@abtnode/webapp 1.16.44-beta-20250603-231026-30a9d27f → 1.16.44-beta-20250605-131649-6eaf56d9
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-C1BR9cKq.js → AdapterDayjs-Cv_u9vX9.js} +6 -6
- package/dist/assets/{Add-_FLiPvnr.js → Add-BgHZW-rC.js} +1 -1
- package/dist/assets/{ArrowDropDown-MtffWzvM.js → ArrowDropDown-B4kEWzcV.js} +1 -1
- package/dist/assets/{Autocomplete-CgmVM_mh.js → Autocomplete-Dn9cwZGk.js} +1 -1
- package/dist/assets/{Breadcrumbs-9te9YWGO.js → Breadcrumbs-CcIA7O4Q.js} +1 -1
- package/dist/assets/{ButtonGroup-CyZftEPU.js → ButtonGroup-B_aX6xrX.js} +1 -1
- package/dist/assets/{CSSTransition-BiIQcYkx.js → CSSTransition-mHo9w1Xm.js} +1 -1
- package/dist/assets/{CallMerge-PsrB7Tkl.js → CallMerge-BLIVvLPa.js} +1 -1
- package/dist/assets/{CardContent-BVxQxAFx.js → CardContent-DiVfs5o0.js} +1 -1
- package/dist/assets/{ChevronLeft-CCxHGEqu.js → ChevronLeft-CT46t2TS.js} +1 -1
- package/dist/assets/{ChevronRight-CfdjNfdi.js → ChevronRight-C0iTeHeW.js} +1 -1
- package/dist/assets/{Clear-CzzSn6gi.js → Clear-DNueioFS.js} +1 -1
- package/dist/assets/{Close-B53jEGex.js → Close-BTlbj8PZ.js} +1 -1
- package/dist/assets/{Community-BBDlY1li.js → Community-C-jP6Fe1.js} +1 -1
- package/dist/assets/{Delete-B03xny6i.js → Delete-XCER7bsY.js} +1 -1
- package/dist/assets/{DeleteOutline-C_C-bBpS.js → DeleteOutline-Cd_INjPT.js} +1 -1
- package/dist/assets/{Done-CEnGV2P1.js → Done-B_Dl03MQ.js} +1 -1
- package/dist/assets/{Edit-CjM24S2u.js → Edit-Dl2UnYBE.js} +1 -1
- package/dist/assets/{ErrorOutline-D6y9_qL6.js → ErrorOutline-De9g0Ol8.js} +1 -1
- package/dist/assets/{HelpOutline-B4MIH072.js → HelpOutline-O3LN2Opx.js} +1 -1
- package/dist/assets/{Holiday-BIM_wngw.js → Holiday-AYGd1K9g.js} +1 -1
- package/dist/assets/{Launch-B3yvw_J_.js → Launch-vfC7_2lv.js} +1 -1
- package/dist/assets/{Link-DKridYM9.js → Link-BThqcf18.js} +1 -1
- package/dist/assets/{ListItemButton-vZmBkXWh.js → ListItemButton-Bv9dOrZc.js} +1 -1
- package/dist/assets/{ListSubheader-BPhNB2Oc.js → ListSubheader-DiTqpbZT.js} +1 -1
- package/dist/assets/{LoadingButton-Davlvc6y.js → LoadingButton-Bq5KEq87.js} +1 -1
- package/dist/assets/{LockIcon-1C9n63UW.js → LockIcon-8LA3WdkF.js} +1 -1
- package/dist/assets/{Meeting-CbtQNFzo.js → Meeting-BnJ40HvU.js} +1 -1
- package/dist/assets/{MoreHoriz-D7yyKUPp.js → MoreHoriz-DIlSvADT.js} +1 -1
- package/dist/assets/{MoreVert-D8KfjeMg.js → MoreVert-BgpxfOll.js} +1 -1
- package/dist/assets/{OffSick-D11BmTrz.js → OffSick-Bbb3rgf4.js} +1 -1
- package/dist/assets/{OpenInNew-CvtRLCd4.js → OpenInNew-Br7wzmcq.js} +1 -1
- package/dist/assets/{Public-BF2LKG2O.js → Public-DcmgnkgM.js} +1 -1
- package/dist/assets/{Refresh-CMdl0n4X.js → Refresh-aZeeMAFw.js} +1 -1
- package/dist/assets/{SchemaReference.es-Bz1aIhgW.js → SchemaReference.es-BrlGTQdI.js} +1 -1
- package/dist/assets/{Search-C9hXwvmq.js → Search-DwJKG2rp.js} +1 -1
- package/dist/assets/{Slider-OBEuEr91.js → Slider-BV7jgO00.js} +1 -1
- package/dist/assets/{Stepper-g85lhZ09.js → Stepper-BFEVqzoU.js} +1 -1
- package/dist/assets/{Switch-DHcUbR0L.js → Switch-DT2kCliN.js} +1 -1
- package/dist/assets/{TableRow-DQ5x-tZA.js → TableRow-Bj3l8hth.js} +1 -1
- package/dist/assets/{TableSearch-Di-DZraN.js → TableSearch-12CV3VPc.js} +2 -2
- package/dist/assets/{ToggleButtonGroup-DmZrsSwk.js → ToggleButtonGroup-BQZl5y2d.js} +1 -1
- package/dist/assets/{Verified-NpqHLdgb.js → Verified-CVhFzDfI.js} +1 -1
- package/dist/assets/{VerifiedUser-DWougmnk.js → VerifiedUser-Bqrb7cii.js} +1 -1
- package/dist/assets/{ViewColumn-BcfEtc-F.js → ViewColumn-Cw8COMnF.js} +1 -1
- package/dist/assets/{ViewList-Bw5GBfRx.js → ViewList-DyL4Mpbe.js} +1 -1
- package/dist/assets/{WorkingRemotely-Ddq9A0PU.js → WorkingRemotely-BnpKD2zv.js} +1 -1
- package/dist/assets/{_createAggregator-e8B5UuQb.js → _createAggregator-Dllr22j6.js} +1 -1
- package/dist/assets/{actions-D-CrDKrc.js → actions-BdySeYEr.js} +1 -1
- package/dist/assets/{actions-n15iXAnz.js → actions-CU5HkWLC.js} +1 -1
- package/dist/assets/{agreement-DxiSkmRO.js → agreement-3Sj9VAYK.js} +1 -1
- package/dist/assets/api-Ci-onPo-.js +1 -0
- package/dist/assets/appearance-CGPXdG-8.js +1 -0
- package/dist/assets/{audit-logs-Cm7Peo8d.js → audit-logs-B205DAqA.js} +2 -2
- package/dist/assets/{base-chart-sAweLHnI.js → base-chart-BiYVpUU1.js} +1 -1
- package/dist/assets/{blocklet-0XH8mmGQ.js → blocklet-BGgqD4BP.js} +1 -1
- package/dist/assets/{brace-fold.es-BSbx02n-.js → brace-fold.es-BWTijt1P.js} +1 -1
- package/dist/assets/{chain-DXi01pCi.js → chain-GVepOAty.js} +1 -1
- package/dist/assets/{click-to-copy-CzLJWIzM.js → click-to-copy-CvqUTuWC.js} +1 -1
- package/dist/assets/cloneDeep-BmVUq-fD.js +1 -0
- package/dist/assets/{closebrackets.es-CgYkPTvg.js → closebrackets.es-zZYPKieg.js} +1 -1
- package/dist/assets/{codemirror.es-BZ0a_ivo.js → codemirror.es-w08msOBy.js} +1 -1
- package/dist/assets/{collapse-BiA9C3xc.js → collapse-Bh8BbLWj.js} +1 -1
- package/dist/assets/{comment.es-7f02Xyrt.js → comment.es-CLsOZbmW.js} +1 -1
- package/dist/assets/{config-navigation-CVCS_wmz.js → config-navigation-DnbJqQvw.js} +10 -10
- package/dist/assets/{connect-to-ChNP_InC.js → connect-to-BHNObJzo.js} +1 -1
- package/dist/assets/{delete-confirm-BQv2uNjr.js → delete-confirm-fBpOTC0X.js} +1 -1
- package/dist/assets/{detail-CmCy8OZl.js → detail-mYYLaEPg.js} +4 -4
- package/dist/assets/{dialog.es-WzckXrqD.js → dialog.es-BKO5c4N0.js} +1 -1
- package/dist/assets/{domains-DJunvhC7.js → domains-6yjV_Atq.js} +2 -2
- package/dist/assets/{download-BBnocOOE.js → download-7ZXIqqSQ.js} +1 -1
- package/dist/assets/emotion-react.browser.esm-SsdnWCKs.js +1 -0
- package/dist/assets/{foldgutter.es-DEngPfJB.js → foldgutter.es-B7Osb2-c.js} +1 -1
- package/dist/assets/{get-safe-url-CeasmSQ-.js → get-safe-url-CQ6WOW_2.js} +1 -1
- package/dist/assets/{get-safe-url-DOD4GJn9.js → get-safe-url-DqxIQnIB.js} +1 -1
- package/dist/assets/getValidReactChildren-KVG9q6ks.js +1 -0
- package/dist/assets/{hint.es-DyRx1Cyd.js → hint.es-lBtA8ZwI.js} +1 -1
- package/dist/assets/{hint.es2-DzHCUANh.js → hint.es2-CkIh6XdJ.js} +1 -1
- package/dist/assets/{iframe-CaiV-sh3.js → iframe-D5iD_BbZ.js} +1 -1
- package/dist/assets/index-39EBB64D.js +1 -0
- package/dist/assets/{index-CWrKe4Fn.js → index-6W-GDgvR.js} +1 -1
- package/dist/assets/{index-B_Ia97sj.js → index-B5OIQ8Ep.js} +1 -1
- package/dist/assets/{index-BP-_EDED.js → index-B6dxjoal.js} +1 -1
- package/dist/assets/{index-rqpjf_aL.js → index-BBD32nFj.js} +1 -1
- package/dist/assets/{index-CzmPd2Yv.js → index-BC9HWsev.js} +2 -2
- package/dist/assets/{index-Dq5qISUc.js → index-BEz0dAo5.js} +1 -1
- package/dist/assets/{index-Dw_CLa5a.js → index-BMc3vTPP.js} +1 -1
- package/dist/assets/{index-BvqxJBeo.js → index-Bb9mPsg4.js} +1 -1
- package/dist/assets/{index-DqemVNEB.js → index-BhHggOVj.js} +1 -1
- package/dist/assets/{index-CJw-UBp7.js → index-BhQtDVfw.js} +12 -12
- package/dist/assets/{index-uI9vL45f.js → index-BmPiTTIZ.js} +12 -12
- package/dist/assets/{index-DhhYGftt.js → index-Bo3mhrC1.js} +1 -1
- package/dist/assets/{index-BId_FUnH.js → index-BoqbVoss.js} +1 -1
- package/dist/assets/{index-ND43AQF3.js → index-BqidStvB.js} +1 -1
- package/dist/assets/{index-DuUh_tiX.js → index-BvzQfEl7.js} +1 -1
- package/dist/assets/index-ByW-N-Aj.js +1 -0
- package/dist/assets/{index-wPkudHOp.js → index-C6FWJewo.js} +1 -1
- package/dist/assets/{index-BfFQSInC.js → index-C7RI5BZx.js} +1 -1
- package/dist/assets/index-CADpz2I-.js +120 -0
- package/dist/assets/{index-C2_kibHi.js → index-CNGTUnyW.js} +1 -1
- package/dist/assets/{index-B3V-N3Wb.js → index-CW6Cp9oI.js} +1 -1
- package/dist/assets/{index-C3mZr8we.js → index-CXQg5kUh.js} +1 -1
- package/dist/assets/{index-IEQvL11R.js → index-CZKkZl9k.js} +1 -1
- package/dist/assets/{index-yr2tw49U.js → index-Ce5WAACz.js} +1 -1
- package/dist/assets/{index-CjndCckY.js → index-CvtRf8XP.js} +1 -1
- package/dist/assets/{index-F1az7AW1.js → index-D-zryRSO.js} +2 -2
- package/dist/assets/{index-BrmVQ0Dk.js → index-D3Shruy6.js} +1 -1
- package/dist/assets/{index-CdUA_Nw3.js → index-DGj8VeE8.js} +1 -1
- package/dist/assets/{index-C8E-LVoC.js → index-DHgO5720.js} +1 -1
- package/dist/assets/{index-CJYLnawL.js → index-DLpmK7g7.js} +2 -2
- package/dist/assets/{index-UwyveOVh.js → index-DQMn-535.js} +1 -1
- package/dist/assets/{index-BI07C4m-.js → index-DW4yqAJe.js} +3 -3
- package/dist/assets/index-DYKtjW1P.js +20 -0
- package/dist/assets/{index-Btk3r71p.js → index-DZCLHo2d.js} +1 -1
- package/dist/assets/{index-CjKWQIp8.js → index-DckmeIXZ.js} +1 -1
- package/dist/assets/{index-DIn71jxf.js → index-DjMj-3TH.js} +4 -4
- package/dist/assets/{index-CfPPx3Iq.js → index-DkCoCiBY.js} +1 -1
- package/dist/assets/{index-F9yX_03E.js → index-DuyERwXL.js} +4 -4
- package/dist/assets/{index-DGAkAa65.js → index-FVHigiGL.js} +5 -5
- package/dist/assets/{index-CO5SYnb0.js → index-Gd_-HHXO.js} +1 -1
- package/dist/assets/index-PI9HcrcZ.js +1 -0
- package/dist/assets/{index-BLXylM3L.js → index-UEEm8IH_.js} +8 -8
- package/dist/assets/index-W_S98308.js +161 -0
- package/dist/assets/{index-B9U9Suki.js → index-dNVpmVF8.js} +1 -1
- package/dist/assets/{index-BoaJIDrq.js → index-dO3xF1h-.js} +1 -1
- package/dist/assets/{index-CsTPddhu.js → index-vDSh3Cp8.js} +2 -2
- package/dist/assets/{index.esm-DFALq7M0.js → index.esm-2g4alCSR.js} +1 -1
- package/dist/assets/{info-addon.es-BqpBr1a_.js → info-addon.es-DXdH3nkT.js} +1 -1
- package/dist/assets/{info.es-XpHeRZxm.js → info.es-DRG0j4sq.js} +1 -1
- package/dist/assets/{install-from-url-C-0PYSod.js → install-from-url-Bb4YsrAU.js} +1 -1
- package/dist/assets/{invitation-CiC039B0.js → invitation-C7NbKNVg.js} +6 -6
- package/dist/assets/is-path-prefix-equal-CuHET4mT.js +1 -0
- package/dist/assets/item-DIw8y9OL.js +277 -0
- package/dist/assets/{javascript.es-lbPUI9aU.js → javascript.es-BT6mBZAc.js} +1 -1
- package/dist/assets/{jump-to-line.es-M3uS8xdC.js → jump-to-line.es-DS6182v1.js} +1 -1
- package/dist/assets/{jump.es-Cczg0IOe.js → jump.es-Cvu_ykfz.js} +1 -1
- package/dist/assets/{lint.es-CV3CrdJN.js → lint.es-B6Mea4ol.js} +1 -1
- package/dist/assets/{lint.es2-DVxe7fKQ.js → lint.es2-D3R4pmX0.js} +1 -1
- package/dist/assets/{lint.es3-B3ba4H3v.js → lint.es3-CovlO_7I.js} +1 -1
- package/dist/assets/{list-header-DphF1qCI.js → list-header-DnSoi2gS.js} +1 -1
- package/dist/assets/{log-CFdakmxI.js → log-BZyJMuGI.js} +1 -1
- package/dist/assets/{lottie-react.esm-B-RjdQsR.js → lottie-react.esm-5lYI1MpH.js} +1 -1
- package/dist/assets/{matchbrackets.es-BhPVZP1g.js → matchbrackets.es-fTMOmWBx.js} +1 -1
- package/dist/assets/{memory-exz0edFH.js → memory-BPgae6Ty.js} +1 -1
- package/dist/assets/{metric-Cp_OG6Ar.js → metric-DXU1nzNR.js} +1 -1
- package/dist/assets/{mode.es-BdIEUTT-.js → mode.es-DB-1ZC30.js} +1 -1
- package/dist/assets/{mode.es2-DCGZNnw-.js → mode.es2-DiACe-_L.js} +1 -1
- package/dist/assets/{mode.es3-DCV5y4SV.js → mode.es3-GDfaO8mJ.js} +1 -1
- package/dist/assets/omit-DXvM5ymG.js +1 -0
- package/dist/assets/{onlineParser.es-C7-DSgy-.js → onlineParser.es-BQT7yuME.js} +1 -1
- package/dist/assets/{overview-BcgyjCEc.js → overview-Bj55od7h.js} +1 -1
- package/dist/assets/{permission-imoW7Dag.js → permission-vMf-uF3v.js} +1 -1
- package/dist/assets/{preference--W7SqmXq.js → preference-Ch1EProJ.js} +5 -5
- package/dist/assets/{raf-schd.esm-FMWvAY6y.js → raf-schd.esm-DF89N1G1.js} +1 -1
- package/dist/assets/refType-BuOkq77J.js +1 -0
- package/dist/assets/{resource-dialog-OB8ZWKbP.js → resource-dialog-CepFEgbz.js} +22 -22
- package/dist/assets/{runtime-DLa3pUwk.js → runtime-Ywr1KH27.js} +1 -1
- package/dist/assets/{schema-CB6vZuPk.js → schema-whOJM5yP.js} +1 -1
- package/dist/assets/sdk-CglYRwAS.js +1 -0
- package/dist/assets/{search.es-CxoPeMIs.js → search.es-D29Kk2jC.js} +1 -1
- package/dist/assets/{searchcursor.es-BLi5Jaz_.js → searchcursor.es-B_M5zHRT.js} +1 -1
- package/dist/assets/{service-CM59EUE1.js → service-Dkju05i2.js} +1 -1
- package/dist/assets/{shorten-label-ROv_Kolv.js → shorten-label-D1iivBtw.js} +1 -1
- package/dist/assets/{show-hint.es-VA8ntogJ.js → show-hint.es-BxRGcKz_.js} +1 -1
- package/dist/assets/{simple-select-DZQHpfOs.js → simple-select-De2jXPa0.js} +1 -1
- package/dist/assets/{spaces-pq4q-xcK.js → spaces-6FINHsBY.js} +1 -1
- package/dist/assets/{status-DQe5HrFt.js → status-DIkTFZl1.js} +1 -1
- package/dist/assets/{status-BNtF-O7o.js → status-DpC75vFg.js} +1 -1
- package/dist/assets/{sublime.es-B0oX3S1G.js → sublime.es-CdVH72LA.js} +1 -1
- package/dist/assets/{switch-control-BkuPmwf0.js → switch-control-C1azX2vK.js} +1 -1
- package/dist/assets/{table-icons-mGCUcig8.js → table-icons-CxG9xSYX.js} +1 -1
- package/dist/assets/{team-B7OFmIul.js → team-CGR5oTKb.js} +1 -1
- package/dist/assets/{toLower-B6OvbucL.js → toLower-JLSds9id.js} +1 -1
- package/dist/assets/toUpper-CtMmdD1L.js +1 -0
- package/dist/assets/{traffic-B4Jt45EJ.js → traffic-CY9CXZe_.js} +1 -1
- package/dist/assets/url-evaluation-D2wHtYXf.js +1 -0
- package/dist/assets/{url-join-ChoyKXT9.js → url-join-DpTGxJea.js} +1 -1
- package/dist/assets/{use-mobile-DTCaLf5g.js → use-mobile-DaQ7GJZg.js} +1 -1
- package/dist/assets/{use-mobile-BGEwy1l2.js → use-mobile-IstSabwI.js} +1 -1
- package/dist/assets/{useAsync-DUqq2w5l.js → useAsync-1E9s8bfS.js} +1 -1
- package/dist/assets/{useAsyncRetry-B5nI7RKf.js → useAsyncRetry-u2647x5s.js} +1 -1
- package/dist/assets/{useLocalStorage-BJuW1NlC.js → useLocalStorage-CCiP1kGY.js} +1 -1
- package/dist/assets/{useThemeProps-BK5mEVp3.js → useThemeProps-CLbMNkj4.js} +1 -1
- package/dist/assets/{util-D0meRqEm.js → util-DCgizAfI.js} +1 -1
- package/dist/assets/{wait-container-BatWKxuP.js → wait-container-DQC3ztrw.js} +1 -1
- package/dist/assets/withStyles-D6aG74hb.js +1 -0
- package/dist/assets/{wrap-locale-BhcfayAL.js → wrap-locale-D_Bptf3J.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Delete-Ckjh8fiz.js +0 -1
- package/dist/assets/api-BdCtM-JU.js +0 -1
- package/dist/assets/appearance-CmkcRR-A.js +0 -1
- package/dist/assets/cloneDeep-DrIYfJtK.js +0 -1
- package/dist/assets/emotion-react.browser.esm-Bw_a1zYt.js +0 -1
- package/dist/assets/getValidReactChildren-Dpq0Aubw.js +0 -1
- package/dist/assets/index-B6Sh3GL-.js +0 -109
- package/dist/assets/index-BS6EkSO3.js +0 -1
- package/dist/assets/index-BfJyRoJf.js +0 -1
- package/dist/assets/index-C2yIkz2Y.js +0 -1
- package/dist/assets/index-C3V0tJaS.js +0 -1
- package/dist/assets/index-CXWISdb1.js +0 -20
- package/dist/assets/index-CoLl5HNr.js +0 -161
- package/dist/assets/index-DQ3oLIL5.js +0 -7
- package/dist/assets/is-path-prefix-equal-CSbxgWMC.js +0 -1
- package/dist/assets/item-C8WBT7Kr.js +0 -277
- package/dist/assets/omit-D6CPuAva.js +0 -1
- package/dist/assets/refType-CPeRd-dg.js +0 -1
- package/dist/assets/sdk-Dhp8eIdk.js +0 -1
- package/dist/assets/table-tips-s8yom9jj.js +0 -1
- package/dist/assets/toUpper-1vQFjHq5.js +0 -1
- package/dist/assets/url-evaluation-UX_hT3EN.js +0 -1
- package/dist/assets/withStyles-Bg0r5eKS.js +0 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import{m as D,j as e,R as B,P as u,r as C,N as G,O as Q,S as Y,Q as Z,K as p,A as z,bq as _,br as Ke,aZ as J,t as M,B as F,C as Ae,ae as ue,e as we,D as xe,aY as Se,U as De,n as $,y as Re,aw as H,l as Ie,W as Be,bs as de,bt as fe,bu as he,bv as ye,bw as $e,H as Pe,k as I,bx as _e,aB as E,a4 as pe,aV as me,by as Le,V as Ne,X as ze,x as Ee,u as We,bp as qe,d as Ue,bz as Me}from"./index-vDSh3Cp8.js";import{T as Fe}from"./index-CXQg5kUh.js";import He from"./audit-logs-B205DAqA.js";import{T as ge,M as Oe}from"./index-dNVpmVF8.js";import{r as be,P as Ve}from"./index-BoqbVoss.js";import{u as L,T as Xe}from"./team-CGR5oTKb.js";import{g as Ge,D as Qe}from"./index-DHgO5720.js";import{d as Ye}from"./Delete-XCER7bsY.js";import{d as Ze}from"./Edit-Dl2UnYBE.js";import{E as Je}from"./index-BEz0dAo5.js";import{d as et}from"./Add-BgHZW-rC.js";import{C as O}from"./index-BvzQfEl7.js";import{C as V}from"./click-to-copy-CvqUTuWC.js";import{f as tt}from"./index-BojVbZw0.js";import{D as st}from"./delete-confirm-fBpOTC0X.js";import{P as ot}from"./permission-vMf-uF3v.js";import{u as nt}from"./blocklet-BGgqD4BP.js";import{A as at}from"./actions-BdySeYEr.js";import{u as je}from"./use-mobile-DaQ7GJZg.js";import{u as it}from"./useAsyncRetry-u2647x5s.js";import"./TableSearch-12CV3VPc.js";import"./Search-DwJKG2rp.js";import"./Clear-DNueioFS.js";import"./useLocalStorage-CCiP1kGY.js";import"./index-BhQtDVfw.js";import"./shorten-label-D1iivBtw.js";import"./ViewList-DyL4Mpbe.js";import"./resource-dialog-CepFEgbz.js";import"./index-dO3xF1h-.js";import"./use-mobile-IstSabwI.js";import"./ListItemButton-Bv9dOrZc.js";import"./index-BMc3vTPP.js";import"./emotion-react.browser.esm-SsdnWCKs.js";import"./index-Ce5WAACz.js";import"./Switch-DT2kCliN.js";import"./url-evaluation-D2wHtYXf.js";import"./index-CvtRf8XP.js";import"./OpenInNew-Br7wzmcq.js";import"./index-BJHGOv7L.js";import"./HelpOutline-O3LN2Opx.js";import"./index-CNGTUnyW.js";import"./ButtonGroup-B_aX6xrX.js";import"./getValidReactChildren-KVG9q6ks.js";import"./AdapterDayjs-Cv_u9vX9.js";import"./useThemeProps-CLbMNkj4.js";import"./CSSTransition-mHo9w1Xm.js";import"./refType-BuOkq77J.js";import"./index-CZKkZl9k.js";import"./Verified-CVhFzDfI.js";import"./DeleteOutline-Cd_INjPT.js";import"./ErrorOutline-De9g0Ol8.js";import"./sdk-CglYRwAS.js";import"./LockIcon-8LA3WdkF.js";import"./cloneDeep-BmVUq-fD.js";import"./chain-GVepOAty.js";import"./list-header-DnSoi2gS.js";import"./ToggleButtonGroup-BQZl5y2d.js";import"./TableRow-Bj3l8hth.js";import"./ViewColumn-Cw8COMnF.js";import"./MoreVert-BgpxfOll.js";import"./MoreHoriz-DIlSvADT.js";import"./useAsync-1E9s8bfS.js";function ee({value:t}){const{t:s,locale:c}=D(),r=new Date;return new Date(t)<r?e.jsxs("span",{style:{color:"red"},children:[e.jsx(B,{value:t,locale:c}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(B,{value:t,locale:c,type:"all"})}ee.propTypes={value:u.string.isRequired};function te({value:t,onChange:s,...c}){const{t:r}=D(),l=C.useMemo(()=>[{value:"signature",title:r("setting.accessKey.signature"),description:r("setting.accessKey.signatureDesc")},{value:"simple",title:r("setting.accessKey.simple"),description:r("setting.accessKey.simpleDesc")}],[r]);return e.jsxs(G,{style:{width:"100%"},variant:"outlined",...c,children:[e.jsx(Q,{children:r("setting.accessKey.authType")}),e.jsx(Y,{value:t,onChange:s,fullWidth:!0,label:r("setting.accessKey.authType"),children:l.map(o=>e.jsx(Z,{value:o.value,children:e.jsxs(p,{children:[e.jsx("span",{children:o.title}),e.jsx(p,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}te.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const W=()=>{const t=z.RBAC_CONFIG.roles.filter(l=>l.passport),{inService:s}=_(),{roles:c}=L(),r=[...t,...s?c:[]];return Ke(r,"name").filter(l=>l.name!==z.ROLES.OWNER)};function se(t){const{remark:s,onCreate:c}=t,{api:r}=_(),{teamDid:l}=L(),{t:o}=D(),[k,g]=C.useState(!1),[d,v]=C.useState(null),x=W(),b=()=>{g(!1),v(null)},y=async a=>{const{remark:j,passport:f,authType:n}=a;g(!0);const h=await r.createAccessKey({input:{teamDid:l,remark:j.trim(),passport:f,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:n}}),{data:S}=h;c(S),v(null),g(!1)},T={title:`${o("common.create")} ${o("accessKey")}`,description:(a,j,f)=>e.jsxs(J,{gap:3,children:[e.jsx(M,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:n=>{j({...a,remark:n.target.value,__disableConfirm:!a.passport||!n.target.value.trim()}),n.target.value.trim()?f(""):f(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(G,{style:{width:"100%"},variant:"outlined",children:[e.jsx(Q,{children:o("setting.accessKey.passport")}),e.jsx(Y,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:n=>{const h=n.target.value;f(null),j({...a,passport:h,__disableConfirm:!a.remark||!h})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:k,children:x.map(n=>e.jsx(Z,{value:n.name,"data-cy":`create-access-key-passport-option-${n.name}`,children:e.jsxs(p,{children:[e.jsx("span",{children:n.title||n.name}),e.jsx(p,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:n.description})]})},n.name))})]}),e.jsx(te,{value:a.authType,onChange:n=>{j({...a,authType:n.target.value})}}),e.jsx(ge,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:n=>{j({...a,expireAt:n,__disableConfirm:!a.passport||!a.remark||!n})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:y,onCancel:b};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>v(T),className:"rule-action",children:[k?e.jsx(Ae,{size:16}):e.jsx(et,{style:{fontSize:16}}),o("common.create")]}),d&&e.jsx(ue,{title:d.title,description:d.description,confirm:d.confirm,color:d.color,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}se.propTypes={remark:u.string,onCreate:u.func};se.defaultProps={onCreate:()=>{},remark:""};function oe(t){const{onConfirm:s,accessKeyId:c,accessKeySecret:r,hideSecret:l}=t,{t:o}=C.useContext(we),[k,g]=C.useState(!1),[d,v]=C.useState(()=>l),x=()=>{v(!d)},b=a=>{g(a.target.checked)},y=C.useMemo(()=>{var a,j,f,n;return l?`const Client = require('@abtnode/client');
|
|
2
|
+
const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
|
|
3
|
+
const { joinURL } = require('ufo');
|
|
4
|
+
|
|
5
|
+
const { endpoint } = await ensureServerEndpoint("${(j=window.blocklet)==null?void 0:j.appUrl}");
|
|
6
|
+
const fullEndpoint = joinURL(endpoint, '/api/gql');
|
|
7
|
+
|
|
8
|
+
const client = new Client(fullEndpoint);
|
|
9
|
+
client.setAuthAccessKey({
|
|
10
|
+
accessKeyId: "${c}",
|
|
11
|
+
accessKeySecret: "${r}",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const rootDid = '${((f=window.blocklet)==null?void 0:f.appId)||((n=window.blocklet)==null?void 0:n.appPid)}';
|
|
15
|
+
const result = await client.getBlocklet(
|
|
16
|
+
{ input: { did: rootDid, attachRuntimeInfo: false } },
|
|
17
|
+
{ headers: { 'x-access-blocklet': rootDid } }
|
|
18
|
+
);
|
|
19
|
+
`:`curl -H "Authorization: Bearer ${r}" "${(a=window.blocklet)==null?void 0:a.appUrl}${z.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`},[l,c,r]),T=C.useMemo(()=>{var a;return l?`blocklet deploy --endpoint ${(a=window.blocklet)==null?void 0:a.appUrl} --access-key ${c} --access-secret ${r} {blockletPath}/.blocklet/bundle;`:null},[l,c,r]);return e.jsxs(xe,{title:o("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(F,{disabled:l?!k:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:o("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(rt,{children:o(l?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(U,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeyId")}),e.jsx(V,{children:c})]}),e.jsxs(U,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeySecret")}),d?e.jsx(F,{"data-cy":"show-secret-btn",color:"primary",onClick:x,children:o("setting.accessKey.showSecret")}):e.jsx(V,{children:r})]}),!d&&e.jsxs(U,{children:[e.jsx(q,{children:`Access Key ${o("setting.accessKey.usage")}`}),e.jsx(O,{code:y,language:"javascript"}),T&&e.jsx(O,{code:T,language:"bash"})]}),l&&e.jsx("div",{children:e.jsx(Se,{value:"end",disabled:d,control:e.jsx(De,{checked:k,onChange:b}),label:o("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}oe.propTypes={accessKeyId:u.string.isRequired,accessKeySecret:u.string.isRequired,onConfirm:u.func,hideSecret:u.bool};oe.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=$.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-items: center;
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
margin-bottom: 8px;
|
|
25
|
+
`,U=$.div`
|
|
26
|
+
margin-bottom: 24px;
|
|
27
|
+
`,rt=$.div`
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
`;function ne(t){const{t:s,locale:c}=D(),{api:r}=_(),{teamDid:l}=L(),{accessKeyId:o,time:k,remark:g,onDelete:d=()=>{},onClose:v=()=>{}}=t,x=()=>{v()},b=async()=>{try{await r.deleteAccessKey({input:{teamDid:l,accessKeyId:o}}),d()}catch(a){Re.error(a==null?void 0:a.message)}finally{x()}},y=a=>({key:`<b>${o}</b>`,name:`<b>${g}</b>`,time:H(a,c),timeAge:tt(new Date(a),Ie(c))}),T={keyName:g,title:s("setting.accessKey.title"),description:k?`${s("setting.accessKey.description",y(k))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${o}</b>`,name:`<b>${g}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:g}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:b,onCancel:x};return e.jsx(st,{keyName:T.keyName,title:T.title,description:T.description,confirmPlaceholder:T.confirmPlaceholder,confirm:T.confirm,cancel:T.cancel,params:T.params,onConfirm:T.onConfirm,onCancel:T.onCancel})}ne.propTypes={accessKeyId:u.string.isRequired,time:u.string.isRequired,remark:u.string.isRequired,onDelete:u.func,onClose:u.func};ne.defaultProps={onDelete:()=>{},onClose:()=>{}};function ae(t){const{accessKeyId:s,remark:c,onUpdate:r,passport:l,expireAt:o,authType:k,onClose:g}=t,{api:d}=_(),{teamDid:v}=L(),{t:x}=D(),[b,y]=C.useState(!1),T=W(),a=()=>{y(!1),g()},j=async n=>{const{accessKeyId:h,remark:S="",passport:m,expireAt:R,authType:N}=n;y(!0),await d.updateAccessKey({input:{teamDid:v,accessKeyId:h,remark:S.trim(),passport:m,expireAt:R?new Date(R).getTime():null,authType:N}}),r(),a()},f={title:`${x("common.update")} ${x("accessKey")}`,description:(n,h,S)=>e.jsxs(J,{gap:3,children:[e.jsx(M,{label:x("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:n.accessKeyId,disabled:!0}),e.jsx(M,{label:x("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:n.remark,onChange:m=>{h({...n,remark:m.target.value,__disableConfirm:!m.target.value.trim()}),m.target.value.trim()?S(""):S(x("setting.accessKey.remarkInvalid"))}}),e.jsxs(G,{style:{width:"100%"},variant:"outlined",children:[e.jsx(Q,{children:x("setting.accessKey.passport")}),e.jsx(Y,{"data-cy":"update-access-key-select-passport",value:n.passport,onChange:m=>{const R=m.target.value;S(null),h({...n,passport:R,__disableConfirm:!n.remark||!R})},fullWidth:!0,label:x("setting.accessKey.passport"),disabled:b,children:T.map(m=>e.jsx(Z,{value:m.name,"data-cy":`update-access-key-passport-option-${m.name}`,children:e.jsxs(p,{children:[e.jsx("span",{children:m.title||m.name}),e.jsx(p,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:m.description})]})},m.name))})]}),e.jsx(te,{disabled:!0,value:n.authType,onChange:m=>{h({...n,authType:m.target.value})}}),e.jsx(ge,{placeholder:x("setting.accessKey.expireTime"),value:n.expireAt,onChange:m=>{h({...n,expireAt:m,__disableConfirm:!n.passport||!n.remark||!m})}})]}),confirm:x("common.confirm"),cancel:x("common.cancel"),color:"primary",params:{accessKeyId:s,remark:c,passport:l,expireAt:o,authType:k},onConfirm:j,onCancel:a};return e.jsx(ue,{title:f.title,description:f.description,confirm:f.confirm,color:f.color,cancel:f.cancel,params:f.params,onConfirm:f.onConfirm,onCancel:f.onCancel})}ae.propTypes={accessKeyId:u.string.isRequired,remark:u.string,passport:u.string,expireAt:u.string,authType:u.string,onUpdate:u.func,onClose:u.func};ae.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function ie({accessKey:t,onCancel:s}){const{t:c}=D();return e.jsx(xe,{title:c("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(ct,{children:e.jsx(Ce,{accessKey:t})})})}ie.propTypes={accessKey:u.object.isRequired,onCancel:u.func.isRequired};ie.defaultProps={};const ct=$(p)`
|
|
31
|
+
margin-top: -16px;
|
|
32
|
+
|
|
33
|
+
.tabs {
|
|
34
|
+
margin-left: 0;
|
|
35
|
+
margin-right: 0;
|
|
36
|
+
}
|
|
37
|
+
`;function Ce({accessKey:t}){var v,x;const{t:s,locale:c}=D(),{blocklet:r}=nt(),l=W(),o=((r==null?void 0:r.children)||[]).find(b=>{var y;return((y=b==null?void 0:b.meta)==null?void 0:y.did)===t.componentDid}),k=l.find(b=>b.name===t.passport),g=k?k.title:t.passport,d=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(Be,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(V,{children:`blocklet-${de.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(p,{children:be(g,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:t.createdBy?e.jsx(fe,{showDid:!0,did:t.createdBy,cardType:he.Detailed,infoType:ye.Minimal,sx:{border:0,padding:0}}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(B,{value:t.createdAt,type:"all",locale:c}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(B,{value:t.lastUsedAt,type:"all",locale:c}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(ee,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...o?[{label:s("setting.accessKey.component"),content:e.jsxs(p,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx($e,{blocklet:o,ancestors:[r]}),e.jsx(p,{ml:"16px",sx:{minWidth:0},children:e.jsxs(p,{className:"component-header",children:[e.jsx(p,{className:"component-name",children:Pe.getDisplayName(o,!0)}),e.jsx(p,{className:"component-version",children:(v=o==null?void 0:o.meta)==null?void 0:v.version})]})})]},o)}]:[],t.authType!=="signature"?{label:s("setting.accessKey.usage"),content:e.jsx(O,{code:`curl -H "Authorization: Bearer blocklet-${de.toBase58(t.accessKeyPublic)}" "${(x=window.blocklet)==null?void 0:x.appUrl}${z.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`,language:"javascript"})}:null].filter(Boolean)}];return e.jsx(lt,{gap:3,children:e.jsx(p,{className:"info-area",children:d.map(b=>e.jsxs(p,{mb:3,children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:b.title}),e.jsx(p,{className:"info-grid",children:b.items.map(y=>e.jsxs(p,{className:"info-item",children:[e.jsx(p,{className:"info-label",children:e.jsx(I,{variant:"subtitle2",color:"textSecondary",children:y.label})}),e.jsx(p,{sx:{flex:1,minWidth:0},children:y.content})]},y.label))})]},b.title))})})}Ce.propTypes={accessKey:u.object.isRequired};const lt=$(J)`
|
|
38
|
+
.info-card {
|
|
39
|
+
margin-bottom: 24px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.card-content {
|
|
44
|
+
display: flex;
|
|
45
|
+
gap: 32px;
|
|
46
|
+
padding: 24px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.passport-image {
|
|
50
|
+
width: 150px;
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
transition: transform 0.2s ease-in-out;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
transform: scale(1.05);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.info-area {
|
|
61
|
+
flex: 1;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.info-header {
|
|
67
|
+
padding-bottom: 16px;
|
|
68
|
+
border-bottom: 1px solid #eee;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.info-grid {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 12px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.info-item {
|
|
78
|
+
display: flex;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.info-label {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 8px;
|
|
86
|
+
width: 140px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.logs-card {
|
|
90
|
+
.card-header {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: 8px;
|
|
94
|
+
padding: 16px 24px;
|
|
95
|
+
border-bottom: 1px solid #eee;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.MuiTimeline-root {
|
|
99
|
+
padding: 24px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.MuiTimelineContent-root {
|
|
103
|
+
padding: 0px 16px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.MuiTimelineDot-root {
|
|
107
|
+
margin: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`;function X({title:t,tooltipTitle:s,link:c}){const{t:r}=D(),l=je(),[o,k]=C.useState(!1),g=()=>k(v=>!v),d=()=>k(!1);return l?e.jsxs(p,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[t,e.jsx(_e,{onClickAway:d,children:e.jsx("span",{children:e.jsx(E,{open:o,onClose:d,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:e.jsxs(p,{sx:{fontSize:"14px",lineHeight:1.5},children:[s,e.jsx(p,{sx:{color:"info.main",ml:.5},component:"a",href:c,target:"_blank",rel:"noopener noreferrer",children:r("dashboard.document")})]}),children:e.jsx(pe,{size:"small",onClick:g,sx:{ml:.5},children:e.jsx(me,{fontSize:"14"})})})})})]}):e.jsxs(p,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[t,e.jsx(E,{enterTouchDelay:0,leaveTouchDelay:3e3,title:e.jsxs(p,{sx:{fontSize:"14px",lineHeight:1.5},children:[s,e.jsx(p,{sx:{color:"info.main",ml:.5},component:"a",href:c,target:"_blank",rel:"noopener noreferrer",children:r("dashboard.document")})]}),children:e.jsx(pe,{size:"small",sx:{ml:.5},children:e.jsx(me,{fontSize:"14"})})})]})}X.propTypes={title:u.string.isRequired,tooltipTitle:u.string.isRequired,link:u.string.isRequired};function dt(){var ce,le;const{t,locale:s}=D(),{api:c,inService:r}=_(),{teamDid:l}=L(),[o,k]=C.useState({}),[g,d]=C.useState(null),[v,x]=C.useState(null),[b,y]=C.useState(null),T=je(),a=W(),j=C.useRef(null),f=`access-keys-${l}`,n=Ge(f),[h,S]=C.useState({searchText:n.searchText||"",pageSize:n.rowsPerPage||10,page:1}),m=it(async()=>await c.getAccessKeys({input:{teamDid:l,paging:{page:h.page,pageSize:h.pageSize}}}),[h.page,h.pageSize]),{loading:R,error:N}=m,P=C.useMemo(()=>{var i;return((i=m.value)==null?void 0:i.list)||[]},[(ce=m.value)==null?void 0:ce.list]),ke=C.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(i,{rowIndex:A})=>{const w=P[A];return e.jsx(p,{display:"flex",alignItems:"center",gap:2,children:e.jsx(I,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:i=>e.jsx(Le,{showDidLogo:!1,children:i})}},{label:t("common.role"),name:"passport",options:{customBodyRender:i=>{const A=a.find(K=>K.name===i),w=A?A.title:i;return e.jsx(p,{children:be(w,i)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:i=>e.jsx(I,{children:i})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:i=>e.jsx(I,{children:t(`setting.accessKey.${i}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:i=>e.jsx(E,{title:H(i,s),children:i?e.jsx(B,{value:i,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:i=>e.jsx(E,{title:H(i,s),children:i?e.jsx(B,{value:i,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:i=>i?e.jsx(ee,{value:i}):t("common.neverExpired")}},{label:t("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:i=>i?e.jsx(fe,{showDid:!0,did:i,cardType:he.Detailed,infoType:ye.Minimal,sx:{border:0,padding:0}}):"-"}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(i,{rowIndex:A})=>{const w=P[A];return e.jsx(at,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(Ze,{}),text:t("common.edit"),onClick:K=>{K.stopPropagation(),y(w)}},{icon:e.jsx(Ye,{}),text:t("common.delete"),onClick:K=>{K.stopPropagation(),x(w)}}]})}}}],[P,s,t,a,x,y]),ve=({page:i,rowsPerPage:A,searchText:w})=>{h.pageSize!==A?S(K=>({...K,searchText:"",pageSize:A,page:1})):h.page!==i+1?S(K=>({...K,searchText:"",page:i+1})):h.searchText!==w&&S(K=>({...K,searchText:w,page:1}))},re=h.searchText?P.filter(i=>i.accessKeyId.toLowerCase().includes(h.searchText.toLowerCase())||(i.remark||"").toLowerCase().includes(h.searchText.toLowerCase())):P;return N?e.jsx(Ne,{severity:"error",children:ze(N)}):e.jsxs(p,{ref:j,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[T?e.jsx(X,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(Qe,{durable:f,durableKeys:["page","rowsPerPage"],data:re,columns:ke,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:h.page-1,rowsPerPage:h.pageSize,count:((le=m.value)==null?void 0:le.count)||0,searchDebounceTime:600,onRowClick(i,{dataIndex:A},w){var K;if((K=j.current)!=null&&K.contains(w.target)){const Te=re[A];d(Te)}}},loading:R,onChange:ve,title:T?null:e.jsx(X,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(ot,{permission:r?"":"mutate_accessKey",children:e.jsx(se,{onCreate:i=>{const{accessKeyId:A,accessKeySecret:w,authType:K}=i;k({show:!0,accessKeyId:A,accessKeySecret:w,authType:K})}})})],emptyNode:e.jsx(Je,{children:t("oauth.client.empty")})}),o.show&&e.jsx(oe,{hideSecret:o.authType==="signature",onConfirm:()=>{m.retry(),k({show:!1})},...o}),g&&e.jsx(ie,{onCancel:()=>d(null),accessKey:g}),v&&e.jsx(ne,{accessKeyId:v.accessKeyId,time:v.lastUsedAt,remark:v.remark||"N/A",onDelete:m.retry,onClose:()=>x(null)}),b&&e.jsx(ae,{...b,onUpdate:m.retry,onClose:()=>y(null)})]})}function pt(){return e.jsx(dt,{})}function Cs(){const t=Ee(),{t:s}=D(),{info:c}=We(),{tab:r="members"}=qe(),l=j=>Me(j,c),{data:o}=Ue(),k=C.useCallback(j=>{const f=o.find(n=>[n.meta.did,n.appDid,n.appPid].includes(j));return f?f.meta.title:"Server"},[o]),g=C.useRef(null);g.current=k;const d=C.useCallback(()=>e.jsx(He,{showScope:!0,scopeFormatter:g.current}),[]),v=C.useCallback(()=>e.jsx(Oe,{type:"server",createPassportSvg:l}),[]),x=c.did,b=j=>{t(`/team/${j}`)},y={members:{label:s("common.members"),value:"members",component:v},passports:{label:s("team.member.passports"),value:"passports",component:Ve},"access-keys":{label:s("common.accessKey"),value:"access-keys",component:pt},"audit-logs":{label:s("common.auditLogs"),value:"audit-logs",component:d}},T=Object.values(y).map(({label:j,value:f})=>({label:j,value:f})),a=y[r]||y.member;return e.jsx(Xe,{teamDid:x,children:e.jsxs(mt,{children:[e.jsx(I,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:s("common.team")}),e.jsx(Fe,{tabs:T,current:r,onChange:b,scrollButtons:"auto"}),e.jsx("div",{className:"page-content",children:e.jsx(a.component,{createPassportSvg:l})})]})})}const mt=$.main`
|
|
111
|
+
.page-header {
|
|
112
|
+
display: flex;
|
|
113
|
+
justify-content: space-between;
|
|
114
|
+
align-items: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.page-content {
|
|
118
|
+
margin-top: 24px;
|
|
119
|
+
}
|
|
120
|
+
`;export{Cs as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,Q as d,j as e,
|
|
1
|
+
import{r as o,Q as d,j as e,eo as c,ba as I,ea as M,bx as b,fj as E,fi as P,dq as p,fk as S}from"./index-vDSh3Cp8.js";import{B as z}from"./ButtonGroup-B_aX6xrX.js";function A(r){const{size:u="medium",color:s="primary",menu:a=[],children:i=null,variant:m="contained",onClick:f=P,menuButtonProps:x={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,C)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:C})):a,y=()=>{l(t=>!t)},k=t=>{n.current&&n.current.contains(t.target)||l(!1)},B=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:m,size:u,color:s,ref:n,...h,children:[typeof i=="function"?i():e.jsx(c,{onClick:f,color:s,children:i}),e.jsx(c,{onClick:y,color:s,...x,"aria-label":"more functions",children:e.jsx(I,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(M,{children:e.jsx(b,{onClickAway:k,children:e.jsx(E,{onClick:B,children:g})})})})]})}A.Item=d;const L=p(z)`
|
|
2
2
|
> .MuiButtonBase-root:last-of-type {
|
|
3
3
|
min-width: 2em;
|
|
4
4
|
padding-left: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b_ as ft,b$ as ht,b8 as A,bW as $t,cd as jt,bX as f,r as d,c0 as vt,bZ as nt,c2 as N,j as b,c3 as mt,dg as oe,dh as Ft,di as Ht,dj as At,dk as le,dl as re,c1 as rt,al as ne,dm as bt,dn as se,dp as ae}from"./index-CsTPddhu.js";let U;function Ot(){if(U)return U;const t=document.createElement("div"),e=document.createElement("div");return e.style.width="10px",e.style.height="1px",t.appendChild(e),t.dir="rtl",t.style.fontSize="14px",t.style.width="4px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.overflow="scroll",document.body.appendChild(t),U="reverse",t.scrollLeft>0?U="default":(t.scrollLeft=1,t.scrollLeft===0&&(U="negative")),document.body.removeChild(t),U}function ie(t,e){const l=t.scrollLeft;if(e!=="rtl")return l;switch(Ot()){case"negative":return t.scrollWidth-t.clientWidth+l;case"reverse":return t.scrollWidth-t.clientWidth-l;default:return l}}function ce(t){return ht("MuiTab",t)}const k=ft("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","iconWrapper"]),de=["className","disabled","disableFocusRipple","fullWidth","icon","iconPosition","indicator","label","onChange","onClick","onFocus","selected","selectionFollowsFocus","textColor","value","wrapped"],ue=t=>{const{classes:e,textColor:l,fullWidth:a,wrapped:s,icon:n,label:u,selected:v,disabled:p}=t,x={root:["root",n&&u&&"labelIcon",`textColor${jt(l)}`,a&&"fullWidth",s&&"wrapped",v&&"selected",p&&"disabled"],iconWrapper:["iconWrapper"]};return mt(x,ce,e)},be=A($t,{name:"MuiTab",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.label&&l.icon&&e.labelIcon,e[`textColor${jt(l.textColor)}`],l.fullWidth&&e.fullWidth,l.wrapped&&e.wrapped,{[`& .${k.iconWrapper}`]:e.iconWrapper}]}})(({theme:t,ownerState:e})=>f({},t.typography.button,{maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center"},e.label&&{flexDirection:e.iconPosition==="top"||e.iconPosition==="bottom"?"column":"row"},{lineHeight:1.25},e.icon&&e.label&&{minHeight:72,paddingTop:9,paddingBottom:9,[`& > .${k.iconWrapper}`]:f({},e.iconPosition==="top"&&{marginBottom:6},e.iconPosition==="bottom"&&{marginTop:6},e.iconPosition==="start"&&{marginRight:t.spacing(1)},e.iconPosition==="end"&&{marginLeft:t.spacing(1)})},e.textColor==="inherit"&&{color:"inherit",opacity:.6,[`&.${k.selected}`]:{opacity:1},[`&.${k.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity}},e.textColor==="primary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.primary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.textColor==="secondary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.secondary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.fullWidth&&{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"},e.wrapped&&{fontSize:t.typography.pxToRem(12)})),St=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTab"}),{className:s,disabled:n=!1,disableFocusRipple:u=!1,fullWidth:v,icon:p,iconPosition:x="top",indicator:B,label:y,onChange:m,onClick:w,onFocus:L,selected:T,selectionFollowsFocus:g,textColor:O="inherit",value:E,wrapped:st=!1}=a,X=nt(a,de),V=f({},a,{disabled:n,disableFocusRipple:u,selected:T,icon:!!p,iconPosition:x,label:!!y,fullWidth:v,textColor:O,wrapped:st}),_=ue(V),$=p&&y&&d.isValidElement(p)?d.cloneElement(p,{className:N(_.iconWrapper,p.props.className)}):p,J=R=>{!T&&m&&m(R,E),w&&w(R)},D=R=>{g&&!T&&m&&m(R,E),L&&L(R)};return b.jsxs(be,f({focusRipple:!u,className:N(_.root,s),ref:l,role:"tab","aria-selected":T,disabled:n,onClick:J,onFocus:D,ownerState:V,tabIndex:T?0:-1},X,{children:[x==="top"||x==="start"?b.jsxs(d.Fragment,{children:[$,y]}):b.jsxs(d.Fragment,{children:[y,$]}),B]}))});function pe(t){return(1+Math.sin(Math.PI*t-Math.PI/2))/2}function fe(t,e,l,a={},s=()=>{}){const{ease:n=pe,duration:u=300}=a;let v=null;const p=e[t];let x=!1;const B=()=>{x=!0},y=m=>{if(x){s(new Error("Animation cancelled"));return}v===null&&(v=m);const w=Math.min(1,(m-v)/u);if(e[t]=n(w)*(l-p)+p,w>=1){requestAnimationFrame(()=>{s(null)});return}requestAnimationFrame(y)};return p===l?(s(new Error("Element already at target position")),B):(requestAnimationFrame(y),B)}const he=["onChange"],ve={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function me(t){const{onChange:e}=t,l=nt(t,he),a=d.useRef(),s=d.useRef(null),n=()=>{a.current=s.current.offsetHeight-s.current.clientHeight};return oe(()=>{const u=Ft(()=>{const p=a.current;n(),p!==a.current&&e(a.current)}),v=Ht(s.current);return v.addEventListener("resize",u),()=>{u.clear(),v.removeEventListener("resize",u)}},[e]),d.useEffect(()=>{n(),e(a.current)},[e]),b.jsx("div",f({style:ve},l,{ref:s}))}function Se(t){return ht("MuiTabScrollButton",t)}const xe=ft("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),ge=["className","slots","slotProps","direction","orientation","disabled"],ye=t=>{const{classes:e,orientation:l,disabled:a}=t;return mt({root:["root",l,a&&"disabled"]},Se,e)},Ce=A($t,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.orientation&&e[l.orientation]]}})(({ownerState:t})=>f({width:40,flexShrink:0,opacity:.8,[`&.${xe.disabled}`]:{opacity:0}},t.orientation==="vertical"&&{width:"100%",height:40,"& svg":{transform:`rotate(${t.isRtl?-90:90}deg)`}})),Be=d.forwardRef(function(e,l){var a,s;const n=vt({props:e,name:"MuiTabScrollButton"}),{className:u,slots:v={},slotProps:p={},direction:x}=n,B=nt(n,ge),y=At(),m=f({isRtl:y},n),w=ye(m),L=(a=v.StartScrollButtonIcon)!=null?a:le,T=(s=v.EndScrollButtonIcon)!=null?s:re,g=rt({elementType:L,externalSlotProps:p.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m}),O=rt({elementType:T,externalSlotProps:p.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m});return b.jsx(Ce,f({component:"div",className:N(w.root,u),ref:l,role:null,ownerState:m,tabIndex:null},B,{children:x==="left"?b.jsx(L,f({},g)):b.jsx(T,f({},O))}))});function we(t){return ht("MuiTabs",t)}const pt=ft("MuiTabs",["root","vertical","flexContainer","flexContainerVertical","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),Te=["aria-label","aria-labelledby","action","centered","children","className","component","allowScrollButtonsMobile","indicatorColor","onChange","orientation","ScrollButtonComponent","scrollButtons","selectionFollowsFocus","slots","slotProps","TabIndicatorProps","TabScrollButtonProps","textColor","value","variant","visibleScrollbar"],Pt=(t,e)=>t===e?t.firstChild:e&&e.nextElementSibling?e.nextElementSibling:t.firstChild,kt=(t,e)=>t===e?t.lastChild:e&&e.previousElementSibling?e.previousElementSibling:t.lastChild,lt=(t,e,l)=>{let a=!1,s=l(t,e);for(;s;){if(s===t.firstChild){if(a)return;a=!0}const n=s.disabled||s.getAttribute("aria-disabled")==="true";if(!s.hasAttribute("tabindex")||n)s=l(t,s);else{s.focus();return}}},Me=t=>{const{vertical:e,fixed:l,hideScrollbar:a,scrollableX:s,scrollableY:n,centered:u,scrollButtonsHideMobile:v,classes:p}=t;return mt({root:["root",e&&"vertical"],scroller:["scroller",l&&"fixed",a&&"hideScrollbar",s&&"scrollableX",n&&"scrollableY"],flexContainer:["flexContainer",e&&"flexContainerVertical",u&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",v&&"scrollButtonsHideMobile"],scrollableX:[s&&"scrollableX"],hideScrollbar:[a&&"hideScrollbar"]},we,p)},Ie=A("div",{name:"MuiTabs",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[{[`& .${pt.scrollButtons}`]:e.scrollButtons},{[`& .${pt.scrollButtons}`]:l.scrollButtonsHideMobile&&e.scrollButtonsHideMobile},e.root,l.vertical&&e.vertical]}})(({ownerState:t,theme:e})=>f({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex"},t.vertical&&{flexDirection:"column"},t.scrollButtonsHideMobile&&{[`& .${pt.scrollButtons}`]:{[e.breakpoints.down("sm")]:{display:"none"}}})),Ee=A("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.scroller,l.fixed&&e.fixed,l.hideScrollbar&&e.hideScrollbar,l.scrollableX&&e.scrollableX,l.scrollableY&&e.scrollableY]}})(({ownerState:t})=>f({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap"},t.fixed&&{overflowX:"hidden",width:"100%"},t.hideScrollbar&&{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},t.scrollableX&&{overflowX:"auto",overflowY:"hidden"},t.scrollableY&&{overflowY:"auto",overflowX:"hidden"})),Re=A("div",{name:"MuiTabs",slot:"FlexContainer",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.flexContainer,l.vertical&&e.flexContainerVertical,l.centered&&e.centered]}})(({ownerState:t})=>f({display:"flex"},t.vertical&&{flexDirection:"column"},t.centered&&{justifyContent:"center"})),We=A("span",{name:"MuiTabs",slot:"Indicator",overridesResolver:(t,e)=>e.indicator})(({ownerState:t,theme:e})=>f({position:"absolute",height:2,bottom:0,width:"100%",transition:e.transitions.create()},t.indicatorColor==="primary"&&{backgroundColor:(e.vars||e).palette.primary.main},t.indicatorColor==="secondary"&&{backgroundColor:(e.vars||e).palette.secondary.main},t.vertical&&{height:"100%",width:2,right:0})),ze=A(me)({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Nt={},xt=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTabs"}),s=ne(),n=At(),{"aria-label":u,"aria-labelledby":v,action:p,centered:x=!1,children:B,className:y,component:m="div",allowScrollButtonsMobile:w=!1,indicatorColor:L="primary",onChange:T,orientation:g="horizontal",ScrollButtonComponent:O=Be,scrollButtons:E="auto",selectionFollowsFocus:st,slots:X={},slotProps:V={},TabIndicatorProps:_={},TabScrollButtonProps:$={},textColor:J="primary",value:D,variant:R="standard",visibleScrollbar:at=!1}=a,Xt=nt(a,Te),M=R==="scrollable",C=g==="vertical",K=C?"scrollTop":"scrollLeft",Q=C?"top":"left",tt=C?"bottom":"right",it=C?"clientHeight":"clientWidth",q=C?"height":"width",j=f({},a,{component:m,allowScrollButtonsMobile:w,indicatorColor:L,orientation:g,vertical:C,scrollButtons:E,textColor:J,variant:R,visibleScrollbar:at,fixed:!M,hideScrollbar:M&&!at,scrollableX:M&&!C,scrollableY:M&&C,centered:x&&!M,scrollButtonsHideMobile:!w}),z=Me(j),_t=rt({elementType:X.StartScrollButtonIcon,externalSlotProps:V.startScrollButtonIcon,ownerState:j}),Dt=rt({elementType:X.EndScrollButtonIcon,externalSlotProps:V.endScrollButtonIcon,ownerState:j}),[gt,Ut]=d.useState(!1),[F,yt]=d.useState(Nt),[Ct,Yt]=d.useState(!1),[Bt,Vt]=d.useState(!1),[wt,Kt]=d.useState(!1),[Tt,qt]=d.useState({overflow:"hidden",scrollbarWidth:0}),Mt=new Map,W=d.useRef(null),H=d.useRef(null),It=()=>{const o=W.current;let r;if(o){const i=o.getBoundingClientRect();r={clientWidth:o.clientWidth,scrollLeft:o.scrollLeft,scrollTop:o.scrollTop,scrollLeftNormalized:ie(o,n?"rtl":"ltr"),scrollWidth:o.scrollWidth,top:i.top,bottom:i.bottom,left:i.left,right:i.right}}let c;if(o&&D!==!1){const i=H.current.children;if(i.length>0){const h=i[Mt.get(D)];c=h?h.getBoundingClientRect():null}}return{tabsMeta:r,tabMeta:c}},G=bt(()=>{const{tabsMeta:o,tabMeta:r}=It();let c=0,i;if(C)i="top",r&&o&&(c=r.top-o.top+o.scrollTop);else if(i=n?"right":"left",r&&o){const S=n?o.scrollLeftNormalized+o.clientWidth-o.scrollWidth:o.scrollLeft;c=(n?-1:1)*(r[i]-o[i]+S)}const h={[i]:c,[q]:r?r[q]:0};if(isNaN(F[i])||isNaN(F[q]))yt(h);else{const S=Math.abs(F[i]-h[i]),I=Math.abs(F[q]-h[q]);(S>=1||I>=1)&&yt(h)}}),ct=(o,{animation:r=!0}={})=>{r?fe(K,W.current,o,{duration:s.transitions.duration.standard}):W.current[K]=o},Et=o=>{let r=W.current[K];C?r+=o:(r+=o*(n?-1:1),r*=n&&Ot()==="reverse"?-1:1),ct(r)},Rt=()=>{const o=W.current[it];let r=0;const c=Array.from(H.current.children);for(let i=0;i<c.length;i+=1){const h=c[i];if(r+h[it]>o){i===0&&(r=o);break}r+=h[it]}return r},Gt=()=>{Et(-1*Rt())},Zt=()=>{Et(Rt())},Jt=d.useCallback(o=>{qt({overflow:null,scrollbarWidth:o})},[]),Qt=()=>{const o={};o.scrollbarSizeListener=M?b.jsx(ze,{onChange:Jt,className:N(z.scrollableX,z.hideScrollbar)}):null;const c=M&&(E==="auto"&&(Ct||Bt)||E===!0);return o.scrollButtonStart=c?b.jsx(O,f({slots:{StartScrollButtonIcon:X.StartScrollButtonIcon},slotProps:{startScrollButtonIcon:_t},orientation:g,direction:n?"right":"left",onClick:Gt,disabled:!Ct},$,{className:N(z.scrollButtons,$.className)})):null,o.scrollButtonEnd=c?b.jsx(O,f({slots:{EndScrollButtonIcon:X.EndScrollButtonIcon},slotProps:{endScrollButtonIcon:Dt},orientation:g,direction:n?"left":"right",onClick:Zt,disabled:!Bt},$,{className:N(z.scrollButtons,$.className)})):null,o},Wt=bt(o=>{const{tabsMeta:r,tabMeta:c}=It();if(!(!c||!r)){if(c[Q]<r[Q]){const i=r[K]+(c[Q]-r[Q]);ct(i,{animation:o})}else if(c[tt]>r[tt]){const i=r[K]+(c[tt]-r[tt]);ct(i,{animation:o})}}}),et=bt(()=>{M&&E!==!1&&Kt(!wt)});d.useEffect(()=>{const o=Ft(()=>{W.current&&G()});let r;const c=S=>{S.forEach(I=>{I.removedNodes.forEach(Z=>{var P;(P=r)==null||P.unobserve(Z)}),I.addedNodes.forEach(Z=>{var P;(P=r)==null||P.observe(Z)})}),o(),et()},i=Ht(W.current);i.addEventListener("resize",o);let h;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(o),Array.from(H.current.children).forEach(S=>{r.observe(S)})),typeof MutationObserver<"u"&&(h=new MutationObserver(c),h.observe(H.current,{childList:!0})),()=>{var S,I;o.clear(),i.removeEventListener("resize",o),(S=h)==null||S.disconnect(),(I=r)==null||I.disconnect()}},[G,et]),d.useEffect(()=>{const o=Array.from(H.current.children),r=o.length;if(typeof IntersectionObserver<"u"&&r>0&&M&&E!==!1){const c=o[0],i=o[r-1],h={root:W.current,threshold:.99},S=ut=>{Yt(!ut[0].isIntersecting)},I=new IntersectionObserver(S,h);I.observe(c);const Z=ut=>{Vt(!ut[0].isIntersecting)},P=new IntersectionObserver(Z,h);return P.observe(i),()=>{I.disconnect(),P.disconnect()}}},[M,E,wt,B==null?void 0:B.length]),d.useEffect(()=>{Ut(!0)},[]),d.useEffect(()=>{G()}),d.useEffect(()=>{Wt(Nt!==F)},[Wt,F]),d.useImperativeHandle(p,()=>({updateIndicator:G,updateScrollButtons:et}),[G,et]);const zt=b.jsx(We,f({},_,{className:N(z.indicator,_.className),ownerState:j,style:f({},F,_.style)}));let ot=0;const te=d.Children.map(B,o=>{if(!d.isValidElement(o))return null;const r=o.props.value===void 0?ot:o.props.value;Mt.set(r,ot);const c=r===D;return ot+=1,d.cloneElement(o,f({fullWidth:R==="fullWidth",indicator:c&&!gt&&zt,selected:c,selectionFollowsFocus:st,onChange:T,textColor:J,value:r},ot===1&&D===!1&&!o.props.tabIndex?{tabIndex:0}:{}))}),ee=o=>{const r=H.current,c=se(r).activeElement;if(c.getAttribute("role")!=="tab")return;let h=g==="horizontal"?"ArrowLeft":"ArrowUp",S=g==="horizontal"?"ArrowRight":"ArrowDown";switch(g==="horizontal"&&n&&(h="ArrowRight",S="ArrowLeft"),o.key){case h:o.preventDefault(),lt(r,c,kt);break;case S:o.preventDefault(),lt(r,c,Pt);break;case"Home":o.preventDefault(),lt(r,null,Pt);break;case"End":o.preventDefault(),lt(r,null,kt);break}},dt=Qt();return b.jsxs(Ie,f({className:N(z.root,y),ownerState:j,ref:l,as:m},Xt,{children:[dt.scrollButtonStart,dt.scrollbarSizeListener,b.jsxs(Ee,{className:z.scroller,ownerState:j,style:{overflow:Tt.overflow,[C?`margin${n?"Left":"Right"}`:"marginBottom"]:at?void 0:-Tt.scrollbarWidth},ref:W,children:[b.jsx(Re,{"aria-label":u,"aria-labelledby":v,"aria-orientation":g==="vertical"?"vertical":null,className:z.flexContainer,ownerState:j,onKeyDown:ee,ref:H,role:"tablist",children:te}),gt&&zt]}),dt.scrollButtonEnd]}))}),Lt="index",Y={tabs:`${Lt}-tabs`,tab:`${Lt}-tab`},Pe=ae(xt)(({theme:t})=>({[`& .${Y.tabs}`]:{},[`& .${Y.tab}`]:{fontSize:"0.875rem",[t.breakpoints.up("md")]:{fontSize:"1rem"}}}));function ke({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":{borderRadius:"100vw"},".MuiTabs-flexContainer":{borderRadius:"100vw",backgroundColor:"grey.100",padding:.5,display:"inline-flex",columnGap:.25,maxWidth:"100%",overflowX:"auto"},".MuiTab-root":{borderRadius:"100vw",border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,color:"text.secondary",fontSize:"13px",fontWeight:"normal",textTransform:"capitalize",transition:"background-color 0.2s ease","&.Mui-selected, &:hover":{backgroundColor:"action.selected",borderColor:"grey.100",color:"grey.A700"}},".MuiTabs-indicator":{display:"none"},...s.sx},children:t.map(n=>b.jsx(St,{className:Y.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function Ne({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":s.orientation!=="vertical"?{"&::after":{content:'""',display:"block",position:"sticky",left:0,zIndex:-1,width:"100%",height:"1px",backgroundColor:"grey.300"}}:{},".MuiTabs-flexContainer":{display:"inline-flex",columnGap:2.5,px:0,pb:.5},".MuiTab-root":{border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,px:0,color:"text.secondary",fontSize:"14px",fontWeight:500,textTransform:"capitalize",minWidth:"auto","&.Mui-selected, &:hover":{color:"primary.main"}},".MuiTabs-indicator":{height:"1px",backgroundColor:"primary.main"},...s.sx},children:t.map(n=>b.jsx(St,{className:Y.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function $e({tabs:t,current:e,onChange:l,variant:a,iconPosition:s,...n}){return a==="card"?b.jsx(ke,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):a==="line"?b.jsx(Ne,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):b.jsx(Pe,{scrollButtons:"auto",variant:"scrollable",value:e,onChange:(u,v)=>l(v),indicatorColor:"primary",...n,className:[Y.tabs,n.className||""].join(" "),children:t.map(u=>b.jsx(St,{className:Y.tab,value:u.value,label:u.label,icon:u.icon,iconPosition:s},u.value))})}export{$e as T,xt as a,St as b,Ot as d,ie as g,pt as t};
|
|
1
|
+
import{b$ as ft,c0 as ht,b8 as A,bX as $t,ce as jt,bY as f,r as d,c1 as vt,b_ as nt,c3 as N,j as b,c4 as mt,dh as oe,di as Ft,dj as Ht,dk as At,dl as le,dm as re,c2 as rt,al as ne,dn as bt,dp as se,dq as ae}from"./index-vDSh3Cp8.js";let Y;function Ot(){if(Y)return Y;const t=document.createElement("div"),e=document.createElement("div");return e.style.width="10px",e.style.height="1px",t.appendChild(e),t.dir="rtl",t.style.fontSize="14px",t.style.width="4px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.overflow="scroll",document.body.appendChild(t),Y="reverse",t.scrollLeft>0?Y="default":(t.scrollLeft=1,t.scrollLeft===0&&(Y="negative")),document.body.removeChild(t),Y}function ie(t,e){const l=t.scrollLeft;if(e!=="rtl")return l;switch(Ot()){case"negative":return t.scrollWidth-t.clientWidth+l;case"reverse":return t.scrollWidth-t.clientWidth-l;default:return l}}function ce(t){return ht("MuiTab",t)}const k=ft("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","iconWrapper"]),de=["className","disabled","disableFocusRipple","fullWidth","icon","iconPosition","indicator","label","onChange","onClick","onFocus","selected","selectionFollowsFocus","textColor","value","wrapped"],ue=t=>{const{classes:e,textColor:l,fullWidth:a,wrapped:s,icon:n,label:u,selected:v,disabled:p}=t,x={root:["root",n&&u&&"labelIcon",`textColor${jt(l)}`,a&&"fullWidth",s&&"wrapped",v&&"selected",p&&"disabled"],iconWrapper:["iconWrapper"]};return mt(x,ce,e)},be=A($t,{name:"MuiTab",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.label&&l.icon&&e.labelIcon,e[`textColor${jt(l.textColor)}`],l.fullWidth&&e.fullWidth,l.wrapped&&e.wrapped,{[`& .${k.iconWrapper}`]:e.iconWrapper}]}})(({theme:t,ownerState:e})=>f({},t.typography.button,{maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center"},e.label&&{flexDirection:e.iconPosition==="top"||e.iconPosition==="bottom"?"column":"row"},{lineHeight:1.25},e.icon&&e.label&&{minHeight:72,paddingTop:9,paddingBottom:9,[`& > .${k.iconWrapper}`]:f({},e.iconPosition==="top"&&{marginBottom:6},e.iconPosition==="bottom"&&{marginTop:6},e.iconPosition==="start"&&{marginRight:t.spacing(1)},e.iconPosition==="end"&&{marginLeft:t.spacing(1)})},e.textColor==="inherit"&&{color:"inherit",opacity:.6,[`&.${k.selected}`]:{opacity:1},[`&.${k.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity}},e.textColor==="primary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.primary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.textColor==="secondary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.secondary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.fullWidth&&{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"},e.wrapped&&{fontSize:t.typography.pxToRem(12)})),St=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTab"}),{className:s,disabled:n=!1,disableFocusRipple:u=!1,fullWidth:v,icon:p,iconPosition:x="top",indicator:B,label:y,onChange:m,onClick:w,onFocus:L,selected:T,selectionFollowsFocus:g,textColor:O="inherit",value:E,wrapped:st=!1}=a,X=nt(a,de),V=f({},a,{disabled:n,disableFocusRipple:u,selected:T,icon:!!p,iconPosition:x,label:!!y,fullWidth:v,textColor:O,wrapped:st}),_=ue(V),$=p&&y&&d.isValidElement(p)?d.cloneElement(p,{className:N(_.iconWrapper,p.props.className)}):p,Q=R=>{!T&&m&&m(R,E),w&&w(R)},D=R=>{g&&!T&&m&&m(R,E),L&&L(R)};return b.jsxs(be,f({focusRipple:!u,className:N(_.root,s),ref:l,role:"tab","aria-selected":T,disabled:n,onClick:Q,onFocus:D,ownerState:V,tabIndex:T?0:-1},X,{children:[x==="top"||x==="start"?b.jsxs(d.Fragment,{children:[$,y]}):b.jsxs(d.Fragment,{children:[y,$]}),B]}))});function pe(t){return(1+Math.sin(Math.PI*t-Math.PI/2))/2}function fe(t,e,l,a={},s=()=>{}){const{ease:n=pe,duration:u=300}=a;let v=null;const p=e[t];let x=!1;const B=()=>{x=!0},y=m=>{if(x){s(new Error("Animation cancelled"));return}v===null&&(v=m);const w=Math.min(1,(m-v)/u);if(e[t]=n(w)*(l-p)+p,w>=1){requestAnimationFrame(()=>{s(null)});return}requestAnimationFrame(y)};return p===l?(s(new Error("Element already at target position")),B):(requestAnimationFrame(y),B)}const he=["onChange"],ve={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function me(t){const{onChange:e}=t,l=nt(t,he),a=d.useRef(),s=d.useRef(null),n=()=>{a.current=s.current.offsetHeight-s.current.clientHeight};return oe(()=>{const u=Ft(()=>{const p=a.current;n(),p!==a.current&&e(a.current)}),v=Ht(s.current);return v.addEventListener("resize",u),()=>{u.clear(),v.removeEventListener("resize",u)}},[e]),d.useEffect(()=>{n(),e(a.current)},[e]),b.jsx("div",f({style:ve},l,{ref:s}))}function Se(t){return ht("MuiTabScrollButton",t)}const xe=ft("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),ge=["className","slots","slotProps","direction","orientation","disabled"],ye=t=>{const{classes:e,orientation:l,disabled:a}=t;return mt({root:["root",l,a&&"disabled"]},Se,e)},Ce=A($t,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.root,l.orientation&&e[l.orientation]]}})(({ownerState:t})=>f({width:40,flexShrink:0,opacity:.8,[`&.${xe.disabled}`]:{opacity:0}},t.orientation==="vertical"&&{width:"100%",height:40,"& svg":{transform:`rotate(${t.isRtl?-90:90}deg)`}})),Be=d.forwardRef(function(e,l){var a,s;const n=vt({props:e,name:"MuiTabScrollButton"}),{className:u,slots:v={},slotProps:p={},direction:x}=n,B=nt(n,ge),y=At(),m=f({isRtl:y},n),w=ye(m),L=(a=v.StartScrollButtonIcon)!=null?a:le,T=(s=v.EndScrollButtonIcon)!=null?s:re,g=rt({elementType:L,externalSlotProps:p.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m}),O=rt({elementType:T,externalSlotProps:p.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m});return b.jsx(Ce,f({component:"div",className:N(w.root,u),ref:l,role:null,ownerState:m,tabIndex:null},B,{children:x==="left"?b.jsx(L,f({},g)):b.jsx(T,f({},O))}))});function we(t){return ht("MuiTabs",t)}const pt=ft("MuiTabs",["root","vertical","flexContainer","flexContainerVertical","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),Te=["aria-label","aria-labelledby","action","centered","children","className","component","allowScrollButtonsMobile","indicatorColor","onChange","orientation","ScrollButtonComponent","scrollButtons","selectionFollowsFocus","slots","slotProps","TabIndicatorProps","TabScrollButtonProps","textColor","value","variant","visibleScrollbar"],Pt=(t,e)=>t===e?t.firstChild:e&&e.nextElementSibling?e.nextElementSibling:t.firstChild,kt=(t,e)=>t===e?t.lastChild:e&&e.previousElementSibling?e.previousElementSibling:t.lastChild,lt=(t,e,l)=>{let a=!1,s=l(t,e);for(;s;){if(s===t.firstChild){if(a)return;a=!0}const n=s.disabled||s.getAttribute("aria-disabled")==="true";if(!s.hasAttribute("tabindex")||n)s=l(t,s);else{s.focus();return}}},Me=t=>{const{vertical:e,fixed:l,hideScrollbar:a,scrollableX:s,scrollableY:n,centered:u,scrollButtonsHideMobile:v,classes:p}=t;return mt({root:["root",e&&"vertical"],scroller:["scroller",l&&"fixed",a&&"hideScrollbar",s&&"scrollableX",n&&"scrollableY"],flexContainer:["flexContainer",e&&"flexContainerVertical",u&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",v&&"scrollButtonsHideMobile"],scrollableX:[s&&"scrollableX"],hideScrollbar:[a&&"hideScrollbar"]},we,p)},Ie=A("div",{name:"MuiTabs",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[{[`& .${pt.scrollButtons}`]:e.scrollButtons},{[`& .${pt.scrollButtons}`]:l.scrollButtonsHideMobile&&e.scrollButtonsHideMobile},e.root,l.vertical&&e.vertical]}})(({ownerState:t,theme:e})=>f({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex"},t.vertical&&{flexDirection:"column"},t.scrollButtonsHideMobile&&{[`& .${pt.scrollButtons}`]:{[e.breakpoints.down("sm")]:{display:"none"}}})),Ee=A("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.scroller,l.fixed&&e.fixed,l.hideScrollbar&&e.hideScrollbar,l.scrollableX&&e.scrollableX,l.scrollableY&&e.scrollableY]}})(({ownerState:t})=>f({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap"},t.fixed&&{overflowX:"hidden",width:"100%"},t.hideScrollbar&&{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},t.scrollableX&&{overflowX:"auto",overflowY:"hidden"},t.scrollableY&&{overflowY:"auto",overflowX:"hidden"})),Re=A("div",{name:"MuiTabs",slot:"FlexContainer",overridesResolver:(t,e)=>{const{ownerState:l}=t;return[e.flexContainer,l.vertical&&e.flexContainerVertical,l.centered&&e.centered]}})(({ownerState:t})=>f({display:"flex"},t.vertical&&{flexDirection:"column"},t.centered&&{justifyContent:"center"})),ze=A("span",{name:"MuiTabs",slot:"Indicator",overridesResolver:(t,e)=>e.indicator})(({ownerState:t,theme:e})=>f({position:"absolute",height:2,bottom:0,width:"100%",transition:e.transitions.create()},t.indicatorColor==="primary"&&{backgroundColor:(e.vars||e).palette.primary.main},t.indicatorColor==="secondary"&&{backgroundColor:(e.vars||e).palette.secondary.main},t.vertical&&{height:"100%",width:2,right:0})),We=A(me)({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Nt={},xt=d.forwardRef(function(e,l){const a=vt({props:e,name:"MuiTabs"}),s=ne(),n=At(),{"aria-label":u,"aria-labelledby":v,action:p,centered:x=!1,children:B,className:y,component:m="div",allowScrollButtonsMobile:w=!1,indicatorColor:L="primary",onChange:T,orientation:g="horizontal",ScrollButtonComponent:O=Be,scrollButtons:E="auto",selectionFollowsFocus:st,slots:X={},slotProps:V={},TabIndicatorProps:_={},TabScrollButtonProps:$={},textColor:Q="primary",value:D,variant:R="standard",visibleScrollbar:at=!1}=a,Xt=nt(a,Te),M=R==="scrollable",C=g==="vertical",K=C?"scrollTop":"scrollLeft",Z=C?"top":"left",tt=C?"bottom":"right",it=C?"clientHeight":"clientWidth",q=C?"height":"width",j=f({},a,{component:m,allowScrollButtonsMobile:w,indicatorColor:L,orientation:g,vertical:C,scrollButtons:E,textColor:Q,variant:R,visibleScrollbar:at,fixed:!M,hideScrollbar:M&&!at,scrollableX:M&&!C,scrollableY:M&&C,centered:x&&!M,scrollButtonsHideMobile:!w}),W=Me(j),_t=rt({elementType:X.StartScrollButtonIcon,externalSlotProps:V.startScrollButtonIcon,ownerState:j}),Dt=rt({elementType:X.EndScrollButtonIcon,externalSlotProps:V.endScrollButtonIcon,ownerState:j}),[gt,Yt]=d.useState(!1),[F,yt]=d.useState(Nt),[Ct,Ut]=d.useState(!1),[Bt,Vt]=d.useState(!1),[wt,Kt]=d.useState(!1),[Tt,qt]=d.useState({overflow:"hidden",scrollbarWidth:0}),Mt=new Map,z=d.useRef(null),H=d.useRef(null),It=()=>{const o=z.current;let r;if(o){const i=o.getBoundingClientRect();r={clientWidth:o.clientWidth,scrollLeft:o.scrollLeft,scrollTop:o.scrollTop,scrollLeftNormalized:ie(o,n?"rtl":"ltr"),scrollWidth:o.scrollWidth,top:i.top,bottom:i.bottom,left:i.left,right:i.right}}let c;if(o&&D!==!1){const i=H.current.children;if(i.length>0){const h=i[Mt.get(D)];c=h?h.getBoundingClientRect():null}}return{tabsMeta:r,tabMeta:c}},G=bt(()=>{const{tabsMeta:o,tabMeta:r}=It();let c=0,i;if(C)i="top",r&&o&&(c=r.top-o.top+o.scrollTop);else if(i=n?"right":"left",r&&o){const S=n?o.scrollLeftNormalized+o.clientWidth-o.scrollWidth:o.scrollLeft;c=(n?-1:1)*(r[i]-o[i]+S)}const h={[i]:c,[q]:r?r[q]:0};if(isNaN(F[i])||isNaN(F[q]))yt(h);else{const S=Math.abs(F[i]-h[i]),I=Math.abs(F[q]-h[q]);(S>=1||I>=1)&&yt(h)}}),ct=(o,{animation:r=!0}={})=>{r?fe(K,z.current,o,{duration:s.transitions.duration.standard}):z.current[K]=o},Et=o=>{let r=z.current[K];C?r+=o:(r+=o*(n?-1:1),r*=n&&Ot()==="reverse"?-1:1),ct(r)},Rt=()=>{const o=z.current[it];let r=0;const c=Array.from(H.current.children);for(let i=0;i<c.length;i+=1){const h=c[i];if(r+h[it]>o){i===0&&(r=o);break}r+=h[it]}return r},Gt=()=>{Et(-1*Rt())},Jt=()=>{Et(Rt())},Qt=d.useCallback(o=>{qt({overflow:null,scrollbarWidth:o})},[]),Zt=()=>{const o={};o.scrollbarSizeListener=M?b.jsx(We,{onChange:Qt,className:N(W.scrollableX,W.hideScrollbar)}):null;const c=M&&(E==="auto"&&(Ct||Bt)||E===!0);return o.scrollButtonStart=c?b.jsx(O,f({slots:{StartScrollButtonIcon:X.StartScrollButtonIcon},slotProps:{startScrollButtonIcon:_t},orientation:g,direction:n?"right":"left",onClick:Gt,disabled:!Ct},$,{className:N(W.scrollButtons,$.className)})):null,o.scrollButtonEnd=c?b.jsx(O,f({slots:{EndScrollButtonIcon:X.EndScrollButtonIcon},slotProps:{endScrollButtonIcon:Dt},orientation:g,direction:n?"left":"right",onClick:Jt,disabled:!Bt},$,{className:N(W.scrollButtons,$.className)})):null,o},zt=bt(o=>{const{tabsMeta:r,tabMeta:c}=It();if(!(!c||!r)){if(c[Z]<r[Z]){const i=r[K]+(c[Z]-r[Z]);ct(i,{animation:o})}else if(c[tt]>r[tt]){const i=r[K]+(c[tt]-r[tt]);ct(i,{animation:o})}}}),et=bt(()=>{M&&E!==!1&&Kt(!wt)});d.useEffect(()=>{const o=Ft(()=>{z.current&&G()});let r;const c=S=>{S.forEach(I=>{I.removedNodes.forEach(J=>{var P;(P=r)==null||P.unobserve(J)}),I.addedNodes.forEach(J=>{var P;(P=r)==null||P.observe(J)})}),o(),et()},i=Ht(z.current);i.addEventListener("resize",o);let h;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(o),Array.from(H.current.children).forEach(S=>{r.observe(S)})),typeof MutationObserver<"u"&&(h=new MutationObserver(c),h.observe(H.current,{childList:!0})),()=>{var S,I;o.clear(),i.removeEventListener("resize",o),(S=h)==null||S.disconnect(),(I=r)==null||I.disconnect()}},[G,et]),d.useEffect(()=>{const o=Array.from(H.current.children),r=o.length;if(typeof IntersectionObserver<"u"&&r>0&&M&&E!==!1){const c=o[0],i=o[r-1],h={root:z.current,threshold:.99},S=ut=>{Ut(!ut[0].isIntersecting)},I=new IntersectionObserver(S,h);I.observe(c);const J=ut=>{Vt(!ut[0].isIntersecting)},P=new IntersectionObserver(J,h);return P.observe(i),()=>{I.disconnect(),P.disconnect()}}},[M,E,wt,B==null?void 0:B.length]),d.useEffect(()=>{Yt(!0)},[]),d.useEffect(()=>{G()}),d.useEffect(()=>{zt(Nt!==F)},[zt,F]),d.useImperativeHandle(p,()=>({updateIndicator:G,updateScrollButtons:et}),[G,et]);const Wt=b.jsx(ze,f({},_,{className:N(W.indicator,_.className),ownerState:j,style:f({},F,_.style)}));let ot=0;const te=d.Children.map(B,o=>{if(!d.isValidElement(o))return null;const r=o.props.value===void 0?ot:o.props.value;Mt.set(r,ot);const c=r===D;return ot+=1,d.cloneElement(o,f({fullWidth:R==="fullWidth",indicator:c&&!gt&&Wt,selected:c,selectionFollowsFocus:st,onChange:T,textColor:Q,value:r},ot===1&&D===!1&&!o.props.tabIndex?{tabIndex:0}:{}))}),ee=o=>{const r=H.current,c=se(r).activeElement;if(c.getAttribute("role")!=="tab")return;let h=g==="horizontal"?"ArrowLeft":"ArrowUp",S=g==="horizontal"?"ArrowRight":"ArrowDown";switch(g==="horizontal"&&n&&(h="ArrowRight",S="ArrowLeft"),o.key){case h:o.preventDefault(),lt(r,c,kt);break;case S:o.preventDefault(),lt(r,c,Pt);break;case"Home":o.preventDefault(),lt(r,null,Pt);break;case"End":o.preventDefault(),lt(r,null,kt);break}},dt=Zt();return b.jsxs(Ie,f({className:N(W.root,y),ownerState:j,ref:l,as:m},Xt,{children:[dt.scrollButtonStart,dt.scrollbarSizeListener,b.jsxs(Ee,{className:W.scroller,ownerState:j,style:{overflow:Tt.overflow,[C?`margin${n?"Left":"Right"}`:"marginBottom"]:at?void 0:-Tt.scrollbarWidth},ref:z,children:[b.jsx(Re,{"aria-label":u,"aria-labelledby":v,"aria-orientation":g==="vertical"?"vertical":null,className:W.flexContainer,ownerState:j,onKeyDown:ee,ref:H,role:"tablist",children:te}),gt&&Wt]}),dt.scrollButtonEnd]}))}),Lt="index",U={tabs:`${Lt}-tabs`,tab:`${Lt}-tab`},Pe=ae(xt)(({theme:t})=>({[`& .${U.tabs}`]:{},[`& .${U.tab}`]:{fontSize:"0.875rem",[t.breakpoints.up("md")]:{fontSize:"1rem"}}}));function ke({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":{borderRadius:"100vw"},".MuiTabs-flexContainer":{borderRadius:"100vw",backgroundColor:"grey.100",padding:.5,display:"inline-flex",columnGap:.25,maxWidth:"100%",overflowX:"auto"},".MuiTab-root":{borderRadius:"100vw",border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,color:"text.secondary",fontSize:"13px",fontWeight:"normal",textTransform:"capitalize",transition:"background-color 0.2s ease","&.Mui-selected, &:hover":{backgroundColor:"action.selected",borderColor:"grey.100",color:"grey.A700"}},".MuiTabs-indicator":{display:"none"},...s.sx},children:t.map(n=>b.jsx(St,{className:U.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function Ne({tabs:t,current:e,onChange:l,iconPosition:a,...s}){return b.jsx(xt,{scrollButtons:"auto",value:e,onChange:(n,u)=>l(u),...s,variant:"scrollable",sx:{minHeight:"auto",".MuiTabs-scrollButtons.Mui-disabled":{opacity:.3,cursor:"not-allowed",pointerEvents:"auto"},".MuiTabs-scroller":s.orientation!=="vertical"?{"&::after":{content:'""',display:"block",position:"sticky",left:0,zIndex:-1,width:"100%",height:"1px",backgroundColor:"grey.300"}}:{},".MuiTabs-flexContainer":{display:"inline-flex",columnGap:2.5,px:0,pb:.5},".MuiTab-root":{border:"1px solid transparent",minHeight:"auto",lineHeight:1,py:1,px:0,color:"text.secondary",fontSize:"14px",fontWeight:500,textTransform:"capitalize",minWidth:"auto","&.Mui-selected, &:hover":{color:"primary.main"}},".MuiTabs-indicator":{height:"1px",backgroundColor:"primary.main"},...s.sx},children:t.map(n=>b.jsx(St,{className:U.tab,value:n.value,label:n.label,icon:n.icon,iconPosition:a},n.value))})}function $e({tabs:t,current:e,onChange:l,variant:a,iconPosition:s,...n}){return a==="card"?b.jsx(ke,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):a==="line"?b.jsx(Ne,{...n,tabs:t,current:e,onChange:l,iconPosition:s}):b.jsx(Pe,{scrollButtons:"auto",variant:"scrollable",value:e,onChange:(u,v)=>l(v),indicatorColor:"primary",...n,className:[U.tabs,n.className||""].join(" "),children:t.map(u=>b.jsx(St,{className:U.tab,value:u.value,label:u.label,icon:u.icon,iconPosition:s},u.value))})}export{$e as T,xt as a,St as b,Ot as d,ie as g,pt as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,k as i,
|
|
1
|
+
import{j as e,k as i,dv as x,dw as c,dq as p}from"./index-vDSh3Cp8.js";function w({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(m=>x(c(m))).join(" "):o,layout:n="horizontal",children:r,valueComponent:l="div",nameWidth:s=90,...f}){return e.jsxs(d,{layout:n,width:s,...f,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),r&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:r})]})}const d=p("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
|
|
4
4
|
justify-content: flex-start;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dq as s,P as c,j as t,aY as e}from"./index-vDSh3Cp8.js";import{S as l}from"./Switch-DT2kCliN.js";const r=s(i=>t.jsx(l,{focusVisibleClassName:".Mui-focusVisible",disableRipple:!0,...i}))(({theme:i})=>({width:42,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:2,transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:i.palette.primary.main,opacity:1,border:0},"&.Mui-disabled + .MuiSwitch-track":{opacity:.5}},"&.Mui-focusVisible .MuiSwitch-thumb":{color:i.palette.primary.main,border:"6px solid #fff"},"&.Mui-disabled .MuiSwitch-thumb":{color:i.palette.mode==="light"?i.palette.grey[100]:i.palette.grey[600]},"&.Mui-disabled + .MuiSwitch-track":{opacity:i.palette.mode==="light"?.7:.3}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:22,height:22},"& .MuiSwitch-track":{borderRadius:26/2,backgroundColor:i.palette.grey[200],opacity:1,transition:i.transitions.create(["background-color"],{duration:500})}}));function a({labelProps:i,...o}){return i?t.jsx(e,{control:t.jsx(r,{...o}),...i}):t.jsx(r,{...o})}a.propTypes={labelProps:c.object};a.defaultProps={labelProps:null};export{a as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fO as $e,al as Ut,E as vr,ct as jt,bd as et,hA as Vt,m as xr,cu as Er,h8 as Mt,hB as Ar,r as c,a2 as L,M as kr,aP as wr,aQ as br,j as p,fZ as Sr,h9 as _r,a4 as Dr,bC as De,fE as Zt,K as W,g as Ce,dq as Ir,hC as Ht,aZ as Or,fh as Br,aS as re,cH as fe,aB as Pt,hD as Fr,fJ as Tr,F as Lr,fe as Rr,k as ye,D as Nr,B as ot,C as Ur,s as jr,t as Vr,hE as ct,v as Mr,hF as Zr,eo as Hr,gZ as Pr}from"./index-vDSh3Cp8.js";import{d as Jt}from"./OpenInNew-Br7wzmcq.js";import{x as Jr}from"./index-BJHGOv7L.js";import{f as Qr}from"./index-BojVbZw0.js";import{d as Gr}from"./HelpOutline-O3LN2Opx.js";import{S as lt}from"./index-CNGTUnyW.js";const we=$e({});function zr({key:r}={key:"md"}){const e=Ut();return vr(e.breakpoints.down(r))}const F={NETWORK_ERROR:1001,UNAUTHORIZED:1002,EXPIRED:1003,PAST_DUE:1004,INVALID:1005,UNIT_LIMIT:1006,CORS_BLOCKED:1007,INCOMPATIBLE:1008};function Xr({endpoint:r,deps:e=[]}){return jt(async()=>{if(!et(r))return;const{headers:t}=await we.head(r,{timeout:1e3*30,params:{withExtras:!0}}),[n,a,s,i,o,u,d,f,b,_]=[t["x-space-name"],t["x-subscription-id"],t["x-listable"]==="true",t["x-readable"]==="true",t["x-writeable"]==="true",t["x-space-version"],t["x-space-owner-did"],t["x-space-is-available"],t["x-error-code"],t["x-is-site-admin"]],S=n?decodeURIComponent(n):"";if(f===void 0||b===void 0){const I=s&&i&&o;return{version:u,name:S,subscriptionId:a,ownerDid:d||"",isAvailable:I,errorCode:I?0:F.UNAUTHORIZED,isSiteAdmin:_==="true"}}return{version:u,name:S,subscriptionId:a,ownerDid:d,isAvailable:f==="true",errorCode:parseInt(b,10),isSiteAdmin:_==="true"}},{refreshDeps:[r].concat(e),onError(t){console.error(t)}})}const Kr=Vt.flatten({common:{cancel:"Cancel",confirm:"Confirm",delete:"Delete",error:"Error",open:"Open",unknown:"Unknown",invalidUrl:"Invalid url: {url}",upgrade:"Upgrade",viewMore:"View More"},storage:{spaces:{authorize:{title:"Connect {appName} to DID Spaces",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} to connect to DID Spaces",success:"Connected successfully"},connect:{reconnect:"Reconnect Now",useSpaceGateway:"Connect using the DID Spaces gateway",useWallet:"Connect to DID Spaces",howToGetGatewayUrl:"How to get the url of did spaces",providerForStorage:"Please connect your DID Spaces"},connected:{title:"Connected DID Spaces",tag:"Connected"},disconnected:{tag:"Disconnected"},error:{tag:"Need Attention",blockedByCors:"Access blocked by CORS",unreachable:"DID Space is unreachable",expired:"DID Spaces has expired, click this link to re-subscribe",pastDue:"DID Spaces has unpaid bills, click this link to complete payment",invalid:"DID Spaces subscription anomaly, click this link to check",unitLimit:"DID Spaces free quota has been used up, click this link to pay for the upgrade",cors:`The connection request may fail due to CORS restrictions:
|
|
2
2
|
1. Please contact the DID Space administrator to verify the relevant configuration.
|
|
3
3
|
2. If you are the administrator, click the link below to view the detailed setup guide and resolve the issue.`,networkError:"DID Space is currently unreachable due to potential server issues, network problems, or maintenance. Please click the link to visit the homepage and check its status.",incompatible:`The current connection of DID Spaces version ({spaceVersion}) is not compatible with the component version ({expectVersion}). Please contact the administrator for adjustments.
|
|
4
4
|
If you are the administrator, you can click the link below to take action.`},gateway:{add:{invalidUrl:"Invalid DID Spaces gateway url",label:"Enter the url of the DID Spaces",title:"Add DID Spaces"}},provideNFT:{title:"Please show the DID Spaces NFT for {appName}",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} show DID Spaces NFT",success:"Connected successfully"},helperText:{fixCorsError:"Fixing CORS Errors When Connecting to DID Spaces"}}},auditLog:{backup:{description:"A backup operation was completed {relativeTime}"},restore:{description:"A restore operation was completed {relativeTime}"},connected:{description:"A connection was established {relativeTime}"},disconnected:{description:"The connection was disconnected {relativeTime}"},objectsSync:{description:"{totalCount} objects ({size}) were synchronized {relativeTime}"}}}),Wr=Vt.flatten({common:{cancel:"取消",confirm:"确认",delete:"删除",error:"错误",open:"打开",unknown:"未知",invalidUrl:"无效的 url: {url}",upgrade:"升级",viewMore:"查看更多"},storage:{spaces:{authorize:{title:"连接 {appName} 至 DID Spaces",scan:"使用你的 DID Wallet 扫描下面的二维码以允许应用 {appName} 连接至 DID Spaces",success:"连接成功"},connect:{reconnect:"立即重连",useSpaceGateway:"使用 DID Spaces 网关连接",useWallet:"连接至 DID Spaces",howToGetGatewayUrl:"如何获取 DID Spaces 的网关地址",providerForStorage:"请连接您的 DID Spaces"},connected:{title:"已连接的 DID Spaces",tag:"已连接"},disconnected:{tag:"连接已断开"},error:{tag:"需要关注",blockedByCors:"因 CORS 限制,访问被阻止",unreachable:"DID Space 无法访问",expired:"DID Spaces 已过期,点击此链接重新订阅",pastDue:"DID Spaces 有未支付账单,点击此链接完成支付",invalid:"DID Spaces 订阅异常,点击此链接检查",unitLimit:"DID Spaces 免费额度已用完,点击此链接付费升级",cors:`连接请求可能因 CORS 限制而失败:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{b$ as Ge,b_ as et,b8 as te,cd as ee,r as y,c0 as tt,bZ as st,bX as Pe,j as e,c2 as ot,c3 as nt,M as V,bq as M,cs as rt,y as B,X,bi as T,ge as Me,aU as Ue,b as _,lb as at,m as E,P as g,hD as it,w as ct,az as Ne,a2 as ge,an as lt,n as dt,k as C,e as ut,C as z,i as pt,al as mt,lc as J,h2 as G,ld as ft,K as j,aZ as W,aB as ye,A as R,g as ht,T as Q,dt as gt,aP as je,aQ as be,Q as q,aI as Y,aa as H,a5 as xt,en as St,b3 as yt,B as me,v as jt,G as Le,Y as We,bB as xe,z as bt}from"./index-CsTPddhu.js";import{T as Ct}from"./index-C3mZr8we.js";import{u as A}from"./blocklet-0XH8mmGQ.js";import{u as kt}from"./use-mobile-DTCaLf5g.js";import{b as Dt,u as Bt,D as wt,c as fe,a as Tt}from"./index-CjndCckY.js";import"./index-C2_kibHi.js";import"./index-BojVbZw0.js";import"./api-BdCtM-JU.js";import{c as $e,b as Et,u as It,C as Rt,D as vt,a as zt}from"./connect-to-ChNP_InC.js";import{d as At,a as Pt,g as Lt,i as Ot,e as Se,f as _t,h as Mt,j as Ut}from"./spaces-pq4q-xcK.js";import{I as Nt}from"./index-IEQvL11R.js";import{R as Wt}from"./index-CO5SYnb0.js";import{d as $t}from"./HelpOutline-B4MIH072.js";import{D as Kt}from"./index-C8E-LVoC.js";import{x as Ft}from"./index-BJHGOv7L.js";import{d as qt}from"./MoreHoriz-D7yyKUPp.js";import{f as Yt}from"./actions-n15iXAnz.js";import{d as Ht}from"./DeleteOutline-C_C-bBpS.js";import{g as Oe}from"./get-safe-url-DOD4GJn9.js";import{S as Qt}from"./switch-control-BkuPmwf0.js";import{L as _e}from"./list-header-DphF1qCI.js";import"./OpenInNew-CvtRLCd4.js";import"./ButtonGroup-CyZftEPU.js";import"./getValidReactChildren-Dpq0Aubw.js";import"./TableRow-DQ5x-tZA.js";import"./useThemeProps-BK5mEVp3.js";import"./emotion-react.browser.esm-Bw_a1zYt.js";import"./ViewColumn-BcfEtc-F.js";import"./Search-C9hXwvmq.js";import"./Clear-CzzSn6gi.js";import"./Delete-B03xny6i.js";import"./index-Dq5qISUc.js";import"./MoreVert-D8KfjeMg.js";import"./TableSearch-Di-DZraN.js";import"./useLocalStorage-BJuW1NlC.js";import"./url-evaluation-UX_hT3EN.js";import"./permission-imoW7Dag.js";import"./index-yr2tw49U.js";import"./Switch-DHcUbR0L.js";function Vt(t){return Ge("MuiIcon",t)}et("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Xt=["baseClassName","className","color","component","fontSize"],Zt=t=>{const{color:o,fontSize:n,classes:s}=t,a={root:["root",o!=="inherit"&&`color${ee(o)}`,`fontSize${ee(n)}`]};return nt(a,Vt,s)},Jt=te("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${ee(n.color)}`],o[`fontSize${ee(n.fontSize)}`]]}})(({theme:t,ownerState:o})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,fontSize:{inherit:"inherit",small:t.typography.pxToRem(20),medium:t.typography.pxToRem(24),large:t.typography.pxToRem(36)}[o.fontSize],color:{primary:(t.vars||t).palette.primary.main,secondary:(t.vars||t).palette.secondary.main,info:(t.vars||t).palette.info.main,success:(t.vars||t).palette.success.main,warning:(t.vars||t).palette.warning.main,action:(t.vars||t).palette.action.active,error:(t.vars||t).palette.error.main,disabled:(t.vars||t).palette.action.disabled,inherit:void 0}[o.color]})),Ce=y.forwardRef(function(o,n){const s=tt({props:o,name:"MuiIcon"}),{baseClassName:a="material-icons",className:r,color:i="inherit",component:l="span",fontSize:u="medium"}=s,c=st(s,Xt),f=Pe({},s,{baseClassName:a,color:i,component:l,fontSize:u}),p=Zt(f);return e.jsx(Jt,Pe({as:l,className:ot(a,"notranslate",p.root,r),ownerState:f,"aria-hidden":!0,ref:n},c))});Ce.muiName="Icon";async function Gt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const a=await Promise.all(n.map(async r=>{let{name:i}=r;const l=await At(r.endpoint);return!V(l)&&l!==i&&(i=l,s=!0),{...r,name:i}}));return s&&await Promise.all(a.filter(r=>r.did).map(r=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:r.did},spaceGateway:{...r}}}))),a}function es({refresh:t}={}){var a;const{blocklet:o}=A(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,{api:s}=M();return rt(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){var i;(i=r==null?void 0:r.message)!=null&&i.includes("not logged")?console.warn(r):(console.error(r),B.error(X(r)))}})}function Ke({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var f;const{blocklet:s}=A(),[a,r]=y.useState([]),{api:i}=M(),[l,u]=y.useMemo(()=>n?[T(n).startOf("day").toISOString(),T(n).endOf("day").toISOString()]:[T().startOf("year").toISOString(),T().endOf("day").toISOString()],[n]),c=Me(async()=>{try{if(o(!0),!s){r([]);return}const{backups:p}=await i.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:u}});r(p??[])}catch(p){console.error(p),B.error(X(p))}finally{o(!1)}},1e3);return Ue(async()=>{c()},[(f=s==null?void 0:s.meta)==null?void 0:f.did].concat(t)),{backups:a}}function ts({appDid:t}){const{backups:o}=Ke(),[n,s]=y.useState({message:"",progress:0,completed:!1}),a=M(),{ws:{useSubscription:r}}=a;return r(_.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&s(()=>({...i}))},[t]),y.useEffect(()=>{var i;if(o!=null&&o.length&&at((i=o[0])==null?void 0:i.status)){const[l]=o;s(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[o]),n}function ss({deps:t=[],setLoading:o=()=>{}}={}){var l;const{blocklet:n}=A(),[s,a]=y.useState([]),{api:r}=M(),i=y.useCallback(Me(async()=>{var u;if(!r||!((u=n==null?void 0:n.meta)!=null&&u.did)){a([]);return}try{o(!0);const c=T(),f=c.subtract(1,"year"),{summary:p}=await r.getBlockletBackupSummary({input:{did:n.meta.did,startTime:f.toISOString(),endTime:c.toISOString()}});a(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),a([])}finally{o(!1)}},1e3),[]);return Ue(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:s}}const Fe=y.createContext({}),{Provider:os,Consumer:ao}=Fe;function ke({children:t}){var K;const{t:o}=E(),{api:n}=M(),{blocklet:s}=A(),[a,r]=y.useState(null),[i,l]=y.useState(!1),{data:u,loading:c,mutate:f}=es({refresh:i}),p=it(u),x=ts({appDid:s==null?void 0:s.appDid}),h=y.useMemo(()=>Pt(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[b,D]=y.useState(!1),[S,d]=y.useState(!1),{backups:oe}=Ke({deps:[S,a],setLoading:D,backupDate:a}),[ne,re]=y.useState(!1),{backupSummary:ae}=ss({deps:[ne]}),[U,L]=y.useState(u==null?void 0:u.find(m=>m.endpoint===h)),I=(K=s==null?void 0:s.settings)==null?void 0:K.autoBackup,v=()=>{l(m=>!m)},ie=()=>{re(m=>!m)},ce=()=>{d(m=>!m)},$=async m=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:m}})},Z=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},le=async(m,N)=>{try{f(w=>{const O=[...w];return O.push({...m,loading:!0}),O}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:m}}),h!==N&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),L(m),v(),B.success(o("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),f(O=>[...O].filter(pe=>pe.did!==m.did)),w}},de=async m=>{m&&(m.endpoint===h&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await $({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),f(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),L(m),v())},ue=async m=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:m.did},spaceGateway:m}}),h!==m.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===h;return e.jsx(os,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:le,deleteSpaceGateway:de,updateSpaceGateway:ue,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:$,abortBlockletBackup:Z,backupEndpoint:h,backupProgress:x,backups:oe,backupSummary:ae,refreshBackupSummary:ie,refreshBackups:ce,setBackupDate:r,backupsLoading:b,autoBackup:I},children:t})}ke.propTypes={children:g.any.isRequired};ke.defaultProps={};function P(){return y.useContext(Fe)}function se({...t}){const{blocklet:o}=A(),{info:n}=M(),{t:s}=E(),a=$e({blocklet:o}),r=ct(n),{spaceGateways:i,addSpaceGateway:l}=P(),u={checkFn:Ne.create({baseURL:ge(window.location.origin,lt())}).get,webWalletUrl:r,extraParams:{appPid:o.appPid,appDid:a.appDid,appName:a.appName,appDescription:a.appDescription,appUrl:a.appUrl,referrer:a.referrer,scopes:a.scopes,nodeDid:n.did}},c=async({endpoint:p,name:x,did:h})=>{const b=await Lt(p);if(!await Ot(b)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(d=>d.endpoint===p)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await l({name:x,did:h,url:b,endpoint:p},p)},f=async({spaceGateway:p})=>{try{await c(p)}catch(x){console.error(x),B.error(X(x))}};return e.jsx(Dt,{...t,connectScope:"app",options:u,onSuccess:f})}se.propTypes={};se.defaultProps={};function qe({...t}){const{t:o}=y.useContext(ut),{blocklet:n,loadingDiskInfo:s,actions:a}=A();if(y.useEffect(()=>{a==null||a.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const r=(u,c,f)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?pt(c):"empty"})]}),i=n.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),l=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(ns,{component:"div",...t,children:l.map(u=>e.jsx(Nt,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return s?e.jsx(z,{}):e.jsx(C,{children:o("blocklet.diskInfo.empty")})}const ns=dt(C)``;function De(){const{t}=E(),{setBackupDate:o,backupSummary:n}=P(),s=Bt({key:"lg"}),a=y.useRef(null),r=mt(),i=y.useCallback(c=>{o(c)},[o]),l=y.useMemo(()=>{const c=T().add(1,"day"),f=T().subtract(11,"month").startOf("month"),p=new Map(n.map(h=>[h.date,{date:h.date,successCount:h.successCount,errorCount:h.errorCount}])),x=[];for(let h=f.clone();T(h).isBefore(c);h=h.add(1,"day")){const b=h.format("YYYY-MM-DD");x.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return x},[n]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:d}=l[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${d}</div>`].join(`
|
|
2
|
-
`)},backgroundColor:r.palette.background.paper,borderColor:r.palette.divider,textStyle:{color:r.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${r.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:r.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:r.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:r.palette.background.default,color:r.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:r.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:r.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[T().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),T().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:r.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ft[200],color:"inherit"}}}}),[l,t,r]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:a,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Wt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&i(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2,children:e.jsxs(W,{direction:s?"column":"row",spacing:s?2:1,width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}De.propTypes={};const rs=te(({className:t,...o})=>e.jsx(ye,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Be({status:t,message:o,createdAt:n}){const{t:s}=E(),a=t===R.BACKUPS.STATUS.PROGRESS&&T().diff(n,"hours")>=R.BACKUPS.TIMEOUT_HOURS,r=a&&s("common.timeoutError"),i=t===R.BACKUPS.STATUS.PROGRESS&&!a,l=t===R.BACKUPS.STATUS.SUCCEEDED&&!a;return i?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):l?e.jsx(Q,{type:"success",children:s("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(Q,{type:"error",children:s("common.failed")})," ",e.jsx(ye,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||r,children:e.jsx(Ce,{children:e.jsx($t,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Be.propTypes={status:g.string.isRequired,message:g.string,createdAt:g.string.isRequired};Be.defaultProps={message:""};function we({metadata:t}){const{t:o}=E();if(V(t))return e.jsx(Q,{type:"success",children:o("common.succeeded")});const n=t.count||0,s=t.size||0,a=Ft(s,{iec:!0}),r=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[o("common.fileCount"),": ",n]}),e.jsxs(C,{variant:"body2",children:[o("common.fileSize"),": ",a]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(Q,{type:"success",children:o("common.succeeded")})," ",e.jsx(rs,{title:r,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(Ce,{children:e.jsx(gt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}we.propTypes={metadata:g.object};we.defaultProps={metadata:{}};function Te(){const{t,locale:o}=E(),{spaceGateways:n,backups:s,backupsLoading:a}=P(),r=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{var D;const{targetUrl:u,targetName:c,status:f,createdAt:p}=s[l],x=f===R.BACKUPS.STATUS.PROGRESS&&T().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,h=f===R.BACKUPS.STATUS.SUCCEEDED&&!x,b=c||((D=n.find(S=>u==null?void 0:u.includes(Se(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return h?e.jsx(ht,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:l=>{const u=t(l===0?"common.auto":"common.manual");return e.jsx(Q,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>T(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>V(l)?"":T(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const u=(s==null?void 0:s[l])??{},{status:c,message:f,createdAt:p,metadata:x}=u,h=c===R.BACKUPS.STATUS.PROGRESS&&T().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!h,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!h;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):D?e.jsx(we,{metadata:x}):e.jsx(Be,{status:c,message:f,createdAt:p})}}}],[s,n,t]),i=y.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:i?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(Kt,{title:"",loading:a,data:s,columns:r,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Te.propTypes={};function Ye(){const{t}=E();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(wt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(se,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(De,{})]})]}),e.jsx(Te,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(qe,{})]})}Ye.propTypes={};var Ee={},as=be;Object.defineProperty(Ee,"__esModule",{value:!0});var He=Ee.default=void 0,is=as(je()),cs=e;He=Ee.default=(0,is.default)((0,cs.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Ie={},ls=be;Object.defineProperty(Ie,"__esModule",{value:!0});var Qe=Ie.default=void 0,ds=ls(je()),us=e;Qe=Ie.default=(0,ds.default)((0,us.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var Re={},ps=be;Object.defineProperty(Re,"__esModule",{value:!0});var Ve=Re.default=void 0,ms=ps(je()),fs=e;Ve=Re.default=(0,ms.default)((0,fs.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function ve({spaceGateway:t,onConfirm:o,onCancel:n}){const{t:s}=E(),[a,r]=y.useState(!1),[i,l]=y.useState(!1),u=(p,x)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),r(x)},c=async p=>{try{p==null||p.stopPropagation(),l(!0),await(o==null?void 0:o(t)),r(!1)}catch(x){console.error(x),B.error(`${s("storage.space.gateway.delete.failed")}: ${X(x)}`)}finally{r(!1),l(!1)}},f=p=>{u(p,!1),n==null||n(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(q,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ht,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(xt,{title:s("storage.spaces.gateway.delete.title"),open:a,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:i}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:i}},onConfirm:c,onCancel:f,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}ve.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool}).isRequired,onConfirm:g.func,onCancel:g.func};ve.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function ze({spaceGateway:t,selected:o,onDelete:n,onConnect:s,enableSwitchToSpace:a,backupInProgress:r,...i}){const{abortBlockletBackup:l}=P(),[u,c]=y.useState(null),{t:f}=E(),[p,x]=y.useState(!1),h=(S,d)=>{S.stopPropagation(),S.preventDefault(),c(d&&S.currentTarget)},b=async S=>{try{x(!0),h(S,!1),await s(t)}catch(d){console.error(d),B.error(d.message)}finally{x(!1)}},D=async S=>{try{x(!0),h(S,!1),await l()}catch(d){console.error(d),B.error(d.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(St,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>h(S,!0),...i,children:e.jsx(qt,{})}),e.jsxs(yt,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>h(S,!1),children:[e.jsxs(q,{onClick:S=>{h(S,!1),window.open(Oe(t.endpoint?_t(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:f("common.open")})]}),e.jsxs(q,{onClick:S=>{h(S,!1),window.open(Oe(Mt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.strategy.viewBackupFiles")})]}),!o&&a&&e.jsxs(q,{onClick:b,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Qe,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.connect.switchToSpace")})]}),r&&e.jsxs(q,{onClick:D,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Yt,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.connect.abortBlockletBackup")})]}),!r&&e.jsx(ve,{spaceGateway:t,onConfirm:async()=>{c(null),await(n==null?void 0:n(t))},onCancel:()=>c(null)})]})]})}ze.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool,endpoint:g.string.isRequired,loading:g.bool}).isRequired,selected:g.bool.isRequired,enableSwitchToSpace:g.bool,onDelete:g.func,onConnect:g.func,backupInProgress:g.bool};ze.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const hs=te(({className:t,...o})=>e.jsx(ye,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({spaceGateway:t,spaceStatus:o,selected:n,onConnected:s,onDeleted:a,onBackedUp:r}){const{t:i,locale:l}=E(),{blocklet:u}=A(),{api:c,info:{did:f}}=M(),{appDid:p,appName:x,appDescription:h,scopes:b,appUrl:D,referrer:S}=$e({blocklet:u}),{backupProgress:d,updateSpaceGateway:oe,deleteSpaceGateway:ne,refreshBackupSummary:re,refreshBackups:ae}=P(),[U,L]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:i("storage.spaces.authorize.title",{appName:x},l),scan:i("storage.spaces.authorize.scan",{appName:x},l),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:i("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),ie=n&&!U&&o===fe.DISCONNECTED,ce=n&&!U&&!t.loading&&o===fe.CONNECTED,$=n&&U&&o===fe.CONNECTED&&(d==null?void 0:d.progress)>=0,Z=async()=>{try{if(await Ut(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(i("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(k){console.error(k),s==null||s(k,t);return}v(k=>({...k,open:!0,prefix:ge(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ne.create({baseURL:ge(t.url,"space")}).get,extraParams:{appDid:p,appName:x,appDescription:h,scopes:b,appUrl:D,referrer:S,nodeDid:f,spaceDid:t.did}}))},le=async(k,K)=>{const m=K(k.endpoint),N=Se(m),w=k.space?K(k.space):{};if(t.did&&N!==t.did){v(pe=>({...pe,open:!1}));const F=i("storage.spaces.gateway.switch.failedForMismatchSpace",{name:w!=null&&w.name?w.name:""});B.error(F),s==null||s(new Error(F),t);return}const O={...t,name:w.name??"DID Space",did:w.did??Se(m),endpoint:m};await oe(O),v(F=>({...F,open:!1})),s==null||s(null,O)},de=async()=>{try{if(U)return;L(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),r==null||r(k,t)}finally{L(!0)}},ue=async()=>{try{await ne(t),B.success(i("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),a==null||a(null,t)}catch(k){console.error(k),a==null||a(k,t)}};return y.useEffect(()=>{d!=null&&d.completed?(n&&((d==null?void 0:d.progress)===100?(B.success(i("storage.spaces.backupSuccessfully")),r==null||r(null,t)):d.message&&(r==null||r(new Error(d==null?void 0:d.message),t)),d.progress=0,d.message=""),L(!1),setTimeout(()=>{re(),ae()},1e3)):d.progress&&L(!0)},[d]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ce&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:de,children:i("storage.spaces.strategy.backupNow")}),ie&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:Z,children:i("storage.spaces.disconnected.reconnectNow")}),$&&e.jsx(hs,{title:(d==null?void 0:d.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:d.message})}),children:e.jsxs(me,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:d==null?void 0:d.progress,size:14,sx:{mr:1}}),d==null?void 0:d.progress,"%"]})}),e.jsx(jt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:le,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:l},"get-endpoint")]}),e.jsx(ze,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:ue,onConnect:Z,enableSwitchToSpace:(d==null?void 0:d.completed)||V(d==null?void 0:d.message),backupInProgress:$})]})}Ae.propTypes={spaceGateway:g.shape({did:g.string.isRequired,name:g.string.isRequired,url:g.string.isRequired,endpoint:g.string.isRequired,protected:g.bool,loading:g.bool}).isRequired,spaceStatus:g.string.isRequired,selected:g.bool.isRequired,onConnected:g.func,onDeleted:g.func,onBackedUp:g.func};Ae.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Xe({...t}){const{t:o}=E();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:o("storage.spaces.backup.records")})}),e.jsx(De,{}),e.jsx(Te,{})]})}Xe.propTypes={};function Ze({...t}){const{t:o}=E(),{autoBackup:n,updateAutoBackup:s}=P(),a=async()=>{try{const r=!(n!=null&&n.enabled);await s({enabled:r}),B.success(o(r?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(r){B.error(r.message)}};return e.jsx(Qt,{checked:!!(n!=null&&n.enabled),onChange:a,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Ze.propTypes={};function gs(){const{t}=E(),{spaceGateways:o,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=P(),a=n&&!(o!=null&&o.length),r=({spaceGateway:i,spaceStatus:l,selected:u,refresh:c})=>e.jsx(Ae,{spaceGateway:i,spaceStatus:l,selected:u,onConnected:()=>c(),onBackedUp:f=>f&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Ze,{}),e.jsx(se,{})]}),e.jsx(j,{mt:2,children:a?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(z,{})}):e.jsx(Le,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(i=>e.jsx(Le,{item:!0,xs:12,md:6,children:e.jsx(Tt,{endpoint:i.endpoint,selected:s(i),action:r},i.endpoint)},i.endpoint))})})}),e.jsx(Xe,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(qe,{})]})}function xs(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=P();return t?e.jsx(We,{relative:"parent",children:e.jsx(z,{})}):V(o)?e.jsx(Ye,{}):e.jsx(gs,{})}function Ss(){return e.jsx(ke,{children:e.jsx(xs,{})})}function ys(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:n,hasStorageEndpoint:s,loading:a,storageEndpoint:r}=It(),i=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return a?e.jsx(We,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(Rt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(vt,{}),e.jsx(j,{sx:i,children:e.jsx(zt,{onConnect:n,storageEndpoint:r})})]})}function js(){const{t}=E();return e.jsxs(Et,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(ys,{})]})}function Je({navOrientation:t,...o}){const{t:n,locale:s}=E(),{blocklet:a}=A(),r=kt({key:"md"}),[i,l]=bt(),u=i.get("tab")||"backup",c=r?"horizontal":t,f=xe(()=>{var d;const D=[{label:n("common.backup"),value:"backup"}],S=(d=a==null?void 0:a.capabilities)==null?void 0:d.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:n("common.storage"),value:"storage"}),D},[s,c]),x=xe(()=>({backup:e.jsx(Ss,{}),storage:e.jsx(js,{})}))[u],h=D=>{l(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(f.length<=1)return e.jsx(he,{children:x});const b=e.jsx(Ct,{tabs:f,current:u,orientation:c,onChange:h,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...o,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(_e,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(he,{sx:{mt:1},children:x})})]})});if(c==="horizontal")return e.jsxs(j,{...o,children:[e.jsx(_e,{left:b}),e.jsx(he,{sx:{mt:2},children:x})]})}Je.propTypes={navOrientation:g.oneOf(["vertical","horizontal"])};Je.defaultProps={navOrientation:"vertical"};const he=te(j)`
|
|
1
|
+
import{c0 as Ge,b$ as et,b8 as te,ce as ee,r as y,c1 as tt,b_ as ot,bY as Pe,j as e,c3 as st,c4 as nt,M as V,bq as M,ct as rt,y as B,X,bi as T,ge as Me,aU as Ue,b as _,lb as at,m as E,P as g,hD as it,w as ct,az as Ne,a2 as ge,an as lt,n as dt,k as C,e as ut,C as z,i as pt,al as mt,lc as J,h2 as G,ld as ft,K as j,aZ as W,aB as ye,A as R,g as ht,T as Q,du as gt,aP as je,aQ as be,Q as Y,aI as q,aa as H,a5 as xt,eo as St,b3 as yt,B as me,v as jt,G as Le,Y as We,bC as xe,z as bt}from"./index-vDSh3Cp8.js";import{T as Ct}from"./index-CXQg5kUh.js";import{u as A}from"./blocklet-BGgqD4BP.js";import{u as kt}from"./use-mobile-DaQ7GJZg.js";import{b as Dt,u as Bt,D as wt,c as fe,a as Tt}from"./index-CvtRf8XP.js";import"./index-CNGTUnyW.js";import"./index-BojVbZw0.js";import"./api-Ci-onPo-.js";import{c as $e,b as Et,u as It,C as Rt,D as vt,a as zt}from"./connect-to-BHNObJzo.js";import{d as At,a as Pt,g as Lt,i as Ot,e as Se,f as _t,h as Mt,j as Ut}from"./spaces-6FINHsBY.js";import{I as Nt}from"./index-CZKkZl9k.js";import{R as Wt}from"./index-Gd_-HHXO.js";import{d as $t}from"./HelpOutline-O3LN2Opx.js";import{D as Kt}from"./index-DHgO5720.js";import{x as Ft}from"./index-BJHGOv7L.js";import{d as Yt}from"./MoreHoriz-DIlSvADT.js";import{f as qt}from"./actions-CU5HkWLC.js";import{d as Ht}from"./DeleteOutline-Cd_INjPT.js";import{g as Oe}from"./get-safe-url-CQ6WOW_2.js";import{S as Qt}from"./switch-control-C1azX2vK.js";import{L as _e}from"./list-header-DnSoi2gS.js";import"./OpenInNew-Br7wzmcq.js";import"./ButtonGroup-B_aX6xrX.js";import"./getValidReactChildren-KVG9q6ks.js";import"./TableRow-Bj3l8hth.js";import"./useThemeProps-CLbMNkj4.js";import"./emotion-react.browser.esm-SsdnWCKs.js";import"./ViewColumn-Cw8COMnF.js";import"./Search-DwJKG2rp.js";import"./Clear-DNueioFS.js";import"./Delete-XCER7bsY.js";import"./index-BEz0dAo5.js";import"./MoreVert-BgpxfOll.js";import"./TableSearch-12CV3VPc.js";import"./useLocalStorage-CCiP1kGY.js";import"./url-evaluation-D2wHtYXf.js";import"./permission-vMf-uF3v.js";import"./index-Ce5WAACz.js";import"./Switch-DT2kCliN.js";function Vt(t){return Ge("MuiIcon",t)}et("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Xt=["baseClassName","className","color","component","fontSize"],Zt=t=>{const{color:s,fontSize:n,classes:o}=t,a={root:["root",s!=="inherit"&&`color${ee(s)}`,`fontSize${ee(n)}`]};return nt(a,Vt,o)},Jt=te("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${ee(n.color)}`],s[`fontSize${ee(n.fontSize)}`]]}})(({theme:t,ownerState:s})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,fontSize:{inherit:"inherit",small:t.typography.pxToRem(20),medium:t.typography.pxToRem(24),large:t.typography.pxToRem(36)}[s.fontSize],color:{primary:(t.vars||t).palette.primary.main,secondary:(t.vars||t).palette.secondary.main,info:(t.vars||t).palette.info.main,success:(t.vars||t).palette.success.main,warning:(t.vars||t).palette.warning.main,action:(t.vars||t).palette.action.active,error:(t.vars||t).palette.error.main,disabled:(t.vars||t).palette.action.disabled,inherit:void 0}[s.color]})),Ce=y.forwardRef(function(s,n){const o=tt({props:s,name:"MuiIcon"}),{baseClassName:a="material-icons",className:r,color:i="inherit",component:l="span",fontSize:u="medium"}=o,c=ot(o,Xt),f=Pe({},o,{baseClassName:a,color:i,component:l,fontSize:u}),p=Zt(f);return e.jsx(Jt,Pe({as:l,className:st(a,"notranslate",p.root,r),ownerState:f,"aria-hidden":!0,ref:n},c))});Ce.muiName="Icon";async function Gt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const a=await Promise.all(n.map(async r=>{let{name:i}=r;const l=await At(r.endpoint);return!V(l)&&l!==i&&(i=l,o=!0),{...r,name:i}}));return o&&await Promise.all(a.filter(r=>r.did).map(r=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:r.did},spaceGateway:{...r}}}))),a}function eo({refresh:t}={}){var a;const{blocklet:s}=A(),n=(a=s==null?void 0:s.meta)==null?void 0:a.did,{api:o}=M();return rt(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){var i;(i=r==null?void 0:r.message)!=null&&i.includes("not logged")?console.warn(r):(console.error(r),B.error(X(r)))}})}function Ke({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var f;const{blocklet:o}=A(),[a,r]=y.useState([]),{api:i}=M(),[l,u]=y.useMemo(()=>n?[T(n).startOf("day").toISOString(),T(n).endOf("day").toISOString()]:[T().startOf("year").toISOString(),T().endOf("day").toISOString()],[n]),c=Me(async()=>{try{if(s(!0),!o){r([]);return}const{backups:p}=await i.getBlockletBackups({input:{did:o.meta.did,startTime:l,endTime:u}});r(p??[])}catch(p){console.error(p),B.error(X(p))}finally{s(!1)}},1e3);return Ue(async()=>{c()},[(f=o==null?void 0:o.meta)==null?void 0:f.did].concat(t)),{backups:a}}function to({appDid:t}){const{backups:s}=Ke(),[n,o]=y.useState({message:"",progress:0,completed:!1}),a=M(),{ws:{useSubscription:r}}=a;return r(_.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&o(()=>({...i}))},[t]),y.useEffect(()=>{var i;if(s!=null&&s.length&&at((i=s[0])==null?void 0:i.status)){const[l]=s;o(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[s]),n}function oo({deps:t=[],setLoading:s=()=>{}}={}){var l;const{blocklet:n}=A(),[o,a]=y.useState([]),{api:r}=M(),i=y.useCallback(Me(async()=>{var u;if(!r||!((u=n==null?void 0:n.meta)!=null&&u.did)){a([]);return}try{s(!0);const c=T(),f=c.subtract(1,"year"),{summary:p}=await r.getBlockletBackupSummary({input:{did:n.meta.did,startTime:f.toISOString(),endTime:c.toISOString()}});a(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),a([])}finally{s(!1)}},1e3),[]);return Ue(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:o}}const Fe=y.createContext({}),{Provider:so,Consumer:is}=Fe;function ke({children:t}){var K;const{t:s}=E(),{api:n}=M(),{blocklet:o}=A(),[a,r]=y.useState(null),[i,l]=y.useState(!1),{data:u,loading:c,mutate:f}=eo({refresh:i}),p=it(u),x=to({appDid:o==null?void 0:o.appDid}),h=y.useMemo(()=>Pt(o==null?void 0:o.environments),[o==null?void 0:o.environments]),[b,D]=y.useState(!1),[S,d]=y.useState(!1),{backups:se}=Ke({deps:[S,a],setLoading:D,backupDate:a}),[ne,re]=y.useState(!1),{backupSummary:ae}=oo({deps:[ne]}),[U,L]=y.useState(u==null?void 0:u.find(m=>m.endpoint===h)),I=(K=o==null?void 0:o.settings)==null?void 0:K.autoBackup,v=()=>{l(m=>!m)},ie=()=>{re(m=>!m)},ce=()=>{d(m=>!m)},$=async m=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:m}})},Z=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},le=async(m,N)=>{try{f(w=>{const O=[...w];return O.push({...m,loading:!0}),O}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:m}}),h!==N&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),L(m),v(),B.success(s("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),f(O=>[...O].filter(pe=>pe.did!==m.did)),w}},de=async m=>{m&&(m.endpoint===h&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await $({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),f(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),L(m),v())},ue=async m=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:m.did},spaceGateway:m}}),h!==m.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===h;return e.jsx(so,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:le,deleteSpaceGateway:de,updateSpaceGateway:ue,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:$,abortBlockletBackup:Z,backupEndpoint:h,backupProgress:x,backups:se,backupSummary:ae,refreshBackupSummary:ie,refreshBackups:ce,setBackupDate:r,backupsLoading:b,autoBackup:I},children:t})}ke.propTypes={children:g.any.isRequired};ke.defaultProps={};function P(){return y.useContext(Fe)}function oe({...t}){const{blocklet:s}=A(),{info:n}=M(),{t:o}=E(),a=$e({blocklet:s}),r=ct(n),{spaceGateways:i,addSpaceGateway:l}=P(),u={checkFn:Ne.create({baseURL:ge(window.location.origin,lt())}).get,webWalletUrl:r,extraParams:{appPid:s.appPid,appDid:a.appDid,appName:a.appName,appDescription:a.appDescription,appUrl:a.appUrl,referrer:a.referrer,scopes:a.scopes,nodeDid:n.did}},c=async({endpoint:p,name:x,did:h})=>{const b=await Lt(p);if(!await Ot(b)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(d=>d.endpoint===p)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await l({name:x,did:h,url:b,endpoint:p},p)},f=async({spaceGateway:p})=>{try{await c(p)}catch(x){console.error(x),B.error(X(x))}};return e.jsx(Dt,{...t,connectScope:"app",options:u,onSuccess:f})}oe.propTypes={};oe.defaultProps={};function Ye({...t}){const{t:s}=y.useContext(ut),{blocklet:n,loadingDiskInfo:o,actions:a}=A();if(y.useEffect(()=>{a==null||a.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const r=(u,c,f)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?pt(c):"empty"})]}),i=n.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),l=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(no,{component:"div",...t,children:l.map(u=>e.jsx(Nt,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return o?e.jsx(z,{}):e.jsx(C,{children:s("blocklet.diskInfo.empty")})}const no=dt(C)``;function De(){const{t}=E(),{setBackupDate:s,backupSummary:n}=P(),o=Bt({key:"lg"}),a=y.useRef(null),r=mt(),i=y.useCallback(c=>{s(c)},[s]),l=y.useMemo(()=>{const c=T().add(1,"day"),f=T().subtract(11,"month").startOf("month"),p=new Map(n.map(h=>[h.date,{date:h.date,successCount:h.successCount,errorCount:h.errorCount}])),x=[];for(let h=f.clone();T(h).isBefore(c);h=h.add(1,"day")){const b=h.format("YYYY-MM-DD");x.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return x},[n]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:d}=l[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${d}</div>`].join(`
|
|
2
|
+
`)},backgroundColor:r.palette.background.paper,borderColor:r.palette.divider,textStyle:{color:r.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${r.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:r.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:r.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:r.palette.background.default,color:r.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:r.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:r.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[T().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),T().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:r.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ft[200],color:"inherit"}}}}),[l,t,r]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:a,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Wt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&i(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2,children:e.jsxs(W,{direction:o?"column":"row",spacing:o?2:1,width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}De.propTypes={};const ro=te(({className:t,...s})=>e.jsx(ye,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Be({status:t,message:s,createdAt:n}){const{t:o}=E(),a=t===R.BACKUPS.STATUS.PROGRESS&&T().diff(n,"hours")>=R.BACKUPS.TIMEOUT_HOURS,r=a&&o("common.timeoutError"),i=t===R.BACKUPS.STATUS.PROGRESS&&!a,l=t===R.BACKUPS.STATUS.SUCCEEDED&&!a;return i?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):l?e.jsx(Q,{type:"success",children:o("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(Q,{type:"error",children:o("common.failed")})," ",e.jsx(ye,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||r,children:e.jsx(Ce,{children:e.jsx($t,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Be.propTypes={status:g.string.isRequired,message:g.string,createdAt:g.string.isRequired};Be.defaultProps={message:""};function we({metadata:t}){const{t:s}=E();if(V(t))return e.jsx(Q,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,a=Ft(o,{iec:!0}),r=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(C,{variant:"body2",children:[s("common.fileSize"),": ",a]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(Q,{type:"success",children:s("common.succeeded")})," ",e.jsx(ro,{title:r,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(Ce,{children:e.jsx(gt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}we.propTypes={metadata:g.object};we.defaultProps={metadata:{}};function Te(){const{t,locale:s}=E(),{spaceGateways:n,backups:o,backupsLoading:a}=P(),r=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{var D;const{targetUrl:u,targetName:c,status:f,createdAt:p}=o[l],x=f===R.BACKUPS.STATUS.PROGRESS&&T().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,h=f===R.BACKUPS.STATUS.SUCCEEDED&&!x,b=c||((D=n.find(S=>u==null?void 0:u.includes(Se(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return h?e.jsx(ht,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:l=>{const u=t(l===0?"common.auto":"common.manual");return e.jsx(Q,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>T(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>V(l)?"":T(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const u=(o==null?void 0:o[l])??{},{status:c,message:f,createdAt:p,metadata:x}=u,h=c===R.BACKUPS.STATUS.PROGRESS&&T().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!h,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!h;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):D?e.jsx(we,{metadata:x}):e.jsx(Be,{status:c,message:f,createdAt:p})}}}],[o,n,t]),i=y.useMemo(()=>!(o!=null&&o.length),[o]);return e.jsx(e.Fragment,{children:i?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(Kt,{title:"",loading:a,data:o,columns:r,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Te.propTypes={};function qe(){const{t}=E();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(wt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(oe,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(De,{})]})]}),e.jsx(Te,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ye,{})]})}qe.propTypes={};var Ee={},ao=be;Object.defineProperty(Ee,"__esModule",{value:!0});var He=Ee.default=void 0,io=ao(je()),co=e;He=Ee.default=(0,io.default)((0,co.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Ie={},lo=be;Object.defineProperty(Ie,"__esModule",{value:!0});var Qe=Ie.default=void 0,uo=lo(je()),po=e;Qe=Ie.default=(0,uo.default)((0,po.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var Re={},mo=be;Object.defineProperty(Re,"__esModule",{value:!0});var Ve=Re.default=void 0,fo=mo(je()),ho=e;Ve=Re.default=(0,fo.default)((0,ho.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function ve({spaceGateway:t,onConfirm:s,onCancel:n}){const{t:o}=E(),[a,r]=y.useState(!1),[i,l]=y.useState(!1),u=(p,x)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),r(x)},c=async p=>{try{p==null||p.stopPropagation(),l(!0),await(s==null?void 0:s(t)),r(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${X(x)}`)}finally{r(!1),l(!1)}},f=p=>{u(p,!1),n==null||n(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(q,{style:{minWidth:24,color:"red"},children:e.jsx(Ht,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(xt,{title:o("storage.spaces.gateway.delete.title"),open:a,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:i}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:i}},onConfirm:c,onCancel:f,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}ve.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool}).isRequired,onConfirm:g.func,onCancel:g.func};ve.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function ze({spaceGateway:t,selected:s,onDelete:n,onConnect:o,enableSwitchToSpace:a,backupInProgress:r,...i}){const{abortBlockletBackup:l}=P(),[u,c]=y.useState(null),{t:f}=E(),[p,x]=y.useState(!1),h=(S,d)=>{S.stopPropagation(),S.preventDefault(),c(d&&S.currentTarget)},b=async S=>{try{x(!0),h(S,!1),await o(t)}catch(d){console.error(d),B.error(d.message)}finally{x(!1)}},D=async S=>{try{x(!0),h(S,!1),await l()}catch(d){console.error(d),B.error(d.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(St,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>h(S,!0),...i,children:e.jsx(Yt,{})}),e.jsxs(yt,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>h(S,!1),children:[e.jsxs(Y,{onClick:S=>{h(S,!1),window.open(Oe(t.endpoint?_t(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:f("common.open")})]}),e.jsxs(Y,{onClick:S=>{h(S,!1),window.open(Oe(Mt(t.endpoint),{allowDomains:null}))},children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.strategy.viewBackupFiles")})]}),!s&&a&&e.jsxs(Y,{onClick:b,children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(Qe,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.connect.switchToSpace")})]}),r&&e.jsxs(Y,{onClick:D,children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(qt,{fontSize:"small"})}),e.jsx(H,{children:f("storage.spaces.connect.abortBlockletBackup")})]}),!r&&e.jsx(ve,{spaceGateway:t,onConfirm:async()=>{c(null),await(n==null?void 0:n(t))},onCancel:()=>c(null)})]})]})}ze.propTypes={spaceGateway:g.shape({name:g.string.isRequired,url:g.string.isRequired,protected:g.bool,endpoint:g.string.isRequired,loading:g.bool}).isRequired,selected:g.bool.isRequired,enableSwitchToSpace:g.bool,onDelete:g.func,onConnect:g.func,backupInProgress:g.bool};ze.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const go=te(({className:t,...s})=>e.jsx(ye,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o,onDeleted:a,onBackedUp:r}){const{t:i,locale:l}=E(),{blocklet:u}=A(),{api:c,info:{did:f}}=M(),{appDid:p,appName:x,appDescription:h,scopes:b,appUrl:D,referrer:S}=$e({blocklet:u}),{backupProgress:d,updateSpaceGateway:se,deleteSpaceGateway:ne,refreshBackupSummary:re,refreshBackups:ae}=P(),[U,L]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:i("storage.spaces.authorize.title",{appName:x},l),scan:i("storage.spaces.authorize.scan",{appName:x},l),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:i("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),ie=n&&!U&&s===fe.DISCONNECTED,ce=n&&!U&&!t.loading&&s===fe.CONNECTED,$=n&&U&&s===fe.CONNECTED&&(d==null?void 0:d.progress)>=0,Z=async()=>{try{if(await Ut(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(i("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o==null||o(null,t);return}}catch(k){console.error(k),o==null||o(k,t);return}v(k=>({...k,open:!0,prefix:ge(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ne.create({baseURL:ge(t.url,"space")}).get,extraParams:{appDid:p,appName:x,appDescription:h,scopes:b,appUrl:D,referrer:S,nodeDid:f,spaceDid:t.did}}))},le=async(k,K)=>{const m=K(k.endpoint),N=Se(m),w=k.space?K(k.space):{};if(t.did&&N!==t.did){v(pe=>({...pe,open:!1}));const F=i("storage.spaces.gateway.switch.failedForMismatchSpace",{name:w!=null&&w.name?w.name:""});B.error(F),o==null||o(new Error(F),t);return}const O={...t,name:w.name??"DID Space",did:w.did??Se(m),endpoint:m};await se(O),v(F=>({...F,open:!1})),o==null||o(null,O)},de=async()=>{try{if(U)return;L(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),r==null||r(k,t)}finally{L(!0)}},ue=async()=>{try{await ne(t),B.success(i("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),a==null||a(null,t)}catch(k){console.error(k),a==null||a(k,t)}};return y.useEffect(()=>{d!=null&&d.completed?(n&&((d==null?void 0:d.progress)===100?(B.success(i("storage.spaces.backupSuccessfully")),r==null||r(null,t)):d.message&&(r==null||r(new Error(d==null?void 0:d.message),t)),d.progress=0,d.message=""),L(!1),setTimeout(()=>{re(),ae()},1e3)):d.progress&&L(!0)},[d]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ce&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:de,children:i("storage.spaces.strategy.backupNow")}),ie&&e.jsx(me,{className:"action-btn",variant:"outlined",size:"small",onClick:Z,children:i("storage.spaces.disconnected.reconnectNow")}),$&&e.jsx(go,{title:(d==null?void 0:d.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:d.message})}),children:e.jsxs(me,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:d==null?void 0:d.progress,size:14,sx:{mr:1}}),d==null?void 0:d.progress,"%"]})}),e.jsx(jt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:le,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:l},"get-endpoint")]}),e.jsx(ze,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:ue,onConnect:Z,enableSwitchToSpace:(d==null?void 0:d.completed)||V(d==null?void 0:d.message),backupInProgress:$})]})}Ae.propTypes={spaceGateway:g.shape({did:g.string.isRequired,name:g.string.isRequired,url:g.string.isRequired,endpoint:g.string.isRequired,protected:g.bool,loading:g.bool}).isRequired,spaceStatus:g.string.isRequired,selected:g.bool.isRequired,onConnected:g.func,onDeleted:g.func,onBackedUp:g.func};Ae.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Xe({...t}){const{t:s}=E();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:s("storage.spaces.backup.records")})}),e.jsx(De,{}),e.jsx(Te,{})]})}Xe.propTypes={};function Ze({...t}){const{t:s}=E(),{autoBackup:n,updateAutoBackup:o}=P(),a=async()=>{try{const r=!(n!=null&&n.enabled);await o({enabled:r}),B.success(s(r?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(r){B.error(r.message)}};return e.jsx(Qt,{checked:!!(n!=null&&n.enabled),onChange:a,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Ze.propTypes={};function xo(){const{t}=E(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=P(),a=n&&!(s!=null&&s.length),r=({spaceGateway:i,spaceStatus:l,selected:u,refresh:c})=>e.jsx(Ae,{spaceGateway:i,spaceStatus:l,selected:u,onConnected:()=>c(),onBackedUp:f=>f&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Ze,{}),e.jsx(oe,{})]}),e.jsx(j,{mt:2,children:a?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(z,{})}):e.jsx(Le,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(i=>e.jsx(Le,{item:!0,xs:12,md:6,children:e.jsx(Tt,{endpoint:i.endpoint,selected:o(i),action:r},i.endpoint)},i.endpoint))})})}),e.jsx(Xe,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ye,{})]})}function So(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=P();return t?e.jsx(We,{relative:"parent",children:e.jsx(z,{})}):V(s)?e.jsx(qe,{}):e.jsx(xo,{})}function yo(){return e.jsx(ke,{children:e.jsx(So,{})})}function jo(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:a,storageEndpoint:r}=It(),i=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return a?e.jsx(We,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(Rt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(vt,{}),e.jsx(j,{sx:i,children:e.jsx(zt,{onConnect:n,storageEndpoint:r})})]})}function bo(){const{t}=E();return e.jsxs(Et,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(jo,{})]})}function Je({navOrientation:t,...s}){const{t:n,locale:o}=E(),{blocklet:a}=A(),r=kt({key:"md"}),[i,l]=bt(),u=i.get("tab")||"backup",c=r?"horizontal":t,f=xe(()=>{var d;const D=[{label:n("common.backup"),value:"backup"}],S=(d=a==null?void 0:a.capabilities)==null?void 0:d.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:n("common.storage"),value:"storage"}),D},[o,c]),x=xe(()=>({backup:e.jsx(yo,{}),storage:e.jsx(bo,{})}))[u],h=D=>{l(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(f.length<=1)return e.jsx(he,{children:x});const b=e.jsx(Ct,{tabs:f,current:u,orientation:c,onChange:h,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...s,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(_e,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(he,{sx:{mt:1},children:x})})]})});if(c==="horizontal")return e.jsxs(j,{...s,children:[e.jsx(_e,{left:b}),e.jsx(he,{sx:{mt:2},children:x})]})}Je.propTypes={navOrientation:g.oneOf(["vertical","horizontal"])};Je.defaultProps={navOrientation:"vertical"};const he=te(j)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
5
5
|
overflow: hidden;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as P,K as b,Z as X,j as e,$ as ve,r as f,P as E,m as O,a0 as We,a1 as Se,a2 as j,a3 as Ge,a4 as re,a5 as He,y as I,X as Z,a6 as qe,k as F,T as Ve,a7 as Ye,B as U,D as Ke,C as je,s as Qe,t as Xe,V as Ce,a8 as Ze,a9 as Je,aa as et,u as M,e as tt,ab as W,o as oe,z as st,ac as ne,x as Pe,q as ae,ad as ot,W as ie,g as J,v as Re,w as ee,ae as rt,af as nt,ag as Te,ah as at,b as B,ai as xe,aj as it,I as lt,ak as ct,M as dt,al as pt,am as mt,an as Ee,ao as De,ap as Be,aq as Ue,ar as Oe,as as N,at as _e,au as $e,av as Ae,aw as ht,ax as ge}from"./index-
|
|
1
|
+
import{n as P,K as b,Z as X,j as e,$ as ve,r as f,P as E,m as O,a0 as We,a1 as Se,a2 as j,a3 as Ge,a4 as re,a5 as He,y as I,X as Z,a6 as qe,k as F,T as Ve,a7 as Ye,B as U,D as Ke,C as je,s as Qe,t as Xe,V as Ce,a8 as Ze,a9 as Je,aa as et,u as M,e as tt,ab as W,o as oe,z as st,ac as ne,x as Pe,q as ae,ad as ot,W as ie,g as J,v as Re,w as ee,ae as rt,af as nt,ag as Te,ah as at,b as B,ai as xe,aj as it,I as lt,ak as ct,M as dt,al as pt,am as mt,an as Ee,ao as De,ap as Be,aq as Ue,ar as Oe,as as N,at as _e,au as $e,av as Ae,aw as ht,ax as ge}from"./index-vDSh3Cp8.js";import{t as ut}from"./toLower-JLSds9id.js";import{P as H,L as ft,A as xt,S as Fe,a as Le}from"./index-UEEm8IH_.js";import{A as gt,D as le,u as yt,W as wt,P as kt,a as Ne,L as Ie}from"./wait-container-DQC3ztrw.js";import{g as te}from"./get-safe-url-DqxIQnIB.js";import{_ as ye}from"./useLocalStorage-CCiP1kGY.js";import{d as bt}from"./Launch-vfC7_2lv.js";import{d as vt}from"./DeleteOutline-Cd_INjPT.js";import{g as St,i as jt}from"./spaces-6FINHsBY.js";import{d as Ct}from"./MoreVert-BgpxfOll.js";import{E as Pt}from"./index-BEz0dAo5.js";import"./url-join-DpTGxJea.js";import"./Close-BTlbj8PZ.js";import"./use-mobile-DaQ7GJZg.js";import"./api-Ci-onPo-.js";function ce({children:t,selected:i}){return e.jsxs(Rt,{children:[t,e.jsx(b,{className:`selected-container ${i?"selected":""}`,children:e.jsx(ve,{className:"selected-icon"})})]})}const Rt=P(b)`
|
|
2
2
|
position: relative;
|
|
3
3
|
|
|
4
4
|
.selected-container {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as y,u as J,_ as Me,aJ as ii,j as e,A as D,aK as In,aL as pr,aM as oi,aN as Ln,aO as rt,aP as Ce,aQ as Se,P as f,n as re,m as z,ae as le,aR as On,aS as ai,aT as Fn,aU as si,y as se,M as Nn,k as A,t as G,aB as pe,aV as Oe,C as Y,V as je,B as X,aW as gr,X as xe,K as q,e as Kt,R as it,aX as li,d as Yt,aY as $e,aZ as fe,ab as ci,a_ as di,a$ as ui,a2 as mi,x as hr,W as $n,T as Un,h as ne,b0 as Vt,a as Nt,Q as Z,b as pt,b1 as xr,b2 as yr,U as br,a4 as $t,b3 as fi,b4 as pi,b5 as gi,b6 as hi,b7 as ot,b8 as vr,a9 as xi,H as yi,b9 as bi,aI as Ze,ba as vi,aa as Et,a7 as At,bb as ji,a8 as Ut,g as Xt,I as wi,bc as Ci,bd as jr,be as Ee,bf as Ae,bg as Si,bh as Di,D as wr,s as zt,al as _i,f as ki,bi as Ri,bj as zn,am as Ti,bk as Pi,bl as Cr,bm as te,bn as Ei,S as Bn,p as Mn,l as Wn,bo as Ai,bp as Ii}from"./index-
|
|
1
|
+
import{r as y,u as J,_ as Me,aJ as ii,j as e,A as D,aK as In,aL as pr,aM as oi,aN as Ln,aO as rt,aP as Ce,aQ as Se,P as f,n as re,m as z,ae as le,aR as On,aS as ai,aT as Fn,aU as si,y as se,M as Nn,k as A,t as G,aB as pe,aV as Oe,C as Y,V as je,B as X,aW as gr,X as xe,K as q,e as Kt,R as it,aX as li,d as Yt,aY as $e,aZ as fe,ab as ci,a_ as di,a$ as ui,a2 as mi,x as hr,W as $n,T as Un,h as ne,b0 as Vt,a as Nt,Q as Z,b as pt,b1 as xr,b2 as yr,U as br,a4 as $t,b3 as fi,b4 as pi,b5 as gi,b6 as hi,b7 as ot,b8 as vr,a9 as xi,H as yi,b9 as bi,aI as Ze,ba as vi,aa as Et,a7 as At,bb as ji,a8 as Ut,g as Xt,I as wi,bc as Ci,bd as jr,be as Ee,bf as Ae,bg as Si,bh as Di,D as wr,s as zt,al as _i,f as ki,bi as Ri,bj as zn,am as Ti,bk as Pi,bl as Cr,bm as te,bn as Ei,S as Bn,p as Mn,l as Wn,bo as Ai,bp as Ii}from"./index-vDSh3Cp8.js";import{T as Li}from"./index-CXQg5kUh.js";import{d as Oi}from"./ArrowDropDown-B4kEWzcV.js";import{u as Qt,C as M,a as qn}from"./index.esm-2g4alCSR.js";import{S as ae}from"./switch-control-C1azX2vK.js";import{P as ie}from"./permission-vMf-uF3v.js";import{D as Sr,g as Fi}from"./index-DHgO5720.js";import{d as Dr}from"./Link-BThqcf18.js";import{d as we}from"./Delete-XCER7bsY.js";import{D as gt}from"./delete-confirm-fBpOTC0X.js";import{I as at}from"./index-CZKkZl9k.js";import{s as Ni}from"./logo-BKA11TRi.js";import{R as _r,a as Bt,b as $i,W as Je}from"./url-evaluation-D2wHtYXf.js";import{_ as Ui}from"./useLocalStorage-CCiP1kGY.js";import{d as zi}from"./Refresh-aZeeMAFw.js";import{L as Bi}from"./LoadingButton-Bq5KEq87.js";import{C as Mi,R as Wi,d as kr}from"./Public-DcmgnkgM.js";import{d as Ue}from"./Add-BgHZW-rC.js";import{B as Rr,D as Hn}from"./status-DIkTFZl1.js";import{i as qi}from"./is-path-prefix-equal-CuHET4mT.js";import{d as Hi}from"./ChevronRight-C0iTeHeW.js";import{d as Gi}from"./MoreVert-BgpxfOll.js";import{d as Tr}from"./Edit-Dl2UnYBE.js";import{d as Ki}from"./CallMerge-BLIVvLPa.js";import{C as Yi}from"./CardContent-DiVfs5o0.js";import{w as Vi}from"./withStyles-D6aG74hb.js";import{S as Xi}from"./Slider-BV7jgO00.js";import"./index-Ce5WAACz.js";import"./Switch-DT2kCliN.js";import"./TableRow-Bj3l8hth.js";import"./useThemeProps-CLbMNkj4.js";import"./emotion-react.browser.esm-SsdnWCKs.js";import"./ViewColumn-Cw8COMnF.js";import"./Search-DwJKG2rp.js";import"./Clear-DNueioFS.js";import"./index-BEz0dAo5.js";import"./TableSearch-12CV3VPc.js";import"./click-to-copy-CvqUTuWC.js";const ve="Dashboard",Pr=y.createContext({}),{Provider:Qi,Consumer:Hs}=Pr,Gn=[ve,D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP],Zi=(t,n)=>{if(t.name===D.DOMAIN_FOR_DEFAULT_SITE)return-1;if(n.name===D.DOMAIN_FOR_DEFAULT_SITE)return 1;const r=Gn.includes(t.name),i=Gn.includes(n.name);return r&&i?Ln(t.name,n.name):r?-1:i?1:Ln(t.name,n.name)},Ji=({sites:t,nodePort:n})=>{const r=window.location.hostname,o=(t||[]).map(a=>{const{id:s,rules:d=[],corsAllowedOrigins:x=[]}=a;let{domain:c,domainAliases:u}=a;u=u||[],[D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP].includes(c)&&(c=ve,u.find(w=>w.value===r)||u.unshift({protected:!1,value:r}));const p={id:s,name:c,type:"domain",items:[],domainAliases:u,isProtected:a.isProtected,corsAllowedOrigins:x};return(d||[]).forEach(w=>{const{id:j,isProtected:R,from:{pathPrefix:v},to:S}=w;if(S.type===D.ROUTING_RULE_TYPES.BLOCKLET){let _="";Number.parseInt(S.port,10)===Number.parseInt(n,10)?(_="Blocklet Server Dashboard",S.type=D.ROUTING_RULE_TYPES.DAEMON):_=S.did,p.items.push({id:j,name:In(v||"/"),title:_,type:"rule",isProtected:R,pathPrefix:v,to:S})}else p.items.push({id:j,pathPrefix:v,name:In(v||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:R,to:S})}),p.items=pr(p.items,w=>w.name),p}).sort(Zi),l=o.reduce((a,s)=>{let{name:d}=s;return d.endsWith(D.BLOCKLET_SITE_GROUP_SUFFIX)&&([d]=d.split(".")),a[d]={...s,rules:s.items},a},{});return{sites:o,siteMap:l}},eo=({did:t,domain:n,mountPoint:r,siteMap:i,params:o}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const a=n||(l.domainAliases||[])[0];if(!a)return null;let s=r;if(!s){const d=l.rules.filter(x=>!x.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];s=d?d.name:"/"}return rt(a.value,s,o)},to=({did:t,mountPoint:n,siteMap:r,params:i}={})=>{if(!r)return[];const o=r[t];if(!o)return[];const l=o.domainAliases||[];if(!l.length)return[];let a=n;if(!a){const s=o.rules.filter(d=>!d.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];a=s?s.name:"/"}return l.map(s=>rt(s.value,a,i))},no=t=>{const n=t.map(i=>i.domain).filter(i=>![D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE].includes(i));let r=[];return t.forEach(i=>r.push(...i.domainAliases||[])),r=r.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:n,domainsAliases:r}};function Kn({children:t}){const{api:n,info:r}=J(),[i,o]=y.useState([]),[l,a]=y.useState([]),[s,d]=y.useState([]),x=Me(async()=>{const{sites:O}=await n.getRoutingSites({input:{snapshotHash:""}}),b=O||[];await Promise.all(b.map(async g=>(g.domainAliases=await ii(g.domainAliases,{getIP:oi}),g)));const m=no(b);o(b),a(m.domains),d([window.location.hostname,...m.domains,...m.domainsAliases.map(g=>g.value)])},[r]),c=(O,b)=>{o(m=>m.map(g=>g.id===O?b.domain?b:{...b,domain:g.domain}:g))},u=O=>n.takeRoutingSnapshot({input:{dryRun:!1,message:encodeURIComponent(O)}}),p=async O=>{const b=await n.addRoutingSite({input:O});o(i.concat(b.site))},w=async(O,b)=>{const m=await n.updateRoutingSite({input:{id:O,...b}});if(m.site&&m.site.id){const g=i.findIndex(k=>k.id===m.site.id);g!==-1&&(i.splice(g,1,m.site),o([].concat(i)))}},j=async O=>{await n.deleteRoutingSite({input:{id:O}}),o(i.filter(b=>b.id!==O))},R=async(O,b,m)=>{const g=await n.addDomainAlias({input:{id:O,domainAlias:b,force:m}});c(O,g.site)},v=async(O,b)=>{const m=await n.deleteDomainAlias({input:{id:O,domainAlias:b}});c(O,m.site)},S=async(O,b)=>{const{site:m}=await n.addRoutingRule({input:{id:O,rule:b}});c(O,m)},_=async(O,b)=>{const{site:m}=await n.updateRoutingRule({input:{id:O,rule:b}});c(O,m)},C=async(O,b)=>{const{site:m}=await n.deleteRoutingRule({input:{id:O,ruleId:b}});c(O,m)},h={loading:x.loading,error:x.error,refresh:x.retry,api:n,actions:{addSite:p,updateSite:w,deleteSite:j,addDomainAlias:R,deleteDomainAlias:v,takeSnapshot:u,addRule:S,updateRule:_,deleteRule:C}},{sites:P,siteMap:I}=Ji({sites:i,nodePort:r.port});return h.sites=P,h.siteMap=I,h.domains=l,h.allDomains=s,h.getBlockletUrl=({did:O,domain:b,mountPoint:m,params:g})=>eo({did:O,domain:b,mountPoint:m,siteMap:h.siteMap,params:g}),h.getBlockletUrls=({did:O,mountPoint:b,params:m})=>to({did:O,mountPoint:b,siteMap:h.siteMap,params:m}),e.jsx(Qi,{value:{routing:h},children:t})}function ue(){const{routing:t}=y.useContext(Pr);return t}function Zt(t){const n=[D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE,D.DOMAIN_FOR_IP_SITE];return typeof window<"u"&&typeof window.location<"u"&&n.push(window.location.hostname),n.includes(t)}var Jt={},ro=Se;Object.defineProperty(Jt,"__esModule",{value:!0});var Er=Jt.default=void 0,io=ro(Ce()),oo=e;Er=Jt.default=(0,io.default)((0,oo.jsx)("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp");function ao(){return null}function en({confirm:t}){const[n,r]=y.useState(null),{t:i}=z(),o=()=>{r(null)},l=async s=>{if(s){let d=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d==="/"?On.push(`${s.pathname}`):(d.endsWith("/")&&(d=d.substring(0,d.length-1)),On.push(`${d}${s.pathname}`)),window.location.reload()}},a=(s,...d)=>{let x=typeof t=="function"?t(s,...d):t;return x?(typeof x=="string"&&(x={description:x}),r({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>o(),...x}),!1):!0};return e.jsxs(so,{children:[e.jsx(ao,{message:a}),n&&e.jsx(le,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})]})}en.propTypes={confirm:f.oneOfType([f.object,f.string,f.func])};en.defaultProps={confirm:null};const so=re.div`
|
|
2
2
|
margin-bottom: 24px;
|
|
3
3
|
.top-btns-alert {
|
|
4
4
|
@media (max-width: ${t=>t.theme.breakpoints.values.sm}px) {
|