@abtnode/webapp 1.16.45-beta-20250609-082716-b6b0592b → 1.16.45-beta-20250609-111118-0d252ebe

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 (202) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-BPnL086D.js → AdapterDayjs-BqwbfR-J.js} +1 -1
  4. package/dist/assets/{Add-BaepTMyl.js → Add-CSGWebd7.js} +1 -1
  5. package/dist/assets/{ArrowDropDown-CJZPcYMj.js → ArrowDropDown-BCCxOUNE.js} +1 -1
  6. package/dist/assets/{Autocomplete-BzsxfAhs.js → Autocomplete-BRFoT1-d.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-bCGgNRxZ.js → Breadcrumbs-B-xYTnoc.js} +1 -1
  8. package/dist/assets/{ButtonGroup-jLU91Eto.js → ButtonGroup-ClVwTb7r.js} +1 -1
  9. package/dist/assets/{CSSTransition-CEYSDYhf.js → CSSTransition-DpoNbm4c.js} +1 -1
  10. package/dist/assets/{CallMerge-BmooQIj9.js → CallMerge-weq4zXp-.js} +1 -1
  11. package/dist/assets/{CardContent-DztUyw0g.js → CardContent-CTAfwoUe.js} +1 -1
  12. package/dist/assets/{ChevronLeft-DxCtjh6K.js → ChevronLeft-DQK-aqqz.js} +1 -1
  13. package/dist/assets/{ChevronRight-BJDD27JD.js → ChevronRight-BtkdX9A9.js} +1 -1
  14. package/dist/assets/{Clear-BxwDIGi1.js → Clear-D0I7uWhD.js} +1 -1
  15. package/dist/assets/{Close-C9dxdyWh.js → Close-6CxneLlA.js} +1 -1
  16. package/dist/assets/{Community-BM20-8dz.js → Community-v2_SoLAO.js} +1 -1
  17. package/dist/assets/{Delete-DKeOWzoo.js → Delete-P4B2dduO.js} +1 -1
  18. package/dist/assets/{DeleteOutline-BKxhOLzM.js → DeleteOutline-EQ9bHspP.js} +1 -1
  19. package/dist/assets/{Done-BSxV_Z_N.js → Done-2EsU1aO2.js} +1 -1
  20. package/dist/assets/{Edit-CcJpZVnD.js → Edit-frf3Fbx4.js} +1 -1
  21. package/dist/assets/{ErrorOutline-Cpcgvmsb.js → ErrorOutline-a1DnwqoR.js} +1 -1
  22. package/dist/assets/{HelpOutline-DddyHTiw.js → HelpOutline-CBv7x3VM.js} +1 -1
  23. package/dist/assets/{Holiday-Bqv7Z2Nl.js → Holiday-CM3JD4xm.js} +1 -1
  24. package/dist/assets/{Launch-W68EZl8H.js → Launch-B7fv6nTK.js} +1 -1
  25. package/dist/assets/{Link-CI9SWqj5.js → Link-CiUEO3cQ.js} +1 -1
  26. package/dist/assets/{ListItemButton-Cz3h14We.js → ListItemButton-ByIRcZGW.js} +1 -1
  27. package/dist/assets/{ListSubheader-B1Gs-Di0.js → ListSubheader-Yn3XMnVm.js} +1 -1
  28. package/dist/assets/{LoadingButton-DAtzlWSB.js → LoadingButton-B3es9INs.js} +1 -1
  29. package/dist/assets/{LockIcon-B5Cu6iVD.js → LockIcon-C1gL9Uz4.js} +1 -1
  30. package/dist/assets/{Meeting-CdElUcfA.js → Meeting-BkxfSXYG.js} +1 -1
  31. package/dist/assets/{MoreHoriz-DAVefXBs.js → MoreHoriz-3d6Yp_t-.js} +1 -1
  32. package/dist/assets/{MoreVert-DqeE3_Hd.js → MoreVert-C_Ck3fn9.js} +1 -1
  33. package/dist/assets/{OffSick-BBRqxJJu.js → OffSick-Z9k6qoex.js} +1 -1
  34. package/dist/assets/{OpenInNew-2bjbGYSq.js → OpenInNew-D79h4Iot.js} +1 -1
  35. package/dist/assets/{Public-BTdEMtHi.js → Public-BtS6bdiD.js} +1 -1
  36. package/dist/assets/{Refresh-C0Iz2zZt.js → Refresh-C1kA8imS.js} +1 -1
  37. package/dist/assets/{SchemaReference.es-oSyd1It7.js → SchemaReference.es-Dfqhb0uS.js} +1 -1
  38. package/dist/assets/{Search-DBiDYaX1.js → Search-CUm1f8xo.js} +1 -1
  39. package/dist/assets/{Slider-BjpE1rv2.js → Slider-B0hY7ZYB.js} +1 -1
  40. package/dist/assets/{Stepper-B-l2XYXD.js → Stepper-CEe-v4P_.js} +1 -1
  41. package/dist/assets/{Switch-DSS8JChR.js → Switch-D3iZUzda.js} +1 -1
  42. package/dist/assets/{TableRow-DQuCW6hn.js → TableRow-CQ8RBtid.js} +1 -1
  43. package/dist/assets/{TableSearch-C6AKfDSr.js → TableSearch-Uk9kIt7i.js} +1 -1
  44. package/dist/assets/{ToggleButtonGroup-CnUjfOWR.js → ToggleButtonGroup-BrZT8OFC.js} +1 -1
  45. package/dist/assets/{Verified-ZTqRecOi.js → Verified-DjfvSM3n.js} +1 -1
  46. package/dist/assets/{VerifiedUser-TTfmWq7J.js → VerifiedUser-CGB9pAg5.js} +1 -1
  47. package/dist/assets/{ViewColumn-BCvqBjPt.js → ViewColumn-CcQluqhl.js} +1 -1
  48. package/dist/assets/{ViewList-CW3TCfoq.js → ViewList-CPkfx4gI.js} +1 -1
  49. package/dist/assets/{WorkingRemotely-Cxxbbwm6.js → WorkingRemotely-BMx519Rn.js} +1 -1
  50. package/dist/assets/{_createAggregator-CPkIJJuD.js → _createAggregator-Dp2y-Mf_.js} +1 -1
  51. package/dist/assets/{actions-C42Q30RQ.js → actions-C8ldDfDc.js} +1 -1
  52. package/dist/assets/{actions-B5wmKEDC.js → actions-CvZtuIOm.js} +1 -1
  53. package/dist/assets/{agreement-Jdo-zY9j.js → agreement-4TUvZhY3.js} +1 -1
  54. package/dist/assets/api-gAVz4YtD.js +1 -0
  55. package/dist/assets/{appearance-BRCCw1u2.js → appearance-CztLZ35g.js} +1 -1
  56. package/dist/assets/{audit-logs-BJqbSAPC.js → audit-logs-vnwtSLPp.js} +1 -1
  57. package/dist/assets/{base-chart-B2gmFhRJ.js → base-chart-tXWghrta.js} +1 -1
  58. package/dist/assets/{blocklet-DiZeBiJN.js → blocklet-SKmr21o8.js} +1 -1
  59. package/dist/assets/{brace-fold.es-DxbrOmhK.js → brace-fold.es-C8hYDu8C.js} +1 -1
  60. package/dist/assets/{chain-D7X2-qfm.js → chain-Cw3CxpIJ.js} +1 -1
  61. package/dist/assets/{click-to-copy-CgzyQB5V.js → click-to-copy-BBcwV5Sv.js} +1 -1
  62. package/dist/assets/cloneDeep-CP0xacDT.js +1 -0
  63. package/dist/assets/{closebrackets.es-Bg15eLC-.js → closebrackets.es-n7j2YaKC.js} +1 -1
  64. package/dist/assets/{codemirror.es-CO1Dk0p2.js → codemirror.es-q3z3D3fp.js} +1 -1
  65. package/dist/assets/{collapse-Xins5ZhF.js → collapse-Cy01Qhtt.js} +1 -1
  66. package/dist/assets/{comment.es-3KCDqSac.js → comment.es-CZaW3Zjc.js} +1 -1
  67. package/dist/assets/{config-navigation-BjQhnuHo.js → config-navigation-B4iEyuxN.js} +3 -3
  68. package/dist/assets/{connect-to-CJ05ah0j.js → connect-to-BbdcjX_x.js} +1 -1
  69. package/dist/assets/{delete-confirm-CCMGtPBw.js → delete-confirm-qy4uClf5.js} +1 -1
  70. package/dist/assets/{detail-KJCoxUAd.js → detail-C_SIxTEY.js} +3 -3
  71. package/dist/assets/{dialog.es-CE99qOYk.js → dialog.es-BEBI39yG.js} +1 -1
  72. package/dist/assets/{domains-DvL3Ga1O.js → domains-Bql4UA4y.js} +1 -1
  73. package/dist/assets/{download-ClJJWg3s.js → download-DdDp7qNF.js} +1 -1
  74. package/dist/assets/emotion-react.browser.esm--gIypTeg.js +1 -0
  75. package/dist/assets/{foldgutter.es-CiZmTrO7.js → foldgutter.es-XJVlfA9j.js} +1 -1
  76. package/dist/assets/{get-safe-url-DO00hPju.js → get-safe-url-BHhOK-87.js} +1 -1
  77. package/dist/assets/{get-safe-url-aH9mMJx2.js → get-safe-url-ZQAisLez.js} +1 -1
  78. package/dist/assets/getValidReactChildren-B-b9MOMT.js +1 -0
  79. package/dist/assets/{hint.es-Bo36zzhX.js → hint.es-BXYnqh_9.js} +1 -1
  80. package/dist/assets/{hint.es2-CAOXzXaR.js → hint.es2-mCmWTcSI.js} +1 -1
  81. package/dist/assets/{iframe-BnX2-HMD.js → iframe-CVde2I2R.js} +1 -1
  82. package/dist/assets/{index-Dmp8rYJ8.js → index-B37Lr7Hg.js} +1 -1
  83. package/dist/assets/{index-D9iEwrbX.js → index-B6YLm2gY.js} +1 -1
  84. package/dist/assets/{index-ClrIfUmS.js → index-B6gCUDLy.js} +1 -1
  85. package/dist/assets/{index-CrF1a2RT.js → index-BDHvuJA-.js} +5 -5
  86. package/dist/assets/{index-BCxIgLgQ.js → index-BILcrV-b.js} +1 -1
  87. package/dist/assets/{index-D3KU0pJA.js → index-BKpBz5IS.js} +1 -1
  88. package/dist/assets/{index-D732T1aT.js → index-BLrsx8oH.js} +1 -1
  89. package/dist/assets/{index-wTEUfJK4.js → index-BQOOINkR.js} +1 -1
  90. package/dist/assets/{index-9XYQmK_k.js → index-BUWOtFDP.js} +1 -1
  91. package/dist/assets/{index-Boy3iHgk.js → index-BWpZKV7G.js} +3 -3
  92. package/dist/assets/{index-BlgBrilI.js → index-BkStkax6.js} +1 -1
  93. package/dist/assets/{index-SykBhSuA.js → index-Boprg64p.js} +1 -1
  94. package/dist/assets/{index-mGiaMB4m.js → index-BublfAf3.js} +1 -1
  95. package/dist/assets/{index-Dj_QnghX.js → index-C-QDjEC-.js} +1 -1
  96. package/dist/assets/{index-DMyI2aU2.js → index-C562LNdR.js} +1 -1
  97. package/dist/assets/{index-Brzpmake.js → index-CCGiAGPb.js} +1 -1
  98. package/dist/assets/{index-DpBmopYo.js → index-CEr4LN-P.js} +1 -1
  99. package/dist/assets/{index-Dow64Z2x.js → index-CFc2cpAq.js} +1 -1
  100. package/dist/assets/{index-Z5lc5lIc.js → index-CIeEDIRZ.js} +1 -1
  101. package/dist/assets/{index-DKyf9Yqh.js → index-CPBAco4X.js} +1 -1
  102. package/dist/assets/{index-CG3kAlcB.js → index-CViyZjZs.js} +1 -1
  103. package/dist/assets/{index-C5r6y0B-.js → index-CZplOWEN.js} +1 -1
  104. package/dist/assets/{index-BuMTt7NP.js → index-C_5on_zt.js} +1 -1
  105. package/dist/assets/{index-CxMh-z_6.js → index-ChSMfUDl.js} +1 -1
  106. package/dist/assets/{index-BhhOQuUW.js → index-Cm6VrPFr.js} +1 -1
  107. package/dist/assets/{index-30VVCODr.js → index-CyCivdc5.js} +1 -1
  108. package/dist/assets/{index-BbtEo9r9.js → index-D3OlVE0m.js} +1 -1
  109. package/dist/assets/{index-t7cKmyc5.js → index-DM5TK3mI.js} +1 -1
  110. package/dist/assets/{index-jI8Y9wpJ.js → index-DNFAdenj.js} +1 -1
  111. package/dist/assets/{index-Zm-WNook.js → index-DRvnuna9.js} +1 -1
  112. package/dist/assets/{index-BOLfvqKF.js → index-DTb1YjkO.js} +8 -8
  113. package/dist/assets/{index-DtapEWSR.js → index-DTnnZgV3.js} +1 -1
  114. package/dist/assets/{index-De4MlLgJ.js → index-DVT--CtL.js} +3 -3
  115. package/dist/assets/{index-CUOESLiC.js → index-DdAt9jDT.js} +1 -1
  116. package/dist/assets/{index-zlu_iF9b.js → index-Dg-nEXIR.js} +1 -1
  117. package/dist/assets/{index-xMJ_lTjJ.js → index-DnLtwT4P.js} +1 -1
  118. package/dist/assets/{index-HJyYrv5X.js → index-DrBxStif.js} +1 -1
  119. package/dist/assets/{index-BmtiSq2M.js → index-Ds-ruyy-.js} +1 -1
  120. package/dist/assets/{index-CEJX705l.js → index-DsdaIM1E.js} +1 -1
  121. package/dist/assets/{index-BCGKopWm.js → index-DzK6OW-H.js} +1 -1
  122. package/dist/assets/{index-Dt9pZ2YF.js → index-DzWDWvao.js} +1 -1
  123. package/dist/assets/{index-DI_gxPWq.js → index-DzcmC4If.js} +3 -3
  124. package/dist/assets/{index-wqaqDly9.js → index-omP-_XYV.js} +1 -1
  125. package/dist/assets/{index-BoMTtsmm.js → index-ooFvSbXR.js} +1 -1
  126. package/dist/assets/index-s1CQJTjJ.js +1 -0
  127. package/dist/assets/{index-IW9KB94O.js → index-uw3m84Z2.js} +1 -1
  128. package/dist/assets/{index-DSvMfxSw.js → index-wKRUqEyT.js} +1 -1
  129. package/dist/assets/{index.esm-Bn-iehLo.js → index.esm-CB-7UGfI.js} +1 -1
  130. package/dist/assets/{info-addon.es-GUHgmi5n.js → info-addon.es-DKtNhOCh.js} +1 -1
  131. package/dist/assets/{info.es-Blua3wzj.js → info.es-B7YFO8O9.js} +1 -1
  132. package/dist/assets/{install-from-url-CE66dEAo.js → install-from-url-B9F0r0Uk.js} +1 -1
  133. package/dist/assets/{invitation-DurHrtHf.js → invitation-BAovnHWT.js} +1 -1
  134. package/dist/assets/is-path-prefix-equal-C80Jhu_q.js +1 -0
  135. package/dist/assets/{item-DKqObQ3Z.js → item-CrnjScjy.js} +1 -1
  136. package/dist/assets/{javascript.es-BH1wlBZU.js → javascript.es-e4wfmIpw.js} +1 -1
  137. package/dist/assets/{jump-to-line.es-Bc8f2sko.js → jump-to-line.es-D1zAOCng.js} +1 -1
  138. package/dist/assets/{jump.es-DchNv69N.js → jump.es-CR1apnMt.js} +1 -1
  139. package/dist/assets/{lint.es-DjIO9EP-.js → lint.es-po0cvpDF.js} +1 -1
  140. package/dist/assets/{lint.es2-D6QiK1LN.js → lint.es2-CIRlGKEU.js} +1 -1
  141. package/dist/assets/{lint.es3-1Hh074BZ.js → lint.es3-CC5QXby4.js} +1 -1
  142. package/dist/assets/{list-header-D5vsRPp7.js → list-header-D5Klosqn.js} +1 -1
  143. package/dist/assets/{log-LbP8IGNT.js → log-DvWjHRjx.js} +1 -1
  144. package/dist/assets/{lottie-react.esm-vLYu8hjp.js → lottie-react.esm-CzS4D97g.js} +1 -1
  145. package/dist/assets/{matchbrackets.es-2wYFPv6E.js → matchbrackets.es-Bh__cUPA.js} +1 -1
  146. package/dist/assets/{memory-CiKqWgj7.js → memory-VuyFpRX6.js} +1 -1
  147. package/dist/assets/{metric-BDJmu11E.js → metric-sJIuzFdD.js} +1 -1
  148. package/dist/assets/{mode.es-BqW6_fGr.js → mode.es-b4PvmWPj.js} +1 -1
  149. package/dist/assets/{mode.es2-D8SKatMd.js → mode.es2-B8UlLCtX.js} +1 -1
  150. package/dist/assets/{mode.es3-CNkkrM-6.js → mode.es3-CQ9X5NiW.js} +1 -1
  151. package/dist/assets/omit-BEDWXxvr.js +1 -0
  152. package/dist/assets/{onlineParser.es-oUEApoDN.js → onlineParser.es-mNPHWPcl.js} +1 -1
  153. package/dist/assets/{overview-CruS8RZC.js → overview-DptGQrLC.js} +1 -1
  154. package/dist/assets/{permission-BQtaoI3I.js → permission-DtbkcHFU.js} +1 -1
  155. package/dist/assets/{preference-DJFG2uH3.js → preference-BIxg48qT.js} +3 -3
  156. package/dist/assets/{raf-schd.esm-CJK5XRZT.js → raf-schd.esm-CyR0PsG3.js} +1 -1
  157. package/dist/assets/refType-J5vgZzDX.js +1 -0
  158. package/dist/assets/{resource-dialog-CO7CVlvn.js → resource-dialog-DSlsEDCi.js} +4 -4
  159. package/dist/assets/{runtime-DYumryGg.js → runtime-BqyrQzUD.js} +1 -1
  160. package/dist/assets/{schema--5oUwlB4.js → schema-BD6PrmCO.js} +1 -1
  161. package/dist/assets/sdk-gxKU3x6m.js +1 -0
  162. package/dist/assets/{search.es-BNWiVNZg.js → search.es-BjwGHA7G.js} +1 -1
  163. package/dist/assets/{searchcursor.es-31Y56HAZ.js → searchcursor.es-CbJCToER.js} +1 -1
  164. package/dist/assets/{service-DQkMTtxe.js → service-BV2uNns2.js} +1 -1
  165. package/dist/assets/{shorten-label-D74t0ifG.js → shorten-label-BOckTQ1X.js} +1 -1
  166. package/dist/assets/{show-hint.es-FtZ2uk9e.js → show-hint.es-q9IMwctI.js} +1 -1
  167. package/dist/assets/{simple-select-BdDQTMpn.js → simple-select-Dtd0a5G_.js} +1 -1
  168. package/dist/assets/{spaces-BgnAkcnA.js → spaces-Bqb0c1IC.js} +1 -1
  169. package/dist/assets/{status-q1EdEhzw.js → status-CoaEXqC8.js} +1 -1
  170. package/dist/assets/{status-BfSQdY5K.js → status-DAsfcIss.js} +1 -1
  171. package/dist/assets/{sublime.es-CxJ3H0tj.js → sublime.es-Di_Rzzft.js} +1 -1
  172. package/dist/assets/{switch-control-DwgD_U7I.js → switch-control-uwHD90eP.js} +1 -1
  173. package/dist/assets/{table-icons--5A28zgV.js → table-icons-CMF2B4vQ.js} +1 -1
  174. package/dist/assets/{team-RnJISF0L.js → team-DbBAK1Lw.js} +1 -1
  175. package/dist/assets/{toLower-RHUaQlXh.js → toLower-Bk4Y66nU.js} +1 -1
  176. package/dist/assets/toUpper-FI4Si1KF.js +1 -0
  177. package/dist/assets/{traffic-DmNfI0bT.js → traffic-C8Jrp6CL.js} +1 -1
  178. package/dist/assets/{url-evaluation-DiN5Q08e.js → url-evaluation-DQ262LSg.js} +1 -1
  179. package/dist/assets/{url-join-BIMdRB8V.js → url-join-IGglLOtK.js} +1 -1
  180. package/dist/assets/{use-mobile-utJ7FsR-.js → use-mobile-BoYyduuc.js} +1 -1
  181. package/dist/assets/{use-mobile-woqAnkRI.js → use-mobile-YvhVWxe8.js} +1 -1
  182. package/dist/assets/{useAsync-BX9-9evM.js → useAsync-DbB0tJq1.js} +1 -1
  183. package/dist/assets/{useAsyncRetry-5y7_186e.js → useAsyncRetry-BLg3v7lI.js} +1 -1
  184. package/dist/assets/{useLocalStorage-DPYKzz1_.js → useLocalStorage-DQZ59j66.js} +1 -1
  185. package/dist/assets/{useThemeProps-DJJZjixl.js → useThemeProps-CtXzBlYo.js} +1 -1
  186. package/dist/assets/{util-DvYZzgdN.js → util-CUC0Xf5B.js} +1 -1
  187. package/dist/assets/{wait-container-JJXJ3aE4.js → wait-container-GoGxY2Kf.js} +1 -1
  188. package/dist/assets/{withStyles-zmjsbKsz.js → withStyles-_FcG1bkA.js} +1 -1
  189. package/dist/assets/{wrap-locale-mYykcBLv.js → wrap-locale-B35eVgy7.js} +1 -1
  190. package/dist/index.html +1 -1
  191. package/dist/service-worker.js +1 -1
  192. package/package.json +1 -1
  193. package/dist/assets/api-DJB2B_-t.js +0 -1
  194. package/dist/assets/cloneDeep-inGyOGD4.js +0 -1
  195. package/dist/assets/emotion-react.browser.esm-BnQsp-2e.js +0 -1
  196. package/dist/assets/getValidReactChildren-D_5CTSB1.js +0 -1
  197. package/dist/assets/index-0cx2L09O.js +0 -1
  198. package/dist/assets/is-path-prefix-equal-CYEALK7U.js +0 -1
  199. package/dist/assets/omit-BiJoS85k.js +0 -1
  200. package/dist/assets/refType-C2bDqONV.js +0 -1
  201. package/dist/assets/sdk-DuEQLs4j.js +0 -1
  202. package/dist/assets/toUpper-DMGZM86u.js +0 -1
@@ -1 +1 @@
1
- import{cq as x,r as o,e as g,cr as r,z as u,j as s,K as m,cs as d}from"./index-BOLfvqKF.js";function P(){const a=x(),{blocklets:c,refresh:l}=a,{t:y}=o.useContext(g),p=r.generateKey(),[i]=u();return o.useEffect(()=>{const n=r.getNotificationQueryParams(p)??{},t=i.get("entityId"),e=i.get("severity"),f={...n,...e?{severity:e==="all"?[]:e.split(","),paging:{...n.paging,page:1}}:{},...t?{entityId:t==="all"?[]:t.split(",")}:{},componentDid:[]};l(f)},[]),s.jsxs(m,{children:[s.jsx("h1",{children:y("notification.title")}),s.jsx(d,{tabType:"line",blocklets:c,context:a,filterType:"entity",type:"server"})]})}export{P as default};
1
+ import{cq as x,r as o,e as g,cr as r,z as u,j as s,K as m,cs as d}from"./index-DTb1YjkO.js";function P(){const a=x(),{blocklets:c,refresh:l}=a,{t:y}=o.useContext(g),p=r.generateKey(),[i]=u();return o.useEffect(()=>{const n=r.getNotificationQueryParams(p)??{},t=i.get("entityId"),e=i.get("severity"),f={...n,...e?{severity:e==="all"?[]:e.split(","),paging:{...n.paging,page:1}}:{},...t?{entityId:t==="all"?[]:t.split(",")}:{},componentDid:[]};l(f)},[]),s.jsxs(m,{children:[s.jsx("h1",{children:y("notification.title")}),s.jsx(d,{tabType:"line",blocklets:c,context:a,filterType:"entity",type:"server"})]})}export{P as default};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Dmp8rYJ8.js","./index-BOLfvqKF.js","./index-Cp6LwWOU.css"])))=>i.map(i=>d[i]);
2
- import{r as p,cv as F,c5 as X,cw as H,cx as q,aP as G,aQ as O,j as s,n as E,P as j,E as Q,aT as V,e as J,cy as K,v as _,K as x,cz as Y,W as Z,B as I,bc as ee,k as M,cA as $,g as te,cB as se,bB as ae,cC as oe,cD as ne,u as re,w as ie,ap as ce,bz as le,af as pe}from"./index-BOLfvqKF.js";import{d as de}from"./ViewList-CW3TCfoq.js";import{d as ue}from"./Done-BSxV_Z_N.js";import{N as me}from"./index-IW9KB94O.js";import{w as fe}from"./wrap-locale-mYykcBLv.js";import{g as he}from"./get-safe-url-DO00hPju.js";import{S as xe,a as ge,b as ve}from"./Stepper-B-l2XYXD.js";import"./emotion-react.browser.esm-BnQsp-2e.js";var P=function(t){if(!t)return 0;var r=q(t).valueOf()-Date.now();return r<0?0:r},be=function(t){return{days:Math.floor(t/864e5),hours:Math.floor(t/36e5)%24,minutes:Math.floor(t/6e4)%60,seconds:Math.floor(t/1e3)%60,milliseconds:Math.floor(t)%1e3}},we=function(t){t===void 0&&(t={});var r=t||{},l=r.leftTime,i=r.targetDate,d=r.interval,v=d===void 0?1e3:d,b=r.onEnd,g=p.useMemo(function(){return F(l)&&l>0?Date.now()+l:void 0},[l]),a="leftTime"in t?g:i,m=X(p.useState(function(){return P(a)}),2),f=m[0],u=m[1],o=H(b);p.useEffect(function(){if(!a){u(0);return}u(P(a));var w=setInterval(function(){var n,c=P(a);u(c),c===0&&(clearInterval(w),(n=o.current)===null||n===void 0||n.call(o))},v);return function(){return clearInterval(w)}},[a,v]);var y=p.useMemo(function(){return be(f)},[f]);return[f,y]},k={},ye=O;Object.defineProperty(k,"__esModule",{value:!0});var R=k.default=void 0,je=ye(G()),Se=s;R=k.default=(0,je.default)((0,Se.jsx)("path",{d:"M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z"}),"GetApp");function T({list:t,width:r,height:l,cardSpace:i,onSelect:d,defaultIndex:v}){const[b,g]=p.useState(0),[a,m]=p.useState(0),f=p.useRef(null),u=n=>{if(n<0||n>t.length-1)return;g(n);const c=f.current.clientWidth;m(n*(r+i)-(c-r)/2+i*.5),d(n)};p.useEffect(()=>{u(v);const n=c=>c.preventDefault();f.current.addEventListener("touchmove",n,{passive:!1})},[]);let o;const y=n=>{o=n.touches[0].clientX},w=n=>{const c=n.changedTouches[0],S=o-c.clientX;Math.abs(S)>60&&(S>0?u(b+1):u(b-1))};return s.jsx(Pe,{ref:f,onTouchStart:y,onTouchEnd:w,children:s.jsx("div",{className:"card-container",style:{transform:`translate(${-a}px, 0)`},children:t.map((n,c)=>s.jsx("div",{className:`card-item ${c===b?"selected":""}`,style:{width:r,height:l,margin:i/2},onClick:()=>u(c),children:n.display?s.jsx("div",{className:"card-content",children:s.jsx(me,{data:n.display,style:{width:"100%",height:"100%"}})}):s.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const Pe=E.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-B37Lr7Hg.js","./index-DTb1YjkO.js","./index-Cp6LwWOU.css"])))=>i.map(i=>d[i]);
2
+ import{r as p,cv as F,c5 as X,cw as H,cx as q,aP as G,aQ as O,j as s,n as E,P as j,E as Q,aT as V,e as J,cy as K,v as _,K as x,cz as Y,W as Z,B as I,bc as ee,k as M,cA as $,g as te,cB as se,bB as ae,cC as oe,cD as ne,u as re,w as ie,ap as ce,bz as le,af as pe}from"./index-DTb1YjkO.js";import{d as de}from"./ViewList-CPkfx4gI.js";import{d as ue}from"./Done-2EsU1aO2.js";import{N as me}from"./index-uw3m84Z2.js";import{w as fe}from"./wrap-locale-B35eVgy7.js";import{g as he}from"./get-safe-url-BHhOK-87.js";import{S as xe,a as ge,b as ve}from"./Stepper-CEe-v4P_.js";import"./emotion-react.browser.esm--gIypTeg.js";var P=function(t){if(!t)return 0;var r=q(t).valueOf()-Date.now();return r<0?0:r},be=function(t){return{days:Math.floor(t/864e5),hours:Math.floor(t/36e5)%24,minutes:Math.floor(t/6e4)%60,seconds:Math.floor(t/1e3)%60,milliseconds:Math.floor(t)%1e3}},we=function(t){t===void 0&&(t={});var r=t||{},l=r.leftTime,i=r.targetDate,d=r.interval,v=d===void 0?1e3:d,b=r.onEnd,g=p.useMemo(function(){return F(l)&&l>0?Date.now()+l:void 0},[l]),a="leftTime"in t?g:i,m=X(p.useState(function(){return P(a)}),2),f=m[0],u=m[1],o=H(b);p.useEffect(function(){if(!a){u(0);return}u(P(a));var w=setInterval(function(){var n,c=P(a);u(c),c===0&&(clearInterval(w),(n=o.current)===null||n===void 0||n.call(o))},v);return function(){return clearInterval(w)}},[a,v]);var y=p.useMemo(function(){return be(f)},[f]);return[f,y]},k={},ye=O;Object.defineProperty(k,"__esModule",{value:!0});var R=k.default=void 0,je=ye(G()),Se=s;R=k.default=(0,je.default)((0,Se.jsx)("path",{d:"M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z"}),"GetApp");function T({list:t,width:r,height:l,cardSpace:i,onSelect:d,defaultIndex:v}){const[b,g]=p.useState(0),[a,m]=p.useState(0),f=p.useRef(null),u=n=>{if(n<0||n>t.length-1)return;g(n);const c=f.current.clientWidth;m(n*(r+i)-(c-r)/2+i*.5),d(n)};p.useEffect(()=>{u(v);const n=c=>c.preventDefault();f.current.addEventListener("touchmove",n,{passive:!1})},[]);let o;const y=n=>{o=n.touches[0].clientX},w=n=>{const c=n.changedTouches[0],S=o-c.clientX;Math.abs(S)>60&&(S>0?u(b+1):u(b-1))};return s.jsx(Pe,{ref:f,onTouchStart:y,onTouchEnd:w,children:s.jsx("div",{className:"card-container",style:{transform:`translate(${-a}px, 0)`},children:t.map((n,c)=>s.jsx("div",{className:`card-item ${c===b?"selected":""}`,style:{width:r,height:l,margin:i/2},onClick:()=>u(c),children:n.display?s.jsx("div",{className:"card-content",children:s.jsx(me,{data:n.display,style:{width:"100%",height:"100%"}})}):s.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const Pe=E.div`
3
3
  overflow: hidden;
4
4
  mask-image: linear-gradient(to left, transparent, black 3%, black 97%, transparent);
5
5
  overflow: hidden;
@@ -33,7 +33,7 @@ import{r as p,cv as F,c5 as X,cw as H,cx as q,aP as G,aQ as O,j as s,n as E,P as
33
33
  }
34
34
  }
35
35
  }
36
- `;T.propTypes={list:j.array,width:j.number,height:j.number,cardSpace:j.number,onSelect:j.func,defaultIndex:j.number};T.defaultProps={list:"",width:300,height:400,cardSpace:40,onSelect:()=>{},defaultIndex:0};function ke({icon:t,active:r,completed:l}){const i={1:s.jsx(de,{className:"step-icon"}),2:s.jsx(R,{className:"step-icon"}),3:s.jsx(ue,{className:"step-icon"})},d=["step-icon-w"];return r&&d.push("step-icon-w--active"),l&&d.push("step-icon-w--completed"),s.jsx("div",{className:d.join(" "),children:i[String(t)]})}function Te({SessionContext:t,webWalletUrl:r,createPassportSvg:l,passportColor:i,onLogin:d}){const{api:v,session:b}=p.useContext(t),g=Q(e=>e.breakpoints.down("sm")),a=V({user:null,passport:null,success:!1,activeStep:0}),m=p.useRef({sessionToken:"",refreshToken:""}),{setPassportId:f,clearPassportId:u}=ne(),{t:o,locale:y}=p.useContext(J),{wallet:w}=K(),[n,c]=p.useState(0),{searchParams:S}=new URL(window.location.href),C=()=>{a.activeStep++},W=e=>{a.user=e.user},A=()=>{C()},z=(e,h)=>{e!=null&&e.passportId&&f(e.passportId),e!=null&&e.sessionToken&&(m.current.sessionToken=h(e.sessionToken)),e!=null&&e.refreshToken&&(m.current.refreshToken=h(e.refreshToken)),a.success=!0,C()},B=async()=>{try{await b.logout()}catch(e){console.warn(e)}},D=async()=>{if(w&&$()){ae(()=>import("./index-Dmp8rYJ8.js").then(h=>h.i),__vite__mapDeps([0,1,2]),import.meta.url).then(h=>{h.call("arcClosePage")});return}await B(),oe(d)&&d({sessionToken:m.current.sessionToken,refreshToken:m.current.refreshToken});const e=S.get("redirect");if(e){window.location.replace(he(e));return}u(),window.location.replace("/")},U=e=>{a.passport=e.target.value},[N]=we({leftTime:n,onEnd:()=>{D()}}),L=[{label:o("lostPassport.recoverPassport"),content:()=>a.user?s.jsxs(x,{className:"select-passport",children:[s.jsxs(x,{my:1,display:"flex",alignItems:"center",className:"user-info",children:[s.jsx(Y,{src:a.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),s.jsxs(x,{children:[s.jsx(x,{className:"name",children:a.user.fullName}),s.jsx(x,{className:"did",mt:1,children:s.jsx(Z,{responsive:!g,compact:g,did:a.user.did})})]})]}),s.jsx("div",{children:s.jsx(T,{width:g?180:230,height:g?240:306,cardSpace:24,list:a.user.passportTypes.map(e=>({src:l({scope:e.scope,role:e.role,title:e.scope==="kyc"?e.name:e.title,issuer:e.issuer.name,issuerDid:e.issuer.id,ownerDid:a.user.did,ownerName:a.user.fullName,ownerAvatarUrl:a.user.avatar,preferredColor:i||"auto",extra:e.scope==="kyc"?{key:"Email",value:e.name}:void 0}),name:e.title,id:e.id,display:e.display})),onSelect:e=>U({target:{value:a.user.passportTypes[e].id}}),defaultIndex:0})}),s.jsx(x,{textAlign:"center",children:s.jsx(I,{variant:"contained",color:"primary",onClick:()=>A(),disabled:!a.passport,children:o("common.next")})})]}):s.jsx(_,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-list",forceConnected:!1,autoConnect:!1,checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:W,locale:y,messages:{title:o("lostPassport.recoverDialog.title"),scan:o("lostPassport.recoverDialog.scan"),confirm:o("lostPassport.recoverDialog.confirm"),success:o("lostPassport.recoverDialog.success")}})},{label:o("lostPassport.receivePassport"),content:()=>{var h;const e={receiverDid:a.user.did,passportId:a.passport,teamDid:((h=window==null?void 0:window.blocklet)==null?void 0:h.did)||""};return s.jsx(_,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-issue",checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:z,locale:y,messages:{title:`${o("lostPassport.receiveDialog.title")}`,scan:o("lostPassport.receiveDialog.scan"),confirm:o("lostPassport.receiveDialog.confirm"),success:o("lostPassport.receiveDialog.success")},extraParams:e})}},{label:o("common.complete"),content:()=>(n===0&&c(3e3),s.jsxs(x,{textAlign:"center",children:[s.jsx(x,{mb:3,color:"success.main",children:s.jsx(ee,{style:{fontSize:60}})}),s.jsx(M,{component:"p",variant:"body1",className:"subheader",children:o("issuePassport.dialog.success")}),s.jsx(M,{component:"p",variant:"body2",color:"gray",children:w&&$()?o("issuePassport.dialog.autoClose",{seconds:Math.round(N/1e3)}):o("issuePassport.dialog.autoJump",{seconds:Math.round(N/1e3)})}),s.jsx(I,{style:{marginTop:40},variant:"contained",color:"primary",onClick:D,children:o("issuePassport.dialog.loginWithPassport")})]}))}];return s.jsx(Ce,{children:s.jsxs("div",{className:"stepper",children:[s.jsx(xe,{className:"stepper-progress",alternativeLabel:!0,activeStep:a.activeStep,children:L.map(({label:e})=>s.jsx(ge,{children:s.jsx(ve,{StepIconComponent:ke,children:e})},e))}),s.jsx("div",{className:"stepper-content",children:L[a.activeStep].content()}),!a.success&&s.jsx(x,{textAlign:"center",fontSize:12,children:s.jsx(te,{href:"/",sx:{color:"#4598FA",textDecoration:"none"},children:o("lostPassport.return")})})]})})}const Ce=E(se)`
36
+ `;T.propTypes={list:j.array,width:j.number,height:j.number,cardSpace:j.number,onSelect:j.func,defaultIndex:j.number};T.defaultProps={list:"",width:300,height:400,cardSpace:40,onSelect:()=>{},defaultIndex:0};function ke({icon:t,active:r,completed:l}){const i={1:s.jsx(de,{className:"step-icon"}),2:s.jsx(R,{className:"step-icon"}),3:s.jsx(ue,{className:"step-icon"})},d=["step-icon-w"];return r&&d.push("step-icon-w--active"),l&&d.push("step-icon-w--completed"),s.jsx("div",{className:d.join(" "),children:i[String(t)]})}function Te({SessionContext:t,webWalletUrl:r,createPassportSvg:l,passportColor:i,onLogin:d}){const{api:v,session:b}=p.useContext(t),g=Q(e=>e.breakpoints.down("sm")),a=V({user:null,passport:null,success:!1,activeStep:0}),m=p.useRef({sessionToken:"",refreshToken:""}),{setPassportId:f,clearPassportId:u}=ne(),{t:o,locale:y}=p.useContext(J),{wallet:w}=K(),[n,c]=p.useState(0),{searchParams:S}=new URL(window.location.href),C=()=>{a.activeStep++},W=e=>{a.user=e.user},A=()=>{C()},z=(e,h)=>{e!=null&&e.passportId&&f(e.passportId),e!=null&&e.sessionToken&&(m.current.sessionToken=h(e.sessionToken)),e!=null&&e.refreshToken&&(m.current.refreshToken=h(e.refreshToken)),a.success=!0,C()},B=async()=>{try{await b.logout()}catch(e){console.warn(e)}},D=async()=>{if(w&&$()){ae(()=>import("./index-B37Lr7Hg.js").then(h=>h.i),__vite__mapDeps([0,1,2]),import.meta.url).then(h=>{h.call("arcClosePage")});return}await B(),oe(d)&&d({sessionToken:m.current.sessionToken,refreshToken:m.current.refreshToken});const e=S.get("redirect");if(e){window.location.replace(he(e));return}u(),window.location.replace("/")},U=e=>{a.passport=e.target.value},[N]=we({leftTime:n,onEnd:()=>{D()}}),L=[{label:o("lostPassport.recoverPassport"),content:()=>a.user?s.jsxs(x,{className:"select-passport",children:[s.jsxs(x,{my:1,display:"flex",alignItems:"center",className:"user-info",children:[s.jsx(Y,{src:a.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),s.jsxs(x,{children:[s.jsx(x,{className:"name",children:a.user.fullName}),s.jsx(x,{className:"did",mt:1,children:s.jsx(Z,{responsive:!g,compact:g,did:a.user.did})})]})]}),s.jsx("div",{children:s.jsx(T,{width:g?180:230,height:g?240:306,cardSpace:24,list:a.user.passportTypes.map(e=>({src:l({scope:e.scope,role:e.role,title:e.scope==="kyc"?e.name:e.title,issuer:e.issuer.name,issuerDid:e.issuer.id,ownerDid:a.user.did,ownerName:a.user.fullName,ownerAvatarUrl:a.user.avatar,preferredColor:i||"auto",extra:e.scope==="kyc"?{key:"Email",value:e.name}:void 0}),name:e.title,id:e.id,display:e.display})),onSelect:e=>U({target:{value:a.user.passportTypes[e].id}}),defaultIndex:0})}),s.jsx(x,{textAlign:"center",children:s.jsx(I,{variant:"contained",color:"primary",onClick:()=>A(),disabled:!a.passport,children:o("common.next")})})]}):s.jsx(_,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-list",forceConnected:!1,autoConnect:!1,checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:W,locale:y,messages:{title:o("lostPassport.recoverDialog.title"),scan:o("lostPassport.recoverDialog.scan"),confirm:o("lostPassport.recoverDialog.confirm"),success:o("lostPassport.recoverDialog.success")}})},{label:o("lostPassport.receivePassport"),content:()=>{var h;const e={receiverDid:a.user.did,passportId:a.passport,teamDid:((h=window==null?void 0:window.blocklet)==null?void 0:h.did)||""};return s.jsx(_,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-issue",checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:z,locale:y,messages:{title:`${o("lostPassport.receiveDialog.title")}`,scan:o("lostPassport.receiveDialog.scan"),confirm:o("lostPassport.receiveDialog.confirm"),success:o("lostPassport.receiveDialog.success")},extraParams:e})}},{label:o("common.complete"),content:()=>(n===0&&c(3e3),s.jsxs(x,{textAlign:"center",children:[s.jsx(x,{mb:3,color:"success.main",children:s.jsx(ee,{style:{fontSize:60}})}),s.jsx(M,{component:"p",variant:"body1",className:"subheader",children:o("issuePassport.dialog.success")}),s.jsx(M,{component:"p",variant:"body2",color:"gray",children:w&&$()?o("issuePassport.dialog.autoClose",{seconds:Math.round(N/1e3)}):o("issuePassport.dialog.autoJump",{seconds:Math.round(N/1e3)})}),s.jsx(I,{style:{marginTop:40},variant:"contained",color:"primary",onClick:D,children:o("issuePassport.dialog.loginWithPassport")})]}))}];return s.jsx(Ce,{children:s.jsxs("div",{className:"stepper",children:[s.jsx(xe,{className:"stepper-progress",alternativeLabel:!0,activeStep:a.activeStep,children:L.map(({label:e})=>s.jsx(ge,{children:s.jsx(ve,{StepIconComponent:ke,children:e})},e))}),s.jsx("div",{className:"stepper-content",children:L[a.activeStep].content()}),!a.success&&s.jsx(x,{textAlign:"center",fontSize:12,children:s.jsx(te,{href:"/",sx:{color:"#4598FA",textDecoration:"none"},children:o("lostPassport.return")})})]})})}const Ce=E(se)`
37
37
  padding-top: 46px;
38
38
  padding-bottom: 46px;
39
39
  height: 100%;
@@ -1 +1 @@
1
- import{u as f,j as s,C as d,x as w,aA as v,ct as C,cu as u,K as j,bz as I,af as P,A as S}from"./index-BOLfvqKF.js";import{I as R}from"./invitation-DurHrtHf.js";import{g as T}from"./get-safe-url-aH9mMJx2.js";import"./index-Z5lc5lIc.js";import"./index-IW9KB94O.js";import"./emotion-react.browser.esm-BnQsp-2e.js";import"./index-C5r6y0B-.js";import"./sdk-DuEQLs4j.js";import"./wrap-locale-mYykcBLv.js";function k(n){const{searchParams:i}=new URL(window.location.href),g=w(),{api:a,session:r}=v(),{info:l}=f(),c=i.get("redirect"),p=i.get("id"),e=C(async()=>{if(!p)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:p,mode:"issue-passport"}});return t}),m=u(()=>{if(e.error)throw e.error;return e==null?void 0:e.data}),h=u(async(t,x=o=>o)=>{t&&(t.sessionToken&&P(x(t.sessionToken)),await r.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?g(o,{replace:!0}):window.location.href=T(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return e.loading?s.jsx(d,{}):s.jsx(j,{className:"page-invite",sx:{width:"100vw",height:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#f6f8fa",overflow:"auto",padding:"20px"},children:s.jsx(R,{...n,action:"issue-passport",getDataFn:m,createPassportSvg:t=>I(t,l),checkFn:a.get,onLoginSuccess:h,passportColor:"default",onLogin:r.login})})}function b(){return f().loading?s.jsx(d,{}):s.jsx(k,{})}export{b as default};
1
+ import{u as f,j as s,C as d,x as w,aA as v,ct as C,cu as u,K as j,bz as I,af as P,A as S}from"./index-DTb1YjkO.js";import{I as R}from"./invitation-BAovnHWT.js";import{g as T}from"./get-safe-url-ZQAisLez.js";import"./index-CIeEDIRZ.js";import"./index-uw3m84Z2.js";import"./emotion-react.browser.esm--gIypTeg.js";import"./index-CZplOWEN.js";import"./sdk-gxKU3x6m.js";import"./wrap-locale-B35eVgy7.js";function k(n){const{searchParams:i}=new URL(window.location.href),g=w(),{api:a,session:r}=v(),{info:l}=f(),c=i.get("redirect"),p=i.get("id"),e=C(async()=>{if(!p)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:p,mode:"issue-passport"}});return t}),m=u(()=>{if(e.error)throw e.error;return e==null?void 0:e.data}),h=u(async(t,x=o=>o)=>{t&&(t.sessionToken&&P(x(t.sessionToken)),await r.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?g(o,{replace:!0}):window.location.href=T(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return e.loading?s.jsx(d,{}):s.jsx(j,{className:"page-invite",sx:{width:"100vw",height:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#f6f8fa",overflow:"auto",padding:"20px"},children:s.jsx(R,{...n,action:"issue-passport",getDataFn:m,createPassportSvg:t=>I(t,l),checkFn:a.get,onLoginSuccess:h,passportColor:"default",onLogin:r.login})})}function b(){return f().loading?s.jsx(d,{}):s.jsx(k,{})}export{b as default};
@@ -1,4 +1,4 @@
1
- import{r as y,u as J,_ as Me,aJ as ii,j as e,A as D,aK as In,aL as pr,aM as oi,aN as Ln,aO as rt,aP as Ce,aQ as Se,P as f,n as re,m as z,ae as le,aR as On,aS as ai,aT as Fn,aU as si,y as se,M as Nn,k as A,t as G,aB as pe,aV as Oe,C as Y,V as je,B as X,aW as gr,X as xe,K as q,e as Kt,R as it,aX as li,d as Yt,aY as $e,aZ as fe,ab as ci,a_ as di,a$ as ui,a2 as mi,x as hr,W as $n,T as Un,h as ne,b0 as Vt,a as Nt,Q as Z,b as pt,b1 as xr,b2 as yr,U as br,a4 as $t,b3 as fi,b4 as pi,b5 as gi,b6 as hi,b7 as ot,b8 as vr,a9 as xi,H as yi,b9 as bi,aI as Ze,ba as vi,aa as Et,a7 as At,bb as ji,a8 as Ut,g as Xt,I as wi,bc as Ci,bd as jr,be as Ee,bf as Ae,bg as Si,bh as Di,D as wr,s as zt,al as _i,f as ki,bi as Ri,bj as zn,am as Ti,bk as Pi,bl as Cr,bm as te,bn as Ei,S as Bn,p as Mn,l as Wn,bo as Ai,bp as Ii}from"./index-BOLfvqKF.js";import{T as Li}from"./index-BCGKopWm.js";import{d as Oi}from"./ArrowDropDown-CJZPcYMj.js";import{u as Qt,C as M,a as qn}from"./index.esm-Bn-iehLo.js";import{S as ae}from"./switch-control-DwgD_U7I.js";import{P as ie}from"./permission-BQtaoI3I.js";import{D as Sr,g as Fi}from"./index-Dow64Z2x.js";import{d as Dr}from"./Link-CI9SWqj5.js";import{d as we}from"./Delete-DKeOWzoo.js";import{D as gt}from"./delete-confirm-CCMGtPBw.js";import{I as at}from"./index-D732T1aT.js";import{s as Ni}from"./logo-BKA11TRi.js";import{R as _r,a as Bt,b as $i,W as Je}from"./url-evaluation-DiN5Q08e.js";import{_ as Ui}from"./useLocalStorage-DPYKzz1_.js";import{d as zi}from"./Refresh-C0Iz2zZt.js";import{L as Bi}from"./LoadingButton-DAtzlWSB.js";import{C as Mi,R as Wi,d as kr}from"./Public-BTdEMtHi.js";import{d as Ue}from"./Add-BaepTMyl.js";import{B as Rr,D as Hn}from"./status-q1EdEhzw.js";import{i as qi}from"./is-path-prefix-equal-CYEALK7U.js";import{d as Hi}from"./ChevronRight-BJDD27JD.js";import{d as Gi}from"./MoreVert-DqeE3_Hd.js";import{d as Tr}from"./Edit-CcJpZVnD.js";import{d as Ki}from"./CallMerge-BmooQIj9.js";import{C as Yi}from"./CardContent-DztUyw0g.js";import{w as Vi}from"./withStyles-zmjsbKsz.js";import{S as Xi}from"./Slider-BjpE1rv2.js";import"./index-BuMTt7NP.js";import"./Switch-DSS8JChR.js";import"./TableRow-DQuCW6hn.js";import"./useThemeProps-DJJZjixl.js";import"./emotion-react.browser.esm-BnQsp-2e.js";import"./ViewColumn-BCvqBjPt.js";import"./Search-DBiDYaX1.js";import"./Clear-BxwDIGi1.js";import"./index-wqaqDly9.js";import"./TableSearch-C6AKfDSr.js";import"./click-to-copy-CgzyQB5V.js";const ve="Dashboard",Pr=y.createContext({}),{Provider:Qi,Consumer:Hs}=Pr,Gn=[ve,D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP],Zi=(t,n)=>{if(t.name===D.DOMAIN_FOR_DEFAULT_SITE)return-1;if(n.name===D.DOMAIN_FOR_DEFAULT_SITE)return 1;const r=Gn.includes(t.name),i=Gn.includes(n.name);return r&&i?Ln(t.name,n.name):r?-1:i?1:Ln(t.name,n.name)},Ji=({sites:t,nodePort:n})=>{const r=window.location.hostname,o=(t||[]).map(a=>{const{id:s,rules:d=[],corsAllowedOrigins:x=[]}=a;let{domain:c,domainAliases:u}=a;u=u||[],[D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP].includes(c)&&(c=ve,u.find(w=>w.value===r)||u.unshift({protected:!1,value:r}));const p={id:s,name:c,type:"domain",items:[],domainAliases:u,isProtected:a.isProtected,corsAllowedOrigins:x};return(d||[]).forEach(w=>{const{id:j,isProtected:R,from:{pathPrefix:v},to:S}=w;if(S.type===D.ROUTING_RULE_TYPES.BLOCKLET){let _="";Number.parseInt(S.port,10)===Number.parseInt(n,10)?(_="Blocklet Server Dashboard",S.type=D.ROUTING_RULE_TYPES.DAEMON):_=S.did,p.items.push({id:j,name:In(v||"/"),title:_,type:"rule",isProtected:R,pathPrefix:v,to:S})}else p.items.push({id:j,pathPrefix:v,name:In(v||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:R,to:S})}),p.items=pr(p.items,w=>w.name),p}).sort(Zi),l=o.reduce((a,s)=>{let{name:d}=s;return d.endsWith(D.BLOCKLET_SITE_GROUP_SUFFIX)&&([d]=d.split(".")),a[d]={...s,rules:s.items},a},{});return{sites:o,siteMap:l}},eo=({did:t,domain:n,mountPoint:r,siteMap:i,params:o}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const a=n||(l.domainAliases||[])[0];if(!a)return null;let s=r;if(!s){const d=l.rules.filter(x=>!x.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];s=d?d.name:"/"}return rt(a.value,s,o)},to=({did:t,mountPoint:n,siteMap:r,params:i}={})=>{if(!r)return[];const o=r[t];if(!o)return[];const l=o.domainAliases||[];if(!l.length)return[];let a=n;if(!a){const s=o.rules.filter(d=>!d.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];a=s?s.name:"/"}return l.map(s=>rt(s.value,a,i))},no=t=>{const n=t.map(i=>i.domain).filter(i=>![D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE].includes(i));let r=[];return t.forEach(i=>r.push(...i.domainAliases||[])),r=r.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:n,domainsAliases:r}};function Kn({children:t}){const{api:n,info:r}=J(),[i,o]=y.useState([]),[l,a]=y.useState([]),[s,d]=y.useState([]),x=Me(async()=>{const{sites:O}=await n.getRoutingSites({input:{snapshotHash:""}}),b=O||[];await Promise.all(b.map(async g=>(g.domainAliases=await ii(g.domainAliases,{getIP:oi}),g)));const m=no(b);o(b),a(m.domains),d([window.location.hostname,...m.domains,...m.domainsAliases.map(g=>g.value)])},[r]),c=(O,b)=>{o(m=>m.map(g=>g.id===O?b.domain?b:{...b,domain:g.domain}:g))},u=O=>n.takeRoutingSnapshot({input:{dryRun:!1,message:encodeURIComponent(O)}}),p=async O=>{const b=await n.addRoutingSite({input:O});o(i.concat(b.site))},w=async(O,b)=>{const m=await n.updateRoutingSite({input:{id:O,...b}});if(m.site&&m.site.id){const g=i.findIndex(k=>k.id===m.site.id);g!==-1&&(i.splice(g,1,m.site),o([].concat(i)))}},j=async O=>{await n.deleteRoutingSite({input:{id:O}}),o(i.filter(b=>b.id!==O))},R=async(O,b,m)=>{const g=await n.addDomainAlias({input:{id:O,domainAlias:b,force:m}});c(O,g.site)},v=async(O,b)=>{const m=await n.deleteDomainAlias({input:{id:O,domainAlias:b}});c(O,m.site)},S=async(O,b)=>{const{site:m}=await n.addRoutingRule({input:{id:O,rule:b}});c(O,m)},_=async(O,b)=>{const{site:m}=await n.updateRoutingRule({input:{id:O,rule:b}});c(O,m)},C=async(O,b)=>{const{site:m}=await n.deleteRoutingRule({input:{id:O,ruleId:b}});c(O,m)},h={loading:x.loading,error:x.error,refresh:x.retry,api:n,actions:{addSite:p,updateSite:w,deleteSite:j,addDomainAlias:R,deleteDomainAlias:v,takeSnapshot:u,addRule:S,updateRule:_,deleteRule:C}},{sites:P,siteMap:I}=Ji({sites:i,nodePort:r.port});return h.sites=P,h.siteMap=I,h.domains=l,h.allDomains=s,h.getBlockletUrl=({did:O,domain:b,mountPoint:m,params:g})=>eo({did:O,domain:b,mountPoint:m,siteMap:h.siteMap,params:g}),h.getBlockletUrls=({did:O,mountPoint:b,params:m})=>to({did:O,mountPoint:b,siteMap:h.siteMap,params:m}),e.jsx(Qi,{value:{routing:h},children:t})}function ue(){const{routing:t}=y.useContext(Pr);return t}function Zt(t){const n=[D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE,D.DOMAIN_FOR_IP_SITE];return typeof window<"u"&&typeof window.location<"u"&&n.push(window.location.hostname),n.includes(t)}var Jt={},ro=Se;Object.defineProperty(Jt,"__esModule",{value:!0});var Er=Jt.default=void 0,io=ro(Ce()),oo=e;Er=Jt.default=(0,io.default)((0,oo.jsx)("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp");function ao(){return null}function en({confirm:t}){const[n,r]=y.useState(null),{t:i}=z(),o=()=>{r(null)},l=async s=>{if(s){let d=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d==="/"?On.push(`${s.pathname}`):(d.endsWith("/")&&(d=d.substring(0,d.length-1)),On.push(`${d}${s.pathname}`)),window.location.reload()}},a=(s,...d)=>{let x=typeof t=="function"?t(s,...d):t;return x?(typeof x=="string"&&(x={description:x}),r({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>o(),...x}),!1):!0};return e.jsxs(so,{children:[e.jsx(ao,{message:a}),n&&e.jsx(le,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})]})}en.propTypes={confirm:f.oneOfType([f.object,f.string,f.func])};en.defaultProps={confirm:null};const so=re.div`
1
+ import{r as y,u as J,_ as Me,aJ as ii,j as e,A as D,aK as In,aL as pr,aM as oi,aN as Ln,aO as rt,aP as Ce,aQ as Se,P as f,n as re,m as z,ae as le,aR as On,aS as ai,aT as Fn,aU as si,y as se,M as Nn,k as A,t as G,aB as pe,aV as Oe,C as Y,V as je,B as X,aW as gr,X as xe,K as q,e as Kt,R as it,aX as li,d as Yt,aY as $e,aZ as fe,ab as ci,a_ as di,a$ as ui,a2 as mi,x as hr,W as $n,T as Un,h as ne,b0 as Vt,a as Nt,Q as Z,b as pt,b1 as xr,b2 as yr,U as br,a4 as $t,b3 as fi,b4 as pi,b5 as gi,b6 as hi,b7 as ot,b8 as vr,a9 as xi,H as yi,b9 as bi,aI as Ze,ba as vi,aa as Et,a7 as At,bb as ji,a8 as Ut,g as Xt,I as wi,bc as Ci,bd as jr,be as Ee,bf as Ae,bg as Si,bh as Di,D as wr,s as zt,al as _i,f as ki,bi as Ri,bj as zn,am as Ti,bk as Pi,bl as Cr,bm as te,bn as Ei,S as Bn,p as Mn,l as Wn,bo as Ai,bp as Ii}from"./index-DTb1YjkO.js";import{T as Li}from"./index-DzK6OW-H.js";import{d as Oi}from"./ArrowDropDown-BCCxOUNE.js";import{u as Qt,C as M,a as qn}from"./index.esm-CB-7UGfI.js";import{S as ae}from"./switch-control-uwHD90eP.js";import{P as ie}from"./permission-DtbkcHFU.js";import{D as Sr,g as Fi}from"./index-CFc2cpAq.js";import{d as Dr}from"./Link-CiUEO3cQ.js";import{d as we}from"./Delete-P4B2dduO.js";import{D as gt}from"./delete-confirm-qy4uClf5.js";import{I as at}from"./index-BLrsx8oH.js";import{s as Ni}from"./logo-BKA11TRi.js";import{R as _r,a as Bt,b as $i,W as Je}from"./url-evaluation-DQ262LSg.js";import{_ as Ui}from"./useLocalStorage-DQZ59j66.js";import{d as zi}from"./Refresh-C1kA8imS.js";import{L as Bi}from"./LoadingButton-B3es9INs.js";import{C as Mi,R as Wi,d as kr}from"./Public-BtS6bdiD.js";import{d as Ue}from"./Add-CSGWebd7.js";import{B as Rr,D as Hn}from"./status-CoaEXqC8.js";import{i as qi}from"./is-path-prefix-equal-C80Jhu_q.js";import{d as Hi}from"./ChevronRight-BtkdX9A9.js";import{d as Gi}from"./MoreVert-C_Ck3fn9.js";import{d as Tr}from"./Edit-frf3Fbx4.js";import{d as Ki}from"./CallMerge-weq4zXp-.js";import{C as Yi}from"./CardContent-CTAfwoUe.js";import{w as Vi}from"./withStyles-_FcG1bkA.js";import{S as Xi}from"./Slider-B0hY7ZYB.js";import"./index-C_5on_zt.js";import"./Switch-D3iZUzda.js";import"./TableRow-CQ8RBtid.js";import"./useThemeProps-CtXzBlYo.js";import"./emotion-react.browser.esm--gIypTeg.js";import"./ViewColumn-CcQluqhl.js";import"./Search-CUm1f8xo.js";import"./Clear-D0I7uWhD.js";import"./index-omP-_XYV.js";import"./TableSearch-Uk9kIt7i.js";import"./click-to-copy-BBcwV5Sv.js";const ve="Dashboard",Pr=y.createContext({}),{Provider:Qi,Consumer:Hs}=Pr,Gn=[ve,D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP],Zi=(t,n)=>{if(t.name===D.DOMAIN_FOR_DEFAULT_SITE)return-1;if(n.name===D.DOMAIN_FOR_DEFAULT_SITE)return 1;const r=Gn.includes(t.name),i=Gn.includes(n.name);return r&&i?Ln(t.name,n.name):r?-1:i?1:Ln(t.name,n.name)},Ji=({sites:t,nodePort:n})=>{const r=window.location.hostname,o=(t||[]).map(a=>{const{id:s,rules:d=[],corsAllowedOrigins:x=[]}=a;let{domain:c,domainAliases:u}=a;u=u||[],[D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP].includes(c)&&(c=ve,u.find(w=>w.value===r)||u.unshift({protected:!1,value:r}));const p={id:s,name:c,type:"domain",items:[],domainAliases:u,isProtected:a.isProtected,corsAllowedOrigins:x};return(d||[]).forEach(w=>{const{id:j,isProtected:R,from:{pathPrefix:v},to:S}=w;if(S.type===D.ROUTING_RULE_TYPES.BLOCKLET){let _="";Number.parseInt(S.port,10)===Number.parseInt(n,10)?(_="Blocklet Server Dashboard",S.type=D.ROUTING_RULE_TYPES.DAEMON):_=S.did,p.items.push({id:j,name:In(v||"/"),title:_,type:"rule",isProtected:R,pathPrefix:v,to:S})}else p.items.push({id:j,pathPrefix:v,name:In(v||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:R,to:S})}),p.items=pr(p.items,w=>w.name),p}).sort(Zi),l=o.reduce((a,s)=>{let{name:d}=s;return d.endsWith(D.BLOCKLET_SITE_GROUP_SUFFIX)&&([d]=d.split(".")),a[d]={...s,rules:s.items},a},{});return{sites:o,siteMap:l}},eo=({did:t,domain:n,mountPoint:r,siteMap:i,params:o}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const a=n||(l.domainAliases||[])[0];if(!a)return null;let s=r;if(!s){const d=l.rules.filter(x=>!x.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];s=d?d.name:"/"}return rt(a.value,s,o)},to=({did:t,mountPoint:n,siteMap:r,params:i}={})=>{if(!r)return[];const o=r[t];if(!o)return[];const l=o.domainAliases||[];if(!l.length)return[];let a=n;if(!a){const s=o.rules.filter(d=>!d.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];a=s?s.name:"/"}return l.map(s=>rt(s.value,a,i))},no=t=>{const n=t.map(i=>i.domain).filter(i=>![D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE].includes(i));let r=[];return t.forEach(i=>r.push(...i.domainAliases||[])),r=r.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:n,domainsAliases:r}};function Kn({children:t}){const{api:n,info:r}=J(),[i,o]=y.useState([]),[l,a]=y.useState([]),[s,d]=y.useState([]),x=Me(async()=>{const{sites:O}=await n.getRoutingSites({input:{snapshotHash:""}}),b=O||[];await Promise.all(b.map(async g=>(g.domainAliases=await ii(g.domainAliases,{getIP:oi}),g)));const m=no(b);o(b),a(m.domains),d([window.location.hostname,...m.domains,...m.domainsAliases.map(g=>g.value)])},[r]),c=(O,b)=>{o(m=>m.map(g=>g.id===O?b.domain?b:{...b,domain:g.domain}:g))},u=O=>n.takeRoutingSnapshot({input:{dryRun:!1,message:encodeURIComponent(O)}}),p=async O=>{const b=await n.addRoutingSite({input:O});o(i.concat(b.site))},w=async(O,b)=>{const m=await n.updateRoutingSite({input:{id:O,...b}});if(m.site&&m.site.id){const g=i.findIndex(k=>k.id===m.site.id);g!==-1&&(i.splice(g,1,m.site),o([].concat(i)))}},j=async O=>{await n.deleteRoutingSite({input:{id:O}}),o(i.filter(b=>b.id!==O))},R=async(O,b,m)=>{const g=await n.addDomainAlias({input:{id:O,domainAlias:b,force:m}});c(O,g.site)},v=async(O,b)=>{const m=await n.deleteDomainAlias({input:{id:O,domainAlias:b}});c(O,m.site)},S=async(O,b)=>{const{site:m}=await n.addRoutingRule({input:{id:O,rule:b}});c(O,m)},_=async(O,b)=>{const{site:m}=await n.updateRoutingRule({input:{id:O,rule:b}});c(O,m)},C=async(O,b)=>{const{site:m}=await n.deleteRoutingRule({input:{id:O,ruleId:b}});c(O,m)},h={loading:x.loading,error:x.error,refresh:x.retry,api:n,actions:{addSite:p,updateSite:w,deleteSite:j,addDomainAlias:R,deleteDomainAlias:v,takeSnapshot:u,addRule:S,updateRule:_,deleteRule:C}},{sites:P,siteMap:I}=Ji({sites:i,nodePort:r.port});return h.sites=P,h.siteMap=I,h.domains=l,h.allDomains=s,h.getBlockletUrl=({did:O,domain:b,mountPoint:m,params:g})=>eo({did:O,domain:b,mountPoint:m,siteMap:h.siteMap,params:g}),h.getBlockletUrls=({did:O,mountPoint:b,params:m})=>to({did:O,mountPoint:b,siteMap:h.siteMap,params:m}),e.jsx(Qi,{value:{routing:h},children:t})}function ue(){const{routing:t}=y.useContext(Pr);return t}function Zt(t){const n=[D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE,D.DOMAIN_FOR_IP_SITE];return typeof window<"u"&&typeof window.location<"u"&&n.push(window.location.hostname),n.includes(t)}var Jt={},ro=Se;Object.defineProperty(Jt,"__esModule",{value:!0});var Er=Jt.default=void 0,io=ro(Ce()),oo=e;Er=Jt.default=(0,io.default)((0,oo.jsx)("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp");function ao(){return null}function en({confirm:t}){const[n,r]=y.useState(null),{t:i}=z(),o=()=>{r(null)},l=async s=>{if(s){let d=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d==="/"?On.push(`${s.pathname}`):(d.endsWith("/")&&(d=d.substring(0,d.length-1)),On.push(`${d}${s.pathname}`)),window.location.reload()}},a=(s,...d)=>{let x=typeof t=="function"?t(s,...d):t;return x?(typeof x=="string"&&(x={description:x}),r({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>o(),...x}),!1):!0};return e.jsxs(so,{children:[e.jsx(ao,{message:a}),n&&e.jsx(le,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})]})}en.propTypes={confirm:f.oneOfType([f.object,f.string,f.func])};en.defaultProps={confirm:null};const so=re.div`
2
2
  margin-bottom: 24px;
3
3
  .top-btns-alert {
4
4
  @media (max-width: ${t=>t.theme.breakpoints.values.sm}px) {
@@ -1,4 +1,4 @@
1
- import{r as o,Q as d,j as e,ep as c,ba as b,eb as I,bx as M,fk as E,fj as P,dq as p,fl as S}from"./index-BOLfvqKF.js";import{B as z}from"./ButtonGroup-jLU91Eto.js";function A(r){const{size:u="medium",color:s="primary",menu:a=[],children:i=null,variant:m="contained",onClick:f=P,menuButtonProps:x={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,C)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:C})):a,y=()=>{l(t=>!t)},k=t=>{n.current&&n.current.contains(t.target)||l(!1)},B=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:m,size:u,color:s,ref:n,...h,children:[typeof i=="function"?i():e.jsx(c,{onClick:f,color:s,children:i}),e.jsx(c,{onClick:y,color:s,...x,"aria-label":"more functions",children:e.jsx(b,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{children:e.jsx(M,{onClickAway:k,children:e.jsx(E,{onClick:B,children:g})})})})]})}A.Item=d;const L=p(z)`
1
+ import{r as o,Q as d,j as e,ep as c,ba as b,eb as I,bx as M,fk as E,fj as P,dq as p,fl as S}from"./index-DTb1YjkO.js";import{B as z}from"./ButtonGroup-ClVwTb7r.js";function A(r){const{size:u="medium",color:s="primary",menu:a=[],children:i=null,variant:m="contained",onClick:f=P,menuButtonProps:x={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,C)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:C})):a,y=()=>{l(t=>!t)},k=t=>{n.current&&n.current.contains(t.target)||l(!1)},B=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:m,size:u,color:s,ref:n,...h,children:[typeof i=="function"?i():e.jsx(c,{onClick:f,color:s,children:i}),e.jsx(c,{onClick:y,color:s,...x,"aria-label":"more functions",children:e.jsx(b,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{children:e.jsx(M,{onClickAway:k,children:e.jsx(E,{onClick:B,children:g})})})})]})}A.Item=d;const L=p(z)`
2
2
  > .MuiButtonBase-root:last-of-type {
3
3
  min-width: 2em;
4
4
  padding-left: 0;
@@ -1,4 +1,4 @@
1
- import{P as z,n as te,K as b,j as e,aZ as I,k as ue,ke as me,bl as fe,bq as re,m as ne,gJ as se,fR as ae,aT as oe,cu as x,y as C,t as g,kf as V,kg as Y,aY as Z,N as y,aB as he,B as F,cH as xe,a2 as pe,A as je,r as H,e as ge,bC as ve}from"./index-BOLfvqKF.js";import{T as ye}from"./index-BCGKopWm.js";import{u as le,C as j}from"./index.esm-Bn-iehLo.js";import{A as be,a as we,d as Re,b as Te}from"./collapse-Xins5ZhF.js";import{f as Se}from"./index-Dow64Z2x.js";import{u as ce}from"./blocklet-DiZeBiJN.js";import{S as Q}from"./Switch-DSS8JChR.js";function p({title:u,desc:r,sectionLeftSx:i,sectionRightSx:f,children:w,...h}){return e.jsx(Ee,{...h,children:e.jsxs(I,{className:"section",direction:{sm:"column",md:"row"},gap:{xs:3,md:6},children:[e.jsxs(b,{className:"section-left",sx:i,children:[e.jsx(ue,{className:"section-title",children:u}),e.jsx(b,{className:"section-desc",sx:{color:"text.secondary"},dangerouslySetInnerHTML:{__html:r}})]}),e.jsx(I,{className:"section-content",direction:"column",sx:{width:"100%",...f},children:w})]})})}p.propTypes={title:z.string.isRequired,children:z.node.isRequired,desc:z.string,sectionLeftSx:z.object,sectionRightSx:z.object};p.defaultProps={desc:"",sectionLeftSx:{width:"384px"},sectionRightSx:{}};const Ee=te(b)`
1
+ import{P as z,n as te,K as b,j as e,aZ as I,k as ue,ke as me,bl as fe,bq as re,m as ne,gJ as se,fR as ae,aT as oe,cu as x,y as C,t as g,kf as V,kg as Y,aY as Z,N as y,aB as he,B as F,cH as xe,a2 as pe,A as je,r as H,e as ge,bC as ve}from"./index-DTb1YjkO.js";import{T as ye}from"./index-DzK6OW-H.js";import{u as le,C as j}from"./index.esm-CB-7UGfI.js";import{A as be,a as we,d as Re,b as Te}from"./collapse-Cy01Qhtt.js";import{f as Se}from"./index-CFc2cpAq.js";import{u as ce}from"./blocklet-SKmr21o8.js";import{S as Q}from"./Switch-D3iZUzda.js";function p({title:u,desc:r,sectionLeftSx:i,sectionRightSx:f,children:w,...h}){return e.jsx(Ee,{...h,children:e.jsxs(I,{className:"section",direction:{sm:"column",md:"row"},gap:{xs:3,md:6},children:[e.jsxs(b,{className:"section-left",sx:i,children:[e.jsx(ue,{className:"section-title",children:u}),e.jsx(b,{className:"section-desc",sx:{color:"text.secondary"},dangerouslySetInnerHTML:{__html:r}})]}),e.jsx(I,{className:"section-content",direction:"column",sx:{width:"100%",...f},children:w})]})})}p.propTypes={title:z.string.isRequired,children:z.node.isRequired,desc:z.string,sectionLeftSx:z.object,sectionRightSx:z.object};p.defaultProps={desc:"",sectionLeftSx:{width:"384px"},sectionRightSx:{}};const Ee=te(b)`
2
2
  display: flex;
3
3
  align-items: flex-start;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{c0 as Ge,b$ as et,b8 as te,ce as ee,r as y,c1 as tt,b_ as ot,bY as Pe,j as e,c3 as st,c4 as nt,M as V,bq as M,ct as rt,y as B,X,bi as T,ge as Me,aU as Ue,b as _,lb as at,m as E,P as g,hD as it,w as ct,az as Ne,a2 as ge,an as lt,n as dt,k as C,e as ut,C as z,i as pt,al as mt,lc as J,h2 as G,ld as ft,K as j,aZ as W,aB as ye,A as R,g as ht,T as Q,du as gt,aP as je,aQ as be,Q as Y,aI as q,aa as H,a5 as xt,ep as St,b3 as yt,B as me,v as jt,G as Le,Y as We,bC as xe,z as bt}from"./index-BOLfvqKF.js";import{T as Ct}from"./index-BCGKopWm.js";import{u as A}from"./blocklet-DiZeBiJN.js";import{u as kt}from"./use-mobile-utJ7FsR-.js";import{b as Dt,u as Bt,D as wt,c as fe,a as Tt}from"./index-BlgBrilI.js";import"./index-xMJ_lTjJ.js";import"./index-BojVbZw0.js";import"./api-DJB2B_-t.js";import{c as $e,b as Et,u as It,C as Rt,D as vt,a as zt}from"./connect-to-CJ05ah0j.js";import{d as At,a as Pt,g as Lt,i as Ot,e as Se,f as _t,h as Mt,j as Ut}from"./spaces-BgnAkcnA.js";import{I as Nt}from"./index-D732T1aT.js";import{R as Wt}from"./index-30VVCODr.js";import{d as $t}from"./HelpOutline-DddyHTiw.js";import{D as Kt}from"./index-Dow64Z2x.js";import{x as Ft}from"./index-BJHGOv7L.js";import{d as Yt}from"./MoreHoriz-DAVefXBs.js";import{f as qt}from"./actions-B5wmKEDC.js";import{d as Ht}from"./DeleteOutline-BKxhOLzM.js";import{g as Oe}from"./get-safe-url-DO00hPju.js";import{S as Qt}from"./switch-control-DwgD_U7I.js";import{L as _e}from"./list-header-D5vsRPp7.js";import"./OpenInNew-2bjbGYSq.js";import"./ButtonGroup-jLU91Eto.js";import"./getValidReactChildren-D_5CTSB1.js";import"./TableRow-DQuCW6hn.js";import"./useThemeProps-DJJZjixl.js";import"./emotion-react.browser.esm-BnQsp-2e.js";import"./ViewColumn-BCvqBjPt.js";import"./Search-DBiDYaX1.js";import"./Clear-BxwDIGi1.js";import"./Delete-DKeOWzoo.js";import"./index-wqaqDly9.js";import"./MoreVert-DqeE3_Hd.js";import"./TableSearch-C6AKfDSr.js";import"./useLocalStorage-DPYKzz1_.js";import"./url-evaluation-DiN5Q08e.js";import"./permission-BQtaoI3I.js";import"./index-BuMTt7NP.js";import"./Switch-DSS8JChR.js";function Vt(t){return Ge("MuiIcon",t)}et("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Xt=["baseClassName","className","color","component","fontSize"],Zt=t=>{const{color:s,fontSize:n,classes:o}=t,a={root:["root",s!=="inherit"&&`color${ee(s)}`,`fontSize${ee(n)}`]};return nt(a,Vt,o)},Jt=te("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${ee(n.color)}`],s[`fontSize${ee(n.fontSize)}`]]}})(({theme:t,ownerState:s})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,fontSize:{inherit:"inherit",small:t.typography.pxToRem(20),medium:t.typography.pxToRem(24),large:t.typography.pxToRem(36)}[s.fontSize],color:{primary:(t.vars||t).palette.primary.main,secondary:(t.vars||t).palette.secondary.main,info:(t.vars||t).palette.info.main,success:(t.vars||t).palette.success.main,warning:(t.vars||t).palette.warning.main,action:(t.vars||t).palette.action.active,error:(t.vars||t).palette.error.main,disabled:(t.vars||t).palette.action.disabled,inherit:void 0}[s.color]})),Ce=y.forwardRef(function(s,n){const o=tt({props:s,name:"MuiIcon"}),{baseClassName:a="material-icons",className:r,color:i="inherit",component:l="span",fontSize:u="medium"}=o,c=ot(o,Xt),f=Pe({},o,{baseClassName:a,color:i,component:l,fontSize:u}),p=Zt(f);return e.jsx(Jt,Pe({as:l,className:st(a,"notranslate",p.root,r),ownerState:f,"aria-hidden":!0,ref:n},c))});Ce.muiName="Icon";async function Gt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const a=await Promise.all(n.map(async r=>{let{name:i}=r;const l=await At(r.endpoint);return!V(l)&&l!==i&&(i=l,o=!0),{...r,name:i}}));return o&&await Promise.all(a.filter(r=>r.did).map(r=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:r.did},spaceGateway:{...r}}}))),a}function eo({refresh:t}={}){var a;const{blocklet:s}=A(),n=(a=s==null?void 0:s.meta)==null?void 0:a.did,{api:o}=M();return rt(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){var i;(i=r==null?void 0:r.message)!=null&&i.includes("not logged")?console.warn(r):(console.error(r),B.error(X(r)))}})}function Ke({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var f;const{blocklet:o}=A(),[a,r]=y.useState([]),{api:i}=M(),[l,u]=y.useMemo(()=>n?[T(n).startOf("day").toISOString(),T(n).endOf("day").toISOString()]:[T().startOf("year").toISOString(),T().endOf("day").toISOString()],[n]),c=Me(async()=>{try{if(s(!0),!o){r([]);return}const{backups:p}=await i.getBlockletBackups({input:{did:o.meta.did,startTime:l,endTime:u}});r(p??[])}catch(p){console.error(p),B.error(X(p))}finally{s(!1)}},1e3);return Ue(async()=>{c()},[(f=o==null?void 0:o.meta)==null?void 0:f.did].concat(t)),{backups:a}}function to({appDid:t}){const{backups:s}=Ke(),[n,o]=y.useState({message:"",progress:0,completed:!1}),a=M(),{ws:{useSubscription:r}}=a;return r(_.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&o(()=>({...i}))},[t]),y.useEffect(()=>{var i;if(s!=null&&s.length&&at((i=s[0])==null?void 0:i.status)){const[l]=s;o(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[s]),n}function oo({deps:t=[],setLoading:s=()=>{}}={}){var l;const{blocklet:n}=A(),[o,a]=y.useState([]),{api:r}=M(),i=y.useCallback(Me(async()=>{var u;if(!r||!((u=n==null?void 0:n.meta)!=null&&u.did)){a([]);return}try{s(!0);const c=T(),f=c.subtract(1,"year"),{summary:p}=await r.getBlockletBackupSummary({input:{did:n.meta.did,startTime:f.toISOString(),endTime:c.toISOString()}});a(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),a([])}finally{s(!1)}},1e3),[]);return Ue(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:o}}const Fe=y.createContext({}),{Provider:so,Consumer:is}=Fe;function ke({children:t}){var K;const{t:s}=E(),{api:n}=M(),{blocklet:o}=A(),[a,r]=y.useState(null),[i,l]=y.useState(!1),{data:u,loading:c,mutate:f}=eo({refresh:i}),p=it(u),x=to({appDid:o==null?void 0:o.appDid}),h=y.useMemo(()=>Pt(o==null?void 0:o.environments),[o==null?void 0:o.environments]),[b,D]=y.useState(!1),[S,d]=y.useState(!1),{backups:se}=Ke({deps:[S,a],setLoading:D,backupDate:a}),[ne,re]=y.useState(!1),{backupSummary:ae}=oo({deps:[ne]}),[U,L]=y.useState(u==null?void 0:u.find(m=>m.endpoint===h)),I=(K=o==null?void 0:o.settings)==null?void 0:K.autoBackup,v=()=>{l(m=>!m)},ie=()=>{re(m=>!m)},ce=()=>{d(m=>!m)},$=async m=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:m}})},Z=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},le=async(m,N)=>{try{f(w=>{const O=[...w];return O.push({...m,loading:!0}),O}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:m}}),h!==N&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),L(m),v(),B.success(s("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),f(O=>[...O].filter(pe=>pe.did!==m.did)),w}},de=async m=>{m&&(m.endpoint===h&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await $({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),f(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),L(m),v())},ue=async m=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:m.did},spaceGateway:m}}),h!==m.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===h;return e.jsx(so,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:le,deleteSpaceGateway:de,updateSpaceGateway:ue,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:$,abortBlockletBackup:Z,backupEndpoint:h,backupProgress:x,backups:se,backupSummary:ae,refreshBackupSummary:ie,refreshBackups:ce,setBackupDate:r,backupsLoading:b,autoBackup:I},children:t})}ke.propTypes={children:g.any.isRequired};ke.defaultProps={};function P(){return y.useContext(Fe)}function oe({...t}){const{blocklet:s}=A(),{info:n}=M(),{t:o}=E(),a=$e({blocklet:s}),r=ct(n),{spaceGateways:i,addSpaceGateway:l}=P(),u={checkFn:Ne.create({baseURL:ge(window.location.origin,lt())}).get,webWalletUrl:r,extraParams:{appPid:s.appPid,appDid:a.appDid,appName:a.appName,appDescription:a.appDescription,appUrl:a.appUrl,referrer:a.referrer,scopes:a.scopes,nodeDid:n.did}},c=async({endpoint:p,name:x,did:h})=>{const b=await Lt(p);if(!await Ot(b)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(d=>d.endpoint===p)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await l({name:x,did:h,url:b,endpoint:p},p)},f=async({spaceGateway:p})=>{try{await c(p)}catch(x){console.error(x),B.error(X(x))}};return e.jsx(Dt,{...t,connectScope:"app",options:u,onSuccess:f})}oe.propTypes={};oe.defaultProps={};function Ye({...t}){const{t:s}=y.useContext(ut),{blocklet:n,loadingDiskInfo:o,actions:a}=A();if(y.useEffect(()=>{a==null||a.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const r=(u,c,f)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?pt(c):"empty"})]}),i=n.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),l=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(no,{component:"div",...t,children:l.map(u=>e.jsx(Nt,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return o?e.jsx(z,{}):e.jsx(C,{children:s("blocklet.diskInfo.empty")})}const no=dt(C)``;function De(){const{t}=E(),{setBackupDate:s,backupSummary:n}=P(),o=Bt({key:"lg"}),a=y.useRef(null),r=mt(),i=y.useCallback(c=>{s(c)},[s]),l=y.useMemo(()=>{const c=T().add(1,"day"),f=T().subtract(11,"month").startOf("month"),p=new Map(n.map(h=>[h.date,{date:h.date,successCount:h.successCount,errorCount:h.errorCount}])),x=[];for(let h=f.clone();T(h).isBefore(c);h=h.add(1,"day")){const b=h.format("YYYY-MM-DD");x.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return x},[n]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:d}=l[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${d}</div>`].join(`
1
+ import{c0 as Ge,b$ as et,b8 as te,ce as ee,r as y,c1 as tt,b_ as ot,bY as Pe,j as e,c3 as st,c4 as nt,M as V,bq as M,ct as rt,y as B,X,bi as T,ge as Me,aU as Ue,b as _,lb as at,m as E,P as g,hD as it,w as ct,az as Ne,a2 as ge,an as lt,n as dt,k as C,e as ut,C as z,i as pt,al as mt,lc as J,h2 as G,ld as ft,K as j,aZ as W,aB as ye,A as R,g as ht,T as Q,du as gt,aP as je,aQ as be,Q as Y,aI as q,aa as H,a5 as xt,ep as St,b3 as yt,B as me,v as jt,G as Le,Y as We,bC as xe,z as bt}from"./index-DTb1YjkO.js";import{T as Ct}from"./index-DzK6OW-H.js";import{u as A}from"./blocklet-SKmr21o8.js";import{u as kt}from"./use-mobile-BoYyduuc.js";import{b as Dt,u as Bt,D as wt,c as fe,a as Tt}from"./index-BkStkax6.js";import"./index-DnLtwT4P.js";import"./index-BojVbZw0.js";import"./api-gAVz4YtD.js";import{c as $e,b as Et,u as It,C as Rt,D as vt,a as zt}from"./connect-to-BbdcjX_x.js";import{d as At,a as Pt,g as Lt,i as Ot,e as Se,f as _t,h as Mt,j as Ut}from"./spaces-Bqb0c1IC.js";import{I as Nt}from"./index-BLrsx8oH.js";import{R as Wt}from"./index-CyCivdc5.js";import{d as $t}from"./HelpOutline-CBv7x3VM.js";import{D as Kt}from"./index-CFc2cpAq.js";import{x as Ft}from"./index-BJHGOv7L.js";import{d as Yt}from"./MoreHoriz-3d6Yp_t-.js";import{f as qt}from"./actions-CvZtuIOm.js";import{d as Ht}from"./DeleteOutline-EQ9bHspP.js";import{g as Oe}from"./get-safe-url-BHhOK-87.js";import{S as Qt}from"./switch-control-uwHD90eP.js";import{L as _e}from"./list-header-D5Klosqn.js";import"./OpenInNew-D79h4Iot.js";import"./ButtonGroup-ClVwTb7r.js";import"./getValidReactChildren-B-b9MOMT.js";import"./TableRow-CQ8RBtid.js";import"./useThemeProps-CtXzBlYo.js";import"./emotion-react.browser.esm--gIypTeg.js";import"./ViewColumn-CcQluqhl.js";import"./Search-CUm1f8xo.js";import"./Clear-D0I7uWhD.js";import"./Delete-P4B2dduO.js";import"./index-omP-_XYV.js";import"./MoreVert-C_Ck3fn9.js";import"./TableSearch-Uk9kIt7i.js";import"./useLocalStorage-DQZ59j66.js";import"./url-evaluation-DQ262LSg.js";import"./permission-DtbkcHFU.js";import"./index-C_5on_zt.js";import"./Switch-D3iZUzda.js";function Vt(t){return Ge("MuiIcon",t)}et("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Xt=["baseClassName","className","color","component","fontSize"],Zt=t=>{const{color:s,fontSize:n,classes:o}=t,a={root:["root",s!=="inherit"&&`color${ee(s)}`,`fontSize${ee(n)}`]};return nt(a,Vt,o)},Jt=te("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${ee(n.color)}`],s[`fontSize${ee(n.fontSize)}`]]}})(({theme:t,ownerState:s})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,fontSize:{inherit:"inherit",small:t.typography.pxToRem(20),medium:t.typography.pxToRem(24),large:t.typography.pxToRem(36)}[s.fontSize],color:{primary:(t.vars||t).palette.primary.main,secondary:(t.vars||t).palette.secondary.main,info:(t.vars||t).palette.info.main,success:(t.vars||t).palette.success.main,warning:(t.vars||t).palette.warning.main,action:(t.vars||t).palette.action.active,error:(t.vars||t).palette.error.main,disabled:(t.vars||t).palette.action.disabled,inherit:void 0}[s.color]})),Ce=y.forwardRef(function(s,n){const o=tt({props:s,name:"MuiIcon"}),{baseClassName:a="material-icons",className:r,color:i="inherit",component:l="span",fontSize:u="medium"}=o,c=ot(o,Xt),f=Pe({},o,{baseClassName:a,color:i,component:l,fontSize:u}),p=Zt(f);return e.jsx(Jt,Pe({as:l,className:st(a,"notranslate",p.root,r),ownerState:f,"aria-hidden":!0,ref:n},c))});Ce.muiName="Icon";async function Gt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const a=await Promise.all(n.map(async r=>{let{name:i}=r;const l=await At(r.endpoint);return!V(l)&&l!==i&&(i=l,o=!0),{...r,name:i}}));return o&&await Promise.all(a.filter(r=>r.did).map(r=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:r.did},spaceGateway:{...r}}}))),a}function eo({refresh:t}={}){var a;const{blocklet:s}=A(),n=(a=s==null?void 0:s.meta)==null?void 0:a.did,{api:o}=M();return rt(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){var i;(i=r==null?void 0:r.message)!=null&&i.includes("not logged")?console.warn(r):(console.error(r),B.error(X(r)))}})}function Ke({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var f;const{blocklet:o}=A(),[a,r]=y.useState([]),{api:i}=M(),[l,u]=y.useMemo(()=>n?[T(n).startOf("day").toISOString(),T(n).endOf("day").toISOString()]:[T().startOf("year").toISOString(),T().endOf("day").toISOString()],[n]),c=Me(async()=>{try{if(s(!0),!o){r([]);return}const{backups:p}=await i.getBlockletBackups({input:{did:o.meta.did,startTime:l,endTime:u}});r(p??[])}catch(p){console.error(p),B.error(X(p))}finally{s(!1)}},1e3);return Ue(async()=>{c()},[(f=o==null?void 0:o.meta)==null?void 0:f.did].concat(t)),{backups:a}}function to({appDid:t}){const{backups:s}=Ke(),[n,o]=y.useState({message:"",progress:0,completed:!1}),a=M(),{ws:{useSubscription:r}}=a;return r(_.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&o(()=>({...i}))},[t]),y.useEffect(()=>{var i;if(s!=null&&s.length&&at((i=s[0])==null?void 0:i.status)){const[l]=s;o(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[s]),n}function oo({deps:t=[],setLoading:s=()=>{}}={}){var l;const{blocklet:n}=A(),[o,a]=y.useState([]),{api:r}=M(),i=y.useCallback(Me(async()=>{var u;if(!r||!((u=n==null?void 0:n.meta)!=null&&u.did)){a([]);return}try{s(!0);const c=T(),f=c.subtract(1,"year"),{summary:p}=await r.getBlockletBackupSummary({input:{did:n.meta.did,startTime:f.toISOString(),endTime:c.toISOString()}});a(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),a([])}finally{s(!1)}},1e3),[]);return Ue(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:o}}const Fe=y.createContext({}),{Provider:so,Consumer:is}=Fe;function ke({children:t}){var K;const{t:s}=E(),{api:n}=M(),{blocklet:o}=A(),[a,r]=y.useState(null),[i,l]=y.useState(!1),{data:u,loading:c,mutate:f}=eo({refresh:i}),p=it(u),x=to({appDid:o==null?void 0:o.appDid}),h=y.useMemo(()=>Pt(o==null?void 0:o.environments),[o==null?void 0:o.environments]),[b,D]=y.useState(!1),[S,d]=y.useState(!1),{backups:se}=Ke({deps:[S,a],setLoading:D,backupDate:a}),[ne,re]=y.useState(!1),{backupSummary:ae}=oo({deps:[ne]}),[U,L]=y.useState(u==null?void 0:u.find(m=>m.endpoint===h)),I=(K=o==null?void 0:o.settings)==null?void 0:K.autoBackup,v=()=>{l(m=>!m)},ie=()=>{re(m=>!m)},ce=()=>{d(m=>!m)},$=async m=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:m}})},Z=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},le=async(m,N)=>{try{f(w=>{const O=[...w];return O.push({...m,loading:!0}),O}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:m}}),h!==N&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),L(m),v(),B.success(s("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),f(O=>[...O].filter(pe=>pe.did!==m.did)),w}},de=async m=>{m&&(m.endpoint===h&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await $({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),f(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),L(m),v())},ue=async m=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:m.did},spaceGateway:m}}),h!==m.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===h;return e.jsx(so,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:le,deleteSpaceGateway:de,updateSpaceGateway:ue,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:$,abortBlockletBackup:Z,backupEndpoint:h,backupProgress:x,backups:se,backupSummary:ae,refreshBackupSummary:ie,refreshBackups:ce,setBackupDate:r,backupsLoading:b,autoBackup:I},children:t})}ke.propTypes={children:g.any.isRequired};ke.defaultProps={};function P(){return y.useContext(Fe)}function oe({...t}){const{blocklet:s}=A(),{info:n}=M(),{t:o}=E(),a=$e({blocklet:s}),r=ct(n),{spaceGateways:i,addSpaceGateway:l}=P(),u={checkFn:Ne.create({baseURL:ge(window.location.origin,lt())}).get,webWalletUrl:r,extraParams:{appPid:s.appPid,appDid:a.appDid,appName:a.appName,appDescription:a.appDescription,appUrl:a.appUrl,referrer:a.referrer,scopes:a.scopes,nodeDid:n.did}},c=async({endpoint:p,name:x,did:h})=>{const b=await Lt(p);if(!await Ot(b)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(d=>d.endpoint===p)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await l({name:x,did:h,url:b,endpoint:p},p)},f=async({spaceGateway:p})=>{try{await c(p)}catch(x){console.error(x),B.error(X(x))}};return e.jsx(Dt,{...t,connectScope:"app",options:u,onSuccess:f})}oe.propTypes={};oe.defaultProps={};function Ye({...t}){const{t:s}=y.useContext(ut),{blocklet:n,loadingDiskInfo:o,actions:a}=A();if(y.useEffect(()=>{a==null||a.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const r=(u,c,f)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?pt(c):"empty"})]}),i=n.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),l=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(no,{component:"div",...t,children:l.map(u=>e.jsx(Nt,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return o?e.jsx(z,{}):e.jsx(C,{children:s("blocklet.diskInfo.empty")})}const no=dt(C)``;function De(){const{t}=E(),{setBackupDate:s,backupSummary:n}=P(),o=Bt({key:"lg"}),a=y.useRef(null),r=mt(),i=y.useCallback(c=>{s(c)},[s]),l=y.useMemo(()=>{const c=T().add(1,"day"),f=T().subtract(11,"month").startOf("month"),p=new Map(n.map(h=>[h.date,{date:h.date,successCount:h.successCount,errorCount:h.errorCount}])),x=[];for(let h=f.clone();T(h).isBefore(c);h=h.add(1,"day")){const b=h.format("YYYY-MM-DD");x.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return x},[n]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:d}=l[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${d}</div>`].join(`
2
2
  `)},backgroundColor:r.palette.background.paper,borderColor:r.palette.divider,textStyle:{color:r.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${r.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:r.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:r.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:r.palette.background.default,color:r.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:r.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:r.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[T().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),T().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:r.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ft[200],color:"inherit"}}}}),[l,t,r]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:a,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Wt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&i(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2,children:e.jsxs(W,{direction:o?"column":"row",spacing:o?2:1,width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}De.propTypes={};const ro=te(({className:t,...s})=>e.jsx(ye,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Be({status:t,message:s,createdAt:n}){const{t:o}=E(),a=t===R.BACKUPS.STATUS.PROGRESS&&T().diff(n,"hours")>=R.BACKUPS.TIMEOUT_HOURS,r=a&&o("common.timeoutError"),i=t===R.BACKUPS.STATUS.PROGRESS&&!a,l=t===R.BACKUPS.STATUS.SUCCEEDED&&!a;return i?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):l?e.jsx(Q,{type:"success",children:o("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(Q,{type:"error",children:o("common.failed")}),"  ",e.jsx(ye,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||r,children:e.jsx(Ce,{children:e.jsx($t,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Be.propTypes={status:g.string.isRequired,message:g.string,createdAt:g.string.isRequired};Be.defaultProps={message:""};function we({metadata:t}){const{t:s}=E();if(V(t))return e.jsx(Q,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,a=Ft(o,{iec:!0}),r=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(C,{variant:"body2",children:[s("common.fileSize"),": ",a]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(Q,{type:"success",children:s("common.succeeded")})," ",e.jsx(ro,{title:r,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(Ce,{children:e.jsx(gt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}we.propTypes={metadata:g.object};we.defaultProps={metadata:{}};function Te(){const{t,locale:s}=E(),{spaceGateways:n,backups:o,backupsLoading:a}=P(),r=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{var D;const{targetUrl:u,targetName:c,status:f,createdAt:p}=o[l],x=f===R.BACKUPS.STATUS.PROGRESS&&T().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,h=f===R.BACKUPS.STATUS.SUCCEEDED&&!x,b=c||((D=n.find(S=>u==null?void 0:u.includes(Se(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return h?e.jsx(ht,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:l=>{const u=t(l===0?"common.auto":"common.manual");return e.jsx(Q,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>T(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>V(l)?"":T(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const u=(o==null?void 0:o[l])??{},{status:c,message:f,createdAt:p,metadata:x}=u,h=c===R.BACKUPS.STATUS.PROGRESS&&T().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!h,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!h;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):D?e.jsx(we,{metadata:x}):e.jsx(Be,{status:c,message:f,createdAt:p})}}}],[o,n,t]),i=y.useMemo(()=>!(o!=null&&o.length),[o]);return e.jsx(e.Fragment,{children:i?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(Kt,{title:"",loading:a,data:o,columns:r,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Te.propTypes={};function qe(){const{t}=E();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(wt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(oe,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(De,{})]})]}),e.jsx(Te,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ye,{})]})}qe.propTypes={};var Ee={},ao=be;Object.defineProperty(Ee,"__esModule",{value:!0});var He=Ee.default=void 0,io=ao(je()),co=e;He=Ee.default=(0,io.default)((0,co.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Ie={},lo=be;Object.defineProperty(Ie,"__esModule",{value:!0});var Qe=Ie.default=void 0,uo=lo(je()),po=e;Qe=Ie.default=(0,uo.default)((0,po.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var Re={},mo=be;Object.defineProperty(Re,"__esModule",{value:!0});var Ve=Re.default=void 0,fo=mo(je()),ho=e;Ve=Re.default=(0,fo.default)((0,ho.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function ve({spaceGateway:t,onConfirm:s,onCancel:n}){const{t:o}=E(),[a,r]=y.useState(!1),[i,l]=y.useState(!1),u=(p,x)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),r(x)},c=async p=>{try{p==null||p.stopPropagation(),l(!0),await(s==null?void 0:s(t)),r(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${X(x)}`)}finally{r(!1),l(!1)}},f=p=>{u(p,!1),n==null||n(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(q,{style:{minWidth:24,color:"red"},children:e.jsx(Ht,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(xt,{title:o("storage.spaces.gateway.delete.title"),open:a,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:i}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:i}},onConfirm:c,onCancel:f,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}ve.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool}).isRequired,onConfirm:g.func,onCancel:g.func};ve.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function ze({spaceGateway:t,selected:s,onDelete:n,onConnect:o,enableSwitchToSpace:a,backupInProgress:r,...i}){const{abortBlockletBackup:l}=P(),[u,c]=y.useState(null),{t:f}=E(),[p,x]=y.useState(!1),h=(S,d)=>{S.stopPropagation(),S.preventDefault(),c(d&&S.currentTarget)},b=async S=>{try{x(!0),h(S,!1),await o(t)}catch(d){console.error(d),B.error(d.message)}finally{x(!1)}},D=async S=>{try{x(!0),h(S,!1),await l()}catch(d){console.error(d),B.error(d.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(St,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>h(S,!0),...i,children:e.jsx(Yt,{})}),e.jsxs(yt,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>h(S,!1),children:[e.jsxs(Y,{onClick:S=>{h(S,!1),window.open(Oe(t.endpoint?_t(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:f("common.open")})]}),e.jsxs(Y,{onClick:S=>{h(S,!1),window.open(Oe(Mt(t.endpoint),{allowDomains:null}))},children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.strategy.viewBackupFiles")})]}),!s&&a&&e.jsxs(Y,{onClick:b,children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(Qe,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.connect.switchToSpace")})]}),r&&e.jsxs(Y,{onClick:D,children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(qt,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.connect.abortBlockletBackup")})]}),!r&&e.jsx(ve,{spaceGateway:t,onConfirm:async()=>{c(null),await(n==null?void 0:n(t))},onCancel:()=>c(null)})]})]})}ze.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool,endpoint:g.string.isRequired,loading:g.bool}).isRequired,selected:g.bool.isRequired,enableSwitchToSpace:g.bool,onDelete:g.func,onConnect:g.func,backupInProgress:g.bool};ze.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const go=te(({className:t,...s})=>e.jsx(ye,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o,onDeleted:a,onBackedUp:r}){const{t:i,locale:l}=E(),{blocklet:u}=A(),{api:c,info:{did:f}}=M(),{appDid:p,appName:x,appDescription:h,scopes:b,appUrl:D,referrer:S}=$e({blocklet:u}),{backupProgress:d,updateSpaceGateway:se,deleteSpaceGateway:ne,refreshBackupSummary:re,refreshBackups:ae}=P(),[U,L]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:i("storage.spaces.authorize.title",{appName:x},l),scan:i("storage.spaces.authorize.scan",{appName:x},l),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:i("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),ie=n&&!U&&s===fe.DISCONNECTED,ce=n&&!U&&!t.loading&&s===fe.CONNECTED,$=n&&U&&s===fe.CONNECTED&&(d==null?void 0:d.progress)>=0,Z=async()=>{try{if(await Ut(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(i("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o==null||o(null,t);return}}catch(k){console.error(k),o==null||o(k,t);return}v(k=>({...k,open:!0,prefix:ge(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ne.create({baseURL:ge(t.url,"space")}).get,extraParams:{appDid:p,appName:x,appDescription:h,scopes:b,appUrl:D,referrer:S,nodeDid:f,spaceDid:t.did}}))},le=async(k,K)=>{const m=K(k.endpoint),N=Se(m),w=k.space?K(k.space):{};if(t.did&&N!==t.did){v(pe=>({...pe,open:!1}));const F=i("storage.spaces.gateway.switch.failedForMismatchSpace",{name:w!=null&&w.name?w.name:""});B.error(F),o==null||o(new Error(F),t);return}const O={...t,name:w.name??"DID Space",did:w.did??Se(m),endpoint:m};await se(O),v(F=>({...F,open:!1})),o==null||o(null,O)},de=async()=>{try{if(U)return;L(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),r==null||r(k,t)}finally{L(!0)}},ue=async()=>{try{await ne(t),B.success(i("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),a==null||a(null,t)}catch(k){console.error(k),a==null||a(k,t)}};return y.useEffect(()=>{d!=null&&d.completed?(n&&((d==null?void 0:d.progress)===100?(B.success(i("storage.spaces.backupSuccessfully")),r==null||r(null,t)):d.message&&(r==null||r(new Error(d==null?void 0:d.message),t)),d.progress=0,d.message=""),L(!1),setTimeout(()=>{re(),ae()},1e3)):d.progress&&L(!0)},[d]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ce&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:de,children:i("storage.spaces.strategy.backupNow")}),ie&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:Z,children:i("storage.spaces.disconnected.reconnectNow")}),$&&e.jsx(go,{title:(d==null?void 0:d.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:d.message})}),children:e.jsxs(me,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:d==null?void 0:d.progress,size:14,sx:{mr:1}}),d==null?void 0:d.progress,"%"]})}),e.jsx(jt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:le,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:l},"get-endpoint")]}),e.jsx(ze,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:ue,onConnect:Z,enableSwitchToSpace:(d==null?void 0:d.completed)||V(d==null?void 0:d.message),backupInProgress:$})]})}Ae.propTypes={spaceGateway:g.shape({did:g.string.isRequired,name:g.string.isRequired,url:g.string.isRequired,endpoint:g.string.isRequired,protected:g.bool,loading:g.bool}).isRequired,spaceStatus:g.string.isRequired,selected:g.bool.isRequired,onConnected:g.func,onDeleted:g.func,onBackedUp:g.func};Ae.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Xe({...t}){const{t:s}=E();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:s("storage.spaces.backup.records")})}),e.jsx(De,{}),e.jsx(Te,{})]})}Xe.propTypes={};function Ze({...t}){const{t:s}=E(),{autoBackup:n,updateAutoBackup:o}=P(),a=async()=>{try{const r=!(n!=null&&n.enabled);await o({enabled:r}),B.success(s(r?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(r){B.error(r.message)}};return e.jsx(Qt,{checked:!!(n!=null&&n.enabled),onChange:a,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Ze.propTypes={};function xo(){const{t}=E(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=P(),a=n&&!(s!=null&&s.length),r=({spaceGateway:i,spaceStatus:l,selected:u,refresh:c})=>e.jsx(Ae,{spaceGateway:i,spaceStatus:l,selected:u,onConnected:()=>c(),onBackedUp:f=>f&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{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(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Ze,{}),e.jsx(oe,{})]}),e.jsx(j,{mt:2,children:a?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(z,{})}):e.jsx(Le,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(i=>e.jsx(Le,{item:!0,xs:12,md:6,children:e.jsx(Tt,{endpoint:i.endpoint,selected:o(i),action:r},i.endpoint)},i.endpoint))})})}),e.jsx(Xe,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ye,{})]})}function So(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=P();return t?e.jsx(We,{relative:"parent",children:e.jsx(z,{})}):V(s)?e.jsx(qe,{}):e.jsx(xo,{})}function yo(){return e.jsx(ke,{children:e.jsx(So,{})})}function jo(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:a,storageEndpoint:r}=It(),i=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return a?e.jsx(We,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(Rt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(vt,{}),e.jsx(j,{sx:i,children:e.jsx(zt,{onConnect:n,storageEndpoint:r})})]})}function bo(){const{t}=E();return e.jsxs(Et,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(jo,{})]})}function Je({navOrientation:t,...s}){const{t:n,locale:o}=E(),{blocklet:a}=A(),r=kt({key:"md"}),[i,l]=bt(),u=i.get("tab")||"backup",c=r?"horizontal":t,f=xe(()=>{var d;const D=[{label:n("common.backup"),value:"backup"}],S=(d=a==null?void 0:a.capabilities)==null?void 0:d.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:n("common.storage"),value:"storage"}),D},[o,c]),x=xe(()=>({backup:e.jsx(yo,{}),storage:e.jsx(bo,{})}))[u],h=D=>{l(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(f.length<=1)return e.jsx(he,{children:x});const b=e.jsx(Ct,{tabs:f,current:u,orientation:c,onChange:h,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...s,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(_e,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(he,{sx:{mt:1},children:x})})]})});if(c==="horizontal")return e.jsxs(j,{...s,children:[e.jsx(_e,{left:b}),e.jsx(he,{sx:{mt:2},children:x})]})}Je.propTypes={navOrientation:g.oneOf(["vertical","horizontal"])};Je.defaultProps={navOrientation:"vertical"};const he=te(j)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1,4 +1,4 @@
1
- import{bq as St,r as x,bC as Q,bi as $,y as V,A as L,j as e,P as d,T as Ct,aP as Xe,aQ as Ze,aw as Nt,h as ne,aB as wt,k as G,K as v,m as X,ej as _e,N as Be,kF as et,bn as Ee,aY as De,U as Ae,ep as we,b7 as Ge,b5 as Oe,C as tt,n as re,f as st,dB as nt,aT as Le,W as Tt,av as at,kG as it,B as ke,kH as ot,g0 as Se,gh as rt,ai as fe,ff as Rt,ax as It,G as Ye,kI as Et,kJ as Dt,D as lt,kK as At,kL as Ot,kM as Lt,kN as kt,R as Pt,bw as ct,O as Ft,S as _t,Q as Je,J as Bt,kO as zt,a4 as Wt}from"./index-BOLfvqKF.js";import{l as Mt,D as dt,g as qt}from"./index-Dow64Z2x.js";import{a as ze,c as Kt}from"./actions-B5wmKEDC.js";import{B as $t}from"./index-HJyYrv5X.js";import{S as xe}from"./shorten-label-D74t0ifG.js";import{I as ut}from"./index-D732T1aT.js";import{T as Ht}from"./index-BCGKopWm.js";import{d as Ut}from"./Refresh-C0Iz2zZt.js";import{D as Vt,g as Gt}from"./traffic-DmNfI0bT.js";import{u as Yt}from"./use-mobile-utJ7FsR-.js";import"./TableRow-DQuCW6hn.js";import"./useThemeProps-DJJZjixl.js";import"./emotion-react.browser.esm-BnQsp-2e.js";import"./ViewColumn-BCvqBjPt.js";import"./Search-DBiDYaX1.js";import"./Clear-BxwDIGi1.js";import"./Delete-DKeOWzoo.js";import"./index-wqaqDly9.js";import"./MoreVert-DqeE3_Hd.js";import"./TableSearch-C6AKfDSr.js";import"./useLocalStorage-DPYKzz1_.js";import"./get-safe-url-DO00hPju.js";import"./ButtonGroup-jLU91Eto.js";import"./getValidReactChildren-D_5CTSB1.js";import"./url-evaluation-DiN5Q08e.js";import"./permission-BQtaoI3I.js";import"./index.esm-Bn-iehLo.js";import"./collapse-Xins5ZhF.js";import"./blocklet-DiZeBiJN.js";import"./Switch-DSS8JChR.js";import"./iframe-BnX2-HMD.js";import"./ChevronLeft-DxCtjh6K.js";import"./ChevronRight-BJDD27JD.js";import"./index-Zm-WNook.js";import"./base-chart-B2gmFhRJ.js";import"./index-30VVCODr.js";import"./AdapterDayjs-BPnL086D.js";import"./CSSTransition-CEYSDYhf.js";import"./refType-C2bDqONV.js";const pt=x.createContext({}),{Provider:Jt,Consumer:pn}=pt;function Qt({children:t,blocklet:s=""}){const{api:n,inService:o,ws:{useSubscription:r}}=St(),[l,b]=x.useState([]),[u,D]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),f=Q(()=>{var p;return(p=s.meta)==null?void 0:p.did},[s]),[C,N]=x.useState([]),[B,z]=x.useState({}),E=Q(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),Y=async({page:p=1,pageSize:S=20,...A}={})=>{if(!f)return[];try{const w={paging:{page:p,pageSize:S},...A,teamDid:f,dateRange:A.dateRange?[$(A.dateRange[0]).toISOString(),$(A.dateRange[1]).toISOString()]:void 0},{dids:O,..._}=w;let Z="";O&&O.includes("system")&&(Z="system");const W=O?O.filter(le=>le!=="system"):[],ae={..._,source:Z,componentDids:W},se=await n.getNotificationSendLog({input:ae});return z(ae),b(se.list),D(se.paging),se.list}catch(w){return V.error(w.message),[]}},P=async()=>{const p=await n.getNotificationComponents({input:{teamDid:f}});N(p.componentDids)},k=x.useCallback(p=>{const S=s.children.find(A=>{var w;return((w=A.meta)==null?void 0:w.did)===p});if(S)return S.ancestors=[s],S},[s]),I=async({notificationId:p,receivers:S,channels:A,...w})=>{await n.resendNotification({input:{teamDid:f,notificationId:p,receivers:S,channels:A.map(O=>O==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:O),...w}})},H=x.useCallback(async p=>(await n.getUser({input:{teamDid:f,user:{did:p}}})).user,[n,f]),J=x.useCallback(async({page:p=1,pageSize:S=20,...A}={})=>{try{const w={paging:{page:p,pageSize:S},...A,userName:A.searchText||"",teamDid:f,dateRange:A.dateRange?[$(A.dateRange[0]).toISOString(),$(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[n,f]);x.useEffect(()=>{f&&P()},[f]),r(L.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{E.has(p.notificationId)&&Y(B)},[E,B]),r(L.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{E.has(p.id)||Y(B)},[E,B]);const te={fetch:Y,data:l,paging:u,blocklet:s,getComponent:k,resendNotification:I,getUser:H,componentDids:C,getReceivers:J,inService:o,teamDid:f};return e.jsx(Jt,{value:{notificationRecords:te},children:t})}function We(){const{notificationRecords:t}=x.useContext(pt);return t}be.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Xt={info:"primary",success:"success",error:"error",warning:"warning"};function be({severity:t="info"}){return e.jsx(Ct,{type:Xt[t],children:t})}var Me={},Zt=Ze;Object.defineProperty(Me,"__esModule",{value:!0});var ft=Me.default=void 0,es=Zt(Xe()),ts=e;ft=Me.default=(0,es.default)((0,ts.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},ss=Ze;Object.defineProperty(qe,"__esModule",{value:!0});var mt=qe.default=void 0,ns=ss(Xe()),as=e;mt=qe.default=(0,ns.default)((0,as.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");const is=(t,s,n="")=>{if(!n||!s)return"";switch(n){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ht(t,s,n={}){const{status:o,updatedAt:r,reason:l="",channel:b="wallet"}=n,u=r?t("notification.sendStatus.sentTime",{date:Nt(r,s)}):"",D=is(t,b,l);return o===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:D}:o===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:D,sentTime:u}}const Pe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Fe=["wallet","pushKit","email"],Qe=["info","success","error","warning"],gt=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:o.enabled},xt=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:o.enabled},os=(t,s)=>{const n=ne(s,"extra.notifications.email",!0);return{available:gt(t),enabled:n}},rs=(t,s)=>{const n=ne(s,"extra.notifications.push",!0);return{available:xt(t),enabled:n}},ls=t=>({enabled:ne(t,"extra.notifications.wallet",!0)}),cs=t=>({enabled:ne(t,"extra.webhooks",[]).length>0}),ye=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ds=(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})}]:[],ve=(t=[])=>{const s=$().startOf("day");return t.filter(n=>$(n.sendAt).isSame(s,"day")).length},us=(t,s="")=>{if(s&&Fe.includes(s)){const l=`${s}SendRecord`,b=ne(t,l,[]);return ve(b)}const n=ne(t,"webhook",{}),o=Object.keys(n??{})??[];if(s&&o.includes(s)){const l=n[s]??[];return ve(l)}const r={};return Fe.forEach(l=>{const b=`${l}SendRecord`,u=ne(t,b,[]),D=ve(u);r[l]=D}),o.length>0&&o.forEach(l=>{const b=n[l]??[],u=ve(b);r[l]=u}),r},Ce=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Ne=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ps=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},bt=()=>({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 ee({config:t,enableTooltip:s=!0,showTitle:n=!1,children:o}){const{status:r,title:l="",sentTime:b="",reason:u=""}=t,D=[l,u].filter(Boolean).join(", ");return e.jsx(wt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:D}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(v,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(v,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(v,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Pe[r],style:{opacity:.15}}),e.jsx(v,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Pe[r]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:n?l:o})]})})}ee.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ee.defaultProps={enableTooltip:!0,showTitle:!1,children:null};me.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};me.defaultProps={onDelete:()=>{}};function me({list:t,label:s,onDelete:n}){const{t:o,locale:r}=X();return e.jsxs(v,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[s,": "]}),t.map(l=>{const b=ht(o,r,{status:l});return e.jsx(_e,{size:"small",label:e.jsx(v,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ee,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>n(u,l)},l)})]})}Ke.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 Ke({filterList:t,onChange:s,index:n,column:o,filterValues:r,label:l,renderLabel:b}){return e.jsxs(Be,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Ee,{row:!0,children:r.map(u=>e.jsx(De,{control:e.jsx(Ae,{checked:t[n].indexOf(u.value??u)>-1,onChange:D=>{const f=[...t];D.target.checked?f[n]=[...f[n],u.value??u]:f[n]=f[n].filter(C=>C!==(u.value??u)),s(f[n],n,o)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Ie(t){return e.jsx(Ke,{...t,renderLabel:s=>e.jsx(ee,{enableTooltip:!1,config:{status:s.status},children:s.label})})}pe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function pe({status:t,updatedAt:s,reason:n="",channel:o="wallet",onResend:r}){const{t:l,locale:b}=X(),u=ht(l,b,{status:t,updatedAt:s,reason:n,channel:o});return e.jsxs(v,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ee,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(we,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:r,children:l("notification.resend")})]})}$e.propTypes={value:d.array.isRequired,onChange:d.func};function $e({value:t,onChange:s}){const{locale:n}=X(),o=$().toDate(),[r,l]=x.useState(null),b=x.useCallback(f=>{l(r?null:f.currentTarget)},[r]),u=!!r,D=x.useCallback(f=>{if(!f.startDate||!f.endDate){V.error("Please select a date range");return}if($(f.startDate).isAfter(f.endDate)||!$(f.startDate).isValid()||!$(f.endDate).isValid()){V.error("Invalid date range");return}s([f.startDate,f.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(we,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[Ge(t[0],n)," - ",Ge(t[1],n)]})}),e.jsx(Oe,{open:u,anchorEl:r,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Vt,{open:!0,maxDate:o,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Gt(o),onChange:D})})]})}He.propTypes={itemComponent:d.elementType.isRequired};function He({itemComponent:t,...s}){var r;const{t:n}=X();return!((r=s==null?void 0:s.filterList)!=null&&r.filter(l=>l.length).length)?null:e.jsxs(v,{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(Mt.TableFilterList,{...s,ItemComponent:t})})]})}function Te({label:t,onDelete:s,canDelete:n=()=>!0,...o}){const r=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...o})),e.jsx(_e,{label:t,variant:"outlined",...r&&l?{onDelete:r}:{}})}Te.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Te.defaultProps={canDelete:()=>!0};const fs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ue.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ue.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ue({loading:t=!1,onCancel:s,onConfirm:n}){const{t:o}=X(),[r,l]=x.useState(fs),[b,u]=x.useState(!0),D=(C,N)=>{N.checked=C.target.checked;const B=r.map(z=>({...z,checked:z.value===N.value?N.checked:z.checked}));l(B)},f=C=>{C.stopPropagation(),n({channels:r.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:b})};return e.jsxs(v,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:o("notification.config")}),e.jsx(v,{className:"choose-channel",children:e.jsxs(Be,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:o("notification.selectChannels")}),e.jsx(Ee,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:r.map(C=>e.jsx(De,{control:e.jsx(Ae,{checked:C.checked,onChange:N=>D(N,C),name:C.value}),label:C.label},C.value))})]})}),e.jsx(v,{className:"resend-config-footer",children:e.jsx(Ee,{children:e.jsx(De,{control:e.jsx(Ae,{checked:b,onChange:C=>u(C.target.checked)}),label:o("notification.resendFailedOnly")})})}),e.jsxs(v,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(we,{onClick:C=>{C.stopPropagation(),s()},color:"inherit",children:o("common.cancel")}),e.jsxs(we,{onClick:f,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),o("common.confirm")]})]})]})}jt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function jt({notificationId:t,handleResend:s,resending:n=!1}){const{t:o,locale:r}=X(),l=st(),b=x.useMemo(()=>nt(l,bt()),[l]),{getReceivers:u,inService:D,teamDid:f,getUser:C,blocklet:N}=We(),[B,z]=x.useState(!1),[E,Y]=x.useState([]),P=Le({anchorEl:null,position:null}),k=Le({anchorEl:null,position:null}),[I,H]=x.useState(null),[J,te]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,S]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[A,w]=x.useState([]),O=[{label:o("notification.sendStatus.pending"),value:0,status:"pending"},{label:o("notification.sendStatus.success"),value:1,status:"success"},{label:o("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!B&&t)try{z(!0);const a=await u({notificationId:t,...p}),i=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:rt(c.receiverUser.avatar,f,D)}}));Y(i),te(a.paging),z(!1)}catch(a){V.error(a.message),z(!1)}};x.useEffect(()=>{_()},[p]);const Z=a=>{a.stopPropagation();const i=a.currentTarget;k.anchorEl=i;const c=i.getBoundingClientRect();k.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},W=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ke,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Z,children:o("notification.resend")})}):null,ae={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:o("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:A,onRowSelectionChange:(a,i)=>{w(i.map(c=>c.dataIndex))},customToolbarSelect:W},se=({page:a,rowsPerPage:i,searchText:c,filterList:y})=>{const[,F=[],K=[],q=[]]=y;p.pageSize!==i?S(M=>({...M,pageSize:i,page:1})):p.page!==a+1?S(M=>({...M,page:a+1})):p.searchText!==c?S(M=>({...M,searchText:c,page:1})):fe(F,p.walletSendStatus)?fe(K,p.pushKitSendStatus)?fe(q,p.emailSendStatus)||S(M=>({...M,emailSendStatus:q,page:1})):S(M=>({...M,pushKitSendStatus:K,page:1})):S(M=>({...M,walletSendStatus:F,page:1}))},le=x.useCallback(async(a,i)=>{if(!i)return!1;const c=await C(i);return c?a==="wallet"?ls(c):a==="email"?os(N,c):a==="pushKit"?rs(N,c):a==="webhook"?cs(c):!0:!1},[C,N]),je=x.useCallback(a=>ds(o,a),[o]),ce=()=>{P.anchorEl=null,P.position=null,H(null)},de=()=>{k.anchorEl=null,k.position=null},ue=async(a,i,c=!0,y="")=>{if(!(!i.length||!a.length))try{s(a,i,c,y),k.anchorEl||(await ye(.5),ce())}catch(F){console.error("handleResend error",{error:F})}},h=async({channels:a,isResendFailedOnly:i})=>{const c=A.map(y=>E[y].receiver);await ue(a,c,i),await ye(.5),de(),w([])},m=async(a,i=[],c=!0)=>{try{await ue(["webhook"],[a.receiver],c,i)}catch(y){V.error(y.response?y.response.statusText:y.message)}},g=async(a,i,c,y=[],F=!0)=>{if(a.stopPropagation(),us(i,c)>=4){V.warning(o("notification.resendLimit"));return}if(!Fe.includes(c)){await m(i,y,F);return}if(a){const q=a.currentTarget,M=q.getBoundingClientRect();P.anchorEl=q,P.position={top:M.top+window.scrollY,left:M.left+window.scrollX}}H({channel:c});try{const q=await le(c,i.receiver);await ye(1),H({channel:c,result:q}),(typeof q=="boolean"&&q||Rt(q)&&Object.values(q).every(M=>!!M))&&(await s([c],[i.receiver],F),k.anchorEl||(await ye(.5),ce()))}catch(q){V.error(q.message)}},j=a=>{S(i=>({...i,dateRange:a,page:1}))},T=(a,i,c,y)=>{a.stopPropagation();const F=c.filter(K=>K!==i);S(K=>({...K,[y]:F,page:1}))},R=Q(()=>[{label:o("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:i,receiver:c}=E[a];return i?e.jsxs(v,{"data-cy":`member-name-${i.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(at,{src:`${i.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(xe,{children:i.fullName})]},c):e.jsx(Tt,{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:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(me,{list:a,label:"Wallet",onDelete:(i,c)=>{i.stopPropagation(),T(i,c,R[1].options.filterList,"walletSendStatus")}}),update:Ce},filterOptions:{names:O,fullWidth:!0,logic:Ne,display:(a,i,c,y)=>e.jsx(Ie,{label:"Wallet",filterList:a,onChange:i,index:c,column:y,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:i,walletSendAt:c,walletSendFailedReason:y}=E[a];return e.jsx(pe,{status:i,updatedAt:c,reason:y,channel:"wallet",onResend:F=>g(F,E[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:i,pushKitSendAt:c,pushKitSendFailedReason:y}=E[a];return e.jsx(pe,{status:i,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>g(F,E[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(me,{list:a,label:"Push Kit",onDelete:(i,c)=>{i.stopPropagation(),T(i,c,R[2].options.filterList,"pushKitSendStatus")}}),update:Ce},filterOptions:{names:O,fullWidth:!0,logic:Ne,display:(a,i,c,y)=>e.jsx(Ie,{label:"Push Kit",filterList:a,onChange:i,index:c,column:y,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:i,emailSendAt:c,emailSendFailedReason:y}=E[a];return e.jsx(pe,{status:i,updatedAt:c,reason:y,channel:"email",onResend:F=>g(F,E[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(me,{list:a,label:"Email",onDelete:(i,c)=>{i.stopPropagation(),T(i,c,R[3].options.filterList,"emailSendStatus")}}),update:Ce},filterOptions:{names:O,fullWidth:!0,logic:Ne,display:(a,i,c,y)=>e.jsx(Ie,{label:"Email",filterList:a,onChange:i,index:c,column:y,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:i}=E[a];if(!i)return null;const c=Object.entries(i)[0];if(!c)return null;const[y,F]=c,K=F[0];return e.jsx(v,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(v,{className:"webhook-item",fontSize:12,children:[e.jsx(xe,{maxLength:30,children:y},y),e.jsx(pe,{status:K.status,updatedAt:K.sendAt,reason:K.failedReason,channel:"webhook",onResend:q=>g(q,E[a],"webhook",[y],!1)})]},y)})}}},{label:o("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:i}=E[a];return e.jsx(it,{value:i,locale:r,shouldUpdate:!0})}}}],[E,r,p,o]),U=[e.jsx($e,{value:p.dateRange,onChange:j},"date-picker"),e.jsx(ke,{variant:"contained",size:"small",color:"primary",loading:B,startIcon:e.jsx(Ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:o("common.refresh")},"refresh")];return e.jsx(v,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(hs,{children:e.jsxs(ot,{theme:b,children:[e.jsx(dt,{className:"receivers-table",locale:r,loading:B,columns:R,data:E,onChange:se,options:ae,customButtons:U,components:{TableFilterList:a=>e.jsx(He,{...a,itemComponent:i=>e.jsx(Te,{...i,canDelete:()=>!1})})}}),P.anchorEl&&e.jsx(Oe,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:ce,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(gs,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(v,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:je(I==null?void 0:I.channel).map(a=>{var F,K;const{type:i,pass:c,fail:y}=a;return!(I!=null&&I.result)||(F=I==null?void 0:I.result)!=null&&F[i]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(K=I==null?void 0:I.result)!=null&&K[i]?Se.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ft,{}):e.jsx(tt,{size:12,sx:{color:Se.primary.main}}),e.jsx("span",{children:c})]},i):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Se.error.main},children:[e.jsx(mt,{}),e.jsx("span",{children:y})]},i)})})]})}),k.anchorEl&&e.jsx(Oe,{open:!!k.anchorEl,anchorReference:"anchorPosition",anchorPosition:k.position,onClose:de,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ue,{loading:n,onCancel:de,onConfirm:h})})]})})})}const ms=x.memo(jt),hs=re.div`
1
+ import{bq as St,r as x,bC as Q,bi as $,y as V,A as L,j as e,P as d,T as Ct,aP as Xe,aQ as Ze,aw as Nt,h as ne,aB as wt,k as G,K as v,m as X,ej as _e,N as Be,kF as et,bn as Ee,aY as De,U as Ae,ep as we,b7 as Ge,b5 as Oe,C as tt,n as re,f as st,dB as nt,aT as Le,W as Tt,av as at,kG as it,B as ke,kH as ot,g0 as Se,gh as rt,ai as fe,ff as Rt,ax as It,G as Ye,kI as Et,kJ as Dt,D as lt,kK as At,kL as Ot,kM as Lt,kN as kt,R as Pt,bw as ct,O as Ft,S as _t,Q as Je,J as Bt,kO as zt,a4 as Wt}from"./index-DTb1YjkO.js";import{l as Mt,D as dt,g as qt}from"./index-CFc2cpAq.js";import{a as ze,c as Kt}from"./actions-CvZtuIOm.js";import{B as $t}from"./index-DrBxStif.js";import{S as xe}from"./shorten-label-BOckTQ1X.js";import{I as ut}from"./index-BLrsx8oH.js";import{T as Ht}from"./index-DzK6OW-H.js";import{d as Ut}from"./Refresh-C1kA8imS.js";import{D as Vt,g as Gt}from"./traffic-C8Jrp6CL.js";import{u as Yt}from"./use-mobile-BoYyduuc.js";import"./TableRow-CQ8RBtid.js";import"./useThemeProps-CtXzBlYo.js";import"./emotion-react.browser.esm--gIypTeg.js";import"./ViewColumn-CcQluqhl.js";import"./Search-CUm1f8xo.js";import"./Clear-D0I7uWhD.js";import"./Delete-P4B2dduO.js";import"./index-omP-_XYV.js";import"./MoreVert-C_Ck3fn9.js";import"./TableSearch-Uk9kIt7i.js";import"./useLocalStorage-DQZ59j66.js";import"./get-safe-url-BHhOK-87.js";import"./ButtonGroup-ClVwTb7r.js";import"./getValidReactChildren-B-b9MOMT.js";import"./url-evaluation-DQ262LSg.js";import"./permission-DtbkcHFU.js";import"./index.esm-CB-7UGfI.js";import"./collapse-Cy01Qhtt.js";import"./blocklet-SKmr21o8.js";import"./Switch-D3iZUzda.js";import"./iframe-CVde2I2R.js";import"./ChevronLeft-DQK-aqqz.js";import"./ChevronRight-BtkdX9A9.js";import"./index-DRvnuna9.js";import"./base-chart-tXWghrta.js";import"./index-CyCivdc5.js";import"./AdapterDayjs-BqwbfR-J.js";import"./CSSTransition-DpoNbm4c.js";import"./refType-J5vgZzDX.js";const pt=x.createContext({}),{Provider:Jt,Consumer:pn}=pt;function Qt({children:t,blocklet:s=""}){const{api:n,inService:o,ws:{useSubscription:r}}=St(),[l,b]=x.useState([]),[u,D]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),f=Q(()=>{var p;return(p=s.meta)==null?void 0:p.did},[s]),[C,N]=x.useState([]),[B,z]=x.useState({}),E=Q(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),Y=async({page:p=1,pageSize:S=20,...A}={})=>{if(!f)return[];try{const w={paging:{page:p,pageSize:S},...A,teamDid:f,dateRange:A.dateRange?[$(A.dateRange[0]).toISOString(),$(A.dateRange[1]).toISOString()]:void 0},{dids:O,..._}=w;let Z="";O&&O.includes("system")&&(Z="system");const W=O?O.filter(le=>le!=="system"):[],ae={..._,source:Z,componentDids:W},se=await n.getNotificationSendLog({input:ae});return z(ae),b(se.list),D(se.paging),se.list}catch(w){return V.error(w.message),[]}},P=async()=>{const p=await n.getNotificationComponents({input:{teamDid:f}});N(p.componentDids)},k=x.useCallback(p=>{const S=s.children.find(A=>{var w;return((w=A.meta)==null?void 0:w.did)===p});if(S)return S.ancestors=[s],S},[s]),I=async({notificationId:p,receivers:S,channels:A,...w})=>{await n.resendNotification({input:{teamDid:f,notificationId:p,receivers:S,channels:A.map(O=>O==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:O),...w}})},H=x.useCallback(async p=>(await n.getUser({input:{teamDid:f,user:{did:p}}})).user,[n,f]),J=x.useCallback(async({page:p=1,pageSize:S=20,...A}={})=>{try{const w={paging:{page:p,pageSize:S},...A,userName:A.searchText||"",teamDid:f,dateRange:A.dateRange?[$(A.dateRange[0]).toISOString(),$(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[n,f]);x.useEffect(()=>{f&&P()},[f]),r(L.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{E.has(p.notificationId)&&Y(B)},[E,B]),r(L.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{E.has(p.id)||Y(B)},[E,B]);const te={fetch:Y,data:l,paging:u,blocklet:s,getComponent:k,resendNotification:I,getUser:H,componentDids:C,getReceivers:J,inService:o,teamDid:f};return e.jsx(Jt,{value:{notificationRecords:te},children:t})}function We(){const{notificationRecords:t}=x.useContext(pt);return t}be.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Xt={info:"primary",success:"success",error:"error",warning:"warning"};function be({severity:t="info"}){return e.jsx(Ct,{type:Xt[t],children:t})}var Me={},Zt=Ze;Object.defineProperty(Me,"__esModule",{value:!0});var ft=Me.default=void 0,es=Zt(Xe()),ts=e;ft=Me.default=(0,es.default)((0,ts.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},ss=Ze;Object.defineProperty(qe,"__esModule",{value:!0});var mt=qe.default=void 0,ns=ss(Xe()),as=e;mt=qe.default=(0,ns.default)((0,as.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");const is=(t,s,n="")=>{if(!n||!s)return"";switch(n){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ht(t,s,n={}){const{status:o,updatedAt:r,reason:l="",channel:b="wallet"}=n,u=r?t("notification.sendStatus.sentTime",{date:Nt(r,s)}):"",D=is(t,b,l);return o===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:D}:o===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:D,sentTime:u}}const Pe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Fe=["wallet","pushKit","email"],Qe=["info","success","error","warning"],gt=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:o.enabled},xt=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:o.enabled},os=(t,s)=>{const n=ne(s,"extra.notifications.email",!0);return{available:gt(t),enabled:n}},rs=(t,s)=>{const n=ne(s,"extra.notifications.push",!0);return{available:xt(t),enabled:n}},ls=t=>({enabled:ne(t,"extra.notifications.wallet",!0)}),cs=t=>({enabled:ne(t,"extra.webhooks",[]).length>0}),ye=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ds=(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})}]:[],ve=(t=[])=>{const s=$().startOf("day");return t.filter(n=>$(n.sendAt).isSame(s,"day")).length},us=(t,s="")=>{if(s&&Fe.includes(s)){const l=`${s}SendRecord`,b=ne(t,l,[]);return ve(b)}const n=ne(t,"webhook",{}),o=Object.keys(n??{})??[];if(s&&o.includes(s)){const l=n[s]??[];return ve(l)}const r={};return Fe.forEach(l=>{const b=`${l}SendRecord`,u=ne(t,b,[]),D=ve(u);r[l]=D}),o.length>0&&o.forEach(l=>{const b=n[l]??[],u=ve(b);r[l]=u}),r},Ce=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Ne=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ps=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},bt=()=>({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 ee({config:t,enableTooltip:s=!0,showTitle:n=!1,children:o}){const{status:r,title:l="",sentTime:b="",reason:u=""}=t,D=[l,u].filter(Boolean).join(", ");return e.jsx(wt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:D}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(v,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(v,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(v,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Pe[r],style:{opacity:.15}}),e.jsx(v,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Pe[r]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:n?l:o})]})})}ee.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ee.defaultProps={enableTooltip:!0,showTitle:!1,children:null};me.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};me.defaultProps={onDelete:()=>{}};function me({list:t,label:s,onDelete:n}){const{t:o,locale:r}=X();return e.jsxs(v,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[s,": "]}),t.map(l=>{const b=ht(o,r,{status:l});return e.jsx(_e,{size:"small",label:e.jsx(v,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ee,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>n(u,l)},l)})]})}Ke.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 Ke({filterList:t,onChange:s,index:n,column:o,filterValues:r,label:l,renderLabel:b}){return e.jsxs(Be,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Ee,{row:!0,children:r.map(u=>e.jsx(De,{control:e.jsx(Ae,{checked:t[n].indexOf(u.value??u)>-1,onChange:D=>{const f=[...t];D.target.checked?f[n]=[...f[n],u.value??u]:f[n]=f[n].filter(C=>C!==(u.value??u)),s(f[n],n,o)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Ie(t){return e.jsx(Ke,{...t,renderLabel:s=>e.jsx(ee,{enableTooltip:!1,config:{status:s.status},children:s.label})})}pe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function pe({status:t,updatedAt:s,reason:n="",channel:o="wallet",onResend:r}){const{t:l,locale:b}=X(),u=ht(l,b,{status:t,updatedAt:s,reason:n,channel:o});return e.jsxs(v,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ee,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(we,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:r,children:l("notification.resend")})]})}$e.propTypes={value:d.array.isRequired,onChange:d.func};function $e({value:t,onChange:s}){const{locale:n}=X(),o=$().toDate(),[r,l]=x.useState(null),b=x.useCallback(f=>{l(r?null:f.currentTarget)},[r]),u=!!r,D=x.useCallback(f=>{if(!f.startDate||!f.endDate){V.error("Please select a date range");return}if($(f.startDate).isAfter(f.endDate)||!$(f.startDate).isValid()||!$(f.endDate).isValid()){V.error("Invalid date range");return}s([f.startDate,f.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(we,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[Ge(t[0],n)," - ",Ge(t[1],n)]})}),e.jsx(Oe,{open:u,anchorEl:r,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Vt,{open:!0,maxDate:o,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Gt(o),onChange:D})})]})}He.propTypes={itemComponent:d.elementType.isRequired};function He({itemComponent:t,...s}){var r;const{t:n}=X();return!((r=s==null?void 0:s.filterList)!=null&&r.filter(l=>l.length).length)?null:e.jsxs(v,{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(Mt.TableFilterList,{...s,ItemComponent:t})})]})}function Te({label:t,onDelete:s,canDelete:n=()=>!0,...o}){const r=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...o})),e.jsx(_e,{label:t,variant:"outlined",...r&&l?{onDelete:r}:{}})}Te.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Te.defaultProps={canDelete:()=>!0};const fs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ue.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ue.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ue({loading:t=!1,onCancel:s,onConfirm:n}){const{t:o}=X(),[r,l]=x.useState(fs),[b,u]=x.useState(!0),D=(C,N)=>{N.checked=C.target.checked;const B=r.map(z=>({...z,checked:z.value===N.value?N.checked:z.checked}));l(B)},f=C=>{C.stopPropagation(),n({channels:r.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:b})};return e.jsxs(v,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:o("notification.config")}),e.jsx(v,{className:"choose-channel",children:e.jsxs(Be,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:o("notification.selectChannels")}),e.jsx(Ee,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:r.map(C=>e.jsx(De,{control:e.jsx(Ae,{checked:C.checked,onChange:N=>D(N,C),name:C.value}),label:C.label},C.value))})]})}),e.jsx(v,{className:"resend-config-footer",children:e.jsx(Ee,{children:e.jsx(De,{control:e.jsx(Ae,{checked:b,onChange:C=>u(C.target.checked)}),label:o("notification.resendFailedOnly")})})}),e.jsxs(v,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(we,{onClick:C=>{C.stopPropagation(),s()},color:"inherit",children:o("common.cancel")}),e.jsxs(we,{onClick:f,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),o("common.confirm")]})]})]})}jt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function jt({notificationId:t,handleResend:s,resending:n=!1}){const{t:o,locale:r}=X(),l=st(),b=x.useMemo(()=>nt(l,bt()),[l]),{getReceivers:u,inService:D,teamDid:f,getUser:C,blocklet:N}=We(),[B,z]=x.useState(!1),[E,Y]=x.useState([]),P=Le({anchorEl:null,position:null}),k=Le({anchorEl:null,position:null}),[I,H]=x.useState(null),[J,te]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,S]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[A,w]=x.useState([]),O=[{label:o("notification.sendStatus.pending"),value:0,status:"pending"},{label:o("notification.sendStatus.success"),value:1,status:"success"},{label:o("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!B&&t)try{z(!0);const a=await u({notificationId:t,...p}),i=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:rt(c.receiverUser.avatar,f,D)}}));Y(i),te(a.paging),z(!1)}catch(a){V.error(a.message),z(!1)}};x.useEffect(()=>{_()},[p]);const Z=a=>{a.stopPropagation();const i=a.currentTarget;k.anchorEl=i;const c=i.getBoundingClientRect();k.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},W=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ke,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Z,children:o("notification.resend")})}):null,ae={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:o("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:A,onRowSelectionChange:(a,i)=>{w(i.map(c=>c.dataIndex))},customToolbarSelect:W},se=({page:a,rowsPerPage:i,searchText:c,filterList:y})=>{const[,F=[],K=[],q=[]]=y;p.pageSize!==i?S(M=>({...M,pageSize:i,page:1})):p.page!==a+1?S(M=>({...M,page:a+1})):p.searchText!==c?S(M=>({...M,searchText:c,page:1})):fe(F,p.walletSendStatus)?fe(K,p.pushKitSendStatus)?fe(q,p.emailSendStatus)||S(M=>({...M,emailSendStatus:q,page:1})):S(M=>({...M,pushKitSendStatus:K,page:1})):S(M=>({...M,walletSendStatus:F,page:1}))},le=x.useCallback(async(a,i)=>{if(!i)return!1;const c=await C(i);return c?a==="wallet"?ls(c):a==="email"?os(N,c):a==="pushKit"?rs(N,c):a==="webhook"?cs(c):!0:!1},[C,N]),je=x.useCallback(a=>ds(o,a),[o]),ce=()=>{P.anchorEl=null,P.position=null,H(null)},de=()=>{k.anchorEl=null,k.position=null},ue=async(a,i,c=!0,y="")=>{if(!(!i.length||!a.length))try{s(a,i,c,y),k.anchorEl||(await ye(.5),ce())}catch(F){console.error("handleResend error",{error:F})}},h=async({channels:a,isResendFailedOnly:i})=>{const c=A.map(y=>E[y].receiver);await ue(a,c,i),await ye(.5),de(),w([])},m=async(a,i=[],c=!0)=>{try{await ue(["webhook"],[a.receiver],c,i)}catch(y){V.error(y.response?y.response.statusText:y.message)}},g=async(a,i,c,y=[],F=!0)=>{if(a.stopPropagation(),us(i,c)>=4){V.warning(o("notification.resendLimit"));return}if(!Fe.includes(c)){await m(i,y,F);return}if(a){const q=a.currentTarget,M=q.getBoundingClientRect();P.anchorEl=q,P.position={top:M.top+window.scrollY,left:M.left+window.scrollX}}H({channel:c});try{const q=await le(c,i.receiver);await ye(1),H({channel:c,result:q}),(typeof q=="boolean"&&q||Rt(q)&&Object.values(q).every(M=>!!M))&&(await s([c],[i.receiver],F),k.anchorEl||(await ye(.5),ce()))}catch(q){V.error(q.message)}},j=a=>{S(i=>({...i,dateRange:a,page:1}))},T=(a,i,c,y)=>{a.stopPropagation();const F=c.filter(K=>K!==i);S(K=>({...K,[y]:F,page:1}))},R=Q(()=>[{label:o("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:i,receiver:c}=E[a];return i?e.jsxs(v,{"data-cy":`member-name-${i.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(at,{src:`${i.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(xe,{children:i.fullName})]},c):e.jsx(Tt,{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:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(me,{list:a,label:"Wallet",onDelete:(i,c)=>{i.stopPropagation(),T(i,c,R[1].options.filterList,"walletSendStatus")}}),update:Ce},filterOptions:{names:O,fullWidth:!0,logic:Ne,display:(a,i,c,y)=>e.jsx(Ie,{label:"Wallet",filterList:a,onChange:i,index:c,column:y,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:i,walletSendAt:c,walletSendFailedReason:y}=E[a];return e.jsx(pe,{status:i,updatedAt:c,reason:y,channel:"wallet",onResend:F=>g(F,E[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:i,pushKitSendAt:c,pushKitSendFailedReason:y}=E[a];return e.jsx(pe,{status:i,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>g(F,E[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(me,{list:a,label:"Push Kit",onDelete:(i,c)=>{i.stopPropagation(),T(i,c,R[2].options.filterList,"pushKitSendStatus")}}),update:Ce},filterOptions:{names:O,fullWidth:!0,logic:Ne,display:(a,i,c,y)=>e.jsx(Ie,{label:"Push Kit",filterList:a,onChange:i,index:c,column:y,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:i,emailSendAt:c,emailSendFailedReason:y}=E[a];return e.jsx(pe,{status:i,updatedAt:c,reason:y,channel:"email",onResend:F=>g(F,E[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(me,{list:a,label:"Email",onDelete:(i,c)=>{i.stopPropagation(),T(i,c,R[3].options.filterList,"emailSendStatus")}}),update:Ce},filterOptions:{names:O,fullWidth:!0,logic:Ne,display:(a,i,c,y)=>e.jsx(Ie,{label:"Email",filterList:a,onChange:i,index:c,column:y,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:i}=E[a];if(!i)return null;const c=Object.entries(i)[0];if(!c)return null;const[y,F]=c,K=F[0];return e.jsx(v,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(v,{className:"webhook-item",fontSize:12,children:[e.jsx(xe,{maxLength:30,children:y},y),e.jsx(pe,{status:K.status,updatedAt:K.sendAt,reason:K.failedReason,channel:"webhook",onResend:q=>g(q,E[a],"webhook",[y],!1)})]},y)})}}},{label:o("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:i}=E[a];return e.jsx(it,{value:i,locale:r,shouldUpdate:!0})}}}],[E,r,p,o]),U=[e.jsx($e,{value:p.dateRange,onChange:j},"date-picker"),e.jsx(ke,{variant:"contained",size:"small",color:"primary",loading:B,startIcon:e.jsx(Ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:o("common.refresh")},"refresh")];return e.jsx(v,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(hs,{children:e.jsxs(ot,{theme:b,children:[e.jsx(dt,{className:"receivers-table",locale:r,loading:B,columns:R,data:E,onChange:se,options:ae,customButtons:U,components:{TableFilterList:a=>e.jsx(He,{...a,itemComponent:i=>e.jsx(Te,{...i,canDelete:()=>!1})})}}),P.anchorEl&&e.jsx(Oe,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:ce,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(gs,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(v,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:je(I==null?void 0:I.channel).map(a=>{var F,K;const{type:i,pass:c,fail:y}=a;return!(I!=null&&I.result)||(F=I==null?void 0:I.result)!=null&&F[i]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(K=I==null?void 0:I.result)!=null&&K[i]?Se.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ft,{}):e.jsx(tt,{size:12,sx:{color:Se.primary.main}}),e.jsx("span",{children:c})]},i):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Se.error.main},children:[e.jsx(mt,{}),e.jsx("span",{children:y})]},i)})})]})}),k.anchorEl&&e.jsx(Oe,{open:!!k.anchorEl,anchorReference:"anchorPosition",anchorPosition:k.position,onClose:de,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ue,{loading:n,onCancel:de,onConfirm:h})})]})})})}const ms=x.memo(jt),hs=re.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1 +1 @@
1
- import{b$ as ft,c0 as ht,b8 as A,bX as $t,ce as jt,bY as f,r as d,c1 as vt,b_ as nt,c3 as N,j as b,c4 as mt,dh as oe,di as Ft,dj as Ht,dk as At,dl as le,dm as re,c2 as rt,al as ne,dn as bt,dp as se,dq as ae}from"./index-BOLfvqKF.js";let Y;function Ot(){if(Y)return Y;const t=document.createElement("div"),e=document.createElement("div");return e.style.width="10px",e.style.height="1px",t.appendChild(e),t.dir="rtl",t.style.fontSize="14px",t.style.width="4px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.overflow="scroll",document.body.appendChild(t),Y="reverse",t.scrollLeft>0?Y="default":(t.scrollLeft=1,t.scrollLeft===0&&(Y="negative")),document.body.removeChild(t),Y}function ie(t,e){const l=t.scrollLeft;if(e!=="rtl")return l;switch(Ot()){case"negative":return t.scrollWidth-t.clientWidth+l;case"reverse":return t.scrollWidth-t.clientWidth-l;default:return l}}function ce(t){return ht("MuiTab",t)}const k=ft("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","iconWrapper"]),de=["className","disabled","disableFocusRipple","fullWidth","icon","iconPosition","indicator","label","onChange","onClick","onFocus","selected","selectionFollowsFocus","textColor","value","wrapped"],ue=t=>{const{classes:e,textColor:l,fullWidth:a,wrapped:s,icon:n,label:u,selected:v,disabled:p}=t,x={root:["root",n&&u&&"labelIcon",`textColor${jt(l)}`,a&&"fullWidth",s&&"wrapped",v&&"selected",p&&"disabled"],iconWrapper:["iconWrapper"]};return mt(x,ce,e)},be=A($t,{name:"MuiTab",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.label&&l.icon&&e.labelIcon,e[`textColor${jt(l.textColor)}`],l.fullWidth&&e.fullWidth,l.wrapped&&e.wrapped,{[`& .${k.iconWrapper}`]:e.iconWrapper}]}})(({theme:t,ownerState:e})=>f({},t.typography.button,{maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center"},e.label&&{flexDirection:e.iconPosition==="top"||e.iconPosition==="bottom"?"column":"row"},{lineHeight:1.25},e.icon&&e.label&&{minHeight:72,paddingTop:9,paddingBottom:9,[`& > .${k.iconWrapper}`]:f({},e.iconPosition==="top"&&{marginBottom:6},e.iconPosition==="bottom"&&{marginTop:6},e.iconPosition==="start"&&{marginRight:t.spacing(1)},e.iconPosition==="end"&&{marginLeft:t.spacing(1)})},e.textColor==="inherit"&&{color:"inherit",opacity:.6,[`&.${k.selected}`]:{opacity:1},[`&.${k.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity}},e.textColor==="primary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.primary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.textColor==="secondary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.secondary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.fullWidth&&{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"},e.wrapped&&{fontSize:t.typography.pxToRem(12)})),St=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTab"}),{className:s,disabled:n=!1,disableFocusRipple:u=!1,fullWidth:v,icon:p,iconPosition:x="top",indicator:B,label:y,onChange:m,onClick:w,onFocus:L,selected:T,selectionFollowsFocus:g,textColor:O="inherit",value:E,wrapped:st=!1}=a,X=nt(a,de),V=f({},a,{disabled:n,disableFocusRipple:u,selected:T,icon:!!p,iconPosition:x,label:!!y,fullWidth:v,textColor:O,wrapped:st}),_=ue(V),$=p&&y&&d.isValidElement(p)?d.cloneElement(p,{className:N(_.iconWrapper,p.props.className)}):p,Q=R=>{!T&&m&&m(R,E),w&&w(R)},D=R=>{g&&!T&&m&&m(R,E),L&&L(R)};return b.jsxs(be,f({focusRipple:!u,className:N(_.root,s),ref:l,role:"tab","aria-selected":T,disabled:n,onClick:Q,onFocus:D,ownerState:V,tabIndex:T?0:-1},X,{children:[x==="top"||x==="start"?b.jsxs(d.Fragment,{children:[$,y]}):b.jsxs(d.Fragment,{children:[y,$]}),B]}))});function pe(t){return(1+Math.sin(Math.PI*t-Math.PI/2))/2}function fe(t,e,l,a={},s=()=>{}){const{ease:n=pe,duration:u=300}=a;let v=null;const p=e[t];let x=!1;const B=()=>{x=!0},y=m=>{if(x){s(new Error("Animation cancelled"));return}v===null&&(v=m);const w=Math.min(1,(m-v)/u);if(e[t]=n(w)*(l-p)+p,w>=1){requestAnimationFrame(()=>{s(null)});return}requestAnimationFrame(y)};return p===l?(s(new Error("Element already at target position")),B):(requestAnimationFrame(y),B)}const he=["onChange"],ve={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function me(t){const{onChange:e}=t,l=nt(t,he),a=d.useRef(),s=d.useRef(null),n=()=>{a.current=s.current.offsetHeight-s.current.clientHeight};return oe(()=>{const u=Ft(()=>{const p=a.current;n(),p!==a.current&&e(a.current)}),v=Ht(s.current);return v.addEventListener("resize",u),()=>{u.clear(),v.removeEventListener("resize",u)}},[e]),d.useEffect(()=>{n(),e(a.current)},[e]),b.jsx("div",f({style:ve},l,{ref:s}))}function Se(t){return ht("MuiTabScrollButton",t)}const xe=ft("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),ge=["className","slots","slotProps","direction","orientation","disabled"],ye=t=>{const{classes:e,orientation:l,disabled:a}=t;return mt({root:["root",l,a&&"disabled"]},Se,e)},Ce=A($t,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.orientation&&e[l.orientation]]}})(({ownerState:t})=>f({width:40,flexShrink:0,opacity:.8,[`&.${xe.disabled}`]:{opacity:0}},t.orientation==="vertical"&&{width:"100%",height:40,"& svg":{transform:`rotate(${t.isRtl?-90:90}deg)`}})),Be=d.forwardRef(function(e,l){var a,s;const n=vt({props:e,name:"MuiTabScrollButton"}),{className:u,slots:v={},slotProps:p={},direction:x}=n,B=nt(n,ge),y=At(),m=f({isRtl:y},n),w=ye(m),L=(a=v.StartScrollButtonIcon)!=null?a:le,T=(s=v.EndScrollButtonIcon)!=null?s:re,g=rt({elementType:L,externalSlotProps:p.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m}),O=rt({elementType:T,externalSlotProps:p.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m});return b.jsx(Ce,f({component:"div",className:N(w.root,u),ref:l,role:null,ownerState:m,tabIndex:null},B,{children:x==="left"?b.jsx(L,f({},g)):b.jsx(T,f({},O))}))});function we(t){return ht("MuiTabs",t)}const pt=ft("MuiTabs",["root","vertical","flexContainer","flexContainerVertical","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),Te=["aria-label","aria-labelledby","action","centered","children","className","component","allowScrollButtonsMobile","indicatorColor","onChange","orientation","ScrollButtonComponent","scrollButtons","selectionFollowsFocus","slots","slotProps","TabIndicatorProps","TabScrollButtonProps","textColor","value","variant","visibleScrollbar"],Pt=(t,e)=>t===e?t.firstChild:e&&e.nextElementSibling?e.nextElementSibling:t.firstChild,kt=(t,e)=>t===e?t.lastChild:e&&e.previousElementSibling?e.previousElementSibling:t.lastChild,lt=(t,e,l)=>{let a=!1,s=l(t,e);for(;s;){if(s===t.firstChild){if(a)return;a=!0}const n=s.disabled||s.getAttribute("aria-disabled")==="true";if(!s.hasAttribute("tabindex")||n)s=l(t,s);else{s.focus();return}}},Me=t=>{const{vertical:e,fixed:l,hideScrollbar:a,scrollableX:s,scrollableY:n,centered:u,scrollButtonsHideMobile:v,classes:p}=t;return mt({root:["root",e&&"vertical"],scroller:["scroller",l&&"fixed",a&&"hideScrollbar",s&&"scrollableX",n&&"scrollableY"],flexContainer:["flexContainer",e&&"flexContainerVertical",u&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",v&&"scrollButtonsHideMobile"],scrollableX:[s&&"scrollableX"],hideScrollbar:[a&&"hideScrollbar"]},we,p)},Ie=A("div",{name:"MuiTabs",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[{[`& .${pt.scrollButtons}`]:e.scrollButtons},{[`& .${pt.scrollButtons}`]:l.scrollButtonsHideMobile&&e.scrollButtonsHideMobile},e.root,l.vertical&&e.vertical]}})(({ownerState:t,theme:e})=>f({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex"},t.vertical&&{flexDirection:"column"},t.scrollButtonsHideMobile&&{[`& .${pt.scrollButtons}`]:{[e.breakpoints.down("sm")]:{display:"none"}}})),Ee=A("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.scroller,l.fixed&&e.fixed,l.hideScrollbar&&e.hideScrollbar,l.scrollableX&&e.scrollableX,l.scrollableY&&e.scrollableY]}})(({ownerState:t})=>f({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap"},t.fixed&&{overflowX:"hidden",width:"100%"},t.hideScrollbar&&{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},t.scrollableX&&{overflowX:"auto",overflowY:"hidden"},t.scrollableY&&{overflowY:"auto",overflowX:"hidden"})),Re=A("div",{name:"MuiTabs",slot:"FlexContainer",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.flexContainer,l.vertical&&e.flexContainerVertical,l.centered&&e.centered]}})(({ownerState:t})=>f({display:"flex"},t.vertical&&{flexDirection:"column"},t.centered&&{justifyContent:"center"})),ze=A("span",{name:"MuiTabs",slot:"Indicator",overridesResolver:(t,e)=>e.indicator})(({ownerState:t,theme:e})=>f({position:"absolute",height:2,bottom:0,width:"100%",transition:e.transitions.create()},t.indicatorColor==="primary"&&{backgroundColor:(e.vars||e).palette.primary.main},t.indicatorColor==="secondary"&&{backgroundColor:(e.vars||e).palette.secondary.main},t.vertical&&{height:"100%",width:2,right:0})),We=A(me)({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Nt={},xt=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTabs"}),s=ne(),n=At(),{"aria-label":u,"aria-labelledby":v,action:p,centered:x=!1,children:B,className:y,component:m="div",allowScrollButtonsMobile:w=!1,indicatorColor:L="primary",onChange:T,orientation:g="horizontal",ScrollButtonComponent:O=Be,scrollButtons:E="auto",selectionFollowsFocus:st,slots:X={},slotProps:V={},TabIndicatorProps:_={},TabScrollButtonProps:$={},textColor:Q="primary",value:D,variant:R="standard",visibleScrollbar:at=!1}=a,Xt=nt(a,Te),M=R==="scrollable",C=g==="vertical",K=C?"scrollTop":"scrollLeft",Z=C?"top":"left",tt=C?"bottom":"right",it=C?"clientHeight":"clientWidth",q=C?"height":"width",j=f({},a,{component:m,allowScrollButtonsMobile:w,indicatorColor:L,orientation:g,vertical:C,scrollButtons:E,textColor:Q,variant:R,visibleScrollbar:at,fixed:!M,hideScrollbar:M&&!at,scrollableX:M&&!C,scrollableY:M&&C,centered:x&&!M,scrollButtonsHideMobile:!w}),W=Me(j),_t=rt({elementType:X.StartScrollButtonIcon,externalSlotProps:V.startScrollButtonIcon,ownerState:j}),Dt=rt({elementType:X.EndScrollButtonIcon,externalSlotProps:V.endScrollButtonIcon,ownerState:j}),[gt,Yt]=d.useState(!1),[F,yt]=d.useState(Nt),[Ct,Ut]=d.useState(!1),[Bt,Vt]=d.useState(!1),[wt,Kt]=d.useState(!1),[Tt,qt]=d.useState({overflow:"hidden",scrollbarWidth:0}),Mt=new Map,z=d.useRef(null),H=d.useRef(null),It=()=>{const o=z.current;let r;if(o){const i=o.getBoundingClientRect();r={clientWidth:o.clientWidth,scrollLeft:o.scrollLeft,scrollTop:o.scrollTop,scrollLeftNormalized:ie(o,n?"rtl":"ltr"),scrollWidth:o.scrollWidth,top:i.top,bottom:i.bottom,left:i.left,right:i.right}}let c;if(o&&D!==!1){const i=H.current.children;if(i.length>0){const h=i[Mt.get(D)];c=h?h.getBoundingClientRect():null}}return{tabsMeta:r,tabMeta:c}},G=bt(()=>{const{tabsMeta:o,tabMeta:r}=It();let c=0,i;if(C)i="top",r&&o&&(c=r.top-o.top+o.scrollTop);else if(i=n?"right":"left",r&&o){const S=n?o.scrollLeftNormalized+o.clientWidth-o.scrollWidth:o.scrollLeft;c=(n?-1:1)*(r[i]-o[i]+S)}const h={[i]:c,[q]:r?r[q]:0};if(isNaN(F[i])||isNaN(F[q]))yt(h);else{const S=Math.abs(F[i]-h[i]),I=Math.abs(F[q]-h[q]);(S>=1||I>=1)&&yt(h)}}),ct=(o,{animation:r=!0}={})=>{r?fe(K,z.current,o,{duration:s.transitions.duration.standard}):z.current[K]=o},Et=o=>{let r=z.current[K];C?r+=o:(r+=o*(n?-1:1),r*=n&&Ot()==="reverse"?-1:1),ct(r)},Rt=()=>{const o=z.current[it];let r=0;const c=Array.from(H.current.children);for(let i=0;i<c.length;i+=1){const h=c[i];if(r+h[it]>o){i===0&&(r=o);break}r+=h[it]}return r},Gt=()=>{Et(-1*Rt())},Jt=()=>{Et(Rt())},Qt=d.useCallback(o=>{qt({overflow:null,scrollbarWidth:o})},[]),Zt=()=>{const o={};o.scrollbarSizeListener=M?b.jsx(We,{onChange:Qt,className:N(W.scrollableX,W.hideScrollbar)}):null;const c=M&&(E==="auto"&&(Ct||Bt)||E===!0);return o.scrollButtonStart=c?b.jsx(O,f({slots:{StartScrollButtonIcon:X.StartScrollButtonIcon},slotProps:{startScrollButtonIcon:_t},orientation:g,direction:n?"right":"left",onClick:Gt,disabled:!Ct},$,{className:N(W.scrollButtons,$.className)})):null,o.scrollButtonEnd=c?b.jsx(O,f({slots:{EndScrollButtonIcon:X.EndScrollButtonIcon},slotProps:{endScrollButtonIcon:Dt},orientation:g,direction:n?"left":"right",onClick:Jt,disabled:!Bt},$,{className:N(W.scrollButtons,$.className)})):null,o},zt=bt(o=>{const{tabsMeta:r,tabMeta:c}=It();if(!(!c||!r)){if(c[Z]<r[Z]){const i=r[K]+(c[Z]-r[Z]);ct(i,{animation:o})}else if(c[tt]>r[tt]){const i=r[K]+(c[tt]-r[tt]);ct(i,{animation:o})}}}),et=bt(()=>{M&&E!==!1&&Kt(!wt)});d.useEffect(()=>{const o=Ft(()=>{z.current&&G()});let r;const c=S=>{S.forEach(I=>{I.removedNodes.forEach(J=>{var P;(P=r)==null||P.unobserve(J)}),I.addedNodes.forEach(J=>{var P;(P=r)==null||P.observe(J)})}),o(),et()},i=Ht(z.current);i.addEventListener("resize",o);let h;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(o),Array.from(H.current.children).forEach(S=>{r.observe(S)})),typeof MutationObserver<"u"&&(h=new MutationObserver(c),h.observe(H.current,{childList:!0})),()=>{var S,I;o.clear(),i.removeEventListener("resize",o),(S=h)==null||S.disconnect(),(I=r)==null||I.disconnect()}},[G,et]),d.useEffect(()=>{const o=Array.from(H.current.children),r=o.length;if(typeof IntersectionObserver<"u"&&r>0&&M&&E!==!1){const c=o[0],i=o[r-1],h={root:z.current,threshold:.99},S=ut=>{Ut(!ut[0].isIntersecting)},I=new IntersectionObserver(S,h);I.observe(c);const J=ut=>{Vt(!ut[0].isIntersecting)},P=new IntersectionObserver(J,h);return P.observe(i),()=>{I.disconnect(),P.disconnect()}}},[M,E,wt,B==null?void 0:B.length]),d.useEffect(()=>{Yt(!0)},[]),d.useEffect(()=>{G()}),d.useEffect(()=>{zt(Nt!==F)},[zt,F]),d.useImperativeHandle(p,()=>({updateIndicator:G,updateScrollButtons:et}),[G,et]);const Wt=b.jsx(ze,f({},_,{className:N(W.indicator,_.className),ownerState:j,style:f({},F,_.style)}));let ot=0;const te=d.Children.map(B,o=>{if(!d.isValidElement(o))return null;const r=o.props.value===void 0?ot:o.props.value;Mt.set(r,ot);const c=r===D;return ot+=1,d.cloneElement(o,f({fullWidth:R==="fullWidth",indicator:c&&!gt&&Wt,selected:c,selectionFollowsFocus:st,onChange:T,textColor:Q,value:r},ot===1&&D===!1&&!o.props.tabIndex?{tabIndex:0}:{}))}),ee=o=>{const r=H.current,c=se(r).activeElement;if(c.getAttribute("role")!=="tab")return;let h=g==="horizontal"?"ArrowLeft":"ArrowUp",S=g==="horizontal"?"ArrowRight":"ArrowDown";switch(g==="horizontal"&&n&&(h="ArrowRight",S="ArrowLeft"),o.key){case h:o.preventDefault(),lt(r,c,kt);break;case S:o.preventDefault(),lt(r,c,Pt);break;case"Home":o.preventDefault(),lt(r,null,Pt);break;case"End":o.preventDefault(),lt(r,null,kt);break}},dt=Zt();return b.jsxs(Ie,f({className:N(W.root,y),ownerState:j,ref:l,as:m},Xt,{children:[dt.scrollButtonStart,dt.scrollbarSizeListener,b.jsxs(Ee,{className:W.scroller,ownerState:j,style:{overflow:Tt.overflow,[C?`margin${n?"Left":"Right"}`:"marginBottom"]:at?void 0:-Tt.scrollbarWidth},ref:z,children:[b.jsx(Re,{"aria-label":u,"aria-labelledby":v,"aria-orientation":g==="vertical"?"vertical":null,className:W.flexContainer,ownerState:j,onKeyDown:ee,ref:H,role:"tablist",children:te}),gt&&Wt]}),dt.scrollButtonEnd]}))}),Lt="index",U={tabs:`${Lt}-tabs`,tab:`${Lt}-tab`},Pe=ae(xt)(({theme:t})=>({[`& .${U.tabs}`]:{},[`& .${U.tab}`]:{fontSize:"0.875rem",[t.breakpoints.up("md")]:{fontSize:"1rem"}}}));function ke({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":{borderRadius:"100vw"},".MuiTabs-flexContainer":{borderRadius:"100vw",backgroundColor:"grey.100",padding:.5,display:"inline-flex",columnGap:.25,maxWidth:"100%",overflowX:"auto"},".MuiTab-root":{borderRadius:"100vw",border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,color:"text.secondary",fontSize:"13px",fontWeight:"normal",textTransform:"capitalize",transition:"background-color 0.2s ease","&.Mui-selected, &:hover":{backgroundColor:"action.selected",borderColor:"grey.100",color:"grey.A700"}},".MuiTabs-indicator":{display:"none"},...s.sx},children:t.map(n=>b.jsx(St,{className:U.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function Ne({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":s.orientation!=="vertical"?{"&::after":{content:'""',display:"block",position:"sticky",left:0,zIndex:-1,width:"100%",height:"1px",backgroundColor:"grey.300"}}:{},".MuiTabs-flexContainer":{display:"inline-flex",columnGap:2.5,px:0,pb:.5},".MuiTab-root":{border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,px:0,color:"text.secondary",fontSize:"14px",fontWeight:500,textTransform:"capitalize",minWidth:"auto","&.Mui-selected, &:hover":{color:"primary.main"}},".MuiTabs-indicator":{height:"1px",backgroundColor:"primary.main"},...s.sx},children:t.map(n=>b.jsx(St,{className:U.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function $e({tabs:t,current:e,onChange:l,variant:a,iconPosition:s,...n}){return a==="card"?b.jsx(ke,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):a==="line"?b.jsx(Ne,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):b.jsx(Pe,{scrollButtons:"auto",variant:"scrollable",value:e,onChange:(u,v)=>l(v),indicatorColor:"primary",...n,className:[U.tabs,n.className||""].join(" "),children:t.map(u=>b.jsx(St,{className:U.tab,value:u.value,label:u.label,icon:u.icon,iconPosition:s},u.value))})}export{$e as T,xt as a,St as b,Ot as d,ie as g,pt as t};
1
+ import{b$ as ft,c0 as ht,b8 as A,bX as $t,ce as jt,bY as f,r as d,c1 as vt,b_ as nt,c3 as N,j as b,c4 as mt,dh as oe,di as Ft,dj as Ht,dk as At,dl as le,dm as re,c2 as rt,al as ne,dn as bt,dp as se,dq as ae}from"./index-DTb1YjkO.js";let Y;function Ot(){if(Y)return Y;const t=document.createElement("div"),e=document.createElement("div");return e.style.width="10px",e.style.height="1px",t.appendChild(e),t.dir="rtl",t.style.fontSize="14px",t.style.width="4px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.overflow="scroll",document.body.appendChild(t),Y="reverse",t.scrollLeft>0?Y="default":(t.scrollLeft=1,t.scrollLeft===0&&(Y="negative")),document.body.removeChild(t),Y}function ie(t,e){const l=t.scrollLeft;if(e!=="rtl")return l;switch(Ot()){case"negative":return t.scrollWidth-t.clientWidth+l;case"reverse":return t.scrollWidth-t.clientWidth-l;default:return l}}function ce(t){return ht("MuiTab",t)}const k=ft("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","iconWrapper"]),de=["className","disabled","disableFocusRipple","fullWidth","icon","iconPosition","indicator","label","onChange","onClick","onFocus","selected","selectionFollowsFocus","textColor","value","wrapped"],ue=t=>{const{classes:e,textColor:l,fullWidth:a,wrapped:s,icon:n,label:u,selected:v,disabled:p}=t,x={root:["root",n&&u&&"labelIcon",`textColor${jt(l)}`,a&&"fullWidth",s&&"wrapped",v&&"selected",p&&"disabled"],iconWrapper:["iconWrapper"]};return mt(x,ce,e)},be=A($t,{name:"MuiTab",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.label&&l.icon&&e.labelIcon,e[`textColor${jt(l.textColor)}`],l.fullWidth&&e.fullWidth,l.wrapped&&e.wrapped,{[`& .${k.iconWrapper}`]:e.iconWrapper}]}})(({theme:t,ownerState:e})=>f({},t.typography.button,{maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center"},e.label&&{flexDirection:e.iconPosition==="top"||e.iconPosition==="bottom"?"column":"row"},{lineHeight:1.25},e.icon&&e.label&&{minHeight:72,paddingTop:9,paddingBottom:9,[`& > .${k.iconWrapper}`]:f({},e.iconPosition==="top"&&{marginBottom:6},e.iconPosition==="bottom"&&{marginTop:6},e.iconPosition==="start"&&{marginRight:t.spacing(1)},e.iconPosition==="end"&&{marginLeft:t.spacing(1)})},e.textColor==="inherit"&&{color:"inherit",opacity:.6,[`&.${k.selected}`]:{opacity:1},[`&.${k.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity}},e.textColor==="primary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.primary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.textColor==="secondary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.secondary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.fullWidth&&{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"},e.wrapped&&{fontSize:t.typography.pxToRem(12)})),St=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTab"}),{className:s,disabled:n=!1,disableFocusRipple:u=!1,fullWidth:v,icon:p,iconPosition:x="top",indicator:B,label:y,onChange:m,onClick:w,onFocus:L,selected:T,selectionFollowsFocus:g,textColor:O="inherit",value:E,wrapped:st=!1}=a,X=nt(a,de),V=f({},a,{disabled:n,disableFocusRipple:u,selected:T,icon:!!p,iconPosition:x,label:!!y,fullWidth:v,textColor:O,wrapped:st}),_=ue(V),$=p&&y&&d.isValidElement(p)?d.cloneElement(p,{className:N(_.iconWrapper,p.props.className)}):p,Q=R=>{!T&&m&&m(R,E),w&&w(R)},D=R=>{g&&!T&&m&&m(R,E),L&&L(R)};return b.jsxs(be,f({focusRipple:!u,className:N(_.root,s),ref:l,role:"tab","aria-selected":T,disabled:n,onClick:Q,onFocus:D,ownerState:V,tabIndex:T?0:-1},X,{children:[x==="top"||x==="start"?b.jsxs(d.Fragment,{children:[$,y]}):b.jsxs(d.Fragment,{children:[y,$]}),B]}))});function pe(t){return(1+Math.sin(Math.PI*t-Math.PI/2))/2}function fe(t,e,l,a={},s=()=>{}){const{ease:n=pe,duration:u=300}=a;let v=null;const p=e[t];let x=!1;const B=()=>{x=!0},y=m=>{if(x){s(new Error("Animation cancelled"));return}v===null&&(v=m);const w=Math.min(1,(m-v)/u);if(e[t]=n(w)*(l-p)+p,w>=1){requestAnimationFrame(()=>{s(null)});return}requestAnimationFrame(y)};return p===l?(s(new Error("Element already at target position")),B):(requestAnimationFrame(y),B)}const he=["onChange"],ve={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function me(t){const{onChange:e}=t,l=nt(t,he),a=d.useRef(),s=d.useRef(null),n=()=>{a.current=s.current.offsetHeight-s.current.clientHeight};return oe(()=>{const u=Ft(()=>{const p=a.current;n(),p!==a.current&&e(a.current)}),v=Ht(s.current);return v.addEventListener("resize",u),()=>{u.clear(),v.removeEventListener("resize",u)}},[e]),d.useEffect(()=>{n(),e(a.current)},[e]),b.jsx("div",f({style:ve},l,{ref:s}))}function Se(t){return ht("MuiTabScrollButton",t)}const xe=ft("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),ge=["className","slots","slotProps","direction","orientation","disabled"],ye=t=>{const{classes:e,orientation:l,disabled:a}=t;return mt({root:["root",l,a&&"disabled"]},Se,e)},Ce=A($t,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.orientation&&e[l.orientation]]}})(({ownerState:t})=>f({width:40,flexShrink:0,opacity:.8,[`&.${xe.disabled}`]:{opacity:0}},t.orientation==="vertical"&&{width:"100%",height:40,"& svg":{transform:`rotate(${t.isRtl?-90:90}deg)`}})),Be=d.forwardRef(function(e,l){var a,s;const n=vt({props:e,name:"MuiTabScrollButton"}),{className:u,slots:v={},slotProps:p={},direction:x}=n,B=nt(n,ge),y=At(),m=f({isRtl:y},n),w=ye(m),L=(a=v.StartScrollButtonIcon)!=null?a:le,T=(s=v.EndScrollButtonIcon)!=null?s:re,g=rt({elementType:L,externalSlotProps:p.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m}),O=rt({elementType:T,externalSlotProps:p.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m});return b.jsx(Ce,f({component:"div",className:N(w.root,u),ref:l,role:null,ownerState:m,tabIndex:null},B,{children:x==="left"?b.jsx(L,f({},g)):b.jsx(T,f({},O))}))});function we(t){return ht("MuiTabs",t)}const pt=ft("MuiTabs",["root","vertical","flexContainer","flexContainerVertical","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),Te=["aria-label","aria-labelledby","action","centered","children","className","component","allowScrollButtonsMobile","indicatorColor","onChange","orientation","ScrollButtonComponent","scrollButtons","selectionFollowsFocus","slots","slotProps","TabIndicatorProps","TabScrollButtonProps","textColor","value","variant","visibleScrollbar"],Pt=(t,e)=>t===e?t.firstChild:e&&e.nextElementSibling?e.nextElementSibling:t.firstChild,kt=(t,e)=>t===e?t.lastChild:e&&e.previousElementSibling?e.previousElementSibling:t.lastChild,lt=(t,e,l)=>{let a=!1,s=l(t,e);for(;s;){if(s===t.firstChild){if(a)return;a=!0}const n=s.disabled||s.getAttribute("aria-disabled")==="true";if(!s.hasAttribute("tabindex")||n)s=l(t,s);else{s.focus();return}}},Me=t=>{const{vertical:e,fixed:l,hideScrollbar:a,scrollableX:s,scrollableY:n,centered:u,scrollButtonsHideMobile:v,classes:p}=t;return mt({root:["root",e&&"vertical"],scroller:["scroller",l&&"fixed",a&&"hideScrollbar",s&&"scrollableX",n&&"scrollableY"],flexContainer:["flexContainer",e&&"flexContainerVertical",u&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",v&&"scrollButtonsHideMobile"],scrollableX:[s&&"scrollableX"],hideScrollbar:[a&&"hideScrollbar"]},we,p)},Ie=A("div",{name:"MuiTabs",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[{[`& .${pt.scrollButtons}`]:e.scrollButtons},{[`& .${pt.scrollButtons}`]:l.scrollButtonsHideMobile&&e.scrollButtonsHideMobile},e.root,l.vertical&&e.vertical]}})(({ownerState:t,theme:e})=>f({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex"},t.vertical&&{flexDirection:"column"},t.scrollButtonsHideMobile&&{[`& .${pt.scrollButtons}`]:{[e.breakpoints.down("sm")]:{display:"none"}}})),Ee=A("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.scroller,l.fixed&&e.fixed,l.hideScrollbar&&e.hideScrollbar,l.scrollableX&&e.scrollableX,l.scrollableY&&e.scrollableY]}})(({ownerState:t})=>f({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap"},t.fixed&&{overflowX:"hidden",width:"100%"},t.hideScrollbar&&{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},t.scrollableX&&{overflowX:"auto",overflowY:"hidden"},t.scrollableY&&{overflowY:"auto",overflowX:"hidden"})),Re=A("div",{name:"MuiTabs",slot:"FlexContainer",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.flexContainer,l.vertical&&e.flexContainerVertical,l.centered&&e.centered]}})(({ownerState:t})=>f({display:"flex"},t.vertical&&{flexDirection:"column"},t.centered&&{justifyContent:"center"})),ze=A("span",{name:"MuiTabs",slot:"Indicator",overridesResolver:(t,e)=>e.indicator})(({ownerState:t,theme:e})=>f({position:"absolute",height:2,bottom:0,width:"100%",transition:e.transitions.create()},t.indicatorColor==="primary"&&{backgroundColor:(e.vars||e).palette.primary.main},t.indicatorColor==="secondary"&&{backgroundColor:(e.vars||e).palette.secondary.main},t.vertical&&{height:"100%",width:2,right:0})),We=A(me)({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Nt={},xt=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTabs"}),s=ne(),n=At(),{"aria-label":u,"aria-labelledby":v,action:p,centered:x=!1,children:B,className:y,component:m="div",allowScrollButtonsMobile:w=!1,indicatorColor:L="primary",onChange:T,orientation:g="horizontal",ScrollButtonComponent:O=Be,scrollButtons:E="auto",selectionFollowsFocus:st,slots:X={},slotProps:V={},TabIndicatorProps:_={},TabScrollButtonProps:$={},textColor:Q="primary",value:D,variant:R="standard",visibleScrollbar:at=!1}=a,Xt=nt(a,Te),M=R==="scrollable",C=g==="vertical",K=C?"scrollTop":"scrollLeft",Z=C?"top":"left",tt=C?"bottom":"right",it=C?"clientHeight":"clientWidth",q=C?"height":"width",j=f({},a,{component:m,allowScrollButtonsMobile:w,indicatorColor:L,orientation:g,vertical:C,scrollButtons:E,textColor:Q,variant:R,visibleScrollbar:at,fixed:!M,hideScrollbar:M&&!at,scrollableX:M&&!C,scrollableY:M&&C,centered:x&&!M,scrollButtonsHideMobile:!w}),W=Me(j),_t=rt({elementType:X.StartScrollButtonIcon,externalSlotProps:V.startScrollButtonIcon,ownerState:j}),Dt=rt({elementType:X.EndScrollButtonIcon,externalSlotProps:V.endScrollButtonIcon,ownerState:j}),[gt,Yt]=d.useState(!1),[F,yt]=d.useState(Nt),[Ct,Ut]=d.useState(!1),[Bt,Vt]=d.useState(!1),[wt,Kt]=d.useState(!1),[Tt,qt]=d.useState({overflow:"hidden",scrollbarWidth:0}),Mt=new Map,z=d.useRef(null),H=d.useRef(null),It=()=>{const o=z.current;let r;if(o){const i=o.getBoundingClientRect();r={clientWidth:o.clientWidth,scrollLeft:o.scrollLeft,scrollTop:o.scrollTop,scrollLeftNormalized:ie(o,n?"rtl":"ltr"),scrollWidth:o.scrollWidth,top:i.top,bottom:i.bottom,left:i.left,right:i.right}}let c;if(o&&D!==!1){const i=H.current.children;if(i.length>0){const h=i[Mt.get(D)];c=h?h.getBoundingClientRect():null}}return{tabsMeta:r,tabMeta:c}},G=bt(()=>{const{tabsMeta:o,tabMeta:r}=It();let c=0,i;if(C)i="top",r&&o&&(c=r.top-o.top+o.scrollTop);else if(i=n?"right":"left",r&&o){const S=n?o.scrollLeftNormalized+o.clientWidth-o.scrollWidth:o.scrollLeft;c=(n?-1:1)*(r[i]-o[i]+S)}const h={[i]:c,[q]:r?r[q]:0};if(isNaN(F[i])||isNaN(F[q]))yt(h);else{const S=Math.abs(F[i]-h[i]),I=Math.abs(F[q]-h[q]);(S>=1||I>=1)&&yt(h)}}),ct=(o,{animation:r=!0}={})=>{r?fe(K,z.current,o,{duration:s.transitions.duration.standard}):z.current[K]=o},Et=o=>{let r=z.current[K];C?r+=o:(r+=o*(n?-1:1),r*=n&&Ot()==="reverse"?-1:1),ct(r)},Rt=()=>{const o=z.current[it];let r=0;const c=Array.from(H.current.children);for(let i=0;i<c.length;i+=1){const h=c[i];if(r+h[it]>o){i===0&&(r=o);break}r+=h[it]}return r},Gt=()=>{Et(-1*Rt())},Jt=()=>{Et(Rt())},Qt=d.useCallback(o=>{qt({overflow:null,scrollbarWidth:o})},[]),Zt=()=>{const o={};o.scrollbarSizeListener=M?b.jsx(We,{onChange:Qt,className:N(W.scrollableX,W.hideScrollbar)}):null;const c=M&&(E==="auto"&&(Ct||Bt)||E===!0);return o.scrollButtonStart=c?b.jsx(O,f({slots:{StartScrollButtonIcon:X.StartScrollButtonIcon},slotProps:{startScrollButtonIcon:_t},orientation:g,direction:n?"right":"left",onClick:Gt,disabled:!Ct},$,{className:N(W.scrollButtons,$.className)})):null,o.scrollButtonEnd=c?b.jsx(O,f({slots:{EndScrollButtonIcon:X.EndScrollButtonIcon},slotProps:{endScrollButtonIcon:Dt},orientation:g,direction:n?"left":"right",onClick:Jt,disabled:!Bt},$,{className:N(W.scrollButtons,$.className)})):null,o},zt=bt(o=>{const{tabsMeta:r,tabMeta:c}=It();if(!(!c||!r)){if(c[Z]<r[Z]){const i=r[K]+(c[Z]-r[Z]);ct(i,{animation:o})}else if(c[tt]>r[tt]){const i=r[K]+(c[tt]-r[tt]);ct(i,{animation:o})}}}),et=bt(()=>{M&&E!==!1&&Kt(!wt)});d.useEffect(()=>{const o=Ft(()=>{z.current&&G()});let r;const c=S=>{S.forEach(I=>{I.removedNodes.forEach(J=>{var P;(P=r)==null||P.unobserve(J)}),I.addedNodes.forEach(J=>{var P;(P=r)==null||P.observe(J)})}),o(),et()},i=Ht(z.current);i.addEventListener("resize",o);let h;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(o),Array.from(H.current.children).forEach(S=>{r.observe(S)})),typeof MutationObserver<"u"&&(h=new MutationObserver(c),h.observe(H.current,{childList:!0})),()=>{var S,I;o.clear(),i.removeEventListener("resize",o),(S=h)==null||S.disconnect(),(I=r)==null||I.disconnect()}},[G,et]),d.useEffect(()=>{const o=Array.from(H.current.children),r=o.length;if(typeof IntersectionObserver<"u"&&r>0&&M&&E!==!1){const c=o[0],i=o[r-1],h={root:z.current,threshold:.99},S=ut=>{Ut(!ut[0].isIntersecting)},I=new IntersectionObserver(S,h);I.observe(c);const J=ut=>{Vt(!ut[0].isIntersecting)},P=new IntersectionObserver(J,h);return P.observe(i),()=>{I.disconnect(),P.disconnect()}}},[M,E,wt,B==null?void 0:B.length]),d.useEffect(()=>{Yt(!0)},[]),d.useEffect(()=>{G()}),d.useEffect(()=>{zt(Nt!==F)},[zt,F]),d.useImperativeHandle(p,()=>({updateIndicator:G,updateScrollButtons:et}),[G,et]);const Wt=b.jsx(ze,f({},_,{className:N(W.indicator,_.className),ownerState:j,style:f({},F,_.style)}));let ot=0;const te=d.Children.map(B,o=>{if(!d.isValidElement(o))return null;const r=o.props.value===void 0?ot:o.props.value;Mt.set(r,ot);const c=r===D;return ot+=1,d.cloneElement(o,f({fullWidth:R==="fullWidth",indicator:c&&!gt&&Wt,selected:c,selectionFollowsFocus:st,onChange:T,textColor:Q,value:r},ot===1&&D===!1&&!o.props.tabIndex?{tabIndex:0}:{}))}),ee=o=>{const r=H.current,c=se(r).activeElement;if(c.getAttribute("role")!=="tab")return;let h=g==="horizontal"?"ArrowLeft":"ArrowUp",S=g==="horizontal"?"ArrowRight":"ArrowDown";switch(g==="horizontal"&&n&&(h="ArrowRight",S="ArrowLeft"),o.key){case h:o.preventDefault(),lt(r,c,kt);break;case S:o.preventDefault(),lt(r,c,Pt);break;case"Home":o.preventDefault(),lt(r,null,Pt);break;case"End":o.preventDefault(),lt(r,null,kt);break}},dt=Zt();return b.jsxs(Ie,f({className:N(W.root,y),ownerState:j,ref:l,as:m},Xt,{children:[dt.scrollButtonStart,dt.scrollbarSizeListener,b.jsxs(Ee,{className:W.scroller,ownerState:j,style:{overflow:Tt.overflow,[C?`margin${n?"Left":"Right"}`:"marginBottom"]:at?void 0:-Tt.scrollbarWidth},ref:z,children:[b.jsx(Re,{"aria-label":u,"aria-labelledby":v,"aria-orientation":g==="vertical"?"vertical":null,className:W.flexContainer,ownerState:j,onKeyDown:ee,ref:H,role:"tablist",children:te}),gt&&Wt]}),dt.scrollButtonEnd]}))}),Lt="index",U={tabs:`${Lt}-tabs`,tab:`${Lt}-tab`},Pe=ae(xt)(({theme:t})=>({[`& .${U.tabs}`]:{},[`& .${U.tab}`]:{fontSize:"0.875rem",[t.breakpoints.up("md")]:{fontSize:"1rem"}}}));function ke({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":{borderRadius:"100vw"},".MuiTabs-flexContainer":{borderRadius:"100vw",backgroundColor:"grey.100",padding:.5,display:"inline-flex",columnGap:.25,maxWidth:"100%",overflowX:"auto"},".MuiTab-root":{borderRadius:"100vw",border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,color:"text.secondary",fontSize:"13px",fontWeight:"normal",textTransform:"capitalize",transition:"background-color 0.2s ease","&.Mui-selected, &:hover":{backgroundColor:"action.selected",borderColor:"grey.100",color:"grey.A700"}},".MuiTabs-indicator":{display:"none"},...s.sx},children:t.map(n=>b.jsx(St,{className:U.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function Ne({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":s.orientation!=="vertical"?{"&::after":{content:'""',display:"block",position:"sticky",left:0,zIndex:-1,width:"100%",height:"1px",backgroundColor:"grey.300"}}:{},".MuiTabs-flexContainer":{display:"inline-flex",columnGap:2.5,px:0,pb:.5},".MuiTab-root":{border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,px:0,color:"text.secondary",fontSize:"14px",fontWeight:500,textTransform:"capitalize",minWidth:"auto","&.Mui-selected, &:hover":{color:"primary.main"}},".MuiTabs-indicator":{height:"1px",backgroundColor:"primary.main"},...s.sx},children:t.map(n=>b.jsx(St,{className:U.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function $e({tabs:t,current:e,onChange:l,variant:a,iconPosition:s,...n}){return a==="card"?b.jsx(ke,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):a==="line"?b.jsx(Ne,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):b.jsx(Pe,{scrollButtons:"auto",variant:"scrollable",value:e,onChange:(u,v)=>l(v),indicatorColor:"primary",...n,className:[U.tabs,n.className||""].join(" "),children:t.map(u=>b.jsx(St,{className:U.tab,value:u.value,label:u.label,icon:u.icon,iconPosition:s},u.value))})}export{$e as T,xt as a,St as b,Ot as d,ie as g,pt as t};
@@ -1,4 +1,4 @@
1
- import{c as H,r as i,u as W,a as E,b as P,j as e,P as y,L as O,d as Q,_ as Y,e as F,f as X,W as R,g as J,T as j,h as K,i as k,k as h,G as g,n as q,p as Z,C as ee,l as L}from"./index-BOLfvqKF.js";import{f as ne}from"./index-BojVbZw0.js";import{I as T}from"./index-D732T1aT.js";import{M as V}from"./metric-BDJmu11E.js";import{C as D}from"./click-to-copy-CgzyQB5V.js";import{w as se}from"./withStyles-zmjsbKsz.js";var te=H(function(t,d,r){return t+(r?" ":"")+d.toLowerCase()});const B=i.createContext({}),{Provider:ae,Consumer:ge}=B;function re({children:t}){const{api:d,info:r}=W(),[u,l]=i.useState(null),[c,a]=i.useState(!1),[n,p]=i.useState([]),_=4,f=async({silent:o=!0,retries:m=_}={})=>{o||a(!0);try{l(null);const{users:x}=await d.getUsers({input:{teamDid:r.did,paging:{pageSize:100}}});a(!1),p(x)}catch(x){m>0?setTimeout(()=>f({silent:o,retries:m-1}),1e3):(a(!1),l(x))}};i.useEffect(()=>{f({silent:!1})},[]),E(P.TeamEvents.userAdded,({teamDid:o})=>{o===r.did&&f()}),E(P.TeamEvents.userRemoved,({teamDid:o,user:{did:m}})=>{o===r.did&&p(x=>x.filter(S=>S.did!==m))}),E(P.TeamEvents.userUpdated,({teamDid:o})=>{o===r.did&&f()});const b={loading:c,error:u,users:n,refresh:f};return e.jsx(ae,{value:{users:b},children:t})}function oe(){const{users:t}=i.useContext(B);return t}const v={oneSecond:1,oneMin:1*60,oneHour:1*60*60,oneDay:24*60*60},ie=(t,d)=>{const[r,u]=i.useState(0),l=n=>n>=v.oneDay?v.oneDay:n>=v.oneHour?v.oneHour:n>=v.oneMin?v.oneMin:v.oneSecond,[c,a]=i.useState(l(t/1e3));return i.useEffect(()=>{const n=setInterval(()=>{u(r+c);const p=l(t/1e3+r+c);c!==p&&a(p)},c*1e3);return()=>clearInterval(n)},[c,r]),i.useEffect(()=>{u(0),a(l(t/1e3))},[t]),d(t+r*1e3)};y.number.isRequired,y.func;const le=async t=>{const d=await t.getNodeEnv();return Object.assign({},d.info||{})};se(t=>({root:{height:20},colorPrimary:{backgroundColor:t.palette.grey[t.palette.mode==="light"?200:700]},bar:{backgroundColor:"#1a90ff"}}))(O);y.number.isRequired;y.string.isRequired,y.string.isRequired,y.string.isRequired;function ce(){const{info:t,api:d,loading:r}=W(),{data:u,externalData:l}=Q(),{users:c}=oe(),a=Y(()=>le(d)),{t:n,locale:p}=i.useContext(F),_=X(),f=ie(+new Date-t.startAt,o=>{const m={compact:!0,verbose:!0,locale:L(p)};return Z(o,m)});let b=null;if(r)b=e.jsx(ee,{});else{const o=[{name:n("dashboard.nodeDid"),value:e.jsx(R,{did:t.did,showQrcode:!0})}];t.nodeOwner&&o.push({name:n("dashboard.ownerDid"),value:e.jsx(R,{did:t.nodeOwner.did,showQrcode:!0})});let m=[];t.launcher&&(m=[{name:n("common.did"),value:e.jsx(R,{did:t.launcher.did,showQrcode:!0})},{name:n("common.type"),value:t.launcher.type},{name:n("launcher.provider"),value:t.launcher.provider},{name:n("launcher.adminUrl"),value:e.jsx(J,{target:"_blank",href:t.launcher.url,underline:"hover",children:t.launcher.url})}]);const x=(s,w)=>!s&&!w?"-":s==="-"?s:!w||w==="-"?e.jsxs(h,{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(D,{children:s})]}):e.jsxs(h,{component:"ul",children:[e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(D,{children:s})]}),e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV6"}),e.jsx(D,{children:w})]})]}),S=()=>{const s=[{name:`${n("common.internalIp")}`,value:x(a.value.ip.internalV4,a.value.ip.internalV6)},{name:`${n("common.externalIp")}`,value:x(a.value.ip.externalV4,a.value.ip.externalV6)}];return a.value.docker?[]:s},U=a.value?[{name:`${n("common.version")}`,value:t.version},...S(),{name:`${n("common.os")}`,value:a.value.os},a.value.docker?{name:`${n("common.docker")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null,a.value.gitpod?{name:`${n("common.gitpod")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null].filter(Boolean):[];Array.isArray(K(a,"value.blockletEngines",null))&&a.value.blockletEngines.filter(s=>s.visible&&s.available).forEach(s=>{U.push({name:s.displayName,value:e.jsx(j,{type:"success",children:`${s.version}`||"N/A"})})});const G=c.length,$=c.filter(s=>s.approved).length;let I=G;$&&(I+=`<small><strong>${te(n("common.approved"))} ${$}</strong></small>`);let N=0,C=0;u&&(N=u.length,C=u.filter(s=>s.status==="running").length),Array.isArray(l)&&(N+=l.length,C+=l.filter(s=>s.status==="running").length);let M=N;C&&(M+=`<small>${n("common.running")} ${C}</small>`);const z=[{name:n("common.blocklets"),value:M},{name:n("common.members"),value:I},{name:n("common.uptime"),value:f},{name:n("common.created"),value:ne(new Date(t.createdAt).getTime(),L(p))}];let A=[];a.value&&a.value.disk&&(A=[{name:n("common.blockletsStorage"),value:k(a.value.disk.blocklets||0).toUpperCase()},{name:n("common.dataStorage"),value:k(a.value.disk.data||0).toUpperCase()},{name:n("common.logStorage"),value:k(a.value.disk.log||0).toUpperCase()},{name:n("common.cacheStorage"),value:k(a.value.disk.cache||0).toUpperCase()},{name:n("common.coreStorage"),value:k(a.value.disk.app||0).toUpperCase()}]),b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:n("common.overview")}),e.jsx(g,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:z.map(s=>e.jsx(g,{item:!0,xl:2,lg:3,md:4,sm:6,xs:6,children:e.jsx(V,{...s})},s.name))})]}),e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:n("common.storage")}),e.jsx(g,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:A.map(s=>e.jsx(g,{item:!0,xl:2,lg:3,md:4,sm:6,xs:6,children:e.jsx(V,{...s})},s.name))})]}),e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:n("common.meta")}),e.jsxs(g,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:[e.jsxs(g,{item:!0,lg:6,md:12,sm:12,xs:12,children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:n("common.dAddress")}),o.map(s=>e.jsx(T,{nameWidth:150,name:s.name,children:s.value},s.name)),m.length>0&&e.jsxs("div",{style:{marginTop:_.spacing(8)},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:n("common.launcher")}),m.map(s=>e.jsx(T,{nameWidth:150,name:s.name,children:s.value},s.name))]})]},"address"),e.jsxs(g,{item:!0,lg:6,md:12,sm:12,xs:12,children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:n("common.env")}),U.map(s=>e.jsx(T,{valueComponent:"div",nameWidth:150,name:s.name,children:s.value},s.name))]},"environment")]})]})]})}return e.jsx(me,{children:b})}const me=q.main`
1
+ import{c as H,r as i,u as W,a as E,b as P,j as e,P as y,L as O,d as Q,_ as Y,e as F,f as X,W as R,g as J,T as j,h as K,i as k,k as h,G as g,n as q,p as Z,C as ee,l as L}from"./index-DTb1YjkO.js";import{f as ne}from"./index-BojVbZw0.js";import{I as T}from"./index-BLrsx8oH.js";import{M as V}from"./metric-sJIuzFdD.js";import{C as D}from"./click-to-copy-BBcwV5Sv.js";import{w as se}from"./withStyles-_FcG1bkA.js";var te=H(function(t,d,r){return t+(r?" ":"")+d.toLowerCase()});const B=i.createContext({}),{Provider:ae,Consumer:ge}=B;function re({children:t}){const{api:d,info:r}=W(),[u,l]=i.useState(null),[c,a]=i.useState(!1),[n,p]=i.useState([]),_=4,f=async({silent:o=!0,retries:m=_}={})=>{o||a(!0);try{l(null);const{users:x}=await d.getUsers({input:{teamDid:r.did,paging:{pageSize:100}}});a(!1),p(x)}catch(x){m>0?setTimeout(()=>f({silent:o,retries:m-1}),1e3):(a(!1),l(x))}};i.useEffect(()=>{f({silent:!1})},[]),E(P.TeamEvents.userAdded,({teamDid:o})=>{o===r.did&&f()}),E(P.TeamEvents.userRemoved,({teamDid:o,user:{did:m}})=>{o===r.did&&p(x=>x.filter(S=>S.did!==m))}),E(P.TeamEvents.userUpdated,({teamDid:o})=>{o===r.did&&f()});const b={loading:c,error:u,users:n,refresh:f};return e.jsx(ae,{value:{users:b},children:t})}function oe(){const{users:t}=i.useContext(B);return t}const v={oneSecond:1,oneMin:1*60,oneHour:1*60*60,oneDay:24*60*60},ie=(t,d)=>{const[r,u]=i.useState(0),l=n=>n>=v.oneDay?v.oneDay:n>=v.oneHour?v.oneHour:n>=v.oneMin?v.oneMin:v.oneSecond,[c,a]=i.useState(l(t/1e3));return i.useEffect(()=>{const n=setInterval(()=>{u(r+c);const p=l(t/1e3+r+c);c!==p&&a(p)},c*1e3);return()=>clearInterval(n)},[c,r]),i.useEffect(()=>{u(0),a(l(t/1e3))},[t]),d(t+r*1e3)};y.number.isRequired,y.func;const le=async t=>{const d=await t.getNodeEnv();return Object.assign({},d.info||{})};se(t=>({root:{height:20},colorPrimary:{backgroundColor:t.palette.grey[t.palette.mode==="light"?200:700]},bar:{backgroundColor:"#1a90ff"}}))(O);y.number.isRequired;y.string.isRequired,y.string.isRequired,y.string.isRequired;function ce(){const{info:t,api:d,loading:r}=W(),{data:u,externalData:l}=Q(),{users:c}=oe(),a=Y(()=>le(d)),{t:n,locale:p}=i.useContext(F),_=X(),f=ie(+new Date-t.startAt,o=>{const m={compact:!0,verbose:!0,locale:L(p)};return Z(o,m)});let b=null;if(r)b=e.jsx(ee,{});else{const o=[{name:n("dashboard.nodeDid"),value:e.jsx(R,{did:t.did,showQrcode:!0})}];t.nodeOwner&&o.push({name:n("dashboard.ownerDid"),value:e.jsx(R,{did:t.nodeOwner.did,showQrcode:!0})});let m=[];t.launcher&&(m=[{name:n("common.did"),value:e.jsx(R,{did:t.launcher.did,showQrcode:!0})},{name:n("common.type"),value:t.launcher.type},{name:n("launcher.provider"),value:t.launcher.provider},{name:n("launcher.adminUrl"),value:e.jsx(J,{target:"_blank",href:t.launcher.url,underline:"hover",children:t.launcher.url})}]);const x=(s,w)=>!s&&!w?"-":s==="-"?s:!w||w==="-"?e.jsxs(h,{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(D,{children:s})]}):e.jsxs(h,{component:"ul",children:[e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(D,{children:s})]}),e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV6"}),e.jsx(D,{children:w})]})]}),S=()=>{const s=[{name:`${n("common.internalIp")}`,value:x(a.value.ip.internalV4,a.value.ip.internalV6)},{name:`${n("common.externalIp")}`,value:x(a.value.ip.externalV4,a.value.ip.externalV6)}];return a.value.docker?[]:s},U=a.value?[{name:`${n("common.version")}`,value:t.version},...S(),{name:`${n("common.os")}`,value:a.value.os},a.value.docker?{name:`${n("common.docker")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null,a.value.gitpod?{name:`${n("common.gitpod")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null].filter(Boolean):[];Array.isArray(K(a,"value.blockletEngines",null))&&a.value.blockletEngines.filter(s=>s.visible&&s.available).forEach(s=>{U.push({name:s.displayName,value:e.jsx(j,{type:"success",children:`${s.version}`||"N/A"})})});const G=c.length,$=c.filter(s=>s.approved).length;let I=G;$&&(I+=`<small><strong>${te(n("common.approved"))} ${$}</strong></small>`);let N=0,C=0;u&&(N=u.length,C=u.filter(s=>s.status==="running").length),Array.isArray(l)&&(N+=l.length,C+=l.filter(s=>s.status==="running").length);let M=N;C&&(M+=`<small>${n("common.running")} ${C}</small>`);const z=[{name:n("common.blocklets"),value:M},{name:n("common.members"),value:I},{name:n("common.uptime"),value:f},{name:n("common.created"),value:ne(new Date(t.createdAt).getTime(),L(p))}];let A=[];a.value&&a.value.disk&&(A=[{name:n("common.blockletsStorage"),value:k(a.value.disk.blocklets||0).toUpperCase()},{name:n("common.dataStorage"),value:k(a.value.disk.data||0).toUpperCase()},{name:n("common.logStorage"),value:k(a.value.disk.log||0).toUpperCase()},{name:n("common.cacheStorage"),value:k(a.value.disk.cache||0).toUpperCase()},{name:n("common.coreStorage"),value:k(a.value.disk.app||0).toUpperCase()}]),b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:n("common.overview")}),e.jsx(g,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:z.map(s=>e.jsx(g,{item:!0,xl:2,lg:3,md:4,sm:6,xs:6,children:e.jsx(V,{...s})},s.name))})]}),e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:n("common.storage")}),e.jsx(g,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:A.map(s=>e.jsx(g,{item:!0,xl:2,lg:3,md:4,sm:6,xs:6,children:e.jsx(V,{...s})},s.name))})]}),e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:n("common.meta")}),e.jsxs(g,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:[e.jsxs(g,{item:!0,lg:6,md:12,sm:12,xs:12,children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:n("common.dAddress")}),o.map(s=>e.jsx(T,{nameWidth:150,name:s.name,children:s.value},s.name)),m.length>0&&e.jsxs("div",{style:{marginTop:_.spacing(8)},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:n("common.launcher")}),m.map(s=>e.jsx(T,{nameWidth:150,name:s.name,children:s.value},s.name))]})]},"address"),e.jsxs(g,{item:!0,lg:6,md:12,sm:12,xs:12,children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:n("common.env")}),U.map(s=>e.jsx(T,{valueComponent:"div",nameWidth:150,name:s.name,children:s.value},s.name))]},"environment")]})]})]})}return e.jsx(me,{children:b})}const me=q.main`
2
2
  .page-header {
3
3
  display: flex;
4
4
  justify-content: space-between;