@abtnode/webapp 1.16.43-beta-20250507-124320-c405ab23 → 1.16.43-beta-20250507-131727-e3e5be46

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 (199) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-D0B_jcmg.js → AdapterDayjs-DN3WVSzh.js} +1 -1
  4. package/dist/assets/{Add-CWZdCpsj.js → Add-B5o3lKZ4.js} +1 -1
  5. package/dist/assets/{ArrowDropDown-CmqsXt9y.js → ArrowDropDown-RVN4Mn-W.js} +1 -1
  6. package/dist/assets/{Autocomplete-B9W0x8LR.js → Autocomplete-DHpI8PP1.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-D6qp1cMT.js → Breadcrumbs-BO8goWHs.js} +1 -1
  8. package/dist/assets/{ButtonGroup-BHcpMxTu.js → ButtonGroup-DP9Um2zw.js} +1 -1
  9. package/dist/assets/{CSSTransition-BuWP1JFF.js → CSSTransition-Ce16mrqT.js} +1 -1
  10. package/dist/assets/{CallMerge-BShTVXkB.js → CallMerge-D9pdEpQ4.js} +1 -1
  11. package/dist/assets/{CardContent-BSYOgOvL.js → CardContent-CV6vnW6h.js} +1 -1
  12. package/dist/assets/{ChevronLeft-CWq3Gxqj.js → ChevronLeft-CVA4N8rQ.js} +1 -1
  13. package/dist/assets/{ChevronRight-DpVf81V0.js → ChevronRight-sZUpX7tH.js} +1 -1
  14. package/dist/assets/{Clear-Dt61s4Jb.js → Clear-C7odY-6_.js} +1 -1
  15. package/dist/assets/{Close-H0Qu26Eg.js → Close-w8eKEJW7.js} +1 -1
  16. package/dist/assets/{Community-Bpc3Fg9d.js → Community-CIu-cG23.js} +1 -1
  17. package/dist/assets/{Delete-uTw81SAG.js → Delete-DSB9GjVg.js} +1 -1
  18. package/dist/assets/{Delete-D3Cc6_4Q.js → Delete-DpNbJCJA.js} +1 -1
  19. package/dist/assets/{DeleteOutline-jp3vin8Z.js → DeleteOutline-B4zcgGCZ.js} +1 -1
  20. package/dist/assets/{Done-DHtSx1Az.js → Done-CasEZEMQ.js} +1 -1
  21. package/dist/assets/{Edit-DBdzAtvQ.js → Edit-D9oke1qz.js} +1 -1
  22. package/dist/assets/{ErrorOutline-BYuoGvYU.js → ErrorOutline-cX4XY61i.js} +1 -1
  23. package/dist/assets/{HelpOutline-CGfBEqN0.js → HelpOutline-B-3RVeU3.js} +1 -1
  24. package/dist/assets/{Holiday-8FYeupTb.js → Holiday-CWWiyhee.js} +1 -1
  25. package/dist/assets/{Launch-IYpFZ4ei.js → Launch-9QmeNFGh.js} +1 -1
  26. package/dist/assets/{Link-CNdMZ-Ir.js → Link-V0zXa94b.js} +1 -1
  27. package/dist/assets/{ListItemButton-B8mGrc4b.js → ListItemButton-Drq6UK1v.js} +1 -1
  28. package/dist/assets/{ListSubheader-CzAOd4qf.js → ListSubheader-r9QVg4z3.js} +1 -1
  29. package/dist/assets/{LoadingButton-DnRPaBiu.js → LoadingButton-CwgQEhJX.js} +1 -1
  30. package/dist/assets/{LockIcon-DebON0bq.js → LockIcon-AR8ebEzv.js} +1 -1
  31. package/dist/assets/{Meeting-C1b2wTDn.js → Meeting-CF-WhmPM.js} +1 -1
  32. package/dist/assets/{MoreHoriz-C2u_cYyx.js → MoreHoriz-DuOMe2bn.js} +1 -1
  33. package/dist/assets/{MoreVert-BVKVbqMe.js → MoreVert-UFPlWjze.js} +1 -1
  34. package/dist/assets/{OffSick-CD8hg4U_.js → OffSick-CSP2kO-5.js} +1 -1
  35. package/dist/assets/{OpenInNew-CqGHjgTE.js → OpenInNew-6pTIeS0r.js} +1 -1
  36. package/dist/assets/{Public-D7l70Nl5.js → Public-Cm3uAF1d.js} +1 -1
  37. package/dist/assets/{Refresh-D-9kJI4M.js → Refresh-DsQW01Ya.js} +1 -1
  38. package/dist/assets/{SchemaReference.es-DwTKYdXb.js → SchemaReference.es-BPpguI5D.js} +1 -1
  39. package/dist/assets/{Search-CnGd_Ao7.js → Search-DnEqCvoa.js} +1 -1
  40. package/dist/assets/{Slider-CHM0tCqD.js → Slider-DRcvOlgL.js} +1 -1
  41. package/dist/assets/{Stepper-CZhNWrms.js → Stepper-DfLckKIy.js} +1 -1
  42. package/dist/assets/{TableRow-D7-Zq-OD.js → TableRow-BMSWmGPk.js} +1 -1
  43. package/dist/assets/{TableSearch-Bc199o0T.js → TableSearch-Dobasaj8.js} +1 -1
  44. package/dist/assets/{ToggleButtonGroup-BTeawApm.js → ToggleButtonGroup-CfjCj__G.js} +1 -1
  45. package/dist/assets/{Verified-Dbca1-Es.js → Verified-oP4ZelZh.js} +1 -1
  46. package/dist/assets/{VerifiedUser-C9X9RjKF.js → VerifiedUser-CzEMJOGM.js} +1 -1
  47. package/dist/assets/{ViewColumn-423RpdF7.js → ViewColumn-BIPD356c.js} +1 -1
  48. package/dist/assets/{ViewList-DsKTRqlV.js → ViewList-BYQ2Wo2N.js} +1 -1
  49. package/dist/assets/{WorkingRemotely-COVb7EO8.js → WorkingRemotely-B8U5I0AD.js} +1 -1
  50. package/dist/assets/{_createAggregator-CEREBT9l.js → _createAggregator-BzC5cfxy.js} +1 -1
  51. package/dist/assets/{actions-Dao-vIba.js → actions-C1blhdkh.js} +1 -1
  52. package/dist/assets/{actions-4ImpPOP5.js → actions-CIvfyQ4N.js} +1 -1
  53. package/dist/assets/{agreement-CM7cPgwb.js → agreement-BKAba3Bu.js} +1 -1
  54. package/dist/assets/api-BhAwS4V8.js +1 -0
  55. package/dist/assets/{appearance-jDDRH5-M.js → appearance-BT6nflvn.js} +1 -1
  56. package/dist/assets/{audit-logs-DGUqXsRe.js → audit-logs-CxO1RKPM.js} +1 -1
  57. package/dist/assets/{blocklet-Cj0P-s6g.js → blocklet-DgGtZNCB.js} +1 -1
  58. package/dist/assets/{brace-fold.es-BEZgxG3i.js → brace-fold.es-D7zHyRiF.js} +1 -1
  59. package/dist/assets/{chain-BD8CghUy.js → chain-CMNZiwbz.js} +1 -1
  60. package/dist/assets/{click-to-copy-CCNzNZ1Q.js → click-to-copy-mgHOJgOu.js} +1 -1
  61. package/dist/assets/cloneDeep-C8Xz4lYT.js +1 -0
  62. package/dist/assets/{closebrackets.es-BF5trJAr.js → closebrackets.es-BY2R-PDl.js} +1 -1
  63. package/dist/assets/{codemirror.es-itieykAV.js → codemirror.es-Bj7wxben.js} +1 -1
  64. package/dist/assets/{comment.es-Dk3fdgwu.js → comment.es-9NAetJeX.js} +1 -1
  65. package/dist/assets/{config-navigation-dcIrxkhP.js → config-navigation-BeyhoAYd.js} +3 -3
  66. package/dist/assets/{connect-to-Cv7_m0q4.js → connect-to-B2UoY2JL.js} +1 -1
  67. package/dist/assets/{delete-confirm-CPi3Neq0.js → delete-confirm-B0FL8Sx7.js} +1 -1
  68. package/dist/assets/{detail-CZzR_pkr.js → detail-Lgl7Opc1.js} +3 -3
  69. package/dist/assets/{dialog.es-BwK4L0zE.js → dialog.es-CV929pYp.js} +1 -1
  70. package/dist/assets/{domains-B_3P9cXG.js → domains-BnwU8REn.js} +2 -2
  71. package/dist/assets/{download-1NleahxB.js → download-IW0OxyHF.js} +1 -1
  72. package/dist/assets/emotion-react.browser.esm-DwA9twTe.js +1 -0
  73. package/dist/assets/{foldgutter.es-BjxnxwQB.js → foldgutter.es-D3SAnwjU.js} +1 -1
  74. package/dist/assets/{get-safe-url-DaO0zNfp.js → get-safe-url-BQ9e1d8R.js} +1 -1
  75. package/dist/assets/{get-safe-url-V1wl4gr3.js → get-safe-url-fVLOWjDv.js} +1 -1
  76. package/dist/assets/getValidReactChildren-BybUhg_p.js +1 -0
  77. package/dist/assets/{hint.es-BAQjy_TP.js → hint.es-xqBNEZOH.js} +1 -1
  78. package/dist/assets/{hint.es2-C4JXylG0.js → hint.es2-jX0Ikd_H.js} +1 -1
  79. package/dist/assets/{iframe-CS_rJQlP.js → iframe-B52MZmUp.js} +1 -1
  80. package/dist/assets/{index-DkgrmE-T.js → index-B3-cD9IV.js} +1 -1
  81. package/dist/assets/{index-B09_oCEi.js → index-B8d6BDWi.js} +1 -1
  82. package/dist/assets/{index-DvLkT-7K.js → index-B930dkB6.js} +1 -1
  83. package/dist/assets/{index-CJZ621kJ.js → index-BEgDyH2G.js} +1 -1
  84. package/dist/assets/{index-C9Qvl3AL.js → index-BFMlUu0x.js} +1 -1
  85. package/dist/assets/{index-Bl3odC1P.js → index-BK_iEF6w.js} +1 -1
  86. package/dist/assets/{index-B5tdRxwW.js → index-BNMAXWQI.js} +1 -1
  87. package/dist/assets/{index-NJM1b5Oy.js → index-Bahrm-G8.js} +18 -18
  88. package/dist/assets/{index-Dw_-VACK.js → index-BcWvyuw8.js} +1 -1
  89. package/dist/assets/{index-CfypG9xi.js → index-BerfqWKB.js} +1 -1
  90. package/dist/assets/{index-CEgPawok.js → index-BfvhxdN7.js} +1 -1
  91. package/dist/assets/{index-DMApNFrR.js → index-BhA9P09u.js} +1 -1
  92. package/dist/assets/{index-Dm-V5BXD.js → index-Bpzwsd3f.js} +1 -1
  93. package/dist/assets/{index-77IZhlGI.js → index-BsoiXoFC.js} +1 -1
  94. package/dist/assets/{index-C58fITNM.js → index-Btu7Neya.js} +1 -1
  95. package/dist/assets/{index-B_OKp_Op.js → index-C8FhJ0rj.js} +1 -1
  96. package/dist/assets/{index-CwQN21sJ.js → index-CCAZAiY9.js} +1 -1
  97. package/dist/assets/{index-3pbhDJdN.js → index-CFslc24J.js} +1 -1
  98. package/dist/assets/{index-BsdDIJ5W.js → index-CNElardu.js} +1 -1
  99. package/dist/assets/{index-C-fTTans.js → index-CUdgGjYV.js} +1 -1
  100. package/dist/assets/{index-Dme3SYPB.js → index-CZGd5QCZ.js} +1 -1
  101. package/dist/assets/{index-DQ3XgEE8.js → index-Ce_kCGci.js} +1 -1
  102. package/dist/assets/{index-DfYDjn49.js → index-CiH2SOFi.js} +3 -3
  103. package/dist/assets/index-D-wNDvqE.js +161 -0
  104. package/dist/assets/{index-Cte4JXAJ.js → index-D6UMpm4p.js} +1 -1
  105. package/dist/assets/{index-CUJLg7oa.js → index-D6sUi9RT.js} +1 -1
  106. package/dist/assets/{index-DAW3TTb5.js → index-DA7j-cev.js} +1 -1
  107. package/dist/assets/{index-CLzvd8Xe.js → index-DATTQ5am.js} +1 -1
  108. package/dist/assets/{index-C9OyOQK_.js → index-DHqdVKlk.js} +1 -1
  109. package/dist/assets/{index-BjeR522b.js → index-DLm8Ub_j.js} +1 -1
  110. package/dist/assets/index-DNHgOX2L.js +1 -0
  111. package/dist/assets/{index-Dn67czO2.js → index-DPJjuq8y.js} +1 -1
  112. package/dist/assets/{index-mqekGQEz.js → index-DRmGM_hP.js} +1 -1
  113. package/dist/assets/{index-YdBd91X5.js → index-DX8DEJlQ.js} +1 -1
  114. package/dist/assets/{index-DP-OGudM.js → index-D_1_RyLT.js} +1 -1
  115. package/dist/assets/{index-Bw0MXptL.js → index-Da_gY2p2.js} +1 -1
  116. package/dist/assets/{index-BuUrL2zu.js → index-DdLMocGE.js} +1 -1
  117. package/dist/assets/index-DjPLbVUc.js +11 -0
  118. package/dist/assets/{index-s-OYwTlQ.js → index-DydT7-LV.js} +1 -1
  119. package/dist/assets/{index-DQDv4NJO.js → index-Dzpr3qS7.js} +1 -1
  120. package/dist/assets/{index-DdJGYtAD.js → index-KdOmwCM0.js} +30 -30
  121. package/dist/assets/{index-CsiV_JrU.js → index-R7x7W7GB.js} +5 -5
  122. package/dist/assets/{index-DDOm4KG9.js → index-hmtP3oKe.js} +1 -1
  123. package/dist/assets/{index-DRrgztHp.js → index-iW0yPyzE.js} +1 -1
  124. package/dist/assets/{index-C2MvOTmW.js → index-n3NnSt8H.js} +1 -1
  125. package/dist/assets/{index-0bofXTKF.js → index-qxurOC9U.js} +1 -1
  126. package/dist/assets/{index-BH2aPeTR.js → index-trVfBCte.js} +1 -1
  127. package/dist/assets/{index-CB0oehbS.js → index-yrfr0MWP.js} +1 -1
  128. package/dist/assets/{index.esm-DhOdskub.js → index.esm-BZeAlIeN.js} +1 -1
  129. package/dist/assets/{info-addon.es-CrUdBD0D.js → info-addon.es-C0ND8uqw.js} +1 -1
  130. package/dist/assets/{info.es-5xOB6WSn.js → info.es-B-kYc798.js} +1 -1
  131. package/dist/assets/{install-from-url-DG3j09rg.js → install-from-url-CV2FomzA.js} +1 -1
  132. package/dist/assets/{invitation-BOb-v4jm.js → invitation-DH_bKwmI.js} +1 -1
  133. package/dist/assets/is-path-prefix-equal-Cl2q8kGU.js +1 -0
  134. package/dist/assets/{item-BaPP1XPw.js → item-D5qxr3Lk.js} +1 -1
  135. package/dist/assets/{javascript.es-9P67vq_T.js → javascript.es-CInOpinR.js} +1 -1
  136. package/dist/assets/{jump-to-line.es-Cj4l1I67.js → jump-to-line.es-GaOpyMuN.js} +1 -1
  137. package/dist/assets/{jump.es-DVtjZkF-.js → jump.es-4QMqZ0U2.js} +1 -1
  138. package/dist/assets/{lint.es-eLWFxcKa.js → lint.es-d-xQpru4.js} +1 -1
  139. package/dist/assets/{lint.es2-GpTg2qB7.js → lint.es2-r0w3QthM.js} +1 -1
  140. package/dist/assets/{lint.es3-eJKqRD1z.js → lint.es3-Duz7LKWy.js} +1 -1
  141. package/dist/assets/{list-header-oZlTZ2ch.js → list-header-Dq6Hm5vy.js} +1 -1
  142. package/dist/assets/{log-BkGAi_un.js → log-CTDXV8ap.js} +1 -1
  143. package/dist/assets/{lottie-react.esm-DZymuHiL.js → lottie-react.esm-Gf3LaMG1.js} +1 -1
  144. package/dist/assets/{matchbrackets.es-DUen6WHE.js → matchbrackets.es-ub9hnhHy.js} +1 -1
  145. package/dist/assets/{memory-CcuZ3GjH.js → memory-Co7ZVOfU.js} +1 -1
  146. package/dist/assets/{mode.es-BLgncka1.js → mode.es-CK82ywlP.js} +1 -1
  147. package/dist/assets/{mode.es2-C2lkMoE7.js → mode.es2-gzITWIBC.js} +1 -1
  148. package/dist/assets/{mode.es3-CRYsREmw.js → mode.es3-CrkiMbzK.js} +1 -1
  149. package/dist/assets/omit-BE_Bff1I.js +1 -0
  150. package/dist/assets/{onlineParser.es-BiBQTv8R.js → onlineParser.es-C1qjwyf6.js} +1 -1
  151. package/dist/assets/{overview-DgXZFrB8.js → overview-WpAQD63O.js} +1 -1
  152. package/dist/assets/{permission-D633VqG0.js → permission-DR4c0ARF.js} +1 -1
  153. package/dist/assets/{preference-7QdXvA7I.js → preference-BJr6poQJ.js} +3 -3
  154. package/dist/assets/{raf-schd.esm-6yAQI9E8.js → raf-schd.esm-CKlBxZ4m.js} +1 -1
  155. package/dist/assets/refType-BFp6Mdcn.js +1 -0
  156. package/dist/assets/{resource-dialog-gdHh8fKp.js → resource-dialog-CnEGcfR6.js} +4 -4
  157. package/dist/assets/{runtime-B5e6cGGX.js → runtime-DiZdSvdg.js} +1 -1
  158. package/dist/assets/{schema-Blu48LcT.js → schema-CV3xzp1r.js} +1 -1
  159. package/dist/assets/{search.es-gJr9rMjt.js → search.es-DKqLEqET.js} +1 -1
  160. package/dist/assets/{searchcursor.es-CWt-zISJ.js → searchcursor.es-BWMpJtYl.js} +1 -1
  161. package/dist/assets/{service-D2-RmUVX.js → service-B4aFqW1U.js} +1 -1
  162. package/dist/assets/{shorten-label-Tu4vbit5.js → shorten-label-B1taCLSu.js} +1 -1
  163. package/dist/assets/{show-hint.es-Nxa_F-_-.js → show-hint.es-C1eZks_O.js} +1 -1
  164. package/dist/assets/{simple-select-BuUixK8r.js → simple-select-BwOhhEqT.js} +1 -1
  165. package/dist/assets/{spaces-CCOUzMaF.js → spaces-BHOuJMC0.js} +1 -1
  166. package/dist/assets/{status-O-A21YK4.js → status-BVDByjVR.js} +1 -1
  167. package/dist/assets/{status-msGV3kDI.js → status-CLTF7DgB.js} +1 -1
  168. package/dist/assets/{sublime.es-CmhC0QBu.js → sublime.es-J7__ylqM.js} +1 -1
  169. package/dist/assets/{switch-control-CWI5Om29.js → switch-control-k82I7Ndl.js} +1 -1
  170. package/dist/assets/{table-icons-VLNele6t.js → table-icons-C8h2igEk.js} +1 -1
  171. package/dist/assets/{team-B-MXJGor.js → team-DTa9igye.js} +1 -1
  172. package/dist/assets/{toLower-1fNo-8Gs.js → toLower-CV1JKc77.js} +1 -1
  173. package/dist/assets/toUpper-CIse071F.js +1 -0
  174. package/dist/assets/{traffic-i_VFNEcA.js → traffic-BZMRS6o_.js} +1 -1
  175. package/dist/assets/{url-evaluation-6DQ24oOJ.js → url-evaluation-BMmqZ9Xm.js} +1 -1
  176. package/dist/assets/{url-join-Bq-w2P_i.js → url-join-3G2iekWy.js} +1 -1
  177. package/dist/assets/{use-mobile-BBz4WOoT.js → use-mobile-4pPVTaiA.js} +1 -1
  178. package/dist/assets/{use-mobile-D5mKgBMg.js → use-mobile-C-Ki3d1-.js} +1 -1
  179. package/dist/assets/{useAsync-C49nf3io.js → useAsync-W0rAsXlK.js} +1 -1
  180. package/dist/assets/{useLocalStorage-C8v8o6PD.js → useLocalStorage-DqX-zdwD.js} +1 -1
  181. package/dist/assets/{useThemeProps-CuAyki4g.js → useThemeProps-BT_RONtx.js} +1 -1
  182. package/dist/assets/{util-pbznBo4J.js → util-CR3vtO32.js} +1 -1
  183. package/dist/assets/{wait-container-WgYu_rWK.js → wait-container-D3DtxHI5.js} +1 -1
  184. package/dist/assets/{withStyles-toRDSEkG.js → withStyles-DQtqSL4M.js} +1 -1
  185. package/dist/assets/{wrap-locale-B7QlLuiz.js → wrap-locale-DB1j-LK3.js} +1 -1
  186. package/dist/index.html +1 -1
  187. package/dist/service-worker.js +1 -1
  188. package/package.json +1 -1
  189. package/dist/assets/api-BjZCencr.js +0 -1
  190. package/dist/assets/cloneDeep-CrmKJTKF.js +0 -1
  191. package/dist/assets/emotion-react.browser.esm-DwVz9Uas.js +0 -1
  192. package/dist/assets/getValidReactChildren-C5sX3SvA.js +0 -1
  193. package/dist/assets/index-BlL9i6qA.js +0 -192
  194. package/dist/assets/index-Dyg-5fn-.js +0 -1
  195. package/dist/assets/index-f1wvnc7Y.js +0 -11
  196. package/dist/assets/is-path-prefix-equal-CXMwO6Qz.js +0 -1
  197. package/dist/assets/omit-BT1EorTD.js +0 -1
  198. package/dist/assets/refType-BUu3J1GQ.js +0 -1
  199. package/dist/assets/toUpper-CCtpR6nt.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as Q,s as Y,j as e,L as V,I as F,r as u,u as W,a as $,b as I,P as j,d as X,e as J,_ as K,f as Z,g as ee,W as P,T as y,h as ne,i as b,k as h,G as g,n as q,p as te,C as ae,l as A}from"./index-DdJGYtAD.js";import{f as se}from"./index-BojVbZw0.js";import{I as E}from"./index-CB0oehbS.js";import{C as T}from"./click-to-copy-CCNzNZ1Q.js";import{w as re}from"./withStyles-toRDSEkG.js";var oe=Q(function(n,c,r){return n+(r?" ":"")+c.toLowerCase()});function L({icon:n,value:c,name:r,url:p="",animated:i=!1,LinkComponent:o=V,prefix:m="/images"}){const s=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"metric__image",children:e.jsx(F,{name:n,alt:typeof r=="string"?r:"",size:30,prefix:m,color:"#222222"})}),e.jsxs("div",{children:[e.jsx("div",{className:`metric__number ${i?"metric__number--animated":""}`,dangerouslySetInnerHTML:{__html:c}}),e.jsx("div",{className:"metric__name",children:r})]})]});return e.jsx(ie,{children:p?e.jsx(o,{to:p,children:s}):s})}const ie=Y("div")`
1
+ import{c as Q,s as Y,j as e,L as V,I as F,r as u,u as W,a as $,b as I,P as j,d as X,e as J,_ as K,f as Z,g as ee,W as P,T as y,h as ne,i as b,k as h,G as g,n as q,p as te,C as ae,l as A}from"./index-KdOmwCM0.js";import{f as se}from"./index-BojVbZw0.js";import{I as E}from"./index-yrfr0MWP.js";import{C as T}from"./click-to-copy-mgHOJgOu.js";import{w as re}from"./withStyles-DQtqSL4M.js";var oe=Q(function(n,c,r){return n+(r?" ":"")+c.toLowerCase()});function L({icon:n,value:c,name:r,url:p="",animated:i=!1,LinkComponent:o=V,prefix:m="/images"}){const s=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"metric__image",children:e.jsx(F,{name:n,alt:typeof r=="string"?r:"",size:30,prefix:m,color:"#222222"})}),e.jsxs("div",{children:[e.jsx("div",{className:`metric__number ${i?"metric__number--animated":""}`,dangerouslySetInnerHTML:{__html:c}}),e.jsx("div",{className:"metric__name",children:r})]})]});return e.jsx(ie,{children:p?e.jsx(o,{to:p,children:s}):s})}const ie=Y("div")`
2
2
  border-left: 1px solid ${n=>n.theme.typography.color.main};
3
3
  padding: 10px 0 10px 16px;
4
4
  @media (max-width: ${n=>n.theme.breakpoints.values.sm}px) {
@@ -1,4 +1,4 @@
1
- import{D as fe,g as ge}from"./index-DMApNFrR.js";import{bZ as q,j as e,P as o,m as L,r as C,bs as _,fX as je,l6 as ye,hb as we,N as f,v as le,k as S,C as H,Y as X,hc as ve,ek as N,aZ as ae,X as V,aC as $,aW as Z,aa as G,bh as ee,ab as Q,cC as ke,ee as O,a6 as te,id as Ee,ba as Ce,bb as Te,bm as Se,z as W,bi as Re,O as ce,a_ as z,bj as Me,G as K,aJ as Ie,ac as ze,fK as Pe,a4 as De,aI as $e,la as Oe,fR as We,bu as pe,b_ as ue,F as Ae,lb as qe,ag as Le}from"./index-DdJGYtAD.js";import{d as Be}from"./Add-CWZdCpsj.js";import{u as U}from"./team-B-MXJGor.js";import{u as He,C as Y}from"./index.esm-DhOdskub.js";import{u as he}from"./blocklet-Cj0P-s6g.js";import{C as J}from"./index-77IZhlGI.js";import{u as Ne}from"./index-B_OKp_Op.js";import{L as Fe}from"./ListSubheader-CzAOd4qf.js";import{C as _e}from"./Close-H0Qu26Eg.js";import{E as Ue}from"./index-Cte4JXAJ.js";import{A as Ve}from"./actions-Dao-vIba.js";import{D as Ke}from"./Delete-uTw81SAG.js";import"./TableRow-D7-Zq-OD.js";import"./useThemeProps-CuAyki4g.js";import"./emotion-react.browser.esm-DwVz9Uas.js";import"./ViewColumn-423RpdF7.js";import"./Search-CnGd_Ao7.js";import"./Clear-Dt61s4Jb.js";import"./Delete-D3Cc6_4Q.js";import"./MoreVert-BVKVbqMe.js";import"./TableSearch-Bc199o0T.js";import"./url-evaluation-6DQ24oOJ.js";import"./MoreHoriz-C2u_cYyx.js";const Ye=q(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),Je=q(e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),Ge=q(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined"),Qe=q(e.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined"),Xe=q(e.jsx("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause"),Ze=q(e.jsx("path",{d:"M8 5v14l11-7z"}),"PlayArrow"),et=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=he(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.domainAliases[0])==null?void 0:y.value,k=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:k,loading:a,error:R,loadData:T}};function oe({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=L(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:j}])=>{const E=j.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),k=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},h=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ae,{control:e.jsx(V,{onChange:h,checked:l>0&&l===k}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const I=s[r]>0,i=s[r]===j.length&&j.length>0,x=R[r];return e.jsxs(ee.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(ae,{control:e.jsx(V,{checked:i,indeterminate:I&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(ke,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),I&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(te,{size:"small",edge:"end",children:x?e.jsx(Ee,{}):e.jsx(Ce,{})})]})]})}),j.length>0&&e.jsx(Te,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,v=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:v,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Se,{error:!0,sx:{mt:1},children:a})]})}oe.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};oe.defaultProps={error:null};function ne({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=L(),[s,l]=C.useState({}),{teamDid:k}=U(),{api:T}=_(),{loading:g,error:y,eventsBySource:h}=et(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:I}=He({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(v=>v);u("selectedEvents",m?"valid":""),I("selectedEvents")},[s,u,I]);const i=()=>{l({}),E(),R()},x=async m=>{const v=Object.keys(s).filter(M=>s[M]),P={url:m.url,description:m.description,enabledEvents:v.map(M=>{const[A,B]=M.split("-");return!A||!B?null:{type:A,source:B}}).filter(Boolean)};try{if(t){const M=await T.updateWebhookEndpoint({input:{teamDid:k,id:t,data:P}});W.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(M)}else{const M=await T.createWebhookEndpoint({input:{teamDid:k,input:P}});W.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(M)}}catch(M){W.error(M==null?void 0:M.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,v)=>(m[`${v.type}-${v.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(je,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(ye,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(we,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Y,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!j.url,helperText:(v=j.url)==null?void 0:v.message})}}),e.jsx(Y,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!j.description,helperText:(v=j.description)==null?void 0:v.message})}}),e.jsx(Y,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&h&&Object.keys(h).length>0&&e.jsx(oe,{eventsBySource:h,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(H,{size:20})}),y&&e.jsx(X,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(ve,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:i,children:p("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ne.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ne.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const tt=(t="en")=>t==="tw"?"zh":t;function F(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Re(t).locale(tt(c)).format(d):"-"}function ot(t){return typeof t=="number"?!1:ce(t)}function nt(t){return t>=200&&t<300}function D(t){const d=ot(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(z,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx($,{title:t.tip,children:e.jsx(Qe,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(Me,{orientation:"vertical",flexItem:!0})]})}D.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};D.defaultProps={tip:"",divider:!1};function se(t){return e.jsxs(z,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}se.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const st=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function re({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=_(),{t:b}=L(),{teamDid:R}=U(),{blocklet:p}=he(),{data:s,loadMore:l,loadingMore:k,loading:T}=Ne(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),g=(s==null?void 0:s.list)||[],[y,h]=C.useState(null),r=st(g);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&h(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(H,{});const j=s&&s.list.length<s.paging.total,E=u=>{var I,i,x,n,m;if(u.responseBody&&((I=u.responseBody)!=null&&I.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const v=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,P=(p.children||[]).find(A=>{var B;return((B=A==null?void 0:A.meta)==null?void 0:B.name)==="ai-studio"}),M=Pe(De(`https://${v}`,(P==null?void 0:P.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(te,{sx:{fontSize:20},onClick:()=>window.open(M,"_blank"),children:e.jsx(f,{component:$e,icon:Oe})})}return null};return e.jsxs(K,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(K,{item:!0,xs:12,md:4,height:1,children:ce(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,I])=>e.jsxs(ee.Fragment,{children:[e.jsx(Fe,{children:u}),I.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:F(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ie,{sx:{minWidth:0,mr:1.5},children:nt(i.responseStatus)===!1?e.jsx(Ge,{color:"error"}):e.jsx(Ye,{color:"success"})}),e.jsx(ze,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:k,sx:{color:u=>u.palette.text.disabled},children:b(k?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(K,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(z,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(J,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}re.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};re.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:t,onClose:d}){var k,T,g,y;const{t:c}=L(),{api:a}=_(),{teamDid:b}=U(),{loading:R,error:p,data:s}=pe(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(X,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(H,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(z,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(z,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx($,{title:l.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(z,{direction:"row",alignItems:"center",children:e.jsx(te,{edge:"end",color:"inherit",onClick:d,children:e.jsx(_e,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(z,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(D,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:F(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:F(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx($,{arrow:!0,title:(k=l.createUser)==null?void 0:k.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(z,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(z,{height:0,flex:1,overflow:"hidden",children:e.jsx(re,{webhookEndpointId:l.id})})]})]})}me.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const rt=ue(z)``;function be({open:t,onClose:d,id:c}){return e.jsx(We,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:c,onClose:d})})})}be.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function de(){return null}const ie=ee.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=L(),l=Ae(g=>g.breakpoints.down("md")),k={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=de),a||(T.TableFooter=de),e.jsx(it,{locale:s,options:{...k,...t},columns:(d||[]).map(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(Ue,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});ie.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const it=ue(fe)`
1
+ import{D as fe,g as ge}from"./index-BhA9P09u.js";import{bZ as q,j as e,P as o,m as L,r as C,bs as _,fX as je,l6 as ye,hb as we,N as f,v as le,k as S,C as H,Y as X,hc as ve,ek as N,aZ as ae,X as V,aC as $,aW as Z,aa as G,bh as ee,ab as Q,cC as ke,ee as O,a6 as te,id as Ee,ba as Ce,bb as Te,bm as Se,z as W,bi as Re,O as ce,a_ as z,bj as Me,G as K,aJ as Ie,ac as ze,fK as Pe,a4 as De,aI as $e,la as Oe,fR as We,bu as pe,b_ as ue,F as Ae,lb as qe,ag as Le}from"./index-KdOmwCM0.js";import{d as Be}from"./Add-B5o3lKZ4.js";import{u as U}from"./team-DTa9igye.js";import{u as He,C as Y}from"./index.esm-BZeAlIeN.js";import{u as he}from"./blocklet-DgGtZNCB.js";import{C as J}from"./index-BsoiXoFC.js";import{u as Ne}from"./index-C8FhJ0rj.js";import{L as Fe}from"./ListSubheader-r9QVg4z3.js";import{C as _e}from"./Close-w8eKEJW7.js";import{E as Ue}from"./index-D6UMpm4p.js";import{A as Ve}from"./actions-C1blhdkh.js";import{D as Ke}from"./Delete-DSB9GjVg.js";import"./TableRow-BMSWmGPk.js";import"./useThemeProps-BT_RONtx.js";import"./emotion-react.browser.esm-DwA9twTe.js";import"./ViewColumn-BIPD356c.js";import"./Search-DnEqCvoa.js";import"./Clear-C7odY-6_.js";import"./Delete-DpNbJCJA.js";import"./MoreVert-UFPlWjze.js";import"./TableSearch-Dobasaj8.js";import"./url-evaluation-BMmqZ9Xm.js";import"./MoreHoriz-DuOMe2bn.js";const Ye=q(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),Je=q(e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),Ge=q(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined"),Qe=q(e.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined"),Xe=q(e.jsx("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause"),Ze=q(e.jsx("path",{d:"M8 5v14l11-7z"}),"PlayArrow"),et=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=he(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.domainAliases[0])==null?void 0:y.value,k=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:k,loading:a,error:R,loadData:T}};function oe({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=L(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:j}])=>{const E=j.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),k=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},h=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ae,{control:e.jsx(V,{onChange:h,checked:l>0&&l===k}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const I=s[r]>0,i=s[r]===j.length&&j.length>0,x=R[r];return e.jsxs(ee.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(ae,{control:e.jsx(V,{checked:i,indeterminate:I&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(ke,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),I&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(te,{size:"small",edge:"end",children:x?e.jsx(Ee,{}):e.jsx(Ce,{})})]})]})}),j.length>0&&e.jsx(Te,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,v=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:v,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Se,{error:!0,sx:{mt:1},children:a})]})}oe.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};oe.defaultProps={error:null};function ne({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=L(),[s,l]=C.useState({}),{teamDid:k}=U(),{api:T}=_(),{loading:g,error:y,eventsBySource:h}=et(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:I}=He({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(v=>v);u("selectedEvents",m?"valid":""),I("selectedEvents")},[s,u,I]);const i=()=>{l({}),E(),R()},x=async m=>{const v=Object.keys(s).filter(M=>s[M]),P={url:m.url,description:m.description,enabledEvents:v.map(M=>{const[A,B]=M.split("-");return!A||!B?null:{type:A,source:B}}).filter(Boolean)};try{if(t){const M=await T.updateWebhookEndpoint({input:{teamDid:k,id:t,data:P}});W.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(M)}else{const M=await T.createWebhookEndpoint({input:{teamDid:k,input:P}});W.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(M)}}catch(M){W.error(M==null?void 0:M.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,v)=>(m[`${v.type}-${v.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(je,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(ye,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(we,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Y,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!j.url,helperText:(v=j.url)==null?void 0:v.message})}}),e.jsx(Y,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!j.description,helperText:(v=j.description)==null?void 0:v.message})}}),e.jsx(Y,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&h&&Object.keys(h).length>0&&e.jsx(oe,{eventsBySource:h,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(H,{size:20})}),y&&e.jsx(X,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(ve,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:i,children:p("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ne.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ne.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const tt=(t="en")=>t==="tw"?"zh":t;function F(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Re(t).locale(tt(c)).format(d):"-"}function ot(t){return typeof t=="number"?!1:ce(t)}function nt(t){return t>=200&&t<300}function D(t){const d=ot(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(z,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx($,{title:t.tip,children:e.jsx(Qe,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(Me,{orientation:"vertical",flexItem:!0})]})}D.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};D.defaultProps={tip:"",divider:!1};function se(t){return e.jsxs(z,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}se.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const st=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function re({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=_(),{t:b}=L(),{teamDid:R}=U(),{blocklet:p}=he(),{data:s,loadMore:l,loadingMore:k,loading:T}=Ne(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),g=(s==null?void 0:s.list)||[],[y,h]=C.useState(null),r=st(g);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&h(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(H,{});const j=s&&s.list.length<s.paging.total,E=u=>{var I,i,x,n,m;if(u.responseBody&&((I=u.responseBody)!=null&&I.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const v=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,P=(p.children||[]).find(A=>{var B;return((B=A==null?void 0:A.meta)==null?void 0:B.name)==="ai-studio"}),M=Pe(De(`https://${v}`,(P==null?void 0:P.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(te,{sx:{fontSize:20},onClick:()=>window.open(M,"_blank"),children:e.jsx(f,{component:$e,icon:Oe})})}return null};return e.jsxs(K,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(K,{item:!0,xs:12,md:4,height:1,children:ce(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,I])=>e.jsxs(ee.Fragment,{children:[e.jsx(Fe,{children:u}),I.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:F(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ie,{sx:{minWidth:0,mr:1.5},children:nt(i.responseStatus)===!1?e.jsx(Ge,{color:"error"}):e.jsx(Ye,{color:"success"})}),e.jsx(ze,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:k,sx:{color:u=>u.palette.text.disabled},children:b(k?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(K,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(z,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(J,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}re.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};re.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:t,onClose:d}){var k,T,g,y;const{t:c}=L(),{api:a}=_(),{teamDid:b}=U(),{loading:R,error:p,data:s}=pe(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(X,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(H,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(z,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(z,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx($,{title:l.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(z,{direction:"row",alignItems:"center",children:e.jsx(te,{edge:"end",color:"inherit",onClick:d,children:e.jsx(_e,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(z,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(D,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:F(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:F(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx($,{arrow:!0,title:(k=l.createUser)==null?void 0:k.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(z,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(z,{height:0,flex:1,overflow:"hidden",children:e.jsx(re,{webhookEndpointId:l.id})})]})]})}me.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const rt=ue(z)``;function be({open:t,onClose:d,id:c}){return e.jsx(We,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:c,onClose:d})})})}be.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function de(){return null}const ie=ee.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=L(),l=Ae(g=>g.breakpoints.down("md")),k={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=de),a||(T.TableFooter=de),e.jsx(it,{locale:s,options:{...k,...t},columns:(d||[]).map(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(Ue,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});ie.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const it=ue(fe)`
2
2
  .custom-toobar-btns {
3
3
  gap: 8px;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{bs as xt,r as j,bF as ee,bi as V,z as Q,E as k,j as e,P as d,T as bt,aQ as Qe,aR as Je,fE as jt,ay as yt,h as ie,aC as vt,k as J,N as C,m as te,ee as ke,Q as Pe,kC as Ze,bn as Te,aZ as Re,X as Ie,ek as Se,b8 as Ve,b6 as Ee,C as et,n as ce,aU as De,W as St,ax as tt,gh as Fe,B as Ae,dO as st,f_ as je,bv as nt,ak as ue,fa as Ct,dP as Nt,G as Ge,kD as wt,kE as Tt,D as Rt,kF as It,kG as Et,kH as Dt,kI as At,bA as at,S as Ot,U as Lt,V as Xe,M as kt,kJ as Pt}from"./index-DdJGYtAD.js";import{k as Ft,D as it,g as _t}from"./index-DMApNFrR.js";import{S as he}from"./shorten-label-Tu4vbit5.js";import{I as ot}from"./index-CB0oehbS.js";import{T as Bt}from"./index-Dn67czO2.js";import{a as _e}from"./actions-4ImpPOP5.js";import{d as zt}from"./Refresh-D-9kJI4M.js";import{D as Wt,g as Mt}from"./traffic-i_VFNEcA.js";import"./TableRow-D7-Zq-OD.js";import"./useThemeProps-CuAyki4g.js";import"./emotion-react.browser.esm-DwVz9Uas.js";import"./ViewColumn-423RpdF7.js";import"./Search-CnGd_Ao7.js";import"./Clear-Dt61s4Jb.js";import"./Delete-D3Cc6_4Q.js";import"./index-Cte4JXAJ.js";import"./MoreVert-BVKVbqMe.js";import"./TableSearch-Bc199o0T.js";import"./useLocalStorage-C8v8o6PD.js";import"./get-safe-url-DaO0zNfp.js";import"./ButtonGroup-BHcpMxTu.js";import"./getValidReactChildren-C5sX3SvA.js";import"./url-evaluation-6DQ24oOJ.js";import"./permission-D633VqG0.js";import"./iframe-CS_rJQlP.js";import"./ChevronLeft-CWq3Gxqj.js";import"./ChevronRight-DpVf81V0.js";import"./index-C58fITNM.js";import"./CardContent-BSYOgOvL.js";import"./AdapterDayjs-D0B_jcmg.js";import"./CSSTransition-BuWP1JFF.js";import"./refType-BUu3J1GQ.js";const rt=j.createContext({}),{Provider:qt,Consumer:Ys}=rt;function Kt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=xt(),[a,x]=j.useState([]),[u,R]=j.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]=j.useState([]),[I,M]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const P={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=P;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),R(se.paging),se.list}catch(P){return Q.error(P.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var P;return((P=A.meta)==null?void 0:P.did)===h});if(O)return O.ancestors=[s],O},[s]),U=async({notificationId:h,receivers:O,channels:A,...P})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?k.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?k.NOTIFICATION_SEND_CHANNEL.PUSH:B),...P}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const P={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:P})}catch(P){throw Q.error(P.message),P}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(k.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(k.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const _={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:U,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(qt,{value:{notificationRecords:_},children:t})}function Be(){const{notificationRecords:t}=j.useContext(rt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(bt,{type:Ut[t],children:t})}var ze={},Ht=Je;Object.defineProperty(ze,"__esModule",{value:!0});var lt=ze.default=void 0,$t=Ht(Qe()),Vt=e;lt=ze.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 We={},Gt=Je;Object.defineProperty(We,"__esModule",{value:!0});var ct=We.default=void 0,Xt=Gt(Qe()),Yt=e;ct=We.default=(0,Xt.default)((0,Yt.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");const Qt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case k.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function dt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:yt(o,s)}):"",R=Qt(t,x,a);return r===k.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===k.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Ye=["info","success","error","warning"],ut=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},pt=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},Jt=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ut(t),enabled:n}},Zt=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:pt(t),enabled:n}},es=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),ts=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ss=(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},ns=(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,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(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},as=t=>{switch(t){case k.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case k.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case k.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case k.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ft=()=>jt({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,R=[a,u].filter(Boolean).join(", ");return e.jsx(vt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:R}),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(J,{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(J,{children:[s,": "]}),t.map(a=>{const x=dt(r,o,{status:a});return e.jsx(ke,{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)})]})}Me.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 Me({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Pe,{className:"filter-container",children:[e.jsx(Ze,{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:R=>{const m=[...t];R.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(Me,{...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=dt(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(_e,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}qe.propTypes={value:d.array.isRequired,onChange:d.func};function qe({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Q.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Q.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{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:[Ve(t[0],n)," - ",Ve(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Wt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Mt(r),onChange:R})})]})}Ke.propTypes={itemComponent:d.elementType.isRequired};function Ke({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(Ft.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(ke,{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 is=[{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}];Ue.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ue.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ue({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(is),[x,u]=j.useState(!0),R=(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(J,{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(Pe,{component:"fieldset",variant:"standard",children:[e.jsx(Ze,{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=>R(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(et,{size:16}),r("common.confirm")]})]})]})}mt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function mt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=Be(),[v,S]=j.useState(!1),[I,M]=j.useState([]),E=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[D,G]=j.useState(null),[U,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,_]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{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"}],P=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:nt(c.receiverUser.avatar,u,x)}}));M(l),H(i.paging),S(!1)}catch(i){Q.error(i.message),S(!1)}};j.useEffect(()=>{P()},[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(_e,{}),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:U.page-1,rowsPerPage:U.pageSize,count:U.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:y})=>{const[,F=[],$=[],K=[]]=y;N.pageSize!==l?_(W=>({...W,pageSize:l,page:1})):N.page!==i+1?_(W=>({...W,page:i+1})):N.searchText!==c?_(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue($,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||_(W=>({...W,emailSendStatus:K,page:1})):_(W=>({...W,pushKitSendStatus:$,page:1})):_(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?es(c):i==="email"?Jt(m,c):i==="pushKit"?Zt(m,c):i==="webhook"?ts(c):!0:!1},[R,m]),se=j.useCallback(i=>ss(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,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Q.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),ns(l,c)>=4){Q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);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],F),L.anchorEl||(await xe(.5),f()))}catch(K){Q.error(K.message)}},X=i=>{_(l=>({...l,dateRange:i,page:1}))},Y=(i,l,c,y)=>{i.stopPropagation();const F=c.filter($=>$!==l);_($=>({...$,[y]:F,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(tt,{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(St,{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(),Y(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,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:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,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(),Y(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,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(),Y(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{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[y,F]=c,$=F[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:y},y),e.jsx(de,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Fe,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),$e=[e.jsx(qe,{value:N.dateRange,onChange:X},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(zt,{}),onClick:()=>P(),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(rs,{children:e.jsxs(st,{theme:ft(),children:[e.jsx(it,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Z,customButtons:$e,components:{TableFilterList:i=>e.jsx(Ke,{...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(ls,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,$;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=D==null?void 0:D.result)!=null&&$[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(lt,{}):e.jsx(et,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(ct,{}),e.jsx("span",{children:y})]},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(Ue,{loading:n,onCancel:p,onConfirm:b})})]})})})}const os=j.memo(mt),rs=ce.div`
1
+ import{bs as xt,r as j,bF as ee,bi as V,z as Q,E as k,j as e,P as d,T as bt,aQ as Qe,aR as Je,fE as jt,ay as yt,h as ie,aC as vt,k as J,N as C,m as te,ee as ke,Q as Pe,kC as Ze,bn as Te,aZ as Re,X as Ie,ek as Se,b8 as Ve,b6 as Ee,C as et,n as ce,aU as De,W as St,ax as tt,gh as Fe,B as Ae,dO as st,f_ as je,bv as nt,ak as ue,fa as Ct,dP as Nt,G as Ge,kD as wt,kE as Tt,D as Rt,kF as It,kG as Et,kH as Dt,kI as At,bA as at,S as Ot,U as Lt,V as Xe,M as kt,kJ as Pt}from"./index-KdOmwCM0.js";import{k as Ft,D as it,g as _t}from"./index-BhA9P09u.js";import{S as he}from"./shorten-label-B1taCLSu.js";import{I as ot}from"./index-yrfr0MWP.js";import{T as Bt}from"./index-DPJjuq8y.js";import{a as _e}from"./actions-CIvfyQ4N.js";import{d as zt}from"./Refresh-DsQW01Ya.js";import{D as Wt,g as Mt}from"./traffic-BZMRS6o_.js";import"./TableRow-BMSWmGPk.js";import"./useThemeProps-BT_RONtx.js";import"./emotion-react.browser.esm-DwA9twTe.js";import"./ViewColumn-BIPD356c.js";import"./Search-DnEqCvoa.js";import"./Clear-C7odY-6_.js";import"./Delete-DpNbJCJA.js";import"./index-D6UMpm4p.js";import"./MoreVert-UFPlWjze.js";import"./TableSearch-Dobasaj8.js";import"./useLocalStorage-DqX-zdwD.js";import"./get-safe-url-fVLOWjDv.js";import"./ButtonGroup-DP9Um2zw.js";import"./getValidReactChildren-BybUhg_p.js";import"./url-evaluation-BMmqZ9Xm.js";import"./permission-DR4c0ARF.js";import"./iframe-B52MZmUp.js";import"./ChevronLeft-CVA4N8rQ.js";import"./ChevronRight-sZUpX7tH.js";import"./index-Btu7Neya.js";import"./CardContent-CV6vnW6h.js";import"./AdapterDayjs-DN3WVSzh.js";import"./CSSTransition-Ce16mrqT.js";import"./refType-BFp6Mdcn.js";const rt=j.createContext({}),{Provider:qt,Consumer:Ys}=rt;function Kt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=xt(),[a,x]=j.useState([]),[u,R]=j.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]=j.useState([]),[I,M]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const P={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=P;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),R(se.paging),se.list}catch(P){return Q.error(P.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var P;return((P=A.meta)==null?void 0:P.did)===h});if(O)return O.ancestors=[s],O},[s]),U=async({notificationId:h,receivers:O,channels:A,...P})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?k.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?k.NOTIFICATION_SEND_CHANNEL.PUSH:B),...P}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const P={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:P})}catch(P){throw Q.error(P.message),P}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(k.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(k.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const _={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:U,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(qt,{value:{notificationRecords:_},children:t})}function Be(){const{notificationRecords:t}=j.useContext(rt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(bt,{type:Ut[t],children:t})}var ze={},Ht=Je;Object.defineProperty(ze,"__esModule",{value:!0});var lt=ze.default=void 0,$t=Ht(Qe()),Vt=e;lt=ze.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 We={},Gt=Je;Object.defineProperty(We,"__esModule",{value:!0});var ct=We.default=void 0,Xt=Gt(Qe()),Yt=e;ct=We.default=(0,Xt.default)((0,Yt.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");const Qt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case k.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function dt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:yt(o,s)}):"",R=Qt(t,x,a);return r===k.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===k.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Ye=["info","success","error","warning"],ut=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},pt=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},Jt=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ut(t),enabled:n}},Zt=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:pt(t),enabled:n}},es=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),ts=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ss=(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},ns=(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,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(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},as=t=>{switch(t){case k.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case k.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case k.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case k.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ft=()=>jt({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,R=[a,u].filter(Boolean).join(", ");return e.jsx(vt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:R}),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(J,{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(J,{children:[s,": "]}),t.map(a=>{const x=dt(r,o,{status:a});return e.jsx(ke,{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)})]})}Me.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 Me({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Pe,{className:"filter-container",children:[e.jsx(Ze,{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:R=>{const m=[...t];R.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(Me,{...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=dt(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(_e,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}qe.propTypes={value:d.array.isRequired,onChange:d.func};function qe({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Q.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Q.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{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:[Ve(t[0],n)," - ",Ve(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Wt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Mt(r),onChange:R})})]})}Ke.propTypes={itemComponent:d.elementType.isRequired};function Ke({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(Ft.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(ke,{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 is=[{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}];Ue.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ue.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ue({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(is),[x,u]=j.useState(!0),R=(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(J,{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(Pe,{component:"fieldset",variant:"standard",children:[e.jsx(Ze,{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=>R(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(et,{size:16}),r("common.confirm")]})]})]})}mt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function mt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=Be(),[v,S]=j.useState(!1),[I,M]=j.useState([]),E=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[D,G]=j.useState(null),[U,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,_]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{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"}],P=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:nt(c.receiverUser.avatar,u,x)}}));M(l),H(i.paging),S(!1)}catch(i){Q.error(i.message),S(!1)}};j.useEffect(()=>{P()},[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(_e,{}),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:U.page-1,rowsPerPage:U.pageSize,count:U.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:y})=>{const[,F=[],$=[],K=[]]=y;N.pageSize!==l?_(W=>({...W,pageSize:l,page:1})):N.page!==i+1?_(W=>({...W,page:i+1})):N.searchText!==c?_(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue($,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||_(W=>({...W,emailSendStatus:K,page:1})):_(W=>({...W,pushKitSendStatus:$,page:1})):_(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?es(c):i==="email"?Jt(m,c):i==="pushKit"?Zt(m,c):i==="webhook"?ts(c):!0:!1},[R,m]),se=j.useCallback(i=>ss(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,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Q.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),ns(l,c)>=4){Q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);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],F),L.anchorEl||(await xe(.5),f()))}catch(K){Q.error(K.message)}},X=i=>{_(l=>({...l,dateRange:i,page:1}))},Y=(i,l,c,y)=>{i.stopPropagation();const F=c.filter($=>$!==l);_($=>({...$,[y]:F,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(tt,{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(St,{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(),Y(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,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:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,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(),Y(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,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(),Y(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{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[y,F]=c,$=F[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:y},y),e.jsx(de,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Fe,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),$e=[e.jsx(qe,{value:N.dateRange,onChange:X},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(zt,{}),onClick:()=>P(),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(rs,{children:e.jsxs(st,{theme:ft(),children:[e.jsx(it,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Z,customButtons:$e,components:{TableFilterList:i=>e.jsx(Ke,{...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(ls,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,$;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=D==null?void 0:D.result)!=null&&$[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(lt,{}):e.jsx(et,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(ct,{}),e.jsx("span",{children:y})]},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(Ue,{loading:n,onCancel:p,onConfirm:b})})]})})})}const os=j.memo(mt),rs=ce.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{ao as ee,y as q,r as p,a as te,b as se,P as b,m as j,u as w,x as oe,az as _,J as O,j as t,w as z,aA as re,a4 as y,k as R,D as W,aB as ne,aC as ae,B as M,C as V,aD as le,z as K,Z as G,aE as ie,aF as ce,N as E,aG as ue,E as de,aH as D,L as pe,aI as he,n as H,ad as fe,a8 as me,aa as ge,ab as xe,aJ as be,ac as ke}from"./index-DdJGYtAD.js";import{_ as L}from"./useLocalStorage-C8v8o6PD.js";import{c as ye,C as Se,A as je,z as we,a as Pe,d as ve,B as Re,S as J,b as Ce,e as Le}from"./item-BaPP1XPw.js";import{g as T}from"./get-safe-url-V1wl4gr3.js";import{P as Q}from"./permission-D633VqG0.js";import{d as Be}from"./ArrowDropDown-CmqsXt9y.js";import{B as De}from"./Breadcrumbs-D6qp1cMT.js";import"./index-B_OKp_Op.js";import"./ChevronLeft-CWq3Gxqj.js";import"./ChevronRight-DpVf81V0.js";import"./Search-CnGd_Ao7.js";import"./index-Cte4JXAJ.js";import"./blocklet-Cj0P-s6g.js";import"./Autocomplete-B9W0x8LR.js";import"./ListSubheader-CzAOd4qf.js";import"./Verified-Dbca1-Es.js";import"./VerifiedUser-C9X9RjKF.js";import"./Add-CWZdCpsj.js";import"./Launch-IYpFZ4ei.js";import"./Done-DHtSx1Az.js";import"./DeleteOutline-jp3vin8Z.js";import"./delete-confirm-CPi3Neq0.js";import"./click-to-copy-CCNzNZ1Q.js";import"./MoreVert-BVKVbqMe.js";import"./get-safe-url-DaO0zNfp.js";import"./ButtonGroup-BHcpMxTu.js";import"./getValidReactChildren-C5sX3SvA.js";function Ee(e){const r=ee(),c=q(),[s,o]=L(`sid:blocklet:purchase:${e}`),[a,u]=p.useState(!1),[h,l]=p.useState(null),f=()=>{const{pathname:n,searchParams:d}=new URL(window.location.href),i=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d.get("sid")&&(o(""),c(n.replace(i,"/"),{replace:!0}))},m=!!(r.get("assetDid")&&s&&r.get("sid")===s);return te(se.BlockletEvents.purchaseChange,n=>{n.did===e&&(l(n.session),["declined","confirmed","error"].includes(n.session.status)&&(u(!0),setTimeout(f,2e3)))}),p.useEffect(()=>{h&&h.id!==s&&o(h.id)},[h]),{hasCompleted:a,hasPurchased:m,session:h,setSession:l,doRedirect:f}}function U({meta:e,onCancel:r,handlePaySuccess:c,storeUrl:s}){const{t:o}=j(),{info:a}=w(),[u,h]=p.useState("both"),[l,f]=p.useState(1),m=oe(a),n=_(e,a,s),d=v=>{v!==u&&h(v)},i=()=>{u&&(f(2),u==="verify"&&(window.location.href=T(n)))},k=(v,B)=>{B!=="backdropClick"&&r()},P=()=>{c(n)},g=O.getDisplayName({meta:e});if(u==="purchase"&&l===2)return t.jsx(z,{open:!0,popup:!0,baseUrl:s,action:"acquire-asset",checkFn:re.create({baseURL:y(s,"/store")}).get,onSuccess:P,onClose:r,checkTimeout:60*5e3,extraParams:{factory:e.nftFactory},webWalletUrl:m,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:o("store.purchase.auth.title",{name:g}),scan:o("store.purchase.auth.scan"),confirm:o("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx(R,{gutterBottom:!0,children:o("store.purchase.auth.success")}),t.jsxs(R,{variant:"subtitle2",children:[" ",o("store.purchase.autoLaunch",{name:g})]})]})}});const x=W;return t.jsx(x,{title:o("store.purchase.title",{name:g}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:k,children:t.jsx("div",{style:{marginBottom:16},children:t.jsx(Se,{action:u,onNext:i,onSelect:d})})})}U.propTypes={...ye,storeUrl:b.string.isRequired,handlePaySuccess:b.func};U.defaultProps={handlePaySuccess:e=>{setTimeout(()=>{window.location.href=T(e,{allowDomains:null})},1e3)}};function I({meta:e,buttonText:r,storeUrl:c,isResource:s}){const{t:o}=j(),a=q(),{info:u}=w(),{api:h}=ne(),l=O.isFreeBlocklet(e)===!1,[f,m]=p.useState(!1),{hasPurchased:n}=Ee(e.did),[d,i]=p.useState(!1),[k]=L("instant-blocklet-install",!1),[P,g]=p.useState(!1),x=p.useMemo(()=>f?o(l?"blocklet.status.purchasing":"blocklet.status.waiting"):"",[f,o,l]),v=p.useMemo(()=>s?o("blocklet.status.resource"):l?r.purchase:r.launch,[l,r,s]),B=S=>{S.preventDefault(),S.stopPropagation();try{if(m(!0),l){i(!0);return}if(k){g(!0);return}if(!l){const C=_(e,u,c);window.location.href=T(C)}}catch(C){K.error(G(C),{autoHideDuration:5e3}),console.error("Blocklet installed failed",C)}finally{m(!1)}},Y=()=>{m(!1),i(!1)},Z=S=>{m(!1),g(!1),a(`/blocklets/${S.appDid}/components`)},X=()=>{m(!1),g(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(je,{children:t.jsx(Q,{permission:"mutate_blocklets",children:S=>t.jsx(ae,{title:s?o("launchBlocklet.error.resourceBlocklet"):"",children:t.jsx(M,{onClick:B,size:"small",sx:{cursor:s?"not-allowed":"pointer"},disabled:!!(x||!S),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:x?t.jsxs(t.Fragment,{children:[t.jsx(V,{size:16,style:{marginRight:3}}),x]}):v},e.did)})})}),(n||d)&&t.jsx(U,{method:"launch",meta:e,mode:"both",onCancel:Y,storeUrl:c}),P&&t.jsx(z,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:h.get,checkTimeout:5*60*1e3,onSuccess:Z,extraParams:{title:e.title,blockletMetaUrl:decodeURIComponent(le(c,e.did).trim())},messages:{title:o("setup.keyPair.title"),scan:o("setup.keyPair.scan"),confirm:o("setup.keyPair.confirm"),success:o("setup.keyPair.success")},onClose:X})]})}I.propTypes={isResource:b.bool,meta:b.object.isRequired,buttonText:b.shape({purchase:b.string.isRequired,launch:b.string.isRequired}).isRequired,storeUrl:b.string.isRequired};I.defaultProps={isResource:!1};const Te=(e,r,c)=>{const s=fe(r);return y(c,`/blocklets/${e.did}/?server-url=${s}`)},$=({meta:e,attribute:r,value:c})=>e._formatted?e._formatted[r]:c,Ue=(e,r)=>{if(!e||!r)return"";try{return y(r,e)}catch(c){return console.warn("Failed to construct avatar URL:",c),""}};function F({blocklet:e,endpoint:r,serverVersion:c}){var n,d;const{t:s}=j(),o=w();let a=y(o.imgPrefix,"blocklet.png");const u=r;if(u.startsWith("http")&&e.logo)a=y(u,ue(e.did,e.logo,e.version));else{let k=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");k&&(k=`/${k}`),a=y(k,`/blocklet/logo/${e.did}`)}try{const i=new URL(a);i.searchParams.set("v",e.version||+new Date),a=i.href}catch{}const h=(o==null?void 0:o.info.mode)!==de.NODE_MODES.SERVERLESS,l=i=>i.currentTarget.contains(i.target)?!0:(i.preventDefault(),!1),f={meta:e,buttonText:{purchase:s("common.purchase"),launch:s("common.launch")},storeUrl:u};let m=null;return h&&(m=t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Pe,{serverVersion:c,requirementVersion:(n=e.requirements)==null?void 0:n.server,size:"small",children:t.jsx(I,{isResource:!(D.hasStartEngine(e)||D.isGatewayBlocklet(e)||D.isPackBlocklet(e)),...f})})})),t.jsx(pe,{href:Te(e,o.info,r),style:{color:"initial",textDecoration:"none"},onClick:l,target:"_blank",children:t.jsx(Ie,{title:$({meta:e,attribute:"title",value:e.title||e.name}),did:e.did,description:$({meta:e,attribute:"description",value:e.description}),cover:e.logo?a:"",version:e.version,onButtonClick:null,icons:(d=e.docker)!=null&&d.image?[{key:"docker",icon:t.jsx(E,{display:"flex",color:"primary.main",children:t.jsx(he,{icon:ve})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,author:e.owner.fullName,avatar:Ue(e.owner.avatar,r),download:e.stats.downloads,button:m})})}F.propTypes={blocklet:b.object.isRequired,serverVersion:b.string,endpoint:b.string};F.defaultProps={endpoint:"",serverVersion:""};function A({storeUrl:e,handleSearchSelect:r,extraFilter:c,...s}){var n;const{locale:o}=j(),a=w(),[u,h]=p.useState({}),l=d=>{h(d)},f=e,m=(n=a==null?void 0:a.info)==null?void 0:n.version;return p.useEffect(()=>{h({})},[f]),t.jsx(ie,{FallbackComponent:ce,resetKeys:[f],children:t.jsx(E,{...s,sx:{"& .title-bar":{pt:0}},children:t.jsx(we,{layout:{showExplore:!1,showTitle:!0},blockletRender:d=>{const i={...d,endpoint:f};return t.jsx(F,{...i})},baseSearch:!0,endpoint:f,locale:o,onFilterChange:l,onSearchSelect:r,filters:u,extraFilter:c,serverVersion:m})})})}A.propTypes={storeUrl:b.string.isRequired,handleSearchSelect:b.func,extraFilter:b.func};A.defaultProps={handleSearchSelect:null,extraFilter:void 0};const Ie=H(Re)`
1
+ import{ao as ee,y as q,r as p,a as te,b as se,P as b,m as j,u as w,x as oe,az as _,J as O,j as t,w as z,aA as re,a4 as y,k as R,D as W,aB as ne,aC as ae,B as M,C as V,aD as le,z as K,Z as G,aE as ie,aF as ce,N as E,aG as ue,E as de,aH as D,L as pe,aI as he,n as H,ad as fe,a8 as me,aa as ge,ab as xe,aJ as be,ac as ke}from"./index-KdOmwCM0.js";import{_ as L}from"./useLocalStorage-DqX-zdwD.js";import{c as ye,C as Se,A as je,z as we,a as Pe,d as ve,B as Re,S as J,b as Ce,e as Le}from"./item-D5qxr3Lk.js";import{g as T}from"./get-safe-url-BQ9e1d8R.js";import{P as Q}from"./permission-DR4c0ARF.js";import{d as Be}from"./ArrowDropDown-RVN4Mn-W.js";import{B as De}from"./Breadcrumbs-BO8goWHs.js";import"./index-C8FhJ0rj.js";import"./ChevronLeft-CVA4N8rQ.js";import"./ChevronRight-sZUpX7tH.js";import"./Search-DnEqCvoa.js";import"./index-D6UMpm4p.js";import"./blocklet-DgGtZNCB.js";import"./Autocomplete-DHpI8PP1.js";import"./ListSubheader-r9QVg4z3.js";import"./Verified-oP4ZelZh.js";import"./VerifiedUser-CzEMJOGM.js";import"./Add-B5o3lKZ4.js";import"./Launch-9QmeNFGh.js";import"./Done-CasEZEMQ.js";import"./DeleteOutline-B4zcgGCZ.js";import"./delete-confirm-B0FL8Sx7.js";import"./click-to-copy-mgHOJgOu.js";import"./MoreVert-UFPlWjze.js";import"./get-safe-url-fVLOWjDv.js";import"./ButtonGroup-DP9Um2zw.js";import"./getValidReactChildren-BybUhg_p.js";function Ee(e){const r=ee(),c=q(),[s,o]=L(`sid:blocklet:purchase:${e}`),[a,u]=p.useState(!1),[h,l]=p.useState(null),f=()=>{const{pathname:n,searchParams:d}=new URL(window.location.href),i=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d.get("sid")&&(o(""),c(n.replace(i,"/"),{replace:!0}))},m=!!(r.get("assetDid")&&s&&r.get("sid")===s);return te(se.BlockletEvents.purchaseChange,n=>{n.did===e&&(l(n.session),["declined","confirmed","error"].includes(n.session.status)&&(u(!0),setTimeout(f,2e3)))}),p.useEffect(()=>{h&&h.id!==s&&o(h.id)},[h]),{hasCompleted:a,hasPurchased:m,session:h,setSession:l,doRedirect:f}}function U({meta:e,onCancel:r,handlePaySuccess:c,storeUrl:s}){const{t:o}=j(),{info:a}=w(),[u,h]=p.useState("both"),[l,f]=p.useState(1),m=oe(a),n=_(e,a,s),d=v=>{v!==u&&h(v)},i=()=>{u&&(f(2),u==="verify"&&(window.location.href=T(n)))},k=(v,B)=>{B!=="backdropClick"&&r()},P=()=>{c(n)},g=O.getDisplayName({meta:e});if(u==="purchase"&&l===2)return t.jsx(z,{open:!0,popup:!0,baseUrl:s,action:"acquire-asset",checkFn:re.create({baseURL:y(s,"/store")}).get,onSuccess:P,onClose:r,checkTimeout:60*5e3,extraParams:{factory:e.nftFactory},webWalletUrl:m,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:o("store.purchase.auth.title",{name:g}),scan:o("store.purchase.auth.scan"),confirm:o("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx(R,{gutterBottom:!0,children:o("store.purchase.auth.success")}),t.jsxs(R,{variant:"subtitle2",children:[" ",o("store.purchase.autoLaunch",{name:g})]})]})}});const x=W;return t.jsx(x,{title:o("store.purchase.title",{name:g}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:k,children:t.jsx("div",{style:{marginBottom:16},children:t.jsx(Se,{action:u,onNext:i,onSelect:d})})})}U.propTypes={...ye,storeUrl:b.string.isRequired,handlePaySuccess:b.func};U.defaultProps={handlePaySuccess:e=>{setTimeout(()=>{window.location.href=T(e,{allowDomains:null})},1e3)}};function I({meta:e,buttonText:r,storeUrl:c,isResource:s}){const{t:o}=j(),a=q(),{info:u}=w(),{api:h}=ne(),l=O.isFreeBlocklet(e)===!1,[f,m]=p.useState(!1),{hasPurchased:n}=Ee(e.did),[d,i]=p.useState(!1),[k]=L("instant-blocklet-install",!1),[P,g]=p.useState(!1),x=p.useMemo(()=>f?o(l?"blocklet.status.purchasing":"blocklet.status.waiting"):"",[f,o,l]),v=p.useMemo(()=>s?o("blocklet.status.resource"):l?r.purchase:r.launch,[l,r,s]),B=S=>{S.preventDefault(),S.stopPropagation();try{if(m(!0),l){i(!0);return}if(k){g(!0);return}if(!l){const C=_(e,u,c);window.location.href=T(C)}}catch(C){K.error(G(C),{autoHideDuration:5e3}),console.error("Blocklet installed failed",C)}finally{m(!1)}},Y=()=>{m(!1),i(!1)},Z=S=>{m(!1),g(!1),a(`/blocklets/${S.appDid}/components`)},X=()=>{m(!1),g(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(je,{children:t.jsx(Q,{permission:"mutate_blocklets",children:S=>t.jsx(ae,{title:s?o("launchBlocklet.error.resourceBlocklet"):"",children:t.jsx(M,{onClick:B,size:"small",sx:{cursor:s?"not-allowed":"pointer"},disabled:!!(x||!S),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:x?t.jsxs(t.Fragment,{children:[t.jsx(V,{size:16,style:{marginRight:3}}),x]}):v},e.did)})})}),(n||d)&&t.jsx(U,{method:"launch",meta:e,mode:"both",onCancel:Y,storeUrl:c}),P&&t.jsx(z,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:h.get,checkTimeout:5*60*1e3,onSuccess:Z,extraParams:{title:e.title,blockletMetaUrl:decodeURIComponent(le(c,e.did).trim())},messages:{title:o("setup.keyPair.title"),scan:o("setup.keyPair.scan"),confirm:o("setup.keyPair.confirm"),success:o("setup.keyPair.success")},onClose:X})]})}I.propTypes={isResource:b.bool,meta:b.object.isRequired,buttonText:b.shape({purchase:b.string.isRequired,launch:b.string.isRequired}).isRequired,storeUrl:b.string.isRequired};I.defaultProps={isResource:!1};const Te=(e,r,c)=>{const s=fe(r);return y(c,`/blocklets/${e.did}/?server-url=${s}`)},$=({meta:e,attribute:r,value:c})=>e._formatted?e._formatted[r]:c,Ue=(e,r)=>{if(!e||!r)return"";try{return y(r,e)}catch(c){return console.warn("Failed to construct avatar URL:",c),""}};function F({blocklet:e,endpoint:r,serverVersion:c}){var n,d;const{t:s}=j(),o=w();let a=y(o.imgPrefix,"blocklet.png");const u=r;if(u.startsWith("http")&&e.logo)a=y(u,ue(e.did,e.logo,e.version));else{let k=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");k&&(k=`/${k}`),a=y(k,`/blocklet/logo/${e.did}`)}try{const i=new URL(a);i.searchParams.set("v",e.version||+new Date),a=i.href}catch{}const h=(o==null?void 0:o.info.mode)!==de.NODE_MODES.SERVERLESS,l=i=>i.currentTarget.contains(i.target)?!0:(i.preventDefault(),!1),f={meta:e,buttonText:{purchase:s("common.purchase"),launch:s("common.launch")},storeUrl:u};let m=null;return h&&(m=t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Pe,{serverVersion:c,requirementVersion:(n=e.requirements)==null?void 0:n.server,size:"small",children:t.jsx(I,{isResource:!(D.hasStartEngine(e)||D.isGatewayBlocklet(e)||D.isPackBlocklet(e)),...f})})})),t.jsx(pe,{href:Te(e,o.info,r),style:{color:"initial",textDecoration:"none"},onClick:l,target:"_blank",children:t.jsx(Ie,{title:$({meta:e,attribute:"title",value:e.title||e.name}),did:e.did,description:$({meta:e,attribute:"description",value:e.description}),cover:e.logo?a:"",version:e.version,onButtonClick:null,icons:(d=e.docker)!=null&&d.image?[{key:"docker",icon:t.jsx(E,{display:"flex",color:"primary.main",children:t.jsx(he,{icon:ve})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,author:e.owner.fullName,avatar:Ue(e.owner.avatar,r),download:e.stats.downloads,button:m})})}F.propTypes={blocklet:b.object.isRequired,serverVersion:b.string,endpoint:b.string};F.defaultProps={endpoint:"",serverVersion:""};function A({storeUrl:e,handleSearchSelect:r,extraFilter:c,...s}){var n;const{locale:o}=j(),a=w(),[u,h]=p.useState({}),l=d=>{h(d)},f=e,m=(n=a==null?void 0:a.info)==null?void 0:n.version;return p.useEffect(()=>{h({})},[f]),t.jsx(ie,{FallbackComponent:ce,resetKeys:[f],children:t.jsx(E,{...s,sx:{"& .title-bar":{pt:0}},children:t.jsx(we,{layout:{showExplore:!1,showTitle:!0},blockletRender:d=>{const i={...d,endpoint:f};return t.jsx(F,{...i})},baseSearch:!0,endpoint:f,locale:o,onFilterChange:l,onSearchSelect:r,filters:u,extraFilter:c,serverVersion:m})})})}A.propTypes={storeUrl:b.string.isRequired,handleSearchSelect:b.func,extraFilter:b.func};A.defaultProps={handleSearchSelect:null,extraFilter:void 0};const Ie=H(Re)`
2
2
  .ms-highlight {
3
3
  color: ${e=>e.theme.palette.primary.main};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{c4 as et,c3 as tt,b_ as te,ch as ee,r as j,c5 as st,c2 as ot,c0 as Me,j as e,c7 as nt,c8 as rt,O as Y,bs as F,bu as at,z as v,Z as X,bi as I,gg as Fe,aV as Pe,b as z,l7 as it,m as E,P as g,hD as ct,x as lt,aA as Ne,a4 as ge,ap as dt,n as pt,k as C,f as ut,C as w,i as mt,an as ht,l8 as _,h4 as $,l9 as ft,N as x,a_ as J,aC as je,E as T,L as gt,T as W,dp as xt,aQ as Ce,aR as Ae,V as H,aJ as V,ac as G,a7 as St,ek as yt,b4 as jt,B as me,w as Ct,G as Le,$ as Je,bF as xe,A as At}from"./index-DdJGYtAD.js";import{T as bt}from"./index-Dn67czO2.js";import{u as O}from"./blocklet-Cj0P-s6g.js";import{u as Bt}from"./use-mobile-BBz4WOoT.js";import{a as vt,u as kt,b as he,D as It}from"./index-3pbhDJdN.js";import"./index-CUJLg7oa.js";import"./index-BojVbZw0.js";import"./api-BjZCencr.js";import{c as Qe,b as Et,u as Rt,C as Tt,D as Dt,a as wt}from"./connect-to-Cv7_m0q4.js";import{d as Ot,a as Ut,g as Mt,i as Lt,e as Se,f as zt,h as Ft,j as Pt}from"./spaces-CCOUzMaF.js";import{I as Nt}from"./index-CB0oehbS.js";import{R as Jt}from"./index-DQ3XgEE8.js";import{d as Qt}from"./HelpOutline-CGfBEqN0.js";import{D as Zt}from"./index-DMApNFrR.js";import{x as Kt}from"./index-BJHGOv7L.js";import{d as Ht}from"./MoreHoriz-C2u_cYyx.js";import{e as Vt}from"./actions-4ImpPOP5.js";import{d as Gt}from"./DeleteOutline-jp3vin8Z.js";import{g as ze}from"./get-safe-url-DaO0zNfp.js";import{S as Wt}from"./switch-control-CWI5Om29.js";import{L as ye}from"./list-header-oZlTZ2ch.js";import"./OpenInNew-CqGHjgTE.js";import"./ButtonGroup-BHcpMxTu.js";import"./getValidReactChildren-C5sX3SvA.js";import"./TableRow-D7-Zq-OD.js";import"./useThemeProps-CuAyki4g.js";import"./emotion-react.browser.esm-DwVz9Uas.js";import"./ViewColumn-423RpdF7.js";import"./Search-CnGd_Ao7.js";import"./Clear-Dt61s4Jb.js";import"./Delete-D3Cc6_4Q.js";import"./index-Cte4JXAJ.js";import"./MoreVert-BVKVbqMe.js";import"./TableSearch-Bc199o0T.js";import"./useLocalStorage-C8v8o6PD.js";import"./url-evaluation-6DQ24oOJ.js";import"./permission-D633VqG0.js";import"./index-DAW3TTb5.js";function Yt(t){return et("MuiIcon",t)}tt("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Xt=["baseClassName","className","color","component","fontSize"],qt=t=>{const{color:o,fontSize:n,classes:s}=t,a={root:["root",o!=="inherit"&&`color${ee(o)}`,`fontSize${ee(n)}`]};return rt(a,Yt,s)},_t=te("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${ee(n.color)}`],o[`fontSize${ee(n.fontSize)}`]]}})(({theme:t,ownerState:o})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,fontSize:{inherit:"inherit",small:t.typography.pxToRem(20),medium:t.typography.pxToRem(24),large:t.typography.pxToRem(36)}[o.fontSize],color:{primary:(t.vars||t).palette.primary.main,secondary:(t.vars||t).palette.secondary.main,info:(t.vars||t).palette.info.main,success:(t.vars||t).palette.success.main,warning:(t.vars||t).palette.warning.main,action:(t.vars||t).palette.action.active,error:(t.vars||t).palette.error.main,disabled:(t.vars||t).palette.action.disabled,inherit:void 0}[o.color]})),be=j.forwardRef(function(o,n){const s=st({props:o,name:"MuiIcon"}),{baseClassName:a="material-icons",className:r,color:i="inherit",component:l="span",fontSize:d="medium"}=s,c=ot(s,Xt),f=Me({},s,{baseClassName:a,color:i,component:l,fontSize:d}),u=qt(f);return e.jsx(_t,Me({as:l,className:nt(a,"notranslate",u.root,r),ownerState:f,"aria-hidden":!0,ref:n},c))});be.muiName="Icon";async function $t({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const a=await Promise.all(n.map(async r=>{let{name:i}=r;const l=await Ot(r.endpoint);return!Y(l)&&l!==i&&(i=l,s=!0),{...r,name:i}}));return s&&await Promise.all(a.filter(r=>r.did).map(r=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:r.did},spaceGateway:{...r}}}))),a}function es({refresh:t}={}){var a;const{blocklet:o}=O(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,{api:s}=F();return at(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await $t({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){var i;(i=r==null?void 0:r.message)!=null&&i.includes("not logged")?console.warn(r):(console.error(r),v.error(X(r)))}})}function Ze({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var f;const{blocklet:s}=O(),[a,r]=j.useState([]),{api:i}=F(),[l,d]=j.useMemo(()=>n?[I(n).startOf("day").toISOString(),I(n).endOf("day").toISOString()]:[I().startOf("year").toISOString(),I().endOf("day").toISOString()],[n]),c=Fe(async()=>{try{if(o(!0),!s){r([]);return}const{backups:u}=await i.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:d}});r(u??[])}catch(u){console.error(u),v.error(X(u))}finally{o(!1)}},1e3);return Pe(async()=>{c()},[(f=s==null?void 0:s.meta)==null?void 0:f.did].concat(t)),{backups:a}}function ts({appDid:t}){const{backups:o}=Ze(),[n,s]=j.useState({message:"",progress:0,completed:!1}),a=F(),{ws:{useSubscription:r}}=a;return r(z.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&s(()=>({...i}))},[t]),j.useEffect(()=>{var i;if(o!=null&&o.length&&it((i=o[0])==null?void 0:i.status)){const[l]=o;s(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[o]),n}function ss({deps:t=[],setLoading:o=()=>{}}={}){var l;const{blocklet:n}=O(),[s,a]=j.useState([]),{api:r}=F(),i=j.useCallback(Fe(async()=>{var d;if(!r||!((d=n==null?void 0:n.meta)!=null&&d.did)){a([]);return}try{o(!0);const c=I(),f=c.subtract(1,"year"),{summary:u}=await r.getBlockletBackupSummary({input:{did:n.meta.did,startTime:f.toISOString(),endTime:c.toISOString()}});a(Array.isArray(u)?u:[])}catch(c){console.error("Failed to fetch backup summary:",c),v.error(X(c)),a([])}finally{o(!1)}},1e3),[]);return Pe(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:s}}const Ke=j.createContext({}),{Provider:os,Consumer:ro}=Ke;function Be({children:t}){var Z;const{t:o}=E(),{api:n}=F(),{blocklet:s}=O(),[a,r]=j.useState(null),[i,l]=j.useState(!1),{data:d,loading:c,mutate:f}=es({refresh:i}),u=ct(d),S=ts({appDid:s==null?void 0:s.appDid}),m=j.useMemo(()=>Ut(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[A,B]=j.useState(!1),[y,p]=j.useState(!1),{backups:oe}=Ze({deps:[y,a],setLoading:B,backupDate:a}),[ne,re]=j.useState(!1),{backupSummary:ae}=ss({deps:[ne]}),[P,M]=j.useState(d==null?void 0:d.find(h=>h.endpoint===m)),R=(Z=s==null?void 0:s.settings)==null?void 0:Z.autoBackup,D=()=>{l(h=>!h)},ie=()=>{re(h=>!h)},ce=()=>{p(h=>!h)},Q=async h=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:h}})},q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},le=async(h,N)=>{try{f(k=>{const L=[...k];return L.push({...h,loading:!0}),L}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:h}}),m!==N&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:z.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),M(h),D(),v.success(o("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"}))}catch(k){throw console.error(k),f(L=>[...L].filter(ue=>ue.did!==h.did)),k}},de=async h=>{h&&(h.endpoint===m&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:z.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),R!=null&&R.enabled&&await Q({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:h==null?void 0:h.did}}),f(N=>{const k=[...N];return k.splice(k.indexOf(h),1),k}),M(h),D())},pe=async h=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:h.did},spaceGateway:h}}),m!==h.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:z.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:h.endpoint}]}})]),v.success(o("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"})),D()},b=h=>(h==null?void 0:h.endpoint)===m;return e.jsx(os,{value:{spaceGateways:d||[],selectedSpaceGateway:P,addSpaceGateway:le,deleteSpaceGateway:de,updateSpaceGateway:pe,refreshSpaceGateways:D,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:b,updateAutoBackup:Q,abortBlockletBackup:q,backupEndpoint:m,backupProgress:S,backups:oe,backupSummary:ae,refreshBackupSummary:ie,refreshBackups:ce,setBackupDate:r,backupsLoading:A,autoBackup:R},children:t})}Be.propTypes={children:g.any.isRequired};Be.defaultProps={};function U(){return j.useContext(Ke)}function se({...t}){const{blocklet:o}=O(),{info:n}=F(),{t:s}=E(),a=Qe({blocklet:o}),r=lt(n),{spaceGateways:i,addSpaceGateway:l}=U(),d={checkFn:Ne.create({baseURL:ge(window.location.origin,dt())}).get,webWalletUrl:r,extraParams:{appPid:o.appPid,appDid:a.appDid,appName:a.appName,appDescription:a.appDescription,appUrl:a.appUrl,referrer:a.referrer,scopes:a.scopes,nodeDid:n.did}},c=async({endpoint:u,name:S,did:m})=>{const A=await Mt(u);if(!await Lt(A)){v.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(p=>p.endpoint===u)){v.error(s("storage.spaces.gateway.add.duplicate",{name:S}));return}await l({name:S,did:m,url:A,endpoint:u},u)},f=async({spaceGateway:u})=>{try{await c(u)}catch(S){console.error(S),v.error(X(S))}};return e.jsx(vt,{...t,options:d,onSuccess:f})}se.propTypes={};se.defaultProps={};function He({...t}){const{t:o}=j.useContext(ut),{blocklet:n,loadingDiskInfo:s,actions:a}=O();if(j.useEffect(()=>{a==null||a.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const r=(d,c,f)=>e.jsxs(C,{children:[d," ",e.jsx("strong",{children:c?mt(c):"empty"})]}),i=n.environments.reduce((d,c)=>(d[c.key]=c.value,d),{}),l=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(ns,{component:"div",...t,children:l.map(d=>e.jsx(Nt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return s?e.jsx(w,{}):e.jsx(C,{children:o("blocklet.diskInfo.empty")})}const ns=pt(C)``;function ve(){const{t}=E(),{setBackupDate:o,backupSummary:n}=U(),s=kt({key:"lg"}),a=j.useRef(null),r=ht(),i=j.useCallback(c=>{o(c)},[o]),l=j.useMemo(()=>{const c=I().subtract(1,"year"),f=I().add(1,"day"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),S=[];for(let m=c.clone();I(m).isBefore(f);m=m.add(1,"day")){const A=m.format("YYYY-MM-DD");S.push(u.get(A)||{date:A,successCount:0,errorCount:0})}return S},[n]),d=j.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:10},tooltip:{formatter:m=>{const{date:A,successCount:B,errorCount:y}=l[m.dataIndex]||{date:m.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${A}</div>`,`<div>${t("common.succeeded")}: ${B}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
1
+ import{c4 as et,c3 as tt,b_ as te,ch as ee,r as j,c5 as st,c2 as ot,c0 as Me,j as e,c7 as nt,c8 as rt,O as Y,bs as F,bu as at,z as v,Z as X,bi as I,gg as Fe,aV as Pe,b as z,l7 as it,m as E,P as g,hD as ct,x as lt,aA as Ne,a4 as ge,ap as dt,n as pt,k as C,f as ut,C as w,i as mt,an as ht,l8 as _,h4 as $,l9 as ft,N as x,a_ as J,aC as je,E as T,L as gt,T as W,dp as xt,aQ as Ce,aR as Ae,V as H,aJ as V,ac as G,a7 as St,ek as yt,b4 as jt,B as me,w as Ct,G as Le,$ as Je,bF as xe,A as At}from"./index-KdOmwCM0.js";import{T as bt}from"./index-DPJjuq8y.js";import{u as O}from"./blocklet-DgGtZNCB.js";import{u as Bt}from"./use-mobile-4pPVTaiA.js";import{a as vt,u as kt,b as he,D as It}from"./index-CFslc24J.js";import"./index-D6sUi9RT.js";import"./index-BojVbZw0.js";import"./api-BhAwS4V8.js";import{c as Qe,b as Et,u as Rt,C as Tt,D as Dt,a as wt}from"./connect-to-B2UoY2JL.js";import{d as Ot,a as Ut,g as Mt,i as Lt,e as Se,f as zt,h as Ft,j as Pt}from"./spaces-BHOuJMC0.js";import{I as Nt}from"./index-yrfr0MWP.js";import{R as Jt}from"./index-Ce_kCGci.js";import{d as Qt}from"./HelpOutline-B-3RVeU3.js";import{D as Zt}from"./index-BhA9P09u.js";import{x as Kt}from"./index-BJHGOv7L.js";import{d as Ht}from"./MoreHoriz-DuOMe2bn.js";import{e as Vt}from"./actions-CIvfyQ4N.js";import{d as Gt}from"./DeleteOutline-B4zcgGCZ.js";import{g as ze}from"./get-safe-url-fVLOWjDv.js";import{S as Wt}from"./switch-control-k82I7Ndl.js";import{L as ye}from"./list-header-Dq6Hm5vy.js";import"./OpenInNew-6pTIeS0r.js";import"./ButtonGroup-DP9Um2zw.js";import"./getValidReactChildren-BybUhg_p.js";import"./TableRow-BMSWmGPk.js";import"./useThemeProps-BT_RONtx.js";import"./emotion-react.browser.esm-DwA9twTe.js";import"./ViewColumn-BIPD356c.js";import"./Search-DnEqCvoa.js";import"./Clear-C7odY-6_.js";import"./Delete-DpNbJCJA.js";import"./index-D6UMpm4p.js";import"./MoreVert-UFPlWjze.js";import"./TableSearch-Dobasaj8.js";import"./useLocalStorage-DqX-zdwD.js";import"./url-evaluation-BMmqZ9Xm.js";import"./permission-DR4c0ARF.js";import"./index-DA7j-cev.js";function Yt(t){return et("MuiIcon",t)}tt("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Xt=["baseClassName","className","color","component","fontSize"],qt=t=>{const{color:o,fontSize:n,classes:s}=t,a={root:["root",o!=="inherit"&&`color${ee(o)}`,`fontSize${ee(n)}`]};return rt(a,Yt,s)},_t=te("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${ee(n.color)}`],o[`fontSize${ee(n.fontSize)}`]]}})(({theme:t,ownerState:o})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,fontSize:{inherit:"inherit",small:t.typography.pxToRem(20),medium:t.typography.pxToRem(24),large:t.typography.pxToRem(36)}[o.fontSize],color:{primary:(t.vars||t).palette.primary.main,secondary:(t.vars||t).palette.secondary.main,info:(t.vars||t).palette.info.main,success:(t.vars||t).palette.success.main,warning:(t.vars||t).palette.warning.main,action:(t.vars||t).palette.action.active,error:(t.vars||t).palette.error.main,disabled:(t.vars||t).palette.action.disabled,inherit:void 0}[o.color]})),be=j.forwardRef(function(o,n){const s=st({props:o,name:"MuiIcon"}),{baseClassName:a="material-icons",className:r,color:i="inherit",component:l="span",fontSize:d="medium"}=s,c=ot(s,Xt),f=Me({},s,{baseClassName:a,color:i,component:l,fontSize:d}),u=qt(f);return e.jsx(_t,Me({as:l,className:nt(a,"notranslate",u.root,r),ownerState:f,"aria-hidden":!0,ref:n},c))});be.muiName="Icon";async function $t({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const a=await Promise.all(n.map(async r=>{let{name:i}=r;const l=await Ot(r.endpoint);return!Y(l)&&l!==i&&(i=l,s=!0),{...r,name:i}}));return s&&await Promise.all(a.filter(r=>r.did).map(r=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:r.did},spaceGateway:{...r}}}))),a}function es({refresh:t}={}){var a;const{blocklet:o}=O(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,{api:s}=F();return at(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await $t({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){var i;(i=r==null?void 0:r.message)!=null&&i.includes("not logged")?console.warn(r):(console.error(r),v.error(X(r)))}})}function Ze({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var f;const{blocklet:s}=O(),[a,r]=j.useState([]),{api:i}=F(),[l,d]=j.useMemo(()=>n?[I(n).startOf("day").toISOString(),I(n).endOf("day").toISOString()]:[I().startOf("year").toISOString(),I().endOf("day").toISOString()],[n]),c=Fe(async()=>{try{if(o(!0),!s){r([]);return}const{backups:u}=await i.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:d}});r(u??[])}catch(u){console.error(u),v.error(X(u))}finally{o(!1)}},1e3);return Pe(async()=>{c()},[(f=s==null?void 0:s.meta)==null?void 0:f.did].concat(t)),{backups:a}}function ts({appDid:t}){const{backups:o}=Ze(),[n,s]=j.useState({message:"",progress:0,completed:!1}),a=F(),{ws:{useSubscription:r}}=a;return r(z.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&s(()=>({...i}))},[t]),j.useEffect(()=>{var i;if(o!=null&&o.length&&it((i=o[0])==null?void 0:i.status)){const[l]=o;s(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[o]),n}function ss({deps:t=[],setLoading:o=()=>{}}={}){var l;const{blocklet:n}=O(),[s,a]=j.useState([]),{api:r}=F(),i=j.useCallback(Fe(async()=>{var d;if(!r||!((d=n==null?void 0:n.meta)!=null&&d.did)){a([]);return}try{o(!0);const c=I(),f=c.subtract(1,"year"),{summary:u}=await r.getBlockletBackupSummary({input:{did:n.meta.did,startTime:f.toISOString(),endTime:c.toISOString()}});a(Array.isArray(u)?u:[])}catch(c){console.error("Failed to fetch backup summary:",c),v.error(X(c)),a([])}finally{o(!1)}},1e3),[]);return Pe(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:s}}const Ke=j.createContext({}),{Provider:os,Consumer:ro}=Ke;function Be({children:t}){var Z;const{t:o}=E(),{api:n}=F(),{blocklet:s}=O(),[a,r]=j.useState(null),[i,l]=j.useState(!1),{data:d,loading:c,mutate:f}=es({refresh:i}),u=ct(d),S=ts({appDid:s==null?void 0:s.appDid}),m=j.useMemo(()=>Ut(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[A,B]=j.useState(!1),[y,p]=j.useState(!1),{backups:oe}=Ze({deps:[y,a],setLoading:B,backupDate:a}),[ne,re]=j.useState(!1),{backupSummary:ae}=ss({deps:[ne]}),[P,M]=j.useState(d==null?void 0:d.find(h=>h.endpoint===m)),R=(Z=s==null?void 0:s.settings)==null?void 0:Z.autoBackup,D=()=>{l(h=>!h)},ie=()=>{re(h=>!h)},ce=()=>{p(h=>!h)},Q=async h=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:h}})},q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},le=async(h,N)=>{try{f(k=>{const L=[...k];return L.push({...h,loading:!0}),L}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:h}}),m!==N&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:z.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),M(h),D(),v.success(o("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"}))}catch(k){throw console.error(k),f(L=>[...L].filter(ue=>ue.did!==h.did)),k}},de=async h=>{h&&(h.endpoint===m&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:z.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),R!=null&&R.enabled&&await Q({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:h==null?void 0:h.did}}),f(N=>{const k=[...N];return k.splice(k.indexOf(h),1),k}),M(h),D())},pe=async h=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:h.did},spaceGateway:h}}),m!==h.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:z.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:h.endpoint}]}})]),v.success(o("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"})),D()},b=h=>(h==null?void 0:h.endpoint)===m;return e.jsx(os,{value:{spaceGateways:d||[],selectedSpaceGateway:P,addSpaceGateway:le,deleteSpaceGateway:de,updateSpaceGateway:pe,refreshSpaceGateways:D,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:b,updateAutoBackup:Q,abortBlockletBackup:q,backupEndpoint:m,backupProgress:S,backups:oe,backupSummary:ae,refreshBackupSummary:ie,refreshBackups:ce,setBackupDate:r,backupsLoading:A,autoBackup:R},children:t})}Be.propTypes={children:g.any.isRequired};Be.defaultProps={};function U(){return j.useContext(Ke)}function se({...t}){const{blocklet:o}=O(),{info:n}=F(),{t:s}=E(),a=Qe({blocklet:o}),r=lt(n),{spaceGateways:i,addSpaceGateway:l}=U(),d={checkFn:Ne.create({baseURL:ge(window.location.origin,dt())}).get,webWalletUrl:r,extraParams:{appPid:o.appPid,appDid:a.appDid,appName:a.appName,appDescription:a.appDescription,appUrl:a.appUrl,referrer:a.referrer,scopes:a.scopes,nodeDid:n.did}},c=async({endpoint:u,name:S,did:m})=>{const A=await Mt(u);if(!await Lt(A)){v.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(p=>p.endpoint===u)){v.error(s("storage.spaces.gateway.add.duplicate",{name:S}));return}await l({name:S,did:m,url:A,endpoint:u},u)},f=async({spaceGateway:u})=>{try{await c(u)}catch(S){console.error(S),v.error(X(S))}};return e.jsx(vt,{...t,options:d,onSuccess:f})}se.propTypes={};se.defaultProps={};function He({...t}){const{t:o}=j.useContext(ut),{blocklet:n,loadingDiskInfo:s,actions:a}=O();if(j.useEffect(()=>{a==null||a.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const r=(d,c,f)=>e.jsxs(C,{children:[d," ",e.jsx("strong",{children:c?mt(c):"empty"})]}),i=n.environments.reduce((d,c)=>(d[c.key]=c.value,d),{}),l=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(ns,{component:"div",...t,children:l.map(d=>e.jsx(Nt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return s?e.jsx(w,{}):e.jsx(C,{children:o("blocklet.diskInfo.empty")})}const ns=pt(C)``;function ve(){const{t}=E(),{setBackupDate:o,backupSummary:n}=U(),s=kt({key:"lg"}),a=j.useRef(null),r=ht(),i=j.useCallback(c=>{o(c)},[o]),l=j.useMemo(()=>{const c=I().subtract(1,"year"),f=I().add(1,"day"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),S=[];for(let m=c.clone();I(m).isBefore(f);m=m.add(1,"day")){const A=m.format("YYYY-MM-DD");S.push(u.get(A)||{date:A,successCount:0,errorCount:0})}return S},[n]),d=j.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:10},tooltip:{formatter:m=>{const{date:A,successCount:B,errorCount:y}=l[m.dataIndex]||{date:m.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${A}</div>`,`<div>${t("common.succeeded")}: ${B}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
2
2
  `)},backgroundColor:r.palette.background.paper,borderColor:r.palette.divider,textStyle:{color:r.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${r.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:_[600]},{min:-9,max:-6,color:_[500]},{min:-6,max:-3,color:_[400]},{min:-3,max:-1,color:_[300]},{min:0,max:0,color:r.palette.grey[200]},{min:1,max:3,color:$[300]},{min:3,max:6,color:$[400]},{min:6,max:9,color:$[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:$[600]}],orient:"horizontal",left:"center",bottom:10,itemWidth:12,itemHeight:12,textStyle:{color:r.palette.text.secondary,fontSize:12}},calendar:{top:30,left:42,right:5,bottom:20,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:4,borderColor:r.palette.background.default,borderRadius:0,color:r.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:12,fontSize:14,color:r.palette.text.primary,fontWeight:"400"},monthLabel:{show:!0,nameMap:"cn",align:"left",color:r.palette.text.primary,fontWeight:"400",fontSize:16,position:"start",margin:12},yearLabel:{show:!1},range:[I().subtract(1,"year").startOf("month").format("YYYY-MM-DD"),I().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(m=>[m.date,m.errorCount?-m.errorCount:m.successCount]),label:{show:!1},itemStyle:{borderWidth:1.5,borderColor:r.palette.background.default,borderRadius:5},emphasis:{itemStyle:{borderWidth:2.5,borderColor:ft[200],color:"inherit"}}}}),[l,t,r]);return j.useEffect(()=>{a.current&&s&&setTimeout(()=>{a.current.scrollLeft=a.current.scrollWidth},100)},[s,l]),e.jsxs(e.Fragment,{children:[e.jsx(x,{ref:a,sx:{overflowX:s?"visible":"hidden",overflowY:"hidden"},children:e.jsx(x,{sx:{minWidth:s?"1600px":"100%",height:"240px"},children:e.jsx(Jt,{option:d,style:{height:"100%",width:"100%",padding:"8px"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&i(c.data[0])}}})})}),e.jsx(x,{display:"flex",justifyContent:"flex-end",mr:s?2:5,mb:2,mt:.5,children:e.jsxs(J,{direction:s?"column":"row",spacing:s?2:1,alignItems:"flex-end",width:"100%",justifyContent:s?"flex-start":"flex-end",children:[e.jsxs(J,{direction:"row",alignItems:"center",spacing:1,children:[e.jsxs(C,{variant:"body2",color:"text.secondary",children:[t("storage.spaces.backup.failed"),":"]}),e.jsx(x,{width:12,height:12,bgcolor:"#8B5000",borderRadius:.5}),e.jsx(x,{width:12,height:12,bgcolor:"#A36200",borderRadius:.5}),e.jsx(x,{width:12,height:12,bgcolor:"#C17700",borderRadius:.5}),e.jsx(x,{width:12,height:12,bgcolor:"#E29000",borderRadius:.5})]}),e.jsxs(J,{direction:"row",alignItems:"center",spacing:1,children:[e.jsxs(C,{variant:"body2",color:"text.secondary",children:[t("storage.spaces.backup.without"),":"]}),e.jsx(x,{width:12,height:12,bgcolor:"grey.200",borderRadius:.5,border:"1px solid",borderColor:"grey.200"})]}),e.jsxs(J,{direction:"row",alignItems:"center",spacing:1,children:[e.jsxs(C,{variant:"body2",color:"text.secondary",children:[t("storage.spaces.backup.succeeded"),":"]}),e.jsx(x,{width:12,height:12,bgcolor:"#9be9a8",borderRadius:.5}),e.jsx(x,{width:12,height:12,bgcolor:"#40c463",borderRadius:.5}),e.jsx(x,{width:12,height:12,bgcolor:"#30a14e",borderRadius:.5}),e.jsx(x,{width:12,height:12,bgcolor:"#216e39",borderRadius:.5})]})]})})]})}ve.propTypes={};const rs=te(({className:t,...o})=>e.jsx(je,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ke({status:t,message:o,createdAt:n}){const{t:s}=E(),a=t===T.BACKUPS.STATUS.PROGRESS&&I().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,r=a&&s("common.timeoutError"),i=t===T.BACKUPS.STATUS.PROGRESS&&!a,l=t===T.BACKUPS.STATUS.SUCCEEDED&&!a;return i?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(w,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):l?e.jsx(W,{type:"success",children:s("common.succeeded")}):e.jsxs(x,{display:"inline-flex",alignItems:"center",children:[e.jsx(W,{type:"error",children:s("common.failed")}),"  ",e.jsx(je,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||r,children:e.jsx(be,{children:e.jsx(Qt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ke.propTypes={status:g.string.isRequired,message:g.string,createdAt:g.string.isRequired};ke.defaultProps={message:""};function Ie({metadata:t}){const{t:o}=E();if(Y(t))return e.jsx(W,{type:"success",children:o("common.succeeded")});const n=t.count||0,s=t.size||0,a=Kt(s,{iec:!0}),r=e.jsxs(x,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[o("common.fileCount"),": ",n]}),e.jsxs(C,{variant:"body2",children:[o("common.fileSize"),": ",a]})]});return e.jsxs(x,{display:"inline-flex",alignItems:"center",children:[e.jsx(W,{type:"success",children:o("common.succeeded")})," ",e.jsx(rs,{title:r,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(xt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ie.propTypes={metadata:g.object};Ie.defaultProps={metadata:{}};function Ee(){const{t,locale:o}=E(),{spaceGateways:n,backups:s,backupsLoading:a}=U(),r=j.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{var B;const{targetUrl:d,targetName:c,status:f,createdAt:u}=s[l],S=f===T.BACKUPS.STATUS.PROGRESS&&I().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=f===T.BACKUPS.STATUS.SUCCEEDED&&!S,A=c||((B=n.find(y=>d==null?void 0:d.includes(Se(y==null?void 0:y.endpoint))))==null?void 0:B.name)||"Unknown DID Space";return m?e.jsx(gt,{fontSize:"16px",href:d,target:"_blank",children:A}):e.jsx(C,{variant:"body1",fontSize:"16px",children:A})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:l=>{const d=t(l===0?"common.auto":"common.manual");return e.jsx(W,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>I(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>Y(l)?"":I(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const d=(s==null?void 0:s[l])??{},{status:c,message:f,createdAt:u,metadata:S}=d,m=c===T.BACKUPS.STATUS.PROGRESS&&I().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,A=c===T.BACKUPS.STATUS.PROGRESS&&!m,B=c===T.BACKUPS.STATUS.SUCCEEDED&&!m;return A?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(w,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):B?e.jsx(Ie,{metadata:S}):e.jsx(ke,{status:c,message:f,createdAt:u})}}}],[s,n,t]),i=j.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:i?e.jsx(x,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(Zt,{title:"",loading:a,data:s,columns:r,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Ee.propTypes={};var Ve=function(o){return e.jsxs("svg",{...o,children:[e.jsxs("g",{filter:"url(#a)",children:[e.jsx("path",{d:"M56.97 2a12 12 0 0 0-8.485 3.515l-40.97 40.97A12 12 0 0 0 4 54.971V240c0 6.627 5.373 12 12 12h196c6.627 0 12-5.373 12-12V14c0-6.627-5.373-12-12-12H56.97Z",fill:"#DDD"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m49.192 6.222-40.97 40.97A11 11 0 0 0 5 54.971V240c0 6.075 4.925 11 11 11h196c6.075 0 11-4.925 11-11V14c0-6.075-4.925-11-11-11H56.97a11 11 0 0 0-7.778 3.222Zm-.707-.707A12 12 0 0 1 56.971 2H212c6.627 0 12 5.373 12 12v226c0 6.627-5.373 12-12 12H16c-6.627 0-12-5.373-12-12V54.97a12 12 0 0 1 3.515-8.485l40.97-40.97Z",fill:"#000",fillOpacity:".08"}),e.jsx("mask",{id:"b",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"4",y:"2",width:"220",height:"250",children:e.jsx("path",{d:"M56.97 2a12 12 0 0 0-8.485 3.515l-40.97 40.97A12 12 0 0 0 4 54.971V240c0 6.627 5.373 12 12 12h196c6.627 0 12-5.373 12-12V14c0-6.627-5.373-12-12-12H56.97Z",fill:"#D9D9D9"})}),e.jsxs("g",{mask:"url(#b)",children:[e.jsx("path",{opacity:".5",fill:"url(#c)",d:"M4 2h220v128H4z"}),e.jsx("path",{opacity:".1",fill:"url(#d)",d:"M4 130h220v122H4z"}),e.jsx("path",{d:"M33.045 169h-3.767v-11.636h3.887c1.14 0 2.12.233 2.937.698a4.61 4.61 0 0 1 1.881 1.995c.44.863.659 1.899.659 3.108 0 1.212-.222 2.254-.665 3.125a4.668 4.668 0 0 1-1.909 2.011c-.833.466-1.84.699-3.023.699Zm-2.01-1.534h1.914c.886 0 1.623-.167 2.21-.5a3.152 3.152 0 0 0 1.318-1.46c.292-.64.438-1.421.438-2.341 0-.913-.146-1.688-.438-2.324a3.095 3.095 0 0 0-1.29-1.449c-.572-.33-1.282-.494-2.13-.494h-2.023v8.568Zm11.546-10.102V169h-1.756v-11.636h1.756ZM48.905 169h-3.767v-11.636h3.886c1.14 0 2.12.233 2.938.698a4.609 4.609 0 0 1 1.88 1.995c.44.863.66 1.899.66 3.108 0 1.212-.222 2.254-.665 3.125a4.667 4.667 0 0 1-1.91 2.011c-.833.466-1.84.699-3.022.699Zm-2.011-1.534h1.914c.887 0 1.623-.167 2.21-.5a3.151 3.151 0 0 0 1.319-1.46c.291-.64.437-1.421.437-2.341 0-.913-.146-1.688-.437-2.324a3.095 3.095 0 0 0-1.29-1.449c-.572-.33-1.282-.494-2.13-.494h-2.023v8.568Zm20.372-7.046a1.662 1.662 0 0 0-.75-1.25c-.44-.299-.993-.448-1.66-.448-.477 0-.89.075-1.238.227a1.91 1.91 0 0 0-.813.613c-.189.258-.284.552-.284.881 0 .277.065.515.194.716.132.201.304.369.516.506.216.132.447.244.694.335.246.087.483.159.71.216l1.136.295c.371.091.752.214 1.142.37.39.155.752.36 1.086.613.333.254.602.568.806.944.209.374.313.823.313 1.346 0 .659-.17 1.244-.511 1.756-.338.511-.828.915-1.472 1.21-.64.295-1.415.443-2.324.443-.871 0-1.625-.138-2.261-.415-.637-.276-1.135-.668-1.495-1.176-.36-.511-.558-1.117-.596-1.818h1.761c.034.421.17.771.41 1.051.242.277.55.483.925.62.38.132.794.198 1.245.198.496 0 .937-.077 1.324-.233.39-.159.697-.378.92-.659a1.56 1.56 0 0 0 .335-.994c0-.345-.098-.627-.295-.847a2.191 2.191 0 0 0-.79-.545 7.725 7.725 0 0 0-1.12-.381l-1.374-.375c-.932-.253-1.67-.627-2.216-1.119-.542-.492-.813-1.144-.813-1.955 0-.67.182-1.255.546-1.755.363-.5.856-.888 1.477-1.165.621-.28 1.322-.42 2.102-.42.788 0 1.483.138 2.085.414.607.277 1.084.658 1.432 1.142.349.481.53 1.034.546 1.659h-1.693Zm3.813 11.853v-12h1.66v1.415h.142c.098-.182.24-.393.426-.631.185-.239.443-.447.772-.625.33-.182.766-.273 1.307-.273.705 0 1.334.178 1.887.534.553.356.987.869 1.3 1.54.319.67.478 1.477.478 2.42 0 .944-.157 1.752-.472 2.427-.314.67-.746 1.187-1.295 1.551-.55.36-1.176.539-1.88.539-.53 0-.965-.089-1.302-.267a2.457 2.457 0 0 1-.784-.625 4.667 4.667 0 0 1-.437-.636h-.103v4.631H71.08Zm1.665-7.637c0 .614.09 1.152.267 1.614.178.462.436.824.773 1.085.337.258.75.387 1.239.387.507 0 .931-.135 1.273-.404.34-.273.598-.642.772-1.108.178-.466.267-.99.267-1.574 0-.575-.087-1.092-.261-1.551-.17-.458-.428-.82-.773-1.085-.34-.265-.767-.398-1.278-.398-.493 0-.91.127-1.25.381-.337.254-.593.608-.767 1.062-.175.455-.262.985-.262 1.591Zm10.75 4.557a3.557 3.557 0 0 1-1.5-.307 2.523 2.523 0 0 1-1.062-.903c-.258-.394-.386-.877-.386-1.449 0-.492.094-.898.283-1.216.19-.318.446-.57.768-.756a4.036 4.036 0 0 1 1.08-.42c.397-.095.802-.167 1.215-.216l1.273-.148c.325-.041.562-.108.71-.198.148-.091.222-.239.222-.444v-.039c0-.497-.14-.881-.42-1.154-.277-.273-.69-.409-1.24-.409-.572 0-1.022.127-1.352.381-.325.25-.55.528-.676.835l-1.597-.364c.19-.53.466-.958.83-1.284.368-.329.79-.568 1.267-.716.477-.151.98-.227 1.506-.227.348 0 .718.042 1.108.125.394.08.761.227 1.102.443.345.216.627.525.847.926.22.398.33.915.33 1.552V169h-1.66v-1.193h-.068c-.11.22-.275.435-.495.648-.22.212-.501.388-.846.528s-.758.21-1.239.21Zm.37-1.363c.47 0 .87-.093 1.204-.279.337-.185.593-.428.767-.727.178-.303.267-.627.267-.972v-1.125c-.06.061-.178.118-.352.171-.17.049-.365.093-.585.13-.22.034-.434.067-.642.097l-.523.068c-.33.042-.63.112-.903.21a1.553 1.553 0 0 0-.648.427c-.16.181-.239.424-.239.727 0 .42.156.738.466.954.31.212.707.319 1.188.319Zm9.876 1.346c-.845 0-1.572-.191-2.182-.574a3.796 3.796 0 0 1-1.398-1.596c-.325-.678-.488-1.455-.488-2.33 0-.886.166-1.668.5-2.346a3.832 3.832 0 0 1 1.409-1.597c.606-.383 1.32-.574 2.142-.574.663 0 1.254.123 1.773.369.519.243.937.584 1.255 1.023.322.44.514.953.574 1.54h-1.653c-.091-.409-.3-.761-.625-1.057-.322-.295-.754-.443-1.296-.443a2.11 2.11 0 0 0-1.244.375c-.352.246-.627.598-.824 1.057-.197.454-.295.992-.295 1.613 0 .637.096 1.186.29 1.648.193.462.466.82.818 1.074.356.254.774.381 1.255.381.322 0 .614-.059.875-.177.266-.121.487-.293.665-.517.182-.223.309-.492.38-.806h1.654a3.211 3.211 0 0 1-.55 1.511 3.165 3.165 0 0 1-1.234 1.045c-.511.254-1.111.381-1.8.381Zm9.163 0c-.859 0-1.6-.184-2.221-.551a3.732 3.732 0 0 1-1.432-1.563c-.333-.674-.5-1.464-.5-2.369 0-.894.167-1.682.5-2.363a3.887 3.887 0 0 1 1.409-1.597c.606-.383 1.314-.574 2.125-.574.493 0 .97.082 1.432.244.462.163.877.419 1.244.767.368.349.657.802.87 1.358.212.553.318 1.226.318 2.017v.603H99.71v-1.273h5.273c0-.447-.091-.843-.273-1.187a2.052 2.052 0 0 0-.767-.824c-.326-.201-.708-.302-1.148-.302a2.22 2.22 0 0 0-1.25.353 2.364 2.364 0 0 0-.818.909 2.626 2.626 0 0 0-.284 1.21v.994c0 .584.102 1.08.307 1.489.208.409.498.722.869.938.372.212.805.318 1.301.318a2.7 2.7 0 0 0 .881-.137c.265-.094.494-.234.688-.42.193-.186.341-.415.443-.688l1.608.29c-.129.474-.36.888-.693 1.244-.33.353-.745.627-1.245.824-.496.194-1.062.29-1.699.29Z",fill:"#fff"}),e.jsx("path",{d:"M117.604 47.263 121.523 45h14.267v41.862h-14.267l-15.335-8.854V53.854l1.818-1.05 3.2 1.848-1.818 1.05V76.16l12.993 7.502h10.209V48.2h-10.209l-1.577.91-3.2-1.847Z",fill:"url(#e)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M119.402 76.16V55.701L106.409 48.2H96.2v35.462h10.209l1.582-.913 3.2 1.847-3.924 2.266H93V45h14.267l15.335 8.854v24.154l-1.813 1.046-3.2-1.847 1.813-1.047Z",fill:"url(#f)"}),e.jsxs("g",{clipPath:"url(#g)",fillRule:"evenodd",clipRule:"evenodd",fill:"#fff",children:[e.jsx("path",{d:"m50.928 216.089 1.034 2.852h-2.503l1.028-2.842a4.95 4.95 0 0 0 .107-.338 7.17 7.17 0 0 0 .111-.409c.075.297.15.542.223.737Zm2.28 5.591h.796l-2.775-7.352h-1.043l-2.774 7.352h.795a.338.338 0 0 0 .223-.077.425.425 0 0 0 .127-.179l.615-1.705h3.07l.617 1.705a.399.399 0 0 0 .126.184.339.339 0 0 0 .223.072Zm4.823-.963a2.023 2.023 0 0 1-.67.098h-1.455v-2.453h1.456c.5 0 .871.106 1.11.318.24.208.36.495.36.86 0 .184-.028.355-.083.512a1.005 1.005 0 0 1-.262.399 1.2 1.2 0 0 1-.456.266Zm-2.125-3.128v-2.406h1.237c.498 0 .865.095 1.101.286.236.192.355.497.355.917 0 .369-.125.662-.374.881-.246.215-.623.322-1.13.322h-1.189Zm2.358-3.128a4.106 4.106 0 0 0-1.12-.133h-2.27v7.352h2.507c.391 0 .74-.051 1.048-.154.307-.102.566-.247.776-.435.21-.188.37-.409.48-.665.11-.26.165-.547.165-.861 0-.904-.506-1.462-1.518-1.674.22-.075.41-.169.572-.281a1.79 1.79 0 0 0 .403-.379c.106-.144.186-.297.237-.461.052-.164.078-.335.078-.512a2.1 2.1 0 0 0-.146-.804 1.49 1.49 0 0 0-.441-.609 2.073 2.073 0 0 0-.771-.384Zm7.535.778h-2.212v6.441h-1.028v-6.441h-2.222v-.911H65.8v.911Zm2.439.564h-1.13v1.193h1.13v-1.193Zm-1.13 2.983h1.13v1.193h-1.13v-1.193Z",fillOpacity:".8"}),e.jsx("path",{d:"M28.247 221.771V214h3.894c.99.072 1.765.944 1.765 1.998v3.77c0 1.106-.85 2.003-1.897 2.003h-3.762ZM36.355 214h-1.011v7.783h1.01V214Zm-7.097 6.704v-5.642h2.751c.49 0 .886.419.886.936v3.77c0 .517-.396.936-.886.936h-2.75ZM37.775 214v7.771h3.762c1.047 0 1.897-.897 1.897-2.003v-3.77c0-1.054-.774-1.926-1.765-1.998h-3.894Zm6.946 1.803h1.13v1.193h-1.13v-1.193Zm1.13 2.983h-1.13v1.193h1.13v-1.193Zm-7.065-3.724v5.642h2.75c.49 0 .887-.419.887-.936v-3.77c0-.517-.397-.936-.886-.936h-2.751Z"})]}),e.jsx("circle",{cx:"191.32",cy:"218",r:"10",fill:"url(#h)"}),e.jsx("path",{d:"m192.064 213.333.976-.564h3.554v10.427h-3.286a1 1 0 0 1-.5-.134l-3.588-2.071v-6.016l.453-.262.797.46-.453.262v5.096l3.237 1.868h2.543v-8.833h-2.543l-.393.227-.797-.46Z",fill:"#fff"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M192.512 220.531v-5.096l-3.237-1.869h-2.543v8.833h2.543l.394-.227.797.46-.977.564h-3.554v-10.427h3.554l3.82 2.206v6.016l-.452.261-.797-.461.452-.26Z",fill:"#fff"})]})]}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"d",x1:"114",y1:"130",x2:"114",y2:"252",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#101010"}),e.jsx("stop",{offset:"1",stopColor:"#272727"})]}),e.jsxs("linearGradient",{id:"e",x1:"120.989",y1:"45",x2:"120.989",y2:"86.862",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#fff",stopOpacity:".4"}),e.jsx("stop",{offset:"1",stopColor:"#fff"})]}),e.jsxs("linearGradient",{id:"f",x1:"107.801",y1:"45",x2:"107.801",y2:"86.862",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#fff"}),e.jsx("stop",{offset:"1",stopColor:"#fff",stopOpacity:".4"})]}),e.jsxs("radialGradient",{id:"h",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(17 -8.76924 6.97565 13.52294 183.166 221)",children:[e.jsx("stop",{stopColor:"#016BED"}),e.jsx("stop",{offset:".699",stopColor:"#4498FB"}),e.jsx("stop",{offset:"1",stopColor:"#9DFFE8"})]}),e.jsx("clipPath",{id:"g",children:e.jsx("path",{fill:"#fff",transform:"translate(28 214)",d:"M0 0h40.32v8H0z"})}),e.jsx("pattern",{id:"c",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:e.jsx("use",{xlinkHref:"#i",transform:"scale(.00455 .00781)"})}),e.jsxs("filter",{id:"a",x:"0",y:"0",width:"228",height:"258",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[e.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),e.jsx("feColorMatrix",{in:"SourceAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),e.jsx("feOffset",{dy:"2"}),e.jsx("feGaussianBlur",{stdDeviation:"2"}),e.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),e.jsx("feColorMatrix",{values:"0 0 0 0 0.0631944 0 0 0 0 0.242785 0 0 0 0 0.403472 0 0 0 0.2 0"}),e.jsx("feBlend",{in2:"BackgroundImageFix",result:"effect1_dropShadow_1410_22507"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_1410_22507",result:"shape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QdSAQzkctDTtXGbDih5iRPVIk9TwCJGwP3tpATkHsNwloUilnNMFce7twgDgrgWhsE8jWW+EBLlTDMn9pmtJOefTJc6Cxld039TN4XiwL4pMtU+8tXJ4g/LghG5APdF7/e3FSi4v8vnEBiIEm+5LlZtsk2LbbbY5hN9JkkJkd5BjQFPoUcwjJdTm0mx0024NmOvVgxASvU9TonFxUqG8cUTy3m5s3i7BqLbFkKcfxLQYhAXfjam0yFFd3PZE9wlXWfHYKlg2cFlTcnwRH6z8DpSfQHidMhElmCMb07li9ceHQHFknk/98f4KJRLpX6xQEXVAnJxlr8Aw6/qb0wu9SNolstScB0izxmMC5DiytBJd9Rcm3RGf42aiddmUTM4d4dgdjiT+vMPX0/RzfZdLoZ4aQqPzhx9plNI3QyvsMZHn2j2wOECoTtkfJt89O+eYUnXB/gFxHxPmOeL9ogAAAABJRU5ErkJggg=="})]})]})};Ve.defaultProps={width:"228",height:"258",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"};function Ge(){const{t}=E();return e.jsxs(x,{children:[e.jsxs(x,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(x,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(Ve,{viewBox:"0 0 228 258",style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(se,{})]}),e.jsxs(x,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(x,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(ve,{})]})]}),e.jsx(Ee,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(He,{})]})}Ge.propTypes={};var Re={},as=Ae;Object.defineProperty(Re,"__esModule",{value:!0});var We=Re.default=void 0,is=as(Ce()),cs=e;We=Re.default=(0,is.default)((0,cs.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Te={},ls=Ae;Object.defineProperty(Te,"__esModule",{value:!0});var Ye=Te.default=void 0,ds=ls(Ce()),ps=e;Ye=Te.default=(0,ds.default)((0,ps.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var De={},us=Ae;Object.defineProperty(De,"__esModule",{value:!0});var Xe=De.default=void 0,ms=us(Ce()),hs=e;Xe=De.default=(0,ms.default)((0,hs.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function we({spaceGateway:t,onConfirm:o,onCancel:n}){const{t:s}=E(),[a,r]=j.useState(!1),[i,l]=j.useState(!1),d=(u,S)=>{u==null||u.preventDefault(),u==null||u.stopPropagation(),r(S)},c=async u=>{try{u==null||u.stopPropagation(),l(!0),await(o==null?void 0:o(t)),r(!1)}catch(S){console.error(S),v.error(`${s("storage.space.gateway.delete.failed")}: ${X(S)}`)}finally{r(!1),l(!1)}},f=u=>{d(u,!1),n==null||n(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(H,{color:"red",onClick:u=>d(u,!0),children:[e.jsx(V,{style:{minWidth:24,color:"red"},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx(G,{style:{color:"red"},children:s("common.delete")})]}),e.jsx(St,{title:s("storage.spaces.gateway.delete.title"),open:a,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:i}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:i}},onConfirm:c,onCancel:f,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}we.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool}).isRequired,onConfirm:g.func,onCancel:g.func};we.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function Oe({spaceGateway:t,selected:o,onDelete:n,onConnect:s,enableSwitchToSpace:a,backupInProgress:r,...i}){const{abortBlockletBackup:l}=U(),[d,c]=j.useState(null),{t:f}=E(),[u,S]=j.useState(!1),m=(y,p)=>{y.stopPropagation(),y.preventDefault(),c(p&&y.currentTarget)},A=async y=>{try{S(!0),m(y,!1),await s(t)}catch(p){console.error(p),v.error(p.message)}finally{S(!1)}},B=async y=>{try{S(!0),m(y,!1),await l()}catch(p){console.error(p),v.error(p.message)}finally{S(!1)}};return e.jsxs(e.Fragment,{children:[u||t!=null&&t.loading?e.jsx(w,{sx:{ml:1},size:"24px"}):e.jsx(yt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...i,children:e.jsx(Ht,{})}),e.jsxs(jt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(H,{onClick:y=>{m(y,!1),window.open(ze(t.endpoint?zt(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(We,{fontSize:"small"})}),e.jsx(G,{children:f("common.open")})]}),e.jsxs(H,{onClick:y=>{m(y,!1),window.open(ze(Ft(t.endpoint),{allowDomains:null}))},children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx(G,{children:f("storage.spaces.strategy.viewBackupFiles")})]}),!o&&a&&e.jsxs(H,{onClick:A,children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(G,{children:f("storage.spaces.connect.switchToSpace")})]}),r&&e.jsxs(H,{onClick:B,children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(Vt,{fontSize:"small"})}),e.jsx(G,{children:f("storage.spaces.connect.abortBlockletBackup")})]}),!r&&e.jsx(we,{spaceGateway:t,onConfirm:async()=>{c(null),await(n==null?void 0:n(t))},onCancel:()=>c(null)})]})]})}Oe.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool,endpoint:g.string.isRequired,loading:g.bool}).isRequired,selected:g.bool.isRequired,enableSwitchToSpace:g.bool,onDelete:g.func,onConnect:g.func,backupInProgress:g.bool};Oe.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const fs=te(({className:t,...o})=>e.jsx(je,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ue({spaceGateway:t,spaceStatus:o,selected:n,onConnected:s,onDeleted:a,onBackedUp:r}){const{t:i,locale:l}=E(),{blocklet:d}=O(),{api:c,info:{did:f}}=F(),{appDid:u,appName:S,appDescription:m,scopes:A,appUrl:B,referrer:y}=Qe({blocklet:d}),{backupProgress:p,updateSpaceGateway:oe,deleteSpaceGateway:ne,refreshBackupSummary:re,refreshBackups:ae}=U(),[P,M]=j.useState(!1),[R,D]=j.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:i("storage.spaces.authorize.title",{appName:S},l),scan:i("storage.spaces.authorize.scan",{appName:S},l),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:i("storage.spaces.authorize.success")})},onClose:()=>{D(b=>({...b,open:!1}))}}),ie=n&&!P&&o===he.DISCONNECTED,ce=n&&!P&&!t.loading&&o===he.CONNECTED,Q=n&&P&&o===he.CONNECTED&&(p==null?void 0:p.progress)>=0,q=async()=>{try{if(await Pt(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[d.meta.did],configs:[{key:z.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),v.success(i("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(b){console.error(b),s==null||s(b,t);return}D(b=>({...b,open:!0,prefix:ge(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ne.create({baseURL:ge(t.url,"space")}).get,extraParams:{appDid:u,appName:S,appDescription:m,scopes:A,appUrl:B,referrer:y,nodeDid:f,spaceDid:t.did}}))},le=async(b,Z)=>{const h=Z(b.endpoint),N=Se(h),k=b.space?Z(b.space):{};if(t.did&&N!==t.did){D(ue=>({...ue,open:!1}));const K=i("storage.spaces.gateway.switch.failedForMismatchSpace",{name:k!=null&&k.name?k.name:""});v.error(K),s==null||s(new Error(K),t);return}const L={...t,name:k.name??"DID Space",did:k.did??Se(h),endpoint:h};await oe(L),D(K=>({...K,open:!1})),s==null||s(null,L)},de=async()=>{try{if(P)return;M(!0),await c.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(b){console.error(b),v.error(b.message),r==null||r(b,t)}finally{M(!0)}},pe=async()=>{try{await ne(t),v.success(i("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),a==null||a(null,t)}catch(b){console.error(b),a==null||a(b,t)}};return j.useEffect(()=>{p!=null&&p.completed?(n&&((p==null?void 0:p.progress)===100?(v.success(i("storage.spaces.backupSuccessfully")),r==null||r(null,t)):p.message&&(r==null||r(new Error(p==null?void 0:p.message),t)),p.progress=0,p.message=""),M(!1),setTimeout(()=>{re(),ae()},1e3)):p.progress&&M(!0)},[p]),e.jsxs(e.Fragment,{children:[e.jsxs(x,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ce&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:de,children:i("storage.spaces.strategy.backupNow")}),ie&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:q,children:i("storage.spaces.disconnected.reconnectNow")}),Q&&e.jsx(fs,{title:(p==null?void 0:p.message)&&e.jsx(x,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:p.message})}),children:e.jsxs(me,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(w,{variant:"determinate",value:p==null?void 0:p.progress,size:14,sx:{mr:1}}),p==null?void 0:p.progress,"%"]})}),e.jsx(Ct,{forceConnected:!1,saveConnect:!1,prefix:R.prefix,open:R.open,popup:!0,action:R.action,baseUrl:R.baseUrl,checkFn:R.checkFn,onSuccess:le,onClose:R.onClose,checkTimeout:R.checkTimeout,extraParams:R.extraParams,messages:R.messages,locale:l},"get-endpoint")]}),e.jsx(Oe,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:pe,onConnect:q,enableSwitchToSpace:(p==null?void 0:p.completed)||Y(p==null?void 0:p.message),backupInProgress:Q})]})}Ue.propTypes={spaceGateway:g.shape({did:g.string.isRequired,name:g.string.isRequired,url:g.string.isRequired,endpoint:g.string.isRequired,protected:g.bool,loading:g.bool}).isRequired,spaceStatus:g.string.isRequired,selected:g.bool.isRequired,onConnected:g.func,onDeleted:g.func,onBackedUp:g.func};Ue.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function qe({...t}){const{t:o}=E();return e.jsxs(x,{...t,children:[e.jsx(x,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:o("storage.spaces.backup.records")})}),e.jsx(ve,{}),e.jsx(Ee,{})]})}qe.propTypes={};function _e({...t}){const{t:o}=E(),{autoBackup:n,updateAutoBackup:s}=U(),a=async()=>{try{const r=!(n!=null&&n.enabled);await s({enabled:r}),v.success(o(r?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(r){v.error(r.message)}};return e.jsx(Wt,{checked:!!(n!=null&&n.enabled),onChange:a,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}_e.propTypes={};function gs(){const{t}=E(),{spaceGateways:o,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=U(),a=n&&!(o!=null&&o.length),r=({spaceGateway:i,spaceStatus:l,selected:d,refresh:c})=>e.jsx(Ue,{spaceGateway:i,spaceStatus:l,selected:d,onConnected:()=>c(),onBackedUp:f=>f&&c()});return e.jsxs(x,{display:"flex",flexDirection:"column",children:[e.jsx(ye,{sx:{button:{fontSize:"revert",fontWeight:500}},left:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),actions:e.jsxs(e.Fragment,{children:[e.jsx(_e,{}),e.jsx(se,{})]})}),e.jsx(x,{mt:2,children:a?e.jsx(x,{display:"flex",justifyContent:"center",children:e.jsx(w,{})}):e.jsx(Le,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(i=>e.jsx(Le,{item:!0,xs:12,md:6,children:e.jsx(It,{endpoint:i.endpoint,selected:s(i),action:r},i.endpoint)}))})})}),e.jsx(qe,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(He,{})]})}function xs(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=U();return t?e.jsx(Je,{relative:"parent",children:e.jsx(w,{})}):Y(o)?e.jsx(Ge,{}):e.jsx(gs,{})}function Ss(){return e.jsx(Be,{children:e.jsx(xs,{})})}function ys(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:n,hasStorageEndpoint:s,loading:a,storageEndpoint:r}=Rt(),i=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return a?e.jsx(Je,{relative:"parent",children:e.jsx(w,{})}):e.jsxs(x,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(Tt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(Dt,{}),e.jsx(x,{sx:i,children:e.jsx(wt,{onConnect:n,storageEndpoint:r})})]})}function js(){const{t}=E();return e.jsxs(Et,{children:[e.jsxs(J,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(ys,{})]})}function $e({navOrientation:t,...o}){const{t:n,locale:s}=E(),{blocklet:a}=O(),r=Bt({key:"md"}),[i,l]=At(),d=i.get("tab")||"backup",c=r?"horizontal":t,f=xe(()=>{var p;const B=[{label:n("common.backup"),value:"backup"}],y=(p=a==null?void 0:a.capabilities)==null?void 0:p.didSpace;return(y===z.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===z.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&B.push({label:n("common.storage"),value:"storage"}),B},[s,c]),S=xe(()=>({backup:e.jsx(Ss,{}),storage:e.jsx(js,{})}))[d],m=B=>{l(y=>(B==="backup"?y.delete("tab"):y.set("tab",B),y))};if(f.length<=1)return e.jsx(fe,{children:S});const A=e.jsx(bt,{tabs:f,current:d,orientation:c,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(x,{...o,children:e.jsxs(J,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(x,{sx:{flexShrink:0},children:e.jsx(ye,{left:A})}),e.jsx(x,{sx:{flexGrow:1,minWidth:0},children:e.jsx(fe,{sx:{mt:1},children:S})})]})});if(c==="horizontal")return e.jsxs(x,{...o,children:[e.jsx(ye,{left:A}),e.jsx(fe,{sx:{mt:2},children:S})]})}$e.propTypes={navOrientation:g.oneOf(["vertical","horizontal"])};$e.defaultProps={navOrientation:"vertical"};const fe=te(x)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1,4 +1,4 @@
1
- import{j as e,k as i,dq as x,dr as c,s as p}from"./index-DdJGYtAD.js";function w({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(m=>x(c(m))).join(" "):o,layout:n="horizontal",children:r,valueComponent:l="div",nameWidth:s=90,...f}){return e.jsxs(d,{layout:n,width:s,...f,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),r&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:r})]})}const d=p("div")`
1
+ import{j as e,k as i,dq as x,dr as c,s as p}from"./index-KdOmwCM0.js";function w({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(m=>x(c(m))).join(" "):o,layout:n="horizontal",children:r,valueComponent:l="div",nameWidth:s=90,...f}){return e.jsxs(d,{layout:n,width:s,...f,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),r&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:r})]})}const d=p("div")`
2
2
  display: flex;
3
3
  flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
4
4
  justify-content: flex-start;