@abtnode/blocklet-services 1.16.53-beta-20251013-005429-ca3b05de → 1.16.53-beta-20251014-110009-8220e324

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 (265) hide show
  1. package/api/middlewares/verify-did.js +27 -0
  2. package/api/routes/csp-proxy.js +4 -0
  3. package/api/routes/ocap.js +18 -3
  4. package/api/routes/openapi.js +3 -2
  5. package/api/routes/opencomponent.js +3 -2
  6. package/api/routes/openembed.js +3 -2
  7. package/api/routes/user.js +11 -9
  8. package/api/services/auth/session.js +6 -0
  9. package/dist/assets/{AdapterDayjs-Bp0ir26R.js → AdapterDayjs-DyE9ImrK.js} +1 -1
  10. package/dist/assets/{Google-E3u2a9g7.js → Google-ZJmTt04Y.js} +1 -1
  11. package/dist/assets/{access-control-7gWIJZpX.js → access-control-tkXiKu_B.js} +1 -1
  12. package/dist/assets/{actions-B4VXcSRp.js → actions-C4-lIUPY.js} +1 -1
  13. package/dist/assets/{add-component-core-C43eXvX3.js → add-component-core-DZewqmQf.js} +17 -17
  14. package/dist/assets/{add-resource-DT9p1SVt.js → add-resource-CFOC6fO8.js} +1 -1
  15. package/dist/assets/{addon-iuYOVe1l.js → addon-CAEOt-oM.js} +1 -1
  16. package/dist/assets/{advanced-CbrPzmPw.js → advanced-BsPW8tKj.js} +2 -2
  17. package/dist/assets/aigne-C6-afA57.js +10 -0
  18. package/dist/assets/api-txzyyizM.js +1 -0
  19. package/dist/assets/{appearance-Ck3ODt4R.js → appearance-BZqg7Kkn.js} +1 -1
  20. package/dist/assets/{ar-7nBHeQPa.js → ar-DW15ct8A.js} +1 -1
  21. package/dist/assets/{ar-CHd3xUx5.js → ar-Ge3t6oI2.js} +2 -2
  22. package/dist/assets/{arrow-down.svg-ByD_YKms.js → arrow-down.svg-zOZF6XLO.js} +1 -1
  23. package/dist/assets/audit-logs-aCVF7lhB.js +35 -0
  24. package/dist/assets/{authorize-C9O917EK.js → authorize-QCoPxe3U.js} +1 -1
  25. package/dist/assets/{base-chart-UFWO9a3P.js → base-chart-C_jLgGFD.js} +1 -1
  26. package/dist/assets/{base32-BK7MXAD4.js → base32-Cg02gOuu.js} +1 -1
  27. package/dist/assets/bind-account-C8pbYbtP.js +1 -0
  28. package/dist/assets/{branding-DtTT8LEA.js → branding-BxYz3fG3.js} +5 -5
  29. package/dist/assets/{branding-F6Ls_sBm.js → branding-CKEfz45I.js} +1 -1
  30. package/dist/assets/branding-r2VAPR6q.js +1 -0
  31. package/dist/assets/{bundle-avatar-BZh2UMH9.js → bundle-avatar-CRBdm-Kg.js} +1 -1
  32. package/dist/assets/button-CaqBEwnu.js +1 -0
  33. package/dist/assets/click-to-copy-CK42VmRr.js +1 -0
  34. package/dist/assets/{cloneDeep-LRq4Ya2k.js → cloneDeep-gpb_g13N.js} +1 -1
  35. package/dist/assets/{collapse-DJGzUM1Q.js → collapse-D7GlSZQp.js} +1 -1
  36. package/dist/assets/{complete-BuJ7B50g.js → complete-B1ERhNgz.js} +3 -3
  37. package/dist/assets/{component-D1cVQ2BQ.js → component-D1imN4b5.js} +2 -2
  38. package/dist/assets/{config-CoBMDXIe.js → config-CRH_AVvL.js} +2 -2
  39. package/dist/assets/{config-D8oltJzP.js → config-D9yLBkGc.js} +1 -1
  40. package/dist/assets/config-dGkFpD36.js +53 -0
  41. package/dist/assets/config-navigation-CkwpaFE2.js +40 -0
  42. package/dist/assets/config-space-DEqVeU5w.js +1 -0
  43. package/dist/assets/confirm-DAMhAYR3.js +7 -0
  44. package/dist/assets/{connect-DNK092nY.js → connect-BHzZ3O8m.js} +1 -1
  45. package/dist/assets/{connect-DyVkSvx0.js → connect-VhC_tOjl.js} +1 -1
  46. package/dist/assets/connect-to-CnrptX8a.js +1 -0
  47. package/dist/assets/{content-layout-B9tc9LCL.js → content-layout-W7JDm8iO.js} +1 -1
  48. package/dist/assets/{create-passport-svg-n0J1kwzH.js → create-passport-svg-BsR3hKFq.js} +1 -1
  49. package/dist/assets/createClass-B4I2IV47.js +1 -0
  50. package/dist/assets/{dashboard-DA1_SonP.js → dashboard-C6gjCAD6.js} +7 -7
  51. package/dist/assets/{de-CD44Obtw.js → de-CbARTvf4.js} +2 -2
  52. package/dist/assets/{de-Dn7PhTZq.js → de-DomrlJGv.js} +1 -1
  53. package/dist/assets/{delete-confirm-BoyKK_sh.js → delete-confirm-Ca3miSFM.js} +1 -1
  54. package/dist/assets/{did-address-DnFNwELW.js → did-address-BQL5Zxlr.js} +1 -1
  55. package/dist/assets/{domain-CxT85hKF.js → domain-DZJxjNTq.js} +1 -1
  56. package/dist/assets/{domain-action-card-k3lim42n.js → domain-action-card-CPmR-n-P.js} +2 -2
  57. package/dist/assets/domains-DH3UyJ8c.js +1 -0
  58. package/dist/assets/{email-DtG_yIEc.js → email-dNTq-UZN.js} +2 -2
  59. package/dist/assets/{empty-spinner-LXNYl6_1.js → empty-spinner-sNq-0DF5.js} +1 -1
  60. package/dist/assets/engine-lkWYvtZC.js +1 -0
  61. package/dist/assets/{es-B_X5HHiA.js → es-BWRncAvl.js} +1 -1
  62. package/dist/assets/{es-DNFAt0y7.js → es-CaCbzATO.js} +2 -2
  63. package/dist/assets/exchange-passport-C-tUCCyK.js +1 -0
  64. package/dist/assets/{form-DgDq3Zmy.js → form-BIXDp48N.js} +3 -3
  65. package/dist/assets/{form-text-input-CwOsIY5R.js → form-text-input-AIMlcRaM.js} +1 -1
  66. package/dist/assets/{form-wrapper-Dt1iJZge.js → form-wrapper-DINLdpTN.js} +1 -1
  67. package/dist/assets/{fr-C9xE9tD4.js → fr-B3yjKUFH.js} +2 -2
  68. package/dist/assets/{fr-BIAMVkwl.js → fr-DkEISw5U.js} +1 -1
  69. package/dist/assets/{fuel-BywHsiUk.js → fuel-_yedTm2I.js} +1 -1
  70. package/dist/assets/{gen-access-key-CDwRDR7-.js → gen-access-key-DXoAyhBv.js} +1 -1
  71. package/dist/assets/{gen-simple-access-key-DGsX2Fkj.js → gen-simple-access-key-BPpzmXdv.js} +1 -1
  72. package/dist/assets/get-safe-url-94yHUMyk.js +1 -0
  73. package/dist/assets/{hi-4-0lpKbp.js → hi-CNLsAFCp.js} +1 -1
  74. package/dist/assets/{hi-D_0DFJcS.js → hi-q4mhHiIl.js} +1 -1
  75. package/dist/assets/{home-Cylh8bGb.js → home-CgfBIBYo.js} +1 -1
  76. package/dist/assets/{id-Dw1-p0GY.js → id-CiNosIvh.js} +1 -1
  77. package/dist/assets/{id-BgJjfH2L.js → id-DTf7aVH8.js} +2 -2
  78. package/dist/assets/{iframe-BPsu-Uyg.js → iframe-D73zp9VN.js} +1 -1
  79. package/dist/assets/{index-spmYO3Ab.js → index-3gh3KcSo.js} +9 -9
  80. package/dist/assets/{index-DwSKcE0X.js → index-9GU1U3uC.js} +2 -2
  81. package/dist/assets/index-B07KPoAU.js +7 -0
  82. package/dist/assets/index-BO_K5qp8.js +4 -0
  83. package/dist/assets/index-BV58Bk4h.js +6 -0
  84. package/dist/assets/index-BcGECSaf.js +1 -0
  85. package/dist/assets/{index-D84o3DbN.js → index-BdlpB2eR.js} +7 -7
  86. package/dist/assets/{index-DM1_TaRl.js → index-Bsziwsc_.js} +6 -6
  87. package/dist/assets/index-CSjGSZvb.js +55 -0
  88. package/dist/assets/{index-BcnVhON2.js → index-CT7MCvWf.js} +2 -2
  89. package/dist/assets/index-CWoGXO4Z.js +30 -0
  90. package/dist/assets/{index-Y8LQew4k.js → index-Cd_Gml9C.js} +1 -1
  91. package/dist/assets/index-CeTnfded.js +1 -0
  92. package/dist/assets/index-CmM1Fb8I.js +1041 -0
  93. package/dist/assets/{index-hl-qhRoV.js → index-CoEkDRkg.js} +3 -3
  94. package/dist/assets/{index-BMvhWz0X.js → index-CtjgKQvS.js} +12 -12
  95. package/dist/assets/{index-CVvmswkh.js → index-D2x0prGU.js} +5 -5
  96. package/dist/assets/{index-B2RPurN4.js → index-DACE9NO5.js} +1 -1
  97. package/dist/assets/{index-CXsAtHLa.js → index-DGuACYX4.js} +2 -2
  98. package/dist/assets/{index-BnQ-_yld.js → index-DJwvNiRa.js} +13 -13
  99. package/dist/assets/{index-Bx-RW9vi.js → index-DX3L95vz.js} +1 -1
  100. package/dist/assets/{index-Cx7Xa7nl.js → index-DhLGB_2p.js} +1 -1
  101. package/dist/assets/{index-kYu0y26a.js → index-Dl5NP6ym.js} +8 -8
  102. package/dist/assets/{index-DlrQ2HQP.js → index-DlRa8Zeh.js} +1 -1
  103. package/dist/assets/index-Dvkly5_Y.js +1 -0
  104. package/dist/assets/{index-BEDCOb-P.js → index-DwuQFnlr.js} +1 -1
  105. package/dist/assets/{index-Ba9-ArMT.js → index-IGBGBXd_.js} +1 -1
  106. package/dist/assets/{index-v2QpDA9k.js → index-J-Fwoozx.js} +1 -1
  107. package/dist/assets/{index-3ePiAFIp.js → index-KpZGUssm.js} +1 -1
  108. package/dist/assets/{index-CDZZTyLs.js → index-M4Y_gFoP.js} +2 -2
  109. package/dist/assets/{index-BO080WnZ.js → index-VySXxf4w.js} +1 -1
  110. package/dist/assets/index-erYyAW7o.js +1 -0
  111. package/dist/assets/index-gu-JSZcO.js +113 -0
  112. package/dist/assets/{index-8b6B9BvP.js → index-xrCVFXc_.js} +5 -5
  113. package/dist/assets/{invitation-C5kJotVc.js → invitation-LkRqaKIR.js} +5 -5
  114. package/dist/assets/invitations-D0twFHTb.js +3 -0
  115. package/dist/assets/invite-Bq02Wgwb.js +1 -0
  116. package/dist/assets/{isURL-GpP7YPNs.js → isURL-DAY9MZJJ.js} +2 -2
  117. package/dist/assets/issue-passport-NpVrtTSF.js +1 -0
  118. package/dist/assets/{item-CQIw46yu.js → item-A9AxqmJb.js} +1 -1
  119. package/dist/assets/{ja-SFs9TI5a.js → ja-Csh_XwzF.js} +2 -2
  120. package/dist/assets/{ja-C6gbn0J8.js → ja-D5EfJGvg.js} +1 -1
  121. package/dist/assets/{ko-av2FKXII.js → ko-DIYdQvvz.js} +1 -1
  122. package/dist/assets/{ko-CHdBh-EI.js → ko-xiNTwgO9.js} +2 -2
  123. package/dist/assets/landing-page-BBhzhyhU.js +1 -0
  124. package/dist/assets/{launch-result-message-DW948RfZ.js → launch-result-message-Dt-T7zmz.js} +1 -1
  125. package/dist/assets/{layout-3MwmBHGM.js → layout-CT8j1IGl.js} +1 -1
  126. package/dist/assets/list-CpdSyVlo.js +103 -0
  127. package/dist/assets/{list-D_RZEh7_.js → list-DcrvvV8X.js} +1 -1
  128. package/dist/assets/{list-header-DMpz8A8v.js → list-header-CjohGZ9B.js} +1 -1
  129. package/dist/assets/localization-BnjH2TLn.js +1 -0
  130. package/dist/assets/{log-BKfIwEBs.js → log-CcKk7QZL.js} +1 -1
  131. package/dist/assets/logger-DkBs7Soy.js +1 -0
  132. package/dist/assets/login-IMzJsMuG.js +1 -0
  133. package/dist/assets/{login-oauth-callback-CMnHoqWF.js → login-oauth-callback-Df5gSERT.js} +1 -1
  134. package/dist/assets/{logo-uploader-DPSSz4_-.js → logo-uploader-DI_6oB30.js} +1 -1
  135. package/dist/assets/{lost-passport-DePdm4wz.js → lost-passport-i0WRSJQt.js} +3 -3
  136. package/dist/assets/{observability-pdEZhjSl.js → observability-B458LeIE.js} +1 -1
  137. package/dist/assets/{omit-BQZKecPT.js → omit-DdfLLBNW.js} +1 -1
  138. package/dist/assets/{open-window-Br_pb9ZW.js → open-window-CrdkIvcc.js} +1 -1
  139. package/dist/assets/{over-due-invoice-payment-uxF9-1cS.js → over-due-invoice-payment-Dairtuas.js} +1 -1
  140. package/dist/assets/{overview-D8Gh5IS7.js → overview-D4hz1f04.js} +2 -2
  141. package/dist/assets/{page-header-DvSb4Cmz.js → page-header-gosgJ3fX.js} +1 -1
  142. package/dist/assets/passport-B2fL-0uN.js +1 -0
  143. package/dist/assets/{passport-item-YF9RfQH3.js → passport-item-L7acCYqJ.js} +1 -1
  144. package/dist/assets/{permission-uKfC5D9f.js → permission-B7_8SVB9.js} +1 -1
  145. package/dist/assets/{playground-C0bWoIDS.js → playground-_1Dj8J_h.js} +1 -1
  146. package/dist/assets/preferences-BNy97I1g.js +1 -0
  147. package/dist/assets/profile-embed-hHsyn2Ki.js +1 -0
  148. package/dist/assets/pt-BvcG4R7B.js +5 -0
  149. package/dist/assets/{pt-C5SxM_jO.js → pt-aIOBgpHE.js} +1 -1
  150. package/dist/assets/publish-resource-urgBZEXm.js +1 -0
  151. package/dist/assets/{react-beautiful-dnd.esm-BeX82uI5.js → react-beautiful-dnd.esm-CIwtis6a.js} +1 -1
  152. package/dist/assets/{react-stripe.esm-C51Uah32.js → react-stripe.esm-omsK4b05.js} +1 -1
  153. package/dist/assets/{required-BT8zXV8U.js → required-BPzIdi1N.js} +1 -1
  154. package/dist/assets/{ru-BWd-_jpY.js → ru-Bt8-v101.js} +1 -1
  155. package/dist/assets/ru-DzUPRLmr.js +5 -0
  156. package/dist/assets/runtime-wNrz-OwM.js +1 -0
  157. package/dist/assets/{sanitize-C5jEFDvG.js → sanitize-CEXE1rEu.js} +1 -1
  158. package/dist/assets/sdk-mf5ixH6N.js +1 -0
  159. package/dist/assets/{section-ZPKr6_ii.js → section-DOw43pby.js} +1 -1
  160. package/dist/assets/{security-YOGcIKde.js → security-D5AcOcu2.js} +3 -3
  161. package/dist/assets/session-BtQQCb_u.js +1 -0
  162. package/dist/assets/{setup-TVwmAqcY.js → setup-PRcxWbhy.js} +1 -1
  163. package/dist/assets/{shorten-label-DVy6K5I7.js → shorten-label-C-X_7vr2.js} +1 -1
  164. package/dist/assets/{simple-select-BeAlThKq.js → simple-select-Bg4XC1E_.js} +1 -1
  165. package/dist/assets/{spaces-C0dI3K7C.js → spaces-jHZOfRT3.js} +1 -1
  166. package/dist/assets/{start-D9z9VSK_.js → start-DyT2xbZe.js} +1 -1
  167. package/dist/assets/{starting-progress-C1bqyLSx.js → starting-progress-Jn-4yF7_.js} +1 -1
  168. package/dist/assets/status-b40PyJnc.js +1 -0
  169. package/dist/assets/{step-actions-C6BvFfMg.js → step-actions-BZmm0ei-.js} +1 -1
  170. package/dist/assets/{studio-CazjgR33.js → studio-Dqjq8IDN.js} +1 -1
  171. package/dist/assets/{switch-control-DEpBEl7-.js → switch-control-CRxlGq2g.js} +1 -1
  172. package/dist/assets/{table-tips-rCE1XKlc.js → table-tips-BMq3WO_p.js} +1 -1
  173. package/dist/assets/team-DK_N0J3a.js +146 -0
  174. package/dist/assets/th-BmW1qKpZ.js +5 -0
  175. package/dist/assets/{th-CRUlNqtq.js → th-QYkziTlm.js} +1 -1
  176. package/dist/assets/traffic-BVT9gNf1.js +1 -0
  177. package/dist/assets/{transfer-CTqNDZDy.js → transfer-BGhQJnlc.js} +2 -2
  178. package/dist/assets/unsubscribe-DsNv3U7c.js +1 -0
  179. package/dist/assets/{use-app-logo-DCgwdb4C.js → use-app-logo-BKyiSzxV.js} +1 -1
  180. package/dist/assets/{use-mobile-BQQpAf3i.js → use-mobile-DLnLSQQq.js} +1 -1
  181. package/dist/assets/{use-mobile-D6YQgajG.js → use-mobile-Db5FIl07.js} +1 -1
  182. package/dist/assets/{use-server-logo-ClR4qaF0.js → use-server-logo-CFlVReBS.js} +1 -1
  183. package/dist/assets/{use-window-close-CAdGHigF.js → use-window-close-CrHmRyVV.js} +1 -1
  184. package/dist/assets/{useAsync-DVtDVEv6.js → useAsync-1_z8P8M4.js} +1 -1
  185. package/dist/assets/{useAsync-fWwm3Jbj.js → useAsync-BKYfrNw7.js} +1 -1
  186. package/dist/assets/{useAsyncRetry-EEjDgDMR.js → useAsyncRetry-Dyo5t1bq.js} +1 -1
  187. package/dist/assets/{useLocalStorage-BtAV-lV2.js → useLocalStorage-Be_1V0gr.js} +1 -1
  188. package/dist/assets/user-center-BcjjuRmk.js +126 -0
  189. package/dist/assets/{user-follower-B4ZDD-Mm.js → user-follower-DgAPhBY5.js} +1 -1
  190. package/dist/assets/{user-sessions-DOAxWAOa.js → user-sessions-Bv46aXrx.js} +1 -1
  191. package/dist/assets/{util-FgS2GkyL.js → util-BLs2BnSw.js} +1 -1
  192. package/dist/assets/{util-DKVr8C5h.js → util-CxUMQb4N.js} +1 -1
  193. package/dist/assets/{vendor-arcblock-DeeG8u0h.js → vendor-arcblock-DGOH9a3F.js} +115 -114
  194. package/dist/assets/{vendor-hooks-BlA8TRnZ.js → vendor-hooks-DmThWyyG.js} +1 -1
  195. package/dist/assets/{vendor-mui-core-DRxbhqaK.js → vendor-mui-core-BFPsXaTR.js} +1 -1
  196. package/dist/assets/{vendor-mui-x-Qp6zkx78.js → vendor-mui-x-C6iZOJbV.js} +1 -1
  197. package/dist/assets/vendor-utils-OrZFrHBP.js +213 -0
  198. package/dist/assets/vendor-ux-CE4sOH7O.js +1569 -0
  199. package/dist/assets/{vi-5AzowaJ4.js → vi-BIkODa3n.js} +1 -1
  200. package/dist/assets/vi-BPU54RQW.js +5 -0
  201. package/dist/assets/{wait-connect-DgVeMAoQ.js → wait-connect-D97I-PbQ.js} +1 -1
  202. package/dist/assets/{wizard-Du2TbNOA.js → wizard-Bs0eTfDi.js} +2 -2
  203. package/dist/assets/{wizard-components-BrC7AMh4.js → wizard-components-BwF9dBN2.js} +2 -2
  204. package/dist/assets/wrap-locale-D6EgWtG_.js +1 -0
  205. package/dist/assets/{zh-CecJnvFy.js → zh-Dp_c1E39.js} +1 -1
  206. package/dist/assets/{zh-CZLHYA5h.js → zh-WrFfMVyM.js} +1 -1
  207. package/dist/assets/{zh-tw-DAvBOrfW.js → zh-tw-CYPf8U5U.js} +1 -1
  208. package/dist/assets/{zh-tw-B-qWW0q8.js → zh-tw-DjWFpq-W.js} +1 -1
  209. package/dist/index.html +1 -1
  210. package/dist/service-worker.js +1 -1
  211. package/package.json +37 -37
  212. package/dist/assets/aigne-SLmG9KvJ.js +0 -10
  213. package/dist/assets/api-rC33aBSs.js +0 -1
  214. package/dist/assets/audit-logs-RI_HNLsi.js +0 -35
  215. package/dist/assets/bind-account-DomcrIoC.js +0 -1
  216. package/dist/assets/branding-CuyMYlwl.js +0 -1
  217. package/dist/assets/button-BmGMF4AE.js +0 -1
  218. package/dist/assets/click-to-copy-CO6UIqva.js +0 -1
  219. package/dist/assets/config-BlJVgRLh.js +0 -53
  220. package/dist/assets/config-navigation-BmFKLKYy.js +0 -40
  221. package/dist/assets/config-space-CIl0FJy6.js +0 -1
  222. package/dist/assets/confirm-nzje1i_c.js +0 -7
  223. package/dist/assets/connect-to-BB7Snd6q.js +0 -1
  224. package/dist/assets/createClass-D_F4rKN8.js +0 -1
  225. package/dist/assets/domains-Dls2DqVC.js +0 -1
  226. package/dist/assets/engine-hb4NRjVe.js +0 -1
  227. package/dist/assets/exchange-passport-5PcjWpqT.js +0 -1
  228. package/dist/assets/get-safe-url-D-OGuIko.js +0 -1
  229. package/dist/assets/index--aKykvS5.js +0 -1
  230. package/dist/assets/index-4905JE5e.js +0 -113
  231. package/dist/assets/index-B6gW9Yjq.js +0 -1
  232. package/dist/assets/index-C-qSsYu-.js +0 -55
  233. package/dist/assets/index-CAQ09npc.js +0 -6
  234. package/dist/assets/index-CfenaAVg.js +0 -7
  235. package/dist/assets/index-D0uQb3TR.js +0 -4
  236. package/dist/assets/index-DccCgoC4.js +0 -1
  237. package/dist/assets/index-Dkx4Mp12.js +0 -1039
  238. package/dist/assets/index-TVXfiYCu.js +0 -29
  239. package/dist/assets/invitations-BkQFdqNe.js +0 -3
  240. package/dist/assets/invite-Bi9qMn-u.js +0 -1
  241. package/dist/assets/issue-passport-CHdu1O5B.js +0 -1
  242. package/dist/assets/landing-page-CjXwLn6s.js +0 -1
  243. package/dist/assets/list-6KE7wBaX.js +0 -103
  244. package/dist/assets/localization-BvU49oVa.js +0 -1
  245. package/dist/assets/logger-DVbuTPin.js +0 -1
  246. package/dist/assets/login-Br-iz4HM.js +0 -1
  247. package/dist/assets/passport-B-GT6j4L.js +0 -1
  248. package/dist/assets/preferences-D3ILj2f_.js +0 -1
  249. package/dist/assets/profile-embed-BFD-Tozn.js +0 -1
  250. package/dist/assets/pt-BJowi6tZ.js +0 -5
  251. package/dist/assets/publish-resource-CV4t0PFh.js +0 -1
  252. package/dist/assets/ru-DTjDV3Pw.js +0 -5
  253. package/dist/assets/runtime-jHV-CQxJ.js +0 -1
  254. package/dist/assets/sdk-CByZ4_g5.js +0 -1
  255. package/dist/assets/session-DsIBYEWF.js +0 -1
  256. package/dist/assets/status-DLtYYu_o.js +0 -1
  257. package/dist/assets/team-geqUb8FM.js +0 -146
  258. package/dist/assets/th-A3GLGlJ1.js +0 -5
  259. package/dist/assets/traffic-DzzcWvVK.js +0 -1
  260. package/dist/assets/unsubscribe-D-R1qemO.js +0 -1
  261. package/dist/assets/user-center-1Ikjxl4_.js +0 -126
  262. package/dist/assets/vendor-utils-CUDP56Ff.js +0 -213
  263. package/dist/assets/vendor-ux-B9VfuZTg.js +0 -1569
  264. package/dist/assets/vi-DGXwnYQW.js +0 -5
  265. package/dist/assets/wrap-locale-vk5eIzsH.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as e,y as Pt,bc as Pe,M as ie,ak as x,Q as H,W as u,J as pe,c1 as Rt,I as $,aN as It,T as I,aj as Tt,b5 as Be,P as Le,b6 as Q,a5 as We,z as Qe,A as Je,ci as At,bh as Mt,U as je,db as zt,dc as Et,at as X,dd as Bt,a6 as Z,n as ae,D as Lt,de as Wt,ar as Oe,b1 as Re,df as Ot,aX as Dt,am as Ce,bq as Nt,br as ye,a$ as $t,cW as Ut}from"./vendor-mui-core-DRxbhqaK.js";import{r as y,a as Ft,u as _t,j as qt}from"./vendor-react-Dvs43sk9.js";import{t as Xe,Z as Ht,a8 as Gt,R as De,D as Kt,C as le,n as V,A as Yt}from"./vendor-utils-CUDP56Ff.js";import{a as Vt,F as Zt,bw as Qt,c as Ie,W as Jt,bx as Xt,aW as Te,U as xe,bd as er,by as tr,a6 as rr,aY as nr,a7 as or,bz as sr}from"./index-Dkx4Mp12.js";import{a as R,h as et,k as ee,g as G,b as B,j as ir}from"./vendor-hooks-BlA8TRnZ.js";import{l as tt}from"./arrow-down.svg-ByD_YKms.js";import{c as Ae,P as O,T as W,aw as ar,k as rt,ax as lr,H as q,ay as cr,az as dr,aA as Ne,f as ur,n as nt,e as Me,aB as pr,aC as M,C as xr,B as fr,$ as ot,aD as hr,aE as gr,A as mr,o as ce,I as $e,j as br,a1 as Ue}from"./vendor-ux-B9VfuZTg.js";import{N as yr}from"./list-6KE7wBaX.js";import{d as vr}from"./search-4YYphs0l.js";import{B as Fe}from"./bundle-avatar-BZh2UMH9.js";import{h as _e,T as wr}from"./team-geqUb8FM.js";import{b as jr,d as Cr,a as Sr,c as kr,e as Pr,f as Rr,h as Ir,_ as Tr}from"./user-center-1Ikjxl4_.js";import{T as qe,O as Ar}from"./index-CAQ09npc.js";import{c as Mr}from"./passport-B-GT6j4L.js";import{N as st,U as it}from"./index-8b6B9BvP.js";import{u as te}from"./use-mobile-D6YQgajG.js";import zr from"./index-v2QpDA9k.js";import{f as J}from"./index-DBs9Ljax.js";import{u as Se}from"./index-DlrQ2HQP.js";import{U as ve}from"./user-sessions-DOAxWAOa.js";import Er from"./index-DM1_TaRl.js";import{o as Br}from"./vendor-arcblock-DeeG8u0h.js";import{c as Lr,b as de,a as Wr,S as Or}from"./index-TVXfiYCu.js";import"./index-Y8LQew4k.js";import"./index-BojVbZw0.js";import{U as Dr}from"./user-follower-B4ZDD-Mm.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-B2RPurN4.js";import"./util-DKVr8C5h.js";import"./base32-BK7MXAD4.js";import"./session-DsIBYEWF.js";import"./isURL-GpP7YPNs.js";import"./use-app-logo-DCgwdb4C.js";import"./index-spmYO3Ab.js";import"./use-mobile-BQQpAf3i.js";import"./actions-B4VXcSRp.js";import"./index-Ba9-ArMT.js";import"./form-text-input-CwOsIY5R.js";import"./required-BT8zXV8U.js";import"./form-wrapper-Dt1iJZge.js";import"./edit.svg-DycWG9v3.js";import"./lock.svg-COUP8tyO.js";import"./index-CVvmswkh.js";import"./permission-uKfC5D9f.js";import"./confirm-nzje1i_c.js";import"./click-to-copy-CO6UIqva.js";import"./invitations-BkQFdqNe.js";import"./create-passport-svg-n0J1kwzH.js";import"./api-rC33aBSs.js";import"./table-tips-rCE1XKlc.js";import"./passport-item-YF9RfQH3.js";import"./did-address-DnFNwELW.js";import"./index-DccCgoC4.js";import"./vendor-mui-x-Qp6zkx78.js";import"./AdapterDayjs-Bp0ir26R.js";import"./delete-confirm-BoyKK_sh.js";import"./index-DRYJ0xIl.js";function Nr(){let t=new Map;function o({root:s,rootMargin:n,threshold:i}){let a=t.get(s);a||(a=new Map,t.set(s,a));let l=JSON.stringify({rootMargin:n,threshold:i}),p=a.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(h=>{r.get(h.target)?.(h)})},{root:s,rootMargin:n,threshold:i}),entryCallbacks:r},a.set(l,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:o}}var $r="0px",Ur=[0],Fr=Nr();function _r(t){let o=t?.rootMargin??$r,s=t?.threshold??Ur,n=y.useRef(null),i=y.useRef(null),a=y.useRef(null),[l,p]=y.useState(),r=y.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Fr.getObserver({root:i.current,rootMargin:o,threshold:s});v.observe(C,c=>{p(c)}),a.current=v},[o,s]),f=y.useCallback(()=>{let C=a.current,v=n.current;v&&C?.unobserve(v),a.current=null},[]),h=y.useCallback(C=>{f(),n.current=C,r()},[r,f]),m=y.useCallback(C=>{f(),i.current=C,r()},[r,f]);return[h,{entry:l,rootRef:m}]}var qr=_r;function Hr(t){let[o,s]=qr(t),n=!!s.entry?.isIntersecting,[i,a]=y.useState(n);return n&&!i&&a(!0),[o,{...s,isVisible:n,wasEverVisible:i}]}var Gr=Hr,Kr=100;function Yr({loading:t,hasNextPage:o,onLoadMore:s,rootMargin:n,disabled:i,delayInMs:a=Kr}){let l=y.useRef(s),[p,{rootRef:r,isVisible:f}]=Gr({rootMargin:n});y.useEffect(()=>{l.current=s},[s]);let h=!i&&!t&&f&&o;return y.useEffect(()=>{if(h){let m=setTimeout(()=>{l.current()},a);return()=>{clearTimeout(m)}}},[h,a]),[p,{rootRef:r}]}var Vr=Yr;const we={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};ue.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function ue({severity:t,size:o=8}){return we[t]?e.jsx(x,{component:"span",sx:{display:"inline-block",width:o,height:o,borderRadius:"50%",backgroundColor:we[t]||we.info}}):null}at.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function at({theme:t="dark",type:o="button",onSelectType:s,extra:n=void 0,currentTab:i="",loading:a=!1,...l}){const{t:p}=y.useContext(Ae),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=g=>{(g!==i||!a)&&s(g)},h=y.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:o==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return o==="line"?Object.assign(g,{}):g},[o,t]),m=(g,S,T)=>e.jsx(H,{disabled:a,onClick:()=>f(g.value),className:`profile-button ${S?"active":""}`,...l,children:g.label},g.value||T),C=(g,S,T)=>e.jsx(H,{variant:"text",disabled:a,onClick:()=>f(g.value),className:`profile-line-button ${S?"active":""}`,...l,children:g.label},g.value||T),v=()=>r?.map((g,S)=>{const T=i===g?.value;return o==="line"?e.jsx(y.Fragment,{children:C(g,T,S)},g.value||S):e.jsx(y.Fragment,{children:m(g,T,S)},g.value||S)}),c=g=>{const{value:S}=g.target;f(S==="all"?"":S)};return o==="select"?e.jsx(Pt,{sx:{maxWidth:300},children:e.jsx(Pe,{value:i||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,S)=>e.jsx(ie,{value:g.value||"all",children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ue,{severity:g.value}),g.label]})},g.value||S))})}):e.jsxs(x,{className:"severity-tabs",sx:h,children:[e.jsx(x,{sx:{...o==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}lt.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function lt({loading:t,paging:o,onChange:s}){const{t:n}=y.useContext(Ae),i=pe(r=>r.breakpoints.down("md"));if(o.pageCount<=0||i)return null;const a=(r,f)=>{s({page:f+1})},l=r=>{const f=Number(r.target.value);s({page:1,pageSize:f})},p=o.page-1<=0?0:o.page-1;return e.jsx(x,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Rt,{component:"div",disabled:t,count:o.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:h})=>`${r}–${f} / ${h!==-1?h:`${n()}more than ${f}`}`,rowsPerPage:o.pageSize,onPageChange:a,onRowsPerPageChange:l})})}const Zr=y.memo(lt),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},He=6,Ge={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Jr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ke=()=>({...Jr,width:"calc(50% - 8px)"});ct.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function ct({onFilterChange:t=()=>{},loading:o=!1,type:s="service",blockletMap:n={},filterType:i="component",selectedId:a=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:h="all"}){const{t:m}=y.useContext(Ae),[C,v]=y.useState(null),c=!!C,[g,S]=y.useState(a),[T,P]=y.useState(l),[b,E]=y.useState(!1),[z,F]=y.useState(""),[N,j]=y.useState([]);y.useEffect(()=>{S(a),P(l)},[a,l]);const k=[{label:m("notification.filterType.all"),value:"all"},{label:m("notification.filterType.unread"),value:"unread"}],D=d=>{(d!==h||!o)&&f(d)},K=[{label:m("notification.severityType.info"),value:"info"},{label:m("notification.severityType.success"),value:"success"},{label:m("notification.severityType.warning"),value:"warning"},{label:m("notification.severityType.error"),value:"error"}],re=d=>{v(d.currentTarget),F(""),E(!1)},he=()=>{v(null)},ne=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];S(w),t({id:w,severity:T})},oe=d=>{const w=T.includes(d)?T.filter(A=>A!==d):[...T,d];P(w),t({severity:w,id:g})},ge=d=>{F(d.target.value)},me=()=>{E(!b)},Y=Ft.useMemo(()=>{if(!n.size)return[];const d=[];return i==="component"&&d.push({label:m("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,L=w.title||w.meta?.title||"",_=w.appPid||w.appDid;(i==="component"&&_!==A||i==="entity"&&_===A)&&d.push({label:L,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,i,m]);y.useEffect(()=>{if(z.trim()==="")j(Y);else{const d=z.toLowerCase(),w=Y.filter(A=>A.label.toLowerCase().includes(d));j(w)}},[z,Y]);const be=z.trim()!==""||b?N:N.slice(0,He);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:k.map(d=>e.jsxs(H,{disabled:o,onClick:()=>D(d.value),className:`profile-button ${h===d.value?"active":""}`,sx:{...s==="service"&&h===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:h===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx($,{size:"small",onClick:re,disabled:o,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(O,{icon:Qr,hFlip:!0})}),e.jsx(It,{open:c,anchorEl:C,onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:m("notification.severity")}),e.jsx(x,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||T.length>0)&&e.jsx(H,{size:"small",onClick:()=>{S([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Tt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:m("notification.clear")})})]}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:K.map(d=>e.jsx(Le,{elevation:0,sx:Ke(T.includes(d.value)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Ge},control:e.jsx(We,{checked:T.includes(d.value),onChange:()=>oe(d.value),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(ue,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(x,{sx:{mb:2},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:m("notification.from")}),e.jsx(x,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Qe,{size:"small",placeholder:"search",value:z,onChange:ge,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Je,{position:"start",sx:{marginRight:"2px"},children:e.jsx(O,{icon:vr})})}}})})]}),e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Le,{elevation:0,sx:Ke(g.includes(d.id)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Ge},control:e.jsx(We,{checked:g.includes(d.id),onChange:()=>ne(d.id),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(Fe,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),N.length>He&&z.trim()===""&&e.jsx(H,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(At,{}):e.jsx(Mt,{})})]})]})})]})]}),g.length>0||T.length>0?e.jsxs(x,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[T.map(d=>{const w=K.find(A=>A.value===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(ue,{severity:d}),w?w.label:d]}),onDelete:()=>oe(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=Y.find(A=>A.id===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(Fe,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>ne(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Xr=X(Bt)`
1
+ import{j as e,y as Pt,bc as Pe,M as ie,ak as x,Q as H,W as u,J as pe,c1 as Rt,I as $,aN as It,T as I,aj as Tt,b5 as Le,P as Be,b6 as Q,a5 as We,z as Qe,A as Je,ci as At,bh as Mt,U as je,d9 as zt,da as Et,at as X,db as Lt,a6 as Z,n as ae,D as Bt,dc as Wt,ar as Oe,b1 as Re,dd as Ot,aX as Dt,am as Ce,bq as Nt,br as ye,a$ as $t,cW as Ft}from"./vendor-mui-core-BFPsXaTR.js";import{r as y,a as Ut,u as _t,j as qt}from"./vendor-react-Dvs43sk9.js";import{t as Xe,Z as Ht,a6 as Gt,R as De,D as Kt,C as le,n as V,A as Yt}from"./vendor-utils-OrZFrHBP.js";import{a as Vt,F as Zt,bu as Qt,c as Ie,Y as Jt,bv as Xt,aX as Te,W as xe,bg as er,bw as tr,a8 as rr,aZ as nr,a9 as or,bx as sr}from"./index-CmM1Fb8I.js";import{a as R,h as et,k as ee,g as G,b as L,j as ir}from"./vendor-hooks-DmThWyyG.js";import{l as tt}from"./arrow-down.svg-zOZF6XLO.js";import{s as Ae,a2 as O,V as W,aB as ar,z as rt,aC as lr,H as q,aD as cr,aE as dr,aF as Ne,v as ur,p as nt,u as Me,aG as pr,aH as M,O as xr,K as fr,$ as ot,aI as hr,aJ as gr,J as mr,o as ce,U as $e,x as br,a9 as Fe}from"./vendor-ux-CE4sOH7O.js";import{N as yr}from"./list-CpdSyVlo.js";import{d as vr}from"./search-4YYphs0l.js";import{B as Ue}from"./bundle-avatar-CRBdm-Kg.js";import{h as _e,T as wr}from"./team-DK_N0J3a.js";import{b as jr,d as Cr,a as Sr,c as kr,e as Pr,f as Rr,h as Ir,O as Tr}from"./user-center-BcjjuRmk.js";import{T as qe,O as Ar}from"./index-BV58Bk4h.js";import{c as Mr}from"./passport-B2fL-0uN.js";import{N as st,U as it}from"./index-xrCVFXc_.js";import{u as te}from"./use-mobile-Db5FIl07.js";import zr from"./index-J-Fwoozx.js";import{f as J}from"./index-DBs9Ljax.js";import{u as Se}from"./index-DlRa8Zeh.js";import{U as ve}from"./user-sessions-Bv46aXrx.js";import Er from"./index-Bsziwsc_.js";import{o as Lr}from"./vendor-arcblock-DGOH9a3F.js";import{c as Br,b as de,a as Wr,S as Or}from"./index-CWoGXO4Z.js";import"./index-Cd_Gml9C.js";import"./index-BojVbZw0.js";import{U as Dr}from"./user-follower-DgAPhBY5.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-DACE9NO5.js";import"./util-CxUMQb4N.js";import"./base32-Cg02gOuu.js";import"./session-BtQQCb_u.js";import"./isURL-DAY9MZJJ.js";import"./use-app-logo-BKyiSzxV.js";import"./index-3gh3KcSo.js";import"./use-mobile-DLnLSQQq.js";import"./actions-C4-lIUPY.js";import"./index-IGBGBXd_.js";import"./form-text-input-AIMlcRaM.js";import"./required-BPzIdi1N.js";import"./form-wrapper-DINLdpTN.js";import"./edit.svg-DycWG9v3.js";import"./lock.svg-COUP8tyO.js";import"./index-D2x0prGU.js";import"./permission-B7_8SVB9.js";import"./confirm-DAMhAYR3.js";import"./click-to-copy-CK42VmRr.js";import"./invitations-D0twFHTb.js";import"./create-passport-svg-BsR3hKFq.js";import"./api-txzyyizM.js";import"./table-tips-BMq3WO_p.js";import"./passport-item-L7acCYqJ.js";import"./did-address-BQL5Zxlr.js";import"./index-CeTnfded.js";import"./vendor-mui-x-C6iZOJbV.js";import"./AdapterDayjs-DyE9ImrK.js";import"./delete-confirm-Ca3miSFM.js";import"./index-DRYJ0xIl.js";function Nr(){let t=new Map;function o({root:s,rootMargin:n,threshold:i}){let a=t.get(s);a||(a=new Map,t.set(s,a));let l=JSON.stringify({rootMargin:n,threshold:i}),p=a.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(h=>{r.get(h.target)?.(h)})},{root:s,rootMargin:n,threshold:i}),entryCallbacks:r},a.set(l,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:o}}var $r="0px",Fr=[0],Ur=Nr();function _r(t){let o=t?.rootMargin??$r,s=t?.threshold??Fr,n=y.useRef(null),i=y.useRef(null),a=y.useRef(null),[l,p]=y.useState(),r=y.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Ur.getObserver({root:i.current,rootMargin:o,threshold:s});v.observe(C,c=>{p(c)}),a.current=v},[o,s]),f=y.useCallback(()=>{let C=a.current,v=n.current;v&&C?.unobserve(v),a.current=null},[]),h=y.useCallback(C=>{f(),n.current=C,r()},[r,f]),m=y.useCallback(C=>{f(),i.current=C,r()},[r,f]);return[h,{entry:l,rootRef:m}]}var qr=_r;function Hr(t){let[o,s]=qr(t),n=!!s.entry?.isIntersecting,[i,a]=y.useState(n);return n&&!i&&a(!0),[o,{...s,isVisible:n,wasEverVisible:i}]}var Gr=Hr,Kr=100;function Yr({loading:t,hasNextPage:o,onLoadMore:s,rootMargin:n,disabled:i,delayInMs:a=Kr}){let l=y.useRef(s),[p,{rootRef:r,isVisible:f}]=Gr({rootMargin:n});y.useEffect(()=>{l.current=s},[s]);let h=!i&&!t&&f&&o;return y.useEffect(()=>{if(h){let m=setTimeout(()=>{l.current()},a);return()=>{clearTimeout(m)}}},[h,a]),[p,{rootRef:r}]}var Vr=Yr;const we={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};ue.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function ue({severity:t,size:o=8}){return we[t]?e.jsx(x,{component:"span",sx:{display:"inline-block",width:o,height:o,borderRadius:"50%",backgroundColor:we[t]||we.info}}):null}at.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function at({theme:t="dark",type:o="button",onSelectType:s,extra:n=void 0,currentTab:i="",loading:a=!1,...l}){const{t:p}=y.useContext(Ae),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=g=>{(g!==i||!a)&&s(g)},h=y.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:o==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return o==="line"?Object.assign(g,{}):g},[o,t]),m=(g,S,T)=>e.jsx(H,{disabled:a,onClick:()=>f(g.value),className:`profile-button ${S?"active":""}`,...l,children:g.label},g.value||T),C=(g,S,T)=>e.jsx(H,{variant:"text",disabled:a,onClick:()=>f(g.value),className:`profile-line-button ${S?"active":""}`,...l,children:g.label},g.value||T),v=()=>r?.map((g,S)=>{const T=i===g?.value;return o==="line"?e.jsx(y.Fragment,{children:C(g,T,S)},g.value||S):e.jsx(y.Fragment,{children:m(g,T,S)},g.value||S)}),c=g=>{const{value:S}=g.target;f(S==="all"?"":S)};return o==="select"?e.jsx(Pt,{sx:{maxWidth:300},children:e.jsx(Pe,{value:i||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,S)=>e.jsx(ie,{value:g.value||"all",children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ue,{severity:g.value}),g.label]})},g.value||S))})}):e.jsxs(x,{className:"severity-tabs",sx:h,children:[e.jsx(x,{sx:{...o==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}lt.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function lt({loading:t,paging:o,onChange:s}){const{t:n}=y.useContext(Ae),i=pe(r=>r.breakpoints.down("md"));if(o.pageCount<=0||i)return null;const a=(r,f)=>{s({page:f+1})},l=r=>{const f=Number(r.target.value);s({page:1,pageSize:f})},p=o.page-1<=0?0:o.page-1;return e.jsx(x,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Rt,{component:"div",disabled:t,count:o.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:h})=>`${r}–${f} / ${h!==-1?h:`${n()}more than ${f}`}`,rowsPerPage:o.pageSize,onPageChange:a,onRowsPerPageChange:l})})}const Zr=y.memo(lt),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},He=6,Ge={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Jr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ke=()=>({...Jr,width:"calc(50% - 8px)"});ct.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function ct({onFilterChange:t=()=>{},loading:o=!1,type:s="service",blockletMap:n={},filterType:i="component",selectedId:a=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:h="all"}){const{t:m}=y.useContext(Ae),[C,v]=y.useState(null),c=!!C,[g,S]=y.useState(a),[T,P]=y.useState(l),[b,E]=y.useState(!1),[z,U]=y.useState(""),[N,j]=y.useState([]);y.useEffect(()=>{S(a),P(l)},[a,l]);const k=[{label:m("notification.filterType.all"),value:"all"},{label:m("notification.filterType.unread"),value:"unread"}],D=d=>{(d!==h||!o)&&f(d)},K=[{label:m("notification.severityType.info"),value:"info"},{label:m("notification.severityType.success"),value:"success"},{label:m("notification.severityType.warning"),value:"warning"},{label:m("notification.severityType.error"),value:"error"}],re=d=>{v(d.currentTarget),U(""),E(!1)},he=()=>{v(null)},ne=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];S(w),t({id:w,severity:T})},oe=d=>{const w=T.includes(d)?T.filter(A=>A!==d):[...T,d];P(w),t({severity:w,id:g})},ge=d=>{U(d.target.value)},me=()=>{E(!b)},Y=Ut.useMemo(()=>{if(!n.size)return[];const d=[];return i==="component"&&d.push({label:m("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,B=w.title||w.meta?.title||"",_=w.appPid||w.appDid;(i==="component"&&_!==A||i==="entity"&&_===A)&&d.push({label:B,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,i,m]);y.useEffect(()=>{if(z.trim()==="")j(Y);else{const d=z.toLowerCase(),w=Y.filter(A=>A.label.toLowerCase().includes(d));j(w)}},[z,Y]);const be=z.trim()!==""||b?N:N.slice(0,He);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:k.map(d=>e.jsxs(H,{disabled:o,onClick:()=>D(d.value),className:`profile-button ${h===d.value?"active":""}`,sx:{...s==="service"&&h===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:h===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx($,{size:"small",onClick:re,disabled:o,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(O,{icon:Qr,hFlip:!0})}),e.jsx(It,{open:c,anchorEl:C,onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:m("notification.severity")}),e.jsx(x,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||T.length>0)&&e.jsx(H,{size:"small",onClick:()=>{S([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Tt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:m("notification.clear")})})]}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Le,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:K.map(d=>e.jsx(Be,{elevation:0,sx:Ke(T.includes(d.value)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Ge},control:e.jsx(We,{checked:T.includes(d.value),onChange:()=>oe(d.value),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(ue,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(x,{sx:{mb:2},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:m("notification.from")}),e.jsx(x,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Qe,{size:"small",placeholder:"search",value:z,onChange:ge,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Je,{position:"start",sx:{marginRight:"2px"},children:e.jsx(O,{icon:vr})})}}})})]}),e.jsx(Le,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Be,{elevation:0,sx:Ke(g.includes(d.id)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Ge},control:e.jsx(We,{checked:g.includes(d.id),onChange:()=>ne(d.id),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(Ue,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),N.length>He&&z.trim()===""&&e.jsx(H,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(At,{}):e.jsx(Mt,{})})]})]})})]})]}),g.length>0||T.length>0?e.jsxs(x,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[T.map(d=>{const w=K.find(A=>A.value===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(ue,{severity:d}),w?w.label:d]}),onDelete:()=>oe(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=Y.find(A=>A.id===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(Ue,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>ne(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Xr=X(Lt)`
2
2
  position: fixed;
3
3
  bottom: 20px;
4
4
  right: 20px;
@@ -73,7 +73,7 @@ import{j as e,y as Pt,bc as Pe,M as ie,ak as x,Q as H,W as u,J as pe,c1 as Rt,I
73
73
  *::-webkit-scrollbar {
74
74
  display: none; /* Chrome, Safari and Opera */
75
75
  }
76
- `;dt.propTypes={blocklets:u.array,context:u.object,pagination:u.bool,inDialog:u.bool,filterType:u.oneOf(["component","entity"]),toViewAll:u.func,type:u.oneOf(["server","service"])};function dt({blocklets:t=[],context:o,pagination:s=!0,inDialog:n=!1,filterType:i="component",toViewAll:a=()=>{},type:l="service"}){const{data:p,paging:r,refresh:f,loading:h,params:m,onReadNotification:C,componentDids:v,filterUnReadCount:c,initial:g}=o,S=d=>{f({...m,severity:d&&typeof d=="string"?[d]:d||[],paging:{...m.paging,page:1}})},[T]=_t(),P=R(()=>T.get("id"),[T]),b=pe(d=>d.breakpoints.down("md")),[E,z]=y.useState(0),[F,N]=y.useState(!1),j=y.useMemo(()=>m.read===!1?"unread":"all",[m.read]),k=R(()=>Xe(d=>{if(h)return;const w=p.length,A=p.filter(_=>!_e(_)).length;let L={...m,append:!0,paging:{...m.paging,...d,currentPage:(r.currentPage||0)+1}};j==="unread"&&A<w&&d.page>m.paging.page&&(L={...m,append:!0,paging:{...m.paging,...d,page:m.paging.page||1,currentPage:(r.currentPage||0)+1}}),f(L)},500),[p,m,j,r,h,f]);et(()=>{g&&typeof g=="function"&&g()}),y.useEffect(()=>{(!r.currentPage||r.currentPage===1)&&z(r.total)},[r.total,r.currentPage]),y.useEffect(()=>{setTimeout(()=>{const d=document.getElementById(P);d&&d.scrollIntoView({behavior:"smooth",block:"center"}),N(!0)},100),setTimeout(()=>{N(!1)},3e3)},[P]);const D=R(()=>p?.length>0&&p.length<E,[p,E]),K=y.useCallback(d=>{const{blocklet:w={}}=window,A=[w?.did,...(w?.ancestors||[]).map(L=>L)];return v?.includes(d)||A.findIndex(L=>L===d)>-1},[v]),re=y.useMemo(()=>{const d=new Map;return t.length&&t.forEach(w=>{const A=w?.did||w.meta?.did;A&&!d.has(A)&&(w.ancestors=[],d.set(A,w),w?.alsoKnownAs?.length>0&&w.alsoKnownAs.forEach(L=>{d.has(L)||d.set(L,w)})),w?.children?.length>0&&w.children.forEach(L=>{const _=L?.did||L.meta?.did;_&&!d.has(_)&&K(_)&&(L.ancestors=[w],d.set(_,L))})}),d},[t,K]),he=y.useCallback(()=>{h||k({page:r.page+1})},[r.page,h,k]),[ne]=Vr({loading:h,hasNextPage:D,onLoadMore:he}),oe=d=>{!d||_e(d)||C(d.id).then(()=>{n&&a()})},ge=({severity:d,id:w})=>{if(h)return;let A={};i==="component"?A={entityId:[],componentDid:w}:i==="entity"&&(A={componentDid:[],entityId:w}),f({...m,severity:d,...A,paging:{...m.paging,page:1}})},me=d=>{if(h)return;let w={...m,paging:{...m.paging,page:1}};d==="unread"?(w.read=!1,w.paging.currentPage=1):w=Ht(w,"read"),f(w)},Y=R(()=>i==="component"?Array.isArray(m.componentDid)?m.componentDid:[]:i==="entity"?Array.isArray(m.entityId)?m.entityId:[]:[],[m,i]),be=R(()=>(Array.isArray(m.severity)?m.severity:[])[0]||"",[m.severity]);return e.jsxs(tn,{inDialog:!!n,children:[n?e.jsx(at,{currentTab:be,type:"line",theme:"light",onSelectType:S}):e.jsx(ct,{loading:h,blockletMap:re,unReadCount:c,filterType:i,type:l,selectedId:Y,onFilterChange:ge,severity:m.severity,onReadFilterChange:me,currentReadFilter:j}),!b&&h?e.jsx(x,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(Z,{})}):e.jsx(yr,{data:p,blockletMap:re,onReadNotification:oe,onReadBatch:C,inDialog:n,highlightId:P,highlight:!n&&F,type:l}),s&&!b?e.jsx(Zr,{loading:h,paging:r,onChange:k}):null,s&&b&&(h||D)?e.jsx(x,{ref:ne,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(Z,{})}):null,!n&&b?e.jsx(en,{}):null]})}const rn=y.memo(dt),U=new Qt;function fe(t){const{userDid:o=""}={},{session:s}=Vt(),n=R(()=>{if(o)return o;const r=window.location.href,f=Gt(r);return f?.did?Array.isArray(f.did)?f.did[0]:f.did:s?.user?.did},[s?.user?.did,o]),i=R(()=>s.user,[s]),a=R(()=>i?n===i?.did:!1,[n,i?.did]),l=ee(async()=>{if(await Zt(()=>s?.initialized),a)return s.user;if(n)return U.user.getUserPublicInfo({did:n})},{refreshDeps:[n,a,s?.initialized,i]}),p=R(()=>i.passports?.some(r=>r.role===Ie.ROLES.OWNER),[i]);return{currentDid:n,session:s,isMyself:a,user:i,viewUser:l.data,isOwner:p}}function ut({user:t,...o}){const{t:s}=W(),n=Lt(),i=R(()=>{const p=(t?.passports||[]).map(r=>({...r,revoked:r.status===ar.REVOKED}));return p.sort((r,f)=>r.revoked===f.revoked?0:r.revoked?1:-1),De(p.filter(r=>!r.display),"role").concat(De(p.filter(r=>r.display),"display.content"))},[t?.passports]),a=R(()=>i?.find(p=>p.name===t.role),[i,t?.role]),l=n.palette.primary.main;return i.length===0?e.jsx(x,{children:e.jsx(rt,{children:s("userCenter.noPassport")})}):e.jsx(x,{...o,sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5,...o.sx},children:i.map(p=>e.jsx(jr,{passport:p,user:t,color:window.blocklet.passportColor,createPassportSvg:Mr,title:a&&a.role===p.role?s("userCenter.currentPassport"):"",sx:{flexDirection:"column",alignItems:"center",gap:1,".passport-item__display":{width:166,height:166,borderRadius:1,px:2,display:"flex",justifyContent:"center",backgroundColor:"grey.50",boxShadow:a&&a.role===p.role?`0px 2px 4px 0px ${l}, 0px 1px 2px -1px ${l}, 0px 0px 0px 1px ${l} !important`:"unset"},".passport-item__body":{marginLeft:"0 !important"}}},p.id))})}ut.propTypes={user:u.object.isRequired};function nn({visible:t,onClose:o,nft:s}){return!t||!s?null:e.jsx(on,{children:e.jsx(Wt,{open:t,onClose:o,children:e.jsx(sn,{onClick:o,children:e.jsx(st,{data:it(s),address:s.address,inset:!0})})})})}const on=X.div`
76
+ `;dt.propTypes={blocklets:u.array,context:u.object,pagination:u.bool,inDialog:u.bool,filterType:u.oneOf(["component","entity"]),toViewAll:u.func,type:u.oneOf(["server","service"])};function dt({blocklets:t=[],context:o,pagination:s=!0,inDialog:n=!1,filterType:i="component",toViewAll:a=()=>{},type:l="service"}){const{data:p,paging:r,refresh:f,loading:h,params:m,onReadNotification:C,componentDids:v,filterUnReadCount:c,initial:g}=o,S=d=>{f({...m,severity:d&&typeof d=="string"?[d]:d||[],paging:{...m.paging,page:1}})},[T]=_t(),P=R(()=>T.get("id"),[T]),b=pe(d=>d.breakpoints.down("md")),[E,z]=y.useState(0),[U,N]=y.useState(!1),j=y.useMemo(()=>m.read===!1?"unread":"all",[m.read]),k=R(()=>Xe(d=>{if(h)return;const w=p.length,A=p.filter(_=>!_e(_)).length;let B={...m,append:!0,paging:{...m.paging,...d,currentPage:(r.currentPage||0)+1}};j==="unread"&&A<w&&d.page>m.paging.page&&(B={...m,append:!0,paging:{...m.paging,...d,page:m.paging.page||1,currentPage:(r.currentPage||0)+1}}),f(B)},500),[p,m,j,r,h,f]);et(()=>{g&&typeof g=="function"&&g()}),y.useEffect(()=>{(!r.currentPage||r.currentPage===1)&&z(r.total)},[r.total,r.currentPage]),y.useEffect(()=>{setTimeout(()=>{const d=document.getElementById(P);d&&d.scrollIntoView({behavior:"smooth",block:"center"}),N(!0)},100),setTimeout(()=>{N(!1)},3e3)},[P]);const D=R(()=>p?.length>0&&p.length<E,[p,E]),K=y.useCallback(d=>{const{blocklet:w={}}=window,A=[w?.did,...(w?.ancestors||[]).map(B=>B)];return v?.includes(d)||A.findIndex(B=>B===d)>-1},[v]),re=y.useMemo(()=>{const d=new Map;return t.length&&t.forEach(w=>{const A=w?.did||w.meta?.did;A&&!d.has(A)&&(w.ancestors=[],d.set(A,w),w?.alsoKnownAs?.length>0&&w.alsoKnownAs.forEach(B=>{d.has(B)||d.set(B,w)})),w?.children?.length>0&&w.children.forEach(B=>{const _=B?.did||B.meta?.did;_&&!d.has(_)&&K(_)&&(B.ancestors=[w],d.set(_,B))})}),d},[t,K]),he=y.useCallback(()=>{h||k({page:r.page+1})},[r.page,h,k]),[ne]=Vr({loading:h,hasNextPage:D,onLoadMore:he}),oe=d=>{!d||_e(d)||C(d.id).then(()=>{n&&a()})},ge=({severity:d,id:w})=>{if(h)return;let A={};i==="component"?A={entityId:[],componentDid:w}:i==="entity"&&(A={componentDid:[],entityId:w}),f({...m,severity:d,...A,paging:{...m.paging,page:1}})},me=d=>{if(h)return;let w={...m,paging:{...m.paging,page:1}};d==="unread"?(w.read=!1,w.paging.currentPage=1):w=Ht(w,"read"),f(w)},Y=R(()=>i==="component"?Array.isArray(m.componentDid)?m.componentDid:[]:i==="entity"?Array.isArray(m.entityId)?m.entityId:[]:[],[m,i]),be=R(()=>(Array.isArray(m.severity)?m.severity:[])[0]||"",[m.severity]);return e.jsxs(tn,{inDialog:!!n,children:[n?e.jsx(at,{currentTab:be,type:"line",theme:"light",onSelectType:S}):e.jsx(ct,{loading:h,blockletMap:re,unReadCount:c,filterType:i,type:l,selectedId:Y,onFilterChange:ge,severity:m.severity,onReadFilterChange:me,currentReadFilter:j}),!b&&h?e.jsx(x,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(Z,{})}):e.jsx(yr,{data:p,blockletMap:re,onReadNotification:oe,onReadBatch:C,inDialog:n,highlightId:P,highlight:!n&&U,type:l}),s&&!b?e.jsx(Zr,{loading:h,paging:r,onChange:k}):null,s&&b&&(h||D)?e.jsx(x,{ref:ne,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(Z,{})}):null,!n&&b?e.jsx(en,{}):null]})}const rn=y.memo(dt),F=new Qt;function fe(t){const{userDid:o=""}={},{session:s}=Vt(),n=R(()=>{if(o)return o;const r=window.location.href,f=Gt(r);return f?.did?Array.isArray(f.did)?f.did[0]:f.did:s?.user?.did},[s?.user?.did,o]),i=R(()=>s.user,[s]),a=R(()=>i?n===i?.did:!1,[n,i?.did]),l=ee(async()=>{if(await Zt(()=>s?.initialized),a)return s.user;if(n)return F.user.getUserPublicInfo({did:n})},{refreshDeps:[n,a,s?.initialized,i]}),p=R(()=>i.passports?.some(r=>r.role===Ie.ROLES.OWNER),[i]);return{currentDid:n,session:s,isMyself:a,user:i,viewUser:l.data,isOwner:p}}function ut({user:t,...o}){const{t:s}=W(),n=Bt(),i=R(()=>{const p=(t?.passports||[]).map(r=>({...r,revoked:r.status===ar.REVOKED}));return p.sort((r,f)=>r.revoked===f.revoked?0:r.revoked?1:-1),De(p.filter(r=>!r.display),"role").concat(De(p.filter(r=>r.display),"display.content"))},[t?.passports]),a=R(()=>i?.find(p=>p.name===t.role),[i,t?.role]),l=n.palette.primary.main;return i.length===0?e.jsx(x,{children:e.jsx(rt,{children:s("userCenter.noPassport")})}):e.jsx(x,{...o,sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5,...o.sx},children:i.map(p=>e.jsx(jr,{passport:p,user:t,color:window.blocklet.passportColor,createPassportSvg:Mr,title:a&&a.role===p.role?s("userCenter.currentPassport"):"",sx:{flexDirection:"column",alignItems:"center",gap:1,".passport-item__display":{width:166,height:166,borderRadius:1,px:2,display:"flex",justifyContent:"center",backgroundColor:"grey.50",boxShadow:a&&a.role===p.role?`0px 2px 4px 0px ${l}, 0px 1px 2px -1px ${l}, 0px 0px 0px 1px ${l} !important`:"unset"},".passport-item__body":{marginLeft:"0 !important"}}},p.id))})}ut.propTypes={user:u.object.isRequired};function nn({visible:t,onClose:o,nft:s}){return!t||!s?null:e.jsx(on,{children:e.jsx(Wt,{open:t,onClose:o,children:e.jsx(sn,{onClick:o,children:e.jsx(st,{data:it(s),address:s.address,inset:!0})})})})}const on=X.div`
77
77
  position: relative;
78
78
  width: 100%;
79
79
  height: 100%;
@@ -118,7 +118,7 @@ import{j as e,y as Pt,bc as Pe,M as ie,ak as x,Q as H,W as u,J as pe,c1 as Rt,I
118
118
  height: 75vmin;
119
119
  }
120
120
  }
121
- `,an=t=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:ae(t.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:ae(t.palette.background.paper,1)}}}),ln={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},Ye="https://main.abtnetwork.io/explorer";function pt({user:t}){const{t:o}=W(),s=te(),[n,i]=y.useState({visible:!1,nft:null}),[a,l]=y.useState({anchorEl:null,props:null}),p=P=>{const b=le(Ye,"assets",P);window.open(b,"_blank")},r=(P,b)=>{let E="";typeof b.data?.value=="string"?E=JSON.parse(b.data?.value)?.domain:E=b.data?.value?.domain,l({anchorEl:P,props:{title:E?`Hey, I just won an NFT at the ${E} event!`:"Hey, I just won an NFT!",url:le(Ye,"assets",b.address)}})},f=P=>{i({visible:!0,nft:P})},h=G({page:1,size:20}),m=ee(async(P=h)=>(await Kt.get(`${Ie.WELLKNOWN_SERVICE_PATH_PREFIX}/ocap/listAssets`,{params:{ownerAddress:t.did,...P}})).data,{ready:t?.did&&h,defaultParams:[h],refreshDeps:[t?.did,h]}),{loading:C,data:v}=m,c=v?.page??{cursor:0,next:!1,total:0},g=(P,b)=>{h.page=b,m.run(h)},S=B(P=>[e.jsx($,{size:"small",className:"mask-item",onClick:b=>{b.stopPropagation(),p(P.address)},children:e.jsx(O,{icon:"tabler:link",fontSize:18})},"link"),e.jsx($,{size:"small",onClick:b=>{b.stopPropagation(),r(b.currentTarget,P)},className:"mask-item",children:e.jsx(O,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx($,{size:"small",onClick:b=>{b.stopPropagation(),f(P)},className:"mask-item",children:e.jsx(O,{icon:"tabler:eye",fontSize:18})},"view")]),T=R(()=>{if(C){const P=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(b=>e.jsx(Oe,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},b));return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(Oe,{width:"20%"}),e.jsx(x,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:P})]})}return e.jsxs(e.Fragment,{children:[e.jsx(I,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:o("userCenter.common.nft")}),v?.assets?.length===0&&!C&&e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(rt,{children:o("userCenter.common.noNFT")})}),e.jsx(x,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:v?.assets?.map(P=>e.jsxs(x,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...s?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(st,{data:it(P),address:P.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),s?e.jsx(x,{className:"footer-mask",sx:ln,children:S(P)}):e.jsx(x,{className:"mask",sx:an,children:e.jsx(Re,{direction:"row",spacing:1,children:S(P)})})]},P.address))}),c.next||h.page>1?e.jsx(Ot,{sx:{display:"flex",justifyContent:"center",mt:2},page:h.page,onChange:g,count:Math.ceil(c.total/h.size),size:"small"}):null,e.jsx(nn,{visible:n.visible&&!!n.nft,nft:n.nft,onClose:()=>{i({visible:!1,nft:null})}}),e.jsx(lr,{anchorEl:a.anchorEl,onClose:()=>{l({anchorEl:null,props:null})},sharedProps:a.props||{title:"",url:""}})]})},[C,c,h.page,h.size,g,a,n]);return e.jsx(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:T})}pt.propTypes={user:u.object.isRequired};function cn(){const{t}=W(),{user:o,isMyself:s,viewUser:n}=fe();return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[s?e.jsxs(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:t("userCenter.passport")}),e.jsx(ut,{user:o})]}):null,e.jsx(pt,{user:s?o:n})]})}const dn=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function xt({user:t,onSave:o}){const{t:s,changeLocale:n}=W(),i=G({locale:t.locale,loading:!1}),a=B(async l=>{try{const{value:p}=l.target;i.loading=!0,await U.user.saveProfile({locale:p}),await o("profile"),n(p),i.locale=p}catch(p){q.error(J(p))}finally{i.loading=!1}});return e.jsxs(x,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(x,{children:s("userCenter.commonSetting.locale")}),e.jsx(x,{children:e.jsx(Pe,{value:i.locale,onChange:a,size:"small",IconComponent:l=>e.jsx(tt,{...l,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||dn).map(l=>e.jsx(ie,{value:l.code,children:l.name},l.code))})})]})}xt.propTypes={user:u.shape({locale:u.string}).isRequired,onSave:u.func.isRequired};function ke({onTest:t=V,onDelete:o=V,onSave:s=V,onCancel:n=V,type:i="slack",url:a="",edit:l=!1}){const{t:p}=W(),r=G({type:i||"slack",url:a||"",edit:l??!1,error:"",loading:!1}),f=B(()=>r.url?Jt(r.url)?(r.error="",!0):(r.error=p("common.invalid"),!1):(r.error=p("common.required"),!1)),h=B(()=>{r.edit=!1,r.url=a||"",r.type=i||"slack",r.error="",r.loading=!1,n()}),m=B(async c=>{r.loading=!0,await t(c),r.loading=!1}),C=B(c=>()=>{f()&&c({type:r.type,url:r.url})}),v=R(()=>r.error?e.jsx(I,{component:"span",color:"error",children:r.error}):r.edit?r.loading?e.jsx(Z,{size:16}):e.jsx($,{size:"small",onClick:C(m),sx:{mr:-1},children:e.jsx(O,{icon:Cr})}):null,[r.error,r.edit,r.loading]);return e.jsxs(x,{sx:{display:"flex",gap:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(Pe,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!r.edit||r.loading,size:"small",value:r.type,onChange:c=>{r.type=c.target.value},children:[e.jsx(ie,{value:"api",children:p("userCenter.webhook.url")}),e.jsx(ie,{value:"slack",children:p("userCenter.webhook.slack")})]}),e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Qe,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!r.edit||r.loading,fullWidth:!0,size:"small",required:!0,value:r.url,onChange:c=>{r.url=c.target.value,f()},error:!!r.error,slotProps:{input:{endAdornment:e.jsx(Je,{position:"end",children:v})}}}),e.jsx(x,{sx:{display:"flex",gap:.5},children:r.edit?e.jsxs(e.Fragment,{children:[e.jsx($,{color:"success",onClick:C((...c)=>{s(...c),r.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:cr})}),e.jsx($,{color:"error",onClick:h,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:dr})})]}):e.jsxs(e.Fragment,{children:[e.jsx($,{onClick:()=>{r.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:Sr})}),e.jsx($,{color:"error",onClick:()=>{o({type:r.type,url:r.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:kr})})]})})]})]})}ke.propTypes={onTest:u.func,onDelete:u.func,onSave:u.func,onCancel:u.func,type:u.oneOf(["api","slack"]),url:u.string,edit:u.bool};function se({title:t=void 0,description:o=void 0,value:s,onChange:n,isMobile:i}){const a=B(l=>{l.stopPropagation()});return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Se,{checked:s,size:"small",onChange:n}),e.jsxs(I,{component:"div",onClick:a,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:i?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:i?"normal":"nowrap"},children:[t,o]})]})}se.propTypes={title:u.string,description:u.node,value:u.bool.isRequired,onChange:u.func.isRequired,isMobile:u.bool.isRequired};function ft({user:t,isMobile:o}){const{t:s}=W(),n=G({showAdd:!1}),i=ee(async()=>await U.user.getUserNotificationConfig(),{refreshDeps:[t],loadingDelay:300}),a=R(()=>({wallet:!0,email:!0,phone:!1,push:!0,...i?.data?.notifications||{}}),[i?.data?.notifications]),l=R(()=>i?.data?.webhooks||[],[i?.data?.webhooks]),p=B(async v=>{try{await U.user.saveUserNotificationConfig(v),q.success(s("userCenter.saveSuccess")),i.run()}catch(c){q.error(J(c))}}),r=B(async(v,c)=>{await p({notifications:{[v]:c}})}),f=async v=>{try{await U.user.testNotificationWebhook(v),q.success(s("userCenter.webhookTested"))}catch(c){q.error(J(c))}},h=B(async v=>{await p({webhooks:l.filter((c,g)=>g!==v)})}),m=B(async(v,c)=>{await p({webhooks:l.map((g,S)=>S===v?c:g)})}),C=B(async v=>{await p({webhooks:[...l,v]}),n.showAdd=!1});return i.error?e.jsx(Dt,{severity:"error",children:i.error.message}):i.loading||!i.data?e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(Z,{})}):e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsx(se,{value:a.wallet,isMobile:o,title:s("userCenter.walletNotification"),onChange:v=>r("wallet",v.target.checked),description:Ne(t)&&e.jsx(ur,{did:Ne(t),showQrcode:!1,showAvatar:!o,copyable:!0,compact:!0,responsive:!0,startChars:o?2:6})}),e.jsx(se,{value:a.email,isMobile:o,onChange:v=>r("email",v.target.checked),title:s("userCenter.emailNotification"),description:t?.email&&e.jsx(I,{component:"span",sx:{color:"text.secondary",fontSize:13},children:t?.email})}),e.jsx(se,{isMobile:o,value:a.push,title:s("userCenter.pushNotification"),onChange:v=>r("push",v.target.checked)})]}),e.jsxs(Re,{spacing:1.5,useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[l.map((v,c)=>e.jsx(ke,{onTest:f,onDelete:()=>h(c),onSave:(...g)=>m(c,...g),type:v.type,url:v.url,edit:!1},`${c}_${v.url}`)),n.showAdd&&e.jsx(ke,{onTest:f,onCancel:()=>{n.showAdd=!1},onSave:(...v)=>C(...v),edit:!0},"add"),e.jsx(nt,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1},startIcon:e.jsx(O,{icon:Pr}),onClick:()=>{n.showAdd=!0},children:s("userCenter.addWebhook")})]})]})}ft.propTypes={user:u.object.isRequired,isMobile:u.bool.isRequired};function ht({item:t}){const o=Me(),{blocklet:s}=Xt(),{confirmApi:n,confirmHolder:i}=Te(),a=G({loading:!1}),{t:l}=W(),{session:p}=y.use(xe),{bindOAuth:r,unbindOAuth:f,setBaseUrl:h,baseUrl:m}=p.useOAuth(),{disconnectPasskey:C,setTargetAppPid:v}=p.usePasskey(),c=R(()=>pr[t?.provider]||"unknown",[t?.provider]),g=B(b=>b?._bind?b.provider===M.WALLET&&b.did?l("userCenter.thirdPartyLogin.walletAccountCantRemove"):b.provider===M.PASSKEY&&o.arcSphere?l("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):b._mainProvider&&o.arcSphere?l("userCenter.thirdPartyLogin.mainProviderCantRemove"):"":""),S=B(async()=>{if(t?.provider===M.PASSKEY){await new Promise((b,E)=>{n.open({title:l("userCenter.thirdPartyLogin.disconnectPasskey",{name:c}),content:l("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.cancel"),onConfirm(z){C({session:p,connectedAccount:t}).then(b).catch(E),z()},onCancel:b})});return}try{a.loading=!0,await new Promise((b,E)=>{if(t?._bind)n.open({title:l("userCenter.thirdPartyLogin.confirmUnbind",{name:c}),content:l("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.cancel"),onConfirm(z){f({session:p,connectedAccount:{...Yt(t,["did","pk"]),showProvider:t.provider,provider:t._rawProvider}}).then(b).catch(E),z()},onCancel:b});else if(t.provider===M.WALLET)n.open({title:l("userCenter.thirdPartyLogin.confirmBindWallet",{name:c}),content:l("userCenter.thirdPartyLogin.confirmBindWalletDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"primary"},cancelButtonText:l("common.cancel"),onConfirm:z=>{p.bindWallet({onSuccess:b,onCancel:E}),z()},onCancel:b});else{const z=m,F=window?.blocklet;let N="/";const j=xr(F),k=fr(F);j&&k?.appPid&&p?.user?.sourceAppPid&&(N=k.appUrl),h(N),v(s?.appPid),r({session:p,oauthItem:{...t,provider:t._rawProvider}}).then(b).catch(E).finally(()=>{h(z),v()})}})}catch(b){console.error(`Failed to ${t?._bind?"unbind":"bind"} oauth account`,b)}finally{a.loading=!1}}),T=B(b=>b.provider===M.WALLET&&b.did?l("userCenter.thirdPartyLogin.walletAccount"):b._mainProvider?l("userCenter.thirdPartyLogin.mainAccount"):b?._bind?l("userCenter.thirdPartyLogin.disconnect"):l("userCenter.thirdPartyLogin.connect")),P=B(b=>b.provider===M.WALLET&&b.did||b.provider===M.PASSKEY&&(o.arcSphere||o.wallet)?!0:!!t._mainProvider,[o.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(er,{provider:t?.provider,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16}}),e.jsx(x,{sx:{flex:1,display:{xs:t.userInfo?.email||t.did?"none":"block",sm:"block"}},children:c}),t.userInfo?.email||t.did?e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(x,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:t.userInfo?.email||t.did}),t.userInfo?.name?e.jsx(qe,{title:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{size:36,variant:"circle",shape:"circle",src:t.userInfo?.picture,did:t.did}),e.jsxs(x,{children:[e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.name}),e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.email})]})]}),children:e.jsx(x,{component:O,icon:tr,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(qe,{title:g(t),placement:"auto",children:e.jsx(x,{children:e.jsx(nt,{variant:"outlined",size:"small",sx:b=>{const E=b.palette.error.main,z=b.palette.primary.main;return{color:t?._bind?E:z,borderColor:t?._bind?E:z,backgroundColor:"background.default","&:hover":{borderColor:t?._bind?E:z,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:a.loading?null:e.jsx(O,{icon:Rr}),onClick:S,disabled:P(t),loading:a.loading,children:T(t)})})}),i]})}ht.propTypes={item:u.shape({provider:u.string,did:u.string,pk:u.string,userInfo:u.object,id:u.string,_bind:u.bool,_rawProvider:u.string,_mainProvider:u.bool}).isRequired};function gt({user:t}){const{session:o}=y.use(xe),[s,n]=y.useState({}),{getOAuthConfigs:i}=o.useOAuth(),a=Me();ir(async()=>{const r=await i({sourceAppPid:t?.sourceAppPid});n(r)},[t?.sourceAppPid]);const l=R(()=>{const r=Object.keys(s).map(f=>({...s[f],provider:f})).filter(f=>f.enabled);return[{provider:M.WALLET,order:-1},...r,{provider:M.PASSKEY,order:1/0}]},[s]),p=R(()=>{const r=hr(t);let f=!1,h="",m=gr(t);const C=r.find(c=>c.provider===M.AUTH0);return C&&(C.id.startsWith("google-oauth2|")&&(r.some(c=>c.provider==="google")||(f=!0,h=M.GOOGLE,m===M.AUTH0&&(m=M.GOOGLE))),C.id.startsWith("appleid|")&&(r.some(c=>c.provider===M.APPLE)||(f=!0,h=M.APPLE,m===M.AUTH0&&(m=M.APPLE))),C.id.startsWith("github|")&&(r.some(c=>c.provider===M.GITHUB)||(f=!0,h=M.GITHUB,m===M.AUTH0&&(m=M.GITHUB)))),l.map(c=>{if(c.provider===M.AUTH0&&f)return null;const g=f&&c.provider===h?r.find(S=>S.provider===M.AUTH0):r.find(S=>S.provider===c.provider);return g?{...c,provider:c.provider,did:g.did,pk:g.pk,userInfo:g.userInfo,_bind:!0,_rawProvider:g.provider,_mainProvider:c.provider===m}:{...c,provider:c.provider,_rawProvider:c.provider,_mainProvider:c.provider===m}}).filter(c=>!(!c||c.provider===M.PASSKEY&&!c.did)).sort((c,g)=>c._mainProvider?-1:c?.order!==void 0&&g?.order!==void 0?c.order-g.order:c?.order!==void 0?-1:1)},[t?.connectedAccounts,l]);return e.jsxs(x,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[p.map(r=>e.jsx(ht,{item:r},r?.provider)),a.wallet||a.arcSphere?null:e.jsx(rr,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:V,onError:V,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}gt.propTypes={user:u.object.isRequired};function mt({configList:t,onSave:o}){const[s,n]=y.useState(t),{t:i}=W(),a=B(async(l,p)=>{try{const r=await U.user.saveUserPrivacyConfig({[l]:typeof p=="string"?p:!p});n(s.map(f=>({...f,value:r?.[f.key]??f.value}))),q.success(i("userCenter.saveSuccess")),o("privacy")}catch(r){q.error(J(r))}});return y.useEffect(()=>{n(t)},[t]),e.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:s.map(l=>{if(l.isPrivate)return null;const p=!l.value||["all","follower-only"].includes(l.value);return e.jsxs(x,{children:[e.jsx(Se,{checked:p,labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:i("userCenter.toPublic",{name:l.name})})},size:"small",onChange:r=>{const{checked:f}=r.target;l.followersOnly?a(l.key,f?"all":"private"):a(l.key,f)}},l.key),l.followersOnly&&p&&e.jsx(x,{sx:{pl:3,pt:1},children:e.jsx(Se,{checked:l.value==="follower-only",labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:i("team.userFollowers.followersOnly")})},size:"small",onChange:r=>{const{checked:f}=r.target;a(l.key,f?"follower-only":"all")}})})]})})})}mt.propTypes={configList:u.arrayOf(u.shape({key:u.string.isRequired,name:u.string.isRequired,value:u.bool.isRequired,isPrivate:u.bool})).isRequired,onSave:u.func.isRequired};function bt({user:t,sessionUser:o}){const s=R(()=>(t?.passports||[])?.find(n=>n.name===o.role),[t?.passports,o?.role]);return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{size:40,variant:"circle",shape:"circle",src:o.avatar,did:o.did,sx:{flexShrink:0}}),e.jsxs(x,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Ce,{title:o.fullName,children:e.jsx(I,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:o.fullName})}),e.jsx(je,{label:s?.title||s?.name||"Guest",size:"small",variant:"outlined",sx:{flexShrink:0,fontWeight:"bold",fontSize:"12px",color:"text.primary",borderColor:"grey.300",backgroundColor:"transparent",textTransform:"capitalize",pr:.5,pl:0,height:"auto"}})]}),e.jsx(Ce,{title:o.email,children:e.jsx(I,{variant:"body2",color:"grey",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.email})})]})]})}bt.propTypes={user:u.object.isRequired,sessionUser:u.shape({role:u.string,avatar:u.string,did:u.string,fullName:u.string,email:u.string}).isRequired};const un=()=>Promise.resolve(""),Ve=t=>new ve(t,{browser:[[/(ArcWallet)\/([\w\.]+)/i],[ve.BROWSER.NAME,ve.BROWSER.VERSION]]}).getResult(),Ze={display:"flex",justifyContent:"flex-end",textAlign:"right"},pn=new nr({concurrency:1}),ze=y.memo(({userSession:t,isMobile:o=!1})=>{const s=G({loading:!0,ipRegion:""}),{t:n,locale:i}=W();y.useEffect(()=>{pn.add(async()=>{try{s.ipRegion=await un(t.lastLoginIp)}finally{s.loading=!1}})},[s,t.lastLoginIp]);const a=R(()=>o?{display:"flex",justifyContent:"flex-end"}:{},[o]);return e.jsx(x,{...o&&{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,flexWrap:"wrap"},children:s.ipRegion?e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"body2",children:s.ipRegion}),e.jsx(Ue,{size:16,className:"ip-address",style:a,locale:i,children:t.lastLoginIp||n("userCenter.unknown")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ue,{size:16,className:"ip-address",style:a,locale:i,children:t.lastLoginIp||n("userCenter.unknown")}),s.loading?e.jsx(I,{variant:"body2",color:"grey",sx:{textAlign:"center"},children:e.jsx(Z,{size:12,color:"inherit"})}):null]})})});ze.propTypes={userSession:u.object.isRequired,isMobile:u.bool};ze.defaultProps={isMobile:!1};function yt({user:t,showAction:o=!0,showUser:s=!0,getUserSessions:n,showOffline:i=!1}){const a=G({status:"online",page:1,pageSize:10}),l=G({online:0,expired:0,offline:0}),p=mr(),{t:r,locale:f}=W(),h=te({key:"md"}),m=pe(j=>j.breakpoints.down("lg")),{confirmApi:C,confirmHolder:v}=Te(),c=B(async()=>{const j=await n({page:a.page,pageSize:a.pageSize,status:a.status}),k=j?.paging?.total||0;return l[a.status]=k,{total:k,list:j?.list||[]}});et(async()=>{const j=await n({page:1,pageSize:1,status:"expired"});l.expired=j?.paging?.total||0;const k=await n({page:1,pageSize:1,status:"offline"});l.offline=k?.paging?.total||0});const g=ee(c,{refreshDeps:[a.status,a.page,a.pageSize]}),S=R(()=>g.data?.list||[],[g.data?.list]),T=R(()=>{const{status:j}=a;return j==="online"?l[j]<=1:l[j]===0},[S,p]),P=R(()=>ce({},h?Ze:{}),[h]),b=B(({visitorId:j})=>{C.open({title:r("userCenter.logoutThisSession"),content:r("userCenter.logoutThisSessionConfirm"),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await U.user.logout({visitorId:j,includeFederated:!0});const{page:k=0}=a,{list:D=[]}=g.data||{},K=D.length||0;k>1&&K===1&&(a.page=Math.max(k-1,1)),g.refresh(),C.close()}})}),E=B(()=>{C.open({title:r("userCenter.logoutAllSession",{type:r(a.status)}),content:r("userCenter.logoutAllSessionConfirm",{type:r(a.status)}),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await U.user.logout({status:a.status,visitorId:p,includeFederated:!0}),a.page=1,g.refresh(),C.close()}})}),z=[];o&&z.push(e.jsx(Ce,{title:r("userCenter.logoutAllTips",{type:r(a.status)}),children:e.jsx(H,{sx:{ml:.5},size:"small",variant:"contained",color:"error",onClick:E,disabled:T,children:r("userCenter.logoutAll",{type:r(a.status)})})},"logoutAll"));const F=R(()=>({search:!1,sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!1,searchDebounceTime:600,page:a.page-1,rowsPerPage:a.pageSize,count:g.data?.total||0}),[g.data?.total,a.page,a.pageSize]),N=[{label:r("userCenter.platform"),name:"platform",options:{customBodyRenderLite:j=>{const k=S[j],D=Ve(k?.ua);return e.jsx(x,{sx:P,children:[D.os?.name,D.os?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.deviceType"),name:"deviceType",options:{customBodyRenderLite:j=>{const k=S[j],D=Ve(k?.ua);return e.jsx(x,{sx:P,children:[D.browser?.name,D.browser?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.walletOS"),name:"walletOS",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.extra?.walletOS?k.extra.walletOS.toUpperCase():r("userCenter.unknown")})}}},s&&{label:r("userCenter.user"),name:"user",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:ce({minWidth:150,maxWidth:250},h?Ze:{}),children:e.jsx(bt,{sessionUser:k.user,user:t})})}}},{label:r("userCenter.createdAt"),name:"createdAt",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.createdAt?e.jsx($e,{value:k.createdAt,relativeRange:3*86400*1e3}):r("userCenter.unknown")})}}},!i&&{label:r("userCenter.updatedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.status==="expired"?r("userCenter.expired"):e.jsx($e,{value:k.updatedAt,relativeRange:3*86400*1e3})})}}},{label:r("userCenter.lastLoginIp"),name:"lastLoginIp",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(ze,{userSession:k,isMobile:h})}}},o&&{label:r("userCenter.actions"),name:"actions",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:e.jsx(H,{sx:{whiteSpace:"nowrap",fontSize:"12px !important",lineHeight:"1.25",px:1},disabled:p===k.visitorId,variant:"outlined",size:"small",color:"error",onClick:()=>b({visitorId:k.visitorId}),children:k.status==="expired"?r("userCenter.remove"):p===k.visitorId?r("userCenter.currentSession"):r("userCenter.logout")})})}}}].filter(Boolean);return e.jsxs(x,{className:"pc-user-sessions",sx:{maxWidth:h?"unset":m?"calc(100vw - 300px)":"100%",...h&&{".pc-user-sessions-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:j=>`${j.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...h&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:[v,e.jsx(br,{count:g.data?.total||0,data:S,columns:N,customButtons:z,options:F,locale:f,loading:g.loading,className:"pc-user-sessions-table",title:e.jsxs(Nt,{row:!0,sx:{lineHeight:1,ml:1},onChange:j=>{a.status=j.target.value},children:[e.jsx(Q,{value:"online",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="online"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.online"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.online,")"]})]})}),e.jsx(Q,{value:"expired",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="expired"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.expired"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.expired,")"]})]})}),i?e.jsx(Q,{value:"offline",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="offline"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.offline"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.offline,")"]})]})}):null]}),onChange:j=>{a.page=j.page+1,a.pageSize=j.rowsPerPage}})]})}yt.propTypes={user:u.object.isRequired,showAction:u.bool,showUser:u.bool,showOffline:u.bool,getUserSessions:u.func.isRequired};function vt({onDestroySelf:t=void 0}){const{confirmHolder:o}=Te(),{t:s}=W(),{session:n}=y.use(xe),i=B(async()=>{if(!t||typeof t!="function")return;const a=n.withSecondaryAuth(t,{extraParams:{removeUserDid:n?.user?.did,input:{user:{did:n?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await a(),n.logout()}catch(l){q.error(l?.message||s("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(x,{children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(x,{children:[e.jsx(I,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:s("userCenter.dangerZone.deleteAccount")}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary"},children:s("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(H,{variant:"contained",color:"error",size:"small",onClick:i,children:s("userCenter.dangerZone.delete")})]})}),o]})}vt.propTypes={onDestroySelf:u.func};function xn(){const t=te({key:"md"}),o=pe(i=>i.breakpoints.down("lg")),s={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},n=R(()=>ce({},t?s:{}),[t]);return e.jsx(x,{id:"user-center-access-key-setting",sx:{maxWidth:t?"unset":o?"calc(100vw - 300px)":"100%",...t&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:i=>`${i.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...t&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(Er,{isSelf:!0,columnSx:n})})}function wt({onDestroySelf:t=void 0,userCenterTabs:o=[]}){const{t:s}=W(),{user:n,session:i,isMyself:a,isOwner:l}=fe(),r=Me().arcSphere,f=te({key:"md"}),h=ee(async()=>n&&a?await U.user.getUserPrivacyConfig({did:n.did}):null,{refreshDeps:[n,a],loadingDelay:300}),m=R(()=>o.map(c=>({key:c.value,name:c.label,value:c.protected,isPrivate:c.isPrivate,followersOnly:c.followersOnly})),[o]),C=B(async c=>c==="privacy"?(await h.runAsync(),h.data):(c==="profile"&&await i.refresh(),null));y.useEffect(()=>{const c=window.location.hash.slice(1);c&&document.getElementById(c)?.scrollIntoView({behavior:"smooth"})},[]);const v=R(()=>[r?void 0:{label:s("userCenter.commonSetting.title"),value:"common",content:e.jsx(xt,{user:n,onSave:C})},{label:s("userCenter.notificationManagement"),value:"notification",content:e.jsx(ft,{user:n,isMobile:f})},{label:s("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(gt,{user:n})},{label:s("common.accessKeys"),value:"accessKeys",content:e.jsx(xn,{isSelf:!0})},{label:s("common.mcpServers"),value:"mcpServers",content:e.jsx(zr,{})},{label:s("userCenter.privacyManagement"),value:"privacy",content:e.jsx(mt,{configList:m,onSave:C})},{label:s("userCenter.sessionManagement"),value:"session",content:e.jsx(yt,{user:n,showUser:!1,getUserSessions:c=>U.userSession.getMyLoginSessions({},c)})},!l&&t&&typeof t=="function"?{label:s("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(vt,{onDestroySelf:t}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[n,m,f,l,t]);return a?e.jsx(x,{className:"user-center-settings",sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},"@media (min-width: 1200px) and (max-width: 1260px)":{maxWidth:750},"@media (min-width: 1100px) and (max-width: 1199px)":{maxWidth:650},"@media (min-width: 1000px) and (max-width: 1099px)":{maxWidth:600},"@media (max-width: 1049px)":{maxWidth:"100%"}},children:v.map(c=>c?e.jsxs(x,{id:c.value,sx:ce({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},c.sx),children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600},children:c.label}),e.jsx(x,{sx:{mt:2.5},children:c.content})]},c.value):null)}):null}wt.propTypes={onDestroySelf:u.func,userCenterTabs:u.array};const jt=y.createContext({}),{Provider:fn,Consumer:Ro}=jt;function Ct({children:t}){const[o]=y.useState(!1),{session:s}=y.use(xe),{user:n}=s,[i,a]=y.useState(),l=y.useMemo(()=>n?.didSpace?.endpoint,[n?.didSpace]);y.useEffect(()=>{a(n?.didSpace)},[n?.didSpace]);const p=async()=>{a(void 0)},r=m=>{},f=async m=>{a(m),await r(m.endpoint)},h=!!(l&&i);return e.jsx(fn,{value:{loading:o,spaceGateway:i,session:s,deleteSpaceGateway:p,updateSpaceGateway:f,storageEndpoint:l,settingStorageEndpoint:r,hasStorageEndpoint:h},children:t})}function Ee(){return y.use(jt)}Ct.propTypes={children:u.node.isRequired};function hn(t){const o=t.replace(/\/api\/space\/.+/,""),n=t.replace(/\/$/,"").split("/").at(-4);return le(o,"space",n)}function St({session:t,spaceGateway:o,spaceStatus:s,refresh:n}){return e.jsxs(Re,{direction:"row",spacing:1,children:[s===Lr.DISCONNECTED&&e.jsx(de,{reconnect:!0,variant:"outlined",session:t,spaceDid:t.user?.didSpace?.did,spaceGatewayUrl:t.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await n()},onError:i=>{console.error(i),q.error(J(i))}}),e.jsx($,{size:"small",LinkComponent:$t,href:hn(o.endpoint),target:"_blank",children:e.jsx(Ut,{})})]})}St.propTypes={session:u.object.isRequired,spaceGateway:u.object.isRequired,spaceStatus:u.string.isRequired,refresh:u.func.isRequired};function kt({spaceGateway:t=void 0}){const{t:o}=W(),{updateSpaceGateway:s,session:n}=Ee(),i=te(),a=({spaceGateway:l})=>s(l);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:o("userCenter.storage.spaces.connected.title")}),!i&&e.jsx(de,{connectScope:"user",connectText:o("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:a})]}),e.jsx(x,{children:t&&e.jsx(Wr,{endpoint:t.endpoint,deps:[t],selected:!0,footer:!0,action:l=>e.jsx(St,{session:n,...l})},t.endpoint)}),i&&e.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(de,{connectScope:"user",connectText:o("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:a})})]})}kt.propTypes={spaceGateway:u.object};function gn(){const{t}=W(),{updateSpaceGateway:o,session:s}=Ee(),n=({spaceGateway:i})=>o(i);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:t("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Or,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(x,{children:e.jsx(de,{session:s,onSuccess:n})})]})}function mn(){const{spaceGateway:t,hasStorageEndpoint:o,loading:s}=Ee(),{isMyself:n}=fe();return n?s?e.jsx(Br,{relative:"parent",children:e.jsx(Z,{})}):e.jsx(yn,{children:e.jsx(x,{sx:{maxWidth:"720px"},children:o?e.jsx(kt,{spaceGateway:t}):e.jsx(gn,{})})}):null}function bn(){return e.jsx(Ct,{children:e.jsx(mn,{})})}const yn=X(x)`
121
+ `,an=t=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:ae(t.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:ae(t.palette.background.paper,1)}}}),ln={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},Ye="https://main.abtnetwork.io/explorer";function pt({user:t}){const{t:o}=W(),s=te(),[n,i]=y.useState({visible:!1,nft:null}),[a,l]=y.useState({anchorEl:null,props:null}),p=P=>{const b=le(Ye,"assets",P);window.open(b,"_blank")},r=(P,b)=>{let E="";typeof b.data?.value=="string"?E=JSON.parse(b.data?.value)?.domain:E=b.data?.value?.domain,l({anchorEl:P,props:{title:E?`Hey, I just won an NFT at the ${E} event!`:"Hey, I just won an NFT!",url:le(Ye,"assets",b.address)}})},f=P=>{i({visible:!0,nft:P})},h=G({page:1,size:20}),m=ee(async(P=h)=>(await Kt.get(`${Ie.WELLKNOWN_SERVICE_PATH_PREFIX}/ocap/listAssets`,{params:{ownerAddress:t.did,...P}})).data,{ready:t?.did&&h,defaultParams:[h],refreshDeps:[t?.did,h]}),{loading:C,data:v}=m,c=v?.page??{cursor:0,next:!1,total:0},g=(P,b)=>{h.page=b,m.run(h)},S=L(P=>[e.jsx($,{size:"small",className:"mask-item",onClick:b=>{b.stopPropagation(),p(P.address)},children:e.jsx(O,{icon:"tabler:link",fontSize:18})},"link"),e.jsx($,{size:"small",onClick:b=>{b.stopPropagation(),r(b.currentTarget,P)},className:"mask-item",children:e.jsx(O,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx($,{size:"small",onClick:b=>{b.stopPropagation(),f(P)},className:"mask-item",children:e.jsx(O,{icon:"tabler:eye",fontSize:18})},"view")]),T=R(()=>{if(C){const P=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(b=>e.jsx(Oe,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},b));return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(Oe,{width:"20%"}),e.jsx(x,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:P})]})}return e.jsxs(e.Fragment,{children:[e.jsx(I,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:o("userCenter.common.nft")}),v?.assets?.length===0&&!C&&e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(rt,{children:o("userCenter.common.noNFT")})}),e.jsx(x,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:v?.assets?.map(P=>e.jsxs(x,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...s?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(st,{data:it(P),address:P.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),s?e.jsx(x,{className:"footer-mask",sx:ln,children:S(P)}):e.jsx(x,{className:"mask",sx:an,children:e.jsx(Re,{direction:"row",spacing:1,children:S(P)})})]},P.address))}),c.next||h.page>1?e.jsx(Ot,{sx:{display:"flex",justifyContent:"center",mt:2},page:h.page,onChange:g,count:Math.ceil(c.total/h.size),size:"small"}):null,e.jsx(nn,{visible:n.visible&&!!n.nft,nft:n.nft,onClose:()=>{i({visible:!1,nft:null})}}),e.jsx(lr,{anchorEl:a.anchorEl,onClose:()=>{l({anchorEl:null,props:null})},sharedProps:a.props||{title:"",url:""}})]})},[C,c,h.page,h.size,g,a,n]);return e.jsx(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:T})}pt.propTypes={user:u.object.isRequired};function cn(){const{t}=W(),{user:o,isMyself:s,viewUser:n}=fe();return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[s?e.jsxs(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:t("userCenter.passport")}),e.jsx(ut,{user:o})]}):null,e.jsx(pt,{user:s?o:n})]})}const dn=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function xt({user:t,onSave:o}){const{t:s,changeLocale:n}=W(),i=G({locale:t.locale,loading:!1}),a=L(async l=>{try{const{value:p}=l.target;i.loading=!0,await F.user.saveProfile({locale:p}),await o("profile"),n(p),i.locale=p}catch(p){q.error(J(p))}finally{i.loading=!1}});return e.jsxs(x,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(x,{children:s("userCenter.commonSetting.locale")}),e.jsx(x,{children:e.jsx(Pe,{value:i.locale,onChange:a,size:"small",IconComponent:l=>e.jsx(tt,{...l,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||dn).map(l=>e.jsx(ie,{value:l.code,children:l.name},l.code))})})]})}xt.propTypes={user:u.shape({locale:u.string}).isRequired,onSave:u.func.isRequired};function ke({onTest:t=V,onDelete:o=V,onSave:s=V,onCancel:n=V,type:i="slack",url:a="",edit:l=!1}){const{t:p}=W(),r=G({type:i||"slack",url:a||"",edit:l??!1,error:"",loading:!1}),f=L(()=>r.url?Jt(r.url)?(r.error="",!0):(r.error=p("common.invalid"),!1):(r.error=p("common.required"),!1)),h=L(()=>{r.edit=!1,r.url=a||"",r.type=i||"slack",r.error="",r.loading=!1,n()}),m=L(async c=>{r.loading=!0,await t(c),r.loading=!1}),C=L(c=>()=>{f()&&c({type:r.type,url:r.url})}),v=R(()=>r.error?e.jsx(I,{component:"span",color:"error",children:r.error}):r.edit?r.loading?e.jsx(Z,{size:16}):e.jsx($,{size:"small",onClick:C(m),sx:{mr:-1},children:e.jsx(O,{icon:Cr})}):null,[r.error,r.edit,r.loading]);return e.jsxs(x,{sx:{display:"flex",gap:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(Pe,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!r.edit||r.loading,size:"small",value:r.type,onChange:c=>{r.type=c.target.value},children:[e.jsx(ie,{value:"api",children:p("userCenter.webhook.url")}),e.jsx(ie,{value:"slack",children:p("userCenter.webhook.slack")})]}),e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Qe,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!r.edit||r.loading,fullWidth:!0,size:"small",required:!0,value:r.url,onChange:c=>{r.url=c.target.value,f()},error:!!r.error,slotProps:{input:{endAdornment:e.jsx(Je,{position:"end",children:v})}}}),e.jsx(x,{sx:{display:"flex",gap:.5},children:r.edit?e.jsxs(e.Fragment,{children:[e.jsx($,{color:"success",onClick:C((...c)=>{s(...c),r.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:cr})}),e.jsx($,{color:"error",onClick:h,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:dr})})]}):e.jsxs(e.Fragment,{children:[e.jsx($,{onClick:()=>{r.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:Sr})}),e.jsx($,{color:"error",onClick:()=>{o({type:r.type,url:r.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:kr})})]})})]})]})}ke.propTypes={onTest:u.func,onDelete:u.func,onSave:u.func,onCancel:u.func,type:u.oneOf(["api","slack"]),url:u.string,edit:u.bool};function se({title:t=void 0,description:o=void 0,value:s,onChange:n,isMobile:i}){const a=L(l=>{l.stopPropagation()});return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Se,{checked:s,size:"small",onChange:n}),e.jsxs(I,{component:"div",onClick:a,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:i?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:i?"normal":"nowrap"},children:[t,o]})]})}se.propTypes={title:u.string,description:u.node,value:u.bool.isRequired,onChange:u.func.isRequired,isMobile:u.bool.isRequired};function ft({user:t,isMobile:o}){const{t:s}=W(),n=G({showAdd:!1}),i=ee(async()=>await F.user.getUserNotificationConfig(),{refreshDeps:[t],loadingDelay:300}),a=R(()=>({wallet:!0,email:!0,phone:!1,push:!0,...i?.data?.notifications||{}}),[i?.data?.notifications]),l=R(()=>i?.data?.webhooks||[],[i?.data?.webhooks]),p=L(async v=>{try{await F.user.saveUserNotificationConfig(v),q.success(s("userCenter.saveSuccess")),i.run()}catch(c){q.error(J(c))}}),r=L(async(v,c)=>{await p({notifications:{[v]:c}})}),f=async v=>{try{await F.user.testNotificationWebhook(v),q.success(s("userCenter.webhookTested"))}catch(c){q.error(J(c))}},h=L(async v=>{await p({webhooks:l.filter((c,g)=>g!==v)})}),m=L(async(v,c)=>{await p({webhooks:l.map((g,S)=>S===v?c:g)})}),C=L(async v=>{await p({webhooks:[...l,v]}),n.showAdd=!1});return i.error?e.jsx(Dt,{severity:"error",children:i.error.message}):i.loading||!i.data?e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(Z,{})}):e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsx(se,{value:a.wallet,isMobile:o,title:s("userCenter.walletNotification"),onChange:v=>r("wallet",v.target.checked),description:Ne(t)&&e.jsx(ur,{did:Ne(t),showQrcode:!1,showAvatar:!o,copyable:!0,compact:!0,responsive:!0,startChars:o?2:6})}),e.jsx(se,{value:a.email,isMobile:o,onChange:v=>r("email",v.target.checked),title:s("userCenter.emailNotification"),description:t?.email&&e.jsx(I,{component:"span",sx:{color:"text.secondary",fontSize:13},children:t?.email})}),e.jsx(se,{isMobile:o,value:a.push,title:s("userCenter.pushNotification"),onChange:v=>r("push",v.target.checked)})]}),e.jsxs(Re,{spacing:1.5,useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[l.map((v,c)=>e.jsx(ke,{onTest:f,onDelete:()=>h(c),onSave:(...g)=>m(c,...g),type:v.type,url:v.url,edit:!1},`${c}_${v.url}`)),n.showAdd&&e.jsx(ke,{onTest:f,onCancel:()=>{n.showAdd=!1},onSave:(...v)=>C(...v),edit:!0},"add"),e.jsx(nt,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1},startIcon:e.jsx(O,{icon:Pr}),onClick:()=>{n.showAdd=!0},children:s("userCenter.addWebhook")})]})]})}ft.propTypes={user:u.object.isRequired,isMobile:u.bool.isRequired};function ht({item:t}){const o=Me(),{blocklet:s}=Xt(),{confirmApi:n,confirmHolder:i}=Te(),a=G({loading:!1}),{t:l}=W(),{session:p}=y.use(xe),{bindOAuth:r,unbindOAuth:f,setBaseUrl:h,baseUrl:m}=p.useOAuth(),{disconnectPasskey:C,setTargetAppPid:v}=p.usePasskey(),c=R(()=>pr[t?.provider]||"unknown",[t?.provider]),g=L(b=>b?._bind?b.provider===M.WALLET&&b.did?l("userCenter.thirdPartyLogin.walletAccountCantRemove"):b.provider===M.PASSKEY&&o.arcSphere?l("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):b._mainProvider&&o.arcSphere?l("userCenter.thirdPartyLogin.mainProviderCantRemove"):"":""),S=L(async()=>{if(t?.provider===M.PASSKEY){await new Promise((b,E)=>{n.open({title:l("userCenter.thirdPartyLogin.disconnectPasskey",{name:c}),content:l("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.cancel"),onConfirm(z){C({session:p,connectedAccount:t}).then(b).catch(E),z()},onCancel:b})});return}try{a.loading=!0,await new Promise((b,E)=>{if(t?._bind)n.open({title:l("userCenter.thirdPartyLogin.confirmUnbind",{name:c}),content:l("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.cancel"),onConfirm(z){f({session:p,connectedAccount:{...Yt(t,["did","pk"]),showProvider:t.provider,provider:t._rawProvider}}).then(b).catch(E),z()},onCancel:b});else if(t.provider===M.WALLET)n.open({title:l("userCenter.thirdPartyLogin.confirmBindWallet",{name:c}),content:l("userCenter.thirdPartyLogin.confirmBindWalletDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"primary"},cancelButtonText:l("common.cancel"),onConfirm:z=>{p.bindWallet({onSuccess:b,onCancel:E}),z()},onCancel:b});else{const z=m,U=window?.blocklet;let N="/";const j=xr(U),k=fr(U);j&&k?.appPid&&p?.user?.sourceAppPid&&(N=k.appUrl),h(N),v(s?.appPid),r({session:p,oauthItem:{...t,provider:t._rawProvider}}).then(b).catch(E).finally(()=>{h(z),v()})}})}catch(b){console.error(`Failed to ${t?._bind?"unbind":"bind"} oauth account`,b)}finally{a.loading=!1}}),T=L(b=>b.provider===M.WALLET&&b.did?l("userCenter.thirdPartyLogin.walletAccount"):b._mainProvider?l("userCenter.thirdPartyLogin.mainAccount"):b?._bind?l("userCenter.thirdPartyLogin.disconnect"):l("userCenter.thirdPartyLogin.connect")),P=L(b=>b.provider===M.WALLET&&b.did||b.provider===M.PASSKEY&&(o.arcSphere||o.wallet)?!0:!!t._mainProvider,[o.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(er,{provider:t?.provider,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16}}),e.jsx(x,{sx:{flex:1,display:{xs:t.userInfo?.email||t.did?"none":"block",sm:"block"}},children:c}),t.userInfo?.email||t.did?e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(x,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:t.userInfo?.email||t.did}),t.userInfo?.name?e.jsx(qe,{title:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{size:36,variant:"circle",shape:"circle",src:t.userInfo?.picture,did:t.did}),e.jsxs(x,{children:[e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.name}),e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.email})]})]}),children:e.jsx(x,{component:O,icon:tr,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(qe,{title:g(t),placement:"auto",children:e.jsx(x,{children:e.jsx(nt,{variant:"outlined",size:"small",sx:b=>{const E=b.palette.error.main,z=b.palette.primary.main;return{color:t?._bind?E:z,borderColor:t?._bind?E:z,backgroundColor:"background.default","&:hover":{borderColor:t?._bind?E:z,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:a.loading?null:e.jsx(O,{icon:Rr}),onClick:S,disabled:P(t),loading:a.loading,children:T(t)})})}),i]})}ht.propTypes={item:u.shape({provider:u.string,did:u.string,pk:u.string,userInfo:u.object,id:u.string,_bind:u.bool,_rawProvider:u.string,_mainProvider:u.bool}).isRequired};function gt({user:t}){const{session:o}=y.use(xe),[s,n]=y.useState({}),{getOAuthConfigs:i}=o.useOAuth(),a=Me();ir(async()=>{const r=await i({sourceAppPid:t?.sourceAppPid});n(r)},[t?.sourceAppPid]);const l=R(()=>{const r=Object.keys(s).map(f=>({...s[f],provider:f})).filter(f=>f.enabled);return[{provider:M.WALLET,order:-1},...r,{provider:M.PASSKEY,order:1/0}]},[s]),p=R(()=>{const r=hr(t);let f=!1,h="",m=gr(t);const C=r.find(c=>c.provider===M.AUTH0);return C&&(C.id.startsWith("google-oauth2|")&&(r.some(c=>c.provider==="google")||(f=!0,h=M.GOOGLE,m===M.AUTH0&&(m=M.GOOGLE))),C.id.startsWith("appleid|")&&(r.some(c=>c.provider===M.APPLE)||(f=!0,h=M.APPLE,m===M.AUTH0&&(m=M.APPLE))),C.id.startsWith("github|")&&(r.some(c=>c.provider===M.GITHUB)||(f=!0,h=M.GITHUB,m===M.AUTH0&&(m=M.GITHUB)))),l.map(c=>{if(c.provider===M.AUTH0&&f)return null;const g=f&&c.provider===h?r.find(S=>S.provider===M.AUTH0):r.find(S=>S.provider===c.provider);return g?{...c,provider:c.provider,did:g.did,pk:g.pk,userInfo:g.userInfo,_bind:!0,_rawProvider:g.provider,_mainProvider:c.provider===m}:{...c,provider:c.provider,_rawProvider:c.provider,_mainProvider:c.provider===m}}).filter(c=>!(!c||c.provider===M.PASSKEY&&!c.did)).sort((c,g)=>c._mainProvider?-1:c?.order!==void 0&&g?.order!==void 0?c.order-g.order:c?.order!==void 0?-1:1)},[t?.connectedAccounts,l]);return e.jsxs(x,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[p.map(r=>e.jsx(ht,{item:r},r?.provider)),a.wallet||a.arcSphere?null:e.jsx(rr,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:V,onError:V,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}gt.propTypes={user:u.object.isRequired};function mt({configList:t,onSave:o}){const[s,n]=y.useState(t),{t:i}=W(),a=L(async(l,p)=>{try{const r=await F.user.saveUserPrivacyConfig({[l]:typeof p=="string"?p:!p});n(s.map(f=>({...f,value:r?.[f.key]??f.value}))),q.success(i("userCenter.saveSuccess")),o("privacy")}catch(r){q.error(J(r))}});return y.useEffect(()=>{n(t)},[t]),e.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:s.map(l=>{if(l.isPrivate)return null;const p=!l.value||["all","follower-only"].includes(l.value);return e.jsxs(x,{children:[e.jsx(Se,{checked:p,labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:i("userCenter.toPublic",{name:l.name})})},size:"small",onChange:r=>{const{checked:f}=r.target;l.followersOnly?a(l.key,f?"all":"private"):a(l.key,f)}},l.key),l.followersOnly&&p&&e.jsx(x,{sx:{pl:3,pt:1},children:e.jsx(Se,{checked:l.value==="follower-only",labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:i("team.userFollowers.followersOnly")})},size:"small",onChange:r=>{const{checked:f}=r.target;a(l.key,f?"follower-only":"all")}})})]})})})}mt.propTypes={configList:u.arrayOf(u.shape({key:u.string.isRequired,name:u.string.isRequired,value:u.bool.isRequired,isPrivate:u.bool})).isRequired,onSave:u.func.isRequired};function bt({user:t,sessionUser:o}){const s=R(()=>(t?.passports||[])?.find(n=>n.name===o.role),[t?.passports,o?.role]);return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{size:40,variant:"circle",shape:"circle",src:o.avatar,did:o.did,sx:{flexShrink:0}}),e.jsxs(x,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Ce,{title:o.fullName,children:e.jsx(I,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:o.fullName})}),e.jsx(je,{label:s?.title||s?.name||"Guest",size:"small",variant:"outlined",sx:{flexShrink:0,fontWeight:"bold",fontSize:"12px",color:"text.primary",borderColor:"grey.300",backgroundColor:"transparent",textTransform:"capitalize",pr:.5,pl:0,height:"auto"}})]}),e.jsx(Ce,{title:o.email,children:e.jsx(I,{variant:"body2",color:"grey",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.email})})]})]})}bt.propTypes={user:u.object.isRequired,sessionUser:u.shape({role:u.string,avatar:u.string,did:u.string,fullName:u.string,email:u.string}).isRequired};const un=()=>Promise.resolve(""),Ve=t=>new ve(t,{browser:[[/(ArcWallet)\/([\w\.]+)/i],[ve.BROWSER.NAME,ve.BROWSER.VERSION]]}).getResult(),Ze={display:"flex",justifyContent:"flex-end",textAlign:"right"},pn=new nr({concurrency:1}),ze=y.memo(({userSession:t,isMobile:o=!1})=>{const s=G({loading:!0,ipRegion:""}),{t:n,locale:i}=W();y.useEffect(()=>{pn.add(async()=>{try{s.ipRegion=await un(t.lastLoginIp)}finally{s.loading=!1}})},[s,t.lastLoginIp]);const a=R(()=>o?{display:"flex",justifyContent:"flex-end"}:{},[o]);return e.jsx(x,{...o&&{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,flexWrap:"wrap"},children:s.ipRegion?e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"body2",children:s.ipRegion}),e.jsx(Fe,{size:16,className:"ip-address",style:a,locale:i,children:t.lastLoginIp||n("userCenter.unknown")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fe,{size:16,className:"ip-address",style:a,locale:i,children:t.lastLoginIp||n("userCenter.unknown")}),s.loading?e.jsx(I,{variant:"body2",color:"grey",sx:{textAlign:"center"},children:e.jsx(Z,{size:12,color:"inherit"})}):null]})})});ze.propTypes={userSession:u.object.isRequired,isMobile:u.bool};ze.defaultProps={isMobile:!1};function yt({user:t,showAction:o=!0,showUser:s=!0,getUserSessions:n,showOffline:i=!1}){const a=G({status:"online",page:1,pageSize:10}),l=G({online:0,expired:0,offline:0}),p=mr(),{t:r,locale:f}=W(),h=te({key:"md"}),m=pe(j=>j.breakpoints.down("lg")),{confirmApi:C,confirmHolder:v}=Te(),c=L(async()=>{const j=await n({page:a.page,pageSize:a.pageSize,status:a.status}),k=j?.paging?.total||0;return l[a.status]=k,{total:k,list:j?.list||[]}});et(async()=>{const j=await n({page:1,pageSize:1,status:"expired"});l.expired=j?.paging?.total||0;const k=await n({page:1,pageSize:1,status:"offline"});l.offline=k?.paging?.total||0});const g=ee(c,{refreshDeps:[a.status,a.page,a.pageSize]}),S=R(()=>g.data?.list||[],[g.data?.list]),T=R(()=>{const{status:j}=a;return j==="online"?l[j]<=1:l[j]===0},[S,p]),P=R(()=>ce({},h?Ze:{}),[h]),b=L(({visitorId:j})=>{C.open({title:r("userCenter.logoutThisSession"),content:r("userCenter.logoutThisSessionConfirm"),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await F.user.logout({visitorId:j,includeFederated:!0});const{page:k=0}=a,{list:D=[]}=g.data||{},K=D.length||0;k>1&&K===1&&(a.page=Math.max(k-1,1)),g.refresh(),C.close()}})}),E=L(()=>{C.open({title:r("userCenter.logoutAllSession",{type:r(a.status)}),content:r("userCenter.logoutAllSessionConfirm",{type:r(a.status)}),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await F.user.logout({status:a.status,visitorId:p,includeFederated:!0}),a.page=1,g.refresh(),C.close()}})}),z=[];o&&z.push(e.jsx(Ce,{title:r("userCenter.logoutAllTips",{type:r(a.status)}),children:e.jsx(H,{sx:{ml:.5},size:"small",variant:"contained",color:"error",onClick:E,disabled:T,children:r("userCenter.logoutAll",{type:r(a.status)})})},"logoutAll"));const U=R(()=>({search:!1,sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!1,searchDebounceTime:600,page:a.page-1,rowsPerPage:a.pageSize,count:g.data?.total||0}),[g.data?.total,a.page,a.pageSize]),N=[{label:r("userCenter.platform"),name:"platform",options:{customBodyRenderLite:j=>{const k=S[j],D=Ve(k?.ua);return e.jsx(x,{sx:P,children:[D.os?.name,D.os?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.deviceType"),name:"deviceType",options:{customBodyRenderLite:j=>{const k=S[j],D=Ve(k?.ua);return e.jsx(x,{sx:P,children:[D.browser?.name,D.browser?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.walletOS"),name:"walletOS",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.extra?.walletOS?k.extra.walletOS.toUpperCase():r("userCenter.unknown")})}}},s&&{label:r("userCenter.user"),name:"user",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:ce({minWidth:150,maxWidth:250},h?Ze:{}),children:e.jsx(bt,{sessionUser:k.user,user:t})})}}},{label:r("userCenter.createdAt"),name:"createdAt",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.createdAt?e.jsx($e,{value:k.createdAt,relativeRange:3*86400*1e3}):r("userCenter.unknown")})}}},!i&&{label:r("userCenter.updatedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.status==="expired"?r("userCenter.expired"):e.jsx($e,{value:k.updatedAt,relativeRange:3*86400*1e3})})}}},{label:r("userCenter.lastLoginIp"),name:"lastLoginIp",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(ze,{userSession:k,isMobile:h})}}},o&&{label:r("userCenter.actions"),name:"actions",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:e.jsx(H,{sx:{whiteSpace:"nowrap",fontSize:"12px !important",lineHeight:"1.25",px:1},disabled:p===k.visitorId,variant:"outlined",size:"small",color:"error",onClick:()=>b({visitorId:k.visitorId}),children:k.status==="expired"?r("userCenter.remove"):p===k.visitorId?r("userCenter.currentSession"):r("userCenter.logout")})})}}}].filter(Boolean);return e.jsxs(x,{className:"pc-user-sessions",sx:{maxWidth:h?"unset":m?"calc(100vw - 300px)":"100%",...h&&{".pc-user-sessions-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:j=>`${j.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...h&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:[v,e.jsx(br,{count:g.data?.total||0,data:S,columns:N,customButtons:z,options:U,locale:f,loading:g.loading,className:"pc-user-sessions-table",title:e.jsxs(Nt,{row:!0,sx:{lineHeight:1,ml:1},onChange:j=>{a.status=j.target.value},children:[e.jsx(Q,{value:"online",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="online"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.online"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.online,")"]})]})}),e.jsx(Q,{value:"expired",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="expired"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.expired"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.expired,")"]})]})}),i?e.jsx(Q,{value:"offline",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="offline"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.offline"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.offline,")"]})]})}):null]}),onChange:j=>{a.page=j.page+1,a.pageSize=j.rowsPerPage}})]})}yt.propTypes={user:u.object.isRequired,showAction:u.bool,showUser:u.bool,showOffline:u.bool,getUserSessions:u.func.isRequired};function vt({onDestroySelf:t=void 0}){const{confirmHolder:o}=Te(),{t:s}=W(),{session:n}=y.use(xe),i=L(async()=>{if(!t||typeof t!="function")return;const a=n.withSecondaryAuth(t,{extraParams:{removeUserDid:n?.user?.did,input:{user:{did:n?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await a(),n.logout()}catch(l){q.error(l?.message||s("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(x,{children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(x,{children:[e.jsx(I,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:s("userCenter.dangerZone.deleteAccount")}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary"},children:s("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(H,{variant:"contained",color:"error",size:"small",onClick:i,children:s("userCenter.dangerZone.delete")})]})}),o]})}vt.propTypes={onDestroySelf:u.func};function xn(){const t=te({key:"md"}),o=pe(i=>i.breakpoints.down("lg")),s={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},n=R(()=>ce({},t?s:{}),[t]);return e.jsx(x,{id:"user-center-access-key-setting",sx:{maxWidth:t?"unset":o?"calc(100vw - 300px)":"100%",...t&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:i=>`${i.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...t&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(Er,{isSelf:!0,columnSx:n})})}function wt({onDestroySelf:t=void 0,userCenterTabs:o=[]}){const{t:s}=W(),{user:n,session:i,isMyself:a,isOwner:l}=fe(),r=Me().arcSphere,f=te({key:"md"}),h=ee(async()=>n&&a?await F.user.getUserPrivacyConfig({did:n.did}):null,{refreshDeps:[n,a],loadingDelay:300}),m=R(()=>o.map(c=>({key:c.value,name:c.label,value:c.protected,isPrivate:c.isPrivate,followersOnly:c.followersOnly})),[o]),C=L(async c=>c==="privacy"?(await h.runAsync(),h.data):(c==="profile"&&await i.refresh(),null));y.useEffect(()=>{const c=window.location.hash.slice(1);c&&document.getElementById(c)?.scrollIntoView({behavior:"smooth"})},[]);const v=R(()=>[r?void 0:{label:s("userCenter.commonSetting.title"),value:"common",content:e.jsx(xt,{user:n,onSave:C})},{label:s("userCenter.notificationManagement"),value:"notification",content:e.jsx(ft,{user:n,isMobile:f})},{label:s("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(gt,{user:n})},{label:s("common.accessKeys"),value:"accessKeys",content:e.jsx(xn,{isSelf:!0})},{label:s("common.mcpServers"),value:"mcpServers",content:e.jsx(zr,{})},{label:s("userCenter.privacyManagement"),value:"privacy",content:e.jsx(mt,{configList:m,onSave:C})},{label:s("userCenter.sessionManagement"),value:"session",content:e.jsx(yt,{user:n,showUser:!1,getUserSessions:c=>F.userSession.getMyLoginSessions({},c)})},!l&&t&&typeof t=="function"?{label:s("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(vt,{onDestroySelf:t}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[n,m,f,l,t]);return a?e.jsx(x,{className:"user-center-settings",sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},"@media (min-width: 1200px) and (max-width: 1260px)":{maxWidth:750},"@media (min-width: 1100px) and (max-width: 1199px)":{maxWidth:650},"@media (min-width: 1000px) and (max-width: 1099px)":{maxWidth:600},"@media (max-width: 1049px)":{maxWidth:"100%"}},children:v.map(c=>c?e.jsxs(x,{id:c.value,sx:ce({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},c.sx),children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600},children:c.label}),e.jsx(x,{sx:{mt:2.5},children:c.content})]},c.value):null)}):null}wt.propTypes={onDestroySelf:u.func,userCenterTabs:u.array};const jt=y.createContext({}),{Provider:fn,Consumer:Ro}=jt;function Ct({children:t}){const[o]=y.useState(!1),{session:s}=y.use(xe),{user:n}=s,[i,a]=y.useState(),l=y.useMemo(()=>n?.didSpace?.endpoint,[n?.didSpace]);y.useEffect(()=>{a(n?.didSpace)},[n?.didSpace]);const p=async()=>{a(void 0)},r=m=>{},f=async m=>{a(m),await r(m.endpoint)},h=!!(l&&i);return e.jsx(fn,{value:{loading:o,spaceGateway:i,session:s,deleteSpaceGateway:p,updateSpaceGateway:f,storageEndpoint:l,settingStorageEndpoint:r,hasStorageEndpoint:h},children:t})}function Ee(){return y.use(jt)}Ct.propTypes={children:u.node.isRequired};function hn(t){const o=t.replace(/\/api\/space\/.+/,""),n=t.replace(/\/$/,"").split("/").at(-4);return le(o,"space",n)}function St({session:t,spaceGateway:o,spaceStatus:s,refresh:n}){return e.jsxs(Re,{direction:"row",spacing:1,children:[s===Br.DISCONNECTED&&e.jsx(de,{reconnect:!0,variant:"outlined",session:t,spaceDid:t.user?.didSpace?.did,spaceGatewayUrl:t.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await n()},onError:i=>{console.error(i),q.error(J(i))}}),e.jsx($,{size:"small",LinkComponent:$t,href:hn(o.endpoint),target:"_blank",children:e.jsx(Ft,{})})]})}St.propTypes={session:u.object.isRequired,spaceGateway:u.object.isRequired,spaceStatus:u.string.isRequired,refresh:u.func.isRequired};function kt({spaceGateway:t=void 0}){const{t:o}=W(),{updateSpaceGateway:s,session:n}=Ee(),i=te(),a=({spaceGateway:l})=>s(l);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:o("userCenter.storage.spaces.connected.title")}),!i&&e.jsx(de,{connectScope:"user",connectText:o("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:a})]}),e.jsx(x,{children:t&&e.jsx(Wr,{endpoint:t.endpoint,deps:[t],selected:!0,footer:!0,action:l=>e.jsx(St,{session:n,...l})},t.endpoint)}),i&&e.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(de,{connectScope:"user",connectText:o("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:a})})]})}kt.propTypes={spaceGateway:u.object};function gn(){const{t}=W(),{updateSpaceGateway:o,session:s}=Ee(),n=({spaceGateway:i})=>o(i);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:t("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Or,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(x,{children:e.jsx(de,{session:s,onSuccess:n})})]})}function mn(){const{spaceGateway:t,hasStorageEndpoint:o,loading:s}=Ee(),{isMyself:n}=fe();return n?s?e.jsx(Lr,{relative:"parent",children:e.jsx(Z,{})}):e.jsx(yn,{children:e.jsx(x,{sx:{maxWidth:"720px"},children:o?e.jsx(kt,{spaceGateway:t}):e.jsx(gn,{})})}):null}function bn(){return e.jsx(Ct,{children:e.jsx(mn,{})})}const yn=X(x)`
122
122
  height: 100%;
123
123
  overflow-y: auto;
124
124
  `;function vn(){const{user:t,isMyself:o,viewUser:s}=fe(),{followed:n}=Ir();return e.jsx(x,{children:e.jsx(Dr,{teamDid:window?.blocklet?.did||"",user:o?t:s,showInvitees:o,followed:n})})}function wn({tab:t=""}){const{api:o}=or(),s=y.useRef(null),n=qt(),i=t||n.tab,l=new URLSearchParams(window.location.search).get("embed")||window.sessionStorage?.getItem("embed"),p=sr(),r=R(()=>({...window.blocklet,meta:{did:window.blocklet.did,name:window.blocklet.did},children:window?.blocklet?.componentMountPoints.map(h=>({...h,meta:{...h,did:h.did,name:h.name||h.title||"",logo:"logo.png"}}))})),f=async h=>{const{input:m,sessionId:C}=h;try{await o.destroySelf({input:{...m,sessionId:C}})}catch(v){console.error("destroy myself error",v)}};return e.jsx(wr,{mode:"user-center",children:e.jsxs(Tr,{ref:s,embed:l==="1",currentTab:i?le(Ie.WELLKNOWN_SERVICE_PATH_PREFIX,"user",i):"",disableAutoRedirect:i==="settings",children:[i==="notifications"?e.jsx(rn,{blocklets:[r],context:p}):null,i==="nfts"?e.jsx(cn,{}):null,i==="settings"?e.jsx(wt,{onDestroySelf:f}):null,i==="did-spaces"?e.jsx(bn,{}):null,i==="user-followers"?e.jsx(vn,{}):null,i==="orgs"?e.jsx(Ar,{id:n.id||""}):null]})})}wn.propTypes={tab:u.string};export{wn as default};
@@ -1,4 +1,4 @@
1
- import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as Y,av as B,f as C,b$ as J,ch as K}from"./vendor-mui-core-DRxbhqaK.js";import{r as d,k as L,L as z,n as ee,o as ae}from"./vendor-react-Dvs43sk9.js";import{H as E,aU as te}from"./index-Dkx4Mp12.js";import{e as ie}from"./vendor-hooks-BlA8TRnZ.js";import{M as re,l as m,X as A,Z as S}from"./vendor-ux-B9VfuZTg.js";import{z as oe}from"./vendor-arcblock-DeeG8u0h.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(re,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
1
+ import{j as a,D as M,T as _,ce as L,Q as W,cf as q,aV as X,ak as h,cg as Y,aU as Z,av as B,f as V,b$ as J,ch as K}from"./vendor-mui-core-BFPsXaTR.js";import{r as d,k as C,L as z,n as ee,o as ae}from"./vendor-react-Dvs43sk9.js";import{H as E,aV as te}from"./index-CmM1Fb8I.js";import{e as ie}from"./vendor-hooks-DmThWyyG.js";import{M as re,l as m,a6 as A,a7 as S}from"./vendor-ux-CE4sOH7O.js";import{z as oe}from"./vendor-arcblock-DGOH9a3F.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(re,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
2
2
  position: relative;
3
3
  .badge-point {
4
4
  position: absolute;
@@ -12,7 +12,7 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
12
12
  0px 1px 4px rgba(0, 0, 0, 0.3),
13
13
  0px 0px 20px rgba(0, 0, 0, 0.1);
14
14
  }
15
- `;function ce({images:e,links:i,prefix:t="/images",addons:r=void 0,logo:s=void 0,...l}){const o=M(),n=L(),c=(x,p)=>new RegExp(`/${p}`).test(n.pathname);return a.jsxs(he,{...l,children:[a.jsx(z,{to:"/",className:"sidebar-logo",children:s||a.jsx(A,{showText:!1,size:20})}),i.map(({url:x,name:p,title:b,showBadge:g})=>{const f=c(x,p);return a.jsxs(pe,{component:z,selected:f,to:x,children:[a.jsx(ne,{name:e[p],size:36,color:f?"#00c2c4":o.typography.color.main,prefix:t,showBadge:g}),a.jsx(_,{component:"span",className:"menu-title",children:b})]},x)}),a.jsx("div",{style:{flex:1}}),r]})}const he=d.memo(m("div")`
15
+ `;function ce({images:e,links:i,prefix:t="/images",addons:r=void 0,logo:s=void 0,...l}){const o=M(),n=C(),c=(x,p)=>new RegExp(`/${p}`).test(n.pathname);return a.jsxs(he,{...l,children:[a.jsx(z,{to:"/",className:"sidebar-logo",children:s||a.jsx(A,{showText:!1,size:20})}),i.map(({url:x,name:p,title:b,showBadge:g})=>{const f=c(x,p);return a.jsxs(pe,{component:z,selected:f,to:x,children:[a.jsx(ne,{name:e[p],size:36,color:f?"#00c2c4":o.typography.color.main,prefix:t,showBadge:g}),a.jsx(_,{component:"span",className:"menu-title",children:b})]},x)}),a.jsx("div",{style:{flex:1}}),r]})}const he=d.memo(m("div")`
16
16
  flex: 1;
17
17
  display: flex;
18
18
  flex-direction: column;
@@ -33,7 +33,7 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
33
33
  display: block;
34
34
  }
35
35
  }
36
- `),V="linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))",pe=m(W)`
36
+ `),T="linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))",pe=m(W)`
37
37
  && {
38
38
  display: flex;
39
39
  flex-direction: column;
@@ -41,14 +41,14 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
41
41
  align-items: center;
42
42
  width: 100%;
43
43
  transition: all 200ms ease-in-out;
44
- background: ${e=>e.selected?V:""};
44
+ background: ${e=>e.selected?T:""};
45
45
  padding: 24px 0;
46
- border-left: 2px solid ${e=>e.selected?T.A700:"transparent"};
46
+ border-left: 2px solid ${e=>e.selected?L.A700:"transparent"};
47
47
  border-radius: 0;
48
48
 
49
49
  &:hover {
50
- background: ${V};
51
- border-left-color: ${T.A700};
50
+ background: ${T};
51
+ border-left-color: ${L.A700};
52
52
  }
53
53
 
54
54
  .menu-title {
@@ -62,7 +62,7 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
62
62
  color: ${e=>e.theme.palette.text.primary};
63
63
  }
64
64
  }
65
- `,xe=m(q)`
65
+ `,xe=m(Y)`
66
66
  && {
67
67
  z-index: ${e=>e.theme.zIndex.drawer};
68
68
  background: ${e=>e.theme.palette.background.default};
@@ -132,7 +132,7 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
132
132
  display: block;
133
133
  }
134
134
  }
135
- `;function ue({onToggleMenu:e,brand:i=void 0,description:t=void 0,addons:r=void 0,brandAddon:s=void 0,homeUrl:l="/",logo:o=void 0,children:n,...c}){return a.jsx(xe,{position:"sticky",className:"header",...c,children:a.jsxs(X,{disableGutters:!1,className:"header-toolbar",children:[a.jsx(W,{color:"inherit","aria-label":"open drawer",className:"header-menu","aira-label":"header menu button",onClick:e,children:a.jsx(Z,{})}),a.jsxs(z,{to:l,className:"header-link",children:[a.jsx(h,{sx:{display:{xs:"none",md:"block"}},className:"header-logo",children:o||a.jsx(A,{showText:!1})}),a.jsxs("div",{className:"header-title",children:[a.jsxs(_,{component:"h2",noWrap:!0,className:"header-title__primary",children:[i,s]}),a.jsx(_,{component:"p",noWrap:!0,className:"header-title__secondary",children:t})]})]}),a.jsx(h,{sx:{flexGrow:1}}),!!n&&a.jsx("div",{className:"header-children",children:n}),a.jsx("div",{className:"header-addons",children:r})]})})}const me=m("div")`
135
+ `;function ue({onToggleMenu:e,brand:i=void 0,description:t=void 0,addons:r=void 0,brandAddon:s=void 0,homeUrl:l="/",logo:o=void 0,children:n,...c}){return a.jsx(xe,{position:"sticky",className:"header",...c,children:a.jsxs(q,{disableGutters:!1,className:"header-toolbar",children:[a.jsx(W,{color:"inherit","aria-label":"open drawer",className:"header-menu","aira-label":"header menu button",onClick:e,children:a.jsx(X,{})}),a.jsxs(z,{to:l,className:"header-link",children:[a.jsx(h,{sx:{display:{xs:"none",md:"block"}},className:"header-logo",children:o||a.jsx(A,{showText:!1})}),a.jsxs("div",{className:"header-title",children:[a.jsxs(_,{component:"h2",noWrap:!0,className:"header-title__primary",children:[i,s]}),a.jsx(_,{component:"p",noWrap:!0,className:"header-title__secondary",children:t})]})]}),a.jsx(h,{sx:{flexGrow:1}}),!!n&&a.jsx("div",{className:"header-children",children:n}),a.jsx("div",{className:"header-addons",children:r})]})})}const me=m("div")`
136
136
  &.dashboard {
137
137
  display: flex;
138
138
  flex-direction: column;
@@ -160,7 +160,7 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
160
160
  box-shadow: 2px 16px 10px 0 rgba(0, 0, 0, ${e=>e.theme.palette.mode==="light"?.05:.5});
161
161
  border: 0;
162
162
  }
163
- `;function be({links:e=[],brand:i="",description:t="",images:r,title:s="Home",brandAddon:l=void 0,headerAddon:o=void 0,prefix:n="/images",fullWidth:c=!1,contentLayout:x="column",className:p="",homeUrl:b="/",logo:g=void 0,children:f,...P}){const w=ie(document.body)?.width||0,[v,F]=d.useState(w>=960?"permanent":"temporary"),[k,y]=d.useState(v==="permanent");d.useEffect(()=>{const N=w>=960?"permanent":"temporary";F(N),y(N!=="temporary")},[w]);const $=()=>{y(!k)},j=c||x==="row";return a.jsxs(me,{className:`dashboard ${p}`,...P,children:[a.jsx(E,{title:`${s}-${i}`}),a.jsx(ue,{className:"dashboard__header",onToggleMenu:$,brand:i,brandAddon:l,description:t,addons:o,homeUrl:b,logo:g}),a.jsxs(h,{className:"dashboard__body",sx:{display:"flex"},children:[a.jsx(Y,{variant:v,className:"drawer",classes:{paper:"drawerPaper"},open:k,onClose:$,ModalProps:{disablePortal:!0,keepMounted:!0},children:a.jsx(ce,{className:"dashboard__sidebar",images:r,links:e,prefix:n,logo:g})}),a.jsxs(h,{className:"dashboard__main",children:[a.jsx(B,{maxWidth:j?!1:"lg",className:"dashboard__content",children:f}),a.jsx(S,{})]})]})]})}function U({routerLinkComponent:e,to:i,external:t=!1,children:r,...s}){return t?a.jsx("a",{href:i,...s,children:r}):a.jsx(e,{to:i,...s,children:r})}function R({...e}){return a.jsx(U,{routerLinkComponent:z,...e})}function ge({className:e="",...i}){const t=i.external&&typeof e=="function"?e({}):e;return a.jsx(U,{routerLinkComponent:ee,className:t,...i})}function D(e,i){if(e.children?.length)return fe(e,i);const{url:t,icon:r,title:s,showBadge:l,external:o,active:n}=e;return a.jsx("li",{className:"layout-sidebar-item",children:a.jsxs(ge,{external:o,to:t,className:({isActive:c})=>C("layout-sidebar-link",{"layout-sidebar-link--active":o?n:c}),children:[r&&a.jsx("span",{className:`layout-sidebar-icon ${l?"layout-sidebar-badge":""}`,children:r}),a.jsx(_,{component:"span",className:"layout-sidebar-link-text",children:s})]})},`${t}-${i}`)}function fe(e,i){return a.jsxs("li",{className:"layout-sidebar-group",children:[a.jsx("span",{className:"layout-sidebar-group-title",children:e.title}),a.jsx("ul",{children:e.children.map(D)})]},`group-${e.title}-${i}`)}function I({links:e,addons:i=void 0,dense:t=!1,...r}){return a.jsxs(je,{...r,className:C({"layout-sidebar-dense":t}),children:[a.jsx("ul",{children:e.map(D)}),a.jsx("div",{style:{flex:1}}),i]})}const ye="linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))",je=m("div")`
163
+ `;function be({links:e=[],brand:i="",description:t="",images:r,title:s="Home",brandAddon:l=void 0,headerAddon:o=void 0,prefix:n="/images",fullWidth:c=!1,contentLayout:x="column",className:p="",homeUrl:b="/",logo:g=void 0,children:f,...P}){const w=ie(document.body)?.width||0,[v,F]=d.useState(w>=960?"permanent":"temporary"),[k,y]=d.useState(v==="permanent");d.useEffect(()=>{const N=w>=960?"permanent":"temporary";F(N),y(N!=="temporary")},[w]);const $=()=>{y(!k)},j=c||x==="row";return a.jsxs(me,{className:`dashboard ${p}`,...P,children:[a.jsx(E,{title:`${s}-${i}`}),a.jsx(ue,{className:"dashboard__header",onToggleMenu:$,brand:i,brandAddon:l,description:t,addons:o,homeUrl:b,logo:g}),a.jsxs(h,{className:"dashboard__body",sx:{display:"flex"},children:[a.jsx(Z,{variant:v,className:"drawer",classes:{paper:"drawerPaper"},open:k,onClose:$,ModalProps:{disablePortal:!0,keepMounted:!0},children:a.jsx(ce,{className:"dashboard__sidebar",images:r,links:e,prefix:n,logo:g})}),a.jsxs(h,{className:"dashboard__main",children:[a.jsx(B,{maxWidth:j?!1:"lg",className:"dashboard__content",children:f}),a.jsx(S,{})]})]})]})}function R({routerLinkComponent:e,to:i,external:t=!1,children:r,...s}){return t?a.jsx("a",{href:i,...s,children:r}):a.jsx(e,{to:i,...s,children:r})}function U({...e}){return a.jsx(R,{routerLinkComponent:z,...e})}function ge({className:e="",...i}){const t=i.external&&typeof e=="function"?e({}):e;return a.jsx(R,{routerLinkComponent:ee,className:t,...i})}function D(e,i){if(e.children?.length)return fe(e,i);const{url:t,icon:r,title:s,showBadge:l,external:o,active:n}=e;return a.jsx("li",{className:"layout-sidebar-item",children:a.jsxs(ge,{external:o,to:t,className:({isActive:c})=>V("layout-sidebar-link",{"layout-sidebar-link--active":o?n:c}),children:[r&&a.jsx("span",{className:`layout-sidebar-icon ${l?"layout-sidebar-badge":""}`,children:r}),a.jsx(_,{component:"span",className:"layout-sidebar-link-text",children:s})]})},`${t}-${i}`)}function fe(e,i){return a.jsxs("li",{className:"layout-sidebar-group",children:[a.jsx("span",{className:"layout-sidebar-group-title",children:e.title}),a.jsx("ul",{children:e.children.map(D)})]},`group-${e.title}-${i}`)}function I({links:e,addons:i=void 0,dense:t=!1,...r}){return a.jsxs(je,{...r,className:V({"layout-sidebar-dense":t}),children:[a.jsx("ul",{children:e.map(D)}),a.jsx("div",{style:{flex:1}}),i]})}const ye="linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))",je=m("div")`
164
164
  display: flex;
165
165
  flex-direction: column;
166
166
  ul {
@@ -285,7 +285,7 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
285
285
  margin-top: 16px;
286
286
  }
287
287
  }
288
- `;function we({closeMenu:e,...i}){const t=L();return d.useEffect(()=>{e()},[t]),a.jsx(te,{...i})}function G(e,i){return e.map(t=>t.children?.length?{...t,label:t.title,children:G(t.children,i)}:{...t,label:a.jsx(R,{to:t.url,external:t.external,children:t.title}),active:t.external?t.active:!!ae({path:t.url,end:!1},i.pathname)})}function ke({title:e="Home",headerProps:i={},links:t=[],sidebarWidth:r=120,fullWidth:s=!1,dense:l="auto",footerProps:o={},sx:n={},children:c,hideHtmlTitle:x=!1,...p}){const b=M(),{inFullPage:g,showToggleButton:f,headerVisible:P,footerVisible:w,sidebarVisible:v,toggleFullPage:F}=se(),k=L(),y=d.useMemo(()=>G(t,k),[k,t]),$=y.some(u=>!!u.children?.length),j=l==="auto"?y.length>=8||$:l,N=C("dashboard",{"dashboard-dense":j},p.className),O={homeLink:u=>a.jsx(R,{to:window.blocklet?.prefix||"/",children:u}),...i};return d.useEffect(()=>{const{searchParams:u}=new URL(window.location.href);u.get("inviter")&&window.localStorage.setItem("inviter",u.get("inviter"))},[]),a.jsxs(ve,{sx:n,...p,className:N,sidebarWidth:r,children:[!x&&a.jsx(E,{title:e},e),P&&a.jsx($e,{...O,className:"dashboard-header",children:t?.length?({isMobile:u,closeMenu:Q})=>u?a.jsx(we,{mode:"inline",items:y,closeMenu:Q,bgColor:"transparent",activeTextColor:b.palette.primary.main}):null:null}),a.jsxs(h,{className:"dashboard-body",sx:{display:"flex"},children:[!!t?.length&&v&&a.jsx(h,{className:"dashboard-sidebar",sx:{display:{xs:"none",md:"block"}},children:j?a.jsx(I,{links:t,dense:j}):a.jsx(h,{className:"dashboard-sidebar-container",children:a.jsx(I,{links:t,dense:j})})}),a.jsxs(h,{className:"dashboard-main",id:"arc__dashboard-main",children:[f&&a.jsx(h,{sx:{position:"absolute",top:4,right:4,display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,color:"#fff",bgcolor:"rgba(158,158,158, 0.6);",borderRadius:1,cursor:"pointer"},onClick:F,children:g?a.jsx(J,{style:{fontSize:18}}):a.jsx(K,{style:{fontSize:18}})}),a.jsx(B,{className:"dashboard-content",id:"arc__dashboard-content",...s&&{maxWidth:!1},children:c}),w&&a.jsx(S,{dark:b.palette.mode==="dark",...o})]})]})]})}const ve=m(h)`
288
+ `;function we({closeMenu:e,...i}){const t=C();return d.useEffect(()=>{e()},[t]),a.jsx(te,{...i})}function G(e,i){return e.map(t=>t.children?.length?{...t,label:t.title,children:G(t.children,i)}:{...t,label:a.jsx(U,{to:t.url,external:t.external,children:t.title}),active:t.external?t.active:!!ae({path:t.url,end:!1},i.pathname)})}function ke({title:e="Home",headerProps:i={},links:t=[],sidebarWidth:r=120,fullWidth:s=!1,dense:l="auto",footerProps:o={},sx:n={},children:c,hideHtmlTitle:x=!1,...p}){const b=M(),{inFullPage:g,showToggleButton:f,headerVisible:P,footerVisible:w,sidebarVisible:v,toggleFullPage:F}=se(),k=C(),y=d.useMemo(()=>G(t,k),[k,t]),$=y.some(u=>!!u.children?.length),j=l==="auto"?y.length>=8||$:l,N=V("dashboard",{"dashboard-dense":j},p.className),O={homeLink:u=>a.jsx(U,{to:window.blocklet?.prefix||"/",children:u}),...i};return d.useEffect(()=>{const{searchParams:u}=new URL(window.location.href);u.get("inviter")&&window.localStorage.setItem("inviter",u.get("inviter"))},[]),a.jsxs(ve,{sx:n,...p,className:N,sidebarWidth:r,children:[!x&&a.jsx(E,{title:e},e),P&&a.jsx($e,{...O,className:"dashboard-header",children:t?.length?({isMobile:u,closeMenu:Q})=>u?a.jsx(we,{mode:"inline",items:y,closeMenu:Q,bgColor:"transparent",activeTextColor:b.palette.primary.main}):null:null}),a.jsxs(h,{className:"dashboard-body",sx:{display:"flex"},children:[!!t?.length&&v&&a.jsx(h,{className:"dashboard-sidebar",sx:{display:{xs:"none",md:"block"}},children:j?a.jsx(I,{links:t,dense:j}):a.jsx(h,{className:"dashboard-sidebar-container",children:a.jsx(I,{links:t,dense:j})})}),a.jsxs(h,{className:"dashboard-main",id:"arc__dashboard-main",children:[f&&a.jsx(h,{sx:{position:"absolute",top:4,right:4,display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,color:"#fff",bgcolor:"rgba(158,158,158, 0.6);",borderRadius:1,cursor:"pointer"},onClick:F,children:g?a.jsx(J,{style:{fontSize:18}}):a.jsx(K,{style:{fontSize:18}})}),a.jsx(B,{className:"dashboard-content",id:"arc__dashboard-content",...s&&{maxWidth:!1},children:c}),w&&a.jsx(S,{dark:b.palette.mode==="dark",...o})]})]})]})}const ve=m(h)`
289
289
  &.dashboard {
290
290
  display: flex;
291
291
  flex-direction: column;
@@ -345,4 +345,4 @@ import{j as a,D as M,T as _,ce as T,Q as W,cf as X,aV as Z,ak as h,cg as q,aU as
345
345
  .header-container {
346
346
  max-width: 100%;
347
347
  }
348
- `;function Le({legacy:e=!0,...i}){return e?a.jsx(be,{...i}):a.jsx(le,{children:a.jsx(ke,{...i})})}export{se as d,Le as x};
348
+ `;function Ce({legacy:e=!0,...i}){return e?a.jsx(be,{...i}):a.jsx(le,{children:a.jsx(ke,{...i})})}export{se as d,Ce as x};
@@ -1,9 +1,9 @@
1
- import{r as j,g as ge}from"./vendor-react-Dvs43sk9.js";import{j as o,T as H,z as $,x as ye,c3 as ve,c4 as Y,bw as je,F as Ce,bD as Te,aX as Fe,a6 as U,W as C,b6 as be,a5 as we,I as K,at as G,ak as B,J as Se,Q as Be,cb as De,am as Re}from"./vendor-mui-core-DRxbhqaK.js";import{X as L,b7 as ae,B as le,c as Ne}from"./index-Dkx4Mp12.js";import{T as M,b as ce,n as E,H as z,E as ee,S as Pe}from"./vendor-ux-B9VfuZTg.js";import{e as ue}from"./edit.svg-DycWG9v3.js";import{C as He}from"./lock.svg-COUP8tyO.js";import{G as Ie,H as Ee}from"./vendor-utils-CUDP56Ff.js";import{f as pe}from"./index-DBs9Ljax.js";import{u as de}from"./team-geqUb8FM.js";import{w as me,P as Le}from"./permission-uKfC5D9f.js";import{C as Me}from"./confirm-nzje1i_c.js";const _e=u=>j.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},j.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"}));var A={exports:{}},W={exports:{}},te;function ke(){return te||(te=1,function(){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m={rotl:function(a,c){return a<<c|a>>>32-c},rotr:function(a,c){return a<<32-c|a>>>c},endian:function(a){if(a.constructor==Number)return m.rotl(a,8)&16711935|m.rotl(a,24)&4278255360;for(var c=0;c<a.length;c++)a[c]=m.endian(a[c]);return a},randomBytes:function(a){for(var c=[];a>0;a--)c.push(Math.floor(Math.random()*256));return c},bytesToWords:function(a){for(var c=[],l=0,p=0;l<a.length;l++,p+=8)c[p>>>5]|=a[l]<<24-p%32;return c},wordsToBytes:function(a){for(var c=[],l=0;l<a.length*32;l+=8)c.push(a[l>>>5]>>>24-l%32&255);return c},bytesToHex:function(a){for(var c=[],l=0;l<a.length;l++)c.push((a[l]>>>4).toString(16)),c.push((a[l]&15).toString(16));return c.join("")},hexToBytes:function(a){for(var c=[],l=0;l<a.length;l+=2)c.push(parseInt(a.substr(l,2),16));return c},bytesToBase64:function(a){for(var c=[],l=0;l<a.length;l+=3)for(var p=a[l]<<16|a[l+1]<<8|a[l+2],d=0;d<4;d++)l*8+d*6<=a.length*8?c.push(u.charAt(p>>>6*(3-d)&63)):c.push("=");return c.join("")},base64ToBytes:function(a){a=a.replace(/[^A-Z0-9+\/]/ig,"");for(var c=[],l=0,p=0;l<a.length;p=++l%4)p!=0&&c.push((u.indexOf(a.charAt(l-1))&Math.pow(2,-2*p+8)-1)<<p*2|u.indexOf(a.charAt(l))>>>6-p*2);return c}};W.exports=m}()),W.exports}var V,re;function ne(){if(re)return V;re=1;var u={utf8:{stringToBytes:function(m){return u.bin.stringToBytes(unescape(encodeURIComponent(m)))},bytesToString:function(m){return decodeURIComponent(escape(u.bin.bytesToString(m)))}},bin:{stringToBytes:function(m){for(var a=[],c=0;c<m.length;c++)a.push(m.charCodeAt(c)&255);return a},bytesToString:function(m){for(var a=[],c=0;c<m.length;c++)a.push(String.fromCharCode(m[c]));return a.join("")}}};return V=u,V}/*!
1
+ import{r as j,g as ge}from"./vendor-react-Dvs43sk9.js";import{j as o,T as H,z as $,x as ye,c3 as ve,c4 as Y,bw as je,F as Ce,bD as Te,aX as Fe,a6 as U,W as C,b6 as be,a5 as we,I as K,at as Z,ak as B,J as Se,Q as Be,cb as De,am as Re}from"./vendor-mui-core-BFPsXaTR.js";import{Z as E,b9 as ae,B as le,c as Ne}from"./index-CmM1Fb8I.js";import{V as L,q as ce,p as q,H as z,E as ee,Z as Pe}from"./vendor-ux-CE4sOH7O.js";import{e as ue}from"./edit.svg-DycWG9v3.js";import{C as He}from"./lock.svg-COUP8tyO.js";import{G as Ie,H as qe}from"./vendor-utils-OrZFrHBP.js";import{f as pe}from"./index-DBs9Ljax.js";import{u as de}from"./team-DK_N0J3a.js";import{w as me,P as Ee}from"./permission-B7_8SVB9.js";import{C as Le}from"./confirm-DAMhAYR3.js";const Me=u=>j.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},j.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"}));var A={exports:{}},W={exports:{}},te;function _e(){return te||(te=1,function(){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m={rotl:function(a,c){return a<<c|a>>>32-c},rotr:function(a,c){return a<<32-c|a>>>c},endian:function(a){if(a.constructor==Number)return m.rotl(a,8)&16711935|m.rotl(a,24)&4278255360;for(var c=0;c<a.length;c++)a[c]=m.endian(a[c]);return a},randomBytes:function(a){for(var c=[];a>0;a--)c.push(Math.floor(Math.random()*256));return c},bytesToWords:function(a){for(var c=[],l=0,p=0;l<a.length;l++,p+=8)c[p>>>5]|=a[l]<<24-p%32;return c},wordsToBytes:function(a){for(var c=[],l=0;l<a.length*32;l+=8)c.push(a[l>>>5]>>>24-l%32&255);return c},bytesToHex:function(a){for(var c=[],l=0;l<a.length;l++)c.push((a[l]>>>4).toString(16)),c.push((a[l]&15).toString(16));return c.join("")},hexToBytes:function(a){for(var c=[],l=0;l<a.length;l+=2)c.push(parseInt(a.substr(l,2),16));return c},bytesToBase64:function(a){for(var c=[],l=0;l<a.length;l+=3)for(var p=a[l]<<16|a[l+1]<<8|a[l+2],d=0;d<4;d++)l*8+d*6<=a.length*8?c.push(u.charAt(p>>>6*(3-d)&63)):c.push("=");return c.join("")},base64ToBytes:function(a){a=a.replace(/[^A-Z0-9+\/]/ig,"");for(var c=[],l=0,p=0;l<a.length;p=++l%4)p!=0&&c.push((u.indexOf(a.charAt(l-1))&Math.pow(2,-2*p+8)-1)<<p*2|u.indexOf(a.charAt(l))>>>6-p*2);return c}};W.exports=m}()),W.exports}var V,re;function ne(){if(re)return V;re=1;var u={utf8:{stringToBytes:function(m){return u.bin.stringToBytes(unescape(encodeURIComponent(m)))},bytesToString:function(m){return decodeURIComponent(escape(u.bin.bytesToString(m)))}},bin:{stringToBytes:function(m){for(var a=[],c=0;c<m.length;c++)a.push(m.charCodeAt(c)&255);return a},bytesToString:function(m){for(var a=[],c=0;c<m.length;c++)a.push(String.fromCharCode(m[c]));return a.join("")}}};return V=u,V}/*!
2
2
  * Determine if an object is a Buffer
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
5
5
  * @license MIT
6
- */var O,se;function qe(){if(se)return O;se=1,O=function(a){return a!=null&&(u(a)||m(a)||!!a._isBuffer)};function u(a){return!!a.constructor&&typeof a.constructor.isBuffer=="function"&&a.constructor.isBuffer(a)}function m(a){return typeof a.readFloatLE=="function"&&typeof a.slice=="function"&&u(a.slice(0,0))}return O}var ie;function $e(){return ie||(ie=1,function(){var u=ke(),m=ne().utf8,a=qe(),c=ne().bin,l=function(p,d){p.constructor==String?d&&d.encoding==="binary"?p=c.stringToBytes(p):p=m.stringToBytes(p):a(p)?p=Array.prototype.slice.call(p,0):!Array.isArray(p)&&p.constructor!==Uint8Array&&(p=p.toString());for(var s=u.bytesToWords(p),f=p.length*8,n=1732584193,t=-271733879,r=-1732584194,e=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[f>>>5]|=128<<f%32,s[(f+64>>>9<<4)+14]=f;for(var v=l._ff,g=l._gg,y=l._hh,h=l._ii,i=0;i<s.length;i+=16){var F=n,D=t,R=r,w=e;n=v(n,t,r,e,s[i+0],7,-680876936),e=v(e,n,t,r,s[i+1],12,-389564586),r=v(r,e,n,t,s[i+2],17,606105819),t=v(t,r,e,n,s[i+3],22,-1044525330),n=v(n,t,r,e,s[i+4],7,-176418897),e=v(e,n,t,r,s[i+5],12,1200080426),r=v(r,e,n,t,s[i+6],17,-1473231341),t=v(t,r,e,n,s[i+7],22,-45705983),n=v(n,t,r,e,s[i+8],7,1770035416),e=v(e,n,t,r,s[i+9],12,-1958414417),r=v(r,e,n,t,s[i+10],17,-42063),t=v(t,r,e,n,s[i+11],22,-1990404162),n=v(n,t,r,e,s[i+12],7,1804603682),e=v(e,n,t,r,s[i+13],12,-40341101),r=v(r,e,n,t,s[i+14],17,-1502002290),t=v(t,r,e,n,s[i+15],22,1236535329),n=g(n,t,r,e,s[i+1],5,-165796510),e=g(e,n,t,r,s[i+6],9,-1069501632),r=g(r,e,n,t,s[i+11],14,643717713),t=g(t,r,e,n,s[i+0],20,-373897302),n=g(n,t,r,e,s[i+5],5,-701558691),e=g(e,n,t,r,s[i+10],9,38016083),r=g(r,e,n,t,s[i+15],14,-660478335),t=g(t,r,e,n,s[i+4],20,-405537848),n=g(n,t,r,e,s[i+9],5,568446438),e=g(e,n,t,r,s[i+14],9,-1019803690),r=g(r,e,n,t,s[i+3],14,-187363961),t=g(t,r,e,n,s[i+8],20,1163531501),n=g(n,t,r,e,s[i+13],5,-1444681467),e=g(e,n,t,r,s[i+2],9,-51403784),r=g(r,e,n,t,s[i+7],14,1735328473),t=g(t,r,e,n,s[i+12],20,-1926607734),n=y(n,t,r,e,s[i+5],4,-378558),e=y(e,n,t,r,s[i+8],11,-2022574463),r=y(r,e,n,t,s[i+11],16,1839030562),t=y(t,r,e,n,s[i+14],23,-35309556),n=y(n,t,r,e,s[i+1],4,-1530992060),e=y(e,n,t,r,s[i+4],11,1272893353),r=y(r,e,n,t,s[i+7],16,-155497632),t=y(t,r,e,n,s[i+10],23,-1094730640),n=y(n,t,r,e,s[i+13],4,681279174),e=y(e,n,t,r,s[i+0],11,-358537222),r=y(r,e,n,t,s[i+3],16,-722521979),t=y(t,r,e,n,s[i+6],23,76029189),n=y(n,t,r,e,s[i+9],4,-640364487),e=y(e,n,t,r,s[i+12],11,-421815835),r=y(r,e,n,t,s[i+15],16,530742520),t=y(t,r,e,n,s[i+2],23,-995338651),n=h(n,t,r,e,s[i+0],6,-198630844),e=h(e,n,t,r,s[i+7],10,1126891415),r=h(r,e,n,t,s[i+14],15,-1416354905),t=h(t,r,e,n,s[i+5],21,-57434055),n=h(n,t,r,e,s[i+12],6,1700485571),e=h(e,n,t,r,s[i+3],10,-1894986606),r=h(r,e,n,t,s[i+10],15,-1051523),t=h(t,r,e,n,s[i+1],21,-2054922799),n=h(n,t,r,e,s[i+8],6,1873313359),e=h(e,n,t,r,s[i+15],10,-30611744),r=h(r,e,n,t,s[i+6],15,-1560198380),t=h(t,r,e,n,s[i+13],21,1309151649),n=h(n,t,r,e,s[i+4],6,-145523070),e=h(e,n,t,r,s[i+11],10,-1120210379),r=h(r,e,n,t,s[i+2],15,718787259),t=h(t,r,e,n,s[i+9],21,-343485551),n=n+F>>>0,t=t+D>>>0,r=r+R>>>0,e=e+w>>>0}return u.endian([n,t,r,e])};l._ff=function(p,d,s,f,n,t,r){var e=p+(d&s|~d&f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._gg=function(p,d,s,f,n,t,r){var e=p+(d&f|s&~f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._hh=function(p,d,s,f,n,t,r){var e=p+(d^s^f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._ii=function(p,d,s,f,n,t,r){var e=p+(s^(d|~f))+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._blocksize=16,l._digestsize=16,A.exports=function(p,d){if(p==null)throw new Error("Illegal argument "+p);var s=u.wordsToBytes(l(p,d));return d&&d.asBytes?s:d&&d.asString?c.bytesToString(s):u.bytesToHex(s)}}()),A.exports}var ze=$e();const Ae=ge(ze);function Z({teamDid:u,onCancel:m,onSuccess:a,onError:c=()=>{},mode:l="create",item:p={},orgId:d=""}){const{api:s}=L(),[f,n]=j.useState(!1),[t,r]=j.useState(""),{t:e}=M(),[i,v]=j.useState(p.title||""),[g,y]=j.useState(p.description||""),[h,F]=j.useState(p?.extra?.display||"builtin"),[D,R]=j.useState(p?.extra?.types?p.extra.types.join(","):""),w=async()=>{const x=i.trim();if(!x){r(e("team.passport.error.titleEmpty"));return}if(x.length>64){r(e("team.passport.error.titleTooLong",{length:64}));return}const N=g.replace(/\n/g," ");if(!N){r(e("team.passport.error.descriptionEmpty"));return}const I=l==="create"?Ae(d?`${d}-${x}`:x):p.name;r(null),n(!0);try{if(l==="create"){const S={teamDid:u,name:I,title:x,description:N,...d?{orgId:d}:{}};h==="custom"&&(S.extra=JSON.stringify({display:"custom",types:D.split(",")})),await s.createRole({input:S})}else{const S={teamDid:u,role:{name:I,title:x,description:N},...d?{orgId:d}:{}};await s.updateRole({input:S})}a()}catch(S){const k=pe(S);r(k),c(S)}finally{n(!1)}},_=o.jsxs("div",{children:[l==="update"&&o.jsx(H,{component:"div",style:{paddingTop:16},children:o.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:p.name,disabled:!0})}),o.jsx(H,{component:"div",style:{marginTop:16},children:o.jsx($,{label:e("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:i,onChange:x=>{r(null),v(x.target.value)},disabled:l==="update"||f,helperText:e("team.passport.create.titleTip")})}),o.jsx(H,{component:"div",style:{marginTop:16,marginBottom:16},children:o.jsx($,{label:e("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:g,onChange:x=>{r(null),y(x.target.value)},disabled:f,multiline:!0,rows:3})}),l==="create"&&o.jsxs("div",{style:{marginBottom:16},children:[o.jsx(ye,{children:e("common.display")}),o.jsxs(ve,{color:"primary",size:"small",value:h,exclusive:!0,style:{marginTop:16},disabled:f,onChange:(x,N)=>F(N),"data-cy":"input-role-display",children:[o.jsx(Y,{value:"builtin","data-cy":"input-role-display-builtin",children:o.jsx(H,{children:e("team.passport.displayBuiltin")})}),o.jsx(Y,{value:"custom","data-cy":"input-role-display-custom",children:o.jsx(H,{children:e("team.passport.displayCustom")})})]}),h==="custom"&&o.jsxs(o.Fragment,{children:[o.jsx(je,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:D,disabled:f,onChange:x=>{R(x.target.value)}}),o.jsx(Ce,{children:e("team.passport.typesTip")})]})]})]});return o.jsxs(ce,{title:l==="create"?e("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:m,showCloseButton:!1,actions:o.jsxs(o.Fragment,{children:[o.jsx(E,{onClick:m,color:"inherit",children:e("common.cancel")}),o.jsxs(E,{"data-cy":"mutate-role-confirm",onClick:w,color:"primary",disabled:f,variant:"contained",autoFocus:!0,children:[f&&o.jsx(U,{size:16}),e(l==="create"?"common.create":"common.update")]})]}),children:[o.jsx(Te,{component:"div",children:_}),!!t&&o.jsx(Fe,{severity:"error",style:{width:"100%",margin:0},children:t})]})}Z.propTypes={teamDid:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onError:C.func,mode:C.oneOf(["create","update"]),item:C.object,orgId:C.string};function J({onCancel:u,onSuccess:m,onDelete:a,roleName:c,roles:l=void 0,hasPermission:p=!1,orgId:d=""}){const{api:s}=L(),{roles:f,permissions:n,teamDid:t,refresh:r,isNodeTeam:e}=de(),{t:i}=M(),[v,g]=j.useState([]),[y,h]=j.useState(!1),[F,D]=j.useState(null),[R,w]=j.useState(!1),_=j.useMemo(()=>l||f,[l,f]),x=Ie(_.find(T=>T.name===c)),N=ae(c),I=async T=>{if(!R)try{w(!0),await s.deleteRole({input:{teamDid:t,name:T}}),a()}catch(b){z.error(b.message)}finally{w(!1),D(null)}},S=async(T,b)=>{const fe=(await s.getPermissionsByRole({input:{teamDid:T,role:{name:b}}})).permissions||[],xe=n.map(X=>({...X,bind:fe.some(he=>he.name===X.name)}));g(xe)},k=async()=>{w(!0);const T=v.filter(b=>b.bind).map(b=>b.name);try{await s.updatePermissionsForRole({input:{teamDid:t,roleName:x.name,grantNames:T}}),z.success(i("common.saveSuccess")),m()}catch(b){z.error(pe(b))}finally{w(!1)}};j.useEffect(()=>{t&&c&&S(t,c)},[t,c]);const q=e||!p;let Q=null;return e&&(Q=o.jsxs("div",{className:"bind",children:[o.jsx("div",{className:"title",children:i("common.permission")}),o.jsx("div",{className:"list",children:v.filter(T=>q?T.bind:!0).map(T=>o.jsx("div",{className:"item",children:o.jsx(be,{control:o.jsx(we,{disabled:q,checked:T.bind,onChange:()=>{g(b=>b.map(P=>(P.name===T.name&&(P.bind=!P.bind),P)))},name:T.name}),label:T.description})}))})]})),o.jsxs(ce,{title:i("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:p&&!N&&o.jsxs(o.Fragment,{children:[o.jsx(K,{onClick:()=>h(x),"data-cy":`edit-passport-${x.name}`,size:"large",children:o.jsx(ue,{fill:"#bfbfbf"})}),o.jsx(K,{onClick:()=>D({title:i("team.passport.delete.title"),description:i("team.passport.delete.description",{name:x.title}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>{I(x.name)},onCancel:()=>{w(!1),D(null)}}),"data-cy":`delete-passport-${x.name}`,size:"large",children:o.jsx(_e,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:e&&!q&&o.jsxs(o.Fragment,{children:[o.jsx(E,{onClick:u,color:"inherit",children:i("common.cancel")}),o.jsxs(E,{onClick:k,color:"primary",disabled:R||!x,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[R&&o.jsx(U,{size:16}),i("common.save")]})]}),children:[o.jsxs(Ue,{children:[!x&&o.jsx(Ge,{children:o.jsx(U,{})}),x&&o.jsxs("div",{className:"dialog-content",children:[o.jsxs("div",{className:"header",children:[o.jsx("div",{className:"title",children:x.title}),o.jsx("div",{className:"description",style:{marginTop:e?16:48},children:x.description})]}),Q]})]}),y&&o.jsx(Z,{teamDid:t,onCancel:()=>h(null),onSuccess:()=>{h(null),d?m():r()},mode:"update",roleName:y.name,item:y,orgId:d}),F&&o.jsx(Me,{title:F.title,description:F.description,confirm:F.confirm,cancel:F.cancel,params:F.params,onConfirm:F.onConfirm,onCancel:F.onCancel})]})}const We=me(J,"mutate_team"),Ve=me(J,"",le);function Oe(u){const{inService:m}=L();return m?o.jsx(Ve,{...u}):o.jsx(We,{...u})}J.propTypes={roleName:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onDelete:C.func.isRequired,hasPermission:C.bool,roles:C.array,orgId:C.string};const Ue=G.div`
6
+ */var O,se;function ke(){if(se)return O;se=1,O=function(a){return a!=null&&(u(a)||m(a)||!!a._isBuffer)};function u(a){return!!a.constructor&&typeof a.constructor.isBuffer=="function"&&a.constructor.isBuffer(a)}function m(a){return typeof a.readFloatLE=="function"&&typeof a.slice=="function"&&u(a.slice(0,0))}return O}var ie;function $e(){return ie||(ie=1,function(){var u=_e(),m=ne().utf8,a=ke(),c=ne().bin,l=function(p,d){p.constructor==String?d&&d.encoding==="binary"?p=c.stringToBytes(p):p=m.stringToBytes(p):a(p)?p=Array.prototype.slice.call(p,0):!Array.isArray(p)&&p.constructor!==Uint8Array&&(p=p.toString());for(var s=u.bytesToWords(p),f=p.length*8,n=1732584193,t=-271733879,r=-1732584194,e=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[f>>>5]|=128<<f%32,s[(f+64>>>9<<4)+14]=f;for(var v=l._ff,g=l._gg,y=l._hh,h=l._ii,i=0;i<s.length;i+=16){var F=n,D=t,R=r,w=e;n=v(n,t,r,e,s[i+0],7,-680876936),e=v(e,n,t,r,s[i+1],12,-389564586),r=v(r,e,n,t,s[i+2],17,606105819),t=v(t,r,e,n,s[i+3],22,-1044525330),n=v(n,t,r,e,s[i+4],7,-176418897),e=v(e,n,t,r,s[i+5],12,1200080426),r=v(r,e,n,t,s[i+6],17,-1473231341),t=v(t,r,e,n,s[i+7],22,-45705983),n=v(n,t,r,e,s[i+8],7,1770035416),e=v(e,n,t,r,s[i+9],12,-1958414417),r=v(r,e,n,t,s[i+10],17,-42063),t=v(t,r,e,n,s[i+11],22,-1990404162),n=v(n,t,r,e,s[i+12],7,1804603682),e=v(e,n,t,r,s[i+13],12,-40341101),r=v(r,e,n,t,s[i+14],17,-1502002290),t=v(t,r,e,n,s[i+15],22,1236535329),n=g(n,t,r,e,s[i+1],5,-165796510),e=g(e,n,t,r,s[i+6],9,-1069501632),r=g(r,e,n,t,s[i+11],14,643717713),t=g(t,r,e,n,s[i+0],20,-373897302),n=g(n,t,r,e,s[i+5],5,-701558691),e=g(e,n,t,r,s[i+10],9,38016083),r=g(r,e,n,t,s[i+15],14,-660478335),t=g(t,r,e,n,s[i+4],20,-405537848),n=g(n,t,r,e,s[i+9],5,568446438),e=g(e,n,t,r,s[i+14],9,-1019803690),r=g(r,e,n,t,s[i+3],14,-187363961),t=g(t,r,e,n,s[i+8],20,1163531501),n=g(n,t,r,e,s[i+13],5,-1444681467),e=g(e,n,t,r,s[i+2],9,-51403784),r=g(r,e,n,t,s[i+7],14,1735328473),t=g(t,r,e,n,s[i+12],20,-1926607734),n=y(n,t,r,e,s[i+5],4,-378558),e=y(e,n,t,r,s[i+8],11,-2022574463),r=y(r,e,n,t,s[i+11],16,1839030562),t=y(t,r,e,n,s[i+14],23,-35309556),n=y(n,t,r,e,s[i+1],4,-1530992060),e=y(e,n,t,r,s[i+4],11,1272893353),r=y(r,e,n,t,s[i+7],16,-155497632),t=y(t,r,e,n,s[i+10],23,-1094730640),n=y(n,t,r,e,s[i+13],4,681279174),e=y(e,n,t,r,s[i+0],11,-358537222),r=y(r,e,n,t,s[i+3],16,-722521979),t=y(t,r,e,n,s[i+6],23,76029189),n=y(n,t,r,e,s[i+9],4,-640364487),e=y(e,n,t,r,s[i+12],11,-421815835),r=y(r,e,n,t,s[i+15],16,530742520),t=y(t,r,e,n,s[i+2],23,-995338651),n=h(n,t,r,e,s[i+0],6,-198630844),e=h(e,n,t,r,s[i+7],10,1126891415),r=h(r,e,n,t,s[i+14],15,-1416354905),t=h(t,r,e,n,s[i+5],21,-57434055),n=h(n,t,r,e,s[i+12],6,1700485571),e=h(e,n,t,r,s[i+3],10,-1894986606),r=h(r,e,n,t,s[i+10],15,-1051523),t=h(t,r,e,n,s[i+1],21,-2054922799),n=h(n,t,r,e,s[i+8],6,1873313359),e=h(e,n,t,r,s[i+15],10,-30611744),r=h(r,e,n,t,s[i+6],15,-1560198380),t=h(t,r,e,n,s[i+13],21,1309151649),n=h(n,t,r,e,s[i+4],6,-145523070),e=h(e,n,t,r,s[i+11],10,-1120210379),r=h(r,e,n,t,s[i+2],15,718787259),t=h(t,r,e,n,s[i+9],21,-343485551),n=n+F>>>0,t=t+D>>>0,r=r+R>>>0,e=e+w>>>0}return u.endian([n,t,r,e])};l._ff=function(p,d,s,f,n,t,r){var e=p+(d&s|~d&f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._gg=function(p,d,s,f,n,t,r){var e=p+(d&f|s&~f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._hh=function(p,d,s,f,n,t,r){var e=p+(d^s^f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._ii=function(p,d,s,f,n,t,r){var e=p+(s^(d|~f))+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._blocksize=16,l._digestsize=16,A.exports=function(p,d){if(p==null)throw new Error("Illegal argument "+p);var s=u.wordsToBytes(l(p,d));return d&&d.asBytes?s:d&&d.asString?c.bytesToString(s):u.bytesToHex(s)}}()),A.exports}var ze=$e();const Ae=ge(ze);function G({teamDid:u,onCancel:m,onSuccess:a,onError:c=()=>{},mode:l="create",item:p={},orgId:d=""}){const{api:s}=E(),[f,n]=j.useState(!1),[t,r]=j.useState(""),{t:e}=L(),[i,v]=j.useState(p.title||""),[g,y]=j.useState(p.description||""),[h,F]=j.useState(p?.extra?.display||"builtin"),[D,R]=j.useState(p?.extra?.types?p.extra.types.join(","):""),w=async()=>{const x=i.trim();if(!x){r(e("team.passport.error.titleEmpty"));return}if(x.length>64){r(e("team.passport.error.titleTooLong",{length:64}));return}const N=g.replace(/\n/g," ");if(!N){r(e("team.passport.error.descriptionEmpty"));return}const I=l==="create"?Ae(d?`${d}-${x}`:x):p.name;r(null),n(!0);try{if(l==="create"){const S={teamDid:u,name:I,title:x,description:N,...d?{orgId:d}:{}};h==="custom"&&(S.extra=JSON.stringify({display:"custom",types:D.split(",")})),await s.createRole({input:S})}else{const S={teamDid:u,role:{name:I,title:x,description:N},...d?{orgId:d}:{}};await s.updateRole({input:S})}a()}catch(S){const _=pe(S);r(_),c(S)}finally{n(!1)}},M=o.jsxs("div",{children:[l==="update"&&o.jsx(H,{component:"div",style:{paddingTop:16},children:o.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:p.name,disabled:!0})}),o.jsx(H,{component:"div",style:{marginTop:16},children:o.jsx($,{label:e("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:i,onChange:x=>{r(null),v(x.target.value)},disabled:l==="update"||f,helperText:e("team.passport.create.titleTip")})}),o.jsx(H,{component:"div",style:{marginTop:16,marginBottom:16},children:o.jsx($,{label:e("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:g,onChange:x=>{r(null),y(x.target.value)},disabled:f,multiline:!0,rows:3})}),l==="create"&&o.jsxs("div",{style:{marginBottom:16},children:[o.jsx(ye,{children:e("common.display")}),o.jsxs(ve,{color:"primary",size:"small",value:h,exclusive:!0,style:{marginTop:16},disabled:f,onChange:(x,N)=>F(N),"data-cy":"input-role-display",children:[o.jsx(Y,{value:"builtin","data-cy":"input-role-display-builtin",children:o.jsx(H,{children:e("team.passport.displayBuiltin")})}),o.jsx(Y,{value:"custom","data-cy":"input-role-display-custom",children:o.jsx(H,{children:e("team.passport.displayCustom")})})]}),h==="custom"&&o.jsxs(o.Fragment,{children:[o.jsx(je,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:D,disabled:f,onChange:x=>{R(x.target.value)}}),o.jsx(Ce,{children:e("team.passport.typesTip")})]})]})]});return o.jsxs(ce,{title:l==="create"?e("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:m,showCloseButton:!1,actions:o.jsxs(o.Fragment,{children:[o.jsx(q,{onClick:m,color:"inherit",children:e("common.cancel")}),o.jsxs(q,{"data-cy":"mutate-role-confirm",onClick:w,color:"primary",disabled:f,variant:"contained",autoFocus:!0,children:[f&&o.jsx(U,{size:16}),e(l==="create"?"common.create":"common.update")]})]}),children:[o.jsx(Te,{component:"div",children:M}),!!t&&o.jsx(Fe,{severity:"error",style:{width:"100%",margin:0},children:t})]})}G.propTypes={teamDid:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onError:C.func,mode:C.oneOf(["create","update"]),item:C.object,orgId:C.string};function J({onCancel:u,onSuccess:m,onDelete:a,roleName:c,roles:l=void 0,hasPermission:p=!1,orgId:d=""}){const{api:s}=E(),{roles:f,permissions:n,teamDid:t,refresh:r,isNodeTeam:e}=de(),{t:i}=L(),[v,g]=j.useState([]),[y,h]=j.useState(!1),[F,D]=j.useState(null),[R,w]=j.useState(!1),M=j.useMemo(()=>l||f,[l,f]),x=Ie(M.find(T=>T.name===c)),N=ae(c),I=async T=>{if(!R)try{w(!0),await s.deleteRole({input:{teamDid:t,name:T}}),a()}catch(b){z.error(b.message)}finally{w(!1),D(null)}},S=async(T,b)=>{const fe=(await s.getPermissionsByRole({input:{teamDid:T,role:{name:b}}})).permissions||[],xe=n.map(X=>({...X,bind:fe.some(he=>he.name===X.name)}));g(xe)},_=async()=>{w(!0);const T=v.filter(b=>b.bind).map(b=>b.name);try{await s.updatePermissionsForRole({input:{teamDid:t,roleName:x.name,grantNames:T}}),z.success(i("common.saveSuccess")),m()}catch(b){z.error(pe(b))}finally{w(!1)}};j.useEffect(()=>{t&&c&&S(t,c)},[t,c]);const k=e||!p;let Q=null;return e&&(Q=o.jsxs("div",{className:"bind",children:[o.jsx("div",{className:"title",children:i("common.permission")}),o.jsx("div",{className:"list",children:v.filter(T=>k?T.bind:!0).map(T=>o.jsx("div",{className:"item",children:o.jsx(be,{control:o.jsx(we,{disabled:k,checked:T.bind,onChange:()=>{g(b=>b.map(P=>(P.name===T.name&&(P.bind=!P.bind),P)))},name:T.name}),label:T.description})}))})]})),o.jsxs(ce,{title:i("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:p&&!N&&o.jsxs(o.Fragment,{children:[o.jsx(K,{onClick:()=>h(x),"data-cy":`edit-passport-${x.name}`,size:"large",children:o.jsx(ue,{fill:"#bfbfbf"})}),o.jsx(K,{onClick:()=>D({title:i("team.passport.delete.title"),description:i("team.passport.delete.description",{name:x.title}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>{I(x.name)},onCancel:()=>{w(!1),D(null)}}),"data-cy":`delete-passport-${x.name}`,size:"large",children:o.jsx(Me,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:e&&!k&&o.jsxs(o.Fragment,{children:[o.jsx(q,{onClick:u,color:"inherit",children:i("common.cancel")}),o.jsxs(q,{onClick:_,color:"primary",disabled:R||!x,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[R&&o.jsx(U,{size:16}),i("common.save")]})]}),children:[o.jsxs(Ue,{children:[!x&&o.jsx(Ze,{children:o.jsx(U,{})}),x&&o.jsxs("div",{className:"dialog-content",children:[o.jsxs("div",{className:"header",children:[o.jsx("div",{className:"title",children:x.title}),o.jsx("div",{className:"description",style:{marginTop:e?16:48},children:x.description})]}),Q]})]}),y&&o.jsx(G,{teamDid:t,onCancel:()=>h(null),onSuccess:()=>{h(null),d?m():r()},mode:"update",roleName:y.name,item:y,orgId:d}),F&&o.jsx(Le,{title:F.title,description:F.description,confirm:F.confirm,cancel:F.cancel,params:F.params,onConfirm:F.onConfirm,onCancel:F.onCancel})]})}const We=me(J,"mutate_team"),Ve=me(J,"",le);function Oe(u){const{inService:m}=E();return m?o.jsx(Ve,{...u}):o.jsx(We,{...u})}J.propTypes={roleName:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onDelete:C.func.isRequired,hasPermission:C.bool,roles:C.array,orgId:C.string};const Ue=Z.div`
7
7
  .header {
8
8
  .title {
9
9
  font-weight: 400;
@@ -46,13 +46,13 @@ import{r as j,g as ge}from"./vendor-react-Dvs43sk9.js";import{j as o,T as H,z as
46
46
  padding-right: 12px;
47
47
  }
48
48
  }
49
- `,Ge=G.div`
49
+ `,Ze=Z.div`
50
50
  flex: 1;
51
51
  display: flex;
52
52
  justify-content: center;
53
53
  align-items: center;
54
54
  height: 200px;
55
- `,oe=j.memo(({field:u,value:m,copyable:a})=>{const{local:c}=M();return m?o.jsxs(B,{onClick:l=>l.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?o.jsxs(ee,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,o.jsx(ee,{variant:"body1",children:o.jsxs(B,{sx:{display:"flex",alignItems:"center"},children:[o.jsx(Re,{title:m,children:o.jsx("span",{className:"value-ellipsis",children:m})}),a?o.jsx(Pe,{content:Ee(m),locale:c,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null}),Ze=j.memo(({role:u={},createPassportSvg:m,onUpdate:a,passportProps:c={},actions:l=null})=>{const{inService:p}=L(),d=Se(f=>f.breakpoints.down("md")),s=j.useMemo(()=>u.name&&!Ne.ROLES[u.name.toUpperCase()],[u]);return o.jsxs(B,{"data-cy":`passport-${u.name}`,className:"item",onClick:()=>a(u),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[o.jsxs(B,{sx:{display:"flex",alignItems:"center"},children:[o.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:m({title:u.title,ownerName:"Your Name",width:"150px",...c})}}),o.jsxs(B,{className:"title",sx:{ml:3},children:[o.jsx(oe,{value:u.title}),s?o.jsx(oe,{value:u.name,copyable:!0}):null]})]}),!d&&o.jsx(B,{className:"description",children:u.description}),l||o.jsx(Le,{permission:p?"":"mutate_team",role:p?le:[],children:o.jsx("div",{className:"action",children:ae(u.name)?o.jsx(He,{}):o.jsx(ue,{})})})]},u.name)});function Je({createPassportSvg:u}){const{roles:m,teamIssuerDid:a,teamName:c,refresh:l,passportColor:p,teamDid:d,isNodeTeam:s}=de(),{t:f}=M(),[n,t]=j.useState(!1),[r,e]=j.useState(!1);return o.jsxs(Qe,{sx:{mt:0},children:[o.jsx(B,{sx:{display:"flex",justifyContent:"flex-end"},children:!s&&o.jsxs(Be,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[o.jsx(De,{style:{fontSize:16,marginRight:4}}),f("team.passport.create.title")]})}),o.jsx(B,{className:"list",children:m.map(i=>o.jsx(Ze,{role:i,createPassportSvg:u,onUpdate:e,passportProps:{issuer:c,issuerDid:a,ownerDid:a,preferredColor:p}}))}),r&&o.jsx(Oe,{onCancel:()=>e(!1),onSuccess:()=>{e(!1),l()},onDelete:()=>{e(!1),l()},mode:"update",roleName:r.name,item:r}),n&&o.jsx(Z,{teamDid:d,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const Qe=G(B)`
55
+ `,oe=j.memo(({field:u,value:m,copyable:a})=>{const{local:c}=L();return m?o.jsxs(B,{onClick:l=>l.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?o.jsxs(ee,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,o.jsx(ee,{variant:"body1",children:o.jsxs(B,{sx:{display:"flex",alignItems:"center"},children:[o.jsx(Re,{title:m,children:o.jsx("span",{className:"value-ellipsis",children:m})}),a?o.jsx(Pe,{content:qe(m),locale:c,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null}),Ge=j.memo(({role:u={},createPassportSvg:m,onUpdate:a,passportProps:c={},actions:l=null})=>{const{inService:p}=E(),d=Se(f=>f.breakpoints.down("md")),s=j.useMemo(()=>u.name&&!Ne.ROLES[u.name.toUpperCase()],[u]);return o.jsxs(B,{"data-cy":`passport-${u.name}`,className:"item",onClick:()=>a(u),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[o.jsxs(B,{sx:{display:"flex",alignItems:"center"},children:[o.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:m({title:u.title,ownerName:"Your Name",width:"150px",...c})}}),o.jsxs(B,{className:"title",sx:{ml:3},children:[o.jsx(oe,{value:u.title}),s?o.jsx(oe,{value:u.name,copyable:!0}):null]})]}),!d&&o.jsx(B,{className:"description",children:u.description}),l||o.jsx(Ee,{permission:p?"":"mutate_team",role:p?le:[],children:o.jsx("div",{className:"action",children:ae(u.name)?o.jsx(He,{}):o.jsx(ue,{})})})]},u.name)});function Je({createPassportSvg:u}){const{roles:m,teamIssuerDid:a,teamName:c,refresh:l,passportColor:p,teamDid:d,isNodeTeam:s}=de(),{t:f}=L(),[n,t]=j.useState(!1),[r,e]=j.useState(!1);return o.jsxs(Qe,{sx:{mt:0},children:[o.jsx(B,{sx:{display:"flex",justifyContent:"flex-end"},children:!s&&o.jsxs(Be,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[o.jsx(De,{style:{fontSize:16,marginRight:4}}),f("team.passport.create.title")]})}),o.jsx(B,{className:"list",children:m.map(i=>o.jsx(Ge,{role:i,createPassportSvg:u,onUpdate:e,passportProps:{issuer:c,issuerDid:a,ownerDid:a,preferredColor:p}}))}),r&&o.jsx(Oe,{onCancel:()=>e(!1),onSuccess:()=>{e(!1),l()},onDelete:()=>{e(!1),l()},mode:"update",roleName:r.name,item:r}),n&&o.jsx(G,{teamDid:d,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const Qe=Z(B)`
56
56
  .list {
57
57
  .item {
58
58
  padding: 12px;
@@ -90,4 +90,4 @@ import{r as j,g as ge}from"./vendor-react-Dvs43sk9.js";import{j as o,T as H,z as
90
90
  fill: ${({theme:u})=>u.palette.text.secondary};
91
91
  }
92
92
  }
93
- `;Je.propTypes={createPassportSvg:C.func.isRequired};export{Qe as D,_e as H,Z as M,Je as P,Ze as a,J as b};
93
+ `;Je.propTypes={createPassportSvg:C.func.isRequired};export{Qe as D,Me as H,G as M,Je as P,Ge as a,J as b};
@@ -1 +1 @@
1
- import{j as e,ak as u,D as y,P as C}from"./vendor-mui-core-DRxbhqaK.js";import{r as c}from"./vendor-react-Dvs43sk9.js";import{aM as j,aN as w,aO as b,aP as P,aQ as A}from"./index-Dkx4Mp12.js";import{o as m,$ as D}from"./vendor-ux-B9VfuZTg.js";var t=(r=>(r.AvatarOnly="AvatarOnly",r.Detailed="Detailed",r))(t||{}),h=(r=>(r.Minimal="Minimal",r.Basic="Basic",r))(h||{});function R(r){const{user:a,infoType:i,avatarSize:s=48,shouldShowHoverCard:n=!1,renderCardContent:o,...p}=r;return e.jsx(j,{user:a,avatarSize:s,shouldShowHoverCard:n,renderCardContent:o,...p})}function T({...r}){const{user:a,avatarSize:i=40,renderCustomContent:s,infoType:n=h.Minimal,renderFields:o,popupRenderFields:p,...l}=r;return e.jsxs(u,{sx:{display:"flex",flexDirection:"column",width:"100%",flex:1,height:"100%"},children:[e.jsx(w,{user:a,avatarSize:i,...l}),n===h.Basic&&e.jsx(b,{user:a,renderFields:o}),e.jsx(u,{className:"user-card__footer",children:s&&e.jsx(u,{sx:{mt:1.5},children:s()})})]})}function v({...r}){return e.jsx(T,{...r})}function z({children:r,sx:a={}}){const i=y();return e.jsx(u,{sx:m({p:2,backgroundColor:i.palette.background.paper,border:"1px solid",borderColor:"divider",borderRadius:1,maxWidth:500,minWidth:320,display:"flex"},a||null),children:r})}function F({children:r,cardType:a=t.Detailed,variant:i="box",containerRef:s=void 0,sx:n={}}){const o={minWidth:320,p:2,borderRadius:1,...a===t.Detailed?{border:"1px solid",borderColor:"divider"}:{}};return i==="paper"?e.jsx(C,{ref:s,elevation:0,sx:o,children:r}):e.jsx(u,{ref:s,sx:m(o,{display:"flex",alignItems:a===t.AvatarOnly?"center":"flex-start",gap:2},n||null),children:r})}function B(r){const{cardType:a=t.Detailed,showHoverCard:i}=r,s=i!==void 0?i:a===t.AvatarOnly,n=c.useRef(null),[o,p]=c.useState(()=>r.user||null);c.useEffect(()=>{let d=!0;return r.user?p(r.user):r.did&&P(r.did)&&!r.user&&A(r.did).then(x=>{d&&p(x||{fullName:"Anonymous",did:r.did,avatar:""})}),()=>{d=!1}},[r.did,r.user]);const l=c.useMemo(()=>{if(!o)return null;const{avatar:d="",...x}=o;if(d){const S=d.split("?")[1]||"";return{...x,avatar:S?d:`${d}?imageFilter=resize&w=48&h=48`}}return o},[o]);if(!l)return e.jsx(D,{did:r.did,size:r.avatarSize,useProxyFallback:!0,...r.avatarProps});const f=()=>e.jsx(z,{sx:r.popupSx,children:e.jsx(v,{...r,shouldShowHoverCard:!1,user:l,avatarProps:r.popupAvatarProps,shortenLabelProps:r.popupShortenLabelProps||r.shortenLabelProps,renderFields:r.popupRenderFields,renderName:r.popupRenderName,infoType:r.popupInfoType||r.infoType,didProps:r.popupDidProps||r.didProps,showDid:r.popupShowDid||r.showDid,showSocialActions:r.popupShowSocialActions===void 0?r.showSocialActions:r.popupShowSocialActions})});return a===t.AvatarOnly?e.jsx(R,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l}):e.jsx(F,{containerRef:n,cardType:a,sx:r.sx,children:e.jsx(v,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l})})}export{B,t as l,h as o};
1
+ import{j as e,ak as u,D as y,P as C}from"./vendor-mui-core-BFPsXaTR.js";import{r as c}from"./vendor-react-Dvs43sk9.js";import{aN as j,aO as w,aP as b,aQ as P,aR as A}from"./index-CmM1Fb8I.js";import{o as m,$ as D}from"./vendor-ux-CE4sOH7O.js";var t=(r=>(r.AvatarOnly="AvatarOnly",r.Detailed="Detailed",r))(t||{}),h=(r=>(r.Minimal="Minimal",r.Basic="Basic",r))(h||{});function R(r){const{user:a,infoType:i,avatarSize:s=48,shouldShowHoverCard:n=!1,renderCardContent:o,...p}=r;return e.jsx(j,{user:a,avatarSize:s,shouldShowHoverCard:n,renderCardContent:o,...p})}function T({...r}){const{user:a,avatarSize:i=40,renderCustomContent:s,infoType:n=h.Minimal,renderFields:o,popupRenderFields:p,...l}=r;return e.jsxs(u,{sx:{display:"flex",flexDirection:"column",width:"100%",flex:1,height:"100%"},children:[e.jsx(w,{user:a,avatarSize:i,...l}),n===h.Basic&&e.jsx(b,{user:a,renderFields:o}),e.jsx(u,{className:"user-card__footer",children:s&&e.jsx(u,{sx:{mt:1.5},children:s()})})]})}function v({...r}){return e.jsx(T,{...r})}function z({children:r,sx:a={}}){const i=y();return e.jsx(u,{sx:m({p:2,backgroundColor:i.palette.background.paper,border:"1px solid",borderColor:"divider",borderRadius:1,maxWidth:500,minWidth:320,display:"flex"},a||null),children:r})}function F({children:r,cardType:a=t.Detailed,variant:i="box",containerRef:s=void 0,sx:n={}}){const o={minWidth:320,p:2,borderRadius:1,...a===t.Detailed?{border:"1px solid",borderColor:"divider"}:{}};return i==="paper"?e.jsx(C,{ref:s,elevation:0,sx:o,children:r}):e.jsx(u,{ref:s,sx:m(o,{display:"flex",alignItems:a===t.AvatarOnly?"center":"flex-start",gap:2},n||null),children:r})}function B(r){const{cardType:a=t.Detailed,showHoverCard:i}=r,s=i!==void 0?i:a===t.AvatarOnly,n=c.useRef(null),[o,p]=c.useState(()=>r.user||null);c.useEffect(()=>{let d=!0;return r.user?p(r.user):r.did&&P(r.did)&&!r.user&&A(r.did).then(x=>{d&&p(x||{fullName:"Anonymous",did:r.did,avatar:""})}),()=>{d=!1}},[r.did,r.user]);const l=c.useMemo(()=>{if(!o)return null;const{avatar:d="",...x}=o;if(d){const S=d.split("?")[1]||"";return{...x,avatar:S?d:`${d}?imageFilter=resize&w=48&h=48`}}return o},[o]);if(!l)return e.jsx(D,{did:r.did,size:r.avatarSize,useProxyFallback:!0,...r.avatarProps});const f=()=>e.jsx(z,{sx:r.popupSx,children:e.jsx(v,{...r,shouldShowHoverCard:!1,user:l,avatarProps:r.popupAvatarProps,shortenLabelProps:r.popupShortenLabelProps||r.shortenLabelProps,renderFields:r.popupRenderFields,renderName:r.popupRenderName,infoType:r.popupInfoType||r.infoType,didProps:r.popupDidProps||r.didProps,showDid:r.popupShowDid||r.showDid,showSocialActions:r.popupShowSocialActions===void 0?r.showSocialActions:r.popupShowSocialActions})});return a===t.AvatarOnly?e.jsx(R,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l}):e.jsx(F,{containerRef:n,cardType:a,sx:r.sx,children:e.jsx(v,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l})})}export{B,t as l,h as o};