@abtnode/webapp 1.17.7-beta-20251227-001958-ea2ba3f5 → 1.17.7-beta-20251229-085620-84f09930

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 (198) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-BdvIhlUS.js → AdapterDayjs-B3EPIF8V.js} +1 -1
  4. package/dist/assets/{Add-75JKngmd.js → Add-B60k0zLe.js} +1 -1
  5. package/dist/assets/ArrowDropDown-D9C6bexH.js +1 -0
  6. package/dist/assets/{Autocomplete-kOONI_Pq.js → Autocomplete-B4QHA8fQ.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-cTLPSR0j.js → Breadcrumbs-C2AxMEIo.js} +1 -1
  8. package/dist/assets/{ButtonGroup-CHbmdfp0.js → ButtonGroup-CwgnAVvA.js} +1 -1
  9. package/dist/assets/{CSSTransition-D4VQqBYl.js → CSSTransition-CTMK0QDG.js} +1 -1
  10. package/dist/assets/{CallMerge-DlG0KEtx.js → CallMerge-Cdfeu5IS.js} +1 -1
  11. package/dist/assets/{CardContent-DzGFYCPu.js → CardContent-LxDdD1ia.js} +1 -1
  12. package/dist/assets/{ChevronLeft-BtZyYDNZ.js → ChevronLeft-BU5D6BrG.js} +1 -1
  13. package/dist/assets/{ChevronRight-RokC-KBT.js → ChevronRight-BntDfQzc.js} +1 -1
  14. package/dist/assets/{Clear-1FRwWVql.js → Clear-RDv89tkq.js} +1 -1
  15. package/dist/assets/{Delete-BwS0ZYTA.js → Delete-BeglY8dh.js} +1 -1
  16. package/dist/assets/{DeleteOutline-1X_2pN5H.js → DeleteOutline-BDLlQ3k7.js} +1 -1
  17. package/dist/assets/{Done-CL3etDC5.js → Done-CEn2z4YZ.js} +1 -1
  18. package/dist/assets/{Edit-CHx0TOIp.js → Edit-B8h0Te5z.js} +1 -1
  19. package/dist/assets/{ErrorOutline-C1GIrHWO.js → ErrorOutline-C8or5W5q.js} +1 -1
  20. package/dist/assets/{FilterList-CeGx1Nvy.js → FilterList-CLDlsWBv.js} +1 -1
  21. package/dist/assets/{Google-C7HwiVx9.js → Google-BjTL7Mbd.js} +1 -1
  22. package/dist/assets/{HelpOutline-v-SutwQQ.js → HelpOutline-BWiGx-E5.js} +1 -1
  23. package/dist/assets/{KeyboardArrowDown-CUBW-wSD.js → KeyboardArrowDown-DEp_gv0Q.js} +1 -1
  24. package/dist/assets/{Launch-DW7r2j3F.js → Launch-dZPSseNQ.js} +1 -1
  25. package/dist/assets/{Link-JpBA3kOe.js → Link-CysJEW2j.js} +1 -1
  26. package/dist/assets/{ListItemButton-YCbqUifF.js → ListItemButton-d8kfS6hh.js} +1 -1
  27. package/dist/assets/{ListSubheader-B7asbL85.js → ListSubheader-fV4wdcMl.js} +1 -1
  28. package/dist/assets/{LoadingButton-KZUgibtr.js → LoadingButton-BsrnRHRU.js} +1 -1
  29. package/dist/assets/{MoreVert-CAHrwnnF.js → MoreVert-uETYsy_E.js} +1 -1
  30. package/dist/assets/{OpenInNew-qP3b9J2q.js → OpenInNew-BCfmTCS5.js} +1 -1
  31. package/dist/assets/{Refresh-kYd1krYv.js → Refresh-Cm8v0stG.js} +1 -1
  32. package/dist/assets/{Replay-SZk6LYf7.js → Replay-DHMSlrmF.js} +1 -1
  33. package/dist/assets/{Search-l7-Pwd1y.js → Search-btz9KaC-.js} +1 -1
  34. package/dist/assets/{Stepper-BGGXEyEh.js → Stepper-Dxn7bqpJ.js} +1 -1
  35. package/dist/assets/{TableSearch-7aO3QXBn.js → TableSearch-fEXgtTVk.js} +1 -1
  36. package/dist/assets/{ToggleButtonGroup-CavSDkQH.js → ToggleButtonGroup-C4kzOS0b.js} +1 -1
  37. package/dist/assets/{UnfoldMore-DGe5-aCR.js → UnfoldMore-DThRR6-N.js} +1 -1
  38. package/dist/assets/{Verified-D57Ev6tJ.js → Verified-C19edvAZ.js} +1 -1
  39. package/dist/assets/{VerifiedUser-BVjv0CVW.js → VerifiedUser-K3XyiGA_.js} +1 -1
  40. package/dist/assets/{ViewList-DnUToii8.js → ViewList-CgjJtd-c.js} +1 -1
  41. package/dist/assets/{_createAggregator-CvUwaNA9.js → _createAggregator-C6OGob0j.js} +1 -1
  42. package/dist/assets/{actions-DmtsArNi.js → actions-Cx5UWmFM.js} +2 -2
  43. package/dist/assets/actions-DLzRFvAK.js +1 -0
  44. package/dist/assets/{agreement-Cr1FBybU.js → agreement-DkKyZFRL.js} +4 -4
  45. package/dist/assets/api-BIW3WSyV.js +1 -0
  46. package/dist/assets/{appearance-349xWfPH.js → appearance-Dy0GAWnb.js} +1 -1
  47. package/dist/assets/{audit-logs-MqhyOVr_.js → audit-logs-DDH5oZ1m.js} +3 -3
  48. package/dist/assets/base-chart-BYW3DQfO.js +1 -0
  49. package/dist/assets/{blocklet-BWp5BZ2L.js → blocklet-DOEd7Lt0.js} +1 -1
  50. package/dist/assets/{chain-Cs69RHJH.js → chain-DxgLFRf-.js} +1 -1
  51. package/dist/assets/click-to-copy-DsEvNuW1.js +1 -0
  52. package/dist/assets/cloneDeep-Cig9fPty.js +1 -0
  53. package/dist/assets/{config-navigation-CB4CUmS1.js → config-navigation-B1zx14fz.js} +22 -22
  54. package/dist/assets/{connect-to-BOU_fUy1.js → connect-to-C32I6gO9.js} +3 -3
  55. package/dist/assets/{cssMode-irya--jO.js → cssMode-CtKJ93fE.js} +1 -1
  56. package/dist/assets/{de-CCwoF0w2.js → de-EFAP4yzZ.js} +1 -1
  57. package/dist/assets/{delete-confirm-Czdis-d2.js → delete-confirm-Rx1yldK0.js} +1 -1
  58. package/dist/assets/{depsEqual-DtNa6mfL.js → depsEqual-CzPGJZq9.js} +1 -1
  59. package/dist/assets/{detail-aen8Gspk.js → detail-BYhPDlPb.js} +3 -3
  60. package/dist/assets/{domains-BRAsjXjE.js → domains-oZZ_Ty-9.js} +2 -2
  61. package/dist/assets/{download-DJuVrKpX.js → download-Dpf3ldu1.js} +1 -1
  62. package/dist/assets/{edit.svg-H5puV-Kf.js → edit.svg-CuloKtQk.js} +1 -1
  63. package/dist/assets/emotion-cache.browser.esm-BSPYCi-c.js +1 -0
  64. package/dist/assets/engine-DsZ-2cMT.js +1 -0
  65. package/dist/assets/{freemarker2-PK6zL7Wa.js → freemarker2-BWRy4jrz.js} +1 -1
  66. package/dist/assets/{get-safe-url-GMIK5bS7.js → get-safe-url-BgeSRCM1.js} +1 -1
  67. package/dist/assets/getValidReactChildren-c-3WOl4y.js +1 -0
  68. package/dist/assets/{graphqlMode-DhfmM5z8.js → graphqlMode-0sRNcgDJ.js} +2 -2
  69. package/dist/assets/{handlebars-suZg9Rb2.js → handlebars-P_4TmNVs.js} +1 -1
  70. package/dist/assets/{html-DLf47i1s.js → html-Dhv8md5y.js} +1 -1
  71. package/dist/assets/{html-title-BhYkXb7K.js → html-title-DD44mmgD.js} +1 -1
  72. package/dist/assets/{htmlMode-CRO-0abo.js → htmlMode-DopggpcY.js} +1 -1
  73. package/dist/assets/{iframe-D8OX0v5x.js → iframe-Qu-nVscQ.js} +1 -1
  74. package/dist/assets/{index-DeYnJhWD.js → index-39sjM7w4.js} +1 -1
  75. package/dist/assets/{index-Devav5mO.js → index-3bdOGXYz.js} +12 -12
  76. package/dist/assets/{index-Bq_Xf-WS.js → index-AnwYvOD6.js} +1 -1
  77. package/dist/assets/{index--sTZZj1Y.js → index-B4-HrO4o.js} +2 -2
  78. package/dist/assets/index-B7s3fWmd.js +79 -0
  79. package/dist/assets/{index-BJDBjriy.js → index-BHdJvD_e.js} +4 -4
  80. package/dist/assets/{index-C43er3Ol.js → index-BU4T_Wvp.js} +1 -1
  81. package/dist/assets/{index-D94ou7Gi.js → index-BXHaVrfH.js} +2 -2
  82. package/dist/assets/index-B_uYaYXc.js +87 -0
  83. package/dist/assets/{index-CjSZc8j3.js → index-BrhUX_qe.js} +1 -1
  84. package/dist/assets/{index-B0YA0eex.js → index-BsR0_qFa.js} +2 -2
  85. package/dist/assets/{index-Dk8_eJCH.js → index-C-V9x4q4.js} +17 -17
  86. package/dist/assets/{index-B9IBU_20.js → index-CBUEmu4p.js} +1 -1
  87. package/dist/assets/{index-CUYDbdpc.js → index-CK33Cb9C.js} +1 -1
  88. package/dist/assets/{index-DV1T4J21.js → index-Cnw2Ig5U.js} +2 -2
  89. package/dist/assets/{index-RvLFbIq0.js → index-Cvq6zZB9.js} +2 -2
  90. package/dist/assets/index-CwUZ9am0.js +5 -0
  91. package/dist/assets/index-Czc8yQAA.js +1 -0
  92. package/dist/assets/{index-BuAy14Fb.js → index-D-xN2OZw.js} +1 -1
  93. package/dist/assets/{index-BbjlOuR9.js → index-D2KGQYNR.js} +3 -3
  94. package/dist/assets/{index-Y-QvttbJ.js → index-D78suzy2.js} +95 -95
  95. package/dist/assets/index-D7HZBvR8.js +1 -0
  96. package/dist/assets/{index-3eT72yhD.js → index-D7vqSOsg.js} +9 -9
  97. package/dist/assets/{index-BQYunZVD.js → index-D93L21zf.js} +1 -1
  98. package/dist/assets/{index-DwIPLdSZ.js → index-D9z9EJRg.js} +17 -17
  99. package/dist/assets/{index-DkSARRFf.js → index-DHkDWWjb.js} +1 -1
  100. package/dist/assets/{index-CV64vjhs.js → index-DWxJ8r2D.js} +3 -3
  101. package/dist/assets/{index-DZVqWhON.js → index-DbU5jvv5.js} +1 -1
  102. package/dist/assets/{index-0K1n4OCx.js → index-DefsJZKk.js} +2 -2
  103. package/dist/assets/{index-929LkcAj.js → index-Deye8jzv.js} +8 -8
  104. package/dist/assets/{index-sa-k6sge.js → index-Dj054slT.js} +1 -1
  105. package/dist/assets/{index-lJeVBvul.js → index-DlpmIKRl.js} +12 -12
  106. package/dist/assets/{index-B8RjSIJa.js → index-Do20OM4S.js} +1 -1
  107. package/dist/assets/{index-CfCUQn4l.js → index-DyaBkuYt.js} +4 -4
  108. package/dist/assets/{index-LHDtQAe7.js → index-Eiq737ML.js} +1 -1
  109. package/dist/assets/index-GJu0trt8.js +155 -0
  110. package/dist/assets/{index-DcB5G7mF.js → index-H0mlKY3H.js} +1 -1
  111. package/dist/assets/index-JJswhFbD.js +1 -0
  112. package/dist/assets/{index-C8P0cv0U.js → index-OMPkcLs4.js} +2 -2
  113. package/dist/assets/{index-HMHQfeWc.js → index-RogGDMH8.js} +9 -9
  114. package/dist/assets/{index-BLAEccy_.js → index-gGxk5WJM.js} +1 -1
  115. package/dist/assets/{index-DARZEe4H.js → index-j3UFl5Dq.js} +2 -2
  116. package/dist/assets/{index-DGClCi00.js → index-qkxVIYPT.js} +11 -11
  117. package/dist/assets/{index-D-GgAn4D.js → index-uV9pYRNo.js} +1 -1
  118. package/dist/assets/{index.esm-D4mbID4N.js → index.esm-mNR4f2BF.js} +1 -1
  119. package/dist/assets/{install-from-url-B3WY31cp.js → install-from-url-D52UYhXy.js} +1 -1
  120. package/dist/assets/{invitation--cbaLA7C.js → invitation-DlWLyqUv.js} +4 -4
  121. package/dist/assets/is-path-prefix-equal-BYQbaqqa.js +1 -0
  122. package/dist/assets/item-LsHOq-zm.js +273 -0
  123. package/dist/assets/{javascript-ChSXcPeU.js → javascript-DKLJNbgU.js} +1 -1
  124. package/dist/assets/{jsonMode-BRST5wef.js → jsonMode-6n4xGwpA.js} +1 -1
  125. package/dist/assets/{liquid-CpSF9izi.js → liquid-BvDNIxXF.js} +1 -1
  126. package/dist/assets/{list-header-CAyaG0bp.js → list-header-BHsvljit.js} +1 -1
  127. package/dist/assets/{lock.svg-DtLI8vnk.js → lock.svg-BzF_roTX.js} +1 -1
  128. package/dist/assets/{log-DZS6nYV_.js → log-CCqXzPvI.js} +2 -2
  129. package/dist/assets/{lottie-react.esm-D7vuHojB.js → lottie-react.esm-CA2-qLw0.js} +1 -1
  130. package/dist/assets/{mdx-BWUp_fub.js → mdx-CORwGL2F.js} +1 -1
  131. package/dist/assets/{memory-ClDXUWJ0.js → memory-DjgLsWG0.js} +1 -1
  132. package/dist/assets/{metric-DyS1o5oY.js → metric-CNMVZIll.js} +1 -1
  133. package/dist/assets/omit-BGJcae02.js +1 -0
  134. package/dist/assets/{overview-BZK8iTTP.js → overview-DZx8sNOc.js} +1 -1
  135. package/dist/assets/{permission-C73DtYHh.js → permission-CCNK9jT0.js} +1 -1
  136. package/dist/assets/{preference-A-YVUe6G.js → preference-CL8oQs4K.js} +9 -9
  137. package/dist/assets/{python-CxcQpe_X.js → python-DNPLg-Zx.js} +1 -1
  138. package/dist/assets/{raf-schd.esm-DUBpm6hM.js → raf-schd.esm-D_x0x_Qn.js} +1 -1
  139. package/dist/assets/{razor-CV7jqhrT.js → razor-BXbmyOQh.js} +1 -1
  140. package/dist/assets/{rotate-session-key-C16BchY6.js → rotate-session-key-B9uPds9f.js} +1 -1
  141. package/dist/assets/{runtime-DQsAvWqZ.js → runtime-CJZGBtjx.js} +1 -1
  142. package/dist/assets/schema-DqiLBSd2.js +1 -0
  143. package/dist/assets/sdk-CSPQYdiI.js +1 -0
  144. package/dist/assets/{service-DAzvPZkc.js → service-BB7jaRU2.js} +1 -1
  145. package/dist/assets/{shorten-label-CkQfhtXr.js → shorten-label-D6qdCHBK.js} +1 -1
  146. package/dist/assets/{simple-select-CuyjHO0U.js → simple-select-ZER_8WgH.js} +1 -1
  147. package/dist/assets/{spaces-CWPgDpWK.js → spaces-M88xnpCx.js} +1 -1
  148. package/dist/assets/status-CjV3xdMN.js +1 -0
  149. package/dist/assets/{status-Dzw7M8P_.js → status-Claw5V5z.js} +1 -1
  150. package/dist/assets/{switch-control-BclMvWCC.js → switch-control-CVj0L-9B.js} +2 -2
  151. package/dist/assets/{table-icons-9svpZs1q.js → table-icons-D5BFFDTU.js} +1 -1
  152. package/dist/assets/{team-j4eaMxpB.js → team-DI44e0Lq.js} +1 -1
  153. package/dist/assets/{toLower-8m1XzQqH.js → toLower-BR9mSuL0.js} +1 -1
  154. package/dist/assets/toUpper-cXhRv1n8.js +1 -0
  155. package/dist/assets/traffic-CtaSaEzh.js +1 -0
  156. package/dist/assets/{tsMode-CqXYRIKQ.js → tsMode-B4RcWbJF.js} +1 -1
  157. package/dist/assets/{typescript-KJ8oiy4w.js → typescript-ApR86vo0.js} +1 -1
  158. package/dist/assets/{url-evaluation-BstEsUAB.js → url-evaluation-Dz0qWdnw.js} +1 -1
  159. package/dist/assets/{url-join-0c-XnZLH.js → url-join-Bhp_MbCf.js} +1 -1
  160. package/dist/assets/{use-mobile-9lV1jqC7.js → use-mobile-D6doCW2D.js} +1 -1
  161. package/dist/assets/{use-mobile-BG1HQZl_.js → use-mobile-p7bScsU1.js} +1 -1
  162. package/dist/assets/{useAsync-Bbnkcz0c.js → useAsync-DeHRjN-F.js} +1 -1
  163. package/dist/assets/{useAsyncRetry-DwNYtCt1.js → useAsyncRetry-M7S8bZOZ.js} +1 -1
  164. package/dist/assets/{useLocalStorage-B2geQn_J.js → useLocalStorage-CGOwOi-p.js} +1 -1
  165. package/dist/assets/{useThemeProps-CqzVTStV.js → useThemeProps-xpQuNQBO.js} +1 -1
  166. package/dist/assets/{util-BRuccBUB.js → util-B4XNVjK7.js} +1 -1
  167. package/dist/assets/{wait-container-C4LPSsIr.js → wait-container-DE5vVesp.js} +3 -3
  168. package/dist/assets/{without-wallet--pvprqkp.js → without-wallet-CZASlBin.js} +1 -1
  169. package/dist/assets/wrap-locale-DqDO9Bmx.js +1 -0
  170. package/dist/assets/{xml-DQZh516a.js → xml-CqiM979f.js} +1 -1
  171. package/dist/assets/{yaml-CpaHe6nN.js → yaml-CHANqhAV.js} +1 -1
  172. package/dist/index.html +1 -1
  173. package/package.json +1 -1
  174. package/dist/assets/ArrowDropDown-CbIxem1P.js +0 -1
  175. package/dist/assets/actions-BZl9shku.js +0 -1
  176. package/dist/assets/api-CZXns3iQ.js +0 -1
  177. package/dist/assets/base-chart-B_hYrlch.js +0 -1
  178. package/dist/assets/click-to-copy-CJg25x9s.js +0 -1
  179. package/dist/assets/cloneDeep-CvglcUIb.js +0 -1
  180. package/dist/assets/emotion-cache.browser.esm-CaLvcLFC.js +0 -1
  181. package/dist/assets/engine-C4nmXPyL.js +0 -1
  182. package/dist/assets/getValidReactChildren-BTFGvhfH.js +0 -1
  183. package/dist/assets/index-BKwmETrp.js +0 -1
  184. package/dist/assets/index-CHyDna8x.js +0 -79
  185. package/dist/assets/index-CK6zgnPU.js +0 -5
  186. package/dist/assets/index-CL23Woxs.js +0 -87
  187. package/dist/assets/index-DYn_D6bf.js +0 -155
  188. package/dist/assets/index-Di8tb0lj.js +0 -1
  189. package/dist/assets/index-Diu0oJmr.js +0 -1
  190. package/dist/assets/is-path-prefix-equal-BkAKRgRo.js +0 -1
  191. package/dist/assets/item-9qWg89Hm.js +0 -273
  192. package/dist/assets/omit-BgwU28m_.js +0 -1
  193. package/dist/assets/schema-CutOyNqB.js +0 -1
  194. package/dist/assets/sdk-vbwSpYyc.js +0 -1
  195. package/dist/assets/status-D1smxOIE.js +0 -1
  196. package/dist/assets/toUpper-B5GOxJoT.js +0 -1
  197. package/dist/assets/traffic-DIOEDjRI.js +0 -1
  198. package/dist/assets/wrap-locale-D8L6OQkL.js +0 -1
@@ -0,0 +1,87 @@
1
+ import{c as Y,u as q,r as o,a as R,b as $,j as e,o as k,d as F,e as X,p as J,f as K,W as D,L as Z,g as b,h as ee,i as B,k as C,T as v,G as j,l as ne,m as V,s as L,C as se}from"./index-D78suzy2.js";import{f as ae}from"./index-BojVbZw0.js";import{v as U}from"./index-uV9pYRNo.js";import{M as W}from"./metric-CNMVZIll.js";import{C as M}from"./click-to-copy-DsEvNuW1.js";import"./CardContent-LxDdD1ia.js";var te=Y(function(s,d,r){return s+(r?" ":"")+d.toLowerCase()});const G=o.createContext({}),{Provider:re,Consumer:ge}=G;function oe({children:s}){const{api:d,info:r}=q(),[p,i]=o.useState(null),[u,x]=o.useState(!1),[l,t]=o.useState([]),a=4,h=async({silent:c=!0,retries:f=a}={})=>{c||x(!0);try{i(null);const{users:m}=await d.getUsers({input:{teamDid:r.did,paging:{pageSize:100}}});x(!1),t(m)}catch(m){f>0?setTimeout(()=>h({silent:c,retries:f-1}),1e3):(x(!1),i(m))}};o.useEffect(()=>{h({silent:!1})},[]),R($.TeamEvents.userAdded,({teamDid:c})=>{c===r.did&&h()}),R($.TeamEvents.userRemoved,({teamDid:c,user:{did:f}})=>{c===r.did&&t(m=>m.filter(g=>g.did!==f))}),R($.TeamEvents.userUpdated,({teamDid:c})=>{c===r.did&&h()});const N={loading:u,error:p,users:l,refresh:h};return e.jsx(re,{value:{users:N},children:s})}function ie(){const{users:s}=o.useContext(G);return s}const y={oneSecond:1,oneMin:1*60,oneHour:1*60*60,oneDay:24*60*60},le=(s,d)=>{const[r,p]=o.useState(0),i=l=>l>=y.oneDay?y.oneDay:l>=y.oneHour?y.oneHour:l>=y.oneMin?y.oneMin:y.oneSecond,[u,x]=o.useState(i(s/1e3));return o.useEffect(()=>{const l=setInterval(()=>{p(r+u);const t=i(s/1e3+r+u);u!==t&&x(t)},u*1e3);return()=>clearInterval(l)},[u,r]),o.useEffect(()=>{p(0),x(i(s/1e3))},[s]),d(s+r*1e3)};k.number.isRequired,k.func;const ce=async s=>{const d=await s.getNodeEnv();return Object.assign({},d.info||{})};k.number.isRequired;k.string.isRequired,k.string.isRequired,k.string.isRequired;function me(){const{info:s,api:d,loading:r}=q(),{data:p,externalData:i,paging:u,externalPaging:x}=F(),{users:l}=ie(),t=X(()=>ce(d)),{t:a,locale:h}=o.useContext(J),N=K(),c=le(+new Date-s.startAt,m=>{const g={compact:!0,verbose:!0,locale:V(h)};return ne(m,g)});let f=null;if(r)f=e.jsx(se,{});else{const m=[{name:a("dashboard.nodeDid"),value:e.jsx(D,{did:s.did,showQrcode:!0})}];s.nodeOwner&&m.push({name:a("dashboard.ownerDid"),value:e.jsx(D,{did:s.nodeOwner.did,showQrcode:!0})});let g=[];s.launcher&&(g=[{name:a("common.did"),value:e.jsx(D,{did:s.launcher.did,showQrcode:!0})},{name:a("common.type"),value:s.launcher.type},{name:a("launcher.provider"),value:s.launcher.provider},{name:a("launcher.adminUrl"),value:e.jsx(Z,{target:"_blank",href:s.launcher.url,underline:"hover",children:s.launcher.url})}]);const P=(n,_)=>!n&&!_?"-":n==="-"?n:!_||_==="-"?e.jsxs(v,{className:"ip-item",children:[e.jsx(b,{children:"IPV4"}),e.jsx(M,{children:n})]}):e.jsxs(v,{component:"ul",children:[e.jsxs("li",{className:"ip-item",children:[e.jsx(b,{children:"IPV4"}),e.jsx(M,{children:n})]}),e.jsxs("li",{className:"ip-item",children:[e.jsx(b,{children:"IPV6"}),e.jsx(M,{children:_})]})]}),O=()=>{const n=[{name:`${a("common.internalIp")}`,value:P(t.value.ip.internalV4,t.value.ip.internalV6)},{name:`${a("common.externalIp")}`,value:P(t.value.ip.externalV4,t.value.ip.externalV6)}];return t.value.docker?[]:n},T=t.value?[{name:`${a("common.version")}`,value:s.version},...O(),{name:`${a("common.os")}`,value:t.value.os},t.value.docker?{name:`${a("common.docker")}`,value:e.jsx(b,{type:"success",children:"Yes"})}:null,t.value.gitpod?{name:`${a("common.gitpod")}`,value:e.jsx(b,{type:"success",children:"Yes"})}:null].filter(Boolean):[];Array.isArray(ee(t,"value.blockletEngines",null))&&t.value.blockletEngines.filter(n=>n.visible&&n.available).forEach(n=>{T.push({name:n.displayName,value:e.jsx(b,{type:"success",children:`${n.version}`||"N/A"})})});const H=l.length,A=l.filter(n=>n.approved).length;let I=H;A&&(I+=`<small><strong>${te(a("common.approved"))} ${A}</strong></small>`);let S=0,w=0;p&&(S=u?.total||p.length,w=p.filter(n=>B.isBlockletRunning(n)).length),Array.isArray(i)&&(S+=x?.total||i.length,w+=i.filter(n=>B.isBlockletRunning(n)).length);let z=S;w&&(z+=`<small>${a("common.running")} ${w}</small>`);const Q=[{name:a("common.blocklets"),value:z},{name:a("common.members"),value:I},{name:a("common.uptime"),value:c},{name:a("common.created"),value:ae(new Date(s.createdAt).getTime(),V(h))}];let E=[];t.value&&t.value.disk&&Object.values(t.value.disk).some(n=>n>0)&&(E=[{name:a("common.blockletsStorage"),value:C(t.value.disk.blocklets||0).toUpperCase()},{name:a("common.dataStorage"),value:C(t.value.disk.data||0).toUpperCase()},{name:a("common.logStorage"),value:C(t.value.disk.log||0).toUpperCase()},{name:a("common.cacheStorage"),value:C(t.value.disk.cache||0).toUpperCase()},{name:a("common.coreStorage"),value:C(t.value.disk.app||0).toUpperCase()}]),f=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"section",children:[e.jsx(v,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:a("common.overview")}),e.jsx(j,{className:"page-metrics",container:!0,spacing:{xs:1,md:2},children:Q.map(n=>e.jsx(j,{size:{xl:1.5,lg:3,md:4,sm:12,xs:12},children:e.jsx(W,{...n})},n.name))})]}),E.length>0&&e.jsxs("div",{className:"section",children:[e.jsx(v,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:a("common.storage")}),e.jsx(j,{className:"page-metrics",container:!0,spacing:{xs:1,md:2},children:E.map(n=>e.jsx(j,{size:{xl:1.5,lg:3,md:4,sm:12,xs:12},children:e.jsx(W,{...n})},n.name))})]}),e.jsxs("div",{className:"section",children:[e.jsx(v,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:a("common.meta")}),e.jsxs(j,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:[e.jsxs(j,{size:{lg:6,md:12,sm:12,xs:12},children:[e.jsx(v,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:a("common.dAddress")}),m.map(n=>e.jsx(U,{nameWidth:150,name:n.name,children:n.value},n.name)),g.length>0&&e.jsxs("div",{style:{marginTop:N.spacing(8)},children:[e.jsx(v,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:a("common.launcher")}),g.map(n=>e.jsx(U,{nameWidth:150,name:n.name,children:n.value},n.name))]})]},"address"),e.jsxs(j,{size:{lg:6,md:12,sm:12,xs:12},children:[e.jsx(v,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:a("common.env")}),T.map(n=>e.jsx(U,{valueComponent:"div",nameWidth:150,name:n.name,children:n.value},n.name))]},"environment")]})]})]})}return e.jsx(de,{children:f})}const de=L.main`
2
+ .page-header {
3
+ display: flex;
4
+ justify-content: space-between;
5
+ align-items: center;
6
+ }
7
+
8
+ .page-content {
9
+ margin-top: 16px;
10
+ }
11
+
12
+ .section {
13
+ display: flex;
14
+ flex-direction: column;
15
+ margin-bottom: ${s=>s.theme.breakpoints.down("sm")?"24px":"64px"};
16
+
17
+ .section__header {
18
+ font-weight: bold;
19
+ margin-bottom: ${s=>s.theme.breakpoints.down("sm")?"12px":"24px"};
20
+ }
21
+
22
+ .info-row__name {
23
+ text-transform: uppercase;
24
+ font-size: 0.9em;
25
+ }
26
+
27
+ .info-row__value .ip-item {
28
+ display: flex;
29
+ align-items: center;
30
+ }
31
+
32
+ .info-row__value .ip-item:not(:first-of-type) {
33
+ margin-top: 5px;
34
+ }
35
+
36
+ /* 屏宽小于 600px 时, container padding 为 16px, .MuiGrid-spacing-xs-5 会在水平方向延伸 40px, 超出容器宽度, 会导致水平滚动条 */
37
+ .MuiGrid-spacing-xs-5 {
38
+ width: calc(100% + 32px);
39
+ margin: -16px;
40
+ }
41
+ }
42
+
43
+ .section-flex {
44
+ flex-direction: row;
45
+ }
46
+
47
+ .section-item {
48
+ flex: 1;
49
+ }
50
+
51
+ .section-item-desc {
52
+ display: flex;
53
+ margin-top: 15px;
54
+ }
55
+
56
+ .used::before {
57
+ content: ' ';
58
+ border: 0;
59
+ background-color: #1a90ff;
60
+ }
61
+
62
+ .free::before {
63
+ content: ' ';
64
+ border: 0;
65
+ background-color: #eeeeee;
66
+ }
67
+
68
+ @media (max-width: ${s=>s.theme.breakpoints.values.md}px) {
69
+ .section-flex {
70
+ flex-direction: column;
71
+ }
72
+ }
73
+ `;L.div`
74
+ flex: 1;
75
+ display: flex;
76
+
77
+ &::before {
78
+ content: '';
79
+ display: block;
80
+ width: 12px;
81
+ height: 12px;
82
+ border: 1px solid #999;
83
+ border-radius: 2px;
84
+ margin-top: 3px;
85
+ margin-right: 10px;
86
+ }
87
+ `;function je(){return e.jsx(oe,{children:e.jsx(me,{})})}export{je as default};
@@ -1 +1 @@
1
- import{A as g,bo as v,u as y,j as r,P as f,S as x,R as h}from"./index-Y-QvttbJ.js";import{L as S,D as j}from"./download-DJuVrKpX.js";import{u as L}from"./useLocalStorage-B2geQn_J.js";import"./ButtonGroup-CHbmdfp0.js";import"./getValidReactChildren-BTFGvhfH.js";function I(){const c=g(),[s,i]=L("server-logs-filter",{name:"abtnode",type:{abtnode:"error"}}),{name:t=s.name}=v(),{info:l}=y(),n=l.routing.provider,a=[{id:"abtnode",name:"Blocklet Server",types:["error","info","access","stdout","stderr","pm2"]},{id:"blocklet-services",name:"Blocklet Services",types:["error","info","access","stdout","stderr"]}];if(n){const e=`Service Gateway(${n})`;a.push({id:`service-gateway-${n}`,name:e,types:["error","access","security"]})}const d=e=>{i({...s,name:e.target.value}),c(`/logs/${e.target.value}`)},m=r.jsx(f,{sx:{minWidth:240},children:r.jsx(x,{value:t,onChange:d,size:"small",children:a.map(e=>r.jsx(h,{value:e.id,children:e.name},e.id))})}),o=a.find(e=>e.id===t)||a[0],p=o.types.indexOf(s.type[t]||"error"),u=e=>{i({name:t,type:{...s.type,[t]:e}})};return r.jsx(S,{name:o.name,logId:o.id,types:o.types,prepend:m,postpend:r.jsx(j,{id:l.did,name:"blocklet-server"}),defaultTypeIndex:p,onTypeChange:u},o.id)}export{I as default};
1
+ import{A as g,bn as v,u as y,j as r,O as f,S as x,Q as h}from"./index-D78suzy2.js";import{L as S,D as j}from"./download-Dpf3ldu1.js";import{u as L}from"./useLocalStorage-CGOwOi-p.js";import"./ButtonGroup-CwgnAVvA.js";import"./getValidReactChildren-c-3WOl4y.js";function I(){const c=g(),[s,i]=L("server-logs-filter",{name:"abtnode",type:{abtnode:"error"}}),{name:t=s.name}=v(),{info:l}=y(),n=l.routing.provider,a=[{id:"abtnode",name:"Blocklet Server",types:["error","info","access","stdout","stderr","pm2"]},{id:"blocklet-services",name:"Blocklet Services",types:["error","info","access","stdout","stderr"]}];if(n){const e=`Service Gateway(${n})`;a.push({id:`service-gateway-${n}`,name:e,types:["error","access","security"]})}const d=e=>{i({...s,name:e.target.value}),c(`/logs/${e.target.value}`)},m=r.jsx(f,{sx:{minWidth:240},children:r.jsx(x,{value:t,onChange:d,size:"small",children:a.map(e=>r.jsx(h,{value:e.id,children:e.name},e.id))})}),o=a.find(e=>e.id===t)||a[0],p=o.types.indexOf(s.type[t]||"error"),u=e=>{i({name:t,type:{...s.type,[t]:e}})};return r.jsx(S,{name:o.name,logId:o.id,types:o.types,prepend:m,postpend:r.jsx(j,{id:l.did,name:"blocklet-server"}),defaultTypeIndex:p,onTypeChange:u},o.id)}export{I as default};
@@ -1,5 +1,5 @@
1
- import{c2 as Fe,c1 as Ge,r as h,c3 as Ke,j as e,ba as ee,c5 as Ye,ci as J,c6 as $e,b$ as He,ck as qe,aG as he,M as q,bp as A,cx as Ce,H as B,Y as V,bh as E,fF as we,aR as Be,b as N,iX as Ve,V as D,gG as Qe,o as f,x as Xe,ay as De,y as fe,am as Ze,p as Je,C as L,T as j,k as et,s as tt,f as st,iY as X,i2 as Z,iZ as ot,K as S,aX as F,aI as T,L as nt,g as H,dp as at,O as Se,R as K,aF as Y,aa as $,a6 as rt,bC as it,fw as ct,b1 as lt,v as pe,w as dt,G as be,Z as Ee,bF as xe,B as pt}from"./index-Y-QvttbJ.js";import{T as ut}from"./html-title-BhYkXb7K.js";import{u as U}from"./blocklet-BWp5BZ2L.js";import{u as mt}from"./use-mobile-BG1HQZl_.js";import{c as Ie,d as ft,e as xt,f as gt,S as ht,g as ue,h as St,b as yt,u as bt,C as kt,D as jt,a as Ct}from"./connect-to-BOU_fUy1.js";import"./index-DARZEe4H.js";import"./index-BojVbZw0.js";import"./api-CZXns3iQ.js";import{d as wt,a as Bt,g as Dt,i as Et,e as ge,f as It,h as Tt,j as Rt}from"./spaces-CWPgDpWK.js";import{v as zt}from"./index-D-GgAn4D.js";import{E as vt}from"./index-DeYnJhWD.js";import{H as Pt}from"./HelpOutline-v-SutwQQ.js";import{H as At}from"./index-LHDtQAe7.js";import{x as Lt}from"./index-DRYJ0xIl.js";import{D as Ut}from"./DeleteOutline-1X_2pN5H.js";import{g as ke}from"./get-safe-url-GMIK5bS7.js";import{S as Ot}from"./switch-control-BclMvWCC.js";import{L as je}from"./list-header-CAyaG0bp.js";import"./OpenInNew-qP3b9J2q.js";import"./ButtonGroup-CHbmdfp0.js";import"./getValidReactChildren-BTFGvhfH.js";import"./FilterList-CeGx1Nvy.js";import"./CSSTransition-D4VQqBYl.js";import"./emotion-cache.browser.esm-CaLvcLFC.js";import"./index-929LkcAj.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DtNa6mfL.js";import"./TableSearch-7aO3QXBn.js";import"./Search-l7-Pwd1y.js";import"./Clear-1FRwWVql.js";import"./MoreVert-CAHrwnnF.js";function Mt(t){return Fe("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${J(s)}`,`fontSize${J(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${J(n.color)}`],s[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ke({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Ft=he(e.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"})),Gt=he(e.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"}));async function Kt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!q(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Kt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:qt,Consumer:_s}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=Ht({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},G=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=U(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=U(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Je),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(L,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
2
- `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(vt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(F,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):i?e.jsx(H,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(Pt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};function Ue({metadata:t={}}){const{t:s}=D();if(q(t))return e.jsx(H,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=Lt(o,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[s("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:s("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:f.object};function Oe(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:u}=o[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return m?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(H,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>q(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=o?.[i]??{},{status:l,message:p,createdAt:u,metadata:x}=d,m=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!m,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!m;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:u})}}}],[o,n,t]),c=h.useMemo(()=>!o?.length,[o]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(At,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(u,x)=>{u?.preventDefault(),u?.stopPropagation(),a(x)},l=async u=>{try{u?.stopPropagation(),i(!0),await s?.(t),a(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=u=>{d(u,!1),n?.(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(K,{color:"red",onClick:u=>d(u,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[u,x]=h.useState(!1),m=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),m(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),m(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[u||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(K,{onClick:y=>{m(y,!1),window.open(ke(t.endpoint?It(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx($,{children:p("common.open")})]}),e.jsxs(K,{onClick:y=>{m(y,!1),window.open(ke(Tt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(K,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(K,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(ht,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};const Jt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,G=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Rt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o?.(null,t);return}}catch(C){console.error(C),o?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:G})]})}_e.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=O(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=O(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(St,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(s)?e.jsx(Zt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=bt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(jt,{}),e.jsx(S,{sx:c,children:e.jsx(Ct,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(yt,{children:[e.jsxs(F,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[o,l]),x=xe(()=>({backup:e.jsx(ns,{}),storage:e.jsx(rs,{})}))[d],m=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(F,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};const me=ee(S)`
1
+ import{c1 as Ge,c0 as Ke,r as h,c2 as Fe,j as e,b9 as ee,c4 as Ye,ch as Z,c5 as $e,b_ as He,cj as qe,aF as he,K as q,bo as A,cw as Ce,H as B,X as V,bg as E,fE as we,aQ as Be,b as N,iX as Ve,V as D,gG as Qe,o as f,x as Xe,ax as De,y as fe,al as Je,p as Ze,C as L,T as j,k as et,s as tt,f as st,iY as X,i2 as J,iZ as ot,J as S,aW as G,aH as T,L as nt,g as H,dn as at,N as Se,Q as F,aE as Y,a9 as $,a5 as rt,bB as it,fv as ct,b0 as lt,v as pe,w as dt,G as be,Y as Ee,bE as xe,B as pt}from"./index-D78suzy2.js";import{T as ut}from"./html-title-DD44mmgD.js";import{u as U}from"./blocklet-DOEd7Lt0.js";import{u as mt}from"./use-mobile-p7bScsU1.js";import{c as Ie,d as ft,e as xt,f as gt,S as ht,g as ue,h as St,b as yt,u as bt,C as kt,D as jt,a as Ct}from"./connect-to-C32I6gO9.js";import"./index-j3UFl5Dq.js";import"./index-BojVbZw0.js";import"./api-BIW3WSyV.js";import{d as wt,a as Bt,g as Dt,i as Et,e as ge,f as It,h as Tt,j as Rt}from"./spaces-M88xnpCx.js";import{v as zt}from"./index-uV9pYRNo.js";import{E as vt}from"./index-39sjM7w4.js";import{H as Pt}from"./HelpOutline-BWiGx-E5.js";import{H as At}from"./index-Eiq737ML.js";import{x as Lt}from"./index-DRYJ0xIl.js";import{D as Ut}from"./DeleteOutline-BDLlQ3k7.js";import{g as ke}from"./get-safe-url-BgeSRCM1.js";import{S as Ot}from"./switch-control-CVj0L-9B.js";import{L as je}from"./list-header-BHsvljit.js";import"./OpenInNew-BCfmTCS5.js";import"./ButtonGroup-CwgnAVvA.js";import"./getValidReactChildren-c-3WOl4y.js";import"./FilterList-CLDlsWBv.js";import"./CSSTransition-CTMK0QDG.js";import"./emotion-cache.browser.esm-BSPYCi-c.js";import"./index-Deye8jzv.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-CzPGJZq9.js";import"./TableSearch-fEXgtTVk.js";import"./Search-btz9KaC-.js";import"./Clear-RDv89tkq.js";import"./MoreVert-uETYsy_E.js";function Mt(t){return Ge("MuiIcon",t)}Ke("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${Z(s)}`,`fontSize${Z(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${Z(n.color)}`],s[`fontSize${Z(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Fe({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Gt=he(e.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"})),Kt=he(e.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"}));async function Ft({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!q(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Ft({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:qt,Consumer:_s}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=Ht({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},K=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await K({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=U(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=U(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Ze),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(L,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
2
+ `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(vt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(G,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):i?e.jsx(H,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(Pt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};function Ue({metadata:t={}}){const{t:s}=D();if(q(t))return e.jsx(H,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=Lt(o,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[s("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:s("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:f.object};function Oe(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:u}=o[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return m?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(H,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>q(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=o?.[i]??{},{status:l,message:p,createdAt:u,metadata:x}=d,m=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!m,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!m;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:u})}}}],[o,n,t]),c=h.useMemo(()=>!o?.length,[o]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(At,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Jt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(u,x)=>{u?.preventDefault(),u?.stopPropagation(),a(x)},l=async u=>{try{u?.stopPropagation(),i(!0),await s?.(t),a(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=u=>{d(u,!1),n?.(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:u=>d(u,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[u,x]=h.useState(!1),m=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),m(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),m(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[u||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(F,{onClick:y=>{m(y,!1),window.open(ke(t.endpoint?It(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx($,{children:p("common.open")})]}),e.jsxs(F,{onClick:y=>{m(y,!1),window.open(ke(Tt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Kt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(ht,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};const Zt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,K=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Rt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o?.(null,t);return}}catch(C){console.error(C),o?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),K&&e.jsx(Zt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:K})]})}_e.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=O(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=O(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(St,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(s)?e.jsx(Jt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=bt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(jt,{}),e.jsx(S,{sx:c,children:e.jsx(Ct,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(yt,{children:[e.jsxs(G,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[o,l]),x=xe(()=>({backup:e.jsx(ns,{}),storage:e.jsx(rs,{})}))[d],m=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};const me=ee(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;
5
5
  overflow: hidden;