@dcl/shop 0.1.0-30381444187.commit-e5b9f13 → 0.1.0-30381451752.commit-ab871f3

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 (183) hide show
  1. package/assets/{Activity-B63zG8uY.js → Activity-DSc7mvP4.js} +18 -18
  2. package/assets/{AnimatedBackground-CWPdO0WE.js → AnimatedBackground-fVnlmf9F.js} +1 -1
  3. package/assets/{Assets-WnaUem5h.js → Assets-CH9evMea.js} +11 -11
  4. package/assets/{Assets.styles-Dmhspue_.js → Assets.styles-CGAD6wJa.js} +5 -5
  5. package/assets/{Authorizations-CAStHHID.js → Authorizations-DhC0rdm8.js} +4 -4
  6. package/assets/Button-DOi50GW0.js +74 -0
  7. package/assets/{Cart-D-YOXeH9.js → Cart-Cn3ZtfkI.js} +1 -1
  8. package/assets/{CircularProgress-CpOs7g9a.js → CircularProgress-JMezNnqa.js} +5 -5
  9. package/assets/{Collection-9Fu4_XnC.js → Collection-DjZMT60J.js} +2 -2
  10. package/assets/{CollectionCarousel-CzvvuUUw.js → CollectionCarousel-Ck_R1F2f.js} +5 -5
  11. package/assets/Creator-CMnVKtlV.js +1 -0
  12. package/assets/{ExchangeController-CL_gVqSw.js → ExchangeController-C6mQYps7.js} +1 -1
  13. package/assets/{GetCredits-DSK7zyc2.js → GetCredits-5VMKvJ-K.js} +11 -11
  14. package/assets/{HelpersUtil-BfapKZKr.js → HelpersUtil-XXeaUDZE.js} +1 -1
  15. package/assets/ImportListings-CF7yr8q-.js +5 -0
  16. package/assets/{ItemDetail-D49gDAwf.js → ItemDetail-BY0kHQB-.js} +185 -185
  17. package/assets/{LoadMore-DTUpuDyu.js → LoadMore-BekgL6OE.js} +1 -1
  18. package/assets/MarketCheckout-GA-mHw2T.js +3 -0
  19. package/assets/{MenuList-DQbLlN7L.js → MenuList-CkcgsIA6.js} +1 -1
  20. package/assets/{MyAssets-DJ0hwGXR.js → MyAssets-ByTH-epK.js} +1 -1
  21. package/assets/{MyFavorites-D3n_-d0Z.js → MyFavorites-BFzYjDUH.js} +1 -1
  22. package/assets/{NotFound-MMFCqdKn.js → NotFound-TS_fVknU.js} +1 -1
  23. package/assets/NotificationsBell-Bho6wwFJ.js +34 -0
  24. package/assets/{StoreSettings-CdSK69sU.js → StoreSettings-P1WQMPTt.js} +5 -5
  25. package/assets/{Success-KKN_AjMe.js → Success-CZvGvIYB.js} +1 -1
  26. package/assets/{SwapController-BNkoWTIp.js → SwapController-DcTviSiv.js} +1 -1
  27. package/assets/{Tooltip-CBuz_rc2.js → Tooltip-Ck8OHf1K.js} +1 -1
  28. package/assets/{TradeService-Dm_ASWCN.js → TradeService-CQyC0ckJ.js} +1 -1
  29. package/assets/{W3MFrameProviderSingleton-CeSRgOaN.js → W3MFrameProviderSingleton-oH9nrVqa.js} +3 -3
  30. package/assets/{WebCryptoP256-GalvwmvU.js → WebCryptoP256-D6sJ4GW3.js} +1 -1
  31. package/assets/{authorizations-Ds7LRLV0.js → authorizations-BxQ2tMzo.js} +1 -1
  32. package/assets/{basic-D_j1sfcj.js → basic-BRNG7iiw.js} +1 -1
  33. package/assets/{biconomy-YD94PgiS.js → biconomy-CUHnXsx-.js} +1 -1
  34. package/assets/{builder-Cc8g4-4q.js → builder-DZ1jvdvk.js} +1 -1
  35. package/assets/{buy-DnSS_Kop.js → buy-C-oTH9gd.js} +1 -1
  36. package/assets/{buy-gasless-9Zn1yAMk.js → buy-gasless-BlKkmgRS.js} +1 -1
  37. package/assets/cart-checkout-BQRIzuA5.js +1 -0
  38. package/assets/{categories-BI9AXlDF.js → categories-DhS9aD1g.js} +4 -4
  39. package/assets/{ccip-bHN-8eS1.js → ccip-BQlc06tF.js} +1 -1
  40. package/assets/{ccip-CiESIEiQ.js → ccip-x24MUJVN.js} +1 -1
  41. package/assets/collection-CB1x49ld.js +1 -0
  42. package/assets/{controller-B2JIau8v.js → controller-ab9pqJXK.js} +2 -2
  43. package/assets/{core-3cHR7yu5.js → core-Dg-XVaV5.js} +4 -4
  44. package/assets/{custom-BFV9Niby.js → custom-CTXht3LT.js} +1 -1
  45. package/assets/{data-capture-DTqon_Ye.js → data-capture-gVncKP92.js} +1 -1
  46. package/assets/{email-CN7CWhKF.js → email-_DXK33a9.js} +1 -1
  47. package/assets/{embedded-wallet-Q6nTAiGf.js → embedded-wallet-B_k2BCRi.js} +1 -1
  48. package/assets/emotion-styled.browser.esm-v-WGRXph.js +1 -0
  49. package/assets/{engine-DoRvgWV1.js → engine-ha18BPJJ.js} +1 -1
  50. package/assets/{errors-CG6pp58g.js → errors-CRgGE21K.js} +1 -1
  51. package/assets/{estimate-l1-fee-DIch6QAI.js → estimate-l1-fee-Bz9lwTZI.js} +1 -1
  52. package/assets/{execute-UcJesME5.js → execute-CLGkeIM4.js} +2 -2
  53. package/assets/{features-B53I2xTg.js → features-BLGU5qKo.js} +1 -1
  54. package/assets/{fetchTokenMetadata-CqYkUkwH.js → fetchTokenMetadata-CYxDKmIt.js} +2 -2
  55. package/assets/{get-ecosystem-wallet-info-HoRTPbSm.js → get-ecosystem-wallet-info-yJH_bkud.js} +1 -1
  56. package/assets/{getBalance-BMDqICQz.js → getBalance-CXmOkNzY.js} +1 -1
  57. package/assets/{getNFT-WdF3UG1j.js → getNFT-D0B4erfI.js} +1 -1
  58. package/assets/{getNFT-6TA-E6XX.js → getNFT-DysvkQcd.js} +1 -1
  59. package/assets/{getThemeProps-HByDG2pD.js → getThemeProps-DIwZ5N8L.js} +1 -1
  60. package/assets/{hashTypedData-ug9gj3v5.js → hashTypedData--HdA9-HS.js} +1 -1
  61. package/assets/{hashTypedData-BGvyK_O1.js → hashTypedData-DziOW2Vc.js} +1 -1
  62. package/assets/{import-CZZ9-DX_.js → import-CsDUWWqh.js} +1 -1
  63. package/assets/{in-app-BXpVuL_f.js → in-app-D7O2V44M.js} +1 -1
  64. package/assets/{in-app-wallet-calls-Cw2KNfOh.js → in-app-wallet-calls-DL6ZAl8I.js} +1 -1
  65. package/assets/{index-D0fJ7qrq.js → index-7Wsfe2Up.js} +1 -1
  66. package/assets/{index-C68XxPCY.js → index-B2t3nSe7.js} +1 -1
  67. package/assets/{index-CYMsLttB.js → index-B7T9Zh6O.js} +1 -1
  68. package/assets/{index-CaR23uYb.js → index-BCW_w0UN.js} +1 -1
  69. package/assets/{index-BeeMSgi1.js → index-BE-vH0_t.js} +1 -1
  70. package/assets/{index-Bq0YYsbG.js → index-BIrUjWEF.js} +1 -1
  71. package/assets/{index-F-n6GV2b.js → index-BMMsxyuq.js} +1 -1
  72. package/assets/{index-BHPkQDns.js → index-BUrRDjD6.js} +1 -1
  73. package/assets/{index-BOMAmQU7.js → index-BaUNQyyt.js} +1 -1
  74. package/assets/{index-B7jIFcHs.js → index-BaYUVFML.js} +2 -2
  75. package/assets/{index-CeKksx_X.js → index-Bc2znaCv.js} +1 -1
  76. package/assets/{index-CmgZ4NMC.js → index-Bg4URcJg.js} +1 -1
  77. package/assets/{index-CjpRvZkq.js → index-BgsCmFBR.js} +1 -1
  78. package/assets/{index-Fe4H2sUE.js → index-C1EFfqUT.js} +1 -1
  79. package/assets/{index-B0SdAX-m.js → index-CB0_zAGI.js} +1 -1
  80. package/assets/{index-TmxHL85j.js → index-CE-8j9dT.js} +31 -31
  81. package/assets/{index-euFuE7ah.js → index-CE3I8gyz.js} +1 -1
  82. package/assets/{index-2jouHGho.js → index-CI3LRVdJ.js} +1 -1
  83. package/assets/{index-gxa5wyAJ.js → index-CLl3y_zB.js} +3 -3
  84. package/assets/{index-Cy8JAEGy.js → index-CQ2b-Icm.js} +1 -1
  85. package/assets/{index-C7TVyPoU.js → index-CQfyml-1.js} +1 -1
  86. package/assets/{index-b39aIkkP.js → index-CVa7EGSX.js} +1 -1
  87. package/assets/{index-BEmTYNSG.js → index-CYjzOXa9.js} +1 -1
  88. package/assets/{index-Dr9lSl0n.js → index-CZKSPj3S.js} +1 -1
  89. package/assets/{index-B1saYH84.js → index-Cd2tsAns.js} +1 -1
  90. package/assets/{index-C0ACz6_-.js → index-CkqJHGTd.js} +1 -1
  91. package/assets/{index-BqPcUFuz.js → index-Cmvj85Uh.js} +1 -1
  92. package/assets/{index-F_0Er667.js → index-CoKHkfgd.js} +2 -2
  93. package/assets/{index-G_lkaThL.js → index-CscFkYoq.js} +1 -1
  94. package/assets/index-Ctx_ebhF.js +2 -0
  95. package/assets/index-Cv07XGtu.js +4 -0
  96. package/assets/{index-BBeW5CPj.js → index-D-LfADaw.js} +1 -1
  97. package/assets/{index-BQe1IsNb.js → index-D-UY1tLQ.js} +1 -1
  98. package/assets/{index-DqLpZ4oP.js → index-D9jcyP1T.js} +1 -1
  99. package/assets/{index-DaGhU6Uz.js → index-DAc_icdG.js} +1 -1
  100. package/assets/{index-CKSJdo5m.js → index-DR4iRFBm.js} +1 -1
  101. package/assets/{index-Z5LdHVdI.js → index-DalVAnKe.js} +1 -1
  102. package/assets/{index-DpXleRYB.js → index-DcffeS4F.js} +1 -1
  103. package/assets/{index-Y77Y_U0L.js → index-Dmk33w1E.js} +1 -1
  104. package/assets/{index-2RpQo6sW.js → index-DxHwXU1C.js} +1 -1
  105. package/assets/{index-CDEPMu43.js → index-J1CoPuuN.js} +3 -3
  106. package/assets/{index-D9gz4wTG.js → index-QZtXXaW6.js} +1 -1
  107. package/assets/{index-ogLhf7-S.js → index-VytDXqCW.js} +1 -1
  108. package/assets/{index-ExvBrBJ4.js → index-_Rup9P59.js} +2 -2
  109. package/assets/{index-CmgoqHgW.js → index-aJlKiR42.js} +1 -1
  110. package/assets/{index-D7r-KbUN.js → index-lTWpOCxL.js} +1 -1
  111. package/assets/{index-FvnJRnD5.js → index-mBqsXHEL.js} +3 -3
  112. package/assets/{index-DGIUeX6X.js → index-oGOYPuqO.js} +1 -1
  113. package/assets/{index-D95ZUsPD.js → index-odQTruvU.js} +1 -1
  114. package/assets/{index-_hV86vSn.js → index-palPyzeM.js} +1 -1
  115. package/assets/{index-B5JNl4HC.js → index-plri7RJC.js} +1 -1
  116. package/assets/{index.es-DD7iT23u.js → index.es-BKZDd-uH.js} +4 -4
  117. package/assets/{index.es-CmoiU8SE.js → index.es-frivxByX.js} +1 -1
  118. package/assets/{index.es-DDEozdoq.js → index.es-kEVHcelo.js} +1 -1
  119. package/assets/{localBatchGatewayRequest-BGfmM9P7.js → localBatchGatewayRequest-CySxBK0P.js} +1 -1
  120. package/assets/mana-rate-iDr_vy1I.js +1 -0
  121. package/assets/{networks-CBAVrHYh.js → networks-3-OnX6AH.js} +1 -1
  122. package/assets/{onramp-dft5bcN9.js → onramp-Bq5dAlFw.js} +1 -1
  123. package/assets/{openzeppelin-WekOcr_Z.js → openzeppelin-CML0yooi.js} +1 -1
  124. package/assets/{parseNft-DTV6iT7B.js → parseNft-Ci6Mgfjs.js} +2 -2
  125. package/assets/{parseSignature-C7rL0b_w.js → parseSignature-D-9wk3ib.js} +3 -3
  126. package/assets/{parseSignature-DmkHq9fC.js → parseSignature-cZaawZ6k.js} +1 -1
  127. package/assets/{passkeys--Px7LRhh.js → passkeys-cg1VKv6x.js} +1 -1
  128. package/assets/{pay-with-exchange-CMQeyenn.js → pay-with-exchange-BJ4Fzmz1.js} +1 -1
  129. package/assets/{qr-overlay-Dz377WEQ.js → qr-overlay-DxCAQFuF.js} +1 -1
  130. package/assets/{receive-CpDxltQB.js → receive-SwsuZNQC.js} +1 -1
  131. package/assets/{resolveImplementation-CFOrDNcu.js → resolveImplementation-BLaiirJ3.js} +1 -1
  132. package/assets/{rpc-CjfGBkRY.js → rpc-DmqY-iw7.js} +1 -1
  133. package/assets/{secp256k1-DSadr9B6.js → secp256k1-B873uX0r.js} +1 -1
  134. package/assets/{secp256k1-Dgs0hNIB.js → secp256k1-BQjGgvAo.js} +1 -1
  135. package/assets/{secp256k1-C77TwNwR.js → secp256k1-GhqpoPlI.js} +1 -1
  136. package/assets/{send-BMIoBrdl.js → send-Gjj-by0g.js} +1 -1
  137. package/assets/{send-batch-transaction-CZ5LHGtL.js → send-batch-transaction-CQKczqLV.js} +1 -1
  138. package/assets/{send-eip712-transaction-DmvWUFiv.js → send-eip712-transaction-D5ErRlD2.js} +2 -2
  139. package/assets/{send-gasless-transaction-DxLNFATn.js → send-gasless-transaction-C2Zr5wl9.js} +2 -2
  140. package/assets/{send-transaction-DVEripxy.js → send-transaction-BSCBM-eH.js} +2 -2
  141. package/assets/{sendMetaTransaction-7YAoB-pL.js → sendMetaTransaction-BMgjMfxP.js} +1 -1
  142. package/assets/{sendRawTransaction-BXyfyJLD.js → sendRawTransaction-DIOHnRnR.js} +3 -3
  143. package/assets/{serializeTransaction-BkF9WfrN.js → serializeTransaction-DLwJGyyA.js} +1 -1
  144. package/assets/{session-proposal-DoIVwtwv.js → session-proposal-P-V7WlA3.js} +1 -1
  145. package/assets/{session-request-C3QQi3mV.js → session-request-DXGq-vPI.js} +2 -2
  146. package/assets/{signing-BInyigJZ.js → signing-B18L8hB9.js} +3 -3
  147. package/assets/{socials-HN5nwNut.js → socials-D2NhoS92.js} +1 -1
  148. package/assets/{swaps-Dbu6ix4y.js → swaps-BjGN9dpo.js} +1 -1
  149. package/assets/{thirdweb-DY9iSWOj.js → thirdweb-D8LTFb7L.js} +3 -3
  150. package/assets/{to-serializable-transaction-DFrgce7C.js → to-serializable-transaction-DvD6rPpV.js} +2 -2
  151. package/assets/{trade-encoding-CcRCeIpG.js → trade-encoding-BjnvL03O.js} +1 -1
  152. package/assets/{transactionReceipt-5vjrQVvz.js → transactionReceipt-6-pcmsdS.js} +1 -1
  153. package/assets/{transactions-DLwOfx7v.js → transactions-uHYWIqRs.js} +1 -1
  154. package/assets/{useCreditPacks-Dft_m4Vq.js → useCreditPacks-CS3eE-oJ.js} +1 -1
  155. package/assets/{useInfiniteGrid-pff93KiW.js → useInfiniteGrid-7tlbDRJY.js} +1 -1
  156. package/assets/useManaRate-1Q3qKQkm.js +1 -0
  157. package/assets/useSecondarySales-Be2j0EMT.js +1 -0
  158. package/assets/{useStore-CV_90SkB.js → useStore-DCT-CgMe.js} +1 -1
  159. package/assets/useTheme-BWiusVd4.js +1 -0
  160. package/assets/{verifyHash-BJDJ-yWB.js → verifyHash-Y9BU7-vn.js} +1 -1
  161. package/assets/{w3m-modal-C_4vaAKJ.js → w3m-modal-IJXUf9Ad.js} +1 -1
  162. package/assets/{w3m-modal-Cs01ZX0b.js → w3m-modal-eUhgw2D5.js} +1 -1
  163. package/assets/{wait-for-tx-receipt-CYy9IgHg.js → wait-for-tx-receipt-ztIanYW8.js} +1 -1
  164. package/assets/{wallets-D4ZcCkX2.js → wallets-D3bPaCuK.js} +5 -5
  165. package/assets/{web-connector-p1b6xGQr.js → web-connector-C71ag9VJ.js} +3 -3
  166. package/assets/{writeContract-Cl5bVpey.js → writeContract-PtF1oxgl.js} +1 -1
  167. package/assets/{zoraTestnet-Dg220Oc3.js → zoraTestnet-DoARpZBA.js} +1 -1
  168. package/index.html +11 -11
  169. package/package.json +2 -2
  170. package/assets/Button-BDUHWtxg.js +0 -74
  171. package/assets/Creator-3NXIbePD.js +0 -1
  172. package/assets/ImportListings-DZs_dFSO.js +0 -5
  173. package/assets/MarketCheckout-CoUO17KO.js +0 -3
  174. package/assets/NotificationsBell-CNLR9ard.js +0 -34
  175. package/assets/cart-checkout-BAugwPm6.js +0 -1
  176. package/assets/collection-DE3QnCpW.js +0 -1
  177. package/assets/emotion-styled.browser.esm-DU8E1n2c.js +0 -1
  178. package/assets/index-8wx1oJ_F.js +0 -4
  179. package/assets/index-CEcu6qlS.js +0 -2
  180. package/assets/mana-rate-C8zn6Vfu.js +0 -1
  181. package/assets/useManaRate-C5mRxzeC.js +0 -1
  182. package/assets/useSecondarySales-BRJGIRwF.js +0 -1
  183. package/assets/useTheme-cgcgN0ze.js +0 -1
@@ -0,0 +1,74 @@
1
+ import{bg as Ko,bh as Xo,G as qo,bi as Zo,$ as X,a0 as b,a1 as z,Y as oo,Z as so,bj as wo,a4 as Y,S as lo,X as Ro,bk as go,bl as Jo,bm as w,a3 as Mo,bn as Qo,T as oe,aY as ee,F as te,a2 as B,bo as ne,bp as J}from"./index-CE-8j9dT.js";import{r as l,j as T,R as K}from"./react-BW1xvPTF.js";function zo(o){var e,t,i="";if(typeof o=="string"||typeof o=="number")i+=o;else if(typeof o=="object")if(Array.isArray(o)){var n=o.length;for(e=0;e<n;e++)o[e]&&(t=zo(o[e]))&&(i&&(i+=" "),i+=t)}else for(t in o)o[t]&&(i&&(i+=" "),i+=t);return i}function ie(){for(var o,e,t=0,i="",n=arguments.length;t<n;t++)(o=arguments[t])&&(e=zo(o))&&(i&&(i+=" "),i+=e);return i}const ae=["className","component"];function re(o={}){const{themeId:e,defaultTheme:t,defaultClassName:i="MuiBox-root",generateClassName:n}=o,a=Ko("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(Xo);return l.forwardRef(function(c,p){const f=qo(t),g=Zo(c),{className:m,component:v="div"}=g,h=X(g,ae);return T.jsx(a,b({as:v,ref:p,className:ie(m,n?n(i):i),theme:e&&f[e]||f},h))})}function ao(o,e){return ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ao(o,e)}function se(o,e){o.prototype=Object.create(e.prototype),o.prototype.constructor=o,ao(o,e)}const mo=K.createContext(null);function le(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function co(o,e){var t=function(a){return e&&l.isValidElement(a)?e(a):a},i=Object.create(null);return o&&l.Children.map(o,function(n){return n}).forEach(function(n){i[n.key]=t(n)}),i}function ce(o,e){o=o||{},e=e||{};function t(f){return f in e?e[f]:o[f]}var i=Object.create(null),n=[];for(var a in o)a in e?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in e){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(o,e,t){return t[e]!=null?t[e]:o.props[e]}function ue(o,e){return co(o.children,function(t){return l.cloneElement(t,{onExited:e.bind(null,t),in:!0,appear:A(t,"appear",o),enter:A(t,"enter",o),exit:A(t,"exit",o)})})}function pe(o,e,t){var i=co(o.children),n=ce(e,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in e,c=a in i,p=e[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",o),enter:A(r,"enter",o)}):!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",o),enter:A(r,"enter",o)}))}}),n}var de=Object.values||function(o){return Object.keys(o).map(function(e){return o[e]})},fe={component:"div",childFactory:function(e){return e}},uo=(function(o){se(e,o);function e(i,n){var a;a=o.call(this,i,n)||this;var r=a.handleExited.bind(le(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var t=e.prototype;return t.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},t.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?ue(n,u):pe(n,r,u),firstRender:!1}},t.handleExited=function(n,a){var r=co(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=X(n,["component","childFactory"]),c=this.state.contextValue,p=de(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?K.createElement(mo.Provider,{value:c},p):K.createElement(mo.Provider,{value:c},K.createElement(a,u,p))},e})(K.Component);uo.propTypes={};uo.defaultProps=fe;function he(o){const{className:e,classes:t,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=o,[f,g]=l.useState(!1),m=z(e,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=oo("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),be=["center","classes","className"];let eo=o=>o,xo,vo,yo,Co;const ro=550,ge=80,me=lo(xo||(xo=eo`
2
+ 0% {
3
+ transform: scale(0);
4
+ opacity: 0.1;
5
+ }
6
+
7
+ 100% {
8
+ transform: scale(1);
9
+ opacity: 0.3;
10
+ }
11
+ `)),xe=lo(vo||(vo=eo`
12
+ 0% {
13
+ opacity: 1;
14
+ }
15
+
16
+ 100% {
17
+ opacity: 0;
18
+ }
19
+ `)),ve=lo(yo||(yo=eo`
20
+ 0% {
21
+ transform: scale(1);
22
+ }
23
+
24
+ 50% {
25
+ transform: scale(0.92);
26
+ }
27
+
28
+ 100% {
29
+ transform: scale(1);
30
+ }
31
+ `)),ye=Y("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),Ce=Y(he,{name:"MuiTouchRipple",slot:"Ripple"})(Co||(Co=eo`
32
+ opacity: 0;
33
+ position: absolute;
34
+
35
+ &.${0} {
36
+ opacity: 0.3;
37
+ transform: scale(1);
38
+ animation-name: ${0};
39
+ animation-duration: ${0}ms;
40
+ animation-timing-function: ${0};
41
+ }
42
+
43
+ &.${0} {
44
+ animation-duration: ${0}ms;
45
+ }
46
+
47
+ & .${0} {
48
+ opacity: 1;
49
+ display: block;
50
+ width: 100%;
51
+ height: 100%;
52
+ border-radius: 50%;
53
+ background-color: currentColor;
54
+ }
55
+
56
+ & .${0} {
57
+ opacity: 0;
58
+ animation-name: ${0};
59
+ animation-duration: ${0}ms;
60
+ animation-timing-function: ${0};
61
+ }
62
+
63
+ & .${0} {
64
+ position: absolute;
65
+ /* @noflip */
66
+ left: 0px;
67
+ top: 0;
68
+ animation-name: ${0};
69
+ animation-duration: 2500ms;
70
+ animation-timing-function: ${0};
71
+ animation-iteration-count: infinite;
72
+ animation-delay: 200ms;
73
+ }
74
+ `),E.rippleVisible,me,ro,({theme:o})=>o.transitions.easing.easeInOut,E.ripplePulsate,({theme:o})=>o.transitions.duration.shorter,E.child,E.childLeaving,xe,ro,({theme:o})=>o.transitions.easing.easeInOut,E.childPulsate,ve,({theme:o})=>o.transitions.easing.easeInOut),Re=l.forwardRef(function(e,t){const i=so({props:e,name:"MuiTouchRipple"}),{center:n=!1,classes:a={},className:r}=i,u=X(i,be),[c,p]=l.useState([]),f=l.useRef(0),g=l.useRef(null);l.useEffect(()=>{g.current&&(g.current(),g.current=null)},[c]);const m=l.useRef(!1),v=wo(),h=l.useRef(null),C=l.useRef(null),_=l.useCallback(d=>{const{pulsate:R,rippleX:x,rippleY:y,rippleSize:L,cb:O}=d;p(M=>[...M,T.jsx(Ce,{classes:{ripple:z(a.ripple,E.ripple),rippleVisible:z(a.rippleVisible,E.rippleVisible),ripplePulsate:z(a.ripplePulsate,E.ripplePulsate),child:z(a.child,E.child),childLeaving:z(a.childLeaving,E.childLeaving),childPulsate:z(a.childPulsate,E.childPulsate)},timeout:ro,pulsate:R,rippleX:x,rippleY:y,rippleSize:L},f.current)]),f.current+=1,g.current=O},[a]),V=l.useCallback((d={},R={},x=()=>{})=>{const{pulsate:y=!1,center:L=n||R.pulsate,fakeElement:O=!1}=R;if((d==null?void 0:d.type)==="mousedown"&&m.current){m.current=!1;return}(d==null?void 0:d.type)==="touchstart"&&(m.current=!0);const M=O?null:C.current,D=M?M.getBoundingClientRect():{width:0,height:0,left:0,top:0};let P,F,j;if(L||d===void 0||d.clientX===0&&d.clientY===0||!d.clientX&&!d.touches)P=Math.round(D.width/2),F=Math.round(D.height/2);else{const{clientX:W,clientY:k}=d.touches&&d.touches.length>0?d.touches[0]:d;P=Math.round(W-D.left),F=Math.round(k-D.top)}if(L)j=Math.sqrt((2*D.width**2+D.height**2)/3),j%2===0&&(j+=1);else{const W=Math.max(Math.abs((M?M.clientWidth:0)-P),P)*2+2,k=Math.max(Math.abs((M?M.clientHeight:0)-F),F)*2+2;j=Math.sqrt(W**2+k**2)}d!=null&&d.touches?h.current===null&&(h.current=()=>{_({pulsate:y,rippleX:P,rippleY:F,rippleSize:j,cb:x})},v.start(ge,()=>{h.current&&(h.current(),h.current=null)})):_({pulsate:y,rippleX:P,rippleY:F,rippleSize:j,cb:x})},[n,_,v]),S=l.useCallback(()=>{V({},{pulsate:!0})},[V]),I=l.useCallback((d,R)=>{if(v.clear(),(d==null?void 0:d.type)==="touchend"&&h.current){h.current(),h.current=null,v.start(0,()=>{I(d,R)});return}h.current=null,p(x=>x.length>0?x.slice(1):x),g.current=R},[v]);return l.useImperativeHandle(t,()=>({pulsate:S,start:V,stop:I}),[S,V,I]),T.jsx(ye,b({className:z(E.root,a.root,r),ref:C},u,{children:T.jsx(uo,{component:null,exit:!0,children:c})}))});function Me(o){return Ro("MuiButtonBase",o)}const ze=oo("MuiButtonBase",["root","disabled","focusVisible"]),Ee=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],Be=o=>{const{disabled:e,focusVisible:t,focusVisibleClassName:i,classes:n}=o,r=Mo({root:["root",e&&"disabled",t&&"focusVisible"]},Me,n);return t&&i&&(r.root+=` ${i}`),r},Te=Y("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(o,e)=>e.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${ze.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),$e=l.forwardRef(function(e,t){const i=so({props:e,name:"MuiButtonBase"}),{action:n,centerRipple:a=!1,children:r,className:u,component:c="button",disabled:p=!1,disableRipple:f=!1,disableTouchRipple:g=!1,focusRipple:m=!1,LinkComponent:v="a",onBlur:h,onClick:C,onContextMenu:_,onDragLeave:V,onFocus:S,onFocusVisible:I,onKeyDown:d,onKeyUp:R,onMouseDown:x,onMouseLeave:y,onMouseUp:L,onTouchEnd:O,onTouchMove:M,onTouchStart:D,tabIndex:P=0,TouchRippleProps:F,touchRippleRef:j,type:W}=i,k=X(i,Ee),G=l.useRef(null),$=l.useRef(null),Bo=go($,j),{isFocusVisibleRef:po,onFocus:To,onBlur:$o,ref:Io}=Jo(),[U,q]=l.useState(!1);p&&U&&q(!1),l.useImperativeHandle(n,()=>({focusVisible:()=>{q(!0),G.current.focus()}}),[]);const[to,Po]=l.useState(!1);l.useEffect(()=>{Po(!0)},[]);const ko=to&&!f&&!p;l.useEffect(()=>{U&&m&&!f&&to&&$.current.pulsate()},[f,m,U,to]);function N(s,ho,Ho=g){return w(bo=>(ho&&ho(bo),!Ho&&$.current&&$.current[s](bo),!0))}const No=N("start",x),Vo=N("stop",_),So=N("stop",V),Lo=N("stop",L),Do=N("stop",s=>{U&&s.preventDefault(),y&&y(s)}),Fo=N("start",D),jo=N("stop",O),_o=N("stop",M),Oo=N("stop",s=>{$o(s),po.current===!1&&q(!1),h&&h(s)},!1),Wo=w(s=>{G.current||(G.current=s.currentTarget),To(s),po.current===!0&&(q(!0),I&&I(s)),S&&S(s)}),no=()=>{const s=G.current;return c&&c!=="button"&&!(s.tagName==="A"&&s.href)},io=l.useRef(!1),Uo=w(s=>{m&&!io.current&&U&&$.current&&s.key===" "&&(io.current=!0,$.current.stop(s,()=>{$.current.start(s)})),s.target===s.currentTarget&&no()&&s.key===" "&&s.preventDefault(),d&&d(s),s.target===s.currentTarget&&no()&&s.key==="Enter"&&!p&&(s.preventDefault(),C&&C(s))}),Ao=w(s=>{m&&s.key===" "&&$.current&&U&&!s.defaultPrevented&&(io.current=!1,$.current.stop(s,()=>{$.current.pulsate(s)})),R&&R(s),C&&s.target===s.currentTarget&&no()&&s.key===" "&&!s.defaultPrevented&&C(s)});let Z=c;Z==="button"&&(k.href||k.to)&&(Z=v);const H={};Z==="button"?(H.type=W===void 0?"button":W,H.disabled=p):(!k.href&&!k.to&&(H.role="button"),p&&(H["aria-disabled"]=p));const Yo=go(t,Io,G),fo=b({},i,{centerRipple:a,component:c,disabled:p,disableRipple:f,disableTouchRipple:g,focusRipple:m,tabIndex:P,focusVisible:U}),Go=Be(fo);return T.jsxs(Te,b({as:Z,className:z(Go.root,u),ownerState:fo,onBlur:Oo,onClick:C,onContextMenu:Vo,onFocus:Wo,onKeyDown:Uo,onKeyUp:Ao,onMouseDown:No,onMouseLeave:Do,onMouseUp:Lo,onDragLeave:So,onTouchEnd:jo,onTouchMove:_o,onTouchStart:Fo,ref:Yo,tabIndex:p?-1:P,type:W},H,k,{children:[r,ko?T.jsx(Re,b({ref:Bo,center:a},F)):null]}))}),Ie=oo("MuiBox",["root"]),Pe=ee(),Ue=re({themeId:oe,defaultTheme:Pe,defaultClassName:Ie.root,generateClassName:Qo.generate});function ke(o){return Ro("MuiButton",o)}const Q=oo("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),Ne=l.createContext({}),Ve=l.createContext(void 0),Se=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],Le=o=>{const{color:e,disableElevation:t,fullWidth:i,size:n,variant:a,classes:r}=o,u={root:["root",a,`${a}${B(e)}`,`size${B(n)}`,`${a}Size${B(n)}`,`color${B(e)}`,t&&"disableElevation",i&&"fullWidth"],label:["label"],startIcon:["icon","startIcon",`iconSize${B(n)}`],endIcon:["icon","endIcon",`iconSize${B(n)}`]},c=Mo(u,ke,r);return b({},r,c)},Eo=o=>b({},o.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},o.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},o.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),De=Y($e,{shouldForwardProp:o=>ne(o)||o==="classes",name:"MuiButton",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,e[t.variant],e[`${t.variant}${B(t.color)}`],e[`size${B(t.size)}`],e[`${t.variant}Size${B(t.size)}`],t.color==="inherit"&&e.colorInherit,t.disableElevation&&e.disableElevation,t.fullWidth&&e.fullWidth]}})(({theme:o,ownerState:e})=>{var t,i;const n=o.palette.mode==="light"?o.palette.grey[300]:o.palette.grey[800],a=o.palette.mode==="light"?o.palette.grey.A100:o.palette.grey[700];return b({},o.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(o.vars||o).shape.borderRadius,transition:o.transitions.create(["background-color","box-shadow","border-color","color"],{duration:o.transitions.duration.short}),"&:hover":b({textDecoration:"none",backgroundColor:o.vars?`rgba(${o.vars.palette.text.primaryChannel} / ${o.vars.palette.action.hoverOpacity})`:J.alpha(o.palette.text.primary,o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="text"&&e.color!=="inherit"&&{backgroundColor:o.vars?`rgba(${o.vars.palette[e.color].mainChannel} / ${o.vars.palette.action.hoverOpacity})`:J.alpha(o.palette[e.color].main,o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="outlined"&&e.color!=="inherit"&&{border:`1px solid ${(o.vars||o).palette[e.color].main}`,backgroundColor:o.vars?`rgba(${o.vars.palette[e.color].mainChannel} / ${o.vars.palette.action.hoverOpacity})`:J.alpha(o.palette[e.color].main,o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="contained"&&{backgroundColor:o.vars?o.vars.palette.Button.inheritContainedHoverBg:a,boxShadow:(o.vars||o).shadows[4],"@media (hover: none)":{boxShadow:(o.vars||o).shadows[2],backgroundColor:(o.vars||o).palette.grey[300]}},e.variant==="contained"&&e.color!=="inherit"&&{backgroundColor:(o.vars||o).palette[e.color].dark,"@media (hover: none)":{backgroundColor:(o.vars||o).palette[e.color].main}}),"&:active":b({},e.variant==="contained"&&{boxShadow:(o.vars||o).shadows[8]}),[`&.${Q.focusVisible}`]:b({},e.variant==="contained"&&{boxShadow:(o.vars||o).shadows[6]}),[`&.${Q.disabled}`]:b({color:(o.vars||o).palette.action.disabled},e.variant==="outlined"&&{border:`1px solid ${(o.vars||o).palette.action.disabledBackground}`},e.variant==="contained"&&{color:(o.vars||o).palette.action.disabled,boxShadow:(o.vars||o).shadows[0],backgroundColor:(o.vars||o).palette.action.disabledBackground})},e.variant==="text"&&{padding:"6px 8px"},e.variant==="text"&&e.color!=="inherit"&&{color:(o.vars||o).palette[e.color].main},e.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},e.variant==="outlined"&&e.color!=="inherit"&&{color:(o.vars||o).palette[e.color].main,border:o.vars?`1px solid rgba(${o.vars.palette[e.color].mainChannel} / 0.5)`:`1px solid ${J.alpha(o.palette[e.color].main,.5)}`},e.variant==="contained"&&{color:o.vars?o.vars.palette.text.primary:(t=(i=o.palette).getContrastText)==null?void 0:t.call(i,o.palette.grey[300]),backgroundColor:o.vars?o.vars.palette.Button.inheritContainedBg:n,boxShadow:(o.vars||o).shadows[2]},e.variant==="contained"&&e.color!=="inherit"&&{color:(o.vars||o).palette[e.color].contrastText,backgroundColor:(o.vars||o).palette[e.color].main},e.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},e.size==="small"&&e.variant==="text"&&{padding:"4px 5px",fontSize:o.typography.pxToRem(13)},e.size==="large"&&e.variant==="text"&&{padding:"8px 11px",fontSize:o.typography.pxToRem(15)},e.size==="small"&&e.variant==="outlined"&&{padding:"3px 9px",fontSize:o.typography.pxToRem(13)},e.size==="large"&&e.variant==="outlined"&&{padding:"7px 21px",fontSize:o.typography.pxToRem(15)},e.size==="small"&&e.variant==="contained"&&{padding:"4px 10px",fontSize:o.typography.pxToRem(13)},e.size==="large"&&e.variant==="contained"&&{padding:"8px 22px",fontSize:o.typography.pxToRem(15)},e.fullWidth&&{width:"100%"})},({ownerState:o})=>o.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${Q.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${Q.disabled}`]:{boxShadow:"none"}}),Fe=Y("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.startIcon,e[`iconSize${B(t.size)}`]]}})(({ownerState:o})=>b({display:"inherit",marginRight:8,marginLeft:-4},o.size==="small"&&{marginLeft:-2},Eo(o))),je=Y("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.endIcon,e[`iconSize${B(t.size)}`]]}})(({ownerState:o})=>b({display:"inherit",marginRight:-4,marginLeft:8},o.size==="small"&&{marginRight:-2},Eo(o))),Ae=l.forwardRef(function(e,t){const i=l.useContext(Ne),n=l.useContext(Ve),a=te(i,e),r=so({props:a,name:"MuiButton"}),{children:u,color:c="primary",component:p="button",className:f,disabled:g=!1,disableElevation:m=!1,disableFocusRipple:v=!1,endIcon:h,focusVisibleClassName:C,fullWidth:_=!1,size:V="medium",startIcon:S,type:I,variant:d="text"}=r,R=X(r,Se),x=b({},r,{color:c,component:p,disabled:g,disableElevation:m,disableFocusRipple:v,fullWidth:_,size:V,type:I,variant:d}),y=Le(x),L=S&&T.jsx(Fe,{className:y.startIcon,ownerState:x,children:S}),O=h&&T.jsx(je,{className:y.endIcon,ownerState:x,children:h}),M=n||"";return T.jsxs(De,b({ownerState:x,className:z(i.className,y.root,f,M),component:p,disabled:g,focusRipple:!v,focusVisibleClassName:z(y.focusVisible,C),ref:t,type:I},R,{classes:y,children:[L,u,O]}))});export{Ne as B,mo as T,se as _,Ve as a,$e as b,Ae as c,Ue as d};
@@ -1 +1 @@
1
- import{j as e,r as j,u as pa,a as _a,L as te}from"./react-BW1xvPTF.js";import{t,C as K,A as G,ak as ga,x as ba,ai as P,Q as Ue,u as fa,n as va,a as xa,b as Ca,al as ja,am as ka,I as A,an as Na,z as wa,y as Ma,ao as Oe,j as B,ap as $e,aq as Sa,J as O,e as qa,h as Ve,c as pe,ar as _e,l as se,k as De,o as ne,q as Pa,r as ge,m as Ge,as as Aa}from"./index-TmxHL85j.js";import{P as Ye,m as Xe,W as Ia,c as be,t as Ra,C as Ta,A as Fa,a as Ea,s as He,i as Wa,b as La,d as Ba,e as Ka}from"./CollectionCarousel-CzvvuUUw.js";import{u as Qa}from"./useManaRate-C5mRxzeC.js";import{u as Je,r as za}from"./mana-rate-C8zn6Vfu.js";import{g as Ua,j as Oa,h as $a,n as Va,i as Da,A as Ga}from"./authorizations-Ds7LRLV0.js";import{a as fe}from"./buy-DnSS_Kop.js";import{a as Ha,w as Ja,S as Ya,G as Xa}from"./buy-gasless-9Zn1yAMk.js";import{R as re,r as Za}from"./cart-checkout-BAugwPm6.js";import{u as et,M as at,c as tt}from"./useCreditPacks-Dft_m4Vq.js";import{l as st}from"./loader-logo-BzY9EKdC.js";import{i as nt,a as rt}from"./errors-CG6pp58g.js";import{E as ct}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-CcRCeIpG.js";import"./sendMetaTransaction-7YAoB-pL.js";const it="https://cdn.decentraland.org/@dcl/shop/0.1.0-30381444187.commit-e5b9f13/assets/buy-error-22UunaPC.png";function ot(c){const{phase:o,balanceCredits:C,onClose:N}=c,I=o==="processing",F=o==="error"?t("cartCheckout.errorTitle"):o==="nofunds"?t("cartCheckout.titleNoFunds"):o==="choose"?t("buyModal.choosePayment"):t("cartCheckout.titleBuy"),E=o==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:I?void 0:N,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${E?" 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:F}),!I&&e.jsx("button",{className:"buy-modal__x",onClick:N,"aria-label":t("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:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(K,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:G(C)})]})]}),o==="choose"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"cart-checkout__choose-total",children:[e.jsx("span",{children:t("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(K,{className:"buy-modal__balance-ico"}),G(c.totalCredits??0)]})]}),e.jsx(Ye,{options:c.options??[],totalCents:c.totalCents??0,onPay:c.onPay??(()=>{}),rateNote:(()=>{const M=Xe(c.totalCents??0,c.totalManaWei??0n);return M!=null?t("buyModal.manaRate",{mana:M.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),o==="processing"&&e.jsx(lt,{stage:c.stage??"reserving",step:c.step??1,total:c.total??1,isSelfCustody:!!c.isSelfCustody}),o==="nofunds"&&e.jsx(dt,{lines:c.lines??[],shortfallCredits:c.shortfallCredits??0,packs:c.packs??[],selectedPack:c.selectedPack??"",onSelectPack:c.onSelectPack??(()=>{}),onBuyPacks:c.onBuyPacks??(()=>{}),onCancel:N}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:it,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:N,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:c.onRetry??N,children:t("cartCheckout.tryAgain")})]})]})]})]})}function lt({stage:c,step:o,total:C,isSelfCustody:N}){const I=c==="reserving",F=C>0?Math.min(100,Math.round(o/C*100)):0,E=c==="awaiting-signature"?N?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):c==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:st,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:E}),I?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:`${F}%`}})}),C>1?e.jsxs("span",{className:"cart-checkout__step",children:[o,"/",C]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function dt({lines:c,shortfallCredits:o,packs:C,selectedPack:N,onSelectPack:I,onBuyPacks:F,onCancel:E}){const M=C.find(n=>n.id===N),ie=c.reduce((n,q)=>n+(q.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ia,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,o)})})," ",t("buyModal.warningToPurchase",{count:ie})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:c.map(n=>{const q=n.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.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:n.item.name,children:[n.item.name||t("buyModal.itemFallback"),q>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:q})}):null]}),n.item.creator?e.jsx(ga,{address:n.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(K,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:G(n.priceCredits*q)})]})]})]},n.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:C.map(n=>{const q=n.id===N;return e.jsxs("button",{className:`buy-modal__pack${q?" buy-modal__pack--on":""}`,onClick:()=>I(n.id),children:[e.jsx(K,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:G(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(K,{className:"buy-modal__total-ico"}),e.jsx("span",{children:G((M==null?void 0:M.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((M==null?void 0:M.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:E,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:F,children:t("buyModal.buy")})]})]})}function ve(c){if(nt(c))return t("errors.rejected");const o=(c.message??"").toLowerCase();return o.includes("insufficient")?t("cart.error.insufficient",{currency:qa.name}):o.includes("no active listing")||o.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const ut=12e4;function ht(c){const o=[];return c.unavailable.length&&o.push(t("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&o.push(t("cart.drop.own",{count:c.own.length})),t("cart.drop.removed",{items:o.join(` ${t("cart.drop.and")} `)})}const xe=c=>c.reduce((o,C)=>o+C.priceCredits*C.quantity,0),ce=c=>c.flatMap(o=>Array.from({length:o.quantity},()=>({...o,quantity:1})));function It(){ba({title:t("nav.cart"),noindex:!0});const c=P(a=>a.items),o=P(a=>a.remove),C=P(a=>a.increment),N=P(a=>a.decrement),I=P(a=>a.clear),F=P(a=>a.restore),E=P(a=>a.setFittingOpen),M=Ue(a=>a.items),ie=Ue(a=>a.toggle),{session:n,signIn:q}=fa(),H=et().packs.slice(0,at);j.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Ze=c.some(a=>a.category!=="emote"),{data:oe}=va({queryKey:["upsell-listings"],queryFn:()=>Aa({first:40}),staleTime:6e4}),{data:f}=xa(n),y=Ca(),Q=pa(),{state:W}=_a(),[ea,$]=j.useState(null),[Ce,J]=j.useState(null),[aa,S]=j.useState(!1),[w,L]=j.useState(null),je=j.useRef(0),[u,g]=j.useState(null),{data:V}=ja(n),{data:le}=Qa(!0),[de,ke]=j.useState(""),D=j.useRef(null),Ne=ka(c),we=a=>Oe(Ne[a.id]),ue=c.filter(we),he=c.length>0&&ue.length===0,ta=ue.reduce((a,s)=>a+s.priceCredits*s.quantity,0),sa=c.reduce((a,s)=>a+s.quantity,0),na=ue.reduce((a,s)=>a+s.quantity,0),Me=w?w.liveTotalCredits:ta,ra=new Set(c.map(a=>a.id)),Se=((oe==null?void 0:oe.items)??[]).filter(a=>!ra.has(a.id)).slice(0,12),ca=new Map(w==null?void 0:w.buyable.map(a=>[a.item.id,a])),Y=(f==null?void 0:f.credits)??0,X=Me*10,qe=le?Je(X,le):0n,Z=be({priceCents:X,priceManaWei:qe,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n}),Pe=Xe(X,qe),Ae=Pe!=null?t("buyModal.manaRate",{mana:Pe.toLocaleString("en",{maximumFractionDigits:2})}):null,ia=Sa;function ee(a){a(),L(null),J(null),$(null)}function oa(){g(null),S(!1)}function Ie(a){const s=xe(a),i=Math.max(0,s-Y),r=H.find(l=>l.credits>=i)??H[H.length-1];ke(r.id),B("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:Y,shortfall:i}),g({phase:"nofunds",lines:a.map(l=>({item:l.item,priceCredits:l.priceCredits,quantity:l.quantity})),shortfall:i}),S(!1)}async function me(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(m=>({...m.item,priceCredits:m.priceCredits})),r=a.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),l=[];let d="authorize",p=!1;g({phase:"processing",stage:"reserving",step:1,total:s.length});try{const m=[];for(let x=0;x<s.length;x++){const b=s[x];g({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const{credit:v,maxCreditedValue:U}=await Ve(n.identity,b.usdCents,b.trade.id);l.push(v.id),m.push({trade:b.trade,credits:[v],maxCreditedValue:U})}catch(v){if(rt(v)){if(l.length){try{await pe(n.identity,l)}catch(U){O(U,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}Ie(a);return}throw v}}d="submit";const k=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let _=[];if(Ua())try{_=await Ha({purchases:m,buyer:n.address,signer:n.signer,onSigned:k});const b=(await Promise.allSettled(_.map(v=>Ja(v)))).flatMap(v=>v.status==="rejected"?[v.reason]:[]);if(b.length&&!b.some(v=>v instanceof Ya))throw b[0];p=!0}catch(x){if(!(x instanceof Xa))throw x;_=await fe({purchases:m,buyer:n.address,signer:n.signer,onSigned:k})}else _=await fe({purchases:m,buyer:n.address,signer:n.signer});a.forEach(x=>o(x.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"credits",no_crypto_step:p,transaction_hash:_[0]??null}),Wa(y);const h=D.current;D.current=null,g(null),S(!1);const T={items:r,txHash:_[0]??void 0,settled:!0,...h?{creditsAdded:h}:{}};Q("/success",{state:T,replace:!0})}catch(m){if(se(m)||O(m,{flow:"cart_checkout",step:d,cart_size:a.length}),B(se(m)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:d,error_code:De(m),value_usd:$e(i.reduce((k,_)=>k+_.priceCredits,0)),cart_size:s.length}),l.length){try{await pe(n.identity,l)}catch(k){O(k,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}g({phase:"error",message:ve(m)})}}function Re(a,s){y.invalidateQueries({queryKey:["usd-balance"]}),y.invalidateQueries({queryKey:["detail-trade"]}),y.invalidateQueries({queryKey:["shop-item"]}),y.invalidateQueries({queryKey:["owned-token"]}),y.invalidateQueries({queryKey:["public-token"]}),y.invalidateQueries({queryKey:["item-resales"]}),y.invalidateQueries({queryKey:["shop-items"]}),y.invalidateQueries({queryKey:["catalog-items"]}),y.invalidateQueries({queryKey:["my-assets"]}),y.invalidateQueries({queryKey:["purchases"]}),y.invalidateQueries({queryKey:["owned-item-count"]}),y.invalidateQueries({queryKey:["overview-listings"]}),y.invalidateQueries({queryKey:["upsell-listings"]});const i=D.current;D.current=null,g(null),S(!1);const r={items:a,txHash:s[0]??void 0,settled:!0,...i?{creditsAdded:i}:{}};Q("/success",{state:r,replace:!0})}function Te(a,s){se(a)||O(a,{flow:s,step:"submit"}),B(se(a)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:De(a)}),g({phase:"error",message:ve(a)}),S(!1)}async function la(a,s){const i=ne(ge.MANAToken,s),r=ne(ge.CreditsManager,s);await Da({auth:{kind:Ga.Allowance,contractAddress:i.address,spenderAddress:r.address,chainId:s},signer:a})}async function da(a){const s=ce(a).reduce((d,p)=>d+p.usdCents,0),i=(V??0n)>0n;let r=le;if(!r&&i)try{r=await y.fetchQuery({queryKey:["mana-rate",Ge.chainId],queryFn:()=>za(Ge.chainId),staleTime:6e4})}catch{r=void 0}const l=r?Je(s,r):0n;return{totalCents:s,manaWei:l}}async function Fe(a,s){const i=xe(a),{totalCents:r,manaWei:l}=await da(a),d=be({priceCents:r,priceManaWei:l,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n});if(s&&d.options.some(p=>p.method===s)){if(s==="credits"){me(a);return}const{spender:p,chainId:m}=Ee(s,a);await We(p,m,()=>s==="mana"?void Le(a):void Be(a,r,l));return}if(d.options.some(p=>p.method==="mana"||p.method==="combined")){g({phase:"choose",lines:a,totalCents:r,manaWei:l}),S(!1);return}if(f!=null&&f.credits<i){Ie(a);return}me(a)}function ua(a){return be({priceCents:a.totalCents,priceManaWei:a.manaWei,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n})}const[ye,ae]=j.useState(null);function Ee(a,s){const i=s[0].trade;return{spender:a==="mana"?ne(Pa(i.contract),i.chainId).address:ne(ge.CreditsManager,i.chainId).address,chainId:i.chainId}}async function We(a,s,i){const r=Oa(s,a),l=n?await $a(r,n.address).catch(()=>!0):!0;if(Va(n==null?void 0:n.providerType,l)){S(!1),ae({auth:r,run:i});return}i()}function ha(a){if((u==null?void 0:u.phase)!=="choose")return;const{lines:s,totalCents:i,manaWei:r}=u;if(a==="credits"){me(s);return}const{spender:l,chainId:d}=Ee(a,s);We(l,d,()=>a==="mana"?void Le(s):void Be(s,i,r))}async function Le(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(d=>({...d.item,priceCredits:d.priceCredits})),r=a.map(d=>({...d.item,priceCredits:d.priceCredits,quantity:d.quantity})),l=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const d=await La({trades:s.map(p=>p.trade),buyer:n.address,signer:n.signer,onSigned:l});a.forEach(p=>o(p.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"mana",transaction_hash:d[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(r,d)}catch(d){Te(d,"buy_cart_mana")}}async function Be(a,s,i){if(!n||a.length===0)return;const r=ce(a),l=r.map(h=>({...h.item,priceCredits:h.priceCredits})),d=a.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),p=Ba(r.map(h=>h.usdCents),(f==null?void 0:f.balanceCents)??0),m=p.reduce((h,T)=>h+T,0),k=Ka(Math.max(0,s-m),s,i),_=[];g({phase:"processing",stage:"reserving",step:1,total:r.length});try{const h=[];for(let b=0;b<r.length;b++){const v=p[b];if(v<=0)continue;g({phase:"processing",stage:"reserving",step:b+1,total:r.length});const{credit:U,maxCreditedValue:ya}=await Ve(n.identity,v,r[b].trade.id);_.push(U.id),h.push({trade:r[b].trade,credits:[U],maxCreditedValue:ya})}r.forEach((b,v)=>{p[v]<=0&&h.push({trade:b.trade,credits:[],maxCreditedValue:"0"})}),h[0]={...h[0],maxCreditedValue:(BigInt(h[0].maxCreditedValue)+k).toString()},await la(n.signer,r[0].trade.chainId);const T=()=>g({phase:"processing",stage:"settling",step:r.length,total:r.length});g({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const x=await fe({purchases:h,buyer:n.address,signer:n.signer,onSigned:T});a.forEach(b=>o(b.item.id)),L(null),B("Shop Completed Purchase",{..._e(l),payment_type:"credits_and_mana",transaction_hash:x[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(d,x)}catch(h){_.length&&(pe(n.identity,_).catch(()=>{}),y.invalidateQueries({queryKey:["usd-balance"]})),Te(h,"buy_cart_combined")}}async function z(a){if(!n){He({type:"cart-checkout"}),q();return}const s=P.getState().items.filter(we);if(s.length===0)return;$(null),J(null),S(!0);const i=s.reduce((r,l)=>r+l.priceCredits*l.quantity,0);B("Shop Started Checkout",{cart_size:s.length,cart_value_credits:i,cart_value_usd:$e(i),has_sufficient_credits:Y>=i});try{const r=await Za(s,n.address,ia),l=[...r.unavailable,...r.own];if(l.length&&(l.forEach(d=>o(d.id)),J(ht(r))),r.buyable.length===0){$(t("cart.error.noneAvailable")),L(null);return}if(r.orderChanged){L(r),je.current=Date.now();return}await Fe(r.buyable,a)}catch(r){O(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),$(ve(r))}finally{S(!1)}}async function Ke(){if(w){if(!n){He({type:"cart-checkout"}),q();return}if(Date.now()-je.current>ut){L(null),J(null),await z();return}$(null),Fe(w.buyable)}}async function ma(){if(de){try{sessionStorage.setItem(re,JSON.stringify(P.getState().items))}catch{}S(!0);try{const a=await tt(de,n?{address:n.address,identity:n.identity}:void 0);if(a.url){window.location.href=a.url;return}Q("/credits")}catch(a){try{sessionStorage.removeItem(re)}catch{}O(a,{flow:"cart_buy_credits"}),g({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{S(!1)}}}const Qe=j.useRef(!1);j.useEffect(()=>{if(!n||Qe.current||!Ra("cart-checkout"))return;Qe.current=!0;const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[n]);const ze=j.useRef(!1);j.useEffect(()=>{if(!(W!=null&&W.resumeCheckout)||ze.current)return;ze.current=!0,D.current=W.creditsAdded??null;try{const s=sessionStorage.getItem(re);if(s){sessionStorage.removeItem(re);const i=JSON.parse(s);Array.isArray(i)&&i.length&&F(i)}}catch{}y.invalidateQueries({queryKey:["usd-balance"]});const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[W==null?void 0:W.resumeCheckout]);const R=aa||(u==null?void 0:u.phase)==="processing";return c.length===0&&!u?e.jsx("div",{className:"checkout checkout--empty",children:e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("section",{className:"checkout__panel cart-empty","data-testid":"cart-empty",children:[e.jsx(A,{name:"cart-plus",size:110,className:"cart-empty__icon"}),e.jsxs("div",{className:"cart-empty__text",children:[e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"cart-empty__body",children:t("cart.empty.body")})]}),e.jsx(te,{className:"cart-empty__cta",to:"/assets",children:t("cart.empty.cta")})]})]})}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("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:()=>Q(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(A,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:sa})}),Ze?e.jsxs("button",{className:"checkout__fitting",onClick:()=>E(!0),disabled:R,children:[e.jsx(A,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:c.map(a=>{const s=ca.get(a.id),i=s?s.priceCredits:a.priceCredits,r=!!s&&s.priceCredits!==a.priceCredits,l=!a.tokenId,d=a.quantity,p=typeof a.available=="number"&&d>=a.available,m=i*d,k=!!M[a.id],_=Na(a),h=Ne[a.id],T=!Oe(h),x=h==="sold-out"?t("cart.availability.soldOut"):t("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${T?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(te,{className:"checkout__thumb-link",to:_,state:{item:a,tradeId:a.tradeId},"aria-label":a.name,children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null}):a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.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(te,{className:"checkout__name",to:_,state:{item:a,tradeId:a.tradeId},title:a.name,children:a.name}):e.jsx("div",{className:"checkout__name",title:a.name,children:a.name}),a.creator?e.jsx(wa,{address:a.creator,className:"checkout__creator",linkToProfile:!0}):null,l?e.jsxs("span",{className:"checkout__creator-tag","data-testid":"cart-creator-tag",children:[e.jsx(A,{name:"buy-from-creator",className:"checkout__creator-tag-ico","aria-hidden":!0}),t("cart.creatorTag")]}):null]}),e.jsx("div",{className:"checkout__foot",children:T?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"checkout__unavailable",children:[e.jsx(A,{name:"warning-fill",size:24,className:"checkout__warn","aria-hidden":!0}),x]}),_?e.jsx(te,{className:"checkout__resales",to:_,state:{item:a,tradeId:a.tradeId},children:t("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>N(a.id)),disabled:R||d<=1,"aria-label":t("cart.decreaseQuantity",{name:a.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:d}),e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>C(a.id)),disabled:R||p,"aria-label":t("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(K,{className:"checkout__price-ico"})," ",m,r?e.jsx("span",{className:"checkout__price-was",children:a.priceCredits*d}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${k?" is-on":""}`,onClick:()=>ie(a),"aria-label":k?t("cart.removeFromFavorites",{name:a.name}):t("cart.addToFavorites",{name:a.name}),title:k?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(A,{name:k?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>ee(()=>o(a.id)),disabled:R,"aria-label":t("cart.remove",{name:a.name}),title:t("cart.removeTitle"),children:e.jsx(A,{name:"trash",size:24})})]})]},a.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>ee(I),disabled:R,children:t("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:t("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:t("cart.totalItems",{count:na})}),e.jsxs("span",{className:"checkout__total-side",children:[e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(K,{className:"checkout__total-ico"})," ",Me]}),Ae&&(V??0n)>0n?e.jsx("span",{className:"checkout__total-rate","data-testid":"cart-mana-rate",children:Ae}):null]})]}),Z.options.length>0||Z.manaShortfall?e.jsx(Ye,{options:Z.options,totalCents:X,shortfall:Z.manaShortfall,creditsLabel:w?t("marketCheckout.confirmPurchase"):t("cart.buyWithCredits"),busy:R||he,onPay:a=>void(w?Ke():z(a))}):e.jsx("button",{className:"checkout__cta",onClick:()=>void(w?Ke():z()),disabled:R||he,children:R?t("cart.working"):w?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),he?e.jsx("p",{className:"muted checkout__msg",children:t("cart.allUnavailable")}):null,n?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),w?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,Ce?e.jsx("p",{className:"muted checkout__msg",children:Ce}):null,e.jsx(ct,{message:ea,className:"checkout__msg"})]})]})]})]}),Se.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Ta,{title:t("cart.youMightAlsoLike"),items:Se})}):null,ye&&n?e.jsx(Fa,{auth:ye.auth,signer:n.signer,title:t("authorizeStep.manaTitle"),name:t("authorizeStep.manaName"),reason:t("authorizeStep.manaReason"),icon:e.jsx("img",{src:Ea,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:a}=ye;ae(null),a()},onCancel:()=>ae(null),onClose:()=>ae(null)}):null,u?e.jsx(ot,{phase:u.phase,balanceCredits:Y,onClose:oa,stage:u.phase==="processing"?u.stage:void 0,step:u.phase==="processing"?u.step:void 0,total:u.phase==="processing"?u.total:void 0,isSelfCustody:Ma(n==null?void 0:n.providerType),options:u.phase==="choose"?ua(u).options:void 0,onPay:ha,totalCents:u.phase==="choose"?u.totalCents:void 0,totalManaWei:u.phase==="choose"?u.manaWei:void 0,totalCredits:u.phase==="choose"?xe(u.lines):void 0,lines:u.phase==="nofunds"?u.lines:void 0,shortfallCredits:u.phase==="nofunds"?u.shortfall:void 0,packs:H,selectedPack:de,onSelectPack:ke,onBuyPacks:()=>void ma(),message:u.phase==="error"?u.message:void 0,onRetry:()=>void z()}):null]})}export{It as Cart};
1
+ import{j as e,r as j,u as pa,a as _a,L as te}from"./react-BW1xvPTF.js";import{t,C as K,D as G,an as ga,y as ba,al as P,R as Ue,u as fa,o as va,a as xa,b as Ca,ao as ja,ap as ka,I as A,aq as Na,A as wa,z as Ma,ar as Oe,k as B,as as $e,at as Sa,K as O,g as qa,j as Ve,d as pe,au as _e,m as se,l as De,q as ne,r as Pa,v as ge,n as Ge,av as Aa}from"./index-CE-8j9dT.js";import{P as Ye,m as Xe,W as Ia,c as be,t as Ra,C as Ta,A as Fa,a as Ea,s as He,i as Wa,b as La,d as Ba,e as Ka}from"./CollectionCarousel-Ck_R1F2f.js";import{u as Qa}from"./useManaRate-1Q3qKQkm.js";import{u as Je,r as za}from"./mana-rate-iDr_vy1I.js";import{g as Ua,j as Oa,h as $a,n as Va,i as Da,A as Ga}from"./authorizations-BxQ2tMzo.js";import{a as fe}from"./buy-C-oTH9gd.js";import{a as Ha,w as Ja,S as Ya,G as Xa}from"./buy-gasless-BlKkmgRS.js";import{R as re,r as Za}from"./cart-checkout-BQRIzuA5.js";import{u as et,M as at,c as tt}from"./useCreditPacks-CS3eE-oJ.js";import{l as st}from"./loader-logo-BzY9EKdC.js";import{i as nt,a as rt}from"./errors-CRgGE21K.js";import{E as ct}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-BjnvL03O.js";import"./sendMetaTransaction-BMgjMfxP.js";const it="https://cdn.decentraland.org/@dcl/shop/0.1.0-30381451752.commit-ab871f3/assets/buy-error-22UunaPC.png";function ot(c){const{phase:o,balanceCredits:C,onClose:N}=c,I=o==="processing",F=o==="error"?t("cartCheckout.errorTitle"):o==="nofunds"?t("cartCheckout.titleNoFunds"):o==="choose"?t("buyModal.choosePayment"):t("cartCheckout.titleBuy"),E=o==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:I?void 0:N,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${E?" 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:F}),!I&&e.jsx("button",{className:"buy-modal__x",onClick:N,"aria-label":t("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:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(K,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:G(C)})]})]}),o==="choose"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"cart-checkout__choose-total",children:[e.jsx("span",{children:t("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(K,{className:"buy-modal__balance-ico"}),G(c.totalCredits??0)]})]}),e.jsx(Ye,{options:c.options??[],totalCents:c.totalCents??0,onPay:c.onPay??(()=>{}),rateNote:(()=>{const M=Xe(c.totalCents??0,c.totalManaWei??0n);return M!=null?t("buyModal.manaRate",{mana:M.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),o==="processing"&&e.jsx(lt,{stage:c.stage??"reserving",step:c.step??1,total:c.total??1,isSelfCustody:!!c.isSelfCustody}),o==="nofunds"&&e.jsx(dt,{lines:c.lines??[],shortfallCredits:c.shortfallCredits??0,packs:c.packs??[],selectedPack:c.selectedPack??"",onSelectPack:c.onSelectPack??(()=>{}),onBuyPacks:c.onBuyPacks??(()=>{}),onCancel:N}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:it,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:N,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:c.onRetry??N,children:t("cartCheckout.tryAgain")})]})]})]})]})}function lt({stage:c,step:o,total:C,isSelfCustody:N}){const I=c==="reserving",F=C>0?Math.min(100,Math.round(o/C*100)):0,E=c==="awaiting-signature"?N?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):c==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:st,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:E}),I?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:`${F}%`}})}),C>1?e.jsxs("span",{className:"cart-checkout__step",children:[o,"/",C]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function dt({lines:c,shortfallCredits:o,packs:C,selectedPack:N,onSelectPack:I,onBuyPacks:F,onCancel:E}){const M=C.find(n=>n.id===N),ie=c.reduce((n,q)=>n+(q.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ia,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,o)})})," ",t("buyModal.warningToPurchase",{count:ie})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:c.map(n=>{const q=n.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.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:n.item.name,children:[n.item.name||t("buyModal.itemFallback"),q>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:q})}):null]}),n.item.creator?e.jsx(ga,{address:n.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(K,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:G(n.priceCredits*q)})]})]})]},n.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:C.map(n=>{const q=n.id===N;return e.jsxs("button",{className:`buy-modal__pack${q?" buy-modal__pack--on":""}`,onClick:()=>I(n.id),children:[e.jsx(K,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:G(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(K,{className:"buy-modal__total-ico"}),e.jsx("span",{children:G((M==null?void 0:M.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((M==null?void 0:M.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:E,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:F,children:t("buyModal.buy")})]})]})}function ve(c){if(nt(c))return t("errors.rejected");const o=(c.message??"").toLowerCase();return o.includes("insufficient")?t("cart.error.insufficient",{currency:qa.name}):o.includes("no active listing")||o.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const ut=12e4;function ht(c){const o=[];return c.unavailable.length&&o.push(t("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&o.push(t("cart.drop.own",{count:c.own.length})),t("cart.drop.removed",{items:o.join(` ${t("cart.drop.and")} `)})}const xe=c=>c.reduce((o,C)=>o+C.priceCredits*C.quantity,0),ce=c=>c.flatMap(o=>Array.from({length:o.quantity},()=>({...o,quantity:1})));function It(){ba({title:t("nav.cart"),noindex:!0});const c=P(a=>a.items),o=P(a=>a.remove),C=P(a=>a.increment),N=P(a=>a.decrement),I=P(a=>a.clear),F=P(a=>a.restore),E=P(a=>a.setFittingOpen),M=Ue(a=>a.items),ie=Ue(a=>a.toggle),{session:n,signIn:q}=fa(),H=et().packs.slice(0,at);j.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Ze=c.some(a=>a.category!=="emote"),{data:oe}=va({queryKey:["upsell-listings"],queryFn:()=>Aa({first:40}),staleTime:6e4}),{data:f}=xa(n),y=Ca(),Q=pa(),{state:W}=_a(),[ea,$]=j.useState(null),[Ce,J]=j.useState(null),[aa,S]=j.useState(!1),[w,L]=j.useState(null),je=j.useRef(0),[u,g]=j.useState(null),{data:V}=ja(n),{data:le}=Qa(!0),[de,ke]=j.useState(""),D=j.useRef(null),Ne=ka(c),we=a=>Oe(Ne[a.id]),ue=c.filter(we),he=c.length>0&&ue.length===0,ta=ue.reduce((a,s)=>a+s.priceCredits*s.quantity,0),sa=c.reduce((a,s)=>a+s.quantity,0),na=ue.reduce((a,s)=>a+s.quantity,0),Me=w?w.liveTotalCredits:ta,ra=new Set(c.map(a=>a.id)),Se=((oe==null?void 0:oe.items)??[]).filter(a=>!ra.has(a.id)).slice(0,12),ca=new Map(w==null?void 0:w.buyable.map(a=>[a.item.id,a])),Y=(f==null?void 0:f.credits)??0,X=Me*10,qe=le?Je(X,le):0n,Z=be({priceCents:X,priceManaWei:qe,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n}),Pe=Xe(X,qe),Ae=Pe!=null?t("buyModal.manaRate",{mana:Pe.toLocaleString("en",{maximumFractionDigits:2})}):null,ia=Sa;function ee(a){a(),L(null),J(null),$(null)}function oa(){g(null),S(!1)}function Ie(a){const s=xe(a),i=Math.max(0,s-Y),r=H.find(l=>l.credits>=i)??H[H.length-1];ke(r.id),B("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:Y,shortfall:i}),g({phase:"nofunds",lines:a.map(l=>({item:l.item,priceCredits:l.priceCredits,quantity:l.quantity})),shortfall:i}),S(!1)}async function me(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(m=>({...m.item,priceCredits:m.priceCredits})),r=a.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),l=[];let d="authorize",p=!1;g({phase:"processing",stage:"reserving",step:1,total:s.length});try{const m=[];for(let x=0;x<s.length;x++){const b=s[x];g({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const{credit:v,maxCreditedValue:U}=await Ve(n.identity,b.usdCents,b.trade.id);l.push(v.id),m.push({trade:b.trade,credits:[v],maxCreditedValue:U})}catch(v){if(rt(v)){if(l.length){try{await pe(n.identity,l)}catch(U){O(U,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}Ie(a);return}throw v}}d="submit";const k=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let _=[];if(Ua())try{_=await Ha({purchases:m,buyer:n.address,signer:n.signer,onSigned:k});const b=(await Promise.allSettled(_.map(v=>Ja(v)))).flatMap(v=>v.status==="rejected"?[v.reason]:[]);if(b.length&&!b.some(v=>v instanceof Ya))throw b[0];p=!0}catch(x){if(!(x instanceof Xa))throw x;_=await fe({purchases:m,buyer:n.address,signer:n.signer,onSigned:k})}else _=await fe({purchases:m,buyer:n.address,signer:n.signer});a.forEach(x=>o(x.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"credits",no_crypto_step:p,transaction_hash:_[0]??null}),Wa(y);const h=D.current;D.current=null,g(null),S(!1);const T={items:r,txHash:_[0]??void 0,settled:!0,...h?{creditsAdded:h}:{}};Q("/success",{state:T,replace:!0})}catch(m){if(se(m)||O(m,{flow:"cart_checkout",step:d,cart_size:a.length}),B(se(m)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:d,error_code:De(m),value_usd:$e(i.reduce((k,_)=>k+_.priceCredits,0)),cart_size:s.length}),l.length){try{await pe(n.identity,l)}catch(k){O(k,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}g({phase:"error",message:ve(m)})}}function Re(a,s){y.invalidateQueries({queryKey:["usd-balance"]}),y.invalidateQueries({queryKey:["detail-trade"]}),y.invalidateQueries({queryKey:["shop-item"]}),y.invalidateQueries({queryKey:["owned-token"]}),y.invalidateQueries({queryKey:["public-token"]}),y.invalidateQueries({queryKey:["item-resales"]}),y.invalidateQueries({queryKey:["shop-items"]}),y.invalidateQueries({queryKey:["catalog-items"]}),y.invalidateQueries({queryKey:["my-assets"]}),y.invalidateQueries({queryKey:["purchases"]}),y.invalidateQueries({queryKey:["owned-item-count"]}),y.invalidateQueries({queryKey:["overview-listings"]}),y.invalidateQueries({queryKey:["upsell-listings"]});const i=D.current;D.current=null,g(null),S(!1);const r={items:a,txHash:s[0]??void 0,settled:!0,...i?{creditsAdded:i}:{}};Q("/success",{state:r,replace:!0})}function Te(a,s){se(a)||O(a,{flow:s,step:"submit"}),B(se(a)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:De(a)}),g({phase:"error",message:ve(a)}),S(!1)}async function la(a,s){const i=ne(ge.MANAToken,s),r=ne(ge.CreditsManager,s);await Da({auth:{kind:Ga.Allowance,contractAddress:i.address,spenderAddress:r.address,chainId:s},signer:a})}async function da(a){const s=ce(a).reduce((d,p)=>d+p.usdCents,0),i=(V??0n)>0n;let r=le;if(!r&&i)try{r=await y.fetchQuery({queryKey:["mana-rate",Ge.chainId],queryFn:()=>za(Ge.chainId),staleTime:6e4})}catch{r=void 0}const l=r?Je(s,r):0n;return{totalCents:s,manaWei:l}}async function Fe(a,s){const i=xe(a),{totalCents:r,manaWei:l}=await da(a),d=be({priceCents:r,priceManaWei:l,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n});if(s&&d.options.some(p=>p.method===s)){if(s==="credits"){me(a);return}const{spender:p,chainId:m}=Ee(s,a);await We(p,m,()=>s==="mana"?void Le(a):void Be(a,r,l));return}if(d.options.some(p=>p.method==="mana"||p.method==="combined")){g({phase:"choose",lines:a,totalCents:r,manaWei:l}),S(!1);return}if(f!=null&&f.credits<i){Ie(a);return}me(a)}function ua(a){return be({priceCents:a.totalCents,priceManaWei:a.manaWei,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n})}const[ye,ae]=j.useState(null);function Ee(a,s){const i=s[0].trade;return{spender:a==="mana"?ne(Pa(i.contract),i.chainId).address:ne(ge.CreditsManager,i.chainId).address,chainId:i.chainId}}async function We(a,s,i){const r=Oa(s,a),l=n?await $a(r,n.address).catch(()=>!0):!0;if(Va(n==null?void 0:n.providerType,l)){S(!1),ae({auth:r,run:i});return}i()}function ha(a){if((u==null?void 0:u.phase)!=="choose")return;const{lines:s,totalCents:i,manaWei:r}=u;if(a==="credits"){me(s);return}const{spender:l,chainId:d}=Ee(a,s);We(l,d,()=>a==="mana"?void Le(s):void Be(s,i,r))}async function Le(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(d=>({...d.item,priceCredits:d.priceCredits})),r=a.map(d=>({...d.item,priceCredits:d.priceCredits,quantity:d.quantity})),l=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const d=await La({trades:s.map(p=>p.trade),buyer:n.address,signer:n.signer,onSigned:l});a.forEach(p=>o(p.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"mana",transaction_hash:d[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(r,d)}catch(d){Te(d,"buy_cart_mana")}}async function Be(a,s,i){if(!n||a.length===0)return;const r=ce(a),l=r.map(h=>({...h.item,priceCredits:h.priceCredits})),d=a.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),p=Ba(r.map(h=>h.usdCents),(f==null?void 0:f.balanceCents)??0),m=p.reduce((h,T)=>h+T,0),k=Ka(Math.max(0,s-m),s,i),_=[];g({phase:"processing",stage:"reserving",step:1,total:r.length});try{const h=[];for(let b=0;b<r.length;b++){const v=p[b];if(v<=0)continue;g({phase:"processing",stage:"reserving",step:b+1,total:r.length});const{credit:U,maxCreditedValue:ya}=await Ve(n.identity,v,r[b].trade.id);_.push(U.id),h.push({trade:r[b].trade,credits:[U],maxCreditedValue:ya})}r.forEach((b,v)=>{p[v]<=0&&h.push({trade:b.trade,credits:[],maxCreditedValue:"0"})}),h[0]={...h[0],maxCreditedValue:(BigInt(h[0].maxCreditedValue)+k).toString()},await la(n.signer,r[0].trade.chainId);const T=()=>g({phase:"processing",stage:"settling",step:r.length,total:r.length});g({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const x=await fe({purchases:h,buyer:n.address,signer:n.signer,onSigned:T});a.forEach(b=>o(b.item.id)),L(null),B("Shop Completed Purchase",{..._e(l),payment_type:"credits_and_mana",transaction_hash:x[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(d,x)}catch(h){_.length&&(pe(n.identity,_).catch(()=>{}),y.invalidateQueries({queryKey:["usd-balance"]})),Te(h,"buy_cart_combined")}}async function z(a){if(!n){He({type:"cart-checkout"}),q();return}const s=P.getState().items.filter(we);if(s.length===0)return;$(null),J(null),S(!0);const i=s.reduce((r,l)=>r+l.priceCredits*l.quantity,0);B("Shop Started Checkout",{cart_size:s.length,cart_value_credits:i,cart_value_usd:$e(i),has_sufficient_credits:Y>=i});try{const r=await Za(s,n.address,ia),l=[...r.unavailable,...r.own];if(l.length&&(l.forEach(d=>o(d.id)),J(ht(r))),r.buyable.length===0){$(t("cart.error.noneAvailable")),L(null);return}if(r.orderChanged){L(r),je.current=Date.now();return}await Fe(r.buyable,a)}catch(r){O(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),$(ve(r))}finally{S(!1)}}async function Ke(){if(w){if(!n){He({type:"cart-checkout"}),q();return}if(Date.now()-je.current>ut){L(null),J(null),await z();return}$(null),Fe(w.buyable)}}async function ma(){if(de){try{sessionStorage.setItem(re,JSON.stringify(P.getState().items))}catch{}S(!0);try{const a=await tt(de,n?{address:n.address,identity:n.identity}:void 0);if(a.url){window.location.href=a.url;return}Q("/credits")}catch(a){try{sessionStorage.removeItem(re)}catch{}O(a,{flow:"cart_buy_credits"}),g({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{S(!1)}}}const Qe=j.useRef(!1);j.useEffect(()=>{if(!n||Qe.current||!Ra("cart-checkout"))return;Qe.current=!0;const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[n]);const ze=j.useRef(!1);j.useEffect(()=>{if(!(W!=null&&W.resumeCheckout)||ze.current)return;ze.current=!0,D.current=W.creditsAdded??null;try{const s=sessionStorage.getItem(re);if(s){sessionStorage.removeItem(re);const i=JSON.parse(s);Array.isArray(i)&&i.length&&F(i)}}catch{}y.invalidateQueries({queryKey:["usd-balance"]});const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[W==null?void 0:W.resumeCheckout]);const R=aa||(u==null?void 0:u.phase)==="processing";return c.length===0&&!u?e.jsx("div",{className:"checkout checkout--empty",children:e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("section",{className:"checkout__panel cart-empty","data-testid":"cart-empty",children:[e.jsx(A,{name:"cart-plus",size:110,className:"cart-empty__icon"}),e.jsxs("div",{className:"cart-empty__text",children:[e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"cart-empty__body",children:t("cart.empty.body")})]}),e.jsx(te,{className:"cart-empty__cta",to:"/assets",children:t("cart.empty.cta")})]})]})}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("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:()=>Q(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(A,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:sa})}),Ze?e.jsxs("button",{className:"checkout__fitting",onClick:()=>E(!0),disabled:R,children:[e.jsx(A,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:c.map(a=>{const s=ca.get(a.id),i=s?s.priceCredits:a.priceCredits,r=!!s&&s.priceCredits!==a.priceCredits,l=!a.tokenId,d=a.quantity,p=typeof a.available=="number"&&d>=a.available,m=i*d,k=!!M[a.id],_=Na(a),h=Ne[a.id],T=!Oe(h),x=h==="sold-out"?t("cart.availability.soldOut"):t("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${T?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(te,{className:"checkout__thumb-link",to:_,state:{item:a,tradeId:a.tradeId},"aria-label":a.name,children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null}):a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.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(te,{className:"checkout__name",to:_,state:{item:a,tradeId:a.tradeId},title:a.name,children:a.name}):e.jsx("div",{className:"checkout__name",title:a.name,children:a.name}),a.creator?e.jsx(wa,{address:a.creator,className:"checkout__creator",linkToProfile:!0}):null,l?e.jsxs("span",{className:"checkout__creator-tag","data-testid":"cart-creator-tag",children:[e.jsx(A,{name:"buy-from-creator",className:"checkout__creator-tag-ico","aria-hidden":!0}),t("cart.creatorTag")]}):null]}),e.jsx("div",{className:"checkout__foot",children:T?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"checkout__unavailable",children:[e.jsx(A,{name:"warning-fill",size:24,className:"checkout__warn","aria-hidden":!0}),x]}),_?e.jsx(te,{className:"checkout__resales",to:_,state:{item:a,tradeId:a.tradeId},children:t("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>N(a.id)),disabled:R||d<=1,"aria-label":t("cart.decreaseQuantity",{name:a.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:d}),e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>C(a.id)),disabled:R||p,"aria-label":t("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(K,{className:"checkout__price-ico"})," ",m,r?e.jsx("span",{className:"checkout__price-was",children:a.priceCredits*d}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${k?" is-on":""}`,onClick:()=>ie(a),"aria-label":k?t("cart.removeFromFavorites",{name:a.name}):t("cart.addToFavorites",{name:a.name}),title:k?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(A,{name:k?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>ee(()=>o(a.id)),disabled:R,"aria-label":t("cart.remove",{name:a.name}),title:t("cart.removeTitle"),children:e.jsx(A,{name:"trash",size:24})})]})]},a.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>ee(I),disabled:R,children:t("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:t("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:t("cart.totalItems",{count:na})}),e.jsxs("span",{className:"checkout__total-side",children:[e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(K,{className:"checkout__total-ico"})," ",Me]}),Ae&&(V??0n)>0n?e.jsx("span",{className:"checkout__total-rate","data-testid":"cart-mana-rate",children:Ae}):null]})]}),Z.options.length>0||Z.manaShortfall?e.jsx(Ye,{options:Z.options,totalCents:X,shortfall:Z.manaShortfall,creditsLabel:w?t("marketCheckout.confirmPurchase"):t("cart.buyWithCredits"),busy:R||he,onPay:a=>void(w?Ke():z(a))}):e.jsx("button",{className:"checkout__cta",onClick:()=>void(w?Ke():z()),disabled:R||he,children:R?t("cart.working"):w?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),he?e.jsx("p",{className:"muted checkout__msg",children:t("cart.allUnavailable")}):null,n?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),w?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,Ce?e.jsx("p",{className:"muted checkout__msg",children:Ce}):null,e.jsx(ct,{message:ea,className:"checkout__msg"})]})]})]})]}),Se.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Ta,{title:t("cart.youMightAlsoLike"),items:Se})}):null,ye&&n?e.jsx(Fa,{auth:ye.auth,signer:n.signer,title:t("authorizeStep.manaTitle"),name:t("authorizeStep.manaName"),reason:t("authorizeStep.manaReason"),icon:e.jsx("img",{src:Ea,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:a}=ye;ae(null),a()},onCancel:()=>ae(null),onClose:()=>ae(null)}):null,u?e.jsx(ot,{phase:u.phase,balanceCredits:Y,onClose:oa,stage:u.phase==="processing"?u.stage:void 0,step:u.phase==="processing"?u.step:void 0,total:u.phase==="processing"?u.total:void 0,isSelfCustody:Ma(n==null?void 0:n.providerType),options:u.phase==="choose"?ua(u).options:void 0,onPay:ha,totalCents:u.phase==="choose"?u.totalCents:void 0,totalManaWei:u.phase==="choose"?u.manaWei:void 0,totalCredits:u.phase==="choose"?xe(u.lines):void 0,lines:u.phase==="nofunds"?u.lines:void 0,shortfallCredits:u.phase==="nofunds"?u.shortfall:void 0,packs:H,selectedPack:de,onSelectPack:ke,onBuyPacks:()=>void ma(),message:u.phase==="error"?u.message:void 0,onRetry:()=>void z()}):null]})}export{It as Cart};
@@ -1,4 +1,4 @@
1
- import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D,R}from"./index-TmxHL85j.js";import{r as W,j as v}from"./react-BW1xvPTF.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=R(P||(P=l`
1
+ import{X as N,Y as U,Z as w,$ as z,a0 as o,a1 as E,a2 as c,a3 as I,a4 as g,a5 as D,S as M}from"./index-CE-8j9dT.js";import{r as F,j as v}from"./react-BW1xvPTF.js";function K(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const a=44,Z=M(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -6,7 +6,7 @@ import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D
6
6
  100% {
7
7
  transform: rotate(360deg);
8
8
  }
9
- `)),Z=R(S||(S=l`
9
+ `)),B=M(S||(S=l`
10
10
  0% {
11
11
  stroke-dasharray: 1px, 200px;
12
12
  stroke-dashoffset: 0;
@@ -21,8 +21,8 @@ import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D
21
21
  stroke-dasharray: 100px, 200px;
22
22
  stroke-dashoffset: -125px;
23
23
  }
24
- `)),B=r=>{const{classes:e,variant:s,color:a,disableShrink:d}=r,u={root:["root",s,`color${c(a)}`],svg:["svg"],circle:["circle",`circle${c(s)}`,d&&"circleDisableShrink"]};return I(u,F,e)},G=g("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.root,e[s.variant],e[`color${c(s.color)}`]]}})(({ownerState:r,theme:e})=>o({display:"inline-block"},r.variant==="determinate"&&{transition:e.transitions.create("transform")},r.color!=="inherit"&&{color:(e.vars||e).palette[r.color].main}),({ownerState:r})=>r.variant==="indeterminate"&&D(b||(b=l`
24
+ `)),G=r=>{const{classes:e,variant:s,color:t,disableShrink:d}=r,u={root:["root",s,`color${c(t)}`],svg:["svg"],circle:["circle",`circle${c(s)}`,d&&"circleDisableShrink"]};return I(u,K,e)},L=g("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.root,e[s.variant],e[`color${c(s.color)}`]]}})(({ownerState:r,theme:e})=>o({display:"inline-block"},r.variant==="determinate"&&{transition:e.transitions.create("transform")},r.color!=="inherit"&&{color:(e.vars||e).palette[r.color].main}),({ownerState:r})=>r.variant==="indeterminate"&&D(b||(b=l`
25
25
  animation: ${0} 1.4s linear infinite;
26
- `),V)),L=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),X=g("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${c(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
26
+ `),Z)),V=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),X=g("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${c(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
27
27
  animation: ${0} 1.4s ease-in-out infinite;
28
- `),Z)),A=W.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:M=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,K),n=o({},a,{color:u,disableShrink:M,size:m,thickness:i,value:p,variant:k}),f=B(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(G,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(L,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(X,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{A as C};
28
+ `),B)),A=F.forwardRef(function(e,s){const t=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:R=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=t,j=z(t,W),n=o({},t,{color:u,disableShrink:R,size:m,thickness:i,value:p,variant:k}),f=G(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((a-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(L,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(V,{className:f.svg,ownerState:n,viewBox:`${a/2} ${a/2} ${a} ${a}`,children:v.jsx(X,{className:f.circle,style:h,ownerState:n,cx:a,cy:a,r:(a-i)/2,fill:"none",strokeWidth:i})})}))});export{A as C};
@@ -1,4 +1,4 @@
1
- import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{K as N,s as v,ay as Y,az as E,I as Z,t,m as V,J as W,n as X,x as ee,M as ae,aA as te,e as re,aB as se}from"./index-TmxHL85j.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-DE3QnCpW.js";import{u as de}from"./useStore-CV_90SkB.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-BI9AXlDF.js";import{L as xe}from"./LoadMore-DTUpuDyu.js";import{u as he}from"./useInfiniteGrid-pff93KiW.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
1
+ import{j as e,r as p,d as Q,u as Y}from"./react-BW1xvPTF.js";import{L as N,s as v,aB as Z,aC as E,I as J,t,n as V,K as W,o as X,y as ee,N as ae,aD as te,g as re,aE as se}from"./index-CE-8j9dT.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-CB1x49ld.js";import{u as de}from"./useStore-DCT-CgMe.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-DhS9aD1g.js";import{L as xe}from"./LoadMore-BekgL6OE.js";import{u as he}from"./useInfiniteGrid-7tlbDRJY.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
2
2
  position: relative;
3
3
  border-radius: ${N.radius.card};
4
4
  overflow: hidden;
@@ -42,4 +42,4 @@ import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{K as N,s as
42
42
  padding: 24px 16px;
43
43
  font-size: 26px;
44
44
  }
45
- `;function ye({name:r,creator:a}){const{data:i}=de(a),n=(i==null?void 0:i.cover)||ie;return e.jsxs(be,{"data-testid":"collection-hero","aria-label":r,children:[e.jsxs(ve,{children:[e.jsx(je,{src:n,alt:"",loading:"eager"}),e.jsx(fe,{"aria-hidden":!0})]}),e.jsx(Ne,{"data-testid":"collection-hero-title",children:r})]})}function _e({address:r}){var h,c;const{data:a}=Y(r),[i,n]=p.useState(!1);if(!r)return null;const l=(a==null?void 0:a.name)||E(r),u=(c=(h=a==null?void 0:a.avatar)==null?void 0:h.snapshots)==null?void 0:c.face256,g=`${V.profileUrl}/${r}`,x=ce(ne({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));async function d(){try{await navigator.clipboard.writeText(r),n(!0),window.setTimeout(()=>n(!1),1500)}catch(j){W(j,{flow:"copy_creator_address"})}}return e.jsxs("div",{className:"creator-card","data-testid":"creator-card",children:[u?e.jsx("img",{className:"creator-card__ava",src:u,alt:"",loading:"eager",style:{backgroundColor:x}}):e.jsx("span",{className:"creator-card__ava creator-card__ava--ph","aria-hidden":!0,style:{backgroundColor:x}}),e.jsx("h2",{className:"creator-card__name",title:l,children:l}),e.jsxs("button",{type:"button",className:"creator-card__account",onClick:()=>void d(),title:i?t("collection.copied"):t("collection.copyAddress"),"aria-label":i?t("collection.copied"):t("collection.copyAddress"),children:[e.jsx("span",{className:"creator-card__account-text",children:E(r)}),e.jsx(Z,{name:"copy",size:16})]}),e.jsx("a",{className:"creator-card__view","data-testid":"creator-card-view",href:g,target:"_blank",rel:"noopener noreferrer",children:t("collection.viewProfile")})]})}const Ce=48;function Ie(){var T;const{contractAddress:r}=O(),a=Q(),[i,n]=p.useState("wearable"),[l,u]=p.useState(null),[g,x]=p.useState([]),[d,h]=p.useState(""),[c,j]=p.useState(""),[_,$]=p.useState("newest"),C=d&&!Number.isNaN(Number(d))?Number(d):void 0,w=c&&!Number.isNaN(Number(c))?Number(c):void 0,z=l?ge[l]:void 0,B=(F.find(s=>s.key===_)??F[0]).server,S={category:i,rarities:g.length?g:void 0,wearableCategories:z,minPriceCredits:C,maxPriceCredits:w,sortBy:B},{items:b,total:I,isLoading:f,error:A,hasNextPage:L,isFetchingNextPage:P,fetchNextPage:U}=he(["collection-page",r,S],s=>te(r,{...S,first:Ce,skip:s}),{enabled:!!r}),{data:o}=X({queryKey:["collection-meta",r],queryFn:()=>se(r),enabled:!!r,staleTime:5*6e4}),k=(o==null?void 0:o.name)||t("collection.fallbackTitle");ee({title:o==null?void 0:o.name,description:o!=null&&o.name?t("seo.collection.description",{name:o.name}):void 0});const M=(o==null?void 0:o.creator)||((T=b[0])==null?void 0:T.creator);function K(s){n(s),u(null)}function q(s){x(m=>m.includes(s)?m.filter(J=>J!==s):[...m,s])}function G(){n("wearable"),u(null),x([]),h(""),j("")}const y=!!(C||w),H=y?`${d||"0"}–${c||"∞"}`:t("filter.price"),D=i!=="wearable"||!!l||g.length>0||y;return e.jsxs("div",{className:"collection-page","data-testid":"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":t("collection.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:t("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:k})]}),e.jsx(ye,{name:k,creator:M}),e.jsxs("div",{className:"browse browse--sidebar collection-page__browse","data-testid":"browse",children:[e.jsxs("aside",{className:"browse__sidebar","data-testid":"browse-sidebar",children:[e.jsx(_e,{address:M}),e.jsx(me,{category:i,subCategory:l,onCategory:K,onSub:u,title:t("collection.category"),flat:!0})]}),e.jsxs("div",{className:"browse__main",children:[!f&&b.length>0?e.jsx(le,{items:b,source:"collection"}):null,e.jsx(pe,{rarities:g,onToggleRarity:q,sort:_,onSort:$,total:I,loading:f,anyActive:D,onClear:G,renderTrailing:s=>e.jsx(ue,{panelKey:"price",label:H,active:y,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMin"),placeholder:t("collection.priceMinPlaceholder"),value:d,onChange:m=>h(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMax"),placeholder:t("collection.priceMaxPlaceholder"),value:c,onChange:m=>j(m.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:t("collection.priceHint",{currency:re.name})})]})})}),A?e.jsx(oe,{message:t("collection.error")}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:f?e.jsx(R,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>e.jsx(ae,{item:s},s.id)),P?e.jsx(R,{count:6}):null]})}),e.jsx(xe,{hasNextPage:L,isFetching:P,onLoadMore:()=>void U()}),!f&&!A&&b.length===0?e.jsx("p",{className:"muted",children:t("collection.empty")}):null]})]})]})}export{Ie as Collection,Ie as default};
45
+ `;function ye({name:r,creator:a}){const{data:i}=de(a),n=(i==null?void 0:i.cover)||ie;return e.jsxs(be,{"data-testid":"collection-hero","aria-label":r,children:[e.jsxs(ve,{children:[e.jsx(je,{src:n,alt:"",loading:"eager"}),e.jsx(fe,{"aria-hidden":!0})]}),e.jsx(Ne,{"data-testid":"collection-hero-title",children:r})]})}function Ce({address:r}){var h,c;const{data:a}=Z(r),[i,n]=p.useState(!1);if(!r)return null;const l=(a==null?void 0:a.name)||E(r),u=(c=(h=a==null?void 0:a.avatar)==null?void 0:h.snapshots)==null?void 0:c.face256,g=`${V.profileUrl}/${r}`,x=ce(ne({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));async function d(){try{await navigator.clipboard.writeText(r),n(!0),window.setTimeout(()=>n(!1),1500)}catch(j){W(j,{flow:"copy_creator_address"})}}return e.jsxs("div",{className:"creator-card","data-testid":"creator-card",children:[u?e.jsx("img",{className:"creator-card__ava",src:u,alt:"",loading:"eager",style:{backgroundColor:x}}):e.jsx("span",{className:"creator-card__ava creator-card__ava--ph","aria-hidden":!0,style:{backgroundColor:x}}),e.jsx("h2",{className:"creator-card__name",title:l,children:l}),e.jsxs("button",{type:"button",className:"creator-card__account",onClick:()=>void d(),title:i?t("collection.copied"):t("collection.copyAddress"),"aria-label":i?t("collection.copied"):t("collection.copyAddress"),children:[e.jsx("span",{className:"creator-card__account-text",children:E(r)}),e.jsx(J,{name:"copy",size:16})]}),e.jsx("a",{className:"creator-card__view","data-testid":"creator-card-view",href:g,target:"_blank",rel:"noopener noreferrer",children:t("collection.viewProfile")})]})}const _e=48;function Le(){var T;const{contractAddress:r}=Q(),a=Y(),[i,n]=p.useState("wearable"),[l,u]=p.useState(null),[g,x]=p.useState([]),[d,h]=p.useState(""),[c,j]=p.useState(""),[C,$]=p.useState("newest"),_=d&&!Number.isNaN(Number(d))?Number(d):void 0,w=c&&!Number.isNaN(Number(c))?Number(c):void 0,B=l?ge[l]:void 0,I=(F.find(s=>s.key===C)??F[0]).server,S={category:i,rarities:g.length?g:void 0,wearableCategories:B,minPriceCredits:_,maxPriceCredits:w,sortBy:I},{items:b,total:L,isLoading:f,error:A,hasNextPage:z,isFetchingNextPage:P,fetchNextPage:U}=he(["collection-page",r,S],s=>te(r,{...S,first:_e,skip:s}),{enabled:!!r}),{data:o}=X({queryKey:["collection-meta",r],queryFn:()=>se(r),enabled:!!r,staleTime:5*6e4}),k=(o==null?void 0:o.name)||t("collection.fallbackTitle");ee({title:o==null?void 0:o.name,description:o!=null&&o.name?t("seo.collection.description",{name:o.name}):void 0});const M=(o==null?void 0:o.creator)||((T=b[0])==null?void 0:T.creator);function K(s){n(s),u(null)}function q(s){x(m=>m.includes(s)?m.filter(O=>O!==s):[...m,s])}function D(){n("wearable"),u(null),x([]),h(""),j("")}const y=!!(_||w),G=y?`${d||"0"}–${c||"∞"}`:t("filter.price"),H=i!=="wearable"||!!l||g.length>0||y;return e.jsxs("div",{className:"collection-page","data-testid":"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":t("collection.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:t("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:k})]}),e.jsx(ye,{name:k,creator:M}),e.jsxs("div",{className:"browse browse--sidebar collection-page__browse","data-testid":"browse",children:[e.jsxs("aside",{className:"browse__sidebar","data-testid":"browse-sidebar",children:[e.jsx(Ce,{address:M}),e.jsx(me,{category:i,subCategory:l,onCategory:K,onSub:u,title:t("collection.category"),flat:!0})]}),e.jsxs("div",{className:"browse__main",children:[!f&&b.length>0?e.jsx(le,{items:b,source:"collection"}):null,e.jsx(pe,{rarities:g,onToggleRarity:q,sort:C,onSort:$,total:L,loading:f,anyActive:H,onClear:D,renderTrailing:s=>e.jsx(ue,{panelKey:"price",label:G,active:y,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMin"),placeholder:t("collection.priceMinPlaceholder"),value:d,onChange:m=>h(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMax"),placeholder:t("collection.priceMaxPlaceholder"),value:c,onChange:m=>j(m.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:t("collection.priceHint",{currency:re.name})})]})})}),A?e.jsx(oe,{message:t("collection.error")}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:f?e.jsx(R,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>e.jsx(ae,{item:s},s.id)),P?e.jsx(R,{count:6}):null]})}),e.jsx(xe,{hasNextPage:z,isFetching:P,onLoadMore:()=>void U()}),!f&&!A&&b.length===0?e.jsx("p",{className:"muted",children:t("collection.empty")}):null]})]})]})}export{Le as Collection,Le as default};
@@ -1,4 +1,4 @@
1
- import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,K as s,t as f,C as R,A as j,aO as C,e as Q,R as D,I as K,J as O,o as $,r as _,q as U,aP as B,M as G}from"./index-TmxHL85j.js";import{s as H,i as P,A as T,a as L,r as J,m as V,e as Y}from"./authorizations-Ds7LRLV0.js";import{i as Z}from"./errors-CG6pp58g.js";import{E as q}from"./ErrorNotice-BG40E5Ff.js";import{b as X}from"./buy-DnSS_Kop.js";import{d as ee,f as te}from"./trade-encoding-CcRCeIpG.js";import{s as ne,M as ae,E as re}from"./sendMetaTransaction-7YAoB-pL.js";import{I as se,C as oe}from"./ethers-CtVvB8eG.js";const I="shop:resume_after_signin",ie=900*1e3;function Oe(n){try{sessionStorage.setItem(I,JSON.stringify({...n,at:Date.now()}))}catch{}}function Ue(n){let t;try{t=sessionStorage.getItem(I)}catch{return null}if(!t)return null;try{sessionStorage.removeItem(I)}catch{}let a;try{a=JSON.parse(t)}catch{return null}return!a||a.type!==n||typeof a.at!="number"||Date.now()-a.at>ie?null:a.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:a.path}}function ce(n,t){return(n+t-1n)/t}function le(n,t,a){return n<=0||t<=0?0n:n>=t?a:ce(a*BigInt(n),BigInt(t))}function Ge(n){var m,x,y;const t=Number.isFinite(n.priceCents)?Math.max(0,Math.trunc(n.priceCents)):0,a=Number.isFinite(n.balanceCents)?Math.max(0,Math.trunc(n.balanceCents)):0,r=n.priceManaWei>0n?n.priceManaWei:0n,i=n.manaBalanceWei>0n?n.manaBalanceWei:0n;if(t<=0)return{options:[],preferred:null,manaShortfall:null};const o=[];if(a>=t&&o.push({method:"credits",creditsCents:t,manaWei:0n}),r>0n&&a>0&&a<t){const c=t-a,g=le(c,t,r);i>=g&&o.push({method:"combined",creditsCents:a,manaWei:g})}r>0n&&i>=r&&o.push({method:"mana",creditsCents:0,manaWei:r});const d=((m=o.find(c=>c.method==="credits"))==null?void 0:m.method)??((x=o.find(c=>c.method==="combined"))==null?void 0:x.method)??((y=o.find(c=>c.method==="mana"))==null?void 0:y.method)??null,b=!o.some(c=>c.method==="mana"||c.method==="combined")&&r>0n&&i>0n?{manaWei:i,manaCents:de(i,t,r),priceCents:t}:null;return{options:o,preferred:d,manaShortfall:b}}function de(n,t,a){return Number(n*BigInt(t)/a)}function He(n,t){let a=Number.isFinite(t)?Math.max(0,Math.trunc(t)):0;return n.map(r=>{const i=Number.isFinite(r)?Math.max(0,Math.trunc(r)):0,o=Math.min(i,a);return a-=o,o})}function k(n){return Number.isFinite(n)?Math.max(0,n)/10:0}function Je(n,t){return n.options.find(a=>a.method===t)??null}function Ve(n,t){if(!Number.isFinite(n)||n<=0||t<=0n)return null;const a=n/10;return Number(t)/1e18/a}const N="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ue=l.div`
1
+ import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,L as s,t as f,C as R,D as j,aS as C,g as Q,S as D,I as T,K as O,q as $,v as _,r as U,aT as L,N as G}from"./index-CE-8j9dT.js";import{s as H,i as K,A as P,a as B,r as V,m as Y,e as Z}from"./authorizations-BxQ2tMzo.js";import{i as q}from"./errors-CRgGE21K.js";import{E as J}from"./ErrorNotice-BG40E5Ff.js";import{b as X}from"./buy-C-oTH9gd.js";import{d as ee,f as te}from"./trade-encoding-BjnvL03O.js";import{s as ne,M as ae,E as re}from"./sendMetaTransaction-BMgjMfxP.js";import{I as se,C as ie}from"./ethers-CtVvB8eG.js";const I="shop:resume_after_signin",oe=900*1e3;function Oe(n){try{sessionStorage.setItem(I,JSON.stringify({...n,at:Date.now()}))}catch{}}function Ue(n){let t;try{t=sessionStorage.getItem(I)}catch{return null}if(!t)return null;try{sessionStorage.removeItem(I)}catch{}let a;try{a=JSON.parse(t)}catch{return null}return!a||a.type!==n||typeof a.at!="number"||Date.now()-a.at>oe?null:a.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:a.path}}function ce(n,t){return(n+t-1n)/t}function le(n,t,a){return n<=0||t<=0?0n:n>=t?a:ce(a*BigInt(n),BigInt(t))}function Ge(n){var m,x,y;const t=Number.isFinite(n.priceCents)?Math.max(0,Math.trunc(n.priceCents)):0,a=Number.isFinite(n.balanceCents)?Math.max(0,Math.trunc(n.balanceCents)):0,r=n.priceManaWei>0n?n.priceManaWei:0n,o=n.manaBalanceWei>0n?n.manaBalanceWei:0n;if(t<=0)return{options:[],preferred:null,manaShortfall:null};const i=[];if(a>=t&&i.push({method:"credits",creditsCents:t,manaWei:0n}),r>0n&&a>0&&a<t){const c=t-a,g=le(c,t,r);o>=g&&i.push({method:"combined",creditsCents:a,manaWei:g})}r>0n&&o>=r&&i.push({method:"mana",creditsCents:0,manaWei:r});const d=((m=i.find(c=>c.method==="credits"))==null?void 0:m.method)??((x=i.find(c=>c.method==="combined"))==null?void 0:x.method)??((y=i.find(c=>c.method==="mana"))==null?void 0:y.method)??null,b=!i.some(c=>c.method==="mana"||c.method==="combined")&&r>0n&&o>0n?{manaWei:o,manaCents:de(o,t,r),priceCents:t}:null;return{options:i,preferred:d,manaShortfall:b}}function de(n,t,a){return Number(n*BigInt(t)/a)}function He(n,t){let a=Number.isFinite(t)?Math.max(0,Math.trunc(t)):0;return n.map(r=>{const o=Number.isFinite(r)?Math.max(0,Math.trunc(r)):0,i=Math.min(o,a);return a-=i,i})}function k(n){return Number.isFinite(n)?Math.max(0,n)/10:0}function Ve(n,t){return n.options.find(a=>a.method===t)??null}function Ye(n,t){if(!Number.isFinite(n)||n<=0||t<=0n)return null;const a=n/10;return Number(t)/1e18/a}const A="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ue=l.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -109,7 +109,7 @@ import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,K as s,t as f,C as
109
109
  line-height: 1.4;
110
110
  color: ${s.colors.muted};
111
111
  text-align: center;
112
- `;function Ye({options:n,totalCents:t,onPay:a,busy:r=!1,rateNote:i,creditsLabel:o,shortfall:d}){return e.jsxs(ue,{children:[n.map(u=>u.method==="credits"?e.jsxs(he,{type:"button","data-testid":"pay-with-credits",onClick:()=>a("credits"),disabled:r,children:[e.jsx("span",{children:o??f("buyModal.buy")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:j(k(u.creditsCents))})]})]},"credits"):u.method==="mana"?e.jsxs(W,{type:"button","data-testid":"pay-with-mana",onClick:()=>a("mana"),disabled:r,children:[e.jsx("span",{children:f("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:N,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)})]})]},"mana"):e.jsxs(W,{type:"button","data-testid":"pay-with-combined",onClick:()=>a("combined"),disabled:r,children:[e.jsx("span",{children:f("buyModal.buyWith")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:j(k(u.creditsCents))}),e.jsx(fe,{children:"+"}),e.jsx(z,{children:e.jsx("img",{src:N,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)}),e.jsx(pe,{children:"MANA"})]})]},"combined")),d?e.jsxs(e.Fragment,{children:[e.jsxs(W,{type:"button","data-testid":"pay-with-mana-disabled",disabled:!0,children:[e.jsx("span",{children:f("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:N,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(d.manaWei)})]})]},"mana-short"),e.jsx(me,{"data-testid":"mana-shortfall-note",children:f("buyModal.manaWorth",{mana:C(d.manaWei),credits:j(k(d.manaCents)),price:j(k(d.priceCents)),currency:Q.name})})]}):null,i?e.jsx(xe,{"data-testid":"mana-rate-note",children:i}):null,e.jsx("span",{hidden:!0,"data-testid":"pay-total-cents",children:t})]})}function Ze(n,t){const a=(r,...i)=>void n.invalidateQueries({queryKey:t?[r,...i]:[r]});n.invalidateQueries({queryKey:["usd-balance"]}),n.invalidateQueries({queryKey:["detail-trade"]}),n.invalidateQueries({queryKey:["shop-item"]}),a("owned-token",t==null?void 0:t.contractAddress,t==null?void 0:t.tokenId),a("public-token",t==null?void 0:t.contractAddress,t==null?void 0:t.tokenId),a("item-resales",t==null?void 0:t.contractAddress,t==null?void 0:t.itemId),n.invalidateQueries({queryKey:["shop-items"]}),n.invalidateQueries({queryKey:["catalog-items"]}),n.invalidateQueries({queryKey:["overview-listings"]}),n.invalidateQueries({queryKey:["upsell-listings"]}),n.invalidateQueries({queryKey:["my-assets"]}),n.invalidateQueries({queryKey:["purchases"]}),n.invalidateQueries({queryKey:["owned-item-count"]})}const ge=D`
112
+ `;function Ze({options:n,totalCents:t,onPay:a,busy:r=!1,rateNote:o,creditsLabel:i,shortfall:d}){return e.jsxs(ue,{children:[n.map(u=>u.method==="credits"?e.jsxs(he,{type:"button","data-testid":"pay-with-credits",onClick:()=>a("credits"),disabled:r,children:[e.jsx("span",{children:i??f("buyModal.buy")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:j(k(u.creditsCents))})]})]},"credits"):u.method==="mana"?e.jsxs(W,{type:"button","data-testid":"pay-with-mana",onClick:()=>a("mana"),disabled:r,children:[e.jsx("span",{children:f("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:A,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)})]})]},"mana"):e.jsxs(W,{type:"button","data-testid":"pay-with-combined",onClick:()=>a("combined"),disabled:r,children:[e.jsx("span",{children:f("buyModal.buyWith")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:j(k(u.creditsCents))}),e.jsx(fe,{children:"+"}),e.jsx(z,{children:e.jsx("img",{src:A,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)}),e.jsx(pe,{children:"MANA"})]})]},"combined")),d?e.jsxs(e.Fragment,{children:[e.jsxs(W,{type:"button","data-testid":"pay-with-mana-disabled",disabled:!0,children:[e.jsx("span",{children:f("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:A,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(d.manaWei)})]})]},"mana-short"),e.jsx(me,{"data-testid":"mana-shortfall-note",children:f("buyModal.manaWorth",{mana:C(d.manaWei),credits:j(k(d.manaCents)),price:j(k(d.priceCents)),currency:Q.name})})]}):null,o?e.jsx(xe,{"data-testid":"mana-rate-note",children:o}):null,e.jsx("span",{hidden:!0,"data-testid":"pay-total-cents",children:t})]})}function qe(n,t){const a=(r,...o)=>void n.invalidateQueries({queryKey:t?[r,...o]:[r]});n.invalidateQueries({queryKey:["usd-balance"]}),n.invalidateQueries({queryKey:["detail-trade"]}),n.invalidateQueries({queryKey:["shop-item"]}),a("owned-token",t==null?void 0:t.contractAddress,t==null?void 0:t.tokenId),a("public-token",t==null?void 0:t.contractAddress,t==null?void 0:t.tokenId),a("item-resales",t==null?void 0:t.contractAddress,t==null?void 0:t.itemId),n.invalidateQueries({queryKey:["shop-items"]}),n.invalidateQueries({queryKey:["catalog-items"]}),n.invalidateQueries({queryKey:["overview-listings"]}),n.invalidateQueries({queryKey:["upsell-listings"]}),n.invalidateQueries({queryKey:["my-assets"]}),n.invalidateQueries({queryKey:["purchases"]}),n.invalidateQueries({queryKey:["owned-item-count"]})}const ge=D`
113
113
  to { transform: rotate(360deg); }
114
114
  `,be=l.div`
115
115
  position: fixed;
@@ -206,11 +206,11 @@ import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,K as s,t as f,C as
206
206
  `,$e=l.span`
207
207
  font-weight: 700;
208
208
  color: ${s.colors.text};
209
- `,Ae=l.span`
209
+ `,Ne=l.span`
210
210
  font-size: 13px;
211
211
  line-height: 1.45;
212
212
  color: ${s.colors.muted};
213
- `,Ne=l.p`
213
+ `,Ae=l.p`
214
214
  margin: 0;
215
215
  font-size: 12px;
216
216
  line-height: 1.5;
@@ -289,4 +289,4 @@ import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,K as s,t as f,C as
289
289
  @media (prefers-reduced-motion: reduce) {
290
290
  animation: none;
291
291
  }
292
- `;function qe({auth:n,signer:t,title:a,reason:r,name:i,image:o,icon:d,onAuthorized:u,onCancel:b,onClose:m}){const[x,y]=w.useState(!1),[c,g]=w.useState(null);async function v(){y(!0),g(null);try{await H({auth:n,signer:t,active:!0}),u()}catch(h){Z(h)?g(f("authorizeStep.errorRejected")):(O(h,{flow:"authorize_step",kind:n.kind}),g(f("authorizeStep.errorGeneric"))),y(!1)}}return e.jsx(be,{onClick:x?void 0:m,role:"presentation",children:e.jsxs(ye,{onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":a,children:[e.jsxs(we,{children:[e.jsx(ve,{children:a}),e.jsx(je,{onClick:m,disabled:x,"aria-label":f("authorizeStep.close"),children:e.jsx(K,{name:"close",className:"ico"})})]}),e.jsxs(Ce,{"data-testid":"authorize-step-row",children:[e.jsx(ke,{children:o?e.jsx("img",{src:o,alt:""}):d}),e.jsxs(Me,{children:[e.jsx($e,{title:i,children:i}),e.jsx(Ae,{children:r})]})]}),e.jsx(Ne,{children:f("authorizeStep.note")}),e.jsx(q,{message:c}),e.jsxs(We,{children:[e.jsx(ze,{type:"button",onClick:b,disabled:x,children:f("authorizeStep.cancel")}),e.jsx(_e,{type:"button","data-testid":"authorize-step-action",onClick:()=>void v(),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{"aria-hidden":!0}),f("authorizeStep.authorizing")]}):f("authorizeStep.authorize")})]})]})})}async function Xe(n){const[t]=await Se({...n,trades:[n.trade]});return t}async function Se(n){const{trades:t,buyer:a,signer:r,onSigned:i}=n;if(t.length===0)throw new Error("No items to buy");const o=new Map;for(const u of t){const b=`${u.chainId}:${u.contract.toLowerCase()}`,m=o.get(b);m?m.push(u):o.set(b,[u])}const d=[];for(const u of o.values())d.push(await Ee({trades:u,buyer:a,signer:r,onSigned:i}));return d}async function Ee(n){const{trades:t,buyer:a,signer:r,onSigned:i}=n,o=t[0],d=$(U(o.contract),o.chainId),u=$(_.MANAToken,o.chainId);await P({auth:{kind:T.Allowance,contractAddress:u.address,spenderAddress:d.address,chainId:o.chainId},signer:r});const b=t.map(c=>ee(c,a));if(L.enabled)try{const c=new se(d.abi).encodeFunctionData("accept",[b]),g=J(),v=V(r.provider,g),h=await ne(v,g,c,d,{serverURL:L.relayerUrl});return i==null||i(),await g.waitForTransaction(h,1,12e4),h}catch(c){if(c instanceof ae&&c.code===re.USER_DENIED)throw c;console.warn("[buyWithMana] gasless meta-tx failed, falling back to a direct tx:",c)}await Y(r.provider,o.chainId);const x=await new oe(d.address,d.abi,r).accept(b,te(o.chainId));return i==null||i(),(await x.wait()).transactionHash}async function et(n){const{trade:t,buyer:a,signer:r,credits:i,manaGapWei:o}=n;if(i.length===0)throw new Error("No credits to spend — use buyWithMana for a MANA-only purchase");if(o<=0n)throw new Error("No MANA gap to cover — use buyWithCredits for a credits-only purchase");const d=$(_.MANAToken,t.chainId),u=$(_.CreditsManager,t.chainId);await P({auth:{kind:T.Allowance,contractAddress:d.address,spenderAddress:u.address,chainId:t.chainId},signer:r});const m=(i.reduce((x,y)=>x+BigInt(y.availableAmount),0n)+o).toString();return X({trade:t,buyer:a,signer:r,credits:i,maxCreditedValue:m})}function tt({className:n}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function nt({title:n,items:t,onViewAll:a}){const r=w.useRef(null),[i,o]=w.useState(1),[d,u]=w.useState(0),[b,m]=w.useState(!0),[x,y]=w.useState(!1),c=w.useCallback(()=>{const h=r.current;if(!h)return;const{scrollLeft:p,scrollWidth:S,clientWidth:A}=h,E=Math.max(1,Math.ceil(S/A));o(E),u(Math.min(E-1,Math.round(p/A))),m(p<=1),y(p+A>=S-1)},[]);if(w.useEffect(()=>{c();const h=r.current;if(h)return h.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{h.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,t.length]),t.length===0)return null;function g(h){const p=r.current;p&&p.scrollBy({left:h*p.clientWidth,behavior:"smooth"})}function v(h){const p=r.current;p&&p.scrollTo({left:h*p.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:n}),a?e.jsxs("button",{className:"collection-carousel__viewall",onClick:a,children:[f("collectionCarousel.viewAll"),e.jsx(K,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>g(-1),"aria-label":f("collectionCarousel.scrollLeft"),disabled:b,children:e.jsx("img",{src:B,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:r,children:t.map(h=>e.jsx(G,{item:h},h.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>g(1),"aria-label":f("collectionCarousel.scrollRight"),disabled:x,children:e.jsx("img",{src:B,alt:"","aria-hidden":!0})})]}),i>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":f("collectionCarousel.pages"),children:Array.from({length:i}).map((h,p)=>e.jsx("button",{className:`collection-carousel__dot${p===d?" is-active":""}`,"aria-label":f("collectionCarousel.goToPage",{page:p+1}),"aria-current":p===d?"true":void 0,onClick:()=>v(p)},p))}):null]})}export{qe as A,nt as C,Ye as P,tt as W,N as a,Se as b,Ge as c,He as d,le as e,k as f,Xe as g,Je as h,Ze as i,et as j,Ve as m,Oe as s,Ue as t};
292
+ `;function Je({auth:n,signer:t,title:a,reason:r,name:o,image:i,icon:d,onAuthorized:u,onCancel:b,onClose:m}){const[x,y]=w.useState(!1),[c,g]=w.useState(null);async function v(){y(!0),g(null);try{await H({auth:n,signer:t,active:!0}),u()}catch(h){q(h)?g(f("authorizeStep.errorRejected")):(O(h,{flow:"authorize_step",kind:n.kind}),g(f("authorizeStep.errorGeneric"))),y(!1)}}return e.jsx(be,{onClick:x?void 0:m,role:"presentation",children:e.jsxs(ye,{onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":a,children:[e.jsxs(we,{children:[e.jsx(ve,{children:a}),e.jsx(je,{onClick:m,disabled:x,"aria-label":f("authorizeStep.close"),children:e.jsx(T,{name:"close",className:"ico"})})]}),e.jsxs(Ce,{"data-testid":"authorize-step-row",children:[e.jsx(ke,{children:i?e.jsx("img",{src:i,alt:""}):d}),e.jsxs(Me,{children:[e.jsx($e,{title:o,children:o}),e.jsx(Ne,{children:r})]})]}),e.jsx(Ae,{children:f("authorizeStep.note")}),e.jsx(J,{message:c}),e.jsxs(We,{children:[e.jsx(ze,{type:"button",onClick:b,disabled:x,children:f("authorizeStep.cancel")}),e.jsx(_e,{type:"button","data-testid":"authorize-step-action",onClick:()=>void v(),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{"aria-hidden":!0}),f("authorizeStep.authorizing")]}):f("authorizeStep.authorize")})]})]})})}async function Xe(n){const[t]=await Se({...n,trades:[n.trade]});return t}async function Se(n){const{trades:t,buyer:a,signer:r,onSigned:o}=n;if(t.length===0)throw new Error("No items to buy");const i=new Map;for(const u of t){const b=`${u.chainId}:${u.contract.toLowerCase()}`,m=i.get(b);m?m.push(u):i.set(b,[u])}const d=[];for(const u of i.values())d.push(await Ee({trades:u,buyer:a,signer:r,onSigned:o}));return d}async function Ee(n){const{trades:t,buyer:a,signer:r,onSigned:o}=n,i=t[0],d=$(U(i.contract),i.chainId),u=$(_.MANAToken,i.chainId);await K({auth:{kind:P.Allowance,contractAddress:u.address,spenderAddress:d.address,chainId:i.chainId},signer:r});const b=t.map(c=>ee(c,a));if(B.enabled)try{const c=new se(d.abi).encodeFunctionData("accept",[b]),g=V(),v=Y(r.provider,g),h=await ne(v,g,c,d,{serverURL:B.relayerUrl});return o==null||o(),await g.waitForTransaction(h,1,12e4),h}catch(c){if(c instanceof ae&&c.code===re.USER_DENIED)throw c;console.warn("[buyWithMana] gasless meta-tx failed, falling back to a direct tx:",c)}await Z(r.provider,i.chainId);const x=await new ie(d.address,d.abi,r).accept(b,te(i.chainId));return o==null||o(),(await x.wait()).transactionHash}async function et(n){const{trade:t,buyer:a,signer:r,credits:o,manaGapWei:i}=n;if(o.length===0)throw new Error("No credits to spend — use buyWithMana for a MANA-only purchase");if(i<=0n)throw new Error("No MANA gap to cover — use buyWithCredits for a credits-only purchase");const d=$(_.MANAToken,t.chainId),u=$(_.CreditsManager,t.chainId);await K({auth:{kind:P.Allowance,contractAddress:d.address,spenderAddress:u.address,chainId:t.chainId},signer:r});const m=(o.reduce((x,y)=>x+BigInt(y.availableAmount),0n)+i).toString();return X({trade:t,buyer:a,signer:r,credits:o,maxCreditedValue:m})}function tt({className:n}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function nt({title:n,items:t,onViewAll:a}){const r=w.useRef(null),[o,i]=w.useState(1),[d,u]=w.useState(0),[b,m]=w.useState(!0),[x,y]=w.useState(!1),c=w.useCallback(()=>{const h=r.current;if(!h)return;const{scrollLeft:p,scrollWidth:S,clientWidth:N}=h,E=Math.max(1,Math.ceil(S/N));i(E),u(Math.min(E-1,Math.round(p/N))),m(p<=1),y(p+N>=S-1)},[]);if(w.useEffect(()=>{c();const h=r.current;if(h)return h.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{h.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,t.length]),t.length===0)return null;function g(h){const p=r.current;p&&p.scrollBy({left:h*p.clientWidth,behavior:"smooth"})}function v(h){const p=r.current;p&&p.scrollTo({left:h*p.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:n}),a?e.jsxs("button",{className:"collection-carousel__viewall",onClick:a,children:[f("collectionCarousel.viewAll"),e.jsx(T,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>g(-1),"aria-label":f("collectionCarousel.scrollLeft"),disabled:b,children:e.jsx("img",{src:L,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:r,children:t.map(h=>e.jsx(G,{item:h},h.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>g(1),"aria-label":f("collectionCarousel.scrollRight"),disabled:x,children:e.jsx("img",{src:L,alt:"","aria-hidden":!0})})]}),o>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":f("collectionCarousel.pages"),children:Array.from({length:o}).map((h,p)=>e.jsx("button",{className:`collection-carousel__dot${p===d?" is-active":""}`,"aria-label":f("collectionCarousel.goToPage",{page:p+1}),"aria-current":p===d?"true":void 0,onClick:()=>v(p)},p))}):null]})}export{Je as A,nt as C,Ze as P,tt as W,A as a,Se as b,Ge as c,He as d,le as e,k as f,Xe as g,Ve as h,qe as i,et as j,Ye as m,Oe as s,Ue as t};
@@ -0,0 +1 @@
1
+ import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-BW1xvPTF.js";import{aF as oe,aG as ce,A as le,t as a,aH as I,B as ne,aB as D,u as ie,aC as G,I as B,n as de,y as me,N as ue,av as he,aI as ge,g as xe}from"./index-CE-8j9dT.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-CB1x49ld.js";import{u as be,L as fe}from"./useStore-DCT-CgMe.js";import{d as E,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-DhS9aD1g.js";import{L as $}from"./LoadMore-BekgL6OE.js";import{u as R}from"./useInfiniteGrid-7tlbDRJY.js";import{E as T}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ye({address:t,className:r=""}){const o=I(m=>m.followed.includes(t.toLowerCase())),n=I(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||G(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(B,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(B,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function He(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?G(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,H]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,O=i?ke[i]:void 0,z=(E.find(s=>s.key===P)??E[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:O,minPriceCredits:y,maxPriceCredits:S,sortBy:z},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx($,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:H,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx($,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{He as Creator,He as default};
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-CeSRgOaN.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-gxa5wyAJ.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
1
+ import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-oH9nrVqa.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-CLl3y_zB.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};