@abtnode/webapp 1.17.7-beta-20251227-001958-ea2ba3f5 → 1.17.7-beta-20251229-223813-e1e6c5e3
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-BdvIhlUS.js → AdapterDayjs-BBi3P2IC.js} +1 -1
- package/dist/assets/{Add-75JKngmd.js → Add-DBDPvM2L.js} +1 -1
- package/dist/assets/ArrowDropDown-CqYw-eY9.js +1 -0
- package/dist/assets/{Autocomplete-kOONI_Pq.js → Autocomplete-6CVDh-bw.js} +1 -1
- package/dist/assets/{Breadcrumbs-cTLPSR0j.js → Breadcrumbs-CIhr-IBH.js} +1 -1
- package/dist/assets/{ButtonGroup-CHbmdfp0.js → ButtonGroup-Um1mBtyg.js} +1 -1
- package/dist/assets/{CSSTransition-D4VQqBYl.js → CSSTransition-BcU1vShi.js} +1 -1
- package/dist/assets/{CallMerge-DlG0KEtx.js → CallMerge-CqN4JiFM.js} +1 -1
- package/dist/assets/{CardContent-DzGFYCPu.js → CardContent-C16B5Bpa.js} +1 -1
- package/dist/assets/{ChevronLeft-BtZyYDNZ.js → ChevronLeft-Ds4qWfjb.js} +1 -1
- package/dist/assets/{ChevronRight-RokC-KBT.js → ChevronRight-BFqUOmvp.js} +1 -1
- package/dist/assets/{Clear-1FRwWVql.js → Clear-L4-iFi83.js} +1 -1
- package/dist/assets/{Delete-BwS0ZYTA.js → Delete-DVp4fJb1.js} +1 -1
- package/dist/assets/{DeleteOutline-1X_2pN5H.js → DeleteOutline-CDxyWfLx.js} +1 -1
- package/dist/assets/{Done-CL3etDC5.js → Done-D7TYY_5X.js} +1 -1
- package/dist/assets/{Edit-CHx0TOIp.js → Edit-DYn1CF5Y.js} +1 -1
- package/dist/assets/{ErrorOutline-C1GIrHWO.js → ErrorOutline-By74cLGJ.js} +1 -1
- package/dist/assets/{FilterList-CeGx1Nvy.js → FilterList-Czj4Os71.js} +1 -1
- package/dist/assets/{Google-C7HwiVx9.js → Google-DZPfsfDE.js} +1 -1
- package/dist/assets/{HelpOutline-v-SutwQQ.js → HelpOutline-DS85eUTc.js} +1 -1
- package/dist/assets/{KeyboardArrowDown-CUBW-wSD.js → KeyboardArrowDown-C53dgTNk.js} +1 -1
- package/dist/assets/{Launch-DW7r2j3F.js → Launch-l1uaKrAG.js} +1 -1
- package/dist/assets/{Link-JpBA3kOe.js → Link-Bs8vi6ND.js} +1 -1
- package/dist/assets/{ListItemButton-YCbqUifF.js → ListItemButton-KbcDtzXD.js} +1 -1
- package/dist/assets/{ListSubheader-B7asbL85.js → ListSubheader-C-Lxj5FB.js} +1 -1
- package/dist/assets/{LoadingButton-KZUgibtr.js → LoadingButton-CZNIV9Ok.js} +1 -1
- package/dist/assets/{MoreVert-CAHrwnnF.js → MoreVert-DaM6pG5s.js} +1 -1
- package/dist/assets/{OpenInNew-qP3b9J2q.js → OpenInNew-BQeSMHR-.js} +1 -1
- package/dist/assets/{Refresh-kYd1krYv.js → Refresh-BJnu5a0L.js} +1 -1
- package/dist/assets/{Replay-SZk6LYf7.js → Replay-BV6q004T.js} +1 -1
- package/dist/assets/{Search-l7-Pwd1y.js → Search-CApGhXwm.js} +1 -1
- package/dist/assets/{Stepper-BGGXEyEh.js → Stepper-B2_oAcOZ.js} +1 -1
- package/dist/assets/{TableSearch-7aO3QXBn.js → TableSearch-CKjIHAce.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-CavSDkQH.js → ToggleButtonGroup-t3tLzS74.js} +1 -1
- package/dist/assets/{UnfoldMore-DGe5-aCR.js → UnfoldMore-D2Y42T3n.js} +1 -1
- package/dist/assets/{Verified-D57Ev6tJ.js → Verified-QiB22jgm.js} +1 -1
- package/dist/assets/{VerifiedUser-BVjv0CVW.js → VerifiedUser-kPobsDlg.js} +1 -1
- package/dist/assets/{ViewList-DnUToii8.js → ViewList-Ceb1JHIv.js} +1 -1
- package/dist/assets/{_createAggregator-CvUwaNA9.js → _createAggregator-g-PBWDTI.js} +1 -1
- package/dist/assets/{actions-DmtsArNi.js → actions-BCMsejAj.js} +2 -2
- package/dist/assets/actions-Dp-VL6XB.js +1 -0
- package/dist/assets/{agreement-Cr1FBybU.js → agreement-Bun3wUY-.js} +4 -4
- package/dist/assets/api-DDSUcMPT.js +1 -0
- package/dist/assets/{appearance-349xWfPH.js → appearance-yP6FtjZ0.js} +1 -1
- package/dist/assets/{audit-logs-MqhyOVr_.js → audit-logs-bPLYn_cc.js} +3 -3
- package/dist/assets/base-chart-BZha7l7D.js +1 -0
- package/dist/assets/{blocklet-BWp5BZ2L.js → blocklet-Nw4kpsVs.js} +1 -1
- package/dist/assets/{chain-Cs69RHJH.js → chain-WdOor_5_.js} +1 -1
- package/dist/assets/click-to-copy-DjkhfhsV.js +1 -0
- package/dist/assets/cloneDeep-Bl8wZyrm.js +1 -0
- package/dist/assets/{config-navigation-CB4CUmS1.js → config-navigation-Pdv-g1jO.js} +22 -22
- package/dist/assets/{connect-to-BOU_fUy1.js → connect-to-D2aJnmIt.js} +3 -3
- package/dist/assets/{cssMode-irya--jO.js → cssMode-CbVfvomN.js} +1 -1
- package/dist/assets/{de-CCwoF0w2.js → de-EFAP4yzZ.js} +1 -1
- package/dist/assets/{delete-confirm-Czdis-d2.js → delete-confirm-DCHvoTQs.js} +1 -1
- package/dist/assets/{depsEqual-DtNa6mfL.js → depsEqual-LiU_ATMs.js} +1 -1
- package/dist/assets/{detail-aen8Gspk.js → detail-B-lIb4O1.js} +3 -3
- package/dist/assets/{domains-BRAsjXjE.js → domains-CeCMQUBm.js} +2 -2
- package/dist/assets/{download-DJuVrKpX.js → download-DHuOHOVu.js} +1 -1
- package/dist/assets/{edit.svg-H5puV-Kf.js → edit.svg-D0_FvYeH.js} +1 -1
- package/dist/assets/emotion-cache.browser.esm-D1-P5QGD.js +1 -0
- package/dist/assets/engine-D8Acg7DY.js +1 -0
- package/dist/assets/{freemarker2-PK6zL7Wa.js → freemarker2-Dbd2dz2J.js} +1 -1
- package/dist/assets/{get-safe-url-GMIK5bS7.js → get-safe-url-DDm_hPj1.js} +1 -1
- package/dist/assets/getValidReactChildren-DpcxJbs9.js +1 -0
- package/dist/assets/{graphqlMode-DhfmM5z8.js → graphqlMode-BNREvohj.js} +2 -2
- package/dist/assets/{handlebars-suZg9Rb2.js → handlebars-Ce_TkpEQ.js} +1 -1
- package/dist/assets/{html-DLf47i1s.js → html-CUmDiv7k.js} +1 -1
- package/dist/assets/{html-title-BhYkXb7K.js → html-title-D3mv3IQk.js} +1 -1
- package/dist/assets/{htmlMode-CRO-0abo.js → htmlMode-Ca_TsxJH.js} +1 -1
- package/dist/assets/{iframe-D8OX0v5x.js → iframe-Dt-xbP5x.js} +1 -1
- package/dist/assets/{index-Dk8_eJCH.js → index-2VA5XrmO.js} +17 -17
- package/dist/assets/index-2lzs7bat.js +1 -0
- package/dist/assets/{index-DeYnJhWD.js → index-B0O0JwRT.js} +1 -1
- package/dist/assets/{index-BuAy14Fb.js → index-B11n09kE.js} +1 -1
- package/dist/assets/{index-HMHQfeWc.js → index-B2WmX6Fx.js} +9 -9
- package/dist/assets/{index-B0YA0eex.js → index-BHAdZ1FZ.js} +2 -2
- package/dist/assets/{index-C43er3Ol.js → index-BLI3C2o7.js} +1 -1
- package/dist/assets/index-BPuMob2k.js +1 -0
- package/dist/assets/{index-CjSZc8j3.js → index-BQNKAwfZ.js} +1 -1
- package/dist/assets/{index-DcB5G7mF.js → index-Be8ehpQE.js} +1 -1
- package/dist/assets/{index-CfCUQn4l.js → index-BsjY45Cd.js} +4 -4
- package/dist/assets/{index-D94ou7Gi.js → index-BxX_nqnW.js} +2 -2
- package/dist/assets/{index-C8P0cv0U.js → index-C8CmKnU4.js} +2 -2
- package/dist/assets/{index--sTZZj1Y.js → index-CAA1AdyJ.js} +2 -2
- package/dist/assets/{index-CV64vjhs.js → index-CADLzzXJ.js} +3 -3
- package/dist/assets/index-CKHOafPq.js +79 -0
- package/dist/assets/{index-lJeVBvul.js → index-CL2N86sI.js} +12 -12
- package/dist/assets/index-CODEE-RB.js +5 -0
- package/dist/assets/{index-B8RjSIJa.js → index-CQYzPG_n.js} +1 -1
- package/dist/assets/{index-Devav5mO.js → index-CQogNORn.js} +12 -12
- package/dist/assets/{index-929LkcAj.js → index-CR1U7OM5.js} +8 -8
- package/dist/assets/{index-BQYunZVD.js → index-CTWQgRaZ.js} +1 -1
- package/dist/assets/index-CaDcvTD7.js +155 -0
- package/dist/assets/{index-BbjlOuR9.js → index-CdxsHt3r.js} +3 -3
- package/dist/assets/{index-DV1T4J21.js → index-Ci1hoD9j.js} +2 -2
- package/dist/assets/{index-CUYDbdpc.js → index-CvZItgju.js} +1 -1
- package/dist/assets/{index-DARZEe4H.js → index-CypG4Dbq.js} +2 -2
- package/dist/assets/{index-BLAEccy_.js → index-D0-rZXcm.js} +1 -1
- package/dist/assets/{index-3eT72yhD.js → index-D319vBae.js} +9 -9
- package/dist/assets/index-DJ9zSKl1.js +87 -0
- package/dist/assets/{index-DkSARRFf.js → index-DQItZ4UM.js} +1 -1
- package/dist/assets/{index-Bq_Xf-WS.js → index-DT5BIL2_.js} +1 -1
- package/dist/assets/index-DdYx-VNK.js +1 -0
- package/dist/assets/{index-0K1n4OCx.js → index-DjQqmpzQ.js} +2 -2
- package/dist/assets/{index-DwIPLdSZ.js → index-Dt9htCod.js} +17 -17
- package/dist/assets/{index-Y-QvttbJ.js → index-DtJVzdtH.js} +111 -111
- package/dist/assets/{index-DGClCi00.js → index-Dtkcfmzb.js} +11 -11
- package/dist/assets/{index-LHDtQAe7.js → index-IWOqJkOB.js} +1 -1
- package/dist/assets/{index-sa-k6sge.js → index-KI2LGzUW.js} +1 -1
- package/dist/assets/{index-B9IBU_20.js → index-WbuPRmjd.js} +1 -1
- package/dist/assets/{index-D-GgAn4D.js → index-jT3H-jhB.js} +1 -1
- package/dist/assets/{index-RvLFbIq0.js → index-kRFEBldM.js} +2 -2
- package/dist/assets/{index-DZVqWhON.js → index-umVLVZjs.js} +1 -1
- package/dist/assets/{index-BJDBjriy.js → index-z-tbDeE3.js} +4 -4
- package/dist/assets/{index.esm-D4mbID4N.js → index.esm-Zck39Kvz.js} +1 -1
- package/dist/assets/{install-from-url-B3WY31cp.js → install-from-url-BXftFn4t.js} +1 -1
- package/dist/assets/{invitation--cbaLA7C.js → invitation-4F28SRYz.js} +4 -4
- package/dist/assets/is-path-prefix-equal-BJMXSv43.js +1 -0
- package/dist/assets/item-C1JxTPT2.js +273 -0
- package/dist/assets/{javascript-ChSXcPeU.js → javascript-B0m7UVIe.js} +1 -1
- package/dist/assets/{jsonMode-BRST5wef.js → jsonMode-CgwGbFre.js} +1 -1
- package/dist/assets/{liquid-CpSF9izi.js → liquid-BZyWy1Tr.js} +1 -1
- package/dist/assets/{list-header-CAyaG0bp.js → list-header-BZRIF_iO.js} +1 -1
- package/dist/assets/{lock.svg-DtLI8vnk.js → lock.svg-Ba4McgFD.js} +1 -1
- package/dist/assets/{log-DZS6nYV_.js → log-BFB-zvPt.js} +2 -2
- package/dist/assets/{lottie-react.esm-D7vuHojB.js → lottie-react.esm-CGSms1Pf.js} +1 -1
- package/dist/assets/{mdx-BWUp_fub.js → mdx-BRVCuIrx.js} +1 -1
- package/dist/assets/{memory-ClDXUWJ0.js → memory-B2j_d87p.js} +1 -1
- package/dist/assets/{metric-DyS1o5oY.js → metric-DpvjSsZq.js} +1 -1
- package/dist/assets/omit-CyTnrDNo.js +1 -0
- package/dist/assets/{overview-BZK8iTTP.js → overview-DkMLRtwO.js} +1 -1
- package/dist/assets/{permission-C73DtYHh.js → permission-DTFazP7s.js} +1 -1
- package/dist/assets/{preference-A-YVUe6G.js → preference-DYVCo0KF.js} +9 -9
- package/dist/assets/{python-CxcQpe_X.js → python-B-wSNZ_T.js} +1 -1
- package/dist/assets/{raf-schd.esm-DUBpm6hM.js → raf-schd.esm-B7_MlDzu.js} +1 -1
- package/dist/assets/{razor-CV7jqhrT.js → razor-BR_HjGgi.js} +1 -1
- package/dist/assets/{rotate-session-key-C16BchY6.js → rotate-session-key-Bz5QE7gB.js} +1 -1
- package/dist/assets/{runtime-DQsAvWqZ.js → runtime-DM0B8rA4.js} +1 -1
- package/dist/assets/schema-BKPaewSy.js +1 -0
- package/dist/assets/sdk-CXClyXm7.js +1 -0
- package/dist/assets/{service-DAzvPZkc.js → service-DkoTQaTk.js} +1 -1
- package/dist/assets/{shorten-label-CkQfhtXr.js → shorten-label-BR48Ofqe.js} +1 -1
- package/dist/assets/{simple-select-CuyjHO0U.js → simple-select-D38wTw_o.js} +1 -1
- package/dist/assets/{spaces-CWPgDpWK.js → spaces-YFYDpL5l.js} +1 -1
- package/dist/assets/status-BTCwUhiG.js +1 -0
- package/dist/assets/{status-Dzw7M8P_.js → status-B_ZSV6JY.js} +1 -1
- package/dist/assets/{switch-control-BclMvWCC.js → switch-control-Fq47wOrt.js} +2 -2
- package/dist/assets/{table-icons-9svpZs1q.js → table-icons-DYQRHdVu.js} +1 -1
- package/dist/assets/{team-j4eaMxpB.js → team-DKJfzzKD.js} +1 -1
- package/dist/assets/{toLower-8m1XzQqH.js → toLower-62VYhzjn.js} +1 -1
- package/dist/assets/toUpper-CBmQ5f7q.js +1 -0
- package/dist/assets/traffic-Dh_MwZxy.js +1 -0
- package/dist/assets/{tsMode-CqXYRIKQ.js → tsMode-CxSxmJBQ.js} +1 -1
- package/dist/assets/{typescript-KJ8oiy4w.js → typescript-Dnu6Xv3U.js} +1 -1
- package/dist/assets/{url-evaluation-BstEsUAB.js → url-evaluation-Cf4MPEtF.js} +1 -1
- package/dist/assets/{url-join-0c-XnZLH.js → url-join-P8kMCiOB.js} +1 -1
- package/dist/assets/{use-mobile-BG1HQZl_.js → use-mobile-BnTDQjTV.js} +1 -1
- package/dist/assets/{use-mobile-9lV1jqC7.js → use-mobile-D1KGwOlr.js} +1 -1
- package/dist/assets/{useAsync-Bbnkcz0c.js → useAsync-SwSlukzF.js} +1 -1
- package/dist/assets/{useAsyncRetry-DwNYtCt1.js → useAsyncRetry-BQEwzyM4.js} +1 -1
- package/dist/assets/{useLocalStorage-B2geQn_J.js → useLocalStorage-41az-hAK.js} +1 -1
- package/dist/assets/{useThemeProps-CqzVTStV.js → useThemeProps-Cw6i_sME.js} +1 -1
- package/dist/assets/{util-BRuccBUB.js → util-C9NPDRP-.js} +1 -1
- package/dist/assets/{wait-container-C4LPSsIr.js → wait-container-GLOlfScg.js} +3 -3
- package/dist/assets/{without-wallet--pvprqkp.js → without-wallet-rfYvx_29.js} +1 -1
- package/dist/assets/wrap-locale-C-Q-ES8F.js +1 -0
- package/dist/assets/{xml-DQZh516a.js → xml-D06mM15g.js} +1 -1
- package/dist/assets/{yaml-CpaHe6nN.js → yaml-DrMeEOdm.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ArrowDropDown-CbIxem1P.js +0 -1
- package/dist/assets/actions-BZl9shku.js +0 -1
- package/dist/assets/api-CZXns3iQ.js +0 -1
- package/dist/assets/base-chart-B_hYrlch.js +0 -1
- package/dist/assets/click-to-copy-CJg25x9s.js +0 -1
- package/dist/assets/cloneDeep-CvglcUIb.js +0 -1
- package/dist/assets/emotion-cache.browser.esm-CaLvcLFC.js +0 -1
- package/dist/assets/engine-C4nmXPyL.js +0 -1
- package/dist/assets/getValidReactChildren-BTFGvhfH.js +0 -1
- package/dist/assets/index-BKwmETrp.js +0 -1
- package/dist/assets/index-CHyDna8x.js +0 -79
- package/dist/assets/index-CK6zgnPU.js +0 -5
- package/dist/assets/index-CL23Woxs.js +0 -87
- package/dist/assets/index-DYn_D6bf.js +0 -155
- package/dist/assets/index-Di8tb0lj.js +0 -1
- package/dist/assets/index-Diu0oJmr.js +0 -1
- package/dist/assets/is-path-prefix-equal-BkAKRgRo.js +0 -1
- package/dist/assets/item-9qWg89Hm.js +0 -273
- package/dist/assets/omit-BgwU28m_.js +0 -1
- package/dist/assets/schema-CutOyNqB.js +0 -1
- package/dist/assets/sdk-vbwSpYyc.js +0 -1
- package/dist/assets/status-D1smxOIE.js +0 -1
- package/dist/assets/toUpper-B5GOxJoT.js +0 -1
- package/dist/assets/traffic-DIOEDjRI.js +0 -1
- package/dist/assets/wrap-locale-D8L6OQkL.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{c2 as Fe,c1 as Ge,r as h,c3 as Ke,j as e,ba as ee,c5 as Ye,ci as J,c6 as $e,b$ as He,ck as qe,aG as he,M as q,bp as A,cx as Ce,H as B,Y as V,bh as E,fF as we,aR as Be,b as N,iX as Ve,V as D,gG as Qe,o as f,x as Xe,ay as De,y as fe,am as Ze,p as Je,C as L,T as j,k as et,s as tt,f as st,iY as X,i2 as Z,iZ as ot,K as S,aX as F,aI as T,L as nt,g as H,dp as at,O as Se,R as K,aF as Y,aa as $,a6 as rt,bC as it,fw as ct,b1 as lt,v as pe,w as dt,G as be,Z as Ee,bF as xe,B as pt}from"./index-Y-QvttbJ.js";import{T as ut}from"./html-title-BhYkXb7K.js";import{u as U}from"./blocklet-BWp5BZ2L.js";import{u as mt}from"./use-mobile-BG1HQZl_.js";import{c as Ie,d as ft,e as xt,f as gt,S as ht,g as ue,h as St,b as yt,u as bt,C as kt,D as jt,a as Ct}from"./connect-to-BOU_fUy1.js";import"./index-DARZEe4H.js";import"./index-BojVbZw0.js";import"./api-CZXns3iQ.js";import{d as wt,a as Bt,g as Dt,i as Et,e as ge,f as It,h as Tt,j as Rt}from"./spaces-CWPgDpWK.js";import{v as zt}from"./index-D-GgAn4D.js";import{E as vt}from"./index-DeYnJhWD.js";import{H as Pt}from"./HelpOutline-v-SutwQQ.js";import{H as At}from"./index-LHDtQAe7.js";import{x as Lt}from"./index-DRYJ0xIl.js";import{D as Ut}from"./DeleteOutline-1X_2pN5H.js";import{g as ke}from"./get-safe-url-GMIK5bS7.js";import{S as Ot}from"./switch-control-BclMvWCC.js";import{L as je}from"./list-header-CAyaG0bp.js";import"./OpenInNew-qP3b9J2q.js";import"./ButtonGroup-CHbmdfp0.js";import"./getValidReactChildren-BTFGvhfH.js";import"./FilterList-CeGx1Nvy.js";import"./CSSTransition-D4VQqBYl.js";import"./emotion-cache.browser.esm-CaLvcLFC.js";import"./index-929LkcAj.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DtNa6mfL.js";import"./TableSearch-7aO3QXBn.js";import"./Search-l7-Pwd1y.js";import"./Clear-1FRwWVql.js";import"./MoreVert-CAHrwnnF.js";function Mt(t){return Fe("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${J(s)}`,`fontSize${J(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${J(n.color)}`],s[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ke({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Ft=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Gt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Kt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!q(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Kt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:qt,Consumer:_s}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=Ht({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},G=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=U(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=U(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Je),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(L,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
|
|
2
|
-
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(vt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(F,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):i?e.jsx(H,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(Pt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};function Ue({metadata:t={}}){const{t:s}=D();if(q(t))return e.jsx(H,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=Lt(o,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[s("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:s("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:f.object};function Oe(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:u}=o[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return m?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(H,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>q(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=o?.[i]??{},{status:l,message:p,createdAt:u,metadata:x}=d,m=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!m,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!m;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:u})}}}],[o,n,t]),c=h.useMemo(()=>!o?.length,[o]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(At,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(u,x)=>{u?.preventDefault(),u?.stopPropagation(),a(x)},l=async u=>{try{u?.stopPropagation(),i(!0),await s?.(t),a(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=u=>{d(u,!1),n?.(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(K,{color:"red",onClick:u=>d(u,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[u,x]=h.useState(!1),m=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),m(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),m(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[u||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(K,{onClick:y=>{m(y,!1),window.open(ke(t.endpoint?It(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx($,{children:p("common.open")})]}),e.jsxs(K,{onClick:y=>{m(y,!1),window.open(ke(Tt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(K,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(K,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(ht,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};const Jt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,G=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Rt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o?.(null,t);return}}catch(C){console.error(C),o?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:G})]})}_e.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=O(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=O(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(St,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(s)?e.jsx(Zt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=bt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(jt,{}),e.jsx(S,{sx:c,children:e.jsx(Ct,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(yt,{children:[e.jsxs(F,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[o,l]),x=xe(()=>({backup:e.jsx(ns,{}),storage:e.jsx(rs,{})}))[d],m=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(F,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};const me=ee(S)`
|
|
1
|
+
import{c1 as Ge,c0 as Ke,r as h,c2 as Fe,j as e,b9 as ee,c4 as Ye,ch as Z,c5 as $e,b_ as He,cj as qe,aF as he,K as q,bo as A,cw as Ce,H as B,X as V,bg as E,fE as we,aQ as Be,b as N,iX as Ve,V as D,gG as Qe,o as f,x as Xe,ax as De,y as fe,al as Je,p as Ze,C as L,T as j,k as et,s as tt,f as st,iY as X,i2 as J,iZ as ot,J as S,aW as G,aH as T,L as nt,g as H,dn as at,N as Se,Q as F,aE as Y,a9 as $,a5 as rt,bB as it,fv as ct,b0 as lt,v as pe,w as dt,G as be,Y as Ee,bE as xe,B as pt}from"./index-DtJVzdtH.js";import{T as ut}from"./html-title-D3mv3IQk.js";import{u as U}from"./blocklet-Nw4kpsVs.js";import{u as mt}from"./use-mobile-BnTDQjTV.js";import{c as Ie,d as ft,e as xt,f as gt,S as ht,g as ue,h as St,b as yt,u as bt,C as kt,D as jt,a as Ct}from"./connect-to-D2aJnmIt.js";import"./index-CypG4Dbq.js";import"./index-BojVbZw0.js";import"./api-DDSUcMPT.js";import{d as wt,a as Bt,g as Dt,i as Et,e as ge,f as It,h as Tt,j as Rt}from"./spaces-YFYDpL5l.js";import{v as zt}from"./index-jT3H-jhB.js";import{E as vt}from"./index-B0O0JwRT.js";import{H as Pt}from"./HelpOutline-DS85eUTc.js";import{H as At}from"./index-IWOqJkOB.js";import{x as Lt}from"./index-DRYJ0xIl.js";import{D as Ut}from"./DeleteOutline-CDxyWfLx.js";import{g as ke}from"./get-safe-url-DDm_hPj1.js";import{S as Ot}from"./switch-control-Fq47wOrt.js";import{L as je}from"./list-header-BZRIF_iO.js";import"./OpenInNew-BQeSMHR-.js";import"./ButtonGroup-Um1mBtyg.js";import"./getValidReactChildren-DpcxJbs9.js";import"./FilterList-Czj4Os71.js";import"./CSSTransition-BcU1vShi.js";import"./emotion-cache.browser.esm-D1-P5QGD.js";import"./index-CR1U7OM5.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-LiU_ATMs.js";import"./TableSearch-CKjIHAce.js";import"./Search-CApGhXwm.js";import"./Clear-L4-iFi83.js";import"./MoreVert-DaM6pG5s.js";function Mt(t){return Ge("MuiIcon",t)}Ke("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${Z(s)}`,`fontSize${Z(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${Z(n.color)}`],s[`fontSize${Z(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Fe({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Gt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Kt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Ft({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!q(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Ft({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:qt,Consumer:_s}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=Ht({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},K=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await K({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=U(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=U(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Ze),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(L,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
|
|
2
|
+
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(vt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(G,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):i?e.jsx(H,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(Pt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};function Ue({metadata:t={}}){const{t:s}=D();if(q(t))return e.jsx(H,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=Lt(o,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[s("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:s("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:f.object};function Oe(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:u}=o[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return m?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(H,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>q(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=o?.[i]??{},{status:l,message:p,createdAt:u,metadata:x}=d,m=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!m,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!m;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:u})}}}],[o,n,t]),c=h.useMemo(()=>!o?.length,[o]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(At,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Jt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(u,x)=>{u?.preventDefault(),u?.stopPropagation(),a(x)},l=async u=>{try{u?.stopPropagation(),i(!0),await s?.(t),a(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=u=>{d(u,!1),n?.(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:u=>d(u,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[u,x]=h.useState(!1),m=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),m(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),m(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[u||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(F,{onClick:y=>{m(y,!1),window.open(ke(t.endpoint?It(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx($,{children:p("common.open")})]}),e.jsxs(F,{onClick:y=>{m(y,!1),window.open(ke(Tt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Kt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(ht,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};const Zt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,K=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Rt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o?.(null,t);return}}catch(C){console.error(C),o?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),K&&e.jsx(Zt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:K})]})}_e.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=O(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=O(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(St,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(s)?e.jsx(Jt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=bt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(jt,{}),e.jsx(S,{sx:c,children:e.jsx(Ct,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(yt,{children:[e.jsxs(G,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[o,l]),x=xe(()=>({backup:e.jsx(ns,{}),storage:e.jsx(rs,{})}))[d],m=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};const me=ee(S)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
5
5
|
overflow: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{eA as k}from"./index-DtJVzdtH.js";var m,C;function S(){if(C)return m;C=1;function v(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function A(o,e){for(var r="",i=0,f=-1,t=0,n,l=0;l<=o.length;++l){if(l<o.length)n=o.charCodeAt(l);else{if(n===47)break;n=47}if(n===47){if(!(f===l-1||t===1))if(f!==l-1&&t===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var s=r.lastIndexOf("/");if(s!==r.length-1){s===-1?(r="",i=0):(r=r.slice(0,s),i=r.length-1-r.lastIndexOf("/")),f=l,t=0;continue}}else if(r.length===2||r.length===1){r="",i=0,f=l,t=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+o.slice(f+1,l):r=o.slice(f+1,l),i=l-f-1;f=l,t=0}else n===46&&t!==-1?++t:t=-1}return r}function b(o,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+o+i:i}var g={resolve:function(){for(var e="",r=!1,i,f=arguments.length-1;f>=-1&&!r;f--){var t;f>=0?t=arguments[f]:(i===void 0&&(i=k.cwd()),t=i),v(t),t.length!==0&&(e=t+"/"+e,r=t.charCodeAt(0)===47)}return e=A(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(v(e),e.length===0)return".";var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=A(e,!r),e.length===0&&!r&&(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return v(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];v(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":g.normalize(e)},relative:function(e,r){if(v(e),v(r),e===r||(e=g.resolve(e),r=g.resolve(r),e===r))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var f=e.length,t=f-i,n=1;n<r.length&&r.charCodeAt(n)===47;++n);for(var l=r.length,s=l-n,c=t<s?t:s,u=-1,a=0;a<=c;++a){if(a===c){if(s>c){if(r.charCodeAt(n+a)===47)return r.slice(n+a+1);if(a===0)return r.slice(n+a)}else t>c&&(e.charCodeAt(i+a)===47?u=a:a===0&&(u=0));break}var h=e.charCodeAt(i+a),y=r.charCodeAt(n+a);if(h!==y)break;h===47&&(u=a)}var d="";for(a=i+u+1;a<=f;++a)(a===f||e.charCodeAt(a)===47)&&(d.length===0?d+="..":d+="/..");return d.length>0?d+r.slice(n+u):(n+=u,r.charCodeAt(n)===47&&++n,r.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(v(e),e.length===0)return".";for(var r=e.charCodeAt(0),i=r===47,f=-1,t=!0,n=e.length-1;n>=1;--n)if(r=e.charCodeAt(n),r===47){if(!t){f=n;break}}else t=!1;return f===-1?i?"/":".":i&&f===1?"//":e.slice(0,f)},basename:function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');v(e);var i=0,f=-1,t=!0,n;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var l=r.length-1,s=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(c===47){if(!t){i=n+1;break}}else s===-1&&(t=!1,s=n+1),l>=0&&(c===r.charCodeAt(l)?--l===-1&&(f=n):(l=-1,f=s))}return i===f?f=s:f===-1&&(f=e.length),e.slice(i,f)}else{for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===47){if(!t){i=n+1;break}}else f===-1&&(t=!1,f=n+1);return f===-1?"":e.slice(i,f)}},extname:function(e){v(e);for(var r=-1,i=0,f=-1,t=!0,n=0,l=e.length-1;l>=0;--l){var s=e.charCodeAt(l);if(s===47){if(!t){i=l+1;break}continue}f===-1&&(t=!1,f=l+1),s===46?r===-1?r=l:n!==1&&(n=1):r!==-1&&(n=-1)}return r===-1||f===-1||n===0||n===1&&r===f-1&&r===i+1?"":e.slice(r,f)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return b("/",e)},parse:function(e){v(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var i=e.charCodeAt(0),f=i===47,t;f?(r.root="/",t=1):t=0;for(var n=-1,l=0,s=-1,c=!0,u=e.length-1,a=0;u>=t;--u){if(i=e.charCodeAt(u),i===47){if(!c){l=u+1;break}continue}s===-1&&(c=!1,s=u+1),i===46?n===-1?n=u:a!==1&&(a=1):n!==-1&&(a=-1)}return n===-1||s===-1||a===0||a===1&&n===s-1&&n===l+1?s!==-1&&(l===0&&f?r.base=r.name=e.slice(1,s):r.base=r.name=e.slice(l,s)):(l===0&&f?(r.name=e.slice(1,n),r.base=e.slice(1,s)):(r.name=e.slice(l,n),r.base=e.slice(l,s)),r.ext=e.slice(n,s)),l>0?r.dir=e.slice(0,l-1):f&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return g.posix=g,m=g,m}export{S as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u,j as s,C as d,A as x,ay as v,cw as C,aT as f,af as j,aH as I,J as P,bC as S}from"./index-DtJVzdtH.js";import{I as T}from"./invitation-4F28SRYz.js";import{g as E}from"./get-safe-url-DDm_hPj1.js";import"./index-kRFEBldM.js";import"./index-z-tbDeE3.js";import"./emotion-cache.browser.esm-D1-P5QGD.js";import"./sdk-CXClyXm7.js";import"./wrap-locale-C-Q-ES8F.js";import"./index-WbuPRmjd.js";function R(n){const{searchParams:a}=new URL(window.location.href),g=x(),{api:i,session:r}=v(),{info:l}=u(),c=a.get("redirect"),p=a.get("id"),o=C(async()=>{if(!p)return null;const{data:t}=await i.get("/api/invitation",{params:{inviteId:p,mode:"issue-passport"}});return t}),m=f(()=>{if(o.error)throw o.error;return o?.data}),h=f(async(t,w=e=>e)=>{t&&(t.sessionToken&&j(w(t.sessionToken)),await r.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(I.WELLKNOWN_SERVICE_PATH_PREFIX)?g(e,{replace:!0}):window.location.href=E(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(d,{}):s.jsx(P,{className:"page-invite",sx:{width:"100vw",height:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#f6f8fa",overflow:"auto",padding:"20px"},children:s.jsx(T,{...n,action:"issue-passport",getDataFn:m,createPassportSvg:t=>S(t,l),checkFn:i.get,onLoginSuccess:h,passportColor:"default",onLogin:r.login})})}function b(){return u().loading?s.jsx(d,{}):s.jsx(R,{})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as g,
|
|
1
|
+
import{A as g,bn as v,u as y,j as r,O as f,S as x,Q as h}from"./index-DtJVzdtH.js";import{L as S,D as j}from"./download-DHuOHOVu.js";import{u as L}from"./useLocalStorage-41az-hAK.js";import"./ButtonGroup-Um1mBtyg.js";import"./getValidReactChildren-DpcxJbs9.js";function I(){const c=g(),[s,i]=L("server-logs-filter",{name:"abtnode",type:{abtnode:"error"}}),{name:t=s.name}=v(),{info:l}=y(),n=l.routing.provider,a=[{id:"abtnode",name:"Blocklet Server",types:["error","info","access","stdout","stderr","pm2"]},{id:"blocklet-services",name:"Blocklet Services",types:["error","info","access","stdout","stderr"]}];if(n){const e=`Service Gateway(${n})`;a.push({id:`service-gateway-${n}`,name:e,types:["error","access","security"]})}const d=e=>{i({...s,name:e.target.value}),c(`/logs/${e.target.value}`)},m=r.jsx(f,{sx:{minWidth:240},children:r.jsx(x,{value:t,onChange:d,size:"small",children:a.map(e=>r.jsx(h,{value:e.id,children:e.name},e.id))})}),o=a.find(e=>e.id===t)||a[0],p=o.types.indexOf(s.type[t]||"error"),u=e=>{i({name:t,type:{...s.type,[t]:e}})};return r.jsx(S,{name:o.name,logId:o.id,types:o.types,prepend:m,postpend:r.jsx(j,{id:l.did,name:"blocklet-server"}),defaultTypeIndex:p,onTypeChange:u},o.id)}export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,
|
|
1
|
+
import{j as e,cG as j,J as v,A as P,r as a,p as S,ay as k,u as w,x as b,f as E,aP as K,dk as W,aT as i,b8 as _,w as U,Y as N,C as R,dl as T,dm as z}from"./index-DtJVzdtH.js";import{p as c}from"./index-kRFEBldM.js";function o({children:r,...s}){return e.jsx(j,{...s,did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function F(){const r=P(),{t:s,locale:d}=a.useContext(S),{api:l}=k(),{info:u}=w(),p=b(u),f=E(),n=K({ready:!1,success:!1,error:null,invalidSession:!1}),h=W(),m=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=T(g);if(!z(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};a.useLayoutEffect(()=>m(),[]);const x=i(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=i(()=>{n.success=!0});if(n.invalidSession)return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(_,{style:{color:f.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(o,{children:e.jsx(U,{className:"connect",action:"gen-key-pair",checkFn:l.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:h?.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:p,onSuccess:C,onError:x,locale:d,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(N,{children:e.jsx(R,{})})}export{F as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aG as Ve,j as e,bp as ht,r as x,bF as Y,bh as H,H as q,aI as E,g as gt,o as d,h as ee,av as xt,O as bt,K as N,T as Q,V as X,eQ as ke,P as Fe,it as Ge,bl as Re,aW as Te,U as Ie,bC as Ce,b5 as He,b3 as Ee,C as Qe,f as Ye,f2 as Xe,aQ as Ae,W as jt,au as Je,iu as Ze,v as De,f4 as et,bs as be,fL as tt,dF as yt,s as ae,ah as pe,G as qe,aw as St,iv as vt,iw as Ct,$ as Nt,ix as wt,iy as Rt,iz as Tt,iA as It,N as Et,bz as st,E as At,J as Dt,Q as Ot,S as Lt,R as Ue,iB as kt}from"./index-Y-QvttbJ.js";import{d as Ft,H as nt,g as Pt}from"./index-LHDtQAe7.js";import{S as me}from"./shorten-label-CkQfhtXr.js";import{v as at}from"./index-D-GgAn4D.js";import{T as _t}from"./html-title-BhYkXb7K.js";import{R as Pe}from"./Replay-SZk6LYf7.js";import{R as Bt}from"./Refresh-kYd1krYv.js";import{D as zt,g as Wt}from"./traffic-DIOEDjRI.js";import"./FilterList-CeGx1Nvy.js";import"./CSSTransition-D4VQqBYl.js";import"./emotion-cache.browser.esm-CaLvcLFC.js";import"./index-929LkcAj.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DtNa6mfL.js";import"./TableSearch-7aO3QXBn.js";import"./Search-l7-Pwd1y.js";import"./Clear-1FRwWVql.js";import"./MoreVert-CAHrwnnF.js";import"./iframe-D8OX0v5x.js";import"./ChevronLeft-BtZyYDNZ.js";import"./ChevronRight-RokC-KBT.js";import"./index-DBii9-f-.js";import"./base-chart-B_hYrlch.js";import"./index-DeYnJhWD.js";import"./AdapterDayjs-BdvIhlUS.js";import"./useThemeProps-CqzVTStV.js";import"./visuallyHidden-Dan1xhjv.js";const Mt=Ve(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"})),Kt=Ve(e.jsx("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),it=x.createContext({}),{Provider:Ht,Consumer:Ks}=it;function qt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=ht(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Y(()=>s.meta?.did,[s]),[j,v]=x.useState([]),[P,F]=x.useState({}),w=Y(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return F(se),b(Z.list),S(Z.paging),Z.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const J={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:j,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:J},children:t})}function _e(){const{notificationRecords:t}=x.useContext(it);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(gt,{type:Ut[t],children:t})}const $t=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ot(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:xt(i,s)}):"",S=$t(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],rt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},lt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Vt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:rt(t),enabled:n}},Gt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:lt(t),enabled:n}},Qt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Yt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Xt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Jt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},je=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ye=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ct=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(bt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Q,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Q,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=X();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Q,{children:[s,": "]}),t.map(l=>{const b=ot(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ge,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(j=>j!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=X(),m=ot(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Q,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Wt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Ft.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const es=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];dt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function dt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[i,l]=x.useState(es),[b,m]=x.useState(!0),S=(j,v)=>{v.checked=j.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=j=>{j.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Q,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ge,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(j=>e.jsx(Te,{control:e.jsx(Ie,{checked:j.checked,onChange:v=>S(v,j),name:j.value}),label:j.label},j.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:j=>m(j.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:j=>{j.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Qe,{size:16}),r("common.confirm")]})]})]})}ut.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ut({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=X(),l=Ye(),b=x.useMemo(()=>Xe(l,ct()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:j,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,J]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:tt(c.receiverUser.avatar,h,S)}}));U(o),J(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await j(o);return c?a==="wallet"?Qt(c):a==="email"?Vt(v,c):a==="pushKit"?Gt(v,c):a==="webhook"?Yt(c):!0:!1},[j,v]),Ne=x.useCallback(a=>Xt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},y=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await y(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await y(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Jt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||yt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=Y(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Je,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(jt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(Ze,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),mt=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(Bt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ss,{children:e.jsxs(et,{theme:b,children:[e.jsx(nt,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:Z,options:se,customButtons:mt,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ns,{children:[e.jsxs(Q,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Q,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(Kt,{}):e.jsx(Qe,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Q,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(Mt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(dt,{loading:n,onCancel:u,onConfirm:I})})]})})})}const ts=x.memo(ut),ss=ae.div`
|
|
1
|
+
import{aF as Ve,j as e,bo as ht,r as x,bE as Q,bg as H,H as q,aH as E,g as gt,o as d,h as ee,au as xt,N as bt,J as N,T as Y,V as X,eP as ke,O as Fe,it as Ge,bk as Re,aV as Te,R as Ie,bB as Ce,b4 as He,b2 as Ee,C as Ye,f as Qe,f1 as Xe,aP as Ae,W as yt,at as Je,iu as Ze,v as De,f3 as et,br as be,fK as tt,dE as jt,s as ae,ag as pe,G as qe,av as St,iv as vt,iw as Ct,$ as Nt,ix as wt,iy as Rt,iz as Tt,iA as It,M as Et,by as st,E as At,I as Dt,P as Ot,S as Lt,Q as Ue,iB as kt}from"./index-DtJVzdtH.js";import{d as Ft,H as nt,g as Pt}from"./index-IWOqJkOB.js";import{S as me}from"./shorten-label-BR48Ofqe.js";import{v as at}from"./index-jT3H-jhB.js";import{T as _t}from"./html-title-D3mv3IQk.js";import{R as Pe}from"./Replay-BV6q004T.js";import{R as Bt}from"./Refresh-BJnu5a0L.js";import{D as zt,g as Wt}from"./traffic-Dh_MwZxy.js";import"./FilterList-Czj4Os71.js";import"./CSSTransition-BcU1vShi.js";import"./emotion-cache.browser.esm-D1-P5QGD.js";import"./index-CR1U7OM5.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-LiU_ATMs.js";import"./TableSearch-CKjIHAce.js";import"./Search-CApGhXwm.js";import"./Clear-L4-iFi83.js";import"./MoreVert-DaM6pG5s.js";import"./iframe-Dt-xbP5x.js";import"./ChevronLeft-Ds4qWfjb.js";import"./ChevronRight-BFqUOmvp.js";import"./index-DBii9-f-.js";import"./base-chart-BZha7l7D.js";import"./index-B0O0JwRT.js";import"./AdapterDayjs-BBi3P2IC.js";import"./useThemeProps-Cw6i_sME.js";import"./visuallyHidden-Dan1xhjv.js";const Mt=Ve(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"})),Kt=Ve(e.jsx("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),it=x.createContext({}),{Provider:Ht,Consumer:Ks}=it;function qt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=ht(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Q(()=>s.meta?.did,[s]),[y,v]=x.useState([]),[P,F]=x.useState({}),w=Q(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return F(se),b(Z.list),S(Z.paging),Z.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const J={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:y,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:J},children:t})}function _e(){const{notificationRecords:t}=x.useContext(it);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(gt,{type:Ut[t],children:t})}const $t=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ot(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:xt(i,s)}):"",S=$t(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],rt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},lt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Vt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:rt(t),enabled:n}},Gt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:lt(t),enabled:n}},Yt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Qt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Xt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Jt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},je=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ct=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(bt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=X();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(l=>{const b=ot(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ge,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(y=>y!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=X(),m=ot(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Wt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Ft.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const es=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];dt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function dt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[i,l]=x.useState(es),[b,m]=x.useState(!0),S=(y,v)=>{v.checked=y.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=y=>{y.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ge,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(y=>e.jsx(Te,{control:e.jsx(Ie,{checked:y.checked,onChange:v=>S(v,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:y=>m(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ye,{size:16}),r("common.confirm")]})]})]})}ut.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ut({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=X(),l=Qe(),b=x.useMemo(()=>Xe(l,ct()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:y,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,J]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:tt(c.receiverUser.avatar,h,S)}}));U(o),J(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await y(o);return c?a==="wallet"?Yt(c):a==="email"?Vt(v,c):a==="pushKit"?Gt(v,c):a==="webhook"?Qt(c):!0:!1},[y,v]),Ne=x.useCallback(a=>Xt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},j=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await j(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await j(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Jt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||jt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=Q(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Je,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(yt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(Ze,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),mt=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(Bt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ss,{children:e.jsxs(et,{theme:b,children:[e.jsx(nt,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:Z,options:se,customButtons:mt,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ns,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(Kt,{}):e.jsx(Ye,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(Mt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(dt,{loading:n,onCancel:u,onConfirm:I})})]})})})}const ts=x.memo(ut),ss=ae.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -27,7 +27,7 @@ import{aG as Ve,j as e,bp as ht,r as x,bF as Y,bh as H,H as q,aI as E,g as gt,o
|
|
|
27
27
|
}
|
|
28
28
|
font-size: 12px;
|
|
29
29
|
}
|
|
30
|
-
`,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function as(t){const{wallet:s,push:n,email:r,webhook:i}=t;return[{name:"Wallet",value:e.jsx(de,{item:s})},{name:"Push",value:e.jsx(de,{item:n})},{name:"Email",value:e.jsx(de,{item:r})},...i.total>0?[{name:"Webhook",value:e.jsx(de,{item:i,isWebhook:!0})}]:[]]}function is(t,s,n){const{wallet:r,push:i,email:l,webhook:b}=t;return[{name:"Wallet",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.PUSH,item:i,onResend:s})},{name:"Email",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}Ke.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};de.propTypes={item:d.object.isRequired,isWebhook:d.bool};function de({item:t,isWebhook:s=!1}){const{t:n}=X(),r=s?t.success.length:t.success,i=t.total,l=r===i?"success":"failed";return e.jsx(N,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(te,{config:{status:l},enableTooltip:!1,children:[fe(r)," / ",fe(i)," ",n("notification.sendStatus.success")]})})})}ue.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};function ue({channel:t=E.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:n=!1,onResend:r=()=>{},loading:i=!1}){const{t:l}=X(),{success:b,failed:m,pending:S}=s,h=Zt(t),
|
|
30
|
+
`,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function as(t){const{wallet:s,push:n,email:r,webhook:i}=t;return[{name:"Wallet",value:e.jsx(de,{item:s})},{name:"Push",value:e.jsx(de,{item:n})},{name:"Email",value:e.jsx(de,{item:r})},...i.total>0?[{name:"Webhook",value:e.jsx(de,{item:i,isWebhook:!0})}]:[]]}function is(t,s,n){const{wallet:r,push:i,email:l,webhook:b}=t;return[{name:"Wallet",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.PUSH,item:i,onResend:s})},{name:"Email",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}Ke.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};de.propTypes={item:d.object.isRequired,isWebhook:d.bool};function de({item:t,isWebhook:s=!1}){const{t:n}=X(),r=s?t.success.length:t.success,i=t.total,l=r===i?"success":"failed";return e.jsx(N,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(te,{config:{status:l},enableTooltip:!1,children:[fe(r)," / ",fe(i)," ",n("notification.sendStatus.success")]})})})}ue.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};function ue({channel:t=E.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:n=!1,onResend:r=()=>{},loading:i=!1}){const{t:l}=X(),{success:b,failed:m,pending:S}=s,h=Zt(t),y=n?b.length:b,v=n?m.length:m,P=n?S.length:S,F=async L=>{L.stopPropagation();const k=n?[...new Set([...b,...m].map($=>$))]:[];await r([t],[],!0,k)},w=y+v,U=w>0?y/w*100:0,M=w>0?v/w*100:0;return e.jsxs(os,{successRatio:U,failedRatio:M,children:[e.jsxs(Y,{variant:"h6",children:[h," (",s.total,")"]}),e.jsxs(Y,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Oe.success,fontWeight:600,fontSize:24},children:fe(y)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(N,{className:"unsent-area",children:[e.jsxs(N,{children:[e.jsxs(te,{config:{status:"failed"},enableTooltip:!1,children:[fe(v)," ",l("notification.sendStatus.failed")]}),e.jsxs(te,{config:{status:"pending"},enableTooltip:!1,children:[fe(P)," ",l("notification.sendStatus.pending")]})]}),v>0&&e.jsx(N,{className:"resend-btn",children:e.jsx(De,{size:"small",color:"primary",loading:i,variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:F,children:l("notification.resend")})})]})]})}function Ke({statistics:t,mode:s="simple",onResend:n=()=>{},resending:r=!1}){const i=Q(()=>s==="simple"?as(t):is(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:i.map(l=>e.jsx(at,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(qe,{container:!0,spacing:2,children:i.map(l=>e.jsx(qe,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const os=ae(N)`
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
align-items: flex-start;
|
|
@@ -45,7 +45,7 @@ import{aG as Ve,j as e,bp as ht,r as x,bF as Y,bh as H,H as q,aI as E,g as gt,o
|
|
|
45
45
|
bottom: 0;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
`;pt.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function pt({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:i,locale:l}=X(),{getComponent:b,resendNotification:m}=_e(),[S,h]=x.useState(!1),
|
|
48
|
+
`;pt.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function pt({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:i,locale:l}=X(),{getComponent:b,resendNotification:m}=_e(),[S,h]=x.useState(!1),y=Q(()=>b(t.componentDid)||n,[n,t.componentDid]),v=Ae({tab:r||"info"}),P=x.useCallback(async(p,g,T=!0,D=[])=>{if(!p.length||!t.id)return;const O=g.length>0?g:t?.receivers?.map(_=>_.receiver);if(!O.length)return;let z=[...p];if(z.includes(E.NOTIFICATION_SEND_CHANNEL.PUSH)&&!lt(n)&&(q.warning(i("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),z=z.filter(_=>_!==E.NOTIFICATION_SEND_CHANNEL.PUSH)),z.includes(E.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!rt(n)&&(q.warning(i("notification.sendStatus.reason.unavailable",{channel:"Email"})),z=z.filter(_=>_!==E.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!z.length)try{h(!0),await m({notificationId:t.id,receivers:O,channels:z,resendFailedOnly:T,...z.includes("webhook")&&D.length?{webhookUrls:D}:{}}),q.success("Message has been sent!")}catch(_){console.error("handleResend error",{error:_}),q.error(_.response?_.response.statusText:_.message)}finally{h(!1)}},[n,t.id,t?.receivers,m,i]),F=Q(()=>vt(t),[t]),w=Q(()=>Ct(t),[t]),U=Q(()=>F?t?.actorInfo:[],[t]),M=Q(()=>n?.did||n?.meta?.did||"",[n]);function L(){return[{name:i("notification.from"),value:F&&w?e.jsx(wt,{actors:U,teamDid:M,size:32,showName:!0}):e.jsx(Rt,{size:32,blocklet:y,showName:!0,hideDot:!0})},{name:i("notification.notificationTitle"),value:e.jsx(me,{maxLength:50,children:t.title})},{name:i("notification.body"),value:F?e.jsx(Tt,{notification:t,blocklet:n}):e.jsx(It,{notification:t,rows:0})},{name:i("notification.severity"),value:e.jsx(he,{severity:t.severity})},{name:i("notification.createdAt"),value:e.jsx(Et,{value:t.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(at,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const k={info:{label:i("common.basicInfo"),value:"info",component:L},receivers:{label:i("notification.receiver"),value:"receivers"},statistics:{label:i("notification.statistics"),value:"statistics"}},$=Object.values(k).map(({label:p,value:g})=>({label:p,value:g})),V=k[v.tab]||k.info,J=p=>{v.tab=p};return e.jsx(Nt,{title:i("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{v.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(ls,{children:[e.jsx(N,{className:"tabs",sx:{mx:3},children:e.jsx(_t,{tabs:$,current:v.tab,onChange:J,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[v.tab==="receivers"&&e.jsx(ts,{notificationId:t.id,resending:S,handleResend:P}),v.tab==="statistics"&&e.jsx(Ke,{statistics:t.statistics,mode:"detail",resending:S,onResend:P}),v.tab==="info"&&e.jsx(V.component,{})]})]})})}const rs=x.memo(pt),ls=ae.div`
|
|
49
49
|
& > .notification-row {
|
|
50
50
|
padding: 0;
|
|
51
51
|
}
|
|
@@ -92,7 +92,7 @@ import{aG as Ve,j as e,bp as ht,r as x,bF as Y,bh as H,H as q,aI as E,g as gt,o
|
|
|
92
92
|
overflow: hidden;
|
|
93
93
|
text-overflow: ellipsis;
|
|
94
94
|
}
|
|
95
|
-
`;function ve({blocklet:t=null,label:s=""}){return e.jsx(cs,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(st,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||t.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}ft.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function ft({list:t,label:s,onDelete:n=()=>{}}){return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(
|
|
95
|
+
`;function ve({blocklet:t=null,label:s=""}){return e.jsx(cs,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(st,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||t.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}ft.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function ft({list:t,label:s,onDelete:n=()=>{}}){return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(r=>e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(he,{severity:r})}),onDelete:i=>n(i,r)},r))]})}function ds(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(he,{severity:s})})}function us({customTableButtons:t}){const{t:s,locale:n}=X(),r=Qe(),i=At(r.breakpoints.down("sm")),l=x.useMemo(()=>Xe(r,ct()),[r]),[b,m]=x.useState(!1),{data:S,paging:h,blocklet:y,fetch:v,getComponent:P,componentDids:F,inService:w,teamDid:U}=_e(),M=x.useRef(null),[L,k]=x.useState(null),[$,V]=x.useState("info"),J=`notification-records-${y.meta?.did}`,p=Pt(J),[g,T]=x.useState({pageSize:p.rowsPerPage||10,page:p.page?p.page+1:1,dids:p.dids||[],dateRange:p.dateRange||[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),D=Q(()=>{if(!y.children||!y.children.length)return[];const f=[];return y.children.forEach(u=>{const j=u.did||u.meta?.did;F.includes(j)&&(u.ancestors=[y],f.push(u))}),f},[F,y]),O=async f=>{try{m(!0),await v(f),m(!1)}finally{m(!1)}};x.useEffect(()=>{O(g)},[g]),x.useEffect(()=>{const f=S.find(u=>u.id===L?.id);L&&f&&k({...f})},[S]);const z=(f,u,j,I)=>{f.stopPropagation();const A=j.filter(R=>R!==u);T(R=>({...R,[I]:A,page:1}))},_=({page:f,rowsPerPage:u,filterList:j})=>{const[I=[],,,,A=[]]=j;g.pageSize!==u?T(R=>({...R,pageSize:u,page:1})):g.page!==f+1?T(R=>({...R,page:f+1})):pe(g.dids,I)?pe(g.severities,A)||T(R=>({...R,severities:A,page:1})):T(R=>({...R,dids:I,page:1}))},ie=x.useCallback(()=>{k(null),V("info")},[]),se=x.useCallback(()=>{v(g)},[v,g]),Z=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:f=>f.map((u,j)=>{if(u==="system")return e.jsx("span",{children:s("notification.system")},`system-${j}`);const I=D.find(A=>(A.did||A.meta?.did)===u);return e.jsx(ve,{blocklet:I,label:I?.title||I?.meta?.title},u)}),update:(f,u,j)=>(f[j].splice(u,1),f)},filterOptions:{names:D,logic:(f,u)=>u.length?!u.includes(f):!1,display:(f,u,j,I)=>e.jsxs(Fe,{style:{width:"380px"},children:[e.jsx(Ot,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Lt,{multiple:!0,value:f[j],renderValue:A=>e.jsx(N,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:A.map(R=>{if(R==="system")return e.jsx("span",{children:s("notification.system")},R);const re=D.find(ne=>(ne.did||ne.meta?.did)===R);return e.jsx(ve,{blocklet:re,label:re?.title||re?.meta?.title},R)})}),onChange:A=>{f[j]=A.target.value,u(f[j],j,I)},children:[e.jsx(Ue,{value:"system",children:s("notification.system")}),D.map(A=>{const R=A.did||A.meta?.did;return e.jsx(Ue,{value:R,children:e.jsx(ve,{blocklet:A,label:A.title||A.meta?.title})},R)})]})]})},customBodyRenderLite:f=>{const u=S[f],j=P(u.componentDid);return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[j?e.jsx(st,{size:32,blocklet:j,ancestors:j.ancestors??[]}):e.jsx(Dt,{blocklet:y,size:32}),e.jsx(me,{maxLength:50,children:j?.meta?.title||y?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:f=>{const u=S[f],{receivers:j}=u;return e.jsx(kt,{total:j.length,renderSurplus:I=>I<100?e.jsxs("span",{children:["+",I]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:I=>{I.stopPropagation(),k(u),V("receivers")},children:j.map(I=>{const{receiverUser:A}=I,R=tt(A.avatar,U,w);return e.jsx(Je,{alt:A.fullName,src:`${R}?imageFilter=resize&w=48&h=48`,size:32,did:I.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},I.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:f=>{const u=S[f];return e.jsx(N,{onClick:j=>{j.stopPropagation(),k(u),V("statistics")},children:e.jsx(Ke,{statistics:u.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:f=>{const u=S[f];return e.jsx(me,{maxLength:50,children:u.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:f=>{const u=S[f];return e.jsx(he,{severity:u.severity})},filter:!0,filterType:"custom",filterList:g.severities??[],customFilterListOptions:{render:f=>e.jsx(ft,{list:f,label:s("notification.severity"),onDelete:(u,j)=>{u.stopPropagation(),z(u,j,Z[4].options.filterList,"severities")}}),update:ye},filterOptions:{names:$e,fullWidth:!0,logic:je,display:(f,u,j,I)=>e.jsx(ds,{label:s("notification.severity"),filterList:f,onChange:u,index:j,column:I,filterValues:$e})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:u}=S[f];return e.jsx(Ze,{value:u,locale:n,shouldUpdate:!0})}}}],oe=f=>{T(u=>({...u,dateRange:f,page:1}))},Ne=[...t||[]];return e.jsxs(N,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ps,{isBreakpointsDownSm:i,children:e.jsx(et,{theme:l,children:e.jsx(nt,{className:"main-table",verticalKeyWidth:100,loading:b,locale:n,columns:Z,data:S,durable:J,onChange:_,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:h.page-1,rowsPerPage:h.pageSize,count:h.total,...p,onRowClick:(f,{dataIndex:u})=>{k(S[u])}},title:e.jsx(ze,{value:g.dateRange,onChange:oe}),customButtons:Ne,components:{TableFilterList:f=>e.jsx(We,{...f,itemComponent:u=>e.jsx(Me,{...u,canDelete:j=>j?.columnNames?.[j?.index||0]?.name==="sender"})})}})})}),L&&e.jsx(rs,{refresh:se,onCancel:ie,notification:L,blocklet:y,tab:$})]})}const ps=ae.div`
|
|
96
96
|
td.MuiTableCell-footer {
|
|
97
97
|
border: none !important;
|
|
98
98
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as
|
|
1
|
+
import{u as N,j as o,C as k,ay as b,cZ as U,A as W,V as E,cN as _,r,aX as D,h as d,y as x,al as P,af as R,w as O,aH as A,x as $,ax as H,bC as K,s as V}from"./index-DtJVzdtH.js";import{I as X}from"./invitation-4F28SRYz.js";import"./index-kRFEBldM.js";import"./index-z-tbDeE3.js";import"./emotion-cache.browser.esm-D1-P5QGD.js";import"./sdk-CXClyXm7.js";import"./wrap-locale-C-Q-ES8F.js";import"./index-WbuPRmjd.js";function z(h){const{api:i,session:f}=b(),{info:s}=N(),c=U(),v=W(),{t:l,locale:m}=E(),{encryptKey:y,decrypt:C}=_(),[I,g]=r.useState(!1),p=r.useMemo(()=>new URLSearchParams(c.search).get("inviteId"),[c]),a=D(async()=>{if(!p)return null;let e;const{data:n}=await i.get("/api/invitation",{params:{inviteId:p}}),t=!!d(s,"ownerNft.did")&&n.role.name==="owner";if(t){const u=new URL(window.location.href);u.pathname=x(P(),"/api/did/invite/token"),u.searchParams.set("_ek_",y),u.searchParams.set("inviteId",p);const{data:F}=await i.get(u.href);e=F}return{invitation:n,nextWorkflow:e,needReceiveNFT:t}}),L=r.useCallback(()=>{g(!0)},[]),S=r.useCallback(()=>{if(a.error)throw a.error;return a.value.invitation},[a]),w=r.useCallback(async e=>{e&&(Object.prototype.hasOwnProperty.call(e,"encrypted")&&!e.encrypted?R(e.sessionToken):R(C(e.sessionToken)));const n=new URLSearchParams(c.search);n.delete("inviteId");const t=n.toString();await f.refresh(),v(`/${t&&`?${t}`}`,{replace:!0})},[c,v,f]);if(a.loading)return o.jsx(k,{});const T=()=>{const e=new URL(window.location.href);e.pathname=x(P(),"/api/did/invite/status"),e.searchParams.set("_t_",a.value.nextWorkflow.token),e.searchParams.set("locale",m);const n=setInterval(async()=>{const{data:t}=await i.get(e.href);t.status==="succeed"&&(clearInterval(n),f.updateConnectedInfo(t),w(t))},2e3)},j=()=>{g(!1)};return o.jsxs(M,{className:"page-invite",children:[d(a,"value.needReceiveNFT")&&o.jsx(O,{action:"login",popup:!0,className:"connect",open:I,locale:m,baseUrl:s.launcher.url,checkFn:H.create({baseURL:s.launcher.url}).get,onSuccess:T,onClose:j,checkTimeout:5*60*1e3,webWalletUrl:$(s),extraParams:{nw:d(a,"value.nextWorkflow.url")},messages:{title:l("invite.transferNFTDialog.title",{name:s.name}),scan:l("invite.transferNFTDialog.scan"),confirm:l("invite.transferNFTDialog.confirm"),success:l("invite.transferNFTDialog.success")},prefix:`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did`}),o.jsx(X,{...h,getDataFn:S,createPassportSvg:e=>K(e,s),checkFn:i.get,onLoginSuccess:w,passportColor:"default",onReceive:d(a,"value.needReceiveNFT")?L:null})]})}const M=V.div`
|
|
2
2
|
width: 100vw;
|
|
3
3
|
height: 100%;
|
|
4
4
|
min-height: 100vh;
|
|
@@ -8,4 +8,4 @@ import{u as k,j as o,C as y,az as b,c_ as U,A as W,V as _,cO as E,r,aY as D,h as
|
|
|
8
8
|
background-color: #f6f8fa;
|
|
9
9
|
overflow: auto;
|
|
10
10
|
padding: 20px;
|
|
11
|
-
`;function te(){return
|
|
11
|
+
`;function te(){return N().loading?o.jsx(k,{}):o.jsx(z,{})}export{te as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{r as t,p as n,j as r,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D319vBae.js","./index-DtJVzdtH.js","./index-DGkT7afN.css","./decode-DPztD6kB.js","./index-CX3PrUL2.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as t,p as n,j as r,bK as i,d5 as a}from"./index-DtJVzdtH.js";const s=t.lazy(()=>i(()=>import("./index-D319vBae.js").then(o=>o.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),d=`{
|
|
3
3
|
getNodeInfo {
|
|
4
4
|
code
|
|
5
5
|
info {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,u as
|
|
1
|
+
import{r as a,u as D,j as e,T as k,bf as Y,J as i,s as U,b3 as Q,o as l,p as P,k as M,d6 as X,bl as ee,d as te,Y as re,C as ne,V as se,i as v,a as h,aH as T,b,d7 as oe,I as ie,by as ae,aD as le,d8 as me,G as C,H as R,l as ce,m as ue,A as de,bn as pe}from"./index-DtJVzdtH.js";import{u as fe,T as xe}from"./html-title-D3mv3IQk.js";import{T as ge}from"./traffic-Dh_MwZxy.js";import{H as he}from"./index-IWOqJkOB.js";import{x as V}from"./index-DRYJ0xIl.js";import{C as ye,M as L}from"./memory-B2j_d87p.js";import{C as ve}from"./CardContent-C16B5Bpa.js";import{u as Ce}from"./useLocalStorage-41az-hAK.js";import{T as je,a as Ie}from"./ToggleButtonGroup-t3tLzS74.js";import"./iframe-Dt-xbP5x.js";import"./ChevronLeft-Ds4qWfjb.js";import"./ChevronRight-BFqUOmvp.js";import"./index-DBii9-f-.js";import"./typeof-QjJsDpFa.js";import"./base-chart-BZha7l7D.js";import"./index-B0O0JwRT.js";import"./AdapterDayjs-BBi3P2IC.js";import"./useThemeProps-Cw6i_sME.js";import"./CSSTransition-BcU1vShi.js";import"./visuallyHidden-Dan1xhjv.js";import"./FilterList-Czj4Os71.js";import"./emotion-cache.browser.esm-D1-P5QGD.js";import"./index-CR1U7OM5.js";import"./redux-DfszZyTl.js";import"./depsEqual-LiU_ATMs.js";import"./TableSearch-CKjIHAce.js";import"./Search-CApGhXwm.js";import"./Clear-L4-iFi83.js";import"./MoreVert-DaM6pG5s.js";import"./getValidReactChildren-DpcxJbs9.js";const be=o=>a.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...o},a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.08295 3.2C2.08295 2.58144 2.58439 2.08 3.20295 2.08H28.8029C29.4215 2.08 29.9229 2.58144 29.9229 3.2V13.44C29.9229 14.0586 29.4215 14.56 28.8029 14.56H3.20295C2.58439 14.56 2.08295 14.0586 2.08295 13.44V3.2ZM4.32295 4.32V12.32H27.6829V4.32H4.32295ZM2.08295 18.56C2.08295 17.9414 2.58439 17.44 3.20295 17.44H28.8029C29.4215 17.44 29.9229 17.9414 29.9229 18.56V28.8C29.9229 29.4186 29.4215 29.92 28.8029 29.92H3.20295C2.58439 29.92 2.08295 29.4186 2.08295 28.8V18.56ZM4.32295 19.68V27.68H27.6829V19.68H4.32295Z",fill:"currentColor"}),a.createElement("path",{d:"M8.96297 7.04001H7.68297C7.51323 7.04001 7.35044 7.10744 7.23042 7.22746C7.1104 7.34748 7.04297 7.51027 7.04297 7.68001V8.96001C7.04297 9.12975 7.1104 9.29253 7.23042 9.41256C7.35044 9.53258 7.51323 9.60001 7.68297 9.60001H8.96297C9.13271 9.60001 9.29549 9.53258 9.41552 9.41256C9.53554 9.29253 9.60297 9.12975 9.60297 8.96001V7.68001C9.60297 7.51027 9.53554 7.34748 9.41552 7.22746C9.29549 7.10744 9.13271 7.04001 8.96297 7.04001ZM8.96297 22.4H7.68297C7.51323 22.4 7.35044 22.4674 7.23042 22.5875C7.1104 22.7075 7.04297 22.8703 7.04297 23.04V24.32C7.04297 24.4897 7.1104 24.6525 7.23042 24.7726C7.35044 24.8926 7.51323 24.96 7.68297 24.96H8.96297C9.13271 24.96 9.29549 24.8926 9.41552 24.7726C9.53554 24.6525 9.60297 24.4897 9.60297 24.32V23.04C9.60297 22.8703 9.53554 22.7075 9.41552 22.5875C9.29549 22.4674 9.13271 22.4 8.96297 22.4ZM14.083 7.04001H12.803C12.6332 7.04001 12.4704 7.10744 12.3504 7.22746C12.2304 7.34748 12.163 7.51027 12.163 7.68001V8.96001C12.163 9.12975 12.2304 9.29253 12.3504 9.41256C12.4704 9.53258 12.6332 9.60001 12.803 9.60001H14.083C14.2527 9.60001 14.4155 9.53258 14.5355 9.41256C14.6555 9.29253 14.723 9.12975 14.723 8.96001V7.68001C14.723 7.51027 14.6555 7.34748 14.5355 7.22746C14.4155 7.10744 14.2527 7.04001 14.083 7.04001ZM14.083 22.4H12.803C12.6332 22.4 12.4704 22.4674 12.3504 22.5875C12.2304 22.7075 12.163 22.8703 12.163 23.04V24.32C12.163 24.4897 12.2304 24.6525 12.3504 24.7726C12.4704 24.8926 12.6332 24.96 12.803 24.96H14.083C14.2527 24.96 14.4155 24.8926 14.5355 24.7726C14.6555 24.6525 14.723 24.4897 14.723 24.32V23.04C14.723 22.8703 14.6555 22.7075 14.5355 22.5875C14.4155 22.4674 14.2527 22.4 14.083 22.4Z",fill:"currentColor"}));function Me(){const{api:o,info:s}=D();return e.jsx(ge,{client:o,did:s.did})}function $({style:o={},title:s=null,value:m=null,graph:c=null,description:p=null,empty:f=null}){return e.jsx(ke,{children:e.jsxs(ve,{style:{...o},children:[e.jsx(k,{sx:{color:"text.secondary",fontSize:14},children:s}),f&&Y.isValidElement(f)?e.jsx(i,{style:{height:150},sx:{color:"text.secondary",display:"flex",justifyContent:"center",alignItems:"center"},children:f}):e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"h5",component:"div",sx:{mt:1},children:m}),c,!!p&&e.jsx(i,{sx:{display:"flex",color:"text.secondary",fontSize:12,marginTop:3},children:p})]})]})})}$.propTypes={style:l.object,title:l.node,value:l.node,graph:l.node,description:l.any,empty:l.node};const ke=U(Q)`
|
|
2
2
|
.card-content {
|
|
3
3
|
height: 150px;
|
|
4
4
|
}
|
|
@@ -32,7 +32,7 @@ import{r as a,u as U,j as e,T as k,bg as Q,K as i,s as D,b4 as X,o as l,p as P,k
|
|
|
32
32
|
fill: red;
|
|
33
33
|
stroke: red;
|
|
34
34
|
}
|
|
35
|
-
`;function Ee(o){return e.jsx(
|
|
35
|
+
`;function Ee(o){return e.jsx(X,{...o,sx:ee(s=>({".MuiLinearProgress-root":{height:10},".MuiLinearProgress-colorPrimary":{backgroundColor:s.palette.grey[s.palette.mode==="light"?200:700]},".MuiLinearProgress-bar":{backgroundColor:s.palette.secondary.main}}),o.sx)})}function A(o){const{value:s}=o;return e.jsxs(i,{sx:{display:"flex",alignItems:"center",mt:2},children:[e.jsx(i,{style:{overflow:"hidden"},sx:{width:"100%",mr:1},children:e.jsx(Ee,{variant:"determinate",...o})}),e.jsx(i,{sx:{minWidth:35},children:e.jsx(k,{variant:"body2",color:"textSecondary",children:`${Math.round(s)}%`})})]})}A.propTypes={value:l.number.isRequired};function Z({disk:o={used:0,free:0,total:1,device:""}}){const{t:s}=a.useContext(P),m=[{id:1,className:"used",title:s("system.used"),metric:M(o.used)},{id:2,className:"free",title:s("system.free"),metric:M(o.free)},{id:3,className:"total",title:s("system.total"),metric:M(o.total)}];return e.jsx($,{title:`${s("common.disk")} (${o.device})`,value:M(o.used),graph:e.jsx(i,{sx:{mt:3},children:e.jsx(A,{value:o.used/o.total*100})}),description:m.map((c,p)=>e.jsxs(i,{sx:{marginLeft:p===0?0:2},children:[c.title,": ",c.metric]},c.title))})}Z.propTypes={disk:l.shape({used:l.number,free:l.number,total:l.number,device:l.string})};const w={uptime:0,pid:-1,cpuUsage:0,memoryUsage:0},z="Blocklet Server";function _({initialBlocklets:o}){const{t:s,locale:m}=se(),{api:c,info:p}=D(),[f,E]=Ce("runtime-view-interval",6),[x,j]=a.useState(null),[g,I]=a.useState([]),H=a.useCallback(t=>{j(t)},[]);a.useEffect(()=>{const t=[];t.push({type:"server",groupId:"server",groupName:z,id:"server:daemon",name:"Server (Daemon)",runtimeInfo:w}),t.push({type:"server",groupId:"server",groupName:z,id:"server:service",name:"Server (Service)",runtimeInfo:w}),o.forEach(r=>{v.forEachBlockletSync(r,(n,{id:u,ancestors:d})=>{n.runtimeInfo&&t.push({type:"blocklet",groupId:r.meta.did,groupName:v.getDisplayName(r),id:u,name:v.getDisplayName(n,!0),blocklet:r,component:n,runtimeInfo:n.runtimeInfo,ancestors:d})})}),I(t)},[!!o?.[0]?.appRuntimeInfo]);const[y,F]=a.useState({os:{platform:""},mem:{used:0,free:0,total:1},cpu:{cpus:[],currentLoad:1},disks:[],daemon:{},service:{}}),[N,O]=a.useState({cpu:[],mem:[],daemonMem:[],serviceMem:[]});h(T.EVENTS.NODE_RUNTIME_INFO,t=>{t.mem.total=t.mem.total||0,t.mem.used=t.mem.total-(t.mem.available||0),F(t),I(r=>r.map(n=>n.id==="server:daemon"?{...n,runtimeInfo:{...n.runtimeInfo,...t.daemon}}:n.id==="server:service"?{...n,runtimeInfo:{...n.runtimeInfo,...t.service}}:n))}),h(T.EVENTS.BLOCKLETS_RUNTIME_INFO,t=>{if(!t||!t.length){console.error("incorrect blocklets runtime info format",t);return}I(r=>r.map(n=>{const u=t.find(d=>d.componentId===n.id);return u?{...n,runtimeInfo:{...n.runtimeInfo,...u.runtimeInfo}}:n}))});const B=t=>{I(r=>r.filter(n=>n.groupId!==t.meta.did))},S=async t=>{try{const{blocklet:r}=await c.getBlocklet({input:{did:t.meta.did,attachRuntimeInfo:!0}});r.status!=="running"&&B(r),I(n=>{const u=n.filter(d=>d.groupId!==r.meta.did);return v.forEachBlockletSync(r,(d,{id:J,ancestors:K})=>{d.runtimeInfo&&u.push({type:"blocklet",groupId:r.meta.did,groupName:v.getDisplayName(r),id:J,name:v.getDisplayName(d,!0),blocklet:r,component:d,runtimeInfo:d.runtimeInfo,ancestors:K})}),u})}catch(r){R.error(r.message)}};h(b.BlockletEvents.removed,B),h(b.BlockletEvents.startFailed,B),h(b.BlockletEvents.statusChange,t=>{if(t.status!=="running"){B(t);return}S(t)}),h(b.BlockletEvents.updated,S),h(b.BlockletEvents.started,S);const G=()=>{c.getNodeRuntimeHistory({input:{hours:f}}).then(t=>{const r=t.history||[];O({cpu:r.map(n=>({date:n.date,value:n.cpu})),mem:r.map(n=>({date:n.date,value:n.mem})),daemonMem:r.map(n=>({date:n.date,value:n.daemonMem})),serviceMem:r.map(n=>({date:n.date,value:n.serviceMem}))})}).catch(t=>{R.error(t.message)})};a.useEffect(()=>{G()},[f]);const W=t=>ce(Number(t||0),{locale:ue(m)}),q=[{label:s("common.group"),name:"groupName",options:{customBodyRenderLite(t){const{type:r,blocklet:n,groupName:u}=g[t];return r==="server"?e.jsxs(i,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(oe,{width:"14",height:"14"}),e.jsx(i,{sx:{ml:1},children:u})]}):e.jsxs(i,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(ie,{size:14,blocklet:n}),e.jsx(i,{sx:{ml:1},children:u})]})}}},{label:s("common.name"),name:"name",options:{customBodyRenderLite(t){const{type:r,name:n,component:u,ancestors:d}=g[t];return r==="server"?e.jsxs(i,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(be,{width:"14",height:"14"}),e.jsx(i,{sx:{ml:1},children:n})]}):e.jsxs(i,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(ae,{size:14,blocklet:u,ancestors:d}),e.jsx(i,{sx:{ml:1},children:n})]})}}},{label:s("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(t){const{runtimeInfo:r}=g[t];return W(r.uptime)}}},{label:s("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(t){const{runtimeInfo:r}=g[t];return M(r?.memoryUsage||0)},sortDirection:"asc"}},{label:s("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(t){const{runtimeInfo:r}=g[t];return`${(r.cpuUsage||0).toFixed(1)}%`}}},{label:s("analytics.runtime"),name:"runtimeInfo.runtime",options:{customBodyRenderLite(t){const{runtimeInfo:r}=g[t];return r?.uptime?e.jsxs(i,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(le,{icon:r?.runningDocker?"catppuccin:docker-ignore":"logos:nodejs-icon"}),e.jsx(i,{sx:{ml:1},children:r?.runningDocker?"Docker":"Nodejs"})]}):null}}},{label:s("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid"},{label:s("blocklet.runtimeInfo.port"),name:"runtimeInfo.port"}];return e.jsxs("div",{children:[e.jsxs(i,{sx:{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2},children:[e.jsx(k,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},children:s("analytics.trend")}),e.jsx(je,{size:"small",exclusive:!0,value:f,onChange:(t,r)=>{me(r)&&E(r)},children:[1,3,6,12,24].map(t=>e.jsxs(Ie,{value:t,children:[t,"H"]},t))})]}),e.jsxs(C,{container:!0,spacing:4,sx:{mb:4},children:[e.jsx(C,{size:{lg:3,md:6,sm:6,xs:12},children:e.jsx(ye,{...y.cpu,history:N.cpu,onHover:H,hoverIndex:x})},"cpu"),e.jsx(C,{size:{lg:3,md:6,sm:6,xs:12},children:e.jsx(L,{...y.mem,history:N.mem,onHover:H,hoverIndex:x})},"memory"),e.jsx(C,{size:{lg:3,md:6,sm:6,xs:12},children:e.jsx(L,{title:`Daemon ${s("common.memory")}`,total:V.parseSize(`${p.runtimeConfig.daemonMaxMemoryLimit}MiB`),used:y.daemon.memoryUsage||0,history:N.daemonMem,onHover:H,hoverIndex:x})},"memory-daemon"),e.jsx(C,{size:{lg:3,md:6,sm:6,xs:12},children:e.jsx(L,{title:`Service ${s("common.memory")}`,total:V.parseSize(`${p.runtimeConfig.blockletMaxMemoryLimit}MiB`),instanceCount:y.service.instanceCount||0,used:y.service.memoryUsage||0,history:N.serviceMem,onHover:H,hoverIndex:x})},"memory-service"),y.disks.map(t=>e.jsx(C,{size:{lg:3,md:6,sm:6,xs:12},children:e.jsx(Z,{disk:t})},t.device||"disk"))]}),e.jsx(he,{className:"runtime-insight-list",title:s("analytics.detail"),locale:m,data:g,columns:q,options:{download:!1,filter:!1,print:!1,pagination:!1,rowsPerPage:100}})]})}_.propTypes={initialBlocklets:l.array.isRequired};function He(){const{data:o,externalData:s,initialized:m}=te();if(!m)return e.jsx(re,{relative:"parent",children:e.jsx(ne,{})});const c=[...o,...s];return e.jsx(_,{initialBlocklets:c})}function ot(){const o=de(),{t:s}=a.useContext(P),{tab:m="traffic"}=pe(),c=j=>{o(`/analytics/${j}`)},p=[{label:s("common.traffic"),value:"traffic"},{label:s("common.runtime"),value:"runtime"}],f=fe(p.find(j=>j.value===m),s("common.analytics")),E={traffic:Me,runtime:He},x=E[m]||E.traffic;return e.jsxs(Ne,{children:[f,e.jsx(k,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:s("common.analytics")}),e.jsx(xe,{tabs:p,current:m,onChange:c}),e.jsx("div",{className:"page-content",children:a.isValidElement(x)?x:e.jsx(x,{})})]})}const Ne=U.main`
|
|
36
36
|
.page-header {
|
|
37
37
|
display: flex;
|
|
38
38
|
justify-content: space-between;
|