@abtnode/webapp 1.16.51 → 1.16.52-beta-20250909-073849-4e392ab1
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.
- package/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/dist/assets/{AdapterDayjs-V7RXKqyP.js → AdapterDayjs-D65E_hJW.js} +1 -1
- package/dist/assets/{Add-7-eXJOKT.js → Add-BuxBWbKv.js} +1 -1
- package/dist/assets/ArrowDropDown-C9tvAge6.js +1 -0
- package/dist/assets/{Autocomplete-CWbaCMBc.js → Autocomplete-CWNFguFL.js} +1 -1
- package/dist/assets/{Breadcrumbs-BeUS9EzN.js → Breadcrumbs-C7nUb_aq.js} +1 -1
- package/dist/assets/{ButtonGroup-88wnT1Nl.js → ButtonGroup-Ca-yV-4C.js} +1 -1
- package/dist/assets/{CSSTransition-BhKCAa_k.js → CSSTransition-BtkiOWZC.js} +1 -1
- package/dist/assets/{CallMerge-DyslC22y.js → CallMerge-D2kp3kEl.js} +1 -1
- package/dist/assets/{CardContent-CWjONtVx.js → CardContent-CCKBriwF.js} +1 -1
- package/dist/assets/{ChevronLeft-DsCa_2Hj.js → ChevronLeft-zMXGyPG9.js} +1 -1
- package/dist/assets/{ChevronRight-Dh1NhSQh.js → ChevronRight-BrTU-Laa.js} +1 -1
- package/dist/assets/{Clear-vz3__EK4.js → Clear-CfUqGbT5.js} +1 -1
- package/dist/assets/{DeleteOutline-BQz9po9Q.js → DeleteOutline-CdS_T1n7.js} +1 -1
- package/dist/assets/{Done-Bk5S0dZ-.js → Done-BMzUfIev.js} +1 -1
- package/dist/assets/{Edit-ZWYQTIT_.js → Edit-s_UOOLA4.js} +1 -1
- package/dist/assets/{ErrorOutline-CWTup7vD.js → ErrorOutline-3Uoca5Wu.js} +1 -1
- package/dist/assets/{FilterList-DOLZBYMl.js → FilterList-oCTR8mcc.js} +1 -1
- package/dist/assets/{Google-DjCWLWBZ.js → Google-RsZHy3xt.js} +1 -1
- package/dist/assets/{HelpOutline-BIIJduw6.js → HelpOutline-Ba2mBnVG.js} +1 -1
- package/dist/assets/{Launch-DOQcWt9h.js → Launch-Dj1HRwwB.js} +1 -1
- package/dist/assets/{Link-D0HMFRxo.js → Link-D7GjIXxD.js} +1 -1
- package/dist/assets/{ListItemButton-hdq-8LOD.js → ListItemButton-B9OsRNX2.js} +1 -1
- package/dist/assets/{ListSubheader-OXmzqw9E.js → ListSubheader-BNfIC8TR.js} +1 -1
- package/dist/assets/{LoadingButton-Dd30R6FK.js → LoadingButton-C2x1AgPO.js} +1 -1
- package/dist/assets/{MoreVert-CRSB-gtE.js → MoreVert-DLy2w-Ib.js} +1 -1
- package/dist/assets/{OpenInNew-nb9brzvh.js → OpenInNew-XVhTNbF5.js} +1 -1
- package/dist/assets/{Refresh-DpCUQ-hQ.js → Refresh-D39GYnGD.js} +1 -1
- package/dist/assets/{Search-Caj8zEyB.js → Search-BRG28-bq.js} +1 -1
- package/dist/assets/{Stepper-xU4PwGHV.js → Stepper-D3o-ipys.js} +1 -1
- package/dist/assets/{Switch-Cr0eK23s.js → Switch-BLUHXgom.js} +1 -1
- package/dist/assets/{TableSearch-BVy-Zwre.js → TableSearch-Cuohy6oG.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-DfdLS7WR.js → ToggleButtonGroup-C6GsXzIq.js} +1 -1
- package/dist/assets/{Verified-QBG89RkJ.js → Verified-Sbsjq85f.js} +1 -1
- package/dist/assets/{VerifiedUser-DRV2TIup.js → VerifiedUser-BYFzI6ca.js} +1 -1
- package/dist/assets/{ViewList-D3SEslCd.js → ViewList-BPHxMt8z.js} +1 -1
- package/dist/assets/{_createAggregator-C1jyyLx1.js → _createAggregator-DroWaLq8.js} +1 -1
- package/dist/assets/{actions-PgvlZmiV.js → actions-CRcVnE0o.js} +1 -1
- package/dist/assets/{actions-BhT4KCkB.js → actions-pGu7rB8t.js} +1 -1
- package/dist/assets/{agreement-DA33xTFi.js → agreement-uOUtZf-O.js} +1 -1
- package/dist/assets/api-rtaXucQX.js +1 -0
- package/dist/assets/{appearance-BPq1UJTg.js → appearance-uCnPBecX.js} +1 -1
- package/dist/assets/{ar-CPI6kJBB.js → ar-DGfbWcRb.js} +1 -1
- package/dist/assets/{audit-logs-Ctg35AJy.js → audit-logs-Betoa8v-.js} +2 -2
- package/dist/assets/{base-chart-Dx4PwDO4.js → base-chart-CU08SDh8.js} +1 -1
- package/dist/assets/{blocklet-CdI4-ak7.js → blocklet-CE5XgbbR.js} +1 -1
- package/dist/assets/chain-fyEjDjKA.js +6 -0
- package/dist/assets/{click-to-copy-C8Sc78ZH.js → click-to-copy-DBwd2qVy.js} +1 -1
- package/dist/assets/client-BqXjUJmr.js +1 -0
- package/dist/assets/cloneDeep-_TP0P9Bh.js +1 -0
- package/dist/assets/{collapse-BmNnb9sz.js → collapse-DYizojFh.js} +1 -1
- package/dist/assets/config-navigation-DdVCj7lN.js +457 -0
- package/dist/assets/{connect-to-DfZIDYiw.js → connect-to-BHJ6ZISO.js} +5 -5
- package/dist/assets/{cssMode-BF4q4okU.js → cssMode-BoRMkbtc.js} +1 -1
- package/dist/assets/{de-DXdF82Jr.js → de-DGZI-Bsh.js} +1 -1
- package/dist/assets/{delete-confirm-D-z4OiCT.js → delete-confirm-CEQXI_Kb.js} +1 -1
- package/dist/assets/{depsEqual-Cr14y622.js → depsEqual-ciSeh1BA.js} +1 -1
- package/dist/assets/{detail-DST4nwih.js → detail-jVJpntfg.js} +3 -3
- package/dist/assets/{domains-DrwaxbvS.js → domains-B4zPTt82.js} +1 -1
- package/dist/assets/{download-OPjh7Dhu.js → download-DbzpWKEp.js} +1 -1
- package/dist/assets/{edit.svg-BhoBkiKe.js → edit.svg-CUba2Jvc.js} +1 -1
- package/dist/assets/emotion-cache.browser.esm-Btm_v21f.js +1 -0
- package/dist/assets/engine-DvqNxRv5.js +1 -0
- package/dist/assets/{es-Cdb297yS.js → es-CMwFpp7C.js} +1 -1
- package/dist/assets/{fr-CQValz_y.js → fr-eKsI9Vcp.js} +1 -1
- package/dist/assets/{freemarker2-CsYcx0mG.js → freemarker2-BNa_PMdu.js} +1 -1
- package/dist/assets/{get-safe-url-D4QANS7R.js → get-safe-url-BKVSUfZ3.js} +1 -1
- package/dist/assets/getValidReactChildren-pQYfZHaB.js +1 -0
- package/dist/assets/{graphqlMode-CEuXGwU0.js → graphqlMode-BLg3m8OF.js} +2 -2
- package/dist/assets/{handlebars-UHGxvaSD.js → handlebars-CdbDI-cc.js} +1 -1
- package/dist/assets/{hi-CAensap9.js → hi-C0JqybmN.js} +1 -1
- package/dist/assets/{html-C1vTBkRn.js → html-BvZdPiaT.js} +1 -1
- package/dist/assets/{html-title-CMu--CLy.js → html-title-BHx37gaF.js} +1 -1
- package/dist/assets/{htmlMode-BggN4Rb6.js → htmlMode-B7CW9X1N.js} +1 -1
- package/dist/assets/{id-6AFgcYKj.js → id-DHF6PX-M.js} +1 -1
- package/dist/assets/{iframe-CvI--k7K.js → iframe-BeqfTz4i.js} +1 -1
- package/dist/assets/{index-gXZxZJIx.js → index-1S2JWh7l.js} +1 -1
- package/dist/assets/{index-BwjlL2Kh.js → index-2e0gieTu.js} +1 -1
- package/dist/assets/{index-gFJpaRWb.js → index-2mNTnhuF.js} +1 -1
- package/dist/assets/{index-PupDr-tS.js → index-3kgC1Nym.js} +1 -1
- package/dist/assets/{index-fVX8tL-Q.js → index-6GBe1q15.js} +3 -3
- package/dist/assets/{index-JPRaNDiB.js → index-7AUqhPuK.js} +1 -1
- package/dist/assets/{index-DN15vW-d.js → index-9VZ-yso9.js} +1 -1
- package/dist/assets/{index-CJBx_cpm.js → index-B4634Y1P.js} +1 -1
- package/dist/assets/{index-BcZW_Njr.js → index-B8K3eja9.js} +1 -1
- package/dist/assets/{index-e4cQdlVT.js → index-BBKncSQI.js} +1 -1
- package/dist/assets/{index-CcPSAXJC.js → index-BBwTny8t.js} +1 -1
- package/dist/assets/{index-COelK26a.js → index-BD-zoT5J.js} +4 -4
- package/dist/assets/{index-6cB3i_74.js → index-BJTXvu7V.js} +1 -1
- package/dist/assets/{index-zmLURVwA.js → index-BNgNadZA.js} +1 -1
- package/dist/assets/{index-KlyXfxtH.js → index-BTth0Avx.js} +1 -1
- package/dist/assets/{index-Cjda8MxV.js → index-BYmI15t3.js} +1 -1
- package/dist/assets/{index-CaVHeI69.js → index-BcIr2X1S.js} +34 -34
- package/dist/assets/{index-CIYlTEmt.js → index-BfwrW--S.js} +1 -1
- package/dist/assets/{index-D_HvYLZX.js → index-BhYH8ghA.js} +2 -2
- package/dist/assets/{index-D2gjCQvJ.js → index-BkGSdfE5.js} +3 -3
- package/dist/assets/{index-hwjSVkr9.js → index-BoBJzeiT.js} +1 -1
- package/dist/assets/{index-DVP4mis5.js → index-CKQB1o8K.js} +1 -1
- package/dist/assets/{index-Cfv8rye0.js → index-CKjp5Lom.js} +1 -1
- package/dist/assets/{index-CIUJRz-P.js → index-CUrsgDRV.js} +1 -1
- package/dist/assets/{index-BEUFNuBP.js → index-CX3EW1PD.js} +1 -1
- package/dist/assets/{index-oN0VLX7B.js → index-Ca0ZcUgz.js} +1 -1
- package/dist/assets/{index-B1mp7zTp.js → index-Cgo1ijTq.js} +1 -1
- package/dist/assets/{index-BrouHktD.js → index-Cl5-xO-O.js} +1 -1
- package/dist/assets/{index-B8SKOyVZ.js → index-CxTqh5oG.js} +1 -1
- package/dist/assets/{index-DlumR6-r.js → index-CzWTJYeS.js} +1 -1
- package/dist/assets/{index-BCjznEDD.js → index-D7lzrhp6.js} +215 -215
- package/dist/assets/{index-DJt0P9UZ.js → index-D9c_n0Zn.js} +1 -1
- package/dist/assets/{index-TD9tpMf3.js → index-DKLXZtmN.js} +1 -1
- package/dist/assets/{index-BNMMf79b.js → index-DZdX_ov1.js} +1 -1
- package/dist/assets/{index-BcCAYOEg.js → index-DfljrMq-.js} +1 -1
- package/dist/assets/{index-Cbv8PaaQ.js → index-DleR_te_.js} +1 -1
- package/dist/assets/{index-UUvY9lTK.js → index-GpweUAuu.js} +1 -1
- package/dist/assets/{index-DxswKF4l.js → index-KviLu8sL.js} +1 -1
- package/dist/assets/{index-CXFs83DK.js → index-OaoSeey4.js} +3 -3
- package/dist/assets/{index-CwJTlpdS.js → index-Zsmw8O9i.js} +2 -2
- package/dist/assets/{index-DWNLuD8k.js → index-g1FfUVZs.js} +3 -3
- package/dist/assets/index-h4tM9WQ3.js +1 -0
- package/dist/assets/{index-C5Qu9Vfw.js → index-mURPOBxV.js} +1 -1
- package/dist/assets/{index-BVkuT-iA.js → index-nbDfygKJ.js} +9 -9
- package/dist/assets/{index-DFNWDU08.js → index-vZ0X00a7.js} +1 -1
- package/dist/assets/{index.esm-BMMBbvkk.js → index.esm-BJXte6-L.js} +1 -1
- package/dist/assets/{install-from-url-BVVKjfjP.js → install-from-url-CtLp7MLy.js} +1 -1
- package/dist/assets/{invitation-COAlxja2.js → invitation-DQv8HAq6.js} +1 -1
- package/dist/assets/{is-path-prefix-equal-DXaCbZpO.js → is-path-prefix-equal-BIFyL0Ru.js} +1 -1
- package/dist/assets/{item-C-IQVzix.js → item-DimcdRAg.js} +9 -9
- package/dist/assets/{ja-D59y1sZ9.js → ja-c-6MaUg1.js} +1 -1
- package/dist/assets/{javascript-Bgq9DttZ.js → javascript-CwbxIHEQ.js} +1 -1
- package/dist/assets/{jsonMode-gicj4lsZ.js → jsonMode-DLbgXAH0.js} +1 -1
- package/dist/assets/{ko-DlSyClni.js → ko-CTFi4Ndk.js} +1 -1
- package/dist/assets/{liquid-Ci2GleTa.js → liquid-q1OjFgE0.js} +1 -1
- package/dist/assets/{list-header-Bimu_qjE.js → list-header-BB26rDnk.js} +1 -1
- package/dist/assets/{log-Do7yF-hd.js → log-C6UozWKv.js} +1 -1
- package/dist/assets/{lottie-react.esm-DfMKPb7z.js → lottie-react.esm-SyXHnE8o.js} +1 -1
- package/dist/assets/{mdx-eB0FmO6P.js → mdx-DHgnA-tS.js} +1 -1
- package/dist/assets/{memory-BCE6QiNB.js → memory-YxMv8BQK.js} +1 -1
- package/dist/assets/{metric-Bk0iXTai.js → metric-DreAuOrl.js} +1 -1
- package/dist/assets/omit-Cqu-CgYq.js +1 -0
- package/dist/assets/{overview-DltjzkWj.js → overview-DUGPpH_y.js} +1 -1
- package/dist/assets/{permission-nS6Be9Zz.js → permission-BcnxfENO.js} +1 -1
- package/dist/assets/{preference-BcV3F-Xa.js → preference-YGKAVWVr.js} +3 -3
- package/dist/assets/{pt-C_3CX1PR.js → pt-QkdDdQuw.js} +1 -1
- package/dist/assets/{python-EI0UxD3D.js → python-BI4r0Wbo.js} +1 -1
- package/dist/assets/{raf-schd.esm-D8Xvrzgn.js → raf-schd.esm-DiR_lSIX.js} +1 -1
- package/dist/assets/{razor-BSy3NnVc.js → razor-BY4SRdR7.js} +1 -1
- package/dist/assets/{rotate-session-key-6xIXKXc3.js → rotate-session-key-CRqisNwo.js} +1 -1
- package/dist/assets/{ru-FBGLUlo5.js → ru-swMH4bvc.js} +1 -1
- package/dist/assets/{runtime-Dxydq6o1.js → runtime-BANAk_eI.js} +1 -1
- package/dist/assets/schema-_5vI79Rv.js +1 -0
- package/dist/assets/sdk-D1MrqeFi.js +1 -0
- package/dist/assets/{service-BiVWc9jf.js → service-XYcHOpXT.js} +1 -1
- package/dist/assets/{shorten-label-1yenXb9Y.js → shorten-label-C2TvZwiB.js} +1 -1
- package/dist/assets/{simple-select-Bt3Ltwm7.js → simple-select-5PaLI5iC.js} +1 -1
- package/dist/assets/{spaces-BnSCxjeY.js → spaces-BjltrgOM.js} +1 -1
- package/dist/assets/{status-CXAtxXK1.js → status-BGZp6E2_.js} +1 -1
- package/dist/assets/{status-BYLk6wlC.js → status-BId3C3tR.js} +1 -1
- package/dist/assets/{switch-control-D5SPzkUx.js → switch-control-93IAc2BI.js} +1 -1
- package/dist/assets/{table-icons-BGs1mthN.js → table-icons--cM-zbAz.js} +1 -1
- package/dist/assets/{team-BlgLSbQd.js → team-D9qX7mGm.js} +1 -1
- package/dist/assets/{th-DmSMYMH5.js → th-DuqieD90.js} +1 -1
- package/dist/assets/{toLower-BiqFoOo1.js → toLower-DdXVIYtI.js} +1 -1
- package/dist/assets/toUpper-BZzsNTfW.js +1 -0
- package/dist/assets/{traffic-d8ue0hO5.js → traffic-CQiQ0sPg.js} +1 -1
- package/dist/assets/{tsMode-DFSmR0ZD.js → tsMode-riDB0Svo.js} +1 -1
- package/dist/assets/{typescript-Dvh-IrHb.js → typescript-DevS6KNa.js} +1 -1
- package/dist/assets/{url-evaluation-DFEEqTh-.js → url-evaluation-BZtvoS6V.js} +1 -1
- package/dist/assets/{url-join-Dra-Zi4G.js → url-join-15mVE4xQ.js} +1 -1
- package/dist/assets/{use-mobile-FV0M1ZqW.js → use-mobile-C3Kt9jiO.js} +1 -1
- package/dist/assets/{use-mobile-BOq_qktK.js → use-mobile-C3R5m8C9.js} +1 -1
- package/dist/assets/{useAsync-B7FuCRJD.js → useAsync-CnNdbLcF.js} +1 -1
- package/dist/assets/{useAsyncRetry-C1rqgcS3.js → useAsyncRetry-CKdA5B4J.js} +1 -1
- package/dist/assets/{useLocalStorage-BjyUhOL-.js → useLocalStorage-BacdU7Dw.js} +1 -1
- package/dist/assets/{useThemeProps-BZz8f5dF.js → useThemeProps-DoaWGRR_.js} +1 -1
- package/dist/assets/{util-vH7l3iJe.js → util-BTYi57HE.js} +1 -1
- package/dist/assets/{vi-CjDg6MoB.js → vi-42QzvOuM.js} +1 -1
- package/dist/assets/{wait-container-4i1AkyPx.js → wait-container-Cf2fBIo1.js} +1 -1
- package/dist/assets/{without-wallet-CG4TWMeN.js → without-wallet-BmXN4c0R.js} +1 -1
- package/dist/assets/wrap-locale-CRCmG_2i.js +1 -0
- package/dist/assets/{xml-7zq5MXwn.js → xml-DkReoolA.js} +1 -1
- package/dist/assets/{yaml-DdyDZl-6.js → yaml-D5EuAiQc.js} +1 -1
- package/dist/assets/{zh-DaR6QxjC.js → zh-C-k4DKK-.js} +1 -1
- package/dist/assets/{zh-tw-DaxtX1HY.js → zh-tw-Dxa4oubT.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +1 -1
- package/dist/assets/ArrowDropDown-B9aDIKPi.js +0 -1
- package/dist/assets/api-BMlRo0OB.js +0 -1
- package/dist/assets/chain-CXX76TQL.js +0 -6
- package/dist/assets/client-ChcYsV1G.js +0 -1
- package/dist/assets/cloneDeep-CQZK-s_V.js +0 -1
- package/dist/assets/config-navigation-8rTODeF1.js +0 -457
- package/dist/assets/emotion-cache.browser.esm-JDbaITlA.js +0 -1
- package/dist/assets/engine-siiM_CrH.js +0 -1
- package/dist/assets/getValidReactChildren-BK9M6ULL.js +0 -1
- package/dist/assets/index-ee21MdrR.js +0 -1
- package/dist/assets/omit-DZngMfUZ.js +0 -1
- package/dist/assets/schema-BYsNslfD.js +0 -1
- package/dist/assets/sdk-BLZzaYH6.js +0 -1
- package/dist/assets/toUpper-BMdlX8ly.js +0 -1
- package/dist/assets/wrap-locale-CCw957fx.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{bX as Ge,bW as Fe,r as h,bY as Ke,j as e,b8 as ee,b_ as $e,cb as J,b$ as Ye,bU as qe,cd as He,aG as he,O as H,bn as A,cq as Ce,H as B,Y as V,bf as E,fC as we,aQ as Be,b as N,i$ as Ve,m as D,gA as Qe,o as m,x as Xe,ax as De,y as fe,al as Ze,g as Je,C as U,T as j,i as et,s as tt,f as st,j0 as X,hY as Z,j1 as ot,N as S,aV as G,E as T,L as nt,p as q,dk as at,az as Se,U as K,aF as $,a9 as Y,a5 as rt,dH as it,gq as ct,a$ as lt,v as pe,w as dt,G as be,Z as Ee,by as xe,B as pt}from"./index-BCjznEDD.js";import{T as ut}from"./html-title-CMu--CLy.js";import{u as L}from"./blocklet-CdI4-ak7.js";import{u as mt}from"./use-mobile-FV0M1ZqW.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-DfZIDYiw.js";import"./index-Cjda8MxV.js";import"./index-BojVbZw0.js";import"./api-BMlRo0OB.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-BnSCxjeY.js";import{v as Rt}from"./index-CcPSAXJC.js";import{E as zt}from"./index-JPRaNDiB.js";import{H as vt}from"./HelpOutline-BIIJduw6.js";import{H as Pt}from"./index-zmLURVwA.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Ut}from"./actions-BhT4KCkB.js";import{D as Lt}from"./DeleteOutline-BQz9po9Q.js";import{g as ke}from"./get-safe-url-D4QANS7R.js";import{S as Ot}from"./switch-control-D5SPzkUx.js";import{L as je}from"./list-header-Bimu_qjE.js";import"./OpenInNew-nb9brzvh.js";import"./ButtonGroup-88wnT1Nl.js";import"./getValidReactChildren-BK9M6ULL.js";import"./FilterList-DOLZBYMl.js";import"./CSSTransition-BhKCAa_k.js";import"./emotion-cache.browser.esm-JDbaITlA.js";import"./index-DVP4mis5.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-Cr14y622.js";import"./index-BNMMf79b.js";import"./TableSearch-BVy-Zwre.js";import"./Search-Caj8zEyB.js";import"./Clear-vz3__EK4.js";import"./MoreVert-CRSB-gtE.js";import"./useLocalStorage-BjyUhOL-.js";import"./url-evaluation-DFEEqTh-.js";import"./permission-nS6Be9Zz.js";import"./Switch-Cr0eK23s.js";function Mt(t){return Ge("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${J(s)}`,`fontSize${J(n)}`]};return Ye(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${J(n.color)}`],s[`fontSize${J(n.fontSize)}`]]}})(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=Ke({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Gt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Ft=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Kt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(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}=L(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Kt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=L(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function qt({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=L(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}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:Ys}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=L(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),f=Qe(d),x=Yt({appDid:o?.appDid}),u=h.useMemo(()=>wt(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===u)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),u!==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===u;return e.jsx(Ht,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=L(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=L(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Je),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(U,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
|
|
2
|
-
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(zt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(G,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ue({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(U,{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(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ue.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function Le({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"})})})]})}Le.propTypes={metadata:m.object};function Oe(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:f}=o[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,u=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return u?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(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:f,metadata:x}=d,u=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!u,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!u;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(U,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Le,{metadata:x}):e.jsx(Ue,{status:l,message:p,createdAt:f})}}}],[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(Pt,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(f,x)=>{f?.preventDefault(),f?.stopPropagation(),a(x)},l=async f=>{try{f?.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=f=>{d(f,!1),n?.(f)};return e.jsxs(e.Fragment,{children:[e.jsxs(K,{color:"red",onClick:f=>d(f,!0),children:[e.jsx($,{style:{minWidth:24,color:"red"},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx(Y,{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:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[f,x]=h.useState(!1),u=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),u(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),u(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[f||t?.loading?e.jsx(U,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>u(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>u(y,!1),children:[e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx(Y,{children:p("common.open")})]}),e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(K,{onClick:k,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(K,{onClick:w,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool,endpoint:m.string.isRequired,loading:m.bool}).isRequired,selected:m.bool.isRequired,enableSwitchToSpace:m.bool,onDelete:m.func,onConnect:m.func,backupInProgress:m.bool};const Jt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=L(),{api:l,info:{did:p}}=A(),{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,F=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),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:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(U,{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:F})]})}_e.propTypes={spaceGateway:m.shape({did:m.string.isRequired,name:m.string.isRequired,url:m.string.isRequired,endpoint:m.string.isRequired,protected:m.bool,loading:m.bool}).isRequired,spaceStatus:m.string.isRequired,selected:m.bool.isRequired,onConnected:m.func,onDeleted:m.func,onBackedUp:m.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=O(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=O(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(U,{})}):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(ht,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(U,{})}):H(s)?e.jsx(Zt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=yt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(U,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(kt,{}),e.jsx(S,{sx:c,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(St,{children:[e.jsxs(G,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=L(),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],u=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const me=ee(S)`
|
|
1
|
+
import{bX as Ge,bW as Fe,r as h,bY as Ke,j as e,b8 as ee,b_ as Ye,cb as J,b$ as $e,bU as He,cd as qe,aG as he,O as q,bn as A,cq as Ce,H as B,Y as V,bf as E,fB as we,aQ as Be,b as N,j1 as Ve,m as D,gz as Qe,o as m,x as Xe,ax as De,y as fe,al as Ze,g as Je,C as U,T as j,i as et,s as tt,f as st,j2 as X,hY as Z,j3 as ot,N as S,aV as G,E as T,L as nt,p as H,dk as at,az as Se,U as K,aF as Y,a9 as $,a5 as rt,dH as it,gp as ct,a$ as lt,v as pe,w as dt,G as be,Z as Ee,by as xe,B as pt}from"./index-D7lzrhp6.js";import{T as ut}from"./html-title-BHx37gaF.js";import{u as L}from"./blocklet-CE5XgbbR.js";import{u as mt}from"./use-mobile-C3Kt9jiO.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-BHJ6ZISO.js";import"./index-BYmI15t3.js";import"./index-BojVbZw0.js";import"./api-rtaXucQX.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-BjltrgOM.js";import{v as Rt}from"./index-BBwTny8t.js";import{E as zt}from"./index-7AUqhPuK.js";import{H as vt}from"./HelpOutline-Ba2mBnVG.js";import{H as Pt}from"./index-BNgNadZA.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Ut}from"./actions-pGu7rB8t.js";import{D as Lt}from"./DeleteOutline-CdS_T1n7.js";import{g as ke}from"./get-safe-url-BKVSUfZ3.js";import{S as Ot}from"./switch-control-93IAc2BI.js";import{L as je}from"./list-header-BB26rDnk.js";import"./OpenInNew-XVhTNbF5.js";import"./ButtonGroup-Ca-yV-4C.js";import"./getValidReactChildren-pQYfZHaB.js";import"./FilterList-oCTR8mcc.js";import"./CSSTransition-BtkiOWZC.js";import"./emotion-cache.browser.esm-Btm_v21f.js";import"./index-CKQB1o8K.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-ciSeh1BA.js";import"./index-DZdX_ov1.js";import"./TableSearch-Cuohy6oG.js";import"./Search-BRG28-bq.js";import"./Clear-CfUqGbT5.js";import"./MoreVert-DLy2w-Ib.js";import"./useLocalStorage-BacdU7Dw.js";import"./url-evaluation-BZtvoS6V.js";import"./permission-BcnxfENO.js";import"./Switch-BLUHXgom.js";function Mt(t){return Ge("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${J(s)}`,`fontSize${J(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${J(n.color)}`],s[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ke({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Gt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Ft=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Kt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:s}=L(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Kt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=L(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=L(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:qt,Consumer:$s}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=L(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),f=Qe(d),x=$t({appDid:o?.appDid}),u=h.useMemo(()=>wt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=Ht({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===u)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),u!==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===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=L(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=L(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Je),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(U,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
|
|
2
|
+
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(zt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(G,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ue({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(U,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):i?e.jsx(H,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ue.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function Le({metadata:t={}}){const{t:s}=D();if(q(t))return e.jsx(H,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=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(H,{type:"success",children:s("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Le.propTypes={metadata:m.object};function Oe(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:f}=o[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,u=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return u?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(H,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>q(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=o?.[i]??{},{status:l,message:p,createdAt:f,metadata:x}=d,u=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!u,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!u;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(U,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Le,{metadata:x}):e.jsx(Ue,{status:l,message:p,createdAt:f})}}}],[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(Pt,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(f,x)=>{f?.preventDefault(),f?.stopPropagation(),a(x)},l=async f=>{try{f?.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=f=>{d(f,!1),n?.(f)};return e.jsxs(e.Fragment,{children:[e.jsxs(K,{color:"red",onClick:f=>d(f,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[f,x]=h.useState(!1),u=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),u(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),u(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[f||t?.loading?e.jsx(U,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>u(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>u(y,!1),children:[e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx($,{children:p("common.open")})]}),e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(K,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(K,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool,endpoint:m.string.isRequired,loading:m.bool}).isRequired,selected:m.bool.isRequired,enableSwitchToSpace:m.bool,onDelete:m.func,onConnect:m.func,backupInProgress:m.bool};const Jt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=L(),{api:l,info:{did:p}}=A(),{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,F=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),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:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(U,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:F})]})}_e.propTypes={spaceGateway:m.shape({did:m.string.isRequired,name:m.string.isRequired,url:m.string.isRequired,endpoint:m.string.isRequired,protected:m.bool,loading:m.bool}).isRequired,spaceStatus:m.string.isRequired,selected:m.bool.isRequired,onConnected:m.func,onDeleted:m.func,onBackedUp:m.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=O(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=O(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(U,{})}):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(ht,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(U,{})}):q(s)?e.jsx(Zt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=yt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(U,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(kt,{}),e.jsx(S,{sx:c,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(St,{children:[e.jsxs(G,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=L(),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],u=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const me=ee(S)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
5
5
|
overflow: hidden;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{aG as qe,j as e,dr as js,gw as ws,ir as _s,m as ce,bn as ye,N as O,az as je,H as V,o as g,f as gt,r as R,g as we,bA as st,b as Ce,J as ee,X as Bn,bz as ft,Y as xe,is as Ss,t as ve,s as oe,a4 as me,aV as oo,T as le,$ as Yt,dG as mt,y as ke,b8 as Es,bE as ks,E as H,b1 as Rs,gj as Ts,gk as Ps,C as be,f4 as so,hx as qn,x as Is,ax as Gt,w as Ds,it as Bs,iu as Os,v as Be,iv as Us,Z as Ns,a0 as Ls,iw as io,bo as ao,U as Ne,f7 as As,f1 as Ms,aB as zs,aC as qs,bk as Fs,aD as $s,aE as fe,aO as Ws,cN as Hs,S as Gs,eN as or,bi as Ks,h as Vs,dv as It,ix as Ys,g2 as lo,iy as Zs,iz as Qs,ey as pe,iA as co,dE as Xs,gN as Js,hb as ei,fS as ti,iB as ni,cE as sr,hs as Fn,av as ri,dH as Zt,dn as Me,bq as oi,br as ir,z as uo,cq as si,G as ze,aP as ar,fP as po,cr as Ke,h7 as ii,by as kt,hA as ai,fm as lr,bg as li,L as xt,F as fo,bm as ci,_ as di,O as Rt,aZ as $n,iC as ui,a_ as Le,aA as cr,cL as pi,ad as it,aM as mo,bS as Wn,cw as fi,iD as mi,b9 as hi,A as ho,aU as On,p as gi,aS as ut,P as un,W as xi,bB as go,aJ as yi,bt as vi,aR as Ci,fd as dr,iE as ur,gG as pr,V as fr,cK as bi,gE as ji,bR as wi,iF as _i}from"./index-BCjznEDD.js";import{y as Si}from"./index-BNMMf79b.js";import{a as Ei,c as ki,d as Ri,u as Hn,R as Ti}from"./actions-BhT4KCkB.js";import{S as Pi}from"./switch-control-D5SPzkUx.js";import{u as De}from"./blocklet-CdI4-ak7.js";import{P as Un,w as Qt}from"./permission-nS6Be9Zz.js";import{E as xo}from"./Edit-ZWYQTIT_.js";import{T as Ii,M as Di,t as Bi}from"./table-icons-BGs1mthN.js";import{s as Oi,F as yo,L as Ui,I as Ni,a as Tt,S as Li,B as Ai}from"./preference-BcV3F-Xa.js";import{C as mr}from"./click-to-copy-C8Sc78ZH.js";import{v as pn}from"./index-Cjda8MxV.js";import{A as Mi}from"./Add-7-eXJOKT.js";import{A as Xt}from"./Link-D0HMFRxo.js";import{C as zi,c as qi,b as Fi,f as vo,A as $i,_ as Wi,a as Hi,e as Gi,d as Co,s as Ki,L as Vi,u as Yi,g as Zi,S as Qi}from"./item-C-IQVzix.js";import{T as Xi,L as Ji,a as Nn,u as hr,W as ea,P as ta}from"./index-gFJpaRWb.js";import{e as bo}from"./engine-siiM_CrH.js";import{u as na,C as ra,D as oa,a as sa,b as ia}from"./connect-to-DfZIDYiw.js";import{C as aa,u as la,A as ca}from"./agreement-DA33xTFi.js";import{A as da,a as ua,b as pa,c as fa,R as ot,S as dt}from"./collapse-BmNnb9sz.js";import{D as jo}from"./Done-Bk5S0dZ-.js";import{C as ma,a as ha}from"./Google-DjCWLWBZ.js";import{I as wo,f as ga,a as xa,B as ya}from"./install-from-url-BVVKjfjP.js";import{a as gr}from"./api-BMlRo0OB.js";import{v as _o,e as va,a as Kt}from"./util-vH7l3iJe.js";import{u as So}from"./use-mobile-FV0M1ZqW.js";import{A as Ca}from"./ArrowDropDown-B9aDIKPi.js";import{u as ba}from"./useLocalStorage-BjyUhOL-.js";import{r as Jt}from"./index-TD9tpMf3.js";import{b as en}from"./without-wallet-CG4TWMeN.js";import{E as Eo}from"./ErrorOutline-CWTup7vD.js";import{H as ja}from"./HelpOutline-BIIJduw6.js";import{D as tn,W as ht,R as wa,a as xr}from"./url-evaluation-DFEEqTh-.js";import{L as ko}from"./Launch-DOQcWt9h.js";import{D as _a}from"./delete-confirm-D-z4OiCT.js";import{B as Ro}from"./status-CXAtxXK1.js";import{A as To}from"./actions-PgvlZmiV.js";import{v as fn}from"./index-CcPSAXJC.js";import{t as Sa}from"./toUpper-BMdlX8ly.js";import{S as Ea}from"./Switch-Cr0eK23s.js";import{a as ka}from"./team-BlgLSbQd.js";import"./MoreVert-CRSB-gtE.js";import"./get-safe-url-D4QANS7R.js";import"./ButtonGroup-88wnT1Nl.js";import"./getValidReactChildren-BK9M6ULL.js";import"./FilterList-DOLZBYMl.js";import"./CSSTransition-BhKCAa_k.js";import"./emotion-cache.browser.esm-JDbaITlA.js";import"./index-DBii9-f-.js";import"./typeof-QjJsDpFa.js";import"./raf-schd.esm-D8Xvrzgn.js";import"./redux-DfszZyTl.js";import"./useThemeProps-BZz8f5dF.js";import"./html-title-CMu--CLy.js";import"./Clear-vz3__EK4.js";import"./ChevronRight-Dh1NhSQh.js";import"./ChevronLeft-DsCa_2Hj.js";import"./Search-Caj8zEyB.js";import"./omit-DZngMfUZ.js";import"./edit.svg-BhoBkiKe.js";import"./index-hwjSVkr9.js";import"./iframe-CvI--k7K.js";import"./Verified-QBG89RkJ.js";import"./Autocomplete-CWbaCMBc.js";import"./ListSubheader-OXmzqw9E.js";import"./VerifiedUser-DRV2TIup.js";import"./DeleteOutline-BQz9po9Q.js";import"./url-join-Dra-Zi4G.js";import"./index-BojVbZw0.js";import"./spaces-BnSCxjeY.js";import"./OpenInNew-nb9brzvh.js";import"./index-DRYJ0xIl.js";import"./index-6cB3i_74.js";import"./decode-DPztD6kB.js";import"./cloneDeep-CQZK-s_V.js";import"./ListItemButton-hdq-8LOD.js";import"./Stepper-xU4PwGHV.js";import"./is-path-prefix-equal-DXaCbZpO.js";const Ra=qe(e.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),Ta=qe(e.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"})),Po=qe(e.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"})),Pa=qe(e.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"})),Io=qe(e.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),Ia=qe(e.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"})),Da=qe(e.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),Ba=qe(e.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),Oa=qe(e.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 yr(t,r){var n={};return r=js(r),ws(t,function(i,a,s){_s(n,a,r(i,a,s))}),n}function Do({children:t=null,...r}){const{t:n}=ce(),{api:i}=ye(),{blocklet:a}=De(),s=a?.settings?.autoCheckUpdate,m=async l=>{await i.updateAutoCheckUpdate({input:{did:a.meta.did,autoCheckUpdate:l}})},c=async()=>{try{const l=!s?.enabled;await m({enabled:l}),V.success(n(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){V.error(l.message)}},d=!!s?.enabled;return e.jsxs(O,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t,e.jsx(je,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:e.jsx("div",{children:e.jsx(Pi,{checked:d,onChange:c,name:"enableWelcomePage",style:{...r.style,zoom:.8}})})})]})}Do.propTypes={children:g.any};function vr(t){function r({sx:n,...i}){return e.jsx(t,{...i,sx:{color:"text.primary",...n}})}return r}const Ua={...yr(Bi,vr),...yr(Ei,vr)},Na=(t,r)=>{let{description:n}=t;return(Object.values(Ce.CHAIN_PROP_MAP).includes(t.key)||ee.isEnvShareable(t))&&(n?n=`${n} (${r("blocklet.config.sharedToAllComponents")})`:n=r("blocklet.config.sharedToAllComponents")),n&&e.jsx("div",{style:{marginLeft:12},children:n})},mn=(t,r,n=[])=>!n?.length&&!t.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(t.key)&&!r.meta.environments.find(i=>i.name===t.key)&&r.children.every(i=>!i.meta.environments.find(a=>a.name===t.key))?!0:t.custom,Cr=t=>[Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(t)?!0:!(t.startsWith("BLOCKLET_")||t.startsWith("COMPONENT_")),hn=t=>[Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(t)===!1;function Bo({blocklet:t,ancestors:r=[]}){const n=ye(),{palette:i}=gt(),{inService:a}=n,{t:s}=R.useContext(we),m=[...r.map(o=>o.meta.did),t.meta.did],c=()=>V.success(s("blocklet.config.changedTip")),d=o=>mn(o,t,r);if(st(t.status)||t.status==="unknown"&&st(t.status))return null;const l=o=>new Promise(async(h,b)=>{if(!o.key.trim()||!o.value.trim()){V.error(s("blocklet.config.environment.keyValueRequired")),b();return}if(Cr(o.key)===!1){V.error(s("blocklet.config.environment.invalidKey")),b();return}o.custom=hn(o.key);try{const T=await n.api.configBlocklet({input:{did:m,configs:[o]}});c(T.blocklet),h()}catch(T){V.error(xe(T)),b()}}),y=(o,h)=>new Promise(async(b,T)=>{if(o.required&&(!o.key.trim()||!o.value.trim())){V.error(s("blocklet.config.environment.keyValueRequired")),T();return}if(Cr(o.key)===!1){V.error(s("blocklet.config.environment.invalidKey")),T();return}if(o.key===Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const M=Ss(o);if(M){V.error(M),T();return}}const E=[{...o,value:o.secure&&o.value==="__encrypted__"?"":o.value}];if(o.key!==h.key){if(!mn(o,t,r)){V.error("Only key of custom env can be changed"),T();return}E.push({key:h.key,custom:hn(o.key)})}try{const M=await n.api.configBlocklet({input:{did:m,configs:E}});c(M.blocklet),b()}catch(M){V.error(xe(M)),T()}}),p=o=>new Promise(async(h,b)=>{if(o.required){V.error(s("blocklet.config.environment.deleteForbidden")),b();return}if(!mn(o,t,r)){V.error("Only key of custom env can be changed"),b();return}try{const T=await n.api.configBlocklet({input:{did:m,configs:[{key:o.key,custom:hn(o.key)}]}});c(T.blocklet),h()}catch(T){V.error(xe(T)),b()}}),C=(t.configs||[]).filter(o=>!Ce.BLOCKLET_CONFIGURABLE_KEY[o.key]||[Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(o.key)),f=ee.getSharedConfigObj(r[0],t),x=ee.getComponentMissingConfigs(t,r[0]),_=C.map(o=>({...o,value:Object.values(Ce.CHAIN_PROP_MAP).includes(o.key)&&Object.keys(f).includes(o.key)?f[o.key]:f[o.key]||o.value})),w=_.some(o=>o.key&&o.key.startsWith("BWA_")),S={onRowAdd:l,onRowUpdate:y,onRowDelete:p,isDeletable:d},u=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:o=>e.jsx(mr,{value:o.value,style:{color:o.required&&!o.value?i.error.main:i.text.primary,fontWeight:o.required?"bold":"normal"},children:o.key}),editComponent:o=>{const{value:h,rowData:b,onChange:T}=o;return e.jsx(br,{children:e.jsx(ve,{fullWidth:!0,size:"small",value:Oi.escapeTag(h),onChange:E=>T(E.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0,slotProps:{input:{readOnly:d(b)===!1}}})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:o=>o.value?o.secure?"******":e.jsx(mr,{unstyled:!0,value:o.value,style:{wordBreak:"break-all"},children:o.value}):null,editComponent:o=>{const{value:h,rowData:b,onChange:T}=o;return e.jsxs(br,{children:[e.jsx(ve,{fullWidth:!0,size:"small",value:h==="__encrypted__"?"":h,onChange:E=>T(E.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Na(b,s)]})}}];return e.jsxs(La,{children:[!!x.length&&e.jsx(Bn,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),w&&e.jsx(Bn,{severity:"info",children:s("blocklet.config.environment.tip")}),e.jsx(Un,{permission:a?"":"mutate_blocklets",role:a?ft:[],children:o=>e.jsx(Ii,{className:"config-table",children:e.jsx(Di,{title:e.jsx(O,{sx:{fontWeight:"bold"},children:s("common.environments")}),columns:u(),icons:Ua,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")}},data:_,editable:o?S:{}})})})]})}Bo.propTypes={blocklet:g.object.isRequired,ancestors:g.array};const La=oe.div`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-OaoSeey4.js","./index-D7lzrhp6.js","./index-DGkT7afN.css","./url-join-15mVE4xQ.js","./index-DKLXZtmN.js","./_createAggregator-DroWaLq8.js","./depsEqual-ciSeh1BA.js","./index-BoBJzeiT.js","./index-DRYJ0xIl.js","./toUpper-BZzsNTfW.js","./index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aG as qe,j as e,dr as js,gv as ws,it as _s,m as ce,bn as ye,N as O,az as je,H as V,o as g,f as gt,r as R,g as we,bA as st,b as Ce,J as ee,X as Bn,bz as ft,Y as xe,iu as Ss,t as ve,s as oe,a4 as me,aV as oo,T as le,$ as Yt,dG as mt,y as ke,b8 as Es,bE as ks,E as H,b1 as Rs,gi as Ts,gj as Ps,C as be,f4 as so,hv as qn,x as Is,ax as Gt,w as Ds,iv as Bs,iw as Os,v as Be,ix as Us,Z as Ns,a0 as Ls,iy as io,bo as ao,U as Ne,f6 as As,f1 as Ms,aB as zs,aC as qs,bk as Fs,aD as $s,aE as fe,aO as Ws,cN as Hs,S as Gs,eN as or,bi as Ks,h as Vs,dv as It,iz as Ys,g1 as lo,iA as Zs,iB as Qs,ey as pe,iC as co,dE as Xs,gM as Js,h9 as ei,fR as ti,iD as ni,cE as sr,hq as Fn,av as ri,dH as Zt,dn as Me,bq as oi,br as ir,z as uo,cq as si,G as ze,aP as ar,fO as po,cr as Ke,h5 as ii,by as kt,hy as ai,fl as lr,bg as li,L as xt,F as fo,bm as ci,_ as di,O as Rt,aZ as $n,iE as ui,a_ as Le,aA as cr,cL as pi,ad as it,aM as mo,bS as Wn,cw as fi,iF as mi,b9 as hi,A as ho,aU as On,p as gi,aS as ut,P as un,W as xi,bB as go,aJ as yi,bt as vi,aR as Ci,fc as dr,iG as ur,gF as pr,V as fr,cK as bi,gD as ji,bR as wi,iH as _i}from"./index-D7lzrhp6.js";import{y as Si}from"./index-DZdX_ov1.js";import{a as Ei,c as ki,d as Ri,u as Hn,R as Ti}from"./actions-pGu7rB8t.js";import{S as Pi}from"./switch-control-93IAc2BI.js";import{u as De}from"./blocklet-CE5XgbbR.js";import{P as Un,w as Qt}from"./permission-BcnxfENO.js";import{E as xo}from"./Edit-s_UOOLA4.js";import{T as Ii,M as Di,t as Bi}from"./table-icons--cM-zbAz.js";import{s as Oi,F as yo,L as Ui,I as Ni,a as Tt,S as Li,B as Ai}from"./preference-YGKAVWVr.js";import{C as mr}from"./click-to-copy-DBwd2qVy.js";import{v as pn}from"./index-BYmI15t3.js";import{A as Mi}from"./Add-BuxBWbKv.js";import{A as Xt}from"./Link-D7GjIXxD.js";import{C as zi,c as qi,b as Fi,f as vo,A as $i,_ as Wi,a as Hi,e as Gi,d as Co,s as Ki,L as Vi,u as Yi,g as Zi,S as Qi}from"./item-DimcdRAg.js";import{T as Xi,L as Ji,a as Nn,u as hr,W as ea,P as ta}from"./index-2mNTnhuF.js";import{e as bo}from"./engine-DvqNxRv5.js";import{u as na,C as ra,D as oa,a as sa,b as ia}from"./connect-to-BHJ6ZISO.js";import{C as aa,u as la,A as ca}from"./agreement-uOUtZf-O.js";import{A as da,a as ua,b as pa,c as fa,R as ot,S as dt}from"./collapse-DYizojFh.js";import{D as jo}from"./Done-BMzUfIev.js";import{C as ma,a as ha}from"./Google-RsZHy3xt.js";import{I as wo,f as ga,a as xa,B as ya}from"./install-from-url-CtLp7MLy.js";import{a as gr}from"./api-rtaXucQX.js";import{v as _o,e as va,a as Kt}from"./util-BTYi57HE.js";import{u as So}from"./use-mobile-C3Kt9jiO.js";import{A as Ca}from"./ArrowDropDown-C9tvAge6.js";import{u as ba}from"./useLocalStorage-BacdU7Dw.js";import{r as Jt}from"./index-DKLXZtmN.js";import{b as en}from"./without-wallet-BmXN4c0R.js";import{E as Eo}from"./ErrorOutline-3Uoca5Wu.js";import{H as ja}from"./HelpOutline-Ba2mBnVG.js";import{D as tn,W as ht,R as wa,a as xr}from"./url-evaluation-BZtvoS6V.js";import{L as ko}from"./Launch-Dj1HRwwB.js";import{D as _a}from"./delete-confirm-CEQXI_Kb.js";import{B as Ro}from"./status-BGZp6E2_.js";import{A as To}from"./actions-CRcVnE0o.js";import{v as fn}from"./index-BBwTny8t.js";import{t as Sa}from"./toUpper-BZzsNTfW.js";import{S as Ea}from"./Switch-BLUHXgom.js";import{a as ka}from"./team-D9qX7mGm.js";import"./MoreVert-DLy2w-Ib.js";import"./get-safe-url-BKVSUfZ3.js";import"./ButtonGroup-Ca-yV-4C.js";import"./getValidReactChildren-pQYfZHaB.js";import"./FilterList-oCTR8mcc.js";import"./CSSTransition-BtkiOWZC.js";import"./emotion-cache.browser.esm-Btm_v21f.js";import"./index-DBii9-f-.js";import"./typeof-QjJsDpFa.js";import"./raf-schd.esm-DiR_lSIX.js";import"./redux-DfszZyTl.js";import"./useThemeProps-DoaWGRR_.js";import"./html-title-BHx37gaF.js";import"./Clear-CfUqGbT5.js";import"./ChevronRight-BrTU-Laa.js";import"./ChevronLeft-zMXGyPG9.js";import"./Search-BRG28-bq.js";import"./omit-Cqu-CgYq.js";import"./edit.svg-CUba2Jvc.js";import"./index-BoBJzeiT.js";import"./iframe-BeqfTz4i.js";import"./Verified-Sbsjq85f.js";import"./Autocomplete-CWNFguFL.js";import"./ListSubheader-BNfIC8TR.js";import"./VerifiedUser-BYFzI6ca.js";import"./DeleteOutline-CdS_T1n7.js";import"./url-join-15mVE4xQ.js";import"./index-BojVbZw0.js";import"./spaces-BjltrgOM.js";import"./OpenInNew-XVhTNbF5.js";import"./index-DRYJ0xIl.js";import"./index-BJTXvu7V.js";import"./decode-DPztD6kB.js";import"./cloneDeep-_TP0P9Bh.js";import"./ListItemButton-B9OsRNX2.js";import"./Stepper-D3o-ipys.js";import"./is-path-prefix-equal-BIFyL0Ru.js";const Ra=qe(e.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),Ta=qe(e.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"})),Po=qe(e.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"})),Pa=qe(e.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"})),Io=qe(e.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),Ia=qe(e.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"})),Da=qe(e.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),Ba=qe(e.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),Oa=qe(e.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 yr(t,r){var n={};return r=js(r),ws(t,function(i,a,s){_s(n,a,r(i,a,s))}),n}function Do({children:t=null,...r}){const{t:n}=ce(),{api:i}=ye(),{blocklet:a}=De(),s=a?.settings?.autoCheckUpdate,m=async l=>{await i.updateAutoCheckUpdate({input:{did:a.meta.did,autoCheckUpdate:l}})},c=async()=>{try{const l=!s?.enabled;await m({enabled:l}),V.success(n(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){V.error(l.message)}},d=!!s?.enabled;return e.jsxs(O,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t,e.jsx(je,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:e.jsx("div",{children:e.jsx(Pi,{checked:d,onChange:c,name:"enableWelcomePage",style:{...r.style,zoom:.8}})})})]})}Do.propTypes={children:g.any};function vr(t){function r({sx:n,...i}){return e.jsx(t,{...i,sx:{color:"text.primary",...n}})}return r}const Ua={...yr(Bi,vr),...yr(Ei,vr)},Na=(t,r)=>{let{description:n}=t;return(Object.values(Ce.CHAIN_PROP_MAP).includes(t.key)||ee.isEnvShareable(t))&&(n?n=`${n} (${r("blocklet.config.sharedToAllComponents")})`:n=r("blocklet.config.sharedToAllComponents")),n&&e.jsx("div",{style:{marginLeft:12},children:n})},mn=(t,r,n=[])=>!n?.length&&!t.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(t.key)&&!r.meta.environments.find(i=>i.name===t.key)&&r.children.every(i=>!i.meta.environments.find(a=>a.name===t.key))?!0:t.custom,Cr=t=>[Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(t)?!0:!(t.startsWith("BLOCKLET_")||t.startsWith("COMPONENT_")),hn=t=>[Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(t)===!1;function Bo({blocklet:t,ancestors:r=[]}){const n=ye(),{palette:i}=gt(),{inService:a}=n,{t:s}=R.useContext(we),m=[...r.map(o=>o.meta.did),t.meta.did],c=()=>V.success(s("blocklet.config.changedTip")),d=o=>mn(o,t,r);if(st(t.status)||t.status==="unknown"&&st(t.status))return null;const l=o=>new Promise(async(h,b)=>{if(!o.key.trim()||!o.value.trim()){V.error(s("blocklet.config.environment.keyValueRequired")),b();return}if(Cr(o.key)===!1){V.error(s("blocklet.config.environment.invalidKey")),b();return}o.custom=hn(o.key);try{const T=await n.api.configBlocklet({input:{did:m,configs:[o]}});c(T.blocklet),h()}catch(T){V.error(xe(T)),b()}}),y=(o,h)=>new Promise(async(b,T)=>{if(o.required&&(!o.key.trim()||!o.value.trim())){V.error(s("blocklet.config.environment.keyValueRequired")),T();return}if(Cr(o.key)===!1){V.error(s("blocklet.config.environment.invalidKey")),T();return}if(o.key===Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const M=Ss(o);if(M){V.error(M),T();return}}const E=[{...o,value:o.secure&&o.value==="__encrypted__"?"":o.value}];if(o.key!==h.key){if(!mn(o,t,r)){V.error("Only key of custom env can be changed"),T();return}E.push({key:h.key,custom:hn(o.key)})}try{const M=await n.api.configBlocklet({input:{did:m,configs:E}});c(M.blocklet),b()}catch(M){V.error(xe(M)),T()}}),p=o=>new Promise(async(h,b)=>{if(o.required){V.error(s("blocklet.config.environment.deleteForbidden")),b();return}if(!mn(o,t,r)){V.error("Only key of custom env can be changed"),b();return}try{const T=await n.api.configBlocklet({input:{did:m,configs:[{key:o.key,custom:hn(o.key)}]}});c(T.blocklet),h()}catch(T){V.error(xe(T)),b()}}),C=(t.configs||[]).filter(o=>!Ce.BLOCKLET_CONFIGURABLE_KEY[o.key]||[Ce.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(o.key)),f=ee.getSharedConfigObj(r[0],t),x=ee.getComponentMissingConfigs(t,r[0]),_=C.map(o=>({...o,value:Object.values(Ce.CHAIN_PROP_MAP).includes(o.key)&&Object.keys(f).includes(o.key)?f[o.key]:f[o.key]||o.value})),w=_.some(o=>o.key&&o.key.startsWith("BWA_")),S={onRowAdd:l,onRowUpdate:y,onRowDelete:p,isDeletable:d},u=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:o=>e.jsx(mr,{value:o.value,style:{color:o.required&&!o.value?i.error.main:i.text.primary,fontWeight:o.required?"bold":"normal"},children:o.key}),editComponent:o=>{const{value:h,rowData:b,onChange:T}=o;return e.jsx(br,{children:e.jsx(ve,{fullWidth:!0,size:"small",value:Oi.escapeTag(h),onChange:E=>T(E.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0,slotProps:{input:{readOnly:d(b)===!1}}})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:o=>o.value?o.secure?"******":e.jsx(mr,{unstyled:!0,value:o.value,style:{wordBreak:"break-all"},children:o.value}):null,editComponent:o=>{const{value:h,rowData:b,onChange:T}=o;return e.jsxs(br,{children:[e.jsx(ve,{fullWidth:!0,size:"small",value:h==="__encrypted__"?"":h,onChange:E=>T(E.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Na(b,s)]})}}];return e.jsxs(La,{children:[!!x.length&&e.jsx(Bn,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),w&&e.jsx(Bn,{severity:"info",children:s("blocklet.config.environment.tip")}),e.jsx(Un,{permission:a?"":"mutate_blocklets",role:a?ft:[],children:o=>e.jsx(Ii,{className:"config-table",children:e.jsx(Di,{title:e.jsx(O,{sx:{fontWeight:"bold"},children:s("common.environments")}),columns:u(),icons:Ua,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")}},data:_,editable:o?S:{}})})})]})}Bo.propTypes={blocklet:g.object.isRequired,ancestors:g.array};const La=oe.div`
|
|
3
3
|
.config-table {
|
|
4
4
|
margin-bottom: 24px;
|
|
5
5
|
position: relative;
|
|
@@ -66,7 +66,7 @@ import{aG as qe,j as e,dr as js,gw as ws,ir as _s,m as ce,bn as ye,N as O,az as
|
|
|
66
66
|
.ux-dialog_closeButton {
|
|
67
67
|
margin: 0;
|
|
68
68
|
}
|
|
69
|
-
`,Ma=R.lazy(()=>ks(()=>import("./index-
|
|
69
|
+
`,Ma=R.lazy(()=>ks(()=>import("./index-OaoSeey4.js").then(t=>t.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).then(t=>({default:t.Uploader}))),za="/blocklet/component/upload",jr=[".html",".htm",".tgz",".zip"],qa=Number(window.env?.MAX_UPLOAD_FILE_SIZE)||H.MAX_UPLOAD_FILE_SIZE,Fa=qa*1024*1024;function Oo({did:t,prefix:r,headers:n=()=>({}),onUploaded:i=mt,open:a=!1,onClose:s=mt}){const{t:m,locale:c}=ce(),d=R.useRef(null),l=R.useCallback(y=>{const{status:p,data:C}=y;if(p===200){i(C);return}V.error(m("blocklet.component.addComponentTip.uploadFailed"))},[i,m]);return R.useEffect(()=>{a?d.current?.open():d.current?.close()},[a]),e.jsx($a,{id:`component-uploader-${t}`,children:e.jsx(Ma,{ref:d,locale:c,popup:!0,onUploadFinish:l,plugins:[],onClose:s,installerProps:{disabled:!0},apiPathProps:{uploader:ke(r,za,t),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:jr,maxFileSize:Fa,maxNumberOfFiles:1}},tusProps:{headers:n},dashboardProps:{note:m("blocklet.component.addComponentTip.allowedFileTypes",{types:jr.map(y=>y.replace(".","")).join(", ")})}})},`component-uploader-${t}`)}Oo.propTypes={did:g.string.isRequired,prefix:g.string.isRequired,open:g.bool,headers:g.func,onUploaded:g.func,onClose:g.func};const $a=Es(O)`
|
|
70
70
|
.uploader-wrapper {
|
|
71
71
|
display: inline-flex;
|
|
72
72
|
position: relative;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c0 as c,r as _,cr as f,h0 as S,cR as r}from"./index-D7lzrhp6.js";var d=function(n){var a=c(_.useState(n),2),u=a[0],o=a[1],i=f(function(t){o(function(e){var s=S(t)?t(e):t;return s?r(r({},e),s):e})});return[u,i]};export{d as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as z,bn as I,bo as Ke,m as S,j as e,P as B,r as h,Q as X,R as G,S as Q,U as J,N as l,o as x,n as Re,v as U,C as Se,ad as ce,aV as Y,t as F,g as De,y as E,$ as le,aU as Ie,V as $e,s as P,au as Be,H as Pe,l as Ne,bp as W,W as Le,bq as de,br as pe,bs as me,bt as Ee,J as _e,T as $,bu as ze,az as ie,a4 as re,aR as ae,bk as We,bv as qe,X as Me,Y as Ue,A as Fe,u as He,bm as Oe,d as Ve,bw as Xe}from"./index-
|
|
1
|
+
import{E as z,bn as I,bo as Ke,m as S,j as e,P as B,r as h,Q as X,R as G,S as Q,U as J,N as l,o as x,n as Re,v as U,C as Se,ad as ce,aV as Y,t as F,g as De,y as E,$ as le,aU as Ie,V as $e,s as P,au as Be,H as Pe,l as Ne,bp as W,W as Le,bq as de,br as pe,bs as me,bt as Ee,J as _e,T as $,bu as ze,az as ie,a4 as re,aR as ae,bk as We,bv as qe,X as Me,Y as Ue,A as Fe,u as He,bm as Oe,d as Ve,bw as Xe}from"./index-D7lzrhp6.js";import{u as Ge,T as Qe}from"./html-title-BHx37gaF.js";import Je from"./audit-logs-Betoa8v-.js";import{T as ue,M as Ye}from"./index-BcIr2X1S.js";import{r as xe,P as Ze}from"./index-D9c_n0Zn.js";import{u as _,T as et}from"./team-D9qX7mGm.js";import{g as tt,H as st}from"./index-BNgNadZA.js";import{D as nt}from"./url-evaluation-BZtvoS6V.js";import{E as ot}from"./Edit-s_UOOLA4.js";import{y as it}from"./index-DZdX_ov1.js";import{A as rt}from"./Add-BuxBWbKv.js";import{l as H}from"./index-GpweUAuu.js";import{C as O}from"./click-to-copy-DBwd2qVy.js";import{f as at}from"./index-BojVbZw0.js";import{D as ct}from"./delete-confirm-CEQXI_Kb.js";import{P as lt}from"./permission-BcnxfENO.js";import{u as dt}from"./blocklet-CE5XgbbR.js";import{A as pt}from"./actions-CRcVnE0o.js";import{u as fe}from"./use-mobile-C3Kt9jiO.js";import{u as mt}from"./useAsyncRetry-CKdA5B4J.js";import"./TableSearch-Cuohy6oG.js";import"./Search-BRG28-bq.js";import"./Clear-CfUqGbT5.js";import"./useLocalStorage-BacdU7Dw.js";import"./index-BJTXvu7V.js";import"./decode-DPztD6kB.js";import"./shorten-label-C2TvZwiB.js";import"./ViewList-BPHxMt8z.js";import"./use-mobile-C3R5m8C9.js";import"./client-BqXjUJmr.js";import"./AdapterDayjs-D65E_hJW.js";import"./useThemeProps-DoaWGRR_.js";import"./CSSTransition-BtkiOWZC.js";import"./visuallyHidden-Dan1xhjv.js";import"./index-BBwTny8t.js";import"./Verified-Sbsjq85f.js";import"./DeleteOutline-CdS_T1n7.js";import"./ErrorOutline-3Uoca5Wu.js";import"./index-BTth0Avx.js";import"./emotion-cache.browser.esm-Btm_v21f.js";import"./sdk-D1MrqeFi.js";import"./index-BYmI15t3.js";import"./ButtonGroup-Ca-yV-4C.js";import"./getValidReactChildren-pQYfZHaB.js";import"./Google-RsZHy3xt.js";import"./cloneDeep-_TP0P9Bh.js";import"./edit.svg-CUba2Jvc.js";import"./list-header-BB26rDnk.js";import"./chain-fyEjDjKA.js";import"./ToggleButtonGroup-C6GsXzIq.js";import"./FilterList-oCTR8mcc.js";import"./index-CKQB1o8K.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-ciSeh1BA.js";import"./MoreVert-DLy2w-Ib.js";import"./useAsync-CnNdbLcF.js";function Z({value:s}){const{t,locale:n}=S(),i=new Date;return new Date(s)<i?e.jsxs("span",{style:{color:"red"},children:[e.jsx(B,{value:s,locale:n}),`${t("setting.accessKey.expired",{time:""})}`]}):e.jsx(B,{mode:"daysLeft",value:s,locale:n,type:"all"})}Z.propTypes={value:x.string.isRequired};function ee({value:s,onChange:t,...n}){const{t:i}=S(),r=h.useMemo(()=>[{value:"signature",title:i("setting.accessKey.signature"),description:i("setting.accessKey.signatureDesc")},{value:"simple",title:i("setting.accessKey.simple"),description:i("setting.accessKey.simpleDesc")}],[i]);return e.jsxs(X,{style:{width:"100%"},variant:"outlined",...n,children:[e.jsx(G,{children:i("setting.accessKey.authType")}),e.jsx(Q,{value:s,onChange:t,fullWidth:!0,label:i("setting.accessKey.authType"),children:r.map(c=>e.jsx(J,{value:c.value,children:e.jsxs(l,{children:[e.jsx("span",{children:c.title}),e.jsx(l,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:c.description})]})},c.value))})]})}ee.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const te=()=>{const s=z.RBAC_CONFIG.roles.filter(r=>r.passport),{inService:t}=I(),{roles:n}=_(),i=[...s,...t?n:[]];return Ke(i,"name").filter(r=>r.name!==z.ROLES.OWNER)};function he(){const{session:s}=Re(),t=te();return h.useMemo(()=>{if(!s?.user?.role)return[];if(["owner","admin"].includes(s.user.role))return t;const i=t.filter(c=>c.name==="guest");return[...t.filter(c=>c.name!=="guest").filter(c=>s.user.passports.find(f=>f.role===c.name)),...i]},[t,s?.user?.passports,s?.user?.role])}function ge({onCreate:s=()=>{},remark:t=""}){const{api:n}=I(),{teamDid:i}=_(),{t:r}=S(),[c,f]=h.useState(!1),[u,j]=h.useState(null),p=he(),w=()=>{f(!1),j(null)},g=async m=>{const{remark:k,passport:y,authType:o}=m;f(!0);const C=await n.createAccessKey({input:{teamDid:i,remark:k.trim(),passport:y,expireAt:m.expireAt?new Date(m.expireAt).getTime():null,authType:o}}),{data:A}=C;s(A),j(null),f(!1)},d={title:`${r("common.create")} ${r("accessKey")}`,description:(m,k,y)=>e.jsxs(Y,{sx:{gap:3},children:[e.jsx(F,{label:r("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,margin:"dense",value:m.remark,onChange:o=>{k({...m,remark:o.target.value,__disableConfirm:!m.passport||!o.target.value.trim()}),o.target.value.trim()?y(""):y(r("setting.accessKey.remarkInvalid"))},slotProps:{htmlInput:{"data-cy":"remark-input"}}}),e.jsxs(X,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:r("setting.accessKey.passport")}),e.jsx(Q,{"data-cy":"create-access-key-select-passport",value:m.passport,onChange:o=>{const C=o.target.value;y(null),k({...m,passport:C,__disableConfirm:!m.remark||!C})},fullWidth:!0,label:r("setting.accessKey.passport"),disabled:c,children:p.map(o=>e.jsx(J,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(l,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(l,{sx:{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify"},children:o.description})]})},o.name))})]}),e.jsx(ee,{value:m.authType,onChange:o=>{k({...m,authType:o.target.value})}}),e.jsx(ue,{placeholder:r("setting.accessKey.expireTime"),value:m.expireAt,onChange:o=>{k({...m,expireAt:o,__disableConfirm:!m.passport||!m.remark||!o})}})]}),confirm:r("common.confirm"),cancel:r("common.cancel"),color:"primary",params:{remark:t,authType:"signature",__disableConfirm:!t.trim()},onConfirm:g,onCancel:w};return e.jsxs(e.Fragment,{children:[e.jsxs(U,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>j(d),className:"rule-action",children:[c?e.jsx(Se,{size:16}):e.jsx(rt,{style:{fontSize:16}}),r("common.create")]}),u&&e.jsx(ce,{title:u.title,description:u.description,confirm:u.confirm,color:u.color,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}ge.propTypes={remark:x.string,onCreate:x.func};function ye({onConfirm:s=()=>{},accessKeyId:t,accessKeySecret:n,hideSecret:i=!0}){const{t:r}=h.useContext(De),[c,f]=h.useState(!1),[u,j]=h.useState(()=>i),p=I(),w=()=>{j(!u)},g=y=>{f(y.target.checked)},d=E(window.location.origin,p?.info?.routing?.adminPath),m=h.useMemo(()=>i?`const Client = require('@blocklet/server-js');
|
|
2
2
|
const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
|
|
3
3
|
const { joinURL } = require('ufo');
|
|
4
4
|
|