@dcl/shop 0.1.0-30264990312.commit-3867b6c → 0.1.0-30270468476.commit-071c9d3

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 (170) hide show
  1. package/assets/Activity-Cz1ikBbA.js +284 -0
  2. package/assets/{AnimatedBackground-CPUC8Bq4.js → AnimatedBackground-BBExv7oB.js} +3 -3
  3. package/assets/{Assets-1qlhefvR.js → Assets-CDD55lk7.js} +9 -9
  4. package/assets/{Assets.styles-jaAClODs.js → Assets.styles-B1CaeypS.js} +1 -1
  5. package/assets/{Authorizations-BY64GC7p.js → Authorizations-ZBky7Fps.js} +1 -1
  6. package/assets/{Button-32yd4_mw.js → Button-C0mFw7Q0.js} +1 -1
  7. package/assets/{Cart-BKh8h-AD.js → Cart-BoKysdAy.js} +1 -1
  8. package/assets/{CircularProgress-BlUNoMZW.js → CircularProgress-CAwo3QqI.js} +1 -1
  9. package/assets/{Collection-BLGBMPln.js → Collection-DMfTR7b6.js} +1 -1
  10. package/assets/{CollectionCarousel-DnTGnT5b.js → CollectionCarousel-ClxfOuf0.js} +1 -1
  11. package/assets/{Creator-fiT5Ak-L.js → Creator-BOr7PKtc.js} +1 -1
  12. package/assets/{ExchangeController-C8HXJHQW.js → ExchangeController-D7O0HVIS.js} +1 -1
  13. package/assets/{GetCredits-Cypy0joY.js → GetCredits-81R0mokS.js} +1 -1
  14. package/assets/{HelpersUtil-BEjuZKCH.js → HelpersUtil-BhSIsEQG.js} +1 -1
  15. package/assets/{ImportListings-B_pf2uBh.js → ImportListings-CgSizNHs.js} +1 -1
  16. package/assets/ItemDetail-HSda4F4J.js +1762 -0
  17. package/assets/{LoadMore-CJZetwig.js → LoadMore-DseV0MlP.js} +1 -1
  18. package/assets/{MarketCheckout-B6P47n_d.js → MarketCheckout-DB0ndatN.js} +1 -1
  19. package/assets/{MenuList-BNU-iAbT.js → MenuList-D2U4AWro.js} +1 -1
  20. package/assets/{MyAssets-ChJN4tna.js → MyAssets-CPerVCvd.js} +1 -1
  21. package/assets/{MyFavorites-DJK-14Tk.js → MyFavorites-C9DmnRPJ.js} +1 -1
  22. package/assets/{NotFound-C5ziYJFo.js → NotFound-BZbWWGpU.js} +1 -1
  23. package/assets/{NotificationsBell-BCOG2QxZ.js → NotificationsBell-CcSL0fus.js} +1 -1
  24. package/assets/{StoreSettings-1woa38vx.js → StoreSettings-tUVa8Io9.js} +1 -1
  25. package/assets/{Success-C6RfxIE0.js → Success-CQZAhwk3.js} +1 -1
  26. package/assets/{SwapController-uKavH_Db.js → SwapController-IzNMQ24o.js} +1 -1
  27. package/assets/{Tooltip-DEcYfA4I.js → Tooltip-ChLdaLYy.js} +1 -1
  28. package/assets/{TradeService-CzWn8tjZ.js → TradeService-C9FGvByw.js} +1 -1
  29. package/assets/{W3MFrameProviderSingleton-D2C7Xu8E.js → W3MFrameProviderSingleton-BztPgidQ.js} +3 -3
  30. package/assets/{WebCryptoP256-CKy4Rucv.js → WebCryptoP256-6gTeaG7K.js} +1 -1
  31. package/assets/{authorizations-BkaxvQnP.js → authorizations-LVujlH7N.js} +1 -1
  32. package/assets/{basic-Df5sn2Og.js → basic-CcHHcm5S.js} +1 -1
  33. package/assets/{biconomy-r4xMmuxU.js → biconomy-BYyRZm8p.js} +1 -1
  34. package/assets/{builder-rUMLIH9C.js → builder-BoAWy25K.js} +1 -1
  35. package/assets/{buy-rVVXrIk8.js → buy-C5fAE4Tk.js} +1 -1
  36. package/assets/{buy-gasless-CGSiK7Ez.js → buy-gasless-DkWqG4cD.js} +1 -1
  37. package/assets/{cart-checkout-B6kx-gf2.js → cart-checkout-Bm6eeQha.js} +1 -1
  38. package/assets/{categories-DgakJcX8.js → categories-BYiSMngY.js} +1 -1
  39. package/assets/{ccip-DqPYC0iT.js → ccip-D-SUSHY2.js} +1 -1
  40. package/assets/{ccip-_7-eIkHG.js → ccip-dayWThwi.js} +1 -1
  41. package/assets/{collection-DFf3C6ED.js → collection-Bth8_k5I.js} +1 -1
  42. package/assets/{controller-DKDIrUwY.js → controller-B9W16qW5.js} +2 -2
  43. package/assets/{core-uho5vgGt.js → core-B-5sR4Al.js} +4 -4
  44. package/assets/{custom-B5_ReoHk.js → custom-DT3TVg96.js} +1 -1
  45. package/assets/{data-capture-BUawD4rc.js → data-capture-yB25uWoP.js} +1 -1
  46. package/assets/{email-CLuIjSzu.js → email-B1UyBbY4.js} +1 -1
  47. package/assets/{embedded-wallet-CLuCvXnb.js → embedded-wallet-BtccJaHj.js} +1 -1
  48. package/assets/{emotion-styled.browser.esm-Ds1e3pqg.js → emotion-styled.browser.esm-RqaRvwIJ.js} +1 -1
  49. package/assets/{engine-D_em8H89.js → engine-D4vflTHi.js} +1 -1
  50. package/assets/{errors-xpfKLPjA.js → errors-Dqf6lF1i.js} +1 -1
  51. package/assets/{estimate-l1-fee-C6kTsCpx.js → estimate-l1-fee-DwvW303J.js} +1 -1
  52. package/assets/{execute-CFuYlcVK.js → execute-BaUM8WN1.js} +2 -2
  53. package/assets/{features-CFjSiVKY.js → features-Cejx8412.js} +1 -1
  54. package/assets/{fetchTokenMetadata-CDMOeaQw.js → fetchTokenMetadata-hqfW0OZq.js} +2 -2
  55. package/assets/{get-ecosystem-wallet-info-C81aFlPp.js → get-ecosystem-wallet-info-CceN8ViP.js} +1 -1
  56. package/assets/{getBalance-DWh26s4L.js → getBalance-BOq60Htf.js} +1 -1
  57. package/assets/{getNFT-BAoH0Ioc.js → getNFT-BT1uhLCc.js} +1 -1
  58. package/assets/{getNFT-RWu_Fge-.js → getNFT-WQ6wLGOs.js} +1 -1
  59. package/assets/{getThemeProps-CEM9EO8z.js → getThemeProps-CxqsFRQQ.js} +1 -1
  60. package/assets/{hashTypedData-BGUUNew1.js → hashTypedData-DIRqpKJD.js} +1 -1
  61. package/assets/{hashTypedData-sFgQYPbX.js → hashTypedData-ldGY6czM.js} +1 -1
  62. package/assets/{import-Bk02SdUc.js → import-BfcW9VC0.js} +1 -1
  63. package/assets/{in-app-DS80Tqeo.js → in-app-RHMiKi43.js} +1 -1
  64. package/assets/{in-app-wallet-calls-CSasDM4K.js → in-app-wallet-calls-CHCsaG0p.js} +1 -1
  65. package/assets/{index-B7nrKvDF.js → index-0vETaKW6.js} +2 -2
  66. package/assets/{index-DSYeuUL-.js → index-B1mN6E1A.js} +1 -1
  67. package/assets/{index-IMO8T-o8.js → index-B2vHUvUF.js} +1 -1
  68. package/assets/{index-C1IFrSZX.js → index-BC0JGAsO.js} +1 -1
  69. package/assets/{index-BYocHeqV.js → index-BJmcBnq5.js} +1 -1
  70. package/assets/{index-DYjgh5t6.js → index-BMGLnaLh.js} +1 -1
  71. package/assets/{index-D3S-uTEC.js → index-BMqoO8d3.js} +1 -1
  72. package/assets/{index-CTR5AAQE.js → index-BVZMk7zF.js} +1 -1
  73. package/assets/{index-C8Z_F0ID.js → index-BWZ36vyh.js} +1 -1
  74. package/assets/{index-CXHwQD12.js → index-BhbG_RoV.js} +1 -1
  75. package/assets/{index-Dwr1dhAP.js → index-BjZzDuYa.js} +1 -1
  76. package/assets/{index-U_CEsIuP.js → index-C0CWtzpF.js} +1 -1
  77. package/assets/{index-D4psGd6w.js → index-C5gvQ6I4.js} +1 -1
  78. package/assets/{index-Vn8di2-p.js → index-CA3xi9-C.js} +1 -1
  79. package/assets/{index-BwX8m6nj.js → index-CBBoSPJo.js} +1 -1
  80. package/assets/{index-B89Xu6Za.js → index-CDISO1MK.js} +1 -1
  81. package/assets/{index-HLWa4qEC.js → index-CEin_PWO.js} +1 -1
  82. package/assets/{index-C_X09RfY.js → index-CIff5ZGB.js} +1 -1
  83. package/assets/{index-CcZ-lXDm.js → index-CJGCs0w1.js} +1 -1
  84. package/assets/{index-Drp394GX.js → index-CaidRfGp.js} +1 -1
  85. package/assets/{index-D_PxLiEz.js → index-CiuTWGL8.js} +1 -1
  86. package/assets/{index-BeoXlNc7.js → index-Cm2XuGaZ.js} +1 -1
  87. package/assets/{index-BBFVlnUK.js → index-CmzbojcQ.js} +1 -1
  88. package/assets/{index-dmeHahLD.js → index-Co1s6m53.js} +1 -1
  89. package/assets/{index-BYyC-AhE.js → index-D7-WGuPj.js} +1 -1
  90. package/assets/{index-2ma7sgH2.js → index-D887F5ux.js} +1 -1
  91. package/assets/{index-YaBqCznY.js → index-DKn89nIW.js} +11 -11
  92. package/assets/{index-5AG3V6Tf.js → index-DO2Pr01D.js} +1 -1
  93. package/assets/{index-B_Fg1ZAJ.js → index-DP6tma9C.js} +1 -1
  94. package/assets/{index-DOqWxrSh.js → index-DTXSnpsP.js} +1 -1
  95. package/assets/{index-B_3HbIXn.js → index-DTkbLRUZ.js} +1 -1
  96. package/assets/{index-DGJ7Bff1.js → index-DXOEYfzl.js} +3 -3
  97. package/assets/{index-DHt65LUY.js → index-DYEbFvRt.js} +1 -1
  98. package/assets/{index-DGd2cmQm.js → index-DZak9MEk.js} +3 -3
  99. package/assets/{index-Dlg5aDRK.js → index-DdvwPc4-.js} +2 -2
  100. package/assets/{index-D3u82Kmg.js → index-Dm5e5M85.js} +1 -1
  101. package/assets/{index-CTgh5sf9.js → index-DvkrX5ye.js} +1 -1
  102. package/assets/{index-BL4LKjhU.js → index-DwtkT27Z.js} +1 -1
  103. package/assets/{index-6uIC-rir.js → index-Dy1DXK_P.js} +1 -1
  104. package/assets/{index-DrlALFLW.js → index-DyYQbYH-.js} +1 -1
  105. package/assets/{index-CQSvhWEj.js → index-ErHUvXaQ.js} +1 -1
  106. package/assets/{index-DtFHZLTQ.js → index-FGgU3KKK.js} +1 -1
  107. package/assets/{index-CN-e-sPY.js → index-ITKVn9c6.js} +1 -1
  108. package/assets/{index-B-PmZxMq.js → index-IYJz3MPB.js} +1 -1
  109. package/assets/{index-DyrJHuUq.js → index-MVkp8e7J.js} +3 -3
  110. package/assets/{index-sVkngeHu.js → index-SKjibbg2.js} +1 -1
  111. package/assets/{index-DuFdfsoK.js → index-SfExPdbm.js} +1 -1
  112. package/assets/{index-CCarvhWf.js → index-UF7uwKmo.js} +1 -1
  113. package/assets/{index-CVJsMFOS.js → index-_75wkcmX.js} +1 -1
  114. package/assets/{index-CWT6oflK.js → index-_mUwznhX.js} +2 -2
  115. package/assets/{index-NSYFDW50.js → index-yQapraNh.js} +1 -1
  116. package/assets/{index.es-DA0rIImN.js → index.es-CepefRlj.js} +4 -4
  117. package/assets/{index.es-C8J8HQKk.js → index.es-DQGcjZw1.js} +1 -1
  118. package/assets/{index.es-CFjEx5-K.js → index.es-l2IY2ojC.js} +1 -1
  119. package/assets/{localBatchGatewayRequest-D9wWzaRz.js → localBatchGatewayRequest-C7J9kEpF.js} +1 -1
  120. package/assets/{mana-rate-BjYv-yy_.js → mana-rate-ClCow8js.js} +1 -1
  121. package/assets/{networks-DTkNQ9lt.js → networks-D0XKaUxt.js} +1 -1
  122. package/assets/{onramp-BlSunIq4.js → onramp-jfcruKoz.js} +1 -1
  123. package/assets/{openzeppelin-CWlOC85g.js → openzeppelin-CcCPYRLb.js} +1 -1
  124. package/assets/{parseNft-BqlCfwHT.js → parseNft-Bh8hbeUO.js} +2 -2
  125. package/assets/{parseSignature-UFJV3xo0.js → parseSignature-CG87M4TZ.js} +1 -1
  126. package/assets/{parseSignature-BKx6fuPW.js → parseSignature-lC7f5E0E.js} +3 -3
  127. package/assets/{passkeys-CoGoqhyD.js → passkeys-Bj-lvFCY.js} +1 -1
  128. package/assets/{pay-with-exchange-7YHXW-BZ.js → pay-with-exchange-BeP2M3Qv.js} +1 -1
  129. package/assets/{qr-overlay-oXfuZNhz.js → qr-overlay-BpfmJGAi.js} +1 -1
  130. package/assets/{receive-0CI3xLMn.js → receive-COD7fdso.js} +1 -1
  131. package/assets/{resolveImplementation-DyuknAE3.js → resolveImplementation-roeco7Ws.js} +1 -1
  132. package/assets/{rpc-zbECrtn6.js → rpc-CsWpew24.js} +1 -1
  133. package/assets/{secp256k1-SjdfVvGc.js → secp256k1-CgFtQxlZ.js} +1 -1
  134. package/assets/{secp256k1-B_R1MRdR.js → secp256k1-DDF768fe.js} +1 -1
  135. package/assets/{secp256k1-DjXJjHEU.js → secp256k1-cCdOUO1G.js} +1 -1
  136. package/assets/{send-Ss_2fuq6.js → send-BAFhKY00.js} +1 -1
  137. package/assets/{send-batch-transaction-DKFk_Wlt.js → send-batch-transaction-BLJJXFHU.js} +1 -1
  138. package/assets/{send-eip712-transaction-Bx1peExo.js → send-eip712-transaction-Bz71BkCW.js} +2 -2
  139. package/assets/{send-gasless-transaction-DTyDJGf4.js → send-gasless-transaction-D71RFEDG.js} +2 -2
  140. package/assets/{send-transaction-CCBZaCtT.js → send-transaction-SAnk0Q__.js} +2 -2
  141. package/assets/{sendRawTransaction-WN2EX28n.js → sendRawTransaction-BsLS3Akr.js} +3 -3
  142. package/assets/{serializeTransaction-DXUeBRn1.js → serializeTransaction-BCs_Pp_j.js} +1 -1
  143. package/assets/{session-proposal-BdtxtinW.js → session-proposal-CiZSuAhW.js} +1 -1
  144. package/assets/{session-request-Dq4C5eg2.js → session-request-9Ve-p2ZN.js} +2 -2
  145. package/assets/{signing-SpTI6mWI.js → signing-BonuLK2W.js} +3 -3
  146. package/assets/{socials-Bs57dRxx.js → socials-Bxj_1Z0E.js} +1 -1
  147. package/assets/{swaps-DCgObHsV.js → swaps-CuOjno-D.js} +1 -1
  148. package/assets/{thirdweb-D2ym7NPl.js → thirdweb-DZ7PpVq9.js} +3 -3
  149. package/assets/{to-serializable-transaction-Bf3io36g.js → to-serializable-transaction-CMEZmVXF.js} +2 -2
  150. package/assets/{trade-encoding-CtcntXuS.js → trade-encoding-BNfrO5uz.js} +1 -1
  151. package/assets/{transactionReceipt-RQEmMhGp.js → transactionReceipt-DeaouCg8.js} +1 -1
  152. package/assets/{transactions-CsNec7EF.js → transactions-D2Vd5hsC.js} +1 -1
  153. package/assets/{useCreditPacks-BLWL1-cL.js → useCreditPacks-CvGo72Yh.js} +1 -1
  154. package/assets/{useInfiniteGrid-mJTWOLCW.js → useInfiniteGrid-BP6y2F0x.js} +1 -1
  155. package/assets/useManaRate-BgA2oiUd.js +1 -0
  156. package/assets/{useStore-DCSLSXFQ.js → useStore-D0aVskRf.js} +1 -1
  157. package/assets/{useTheme-BfZDXdIC.js → useTheme-BbjtAD5a.js} +1 -1
  158. package/assets/{verifyHash-Cal1bXA7.js → verifyHash-BP78LGMF.js} +1 -1
  159. package/assets/{w3m-modal-RHuOifg_.js → w3m-modal-Bhuvkbk7.js} +1 -1
  160. package/assets/{w3m-modal-hK2eMO5W.js → w3m-modal-DlPGU9Hi.js} +1 -1
  161. package/assets/{wait-for-tx-receipt-CWI5vC2o.js → wait-for-tx-receipt-c8TXyqT7.js} +1 -1
  162. package/assets/{wallets-B6MCDry4.js → wallets-uvClMVWd.js} +5 -5
  163. package/assets/{web-connector-DfKjFzf7.js → web-connector-Bkzu3qgs.js} +3 -3
  164. package/assets/{writeContract-CzTyMYeP.js → writeContract-B7ucurrF.js} +1 -1
  165. package/assets/{zoraTestnet-DOy_ErSs.js → zoraTestnet-Dw1u3z7B.js} +1 -1
  166. package/index.html +11 -11
  167. package/package.json +2 -2
  168. package/assets/Activity-D7lzA0aE.js +0 -284
  169. package/assets/ItemDetail-DTsEsm7f.js +0 -1762
  170. package/assets/useManaRate-CD7QH6a5.js +0 -1
@@ -0,0 +1,284 @@
1
+ import{r as m,j as e,L as D,e as et}from"./react-BW1xvPTF.js";import{s as c,J as r,O as it,B as nt,m as st,t as d,u as at,o as j,I as f,aB as S,aC as rt,aD as ot,C as y,ai as H,y as ct,aE as dt,aF as lt}from"./index-DKn89nIW.js";import{a as ut}from"./mana-rate-ClCow8js.js";import{u as ht}from"./useManaRate-BgA2oiUd.js";import{L as pt}from"./LoadMore-DseV0MlP.js";import{u as b}from"./useInfiniteGrid-BP6y2F0x.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";const xt=15e3;function mt(t,i){return t.txHash&&i.txHash?t.txHash===i.txHash:t.txHash||i.txHash?!1:t.status===i.status&&Math.abs(t.createdAt-i.createdAt)<=xt}function gt(t){const i=[...t].sort((n,a)=>a.createdAt-n.createdAt),o=[];for(const n of i){const a=o[o.length-1];a&&mt(a[a.length-1],n)?a.push(n):o.push([n])}return o.map(n=>{var a;return{id:((a=n.find(s=>s.txHash))==null?void 0:a.txHash)??n[n.length-1].id,createdAt:Math.max(...n.map(s=>s.createdAt)),status:n.some(s=>s.status==="PENDING")?"PENDING":"SETTLED",totalCredits:n.reduce((s,l)=>s+l.credits,0),lines:n}})}function ft(t){const i=[],o=new Map;for(const n of t)if(n.tradeId){const a=o.get(n.tradeId);if(a){a.quantity+=1,a.credits+=n.credits;continue}const s={key:n.tradeId,tradeId:n.tradeId,quantity:1,credits:n.credits};o.set(n.tradeId,s),i.push(s)}else i.push({key:n.id,tradeId:null,quantity:1,credits:n.credits});return i}function yt(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?ut(t.manaWei,i):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function bt(t){const o=gt(t.purchases.filter(s=>s.status!=="EXPIRED")).map(s=>({kind:"purchase",id:`purchase:${s.id}`,createdAt:s.createdAt,order:s})),n=t.sales.map(s=>{const l=yt(s,t.rate);return{kind:"sale",id:`sale:${l.id}`,createdAt:l.createdAt,sale:l}}),a=(t.creditOrders??[]).filter(s=>s.status!=="EXPIRED").map(s=>({kind:"credit",id:`credit:${s.id}`,createdAt:s.createdAt,order:s}));return[...o,...n,...a].sort((s,l)=>l.createdAt-s.createdAt||(s.id<l.id?-1:1))}function vt(t,i){return i==="all"?t:i==="sales"?t.filter(o=>o.kind==="sale"):t.filter(o=>o.kind==="purchase"||o.kind==="credit")}const z=t=>t.trim().toLowerCase();function jt(t){const i=new Map;for(const o of t??[]){const n=z(o.txHash??"");if(!n)continue;const a=i.get(n);a?a.push(o):i.set(n,[o])}return i}function kt(t,i,o=Date.now()){const n=i.txHash?t.get(z(i.txHash)):void 0;if(!n||n.length===0)return{kind:"direct"};const a=n.length===1?wt(n[0].netCents):null,s=n.filter(h=>!h.available&&h.availableAt>o);if(s.length===0)return{kind:"credited",credits:a};const l=s.reduce((h,x)=>Math.max(h,x.availableAt),0);return{kind:"pending",credits:a,availableAt:l}}function wt(t){return Math.floor(t/10)}const $t="https://cdn.decentraland.org/@dcl/shop/0.1.0-30270468476.commit-071c9d3/assets/credits-product-vs4Q6u6l.svg",It="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%200L24%2012L12%2024L0%2012L12%200ZM12.0002%203.36001L20.6402%2012L12.0002%2020.64L3.36023%2012L12.0002%203.36001ZM12.0009%2016.32C14.3868%2016.32%2016.3209%2014.3859%2016.3209%2012C16.3209%209.61415%2014.3868%207.68002%2012.0009%207.68002C9.61507%207.68002%207.68094%209.61415%207.68094%2012C7.68094%2014.3859%209.61507%2016.32%2012.0009%2016.32Z'%20fill='%2316141A'/%3e%3c/svg%3e",k=it`
2
+ 0% { background-position: 200% 0; }
3
+ 100% { background-position: -200% 0; }
4
+ `,At=c.section`
5
+ width: 100%;
6
+ min-width: 0;
7
+ min-height: 60vh;
8
+ `,Lt=c.div`
9
+ display: flex;
10
+ align-items: baseline;
11
+ gap: 12px;
12
+ margin-bottom: 20px;
13
+ `,Pt=c.h1`
14
+ font-family: ${r.font.sans};
15
+ margin: 0;
16
+ `;c.span`
17
+ color: ${r.colors.muted};
18
+ font-size: 14px;
19
+ `;const Nt=c.div`
20
+ display: flex;
21
+ gap: 8px;
22
+ margin-bottom: 20px;
23
+ flex-wrap: wrap;
24
+ `,Ct=c.button`
25
+ appearance: none;
26
+ border: 1px solid ${r.colors.line};
27
+ background: ${r.colors.white};
28
+ color: ${r.colors.text};
29
+ font-family: ${r.font.sans};
30
+ font-size: 14px;
31
+ font-weight: 600;
32
+ padding: 8px 16px;
33
+ min-height: 40px;
34
+ border-radius: ${r.radius.pill};
35
+ cursor: pointer;
36
+ transition:
37
+ background 0.15s,
38
+ border-color 0.15s,
39
+ color 0.15s;
40
+
41
+ &:hover {
42
+ background: ${r.colors.media};
43
+ }
44
+ &:focus-visible {
45
+ outline: 2px solid ${r.colors.accent};
46
+ outline-offset: 2px;
47
+ }
48
+ &[data-active='true'] {
49
+ background: ${r.colors.accent};
50
+ border-color: ${r.colors.accent};
51
+ color: ${r.colors.white};
52
+ }
53
+ `,M=c.div`
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: 16px;
57
+ max-width: 760px;
58
+ `,w=c.div`
59
+ background: ${r.colors.white};
60
+ border: 1px solid ${r.colors.line};
61
+ border-radius: 16px;
62
+ overflow: hidden;
63
+ `,$=c.div`
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: space-between;
67
+ gap: 12px;
68
+ padding: 14px 18px;
69
+ background: ${r.colors.softWhite};
70
+ border-bottom: 1px solid ${r.colors.line};
71
+
72
+ ${r.media.down("mobile")} {
73
+ flex-wrap: wrap;
74
+ }
75
+ `,I=c.div`
76
+ display: flex;
77
+ flex-direction: column;
78
+ gap: 2px;
79
+ min-width: 0;
80
+ `,A=c.span`
81
+ font-weight: 700;
82
+ color: ${r.colors.text};
83
+ `,L=c.span`
84
+ font-size: 13px;
85
+ color: ${r.colors.muted};
86
+ `,P=c.div`
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 14px;
90
+ /* Pin to the right regardless of how many elements sit on the left (the credit-purchase card adds a
91
+ leading thumbnail, giving the head three children instead of two). */
92
+ margin-left: auto;
93
+ `,Et=c.div`
94
+ flex: 0 0 auto;
95
+ width: 52px;
96
+ height: 52px;
97
+ border-radius: 10px;
98
+ background: ${r.colors.media};
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+
103
+ img {
104
+ width: 30px;
105
+ height: 30px;
106
+ display: block;
107
+ }
108
+ `,N=c.span`
109
+ font-size: 11px;
110
+ font-weight: 700;
111
+ text-transform: uppercase;
112
+ letter-spacing: 0.03em;
113
+ padding: 4px 10px;
114
+ border-radius: ${r.radius.pill};
115
+ white-space: nowrap;
116
+
117
+ &[data-status='SETTLED'] {
118
+ background: rgba(30, 166, 114, 0.14);
119
+ color: ${r.colors.okStrong};
120
+ }
121
+ &[data-status='PENDING'] {
122
+ background: rgba(245, 166, 35, 0.16);
123
+ color: #b5790a;
124
+ }
125
+ &[data-status='SOLD'] {
126
+ background: rgba(103, 58, 183, 0.14);
127
+ color: ${r.colors.accent};
128
+ }
129
+ `,p=c.div`
130
+ display: flex;
131
+ align-items: center;
132
+ gap: 5px;
133
+ font-weight: 800;
134
+ color: ${r.colors.text};
135
+ white-space: nowrap;
136
+
137
+ .ccy-mark {
138
+ width: 16px;
139
+ height: 16px;
140
+ }
141
+
142
+ // Money received (a sale) reads as income in the shop's success green.
143
+ &[data-kind='income'] {
144
+ color: ${r.colors.okStrong};
145
+ }
146
+ `,Tt=c.img`
147
+ width: 16px;
148
+ height: 16px;
149
+ vertical-align: -0.15em;
150
+ `,St=c.span`
151
+ display: inline-flex;
152
+ align-items: center;
153
+ cursor: pointer;
154
+ `,Mt=c.span`
155
+ position: fixed;
156
+ transform: translateX(-50%);
157
+ padding: 6px 8px;
158
+ border-radius: 6px;
159
+ background: #16141a;
160
+ color: #fff;
161
+ font-size: 12px;
162
+ font-weight: 600;
163
+ line-height: 1;
164
+ white-space: nowrap;
165
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
166
+ pointer-events: none;
167
+ z-index: 9999;
168
+ `,O=c.div`
169
+ display: flex;
170
+ flex-direction: column;
171
+ `,C=c.div`
172
+ display: grid;
173
+ grid-template-columns: 52px 1fr auto;
174
+ align-items: center;
175
+ gap: 14px;
176
+ padding: 12px 18px;
177
+ text-decoration: none;
178
+ color: inherit;
179
+
180
+ & + & {
181
+ border-top: 1px solid ${r.colors.line};
182
+ }
183
+
184
+ &[data-link='true'] {
185
+ transition: background 0.15s;
186
+ }
187
+ &[data-link='true']:hover {
188
+ background: ${r.colors.media};
189
+ }
190
+ &[data-link='true']:focus-visible {
191
+ outline: 2px solid ${r.colors.accent};
192
+ outline-offset: -2px;
193
+ }
194
+ `,q=c.div`
195
+ width: 52px;
196
+ height: 52px;
197
+ border-radius: 10px;
198
+ background: ${r.colors.media};
199
+ overflow: hidden;
200
+ display: flex;
201
+ align-items: center;
202
+ justify-content: center;
203
+ color: ${r.colors.muted2};
204
+
205
+ img {
206
+ width: 100%;
207
+ height: 100%;
208
+ object-fit: contain;
209
+ }
210
+ `,B=c.div`
211
+ width: 52px;
212
+ height: 52px;
213
+ border-radius: 10px;
214
+ background: linear-gradient(100deg, ${r.colors.media} 30%, ${r.colors.panel} 50%, ${r.colors.media} 70%);
215
+ background-size: 200% 100%;
216
+ animation: ${k} 1.3s infinite linear;
217
+
218
+ @media (prefers-reduced-motion: reduce) {
219
+ animation: none;
220
+ }
221
+ `,R=c.div`
222
+ min-width: 0;
223
+ display: flex;
224
+ flex-direction: column;
225
+ gap: 2px;
226
+ `,G=c.span`
227
+ font-weight: 700;
228
+ white-space: nowrap;
229
+ overflow: hidden;
230
+ text-overflow: ellipsis;
231
+ `,W=c.span`
232
+ display: inline-block;
233
+ width: 140px;
234
+ max-width: 60%;
235
+ height: 12px;
236
+ border-radius: 6px;
237
+ background: linear-gradient(100deg, ${r.colors.media} 30%, ${r.colors.panel} 50%, ${r.colors.media} 70%);
238
+ background-size: 200% 100%;
239
+ animation: ${k} 1.3s infinite linear;
240
+
241
+ @media (prefers-reduced-motion: reduce) {
242
+ animation: none;
243
+ }
244
+ `,U=c.span`
245
+ font-size: 13px;
246
+ color: ${r.colors.muted};
247
+ `,Ft=c.div`
248
+ display: flex;
249
+ align-items: center;
250
+ gap: 4px;
251
+ font-weight: 700;
252
+ color: ${r.colors.text};
253
+ white-space: nowrap;
254
+
255
+ .ccy-mark {
256
+ width: 14px;
257
+ height: 14px;
258
+ }
259
+ `,F=c.div`
260
+ height: 132px;
261
+ border-radius: 16px;
262
+ border: 1px solid transparent;
263
+ background: linear-gradient(100deg, ${r.colors.media} 30%, ${r.colors.panel} 50%, ${r.colors.media} 70%);
264
+ background-size: 200% 100%;
265
+ animation: ${k} 1.3s infinite linear;
266
+
267
+ @media (prefers-reduced-motion: reduce) {
268
+ animation: none;
269
+ }
270
+ `,Z=c.div`
271
+ display: flex;
272
+ flex-direction: column;
273
+ align-items: center;
274
+ gap: 8px;
275
+ text-align: center;
276
+ padding: 90px 20px;
277
+ min-height: 50vh;
278
+ `,_=c.p`
279
+ font-size: 22px;
280
+ font-weight: 700;
281
+ margin: 6px 0 0;
282
+ `,Dt=c(nt)`
283
+ margin-top: 12px;
284
+ `,K=C.withComponent(D),v=24,Ht=["all","purchases","sales"];function g(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function zt(t){return t.length>10?`${t.slice(0,6)}…${t.slice(-4)}`:t}function Ot(t){const i=Number(t)/1e18;return Number.isFinite(i)?i.toLocaleString("en",{maximumFractionDigits:2}):"0"}function qt({children:t}){const i=m.useRef(null),[o,n]=m.useState(null),a=()=>{var l;const s=(l=i.current)==null?void 0:l.getBoundingClientRect();s&&n({top:s.bottom+8,left:s.left+s.width/2})};return e.jsxs(St,{ref:i,tabIndex:0,onMouseEnter:a,onMouseLeave:()=>n(null),onFocus:a,onBlur:()=>n(null),children:[t,o?et.createPortal(e.jsx(Mt,{style:{top:o.top,left:o.left},role:"tooltip",children:d("activity.polygonMana")}),document.body):null]})}function Bt({item:t}){const{data:i,isLoading:o}=j({queryKey:["trade-display",t.tradeId],queryFn:()=>dt(t.tradeId),enabled:!!t.tradeId,staleTime:3e5}),n=!!t.tradeId&&o,a=(i==null?void 0:i.name)??d("activity.itemFallback"),s=(i==null?void 0:i.thumbnail)??"",l=H({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,h=e.jsxs(e.Fragment,{children:[n?e.jsx(B,{}):e.jsx(q,{children:s?e.jsx("img",{src:s,alt:a}):e.jsx(f,{name:"cart",size:20})}),e.jsxs(R,{children:[n?e.jsx(W,{}):e.jsx(G,{title:a,children:a}),t.quantity>1?e.jsx(U,{children:d("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(Ft,{children:[e.jsx(y,{className:"ccy-mark"})," ",t.credits]})]});return l?e.jsx(K,{to:l,"data-link":"true",children:h}):e.jsx(C,{children:h})}function Rt({order:t}){const i=ft(t.lines),o=i.reduce((n,a)=>n+a.quantity,0);return e.jsxs(w,{"data-testid":"purchase-order",children:[e.jsxs($,{children:[e.jsxs(I,{children:[e.jsx(A,{children:g(t.createdAt)}),e.jsxs(L,{children:[d("activity.purchaseLabel")," · ",d("activity.itemCount",{count:o})]})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(p,{children:[e.jsx(y,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),e.jsx(O,{children:i.map(n=>e.jsx(Bt,{item:n},n.key))})]})}function Gt({sale:t,payout:i}){const{data:o,isLoading:n}=j({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>lt(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),a=(o==null?void 0:o.name)??d("activity.itemFallback"),s=(o==null?void 0:o.thumbnail)??"",l=H({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,h=e.jsxs(e.Fragment,{children:[n?e.jsx(B,{}):e.jsx(q,{children:s?e.jsx("img",{src:s,alt:a}):e.jsx(f,{name:"offer",size:20})}),e.jsxs(R,{children:[n?e.jsx(W,{}):e.jsx(G,{title:a,children:a}),e.jsxs(U,{children:[d("activity.soldTo",{account:zt(t.counterparty)}),i.kind==="pending"?` · ${d("activity.payoutPendingOn",{date:g(i.availableAt)})}`:""]})]})]});return e.jsxs(w,{"data-testid":"activity-sale",children:[e.jsxs($,{children:[e.jsxs(I,{children:[e.jsx(A,{children:g(t.createdAt)}),e.jsx(L,{children:d("activity.saleLabel")})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":i.kind==="pending"?"PENDING":"SOLD",children:i.kind==="pending"?d("activity.payoutPending"):d("activity.sold")}),i.kind==="direct"?e.jsxs(p,{"data-kind":"income",children:["+",Ot(t.manaWei)," ",e.jsx(qt,{children:e.jsx(Tt,{src:It,alt:"MANA"})})]}):i.credits!==null?e.jsxs(p,{"data-kind":"income",children:[e.jsx(y,{className:"ccy-mark"})," +",ct(i.credits)]}):e.jsx(p,{"data-kind":"income",children:d("activity.payoutCredited")})]})]}),e.jsx(O,{children:l?e.jsx(K,{to:l,"data-link":"true",children:h}):e.jsx(C,{children:h})})]})}function Wt({order:t}){const i=`$${(t.usdCents/100).toFixed(2)}`;return e.jsx(w,{"data-testid":"credit-order",children:e.jsxs($,{children:[e.jsx(Et,{children:e.jsx("img",{src:$t,alt:"","aria-hidden":!0})}),e.jsxs(I,{children:[e.jsx(A,{children:g(t.createdAt)}),e.jsxs(L,{children:[d("activity.creditPurchaseLabel")," · ",d("activity.creditPaid",{usd:i})]})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(p,{"data-kind":"income",children:["+",e.jsx(y,{className:"ccy-mark"})," ",t.credits]})]})]})})}function Ut({filter:t}){const i={all:{icon:"clock",title:d("activity.emptyAllTitle"),body:d("activity.emptyAllBody")},purchases:{icon:"cart",title:d("activity.emptyPurchasesTitle"),body:d("activity.emptyPurchasesBody")},sales:{icon:"offer",title:d("activity.emptySalesTitle"),body:d("activity.emptySalesBody")}}[t];return e.jsxs(Z,{children:[e.jsx(f,{name:i.icon,size:40,color:"var(--muted-2)"}),e.jsx(_,{children:i.title}),e.jsx("p",{className:"muted",children:i.body}),t!=="sales"?e.jsx(Dt,{as:D,to:"/assets",variant:"purple",children:d("notFound.cta")}):null]})}function ne(){st({title:d("nav.activity"),noindex:!0});const{session:t}=at(),[i,o]=m.useState("all"),n=!!t&&i!=="sales",a=!!t&&i!=="purchases",s=b(["purchases",t==null?void 0:t.address],u=>ot(t.address,t.identity,{first:v,skip:u}),{enabled:n}),l=b(["sales",t==null?void 0:t.address],u=>rt(t.address,{role:"seller",first:v,skip:u}),{enabled:a}),h=b(["credit-orders",t==null?void 0:t.address],u=>S(t.address,t.identity,{first:v,skip:u}),{enabled:n}),{data:x}=j({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>S(t.address,t.identity,{first:200}).then(u=>u.payouts),enabled:a,staleTime:6e4}),X=m.useMemo(()=>jt(x),[x]),{data:Q}=ht(a);if(!t)return e.jsxs(Z,{children:[e.jsx(f,{name:"clock",size:40,color:"var(--muted-2)"}),e.jsx(_,{children:d("activity.signInTitle")}),e.jsx("p",{className:"muted",children:d("activity.signInBody")})]});const E=vt(bt({purchases:n?s.items:[],sales:a?l.items:[],creditOrders:n?h.items:[],rate:Q}),i),J=n&&(s.isLoading||h.isLoading)||a&&l.isLoading,T=n&&(s.isFetchingNextPage||h.isFetchingNextPage)||a&&l.isFetchingNextPage,V=n&&(s.hasNextPage||h.hasNextPage)||a&&l.hasNextPage;function Y(){n&&s.hasNextPage&&s.fetchNextPage(),n&&h.hasNextPage&&h.fetchNextPage(),a&&l.hasNextPage&&l.fetchNextPage()}return e.jsxs(At,{children:[e.jsx(Lt,{children:e.jsx(Pt,{children:d("nav.activity")})}),e.jsx(Nt,{role:"tablist","aria-label":d("nav.activity"),children:Ht.map(u=>e.jsx(Ct,{type:"button",role:"tab","aria-selected":i===u,"data-active":i===u,"data-testid":`activity-filter-${u}`,onClick:()=>o(u),children:d(`activity.filter.${u}`)},u))}),J?e.jsx(M,{children:Array.from({length:5}).map((u,tt)=>e.jsx(F,{},tt))}):E.length===0?e.jsx(Ut,{filter:i}):e.jsxs(e.Fragment,{children:[e.jsxs(M,{children:[E.map(u=>u.kind==="purchase"?e.jsx(Rt,{order:u.order},u.id):u.kind==="credit"?e.jsx(Wt,{order:u.order},u.id):e.jsx(Gt,{sale:u.sale,payout:kt(X,u.sale)},u.id)),T?e.jsx(F,{}):null]}),e.jsx(pt,{hasNextPage:V,isFetching:T,onLoadMore:Y})]})]})}export{ne as Activity};
@@ -1,11 +1,11 @@
1
- import{r as l,j as v}from"./react-BW1xvPTF.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30264990312.commit-3867b6c/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30264990312.commit-3867b6c/assets/DCL_LogoPattern-BryBPc3d.png",b=`
1
+ import{r as l,j as v}from"./react-BW1xvPTF.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30270468476.commit-071c9d3/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30270468476.commit-071c9d3/assets/DCL_LogoPattern-BryBPc3d.png",U=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
5
5
  v_uv = a_position * 0.5 + 0.5;
6
6
  gl_Position = vec4(a_position, 0.0, 1.0);
7
7
  }
8
- `,U=`
8
+ `,b=`
9
9
  precision highp float;
10
10
 
11
11
  uniform float u_time;
@@ -77,4 +77,4 @@ void main() {
77
77
 
78
78
  gl_FragColor = result;
79
79
  }
80
- `;function g(t,a,r){const e=t.createShader(a);return e?(t.shaderSource(e,r),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)?e:(console.error("Shader compile error:",t.getShaderInfoLog(e)),t.deleteShader(e),null)):null}function P(t,a,r){const e=t.createProgram();return e?(t.attachShader(e,a),t.attachShader(e,r),t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS)?e:(console.error("Program link error:",t.getProgramInfoLog(e)),t.deleteProgram(e),null)):null}function D(t,a,r){const e=t.createTexture();if(!e)return null;t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([128,128,128,255]));const o=new Image;return o.crossOrigin="anonymous",o.onload=()=>{r!=null&&r()||(t.bindTexture(t.TEXTURE_2D,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D))},o.src=a,e}function L(){const t=l.useRef(null),a=l.useRef(0);return l.useEffect(()=>{var h;const r=t.current;if(!r||(h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=g(e,e.VERTEX_SHADER,b),c=g(e,e.FRAGMENT_SHADER,U);if(!o||!c){o&&e.deleteShader(o),c&&e.deleteShader(c);return}const n=P(e,o,c);if(!n){e.deleteShader(o),e.deleteShader(c);return}const u=e.getAttribLocation(n,"a_position"),_=e.getUniformLocation(n,"u_time"),R=e.getUniformLocation(n,"u_resolution"),y=e.getUniformLocation(n,"u_overlayTex"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);let m=!1;const d=D(e,S,()=>m),A=()=>{const i=window.devicePixelRatio||1,x=r.clientWidth*i,E=r.clientHeight*i;(r.width!==x||r.height!==E)&&(r.width=x,r.height=E)},p=performance.now()/1e3,f=()=>{A(),e.viewport(0,0,r.width,r.height),e.useProgram(n),e.uniform1f(_,performance.now()/1e3-p),e.uniform2f(R,r.width,r.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),e.uniform1i(y,0),e.enableVertexAttribArray(u),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),a.current=requestAnimationFrame(f)},T=i=>{i.preventDefault(),cancelAnimationFrame(a.current),r.style.opacity="0"};return r.addEventListener("webglcontextlost",T,!1),a.current=requestAnimationFrame(f),()=>{m=!0,cancelAnimationFrame(a.current),r.removeEventListener("webglcontextlost",T),e.deleteProgram(n),e.deleteShader(o),e.deleteShader(c),e.deleteBuffer(s),e.deleteTexture(d)}},[]),v.jsxs("div",{className:"AnimatedBackground","aria-hidden":!0,children:[v.jsx("div",{className:"AnimatedBackground__fallback",style:{backgroundImage:`url(${w})`}}),v.jsx("canvas",{ref:t,className:"AnimatedBackground__canvas"})]})}export{L as default};
80
+ `;function g(t,a,r){const e=t.createShader(a);return e?(t.shaderSource(e,r),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)?e:(console.error("Shader compile error:",t.getShaderInfoLog(e)),t.deleteShader(e),null)):null}function P(t,a,r){const e=t.createProgram();return e?(t.attachShader(e,a),t.attachShader(e,r),t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS)?e:(console.error("Program link error:",t.getProgramInfoLog(e)),t.deleteProgram(e),null)):null}function D(t,a,r){const e=t.createTexture();if(!e)return null;t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([128,128,128,255]));const o=new Image;return o.crossOrigin="anonymous",o.onload=()=>{r!=null&&r()||(t.bindTexture(t.TEXTURE_2D,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D))},o.src=a,e}function L(){const t=l.useRef(null),a=l.useRef(0);return l.useEffect(()=>{var h;const r=t.current;if(!r||(h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=g(e,e.VERTEX_SHADER,U),c=g(e,e.FRAGMENT_SHADER,b);if(!o||!c){o&&e.deleteShader(o),c&&e.deleteShader(c);return}const n=P(e,o,c);if(!n){e.deleteShader(o),e.deleteShader(c);return}const u=e.getAttribLocation(n,"a_position"),_=e.getUniformLocation(n,"u_time"),R=e.getUniformLocation(n,"u_resolution"),y=e.getUniformLocation(n,"u_overlayTex"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);let m=!1;const d=D(e,S,()=>m),A=()=>{const i=window.devicePixelRatio||1,x=r.clientWidth*i,E=r.clientHeight*i;(r.width!==x||r.height!==E)&&(r.width=x,r.height=E)},p=performance.now()/1e3,f=()=>{A(),e.viewport(0,0,r.width,r.height),e.useProgram(n),e.uniform1f(_,performance.now()/1e3-p),e.uniform2f(R,r.width,r.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),e.uniform1i(y,0),e.enableVertexAttribArray(u),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),a.current=requestAnimationFrame(f)},T=i=>{i.preventDefault(),cancelAnimationFrame(a.current),r.style.opacity="0"};return r.addEventListener("webglcontextlost",T,!1),a.current=requestAnimationFrame(f),()=>{m=!0,cancelAnimationFrame(a.current),r.removeEventListener("webglcontextlost",T),e.deleteProgram(n),e.deleteShader(o),e.deleteShader(c),e.deleteBuffer(s),e.deleteTexture(d)}},[]),v.jsxs("div",{className:"AnimatedBackground","aria-hidden":!0,children:[v.jsx("div",{className:"AnimatedBackground__fallback",style:{backgroundImage:`url(${w})`}}),v.jsx("canvas",{ref:t,className:"AnimatedBackground__canvas"})]})}export{L as default};
@@ -1,4 +1,4 @@
1
- import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h as Xe,c as Ye,r as et,s,J as t,u as oe,a as tt,b as Ne,y as _e,w as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as Ae,K as rt,A as Q,aE as it,aF as at}from"./index-YaBqCznY.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-BjYv-yy_.js";import{u as Me}from"./useManaRate-CD7QH6a5.js";import{g as dt,h as ft,i as pt,j as ut,k as xt,C as ht,l as mt,o as gt,m as bt,n as yt,M as wt}from"./Assets.styles-jaAClODs.js";import{d as me,R as vt,F as jt,S as ge,b as $t}from"./categories-DgakJcX8.js";import{L as Ct}from"./LoadMore-CJZetwig.js";import{M as kt}from"./MarketCheckout-B6P47n_d.js";import{u as St}from"./useInfiniteGrid-mJTWOLCW.js";import{E as Rt}from"./ErrorNotice-BG40E5Ff.js";import{d as Et}from"./dcl-schemas-BICTSpB5.js";import{u as It,G as Tt,w as zt,S as Nt}from"./buy-gasless-CGSiK7Ez.js";import{s as _t}from"./buy-rVVXrIk8.js";import{i as At}from"./trade-encoding-CtcntXuS.js";import{f as Pt}from"./errors-xpfKLPjA.js";import{J as Mt,C as Lt,B as se}from"./ethers-CtVvB8eG.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-BV_ZSgtd.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-DEcYfA4I.js";import"./authorizations-BkaxvQnP.js";import"./sendMetaTransaction-CiO3jI6F.js";function J(n){const r=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${f}`}const H="100000000000000000000",Le=2,V=15,Wt=/^[a-zA-Z0-9]+$/;function be(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Wt.test(r)?r.length<Le?{ok:!1,reason:"too-short"}:r.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ht(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Ot=["function available(string _subdomain) view returns (bool)"],ye={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ut(){return W.chainId===Et.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function qt(n,r={}){var d;const{rpc:f,address:u}=Ut(),h=new Mt(f),l=new Lt(u,Ot,h);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const c=await l.available(n);if((d=r.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${c}`),c?"available":"taken"}const Gt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Dt(n){return ct(H,n)}async function Vt(n,r,f={}){var d;const u=f.chainId??W.chainId,h=f.provider??"across",l=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${u}&provider=${h}`,c=await et(l,{method:"GET",identity:n,metadata:{}});if(!c.ok){let a;try{a=(d=await c.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${c.status}`)}return c.json()}function Kt(n,r){const f=se.from(n.availableAmount),h=se.from(H).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:At(n.id)}],creditsSignatures:[n.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:H}}async function Qt(n,r={}){const f=Gt,u=r.intervalMs??1e4,h=r.maxAttempts??60;let l={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let c=0;c<h;c++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),x=(a.status??"pending").toLowerCase(),m=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(x==="filled")return{status:"filled",destinationTxHash:m,actionsSucceeded:w};if(x==="refunded"||x==="expired")return{status:x,destinationTxHash:null,actionsSucceeded:!1};l={status:"pending",destinationTxHash:m,actionsSucceeded:w}}}catch{}c<h-1&&await new Promise(d=>setTimeout(d,u))}return l}async function Jt(n){const{name:r,identity:f,signer:u}=n,h=n.chainId??W.chainId,l=n.provider??"across",c=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:r,buyer:c,chainId:h,provider:l});try{const x=await lt(h),m=Dt(x);console.info("[names] step 1/6 sized reservation",{usdCents:m,manaRate:x});const w=await Vt(f,r,{chainId:h,provider:l});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Xe(f,m);if(d=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),se.from(j.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const k=Kt(j.credit,w);let g;try{g=await It({chainId:h,buyer:c,signer:u,args:k})}catch(y){if(!(y instanceof Tt))throw y;g=await _t(h,k,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:g}),await zt(g),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:g}),l==="across"){const y=await Qt(g,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:g};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:g,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:g}}catch(x){if(console.error("[names] register failed — raw error:",x,{name:r,buyer:c,originConfirmed:a}),x instanceof Nt)return{status:"pending",originTxHash:x.txHash};throw d&&!a&&await Ye(f,[d]).catch(()=>{}),x instanceof Be?x:new Error(Pt(x,"Couldn't register the name. Please try again.",{sale:!0}))}}const Zt=s.div`
1
+ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h as Xe,c as Ye,r as et,s,J as t,u as oe,a as tt,b as Ne,y as Ae,w as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as _e,K as rt,A as Q,az as it,aA as at}from"./index-DKn89nIW.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-ClCow8js.js";import{u as Me}from"./useManaRate-BgA2oiUd.js";import{g as dt,h as ft,i as pt,j as ut,k as xt,C as ht,l as mt,o as gt,m as bt,n as yt,M as wt}from"./Assets.styles-B1CaeypS.js";import{d as me,R as vt,F as jt,S as ge,b as $t}from"./categories-BYiSMngY.js";import{L as Ct}from"./LoadMore-DseV0MlP.js";import{M as kt}from"./MarketCheckout-DB0ndatN.js";import{u as St}from"./useInfiniteGrid-BP6y2F0x.js";import{E as Rt}from"./ErrorNotice-BG40E5Ff.js";import{d as It}from"./dcl-schemas-BICTSpB5.js";import{u as Et,G as Tt,w as zt,S as Nt}from"./buy-gasless-DkWqG4cD.js";import{s as At}from"./buy-C5fAE4Tk.js";import{i as _t}from"./trade-encoding-BNfrO5uz.js";import{f as Pt}from"./errors-Dqf6lF1i.js";import{J as Mt,C as Lt,B as se}from"./ethers-CtVvB8eG.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-BV_ZSgtd.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-ChLdaLYy.js";import"./authorizations-LVujlH7N.js";import"./sendMetaTransaction-CiO3jI6F.js";function J(n){const r=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${f}`}const H="100000000000000000000",Le=2,V=15,Wt=/^[a-zA-Z0-9]+$/;function be(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Wt.test(r)?r.length<Le?{ok:!1,reason:"too-short"}:r.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ht(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Ot=["function available(string _subdomain) view returns (bool)"],ye={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ut(){return W.chainId===It.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function qt(n,r={}){var d;const{rpc:f,address:u}=Ut(),h=new Mt(f),l=new Lt(u,Ot,h);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const c=await l.available(n);if((d=r.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${c}`),c?"available":"taken"}const Gt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Dt(n){return ct(H,n)}async function Vt(n,r,f={}){var d;const u=f.chainId??W.chainId,h=f.provider??"across",l=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${u}&provider=${h}`,c=await et(l,{method:"GET",identity:n,metadata:{}});if(!c.ok){let a;try{a=(d=await c.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${c.status}`)}return c.json()}function Kt(n,r){const f=se.from(n.availableAmount),h=se.from(H).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:_t(n.id)}],creditsSignatures:[n.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:H}}async function Qt(n,r={}){const f=Gt,u=r.intervalMs??1e4,h=r.maxAttempts??60;let l={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let c=0;c<h;c++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),x=(a.status??"pending").toLowerCase(),m=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(x==="filled")return{status:"filled",destinationTxHash:m,actionsSucceeded:w};if(x==="refunded"||x==="expired")return{status:x,destinationTxHash:null,actionsSucceeded:!1};l={status:"pending",destinationTxHash:m,actionsSucceeded:w}}}catch{}c<h-1&&await new Promise(d=>setTimeout(d,u))}return l}async function Jt(n){const{name:r,identity:f,signer:u}=n,h=n.chainId??W.chainId,l=n.provider??"across",c=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:r,buyer:c,chainId:h,provider:l});try{const x=await lt(h),m=Dt(x);console.info("[names] step 1/6 sized reservation",{usdCents:m,manaRate:x});const w=await Vt(f,r,{chainId:h,provider:l});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Xe(f,m);if(d=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),se.from(j.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const k=Kt(j.credit,w);let g;try{g=await Et({chainId:h,buyer:c,signer:u,args:k})}catch(y){if(!(y instanceof Tt))throw y;g=await At(h,k,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:g}),await zt(g),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:g}),l==="across"){const y=await Qt(g,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:g};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:g,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:g}}catch(x){if(console.error("[names] register failed — raw error:",x,{name:r,buyer:c,originConfirmed:a}),x instanceof Nt)return{status:"pending",originTxHash:x.txHash};throw d&&!a&&await Ye(f,[d]).catch(()=>{}),x instanceof Be?x:new Error(Pt(x,"Couldn't register the name. Please try again.",{sale:!0}))}}const Zt=s.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -94,7 +94,7 @@ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h a
94
94
  `,Re=s.div`
95
95
  flex: 1;
96
96
  min-width: 0;
97
- `,Ee=s.div`
97
+ `,Ie=s.div`
98
98
  font-family: ${t.font.sans};
99
99
  font-weight: 700;
100
100
  font-size: 20px;
@@ -108,7 +108,7 @@ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h a
108
108
  font-weight: 400;
109
109
  color: ${t.colors.muted2};
110
110
  }
111
- `,Ie=s.div`
111
+ `,Ee=s.div`
112
112
  font-family: ${t.font.sans};
113
113
  font-size: 14px;
114
114
  color: ${t.colors.muted2};
@@ -366,7 +366,7 @@ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h a
366
366
  flex: none;
367
367
  color: ${t.colors.dclRed};
368
368
  }
369
- `;function wn({name:n,priceCredits:r,onClose:f}){const{session:u}=oe(),{data:h,isError:l}=tt(u),c=Ne(),d=Je(),[a,x]=p.useState("confirm"),[m,w]=p.useState(""),[j,k]=p.useState(null),g=p.useRef(!1),y=m.trim().toLowerCase()===n.toLowerCase(),v=a==="completing",S=r!=null?_e(r):"—";p.useEffect(()=>{const b=T=>{T.key==="Escape"&&!v&&f()};document.addEventListener("keydown",b);const _=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",b),document.body.style.overflow=_}},[v,f]);async function C(){if(!(!u||!y||g.current)){g.current=!0,x("completing"),k(null);try{await Jt({name:n,identity:u.identity,signer:u.signer}),D("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:r??null}),c.invalidateQueries({queryKey:["usd-balance"]}),c.invalidateQueries({queryKey:["my-assets"]}),x("success")}catch(b){D(ot(b)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:st(b),purchase_type:"name"}),k((b==null?void 0:b.message)||o("names.errorGeneric")),x("error")}finally{g.current=!1}}}const E=a!=="success",R=nt(u==null?void 0:u.providerType);return e.jsx(Zt,{onClick:v?void 0:f,role:"presentation",children:e.jsxs(Xt,{role:"dialog","aria-modal":"true","aria-label":o("names.buyTitle"),onClick:b=>b.stopPropagation(),children:[E&&e.jsxs(e.Fragment,{children:[e.jsxs(we,{children:[e.jsx(ve,{children:a==="error"?o("names.errorTitle"):o("names.buyTitle")}),e.jsx(je,{onClick:f,disabled:v,"aria-label":o("buyModal.close"),children:e.jsx(N,{name:"close"})})]}),e.jsxs($e,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",he(h,l)]}),e.jsx(Ce,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(ke,{children:[e.jsx(Se,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(Ee,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ie,{children:o("names.subtitle")})]}),e.jsxs(Te,{children:[e.jsx(F,{}),S]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(yn,{children:[e.jsx(N,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(ze,{onClick:()=>x("confirm"),children:o("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Yt,{children:[e.jsx(en,{children:o("names.confirmTitle")}),e.jsx(tn,{dangerouslySetInnerHTML:{__html:o("names.confirmBody",{name:`<b>@${vn(n)}</b>`})}}),e.jsxs(nn,{children:[e.jsx(sn,{"aria-hidden":!0,children:"@"}),e.jsx(on,{value:m,onChange:b=>w(b.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":o("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(m.length,8)}ch`}}),e.jsx(rn,{children:".dcl.eth"})]})]}),e.jsx(ze,{onClick:()=>void C(),disabled:!y||!u,children:o("names.buyCta")})]})]}),a==="completing"&&e.jsxs(an,{children:[e.jsx(ln,{src:Bt,alt:"",width:56,height:56}),e.jsx(cn,{children:R?o("names.confirming"):o("names.completing")}),e.jsxs(dn,{children:[e.jsx(fn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(pn,{children:"1/1"})]})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(we,{children:[e.jsx(ve,{children:o("names.successHeaderTitle")}),e.jsx(je,{onClick:f,"aria-label":o("buyModal.close"),children:e.jsx(N,{name:"close"})})]}),e.jsxs($e,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",he(h,l)]}),e.jsx(Ce,{}),e.jsxs(un,{children:[e.jsx(xn,{"aria-hidden":!0,children:e.jsx(N,{name:"check"})}),e.jsxs(hn,{children:[e.jsx("b",{children:o("names.successBannerBold")})," ",o("names.successBannerRest")]})]}),e.jsxs(ke,{style:{marginTop:20},children:[e.jsx(Se,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(Ee,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ie,{children:o("names.subtitle")})]}),e.jsxs(Te,{children:[e.jsx(F,{}),S]})]}),e.jsxs(mn,{children:[e.jsx(gn,{onClick:()=>{f(),d("/my-assets")},children:o("names.myItems")}),e.jsx(bn,{href:W.profileUrl,target:"_blank",rel:"noopener noreferrer",children:o("names.assignToAvatar")})]})]})]})})}function vn(n){return n.replace(/[&<>"']/g,r=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[r])}const jn=s.div`
369
+ `;function wn({name:n,priceCredits:r,onClose:f}){const{session:u}=oe(),{data:h,isError:l}=tt(u),c=Ne(),d=Je(),[a,x]=p.useState("confirm"),[m,w]=p.useState(""),[j,k]=p.useState(null),g=p.useRef(!1),y=m.trim().toLowerCase()===n.toLowerCase(),v=a==="completing",S=r!=null?Ae(r):"—";p.useEffect(()=>{const b=T=>{T.key==="Escape"&&!v&&f()};document.addEventListener("keydown",b);const A=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",b),document.body.style.overflow=A}},[v,f]);async function C(){if(!(!u||!y||g.current)){g.current=!0,x("completing"),k(null);try{await Jt({name:n,identity:u.identity,signer:u.signer}),D("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:r??null}),c.invalidateQueries({queryKey:["usd-balance"]}),c.invalidateQueries({queryKey:["my-assets"]}),x("success")}catch(b){D(ot(b)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:st(b),purchase_type:"name"}),k((b==null?void 0:b.message)||o("names.errorGeneric")),x("error")}finally{g.current=!1}}}const I=a!=="success",R=nt(u==null?void 0:u.providerType);return e.jsx(Zt,{onClick:v?void 0:f,role:"presentation",children:e.jsxs(Xt,{role:"dialog","aria-modal":"true","aria-label":o("names.buyTitle"),onClick:b=>b.stopPropagation(),children:[I&&e.jsxs(e.Fragment,{children:[e.jsxs(we,{children:[e.jsx(ve,{children:a==="error"?o("names.errorTitle"):o("names.buyTitle")}),e.jsx(je,{onClick:f,disabled:v,"aria-label":o("buyModal.close"),children:e.jsx(N,{name:"close"})})]}),e.jsxs($e,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",he(h,l)]}),e.jsx(Ce,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(ke,{children:[e.jsx(Se,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(Ie,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:o("names.subtitle")})]}),e.jsxs(Te,{children:[e.jsx(F,{}),S]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(yn,{children:[e.jsx(N,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(ze,{onClick:()=>x("confirm"),children:o("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Yt,{children:[e.jsx(en,{children:o("names.confirmTitle")}),e.jsx(tn,{dangerouslySetInnerHTML:{__html:o("names.confirmBody",{name:`<b>@${vn(n)}</b>`})}}),e.jsxs(nn,{children:[e.jsx(sn,{"aria-hidden":!0,children:"@"}),e.jsx(on,{value:m,onChange:b=>w(b.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":o("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(m.length,8)}ch`}}),e.jsx(rn,{children:".dcl.eth"})]})]}),e.jsx(ze,{onClick:()=>void C(),disabled:!y||!u,children:o("names.buyCta")})]})]}),a==="completing"&&e.jsxs(an,{children:[e.jsx(ln,{src:Bt,alt:"",width:56,height:56}),e.jsx(cn,{children:R?o("names.confirming"):o("names.completing")}),e.jsxs(dn,{children:[e.jsx(fn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(pn,{children:"1/1"})]})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(we,{children:[e.jsx(ve,{children:o("names.successHeaderTitle")}),e.jsx(je,{onClick:f,"aria-label":o("buyModal.close"),children:e.jsx(N,{name:"close"})})]}),e.jsxs($e,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",he(h,l)]}),e.jsx(Ce,{}),e.jsxs(un,{children:[e.jsx(xn,{"aria-hidden":!0,children:e.jsx(N,{name:"check"})}),e.jsxs(hn,{children:[e.jsx("b",{children:o("names.successBannerBold")})," ",o("names.successBannerRest")]})]}),e.jsxs(ke,{style:{marginTop:20},children:[e.jsx(Se,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(Ie,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:o("names.subtitle")})]}),e.jsxs(Te,{children:[e.jsx(F,{}),S]})]}),e.jsxs(mn,{children:[e.jsx(gn,{onClick:()=>{f(),d("/my-assets")},children:o("names.myItems")}),e.jsx(bn,{href:W.profileUrl,target:"_blank",rel:"noopener noreferrer",children:o("names.assignToAvatar")})]})]})]})})}function vn(n){return n.replace(/[&<>"']/g,r=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[r])}const jn=s.div`
370
370
  width: 100%;
371
371
  min-width: 0;
372
372
  `,$n=s.nav`
@@ -425,12 +425,12 @@ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h a
425
425
  padding: 40px 20px;
426
426
  gap: 28px;
427
427
  }
428
- `,En=s.div`
428
+ `,In=s.div`
429
429
  display: flex;
430
430
  flex-direction: column;
431
431
  align-items: center;
432
432
  gap: 12px;
433
- `,In=s.h1`
433
+ `,En=s.h1`
434
434
  margin: 0;
435
435
  font-family: ${t.font.sans};
436
436
  font-weight: 600;
@@ -460,7 +460,7 @@ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h a
460
460
  gap: 12px;
461
461
  `,Nn=s.div`
462
462
  position: relative;
463
- `,_n=s("div",Ft("invalid"))`
463
+ `,An=s("div",Ft("invalid"))`
464
464
  display: flex;
465
465
  align-items: center;
466
466
  gap: 8px;
@@ -476,7 +476,7 @@ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h a
476
476
  ${t.media.down("mobile")} {
477
477
  border-radius: 16px;
478
478
  }
479
- `,An=s.span`
479
+ `,_n=s.span`
480
480
  position: absolute;
481
481
  left: -9999px;
482
482
  top: 0;
@@ -755,4 +755,4 @@ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h a
755
755
  clip: rect(0, 0, 0, 0);
756
756
  white-space: nowrap;
757
757
  border: 0;
758
- `,Jn="https://docs.decentraland.org/creator/worlds/about/";function Zn(n){const r=typeof window<"u"?window.location.hostname:"";return`${r.endsWith("decentraland.org")?"https://decentraland.org":r.endsWith("decentraland.today")?"https://decentraland.today":"https://decentraland.zone"}/marketplace/names/browse?search=${encodeURIComponent(n)}`}function Xn({onBack:n}){Ae({title:o("seo.names.title"),description:o("seo.names.description")});const{session:r,signIn:f}=oe(),{data:u}=Me(),h=u?Pe(H,u):null,[l,c]=p.useState(""),[d,a]=p.useState("idle"),[x,m]=p.useState(!1),w=p.useRef(null),[j,k]=p.useState(void 0);p.useLayoutEffect(()=>{w.current&&k(w.current.offsetWidth)},[l]),p.useEffect(()=>{if(!be(l).ok){a(l.length===0?"idle":"invalid");return}a("checking");const E=new AbortController,R=setTimeout(()=>{(async()=>{try{const b=await qt(l,{signal:E.signal});a(b)}catch(b){if((b==null?void 0:b.name)==="AbortError")return;a("error")}})()},400);return()=>{clearTimeout(R),E.abort()}},[l]);const g=be(l),y=g.ok&&(d==="available"||d==="error");function v(){if(y){if(!r){f();return}m(!0)}}const S=e.jsxs(e.Fragment,{children:[o("names.claim"),h!=null?e.jsxs(Un,{children:[e.jsx(F,{}),_e(h)]}):null]});return e.jsxs(jn,{"data-testid":"names-page",children:[e.jsxs($n,{"aria-label":o("names.breadcrumbAria"),children:[e.jsx(Cn,{onClick:n,children:o("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(kn,{children:o("names.breadcrumbCurrent")})]}),e.jsxs(Sn,{children:[e.jsxs(Rn,{children:[e.jsxs(En,{children:[e.jsx(In,{children:o("names.heroTitle")}),e.jsx(Tn,{children:o("names.heroSubtitle")})]}),e.jsxs(zn,{children:[e.jsxs(Nn,{children:[e.jsxs(_n,{invalid:d==="taken",children:[e.jsxs(Ln,{children:[e.jsx(Bn,{"aria-hidden":!0,children:"@"}),e.jsx(Fn,{value:l,onChange:C=>c(Ht(C.target.value)),placeholder:o("names.inputPlaceholder"),"aria-label":o("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:V,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(An,{ref:w,"aria-hidden":!0,children:l||o("names.inputPlaceholder")}),e.jsx(Wn,{children:o("names.suffix")})]}),l.length>0?e.jsxs(Hn,{"aria-hidden":!0,children:[l.length,"/",V]}):null,e.jsx(Fe,{onClick:v,disabled:!y,"data-testid":"names-claim",children:S})]}),d==="taken"?e.jsxs(Pn,{role:"status","data-testid":"names-taken",children:[e.jsx(N,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:o("names.taken")}),e.jsxs(Mn,{href:Zn(l),target:"_blank",rel:"noopener noreferrer",children:[o("names.takenMakeOffer"),e.jsx(N,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(On,{onClick:v,disabled:!y,children:S}),d==="checking"?e.jsx(Z,{tone:"muted",role:"status","data-testid":"names-checking",children:o("names.checking")}):d==="error"?e.jsx(Z,{tone:"muted",role:"status",children:o("names.checkError")}):d==="invalid"&&!g.ok&&g.reason==="too-short"?e.jsx(Z,{tone:"muted",role:"status",children:o("names.tooShort",{min:Le})}):null,e.jsx(Qn,{role:"status","aria-live":"polite",children:d==="available"?o("names.available",{name:l}):""})]})]}),e.jsxs(qn,{children:[e.jsx(Gn,{children:o("names.whyTitle")}),e.jsxs(Dn,{children:[e.jsxs(X,{children:[e.jsx(Y,{"aria-hidden":!0}),e.jsx(ee,{children:e.jsx(te,{children:o("names.why1")})})]}),e.jsxs(X,{children:[e.jsx(Y,{"aria-hidden":!0}),e.jsxs(ee,{children:[e.jsx(te,{children:o("names.why2")}),e.jsxs(Vn,{href:Jn,target:"_blank",rel:"noopener noreferrer",children:[o("names.why2Link"),e.jsx(N,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(X,{children:[e.jsx(Y,{"aria-hidden":!0}),e.jsxs(ee,{children:[e.jsx(te,{children:o("names.why3")}),e.jsx(Kn,{children:o("names.why3Link")})]})]})]})]})]}),x?e.jsx(wn,{name:l,priceCredits:h,onClose:()=>m(!1)}):null]})}const ne=48;function Yn(n){return{tradeId:n.tradeId??n.id,listingType:"primary",contractAddress:n.contractAddress,itemId:n.itemId??"",name:n.name,thumbnail:n.thumbnail,rarity:n.rarity,category:n.category,wearableCategory:n.wearableCategory??null,creator:n.creator,manaWei:n.manaWei??"0",available:1,network:n.network,chainId:n.chainId,createdAt:0}}function Cs(){const[n]=Ze(),r=(n.get("q")??"").trim().toLowerCase(),f=Ne(),{session:u,signIn:h}=oe(),l=(n.get("q")??"").trim();Ae({title:l?o("seo.collectibles.searchTitle",{query:l}):o("seo.collectibles.title"),description:o("seo.collectibles.description")});const[c,d]=p.useState("wearable"),[a,x]=p.useState(null),[m,w]=p.useState([]),[j,k]=p.useState(""),[g,y]=p.useState(""),[v,S]=p.useState("on_sale"),[C,E]=p.useState(!1),[R,b]=p.useState("newest"),[_,T]=p.useState(!1),[re,K]=p.useState(null);p.useEffect(()=>{if(!_)return;const i=B=>{B.key==="Escape"&&T(!1)};document.addEventListener("keydown",i);const $=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",i),document.body.style.overflow=$}},[_]);const O=v==="on_sale",A=j&&!Number.isNaN(Number(j))?Number(j):void 0,P=g&&!Number.isNaN(Number(g))?Number(g):void 0,ie=a?$t[a]:void 0,ae=(me.find(i=>i.key===R)??me[0]).server,le={category:c,rarities:m.length?m:void 0,wearableCategories:ie,minPriceCredits:A,maxPriceCredits:P,search:r||void 0,sortBy:ae,isSmart:C||void 0,onSale:!0},ce={category:c,rarities:m.length?m:void 0,wearableCategories:ie,search:r||void 0,sortBy:ae,isWearableSmart:C||void 0,isOnSale:v==="not_for_sale"?!1:void 0},{items:M,total:de,isLoading:I,isPlaceholderData:z,error:We,hasNextPage:He,isFetchingNextPage:fe,fetchNextPage:Oe}=St(O?["shop-items",le]:["catalog-items",ce],i=>O?it({...le,first:ne,skip:i}):at({...ce,first:ne,skip:i}),{enabled:c!=="names"}),U=de,Ue=I||z,qe=I?15:Math.min(Math.max(M.length,1),ne),{data:q,isError:Ge}=Me(),De=i=>q&&i.manaWei?Pe(i.manaWei,q):null,pe=p.useRef(null);p.useEffect(()=>{I||z||!r||pe.current===r||(pe.current=r,D("Shop Searched",{query:r,result_count:U}))},[r,I,z,U]);const G=p.useRef("__init__");p.useEffect(()=>{if(I||z)return;const i=JSON.stringify({category:c,subCategory:a,rarities:m,min:A,max:P,sort:R,status:v,smart:C});if(G.current==="__init__"||G.current===i){G.current=i;return}G.current=i,D("Shop Applied Filter",{filters:{category:c,sub_category:a,rarities:m,min_price_credits:A??null,max_price_credits:P??null,status:v,smart:C,sort:R},result_count:U})},[c,a,m,A,P,R,v,C,I,z,U]);function ue(i){d(i),x(null)}function xe(i){w($=>$.includes(i)?$.filter(B=>B!==i):[...$,i])}function Ve(){d("wearable"),x(null),w([]),k(""),y(""),S("on_sale"),E(!1)}function Ke(i){const $=M.find(B=>B.id===i.id);if(!(!$||$.source!=="legacy"||!$.manaWei)){if(!u){h();return}K(Yn($))}}function Qe(){f.invalidateQueries({queryKey:["shop-items"]})}const L=[];(A!=null||P!=null)&&L.push({key:"price",label:o("filter.price"),onRemove:()=>{k(""),y("")}});for(const i of vt)m.includes(i)&&L.push({key:`rarity-${i}`,label:rt(i),onRemove:()=>xe(i)});return C&&L.push({key:"smart",label:o("filter.smart"),onRemove:()=>E(!1)}),v!=="on_sale"&&L.push({key:"status",label:v==="all"?o("filter.statusAll"):o("filter.notForSale"),onRemove:()=>S("on_sale")}),e.jsxs(dt,{"data-testid":"browse",children:[c!=="names"&&e.jsxs(e.Fragment,{children:[_?e.jsx(ft,{onClick:()=>T(!1),"aria-hidden":!0}):null,e.jsxs(pt,{className:_?"is-open":"","data-testid":"browse-sidebar",children:[e.jsxs(ut,{children:[e.jsx(xt,{children:o("assets.filters")}),e.jsx(ht,{onClick:()=>T(!1),"aria-label":o("assets.closeFilters"),children:"✕"})]}),e.jsx(mt,{children:e.jsx(gt,{category:c,subCategory:a,onCategory:ue,onSub:x,priceMin:j,priceMax:g,onPriceMin:k,onPriceMax:y,rarities:m,onToggleRarity:xe,status:v,onStatus:S,smart:C,onSmart:E})}),e.jsx(bt,{children:e.jsx(yt,{type:"button",onClick:()=>T(!1),children:o("assets.showItems")})})]})]}),e.jsx(wt,{children:c==="names"?e.jsx(Xn,{onBack:()=>ue("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(jt,{sort:R,onSort:b,total:de,loading:I||z,query:r,onOpenFilters:()=>T(!0),chips:L,onClearChips:Ve}),Ge&&O&&M.some(i=>i.source==="legacy")?e.jsx("p",{className:"market-banner market-banner--warn",children:o("assets.marketUnavailable")}):null,We?e.jsx(Rt,{message:o("assets.loadError"),testId:"browse-error"}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:Ue?e.jsx(ge,{count:qe}):e.jsxs(e.Fragment,{children:[M.map(i=>{if(!O)return e.jsx(Q,{item:i,mode:"view"},J(i));const $=i;return $.source==="legacy"?e.jsx(Q,{item:$,mode:"market",marketPriceCredits:De($),onBuyNow:Ke},J(i)):e.jsx(Q,{item:i},J(i))}),fe?e.jsx(ge,{count:6}):null]})}),e.jsx(Ct,{hasNextPage:He,isFetching:fe,onLoadMore:()=>void Oe()}),!I&&!z&&M.length===0?e.jsx("p",{className:"muted",children:o("assets.noItems")}):null]})}),re&&q?e.jsx(kt,{listing:re,rate:q,onClose:()=>K(null),onSold:()=>{K(null),Qe()}}):null]})}export{Cs as Assets};
758
+ `,Jn="https://docs.decentraland.org/creator/worlds/about/";function Zn(n){const r=typeof window<"u"?window.location.hostname:"";return`${r.endsWith("decentraland.org")?"https://decentraland.org":r.endsWith("decentraland.today")?"https://decentraland.today":"https://decentraland.zone"}/marketplace/names/browse?search=${encodeURIComponent(n)}`}function Xn({onBack:n}){_e({title:o("seo.names.title"),description:o("seo.names.description")});const{session:r,signIn:f}=oe(),{data:u}=Me(),h=u?Pe(H,u):null,[l,c]=p.useState(""),[d,a]=p.useState("idle"),[x,m]=p.useState(!1),w=p.useRef(null),[j,k]=p.useState(void 0);p.useLayoutEffect(()=>{w.current&&k(w.current.offsetWidth)},[l]),p.useEffect(()=>{if(!be(l).ok){a(l.length===0?"idle":"invalid");return}a("checking");const I=new AbortController,R=setTimeout(()=>{(async()=>{try{const b=await qt(l,{signal:I.signal});a(b)}catch(b){if((b==null?void 0:b.name)==="AbortError")return;a("error")}})()},400);return()=>{clearTimeout(R),I.abort()}},[l]);const g=be(l),y=g.ok&&(d==="available"||d==="error");function v(){if(y){if(!r){f();return}m(!0)}}const S=e.jsxs(e.Fragment,{children:[o("names.claim"),h!=null?e.jsxs(Un,{children:[e.jsx(F,{}),Ae(h)]}):null]});return e.jsxs(jn,{"data-testid":"names-page",children:[e.jsxs($n,{"aria-label":o("names.breadcrumbAria"),children:[e.jsx(Cn,{onClick:n,children:o("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(kn,{children:o("names.breadcrumbCurrent")})]}),e.jsxs(Sn,{children:[e.jsxs(Rn,{children:[e.jsxs(In,{children:[e.jsx(En,{children:o("names.heroTitle")}),e.jsx(Tn,{children:o("names.heroSubtitle")})]}),e.jsxs(zn,{children:[e.jsxs(Nn,{children:[e.jsxs(An,{invalid:d==="taken",children:[e.jsxs(Ln,{children:[e.jsx(Bn,{"aria-hidden":!0,children:"@"}),e.jsx(Fn,{value:l,onChange:C=>c(Ht(C.target.value)),placeholder:o("names.inputPlaceholder"),"aria-label":o("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:V,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(_n,{ref:w,"aria-hidden":!0,children:l||o("names.inputPlaceholder")}),e.jsx(Wn,{children:o("names.suffix")})]}),l.length>0?e.jsxs(Hn,{"aria-hidden":!0,children:[l.length,"/",V]}):null,e.jsx(Fe,{onClick:v,disabled:!y,"data-testid":"names-claim",children:S})]}),d==="taken"?e.jsxs(Pn,{role:"status","data-testid":"names-taken",children:[e.jsx(N,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:o("names.taken")}),e.jsxs(Mn,{href:Zn(l),target:"_blank",rel:"noopener noreferrer",children:[o("names.takenMakeOffer"),e.jsx(N,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(On,{onClick:v,disabled:!y,children:S}),d==="checking"?e.jsx(Z,{tone:"muted",role:"status","data-testid":"names-checking",children:o("names.checking")}):d==="error"?e.jsx(Z,{tone:"muted",role:"status",children:o("names.checkError")}):d==="invalid"&&!g.ok&&g.reason==="too-short"?e.jsx(Z,{tone:"muted",role:"status",children:o("names.tooShort",{min:Le})}):null,e.jsx(Qn,{role:"status","aria-live":"polite",children:d==="available"?o("names.available",{name:l}):""})]})]}),e.jsxs(qn,{children:[e.jsx(Gn,{children:o("names.whyTitle")}),e.jsxs(Dn,{children:[e.jsxs(X,{children:[e.jsx(Y,{"aria-hidden":!0}),e.jsx(ee,{children:e.jsx(te,{children:o("names.why1")})})]}),e.jsxs(X,{children:[e.jsx(Y,{"aria-hidden":!0}),e.jsxs(ee,{children:[e.jsx(te,{children:o("names.why2")}),e.jsxs(Vn,{href:Jn,target:"_blank",rel:"noopener noreferrer",children:[o("names.why2Link"),e.jsx(N,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(X,{children:[e.jsx(Y,{"aria-hidden":!0}),e.jsxs(ee,{children:[e.jsx(te,{children:o("names.why3")}),e.jsx(Kn,{children:o("names.why3Link")})]})]})]})]})]}),x?e.jsx(wn,{name:l,priceCredits:h,onClose:()=>m(!1)}):null]})}const ne=48;function Yn(n){return{tradeId:n.tradeId??n.id,listingType:"primary",contractAddress:n.contractAddress,itemId:n.itemId??"",name:n.name,thumbnail:n.thumbnail,rarity:n.rarity,category:n.category,wearableCategory:n.wearableCategory??null,creator:n.creator,manaWei:n.manaWei??"0",available:1,network:n.network,chainId:n.chainId,createdAt:0}}function Cs(){const[n]=Ze(),r=(n.get("q")??"").trim().toLowerCase(),f=Ne(),{session:u,signIn:h}=oe(),l=(n.get("q")??"").trim();_e({title:l?o("seo.collectibles.searchTitle",{query:l}):o("seo.collectibles.title"),description:o("seo.collectibles.description")});const[c,d]=p.useState("wearable"),[a,x]=p.useState(null),[m,w]=p.useState([]),[j,k]=p.useState(""),[g,y]=p.useState(""),[v,S]=p.useState("on_sale"),[C,I]=p.useState(!1),[R,b]=p.useState("newest"),[A,T]=p.useState(!1),[re,K]=p.useState(null);p.useEffect(()=>{if(!A)return;const i=B=>{B.key==="Escape"&&T(!1)};document.addEventListener("keydown",i);const $=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",i),document.body.style.overflow=$}},[A]);const O=v==="on_sale",_=j&&!Number.isNaN(Number(j))?Number(j):void 0,P=g&&!Number.isNaN(Number(g))?Number(g):void 0,ie=a?$t[a]:void 0,ae=(me.find(i=>i.key===R)??me[0]).server,le={category:c,rarities:m.length?m:void 0,wearableCategories:ie,minPriceCredits:_,maxPriceCredits:P,search:r||void 0,sortBy:ae,isSmart:C||void 0,onSale:!0},ce={category:c,rarities:m.length?m:void 0,wearableCategories:ie,search:r||void 0,sortBy:ae,isWearableSmart:C||void 0,isOnSale:v==="not_for_sale"?!1:void 0},{items:M,total:de,isLoading:E,isPlaceholderData:z,error:We,hasNextPage:He,isFetchingNextPage:fe,fetchNextPage:Oe}=St(O?["shop-items",le]:["catalog-items",ce],i=>O?it({...le,first:ne,skip:i}):at({...ce,first:ne,skip:i}),{enabled:c!=="names"}),U=de,Ue=E||z,qe=E?15:Math.min(Math.max(M.length,1),ne),{data:q,isError:Ge}=Me(),De=i=>q&&i.manaWei?Pe(i.manaWei,q):null,pe=p.useRef(null);p.useEffect(()=>{E||z||!r||pe.current===r||(pe.current=r,D("Shop Searched",{query:r,result_count:U}))},[r,E,z,U]);const G=p.useRef("__init__");p.useEffect(()=>{if(E||z)return;const i=JSON.stringify({category:c,subCategory:a,rarities:m,min:_,max:P,sort:R,status:v,smart:C});if(G.current==="__init__"||G.current===i){G.current=i;return}G.current=i,D("Shop Applied Filter",{filters:{category:c,sub_category:a,rarities:m,min_price_credits:_??null,max_price_credits:P??null,status:v,smart:C,sort:R},result_count:U})},[c,a,m,_,P,R,v,C,E,z,U]);function ue(i){d(i),x(null)}function xe(i){w($=>$.includes(i)?$.filter(B=>B!==i):[...$,i])}function Ve(){d("wearable"),x(null),w([]),k(""),y(""),S("on_sale"),I(!1)}function Ke(i){const $=M.find(B=>B.id===i.id);if(!(!$||$.source!=="legacy"||!$.manaWei)){if(!u){h();return}K(Yn($))}}function Qe(){f.invalidateQueries({queryKey:["shop-items"]})}const L=[];(_!=null||P!=null)&&L.push({key:"price",label:o("filter.price"),onRemove:()=>{k(""),y("")}});for(const i of vt)m.includes(i)&&L.push({key:`rarity-${i}`,label:rt(i),onRemove:()=>xe(i)});return C&&L.push({key:"smart",label:o("filter.smart"),onRemove:()=>I(!1)}),v!=="on_sale"&&L.push({key:"status",label:v==="all"?o("filter.statusAll"):o("filter.notForSale"),onRemove:()=>S("on_sale")}),e.jsxs(dt,{"data-testid":"browse",children:[c!=="names"&&e.jsxs(e.Fragment,{children:[A?e.jsx(ft,{onClick:()=>T(!1),"aria-hidden":!0}):null,e.jsxs(pt,{className:A?"is-open":"","data-testid":"browse-sidebar",children:[e.jsxs(ut,{children:[e.jsx(xt,{children:o("assets.filters")}),e.jsx(ht,{onClick:()=>T(!1),"aria-label":o("assets.closeFilters"),children:"✕"})]}),e.jsx(mt,{children:e.jsx(gt,{category:c,subCategory:a,onCategory:ue,onSub:x,priceMin:j,priceMax:g,onPriceMin:k,onPriceMax:y,rarities:m,onToggleRarity:xe,status:v,onStatus:S,smart:C,onSmart:I})}),e.jsx(bt,{children:e.jsx(yt,{type:"button",onClick:()=>T(!1),children:o("assets.showItems")})})]})]}),e.jsx(wt,{children:c==="names"?e.jsx(Xn,{onBack:()=>ue("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(jt,{sort:R,onSort:b,total:de,loading:E||z,query:r,onOpenFilters:()=>T(!0),chips:L,onClearChips:Ve}),Ge&&O&&M.some(i=>i.source==="legacy")?e.jsx("p",{className:"market-banner market-banner--warn",children:o("assets.marketUnavailable")}):null,We?e.jsx(Rt,{message:o("assets.loadError"),testId:"browse-error"}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:Ue?e.jsx(ge,{count:qe}):e.jsxs(e.Fragment,{children:[M.map(i=>{if(!O)return e.jsx(Q,{item:i,mode:"view"},J(i));const $=i;return $.source==="legacy"?e.jsx(Q,{item:$,mode:"market",marketPriceCredits:De($),onBuyNow:Ke},J(i)):e.jsx(Q,{item:i},J(i))}),fe?e.jsx(ge,{count:6}):null]})}),e.jsx(Ct,{hasNextPage:He,isFetching:fe,onLoadMore:()=>void Oe()}),!E&&!z&&M.length===0?e.jsx("p",{className:"muted",children:o("assets.noItems")}):null]})}),re&&q?e.jsx(kt,{listing:re,rate:q,onClose:()=>K(null),onSold:()=>{K(null),Qe()}}):null]})}export{Cs as Assets};
@@ -1,4 +1,4 @@
1
- import{r as y,j as t}from"./react-BW1xvPTF.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-DgakJcX8.js";import{T as se}from"./Tooltip-DEcYfA4I.js";import{J as e,s as o,I as m,t as s,K as re,e as v}from"./index-YaBqCznY.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
1
+ import{r as y,j as t}from"./react-BW1xvPTF.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-BYiSMngY.js";import{T as se}from"./Tooltip-ChLdaLYy.js";import{J as e,s as o,I as m,t as s,K as re,e as v}from"./index-DKn89nIW.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{j as t,L as D,r as B}from"./react-BW1xvPTF.js";import{s as a,B as F,J as o,O as S,m as N,t as e,u as M,w as P,I as g,C as G,o as w,b as H,p as K,P as k,H as Q,L as $}from"./index-YaBqCznY.js";import{b as O,c as W,d as _,s as J,f as X}from"./authorizations-BkaxvQnP.js";import{a as U}from"./builder-rUMLIH9C.js";import{f as V}from"./errors-xpfKLPjA.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const Y=S`
1
+ import{j as t,L as D,r as B}from"./react-BW1xvPTF.js";import{s as a,B as F,J as o,O as S,m as N,t as e,u as M,w as P,I as g,C as G,o as w,b as H,p as K,P as k,H as Q,L as $}from"./index-DKn89nIW.js";import{b as O,c as W,d as _,s as J,f as X}from"./authorizations-LVujlH7N.js";import{a as U}from"./builder-BoAWy25K.js";import{f as V}from"./errors-Dqf6lF1i.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const Y=S`
2
2
  to { transform: rotate(360deg); }
3
3
  `,Z=S`
4
4
  to { background-position: -200% 0; }
@@ -1,4 +1,4 @@
1
- import{b2 as Xe,b3 as Ye,E as Ge,b4 as qe,U as G,V as b,W as z,R as ee,S as se,b5 as Qe,Z as K,O as le,Q as Ce,b6 as be,b7 as Ze,b8 as Z,Y as Re,b9 as we,T as Je,aK as eo,D as oo,X as B,ba as to,bb as w}from"./index-YaBqCznY.js";import{r as l,j as T,R as Y}from"./react-BW1xvPTF.js";function Me(e){var o,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(t=Me(e[o]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function no(){for(var e,o,t=0,i="",n=arguments.length;t<n;t++)(e=arguments[t])&&(o=Me(e))&&(i&&(i+=" "),i+=o);return i}const io=["className","component"];function ao(e={}){const{themeId:o,defaultTheme:t,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Xe("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(Ye);return l.forwardRef(function(c,p){const f=Ge(t),g=qe(c),{className:m,component:v="div"}=g,h=G(g,io);return T.jsx(a,b({as:v,ref:p,className:no(m,n?n(i):i),theme:o&&f[o]||f},h))})}function ae(e,o){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ae(e,o)}function ro(e,o){e.prototype=Object.create(o.prototype),e.prototype.constructor=e,ae(e,o)}const ge=Y.createContext(null);function so(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,o){var t=function(a){return o&&l.isValidElement(a)?o(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=t(n)}),i}function lo(e,o){e=e||{},o=o||{};function t(f){return f in o?o[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in o?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in o){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=t(p)}u[c]=t(c)}for(r=0;r<n.length;r++)u[n[r]]=t(n[r]);return u}function A(e,o,t){return t[o]!=null?t[o]:e.props[o]}function co(e,o){return ce(e.children,function(t){return l.cloneElement(t,{onExited:o.bind(null,t),in:!0,appear:A(t,"appear",e),enter:A(t,"enter",e),exit:A(t,"exit",e)})})}function uo(e,o,t){var i=ce(e.children),n=lo(o,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in o,c=a in i,p=o[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var po=Object.values||function(e){return Object.keys(e).map(function(o){return e[o]})},fo={component:"div",childFactory:function(o){return o}},ue=(function(e){ro(o,e);function o(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(so(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var t=o.prototype;return t.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},t.componentWillUnmount=function(){this.mounted=!1},o.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?co(n,u):uo(n,r,u),firstRender:!1}},t.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},t.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=G(n,["component","childFactory"]),c=this.state.contextValue,p=po(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?Y.createElement(ge.Provider,{value:c},p):Y.createElement(ge.Provider,{value:c},Y.createElement(a,u,p))},o})(Y.Component);ue.propTypes={};ue.defaultProps=fo;function ho(e){const{className:o,classes:t,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(o,t.ripple,t.rippleVisible,i&&t.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(t.child,f&&t.childLeaving,i&&t.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),T.jsx("span",{className:m,style:v,children:T.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),bo=["center","classes","className"];let oe=e=>e,me,xe,ve,ye;const re=550,go=80,mo=le(me||(me=oe`
1
+ import{b2 as Xe,b3 as Ye,E as Ge,b4 as qe,U as G,V as b,W as z,R as ee,S as se,b5 as Qe,Z as K,O as le,Q as Ce,b6 as be,b7 as Ze,b8 as Z,Y as Re,b9 as we,T as Je,aK as eo,D as oo,X as B,ba as to,bb as w}from"./index-DKn89nIW.js";import{r as l,j as T,R as Y}from"./react-BW1xvPTF.js";function Me(e){var o,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(t=Me(e[o]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function no(){for(var e,o,t=0,i="",n=arguments.length;t<n;t++)(e=arguments[t])&&(o=Me(e))&&(i&&(i+=" "),i+=o);return i}const io=["className","component"];function ao(e={}){const{themeId:o,defaultTheme:t,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Xe("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(Ye);return l.forwardRef(function(c,p){const f=Ge(t),g=qe(c),{className:m,component:v="div"}=g,h=G(g,io);return T.jsx(a,b({as:v,ref:p,className:no(m,n?n(i):i),theme:o&&f[o]||f},h))})}function ae(e,o){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ae(e,o)}function ro(e,o){e.prototype=Object.create(o.prototype),e.prototype.constructor=e,ae(e,o)}const ge=Y.createContext(null);function so(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,o){var t=function(a){return o&&l.isValidElement(a)?o(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=t(n)}),i}function lo(e,o){e=e||{},o=o||{};function t(f){return f in o?o[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in o?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in o){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=t(p)}u[c]=t(c)}for(r=0;r<n.length;r++)u[n[r]]=t(n[r]);return u}function A(e,o,t){return t[o]!=null?t[o]:e.props[o]}function co(e,o){return ce(e.children,function(t){return l.cloneElement(t,{onExited:o.bind(null,t),in:!0,appear:A(t,"appear",e),enter:A(t,"enter",e),exit:A(t,"exit",e)})})}function uo(e,o,t){var i=ce(e.children),n=lo(o,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in o,c=a in i,p=o[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var po=Object.values||function(e){return Object.keys(e).map(function(o){return e[o]})},fo={component:"div",childFactory:function(o){return o}},ue=(function(e){ro(o,e);function o(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(so(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var t=o.prototype;return t.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},t.componentWillUnmount=function(){this.mounted=!1},o.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?co(n,u):uo(n,r,u),firstRender:!1}},t.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},t.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=G(n,["component","childFactory"]),c=this.state.contextValue,p=po(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?Y.createElement(ge.Provider,{value:c},p):Y.createElement(ge.Provider,{value:c},Y.createElement(a,u,p))},o})(Y.Component);ue.propTypes={};ue.defaultProps=fo;function ho(e){const{className:o,classes:t,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(o,t.ripple,t.rippleVisible,i&&t.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(t.child,f&&t.childLeaving,i&&t.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),T.jsx("span",{className:m,style:v,children:T.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),bo=["center","classes","className"];let oe=e=>e,me,xe,ve,ye;const re=550,go=80,mo=le(me||(me=oe`
2
2
  0% {
3
3
  transform: scale(0);
4
4
  opacity: 0.1;
@@ -1,3 +1,3 @@
1
- import{j as e,r as m,u as Ae,a as Ue,L as re}from"./react-BW1xvPTF.js";import{t as a,C as F,y as Y,ag as We,m as ze,ae as N,n as pe,u as Oe,o as $e,a as Ge,b as He,ah as De,I as R,ai as Je,x as Ve,w as Ye,aj as ge,j as J,ak as ve,al as Xe,H as U,s as Ze,B as es,e as ss,h as as,c as fe,am as ts,l as xe,k as rs,an as cs}from"./index-YaBqCznY.js";import{W as ns,t as is,C as ls,s as ke}from"./CollectionCarousel-DnTGnT5b.js";import{a as je}from"./buy-rVVXrIk8.js";import{a as os,w as ds,S as us,G as hs}from"./buy-gasless-CGSiK7Ez.js";import{R as V,r as ms}from"./cart-checkout-B6kx-gf2.js";import{g as _s}from"./authorizations-BkaxvQnP.js";import{u as ys,M as bs,c as ps}from"./useCreditPacks-BLWL1-cL.js";import{l as gs}from"./loader-logo-BzY9EKdC.js";import{i as vs,a as fs}from"./errors-xpfKLPjA.js";import{E as xs}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-CtcntXuS.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const ks="https://cdn.decentraland.org/@dcl/shop/0.1.0-30264990312.commit-3867b6c/assets/buy-error-22UunaPC.png";function js(r){const{phase:n,balanceCredits:h,onClose:y}=r,C=n==="processing",S=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),q=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:y,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${q?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:S}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:y,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(F,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:Y(h)})]})]}),n==="processing"&&e.jsx(Ns,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(Cs,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:y}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ks,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:y,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??y,children:a("cartCheckout.tryAgain")})]})]})]})]})}function Ns({stage:r,step:n,total:h,isSelfCustody:y}){const C=r==="reserving",S=h>0?Math.min(100,Math.round(n/h*100)):0,q=r==="awaiting-signature"?y?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:gs,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:q}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${S}%`}})}),h>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",h]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function Cs({lines:r,shortfallCredits:n,packs:h,selectedPack:y,onSelectPack:C,onBuyPacks:S,onCancel:q}){const w=h.find(t=>t.id===y),X=r.reduce((t,f)=>t+(f.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ns,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:X})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const f=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),f>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:f})}):null]}),t.item.creator?e.jsx(We,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(F,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:Y(t.priceCredits*f)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:h.map(t=>{const f=t.id===y;return e.jsxs("button",{className:`buy-modal__pack${f?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(F,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:Y(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(F,{className:"buy-modal__total-ico"}),e.jsx("span",{children:Y((w==null?void 0:w.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((w==null?void 0:w.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:q,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:S,children:a("buyModal.buy")})]})]})}const ws=Ze(es)`
1
+ import{j as e,r as m,u as Ae,a as Ue,L as re}from"./react-BW1xvPTF.js";import{t as a,C as F,y as Y,ag as We,m as ze,ae as N,n as pe,u as Oe,o as $e,a as Ge,b as He,ah as De,I as R,ai as Je,x as Ve,w as Ye,aj as ge,j as J,ak as ve,al as Xe,H as U,s as Ze,B as es,e as ss,h as as,c as fe,am as ts,l as xe,k as rs,an as cs}from"./index-DKn89nIW.js";import{W as ns,t as is,C as ls,s as ke}from"./CollectionCarousel-ClxfOuf0.js";import{a as je}from"./buy-C5fAE4Tk.js";import{a as os,w as ds,S as us,G as hs}from"./buy-gasless-DkWqG4cD.js";import{R as V,r as ms}from"./cart-checkout-Bm6eeQha.js";import{g as _s}from"./authorizations-LVujlH7N.js";import{u as ys,M as bs,c as ps}from"./useCreditPacks-CvGo72Yh.js";import{l as gs}from"./loader-logo-BzY9EKdC.js";import{i as vs,a as fs}from"./errors-Dqf6lF1i.js";import{E as xs}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-BNfrO5uz.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const ks="https://cdn.decentraland.org/@dcl/shop/0.1.0-30270468476.commit-071c9d3/assets/buy-error-22UunaPC.png";function js(r){const{phase:n,balanceCredits:h,onClose:y}=r,C=n==="processing",S=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),q=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:y,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${q?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:S}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:y,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(F,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:Y(h)})]})]}),n==="processing"&&e.jsx(Ns,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(Cs,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:y}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ks,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:y,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??y,children:a("cartCheckout.tryAgain")})]})]})]})]})}function Ns({stage:r,step:n,total:h,isSelfCustody:y}){const C=r==="reserving",S=h>0?Math.min(100,Math.round(n/h*100)):0,q=r==="awaiting-signature"?y?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:gs,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:q}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${S}%`}})}),h>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",h]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function Cs({lines:r,shortfallCredits:n,packs:h,selectedPack:y,onSelectPack:C,onBuyPacks:S,onCancel:q}){const w=h.find(t=>t.id===y),X=r.reduce((t,f)=>t+(f.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ns,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:X})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const f=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),f>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:f})}):null]}),t.item.creator?e.jsx(We,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(F,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:Y(t.priceCredits*f)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:h.map(t=>{const f=t.id===y;return e.jsxs("button",{className:`buy-modal__pack${f?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(F,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:Y(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(F,{className:"buy-modal__total-ico"}),e.jsx("span",{children:Y((w==null?void 0:w.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((w==null?void 0:w.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:q,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:S,children:a("buyModal.buy")})]})]})}const ws=Ze(es)`
2
2
  margin-top: 12px;
3
3
  `;function Ne(r){if(vs(r))return a("errors.rejected");const n=(r.message??"").toLowerCase();return n.includes("insufficient")?a("cart.error.insufficient",{currency:ss.name}):n.includes("no active listing")||n.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const Ss=12e4;function qs(r){const n=[];return r.unavailable.length&&n.push(a("cart.drop.unavailable",{count:r.unavailable.length})),r.own.length&&n.push(a("cart.drop.own",{count:r.own.length})),a("cart.drop.removed",{items:n.join(` ${a("cart.drop.and")} `)})}const Ce=r=>r.reduce((n,h)=>n+h.priceCredits*h.quantity,0),Ms=r=>r.flatMap(n=>Array.from({length:n.quantity},()=>({...n,quantity:1})));function Ds(){ze({title:a("nav.cart"),noindex:!0});const r=N(s=>s.items),n=N(s=>s.remove),h=N(s=>s.increment),y=N(s=>s.decrement),C=N(s=>s.clear),S=N(s=>s.restore),q=N(s=>s.setFittingOpen),w=pe(s=>s.items),X=pe(s=>s.toggle),{session:t,signIn:f}=Oe(),W=ys().packs.slice(0,bs);m.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const we=r.some(s=>s.category!=="emote"),{data:Z}=$e({queryKey:["upsell-listings"],queryFn:()=>cs({first:40}),staleTime:6e4}),{data:T}=Ge(t),d=He(),z=Ae(),{state:M}=Ue(),[ce,B]=m.useState(null),[Se,L]=m.useState(null),[ne,O]=m.useState(null),[qe,E]=m.useState(!1),[x,K]=m.useState(null),ie=m.useRef(0),[o,k]=m.useState(null),[ee,le]=m.useState(""),se=m.useRef(null),oe=De(r),de=s=>ge(oe[s.id]),ae=r.filter(de),ue=r.length>0&&ae.length===0,Me=ae.reduce((s,c)=>s+c.priceCredits*c.quantity,0),Ee=r.reduce((s,c)=>s+c.quantity,0),Pe=ae.reduce((s,c)=>s+c.quantity,0),Ie=x?x.liveTotalCredits:Me,Re=new Set(r.map(s=>s.id)),he=((Z==null?void 0:Z.items)??[]).filter(s=>!Re.has(s.id)).slice(0,12),Fe=new Map(x==null?void 0:x.buyable.map(s=>[s.item.id,s])),$=(T==null?void 0:T.credits)??0,Te=Xe;function G(s){s(),K(null),O(null),L(null)}function Be(){k(null),E(!1)}function me(s){const c=Ce(s),i=Math.max(0,c-$),g=W.find(u=>u.credits>=i)??W[W.length-1];le(g.id),J("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:$,shortfall:i}),k({phase:"nofunds",lines:s.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:i}),E(!1)}async function Le(s){if(!t||s.length===0)return;const c=Ms(s),i=c.map(l=>({...l.item,priceCredits:l.priceCredits})),g=s.map(l=>({...l.item,priceCredits:l.priceCredits,quantity:l.quantity})),u=[];let j="authorize",H=!1;k({phase:"processing",stage:"reserving",step:1,total:c.length});try{const l=[];for(let b=0;b<c.length;b++){const I=c[b];k({phase:"processing",stage:"reserving",step:b+1,total:c.length});try{const{credit:p,maxCreditedValue:te}=await as(t.identity,I.usdCents,I.trade.id);u.push(p.id),l.push({trade:I.trade,credits:[p],maxCreditedValue:te})}catch(p){if(fs(p)){if(u.length){try{await fe(t.identity,u)}catch(te){U(te,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}me(s);return}throw p}}j="submit";const v=()=>k({phase:"processing",stage:"settling",step:c.length,total:c.length});k({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});let _=[];if(_s())try{_=await os({purchases:l,buyer:t.address,signer:t.signer,onSigned:v});const I=(await Promise.allSettled(_.map(p=>ds(p)))).flatMap(p=>p.status==="rejected"?[p.reason]:[]);if(I.length&&!I.some(p=>p instanceof us))throw I[0];H=!0}catch(b){if(!(b instanceof hs))throw b;_=await je({purchases:l,buyer:t.address,signer:t.signer,onSigned:v})}else _=await je({purchases:l,buyer:t.address,signer:t.signer});s.forEach(b=>n(b.item.id)),K(null),J("Shop Completed Purchase",{...ts(i),payment_type:"credits",no_crypto_step:H,transaction_hash:_[0]??null}),d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const A=se.current;se.current=null,k(null),E(!1);const D={items:g,txHash:_[0]??void 0,settled:!0,...A?{creditsAdded:A}:{}};z("/success",{state:D,replace:!0})}catch(l){if(xe(l)||U(l,{flow:"cart_checkout",step:j,cart_size:s.length}),J(xe(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:j,error_code:rs(l),value_usd:ve(i.reduce((v,_)=>v+_.priceCredits,0)),cart_size:c.length}),u.length){try{await fe(t.identity,u)}catch(v){U(v,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}k({phase:"error",message:Ne(l)})}}function _e(s){const c=Ce(s);if(T!=null&&T.credits<c){me(s);return}Le(s)}async function Q(){if(!t){ke({type:"cart-checkout"}),f();return}const s=N.getState().items.filter(de);if(s.length===0)return;L(null),O(null),E(!0);const c=s.reduce((i,g)=>i+g.priceCredits*g.quantity,0);J("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:ve(c),has_sufficient_credits:$>=c});try{B(a("cart.status.reviewing"));const i=await ms(s,t.address,Te),g=[...i.unavailable,...i.own];if(g.length&&(g.forEach(u=>n(u.id)),O(qs(i))),i.buyable.length===0){L(a("cart.error.noneAvailable")),K(null),B(null);return}if(i.orderChanged){K(i),ie.current=Date.now(),B(null);return}B(null),_e(i.buyable)}catch(i){U(i,{flow:"cart_checkout",step:"review",cart_size:s.length}),L(Ne(i)),B(null)}finally{E(!1)}}async function Ke(){if(x){if(!t){ke({type:"cart-checkout"}),f();return}if(Date.now()-ie.current>Ss){K(null),O(null),await Q();return}L(null),_e(x.buyable)}}async function Qe(){if(ee){try{sessionStorage.setItem(V,JSON.stringify(N.getState().items))}catch{}E(!0);try{const s=await ps(ee,t?{address:t.address,identity:t.identity}:void 0);if(s.url){window.location.href=s.url;return}z("/credits")}catch(s){try{sessionStorage.removeItem(V)}catch{}U(s,{flow:"cart_buy_credits"}),k({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{E(!1)}}}const ye=m.useRef(!1);m.useEffect(()=>{if(!t||ye.current||!is("cart-checkout"))return;ye.current=!0;const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[t]);const be=m.useRef(!1);m.useEffect(()=>{if(!(M!=null&&M.resumeCheckout)||be.current)return;be.current=!0,se.current=M.creditsAdded??null;try{const c=sessionStorage.getItem(V);if(c){sessionStorage.removeItem(V);const i=JSON.parse(c);Array.isArray(i)&&i.length&&S(i)}}catch{}d.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[M==null?void 0:M.resumeCheckout]);const P=qe||(o==null?void 0:o.phase)==="processing";return r.length===0&&!o?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx(R,{name:"cart",size:44,color:"var(--muted-2)"}),e.jsx("p",{className:"cart-empty__title",children:a("cart.empty.title")}),e.jsx("p",{className:"muted",children:a("cart.empty.body")}),e.jsx(ws,{as:re,to:"/assets",variant:"purple",children:a("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>z(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>z(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(R,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:a("cart.panelTitle",{count:Ee})}),we?e.jsxs("button",{className:"checkout__fitting",onClick:()=>q(!0),disabled:P,children:[e.jsx(R,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:r.map(s=>{const c=Fe.get(s.id),i=c?c.priceCredits:s.priceCredits,g=!!c&&c.priceCredits!==s.priceCredits,u=!s.tokenId,j=s.quantity,H=typeof s.available=="number"&&j>=s.available,l=i*j,v=!!w[s.id],_=Je(s),A=oe[s.id],D=!ge(A),b=A==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${D?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(re,{className:"checkout__thumb-link",to:_,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","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("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[_?e.jsx(re,{className:"checkout__name",to:_,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(Ve,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsx("div",{className:"checkout__foot",children:D?e.jsx("span",{className:"checkout__unavailable",children:b}):e.jsxs(e.Fragment,{children:[u?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>y(s.id)),disabled:P||j<=1,"aria-label":a("cart.decreaseQuantity",{name:s.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("span",{className:"checkout__qty",children:j}),e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>h(s.id)),disabled:P||H,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(F,{className:"checkout__price-ico"})," ",l,g?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits*j}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${v?" is-on":""}`,onClick:()=>X(s),"aria-label":v?a("cart.removeFromFavorites",{name:s.name}):a("cart.addToFavorites",{name:s.name}),title:v?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(R,{name:v?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>G(()=>n(s.id)),disabled:P,"aria-label":a("cart.remove",{name:s.name}),title:a("cart.removeTitle"),children:e.jsx(R,{name:"trash",size:24})})]})]},s.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>G(C),disabled:P,children:a("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:a("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:a("cart.totalItems",{count:Pe})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(F,{className:"checkout__total-ico"})," ",Ie]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(x?Ke():Q()),disabled:P||ue,children:P?a("cart.working"):x?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),ue?e.jsx("p",{className:"muted checkout__msg",children:a("cart.allUnavailable")}):null,t?null:e.jsx("p",{className:"muted checkout__msg",children:a("cart.signInHint")}),x?e.jsx("p",{className:"muted checkout__msg",children:a("cart.priceChanged")}):null,ne?e.jsx("p",{className:"muted checkout__msg",children:ne}):null,ce?e.jsx("p",{className:"muted checkout__msg",children:ce}):null,e.jsx(xs,{message:Se,className:"checkout__msg"})]})]})]})]}),he.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(ls,{title:a("cart.youMightAlsoLike"),items:he})}):null,o?e.jsx(js,{phase:o.phase,balanceCredits:$,onClose:Be,stage:o.phase==="processing"?o.stage:void 0,step:o.phase==="processing"?o.step:void 0,total:o.phase==="processing"?o.total:void 0,isSelfCustody:Ye(t==null?void 0:t.providerType),lines:o.phase==="nofunds"?o.lines:void 0,shortfallCredits:o.phase==="nofunds"?o.shortfall:void 0,packs:W,selectedPack:ee,onSelectPack:le,onBuyPacks:()=>void Qe(),message:o.phase==="error"?o.message:void 0,onRetry:()=>void Q()}):null]})}export{Ds as Cart};