@abtnode/webapp 1.17.3-beta-20251117-130331-b2ce7065 → 1.17.3-beta-20251118-061144-335cd35d

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 (189) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-Bf5-20Hs.js → AdapterDayjs-CYQj26XH.js} +1 -1
  4. package/dist/assets/{Add-CYJYCqae.js → Add-D3nFvEMB.js} +1 -1
  5. package/dist/assets/ArrowDropDown-CsPHtg1Z.js +1 -0
  6. package/dist/assets/{Autocomplete-DBgFXR4S.js → Autocomplete-Bv76_KL0.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-8fBU6snO.js → Breadcrumbs-Dz5_xB6v.js} +1 -1
  8. package/dist/assets/{ButtonGroup-DdwOEbFl.js → ButtonGroup-CXE45zw_.js} +1 -1
  9. package/dist/assets/{CSSTransition-D4EEAtrd.js → CSSTransition-DETThFuD.js} +1 -1
  10. package/dist/assets/{CallMerge-CPW4TW2I.js → CallMerge-DMMNtA91.js} +1 -1
  11. package/dist/assets/{CardContent-BhjbYpgO.js → CardContent-0tGjd4AR.js} +1 -1
  12. package/dist/assets/{ChevronLeft-B9gimbug.js → ChevronLeft-Cv7hEe9j.js} +1 -1
  13. package/dist/assets/{ChevronRight-CxtWttnr.js → ChevronRight-DDzebVAp.js} +1 -1
  14. package/dist/assets/{Clear-CxuHkeB_.js → Clear-BKH2DPdA.js} +1 -1
  15. package/dist/assets/{DeleteOutline-BaG49xB4.js → DeleteOutline-C_ptzk3q.js} +1 -1
  16. package/dist/assets/{Done-vXmO1_nL.js → Done-B4vyGIbD.js} +1 -1
  17. package/dist/assets/{Edit-q21V0uHn.js → Edit-BPwRu79h.js} +1 -1
  18. package/dist/assets/{ErrorOutline-nmAT1HDy.js → ErrorOutline-DK4r7q3e.js} +1 -1
  19. package/dist/assets/{FilterList-DJIxPwJl.js → FilterList-NTvfDQQ0.js} +1 -1
  20. package/dist/assets/{Google-LZJ4034m.js → Google-Ct2UR0cZ.js} +1 -1
  21. package/dist/assets/{HelpOutline-ClH7KlOo.js → HelpOutline-Dl5Yvk3d.js} +1 -1
  22. package/dist/assets/{KeyboardArrowDown-DX0Brp6T.js → KeyboardArrowDown-FDIQe8i9.js} +1 -1
  23. package/dist/assets/{Launch-HRe6ja_q.js → Launch-Bbmt72w1.js} +1 -1
  24. package/dist/assets/{Link-xbXtHMcm.js → Link-CDqKHFq9.js} +1 -1
  25. package/dist/assets/{ListItemButton-BTom3jC4.js → ListItemButton-CPUETe4N.js} +1 -1
  26. package/dist/assets/{ListSubheader-DtB8aen3.js → ListSubheader-CXMRJUdt.js} +1 -1
  27. package/dist/assets/{LoadingButton-fl1a3VJ5.js → LoadingButton-B_6lwM1e.js} +1 -1
  28. package/dist/assets/{MoreVert-C0TW35nI.js → MoreVert-C8oKCpDc.js} +1 -1
  29. package/dist/assets/{OpenInNew-BARTtWT4.js → OpenInNew-Bthv24Qd.js} +1 -1
  30. package/dist/assets/{Refresh-DPUEH7GP.js → Refresh-jF1ntmdY.js} +1 -1
  31. package/dist/assets/{Search-xi7mzsy1.js → Search-CL67DzD6.js} +1 -1
  32. package/dist/assets/{Stepper-DTI_TWkX.js → Stepper-CBmVxEeg.js} +1 -1
  33. package/dist/assets/{Switch-3lSFjk1I.js → Switch-Dtn3RWR5.js} +1 -1
  34. package/dist/assets/{TableSearch-h0N_WiXK.js → TableSearch-DLP010Te.js} +1 -1
  35. package/dist/assets/{ToggleButtonGroup-B7unrKOQ.js → ToggleButtonGroup-QnXUedbZ.js} +1 -1
  36. package/dist/assets/{UnfoldMore-C9cvZJbw.js → UnfoldMore-DJtqAZSg.js} +1 -1
  37. package/dist/assets/{Verified-C7pIsLBr.js → Verified-BIjAmkBj.js} +1 -1
  38. package/dist/assets/{VerifiedUser-8jnzzhUp.js → VerifiedUser-C2Na71lh.js} +1 -1
  39. package/dist/assets/{ViewList-BwWxfIQm.js → ViewList-E3mSGuLu.js} +1 -1
  40. package/dist/assets/{_createAggregator-zy56jAyV.js → _createAggregator-D3cee_13.js} +1 -1
  41. package/dist/assets/{actions-DB9KRUZP.js → actions-Bp0I4iiq.js} +1 -1
  42. package/dist/assets/{actions-CSHVjH1K.js → actions-CERYEoLy.js} +1 -1
  43. package/dist/assets/{agreement-DtB1vl7S.js → agreement-Dcyk6kKb.js} +1 -1
  44. package/dist/assets/api-DxzFdLki.js +1 -0
  45. package/dist/assets/{appearance-pTUtw_MS.js → appearance-B-gL9Z52.js} +1 -1
  46. package/dist/assets/{audit-logs-SvoghMMD.js → audit-logs-FJ0vLLB1.js} +1 -1
  47. package/dist/assets/{base-chart-DmnJjW6a.js → base-chart-aUdxIyGY.js} +1 -1
  48. package/dist/assets/{blocklet-BiSktkqf.js → blocklet-CTig8EZC.js} +1 -1
  49. package/dist/assets/chain-DkxBElQK.js +6 -0
  50. package/dist/assets/{click-to-copy-CR2I9N_h.js → click-to-copy-C0H_SWXD.js} +1 -1
  51. package/dist/assets/cloneDeep-De7nGURI.js +1 -0
  52. package/dist/assets/{collapse-gFG2GWAJ.js → collapse-CG1JFMDb.js} +1 -1
  53. package/dist/assets/{config-navigation-BA-dW1Cj.js → config-navigation-CPSSd34k.js} +3 -3
  54. package/dist/assets/connect-to-DZIdTrfY.js +29 -0
  55. package/dist/assets/{cssMode-Qaz3Dq8b.js → cssMode-DgwnomwV.js} +1 -1
  56. package/dist/assets/{delete-confirm-BLFHS3Q1.js → delete-confirm-3ByffieE.js} +1 -1
  57. package/dist/assets/{depsEqual-BHwu6MhF.js → depsEqual-DQ8f_obf.js} +1 -1
  58. package/dist/assets/{detail-DDuU-iec.js → detail-BJBirY8S.js} +3 -3
  59. package/dist/assets/{domains-5dVDY635.js → domains-D7Nx60Iu.js} +1 -1
  60. package/dist/assets/{download-DIDPIhA_.js → download-CJ21CP9q.js} +1 -1
  61. package/dist/assets/{edit.svg-DKz1Cv7A.js → edit.svg-Cs1qWG7S.js} +1 -1
  62. package/dist/assets/emotion-cache.browser.esm-R7OUqHQ7.js +1 -0
  63. package/dist/assets/engine-Barzy6EW.js +1 -0
  64. package/dist/assets/{freemarker2-CiQofTpA.js → freemarker2-BCzkwmC3.js} +1 -1
  65. package/dist/assets/{get-safe-url-Bl0GiKcG.js → get-safe-url-B4jRm2fX.js} +1 -1
  66. package/dist/assets/getValidReactChildren-Ixtn2Lye.js +1 -0
  67. package/dist/assets/{graphqlMode-CSQeVKey.js → graphqlMode-DN5_jFBm.js} +2 -2
  68. package/dist/assets/{handlebars-D4Xjvhdx.js → handlebars-CbTwQSKo.js} +1 -1
  69. package/dist/assets/{html-ColxAq8f.js → html-C5j77qA4.js} +1 -1
  70. package/dist/assets/{html-title-6LqX2w8M.js → html-title-7s4LlRfZ.js} +1 -1
  71. package/dist/assets/{htmlMode-rdPbEarV.js → htmlMode-iLAmaecF.js} +1 -1
  72. package/dist/assets/{iframe-DiiXxW_e.js → iframe-Lor2b2kR.js} +1 -1
  73. package/dist/assets/{index-CrViMJ5B.js → index-B6gEjd41.js} +1 -1
  74. package/dist/assets/{index-CIj09Pcu.js → index-B9bVoJvj.js} +1 -1
  75. package/dist/assets/{index-Cn4qYCgV.js → index-BPUHmN3S.js} +2 -2
  76. package/dist/assets/{index-BD0Uv4Gl.js → index-BQDGNXlA.js} +1 -1
  77. package/dist/assets/{index-AiMHcWYz.js → index-BR5tqNCz.js} +1 -1
  78. package/dist/assets/{index-DHbsQGci.js → index-BUvb2LGc.js} +1 -1
  79. package/dist/assets/{index-B2zgGgjI.js → index-BXIK_ZvE.js} +3 -3
  80. package/dist/assets/{index-Cjl-VlwM.js → index-BXxjP2NC.js} +9 -9
  81. package/dist/assets/{index-BdcV8EAY.js → index-BZYJZVK9.js} +1 -1
  82. package/dist/assets/{index-SZTTi26H.js → index-BjCDY7o7.js} +1 -1
  83. package/dist/assets/{index-Sz-ky4ND.js → index-BqKmOEO2.js} +1 -1
  84. package/dist/assets/{index-CWgFZr4-.js → index-BqTTwfgk.js} +1 -1
  85. package/dist/assets/{index-CeH8-AEj.js → index-BsoC_lrH.js} +1 -1
  86. package/dist/assets/{index-R-cIWXnC.js → index-BtRJV9SA.js} +1 -1
  87. package/dist/assets/{index-B8jNHs3n.js → index-C03Xs5y6.js} +1 -1
  88. package/dist/assets/{index-BoMj9C4D.js → index-C4wYPIWG.js} +1 -1
  89. package/dist/assets/{index-Bm_l9nlM.js → index-C7oyIqA7.js} +133 -136
  90. package/dist/assets/{index-BTz9PK_P.js → index-C86Wh4X2.js} +1 -1
  91. package/dist/assets/{index-D2Fb9-sJ.js → index-CAILMp9T.js} +1 -1
  92. package/dist/assets/{index-CS8lfW32.js → index-CDZRZ08r.js} +1 -1
  93. package/dist/assets/{index-C0Cl1KH_.js → index-CTD6v5o8.js} +1 -1
  94. package/dist/assets/{index-Dosn5Rf8.js → index-CYhvTwYc.js} +1 -1
  95. package/dist/assets/{index-Dsde1L6e.js → index-CeZHZjg2.js} +1 -1
  96. package/dist/assets/{index-D2_Zhh-7.js → index-Cn_Ep5fQ.js} +1 -1
  97. package/dist/assets/{index-PX-nJtRg.js → index-CnggYr6i.js} +3 -3
  98. package/dist/assets/{index-CiD7ef_l.js → index-CpafYj8K.js} +1 -1
  99. package/dist/assets/{index-CRCDuqtr.js → index-CyOYZIyc.js} +1 -1
  100. package/dist/assets/{index-C4XN0Kz6.js → index-Czl2YXdp.js} +1 -1
  101. package/dist/assets/{index-BuyR7Vcz.js → index-D5L-lDoJ.js} +1 -1
  102. package/dist/assets/{index-Bc0KMH9_.js → index-DOkSzlW8.js} +3 -3
  103. package/dist/assets/{index-Dv_YqGF9.js → index-DSXieMH9.js} +1 -1
  104. package/dist/assets/{index-Coaf_Q-u.js → index-DUoosowu.js} +1 -1
  105. package/dist/assets/{index-CaaGoS1U.js → index-DZnln7_d.js} +1 -1
  106. package/dist/assets/{index-BRw5riiu.js → index-DjewGuIf.js} +1 -1
  107. package/dist/assets/{index-CvGq-Qxj.js → index-DkIe2azS.js} +3 -3
  108. package/dist/assets/{index-B_yw38TX.js → index-DnfwZfKh.js} +1 -1
  109. package/dist/assets/{index-D60hmvDo.js → index-F-3NBA_J.js} +1 -1
  110. package/dist/assets/{index-CfidfTow.js → index-MGqS20SY.js} +1 -1
  111. package/dist/assets/index-VRAfth6S.js +1 -0
  112. package/dist/assets/{index-C1JU4GjO.js → index-W21RY8Bn.js} +1 -1
  113. package/dist/assets/{index-DYQxrbaR.js → index-XP9Sdcko.js} +1 -1
  114. package/dist/assets/{index-Dg2MABfe.js → index-_dzE-N9z.js} +1 -1
  115. package/dist/assets/{index-BGQtqZhg.js → index-gi1c-lgo.js} +1 -1
  116. package/dist/assets/{index-C4cay8Y6.js → index-k_VWiAXM.js} +1 -1
  117. package/dist/assets/{index-DbYGxxqG.js → index-w8a9j4Lh.js} +1 -1
  118. package/dist/assets/{index-DvEp0N83.js → index-wB3bGq-Y.js} +1 -1
  119. package/dist/assets/{index.esm-Bs3p187N.js → index.esm-CoXuWxwd.js} +1 -1
  120. package/dist/assets/{install-from-url-BdwrhLEn.js → install-from-url-CM4-q1OH.js} +1 -1
  121. package/dist/assets/{invitation-RdveTwWE.js → invitation-nbCDrt2L.js} +1 -1
  122. package/dist/assets/{is-path-prefix-equal-Bp4qHWB5.js → is-path-prefix-equal-B-r_-nu3.js} +1 -1
  123. package/dist/assets/{item-nJ8ETSBU.js → item-CmPv8jYK.js} +1 -1
  124. package/dist/assets/{javascript-CRpB_uhV.js → javascript-Bgnir3TY.js} +1 -1
  125. package/dist/assets/{jsonMode-DbxQ3HXZ.js → jsonMode-np4Sdl1O.js} +1 -1
  126. package/dist/assets/{liquid-DL8uvkYc.js → liquid-BsUOYxUu.js} +1 -1
  127. package/dist/assets/{list-header-CeZ7lRnY.js → list-header-DKhmsovM.js} +1 -1
  128. package/dist/assets/{lock.svg-BA73VmdT.js → lock.svg-DsoBO5VK.js} +1 -1
  129. package/dist/assets/{log-DLCETmFq.js → log-Cpp-XdCr.js} +1 -1
  130. package/dist/assets/{lottie-react.esm-YcVL9_bK.js → lottie-react.esm-B5GgRjtI.js} +1 -1
  131. package/dist/assets/{mdx-CArQhcWo.js → mdx-giJhSA7-.js} +1 -1
  132. package/dist/assets/{memory-DcHt02vi.js → memory-CH9hRvQm.js} +1 -1
  133. package/dist/assets/{metric-BSqz6uVg.js → metric-DSsVl3Cm.js} +1 -1
  134. package/dist/assets/omit-Do63Hql7.js +1 -0
  135. package/dist/assets/{overview--qxw8faD.js → overview-jF5ol3BN.js} +1 -1
  136. package/dist/assets/{permission-CZwbIMwH.js → permission-CYhKziEK.js} +1 -1
  137. package/dist/assets/{preference-C6bKZJy1.js → preference---2pRjAN.js} +3 -3
  138. package/dist/assets/{python-C22IC4Ow.js → python-yPV2hgrq.js} +1 -1
  139. package/dist/assets/{raf-schd.esm-C9AfJ5dk.js → raf-schd.esm-DAtwKRiC.js} +1 -1
  140. package/dist/assets/{razor-D_EDQHVZ.js → razor-C6MyZoWd.js} +1 -1
  141. package/dist/assets/{rotate-session-key-DQXPMtMo.js → rotate-session-key-bWlHyJ3Q.js} +1 -1
  142. package/dist/assets/{runtime-DkQORF9i.js → runtime-Ce82-6Vy.js} +1 -1
  143. package/dist/assets/schema-CFNtS407.js +1 -0
  144. package/dist/assets/sdk-2u3kCwLk.js +1 -0
  145. package/dist/assets/{service-BqabGBqV.js → service-C7MsF2Ta.js} +1 -1
  146. package/dist/assets/{shorten-label-Df52qlAD.js → shorten-label-F3aTTiYl.js} +1 -1
  147. package/dist/assets/{simple-select-Hr-fafsv.js → simple-select-CclmRLPq.js} +1 -1
  148. package/dist/assets/{spaces-CFEqPh3C.js → spaces-BQok4_vA.js} +1 -1
  149. package/dist/assets/{status-BVvVWxS1.js → status-AoEub3Rs.js} +1 -1
  150. package/dist/assets/{status-zS6roOCg.js → status-CpXw7_VT.js} +1 -1
  151. package/dist/assets/{switch-control-Dg3K4nsi.js → switch-control-BmvEmQoO.js} +1 -1
  152. package/dist/assets/{table-icons-DV7ggPIq.js → table-icons-DqvdBFtX.js} +1 -1
  153. package/dist/assets/{team-CJqX7LGt.js → team-BlSuObjC.js} +1 -1
  154. package/dist/assets/{toLower-DU3J81VJ.js → toLower-CBsJSe8M.js} +1 -1
  155. package/dist/assets/toUpper-C4TBXpfs.js +1 -0
  156. package/dist/assets/{traffic-CfQ0107D.js → traffic-NitwIn36.js} +1 -1
  157. package/dist/assets/{tsMode-BX2H6pCp.js → tsMode-CsVrPc6A.js} +1 -1
  158. package/dist/assets/{typescript-DsA7IVF6.js → typescript-BdD7LnJq.js} +1 -1
  159. package/dist/assets/{url-evaluation-Cgv5jFUd.js → url-evaluation-DNKcusJ-.js} +1 -1
  160. package/dist/assets/{url-join-DxD2Gj4C.js → url-join-DFDvwpzb.js} +1 -1
  161. package/dist/assets/{use-mobile-BIr5XrNk.js → use-mobile-BofeT_Q4.js} +1 -1
  162. package/dist/assets/{use-mobile-DejvdfF-.js → use-mobile-Ct3mh22I.js} +1 -1
  163. package/dist/assets/{useAsync-DdDBBsf-.js → useAsync-BpJM8Asg.js} +1 -1
  164. package/dist/assets/{useAsyncRetry-DkI_OyrW.js → useAsyncRetry-C92elVh7.js} +1 -1
  165. package/dist/assets/{useLocalStorage-DCBNi-1B.js → useLocalStorage-BbZxR418.js} +1 -1
  166. package/dist/assets/{useThemeProps-DeAc5QgN.js → useThemeProps-D6aOJl-G.js} +1 -1
  167. package/dist/assets/{util-DVzwrKal.js → util-BGhsYWnW.js} +1 -1
  168. package/dist/assets/{wait-container-DSGw6clb.js → wait-container-CQB6MKpK.js} +1 -1
  169. package/dist/assets/{without-wallet-DFT-2KAL.js → without-wallet-pqh7Wquz.js} +1 -1
  170. package/dist/assets/wrap-locale-4nP_RMJf.js +1 -0
  171. package/dist/assets/{xml-CdAptCm9.js → xml-C_t7ZM-7.js} +1 -1
  172. package/dist/assets/{yaml-DVro76uB.js → yaml-s-PecxRK.js} +1 -1
  173. package/dist/index.html +1 -1
  174. package/dist/service-worker.js +1 -1
  175. package/package.json +1 -1
  176. package/dist/assets/ArrowDropDown-DlYnYg9A.js +0 -1
  177. package/dist/assets/api-DvjvmnE7.js +0 -1
  178. package/dist/assets/chain-C37XjDKy.js +0 -6
  179. package/dist/assets/cloneDeep-BlfyMkjT.js +0 -1
  180. package/dist/assets/connect-to-DfLNs2UU.js +0 -30
  181. package/dist/assets/emotion-cache.browser.esm-Boqprxmw.js +0 -1
  182. package/dist/assets/engine--07M59ne.js +0 -1
  183. package/dist/assets/getValidReactChildren-BW9X0l3m.js +0 -1
  184. package/dist/assets/index-CwAIwcil.js +0 -1
  185. package/dist/assets/omit-CynnoJR-.js +0 -1
  186. package/dist/assets/schema-1S-EeX3b.js +0 -1
  187. package/dist/assets/sdk-UW9gC3fJ.js +0 -1
  188. package/dist/assets/toUpper-BwnYRIYt.js +0 -1
  189. package/dist/assets/wrap-locale-muuRqko4.js +0 -1
@@ -1,4 +1,4 @@
1
- import{aF as createSvgIcon,j as jsxRuntimeExports,r as reactExports$1,o,bd as getDefaultExportFromCjs,E as useMediaQuery,s as styled,dp as Skeleton,cT as M$1,Z as CheckIcon,ay as Tooltip,dI as Button,T as Typography,K as Box,C as CircularProgress,f as useTheme,dC as isObject,f0 as mergeThemeOptions,f1 as StyledEngineProvider,f2 as ThemeProvider,f3 as ThemeProvider$1,f4 as s,Y as o$1,b8 as styled$1,f5 as CloseIcon,cI as Buffer,be as U,bI as __vitePreload,dH as noop,br as l$2}from"./index-Bm_l9nlM.js";import{j as joinUrl}from"./url-join-DxD2Gj4C.js";const l$1=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"})),d$2=createSvgIcon([jsxRuntimeExports.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),jsxRuntimeExports.jsx("path",{d:"M10 3h4v12h-4z"},"1")]),k$2=reactExports$1.createContext(),{Provider:w$3}=k$2,d$1=(C,F,V=window.location.pathname.replace(/\/$/,"/"))=>C?F?C===V:new RegExp(C).test(V):!1;function P({children:C,steps:F,mode:V="history"}){const[D,B]=reactExports$1.useState("");!D&&F.length&&B(F[0].key);const O=F.map(X=>X.children?[{key:X.key,hasChild:!0},X.children.map(at=>({parentKey:X.key,key:at.key}))]:{key:X.key}).flat(1/0),j=O.filter(X=>!X.hasChild),H=X=>{let at;const rt=O.findIndex(ft=>ft.key===D?(at=ft.parentKey,!0):!1);if(at===X)return"current";const tt=O.findIndex(ft=>ft.key===X);if(tt!==-1){if(tt===rt)return"current";if(tt<rt)return"before"}return"after"};function G(X){B(X)}function K(X){if(typeof X=="function"){const at=X(j.findIndex(rt=>rt.key===D));B(j[at].key)}else B(j[X].key)}const it=j.findIndex(X=>X.key===D);reactExports$1.useEffect(()=>{if(V==="history"){let X="";F.some(at=>at.children&&at.children.length?at.children.some(rt=>d$1(rt.path,rt.exact)?(X=rt.key,!0):!1):d$1(at.path,at.exact)?(X=at.key,!0):!1),X&&B(X)}return()=>{}},[F,V]);const ot={steps:F,totalStepsCount:j.length,getStepStatus:H,setActiveStepByKey:G,setActiveStepByIndex:K,activeStep:it,canBackToStep:X=>V==="memory"&&it!==0&&X<it};return jsxRuntimeExports.jsx(w$3,{value:ot,children:C})}function T$1(){return reactExports$1.use(k$2)}P.propTypes={children:o.any.isRequired,steps:o.array.isRequired,mode:o.string};var lib,hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;var C=Object.prototype.hasOwnProperty,F=Object.prototype.toString;function V(D){if(D==null)return!0;if(typeof D=="boolean")return!1;if(typeof D=="number")return D===0;if(typeof D=="string"||typeof D=="function"||Array.isArray(D))return D.length===0;if(D instanceof Error)return D.message==="";if(D.toString==F)switch(D.toString()){case"[object File]":case"[object Map]":case"[object Set]":return D.size===0;case"[object Object]":{for(var B in D)if(C.call(D,B))return!1;return!0}}return!1}return lib=V,lib}var libExports=requireLib();const k$1=getDefaultExportFromCjs(libExports),S=""+new URL("blocklet-default-logo-Bspnu_ws.png",import.meta.url).href,t$1={en:{optional:"Optional",defaultNavSubTitle:"Launching"},zh:{optional:"可选",defaultNavSubTitle:"启动"}},a$1=C=>t$1[C]?t$1[C]:t$1.en,i=C=>C==="zh"?"启动":"Launching",g$2=C=>C?.title||C?.name||"";function T({blockletMeta:C={},subTitle:F="",logoUrl:V="",locale:D="",navLogo:B="",loading:O=!1}){const j=useMediaQuery(ot=>ot.breakpoints.down("md")),H=j?18:48,G=reactExports$1.useRef(null),[K,it]=reactExports$1.useState("");return reactExports$1.useEffect(()=>{G.current&&G.current.offsetHeight>34&&(K===""?it("middle"):K==="middle"&&it("small"))},[K]),jsxRuntimeExports.jsxs(R,{className:K==="small"?"center-mode":"",children:[j?jsxRuntimeExports.jsx("div",{className:"app-icon",children:B}):jsxRuntimeExports.jsxs("div",{className:"app-icon",children:[O&&jsxRuntimeExports.jsx(I,{blockletSize:H,isMobile:j}),!O&&jsxRuntimeExports.jsx(u$1,{blockletSize:H,logoUrl:V})]}),jsxRuntimeExports.jsxs("div",{className:"header-title",children:[j&&F&&jsxRuntimeExports.jsx("div",{className:"header-title-sub",children:F}),jsxRuntimeExports.jsxs("div",{className:"app-name-content",children:[!j&&jsxRuntimeExports.jsx("div",{className:"launching-context",children:F||i(D)}),jsxRuntimeExports.jsx("div",{className:`header-title-name ${K==="middle"||K==="small"?"middle-size":""}`,ref:G,children:jsxRuntimeExports.jsx(w$2,{logoUrl:V,isMobile:j,blockletMeta:C,blockletSize:H,loading:O})})]})]})]})}T.propTypes={blockletMeta:o.object,subTitle:o.any,logoUrl:o.string,locale:o.string,navLogo:o.any,loading:o.bool};function I({blockletSize:C,isMobile:F}){return F?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:C,height:C})}function u$1({logoUrl:C,blockletSize:F}){return jsxRuntimeExports.jsx(M$1,{width:F,height:F,src:C,alt:"blocklet icon",fallback:S,style:{verticalAlign:"text-bottom"}},`layout-app-icon-${C}`)}function w$2({isMobile:C,logoUrl:F,blockletMeta:V={},blockletSize:D,loading:B}){const O=g$2(V);return B?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):k$1(V)?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",animation:!1,width:100,height:16,alt:"icon",style:{marginTop:4}}):C?jsxRuntimeExports.jsxs(L$1,{children:[jsxRuntimeExports.jsx(u$1,{blockletSize:D,logoUrl:F}),jsxRuntimeExports.jsx("span",{className:"ellipsis-title",children:g$2(V)})]}):jsxRuntimeExports.jsx(E,{className:"app-link",target:"_blank",href:joinUrl(V?.registryUrl||"",`/blocklets/${V?.did}`),title:O,children:O})}const L$1=styled.div`
1
+ import{aF as createSvgIcon,j as jsxRuntimeExports,r as reactExports$1,o,bd as getDefaultExportFromCjs,E as useMediaQuery,s as styled,dp as Skeleton,cT as M$1,Z as CheckIcon,ay as Tooltip,dI as Button,T as Typography,K as Box,C as CircularProgress,f as useTheme,dC as isObject,f0 as mergeThemeOptions,f1 as StyledEngineProvider,f2 as ThemeProvider,f3 as ThemeProvider$1,f4 as s,Y as o$1,b8 as styled$1,f5 as CloseIcon,cI as Buffer,be as U,bI as __vitePreload,dH as noop,br as l$2}from"./index-C7oyIqA7.js";import{j as joinUrl}from"./url-join-DFDvwpzb.js";const l$1=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"})),d$2=createSvgIcon([jsxRuntimeExports.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),jsxRuntimeExports.jsx("path",{d:"M10 3h4v12h-4z"},"1")]),k$2=reactExports$1.createContext(),{Provider:w$3}=k$2,d$1=(C,F,V=window.location.pathname.replace(/\/$/,"/"))=>C?F?C===V:new RegExp(C).test(V):!1;function P({children:C,steps:F,mode:V="history"}){const[D,B]=reactExports$1.useState("");!D&&F.length&&B(F[0].key);const O=F.map(X=>X.children?[{key:X.key,hasChild:!0},X.children.map(at=>({parentKey:X.key,key:at.key}))]:{key:X.key}).flat(1/0),j=O.filter(X=>!X.hasChild),H=X=>{let at;const rt=O.findIndex(ft=>ft.key===D?(at=ft.parentKey,!0):!1);if(at===X)return"current";const tt=O.findIndex(ft=>ft.key===X);if(tt!==-1){if(tt===rt)return"current";if(tt<rt)return"before"}return"after"};function G(X){B(X)}function K(X){if(typeof X=="function"){const at=X(j.findIndex(rt=>rt.key===D));B(j[at].key)}else B(j[X].key)}const it=j.findIndex(X=>X.key===D);reactExports$1.useEffect(()=>{if(V==="history"){let X="";F.some(at=>at.children&&at.children.length?at.children.some(rt=>d$1(rt.path,rt.exact)?(X=rt.key,!0):!1):d$1(at.path,at.exact)?(X=at.key,!0):!1),X&&B(X)}return()=>{}},[F,V]);const ot={steps:F,totalStepsCount:j.length,getStepStatus:H,setActiveStepByKey:G,setActiveStepByIndex:K,activeStep:it,canBackToStep:X=>V==="memory"&&it!==0&&X<it};return jsxRuntimeExports.jsx(w$3,{value:ot,children:C})}function T$1(){return reactExports$1.use(k$2)}P.propTypes={children:o.any.isRequired,steps:o.array.isRequired,mode:o.string};var lib,hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;var C=Object.prototype.hasOwnProperty,F=Object.prototype.toString;function V(D){if(D==null)return!0;if(typeof D=="boolean")return!1;if(typeof D=="number")return D===0;if(typeof D=="string"||typeof D=="function"||Array.isArray(D))return D.length===0;if(D instanceof Error)return D.message==="";if(D.toString==F)switch(D.toString()){case"[object File]":case"[object Map]":case"[object Set]":return D.size===0;case"[object Object]":{for(var B in D)if(C.call(D,B))return!1;return!0}}return!1}return lib=V,lib}var libExports=requireLib();const k$1=getDefaultExportFromCjs(libExports),S=""+new URL("blocklet-default-logo-Bspnu_ws.png",import.meta.url).href,t$1={en:{optional:"Optional",defaultNavSubTitle:"Launching"},zh:{optional:"可选",defaultNavSubTitle:"启动"}},a$1=C=>t$1[C]?t$1[C]:t$1.en,i=C=>C==="zh"?"启动":"Launching",g$2=C=>C?.title||C?.name||"";function T({blockletMeta:C={},subTitle:F="",logoUrl:V="",locale:D="",navLogo:B="",loading:O=!1}){const j=useMediaQuery(ot=>ot.breakpoints.down("md")),H=j?18:48,G=reactExports$1.useRef(null),[K,it]=reactExports$1.useState("");return reactExports$1.useEffect(()=>{G.current&&G.current.offsetHeight>34&&(K===""?it("middle"):K==="middle"&&it("small"))},[K]),jsxRuntimeExports.jsxs(R,{className:K==="small"?"center-mode":"",children:[j?jsxRuntimeExports.jsx("div",{className:"app-icon",children:B}):jsxRuntimeExports.jsxs("div",{className:"app-icon",children:[O&&jsxRuntimeExports.jsx(I,{blockletSize:H,isMobile:j}),!O&&jsxRuntimeExports.jsx(u$1,{blockletSize:H,logoUrl:V})]}),jsxRuntimeExports.jsxs("div",{className:"header-title",children:[j&&F&&jsxRuntimeExports.jsx("div",{className:"header-title-sub",children:F}),jsxRuntimeExports.jsxs("div",{className:"app-name-content",children:[!j&&jsxRuntimeExports.jsx("div",{className:"launching-context",children:F||i(D)}),jsxRuntimeExports.jsx("div",{className:`header-title-name ${K==="middle"||K==="small"?"middle-size":""}`,ref:G,children:jsxRuntimeExports.jsx(w$2,{logoUrl:V,isMobile:j,blockletMeta:C,blockletSize:H,loading:O})})]})]})]})}T.propTypes={blockletMeta:o.object,subTitle:o.any,logoUrl:o.string,locale:o.string,navLogo:o.any,loading:o.bool};function I({blockletSize:C,isMobile:F}){return F?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:C,height:C})}function u$1({logoUrl:C,blockletSize:F}){return jsxRuntimeExports.jsx(M$1,{width:F,height:F,src:C,alt:"blocklet icon",fallback:S,style:{verticalAlign:"text-bottom"}},`layout-app-icon-${C}`)}function w$2({isMobile:C,logoUrl:F,blockletMeta:V={},blockletSize:D,loading:B}){const O=g$2(V);return B?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):k$1(V)?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",animation:!1,width:100,height:16,alt:"icon",style:{marginTop:4}}):C?jsxRuntimeExports.jsxs(L$1,{children:[jsxRuntimeExports.jsx(u$1,{blockletSize:D,logoUrl:F}),jsxRuntimeExports.jsx("span",{className:"ellipsis-title",children:g$2(V)})]}):jsxRuntimeExports.jsx(E,{className:"app-link",target:"_blank",href:joinUrl(V?.registryUrl||"",`/blocklets/${V?.did}`),title:O,children:O})}const L$1=styled.div`
2
2
  .ellipsis-title {
3
3
  flex: 1;
4
4
  position: absolute;
@@ -1,4 +1,4 @@
1
- import{aj as ee,A as T,r as f,a as te,b as se,V as j,u as S,x as re,av as A,i as F,j as t,w as q,aw as oe,T as C,y as k,$,o as m,ax as ne,ay as ae,v as _,C as N,az as ie,H as W,X as M,aA as le,aB as ce,K as E,aC as ue,L as de,aD as pe,a9 as he,s as O,a6 as fe,a7 as me,aE as ge,a8 as xe}from"./index-Bm_l9nlM.js";import{u as L}from"./useLocalStorage-DCBNi-1B.js";import{C as be,c as ke,e as ye,_ as je,a as Se,d as we,s as ve,S as V,b as Pe,A as Ce}from"./item-nJ8ETSBU.js";import{e as D}from"./engine--07M59ne.js";import{g as U}from"./get-safe-url-Bl0GiKcG.js";import{P as z}from"./permission-CZwbIMwH.js";import{A as Re}from"./ArrowDropDown-DlYnYg9A.js";import{B as Le}from"./Breadcrumbs-8fBU6snO.js";import"./index-CeH8-AEj.js";import"./KeyboardArrowDown-DX0Brp6T.js";import"./ChevronLeft-B9gimbug.js";import"./ChevronRight-CxtWttnr.js";import"./Search-xi7mzsy1.js";import"./index-CS8lfW32.js";import"./blocklet-BiSktkqf.js";import"./Autocomplete-DBgFXR4S.js";import"./ListSubheader-DtB8aen3.js";import"./Verified-C7pIsLBr.js";import"./VerifiedUser-8jnzzhUp.js";import"./Add-CYJYCqae.js";import"./Launch-HRe6ja_q.js";import"./Done-vXmO1_nL.js";import"./DeleteOutline-BaG49xB4.js";import"./delete-confirm-BLFHS3Q1.js";import"./click-to-copy-CR2I9N_h.js";import"./MoreVert-C0TW35nI.js";import"./ButtonGroup-DdwOEbFl.js";import"./getValidReactChildren-BW9X0l3m.js";function Be(e){const r=ee(),c=T(),[s,o]=L(`sid:blocklet:purchase:${e}`),[l,u]=f.useState(!1),[d,a]=f.useState(null),p=()=>{const{pathname:n,searchParams:b}=new URL(window.location.href),g=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";b.get("sid")&&(o(""),c(n.replace(g,"/"),{replace:!0}))},i=!!(r.get("assetDid")&&s&&r.get("sid")===s);return te(se.BlockletEvents.purchaseChange,n=>{n.did===e&&(a(n.session),["declined","confirmed","error"].includes(n.session.status)&&(u(!0),setTimeout(p,2e3)))}),f.useEffect(()=>{d&&d.id!==s&&o(d.id)},[d]),{hasCompleted:l,hasPurchased:i,session:d,setSession:a,doRedirect:p}}function De(e){setTimeout(()=>{window.location.href=U(e,{allowDomains:null})},1e3)}function K({meta:e,onCancel:r,handlePaySuccess:c=De,storeUrl:s}){const{t:o}=j(),{info:l}=S(),[u,d]=f.useState("both"),[a,p]=f.useState(1),i=re(l),n=A(e,l,s),b=P=>{P!==u&&d(P)},g=()=>{u&&(p(2),u==="verify"&&(window.location.href=U(n)))},w=(P,B)=>{B!=="backdropClick"&&r()},x=()=>{c(n)},h=F.getDisplayName({meta:e});if(u==="purchase"&&a===2)return t.jsx(q,{open:!0,popup:!0,baseUrl:s,action:"acquire-asset",checkFn:oe.create({baseURL:k(s,"/store")}).get,onSuccess:x,onClose:r,checkTimeout:60*5e3,extraParams:{factory:e.nftFactory},webWalletUrl:i,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:o("store.purchase.auth.title",{name:h}),scan:o("store.purchase.auth.scan"),confirm:o("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx(C,{gutterBottom:!0,children:o("store.purchase.auth.success")}),t.jsxs(C,{variant:"subtitle2",children:[" ",o("store.purchase.autoLaunch",{name:h})]})]})}});const v=$;return t.jsx(v,{title:o("store.purchase.title",{name:h}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:w,children:t.jsx("div",{style:{marginBottom:16},children:t.jsx(be,{action:u,onNext:g,onSelect:b})})})}K.propTypes={...ke,storeUrl:m.string.isRequired,handlePaySuccess:m.func};function H({meta:e,buttonText:r,storeUrl:c,isResource:s=!1}){const{t:o}=j(),l=T(),{info:u}=S(),{api:d}=ne(),a=F.isFreeBlocklet(e)===!1,[p,i]=f.useState(!1),{hasPurchased:n}=Be(e.did),[b,g]=f.useState(!1),[w]=L("instant-blocklet-install",!1),[x,h]=f.useState(!1),v=f.useMemo(()=>p?o(a?"blocklet.status.purchasing":"blocklet.status.waiting"):"",[p,o,a]),P=f.useMemo(()=>s?o("blocklet.status.resource"):a?r.purchase:r.launch,[a,r,s]),B=y=>{y.preventDefault(),y.stopPropagation();try{if(i(!0),a){g(!0);return}if(w){h(!0);return}if(!a){const R=A(e,u,c);window.location.href=U(R)}}catch(R){W.error(M(R),{autoHideDuration:5e3}),console.error("Blocklet installed failed",R)}finally{i(!1)}},Y=()=>{i(!1),g(!1)},J=y=>{i(!1),h(!1),l(`/blocklets/${y.appDid}/components`)},Z=()=>{i(!1),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx(z,{permission:"mutate_blocklets",children:y=>t.jsx(ae,{title:s?o("launchBlocklet.error.resourceBlocklet"):"",children:t.jsx(_,{onClick:B,size:"small",sx:{cursor:s?"not-allowed":"pointer",overflow:"hidden"},disabled:!!(v||!y),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:v?t.jsxs(t.Fragment,{children:[t.jsx(N,{size:16,style:{marginRight:3}}),v]}):P},e.did)})})}),(n||b)&&t.jsx(K,{method:"launch",meta:e,mode:"both",onCancel:Y,storeUrl:c}),x&&t.jsx(q,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:d.get,checkTimeout:5*60*1e3,onSuccess:J,extraParams:{title:e.title,blockletMetaUrl:decodeURIComponent(ie(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:Z})]})}H.propTypes={isResource:m.bool,meta:m.object.isRequired,buttonText:m.shape({purchase:m.string.isRequired,launch:m.string.isRequired}).isRequired,storeUrl:m.string.isRequired};const Ee=(e,r,c)=>{const s=he(r);return k(c,`/blocklets/${e.did}/?server-url=${s}`)},I=({meta:e,attribute:r,value:c})=>e._formatted?e._formatted[r]:c,Ue=(e,r)=>{if(!e||!r)return"";try{return k(r,e)}catch(c){return console.warn("Failed to construct avatar URL:",c),""}};function G({blocklet:e,endpoint:r="",serverVersion:c=""}){const{t:s}=j(),o=S();let l=k(o.imgPrefix,"blocklet.png");const u=r;if(u.startsWith("http")&&e.logo)l=k(u,ue(e.did,e.logo,e.version));else{let n=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");n&&(n=`/${n}`),l=k(n,`/blocklet/logo/${e.did}`)}try{const i=new URL(l);i.searchParams.set("v",e.version||+new Date),l=i.href}catch{}const d=i=>i.currentTarget.contains(i.target)?!0:(i.preventDefault(),!1),a={meta:e,buttonText:{purchase:s("common.purchase"),launch:s("common.launch")},storeUrl:u},p=t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Se,{serverVersion:c,requirementVersion:e.requirements?.server,size:"small",children:t.jsx(H,{isResource:!(D.hasStartEngine(e)||D.isGatewayBlocklet(e)||D.isPackBlocklet(e)),...a})})});return t.jsx(de,{href:Ee(e,o.info,r),style:{color:"initial",textDecoration:"none"},onClick:d,target:"_blank",children:t.jsx(Ie,{title:I({meta:e,attribute:"title",value:e.title||e.name}),did:e.did,description:I({meta:e,attribute:"description",value:e.description}),cover:e.logo?l:"",version:e.version,onButtonClick:null,icons:e.docker?.image?[{key:"docker",icon:t.jsx(E,{sx:{display:"flex",color:"primary.main"},children:t.jsx(pe,{icon:we})}),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:p})})}G.propTypes={blocklet:m.object.isRequired,serverVersion:m.string,endpoint:m.string};function Q({storeUrl:e,handleSearchSelect:r=null,extraFilter:c=void 0,...s}){const{locale:o}=j(),l=S(),[u,d]=f.useState({}),a=n=>{d(n)},p=e,i=l?.info?.version;return f.useEffect(()=>{d({})},[p]),t.jsx(le,{FallbackComponent:ce,resetKeys:[p],children:t.jsx(E,{...s,sx:{"& .title-bar":{pt:0},".blocklet-list":{mt:0},"& h2":{display:"none"}},children:t.jsx(je,{layout:{showExplore:!1,showTitle:!0},blockletRender:n=>t.jsx(G,{...n,endpoint:p}),baseSearch:!0,endpoint:p,locale:o,onFilterChange:a,onSearchSelect:r,filters:u,extraFilter:c,serverVersion:i})})})}Q.propTypes={storeUrl:m.string.isRequired,handleSearchSelect:m.func,extraFilter:m.func};const Ie=O(ve)`
1
+ import{aj as ee,A as T,r as f,a as te,b as se,V as j,u as S,x as re,av as A,i as F,j as t,w as q,aw as oe,T as C,y as k,$,o as m,ax as ne,ay as ae,v as _,C as N,az as ie,H as W,X as M,aA as le,aB as ce,K as E,aC as ue,L as de,aD as pe,a9 as he,s as O,a6 as fe,a7 as me,aE as ge,a8 as xe}from"./index-C7oyIqA7.js";import{u as L}from"./useLocalStorage-BbZxR418.js";import{C as be,c as ke,e as ye,_ as je,a as Se,d as we,s as ve,S as V,b as Pe,A as Ce}from"./item-CmPv8jYK.js";import{e as D}from"./engine-Barzy6EW.js";import{g as U}from"./get-safe-url-B4jRm2fX.js";import{P as z}from"./permission-CYhKziEK.js";import{A as Re}from"./ArrowDropDown-CsPHtg1Z.js";import{B as Le}from"./Breadcrumbs-Dz5_xB6v.js";import"./index-BsoC_lrH.js";import"./KeyboardArrowDown-FDIQe8i9.js";import"./ChevronLeft-Cv7hEe9j.js";import"./ChevronRight-DDzebVAp.js";import"./Search-CL67DzD6.js";import"./index-CDZRZ08r.js";import"./blocklet-CTig8EZC.js";import"./Autocomplete-Bv76_KL0.js";import"./ListSubheader-CXMRJUdt.js";import"./Verified-BIjAmkBj.js";import"./VerifiedUser-C2Na71lh.js";import"./Add-D3nFvEMB.js";import"./Launch-Bbmt72w1.js";import"./Done-B4vyGIbD.js";import"./DeleteOutline-C_ptzk3q.js";import"./delete-confirm-3ByffieE.js";import"./click-to-copy-C0H_SWXD.js";import"./MoreVert-C8oKCpDc.js";import"./ButtonGroup-CXE45zw_.js";import"./getValidReactChildren-Ixtn2Lye.js";function Be(e){const r=ee(),c=T(),[s,o]=L(`sid:blocklet:purchase:${e}`),[l,u]=f.useState(!1),[d,a]=f.useState(null),p=()=>{const{pathname:n,searchParams:b}=new URL(window.location.href),g=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";b.get("sid")&&(o(""),c(n.replace(g,"/"),{replace:!0}))},i=!!(r.get("assetDid")&&s&&r.get("sid")===s);return te(se.BlockletEvents.purchaseChange,n=>{n.did===e&&(a(n.session),["declined","confirmed","error"].includes(n.session.status)&&(u(!0),setTimeout(p,2e3)))}),f.useEffect(()=>{d&&d.id!==s&&o(d.id)},[d]),{hasCompleted:l,hasPurchased:i,session:d,setSession:a,doRedirect:p}}function De(e){setTimeout(()=>{window.location.href=U(e,{allowDomains:null})},1e3)}function K({meta:e,onCancel:r,handlePaySuccess:c=De,storeUrl:s}){const{t:o}=j(),{info:l}=S(),[u,d]=f.useState("both"),[a,p]=f.useState(1),i=re(l),n=A(e,l,s),b=P=>{P!==u&&d(P)},g=()=>{u&&(p(2),u==="verify"&&(window.location.href=U(n)))},w=(P,B)=>{B!=="backdropClick"&&r()},x=()=>{c(n)},h=F.getDisplayName({meta:e});if(u==="purchase"&&a===2)return t.jsx(q,{open:!0,popup:!0,baseUrl:s,action:"acquire-asset",checkFn:oe.create({baseURL:k(s,"/store")}).get,onSuccess:x,onClose:r,checkTimeout:60*5e3,extraParams:{factory:e.nftFactory},webWalletUrl:i,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:o("store.purchase.auth.title",{name:h}),scan:o("store.purchase.auth.scan"),confirm:o("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx(C,{gutterBottom:!0,children:o("store.purchase.auth.success")}),t.jsxs(C,{variant:"subtitle2",children:[" ",o("store.purchase.autoLaunch",{name:h})]})]})}});const v=$;return t.jsx(v,{title:o("store.purchase.title",{name:h}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:w,children:t.jsx("div",{style:{marginBottom:16},children:t.jsx(be,{action:u,onNext:g,onSelect:b})})})}K.propTypes={...ke,storeUrl:m.string.isRequired,handlePaySuccess:m.func};function H({meta:e,buttonText:r,storeUrl:c,isResource:s=!1}){const{t:o}=j(),l=T(),{info:u}=S(),{api:d}=ne(),a=F.isFreeBlocklet(e)===!1,[p,i]=f.useState(!1),{hasPurchased:n}=Be(e.did),[b,g]=f.useState(!1),[w]=L("instant-blocklet-install",!1),[x,h]=f.useState(!1),v=f.useMemo(()=>p?o(a?"blocklet.status.purchasing":"blocklet.status.waiting"):"",[p,o,a]),P=f.useMemo(()=>s?o("blocklet.status.resource"):a?r.purchase:r.launch,[a,r,s]),B=y=>{y.preventDefault(),y.stopPropagation();try{if(i(!0),a){g(!0);return}if(w){h(!0);return}if(!a){const R=A(e,u,c);window.location.href=U(R)}}catch(R){W.error(M(R),{autoHideDuration:5e3}),console.error("Blocklet installed failed",R)}finally{i(!1)}},Y=()=>{i(!1),g(!1)},J=y=>{i(!1),h(!1),l(`/blocklets/${y.appDid}/components`)},Z=()=>{i(!1),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx(z,{permission:"mutate_blocklets",children:y=>t.jsx(ae,{title:s?o("launchBlocklet.error.resourceBlocklet"):"",children:t.jsx(_,{onClick:B,size:"small",sx:{cursor:s?"not-allowed":"pointer",overflow:"hidden"},disabled:!!(v||!y),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:v?t.jsxs(t.Fragment,{children:[t.jsx(N,{size:16,style:{marginRight:3}}),v]}):P},e.did)})})}),(n||b)&&t.jsx(K,{method:"launch",meta:e,mode:"both",onCancel:Y,storeUrl:c}),x&&t.jsx(q,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:d.get,checkTimeout:5*60*1e3,onSuccess:J,extraParams:{title:e.title,blockletMetaUrl:decodeURIComponent(ie(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:Z})]})}H.propTypes={isResource:m.bool,meta:m.object.isRequired,buttonText:m.shape({purchase:m.string.isRequired,launch:m.string.isRequired}).isRequired,storeUrl:m.string.isRequired};const Ee=(e,r,c)=>{const s=he(r);return k(c,`/blocklets/${e.did}/?server-url=${s}`)},I=({meta:e,attribute:r,value:c})=>e._formatted?e._formatted[r]:c,Ue=(e,r)=>{if(!e||!r)return"";try{return k(r,e)}catch(c){return console.warn("Failed to construct avatar URL:",c),""}};function G({blocklet:e,endpoint:r="",serverVersion:c=""}){const{t:s}=j(),o=S();let l=k(o.imgPrefix,"blocklet.png");const u=r;if(u.startsWith("http")&&e.logo)l=k(u,ue(e.did,e.logo,e.version));else{let n=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");n&&(n=`/${n}`),l=k(n,`/blocklet/logo/${e.did}`)}try{const i=new URL(l);i.searchParams.set("v",e.version||+new Date),l=i.href}catch{}const d=i=>i.currentTarget.contains(i.target)?!0:(i.preventDefault(),!1),a={meta:e,buttonText:{purchase:s("common.purchase"),launch:s("common.launch")},storeUrl:u},p=t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Se,{serverVersion:c,requirementVersion:e.requirements?.server,size:"small",children:t.jsx(H,{isResource:!(D.hasStartEngine(e)||D.isGatewayBlocklet(e)||D.isPackBlocklet(e)),...a})})});return t.jsx(de,{href:Ee(e,o.info,r),style:{color:"initial",textDecoration:"none"},onClick:d,target:"_blank",children:t.jsx(Ie,{title:I({meta:e,attribute:"title",value:e.title||e.name}),did:e.did,description:I({meta:e,attribute:"description",value:e.description}),cover:e.logo?l:"",version:e.version,onButtonClick:null,icons:e.docker?.image?[{key:"docker",icon:t.jsx(E,{sx:{display:"flex",color:"primary.main"},children:t.jsx(pe,{icon:we})}),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:p})})}G.propTypes={blocklet:m.object.isRequired,serverVersion:m.string,endpoint:m.string};function Q({storeUrl:e,handleSearchSelect:r=null,extraFilter:c=void 0,...s}){const{locale:o}=j(),l=S(),[u,d]=f.useState({}),a=n=>{d(n)},p=e,i=l?.info?.version;return f.useEffect(()=>{d({})},[p]),t.jsx(le,{FallbackComponent:ce,resetKeys:[p],children:t.jsx(E,{...s,sx:{"& .title-bar":{pt:0},".blocklet-list":{mt:0},"& h2":{display:"none"}},children:t.jsx(je,{layout:{showExplore:!1,showTitle:!0},blockletRender:n=>t.jsx(G,{...n,endpoint:p}),baseSearch:!0,endpoint:p,locale:o,onFilterChange:a,onSearchSelect:r,filters:u,extraFilter:c,serverVersion:i})})})}Q.propTypes={storeUrl:m.string.isRequired,handleSearchSelect:m.func,extraFilter:m.func};const Ie=O(ve)`
2
2
  .ms-highlight {
3
3
  color: ${e=>e.theme.palette.primary.main};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{cI as $m,bd as jL,h0 as oT,ba as Xm,bb as Zm,cV as qm,be as JL,r as QL}from"./index-Bm_l9nlM.js";/*! *****************************************************************************
1
+ import{cI as $m,bd as jL,g_ as oT,ba as Xm,bb as Zm,cV as qm,be as JL,r as QL}from"./index-C7oyIqA7.js";/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- import{A as g,bm as v,u as y,j as r,O as f,S as x,Q as h}from"./index-Bm_l9nlM.js";import{L as S,D as j}from"./download-DIDPIhA_.js";import{u as L}from"./useLocalStorage-DCBNi-1B.js";import"./ButtonGroup-DdwOEbFl.js";import"./getValidReactChildren-BW9X0l3m.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,bm as v,u as y,j as r,O as f,S as x,Q as h}from"./index-C7oyIqA7.js";import{L as S,D as j}from"./download-CJ21CP9q.js";import{u as L}from"./useLocalStorage-BbZxR418.js";import"./ButtonGroup-CXE45zw_.js";import"./getValidReactChildren-Ixtn2Lye.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 +1 @@
1
- import{c4 as a,r as f,cu as U,ba as W,bb as X,cV as v,fq as u,cv as m,fr as Z,fs as $,ft as I}from"./index-Bm_l9nlM.js";var ee=function(t){return t===document||t===document.documentElement||t===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):t.scrollTop},O=function(t){return t.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)},re=function(t){return t.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight)},oe=function(t,o){o===void 0&&(o={});var g=o.target,F=o.isNoMore,p=o.threshold,w=p===void 0?100:p,B=o.direction,P=B===void 0?"bottom":B,R=o.reloadDeps,V=R===void 0?[]:R,Y=o.manual,h=o.onBefore,_=o.onSuccess,M=o.onError,y=o.onFinally,q=a(f.useState(),2),c=q[0],E=q[1],D=a(f.useState(!1),2),b=D[0],i=D[1],T=P==="top",H=f.useRef(void 0),L=f.useRef(0),S=f.useMemo(function(){return F?F(c):!1},[c]),s=U(function(r){return W(void 0,void 0,void 0,function(){var e,n,l,d;return X(this,function(C){switch(C.label){case 0:return[4,t(r)];case 1:return e=C.sent(),E(r?v(v({},e),{list:T?u(u([],a(e.list),!1),a((l=r.list)!==null&&l!==void 0?l:[]),!1):u(u([],a((d=r.list)!==null&&d!==void 0?d:[]),!1),a(e.list),!1)}):v(v({},e),{list:u([],a((n=e.list)!==null&&n!==void 0?n:[]),!1)})),[2,e]}})})},{manual:Y,onFinally:function(r,e,n){i(!1),y?.(e,n)},onBefore:function(){return h?.()},onSuccess:function(r){setTimeout(function(){if(T){var e=I(g);if(e=e===document?document.documentElement:e,e){var n=O(e);e.scrollTo(0,n-L.current)}}else z()}),_?.(r)},onError:function(r){return M?.(r)}}),N=s.loading,k=s.error,A=s.run,j=s.runAsync,G=s.cancel,x=m(function(){S||(i(!0),A(c))}),J=m(function(){return S?Promise.reject():(i(!0),j(c))}),K=function(){return i(!1),A()},Q=function(){return i(!1),j()},z=function(){var r=I(g);if(r){var e=r===document?document.documentElement:r,n=ee(e),l=O(e),d=re(e);T?(H.current!==void 0&&H.current>n&&n<=w&&x(),H.current=n,L.current=l-n):l-n<=d+w&&x()}};return Z("scroll",function(){N||b||z()},{target:g}),$(function(){A()},u([],a(V),!1)),{data:c,loading:!b&&N,error:k,loadingMore:b,noMore:S,loadMore:x,loadMoreAsync:J,reload:m(K),reloadAsync:m(Q),mutate:E,cancel:G}};export{oe as u};
1
+ import{c4 as a,r as f,cu as U,ba as W,bb as X,cV as v,fq as u,cv as m,fr as Z,fs as $,ft as I}from"./index-C7oyIqA7.js";var ee=function(t){return t===document||t===document.documentElement||t===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):t.scrollTop},O=function(t){return t.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)},re=function(t){return t.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight)},oe=function(t,o){o===void 0&&(o={});var g=o.target,F=o.isNoMore,p=o.threshold,w=p===void 0?100:p,B=o.direction,P=B===void 0?"bottom":B,R=o.reloadDeps,V=R===void 0?[]:R,Y=o.manual,h=o.onBefore,_=o.onSuccess,M=o.onError,y=o.onFinally,q=a(f.useState(),2),c=q[0],E=q[1],D=a(f.useState(!1),2),b=D[0],i=D[1],T=P==="top",H=f.useRef(void 0),L=f.useRef(0),S=f.useMemo(function(){return F?F(c):!1},[c]),s=U(function(r){return W(void 0,void 0,void 0,function(){var e,n,l,d;return X(this,function(C){switch(C.label){case 0:return[4,t(r)];case 1:return e=C.sent(),E(r?v(v({},e),{list:T?u(u([],a(e.list),!1),a((l=r.list)!==null&&l!==void 0?l:[]),!1):u(u([],a((d=r.list)!==null&&d!==void 0?d:[]),!1),a(e.list),!1)}):v(v({},e),{list:u([],a((n=e.list)!==null&&n!==void 0?n:[]),!1)})),[2,e]}})})},{manual:Y,onFinally:function(r,e,n){i(!1),y?.(e,n)},onBefore:function(){return h?.()},onSuccess:function(r){setTimeout(function(){if(T){var e=I(g);if(e=e===document?document.documentElement:e,e){var n=O(e);e.scrollTo(0,n-L.current)}}else z()}),_?.(r)},onError:function(r){return M?.(r)}}),N=s.loading,k=s.error,A=s.run,j=s.runAsync,G=s.cancel,x=m(function(){S||(i(!0),A(c))}),J=m(function(){return S?Promise.reject():(i(!0),j(c))}),K=function(){return i(!1),A()},Q=function(){return i(!1),j()},z=function(){var r=I(g);if(r){var e=r===document?document.documentElement:r,n=ee(e),l=O(e),d=re(e);T?(H.current!==void 0&&H.current>n&&n<=w&&x(),H.current=n,L.current=l-n):l-n<=d+w&&x()}};return Z("scroll",function(){N||b||z()},{target:g}),$(function(){A()},u([],a(V),!1)),{data:c,loading:!b&&N,error:k,loadingMore:b,noMore:S,loadMore:x,loadMoreAsync:J,reload:m(K),reloadAsync:m(Q),mutate:E,cancel:G}};export{oe as u};
@@ -1,4 +1,4 @@
1
- import{aF as Ge,j as e,bn as gt,r as g,bC as Q,bf as H,H as q,aH as D,g as xt,o as d,h as ee,at as bt,ay as jt,K as C,T as U,V as X,eO as Fe,O as Pe,im as Ye,bj as Te,aU as Ie,R as Ee,dI as Ne,b3 as qe,b1 as Ae,C as Qe,f as Xe,f0 as Je,aP as De,W as yt,as as Ze,io as et,v as Oe,f2 as tt,bq as je,fI as st,dC as St,s as ie,af as pe,G as Ue,au as vt,ip as Ct,iq as Nt,$ as nt,ir as wt,is as Rt,it as Tt,iu as It,N as Et,bx as it,E as At,J as Dt,P as Ot,S as Lt,Q as $e,iv as kt,a3 as Ft}from"./index-Bm_l9nlM.js";import{d as Pt,H as at,g as _t}from"./index-CaaGoS1U.js";import{R as _e,S as Bt}from"./actions-CSHVjH1K.js";import{B as zt}from"./index-BD0Uv4Gl.js";import{S as me}from"./shorten-label-Df52qlAD.js";import{v as ot}from"./index-Coaf_Q-u.js";import{T as Wt}from"./html-title-6LqX2w8M.js";import{R as Mt}from"./Refresh-DPUEH7GP.js";import{D as Kt,g as Ht}from"./traffic-CfQ0107D.js";import{u as qt}from"./use-mobile-DejvdfF-.js";import"./FilterList-DJIxPwJl.js";import"./CSSTransition-D4EEAtrd.js";import"./emotion-cache.browser.esm-Boqprxmw.js";import"./index-Dv_YqGF9.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BHwu6MhF.js";import"./index-CS8lfW32.js";import"./TableSearch-h0N_WiXK.js";import"./Search-xi7mzsy1.js";import"./Clear-CxuHkeB_.js";import"./MoreVert-C0TW35nI.js";import"./useLocalStorage-DCBNi-1B.js";import"./url-evaluation-Cgv5jFUd.js";import"./get-safe-url-Bl0GiKcG.js";import"./ButtonGroup-DdwOEbFl.js";import"./getValidReactChildren-BW9X0l3m.js";import"./permission-CZwbIMwH.js";import"./index.esm-Bs3p187N.js";import"./collapse-gFG2GWAJ.js";import"./blocklet-BiSktkqf.js";import"./Switch-3lSFjk1I.js";import"./iframe-DiiXxW_e.js";import"./ChevronLeft-B9gimbug.js";import"./ChevronRight-CxtWttnr.js";import"./index-DBii9-f-.js";import"./base-chart-DmnJjW6a.js";import"./index-Sz-ky4ND.js";import"./AdapterDayjs-Bf5-20Hs.js";import"./useThemeProps-DeAc5QgN.js";import"./visuallyHidden-Dan1xhjv.js";const Ut=Ge(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 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"})),$t=Ge(e.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"})),rt=g.createContext({}),{Provider:Vt,Consumer:on}=rt;function Gt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=gt(),[l,x]=g.useState([]),[f,y]=g.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Q(()=>s.meta?.did,[s]),[b,S]=g.useState([]),[B,_]=g.useState({}),R=Q(()=>l.length?new Set(l.map(m=>m.id)):new Set,[l]),$=async({page:m=1,pageSize:N=20,...O}={})=>{if(!h)return[];try{const A={paging:{page:m,pageSize:N},...O,teamDid:h,dateRange:O.dateRange?[H(O.dateRange[0]).toISOString(),H(O.dateRange[1]).toISOString()]:void 0},{dids:w,...L}=A;let P="";w&&w.includes("system")&&(P="system");const ae=w?w.filter(oe=>oe!=="system"):[],se={...L,source:P,componentDids:ae},Z=await n.getNotificationSendLog({input:se});return _(se),x(Z.list),y(Z.paging),Z.list}catch(A){return q.error(A.message),[]}},M=async()=>{const m=await n.getNotificationComponents({input:{teamDid:h}});S(m.componentDids)},k=g.useCallback(m=>{const N=s.children.find(O=>O.meta?.did===m);if(N)return N.ancestors=[s],N},[s]),F=async({notificationId:m,receivers:N,channels:O,...A})=>{await n.resendNotification({input:{teamDid:h,notificationId:m,receivers:N,channels:O.map(w=>w==="wallet"?D.NOTIFICATION_SEND_CHANNEL.WALLET:w==="pushKit"?D.NOTIFICATION_SEND_CHANNEL.PUSH:w),...A}})},V=g.useCallback(async m=>(await n.getUser({input:{teamDid:h,user:{did:m},options:{enableConnectedAccount:!0}}})).user,[n,h]),G=g.useCallback(async({page:m=1,pageSize:N=20,...O}={})=>{try{const A={paging:{page:m,pageSize:N},...O,userName:O.searchText||"",teamDid:h,dateRange:O.dateRange?[H(O.dateRange[0]).toISOString(),H(O.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:A})}catch(A){throw q.error(A.message),A}},[n,h]);g.useEffect(()=>{h&&M()},[h]),o(D.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,m=>{R.has(m.notificationId)&&$(B)},[R,B]),o(D.EVENTS.NOTIFICATION_BLOCKLET_CREATE,m=>{R.has(m.id)||$(B)},[R,B]);const J={fetch:$,data:l,paging:f,blocklet:s,getComponent:k,resendNotification:F,getUser:V,componentDids:b,getReceivers:G,inService:r,teamDid:h};return e.jsx(Vt,{value:{notificationRecords:J},children:t})}function Be(){const{notificationRecords:t}=g.useContext(rt);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Yt={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(xt,{type:Yt[t],children:t})}const Qt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case D.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case D.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case D.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case D.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function lt(t,s,n={}){const{status:r,updatedAt:o,reason:l="",channel:x="wallet"}=n,f=o?t("notification.sendStatus.sentTime",{date:bt(o,s)}):"",y=Qt(t,x,l);return r===D.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:r===D.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ve=["info","success","error","warning"],ct=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},dt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Xt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:ct(t),enabled:n}},Jt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:dt(t),enabled:n}},Zt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),es=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ts=(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=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},ss=(t,s="")=>{if(s&&ke.includes(s)){const l=`${s}SendRecord`,x=ee(t,l,[]);return be(x)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return be(l)}const o={};return ke.forEach(l=>{const x=`${l}SendRecord`,f=ee(t,x,[]),y=be(f);o[l]=y}),r.length>0&&r.forEach(l=>{const x=n[l]??[],f=be(x);o[l]=f}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Se=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ns=t=>{switch(t){case D.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case D.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case D.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case D.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ut=()=>({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 te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:o,title:l="",sentTime:x="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(U,{color:"inherit",sx:{fontSize:12},children:y}),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,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(C,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[o]}}),e.jsx(C,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[o]}})]}),e.jsx(U,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ve.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function ve({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:o}=X();return e.jsxs(C,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(U,{children:[s,": "]}),t.map(l=>{const x=lt(r,o,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(C,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:x,enableTooltip:!1,children:x.title})}),onDelete:f=>n(f,l)},l)})]})}ze.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 ze({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:l,renderLabel:x}){return e.jsxs(Pe,{className:"filter-container",children:[e.jsx(Ye,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:o.map(f=>e.jsx(Ie,{control:e.jsx(Ee,{checked:t[n].indexOf(f.value??f)>-1,onChange:y=>{const h=[...t];y.target.checked?h[n]=[...h[n],f.value??f]:h[n]=h[n].filter(b=>b!==(f.value??f)),s(h[n],n,r)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(f)})},f.value??f))})]})}function Re(t){return e.jsx(ze,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:l,locale:x}=X(),f=lt(l,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(Ne,{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:l("notification.resend")})]})}We.propTypes={value:d.array.isRequired,onChange:d.func};function We({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[o,l]=g.useState(null),x=g.useCallback(h=>{l(o?null:h.currentTarget)},[o]),f=!!o,y=g.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(U,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ne,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[qe(t[0],n)," - ",qe(t[1],n)]})}),e.jsx(Ae,{open:f,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Kt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Ht(r),onChange:y})})]})}Me.propTypes={itemComponent:d.elementType.isRequired};function Me({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(C,{sx:{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(Pt.TableFilterList,{...s,ItemComponent:t})})]})}function Ke({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Fe,{label:t,variant:"outlined",...o&&l?{onDelete:o}:{}})}Ke.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};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}];pt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function pt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[o,l]=g.useState(is),[x,f]=g.useState(!0),y=(b,S)=>{S.checked=b.target.checked;const B=o.map(_=>({..._,checked:_.value===S.value?S.checked:_.checked}));l(B)},h=b=>{b.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(U,{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(Ye,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(b=>e.jsx(Ie,{control:e.jsx(Ee,{checked:b.checked,onChange:S=>y(S,b),name:b.value}),label:b.label},b.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(Ee,{checked:x,onChange:b=>f(b.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ne,{onClick:b=>{b.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ne,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Qe,{size:16}),r("common.confirm")]})]})]})}ft.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ft({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=X(),l=Xe(),x=g.useMemo(()=>Je(l,ut()),[l]),{getReceivers:f,inService:y,teamDid:h,getUser:b,blocklet:S}=Be(),[B,_]=g.useState(!1),[R,$]=g.useState([]),M=De({anchorEl:null,position:null}),k=De({anchorEl:null,position:null}),[F,V]=g.useState(null),[G,J]=g.useState({total:0,pageSize:10,pageCount:0,page:1}),[m,N]=g.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[O,A]=g.useState([]),w=[{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"}],L=async()=>{if(!B&&t)try{_(!0);const i=await f({notificationId:t,...m}),a=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:st(c.receiverUser.avatar,h,y)}}));$(a),J(i.paging),_(!1)}catch(i){q.error(i.message),_(!1)}};g.useEffect(()=>{L()},[m]);const P=i=>{i.stopPropagation();const a=i.currentTarget;k.anchorEl=a;const c=a.getBoundingClientRect();k.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ae=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Oe,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(_e,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:P,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:G.page-1,rowsPerPage:G.pageSize,count:G.total,searchText:m.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:O,onRowSelectionChange:(i,a)=>{A(a.map(c=>c.dataIndex))},customToolbarSelect:ae},Z=({page:i,rowsPerPage:a,searchText:c,filterList:v})=>{const[,z=[],Y=[],K=[]]=v;m.pageSize!==a?N(W=>({...W,pageSize:a,page:1})):m.page!==i+1?N(W=>({...W,page:i+1})):m.searchText!==c?N(W=>({...W,searchText:c,page:1})):pe(z,m.walletSendStatus)?pe(Y,m.pushKitSendStatus)?pe(K,m.emailSendStatus)||N(W=>({...W,emailSendStatus:K,page:1})):N(W=>({...W,pushKitSendStatus:Y,page:1})):N(W=>({...W,walletSendStatus:z,page:1}))},oe=g.useCallback(async(i,a)=>{if(!a)return!1;const c=await b(a);return c?i==="wallet"?Zt(c):i==="email"?Xt(S,c):i==="pushKit"?Jt(S,c):i==="webhook"?es(c):!0:!1},[b,S]),we=g.useCallback(i=>ts(r,i),[r]),ne=()=>{M.anchorEl=null,M.position=null,V(null)},re=()=>{k.anchorEl=null,k.position=null},ge=async(i,a,c=!0,v="")=>{if(!(!a.length||!i.length))try{s(i,a,c,v),k.anchorEl||(await xe(.5),ne())}catch(z){console.error("handleResend error",{error:z})}},p=async({channels:i,isResendFailedOnly:a})=>{const c=O.map(v=>R[v].receiver);await ge(i,c,a),await xe(.5),re(),A([])},u=async(i,a=[],c=!0)=>{try{await ge(["webhook"],[i.receiver],c,a)}catch(v){q.error(v.response?v.response.statusText:v.message)}},j=async(i,a,c,v=[],z=!0)=>{if(i.stopPropagation(),ss(a,c)>=4){q.warning(r("notification.resendLimit"));return}if(!ke.includes(c)){await u(a,v,z);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}V({channel:c});try{const K=await oe(c,a.receiver);await xe(1),V({channel:c,result:K}),(typeof K=="boolean"&&K||St(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[a.receiver],z),k.anchorEl||(await xe(.5),ne()))}catch(K){q.error(K.message)}},I=i=>{N(a=>({...a,dateRange:i,page:1}))},E=(i,a,c,v)=>{i.stopPropagation();const z=c.filter(Y=>Y!==a);N(Y=>({...Y,[v]:z,page:1}))},T=Q(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:a,receiver:c}=R[i];return a?e.jsxs(C,{"data-cy":`member-name-${a.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Ze,{src:`${a.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:a.fullName})]},c):e.jsx(yt,{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:m.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(ve,{list:i,label:"Wallet",onDelete:(a,c)=>{a.stopPropagation(),E(a,c,T[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:w,fullWidth:!0,logic:Se,display:(i,a,c,v)=>e.jsx(Re,{label:"Wallet",filterList:i,onChange:a,index:c,column:v,filterValues:w})},customBodyRenderLite:i=>{const{walletSendStatus:a,walletSendAt:c,walletSendFailedReason:v}=R[i];return e.jsx(ce,{status:a,updatedAt:c,reason:v,channel:"wallet",onResend:z=>j(z,R[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:a,pushKitSendAt:c,pushKitSendFailedReason:v}=R[i];return e.jsx(ce,{status:a,updatedAt:c,reason:v,channel:"pushkit",onResend:z=>j(z,R[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:m.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(ve,{list:i,label:"Push Kit",onDelete:(a,c)=>{a.stopPropagation(),E(a,c,T[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:w,fullWidth:!0,logic:Se,display:(i,a,c,v)=>e.jsx(Re,{label:"Push Kit",filterList:i,onChange:a,index:c,column:v,filterValues:w})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:a,emailSendAt:c,emailSendFailedReason:v}=R[i];return e.jsx(ce,{status:a,updatedAt:c,reason:v,channel:"email",onResend:z=>j(z,R[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:m.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(ve,{list:i,label:"Email",onDelete:(a,c)=>{a.stopPropagation(),E(a,c,T[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:w,fullWidth:!0,logic:Se,display:(i,a,c,v)=>e.jsx(Re,{label:"Email",filterList:i,onChange:a,index:c,column:v,filterValues:w})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:a}=R[i];if(!a)return null;const c=Object.entries(a)[0];if(!c)return null;const[v,z]=c,Y=z[0];return e.jsx(C,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(C,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:v},v),e.jsx(ce,{status:Y.status,updatedAt:Y.sendAt,reason:Y.failedReason,channel:"webhook",onResend:K=>j(K,R[i],"webhook",[v],!1)})]},v)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:a}=R[i];return e.jsx(et,{value:a,locale:o,shouldUpdate:!0})}}}],[R,o,m,r]),le=[e.jsx(We,{value:m.dateRange,onChange:I},"date-picker"),e.jsx(Oe,{variant:"contained",size:"small",color:"primary",loading:B,startIcon:e.jsx(Mt,{}),onClick:()=>L(),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(os,{children:e.jsxs(tt,{theme:x,children:[e.jsx(at,{className:"receivers-table",locale:o,loading:B,columns:T,data:R,onChange:Z,options:se,customButtons:le,components:{TableFilterList:i=>e.jsx(Me,{...i,itemComponent:a=>e.jsx(Ke,{...a,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ae,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:ne,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rs,{children:[e.jsxs(U,{variant:"body1",component:"div",className:"check-title",children:[F?.channel," Checking"]}),e.jsx(C,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(F?.channel).map(i=>{const{type:a,pass:c,fail:v}=i;return!F?.result||F?.result?.[a]?e.jsxs(U,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:F?.result?.[a]?je.success.main:"inherit"},children:[F?.result?e.jsx($t,{}):e.jsx(Qe,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},a):e.jsxs(U,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:je.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:v})]},a)})})]})}),k.anchorEl&&e.jsx(Ae,{open:!!k.anchorEl,anchorReference:"anchorPosition",anchorPosition:k.position,onClose:re,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(pt,{loading:n,onCancel:re,onConfirm:p})})]})})})}const as=g.memo(ft),os=ie.div`
1
+ import{aF as Ge,j as e,bn as gt,r as g,bC as Q,bf as H,H as q,aH as D,g as xt,o as d,h as ee,at as bt,ay as jt,K as C,T as U,V as X,eO as Fe,O as Pe,ik as Ye,bj as Te,aU as Ie,R as Ee,dI as Ne,b3 as qe,b1 as Ae,C as Qe,f as Xe,f0 as Je,aP as De,W as yt,as as Ze,il as et,v as Oe,f2 as tt,bq as je,fI as st,dC as St,s as ie,af as pe,G as Ue,au as vt,im as Ct,io as Nt,$ as nt,ip as wt,iq as Rt,ir as Tt,is as It,N as Et,bx as it,E as At,J as Dt,P as Ot,S as Lt,Q as $e,it as kt,a3 as Ft}from"./index-C7oyIqA7.js";import{d as Pt,H as at,g as _t}from"./index-DZnln7_d.js";import{R as _e,S as Bt}from"./actions-CERYEoLy.js";import{B as zt}from"./index-BQDGNXlA.js";import{S as me}from"./shorten-label-F3aTTiYl.js";import{v as ot}from"./index-DUoosowu.js";import{T as Wt}from"./html-title-7s4LlRfZ.js";import{R as Mt}from"./Refresh-jF1ntmdY.js";import{D as Kt,g as Ht}from"./traffic-NitwIn36.js";import{u as qt}from"./use-mobile-Ct3mh22I.js";import"./FilterList-NTvfDQQ0.js";import"./CSSTransition-DETThFuD.js";import"./emotion-cache.browser.esm-R7OUqHQ7.js";import"./index-DSXieMH9.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DQ8f_obf.js";import"./index-CDZRZ08r.js";import"./TableSearch-DLP010Te.js";import"./Search-CL67DzD6.js";import"./Clear-BKH2DPdA.js";import"./MoreVert-C8oKCpDc.js";import"./useLocalStorage-BbZxR418.js";import"./url-evaluation-DNKcusJ-.js";import"./get-safe-url-B4jRm2fX.js";import"./ButtonGroup-CXE45zw_.js";import"./getValidReactChildren-Ixtn2Lye.js";import"./permission-CYhKziEK.js";import"./index.esm-CoXuWxwd.js";import"./collapse-CG1JFMDb.js";import"./blocklet-CTig8EZC.js";import"./Switch-Dtn3RWR5.js";import"./iframe-Lor2b2kR.js";import"./ChevronLeft-Cv7hEe9j.js";import"./ChevronRight-DDzebVAp.js";import"./index-DBii9-f-.js";import"./base-chart-aUdxIyGY.js";import"./index-BqKmOEO2.js";import"./AdapterDayjs-CYQj26XH.js";import"./useThemeProps-D6aOJl-G.js";import"./visuallyHidden-Dan1xhjv.js";const Ut=Ge(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 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"})),$t=Ge(e.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"})),rt=g.createContext({}),{Provider:Vt,Consumer:on}=rt;function Gt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=gt(),[l,x]=g.useState([]),[f,y]=g.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Q(()=>s.meta?.did,[s]),[b,S]=g.useState([]),[B,_]=g.useState({}),R=Q(()=>l.length?new Set(l.map(m=>m.id)):new Set,[l]),$=async({page:m=1,pageSize:N=20,...O}={})=>{if(!h)return[];try{const A={paging:{page:m,pageSize:N},...O,teamDid:h,dateRange:O.dateRange?[H(O.dateRange[0]).toISOString(),H(O.dateRange[1]).toISOString()]:void 0},{dids:w,...L}=A;let P="";w&&w.includes("system")&&(P="system");const ae=w?w.filter(oe=>oe!=="system"):[],se={...L,source:P,componentDids:ae},Z=await n.getNotificationSendLog({input:se});return _(se),x(Z.list),y(Z.paging),Z.list}catch(A){return q.error(A.message),[]}},M=async()=>{const m=await n.getNotificationComponents({input:{teamDid:h}});S(m.componentDids)},k=g.useCallback(m=>{const N=s.children.find(O=>O.meta?.did===m);if(N)return N.ancestors=[s],N},[s]),F=async({notificationId:m,receivers:N,channels:O,...A})=>{await n.resendNotification({input:{teamDid:h,notificationId:m,receivers:N,channels:O.map(w=>w==="wallet"?D.NOTIFICATION_SEND_CHANNEL.WALLET:w==="pushKit"?D.NOTIFICATION_SEND_CHANNEL.PUSH:w),...A}})},V=g.useCallback(async m=>(await n.getUser({input:{teamDid:h,user:{did:m},options:{enableConnectedAccount:!0}}})).user,[n,h]),G=g.useCallback(async({page:m=1,pageSize:N=20,...O}={})=>{try{const A={paging:{page:m,pageSize:N},...O,userName:O.searchText||"",teamDid:h,dateRange:O.dateRange?[H(O.dateRange[0]).toISOString(),H(O.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:A})}catch(A){throw q.error(A.message),A}},[n,h]);g.useEffect(()=>{h&&M()},[h]),o(D.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,m=>{R.has(m.notificationId)&&$(B)},[R,B]),o(D.EVENTS.NOTIFICATION_BLOCKLET_CREATE,m=>{R.has(m.id)||$(B)},[R,B]);const J={fetch:$,data:l,paging:f,blocklet:s,getComponent:k,resendNotification:F,getUser:V,componentDids:b,getReceivers:G,inService:r,teamDid:h};return e.jsx(Vt,{value:{notificationRecords:J},children:t})}function Be(){const{notificationRecords:t}=g.useContext(rt);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Yt={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(xt,{type:Yt[t],children:t})}const Qt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case D.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case D.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case D.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case D.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function lt(t,s,n={}){const{status:r,updatedAt:o,reason:l="",channel:x="wallet"}=n,f=o?t("notification.sendStatus.sentTime",{date:bt(o,s)}):"",y=Qt(t,x,l);return r===D.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:r===D.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ve=["info","success","error","warning"],ct=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},dt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Xt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:ct(t),enabled:n}},Jt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:dt(t),enabled:n}},Zt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),es=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ts=(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=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},ss=(t,s="")=>{if(s&&ke.includes(s)){const l=`${s}SendRecord`,x=ee(t,l,[]);return be(x)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return be(l)}const o={};return ke.forEach(l=>{const x=`${l}SendRecord`,f=ee(t,x,[]),y=be(f);o[l]=y}),r.length>0&&r.forEach(l=>{const x=n[l]??[],f=be(x);o[l]=f}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Se=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ns=t=>{switch(t){case D.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case D.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case D.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case D.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ut=()=>({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 te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:o,title:l="",sentTime:x="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(U,{color:"inherit",sx:{fontSize:12},children:y}),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,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(C,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[o]}}),e.jsx(C,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[o]}})]}),e.jsx(U,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ve.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function ve({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:o}=X();return e.jsxs(C,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(U,{children:[s,": "]}),t.map(l=>{const x=lt(r,o,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(C,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:x,enableTooltip:!1,children:x.title})}),onDelete:f=>n(f,l)},l)})]})}ze.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 ze({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:l,renderLabel:x}){return e.jsxs(Pe,{className:"filter-container",children:[e.jsx(Ye,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:o.map(f=>e.jsx(Ie,{control:e.jsx(Ee,{checked:t[n].indexOf(f.value??f)>-1,onChange:y=>{const h=[...t];y.target.checked?h[n]=[...h[n],f.value??f]:h[n]=h[n].filter(b=>b!==(f.value??f)),s(h[n],n,r)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(f)})},f.value??f))})]})}function Re(t){return e.jsx(ze,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:l,locale:x}=X(),f=lt(l,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(Ne,{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:l("notification.resend")})]})}We.propTypes={value:d.array.isRequired,onChange:d.func};function We({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[o,l]=g.useState(null),x=g.useCallback(h=>{l(o?null:h.currentTarget)},[o]),f=!!o,y=g.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(U,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ne,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[qe(t[0],n)," - ",qe(t[1],n)]})}),e.jsx(Ae,{open:f,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Kt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Ht(r),onChange:y})})]})}Me.propTypes={itemComponent:d.elementType.isRequired};function Me({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(C,{sx:{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(Pt.TableFilterList,{...s,ItemComponent:t})})]})}function Ke({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Fe,{label:t,variant:"outlined",...o&&l?{onDelete:o}:{}})}Ke.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};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}];pt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function pt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[o,l]=g.useState(is),[x,f]=g.useState(!0),y=(b,S)=>{S.checked=b.target.checked;const B=o.map(_=>({..._,checked:_.value===S.value?S.checked:_.checked}));l(B)},h=b=>{b.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(U,{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(Ye,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(b=>e.jsx(Ie,{control:e.jsx(Ee,{checked:b.checked,onChange:S=>y(S,b),name:b.value}),label:b.label},b.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(Ee,{checked:x,onChange:b=>f(b.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ne,{onClick:b=>{b.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ne,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Qe,{size:16}),r("common.confirm")]})]})]})}ft.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ft({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=X(),l=Xe(),x=g.useMemo(()=>Je(l,ut()),[l]),{getReceivers:f,inService:y,teamDid:h,getUser:b,blocklet:S}=Be(),[B,_]=g.useState(!1),[R,$]=g.useState([]),M=De({anchorEl:null,position:null}),k=De({anchorEl:null,position:null}),[F,V]=g.useState(null),[G,J]=g.useState({total:0,pageSize:10,pageCount:0,page:1}),[m,N]=g.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[O,A]=g.useState([]),w=[{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"}],L=async()=>{if(!B&&t)try{_(!0);const i=await f({notificationId:t,...m}),a=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:st(c.receiverUser.avatar,h,y)}}));$(a),J(i.paging),_(!1)}catch(i){q.error(i.message),_(!1)}};g.useEffect(()=>{L()},[m]);const P=i=>{i.stopPropagation();const a=i.currentTarget;k.anchorEl=a;const c=a.getBoundingClientRect();k.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ae=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Oe,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(_e,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:P,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:G.page-1,rowsPerPage:G.pageSize,count:G.total,searchText:m.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:O,onRowSelectionChange:(i,a)=>{A(a.map(c=>c.dataIndex))},customToolbarSelect:ae},Z=({page:i,rowsPerPage:a,searchText:c,filterList:v})=>{const[,z=[],Y=[],K=[]]=v;m.pageSize!==a?N(W=>({...W,pageSize:a,page:1})):m.page!==i+1?N(W=>({...W,page:i+1})):m.searchText!==c?N(W=>({...W,searchText:c,page:1})):pe(z,m.walletSendStatus)?pe(Y,m.pushKitSendStatus)?pe(K,m.emailSendStatus)||N(W=>({...W,emailSendStatus:K,page:1})):N(W=>({...W,pushKitSendStatus:Y,page:1})):N(W=>({...W,walletSendStatus:z,page:1}))},oe=g.useCallback(async(i,a)=>{if(!a)return!1;const c=await b(a);return c?i==="wallet"?Zt(c):i==="email"?Xt(S,c):i==="pushKit"?Jt(S,c):i==="webhook"?es(c):!0:!1},[b,S]),we=g.useCallback(i=>ts(r,i),[r]),ne=()=>{M.anchorEl=null,M.position=null,V(null)},re=()=>{k.anchorEl=null,k.position=null},ge=async(i,a,c=!0,v="")=>{if(!(!a.length||!i.length))try{s(i,a,c,v),k.anchorEl||(await xe(.5),ne())}catch(z){console.error("handleResend error",{error:z})}},p=async({channels:i,isResendFailedOnly:a})=>{const c=O.map(v=>R[v].receiver);await ge(i,c,a),await xe(.5),re(),A([])},u=async(i,a=[],c=!0)=>{try{await ge(["webhook"],[i.receiver],c,a)}catch(v){q.error(v.response?v.response.statusText:v.message)}},j=async(i,a,c,v=[],z=!0)=>{if(i.stopPropagation(),ss(a,c)>=4){q.warning(r("notification.resendLimit"));return}if(!ke.includes(c)){await u(a,v,z);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}V({channel:c});try{const K=await oe(c,a.receiver);await xe(1),V({channel:c,result:K}),(typeof K=="boolean"&&K||St(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[a.receiver],z),k.anchorEl||(await xe(.5),ne()))}catch(K){q.error(K.message)}},I=i=>{N(a=>({...a,dateRange:i,page:1}))},E=(i,a,c,v)=>{i.stopPropagation();const z=c.filter(Y=>Y!==a);N(Y=>({...Y,[v]:z,page:1}))},T=Q(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:a,receiver:c}=R[i];return a?e.jsxs(C,{"data-cy":`member-name-${a.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Ze,{src:`${a.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:a.fullName})]},c):e.jsx(yt,{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:m.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(ve,{list:i,label:"Wallet",onDelete:(a,c)=>{a.stopPropagation(),E(a,c,T[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:w,fullWidth:!0,logic:Se,display:(i,a,c,v)=>e.jsx(Re,{label:"Wallet",filterList:i,onChange:a,index:c,column:v,filterValues:w})},customBodyRenderLite:i=>{const{walletSendStatus:a,walletSendAt:c,walletSendFailedReason:v}=R[i];return e.jsx(ce,{status:a,updatedAt:c,reason:v,channel:"wallet",onResend:z=>j(z,R[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:a,pushKitSendAt:c,pushKitSendFailedReason:v}=R[i];return e.jsx(ce,{status:a,updatedAt:c,reason:v,channel:"pushkit",onResend:z=>j(z,R[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:m.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(ve,{list:i,label:"Push Kit",onDelete:(a,c)=>{a.stopPropagation(),E(a,c,T[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:w,fullWidth:!0,logic:Se,display:(i,a,c,v)=>e.jsx(Re,{label:"Push Kit",filterList:i,onChange:a,index:c,column:v,filterValues:w})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:a,emailSendAt:c,emailSendFailedReason:v}=R[i];return e.jsx(ce,{status:a,updatedAt:c,reason:v,channel:"email",onResend:z=>j(z,R[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:m.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(ve,{list:i,label:"Email",onDelete:(a,c)=>{a.stopPropagation(),E(a,c,T[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:w,fullWidth:!0,logic:Se,display:(i,a,c,v)=>e.jsx(Re,{label:"Email",filterList:i,onChange:a,index:c,column:v,filterValues:w})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:a}=R[i];if(!a)return null;const c=Object.entries(a)[0];if(!c)return null;const[v,z]=c,Y=z[0];return e.jsx(C,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(C,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:v},v),e.jsx(ce,{status:Y.status,updatedAt:Y.sendAt,reason:Y.failedReason,channel:"webhook",onResend:K=>j(K,R[i],"webhook",[v],!1)})]},v)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:a}=R[i];return e.jsx(et,{value:a,locale:o,shouldUpdate:!0})}}}],[R,o,m,r]),le=[e.jsx(We,{value:m.dateRange,onChange:I},"date-picker"),e.jsx(Oe,{variant:"contained",size:"small",color:"primary",loading:B,startIcon:e.jsx(Mt,{}),onClick:()=>L(),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(os,{children:e.jsxs(tt,{theme:x,children:[e.jsx(at,{className:"receivers-table",locale:o,loading:B,columns:T,data:R,onChange:Z,options:se,customButtons:le,components:{TableFilterList:i=>e.jsx(Me,{...i,itemComponent:a=>e.jsx(Ke,{...a,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ae,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:ne,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rs,{children:[e.jsxs(U,{variant:"body1",component:"div",className:"check-title",children:[F?.channel," Checking"]}),e.jsx(C,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(F?.channel).map(i=>{const{type:a,pass:c,fail:v}=i;return!F?.result||F?.result?.[a]?e.jsxs(U,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:F?.result?.[a]?je.success.main:"inherit"},children:[F?.result?e.jsx($t,{}):e.jsx(Qe,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},a):e.jsxs(U,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:je.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:v})]},a)})})]})}),k.anchorEl&&e.jsx(Ae,{open:!!k.anchorEl,anchorReference:"anchorPosition",anchorPosition:k.position,onClose:re,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(pt,{loading:n,onCancel:re,onConfirm:p})})]})})})}const as=g.memo(ft),os=ie.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1 +1 @@
1
- import{bd as x}from"./index-Bm_l9nlM.js";function D(a,i){for(var r=0;r<i.length;r++){const e=i[r];if(typeof e!="string"&&!Array.isArray(e)){for(const s in e)if(s!=="default"&&!(s in a)){const t=Object.getOwnPropertyDescriptor(e,s);t&&Object.defineProperty(a,s,t.get?t:{enumerable:!0,get:()=>e[s]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var l,w;function J(){if(w)return l;w=1;var a={default:l,call:function(i,r,e){var s="";typeof r=="function"&&(e=r,r={});var t={data:r===void 0?null:r};if(typeof e=="function"){var d="dscb"+window.dscb++;window[d]=e,t._dscbstub=d}return t=JSON.stringify(t),window._dsbridge?s=_dsbridge.call(i,t):(window._dswk||navigator.userAgent.indexOf("_dsbridge")!=-1)&&(s=prompt("_dsbridge="+i,t)),JSON.parse(s||"{}").data},register:function(i,r,e){var s=e?window._dsaf:window._dsf;window._dsInit||(window._dsInit=!0,setTimeout(function(){a.call("_dsb.dsinit")},0)),typeof r=="object"?s._obs[i]=r:s[i]=r},registerAsyn:function(i,r){this.register(i,r,!0)},hasNativeMethod:function(i,r){return this.call("_dsb.hasNativeMethod",{name:i,type:r||"all"})},disableJavascriptDialogBlock:function(i){this.call("_dsb.disableJavascriptDialogBlock",{disable:i!==!1})}};return function(){if(!window._dsf){var i={_dsf:{_obs:{}},_dsaf:{_obs:{}},dscb:0,dsBridge:a,close:function(){a.call("_dsb.closePage")},_handleMessageFromNative:function(e){var s=JSON.parse(e.data),t={id:e.callbackId,complete:!0},d=this._dsf[e.method],o=this._dsaf[e.method],v=function(_,p){t.data=_.apply(p,s),a.call("_dsb.returnValue",t)},g=function(_,p){s.push(function(O,j){t.data=O,t.complete=j!==!1,a.call("_dsb.returnValue",t)}),_.apply(p,s)};if(d)v(d,this._dsf);else if(o)g(o,this._dsaf);else{var u=e.method.split(".");if(u.length<2)return;var b=u.pop(),h=u.join("."),c=this._dsf._obs,f=c[h]||{},n=f[b];if(n&&typeof n=="function"){v(n,f);return}if(c=this._dsaf._obs,f=c[h]||{},n=f[b],n&&typeof n=="function"){g(n,f);return}}}};for(var r in i)window[r]=i[r];a.register("_hasJavascriptMethod",function(e,s){var t=e.split(".");if(t.length<2)return!!(_dsf[t]||_dsaf[t]);var e=t.pop(),d=t.join("."),o=_dsf._obs[d]||_dsaf._obs[d];return o&&!!o[e]})}}(),l=a,l}var y=J();const N=x(y),k=D({__proto__:null,default:N},[y]);export{k as i};
1
+ import{bd as x}from"./index-C7oyIqA7.js";function D(a,i){for(var r=0;r<i.length;r++){const e=i[r];if(typeof e!="string"&&!Array.isArray(e)){for(const s in e)if(s!=="default"&&!(s in a)){const t=Object.getOwnPropertyDescriptor(e,s);t&&Object.defineProperty(a,s,t.get?t:{enumerable:!0,get:()=>e[s]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var l,w;function J(){if(w)return l;w=1;var a={default:l,call:function(i,r,e){var s="";typeof r=="function"&&(e=r,r={});var t={data:r===void 0?null:r};if(typeof e=="function"){var d="dscb"+window.dscb++;window[d]=e,t._dscbstub=d}return t=JSON.stringify(t),window._dsbridge?s=_dsbridge.call(i,t):(window._dswk||navigator.userAgent.indexOf("_dsbridge")!=-1)&&(s=prompt("_dsbridge="+i,t)),JSON.parse(s||"{}").data},register:function(i,r,e){var s=e?window._dsaf:window._dsf;window._dsInit||(window._dsInit=!0,setTimeout(function(){a.call("_dsb.dsinit")},0)),typeof r=="object"?s._obs[i]=r:s[i]=r},registerAsyn:function(i,r){this.register(i,r,!0)},hasNativeMethod:function(i,r){return this.call("_dsb.hasNativeMethod",{name:i,type:r||"all"})},disableJavascriptDialogBlock:function(i){this.call("_dsb.disableJavascriptDialogBlock",{disable:i!==!1})}};return function(){if(!window._dsf){var i={_dsf:{_obs:{}},_dsaf:{_obs:{}},dscb:0,dsBridge:a,close:function(){a.call("_dsb.closePage")},_handleMessageFromNative:function(e){var s=JSON.parse(e.data),t={id:e.callbackId,complete:!0},d=this._dsf[e.method],o=this._dsaf[e.method],v=function(_,p){t.data=_.apply(p,s),a.call("_dsb.returnValue",t)},g=function(_,p){s.push(function(O,j){t.data=O,t.complete=j!==!1,a.call("_dsb.returnValue",t)}),_.apply(p,s)};if(d)v(d,this._dsf);else if(o)g(o,this._dsaf);else{var u=e.method.split(".");if(u.length<2)return;var b=u.pop(),h=u.join("."),c=this._dsf._obs,f=c[h]||{},n=f[b];if(n&&typeof n=="function"){v(n,f);return}if(c=this._dsaf._obs,f=c[h]||{},n=f[b],n&&typeof n=="function"){g(n,f);return}}}};for(var r in i)window[r]=i[r];a.register("_hasJavascriptMethod",function(e,s){var t=e.split(".");if(t.length<2)return!!(_dsf[t]||_dsaf[t]);var e=t.pop(),d=t.join("."),o=_dsf._obs[d]||_dsaf._obs[d];return o&&!!o[e]})}}(),l=a,l}var y=J();const N=x(y),k=D({__proto__:null,default:N},[y]);export{k as i};
@@ -1,4 +1,4 @@
1
- import{b$ as Ke,b_ as Fe,r as h,c0 as Ge,j as e,b8 as ee,c2 as $e,cf as Z,c3 as Ye,bY as He,ch as qe,aF as he,M as q,bn as A,cu as Ce,H as B,X as V,bf as E,fC as we,aQ as Be,b as N,i_ as Ve,V as D,gD as Qe,o as m,x as Xe,aw as De,y as fe,ak as Je,p as Ze,C as L,T as j,k as et,s as tt,f as ot,i$ as X,i0 as J,j0 as st,K as S,aV as K,aH as T,L as nt,g as H,dl as at,ay as Se,Q as G,aE as $,a8 as Y,a4 as rt,dI as it,gt as ct,a$ as lt,v as pe,w as dt,G as be,Y as Ee,bC as xe,B as pt}from"./index-Bm_l9nlM.js";import{T as ut}from"./html-title-6LqX2w8M.js";import{u as U}from"./blocklet-BiSktkqf.js";import{u as mt}from"./use-mobile-DejvdfF-.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-DfLNs2UU.js";import"./index-BuyR7Vcz.js";import"./index-BojVbZw0.js";import"./api-DvjvmnE7.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-CFEqPh3C.js";import{v as Rt}from"./index-Coaf_Q-u.js";import{E as zt}from"./index-Sz-ky4ND.js";import{H as vt}from"./HelpOutline-ClH7KlOo.js";import{H as Pt}from"./index-CaaGoS1U.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-CSHVjH1K.js";import{D as Ut}from"./DeleteOutline-BaG49xB4.js";import{g as ke}from"./get-safe-url-Bl0GiKcG.js";import{S as Ot}from"./switch-control-Dg3K4nsi.js";import{L as je}from"./list-header-CeZ7lRnY.js";import"./OpenInNew-BARTtWT4.js";import"./ButtonGroup-DdwOEbFl.js";import"./getValidReactChildren-BW9X0l3m.js";import"./FilterList-DJIxPwJl.js";import"./CSSTransition-D4EEAtrd.js";import"./emotion-cache.browser.esm-Boqprxmw.js";import"./index-Dv_YqGF9.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BHwu6MhF.js";import"./index-CS8lfW32.js";import"./TableSearch-h0N_WiXK.js";import"./Search-xi7mzsy1.js";import"./Clear-CxuHkeB_.js";import"./MoreVert-C0TW35nI.js";import"./useLocalStorage-DCBNi-1B.js";import"./url-evaluation-Cgv5jFUd.js";import"./permission-CZwbIMwH.js";import"./Switch-3lSFjk1I.js";function Mt(t){return Ke("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${Z(o)}`,`fontSize${Z(n)}`]};return Ye(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${Z(n.color)}`],o[`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(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Ge({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",f.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"})),Kt=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"})),Ft=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 Gt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:s,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:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=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(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!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()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),f=Qe(d),x=Yt({appDid:s?.appDid}),u=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===u)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("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===u&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.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:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:o.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:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}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:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Ze),{blocklet:n,loading:s}=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:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("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(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.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(`
1
+ import{b$ as Ke,b_ as Fe,r as h,c0 as Ge,j as e,b8 as ee,c2 as $e,cf as Z,c3 as Ye,bY as He,ch as qe,aF as he,M as q,bn as A,cu as Ce,H as B,X as V,bf as E,fC as we,aQ as Be,b as N,iP as Ve,V as D,gD as Qe,o as m,x as Xe,aw as De,y as fe,ak as Je,p as Ze,C as L,T as j,k as et,s as tt,f as ot,iQ as X,h_ as J,iR as st,K as S,aV as K,aH as T,L as nt,g as H,dl as at,ay as Se,Q as G,aE as $,a8 as Y,a4 as rt,dI as it,gt as ct,a$ as lt,v as pe,w as dt,G as be,Y as Ee,bC as xe,B as pt}from"./index-C7oyIqA7.js";import{T as ut}from"./html-title-7s4LlRfZ.js";import{u as U}from"./blocklet-CTig8EZC.js";import{u as mt}from"./use-mobile-Ct3mh22I.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-DZIdTrfY.js";import"./index-D5L-lDoJ.js";import"./index-BojVbZw0.js";import"./api-DxzFdLki.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-BQok4_vA.js";import{v as Rt}from"./index-DUoosowu.js";import{E as zt}from"./index-BqKmOEO2.js";import{H as vt}from"./HelpOutline-Dl5Yvk3d.js";import{H as Pt}from"./index-DZnln7_d.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-CERYEoLy.js";import{D as Ut}from"./DeleteOutline-C_ptzk3q.js";import{g as ke}from"./get-safe-url-B4jRm2fX.js";import{S as Ot}from"./switch-control-BmvEmQoO.js";import{L as je}from"./list-header-DKhmsovM.js";import"./OpenInNew-Bthv24Qd.js";import"./ButtonGroup-CXE45zw_.js";import"./getValidReactChildren-Ixtn2Lye.js";import"./FilterList-NTvfDQQ0.js";import"./CSSTransition-DETThFuD.js";import"./emotion-cache.browser.esm-R7OUqHQ7.js";import"./index-DSXieMH9.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DQ8f_obf.js";import"./index-CDZRZ08r.js";import"./TableSearch-DLP010Te.js";import"./Search-CL67DzD6.js";import"./Clear-BKH2DPdA.js";import"./MoreVert-C8oKCpDc.js";import"./useLocalStorage-BbZxR418.js";import"./url-evaluation-DNKcusJ-.js";import"./permission-CYhKziEK.js";import"./Switch-Dtn3RWR5.js";function Mt(t){return Ke("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${Z(o)}`,`fontSize${Z(n)}`]};return Ye(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${Z(n.color)}`],o[`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(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Ge({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",f.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"})),Kt=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"})),Ft=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 Gt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:s,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:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=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(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!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()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),f=Qe(d),x=Yt({appDid:s?.appDid}),u=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===u)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("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===u&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.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:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:o.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:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}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:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Ze),{blocklet:n,loading:s}=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:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("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(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.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
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:st[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(zt,{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:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{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(K,{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(K,{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,...o})=>e.jsx(Se,{...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 Le({status:t,message:o="",createdAt:n}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&s("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"}),s("common.progress")]}):i?e.jsx(H,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:s("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||a,children:e.jsx(ye,{children:e.jsx(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function Ue({metadata:t={}}){const{t:o}=D();if(q(t))return e.jsx(H,{type:"success",children:o("common.succeeded")});const n=t.count||0,s=t.size||0,r=At(s,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:o("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:m.object};function Oe(){const{t,locale:o}=D(),{spaceGateways:n,backups:s,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:f}=s[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,u=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return u?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=s?.[i]??{},{status:l,message:p,createdAt:f,metadata:x}=d,u=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!u,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!u;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:f})}}}],[s,n,t]),c=h.useMemo(()=>!s?.length,[s]);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(Pt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",o),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:o=()=>{},onCancel:n=()=>{}}){const{t:s}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(f,x)=>{f?.preventDefault(),f?.stopPropagation(),a(x)},l=async f=>{try{f?.stopPropagation(),i(!0),await o?.(t),a(!1)}catch(x){console.error(x),B.error(`${s("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=f=>{d(f,!1),n?.(f)};return e.jsxs(e.Fragment,{children:[e.jsxs(G,{color:"red",onClick:f=>d(f,!0),children:[e.jsx($,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx(Y,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(rt,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Ne({spaceGateway:t,selected:o,onDelete:n=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[f,x]=h.useState(!1),u=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),u(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),u(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[f||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=>u(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>u(y,!1),children:[e.jsxs(G,{onClick:y=>{u(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx(Y,{children:p("common.open")})]}),e.jsxs(G,{onClick:y=>{u(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!o&&r&&e.jsxs(G,{onClick:k,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Kt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(G,{onClick:w,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx(Y,{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:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool,endpoint:m.string.isRequired,loading:m.bool}).isRequired,selected:m.bool.isRequired,enableSwitchToSpace:m.bool,onDelete:m.func,onConnect:m.func,backupInProgress:m.bool};const Zt=ee(({className:t,...o})=>e.jsx(Se,{...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 _e({spaceGateway:t,spaceStatus:o,selected:n,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:oe,refreshBackupSummary:se,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&&!_&&o===ue.DISCONNECTED,re=n&&!_&&!t.loading&&o===ue.CONNECTED,F=n&&_&&o===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(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})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(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:f,appName:x,appDescription:u,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),s?.(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})),s?.(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 oe(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),se(),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")}),F&&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:F})]})}_e.propTypes={spaceGateway:m.shape({did:m.string.isRequired,name:m.string.isRequired,url:m.string.isRequired,endpoint:m.string.isRequired,protected:m.bool,loading:m.bool}).isRequired,spaceStatus:m.string.isRequired,selected:m.bool.isRequired,onConnected:m.func,onDeleted:m.func,onBackedUp:m.func};function eo({...t}){const{t:o}=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:o("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function to({...t}){const{t:o}=D(),{autoBackup:n,updateAutoBackup:s}=O(),r=async()=>{try{const a=!n?.enabled;await s({enabled:a}),B.success(o(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:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function oo(){const{t}=D(),{spaceGateways:o,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=O(),r=n&&!o?.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(to,{}),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:o.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(ht,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(eo,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function so(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(o)?e.jsx(Jt,{}):e.jsx(oo,{})}function no(){return e.jsx(ze,{children:e.jsx(so,{})})}function ao(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:n,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=yt(),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:[s?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(kt,{}),e.jsx(S,{sx:c,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function ro(){const{t}=D();return e.jsxs(St,{children:[e.jsxs(K,{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(ao,{})]})}function io({navOrientation:t="vertical",...o}){const{t:n,locale:s}=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},[s,l]),x=xe(()=>({backup:e.jsx(no,{}),storage:e.jsx(ro,{})}))[d],u=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:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...o,children:e.jsxs(K,{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,{...o,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}io.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const me=ee(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;