@abtnode/webapp 1.17.8 → 1.17.9

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 (184) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-CXgBZcQU.js → AdapterDayjs-DWO9WIHe.js} +1 -1
  4. package/dist/assets/{Add-B-lIYZBc.js → Add-CaX-C76B.js} +1 -1
  5. package/dist/assets/ArrowDropDown-225S5d4X.js +1 -0
  6. package/dist/assets/{Autocomplete-BHqH72uG.js → Autocomplete-CoHLc9sw.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-CpZ2DeBG.js → Breadcrumbs-CtmWaPWD.js} +1 -1
  8. package/dist/assets/{ButtonGroup-CXwzM552.js → ButtonGroup-CFUm4DnA.js} +1 -1
  9. package/dist/assets/{CSSTransition-hTlKGu0l.js → CSSTransition-BoEOBxnu.js} +1 -1
  10. package/dist/assets/{CallMerge-V8M4tzIM.js → CallMerge-g03IIE2c.js} +1 -1
  11. package/dist/assets/{CardContent-MdG6Fo_s.js → CardContent-De2diFnM.js} +1 -1
  12. package/dist/assets/{ChevronLeft-BPs9Erbv.js → ChevronLeft-6mKauCKy.js} +1 -1
  13. package/dist/assets/{ChevronRight-C_yvQN06.js → ChevronRight-Ba1GeQFe.js} +1 -1
  14. package/dist/assets/{Clear-XkW6YpHE.js → Clear-B_hKjaJj.js} +1 -1
  15. package/dist/assets/{Delete-CCasVLgy.js → Delete-B-jFRJwJ.js} +1 -1
  16. package/dist/assets/{DeleteOutline-CocEa6gq.js → DeleteOutline-7b3f7PEm.js} +1 -1
  17. package/dist/assets/{Done-DfHgd6VN.js → Done-L7ZRzL_V.js} +1 -1
  18. package/dist/assets/{Edit-CGdW8_LW.js → Edit-DUM500XS.js} +1 -1
  19. package/dist/assets/{ErrorOutline-D3nJBXYA.js → ErrorOutline-DsKZTEd8.js} +1 -1
  20. package/dist/assets/{FilterList-BiaeVs0C.js → FilterList-ChbigVQM.js} +1 -1
  21. package/dist/assets/{Google-D9HgkG4U.js → Google-CWlHJZAv.js} +1 -1
  22. package/dist/assets/{HelpOutline-s5mQqTw1.js → HelpOutline-dihfOb5v.js} +1 -1
  23. package/dist/assets/{Launch-DHnB5pzO.js → Launch-BkVAoVZE.js} +1 -1
  24. package/dist/assets/{Link-DUSQD8mc.js → Link-DOvnx4g5.js} +1 -1
  25. package/dist/assets/{ListItemButton-BIo7wBNv.js → ListItemButton-BQDScowx.js} +1 -1
  26. package/dist/assets/{ListSubheader-rZisNvzB.js → ListSubheader-Cl_ECqW2.js} +1 -1
  27. package/dist/assets/{LoadingButton-egcGN7yK.js → LoadingButton-CDH-grwB.js} +1 -1
  28. package/dist/assets/{LottiePlayer.modern-DuQJ5g1j.js → LottiePlayer.modern-CLfr42jY.js} +1 -1
  29. package/dist/assets/{MoreVert-Cw1fjU9L.js → MoreVert-DV_CQ8ui.js} +1 -1
  30. package/dist/assets/{OpenInNew-2i4mGCRx.js → OpenInNew-DXke8B9Y.js} +1 -1
  31. package/dist/assets/{Refresh-BIkqgW7p.js → Refresh-D_WONHhn.js} +1 -1
  32. package/dist/assets/{Replay-3PaYn2br.js → Replay-B4flsCqt.js} +1 -1
  33. package/dist/assets/{Search-mc0LftDb.js → Search-z9bCqmrZ.js} +1 -1
  34. package/dist/assets/{Stepper-CnqNXODv.js → Stepper-DKmKSFCG.js} +1 -1
  35. package/dist/assets/{TableSearch-ZIwL7jK3.js → TableSearch-C5Kz0G1P.js} +1 -1
  36. package/dist/assets/{ToggleButtonGroup-DeGfqT0G.js → ToggleButtonGroup-BZx2FaaL.js} +1 -1
  37. package/dist/assets/{UnfoldMore-DFA58tLQ.js → UnfoldMore-B28R2WSj.js} +1 -1
  38. package/dist/assets/{Verified-se8hbTqT.js → Verified-TZI1j-Va.js} +1 -1
  39. package/dist/assets/{VerifiedUser-8QA2XNlm.js → VerifiedUser-Ddu-50lW.js} +1 -1
  40. package/dist/assets/{ViewList-DgyKMmIc.js → ViewList-D-osXRf3.js} +1 -1
  41. package/dist/assets/{Visibility-BqBwXDHr.js → Visibility-BVnDeVk-.js} +1 -1
  42. package/dist/assets/{_createAggregator-BS_ZCLsv.js → _createAggregator-DvxY8dpL.js} +1 -1
  43. package/dist/assets/{actions-BuX7-i-0.js → actions-CUnz9wHy.js} +1 -1
  44. package/dist/assets/{actions-DR8B4Taf.js → actions-TKbswZRW.js} +1 -1
  45. package/dist/assets/{actions-Zy-oEKVg.js → actions-rnAVohGM.js} +1 -1
  46. package/dist/assets/{agreement-3SHQ4MuR.js → agreement-B81jBHjm.js} +1 -1
  47. package/dist/assets/api-BLIecOBq.js +1 -0
  48. package/dist/assets/{appearance-CRQaeOoe.js → appearance-BnoPFfcA.js} +1 -1
  49. package/dist/assets/{audit-logs-BGRhRsNS.js → audit-logs-rRPPzNCV.js} +1 -1
  50. package/dist/assets/{babel-BILHfcMU.js → babel-BhzMK_Nh.js} +1 -1
  51. package/dist/assets/{base-chart-Cp-etWR-.js → base-chart-B-7wNcRu.js} +1 -1
  52. package/dist/assets/{blocklet-D7q_eJsm.js → blocklet-B65NZ0SL.js} +1 -1
  53. package/dist/assets/{chain-DDmwEbOF.js → chain-De_ycb3s.js} +1 -1
  54. package/dist/assets/{click-to-copy-wk3E32eY.js → click-to-copy-BgfWbRfM.js} +1 -1
  55. package/dist/assets/cloneDeep-BBtZ6NeX.js +1 -0
  56. package/dist/assets/{config-navigation-iUuwjLA_.js → config-navigation-CAY0oLM7.js} +3 -3
  57. package/dist/assets/{connect-DGRM2e01.js → connect-DeAl0a0w.js} +1 -1
  58. package/dist/assets/{connect-to-BdinmIba.js → connect-to-TtcHrCpE.js} +1 -1
  59. package/dist/assets/{delete-confirm-C8X53PNk.js → delete-confirm-BCALKic0.js} +1 -1
  60. package/dist/assets/{depsEqual-FU6HOfMn.js → depsEqual-iVI-ppGn.js} +1 -1
  61. package/dist/assets/{detail-BX_klHKR.js → detail-B9b8qEuw.js} +2 -2
  62. package/dist/assets/{domains-DlW2t7QG.js → domains-ilDCawII.js} +1 -1
  63. package/dist/assets/{download-CHMW-VV9.js → download-BLP_P5GN.js} +1 -1
  64. package/dist/assets/{edit.svg-CBqxioRV.js → edit.svg-088QpjsR.js} +1 -1
  65. package/dist/assets/emotion-cache.browser.esm-fPnQyG8C.js +1 -0
  66. package/dist/assets/engine-xHEY-z1Q.js +1 -0
  67. package/dist/assets/{federated-detail-dialog-C93dA_OW.js → federated-detail-dialog-FIBSqJbV.js} +1 -1
  68. package/dist/assets/{get-safe-url-n4nPkbEQ.js → get-safe-url-C0YzO5pG.js} +1 -1
  69. package/dist/assets/getValidReactChildren-BwWzCXzg.js +1 -0
  70. package/dist/assets/{graphql-BOG1t7Ob.js → graphql-DZtbZ5p5.js} +1 -1
  71. package/dist/assets/{graphqlMode-BuOU6E0N.js → graphqlMode-D6b77q6d.js} +2 -2
  72. package/dist/assets/{html-title-DwrWBQUt.js → html-title-wftxlNic.js} +1 -1
  73. package/dist/assets/{iframe-B0inMXzK.js → iframe-CVO90dup.js} +1 -1
  74. package/dist/assets/{index-OZjARxbD.js → index--K9Fm5hg.js} +1 -1
  75. package/dist/assets/{index-pMmL--Md.js → index-2QIyI-hX.js} +1 -1
  76. package/dist/assets/{index-erCgIvu7.js → index-B0mArAvv.js} +1 -1
  77. package/dist/assets/{index-BbnbDlTc.js → index-BApx63vN.js} +1 -1
  78. package/dist/assets/{index-DK8BRrRb.js → index-BTW5KgWm.js} +1 -1
  79. package/dist/assets/{index-CqXuTw4d.js → index-BXslTYRT.js} +1 -1
  80. package/dist/assets/{index-BDQexjSt.js → index-BdA3fNuc.js} +1 -1
  81. package/dist/assets/{index-PzC6rkTH.js → index-BgEoonJf.js} +1 -1
  82. package/dist/assets/{index-_qKxdWY4.js → index-BsxJA--7.js} +1 -1
  83. package/dist/assets/{index-De_3fKYA.js → index-Bt02N9ee.js} +1 -1
  84. package/dist/assets/{index-BFpYSXLl.js → index-BuwIEPLP.js} +3 -3
  85. package/dist/assets/{index-Oah-jRyx.js → index-C6-nc71s.js} +1 -1
  86. package/dist/assets/{index-p8ewFFuc.js → index-C9laDmdO.js} +1 -1
  87. package/dist/assets/{index-BIOcSTv1.js → index-CJtH7ShQ.js} +1 -1
  88. package/dist/assets/{index-CyXVLDQI.js → index-CSC84DXT.js} +1 -1
  89. package/dist/assets/{index-StdVm_EG.js → index-CSRgOtp2.js} +1 -1
  90. package/dist/assets/{index-B01of1n7.js → index-Ce4rkgom.js} +1 -1
  91. package/dist/assets/index-CkfMmvW2.js +1 -0
  92. package/dist/assets/{index-B9oDQ5jy.js → index-Cnc9i7Ak.js} +1 -1
  93. package/dist/assets/{index-Cske9PWb.js → index-DHJJWO6c.js} +3 -3
  94. package/dist/assets/{index-0lc-age1.js → index-DKy5xk6V.js} +1 -1
  95. package/dist/assets/{index-CGJGuomb.js → index-DReJtC5l.js} +3 -3
  96. package/dist/assets/{index-2tPqycMJ.js → index-DSoeY_gC.js} +2 -2
  97. package/dist/assets/{index-D3qtx7de.js → index-DTafCIMf.js} +1 -1
  98. package/dist/assets/{index-DNGIFQtW.js → index-DW68hKiw.js} +1 -1
  99. package/dist/assets/{index-BJsW1I-W.js → index-DWMihgj_.js} +1 -1
  100. package/dist/assets/{index-mGRBDoXw.js → index-DXSDhJsN.js} +1 -1
  101. package/dist/assets/{index-2jRJYLHP.js → index-DdoE1xT5.js} +1 -1
  102. package/dist/assets/{index-dKtf23Ej.js → index-Def_Nrmy.js} +1 -1
  103. package/dist/assets/{index-C5xvmzdD.js → index-DkOCnoPS.js} +1 -1
  104. package/dist/assets/{index-G4GuFOuO.js → index-DrnnoDEf.js} +1 -1
  105. package/dist/assets/{index-7TgPZijh.js → index-DtdZa4Ii.js} +1 -1
  106. package/dist/assets/{index-CP8e2zcP.js → index-Dtj3cePH.js} +4 -4
  107. package/dist/assets/{index-BsmvyFtw.js → index-Fa8vAbIc.js} +1 -1
  108. package/dist/assets/{index-MLCJ7HJV.js → index-GSHwCvc7.js} +1 -1
  109. package/dist/assets/{index-BQ0GXRUy.js → index-KvvUCU7Y.js} +1 -1
  110. package/dist/assets/{index-CRRnOuLM.js → index-OZ9TU2gG.js} +3 -3
  111. package/dist/assets/{index-8K8V7S7h.js → index-TLvz3wdj.js} +1 -1
  112. package/dist/assets/{index-hxHDV4zb.js → index-UjkYO3io.js} +1 -1
  113. package/dist/assets/{index-BPu5OFdR.js → index-XFNKEyIx.js} +1 -1
  114. package/dist/assets/{index-Cm_CX9Km.js → index-YDhLwC2f.js} +1 -1
  115. package/dist/assets/{index-4OvGI3tM.js → index-etYz30nT.js} +1 -1
  116. package/dist/assets/{index-Bg6xcyjD.js → index-f-tffvn9.js} +6 -6
  117. package/dist/assets/{index-DX_ig3IR.js → index-imQtUA1Y.js} +1 -1
  118. package/dist/assets/{index-B8jKymjp.js → index-kfl7onTb.js} +3 -3
  119. package/dist/assets/{index.esm-DjcC6_YD.js → index.esm-KhX4wp--.js} +1 -1
  120. package/dist/assets/{install-from-url-DfM4lxPD.js → install-from-url-B05WE8Ly.js} +1 -1
  121. package/dist/assets/{invitation-CyjIyIIY.js → invitation-BV4-svSZ.js} +1 -1
  122. package/dist/assets/{is-path-prefix-equal-sWdIB_FI.js → is-path-prefix-equal-BxWUya7r.js} +1 -1
  123. package/dist/assets/{isEmail-CpvKmXxu.js → isEmail-DeuFXn6y.js} +1 -1
  124. package/dist/assets/{item-NX8BCXwV.js → item-DI_IF5jI.js} +1 -1
  125. package/dist/assets/{jsonMode-wNz3PCor.js → jsonMode-U78AHGim.js} +1 -1
  126. package/dist/assets/{list-header-DXqt77-Y.js → list-header-B3--_6Bl.js} +1 -1
  127. package/dist/assets/{lite-D7_0Kk8P.js → lite-s4CjMGFV.js} +2 -2
  128. package/dist/assets/{lock.svg-D22_UbmU.js → lock.svg-Cgo551jB.js} +1 -1
  129. package/dist/assets/{log-BtG4l72D.js → log-ll3_FUxN.js} +1 -1
  130. package/dist/assets/{login-method-item-CGUaonon.js → login-method-item-rb7xoaP3.js} +1 -1
  131. package/dist/assets/{lottie-react.esm-Cj9O6Lld.js → lottie-react.esm-B1Y5_TqJ.js} +1 -1
  132. package/dist/assets/{memory-MEOErB2y.js → memory-DzWPIeHP.js} +1 -1
  133. package/dist/assets/{metric-DzrjUE5P.js → metric-DCKs2r9K.js} +1 -1
  134. package/dist/assets/{monaco-editor-i4E7Erh-.js → monaco-editor-3B-B1pdB.js} +3 -3
  135. package/dist/assets/{mouseTarget-DHjy6bBl.js → mouseTarget-BZ5frXuo.js} +1 -1
  136. package/dist/assets/omit-C22NrHjF.js +1 -0
  137. package/dist/assets/{overview-BPSzB7yi.js → overview-Cu4YrIFe.js} +1 -1
  138. package/dist/assets/{permission-D6xGjoP4.js → permission-B-geZ8jf.js} +1 -1
  139. package/dist/assets/{preference-CWfaETuk.js → preference-C8QaexiP.js} +3 -3
  140. package/dist/assets/{provider-icon-D-a204Ay.js → provider-icon-lv3oS7d4.js} +1 -1
  141. package/dist/assets/{raf-schd.esm-vaS856Rv.js → raf-schd.esm-B49R8L3J.js} +1 -1
  142. package/dist/assets/{rotate-session-key-Cn3NVWRi.js → rotate-session-key-BPhFiNZy.js} +1 -1
  143. package/dist/assets/{runtime-BJVsSRvX.js → runtime-DhJ59c5Q.js} +1 -1
  144. package/dist/assets/schema-BwJa8hO6.js +1 -0
  145. package/dist/assets/sdk-Bx_WDGD1.js +1 -0
  146. package/dist/assets/{service-COrrqY-3.js → service-Bad7qk9f.js} +1 -1
  147. package/dist/assets/{shorten-label-j-itDv6J.js → shorten-label-DmKAPPTX.js} +1 -1
  148. package/dist/assets/{simple-select-DApzKMrW.js → simple-select-CHH0_oB5.js} +1 -1
  149. package/dist/assets/{spaces-BqdEt5Dg.js → spaces-BsLjYZLj.js} +1 -1
  150. package/dist/assets/{status-CFw68CfZ.js → status-CcMfecIj.js} +1 -1
  151. package/dist/assets/{status-vwaEURfH.js → status-VF8vuUxF.js} +1 -1
  152. package/dist/assets/{switch-control-BEw34mlq.js → switch-control-CzpP7CIf.js} +1 -1
  153. package/dist/assets/{table-icons-V0nzUvpC.js → table-icons-Bo0tOvqU.js} +1 -1
  154. package/dist/assets/{team-Bp-ehLS6.js → team-cDk0EvPf.js} +1 -1
  155. package/dist/assets/{toLower-C4OoJYWk.js → toLower-D7a3qnvH.js} +1 -1
  156. package/dist/assets/toUpper-B8LTwalX.js +1 -0
  157. package/dist/assets/{traffic-BuuDuC5C.js → traffic-DYynIkpC.js} +1 -1
  158. package/dist/assets/{trim-BrqZEf0Q.js → trim-Diihj-s0.js} +1 -1
  159. package/dist/assets/{url-evaluation-BotqjpOW.js → url-evaluation-D49POKf_.js} +1 -1
  160. package/dist/assets/{url-join-BYRfgTzL.js → url-join-CYWu6vsi.js} +1 -1
  161. package/dist/assets/{use-mobile-BxCxZMSF.js → use-mobile-wKUCaVoo.js} +1 -1
  162. package/dist/assets/{use-mobile-BIorytbM.js → use-mobile-xq_yWBax.js} +1 -1
  163. package/dist/assets/{useAsync-CbHsXkPS.js → useAsync-CLJdaax3.js} +1 -1
  164. package/dist/assets/{useAsyncRetry-6ULbruV9.js → useAsyncRetry-DLctK9N7.js} +1 -1
  165. package/dist/assets/{useLocalStorage-CBx2eW_l.js → useLocalStorage-Dn6UErBV.js} +1 -1
  166. package/dist/assets/{useThemeProps-BWD3Vp6O.js → useThemeProps-9zV1AZbb.js} +1 -1
  167. package/dist/assets/{util-BF2dKFyL.js → util-BVHL76Cg.js} +1 -1
  168. package/dist/assets/{wait-container-Cc0h_2b3.js → wait-container-ClqOwvvu.js} +1 -1
  169. package/dist/assets/{without-wallet-lUjEmpWw.js → without-wallet-BzLoVl__.js} +1 -1
  170. package/dist/assets/wrap-locale-CowysH2k.js +1 -0
  171. package/dist/index.html +1 -1
  172. package/package.json +1 -1
  173. package/dist/assets/ArrowDropDown-C1ynmK1V.js +0 -1
  174. package/dist/assets/api-DBq1KtcA.js +0 -1
  175. package/dist/assets/cloneDeep-BEJXcFgb.js +0 -1
  176. package/dist/assets/emotion-cache.browser.esm-D6kXFXIA.js +0 -1
  177. package/dist/assets/engine-hQAyActy.js +0 -1
  178. package/dist/assets/getValidReactChildren-dJeDeNuf.js +0 -1
  179. package/dist/assets/index-1nsTMIEw.js +0 -1
  180. package/dist/assets/omit-C1X-CRrb.js +0 -1
  181. package/dist/assets/schema-DeNYz3hJ.js +0 -1
  182. package/dist/assets/sdk-CyaYnqk4.js +0 -1
  183. package/dist/assets/toUpper-P-IpqDCE.js +0 -1
  184. package/dist/assets/wrap-locale-CF87ubG3.js +0 -1
@@ -1 +1 @@
1
- import{bj as x}from"./index-CP8e2zcP.js";function D(a,i){for(var r=0;r<i.length;r++){const e=i[r];if(typeof e!="string"&&!Array.isArray(e)){for(const s in e)if(s!=="default"&&!(s in a)){const t=Object.getOwnPropertyDescriptor(e,s);t&&Object.defineProperty(a,s,t.get?t:{enumerable:!0,get:()=>e[s]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var l,w;function J(){if(w)return l;w=1;var a={default:l,call:function(i,r,e){var s="";typeof r=="function"&&(e=r,r={});var t={data:r===void 0?null:r};if(typeof e=="function"){var n="dscb"+window.dscb++;window[n]=e,t._dscbstub=n}return t=JSON.stringify(t),window._dsbridge?s=_dsbridge.call(i,t):(window._dswk||navigator.userAgent.indexOf("_dsbridge")!=-1)&&(s=prompt("_dsbridge="+i,t)),JSON.parse(s||"{}").data},register:function(i,r,e){var s=e?window._dsaf:window._dsf;window._dsInit||(window._dsInit=!0,setTimeout(function(){a.call("_dsb.dsinit")},0)),typeof r=="object"?s._obs[i]=r:s[i]=r},registerAsyn:function(i,r){this.register(i,r,!0)},hasNativeMethod:function(i,r){return this.call("_dsb.hasNativeMethod",{name:i,type:r||"all"})},disableJavascriptDialogBlock:function(i){this.call("_dsb.disableJavascriptDialogBlock",{disable:i!==!1})}};return(function(){if(!window._dsf){var i={_dsf:{_obs:{}},_dsaf:{_obs:{}},dscb:0,dsBridge:a,close:function(){a.call("_dsb.closePage")},_handleMessageFromNative:function(e){var s=JSON.parse(e.data),t={id:e.callbackId,complete:!0},n=this._dsf[e.method],o=this._dsaf[e.method],v=function(_,p){t.data=_.apply(p,s),a.call("_dsb.returnValue",t)},g=function(_,p){s.push(function(j,O){t.data=j,t.complete=O!==!1,a.call("_dsb.returnValue",t)}),_.apply(p,s)};if(n)v(n,this._dsf);else if(o)g(o,this._dsaf);else{var u=e.method.split(".");if(u.length<2)return;var b=u.pop(),h=u.join("."),c=this._dsf._obs,f=c[h]||{},d=f[b];if(d&&typeof d=="function"){v(d,f);return}if(c=this._dsaf._obs,f=c[h]||{},d=f[b],d&&typeof d=="function"){g(d,f);return}}}};for(var r in i)window[r]=i[r];a.register("_hasJavascriptMethod",function(e,s){var t=e.split(".");if(t.length<2)return!!(_dsf[t]||_dsaf[t]);var e=t.pop(),n=t.join("."),o=_dsf._obs[n]||_dsaf._obs[n];return o&&!!o[e]})}})(),l=a,l}var y=J();const N=x(y),k=D({__proto__:null,default:N},[y]);export{k as i};
1
+ import{bj as x}from"./index-Dtj3cePH.js";function D(a,i){for(var r=0;r<i.length;r++){const e=i[r];if(typeof e!="string"&&!Array.isArray(e)){for(const s in e)if(s!=="default"&&!(s in a)){const t=Object.getOwnPropertyDescriptor(e,s);t&&Object.defineProperty(a,s,t.get?t:{enumerable:!0,get:()=>e[s]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var l,w;function J(){if(w)return l;w=1;var a={default:l,call:function(i,r,e){var s="";typeof r=="function"&&(e=r,r={});var t={data:r===void 0?null:r};if(typeof e=="function"){var n="dscb"+window.dscb++;window[n]=e,t._dscbstub=n}return t=JSON.stringify(t),window._dsbridge?s=_dsbridge.call(i,t):(window._dswk||navigator.userAgent.indexOf("_dsbridge")!=-1)&&(s=prompt("_dsbridge="+i,t)),JSON.parse(s||"{}").data},register:function(i,r,e){var s=e?window._dsaf:window._dsf;window._dsInit||(window._dsInit=!0,setTimeout(function(){a.call("_dsb.dsinit")},0)),typeof r=="object"?s._obs[i]=r:s[i]=r},registerAsyn:function(i,r){this.register(i,r,!0)},hasNativeMethod:function(i,r){return this.call("_dsb.hasNativeMethod",{name:i,type:r||"all"})},disableJavascriptDialogBlock:function(i){this.call("_dsb.disableJavascriptDialogBlock",{disable:i!==!1})}};return(function(){if(!window._dsf){var i={_dsf:{_obs:{}},_dsaf:{_obs:{}},dscb:0,dsBridge:a,close:function(){a.call("_dsb.closePage")},_handleMessageFromNative:function(e){var s=JSON.parse(e.data),t={id:e.callbackId,complete:!0},n=this._dsf[e.method],o=this._dsaf[e.method],v=function(_,p){t.data=_.apply(p,s),a.call("_dsb.returnValue",t)},g=function(_,p){s.push(function(j,O){t.data=j,t.complete=O!==!1,a.call("_dsb.returnValue",t)}),_.apply(p,s)};if(n)v(n,this._dsf);else if(o)g(o,this._dsaf);else{var u=e.method.split(".");if(u.length<2)return;var b=u.pop(),h=u.join("."),c=this._dsf._obs,f=c[h]||{},d=f[b];if(d&&typeof d=="function"){v(d,f);return}if(c=this._dsaf._obs,f=c[h]||{},d=f[b],d&&typeof d=="function"){g(d,f);return}}}};for(var r in i)window[r]=i[r];a.register("_hasJavascriptMethod",function(e,s){var t=e.split(".");if(t.length<2)return!!(_dsf[t]||_dsaf[t]);var e=t.pop(),n=t.join("."),o=_dsf._obs[n]||_dsaf._obs[n];return o&&!!o[e]})}})(),l=a,l}var y=J();const N=x(y),k=D({__proto__:null,default:N},[y]);export{k as i};
@@ -1,4 +1,4 @@
1
- import{aZ as Fe,aY as Ge,r as h,$ as Ye,j as e,a3 as ee,a4 as $e,b0 as Z,a5 as Ke,a9 as qe,b1 as He,c as he,bt as H,aS as O,i as Ce,H as B,bB as V,dg as E,d1 as we,fx as Be,am as N,fy as Ve,V as D,fz as Qe,o as f,D as Xe,E as De,x as fe,y as Je,p as Ze,C as A,J as j,bs as et,q as tt,ab as st,fA as X,fB as J,fC as ot,B as S,aI as F,eq as T,Q as nt,bN as q,cI as at,ad as Se,M as Y,az as $,aA as K,eT as rt,aB as it,aw as ct,ax as lt,bz as pe,A as dt,bu as be,b3 as Ee,bF as xe,g as pt}from"./index-CP8e2zcP.js";import{T as ut}from"./html-title-DwrWBQUt.js";import{u as P}from"./blocklet-D7q_eJsm.js";import{u as mt}from"./use-mobile-BIorytbM.js";import{u as Ie,D as ft,a as xt,b as gt,S as ht,c as ue,d as St,C as yt,e as bt,f as kt,g as jt,h as Ct}from"./connect-to-BdinmIba.js";import"./index-BojVbZw0.js";import"./api-DBq1KtcA.js";import{b as wt,g as Bt,a as Dt,i as Et,c as ge,d as It,e as Tt,h as Rt}from"./spaces-BqdEt5Dg.js";import{v as zt}from"./index-8K8V7S7h.js";import{E as vt}from"./index-erCgIvu7.js";import{H as Lt}from"./HelpOutline-s5mQqTw1.js";import{H as Ot}from"./index-7TgPZijh.js";import{x as At}from"./index-D29L5UKE.js";import{D as Pt}from"./DeleteOutline-CocEa6gq.js";import{g as ke}from"./get-safe-url-n4nPkbEQ.js";import{S as Ut}from"./switch-control-BEw34mlq.js";import{L as je}from"./list-header-DXqt77-Y.js";import"./OpenInNew-2i4mGCRx.js";import"./index-hxHDV4zb.js";import"./ButtonGroup-CXwzM552.js";import"./getValidReactChildren-dJeDeNuf.js";import"./FilterList-BiaeVs0C.js";import"./CSSTransition-hTlKGu0l.js";import"./emotion-cache.browser.esm-D6kXFXIA.js";import"./index-CyXVLDQI.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-FU6HOfMn.js";import"./index-DX_ig3IR.js";import"./TableSearch-ZIwL7jK3.js";import"./Search-mc0LftDb.js";import"./Clear-XkW6YpHE.js";import"./MoreVert-Cw1fjU9L.js";function Mt(t){return Fe("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${Z(s)}`,`fontSize${Z(n)}`]};return Ke(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${Z(n.color)}`],s[`fontSize${Z(n.fontSize)}`]]}})(qe(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(He()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ye({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Ft=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Gt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Yt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!H(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:s}=P(),n=s?.meta?.did,{api:o}=O();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Yt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=P(),[r,a]=h.useState([]),{api:c}=O(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function Kt({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=O(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function qt({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=P(),[o,r]=h.useState([]),{api:a}=O(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:Ht,Consumer:Ws}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=O(),{blocklet:o}=P(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),u=Qe(d),x=Kt({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=qt({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},G=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,L)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==L&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:L}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(L=>{const R=[...L];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(Ht,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function U(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=P(),{info:n}=O(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=U(),d={checkFn:De.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=O(),{blocklet:s}=P(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Le({...t}){const{t:s}=h.useContext(Ze),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(A,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Oe(){const{t}=D(),{setBackupDate:s,backupSummary:n}=U(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
1
+ import{aZ as Fe,aY as Ge,r as h,$ as Ye,j as e,a3 as ee,a4 as $e,b0 as Z,a5 as Ke,a9 as qe,b1 as He,c as he,bt as H,aS as O,i as Ce,H as B,bB as V,dg as E,d1 as we,fx as Be,am as N,fy as Ve,V as D,fz as Qe,o as f,D as Xe,E as De,x as fe,y as Je,p as Ze,C as A,J as j,bs as et,q as tt,ab as st,fA as X,fB as J,fC as ot,B as S,aI as F,eq as T,Q as nt,bN as q,cI as at,ad as Se,M as Y,az as $,aA as K,eT as rt,aB as it,aw as ct,ax as lt,bz as pe,A as dt,bu as be,b3 as Ee,bF as xe,g as pt}from"./index-Dtj3cePH.js";import{T as ut}from"./html-title-wftxlNic.js";import{u as P}from"./blocklet-B65NZ0SL.js";import{u as mt}from"./use-mobile-xq_yWBax.js";import{u as Ie,D as ft,a as xt,b as gt,S as ht,c as ue,d as St,C as yt,e as bt,f as kt,g as jt,h as Ct}from"./connect-to-TtcHrCpE.js";import"./index-BojVbZw0.js";import"./api-BLIecOBq.js";import{b as wt,g as Bt,a as Dt,i as Et,c as ge,d as It,e as Tt,h as Rt}from"./spaces-BsLjYZLj.js";import{v as zt}from"./index-TLvz3wdj.js";import{E as vt}from"./index-B0mArAvv.js";import{H as Lt}from"./HelpOutline-dihfOb5v.js";import{H as Ot}from"./index-DtdZa4Ii.js";import{x as At}from"./index-D29L5UKE.js";import{D as Pt}from"./DeleteOutline-7b3f7PEm.js";import{g as ke}from"./get-safe-url-C0YzO5pG.js";import{S as Ut}from"./switch-control-CzpP7CIf.js";import{L as je}from"./list-header-B3--_6Bl.js";import"./OpenInNew-DXke8B9Y.js";import"./index-UjkYO3io.js";import"./ButtonGroup-CFUm4DnA.js";import"./getValidReactChildren-BwWzCXzg.js";import"./FilterList-ChbigVQM.js";import"./CSSTransition-BoEOBxnu.js";import"./emotion-cache.browser.esm-fPnQyG8C.js";import"./index-CSC84DXT.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-iVI-ppGn.js";import"./index-imQtUA1Y.js";import"./TableSearch-C5Kz0G1P.js";import"./Search-z9bCqmrZ.js";import"./Clear-B_hKjaJj.js";import"./MoreVert-DV_CQ8ui.js";function Mt(t){return Fe("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${Z(s)}`,`fontSize${Z(n)}`]};return Ke(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${Z(n.color)}`],s[`fontSize${Z(n.fontSize)}`]]}})(qe(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(He()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ye({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Ft=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Gt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Yt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!H(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:s}=P(),n=s?.meta?.did,{api:o}=O();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Yt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=P(),[r,a]=h.useState([]),{api:c}=O(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function Kt({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=O(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function qt({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=P(),[o,r]=h.useState([]),{api:a}=O(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:Ht,Consumer:Ws}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=O(),{blocklet:o}=P(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),u=Qe(d),x=Kt({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=qt({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},G=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,L)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==L&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:L}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(L=>{const R=[...L];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(Ht,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function U(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=P(),{info:n}=O(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=U(),d={checkFn:De.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=O(),{blocklet:s}=P(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Le({...t}){const{t:s}=h.useContext(Ze),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(A,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Oe(){const{t}=D(),{setBackupDate:s,backupSummary:n}=U(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
2
2
  `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(vt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(F,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.STATUS.PROGRESS&&E().diff(n,"hours")>=T.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.STATUS.PROGRESS&&!r,i=t===T.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):i?e.jsx(q,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(Lt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};function Pe({metadata:t={}}){const{t:s}=D();if(H(t))return e.jsx(q,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=At(o,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[s("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:s("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Pe.propTypes={metadata:f.object};function Ue(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=U(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:u}=o[i],x=p===T.STATUS.PROGRESS&&E().diff(u,"hours")>=T.TIMEOUT_HOURS,m=p===T.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return m?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=o?.[i]??{},{status:l,message:p,createdAt:u,metadata:x}=d,m=l===T.STATUS.PROGRESS&&E().diff(u,"hours")>=T.TIMEOUT_HOURS,k=l===T.STATUS.PROGRESS&&!m,w=l===T.STATUS.SUCCEEDED&&!m;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Pe,{metadata:x}):e.jsx(Ae,{status:l,message:p,createdAt:u})}}}],[o,n,t]),c=h.useMemo(()=>!o?.length,[o]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(Ot,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Jt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Oe,{})]})]}),e.jsx(Ue,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Le,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(u,x)=>{u?.preventDefault(),u?.stopPropagation(),a(x)},l=async u=>{try{u?.stopPropagation(),i(!0),await s?.(t),a(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=u=>{d(u,!1),n?.(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{color:"red",onClick:u=>d(u,!0),children:[e.jsx($,{style:{minWidth:24,color:"red"},children:e.jsx(Pt,{fontSize:"small"})}),e.jsx(K,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=U(),[d,l]=h.useState(null),{t:p}=D(),[u,x]=h.useState(!1),m=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),m(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),m(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[u||t?.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(Y,{onClick:y=>{m(y,!1),window.open(ke(t.endpoint?It(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx(K,{children:p("common.open")})]}),e.jsxs(Y,{onClick:y=>{m(y,!1),window.open(ke(Tt(t.endpoint),{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx(K,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(Y,{onClick:k,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx(K,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(Y,{onClick:w,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(ht,{fontSize:"small"})}),e.jsx(K,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};const Zt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=P(),{api:l,info:{did:p}}=O(),{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=U(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,G=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Rt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o?.(null,t);return}}catch(C){console.error(C),o?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const L=g(C.endpoint),R=ge(L),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(L),endpoint:L};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Zt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||H(b?.message),backupInProgress:G})]})}_e.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Oe,{}),e.jsx(Ue,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=U(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ut,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=U(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(A,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(St,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Le,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=U();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(A,{})}):H(s)?e.jsx(Jt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=bt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(jt,{}),e.jsx(S,{sx:c,children:e.jsx(Ct,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(yt,{children:[e.jsxs(F,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=P(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[o,l]),x=xe(()=>({backup:e.jsx(ns,{}),storage:e.jsx(rs,{})}))[d],m=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(F,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};const me=ee(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1,4 +1,4 @@
1
- import{c as we,j as e,b as Q,r as g,c7 as ze,hv as ei,hw as pt,hx as fe,hy as Qt,dR as q,hz as gn,hA as or,hB as it,dG as ti,hC as hn,hD as ar,dH as ot,V as B,as as le,q as re,hE as xn,o as f,fG as ni,b6 as yn,fx as ri,bt as bn,H as te,J as L,au as H,hF as ii,ad as pe,d2 as Le,C as V,at as ve,bz as Z,f8 as sr,bB as ge,B as W,p as gt,k as oi,M as Y,az as Fe,aA as tt,cw as at,hG as ai,bE as Zt,ch as Ne,aI as me,cX as si,v as li,hH as ci,x as di,u as lr,c8 as vn,bN as jn,w as ne,gh as Jt,c6 as $t,c$ as Ot,am as ht,bD as wn,hI as cr,hJ as dr,cx as ur,av as zt,ax as ui,gi as mi,fe as fi,R as pi,fd as st,aU as Cn,gj as gi,bb as hi,eU as At,ga as xi,cY as Bt,Q as en,bK as yi,b8 as bi,a3 as mr,cZ as vi,ap as fr,b_ as Pe,b$ as Ae,hK as ji,bj as tn,U as wi,cu as pr,cv as Mt,ab as gr,dg as Ci,ay as kn,cR as ki,hL as Si,hM as Rt,hN as Tt,hO as Sn,aG as ee,hP as Dn,dU as Di,S as Pn,bw as An,bx as Rn,ac as Pi,hQ as Ai,a as Ri}from"./index-CP8e2zcP.js";import{u as Ti,T as Ei}from"./html-title-DwrWBQUt.js";import{A as Ii}from"./ArrowDropDown-C1ynmK1V.js";import{u as nn,C as M,a as Tn}from"./index.esm-DjcC6_YD.js";import{S as se,a as Li}from"./switch-control-BEw34mlq.js";import{P as ie}from"./permission-D6xGjoP4.js";import{H as hr,g as Fi}from"./index-7TgPZijh.js";import{A as xr}from"./Link-DUSQD8mc.js";import{A as _i}from"./actions-Zy-oEKVg.js";import{D as je}from"./Delete-CCasVLgy.js";import{D as xt}from"./delete-confirm-C8X53PNk.js";import{v as lt}from"./index-8K8V7S7h.js";import{s as Ni}from"./logo-BKA11TRi.js";import{R as yr,b as Wt,a as $i}from"./url-evaluation-BotqjpOW.js";import{u as Oi}from"./useLocalStorage-CBx2eW_l.js";import{R as zi}from"./Refresh-BIkqgW7p.js";import{L as Bi}from"./LoadingButton-egcGN7yK.js";import{C as Mi,R as Wi,P as br,S as qi}from"./rotate-session-key-Cn3NVWRi.js";import{A as $e}from"./Add-B-lIYZBc.js";import{B as vr,D as En,W as Ge}from"./status-CFw68CfZ.js";import{i as Ui}from"./is-path-prefix-equal-sWdIB_FI.js";import{N as Hi}from"./ChevronRight-C_yvQN06.js";import{I as Ki}from"./MoreVert-Cw1fjU9L.js";import{E as jr}from"./Edit-CGdW8_LW.js";import{A as Vi}from"./CallMerge-V8M4tzIM.js";import{C as Gi}from"./CardContent-MdG6Fo_s.js";import"./FilterList-BiaeVs0C.js";import"./CSSTransition-hTlKGu0l.js";import"./emotion-cache.browser.esm-D6kXFXIA.js";import"./index-CyXVLDQI.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-FU6HOfMn.js";import"./index-DX_ig3IR.js";import"./TableSearch-ZIwL7jK3.js";import"./Search-mc0LftDb.js";import"./Clear-XkW6YpHE.js";import"./click-to-copy-wk3E32eY.js";import"./visuallyHidden-Dan1xhjv.js";const Yi=we(e.jsx("path",{d:"m7 14 5-5 5 5z"})),Xi=we(e.jsx("path",{d:"M12 3 2 21h20zm1 5.92L18.6 19H13zm-2 0V19H5.4z"})),Qi=we(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"})),wr=we(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),Zi=we(e.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"})),Ji=we(e.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),eo=we(e.jsx("path",{d:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9z"})),be="Dashboard",Cr=g.createContext({}),{Provider:to,Consumer:Ss}=Cr,In=[be,Qt,pt],no=(t,r)=>{if(t.name===fe)return-1;if(r.name===fe)return 1;const n=In.includes(t.name),i=In.includes(r.name);return n&&i?hn(t.name,r.name):n?-1:i?1:hn(t.name,r.name)},Ln=({sites:t,nodePort:r})=>{const n=window.location.hostname,a=(t||[]).map(o=>{const{id:s,rules:d=[],corsAllowedOrigins:m=[]}=o;let{domain:c,domainAliases:u}=o;u=u||[],[Qt,pt].includes(c)&&(c=be,u.find(v=>v.value===n)||u.unshift({protected:!1,value:n}));const j={id:s,name:c,type:"domain",items:[],domainAliases:u,isProtected:o.isProtected,corsAllowedOrigins:m};return(d||[]).forEach(v=>{const{id:h,isProtected:k,from:{pathPrefix:b},to:S}=v;if(S.type===q.BLOCKLET){let D="";Number.parseInt(S.port,10)===Number.parseInt(r,10)?(D="Blocklet Server Dashboard",S.type=q.DAEMON):D=S.did,j.items.push({id:h,name:gn(b||"/"),title:D,type:"rule",isProtected:k,pathPrefix:b,to:S})}else j.items.push({id:h,pathPrefix:b,name:gn(b||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:k,to:S})}),j.items=or(j.items,v=>v.name),j}).sort(no),l=a.reduce((o,s)=>{let{name:d}=s;return d.endsWith(it)&&([d]=d.split(".")),o[d]={...s,rules:s.items},o},{});return{sites:a,siteMap:l}},ro=({did:t,domain:r,mountPoint:n,siteMap:i,params:a}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const o=r||(l.domainAliases||[])[0];if(!o)return null;let s=n;if(!s){const d=l.rules.filter(m=>!m.name.startsWith(ar))[0];s=d?d.name:"/"}return ot(o.value,s,a)},io=({did:t,mountPoint:r,siteMap:n,params:i}={})=>{if(!n)return[];const a=n[t];if(!a)return[];const l=a.domainAliases||[];if(!l.length)return[];let o=r;if(!o){const s=a.rules.filter(d=>!d.name.startsWith(ar))[0];o=s?s.name:"/"}return l.map(s=>ot(s.value,o,i))},oo=t=>{const r=t.map(i=>i.domain).filter(i=>![pt,fe].includes(i));let n=[];return t.forEach(i=>n.push(...i.domainAliases||[])),n=n.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:r,domainsAliases:n}};function Fn({children:t}){const{api:r,info:n}=Q(),[i,a]=g.useState([]),[l,o]=g.useState([]),[s,d]=g.useState([]),m=ze(async()=>{const{sites:y}=await r.getRoutingSites({input:{snapshotHash:""}}),R=y||[];await Promise.all(R.map(async w=>(w.domainAliases=await ei(w.domainAliases,{getIP:ti}),w)));const x=oo(R);a(R),o(x.domains);const p=Ln({sites:R,nodePort:n.port});d((p?.sites||[]).map(w=>w.domainAliases.map(T=>T.value)).filter(w=>w.length))},[n]),c=(y,R)=>{a(x=>x.map(p=>p.id===y?R.domain?R:{...R,domain:p.domain}:p))},u=async y=>{const R=await r.addRoutingSite({input:y});a(i.concat(R.site))},j=async(y,R)=>{const x=await r.updateRoutingSite({input:{id:y,...R}});if(x.site&&x.site.id){const p=i.findIndex(w=>w.id===x.site.id);p!==-1&&(i.splice(p,1,x.site),a([].concat(i)))}},v=async y=>{await r.deleteRoutingSite({input:{id:y}}),a(i.filter(R=>R.id!==y))},h=async(y,R,x)=>{const p=await r.addDomainAlias({input:{id:y,domainAlias:R,force:x}});c(y,p.site)},k=async(y,R)=>{const x=await r.deleteDomainAlias({input:{id:y,domainAlias:R}});c(y,x.site)},b=async(y,R)=>{const{site:x}=await r.addRoutingRule({input:{id:y,rule:R}});c(y,x)},S=async(y,R)=>{const{site:x}=await r.updateRoutingRule({input:{id:y,rule:R}});c(y,x)},D=async(y,R)=>{const{site:x}=await r.deleteRoutingRule({input:{id:y,ruleId:R}});c(y,x)},C={loading:m.loading,error:m.error,refresh:m.retry,api:r,actions:{addSite:u,updateSite:j,deleteSite:v,addDomainAlias:h,deleteDomainAlias:k,addRule:b,updateRule:S,deleteRule:D}},{sites:P,siteMap:A}=Ln({sites:i,nodePort:n.port});return C.sites=P,C.siteMap=A,C.domains=l,C.allDomains=s,C.getBlockletUrl=({did:y,domain:R,mountPoint:x,params:p})=>ro({did:y,domain:R,mountPoint:x,siteMap:C.siteMap,params:p}),C.getBlockletUrls=({did:y,mountPoint:R,params:x})=>io({did:y,mountPoint:R,siteMap:C.siteMap,params:x}),e.jsx(to,{value:{routing:C},children:t})}function de(){const{routing:t}=g.useContext(Cr);return t}function rn(t){const r=[pt,fe,Qt];return typeof window<"u"&&typeof window.location<"u"&&r.push(window.location.hostname),r.includes(t)}function ao(){return null}function kr({confirm:t=null}){const[r,n]=g.useState(null),{t:i}=B(),a=()=>{n(null)},l=async s=>{if(s){let d=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d==="/"?xn.push(`${s.pathname}`):(d.endsWith("/")&&(d=d.substring(0,d.length-1)),xn.push(`${d}${s.pathname}`)),window.location.reload()}},o=(s,...d)=>{let m=typeof t=="function"?t(s,...d):t;return m?(typeof m=="string"&&(m={description:m}),n({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>a(),...m}),!1):!0};return e.jsxs(so,{children:[e.jsx(ao,{message:o}),r&&e.jsx(le,{title:r.title,description:r.description,confirm:r.confirm,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}kr.propTypes={confirm:f.oneOfType([f.object,f.string,f.func])};const so=re.div`
1
+ import{c as we,j as e,b as Q,r as g,c7 as ze,hv as ei,hw as pt,hx as fe,hy as Qt,dR as q,hz as gn,hA as or,hB as it,dG as ti,hC as hn,hD as ar,dH as ot,V as B,as as le,q as re,hE as xn,o as f,fG as ni,b6 as yn,fx as ri,bt as bn,H as te,J as L,au as H,hF as ii,ad as pe,d2 as Le,C as V,at as ve,bz as Z,f8 as sr,bB as ge,B as W,p as gt,k as oi,M as Y,az as Fe,aA as tt,cw as at,hG as ai,bE as Zt,ch as Ne,aI as me,cX as si,v as li,hH as ci,x as di,u as lr,c8 as vn,bN as jn,w as ne,gh as Jt,c6 as $t,c$ as Ot,am as ht,bD as wn,hI as cr,hJ as dr,cx as ur,av as zt,ax as ui,gi as mi,fe as fi,R as pi,fd as st,aU as Cn,gj as gi,bb as hi,eU as At,ga as xi,cY as Bt,Q as en,bK as yi,b8 as bi,a3 as mr,cZ as vi,ap as fr,b_ as Pe,b$ as Ae,hK as ji,bj as tn,U as wi,cu as pr,cv as Mt,ab as gr,dg as Ci,ay as kn,cR as ki,hL as Si,hM as Rt,hN as Tt,hO as Sn,aG as ee,hP as Dn,dU as Di,S as Pn,bw as An,bx as Rn,ac as Pi,hQ as Ai,a as Ri}from"./index-Dtj3cePH.js";import{u as Ti,T as Ei}from"./html-title-wftxlNic.js";import{A as Ii}from"./ArrowDropDown-225S5d4X.js";import{u as nn,C as M,a as Tn}from"./index.esm-KhX4wp--.js";import{S as se,a as Li}from"./switch-control-CzpP7CIf.js";import{P as ie}from"./permission-B-geZ8jf.js";import{H as hr,g as Fi}from"./index-DtdZa4Ii.js";import{A as xr}from"./Link-DOvnx4g5.js";import{A as _i}from"./actions-rnAVohGM.js";import{D as je}from"./Delete-B-jFRJwJ.js";import{D as xt}from"./delete-confirm-BCALKic0.js";import{v as lt}from"./index-TLvz3wdj.js";import{s as Ni}from"./logo-BKA11TRi.js";import{R as yr,b as Wt,a as $i}from"./url-evaluation-D49POKf_.js";import{u as Oi}from"./useLocalStorage-Dn6UErBV.js";import{R as zi}from"./Refresh-D_WONHhn.js";import{L as Bi}from"./LoadingButton-CDH-grwB.js";import{C as Mi,R as Wi,P as br,S as qi}from"./rotate-session-key-BPhFiNZy.js";import{A as $e}from"./Add-CaX-C76B.js";import{B as vr,D as En,W as Ge}from"./status-CcMfecIj.js";import{i as Ui}from"./is-path-prefix-equal-BxWUya7r.js";import{N as Hi}from"./ChevronRight-Ba1GeQFe.js";import{I as Ki}from"./MoreVert-DV_CQ8ui.js";import{E as jr}from"./Edit-DUM500XS.js";import{A as Vi}from"./CallMerge-g03IIE2c.js";import{C as Gi}from"./CardContent-De2diFnM.js";import"./FilterList-ChbigVQM.js";import"./CSSTransition-BoEOBxnu.js";import"./emotion-cache.browser.esm-fPnQyG8C.js";import"./index-CSC84DXT.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-iVI-ppGn.js";import"./index-imQtUA1Y.js";import"./TableSearch-C5Kz0G1P.js";import"./Search-z9bCqmrZ.js";import"./Clear-B_hKjaJj.js";import"./click-to-copy-BgfWbRfM.js";import"./visuallyHidden-Dan1xhjv.js";const Yi=we(e.jsx("path",{d:"m7 14 5-5 5 5z"})),Xi=we(e.jsx("path",{d:"M12 3 2 21h20zm1 5.92L18.6 19H13zm-2 0V19H5.4z"})),Qi=we(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"})),wr=we(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),Zi=we(e.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"})),Ji=we(e.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),eo=we(e.jsx("path",{d:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9z"})),be="Dashboard",Cr=g.createContext({}),{Provider:to,Consumer:Ss}=Cr,In=[be,Qt,pt],no=(t,r)=>{if(t.name===fe)return-1;if(r.name===fe)return 1;const n=In.includes(t.name),i=In.includes(r.name);return n&&i?hn(t.name,r.name):n?-1:i?1:hn(t.name,r.name)},Ln=({sites:t,nodePort:r})=>{const n=window.location.hostname,a=(t||[]).map(o=>{const{id:s,rules:d=[],corsAllowedOrigins:m=[]}=o;let{domain:c,domainAliases:u}=o;u=u||[],[Qt,pt].includes(c)&&(c=be,u.find(v=>v.value===n)||u.unshift({protected:!1,value:n}));const j={id:s,name:c,type:"domain",items:[],domainAliases:u,isProtected:o.isProtected,corsAllowedOrigins:m};return(d||[]).forEach(v=>{const{id:h,isProtected:k,from:{pathPrefix:b},to:S}=v;if(S.type===q.BLOCKLET){let D="";Number.parseInt(S.port,10)===Number.parseInt(r,10)?(D="Blocklet Server Dashboard",S.type=q.DAEMON):D=S.did,j.items.push({id:h,name:gn(b||"/"),title:D,type:"rule",isProtected:k,pathPrefix:b,to:S})}else j.items.push({id:h,pathPrefix:b,name:gn(b||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:k,to:S})}),j.items=or(j.items,v=>v.name),j}).sort(no),l=a.reduce((o,s)=>{let{name:d}=s;return d.endsWith(it)&&([d]=d.split(".")),o[d]={...s,rules:s.items},o},{});return{sites:a,siteMap:l}},ro=({did:t,domain:r,mountPoint:n,siteMap:i,params:a}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const o=r||(l.domainAliases||[])[0];if(!o)return null;let s=n;if(!s){const d=l.rules.filter(m=>!m.name.startsWith(ar))[0];s=d?d.name:"/"}return ot(o.value,s,a)},io=({did:t,mountPoint:r,siteMap:n,params:i}={})=>{if(!n)return[];const a=n[t];if(!a)return[];const l=a.domainAliases||[];if(!l.length)return[];let o=r;if(!o){const s=a.rules.filter(d=>!d.name.startsWith(ar))[0];o=s?s.name:"/"}return l.map(s=>ot(s.value,o,i))},oo=t=>{const r=t.map(i=>i.domain).filter(i=>![pt,fe].includes(i));let n=[];return t.forEach(i=>n.push(...i.domainAliases||[])),n=n.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:r,domainsAliases:n}};function Fn({children:t}){const{api:r,info:n}=Q(),[i,a]=g.useState([]),[l,o]=g.useState([]),[s,d]=g.useState([]),m=ze(async()=>{const{sites:y}=await r.getRoutingSites({input:{snapshotHash:""}}),R=y||[];await Promise.all(R.map(async w=>(w.domainAliases=await ei(w.domainAliases,{getIP:ti}),w)));const x=oo(R);a(R),o(x.domains);const p=Ln({sites:R,nodePort:n.port});d((p?.sites||[]).map(w=>w.domainAliases.map(T=>T.value)).filter(w=>w.length))},[n]),c=(y,R)=>{a(x=>x.map(p=>p.id===y?R.domain?R:{...R,domain:p.domain}:p))},u=async y=>{const R=await r.addRoutingSite({input:y});a(i.concat(R.site))},j=async(y,R)=>{const x=await r.updateRoutingSite({input:{id:y,...R}});if(x.site&&x.site.id){const p=i.findIndex(w=>w.id===x.site.id);p!==-1&&(i.splice(p,1,x.site),a([].concat(i)))}},v=async y=>{await r.deleteRoutingSite({input:{id:y}}),a(i.filter(R=>R.id!==y))},h=async(y,R,x)=>{const p=await r.addDomainAlias({input:{id:y,domainAlias:R,force:x}});c(y,p.site)},k=async(y,R)=>{const x=await r.deleteDomainAlias({input:{id:y,domainAlias:R}});c(y,x.site)},b=async(y,R)=>{const{site:x}=await r.addRoutingRule({input:{id:y,rule:R}});c(y,x)},S=async(y,R)=>{const{site:x}=await r.updateRoutingRule({input:{id:y,rule:R}});c(y,x)},D=async(y,R)=>{const{site:x}=await r.deleteRoutingRule({input:{id:y,ruleId:R}});c(y,x)},C={loading:m.loading,error:m.error,refresh:m.retry,api:r,actions:{addSite:u,updateSite:j,deleteSite:v,addDomainAlias:h,deleteDomainAlias:k,addRule:b,updateRule:S,deleteRule:D}},{sites:P,siteMap:A}=Ln({sites:i,nodePort:n.port});return C.sites=P,C.siteMap=A,C.domains=l,C.allDomains=s,C.getBlockletUrl=({did:y,domain:R,mountPoint:x,params:p})=>ro({did:y,domain:R,mountPoint:x,siteMap:C.siteMap,params:p}),C.getBlockletUrls=({did:y,mountPoint:R,params:x})=>io({did:y,mountPoint:R,siteMap:C.siteMap,params:x}),e.jsx(to,{value:{routing:C},children:t})}function de(){const{routing:t}=g.useContext(Cr);return t}function rn(t){const r=[pt,fe,Qt];return typeof window<"u"&&typeof window.location<"u"&&r.push(window.location.hostname),r.includes(t)}function ao(){return null}function kr({confirm:t=null}){const[r,n]=g.useState(null),{t:i}=B(),a=()=>{n(null)},l=async s=>{if(s){let d=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d==="/"?xn.push(`${s.pathname}`):(d.endsWith("/")&&(d=d.substring(0,d.length-1)),xn.push(`${d}${s.pathname}`)),window.location.reload()}},o=(s,...d)=>{let m=typeof t=="function"?t(s,...d):t;return m?(typeof m=="string"&&(m={description:m}),n({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>a(),...m}),!1):!0};return e.jsxs(so,{children:[e.jsx(ao,{message:o}),r&&e.jsx(le,{title:r.title,description:r.description,confirm:r.confirm,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}kr.propTypes={confirm:f.oneOfType([f.object,f.string,f.func])};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,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-B8jKymjp.js","./index-CP8e2zcP.js","./index-BLDnEtdF.css","./url-join-BYRfgTzL.js","./index-PzC6rkTH.js","./_createAggregator-BS_ZCLsv.js","./depsEqual-FU6HOfMn.js","./index-B01of1n7.js","./index-D29L5UKE.js","./toUpper-P-IpqDCE.js","./index-_3Fxot8G.css"])))=>i.map(i=>d[i]);
2
- import{c as nt,j as t,de as as,hV as ls,ij as cs,V as je,aS as Be,B as G,ad as Oe,H as fe,o as S,ab as Dt,r as L,p as $e,bH as vt,am as Ne,aU as ve,at as nr,bG as Pt,bB as Te,ik as us,au as Ie,q as we,av as Re,aI as Mo,J as Se,cu as hn,af as Tt,x as Me,a3 as ds,G as fs,il as ps,fe as ms,fJ as hs,fK as gs,C as Ae,eP as $o,gb as dr,D as xs,E as un,A as ys,im as vs,io as bs,bz as He,ip as Cs,b3 as ws,eQ as js,iq as Uo,dE as Fo,M as Ye,fZ as Ss,eM as _s,cU as ks,cV as Es,ac as Rs,cW as Ps,X as Ee,fG as Ts,eb as Bs,S as Ds,aE as Dr,aG as Is,w as Os,ir as Ns,is as qo,fT as Gt,it as As,iu as zo,iv as Ls,ah as ke,iw as Wo,fg as Ms,dw as $s,gm as Us,gt as Fs,ix as qs,cQ as Ir,iy as Vo,gY as Ho,bq as zs,aB as gn,P as Je,fD as Ws,fE as Or,ao as dn,iz as Vs,c4 as Nr,iA as Ko,bF as kt,i as Hs,bu as et,b6 as Ar,i7 as Go,k as at,gf as Ks,dX as Lr,i8 as Gs,fO as Mr,ay as Ys,Q as It,al as Yo,a as Zs,eJ as Xs,bt as zt,hI as fr,iB as Qs,hJ as Ze,cT as $r,e9 as Js,dR as he,iC as Zo,as as bt,dH as Xo,dD as pr,cC as ea,ap as ta,u as mr,ch as rr,bN as na,f8 as Et,cw as Tn,c8 as ra,bI as Qo,hz as oa,d6 as ia,aV as Jo,d2 as sa,by as aa,co as Ur,cp as Fr,cq as qr,cx as zr,e8 as la,cr as ca,dC as ua,iD as da,bC as fa}from"./index-CP8e2zcP.js";import{y as pa}from"./index-DX_ig3IR.js";import{b as ma,S as ha,u as hr}from"./actions-BuX7-i-0.js";import{S as ga,a as xa}from"./switch-control-BEw34mlq.js";import{u as We}from"./blocklet-D7q_eJsm.js";import{P as or,w as xn}from"./permission-D6xGjoP4.js";import{E as ei}from"./Edit-CGdW8_LW.js";import{T as ya,M as va,t as ba}from"./table-icons-V0nzUvpC.js";import{s as Ca,F as ti,A as wa,b as ja,c as Sa,d as _a,R as yt,L as ka,I as Ea,S as St,a as Wt,B as Ra}from"./preference-CWfaETuk.js";import{C as Wr}from"./click-to-copy-wk3E32eY.js";import{O as Bn}from"./index-hxHDV4zb.js";import{A as Pa}from"./Add-B-lIYZBc.js";import{A as yn}from"./Link-DUSQD8mc.js";import{C as Ta,c as Ba,b as Da,f as ni,A as Ia,_ as Oa,a as Na,e as Aa,d as ri,s as La,L as Ma,u as $a,g as Ua,S as Fa}from"./item-NX8BCXwV.js";import{T as qa,L as za,a as ir,u as Vr,B as Wa,P as Va}from"./index-Cske9PWb.js";import{e as oi}from"./engine-hQAyActy.js";import{e as Ha,f as Ka,g as Ga,h as Ya,C as Za,S as ii}from"./connect-to-BdinmIba.js";import{C as Xa,u as Qa,A as Ja}from"./agreement-3SHQ4MuR.js";import{D as si}from"./Done-DfHgd6VN.js";import{C as el}from"./Google-D9HgkG4U.js";import{I as ai,f as tl,a as nl,B as rl}from"./install-from-url-DfM4lxPD.js";import{a as Hr}from"./api-DBq1KtcA.js";import{v as li,e as ol,a as fn}from"./util-BF2dKFyL.js";import{u as ci}from"./use-mobile-BIorytbM.js";import{A as il}from"./ArrowDropDown-C1ynmK1V.js";import{u as sl}from"./useLocalStorage-CBx2eW_l.js";import{r as vn}from"./index-PzC6rkTH.js";import{b as bn}from"./without-wallet-lUjEmpWw.js";import{E as gr}from"./ErrorOutline-D3nJBXYA.js";import{V as al}from"./Visibility-BqBwXDHr.js";import{H as ll}from"./HelpOutline-s5mQqTw1.js";import{c as cl}from"./lock.svg-D22_UbmU.js";import{D as Cn}from"./Delete-CCasVLgy.js";import{L as ui}from"./Launch-DHnB5pzO.js";import{D as ul}from"./delete-confirm-C8X53PNk.js";import{W as Bt,B as sr,m as dl}from"./status-CFw68CfZ.js";import{R as fl}from"./Replay-3PaYn2br.js";import{R as pl,b as Kr}from"./url-evaluation-BotqjpOW.js";import{A as di}from"./actions-Zy-oEKVg.js";import{v as Dn}from"./index-8K8V7S7h.js";import{t as ml}from"./toUpper-P-IpqDCE.js";import{u as hl}from"./team-Bp-ehLS6.js";import"./MoreVert-Cw1fjU9L.js";import"./DeleteOutline-CocEa6gq.js";import"./get-safe-url-n4nPkbEQ.js";import"./ButtonGroup-CXwzM552.js";import"./getValidReactChildren-dJeDeNuf.js";import"./FilterList-BiaeVs0C.js";import"./CSSTransition-hTlKGu0l.js";import"./emotion-cache.browser.esm-D6kXFXIA.js";import"./index-CVhk080O.js";import"./typeof-QjJsDpFa.js";import"./raf-schd.esm-vaS856Rv.js";import"./redux-Ab4buSXY.js";import"./useThemeProps-BWD3Vp6O.js";import"./html-title-DwrWBQUt.js";import"./Clear-XkW6YpHE.js";import"./ChevronRight-C_yvQN06.js";import"./ChevronLeft-BPs9Erbv.js";import"./Search-mc0LftDb.js";import"./omit-C1X-CRrb.js";import"./edit.svg-CBqxioRV.js";import"./index-B01of1n7.js";import"./iframe-B0inMXzK.js";import"./Verified-se8hbTqT.js";import"./Autocomplete-BHqH72uG.js";import"./ListSubheader-rZisNvzB.js";import"./VerifiedUser-8QA2XNlm.js";import"./url-join-BYRfgTzL.js";import"./index-BojVbZw0.js";import"./spaces-BqdEt5Dg.js";import"./OpenInNew-2i4mGCRx.js";import"./index-D29L5UKE.js";import"./index-BPu5OFdR.js";import"./cloneDeep-BEJXcFgb.js";import"./ListItemButton-BIo7wBNv.js";import"./Stepper-CnqNXODv.js";import"./is-path-prefix-equal-sWdIB_FI.js";import"./login-method-item-CGUaonon.js";import"./passkey-rounded-_WDHIZVd.js";const gl=nt(t.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),xl=nt(t.jsx("path",{d:"m19 8-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4z"})),yl=nt(t.jsx("path",{d:"M8 5v14l11-7z"})),fi=nt(t.jsx("path",{d:"M22 5.18 10.59 16.6l-4.24-4.24 1.41-1.41 2.83 2.83 10-10zm-2.21 5.04c.13.57.21 1.17.21 1.78 0 4.42-3.58 8-8 8s-8-3.58-8-8 3.58-8 8-8c1.58 0 3.04.46 4.28 1.25l1.44-1.44C16.1 2.67 14.13 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-1.19-.22-2.33-.6-3.39z"})),vl=nt(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"})),pi=nt(t.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),bl=nt(t.jsx("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"})),Cl=nt(t.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),wl=nt(t.jsx("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"}));function Gr(e,n){var r={};return n=as(n),ls(e,function(i,a,s){cs(r,a,n(i,a,s))}),r}function mi({children:e=null,...n}){const{t:r}=je(),{api:i}=Be(),{blocklet:a}=We(),s=a?.settings?.autoCheckUpdate,d=async o=>{await i.updateAutoCheckUpdate({input:{did:a.meta.did,autoCheckUpdate:o}})},c=async()=>{try{const o=!s?.enabled;await d({enabled:o}),fe.success(r(o?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(o){fe.error(o.message)}},l=!!s?.enabled;return t.jsxs(G,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e,t.jsx(Oe,{title:r("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(ga,{checked:l,onChange:c,name:"enableWelcomePage",style:{...n.style,zoom:.8}})})})]})}mi.propTypes={children:S.any};function Yr(e){function n({sx:r,...i}){return t.jsx(e,{...i,sx:{color:"text.primary",...r}})}return n}const jl={...Gr(ba,Yr),...Gr(ma,Yr)},Sl=(e,n)=>{let{description:r}=e;return(Object.values(Ne.CHAIN_PROP_MAP).includes(e.key)||ve.isEnvShareable(e))&&(r?r=`${r} (${n("blocklet.config.sharedToAllComponents")})`:r=n("blocklet.config.sharedToAllComponents")),r&&t.jsx("div",{style:{marginLeft:12},children:r})},In=(e,n,r=[])=>!r?.length&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!n.meta.environments.find(i=>i.name===e.key)&&n.children.every(i=>!i.meta.environments.find(a=>a.name===e.key))?!0:e.custom,Zr=e=>[Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),On=e=>[Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function hi({blocklet:e,ancestors:n=[]}){const r=Be(),{palette:i}=Dt(),{inService:a}=r,{t:s}=L.useContext($e),d=[...n.map(m=>m.meta.did),e.meta.did],c=()=>fe.success(s("blocklet.config.changedTip")),l=m=>In(m,e,n);if(vt(e.status)||e.status==="unknown"&&vt(e.status))return null;const o=m=>new Promise(async(v,j)=>{if(!m.key.trim()||!m.value.trim()){fe.error(s("blocklet.config.environment.keyValueRequired")),j();return}if(Zr(m.key)===!1){fe.error(s("blocklet.config.environment.invalidKey")),j();return}m.custom=On(m.key);try{const y=await r.api.configBlocklet({input:{did:d,configs:[m]}});c(y.blocklet),v()}catch(y){fe.error(Te(y)),j()}}),p=(m,v)=>new Promise(async(j,y)=>{if(m.required&&(!m.key.trim()||!m.value.trim())){fe.error(s("blocklet.config.environment.keyValueRequired")),y();return}if(Zr(m.key)===!1){fe.error(s("blocklet.config.environment.invalidKey")),y();return}if(m.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const K=us(m);if(K){fe.error(K),y();return}}const C=[{...m,value:m.secure&&m.value==="__encrypted__"?"":m.value}];if(m.key!==v.key){if(!In(m,e,n)){fe.error("Only key of custom env can be changed"),y();return}C.push({key:v.key,custom:On(m.key)})}try{const K=await r.api.configBlocklet({input:{did:d,configs:C}});c(K.blocklet),j()}catch(K){fe.error(Te(K)),y()}}),f=m=>new Promise(async(v,j)=>{if(m.required){fe.error(s("blocklet.config.environment.deleteForbidden")),j();return}if(!In(m,e,n)){fe.error(s("environmentTips.deleteForbidden")),j();return}try{const y=await r.api.configBlocklet({input:{did:d,configs:[{key:m.key,custom:On(m.key)}]}});c(y.blocklet),v()}catch(y){fe.error(Te(y)),j()}}),b=(e.configs||[]).filter(m=>!Ne.BLOCKLET_CONFIGURABLE_KEY[m.key]||[Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(m.key)),x=ve.getSharedConfigObj(n[0],e),k=ve.getComponentMissingConfigs(e,n[0]),P=b.map(m=>({...m,value:Object.values(Ne.CHAIN_PROP_MAP).includes(m.key)&&Object.keys(x).includes(m.key)?x[m.key]:x[m.key]||m.value})),E=P.some(m=>m.key&&m.key.startsWith("BWA_")),A={onRowAdd:o,onRowUpdate:p,onRowDelete:f,isDeletable:l},h=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:m=>t.jsx(Wr,{value:m.value,style:{color:m.required&&!m.value?i.error.main:i.text.primary,fontWeight:m.required?"bold":"normal"},children:m.key}),editComponent:m=>{const{value:v,rowData:j,onChange:y}=m;return t.jsx(Xr,{children:t.jsx(Ie,{fullWidth:!0,size:"small",value:Ca.escapeTag(v),onChange:C=>y(C.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0,slotProps:{input:{readOnly:l(j)===!1}}})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:m=>m.value?m.secure?"******":t.jsx(Wr,{unstyled:!0,value:m.value,style:{wordBreak:"break-all"},children:m.value}):null,editComponent:m=>{const{value:v,rowData:j,onChange:y}=m;return t.jsxs(Xr,{children:[t.jsx(Ie,{fullWidth:!0,size:"small",value:v==="__encrypted__"?"":v,onChange:C=>y(C.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Sl(j,s)]})}}];return t.jsxs(_l,{children:[!!k.length&&t.jsx(nr,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),E&&t.jsx(nr,{severity:"info",children:s("blocklet.config.environment.tip")}),t.jsx(or,{permission:a?"":"mutate_blocklets",role:a?Pt:[],children:m=>t.jsx(ya,{className:"config-table",children:t.jsx(va,{title:t.jsx(G,{sx:{fontWeight:"bold"},children:s("common.environments")}),columns:h(),icons:jl,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:s("common.actions")},body:{emptyDataSourceMessage:s("common.noData"),editRow:{deleteText:s("environmentTips.delete")}}},data:P,editable:m?A:{}})})})]})}hi.propTypes={blocklet:S.object.isRequired,ancestors:S.array};const _l=we.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-kfl7onTb.js","./index-Dtj3cePH.js","./index-BLDnEtdF.css","./url-join-CYWu6vsi.js","./index-BgEoonJf.js","./_createAggregator-DvxY8dpL.js","./depsEqual-iVI-ppGn.js","./index-Ce4rkgom.js","./index-D29L5UKE.js","./toUpper-B8LTwalX.js","./index-_3Fxot8G.css"])))=>i.map(i=>d[i]);
2
+ import{c as nt,j as t,de as as,hV as ls,ij as cs,V as je,aS as Be,B as G,ad as Oe,H as fe,o as S,ab as Dt,r as L,p as $e,bH as vt,am as Ne,aU as ve,at as nr,bG as Pt,bB as Te,ik as us,au as Ie,q as we,av as Re,aI as Mo,J as Se,cu as hn,af as Tt,x as Me,a3 as ds,G as fs,il as ps,fe as ms,fJ as hs,fK as gs,C as Ae,eP as $o,gb as dr,D as xs,E as un,A as ys,im as vs,io as bs,bz as He,ip as Cs,b3 as ws,eQ as js,iq as Uo,dE as Fo,M as Ye,fZ as Ss,eM as _s,cU as ks,cV as Es,ac as Rs,cW as Ps,X as Ee,fG as Ts,eb as Bs,S as Ds,aE as Dr,aG as Is,w as Os,ir as Ns,is as qo,fT as Gt,it as As,iu as zo,iv as Ls,ah as ke,iw as Wo,fg as Ms,dw as $s,gm as Us,gt as Fs,ix as qs,cQ as Ir,iy as Vo,gY as Ho,bq as zs,aB as gn,P as Je,fD as Ws,fE as Or,ao as dn,iz as Vs,c4 as Nr,iA as Ko,bF as kt,i as Hs,bu as et,b6 as Ar,i7 as Go,k as at,gf as Ks,dX as Lr,i8 as Gs,fO as Mr,ay as Ys,Q as It,al as Yo,a as Zs,eJ as Xs,bt as zt,hI as fr,iB as Qs,hJ as Ze,cT as $r,e9 as Js,dR as he,iC as Zo,as as bt,dH as Xo,dD as pr,cC as ea,ap as ta,u as mr,ch as rr,bN as na,f8 as Et,cw as Tn,c8 as ra,bI as Qo,hz as oa,d6 as ia,aV as Jo,d2 as sa,by as aa,co as Ur,cp as Fr,cq as qr,cx as zr,e8 as la,cr as ca,dC as ua,iD as da,bC as fa}from"./index-Dtj3cePH.js";import{y as pa}from"./index-imQtUA1Y.js";import{b as ma,S as ha,u as hr}from"./actions-CUnz9wHy.js";import{S as ga,a as xa}from"./switch-control-CzpP7CIf.js";import{u as We}from"./blocklet-B65NZ0SL.js";import{P as or,w as xn}from"./permission-B-geZ8jf.js";import{E as ei}from"./Edit-DUM500XS.js";import{T as ya,M as va,t as ba}from"./table-icons-Bo0tOvqU.js";import{s as Ca,F as ti,A as wa,b as ja,c as Sa,d as _a,R as yt,L as ka,I as Ea,S as St,a as Wt,B as Ra}from"./preference-C8QaexiP.js";import{C as Wr}from"./click-to-copy-BgfWbRfM.js";import{O as Bn}from"./index-UjkYO3io.js";import{A as Pa}from"./Add-CaX-C76B.js";import{A as yn}from"./Link-DOvnx4g5.js";import{C as Ta,c as Ba,b as Da,f as ni,A as Ia,_ as Oa,a as Na,e as Aa,d as ri,s as La,L as Ma,u as $a,g as Ua,S as Fa}from"./item-DI_IF5jI.js";import{T as qa,L as za,a as ir,u as Vr,B as Wa,P as Va}from"./index-DHJJWO6c.js";import{e as oi}from"./engine-xHEY-z1Q.js";import{e as Ha,f as Ka,g as Ga,h as Ya,C as Za,S as ii}from"./connect-to-TtcHrCpE.js";import{C as Xa,u as Qa,A as Ja}from"./agreement-B81jBHjm.js";import{D as si}from"./Done-L7ZRzL_V.js";import{C as el}from"./Google-CWlHJZAv.js";import{I as ai,f as tl,a as nl,B as rl}from"./install-from-url-B05WE8Ly.js";import{a as Hr}from"./api-BLIecOBq.js";import{v as li,e as ol,a as fn}from"./util-BVHL76Cg.js";import{u as ci}from"./use-mobile-xq_yWBax.js";import{A as il}from"./ArrowDropDown-225S5d4X.js";import{u as sl}from"./useLocalStorage-Dn6UErBV.js";import{r as vn}from"./index-BgEoonJf.js";import{b as bn}from"./without-wallet-BzLoVl__.js";import{E as gr}from"./ErrorOutline-DsKZTEd8.js";import{V as al}from"./Visibility-BVnDeVk-.js";import{H as ll}from"./HelpOutline-dihfOb5v.js";import{c as cl}from"./lock.svg-Cgo551jB.js";import{D as Cn}from"./Delete-B-jFRJwJ.js";import{L as ui}from"./Launch-BkVAoVZE.js";import{D as ul}from"./delete-confirm-BCALKic0.js";import{W as Bt,B as sr,m as dl}from"./status-CcMfecIj.js";import{R as fl}from"./Replay-B4flsCqt.js";import{R as pl,b as Kr}from"./url-evaluation-D49POKf_.js";import{A as di}from"./actions-rnAVohGM.js";import{v as Dn}from"./index-TLvz3wdj.js";import{t as ml}from"./toUpper-B8LTwalX.js";import{u as hl}from"./team-cDk0EvPf.js";import"./MoreVert-DV_CQ8ui.js";import"./DeleteOutline-7b3f7PEm.js";import"./get-safe-url-C0YzO5pG.js";import"./ButtonGroup-CFUm4DnA.js";import"./getValidReactChildren-BwWzCXzg.js";import"./FilterList-ChbigVQM.js";import"./CSSTransition-BoEOBxnu.js";import"./emotion-cache.browser.esm-fPnQyG8C.js";import"./index-CVhk080O.js";import"./typeof-QjJsDpFa.js";import"./raf-schd.esm-B49R8L3J.js";import"./redux-Ab4buSXY.js";import"./useThemeProps-9zV1AZbb.js";import"./html-title-wftxlNic.js";import"./Clear-B_hKjaJj.js";import"./ChevronRight-Ba1GeQFe.js";import"./ChevronLeft-6mKauCKy.js";import"./Search-z9bCqmrZ.js";import"./omit-C22NrHjF.js";import"./edit.svg-088QpjsR.js";import"./index-Ce4rkgom.js";import"./iframe-CVO90dup.js";import"./Verified-TZI1j-Va.js";import"./Autocomplete-CoHLc9sw.js";import"./ListSubheader-Cl_ECqW2.js";import"./VerifiedUser-Ddu-50lW.js";import"./url-join-CYWu6vsi.js";import"./index-BojVbZw0.js";import"./spaces-BsLjYZLj.js";import"./OpenInNew-DXke8B9Y.js";import"./index-D29L5UKE.js";import"./index-XFNKEyIx.js";import"./cloneDeep-BBtZ6NeX.js";import"./ListItemButton-BQDScowx.js";import"./Stepper-DKmKSFCG.js";import"./is-path-prefix-equal-BxWUya7r.js";import"./login-method-item-rb7xoaP3.js";import"./passkey-rounded-_WDHIZVd.js";const gl=nt(t.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),xl=nt(t.jsx("path",{d:"m19 8-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4z"})),yl=nt(t.jsx("path",{d:"M8 5v14l11-7z"})),fi=nt(t.jsx("path",{d:"M22 5.18 10.59 16.6l-4.24-4.24 1.41-1.41 2.83 2.83 10-10zm-2.21 5.04c.13.57.21 1.17.21 1.78 0 4.42-3.58 8-8 8s-8-3.58-8-8 3.58-8 8-8c1.58 0 3.04.46 4.28 1.25l1.44-1.44C16.1 2.67 14.13 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-1.19-.22-2.33-.6-3.39z"})),vl=nt(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"})),pi=nt(t.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),bl=nt(t.jsx("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"})),Cl=nt(t.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),wl=nt(t.jsx("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"}));function Gr(e,n){var r={};return n=as(n),ls(e,function(i,a,s){cs(r,a,n(i,a,s))}),r}function mi({children:e=null,...n}){const{t:r}=je(),{api:i}=Be(),{blocklet:a}=We(),s=a?.settings?.autoCheckUpdate,d=async o=>{await i.updateAutoCheckUpdate({input:{did:a.meta.did,autoCheckUpdate:o}})},c=async()=>{try{const o=!s?.enabled;await d({enabled:o}),fe.success(r(o?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(o){fe.error(o.message)}},l=!!s?.enabled;return t.jsxs(G,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e,t.jsx(Oe,{title:r("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(ga,{checked:l,onChange:c,name:"enableWelcomePage",style:{...n.style,zoom:.8}})})})]})}mi.propTypes={children:S.any};function Yr(e){function n({sx:r,...i}){return t.jsx(e,{...i,sx:{color:"text.primary",...r}})}return n}const jl={...Gr(ba,Yr),...Gr(ma,Yr)},Sl=(e,n)=>{let{description:r}=e;return(Object.values(Ne.CHAIN_PROP_MAP).includes(e.key)||ve.isEnvShareable(e))&&(r?r=`${r} (${n("blocklet.config.sharedToAllComponents")})`:r=n("blocklet.config.sharedToAllComponents")),r&&t.jsx("div",{style:{marginLeft:12},children:r})},In=(e,n,r=[])=>!r?.length&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!n.meta.environments.find(i=>i.name===e.key)&&n.children.every(i=>!i.meta.environments.find(a=>a.name===e.key))?!0:e.custom,Zr=e=>[Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),On=e=>[Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function hi({blocklet:e,ancestors:n=[]}){const r=Be(),{palette:i}=Dt(),{inService:a}=r,{t:s}=L.useContext($e),d=[...n.map(m=>m.meta.did),e.meta.did],c=()=>fe.success(s("blocklet.config.changedTip")),l=m=>In(m,e,n);if(vt(e.status)||e.status==="unknown"&&vt(e.status))return null;const o=m=>new Promise(async(v,j)=>{if(!m.key.trim()||!m.value.trim()){fe.error(s("blocklet.config.environment.keyValueRequired")),j();return}if(Zr(m.key)===!1){fe.error(s("blocklet.config.environment.invalidKey")),j();return}m.custom=On(m.key);try{const y=await r.api.configBlocklet({input:{did:d,configs:[m]}});c(y.blocklet),v()}catch(y){fe.error(Te(y)),j()}}),p=(m,v)=>new Promise(async(j,y)=>{if(m.required&&(!m.key.trim()||!m.value.trim())){fe.error(s("blocklet.config.environment.keyValueRequired")),y();return}if(Zr(m.key)===!1){fe.error(s("blocklet.config.environment.invalidKey")),y();return}if(m.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const K=us(m);if(K){fe.error(K),y();return}}const C=[{...m,value:m.secure&&m.value==="__encrypted__"?"":m.value}];if(m.key!==v.key){if(!In(m,e,n)){fe.error("Only key of custom env can be changed"),y();return}C.push({key:v.key,custom:On(m.key)})}try{const K=await r.api.configBlocklet({input:{did:d,configs:C}});c(K.blocklet),j()}catch(K){fe.error(Te(K)),y()}}),f=m=>new Promise(async(v,j)=>{if(m.required){fe.error(s("blocklet.config.environment.deleteForbidden")),j();return}if(!In(m,e,n)){fe.error(s("environmentTips.deleteForbidden")),j();return}try{const y=await r.api.configBlocklet({input:{did:d,configs:[{key:m.key,custom:On(m.key)}]}});c(y.blocklet),v()}catch(y){fe.error(Te(y)),j()}}),b=(e.configs||[]).filter(m=>!Ne.BLOCKLET_CONFIGURABLE_KEY[m.key]||[Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(m.key)),x=ve.getSharedConfigObj(n[0],e),k=ve.getComponentMissingConfigs(e,n[0]),P=b.map(m=>({...m,value:Object.values(Ne.CHAIN_PROP_MAP).includes(m.key)&&Object.keys(x).includes(m.key)?x[m.key]:x[m.key]||m.value})),E=P.some(m=>m.key&&m.key.startsWith("BWA_")),A={onRowAdd:o,onRowUpdate:p,onRowDelete:f,isDeletable:l},h=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:m=>t.jsx(Wr,{value:m.value,style:{color:m.required&&!m.value?i.error.main:i.text.primary,fontWeight:m.required?"bold":"normal"},children:m.key}),editComponent:m=>{const{value:v,rowData:j,onChange:y}=m;return t.jsx(Xr,{children:t.jsx(Ie,{fullWidth:!0,size:"small",value:Ca.escapeTag(v),onChange:C=>y(C.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0,slotProps:{input:{readOnly:l(j)===!1}}})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:m=>m.value?m.secure?"******":t.jsx(Wr,{unstyled:!0,value:m.value,style:{wordBreak:"break-all"},children:m.value}):null,editComponent:m=>{const{value:v,rowData:j,onChange:y}=m;return t.jsxs(Xr,{children:[t.jsx(Ie,{fullWidth:!0,size:"small",value:v==="__encrypted__"?"":v,onChange:C=>y(C.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Sl(j,s)]})}}];return t.jsxs(_l,{children:[!!k.length&&t.jsx(nr,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),E&&t.jsx(nr,{severity:"info",children:s("blocklet.config.environment.tip")}),t.jsx(or,{permission:a?"":"mutate_blocklets",role:a?Pt:[],children:m=>t.jsx(ya,{className:"config-table",children:t.jsx(va,{title:t.jsx(G,{sx:{fontWeight:"bold"},children:s("common.environments")}),columns:h(),icons:jl,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:s("common.actions")},body:{emptyDataSourceMessage:s("common.noData"),editRow:{deleteText:s("environmentTips.delete")}}},data:P,editable:m?A:{}})})})]})}hi.propTypes={blocklet:S.object.isRequired,ancestors:S.array};const _l=we.div`
3
3
  .config-table {
4
4
  margin-bottom: 24px;
5
5
  position: relative;
@@ -66,7 +66,7 @@ import{c as nt,j as t,de as as,hV as ls,ij as cs,V as je,aS as Be,B as G,ad as O
66
66
  .ux-dialog_closeButton {
67
67
  margin: 0;
68
68
  }
69
- `,El=L.lazy(()=>fs(()=>import("./index-B8jKymjp.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).then(e=>({default:e.Uploader}))),Rl="/blocklet/component/upload",Qr=[".html",".htm",".tgz",".zip"],Pl=Number(window.env?.maxUploadFileSize)||ps,Tl=Pl*1024*1024;function gi({did:e,prefix:n,headers:r=()=>({}),onUploaded:i=Tt,open:a=!1,onClose:s=Tt}){const{t:d,locale:c}=je(),l=L.useRef(null),o=L.useCallback(p=>{const{status:f,data:b}=p;if(f===200){i(b);return}fe.error(d("blocklet.component.addComponentTip.uploadFailed"))},[i,d]);return L.useEffect(()=>{a?l.current?.open():l.current?.close()},[a]),t.jsx(Bl,{id:`component-uploader-${e}`,children:t.jsx(El,{ref:l,locale:c,popup:!0,disableXssAttack:!0,onUploadFinish:o,plugins:[],onClose:s,installerProps:{disabled:!0},apiPathProps:{uploader:Me(n,Rl,e),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:Qr,maxFileSize:Tl,maxNumberOfFiles:1}},tusProps:{headers:r},dashboardProps:{note:d("blocklet.component.addComponentTip.allowedFileTypes",{types:Qr.map(p=>p.replace(".","")).join(", ")})}})},`component-uploader-${e}`)}gi.propTypes={did:S.string.isRequired,prefix:S.string.isRequired,open:S.bool,headers:S.func,onUploaded:S.func,onClose:S.func};const Bl=ds(G)`
69
+ `,El=L.lazy(()=>fs(()=>import("./index-kfl7onTb.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).then(e=>({default:e.Uploader}))),Rl="/blocklet/component/upload",Qr=[".html",".htm",".tgz",".zip"],Pl=Number(window.env?.maxUploadFileSize)||ps,Tl=Pl*1024*1024;function gi({did:e,prefix:n,headers:r=()=>({}),onUploaded:i=Tt,open:a=!1,onClose:s=Tt}){const{t:d,locale:c}=je(),l=L.useRef(null),o=L.useCallback(p=>{const{status:f,data:b}=p;if(f===200){i(b);return}fe.error(d("blocklet.component.addComponentTip.uploadFailed"))},[i,d]);return L.useEffect(()=>{a?l.current?.open():l.current?.close()},[a]),t.jsx(Bl,{id:`component-uploader-${e}`,children:t.jsx(El,{ref:l,locale:c,popup:!0,disableXssAttack:!0,onUploadFinish:o,plugins:[],onClose:s,installerProps:{disabled:!0},apiPathProps:{uploader:Me(n,Rl,e),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:Qr,maxFileSize:Tl,maxNumberOfFiles:1}},tusProps:{headers:r},dashboardProps:{note:d("blocklet.component.addComponentTip.allowedFileTypes",{types:Qr.map(p=>p.replace(".","")).join(", ")})}})},`component-uploader-${e}`)}gi.propTypes={did:S.string.isRequired,prefix:S.string.isRequired,open:S.bool,headers:S.func,onUploaded:S.func,onClose:S.func};const Bl=ds(G)`
70
70
  .uploader-wrapper {
71
71
  display: inline-flex;
72
72
  position: relative;
@@ -1,4 +1,4 @@
1
- import{j as o,J as i,K as x,L as f,O as p}from"./index-CP8e2zcP.js";function w({name:t,nameFormatter:r=e=>typeof e=="string"?e.split(" ").map(c=>x(f(c))).join(" "):e,layout:n="horizontal",children:a,valueComponent:l="div",nameWidth:s=90,...m}){return o.jsxs(d,{layout:n,width:s,...m,children:[o.jsx(i,{color:"textSecondary",className:"info-row__name",children:r(t)}),a&&o.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:a})]})}const d=p("div")`
1
+ import{j as o,J as i,K as x,L as f,O as p}from"./index-Dtj3cePH.js";function w({name:t,nameFormatter:r=e=>typeof e=="string"?e.split(" ").map(c=>x(f(c))).join(" "):e,layout:n="horizontal",children:a,valueComponent:l="div",nameWidth:s=90,...m}){return o.jsxs(d,{layout:n,width:s,...m,children:[o.jsx(i,{color:"textSecondary",className:"info-row__name",children:r(t)}),a&&o.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:a})]})}const d=p("div")`
2
2
  display: flex;
3
3
  flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
4
4
  justify-content: flex-start;
@@ -1,4 +1,4 @@
1
- import{r as i,af as E,M as p,j as e,aB as m,bb as C,bc as I,bd as L,be as v,O as f,bf as A}from"./index-CP8e2zcP.js";import{B as z}from"./ButtonGroup-CXwzM552.js";function P(t,s){i.useEffect(()=>{function r(o){!t||!t.current||t.current.contains(o.target)||s(o)}return document.addEventListener("click",r,!0),()=>{document.removeEventListener("click",r,!0)}},[t,s])}function w({...t}){const{size:s="medium",color:r="primary",menu:o=[],children:c=null,variant:x="contained",onClick:h=E,menuButtonProps:g={},...j}=t,[b,l]=i.useState(!1),a=i.useRef(null),u=i.useRef(null),k=Array.isArray(o)?o.map((n,B)=>i.isValidElement(n)?n:i.createElement(p,{...n,key:B})):o,y=()=>{l(n=>!n)},d=n=>{a.current&&a.current.contains(n.target)||l(!1)};P(u,d);const M=n=>{n.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(R,{variant:x,size:s,color:r,ref:a,...j,children:[typeof c=="function"?c():e.jsx(m,{onClick:h,color:r,children:c}),e.jsx(m,{onClick:y,color:r,...g,"aria-label":"more functions",children:e.jsx(C,{})})]}),e.jsx(O,{open:b,anchorEl:a.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{ref:u,children:e.jsx(L,{onClickAway:d,children:e.jsx(v,{onClick:M,children:k})})})})]})}w.Item=p;const R=f(z)`
1
+ import{r as i,af as E,M as p,j as e,aB as m,bb as C,bc as I,bd as L,be as v,O as f,bf as A}from"./index-Dtj3cePH.js";import{B as z}from"./ButtonGroup-CFUm4DnA.js";function P(t,s){i.useEffect(()=>{function r(o){!t||!t.current||t.current.contains(o.target)||s(o)}return document.addEventListener("click",r,!0),()=>{document.removeEventListener("click",r,!0)}},[t,s])}function w({...t}){const{size:s="medium",color:r="primary",menu:o=[],children:c=null,variant:x="contained",onClick:h=E,menuButtonProps:g={},...j}=t,[b,l]=i.useState(!1),a=i.useRef(null),u=i.useRef(null),k=Array.isArray(o)?o.map((n,B)=>i.isValidElement(n)?n:i.createElement(p,{...n,key:B})):o,y=()=>{l(n=>!n)},d=n=>{a.current&&a.current.contains(n.target)||l(!1)};P(u,d);const M=n=>{n.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(R,{variant:x,size:s,color:r,ref:a,...j,children:[typeof c=="function"?c():e.jsx(m,{onClick:h,color:r,children:c}),e.jsx(m,{onClick:y,color:r,...g,"aria-label":"more functions",children:e.jsx(C,{})})]}),e.jsx(O,{open:b,anchorEl:a.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{ref:u,children:e.jsx(L,{onClickAway:d,children:e.jsx(v,{onClick:M,children:k})})})})]})}w.Item=p;const R=f(z)`
2
2
  > .MuiButtonBase-root:last-of-type {
3
3
  min-width: 2em;
4
4
  padding-left: 0;