@abtnode/blocklet-services 1.16.43-beta-20250419-231352-c78ac93d → 1.16.43-beta-20250422-042711-c40bec75

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 (217) hide show
  1. package/api/services/auth/connect/gen-access-key.js +9 -2
  2. package/api/services/auth/session.js +7 -4
  3. package/dist/assets/{AdapterDayjs-DBd25Gc9.js → AdapterDayjs-DcprbhsV.js} +1 -1
  4. package/dist/assets/{ArrowDropDown-CplPoZk0.js → ArrowDropDown-BHNhtNqo.js} +1 -1
  5. package/dist/assets/{CheckCircle-DKW0gPt9.js → CheckCircle-C7lAzkFm.js} +1 -1
  6. package/dist/assets/{ChevronLeft-f4mXxiqC.js → ChevronLeft-fcaEvvT2.js} +1 -1
  7. package/dist/assets/{ChevronRight-I8lL2o6m.js → ChevronRight-BWcj-otI.js} +1 -1
  8. package/dist/assets/{Community-eISlOOkV.js → Community-BXFIKoZW.js} +1 -1
  9. package/dist/assets/{DeleteOutline-gXV6-Yj1.js → DeleteOutline-CMgoFNHT.js} +1 -1
  10. package/dist/assets/{Done-D7ovxqe0.js → Done-CkkNExgL.js} +1 -1
  11. package/dist/assets/{Download-DnSJYUu9.js → Download-B1KcU2Zd.js} +1 -1
  12. package/dist/assets/{Edit-K6PObbWp.js → Edit-C-ChSGAK.js} +1 -1
  13. package/dist/assets/{EditIcon-CQgpOLLT.js → EditIcon-BRKobKzh.js} +1 -1
  14. package/dist/assets/{Email-BWTg6iJI.js → Email-7cDhevM1.js} +1 -1
  15. package/dist/assets/{Error-Cpr3WuZf.js → Error-Du9QXuYs.js} +1 -1
  16. package/dist/assets/{ExpandLess-CfCbhFiC.js → ExpandLess-Cdn0T-U2.js} +1 -1
  17. package/dist/assets/{Google-BPbeA72O.js → Google-3Ox3gIL3.js} +1 -1
  18. package/dist/assets/{Holiday-C3bRTVlx.js → Holiday-BtexoPxk.js} +1 -1
  19. package/dist/assets/{InfoOutlined-Cxodw3Dd.js → InfoOutlined-ZIQMeu0p.js} +1 -1
  20. package/dist/assets/{Launch-BtCtZYws.js → Launch-qJWNGQwX.js} +1 -1
  21. package/dist/assets/{LaunchOutlined--YSktZgX.js → LaunchOutlined-BVUDVgft.js} +1 -1
  22. package/dist/assets/LoadingButton-D_tuQuaP.js +1 -0
  23. package/dist/assets/{Location-C_mUMqZP.js → Location-BF9BwrVf.js} +1 -1
  24. package/dist/assets/{LockIcon-G8zLxYzV.js → LockIcon-L5QI4AoC.js} +1 -1
  25. package/dist/assets/{Meeting-vvmUKHs1.js → Meeting-gc3Ts6jN.js} +1 -1
  26. package/dist/assets/{MoreHoriz-ChU2hdzJ.js → MoreHoriz-ByNTWUxY.js} +1 -1
  27. package/dist/assets/{OffSick-BTxtVws3.js → OffSick-_EZgqU01.js} +1 -1
  28. package/dist/assets/{Phone-Cz_yY8ed.js → Phone-oJLFEdfI.js} +1 -1
  29. package/dist/assets/{PlayArrow-sN_fSbsI.js → PlayArrow-rSzT1Thf.js} +1 -1
  30. package/dist/assets/{QuestionMarkCircle-DeAbZuzW.js → QuestionMarkCircle-Cw7EtCDd.js} +1 -1
  31. package/dist/assets/{ServerLogo-UZVUmHWK.js → ServerLogo-zdbLsMaw.js} +1 -1
  32. package/dist/assets/{Timezone-5RxC7sK-.js → Timezone-BtCtoEo9.js} +1 -1
  33. package/dist/assets/{TuneOutlined-CiDODSgi.js → TuneOutlined-BnxAi8kP.js} +1 -1
  34. package/dist/assets/{ViewList-BgK0KBCz.js → ViewList-DbzNMeex.js} +1 -1
  35. package/dist/assets/{WorkingRemotely-_QD8QN72.js → WorkingRemotely-YBya8rZT.js} +1 -1
  36. package/dist/assets/{access-control-Py8YI7Sg.js → access-control-q2DA79L8.js} +1 -1
  37. package/dist/assets/actions-J8MFA_6y.js +1 -0
  38. package/dist/assets/{add-component-core-Qy10hfGq.js → add-component-core-IYRc9eac.js} +30 -30
  39. package/dist/assets/{add-resource--JfwloZn.js → add-resource-8w2aCwfA.js} +1 -1
  40. package/dist/assets/{addon-BF7ni3fn.js → addon-BQEpbqTR.js} +1 -1
  41. package/dist/assets/{advanced--o9qksiV.js → advanced-CX8tZItX.js} +1 -1
  42. package/dist/assets/api-BrU7j0QA.js +1 -0
  43. package/dist/assets/appearance-C5895lZP.js +1 -0
  44. package/dist/assets/{audit-logs-CXRUUhqH.js → audit-logs-DukS3LSM.js} +3 -3
  45. package/dist/assets/authorize-CEHLfOxJ.js +1 -0
  46. package/dist/assets/{base32-CWI-u9nV.js → base32--dljmFCF.js} +1 -1
  47. package/dist/assets/{branding-D9uh0isl.js → branding-Abk6CVlX.js} +1 -1
  48. package/dist/assets/branding-Cczews7F.js +40 -0
  49. package/dist/assets/bundle-avatar-DFwyxj9P.js +1 -0
  50. package/dist/assets/button-CJk6Iiza.js +1 -0
  51. package/dist/assets/click-to-copy-CbKZyfyr.js +1 -0
  52. package/dist/assets/cloneDeep-SfcdeqEN.js +1 -0
  53. package/dist/assets/{complete-DVY-bJt4.js → complete-ejUOC1cY.js} +2 -2
  54. package/dist/assets/{component-DvDJBvwl.js → component-BOLQzzEI.js} +2 -2
  55. package/dist/assets/{config-ogNfLnBw.js → config-Bv0DcfgY.js} +2 -2
  56. package/dist/assets/{config-BQCgx2fR.js → config-efFznM9P.js} +1 -1
  57. package/dist/assets/{config-navigation-gxUAyoWT.js → config-navigation-1cuUaRsL.js} +6 -6
  58. package/dist/assets/{config-space-BVobvnPL.js → config-space-DEku2tJv.js} +1 -1
  59. package/dist/assets/confirm-miQS3Z1c.js +7 -0
  60. package/dist/assets/connect-0B3z_kZV.js +5 -0
  61. package/dist/assets/{connect-CZiBZEfi.js → connect-OYujfpaQ.js} +1 -1
  62. package/dist/assets/connect-to-C-vFK0ym.js +1 -0
  63. package/dist/assets/{content-layout-Cg5RRv1R.js → content-layout-JixQ7owc.js} +1 -1
  64. package/dist/assets/dashboard-C9tAGBV0.js +280 -0
  65. package/dist/assets/{delete-confirm-XK8jSuf8.js → delete-confirm-kKb8VxbQ.js} +1 -1
  66. package/dist/assets/{did-address-CQl19Nvh.js → did-address-DNf_-NM-.js} +1 -1
  67. package/dist/assets/domain-RAN90v9n.js +9 -0
  68. package/dist/assets/domain-action-card-BNybk5kq.js +25 -0
  69. package/dist/assets/domains-B51g2OQM.js +1 -0
  70. package/dist/assets/dot-xwsgXXMo.js +7 -0
  71. package/dist/assets/{email-C_xHssUU.js → email-CBFKGDtB.js} +3 -3
  72. package/dist/assets/{empty-spinner-yzHJfTIe.js → empty-spinner-Rr_2DR73.js} +1 -1
  73. package/dist/assets/{exchange-passport-hQXgq3GD.js → exchange-passport-2U7cUaM-.js} +1 -1
  74. package/dist/assets/{format-error-LAoTjvJe.js → format-error-BrmqJs5a.js} +1 -1
  75. package/dist/assets/{fuel-DVf4_c57.js → fuel-Ctl6kh4M.js} +1 -1
  76. package/dist/assets/{gen-access-key-DpUd0FlR.js → gen-access-key-CIrRotRy.js} +2 -2
  77. package/dist/assets/{get-safe-url-B-sc0A-n.js → get-safe-url-BXaepgsm.js} +1 -1
  78. package/dist/assets/{get-safe-url-B_RF0YU0.js → get-safe-url-MZ-ksvtD.js} +1 -1
  79. package/dist/assets/{home-DMgMCymt.js → home-C2Bgs4zS.js} +1 -1
  80. package/dist/assets/{iframe-4UgdZZC1.js → iframe-oHkt22fl.js} +1 -1
  81. package/dist/assets/{index-CHnniEyF.js → index-51ncOoae.js} +2 -2
  82. package/dist/assets/{index-BkddeMo4.js → index-B1-S-x6B.js} +32 -32
  83. package/dist/assets/{index-DDQJBjEj.js → index-B1EwWGHW.js} +4 -4
  84. package/dist/assets/index-B1ljmpu4.css +1 -0
  85. package/dist/assets/{index-CsgM0f6J.js → index-BRXM9-_y.js} +1 -1
  86. package/dist/assets/{index-DLKBGmpX.js → index-BT3gX_Gs.js} +1 -1
  87. package/dist/assets/index-BWx6ivvZ.js +708 -0
  88. package/dist/assets/{index-WrR7FOJW.js → index-BaU0U5xc.js} +10 -10
  89. package/dist/assets/index-BiIKWZTs.js +113 -0
  90. package/dist/assets/{index-B0Z8409R.js → index-C3XAI9I7.js} +1 -1
  91. package/dist/assets/{index-DpPN2Hn-.js → index-C7UL-KG1.js} +2 -2
  92. package/dist/assets/{index-Cy-N-WWk.js → index-CILVFQJH.js} +4 -4
  93. package/dist/assets/{index-Pg83GFwT.js → index-CNpN35y4.js} +1 -1
  94. package/dist/assets/{index-pV_0wOyY.js → index-CPE8Apzb.js} +1 -1
  95. package/dist/assets/{index-haYY8BAk.js → index-CYeIiQ6Q.js} +1 -1
  96. package/dist/assets/index-CzzLOOSx.js +55 -0
  97. package/dist/assets/{index-C7N2sf_h.js → index-DGPhY8xp.js} +2 -2
  98. package/dist/assets/{index-I8x_0gIy.js → index-DHdYd4nT.js} +3 -3
  99. package/dist/assets/index-DHjPgdgK.js +1 -0
  100. package/dist/assets/{index-CEMXycV7.js → index-DQc29-JM.js} +1 -1
  101. package/dist/assets/{index-tUQxVYYQ.js → index-DVQCgvFb.js} +1 -1
  102. package/dist/assets/{index-CgtY16Wm.js → index-DhGZEbPZ.js} +1 -1
  103. package/dist/assets/index-Ds7z-vG7.js +10 -0
  104. package/dist/assets/{index-CtXa7h2w.js → index-GJgyTjK2.js} +9 -9
  105. package/dist/assets/{index-DPgbycNO.js → index-Hl4sXXdc.js} +1 -1
  106. package/dist/assets/{index-BjmnM2sd.js → index-ILkKQT7G.js} +1 -1
  107. package/dist/assets/{index-kqlC8JFQ.js → index-YbJjfDTR.js} +1 -1
  108. package/dist/assets/{index-GjE02L4C.js → index-qcSTfn8X.js} +2 -2
  109. package/dist/assets/{invitation-BHGagSLV.js → invitation-CPSru_8S.js} +4 -4
  110. package/dist/assets/invite-DquuAqEb.js +1 -0
  111. package/dist/assets/issue-passport-DW27M9Fi.js +1 -0
  112. package/dist/assets/{item-BF4KPkcQ.js → item-CdEFLc19.js} +1 -1
  113. package/dist/assets/{landing-page-D5MYBFUa.js → landing-page-DPD1zNWJ.js} +1 -1
  114. package/dist/assets/{launch-result-message-Ckk5lRW7.js → launch-result-message-yorrVgpQ.js} +1 -1
  115. package/dist/assets/{layout-aojLTImI.js → layout-DBsOgAhr.js} +1 -1
  116. package/dist/assets/{list-Dc8Jfe8L.js → list-BNd4p4TF.js} +8 -7
  117. package/dist/assets/{list-header-BYlc5SI1.js → list-header-BTUducS9.js} +1 -1
  118. package/dist/assets/localization-CS7BsCef.js +1 -0
  119. package/dist/assets/{log-DOIIPe_H.js → log-R8TIkchf.js} +1 -1
  120. package/dist/assets/logger-d2Lh_KCF.js +1 -0
  121. package/dist/assets/{login-CWe2jVnz.js → login-Dgvm6HMJ.js} +1 -1
  122. package/dist/assets/{login-oauth-callback-DX0RUZbI.js → login-oauth-callback-rmUYgE44.js} +1 -1
  123. package/dist/assets/logo-uploader-Bv2ZSxJV.js +133 -0
  124. package/dist/assets/{lost-passport-3IUMBdMK.js → lost-passport-CiVM9B2L.js} +4 -4
  125. package/dist/assets/{lottie-react.esm-CPHH620R.js → lottie-react.esm-D2t-u0YU.js} +1 -1
  126. package/dist/assets/{lottie-web-B6s7dDoL.js → lottie-web-jYmAQWuC.js} +1 -1
  127. package/dist/assets/omit-bLid3PKQ.js +1 -0
  128. package/dist/assets/{open-window-C9M0sLPo.js → open-window-D2wkW326.js} +1 -1
  129. package/dist/assets/{overview-DXBkrcK9.js → overview-C_fDcPQA.js} +2 -2
  130. package/dist/assets/{page-header-CtJV2gil.js → page-header-C86YQnHE.js} +1 -1
  131. package/dist/assets/{passport-item-Eb0O4plM.js → passport-item-C4X2VZeo.js} +1 -1
  132. package/dist/assets/{permission-Bua36Doc.js → permission-CbDCh9eS.js} +1 -1
  133. package/dist/assets/preferences-Cdzon7pe.js +1 -0
  134. package/dist/assets/profile-embed-Dr2ZxkvM.js +1 -0
  135. package/dist/assets/publish-resource-DumHfLtC.js +1 -0
  136. package/dist/assets/{raf-schd.esm-GV-XhwE0.js → raf-schd.esm-B3j6BePR.js} +1 -1
  137. package/dist/assets/{react-beautiful-dnd.esm-QRb5iprr.js → react-beautiful-dnd.esm-kcYalw4r.js} +1 -1
  138. package/dist/assets/{relative-time-BTIpMkPf.js → relative-time-Dkz5qmEb.js} +1 -1
  139. package/dist/assets/runtime-HBzWjxDb.js +1 -0
  140. package/dist/assets/sdk-DuZx5LYY.js +1 -0
  141. package/dist/assets/{security-fEJBFCBy.js → security-BFBpBlQy.js} +4 -4
  142. package/dist/assets/session-CdQbSkeB.js +1 -0
  143. package/dist/assets/setup-BSfklNq4.js +19 -0
  144. package/dist/assets/{shorten-label-8jfEkawx.js → shorten-label-Dz7RgJfj.js} +1 -1
  145. package/dist/assets/{simple-select-CNZc1N7Q.js → simple-select-BlUQXxNL.js} +1 -1
  146. package/dist/assets/{slicedToArray-gyBkcGHe.js → slicedToArray-lOWXD6Th.js} +1 -1
  147. package/dist/assets/{spaces-970nXC4W.js → spaces-CcTi9vap.js} +1 -1
  148. package/dist/assets/{start-2a5gIZRp.js → start-BitVK7fH.js} +1 -1
  149. package/dist/assets/{status-DBrvkky_.js → status-F7OR8ZWk.js} +1 -1
  150. package/dist/assets/{step-actions-6TYxd1MB.js → step-actions-Cmh5n2jE.js} +1 -1
  151. package/dist/assets/{studio-DbIZ4lHD.js → studio-CW2bLcBh.js} +1 -1
  152. package/dist/assets/{switch-control-Bw3ohhMA.js → switch-control-BjOmRKBW.js} +1 -1
  153. package/dist/assets/{traffic-DBgXOCbQ.js → traffic-CcfffSvS.js} +2 -2
  154. package/dist/assets/{transfer-B0de7VRU.js → transfer-DHcMO-R4.js} +1 -1
  155. package/dist/assets/{unsubscribe-CUEA_4Ow.js → unsubscribe-DnPmucfC.js} +1 -1
  156. package/dist/assets/{use-app-logo-DoDXvoIT.js → use-app-logo-DnfizCGM.js} +1 -1
  157. package/dist/assets/{use-mobile-BbxjRR_q.js → use-mobile-Bgy7gTTP.js} +1 -1
  158. package/dist/assets/{use-mobile-T-9_nK_m.js → use-mobile-CcdVxg80.js} +1 -1
  159. package/dist/assets/useAsync-70zHrUMr.js +1 -0
  160. package/dist/assets/useAsync-BquSRC77.js +1 -0
  161. package/dist/assets/{useLocalStorage-CkST2tLi.js → useLocalStorage-BJb7uGDO.js} +1 -1
  162. package/dist/assets/{useSetState-BL3ktMon.js → useSetState-CWq0AVWn.js} +1 -1
  163. package/dist/assets/user-center-u43jJYr4.js +77 -0
  164. package/dist/assets/{util-Bt5DR42K.js → util-BYLEVYA_.js} +1 -1
  165. package/dist/assets/{util-BUnBptcm.js → util-CJbxj6IE.js} +1 -1
  166. package/dist/assets/{vendor-arcblock-CBc_0mJh.js → vendor-arcblock-CWji6U03.js} +300 -300
  167. package/dist/assets/{vendor-hooks-jg6xPUPF.js → vendor-hooks-DftG_2gV.js} +2 -2
  168. package/dist/assets/{vendor-mui-core-DiDsSLd-.js → vendor-mui-core-CfA4EdRA.js} +26 -26
  169. package/dist/assets/{vendor-mui-x-mVhD3N7n.js → vendor-mui-x-DSNWmGVo.js} +1 -1
  170. package/dist/assets/{vendor-react-DoD83n6N.js → vendor-react-DEoibe3W.js} +1 -1
  171. package/dist/assets/vendor-utils-BNHJB5U7.js +208 -0
  172. package/dist/assets/vendor-ux-did-connect-zBIy2ulO.js +2265 -0
  173. package/dist/assets/{wrap-locale-CJY3ql5f.js → wrap-locale-BSYWBgCo.js} +1 -1
  174. package/dist/assets/zh-_GYrLCB8.js +1 -0
  175. package/dist/index.html +9 -8
  176. package/dist/service-worker.js +1 -1
  177. package/package.json +30 -28
  178. package/dist/assets/actions-C-bMrlCM.js +0 -1
  179. package/dist/assets/api-DwjKcjK8.js +0 -1
  180. package/dist/assets/appearance-DQ7WvKeM.js +0 -1
  181. package/dist/assets/authorize-DUug1C68.js +0 -1
  182. package/dist/assets/branding-BS99MP-h.js +0 -40
  183. package/dist/assets/bundle-avatar-nPtHnMPN.js +0 -1
  184. package/dist/assets/button-BxdaIS5g.js +0 -1
  185. package/dist/assets/click-to-copy-CTfzGpml.js +0 -1
  186. package/dist/assets/cloneDeep-DUYD8ZBI.js +0 -1
  187. package/dist/assets/confirm-DVW7YBsC.js +0 -7
  188. package/dist/assets/connect-C1ax2q5c.js +0 -5
  189. package/dist/assets/connect-to-CzcgHUZG.js +0 -1
  190. package/dist/assets/dashboard-CP2P7oxj.js +0 -279
  191. package/dist/assets/domain-Gbwc_7wY.js +0 -9
  192. package/dist/assets/domain-action-card-kpBwugfc.js +0 -25
  193. package/dist/assets/domains-PNVO5nNw.js +0 -1
  194. package/dist/assets/dot-BBxUn__M.js +0 -7
  195. package/dist/assets/index-BwaE3jmF.js +0 -10
  196. package/dist/assets/index-CagPo5v-.js +0 -113
  197. package/dist/assets/index-D0RC10aR.js +0 -55
  198. package/dist/assets/index-DZj02tPf.js +0 -113
  199. package/dist/assets/index-Gm2-_e3j.js +0 -1
  200. package/dist/assets/invite-CvX-43Qc.js +0 -1
  201. package/dist/assets/issue-passport-BW6yzKx3.js +0 -1
  202. package/dist/assets/localization-Bd0hX08w.js +0 -1
  203. package/dist/assets/logger-BWFrucDF.js +0 -1
  204. package/dist/assets/logo-uploader-DrmXtKUh.js +0 -133
  205. package/dist/assets/omit-B1LDXfkq.js +0 -1
  206. package/dist/assets/preferences-D4p_dB62.js +0 -1
  207. package/dist/assets/profile-embed-CBcCbRqv.js +0 -1
  208. package/dist/assets/publish-resource-DZIl2SXf.js +0 -1
  209. package/dist/assets/runtime-DZIYyJfe.js +0 -1
  210. package/dist/assets/sdk-Bt5s8-As.js +0 -1
  211. package/dist/assets/session-CW6CHHdW.js +0 -1
  212. package/dist/assets/setup-D3w4xkpj.js +0 -19
  213. package/dist/assets/useAsync-B_98ShEr.js +0 -1
  214. package/dist/assets/user-center-B2qCZ2yX.js +0 -77
  215. package/dist/assets/vendor-utils-DMClavLd.js +0 -11
  216. package/dist/assets/vendor-ux-did-connect-BKeZkgZt.js +0 -1832
  217. package/dist/assets/zh-yJzqRkfw.js +0 -1
@@ -1,55 +0,0 @@
1
- import{u as ne,Y as U,bX as Ee,bY as Ue,o as le,h as K,bV as We,bW as Me,ab as _e,ac as Ve,aa as $e,bZ as Ne,b2 as Ce,p as he,r as Je,b0 as X,b_ as xe,al as je,B as z,bK as He,a4 as Ke,b$ as Ze,a5 as Ge,a1 as Ye,_ as Xe,ar as De}from"./vendor-ux-did-connect-BKeZkgZt.js";import{u as p,a as se,f as te,c as Qe}from"./vendor-hooks-jg6xPUPF.js";import{r as R}from"./vendor-react-DoD83n6N.js";import{j as e,aa as m,bs as W,bo as E,O as B,y as V,H as N,T as fe,I as ae,X as re,ag as Re,ak as H,cx as et,a8 as tt,e as be,a9 as ge,a5 as Ae,ab as nt}from"./vendor-mui-core-DiDsSLd-.js";import{I as Y,a2 as st,b as qe,C as ot,n as G,aE as at,y as rt,z as it}from"./vendor-utils-DMClavLd.js";import{a as oe,S as I,C,f as Fe}from"./dashboard-CP2P7oxj.js";import{z as J,C as $}from"./index-CagPo5v-.js";import{S as ie}from"./switch-control-Bw3ohhMA.js";import{K as lt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{B as Pe,J as ct,c as dt}from"./vendor-arcblock-CBc_0mJh.js";import{I as ut}from"./index-DpPN2Hn-.js";import{b as mt}from"./base32-CWI-u9nV.js";import{u as pt}from"./use-mobile-BbxjRR_q.js";import"./lottie-web-B6s7dDoL.js";import"./useLocalStorage-CkST2tLi.js";import"./confirm-DVW7YBsC.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-sN_fSbsI.js";import"./get-safe-url-B_RF0YU0.js";import"./session-CW6CHHdW.js";import"./index-DPgbycNO.js";import"./InfoOutlined-Cxodw3Dd.js";import"./dot-BBxUn__M.js";import"./useAsync-B_98ShEr.js";import"./useSetState-BL3ktMon.js";import"./use-mobile-T-9_nK_m.js";const ce={enabled:!1,domain:"",clientId:"",clientSecret:""};function ht(){var b,y,i;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...ce},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async a=>{var T,o;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:a})}}),u=Object.assign({...ce},((o=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:o.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.domainDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(I,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(C,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(I,{title:n("oauth.auth0.domain"),children:e.jsx(C,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:a})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...a,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.auth0.clientId"),children:e.jsx(C,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:a})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...a,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.auth0.clientSecret"),children:e.jsx(C,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:a})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...a,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...de},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(I,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(C,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(I,{title:n("oauth.github.clientId"),children:e.jsx(C,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.github.clientSecret"),children:e.jsx(C,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function ft(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ue},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...ue},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(I,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(C,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(I,{title:n("oauth.google.clientId"),children:e.jsx(C,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.google.clientSecret"),children:e.jsx(C,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function gt(){var i,a,T;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...me},((T=(a=r==null?void 0:r.settings)==null?void 0:a.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async o=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:o})}}),A=Object.assign({...me},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(I,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(C,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(I,{title:n("oauth.apple.teamId"),children:e.jsx(C,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...o,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.apple.bundleId"),children:e.jsx(C,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...o,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.apple.serviceId"),children:e.jsx(C,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...o,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.apple.keyId"),children:e.jsx(C,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...o,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(I,{title:n("oauth.apple.authKey"),children:e.jsx(C,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(B,{...o,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const jt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function ve({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=Ee({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const a=y.index,T=s;if(a===T)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-o.top;a<T&&A<u||a>T&&A>u||(w(a,T),y.index=T)}}),[{isDragging:x},g]=Ue({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:le.backgroundsBgSubtileHover}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:le.textMuted,"&:hover":{color:le.textSubtitle}},children:e.jsx(K,{fontSize:20,icon:jt})}),e.jsx(fe,{sx:{flex:1},children:S}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:lt,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}ve.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};ve.defaultProps={defaultExpand:!1};const bt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:_e}),component:e.jsx(xt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:Ve}),component:e.jsx(ft,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:$e}),component:e.jsx(gt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ne}),component:e.jsx(ht,{})}],vt=["github","google","apple","auth0"];function yt(){var k,L;const{api:S}=J(),{blocklet:r}=$(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of vt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...bt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(We,{backend:Me,...c,children:f.map((x,g)=>e.jsx(ve,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:he.SESSION_TTL,cacheTtl:he.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(ct,{...S,sx:{transform:"scale(0.75)"}})}function pe(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function St(){var o,j;const{api:S}=J(),{blocklet:r}=$(),n=(o=r==null?void 0:r.meta)==null?void 0:o.did,s=st({},Z,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=Z.ttl),qe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=oe({defaultValues:Y(pe(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:a}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:ot(pe(u,!0),["phone"])}}),_=Object.assign({},Z,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(wt,{onSubmit:w(T),children:e.jsxs(H,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(fe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(H,{gap:2,children:[e.jsx(I,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(I,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(I,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(H,{direction:"column",ml:2,children:[e.jsx(I,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(I,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(I,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(I,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(C,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(B,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>b(P),children:e.jsx(Ce,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Pe,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(I,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(C,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(B,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>a(P),children:e.jsx(Ce,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Pe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(I,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(H,{direction:"column",ml:2,mt:1,children:[e.jsx(I,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(I,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(C,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(fe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(H,{direction:"column",spacing:2,children:e.jsx(C,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(I,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(et,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const wt=Re.form`
2
- max-width: 1536px;
3
-
4
- .advanced-config {
5
- border: 0;
6
- padding: 0;
7
- }
8
-
9
- .config-form {
10
- flex-grow: 1;
11
- overflow-y: auto;
12
- will-change: transform;
13
-
14
- &:first-child {
15
- margin: 0;
16
- }
17
-
18
- ${S=>S.theme.breakpoints.down("md")} {
19
- width: 100%;
20
- flex-shrink: 0;
21
- padding: 0 24px;
22
- transform: translate(0, 0);
23
- }
24
- }
25
-
26
- .config-item {
27
- display: flex;
28
- align-items: center;
29
- justify-content: space-between;
30
- }
31
-
32
- .config-desc {
33
- font-weight: normal;
34
- font-size: 12px;
35
- color: #666;
36
- }
37
-
38
- .form-item {
39
- margin-top: 0;
40
- }
41
- `;var ye={},kt=tt;Object.defineProperty(ye,"__esModule",{value:!0});var Se=ye.default=void 0,Tt=kt(Je()),Lt=e;Se=ye.default=(0,Tt.default)((0,Lt.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const It={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:Ct,SLOT_FOR_IP_DNS_SITE:Dt,DEFAULT_DID_DOMAIN:qt}=he,{encode:Be}=mt,Ft=S=>`${Be(S.meta.did)}-${Dt}.${Ct}`,Pt=({did:S,didDomain:r=qt})=>`${Be(S)}.${r}`;var Rt={getIpDnsDomainForBlocklet:Ft,getDidDomainForBlocklet:Pt};const At=R.forwardRef((S,r)=>{var b,y;const{t:n}=R.useContext(X),{blocklet:s}=$(),{api:w}=J(),t=se({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:G}),f=be(),c=((y=(b=f==null?void 0:f.transitions)==null?void 0:b.duration)==null?void 0:y.leavingScreen)||300,h=p(()=>{t.mode="view",t.data={},t.callback=G}),l=p(()=>{t.show=!1,setTimeout(()=>{h()},c)}),d=p(i=>{t.mode="view",t.show=!0,t.data=i}),k=p((i,a=G)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=a});R.useImperativeHandle(r,()=>({open:d,close:l,approve:k}),[d,l,k]);const L=te(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&at(i,"appliedAt","status"),i.map(a=>{const T=n(`federated.info.${a}`);let o=t.data[a];if(a==="appName"&&t.data.isMaster&&(o=e.jsxs(m,{children:[e.jsx(Ae,{component:Se}),o]})),["appId","appPid","serverId"].includes(a)&&(o=e.jsx(xe,{children:o})),["appUrl"].includes(a)&&(o=e.jsx(m,{component:"a",href:o,target:"_blank",children:o})),["appLogo"].includes(a)){const j=rt(`https://${Rt.getDidDomainForBlocklet({did:t.data.appPid})}`,"/.well-known/service/blocklet/logo");try{const u=new URL(j);u.searchParams.set("imageFilter","resize"),u.searchParams.set("w","80"),u.searchParams.set("h","80"),o=e.jsx("img",{src:u.href,width:"60",height:"60",alt:t.data.appName})}catch{o=e.jsx("img",{src:j,width:"60",height:"60",alt:t.data.appName})}}return a==="status"&&(o=o&&n(`federated.status.${o}`)),a==="migratedFrom"&&(o=(t.data.migratedFrom||[]).filter(P=>![t.data.appId,t.data.appPid].includes(P)).map(P=>e.jsx(xe,{children:P}))),it(o)&&(o="-"),{name:T,value:o}})},[t.data]),x=t.mode==="approve",g=p(async()=>{try{t.loadingReject=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),v=p(async()=>{try{t.loadingApprove=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(je,{open:t.show,title:n(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:x?e.jsxs(e.Fragment,{children:[e.jsxs(V,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(ge,{size:16,color:"grey"}):null,n("common.reject")]}),e.jsxs(V,{variant:"contained",onClick:v,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(ge,{size:16,color:"grey"}):null,n("common.approve")]})]}):e.jsx(V,{variant:"outlined",onClick:l,children:n("common.close")}),children:L.map(i=>e.jsx(ut,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),Oe=R.forwardRef((S,r)=>{var d,k;const n=be(),s=((k=(d=n==null?void 0:n.transitions)==null?void 0:d.duration)==null?void 0:k.leavingScreen)||300,{t:w}=R.useContext(X),t=se({show:!1,data:{link:""}}),f=p(()=>{t.data.link=""}),c=p(()=>{t.show=!1,setTimeout(()=>{f()},s)}),h=p(({link:L})=>{t.show=!0,t.data.link=L});R.useImperativeHandle(r,()=>({open:h,close:c}),[h,c]);const l=p(()=>{Qe(t.data.link),c()});return e.jsxs(je,{open:t.show,title:w("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:w("common.copyAndClose")}),children:[e.jsx(m,{mb:1,children:w("federated.inviteJoinFederatedLoginDescription")}),e.jsx(m,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(He,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function we({mode:S}){var Q,ke,Te,Le,Ie;const r=R.useRef(null),n=R.useRef(null),{t:s,locale:w}=R.useContext(X),{blocklet:t,actions:{refreshBlocklet:f}}=$(),{confirmApi:c,confirmHolder:h}=Ke(),{api:l}=J(),d=((Q=t.settings.federated)==null?void 0:Q.sites)||[],k=((ke=t.settings.federated)==null?void 0:ke.config)||{},L=k.isMaster!==!1,x=d.find(D=>D.appPid===t.appPid),g=se({loadingSync:!1}),v=p(D=>{var q;(q=n.current)==null||q.open(D)}),b=p(D=>{var q;(q=n.current)==null||q.approve(D,f)}),y=p(D=>{c.open({title:s("federated.removeFederatedLogin"),content:s("federated.removeFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:D.appPid}}),q()}})}),i=p(D=>{c.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:D.appPid,did:t.appPid,status:"revoked"}}),q()}})}),a=p(D=>{c.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:D.appPid,did:t.appPid,status:"approved"}}),q()}})}),T=te(()=>{const D=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"inline-block",children:e.jsxs(m,{component:"a",display:"flex",alignItems:"center",href:F.appUrl,target:"_blank",onClick:O=>{O.stopPropagation()},children:[ee&&e.jsx(Ae,{component:Se,style:{marginRight:"4px"}}),F.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:q=>{const F=d[q];return e.jsx(xe,{children:F.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{children:ee?"-":s(`federated.status.${F.status}`)})}}}];return L&&D.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"flex",gap:1,children:ee?e.jsxs(e.Fragment,{children:[F.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation()},children:s("federated.status.rejected")}),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:O=>{O.stopPropagation()},children:s("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation(),y(F)},children:s("federated.quitMember")},"quiteSite"),F.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:O=>{O.stopPropagation(),b(F)},children:s("federated.status.pending")},"auditSite"),F.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation(),i(F)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")},"revokeSite"),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:O=>{O.stopPropagation(),a(F)},style:{whiteSpace:"nowrap"},children:s("federated.approve")},"approveSite")]})})}}}),D},[k.appId,d,L,s]),o=te(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(D,{dataIndex:q}){const F=d[q];v(F)}}),[]),j=p(()=>{var q;const D=t.environments.find(F=>F.key===dt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);D!=null&&D.value?(q=r.current)==null||q.open({link:D.value}):U.error(s("federated.failedToGetFederatedLoginLink"))},[(Ie=(Le=(Te=t.site)==null?void 0:Te.domainAliases)==null?void 0:Le[0])==null?void 0:Ie.href]),u=p(()=>{c.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.quitFederatedLogin({input:{did:t.appPid}}),D()}})}),P=p(()=>{c.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.disbandFederatedLogin({input:{did:t.appPid}}),D()}})}),A=p(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),Ze(500)]),U.success(s("common.succeeded"))}finally{g.loadingSync=!1}}),_=[];return x.status!=="pending"&&_.push(e.jsx(nt,{title:s("federated.syncConfig"),children:e.jsx(ae,{size:"small",onClick:A,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(K,{icon:It,style:{fontSize:24}})},"syncConfig")})),S==="master"?(_.push(e.jsx(z,{size:"small",variant:"contained",onClick:j,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),_.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:P,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):_.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:u,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ge,{className:"main-table",locale:w,data:d,columns:T,customButtons:_,title:e.jsx(m,{className:"table-toolbar-left",children:s("oauth.federated")}),options:o}),h,e.jsx(Oe,{ref:r}),e.jsx(At,{ref:n})]})}we.propTypes={mode:N.oneOf(["member","master"])};we.defaultProps={mode:"member"};const Bt=R.forwardRef((S,r)=>{var g,v;const{t:n}=R.useContext(X),{api:s}=J(),{blocklet:w}=$(),t=w==null?void 0:w.appPid,f=be(),c=((v=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:v.leavingScreen)||300,h=se({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:G}),l=p(()=>{h.appUrl="",h.appUrlError="",h.callback=G}),d=p(()=>{h.show=!1,setTimeout(()=>{l()},c)}),k=p((b=G)=>{h.show=!0,h.callback=b});R.useImperativeHandle(r,()=>({open:k,close:d}),[k,d]);const L=p(b=>{if(!b)throw new Error(n("federated.federatedJoinAppUrlRequired"));if(!Ye(b))throw new Error(n("federated.federatedJoinAppUrlInvalid"))}),x=p(async()=>{try{L(h.appUrl),h.loading=!0;const b=await s.joinFederatedLogin({input:{did:t,appUrl:h.appUrl}});h.show=!1,d(),h==null||h.callback(b)}catch(b){h.appUrlError=b.message}finally{h.loading=!1}});return e.jsxs(je,{open:h.show,title:n("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,disabled:h.loading,children:[h.loading?e.jsx(ge,{size:16,sx:{mr:1},color:"grey"}):null,n("common.confirm")]}),children:[e.jsx(m,{mb:1,children:n("federated.joinFederatedLoginDescription")}),e.jsx(B,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:n("federated.federatedJoinAppUrl"),label:n("federated.federatedJoinAppUrl"),value:h.appUrl,error:!!h.appUrlError,helperText:h.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{h.appUrl=b.target.value}})]})});function Ot(){var c,h,l,d,k;const S=R.useRef(null),r=R.useRef(null),{t:n}=R.useContext(X),{blocklet:s,actions:{refreshBlocklet:w}}=$(),t=p(()=>{var x,g,v,b;const L=(v=(g=(x=s.site)==null?void 0:x.domainAliases)==null?void 0:g[0])==null?void 0:v.href;if(L)try{const y=new URL(L);(b=S.current)==null||b.open({link:y.origin})}catch{U.error(n("federated.failedToGetFederatedLoginLink"))}},[(l=(h=(c=s.site)==null?void 0:c.domainAliases)==null?void 0:h[0])==null?void 0:l.href]),f=p(()=>{var L;(L=r.current)==null||L.open(()=>{w()})});if(((d=s.settings.federated)==null?void 0:d.sites.length)>0){const L=((k=s.settings.federated)==null?void 0:k.config.isMaster)!==!1;return e.jsx(we,{mode:L?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsxs(m,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[e.jsx(z,{variant:"contained",onClick:t,children:n("federated.inviteJoinFederatedLogin")}),e.jsx(re,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),e.jsx(z,{variant:"outlined",onClick:f,children:n("federated.joinFederatedLogin")})]}),e.jsx(Oe,{ref:S}),e.jsx(Bt,{ref:r})]})}function ze({orientation:S="horizontal"}){const{t:r}=R.useContext(X),n=pt({key:"lg"}),s=[{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.commonSettings")}),value:"settings"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.federated")}),value:"federated"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.oauth")}),value:"oauth"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.moreLogin")}),value:"more"}],[w,t]=R.useState(s[0].value),f=te(()=>({oauth:e.jsx(yt,{}),federated:e.jsx(Ot,{}),more:e.jsx(Xe,{children:r("oauth.comingSoon")}),settings:e.jsx(St,{})}),[r]);return S==="vertical"?e.jsx(zt,{children:e.jsxs(H,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(m,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(De,{tabs:s,current:w,orientation:n?"horizontal":"vertical",onChange:t,sx:{borderRight:n?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(m,{sx:{flexGrow:1,minWidth:0},children:e.jsx(m,{maxWidth:"1200px",children:f[w]})})]})}):e.jsxs(m,{children:[e.jsx(De,{tabs:s,current:w,onChange:t}),e.jsx(m,{marginTop:"10px",children:f[w]})]})}ze.propTypes={orientation:N.oneOf(["horizontal","vertical"])};ze.defaultProps={orientation:"horizontal"};const zt=Re.div`
42
- .MuiTab-root {
43
- text-align: left;
44
- align-items: flex-start;
45
- font-weight: normal;
46
-
47
- div {
48
- text-align: left;
49
- }
50
- }
51
-
52
- .Mui-selected {
53
- font-weight: bold;
54
- }
55
- `;export{ze as default};
@@ -1,113 +0,0 @@
1
- import{r as b}from"./vendor-react-DoD83n6N.js";import{j as e,H as d,a8 as Pe,ab as yt,T as Q,aa as C,E as Fe,bo as _e,ce as et,bN as Te,bs as Re,bO as Ie,y as Se,b3 as Ee,a9 as tt,ag as ce,a1 as st,bg as Xe,br as jt,bn as vt,q as Je,bV as St}from"./vendor-mui-core-DiDsSLd-.js";import{c as ie,av as ue,A as Ct}from"./vendor-utils-DMClavLd.js";import{Y as J,p as P,b4 as Nt,r as ke,f as wt,u as te,bM as Tt,X as nt,B as Ae,a5 as at,al as Rt,ar as It,br as Et}from"./vendor-ux-did-connect-BKeZkgZt.js";import{z as At,t as V,l as Dt,G as Qe}from"./index-CagPo5v-.js";import{f as ee,a as De}from"./vendor-hooks-jg6xPUPF.js";import{S as he}from"./shorten-label-8jfEkawx.js";import{I as it}from"./index-DpPN2Hn-.js";import{A as Ot,S as Lt,a as Pt,b as Ft,B as _t}from"./list-Dc8Jfe8L.js";import{R as Be}from"./relative-time-BTIpMkPf.js";import{b as ze}from"./dashboard-CP2P7oxj.js";import{W as kt}from"./did-address-CQl19Nvh.js";import{p as ot}from"./util-BUnBptcm.js";import{D as Bt,g as zt}from"./traffic-DBgXOCbQ.js";import{i as Wt,a as Mt}from"./index-DPgbycNO.js";import{B as rt}from"./bundle-avatar-nPtHnMPN.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-CBc_0mJh.js";import"./index-B0Z8409R.js";import"./use-app-logo-DoDXvoIT.js";import"./InfoOutlined-Cxodw3Dd.js";import"./sdk-Bt5s8-As.js";import"./CheckCircle-DKW0gPt9.js";import"./index-BwaE3jmF.js";import"./Location-C_mUMqZP.js";import"./Email-BWTg6iJI.js";import"./Timezone-5RxC7sK-.js";import"./useLocalStorage-CkST2tLi.js";import"./confirm-DVW7YBsC.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-sN_fSbsI.js";import"./get-safe-url-B_RF0YU0.js";import"./session-CW6CHHdW.js";import"./dot-BBxUn__M.js";import"./useAsync-B_98ShEr.js";import"./useSetState-BL3ktMon.js";import"./use-mobile-T-9_nK_m.js";import"./base32-CWI-u9nV.js";import"./iframe-4UgdZZC1.js";import"./LaunchOutlined--YSktZgX.js";import"./ChevronLeft-f4mXxiqC.js";import"./ChevronRight-I8lL2o6m.js";import"./index-CgtY16Wm.js";import"./vendor-mui-x-mVhD3N7n.js";import"./AdapterDayjs-DBd25Gc9.js";const lt=b.createContext({}),{Provider:qt,Consumer:fn}=lt;function Kt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=At(),[a,x]=b.useState([]),[u,T]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=b.useState([]),[I,M]=b.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...D}={})=>{if(!m)return[];try{const F={paging:{page:h,pageSize:O},...D,teamDid:m,dateRange:D.dateRange?[V(D.dateRange[0]).toISOString(),V(D.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=F;let Z="";B&&B.includes("system")&&(Z="system");const z=B?B.filter(f=>f!=="system"):[],oe={...q,source:Z,componentDids:z},se=await n.getNotificationSendLog({input:oe});return M(oe),x(se.list),T(se.paging),se.list}catch(F){return J.error(F.message),[]}},A=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=b.useCallback(h=>{const O=s.children.find(D=>{var F;return((F=D.meta)==null?void 0:F.did)===h});if(O)return O.ancestors=[s],O},[s]),H=async({notificationId:h,receivers:O,channels:D,...F})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:D.map(B=>B==="wallet"?P.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?P.NOTIFICATION_SEND_CHANNEL.PUSH:B),...F}})},U=b.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=b.useCallback(async({page:h=1,pageSize:O=20,...D}={})=>{try{const F={paging:{page:h,pageSize:O},...D,userName:D.searchText||"",teamDid:m,dateRange:D.dateRange?[V(D.dateRange[0]).toISOString(),V(D.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:F})}catch(F){throw J.error(F.message),F}},[n,m]);b.useEffect(()=>{m&&A()},[m]),o(P.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(P.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const k={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:H,getUser:U,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(qt,{value:{notificationRecords:k},children:t})}function We(){const{notificationRecords:t}=b.useContext(lt);return t}const ye={common:{black:"#000",white:"#fff"},primary:{main:"#3773F2",contrastText:"#fff"},secondary:{main:"#16CED1",contrastText:"#fff"},error:{main:"#F16E6E",contrastText:"#fff"},warning:{main:"#DE9E37",contrastText:"#fff"},info:{main:"#0775F8",contrastText:"#fff"},success:{main:"#34BE74",contrastText:"#fff"},grey:{50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#d5d5d5",A200:"#aaaaaa",A400:"#303030",A700:"#616161"},text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.38)",hint:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{default:"#fff"},did:{primary:"#4598FA",secondary:"#49C3AD"}};ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(Nt,{type:Ht[t],children:t})}var Me={},Ut=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var ct=Me.default=void 0,$t=Ut(ke()),Vt=e;ct=Me.default=(0,$t.default)((0,Vt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},Gt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var dt=qe.default=void 0,Yt=Gt(ke()),Xt=e;dt=qe.default=(0,Yt.default)((0,Xt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var Ke={},Jt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Qt=Jt(ke()),Zt=e;ut=Ke.default=(0,Qt.default)((0,Zt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const es=(t,s,n="")=>{if(!n||!s)return"";switch(n){case P.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:Dt(o,s)}):"",T=es(t,x,a);return r===P.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:T}:r===P.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:T,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},mt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},ts=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ss=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},ns=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),as=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),is=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},os=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),T=be(u);o[a]=T}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},je=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},rs=t=>{switch(t){case P.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case P.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case P.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case P.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>wt({typography:{fontSize:14,button:{textTransform:"none"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,T=[a,u].filter(Boolean).join(", ");return e.jsx(yt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Q,{color:"inherit",sx:{fontSize:12},children:T}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(Q,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(Q,{children:[s,": "]}),t.map(a=>{const x=pt(r,o,{status:a});return e.jsx(Fe,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}He.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function He({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:T=>{const m=[...t];T.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx(He,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=pt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=b.useState(null),x=b.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,T=b.useCallback(m=>{if(!m.startDate||!m.endDate){J.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){J.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(Q,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],n)," - ",Qe(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Bt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:zt(r),onChange:T})})]})}$e.propTypes={itemComponent:d.elementType.isRequired};function $e({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Tt.TableFilterList,{...s,ItemComponent:t})})]})}function Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(Fe,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const ls=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=b.useState(ls),[x,u]=b.useState(!0),T=(v,S)=>{S.checked=v.target.checked;const I=o.map(M=>({...M,checked:M.value===S.value?S.checked:M.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Q,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>T(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),r("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:T,blocklet:m}=We(),[v,S]=b.useState(!1),[I,M]=b.useState([]),E=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[A,G]=b.useState(null),[H,U]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,k]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=b.useState([]),D=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],F=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));M(l),U(i.paging),S(!1)}catch(i){J.error(i.message),S(!1)}};b.useEffect(()=>{F()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},q=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Z={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:H.page-1,rowsPerPage:H.pageSize,count:H.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:q},z=({page:i,rowsPerPage:l,searchText:c,filterList:j})=>{const[,_=[],$=[],K=[]]=j;N.pageSize!==l?k(W=>({...W,pageSize:l,page:1})):N.page!==i+1?k(W=>({...W,page:i+1})):N.searchText!==c?k(W=>({...W,searchText:c,page:1})):ue(_,N.walletSendStatus)?ue($,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||k(W=>({...W,emailSendStatus:K,page:1})):k(W=>({...W,pushKitSendStatus:$,page:1})):k(W=>({...W,walletSendStatus:_,page:1}))},oe=b.useCallback(async(i,l)=>{if(!l)return!1;const c=await T(l);return c?i==="wallet"?ns(c):i==="email"?ts(m,c):i==="pushKit"?ss(m,c):i==="webhook"?as(c):!0:!1},[T,m]),se=b.useCallback(i=>is(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,j="")=>{if(!(!l.length||!i.length))try{s(i,l,c,j),L.anchorEl||(await xe(.5),f())}catch(_){console.error("handleResend error",{error:_})}},y=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(j=>I[j].receiver);await g(i,c,l),await xe(.5),p(),O([])},R=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(j){J.error(j.response?j.response.statusText:j.message)}},w=async(i,l,c,j=[],_=!0)=>{if(i.stopPropagation(),os(l,c)>=4){J.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await R(l,j,_);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Ct(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],_),L.anchorEl||(await xe(.5),f()))}catch(K){J.error(K.message)}},Y=i=>{k(l=>({...l,dateRange:i,page:1}))},X=(i,l,c,j)=>{i.stopPropagation();const _=c.filter($=>$!==l);k($=>({...$,[j]:_,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(kt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:D,fullWidth:!0,logic:ve,display:(i,l,c,j)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:j,filterValues:D})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:j}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:j,channel:"wallet",onResend:_=>w(_,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:j}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:j,channel:"pushkit",onResend:_=>w(_,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:D,fullWidth:!0,logic:ve,display:(i,l,c,j)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:j,filterValues:D})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:j}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:j,channel:"email",onResend:_=>w(_,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:D,fullWidth:!0,logic:ve,display:(i,l,c,j)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:j,filterValues:D})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[j,_]=c,$=_[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:j},j),e.jsx(de,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[j],!1)})]},j)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Be,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),Ye=[e.jsx(Ue,{value:N.dateRange,onChange:Y},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(ut,{}),onClick:()=>F(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ds,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Z,customButtons:Ye,components:{TableFilterList:i=>e.jsx($e,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(us,{children:[e.jsxs(Q,{variant:"body1",component:"div",className:"check-title",children:[A==null?void 0:A.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(A==null?void 0:A.channel).map(i=>{var _,$;const{type:l,pass:c,fail:j}=i;return!(A!=null&&A.result)||(_=A==null?void 0:A.result)!=null&&_[l]?e.jsxs(Q,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=A==null?void 0:A.result)!=null&&$[l]?ye.success.main:"inherit"},children:[A!=null&&A.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:ye.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(Q,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:ye.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:j})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:y})})]})})})}const cs=b.memo(gt),ds=ce.div`
2
- td.MuiTableCell-footer {
3
- border: none !important;
4
- }
5
- .sent-status-cell {
6
- .resend-btn {
7
- display: none;
8
- }
9
- &:hover {
10
- .resend-btn {
11
- display: flex;
12
- }
13
- }
14
- }
15
- `,us=ce.div`
16
- padding: 8px 16px;
17
- .check-title {
18
- font-weight: 500;
19
- margin-bottom: 8px;
20
- &::first-letter {
21
- text-transform: uppercase;
22
- }
23
- }
24
- .check-item {
25
- svg {
26
- font-size: 16px;
27
- }
28
- font-size: 12px;
29
- }
30
- `,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function ps(t){const{wallet:s,push:n,email:r,webhook:o}=t;return[{name:"Wallet",value:e.jsx(re,{item:s})},{name:"Push",value:e.jsx(re,{item:n})},{name:"Email",value:e.jsx(re,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(re,{item:o,isWebhook:!0})}]:[]]}function fs(t,s,n){const{wallet:r,push:o,email:a,webhook:x}=t;return[{name:"Wallet",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.EMAIL,item:a,onResend:s})},...x.total>0?[{name:"Webhook",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:x,isWebhook:!0,onResend:s})}]:[]]}Ne.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};Ne.defaultProps={mode:"simple",onResend:()=>{},resending:!1};re.propTypes={item:d.object.isRequired,isWebhook:d.bool};re.defaultProps={isWebhook:!1};function re({item:t,isWebhook:s=!1}){const{t:n}=te(),r=s?t.success.length:t.success,o=t.total,a=r===o?"success":"failed";return e.jsx(C,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(C,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(ne,{config:{status:a},enableTooltip:!1,children:[fe(r)," / ",fe(o)," ",n("notification.sendStatus.success")]})})})}le.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};le.defaultProps={isWebhook:!1,channel:P.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function le({channel:t,item:s,isWebhook:n=!1,onResend:r,loading:o}){const{t:a}=te(),{success:x,failed:u,pending:T}=s,m=rs(t),v=n?x.length:x,S=n?u.length:u,I=n?T.length:T,M=async G=>{G.stopPropagation();const H=n?[...new Set([...x,...u].map(U=>U))]:[];await r([t],[],!0,H)},E=v+S,L=E>0?v/E*100:0,A=E>0?S/E*100:0;return e.jsxs(ms,{successRatio:L,failedRatio:A,children:[e.jsxs(Q,{variant:"h6",children:[m," (",s.total,")"]}),e.jsxs(Q,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Oe.success,fontWeight:600,fontSize:24},children:fe(v)}),e.jsx("small",{style:{paddingLeft:4},children:a("notification.sendStatus.success")})]}),e.jsxs(C,{className:"unsent-area",children:[e.jsxs(C,{children:[e.jsxs(ne,{config:{status:"failed"},enableTooltip:!1,children:[fe(S)," ",a("notification.sendStatus.failed")]}),e.jsxs(ne,{config:{status:"pending"},enableTooltip:!1,children:[fe(I)," ",a("notification.sendStatus.pending")]})]}),S>0&&e.jsx(C,{className:"resend-btn",children:e.jsx(Ae,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:M,children:a("notification.resend")})})]})]})}function Ne({statistics:t,mode:s="simple",onResend:n,resending:r}){const o=ee(()=>s==="simple"?ps(t):fs(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:o.map(a=>e.jsx(it,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:a.name,children:a.value},a.name))}):e.jsx(Xe,{container:!0,spacing:2,children:o.map(a=>e.jsx(Xe,{item:!0,md:4,sm:6,xs:12,children:a.value},a.name))})}const ms=ce(C)`
31
- display: flex;
32
- flex-direction: column;
33
- align-items: flex-start;
34
- padding: 16px;
35
- border-radius: 8px;
36
- background: ${({successRatio:t,failedRatio:s})=>t===0&&s===0?"#eff3fa":`linear-gradient(to right, #dafee7 ${t}%, #fef2f2 ${t}%)`};
37
- transition: 'background 0.5s ease',
38
- cursor: pointer;
39
- .unsent-area {
40
- width: 100%;
41
- position: relative;
42
- .resend-btn {
43
- position: absolute;
44
- right: 0;
45
- bottom: 0;
46
- }
47
- }
48
- `;xt.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function xt({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:o,locale:a}=te(),{getComponent:x,resendNotification:u}=We(),[T,m]=b.useState(!1),v=ee(()=>x(t.componentDid)||n,[n,t.componentDid]),S=De({tab:r||"info"}),I=b.useCallback(async(h,O,D=!0,F=[])=>{var Z;if(!h.length||!t.id)return;const B=O.length>0?O:(Z=t==null?void 0:t.receivers)==null?void 0:Z.map(z=>z.receiver);if(!B.length)return;let q=[...h];if(q.includes(P.NOTIFICATION_SEND_CHANNEL.PUSH)&&!mt(n)&&(J.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),q=q.filter(z=>z!==P.NOTIFICATION_SEND_CHANNEL.PUSH)),q.includes(P.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!ft(n)&&(J.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),q=q.filter(z=>z!==P.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!q.length)try{m(!0),await u({notificationId:t.id,receivers:B,channels:q,resendFailedOnly:D,...q.includes("webhook")&&F.length?{webhookUrls:F}:{}}),J.success("Message has been sent!")}catch(z){console.error("handleResend error",{error:z}),J.error(z.response?z.response.statusText:z.message)}finally{m(!1)}},[n,t.id,t==null?void 0:t.receivers,u,o]),M=ee(()=>Wt(t),[t]),E=ee(()=>Mt(t),[t]),L=ee(()=>M?t==null?void 0:t.actorInfo:[],[t]),A=ee(()=>{var h;return(n==null?void 0:n.did)||((h=n==null?void 0:n.meta)==null?void 0:h.did)||""},[n]);function G(){return[{name:o("notification.from"),value:M&&E?e.jsx(Ot,{actors:L,teamDid:A,size:32,showName:!0}):e.jsx(Lt,{size:32,blocklet:v,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(he,{maxLength:50,children:t.title})},{name:o("notification.body"),value:M?e.jsx(Pt,{notification:t,blocklet:n}):e.jsx(Ft,{notification:t,rows:0})},{name:o("notification.severity"),value:e.jsx(ge,{severity:t.severity})},{name:o("notification.createdAt"),value:e.jsx(Be,{value:t.createdAt,locale:a,shouldUpdate:!0})}].map(O=>e.jsx(it,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:O.name,children:O.value},O.name))}const H={info:{label:o("common.basicInfo"),value:"info",component:G},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},U=Object.values(H).map(({label:h,value:O})=>({label:h,value:O})),N=H[S.tab]||H.info,k=h=>{S.tab=h};return e.jsx(Rt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{S.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(gs,{children:[e.jsx(C,{mx:3,className:"tabs",children:e.jsx(It,{tabs:U,current:S.tab,onChange:k,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[S.tab==="receivers"&&e.jsx(cs,{notificationId:t.id,resending:T,handleResend:I}),S.tab==="statistics"&&e.jsx(Ne,{statistics:t.statistics,mode:"detail",resending:T,onResend:I}),S.tab==="info"&&e.jsx(N.component,{})]})]})})}const hs=b.memo(xt),gs=ce.div`
49
- & > .notification-row {
50
- padding: 0;
51
- }
52
-
53
- .tabs {
54
- margin: 0;
55
- }
56
- .body {
57
- margin-top: 16px;
58
- }
59
-
60
- .channel-item {
61
- display: flex;
62
- padding: 4px;
63
- justify-content: flex-start;
64
- align-items: center;
65
- gap: 8px;
66
- > p {
67
- font-size: 15px;
68
- }
69
- .resend-btn {
70
- svg {
71
- font-size: 16px;
72
- }
73
- display: flex;
74
- align-items: center;
75
- font-size: 12px;
76
- cursor: pointer;
77
- &.disabled {
78
- cursor: not-allowed;
79
- color: ${ye.text.disabled};
80
- }
81
- }
82
- }
83
- `;me.propTypes={blocklet:d.object,label:d.string};me.defaultProps={blocklet:null,label:""};const xs=ce.div`
84
- display: flex;
85
- justify-items: flex-start;
86
- align-items: center;
87
- gap: 8px;
88
- .name {
89
- display: block;
90
- max-width: 260px;
91
- white-space: nowrap;
92
- overflow: hidden;
93
- text-overflow: ellipsis;
94
- }
95
- `;function me({blocklet:t,label:s}){var n;return e.jsx(xs,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(rt,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||((n=t.meta)==null?void 0:n.title)})]}):e.jsx("span",{className:"name",children:s})})}Ge.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};Ge.defaultProps={onDelete:()=>{}};function Ge({list:t,label:s,onDelete:n}){return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(Q,{children:[s,": "]}),t.map(r=>e.jsx(Fe,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ge,{severity:r})}),onDelete:o=>n(o,r)},r))]})}function bs(t){return e.jsx(He,{...t,renderLabel:s=>e.jsx(ge,{severity:s})})}function ys({customTableButtons:t}){var se;const{t:s,locale:n}=te(),[r,o]=b.useState(!1),{data:a,paging:x,blocklet:u,fetch:T,getComponent:m,componentDids:v,inService:S,teamDid:I}=We(),M=b.useRef(null),[E,L]=b.useState(null),[A,G]=b.useState("info"),H=`notification-records-${(se=u.meta)==null?void 0:se.did}`,U=Et(H),[N,k]=b.useState({pageSize:U.rowsPerPage||10,page:U.page?U.page+1:1,dids:U.dids||[],dateRange:U.dateRange||[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),h=ee(()=>{if(!u.children||!u.children.length)return[];const f=[];return u.children.forEach(p=>{var y;const g=p.did||((y=p.meta)==null?void 0:y.did);v.includes(g)&&(p.ancestors=[u],f.push(p))}),f},[v,u]),O=b.useCallback(async()=>{try{o(!0),await T(N),o(!1)}finally{o(!1)}},[T,N]);b.useEffect(()=>{O()},[]),b.useEffect(()=>{const f=a.find(p=>p.id===(E==null?void 0:E.id));E&&f&&L({...f})},[a,E]);const D=(f,p,g,y)=>{f.stopPropagation();const R=g.filter(w=>w!==p);k(w=>({...w,[y]:R,page:1}))},F=({page:f,rowsPerPage:p,filterList:g})=>{const[y=[],,,,R=[]]=g;N.pageSize!==p?k(w=>({...w,pageSize:p,page:1})):N.page!==f+1?k(w=>({...w,page:f+1})):ue(N.dids,y)?ue(N.severities,R)||k(w=>({...w,severities:R,page:1})):k(w=>({...w,dids:y,page:1}))},B=b.useCallback(()=>{L(null),G("info")},[]),q=b.useCallback(()=>{T(N)},[T,N]),Z=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:f=>f.map((p,g)=>{var R;if(p==="system")return e.jsx("span",{children:s("notification.system")},`system-${g}`);const y=h.find(w=>{var X;return(w.did||((X=w.meta)==null?void 0:X.did))===p});return e.jsx(me,{blocklet:y,label:(y==null?void 0:y.title)||((R=y==null?void 0:y.meta)==null?void 0:R.title)},p)}),update:(f,p,g)=>(f[g].splice(p,1),f)},filterOptions:{names:h,logic:(f,p)=>p.length?!p.includes(f):!1,display:(f,p,g,y)=>e.jsxs(_e,{style:{width:"380px"},children:[e.jsx(jt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(vt,{multiple:!0,value:f[g],renderValue:R=>e.jsx(C,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:R.map(w=>{var X;if(w==="system")return e.jsx("span",{children:s("notification.system")},w);const Y=h.find(ae=>{var i;return(ae.did||((i=ae.meta)==null?void 0:i.did))===w});return e.jsx(me,{blocklet:Y,label:(Y==null?void 0:Y.title)||((X=Y==null?void 0:Y.meta)==null?void 0:X.title)},w)})}),onChange:R=>{f[g]=R.target.value,p(f[g],g,y)},children:[e.jsx(Je,{value:"system",children:s("notification.system")}),h.map(R=>{var Y,X;const w=R.did||((Y=R.meta)==null?void 0:Y.did);return e.jsx(Je,{value:w,children:e.jsx(me,{blocklet:R,label:R.title||((X=R.meta)==null?void 0:X.title)})},w)})]})]})},customBodyRenderLite:f=>{var y,R;const p=a[f],g=m(p.componentDid);return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[g?e.jsx(rt,{size:32,blocklet:g,ancestors:g.ancestors??[]}):e.jsx(_t,{blocklet:u,size:32}),e.jsx(he,{maxLength:50,children:((y=g==null?void 0:g.meta)==null?void 0:y.title)||((R=u==null?void 0:u.meta)==null?void 0:R.title)})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f],{receivers:g}=p;return e.jsx(St,{total:g.length,renderSurplus:y=>y<100?e.jsxs("span",{children:["+",y]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:y=>{y.stopPropagation(),L(p),G("receivers")},children:g.map(y=>{const{receiverUser:R}=y,w=ot(R.avatar,I,S);return e.jsx(nt,{alt:R.fullName,src:`${w}?imageFilter=resize&w=48&h=48`,size:32,did:y.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},y.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(C,{onClick:g=>{g.stopPropagation(),L(p),G("statistics")},children:e.jsx(Ne,{statistics:p.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(he,{maxLength:50,children:p.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:f=>{const p=a[f];return e.jsx(ge,{severity:p.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:f=>e.jsx(Ge,{list:f,label:s("notification.severity"),onDelete:(p,g)=>{p.stopPropagation(),D(p,g,Z[4].options.filterList,"severities")}}),update:je},filterOptions:{names:Ze,fullWidth:!0,logic:ve,display:(f,p,g,y)=>e.jsx(bs,{label:s("notification.severity"),filterList:f,onChange:p,index:g,column:y,filterValues:Ze})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:p}=a[f];return e.jsx(Be,{value:p,locale:n,shouldUpdate:!0})}}}],z=f=>{k(p=>({...p,dateRange:f,page:1}))},oe=[...t||[]];return e.jsxs(C,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(js,{children:e.jsx(st,{theme:ht(),children:e.jsx(at,{className:"main-table",verticalKeyWidth:100,loading:r,locale:n,columns:Z,data:a,durable:H,onChange:F,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:x.page-1,rowsPerPage:x.pageSize,count:x.total,...U,onRowClick:(f,{dataIndex:p})=>{L(a[p])}},customPreButtons:[e.jsx(Ue,{value:N.dateRange,onChange:z})],customButtons:oe,components:{TableFilterList:f=>e.jsx($e,{...f,itemComponent:p=>e.jsx(Ce,{...p,canDelete:g=>{var R;const y=(R=g==null?void 0:g.columnNames)==null?void 0:R[(g==null?void 0:g.index)||0];return(y==null?void 0:y.name)==="sender"}})})}})})}),E&&e.jsx(hs,{refresh:q,onCancel:B,notification:E,blocklet:u,tab:A})]})}const js=ce.div`
96
- td.MuiTableCell-footer {
97
- border: none !important;
98
- }
99
- .sent-status-cell {
100
- .resend-btn {
101
- display: none;
102
- }
103
- &:hover {
104
- .resend-btn {
105
- display: flex;
106
- }
107
- }
108
- }
109
-
110
- .custom-toobar-btns {
111
- gap: 4px;
112
- }
113
- `;bt.propTypes={blocklet:d.object.isRequired,customTableButtons:d.array};bt.defaultProps={customTableButtons:[]};function bt({blocklet:t={},customTableButtons:s}){return e.jsx(Kt,{blocklet:t,children:e.jsx(ys,{customTableButtons:s})})}export{bt as default};
@@ -1 +0,0 @@
1
- import{j as t,ag as r}from"./vendor-mui-core-DiDsSLd-.js";import{r as s}from"./vendor-react-DoD83n6N.js";import{b0 as a}from"./vendor-ux-did-connect-BKeZkgZt.js";import{R as e}from"./vendor-arcblock-CBc_0mJh.js";import"./vendor-utils-DMClavLd.js";import"./vendor-hooks-jg6xPUPF.js";import"./lottie-web-B6s7dDoL.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};
@@ -1 +0,0 @@
1
- import{j as i,aa as g}from"./vendor-mui-core-DiDsSLd-.js";import{k as x,r as u}from"./vendor-react-DoD83n6N.js";import{u as v}from"./vendor-hooks-jg6xPUPF.js";import{I as w}from"./invitation-BHGagSLV.js";import{L as I}from"./landing-page-D5MYBFUa.js";import{u as S,aR as k,p as P}from"./vendor-ux-did-connect-BKeZkgZt.js";import{H as T}from"./vendor-arcblock-CBc_0mJh.js";import{g as j}from"./get-safe-url-B-sc0A-n.js";import{u as E,d as L,c as R,s as W,a as C}from"./index-CagPo5v-.js";import"./vendor-utils-DMClavLd.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CW6CHHdW.js";import"./sdk-Bt5s8-As.js";import"./CheckCircle-DKW0gPt9.js";import"./wrap-locale-CJY3ql5f.js";import"./lottie-web-B6s7dDoL.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&k(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=j(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(T,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>R({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
@@ -1 +0,0 @@
1
- import{j as e,a9 as w,aa as v}from"./vendor-mui-core-DiDsSLd-.js";import{a as I,m as P,u as p}from"./vendor-hooks-jg6xPUPF.js";import{I as T}from"./invitation-BHGagSLV.js";import{L as k}from"./landing-page-D5MYBFUa.js";import{u as R,aR as j,p as S}from"./vendor-ux-did-connect-BKeZkgZt.js";import{H as L}from"./vendor-arcblock-CBc_0mJh.js";import{g as E}from"./get-safe-url-B-sc0A-n.js";import{u as C,c as W,s as F,a as N}from"./index-CagPo5v-.js";import{k as H}from"./vendor-react-DoD83n6N.js";import"./vendor-utils-DMClavLd.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CW6CHHdW.js";import"./sdk-Bt5s8-As.js";import"./CheckCircle-DKW0gPt9.js";import"./wrap-locale-CJY3ql5f.js";import"./lottie-web-B6s7dDoL.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=R(),n=a.get("id"),c=a.get("redirect"),g=I({state:""}),s=P(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(k,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...f,action:"issue-passport",getDataFn:l,checkFn:r.get,createPassportSvg:W,onLoginSuccess:x,inService:!0,status:g.state})})]})}export{Q as default};
@@ -1 +0,0 @@
1
- import{j as o}from"./vendor-mui-core-DiDsSLd-.js";import"./vendor-react-DoD83n6N.js";import{S as t}from"./studio-DbIZ4lHD.js";import"./vendor-ux-did-connect-BKeZkgZt.js";import"./vendor-utils-DMClavLd.js";import"./vendor-hooks-jg6xPUPF.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-CBc_0mJh.js";import"./TuneOutlined-CiDODSgi.js";function d(){return o.jsx(t,{children:"Coming soon..."})}export{d as default};
@@ -1 +0,0 @@
1
- import{aZ as e,a_ as r}from"./vendor-ux-did-connect-BKeZkgZt.js";const a=e("blocklet-services");r("blocklet-services");export{a as d};
@@ -1,133 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-I8x_0gIy.js","assets/vendor-ux-did-connect-BKeZkgZt.js","assets/vendor-react-DoD83n6N.js","assets/vendor-utils-DMClavLd.js","assets/vendor-mui-core-DiDsSLd-.js","assets/vendor-hooks-jg6xPUPF.js","assets/lottie-web-B6s7dDoL.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-CBc_0mJh.js","assets/index-kqlC8JFQ.js","assets/index-CagPo5v-.js","assets/index-tUQxVYYQ.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
- import{ag as l,aa as s,H as e,j as r}from"./vendor-mui-core-DiDsSLd-.js";import{_ as E}from"./vendor-arcblock-CBc_0mJh.js";import{r as m}from"./vendor-react-DoD83n6N.js";import{y as q,n as F}from"./vendor-utils-DMClavLd.js";import{c as O}from"./index-tUQxVYYQ.js";import{u as S}from"./vendor-ux-did-connect-BKeZkgZt.js";const _=l.span`
3
- color: ${o=>o.theme.palette.error.main};
4
- &::before {
5
- content: '*';
6
- }
7
- `,N=_,T=l(s)`
8
- width: 100%;
9
- flex-grow: 1;
10
- overflow-y: auto;
11
-
12
- ${o=>o.theme.breakpoints.down("md")} {
13
- width: 100%;
14
- flex-shrink: 0;
15
- padding: 0 4px;
16
- transform: translate(0, 0);
17
- /* max-height: 60vh; */
18
- }
19
-
20
- .form-item {
21
- width: 100%;
22
- margin-bottom: 24px;
23
- position: relative;
24
- ${o=>o.theme.breakpoints.down("md")} {
25
- flex-wrap: wrap;
26
- justify-content: space-between;
27
- width: 100%;
28
- flex-shrink: 0;
29
- }
30
- }
31
-
32
- .form-item-body {
33
- display: flex;
34
- align-items: center;
35
- width: 100%;
36
- }
37
-
38
- .form-item-label {
39
- line-height: 1.2;
40
- font-size: 14px;
41
- color: #888;
42
- font-weight: bold;
43
-
44
- ${o=>o.theme.breakpoints.down("md")} {
45
- text-align: left;
46
- width: auto;
47
- flex-grow: 1;
48
- }
49
- }
50
-
51
- .form-item-input {
52
- flex-grow: 1;
53
- overflow: hidden;
54
- white-space: nowrap;
55
- text-overflow: ellipsis;
56
-
57
- &.slot {
58
- height: 40px;
59
- line-height: 40px;
60
- background: #f8f8f8;
61
- border: 1px solid #ffffff;
62
- font-size: 16px;
63
-
64
- &:hover {
65
- box-sizing: border-box;
66
- background: #ffffff;
67
- border: 1px solid rgba(0, 0, 0, 0.23);
68
- border-radius: 4px;
69
- }
70
-
71
- .MuiChip-root {
72
- margin-top: -4px;
73
- }
74
- .placeholder {
75
- color: rgba(0, 0, 0, 0.23);
76
- }
77
- }
78
-
79
- .MuiSelect-select {
80
- padding: 8px;
81
- }
82
- }
83
-
84
- .form-item-action {
85
- // width: 100px;
86
- text-align: left;
87
- margin-left: 12px;
88
- flex-shrink: 0;
89
- ${o=>o.theme.breakpoints.down("md")} {
90
- width: auto;
91
- margin-left: 0px;
92
- }
93
- .MuiIconButton-root {
94
- padding: 8px;
95
- svg {
96
- fill: #888;
97
- }
98
- &.Mui-disabled {
99
- opacity: 0.4;
100
- }
101
- }
102
- }
103
- `,C=m.lazy(()=>E(()=>import("./index-I8x_0gIy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(o=>({default:o.Uploader}))),U="/blocklet/logo/upload",f=[".png",".jpg",".jpeg",".webp",".bmp",".ico"];function h({url:o,height:g,width:x,enabled:p,allowSVG:b,type:i,did:a,prefix:w,headers:v,aspectRatio:d,minWidth:y,minHeight:R,onUploaded:k,children:u}){const{t:P,locale:j}=S(),n=m.useRef(null),c=()=>{var t;(t=n.current)==null||t.open()},$=()=>{var t;k(),(t=n.current)==null||t.close()},z={cursor:p?"pointer":"default","&::after":{content:`"${P("common.switch")}"`}};return r.jsxs(M,{id:`uploader-${a}-${i}`,children:[r.jsx(C,{ref:n,locale:j,popup:!0,onUploadFinish:$,plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:q(w,U,i,a),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:b?[...f,".svg"]:f,maxFileSize:1024*1024*5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:d,initialAspectRatio:d,croppedCanvasOptions:{minWidth:y,minHeight:R}}},tusProps:{headers:v}}),u?r.jsx(s,{onClick:c,children:u}):r.jsx(s,{className:O("uploader-wrapper",p&&"enabled"),sx:z,onClick:c,children:r.jsx("img",{alt:i,src:o,style:{width:x,height:g}})})]},`uploader-${a}-${i}`)}h.propTypes={url:e.string.isRequired,type:e.oneOf(["square","rect","favicon","splash-portrait","splash-landscape","og-image"]).isRequired,did:e.string.isRequired,prefix:e.string.isRequired,headers:e.func,onUploaded:e.func,height:e.number,width:e.any,enabled:e.bool,allowSVG:e.bool,aspectRatio:e.number,minWidth:e.number,minHeight:e.number,children:e.node};h.defaultProps={height:80,width:"auto",enabled:!0,allowSVG:!0,headers:()=>({}),onUploaded:F,aspectRatio:1,minWidth:256,minHeight:256,children:null};const M=l.div`
104
- .uploader-wrapper {
105
- display: inline-flex;
106
- position: relative;
107
- font-size: 0px;
108
- &.enabled {
109
- cursor: pointer;
110
- }
111
- &::after {
112
- display: none;
113
- }
114
- &.enabled::after {
115
- display: block;
116
- opacity: 0;
117
- position: absolute;
118
- bottom: 0;
119
- background: rgba(0, 0, 0, 0.2);
120
- left: 0;
121
- right: 0;
122
- height: 2.2em;
123
- color: white;
124
- text-align: center;
125
- font-size: 12px;
126
- line-height: 2em;
127
- transition: opacity 0.3s ease;
128
- }
129
- &:hover::after {
130
- opacity: 1;
131
- }
132
- }
133
- `;export{T as F,h as L,N as R};
@@ -1 +0,0 @@
1
- import{a as e}from"./vendor-react-DoD83n6N.js";import{at as r}from"./vendor-utils-DMClavLd.js";const m=e(r);export{m as r};
@@ -1 +0,0 @@
1
- import{j as o}from"./vendor-mui-core-DiDsSLd-.js";import{y as t}from"./vendor-utils-DMClavLd.js";import{I as s}from"./iframe-4UgdZZC1.js";import{p as e}from"./vendor-ux-did-connect-BKeZkgZt.js";import{S as m}from"./studio-DbIZ4lHD.js";import"./vendor-react-DoD83n6N.js";import"./vendor-arcblock-CBc_0mJh.js";import"./vendor-hooks-jg6xPUPF.js";import"./lottie-web-B6s7dDoL.js";import"./TuneOutlined-CiDODSgi.js";function P(){const r=new URLSearchParams;r.set("title","Preference Builder"),r.set("schemaKey",t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/studio/preferences"));const i=`${t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/hosted/form-builder/")}?${r.toString()}`;return o.jsx(m,{children:o.jsx(s,{url:i,width:"100%",height:"100%",frameBorder:0,styles:{border:0}})})}export{P as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-mui-core-DiDsSLd-.js";import{H as t,U as o}from"./vendor-arcblock-CBc_0mJh.js";import"./vendor-react-DoD83n6N.js";import{u as s}from"./vendor-ux-did-connect-BKeZkgZt.js";import"./vendor-utils-DMClavLd.js";import"./vendor-hooks-jg6xPUPF.js";import"./lottie-web-B6s7dDoL.js";function x(){const{t:r}=s();return e.jsxs(e.Fragment,{children:[e.jsx(t,{children:e.jsx("title",{children:r("pageTitle.userCenter")})}),e.jsx(o,{onlyProfile:!0,currentTab:"",disableAutoRedirect:!0})]})}export{x as default};
@@ -1 +0,0 @@
1
- import{v as n,j as i,aa as l}from"./vendor-mui-core-DiDsSLd-.js";import{l as d,r as c}from"./vendor-react-DoD83n6N.js";import{u,al as h}from"./vendor-ux-did-connect-BKeZkgZt.js";import g from"./index-WrR7FOJW.js";import"./vendor-utils-DMClavLd.js";import"./vendor-hooks-jg6xPUPF.js";import"./lottie-web-B6s7dDoL.js";import"./index-CagPo5v-.js";import"./vendor-arcblock-CBc_0mJh.js";import"./Error-Cpr3WuZf.js";import"./confirm-DVW7YBsC.js";import"./format-error-LAoTjvJe.js";import"./session-CW6CHHdW.js";import"./did-address-CQl19Nvh.js";import"./empty-spinner-yzHJfTIe.js";import"./bundle-avatar-nPtHnMPN.js";import"./shorten-label-8jfEkawx.js";import"./list-header-BYlc5SI1.js";import"./Download-DnSJYUu9.js";import"./click-to-copy-CTfzGpml.js";import"./QuestionMarkCircle-DeAbZuzW.js";import"./useSetState-BL3ktMon.js";import"./index-tUQxVYYQ.js";import"./index-B0Z8409R.js";import"./api-DwjKcjK8.js";import"./ChevronRight-I8lL2o6m.js";import"./vendor-mui-x-mVhD3N7n.js";import"./DeleteOutline-gXV6-Yj1.js";import"./react-beautiful-dnd.esm-QRb5iprr.js";import"./raf-schd.esm-GV-XhwE0.js";import"./item-BF4KPkcQ.js";import"./Launch-BtCtZYws.js";import"./Done-D7ovxqe0.js";import"./delete-confirm-XK8jSuf8.js";import"./get-safe-url-B_RF0YU0.js";import"./ArrowDropDown-CplPoZk0.js";import"./index-CEMXycV7.js";import"./index-BjmnM2sd.js";const r=new URL(window.location.href),s=r.searchParams.get("mode")==="dialog",w=s?"":r.searchParams.get("padding")||"";function to(){const{t:p}=u(),{componentDid:o}=d(),m=n(t=>t.breakpoints.down("md")),a=t=>{t.stopPropagation(),window.parent.postMessage({event:"resourceDialog.close",componentDid:o},"*")};c.useEffect(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:o},"*")},[o]);const e=i.jsx(g,{padding:w,initUrl:r});return s?i.jsx(h,{className:"studio-dialog",title:p("blocklet.publish.blockletStudio"),maxWidth:!1,fullWidth:!1,PaperProps:{style:m?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:a,showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:i.jsx(l,{sx:{height:"72vh",overflow:"auto",position:"relative"},children:e})}):e}export{to as default};
@@ -1 +0,0 @@
1
- import{r as x}from"./vendor-react-DoD83n6N.js";import{e as W,j as n,bH as G,T,aa as w,H as l,bg as D,ag as O,ab as S,cc as Y,cd as Z}from"./vendor-mui-core-DiDsSLd-.js";import{p as H}from"./index-DPgbycNO.js";import{u as A,_ as v,h as tt,a5 as et}from"./vendor-ux-did-connect-BKeZkgZt.js";import{an as _,as as q,z as st,C as F,f as z,ay as nt}from"./index-CagPo5v-.js";import{z as B,aH as at}from"./vendor-utils-DMClavLd.js";import{$}from"./vendor-arcblock-CBc_0mJh.js";import{R as J}from"./index-haYY8BAk.js";import{B as it}from"./bundle-avatar-nPtHnMPN.js";import{B as rt}from"./dashboard-CP2P7oxj.js";import"./vendor-hooks-jg6xPUPF.js";import"./lottie-web-B6s7dDoL.js";import"./useLocalStorage-CkST2tLi.js";import"./confirm-DVW7YBsC.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-sN_fSbsI.js";import"./get-safe-url-B_RF0YU0.js";import"./session-CW6CHHdW.js";import"./InfoOutlined-Cxodw3Dd.js";import"./dot-BBxUn__M.js";import"./useAsync-B_98ShEr.js";import"./useSetState-BL3ktMon.js";import"./use-mobile-T-9_nK_m.js";const K=a=>{const g=new Date(Math.min(...a)),r=(new Date(Math.max(...a))-g)/(1e3*60);return u=>{if(r<=10){const e=(a.length-a.length%r)/r;return u%e===0}const o=(a.length-a.length%6)/6;return u%o===0}},R=a=>`${a}%`;function U({title:a,cpus:g,currentLoad:c,history:d,empty:r,onHover:u,hoverIndex:i}){const{t:o,locale:b}=A(),e=W(),t=x.useRef(null),s=B(d)?[]:d.map(p=>_(p.date,"HH:mm",b)),j=`${a||o("common.cpu")} (${Math.floor(c||0)}%)`,L=x.useCallback(()=>{u==null||u(null)},[u]);if(x.useEffect(()=>{if(!t.current||(i==null?void 0:i.ref)===t)return;const p=t.current.getEchartsInstance(),E=i==null?void 0:i.seriesIndex,M=s.findIndex(y=>y===(i==null?void 0:i.dataValue));i&&M!==-1?p.dispatchAction({type:"showTip",seriesIndex:E,dataIndex:M}):(p.dispatchAction({type:"hideTip"}),p.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[i]),!B(d)){const M={tooltip:{trigger:"axis",formatter(y){const C=y[0].data,{seriesIndex:f,dataIndex:h}=y[0];return u==null||u({seriesIndex:f,dataIndex:h,dataValue:s[h],ref:(i==null?void 0:i.ref)||t}),`${y[0].name}: <b>${R(C)}</b>`}},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:s,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:K(d.map(y=>new Date(y.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:100,interval:Math.ceil(50),axisLabel:{formatter:R}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:[{max:80,color:"#e9f8f9"},{min:80,max:100,color:e.palette.warning.light},{min:100,color:"#ff4d4f"}]},series:[{name:"CPU Usage",type:"line",smooth:!0,symbol:"none",lineStyle:{color:e.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:d.map(y=>y.value),markLine:{silent:!0,symbol:["none","none"],lineStyle:{color:"#ff4d4f",type:"dashed",width:1.5},label:{formatter:`${R(100)}`,position:"insideEndTop"},data:[{yAxis:100},{yAxis:80,lineStyle:{color:e.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${R(80)}`,position:"insideEndTop"}}]}}]};return n.jsxs(G,{sx:{p:1,position:"relative"},onMouseLeave:L,children:[n.jsx(T,{sx:{position:"absolute",top:8,left:16,zIndex:10},fontSize:"16px",fontWeight:"bold",color:"text.secondary",children:j}),n.jsx(J,{ref:t,option:M,style:{width:"100%",height:"200px"},onEvents:{globalout:L}}),n.jsxs(w,{sx:{ml:2,mt:1,fontSize:12},color:"text.secondary",children:[`${o("system.cores")}: ${(g==null?void 0:g.length)||0}`," "]})]})}return r}U.propTypes={title:l.string,cpus:l.array,currentLoad:l.number,history:l.array,empty:l.node,onHover:l.func,hoverIndex:l.number};U.defaultProps={title:"",cpus:[],currentLoad:0,history:[],empty:null,onHover:()=>{},hoverIndex:null};function N({instanceCount:a,title:g,total:c,used:d,history:r,empty:u,onHover:i,hoverIndex:o}){const{t:b,locale:e}=A(),t=W(),s=!!c,j=c-d,L=s?`(${q(d)}, ${Math.floor(d/c*100)}%)`:"",p=x.useRef(null),E=`${g||b("common.memory")} ${L}`,M=B(r)?[]:r.map(f=>_(f.date,"HH:mm",e));x.useEffect(()=>{if(!p.current||(o==null?void 0:o.ref)===p)return;const f=p.current.getEchartsInstance(),h=o==null?void 0:o.seriesIndex,k=M.findIndex(m=>m===(o==null?void 0:o.dataValue));o&&k!==-1?f.dispatchAction({type:"showTip",seriesIndex:h,dataIndex:k}):(f.dispatchAction({type:"hideTip"}),f.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[o==null?void 0:o.dataIndex]);const y=x.useCallback(()=>{i==null||i(null)},[i]);x.useEffect(()=>{if(p.current){const f=p.current.getEchartsInstance(),h=f.getDom(),k=m=>{y(m)};return h.addEventListener("mouseleave",k),()=>{h&&h.removeEventListener("mouseleave",k),f&&f.dispose()}}},[y]);const C=[];if(a&&C.push({title:b("system.instances"),metric:a}),s&&C.push({title:b("system.free"),metric:$(j,{short:!0,iec:!0})}),!B(r)){const f=Math.max(...r.map(m=>m.value),c,0),h=Math.ceil(c*.8),k={tooltip:{trigger:"axis",formatter(m){const P=m[0].data,Q=$(P,{short:!0,iec:!0}),{seriesIndex:X,dataIndex:I}=m[0];return i==null||i({seriesIndex:X,dataIndex:I,dataValue:M[I],ref:(o==null?void 0:o.ref)||p}),`${m[0].name}: <b>${Q}</b>`}},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:M,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:K(r.map(m=>new Date(m.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:f,interval:Math.ceil(f/2),axisLabel:{formatter:m=>$(m,{short:!0,iec:!0}),padding:[5,0,0,0]}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:[{max:h,color:"#e9f8f9"},{min:h,max:c,color:t.palette.warning.light},{min:c,color:"#ff4d4f"}]},series:[{name:"Memory Usage",type:"line",smooth:!0,symbol:"none",lineStyle:{color:t.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:r.map(m=>m.value),markLine:{silent:!0,symbol:["none","none"],data:[{yAxis:c,lineStyle:{color:"#ff4d4f",type:"dashed",width:1.5},label:{formatter:`${$(c,{short:!0,iec:!0})}`,position:"insideEndTop"}},{yAxis:h,lineStyle:{color:t.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${$(h,{short:!0,iec:!0})}`,position:"insideEndTop"}}]}}]};return n.jsxs(G,{sx:{p:1,position:"relative"},onMouseLeave:y,children:[n.jsx(T,{sx:{position:"absolute",top:8,left:16,zIndex:10},fontSize:"16px",fontWeight:"bold",color:"text.secondary",children:E}),n.jsx(J,{ref:p,option:k,style:{width:"100%",height:"200px"}}),n.jsx(w,{sx:{ml:2,mt:1,fontSize:12},color:"text.secondary",children:C.map((m,P)=>n.jsxs(w,{sx:{marginLeft:P===0?0:1,display:"inline-flex"},children:[m.title,": ",m.metric]},m.title))})]})}return u}N.propTypes={title:l.string,instanceCount:l.number,total:l.number,used:l.number,history:l.array,empty:l.node,onHover:l.func,hoverIndex:l.number};N.defaultProps={title:"",instanceCount:null,total:null,used:null,history:[],empty:null,onHover:()=>{},hoverIndex:null};function V({blocklet:a,...g}){const{t:c}=A(),{info:d}=st(),{runtimeHistory:r}=F(),[u,i]=x.useState(null),o=x.useCallback(e=>a.status!=="running"?n.jsx(T,{children:c("blocklet.runtimeInfo.noRunning")}):e.length?null:n.jsx(v,{children:c("common.empty")}),[a.status,c]),b=x.useCallback(e=>{i(e)},[]);return r.length===0?n.jsx(T,{children:c("blocklet.runtimeInfo.noRunning")}):n.jsxs(ot,{component:"div",...g,children:[n.jsxs(D,{className:"page-metrics",container:!0,spacing:5,children:[n.jsx(D,{item:!0,xs:12,sx:{pt:"16px !important"},children:n.jsx(T,{fontSize:"16px",fontWeight:"bold",children:"CPU"})}),r==null?void 0:r.map(e=>{var t,s;return n.jsx(D,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:n.jsx(U,{title:`${e.name} CPU`,empty:o(e.cpu),currentLoad:((t=e.appRuntimeInfo)==null?void 0:t.cpuUsage)||0,cpus:((s=e.appRuntimeInfo)==null?void 0:s.cpus)||[],history:e.cpu,onHover:b,hoverIndex:u,style:{height:150}})},`${e.key}-cpu`)})]}),n.jsxs(D,{className:"page-metrics",container:!0,spacing:5,sx:{mt:1},children:[n.jsx(D,{item:!0,xs:12,sx:{pt:"16px !important"},children:n.jsx(T,{fontSize:"16px",fontWeight:"bold",children:"Memory"})}),r==null?void 0:r.map(e=>{var t,s,j;return n.jsx(D,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:n.jsx(N,{title:`${e.name} Memory`,empty:o(e.memory),total:(t=d.runtimeConfig)!=null&&t.blockletMaxMemoryLimit?$.parseSize(`${d.runtimeConfig.blockletMaxMemoryLimit*(e.key===((s=a==null?void 0:a.meta)==null?void 0:s.did)?r.length-1:1)}MiB`):0,used:((j=e.appRuntimeInfo)==null?void 0:j.memoryUsage)||0,history:e.memory,onHover:b,hoverIndex:u,style:{height:150}})},`${e.key}-memory`)})]})]})}V.propTypes={blocklet:l.object.isRequired,cpuHistory:l.arrayOf(l.shape({date:l.number,value:l.number})),memoryHistory:l.arrayOf(l.shape({date:l.number,value:l.number}))};V.defaultProps={cpuHistory:[],memoryHistory:[]};const ot=O(T)``;function lt(){const{t:a,locale:g}=A(),[c,d]=x.useState(6),{blocklet:r,actions:{refreshBlocklet:u}}=F(),i=x.useMemo(()=>{const e=[];return z.forEachBlockletSync(r,(t,{ancestors:s,id:j,level:L})=>{var p;(p=t==null?void 0:t.meta)!=null&&p.did&&t.meta.did!==r.meta.did&&e.push({type:"blocklet",groupId:r.meta.did,groupName:z.getDisplayName(r),id:j,name:z.getDisplayName(t,!0),blocklet:r,component:t,level:L-1>=0?L-1:0,runtimeInfo:t.runtimeInfo,ancestors:s})}),e},[r]);x.useEffect(()=>{u({hours:c});const e=setInterval(()=>{u({hours:c})},1e3*10);return()=>{clearInterval(e)}},[c]);const o=e=>H(Number(e||0),{locale:nt(g)}),b=[{label:a("common.name"),name:"name",options:{customBodyRenderLite(e){const{name:t,component:s,level:j,ancestors:L}=i[e];return n.jsxs(w,{display:"flex",alignItems:"center",pl:j*2,children:[n.jsx(it,{size:20,blocklet:s,ancestors:L}),n.jsx(w,{ml:1,children:t}),n.jsx(rt,{variant:"pin",style:{marginLeft:8},status:s.status,source:s.source,progress:s.progress})]})}}},{label:a("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(e){const{runtimeInfo:t,component:s}=i[e];return!(s!=null&&s.status)||s.status!=="running"?n.jsx(S,{title:a("common.noData"),children:"--"}):o(t==null?void 0:t.uptime)}}},{label:a("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t,component:s}=i[e];return!(s!=null&&s.status)||s.status!=="running"?n.jsx(S,{title:a("common.noData"),children:"--"}):q((t==null?void 0:t.memoryUsage)||0)}}},{label:a("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t,component:s}=i[e];return!(s!=null&&s.status)||s.status!=="running"?n.jsx(S,{title:a("common.noData"),children:"--"}):`${((t==null?void 0:t.cpuUsage)||0).toFixed(1)}%`}}},{label:a("analytics.runtime"),name:"runtimeInfo.runtime",options:{customBodyRenderLite(e){const{runtimeInfo:t}=i[e];return t!=null&&t.uptime?n.jsxs(w,{display:"flex",alignItems:"center",children:[n.jsx(tt,{icon:t!=null&&t.runningDocker?"catppuccin:docker-ignore":"logos:nodejs-icon"}),n.jsx(w,{ml:1,children:t!=null&&t.runningDocker?"Docker":"Nodejs"})]}):null}}},{label:a("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid",options:{customBodyRenderLite(e){const{runtimeInfo:t,component:s}=i[e];return!(s!=null&&s.status)||s.status!=="running"?n.jsx(S,{title:a("common.noData"),children:"--"}):t==null?void 0:t.pid}}},{label:a("blocklet.runtimeInfo.port"),name:"runtimeInfo.port",options:{customBodyRenderLite(e){const{runtimeInfo:t,component:s}=i[e];return!(s!=null&&s.status)||s.status!=="running"?n.jsx(S,{title:a("common.noData"),children:"--"}):t==null?void 0:t.port}}}];return n.jsxs(ct,{component:"div",children:[n.jsxs(w,{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2,children:[n.jsx(T,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:2,children:a("analytics.trend")}),n.jsx(Y,{size:"small",exclusive:!0,value:c,onChange:(e,t)=>{at(t)&&d(t)},children:[1,3,6,12,24].map(e=>n.jsxs(Z,{value:e,children:[e,"H"]},e))})]}),n.jsx(w,{children:n.jsx(V,{blocklet:r})}),n.jsx(w,{mt:3,children:n.jsx(et,{title:a("analytics.detail"),className:"monitor-table",locale:g,data:i,columns:b,options:{search:!1,download:!1,filter:!1,print:!1,viewColumns:!1,pagination:!1,rowsPerPage:100}})})]})}lt.propTypes={};const ct=O(T)``;export{lt as default};
@@ -1 +0,0 @@
1
- import{aV as o}from"./vendor-ux-did-connect-BKeZkgZt.js";const e=o();export{e as b};
@@ -1 +0,0 @@
1
- import{r as o}from"./vendor-react-DoD83n6N.js";import{k as t}from"./vendor-ux-did-connect-BKeZkgZt.js";function r(){return o.useContext(t)}export{r as u};