@dcl/shop 0.1.0-29941568358.commit-de47e56 → 0.1.0-29942574523.commit-573f25e

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 (228) hide show
  1. package/assets/{AnimatedBackground-cMeJUDnS.js → AnimatedBackground-CzCwcFdY.js} +1 -1
  2. package/assets/{Assets-D4bmQvg2.js → Assets-BTdyC00C.js} +15 -15
  3. package/assets/{Assets.styles-JIZQe0rQ.js → Assets.styles-eeqx94WS.js} +6 -6
  4. package/assets/{Authorizations-Bxum5Ckz.js → Authorizations-BZhmfDD4.js} +3 -3
  5. package/assets/Cart-BicSZMzV.js +3 -0
  6. package/assets/{CircularProgress-DVvK_YYJ.js → CircularProgress-BivMeg1W.js} +4 -4
  7. package/assets/{Collection-CCeBHPqN.js → Collection-DQAOAaC9.js} +1 -1
  8. package/assets/{CollectionCarousel-CfEwak3h.js → CollectionCarousel-D_udpdxX.js} +1 -1
  9. package/assets/{ConstantsUtil-CPwpahR3.js → ConstantsUtil-DO6FyoSW.js} +1 -1
  10. package/assets/{ContentClient-DWUTshFt.js → ContentClient-Xp597FfN.js} +1 -1
  11. package/assets/Creator-X75Qvpr4.js +1 -0
  12. package/assets/{CssVarsProvider-CaTQjQty.js → CssVarsProvider-C0ny30E-.js} +3 -3
  13. package/assets/{DeploymentBuilder-BeZK0qfR.js → DeploymentBuilder-Ba-Y42wz.js} +1 -1
  14. package/assets/{ErrorNotice-DDr3KjIH.js → ErrorNotice-BDH9xoG4.js} +1 -1
  15. package/assets/{ExchangeController-ZePEIh3m.js → ExchangeController-D0l6M3tj.js} +1 -1
  16. package/assets/{GetCredits-BcaMNIRG.js → GetCredits-CMdoboQp.js} +1 -1
  17. package/assets/{HelpersUtil-CRTK_83W.js → HelpersUtil-hamZLlhX.js} +1 -1
  18. package/assets/{ImportListings-9YfzHduB.js → ImportListings-BFIpuuBM.js} +1 -1
  19. package/assets/ItemDetail-C0Sm18Me.js +78 -0
  20. package/assets/{LoadMore-BK9c312B.js → LoadMore-BLy9p9ul.js} +1 -1
  21. package/assets/{MarketCheckout-BxM5rUvM.js → MarketCheckout-DSl7Bl-M.js} +2 -2
  22. package/assets/{MyAssets-BA5zCiVR.js → MyAssets-UFPrjPwu.js} +8 -8
  23. package/assets/{MyFavorites-DWjt5m8Z.js → MyFavorites-Dul-WC6l.js} +1 -1
  24. package/assets/{MyPurchases--MUfwO_U.js → MyPurchases-DI0zzNTZ.js} +1 -1
  25. package/assets/{NetworkUtil-CM7JZPbs.js → NetworkUtil-BGlQiKvg.js} +1 -1
  26. package/assets/{NotFound-DVZ9W5Hr.js → NotFound-Bdg_iIpB.js} +1 -1
  27. package/assets/PrimaryListModal-CnlMOkG5.js +1 -0
  28. package/assets/{StoreSettings-CpeZPPkb.js → StoreSettings-2cViRT0c.js} +8 -8
  29. package/assets/Success-D9l7pr2K.js +4 -0
  30. package/assets/{SwapController-BH4rWo6P.js → SwapController-DKBIcDPA.js} +1 -1
  31. package/assets/{Tooltip-zazDSBbm.js → Tooltip-DJ7HtAmB.js} +1 -1
  32. package/assets/{TradeService-IuqYxWb8.js → TradeService-BpWgN8zg.js} +1 -1
  33. package/assets/{W3MFrameProviderSingleton-CFGfbV9-.js → W3MFrameProviderSingleton-B40OWK0h.js} +3 -3
  34. package/assets/{WebCryptoP256-ByM1YcL4.js → WebCryptoP256-Ccr1DsYO.js} +1 -1
  35. package/assets/{authorizations-CsduRV0X.js → authorizations-sU14ILrd.js} +1 -1
  36. package/assets/{basic-BMJtBJ3f.js → basic-DaSuNoEa.js} +1 -1
  37. package/assets/{biconomy-WqxLiteU.js → biconomy-DmmBzkXG.js} +1 -1
  38. package/assets/{browser-7Z6Tx7yC.js → browser-Cad_aDY9.js} +1 -1
  39. package/assets/{browser-ponyfill-C_hn4Jen.js → browser-ponyfill-CQ0GHmxr.js} +1 -1
  40. package/assets/browser-ponyfill-vZOvKb_B.js +1 -0
  41. package/assets/{buy-CN2rC9a0.js → buy-BRLq1STf.js} +1 -1
  42. package/assets/{buy-gasless-iZXsoGZN.js → buy-gasless-hR2bH0iR.js} +1 -1
  43. package/assets/{cart-checkout-CLMqKMCz.js → cart-checkout-CifIjL1z.js} +1 -1
  44. package/assets/{categories-D7_Qudaw.js → categories-BPU8ySTe.js} +5 -5
  45. package/assets/{ccip-DLXgNS3N.js → ccip-C1DhAmlP.js} +1 -1
  46. package/assets/{ccip-Be5Dn1Zo.js → ccip-pv6qu637.js} +1 -1
  47. package/assets/{chains-DOpzCPsr.js → chains-C1bwVnfj.js} +1 -1
  48. package/assets/{collection-DbmjhyjW.js → collection-DhudRI2A.js} +1 -1
  49. package/assets/{common-BO9A6Obt.js → common-yfho93wI.js} +1 -1
  50. package/assets/{controller-CDv5xjYs.js → controller-DBPpBNi9.js} +2 -2
  51. package/assets/{core-B1vdvz8J.js → core-CftjJZSY.js} +4 -4
  52. package/assets/{custom-3-JWbHeB.js → custom-CLjHEVcz.js} +1 -1
  53. package/assets/{data-capture-B9u0j-_M.js → data-capture-ClKTWWBL.js} +1 -1
  54. package/assets/{decimals-z4vOxece.js → decimals-B36bI5dA.js} +1 -1
  55. package/assets/decimals-BPDUTKfa.js +1 -0
  56. package/assets/{detectExtension-Cvy4AYwr.js → detectExtension-CKplVZ9K.js} +1 -1
  57. package/assets/{email-Bu0wLP5a.js → email-Dx9BSTtw.js} +1 -1
  58. package/assets/{embedded-wallet-DALUv36Z.js → embedded-wallet-CCKNmFwm.js} +1 -1
  59. package/assets/emotion-styled.browser.esm-B6FBNgF3.js +1 -0
  60. package/assets/{engine-COZjF6GN.js → engine-1UaDNb6s.js} +1 -1
  61. package/assets/{errors-BuvqNt2H.js → errors-DKFg2ql0.js} +1 -1
  62. package/assets/estimate-l1-fee-cQM6_GVS.js +1 -0
  63. package/assets/eth_estimateGas-BeErQaun.js +1 -0
  64. package/assets/{eth_getStorageAt-CqeWdstl.js → eth_getStorageAt-C0E8Vng5.js} +1 -1
  65. package/assets/eth_getTransactionCount-kFIWL36y.js +1 -0
  66. package/assets/{ethereum-C3MAoMFC.js → ethereum-C5kfwN9D.js} +1 -1
  67. package/assets/{ethers-Dpp9c5As.js → ethers-CLB2z3On.js} +1 -1
  68. package/assets/{execute-DVE3v1AF.js → execute-BuVfiwvM.js} +2 -2
  69. package/assets/{extractIPFS-HvQvYdM-.js → extractIPFS-CsawLTu6.js} +1 -1
  70. package/assets/{features-CqkOcXXU.js → features-ieqkL6m1.js} +1 -1
  71. package/assets/{fetchTokenMetadata-CZAPbDmS.js → fetchTokenMetadata-D8OWz4cP.js} +2 -2
  72. package/assets/{fortmatic-udOxQk4J.js → fortmatic-DwISA9k4.js} +1 -1
  73. package/assets/{get-bytecode-mfFuNYuc.js → get-bytecode-nwWHW248.js} +1 -1
  74. package/assets/get-ecosystem-wallet-info-LZLHBFVZ.js +1 -0
  75. package/assets/{getBalance-BawNMn6h.js → getBalance-Ck1YHbUL.js} +2 -2
  76. package/assets/{getInstalledModules-BNHlcIGs.js → getInstalledModules-fBSGgSis.js} +1 -1
  77. package/assets/{getNFT-BnfoPCmO.js → getNFT-DYxVn0Et.js} +2 -2
  78. package/assets/getNFT-DnYNAiji.js +1 -0
  79. package/assets/{getOverlayAlpha-DAstUi74.js → getOverlayAlpha-Jb_9sPPd.js} +1 -1
  80. package/assets/{hashTypedData-Cb3dj8Vj.js → hashTypedData-BHOeb4kN.js} +1 -1
  81. package/assets/{hashTypedData-CKhs32SE.js → hashTypedData-Bqz6FRnB.js} +1 -1
  82. package/assets/{import-D2QUSpyp.js → import-CyzZeEcP.js} +1 -1
  83. package/assets/{in-app-wallet-calls-Df8xMcoL.js → in-app-wallet-calls-BJRqCE4k.js} +1 -1
  84. package/assets/{in-app-Dy6198Ub.js → in-app-yMA-tvKO.js} +1 -1
  85. package/assets/{index-D8me2ig5.js → index-0C8jHF02.js} +1 -1
  86. package/assets/{index-BsI3EWcy.js → index-0Z5nkscP.js} +1 -1
  87. package/assets/{index-DoaLV6gK.js → index-3c-o1deN.js} +1 -1
  88. package/assets/{index-BhfJUYAQ.js → index-B2VkMi-_.js} +1 -1
  89. package/assets/{index-CEhWolV_.js → index-B55KertC.js} +1 -1
  90. package/assets/{index-kbFINusp.js → index-B6Hb0r15.js} +1 -1
  91. package/assets/{index-4DPFDe86.js → index-B7YJ2-NC.js} +1 -1
  92. package/assets/{index-DIGUl9iX.js → index-B8PSEU0f.js} +1 -1
  93. package/assets/{index-CRSMETpm.js → index-BEKwTyL9.js} +1 -1
  94. package/assets/{index-cjI3Jxw7.js → index-BEOJi3Jo.js} +1 -1
  95. package/assets/{index-85kWMWjg.js → index-BLpc0PAw.js} +2 -2
  96. package/assets/{index-V1lpWoC-.js → index-BUzglYPe.js} +1 -1
  97. package/assets/{index-Ct22HWuE.js → index-BVjayAtf.js} +1 -1
  98. package/assets/{index-BCWp_6cV.js → index-B_fPkyQt.js} +1 -1
  99. package/assets/{index-BmlDboHr.js → index-Bc63dzBj.js} +3 -3
  100. package/assets/{index-DPTvpJzS.js → index-BgMPhDEY.js} +1 -1
  101. package/assets/{index-Bi4zgWjQ.js → index-BlKccc7B.js} +2 -2
  102. package/assets/{index-CjTTlJEo.js → index-Bn-EvtCB.js} +1 -1
  103. package/assets/{index-B4Jw07i3.js → index-Bxu_HZv7.js} +1 -1
  104. package/assets/{index-DgYBZU4A.js → index-C0MEN305.js} +1 -1
  105. package/assets/{index-BRKyx7oU.js → index-CCr2J09y.js} +2 -2
  106. package/assets/index-CD_HpB6P.js +1 -0
  107. package/assets/{index-V0hMC6mZ.js → index-CJ4mXolB.js} +21 -21
  108. package/assets/{index-D0xvd_Dp.js → index-CO9CUrPm.js} +2 -2
  109. package/assets/{index-rFCcyY0H.js → index-CVG4mg1H.js} +1 -1
  110. package/assets/{index-CaOpng6c.js → index-CWcMLN9O.js} +1 -1
  111. package/assets/{index-Tfh0IyJl.js → index-Cenx9VIL.js} +1 -1
  112. package/assets/{index-C2-W1jZ1.js → index-Chx72aoA.js} +1 -1
  113. package/assets/{index-Cq0eRfqs.js → index-CjBPO58E.js} +1 -1
  114. package/assets/{index-DJVoIGkn.js → index-CnFuk6fK.js} +1 -1
  115. package/assets/{index-FFhK2B90.js → index-CqYieDft.js} +1 -1
  116. package/assets/{index-BA2L6eSl.css → index-CqYr0ABc.css} +1 -1
  117. package/assets/{index-CIfdS8Db.js → index-CstoEHiD.js} +1 -1
  118. package/assets/{index-BpbWCyB4.js → index-CvIOskBU.js} +1 -1
  119. package/assets/{index-B83hIo9e.js → index-D0tMQ_oG.js} +1 -1
  120. package/assets/{index-DP9-yadx.js → index-D18uHh6f.js} +1 -1
  121. package/assets/{index-BPKqBTdV.js → index-DHzasbYL.js} +1 -1
  122. package/assets/{index-B0SpA1TA.js → index-DJEb_i4T.js} +1 -1
  123. package/assets/{index-sN6H-jhd.js → index-DM6cwvvh.js} +1 -1
  124. package/assets/{index-BcuysZka.js → index-DPjEYQhJ.js} +1 -1
  125. package/assets/{index-uTPBgRyq.js → index-DPm2T7me.js} +3 -3
  126. package/assets/{index-Cz1Suly9.js → index-DSbcS8Gm.js} +1 -1
  127. package/assets/{index-BRNsIe3m.js → index-Dc1nvyn9.js} +1 -1
  128. package/assets/{index-DtYBJNaS.js → index-DdAgdwh_.js} +1 -1
  129. package/assets/{index-BlBcCTXj.js → index-Df4qngsG.js} +1 -1
  130. package/assets/{index-CbxN7Krq.js → index-Dil5ESgb.js} +1 -1
  131. package/assets/{index-CQbgtHPx.js → index-DjQcD_Sm.js} +1 -1
  132. package/assets/{index-BDN6djsw.js → index-Dszgr0BR.js} +1 -1
  133. package/assets/{index-DIpMchso.js → index-DwFc8v1Z.js} +1 -1
  134. package/assets/{index-BItUV6PM.js → index-Dx4oKUoK.js} +1 -1
  135. package/assets/{index-DoxUiIoZ.js → index-KyO7a8ne.js} +3 -3
  136. package/assets/{index-CXgtaw1w.js → index-LMkzNUyd.js} +1 -1
  137. package/assets/{index-BIulqLQL.js → index-LQPmlKJw.js} +1 -1
  138. package/assets/{index-CNpvozfL.js → index-O1MAeCt1.js} +1 -1
  139. package/assets/{index-D_Osq35D.js → index-Wkl8TG1w.js} +1 -1
  140. package/assets/{index-C2ZtkYpB.js → index-WrHr3vKs.js} +2 -2
  141. package/assets/{index-CIHaBruC.js → index-YX1mo09T.js} +1 -1
  142. package/assets/{index-cA2ARKGJ.js → index-a_8ZLAR0.js} +1 -1
  143. package/assets/{index-CJRmkopy.js → index-fvb_2ePt.js} +2 -2
  144. package/assets/{index-DPp2bhUs.js → index-mc7xea6T.js} +1 -1
  145. package/assets/{index-Cnmgw5PF.js → index-nmCuLAGG.js} +1 -1
  146. package/assets/{index-CPs7rZSr.js → index-riVFlKIa.js} +1 -1
  147. package/assets/{index-DlvbN_Av.js → index-uESxdvPf.js} +1 -1
  148. package/assets/{index-HRvlJsjj.js → index-xFOezD9a.js} +1 -1
  149. package/assets/{index-BzcxFNUz.js → index-zfsFyt-v.js} +1 -1
  150. package/assets/{index.es-C7FJOZk9.js → index.es-B-uJmNhd.js} +1 -1
  151. package/assets/{index.es-DLc2fyYi.js → index.es-CP2cNM9F.js} +1 -1
  152. package/assets/{index.es-BqAU2pak.js → index.es-Dy8PEmK4.js} +4 -4
  153. package/assets/{linkAccount-Coo42zCf.js → linkAccount-DKoZKguc.js} +1 -1
  154. package/assets/{localBatchGatewayRequest-aE453fG9.js → localBatchGatewayRequest-Dg8trW1f.js} +1 -1
  155. package/assets/{mana-rate-CFrZfrxV.js → mana-rate-DtQ8WpoI.js} +1 -1
  156. package/assets/{native-0dhyeu0o.js → native-t1vLKS11.js} +1 -1
  157. package/assets/{networks-DYw-qqg1.js → networks-BaSDToU0.js} +1 -1
  158. package/assets/{onramp-Dv5XffT1.js → onramp-D6REu-OE.js} +1 -1
  159. package/assets/{openzeppelin-DY9zonpF.js → openzeppelin-DsZ0ZpWh.js} +1 -1
  160. package/assets/{ownerOf-DZ5adWxQ.js → ownerOf-Cl_sRHvA.js} +1 -1
  161. package/assets/{parseNft-BoqFzz1w.js → parseNft-BrwItloF.js} +2 -2
  162. package/assets/{parseSignature-DLqUl44D.js → parseSignature-C67g8Ikn.js} +1 -1
  163. package/assets/{parseSignature-_8ci0C1c.js → parseSignature-CtBPNsAi.js} +3 -3
  164. package/assets/{passkeys-9jKCllXJ.js → passkeys-CkVvpC6F.js} +1 -1
  165. package/assets/{pay-with-exchange-q2w3TOV5.js → pay-with-exchange-DDftQXGa.js} +1 -1
  166. package/assets/{prepare-contract-call-C3igYCn_.js → prepare-contract-call-DmYPUPWz.js} +1 -1
  167. package/assets/{qr-overlay-kE0-Tb5Q.js → qr-overlay-CHyDfEfF.js} +3 -3
  168. package/assets/{react-BMZSDQJw.js → react-BrLDncxD.js} +1 -1
  169. package/assets/{receive-BlDcpWqy.js → receive-BqeMp3_k.js} +1 -1
  170. package/assets/{resolveImplementation-u5UN_seG.js → resolveImplementation-D6GNwvZn.js} +1 -1
  171. package/assets/{rpc-hzBSsIuq.js → rpc-D1wZc4pd.js} +1 -1
  172. package/assets/{secp256k1-DogjvjtS.js → secp256k1-Cu8gqKOi.js} +1 -1
  173. package/assets/{secp256k1-CIm5iUJu.js → secp256k1-DKdkwurr.js} +1 -1
  174. package/assets/{secp256k1-D_XLFIAD.js → secp256k1-tM-HU4Wb.js} +1 -1
  175. package/assets/{send-33Lvo35v.js → send-C5LlTSZw.js} +1 -1
  176. package/assets/{send-batch-transaction-DxqLfBgo.js → send-batch-transaction-2M20mpyd.js} +1 -1
  177. package/assets/{send-eip712-transaction-BWi3gkm3.js → send-eip712-transaction-DxCA-Uwd.js} +2 -2
  178. package/assets/send-gasless-transaction-VjwN2uQK.js +2 -0
  179. package/assets/{send-transaction-DN1HyeTa.js → send-transaction-Bb0Q9hmN.js} +2 -2
  180. package/assets/{sendRawTransaction-DqtJOwfz.js → sendRawTransaction-CED77ONZ.js} +3 -3
  181. package/assets/{sentry-8SzFotJj.js → sentry-DYZXk5O5.js} +1 -1
  182. package/assets/{serializeTransaction-DOUpHqmp.js → serializeTransaction-7yAEy3FU.js} +1 -1
  183. package/assets/{session-proposal-BtkIO7cP.js → session-proposal-DGrkZ9Ix.js} +1 -1
  184. package/assets/{session-request-lsymM3l6.js → session-request-Dg8cFRll.js} +2 -2
  185. package/assets/{sha256-CDuVPJMW.js → sha256-DM_yyL1v.js} +1 -1
  186. package/assets/{signing-Bskb_x4I.js → signing-DuUwyfpZ.js} +3 -3
  187. package/assets/{socials-BrDjbXdD.js → socials-cbGvEEpM.js} +1 -1
  188. package/assets/{swaps-BcWPrBSV.js → swaps-EURvYFti.js} +1 -1
  189. package/assets/{thirdweb-Cpf8EN89.js → thirdweb-D4Tt3SPK.js} +3 -3
  190. package/assets/{to-serializable-transaction-gyjNAfk6.js → to-serializable-transaction-Dh5bAtyQ.js} +2 -2
  191. package/assets/{totalSupply-qMyfSB-2.js → totalSupply-DKYveUeg.js} +1 -1
  192. package/assets/{trade-encoding-vTSEXgN1.js → trade-encoding-0IFZ39Tk.js} +1 -1
  193. package/assets/{transaction-DiMmwD2W.js → transaction-HL8b44XJ.js} +1 -1
  194. package/assets/{transactionReceipt-Bum6hzjL.js → transactionReceipt-DIw9ApVw.js} +1 -1
  195. package/assets/{transactions-D-Z-vxC7.js → transactions-xAqHSp91.js} +1 -1
  196. package/assets/{useCreditPacks-BJp5mEnq.js → useCreditPacks-DO-uyk4N.js} +1 -1
  197. package/assets/{useInfiniteGrid-COXciuKu.js → useInfiniteGrid-BbeLTVdN.js} +1 -1
  198. package/assets/{useStore-cTXMZhwG.js → useStore-PWA7dbNJ.js} +2 -2
  199. package/assets/{useTheme-DmdtRbZb.js → useTheme-BHtz4hyG.js} +1 -1
  200. package/assets/useTheme-Ciqd957r.js +1 -0
  201. package/assets/{utils-DLyVQGg1.js → utils-5mrprTVL.js} +1 -1
  202. package/assets/{verifyHash-DOsO5RNA.js → verifyHash-sv4aRvH_.js} +1 -1
  203. package/assets/{w3m-modal-D1Pu_W_3.js → w3m-modal-BoTSPCYe.js} +1 -1
  204. package/assets/{w3m-modal-oBw-UuhI.js → w3m-modal-D1RMqW5z.js} +1 -1
  205. package/assets/{wait-for-tx-receipt-BYt5Gcy_.js → wait-for-tx-receipt-CnoUxMtV.js} +1 -1
  206. package/assets/{wallets-uu9PjeR0.js → wallets-Cuqbvnoy.js} +5 -5
  207. package/assets/{web-connector-Vwf5Urnw.js → web-connector-0FomZsHS.js} +3 -3
  208. package/assets/{writeContract-iaip-T2H.js → writeContract-Bicvfabo.js} +1 -1
  209. package/assets/{zora-sepolia-sSAsjV_j.js → zora-sepolia-Bef01XwU.js} +1 -1
  210. package/assets/{zoraTestnet-EJHbKpn0.js → zoraTestnet-4QPNkDlh.js} +1 -1
  211. package/index.html +11 -11
  212. package/package.json +2 -2
  213. package/assets/Cart-pFVN5ROM.js +0 -3
  214. package/assets/Creator-DyLgE_Lq.js +0 -1
  215. package/assets/ItemDetail-BSqp8w-l.js +0 -78
  216. package/assets/PrimaryListModal-CQHoY5iG.js +0 -1
  217. package/assets/Success-CxrAGNmd.js +0 -98
  218. package/assets/browser-ponyfill-iWQHRc9C.js +0 -1
  219. package/assets/decimals-8h3d0d0Q.js +0 -1
  220. package/assets/emotion-styled.browser.esm-rI_2ZiJm.js +0 -1
  221. package/assets/estimate-l1-fee-y9SYh7nZ.js +0 -1
  222. package/assets/eth_estimateGas-BhQqpdnq.js +0 -1
  223. package/assets/eth_getTransactionCount-Ca9PbmYY.js +0 -1
  224. package/assets/get-ecosystem-wallet-info-CSMzgHAT.js +0 -1
  225. package/assets/getNFT-yjjewJwo.js +0 -1
  226. package/assets/index-BsYYLNpm.js +0 -1
  227. package/assets/send-gasless-transaction-CC-pEfDw.js +0 -2
  228. package/assets/useTheme-Cv3anIxV.js +0 -1
@@ -1,4 +1,4 @@
1
- import{ba as U,bb as Ue,O as C,bc as qe,bd as Ye,X as Qe,be as Xe,aZ as Ze,N as R,b2 as K,b1 as Te,bf as a,bg as Je,bh as Le,T as et,b8 as tt}from"./index-V0hMC6mZ.js";import{R as rt,g as ot}from"./getOverlayAlpha-DAstUi74.js";import{j as T,r as y}from"./react-BMZSDQJw.js";import{u as nt,a as Be}from"./useTheme-DmdtRbZb.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Xe,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
1
+ import{b7 as U,b8 as Ue,R as C,b9 as qe,ba as Ye,$ as Qe,bb as Je,aW as Xe,Q as R,a$ as K,a_ as Te,bc as a,bd as Ze,be as Le,T as et,b5 as tt}from"./index-CJ4mXolB.js";import{R as rt,g as ot}from"./getOverlayAlpha-Jb_9sPPd.js";import{j as T,r as y}from"./react-BrLDncxD.js";import{u as nt,a as Be}from"./useTheme-BHtz4hyG.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
2
2
  try {
3
3
  var mode = localStorage.getItem('${s}') || '${o}';
4
4
  var colorScheme = '';
@@ -20,5 +20,5 @@ try {
20
20
  if (colorScheme) {
21
21
  ${m}.setAttribute('${d}', colorScheme);
22
22
  }
23
- } catch(e){}})();`}},"mui-color-scheme-init")}function Ae(r){if(typeof window<"u"&&r==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Me(r,o){if(r.mode==="light"||r.mode==="system"&&r.systemMode==="light")return o("light");if(r.mode==="dark"||r.mode==="system"&&r.systemMode==="dark")return o("dark")}function ft(r){return Me(r,o=>{if(o==="light")return r.lightColorScheme;if(o==="dark")return r.darkColorScheme})}function ae(r,o){if(typeof window>"u")return;let n;try{n=localStorage.getItem(r)||void 0,n||localStorage.setItem(r,o)}catch{}return n||o}function ht(r){const{defaultMode:o="light",defaultLightColorScheme:n,defaultDarkColorScheme:i,supportedColorSchemes:s=[],modeStorageKey:l=le,colorSchemeStorageKey:d=ce,storageWindow:m=typeof window>"u"?void 0:window}=r,f=s.join(","),[S,b]=y.useState(()=>{const h=ae(l,o),c=ae(`${d}-light`,n),g=ae(`${d}-dark`,i);return{mode:h,systemMode:Ae(h),lightColorScheme:c,darkColorScheme:g}}),A=ft(S),M=y.useCallback(h=>{b(c=>{if(h===c.mode)return c;const g=h??o;try{localStorage.setItem(l,g)}catch{}return C({},c,{mode:g,systemMode:Ae(g)})})},[l,o]),v=y.useCallback(h=>{h?typeof h=="string"?h&&!f.includes(h)?console.error(`\`${h}\` does not exist in \`theme.colorSchemes\`.`):b(c=>{const g=C({},c);return Me(c,w=>{try{localStorage.setItem(`${d}-${w}`,h)}catch{}w==="light"&&(g.lightColorScheme=h),w==="dark"&&(g.darkColorScheme=h)}),g}):b(c=>{const g=C({},c),w=h.light===null?n:h.light,L=h.dark===null?i:h.dark;if(w)if(!f.includes(w))console.error(`\`${w}\` does not exist in \`theme.colorSchemes\`.`);else{g.lightColorScheme=w;try{localStorage.setItem(`${d}-light`,w)}catch{}}if(L)if(!f.includes(L))console.error(`\`${L}\` does not exist in \`theme.colorSchemes\`.`);else{g.darkColorScheme=L;try{localStorage.setItem(`${d}-dark`,L)}catch{}}return g}):b(c=>{try{localStorage.setItem(`${d}-light`,n),localStorage.setItem(`${d}-dark`,i)}catch{}return C({},c,{lightColorScheme:n,darkColorScheme:i})})},[f,d,n,i]),k=y.useCallback(h=>{S.mode==="system"&&b(c=>{const g=h!=null&&h.matches?"dark":"light";return c.systemMode===g?c:C({},c,{systemMode:g})})},[S.mode]),$=y.useRef(k);return $.current=k,y.useEffect(()=>{const h=(...g)=>$.current(...g),c=window.matchMedia("(prefers-color-scheme: dark)");return c.addListener(h),h(c),()=>{c.removeListener(h)}},[]),y.useEffect(()=>{if(m){const h=c=>{const g=c.newValue;typeof c.key=="string"&&c.key.startsWith(d)&&(!g||f.match(g))&&(c.key.endsWith("light")&&v({light:g}),c.key.endsWith("dark")&&v({dark:g})),c.key===l&&(!g||["light","dark","system"].includes(g))&&M(g||o)};return m.addEventListener("storage",h),()=>{m.removeEventListener("storage",h)}}},[v,M,l,d,f,o,m]),C({},S,{colorScheme:A,setMode:M,setColorScheme:v})}const gt=["colorSchemes","components","generateCssVars","cssVarPrefix"],pt="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function St(r){const{themeId:o,theme:n={},attribute:i=Ie,modeStorageKey:s=le,colorSchemeStorageKey:l=ce,defaultMode:d="light",defaultColorScheme:m,disableTransitionOnChange:f=!1,resolveTheme:S,excludeVariablesFromRoot:b}=r;(!n.colorSchemes||typeof m=="string"&&!n.colorSchemes[m]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.light]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.dark])&&console.error(`MUI: \`${m}\` does not exist in \`theme.colorSchemes\`.`);const A=y.createContext(void 0),M=()=>{const c=y.useContext(A);if(!c)throw new Error(Ze(19));return c};function v(c){const{children:g,theme:w=n,modeStorageKey:L=s,colorSchemeStorageKey:B=l,attribute:e=i,defaultMode:u=d,defaultColorScheme:p=m,disableTransitionOnChange:_=f,storageWindow:q=typeof window>"u"?void 0:window,documentNode:j=typeof document>"u"?void 0:document,colorSchemeNode:Y=typeof document>"u"?void 0:document.documentElement,colorSchemeSelector:H=":root",disableNestedContext:je=!1,disableStyleSheetGeneration:Pe=!1}=c,Q=y.useRef(!1),de=se(),X=y.useContext(A),Z=!!X&&!je,ue=w[o],me=ue||w,{colorSchemes:J={},components:Ve={},generateCssVars:fe=()=>({vars:{},css:{}}),cssVarPrefix:ee}=me,Fe=R(me,gt),te=Object.keys(J),he=typeof p=="string"?p:p.light,ge=typeof p=="string"?p:p.dark,{mode:Oe,setMode:pe,systemMode:Se,lightColorScheme:Ce,darkColorScheme:ye,colorScheme:Ge,setColorScheme:ve}=ht({supportedColorSchemes:te,defaultLightColorScheme:he,defaultDarkColorScheme:ge,modeStorageKey:L,colorSchemeStorageKey:B,defaultMode:u,storageWindow:q});let O=Oe,P=Ge;Z&&(O=X.mode,P=X.colorScheme);const We=O||(u==="system"?d:u),Re=P||(We==="dark"?ge:he),{css:Ke,vars:be}=fe(),D=C({},Fe,{components:Ve,colorSchemes:J,cssVarPrefix:ee,vars:be,getColorSchemeSelector:x=>`[${e}="${x}"] &`}),re={},ke={};Object.entries(J).forEach(([x,V])=>{const{css:z,vars:He}=fe(x);D.vars=K(D.vars,He),x===Re&&(Object.keys(V).forEach(E=>{V[E]&&typeof V[E]=="object"?D[E]=C({},D[E],V[E]):D[E]=V[E]}),D.palette&&(D.palette.colorScheme=x));const ze=typeof p=="string"?p:u==="dark"?p.dark:p.light;if(x===ze){if(b){const E={};b(ee).forEach(oe=>{E[oe]=z[oe],delete z[oe]}),re[`[${e}="${x}"]`]=E}re[`${H}, [${e}="${x}"]`]=z}else ke[`${H===":root"?"":H}[${e}="${x}"]`]=z}),D.vars=K(D.vars,be),y.useEffect(()=>{P&&Y&&Y.setAttribute(e,P)},[P,e,Y]),y.useEffect(()=>{let x;if(_&&Q.current&&j){const V=j.createElement("style");V.appendChild(j.createTextNode(pt)),j.head.appendChild(V),window.getComputedStyle(j.body),x=setTimeout(()=>{j.head.removeChild(V)},1)}return()=>{clearTimeout(x)}},[P,_,j]),y.useEffect(()=>(Q.current=!0,()=>{Q.current=!1}),[]);const Ne=y.useMemo(()=>({allColorSchemes:te,colorScheme:P,darkColorScheme:ye,lightColorScheme:Ce,mode:O,setColorScheme:ve,setMode:pe,systemMode:Se}),[te,P,ye,Ce,O,ve,pe,Se]);let _e=!0;(Pe||Z&&(de==null?void 0:de.cssVarPrefix)===ee)&&(_e=!1);const we=T.jsxs(y.Fragment,{children:[_e&&T.jsxs(y.Fragment,{children:[T.jsx(U,{styles:{[H]:Ke}}),T.jsx(U,{styles:re}),T.jsx(U,{styles:ke})]}),T.jsx(ut,{themeId:ue?o:void 0,theme:S?S(D):D,children:g})]});return Z?we:T.jsx(A.Provider,{value:Ne,children:we})}const k=typeof m=="string"?m:m.light,$=typeof m=="string"?m:m.dark;return{CssVarsProvider:v,useColorScheme:M,getInitColorSchemeScript:c=>mt(C({attribute:i,colorSchemeStorageKey:l,defaultMode:d,defaultLightColorScheme:k,defaultDarkColorScheme:$,modeStorageKey:s},c))}}function Ct(r=""){function o(...i){if(!i.length)return"";const s=i[0];return typeof s=="string"&&!s.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${r?`${r}-`:""}${s}${o(...i.slice(1))})`:`, ${s}`}return(i,...s)=>`var(--${r?`${r}-`:""}${i}${o(...s)})`}const De=(r,o,n,i=[])=>{let s=r;o.forEach((l,d)=>{d===o.length-1?Array.isArray(s)?s[Number(l)]=n:s&&typeof s=="object"&&(s[l]=n):s&&typeof s=="object"&&(s[l]||(s[l]=i.includes(l)?[]:{}),s=s[l])})},yt=(r,o,n)=>{function i(s,l=[],d=[]){Object.entries(s).forEach(([m,f])=>{(!n||n&&!n([...l,m]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?i(f,[...l,m],Array.isArray(f)?[...d,m]:d):o([...l,m],f,d))})}i(r)},vt=(r,o)=>typeof o=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(i=>r.includes(i))||r[r.length-1].toLowerCase().indexOf("opacity")>=0?o:`${o}px`:o;function ie(r,o){const{prefix:n,shouldSkipGeneratingVar:i}=o||{},s={},l={},d={};return yt(r,(m,f,S)=>{if((typeof f=="string"||typeof f=="number")&&(!i||!i(m,f))){const b=`--${n?`${n}-`:""}${m.join("-")}`;Object.assign(s,{[b]:vt(m,f)}),De(l,m,`var(${b})`,S),De(d,m,`var(${b}, ${f})`,S)}},m=>m[0]==="vars"),{css:s,vars:l,varsWithDefaults:d}}function N(r){"@babel/helpers - typeof";return N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},N(r)}function bt(r,o){if(N(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var i=n.call(r,o);if(N(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function kt(r){var o=bt(r,"string");return N(o)=="symbol"?o:o+""}const _t=["colorSchemes","components","defaultColorScheme"];function wt(r,o){const{colorSchemes:n={},defaultColorScheme:i="light"}=r,s=R(r,_t),{vars:l,css:d,varsWithDefaults:m}=ie(s,o);let f=m;const S={},{[i]:b}=n,A=R(n,[i].map(kt));if(Object.entries(A||{}).forEach(([v,k])=>{const{vars:$,css:h,varsWithDefaults:c}=ie(k,o);f=K(f,c),S[v]={css:h,vars:$}}),b){const{css:v,vars:k,varsWithDefaults:$}=ie(b,o);f=K(f,$),S[i]={css:v,vars:k}}return{vars:f,generateCssVars:v=>{var k;if(!v){var $;const c=C({},d);return{css:c,vars:l,selector:(o==null||($=o.getSelector)==null?void 0:$.call(o,v,c))||":root"}}const h=C({},S[v].css);return{css:h,vars:S[v].vars,selector:(o==null||(k=o.getSelector)==null?void 0:k.call(o,v,h))||":root"}}}}function Tt(r){var o;return!!r[0].match(/(cssVarPrefix|typography|mixins|breakpoints|direction|transitions)/)||!!r[0].match(/sxConfig$/)||r[0]==="palette"&&!!((o=r[1])!=null&&o.match(/(mode|contrastThreshold|tonalOffset)/))}const $t=["colorSchemes","cssVarPrefix","shouldSkipGeneratingVar"],xt=["palette"],At=[...Array(25)].map((r,o)=>{if(o===0)return;const n=ot(o);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Dt(r,o){o.forEach(n=>{r[n]||(r[n]={})})}function t(r,o,n){!r[o]&&n&&(r[o]=n)}function W(r){return!r||!r.startsWith("hsl")?r:a.hslToRgb(r)}function F(r,o){`${o}Channel`in r||(r[`${o}Channel`]=a.private_safeColorChannel(W(r[o]),`MUI: Can't create \`palette.${o}Channel\` because \`palette.${o}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
24
- To suppress this warning, you need to explicitly provide the \`palette.${o}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}const I=r=>{try{return r()}catch{}},Lt=(r="mui")=>Ct(r);function Bt(r={},...o){var n,i,s,l,d,m;const{colorSchemes:f={},cssVarPrefix:S="mui",shouldSkipGeneratingVar:b=Tt}=r,A=R(r,$t),M=Lt(S),v=Te(C({},A,f.light&&{palette:(n=f.light)==null?void 0:n.palette})),{palette:k}=v,$=R(v,xt),{palette:h}=Te({palette:C({mode:"dark"},(i=f.dark)==null?void 0:i.palette)});let c=C({},$,{cssVarPrefix:S,getCssVar:M,colorSchemes:C({},f,{light:C({},f.light,{palette:k,opacity:C({inputPlaceholder:.42,inputUnderline:.42,switchTrackDisabled:.12,switchTrack:.38},(s=f.light)==null?void 0:s.opacity),overlays:((l=f.light)==null?void 0:l.overlays)||[]}),dark:C({},f.dark,{palette:h,opacity:C({inputPlaceholder:.5,inputUnderline:.7,switchTrackDisabled:.2,switchTrack:.3},(d=f.dark)==null?void 0:d.opacity),overlays:((m=f.dark)==null?void 0:m.overlays)||At})})});Object.keys(c.colorSchemes).forEach(B=>{const e=c.colorSchemes[B].palette,u=p=>{const _=p.split("-"),q=_[1],j=_[2];return M(p,e[q][j])};if(B==="light"?(t(e.common,"background","#fff"),t(e.common,"onBackground","#000")):(t(e.common,"background","#000"),t(e.common,"onBackground","#fff")),Dt(e,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),B==="light"){t(e.Alert,"errorColor",a.private_safeDarken(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeDarken(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeDarken(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeDarken(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-main")),t(e.Alert,"infoFilledBg",u("palette-info-main")),t(e.Alert,"successFilledBg",u("palette-success-main")),t(e.Alert,"warningFilledBg",u("palette-warning-main")),t(e.Alert,"errorFilledColor",I(()=>k.getContrastText(e.error.main))),t(e.Alert,"infoFilledColor",I(()=>k.getContrastText(e.info.main))),t(e.Alert,"successFilledColor",I(()=>k.getContrastText(e.success.main))),t(e.Alert,"warningFilledColor",I(()=>k.getContrastText(e.warning.main))),t(e.Alert,"errorStandardBg",a.private_safeLighten(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeLighten(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeLighten(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeLighten(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-100")),t(e.Avatar,"defaultBg",u("palette-grey-400")),t(e.Button,"inheritContainedBg",u("palette-grey-300")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-A100")),t(e.Chip,"defaultBorder",u("palette-grey-400")),t(e.Chip,"defaultAvatarColor",u("palette-grey-700")),t(e.Chip,"defaultIconColor",u("palette-grey-700")),t(e.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),t(e.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),t(e.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeLighten(e.primary.main,.62)),t(e.LinearProgress,"secondaryBg",a.private_safeLighten(e.secondary.main,.62)),t(e.LinearProgress,"errorBg",a.private_safeLighten(e.error.main,.62)),t(e.LinearProgress,"infoBg",a.private_safeLighten(e.info.main,.62)),t(e.LinearProgress,"successBg",a.private_safeLighten(e.success.main,.62)),t(e.LinearProgress,"warningBg",a.private_safeLighten(e.warning.main,.62)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.11)`),t(e.Slider,"primaryTrack",a.private_safeLighten(e.primary.main,.62)),t(e.Slider,"secondaryTrack",a.private_safeLighten(e.secondary.main,.62)),t(e.Slider,"errorTrack",a.private_safeLighten(e.error.main,.62)),t(e.Slider,"infoTrack",a.private_safeLighten(e.info.main,.62)),t(e.Slider,"successTrack",a.private_safeLighten(e.success.main,.62)),t(e.Slider,"warningTrack",a.private_safeLighten(e.warning.main,.62));const p=a.private_safeEmphasize(e.background.default,.8);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>k.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-400")),t(e.StepContent,"border",u("palette-grey-400")),t(e.Switch,"defaultColor",u("palette-common-white")),t(e.Switch,"defaultDisabledColor",u("palette-grey-100")),t(e.Switch,"primaryDisabledColor",a.private_safeLighten(e.primary.main,.62)),t(e.Switch,"secondaryDisabledColor",a.private_safeLighten(e.secondary.main,.62)),t(e.Switch,"errorDisabledColor",a.private_safeLighten(e.error.main,.62)),t(e.Switch,"infoDisabledColor",a.private_safeLighten(e.info.main,.62)),t(e.Switch,"successDisabledColor",a.private_safeLighten(e.success.main,.62)),t(e.Switch,"warningDisabledColor",a.private_safeLighten(e.warning.main,.62)),t(e.TableCell,"border",a.private_safeLighten(a.private_safeAlpha(e.divider,1),.88)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}else{t(e.Alert,"errorColor",a.private_safeLighten(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeLighten(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeLighten(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeLighten(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-dark")),t(e.Alert,"infoFilledBg",u("palette-info-dark")),t(e.Alert,"successFilledBg",u("palette-success-dark")),t(e.Alert,"warningFilledBg",u("palette-warning-dark")),t(e.Alert,"errorFilledColor",I(()=>h.getContrastText(e.error.dark))),t(e.Alert,"infoFilledColor",I(()=>h.getContrastText(e.info.dark))),t(e.Alert,"successFilledColor",I(()=>h.getContrastText(e.success.dark))),t(e.Alert,"warningFilledColor",I(()=>h.getContrastText(e.warning.dark))),t(e.Alert,"errorStandardBg",a.private_safeDarken(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeDarken(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeDarken(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeDarken(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-900")),t(e.AppBar,"darkBg",u("palette-background-paper")),t(e.AppBar,"darkColor",u("palette-text-primary")),t(e.Avatar,"defaultBg",u("palette-grey-600")),t(e.Button,"inheritContainedBg",u("palette-grey-800")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-700")),t(e.Chip,"defaultBorder",u("palette-grey-700")),t(e.Chip,"defaultAvatarColor",u("palette-grey-300")),t(e.Chip,"defaultIconColor",u("palette-grey-300")),t(e.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),t(e.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),t(e.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeDarken(e.primary.main,.5)),t(e.LinearProgress,"secondaryBg",a.private_safeDarken(e.secondary.main,.5)),t(e.LinearProgress,"errorBg",a.private_safeDarken(e.error.main,.5)),t(e.LinearProgress,"infoBg",a.private_safeDarken(e.info.main,.5)),t(e.LinearProgress,"successBg",a.private_safeDarken(e.success.main,.5)),t(e.LinearProgress,"warningBg",a.private_safeDarken(e.warning.main,.5)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.13)`),t(e.Slider,"primaryTrack",a.private_safeDarken(e.primary.main,.5)),t(e.Slider,"secondaryTrack",a.private_safeDarken(e.secondary.main,.5)),t(e.Slider,"errorTrack",a.private_safeDarken(e.error.main,.5)),t(e.Slider,"infoTrack",a.private_safeDarken(e.info.main,.5)),t(e.Slider,"successTrack",a.private_safeDarken(e.success.main,.5)),t(e.Slider,"warningTrack",a.private_safeDarken(e.warning.main,.5));const p=a.private_safeEmphasize(e.background.default,.98);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>h.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-600")),t(e.StepContent,"border",u("palette-grey-600")),t(e.Switch,"defaultColor",u("palette-grey-300")),t(e.Switch,"defaultDisabledColor",u("palette-grey-600")),t(e.Switch,"primaryDisabledColor",a.private_safeDarken(e.primary.main,.55)),t(e.Switch,"secondaryDisabledColor",a.private_safeDarken(e.secondary.main,.55)),t(e.Switch,"errorDisabledColor",a.private_safeDarken(e.error.main,.55)),t(e.Switch,"infoDisabledColor",a.private_safeDarken(e.info.main,.55)),t(e.Switch,"successDisabledColor",a.private_safeDarken(e.success.main,.55)),t(e.Switch,"warningDisabledColor",a.private_safeDarken(e.warning.main,.55)),t(e.TableCell,"border",a.private_safeDarken(a.private_safeAlpha(e.divider,1),.68)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}F(e.background,"default"),F(e.background,"paper"),F(e.common,"background"),F(e.common,"onBackground"),F(e,"divider"),Object.keys(e).forEach(p=>{const _=e[p];_&&typeof _=="object"&&(_.main&&t(e[p],"mainChannel",a.private_safeColorChannel(W(_.main))),_.light&&t(e[p],"lightChannel",a.private_safeColorChannel(W(_.light))),_.dark&&t(e[p],"darkChannel",a.private_safeColorChannel(W(_.dark))),_.contrastText&&t(e[p],"contrastTextChannel",a.private_safeColorChannel(W(_.contrastText))),p==="text"&&(F(e[p],"primary"),F(e[p],"secondary")),p==="action"&&(_.active&&F(e[p],"active"),_.selected&&F(e[p],"selected")))})}),c=o.reduce((B,e)=>K(B,e),c);const g={prefix:S,shouldSkipGeneratingVar:b},{vars:w,generateCssVars:L}=wt(c,g);return c.vars=w,c.generateCssVars=L,c.shouldSkipGeneratingVar=b,c.unstable_sxConfig=C({},Je,A==null?void 0:A.unstable_sxConfig),c.unstable_sx=function(e){return Le({sx:e,theme:this})},c}const Et=r=>[...[...Array(24)].map((o,n)=>`--${r?`${r}-`:""}overlays-${n+1}`),`--${r?`${r}-`:""}palette-AppBar-darkBg`,`--${r?`${r}-`:""}palette-AppBar-darkColor`],G={attribute:"data-mui-color-scheme",colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},It=Bt(),{CssVarsProvider:Ot,useColorScheme:Gt,getInitColorSchemeScript:Mt}=St({themeId:et,theme:It,attribute:G.attribute,colorSchemeStorageKey:G.colorSchemeStorageKey,modeStorageKey:G.modeStorageKey,defaultColorScheme:{light:G.defaultLightColorScheme,dark:G.defaultDarkColorScheme},resolveTheme:r=>{const o=C({},r,{typography:tt(r.palette,r.typography)});return o.unstable_sx=function(i){return Le({sx:i,theme:this})},o},excludeVariablesFromRoot:Et}),Wt=Mt;export{Ot as C,at as G,ut as T,Et as a,Bt as e,Wt as g,Tt as s,Gt as u};
23
+ } catch(e){}})();`}},"mui-color-scheme-init")}function Ae(r){if(typeof window<"u"&&r==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Me(r,o){if(r.mode==="light"||r.mode==="system"&&r.systemMode==="light")return o("light");if(r.mode==="dark"||r.mode==="system"&&r.systemMode==="dark")return o("dark")}function ft(r){return Me(r,o=>{if(o==="light")return r.lightColorScheme;if(o==="dark")return r.darkColorScheme})}function ae(r,o){if(typeof window>"u")return;let n;try{n=localStorage.getItem(r)||void 0,n||localStorage.setItem(r,o)}catch{}return n||o}function ht(r){const{defaultMode:o="light",defaultLightColorScheme:n,defaultDarkColorScheme:i,supportedColorSchemes:s=[],modeStorageKey:l=le,colorSchemeStorageKey:d=ce,storageWindow:m=typeof window>"u"?void 0:window}=r,f=s.join(","),[S,b]=y.useState(()=>{const h=ae(l,o),c=ae(`${d}-light`,n),g=ae(`${d}-dark`,i);return{mode:h,systemMode:Ae(h),lightColorScheme:c,darkColorScheme:g}}),A=ft(S),M=y.useCallback(h=>{b(c=>{if(h===c.mode)return c;const g=h??o;try{localStorage.setItem(l,g)}catch{}return C({},c,{mode:g,systemMode:Ae(g)})})},[l,o]),v=y.useCallback(h=>{h?typeof h=="string"?h&&!f.includes(h)?console.error(`\`${h}\` does not exist in \`theme.colorSchemes\`.`):b(c=>{const g=C({},c);return Me(c,w=>{try{localStorage.setItem(`${d}-${w}`,h)}catch{}w==="light"&&(g.lightColorScheme=h),w==="dark"&&(g.darkColorScheme=h)}),g}):b(c=>{const g=C({},c),w=h.light===null?n:h.light,L=h.dark===null?i:h.dark;if(w)if(!f.includes(w))console.error(`\`${w}\` does not exist in \`theme.colorSchemes\`.`);else{g.lightColorScheme=w;try{localStorage.setItem(`${d}-light`,w)}catch{}}if(L)if(!f.includes(L))console.error(`\`${L}\` does not exist in \`theme.colorSchemes\`.`);else{g.darkColorScheme=L;try{localStorage.setItem(`${d}-dark`,L)}catch{}}return g}):b(c=>{try{localStorage.setItem(`${d}-light`,n),localStorage.setItem(`${d}-dark`,i)}catch{}return C({},c,{lightColorScheme:n,darkColorScheme:i})})},[f,d,n,i]),k=y.useCallback(h=>{S.mode==="system"&&b(c=>{const g=h!=null&&h.matches?"dark":"light";return c.systemMode===g?c:C({},c,{systemMode:g})})},[S.mode]),$=y.useRef(k);return $.current=k,y.useEffect(()=>{const h=(...g)=>$.current(...g),c=window.matchMedia("(prefers-color-scheme: dark)");return c.addListener(h),h(c),()=>{c.removeListener(h)}},[]),y.useEffect(()=>{if(m){const h=c=>{const g=c.newValue;typeof c.key=="string"&&c.key.startsWith(d)&&(!g||f.match(g))&&(c.key.endsWith("light")&&v({light:g}),c.key.endsWith("dark")&&v({dark:g})),c.key===l&&(!g||["light","dark","system"].includes(g))&&M(g||o)};return m.addEventListener("storage",h),()=>{m.removeEventListener("storage",h)}}},[v,M,l,d,f,o,m]),C({},S,{colorScheme:A,setMode:M,setColorScheme:v})}const gt=["colorSchemes","components","generateCssVars","cssVarPrefix"],pt="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function St(r){const{themeId:o,theme:n={},attribute:i=Ie,modeStorageKey:s=le,colorSchemeStorageKey:l=ce,defaultMode:d="light",defaultColorScheme:m,disableTransitionOnChange:f=!1,resolveTheme:S,excludeVariablesFromRoot:b}=r;(!n.colorSchemes||typeof m=="string"&&!n.colorSchemes[m]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.light]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.dark])&&console.error(`MUI: \`${m}\` does not exist in \`theme.colorSchemes\`.`);const A=y.createContext(void 0),M=()=>{const c=y.useContext(A);if(!c)throw new Error(Xe(19));return c};function v(c){const{children:g,theme:w=n,modeStorageKey:L=s,colorSchemeStorageKey:B=l,attribute:e=i,defaultMode:u=d,defaultColorScheme:p=m,disableTransitionOnChange:_=f,storageWindow:q=typeof window>"u"?void 0:window,documentNode:j=typeof document>"u"?void 0:document,colorSchemeNode:Y=typeof document>"u"?void 0:document.documentElement,colorSchemeSelector:N=":root",disableNestedContext:je=!1,disableStyleSheetGeneration:Pe=!1}=c,Q=y.useRef(!1),de=se(),J=y.useContext(A),X=!!J&&!je,ue=w[o],me=ue||w,{colorSchemes:Z={},components:Ve={},generateCssVars:fe=()=>({vars:{},css:{}}),cssVarPrefix:ee}=me,Fe=R(me,gt),te=Object.keys(Z),he=typeof p=="string"?p:p.light,ge=typeof p=="string"?p:p.dark,{mode:Oe,setMode:pe,systemMode:Se,lightColorScheme:Ce,darkColorScheme:ye,colorScheme:Ge,setColorScheme:ve}=ht({supportedColorSchemes:te,defaultLightColorScheme:he,defaultDarkColorScheme:ge,modeStorageKey:L,colorSchemeStorageKey:B,defaultMode:u,storageWindow:q});let O=Oe,P=Ge;X&&(O=J.mode,P=J.colorScheme);const We=O||(u==="system"?d:u),Re=P||(We==="dark"?ge:he),{css:Ke,vars:be}=fe(),D=C({},Fe,{components:Ve,colorSchemes:Z,cssVarPrefix:ee,vars:be,getColorSchemeSelector:x=>`[${e}="${x}"] &`}),re={},ke={};Object.entries(Z).forEach(([x,V])=>{const{css:z,vars:Ne}=fe(x);D.vars=K(D.vars,Ne),x===Re&&(Object.keys(V).forEach(E=>{V[E]&&typeof V[E]=="object"?D[E]=C({},D[E],V[E]):D[E]=V[E]}),D.palette&&(D.palette.colorScheme=x));const ze=typeof p=="string"?p:u==="dark"?p.dark:p.light;if(x===ze){if(b){const E={};b(ee).forEach(oe=>{E[oe]=z[oe],delete z[oe]}),re[`[${e}="${x}"]`]=E}re[`${N}, [${e}="${x}"]`]=z}else ke[`${N===":root"?"":N}[${e}="${x}"]`]=z}),D.vars=K(D.vars,be),y.useEffect(()=>{P&&Y&&Y.setAttribute(e,P)},[P,e,Y]),y.useEffect(()=>{let x;if(_&&Q.current&&j){const V=j.createElement("style");V.appendChild(j.createTextNode(pt)),j.head.appendChild(V),window.getComputedStyle(j.body),x=setTimeout(()=>{j.head.removeChild(V)},1)}return()=>{clearTimeout(x)}},[P,_,j]),y.useEffect(()=>(Q.current=!0,()=>{Q.current=!1}),[]);const He=y.useMemo(()=>({allColorSchemes:te,colorScheme:P,darkColorScheme:ye,lightColorScheme:Ce,mode:O,setColorScheme:ve,setMode:pe,systemMode:Se}),[te,P,ye,Ce,O,ve,pe,Se]);let _e=!0;(Pe||X&&(de==null?void 0:de.cssVarPrefix)===ee)&&(_e=!1);const we=T.jsxs(y.Fragment,{children:[_e&&T.jsxs(y.Fragment,{children:[T.jsx(U,{styles:{[N]:Ke}}),T.jsx(U,{styles:re}),T.jsx(U,{styles:ke})]}),T.jsx(ut,{themeId:ue?o:void 0,theme:S?S(D):D,children:g})]});return X?we:T.jsx(A.Provider,{value:He,children:we})}const k=typeof m=="string"?m:m.light,$=typeof m=="string"?m:m.dark;return{CssVarsProvider:v,useColorScheme:M,getInitColorSchemeScript:c=>mt(C({attribute:i,colorSchemeStorageKey:l,defaultMode:d,defaultLightColorScheme:k,defaultDarkColorScheme:$,modeStorageKey:s},c))}}function Ct(r=""){function o(...i){if(!i.length)return"";const s=i[0];return typeof s=="string"&&!s.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${r?`${r}-`:""}${s}${o(...i.slice(1))})`:`, ${s}`}return(i,...s)=>`var(--${r?`${r}-`:""}${i}${o(...s)})`}const De=(r,o,n,i=[])=>{let s=r;o.forEach((l,d)=>{d===o.length-1?Array.isArray(s)?s[Number(l)]=n:s&&typeof s=="object"&&(s[l]=n):s&&typeof s=="object"&&(s[l]||(s[l]=i.includes(l)?[]:{}),s=s[l])})},yt=(r,o,n)=>{function i(s,l=[],d=[]){Object.entries(s).forEach(([m,f])=>{(!n||n&&!n([...l,m]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?i(f,[...l,m],Array.isArray(f)?[...d,m]:d):o([...l,m],f,d))})}i(r)},vt=(r,o)=>typeof o=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(i=>r.includes(i))||r[r.length-1].toLowerCase().indexOf("opacity")>=0?o:`${o}px`:o;function ie(r,o){const{prefix:n,shouldSkipGeneratingVar:i}=o||{},s={},l={},d={};return yt(r,(m,f,S)=>{if((typeof f=="string"||typeof f=="number")&&(!i||!i(m,f))){const b=`--${n?`${n}-`:""}${m.join("-")}`;Object.assign(s,{[b]:vt(m,f)}),De(l,m,`var(${b})`,S),De(d,m,`var(${b}, ${f})`,S)}},m=>m[0]==="vars"),{css:s,vars:l,varsWithDefaults:d}}function H(r){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},H(r)}function bt(r,o){if(H(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var i=n.call(r,o);if(H(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function kt(r){var o=bt(r,"string");return H(o)=="symbol"?o:o+""}const _t=["colorSchemes","components","defaultColorScheme"];function wt(r,o){const{colorSchemes:n={},defaultColorScheme:i="light"}=r,s=R(r,_t),{vars:l,css:d,varsWithDefaults:m}=ie(s,o);let f=m;const S={},{[i]:b}=n,A=R(n,[i].map(kt));if(Object.entries(A||{}).forEach(([v,k])=>{const{vars:$,css:h,varsWithDefaults:c}=ie(k,o);f=K(f,c),S[v]={css:h,vars:$}}),b){const{css:v,vars:k,varsWithDefaults:$}=ie(b,o);f=K(f,$),S[i]={css:v,vars:k}}return{vars:f,generateCssVars:v=>{var k;if(!v){var $;const c=C({},d);return{css:c,vars:l,selector:(o==null||($=o.getSelector)==null?void 0:$.call(o,v,c))||":root"}}const h=C({},S[v].css);return{css:h,vars:S[v].vars,selector:(o==null||(k=o.getSelector)==null?void 0:k.call(o,v,h))||":root"}}}}function Tt(r){var o;return!!r[0].match(/(cssVarPrefix|typography|mixins|breakpoints|direction|transitions)/)||!!r[0].match(/sxConfig$/)||r[0]==="palette"&&!!((o=r[1])!=null&&o.match(/(mode|contrastThreshold|tonalOffset)/))}const $t=["colorSchemes","cssVarPrefix","shouldSkipGeneratingVar"],xt=["palette"],At=[...Array(25)].map((r,o)=>{if(o===0)return;const n=ot(o);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Dt(r,o){o.forEach(n=>{r[n]||(r[n]={})})}function t(r,o,n){!r[o]&&n&&(r[o]=n)}function W(r){return!r||!r.startsWith("hsl")?r:a.hslToRgb(r)}function F(r,o){`${o}Channel`in r||(r[`${o}Channel`]=a.private_safeColorChannel(W(r[o]),`MUI: Can't create \`palette.${o}Channel\` because \`palette.${o}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
24
+ To suppress this warning, you need to explicitly provide the \`palette.${o}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}const I=r=>{try{return r()}catch{}},Lt=(r="mui")=>Ct(r);function Bt(r={},...o){var n,i,s,l,d,m;const{colorSchemes:f={},cssVarPrefix:S="mui",shouldSkipGeneratingVar:b=Tt}=r,A=R(r,$t),M=Lt(S),v=Te(C({},A,f.light&&{palette:(n=f.light)==null?void 0:n.palette})),{palette:k}=v,$=R(v,xt),{palette:h}=Te({palette:C({mode:"dark"},(i=f.dark)==null?void 0:i.palette)});let c=C({},$,{cssVarPrefix:S,getCssVar:M,colorSchemes:C({},f,{light:C({},f.light,{palette:k,opacity:C({inputPlaceholder:.42,inputUnderline:.42,switchTrackDisabled:.12,switchTrack:.38},(s=f.light)==null?void 0:s.opacity),overlays:((l=f.light)==null?void 0:l.overlays)||[]}),dark:C({},f.dark,{palette:h,opacity:C({inputPlaceholder:.5,inputUnderline:.7,switchTrackDisabled:.2,switchTrack:.3},(d=f.dark)==null?void 0:d.opacity),overlays:((m=f.dark)==null?void 0:m.overlays)||At})})});Object.keys(c.colorSchemes).forEach(B=>{const e=c.colorSchemes[B].palette,u=p=>{const _=p.split("-"),q=_[1],j=_[2];return M(p,e[q][j])};if(B==="light"?(t(e.common,"background","#fff"),t(e.common,"onBackground","#000")):(t(e.common,"background","#000"),t(e.common,"onBackground","#fff")),Dt(e,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),B==="light"){t(e.Alert,"errorColor",a.private_safeDarken(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeDarken(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeDarken(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeDarken(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-main")),t(e.Alert,"infoFilledBg",u("palette-info-main")),t(e.Alert,"successFilledBg",u("palette-success-main")),t(e.Alert,"warningFilledBg",u("palette-warning-main")),t(e.Alert,"errorFilledColor",I(()=>k.getContrastText(e.error.main))),t(e.Alert,"infoFilledColor",I(()=>k.getContrastText(e.info.main))),t(e.Alert,"successFilledColor",I(()=>k.getContrastText(e.success.main))),t(e.Alert,"warningFilledColor",I(()=>k.getContrastText(e.warning.main))),t(e.Alert,"errorStandardBg",a.private_safeLighten(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeLighten(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeLighten(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeLighten(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-100")),t(e.Avatar,"defaultBg",u("palette-grey-400")),t(e.Button,"inheritContainedBg",u("palette-grey-300")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-A100")),t(e.Chip,"defaultBorder",u("palette-grey-400")),t(e.Chip,"defaultAvatarColor",u("palette-grey-700")),t(e.Chip,"defaultIconColor",u("palette-grey-700")),t(e.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),t(e.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),t(e.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeLighten(e.primary.main,.62)),t(e.LinearProgress,"secondaryBg",a.private_safeLighten(e.secondary.main,.62)),t(e.LinearProgress,"errorBg",a.private_safeLighten(e.error.main,.62)),t(e.LinearProgress,"infoBg",a.private_safeLighten(e.info.main,.62)),t(e.LinearProgress,"successBg",a.private_safeLighten(e.success.main,.62)),t(e.LinearProgress,"warningBg",a.private_safeLighten(e.warning.main,.62)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.11)`),t(e.Slider,"primaryTrack",a.private_safeLighten(e.primary.main,.62)),t(e.Slider,"secondaryTrack",a.private_safeLighten(e.secondary.main,.62)),t(e.Slider,"errorTrack",a.private_safeLighten(e.error.main,.62)),t(e.Slider,"infoTrack",a.private_safeLighten(e.info.main,.62)),t(e.Slider,"successTrack",a.private_safeLighten(e.success.main,.62)),t(e.Slider,"warningTrack",a.private_safeLighten(e.warning.main,.62));const p=a.private_safeEmphasize(e.background.default,.8);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>k.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-400")),t(e.StepContent,"border",u("palette-grey-400")),t(e.Switch,"defaultColor",u("palette-common-white")),t(e.Switch,"defaultDisabledColor",u("palette-grey-100")),t(e.Switch,"primaryDisabledColor",a.private_safeLighten(e.primary.main,.62)),t(e.Switch,"secondaryDisabledColor",a.private_safeLighten(e.secondary.main,.62)),t(e.Switch,"errorDisabledColor",a.private_safeLighten(e.error.main,.62)),t(e.Switch,"infoDisabledColor",a.private_safeLighten(e.info.main,.62)),t(e.Switch,"successDisabledColor",a.private_safeLighten(e.success.main,.62)),t(e.Switch,"warningDisabledColor",a.private_safeLighten(e.warning.main,.62)),t(e.TableCell,"border",a.private_safeLighten(a.private_safeAlpha(e.divider,1),.88)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}else{t(e.Alert,"errorColor",a.private_safeLighten(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeLighten(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeLighten(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeLighten(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-dark")),t(e.Alert,"infoFilledBg",u("palette-info-dark")),t(e.Alert,"successFilledBg",u("palette-success-dark")),t(e.Alert,"warningFilledBg",u("palette-warning-dark")),t(e.Alert,"errorFilledColor",I(()=>h.getContrastText(e.error.dark))),t(e.Alert,"infoFilledColor",I(()=>h.getContrastText(e.info.dark))),t(e.Alert,"successFilledColor",I(()=>h.getContrastText(e.success.dark))),t(e.Alert,"warningFilledColor",I(()=>h.getContrastText(e.warning.dark))),t(e.Alert,"errorStandardBg",a.private_safeDarken(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeDarken(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeDarken(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeDarken(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-900")),t(e.AppBar,"darkBg",u("palette-background-paper")),t(e.AppBar,"darkColor",u("palette-text-primary")),t(e.Avatar,"defaultBg",u("palette-grey-600")),t(e.Button,"inheritContainedBg",u("palette-grey-800")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-700")),t(e.Chip,"defaultBorder",u("palette-grey-700")),t(e.Chip,"defaultAvatarColor",u("palette-grey-300")),t(e.Chip,"defaultIconColor",u("palette-grey-300")),t(e.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),t(e.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),t(e.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeDarken(e.primary.main,.5)),t(e.LinearProgress,"secondaryBg",a.private_safeDarken(e.secondary.main,.5)),t(e.LinearProgress,"errorBg",a.private_safeDarken(e.error.main,.5)),t(e.LinearProgress,"infoBg",a.private_safeDarken(e.info.main,.5)),t(e.LinearProgress,"successBg",a.private_safeDarken(e.success.main,.5)),t(e.LinearProgress,"warningBg",a.private_safeDarken(e.warning.main,.5)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.13)`),t(e.Slider,"primaryTrack",a.private_safeDarken(e.primary.main,.5)),t(e.Slider,"secondaryTrack",a.private_safeDarken(e.secondary.main,.5)),t(e.Slider,"errorTrack",a.private_safeDarken(e.error.main,.5)),t(e.Slider,"infoTrack",a.private_safeDarken(e.info.main,.5)),t(e.Slider,"successTrack",a.private_safeDarken(e.success.main,.5)),t(e.Slider,"warningTrack",a.private_safeDarken(e.warning.main,.5));const p=a.private_safeEmphasize(e.background.default,.98);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>h.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-600")),t(e.StepContent,"border",u("palette-grey-600")),t(e.Switch,"defaultColor",u("palette-grey-300")),t(e.Switch,"defaultDisabledColor",u("palette-grey-600")),t(e.Switch,"primaryDisabledColor",a.private_safeDarken(e.primary.main,.55)),t(e.Switch,"secondaryDisabledColor",a.private_safeDarken(e.secondary.main,.55)),t(e.Switch,"errorDisabledColor",a.private_safeDarken(e.error.main,.55)),t(e.Switch,"infoDisabledColor",a.private_safeDarken(e.info.main,.55)),t(e.Switch,"successDisabledColor",a.private_safeDarken(e.success.main,.55)),t(e.Switch,"warningDisabledColor",a.private_safeDarken(e.warning.main,.55)),t(e.TableCell,"border",a.private_safeDarken(a.private_safeAlpha(e.divider,1),.68)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}F(e.background,"default"),F(e.background,"paper"),F(e.common,"background"),F(e.common,"onBackground"),F(e,"divider"),Object.keys(e).forEach(p=>{const _=e[p];_&&typeof _=="object"&&(_.main&&t(e[p],"mainChannel",a.private_safeColorChannel(W(_.main))),_.light&&t(e[p],"lightChannel",a.private_safeColorChannel(W(_.light))),_.dark&&t(e[p],"darkChannel",a.private_safeColorChannel(W(_.dark))),_.contrastText&&t(e[p],"contrastTextChannel",a.private_safeColorChannel(W(_.contrastText))),p==="text"&&(F(e[p],"primary"),F(e[p],"secondary")),p==="action"&&(_.active&&F(e[p],"active"),_.selected&&F(e[p],"selected")))})}),c=o.reduce((B,e)=>K(B,e),c);const g={prefix:S,shouldSkipGeneratingVar:b},{vars:w,generateCssVars:L}=wt(c,g);return c.vars=w,c.generateCssVars=L,c.shouldSkipGeneratingVar=b,c.unstable_sxConfig=C({},Ze,A==null?void 0:A.unstable_sxConfig),c.unstable_sx=function(e){return Le({sx:e,theme:this})},c}const Et=r=>[...[...Array(24)].map((o,n)=>`--${r?`${r}-`:""}overlays-${n+1}`),`--${r?`${r}-`:""}palette-AppBar-darkBg`,`--${r?`${r}-`:""}palette-AppBar-darkColor`],G={attribute:"data-mui-color-scheme",colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},It=Bt(),{CssVarsProvider:Ot,useColorScheme:Gt,getInitColorSchemeScript:Mt}=St({themeId:et,theme:It,attribute:G.attribute,colorSchemeStorageKey:G.colorSchemeStorageKey,modeStorageKey:G.modeStorageKey,defaultColorScheme:{light:G.defaultLightColorScheme,dark:G.defaultDarkColorScheme},resolveTheme:r=>{const o=C({},r,{typography:tt(r.palette,r.typography)});return o.unstable_sx=function(i){return Le({sx:i,theme:this})},o},excludeVariablesFromRoot:Et}),Wt=Mt;export{Ot as C,at as G,ut as T,Et as a,Bt as e,Wt as g,Tt as s,Gt as u};
@@ -1,3 +1,3 @@
1
- import{g as M}from"./react-BMZSDQJw.js";import{r as O}from"./index-V1lpWoC-.js";import{r as _}from"./dcl-schemas-BICTSpB5.js";function C(u,w){for(var m=0;m<w.length;m++){const f=w[m];if(typeof f!="string"&&!Array.isArray(f)){for(const h in f)if(h!=="default"&&!(h in u)){const v=Object.getOwnPropertyDescriptor(f,h);v&&Object.defineProperty(u,h,v.get?v:{enumerable:!0,get:()=>f[h]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var d={},F;function P(){if(F)return d;F=1,Object.defineProperty(d,"__esModule",{value:!0}),d.getHashesByKey=d.buildEntityWithoutNewFiles=d.buildEntity=d.buildEntityAndFile=void 0;const u=O(),w=_();async function m({type:n,pointers:t,timestamp:e,content:a,metadata:r}){var i;if(t.length===0)throw new Error("All entities must have at least one pointer.");const l={version:"v3",type:n,pointers:t,timestamp:e,content:a,metadata:r};if(a){const s=new Set;for(const b of a){const E=b.file.toLowerCase();if(s.has(E))throw new Error(`Error creating the deployable entity: Decentraland's file system is case insensitive, the file ${JSON.stringify(b.file)} is repeated`);s.add(E)}}const c=new TextEncoder().encode(JSON.stringify(l)),o={id:await(0,u.hashV1)(c),...l};if(!w.Entity.validate(o))throw new Error(`Generated entity is not valid:
1
+ import{g as M}from"./react-BrLDncxD.js";import{r as O}from"./index-BUzglYPe.js";import{r as _}from"./dcl-schemas-BICTSpB5.js";function C(u,w){for(var m=0;m<w.length;m++){const f=w[m];if(typeof f!="string"&&!Array.isArray(f)){for(const h in f)if(h!=="default"&&!(h in u)){const v=Object.getOwnPropertyDescriptor(f,h);v&&Object.defineProperty(u,h,v.get?v:{enumerable:!0,get:()=>f[h]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var d={},F;function P(){if(F)return d;F=1,Object.defineProperty(d,"__esModule",{value:!0}),d.getHashesByKey=d.buildEntityWithoutNewFiles=d.buildEntity=d.buildEntityAndFile=void 0;const u=O(),w=_();async function m({type:n,pointers:t,timestamp:e,content:a,metadata:r}){var i;if(t.length===0)throw new Error("All entities must have at least one pointer.");const l={version:"v3",type:n,pointers:t,timestamp:e,content:a,metadata:r};if(a){const s=new Set;for(const b of a){const E=b.file.toLowerCase();if(s.has(E))throw new Error(`Error creating the deployable entity: Decentraland's file system is case insensitive, the file ${JSON.stringify(b.file)} is repeated`);s.add(E)}}const c=new TextEncoder().encode(JSON.stringify(l)),o={id:await(0,u.hashV1)(c),...l};if(!w.Entity.validate(o))throw new Error(`Generated entity is not valid:
2
2
  `+((i=w.Entity.validate.errors)===null||i===void 0?void 0:i.map(s=>s.message).join(`
3
3
  `)));return{entity:o,entityFile:c}}d.buildEntityAndFile=m;async function f({type:n,pointers:t,files:e,metadata:a,timestamp:r}){const i=Array.from(e||[]).map(([o,s])=>({key:o,content:s})),l=await Promise.all(i.map(async({key:o,content:s})=>({key:o,content:s,hash:await(0,u.hashV1)(s)}))),c=new Map(l.map(({hash:o,key:s})=>[s,o])),y=new Map(l.map(({hash:o,content:s})=>[o,s]));return v(n,t,{hashesByKey:c,filesByHash:y,metadata:a,timestamp:r})}d.buildEntity=f;async function h(n,{contentUrl:t,type:e,pointers:a,hashesByKey:r,metadata:i,timestamp:l}){const c=r??i?p(i):void 0;if(c&&A(e,c)){const y=await D(n,t,c),o=await H(y,i);return f({type:e,pointers:a,files:y,metadata:o,timestamp:l})}return v(e,a,{hashesByKey:r,metadata:i,timestamp:l})}d.buildEntityWithoutNewFiles=h;async function v(n,t,e){if(t.length===0)throw new Error("All entities must have at least one pointer.");const a=e!=null&&e.hashesByKey?e==null?void 0:e.hashesByKey:new Map,r=Array.from(a.entries()).map(([o,s])=>({file:o,hash:s})),i=e!=null&&e.timestamp?e==null?void 0:e.timestamp:Date.now(),{entity:l,entityFile:c}=await m({type:n,pointers:t,timestamp:i,content:r,metadata:e==null?void 0:e.metadata}),y=e!=null&&e.filesByHash?e.filesByHash:new Map;return y.set(l.id,c),{files:y,entityId:l.id}}function A(n,t){return n===w.EntityType.PROFILE&&Array.from(t).some(([,e])=>e.toLowerCase().startsWith("qm"))}async function g(n,t){const a=await(await n.fetch(t)).arrayBuffer();return new Uint8Array(a)}async function D(n,t,e){const a=e.get("body.png"),r=e.get("face256.png"),i=new URL(`${t}/contents/${a}`).toString(),l=new URL(`${t}/contents/${r}`).toString(),[c,y]=await Promise.all([g(n,i),g(n,l)]);return new Map([["body.png",c],["face256.png",y]])}async function H(n,t){return t&&(t.avatars=await Promise.all(t.avatars.map(async e=>{const a={face256:"",body:""},r=n.get("face256.png");r&&(a.face256=await(0,u.hashV1)(r));const i=n.get("body.png");return i&&(a.body=await(0,u.hashV1)(i)),e.avatar.snapshots=a,e})),t)}function p(n){const t=n.avatars[0];if(t.avatar.snapshots)return new Map([["body.png",t.avatar.snapshots.body],["face256.png",t.avatar.snapshots.face256]])}return d.getHashesByKey=p,d}var B=P();const N=M(B),I=C({__proto__:null,default:N},[B]);export{I as D};
@@ -1 +1 @@
1
- import{j as r}from"./react-BMZSDQJw.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx("svg",{className:"error-notice__ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M12 2 1 21h22L12 2zm0 6a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1zm0 8.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5z"})}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
1
+ import{j as r}from"./react-BrLDncxD.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx("svg",{className:"error-notice__ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M12 2 1 21h22L12 2zm0 6a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1zm0 8.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5z"})}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-CFGfbV9-.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-DoxUiIoZ.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-B40OWK0h.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-KyO7a8ne.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
@@ -1 +1 @@
1
- import{u as Y,a as $,r as i,j as e}from"./react-BMZSDQJw.js";import{u as H,t as s,g as Q,j as V,q as g,C as d,x as P,r as I,l as W,m as z}from"./index-V0hMC6mZ.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-CLMqKMCz.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-BJp5mEnq.js";import{C as te}from"./CircularProgress-DVvK_YYJ.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-8SzFotJj.js";import"./ethers-Dpp9c5As.js";import"./intl-CBcMB1D2.js";const x="https://cdn.decentraland.org/@dcl/shop/0.1.0-29941568358.commit-de47e56/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29941568358.commit-de47e56/assets/credit-coin-CmcTCd5i.webp",ae="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",C=se()?"mock":"stripe",ce={pack_5:x,pack_10:x,pack_25:x,pack_50:x},ne="https://docs.decentraland.org";function M(o){const r=o;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const o=Y(),{session:r,signIn:m}=Q(),n=V(),[k,S]=$(),{packs:F,isLoading:T}=Z(),[p,l]=i.useState("select"),[c,w]=i.useState(null),[E,R]=i.useState(null),[U,_]=i.useState(null),[K,N]=i.useState(!1),f=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=f.current)==null?void 0:t.abort()},[]);const L=i.useCallback(()=>{S(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[S]),b=i.useCallback(async t=>{l("processing");const a=new AbortController;f.current=a;try{const u=await X(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const j=u.creditsGranted??(c==null?void 0:c.credits)??0;R(j>0?j:null),l("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:j>0?j:null,provider:C}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){o("/cart",{state:{resumeCheckout:!0}});return}}catch{}try{const A=sessionStorage.getItem(G);if(A){sessionStorage.removeItem(G);const h=JSON.parse(A),B=h.tokenId??h.itemId;if(h.contractAddress&&B){o(`/item/${h.contractAddress}/${B}`,{state:{item:h,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),l("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),_(u.error??s("getCredits.errorGrant",{currency:d.name})),l("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(c==null?void 0:c.usd)??null}),_(M(u)),l("error")}},[c,r,n,o]),q=i.useCallback(async t=>{if(!r){m();return}_(null),N(!1),w(t),l(C==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:C});try{const a=await ee(t.id,{address:r.address,identity:r.identity});if(a.mock)b(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){P(a,{flow:"get_credits",step:"checkout",provider:C}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),_(M(a)),l("error")}},[r,m,b]),y=i.useRef(!1);i.useEffect(()=>{if(y.current)return;const t=k.get("order");if(k.get("canceled")!=null){y.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:C}),L(),N(!0),l("select");return}t&&(l("processing"),r&&(y.current=!0,L(),b(t)))},[k,r]);function v(){var t;(t=f.current)==null||t.abort(),l("select"),w(null),R(null),_(null),N(!1)}const O=p==="select";return e.jsxs("div",{className:"getcredits",children:[O&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void q(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ae,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),E!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:E,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>o("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>o("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:v,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:o,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:o.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ce[n.id]??x,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
1
+ import{a as $,b as q,r as i,j as e}from"./react-BrLDncxD.js";import{u as H,t as s,d as Q,o as V,x as g,C as d,E as P,y as I,h as W,r as z}from"./index-CJ4mXolB.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-CifIjL1z.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-DO-uyk4N.js";import{C as te}from"./CircularProgress-BivMeg1W.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";const x="https://cdn.decentraland.org/@dcl/shop/0.1.0-29942574523.commit-573f25e/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29942574523.commit-573f25e/assets/credit-coin-CmcTCd5i.webp",ae="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",C=se()?"mock":"stripe",ce={pack_5:x,pack_10:x,pack_25:x,pack_50:x},ne="https://docs.decentraland.org";function M(l){const r=l;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[k,S]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[c,w]=i.useState(null),[E,R]=i.useState(null),[U,_]=i.useState(null),[K,N]=i.useState(!1),f=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=f.current)==null?void 0:t.abort()},[]);const L=i.useCallback(()=>{S(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[S]),b=i.useCallback(async t=>{o("processing");const a=new AbortController;f.current=a;try{const u=await X(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const j=u.creditsGranted??(c==null?void 0:c.credits)??0;R(j>0?j:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:j>0?j:null,provider:C}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){l("/cart",{state:{resumeCheckout:!0}});return}}catch{}try{const A=sessionStorage.getItem(G);if(A){sessionStorage.removeItem(G);const h=JSON.parse(A),B=h.tokenId??h.itemId;if(h.contractAddress&&B){l(`/item/${h.contractAddress}/${B}`,{state:{item:h,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),_(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(c==null?void 0:c.usd)??null}),_(M(u)),o("error")}},[c,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}_(null),N(!1),w(t),o(C==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:C});try{const a=await ee(t.id,{address:r.address,identity:r.identity});if(a.mock)b(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){P(a,{flow:"get_credits",step:"checkout",provider:C}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),_(M(a)),o("error")}},[r,m,b]),y=i.useRef(!1);i.useEffect(()=>{if(y.current)return;const t=k.get("order");if(k.get("canceled")!=null){y.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:C}),L(),N(!0),o("select");return}t&&(o("processing"),r&&(y.current=!0,L(),b(t)))},[k,r]);function v(){var t;(t=f.current)==null||t.abort(),o("select"),w(null),R(null),_(null),N(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ae,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),E!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:E,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:v,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ce[n.id]??x,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
@@ -1,4 +1,4 @@
1
- import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-FFhK2B90.js";import{d as g,r as v}from"./index-DoxUiIoZ.js";import{C as c}from"./ConstantsUtil-CPwpahR3.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CFGfbV9-.js";import{au as y}from"./NetworkUtil-CM7JZPbs.js";const b=g`
1
+ import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-CqYieDft.js";import{d as g,r as v}from"./index-KyO7a8ne.js";import{C as c}from"./ConstantsUtil-DO6FyoSW.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-B40OWK0h.js";import{au as y}from"./NetworkUtil-BGlQiKvg.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import{u as K,r as u,j as e,L as B}from"./react-BMZSDQJw.js";import{J as $,t as s,C as w,B as k,l as L,q as P,x as A,u as U,g as W,j as O,e as z,s as Q,E as J}from"./index-V0hMC6mZ.js";import{i as Y,R as D,f as G}from"./import-D2QUSpyp.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-8SzFotJj.js";import"./ethers-Dpp9c5As.js";import"./intl-CBcMB1D2.js";import"./buy-CN2rC9a0.js";import"./authorizations-CsduRV0X.js";import"./index-HN6Rk25C.js";import"./trade-encoding-vTSEXgN1.js";import"./mana-rate-CFrZfrxV.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
1
+ import{a as K,r as u,j as e,L as B}from"./react-BrLDncxD.js";import{e as $,t as s,C as w,B as k,h as L,x as P,E as A,u as U,d as W,o as O,m as z,s as Q,J}from"./index-CJ4mXolB.js";import{i as Y,R as D,f as G}from"./import-CyzZeEcP.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";import"./buy-BRLq1STf.js";import"./authorizations-sU14ILrd.js";import"./index-HN6Rk25C.js";import"./trade-encoding-0IFZ39Tk.js";import"./mana-rate-DtQ8WpoI.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
2
2
  margin-top: 10px;
3
3
  `,V=Q(k)`
4
4
  padding: 13px 24px;
@@ -0,0 +1,78 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-fvb_2ePt.js","assets/react-BrLDncxD.js","assets/dcl-schemas-BICTSpB5.js","assets/index-CJ4mXolB.js","assets/sentry-DYZXk5O5.js","assets/ethers-CLB2z3On.js","assets/intl-CBcMB1D2.js","assets/index-CqYr0ABc.css","assets/emotion-styled.browser.esm-B6FBNgF3.js","assets/useTheme-BHtz4hyG.js","assets/CircularProgress-BivMeg1W.js","assets/index-BlKccc7B.js","assets/useTheme-Ciqd957r.js","assets/CssVarsProvider-C0ny30E-.js","assets/getOverlayAlpha-Jb_9sPPd.js","assets/index-BgMPhDEY.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
2
+ import{a as pe,r as c,j as e,d as ha,u as _a,L as ya}from"./react-BrLDncxD.js";import{d as Y,n as pa,o as Ge,t,ai as fa,i as ba,b as xa,w as ja,q as ie,x as V,y as Re,z as _e,aj as va,E as le,h as M,j as ne,_ as ye,an as ga,ax as Na,ay as wa,az as ka,aA as Ia,c as fe,aB as Ca,a6 as He,m as R,aC as Aa,I as F,F as O,s as z,aD as Sa,aE as Ma,aF as Pa,G as Ea,af as qe,a as $e,aG as Fa,aH as La,aI as Da,aJ as Ta,aK as Ba,ag as Ra,u as qa,aL as $a,aM as Oa,aN as za,g as Ka,aO as Oe,aP as Wa,B as be,f as Va,J as Qa,ao as Ua,aQ as Ga,aR as Ha,ap as Ja,aS as Ya,aT as Za}from"./index-CJ4mXolB.js";import{d as Q}from"./dcl-schemas-BICTSpB5.js";import{b as ze,c as Xa}from"./buy-BRLq1STf.js";import{S as et,P as at,f as tt}from"./PrimaryListModal-CnlMOkG5.js";import{g as st,b as it,w as rt,S as nt,G as lt}from"./buy-gasless-hR2bH0iR.js";import{u as dt,c as ot}from"./useCreditPacks-DO-uyk4N.js";import{R as Ke}from"./resume-buy-Bf0zIH7y.js";import{a as ct,f as We,i as mt}from"./errors-DKFg2ql0.js";import{E as xe}from"./ErrorNotice-BDH9xoG4.js";import{l as ut}from"./loader-logo-BzY9EKdC.js";import{C as ht}from"./CircularProgress-BivMeg1W.js";import{u as _t,M as yt}from"./MarketCheckout-DSl7Bl-M.js";import{s as pt}from"./address-DrURAr9O.js";import{C as ft}from"./CollectionCarousel-D_udpdxX.js";import{T as Je}from"./Tooltip-DJ7HtAmB.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";import"./authorizations-sU14ILrd.js";import"./index-HN6Rk25C.js";import"./trade-encoding-0IFZ39Tk.js";import"./mana-rate-DtQ8WpoI.js";import"./emotion-CSxEP8yM.js";function bt({item:s,onClose:n,resume:r=!1}){var X,ee;const{session:d}=Y(),{data:o}=pa(d),h=Ge(),g=pe(),j=dt().packs.slice(0,3),[m,l]=c.useState("loading"),[a,N]=c.useState(null),[p,w]=c.useState(""),[L,b]=c.useState(s.priceCredits),[f,D]=c.useState(null),P=c.useRef(null),A=(f==null?void 0:f.credits)??L,Z=(o==null?void 0:o.credits)??0;c.useEffect(()=>{let u=!1;if(!d){l("error"),N(t("buyModal.signInToCheckout"));return}const k=_=>{const I=_-((o==null?void 0:o.credits)??0),x=j.find(T=>T.credits>=I)??j[j.length-1];w(x.id),V("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:_,credits_balance:(o==null?void 0:o.credits)??0,shortfall:Math.max(0,I)}),l("nofunds")};return(async()=>{var _,I;try{const x=await fa(s);if(!x)throw new Error("not for sale");if(ba(x,d.address))throw new Error("You can't buy your own listing.");const T=xa((I=(_=x.received)==null?void 0:_[0])==null?void 0:I.amount);if(!Number.isFinite(T)||T<=0)throw new Error("price unavailable");const K=Math.ceil(T/10);if(u)return;if(b(K),o!=null&&o.credits<K){k(K);return}try{const{credit:C,maxCreditedValue:G,usdCents:$}=await ja(d.identity,T,x.id);if(u){ie(d.identity,[C.id]).catch(()=>{});return}P.current=C.id;const ae=Math.ceil($/10);b(ae);const W={trade:x,credit:C,maxCreditedValue:G,usdCents:$,credits:ae};D(W),r?U(W):l("ready")}catch(C){if(u)return;if(ct(C)){k(K);return}throw C}}catch(x){if(u)return;V(_e(x)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:Re(x)}),l("error"),N(We(x,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{u=!0,P.current&&d&&(ie(d.identity,[P.current]).catch(()=>{}),P.current=null)}},[]);async function U(u=f){if(!d||!u)return;l("processing"),N(null);let k=!1;try{const _={trade:u.trade,buyer:d.address,signer:d.signer,credits:[u.credit],maxCreditedValue:u.maxCreditedValue};let I;if(st())try{I=await it(_),await rt(I),k=!0}catch(x){if(x instanceof nt)k=!0;else if(x instanceof lt)I=await ze(_);else throw x}else I=await ze(_);P.current=null,V("Shop Completed Purchase",{...va([s]),payment_type:"credits",no_crypto_step:k,transaction_hash:I??null}),h.invalidateQueries({queryKey:["usd-balance"]}),l("complete")}catch(_){_e(_)||le(_,{flow:"buy",step:"submit",gasless:k}),ie(d.identity,[u.credit.id]).catch(()=>{}),P.current=null,V(_e(_)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:Re(_)}),h.invalidateQueries({queryKey:["usd-balance"]}),N(We(_,t("buyModal.error.generic"),{sale:!0})),l("error")}}async function de(){if(!(!p||!d)){try{sessionStorage.setItem(Ke,JSON.stringify(s))}catch{}f&&ie(d.identity,[f.credit.id]).catch(()=>{}),P.current=null,l("loading");try{const u=await ot(p,{address:d.address,identity:d.identity});if(u.url){window.location.href=u.url;return}g("/credits")}catch(u){le(u,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Ke)}catch{}N(t("buyModal.error.creditsCheckout")),l("error")}}}const q=m==="processing",E=m==="complete"?t("buyModal.titleComplete"):m==="nofunds"?t("buyModal.titleNoFunds"):t("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:s.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:q?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${m==="processing"||m==="loading"?" 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:E}),!q&&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:m==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(M,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:ne(Z)})]})]}),m==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(ht,{size:44})}),m==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(xe,{message:a}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:n,children:t("buyModal.close")})})]}),m==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),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,A-Z)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Ve,{item:s,priceCredits:A}),e.jsx("div",{className:"buy-modal__packs",children:j.map(u=>{const k=u.credits,_=u.id===p;return e.jsxs("button",{className:`buy-modal__pack${_?" buy-modal__pack--on":""}`,onClick:()=>w(u.id),children:[e.jsx(M,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:ne(k)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",u.usd.toFixed(2),")"]})]},u.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(M,{className:"buy-modal__total-ico"}),e.jsx("span",{children:ne(((X=j.find(u=>u.id===p))==null?void 0:X.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((ee=j.find(u=>u.id===p))==null?void 0:ee.usd)??0).toFixed(2)]})]}),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--gradient",onClick:()=>void de(),children:t("buyModal.buy")})]})]}),m==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Ve,{item:s,priceCredits:A}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void U(),children:t("buyModal.buy")})})]}),m==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ut,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:r?t("buyModal.completingPurchase"):t("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),m==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:t("getCredits.successTitle")})," ",t("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>g("/assets?tab=mine"),children:t("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:n,children:[t("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function Ve({item:s,priceCredits:n}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:s.name,children:s.name||t("buyModal.itemFallback")}),s.creator?e.jsx("div",{className:"buy-modal__asset-creator",children:t("search.byCreator",{name:s.creator})}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(M,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:ne(n)})]})]})]})}const xt=c.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:n},{light:r}]=await Promise.all([ye(()=>import("./index-fvb_2ePt.js").then(d=>d.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),ye(()=>import("./index-BlKccc7B.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),ye(()=>import("./index-BgMPhDEY.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:d=>e.jsx(n,{theme:r,children:e.jsx(s,{...d})})}});function jt(s){return e.jsx(c.Suspense,{fallback:null,children:e.jsx(xt,{...s})})}function vt({item:s}){const n=Y(f=>{var D;return(D=f.session)==null?void 0:D.address}),{data:r,isLoading:d}=ga(n),o=n&&r?n:"default",h=s.category==="emote",[g,j]=c.useState("item"),m=!h&&g==="item",l=m||!d,[a,N]=c.useState(!0);c.useEffect(()=>{N(!0)},[s.id,m]);const p=!!n&&!!r,w=p&&Na(s,wa(r)),L=ka(s)[0],b=p&&!w&&!h;return e.jsxs(e.Fragment,{children:[l?e.jsx(Ia,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:m?void 0:w?o:"default",bodyShape:m||w?void 0:L,type:h?void 0:m?Q.PreviewType.WEARABLE:Q.PreviewType.AVATAR,emote:h||m?void 0:Q.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:h?1.5:void 0,wheelStart:h?100:void 0,dev:fe.chainId===80002,onLoad:()=>N(!1)}):null,!l||a?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,b&&!m?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Ca(L)})}):null,h?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(jt,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":t("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:g==="avatar"?"is-active":"","aria-pressed":g==="avatar","aria-label":t("itemPreview.onAvatar"),onClick:()=>j("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:g==="item"?"is-active":"","aria-pressed":g==="item","aria-label":t("itemPreview.item"),onClick:()=>j("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.item")})]})]})]})}function Ye(){return fe.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function gt(s,n,r){const d=new URLSearchParams({contractAddress:s,itemId:n}),o=`${Ye()}/notify-requests?${d.toString()}`,h=await He(o,{method:"GET",identity:r,metadata:{}});if(!h.ok)throw new Error(`getNotifyRequest ${h.status}`);return h.json()}async function Nt(s,n){const r=`${Ye()}/notify-requests`,d=await He(r,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!d.ok)throw new Error(`createNotifyRequest ${d.status}: ${await d.text()}`);await d.json().catch(()=>{})}function Qe(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function wt({item:s}){const n=Y(b=>b.session),r=Y(b=>b.signIn),[d,o]=c.useState(""),[h,g]=c.useState(!1),[j,m]=c.useState(!1),[l,a]=c.useState(null),N=!!n&&!!s.contractAddress&&!!s.itemId,{data:p}=R({queryKey:["notify-request",s.contractAddress,s.itemId,n==null?void 0:n.address],enabled:N,queryFn:()=>gt(s.contractAddress,s.itemId,n.identity)});c.useEffect(()=>{p!=null&&p.email&&o(b=>b||p.email)},[p==null?void 0:p.email]),c.useEffect(()=>{if(!n)return;let b=!1;return Aa().then(f=>{!b&&f&&o(D=>D||f)}),()=>{b=!0}},[n]);const w=j||!!(p!=null&&p.subscribed);async function L(b){if(b.preventDefault(),!(!n||!s.itemId||!Qe(d)||h)){g(!0),a(null);try{await Nt({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:d.trim()},n.identity),m(!0)}catch(f){le(f,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),a(t("notifyMe.error"))}finally{g(!1)}}}return n?w?e.jsxs("div",{className:"notify notify__done","data-testid":"notify-subscribed",children:[e.jsx("span",{className:"notify__done-check","aria-hidden":!0,children:e.jsx(F,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:L,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:t("notifyMe.label")}),e.jsxs("div",{className:"notify__row",children:[e.jsx("input",{id:"notify-email",className:"notify__input",type:"email",inputMode:"email",autoComplete:"email",placeholder:t("notifyMe.placeholder"),value:d,onChange:b=>o(b.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!Qe(d)||h,"data-testid":"notify-submit",children:h?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(xe,{message:l})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:r,"data-testid":"notify-signin",children:t("notifyMe.signInCta")})})}const kt=z.button`
3
+ display: flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ gap: 8px;
7
+ width: 100%;
8
+ height: 40px;
9
+ padding: 0 12px;
10
+ border: 2px solid #c640cd;
11
+ border-radius: 8px;
12
+ background: transparent;
13
+ color: ${O.colors.accent};
14
+ font-family: ${O.font.sans};
15
+ font-weight: 600;
16
+ font-size: 15px;
17
+ line-height: 24px;
18
+ letter-spacing: 0.46px;
19
+ text-transform: uppercase;
20
+ cursor: not-allowed;
21
+ opacity: 0.55;
22
+ transition: opacity 0.15s ease;
23
+
24
+ &:hover,
25
+ &:focus-visible {
26
+ opacity: 0.75;
27
+ }
28
+ &:focus-visible {
29
+ outline: 2px solid ${O.colors.accent};
30
+ outline-offset: 2px;
31
+ }
32
+ `;function It({item:s}){return e.jsx(Je,{block:!0,content:t("makeOffer.comingSoon"),onShow:()=>V("Shop Make Offer Tooltip Shown",{contractAddress:s.contractAddress,itemId:s.itemId}),children:e.jsxs(kt,{type:"button","aria-disabled":!0,onClick:n=>n.preventDefault(),"data-testid":"make-offer",children:[e.jsx(F,{name:"offer",size:20,"aria-hidden":!0}),e.jsx("span",{children:t("makeOffer.cta")})]})})}const Ct=z(Sa)`
33
+ display: flex;
34
+ flex-direction: column;
35
+ overflow: hidden;
36
+ gap: 1px;
37
+ background: ${O.colors.lineStrong};
38
+ `;function At({contractAddress:s,name:n,items:r,className:d}){const o=pe();if(!s||!n)return null;const h=(r??[]).map(m=>m.thumbnail).filter(m=>!!m).slice(0,4),g=h.slice(0,2),j=h.slice(2,4);return e.jsxs(Ma,{as:"button","data-link":!0,className:d,"data-testid":"creator",onClick:m=>{m.stopPropagation(),o(`/collection/${s}`)},children:[h.length>0?e.jsxs(Ct,{as:"span","data-avatar":!0,"data-testid":"creator-ava","aria-hidden":!0,children:[e.jsx("span",{className:`collection-collage__row${j.length===0?" collection-collage__row--full":""}`,children:g.map((m,l)=>e.jsx("img",{src:m,alt:""},l))}),j.length>0?e.jsx("span",{className:"collection-collage__row",children:j.map((m,l)=>e.jsx("img",{src:m,alt:""},l))}):null]}):null,e.jsx(Pa,{"data-testid":"creator-name",children:Ea(n)})]})}const St=z(be)`
39
+ margin-top: 6px;
40
+ `,re=z(be)`
41
+ && {
42
+ width: 100%;
43
+ height: 48px;
44
+ font-size: 15px;
45
+ font-weight: 600;
46
+ letter-spacing: 0.46px;
47
+ display: flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ gap: 8px;
51
+ }
52
+
53
+ ${O.media.down("lg")} {
54
+ .item-detail__ctas--dual && {
55
+ flex: 1 1 auto;
56
+ width: auto;
57
+ }
58
+ }
59
+ `,Mt=z("div")`
60
+ display: flex;
61
+ flex-direction: column;
62
+ gap: 10px;
63
+ width: 100%;
64
+ `,Pt=z(be)`
65
+ && {
66
+ width: 100%;
67
+ height: 44px;
68
+ }
69
+ `,Et=z("p")`
70
+ margin: 4px 0 0;
71
+ font-size: 13px;
72
+ color: ${O.colors.muted};
73
+
74
+ a {
75
+ color: ${O.colors.accent};
76
+ font-weight: 600;
77
+ }
78
+ `;function Ft(s){return Object.values(Q.Rarity).includes(s)}function Lt(s){return s==="male"?t("itemDetail.genderMale"):s==="female"?t("itemDetail.genderFemale"):s==="unisex"?t("itemDetail.genderUnisex"):null}function Ue(s){return s.wearableCategory?s.wearableCategory.replace(/_/g," "):s.category==="emote"?t("itemDetail.categoryEmote"):t("itemDetail.categoryWearable")}function ls(){var Te;const{contractAddress:s,tokenId:n}=ha(),{state:r}=_a(),d=pe(),o=!!(r!=null&&r.market),h=(r==null?void 0:r.marketPriceCredits)??null,g=qe(i=>i.add),j=qe(i=>i.items),m=$e(i=>i.toggle),{session:l}=Y(),[a,N]=c.useState(()=>r!=null&&r.item?{...r.item,tradeId:r.tradeId??r.item.tradeId}:{id:`${s}-${n}`,name:"",creator:"",contractAddress:s??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:fe.chainId,thumbnail:"",priceCredits:0,gender:null,isSmart:!1,tokenId:n??void 0,tradeId:r==null?void 0:r.tradeId}),[p,w]=c.useState(!1),[L,b]=c.useState(!!(r!=null&&r.resumeBuy));c.useEffect(()=>{r!=null&&r.resumeBuy&&w(!0)},[r==null?void 0:r.resumeBuy]);const{data:f=[],isFetched:D}=R({queryKey:["collection-items",a.contractAddress],enabled:!!a.contractAddress,queryFn:()=>Ua(a.contractAddress,{first:20}).then(i=>i.items)}),P=a.available==null&&!a.tokenId,{data:A,isLoading:Z}=R({queryKey:["shop-item",a.contractAddress,n],enabled:!o&&!!a.contractAddress&&!!n&&(!(r!=null&&r.item)||P),queryFn:()=>Ga(a.contractAddress,n)});c.useEffect(()=>{A&&N(i=>i.tradeId?i.available!=null&&i.wearableCategory?i:{...i,available:i.available??A.available,wearableCategory:i.wearableCategory??A.wearableCategory}:{...A})},[A]);const[U,de]=c.useState(!1),{data:q=""}=R({queryKey:["item-desc",a.contractAddress,a.itemId],enabled:!!a.contractAddress&&!!a.itemId,staleTime:5*6e4,queryFn:()=>Ha(a.contractAddress,a.itemId)}),{data:E}=R({queryKey:["collection-meta",a.contractAddress],enabled:!!a.contractAddress,staleTime:5*6e4,queryFn:()=>Ja(a.contractAddress)});c.useEffect(()=>{if(a.name||A||f.length===0)return;const i=n&&f.find(v=>v.tokenId===n||v.itemId===n)||f.find(v=>v.contractAddress===a.contractAddress);i&&N(v=>({...i,tradeId:v.tradeId??i.tradeId}))},[f,A]);const X=c.useMemo(()=>{const i=new Set,v=[];for(const S of f){if(S.id===a.id||a.itemId&&S.itemId===a.itemId||a.tokenId&&S.tokenId===a.tokenId)continue;const Be=`${S.contractAddress}-${S.itemId??S.tokenId??S.id}`;i.has(Be)||(i.add(Be),v.push(S))}return v},[f,a.id,a.itemId,a.tokenId]),{data:ee,isLoading:u}=R({queryKey:["detail-trade",a.id,a.tradeId,a.contractAddress,a.itemId],enabled:!!a.contractAddress,queryFn:async()=>{if(a.tradeId)return a.tradeId;if(a.itemId){const i=await Ya(a.contractAddress,a.itemId);return(i==null?void 0:i.id)??null}return null}}),k=a.tradeId??ee??void 0,_=!!k,{data:I}=_t(o),x=c.useMemo(()=>{if(!o||!(r!=null&&r.item))return null;const i=r.item;return i.manaWei?{tradeId:i.tradeId??i.id,listingType:"primary",contractAddress:i.contractAddress,itemId:i.itemId??"",name:i.name,thumbnail:i.thumbnail,rarity:i.rarity,category:i.category,wearableCategory:i.wearableCategory??null,creator:i.creator,manaWei:i.manaWei,available:1,network:i.network,chainId:i.chainId,createdAt:0}:null},[o,r==null?void 0:r.item]),T=o&&h!=null&&!!I&&!!x,K=Fa({priceCredits:a.priceCredits,compareAtCredits:a.compareAtCredits,saleEndsAt:a.saleEndsAt}),C=c.useMemo(()=>({...a,tradeId:k,id:k??a.id}),[a,k]),G=j.some(i=>i.id===C.id),$=!C.tokenId,ae=((Te=j.find(i=>i.id===C.id))==null?void 0:Te.quantity)??0,W=$&&typeof a.available=="number"&&ae>=a.available,B=$e(i=>!!i.items[a.id]),je=c.useRef(null);c.useEffect(()=>{!a.name||u||je.current===a.id||(je.current=a.id,V("Shop Viewed Item",{...La(a),for_sale:_}),Da(a))},[a.id,a.name,u,_]);const te=`${s}/${n}`,ve=c.useRef(te);c.useEffect(()=>{ve.current!==te&&(ve.current=te,r!=null&&r.item&&N({...r.item,tradeId:r.tradeId??r.item.tradeId}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"}))},[te]);function Ze(){!_||ce||u||!$&&G||W||g(C,"item_detail")}const oe=Ft(a.rarity)?a.rarity:Q.Rarity.COMMON,ge=Lt(a.gender),Ne=Ta(a),we=Ba(a.gender),Xe=_&&K,ea=t("itemDetail.moreFromCollection"),ce=Ra(a,l==null?void 0:l.address),se=Ge(),[aa,ke]=c.useState(!1),[ta,Ie]=c.useState(!1),[H,Ce]=c.useState(!1),[sa,Ae]=c.useState(null),{data:y,isLoading:ia}=R({queryKey:["owned-token",a.contractAddress,a.tokenId,l==null?void 0:l.address],enabled:!o&&!!(l!=null&&l.address)&&!!a.contractAddress&&!!a.tokenId,queryFn:()=>l?Za(l.address,a.contractAddress,a.tokenId):null});c.useEffect(()=>{y&&N(i=>i.name?i.issuedId?i:{...i,issuedId:y.issuedId}:{id:y.id,name:y.name,creator:"",contractAddress:y.contractAddress,itemId:y.itemId,category:y.category,rarity:y.rarity??"common",network:y.network,chainId:y.chainId,thumbnail:y.image,priceCredits:y.listingPrice??0,gender:null,isSmart:!1,tokenId:y.tokenId,issuedId:y.issuedId,tradeId:y.tradeId})},[y]);const{data:me}=R({queryKey:["publishable-item",a.contractAddress,a.itemId,l==null?void 0:l.address],enabled:ce&&!!l&&!!a.itemId,queryFn:async()=>l?(await tt(l.address,l.identity)).find(v=>v.contractAddress.toLowerCase()===a.contractAddress.toLowerCase()&&v.blockchainItemId===a.itemId)??null:null}),J=!!y,ue=!o&&(ce||J),ra=J?!!(y!=null&&y.isOnSale):_,he=J?y==null?void 0:y.tradeId:k,Se=J?!!y:!!me;async function Me(){await Promise.all([se.invalidateQueries({queryKey:["owned-token",a.contractAddress,a.tokenId]}),se.invalidateQueries({queryKey:["detail-trade"]}),se.invalidateQueries({queryKey:["shop-item"]}),se.invalidateQueries({queryKey:["collection-sale-state"]})])}async function Pe(i={}){if(!l||!he)return!1;Ae(null),Ce(!0);try{const v=await Va(he);return await Xa({trade:v,signer:l.signer}),i.silent||Qa.success(t("myAssets.removedFromSale",{name:a.name})),await Me(),!0}catch(v){const S=mt(v);return S||le(v,{flow:"remove-listing",tradeId:he}),Ae(S?t("getCredits.errorCanceled"):t("myAssets.removeListingError")),!1}finally{Ce(!1)}}function Ee(){J?ke(!0):Ie(!0)}async function na(){await Pe({silent:!0})&&Ee()}function Fe(){ke(!1),Ie(!1),Me()}const Le=_?u?t("itemDetail.checking"):W?t("itemDetail.maxInCart"):!$&&G?t("assetCard.inCart"):t("assetCard.addToCart"):t("itemDetail.notForSale"),la=typeof a.available=="number"&&a.available>0&&!a.tokenId&&!o,da=!o&&!a.tokenId&&a.available===0,oa=!ue&&_&&!o,ca=o||!ue,ma=Z||!!a.contractAddress&&!D||!a.name&&ia,De=!a.name&&!ma,ua=/^https?:\/\//i.test(a.thumbnail);return qa(De?{title:t("seo.item.notFoundTitle"),noindex:!0}:a.name?{title:a.name,description:q||t("seo.item.fallbackDescription",{name:a.name,rarity:a.rarity,category:Ue(a),creator:pt(a.creator)}),image:ua?a.thumbnail:void 0,type:"product"}:{}),De?e.jsxs("div",{className:"item-detail item-detail--notfound",children:[e.jsx(F,{name:"cart",className:"item-detail__notfound-ico"}),e.jsx("h1",{className:"item-detail__notfound-title",children:t("itemDetail.notAvailableTitle")}),e.jsx("p",{className:"muted",children:t("itemDetail.notAvailableBody")}),e.jsx(St,{variant:"purple",onClick:()=>d("/assets"),children:t("notFound.cta")})]}):e.jsxs("div",{className:"item-detail",children:[e.jsxs("nav",{className:"item-detail__crumbs","aria-label":t("itemDetail.breadcrumbAria"),children:[e.jsx("button",{className:"item-detail__crumb-link",onClick:()=>d("/assets"),children:t("nav.collectibles")}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children:a.name||t("itemDetail.itemFallback")})]}),e.jsxs("div",{className:"item-detail__main",children:[e.jsxs("div",{className:"item-detail__preview","data-testid":"item-preview",children:[a.name?e.jsx(vt,{item:a}):e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"skeleton item-preview__skeleton","aria-hidden":!0})}),e.jsx("button",{className:`item-detail__fav item-detail__fav--preview${B?" is-on":""}`,onClick:()=>m(a),"aria-pressed":B,"aria-label":B?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(F,{name:B?"heart-solid":"heart",size:18})})]}),e.jsx("div",{className:"item-detail__info",children:a.name?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"item-detail__info-head",children:[e.jsx("h1",{className:"item-detail__title",children:a.name}),e.jsx("button",{className:`item-detail__fav${B?" is-on":""}`,onClick:()=>m(a),"aria-pressed":B,"aria-label":B?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(F,{name:B?"heart-solid":"heart",size:18})})]}),e.jsxs("div",{className:"item-detail__chips",children:[e.jsx("span",{className:"chip chip--rarity",style:{background:za(oe),color:Oa(oe)},title:$a(a.rarity),children:a.rarity}),e.jsxs("span",{className:"chip item-detail__chip",children:[Ne?e.jsx(F,{name:Ne,size:18,color:"var(--text-2)"}):null,Ue(a)]}),ge?e.jsxs("span",{className:"chip item-detail__chip",children:[we?e.jsx(F,{name:we,size:18,color:"var(--text-2)"}):null,ge]}):null,a.issuedId?e.jsxs("span",{className:"chip item-detail__chip","data-testid":"detail-issued",children:["#",a.issuedId]}):null]}),q?e.jsxs("div",{className:"item-detail__section item-detail__description",children:[e.jsx("div",{className:"item-detail__label",children:t("itemDetail.description")}),e.jsx("p",{className:`item-detail__desc-text${U?" is-expanded":""}`,children:q}),q.length>140?e.jsx("button",{className:"link item-detail__desc-toggle",onClick:()=>de(i=>!i),children:U?t("itemDetail.showLess"):t("itemDetail.readMore")}):null]}):null,a.creator||E!=null&&E.name?e.jsxs("div",{className:"item-detail__meta",children:[a.creator?e.jsxs("div",{className:"item-detail__meta-col",children:[e.jsx("div",{className:"item-detail__label",children:t("itemDetail.creator")}),e.jsx(Ka,{address:a.creator,className:"item-detail__creator",linkToProfile:!0,hidePrefix:!0})]}):null,E!=null&&E.name?e.jsxs("div",{className:"item-detail__meta-col item-detail__meta-col--collection",children:[e.jsx("div",{className:"item-detail__label",children:t("itemDetail.collection")}),e.jsx(At,{contractAddress:a.contractAddress,name:E.name,items:f,className:"item-detail__creator"})]}):null]}):null,e.jsx("hr",{className:"item-detail__divider"}),e.jsx("div",{className:"item-detail__price-block",children:e.jsxs("div",{className:"item-detail__price-row",children:[e.jsxs("div",{className:"item-detail__price-col",children:[o||_?e.jsx("div",{className:"item-detail__price-label",children:t("itemDetail.price")}):null,o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"item-detail__price item-detail__price--market",children:h==null?e.jsx("span",{className:"item-detail__price-value",children:"—"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"item-detail__approx","aria-hidden":!0,children:"≈"}),e.jsx(M,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:h})]})}),e.jsx("div",{className:"item-detail__market-note muted",children:t("assetCard.marketPrice")})]}):_?Xe?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(M,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:a.priceCredits})]}),e.jsxs("span",{className:"item-detail__price-was",children:[e.jsx(M,{className:"item-detail__diamond item-detail__diamond--was"}),a.compareAtCredits]}),Oe(a.compareAtCredits,a.priceCredits)>0?e.jsx("span",{className:"item-detail__sale-badge",children:t("assetCard.saleWithDiscount",{pct:Oe(a.compareAtCredits,a.priceCredits)})}):null,e.jsx(Wa,{endsAt:a.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(M,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:a.priceCredits})]}):e.jsxs("div",{className:"item-detail__price item-detail__price--none",children:[e.jsx("span",{children:t("itemDetail.notForSale")}),e.jsx(Je,{content:t("itemDetail.notForSaleHint"),children:e.jsx("span",{className:"item-detail__price-info",tabIndex:0,role:"img","aria-label":t("itemDetail.notForSaleHint"),children:e.jsx(F,{name:"info",size:14})})})]})]}),la?e.jsxs("div",{className:"item-detail__stock-col",children:[e.jsx("div",{className:"item-detail__price-label",children:t("itemDetail.stock")}),e.jsxs("div",{className:"item-detail__stock-value",children:[(a.available??0).toLocaleString(),"/",Q.Rarity.getMaxSupply(oe).toLocaleString()]})]}):da?e.jsx("div",{className:"item-detail__stock-col",children:e.jsx("div",{className:"item-detail__stock-value item-detail__stock-value--out","data-testid":"out-of-stock",children:t("itemDetail.outOfStock")})}):null]})}),e.jsx("div",{className:`item-detail__ctas${ca?" item-detail__ctas--buttons":""}${oa?" item-detail__ctas--dual":""}`,children:o?e.jsxs(re,{variant:"purple",onClick:()=>w(!0),disabled:!T,children:[e.jsx("span",{className:"item-detail__cta-label",children:t("assetCard.buyNow")}),h!=null?e.jsxs("span",{className:"item-detail__cta-price","aria-hidden":!0,children:[e.jsx(M,{className:"item-detail__cta-diamond"}),h]}):null]}):ue?e.jsxs(Mt,{"data-testid":"manage-actions",children:[e.jsx(xe,{message:sa}),ra?e.jsxs(e.Fragment,{children:[e.jsx(re,{variant:"purple",onClick:()=>void na(),disabled:H||!Se,children:e.jsx("span",{className:"item-detail__cta-label",children:H?t("itemDetail.manageWorking"):t("itemDetail.manageUpdatePrice")})}),e.jsx(Pt,{variant:"ghost",onClick:()=>void Pe(),disabled:H,children:H?t("myAssets.removing"):t("itemDetail.manageRemove")})]}):e.jsx(re,{variant:"purple",onClick:Ee,disabled:H||!Se,children:e.jsx("span",{className:"item-detail__cta-label",children:t("itemDetail.manageList")})}),e.jsxs(Et,{children:[t("itemDetail.ownItemPrefix")," ",e.jsx(ya,{to:"/my-assets",children:t("nav.myAssets")}),t("itemDetail.ownItemSuffix")]})]}):_?e.jsxs(e.Fragment,{children:[e.jsxs(re,{variant:"purple",onClick:()=>w(!0),disabled:u,children:[e.jsx("span",{className:"item-detail__cta-label",children:t("assetCard.buyNow")}),e.jsxs("span",{className:"item-detail__cta-price","aria-hidden":!0,children:[e.jsx(M,{className:"item-detail__cta-diamond"}),a.priceCredits]})]}),e.jsxs("button",{className:"item-detail__addcart",onClick:Ze,disabled:u||($?W:G),"aria-label":Le,children:[e.jsx(F,{name:"cart-solid"}),e.jsx("span",{className:"item-detail__addcart-label",children:Le})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(wt,{item:a}),e.jsx(It,{item:a})]})})]}):e.jsx(Dt,{})})]}),e.jsx(ft,{title:ea,items:X,onViewAll:a.contractAddress?()=>d(`/collection/${a.contractAddress}`):void 0}),p&&o&&x&&I?e.jsx(yt,{listing:x,rate:I,onClose:()=>w(!1),onSold:()=>w(!1)}):p&&!o?e.jsx(bt,{item:C,resume:L,onClose:()=>{w(!1),b(!1)}}):null,aa&&y&&l?e.jsx(et,{asset:y,session:l,onClose:Fe}):null,ta&&me&&l?e.jsx(at,{item:me,session:l,onClose:Fe}):null]})}function Dt(){return e.jsxs("div",{className:"item-detail__info-skel","aria-hidden":!0,children:[e.jsx("span",{className:"skeleton id-skel__title"}),e.jsxs("div",{className:"id-skel__chips",children:[e.jsx("span",{className:"skeleton id-skel__chip"}),e.jsx("span",{className:"skeleton id-skel__chip"})]}),e.jsx("span",{className:"skeleton id-skel__line"}),e.jsx("span",{className:"skeleton id-skel__line id-skel__line--short"}),e.jsx("hr",{className:"item-detail__divider"}),e.jsx("span",{className:"skeleton id-skel__price"}),e.jsx("span",{className:"skeleton id-skel__btn"})]})}export{ls as ItemDetail,ls as default};
@@ -1,4 +1,4 @@
1
- import{r as l,j as c}from"./react-BMZSDQJw.js";import{s as u,B as p,t as d}from"./index-V0hMC6mZ.js";const a=u.div`
1
+ import{r as l,j as c}from"./react-BrLDncxD.js";import{s as u,B as p,t as d}from"./index-CJ4mXolB.js";const a=u.div`
2
2
  display: flex;
3
3
  justify-content: center;
4
4
  padding: 28px 0 8px;
@@ -1,3 +1,3 @@
1
- import{e as O,c as S,g as V,h as Y,j as H,t,k as h,l as x,m as M,n as $,C as j,f as D,i as J,o as X,q as y,r as F,v as R,s as Z,B as ee}from"./index-V0hMC6mZ.js";import{r as re,a as b}from"./mana-rate-CFrZfrxV.js";import{u as ae,r as m,j as r}from"./react-BMZSDQJw.js";import{b as A}from"./buy-CN2rC9a0.js";import{g as te,b as se,w as ie,S as ce,G as ne}from"./buy-gasless-iZXsoGZN.js";import{i as de}from"./errors-BuvqNt2H.js";import{E as oe}from"./ErrorNotice-DDr3KjIH.js";function pe(e=!0){return O({queryKey:["mana-rate",S.chainId],queryFn:()=>re(S.chainId),enabled:e,staleTime:6e4,refetchInterval:6e4,retry:1})}const B=Z(ee)`
1
+ import{m as O,c as S,d as V,n as Y,o as H,t,q as h,h as x,r as M,v as $,C as j,f as D,i as J,w as X,x as y,y as F,z as R,s as Z,B as ee}from"./index-CJ4mXolB.js";import{r as re,a as b}from"./mana-rate-DtQ8WpoI.js";import{a as ae,r as m,j as r}from"./react-BrLDncxD.js";import{b as A}from"./buy-BRLq1STf.js";import{g as te,b as se,w as ie,S as ce,G as ne}from"./buy-gasless-hR2bH0iR.js";import{i as de}from"./errors-DKFg2ql0.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";function pe(e=!0){return O({queryKey:["mana-rate",S.chainId],queryFn:()=>re(S.chainId),enabled:e,staleTime:6e4,refetchInterval:6e4,retry:1})}const B=Z(ee)`
2
2
  flex: 1;
3
- `;function U(e){if(de(e))return t("errors.rejected");const n=(e.message??"").toLowerCase();return n.includes("insufficient")?t("marketCheckout.error.insufficient",{currency:j.name}):n.includes("not found")||n.includes("no active listing")||n.includes("404")?t("marketCheckout.error.soldOrRemoved"):n.includes("your own listing")?t("errors.cantBuyOwn"):t("marketCheckout.error.generic")}function le(e){return{id:e.tradeId,tradeId:e.tradeId,name:e.name,creator:e.creator,contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,wearableCategory:e.wearableCategory??void 0,rarity:e.rarity,network:e.network,chainId:e.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null,isSmart:!1}}function Ce({listing:e,rate:n,onClose:q,onSold:W}){const{session:i}=V(),{data:d,isError:T}=Y(i),w=H(),g=ae(),[N,k]=m.useState("confirm"),[p,I]=m.useState(t("marketCheckout.lockingPrice")),[G,f]=m.useState(null),[a,L]=m.useState(null),o=m.useRef(null),Q=Math.ceil(b(e.manaWei,n)/10);m.useEffect(()=>{let l=!1;if(!i){k("error"),f(t("buyModal.signInToCheckout"));return}return(async()=>{try{const s=await D(e.tradeId);if(!s)throw new Error("not found");if(J(s,i.address))throw new Error("You can't buy your own listing.");const u=b(e.manaWei,n);if(!Number.isFinite(u)||u<=0)throw new Error("price unavailable");const{credit:v,maxCreditedValue:K,usdCents:P}=await X(i.identity,u,e.tradeId);if(l){h(i.identity,[v.id]).catch(()=>{});return}o.current=v.id,L({trade:s,credit:v,maxCreditedValue:K,usdCents:P,credits:Math.ceil(P/10)}),I("")}catch(s){if(l)return;console.error("[market] authorize failed",s),y(R(s)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:F(s),value_usd:Math.round(b(e.manaWei,n))/100}),k("error"),f(U(s))}})(),()=>{l=!0,o.current&&i&&(h(i.identity,[o.current]).catch(()=>{}),o.current=null)}},[]);const C=!!a&&d!=null&&d.credits<a.credits;async function z(){if(!i||!a)return;if(C){y("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:a.credits,credits_balance:(d==null?void 0:d.credits)??0,shortfall:Math.max(0,a.credits-((d==null?void 0:d.credits)??0))}),h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,g("/credits");return}k("working"),f(null);let l=!1;try{I(t("marketCheckout.confirming"));const c={trade:a.trade,buyer:i.address,signer:i.signer,credits:[a.credit],maxCreditedValue:a.maxCreditedValue};let s;if(te())try{s=await se(c),await ie(s),l=!0}catch(u){if(u instanceof ce)l=!0;else if(u instanceof ne)s=await A(c);else throw u}else s=await A(c);o.current=null,y("Shop Completed Purchase",{items:[{item_id:e.itemId??null,contract_address:e.contractAddress,token_id:null,price_usd:a.usdCents/100}],value_credits:a.credits,value_usd:a.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:l,transaction_hash:s??null}),w.invalidateQueries({queryKey:["usd-balance"]}),g("/success",{state:{items:[le(e)],txHash:s}})}catch(c){console.error("[market] buy now failed",c),h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,y(R(c)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:F(c),value_usd:a.usdCents/100}),w.invalidateQueries({queryKey:["usd-balance"]}),f(U(c)),k("error");const s=(c.message??"").toLowerCase();(s.includes("not found")||s.includes("no active listing")||s.includes("404"))&&W()}}function E(){i&&a&&h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,q()}const _=N==="working";return r.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:e.name}),children:[r.jsx("div",{className:"mkt-modal__scrim",onClick:_?void 0:E,"aria-hidden":!0}),r.jsxs("div",{className:"mkt-modal__card",children:[r.jsxs("div",{className:"mkt-modal__head",children:[r.jsx("div",{className:"mkt-modal__thumb",children:e.thumbnail?r.jsx("img",{src:e.thumbnail,alt:""}):null}),r.jsxs("div",{children:[r.jsx("div",{className:"mkt-modal__name",title:e.name,children:e.name||t("buyModal.itemFallback")}),r.jsx("span",{className:"chip chip--rarity",children:e.rarity})]})]}),r.jsx("div",{className:"mkt-modal__price",children:a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.finalPrice")}),r.jsxs("div",{className:"mkt-modal__price-value",children:[r.jsx(x,{className:"mkt-modal__diamond"}),M(a.credits)]}),r.jsxs("div",{className:"mkt-modal__price-sub muted",children:[t("marketCheckout.lockedForPurchase")," · $",(a.usdCents/100).toFixed(2)]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.todaysPrice")}),r.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[r.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),r.jsx(x,{className:"mkt-modal__diamond"}),M(Q)]}),r.jsx("div",{className:"mkt-modal__price-sub muted",children:p||t("marketCheckout.lockingPrice")})]})}),i?r.jsxs("div",{className:"mkt-modal__balance muted",children:[t("marketCheckout.yourBalance")," ",r.jsx(x,{className:"ccy-mark"})," ",$(d,T)]}):null,C?r.jsx("p",{className:"muted mkt-modal__note",children:t("marketCheckout.needMore",{currency:j.name})}):null,p&&N==="working"?r.jsx("p",{className:"muted mkt-modal__note",children:p}):null,r.jsx(oe,{message:G,className:"mkt-modal__note"}),r.jsxs("div",{className:"mkt-modal__actions",children:[r.jsx(B,{variant:"ghost",onClick:E,disabled:_,children:t("buyModal.cancel")}),r.jsx(B,{variant:"purple",onClick:()=>void z(),disabled:_||!a,children:_?t("marketCheckout.buying"):C?t("nav.getCredits",{currency:j.name}):t("marketCheckout.confirmPurchase")})]})]})]})}export{Ce as M,pe as u};
3
+ `;function U(e){if(de(e))return t("errors.rejected");const n=(e.message??"").toLowerCase();return n.includes("insufficient")?t("marketCheckout.error.insufficient",{currency:j.name}):n.includes("not found")||n.includes("no active listing")||n.includes("404")?t("marketCheckout.error.soldOrRemoved"):n.includes("your own listing")?t("errors.cantBuyOwn"):t("marketCheckout.error.generic")}function le(e){return{id:e.tradeId,tradeId:e.tradeId,name:e.name,creator:e.creator,contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,wearableCategory:e.wearableCategory??void 0,rarity:e.rarity,network:e.network,chainId:e.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null,isSmart:!1}}function Ce({listing:e,rate:n,onClose:q,onSold:W}){const{session:i}=V(),{data:d,isError:T}=Y(i),w=H(),g=ae(),[N,k]=m.useState("confirm"),[p,I]=m.useState(t("marketCheckout.lockingPrice")),[z,f]=m.useState(null),[a,G]=m.useState(null),o=m.useRef(null),L=Math.ceil(b(e.manaWei,n)/10);m.useEffect(()=>{let l=!1;if(!i){k("error"),f(t("buyModal.signInToCheckout"));return}return(async()=>{try{const s=await D(e.tradeId);if(!s)throw new Error("not found");if(J(s,i.address))throw new Error("You can't buy your own listing.");const u=b(e.manaWei,n);if(!Number.isFinite(u)||u<=0)throw new Error("price unavailable");const{credit:v,maxCreditedValue:K,usdCents:P}=await X(i.identity,u,e.tradeId);if(l){h(i.identity,[v.id]).catch(()=>{});return}o.current=v.id,G({trade:s,credit:v,maxCreditedValue:K,usdCents:P,credits:Math.ceil(P/10)}),I("")}catch(s){if(l)return;console.error("[market] authorize failed",s),y(R(s)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:F(s),value_usd:Math.round(b(e.manaWei,n))/100}),k("error"),f(U(s))}})(),()=>{l=!0,o.current&&i&&(h(i.identity,[o.current]).catch(()=>{}),o.current=null)}},[]);const C=!!a&&d!=null&&d.credits<a.credits;async function Q(){if(!i||!a)return;if(C){y("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:a.credits,credits_balance:(d==null?void 0:d.credits)??0,shortfall:Math.max(0,a.credits-((d==null?void 0:d.credits)??0))}),h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,g("/credits");return}k("working"),f(null);let l=!1;try{I(t("marketCheckout.confirming"));const c={trade:a.trade,buyer:i.address,signer:i.signer,credits:[a.credit],maxCreditedValue:a.maxCreditedValue};let s;if(te())try{s=await se(c),await ie(s),l=!0}catch(u){if(u instanceof ce)l=!0;else if(u instanceof ne)s=await A(c);else throw u}else s=await A(c);o.current=null,y("Shop Completed Purchase",{items:[{item_id:e.itemId??null,contract_address:e.contractAddress,token_id:null,price_usd:a.usdCents/100}],value_credits:a.credits,value_usd:a.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:l,transaction_hash:s??null}),w.invalidateQueries({queryKey:["usd-balance"]}),g("/success",{state:{items:[le(e)],txHash:s}})}catch(c){console.error("[market] buy now failed",c),h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,y(R(c)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:F(c),value_usd:a.usdCents/100}),w.invalidateQueries({queryKey:["usd-balance"]}),f(U(c)),k("error");const s=(c.message??"").toLowerCase();(s.includes("not found")||s.includes("no active listing")||s.includes("404"))&&W()}}function E(){i&&a&&h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,q()}const _=N==="working";return r.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:e.name}),children:[r.jsx("div",{className:"mkt-modal__scrim",onClick:_?void 0:E,"aria-hidden":!0}),r.jsxs("div",{className:"mkt-modal__card",children:[r.jsxs("div",{className:"mkt-modal__head",children:[r.jsx("div",{className:"mkt-modal__thumb",children:e.thumbnail?r.jsx("img",{src:e.thumbnail,alt:""}):null}),r.jsxs("div",{children:[r.jsx("div",{className:"mkt-modal__name",title:e.name,children:e.name||t("buyModal.itemFallback")}),r.jsx("span",{className:"chip chip--rarity",children:e.rarity})]})]}),r.jsx("div",{className:"mkt-modal__price",children:a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.finalPrice")}),r.jsxs("div",{className:"mkt-modal__price-value",children:[r.jsx(x,{className:"mkt-modal__diamond"}),M(a.credits)]}),r.jsxs("div",{className:"mkt-modal__price-sub muted",children:[t("marketCheckout.lockedForPurchase")," · $",(a.usdCents/100).toFixed(2)]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.todaysPrice")}),r.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[r.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),r.jsx(x,{className:"mkt-modal__diamond"}),M(L)]}),r.jsx("div",{className:"mkt-modal__price-sub muted",children:p||t("marketCheckout.lockingPrice")})]})}),i?r.jsxs("div",{className:"mkt-modal__balance muted",children:[t("marketCheckout.yourBalance")," ",r.jsx(x,{className:"ccy-mark"})," ",$(d,T)]}):null,C?r.jsx("p",{className:"muted mkt-modal__note",children:t("marketCheckout.needMore",{currency:j.name})}):null,p&&N==="working"?r.jsx("p",{className:"muted mkt-modal__note",children:p}):null,r.jsx(oe,{message:z,className:"mkt-modal__note"}),r.jsxs("div",{className:"mkt-modal__actions",children:[r.jsx(B,{variant:"ghost",onClick:E,disabled:_,children:t("buyModal.cancel")}),r.jsx(B,{variant:"purple",onClick:()=>void Q(),disabled:_||!a,children:_?t("marketCheckout.buying"):C?t("nav.getCredits",{currency:j.name}):t("marketCheckout.confirmPurchase")})]})]})]})}export{Ce as M,pe as u};