@abtnode/blocklet-services 1.17.7 → 1.17.8-beta-20260106-113136-b3c09e14

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 (242) hide show
  1. package/api/routes/blocklet.js +26 -2
  2. package/api/util/blocklet-utils.js +15 -0
  3. package/dist/assets/{AdapterDayjs-CIz_EOtQ.js → AdapterDayjs-DafRMFLg.js} +1 -1
  4. package/dist/assets/Community-3AO97CCq.js +1 -0
  5. package/dist/assets/{Google-UUKF9aLU.js → Google-DRu937I3.js} +1 -1
  6. package/dist/assets/Holiday-CqSw2e8m.js +1 -0
  7. package/dist/assets/Meeting-DKbNRI16.js +1 -0
  8. package/dist/assets/OffSick-BvEREz3_.js +1 -0
  9. package/dist/assets/WorkingRemotely-DNtYHcSB.js +1 -0
  10. package/dist/assets/{access-control-BvVaKG93.js → access-control-cgo5Z15_.js} +1 -1
  11. package/dist/assets/{add-component-core-DuwLtUBl.js → add-component-core-BfzNEcS5.js} +7 -7
  12. package/dist/assets/{add-resource-DSF4-AYI.js → add-resource-CYRgZ1ps.js} +1 -1
  13. package/dist/assets/addon-qN24wAb4.js +14 -0
  14. package/dist/assets/advanced-1Vu6rcXU.js +14 -0
  15. package/dist/assets/{aigne-B-7qxD7r.js → aigne-D6MrXXCU.js} +1 -1
  16. package/dist/assets/api-DwxIBXZs.js +1 -0
  17. package/dist/assets/{appearance-DpKwY0o1.js → appearance-DOQHBg9p.js} +1 -1
  18. package/dist/assets/arrow-down.svg-7ME6T1BL.js +1 -0
  19. package/dist/assets/{audit-logs-BW1TvN0z.js → audit-logs-ISyoqJFp.js} +2 -2
  20. package/dist/assets/{authorize-BwNdnPft.js → authorize-B9RLEFal.js} +1 -1
  21. package/dist/assets/{base-chart-ChBZtUEG.js → base-chart-DhxjAyBU.js} +1 -1
  22. package/dist/assets/base32-_D4eWUeh.js +1 -0
  23. package/dist/assets/bind-account-CLIjYy96.js +1 -0
  24. package/dist/assets/{branding-40UKivXV.js → branding-C81Kt22j.js} +1 -1
  25. package/dist/assets/{branding-CUwzFTtf.js → branding-iwUveEf5.js} +2 -2
  26. package/dist/assets/branding-myiZl37D.js +1 -0
  27. package/dist/assets/{bundle-avatar-DJ_-4AO_.js → bundle-avatar-Cc_6nw01.js} +1 -1
  28. package/dist/assets/button-D-lyR9BW.js +1 -0
  29. package/dist/assets/{click-to-copy-CBd8B_uk.js → click-to-copy-CMo42VnK.js} +1 -1
  30. package/dist/assets/cloneDeep-BY8zW7hH.js +1 -0
  31. package/dist/assets/{complete-DCZaPQL5.js → complete-CJ_buCAS.js} +4 -4
  32. package/dist/assets/{component-CIlZ9gz_.js → component-Dip3v1Iq.js} +3 -3
  33. package/dist/assets/config-44sI5I0w.js +53 -0
  34. package/dist/assets/{config-DCwReZ_J.js → config-D5KnWqfn.js} +1 -1
  35. package/dist/assets/{config-BFSglxmm.js → config-D8XZj8JI.js} +2 -2
  36. package/dist/assets/{config-navigation-D47x55_t.js → config-navigation-Ni0iczgA.js} +8 -8
  37. package/dist/assets/config-space-B6_f52sE.js +1 -0
  38. package/dist/assets/{confirm-DQlu79Sm.js → confirm-Lb1MrAdS.js} +1 -1
  39. package/dist/assets/connect-0OZVqJvc.js +1 -0
  40. package/dist/assets/connect-B9GQZEi7.js +5 -0
  41. package/dist/assets/connect-BV6BUhDJ.css +1 -0
  42. package/dist/assets/connect-JAX_oP3o.js +5 -0
  43. package/dist/assets/{connect-to-B_iWUbwW.js → connect-to-Djgj6TLg.js} +1 -1
  44. package/dist/assets/{create-passport-svg-BwkPTICE.js → create-passport-svg-5AYzBKFb.js} +1 -1
  45. package/dist/assets/createClass-DXYd7BIe.js +1 -0
  46. package/dist/assets/{dashboard-Bu3a5Px4.js → dashboard-C0l2IWWH.js} +7 -7
  47. package/dist/assets/{delete-confirm-BIuv3oO4.js → delete-confirm-tbfLqDBI.js} +1 -1
  48. package/dist/assets/did-address-CsOJBoiY.js +1 -0
  49. package/dist/assets/{domain--lKnmb8L.js → domain-CnhOsdmM.js} +1 -1
  50. package/dist/assets/{domain-action-card-B5bWcTCx.js → domain-action-card-BsdHbhEi.js} +2 -2
  51. package/dist/assets/domains-DRP2VSvO.js +1 -0
  52. package/dist/assets/edit.svg-CTE5eATX.js +1 -0
  53. package/dist/assets/email-Dt_DGuhf.js +17 -0
  54. package/dist/assets/engine-BXGX_w-S.js +1 -0
  55. package/dist/assets/exchange-passport-DztKvBat.js +1 -0
  56. package/dist/assets/{form-DcGl-E0U.js → form-DoC8uBcB.js} +3 -3
  57. package/dist/assets/{form-text-input-DNXpKwew.js → form-text-input-XjloVwBd.js} +2 -2
  58. package/dist/assets/{fuel-tsazXQKp.js → fuel-IaJHNPPW.js} +1 -1
  59. package/dist/assets/gen-access-key-BJlDqEhI.js +1 -0
  60. package/dist/assets/gen-simple-access-key-lyiUw0C-.js +1 -0
  61. package/dist/assets/get-safe-url-BiNPujaX.js +1 -0
  62. package/dist/assets/google-icon-vNOJy67F.js +1 -0
  63. package/dist/assets/{home-BN59HeAP.js → home-Bs_5YPbK.js} +1 -1
  64. package/dist/assets/{iframe-CC7bnIjL.js → iframe-Dqu4MSyW.js} +1 -1
  65. package/dist/assets/{index-ByMKy0IO.js → index-1HKgA-fz.js} +1 -1
  66. package/dist/assets/{index-keEY0SLH.js → index-B10SG1vs.js} +1 -1
  67. package/dist/assets/{index-CbjFdIdE.js → index-B4KKUWng.js} +2 -2
  68. package/dist/assets/{index-Bg5uZrWj.js → index-B4YCnemd.js} +1 -1
  69. package/dist/assets/index-B6DWjLJS.js +281 -0
  70. package/dist/assets/{index-H8MAN7us.js → index-B7_VUEoc.js} +1 -1
  71. package/dist/assets/index-B9LF8Bep.js +1 -0
  72. package/dist/assets/index-BDH_LtJL.js +1 -0
  73. package/dist/assets/{index-5n0QAOjO.js → index-BGhqVqit.js} +1 -1
  74. package/dist/assets/{index-D4cbtlCM.js → index-BNhv-9xy.js} +3 -3
  75. package/dist/assets/{index-BmeJ3mXz.js → index-BSZtxRM0.js} +2 -2
  76. package/dist/assets/{index-CLao_b9r.js → index-BWDWEkUF.js} +1 -1
  77. package/dist/assets/{index-CH-EXqMX.js → index-BWL6HE0j.js} +1 -1
  78. package/dist/assets/{index-D3AsXyHs.js → index-B_SjLIbT.js} +7 -7
  79. package/dist/assets/{index-mL2PjDd3.js → index-BhhZ8IDZ.js} +13 -13
  80. package/dist/assets/{index-JhIOETr8.js → index-BkePHcyK.js} +9 -9
  81. package/dist/assets/{index-DlTghgU6.js → index-BmXPp3DU.js} +1 -1
  82. package/dist/assets/{index-D1SIrheh.js → index-BsohFwTm.js} +1 -1
  83. package/dist/assets/index-CI_uwh_J.js +81 -0
  84. package/dist/assets/index-CQgzjKgB.js +1039 -0
  85. package/dist/assets/{index-Bc7P9fwl.js → index-CRZM3CKo.js} +2 -2
  86. package/dist/assets/index-CbiyJRV7.js +1 -0
  87. package/dist/assets/{index-BJ6le4Td.js → index-Cp0b8q3A.js} +1 -1
  88. package/dist/assets/{index-DJEbIkF6.js → index-Cq6z7yeF.js} +4 -4
  89. package/dist/assets/index-DT5AXPVB.js +200 -0
  90. package/dist/assets/{index-CNUfol2K.js → index-DctZHPFL.js} +1 -1
  91. package/dist/assets/{index-D0cfNfgL.js → index-Dfx19arA.js} +6 -6
  92. package/dist/assets/index-DhHvANH8.js +93 -0
  93. package/dist/assets/index-DrCTi6nm.css +1 -0
  94. package/dist/assets/{index-ETdrsXsn.js → index-G6Vk78zE.js} +3 -3
  95. package/dist/assets/{index-DMjWlw40.js → index-TYwJnR0n.js} +23 -23
  96. package/dist/assets/{index-CoWxyxJt.js → index-dbYkWwF4.js} +1 -1
  97. package/dist/assets/index-vP1T6V7V.js +120 -0
  98. package/dist/assets/info-outline-rounded-BIwvgXCK.js +1 -0
  99. package/dist/assets/invitation-CYFN9u5t.js +177 -0
  100. package/dist/assets/invitations-jY13RXbI.js +3 -0
  101. package/dist/assets/invite-D72FvaiG.js +1 -0
  102. package/dist/assets/{isURL-D4WfF4w_.js → isURL-CJRImg0N.js} +2 -2
  103. package/dist/assets/issue-passport-BfqkJF3W.js +1 -0
  104. package/dist/assets/{item-CwiqvF0e.js → item-5ZWPft2s.js} +1 -1
  105. package/dist/assets/landing-page-DRtId3hN.js +1 -0
  106. package/dist/assets/{layout-CdGgFfY4.js → layout-Be1KH57_.js} +1 -1
  107. package/dist/assets/{list-CVN6FKdL.js → list-CHI1rCEg.js} +3 -3
  108. package/dist/assets/list-CQtiNSih.js +2 -0
  109. package/dist/assets/localization-CKE-bHgd.js +1 -0
  110. package/dist/assets/lock.svg-CiT4rEpi.js +1 -0
  111. package/dist/assets/{log-Cox3P5_L.js → log-BfCFT05M.js} +1 -1
  112. package/dist/assets/logger-DU7baop2.js +1 -0
  113. package/dist/assets/login-BtsH3IvI.js +1 -0
  114. package/dist/assets/{login-oauth-callback-zq4hRJXC.js → login-oauth-callback-Ds4uYiRr.js} +1 -1
  115. package/dist/assets/{logo-uploader-6T6d75Q6.js → logo-uploader-lepUW_D7.js} +3 -3
  116. package/dist/assets/{lost-passport-DviehTF2.js → lost-passport-BtN3h1ya.js} +2 -2
  117. package/dist/assets/omit-CCIQ0Qdi.js +1 -0
  118. package/dist/assets/{open-window-_3kVydQ2.js → open-window-CNt8gsrN.js} +1 -1
  119. package/dist/assets/{over-due-invoice-payment-rAHkUVgY.js → over-due-invoice-payment-7TbnqqKX.js} +1 -1
  120. package/dist/assets/{overview-DSB1dlE4.js → overview-Be3tncsL.js} +3 -3
  121. package/dist/assets/passport-CkJ4B4CG.js +1 -0
  122. package/dist/assets/passport-item-Bhbm8_m6.js +1 -0
  123. package/dist/assets/{permission-CcdJMHov.js → permission-BHvrn0M5.js} +1 -1
  124. package/dist/assets/preferences-TFWtUYLy.js +1 -0
  125. package/dist/assets/profile-embed-B9f9hlSS.js +1 -0
  126. package/dist/assets/provider-icon-DQY2_LaP.js +1 -0
  127. package/dist/assets/publish-resource-CyvkVMG_.js +1 -0
  128. package/dist/assets/question-mark-circle.svg-GhTaklFN.js +1 -0
  129. package/dist/assets/{react-beautiful-dnd.esm-DDZ1XDH7.js → react-beautiful-dnd.esm-D0JKrMDl.js} +4 -4
  130. package/dist/assets/revoke.svg-DUoaRyPZ.js +1 -0
  131. package/dist/assets/runtime-npJC4gp_.js +1 -0
  132. package/dist/assets/{sanitize-yVk8VEIO.js → sanitize-C-shWbtD.js} +1 -1
  133. package/dist/assets/sdk-CoWDgSLO.js +1 -0
  134. package/dist/assets/security-nSKpCl8B.js +22 -0
  135. package/dist/assets/server-logo-notext.svg-BLAdvsmP.js +1 -0
  136. package/dist/assets/{session-D-wwXXFW.js → session-C2ZBRIpv.js} +1 -1
  137. package/dist/assets/{setup-CgcKBlmf.js → setup-krkSJpAg.js} +1 -1
  138. package/dist/assets/simple-select-i16Vwzvl.js +1 -0
  139. package/dist/assets/{spaces-DGJd1uEt.js → spaces-BdZ_Rv3s.js} +1 -1
  140. package/dist/assets/start-y3zrboBQ.js +187 -0
  141. package/dist/assets/{starting-progress-DpUpXo1N.js → starting-progress-DI-J-VlX.js} +1 -1
  142. package/dist/assets/status-B8pB_mTB.js +1 -0
  143. package/dist/assets/{step-actions-BKMeYA5x.js → step-actions-B1ufIDaK.js} +1 -1
  144. package/dist/assets/{studio-BzkFXY4W.js → studio-1jwq0HOw.js} +1 -1
  145. package/dist/assets/{switch-CWBW7iKo.js → switch-CetbUrYR.js} +1 -1
  146. package/dist/assets/{switch-control-D9D8FbX3.js → switch-control-_85hc9FG.js} +1 -1
  147. package/dist/assets/{table-tips-B9_goTLn.js → table-tips-CMt22HEy.js} +1 -1
  148. package/dist/assets/team-DDjNXwXE.js +146 -0
  149. package/dist/assets/{traffic-DsUQQR3F.js → traffic-mcbpWOFq.js} +1 -1
  150. package/dist/assets/transfer-C66c3bWd.js +16 -0
  151. package/dist/assets/unsubscribe-Cvz0OKhq.js +1 -0
  152. package/dist/assets/{use-app-logo-BKJ912HX.js → use-app-logo-BuyF983S.js} +1 -1
  153. package/dist/assets/use-server-logo-Pbr_UuiI.js +1 -0
  154. package/dist/assets/{use-window-close-BVOSCf9h.js → use-window-close-B16QghYq.js} +1 -1
  155. package/dist/assets/{useAsync-DVl73fmG.js → useAsync-BVTh1KYj.js} +1 -1
  156. package/dist/assets/{useAsync-Dotoxibi.js → useAsync-ZGLJQow7.js} +1 -1
  157. package/dist/assets/{useAsyncRetry-r8dEPb-x.js → useAsyncRetry-BMmRgSGm.js} +1 -1
  158. package/dist/assets/{useLocalStorage-BmGa-RG8.js → useLocalStorage-De-EuH_M.js} +1 -1
  159. package/dist/assets/user-center-DQSoqc_z.js +125 -0
  160. package/dist/assets/user-follower-TTyja_sV.js +32 -0
  161. package/dist/assets/{util-DQmPydCJ.js → util-DuMKfKo8.js} +1 -1
  162. package/dist/assets/{util-CznlXimv.js → util-Ff3hwYmy.js} +1 -1
  163. package/dist/assets/{vendor-arcblock-DyliHtVF.js → vendor-arcblock-Cnwtqa7s.js} +19 -19
  164. package/dist/assets/{vendor-hooks-qxhUUbW5.js → vendor-hooks-BQWlJm53.js} +2 -2
  165. package/dist/assets/{vendor-utils-CxWN1dT3.js → vendor-utils-DCMKu06e.js} +3 -3
  166. package/dist/assets/{vendor-ux-IiqHAjMq.js → vendor-ux-B0gV9NvH.js} +92 -95
  167. package/dist/assets/{wait-connect-Co7Po2HJ.js → wait-connect-CRZmfXOA.js} +1 -1
  168. package/dist/assets/{wizard-tGxr6THv.js → wizard-B41kI39b.js} +1 -1
  169. package/dist/assets/{wizard-components-qCiwxNk8.js → wizard-components-Bn72hVOe.js} +2 -2
  170. package/dist/assets/wrap-locale-CF46rj6q.js +1 -0
  171. package/dist/assets/{zh-DL3Su93_.js → zh-BmX_fuoi.js} +1 -1
  172. package/dist/index.html +2 -2
  173. package/package.json +49 -49
  174. package/dist/assets/Community-CELsDteM.js +0 -1
  175. package/dist/assets/Holiday-DOCjSYjH.js +0 -1
  176. package/dist/assets/Meeting-BAXt_LiK.js +0 -1
  177. package/dist/assets/OffSick-BGEr8Nkc.js +0 -1
  178. package/dist/assets/WorkingRemotely-BcneAIXG.js +0 -1
  179. package/dist/assets/addon-CAO5ZUVe.js +0 -14
  180. package/dist/assets/advanced-D-_qy4C4.js +0 -14
  181. package/dist/assets/api-FQQlzPOP.js +0 -1
  182. package/dist/assets/arrow-down.svg-C4FUKwt4.js +0 -1
  183. package/dist/assets/base32-CmNHdxL7.js +0 -1
  184. package/dist/assets/bind-account-DOG2XJ6s.js +0 -1
  185. package/dist/assets/branding-lvlhWE2R.js +0 -1
  186. package/dist/assets/button-82FUWQ2H.js +0 -1
  187. package/dist/assets/cloneDeep-C2rlAYcK.js +0 -1
  188. package/dist/assets/config-Dzr61Ovu.js +0 -53
  189. package/dist/assets/config-space-D2mAEqFL.js +0 -1
  190. package/dist/assets/connect-Dd7NRVCL.js +0 -1
  191. package/dist/assets/connect-II0vWvpi.js +0 -5
  192. package/dist/assets/createClass-DVDZaC6q.js +0 -1
  193. package/dist/assets/did-address-h4uLp20A.js +0 -1
  194. package/dist/assets/domains-DTnBb4pb.js +0 -1
  195. package/dist/assets/edit.svg-RRSklUg-.js +0 -1
  196. package/dist/assets/email-bOQg3Ln3.js +0 -17
  197. package/dist/assets/engine-_hdQizRi.js +0 -1
  198. package/dist/assets/exchange-passport-B8J1z6zW.js +0 -1
  199. package/dist/assets/gen-access-key-DrfFQLFL.js +0 -1
  200. package/dist/assets/gen-simple-access-key-CnP2yUd7.js +0 -1
  201. package/dist/assets/get-safe-url-DaqBo3hv.js +0 -1
  202. package/dist/assets/index-55ZI5Xlz.js +0 -200
  203. package/dist/assets/index-BDmLm9RE.js +0 -93
  204. package/dist/assets/index-BORuOqqa.js +0 -1
  205. package/dist/assets/index-ByEZTgqv.js +0 -120
  206. package/dist/assets/index-CXyo5mo3.js +0 -1
  207. package/dist/assets/index-DG0EDext.js +0 -1039
  208. package/dist/assets/index-DPByvHrj.js +0 -281
  209. package/dist/assets/index-DZyT0N9R.js +0 -81
  210. package/dist/assets/index-DrVXX4fX.css +0 -1
  211. package/dist/assets/invitation-0lU4EchQ.js +0 -177
  212. package/dist/assets/invitations-CSnyD-Wp.js +0 -3
  213. package/dist/assets/invite-8i_Oru_O.js +0 -1
  214. package/dist/assets/issue-passport-Br15qs7n.js +0 -1
  215. package/dist/assets/landing-page-q4NMkyjD.js +0 -1
  216. package/dist/assets/list-NP-91JKf.js +0 -2
  217. package/dist/assets/localization-DAE0Xt60.js +0 -1
  218. package/dist/assets/lock.svg-BgybwZNe.js +0 -1
  219. package/dist/assets/logger-BKK0qIc9.js +0 -1
  220. package/dist/assets/login-2zmJhcBe.js +0 -1
  221. package/dist/assets/omit-spWLSLbo.js +0 -1
  222. package/dist/assets/passport-DzlmGAGE.js +0 -1
  223. package/dist/assets/passport-item-DdvT-U5C.js +0 -1
  224. package/dist/assets/preferences-B3FTkTJx.js +0 -1
  225. package/dist/assets/profile-embed-Ds6zLGgv.js +0 -1
  226. package/dist/assets/publish-resource-CAbbkAX0.js +0 -1
  227. package/dist/assets/question-mark-circle.svg-CByEVDhb.js +0 -1
  228. package/dist/assets/revoke.svg-CNl4LAbv.js +0 -1
  229. package/dist/assets/runtime-BKJMYAui.js +0 -1
  230. package/dist/assets/sdk-DkjNLRKY.js +0 -1
  231. package/dist/assets/security-3Y4MabOo.js +0 -22
  232. package/dist/assets/server-logo-notext.svg-xZ-i1SpD.js +0 -1
  233. package/dist/assets/simple-select-qqtCC0US.js +0 -1
  234. package/dist/assets/start-Cu_Xr7Yd.js +0 -187
  235. package/dist/assets/status-qiMZo73y.js +0 -1
  236. package/dist/assets/team-DvyWlb8W.js +0 -146
  237. package/dist/assets/transfer-BU2gLE9m.js +0 -16
  238. package/dist/assets/unsubscribe-DpfMHut2.js +0 -1
  239. package/dist/assets/use-server-logo-Cv1kAPgB.js +0 -1
  240. package/dist/assets/user-center-8NTN-2CY.js +0 -125
  241. package/dist/assets/user-follower-C-xe6Fqb.js +0 -32
  242. package/dist/assets/wrap-locale-BdDblHwV.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as o,ak as i,at as g,W as u}from"./vendor-mui-core-DnR6WYuU.js";import{y as v,q as C,aB as b,o as B}from"./index-DG0EDext.js";import{D as E,a as I,b as w}from"./domain-action-card-B5bWcTCx.js";import{aU as T}from"./vendor-ux-IiqHAjMq.js";import{a as W}from"./page-header-CHAwrgX-.js";import{r,j as A}from"./vendor-react-CTtPmzVP.js";import{u as L}from"./useSetState-L-f8mSga.js";import{S as x}from"./button-82FUWQ2H.js";import{S as $}from"./layout-CdGgFfY4.js";import{S as z}from"./step-actions-BKMeYA5x.js";import"./vendor-arcblock-DyliHtVF.js";import"./vendor-utils-CxWN1dT3.js";import"./vendor-hooks-qxhUUbW5.js";import"./lottie-web-4koyQiv_.js";import"./permission-CcdJMHov.js";import"./session-D-wwXXFW.js";import"./useAsyncRetry-r8dEPb-x.js";import"./useAsync-Dotoxibi.js";import"./confirm-DQlu79Sm.js";import"./index-DBs9Ljax.js";import"./actions-Dfiiwkit.js";import"./delete-confirm-BIuv3oO4.js";import"./click-to-copy-CBd8B_uk.js";import"./useAsync-DVl73fmG.js";import"./index-CLao_b9r.js";import"./util-CznlXimv.js";import"./engine-_hdQizRi.js";import"./content-layout-DmSBGGVm.js";import"./use-mobile-D5clNlrm.js";function h({onNext:a=()=>{},onPrevious:f=()=>{}}){const{t:s}=r.useContext(T),[D,d]=r.useState(!1),{blocklet:e}=v(),[p,S]=r.useState(""),j=((e?.site||{}).domainAliases||[]).map(t=>C.replaceSlotToIp(t.value,p)),[n,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=e.environments?.find(t=>t.key==="BLOCKLET_APP_PK")?.value,y=j.find(t=>b.isDidDomain(t)),[l,P]=A();return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{S(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(H,{children:[o.jsx(i,{className:"header",children:o.jsx(W,{title:s("setup.domain.title"),subTitle:s("setup.domain.subTitle"),onClickBack:f})}),o.jsxs(i,{className:"form form-container",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(i,{children:[o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem"},children:o.jsx(i,{sx:{display:"inline"},children:`${s("setup.domain.buyOrConnect")} (${s("common.optional")})`})}),o.jsx(i,{sx:{mt:1},children:o.jsx(I,{blocklet:e,bugDidDomainProps:{appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,cnameDomain:y,currentIp:p,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),d(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const k={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};l.set("redirect",t.domain),P(l,{replace:!0}),m(k),a()},onError:d}})})]}),o.jsx(i,{children:o.jsx(w,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1},children:o.jsx(i,{sx:{display:"inline"},children:s("setup.domain.skipDescription")})})})})]}),o.jsx(z,{mt:8,disabled:!!n.addDomainState.text,blocklet:e,onStartNow:()=>a("complete"),children:n.domain?o.jsx(x,{variant:"contained",loading:!!n.addDomainState.text,disabled:D||!!n.addDomainState.text||!n.domain,onClick:()=>a(),children:n.addDomainState.text||s("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!n.addDomainState.text,onClick:()=>a(),children:s("setup.continue")})})]})}function ht(a){return o.jsx(E,{children:o.jsx(h,{...a})})}h.propTypes={onNext:u.func,onPrevious:u.func};const H=g($)`
1
+ import{j as o,ak as i,at as g,W as u}from"./vendor-mui-core-DnR6WYuU.js";import{y as v,q as C,aA as b,o as B}from"./index-CQgzjKgB.js";import{D as E,a as I,b as w}from"./domain-action-card-BsdHbhEi.js";import{b8 as A}from"./vendor-ux-B0gV9NvH.js";import{a as T}from"./page-header-CHAwrgX-.js";import{r,j as W}from"./vendor-react-CTtPmzVP.js";import{u as L}from"./useSetState-L-f8mSga.js";import{S as x}from"./button-D-lyR9BW.js";import{S as $}from"./layout-Be1KH57_.js";import{S as z}from"./step-actions-B1ufIDaK.js";import"./vendor-arcblock-Cnwtqa7s.js";import"./vendor-utils-DCMKu06e.js";import"./vendor-hooks-BQWlJm53.js";import"./lottie-web-4koyQiv_.js";import"./permission-BHvrn0M5.js";import"./session-C2ZBRIpv.js";import"./useAsyncRetry-BMmRgSGm.js";import"./useAsync-ZGLJQow7.js";import"./confirm-Lb1MrAdS.js";import"./index-DBs9Ljax.js";import"./actions-Dfiiwkit.js";import"./delete-confirm-tbfLqDBI.js";import"./click-to-copy-CMo42VnK.js";import"./useAsync-BVTh1KYj.js";import"./index-BWDWEkUF.js";import"./util-Ff3hwYmy.js";import"./engine-BXGX_w-S.js";import"./content-layout-DmSBGGVm.js";import"./use-mobile-D5clNlrm.js";function h({onNext:a=()=>{},onPrevious:f=()=>{}}){const{t:s}=r.useContext(A),[D,d]=r.useState(!1),{blocklet:e}=v(),[p,S]=r.useState(""),j=((e?.site||{}).domainAliases||[]).map(t=>C.replaceSlotToIp(t.value,p)),[n,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=e.environments?.find(t=>t.key==="BLOCKLET_APP_PK")?.value,y=j.find(t=>b.isDidDomain(t)),[l,P]=W();return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{S(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(H,{children:[o.jsx(i,{className:"header",children:o.jsx(T,{title:s("setup.domain.title"),subTitle:s("setup.domain.subTitle"),onClickBack:f})}),o.jsxs(i,{className:"form form-container",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(i,{children:[o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem"},children:o.jsx(i,{sx:{display:"inline"},children:`${s("setup.domain.buyOrConnect")} (${s("common.optional")})`})}),o.jsx(i,{sx:{mt:1},children:o.jsx(I,{blocklet:e,bugDidDomainProps:{appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,cnameDomain:y,currentIp:p,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),d(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const k={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};l.set("redirect",t.domain),P(l,{replace:!0}),m(k),a()},onError:d}})})]}),o.jsx(i,{children:o.jsx(w,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1},children:o.jsx(i,{sx:{display:"inline"},children:s("setup.domain.skipDescription")})})})})]}),o.jsx(z,{mt:8,disabled:!!n.addDomainState.text,blocklet:e,onStartNow:()=>a("complete"),children:n.domain?o.jsx(x,{variant:"contained",loading:!!n.addDomainState.text,disabled:D||!!n.addDomainState.text||!n.domain,onClick:()=>a(),children:n.addDomainState.text||s("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!n.addDomainState.text,onClick:()=>a(),children:s("setup.continue")})})]})}function ht(a){return o.jsx(E,{children:o.jsx(h,{...a})})}h.propTypes={onNext:u.func,onPrevious:u.func};const H=g($)`
2
2
  height: 100%;
3
3
  overflow-y: hidden;
4
4
 
@@ -1,4 +1,4 @@
1
- import{v as bn,T as vn,V as A,aL as Cn,H as E,w as te,au as wn,ba as Ue}from"./vendor-ux-IiqHAjMq.js";import{j as e,dh as Ne,cP as Sn,ak as h,a6 as U,bu as Rn,T as R,aZ as ye,D as H,J as ie,am as L,aN as $e,W as t,cu as _e,M as Oe,aO as An,aP as kn,cQ as Tn,c5 as In,co as Pn,di as qn,dj as En,b6 as W,P as We,c0 as Ln,b0 as Fn,at as Mn,bb as Bn,bj as zn,dk as Un,dl as Nn,dm as $n,dn as Te,dp as _,dq as _n,z as On,n as Wn,bl as Hn,dr as Vn,bi as Gn}from"./vendor-mui-core-DnR6WYuU.js";import{C as ee,J as Zn,a as Jn,e as Qn,T as je,ar as Kn,as as Yn,n as J}from"./vendor-utils-CxWN1dT3.js";import{r as j,e as He,g as Xn}from"./vendor-react-CTtPmzVP.js";import{u as se}from"./useSetState-L-f8mSga.js";import{x as et,q as nt,b as Q,t as tt,E as it}from"./vendor-hooks-qxhUUbW5.js";import{bw as Ve,be as Ge,c3 as st,c4 as Ze,Z as F,Y as oe,J as Ie,e as ot,a1 as Pe,c5 as rt,G as at,ag as lt,c6 as Je,aB as fe,c7 as Qe,bV as ct,c8 as dt,c9 as mt,b0 as ut,q as xe,bz as pt,ca as ft}from"./index-DG0EDext.js";import{w as Ke}from"./permission-CcdJMHov.js";import{u as xt,D as qe}from"./useAsyncRetry-r8dEPb-x.js";import{C as re}from"./confirm-DQlu79Sm.js";import{A as ht}from"./actions-Dfiiwkit.js";import{D as gt}from"./delete-confirm-BIuv3oO4.js";import{o as Ee}from"./vendor-arcblock-DyliHtVF.js";import{u as Dt}from"./useAsync-DVl73fmG.js";import{f as N}from"./index-DBs9Ljax.js";import{v as yt}from"./index-CLao_b9r.js";import{g as jt,p as Le}from"./util-CznlXimv.js";import{C as bt}from"./click-to-copy-CBd8B_uk.js";const vt=Ve({});vt.interceptors.request.use(n=>{const i=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=i||"",n.url=ee("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=bn()),n},n=>Promise.reject(n));const Ye=(...n)=>Ve(...n),Ct=(n,i)=>i?n?[n,...Array.isArray(i)?i:[i]]:i:n,wt=(n,{width:i=600,height:o=700,name:a="did-domain:popup"}={})=>{const s=window.screenX+(window.innerWidth-i)/2,r=window.screenY+(window.innerHeight-o)/2,u=[`left=${s}`,`top=${r}`,`width=${i}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],l=window.open("",a,u.join(","));if(l===null)throw new Error("Failed to open popup");return l.location.href=Zn(n,{opener:window.location.origin}),l},St="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Xe=async n=>{if(!n||!n?.trim())return null;const i=Ye(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:a}=await i.get(o.toString()),s=a?.componentMountPoints?.find(m=>m.did===St),r=new URL(n);r.pathname=s?.mountPoint;const u=r.toString(),l=ee(u,"/api");return{base:u,api:l}},Rt=Ge({embed:{iconTip:"Click to view subscription details"},buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),At=Ge({embed:{iconTip:"点击查看订阅详情"},buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),kt={zh:At,en:Rt},Tt=async({didDomainURL:n,delegatee:i,delegateePk:o})=>{const a=await Xe(n);if(!a)return null;const s=Ye({baseURL:a.api}),{data:r}=await s.post("/payment/session",{delegatee:i,delegateePk:o});return{sessionId:r.sessionId,baseURL:a.base}};function It({delegatee:n,delegateePk:i,didDomainURL:o,locale:a,title:s="",onSuccess:r=()=>{},...u}){const{t:l}=A(),[m,p]=et({currentState:1}),f=j.useRef(null),c=nt(async()=>{const d=await Tt({didDomainURL:o,delegatee:n,delegateePk:i});return d},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(d){console.error(d)}}),g=Q(d=>{d.data.type==="didDomain.success"&&(r?.({nftDid:d.data?.nftDid,domain:d.data?.domain,chainHost:d.data?.chainHost}),f.current?.close(),f.current=null,p({currentState:4}),setTimeout(()=>{p({currentState:8})},2e3))});tt(()=>{try{window.removeEventListener("message",g),f.current?.close(),f.current=null}catch(d){console.warn("Failed to close popup",d)}});const y=Q(()=>{p({currentState:1})}),x=Q(()=>{if(p({currentState:2}),!c.data){console.error("Failed to create session");return}b({sessionId:c.data.sessionId,baseURL:c.data.baseURL})}),b=Q(({sessionId:d,baseURL:w})=>{window.addEventListener("message",g);const C=new URL(w);C.searchParams.set("sessionId",d),C.searchParams.set("locale",a),C.searchParams.set("embed","1"),f.current=wt(C.toString());const q=setInterval(()=>{f.current?.closed&&(clearInterval(q),y())},1e3);return()=>clearInterval(q)});return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{loading:c.loading,onClick:x,variant:"contained",startIcon:e.jsx(Sn,{}),...u,children:s||l("buy.button.title")}),e.jsxs(Cn,{fullWidth:!0,maxWidth:"xs",open:m.currentState>1&&m.currentState<8,onClose:y,children:[!c.error&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[m.currentState===2&&e.jsx(U,{size:50}),m.currentState===4&&e.jsx(Rn,{sx:{color:"primary.main",fontSize:"5rem"}}),m.currentState===2&&e.jsx(R,{children:l("buy.status.inProgress")}),m.currentState===4&&e.jsx(R,{children:l("buy.status.success")})]}),c.error&&e.jsx(ye,{severity:"error",children:l("buy.error.failedToCreateSession")})]})]})}function Pt(n){return e.jsx(vn,{locale:n.locale,translations:kt,children:e.jsx(It,{...n})})}function qt({nftDid:n,didDomainURL:i,locale:o,sx:a={}}){const{t:s}=A(),[r,u]=se({safeIframeRef:null,popoverAnchorEl:null}),l=j.useRef(null),m=H(),p=ie(m.breakpoints.down("md")),f=x=>{u({popoverAnchorEl:x.currentTarget})},c=()=>{u({popoverAnchorEl:null})},g=it(async()=>{const x=await Xe(i);return x?x.base:null});if(!g.value)return null;if(g.loading)return e.jsx(U,{});const y=ee(g.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(L,{title:s("embed.iconTip"),children:e.jsx(h,{component:"img",src:ee(i,"/.well-known/service/blocklet/logo"),alt:"logo",onClick:f,sx:[{width:16,height:16},Ct({cursor:"pointer"},a)]})}),e.jsx($e,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:l,title:s("common.subscription"),width:p?"320px":"400px",height:"350px",style:{border:0,display:"block"},src:y})})]})}const Et=n=>["waiting","creating","renewaling"].includes(n);function en({siteId:n,domain:i,onAdd:o=()=>{},children:a=null,did:s,issuing:r=!1,setIssuing:u=()=>{}}){const{t:l}=A(),[m,p]=j.useState(!1),{inService:f}=F(),[c,g]=j.useState(null),{api:y,ws:{useSubscription:x}}=F(),{mode:b,actions:{refreshDomainStatus:d}}=oe(),w=xt(async()=>{const{cert:T}=await y.findCertificateByDomain({input:{domain:i,did:s}});return T}),C=(T,S)=>{T.domain===i&&(u(!1),p(!1),f&&b!=="setup"&&(S==="success"?E.success(l("setup.domain.genCertSuccess",{domain:T.domain})):S==="error"&&E.error(l("setup.domain.genCertFailed",{domain:T.domain,message:T.message}))))};if(j.useEffect(()=>{w.loading||u(Et(w.value?.status))},[w.loading,w.value?.status,u]),x(Ie.BlockletEvents.certError,T=>C(T,"error")),x(Ie.BlockletEvents.certIssued,T=>{w.retry(),d(T.domain),C(T,"success")}),w.loading||w.value?.status==="normal")return"";const q=()=>{p(!1),g(null)},B=async()=>{p(!0);try{await y.issueLetsEncryptCert({input:{siteId:n,domain:i,did:s,inBlockletSetup:b==="setup"}}),o(),u(!0)}catch(T){console.error(T),u(!1)}finally{p(!1),g(null)}},M={title:l("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ye,{severity:"success",children:l("router.cert.genLetsEncryptCert.dnsTip")}),l("router.cert.genLetsEncryptCert.description")]}),confirm:l("common.confirm"),onConfirm:B,onCancel:q},z=T=>{T.stopPropagation(),g(M)};return e.jsxs(e.Fragment,{children:[r?e.jsx(L,{title:l("router.cert.issuing"),children:e.jsx(U,{size:13,style:{fontSize:"13px"}})}):a({loading:m,open:z}),c&&e.jsx(re,{color:"primary",title:c.title,description:c.description,confirm:c.confirm,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}en.propTypes={domain:t.string.isRequired,did:t.string.isRequired,siteId:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function nn({domain:n,domainStatus:i,did:o,onAdd:a=()=>{},children:s=null,issuing:r=!1,setIssuing:u=()=>{},...l}){return st(n)||!Ze(n)||Jn(i)||i?.isHttps?"":e.jsx(en,{...l,domain:n,did:o,onAdd:a,issuing:r,setIssuing:u,children:s})}nn.propTypes={domain:t.string.isRequired,domainStatus:t.shape({isHttps:t.bool}).isRequired,did:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function tn({id:n,domain:i,children:o=null,teamDid:a="",onDelete:s=null}){const{t:r}=A(),[u,l]=j.useState(!1),[m,p]=j.useState(null),{api:f}=F(),c=()=>{l(!1),p(null)},g=async()=>{l(!0);try{await f.deleteDomainAlias({input:{id:n,domainAlias:i,teamDid:a}}),s?.(),await ot(2e3)}catch(b){E.error(b.message)}finally{p(null),l(!1)}},y={keyName:i,title:r("router.domainAlias.delete.title"),description:r("router.domainAlias.delete.description",{domain:i}),confirmPlaceholder:r("router.domainAlias.delete.confirmPlaceholder",{domain:i}),confirm:r("common.delete"),onConfirm:g,onCancel:c},x=b=>{b.stopPropagation(),p(y)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({loading:u,open:x}):e.jsxs(te,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[u?e.jsx(U,{size:16}):e.jsx(_e,{style:{fontSize:16}}),r("common.delete")]}),m&&e.jsx(gt,{keyName:m.keyName,title:m.title,description:m.description,confirmPlaceholder:m.confirmPlaceholder,confirm:m.confirm,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}tn.propTypes={id:t.string.isRequired,domain:t.string.isRequired,children:t.any,teamDid:t.string,onDelete:t.func};function sn({site:n,domain:i,blocklet:o,onDelete:a=()=>{}}){const{t:s}=A(),r=i.value===window.location.hostname;return e.jsx(ht,{"data-cy":"domain-actions",size:"large",actions:[({close:u})=>e.jsx(tn,{id:n.id,domain:i.value,teamDid:o?.meta?.did,onDelete:a,children:({open:l})=>e.jsx(L,{title:r?s("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:i.isProtected||r,dense:!0,onClick:m=>{u(),l(m)},"data-cy":"action-toggle-block",children:[e.jsx(An,{style:{minWidth:24,marginRight:8},children:e.jsx(_e,{})}),e.jsx(kn,{primary:s("common.delete")})]},"remove")})})})]})}sn.propTypes={site:t.object.isRequired,domain:t.object.isRequired,blocklet:t.object.isRequired,onDelete:t.func};const ae=t.shape({href:t.string,accessibility:t.shape({loading:t.bool,accessible:t.bool}),domainStatus:t.shape({isHttps:t.bool,matchedCert:t.object}),dns:t.shape({resolved:t.bool,ip:t.string})});function on({certificate:n={}}){const[i,o]=j.useState(null),a=F(),{t:s,locale:r}=A(),u=p=>{o(p.currentTarget)},l=()=>{o(null)},m=!!i;return e.jsxs(e.Fragment,{children:[e.jsx(Tn,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:u,onMouseLeave:l,style:{color:"#44cdc6",fontSize:"1em",cursor:"pointer"}}),e.jsx($e,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:e.jsx(In,{children:e.jsxs(Pn,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${a.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(R,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(R,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(R,{component:"div",children:`${s("common.issuer")}: ${Qn(n,"issuer.commonName","")}`}),e.jsx(R,{component:"div",children:`${s("router.cert.issuedOn")}: ${Pe(n.validFrom,r)}`}),e.jsx(R,{component:"div",children:`${s("router.cert.expiryOn")}: ${Pe(n.validTo,r)}`})]})]})})})]})}on.propTypes={certificate:t.object};function ne({domain:n,filters:i=["domain","http"]}){const{t:o}=A(),{value:a,domainStatus:s}=n;if(!Ze(a))return null;let r=null,u=null;const{isHttps:l,matchedCert:m}=s,{dns:{ip:p,isDnsResolved:f,isCnameMatch:c}={}}=s,g=f&&c;rt(a)||(g||p==="127.0.0.1"?r=e.jsx(L,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})),g?l?u=e.jsx(on,{certificate:m}):u=e.jsx(L,{title:o("router.domain.https.bad"),children:e.jsx(qn,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})}):u=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(En,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})});const y=i.map(x=>x==="domain"?r:x==="http"?u:null);return j.createElement(j.Fragment,null,...y)}ne.propTypes={domain:ae.isRequired,filters:t.array};const Lt=Ke(be,"mutate_blocklets"),Ft=Ke(be,"",at);function pi(n){const{inService:i}=F(),{blocklet:o,loadingRuntimeInfo:a}=oe();let s=Lt;return i&&(s=Ft),e.jsx(s,{...n,blocklet:o,inService:i,loadingRuntimeInfo:a})}const Fe="nft-domain";function be({hasPermission:n=!1,blocklet:i,loadingRuntimeInfo:o=!1,inService:a=!1,showAllDomains:s=!1,updateBlockletDomainAliases:r=()=>{},systemTips:u=null}){const{t:l}=A(),m=ie(d=>d.breakpoints.down("md")),p=j.useMemo(()=>{let d=n;return lt(i)&&(d=d&&a),d},[n,a,i]),{site:f}=i,c=j.useMemo(()=>Je(i.site?.domainAliases),[i.site?.domainAliases]),g=j.useMemo(()=>c.filter(d=>!fe.isCustomDomain(d.value)),[c]),y=j.useMemo(()=>c.filter(d=>fe.isCustomDomain(d.value)),[c]),x=j.useMemo(()=>y.filter(d=>d.type!==Fe),[y]),b=j.useMemo(()=>y.filter(d=>d.type===Fe),[y]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{sx:{gap:3},children:[!!b.length&&e.jsx(X,{title:l("common.didDomains"),description:l("common.didDomainsDescription"),domains:b,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!x.length&&e.jsx(X,{title:l("common.manualDomains"),description:l("common.manualDomainsDescription"),domains:x,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!g.length&&e.jsxs(h,{children:[u,e.jsx(X,{title:l("common.systemDomains"),description:l("common.systemDomainsDescription"),domains:g,hasMutatePermission:p,blocklet:i,site:f,mobile:m,updateBlockletDomainAliases:r})]})]}),!c.length&&(o?e.jsx(U,{size:16}):e.jsx(wn,{children:l("common.empty")}))]})}be.propTypes={hasPermission:t.bool,blocklet:t.object.isRequired,loadingRuntimeInfo:t.bool,inService:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func,systemTips:t.node};function K({children:n=null}){return e.jsx(h,{component:"span",sx:{verticalAlign:"bottom"},children:n})}K.propTypes={children:t.node};function he({domain:n,children:i,suffix:o=null,...a}){const{t:s,locale:r}=A(),u=H(),{href:l,accessibility:m,value:p}=n,f=j.useCallback(()=>e.jsx(Ue,{content:je(p),locale:r,style:{marginLeft:"4px",color:u.palette.text.secondary,fontSize:"0.8em"}}),[p,r,u]);return!m||m.loading?e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),f(),e.jsx(K,{children:o}),e.jsx(L,{title:s("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx(h,{component:"span",className:"status",children:e.jsx(U,{size:13,style:{fontSize:"13px"}})})})]}):m.accessible?e.jsxs(me,{component:"span",...a,children:[e.jsx(h,{component:"a",href:l,target:"_blank",rel:"noopener noreferrer",sx:{color:n.loading?"text.disabled":void 0},children:e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})})}),f(),e.jsx(K,{children:o})]}):e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:s("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),!n.loading&&f(),e.jsx(K,{children:o})]})}he.propTypes={domain:ae.isRequired,children:t.any.isRequired,suffix:t.node};const me=Mn(h)`
1
+ import{E as bn,T as vn,V as A,aZ as Cn,W as E,F as te,b1 as wn,bu as ze}from"./vendor-ux-B0gV9NvH.js";import{j as e,dh as Ne,cP as Sn,ak as h,a6 as z,bu as Rn,T as R,aZ as ye,D as H,J as ie,am as L,aN as $e,W as t,cu as _e,M as Oe,aO as An,aP as kn,cQ as Tn,c5 as In,co as Pn,di as qn,dj as En,b6 as W,P as We,c0 as Ln,b0 as Fn,at as Mn,bb as Bn,bj as Un,dk as zn,dl as Nn,dm as $n,dn as Te,dp as _,dq as _n,z as On,n as Wn,bl as Hn,dr as Vn,bi as Gn}from"./vendor-mui-core-DnR6WYuU.js";import{y as ee,E as Zn,a as Qn,e as Yn,M as je,au as Jn,av as Kn,n as Q}from"./vendor-utils-DCMKu06e.js";import{r as j,e as He,g as Xn}from"./vendor-react-CTtPmzVP.js";import{u as se}from"./useSetState-L-f8mSga.js";import{v as et,p as nt,b as Y,r as tt,D as it}from"./vendor-hooks-BQWlJm53.js";import{bq as Ve,b8 as Ge,cn as st,co as Ze,Z as F,Y as oe,J as Ie,f as ot,a1 as Pe,cp as rt,G as at,ag as lt,cq as Qe,aA as fe,cr as Ye,bS as ct,cs as dt,ct as mt,aY as ut,q as xe,bt as pt,cu as ft}from"./index-CQgzjKgB.js";import{w as Je}from"./permission-BHvrn0M5.js";import{u as xt,D as qe}from"./useAsyncRetry-BMmRgSGm.js";import{C as re}from"./confirm-Lb1MrAdS.js";import{A as ht}from"./actions-Dfiiwkit.js";import{D as gt}from"./delete-confirm-tbfLqDBI.js";import{o as Ee}from"./vendor-arcblock-Cnwtqa7s.js";import{u as Dt}from"./useAsync-BVTh1KYj.js";import{f as N}from"./index-DBs9Ljax.js";import{v as yt}from"./index-BWDWEkUF.js";import{g as jt,p as Le}from"./util-Ff3hwYmy.js";import{C as bt}from"./click-to-copy-CMo42VnK.js";const vt=Ve({});vt.interceptors.request.use(n=>{const i=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=i||"",n.url=ee("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=bn()),n},n=>Promise.reject(n));const Ke=(...n)=>Ve(...n),Ct=(n,i)=>i?n?[n,...Array.isArray(i)?i:[i]]:i:n,wt=(n,{width:i=600,height:o=700,name:a="did-domain:popup"}={})=>{const s=window.screenX+(window.innerWidth-i)/2,r=window.screenY+(window.innerHeight-o)/2,u=[`left=${s}`,`top=${r}`,`width=${i}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],l=window.open("",a,u.join(","));if(l===null)throw new Error("Failed to open popup");return l.location.href=Zn(n,{opener:window.location.origin}),l},St="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Xe=async n=>{if(!n||!n?.trim())return null;const i=Ke(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:a}=await i.get(o.toString()),s=a?.componentMountPoints?.find(m=>m.did===St),r=new URL(n);r.pathname=s?.mountPoint;const u=r.toString(),l=ee(u,"/api");return{base:u,api:l}},Rt=Ge({embed:{iconTip:"Click to view subscription details"},buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),At=Ge({embed:{iconTip:"点击查看订阅详情"},buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),kt={zh:At,en:Rt},Tt=async({didDomainURL:n,delegatee:i,delegateePk:o})=>{const a=await Xe(n);if(!a)return null;const s=Ke({baseURL:a.api}),{data:r}=await s.post("/payment/session",{delegatee:i,delegateePk:o});return{sessionId:r.sessionId,baseURL:a.base}};function It({delegatee:n,delegateePk:i,didDomainURL:o,locale:a,title:s="",onSuccess:r=()=>{},...u}){const{t:l}=A(),[m,p]=et({currentState:1}),f=j.useRef(null),c=nt(async()=>{const d=await Tt({didDomainURL:o,delegatee:n,delegateePk:i});return d},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(d){console.error(d)}}),g=Y(d=>{d.data.type==="didDomain.success"&&(r?.({nftDid:d.data?.nftDid,domain:d.data?.domain,chainHost:d.data?.chainHost}),f.current?.close(),f.current=null,p({currentState:4}),setTimeout(()=>{p({currentState:8})},2e3))});tt(()=>{try{window.removeEventListener("message",g),f.current?.close(),f.current=null}catch(d){console.warn("Failed to close popup",d)}});const y=Y(()=>{p({currentState:1})}),x=Y(()=>{if(p({currentState:2}),!c.data){console.error("Failed to create session");return}b({sessionId:c.data.sessionId,baseURL:c.data.baseURL})}),b=Y(({sessionId:d,baseURL:w})=>{window.addEventListener("message",g);const C=new URL(w);C.searchParams.set("sessionId",d),C.searchParams.set("locale",a),C.searchParams.set("embed","1"),f.current=wt(C.toString());const q=setInterval(()=>{f.current?.closed&&(clearInterval(q),y())},1e3);return()=>clearInterval(q)});return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{loading:c.loading,onClick:x,variant:"contained",startIcon:e.jsx(Sn,{}),...u,children:s||l("buy.button.title")}),e.jsxs(Cn,{fullWidth:!0,maxWidth:"xs",open:m.currentState>1&&m.currentState<8,onClose:y,children:[!c.error&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[m.currentState===2&&e.jsx(z,{size:50}),m.currentState===4&&e.jsx(Rn,{sx:{color:"primary.main",fontSize:"5rem"}}),m.currentState===2&&e.jsx(R,{children:l("buy.status.inProgress")}),m.currentState===4&&e.jsx(R,{children:l("buy.status.success")})]}),c.error&&e.jsx(ye,{severity:"error",children:l("buy.error.failedToCreateSession")})]})]})}function Pt(n){return e.jsx(vn,{locale:n.locale,translations:kt,children:e.jsx(It,{...n})})}function qt({nftDid:n,didDomainURL:i,locale:o,sx:a={}}){const{t:s}=A(),[r,u]=se({safeIframeRef:null,popoverAnchorEl:null}),l=j.useRef(null),m=H(),p=ie(m.breakpoints.down("md")),f=x=>{u({popoverAnchorEl:x.currentTarget})},c=()=>{u({popoverAnchorEl:null})},g=it(async()=>{const x=await Xe(i);return x?x.base:null});if(!g.value)return null;if(g.loading)return e.jsx(z,{});const y=ee(g.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(L,{title:s("embed.iconTip"),children:e.jsx(h,{component:"img",src:ee(i,"/.well-known/service/blocklet/logo"),alt:"logo",onClick:f,sx:[{width:16,height:16},Ct({cursor:"pointer"},a)]})}),e.jsx($e,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:l,title:s("common.subscription"),width:p?"320px":"400px",height:"350px",style:{border:0,display:"block"},src:y})})]})}const Et=n=>["waiting","creating","renewaling"].includes(n);function en({siteId:n,domain:i,onAdd:o=()=>{},children:a=null,did:s,issuing:r=!1,setIssuing:u=()=>{}}){const{t:l}=A(),[m,p]=j.useState(!1),{inService:f}=F(),[c,g]=j.useState(null),{api:y,ws:{useSubscription:x}}=F(),{mode:b,actions:{refreshDomainStatus:d}}=oe(),w=xt(async()=>{const{cert:T}=await y.findCertificateByDomain({input:{domain:i,did:s}});return T}),C=(T,S)=>{T.domain===i&&(u(!1),p(!1),f&&b!=="setup"&&(S==="success"?E.success(l("setup.domain.genCertSuccess",{domain:T.domain})):S==="error"&&E.error(l("setup.domain.genCertFailed",{domain:T.domain,message:T.message}))))};if(j.useEffect(()=>{w.loading||u(Et(w.value?.status))},[w.loading,w.value?.status,u]),x(Ie.BlockletEvents.certError,T=>C(T,"error")),x(Ie.BlockletEvents.certIssued,T=>{w.retry(),d(T.domain),C(T,"success")}),w.loading||w.value?.status==="normal")return"";const q=()=>{p(!1),g(null)},B=async()=>{p(!0);try{await y.issueLetsEncryptCert({input:{siteId:n,domain:i,did:s,inBlockletSetup:b==="setup"}}),o(),u(!0)}catch(T){console.error(T),u(!1)}finally{p(!1),g(null)}},M={title:l("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ye,{severity:"success",children:l("router.cert.genLetsEncryptCert.dnsTip")}),l("router.cert.genLetsEncryptCert.description")]}),confirm:l("common.confirm"),onConfirm:B,onCancel:q},U=T=>{T.stopPropagation(),g(M)};return e.jsxs(e.Fragment,{children:[r?e.jsx(L,{title:l("router.cert.issuing"),children:e.jsx(z,{size:13,style:{fontSize:"13px"}})}):a({loading:m,open:U}),c&&e.jsx(re,{color:"primary",title:c.title,description:c.description,confirm:c.confirm,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}en.propTypes={domain:t.string.isRequired,did:t.string.isRequired,siteId:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function nn({domain:n,domainStatus:i,did:o,onAdd:a=()=>{},children:s=null,issuing:r=!1,setIssuing:u=()=>{},...l}){return st(n)||!Ze(n)||Qn(i)||i?.isHttps?"":e.jsx(en,{...l,domain:n,did:o,onAdd:a,issuing:r,setIssuing:u,children:s})}nn.propTypes={domain:t.string.isRequired,domainStatus:t.shape({isHttps:t.bool}).isRequired,did:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function tn({id:n,domain:i,children:o=null,teamDid:a="",onDelete:s=null}){const{t:r}=A(),[u,l]=j.useState(!1),[m,p]=j.useState(null),{api:f}=F(),c=()=>{l(!1),p(null)},g=async()=>{l(!0);try{await f.deleteDomainAlias({input:{id:n,domainAlias:i,teamDid:a}}),s?.(),await ot(2e3)}catch(b){E.error(b.message)}finally{p(null),l(!1)}},y={keyName:i,title:r("router.domainAlias.delete.title"),description:r("router.domainAlias.delete.description",{domain:i}),confirmPlaceholder:r("router.domainAlias.delete.confirmPlaceholder",{domain:i}),confirm:r("common.delete"),onConfirm:g,onCancel:c},x=b=>{b.stopPropagation(),p(y)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({loading:u,open:x}):e.jsxs(te,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[u?e.jsx(z,{size:16}):e.jsx(_e,{style:{fontSize:16}}),r("common.delete")]}),m&&e.jsx(gt,{keyName:m.keyName,title:m.title,description:m.description,confirmPlaceholder:m.confirmPlaceholder,confirm:m.confirm,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}tn.propTypes={id:t.string.isRequired,domain:t.string.isRequired,children:t.any,teamDid:t.string,onDelete:t.func};function sn({site:n,domain:i,blocklet:o,onDelete:a=()=>{}}){const{t:s}=A(),r=i.value===window.location.hostname;return e.jsx(ht,{"data-cy":"domain-actions",size:"large",actions:[({close:u})=>e.jsx(tn,{id:n.id,domain:i.value,teamDid:o?.meta?.did,onDelete:a,children:({open:l})=>e.jsx(L,{title:r?s("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:i.isProtected||r,dense:!0,onClick:m=>{u(),l(m)},"data-cy":"action-toggle-block",children:[e.jsx(An,{style:{minWidth:24,marginRight:8},children:e.jsx(_e,{})}),e.jsx(kn,{primary:s("common.delete")})]},"remove")})})})]})}sn.propTypes={site:t.object.isRequired,domain:t.object.isRequired,blocklet:t.object.isRequired,onDelete:t.func};const ae=t.shape({href:t.string,accessibility:t.shape({loading:t.bool,accessible:t.bool}),domainStatus:t.shape({isHttps:t.bool,matchedCert:t.object}),dns:t.shape({resolved:t.bool,ip:t.string})});function on({certificate:n={}}){const[i,o]=j.useState(null),a=F(),{t:s,locale:r}=A(),u=p=>{o(p.currentTarget)},l=()=>{o(null)},m=!!i;return e.jsxs(e.Fragment,{children:[e.jsx(Tn,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:u,onMouseLeave:l,style:{color:"#44cdc6",fontSize:"1em",cursor:"pointer"}}),e.jsx($e,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:e.jsx(In,{children:e.jsxs(Pn,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${a.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(R,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(R,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(R,{component:"div",children:`${s("common.issuer")}: ${Yn(n,"issuer.commonName","")}`}),e.jsx(R,{component:"div",children:`${s("router.cert.issuedOn")}: ${Pe(n.validFrom,r)}`}),e.jsx(R,{component:"div",children:`${s("router.cert.expiryOn")}: ${Pe(n.validTo,r)}`})]})]})})})]})}on.propTypes={certificate:t.object};function ne({domain:n,filters:i=["domain","http"]}){const{t:o}=A(),{value:a,domainStatus:s}=n;if(!Ze(a))return null;let r=null,u=null;const{isHttps:l,matchedCert:m}=s,{dns:{ip:p,isDnsResolved:f,isCnameMatch:c}={}}=s,g=f&&c;rt(a)||(g||p==="127.0.0.1"?r=e.jsx(L,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})),g?l?u=e.jsx(on,{certificate:m}):u=e.jsx(L,{title:o("router.domain.https.bad"),children:e.jsx(qn,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})}):u=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(En,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})});const y=i.map(x=>x==="domain"?r:x==="http"?u:null);return j.createElement(j.Fragment,null,...y)}ne.propTypes={domain:ae.isRequired,filters:t.array};const Lt=Je(be,"mutate_blocklets"),Ft=Je(be,"",at);function pi(n){const{inService:i}=F(),{blocklet:o,loadingRuntimeInfo:a}=oe();let s=Lt;return i&&(s=Ft),e.jsx(s,{...n,blocklet:o,inService:i,loadingRuntimeInfo:a})}const Fe="nft-domain";function be({hasPermission:n=!1,blocklet:i,loadingRuntimeInfo:o=!1,inService:a=!1,showAllDomains:s=!1,updateBlockletDomainAliases:r=()=>{},systemTips:u=null}){const{t:l}=A(),m=ie(d=>d.breakpoints.down("md")),p=j.useMemo(()=>{let d=n;return lt(i)&&(d=d&&a),d},[n,a,i]),{site:f}=i,c=j.useMemo(()=>Qe(i.site?.domainAliases),[i.site?.domainAliases]),g=j.useMemo(()=>c.filter(d=>!fe.isCustomDomain(d.value)),[c]),y=j.useMemo(()=>c.filter(d=>fe.isCustomDomain(d.value)),[c]),x=j.useMemo(()=>y.filter(d=>d.type!==Fe),[y]),b=j.useMemo(()=>y.filter(d=>d.type===Fe),[y]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{sx:{gap:3},children:[!!b.length&&e.jsx(X,{title:l("common.didDomains"),description:l("common.didDomainsDescription"),domains:b,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!x.length&&e.jsx(X,{title:l("common.manualDomains"),description:l("common.manualDomainsDescription"),domains:x,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!g.length&&e.jsxs(h,{children:[u,e.jsx(X,{title:l("common.systemDomains"),description:l("common.systemDomainsDescription"),domains:g,hasMutatePermission:p,blocklet:i,site:f,mobile:m,updateBlockletDomainAliases:r})]})]}),!c.length&&(o?e.jsx(z,{size:16}):e.jsx(wn,{children:l("common.empty")}))]})}be.propTypes={hasPermission:t.bool,blocklet:t.object.isRequired,loadingRuntimeInfo:t.bool,inService:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func,systemTips:t.node};function J({children:n=null}){return e.jsx(h,{component:"span",sx:{verticalAlign:"bottom"},children:n})}J.propTypes={children:t.node};function he({domain:n,children:i,suffix:o=null,...a}){const{t:s,locale:r}=A(),u=H(),{href:l,accessibility:m,value:p}=n,f=j.useCallback(()=>e.jsx(ze,{content:je(p),locale:r,style:{marginLeft:"4px",color:u.palette.text.secondary,fontSize:"0.8em"}}),[p,r,u]);return!m||m.loading?e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),f(),e.jsx(J,{children:o}),e.jsx(L,{title:s("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx(h,{component:"span",className:"status",children:e.jsx(z,{size:13,style:{fontSize:"13px"}})})})]}):m.accessible?e.jsxs(me,{component:"span",...a,children:[e.jsx(h,{component:"a",href:l,target:"_blank",rel:"noopener noreferrer",sx:{color:n.loading?"text.disabled":void 0},children:e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})})}),f(),e.jsx(J,{children:o})]}):e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:s("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),!n.loading&&f(),e.jsx(J,{children:o})]})}he.propTypes={domain:ae.isRequired,children:t.any.isRequired,suffix:t.node};const me=Mn(h)`
2
2
  display: inline-block;
3
3
  vertical-align: middle;
4
4
 
@@ -25,4 +25,4 @@ import{v as bn,T as vn,V as A,aL as Cn,H as E,w as te,au as wn,ba as Ue}from"./v
25
25
  margin-left: 8px;
26
26
  font-size: 13px;
27
27
  }
28
- `;function ge({hasMutatePermission:n,site:i,domain:o,blocklet:a,onDelete:s}){return n&&!o.isProtected?e.jsx(sn,{site:i,domain:o,blocklet:a,onDelete:s}):null}ge.propTypes={hasMutatePermission:t.bool.isRequired,site:t.object.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,onDelete:t.func.isRequired};function Y({siteId:n,domain:i,blocklet:o,hasMutatePermission:a}){const{info:s}=F(),{t:r,locale:u}=A(),[l,m]=j.useState(!1);return e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:.5,button:{lineHeight:1}},children:[i.type==="nft-domain"&&e.jsx(qt,{locale:u,nftDid:i.nftDid,didDomainURL:s.nftDomainUrl}),e.jsx(h,{sx:{display:"flex",mt:"-1px"},children:e.jsx(ne,{domain:i,filters:["http"]},`${i.value}-http`)}),a&&i.canGenerateCertificate&&e.jsx(nn,{siteId:n,domain:i.value,domainStatus:i.domainStatus,did:o.meta.did,issuing:l,setIssuing:m,children:({open:p})=>e.jsx(te,{sx:{padding:0},size:"small",onClick:f=>p(f),children:r("router.cert.genLetsEncryptCert.title")})})]})}Y.propTypes={siteId:t.string.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,hasMutatePermission:t.bool.isRequired};function X({title:n,description:i,domains:o=[],hasMutatePermission:a,blocklet:s,site:r,mobile:u,showAllDomains:l=!1,updateBlockletDomainAliases:m=()=>{}}){const[p,f]=j.useState(!1),c=j.useMemo(()=>l||p?o:o.slice(0,1),[o,p,l]),g=o.length>1,y=x=>a&&!x.isProtected;return e.jsx(We,{elevation:0,sx:{p:3,pb:l?3:1.5,display:"flex",alignItems:"flex-start",gap:3,borderRadius:2,border:"1px solid",borderColor:"divider",transition:"box-shadow 0.2s ease-in-out"},children:e.jsxs(W,{sx:{width:1},children:[e.jsxs(h,{sx:{mb:1.5},children:[e.jsx(R,{variant:"h6",children:n}),e.jsx(R,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i})]}),c.map((x,b)=>e.jsxs(W,{children:[b!==0&&e.jsx(h,{sx:{my:.75,width:1,height:"1px"}}),!u&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,svg:{width:"1em",height:"1em"},img:{width:"0.9em",height:"0.9em"}},children:[e.jsx(he,{domain:x,target:"_blank",children:x.value}),e.jsx(h,{sx:{mt:"2px"},children:e.jsx(Y,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})})]})]}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]}),u&&e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsx(he,{domain:x,target:"_blank",suffix:y(x)?null:e.jsx(h,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"space-between",svg:{width:"1em",height:"1rem"},img:{width:"0.9rem",height:"0.9rem"}},children:e.jsx(Y,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),children:x.value})]}),y(x)&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",ml:"18px"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center"},children:e.jsx(Y,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]})]})]},x.value)),g&&!l&&e.jsx(te,{onClick:()=>f(!p),sx:{p:0,mt:.5,alignSelf:"center"},children:p?e.jsx(Ln,{}):e.jsx(Fn,{})})]})})}X.propTypes={title:t.string.isRequired,description:t.string.isRequired,domains:t.array.isRequired,hasMutatePermission:t.bool.isRequired,blocklet:t.object.isRequired,site:t.object.isRequired,mobile:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func};const rn=j.createContext({}),{Provider:Mt,Consumer:fi}=rn;function Bt({children:n}){const[i,o]=se({domain:"",error:null}),{locale:a}=A(),s={error:i.error,domain:i.domain,setError:r=>{o({error:r})},setDomain:r=>{const u=je(r),l=Qe(u,a);o({domain:u,error:l})}};return e.jsx(Mt,{value:{value:s},children:n})}function zt(){const{value:n}=j.useContext(rn);return n}var ue,Me;function Ut(){if(Me)return ue;Me=1;const{joinURL:n}=ct(),i=dt(),o="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p";return ue={DID_DOMAIN_SERVICE_DID:o,getDidDomainServiceURL:async s=>{if(!s||!s?.trim())return null;const r=new URL(s);r.pathname="__blocklet__.js",r.searchParams.set("type","json");const{data:u}=await i.get(r.toString()),l=u?.componentMountPoints?.find(c=>c.did===o),m=new URL(s);m.pathname=l?.mountPoint;const p=m.toString(),f=n(p,"/api");return{base:p,api:f,domain:n(f,"/domains")}}},ue}var Nt=Ut();const $t=He(Kn),_t=He(Yn);var pe,Be;function Ot(){if(Be)return pe;Be=1;const n=$t,i=_t;function o(s){return!s||typeof s!="string"?!1:s.split(".").length===2}return pe={isTopLevelDomain:o,formatTopLevelDidDomain:s=>{const r=n(i(s));return r&&(o(r)?`www.${r}`:r)}},pe}var ze=Ot(),Wt=mt();const Ht=Xn(Wt);function an({domain:n="",resolvedTarget:i,...o}){const{t:a,locale:s}=A();return e.jsxs(h,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...o,children:[e.jsxs(h,{sx:{display:"flex",flexWrap:"wrap"},children:[a("router.domain.setup.tipStart"),n&&e.jsx(h,{sx:{mx:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:n}),a("router.domain.setup.tipEnd"),":"]}),e.jsxs(W,{sx:{gap:.5,"&>div":{mb:0},marginTop:"12px"},children:[e.jsx(De,{label:a("router.domain.setup.recordType"),value:"CNAME",locale:s}),e.jsx(De,{label:a("router.domain.setup.recordValue"),value:i,locale:s})]})]})}an.propTypes={domain:t.string,resolvedTarget:t.string.isRequired};function De({locale:n,label:i,value:o}){const a=ie(r=>r.breakpoints.down("md")),s=H();return e.jsx(yt,{name:i,nameWidth:120,children:e.jsxs(h,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(R,{component:"span",sx:[{color:"primary.main",overflow:"auto"},a?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"}],children:o}),e.jsx(Ue,{content:o,locale:n,style:{marginLeft:"4px",color:s.palette.text.secondary}})]})})}De.propTypes={locale:t.string.isRequired,label:t.string.isRequired,value:t.string.isRequired};function ln({children:n=null,href:i="",sx:o=null,showIcon:a=!1,...s}){const r=H();return e.jsxs(Bn,{href:i,target:"_blank",...s,sx:{display:"inline-flex",alignItems:"center",color:"text.primary",":hover":{color:r.palette.primary.main},...o},children:[n,a&&e.jsx(zn,{fontSize:"small",sx:{ml:"4px",fontSize:"1rem"}})]})}ln.propTypes={children:t.node,sx:t.object,href:t.string,showIcon:t.bool};function cn({records:n}){return e.jsx(Un,{component:h,sx:{".MuiTableCell-root":{color:"text.primary"}},children:e.jsxs(Nn,{children:[e.jsx($n,{children:e.jsxs(Te,{children:[e.jsx(_,{children:"Type"}),e.jsx(_,{children:"Name"}),e.jsx(_,{children:"Data"})]})}),e.jsx(_n,{children:n.map(i=>e.jsxs(Te,{children:[e.jsx(_,{children:i.type}),e.jsx(_,{children:i.name}),e.jsx(_,{sx:{wordBreak:"break-word"},children:e.jsx(bt,{children:i.data})})]},i.name))})]})})}cn.propTypes={records:t.array.isRequired};function dn({url:n,domain:i=""}){const{t:o}=A();return e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step1Title")}),e.jsxs(R,{component:"section",children:[o("setting.dns.step1Desc1"),e.jsx(ln,{href:"https://lookup.icann.org/",target:"_blank",children:"ICANN"})]})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step2Title",{url:n})}),e.jsx(R,{component:"section",children:o("setting.dns.step2Desc")})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step3Title")}),e.jsx(R,{component:"section",children:o("setting.dns.step3Desc")}),e.jsx(cn,{records:[{type:"CNAME",name:jt(n),data:i}]})]})]})}dn.propTypes={url:t.string.isRequired,domain:t.string};const mn=j.createContext();function Vt({children:n}){const{t:i}=A(),{api:o}=F(),{blocklet:a}=oe(),[s,r]=j.useState(null),u=j.useCallback(async(p,f)=>{try{const c=await o.getBlocklet({input:{domain:p,did:a?.meta?.did}});return c?.blocklet?new Promise(g=>{r({title:i("setting.domain.conflictTitle",{domain:p}),description:i("setting.domain.conflictDescription",{domain:p,title:c.blocklet.meta?.title,from:c.blocklet.meta?.title,to:a.meta?.title}),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:async()=>{r(null),await f?.(),g(!0)},onCancel:()=>{r(null),g(!1)}})}):!1}catch(c){return console.error(c),E.error(N(c)),!1}},[o,i,a]),l=j.useCallback(()=>s?e.jsx(re,{title:s.title,description:s.description,confirm:s.confirm,cancel:s.cancel,onConfirm:s.onConfirm,onCancel:s.onCancel}):null,[s]),m=j.useMemo(()=>({checkConflict:u}),[u]);return e.jsxs(mn.Provider,{value:m,children:[n,l()]})}function un(){return j.useContext(mn)}function pn({siteId:n,teamDid:i,cnameDomain:o,defaultCustomDomain:a="",onInputDomain:s=J,appId:r="",appPk:u="",onSuccess:l=J,onError:m=J,disabled:p=!1,autoFocus:f=!0,inBlockletSetup:c=!1,shouldCheckDomain:g=!1,onStateChange:y=J,currentIp:x="",...b}){const{t:d,locale:w}=A(),{api:C,info:q}=F(),{blocklet:B}=oe(),M=zt(),z=H(),T=ut({key:"sm"}),[S,P]=se({submittingDomain:!1,domain:a,error:null,type:q?.nftDomainUrl?"nftDomain":"inputDomain",showDnsTip:!1}),le=xe.getDisplayName(B),{checkConflict:ve}=un(),{connectApi:gn}=pt(),V=Dt(()=>Nt.getDidDomainServiceURL(q?.nftDomainUrl));if(q?.nftDomainUrl&&V.loading)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:e.jsx(U,{})})});if(V.error)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:V.error.message})});const Ce=V.value,ce=()=>{P({invalidDNSDomain:null})},we=async(D,v,k=!1)=>{await C.addDomainAlias({input:{id:n,domainAlias:D,teamDid:i,inBlockletSetup:!0,force:k}}),P({submittingDomain:!1}),l({domain:D,type:"inputDomain",canGenerateCertificate:!v})},de=async(D,v)=>{y(d("setting.domain.addingDomain"));try{await we(D,v,!1)}catch(k){if(console.error(k),ce(),N(k).includes("already exists")){await ve(D,()=>we(D,v,!0));return}E.error(N(k))}},Se=async({domain:D,type:v,nftDid:k,chainHost:O})=>{try{if(!g){if(v==="inputDomain"){await de(D);return}l({domain:D,type:v,nftDid:k,chainHost:O});return}y({text:d("setting.domain.checkingResolvable")});let I=30;const $=3e3,jn=I*1e3/$,ke=setInterval(()=>{if(I<=0){clearInterval(ke);return}y({text:`${d("setting.domain.checkingResolvable")} (${I--}s)`})},1e3),G=await Ht(()=>C.getDomainDNS({input:{teamDid:i,domain:D}}),{retries:jn,minTimeout:$,maxTimeout:$,onFailedAttempt:console.error});if(clearInterval(ke),!G?.isDnsResolved||!G?.isCnameMatch){let Z="";if(G.isDnsResolved?G.isCnameMatch||(Z=d("setting.domain.resolvedAddressError",{domain:D,curDomain:o})):Z=d("setting.domain.cannotResolve",{domain:D}),v==="nftDomain"){E.error(Z),l({domain:D,type:"nftDomain"});return}y({text:""}),P({invalidDNSDomain:{domain:D,error:Z},domain:D,type:v,submittingDomain:!1});return}if(v==="nftDomain"){l({domain:D,type:"nftDomain"});return}await de(D)}catch(I){E.error(I.message),y({text:""}),P({submittingDomain:!1})}},Re=async({domain:D,nftDid:v,chainHost:k,force:O})=>{let I=Le(D);I=ze.formatTopLevelDidDomain(I),P({submittingDomain:!0}),await C.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:I,nftDid:v,chainHost:k,teamDid:i,inBlockletSetup:c,force:O}});const $="nftDomain";P({type:$}),await Se({domain:I,type:$,nftDid:v,chainHost:k})},Dn=async({domain:D,nftDid:v,chainHost:k,isDomainOwner:O})=>{if(!O){const I=d("router.domainAlias.addDomainNFT.authorizeFailed");E.error(I),P({submittingDomain:!1,error:I});return}try{await Re({domain:D,nftDid:v,chainHost:k,force:!1})}catch(I){if(console.error(I),ce(),N(I).includes("already exists")){await ve(D,()=>Re({domain:D,nftDid:v,chainHost:k,force:!0}));return}E.error(N(I))}finally{P({submittingDomain:!1})}},yn=async()=>{try{P({submittingDomain:!0});const D=Le(S.domain);if(q.nftDomainUrl&&Ce&&(await C.isDidDomain({input:{domain:D}})).value===!0){gn.openPopup({prefix:"/connect-to-did-domain",custom:!0,locale:w,extraParams:{provider:"wallet",delegatee:r,delegateePk:u,domain:ze.formatTopLevelDidDomain(S.domain),appName:le,appUrl:xe.getAppUrl(B)},message:{title:d("router.domainAlias.addDomainNFT.connect.title",{appName:le}),scan:d("router.domainAlias.addDomainNFT.connect.scan",{domain:S.domain,appName:le}),confirm:d("router.domainAlias.addDomainNFT.connect.confirm"),success:d("router.domainAlias.addDomainNFT.connect.success")},onSuccess:Dn,onError:k=>{E.error(k.message),P({submittingDomain:!1})},onClose:()=>P({submittingDomain:!1}),checkTimeout:60*5e3},{baseUrl:Ce.base,locale:w});return}await Se({domain:D,type:S.type})}catch(D){P({submittingDomain:!1}),M.setError(D.message)}},Ae=M.error||S.error;return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(h,{component:"form",onSubmit:D=>{D.preventDefault(),yn()},sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(R,{sx:{color:z.palette.text.primary},children:d("router.domainAlias.add.tips")}),e.jsx(On,{sx:{display:"block",marginTop:"8px"},label:d("router.domainAlias.add.domainDescription"),helperText:S.type==="inputDomain"&&Ae||d("router.domainAlias.add.helperText"),fullWidth:!0,disabled:p,value:S.domain,size:"small",variant:"outlined",error:!!Ae&&S.type==="inputDomain",onChange:D=>{const v=je(D.target?.value);M.setDomain(v);const k=Qe(v,w);P({domain:v,error:k,type:"inputDomain"}),s({domain:v,error:k,type:"inputDomain"})},autoFocus:f,onBlur:()=>{M.domain||(P({error:null}),M.setError(null))},slotProps:{htmlInput:{"data-cy":"domain-name-input"}}}),e.jsx(h,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(Ne,{"data-cy":"confirm-add-domain",fullWidth:T,variant:"contained",loading:S.submittingDomain,type:"submit",children:d("common.add")})}),e.jsx(h,{sx:{backgroundColor:()=>Wn(z.palette.primary.light,.1),borderRadius:"8px",padding:"12px"},children:d("router.domainAlias.addDomainNFT.topLevelDidDomainHint")}),e.jsxs(h,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:z.palette.primary.main},onClick:()=>P({showDnsTip:!S.showDnsTip}),children:[e.jsx(Hn,{fontSize:"1em"}),d("router.domainAlias.showTipHint")]}),S.showDnsTip&&e.jsx(an,{domain:S.domain,resolvedTarget:o,style:{marginTop:"4px"}})]}),S.invalidDNSDomain&&e.jsx(re,{maxWidth:"md",title:d("common.reminder"),description:e.jsxs(W,{sx:{gap:2},children:[e.jsx(ye,{severity:"warning",children:d("setting.domain.invalidDNSReminder",{error:S.invalidDNSDomain.error})}),e.jsx(dn,{url:S.domain,domain:o})]}),color:"primary",confirm:d("setting.domain.continueAdd"),onConfirm:()=>de(S.invalidDNSDomain.domain,S.type),onCancel:ce})]})})}pn.propTypes={siteId:t.string.isRequired,currentIp:t.string,teamDid:t.string.isRequired,cnameDomain:t.string.isRequired,defaultCustomDomain:t.string,onInputDomain:t.func,onSuccess:t.func,appId:t.string,appPk:t.string,disabled:t.bool,autoFocus:t.bool,inBlockletSetup:t.bool,shouldCheckDomain:t.bool,onStateChange:t.func,onError:t.func};function fn({id:n,children:i=null,title:o="",teamDid:a="",systemDomains:s,appId:r=null,appPk:u,onAddDomainAlias:l=()=>{},...m}){const{t:p}=A(),[f,c]=se({loading:!1,confirmSetting:null}),g=s.find(d=>fe.isDidDomain(d)),y=()=>{c({loading:!1,confirmSetting:null})},x={title:o||p("router.domainAlias.add.title"),description:function(w,C,q){return e.jsx(pn,{siteId:n,teamDid:a,cnameDomain:g,onSuccess:B=>{l(B),c({confirmSetting:null})},onInputDomain:({domain:B,type:M,error:z})=>{C({...w,domain:B,type:M,__disableConfirm:!!z}),q(z)},appId:r,appPk:u,...m})},confirm:p("common.confirm"),cancel:p("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:y},b=d=>{d.stopPropagation(),c({confirmSetting:x})};return e.jsxs(e.Fragment,{children:[typeof i=="function"?i({loading:f.loading,open:b}):e.jsxs(Oe,{onClick:b,className:"rule-action","data-cy":"action-add-domain-alias",children:[f.loading?e.jsx(U,{size:16}):e.jsx(Vn,{style:{fontSize:18,marginRight:5}}),p("router.domainAlias.add.title")]}),f.confirmSetting&&e.jsx(re,{title:f.confirmSetting.title,description:f.confirmSetting.description,confirm:f.confirmSetting.confirm,cancel:f.confirmSetting.cancel,params:f.confirmSetting.params,onCancel:f.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:f.loading,maxWidth:"sm"})]})}fn.propTypes={id:t.string.isRequired,children:t.any,title:t.string,teamDid:t.string,systemDomains:t.arrayOf(t.string).isRequired,appId:t.string,appPk:t.string.isRequired,onAddDomainAlias:t.func};function Gt(n){return e.jsx(Bt,{children:e.jsx(fn,{...n})})}function xn({appId:n,appPk:i,siteId:o,inBlockletSetup:a,teamDid:s,sx:r={},onAddDomainAlias:u=()=>{},...l}){const{api:m,info:p}=F(),{locale:f,t:c}=A(),{checkConflict:g}=un(),y=async({domain:b,nftDid:d,chainHost:w,force:C})=>{const q={id:o,type:"nft-domain",domainAlias:b,nftDid:d,chainHost:w,teamDid:s,inBlockletSetup:a,force:C};return await m.addDomainAlias({input:q}),q},x=async({domain:b,nftDid:d,chainHost:w})=>{try{const C=await y({domain:b,nftDid:d,chainHost:w,force:!1});u(C)}catch(C){if(N(C).includes("already exists")){await g(b,()=>y({domain:b,nftDid:d,chainHost:w,force:!0}));return}E.error(N(C))}};return e.jsx(Pt,{delegatee:n,delegateePk:i,didDomainURL:p.nftDomainUrl,onSuccess:x,locale:f,variant:"outlined",sx:r,title:c("router.domainAlias.addDomainNFT.buy"),...l})}xn.propTypes={appId:t.string.isRequired,appPk:t.string.isRequired,siteId:t.string.isRequired,inBlockletSetup:t.bool.isRequired,teamDid:t.string.isRequired,sx:t.object,onAddDomainAlias:t.func};function Zt({blocklet:n,bugDidDomainProps:i={},connectDomainProps:o={},updateBlockletDomainAliases:a=()=>{}}){const{t:s}=A(),{info:r}=F(),u=ie(c=>c.breakpoints.down("md")),{site:l}=n,m=j.useMemo(()=>Je(n.site?.domainAliases),[n.site?.domainAliases]),p=n.environments?.find(c=>c.key==="BLOCKLET_APP_PK")?.value,f=ft(m);return e.jsx(Vt,{children:e.jsx(hn,{action:e.jsxs(h,{sx:{display:"flex",alignItems:u?"stretch":"center",flexDirection:u?"column":"row",gap:1},children:[r.nftDomainUrl&&e.jsx(xn,{variant:"contained",appId:n.appPid,appPk:p,siteId:l.id,inBlockletSetup:!1,teamDid:n.meta.did,onAddDomainAlias:c=>{const g={value:c.domainAlias,isProtected:!1,type:c.type,nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0}};a(g)},...i}),e.jsx(Gt,{id:l.id,title:s("common.connectExistingDomain"),teamDid:n.meta?.did,appId:n.appPid,appPk:p,systemDomains:f?.map(c=>c.value),onAddDomainAlias:c=>{const g={value:c.domain,isProtected:!1,type:c.type==="nftDomain"?"nft-domain":"",nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0},canGenerateCertificate:c.canGenerateCertificate===void 0?!0:c.canGenerateCertificate};a(g)},...o,children:({open:c})=>e.jsxs(te,{variant:"outlined",sx:{borderColor:"#ddd",color:"text.primary","&:hover":{bgcolor:g=>g.palette.primary.main,color:g=>g.palette.primary.contrastText}},"data-cy":"add-domain-alias",onClick:c,disabled:xe.isInProgress(n.status),children:[e.jsx(Gn,{style:{fontSize:"1.3em",marginRight:4}}),s("common.connectExistingDomain")]})})]})})})}Zt.propTypes={blocklet:t.object.isRequired,bugDidDomainProps:t.object,connectDomainProps:t.object,updateBlockletDomainAliases:t.func};function hn({action:n}){const{t:i}=A();return e.jsxs(We,{elevation:0,sx:{p:3,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(h,{sx:{flex:1,width:0,mb:1.5},children:[e.jsx(R,{variant:"h6",children:i("common.bugOrConnectDomain")}),e.jsx(R,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i("common.bugOrConnectDomainTip")})]})}),n]})}hn.propTypes={action:t.element.isRequired};export{Bt as D,Zt as a,pi as b};
28
+ `;function ge({hasMutatePermission:n,site:i,domain:o,blocklet:a,onDelete:s}){return n&&!o.isProtected?e.jsx(sn,{site:i,domain:o,blocklet:a,onDelete:s}):null}ge.propTypes={hasMutatePermission:t.bool.isRequired,site:t.object.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,onDelete:t.func.isRequired};function K({siteId:n,domain:i,blocklet:o,hasMutatePermission:a}){const{info:s}=F(),{t:r,locale:u}=A(),[l,m]=j.useState(!1);return e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:.5,button:{lineHeight:1}},children:[i.type==="nft-domain"&&e.jsx(qt,{locale:u,nftDid:i.nftDid,didDomainURL:s.nftDomainUrl}),e.jsx(h,{sx:{display:"flex",mt:"-1px"},children:e.jsx(ne,{domain:i,filters:["http"]},`${i.value}-http`)}),a&&i.canGenerateCertificate&&e.jsx(nn,{siteId:n,domain:i.value,domainStatus:i.domainStatus,did:o.meta.did,issuing:l,setIssuing:m,children:({open:p})=>e.jsx(te,{sx:{padding:0},size:"small",onClick:f=>p(f),children:r("router.cert.genLetsEncryptCert.title")})})]})}K.propTypes={siteId:t.string.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,hasMutatePermission:t.bool.isRequired};function X({title:n,description:i,domains:o=[],hasMutatePermission:a,blocklet:s,site:r,mobile:u,showAllDomains:l=!1,updateBlockletDomainAliases:m=()=>{}}){const[p,f]=j.useState(!1),c=j.useMemo(()=>l||p?o:o.slice(0,1),[o,p,l]),g=o.length>1,y=x=>a&&!x.isProtected;return e.jsx(We,{elevation:0,sx:{p:3,pb:l?3:1.5,display:"flex",alignItems:"flex-start",gap:3,borderRadius:2,border:"1px solid",borderColor:"divider",transition:"box-shadow 0.2s ease-in-out"},children:e.jsxs(W,{sx:{width:1},children:[e.jsxs(h,{sx:{mb:1.5},children:[e.jsx(R,{variant:"h6",children:n}),e.jsx(R,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i})]}),c.map((x,b)=>e.jsxs(W,{children:[b!==0&&e.jsx(h,{sx:{my:.75,width:1,height:"1px"}}),!u&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,svg:{width:"1em",height:"1em"},img:{width:"0.9em",height:"0.9em"}},children:[e.jsx(he,{domain:x,target:"_blank",children:x.value}),e.jsx(h,{sx:{mt:"2px"},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})})]})]}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]}),u&&e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsx(he,{domain:x,target:"_blank",suffix:y(x)?null:e.jsx(h,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"space-between",svg:{width:"1em",height:"1rem"},img:{width:"0.9rem",height:"0.9rem"}},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),children:x.value})]}),y(x)&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",ml:"18px"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center"},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]})]})]},x.value)),g&&!l&&e.jsx(te,{onClick:()=>f(!p),sx:{p:0,mt:.5,alignSelf:"center"},children:p?e.jsx(Ln,{}):e.jsx(Fn,{})})]})})}X.propTypes={title:t.string.isRequired,description:t.string.isRequired,domains:t.array.isRequired,hasMutatePermission:t.bool.isRequired,blocklet:t.object.isRequired,site:t.object.isRequired,mobile:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func};const rn=j.createContext({}),{Provider:Mt,Consumer:fi}=rn;function Bt({children:n}){const[i,o]=se({domain:"",error:null}),{locale:a}=A(),s={error:i.error,domain:i.domain,setError:r=>{o({error:r})},setDomain:r=>{const u=je(r),l=Ye(u,a);o({domain:u,error:l})}};return e.jsx(Mt,{value:{value:s},children:n})}function Ut(){const{value:n}=j.useContext(rn);return n}var ue,Me;function zt(){if(Me)return ue;Me=1;const{joinURL:n}=ct(),i=dt(),o="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p";return ue={DID_DOMAIN_SERVICE_DID:o,getDidDomainServiceURL:async s=>{if(!s||!s?.trim())return null;const r=new URL(s);r.pathname="__blocklet__.js",r.searchParams.set("type","json");const{data:u}=await i.get(r.toString()),l=u?.componentMountPoints?.find(c=>c.did===o),m=new URL(s);m.pathname=l?.mountPoint;const p=m.toString(),f=n(p,"/api");return{base:p,api:f,domain:n(f,"/domains")}}},ue}var Nt=zt();const $t=He(Jn),_t=He(Kn);var pe,Be;function Ot(){if(Be)return pe;Be=1;const n=$t,i=_t;function o(s){return!s||typeof s!="string"?!1:s.split(".").length===2}return pe={isTopLevelDomain:o,formatTopLevelDidDomain:s=>{const r=n(i(s));return r&&(o(r)?`www.${r}`:r)}},pe}var Ue=Ot(),Wt=mt();const Ht=Xn(Wt);function an({domain:n="",resolvedTarget:i,...o}){const{t:a,locale:s}=A();return e.jsxs(h,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...o,children:[e.jsxs(h,{sx:{display:"flex",flexWrap:"wrap"},children:[a("router.domain.setup.tipStart"),n&&e.jsx(h,{sx:{mx:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:n}),a("router.domain.setup.tipEnd"),":"]}),e.jsxs(W,{sx:{gap:.5,"&>div":{mb:0},marginTop:"12px"},children:[e.jsx(De,{label:a("router.domain.setup.recordType"),value:"CNAME",locale:s}),e.jsx(De,{label:a("router.domain.setup.recordValue"),value:i,locale:s})]})]})}an.propTypes={domain:t.string,resolvedTarget:t.string.isRequired};function De({locale:n,label:i,value:o}){const a=ie(r=>r.breakpoints.down("md")),s=H();return e.jsx(yt,{name:i,nameWidth:120,children:e.jsxs(h,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(R,{component:"span",sx:[{color:"primary.main",overflow:"auto"},a?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"}],children:o}),e.jsx(ze,{content:o,locale:n,style:{marginLeft:"4px",color:s.palette.text.secondary}})]})})}De.propTypes={locale:t.string.isRequired,label:t.string.isRequired,value:t.string.isRequired};function ln({children:n=null,href:i="",sx:o=null,showIcon:a=!1,...s}){const r=H();return e.jsxs(Bn,{href:i,target:"_blank",...s,sx:{display:"inline-flex",alignItems:"center",color:"text.primary",":hover":{color:r.palette.primary.main},...o},children:[n,a&&e.jsx(Un,{fontSize:"small",sx:{ml:"4px",fontSize:"1rem"}})]})}ln.propTypes={children:t.node,sx:t.object,href:t.string,showIcon:t.bool};function cn({records:n}){return e.jsx(zn,{component:h,sx:{".MuiTableCell-root":{color:"text.primary"}},children:e.jsxs(Nn,{children:[e.jsx($n,{children:e.jsxs(Te,{children:[e.jsx(_,{children:"Type"}),e.jsx(_,{children:"Name"}),e.jsx(_,{children:"Data"})]})}),e.jsx(_n,{children:n.map(i=>e.jsxs(Te,{children:[e.jsx(_,{children:i.type}),e.jsx(_,{children:i.name}),e.jsx(_,{sx:{wordBreak:"break-word"},children:e.jsx(bt,{children:i.data})})]},i.name))})]})})}cn.propTypes={records:t.array.isRequired};function dn({url:n,domain:i=""}){const{t:o}=A();return e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step1Title")}),e.jsxs(R,{component:"section",children:[o("setting.dns.step1Desc1"),e.jsx(ln,{href:"https://lookup.icann.org/",target:"_blank",children:"ICANN"})]})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step2Title",{url:n})}),e.jsx(R,{component:"section",children:o("setting.dns.step2Desc")})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step3Title")}),e.jsx(R,{component:"section",children:o("setting.dns.step3Desc")}),e.jsx(cn,{records:[{type:"CNAME",name:jt(n),data:i}]})]})]})}dn.propTypes={url:t.string.isRequired,domain:t.string};const mn=j.createContext();function Vt({children:n}){const{t:i}=A(),{api:o}=F(),{blocklet:a}=oe(),[s,r]=j.useState(null),u=j.useCallback(async(p,f)=>{try{const c=await o.getBlocklet({input:{domain:p,did:a?.meta?.did}});return c?.blocklet?new Promise(g=>{r({title:i("setting.domain.conflictTitle",{domain:p}),description:i("setting.domain.conflictDescription",{domain:p,title:c.blocklet.meta?.title,from:c.blocklet.meta?.title,to:a.meta?.title}),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:async()=>{r(null),await f?.(),g(!0)},onCancel:()=>{r(null),g(!1)}})}):!1}catch(c){return console.error(c),E.error(N(c)),!1}},[o,i,a]),l=j.useCallback(()=>s?e.jsx(re,{title:s.title,description:s.description,confirm:s.confirm,cancel:s.cancel,onConfirm:s.onConfirm,onCancel:s.onCancel}):null,[s]),m=j.useMemo(()=>({checkConflict:u}),[u]);return e.jsxs(mn.Provider,{value:m,children:[n,l()]})}function un(){return j.useContext(mn)}function pn({siteId:n,teamDid:i,cnameDomain:o,defaultCustomDomain:a="",onInputDomain:s=Q,appId:r="",appPk:u="",onSuccess:l=Q,onError:m=Q,disabled:p=!1,autoFocus:f=!0,inBlockletSetup:c=!1,shouldCheckDomain:g=!1,onStateChange:y=Q,currentIp:x="",...b}){const{t:d,locale:w}=A(),{api:C,info:q}=F(),{blocklet:B}=oe(),M=Ut(),U=H(),T=ut({key:"sm"}),[S,P]=se({submittingDomain:!1,domain:a,error:null,type:q?.nftDomainUrl?"nftDomain":"inputDomain",showDnsTip:!1}),le=xe.getDisplayName(B),{checkConflict:ve}=un(),{connectApi:gn}=pt(),V=Dt(()=>Nt.getDidDomainServiceURL(q?.nftDomainUrl));if(q?.nftDomainUrl&&V.loading)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:e.jsx(z,{})})});if(V.error)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:V.error.message})});const Ce=V.value,ce=()=>{P({invalidDNSDomain:null})},we=async(D,v,k=!1)=>{await C.addDomainAlias({input:{id:n,domainAlias:D,teamDid:i,inBlockletSetup:!0,force:k}}),P({submittingDomain:!1}),l({domain:D,type:"inputDomain",canGenerateCertificate:!v})},de=async(D,v)=>{y(d("setting.domain.addingDomain"));try{await we(D,v,!1)}catch(k){if(console.error(k),ce(),N(k).includes("already exists")){await ve(D,()=>we(D,v,!0));return}E.error(N(k))}},Se=async({domain:D,type:v,nftDid:k,chainHost:O})=>{try{if(!g){if(v==="inputDomain"){await de(D);return}l({domain:D,type:v,nftDid:k,chainHost:O});return}y({text:d("setting.domain.checkingResolvable")});let I=30;const $=3e3,jn=I*1e3/$,ke=setInterval(()=>{if(I<=0){clearInterval(ke);return}y({text:`${d("setting.domain.checkingResolvable")} (${I--}s)`})},1e3),G=await Ht(()=>C.getDomainDNS({input:{teamDid:i,domain:D}}),{retries:jn,minTimeout:$,maxTimeout:$,onFailedAttempt:console.error});if(clearInterval(ke),!G?.isDnsResolved||!G?.isCnameMatch){let Z="";if(G.isDnsResolved?G.isCnameMatch||(Z=d("setting.domain.resolvedAddressError",{domain:D,curDomain:o})):Z=d("setting.domain.cannotResolve",{domain:D}),v==="nftDomain"){E.error(Z),l({domain:D,type:"nftDomain"});return}y({text:""}),P({invalidDNSDomain:{domain:D,error:Z},domain:D,type:v,submittingDomain:!1});return}if(v==="nftDomain"){l({domain:D,type:"nftDomain"});return}await de(D)}catch(I){E.error(I.message),y({text:""}),P({submittingDomain:!1})}},Re=async({domain:D,nftDid:v,chainHost:k,force:O})=>{let I=Le(D);I=Ue.formatTopLevelDidDomain(I),P({submittingDomain:!0}),await C.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:I,nftDid:v,chainHost:k,teamDid:i,inBlockletSetup:c,force:O}});const $="nftDomain";P({type:$}),await Se({domain:I,type:$,nftDid:v,chainHost:k})},Dn=async({domain:D,nftDid:v,chainHost:k,isDomainOwner:O})=>{if(!O){const I=d("router.domainAlias.addDomainNFT.authorizeFailed");E.error(I),P({submittingDomain:!1,error:I});return}try{await Re({domain:D,nftDid:v,chainHost:k,force:!1})}catch(I){if(console.error(I),ce(),N(I).includes("already exists")){await ve(D,()=>Re({domain:D,nftDid:v,chainHost:k,force:!0}));return}E.error(N(I))}finally{P({submittingDomain:!1})}},yn=async()=>{try{P({submittingDomain:!0});const D=Le(S.domain);if(q.nftDomainUrl&&Ce&&(await C.isDidDomain({input:{domain:D}})).value===!0){gn.openPopup({prefix:"/connect-to-did-domain",custom:!0,locale:w,extraParams:{provider:"wallet",delegatee:r,delegateePk:u,domain:Ue.formatTopLevelDidDomain(S.domain),appName:le,appUrl:xe.getAppUrl(B)},message:{title:d("router.domainAlias.addDomainNFT.connect.title",{appName:le}),scan:d("router.domainAlias.addDomainNFT.connect.scan",{domain:S.domain,appName:le}),confirm:d("router.domainAlias.addDomainNFT.connect.confirm"),success:d("router.domainAlias.addDomainNFT.connect.success")},onSuccess:Dn,onError:k=>{E.error(k.message),P({submittingDomain:!1})},onClose:()=>P({submittingDomain:!1}),checkTimeout:60*5e3},{baseUrl:Ce.base,locale:w});return}await Se({domain:D,type:S.type})}catch(D){P({submittingDomain:!1}),M.setError(D.message)}},Ae=M.error||S.error;return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(h,{component:"form",onSubmit:D=>{D.preventDefault(),yn()},sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(R,{sx:{color:U.palette.text.primary},children:d("router.domainAlias.add.tips")}),e.jsx(On,{sx:{display:"block",marginTop:"8px"},label:d("router.domainAlias.add.domainDescription"),helperText:S.type==="inputDomain"&&Ae||d("router.domainAlias.add.helperText"),fullWidth:!0,disabled:p,value:S.domain,size:"small",variant:"outlined",error:!!Ae&&S.type==="inputDomain",onChange:D=>{const v=je(D.target?.value);M.setDomain(v);const k=Ye(v,w);P({domain:v,error:k,type:"inputDomain"}),s({domain:v,error:k,type:"inputDomain"})},autoFocus:f,onBlur:()=>{M.domain||(P({error:null}),M.setError(null))},slotProps:{htmlInput:{"data-cy":"domain-name-input"}}}),e.jsx(h,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(Ne,{"data-cy":"confirm-add-domain",fullWidth:T,variant:"contained",loading:S.submittingDomain,type:"submit",children:d("common.add")})}),e.jsx(h,{sx:{backgroundColor:()=>Wn(U.palette.primary.light,.1),borderRadius:"8px",padding:"12px"},children:d("router.domainAlias.addDomainNFT.topLevelDidDomainHint")}),e.jsxs(h,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:U.palette.primary.main},onClick:()=>P({showDnsTip:!S.showDnsTip}),children:[e.jsx(Hn,{fontSize:"1em"}),d("router.domainAlias.showTipHint")]}),S.showDnsTip&&e.jsx(an,{domain:S.domain,resolvedTarget:o,style:{marginTop:"4px"}})]}),S.invalidDNSDomain&&e.jsx(re,{maxWidth:"md",title:d("common.reminder"),description:e.jsxs(W,{sx:{gap:2},children:[e.jsx(ye,{severity:"warning",children:d("setting.domain.invalidDNSReminder",{error:S.invalidDNSDomain.error})}),e.jsx(dn,{url:S.domain,domain:o})]}),color:"primary",confirm:d("setting.domain.continueAdd"),onConfirm:()=>de(S.invalidDNSDomain.domain,S.type),onCancel:ce})]})})}pn.propTypes={siteId:t.string.isRequired,currentIp:t.string,teamDid:t.string.isRequired,cnameDomain:t.string.isRequired,defaultCustomDomain:t.string,onInputDomain:t.func,onSuccess:t.func,appId:t.string,appPk:t.string,disabled:t.bool,autoFocus:t.bool,inBlockletSetup:t.bool,shouldCheckDomain:t.bool,onStateChange:t.func,onError:t.func};function fn({id:n,children:i=null,title:o="",teamDid:a="",systemDomains:s,appId:r=null,appPk:u,onAddDomainAlias:l=()=>{},...m}){const{t:p}=A(),[f,c]=se({loading:!1,confirmSetting:null}),g=s.find(d=>fe.isDidDomain(d)),y=()=>{c({loading:!1,confirmSetting:null})},x={title:o||p("router.domainAlias.add.title"),description:function(w,C,q){return e.jsx(pn,{siteId:n,teamDid:a,cnameDomain:g,onSuccess:B=>{l(B),c({confirmSetting:null})},onInputDomain:({domain:B,type:M,error:U})=>{C({...w,domain:B,type:M,__disableConfirm:!!U}),q(U)},appId:r,appPk:u,...m})},confirm:p("common.confirm"),cancel:p("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:y},b=d=>{d.stopPropagation(),c({confirmSetting:x})};return e.jsxs(e.Fragment,{children:[typeof i=="function"?i({loading:f.loading,open:b}):e.jsxs(Oe,{onClick:b,className:"rule-action","data-cy":"action-add-domain-alias",children:[f.loading?e.jsx(z,{size:16}):e.jsx(Vn,{style:{fontSize:18,marginRight:5}}),p("router.domainAlias.add.title")]}),f.confirmSetting&&e.jsx(re,{title:f.confirmSetting.title,description:f.confirmSetting.description,confirm:f.confirmSetting.confirm,cancel:f.confirmSetting.cancel,params:f.confirmSetting.params,onCancel:f.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:f.loading,maxWidth:"sm"})]})}fn.propTypes={id:t.string.isRequired,children:t.any,title:t.string,teamDid:t.string,systemDomains:t.arrayOf(t.string).isRequired,appId:t.string,appPk:t.string.isRequired,onAddDomainAlias:t.func};function Gt(n){return e.jsx(Bt,{children:e.jsx(fn,{...n})})}function xn({appId:n,appPk:i,siteId:o,inBlockletSetup:a,teamDid:s,sx:r={},onAddDomainAlias:u=()=>{},...l}){const{api:m,info:p}=F(),{locale:f,t:c}=A(),{checkConflict:g}=un(),y=async({domain:b,nftDid:d,chainHost:w,force:C})=>{const q={id:o,type:"nft-domain",domainAlias:b,nftDid:d,chainHost:w,teamDid:s,inBlockletSetup:a,force:C};return await m.addDomainAlias({input:q}),q},x=async({domain:b,nftDid:d,chainHost:w})=>{try{const C=await y({domain:b,nftDid:d,chainHost:w,force:!1});u(C)}catch(C){if(N(C).includes("already exists")){await g(b,()=>y({domain:b,nftDid:d,chainHost:w,force:!0}));return}E.error(N(C))}};return e.jsx(Pt,{delegatee:n,delegateePk:i,didDomainURL:p.nftDomainUrl,onSuccess:x,locale:f,variant:"outlined",sx:r,title:c("router.domainAlias.addDomainNFT.buy"),...l})}xn.propTypes={appId:t.string.isRequired,appPk:t.string.isRequired,siteId:t.string.isRequired,inBlockletSetup:t.bool.isRequired,teamDid:t.string.isRequired,sx:t.object,onAddDomainAlias:t.func};function Zt({blocklet:n,bugDidDomainProps:i={},connectDomainProps:o={},updateBlockletDomainAliases:a=()=>{}}){const{t:s}=A(),{info:r}=F(),u=ie(c=>c.breakpoints.down("md")),{site:l}=n,m=j.useMemo(()=>Qe(n.site?.domainAliases),[n.site?.domainAliases]),p=n.environments?.find(c=>c.key==="BLOCKLET_APP_PK")?.value,f=ft(m);return e.jsx(Vt,{children:e.jsx(hn,{action:e.jsxs(h,{sx:{display:"flex",alignItems:u?"stretch":"center",flexDirection:u?"column":"row",gap:1},children:[r.nftDomainUrl&&e.jsx(xn,{variant:"contained",appId:n.appPid,appPk:p,siteId:l.id,inBlockletSetup:!1,teamDid:n.meta.did,onAddDomainAlias:c=>{const g={value:c.domainAlias,isProtected:!1,type:c.type,nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0}};a(g)},...i}),e.jsx(Gt,{id:l.id,title:s("common.connectExistingDomain"),teamDid:n.meta?.did,appId:n.appPid,appPk:p,systemDomains:f?.map(c=>c.value),onAddDomainAlias:c=>{const g={value:c.domain,isProtected:!1,type:c.type==="nftDomain"?"nft-domain":"",nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0},canGenerateCertificate:c.canGenerateCertificate===void 0?!0:c.canGenerateCertificate};a(g)},...o,children:({open:c})=>e.jsxs(te,{variant:"outlined",sx:{borderColor:"#ddd",color:"text.primary","&:hover":{bgcolor:g=>g.palette.primary.main,color:g=>g.palette.primary.contrastText}},"data-cy":"add-domain-alias",onClick:c,disabled:xe.isInProgress(n.status),children:[e.jsx(Gn,{style:{fontSize:"1.3em",marginRight:4}}),s("common.connectExistingDomain")]})})]})})})}Zt.propTypes={blocklet:t.object.isRequired,bugDidDomainProps:t.object,connectDomainProps:t.object,updateBlockletDomainAliases:t.func};function hn({action:n}){const{t:i}=A();return e.jsxs(We,{elevation:0,sx:{p:3,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(h,{sx:{flex:1,width:0,mb:1.5},children:[e.jsx(R,{variant:"h6",children:i("common.bugOrConnectDomain")}),e.jsx(R,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i("common.bugOrConnectDomainTip")})]})}),n]})}hn.propTypes={action:t.element.isRequired};export{Bt as D,Zt as a,pi as b};
@@ -0,0 +1 @@
1
+ import{r as m}from"./vendor-react-CTtPmzVP.js";import{V as n}from"./vendor-ux-B0gV9NvH.js";import{Y as p,Z as l,ag as c,q as u}from"./index-CQgzjKgB.js";import{a as x,b as d}from"./domain-action-card-BsdHbhEi.js";import{j as t,ak as k,b6 as f,aZ as h}from"./vendor-mui-core-DnR6WYuU.js";import"./vendor-utils-DCMKu06e.js";import"./vendor-hooks-BQWlJm53.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cnwtqa7s.js";import"./useSetState-L-f8mSga.js";import"./permission-BHvrn0M5.js";import"./session-C2ZBRIpv.js";import"./useAsyncRetry-BMmRgSGm.js";import"./useAsync-ZGLJQow7.js";import"./confirm-Lb1MrAdS.js";import"./index-DBs9Ljax.js";import"./actions-Dfiiwkit.js";import"./delete-confirm-tbfLqDBI.js";import"./click-to-copy-CMo42VnK.js";import"./useAsync-BVTh1KYj.js";import"./index-BWDWEkUF.js";import"./util-Ff3hwYmy.js";import"./engine-BXGX_w-S.js";function z(){const{blocklet:o,actions:{updateBlockletDomainAliases:i}}=p(),{inService:r}=l(),{t:e}=n(),a=m.useMemo(()=>{let s=!0;return c(o)&&(s=s&&r),s},[r,o]);return t.jsxs(k,{component:f,sx:{gap:3,maxWidth:820},children:[t.jsxs(t.Fragment,{children:[u.isAccessible(o.status)===!1&&t.jsx(h,{severity:"warning",children:e("blocklet.router.noRunning")}),a&&t.jsx(x,{blocklet:o,updateBlockletDomainAliases:i,connectDomainProps:{shouldCheckDomain:!0}})]}),t.jsx(d,{showAllDomains:!0,updateBlockletDomainAliases:i})]})}export{z as default};
@@ -0,0 +1 @@
1
+ import{r as a}from"./vendor-react-CTtPmzVP.js";const r=t=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},a.createElement("path",{d:"M6.04 17.625a.953.953 0 0 0 .14-.012l3.943-.691a.23.23 0 0 0 .124-.066l9.935-9.935a.233.233 0 0 0 0-.33l-3.895-3.898a.232.232 0 0 0-.167-.068.232.232 0 0 0-.166.068l-9.935 9.935a.238.238 0 0 0-.066.124l-.691 3.943a.785.785 0 0 0 .22.698c.155.15.35.232.558.232zm1.58-4.088 8.5-8.498 1.718 1.718-8.5 8.498-2.084.368.366-2.085zm13.005 6.057H3.375a.75.75 0 0 0-.75.75v.843c0 .104.084.188.188.188h18.375a.188.188 0 0 0 .187-.188v-.843a.75.75 0 0 0-.75-.75z"}));export{r as e};
@@ -0,0 +1,17 @@
1
+ import{V as U,al as q,_ as w,W as C,a1 as Q,a$ as J,bp as X}from"./vendor-ux-B0gV9NvH.js";import{j as t,b6 as f,bu as Z,cl as ee,T as b,Q as T,bb as te,ak as B,z as $,a6 as se,at as ie}from"./vendor-mui-core-DnR6WYuU.js";import{r as n,j as ne}from"./vendor-react-CTtPmzVP.js";import{M as g}from"./vendor-utils-DCMKu06e.js";import{u as oe,n as h,o as O,c as j,H as re,aS as ae}from"./index-CQgzjKgB.js";import{K as ce}from"./landing-page-DRtId3hN.js";import{f as _}from"./index-DBs9Ljax.js";import{g as D}from"./get-safe-url-BiNPujaX.js";import"./vendor-hooks-BQWlJm53.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cnwtqa7s.js";const le=ie.form`
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ justify-content: center;
6
+ gap: 24px;
7
+ width: 100%;
8
+
9
+ input[type='number']::-webkit-inner-spin-button,
10
+ input[type='number']::-webkit-outer-spin-button {
11
+ -webkit-appearance: none;
12
+ margin: 0;
13
+ }
14
+ div.Mui-focused input {
15
+ caret-color: ${p=>p.theme.palette.primary.main};
16
+ }
17
+ `,ue=p=>{try{if(!p)return null;const o=X(p).toString();return ae(o)?o:null}catch{return null}};function je(){const p=n.useRef(null),{session:o,connectApi:K}=oe(),{t:s,locale:l}=U(),[y,P]=n.useState(o.user?.email||""),[r,V]=n.useState(""),[x,v]=n.useState(!1),[W,z]=n.useState(!1),[c,H]=n.useState(!1),[F,I]=n.useState(!1),[E,N]=n.useState(!1),{wallet:u}=q(),[a]=ne(),A=a.get("inviter")||localStorage.getItem("inviter"),d=a.get("updateKyc")==="1";n.useEffect(()=>{const i=a.get("subject"),e=ue(i);e&&P(e)},[]),n.useEffect(()=>{o.user?.emailVerified&&d&&(I(!0),setTimeout(()=>{if(u&&h()){w(()=>import("./index-m1ZQT0sU.js").then(i=>i.i),[],import.meta.url).then(i=>{i.call("arcClosePage")});return}window.location.href=D(a.get("redirect")||"/")},1e3))},[o.user,d,u,a]);const G=n.useCallback(async i=>{i.preventDefault(),v(!0);try{await O.post(`/kyc/email/send?locale=${l}`,{email:y}),H(!0),C.success(s("login.issueKyc.codeSentSuccess"))}catch(e){C.error(_(e)),document.getElementById("email-input")?.focus()}finally{v(!1)}},[y,l,s]),S=n.useCallback(async i=>{i&&i.preventDefault(),v(!0);try{await O.post(`/kyc/email/verify?locale=${l}`,{code:r}),I(!0),K.open({locale:l,action:"issue-kyc",extraParams:{code:r,updateKyc:a.get("updateKyc")||"0",inviter:A||""},className:"connect",popup:!0,saveConnect:!1,forceConnected:!0,hideCloseButton:!0,messages:{title:s("login.issueKyc.claim"),scan:s("login.issueKyc.scan"),confirm:s("login.issueKyc.confirm"),success:s("login.issueKyc.success")},useSocket:!0,onSuccess:()=>{N(!0),K.close(),d?(o.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(u&&h()){w(()=>import("./index-m1ZQT0sU.js").then(e=>e.i),[],import.meta.url).then(e=>{e.call("arcClosePage")});return}window.location.href=D(a.get("redirect")||"/")},1e3)):u&&h()&&w(()=>import("./index-m1ZQT0sU.js").then(e=>e.i),[],import.meta.url).then(e=>{e.call("arcClosePage")})},onError:e=>{C.error(_(e))}})}catch(e){I(!1),C.error(_(e)),document.getElementById(`code-input-${g(r).length-1}`)?.focus()}finally{v(!1)}},[r,l,a,d,u,A]);n.useEffect(()=>{c&&g(r).length===j.VERIFY_CODE_LENGTH&&S()},[r,S,c]);const Y=n.useCallback(()=>{z(!0),K.open({locale:l,action:"update-kyc",className:"connect",popup:!0,saveConnect:!1,forceConnected:!0,hideCloseButton:!0,messages:{title:s("login.updateKyc.title"),scan:s("login.updateKyc.scan"),confirm:s("login.updateKyc.confirm"),success:s("login.updateKyc.success")},useSocket:!0,onSuccess:()=>{o.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(u&&h()){w(()=>import("./index-m1ZQT0sU.js").then(i=>i.i),[],import.meta.url).then(i=>{i.call("arcClosePage")});return}window.location.href=D(a.get("redirect")||"/")},2e3)},onError:i=>{C.error(_(i))}})},[l,a,u]),k=n.useCallback(i=>{if(!c)return;i.preventDefault();const e=g(i.clipboardData.getData("text/plain").slice(0,j.VERIFY_CODE_LENGTH));if(!/^\d+$/.test(e))return;V(e.padEnd(j.VERIFY_CODE_LENGTH," "));const m=document.getElementById(`code-input-${e.length}`);m&&m.focus()},[c]);n.useEffect(()=>(document.addEventListener("paste",k),()=>{document.removeEventListener("paste",k)}),[k]);const L=h()?s("login.issueKyc.issueTitle"):s("login.issueKyc.verifyTitle"),M=h()?s("login.issueKyc.issueAction"):s("login.issueKyc.verifyAction");return t.jsxs(ce,{did:window.blocklet?.appPid,children:[t.jsx(re,{children:t.jsxs("title",{children:[L," | ",window.blocklet?.appName]})}),t.jsxs(f,{direction:"column",sx:{justifyContent:"center",alignItems:"center",width:"560px",px:2,boxSizing:"border-box",maxWidth:"100%",height:"100%"},children:[t.jsxs(f,{spacing:1,sx:{justifyContent:"center",alignItems:"center",mb:3},children:[E?t.jsx(Z,{sx:{fontSize:72},color:"success"}):t.jsx(ee,{sx:{fontSize:72},color:"primary"}),t.jsx(b,{variant:"h5",sx:{textAlign:"center"},children:L}),!E&&t.jsx(b,{variant:"body2",sx:{color:"text.secondary",textAlign:"center"},children:s("login.issueKyc.pageDescription")}),E&&t.jsx(b,{variant:"body1",sx:{textAlign:"center"},children:s("login.issueKyc.success")}),E&&t.jsx(T,{variant:"contained",color:"primary",component:te,href:"/",size:"large",children:s("login.issueKyc.backToHome")}),!E&&o.user&&t.jsxs(f,{direction:"column",sx:{justifyContent:"center",alignItems:"center"},children:[t.jsx(b,{variant:"body2",sx:{color:"info.main",textAlign:"center",mt:1},children:s("login.issueKyc.issueTarget",{action:M})}),t.jsxs(f,{direction:"row",spacing:1,sx:{justifyContent:"center",alignItems:"center",width:"100%",maxWidth:360},children:[t.jsx(Q,{did:o.user.did,responsive:!0,copyable:!0,showQrcode:!1}),t.jsx(J,{locale:l,session:o,showRole:!0,showManageBlocklet:!1})]})]})]}),t.jsx(B,{ref:p,sx:{width:"100%"},children:!F&&!W&&t.jsxs(le,{onSubmit:c?S:G,children:[!c&&t.jsx($,{type:"email",id:"email-input",placeholder:s("login.issueKyc.emailPlaceholder"),sx:{width:"100%",maxWidth:360},value:y,onChange:i=>P(i.target.value),disabled:x,required:!0}),c&&t.jsxs(f,{direction:"column",spacing:2,sx:{justifyContent:"center",alignItems:"center"},children:[t.jsx(b,{variant:"body2",sx:{textAlign:"center"},children:s("login.issueKyc.codeSentMessage",{email:y})}),t.jsx(B,{sx:{width:"100%",maxWidth:360,display:"flex",justifyContent:"space-between"},children:[...Array(j.VERIFY_CODE_LENGTH)].map((i,e)=>t.jsx($,{value:g(r[e])||"",type:"number",sx:{width:"14%"},onChange:m=>{const R=r.split("");R[e]=m.target.value,V(R.join("")),m.target.value&&e<5&&document.getElementById(`code-input-${e+1}`)?.focus()},onKeyDown:m=>{m.key==="Backspace"&&!g(r[e])&&e>0&&document.getElementById(`code-input-${e-1}`)?.focus()},disabled:x,required:!0,id:`code-input-${e}`,autoComplete:"off",slotProps:{htmlInput:{maxLength:1,style:{textAlign:"center",fontSize:"1.5rem"},autoComplete:"off"}}},`code-input-${e}`))})]}),t.jsxs(f,{direction:"row",spacing:2,sx:{justifyContent:d?"space-between":"center",alignItems:"center",width:"100%",maxWidth:360},children:[d&&t.jsx(T,{variant:"text",disabled:x,onClick:Y,size:"large",children:s("login.updateKyc.button")}),t.jsx(T,{type:"submit",size:"large",variant:"contained",disabled:x||!y||c&&g(r).length!==j.VERIFY_CODE_LENGTH,sx:{width:d?"auto":"100%"},children:x?t.jsx(se,{size:24}):s(c?"login.issueKyc.verifyButton":"login.issueKyc.sendCodeButton")})]})]})})]})]})}export{je as default};
@@ -0,0 +1 @@
1
+ import{bO as e}from"./index-CQgzjKgB.js";var i=e();export{i as e};
@@ -0,0 +1 @@
1
+ import{j as e,a6 as P,ak as E}from"./vendor-mui-core-DnR6WYuU.js";import{r as k,u as T}from"./vendor-react-CTtPmzVP.js";import{o as j}from"./vendor-arcblock-Cnwtqa7s.js";import{V as W,W as d,b7 as C}from"./vendor-ux-B0gV9NvH.js";import{w as I,c as R,m as S,b,e as v}from"./index-CQgzjKgB.js";import{K as U}from"./landing-page-DRtId3hN.js";import{w as L}from"./wrap-locale-CF46rj6q.js";import{g as N}from"./get-safe-url-BiNPujaX.js";import"./vendor-utils-DCMKu06e.js";import"./vendor-hooks-BQWlJm53.js";import"./lottie-web-4koyQiv_.js";import"./index-BmXPp3DU.js";function _({SessionContext:n,webWalletUrl:r,onSuccess:o}){const{api:t,session:i}=k.useContext(n),{t:s,locale:h}=W(),f=T(),{searchParams:p}=new URL(window.location.href),m=p.get("redirect"),g=async(a,w)=>{o(a,w),await i.refresh(),d.success(s("exchangePassport.success")),setTimeout(()=>{if(m){const c=decodeURIComponent(m);c.startsWith(R.WELLKNOWN_SERVICE_PATH_PREFIX)?f(c,{replace:!0}):window.location.href=N(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},u=a=>{d.error(a.message)},l={},x=p.get("componentId");return x&&(l.componentId=x),i.loading?e.jsx(j,{children:e.jsx(P,{})}):e.jsx(U,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(E,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(I,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:g,onError:u,locale:h,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:l,extraContent:null,hideCloseButton:!0})})})}const B=L(_);function G(){const n=C(),r=(o,t)=>{o.sessionToken&&(b(t(o.sessionToken)),v(t(o.refreshToken)))};return e.jsx(B,{SessionContext:S,webWalletUrl:n,onSuccess:r})}export{G as default};
@@ -1,11 +1,11 @@
1
- import{D as S,j as o,a6 as B,T,bm as k}from"./vendor-mui-core-DnR6WYuU.js";import{o as M}from"./vendor-arcblock-DyliHtVF.js";import{V as P,aL as F}from"./vendor-ux-IiqHAjMq.js";import{r as w}from"./vendor-react-CTtPmzVP.js";import{x as E}from"./vendor-hooks-qxhUUbW5.js";import{c0 as D,ay as I}from"./index-DG0EDext.js";import"./vendor-utils-CxWN1dT3.js";import"./lottie-web-4koyQiv_.js";const{Elements:R,PaymentElement:z,useElements:N,useStripe:L,loadStripe:O,LinkAuthenticationElement:V}=globalThis.__STRIPE_COMPONENTS__,W=k("div")`
1
+ import{D as S,j as o,a6 as B,T,bm as k}from"./vendor-mui-core-DnR6WYuU.js";import{o as M}from"./vendor-arcblock-Cnwtqa7s.js";import{V as P,aZ as F}from"./vendor-ux-B0gV9NvH.js";import{r as w}from"./vendor-react-CTtPmzVP.js";import{v as E}from"./vendor-hooks-BQWlJm53.js";import{b_ as D,ax as I}from"./index-CQgzjKgB.js";import"./vendor-utils-DCMKu06e.js";import"./lottie-web-4koyQiv_.js";const{Elements:R,PaymentElement:z,useElements:N,useStripe:O,loadStripe:V,LinkAuthenticationElement:W}=globalThis.__STRIPE_COMPONENTS__,$=k("div")`
2
2
  width: 100%;
3
3
  opacity: 0;
4
4
  transition: opacity 300ms ease;
5
5
  &.visible {
6
6
  opacity: 1;
7
7
  }
8
- `;function $({clientSecret:c,intentType:u,customer:e,mode:f,onConfirm:b,returnUrl:g="",submitButtonText:x=""}){const r=L(),l=N(),{t:d}=P(),m=S(),[t,n]=E({message:"",confirming:!1,loaded:!1,showBillingForm:!1,isTransitioning:!1,paymentMethod:"card"}),C=a=>{const i=a.value?.type;(i==="google_pay"||i==="apple_pay")&&!s(e.address)&&!t.showBillingForm?(n({isTransitioning:!0}),setTimeout(()=>{n({isTransitioning:!1,paymentMethod:i,showBillingForm:!0})},300)):n({showBillingForm:!1,paymentMethod:i,isTransitioning:!1})},s=a=>a&&a.line1&&a.city&&a.state&&a.postal_code&&a.country;w.useEffect(()=>{if(!r||!c)return;r[u==="payment_intent"?"retrievePaymentIntent":"retrieveSetupIntent"](c).then(({paymentIntent:i,setupIntent:h})=>{switch((i||h)?.status){case"succeeded":n({message:d("paymentCredit.preparePayMessage.succeeded")});break;case"processing":n({message:d("paymentCredit.preparePayMessage.processing")});break}})},[r,c]);const y=w.useCallback(async a=>{if(a.preventDefault(),!(!r||!l))try{n({confirming:!0,message:""});const i=u==="payment_intent"?"confirmPayment":"confirmSetup",{error:h}=await l.submit();if(h){n({confirming:!1});return}const{error:p,paymentIntent:j,setupIntent:v}=await r[i]({elements:l,redirect:"if_required",confirmParams:{return_url:g||window.location.href,...t.showBillingForm?{}:{payment_method_data:{billing_details:{name:e.name,phone:e.phone,email:e.email,address:{...e.address||{},country:e.address?.country||"us",line1:e.address?.line1||"",line2:e.address?.line2||"",city:e.address?.city||"",state:e.address?.state||"",postal_code:e.address?.postal_code||"00000"}}}}}}),_=j||v;if(_?.status==="canceled"||_?.status==="requires_payment_method"){n({confirming:!1});return}if(n({confirming:!1}),p){if(p.type==="validation_error")return;n({message:p.message});return}b()}catch(i){console.error(i),n({confirming:!1,message:i.message})}},[e,u,r,t.showBillingForm,g]);return o.jsxs(q,{onSubmit:y,children:[(!t.paymentMethod||["link","card"].includes(t.paymentMethod))&&o.jsx(V,{options:{defaultValues:{email:e.email}}}),o.jsx(W,{className:t.isTransitioning?"":"visible",children:o.jsx(z,{options:{layout:"auto",fields:{billingDetails:t.showBillingForm?"auto":"never"},readOnly:t.confirming,defaultValues:{billingDetails:{name:e.name,phone:e.phone,email:e.email,address:e.address}},appearance:{theme:m.palette.mode,variables:{colorPrimary:m.palette.primary.main,colorBackground:m.palette.background.paper,colorText:m.palette.text.primary,colorDanger:m.palette.error.main,borderRadius:"4px"}}},onChange:C,onReady:()=>n({loaded:!0})})}),(!r||!l||!t.loaded)&&o.jsx(M,{relative:"parent",children:o.jsx(B,{})}),r&&l&&t.loaded&&o.jsx(I,{fullWidth:!0,sx:{mt:2,mb:1,borderRadius:0,fontSize:"0.875rem"},type:"submit",disabled:t.confirming||!t.loaded,loading:t.confirming,variant:"contained",color:"primary",size:"large",children:x||d("payment.checkout.continue",{action:d(`payment.checkout.${f}`)})}),t.message&&o.jsx(T,{sx:{mt:1,color:"error.main"},children:t.message})]})}const q=k("form")`
8
+ `;function q({clientSecret:c,intentType:u,customer:e,mode:f,onConfirm:b,returnUrl:g="",submitButtonText:x=""}){const r=O(),l=N(),{t:d}=P(),m=S(),[t,n]=E({message:"",confirming:!1,loaded:!1,showBillingForm:!1,isTransitioning:!1,paymentMethod:"card"}),_=a=>{const i=a.value?.type;(i==="google_pay"||i==="apple_pay")&&!s(e.address)&&!t.showBillingForm?(n({isTransitioning:!0}),setTimeout(()=>{n({isTransitioning:!1,paymentMethod:i,showBillingForm:!0})},300)):n({showBillingForm:!1,paymentMethod:i,isTransitioning:!1})},s=a=>a&&a.line1&&a.city&&a.state&&a.postal_code&&a.country;w.useEffect(()=>{if(!r||!c)return;r[u==="payment_intent"?"retrievePaymentIntent":"retrieveSetupIntent"](c).then(({paymentIntent:i,setupIntent:h})=>{switch((i||h)?.status){case"succeeded":n({message:d("paymentCredit.preparePayMessage.succeeded")});break;case"processing":n({message:d("paymentCredit.preparePayMessage.processing")});break}})},[r,c]);const y=w.useCallback(async a=>{if(a.preventDefault(),!(!r||!l))try{n({confirming:!0,message:""});const i=u==="payment_intent"?"confirmPayment":"confirmSetup",{error:h}=await l.submit();if(h){n({confirming:!1});return}const{error:p,paymentIntent:j,setupIntent:v}=await r[i]({elements:l,redirect:"if_required",confirmParams:{return_url:g||window.location.href,...t.showBillingForm?{}:{payment_method_data:{billing_details:{name:e.name,phone:e.phone,email:e.email,address:{...e.address||{},country:e.address?.country||"us",line1:e.address?.line1||"",line2:e.address?.line2||"",city:e.address?.city||"",state:e.address?.state||"",postal_code:e.address?.postal_code||"00000"}}}}}}),C=j||v;if(C?.status==="canceled"||C?.status==="requires_payment_method"){n({confirming:!1});return}if(n({confirming:!1}),p){if(p.type==="validation_error")return;n({message:p.message});return}b()}catch(i){console.error(i),n({confirming:!1,message:i.message})}},[e,u,r,t.showBillingForm,g]);return o.jsxs(A,{onSubmit:y,children:[(!t.paymentMethod||["link","card"].includes(t.paymentMethod))&&o.jsx(W,{options:{defaultValues:{email:e.email}}}),o.jsx($,{className:t.isTransitioning?"":"visible",children:o.jsx(z,{options:{layout:"auto",fields:{billingDetails:t.showBillingForm?"auto":"never"},readOnly:t.confirming,defaultValues:{billingDetails:{name:e.name,phone:e.phone,email:e.email,address:e.address}},appearance:{theme:m.palette.mode,variables:{colorPrimary:m.palette.primary.main,colorBackground:m.palette.background.paper,colorText:m.palette.text.primary,colorDanger:m.palette.error.main,borderRadius:"4px"}}},onChange:_,onReady:()=>n({loaded:!0})})}),(!r||!l||!t.loaded)&&o.jsx(M,{relative:"parent",children:o.jsx(B,{})}),r&&l&&t.loaded&&o.jsx(I,{fullWidth:!0,sx:{mt:2,mb:1,borderRadius:0,fontSize:"0.875rem"},type:"submit",disabled:t.confirming||!t.loaded,loading:t.confirming,variant:"contained",color:"primary",size:"large",children:x||d("payment.checkout.continue",{action:d(`payment.checkout.${f}`)})}),t.message&&o.jsx(T,{sx:{mt:1,color:"error.main"},children:t.message})]})}const A=k("form")`
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  justify-content: center;
@@ -13,4 +13,4 @@ import{D as S,j as o,a6 as B,T,bm as k}from"./vendor-mui-core-DnR6WYuU.js";impor
13
13
  width: 100%;
14
14
  height: 100%;
15
15
  min-height: 320px;
16
- `;function Z({clientSecret:c,intentType:u,publicKey:e,mode:f,customer:b,onConfirm:g,onCancel:x,returnUrl:r="",title:l="",submitButtonText:d=""}){const m=O(e),{isMobile:t}=D(),{t:n,locale:C}=P(),s=S(),[y,a]=E({open:!0,closable:!0}),i=(h,p)=>{p!=="backdropClick"&&(a({open:!1}),x())};return o.jsx(F,{title:l||n("payment.checkout.cardPay",{action:n(`payment.checkout.${f}`)}),showCloseButton:y.closable,open:y.open,onClose:i,disableEscapeKeyDown:!0,sx:{".StripeElement":{minWidth:t?"100%":"500px",py:1},form:{justifyContent:"flex-start"},".StripeElement--focus":{borderColor:s.palette.primary.main},".StripeElement--invalid":{borderColor:s.palette.error.main},".StripeElement--complete":{borderColor:s.palette.success.main}},PaperProps:{style:{minWidth:t?"100%":"500px"}},children:o.jsx(R,{options:{clientSecret:c,locale:C==="zh"?"zh-CN":"en",appearance:{theme:s.palette.mode,variables:{colorPrimary:s.palette.primary.main,colorBackground:s.palette.background.paper,colorText:s.palette.text.primary,colorDanger:s.palette.error.main}}},stripe:m,children:o.jsx($,{clientSecret:c,intentType:u,mode:f,customer:b,onConfirm:g,returnUrl:r,submitButtonText:d})})})}export{Z as default};
16
+ `;function Y({clientSecret:c,intentType:u,publicKey:e,mode:f,customer:b,onConfirm:g,onCancel:x,returnUrl:r="",title:l="",submitButtonText:d=""}){const m=V(e),{isMobile:t}=D(),{t:n,locale:_}=P(),s=S(),[y,a]=E({open:!0,closable:!0}),i=(h,p)=>{p!=="backdropClick"&&(a({open:!1}),x())};return o.jsx(F,{title:l||n("payment.checkout.cardPay",{action:n(`payment.checkout.${f}`)}),showCloseButton:y.closable,open:y.open,onClose:i,disableEscapeKeyDown:!0,sx:{".StripeElement":{minWidth:t?"100%":"500px",py:1},form:{justifyContent:"flex-start"},".StripeElement--focus":{borderColor:s.palette.primary.main},".StripeElement--invalid":{borderColor:s.palette.error.main},".StripeElement--complete":{borderColor:s.palette.success.main}},PaperProps:{style:{minWidth:t?"100%":"500px"}},children:o.jsx(R,{options:{clientSecret:c,locale:_==="zh"?"zh-CN":"en",appearance:{theme:s.palette.mode,variables:{colorPrimary:s.palette.primary.main,colorBackground:s.palette.background.paper,colorText:s.palette.text.primary,colorDanger:s.palette.error.main}}},stripe:m,children:o.jsx(q,{clientSecret:c,intentType:u,mode:f,customer:b,onConfirm:g,returnUrl:r,submitButtonText:d})})})}export{Y as default};
@@ -1,4 +1,4 @@
1
- import{a as L,r as l}from"./vendor-react-CTtPmzVP.js";import{j as e,I as q,bV as H,Q,cG as $,O as J,P as V,ai as Y,o as Z,M as ee,W as t,z as te,ak as d,a6 as se,by as ne,aj as ae,F as re,cH as le}from"./vendor-mui-core-DnR6WYuU.js";import{aU as oe}from"./vendor-ux-IiqHAjMq.js";import{R as ie}from"./required-BQln5OcV.js";import{F as ce}from"./form-wrapper-PT5ZzMQy.js";import{e as ue}from"./edit.svg-RRSklUg-.js";function P({triggers:o=[],onEnterEdit:n,disabled:p}){const a=L.useRef(null),[h,u]=L.useState(!1),C=r=>{u(!1),r()},I=()=>{u(r=>!r)},i=r=>{a.current&&a.current.contains(r.target)||u(!1)};return o.length===0?e.jsx(q,{"data-cy":"schema-form-item-edit",onClick:n,disabled:p,size:"large",children:e.jsx(ue,{})}):e.jsxs(e.Fragment,{children:[e.jsx(H,{variant:"outlined",ref:a,"aria-label":"split button",children:e.jsx(Q,{size:"large","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:I,children:e.jsx($,{})})}),e.jsx(J,{sx:{zIndex:9999},open:h,anchorEl:a.current,role:void 0,placement:"bottom-end",children:e.jsx(V,{children:e.jsx(Y,{onClickAway:i,children:e.jsx(Z,{id:"split-button-menu",autoFocusItem:!0,children:o.map(r=>e.jsx(ee,{onClick:()=>C(r.handler),children:r.title},r.key))})})})})]})}P.propTypes={triggers:t.arrayOf(t.shape({key:t.string.isRequired,title:t.string.isRequired,handler:t.func.isRequired})),onEnterEdit:t.func.isRequired,disabled:t.bool.isRequired};const B=(o,n,p)=>o===null&&n&&p?"******":o?n?"******":o:"",de=le`
1
+ import{a as L,r as l}from"./vendor-react-CTtPmzVP.js";import{j as e,I as q,bV as U,Q,cG as $,O as J,P as V,ai as Y,o as Z,M as ee,W as t,z as te,ak as d,a6 as se,by as ne,aj as ae,F as re,cH as le}from"./vendor-mui-core-DnR6WYuU.js";import{b8 as oe}from"./vendor-ux-B0gV9NvH.js";import{R as ie}from"./required-BQln5OcV.js";import{F as ce}from"./form-wrapper-PT5ZzMQy.js";import{e as ue}from"./edit.svg-CTE5eATX.js";function P({triggers:o=[],onEnterEdit:n,disabled:p}){const a=L.useRef(null),[h,u]=L.useState(!1),C=r=>{u(!1),r()},I=()=>{u(r=>!r)},i=r=>{a.current&&a.current.contains(r.target)||u(!1)};return o.length===0?e.jsx(q,{"data-cy":"schema-form-item-edit",onClick:n,disabled:p,size:"large",children:e.jsx(ue,{})}):e.jsxs(e.Fragment,{children:[e.jsx(U,{variant:"outlined",ref:a,"aria-label":"split button",children:e.jsx(Q,{size:"large","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:I,children:e.jsx($,{})})}),e.jsx(J,{sx:{zIndex:9999},open:h,anchorEl:a.current,role:void 0,placement:"bottom-end",children:e.jsx(V,{children:e.jsx(Y,{onClickAway:i,children:e.jsx(Z,{id:"split-button-menu",autoFocusItem:!0,children:o.map(r=>e.jsx(ee,{onClick:()=>C(r.handler),children:r.title},r.key))})})})})]})}P.propTypes={triggers:t.arrayOf(t.shape({key:t.string.isRequired,title:t.string.isRequired,handler:t.func.isRequired})),onEnterEdit:t.func.isRequired,disabled:t.bool.isRequired};const B=(o,n,p)=>o===null&&n&&p?"******":o?n?"******":o:"",de=le`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }
@@ -8,4 +8,4 @@ import{a as L,r as l}from"./vendor-react-CTtPmzVP.js";import{j as e,I as q,bV as
8
8
  25%, 75% {
9
9
  transform: scale(1.1) translateX(3px);
10
10
  }
11
- `;function fe({label:o="",disabled:n=!1,required:p=!1,initialValue:a="",onChange:h=()=>{},placeholder:u="",style:C={},onSubmit:I=()=>{},secure:i=!1,type:r="",triggers:S=[],formatterBeforeSubmit:z=null,directEditing:x=!1,autoFocus:M=!0,errorTips:F="",...b}){const[E,k]=l.useState(x),[g,T]=l.useState(!1),{t:O}=l.useContext(oe),[_,D]=l.useState(""),[f,N]=l.useState(i&&a==="__encrypted__"?null:a),[c,m]=l.useState(f),[y,j]=l.useState(!1),[A,v]=l.useState(!1),R=async()=>{if(b.validate&&typeof b.validate=="function"){const s=b.validate(c);if(s){D(s);return}}D(""),T(!0);try{if(await I(c)===!1)m(f);else{let w=c;typeof z=="function"&&(w=z(c)),m(w),N(w),j(!1)}}catch{m(f)}finally{T(!1),k(!1)}};l.useEffect(()=>{const s=i&&a==="__encrypted__"?null:a;s!==f&&(N(s),m(s),j(!1))},[a,i,f]);const K=s=>{j(s!==c),m(s),h(s)},U=s=>{s.key==="Enter"&&R()},W=l.useCallback(()=>{v(!0),setTimeout(()=>{v(!1)},500)},[]),X=()=>{if(x&&!n&&!g){R();return}y&&W(),!y&&!n&&!g&&(k(!1),j(!1))},G=E||x?e.jsx(te,{style:{flex:1},fullWidth:!0,value:c,onChange:s=>{K(s.target.value)},autoFocus:M,size:"small",variant:"outlined",placeholder:u,onKeyDown:U,onBlur:X,disabled:n,error:!!F,multiline:r==="textarea",type:i?"password":r||"text",...b}):e.jsx(d,{"data-cy":"schema-form-item-edit",className:"form-item-input slot",style:{whiteSpace:"pre-wrap",cursor:"text"},onClick:()=>{n||k(!0)},sx:{px:1},children:B(c,i,a)?B(c,i,a):e.jsx("span",{className:"placeholder",children:O("common.requiredInputPlaceholder",{name:u||o})})});return e.jsx(ce,{className:"form",style:C,children:e.jsxs(d,{children:[e.jsxs(d,{className:"form-item-label",children:[o,p&&e.jsx(ie,{})]}),e.jsxs(d,{className:"form-item-body",style:{alignItems:"flex-start"},children:[e.jsx(d,{className:"form-item-input",children:G}),e.jsx(d,{className:"form-item-action",style:{marginLeft:!S.length||x?0:12},children:E&&!x?e.jsxs(e.Fragment,{children:[y?e.jsx(q,{"data-cy":"schema-form-item-confirm",onClick:R,disabled:n||g||!y,sx:{animation:A?`${de} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:g?e.jsx(se,{size:24}):e.jsx(ne,{})}):null,e.jsx(q,{"data-cy":"schema-form-item-cancel",onClick:()=>{m(f),k(!1),j(!1)},style:{paddingLeft:y?4:8},disabled:n||g,size:"large",children:e.jsx(ae,{})})]}):e.jsx(d,{children:S.length?e.jsx(P,{triggers:S,disabled:n}):null})})]}),(F||_)&&e.jsx(re,{error:!0,children:F||_})]})})}fe.propTypes={style:t.object,onSubmit:t.func,onChange:t.func,label:t.string,initialValue:t.string,placeholder:t.string,required:t.bool,disabled:t.bool,secure:t.bool,triggers:t.array,formatterBeforeSubmit:t.func,directEditing:t.bool,type:t.string,autoFocus:t.bool,errorTips:t.string};export{fe as F,P as I};
11
+ `;function fe({label:o="",disabled:n=!1,required:p=!1,initialValue:a="",onChange:h=()=>{},placeholder:u="",style:C={},onSubmit:I=()=>{},secure:i=!1,type:r="",triggers:S=[],formatterBeforeSubmit:z=null,directEditing:x=!1,autoFocus:M=!0,errorTips:F="",...b}){const[E,k]=l.useState(x),[g,T]=l.useState(!1),{t:O}=l.useContext(oe),[_,D]=l.useState(""),[f,N]=l.useState(i&&a==="__encrypted__"?null:a),[c,m]=l.useState(f),[y,j]=l.useState(!1),[A,v]=l.useState(!1),R=async()=>{if(b.validate&&typeof b.validate=="function"){const s=b.validate(c);if(s){D(s);return}}D(""),T(!0);try{if(await I(c)===!1)m(f);else{let w=c;typeof z=="function"&&(w=z(c)),m(w),N(w),j(!1)}}catch{m(f)}finally{T(!1),k(!1)}};l.useEffect(()=>{const s=i&&a==="__encrypted__"?null:a;s!==f&&(N(s),m(s),j(!1))},[a,i,f]);const K=s=>{j(s!==c),m(s),h(s)},W=s=>{s.key==="Enter"&&R()},X=l.useCallback(()=>{v(!0),setTimeout(()=>{v(!1)},500)},[]),G=()=>{if(x&&!n&&!g){R();return}y&&X(),!y&&!n&&!g&&(k(!1),j(!1))},H=E||x?e.jsx(te,{style:{flex:1},fullWidth:!0,value:c,onChange:s=>{K(s.target.value)},autoFocus:M,size:"small",variant:"outlined",placeholder:u,onKeyDown:W,onBlur:G,disabled:n,error:!!F,multiline:r==="textarea",type:i?"password":r||"text",...b}):e.jsx(d,{"data-cy":"schema-form-item-edit",className:"form-item-input slot",style:{whiteSpace:"pre-wrap",cursor:"text"},onClick:()=>{n||k(!0)},sx:{px:1},children:B(c,i,a)?B(c,i,a):e.jsx("span",{className:"placeholder",children:O("common.requiredInputPlaceholder",{name:u||o})})});return e.jsx(ce,{className:"form",style:C,children:e.jsxs(d,{children:[e.jsxs(d,{className:"form-item-label",children:[o,p&&e.jsx(ie,{})]}),e.jsxs(d,{className:"form-item-body",style:{alignItems:"flex-start"},children:[e.jsx(d,{className:"form-item-input",children:H}),e.jsx(d,{className:"form-item-action",style:{marginLeft:!S.length||x?0:12},children:E&&!x?e.jsxs(e.Fragment,{children:[y?e.jsx(q,{"data-cy":"schema-form-item-confirm",onClick:R,disabled:n||g||!y,sx:{animation:A?`${de} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:g?e.jsx(se,{size:24}):e.jsx(ne,{})}):null,e.jsx(q,{"data-cy":"schema-form-item-cancel",onClick:()=>{m(f),k(!1),j(!1)},style:{paddingLeft:y?4:8},disabled:n||g,size:"large",children:e.jsx(ae,{})})]}):e.jsx(d,{children:S.length?e.jsx(P,{triggers:S,disabled:n}):null})})]}),(F||_)&&e.jsx(re,{error:!0,children:F||_})]})})}fe.propTypes={style:t.object,onSubmit:t.func,onChange:t.func,label:t.string,initialValue:t.string,placeholder:t.string,required:t.bool,disabled:t.bool,secure:t.bool,triggers:t.array,formatterBeforeSubmit:t.func,directEditing:t.bool,type:t.string,autoFocus:t.bool,errorTips:t.string};export{fe as F,P as I};
@@ -1,4 +1,4 @@
1
- import{j as e,ak as s,a6 as w,bb as B,cC as N,at as I,W as d}from"./vendor-mui-core-DnR6WYuU.js";import{r as l}from"./vendor-react-CTtPmzVP.js";import{C as v}from"./vendor-utils-CxWN1dT3.js";import{aU as L}from"./vendor-ux-IiqHAjMq.js";import{y as $,u as E,l as z}from"./index-DG0EDext.js";import{W as A}from"./did-address-h4uLp20A.js";import{a as D}from"./page-header-CHAwrgX-.js";import{S as F}from"./layout-CdGgFfY4.js";import{S as P}from"./step-actions-BKMeYA5x.js";import{S as m}from"./button-82FUWQ2H.js";import"./vendor-hooks-qxhUUbW5.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DyliHtVF.js";import"./content-layout-DmSBGGVm.js";import"./use-mobile-D5clNlrm.js";function R({onNext:n=()=>{},onPrevious:u=()=>{}}){const{locale:x,t}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:f,actions:h}=$(),{api:j}=E(),[y,o]=l.useState(!1),{need:p="",current:g="",owe:r=99999,deficiency:b,symbol:k="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const W=setInterval(()=>{h.refreshFuel()},2e3);return()=>{clearInterval(W)}},[]);const S=()=>{o(!1)};return c?e.jsxs(T,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:t("setup.fuel.title"),onClickBack:u})}),e.jsxs(s,{className:"qr-body",children:[e.jsxs(s,{className:"tip",sx:{mb:6},children:[t("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${k}`}),t("setup.fuel.tipEnd")]}),e.jsx(s,{sx:{fontSize:16,fontWeight:"fontWeightBold",mb:.5},children:t("setup.fuel.addressTitle")}),e.jsxs(s,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(B,{style:{lineHeight:1},target:"_blank",href:v(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(N,{className:"icon-launch"})})]}),e.jsx(s,{sx:{my:2},children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:t("setup.fuel.fuelApp")})}),e.jsx(z,{popup:!0,open:y,action:"fuel",checkFn:j.get,checkTimeout:10*60*1e3,onSuccess:S,onClose:()=>o(!1),locale:x,messages:{title:t("setup.connect.title"),scan:t("setup.connect.scan"),confirm:t("setup.connect.confirm"),success:t("setup.connect.success")},extraParams:{amount:b,...f,endpoint:i}}),e.jsxs(s,{sx:{display:"flex",color:"text.secondary"},children:[e.jsxs(s,{sx:{display:"flex"},children:[e.jsxs(s,{children:[t("setup.fuel.need"),":"]}),e.jsx(s,{sx:{ml:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:p})]}),e.jsxs(s,{sx:{display:"flex",ml:3},children:[e.jsxs(s,{children:[t("setup.fuel.current"),":"]}),e.jsx(s,{sx:{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold"},children:g})]})]})]}),e.jsx(P,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:t("setup.next")})})]}):e.jsx(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:e.jsx(w,{})})}R.propTypes={onNext:d.func,onPrevious:d.func};const T=I(F)`
1
+ import{j as e,ak as s,a6 as W,bb as B,cC as N,at as I,W as d}from"./vendor-mui-core-DnR6WYuU.js";import{r as l}from"./vendor-react-CTtPmzVP.js";import{y as v}from"./vendor-utils-DCMKu06e.js";import{b8 as L}from"./vendor-ux-B0gV9NvH.js";import{y as $,u as E,w as z}from"./index-CQgzjKgB.js";import{W as A}from"./did-address-CsOJBoiY.js";import{a as D}from"./page-header-CHAwrgX-.js";import{S as F}from"./layout-Be1KH57_.js";import{S as P}from"./step-actions-B1ufIDaK.js";import{S as m}from"./button-D-lyR9BW.js";import"./vendor-hooks-BQWlJm53.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cnwtqa7s.js";import"./content-layout-DmSBGGVm.js";import"./use-mobile-D5clNlrm.js";function R({onNext:n=()=>{},onPrevious:u=()=>{}}){const{locale:x,t}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:f,actions:h}=$(),{api:j}=E(),[y,o]=l.useState(!1),{need:p="",current:g="",owe:r=99999,deficiency:b,symbol:k="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const w=setInterval(()=>{h.refreshFuel()},2e3);return()=>{clearInterval(w)}},[]);const S=()=>{o(!1)};return c?e.jsxs(T,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:t("setup.fuel.title"),onClickBack:u})}),e.jsxs(s,{className:"qr-body",children:[e.jsxs(s,{className:"tip",sx:{mb:6},children:[t("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${k}`}),t("setup.fuel.tipEnd")]}),e.jsx(s,{sx:{fontSize:16,fontWeight:"fontWeightBold",mb:.5},children:t("setup.fuel.addressTitle")}),e.jsxs(s,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(B,{style:{lineHeight:1},target:"_blank",href:v(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(N,{className:"icon-launch"})})]}),e.jsx(s,{sx:{my:2},children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:t("setup.fuel.fuelApp")})}),e.jsx(z,{popup:!0,open:y,action:"fuel",checkFn:j.get,checkTimeout:10*60*1e3,onSuccess:S,onClose:()=>o(!1),locale:x,messages:{title:t("setup.connect.title"),scan:t("setup.connect.scan"),confirm:t("setup.connect.confirm"),success:t("setup.connect.success")},extraParams:{amount:b,...f,endpoint:i}}),e.jsxs(s,{sx:{display:"flex",color:"text.secondary"},children:[e.jsxs(s,{sx:{display:"flex"},children:[e.jsxs(s,{children:[t("setup.fuel.need"),":"]}),e.jsx(s,{sx:{ml:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:p})]}),e.jsxs(s,{sx:{display:"flex",ml:3},children:[e.jsxs(s,{children:[t("setup.fuel.current"),":"]}),e.jsx(s,{sx:{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold"},children:g})]})]})]}),e.jsx(P,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:t("setup.next")})})]}):e.jsx(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:e.jsx(W,{})})}R.propTypes={onNext:d.func,onPrevious:d.func};const T=I(F)`
2
2
  .qr-body {
3
3
  width: 580px;
4
4
  ${n=>n.theme.breakpoints.down("md")} {
@@ -0,0 +1 @@
1
+ import{D as E,j as e,Q as S,cm as P,bu as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-DnR6WYuU.js";import{u as W,s as I,c as L,W as p,j as N,b3 as A}from"./index-CQgzjKgB.js";import{o as D}from"./vendor-arcblock-Cnwtqa7s.js";import{b8 as T}from"./vendor-ux-B0gV9NvH.js";import{g as U,b as j}from"./vendor-hooks-BQWlJm53.js";import{u as z,r as i,j as F}from"./vendor-react-CTtPmzVP.js";import{K as a}from"./landing-page-DRtId3hN.js";import{y as K}from"./vendor-utils-DCMKu06e.js";import{u as M}from"./use-window-close-B16QghYq.js";import"./lottie-web-4koyQiv_.js";function Z(){const m=z(),l=i.useRef(null),{t:s,locale:d}=i.useContext(T),{api:x,connectApi:f}=W(),[h]=F(),w=E(),b=M(),n=U({ready:!1,success:!1,error:null,invalidSession:!1}),k=()=>{try{const o=new URL(window.location.href);if(o.hash.includes("invalid")){n.invalidSession=!0;return}const u=o.searchParams.get("__connect_url__"),v=N(u);if(!A(v))throw new Error("No token");n.ready=!0}catch{n.invalidSession=!0,m("#invalid",{replace:!0})}};i.useLayoutEffect(()=>k(),[]);const C=j(o=>{n.error=o.message,window.opener?.postMessage({type:"connect-endpoint-message",error:n.error},"*"),m("#invalid",{replace:!0})}),y=j(()=>{window.opener?.postMessage({type:"connect-endpoint-message",success:!0},"*"),n.success=!0}),t=h.get("source")||"Generate Access Key";i.useEffect(()=>{l.current&&n.ready&&f.open({locale:d,containerEl:l.current,action:"gen-access-key",extraParams:{remark:t},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:K(window.location.origin,L.WELLKNOWN_SERVICE_PATH_PREFIX,I),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:y,onError:C},{locale:d})},[f,n.ready,x,C,y,d,s,t]);const g=e.jsx(S,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(P,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(n.invalidSession)return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:g})},"invalid");if(n.error){const o=n.error,u=g;return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:o,extra:u})},"error")}return n.success?(h.has("closeOnSuccess")&&b(),e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(R,{style:{color:w.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:t}),description:`${s("connectCli.successDesc",{source:t})} ${s("connectCli.upload")}`})},"success")):n.ready?e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsxs(r,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(r,{sx:{mb:5},children:[e.jsx(c,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(r,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(r,{sx:{display:"inline-block"},ref:l})]})},"ready"):e.jsx(D,{children:e.jsx(_,{})})}export{Z as default};
@@ -0,0 +1 @@
1
+ import{j as e,ak as a,T as y,a6 as M,b6 as Y,Q as W,bb as Z,D as X,aZ as F,a_ as K,bu as ee}from"./vendor-mui-core-DnR6WYuU.js";import{r as d,u as se,j as ne}from"./vendor-react-CTtPmzVP.js";import{b0 as te,b4 as oe,b5 as re,b6 as ie,b7 as ae,u as ce,o as le,j as $,W as ue,am as de,c as pe}from"./index-CQgzjKgB.js";import{n as S,ae as he,y as O}from"./vendor-utils-DCMKu06e.js";import{g as J,b as p,x as xe,t as fe}from"./vendor-hooks-BQWlJm53.js";import{M as H,V as Q,G as ge,a3 as G,a6 as me}from"./vendor-ux-B0gV9NvH.js";import{o as je}from"./vendor-arcblock-Cnwtqa7s.js";import{K as ye}from"./landing-page-DRtId3hN.js";import{u as we}from"./use-window-close-B16QghYq.js";import"./lottie-web-4koyQiv_.js";function Ce({requestAppInfo:l,currentAppInfo:w}){return e.jsxs(a,{sx:{textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(H,{src:w.appLogo,alt:"Server",width:48,height:48,useProxyFallback:!0}),e.jsxs(a,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"grey.500",mx:.5}},children:[e.jsx(a,{className:"dot"}),e.jsx(a,{className:"dot"}),e.jsx(a,{className:"dot"})]}),e.jsx(H,{src:l.appLogo,alt:l.appName,width:48,height:48,useProxyFallback:!0})]}),e.jsxs(y,{sx:{mb:1,fontSize:"1.2rem"},children:["Authorize"," ",e.jsx(a,{component:"span",sx:{color:"primary.main"},children:l.appName})]})]})}const Ae={en:{notThis:"Not you?",useAnother:"Use another account",authorize:"Authorize",connect:"Connect",cancel:"Cancel"},zh:{notThis:"不是这个?",useAnother:"使用其他账户",authorize:"授权",connect:"Connect",cancel:"取消"}};function be({session:l,requestAppInfo:w,currentAppInfo:z,children:k=null,userInfo:s=void 0,hideSwitchConnect:N=!1,hideAuthorize:t=!1,hideCancel:L=!1,hideButton:_=!1,notThisText:I=void 0,authorizeText:o=void 0,connectText:c=void 0,cancelText:P=void 0,useAnotherText:C=void 0,slotProps:h=void 0,onConnect:R=S,onAuthorize:f=S,onSwitchConnect:v=S,onSwitchPassport:A=S,onCancel:D=S,ref:E,disableAuthorizeButton:T=!1}){const r=J({loading:!1}),{locale:b="en"}=Q()||{},g=p((B,j={})=>ge(Ae,B,b,"en",j)),x=p(()=>{r.loading=!1}),U=p(()=>{r.loading=!0,R?.(x)}),q=p(()=>{r.loading=!0,v?.(x)}),n=p(()=>{r.loading=!0,f?.(x)}),i=p(()=>{r.loading=!0,A?.(x)}),u=p(()=>{D?.()});if(d.useImperativeHandle(E,()=>({closeLoading:x})),l.loading||!l.initialized)return e.jsx(je,{children:e.jsx(M,{})});const m=s??l?.user;return e.jsx(ye,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(a,{...h?.root,sx:G({width:420,maxWidth:"100%"},h?.root?.sx),children:e.jsx(te,{hideCloseButton:!0,...h?.didConnectContainer,children:e.jsxs(a,{...h?.contentContainer,sx:G({display:"flex",flexDirection:"column",gap:1.5,p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},h?.contentContainer?.sx),children:[e.jsx(Ce,{requestAppInfo:w,currentAppInfo:z}),m?e.jsxs(e.Fragment,{children:[e.jsx(oe,{user:m,showDid:!0,cardType:ie.Detailed,infoType:re.Minimal,renderTopRightContent:()=>e.jsx(ae,{user:m,switchPassport:i})}),e.jsx(a,{})]}):null,k,_?null:e.jsxs(e.Fragment,{children:[e.jsx(a,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden",my:1}}),e.jsxs(Y,{direction:"row",spacing:2,children:[L?null:e.jsx(W,{color:"inherit",variant:"outlined",size:"large",fullWidth:!0,onClick:u,sx:{color:"grey.500"},children:P||g("cancel")}),m&&!t?e.jsxs(W,{variant:"contained",size:"large",fullWidth:!0,onClick:n,disabled:r.loading||T,children:[r.loading?e.jsx(M,{size:20,sx:{mr:1}}):null,o||g("authorize")]}):e.jsxs(W,{variant:"contained",size:"large",fullWidth:!0,disabled:r.loading||T,onClick:U,children:[r.loading?e.jsx(M,{size:20,sx:{mr:1}}):null,c||g("connect")]})]})]}),N||!m?null:e.jsx(a,{sx:{textAlign:"center"},children:e.jsxs(y,{variant:"body2",sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:[I||g("notThis")," ",e.jsx(Z,{underline:"hover",onClick:q,sx:{cursor:"pointer"},children:C||g("useAnother")})]})})]})})})})}const Se=O(window.location.origin,pe.WELLKNOWN_BLOCKLET_USER_PATH,"settings#user-center-access-key-setting"),V=3e3;function De(){const l=d.useRef(null),[w,z]=d.useState(),[k]=xe({targetDate:w}),{session:s}=ce(),N=X(),t=J({ready:!1,success:!1,error:null,invalidSession:!1,token:null}),[L,_]=fe("currentUserInfo",{defaultValue:null}),I=se(),{t:o}=Q(),[c]=ne(),P=we(),[,C]=d.useState(!0),[h,R]=d.useState({appName:c.get("cli")?c.get("appName")??o("aigne.cli"):"",appLogo:c.get("cli")?c.get("appLogo"):""}),f=c.get("required_roles")||"",v=d.useMemo(()=>{const n=f.split(",")||[];if(n.length===0)return n;const i=he([s.user?.role,(s.user?.passports||[]).map(u=>u.role)].flat().filter(Boolean));return i.length===0?i:n.filter(u=>i.includes(u.toLocaleLowerCase().trim()))},[s.user,f]),A=v.join(","),D=s.user&&f?v.length>0:!0,E=async()=>{C(!0);try{const n=c.get("__url__"),i=n?$(n):null;if(!i){C(!1);return}const u="__blocklet__.js?type=json",B=new URL(i).origin,{data:j}=await de.get(O(B,u));R({appName:j?.appName,appUrl:j?.appUrl,appLogo:O(j?.appUrl,j?.appLogo)})}catch(n){console.error(n)}finally{C(!1)}};d.useEffect(()=>{s.user&&_(s.user)},[s.user]);const T=()=>{E(),s.user&&_(s.user);try{const n=new URL(window.location.href);if(n.hash.includes("invalid")){t.invalidSession=!0;return}const i=n.searchParams.get("__token__"),u=i?$(i):null;if(!u)throw new Error("No token");t.token=u,t.ready=!0}catch(n){t.invalidSession=!0,t.error=n.message,window.opener?.postMessage({type:"connect-aigne-message",error:n.message},"*"),I("#invalid",{replace:!0})}};d.useLayoutEffect(()=>T(),[]);const r=window.blocklet,b=c.get("source")||"Generate Access Key",g=p(async n=>{try{await le.post("/access-key/authorize",{source:b,sid:t.token,requiredRoles:A}),t.success=!0,window.opener?.postMessage({type:"connect-aigne-message",success:!0},"*"),c.has("closeOnSuccess")&&(z(Date.now()+V),setTimeout(()=>P(),V))}catch(i){console.error(i)}finally{n()}}),x=p(()=>{s.login()}),U=p(()=>{window.close()});d.useEffect(()=>{s.initialized&&!s.user&&(me()||x())},[s?.user,s?.initialized,x]),d.useEffect(()=>{s.open||l.current?.closeLoading?.()},[s.open]);const q=()=>t.error?e.jsxs(F,{severity:"error",children:[e.jsx(K,{children:o("aigne.notAuthorized")}),t.error]}):t.success?e.jsx(ue,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(ee,{style:{color:N.palette.success.main,fontSize:72}}),title:o("connectCli.success",{source:b}),description:`${o("connectCli.successDesc",{source:b})} ${c.has("closeOnSuccess")?o("connectCli.closeDelay",{seconds:Math.ceil(k/1e3)}):""}`}):e.jsxs(F,{severity:"info",children:[e.jsx(K,{children:o("aigne.connectTo",{appName:r.appName})}),f&&e.jsx(y,{component:"li",variant:"body2",children:A?o("aigne.accessTips.switchPassport",{required_roles:A}):o("aigne.accessTips.switchPassportRequired",{required_roles:f})}),e.jsx(y,{component:"li",variant:"body2",children:o("aigne.accessTips.tips1",{appName:h.appName,accessAppName:r.appName})}),e.jsx(y,{component:"li",variant:"body2",children:o("aigne.accessTips.tips2",{appName:h.appName})}),e.jsx(y,{component:"li",variant:"body2",sx:{"& a":{color:"inherit",textDecoration:"underline"}},dangerouslySetInnerHTML:{__html:o("aigne.accessTips.tips3",{url:Se,accessAppName:r.appName})}})]});return e.jsx(be,{ref:l,session:s,requestAppInfo:h,currentAppInfo:r,userInfo:L,onAuthorize:g,onConnect:x,onSwitchConnect:s.switchDid,onCancel:U,hideAuthorize:!!t.error,hideSwitchConnect:t.success,hideButton:t.success,authorizeText:o("common.approve"),onSwitchPassport:s.switchDid,slotProps:{root:{sx:{width:500}}},disableAuthorizeButton:!D,children:q()})}export{De as default};
@@ -0,0 +1 @@
1
+ import{b2 as t}from"./index-CQgzjKgB.js";import{W as e}from"./vendor-ux-B0gV9NvH.js";function c(...o){try{return t(...o)}catch(r){throw e.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{c as g};
@@ -0,0 +1 @@
1
+ const c={width:256,height:315,body:'<path d="M213.803 167.03c.442 47.58 41.74 63.413 42.197 63.615c-.35 1.116-6.599 22.563-21.757 44.716c-13.104 19.153-26.705 38.235-48.13 38.63c-21.05.388-27.82-12.483-51.888-12.483c-24.061 0-31.582 12.088-51.51 12.871c-20.68.783-36.428-20.71-49.64-39.793c-27-39.033-47.633-110.3-19.928-158.406c13.763-23.89 38.36-39.017 65.056-39.405c20.307-.387 39.475 13.662 51.889 13.662c12.406 0 35.699-16.895 60.186-14.414c10.25.427 39.026 4.14 57.503 31.186c-1.49.923-34.335 20.044-33.978 59.822M174.24 50.199c10.98-13.29 18.369-31.79 16.353-50.199c-15.826.636-34.962 10.546-46.314 23.828c-10.173 11.763-19.082 30.589-16.678 48.633c17.64 1.365 35.66-8.964 46.64-22.262"/>'},l={width:256,height:262,body:'<path fill="#4285F4" d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"/><path fill="#34A853" d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"/><path fill="#FBBC05" d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782"/><path fill="#EB4335" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"/>'};export{c as a,l as d};
@@ -1 +1 @@
1
- import{j as o,b6 as n}from"./vendor-mui-core-DnR6WYuU.js";import{L as r}from"./vendor-react-CTtPmzVP.js";import{w as i}from"./vendor-ux-IiqHAjMq.js";import{c as t}from"./index-DG0EDext.js";import{S as e}from"./studio-BzkFXY4W.js";import"./vendor-utils-CxWN1dT3.js";import"./vendor-hooks-qxhUUbW5.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DyliHtVF.js";import"./index-5n0QAOjO.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",spacing:2,sx:{m:4},children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
1
+ import{j as o,b6 as n}from"./vendor-mui-core-DnR6WYuU.js";import{L as r}from"./vendor-react-CTtPmzVP.js";import{F as i}from"./vendor-ux-B0gV9NvH.js";import{c as t}from"./index-CQgzjKgB.js";import{S as e}from"./studio-1jwq0HOw.js";import"./vendor-utils-DCMKu06e.js";import"./vendor-hooks-BQWlJm53.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cnwtqa7s.js";import"./index-BGhqVqit.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",spacing:2,sx:{m:4},children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
@@ -1 +1 @@
1
- import{a as E}from"./vendor-react-CTtPmzVP.js";import{bA as L}from"./index-DG0EDext.js";const $=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:y,overflow:c,styles:f,onLoad:p,onMouseOver:b,onMouseOut:m,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:A,name:P,target:v,loading:F,importance:I,referrerpolicy:M,allowpaymentrequest:S,src:q,key:x})=>{const t=L({src:q||r,target:v||null,style:{position:a||null,display:i||"initial",overflow:c||null},scrolling:w||null,allowpaymentrequest:S||null,importance:I||null,sandbox:s&&[...s].join(" ")||null,loading:F||null,styles:f||null,name:P||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":A||null,"aria-hidden":O||null,"aria-label":k||null,width:y||null,height:u||null,onLoad:p||null,onMouseOver:b||null,onMouseOut:m||null,key:x||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),E.createElement("iframe",Object.assign({},l))};export{$ as I};
1
+ import{a as E}from"./vendor-react-CTtPmzVP.js";import{bv as L}from"./index-CQgzjKgB.js";const $=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:y,overflow:c,styles:f,onLoad:p,onMouseOver:b,onMouseOut:m,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:v,name:P,target:A,loading:F,importance:I,referrerpolicy:M,allowpaymentrequest:S,src:q,key:x})=>{const t=L({src:q||r,target:A||null,style:{position:a||null,display:i||"initial",overflow:c||null},scrolling:w||null,allowpaymentrequest:S||null,importance:I||null,sandbox:s&&[...s].join(" ")||null,loading:F||null,styles:f||null,name:P||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":v||null,"aria-hidden":O||null,"aria-label":k||null,width:y||null,height:u||null,onLoad:p||null,onMouseOver:b||null,onMouseOut:m||null,key:x||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),E.createElement("iframe",Object.assign({},l))};export{$ as I};
@@ -1,4 +1,4 @@
1
- import{M as p,j as e,Q as m,b0 as I,P as b,ai as B,o as L,bV as v,O as P}from"./vendor-mui-core-DnR6WYuU.js";import{r as i}from"./vendor-react-CTtPmzVP.js";import{n as z}from"./vendor-utils-CxWN1dT3.js";import{l as f}from"./vendor-ux-IiqHAjMq.js";function A(t,s){i.useEffect(()=>{function r(o){!t||!t.current||t.current.contains(o.target)||s(o)}return document.addEventListener("click",r,!0),()=>{document.removeEventListener("click",r,!0)}},[t,s])}function w({...t}){const{size:s="medium",color:r="primary",menu:o=[],children:c=null,variant:x="contained",onClick:h=z,menuButtonProps:g={},...j}=t,[k,l]=i.useState(!1),a=i.useRef(null),u=i.useRef(null),M=Array.isArray(o)?o.map((n,C)=>i.isValidElement(n)?n:i.createElement(p,{...n,key:C})):o,y=()=>{l(n=>!n)},d=n=>{a.current&&a.current.contains(n.target)||l(!1)};A(u,d);const E=n=>{n.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(R,{variant:x,size:s,color:r,ref:a,...j,children:[typeof c=="function"?c():e.jsx(m,{onClick:h,color:r,children:c}),e.jsx(m,{onClick:y,color:r,...g,"aria-label":"more functions",children:e.jsx(I,{})})]}),e.jsx(V,{open:k,anchorEl:a.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(b,{ref:u,children:e.jsx(B,{onClickAway:d,children:e.jsx(L,{onClick:E,children:M})})})})]})}w.Item=p;const R=f(v)`
1
+ import{M as p,j as e,Q as m,b0 as I,P as b,ai as B,o as L,bV as v,O as P}from"./vendor-mui-core-DnR6WYuU.js";import{r as i}from"./vendor-react-CTtPmzVP.js";import{n as z}from"./vendor-utils-DCMKu06e.js";import{l as f}from"./vendor-ux-B0gV9NvH.js";function A(t,s){i.useEffect(()=>{function r(o){!t||!t.current||t.current.contains(o.target)||s(o)}return document.addEventListener("click",r,!0),()=>{document.removeEventListener("click",r,!0)}},[t,s])}function w({...t}){const{size:s="medium",color:r="primary",menu:o=[],children:c=null,variant:x="contained",onClick:h=z,menuButtonProps:g={},...j}=t,[k,l]=i.useState(!1),a=i.useRef(null),u=i.useRef(null),M=Array.isArray(o)?o.map((n,C)=>i.isValidElement(n)?n:i.createElement(p,{...n,key:C})):o,y=()=>{l(n=>!n)},d=n=>{a.current&&a.current.contains(n.target)||l(!1)};A(u,d);const E=n=>{n.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(R,{variant:x,size:s,color:r,ref:a,...j,children:[typeof c=="function"?c():e.jsx(m,{onClick:h,color:r,children:c}),e.jsx(m,{onClick:y,color:r,...g,"aria-label":"more functions",children:e.jsx(I,{})})]}),e.jsx(V,{open:k,anchorEl:a.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(b,{ref:u,children:e.jsx(B,{onClickAway:d,children:e.jsx(L,{onClick:E,children:M})})})})]})}w.Item=p;const R=f(v)`
2
2
  > .MuiButtonBase-root:last-of-type {
3
3
  min-width: 2em;
4
4
  padding-left: 0;
@@ -1 +1 @@
1
- import{r as p}from"./vendor-react-CTtPmzVP.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-DnR6WYuU.js";import{a as j}from"./vendor-hooks-qxhUUbW5.js";import{Q as r}from"./index-DG0EDext.js";import{V as A}from"./vendor-ux-IiqHAjMq.js";import{l as C}from"./arrow-down.svg-C4FUKwt4.js";import{L as O,D as H}from"./vendor-mui-x-CQc01l4r.js";import{A as R}from"./AdapterDayjs-CIz_EOtQ.js";function v({value:s=null,onChange:i,error:l=!1,helperText:c="",label:h="",timezone:e="",minDateTime:f=null}){const d=j(()=>{let n=r();return s&&(n=e?r(s).tz(e):r(s)),n},[s,e]),m=n=>{const T=e?r(n).tz(e):r(n);i(new Date(T.format("YYYY-MM-DD HH:mm:00")))};return a.jsx(O,{dateAdapter:R,children:a.jsx(b,{fullWidth:!0,error:l,children:a.jsx(H,{label:h,minDateTime:f,value:d,onChange:m,slotProps:{textField:{error:l,helperText:l?c:""}},format:"YYYY-MM-DD HH:mm"})})})}v.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,error:t.bool,helperText:t.string,label:t.string,timezone:t.string,minDateTime:t.instanceOf(Date)};function U(s){return a.jsx(C,{...s,width:20,height:20})}const u={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function $({placeholder:s="",value:i="",onChange:l,timezone:c="",showError:h=!0}){const{t:e}=A(),[f,d]=p.useState(i||""),[m,n]=p.useState(null),[T,Y]=p.useState(null),x=p.useMemo(()=>[{value:u.MINUTES_30,label:`30 ${e("common.minutes")}`},{value:u.HOUR_1,label:`1 ${e("common.hour")}`},{value:u.HOURS_3,label:`3 ${e("common.hours")}`},{value:u.DAY_1,label:`1 ${e("common.day")}`},{value:u.DAYS_7,label:`7 ${e("common.days")}`},{value:u.DAYS_30,label:`30 ${e("common.days")}`},{value:"custom",label:e("common.custom")}],[e]),M=o=>{if(d(o),o==="custom"){const D=c?r().tz(c):r(),S=D.add(1,"day").toDate();Y(D),n(S),l(S)}else l(new Date(Date.now()+o))},_=o=>{n(o),l(o)};p.useEffect(()=>{i&&(x.find(D=>r(D.value).isSame(i))||(d("custom"),n(i)))},[]);const g=j(()=>h?!!(!m||r(m).isBefore(r())):!1,[m,e]);return a.jsxs(a.Fragment,{children:[a.jsx(b,{fullWidth:!0,children:a.jsx(y,{select:!0,value:f,label:s||e("team.passport.passportExpireTime"),onChange:o=>M(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:U}},sx:{"& .MuiInputLabel-root":{width:"calc(100% - 46px)"}},children:x.map(o=>a.jsx(E,{value:o.value,children:o.label},o.value))})}),f==="custom"&&a.jsx(I,{children:a.jsx(v,{value:m,onChange:_,label:e("team.passport.customExpireTime"),timezone:c,error:!!g,helperText:g?e("team.passport.customExpireTimeIsInvalid"):void 0,minDateTime:T})})]})}$.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,timezone:t.string,placeholder:t.string,showError:t.bool};export{$ as T};
1
+ import{r as p}from"./vendor-react-CTtPmzVP.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-DnR6WYuU.js";import{a as j}from"./vendor-hooks-BQWlJm53.js";import{Q as r}from"./index-CQgzjKgB.js";import{V as A}from"./vendor-ux-B0gV9NvH.js";import{t as C}from"./arrow-down.svg-7ME6T1BL.js";import{L as O,D as H}from"./vendor-mui-x-CQc01l4r.js";import{A as R}from"./AdapterDayjs-DafRMFLg.js";function v({value:s=null,onChange:i,error:l=!1,helperText:c="",label:h="",timezone:e="",minDateTime:f=null}){const d=j(()=>{let n=r();return s&&(n=e?r(s).tz(e):r(s)),n},[s,e]),m=n=>{const T=e?r(n).tz(e):r(n);i(new Date(T.format("YYYY-MM-DD HH:mm:00")))};return a.jsx(O,{dateAdapter:R,children:a.jsx(b,{fullWidth:!0,error:l,children:a.jsx(H,{label:h,minDateTime:f,value:d,onChange:m,slotProps:{textField:{error:l,helperText:l?c:""}},format:"YYYY-MM-DD HH:mm"})})})}v.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,error:t.bool,helperText:t.string,label:t.string,timezone:t.string,minDateTime:t.instanceOf(Date)};function U(s){return a.jsx(C,{...s,width:20,height:20})}const u={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function $({placeholder:s="",value:i="",onChange:l,timezone:c="",showError:h=!0}){const{t:e}=A(),[f,d]=p.useState(i||""),[m,n]=p.useState(null),[T,Y]=p.useState(null),x=p.useMemo(()=>[{value:u.MINUTES_30,label:`30 ${e("common.minutes")}`},{value:u.HOUR_1,label:`1 ${e("common.hour")}`},{value:u.HOURS_3,label:`3 ${e("common.hours")}`},{value:u.DAY_1,label:`1 ${e("common.day")}`},{value:u.DAYS_7,label:`7 ${e("common.days")}`},{value:u.DAYS_30,label:`30 ${e("common.days")}`},{value:"custom",label:e("common.custom")}],[e]),M=o=>{if(d(o),o==="custom"){const D=c?r().tz(c):r(),S=D.add(1,"day").toDate();Y(D),n(S),l(S)}else l(new Date(Date.now()+o))},_=o=>{n(o),l(o)};p.useEffect(()=>{i&&(x.find(D=>r(D.value).isSame(i))||(d("custom"),n(i)))},[]);const g=j(()=>h?!!(!m||r(m).isBefore(r())):!1,[m,e]);return a.jsxs(a.Fragment,{children:[a.jsx(b,{fullWidth:!0,children:a.jsx(y,{select:!0,value:f,label:s||e("team.passport.passportExpireTime"),onChange:o=>M(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:U}},sx:{"& .MuiInputLabel-root":{width:"calc(100% - 46px)"}},children:x.map(o=>a.jsx(E,{value:o.value,children:o.label},o.value))})}),f==="custom"&&a.jsx(I,{children:a.jsx(v,{value:m,onChange:_,label:e("team.passport.customExpireTime"),timezone:c,error:!!g,helperText:g?e("team.passport.customExpireTimeIsInvalid"):void 0,minDateTime:T})})]})}$.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,timezone:t.string,placeholder:t.string,showError:t.bool};export{$ as T};