@abtnode/blocklet-services 1.16.49-beta-20250812-040454-05aece54 → 1.16.49-beta-20250813-141500-f02b41b4
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/api/services/notification/queue.js +14 -9
- package/api/socket/channel/did.js +2 -2
- package/dist/assets/{AdapterDayjs-hXG6wgqC.js → AdapterDayjs-C9drjkA9.js} +1 -1
- package/dist/assets/{Google-CuUa2ivB.js → Google-Dr94kq2T.js} +1 -1
- package/dist/assets/{access-control-6guUEIIp.js → access-control-BcKWG1wa.js} +1 -1
- package/dist/assets/{add-component-core-4uFRHIpx.js → add-component-core-CHSSGHBg.js} +1 -1
- package/dist/assets/{add-resource-_COpArrC.js → add-resource-DC1_sP9P.js} +1 -1
- package/dist/assets/{addon-Cmm3lxUs.js → addon-B8Vu2MS3.js} +1 -1
- package/dist/assets/{advanced-B05ps9YS.js → advanced-DMpADi54.js} +1 -1
- package/dist/assets/{aigne-CsEmFLGi.js → aigne-CBsKTiWL.js} +1 -1
- package/dist/assets/{appearance-Bw11KiXQ.js → appearance-DInXMJY2.js} +1 -1
- package/dist/assets/{ar-gi-DUwmP.js → ar-BKfdi-bl.js} +1 -1
- package/dist/assets/{ar-BrkwppMS.js → ar-RVOyZ73G.js} +1 -1
- package/dist/assets/{arrow-down.svg-_z1Gr5z1.js → arrow-down.svg-DUodC7Ld.js} +1 -1
- package/dist/assets/{audit-logs-CsQOeDrk.js → audit-logs-CzlEEvCI.js} +1 -1
- package/dist/assets/{authorize-DZczp4it.js → authorize-B80jXWd0.js} +1 -1
- package/dist/assets/{base32-CzDOk3cF.js → base32-DjDr5HEK.js} +1 -1
- package/dist/assets/{bind-account-TVWaibO6.js → bind-account-BABAdoh2.js} +1 -1
- package/dist/assets/branding-CMJPNAPT.js +1 -0
- package/dist/assets/{branding-DIfO6Wlq.js → branding-M6PCXaJ1.js} +2 -2
- package/dist/assets/{branding-DnBXFIg2.js → branding-ZwRlAtol.js} +4 -4
- package/dist/assets/{bundle-avatar-CZNhHDkE.js → bundle-avatar-CsgRY1qN.js} +1 -1
- package/dist/assets/{button-B0AX6HJx.js → button-fR96s6VI.js} +1 -1
- package/dist/assets/{click-to-copy-CNVY2jyw.js → click-to-copy-rdt9ohrk.js} +1 -1
- package/dist/assets/{complete-BJRYgLYa.js → complete-GwyliVop.js} +1 -1
- package/dist/assets/{component-LYdOEk37.js → component-C3dWsQvt.js} +3 -3
- package/dist/assets/config-BtB4kSwu.js +53 -0
- package/dist/assets/{config-BsNFHebj.js → config-CCYF_L4r.js} +1 -1
- package/dist/assets/{config-DLIOyrIT.js → config-DApCVY4Y.js} +1 -1
- package/dist/assets/{config-navigation-B8lmgCq0.js → config-navigation-MUBctnXR.js} +3 -3
- package/dist/assets/{config-space-Bf7RiOeS.js → config-space-Dji2nQRV.js} +1 -1
- package/dist/assets/{confirm-B-Pohnpi.js → confirm-B32PxkWp.js} +1 -1
- package/dist/assets/{connect-CxxQdWs5.js → connect-BEFi8dla.js} +1 -1
- package/dist/assets/{connect-CQ41eSpn.js → connect-DqvnfmLZ.js} +1 -1
- package/dist/assets/{connect-to-qV7wuVVK.js → connect-to-DgCDbehT.js} +1 -1
- package/dist/assets/{createClass-Dg_VTkOQ.js → createClass-Dj3hG9Dc.js} +1 -1
- package/dist/assets/{dashboard-CvtXVg-Y.js → dashboard-Tj8yP2Z7.js} +6 -6
- package/dist/assets/{de-DjoPhrWS.js → de-BXIXPwxt.js} +1 -1
- package/dist/assets/{de-BtMLLcnl.js → de-MpfXQ3NK.js} +1 -1
- package/dist/assets/{delete-confirm-DkSfjrm9.js → delete-confirm-B7BHZ7XM.js} +1 -1
- package/dist/assets/{did-address-ByONFwMZ.js → did-address-F4eDvKaA.js} +1 -1
- package/dist/assets/domain-BASPOMcT.js +9 -0
- package/dist/assets/{domain-action-card-CDmXQx1H.js → domain-action-card-DaSjMvff.js} +1 -1
- package/dist/assets/{domains-ItVUzQLa.js → domains-DDbju8VC.js} +1 -1
- package/dist/assets/{email-DCLJdLrL.js → email-BpKR4cMX.js} +1 -1
- package/dist/assets/engine-CG7v_sNE.js +1 -0
- package/dist/assets/{es-CeY3141A.js → es-BpFj8KP-.js} +1 -1
- package/dist/assets/{es-BLM6BW2Z.js → es-DJvu101w.js} +1 -1
- package/dist/assets/{exchange-passport-CSiut7vw.js → exchange-passport-CAXt7cIJ.js} +1 -1
- package/dist/assets/{form-CXB49CUG.js → form-CVIx-hvs.js} +1 -1
- package/dist/assets/{form-text-input-y9UkSEXJ.js → form-text-input-MaDVJnR3.js} +1 -1
- package/dist/assets/{fr-DHiivuwa.js → fr-CilO0zLV.js} +1 -1
- package/dist/assets/{fr-DM9fauTH.js → fr-D9eGKSnG.js} +1 -1
- package/dist/assets/{fuel-jNlTLYIw.js → fuel-DRwUfMsT.js} +1 -1
- package/dist/assets/{gen-access-key-DX2pH7fs.js → gen-access-key-BzfD0YW5.js} +1 -1
- package/dist/assets/gen-simple-access-key-B6hJvna9.js +1 -0
- package/dist/assets/get-safe-url-DM7RwZvc.js +1 -0
- package/dist/assets/{hdkey-OYxbu68D.js → hdkey-CrUMEP4B.js} +1 -1
- package/dist/assets/{hi-DgD0hgry.js → hi-CSHwUi_Z.js} +1 -1
- package/dist/assets/{hi-zAkIId6q.js → hi-yAi4KA86.js} +1 -1
- package/dist/assets/{home-DLBmoHQ2.js → home-CpTX-k1v.js} +1 -1
- package/dist/assets/{id-CNxc03tk.js → id-D-HeXzMz.js} +1 -1
- package/dist/assets/{id-DRypmlkS.js → id-Dc-m_i57.js} +1 -1
- package/dist/assets/{iframe-CDGyGqia.js → iframe-CHpw-i2w.js} +1 -1
- package/dist/assets/{index-BNqNjoec.js → index-0vzZm-sq.js} +1 -1
- package/dist/assets/{index-C1MXs4dK.js → index-5Yk46iGv.js} +1 -1
- package/dist/assets/{index-7ARWVbTs.js → index-BJ9QvinP.js} +1 -1
- package/dist/assets/{index-CkE6QgrS.js → index-BZEuZSGl.js} +1 -1
- package/dist/assets/index-BcdBlJHQ.js +1 -0
- package/dist/assets/{index-wD9l4LeM.js → index-BhtzMAWs.js} +3 -3
- package/dist/assets/{index-C0n8v4Cp.js → index-BkEMXnXG.js} +1 -1
- package/dist/assets/{index-DR0oTIfe.js → index-Bmme4cwW.js} +1 -1
- package/dist/assets/{index-B4oI4SXk.js → index-BuvI59ON.js} +1 -1
- package/dist/assets/{index-CPzKPZVk.js → index-C2jb3qUW.js} +4 -4
- package/dist/assets/{index-BaJEVELd.js → index-CA6SmdD7.js} +1 -1
- package/dist/assets/{index-Df2pSXXR.js → index-CGL7HcjC.js} +1 -1
- package/dist/assets/{index-CLqfXh65.js → index-CruC5qk4.js} +1 -1
- package/dist/assets/{index-BRr23LOn.js → index-Cvi2zSUY.js} +1 -1
- package/dist/assets/{index-DiAhuObw.js → index-D0mybwC6.js} +1 -1
- package/dist/assets/{index-kYCU1Exv.js → index-D1MPZP7H.js} +1 -1
- package/dist/assets/{index-z-8ML1C9.js → index-DAfNMdqh.js} +1 -1
- package/dist/assets/{index-D9CRulWG.js → index-DJuynn-u.js} +1 -1
- package/dist/assets/{index-ZddejrLr.js → index-DM_hFdFx.js} +1 -1
- package/dist/assets/{index-Dg-fihjm.js → index-DNoNJJuw.js} +81 -81
- package/dist/assets/{index-BRP1KIY3.js → index-DRivg_5Z.js} +1 -1
- package/dist/assets/{index-BzuF1xQu.js → index-DpElP3rs.js} +1 -1
- package/dist/assets/{index-CgNRJie5.js → index-O3MJ4eW3.js} +1 -1
- package/dist/assets/{index-CpZPMhFT.js → index-QxHfLMG_.js} +1 -1
- package/dist/assets/{index-BbMfrFOc.js → index-h3WvQRzJ.js} +3 -3
- package/dist/assets/{index-DgBUoYTd.js → index-rNyzt7-f.js} +1 -1
- package/dist/assets/index-xzFvlWY6.js +55 -0
- package/dist/assets/{invitation-2TIhgFxI.js → invitation-BXGvcZRS.js} +1 -1
- package/dist/assets/{invite-BpVhovN4.js → invite-Dinpahed.js} +1 -1
- package/dist/assets/{isURL-JpmdK601.js → isURL-Bb15qx-x.js} +1 -1
- package/dist/assets/{issue-passport-Db3IyDmL.js → issue-passport-Dkz08H9Y.js} +1 -1
- package/dist/assets/{item-DT6l0SVr.js → item-CucTySxT.js} +1 -1
- package/dist/assets/{ja-B5zPuvbe.js → ja-CRcT1olQ.js} +1 -1
- package/dist/assets/{ja-BgI9SuxS.js → ja-DuWRl1OM.js} +1 -1
- package/dist/assets/{ko-D1mgIh26.js → ko-BVbPgR9Q.js} +1 -1
- package/dist/assets/{ko-DxWYUlEG.js → ko-YalU3HfD.js} +1 -1
- package/dist/assets/{landing-page-D7Nuam-y.js → landing-page-BtJCFmD2.js} +1 -1
- package/dist/assets/{layout-CkPC48Ju.js → layout-CRZRIFZ4.js} +1 -1
- package/dist/assets/{list-Bv_zhprU.js → list-C6EcSIvj.js} +1 -1
- package/dist/assets/{list-dUYG3Ahk.js → list-DuOlxUCn.js} +3 -3
- package/dist/assets/localization-DpT56oWf.js +1 -0
- package/dist/assets/{log-BZZMcnOo.js → log-B4-jbFWw.js} +13 -13
- package/dist/assets/logger-fD-zoY7i.js +1 -0
- package/dist/assets/{login-BQTVr2Ix.js → login-C0CJXbnr.js} +1 -1
- package/dist/assets/{login-oauth-callback-YrBLYGL2.js → login-oauth-callback-Dw-6SpLt.js} +1 -1
- package/dist/assets/{logo-uploader-hp3SBdhZ.js → logo-uploader-DfDbtbb8.js} +2 -2
- package/dist/assets/{lost-passport-4zNJXOm_.js → lost-passport-zhSpUcAi.js} +1 -1
- package/dist/assets/{open-window-Zhqej7Dc.js → open-window-DeCkeATD.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-CDRcX7in.js → over-due-invoice-payment-C571LZOO.js} +1 -1
- package/dist/assets/{overview-ChSvzQtv.js → overview-BRXEgGWb.js} +1 -1
- package/dist/assets/{passport-item-BX4n24TJ.js → passport-item-CqMag6bd.js} +1 -1
- package/dist/assets/{permission-CcwCK5jk.js → permission-Dq0o-1GG.js} +1 -1
- package/dist/assets/{preferences-DKHf6oxx.js → preferences-DEym4oLZ.js} +1 -1
- package/dist/assets/profile-embed-CD2afA6i.js +1 -0
- package/dist/assets/{pt-DeehC2Gk.js → pt-B3IRBzK6.js} +1 -1
- package/dist/assets/{pt-vo8CUdkQ.js → pt-DjIqGhZP.js} +1 -1
- package/dist/assets/{publish-resource-DRhFWF1H.js → publish-resource-BdgiCQzb.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-CN6lay1O.js → react-beautiful-dnd.esm-D4Hmrl1P.js} +1 -1
- package/dist/assets/{ru-DGlqMwrt.js → ru-BEEcST35.js} +1 -1
- package/dist/assets/{ru-DPcmVq5_.js → ru-CP5-2ocR.js} +1 -1
- package/dist/assets/{runtime-DsOc3CI-.js → runtime-D60vI2TI.js} +1 -1
- package/dist/assets/sdk-1bCjOEiK.js +1 -0
- package/dist/assets/{security-PrkTELzO.js → security-BfInt_Xi.js} +1 -1
- package/dist/assets/{session-CccpevO4.js → session-B067QcnJ.js} +1 -1
- package/dist/assets/{setup-mioXTSNX.js → setup-Do16jB1g.js} +1 -1
- package/dist/assets/{spaces-ccyzWtGO.js → spaces-ucK1WAQv.js} +1 -1
- package/dist/assets/{start-CyX7g3Wc.js → start-C8luWciP.js} +1 -1
- package/dist/assets/{starting-progress-Dv-PMSrV.js → starting-progress-Dt2mxWxv.js} +1 -1
- package/dist/assets/{status-C2dqS1Qp.js → status-PUMLMu-J.js} +1 -1
- package/dist/assets/{step-actions-CRPdOrrx.js → step-actions-DgcV8zCz.js} +1 -1
- package/dist/assets/{studio-8pwFbDz_.js → studio-B9FByEOI.js} +1 -1
- package/dist/assets/{switch-control-TkSdNEjL.js → switch-control-DxmUKBCX.js} +1 -1
- package/dist/assets/{table-tips-Cw939Sls.js → table-tips-DNfCLdtd.js} +1 -1
- package/dist/assets/{team-B6ADMIin.js → team-BPq5KCHV.js} +1 -1
- package/dist/assets/{th-D51PYJxx.js → th-CslbyUot.js} +1 -1
- package/dist/assets/{th-DH3YSYWo.js → th-DYSyn_pj.js} +1 -1
- package/dist/assets/{traffic-B3OSPNpZ.js → traffic-DzuAj6Gg.js} +1 -1
- package/dist/assets/{transfer-DovcOgtx.js → transfer-DkQeF4Py.js} +1 -1
- package/dist/assets/unsubscribe-BiMAFEJ-.js +1 -0
- package/dist/assets/{use-app-logo-oV4_Gpbf.js → use-app-logo-DzFTqU3i.js} +1 -1
- package/dist/assets/{use-window-close-DnNlurow.js → use-window-close-B9_5KVZh.js} +1 -1
- package/dist/assets/{useLocalStorage-c2PGUYSe.js → useLocalStorage-Cw-tIN0T.js} +1 -1
- package/dist/assets/{user-center-BVU6gSvw.js → user-center-C6APQ1tQ.js} +4 -4
- package/dist/assets/{user-sessions-BMBqVzE9.js → user-sessions-BGZN3e4q.js} +1 -1
- package/dist/assets/{util-P7tJ3St_.js → util-BFlzHx4J.js} +1 -1
- package/dist/assets/{util-xGYUIoLs.js → util-CM3cih5O.js} +1 -1
- package/dist/assets/{vendor-arcblock-B6isO619.js → vendor-arcblock-BOtVH-Qa.js} +1 -1
- package/dist/assets/{vendor-ux-Br1Zu4eg.js → vendor-ux-CwCI0CzW.js} +17 -17
- package/dist/assets/{vi-B-WRpo9V.js → vi-BvKqvojn.js} +1 -1
- package/dist/assets/{vi-Baf2ShPI.js → vi-CSrjam88.js} +1 -1
- package/dist/assets/wait-connect-zhfaNlMr.js +1 -0
- package/dist/assets/wizard-5OKaqjON.js +8 -0
- package/dist/assets/wizard-components-CzzolZVI.js +52 -0
- package/dist/assets/wrap-locale-fD95lScr.js +1 -0
- package/dist/assets/{zh-jdBEl5u8.js → zh-BaEjqGHy.js} +1 -1
- package/dist/assets/{zh-CCW_9vRO.js → zh-DF8soasH.js} +1 -1
- package/dist/assets/{zh-tMEgrdGe.js → zh-GGX-IWj_.js} +1 -1
- package/dist/assets/{zh-tw-oY6_dodA.js → zh-tw-CfEpvT7A.js} +1 -1
- package/dist/assets/{zh-tw-2esms75_.js → zh-tw-xcyHbP3V.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +32 -32
- package/dist/assets/branding-Bu9K-aCC.js +0 -1
- package/dist/assets/config-CZieYCwq.js +0 -53
- package/dist/assets/domain-Bv6VPlTz.js +0 -9
- package/dist/assets/engine-Bd6Eh0_C.js +0 -1
- package/dist/assets/gen-simple-access-key-DJblT-SX.js +0 -1
- package/dist/assets/get-safe-url-Cg-U52oI.js +0 -1
- package/dist/assets/index-B4vHuy5A.js +0 -55
- package/dist/assets/index-O8QTFET3.js +0 -1
- package/dist/assets/localization-DTxP-FFX.js +0 -1
- package/dist/assets/log-1sZ_L4eJ.css +0 -32
- package/dist/assets/logger-CFfnQaY0.js +0 -1
- package/dist/assets/profile-embed-BTTCP7jk.js +0 -1
- package/dist/assets/sdk-Bskg7NCT.js +0 -1
- package/dist/assets/unsubscribe-OBA6L-An.js +0 -1
- package/dist/assets/wait-connect-B1IAhfbk.js +0 -1
- package/dist/assets/wizard-B9NUY_Os.js +0 -8
- package/dist/assets/wizard-components-DoPyyExg.js +0 -52
- package/dist/assets/wrap-locale-Bb9x1dCk.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,y as St,bb as Se,M as ae,ak as f,Q as _,W as u,J as xe,c0 as kt,I as O,aN as Pt,T as I,aj as Rt,b5 as Ee,P as Le,b6 as Z,a5 as Be,z as Ve,A as Ye,cm as It,bf as Tt,U as je,d8 as At,d9 as Mt,at as ee,da as zt,a6 as Y,n as le,D as Et,db as Lt,ar as We,b1 as ke,dc as Bt,aX as Wt,am as J,bp as Dt,bq as ye,a$ as Nt,cV as Ot}from"./vendor-mui-core-B7zoO8f5.js";import{r as y,a as $t,u as Ut,j as Ft}from"./vendor-react-Dvs43sk9.js";import{t as Qe,Z as qt,a7 as _t,R as De,D as Ht,C as ce,n as V,A as Gt}from"./vendor-utils-DtY42AM-.js";import{a as Kt,G as Vt,bw as Yt,c as Pe,d as Qt,Y as Zt,bx as Jt,aU as Re,W as fe,bh as Xt,by as er,a5 as tr,aW as rr,a6 as nr,bz as or}from"./index-Dg-fihjm.js";import{a as T,h as Ze,k as te,g as H,b as E,j as sr}from"./vendor-hooks-BRXKH6Nb.js";import{l as Je}from"./arrow-down.svg-_z1Gr5z1.js";import{G as Ie,aa as N,T as D,aL as ir,a9 as Xe,aM as ar,H as q,aN as lr,aO as cr,aP as Ne,J as dr,D as et,I as Te,aQ as ur,aR as M,a1 as pr,a0 as xr,$ as tt,aS as fr,aT as hr,Z as gr,C as de,a5 as Oe,ab as mr}from"./vendor-ux-Br1Zu4eg.js";import{N as br}from"./list-Bv_zhprU.js";import{d as yr}from"./search-4YYphs0l.js";import{B as $e}from"./bundle-avatar-CZNhHDkE.js";import{h as Ue,T as vr}from"./team-B6ADMIin.js";import{b as wr,d as jr,a as Cr,c as Sr,e as kr,f as Pr,B as Rr}from"./user-center-BVU6gSvw.js";import{N as rt,U as nt}from"./index-DgBUoYTd.js";import{u as re}from"./use-mobile-DM4d_PLd.js";import Ir from"./index-O8QTFET3.js";import{f as X}from"./index-DBs9Ljax.js";import{u as ot}from"./index-BRP1KIY3.js";import{U as ve}from"./user-sessions-BMBqVzE9.js";import Tr from"./index-ZddejrLr.js";import{o as Ar}from"./vendor-arcblock-B6isO619.js";import{c as Mr,b as ue,a as zr,S as Er}from"./index-CLqfXh65.js";import"./index-BaJEVELd.js";import"./index-BojVbZw0.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-Df2pSXXR.js";import"./util-P7tJ3St_.js";import"./base32-CzDOk3cF.js";import"./session-CccpevO4.js";import"./isURL-JpmdK601.js";import"./use-app-logo-oV4_Gpbf.js";import"./index-z-8ML1C9.js";import"./api-IUmhrtIY.js";import"./table-tips-Cw939Sls.js";import"./use-mobile-C_DcJ5SZ.js";import"./passport-item-BX4n24TJ.js";import"./did-address-ByONFwMZ.js";import"./index-BNqNjoec.js";import"./vendor-mui-x-Qph0dQcg.js";import"./AdapterDayjs-hXG6wgqC.js";import"./confirm-B-Pohnpi.js";import"./click-to-copy-CNVY2jyw.js";import"./delete-confirm-DkSfjrm9.js";import"./permission-CcwCK5jk.js";import"./actions-Bf4UKTeu.js";import"./index-DRYJ0xIl.js";function Lr(){let t=new Map;function s({root:o,rootMargin:n,threshold:l}){let i=t.get(o);i||(i=new Map,t.set(o,i));let c=JSON.stringify({rootMargin:n,threshold:l}),p=i.get(c);if(!p){let r=new Map;p={observer:new IntersectionObserver(x=>{x.forEach(m=>{r.get(m.target)?.(m)})},{root:o,rootMargin:n,threshold:l}),entryCallbacks:r},i.set(c,p)}return{observe:(r,x)=>{p.entryCallbacks.set(r,x),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:s}}var Br="0px",Wr=[0],Dr=Lr();function Nr(t){let s=t?.rootMargin??Br,o=t?.threshold??Wr,n=y.useRef(null),l=y.useRef(null),i=y.useRef(null),[c,p]=y.useState(),r=y.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Dr.getObserver({root:l.current,rootMargin:s,threshold:o});v.observe(C,a=>{p(a)}),i.current=v},[s,o]),x=y.useCallback(()=>{let C=i.current,v=n.current;v&&C?.unobserve(v),i.current=null},[]),m=y.useCallback(C=>{x(),n.current=C,r()},[r,x]),h=y.useCallback(C=>{x(),l.current=C,r()},[r,x]);return[m,{entry:c,rootRef:h}]}var Or=Nr;function $r(t){let[s,o]=Or(t),n=!!o.entry?.isIntersecting,[l,i]=y.useState(n);return n&&!l&&i(!0),[s,{...o,isVisible:n,wasEverVisible:l}]}var Ur=$r,Fr=100;function qr({loading:t,hasNextPage:s,onLoadMore:o,rootMargin:n,disabled:l,delayInMs:i=Fr}){let c=y.useRef(o),[p,{rootRef:r,isVisible:x}]=Ur({rootMargin:n});y.useEffect(()=>{c.current=o},[o]);let m=!l&&!t&&x&&s;return y.useEffect(()=>{if(m){let h=setTimeout(()=>{c.current()},i);return()=>{clearTimeout(h)}}},[m,i]),[p,{rootRef:r}]}var _r=qr;const we={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function pe({severity:t,size:s=8}){return we[t]?e.jsx(f,{component:"span",sx:{display:"inline-block",width:s,height:s,borderRadius:"50%",backgroundColor:we[t]||we.info}}):null}st.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function st({theme:t="dark",type:s="button",onSelectType:o,extra:n=void 0,currentTab:l="",loading:i=!1,...c}){const{t:p}=y.useContext(Ie),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],x=g=>{(g!==l||!i)&&o(g)},m=y.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:s==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return s==="line"?Object.assign(g,{}):g},[s,t]),h=(g,k,R)=>e.jsx(_,{disabled:i,onClick:()=>x(g.value),className:`profile-button ${k?"active":""}`,...c,children:g.label},g.value||R),C=(g,k,R)=>e.jsx(_,{variant:"text",disabled:i,onClick:()=>x(g.value),className:`profile-line-button ${k?"active":""}`,...c,children:g.label},g.value||R),v=()=>r?.map((g,k)=>{const R=l===g?.value;return s==="line"?e.jsx(y.Fragment,{children:C(g,R,k)},g.value||k):e.jsx(y.Fragment,{children:h(g,R,k)},g.value||k)}),a=g=>{const{value:k}=g.target;x(k==="all"?"":k)};return s==="select"?e.jsx(St,{sx:{maxWidth:300},children:e.jsx(Se,{value:l||"all",onChange:a,size:"small",label:"Severity",IconComponent:g=>e.jsx(Je,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,k)=>e.jsx(ae,{value:g.value||"all",children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(pe,{severity:g.value}),g.label]})},g.value||k))})}):e.jsxs(f,{className:"severity-tabs",sx:m,children:[e.jsx(f,{sx:{...s==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}it.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function it({loading:t,paging:s,onChange:o}){const{t:n}=y.useContext(Ie),l=xe(r=>r.breakpoints.down("md"));if(s.pageCount<=0||l)return null;const i=(r,x)=>{o({page:x+1})},c=r=>{const x=Number(r.target.value);o({page:1,pageSize:x})},p=s.page-1<=0?0:s.page-1;return e.jsx(f,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(kt,{component:"div",disabled:t,count:s.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:x,count:m})=>`${r}–${x} / ${m!==-1?m:`${n()}more than ${x}`}`,rowsPerPage:s.pageSize,onPageChange:i,onRowsPerPageChange:c})})}const Hr=y.memo(it),Gr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},Fe=6,qe={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Kr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},_e=()=>({...Kr,width:"calc(50% - 8px)"});at.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function at({onFilterChange:t=()=>{},loading:s=!1,type:o="service",blockletMap:n={},filterType:l="component",selectedId:i=[],severity:c=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:x=()=>{},currentReadFilter:m="all"}){const{t:h}=y.useContext(Ie),[C,v]=y.useState(null),a=!!C,[g,k]=y.useState(i),[R,P]=y.useState(c),[b,z]=y.useState(!1),[L,U]=y.useState(""),[j,S]=y.useState([]);y.useEffect(()=>{k(i),P(c)},[i,c]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],G=d=>{(d!==m||!s)&&x(d)},Q=[{label:h("notification.severityType.info"),value:"info"},{label:h("notification.severityType.success"),value:"success"},{label:h("notification.severityType.warning"),value:"warning"},{label:h("notification.severityType.error"),value:"error"}],ne=d=>{v(d.currentTarget),U(""),z(!1)},he=()=>{v(null)},oe=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];k(w),t({id:w,severity:R})},se=d=>{const w=R.includes(d)?R.filter(A=>A!==d):[...R,d];P(w),t({severity:w,id:g})},ge=d=>{U(d.target.value)},me=()=>{z(!b)},K=$t.useMemo(()=>{if(!n.size)return[];const d=[];return l==="component"&&d.push({label:h("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,W=w.title||w.meta?.title||"",F=w.appPid||w.appDid;(l==="component"&&F!==A||l==="entity"&&F===A)&&d.push({label:W,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,l,h]);y.useEffect(()=>{if(L.trim()==="")S(K);else{const d=L.toLowerCase(),w=K.filter(A=>A.label.toLowerCase().includes(d));S(w)}},[L,K]);const be=L.trim()!==""||b?j:j.slice(0,Fe);return e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(f,{sx:{display:"flex",gap:1.5},children:B.map(d=>e.jsxs(_,{disabled:s,onClick:()=>G(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...o==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(f,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(O,{size:"small",onClick:ne,disabled:s,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(N,{icon:Gr,hFlip:!0})}),e.jsx(Pt,{open:a,anchorEl:C,onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("notification.severity")}),e.jsx(f,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||R.length>0)&&e.jsx(_,{size:"small",onClick:()=>{k([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Rt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:h("notification.clear")})})]}),e.jsx(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Ee,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:Q.map(d=>e.jsx(Le,{elevation:0,sx:_e(R.includes(d.value)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...qe},control:e.jsx(Be,{checked:R.includes(d.value),onChange:()=>se(d.value),disabled:s,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(f,{sx:{mb:2},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:h("notification.from")}),e.jsx(f,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Ve,{size:"small",placeholder:"search",value:L,onChange:ge,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Ye,{position:"start",sx:{marginRight:"2px"},children:e.jsx(N,{icon:yr})})}}})})]}),e.jsx(Ee,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Le,{elevation:0,sx:_e(g.includes(d.id)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...qe},control:e.jsx(Be,{checked:g.includes(d.id),onChange:()=>oe(d.id),disabled:s,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx($e,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),j.length>Fe&&L.trim()===""&&e.jsx(_,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(It,{}):e.jsx(Tt,{})})]})]})})]})]}),g.length>0||R.length>0?e.jsxs(f,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[R.map(d=>{const w=Q.find(A=>A.value===d);return e.jsx(je,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),w?w.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=K.find(A=>A.id===d);return e.jsx(je,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx($e,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Vr=ee(zt)`
|
|
1
|
+
import{j as e,y as St,bb as Se,M as ae,ak as f,Q as _,W as u,J as xe,c0 as kt,I as O,aN as Pt,T as I,aj as Rt,b5 as Ee,P as Le,b6 as Z,a5 as Be,z as Ve,A as Ye,cm as It,bf as Tt,U as je,d8 as At,d9 as Mt,at as ee,da as zt,a6 as Y,n as le,D as Et,db as Lt,ar as We,b1 as ke,dc as Bt,aX as Wt,am as J,bp as Nt,bq as ye,a$ as Dt,cV as Ot}from"./vendor-mui-core-B7zoO8f5.js";import{r as y,a as $t,u as Ut,j as Ft}from"./vendor-react-Dvs43sk9.js";import{t as Qe,Z as qt,a7 as _t,R as Ne,D as Ht,C as ce,n as V,A as Gt}from"./vendor-utils-DtY42AM-.js";import{a as Kt,G as Vt,bw as Yt,c as Pe,d as Qt,Y as Zt,bx as Jt,aU as Re,W as fe,bh as Xt,by as er,a5 as tr,aW as rr,a6 as nr,bz as or}from"./index-DNoNJJuw.js";import{a as T,h as Ze,k as te,g as H,b as E,j as sr}from"./vendor-hooks-BRXKH6Nb.js";import{l as Je}from"./arrow-down.svg-DUodC7Ld.js";import{G as Ie,aa as D,T as N,aL as ir,a9 as Xe,aM as ar,H as q,aN as lr,aO as cr,aP as De,J as dr,D as et,I as Te,aQ as ur,aR as M,a1 as pr,a0 as xr,$ as tt,aS as fr,aT as hr,Z as gr,C as de,a5 as Oe,ab as mr}from"./vendor-ux-CwCI0CzW.js";import{N as br}from"./list-C6EcSIvj.js";import{d as yr}from"./search-4YYphs0l.js";import{B as $e}from"./bundle-avatar-CsgRY1qN.js";import{h as Ue,T as vr}from"./team-BPq5KCHV.js";import{b as wr,d as jr,a as Cr,c as Sr,e as kr,f as Pr,B as Rr}from"./user-center-C6APQ1tQ.js";import{N as rt,U as nt}from"./index-rNyzt7-f.js";import{u as re}from"./use-mobile-DM4d_PLd.js";import Ir from"./index-BcdBlJHQ.js";import{f as X}from"./index-DBs9Ljax.js";import{u as ot}from"./index-DRivg_5Z.js";import{U as ve}from"./user-sessions-BGZN3e4q.js";import Tr from"./index-DM_hFdFx.js";import{o as Ar}from"./vendor-arcblock-BOtVH-Qa.js";import{c as Mr,b as ue,a as zr,S as Er}from"./index-CruC5qk4.js";import"./index-CA6SmdD7.js";import"./index-BojVbZw0.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-CGL7HcjC.js";import"./util-BFlzHx4J.js";import"./base32-DjDr5HEK.js";import"./session-B067QcnJ.js";import"./isURL-Bb15qx-x.js";import"./use-app-logo-DzFTqU3i.js";import"./index-DAfNMdqh.js";import"./api-IUmhrtIY.js";import"./table-tips-DNfCLdtd.js";import"./use-mobile-C_DcJ5SZ.js";import"./passport-item-CqMag6bd.js";import"./did-address-F4eDvKaA.js";import"./index-0vzZm-sq.js";import"./vendor-mui-x-Qph0dQcg.js";import"./AdapterDayjs-C9drjkA9.js";import"./confirm-B32PxkWp.js";import"./click-to-copy-rdt9ohrk.js";import"./delete-confirm-B7BHZ7XM.js";import"./permission-Dq0o-1GG.js";import"./actions-Bf4UKTeu.js";import"./index-DRYJ0xIl.js";function Lr(){let t=new Map;function s({root:o,rootMargin:n,threshold:l}){let i=t.get(o);i||(i=new Map,t.set(o,i));let c=JSON.stringify({rootMargin:n,threshold:l}),p=i.get(c);if(!p){let r=new Map;p={observer:new IntersectionObserver(x=>{x.forEach(m=>{r.get(m.target)?.(m)})},{root:o,rootMargin:n,threshold:l}),entryCallbacks:r},i.set(c,p)}return{observe:(r,x)=>{p.entryCallbacks.set(r,x),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:s}}var Br="0px",Wr=[0],Nr=Lr();function Dr(t){let s=t?.rootMargin??Br,o=t?.threshold??Wr,n=y.useRef(null),l=y.useRef(null),i=y.useRef(null),[c,p]=y.useState(),r=y.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Nr.getObserver({root:l.current,rootMargin:s,threshold:o});v.observe(C,a=>{p(a)}),i.current=v},[s,o]),x=y.useCallback(()=>{let C=i.current,v=n.current;v&&C?.unobserve(v),i.current=null},[]),m=y.useCallback(C=>{x(),n.current=C,r()},[r,x]),h=y.useCallback(C=>{x(),l.current=C,r()},[r,x]);return[m,{entry:c,rootRef:h}]}var Or=Dr;function $r(t){let[s,o]=Or(t),n=!!o.entry?.isIntersecting,[l,i]=y.useState(n);return n&&!l&&i(!0),[s,{...o,isVisible:n,wasEverVisible:l}]}var Ur=$r,Fr=100;function qr({loading:t,hasNextPage:s,onLoadMore:o,rootMargin:n,disabled:l,delayInMs:i=Fr}){let c=y.useRef(o),[p,{rootRef:r,isVisible:x}]=Ur({rootMargin:n});y.useEffect(()=>{c.current=o},[o]);let m=!l&&!t&&x&&s;return y.useEffect(()=>{if(m){let h=setTimeout(()=>{c.current()},i);return()=>{clearTimeout(h)}}},[m,i]),[p,{rootRef:r}]}var _r=qr;const we={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function pe({severity:t,size:s=8}){return we[t]?e.jsx(f,{component:"span",sx:{display:"inline-block",width:s,height:s,borderRadius:"50%",backgroundColor:we[t]||we.info}}):null}st.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function st({theme:t="dark",type:s="button",onSelectType:o,extra:n=void 0,currentTab:l="",loading:i=!1,...c}){const{t:p}=y.useContext(Ie),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],x=g=>{(g!==l||!i)&&o(g)},m=y.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:s==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return s==="line"?Object.assign(g,{}):g},[s,t]),h=(g,k,R)=>e.jsx(_,{disabled:i,onClick:()=>x(g.value),className:`profile-button ${k?"active":""}`,...c,children:g.label},g.value||R),C=(g,k,R)=>e.jsx(_,{variant:"text",disabled:i,onClick:()=>x(g.value),className:`profile-line-button ${k?"active":""}`,...c,children:g.label},g.value||R),v=()=>r?.map((g,k)=>{const R=l===g?.value;return s==="line"?e.jsx(y.Fragment,{children:C(g,R,k)},g.value||k):e.jsx(y.Fragment,{children:h(g,R,k)},g.value||k)}),a=g=>{const{value:k}=g.target;x(k==="all"?"":k)};return s==="select"?e.jsx(St,{sx:{maxWidth:300},children:e.jsx(Se,{value:l||"all",onChange:a,size:"small",label:"Severity",IconComponent:g=>e.jsx(Je,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,k)=>e.jsx(ae,{value:g.value||"all",children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(pe,{severity:g.value}),g.label]})},g.value||k))})}):e.jsxs(f,{className:"severity-tabs",sx:m,children:[e.jsx(f,{sx:{...s==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}it.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function it({loading:t,paging:s,onChange:o}){const{t:n}=y.useContext(Ie),l=xe(r=>r.breakpoints.down("md"));if(s.pageCount<=0||l)return null;const i=(r,x)=>{o({page:x+1})},c=r=>{const x=Number(r.target.value);o({page:1,pageSize:x})},p=s.page-1<=0?0:s.page-1;return e.jsx(f,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(kt,{component:"div",disabled:t,count:s.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:x,count:m})=>`${r}–${x} / ${m!==-1?m:`${n()}more than ${x}`}`,rowsPerPage:s.pageSize,onPageChange:i,onRowsPerPageChange:c})})}const Hr=y.memo(it),Gr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},Fe=6,qe={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Kr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},_e=()=>({...Kr,width:"calc(50% - 8px)"});at.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function at({onFilterChange:t=()=>{},loading:s=!1,type:o="service",blockletMap:n={},filterType:l="component",selectedId:i=[],severity:c=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:x=()=>{},currentReadFilter:m="all"}){const{t:h}=y.useContext(Ie),[C,v]=y.useState(null),a=!!C,[g,k]=y.useState(i),[R,P]=y.useState(c),[b,z]=y.useState(!1),[L,U]=y.useState(""),[j,S]=y.useState([]);y.useEffect(()=>{k(i),P(c)},[i,c]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],G=d=>{(d!==m||!s)&&x(d)},Q=[{label:h("notification.severityType.info"),value:"info"},{label:h("notification.severityType.success"),value:"success"},{label:h("notification.severityType.warning"),value:"warning"},{label:h("notification.severityType.error"),value:"error"}],ne=d=>{v(d.currentTarget),U(""),z(!1)},he=()=>{v(null)},oe=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];k(w),t({id:w,severity:R})},se=d=>{const w=R.includes(d)?R.filter(A=>A!==d):[...R,d];P(w),t({severity:w,id:g})},ge=d=>{U(d.target.value)},me=()=>{z(!b)},K=$t.useMemo(()=>{if(!n.size)return[];const d=[];return l==="component"&&d.push({label:h("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,W=w.title||w.meta?.title||"",F=w.appPid||w.appDid;(l==="component"&&F!==A||l==="entity"&&F===A)&&d.push({label:W,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,l,h]);y.useEffect(()=>{if(L.trim()==="")S(K);else{const d=L.toLowerCase(),w=K.filter(A=>A.label.toLowerCase().includes(d));S(w)}},[L,K]);const be=L.trim()!==""||b?j:j.slice(0,Fe);return e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(f,{sx:{display:"flex",gap:1.5},children:B.map(d=>e.jsxs(_,{disabled:s,onClick:()=>G(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...o==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(f,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(O,{size:"small",onClick:ne,disabled:s,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(D,{icon:Gr,hFlip:!0})}),e.jsx(Pt,{open:a,anchorEl:C,onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("notification.severity")}),e.jsx(f,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||R.length>0)&&e.jsx(_,{size:"small",onClick:()=>{k([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Rt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:h("notification.clear")})})]}),e.jsx(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Ee,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:Q.map(d=>e.jsx(Le,{elevation:0,sx:_e(R.includes(d.value)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...qe},control:e.jsx(Be,{checked:R.includes(d.value),onChange:()=>se(d.value),disabled:s,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(f,{sx:{mb:2},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:h("notification.from")}),e.jsx(f,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Ve,{size:"small",placeholder:"search",value:L,onChange:ge,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Ye,{position:"start",sx:{marginRight:"2px"},children:e.jsx(D,{icon:yr})})}}})})]}),e.jsx(Ee,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Le,{elevation:0,sx:_e(g.includes(d.id)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...qe},control:e.jsx(Be,{checked:g.includes(d.id),onChange:()=>oe(d.id),disabled:s,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx($e,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),j.length>Fe&&L.trim()===""&&e.jsx(_,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(It,{}):e.jsx(Tt,{})})]})]})})]})]}),g.length>0||R.length>0?e.jsxs(f,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[R.map(d=>{const w=Q.find(A=>A.value===d);return e.jsx(je,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),w?w.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=K.find(A=>A.id===d);return e.jsx(je,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx($e,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Vr=ee(zt)`
|
|
2
2
|
position: fixed;
|
|
3
3
|
bottom: 20px;
|
|
4
4
|
right: 20px;
|
|
@@ -73,7 +73,7 @@ import{j as e,y as St,bb as Se,M as ae,ak as f,Q as _,W as u,J as xe,c0 as kt,I
|
|
|
73
73
|
*::-webkit-scrollbar {
|
|
74
74
|
display: none; /* Chrome, Safari and Opera */
|
|
75
75
|
}
|
|
76
|
-
`;lt.propTypes={blocklets:u.array,context:u.object,pagination:u.bool,inDialog:u.bool,filterType:u.oneOf(["component","entity"]),toViewAll:u.func,type:u.oneOf(["server","service"])};function lt({blocklets:t=[],context:s,pagination:o=!0,inDialog:n=!1,filterType:l="component",toViewAll:i=()=>{},type:c="service"}){const{data:p,paging:r,refresh:x,loading:m,params:h,onReadNotification:C,componentDids:v,filterUnReadCount:a,initial:g}=s,k=d=>{x({...h,severity:d&&typeof d=="string"?[d]:d||[],paging:{...h.paging,page:1}})},[R]=Ut(),P=T(()=>R.get("id"),[R]),b=xe(d=>d.breakpoints.down("md")),[z,L]=y.useState(0),[U,j]=y.useState(!1),S=y.useMemo(()=>h.read===!1?"unread":"all",[h.read]),B=T(()=>Qe(d=>{if(m)return;const w=p.length,A=p.filter(F=>!Ue(F)).length;let W={...h,append:!0,paging:{...h.paging,...d,currentPage:(r.currentPage||0)+1}};S==="unread"&&A<w&&d.page>h.paging.page&&(W={...h,append:!0,paging:{...h.paging,...d,page:h.paging.page||1,currentPage:(r.currentPage||0)+1}}),x(W)},500),[p,h,S,r,m,x]);Ze(()=>{g&&typeof g=="function"&&g()}),y.useEffect(()=>{(!r.currentPage||r.currentPage===1)&&L(r.total)},[r.total,r.currentPage]),y.useEffect(()=>{setTimeout(()=>{const d=document.getElementById(P);d&&d.scrollIntoView({behavior:"smooth",block:"center"}),j(!0)},100),setTimeout(()=>{j(!1)},3e3)},[P]);const G=T(()=>p?.length>0&&p.length<z,[p,z]),Q=y.useCallback(d=>{const{blocklet:w={}}=window,A=[w?.did,...(w?.ancestors||[]).map(W=>W)];return v?.includes(d)||A.findIndex(W=>W===d)>-1},[v]),ne=y.useMemo(()=>{const d=new Map;return t.length&&t.forEach(w=>{const A=w?.did||w.meta?.did;A&&!d.has(A)&&(w.ancestors=[],d.set(A,w),w?.alsoKnownAs?.length>0&&w.alsoKnownAs.forEach(W=>{d.has(W)||d.set(W,w)})),w?.children?.length>0&&w.children.forEach(W=>{const F=W?.did||W.meta?.did;F&&!d.has(F)&&Q(F)&&(W.ancestors=[w],d.set(F,W))})}),d},[t,Q]),he=y.useCallback(()=>{m||B({page:r.page+1})},[r.page,m,B]),[oe]=_r({loading:m,hasNextPage:G,onLoadMore:he}),se=d=>{!d||Ue(d)||C(d.id).then(()=>{n&&i()})},ge=({severity:d,id:w})=>{if(m)return;let A={};l==="component"?A={entityId:[],componentDid:w}:l==="entity"&&(A={componentDid:[],entityId:w}),x({...h,severity:d,...A,paging:{...h.paging,page:1}})},me=d=>{if(m)return;let w={...h,paging:{...h.paging,page:1}};d==="unread"?(w.read=!1,w.paging.currentPage=1):w=qt(w,"read"),x(w)},K=T(()=>l==="component"?Array.isArray(h.componentDid)?h.componentDid:[]:l==="entity"?Array.isArray(h.entityId)?h.entityId:[]:[],[h,l]),be=T(()=>(Array.isArray(h.severity)?h.severity:[])[0]||"",[h.severity]);return e.jsxs(Qr,{inDialog:!!n,children:[n?e.jsx(st,{currentTab:be,type:"line",theme:"light",onSelectType:k}):e.jsx(at,{loading:m,blockletMap:ne,unReadCount:a,filterType:l,type:c,selectedId:K,onFilterChange:ge,severity:h.severity,onReadFilterChange:me,currentReadFilter:S}),!b&&m?e.jsx(f,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(Y,{})}):e.jsx(br,{data:p,blockletMap:ne,onReadNotification:se,onReadBatch:C,inDialog:n,highlightId:P,highlight:!n&&U,type:c}),o&&!b?e.jsx(Hr,{loading:m,paging:r,onChange:B}):null,o&&b&&(m||G)?e.jsx(f,{ref:oe,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(Y,{})}):null,!n&&b?e.jsx(Yr,{}):null]})}const Zr=y.memo(lt),$=new Yt;function Ae(t){const{userDid:s=""}={},{session:o}=Kt(),n=T(()=>{if(s)return s;const r=window.location.href,x=_t(r);return x?.did?Array.isArray(x.did)?x.did[0]:x.did:o?.user?.did},[o?.user?.did,s]),l=T(()=>o.user,[o]),i=T(()=>l?n===l?.did:!1,[n,l?.did]),c=te(async()=>{if(await Vt(()=>o?.initialized),i)return o.user;if(n)return $.user.getUserPublicInfo({did:n})},{refreshDeps:[n,i,o?.initialized,l]}),p=T(()=>l.passports?.some(r=>r.role===Pe.ROLES.OWNER),[l]);return{currentDid:n,session:o,isMyself:i,user:l,viewUser:c.data,isOwner:p}}function ct({user:t,...s}){const{t:o}=
|
|
76
|
+
`;lt.propTypes={blocklets:u.array,context:u.object,pagination:u.bool,inDialog:u.bool,filterType:u.oneOf(["component","entity"]),toViewAll:u.func,type:u.oneOf(["server","service"])};function lt({blocklets:t=[],context:s,pagination:o=!0,inDialog:n=!1,filterType:l="component",toViewAll:i=()=>{},type:c="service"}){const{data:p,paging:r,refresh:x,loading:m,params:h,onReadNotification:C,componentDids:v,filterUnReadCount:a,initial:g}=s,k=d=>{x({...h,severity:d&&typeof d=="string"?[d]:d||[],paging:{...h.paging,page:1}})},[R]=Ut(),P=T(()=>R.get("id"),[R]),b=xe(d=>d.breakpoints.down("md")),[z,L]=y.useState(0),[U,j]=y.useState(!1),S=y.useMemo(()=>h.read===!1?"unread":"all",[h.read]),B=T(()=>Qe(d=>{if(m)return;const w=p.length,A=p.filter(F=>!Ue(F)).length;let W={...h,append:!0,paging:{...h.paging,...d,currentPage:(r.currentPage||0)+1}};S==="unread"&&A<w&&d.page>h.paging.page&&(W={...h,append:!0,paging:{...h.paging,...d,page:h.paging.page||1,currentPage:(r.currentPage||0)+1}}),x(W)},500),[p,h,S,r,m,x]);Ze(()=>{g&&typeof g=="function"&&g()}),y.useEffect(()=>{(!r.currentPage||r.currentPage===1)&&L(r.total)},[r.total,r.currentPage]),y.useEffect(()=>{setTimeout(()=>{const d=document.getElementById(P);d&&d.scrollIntoView({behavior:"smooth",block:"center"}),j(!0)},100),setTimeout(()=>{j(!1)},3e3)},[P]);const G=T(()=>p?.length>0&&p.length<z,[p,z]),Q=y.useCallback(d=>{const{blocklet:w={}}=window,A=[w?.did,...(w?.ancestors||[]).map(W=>W)];return v?.includes(d)||A.findIndex(W=>W===d)>-1},[v]),ne=y.useMemo(()=>{const d=new Map;return t.length&&t.forEach(w=>{const A=w?.did||w.meta?.did;A&&!d.has(A)&&(w.ancestors=[],d.set(A,w),w?.alsoKnownAs?.length>0&&w.alsoKnownAs.forEach(W=>{d.has(W)||d.set(W,w)})),w?.children?.length>0&&w.children.forEach(W=>{const F=W?.did||W.meta?.did;F&&!d.has(F)&&Q(F)&&(W.ancestors=[w],d.set(F,W))})}),d},[t,Q]),he=y.useCallback(()=>{m||B({page:r.page+1})},[r.page,m,B]),[oe]=_r({loading:m,hasNextPage:G,onLoadMore:he}),se=d=>{!d||Ue(d)||C(d.id).then(()=>{n&&i()})},ge=({severity:d,id:w})=>{if(m)return;let A={};l==="component"?A={entityId:[],componentDid:w}:l==="entity"&&(A={componentDid:[],entityId:w}),x({...h,severity:d,...A,paging:{...h.paging,page:1}})},me=d=>{if(m)return;let w={...h,paging:{...h.paging,page:1}};d==="unread"?(w.read=!1,w.paging.currentPage=1):w=qt(w,"read"),x(w)},K=T(()=>l==="component"?Array.isArray(h.componentDid)?h.componentDid:[]:l==="entity"?Array.isArray(h.entityId)?h.entityId:[]:[],[h,l]),be=T(()=>(Array.isArray(h.severity)?h.severity:[])[0]||"",[h.severity]);return e.jsxs(Qr,{inDialog:!!n,children:[n?e.jsx(st,{currentTab:be,type:"line",theme:"light",onSelectType:k}):e.jsx(at,{loading:m,blockletMap:ne,unReadCount:a,filterType:l,type:c,selectedId:K,onFilterChange:ge,severity:h.severity,onReadFilterChange:me,currentReadFilter:S}),!b&&m?e.jsx(f,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(Y,{})}):e.jsx(br,{data:p,blockletMap:ne,onReadNotification:se,onReadBatch:C,inDialog:n,highlightId:P,highlight:!n&&U,type:c}),o&&!b?e.jsx(Hr,{loading:m,paging:r,onChange:B}):null,o&&b&&(m||G)?e.jsx(f,{ref:oe,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(Y,{})}):null,!n&&b?e.jsx(Yr,{}):null]})}const Zr=y.memo(lt),$=new Yt;function Ae(t){const{userDid:s=""}={},{session:o}=Kt(),n=T(()=>{if(s)return s;const r=window.location.href,x=_t(r);return x?.did?Array.isArray(x.did)?x.did[0]:x.did:o?.user?.did},[o?.user?.did,s]),l=T(()=>o.user,[o]),i=T(()=>l?n===l?.did:!1,[n,l?.did]),c=te(async()=>{if(await Vt(()=>o?.initialized),i)return o.user;if(n)return $.user.getUserPublicInfo({did:n})},{refreshDeps:[n,i,o?.initialized,l]}),p=T(()=>l.passports?.some(r=>r.role===Pe.ROLES.OWNER),[l]);return{currentDid:n,session:o,isMyself:i,user:l,viewUser:c.data,isOwner:p}}function ct({user:t,...s}){const{t:o}=N(),n=Et(),l=T(()=>{const p=(t?.passports||[]).map(r=>({...r,revoked:r.status===ir.REVOKED}));return p.sort((r,x)=>r.revoked===x.revoked?0:r.revoked?1:-1),Ne(p.filter(r=>!r.display),"role").concat(Ne(p.filter(r=>r.display),"display.content"))},[t?.passports]),i=T(()=>l?.find(p=>p.name===t.role),[l,t?.role]),c=n.palette.primary.main;return l.length===0?e.jsx(f,{children:e.jsx(Xe,{children:o("userCenter.noPassport")})}):e.jsx(f,{...s,sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5,...s.sx},children:l.map(p=>e.jsx(wr,{passport:p,user:t,color:window.blocklet.passportColor,createPassportSvg:Qt,title:i&&i.role===p.role?o("userCenter.currentPassport"):"",sx:{flexDirection:"column",alignItems:"center",gap:1,".passport-item__display":{width:166,height:166,borderRadius:1,px:2,display:"flex",justifyContent:"center",backgroundColor:"grey.50",boxShadow:i&&i.role===p.role?`0px 2px 4px 0px ${c}, 0px 1px 2px -1px ${c}, 0px 0px 0px 1px ${c} !important`:"unset"},".passport-item__body":{marginLeft:"0 !important"}}},p.id))})}ct.propTypes={user:u.object.isRequired};function Jr({visible:t,onClose:s,nft:o}){return!t||!o?null:e.jsx(Xr,{children:e.jsx(Lt,{open:t,onClose:s,children:e.jsx(en,{onClick:s,children:e.jsx(rt,{data:nt(o),address:o.address,inset:!0})})})})}const Xr=ee.div`
|
|
77
77
|
position: relative;
|
|
78
78
|
width: 100%;
|
|
79
79
|
height: 100%;
|
|
@@ -118,7 +118,7 @@ import{j as e,y as St,bb as Se,M as ae,ak as f,Q as _,W as u,J as xe,c0 as kt,I
|
|
|
118
118
|
height: 75vmin;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
`,tn=t=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:le(t.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:le(t.palette.background.paper,1)}}}),rn={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},He="https://main.abtnetwork.io/explorer";function dt({user:t}){const{t:s}=D(),o=re(),[n,l]=y.useState({visible:!1,nft:null}),[i,c]=y.useState({anchorEl:null,props:null}),p=P=>{const b=ce(He,"assets",P);window.open(b,"_blank")},r=(P,b)=>{let z="";typeof b.data?.value=="string"?z=JSON.parse(b.data?.value)?.domain:z=b.data?.value?.domain,c({anchorEl:P,props:{title:z?`Hey, I just won an NFT at the ${z} event!`:"Hey, I just won an NFT!",url:ce(He,"assets",b.address)}})},x=P=>{l({visible:!0,nft:P})},m=H({page:1,size:20}),h=te(async(P=m)=>(await Ht.get(`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/ocap/listAssets`,{params:{ownerAddress:t.did,...P}})).data,{ready:t?.did&&m,defaultParams:[m],refreshDeps:[t?.did,m]}),{loading:C,data:v}=h,a=v?.page??{cursor:0,next:!1,total:0},g=(P,b)=>{m.page=b,h.run(m)},k=E(P=>[e.jsx(O,{size:"small",className:"mask-item",onClick:b=>{b.stopPropagation(),p(P.address)},children:e.jsx(N,{icon:"tabler:link",fontSize:18})},"link"),e.jsx(O,{size:"small",onClick:b=>{b.stopPropagation(),r(b.currentTarget,P)},className:"mask-item",children:e.jsx(N,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx(O,{size:"small",onClick:b=>{b.stopPropagation(),x(P)},className:"mask-item",children:e.jsx(N,{icon:"tabler:eye",fontSize:18})},"view")]),R=T(()=>{if(C){const P=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(b=>e.jsx(We,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},b));return e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(We,{width:"20%"}),e.jsx(f,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:P})]})}return e.jsxs(e.Fragment,{children:[e.jsx(I,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:s("userCenter.common.nft")}),v?.assets?.length===0&&!C&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(Xe,{children:s("userCenter.common.noNFT")})}),e.jsx(f,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:v?.assets?.map(P=>e.jsxs(f,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...o?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(rt,{data:nt(P),address:P.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),o?e.jsx(f,{className:"footer-mask",sx:rn,children:k(P)}):e.jsx(f,{className:"mask",sx:tn,children:e.jsx(ke,{direction:"row",spacing:1,children:k(P)})})]},P.address))}),a.next||m.page>1?e.jsx(Bt,{sx:{display:"flex",justifyContent:"center",mt:2},page:m.page,onChange:g,count:Math.ceil(a.total/m.size),size:"small"}):null,e.jsx(Jr,{visible:n.visible&&!!n.nft,nft:n.nft,onClose:()=>{l({visible:!1,nft:null})}}),e.jsx(ar,{anchorEl:i.anchorEl,onClose:()=>{c({anchorEl:null,props:null})},sharedProps:i.props||{title:"",url:""}})]})},[C,a,m.page,m.size,g,i,n]);return e.jsx(f,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:R})}dt.propTypes={user:u.object.isRequired};function nn(){const{t}=D(),{user:s,isMyself:o,viewUser:n}=Ae();return e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[o?e.jsxs(f,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:t("userCenter.passport")}),e.jsx(ct,{user:s})]}):null,e.jsx(dt,{user:o?s:n})]})}const on=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function ut({user:t,onSave:s}){const{t:o,changeLocale:n}=D(),l=H({locale:t.locale,loading:!1}),i=E(async c=>{try{const{value:p}=c.target;l.loading=!0,await $.user.saveProfile({locale:p}),await s("profile"),n(p),l.locale=p}catch(p){q.error(X(p))}finally{l.loading=!1}});return e.jsxs(f,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(f,{children:o("userCenter.commonSetting.locale")}),e.jsx(f,{children:e.jsx(Se,{value:l.locale,onChange:i,size:"small",IconComponent:c=>e.jsx(Je,{...c,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||on).map(c=>e.jsx(ae,{value:c.code,children:c.name},c.code))})})]})}ut.propTypes={user:u.shape({locale:u.string}).isRequired,onSave:u.func.isRequired};function Ce({onTest:t=V,onDelete:s=V,onSave:o=V,onCancel:n=V,type:l="slack",url:i="",edit:c=!1}){const{t:p}=D(),r=H({type:l||"slack",url:i||"",edit:c??!1,error:"",loading:!1}),x=E(()=>r.url?Zt(r.url)?(r.error="",!0):(r.error=p("common.invalid"),!1):(r.error=p("common.required"),!1)),m=E(()=>{r.edit=!1,r.url=i||"",r.type=l||"slack",r.error="",r.loading=!1,n()}),h=E(async a=>{r.loading=!0,await t(a),r.loading=!1}),C=E(a=>()=>{x()&&a({type:r.type,url:r.url})}),v=T(()=>r.error?e.jsx(I,{component:"span",color:"error",children:r.error}):r.edit?r.loading?e.jsx(Y,{size:16}):e.jsx(O,{size:"small",onClick:C(h),sx:{mr:-1},children:e.jsx(N,{icon:jr})}):null,[r.error,r.edit,r.loading]);return e.jsxs(f,{sx:{display:"flex",gap:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(Se,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!r.edit||r.loading,size:"small",value:r.type,onChange:a=>{r.type=a.target.value},children:[e.jsx(ae,{value:"api",children:p("userCenter.webhook.url")}),e.jsx(ae,{value:"slack",children:p("userCenter.webhook.slack")})]}),e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Ve,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!r.edit||r.loading,fullWidth:!0,size:"small",required:!0,value:r.url,onChange:a=>{r.url=a.target.value,x()},error:!!r.error,slotProps:{input:{endAdornment:e.jsx(Ye,{position:"end",children:v})}}}),e.jsx(f,{sx:{display:"flex",gap:.5},children:r.edit?e.jsxs(e.Fragment,{children:[e.jsx(O,{color:"success",onClick:C((...a)=>{o(...a),r.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:lr})}),e.jsx(O,{color:"error",onClick:m,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:cr})})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{onClick:()=>{r.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:Cr})}),e.jsx(O,{color:"error",onClick:()=>{s({type:r.type,url:r.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:Sr})})]})})]})]})}Ce.propTypes={onTest:u.func,onDelete:u.func,onSave:u.func,onCancel:u.func,type:u.oneOf(["api","slack"]),url:u.string,edit:u.bool};function ie({title:t=void 0,description:s=void 0,value:o,onChange:n,isMobile:l}){const i=E(c=>{c.stopPropagation()});return e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{checked:o,size:"small",onChange:n}),e.jsxs(I,{component:"div",onClick:i,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:l?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:l?"normal":"nowrap"},children:[t,s]})]})}ie.propTypes={title:u.string,description:u.node,value:u.bool.isRequired,onChange:u.func.isRequired,isMobile:u.bool.isRequired};function pt({user:t,isMobile:s}){const{t:o}=D(),n=H({showAdd:!1}),l=te(async()=>await $.user.getUserNotificationConfig(),{refreshDeps:[t],loadingDelay:300}),i=T(()=>({wallet:!0,email:!0,phone:!1,push:!0,...l?.data?.notifications||{}}),[l?.data?.notifications]),c=T(()=>l?.data?.webhooks||[],[l?.data?.webhooks]),p=E(async v=>{try{await $.user.saveUserNotificationConfig(v),q.success(o("userCenter.saveSuccess")),l.run()}catch(a){q.error(X(a))}}),r=E(async(v,a)=>{await p({notifications:{[v]:a}})}),x=async v=>{try{await $.user.testNotificationWebhook(v),q.success(o("userCenter.webhookTested"))}catch(a){q.error(X(a))}},m=E(async v=>{await p({webhooks:c.filter((a,g)=>g!==v)})}),h=E(async(v,a)=>{await p({webhooks:c.map((g,k)=>k===v?a:g)})}),C=E(async v=>{await p({webhooks:[...c,v]}),n.showAdd=!1});return l.error?e.jsx(Wt,{severity:"error",children:l.error.message}):l.loading||!l.data?e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(Y,{})}):e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsx(ie,{value:i.wallet,isMobile:s,title:o("userCenter.walletNotification"),onChange:v=>r("wallet",v.target.checked),description:Ne(t)&&e.jsx(dr,{did:Ne(t),showQrcode:!1,showAvatar:!s,copyable:!0,compact:!0,responsive:!0,startChars:s?2:6})}),e.jsx(ie,{value:i.email,isMobile:s,onChange:v=>r("email",v.target.checked),title:o("userCenter.emailNotification"),description:t?.email&&e.jsx(I,{component:"span",sx:{color:"text.secondary",fontSize:13},children:t?.email})}),e.jsx(ie,{isMobile:s,value:i.push,title:o("userCenter.pushNotification"),onChange:v=>r("push",v.target.checked)})]}),e.jsxs(ke,{spacing:1.5,useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[c.map((v,a)=>e.jsx(Ce,{onTest:x,onDelete:()=>m(a),onSave:(...g)=>h(a,...g),type:v.type,url:v.url,edit:!1},`${a}_${v.url}`)),n.showAdd&&e.jsx(Ce,{onTest:x,onCancel:()=>{n.showAdd=!1},onSave:(...v)=>C(...v),edit:!0},"add"),e.jsx(et,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1},startIcon:e.jsx(N,{icon:kr}),onClick:()=>{n.showAdd=!0},children:o("userCenter.addWebhook")})]})]})}pt.propTypes={user:u.object.isRequired,isMobile:u.bool.isRequired};function xt({item:t}){const s=Te(),{blocklet:o}=Jt(),{confirmApi:n,confirmHolder:l}=Re(),i=H({loading:!1}),{t:c}=D(),{session:p}=y.use(fe),{bindOAuth:r,unbindOAuth:x,setBaseUrl:m,baseUrl:h}=p.useOAuth(),{disconnectPasskey:C,setTargetAppPid:v}=p.usePasskey(),a=T(()=>ur[t?.provider]||"unknown",[t?.provider]),g=E(async()=>{if(t?.provider===M.PASSKEY){await new Promise((b,z)=>{n.open({title:c("userCenter.thirdPartyLogin.disconnectPasskey",{name:a}),content:c("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:a}),confirmButtonText:c("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:c("common.cancel"),onConfirm(L){C({session:p,connectedAccount:t}).then(b).catch(z),L()},onCancel:b})});return}try{i.loading=!0,await new Promise((b,z)=>{if(t?._bind)n.open({title:c("userCenter.thirdPartyLogin.confirmUnbind",{name:a}),content:c("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:a}),confirmButtonText:c("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:c("common.confirm"),onConfirm(L){x({session:p,connectedAccount:{...Gt(t,["did","pk"]),showProvider:t.provider,provider:t._rawProvider}}).then(b).catch(z),L()},onCancel:b});else if(t.provider===M.WALLET)p.bindWallet({onSuccess:b,onCancel:z});else{const L=h,U=window?.blocklet;let j="/";const S=pr(U),B=xr(U);S&&B?.appPid&&p?.user?.sourceAppPid&&(j=B.appUrl),m(j),v(o?.appPid),r({session:p,oauthItem:{...t,provider:t._rawProvider}}).then(b).catch(z).finally(()=>{m(L),v()})}})}catch(b){console.error(`Failed to ${t?._bind?"unbind":"bind"} oauth account`,b)}finally{i.loading=!1}}),k=E(b=>b.provider===M.WALLET&&b.did?c("userCenter.thirdPartyLogin.walletAccount"):b._mainProvider?c("userCenter.thirdPartyLogin.mainAccount"):b?._bind?c("userCenter.thirdPartyLogin.disconnect"):c("userCenter.thirdPartyLogin.connect")),R=E(b=>b.provider===M.WALLET&&b.did?c("userCenter.thirdPartyLogin.walletAccountCantRemove"):b.provider===M.PASSKEY?c("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):b._mainProvider?c("userCenter.thirdPartyLogin.mainProviderCantRemove"):""),P=E(b=>b.provider===M.WALLET&&b.did||b.provider===M.PASSKEY&&(s.arcSphere||s.wallet)?!0:!!t._mainProvider,[s.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(f,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(Xt,{provider:t?.provider,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16,filter:({palette:b})=>t?.provider===M.GITHUB&&b.mode==="dark"?"invert(1)":"none"}}),e.jsx(f,{sx:{flex:1,display:{xs:t.userInfo?.email||t.did?"none":"block",sm:"block"}},children:a}),t.userInfo?.email||t.did?e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(f,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:t.userInfo?.email||t.did}),t.userInfo?.name?e.jsx(J,{title:e.jsx(e.Fragment,{children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(tt,{size:36,variant:"circle",shape:"circle",src:t.userInfo?.picture,did:t.did}),e.jsxs(f,{children:[e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.name}),e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.email})]})]})}),children:e.jsx(f,{component:N,icon:er,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(J,{title:R(t),placement:"auto",children:e.jsx(f,{children:e.jsx(et,{variant:"outlined",size:"small",sx:b=>{const z=b.palette.error.main,L=b.palette.primary.main;return{color:t?._bind?z:L,borderColor:t?._bind?z:L,backgroundColor:"background.default","&:hover":{borderColor:t?._bind?z:L,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:i.loading?null:e.jsx(N,{icon:Pr}),onClick:g,disabled:P(t),loading:i.loading,children:k(t)})})}),l]})}xt.propTypes={item:u.shape({provider:u.string,did:u.string,pk:u.string,userInfo:u.object,id:u.string,_bind:u.bool,_rawProvider:u.string,_mainProvider:u.bool}).isRequired};function ft({user:t}){const{session:s}=y.use(fe),[o,n]=y.useState({}),{getOAuthConfigs:l}=s.useOAuth(),i=Te();sr(async()=>{const r=await l({sourceAppPid:t?.sourceAppPid});n(r)},[t?.sourceAppPid]);const c=T(()=>{const r=Object.keys(o).map(x=>({...o[x],provider:x})).filter(x=>x.enabled);return[{provider:M.WALLET,order:-1},...r,{provider:M.PASSKEY,order:1/0}]},[o]),p=T(()=>{const r=fr(t);let x=!1,m="",h=hr(t);const C=r.find(a=>a.provider===M.AUTH0);return C&&(C.id.startsWith("google-oauth2|")&&(r.some(a=>a.provider==="google")||(x=!0,m=M.GOOGLE,h===M.AUTH0&&(h=M.GOOGLE))),C.id.startsWith("appleid|")&&(r.some(a=>a.provider===M.APPLE)||(x=!0,m=M.APPLE,h===M.AUTH0&&(h=M.APPLE))),C.id.startsWith("github|")&&(r.some(a=>a.provider===M.GITHUB)||(x=!0,m=M.GITHUB,h===M.AUTH0&&(h=M.GITHUB)))),c.map(a=>{if(a.provider===M.AUTH0&&x)return null;const g=x&&a.provider===m?r.find(k=>k.provider===M.AUTH0):r.find(k=>k.provider===a.provider);return g?{...a,provider:a.provider,did:g.did,pk:g.pk,userInfo:g.userInfo,_bind:!0,_rawProvider:g.provider,_mainProvider:a.provider===h}:{...a,provider:a.provider,_rawProvider:a.provider,_mainProvider:a.provider===h}}).filter(a=>!(!a||a.provider===M.PASSKEY&&!a.did)).sort((a,g)=>a._mainProvider?-1:a?.order!==void 0&&g?.order!==void 0?a.order-g.order:a?.order!==void 0?-1:1)},[t?.connectedAccounts,c]);return e.jsxs(f,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[p.map(r=>e.jsx(xt,{item:r},r?.provider)),i.wallet||i.arcSphere?null:e.jsx(tr,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:V,onError:V,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}ft.propTypes={user:u.object.isRequired};function ht({configList:t,onSave:s}){const[o,n]=y.useState(t),{t:l}=D(),i=E(async(c,p)=>{try{const r=await $.user.saveUserPrivacyConfig({[c]:!p});n(o.map(x=>({...x,value:r?.[x.key]??x.value}))),q.success(l("userCenter.saveSuccess")),s("privacy")}catch(r){q.error(X(r))}});return y.useEffect(()=>{n(t)},[t]),e.jsx(f,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:o.map(c=>c.isPrivate?null:e.jsx(ot,{checked:!c.value,labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:l("userCenter.toPublic",{name:c.name})})},size:"small",onChange:p=>i(c.key,p.target.checked)},c.key))})}ht.propTypes={configList:u.arrayOf(u.shape({key:u.string.isRequired,name:u.string.isRequired,value:u.bool.isRequired,isPrivate:u.bool})).isRequired,onSave:u.func.isRequired};function gt({user:t,sessionUser:s}){const o=T(()=>(t?.passports||[])?.find(n=>n.name===s.role),[t?.passports,s?.role]);return e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(tt,{size:40,variant:"circle",shape:"circle",src:s.avatar,did:s.did,sx:{flexShrink:0}}),e.jsxs(f,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(J,{title:s.fullName,children:e.jsx(I,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:s.fullName})}),e.jsx(je,{label:o?.title||o?.name||"Guest",size:"small",variant:"outlined",sx:{flexShrink:0,fontWeight:"bold",fontSize:"12px",color:"text.primary",borderColor:"grey.300",backgroundColor:"transparent",textTransform:"capitalize",pr:.5,pl:0,height:"auto"}})]}),e.jsx(J,{title:s.email,children:e.jsx(I,{variant:"body2",color:"grey",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.email})})]})]})}gt.propTypes={user:u.object.isRequired,sessionUser:u.shape({role:u.string,avatar:u.string,did:u.string,fullName:u.string,email:u.string}).isRequired};const sn=()=>Promise.resolve(""),Ge=t=>new ve(t,{browser:[[/(ArcWallet)\/([\w\.]+)/i],[ve.BROWSER.NAME,ve.BROWSER.VERSION]]}).getResult(),Ke={display:"flex",justifyContent:"flex-end",textAlign:"right"},an=new rr({concurrency:1}),Me=y.memo(({userSession:t,isMobile:s=!1})=>{const o=H({loading:!0,ipRegion:""}),{t:n}=D();return y.useEffect(()=>{an.add(async()=>{try{o.ipRegion=await sn(t.lastLoginIp)}finally{o.loading=!1}})},[o,t.lastLoginIp]),e.jsx(f,{...s&&{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,flexWrap:"wrap"},children:o.ipRegion?e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"body2",children:o.ipRegion}),e.jsx(I,{variant:"body2",color:"grey",children:t.lastLoginIp||n("userCenter.unknown")})]}):e.jsxs(e.Fragment,{children:[e.jsx(I,{children:t.lastLoginIp||n("userCenter.unknown")}),o.loading?e.jsx(I,{variant:"body2",color:"grey",sx:{textAlign:"center"},children:e.jsx(Y,{size:12,color:"inherit"})}):null]})})});Me.propTypes={userSession:u.object.isRequired,isMobile:u.bool};Me.defaultProps={isMobile:!1};function mt({user:t,showAction:s=!0,showUser:o=!0,getUserSessions:n,showOffline:l=!1}){const i=H({status:"online",page:1,pageSize:10}),c=H({online:0,expired:0,offline:0}),p=gr(),{t:r}=D(),x=re({key:"md"}),m=xe(j=>j.breakpoints.down("lg")),{confirmApi:h,confirmHolder:C}=Re(),v=E(async()=>{const j=await n({page:i.page,pageSize:i.pageSize,status:i.status}),S=j?.paging?.total||0;return c[i.status]=S,{total:S,list:j?.list||[]}});Ze(async()=>{const j=await n({page:1,pageSize:1,status:"expired"});c.expired=j?.paging?.total||0;const S=await n({page:1,pageSize:1,status:"offline"});c.offline=S?.paging?.total||0});const a=te(v,{refreshDeps:[i.status,i.page,i.pageSize]}),g=T(()=>a.data?.list||[],[a.data?.list]),k=T(()=>{const{status:j}=i;return j==="online"?c[j]<=1:c[j]===0},[g,p]),R=T(()=>de({},x?Ke:{}),[x]),P=E(({visitorId:j})=>{h.open({title:r("userCenter.logoutThisSession"),content:r("userCenter.logoutThisSessionConfirm"),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await $.user.logout({visitorId:j,includeFederated:!0});const{page:S=0}=i,{list:B=[]}=a.data||{},G=B.length||0;S>1&&G===1&&(i.page=Math.max(S-1,1)),a.refresh(),h.close()}})}),b=E(()=>{h.open({title:r("userCenter.logoutAllSession",{type:r(i.status)}),content:r("userCenter.logoutAllSessionConfirm",{type:r(i.status)}),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await $.user.logout({status:i.status,visitorId:p,includeFederated:!0}),i.page=1,a.refresh(),h.close()}})}),z=[];s&&z.push(e.jsx(J,{title:r("userCenter.logoutAllTips",{type:r(i.status)}),children:e.jsx(_,{sx:{ml:.5},size:"small",variant:"contained",color:"error",onClick:b,disabled:k,children:r("userCenter.logoutAll",{type:r(i.status)})})},"logoutAll"));const L=T(()=>({search:!1,sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!1,searchDebounceTime:600,page:i.page-1,rowsPerPage:i.pageSize,count:a.data?.total||0}),[a.data?.total,i.page,i.pageSize]),U=[{label:r("userCenter.platform"),name:"platform",options:{customBodyRenderLite:j=>{const S=g[j],B=Ge(S?.ua);return e.jsx(f,{sx:R,children:[B.os?.name,B.os?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.deviceType"),name:"deviceType",options:{customBodyRenderLite:j=>{const S=g[j],B=Ge(S?.ua);return e.jsx(f,{sx:R,children:[B.browser?.name,B.browser?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.walletOS"),name:"walletOS",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:S.extra?.walletOS||r("userCenter.unknown")})}}},o&&{label:r("userCenter.user"),name:"user",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:de({minWidth:150,maxWidth:250},x?Ke:{}),children:e.jsx(gt,{sessionUser:S.user,user:t})})}}},{label:r("userCenter.createdAt"),name:"createdAt",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:S.createdAt?e.jsx(Oe,{value:S.createdAt,relativeRange:3*86400*1e3}):r("userCenter.unknown")})}}},!l&&{label:r("userCenter.updatedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:S.status==="expired"?r("userCenter.expired"):e.jsx(Oe,{value:S.updatedAt,relativeRange:3*86400*1e3})})}}},{label:r("userCenter.lastLoginIp"),name:"lastLoginIp",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(Me,{userSession:S,isMobile:x})}}},s&&{label:r("userCenter.actions"),name:"actions",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:e.jsx(_,{sx:{whiteSpace:"nowrap",fontSize:"12px !important",lineHeight:"1.25",px:1},disabled:p===S.visitorId,variant:"outlined",size:"small",color:"error",onClick:()=>P({visitorId:S.visitorId}),children:S.status==="expired"?r("userCenter.remove"):p===S.visitorId?r("userCenter.currentSession"):r("userCenter.logout")})})}}}].filter(Boolean);return e.jsxs(f,{className:"pc-user-sessions",sx:{maxWidth:x?"unset":m?"calc(100vw - 300px)":"100%",...x&&{".pc-user-sessions-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:j=>`${j.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...x&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:[C,e.jsx(mr,{count:a.data?.total||0,data:g,columns:U,customButtons:z,options:L,loading:a.loading,className:"pc-user-sessions-table",title:e.jsxs(Dt,{row:!0,sx:{lineHeight:1,ml:1},onChange:j=>{i.status=j.target.value},children:[e.jsx(Z,{value:"online",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="online"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.online"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",c.online,")"]})]})}),e.jsx(Z,{value:"expired",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="expired"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.expired"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",c.expired,")"]})]})}),l?e.jsx(Z,{value:"offline",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="offline"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.offline"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",c.offline,")"]})]})}):null]}),onChange:j=>{i.page=j.page+1,i.pageSize=j.rowsPerPage}})]})}mt.propTypes={user:u.object.isRequired,showAction:u.bool,showUser:u.bool,showOffline:u.bool,getUserSessions:u.func.isRequired};function bt({onDestroySelf:t=void 0}){const{confirmHolder:s}=Re(),{t:o}=D(),{session:n}=y.use(fe),l=E(async()=>{if(!t||typeof t!="function")return;const i=n.withSecondaryAuth(t,{extraParams:{removeUserDid:n?.user?.did,input:{user:{did:n?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await i(),n.logout()}catch(c){q.error(c?.message||o("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(f,{children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(f,{children:[e.jsx(I,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:o("userCenter.dangerZone.deleteAccount")}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary"},children:o("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(_,{variant:"contained",color:"error",size:"small",onClick:l,children:o("userCenter.dangerZone.delete")})]})}),s]})}bt.propTypes={onDestroySelf:u.func};function ln(){const t=re({key:"md"}),s=xe(l=>l.breakpoints.down("lg")),o={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},n=T(()=>de({},t?o:{}),[t]);return e.jsx(f,{id:"user-center-access-key-setting",sx:{maxWidth:t?"unset":s?"calc(100vw - 300px)":"100%",...t&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:l=>`${l.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...t&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(Tr,{isSelf:!0,columnSx:n})})}function yt({onDestroySelf:t=void 0,userCenterTabs:s=[]}){const{t:o}=D(),{user:n,session:l,isMyself:i,isOwner:c}=Ae(),r=Te().arcSphere,x=re({key:"md"}),m=te(async()=>n&&i?await $.user.getUserPrivacyConfig({did:n.did}):null,{refreshDeps:[n,i],loadingDelay:300}),h=T(()=>s.map(a=>({key:a.value,name:a.label,value:a.protected,isPrivate:a.isPrivate})),[s]),C=E(async a=>a==="privacy"?(await m.runAsync(),m.data):(a==="profile"&&await l.refresh(),null));y.useEffect(()=>{const a=window.location.hash.slice(1);a&&document.getElementById(a)?.scrollIntoView({behavior:"smooth"})},[]);const v=T(()=>[r?void 0:{label:o("userCenter.commonSetting.title"),value:"common",content:e.jsx(ut,{user:n,onSave:C})},{label:o("userCenter.notificationManagement"),value:"notification",content:e.jsx(pt,{user:n,isMobile:x})},{label:o("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(ft,{user:n})},{label:o("common.accessKeys"),value:"accessKeys",content:e.jsx(ln,{isSelf:!0})},{label:o("common.mcpServers"),value:"mcpServers",content:e.jsx(Ir,{})},{label:o("userCenter.privacyManagement"),value:"privacy",content:e.jsx(ht,{configList:h,onSave:C})},{label:o("userCenter.sessionManagement"),value:"session",content:e.jsx(mt,{user:n,showUser:!1,getUserSessions:a=>$.userSession.getMyLoginSessions({},a)})},!c&&t&&typeof t=="function"?{label:o("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(bt,{onDestroySelf:t}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[n,h,x,c,t]);return i?e.jsx(f,{sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},maxWidth:"100%"},children:v.map(a=>a?e.jsxs(f,{id:a.value,sx:de({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},a.sx),children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600},children:a.label}),e.jsx(f,{sx:{mt:2.5},children:a.content})]},a.value):null)}):null}yt.propTypes={onDestroySelf:u.func,userCenterTabs:u.array};const vt=y.createContext({}),{Provider:cn,Consumer:ao}=vt;function wt({children:t}){const[s]=y.useState(!1),{session:o}=y.use(fe),{user:n}=o,[l,i]=y.useState(),c=y.useMemo(()=>n?.didSpace?.endpoint,[n?.didSpace]);y.useEffect(()=>{i(n?.didSpace)},[n?.didSpace]);const p=async()=>{i(void 0)},r=h=>{},x=async h=>{i(h),await r(h.endpoint)},m=!!(c&&l);return e.jsx(cn,{value:{loading:s,spaceGateway:l,session:o,deleteSpaceGateway:p,updateSpaceGateway:x,storageEndpoint:c,settingStorageEndpoint:r,hasStorageEndpoint:m},children:t})}function ze(){return y.use(vt)}wt.propTypes={children:u.node.isRequired};function dn(t){const s=t.replace(/\/api\/space\/.+/,""),n=t.replace(/\/$/,"").split("/").at(-4);return ce(s,"space",n)}function jt({session:t,spaceGateway:s,spaceStatus:o,refresh:n}){return e.jsxs(ke,{direction:"row",spacing:1,children:[o===Mr.DISCONNECTED&&e.jsx(ue,{reconnect:!0,variant:"outlined",session:t,spaceDid:t.user?.didSpace?.did,spaceGatewayUrl:t.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await n()},onError:l=>{console.error(l),q.error(X(l))}}),e.jsx(O,{size:"small",LinkComponent:Nt,href:dn(s.endpoint),target:"_blank",children:e.jsx(Ot,{})})]})}jt.propTypes={session:u.object.isRequired,spaceGateway:u.object.isRequired,spaceStatus:u.string.isRequired,refresh:u.func.isRequired};function Ct({spaceGateway:t=void 0}){const{t:s}=D(),{updateSpaceGateway:o,session:n}=ze(),l=re(),i=({spaceGateway:c})=>o(c);return e.jsxs(f,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(f,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:s("userCenter.storage.spaces.connected.title")}),!l&&e.jsx(ue,{connectScope:"user",connectText:s("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})]}),e.jsx(f,{children:t&&e.jsx(zr,{endpoint:t.endpoint,deps:[t],selected:!0,footer:!0,action:c=>e.jsx(jt,{session:n,...c})},t.endpoint)}),l&&e.jsx(f,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(ue,{connectScope:"user",connectText:s("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})})]})}Ct.propTypes={spaceGateway:u.object};function un(){const{t}=D(),{updateSpaceGateway:s,session:o}=ze(),n=({spaceGateway:l})=>s(l);return e.jsxs(f,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:t("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Er,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(f,{children:e.jsx(ue,{session:o,onSuccess:n})})]})}function pn(){const{spaceGateway:t,hasStorageEndpoint:s,loading:o}=ze(),{isMyself:n}=Ae();return n?o?e.jsx(Ar,{relative:"parent",children:e.jsx(Y,{})}):e.jsx(fn,{children:e.jsx(f,{sx:{maxWidth:"720px"},children:s?e.jsx(Ct,{spaceGateway:t}):e.jsx(un,{})})}):null}function xn(){return e.jsx(wt,{children:e.jsx(pn,{})})}const fn=ee(f)`
|
|
121
|
+
`,tn=t=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:le(t.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:le(t.palette.background.paper,1)}}}),rn={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},He="https://main.abtnetwork.io/explorer";function dt({user:t}){const{t:s}=N(),o=re(),[n,l]=y.useState({visible:!1,nft:null}),[i,c]=y.useState({anchorEl:null,props:null}),p=P=>{const b=ce(He,"assets",P);window.open(b,"_blank")},r=(P,b)=>{let z="";typeof b.data?.value=="string"?z=JSON.parse(b.data?.value)?.domain:z=b.data?.value?.domain,c({anchorEl:P,props:{title:z?`Hey, I just won an NFT at the ${z} event!`:"Hey, I just won an NFT!",url:ce(He,"assets",b.address)}})},x=P=>{l({visible:!0,nft:P})},m=H({page:1,size:20}),h=te(async(P=m)=>(await Ht.get(`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/ocap/listAssets`,{params:{ownerAddress:t.did,...P}})).data,{ready:t?.did&&m,defaultParams:[m],refreshDeps:[t?.did,m]}),{loading:C,data:v}=h,a=v?.page??{cursor:0,next:!1,total:0},g=(P,b)=>{m.page=b,h.run(m)},k=E(P=>[e.jsx(O,{size:"small",className:"mask-item",onClick:b=>{b.stopPropagation(),p(P.address)},children:e.jsx(D,{icon:"tabler:link",fontSize:18})},"link"),e.jsx(O,{size:"small",onClick:b=>{b.stopPropagation(),r(b.currentTarget,P)},className:"mask-item",children:e.jsx(D,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx(O,{size:"small",onClick:b=>{b.stopPropagation(),x(P)},className:"mask-item",children:e.jsx(D,{icon:"tabler:eye",fontSize:18})},"view")]),R=T(()=>{if(C){const P=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(b=>e.jsx(We,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},b));return e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(We,{width:"20%"}),e.jsx(f,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:P})]})}return e.jsxs(e.Fragment,{children:[e.jsx(I,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:s("userCenter.common.nft")}),v?.assets?.length===0&&!C&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(Xe,{children:s("userCenter.common.noNFT")})}),e.jsx(f,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:v?.assets?.map(P=>e.jsxs(f,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...o?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(rt,{data:nt(P),address:P.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),o?e.jsx(f,{className:"footer-mask",sx:rn,children:k(P)}):e.jsx(f,{className:"mask",sx:tn,children:e.jsx(ke,{direction:"row",spacing:1,children:k(P)})})]},P.address))}),a.next||m.page>1?e.jsx(Bt,{sx:{display:"flex",justifyContent:"center",mt:2},page:m.page,onChange:g,count:Math.ceil(a.total/m.size),size:"small"}):null,e.jsx(Jr,{visible:n.visible&&!!n.nft,nft:n.nft,onClose:()=>{l({visible:!1,nft:null})}}),e.jsx(ar,{anchorEl:i.anchorEl,onClose:()=>{c({anchorEl:null,props:null})},sharedProps:i.props||{title:"",url:""}})]})},[C,a,m.page,m.size,g,i,n]);return e.jsx(f,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:R})}dt.propTypes={user:u.object.isRequired};function nn(){const{t}=N(),{user:s,isMyself:o,viewUser:n}=Ae();return e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[o?e.jsxs(f,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:t("userCenter.passport")}),e.jsx(ct,{user:s})]}):null,e.jsx(dt,{user:o?s:n})]})}const on=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function ut({user:t,onSave:s}){const{t:o,changeLocale:n}=N(),l=H({locale:t.locale,loading:!1}),i=E(async c=>{try{const{value:p}=c.target;l.loading=!0,await $.user.saveProfile({locale:p}),await s("profile"),n(p),l.locale=p}catch(p){q.error(X(p))}finally{l.loading=!1}});return e.jsxs(f,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(f,{children:o("userCenter.commonSetting.locale")}),e.jsx(f,{children:e.jsx(Se,{value:l.locale,onChange:i,size:"small",IconComponent:c=>e.jsx(Je,{...c,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||on).map(c=>e.jsx(ae,{value:c.code,children:c.name},c.code))})})]})}ut.propTypes={user:u.shape({locale:u.string}).isRequired,onSave:u.func.isRequired};function Ce({onTest:t=V,onDelete:s=V,onSave:o=V,onCancel:n=V,type:l="slack",url:i="",edit:c=!1}){const{t:p}=N(),r=H({type:l||"slack",url:i||"",edit:c??!1,error:"",loading:!1}),x=E(()=>r.url?Zt(r.url)?(r.error="",!0):(r.error=p("common.invalid"),!1):(r.error=p("common.required"),!1)),m=E(()=>{r.edit=!1,r.url=i||"",r.type=l||"slack",r.error="",r.loading=!1,n()}),h=E(async a=>{r.loading=!0,await t(a),r.loading=!1}),C=E(a=>()=>{x()&&a({type:r.type,url:r.url})}),v=T(()=>r.error?e.jsx(I,{component:"span",color:"error",children:r.error}):r.edit?r.loading?e.jsx(Y,{size:16}):e.jsx(O,{size:"small",onClick:C(h),sx:{mr:-1},children:e.jsx(D,{icon:jr})}):null,[r.error,r.edit,r.loading]);return e.jsxs(f,{sx:{display:"flex",gap:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(Se,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!r.edit||r.loading,size:"small",value:r.type,onChange:a=>{r.type=a.target.value},children:[e.jsx(ae,{value:"api",children:p("userCenter.webhook.url")}),e.jsx(ae,{value:"slack",children:p("userCenter.webhook.slack")})]}),e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Ve,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!r.edit||r.loading,fullWidth:!0,size:"small",required:!0,value:r.url,onChange:a=>{r.url=a.target.value,x()},error:!!r.error,slotProps:{input:{endAdornment:e.jsx(Ye,{position:"end",children:v})}}}),e.jsx(f,{sx:{display:"flex",gap:.5},children:r.edit?e.jsxs(e.Fragment,{children:[e.jsx(O,{color:"success",onClick:C((...a)=>{o(...a),r.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:lr})}),e.jsx(O,{color:"error",onClick:m,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:cr})})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{onClick:()=>{r.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:Cr})}),e.jsx(O,{color:"error",onClick:()=>{s({type:r.type,url:r.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:Sr})})]})})]})]})}Ce.propTypes={onTest:u.func,onDelete:u.func,onSave:u.func,onCancel:u.func,type:u.oneOf(["api","slack"]),url:u.string,edit:u.bool};function ie({title:t=void 0,description:s=void 0,value:o,onChange:n,isMobile:l}){const i=E(c=>{c.stopPropagation()});return e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{checked:o,size:"small",onChange:n}),e.jsxs(I,{component:"div",onClick:i,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:l?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:l?"normal":"nowrap"},children:[t,s]})]})}ie.propTypes={title:u.string,description:u.node,value:u.bool.isRequired,onChange:u.func.isRequired,isMobile:u.bool.isRequired};function pt({user:t,isMobile:s}){const{t:o}=N(),n=H({showAdd:!1}),l=te(async()=>await $.user.getUserNotificationConfig(),{refreshDeps:[t],loadingDelay:300}),i=T(()=>({wallet:!0,email:!0,phone:!1,push:!0,...l?.data?.notifications||{}}),[l?.data?.notifications]),c=T(()=>l?.data?.webhooks||[],[l?.data?.webhooks]),p=E(async v=>{try{await $.user.saveUserNotificationConfig(v),q.success(o("userCenter.saveSuccess")),l.run()}catch(a){q.error(X(a))}}),r=E(async(v,a)=>{await p({notifications:{[v]:a}})}),x=async v=>{try{await $.user.testNotificationWebhook(v),q.success(o("userCenter.webhookTested"))}catch(a){q.error(X(a))}},m=E(async v=>{await p({webhooks:c.filter((a,g)=>g!==v)})}),h=E(async(v,a)=>{await p({webhooks:c.map((g,k)=>k===v?a:g)})}),C=E(async v=>{await p({webhooks:[...c,v]}),n.showAdd=!1});return l.error?e.jsx(Wt,{severity:"error",children:l.error.message}):l.loading||!l.data?e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(Y,{})}):e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsx(ie,{value:i.wallet,isMobile:s,title:o("userCenter.walletNotification"),onChange:v=>r("wallet",v.target.checked),description:De(t)&&e.jsx(dr,{did:De(t),showQrcode:!1,showAvatar:!s,copyable:!0,compact:!0,responsive:!0,startChars:s?2:6})}),e.jsx(ie,{value:i.email,isMobile:s,onChange:v=>r("email",v.target.checked),title:o("userCenter.emailNotification"),description:t?.email&&e.jsx(I,{component:"span",sx:{color:"text.secondary",fontSize:13},children:t?.email})}),e.jsx(ie,{isMobile:s,value:i.push,title:o("userCenter.pushNotification"),onChange:v=>r("push",v.target.checked)})]}),e.jsxs(ke,{spacing:1.5,useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[c.map((v,a)=>e.jsx(Ce,{onTest:x,onDelete:()=>m(a),onSave:(...g)=>h(a,...g),type:v.type,url:v.url,edit:!1},`${a}_${v.url}`)),n.showAdd&&e.jsx(Ce,{onTest:x,onCancel:()=>{n.showAdd=!1},onSave:(...v)=>C(...v),edit:!0},"add"),e.jsx(et,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1},startIcon:e.jsx(D,{icon:kr}),onClick:()=>{n.showAdd=!0},children:o("userCenter.addWebhook")})]})]})}pt.propTypes={user:u.object.isRequired,isMobile:u.bool.isRequired};function xt({item:t}){const s=Te(),{blocklet:o}=Jt(),{confirmApi:n,confirmHolder:l}=Re(),i=H({loading:!1}),{t:c}=N(),{session:p}=y.use(fe),{bindOAuth:r,unbindOAuth:x,setBaseUrl:m,baseUrl:h}=p.useOAuth(),{disconnectPasskey:C,setTargetAppPid:v}=p.usePasskey(),a=T(()=>ur[t?.provider]||"unknown",[t?.provider]),g=E(async()=>{if(t?.provider===M.PASSKEY){await new Promise((b,z)=>{n.open({title:c("userCenter.thirdPartyLogin.disconnectPasskey",{name:a}),content:c("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:a}),confirmButtonText:c("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:c("common.cancel"),onConfirm(L){C({session:p,connectedAccount:t}).then(b).catch(z),L()},onCancel:b})});return}try{i.loading=!0,await new Promise((b,z)=>{if(t?._bind)n.open({title:c("userCenter.thirdPartyLogin.confirmUnbind",{name:a}),content:c("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:a}),confirmButtonText:c("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:c("common.confirm"),onConfirm(L){x({session:p,connectedAccount:{...Gt(t,["did","pk"]),showProvider:t.provider,provider:t._rawProvider}}).then(b).catch(z),L()},onCancel:b});else if(t.provider===M.WALLET)p.bindWallet({onSuccess:b,onCancel:z});else{const L=h,U=window?.blocklet;let j="/";const S=pr(U),B=xr(U);S&&B?.appPid&&p?.user?.sourceAppPid&&(j=B.appUrl),m(j),v(o?.appPid),r({session:p,oauthItem:{...t,provider:t._rawProvider}}).then(b).catch(z).finally(()=>{m(L),v()})}})}catch(b){console.error(`Failed to ${t?._bind?"unbind":"bind"} oauth account`,b)}finally{i.loading=!1}}),k=E(b=>b.provider===M.WALLET&&b.did?c("userCenter.thirdPartyLogin.walletAccount"):b._mainProvider?c("userCenter.thirdPartyLogin.mainAccount"):b?._bind?c("userCenter.thirdPartyLogin.disconnect"):c("userCenter.thirdPartyLogin.connect")),R=E(b=>b.provider===M.WALLET&&b.did?c("userCenter.thirdPartyLogin.walletAccountCantRemove"):b.provider===M.PASSKEY?c("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):b._mainProvider?c("userCenter.thirdPartyLogin.mainProviderCantRemove"):""),P=E(b=>b.provider===M.WALLET&&b.did||b.provider===M.PASSKEY&&(s.arcSphere||s.wallet)?!0:!!t._mainProvider,[s.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(f,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(Xt,{provider:t?.provider,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16,filter:({palette:b})=>t?.provider===M.GITHUB&&b.mode==="dark"?"invert(1)":"none"}}),e.jsx(f,{sx:{flex:1,display:{xs:t.userInfo?.email||t.did?"none":"block",sm:"block"}},children:a}),t.userInfo?.email||t.did?e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(f,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:t.userInfo?.email||t.did}),t.userInfo?.name?e.jsx(J,{title:e.jsx(e.Fragment,{children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(tt,{size:36,variant:"circle",shape:"circle",src:t.userInfo?.picture,did:t.did}),e.jsxs(f,{children:[e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.name}),e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.email})]})]})}),children:e.jsx(f,{component:D,icon:er,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(J,{title:R(t),placement:"auto",children:e.jsx(f,{children:e.jsx(et,{variant:"outlined",size:"small",sx:b=>{const z=b.palette.error.main,L=b.palette.primary.main;return{color:t?._bind?z:L,borderColor:t?._bind?z:L,backgroundColor:"background.default","&:hover":{borderColor:t?._bind?z:L,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:i.loading?null:e.jsx(D,{icon:Pr}),onClick:g,disabled:P(t),loading:i.loading,children:k(t)})})}),l]})}xt.propTypes={item:u.shape({provider:u.string,did:u.string,pk:u.string,userInfo:u.object,id:u.string,_bind:u.bool,_rawProvider:u.string,_mainProvider:u.bool}).isRequired};function ft({user:t}){const{session:s}=y.use(fe),[o,n]=y.useState({}),{getOAuthConfigs:l}=s.useOAuth(),i=Te();sr(async()=>{const r=await l({sourceAppPid:t?.sourceAppPid});n(r)},[t?.sourceAppPid]);const c=T(()=>{const r=Object.keys(o).map(x=>({...o[x],provider:x})).filter(x=>x.enabled);return[{provider:M.WALLET,order:-1},...r,{provider:M.PASSKEY,order:1/0}]},[o]),p=T(()=>{const r=fr(t);let x=!1,m="",h=hr(t);const C=r.find(a=>a.provider===M.AUTH0);return C&&(C.id.startsWith("google-oauth2|")&&(r.some(a=>a.provider==="google")||(x=!0,m=M.GOOGLE,h===M.AUTH0&&(h=M.GOOGLE))),C.id.startsWith("appleid|")&&(r.some(a=>a.provider===M.APPLE)||(x=!0,m=M.APPLE,h===M.AUTH0&&(h=M.APPLE))),C.id.startsWith("github|")&&(r.some(a=>a.provider===M.GITHUB)||(x=!0,m=M.GITHUB,h===M.AUTH0&&(h=M.GITHUB)))),c.map(a=>{if(a.provider===M.AUTH0&&x)return null;const g=x&&a.provider===m?r.find(k=>k.provider===M.AUTH0):r.find(k=>k.provider===a.provider);return g?{...a,provider:a.provider,did:g.did,pk:g.pk,userInfo:g.userInfo,_bind:!0,_rawProvider:g.provider,_mainProvider:a.provider===h}:{...a,provider:a.provider,_rawProvider:a.provider,_mainProvider:a.provider===h}}).filter(a=>!(!a||a.provider===M.PASSKEY&&!a.did)).sort((a,g)=>a._mainProvider?-1:a?.order!==void 0&&g?.order!==void 0?a.order-g.order:a?.order!==void 0?-1:1)},[t?.connectedAccounts,c]);return e.jsxs(f,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[p.map(r=>e.jsx(xt,{item:r},r?.provider)),i.wallet||i.arcSphere?null:e.jsx(tr,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:V,onError:V,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}ft.propTypes={user:u.object.isRequired};function ht({configList:t,onSave:s}){const[o,n]=y.useState(t),{t:l}=N(),i=E(async(c,p)=>{try{const r=await $.user.saveUserPrivacyConfig({[c]:!p});n(o.map(x=>({...x,value:r?.[x.key]??x.value}))),q.success(l("userCenter.saveSuccess")),s("privacy")}catch(r){q.error(X(r))}});return y.useEffect(()=>{n(t)},[t]),e.jsx(f,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:o.map(c=>c.isPrivate?null:e.jsx(ot,{checked:!c.value,labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:l("userCenter.toPublic",{name:c.name})})},size:"small",onChange:p=>i(c.key,p.target.checked)},c.key))})}ht.propTypes={configList:u.arrayOf(u.shape({key:u.string.isRequired,name:u.string.isRequired,value:u.bool.isRequired,isPrivate:u.bool})).isRequired,onSave:u.func.isRequired};function gt({user:t,sessionUser:s}){const o=T(()=>(t?.passports||[])?.find(n=>n.name===s.role),[t?.passports,s?.role]);return e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(tt,{size:40,variant:"circle",shape:"circle",src:s.avatar,did:s.did,sx:{flexShrink:0}}),e.jsxs(f,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(J,{title:s.fullName,children:e.jsx(I,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:s.fullName})}),e.jsx(je,{label:o?.title||o?.name||"Guest",size:"small",variant:"outlined",sx:{flexShrink:0,fontWeight:"bold",fontSize:"12px",color:"text.primary",borderColor:"grey.300",backgroundColor:"transparent",textTransform:"capitalize",pr:.5,pl:0,height:"auto"}})]}),e.jsx(J,{title:s.email,children:e.jsx(I,{variant:"body2",color:"grey",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.email})})]})]})}gt.propTypes={user:u.object.isRequired,sessionUser:u.shape({role:u.string,avatar:u.string,did:u.string,fullName:u.string,email:u.string}).isRequired};const sn=()=>Promise.resolve(""),Ge=t=>new ve(t,{browser:[[/(ArcWallet)\/([\w\.]+)/i],[ve.BROWSER.NAME,ve.BROWSER.VERSION]]}).getResult(),Ke={display:"flex",justifyContent:"flex-end",textAlign:"right"},an=new rr({concurrency:1}),Me=y.memo(({userSession:t,isMobile:s=!1})=>{const o=H({loading:!0,ipRegion:""}),{t:n}=N();return y.useEffect(()=>{an.add(async()=>{try{o.ipRegion=await sn(t.lastLoginIp)}finally{o.loading=!1}})},[o,t.lastLoginIp]),e.jsx(f,{...s&&{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,flexWrap:"wrap"},children:o.ipRegion?e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"body2",children:o.ipRegion}),e.jsx(I,{variant:"body2",color:"grey",children:t.lastLoginIp||n("userCenter.unknown")})]}):e.jsxs(e.Fragment,{children:[e.jsx(I,{children:t.lastLoginIp||n("userCenter.unknown")}),o.loading?e.jsx(I,{variant:"body2",color:"grey",sx:{textAlign:"center"},children:e.jsx(Y,{size:12,color:"inherit"})}):null]})})});Me.propTypes={userSession:u.object.isRequired,isMobile:u.bool};Me.defaultProps={isMobile:!1};function mt({user:t,showAction:s=!0,showUser:o=!0,getUserSessions:n,showOffline:l=!1}){const i=H({status:"online",page:1,pageSize:10}),c=H({online:0,expired:0,offline:0}),p=gr(),{t:r}=N(),x=re({key:"md"}),m=xe(j=>j.breakpoints.down("lg")),{confirmApi:h,confirmHolder:C}=Re(),v=E(async()=>{const j=await n({page:i.page,pageSize:i.pageSize,status:i.status}),S=j?.paging?.total||0;return c[i.status]=S,{total:S,list:j?.list||[]}});Ze(async()=>{const j=await n({page:1,pageSize:1,status:"expired"});c.expired=j?.paging?.total||0;const S=await n({page:1,pageSize:1,status:"offline"});c.offline=S?.paging?.total||0});const a=te(v,{refreshDeps:[i.status,i.page,i.pageSize]}),g=T(()=>a.data?.list||[],[a.data?.list]),k=T(()=>{const{status:j}=i;return j==="online"?c[j]<=1:c[j]===0},[g,p]),R=T(()=>de({},x?Ke:{}),[x]),P=E(({visitorId:j})=>{h.open({title:r("userCenter.logoutThisSession"),content:r("userCenter.logoutThisSessionConfirm"),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await $.user.logout({visitorId:j,includeFederated:!0});const{page:S=0}=i,{list:B=[]}=a.data||{},G=B.length||0;S>1&&G===1&&(i.page=Math.max(S-1,1)),a.refresh(),h.close()}})}),b=E(()=>{h.open({title:r("userCenter.logoutAllSession",{type:r(i.status)}),content:r("userCenter.logoutAllSessionConfirm",{type:r(i.status)}),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await $.user.logout({status:i.status,visitorId:p,includeFederated:!0}),i.page=1,a.refresh(),h.close()}})}),z=[];s&&z.push(e.jsx(J,{title:r("userCenter.logoutAllTips",{type:r(i.status)}),children:e.jsx(_,{sx:{ml:.5},size:"small",variant:"contained",color:"error",onClick:b,disabled:k,children:r("userCenter.logoutAll",{type:r(i.status)})})},"logoutAll"));const L=T(()=>({search:!1,sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!1,searchDebounceTime:600,page:i.page-1,rowsPerPage:i.pageSize,count:a.data?.total||0}),[a.data?.total,i.page,i.pageSize]),U=[{label:r("userCenter.platform"),name:"platform",options:{customBodyRenderLite:j=>{const S=g[j],B=Ge(S?.ua);return e.jsx(f,{sx:R,children:[B.os?.name,B.os?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.deviceType"),name:"deviceType",options:{customBodyRenderLite:j=>{const S=g[j],B=Ge(S?.ua);return e.jsx(f,{sx:R,children:[B.browser?.name,B.browser?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.walletOS"),name:"walletOS",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:S.extra?.walletOS||r("userCenter.unknown")})}}},o&&{label:r("userCenter.user"),name:"user",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:de({minWidth:150,maxWidth:250},x?Ke:{}),children:e.jsx(gt,{sessionUser:S.user,user:t})})}}},{label:r("userCenter.createdAt"),name:"createdAt",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:S.createdAt?e.jsx(Oe,{value:S.createdAt,relativeRange:3*86400*1e3}):r("userCenter.unknown")})}}},!l&&{label:r("userCenter.updatedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:S.status==="expired"?r("userCenter.expired"):e.jsx(Oe,{value:S.updatedAt,relativeRange:3*86400*1e3})})}}},{label:r("userCenter.lastLoginIp"),name:"lastLoginIp",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(Me,{userSession:S,isMobile:x})}}},s&&{label:r("userCenter.actions"),name:"actions",options:{customBodyRenderLite:j=>{const S=g[j];return e.jsx(f,{sx:R,children:e.jsx(_,{sx:{whiteSpace:"nowrap",fontSize:"12px !important",lineHeight:"1.25",px:1},disabled:p===S.visitorId,variant:"outlined",size:"small",color:"error",onClick:()=>P({visitorId:S.visitorId}),children:S.status==="expired"?r("userCenter.remove"):p===S.visitorId?r("userCenter.currentSession"):r("userCenter.logout")})})}}}].filter(Boolean);return e.jsxs(f,{className:"pc-user-sessions",sx:{maxWidth:x?"unset":m?"calc(100vw - 300px)":"100%",...x&&{".pc-user-sessions-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:j=>`${j.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...x&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:[C,e.jsx(mr,{count:a.data?.total||0,data:g,columns:U,customButtons:z,options:L,loading:a.loading,className:"pc-user-sessions-table",title:e.jsxs(Nt,{row:!0,sx:{lineHeight:1,ml:1},onChange:j=>{i.status=j.target.value},children:[e.jsx(Z,{value:"online",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="online"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.online"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",c.online,")"]})]})}),e.jsx(Z,{value:"expired",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="expired"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.expired"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",c.expired,")"]})]})}),l?e.jsx(Z,{value:"offline",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="offline"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.offline"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",c.offline,")"]})]})}):null]}),onChange:j=>{i.page=j.page+1,i.pageSize=j.rowsPerPage}})]})}mt.propTypes={user:u.object.isRequired,showAction:u.bool,showUser:u.bool,showOffline:u.bool,getUserSessions:u.func.isRequired};function bt({onDestroySelf:t=void 0}){const{confirmHolder:s}=Re(),{t:o}=N(),{session:n}=y.use(fe),l=E(async()=>{if(!t||typeof t!="function")return;const i=n.withSecondaryAuth(t,{extraParams:{removeUserDid:n?.user?.did,input:{user:{did:n?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await i(),n.logout()}catch(c){q.error(c?.message||o("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(f,{children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(f,{children:[e.jsx(I,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:o("userCenter.dangerZone.deleteAccount")}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary"},children:o("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(_,{variant:"contained",color:"error",size:"small",onClick:l,children:o("userCenter.dangerZone.delete")})]})}),s]})}bt.propTypes={onDestroySelf:u.func};function ln(){const t=re({key:"md"}),s=xe(l=>l.breakpoints.down("lg")),o={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},n=T(()=>de({},t?o:{}),[t]);return e.jsx(f,{id:"user-center-access-key-setting",sx:{maxWidth:t?"unset":s?"calc(100vw - 300px)":"100%",...t&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:l=>`${l.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...t&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(Tr,{isSelf:!0,columnSx:n})})}function yt({onDestroySelf:t=void 0,userCenterTabs:s=[]}){const{t:o}=N(),{user:n,session:l,isMyself:i,isOwner:c}=Ae(),r=Te().arcSphere,x=re({key:"md"}),m=te(async()=>n&&i?await $.user.getUserPrivacyConfig({did:n.did}):null,{refreshDeps:[n,i],loadingDelay:300}),h=T(()=>s.map(a=>({key:a.value,name:a.label,value:a.protected,isPrivate:a.isPrivate})),[s]),C=E(async a=>a==="privacy"?(await m.runAsync(),m.data):(a==="profile"&&await l.refresh(),null));y.useEffect(()=>{const a=window.location.hash.slice(1);a&&document.getElementById(a)?.scrollIntoView({behavior:"smooth"})},[]);const v=T(()=>[r?void 0:{label:o("userCenter.commonSetting.title"),value:"common",content:e.jsx(ut,{user:n,onSave:C})},{label:o("userCenter.notificationManagement"),value:"notification",content:e.jsx(pt,{user:n,isMobile:x})},{label:o("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(ft,{user:n})},{label:o("common.accessKeys"),value:"accessKeys",content:e.jsx(ln,{isSelf:!0})},{label:o("common.mcpServers"),value:"mcpServers",content:e.jsx(Ir,{})},{label:o("userCenter.privacyManagement"),value:"privacy",content:e.jsx(ht,{configList:h,onSave:C})},{label:o("userCenter.sessionManagement"),value:"session",content:e.jsx(mt,{user:n,showUser:!1,getUserSessions:a=>$.userSession.getMyLoginSessions({},a)})},!c&&t&&typeof t=="function"?{label:o("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(bt,{onDestroySelf:t}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[n,h,x,c,t]);return i?e.jsx(f,{className:"user-center-settings",sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},"@media (min-width: 1200px) and (max-width: 1260px)":{maxWidth:750},"@media (min-width: 1100px) and (max-width: 1199px)":{maxWidth:650},"@media (min-width: 1000px) and (max-width: 1099px)":{maxWidth:600},"@media (max-width: 1049px)":{maxWidth:"100%"}},children:v.map(a=>a?e.jsxs(f,{id:a.value,sx:de({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},a.sx),children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600},children:a.label}),e.jsx(f,{sx:{mt:2.5},children:a.content})]},a.value):null)}):null}yt.propTypes={onDestroySelf:u.func,userCenterTabs:u.array};const vt=y.createContext({}),{Provider:cn,Consumer:ao}=vt;function wt({children:t}){const[s]=y.useState(!1),{session:o}=y.use(fe),{user:n}=o,[l,i]=y.useState(),c=y.useMemo(()=>n?.didSpace?.endpoint,[n?.didSpace]);y.useEffect(()=>{i(n?.didSpace)},[n?.didSpace]);const p=async()=>{i(void 0)},r=h=>{},x=async h=>{i(h),await r(h.endpoint)},m=!!(c&&l);return e.jsx(cn,{value:{loading:s,spaceGateway:l,session:o,deleteSpaceGateway:p,updateSpaceGateway:x,storageEndpoint:c,settingStorageEndpoint:r,hasStorageEndpoint:m},children:t})}function ze(){return y.use(vt)}wt.propTypes={children:u.node.isRequired};function dn(t){const s=t.replace(/\/api\/space\/.+/,""),n=t.replace(/\/$/,"").split("/").at(-4);return ce(s,"space",n)}function jt({session:t,spaceGateway:s,spaceStatus:o,refresh:n}){return e.jsxs(ke,{direction:"row",spacing:1,children:[o===Mr.DISCONNECTED&&e.jsx(ue,{reconnect:!0,variant:"outlined",session:t,spaceDid:t.user?.didSpace?.did,spaceGatewayUrl:t.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await n()},onError:l=>{console.error(l),q.error(X(l))}}),e.jsx(O,{size:"small",LinkComponent:Dt,href:dn(s.endpoint),target:"_blank",children:e.jsx(Ot,{})})]})}jt.propTypes={session:u.object.isRequired,spaceGateway:u.object.isRequired,spaceStatus:u.string.isRequired,refresh:u.func.isRequired};function Ct({spaceGateway:t=void 0}){const{t:s}=N(),{updateSpaceGateway:o,session:n}=ze(),l=re(),i=({spaceGateway:c})=>o(c);return e.jsxs(f,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(f,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:s("userCenter.storage.spaces.connected.title")}),!l&&e.jsx(ue,{connectScope:"user",connectText:s("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})]}),e.jsx(f,{children:t&&e.jsx(zr,{endpoint:t.endpoint,deps:[t],selected:!0,footer:!0,action:c=>e.jsx(jt,{session:n,...c})},t.endpoint)}),l&&e.jsx(f,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(ue,{connectScope:"user",connectText:s("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})})]})}Ct.propTypes={spaceGateway:u.object};function un(){const{t}=N(),{updateSpaceGateway:s,session:o}=ze(),n=({spaceGateway:l})=>s(l);return e.jsxs(f,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:t("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Er,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(f,{children:e.jsx(ue,{session:o,onSuccess:n})})]})}function pn(){const{spaceGateway:t,hasStorageEndpoint:s,loading:o}=ze(),{isMyself:n}=Ae();return n?o?e.jsx(Ar,{relative:"parent",children:e.jsx(Y,{})}):e.jsx(fn,{children:e.jsx(f,{sx:{maxWidth:"720px"},children:s?e.jsx(Ct,{spaceGateway:t}):e.jsx(un,{})})}):null}function xn(){return e.jsx(wt,{children:e.jsx(pn,{})})}const fn=ee(f)`
|
|
122
122
|
height: 100%;
|
|
123
123
|
overflow-y: auto;
|
|
124
124
|
`;function lo(){const{api:t}=nr(),s=y.useRef(null),n=Ft().tab,i=new URLSearchParams(window.location.search).get("embed")||window.sessionStorage?.getItem("embed"),c=or(),p=T(()=>({...window.blocklet,meta:{did:window.blocklet.did,name:window.blocklet.did},children:window?.blocklet?.componentMountPoints.map(x=>({...x,meta:{...x,did:x.did,name:x.name||x.title||"",logo:"logo.png"}}))})),r=async x=>{const{input:m,sessionId:h}=x;try{await t.destroySelf({input:{...m,sessionId:h}})}catch(C){console.error("destroy myself error",C)}};return e.jsx(vr,{children:e.jsxs(Rr,{ref:s,embed:i==="1",currentTab:n?ce(Pe.WELLKNOWN_SERVICE_PATH_PREFIX,"user",n):"",disableAutoRedirect:n==="settings",children:[n==="notifications"?e.jsx(Zr,{blocklets:[p],context:c}):null,n==="nfts"?e.jsx(nn,{}):null,n==="settings"?e.jsx(yt,{onDestroySelf:r}):null,n==="did-spaces"?e.jsx(xn,{}):null]})})}export{lo as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as y,t as dr,g as mr,e as ur}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as L,y as _e,x as Me,bb as qe,M as ye,T as G,z as de,bC as Ze,aX as se,a6 as ie,W as b,at as $,aj as pr,aI as fr,D as hr,ck as ve,bp as gr,b6 as kt,bq as xr,am as me,bZ as ct,P as yr,Q as Pt,bW as vr,ds as br,c9 as Cr,aO as jr,aP as Sr,dt as wr,I as kr,dr as Pr,bL as Ir,du as Er,a5 as Tr}from"./vendor-mui-core-B7zoO8f5.js";import{B as We,e as $e,K as Ar,ad as Rr,n as dt,C as Dr,a as Lr}from"./vendor-utils-DtY42AM-.js";import{T as Z,$ as Or,J as Nr,H as Y,F as te,D as W,G as pe,a9 as It,aa as Ur,L as Br,a5 as ze,ab as Et,ah as Fr}from"./vendor-ux-Br1Zu4eg.js";import{bd as Qe,aA as Tt,av as _r,aB as Mr,bS as qr,bT as Wr,Z as H,bU as be,p as ue,ao as He,W as $r,v as zr,aM as Hr,B as ne,bV as Kr,bW as Vr,a8 as At,c as ee,b9 as Zr,a5 as Qr,X as re,bX as Rt,aq as Yr,aU as Dt,bY as Gr}from"./index-Dg-fihjm.js";import{B as Lt,a as Xr,l as Ot}from"./index-Df2pSXXR.js";import{w as Jr,b as Ye,g as je,c as en,h as tn,a as rn}from"./vendor-hooks-BRXKH6Nb.js";import{C as Nt,A as nn}from"./user-sessions-BMBqVzE9.js";import{r as sn}from"./hdkey-OYxbu68D.js";import{W as Ut}from"./dashboard-CvtXVg-Y.js";import{W as Ge}from"./did-address-ByONFwMZ.js";import{u as Q}from"./team-B6ADMIin.js";import{P as X}from"./permission-CcwCK5jk.js";import{C as Se}from"./click-to-copy-CNVY2jyw.js";import{T as Bt}from"./index-BNqNjoec.js";import{f as J}from"./index-DBs9Ljax.js";import{u as on}from"./useAsync-CsYRBczg.js";import{v as z}from"./index-CpZPMhFT.js";import{C as fe}from"./confirm-B-Pohnpi.js";import{u as he}from"./session-CccpevO4.js";import{N as an}from"./index-DgBUoYTd.js";import{i as Ft,a as Ce,p as _t}from"./util-P7tJ3St_.js";import{b as ln}from"./sdk-Bskg7NCT.js";import{A as cn}from"./actions-Bf4UKTeu.js";import{S as dn}from"./shorten-label-BHlFrl9P.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-B6isO619.js";import"./useLocalStorage-c2PGUYSe.js";import"./get-safe-url-Cg-U52oI.js";import"./useAsyncRetry-D4-sRZN-.js";import"./useAsync-BrMo9m7W.js";import"./useSetState-DFuQZPPV.js";import"./index-BzuF1xQu.js";import"./over-due-invoice-payment-CDRcX7in.js";import"./use-mobile-DM4d_PLd.js";import"./isURL-JpmdK601.js";import"./use-app-logo-oV4_Gpbf.js";import"./arrow-down.svg-_z1Gr5z1.js";import"./vendor-mui-x-Qph0dQcg.js";import"./AdapterDayjs-hXG6wgqC.js";import"./base32-CzDOk3cF.js";const Mt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375}),y.createElement("rect",{x:15.3125,y:14.0625,width:7.5,height:1.875,rx:.9375,transform:"rotate(-90 15.3125 14.0625)"})),qt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})),Wt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375})),mn=t=>y.createElement("svg",{width:18,height:19,viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("g",{clipPath:"url(#clip0)"},y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0"},y.createElement("rect",{width:18,height:18,transform:"translate(0 0.5)"}))));var Te={},Ae,mt;function un(){return mt||(mt=1,Ae=t=>encodeURIComponent(t).replace(/[!'()*]/g,u=>`%${u.charCodeAt(0).toString(16).toUpperCase()}`)),Ae}var Re,ut;function pn(){if(ut)return Re;ut=1;var t="%[a-f0-9]{2}",u=new RegExp("("+t+")|([^%]+?)","gi"),f=new RegExp("("+t+")+","gi");function x(o,c){try{return[decodeURIComponent(o.join(""))]}catch{}if(o.length===1)return o;c=c||1;var i=o.slice(0,c),p=o.slice(c);return Array.prototype.concat.call([],x(i),x(p))}function C(o){try{return decodeURIComponent(o)}catch{for(var c=o.match(u)||[],i=1;i<c.length;i++)o=x(c,i).join(""),c=o.match(u)||[];return o}}function h(o){for(var c={"%FE%FF":"��","%FF%FE":"��"},i=f.exec(o);i;){try{c[i[0]]=decodeURIComponent(i[0])}catch{var p=C(i[0]);p!==i[0]&&(c[i[0]]=p)}i=f.exec(o)}c["%C2"]="�";for(var s=Object.keys(c),j=0;j<s.length;j++){var v=s[j];o=o.replace(new RegExp(v,"g"),c[v])}return o}return Re=function(o){if(typeof o!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof o+"`");try{return o=o.replace(/\+/g," "),decodeURIComponent(o)}catch{return h(o)}},Re}var De,pt;function fn(){return pt||(pt=1,De=(t,u)=>{if(!(typeof t=="string"&&typeof u=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(u==="")return[t];const f=t.indexOf(u);return f===-1?[t]:[t.slice(0,f),t.slice(f+u.length)]}),De}var Le,ft;function hn(){return ft||(ft=1,Le=function(t,u){for(var f={},x=Object.keys(t),C=Array.isArray(u),h=0;h<x.length;h++){var o=x[h],c=t[o];(C?u.indexOf(o)!==-1:u(o,c,t))&&(f[o]=c)}return f}),Le}var ht;function gn(){return ht||(ht=1,function(t){const u=un(),f=pn(),x=fn(),C=hn(),h=r=>r==null;function o(r){switch(r.arrayFormat){case"index":return n=>(l,d)=>{const m=l.length;return d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[p(n,r),"[",m,"]"].join("")]:[...l,[p(n,r),"[",p(m,r),"]=",p(d,r)].join("")]};case"bracket":return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[p(n,r),"[]"].join("")]:[...l,[p(n,r),"[]=",p(d,r)].join("")];case"comma":case"separator":return n=>(l,d)=>d==null||d.length===0?l:l.length===0?[[p(n,r),"=",p(d,r)].join("")]:[[l,p(d,r)].join(r.arrayFormatSeparator)];default:return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,p(n,r)]:[...l,[p(n,r),"=",p(d,r)].join("")]}}function c(r){let n;switch(r.arrayFormat){case"index":return(l,d,m)=>{if(n=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!n){m[l]=d;return}m[l]===void 0&&(m[l]={}),m[l][n[1]]=d};case"bracket":return(l,d,m)=>{if(n=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!n){m[l]=d;return}if(m[l]===void 0){m[l]=[d];return}m[l]=[].concat(m[l],d)};case"comma":case"separator":return(l,d,m)=>{const I=typeof d=="string"&&d.includes(r.arrayFormatSeparator),w=typeof d=="string"&&!I&&s(d,r).includes(r.arrayFormatSeparator);d=w?s(d,r):d;const D=I||w?d.split(r.arrayFormatSeparator).map(R=>s(R,r)):d===null?d:s(d,r);m[l]=D};default:return(l,d,m)=>{if(m[l]===void 0){m[l]=d;return}m[l]=[].concat(m[l],d)}}}function i(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function p(r,n){return n.encode?n.strict?u(r):encodeURIComponent(r):r}function s(r,n){return n.decode?f(r):r}function j(r){return Array.isArray(r)?r.sort():typeof r=="object"?j(Object.keys(r)).sort((n,l)=>Number(n)-Number(l)).map(n=>r[n]):r}function v(r){const n=r.indexOf("#");return n!==-1&&(r=r.slice(0,n)),r}function k(r){let n="";const l=r.indexOf("#");return l!==-1&&(n=r.slice(l)),n}function a(r){r=v(r);const n=r.indexOf("?");return n===-1?"":r.slice(n+1)}function g(r,n){return n.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):n.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function P(r,n){n=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},n),i(n.arrayFormatSeparator);const l=c(n),d=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return d;for(const m of r.split("&")){if(m==="")continue;let[I,w]=x(n.decode?m.replace(/\+/g," "):m,"=");w=w===void 0?null:["comma","separator"].includes(n.arrayFormat)?w:s(w,n),l(s(I,n),w,d)}for(const m of Object.keys(d)){const I=d[m];if(typeof I=="object"&&I!==null)for(const w of Object.keys(I))I[w]=g(I[w],n);else d[m]=g(I,n)}return n.sort===!1?d:(n.sort===!0?Object.keys(d).sort():Object.keys(d).sort(n.sort)).reduce((m,I)=>{const w=d[I];return w&&typeof w=="object"&&!Array.isArray(w)?m[I]=j(w):m[I]=w,m},Object.create(null))}t.extract=a,t.parse=P,t.stringify=(r,n)=>{if(!r)return"";n=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},n),i(n.arrayFormatSeparator);const l=w=>n.skipNull&&h(r[w])||n.skipEmptyString&&r[w]==="",d=o(n),m={};for(const w of Object.keys(r))l(w)||(m[w]=r[w]);const I=Object.keys(m);return n.sort!==!1&&I.sort(n.sort),I.map(w=>{const D=r[w];return D===void 0?"":D===null?p(w,n):Array.isArray(D)?D.reduce(d(w),[]).join("&"):p(w,n)+"="+p(D,n)}).filter(w=>w.length>0).join("&")},t.parseUrl=(r,n)=>{n=Object.assign({decode:!0},n);const[l,d]=x(r,"#");return Object.assign({url:l.split("?")[0]||"",query:P(a(r),n)},n&&n.parseFragmentIdentifier&&d?{fragmentIdentifier:s(d,n)}:{})},t.stringifyUrl=(r,n)=>{n=Object.assign({encode:!0,strict:!0},n);const l=v(r.url).split("?")[0]||"",d=t.extract(r.url),m=t.parse(d,{sort:!1}),I=Object.assign(m,r.query);let w=t.stringify(I,n);w&&(w=`?${w}`);let D=k(r.url);return r.fragmentIdentifier&&(D=`#${p(r.fragmentIdentifier,n)}`),`${l}${w}${D}`},t.pick=(r,n,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:d,query:m,fragmentIdentifier:I}=t.parseUrl(r,l);return t.stringifyUrl({url:d,query:C(m,n),fragmentIdentifier:I},l)},t.exclude=(r,n,l)=>{const d=Array.isArray(n)?m=>!n.includes(m):(m,I)=>!n(m,I);return t.pick(r,d,l)}}(Te)),Te}var Oe=gn();const ae=dr,xn={parseNumbers:!1,parseBooleans:!1},yn={skipNull:!1,skipEmptyString:!1},vn=(t,u)=>{var f,x;const{navigateMode:C="push",parseOptions:h,stringifyOptions:o}={},c=Object.assign(Object.assign({},xn),h),i=Object.assign(Object.assign({},yn),o),p=ae.useLocation(),s=(f=ae.useHistory)===null||f===void 0?void 0:f.call(ae),j=(x=ae.useNavigate)===null||x===void 0?void 0:x.call(ae),v=Jr(),k=y.useRef(typeof t=="function"?t():t||{}),a=y.useMemo(()=>Oe.parse(p.search,c),[p.search]),g=y.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[g,Ye(r=>{const n=typeof r=="function"?r(g):r;v(),s&&s[C]({hash:p.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),i)||"?"},p.state),j&&j({hash:p.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),i)||"?"},{replace:C==="replace",state:p.state})})]};var Ne,gt;function bn(){if(gt)return Ne;gt=1;const t=sn(),u=Qe(),{fromSecretKey:f,WalletType:x}=Tt(),{isHexStrict:C,toHex:h,toBuffer:o,stripHexPrefix:c}=_r(),{types:i}=u;return Ne={fromAppDid:(s,j,v={role:i.RoleType.ROLE_ACCOUNT},k=0)=>{if(!j)throw new Error("Cannot get user wallet with empty root sk");const a=u.Hasher.SHA3.hash256(o(s)),g=c(a).slice(0,16),P=g.slice(0,8),r=g.slice(8,16),n=parseInt(+`0x${P}`,10)&2147483647,l=parseInt(+`0x${r}`,10)&2147483647,d=c(C(j)?j:h(j)),m=t.fromMasterSeed(We.from(d,"hex")),I=`m/44'/260'/${n}'/${l}'/${k}`,w=m.derive(I),D=x(v),{pk:R=i.KeyType.ED25519}=D;let T;return R===i.KeyType.ED25519?T=u.Signer.Ed25519.genKeyPair("hex",w.privateKey).secretKey:T=h(w.privateKey),R===i.KeyType.ETHEREUM&&(T=T.slice(0,66)),f(T,D)}},Ne}var Ue,xt;function Cn(){if(xt)return Ue;xt=1;const t=Qe(),u=Tt(),f=Mr(),x=bn(),C={role:t.types.RoleType.ROLE_APPLICATION};return Ue=(o,c,i,p)=>{let s=i||C;const j=(0,f.isEthereumType)((0,f.DidType)(i));if(j?s=(0,u.WalletType)(i):s=(0,u.WalletType)(C),!(0,f.isValid)(o)){let v="";try{return j?v=o.slice(0,66):v=o,(0,u.fromSecretKey)(v,s)}catch(k){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${k.message}`)}}if(!c)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,x.fromAppDid)(o,c,s,p||0)},Ue}var le,yt;function jn(){if(yt)return le;yt=1;var t=le&&le.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};const u=t(qr),f=Qe(),x=t(Cn()),C=Wr();return le=(o,c,{returnWallet:i=!0}={})=>{if(!o||typeof o!="object"||!Array.isArray(o.environments)||!(0,u.default)(o,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:p,configs:s=[]}=o,j=[...s,...p],v=j.find(U=>U.key==="BLOCKLET_APP_DESCRIPTION"),k=j.find(U=>U.key==="BLOCKLET_PASSPORT_COLOR"),a=j.find(U=>U.key==="BLOCKLET_APP_URL"),g=j.find(U=>U.key==="BLOCKLET_APP_TENANT_MODE"),{did:P,version:r}=o.meta,n=(0,C.getDisplayName)(o),l=(0,u.default)(v,"value",o.meta.description),d=(0,u.default)(k,"value","auto"),m=(0,u.default)(a,"value",""),I=(0,u.default)(g,"value","");if(!i)return{did:P,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:"",wallet:null,permanentWallet:null,tenantMode:I};const w=j.find(U=>U.key==="BLOCKLET_APP_SK"),D=j.find(U=>U.key==="BLOCKLET_APP_CHAIN_TYPE")||j.find(U=>U.key==="BLOCKLET_WALLET_TYPE"),R=j.find(U=>U.key==="BLOCKLET_APP_PSK");let T;D&&(D.value==="ethereum"||D.value==="eth")&&(T=D.value);let O=null,F=null;if(w&&w.value)O=(0,x.default)(w.value,void 0,T),R&&R.value&&R.value!==w.value&&(F=(0,x.default)(R.value,void 0,T));else{if(!c||typeof c!="string")throw new Error("Node secret key must be a string");D?O=(0,x.default)(o.meta.did,c,T):O=(0,x.default)(o.meta.did,c)}const M=o.settings?.session?.salt||"",K=f.Hasher.SHA3.hash256(We.concat([O.secretKey,O.address,M].filter(Boolean).map(U=>We.from(U))));return{did:P,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:K,wallet:O,permanentWallet:F||O,tenantMode:I}},le}var Sn=jn();const wn=mr(Sn);var kn={};function $t({teamDid:t,roles:u=[],apps:f=[],onCancel:x,onSuccess:C,onError:h=()=>{},endpoint:o=""}){const{api:c}=H(),{t:i,locale:p}=Z(),s=je({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:f.length>0?f[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),j=async()=>{if(!s.role){s.error=i("team.member.error.passportEmpty");return}if(s.passportExpireTime&&He(s.passportExpireTime).isBefore(He())){s.error=i("team.passport.customExpireTimeIsInvalid");return}const g=s.remark.trim();s.error=null,s.loading=!0;try{let P=s.sourceAppPid??null;P===t&&(P=null);const r={teamDid:t,role:s.role,remark:g,sourceAppPid:P,passportExpireTime:s.passportExpireTime?s.passportExpireTime.toISOString():""};s.display&&(r.display={type:"url",content:s.display});const{inviteInfo:n}=await c.createMemberInvitation({input:r});s.inviteInfo=n,s.activeStep=1}catch(P){const r=J(P);s.error=r,h(P)}finally{s.loading=!1}},v=u.find(g=>g.name===s.role),a=[{body:e.jsxs(L,{sx:{display:"flex",flexDirection:"column",gap:3},children:[f.length>1?e.jsxs(_e,{fullWidth:!0,children:[e.jsx(Me,{children:i("common.sourceApp")}),e.jsx(qe,{value:s.sourceAppPid,onChange:g=>{s.error=null,s.sourceAppPid=g.target.value},fullWidth:!0,label:i("common.passport"),disabled:s.loading,children:f.map(g=>e.jsx(ye,{value:g.appPid,children:e.jsxs(L,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(L,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Or,{did:g.appPid,size:28}),g.appName]}),e.jsx(Nr,{did:g.appPid,compact:!0,responsive:!1})]})},g.appPid))})]}):null,e.jsxs(_e,{fullWidth:!0,variant:"outlined",children:[e.jsx(Me,{children:i("common.passport")}),e.jsx(qe,{"data-cy":"invite-member-select-role",value:s.role,onChange:g=>{s.error=null,s.role=g.target.value},fullWidth:!0,label:i("common.passport"),disabled:s.loading,onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),j())},children:u.filter(g=>g.name!=="owner").map(g=>e.jsx(ye,{value:g.name,"data-cy":`invite-member-select-option-${g.name}`,children:e.jsxs(L,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(G,{variant:"subtitle1",children:g.title||g.name}),e.jsx(G,{variant:"caption",sx:{opacity:.7},children:g.description})]})},g.name))})]}),v?.extra?.display==="custom"&&e.jsx(de,{label:i("common.display"),type:"url",value:s.display,onChange:g=>{s.error=null,s.display=g.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.remark,onChange:g=>{s.error=null,s.remark=g.target.value},disabled:s.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Bt,{value:s.passportExpireTime,onChange:g=>{s.error=null,s.passportExpireTime=g},showError:!1})]}),cancel:i("common.cancel"),confirm:i("team.member.inviteDialog.createInviteLink"),onCancel:x,onConfirm:j},{body:()=>{const g=be({inviteId:s.inviteInfo?.inviteId,endpoint:o});return e.jsxs("div",{children:[e.jsx(L,{sx:{fontSize:16,fontWeight:"bold"},children:i("team.member.inviteDialog.createSuccessTip",{expireDate:ue(s.inviteInfo?.expireDate,p)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:g})]})},confirm:i("common.copy"),onConfirm:()=>{const g=be({inviteId:s.inviteInfo?.inviteId,endpoint:o});if(["1","true"].includes(kn.IS_E2E)){C();return}en(g),Y.success(i("common.copied")),C()},cancel:i("common.cancel"),onCancel:x}][s.activeStep];return e.jsxs(te,{title:i("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:s.loading||!s.role,variant:"contained",autoFocus:!0,children:[s.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!s.error&&e.jsx(se,{severity:"error",sx:{mt:2},children:s.error})]})}$t.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};function zt({teamDid:t,onCancel:u,onSuccess:f,onError:x=()=>{},endpoint:C=""}){const{api:h,info:o}=H(),{api:c}=y.useContext($r),[i,p]=y.useState(!1),{t:s,locale:j}=Z(),[v,k]=y.useState(""),[a,g]=y.useState(!1),[P,r]=y.useState(0),[n,l]=y.useState(""),[d,m]=y.useState(""),I=!!$e(o,"ownerNft.did"),w=on(async()=>{if(I){const{state:M}=await h.getDelegationState();return M}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:u,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:u,children:e.jsx(se,{severity:"error",children:J(w.error)})});const D=async()=>{k(null),p(!0);try{const{inviteInfo:M}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:d.trim()}});l(M),r(O.length-1)}catch(M){const K=J(M);k(K),x(M)}finally{p(!1)}},R=()=>{g(!0),r(1)},T=()=>{g(!1),r(0)},O=[{body:e.jsxs(G,{component:"div",children:[e.jsxs(se,{severity:"warning",children:[e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.progress")}),e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(se,{severity:"warning",children:e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:s("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:d,onChange:M=>{k(null),m(M.target.value)},disabled:i,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:s("common.cancel"),confirm:s("team.transferNode.inviteDialog.createInviteLink"),onCancel:u,onConfirm:I&&!$e(w,"value.delegated")?R:D},{body:()=>e.jsx(zr,{action:"delegate-transfer-nft",open:a,locale:j,checkFn:c.get,onClose:T,onSuccess:D,checkTimeout:5*60*1e3,webWalletUrl:Hr(o),extraParams:{targetDID:o.did},messages:{title:s("team.transferNode.delegateDialog.title"),scan:s("team.transferNode.delegateDialog.scan"),confirm:s("team.transferNode.delegateDialog.confirm"),success:s("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const M=be({inviteId:n.inviteId,endpoint:C});return e.jsxs("div",{children:[e.jsx(Pn,{children:s("team.transferNode.inviteDialog.createSuccessTip",{expireDate:ue(n.expireDate,j)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:M})]})},confirm:s("common.confirm"),onConfirm:f}],F=O[P];return e.jsxs(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[F.cancel&&e.jsx(W,{onClick:F.onCancel,color:"inherit",children:F.cancel}),e.jsxs(W,{onClick:F.onConfirm,color:"primary",disabled:i,variant:"contained",autoFocus:!0,children:[i&&e.jsx(ie,{size:16}),F.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof F.body=="function"?F.body():F.body}),!!v&&e.jsx(se,{severity:"error",children:v})]})}zt.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};const Pn=$.div`
|
|
1
|
+
import{r as y,t as dr,g as mr,e as ur}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as L,y as _e,x as Me,bb as qe,M as ye,T as G,z as de,bC as Ze,aX as se,a6 as ie,W as b,at as $,aj as pr,aI as fr,D as hr,ck as ve,bp as gr,b6 as kt,bq as xr,am as me,bZ as ct,P as yr,Q as Pt,bW as vr,ds as br,c9 as Cr,aO as jr,aP as Sr,dt as wr,I as kr,dr as Pr,bL as Ir,du as Er,a5 as Tr}from"./vendor-mui-core-B7zoO8f5.js";import{B as We,e as $e,K as Ar,ad as Rr,n as dt,C as Dr,a as Lr}from"./vendor-utils-DtY42AM-.js";import{T as Z,$ as Or,J as Nr,H as Y,F as te,D as W,G as pe,a9 as It,aa as Ur,L as Br,a5 as ze,ab as Et,ah as Fr}from"./vendor-ux-CwCI0CzW.js";import{bd as Qe,aA as Tt,av as _r,aB as Mr,bS as qr,bT as Wr,Z as H,bU as be,p as ue,ao as He,W as $r,v as zr,aM as Hr,B as ne,bV as Kr,bW as Vr,a8 as At,c as ee,b9 as Zr,a5 as Qr,X as re,bX as Rt,aq as Yr,aU as Dt,bY as Gr}from"./index-DNoNJJuw.js";import{B as Lt,a as Xr,l as Ot}from"./index-CGL7HcjC.js";import{w as Jr,b as Ye,g as je,c as en,h as tn,a as rn}from"./vendor-hooks-BRXKH6Nb.js";import{C as Nt,A as nn}from"./user-sessions-BGZN3e4q.js";import{r as sn}from"./hdkey-CrUMEP4B.js";import{W as Ut}from"./dashboard-Tj8yP2Z7.js";import{W as Ge}from"./did-address-F4eDvKaA.js";import{u as Q}from"./team-BPq5KCHV.js";import{P as X}from"./permission-Dq0o-1GG.js";import{C as Se}from"./click-to-copy-rdt9ohrk.js";import{T as Bt}from"./index-0vzZm-sq.js";import{f as J}from"./index-DBs9Ljax.js";import{u as on}from"./useAsync-CsYRBczg.js";import{v as z}from"./index-QxHfLMG_.js";import{C as fe}from"./confirm-B32PxkWp.js";import{u as he}from"./session-B067QcnJ.js";import{N as an}from"./index-rNyzt7-f.js";import{i as Ft,a as Ce,p as _t}from"./util-BFlzHx4J.js";import{b as ln}from"./sdk-1bCjOEiK.js";import{A as cn}from"./actions-Bf4UKTeu.js";import{S as dn}from"./shorten-label-BHlFrl9P.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BOtVH-Qa.js";import"./useLocalStorage-Cw-tIN0T.js";import"./get-safe-url-DM7RwZvc.js";import"./useAsyncRetry-D4-sRZN-.js";import"./useAsync-BrMo9m7W.js";import"./useSetState-DFuQZPPV.js";import"./index-DpElP3rs.js";import"./over-due-invoice-payment-C571LZOO.js";import"./use-mobile-DM4d_PLd.js";import"./isURL-Bb15qx-x.js";import"./use-app-logo-DzFTqU3i.js";import"./arrow-down.svg-DUodC7Ld.js";import"./vendor-mui-x-Qph0dQcg.js";import"./AdapterDayjs-C9drjkA9.js";import"./base32-DjDr5HEK.js";const Mt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375}),y.createElement("rect",{x:15.3125,y:14.0625,width:7.5,height:1.875,rx:.9375,transform:"rotate(-90 15.3125 14.0625)"})),qt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})),Wt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375})),mn=t=>y.createElement("svg",{width:18,height:19,viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("g",{clipPath:"url(#clip0)"},y.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0"},y.createElement("rect",{width:18,height:18,transform:"translate(0 0.5)"}))));var Te={},Ae,mt;function un(){return mt||(mt=1,Ae=t=>encodeURIComponent(t).replace(/[!'()*]/g,u=>`%${u.charCodeAt(0).toString(16).toUpperCase()}`)),Ae}var Re,ut;function pn(){if(ut)return Re;ut=1;var t="%[a-f0-9]{2}",u=new RegExp("("+t+")|([^%]+?)","gi"),f=new RegExp("("+t+")+","gi");function x(o,c){try{return[decodeURIComponent(o.join(""))]}catch{}if(o.length===1)return o;c=c||1;var i=o.slice(0,c),p=o.slice(c);return Array.prototype.concat.call([],x(i),x(p))}function C(o){try{return decodeURIComponent(o)}catch{for(var c=o.match(u)||[],i=1;i<c.length;i++)o=x(c,i).join(""),c=o.match(u)||[];return o}}function h(o){for(var c={"%FE%FF":"��","%FF%FE":"��"},i=f.exec(o);i;){try{c[i[0]]=decodeURIComponent(i[0])}catch{var p=C(i[0]);p!==i[0]&&(c[i[0]]=p)}i=f.exec(o)}c["%C2"]="�";for(var s=Object.keys(c),j=0;j<s.length;j++){var v=s[j];o=o.replace(new RegExp(v,"g"),c[v])}return o}return Re=function(o){if(typeof o!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof o+"`");try{return o=o.replace(/\+/g," "),decodeURIComponent(o)}catch{return h(o)}},Re}var De,pt;function fn(){return pt||(pt=1,De=(t,u)=>{if(!(typeof t=="string"&&typeof u=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(u==="")return[t];const f=t.indexOf(u);return f===-1?[t]:[t.slice(0,f),t.slice(f+u.length)]}),De}var Le,ft;function hn(){return ft||(ft=1,Le=function(t,u){for(var f={},x=Object.keys(t),C=Array.isArray(u),h=0;h<x.length;h++){var o=x[h],c=t[o];(C?u.indexOf(o)!==-1:u(o,c,t))&&(f[o]=c)}return f}),Le}var ht;function gn(){return ht||(ht=1,function(t){const u=un(),f=pn(),x=fn(),C=hn(),h=r=>r==null;function o(r){switch(r.arrayFormat){case"index":return n=>(l,d)=>{const m=l.length;return d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[p(n,r),"[",m,"]"].join("")]:[...l,[p(n,r),"[",p(m,r),"]=",p(d,r)].join("")]};case"bracket":return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[p(n,r),"[]"].join("")]:[...l,[p(n,r),"[]=",p(d,r)].join("")];case"comma":case"separator":return n=>(l,d)=>d==null||d.length===0?l:l.length===0?[[p(n,r),"=",p(d,r)].join("")]:[[l,p(d,r)].join(r.arrayFormatSeparator)];default:return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,p(n,r)]:[...l,[p(n,r),"=",p(d,r)].join("")]}}function c(r){let n;switch(r.arrayFormat){case"index":return(l,d,m)=>{if(n=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!n){m[l]=d;return}m[l]===void 0&&(m[l]={}),m[l][n[1]]=d};case"bracket":return(l,d,m)=>{if(n=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!n){m[l]=d;return}if(m[l]===void 0){m[l]=[d];return}m[l]=[].concat(m[l],d)};case"comma":case"separator":return(l,d,m)=>{const I=typeof d=="string"&&d.includes(r.arrayFormatSeparator),w=typeof d=="string"&&!I&&s(d,r).includes(r.arrayFormatSeparator);d=w?s(d,r):d;const D=I||w?d.split(r.arrayFormatSeparator).map(R=>s(R,r)):d===null?d:s(d,r);m[l]=D};default:return(l,d,m)=>{if(m[l]===void 0){m[l]=d;return}m[l]=[].concat(m[l],d)}}}function i(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function p(r,n){return n.encode?n.strict?u(r):encodeURIComponent(r):r}function s(r,n){return n.decode?f(r):r}function j(r){return Array.isArray(r)?r.sort():typeof r=="object"?j(Object.keys(r)).sort((n,l)=>Number(n)-Number(l)).map(n=>r[n]):r}function v(r){const n=r.indexOf("#");return n!==-1&&(r=r.slice(0,n)),r}function k(r){let n="";const l=r.indexOf("#");return l!==-1&&(n=r.slice(l)),n}function a(r){r=v(r);const n=r.indexOf("?");return n===-1?"":r.slice(n+1)}function g(r,n){return n.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):n.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function P(r,n){n=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},n),i(n.arrayFormatSeparator);const l=c(n),d=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return d;for(const m of r.split("&")){if(m==="")continue;let[I,w]=x(n.decode?m.replace(/\+/g," "):m,"=");w=w===void 0?null:["comma","separator"].includes(n.arrayFormat)?w:s(w,n),l(s(I,n),w,d)}for(const m of Object.keys(d)){const I=d[m];if(typeof I=="object"&&I!==null)for(const w of Object.keys(I))I[w]=g(I[w],n);else d[m]=g(I,n)}return n.sort===!1?d:(n.sort===!0?Object.keys(d).sort():Object.keys(d).sort(n.sort)).reduce((m,I)=>{const w=d[I];return w&&typeof w=="object"&&!Array.isArray(w)?m[I]=j(w):m[I]=w,m},Object.create(null))}t.extract=a,t.parse=P,t.stringify=(r,n)=>{if(!r)return"";n=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},n),i(n.arrayFormatSeparator);const l=w=>n.skipNull&&h(r[w])||n.skipEmptyString&&r[w]==="",d=o(n),m={};for(const w of Object.keys(r))l(w)||(m[w]=r[w]);const I=Object.keys(m);return n.sort!==!1&&I.sort(n.sort),I.map(w=>{const D=r[w];return D===void 0?"":D===null?p(w,n):Array.isArray(D)?D.reduce(d(w),[]).join("&"):p(w,n)+"="+p(D,n)}).filter(w=>w.length>0).join("&")},t.parseUrl=(r,n)=>{n=Object.assign({decode:!0},n);const[l,d]=x(r,"#");return Object.assign({url:l.split("?")[0]||"",query:P(a(r),n)},n&&n.parseFragmentIdentifier&&d?{fragmentIdentifier:s(d,n)}:{})},t.stringifyUrl=(r,n)=>{n=Object.assign({encode:!0,strict:!0},n);const l=v(r.url).split("?")[0]||"",d=t.extract(r.url),m=t.parse(d,{sort:!1}),I=Object.assign(m,r.query);let w=t.stringify(I,n);w&&(w=`?${w}`);let D=k(r.url);return r.fragmentIdentifier&&(D=`#${p(r.fragmentIdentifier,n)}`),`${l}${w}${D}`},t.pick=(r,n,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:d,query:m,fragmentIdentifier:I}=t.parseUrl(r,l);return t.stringifyUrl({url:d,query:C(m,n),fragmentIdentifier:I},l)},t.exclude=(r,n,l)=>{const d=Array.isArray(n)?m=>!n.includes(m):(m,I)=>!n(m,I);return t.pick(r,d,l)}}(Te)),Te}var Oe=gn();const ae=dr,xn={parseNumbers:!1,parseBooleans:!1},yn={skipNull:!1,skipEmptyString:!1},vn=(t,u)=>{var f,x;const{navigateMode:C="push",parseOptions:h,stringifyOptions:o}={},c=Object.assign(Object.assign({},xn),h),i=Object.assign(Object.assign({},yn),o),p=ae.useLocation(),s=(f=ae.useHistory)===null||f===void 0?void 0:f.call(ae),j=(x=ae.useNavigate)===null||x===void 0?void 0:x.call(ae),v=Jr(),k=y.useRef(typeof t=="function"?t():t||{}),a=y.useMemo(()=>Oe.parse(p.search,c),[p.search]),g=y.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[g,Ye(r=>{const n=typeof r=="function"?r(g):r;v(),s&&s[C]({hash:p.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),i)||"?"},p.state),j&&j({hash:p.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),i)||"?"},{replace:C==="replace",state:p.state})})]};var Ne,gt;function bn(){if(gt)return Ne;gt=1;const t=sn(),u=Qe(),{fromSecretKey:f,WalletType:x}=Tt(),{isHexStrict:C,toHex:h,toBuffer:o,stripHexPrefix:c}=_r(),{types:i}=u;return Ne={fromAppDid:(s,j,v={role:i.RoleType.ROLE_ACCOUNT},k=0)=>{if(!j)throw new Error("Cannot get user wallet with empty root sk");const a=u.Hasher.SHA3.hash256(o(s)),g=c(a).slice(0,16),P=g.slice(0,8),r=g.slice(8,16),n=parseInt(+`0x${P}`,10)&2147483647,l=parseInt(+`0x${r}`,10)&2147483647,d=c(C(j)?j:h(j)),m=t.fromMasterSeed(We.from(d,"hex")),I=`m/44'/260'/${n}'/${l}'/${k}`,w=m.derive(I),D=x(v),{pk:R=i.KeyType.ED25519}=D;let T;return R===i.KeyType.ED25519?T=u.Signer.Ed25519.genKeyPair("hex",w.privateKey).secretKey:T=h(w.privateKey),R===i.KeyType.ETHEREUM&&(T=T.slice(0,66)),f(T,D)}},Ne}var Ue,xt;function Cn(){if(xt)return Ue;xt=1;const t=Qe(),u=Tt(),f=Mr(),x=bn(),C={role:t.types.RoleType.ROLE_APPLICATION};return Ue=(o,c,i,p)=>{let s=i||C;const j=(0,f.isEthereumType)((0,f.DidType)(i));if(j?s=(0,u.WalletType)(i):s=(0,u.WalletType)(C),!(0,f.isValid)(o)){let v="";try{return j?v=o.slice(0,66):v=o,(0,u.fromSecretKey)(v,s)}catch(k){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${k.message}`)}}if(!c)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,x.fromAppDid)(o,c,s,p||0)},Ue}var le,yt;function jn(){if(yt)return le;yt=1;var t=le&&le.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};const u=t(qr),f=Qe(),x=t(Cn()),C=Wr();return le=(o,c,{returnWallet:i=!0}={})=>{if(!o||typeof o!="object"||!Array.isArray(o.environments)||!(0,u.default)(o,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:p,configs:s=[]}=o,j=[...s,...p],v=j.find(U=>U.key==="BLOCKLET_APP_DESCRIPTION"),k=j.find(U=>U.key==="BLOCKLET_PASSPORT_COLOR"),a=j.find(U=>U.key==="BLOCKLET_APP_URL"),g=j.find(U=>U.key==="BLOCKLET_APP_TENANT_MODE"),{did:P,version:r}=o.meta,n=(0,C.getDisplayName)(o),l=(0,u.default)(v,"value",o.meta.description),d=(0,u.default)(k,"value","auto"),m=(0,u.default)(a,"value",""),I=(0,u.default)(g,"value","");if(!i)return{did:P,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:"",wallet:null,permanentWallet:null,tenantMode:I};const w=j.find(U=>U.key==="BLOCKLET_APP_SK"),D=j.find(U=>U.key==="BLOCKLET_APP_CHAIN_TYPE")||j.find(U=>U.key==="BLOCKLET_WALLET_TYPE"),R=j.find(U=>U.key==="BLOCKLET_APP_PSK");let T;D&&(D.value==="ethereum"||D.value==="eth")&&(T=D.value);let O=null,F=null;if(w&&w.value)O=(0,x.default)(w.value,void 0,T),R&&R.value&&R.value!==w.value&&(F=(0,x.default)(R.value,void 0,T));else{if(!c||typeof c!="string")throw new Error("Node secret key must be a string");D?O=(0,x.default)(o.meta.did,c,T):O=(0,x.default)(o.meta.did,c)}const M=o.settings?.session?.salt||"",K=f.Hasher.SHA3.hash256(We.concat([O.secretKey,O.address,M].filter(Boolean).map(U=>We.from(U))));return{did:P,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:K,wallet:O,permanentWallet:F||O,tenantMode:I}},le}var Sn=jn();const wn=mr(Sn);var kn={};function $t({teamDid:t,roles:u=[],apps:f=[],onCancel:x,onSuccess:C,onError:h=()=>{},endpoint:o=""}){const{api:c}=H(),{t:i,locale:p}=Z(),s=je({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:f.length>0?f[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),j=async()=>{if(!s.role){s.error=i("team.member.error.passportEmpty");return}if(s.passportExpireTime&&He(s.passportExpireTime).isBefore(He())){s.error=i("team.passport.customExpireTimeIsInvalid");return}const g=s.remark.trim();s.error=null,s.loading=!0;try{let P=s.sourceAppPid??null;P===t&&(P=null);const r={teamDid:t,role:s.role,remark:g,sourceAppPid:P,passportExpireTime:s.passportExpireTime?s.passportExpireTime.toISOString():""};s.display&&(r.display={type:"url",content:s.display});const{inviteInfo:n}=await c.createMemberInvitation({input:r});s.inviteInfo=n,s.activeStep=1}catch(P){const r=J(P);s.error=r,h(P)}finally{s.loading=!1}},v=u.find(g=>g.name===s.role),a=[{body:e.jsxs(L,{sx:{display:"flex",flexDirection:"column",gap:3},children:[f.length>1?e.jsxs(_e,{fullWidth:!0,children:[e.jsx(Me,{children:i("common.sourceApp")}),e.jsx(qe,{value:s.sourceAppPid,onChange:g=>{s.error=null,s.sourceAppPid=g.target.value},fullWidth:!0,label:i("common.passport"),disabled:s.loading,children:f.map(g=>e.jsx(ye,{value:g.appPid,children:e.jsxs(L,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(L,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Or,{did:g.appPid,size:28}),g.appName]}),e.jsx(Nr,{did:g.appPid,compact:!0,responsive:!1})]})},g.appPid))})]}):null,e.jsxs(_e,{fullWidth:!0,variant:"outlined",children:[e.jsx(Me,{children:i("common.passport")}),e.jsx(qe,{"data-cy":"invite-member-select-role",value:s.role,onChange:g=>{s.error=null,s.role=g.target.value},fullWidth:!0,label:i("common.passport"),disabled:s.loading,onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),j())},children:u.filter(g=>g.name!=="owner").map(g=>e.jsx(ye,{value:g.name,"data-cy":`invite-member-select-option-${g.name}`,children:e.jsxs(L,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(G,{variant:"subtitle1",children:g.title||g.name}),e.jsx(G,{variant:"caption",sx:{opacity:.7},children:g.description})]})},g.name))})]}),v?.extra?.display==="custom"&&e.jsx(de,{label:i("common.display"),type:"url",value:s.display,onChange:g=>{s.error=null,s.display=g.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.remark,onChange:g=>{s.error=null,s.remark=g.target.value},disabled:s.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Bt,{value:s.passportExpireTime,onChange:g=>{s.error=null,s.passportExpireTime=g},showError:!1})]}),cancel:i("common.cancel"),confirm:i("team.member.inviteDialog.createInviteLink"),onCancel:x,onConfirm:j},{body:()=>{const g=be({inviteId:s.inviteInfo?.inviteId,endpoint:o});return e.jsxs("div",{children:[e.jsx(L,{sx:{fontSize:16,fontWeight:"bold"},children:i("team.member.inviteDialog.createSuccessTip",{expireDate:ue(s.inviteInfo?.expireDate,p)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:g})]})},confirm:i("common.copy"),onConfirm:()=>{const g=be({inviteId:s.inviteInfo?.inviteId,endpoint:o});if(["1","true"].includes(kn.IS_E2E)){C();return}en(g),Y.success(i("common.copied")),C()},cancel:i("common.cancel"),onCancel:x}][s.activeStep];return e.jsxs(te,{title:i("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:s.loading||!s.role,variant:"contained",autoFocus:!0,children:[s.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!s.error&&e.jsx(se,{severity:"error",sx:{mt:2},children:s.error})]})}$t.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};function zt({teamDid:t,onCancel:u,onSuccess:f,onError:x=()=>{},endpoint:C=""}){const{api:h,info:o}=H(),{api:c}=y.useContext($r),[i,p]=y.useState(!1),{t:s,locale:j}=Z(),[v,k]=y.useState(""),[a,g]=y.useState(!1),[P,r]=y.useState(0),[n,l]=y.useState(""),[d,m]=y.useState(""),I=!!$e(o,"ownerNft.did"),w=on(async()=>{if(I){const{state:M}=await h.getDelegationState();return M}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:u,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:u,children:e.jsx(se,{severity:"error",children:J(w.error)})});const D=async()=>{k(null),p(!0);try{const{inviteInfo:M}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:d.trim()}});l(M),r(O.length-1)}catch(M){const K=J(M);k(K),x(M)}finally{p(!1)}},R=()=>{g(!0),r(1)},T=()=>{g(!1),r(0)},O=[{body:e.jsxs(G,{component:"div",children:[e.jsxs(se,{severity:"warning",children:[e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.progress")}),e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(se,{severity:"warning",children:e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:s("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:d,onChange:M=>{k(null),m(M.target.value)},disabled:i,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:s("common.cancel"),confirm:s("team.transferNode.inviteDialog.createInviteLink"),onCancel:u,onConfirm:I&&!$e(w,"value.delegated")?R:D},{body:()=>e.jsx(zr,{action:"delegate-transfer-nft",open:a,locale:j,checkFn:c.get,onClose:T,onSuccess:D,checkTimeout:5*60*1e3,webWalletUrl:Hr(o),extraParams:{targetDID:o.did},messages:{title:s("team.transferNode.delegateDialog.title"),scan:s("team.transferNode.delegateDialog.scan"),confirm:s("team.transferNode.delegateDialog.confirm"),success:s("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const M=be({inviteId:n.inviteId,endpoint:C});return e.jsxs("div",{children:[e.jsx(Pn,{children:s("team.transferNode.inviteDialog.createSuccessTip",{expireDate:ue(n.expireDate,j)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:M})]})},confirm:s("common.confirm"),onConfirm:f}],F=O[P];return e.jsxs(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[F.cancel&&e.jsx(W,{onClick:F.onCancel,color:"inherit",children:F.cancel}),e.jsxs(W,{onClick:F.onConfirm,color:"primary",disabled:i,variant:"contained",autoFocus:!0,children:[i&&e.jsx(ie,{size:16}),F.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof F.body=="function"?F.body():F.body}),!!v&&e.jsx(se,{severity:"error",children:v})]})}zt.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};const Pn=$.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
`;function Ke({passport:t,onDelete:u=null,...f}){return e.jsxs(In,{...f,children:[t.title||t.name," ",!!u&&e.jsx(pr,{"data-cy":"delete-issuance",className:"delete",onClick:u})]})}Ke.propTypes={passport:b.object.isRequired,onDelete:b.func};const In=$.span`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,W as u,a6 as z,T as j,at as Ne,D as _e,cG as J,ao as V,cH as We,ak as S,b1 as G,a$ as Ge,s as xe,cI as be,cw as Ke,am as ge,cs as Fe,M as F,aO as Y,bW as Ye,aP as $,Q as $e,bh as qe,aR as He,cJ as Qe,cK as Xe,cL as Je,cM as Ve,c1 as he}from"./vendor-mui-core-B7zoO8f5.js";import{k as Ze,j as ke,a as ue}from"./vendor-hooks-BRXKH6Nb.js";import{r as h,u as et}from"./vendor-react-Dvs43sk9.js";import{a8 as O,Z as N,ao as D,X as M,aM as tt,aN as st,aD as nt,c as I,v as ot}from"./index-
|
|
1
|
+
import{j as e,W as u,a6 as z,T as j,at as Ne,D as _e,cG as J,ao as V,cH as We,ak as S,b1 as G,a$ as Ge,s as xe,cI as be,cw as Ke,am as ge,cs as Fe,M as F,aO as Y,bW as Ye,aP as $,Q as $e,bh as qe,aR as He,cJ as Qe,cK as Xe,cL as Je,cM as Ve,c1 as he}from"./vendor-mui-core-B7zoO8f5.js";import{k as Ze,j as ke,a as ue}from"./vendor-hooks-BRXKH6Nb.js";import{r as h,u as et}from"./vendor-react-Dvs43sk9.js";import{a8 as O,Z as N,ao as D,X as M,aM as tt,aN as st,aD as nt,c as I,v as ot}from"./index-DNoNJJuw.js";import{H as B,T as E,G as at,ak as q,ab as rt,ac as it,D as le,L as ct}from"./vendor-ux-CwCI0CzW.js";import{u as lt}from"./use-mobile-C_DcJ5SZ.js";import{a as H,d as je,a1 as dt,c as pt,D as Ce,C as me}from"./vendor-utils-DtY42AM-.js";import{o as we}from"./vendor-arcblock-BOtVH-Qa.js";import{b as ut,u as mt,D as ft,c as de,a as xt}from"./index-CruC5qk4.js";import"./index-CA6SmdD7.js";import"./index-BojVbZw0.js";import"./api-IUmhrtIY.js";import{u as Be,C as gt,D as ht,a as St}from"./connect-to-DgCDbehT.js";import{b as yt,c as bt,d as kt,i as jt,e as fe,f as Ct,h as wt,j as Bt}from"./spaces-ucK1WAQv.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-QxHfLMG_.js";import{E as Et}from"./index-DT3k66ox.js";import{x as Tt}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-DM7RwZvc.js";import{S as It}from"./switch-control-DxmUKBCX.js";import{C as Rt,u as Pt}from"./config-space-Dji2nQRV.js";import{L as ye}from"./list-header-BQx81X9X.js";import"./lottie-web-4koyQiv_.js";import"./index-DRivg_5Z.js";async function vt({blockletDid:t,nodeApi:o,spaceGateways:a}){let s=!1;const i=await Promise.all(a.map(async n=>{let{name:r}=n;const l=await yt(n.endpoint);return!H(l)&&l!==r&&(r=l,s=!0),{...n,name:r}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function At({refresh:t}={}){const{blocklet:o}=O(),a=o?.meta?.did,{api:s}=N();return Ze(async()=>{if(!a)return[];const{spaceGateways:i}=await s.getBlockletSpaceGateways({input:{did:a}});return await vt({blockletDid:a,nodeApi:s,spaceGateways:i})??[]},{refreshDeps:[a,t],onError(i){i?.message?.includes("not logged")?console.warn(i):(console.error(i),B.error(Q(i)))}})}function De({deps:t,setLoading:o,backupDate:a}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=O(),[i,n]=h.useState([]),{api:r}=N(),[l,d]=h.useMemo(()=>a?[D(a).startOf("day").toISOString(),D(a).endOf("day").toISOString()]:[D().startOf("year").toISOString(),D().endOf("day").toISOString()],[a]),c=je(async()=>{try{if(o(!0),!s){n([]);return}const{backups:m}=await r.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:d}});n(m??[])}catch(m){console.error(m),B.error(Q(m))}finally{o(!1)}},1e3);return ke(async()=>{c()},[s?.meta?.did].concat(t)),{backups:i}}function zt({appDid:t}){const{backups:o}=De(),[a,s]=h.useState({message:"",progress:0,completed:!1}),i=N(),{ws:{useSubscription:n}}=i;return n(M.BlockletEvents.backupProgress,r=>{t===r?.appDid&&s(()=>({...r}))},[t]),h.useEffect(()=>{if(o?.length&&dt(o[0]?.status)){const[r]=o;s(()=>({message:r.message,progress:r.progress,completed:r.progress>=100}))}},[o]),a}function Ot({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:a}=O(),[s,i]=h.useState([]),{api:n}=N(),r=h.useCallback(je(async()=>{if(!n||!a?.meta?.did){i([]);return}try{o(!0);const l=D(),d=l.subtract(1,"year"),{summary:c}=await n.getBlockletBackupSummary({input:{did:a.meta.did,startTime:d.toISOString(),endTime:l.toISOString()}});i(Array.isArray(c)?c:[])}catch(l){console.error("Failed to fetch backup summary:",l),B.error(Q(l)),i([])}finally{o(!1)}},1e3),[]);return ke(async()=>(await r(),()=>{r.cancel()}),[a?.meta?.did].concat(t)),{backupSummary:s}}const Ee=h.createContext({}),{Provider:Lt,Consumer:ys}=Ee;function Te({children:t}){const{t:o}=E(),{api:a}=N(),{blocklet:s}=O(),[i,n]=h.useState(null),[r,l]=h.useState(!1),{data:d,loading:c,mutate:m}=At({refresh:r}),g=pt(d),f=zt({appDid:s?.appDid}),p=h.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(!1),{backups:Z}=De({deps:[y,i],setLoading:w,backupDate:i}),[ee,te]=h.useState(!1),{backupSummary:se}=Ot({deps:[ee]}),[_,U]=h.useState(d?.find(x=>x.endpoint===p)),T=s?.settings?.autoBackup,P=()=>{l(x=>!x)},ne=()=>{te(x=>!x)},oe=()=>{b(x=>!x)},K=async x=>{await a.updateAutoBackup({input:{did:s.meta.did,autoBackup:x}})},X=async()=>{await a.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(x,A)=>{try{m(R=>{const v=[...R];return v.push({...x,loading:!0}),v}),await a.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:x}}),p!==A&&await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:A}]}}),U(x),P(),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"}))}catch(R){throw console.error(R),m(v=>[...v].filter(W=>W.did!==x.did)),R}},re=async x=>{x&&(x.endpoint===p&&(await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),T?.enabled&&await K({enabled:!1})),await a.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:x?.did}}),m(A=>{const R=[...A];return R.splice(R.indexOf(x),1),R}),U(x),P())},ie=async x=>{await Promise.all([a.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:x.did},spaceGateway:x}}),p!==x.endpoint&&a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:x.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"})),P()},C=x=>x?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:X,backupEndpoint:p,backupProgress:f,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:n,backupsLoading:k,autoBackup:T},children:t})}Te.propTypes={children:u.any.isRequired};function L(){return h.useContext(Ee)}function Ie({...t}){const{blocklet:o}=O(),{info:a}=N(),{t:s}=E(),i=Be({blocklet:o}),n=tt(a),{spaceGateways:r,addSpaceGateway:l}=L(),d={checkFn:Ce.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:n,extraParams:{appPid:o.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:a.did}},c=async({endpoint:g,name:f,did:p})=>{const k=await kt(g);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(r.some(b=>b.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:f}));return}await l({name:f,did:p,url:k,endpoint:g},g)},m=async({spaceGateway:g})=>{try{await c(g)}catch(f){console.error(f),B.error(Q(f))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:m})}function Re({...t}){const{t:o}=h.useContext(at),{blocklet:a,loadingDiskInfo:s,actions:i}=O();if(h.useEffect(()=>{i?.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),a.diskInfo){const n=(d,c,m)=>e.jsxs(j,{children:[d," ",e.jsx("strong",{children:c?nt(c):"empty"})]}),r=a.environments.reduce((d,c)=>(d[c.key]=c.value,d),{}),l=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:n(r.BLOCKLET_APP_DIR,a.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:n(r.BLOCKLET_DATA_DIR,a.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:n(r.BLOCKLET_LOG_DIR,a.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:n(r.BLOCKLET_CACHE_DIR,a.diskInfo.cache)}];return e.jsx(Ut,{component:"div",...t,children:l.map(d=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Ut=Ne(j)``;function Pe(){const{t}=E(),{setBackupDate:o,backupSummary:a}=L(),s=mt({key:"lg"}),i=h.useRef(null),n=_e(),r=h.useCallback(c=>{o(c)},[o]),l=h.useMemo(()=>{const c=D().add(1,"day"),m=D().subtract(11,"month").startOf("month"),g=new Map(a.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),f=[];for(let p=m.clone();D(p).isBefore(c);p=p.add(1,"day")){const k=p.format("YYYY-MM-DD");f.push(g.get(k)||{date:k,successCount:0,errorCount:0})}return f},[a]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=l[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
|
|
2
2
|
`)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:V[300]},{min:3,max:6,color:V[400]},{min:6,max:9,color:V[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:V[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[D().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),D().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:We[200],color:"inherit"}}}}),[l,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:i,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(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&r(c.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(G,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"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 Mt=xe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({status:t,message:o="",createdAt:a}){const{t:s}=E(),i=t===I.BACKUPS.STATUS.PROGRESS&&D().diff(a,"hours")>=I.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),r=t===I.BACKUPS.STATUS.PROGRESS&&!i,l=t===I.BACKUPS.STATUS.SUCCEEDED&&!i;return r?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):l?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||n,children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ve.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function Ae({metadata:t={}}){const{t:o}=E();if(H(t))return e.jsx(q,{type:"success",children:o("common.succeeded")});const a=t.count||0,s=t.size||0,i=Tt(s,{iec:!0}),n=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",a]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",i]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:o("common.succeeded")}),e.jsx(Mt,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Ke,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ae.propTypes={metadata:u.object};function ze(){const{t,locale:o}=E(),{spaceGateways:a,backups:s,backupsLoading:i}=L(),n=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{const{targetUrl:d,targetName:c,status:m,createdAt:g}=s[l],f=m===I.BACKUPS.STATUS.PROGRESS&&D().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,p=m===I.BACKUPS.STATUS.SUCCEEDED&&!f,k=c||a.find(w=>d?.includes(fe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ge,{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:l=>{const d=t(l===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>D(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>H(l)?"":D(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const d=s?.[l]??{},{status:c,message:m,createdAt:g,metadata:f}=d,p=c===I.BACKUPS.STATUS.PROGRESS&&D().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,k=c===I.BACKUPS.STATUS.PROGRESS&&!p,w=c===I.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ae,{metadata:f}):e.jsx(ve,{status:c,message:m,createdAt:g})}}}],[s,a,t]),r=h.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:r?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(rt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Nt(){const{t}=E();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(ft,{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(Ie,{})]}),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(Pe,{})]})]}),e.jsx(ze,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Re,{})]})}function Oe({spaceGateway:t,onConfirm:o=()=>{},onCancel:a=()=>{}}){const{t:s}=E(),[i,n]=h.useState(!1),[r,l]=h.useState(!1),d=(g,f)=>{g?.preventDefault(),g?.stopPropagation(),n(f)},c=async g=>{try{g?.stopPropagation(),l(!0),await o?.(t),n(!1)}catch(f){console.error(f),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(f)}`)}finally{n(!1),l(!1)}},m=g=>{d(g,!1),a?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:r}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:r}},onConfirm:c,onCancel:m,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Oe.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Le({spaceGateway:t,selected:o,onDelete:a=()=>{},onConnect:s=()=>{},enableSwitchToSpace:i=!0,backupInProgress:n=!1,...r}){const{abortBlockletBackup:l}=L(),[d,c]=h.useState(null),{t:m}=E(),[g,f]=h.useState(!1),p=(y,b)=>{y.stopPropagation(),y.preventDefault(),c(b&&y.currentTarget)},k=async y=>{try{f(!0),p(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{f(!1)}},w=async y=>{try{f(!0),p(y,!1),await l()}catch(b){console.error(b),B.error(b.message)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx($e,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>p(y,!0),...r,children:e.jsx(qe,{})}),e.jsxs(He,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>p(y,!1),children:[e.jsxs(F,{onClick:y=>{p(y,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Qe,{fontSize:"small"})}),e.jsx($,{children:m("common.open")})]}),e.jsxs(F,{onClick:y=>{p(y,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.strategy.viewBackupFiles")})]}),!o&&i&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Oe,{spaceGateway:t,onConfirm:async()=>{c(null),await a?.(t)},onCancel:()=>c(null)})]})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const _t=xe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ue({spaceGateway:t,spaceStatus:o,selected:a,onConnected:s=()=>{},onDeleted:i=()=>{},onBackedUp:n=()=>{}}){const{t:r,locale:l}=E(),{blocklet:d}=O(),{api:c,info:{did:m}}=N(),{appDid:g,appName:f,appDescription:p,scopes:k,appUrl:w,referrer:y}=Be({blocklet:d}),{backupProgress:b,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=L(),[_,U]=h.useState(!1),[T,P]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:r("storage.spaces.authorize.title",{appName:f},l),scan:r("storage.spaces.authorize.scan",{appName:f},l),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:r("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=a&&!_&&o===de.DISCONNECTED,oe=a&&!_&&!t.loading&&o===de.CONNECTED,K=a&&_&&o===de.CONNECTED&&b?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await c.configBlocklet({input:{did:[d.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(r("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ce.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:f,appDescription:p,scopes:k,appUrl:w,referrer:y,nodeDid:m,spaceDid:t.did}}))},ae=async(C,x)=>{const A=x(C.endpoint),R=fe(A),v=C.space?x(C.space):{};if(t.did&&R!==t.did){P(Me=>({...Me,open:!1}));const W=r("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:v.name??"DID Space",did:v.did??fe(A),endpoint:A};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;U(!0),await c.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),n?.(C,t)}finally{U(!0)}},ie=async()=>{try{await ee(t),B.success(r("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i?.(null,t)}catch(C){console.error(C),i?.(C,t)}};return h.useEffect(()=>{b?.completed?(a&&(b?.progress===100?(B.success(r("storage.spaces.backupSuccessfully")),n?.(null,t)):b.message&&n?.(new Error(b?.message),t),b.progress=0,b.message=""),U(!1),setTimeout(()=>{te(),se()},1e3)):b.progress&&U(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:r("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:r("storage.spaces.disconnected.reconnectNow")}),K&&e.jsx(_t,{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(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:T.prefix,open:T.open,popup:!0,action:T.action,baseUrl:T.baseUrl,checkFn:T.checkFn,onSuccess:ae,onClose:T.onClose,checkTimeout:T.checkTimeout,extraParams:T.extraParams,messages:T.messages,locale:l},"get-endpoint")]}),e.jsx(Le,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:a,onDelete:ie,onConnect:X,enableSwitchToSpace:b?.completed||H(b?.message),backupInProgress:K})]})}Ue.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Wt({...t}){const{t:o}=E();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:o("storage.spaces.backup.records")})}),e.jsx(Pe,{}),e.jsx(ze,{})]})}function Gt({...t}){const{t:o}=E(),{autoBackup:a,updateAutoBackup:s}=L(),i=async()=>{try{const n=!a?.enabled;await s({enabled:n}),B.success(o(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(It,{checked:!!a?.enabled,onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Kt(){const{t}=E(),{spaceGateways:o,spaceGatewaysLoading:a,spaceGatewayIsSelected:s}=L(),i=a&&!o?.length,n=({spaceGateway:r,spaceStatus:l,selected:d,refresh:c})=>e.jsx(Ue,{spaceGateway:r,spaceStatus:l,selected:d,onConnected:()=>c(),onBackedUp:m=>m&&c()});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(Gt,{}),e.jsx(Ie,{})]}),e.jsx(S,{sx:{mt:2},children:i?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(r=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(xt,{endpoint:r.endpoint,selected:s(r),action:n},r.endpoint)},r.endpoint))})})}),e.jsx(Wt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Re,{})]})}function Ft(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=L();return t?e.jsx(we,{relative:"parent",children:e.jsx(z,{})}):H(o)?e.jsx(Nt,{}):e.jsx(Kt,{})}function Yt(){return e.jsx(Te,{children:e.jsx(Ft,{})})}function $t(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:a,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Pt(),r=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(we,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(ht,{}),e.jsx(S,{sx:r,children:e.jsx(St,{onConnect:a,storageEndpoint:n})})]})}function qt(){const{t}=E();return e.jsxs(Rt,{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($t,{})]})}function Ht({navOrientation:t="vertical",...o}){const{t:a,locale:s}=E(),{blocklet:i}=O(),n=lt({key:"md"}),[r,l]=et(),d=r.get("tab")||"backup",c=n?"horizontal":t,m=ue(()=>{const w=[{label:a("common.backup"),value:"backup"}],y=i?.capabilities?.didSpace;return(y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:a("common.storage"),value:"storage"}),w},[s,c]),f=ue(()=>({backup:e.jsx(Yt,{}),storage:e.jsx(qt,{})}))[d],p=w=>{l(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(m.length<=1)return e.jsx(pe,{children:f});const k=e.jsx(ct,{tabs:m,current:d,orientation:c,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(S,{...o,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:f})})]})});if(c==="horizontal")return e.jsxs(S,{...o,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:f})]})}Ht.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=xe(S)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|