@dcl/shop 0.5.1-30934281711.commit-71d435d → 0.5.1-30936490891.commit-42e2634

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 (181) hide show
  1. package/_assets/Activity-CIJJTSUp.js +336 -0
  2. package/_assets/{AnimatedBackground-COSG1YHZ.js → AnimatedBackground-Bv2erZC5.js} +1 -1
  3. package/_assets/{Assets-hxHJCxJp.js → Assets-BoR-QJY6.js} +15 -15
  4. package/_assets/{Assets.styles-CqHMtvn6.js → Assets.styles-BePHQ_QA.js} +1 -1
  5. package/_assets/{Authorizations-Z_3XHseF.js → Authorizations-BCA1IImf.js} +3 -3
  6. package/_assets/{Cart-Csx5bd_E.js → Cart-DTe7zox3.js} +6 -6
  7. package/_assets/{CircularProgress-CxdmiPfO.js → CircularProgress-DzeFXlov.js} +1 -1
  8. package/_assets/{Collection-CCy2cdeV.js → Collection-DHHXSeak.js} +6 -6
  9. package/_assets/{CollectionCarousel-CKFxOqjb.js → CollectionCarousel-Orp4rJm9.js} +7 -7
  10. package/_assets/{Creator-plYQGi53.js → Creator-AMjYkiKe.js} +9 -9
  11. package/_assets/{ErrorNotice-C-nXSZqX.js → ErrorNotice-I9zAvGEr.js} +1 -1
  12. package/_assets/{ExchangeController-DY7abnKb.js → ExchangeController-B-TJWUiW.js} +1 -1
  13. package/_assets/{GetCredits-TNPm_zAt.js → GetCredits-BNkvpwnR.js} +7 -7
  14. package/_assets/{HelpersUtil-DxyZBMvo.js → HelpersUtil-ylN16m8a.js} +1 -1
  15. package/_assets/{ItemDetail-CuLGfIRL.js → ItemDetail-k2BANQ0W.js} +6 -6
  16. package/_assets/{LoadMore-yAi8vsa6.js → LoadMore-DPVuoR5W.js} +1 -1
  17. package/_assets/ManaPricingBanner.styles-nRVCJe8Y.js +74 -0
  18. package/_assets/{MenuList-CtnltPtJ.js → MenuList-yS83NC0F.js} +1 -1
  19. package/_assets/MyAssets-Ds0TK1z5.js +381 -0
  20. package/_assets/{MyFavorites-DvP0qwpm.js → MyFavorites-CDmtpdZP.js} +2 -2
  21. package/_assets/{NotFound-BfV911SO.js → NotFound-CVe0kC-t.js} +1 -1
  22. package/_assets/{NotificationsBell-LBfk_tmW.js → NotificationsBell-Fprokx0Q.js} +1 -1
  23. package/_assets/{OutfitDetail-CUGDW7tY.js → OutfitDetail-CdEsz8A4.js} +10 -10
  24. package/_assets/{OutfitPreview-BbEqr4QU.js → OutfitPreview-Y1WhUQaY.js} +2 -2
  25. package/_assets/{OutfitStudio-C7sSmIlF.js → OutfitStudio-B9G6xI3H.js} +11 -11
  26. package/_assets/{StoreSettings-CPNAijT4.js → StoreSettings-RMqF_ccU.js} +9 -9
  27. package/_assets/{Success-CoreUida.js → Success-rJNIKLQ6.js} +6 -6
  28. package/_assets/{SwapController-CEnoFZxK.js → SwapController-CgtlXeu5.js} +1 -1
  29. package/_assets/{Tooltip-D2z-c3xY.js → Tooltip-D1Bg11IA.js} +1 -1
  30. package/_assets/{TradeService-C0WM0IK5.js → TradeService-BhQmC5tm.js} +1 -1
  31. package/_assets/{W3MFrameProviderSingleton-DHADoYvF.js → W3MFrameProviderSingleton-D-orryVV.js} +3 -3
  32. package/_assets/{WebCryptoP256-D3CAJ1hZ.js → WebCryptoP256-Ckj1TqYw.js} +1 -1
  33. package/_assets/{authorizations-DKmCykqz.js → authorizations-vn6dbOqY.js} +1 -1
  34. package/_assets/{basic-CEhjKQJL.js → basic-D2f8I1xA.js} +1 -1
  35. package/_assets/{biconomy-BykCCfMc.js → biconomy-BZAxWDGN.js} +1 -1
  36. package/_assets/{browseLayout.styles-BrABo9Hf.js → browseLayout.styles-BYrLBkl5.js} +4 -4
  37. package/_assets/{builder-BkXoi_6e.js → builder-DT_IucDZ.js} +1 -1
  38. package/_assets/{buy-gasless-CGeqOHtJ.js → buy-gasless-DP35z8wI.js} +1 -1
  39. package/_assets/buy-k-76F4x2.js +1 -0
  40. package/_assets/{categories-2xUKydml.js → categories-_gS0pssw.js} +1 -1
  41. package/_assets/{ccip-BlVvJTli.js → ccip-B4KLf1_A.js} +1 -1
  42. package/_assets/{ccip-CADVZTOO.js → ccip-skuYIwjJ.js} +1 -1
  43. package/_assets/{clsx-CqnJSHSW.js → clsx-BtU7gPvo.js} +1 -1
  44. package/_assets/{controller-BP8z62yr.js → controller-BkNCBo5Z.js} +2 -2
  45. package/_assets/{core-CI5jAIo9.js → core-NV0Q-IPg.js} +4 -4
  46. package/_assets/{createSvgIcon-C_0Xv0NV.js → createSvgIcon-ONkmiYB6.js} +1 -1
  47. package/_assets/{custom-iCYkgXy_.js → custom-B2TqKkEi.js} +1 -1
  48. package/_assets/{data-capture-Bvpb1Gue.js → data-capture-ubD-gh1z.js} +1 -1
  49. package/_assets/{email-DGY8FmZr.js → email-yk5CxwkK.js} +1 -1
  50. package/_assets/{embedded-wallet-DGdykNIW.js → embedded-wallet-Sdgu7IIM.js} +1 -1
  51. package/_assets/{emotion-styled.browser.esm-BcV8HqIx.js → emotion-styled.browser.esm-Bi-gHJrz.js} +1 -1
  52. package/_assets/{engine-CG5_hJfk.js → engine-tdlero6P.js} +1 -1
  53. package/_assets/{errors-N8U87ba-.js → errors-WsZgWksO.js} +1 -1
  54. package/_assets/{estimate-l1-fee-BOQxb4ii.js → estimate-l1-fee-CyMpT0rk.js} +1 -1
  55. package/_assets/{execute-fo7nVUhk.js → execute-C4cl9W-o.js} +2 -2
  56. package/_assets/{features-Dg1ILYcD.js → features-CZqcLmC4.js} +1 -1
  57. package/_assets/{fetchTokenMetadata-WWZG1mk5.js → fetchTokenMetadata-CS5UBL6x.js} +2 -2
  58. package/_assets/{field.styles-D-WXHTOH.js → field.styles-CJlWBLbF.js} +1 -1
  59. package/_assets/{get-ecosystem-wallet-info-CImjdvym.js → get-ecosystem-wallet-info-07JzLM0i.js} +1 -1
  60. package/_assets/{getBalance-CRQfFcYC.js → getBalance-DL9ADD0u.js} +1 -1
  61. package/_assets/{getNFT-D3KLRabb.js → getNFT-D17z9oKn.js} +1 -1
  62. package/_assets/{getNFT-B2PC0-g2.js → getNFT-DoaFm4AC.js} +1 -1
  63. package/_assets/{getThemeProps-DmYVP8OC.js → getThemeProps-Cl72yIFf.js} +1 -1
  64. package/_assets/{grid.styles-wzi16hJ0.js → grid.styles-BZnnDTVu.js} +1 -1
  65. package/_assets/{hashTypedData-BDhBKMw7.js → hashTypedData-CrsUYWGu.js} +1 -1
  66. package/_assets/{hashTypedData-7f24Qmm1.js → hashTypedData-wJwJpwvj.js} +1 -1
  67. package/_assets/{in-app-Dw1uWQch.js → in-app-Btz7IDiL.js} +1 -1
  68. package/_assets/{in-app-wallet-calls-Ced-Hk1u.js → in-app-wallet-calls-DP3IphiJ.js} +1 -1
  69. package/_assets/{index-miM7OoYW.js → index-639jix5x.js} +1 -1
  70. package/_assets/{index-Bv6jRoUh.js → index-7BMeGSgL.js} +1 -1
  71. package/_assets/{index-HcU1BZGi.js → index-8SWxdM-1.js} +1 -1
  72. package/_assets/{index-BSJOsaoy.js → index-B59Gh8B7.js} +1 -1
  73. package/_assets/{index-DGhB3WMs.js → index-B5UKanqd.js} +1 -1
  74. package/_assets/{index-Dh2nN1pf.js → index-BE-fLnWc.js} +1 -1
  75. package/_assets/{index-C0tjFuh4.js → index-BM3ki5xD.js} +1 -1
  76. package/_assets/{index-B1-7yuu3.js → index-BQimjtyT.js} +3 -3
  77. package/_assets/{index-cgof2fbB.js → index-BVdlPUJG.js} +1 -1
  78. package/_assets/{index-BUZJwPmQ.js → index-BYbz0Puw.js} +1 -1
  79. package/_assets/{index-Bbu6XUqy.js → index-BbQMVOsy.js} +3 -3
  80. package/_assets/{index-B1l_Uvp9.js → index-BeQhSahz.js} +1 -1
  81. package/_assets/{index-Bkg0Qrp6.js → index-Bi_Apm6j.js} +1 -1
  82. package/_assets/{index-D3jBjpLf.js → index-BlQcf37-.js} +1 -1
  83. package/_assets/{index-Nu_iUU26.js → index-BtwYGrhd.js} +1 -1
  84. package/_assets/{index-BQE1lbNd.js → index-BxzWlq1h.js} +1 -1
  85. package/_assets/{index-DRMZKNFH.js → index-C0xJOFUc.js} +1 -1
  86. package/_assets/{index-BRAjDYmB.js → index-C1Z_9GsV.js} +1 -1
  87. package/_assets/{index-Drfl98A2.js → index-C45bHTUp.js} +1 -1
  88. package/_assets/{index-DyghLCFO.js → index-C7KsfPUz.js} +1 -1
  89. package/_assets/{index-DfnFAWTr.js → index-CBXYUzDZ.js} +2 -2
  90. package/_assets/{index-B0rKW0gc.js → index-CFksIzM4.js} +1 -1
  91. package/_assets/{index-DDu4b2rq.js → index-CL530K8Y.js} +1 -1
  92. package/_assets/{index-CRdySivd.js → index-CMFliAhY.js} +1 -1
  93. package/_assets/{index-uh1KT2cw.js → index-CPdKHNCF.js} +1 -1
  94. package/_assets/{index-CFw8nBxU.js → index-CQQrdcNQ.js} +1 -1
  95. package/_assets/{index-C53xszMs.js → index-CZF0PGAb.js} +1 -1
  96. package/_assets/{index-B_dncyHS.js → index-CbHNXAwv.js} +2 -2
  97. package/_assets/{index-DQsiee3b.js → index-Ci8PIdRp.js} +1 -1
  98. package/_assets/{index-CBpSiNz5.js → index-ClHp2_nl.js} +1 -1
  99. package/_assets/{index-DpqAhSTM.js → index-CrWSaqPI.js} +1 -1
  100. package/_assets/{index-BPGvNzFI.js → index-CtASwK4E.js} +1 -1
  101. package/_assets/{index-x992Sn-f.js → index-CtaCRDRI.js} +1 -1
  102. package/_assets/{index-DHYMCRcr.js → index-Cxty1u3d.js} +1 -1
  103. package/_assets/{index-lG7DN5xF.js → index-CzghBU6C.js} +1 -1
  104. package/_assets/{index-_SEhAywg.js → index-D4hVVIWp.js} +1 -1
  105. package/_assets/{index-BCvO08kk.js → index-DJ-CxX91.js} +1 -1
  106. package/_assets/{index-BD0M18Fj.js → index-DKnXZSeg.js} +1 -1
  107. package/_assets/{index-CiM8C2LD.js → index-DQM4pVOP.js} +1 -1
  108. package/_assets/{index-DLdGvRZQ.js → index-DcebaGnX.js} +1 -1
  109. package/_assets/{index-DFzINjaK.js → index-DimCwX0M.js} +1 -1
  110. package/_assets/{index-B3Hj28R0.js → index-DjltGmXq.js} +1 -1
  111. package/_assets/{index-DaLiUn8r.js → index-Dlg6tqPP.js} +1 -1
  112. package/_assets/{index-BpZz3bw9.js → index-DpOehH6H.js} +3 -3
  113. package/_assets/{index-Da1IWtza.js → index-Dy5Vw1H0.js} +91 -91
  114. package/_assets/{index-WEZnjywW.js → index-EECYRahm.js} +1 -1
  115. package/_assets/index-EheyvR55.js +472 -0
  116. package/_assets/{index-BiDNavgD.js → index-IsmxguMZ.js} +1 -1
  117. package/_assets/{index-D0Aqcjc0.js → index-O4FksRMn.js} +1 -1
  118. package/_assets/{index-BKjuIcZ1.js → index-grgWjFlo.js} +1 -1
  119. package/_assets/{index-BxR8fKca.js → index-m00Y2hq4.js} +1 -1
  120. package/_assets/{index-CgIgZ8TZ.js → index-nNKO8ftl.js} +2 -2
  121. package/_assets/{index.es-4XDsATwL.js → index.es-BzqwGWTI.js} +4 -4
  122. package/_assets/{index.es-DSpyirS0.js → index.es-KzvQwqfO.js} +1 -1
  123. package/_assets/{index.es-teXV_ogJ.js → index.es-StMi_Ya4.js} +1 -1
  124. package/_assets/{localBatchGatewayRequest-DeyVc56J.js → localBatchGatewayRequest-DQGGi_PU.js} +1 -1
  125. package/_assets/{mana-convert-DnJmYgcw.js → mana-convert-D_y2vjtn.js} +1 -1
  126. package/_assets/{networks-1b8NsW4Y.js → networks-DDcMYhGU.js} +1 -1
  127. package/_assets/{onramp-hTLhj5ti.js → onramp-CBdambV_.js} +1 -1
  128. package/_assets/{openzeppelin-BJlHJFSk.js → openzeppelin-DSxwqs4i.js} +1 -1
  129. package/_assets/{parseNft-DkIiwdC7.js → parseNft-DHPQc0OX.js} +2 -2
  130. package/_assets/{parseSignature-DQwihZkm.js → parseSignature-CGumShnk.js} +1 -1
  131. package/_assets/{parseSignature-CvH9K2oI.js → parseSignature-DJF5siOG.js} +3 -3
  132. package/_assets/{passkeys-IvY3Iqv-.js → passkeys-C9h38bzo.js} +1 -1
  133. package/_assets/{pay-with-exchange-BdHjrEQV.js → pay-with-exchange-CdWIlkYG.js} +1 -1
  134. package/_assets/{qr-overlay-BYsKakQ3.js → qr-overlay-DfYnP7zW.js} +1 -1
  135. package/_assets/{receive-YK_fd_CU.js → receive-BDPZr_50.js} +1 -1
  136. package/_assets/{resolveImplementation-DPilssBn.js → resolveImplementation-1IibNw8J.js} +1 -1
  137. package/_assets/{rpc-Sc56-gmm.js → rpc-Be4cuLO-.js} +1 -1
  138. package/_assets/{secp256k1-D_5VBkHj.js → secp256k1-C2A9iNFQ.js} +1 -1
  139. package/_assets/{secp256k1-Cc4QlgFt.js → secp256k1-CBaRftLy.js} +1 -1
  140. package/_assets/{secp256k1-mkhJYubv.js → secp256k1-CfSstl_L.js} +1 -1
  141. package/_assets/{send-DeNQyeKY.js → send-DpFdmYN7.js} +1 -1
  142. package/_assets/{send-batch-transaction-DNMKl7ky.js → send-batch-transaction-Bfap8p0Z.js} +1 -1
  143. package/_assets/{send-eip712-transaction-CDu2CS-m.js → send-eip712-transaction-Ca7s6qzX.js} +2 -2
  144. package/_assets/{send-gasless-transaction-BfQQxuNb.js → send-gasless-transaction-DPOigmTX.js} +2 -2
  145. package/_assets/{send-transaction-egO16iDc.js → send-transaction-D2BNOa_n.js} +2 -2
  146. package/_assets/{sendMetaTransaction-kBil2Ej7.js → sendMetaTransaction-feJSI2TG.js} +1 -1
  147. package/_assets/{sendRawTransaction-8z5-lN6F.js → sendRawTransaction-B-XApuqY.js} +3 -3
  148. package/_assets/{serializeTransaction-D2h63c4_.js → serializeTransaction-I8okodGI.js} +1 -1
  149. package/_assets/{session-proposal-DW2kA8O7.js → session-proposal-DvL8lvR_.js} +1 -1
  150. package/_assets/{session-request-CPMpN15W.js → session-request-BXYdMjrw.js} +2 -2
  151. package/_assets/{signing-DPwEu2UU.js → signing-DT63E54M.js} +3 -3
  152. package/_assets/{socials-CBKa2AOj.js → socials-ClcK9a8P.js} +1 -1
  153. package/_assets/{swaps-xpOfH90g.js → swaps-C0ufdoJC.js} +1 -1
  154. package/_assets/{thirdweb-DzBPyGMD.js → thirdweb-B50LsjvD.js} +3 -3
  155. package/_assets/{to-serializable-transaction-Cq1PN1aZ.js → to-serializable-transaction-D0wz5egz.js} +2 -2
  156. package/_assets/{trade-encoding-4xiglK48.js → trade-encoding-SVWWPYXU.js} +1 -1
  157. package/_assets/{transactionReceipt-Bx1LFZ2X.js → transactionReceipt-BW33bMK1.js} +1 -1
  158. package/_assets/{transactions-ncGplKHW.js → transactions-Dydjvljn.js} +1 -1
  159. package/_assets/{useCreditPacks-BElseyte.js → useCreditPacks-BFQph8eD.js} +1 -1
  160. package/_assets/useImportable-BP4DqZ-f.js +1 -0
  161. package/_assets/{useInfiniteGrid-RdlgtcqE.js → useInfiniteGrid-Dz6b_PHh.js} +1 -1
  162. package/_assets/useManaRate-CfhYfW7C.js +1 -0
  163. package/_assets/{useStore-C66JN0w6.js → useStore-ff9cCCX6.js} +1 -1
  164. package/_assets/{useTheme-DO99UzMT.js → useTheme-BzWpoSXD.js} +1 -1
  165. package/_assets/{verifyHash-DdYLeP97.js → verifyHash-6ZvXkv0_.js} +1 -1
  166. package/_assets/{w3m-modal-CD6HTrJ3.js → w3m-modal-B5LvO_YQ.js} +1 -1
  167. package/_assets/{w3m-modal-C0b4AnQ3.js → w3m-modal-BI6MOh7J.js} +1 -1
  168. package/_assets/{wait-for-tx-receipt-CYCUuRY7.js → wait-for-tx-receipt-B6htZpEq.js} +1 -1
  169. package/_assets/{wallets-B_igN3zv.js → wallets-cwZJIsw-.js} +5 -5
  170. package/_assets/{web-connector-DtLrUYHU.js → web-connector-BMBh8mIE.js} +3 -3
  171. package/_assets/{writeContract-CvTh4kpk.js → writeContract-C3lGbTIC.js} +1 -1
  172. package/_assets/{zoraTestnet-vikR0D9L.js → zoraTestnet-Dvb_L0a4.js} +1 -1
  173. package/index.html +11 -11
  174. package/package.json +2 -2
  175. package/_assets/Activity-DbEcN_ip.js +0 -291
  176. package/_assets/ImportListings-BJ0q3u26.js +0 -472
  177. package/_assets/ManaPricingBanner.styles-ByRxQdOU.js +0 -74
  178. package/_assets/MyAssets-CkgpQXbD.js +0 -381
  179. package/_assets/buy-DKJg2rHj.js +0 -1
  180. package/_assets/mana-rate-CC5D3Meh.js +0 -1
  181. package/_assets/useManaRate-DAwFZ75M.js +0 -1
@@ -1,6 +1,6 @@
1
- import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as a,l as R,m as F,b as e,n as G,o as O,I as z,p as B,u as w,q as K,c as Q,v as H,w as A,j as X,x as Z,y as T}from"./index-Da1IWtza.js";import{a as J,b as U,d as V,f as Y,s as tt,h as it}from"./authorizations-DKmCykqz.js";import{f as et}from"./builder-BkXoi_6e.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-N8U87ba-.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-kBil2Ej7.js";const nt=R`
1
+ import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as a,o as D,q as F,b as e,n as G,v as O,I as z,w as B,u as w,x as K,c as Q,y as H,z as A,j as X,A as Z,D as T}from"./index-Dy5Vw1H0.js";import{a as J,b as U,c as V,d as Y,s as tt,e as it}from"./authorizations-vn6dbOqY.js";import{f as et}from"./builder-DT_IucDZ.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-WsZgWksO.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-feJSI2TG.js";const nt=D`
2
2
  to { transform: rotate(360deg); }
3
- `,st=R`
3
+ `,st=D`
4
4
  to { background-position: -200% 0; }
5
5
  `,rt=n.section`
6
6
  width: 100%;
@@ -183,4 +183,4 @@ import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as
183
183
  margin: 6px 0 0;
184
184
  `,M=n(W)`
185
185
  margin-top: 12px;
186
- `;function j({descriptor:t,owner:s,signer:r,name:o,description:c,image:l,icon:p}){const v=K(),[h,y]=P.useState(!1),{data:u,isLoading:m,refetch:d}=w({queryKey:["authorization",t.id,s],queryFn:()=>it(t,s),staleTime:3e4});async function g(){if(h||m)return;const b=!u;y(!0);try{await tt({auth:t,signer:r,active:b}),await d(),v.setQueryData(["authorization",t.id,s],b),A.success(b?e("authorizations.toastActivated",{name:o}):e("authorizations.toastDeactivated",{name:o}))}catch($){X($,{flow:"authorizations",step:b?"grant":"revoke"}),A.error(at($,e("authorizations.errorGeneric")))}finally{y(!1)}}const D=m?e("authorizations.checking"):u?e("authorizations.active"):e("authorizations.inactive");return i.jsxs(ut,{"data-testid":`authorization-${t.id}`,"data-active":!!u,children:[i.jsx(pt,{children:l?i.jsx("img",{src:l,alt:""}):p}),i.jsxs(mt,{children:[i.jsx(gt,{title:o,children:o}),i.jsx(xt,{children:c})]}),i.jsxs(yt,{children:[i.jsx(ft,{"data-active":!!u,children:D}),h?i.jsx(zt,{"aria-label":e("authorizations.working")}):i.jsx(bt,{type:"button","data-testid":`authorization-toggle-${t.id}`,"data-active":!!u,role:"switch","aria-checked":!!u,"aria-label":u?e("authorizations.deactivateAria",{name:o}):e("authorizations.activateAria",{name:o}),disabled:m,onClick:()=>void g()})]})]})}const f=500,q=10,wt=f*q;async function N(t,s){const r=await T(t,{category:s,first:f}),o=Math.min(Math.ceil(r.total/f),q),c=await Promise.all(Array.from({length:Math.max(0,o-1)},(l,p)=>T(t,{category:s,first:f,skip:(p+1)*f})));return{assets:[...r.assets,...c.flatMap(l=>l.assets)],truncated:r.total>wt}}function vt(t){return w({queryKey:["owned-collections",t],enabled:!!t,staleTime:6e4,queryFn:async()=>{const[s,r]=await Promise.all([N(t,"wearable"),N(t,"emote")]),o=new Map;for(const c of[...s.assets,...r.assets]){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return{collections:[...o.values()],truncated:s.truncated||r.truncated,scanned:s.assets.length+r.assets.length}}})}function kt(t){return w({queryKey:["contract-registry"],enabled:t,staleTime:1/0,gcTime:1/0,queryFn:Z})}function Ct(t,s){const r=s==null?void 0:s.get(t.toLowerCase());if(r)return r;const o=H(t);return o===t?e("authorizations.collectionFallback"):o}function $t(t,s){return w({queryKey:["creator-collections",t],enabled:!!t&&!!s,staleTime:6e4,queryFn:async()=>{const r=await et(t,s),o=new Map;for(const c of r){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return[...o.values()]}})}function _t(){F({title:e("authorizations.title"),noindex:!0});const{session:t,signIn:s}=G(),r=Q.chainId,o=O(t==null?void 0:t.providerType),{data:c,isLoading:l}=vt(o?t==null?void 0:t.address:void 0),{data:p,isLoading:v}=kt(!!o&&!!(t!=null&&t.address)),{data:h,isLoading:y}=$t(o?t==null?void 0:t.address:void 0,o?t==null?void 0:t.identity:void 0);if(!t)return i.jsxs(S,{children:[i.jsx(z,{name:"info",size:40,color:a.colors.muted2}),i.jsx(L,{children:e("authorizations.signInTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.signInBody")}),i.jsx(M,{variant:"purple",onClick:()=>s(),children:e("storeSettings.signIn")})]});if(!o)return i.jsxs(S,{children:[i.jsx(z,{name:"check",size:40,color:a.colors.ok}),i.jsx(L,{children:e("authorizations.managedTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.managedBody")}),i.jsx(M,{as:_,to:"/items",variant:"purple",children:e("authorizations.managedCta")})]});const u=J(r),m=U(r);return i.jsxs(rt,{children:[i.jsxs(ct,{children:[i.jsx(lt,{children:e("authorizations.title")}),i.jsx(dt,{children:e("authorizations.intro")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.buyingTitle")}),i.jsxs(x,{children:[i.jsx(j,{descriptor:u,owner:t.address,signer:t.signer,name:e("authorizations.creditsName"),description:e("authorizations.creditsDesc"),icon:i.jsx(B,{className:"ccy-mark"})}),i.jsx(j,{descriptor:m,owner:t.address,signer:t.signer,name:e("authorizations.manaName"),description:e("authorizations.manaDesc"),icon:i.jsx(ht,{src:ot,alt:"","aria-hidden":!0})})]})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.sellingTitle")}),c!=null&&c.truncated?i.jsx(jt,{"data-testid":"authorizations-selling-truncated",children:e("authorizations.sellingTruncated",{count:c.scanned})}):null,l||v?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(E,{"aria-hidden":!0},g))}):c&&c.collections.length>0?i.jsx(x,{children:c.collections.map(d=>i.jsx(j,{descriptor:V(d.contractAddress,r),owner:t.address,signer:t.signer,name:Ct(d.contractAddress,p),description:e("authorizations.sellingDesc"),image:d.image,icon:i.jsx(z,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.sellingEmpty")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.mintingTitle")}),y?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(E,{"aria-hidden":!0},g))}):h&&h.length>0?i.jsx(x,{children:h.map(d=>i.jsx(j,{descriptor:Y(d.contractAddress,r),owner:t.address,signer:t.signer,name:d.name||e("authorizations.collectionFallback"),description:e("authorizations.mintingDesc"),icon:i.jsx(z,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.mintingEmpty")})]})]})}export{_t as Authorizations};
186
+ `;function j({descriptor:t,owner:s,signer:r,name:o,description:c,image:l,icon:p}){const v=K(),[h,y]=P.useState(!1),{data:u,isLoading:m,refetch:d}=w({queryKey:["authorization",t.id,s],queryFn:()=>it(t,s),staleTime:3e4});async function g(){if(h||m)return;const b=!u;y(!0);try{await tt({auth:t,signer:r,active:b}),await d(),v.setQueryData(["authorization",t.id,s],b),A.success(b?e("authorizations.toastActivated",{name:o}):e("authorizations.toastDeactivated",{name:o}))}catch($){X($,{flow:"authorizations",step:b?"grant":"revoke"}),A.error(at($,e("authorizations.errorGeneric")))}finally{y(!1)}}const q=m?e("authorizations.checking"):u?e("authorizations.active"):e("authorizations.inactive");return i.jsxs(ut,{"data-testid":`authorization-${t.id}`,"data-active":!!u,children:[i.jsx(pt,{children:l?i.jsx("img",{src:l,alt:""}):p}),i.jsxs(mt,{children:[i.jsx(gt,{title:o,children:o}),i.jsx(xt,{children:c})]}),i.jsxs(yt,{children:[i.jsx(ft,{"data-active":!!u,children:q}),h?i.jsx(zt,{"aria-label":e("authorizations.working")}):i.jsx(bt,{type:"button","data-testid":`authorization-toggle-${t.id}`,"data-active":!!u,role:"switch","aria-checked":!!u,"aria-label":u?e("authorizations.deactivateAria",{name:o}):e("authorizations.activateAria",{name:o}),disabled:m,onClick:()=>void g()})]})]})}const f=500,R=10,wt=f*R;async function N(t,s){const r=await T(t,{category:s,first:f}),o=Math.min(Math.ceil(r.total/f),R),c=await Promise.all(Array.from({length:Math.max(0,o-1)},(l,p)=>T(t,{category:s,first:f,skip:(p+1)*f})));return{assets:[...r.assets,...c.flatMap(l=>l.assets)],truncated:r.total>wt}}function vt(t){return w({queryKey:["owned-collections",t],enabled:!!t,staleTime:6e4,queryFn:async()=>{const[s,r]=await Promise.all([N(t,"wearable"),N(t,"emote")]),o=new Map;for(const c of[...s.assets,...r.assets]){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return{collections:[...o.values()],truncated:s.truncated||r.truncated,scanned:s.assets.length+r.assets.length}}})}function kt(t){return w({queryKey:["contract-registry"],enabled:t,staleTime:1/0,gcTime:1/0,queryFn:Z})}function Ct(t,s){const r=s==null?void 0:s.get(t.toLowerCase());if(r)return r;const o=H(t);return o===t?e("authorizations.collectionFallback"):o}function $t(t,s){return w({queryKey:["creator-collections",t],enabled:!!t&&!!s,staleTime:6e4,queryFn:async()=>{const r=await et(t,s),o=new Map;for(const c of r){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return[...o.values()]}})}function _t(){F({title:e("authorizations.title"),noindex:!0});const{session:t,signIn:s}=G(),r=Q.chainId,o=O(t==null?void 0:t.providerType),{data:c,isLoading:l}=vt(o?t==null?void 0:t.address:void 0),{data:p,isLoading:v}=kt(!!o&&!!(t!=null&&t.address)),{data:h,isLoading:y}=$t(o?t==null?void 0:t.address:void 0,o?t==null?void 0:t.identity:void 0);if(!t)return i.jsxs(S,{children:[i.jsx(z,{name:"info",size:40,color:a.colors.muted2}),i.jsx(L,{children:e("authorizations.signInTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.signInBody")}),i.jsx(M,{variant:"purple",onClick:()=>s(),children:e("storeSettings.signIn")})]});if(!o)return i.jsxs(S,{children:[i.jsx(z,{name:"check",size:40,color:a.colors.ok}),i.jsx(L,{children:e("authorizations.managedTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.managedBody")}),i.jsx(M,{as:_,to:"/items",variant:"purple",children:e("authorizations.managedCta")})]});const u=J(r),m=U(r);return i.jsxs(rt,{children:[i.jsxs(ct,{children:[i.jsx(lt,{children:e("authorizations.title")}),i.jsx(dt,{children:e("authorizations.intro")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.buyingTitle")}),i.jsxs(x,{children:[i.jsx(j,{descriptor:u,owner:t.address,signer:t.signer,name:e("authorizations.creditsName"),description:e("authorizations.creditsDesc"),icon:i.jsx(B,{className:"ccy-mark"})}),i.jsx(j,{descriptor:m,owner:t.address,signer:t.signer,name:e("authorizations.manaName"),description:e("authorizations.manaDesc"),icon:i.jsx(ht,{src:ot,alt:"","aria-hidden":!0})})]})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.sellingTitle")}),c!=null&&c.truncated?i.jsx(jt,{"data-testid":"authorizations-selling-truncated",children:e("authorizations.sellingTruncated",{count:c.scanned})}):null,l||v?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(E,{"aria-hidden":!0},g))}):c&&c.collections.length>0?i.jsx(x,{children:c.collections.map(d=>i.jsx(j,{descriptor:V(d.contractAddress,r),owner:t.address,signer:t.signer,name:Ct(d.contractAddress,p),description:e("authorizations.sellingDesc"),image:d.image,icon:i.jsx(z,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.sellingEmpty")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.mintingTitle")}),y?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(E,{"aria-hidden":!0},g))}):h&&h.length>0?i.jsx(x,{children:h.map(d=>i.jsx(j,{descriptor:Y(d.contractAddress,r),owner:t.address,signer:t.signer,name:d.name||e("authorizations.collectionFallback"),description:e("authorizations.mintingDesc"),icon:i.jsx(z,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.mintingEmpty")})]})]})}export{_t as Authorizations};
@@ -1,4 +1,4 @@
1
- import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t as le,s as i,b as s,ao as de,a_ as sa,an as na,I as O,p as Mt,a9 as Ne,m as ia,L as Q,ab as dt,n as ra,u as oa,a$ as ca,q as da,b0 as la,b1 as ua,b2 as ha,b3 as pa,o as ga,b4 as lt,O as G,b5 as ut,b6 as xa,j as ae,c as ht,b7 as ma,d as fa,b8 as pt,b9 as Re,ba as ye,bb as be,bc as gt,g as ve,e as ya,C as We,bd as ba}from"./index-Da1IWtza.js";import{M as va,S as wa,C as Ca,H as ja,a as ka,T as $a,X as Sa,b as Ma,B as Ta,c as Ia,d as xt,e as Pa,f as ke,P as Tt,m as za,g as Aa,h as Ea,i as qa,j as It,k as $e,L as _a,l as Ba,n as mt,o as ft,W as Ra,p as Wa,q as Fa,A as La,r as Ka,s as Ua,t as Na,u as Qa,v as Oa,w as Ha,x as Va,y as Ga,z as Da,D as Ya,E as Ja,F as Xa,G as Za,I as es,J as ts,K as Fe,N as as,O as ss,Q as ns,R as is,U as yt,V as bt,Y as rs,Z as os,_ as cs}from"./CollectionCarousel-CKFxOqjb.js";import{u as ds}from"./useManaRate-DAwFZ75M.js";import{r as ls}from"./mana-rate-CC5D3Meh.js";import{j as us,k as hs,h as ps,n as gs,i as xs,A as ms}from"./authorizations-DKmCykqz.js";import{u as fs,g as ys,b as Le}from"./buy-DKJg2rHj.js";import{b as bs,w as vs,S as vt,G as ws}from"./buy-gasless-CGeqOHtJ.js";import{u as Cs,M as js,R as we,r as ks,c as $s,p as wt}from"./useCreditPacks-BElseyte.js";import{i as Ss,a as Ms}from"./errors-N8U87ba-.js";import{E as Ts}from"./ErrorNotice-C-nXSZqX.js";import{u as Ct}from"./mana-convert-DnJmYgcw.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-4xiglK48.js";import"./sendMetaTransaction-kBil2Ej7.js";const{colors:se,radius:Is}=le,Ps=i.div`
1
+ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t as le,s as i,b as s,ar as de,a_ as sa,aq as na,I as O,w as Mt,ac as Ne,q as ia,O as Q,ae as dt,n as ra,u as oa,a$ as ca,x as da,b0 as la,b1 as ua,b2 as ha,b3 as pa,v as ga,b4 as lt,R as G,b5 as ut,b6 as xa,j as ae,c as ht,b7 as ma,C as fa,b8 as pt,b9 as Be,ba as ye,bb as be,bc as gt,g as ve,d as ya,e as We,bd as ba}from"./index-Dy5Vw1H0.js";import{M as va,S as wa,C as Ca,H as ja,a as ka,T as $a,X as Sa,b as Ma,B as Ta,c as Ia,d as xt,e as Pa,f as ke,P as Tt,m as za,g as Aa,h as Ea,i as qa,j as It,k as $e,L as Ra,l as _a,n as mt,o as ft,W as Ba,p as Wa,q as Fa,A as La,r as Ka,s as Ua,t as Na,u as Qa,v as Oa,w as Ha,x as Va,y as Ga,z as Da,D as Ya,E as Ja,F as Xa,G as Za,I as es,J as ts,K as Fe,N as as,O as ss,Q as ns,R as is,U as yt,V as bt,Y as rs,Z as os,_ as cs}from"./CollectionCarousel-Orp4rJm9.js";import{u as ds}from"./useManaRate-CfhYfW7C.js";import{u as ls,r as us,g as hs,b as Le}from"./buy-k-76F4x2.js";import{j as ps,k as gs,e as xs,n as ms,f as fs,A as ys}from"./authorizations-vn6dbOqY.js";import{b as bs,w as vs,S as vt,G as ws}from"./buy-gasless-DP35z8wI.js";import{u as Cs,M as js,R as we,r as ks,c as $s,p as wt}from"./useCreditPacks-BFQph8eD.js";import{i as Ss,a as Ms}from"./errors-WsZgWksO.js";import{E as Ts}from"./ErrorNotice-I9zAvGEr.js";import{u as Ct}from"./mana-convert-D_y2vjtn.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-SVWWPYXU.js";import"./sendMetaTransaction-feJSI2TG.js";const{colors:se,radius:Is}=le,Ps=i.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -58,7 +58,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
58
58
  font-weight: 700;
59
59
  color: ${se.text};
60
60
  }
61
- `,_s="https://cdn.decentraland.org/@dcl/shop/0.5.1-30934281711.commit-71d435d/_assets/buy-error-22UunaPC.png";function Bs(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?s("cartCheckout.errorTitle"):l==="nofunds"?s("cartCheckout.titleNoFunds"):l==="choose"?s("buyModal.choosePayment"):s("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(va,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(wa,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(Ca,{"data-tall":Y||void 0,children:[e.jsxs(ja,{children:[e.jsxs(ka,{children:[e.jsx($a,{children:D}),!W&&e.jsx(Sa,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Ma,{})})]}),e.jsxs(Ta,{children:[e.jsx(Ia,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(xt,{}),e.jsx(Pa,{children:de(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(qs,{children:[e.jsx("span",{children:s("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(xt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=za(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(Rs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Ws,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&e.jsxs(ke,{children:[e.jsxs(Aa,{"data-testid":"buy-error",children:[e.jsx(Ea,{src:_s,alt:"",width:64,height:80}),e.jsxs(qa,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function Rs({stage:o,step:l,total:I,isSelfCustody:z,signatures:W}){const D=o==="reserving",Y=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&W&&W.total>1,ne=o==="awaiting-signature"?z?A?s("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):s("buyModal.confirmToContinue"):s("buyModal.completingTransaction"):o==="settling"?s("buyModal.completingTransaction"):s("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(_a,{src:sa,alt:"",width:61,height:61}),e.jsx(Ba,{children:ne}),D?e.jsxs(Ps,{children:[e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(zs,{children:[l,"/",I]}):null]}):e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{})})]})}function Ws({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:W,onBuyPacks:D,onCancel:Y}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return e.jsxs(ke,{children:[e.jsxs(Ra,{"data-testid":"nofunds-warning",children:[e.jsx(Wa,{}),e.jsxs(Fa,{children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",s("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(As,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(La,{children:[e.jsx(Ka,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ua,{children:[e.jsxs("div",{children:[e.jsxs(Na,{title:n.item.name,children:[n.item.name||s("buyModal.itemFallback"),L>1?e.jsx(Es,{children:s("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Qa,{address:n.item.creator}):null]}),e.jsxs(Oa,{children:[e.jsx(Ha,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Va,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Ga,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Da,{}),e.jsx(Ya,{children:de(n.credits)}),e.jsxs(Ja,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Xa,{children:[e.jsxs(Za,{children:[e.jsx(es,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(ts,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"gradient",onClick:D,children:s("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=le,zt="@media (max-width: 1080px)",T="@media (max-width: 880px)",jt=i.div`
61
+ `,Rs="https://cdn.decentraland.org/@dcl/shop/0.5.1-30936490891.commit-42e2634/_assets/buy-error-22UunaPC.png";function _s(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?s("cartCheckout.errorTitle"):l==="nofunds"?s("cartCheckout.titleNoFunds"):l==="choose"?s("buyModal.choosePayment"):s("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(va,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(wa,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(Ca,{"data-tall":Y||void 0,children:[e.jsxs(ja,{children:[e.jsxs(ka,{children:[e.jsx($a,{children:D}),!W&&e.jsx(Sa,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Ma,{})})]}),e.jsxs(Ta,{children:[e.jsx(Ia,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(xt,{}),e.jsx(Pa,{children:de(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(qs,{children:[e.jsx("span",{children:s("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(xt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=za(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(Bs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Ws,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&e.jsxs(ke,{children:[e.jsxs(Aa,{"data-testid":"buy-error",children:[e.jsx(Ea,{src:Rs,alt:"",width:64,height:80}),e.jsxs(qa,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function Bs({stage:o,step:l,total:I,isSelfCustody:z,signatures:W}){const D=o==="reserving",Y=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&W&&W.total>1,ne=o==="awaiting-signature"?z?A?s("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):s("buyModal.confirmToContinue"):s("buyModal.completingTransaction"):o==="settling"?s("buyModal.completingTransaction"):s("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(Ra,{src:sa,alt:"",width:61,height:61}),e.jsx(_a,{children:ne}),D?e.jsxs(Ps,{children:[e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(zs,{children:[l,"/",I]}):null]}):e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{})})]})}function Ws({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:W,onBuyPacks:D,onCancel:Y}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return e.jsxs(ke,{children:[e.jsxs(Ba,{"data-testid":"nofunds-warning",children:[e.jsx(Wa,{}),e.jsxs(Fa,{children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",s("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(As,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(La,{children:[e.jsx(Ka,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ua,{children:[e.jsxs("div",{children:[e.jsxs(Na,{title:n.item.name,children:[n.item.name||s("buyModal.itemFallback"),L>1?e.jsx(Es,{children:s("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Qa,{address:n.item.creator}):null]}),e.jsxs(Oa,{children:[e.jsx(Ha,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Va,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Ga,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Da,{}),e.jsx(Ya,{children:de(n.credits)}),e.jsxs(Ja,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Xa,{children:[e.jsxs(Za,{children:[e.jsx(es,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(ts,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"gradient",onClick:D,children:s("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=le,zt="@media (max-width: 1080px)",T="@media (max-width: 880px)",jt=i.div`
62
62
  max-width: 1510px;
63
63
  margin: 0 auto;
64
64
  /* Grows into the page's leftover height and passes it down to Upsell, so the white cross-sell band ends at
@@ -658,13 +658,13 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
658
658
  opacity: 0.6;
659
659
  cursor: default;
660
660
  }
661
- `,_t=Ne`
661
+ `,Rt=Ne`
662
662
  margin: 0;
663
663
  font-size: 13px;
664
664
  `,Ce=i.p`
665
- ${_t};
665
+ ${Rt};
666
666
  `,zn=i(Ts)`
667
- ${_t};
667
+ ${Rt};
668
668
  `,An=i.div`
669
669
  position: relative;
670
670
  /* Takes the leftover height so its white ::before covers it — see .page[data-route="/cart"]. */
@@ -692,4 +692,4 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
692
692
  & section {
693
693
  margin-top: 0;
694
694
  }
695
- `;function Ke(o){if(Ss(o))return s("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?s("cart.error.insufficient",{currency:fa.name}):l.includes("no active listing")||l.includes("your own listing")?s("cart.error.listingChanged"):s("marketCheckout.error.generic")}const En=12e4;function qn(o){const l=[];return o.unavailable.length&&l.push(s("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(s("cart.drop.own",{count:o.own.length})),s("cart.drop.removed",{items:l.join(` ${s("cart.drop.and")} `)})}const Ue=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),je=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Zn(){ia({title:s("nav.cart"),noindex:!0});const o=Q(t=>t.items),l=Q(t=>t.remove),I=Q(t=>t.increment),z=Q(t=>t.decrement),W=Q(t=>t.clear),D=Q(t=>t.restore),Y=Q(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ra(),Bt=fs(),ue=Cs().packs.slice(0,js);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Rt=o.some(t=>t.category!=="emote"),{data:Me}=oa({queryKey:["upsell-listings"],queryFn:()=>ba({first:40}),staleTime:6e4}),{data:$}=ca(n),b=da(),ee=ta(),{state:J}=aa(),[Wt,ie]=P.useState(null),[Qe,he]=P.useState(null),[Ft,_]=P.useState(!1),[B,H]=P.useState(null),Oe=P.useRef(0),[p,j]=P.useState(null),{data:pe}=la(n),{data:re}=ds(!0),[Te,He]=P.useState(""),oe=P.useRef(null),Ve=ua(o),Ge=t=>lt(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Lt=Ie.reduce((t,a)=>t+a.priceCredits*a.quantity,0),Kt=o.reduce((t,a)=>t+a.quantity,0),Ut=Ie.reduce((t,a)=>t+a.quantity,0),De=B?B.liveTotalCredits:Lt,Nt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Nt.has(t.id)).slice(0,12),Qt=new Map(B==null?void 0:B.buyable.map(t=>[t.item.id,t])),ge=($==null?void 0:$.credits)??0,ze=De*10,Ot=re?Ct(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Ot,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),Ht=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Vt=xa,Gt=t=>ma(t.contractAddress,String(t.itemId));function me(t){t(),H(null),he(null),ie(null)}function Dt(){j(null),_(!1)}function Je(t){const a=Ue(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];He(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:a,credits_balance:ge,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),_(!1)}async function Ee(t){if(!n||t.length===0)return;const a=je(t),d=a.map(y=>({...y.item,priceCredits:y.priceCredits})),c=t.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,S=new Set,R=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:a.length});try{const y=[];for(let m=0;m<a.length;m++){const x=a[m];j({phase:"processing",stage:"reserving",step:m+1,total:a.length});try{const M=x.acquisition==="trade"?x.trade.id:void 0,C=x.item.contractAddress&&x.item.itemId!=null?{contractAddress:x.item.contractAddress,itemId:String(x.item.itemId)}:void 0,{credit:N,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:N.id,itemId:x.item.id}),y.push(x.acquisition==="store"?{kind:"store",item:{collection:x.item.contractAddress,itemId:String(x.item.itemId),priceWei:x.priceWei},credits:[N],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[N],maxCreditedValue:X})}catch(M){if(Ms(M)){if(u.length){try{await Re(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=ys(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:a.length,total:a.length,signatures:k(x)}),K=m=>m<g?F("awaiting-signature",m+1):F("settling",g);F("awaiting-signature",1);let f=[];const v=y.some(m=>m.kind==="store"),U=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(us()&&!v)try{const m=new Map;f=await bs({purchases:U,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:N})=>{m.set(C,N),N.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>vs(C)));x.forEach((C,N)=>{const X=m.get(f[N])??[];C.status==="fulfilled"?(X.forEach(Be=>S.add(Be)),E.push(f[N])):C.reason instanceof vt||X.forEach(Be=>R.add(Be))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof vt))throw M[0];q=!0}catch(m){if(!(m instanceof ws))throw m;f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:x})=>x.forEach(M=>w.add(M)),onSettled:({txHash:x,salts:M})=>{M.forEach(C=>S.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>R.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>S.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>R.add(x))});t.forEach(m=>l(m.item.id)),H(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),bt(b);const ce=oe.current;oe.current=null,j(null),_(!1);const _e={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:_e,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!R.has(v))),{toRelease:k,boughtItemIds:F}=wt({reservations:u,spent:g,settled:S}),K=d.filter(v=>F.includes(v.id)),f=d.filter(v=>!F.includes(v.id));if(G(be(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:gt(y),value_usd:ut(f.reduce((v,U)=>v+U.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await Re(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){F.forEach(v=>l(v)),H(null),bt(b),G("Shop Completed Purchase",{...ye(K),payment_type:"credits",no_crypto_step:q,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:s("cart.error.partiallyBought")}),_(!1);return}j({phase:"error",message:Ke(y)})}}function Xe(t,a){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),_(!1);const c={items:t,txHash:a[0]??void 0,txHashes:a,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,a){be(t)||ae(t,{flow:a,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:gt(t)}),j({phase:"error",message:Ke(t)}),_(!1)}async function Yt(t,a){const d=ve(We.MANAToken,a),c=ve(We.CreditsManager,a);await xs({auth:{kind:ms.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:a},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",ht.chainId],queryFn:()=>ls(ht.chainId),staleTime:6e4})}catch{return}}async function Jt(t){const a=je(t).reduce((h,w)=>h+w.usdCents,0),c=(pe??0n)>0n?await et():re,u=c?Ct(a,c):0n;return{totalCents:a,manaWei:u}}async function tt(t,a){const d=Ue(t),{totalCents:c,manaWei:u}=await Jt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ht(t)?{...h,options:h.options.filter(S=>S.method==="credits")}:h;if(a&&w.options.some(S=>S.method===a)){if(a==="credits"){Ee(t);return}const{spender:S,chainId:R}=at(a,t);await st(S,R,()=>a==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some(S=>S.method==="mana"||S.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),_(!1);return}if($!=null&&$.credits<d){Je(t);return}Ee(t)}function Xt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n})}const[qe,fe]=P.useState(null);function at(t,a){const d=Ae(a)[0].trade;return{spender:t==="mana"?ve(ya(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,a,d){const c=hs(a,t),u=n?await ps(c,n.address).catch(()=>!0):!0;if(gs(n==null?void 0:n.providerType,u)){_(!1),fe({auth:c,run:d});return}d()}function Zt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:a,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(a);return}const{spender:u,chainId:h}=at(t,a);st(u,h,()=>t==="mana"?void nt(a):void it(a,d,c))}async function nt(t){if(!n||t.length===0)return;const a=je(t),d=a.map(h=>({...h.item,priceCredits:h.priceCredits})),c=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:a.length,total:a.length});j({phase:"processing",stage:"awaiting-signature",step:a.length,total:a.length});try{const h=await rs({trades:Ae(a).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),H(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,a,d){if(!n||t.length===0)return;const c=je(t),u=c.map(g=>({...g.item,priceCredits:g.priceCredits})),h=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),w=os(c.map(g=>g.usdCents),($==null?void 0:$.balanceCents)??0),S=w.reduce((g,k)=>g+k,0),R=cs(Math.max(0,a-S),a,d),E=[],q=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const g=Ae(c),k=[];for(let f=0;f<g.length;f++){const v=w[f];if(v<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:g.length});const U=g[f].item,{credit:ce,maxCreditedValue:_e}=await pt(n.identity,v,g[f].trade.id,U.contractAddress&&U.itemId!=null?{contractAddress:U.contractAddress,itemId:String(U.itemId)}:void 0);E.push({salt:ce.id,itemId:U.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:_e})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+R).toString()},await Yt(n.signer,g[0].trade.chainId);const F=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const K=await Le({purchases:k,buyer:n.address,signer:n.signer,onSigned:F,onBroadcast:({salts:f})=>f.forEach(v=>q.add(v)),onReverted:({salts:f})=>f.forEach(v=>y.add(v))});t.forEach(f=>l(f.item.id)),H(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,K)}catch(g){const{toRelease:k}=wt({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&Re(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){yt({type:"cart-checkout"}),L();return}const a=Q.getState().items.filter(Ge);if(a.length===0)return;ie(null),he(null),_(!0);const d=a.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:a.length,cart_value_credits:d,cart_value_usd:ut(d),has_sufficient_credits:ge>=d});try{const c=await ks(a,n.address,Vt,await et(),Gt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),he(qn(c))),c.buyable.length===0){ie(s("cart.error.noneAvailable")),H(null);return}if(c.orderChanged){H(c),Oe.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:a.length}),ie(Ke(c))}finally{_(!1)}}async function rt(){if(B){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-Oe.current>En){H(null),he(null),await te();return}ie(null),tt(B.buyable)}}async function ea(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(Q.getState().items))}catch{}_(!0);try{const t=await $s(Te,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}ee("/credits")}catch(t){try{sessionStorage.removeItem(we)}catch{}ae(t,{flow:"cart_buy_credits"}),j({phase:"error",message:s("buyModal.error.creditsCheckout")})}finally{_(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!as("cart-checkout"))return;ot.current=!0;const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[n]);const ct=P.useRef(!1);P.useEffect(()=>{if(!(J!=null&&J.resumeCheckout)||ct.current)return;ct.current=!0,oe.current=J.creditsAdded??null;try{const a=sessionStorage.getItem(we);if(a){sessionStorage.removeItem(we);const d=JSON.parse(a);Array.isArray(d)&&d.length&&D(d)}}catch{}b.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[J==null?void 0:J.resumeCheckout]);const V=Ft||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Us,{"data-testid":"cart-empty",children:[e.jsx(O,{name:"cart-plus",size:110}),e.jsxs(Ns,{children:[e.jsx(Qs,{children:s("cart.empty.title")}),e.jsx(Os,{children:s("cart.empty.body")})]}),e.jsx(Hs,{to:"/items",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Fs,{children:[e.jsxs(Ls,{children:[e.jsxs(Ks,{children:[e.jsx(Vs,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(O,{name:"arrow-left"})}),e.jsx(Gs,{children:s("cart.panelTitle",{count:Kt})}),Rt?e.jsxs(Ds,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(O,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Ys,{children:o.map(t=>{const a=Qt.get(t.id),d=a?a.priceCredits:t.priceCredits,c=!!a&&a.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,S=d*h,R=ha(t),E=!!R&&!!A[R],q=pa(t),y=Ve[t.id],g=!lt(y),k=y==="sold-out"?s("cart.availability.soldOut"):s("cart.availability.unavailable");return e.jsxs(Js,{"data-unavailable":g||void 0,children:[e.jsxs(Xs,{"data-thumb":!0,children:[q?e.jsx(Zs,{to:q,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(en,{"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(tn,{children:[e.jsxs(an,{"data-desc":!0,children:[q?e.jsx(nn,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(sn,{title:t.name,children:t.name}),t.creator?e.jsx(rn,{address:t.creator,linkToProfile:!0}):null,Bt&&u?e.jsxs(fn,{"data-testid":"cart-creator-tag",children:[e.jsx(yn,{name:"buy-from-creator"}),s("cart.creatorTag")]}):null]}),e.jsx(on,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(xn,{name:"warning-fill",size:24}),k]}),q?e.jsx(mn,{to:q,state:{item:t,tradeId:t.tradeId},children:s("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(cn,{children:[e.jsx(St,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":s("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(dn,{children:h}),e.jsx(St,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":s("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(ln,{children:[e.jsx(un,{})," ",S,c?e.jsx(hn,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(pn,{children:[R?e.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?s("cart.removeFromFavorites",{name:t.name}):s("cart.addToFavorites",{name:t.name}),title:E?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx(O,{name:E?"heart-solid":"heart"})}):null,e.jsx(vn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":s("cart.remove",{name:t.name}),title:s("cart.removeTitle"),children:e.jsx(O,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(wn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:s("cart.clearCart")})})]})]}),e.jsxs(Cn,{children:[e.jsx(jn,{children:s("cart.purchaseSummary")}),e.jsxs(kn,{children:[e.jsxs($n,{children:[e.jsx(Sn,{children:s("cart.totalItems",{count:Ut})}),e.jsx(Tn,{children:e.jsxs(Mn,{children:[e.jsx(In,{})," ",De]})})]}),xe.options.length>0||xe.manaShortfall?e.jsx(Tt,{options:xe.options,totalCents:ze,shortfall:xe.manaShortfall,creditsLabel:B?s("marketCheckout.confirmPurchase"):s("cart.buyWithCredits"),busy:V||Pe,onPay:t=>void(B?rt():te(t))}):e.jsx(Pn,{onClick:()=>void(B?rt():te()),disabled:V||Pe,children:V?s("cart.working"):B?s("marketCheckout.confirmPurchase"):s("cart.checkout")}),Pe?e.jsx(Ce,{className:"muted",children:s("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:s("cart.signInHint")}),B?e.jsx(Ce,{className:"muted",children:s("cart.priceChanged")}):null,Qe?e.jsx(Ce,{className:"muted",children:Qe}):null,e.jsx(zn,{message:Wt})]})]})]})]}),Ye.length>0?e.jsx(An,{children:e.jsx(ss,{title:s("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(ns,{auth:qe.auth,signer:n.signer,title:s("authorizeStep.manaTitle"),name:s("authorizeStep.manaName"),reason:s("authorizeStep.manaReason"),icon:e.jsx("img",{src:is,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=qe;fe(null),t()},onCancel:()=>fe(null),onClose:()=>fe(null)}):null,p?e.jsx(Bs,{phase:p.phase,balanceCredits:ge,onClose:Dt,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:ga(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Xt(p).options:void 0,onPay:Zt,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Ue(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:ue,selectedPack:Te,onSelectPack:He,onBuyPacks:()=>void ea(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Zn as Cart};
695
+ `;function Ke(o){if(Ss(o))return s("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?s("cart.error.insufficient",{currency:fa.name}):l.includes("no active listing")||l.includes("your own listing")?s("cart.error.listingChanged"):s("marketCheckout.error.generic")}const En=12e4;function qn(o){const l=[];return o.unavailable.length&&l.push(s("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(s("cart.drop.own",{count:o.own.length})),s("cart.drop.removed",{items:l.join(` ${s("cart.drop.and")} `)})}const Ue=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),je=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Xn(){ia({title:s("nav.cart"),noindex:!0});const o=Q(t=>t.items),l=Q(t=>t.remove),I=Q(t=>t.increment),z=Q(t=>t.decrement),W=Q(t=>t.clear),D=Q(t=>t.restore),Y=Q(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ra(),_t=ls(),ue=Cs().packs.slice(0,js);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Bt=o.some(t=>t.category!=="emote"),{data:Me}=oa({queryKey:["upsell-listings"],queryFn:()=>ba({first:40}),staleTime:6e4}),{data:$}=ca(n),b=da(),ee=ta(),{state:J}=aa(),[Wt,ie]=P.useState(null),[Qe,he]=P.useState(null),[Ft,R]=P.useState(!1),[_,H]=P.useState(null),Oe=P.useRef(0),[p,j]=P.useState(null),{data:pe}=la(n),{data:re}=ds(!0),[Te,He]=P.useState(""),oe=P.useRef(null),Ve=ua(o),Ge=t=>lt(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Lt=Ie.reduce((t,a)=>t+a.priceCredits*a.quantity,0),Kt=o.reduce((t,a)=>t+a.quantity,0),Ut=Ie.reduce((t,a)=>t+a.quantity,0),De=_?_.liveTotalCredits:Lt,Nt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Nt.has(t.id)).slice(0,12),Qt=new Map(_==null?void 0:_.buyable.map(t=>[t.item.id,t])),ge=($==null?void 0:$.credits)??0,ze=De*10,Ot=re?Ct(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Ot,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),Ht=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Vt=xa,Gt=t=>ma(t.contractAddress,String(t.itemId));function me(t){t(),H(null),he(null),ie(null)}function Dt(){j(null),R(!1)}function Je(t){const a=Ue(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];He(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:a,credits_balance:ge,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),R(!1)}async function Ee(t){if(!n||t.length===0)return;const a=je(t),d=a.map(y=>({...y.item,priceCredits:y.priceCredits})),c=t.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,S=new Set,B=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:a.length});try{const y=[];for(let m=0;m<a.length;m++){const x=a[m];j({phase:"processing",stage:"reserving",step:m+1,total:a.length});try{const M=x.acquisition==="trade"?x.trade.id:void 0,C=x.item.contractAddress&&x.item.itemId!=null?{contractAddress:x.item.contractAddress,itemId:String(x.item.itemId)}:void 0,{credit:N,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:N.id,itemId:x.item.id}),y.push(x.acquisition==="store"?{kind:"store",item:{collection:x.item.contractAddress,itemId:String(x.item.itemId),priceWei:x.priceWei},credits:[N],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[N],maxCreditedValue:X})}catch(M){if(Ms(M)){if(u.length){try{await Be(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=hs(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:a.length,total:a.length,signatures:k(x)}),K=m=>m<g?F("awaiting-signature",m+1):F("settling",g);F("awaiting-signature",1);let f=[];const v=y.some(m=>m.kind==="store"),U=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(ps()&&!v)try{const m=new Map;f=await bs({purchases:U,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:N})=>{m.set(C,N),N.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>vs(C)));x.forEach((C,N)=>{const X=m.get(f[N])??[];C.status==="fulfilled"?(X.forEach(_e=>S.add(_e)),E.push(f[N])):C.reason instanceof vt||X.forEach(_e=>B.add(_e))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof vt))throw M[0];q=!0}catch(m){if(!(m instanceof ws))throw m;f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:x})=>x.forEach(M=>w.add(M)),onSettled:({txHash:x,salts:M})=>{M.forEach(C=>S.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>B.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>S.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>B.add(x))});t.forEach(m=>l(m.item.id)),H(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),bt(b);const ce=oe.current;oe.current=null,j(null),R(!1);const Re={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:Re,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!B.has(v))),{toRelease:k,boughtItemIds:F}=wt({reservations:u,spent:g,settled:S}),K=d.filter(v=>F.includes(v.id)),f=d.filter(v=>!F.includes(v.id));if(G(be(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:gt(y),value_usd:ut(f.reduce((v,U)=>v+U.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await Be(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){F.forEach(v=>l(v)),H(null),bt(b),G("Shop Completed Purchase",{...ye(K),payment_type:"credits",no_crypto_step:q,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:s("cart.error.partiallyBought")}),R(!1);return}j({phase:"error",message:Ke(y)})}}function Xe(t,a){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),R(!1);const c={items:t,txHash:a[0]??void 0,txHashes:a,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,a){be(t)||ae(t,{flow:a,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:gt(t)}),j({phase:"error",message:Ke(t)}),R(!1)}async function Yt(t,a){const d=ve(We.MANAToken,a),c=ve(We.CreditsManager,a);await fs({auth:{kind:ys.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:a},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",ht.chainId],queryFn:()=>us(ht.chainId),staleTime:6e4})}catch{return}}async function Jt(t){const a=je(t).reduce((h,w)=>h+w.usdCents,0),c=(pe??0n)>0n?await et():re,u=c?Ct(a,c):0n;return{totalCents:a,manaWei:u}}async function tt(t,a){const d=Ue(t),{totalCents:c,manaWei:u}=await Jt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ht(t)?{...h,options:h.options.filter(S=>S.method==="credits")}:h;if(a&&w.options.some(S=>S.method===a)){if(a==="credits"){Ee(t);return}const{spender:S,chainId:B}=at(a,t);await st(S,B,()=>a==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some(S=>S.method==="mana"||S.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),R(!1);return}if($!=null&&$.credits<d){Je(t);return}Ee(t)}function Xt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n})}const[qe,fe]=P.useState(null);function at(t,a){const d=Ae(a)[0].trade;return{spender:t==="mana"?ve(ya(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,a,d){const c=gs(a,t),u=n?await xs(c,n.address).catch(()=>!0):!0;if(ms(n==null?void 0:n.providerType,u)){R(!1),fe({auth:c,run:d});return}d()}function Zt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:a,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(a);return}const{spender:u,chainId:h}=at(t,a);st(u,h,()=>t==="mana"?void nt(a):void it(a,d,c))}async function nt(t){if(!n||t.length===0)return;const a=je(t),d=a.map(h=>({...h.item,priceCredits:h.priceCredits})),c=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:a.length,total:a.length});j({phase:"processing",stage:"awaiting-signature",step:a.length,total:a.length});try{const h=await rs({trades:Ae(a).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),H(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,a,d){if(!n||t.length===0)return;const c=je(t),u=c.map(g=>({...g.item,priceCredits:g.priceCredits})),h=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),w=os(c.map(g=>g.usdCents),($==null?void 0:$.balanceCents)??0),S=w.reduce((g,k)=>g+k,0),B=cs(Math.max(0,a-S),a,d),E=[],q=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const g=Ae(c),k=[];for(let f=0;f<g.length;f++){const v=w[f];if(v<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:g.length});const U=g[f].item,{credit:ce,maxCreditedValue:Re}=await pt(n.identity,v,g[f].trade.id,U.contractAddress&&U.itemId!=null?{contractAddress:U.contractAddress,itemId:String(U.itemId)}:void 0);E.push({salt:ce.id,itemId:U.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:Re})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+B).toString()},await Yt(n.signer,g[0].trade.chainId);const F=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const K=await Le({purchases:k,buyer:n.address,signer:n.signer,onSigned:F,onBroadcast:({salts:f})=>f.forEach(v=>q.add(v)),onReverted:({salts:f})=>f.forEach(v=>y.add(v))});t.forEach(f=>l(f.item.id)),H(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,K)}catch(g){const{toRelease:k}=wt({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&Be(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){yt({type:"cart-checkout"}),L();return}const a=Q.getState().items.filter(Ge);if(a.length===0)return;ie(null),he(null),R(!0);const d=a.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:a.length,cart_value_credits:d,cart_value_usd:ut(d),has_sufficient_credits:ge>=d});try{const c=await ks(a,n.address,Vt,await et(),Gt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),he(qn(c))),c.buyable.length===0){ie(s("cart.error.noneAvailable")),H(null);return}if(c.orderChanged){H(c),Oe.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:a.length}),ie(Ke(c))}finally{R(!1)}}async function rt(){if(_){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-Oe.current>En){H(null),he(null),await te();return}ie(null),tt(_.buyable)}}async function ea(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(Q.getState().items))}catch{}R(!0);try{const t=await $s(Te,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}ee("/credits")}catch(t){try{sessionStorage.removeItem(we)}catch{}ae(t,{flow:"cart_buy_credits"}),j({phase:"error",message:s("buyModal.error.creditsCheckout")})}finally{R(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!as("cart-checkout"))return;ot.current=!0;const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[n]);const ct=P.useRef(!1);P.useEffect(()=>{if(!(J!=null&&J.resumeCheckout)||ct.current)return;ct.current=!0,oe.current=J.creditsAdded??null;try{const a=sessionStorage.getItem(we);if(a){sessionStorage.removeItem(we);const d=JSON.parse(a);Array.isArray(d)&&d.length&&D(d)}}catch{}b.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[J==null?void 0:J.resumeCheckout]);const V=Ft||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Us,{"data-testid":"cart-empty",children:[e.jsx(O,{name:"cart-plus",size:110}),e.jsxs(Ns,{children:[e.jsx(Qs,{children:s("cart.empty.title")}),e.jsx(Os,{children:s("cart.empty.body")})]}),e.jsx(Hs,{to:"/items",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Fs,{children:[e.jsxs(Ls,{children:[e.jsxs(Ks,{children:[e.jsx(Vs,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(O,{name:"arrow-left"})}),e.jsx(Gs,{children:s("cart.panelTitle",{count:Kt})}),Bt?e.jsxs(Ds,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(O,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Ys,{children:o.map(t=>{const a=Qt.get(t.id),d=a?a.priceCredits:t.priceCredits,c=!!a&&a.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,S=d*h,B=ha(t),E=!!B&&!!A[B],q=pa(t),y=Ve[t.id],g=!lt(y),k=y==="sold-out"?s("cart.availability.soldOut"):s("cart.availability.unavailable");return e.jsxs(Js,{"data-unavailable":g||void 0,children:[e.jsxs(Xs,{"data-thumb":!0,children:[q?e.jsx(Zs,{to:q,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(en,{"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(tn,{children:[e.jsxs(an,{"data-desc":!0,children:[q?e.jsx(nn,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(sn,{title:t.name,children:t.name}),t.creator?e.jsx(rn,{address:t.creator,linkToProfile:!0}):null,_t&&u?e.jsxs(fn,{"data-testid":"cart-creator-tag",children:[e.jsx(yn,{name:"buy-from-creator"}),s("cart.creatorTag")]}):null]}),e.jsx(on,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(xn,{name:"warning-fill",size:24}),k]}),q?e.jsx(mn,{to:q,state:{item:t,tradeId:t.tradeId},children:s("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(cn,{children:[e.jsx(St,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":s("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(dn,{children:h}),e.jsx(St,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":s("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(ln,{children:[e.jsx(un,{})," ",S,c?e.jsx(hn,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(pn,{children:[B?e.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?s("cart.removeFromFavorites",{name:t.name}):s("cart.addToFavorites",{name:t.name}),title:E?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx(O,{name:E?"heart-solid":"heart"})}):null,e.jsx(vn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":s("cart.remove",{name:t.name}),title:s("cart.removeTitle"),children:e.jsx(O,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(wn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:s("cart.clearCart")})})]})]}),e.jsxs(Cn,{children:[e.jsx(jn,{children:s("cart.purchaseSummary")}),e.jsxs(kn,{children:[e.jsxs($n,{children:[e.jsx(Sn,{children:s("cart.totalItems",{count:Ut})}),e.jsx(Tn,{children:e.jsxs(Mn,{children:[e.jsx(In,{})," ",De]})})]}),xe.options.length>0||xe.manaShortfall?e.jsx(Tt,{options:xe.options,totalCents:ze,shortfall:xe.manaShortfall,creditsLabel:_?s("marketCheckout.confirmPurchase"):s("cart.buyWithCredits"),busy:V||Pe,onPay:t=>void(_?rt():te(t))}):e.jsx(Pn,{onClick:()=>void(_?rt():te()),disabled:V||Pe,children:V?s("cart.working"):_?s("marketCheckout.confirmPurchase"):s("cart.checkout")}),Pe?e.jsx(Ce,{className:"muted",children:s("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:s("cart.signInHint")}),_?e.jsx(Ce,{className:"muted",children:s("cart.priceChanged")}):null,Qe?e.jsx(Ce,{className:"muted",children:Qe}):null,e.jsx(zn,{message:Wt})]})]})]})]}),Ye.length>0?e.jsx(An,{children:e.jsx(ss,{title:s("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(ns,{auth:qe.auth,signer:n.signer,title:s("authorizeStep.manaTitle"),name:s("authorizeStep.manaName"),reason:s("authorizeStep.manaReason"),icon:e.jsx("img",{src:is,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=qe;fe(null),t()},onCancel:()=>fe(null),onClose:()=>fe(null)}):null,p?e.jsx(_s,{phase:p.phase,balanceCredits:ge,onClose:Dt,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:ga(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Xt(p).options:void 0,onPay:Zt,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Ue(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:ue,selectedPack:Te,onSelectPack:He,onBuyPacks:()=>void ea(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Xn as Cart};
@@ -1,4 +1,4 @@
1
- import{a5 as N,a6 as U,a7 as o,a8 as n,a9 as D,l as M}from"./index-Da1IWtza.js";import{r as w,j as g}from"./react-DehiWSvs.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-CqnJSHSW.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const a=44,B=M(P||(P=l`
1
+ import{a8 as N,a9 as U,aa as o,ab as n,ac as D,o as M}from"./index-Dy5Vw1H0.js";import{r as w,j as g}from"./react-DehiWSvs.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-BtU7gPvo.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const a=44,B=M(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as c,R as X,v as T,I as ee,b as a,c as te,j as ae,u as re,m as oe,d as ie,ac as F,ad as se,aU as ne,aV as ce}from"./index-Da1IWtza.js";import{E as le}from"./ErrorNotice-C-nXSZqX.js";import{d as de,g as pe,a as xe,P as ue,C as me,b as ge,c as he,B as be,S as fe,M as je,A as ve}from"./browseLayout.styles-BrABo9Hf.js";import{u as ye}from"./useStore-C66JN0w6.js";import{S as z,C as Ce,F as we,c as Ne,P as Se,d as ke,H as Pe,e as $e}from"./categories-2xUKydml.js";import{L as Ae}from"./LoadMore-yAi8vsa6.js";import{u as Me}from"./useInfiniteGrid-RdlgtcqE.js";import{G as Re}from"./grid.styles-wzi16hJ0.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const Ee=c.section`
1
+ import{j as e,r as m,u as V,d as J}from"./react-DehiWSvs.js";import{t as v,s as c,W as X,y as T,I as ee,b as a,c as te,j as ae,u as re,q as oe,C as ie,af as F,ag as se,aY as ne,aZ as ce}from"./index-Dy5Vw1H0.js";import{E as le}from"./ErrorNotice-I9zAvGEr.js";import{d as de,g as pe,a as xe,P as ue,C as me,b as ge,c as he,B as be,S as fe,M as je,A as ve}from"./browseLayout.styles-BYrLBkl5.js";import{u as ye}from"./useStore-ff9cCCX6.js";import{S as z,C as Ce,F as we,c as Ne,P as Se,d as ke,H as Pe,e as $e}from"./categories-_gS0pssw.js";import{L as Ae}from"./LoadMore-DPVuoR5W.js";import{u as Me}from"./useInfiniteGrid-Dz6b_PHh.js";import{G as Ee}from"./grid.styles-BZnnDTVu.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const Re=c.section`
2
2
  position: relative;
3
3
  border-radius: ${v.radius.card};
4
4
  overflow: hidden;
@@ -42,7 +42,7 @@ import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as
42
42
  padding: 24px 16px;
43
43
  font-size: 26px;
44
44
  }
45
- `;function Le({name:r,creator:t}){const{data:s}=ye(t),d=(s==null?void 0:s.cover)||de;return e.jsxs(Ee,{"data-testid":"collection-hero","aria-label":r,children:[e.jsxs(Te,{children:[e.jsx(Fe,{src:d,alt:"",loading:"eager"}),e.jsx(ze,{"aria-hidden":!0})]}),e.jsx(Be,{"data-testid":"collection-hero-title",children:r})]})}const{colors:n,radius:L}=v,Ie=c.div`
45
+ `;function Le({name:r,creator:t}){const{data:s}=ye(t),d=(s==null?void 0:s.cover)||de;return e.jsxs(Re,{"data-testid":"collection-hero","aria-label":r,children:[e.jsxs(Te,{children:[e.jsx(Fe,{src:d,alt:"",loading:"eager"}),e.jsx(ze,{"aria-hidden":!0})]}),e.jsx(Be,{"data-testid":"collection-hero-title",children:r})]})}const{colors:n,radius:L}=v,Ie=c.div`
46
46
  display: flex;
47
47
  flex-direction: column;
48
48
  align-items: center;
@@ -62,7 +62,7 @@ import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as
62
62
  border: 5px solid ${n.white};
63
63
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
64
64
  background: #ff4bed;
65
- `,Ue=c.h2`
65
+ `,_e=c.h2`
66
66
  margin: 0;
67
67
  font-size: 20px;
68
68
  font-weight: 700;
@@ -72,7 +72,7 @@ import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as
72
72
  overflow: hidden;
73
73
  text-overflow: ellipsis;
74
74
  white-space: nowrap;
75
- `,_e=c.button`
75
+ `,Ge=c.button`
76
76
  display: inline-flex;
77
77
  align-items: center;
78
78
  gap: 8px;
@@ -92,7 +92,7 @@ import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as
92
92
  color: ${n.text};
93
93
  background: ${n.media};
94
94
  }
95
- `,Ge=c.a`
95
+ `,He=c.a`
96
96
  display: inline-flex;
97
97
  align-items: center;
98
98
  justify-content: center;
@@ -116,4 +116,4 @@ import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as
116
116
  background: ${n.accent};
117
117
  color: ${n.white};
118
118
  }
119
- `;function He({address:r}){var f,l;const{data:t}=X(r),[s,d]=m.useState(!1);if(!r)return null;const p=(t==null?void 0:t.name)||T(r),g=(l=(f=t==null?void 0:t.avatar)==null?void 0:f.snapshots)==null?void 0:l.face256,h=`${te.profileUrl}/${r}`,b=pe(xe({name:t==null?void 0:t.name,hasClaimedName:t==null?void 0:t.hasClaimedName,ethAddress:(t==null?void 0:t.ethAddress)??r}));async function x(){try{await navigator.clipboard.writeText(r),d(!0),window.setTimeout(()=>d(!1),1500)}catch(y){ae(y,{flow:"copy_creator_address"})}}return e.jsxs(Ie,{"data-testid":"creator-card",children:[g?e.jsx(B,{src:g,alt:"",loading:"eager",style:{backgroundColor:b}}):e.jsx(B,{as:"span","aria-hidden":!0,style:{backgroundColor:b}}),e.jsx(Ue,{title:p,children:p}),e.jsxs(_e,{type:"button",onClick:()=>void x(),title:s?a("collection.copied"):a("collection.copyAddress"),"aria-label":s?a("collection.copied"):a("collection.copyAddress"),children:[e.jsx("span",{children:T(r)}),e.jsx(ee,{name:"copy",size:16})]}),e.jsx(Ge,{"data-testid":"creator-card-view",href:h,target:"_blank",rel:"noopener noreferrer",children:a("collection.viewProfile")})]})}const qe=48;function rt(){var E;const{contractAddress:r}=Z(),t=J(),[s,d]=m.useState("wearable"),[p,g]=m.useState(null),[h,b]=m.useState([]),[x,f]=m.useState(""),[l,y]=m.useState(""),[N,I]=m.useState("newest"),S=x&&!Number.isNaN(Number(x))?Number(x):void 0,k=l&&!Number.isNaN(Number(l))?Number(l):void 0,U=p?$e[p]:void 0,_=(z.find(o=>o.key===N)??z[0]).server,P={category:s,rarities:h.length?h:void 0,wearableCategories:U,minPriceCredits:S,maxPriceCredits:k,sortBy:_},{items:j,total:G,isLoading:C,error:$,hasNextPage:H,isFetchingNextPage:A,isFetchNextPageError:q,fetchNextPage:K}=Me(["collection-page",r,P],o=>ne(r,{...P,first:qe,skip:o}),{enabled:!!r}),{data:i}=re({queryKey:["collection-meta",r],queryFn:()=>ce(r),enabled:!!r,staleTime:5*6e4}),M=(i==null?void 0:i.name)||a("collection.fallbackTitle");oe({title:i==null?void 0:i.name,description:i!=null&&i.name?a("seo.collection.description",{name:i.name}):void 0});const R=(i==null?void 0:i.creator)||((E=j[0])==null?void 0:E.creator);function V(o){d(o),g(null)}function W(o){b(u=>u.includes(o)?u.filter(Y=>Y!==o):[...u,o])}function D(){d("wearable"),g(null),b([]),f(""),y("")}const w=!!(S||k),O=w?`${x||"0"}–${l||"∞"}`:a("filter.price"),Q=s!=="wearable"||!!p||h.length>0||w;return e.jsxs(ue,{"data-testid":"collection-page",children:[e.jsxs(me,{"aria-label":a("collection.breadcrumbAria"),children:[e.jsx(ge,{onClick:()=>t("/items"),children:a("collection.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(he,{children:M})]}),e.jsx(Le,{name:M,creator:R}),e.jsxs(be,{"data-testid":"browse",children:[e.jsxs(fe,{"data-testid":"browse-sidebar",children:[e.jsx(He,{address:R}),e.jsx(Ce,{category:s,subCategory:p,onCategory:V,onSub:g,title:a("collection.category"),flat:!0})]}),e.jsxs(je,{children:[!C&&j.length>0?e.jsx(ve,{items:j,source:"collection"}):null,e.jsx(we,{rarities:h,onToggleRarity:W,sort:N,onSort:I,total:G,loading:C,anyActive:Q,onClear:D,renderTrailing:o=>e.jsx(Ne,{panelKey:"price",label:O,active:w,panel:o,children:e.jsxs(Se,{"data-variant":"price",children:[e.jsxs(ke,{children:[e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMin"),placeholder:a("collection.priceMinPlaceholder"),value:x,onChange:u=>f(u.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMax"),placeholder:a("collection.priceMaxPlaceholder"),value:l,onChange:u=>y(u.target.value)})]}),e.jsx(Pe,{children:a("collection.priceHint",{currency:ie.name})})]})})}),$?e.jsx(le,{message:a("collection.error")}):null,e.jsx(Re,{"data-testid":"grid",children:C?e.jsx(F,{count:15}):e.jsxs(e.Fragment,{children:[j.map(o=>e.jsx(se,{item:o},o.id)),A?e.jsx(F,{count:6}):null]})}),e.jsx(Ae,{hasNextPage:H,isFetching:A,isError:q,onLoadMore:()=>void K()}),!C&&!$&&j.length===0?e.jsx("p",{className:"muted",children:a("collection.empty")}):null]})]})]})}export{rt as Collection,rt as default};
119
+ `;function Ue({address:r}){var f,l;const{data:t}=X(r),[s,d]=m.useState(!1);if(!r)return null;const p=(t==null?void 0:t.name)||T(r),g=(l=(f=t==null?void 0:t.avatar)==null?void 0:f.snapshots)==null?void 0:l.face256,h=`${te.profileUrl}/${r}`,b=pe(xe({name:t==null?void 0:t.name,hasClaimedName:t==null?void 0:t.hasClaimedName,ethAddress:(t==null?void 0:t.ethAddress)??r}));async function x(){try{await navigator.clipboard.writeText(r),d(!0),window.setTimeout(()=>d(!1),1500)}catch(y){ae(y,{flow:"copy_creator_address"})}}return e.jsxs(Ie,{"data-testid":"creator-card",children:[g?e.jsx(B,{src:g,alt:"",loading:"eager",style:{backgroundColor:b}}):e.jsx(B,{as:"span","aria-hidden":!0,style:{backgroundColor:b}}),e.jsx(_e,{title:p,children:p}),e.jsxs(Ge,{type:"button",onClick:()=>void x(),title:s?a("collection.copied"):a("collection.copyAddress"),"aria-label":s?a("collection.copied"):a("collection.copyAddress"),children:[e.jsx("span",{children:T(r)}),e.jsx(ee,{name:"copy",size:16})]}),e.jsx(He,{"data-testid":"creator-card-view",href:h,target:"_blank",rel:"noopener noreferrer",children:a("collection.viewProfile")})]})}const qe=48;function rt(){var R;const{contractAddress:r}=V(),t=J(),[s,d]=m.useState("wearable"),[p,g]=m.useState(null),[h,b]=m.useState([]),[x,f]=m.useState(""),[l,y]=m.useState(""),[N,I]=m.useState("newest"),S=x&&!Number.isNaN(Number(x))?Number(x):void 0,k=l&&!Number.isNaN(Number(l))?Number(l):void 0,_=p?$e[p]:void 0,G=(z.find(o=>o.key===N)??z[0]).server,P={category:s,rarities:h.length?h:void 0,wearableCategories:_,minPriceCredits:S,maxPriceCredits:k,sortBy:G},{items:j,total:H,isLoading:C,error:$,hasNextPage:U,isFetchingNextPage:A,isFetchNextPageError:q,fetchNextPage:W}=Me(["collection-page",r,P],o=>ne(r,{...P,first:qe,skip:o}),{enabled:!!r}),{data:i}=re({queryKey:["collection-meta",r],queryFn:()=>ce(r),enabled:!!r,staleTime:5*6e4}),M=(i==null?void 0:i.name)||a("collection.fallbackTitle");oe({title:i==null?void 0:i.name,description:i!=null&&i.name?a("seo.collection.description",{name:i.name}):void 0});const E=(i==null?void 0:i.creator)||((R=j[0])==null?void 0:R.creator);function K(o){d(o),g(null)}function Y(o){b(u=>u.includes(o)?u.filter(Q=>Q!==o):[...u,o])}function Z(){d("wearable"),g(null),b([]),f(""),y("")}const w=!!(S||k),D=w?`${x||"0"}–${l||"∞"}`:a("filter.price"),O=s!=="wearable"||!!p||h.length>0||w;return e.jsxs(ue,{"data-testid":"collection-page",children:[e.jsxs(me,{"aria-label":a("collection.breadcrumbAria"),children:[e.jsx(ge,{onClick:()=>t("/items"),children:a("collection.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(he,{children:M})]}),e.jsx(Le,{name:M,creator:E}),e.jsxs(be,{"data-testid":"browse",children:[e.jsxs(fe,{"data-testid":"browse-sidebar",children:[e.jsx(Ue,{address:E}),e.jsx(Ce,{category:s,subCategory:p,onCategory:K,onSub:g,title:a("collection.category"),flat:!0})]}),e.jsxs(je,{children:[!C&&j.length>0?e.jsx(ve,{items:j,source:"collection"}):null,e.jsx(we,{rarities:h,onToggleRarity:Y,sort:N,onSort:I,total:H,loading:C,anyActive:O,onClear:Z,renderTrailing:o=>e.jsx(Ne,{panelKey:"price",label:D,active:w,panel:o,children:e.jsxs(Se,{"data-variant":"price",children:[e.jsxs(ke,{children:[e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMin"),placeholder:a("collection.priceMinPlaceholder"),value:x,onChange:u=>f(u.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMax"),placeholder:a("collection.priceMaxPlaceholder"),value:l,onChange:u=>y(u.target.value)})]}),e.jsx(Pe,{children:a("collection.priceHint",{currency:ie.name})})]})})}),$?e.jsx(le,{message:a("collection.error")}):null,e.jsx(Ee,{"data-testid":"grid",children:C?e.jsx(F,{count:15}):e.jsxs(e.Fragment,{children:[j.map(o=>e.jsx(se,{item:o},o.id)),A?e.jsx(F,{count:6}):null]})}),e.jsx(Ae,{hasNextPage:U,isFetching:A,isError:q,onLoadMore:()=>void W()}),!C&&!$&&j.length===0?e.jsx("p",{className:"muted",children:a("collection.empty")}):null]})]})]})}export{rt as Collection,rt as default};
@@ -1,4 +1,4 @@
1
- import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,p as k,ao as j,bu as C,d as Y,l as G,I as Q,j as X,g as W,C as B,e as Z,Y as J,bS as F,ad as q}from"./index-Da1IWtza.js";import{s as ee,i as U,A as H,g as K,r as te,m as ne,c as ae,M as ie,e as oe}from"./authorizations-DKmCykqz.js";import{i as se}from"./errors-N8U87ba-.js";import{E as re}from"./ErrorNotice-C-nXSZqX.js";import{a as ce}from"./buy-DKJg2rHj.js";import{g as de,a as le}from"./trade-encoding-4xiglK48.js";import{s as pe,M as he,E as ue}from"./sendMetaTransaction-kBil2Ej7.js";import{I as xe,C as ge}from"./ethers-CtNGBird.js";const R="shop:resume_after_signin",fe=900*1e3;function dt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function lt(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>fe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function me(a,n){return(a+n-1n)/n}function be(a,n,i){return a<=0||n<=0?0n:a>=n?i:me(i*BigInt(a),BigInt(n))}function pt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,l=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const d=n-i,f=be(d,n,s);l>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&l>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(d=>d.method==="credits"))==null?void 0:b.method)??((y=c.find(d=>d.method==="combined"))==null?void 0:y.method)??((w=c.find(d=>d.method==="mana"))==null?void 0:w.method)??null,m=!c.some(d=>d.method==="mana"||d.method==="combined")&&s>0n&&l>0n?{manaWei:l,manaCents:ye(l,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function ye(a,n,i){return Number(a*BigInt(n)/i)}function ht(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const l=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(l,i);return i-=c,c})}function M(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function ut(a,n){return a.options.find(i=>i.method===n)??null}function xt(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",we=e.div`
1
+ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as k,ar as j,bu as C,C as G,o as Y,I as Q,j as X,g as W,e as B,d as Z,a0 as J,bS as F,ag as q}from"./index-Dy5Vw1H0.js";import{s as ee,f as U,A as H,g as K,r as te,m as ne,i as ae,M as ie,h as oe}from"./authorizations-vn6dbOqY.js";import{i as se}from"./errors-WsZgWksO.js";import{E as re}from"./ErrorNotice-I9zAvGEr.js";import{a as ce}from"./buy-k-76F4x2.js";import{g as de,f as le}from"./trade-encoding-SVWWPYXU.js";import{s as pe,M as he,E as ue}from"./sendMetaTransaction-feJSI2TG.js";import{I as xe,C as ge}from"./ethers-CtNGBird.js";const R="shop:resume_after_signin",fe=900*1e3;function dt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function lt(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>fe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function me(a,n){return(a+n-1n)/n}function be(a,n,i){return a<=0||n<=0?0n:a>=n?i:me(i*BigInt(a),BigInt(n))}function pt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,l=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const d=n-i,f=be(d,n,s);l>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&l>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(d=>d.method==="credits"))==null?void 0:b.method)??((y=c.find(d=>d.method==="combined"))==null?void 0:y.method)??((w=c.find(d=>d.method==="mana"))==null?void 0:w.method)??null,m=!c.some(d=>d.method==="mana"||d.method==="combined")&&s>0n&&l>0n?{manaWei:l,manaCents:ye(l,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function ye(a,n,i){return Number(a*BigInt(n)/i)}function ht(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const l=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(l,i);return i-=c,c})}function M(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function ut(a,n){return a.options.find(i=>i.method===n)??null}function xt(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",we=e.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -109,7 +109,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,p as
109
109
  line-height: 1.4;
110
110
  color: ${o.colors.muted};
111
111
  text-align: center;
112
- `;function gt({options:a,totalCents:n,onPay:i,busy:s=!1,rateNote:l,creditsLabel:c,shortfall:p}){return t.jsxs(we,{children:[a.map(h=>h.method==="credits"?t.jsxs(ve,{type:"button","data-testid":"pay-with-credits",onClick:()=>i("credits"),disabled:s,children:[t.jsx("span",{children:c??g("buyModal.buy")}),t.jsxs(z,{children:[t.jsx(k,{}),t.jsx("span",{children:j(M(h.creditsCents))})]})]},"credits"):h.method==="mana"?t.jsxs(N,{type:"button","data-testid":"pay-with-mana",onClick:()=>i("mana"),disabled:s,children:[t.jsx("span",{children:g("buyModal.buyWithMana")}),t.jsxs(z,{children:[t.jsx(E,{children:t.jsx("img",{src:T,alt:"","aria-hidden":!0})}),t.jsx("span",{children:C(h.manaWei)})]})]},"mana"):t.jsxs(N,{type:"button","data-testid":"pay-with-combined",onClick:()=>i("combined"),disabled:s,children:[t.jsx("span",{children:g("buyModal.buyWith")}),t.jsxs(z,{children:[t.jsx(k,{}),t.jsx("span",{children:j(M(h.creditsCents))}),t.jsx($e,{children:"+"}),t.jsx(E,{children:t.jsx("img",{src:T,alt:"","aria-hidden":!0})}),t.jsx("span",{children:C(h.manaWei)}),t.jsx(ke,{children:"MANA"})]})]},"combined")),p?t.jsxs(t.Fragment,{children:[t.jsxs(N,{type:"button","data-testid":"pay-with-mana-disabled",disabled:!0,children:[t.jsx("span",{children:g("buyModal.buyWithMana")}),t.jsxs(z,{children:[t.jsx(E,{children:t.jsx("img",{src:T,alt:"","aria-hidden":!0})}),t.jsx("span",{children:C(p.manaWei)})]})]},"mana-short"),t.jsx(Ce,{"data-testid":"mana-shortfall-note",children:g("buyModal.manaWorth",{mana:C(p.manaWei),credits:j(M(p.manaCents)),price:j(M(p.priceCents)),currency:Y.name})})]}):null,l?t.jsx(je,{"data-testid":"mana-rate-note",children:l}):null,t.jsx("span",{hidden:!0,"data-testid":"pay-total-cents",children:n})]})}function ft(a,n){const i=(s,...l)=>void a.invalidateQueries({queryKey:n?[s,...l]:[s]});a.invalidateQueries({queryKey:["usd-balance"]}),a.invalidateQueries({queryKey:["detail-trade"]}),a.invalidateQueries({queryKey:["shop-item"]}),i("owned-token",n==null?void 0:n.contractAddress,n==null?void 0:n.tokenId),i("public-token",n==null?void 0:n.contractAddress,n==null?void 0:n.tokenId),i("item-resales",n==null?void 0:n.contractAddress,n==null?void 0:n.itemId),a.invalidateQueries({queryKey:["shop-items"]}),a.invalidateQueries({queryKey:["catalog-items"]}),a.invalidateQueries({queryKey:["overview-listings"]}),a.invalidateQueries({queryKey:["upsell-listings"]}),a.invalidateQueries({queryKey:["my-assets"]}),a.invalidateQueries({queryKey:["purchases"]}),a.invalidateQueries({queryKey:["owned-item-count"]})}const Me=G`
112
+ `;function gt({options:a,totalCents:n,onPay:i,busy:s=!1,rateNote:l,creditsLabel:c,shortfall:p}){return t.jsxs(we,{children:[a.map(h=>h.method==="credits"?t.jsxs(ve,{type:"button","data-testid":"pay-with-credits",onClick:()=>i("credits"),disabled:s,children:[t.jsx("span",{children:c??g("buyModal.buy")}),t.jsxs(z,{children:[t.jsx(k,{}),t.jsx("span",{children:j(M(h.creditsCents))})]})]},"credits"):h.method==="mana"?t.jsxs(N,{type:"button","data-testid":"pay-with-mana",onClick:()=>i("mana"),disabled:s,children:[t.jsx("span",{children:g("buyModal.buyWithMana")}),t.jsxs(z,{children:[t.jsx(E,{children:t.jsx("img",{src:T,alt:"","aria-hidden":!0})}),t.jsx("span",{children:C(h.manaWei)})]})]},"mana"):t.jsxs(N,{type:"button","data-testid":"pay-with-combined",onClick:()=>i("combined"),disabled:s,children:[t.jsx("span",{children:g("buyModal.buyWith")}),t.jsxs(z,{children:[t.jsx(k,{}),t.jsx("span",{children:j(M(h.creditsCents))}),t.jsx($e,{children:"+"}),t.jsx(E,{children:t.jsx("img",{src:T,alt:"","aria-hidden":!0})}),t.jsx("span",{children:C(h.manaWei)}),t.jsx(ke,{children:"MANA"})]})]},"combined")),p?t.jsxs(t.Fragment,{children:[t.jsxs(N,{type:"button","data-testid":"pay-with-mana-disabled",disabled:!0,children:[t.jsx("span",{children:g("buyModal.buyWithMana")}),t.jsxs(z,{children:[t.jsx(E,{children:t.jsx("img",{src:T,alt:"","aria-hidden":!0})}),t.jsx("span",{children:C(p.manaWei)})]})]},"mana-short"),t.jsx(Ce,{"data-testid":"mana-shortfall-note",children:g("buyModal.manaWorth",{mana:C(p.manaWei),credits:j(M(p.manaCents)),price:j(M(p.priceCents)),currency:G.name})})]}):null,l?t.jsx(je,{"data-testid":"mana-rate-note",children:l}):null,t.jsx("span",{hidden:!0,"data-testid":"pay-total-cents",children:n})]})}function ft(a,n){const i=(s,...l)=>void a.invalidateQueries({queryKey:n?[s,...l]:[s]});a.invalidateQueries({queryKey:["usd-balance"]}),a.invalidateQueries({queryKey:["detail-trade"]}),a.invalidateQueries({queryKey:["shop-item"]}),i("owned-token",n==null?void 0:n.contractAddress,n==null?void 0:n.tokenId),i("public-token",n==null?void 0:n.contractAddress,n==null?void 0:n.tokenId),i("item-resales",n==null?void 0:n.contractAddress,n==null?void 0:n.itemId),a.invalidateQueries({queryKey:["shop-items"]}),a.invalidateQueries({queryKey:["catalog-items"]}),a.invalidateQueries({queryKey:["overview-listings"]}),a.invalidateQueries({queryKey:["upsell-listings"]}),a.invalidateQueries({queryKey:["my-assets"]}),a.invalidateQueries({queryKey:["purchases"]}),a.invalidateQueries({queryKey:["owned-item-count"]})}const Me=Y`
113
113
  to { transform: rotate(360deg); }
114
114
  `,ze=e.div`
115
115
  position: fixed;
@@ -488,13 +488,13 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,p as
488
488
  `,Vt=e.span`
489
489
  font-size: 14px;
490
490
  color: ${r.text};
491
- `,Yt=e.div`
491
+ `,Gt=e.div`
492
492
  display: flex;
493
493
  align-items: center;
494
494
  justify-content: space-between;
495
495
  border-top: 1px solid ${r.gray4};
496
496
  padding-top: 12px;
497
- `,Gt=e.div`
497
+ `,Yt=e.div`
498
498
  display: flex;
499
499
  align-items: center;
500
500
  gap: 8px;
@@ -676,7 +676,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,p as
676
676
  font-size: 22px;
677
677
  font-weight: 700;
678
678
  color: ${I.text};
679
- `,Ye=e.button`
679
+ `,Ge=e.button`
680
680
  display: inline-flex;
681
681
  align-items: center;
682
682
  gap: 4px;
@@ -694,7 +694,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,p as
694
694
  &:hover {
695
695
  text-decoration: underline;
696
696
  }
697
- `,Ge=e(Q)`
697
+ `,Ye=e(Q)`
698
698
  transform: rotate(-90deg);
699
699
  `,Xe=e.div`
700
700
  position: relative;
@@ -801,4 +801,4 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,p as
801
801
  opacity: 1;
802
802
  transform: scale(1.1);
803
803
  }
804
- `;function ln({title:a,items:n,onViewAll:i}){const s=v.useRef(null),[l,c]=v.useState(1),[p,h]=v.useState(0),[m,b]=v.useState(!0),[y,w]=v.useState(!1),d=v.useCallback(()=>{const u=s.current;if(!u)return;const{scrollLeft:x,scrollWidth:L,clientWidth:S}=u,P=Math.max(1,Math.ceil(L/S));c(P),h(Math.min(P-1,Math.round(x/S))),b(x<=1),w(x+S>=L-1)},[]);if(v.useEffect(()=>{d();const u=s.current;if(u)return u.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),()=>{u.removeEventListener("scroll",d),window.removeEventListener("resize",d)}},[d,n.length]),n.length===0)return null;function f(u){const x=s.current;x&&x.scrollBy({left:u*x.clientWidth,behavior:"smooth"})}function $(u){const x=s.current;x&&x.scrollTo({left:u*x.clientWidth,behavior:"smooth"})}return t.jsxs(_e,{children:[t.jsxs(Oe,{children:[t.jsx(Ve,{children:a}),i?t.jsxs(Ye,{onClick:i,children:[g("collectionCarousel.viewAll"),t.jsx(Ge,{name:"chevron-down",size:16})]}):null]}),t.jsxs(Xe,{children:[t.jsx(D,{"data-side":"left",onClick:()=>f(-1),"aria-label":g("collectionCarousel.scrollLeft"),disabled:m,children:t.jsx("img",{src:F,alt:"","aria-hidden":!0})}),t.jsx(Ze,{ref:s,children:n.map(u=>t.jsx(q,{item:u},u.id))}),t.jsx(D,{"data-side":"right",onClick:()=>f(1),"aria-label":g("collectionCarousel.scrollRight"),disabled:y,children:t.jsx("img",{src:F,alt:"","aria-hidden":!0})})]}),l>1?t.jsx(Je,{"aria-label":g("collectionCarousel.pages"),children:Array.from({length:l}).map((u,x)=>t.jsx(qe,{"data-active":x===p||void 0,"aria-label":g("collectionCarousel.goToPage",{page:x+1}),"aria-current":x===p?"true":void 0,onClick:()=>$(x)},x))}):null]})}export{M as $,Et as A,Wt as B,jt as C,Ot as D,Vt as E,Yt as F,Gt as G,Ct as H,Xt as I,Zt as J,pt as K,en as L,kt as M,lt as N,ln as O,gt as P,mt as Q,T as R,$t as S,zt as T,dt as U,ft as V,Dt as W,At as X,Qe as Y,ht as Z,be as _,Mt as a,cn as a0,dn as a1,bt as a2,ut as a3,yt as a4,wt as b,It as c,St as d,Tt as e,Nt as f,tn as g,nn as h,an as i,Jt as j,qt as k,on as l,xt as m,sn as n,rn as o,vt as p,Qt as q,Bt as r,Rt as s,Lt as t,Pt as u,Ft as v,Kt as w,Ut as x,Ht as y,_t as z};
804
+ `;function ln({title:a,items:n,onViewAll:i}){const s=v.useRef(null),[l,c]=v.useState(1),[p,h]=v.useState(0),[m,b]=v.useState(!0),[y,w]=v.useState(!1),d=v.useCallback(()=>{const u=s.current;if(!u)return;const{scrollLeft:x,scrollWidth:L,clientWidth:S}=u,P=Math.max(1,Math.ceil(L/S));c(P),h(Math.min(P-1,Math.round(x/S))),b(x<=1),w(x+S>=L-1)},[]);if(v.useEffect(()=>{d();const u=s.current;if(u)return u.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),()=>{u.removeEventListener("scroll",d),window.removeEventListener("resize",d)}},[d,n.length]),n.length===0)return null;function f(u){const x=s.current;x&&x.scrollBy({left:u*x.clientWidth,behavior:"smooth"})}function $(u){const x=s.current;x&&x.scrollTo({left:u*x.clientWidth,behavior:"smooth"})}return t.jsxs(_e,{children:[t.jsxs(Oe,{children:[t.jsx(Ve,{children:a}),i?t.jsxs(Ge,{onClick:i,children:[g("collectionCarousel.viewAll"),t.jsx(Ye,{name:"chevron-down",size:16})]}):null]}),t.jsxs(Xe,{children:[t.jsx(D,{"data-side":"left",onClick:()=>f(-1),"aria-label":g("collectionCarousel.scrollLeft"),disabled:m,children:t.jsx("img",{src:F,alt:"","aria-hidden":!0})}),t.jsx(Ze,{ref:s,children:n.map(u=>t.jsx(q,{item:u},u.id))}),t.jsx(D,{"data-side":"right",onClick:()=>f(1),"aria-label":g("collectionCarousel.scrollRight"),disabled:y,children:t.jsx("img",{src:F,alt:"","aria-hidden":!0})})]}),l>1?t.jsx(Je,{"aria-label":g("collectionCarousel.pages"),children:Array.from({length:l}).map((u,x)=>t.jsx(qe,{"data-active":x===p||void 0,"aria-label":g("collectionCarousel.goToPage",{page:x+1}),"aria-current":x===p?"true":void 0,onClick:()=>$(x)},x))}):null]})}export{M as $,Et as A,Wt as B,jt as C,Ot as D,Vt as E,Gt as F,Yt as G,Ct as H,Xt as I,Zt as J,pt as K,en as L,kt as M,lt as N,ln as O,gt as P,mt as Q,T as R,$t as S,zt as T,dt as U,ft as V,Dt as W,At as X,Qe as Y,ht as Z,be as _,Mt as a,cn as a0,dn as a1,bt as a2,ut as a3,yt as a4,wt as b,It as c,St as d,Tt as e,Nt as f,tn as g,nn as h,an as i,Jt as j,qt as k,on as l,xt as m,sn as n,rn as o,vt as p,Qt as q,Bt as r,Rt as s,Lt as t,Pt as u,Ft as v,Kt as w,Ut as x,Ht as y,_t as z};
@@ -1,4 +1,4 @@
1
- import{d as Y,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";import{t as Z,A as je,E as I,D as _,s as r,be as ve,an as Ce,bf as ye,b as t,bg as $e,bh as W,B as ke,a9 as q,R as J,n as Ne,v as Q,I as T,c as Pe,m as Se,ac as S,d as Le,ad as Ae,bd as Ee,bi as Fe}from"./index-Da1IWtza.js";import{d as Me,g as ze,a as Be,P as Re,C as Ie,b as _e,c as We,A as Te,B as He,S as Ue,M as De,e as Ge,f as Ke}from"./browseLayout.styles-BrABo9Hf.js";import{u as Oe,L as Ve}from"./useStore-C66JN0w6.js";import{S as H,C as Ye,F as Ze,c as qe,P as Je,d as Qe,H as Xe,e as et}from"./categories-2xUKydml.js";import{L as U}from"./LoadMore-yAi8vsa6.js";import{u as D}from"./useInfiniteGrid-RdlgtcqE.js";import{E as G}from"./ErrorNotice-C-nXSZqX.js";import{G as K}from"./grid.styles-wzi16hJ0.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const{colors:u,radius:X,media:tt}=Z,it=r.article`
1
+ import{d as V,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";import{t as Y,F as je,H as R,G as W,s as r,be as ve,aq as Ce,bf as ye,b as t,bg as $e,bh as _,B as ke,ac as Z,W as J,n as Ne,y as Q,I as T,c as Pe,q as Se,af as S,C as Le,ag as Ae,bd as Fe,bi as Ee}from"./index-Dy5Vw1H0.js";import{d as Me,g as ze,a as Be,P as Ie,C as Re,b as We,c as _e,A as Te,B as He,S as Ge,M as Ue,e as De,f as Ke}from"./browseLayout.styles-BYrLBkl5.js";import{u as Oe,L as qe}from"./useStore-ff9cCCX6.js";import{S as H,C as Ve,F as Ye,c as Ze,P as Je,d as Qe,H as Xe,e as et}from"./categories-_gS0pssw.js";import{L as G}from"./LoadMore-DPVuoR5W.js";import{u as U}from"./useInfiniteGrid-Dz6b_PHh.js";import{E as D}from"./ErrorNotice-I9zAvGEr.js";import{G as K}from"./grid.styles-BZnnDTVu.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const{colors:u,radius:X,media:tt}=Y,it=r.article`
2
2
  height: 300px;
3
3
  background: ${u.bg};
4
4
  border-radius: ${X.card};
@@ -15,10 +15,10 @@ import{d as Y,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";im
15
15
  }
16
16
 
17
17
  &:focus-visible {
18
- ${I};
18
+ ${R};
19
19
  }
20
20
  &:focus-visible::after {
21
- ${_};
21
+ ${W};
22
22
  }
23
23
 
24
24
  // The swap is a pointer affordance only: keyboard focus must not hide the creator row, whose profile
@@ -26,10 +26,10 @@ import{d as Y,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";im
26
26
  // already opens the collection.
27
27
  @media (hover: hover) {
28
28
  &:hover {
29
- ${I};
29
+ ${R};
30
30
  }
31
31
  &:hover::after {
32
- ${_};
32
+ ${W};
33
33
  }
34
34
  &:hover [data-view] {
35
35
  visibility: visible;
@@ -112,7 +112,7 @@ import{d as Y,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";im
112
112
  font-weight: 600;
113
113
  font-size: 14px;
114
114
  white-space: nowrap;
115
- `,pt=r.button`
115
+ `,gt=r.button`
116
116
  visibility: hidden;
117
117
  width: 100%;
118
118
  height: 44px;
@@ -135,7 +135,7 @@ import{d as Y,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";im
135
135
  &:active {
136
136
  background: ${u.accentActive};
137
137
  }
138
- `;function gt({collection:a,cover:i,itemCount:s}){const n=Y(),{contractAddress:g,name:x,creator:b}=a,C=i==null||s==null,{data:d}=ye(g,C),w=i==null?(d==null?void 0:d.items)??[]:[],m=s??(d==null?void 0:d.total);function f(){n(`/collection/${g}`)}return e.jsxs(it,{"data-testid":"coll-card",role:"link",tabIndex:0,onClick:f,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),f())},children:[e.jsx(ot,{children:i?e.jsx(rt,{"data-testid":"coll-card-img",src:i,alt:"",loading:"lazy"}):w.length>0?e.jsx(at,{items:w,tinted:!1}):null}),e.jsxs(st,{children:[e.jsx(nt,{title:x,children:x}),e.jsxs(ct,{children:[e.jsxs(lt,{"data-meta":!0,"data-testid":"coll-card-meta",children:[b?e.jsx(dt,{address:b,linkToProfile:!0}):e.jsx(ht,{children:" "}),e.jsx(xt,{children:m==null?"…":t("collectionCard.itemCount",{count:m})})]}),e.jsx(pt,{"data-view":!0,"data-testid":"coll-card-view",onClick:h=>{h.stopPropagation(),f()},tabIndex:-1,children:t("collectionCard.viewCollection")})]})]})]})}function mt({address:a,className:i=""}){const s=$e(),n=W(x=>x.followed.includes(a.toLowerCase())),g=W(x=>x.toggle);return!s||!a?null:e.jsx(ke,{type:"button",size:"sm",variant:n?"ghost":"outline",className:i||void 0,"aria-pressed":n,title:n?t("creator.unfollowTitle"):t("creator.followTitle"),onClick:()=>g(a),children:n?t("creator.following"):t("creator.follow")})}const{colors:v,radius:ee,media:j}=Z,te=q`
138
+ `;function pt({collection:a,cover:i,itemCount:s}){const n=V(),{contractAddress:p,name:x,creator:b}=a,C=i==null||s==null,{data:d}=ye(p,C),w=i==null?(d==null?void 0:d.items)??[]:[],m=s??(d==null?void 0:d.total);function f(){n(`/collection/${p}`)}return e.jsxs(it,{"data-testid":"coll-card",role:"link",tabIndex:0,onClick:f,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),f())},children:[e.jsx(ot,{children:i?e.jsx(rt,{"data-testid":"coll-card-img",src:i,alt:"",loading:"lazy"}):w.length>0?e.jsx(at,{items:w,tinted:!1}):null}),e.jsxs(st,{children:[e.jsx(nt,{title:x,children:x}),e.jsxs(ct,{children:[e.jsxs(lt,{"data-meta":!0,"data-testid":"coll-card-meta",children:[b?e.jsx(dt,{address:b,linkToProfile:!0}):e.jsx(ht,{children:" "}),e.jsx(xt,{children:m==null?"…":t("collectionCard.itemCount",{count:m})})]}),e.jsx(gt,{"data-view":!0,"data-testid":"coll-card-view",onClick:h=>{h.stopPropagation(),f()},tabIndex:-1,children:t("collectionCard.viewCollection")})]})]})]})}function mt({address:a,className:i=""}){const s=$e(),n=_(x=>x.followed.includes(a.toLowerCase())),p=_(x=>x.toggle);return!s||!a?null:e.jsx(ke,{type:"button",size:"sm",variant:n?"ghost":"outline",className:i||void 0,"aria-pressed":n,title:n?t("creator.unfollowTitle"):t("creator.followTitle"),onClick:()=>p(a),children:n?t("creator.following"):t("creator.follow")})}const{colors:v,radius:ee,media:j}=Y,te=Z`
139
139
  display: inline-flex;
140
140
  align-items: center;
141
141
  justify-content: center;
@@ -197,7 +197,7 @@ import{d as Y,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";im
197
197
  right: 12px;
198
198
  gap: 6px;
199
199
  }
200
- `,ie=q`
200
+ `,ie=Z`
201
201
  display: flex;
202
202
  align-items: center;
203
203
  justify-content: center;
@@ -303,4 +303,4 @@ import{d as Y,j as e,L as be,u as fe,e as we,r as y}from"./react-DehiWSvs.js";im
303
303
  &:hover {
304
304
  background: rgba(255, 255, 255, 0.14);
305
305
  }
306
- `,St={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Lt({address:a}){var h,$;const{data:i}=J(a),{data:s}=Oe(a),n=Ne(l=>{var k;return(k=l.session)==null?void 0:k.address}),g=!!n&&n.toLowerCase()===a.toLowerCase(),x=(i==null?void 0:i.name)||Q(a),b=($=(h=i==null?void 0:i.avatar)==null?void 0:h.snapshots)==null?void 0:$.face256,C=(s==null?void 0:s.cover)||Me,d=s==null?void 0:s.description,w=`${Pe.profileUrl}/${a}`,m=Ve.filter(l=>s==null?void 0:s.links[l]),f=ze(Be({name:i==null?void 0:i.name,hasClaimedName:i==null?void 0:i.hasClaimedName,ethAddress:(i==null?void 0:i.ethAddress)??a}));return e.jsxs(ut,{"aria-label":`${x} storefront`,children:[e.jsxs(bt,{children:[e.jsx(ft,{src:C,alt:"",loading:"eager"}),e.jsx(wt,{"aria-hidden":!0})]}),(m.length>0||g)&&e.jsxs(jt,{children:[m.map(l=>e.jsx(vt,{"data-testid":"creator-hero-link",href:(s==null?void 0:s.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:t(`creator.link.${l}`),"aria-label":t(`creator.link.${l}`),children:e.jsx(T,{name:St[l]})},l)),g&&e.jsx(Ct,{to:"/store-settings",title:t("creator.editStore"),"aria-label":t("creator.editStore"),children:e.jsx(T,{name:"pen"})})]}),e.jsxs(yt,{children:[b?e.jsx(O,{src:b,alt:"",loading:"eager",style:{backgroundColor:f}}):e.jsx(O,{as:"span","aria-hidden":!0,style:{backgroundColor:f}}),e.jsxs("div",{children:[e.jsx($t,{children:x}),d?e.jsx(kt,{children:d}):null]}),e.jsxs(Nt,{children:[e.jsx(Pt,{"data-testid":"creator-hero-view",href:w,target:"_blank",rel:"noopener noreferrer",children:t("creator.viewProfile")}),e.jsx(mt,{address:a,className:"creator-hero__follow"})]})]})]})}const V=48;function Dt(){const{address:a}=fe(),i=Y(),[s]=we(),n=s.has("collections"),{data:g}=J(a),x=(g==null?void 0:g.name)||(a?Q(a):t("creator.fallbackName"));Se({title:x,description:t("seo.creator.description",{name:x})});const[b,C]=y.useState("wearable"),[d,w]=y.useState(null),[m,f]=y.useState([]),[h,$]=y.useState(""),[l,k]=y.useState(""),[A,oe]=y.useState("newest"),E=h&&!Number.isNaN(Number(h))?Number(h):void 0,F=l&&!Number.isNaN(Number(l))?Number(l):void 0,re=d?et[d]:void 0,ae=(H.find(o=>o.key===A)??H[0]).server,M={creator:a,category:b,rarities:m.length?m:void 0,wearableCategories:re,minPriceCredits:E,maxPriceCredits:F,sortBy:ae},{items:N,total:se,isLoading:P,error:z,hasNextPage:ne,isFetchingNextPage:B,isFetchNextPageError:ce,fetchNextPage:le}=D(["creator-listings",M],o=>Ee({...M,first:V,skip:o}),{enabled:!!a&&!n}),p=D(["creator-collections",a],o=>Fe(a,{first:V,skip:o}).then(c=>({items:c.collections,total:c.total})),{enabled:!!a&&n});function de(o){C(o),w(null),n&&R()}function R(){const o=new URLSearchParams(s);o.delete("collections");const c=o.toString();i({search:c?`?${c}`:""},{replace:!0})}function he(){if(n){R();return}const o=new URLSearchParams(s);o.delete("collections");const c=o.toString();i({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function xe(o){f(c=>c.includes(o)?c.filter(ue=>ue!==o):[...c,o])}function pe(){C("wearable"),w(null),f([]),$(""),k("")}const L=!!(E||F),ge=L?`${h||"0"}–${l||"∞"}`:t("filter.price"),me=b!=="wearable"||!!d||m.length>0||L;return e.jsxs(Re,{children:[e.jsxs(Ie,{"aria-label":t("creator.breadcrumbAria"),children:[e.jsx(_e,{onClick:()=>i("/items"),children:t("creator.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(We,{children:x})]}),a?e.jsx(Lt,{address:a}):null,!n&&!P&&N.length>0?e.jsx(Te,{items:N,source:"creator"}):null,e.jsxs(He,{children:[e.jsx(Ue,{children:e.jsx(Ye,{category:b,subCategory:d,onCategory:de,onSub:w,title:t("creator.category"),flat:!0,collections:n,onCollections:he})}),e.jsx(De,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Ge,{children:e.jsx(Ke,{children:p.isLoading?"…":t("creator.collectionsCount",{count:p.total})})}),p.error?e.jsx(G,{message:t("creator.error")}):null,e.jsx(K,{"data-variant":"collections",children:p.isLoading?e.jsx(S,{count:9}):e.jsxs(e.Fragment,{children:[p.items.map(o=>e.jsx(gt,{collection:o,itemCount:o.itemCount},o.contractAddress)),p.isFetchingNextPage?e.jsx(S,{count:6}):null]})}),e.jsx(U,{hasNextPage:p.hasNextPage,isFetching:p.isFetchingNextPage,isError:p.isFetchNextPageError,onLoadMore:()=>void p.fetchNextPage()}),!p.isLoading&&!p.error&&p.items.length===0?e.jsx("p",{className:"muted",children:t("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ze,{rarities:m,onToggleRarity:xe,sort:A,onSort:oe,total:se,loading:P,anyActive:me,onClear:pe,renderTrailing:o=>e.jsx(qe,{panelKey:"price",label:ge,active:L,panel:o,children:e.jsxs(Je,{"data-variant":"price",children:[e.jsxs(Qe,{children:[e.jsx("input",{type:"number",min:"0","aria-label":t("creator.priceMin"),placeholder:t("creator.priceMinPlaceholder"),value:h,onChange:c=>$(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("creator.priceMax"),placeholder:t("creator.priceMaxPlaceholder"),value:l,onChange:c=>k(c.target.value)})]}),e.jsx(Xe,{children:t("creator.priceHint",{currency:Le.name})})]})})}),z?e.jsx(G,{message:t("creator.error")}):null,e.jsx(K,{children:P?e.jsx(S,{count:15}):e.jsxs(e.Fragment,{children:[N.map(o=>e.jsx(Ae,{item:o},o.id)),B?e.jsx(S,{count:6}):null]})}),e.jsx(U,{hasNextPage:ne,isFetching:B,isError:ce,onLoadMore:()=>void le()}),!P&&!z&&N.length===0?e.jsx("p",{className:"muted",children:t("creator.empty")}):null]})})]})]})}export{Dt as Creator,Dt as default};
306
+ `,St={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Lt({address:a}){var h,$;const{data:i}=J(a),{data:s}=Oe(a),n=Ne(l=>{var k;return(k=l.session)==null?void 0:k.address}),p=!!n&&n.toLowerCase()===a.toLowerCase(),x=(i==null?void 0:i.name)||Q(a),b=($=(h=i==null?void 0:i.avatar)==null?void 0:h.snapshots)==null?void 0:$.face256,C=(s==null?void 0:s.cover)||Me,d=s==null?void 0:s.description,w=`${Pe.profileUrl}/${a}`,m=qe.filter(l=>s==null?void 0:s.links[l]),f=ze(Be({name:i==null?void 0:i.name,hasClaimedName:i==null?void 0:i.hasClaimedName,ethAddress:(i==null?void 0:i.ethAddress)??a}));return e.jsxs(ut,{"aria-label":`${x} storefront`,children:[e.jsxs(bt,{children:[e.jsx(ft,{src:C,alt:"",loading:"eager"}),e.jsx(wt,{"aria-hidden":!0})]}),(m.length>0||p)&&e.jsxs(jt,{children:[m.map(l=>e.jsx(vt,{"data-testid":"creator-hero-link",href:(s==null?void 0:s.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:t(`creator.link.${l}`),"aria-label":t(`creator.link.${l}`),children:e.jsx(T,{name:St[l]})},l)),p&&e.jsx(Ct,{to:"/store-settings",title:t("creator.editStore"),"aria-label":t("creator.editStore"),children:e.jsx(T,{name:"pen"})})]}),e.jsxs(yt,{children:[b?e.jsx(O,{src:b,alt:"",loading:"eager",style:{backgroundColor:f}}):e.jsx(O,{as:"span","aria-hidden":!0,style:{backgroundColor:f}}),e.jsxs("div",{children:[e.jsx($t,{children:x}),d?e.jsx(kt,{children:d}):null]}),e.jsxs(Nt,{children:[e.jsx(Pt,{"data-testid":"creator-hero-view",href:w,target:"_blank",rel:"noopener noreferrer",children:t("creator.viewProfile")}),e.jsx(mt,{address:a,className:"creator-hero__follow"})]})]})]})}const q=48;function Ut(){const{address:a}=fe(),i=V(),[s]=we(),n=s.has("collections"),{data:p}=J(a),x=(p==null?void 0:p.name)||(a?Q(a):t("creator.fallbackName"));Se({title:x,description:t("seo.creator.description",{name:x})});const[b,C]=y.useState("wearable"),[d,w]=y.useState(null),[m,f]=y.useState([]),[h,$]=y.useState(""),[l,k]=y.useState(""),[A,oe]=y.useState("newest"),F=h&&!Number.isNaN(Number(h))?Number(h):void 0,E=l&&!Number.isNaN(Number(l))?Number(l):void 0,re=d?et[d]:void 0,ae=(H.find(o=>o.key===A)??H[0]).server,M={creator:a,category:b,rarities:m.length?m:void 0,wearableCategories:re,minPriceCredits:F,maxPriceCredits:E,sortBy:ae},{items:N,total:se,isLoading:P,error:z,hasNextPage:ne,isFetchingNextPage:B,isFetchNextPageError:ce,fetchNextPage:le}=U(["creator-listings",M],o=>Fe({...M,first:q,skip:o}),{enabled:!!a&&!n}),g=U(["creator-collections",a],o=>Ee(a,{first:q,skip:o}).then(c=>({items:c.collections,total:c.total})),{enabled:!!a&&n});function de(o){C(o),w(null),n&&I()}function I(){const o=new URLSearchParams(s);o.delete("collections");const c=o.toString();i({search:c?`?${c}`:""},{replace:!0})}function he(){if(n){I();return}const o=new URLSearchParams(s);o.delete("collections");const c=o.toString();i({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function xe(o){f(c=>c.includes(o)?c.filter(ue=>ue!==o):[...c,o])}function ge(){C("wearable"),w(null),f([]),$(""),k("")}const L=!!(F||E),pe=L?`${h||"0"}–${l||"∞"}`:t("filter.price"),me=b!=="wearable"||!!d||m.length>0||L;return e.jsxs(Ie,{children:[e.jsxs(Re,{"aria-label":t("creator.breadcrumbAria"),children:[e.jsx(We,{onClick:()=>i("/items"),children:t("creator.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(_e,{children:x})]}),a?e.jsx(Lt,{address:a}):null,!n&&!P&&N.length>0?e.jsx(Te,{items:N,source:"creator"}):null,e.jsxs(He,{children:[e.jsx(Ge,{children:e.jsx(Ve,{category:b,subCategory:d,onCategory:de,onSub:w,title:t("creator.category"),flat:!0,collections:n,onCollections:he})}),e.jsx(Ue,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(De,{children:e.jsx(Ke,{children:g.isLoading?"…":t("creator.collectionsCount",{count:g.total})})}),g.error?e.jsx(D,{message:t("creator.error")}):null,e.jsx(K,{"data-variant":"collections",children:g.isLoading?e.jsx(S,{count:9}):e.jsxs(e.Fragment,{children:[g.items.map(o=>e.jsx(pt,{collection:o,itemCount:o.itemCount},o.contractAddress)),g.isFetchingNextPage?e.jsx(S,{count:6}):null]})}),e.jsx(G,{hasNextPage:g.hasNextPage,isFetching:g.isFetchingNextPage,isError:g.isFetchNextPageError,onLoadMore:()=>void g.fetchNextPage()}),!g.isLoading&&!g.error&&g.items.length===0?e.jsx("p",{className:"muted",children:t("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ye,{rarities:m,onToggleRarity:xe,sort:A,onSort:oe,total:se,loading:P,anyActive:me,onClear:ge,renderTrailing:o=>e.jsx(Ze,{panelKey:"price",label:pe,active:L,panel:o,children:e.jsxs(Je,{"data-variant":"price",children:[e.jsxs(Qe,{children:[e.jsx("input",{type:"number",min:"0","aria-label":t("creator.priceMin"),placeholder:t("creator.priceMinPlaceholder"),value:h,onChange:c=>$(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("creator.priceMax"),placeholder:t("creator.priceMaxPlaceholder"),value:l,onChange:c=>k(c.target.value)})]}),e.jsx(Xe,{children:t("creator.priceHint",{currency:Le.name})})]})})}),z?e.jsx(D,{message:t("creator.error")}):null,e.jsx(K,{children:P?e.jsx(S,{count:15}):e.jsxs(e.Fragment,{children:[N.map(o=>e.jsx(Ae,{item:o},o.id)),B?e.jsx(S,{count:6}):null]})}),e.jsx(G,{hasNextPage:ne,isFetching:B,isError:ce,onLoadMore:()=>void le()}),!P&&!z&&N.length===0?e.jsx("p",{className:"muted",children:t("creator.empty")}):null]})})]})]})}export{Ut as Creator,Ut as default};
@@ -1 +1 @@
1
- import{j as r}from"./react-DehiWSvs.js";import{I as i}from"./index-Da1IWtza.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx(i,{name:"alert",className:"error-notice__ico",size:18}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
1
+ import{j as r}from"./react-DehiWSvs.js";import{I as i}from"./index-Dy5Vw1H0.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx(i,{name:"alert",className:"error-notice__ico",size:18}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
@@ -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-DHADoYvF.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-B1-7yuu3.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-D-orryVV.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-BQimjtyT.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};