@abtnode/blocklet-services 1.16.43-beta-20250510-123357-65a2988c → 1.16.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/assets/add-component-core-DRAzXCeg.js +1 -1
  2. package/dist/assets/add-resource-BDJuVU8K.js +1 -1
  3. package/dist/assets/advanced-CFME3Vrl.js +1 -1
  4. package/dist/assets/audit-logs-CtFZQHby.js +1 -1
  5. package/dist/assets/branding-CS-f1gMT.js +1 -1
  6. package/dist/assets/complete-BRApuFsV.js +1 -1
  7. package/dist/assets/component-C7g4FGFm.js +1 -1
  8. package/dist/assets/config-navigation-B7r4dV5S.js +1 -1
  9. package/dist/assets/connect-B2HOOYzS.js +1 -1
  10. package/dist/assets/dashboard-C124DXmc.js +2 -2
  11. package/dist/assets/email-Bc5KLu5Q.js +1 -1
  12. package/dist/assets/exchange-passport-DbNEDTaa.js +1 -1
  13. package/dist/assets/index--HbH1n1_.js +1 -1
  14. package/dist/assets/index-9ixwCOkw.js +1 -1
  15. package/dist/assets/index-B_fwtN9z.js +1 -1
  16. package/dist/assets/index-CyUXddLG.js +1 -1
  17. package/dist/assets/index-D64RNKdt.js +1 -1
  18. package/dist/assets/index-DF3gHUuW.js +1 -1
  19. package/dist/assets/index-DsT9i24r.js +1 -1
  20. package/dist/assets/index-g0L_1foA.js +1 -1
  21. package/dist/assets/index-u-w3iMC9.js +1 -1
  22. package/dist/assets/invite-CCCSmPiy.js +1 -1
  23. package/dist/assets/issue-passport-C3zUptls.js +1 -1
  24. package/dist/assets/item-CkcpHBHM.js +1 -1
  25. package/dist/assets/list-D1dIr8Je.js +1 -1
  26. package/dist/assets/login-BKaJnfFX.js +1 -1
  27. package/dist/assets/lost-passport-Bk0k4I4s.js +1 -1
  28. package/dist/assets/open-window-DV0D-Mov.js +1 -1
  29. package/dist/assets/overview-UIMGVO1S.js +1 -1
  30. package/dist/assets/publish-resource-CcM3RwPR.js +1 -1
  31. package/dist/assets/runtime-BVDdcpyT.js +1 -1
  32. package/dist/assets/security-BQbSLSOe.js +1 -1
  33. package/dist/assets/setup-CifjXQIf.js +2 -2
  34. package/dist/assets/start-CHmWCQE9.js +1 -1
  35. package/package.json +21 -21
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/log-DNpJdgp3.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-react-DEoibe3W.js","assets/useLocalStorage-C6U1Aqya.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-u-w3iMC9.js","assets/vendor-arcblock-CN2B_oTr.js","assets/index-DOq-_YXu.css","assets/Download-DKQGRFHf.js","assets/bundle-avatar-Db5l8MQ4.js","assets/log-D33dFtt_.css","assets/index-CyUXddLG.js","assets/ViewList-B4hmqizo.js","assets/index-Ce2NSVmU.js","assets/Phone-CoX1qzAs.js","assets/Location-C__VfR4D.js","assets/Email-DOy8vL0N.js","assets/Timezone-CCdgxxpv.js","assets/index-CHDiquXf.js","assets/did-address-BKBBjFqv.js","assets/permission-BkNXA8B5.js","assets/session-6XaVDQaE.js","assets/click-to-copy-BxhgzyYL.js","assets/index-BmWVfEGP.js","assets/vendor-mui-x-whuSO90H.js","assets/AdapterDayjs-BiPHzcUP.js","assets/format-error-BrmqJs5a.js","assets/useAsync-DV3NyLhI.js","assets/index-C0SLCehH.js","assets/DeleteOutline-B6efX_Fy.js","assets/confirm-BvUfAlkx.js","assets/util-Bg0WSJ-t.js","assets/base32-BbrXtXL6.js","assets/sdk-7yPC_DtN.js","assets/actions-BCWb2ez1.js","assets/MoreHoriz-BxJelL2A.js","assets/shorten-label-Dq7bVuNa.js","assets/PlayArrow-C9IFmc-j.js","assets/get-safe-url-CEvgWyL5.js","assets/use-blocklet-logo-sEJnYyNL.js","assets/InfoOutlined-Dy7jTc7H.js","assets/collapse-Bn_BDlF9.js","assets/dot-C05enzim.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-Bh8CHBbH.js","assets/index-DsT9i24r.js","assets/ExpandLess-CJXkgMMr.js","assets/index-DF3gHUuW.js","assets/Error-wpqrAfUT.js","assets/empty-spinner-BZlBh4vA.js","assets/list-header-CU9W30JD.js","assets/QuestionMarkCircle-DCM9zW3a.js","assets/index-DVQCgvFb.js","assets/index-DjLLC6N3.js","assets/api-BjteVZFg.js","assets/ChevronRight-BfbPIE2b.js","assets/react-beautiful-dnd.esm-Cq_dOQ2z.js","assets/raf-schd.esm-B3j6BePR.js","assets/item-CkcpHBHM.js","assets/Launch-DBKe0gh0.js","assets/Done-Ct5slWpT.js","assets/delete-confirm-BBaXcAXg.js","assets/ArrowDropDown-Dghek9CI.js","assets/index-CKheO_aT.js","assets/index-C0Iiqot3.css","assets/index-BMD-pSqT.js","assets/overview-UIMGVO1S.js","assets/keyboard-arrow-down-rounded-DadBVmpO.js","assets/status-46dMQnxA.js","assets/omit-D2k92RIF.js","assets/spaces-Cp7TgoZP.js","assets/domains-BxkmGeZE.js","assets/domain-action-card-D-WETV-f.js","assets/util-RWes6RwK.js","assets/CheckCircle-Dvhgeo9j.js","assets/index-g0L_1foA.js","assets/passport-item-BxfGrDcE.js","assets/Google-BbAgcDQ_.js","assets/cloneDeep-UpFQ2VNg.js","assets/EditIcon-CwTCQzs9.js","assets/LockIcon-DIGiHKHl.js","assets/appearance-BqJwEmtt.js","assets/audit-logs-CtFZQHby.js","assets/relative-time-Cl7lOTkO.js","assets/index-9ixwCOkw.js","assets/list-TP-VNuzL.js","assets/traffic-CY9Vj6w7.js","assets/iframe-CIVgAJuH.js","assets/LaunchOutlined-BIq6YUU8.js","assets/ChevronLeft-DE33N57i.js","assets/index-wXCx8TFU.js","assets/config-navigation-B7r4dV5S.js","assets/index-Bs1kxR8_.js","assets/slicedToArray-vWe02CJE.js","assets/simple-select-C-wGUGQR.js","assets/index--HbH1n1_.js","assets/use-mobile-BAjFH6d8.js","assets/connect-to-BBtnljQ-.js","assets/config-space-CSKkMgqX.js","assets/index-ftkgQlGr.js","assets/switch-control-D6CqAlDY.js","assets/index-B_fwtN9z.js","assets/security-BQbSLSOe.js","assets/config-qG8JCIJ_.js","assets/branding-CS-f1gMT.js","assets/logo-uploader-BYnd80uu.js","assets/advanced-CFME3Vrl.js","assets/runtime-BVDdcpyT.js","assets/index-D64RNKdt.js","assets/Edit-BLsIdIOp.js","assets/list-D1dIr8Je.js","assets/component-C7g4FGFm.js","assets/TuneOutlined-CB7t_nGq.js","assets/add-component-core-DRAzXCeg.js","assets/launch-result-message-BaU6oEsi.js","assets/page-header-CpNMTtn_.js","assets/index-D09AfnR1.js","assets/content-layout-DzqMXifY.js","assets/add-component-core-D-IRi6XF.css","assets/index-CUfP1M2j.js"])))=>i.map(i=>d[i]);
2
- import{c as ge,u as nr,p as Is,h as st,f as rr,g as Es,i as bt,j as Rs,E as ks,k as Ps,H as Ls,_ as $,R as Ds}from"./vendor-arcblock-CN2B_oTr.js";import{H as b,j as s,a9 as X,ah as G,I as ft,aq as As,ak as sr,X as Wt,q as Os,b5 as $s,ab as de,b6 as Ms,bx as Ns,T as V,bv as zs,bt as $e,bw as Dn,aa as C,bJ as Us,v as oe,a6 as pt,bK as Bs,e as ce,ae as Hs,bf as Fs,ap as Kt,bL as or,ad as Ie,bM as qs,ar as Vs,ai as Ws,al as ot,O as W,bu as Rt,bp as Q,bN as ir,bO as ar,bP as cr,E as xe,b4 as lr,y as Ks,bh as Gs}from"./vendor-mui-core-UZpb7wT7.js";import{r as y,L as ur,f as dr,g as Qs,u as Js,l as Zs}from"./vendor-react-DEoibe3W.js";import{r as Y,b4 as Xs,b2 as mt,b5 as Ys,B as be,j as z,a3 as An,_ as N,u as J,ao as eo,m as fr,k as to,d as no,h as ro,aJ as so,Y as Gt,b6 as oo,a6 as pr,b7 as io,as as mr,b8 as ao,I as co,C as it,b9 as lo,ba as uo,a0 as fo,am as po}from"./vendor-ux-did-connect-TEE6cGq6.js";import{z as Re,f as K,A as jt,B as mo,b as ho,C as Qt,D as go,E as hr,F as q,G as gr,t as Te,H as xr,I as xo,n as ke,J as vo,K as yo,u as bo,j as On,g as jo,L as $n,h as wo,l as wt,k as So,m as Co,M as _o,O as To,Q as Xe,e as Ke,R as Io,T as Eo,U as Ro,N as ko,V as Po,c as Mn}from"./index-u-w3iMC9.js";import{af as Lo,A as ve,ag as Do,z as Jt,b as Ye,J as vr,ah as Ao}from"./vendor-utils-rHXShPKm.js";import{_ as Nn}from"./useLocalStorage-C6U1Aqya.js";import{C as zn}from"./confirm-BvUfAlkx.js";import{d as Oo}from"./PlayArrow-C9IFmc-j.js";import{g as Un}from"./get-safe-url-CEvgWyL5.js";import{f as Zt}from"./format-error-BrmqJs5a.js";import{u as yr}from"./session-6XaVDQaE.js";import{f as je,a as br,u as B,w as $o}from"./vendor-hooks-rDgu5KV9.js";import{i as Mo,u as No,M as zo,c as Me,s as at,H as Uo,a as kt,p as jr,b as Bo}from"./use-blocklet-logo-sEJnYyNL.js";import{d as Ho}from"./InfoOutlined-Dy7jTc7H.js";import{A as Fo,a as qo,d as Vo,b as Wo}from"./collapse-Bn_BDlF9.js";import{_ as wr,D as Ko}from"./dot-C05enzim.js";import{_ as Sr}from"./useSetState-CWq0AVWn.js";import{u as Cr}from"./use-mobile-Bh8CHBbH.js";const _r=y.createContext({});function Xt({children:e,type:t}){const[n,r]=y.useState([]),o=y.useRef([]),i=c=>{if(!o.current.includes(c)){const u=[...o.current,c];r(u),o.current=u}},a=c=>{if(o.current.includes(c)){const u=o.current.filter(d=>d!==c);r(u),o.current=u}},l=c=>{const u=n.filter(p=>c.find(f=>f===p));Lo(u,n).forEach(p=>a(p))};return s.jsx(_r.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:i,removeDeletingDid:a,matchDeletingDid:l},children:e})}Xt.propTypes={type:b.string,children:b.node.isRequired};Xt.defaultProps={type:"blocklets"};function Wl(){return y.useContext(_r)}var Yt={},Go=X;Object.defineProperty(Yt,"__esModule",{value:!0});var Tr=Yt.default=void 0,Qo=Go(Y()),Jo=s;Tr=Yt.default=(0,Qo.default)((0,Jo.jsx)("path",{d:"M6 6h12v12H6z"}),"Stop");var en={},Zo=X;Object.defineProperty(en,"__esModule",{value:!0});var Ir=en.default=void 0,Xo=Zo(Y()),Yo=s;Ir=en.default=(0,Xo.default)((0,Yo.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var tn={},ei=X;Object.defineProperty(tn,"__esModule",{value:!0});var Er=tn.default=void 0,ti=ei(Y()),ni=s;Er=tn.default=(0,ti.default)((0,ni.jsx)("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"}),"Autorenew");var nn={},ri=X;Object.defineProperty(nn,"__esModule",{value:!0});var rn=nn.default=void 0,si=ri(Y()),oi=s;rn=nn.default=(0,si.default)((0,oi.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var sn={},ii=X;Object.defineProperty(sn,"__esModule",{value:!0});var Rr=sn.default=void 0,ai=ii(Y()),ci=s;Rr=sn.default=(0,ai.default)((0,ci.jsx)("path",{d:"M18 17H6v-2h12zm0-4H6v-2h12zm0-4H6V7h12zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2z"}),"Receipt");var on={},li=X;Object.defineProperty(on,"__esModule",{value:!0});var kr=on.default=void 0,ui=li(Y()),di=s;kr=on.default=(0,ui.default)((0,di.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group");var an={},fi=X;Object.defineProperty(an,"__esModule",{value:!0});var Pr=an.default=void 0,pi=fi(Y()),mi=s;Pr=an.default=(0,pi.default)((0,mi.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"NotInterested");var cn=function(e){return s.jsx("svg",{...e,children:s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})})};cn.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};cn.displayName="dashboard";var ln={},hi=X;Object.defineProperty(ln,"__esModule",{value:!0});var Lr=ln.default=void 0,gi=hi(Y()),xi=s;Lr=ln.default=(0,gi.default)((0,xi.jsx)("path",{d:"m18.25 7.6-5.5-3.18c-.46-.27-1.04-.27-1.5 0L5.75 7.6c-.46.27-.75.76-.75 1.3v6.35c0 .54.29 1.03.75 1.3l5.5 3.18c.46.27 1.04.27 1.5 0l5.5-3.18c.46-.27.75-.76.75-1.3V8.9c0-.54-.29-1.03-.75-1.3M7 14.96v-4.62l4 2.32v4.61zm5-4.03L8 8.61l4-2.31 4 2.31zm1 6.34v-4.61l4-2.32v4.62zM7 2H3.5C2.67 2 2 2.67 2 3.5V7h2V4h3zm10 0h3.5c.83 0 1.5.67 1.5 1.5V7h-2V4h-3zM7 22H3.5c-.83 0-1.5-.67-1.5-1.5V17h2v3h3zm10 0h3.5c.83 0 1.5-.67 1.5-1.5V17h-2v3h-3z"}),"ViewInAr");const _e={Start:Oo,Stop:Tr,Restart:Ir,Reload:Er,Remove:Xs,Config:rn,Log:Rr,Group:kr,Cancel:Pr,Dashboard:cn,Overview:Lr},vi=(e,t)=>{if(!e)return"";const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(ve(n.origin,t));return o.search=r.toString(),o.toString()},yi="internal",bi="external";function un({blocklet:e,onStart:t,onComplete:n,variant:r,hasPermission:o,getComponentUrl:i,useBlockletUrlEvaluation:a,...l}){const c=Re(),[u,d]=y.useState(null),[p,f]=y.useState(null),[h,j]=y.useState(!1),[x,k]=y.useState(null),{t:g}=y.useContext(mt),[T]=Nn("skip-blocklet-setup",!1),{loading:w,recommendedUrl:D}=a(e),[A]=Nn("blocklet-type-filter",yi),v=K.isInProgress(e.status),[E,_]=y.useState(!1);y.useEffect(()=>{var M,Z;if(!(e!=null&&e.controller))return;_(((Z=(M=e==null?void 0:e.controller)==null?void 0:M.status)==null?void 0:Z.value)===ge.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{var ee,ae,me;try{const te=await c.api.getLauncherSession({input:{launcherSessionId:(ee=e==null?void 0:e.controller)==null?void 0:ee.launcherSessionId,launcherUrl:(ae=e==null?void 0:e.controller)==null?void 0:ae.launcherUrl}});if(te!=null&&te.error){console.error("get launcher session failed",te.error);return}_([z.LAUNCH_SESSION_STATUS.overdue,z.LAUNCH_SESSION_STATUS.canceled,z.LAUNCH_SESSION_STATUS.terminated].includes((me=te==null?void 0:te.launcherSession)==null?void 0:me.status))}catch(te){console.error("call getLauncherSession error",te)}})()},[]);const{inService:P}=c,R=(S,M,Z=!1)=>async()=>{const ee=async qe=>{var We;t({action:S,blocklet:e}),j(!0),f(S);let Ve=!1;try{if(S==="remove")await M(qe);else if(S==="start"){if(!K.hasRunnableComponent(e)){N.error(g("blocklet.noComponent"));return}if(!P&&!T&&!((We=e.settings)!=null&&We.initialized)&&e.mode!==ge.BLOCKLET_MODES.DEVELOPMENT){if(!D||!An(D)){N.error(g("blocklet.gotoVisitError"));return}const se=mo(c.info),Ln=new URL(D);Ln.searchParams.set("serverUrl",se),window.open(Un(Ln.href,{allowDomains:null})),n({action:S,blocklet:e});return}const he=e.children.filter(se=>!K.isInProgress(se.status)&&se.status!=="running").map(se=>se.meta.did),Ce={did:e.meta.did,componentDids:he};await M({input:Ce})}else if(["stop","restart","reload"].includes(S)){const he=e.children.filter(se=>se.status==="running").map(se=>se.meta.did),Ce={did:e.meta.did,componentDids:he};await M({input:Ce})}else{const he={did:e.meta.did};await M({input:he})}S==="remove"?Ve=!0:await ho(1e3),S==="reload"&&N.success(g("blocklet.reloadSuccess")),k(null),n({action:S,blocklet:e})}catch(he){const Ce=`Blocklet ${S} failed: ${Zt(he)}`;throw n({action:S,blocklet:e,error:new Error(Ce)}),new Error(Ce)}finally{Ve||j(!1)}},ae=()=>{j(!1),k(null)},me=K.getDisplayName(e,!0),te=e.mode===ge.BLOCKLET_MODES.DEVELOPMENT?{description:()=>s.jsx(V,{component:"div",children:s.jsx(V,{gutterBottom:!0,children:g("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(qe,Ve)=>s.jsxs(V,{component:"div",children:[s.jsx(V,{gutterBottom:!0,children:g("blocklet.action.removeApplicationDescription")}),s.jsxs(zs,{name:"removeType",value:qe.removeType,onChange:We=>Ve({...qe,removeType:We.target.value}),children:[s.jsx($e,{value:"backup",control:s.jsx(Dn,{}),label:g("blocklet.action.removeApplicationAfterBackup")}),s.jsx($e,{value:"complete",control:s.jsx(Dn,{}),label:g("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},Ts={stop:{title:`${g("common.stop")} ${me}`,description:g("blocklet.action.stopDescription"),confirm:g("blocklet.action.confirmStop"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae},restart:{title:`${g("common.restart")} ${me}`,description:g("blocklet.action.restartDescription"),confirm:g("blocklet.action.confirmRestart"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae},remove:{title:`${g("common.remove")} ${me}`,confirm:g("blocklet.action.confirmRemove"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae,...te},cancelDownload:{title:`${g("common.cancel")}`,description:g("blocklet.action.cancelDownloadDescription",{name:me}),confirm:g("common.confirm"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae}};Z?k(Ts[S]):await ee()},L=!!u,m=S=>{try{S.stopPropagation(),S.preventDefault()}catch{}d(S.currentTarget)},I=S=>{try{S.stopPropagation(),S.preventDefault()}catch{}d(null)},F=async(S,M)=>{try{M.stopPropagation(),M.preventDefault()}catch{}if(typeof S.handler=="function")try{j(!0),f(S.action),await S.handler()}catch(Z){console.error(`Blocklet ${S.name} failed: `,Z)}finally{j(!1),d(null)}else d(null)},re=!P&&K.isDeletableBlocklet(e)?{action:"remove",icon:_e.Remove,name:g("common.remove"),handler:R("remove",async({removeType:S})=>{S==="backup"&&await c.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await c.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:v}:null,pe={action:"remove",icon:({sx:S,...M})=>s.jsx(_e.Cancel,{sx:{...S,paddingRight:"2px",zoom:.95},...M}),name:g("common.cancel"),handler:R("cancelDownload",c.api.cancelDownloadBlocklet,!0)},le=K.getAppMissingConfigs(e),yt=()=>{var ee;const S=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),M=i==null?void 0:i({mountPoint:S,blocklet:e});if(!M||!An(M)){N.error(g("blocklet.gotoVisitError"));return}const Z=(ee=e==null?void 0:e.site)==null?void 0:ee.domainAliases;window.open(Un(vi(M,".well-known/service/admin"),{allowDomains:Z==null?void 0:Z.map(ae=>ae.value)}))};let Fe=[{action:"start",icon:_e.Start,inExternal:!0,name:g("common.start"),handler:R("start",c.api.startBlocklet),disabled:E||e.children.every(S=>S.status==="running")||jt(e.status)||w||v},{action:"stop",icon:_e.Stop,inExternal:!0,name:g("common.stop"),handler:R("stop",c.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:_e.Restart,name:g("common.restart"),handler:R("restart",c.api.restartBlocklet,!0),disabled:E||e.status!=="running"},jt(e.status)?pe:re,{separator:!0},P?null:{action:"dashboard",icon:({style:S,...M})=>s.jsx(_e.Dashboard,{...M,style:{...S,width:"26px",height:"26px",paddingRight:"3px"}}),name:g("sidebar.dashboard"),handler:yt}].filter(Boolean);return A===bi&&(Fe=Fe.filter(S=>S.inExternal)),r==="menu"?s.jsxs(Bn,{"data-cy":"blocklet-actions",children:[s.jsx(ft,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:m,size:"small",disabled:!o||!jt(e.status)&&h,children:s.jsx(Ys,{})}),s.jsxs(As,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:L,onClose:I,PaperProps:{},children:[le.length>0&&s.jsxs(sr,{style:{maxWidth:"400px"},severity:"error",children:[g("blocklet.config.missingRequired"),s.jsx("br",{}),s.jsx(ur,{to:`/blocklets/${e.meta.did}/components`,children:g("blocklet.config.gotoFix")})]}),Fe.map((S,M)=>S.separator?s.jsx(Wt,{},`separator-${M}`):s.jsxs(Os,{dense:!0,onClick:Z=>F(S,Z),disabled:h||S.disabled,"data-cy":`${S.action}-blocklet`,children:[s.jsx($s,{style:{minWidth:24},children:p===S.action&&h?s.jsx(de,{size:16,sx:{marginRight:1}}):s.jsx(S.icon,{fontSize:"small"})}),s.jsx(Ms,{primary:S.name})]},S.name))]}),x&&s.jsx(zn,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]}):s.jsxs(Bn,{"data-cy":"blocklet-actions",...l,children:[s.jsx(Ns,{children:Fe.filter(S=>!S.separator&&!S.onlyInMenu).map(S=>s.jsxs(be,{title:S.name,"data-cy":`${S.action}-blocklet`,onClick:()=>F(S),disabled:!!S.disabled||h,children:[p===S.action&&h?s.jsx(de,{size:16,sx:{marginRight:1}}):s.jsx(S.icon,{}),s.jsx("span",{className:"blocklet-action-text",children:S.name})]},S.name))}),x&&s.jsx(zn,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}un.propTypes={getComponentUrl:b.func,blocklet:b.object.isRequired,onStart:b.func.isRequired,onComplete:b.func.isRequired,variant:b.oneOf(["menu","group"]),hasPermission:b.bool,useBlockletUrlEvaluation:b.func};un.defaultProps={getComponentUrl:null,variant:"menu",hasPermission:!1,useBlockletUrlEvaluation:()=>{var e;return{loading:!1,recommendedUrl:(e=window==null?void 0:window.location)==null?void 0:e.href}}};const Bn=G.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/log-DNpJdgp3.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-react-DEoibe3W.js","assets/useLocalStorage-C6U1Aqya.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-u-w3iMC9.js","assets/vendor-arcblock-CN2B_oTr.js","assets/index-DOq-_YXu.css","assets/Download-DKQGRFHf.js","assets/bundle-avatar-Db5l8MQ4.js","assets/log-D33dFtt_.css","assets/index-CyUXddLG.js","assets/ViewList-B4hmqizo.js","assets/index-Ce2NSVmU.js","assets/Phone-CoX1qzAs.js","assets/Location-C__VfR4D.js","assets/Email-DOy8vL0N.js","assets/Timezone-CCdgxxpv.js","assets/index-CHDiquXf.js","assets/did-address-BKBBjFqv.js","assets/permission-BkNXA8B5.js","assets/session-6XaVDQaE.js","assets/click-to-copy-BxhgzyYL.js","assets/index-BmWVfEGP.js","assets/vendor-mui-x-whuSO90H.js","assets/AdapterDayjs-BiPHzcUP.js","assets/format-error-BrmqJs5a.js","assets/useAsync-DV3NyLhI.js","assets/index-C0SLCehH.js","assets/DeleteOutline-B6efX_Fy.js","assets/confirm-BvUfAlkx.js","assets/util-Bg0WSJ-t.js","assets/base32-BbrXtXL6.js","assets/sdk-7yPC_DtN.js","assets/actions-BCWb2ez1.js","assets/MoreHoriz-BxJelL2A.js","assets/shorten-label-Dq7bVuNa.js","assets/PlayArrow-C9IFmc-j.js","assets/get-safe-url-2RcRY8gU.js","assets/use-blocklet-logo-sEJnYyNL.js","assets/InfoOutlined-Dy7jTc7H.js","assets/collapse-Bn_BDlF9.js","assets/dot-C05enzim.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-Bh8CHBbH.js","assets/index-DsT9i24r.js","assets/ExpandLess-CJXkgMMr.js","assets/index-DF3gHUuW.js","assets/Error-wpqrAfUT.js","assets/empty-spinner-BZlBh4vA.js","assets/list-header-CU9W30JD.js","assets/QuestionMarkCircle-DCM9zW3a.js","assets/index-DVQCgvFb.js","assets/index-DjLLC6N3.js","assets/api-BjteVZFg.js","assets/ChevronRight-BfbPIE2b.js","assets/react-beautiful-dnd.esm-Cq_dOQ2z.js","assets/raf-schd.esm-B3j6BePR.js","assets/item-CkcpHBHM.js","assets/Launch-DBKe0gh0.js","assets/Done-Ct5slWpT.js","assets/delete-confirm-BBaXcAXg.js","assets/ArrowDropDown-Dghek9CI.js","assets/index-CKheO_aT.js","assets/index-C0Iiqot3.css","assets/index-BMD-pSqT.js","assets/overview-UIMGVO1S.js","assets/keyboard-arrow-down-rounded-DadBVmpO.js","assets/status-46dMQnxA.js","assets/omit-D2k92RIF.js","assets/spaces-Cp7TgoZP.js","assets/domains-BxkmGeZE.js","assets/domain-action-card-D-WETV-f.js","assets/util-RWes6RwK.js","assets/CheckCircle-Dvhgeo9j.js","assets/index-g0L_1foA.js","assets/passport-item-BxfGrDcE.js","assets/Google-BbAgcDQ_.js","assets/cloneDeep-UpFQ2VNg.js","assets/EditIcon-CwTCQzs9.js","assets/LockIcon-DIGiHKHl.js","assets/appearance-BqJwEmtt.js","assets/audit-logs-CtFZQHby.js","assets/relative-time-Cl7lOTkO.js","assets/index-9ixwCOkw.js","assets/list-TP-VNuzL.js","assets/traffic-CY9Vj6w7.js","assets/iframe-CIVgAJuH.js","assets/LaunchOutlined-BIq6YUU8.js","assets/ChevronLeft-DE33N57i.js","assets/index-wXCx8TFU.js","assets/config-navigation-B7r4dV5S.js","assets/index-Bs1kxR8_.js","assets/slicedToArray-vWe02CJE.js","assets/simple-select-C-wGUGQR.js","assets/index--HbH1n1_.js","assets/use-mobile-BAjFH6d8.js","assets/connect-to-BBtnljQ-.js","assets/config-space-CSKkMgqX.js","assets/index-ftkgQlGr.js","assets/switch-control-D6CqAlDY.js","assets/index-B_fwtN9z.js","assets/security-BQbSLSOe.js","assets/config-qG8JCIJ_.js","assets/branding-CS-f1gMT.js","assets/logo-uploader-BYnd80uu.js","assets/advanced-CFME3Vrl.js","assets/runtime-BVDdcpyT.js","assets/index-D64RNKdt.js","assets/Edit-BLsIdIOp.js","assets/list-D1dIr8Je.js","assets/component-C7g4FGFm.js","assets/TuneOutlined-CB7t_nGq.js","assets/add-component-core-DRAzXCeg.js","assets/launch-result-message-BaU6oEsi.js","assets/page-header-CpNMTtn_.js","assets/index-D09AfnR1.js","assets/content-layout-DzqMXifY.js","assets/add-component-core-D-IRi6XF.css","assets/index-CUfP1M2j.js"])))=>i.map(i=>d[i]);
2
+ import{c as ge,u as nr,p as Is,h as st,f as rr,g as Es,i as bt,j as Rs,E as ks,k as Ps,H as Ls,_ as $,R as Ds}from"./vendor-arcblock-CN2B_oTr.js";import{H as b,j as s,a9 as X,ah as G,I as ft,aq as As,ak as sr,X as Wt,q as Os,b5 as $s,ab as de,b6 as Ms,bx as Ns,T as V,bv as zs,bt as $e,bw as Dn,aa as C,bJ as Us,v as oe,a6 as pt,bK as Bs,e as ce,ae as Hs,bf as Fs,ap as Kt,bL as or,ad as Ie,bM as qs,ar as Vs,ai as Ws,al as ot,O as W,bu as Rt,bp as Q,bN as ir,bO as ar,bP as cr,E as xe,b4 as lr,y as Ks,bh as Gs}from"./vendor-mui-core-UZpb7wT7.js";import{r as y,L as ur,f as dr,g as Qs,u as Js,l as Zs}from"./vendor-react-DEoibe3W.js";import{r as Y,b4 as Xs,b2 as mt,b5 as Ys,B as be,j as z,a3 as An,_ as N,u as J,ao as eo,m as fr,k as to,d as no,h as ro,aJ as so,Y as Gt,b6 as oo,a6 as pr,b7 as io,as as mr,b8 as ao,I as co,C as it,b9 as lo,ba as uo,a0 as fo,am as po}from"./vendor-ux-did-connect-TEE6cGq6.js";import{z as Re,f as K,A as jt,B as mo,b as ho,C as Qt,D as go,E as hr,F as q,G as gr,t as Te,H as xr,I as xo,n as ke,J as vo,K as yo,u as bo,j as On,g as jo,L as $n,h as wo,l as wt,k as So,m as Co,M as _o,O as To,Q as Xe,e as Ke,R as Io,T as Eo,U as Ro,N as ko,V as Po,c as Mn}from"./index-u-w3iMC9.js";import{af as Lo,A as ve,ag as Do,z as Jt,b as Ye,J as vr,ah as Ao}from"./vendor-utils-rHXShPKm.js";import{_ as Nn}from"./useLocalStorage-C6U1Aqya.js";import{C as zn}from"./confirm-BvUfAlkx.js";import{d as Oo}from"./PlayArrow-C9IFmc-j.js";import{g as Un}from"./get-safe-url-2RcRY8gU.js";import{f as Zt}from"./format-error-BrmqJs5a.js";import{u as yr}from"./session-6XaVDQaE.js";import{f as je,a as br,u as B,w as $o}from"./vendor-hooks-rDgu5KV9.js";import{i as Mo,u as No,M as zo,c as Me,s as at,H as Uo,a as kt,p as jr,b as Bo}from"./use-blocklet-logo-sEJnYyNL.js";import{d as Ho}from"./InfoOutlined-Dy7jTc7H.js";import{A as Fo,a as qo,d as Vo,b as Wo}from"./collapse-Bn_BDlF9.js";import{_ as wr,D as Ko}from"./dot-C05enzim.js";import{_ as Sr}from"./useSetState-CWq0AVWn.js";import{u as Cr}from"./use-mobile-Bh8CHBbH.js";const _r=y.createContext({});function Xt({children:e,type:t}){const[n,r]=y.useState([]),o=y.useRef([]),i=c=>{if(!o.current.includes(c)){const u=[...o.current,c];r(u),o.current=u}},a=c=>{if(o.current.includes(c)){const u=o.current.filter(d=>d!==c);r(u),o.current=u}},l=c=>{const u=n.filter(p=>c.find(f=>f===p));Lo(u,n).forEach(p=>a(p))};return s.jsx(_r.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:i,removeDeletingDid:a,matchDeletingDid:l},children:e})}Xt.propTypes={type:b.string,children:b.node.isRequired};Xt.defaultProps={type:"blocklets"};function Wl(){return y.useContext(_r)}var Yt={},Go=X;Object.defineProperty(Yt,"__esModule",{value:!0});var Tr=Yt.default=void 0,Qo=Go(Y()),Jo=s;Tr=Yt.default=(0,Qo.default)((0,Jo.jsx)("path",{d:"M6 6h12v12H6z"}),"Stop");var en={},Zo=X;Object.defineProperty(en,"__esModule",{value:!0});var Ir=en.default=void 0,Xo=Zo(Y()),Yo=s;Ir=en.default=(0,Xo.default)((0,Yo.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var tn={},ei=X;Object.defineProperty(tn,"__esModule",{value:!0});var Er=tn.default=void 0,ti=ei(Y()),ni=s;Er=tn.default=(0,ti.default)((0,ni.jsx)("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"}),"Autorenew");var nn={},ri=X;Object.defineProperty(nn,"__esModule",{value:!0});var rn=nn.default=void 0,si=ri(Y()),oi=s;rn=nn.default=(0,si.default)((0,oi.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var sn={},ii=X;Object.defineProperty(sn,"__esModule",{value:!0});var Rr=sn.default=void 0,ai=ii(Y()),ci=s;Rr=sn.default=(0,ai.default)((0,ci.jsx)("path",{d:"M18 17H6v-2h12zm0-4H6v-2h12zm0-4H6V7h12zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2z"}),"Receipt");var on={},li=X;Object.defineProperty(on,"__esModule",{value:!0});var kr=on.default=void 0,ui=li(Y()),di=s;kr=on.default=(0,ui.default)((0,di.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group");var an={},fi=X;Object.defineProperty(an,"__esModule",{value:!0});var Pr=an.default=void 0,pi=fi(Y()),mi=s;Pr=an.default=(0,pi.default)((0,mi.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"NotInterested");var cn=function(e){return s.jsx("svg",{...e,children:s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})})};cn.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};cn.displayName="dashboard";var ln={},hi=X;Object.defineProperty(ln,"__esModule",{value:!0});var Lr=ln.default=void 0,gi=hi(Y()),xi=s;Lr=ln.default=(0,gi.default)((0,xi.jsx)("path",{d:"m18.25 7.6-5.5-3.18c-.46-.27-1.04-.27-1.5 0L5.75 7.6c-.46.27-.75.76-.75 1.3v6.35c0 .54.29 1.03.75 1.3l5.5 3.18c.46.27 1.04.27 1.5 0l5.5-3.18c.46-.27.75-.76.75-1.3V8.9c0-.54-.29-1.03-.75-1.3M7 14.96v-4.62l4 2.32v4.61zm5-4.03L8 8.61l4-2.31 4 2.31zm1 6.34v-4.61l4-2.32v4.62zM7 2H3.5C2.67 2 2 2.67 2 3.5V7h2V4h3zm10 0h3.5c.83 0 1.5.67 1.5 1.5V7h-2V4h-3zM7 22H3.5c-.83 0-1.5-.67-1.5-1.5V17h2v3h3zm10 0h3.5c.83 0 1.5-.67 1.5-1.5V17h-2v3h-3z"}),"ViewInAr");const _e={Start:Oo,Stop:Tr,Restart:Ir,Reload:Er,Remove:Xs,Config:rn,Log:Rr,Group:kr,Cancel:Pr,Dashboard:cn,Overview:Lr},vi=(e,t)=>{if(!e)return"";const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(ve(n.origin,t));return o.search=r.toString(),o.toString()},yi="internal",bi="external";function un({blocklet:e,onStart:t,onComplete:n,variant:r,hasPermission:o,getComponentUrl:i,useBlockletUrlEvaluation:a,...l}){const c=Re(),[u,d]=y.useState(null),[p,f]=y.useState(null),[h,j]=y.useState(!1),[x,k]=y.useState(null),{t:g}=y.useContext(mt),[T]=Nn("skip-blocklet-setup",!1),{loading:w,recommendedUrl:D}=a(e),[A]=Nn("blocklet-type-filter",yi),v=K.isInProgress(e.status),[E,_]=y.useState(!1);y.useEffect(()=>{var M,Z;if(!(e!=null&&e.controller))return;_(((Z=(M=e==null?void 0:e.controller)==null?void 0:M.status)==null?void 0:Z.value)===ge.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{var ee,ae,me;try{const te=await c.api.getLauncherSession({input:{launcherSessionId:(ee=e==null?void 0:e.controller)==null?void 0:ee.launcherSessionId,launcherUrl:(ae=e==null?void 0:e.controller)==null?void 0:ae.launcherUrl}});if(te!=null&&te.error){console.error("get launcher session failed",te.error);return}_([z.LAUNCH_SESSION_STATUS.overdue,z.LAUNCH_SESSION_STATUS.canceled,z.LAUNCH_SESSION_STATUS.terminated].includes((me=te==null?void 0:te.launcherSession)==null?void 0:me.status))}catch(te){console.error("call getLauncherSession error",te)}})()},[]);const{inService:P}=c,R=(S,M,Z=!1)=>async()=>{const ee=async qe=>{var We;t({action:S,blocklet:e}),j(!0),f(S);let Ve=!1;try{if(S==="remove")await M(qe);else if(S==="start"){if(!K.hasRunnableComponent(e)){N.error(g("blocklet.noComponent"));return}if(!P&&!T&&!((We=e.settings)!=null&&We.initialized)&&e.mode!==ge.BLOCKLET_MODES.DEVELOPMENT){if(!D||!An(D)){N.error(g("blocklet.gotoVisitError"));return}const se=mo(c.info),Ln=new URL(D);Ln.searchParams.set("serverUrl",se),window.open(Un(Ln.href,{allowDomains:null})),n({action:S,blocklet:e});return}const he=e.children.filter(se=>!K.isInProgress(se.status)&&se.status!=="running").map(se=>se.meta.did),Ce={did:e.meta.did,componentDids:he};await M({input:Ce})}else if(["stop","restart","reload"].includes(S)){const he=e.children.filter(se=>se.status==="running").map(se=>se.meta.did),Ce={did:e.meta.did,componentDids:he};await M({input:Ce})}else{const he={did:e.meta.did};await M({input:he})}S==="remove"?Ve=!0:await ho(1e3),S==="reload"&&N.success(g("blocklet.reloadSuccess")),k(null),n({action:S,blocklet:e})}catch(he){const Ce=`Blocklet ${S} failed: ${Zt(he)}`;throw n({action:S,blocklet:e,error:new Error(Ce)}),new Error(Ce)}finally{Ve||j(!1)}},ae=()=>{j(!1),k(null)},me=K.getDisplayName(e,!0),te=e.mode===ge.BLOCKLET_MODES.DEVELOPMENT?{description:()=>s.jsx(V,{component:"div",children:s.jsx(V,{gutterBottom:!0,children:g("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(qe,Ve)=>s.jsxs(V,{component:"div",children:[s.jsx(V,{gutterBottom:!0,children:g("blocklet.action.removeApplicationDescription")}),s.jsxs(zs,{name:"removeType",value:qe.removeType,onChange:We=>Ve({...qe,removeType:We.target.value}),children:[s.jsx($e,{value:"backup",control:s.jsx(Dn,{}),label:g("blocklet.action.removeApplicationAfterBackup")}),s.jsx($e,{value:"complete",control:s.jsx(Dn,{}),label:g("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},Ts={stop:{title:`${g("common.stop")} ${me}`,description:g("blocklet.action.stopDescription"),confirm:g("blocklet.action.confirmStop"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae},restart:{title:`${g("common.restart")} ${me}`,description:g("blocklet.action.restartDescription"),confirm:g("blocklet.action.confirmRestart"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae},remove:{title:`${g("common.remove")} ${me}`,confirm:g("blocklet.action.confirmRemove"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae,...te},cancelDownload:{title:`${g("common.cancel")}`,description:g("blocklet.action.cancelDownloadDescription",{name:me}),confirm:g("common.confirm"),cancel:g("common.cancel"),onConfirm:ee,onCancel:ae}};Z?k(Ts[S]):await ee()},L=!!u,m=S=>{try{S.stopPropagation(),S.preventDefault()}catch{}d(S.currentTarget)},I=S=>{try{S.stopPropagation(),S.preventDefault()}catch{}d(null)},F=async(S,M)=>{try{M.stopPropagation(),M.preventDefault()}catch{}if(typeof S.handler=="function")try{j(!0),f(S.action),await S.handler()}catch(Z){console.error(`Blocklet ${S.name} failed: `,Z)}finally{j(!1),d(null)}else d(null)},re=!P&&K.isDeletableBlocklet(e)?{action:"remove",icon:_e.Remove,name:g("common.remove"),handler:R("remove",async({removeType:S})=>{S==="backup"&&await c.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await c.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:v}:null,pe={action:"remove",icon:({sx:S,...M})=>s.jsx(_e.Cancel,{sx:{...S,paddingRight:"2px",zoom:.95},...M}),name:g("common.cancel"),handler:R("cancelDownload",c.api.cancelDownloadBlocklet,!0)},le=K.getAppMissingConfigs(e),yt=()=>{var ee;const S=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),M=i==null?void 0:i({mountPoint:S,blocklet:e});if(!M||!An(M)){N.error(g("blocklet.gotoVisitError"));return}const Z=(ee=e==null?void 0:e.site)==null?void 0:ee.domainAliases;window.open(Un(vi(M,".well-known/service/admin"),{allowDomains:Z==null?void 0:Z.map(ae=>ae.value)}))};let Fe=[{action:"start",icon:_e.Start,inExternal:!0,name:g("common.start"),handler:R("start",c.api.startBlocklet),disabled:E||e.children.every(S=>S.status==="running")||jt(e.status)||w||v},{action:"stop",icon:_e.Stop,inExternal:!0,name:g("common.stop"),handler:R("stop",c.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:_e.Restart,name:g("common.restart"),handler:R("restart",c.api.restartBlocklet,!0),disabled:E||e.status!=="running"},jt(e.status)?pe:re,{separator:!0},P?null:{action:"dashboard",icon:({style:S,...M})=>s.jsx(_e.Dashboard,{...M,style:{...S,width:"26px",height:"26px",paddingRight:"3px"}}),name:g("sidebar.dashboard"),handler:yt}].filter(Boolean);return A===bi&&(Fe=Fe.filter(S=>S.inExternal)),r==="menu"?s.jsxs(Bn,{"data-cy":"blocklet-actions",children:[s.jsx(ft,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:m,size:"small",disabled:!o||!jt(e.status)&&h,children:s.jsx(Ys,{})}),s.jsxs(As,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:L,onClose:I,PaperProps:{},children:[le.length>0&&s.jsxs(sr,{style:{maxWidth:"400px"},severity:"error",children:[g("blocklet.config.missingRequired"),s.jsx("br",{}),s.jsx(ur,{to:`/blocklets/${e.meta.did}/components`,children:g("blocklet.config.gotoFix")})]}),Fe.map((S,M)=>S.separator?s.jsx(Wt,{},`separator-${M}`):s.jsxs(Os,{dense:!0,onClick:Z=>F(S,Z),disabled:h||S.disabled,"data-cy":`${S.action}-blocklet`,children:[s.jsx($s,{style:{minWidth:24},children:p===S.action&&h?s.jsx(de,{size:16,sx:{marginRight:1}}):s.jsx(S.icon,{fontSize:"small"})}),s.jsx(Ms,{primary:S.name})]},S.name))]}),x&&s.jsx(zn,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]}):s.jsxs(Bn,{"data-cy":"blocklet-actions",...l,children:[s.jsx(Ns,{children:Fe.filter(S=>!S.separator&&!S.onlyInMenu).map(S=>s.jsxs(be,{title:S.name,"data-cy":`${S.action}-blocklet`,onClick:()=>F(S),disabled:!!S.disabled||h,children:[p===S.action&&h?s.jsx(de,{size:16,sx:{marginRight:1}}):s.jsx(S.icon,{}),s.jsx("span",{className:"blocklet-action-text",children:S.name})]},S.name))}),x&&s.jsx(zn,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}un.propTypes={getComponentUrl:b.func,blocklet:b.object.isRequired,onStart:b.func.isRequired,onComplete:b.func.isRequired,variant:b.oneOf(["menu","group"]),hasPermission:b.bool,useBlockletUrlEvaluation:b.func};un.defaultProps={getComponentUrl:null,variant:"menu",hasPermission:!1,useBlockletUrlEvaluation:()=>{var e;return{loading:!1,recommendedUrl:(e=window==null?void 0:window.location)==null?void 0:e.href}}};const Bn=G.div`
3
3
  display: flex;
4
4
  align-items: center;
5
5
 
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CPE8Apzb.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
2
- import{_ as b,H as ee,i as te}from"./vendor-arcblock-CN2B_oTr.js";import{a9 as se,j as e,al as g,T as j,y as T,ap as ne,aa as z,O as H,ab as ie,ah as oe}from"./vendor-mui-core-UZpb7wT7.js";import{r as o,h as re}from"./vendor-react-DEoibe3W.js";import{K as h}from"./vendor-utils-rHXShPKm.js";import{j as p,r as ae,u as ce,o as le,_ as w,Y as ue,n as de,aA as fe}from"./vendor-ux-did-connect-TEE6cGq6.js";import{L as me}from"./landing-page-q-KgqE9Q.js";import{u as pe,d as M}from"./index-u-w3iMC9.js";import{f as S}from"./format-error-BrmqJs5a.js";import{d as ge}from"./CheckCircle-Dvhgeo9j.js";import{g as D}from"./get-safe-url-2RcRY8gU.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";var N;(N=window.env)!=null&&N.groupPathPrefix;p.ROLES.ADMIN,p.ROLES.OWNER;const y=()=>{const{searchParams:u}=new URL(window.location.href);return u.get("fromWallet")==="1"};var P={},he=se;Object.defineProperty(P,"__esModule",{value:!0});var F=P.default=void 0,ye=he(ae()),xe=e;F=P.default=(0,ye.default)((0,xe.jsx)("path",{d:"M12 19c0-3.87 3.13-7 7-7 1.08 0 2.09.25 3 .68V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h8.08c-.05-.33-.08-.66-.08-1M4 6l8 5 8-5v2l-8 5-8-5zm13.34 16-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L23 16.34z"}),"MarkEmailRead");const Ee=oe.form`
2
+ import{_ as b,H as ee,i as te}from"./vendor-arcblock-CN2B_oTr.js";import{a9 as se,j as e,al as g,T as j,y as T,ap as ne,aa as z,O as H,ab as ie,ah as oe}from"./vendor-mui-core-UZpb7wT7.js";import{r as o,h as re}from"./vendor-react-DEoibe3W.js";import{K as h}from"./vendor-utils-rHXShPKm.js";import{j as p,r as ae,u as ce,o as le,_ as w,Y as ue,n as de,aA as fe}from"./vendor-ux-did-connect-TEE6cGq6.js";import{L as me}from"./landing-page-q-KgqE9Q.js";import{u as pe,d as M}from"./index-u-w3iMC9.js";import{f as S}from"./format-error-BrmqJs5a.js";import{d as ge}from"./CheckCircle-Dvhgeo9j.js";import{g as D}from"./get-safe-url-CEvgWyL5.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";var N;(N=window.env)!=null&&N.groupPathPrefix;p.ROLES.ADMIN,p.ROLES.OWNER;const y=()=>{const{searchParams:u}=new URL(window.location.href);return u.get("fromWallet")==="1"};var P={},he=se;Object.defineProperty(P,"__esModule",{value:!0});var F=P.default=void 0,ye=he(ae()),xe=e;F=P.default=(0,ye.default)((0,xe.jsx)("path",{d:"M12 19c0-3.87 3.13-7 7-7 1.08 0 2.09.25 3 .68V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h8.08c-.05-.33-.08-.66-.08-1M4 6l8 5 8-5v2l-8 5-8-5zm13.34 16-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L23 16.34z"}),"MarkEmailRead");const Ee=oe.form`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  align-items: center;
@@ -1 +1 @@
1
- import{j as e,ab as E,aa as T}from"./vendor-mui-core-UZpb7wT7.js";import{r as j,f as W}from"./vendor-react-DEoibe3W.js";import{u as k,C as L,ao as S,_ as h,j as b,b1 as I}from"./vendor-ux-did-connect-TEE6cGq6.js";import{L as R}from"./landing-page-q-KgqE9Q.js";import{w as U}from"./wrap-locale-DZ79GW_G.js";import{g as v}from"./get-safe-url-CEvgWyL5.js";import{S as N,s as _,a as B}from"./index-u-w3iMC9.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CN2B_oTr.js";function F({SessionContext:a,webWalletUrl:n,onSuccess:s}){var d,g;const{api:t,session:i}=j.useContext(a),{t:o,locale:f}=k(),u=W(),{searchParams:p}=new URL(window.location.href),l=p.get("redirect"),w=async(r,C)=>{s(r,C),await i.refresh(),h.success(o("exchangePassport.success")),setTimeout(()=>{if(l){const c=decodeURIComponent(l);c.startsWith(b.WELLKNOWN_SERVICE_PATH_PREFIX)?u(c,{replace:!0}):window.location.href=v(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=r=>{h.error(r.message)},m={},x=p.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(L,{children:e.jsx(E,{})}):e.jsx(R,{did:((d=window==null?void 0:window.blocklet)==null?void 0:d.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(S,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:n,onSuccess:w,onError:P,locale:f,messages:{title:o("exchangePassport.dialog.title"),scan:o("exchangePassport.dialog.scan"),confirm:o("exchangePassport.dialog.confirm"),success:o("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const A=U(F);function J(){const a=I(),n=(s,t)=>{s.sessionToken&&(_(t(s.sessionToken)),B(t(s.refreshToken)))};return e.jsx(A,{SessionContext:N,webWalletUrl:a,onSuccess:n})}export{J as default};
1
+ import{j as e,ab as E,aa as T}from"./vendor-mui-core-UZpb7wT7.js";import{r as j,f as W}from"./vendor-react-DEoibe3W.js";import{u as k,C as L,ao as S,_ as h,j as b,b1 as I}from"./vendor-ux-did-connect-TEE6cGq6.js";import{L as R}from"./landing-page-q-KgqE9Q.js";import{w as U}from"./wrap-locale-DZ79GW_G.js";import{g as v}from"./get-safe-url-2RcRY8gU.js";import{S as N,s as _,a as B}from"./index-u-w3iMC9.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CN2B_oTr.js";function F({SessionContext:a,webWalletUrl:n,onSuccess:s}){var d,g;const{api:t,session:i}=j.useContext(a),{t:o,locale:f}=k(),u=W(),{searchParams:p}=new URL(window.location.href),l=p.get("redirect"),w=async(r,C)=>{s(r,C),await i.refresh(),h.success(o("exchangePassport.success")),setTimeout(()=>{if(l){const c=decodeURIComponent(l);c.startsWith(b.WELLKNOWN_SERVICE_PATH_PREFIX)?u(c,{replace:!0}):window.location.href=v(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=r=>{h.error(r.message)},m={},x=p.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(L,{children:e.jsx(E,{})}):e.jsx(R,{did:((d=window==null?void 0:window.blocklet)==null?void 0:d.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(S,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:n,onSuccess:w,onError:P,locale:f,messages:{title:o("exchangePassport.dialog.title"),scan:o("exchangePassport.dialog.scan"),confirm:o("exchangePassport.dialog.confirm"),success:o("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const A=U(F);function J(){const a=I(),n=(s,t)=>{s.sessionToken&&(_(t(s.sessionToken)),B(t(s.refreshToken)))};return e.jsx(A,{SessionContext:N,webWalletUrl:a,onSuccess:n})}export{J as default};
@@ -1,4 +1,4 @@
1
- import{j as e,H as f,ah as _e,T as C,ab as w,e as $e,cF as _,ae as $,cG as et,aa as g,al as J,s as Se,ad as je,ap as tt,cH as Le,a9 as ye,q as K,b5 as V,b6 as G,y as st,aq as ot,bc as Oe}from"./vendor-mui-core-UZpb7wT7.js";import{m as nt,i as Me,f as he}from"./vendor-hooks-rDgu5KV9.js";import{r as y,h as at}from"./vendor-react-DEoibe3W.js";import{c as F,P as rt,a4 as it,Y as ct,a5 as lt,w as dt,a6 as pe,O as pt}from"./vendor-arcblock-CN2B_oTr.js";import{_ as k,u as E,b2 as ut,j as T,b8 as Y,a7 as mt,r as Ce,bs as ht,B as ue,ao as ft,C as Fe,as as gt}from"./vendor-ux-did-connect-TEE6cGq6.js";import{C as O,z,t as v,a2 as xt,ae as St,ax as jt}from"./index-u-w3iMC9.js";import{u as yt}from"./use-mobile-BAjFH6d8.js";import{b as W,d as ze,a7 as Ct,I as At,E as Pe,A as fe}from"./vendor-utils-rHXShPKm.js";import"./api-BjteVZFg.js";import{u as Ne,C as Bt,D as bt,a as kt}from"./connect-to-BBtnljQ-.js";import{b as It,c as vt,d as Et,i as Rt,e as ge,f as Tt,h as Dt,j as wt}from"./spaces-Cp7TgoZP.js";import{f as X}from"./format-error-BrmqJs5a.js";import{I as Ot}from"./index-C0SLCehH.js";import{R as Ut}from"./index-ftkgQlGr.js";import{d as Lt}from"./MoreHoriz-BxJelL2A.js";import{b as Mt}from"./dashboard-C124DXmc.js";import{d as Ft}from"./DeleteOutline-B6efX_Fy.js";import{g as Ue}from"./get-safe-url-CEvgWyL5.js";import{S as zt}from"./switch-control-D6CqAlDY.js";import{L as xe}from"./list-header-CU9W30JD.js";import{C as Pt,u as Nt}from"./config-space-CSKkMgqX.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./PlayArrow-C9IFmc-j.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";async function Jt({blockletDid:t,nodeApi:a,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async o=>{let{name:i}=o;const l=await It(o.endpoint);return!W(l)&&l!==i&&(i=l,s=!0),{...o,name:i}}));return s&&await Promise.all(r.filter(o=>o.did).map(o=>a.updateBlockletSpaceGateway({input:{did:t,where:{did:o.did},spaceGateway:{...o}}}))),r}function Qt({refresh:t}={}){var r;const{blocklet:a}=O(),n=(r=a==null?void 0:a.meta)==null?void 0:r.did,{api:s}=z();return nt(async()=>{if(!n)return[];const{spaceGateways:o}=await s.getBlockletSpaceGateways({input:{did:n}});return await Jt({blockletDid:n,nodeApi:s,spaceGateways:o})??[]},{refreshDeps:[n,t],onError(o){var i;(i=o==null?void 0:o.message)!=null&&i.includes("not logged")?console.warn(o):(console.error(o),k.error(X(o)))}})}function Je({deps:t,setLoading:a,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:s}=O(),[r,o]=y.useState([]),{api:i}=z(),[l,p]=y.useMemo(()=>n?[v(n).startOf("day").toISOString(),v(n).endOf("day").toISOString()]:[v().startOf("year").toISOString(),v().endOf("day").toISOString()],[n]),c=ze(async()=>{try{if(a(!0),!s){o([]);return}const{backups:u}=await i.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:p}});o(u??[])}catch(u){console.error(u),k.error(X(u))}finally{a(!1)}},1e3);return Me(async()=>{c()},[(x=s==null?void 0:s.meta)==null?void 0:x.did].concat(t)),{backups:r}}function Zt({appDid:t}){const{backups:a}=Je(),[n,s]=y.useState({message:"",progress:0,completed:!1}),r=z(),{ws:{useSubscription:o}}=r;return o(F.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&s(()=>({...i}))},[t]),y.useEffect(()=>{var i;if(a!=null&&a.length&&Ct((i=a[0])==null?void 0:i.status)){const[l]=a;s(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[a]),n}function Ht({deps:t=[],setLoading:a=()=>{}}={}){var l;const{blocklet:n}=O(),[s,r]=y.useState([]),{api:o}=z(),i=y.useCallback(ze(async()=>{var p;if(!o||!((p=n==null?void 0:n.meta)!=null&&p.did)){r([]);return}try{a(!0);const c=v(),x=c.subtract(1,"year"),{summary:u}=await o.getBlockletBackupSummary({input:{did:n.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});r(Array.isArray(u)?u:[])}catch(c){console.error("Failed to fetch backup summary:",c),k.error(X(c)),r([])}finally{a(!1)}},1e3),[]);return Me(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:s}}const Qe=y.createContext({}),{Provider:Kt,Consumer:Qs}=Qe;function Ae({children:t}){var Z;const{t:a}=E(),{api:n}=z(),{blocklet:s}=O(),[r,o]=y.useState(null),[i,l]=y.useState(!1),{data:p,loading:c,mutate:x}=Qt({refresh:i}),u=At(p),S=Zt({appDid:s==null?void 0:s.appDid}),m=y.useMemo(()=>vt(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[A,b]=y.useState(!1),[j,d]=y.useState(!1),{backups:te}=Je({deps:[j,r],setLoading:b,backupDate:r}),[se,oe]=y.useState(!1),{backupSummary:ne}=Ht({deps:[se]}),[P,L]=y.useState(p==null?void 0:p.find(h=>h.endpoint===m)),R=(Z=s==null?void 0:s.settings)==null?void 0:Z.autoBackup,D=()=>{l(h=>!h)},ae=()=>{oe(h=>!h)},re=()=>{d(h=>!h)},Q=async h=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:h}})},q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(h,N)=>{try{x(I=>{const M=[...I];return M.push({...h,loading:!0}),M}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:h}}),m!==N&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:F.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),L(h),D(),k.success(a("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"}))}catch(I){throw console.error(I),x(M=>[...M].filter(de=>de.did!==h.did)),I}},ce=async h=>{h&&(h.endpoint===m&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:F.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),R!=null&&R.enabled&&await Q({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:h==null?void 0:h.did}}),x(N=>{const I=[...N];return I.splice(I.indexOf(h),1),I}),L(h),D())},le=async h=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:h.did},spaceGateway:h}}),m!==h.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:F.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:h.endpoint}]}})]),k.success(a("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"})),D()},B=h=>(h==null?void 0:h.endpoint)===m;return e.jsx(Kt,{value:{spaceGateways:p||[],selectedSpaceGateway:P,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:D,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:B,updateAutoBackup:Q,abortBlockletBackup:q,backupEndpoint:m,backupProgress:S,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:o,backupsLoading:A,autoBackup:R},children:t})}Ae.propTypes={children:f.any.isRequired};Ae.defaultProps={};function U(){return y.useContext(Qe)}function ee({...t}){const{blocklet:a}=O(),{info:n}=z(),{t:s}=E(),r=Ne({blocklet:a}),o=xt(n),{spaceGateways:i,addSpaceGateway:l}=U(),p={checkFn:Pe.create({baseURL:fe(window.location.origin,St())}).get,webWalletUrl:o,extraParams:{appPid:a.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},c=async({endpoint:u,name:S,did:m})=>{const A=await Et(u);if(!await Rt(A)){k.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(d=>d.endpoint===u)){k.error(s("storage.spaces.gateway.add.duplicate",{name:S}));return}await l({name:S,did:m,url:A,endpoint:u},u)},x=async({spaceGateway:u})=>{try{await c(u)}catch(S){console.error(S),k.error(X(S))}};return e.jsx(rt,{...t,options:p,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ze({...t}){const{t:a}=y.useContext(ut),{blocklet:n,loadingDiskInfo:s,actions:r}=O();if(y.useEffect(()=>{r==null||r.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const o=(p,c,x)=>e.jsxs(C,{children:[p," ",e.jsx("strong",{children:c?jt(c):"empty"})]}),i=n.environments.reduce((p,c)=>(p[c.key]=c.value,p),{}),l=[{key:"appDir",name:a("blocklet.diskInfo.appDir"),value:o(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:a("blocklet.diskInfo.dataDir"),value:o(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:a("blocklet.diskInfo.logDir"),value:o(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:a("blocklet.diskInfo.cacheDir"),value:o(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Vt,{component:"div",...t,children:l.map(p=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:p.name,children:p.value},p.key))})}return s?e.jsx(w,{}):e.jsx(C,{children:a("blocklet.diskInfo.empty")})}const Vt=_e(C)``;function Be(){const{t}=E(),{setBackupDate:a,backupSummary:n}=U(),s=it({key:"lg"}),r=y.useRef(null),o=$e(),i=y.useCallback(c=>{a(c)},[a]),l=y.useMemo(()=>{const c=v().subtract(1,"year"),x=v().add(1,"day"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),S=[];for(let m=c.clone();v(m).isBefore(x);m=m.add(1,"day")){const A=m.format("YYYY-MM-DD");S.push(u.get(A)||{date:A,successCount:0,errorCount:0})}return S},[n]),p=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:10},tooltip:{formatter:m=>{const{date:A,successCount:b,errorCount:j}=l[m.dataIndex]||{date:m.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${A}</div>`,`<div>${t("common.succeeded")}: ${b}</div>`,`<div>${t("common.failed")}: ${j}</div>`].join(`
1
+ import{j as e,H as f,ah as _e,T as C,ab as w,e as $e,cF as _,ae as $,cG as et,aa as g,al as J,s as Se,ad as je,ap as tt,cH as Le,a9 as ye,q as K,b5 as V,b6 as G,y as st,aq as ot,bc as Oe}from"./vendor-mui-core-UZpb7wT7.js";import{m as nt,i as Me,f as he}from"./vendor-hooks-rDgu5KV9.js";import{r as y,h as at}from"./vendor-react-DEoibe3W.js";import{c as F,P as rt,a4 as it,Y as ct,a5 as lt,w as dt,a6 as pe,O as pt}from"./vendor-arcblock-CN2B_oTr.js";import{_ as k,u as E,b2 as ut,j as T,b8 as Y,a7 as mt,r as Ce,bs as ht,B as ue,ao as ft,C as Fe,as as gt}from"./vendor-ux-did-connect-TEE6cGq6.js";import{C as O,z,t as v,a2 as xt,ae as St,ax as jt}from"./index-u-w3iMC9.js";import{u as yt}from"./use-mobile-BAjFH6d8.js";import{b as W,d as ze,a7 as Ct,I as At,E as Pe,A as fe}from"./vendor-utils-rHXShPKm.js";import"./api-BjteVZFg.js";import{u as Ne,C as Bt,D as bt,a as kt}from"./connect-to-BBtnljQ-.js";import{b as It,c as vt,d as Et,i as Rt,e as ge,f as Tt,h as Dt,j as wt}from"./spaces-Cp7TgoZP.js";import{f as X}from"./format-error-BrmqJs5a.js";import{I as Ot}from"./index-C0SLCehH.js";import{R as Ut}from"./index-ftkgQlGr.js";import{d as Lt}from"./MoreHoriz-BxJelL2A.js";import{b as Mt}from"./dashboard-C124DXmc.js";import{d as Ft}from"./DeleteOutline-B6efX_Fy.js";import{g as Ue}from"./get-safe-url-2RcRY8gU.js";import{S as zt}from"./switch-control-D6CqAlDY.js";import{L as xe}from"./list-header-CU9W30JD.js";import{C as Pt,u as Nt}from"./config-space-CSKkMgqX.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./PlayArrow-C9IFmc-j.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";async function Jt({blockletDid:t,nodeApi:a,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async o=>{let{name:i}=o;const l=await It(o.endpoint);return!W(l)&&l!==i&&(i=l,s=!0),{...o,name:i}}));return s&&await Promise.all(r.filter(o=>o.did).map(o=>a.updateBlockletSpaceGateway({input:{did:t,where:{did:o.did},spaceGateway:{...o}}}))),r}function Qt({refresh:t}={}){var r;const{blocklet:a}=O(),n=(r=a==null?void 0:a.meta)==null?void 0:r.did,{api:s}=z();return nt(async()=>{if(!n)return[];const{spaceGateways:o}=await s.getBlockletSpaceGateways({input:{did:n}});return await Jt({blockletDid:n,nodeApi:s,spaceGateways:o})??[]},{refreshDeps:[n,t],onError(o){var i;(i=o==null?void 0:o.message)!=null&&i.includes("not logged")?console.warn(o):(console.error(o),k.error(X(o)))}})}function Je({deps:t,setLoading:a,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:s}=O(),[r,o]=y.useState([]),{api:i}=z(),[l,p]=y.useMemo(()=>n?[v(n).startOf("day").toISOString(),v(n).endOf("day").toISOString()]:[v().startOf("year").toISOString(),v().endOf("day").toISOString()],[n]),c=ze(async()=>{try{if(a(!0),!s){o([]);return}const{backups:u}=await i.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:p}});o(u??[])}catch(u){console.error(u),k.error(X(u))}finally{a(!1)}},1e3);return Me(async()=>{c()},[(x=s==null?void 0:s.meta)==null?void 0:x.did].concat(t)),{backups:r}}function Zt({appDid:t}){const{backups:a}=Je(),[n,s]=y.useState({message:"",progress:0,completed:!1}),r=z(),{ws:{useSubscription:o}}=r;return o(F.BlockletEvents.backupProgress,i=>{t===(i==null?void 0:i.appDid)&&s(()=>({...i}))},[t]),y.useEffect(()=>{var i;if(a!=null&&a.length&&Ct((i=a[0])==null?void 0:i.status)){const[l]=a;s(()=>({message:l.message,progress:l.progress,completed:l.progress>=100}))}},[a]),n}function Ht({deps:t=[],setLoading:a=()=>{}}={}){var l;const{blocklet:n}=O(),[s,r]=y.useState([]),{api:o}=z(),i=y.useCallback(ze(async()=>{var p;if(!o||!((p=n==null?void 0:n.meta)!=null&&p.did)){r([]);return}try{a(!0);const c=v(),x=c.subtract(1,"year"),{summary:u}=await o.getBlockletBackupSummary({input:{did:n.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});r(Array.isArray(u)?u:[])}catch(c){console.error("Failed to fetch backup summary:",c),k.error(X(c)),r([])}finally{a(!1)}},1e3),[]);return Me(async()=>(await i(),()=>{i.cancel()}),[(l=n==null?void 0:n.meta)==null?void 0:l.did].concat(t)),{backupSummary:s}}const Qe=y.createContext({}),{Provider:Kt,Consumer:Qs}=Qe;function Ae({children:t}){var Z;const{t:a}=E(),{api:n}=z(),{blocklet:s}=O(),[r,o]=y.useState(null),[i,l]=y.useState(!1),{data:p,loading:c,mutate:x}=Qt({refresh:i}),u=At(p),S=Zt({appDid:s==null?void 0:s.appDid}),m=y.useMemo(()=>vt(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[A,b]=y.useState(!1),[j,d]=y.useState(!1),{backups:te}=Je({deps:[j,r],setLoading:b,backupDate:r}),[se,oe]=y.useState(!1),{backupSummary:ne}=Ht({deps:[se]}),[P,L]=y.useState(p==null?void 0:p.find(h=>h.endpoint===m)),R=(Z=s==null?void 0:s.settings)==null?void 0:Z.autoBackup,D=()=>{l(h=>!h)},ae=()=>{oe(h=>!h)},re=()=>{d(h=>!h)},Q=async h=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:h}})},q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(h,N)=>{try{x(I=>{const M=[...I];return M.push({...h,loading:!0}),M}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:h}}),m!==N&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:F.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),L(h),D(),k.success(a("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"}))}catch(I){throw console.error(I),x(M=>[...M].filter(de=>de.did!==h.did)),I}},ce=async h=>{h&&(h.endpoint===m&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:F.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),R!=null&&R.enabled&&await Q({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:h==null?void 0:h.did}}),x(N=>{const I=[...N];return I.splice(I.indexOf(h),1),I}),L(h),D())},le=async h=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:h.did},spaceGateway:h}}),m!==h.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:F.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:h.endpoint}]}})]),k.success(a("storage.spaces.connectedWithName",{name:(h==null?void 0:h.name)??"DID Spaces"})),D()},B=h=>(h==null?void 0:h.endpoint)===m;return e.jsx(Kt,{value:{spaceGateways:p||[],selectedSpaceGateway:P,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:D,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:B,updateAutoBackup:Q,abortBlockletBackup:q,backupEndpoint:m,backupProgress:S,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:o,backupsLoading:A,autoBackup:R},children:t})}Ae.propTypes={children:f.any.isRequired};Ae.defaultProps={};function U(){return y.useContext(Qe)}function ee({...t}){const{blocklet:a}=O(),{info:n}=z(),{t:s}=E(),r=Ne({blocklet:a}),o=xt(n),{spaceGateways:i,addSpaceGateway:l}=U(),p={checkFn:Pe.create({baseURL:fe(window.location.origin,St())}).get,webWalletUrl:o,extraParams:{appPid:a.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},c=async({endpoint:u,name:S,did:m})=>{const A=await Et(u);if(!await Rt(A)){k.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(d=>d.endpoint===u)){k.error(s("storage.spaces.gateway.add.duplicate",{name:S}));return}await l({name:S,did:m,url:A,endpoint:u},u)},x=async({spaceGateway:u})=>{try{await c(u)}catch(S){console.error(S),k.error(X(S))}};return e.jsx(rt,{...t,options:p,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ze({...t}){const{t:a}=y.useContext(ut),{blocklet:n,loadingDiskInfo:s,actions:r}=O();if(y.useEffect(()=>{r==null||r.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const o=(p,c,x)=>e.jsxs(C,{children:[p," ",e.jsx("strong",{children:c?jt(c):"empty"})]}),i=n.environments.reduce((p,c)=>(p[c.key]=c.value,p),{}),l=[{key:"appDir",name:a("blocklet.diskInfo.appDir"),value:o(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:a("blocklet.diskInfo.dataDir"),value:o(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:a("blocklet.diskInfo.logDir"),value:o(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:a("blocklet.diskInfo.cacheDir"),value:o(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Vt,{component:"div",...t,children:l.map(p=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:p.name,children:p.value},p.key))})}return s?e.jsx(w,{}):e.jsx(C,{children:a("blocklet.diskInfo.empty")})}const Vt=_e(C)``;function Be(){const{t}=E(),{setBackupDate:a,backupSummary:n}=U(),s=it({key:"lg"}),r=y.useRef(null),o=$e(),i=y.useCallback(c=>{a(c)},[a]),l=y.useMemo(()=>{const c=v().subtract(1,"year"),x=v().add(1,"day"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),S=[];for(let m=c.clone();v(m).isBefore(x);m=m.add(1,"day")){const A=m.format("YYYY-MM-DD");S.push(u.get(A)||{date:A,successCount:0,errorCount:0})}return S},[n]),p=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:10},tooltip:{formatter:m=>{const{date:A,successCount:b,errorCount:j}=l[m.dataIndex]||{date:m.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${A}</div>`,`<div>${t("common.succeeded")}: ${b}</div>`,`<div>${t("common.failed")}: ${j}</div>`].join(`
2
2
  `)},backgroundColor:o.palette.background.paper,borderColor:o.palette.divider,textStyle:{color:o.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${o.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:_[600]},{min:-9,max:-6,color:_[500]},{min:-6,max:-3,color:_[400]},{min:-3,max:-1,color:_[300]},{min:0,max:0,color:o.palette.grey[200]},{min:1,max:3,color:$[300]},{min:3,max:6,color:$[400]},{min:6,max:9,color:$[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:$[600]}],orient:"horizontal",left:"center",bottom:10,itemWidth:12,itemHeight:12,textStyle:{color:o.palette.text.secondary,fontSize:12}},calendar:{top:30,left:42,right:5,bottom:20,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:4,borderColor:o.palette.background.default,borderRadius:0,color:o.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:12,fontSize:14,color:o.palette.text.primary,fontWeight:"400"},monthLabel:{show:!0,nameMap:"cn",align:"left",color:o.palette.text.primary,fontWeight:"400",fontSize:16,position:"start",margin:12},yearLabel:{show:!1},range:[v().subtract(1,"year").startOf("month").format("YYYY-MM-DD"),v().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(m=>[m.date,m.errorCount?-m.errorCount:m.successCount]),label:{show:!1},itemStyle:{borderWidth:1.5,borderColor:o.palette.background.default,borderRadius:5},emphasis:{itemStyle:{borderWidth:2.5,borderColor:et[200],color:"inherit"}}}}),[l,t,o]);return y.useEffect(()=>{r.current&&s&&setTimeout(()=>{r.current.scrollLeft=r.current.scrollWidth},100)},[s,l]),e.jsxs(e.Fragment,{children:[e.jsx(g,{ref:r,sx:{overflowX:s?"visible":"hidden",overflowY:"hidden"},children:e.jsx(g,{sx:{minWidth:s?"1600px":"100%",height:"240px"},children:e.jsx(Ut,{option:p,style:{height:"100%",width:"100%",padding:"8px"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&i(c.data[0])}}})})}),e.jsx(g,{display:"flex",justifyContent:"flex-end",mr:s?2:5,mb:2,mt:.5,children:e.jsxs(J,{direction:s?"column":"row",spacing:s?2:1,alignItems:"flex-end",width:"100%",justifyContent:s?"flex-start":"flex-end",children:[e.jsxs(J,{direction:"row",alignItems:"center",spacing:1,children:[e.jsxs(C,{variant:"body2",color:"text.secondary",children:[t("storage.spaces.backup.failed"),":"]}),e.jsx(g,{width:12,height:12,bgcolor:"#8B5000",borderRadius:.5}),e.jsx(g,{width:12,height:12,bgcolor:"#A36200",borderRadius:.5}),e.jsx(g,{width:12,height:12,bgcolor:"#C17700",borderRadius:.5}),e.jsx(g,{width:12,height:12,bgcolor:"#E29000",borderRadius:.5})]}),e.jsxs(J,{direction:"row",alignItems:"center",spacing:1,children:[e.jsxs(C,{variant:"body2",color:"text.secondary",children:[t("storage.spaces.backup.without"),":"]}),e.jsx(g,{width:12,height:12,bgcolor:"grey.200",borderRadius:.5,border:"1px solid",borderColor:"grey.200"})]}),e.jsxs(J,{direction:"row",alignItems:"center",spacing:1,children:[e.jsxs(C,{variant:"body2",color:"text.secondary",children:[t("storage.spaces.backup.succeeded"),":"]}),e.jsx(g,{width:12,height:12,bgcolor:"#9be9a8",borderRadius:.5}),e.jsx(g,{width:12,height:12,bgcolor:"#40c463",borderRadius:.5}),e.jsx(g,{width:12,height:12,bgcolor:"#30a14e",borderRadius:.5}),e.jsx(g,{width:12,height:12,bgcolor:"#216e39",borderRadius:.5})]})]})})]})}Be.propTypes={};const Gt=Se(({className:t,...a})=>e.jsx(je,{...a,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function be({status:t,message:a,createdAt:n}){const{t:s}=E(),r=t===T.BACKUPS.STATUS.PROGRESS&&v().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,o=r&&s("common.timeoutError"),i=t===T.BACKUPS.STATUS.PROGRESS&&!r,l=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return i?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(w,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):l?e.jsx(Y,{type:"success",children:s("common.succeeded")}):e.jsxs(g,{display:"inline-flex",alignItems:"center",children:[e.jsx(Y,{type:"error",children:s("common.failed")}),"  ",e.jsx(je,{style:{display:"flex",alignItems:"center",flexShrink:0},title:a||o,children:e.jsx(Le,{children:e.jsx(ct,{style:{width:"24px",height:"24px"},color:"error"})})})]})}be.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};be.defaultProps={message:""};function ke({metadata:t}){const{t:a}=E();if(W(t))return e.jsx(Y,{type:"success",children:a("common.succeeded")});const n=t.count||0,s=t.size||0,r=lt(s,{iec:!0}),o=e.jsxs(g,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[a("common.fileCount"),": ",n]}),e.jsxs(C,{variant:"body2",children:[a("common.fileSize"),": ",r]})]});return e.jsxs(g,{display:"inline-flex",alignItems:"center",children:[e.jsx(Y,{type:"success",children:a("common.succeeded")})," ",e.jsx(Gt,{title:o,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(Le,{children:e.jsx(dt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ke.propTypes={metadata:f.object};ke.defaultProps={metadata:{}};function Ie(){const{t,locale:a}=E(),{spaceGateways:n,backups:s,backupsLoading:r}=U(),o=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{var b;const{targetUrl:p,targetName:c,status:x,createdAt:u}=s[l],S=x===T.BACKUPS.STATUS.PROGRESS&&v().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=x===T.BACKUPS.STATUS.SUCCEEDED&&!S,A=c||((b=n.find(j=>p==null?void 0:p.includes(ge(j==null?void 0:j.endpoint))))==null?void 0:b.name)||"Unknown DID Space";return m?e.jsx(tt,{fontSize:"16px",href:p,target:"_blank",children:A}):e.jsx(C,{variant:"body1",fontSize:"16px",children:A})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:l=>{const p=t(l===0?"common.auto":"common.manual");return e.jsx(Y,{children:p})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>v(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>W(l)?"":v(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const p=(s==null?void 0:s[l])??{},{status:c,message:x,createdAt:u,metadata:S}=p,m=c===T.BACKUPS.STATUS.PROGRESS&&v().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,A=c===T.BACKUPS.STATUS.PROGRESS&&!m,b=c===T.BACKUPS.STATUS.SUCCEEDED&&!m;return A?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(w,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):b?e.jsx(ke,{metadata:S}):e.jsx(be,{status:c,message:x,createdAt:u})}}}],[s,n,t]),i=y.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:i?e.jsx(g,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(mt,{title:"",loading:r,data:s,columns:o,emptyNode:t("storage.spaces.record.emptyData",a),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Ie.propTypes={};var He=function(a){return e.jsxs("svg",{...a,children:[e.jsxs("g",{filter:"url(#a)",children:[e.jsx("path",{d:"M56.97 2a12 12 0 0 0-8.485 3.515l-40.97 40.97A12 12 0 0 0 4 54.971V240c0 6.627 5.373 12 12 12h196c6.627 0 12-5.373 12-12V14c0-6.627-5.373-12-12-12H56.97Z",fill:"#DDD"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m49.192 6.222-40.97 40.97A11 11 0 0 0 5 54.971V240c0 6.075 4.925 11 11 11h196c6.075 0 11-4.925 11-11V14c0-6.075-4.925-11-11-11H56.97a11 11 0 0 0-7.778 3.222Zm-.707-.707A12 12 0 0 1 56.971 2H212c6.627 0 12 5.373 12 12v226c0 6.627-5.373 12-12 12H16c-6.627 0-12-5.373-12-12V54.97a12 12 0 0 1 3.515-8.485l40.97-40.97Z",fill:"#000",fillOpacity:".08"}),e.jsx("mask",{id:"b",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"4",y:"2",width:"220",height:"250",children:e.jsx("path",{d:"M56.97 2a12 12 0 0 0-8.485 3.515l-40.97 40.97A12 12 0 0 0 4 54.971V240c0 6.627 5.373 12 12 12h196c6.627 0 12-5.373 12-12V14c0-6.627-5.373-12-12-12H56.97Z",fill:"#D9D9D9"})}),e.jsxs("g",{mask:"url(#b)",children:[e.jsx("path",{opacity:".5",fill:"url(#c)",d:"M4 2h220v128H4z"}),e.jsx("path",{opacity:".1",fill:"url(#d)",d:"M4 130h220v122H4z"}),e.jsx("path",{d:"M33.045 169h-3.767v-11.636h3.887c1.14 0 2.12.233 2.937.698a4.61 4.61 0 0 1 1.881 1.995c.44.863.659 1.899.659 3.108 0 1.212-.222 2.254-.665 3.125a4.668 4.668 0 0 1-1.909 2.011c-.833.466-1.84.699-3.023.699Zm-2.01-1.534h1.914c.886 0 1.623-.167 2.21-.5a3.152 3.152 0 0 0 1.318-1.46c.292-.64.438-1.421.438-2.341 0-.913-.146-1.688-.438-2.324a3.095 3.095 0 0 0-1.29-1.449c-.572-.33-1.282-.494-2.13-.494h-2.023v8.568Zm11.546-10.102V169h-1.756v-11.636h1.756ZM48.905 169h-3.767v-11.636h3.886c1.14 0 2.12.233 2.938.698a4.609 4.609 0 0 1 1.88 1.995c.44.863.66 1.899.66 3.108 0 1.212-.222 2.254-.665 3.125a4.667 4.667 0 0 1-1.91 2.011c-.833.466-1.84.699-3.022.699Zm-2.011-1.534h1.914c.887 0 1.623-.167 2.21-.5a3.151 3.151 0 0 0 1.319-1.46c.291-.64.437-1.421.437-2.341 0-.913-.146-1.688-.437-2.324a3.095 3.095 0 0 0-1.29-1.449c-.572-.33-1.282-.494-2.13-.494h-2.023v8.568Zm20.372-7.046a1.662 1.662 0 0 0-.75-1.25c-.44-.299-.993-.448-1.66-.448-.477 0-.89.075-1.238.227a1.91 1.91 0 0 0-.813.613c-.189.258-.284.552-.284.881 0 .277.065.515.194.716.132.201.304.369.516.506.216.132.447.244.694.335.246.087.483.159.71.216l1.136.295c.371.091.752.214 1.142.37.39.155.752.36 1.086.613.333.254.602.568.806.944.209.374.313.823.313 1.346 0 .659-.17 1.244-.511 1.756-.338.511-.828.915-1.472 1.21-.64.295-1.415.443-2.324.443-.871 0-1.625-.138-2.261-.415-.637-.276-1.135-.668-1.495-1.176-.36-.511-.558-1.117-.596-1.818h1.761c.034.421.17.771.41 1.051.242.277.55.483.925.62.38.132.794.198 1.245.198.496 0 .937-.077 1.324-.233.39-.159.697-.378.92-.659a1.56 1.56 0 0 0 .335-.994c0-.345-.098-.627-.295-.847a2.191 2.191 0 0 0-.79-.545 7.725 7.725 0 0 0-1.12-.381l-1.374-.375c-.932-.253-1.67-.627-2.216-1.119-.542-.492-.813-1.144-.813-1.955 0-.67.182-1.255.546-1.755.363-.5.856-.888 1.477-1.165.621-.28 1.322-.42 2.102-.42.788 0 1.483.138 2.085.414.607.277 1.084.658 1.432 1.142.349.481.53 1.034.546 1.659h-1.693Zm3.813 11.853v-12h1.66v1.415h.142c.098-.182.24-.393.426-.631.185-.239.443-.447.772-.625.33-.182.766-.273 1.307-.273.705 0 1.334.178 1.887.534.553.356.987.869 1.3 1.54.319.67.478 1.477.478 2.42 0 .944-.157 1.752-.472 2.427-.314.67-.746 1.187-1.295 1.551-.55.36-1.176.539-1.88.539-.53 0-.965-.089-1.302-.267a2.457 2.457 0 0 1-.784-.625 4.667 4.667 0 0 1-.437-.636h-.103v4.631H71.08Zm1.665-7.637c0 .614.09 1.152.267 1.614.178.462.436.824.773 1.085.337.258.75.387 1.239.387.507 0 .931-.135 1.273-.404.34-.273.598-.642.772-1.108.178-.466.267-.99.267-1.574 0-.575-.087-1.092-.261-1.551-.17-.458-.428-.82-.773-1.085-.34-.265-.767-.398-1.278-.398-.493 0-.91.127-1.25.381-.337.254-.593.608-.767 1.062-.175.455-.262.985-.262 1.591Zm10.75 4.557a3.557 3.557 0 0 1-1.5-.307 2.523 2.523 0 0 1-1.062-.903c-.258-.394-.386-.877-.386-1.449 0-.492.094-.898.283-1.216.19-.318.446-.57.768-.756a4.036 4.036 0 0 1 1.08-.42c.397-.095.802-.167 1.215-.216l1.273-.148c.325-.041.562-.108.71-.198.148-.091.222-.239.222-.444v-.039c0-.497-.14-.881-.42-1.154-.277-.273-.69-.409-1.24-.409-.572 0-1.022.127-1.352.381-.325.25-.55.528-.676.835l-1.597-.364c.19-.53.466-.958.83-1.284.368-.329.79-.568 1.267-.716.477-.151.98-.227 1.506-.227.348 0 .718.042 1.108.125.394.08.761.227 1.102.443.345.216.627.525.847.926.22.398.33.915.33 1.552V169h-1.66v-1.193h-.068c-.11.22-.275.435-.495.648-.22.212-.501.388-.846.528s-.758.21-1.239.21Zm.37-1.363c.47 0 .87-.093 1.204-.279.337-.185.593-.428.767-.727.178-.303.267-.627.267-.972v-1.125c-.06.061-.178.118-.352.171-.17.049-.365.093-.585.13-.22.034-.434.067-.642.097l-.523.068c-.33.042-.63.112-.903.21a1.553 1.553 0 0 0-.648.427c-.16.181-.239.424-.239.727 0 .42.156.738.466.954.31.212.707.319 1.188.319Zm9.876 1.346c-.845 0-1.572-.191-2.182-.574a3.796 3.796 0 0 1-1.398-1.596c-.325-.678-.488-1.455-.488-2.33 0-.886.166-1.668.5-2.346a3.832 3.832 0 0 1 1.409-1.597c.606-.383 1.32-.574 2.142-.574.663 0 1.254.123 1.773.369.519.243.937.584 1.255 1.023.322.44.514.953.574 1.54h-1.653c-.091-.409-.3-.761-.625-1.057-.322-.295-.754-.443-1.296-.443a2.11 2.11 0 0 0-1.244.375c-.352.246-.627.598-.824 1.057-.197.454-.295.992-.295 1.613 0 .637.096 1.186.29 1.648.193.462.466.82.818 1.074.356.254.774.381 1.255.381.322 0 .614-.059.875-.177.266-.121.487-.293.665-.517.182-.223.309-.492.38-.806h1.654a3.211 3.211 0 0 1-.55 1.511 3.165 3.165 0 0 1-1.234 1.045c-.511.254-1.111.381-1.8.381Zm9.163 0c-.859 0-1.6-.184-2.221-.551a3.732 3.732 0 0 1-1.432-1.563c-.333-.674-.5-1.464-.5-2.369 0-.894.167-1.682.5-2.363a3.887 3.887 0 0 1 1.409-1.597c.606-.383 1.314-.574 2.125-.574.493 0 .97.082 1.432.244.462.163.877.419 1.244.767.368.349.657.802.87 1.358.212.553.318 1.226.318 2.017v.603H99.71v-1.273h5.273c0-.447-.091-.843-.273-1.187a2.052 2.052 0 0 0-.767-.824c-.326-.201-.708-.302-1.148-.302a2.22 2.22 0 0 0-1.25.353 2.364 2.364 0 0 0-.818.909 2.626 2.626 0 0 0-.284 1.21v.994c0 .584.102 1.08.307 1.489.208.409.498.722.869.938.372.212.805.318 1.301.318a2.7 2.7 0 0 0 .881-.137c.265-.094.494-.234.688-.42.193-.186.341-.415.443-.688l1.608.29c-.129.474-.36.888-.693 1.244-.33.353-.745.627-1.245.824-.496.194-1.062.29-1.699.29Z",fill:"#fff"}),e.jsx("path",{d:"M117.604 47.263 121.523 45h14.267v41.862h-14.267l-15.335-8.854V53.854l1.818-1.05 3.2 1.848-1.818 1.05V76.16l12.993 7.502h10.209V48.2h-10.209l-1.577.91-3.2-1.847Z",fill:"url(#e)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M119.402 76.16V55.701L106.409 48.2H96.2v35.462h10.209l1.582-.913 3.2 1.847-3.924 2.266H93V45h14.267l15.335 8.854v24.154l-1.813 1.046-3.2-1.847 1.813-1.047Z",fill:"url(#f)"}),e.jsxs("g",{clipPath:"url(#g)",fillRule:"evenodd",clipRule:"evenodd",fill:"#fff",children:[e.jsx("path",{d:"m50.928 216.089 1.034 2.852h-2.503l1.028-2.842a4.95 4.95 0 0 0 .107-.338 7.17 7.17 0 0 0 .111-.409c.075.297.15.542.223.737Zm2.28 5.591h.796l-2.775-7.352h-1.043l-2.774 7.352h.795a.338.338 0 0 0 .223-.077.425.425 0 0 0 .127-.179l.615-1.705h3.07l.617 1.705a.399.399 0 0 0 .126.184.339.339 0 0 0 .223.072Zm4.823-.963a2.023 2.023 0 0 1-.67.098h-1.455v-2.453h1.456c.5 0 .871.106 1.11.318.24.208.36.495.36.86 0 .184-.028.355-.083.512a1.005 1.005 0 0 1-.262.399 1.2 1.2 0 0 1-.456.266Zm-2.125-3.128v-2.406h1.237c.498 0 .865.095 1.101.286.236.192.355.497.355.917 0 .369-.125.662-.374.881-.246.215-.623.322-1.13.322h-1.189Zm2.358-3.128a4.106 4.106 0 0 0-1.12-.133h-2.27v7.352h2.507c.391 0 .74-.051 1.048-.154.307-.102.566-.247.776-.435.21-.188.37-.409.48-.665.11-.26.165-.547.165-.861 0-.904-.506-1.462-1.518-1.674.22-.075.41-.169.572-.281a1.79 1.79 0 0 0 .403-.379c.106-.144.186-.297.237-.461.052-.164.078-.335.078-.512a2.1 2.1 0 0 0-.146-.804 1.49 1.49 0 0 0-.441-.609 2.073 2.073 0 0 0-.771-.384Zm7.535.778h-2.212v6.441h-1.028v-6.441h-2.222v-.911H65.8v.911Zm2.439.564h-1.13v1.193h1.13v-1.193Zm-1.13 2.983h1.13v1.193h-1.13v-1.193Z",fillOpacity:".8"}),e.jsx("path",{d:"M28.247 221.771V214h3.894c.99.072 1.765.944 1.765 1.998v3.77c0 1.106-.85 2.003-1.897 2.003h-3.762ZM36.355 214h-1.011v7.783h1.01V214Zm-7.097 6.704v-5.642h2.751c.49 0 .886.419.886.936v3.77c0 .517-.396.936-.886.936h-2.75ZM37.775 214v7.771h3.762c1.047 0 1.897-.897 1.897-2.003v-3.77c0-1.054-.774-1.926-1.765-1.998h-3.894Zm6.946 1.803h1.13v1.193h-1.13v-1.193Zm1.13 2.983h-1.13v1.193h1.13v-1.193Zm-7.065-3.724v5.642h2.75c.49 0 .887-.419.887-.936v-3.77c0-.517-.397-.936-.886-.936h-2.751Z"})]}),e.jsx("circle",{cx:"191.32",cy:"218",r:"10",fill:"url(#h)"}),e.jsx("path",{d:"m192.064 213.333.976-.564h3.554v10.427h-3.286a1 1 0 0 1-.5-.134l-3.588-2.071v-6.016l.453-.262.797.46-.453.262v5.096l3.237 1.868h2.543v-8.833h-2.543l-.393.227-.797-.46Z",fill:"#fff"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M192.512 220.531v-5.096l-3.237-1.869h-2.543v8.833h2.543l.394-.227.797.46-.977.564h-3.554v-10.427h3.554l3.82 2.206v6.016l-.452.261-.797-.461.452-.26Z",fill:"#fff"})]})]}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"d",x1:"114",y1:"130",x2:"114",y2:"252",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#101010"}),e.jsx("stop",{offset:"1",stopColor:"#272727"})]}),e.jsxs("linearGradient",{id:"e",x1:"120.989",y1:"45",x2:"120.989",y2:"86.862",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#fff",stopOpacity:".4"}),e.jsx("stop",{offset:"1",stopColor:"#fff"})]}),e.jsxs("linearGradient",{id:"f",x1:"107.801",y1:"45",x2:"107.801",y2:"86.862",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#fff"}),e.jsx("stop",{offset:"1",stopColor:"#fff",stopOpacity:".4"})]}),e.jsxs("radialGradient",{id:"h",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(17 -8.76924 6.97565 13.52294 183.166 221)",children:[e.jsx("stop",{stopColor:"#016BED"}),e.jsx("stop",{offset:".699",stopColor:"#4498FB"}),e.jsx("stop",{offset:"1",stopColor:"#9DFFE8"})]}),e.jsx("clipPath",{id:"g",children:e.jsx("path",{fill:"#fff",transform:"translate(28 214)",d:"M0 0h40.32v8H0z"})}),e.jsx("pattern",{id:"c",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:e.jsx("use",{xlinkHref:"#i",transform:"scale(.00455 .00781)"})}),e.jsxs("filter",{id:"a",x:"0",y:"0",width:"228",height:"258",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[e.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),e.jsx("feColorMatrix",{in:"SourceAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),e.jsx("feOffset",{dy:"2"}),e.jsx("feGaussianBlur",{stdDeviation:"2"}),e.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),e.jsx("feColorMatrix",{values:"0 0 0 0 0.0631944 0 0 0 0 0.242785 0 0 0 0 0.403472 0 0 0 0.2 0"}),e.jsx("feBlend",{in2:"BackgroundImageFix",result:"effect1_dropShadow_1410_22507"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_1410_22507",result:"shape"})]}),e.jsx("image",{id:"i",width:"220",height:"128",xlinkHref:"data:image/png;base64,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"})]})]})};He.defaultProps={width:"228",height:"258",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"};function Ke(){const{t}=E();return e.jsxs(g,{children:[e.jsxs(g,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(g,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(He,{viewBox:"0 0 228 258",style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ee,{})]}),e.jsxs(g,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(g,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(Be,{})]})]}),e.jsx(Ie,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ze,{})]})}Ke.propTypes={};var ve={},Yt=ye;Object.defineProperty(ve,"__esModule",{value:!0});var Ve=ve.default=void 0,Wt=Yt(Ce()),Xt=e;Ve=ve.default=(0,Wt.default)((0,Xt.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Ee={},qt=ye;Object.defineProperty(Ee,"__esModule",{value:!0});var Ge=Ee.default=void 0,_t=qt(Ce()),$t=e;Ge=Ee.default=(0,_t.default)((0,$t.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var Re={},es=ye;Object.defineProperty(Re,"__esModule",{value:!0});var Ye=Re.default=void 0,ts=es(Ce()),ss=e;Ye=Re.default=(0,ts.default)((0,ss.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function Te({spaceGateway:t,onConfirm:a,onCancel:n}){const{t:s}=E(),[r,o]=y.useState(!1),[i,l]=y.useState(!1),p=(u,S)=>{u==null||u.preventDefault(),u==null||u.stopPropagation(),o(S)},c=async u=>{try{u==null||u.stopPropagation(),l(!0),await(a==null?void 0:a(t)),o(!1)}catch(S){console.error(S),k.error(`${s("storage.space.gateway.delete.failed")}: ${X(S)}`)}finally{o(!1),l(!1)}},x=u=>{p(u,!1),n==null||n(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(K,{color:"red",onClick:u=>p(u,!0),children:[e.jsx(V,{style:{minWidth:24,color:"red"},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx(G,{style:{color:"red"},children:s("common.delete")})]}),e.jsx(ht,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:i}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:i}},onConfirm:c,onCancel:x,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}Te.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};Te.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function De({spaceGateway:t,selected:a,onDelete:n,onConnect:s,enableSwitchToSpace:r,backupInProgress:o,...i}){const{abortBlockletBackup:l}=U(),[p,c]=y.useState(null),{t:x}=E(),[u,S]=y.useState(!1),m=(j,d)=>{j.stopPropagation(),j.preventDefault(),c(d&&j.currentTarget)},A=async j=>{try{S(!0),m(j,!1),await s(t)}catch(d){console.error(d),k.error(d.message)}finally{S(!1)}},b=async j=>{try{S(!0),m(j,!1),await l()}catch(d){console.error(d),k.error(d.message)}finally{S(!1)}};return e.jsxs(e.Fragment,{children:[u||t!=null&&t.loading?e.jsx(w,{sx:{ml:1},size:"24px"}):e.jsx(st,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:j=>m(j,!0),...i,children:e.jsx(Lt,{})}),e.jsxs(ot,{id:"simple-menu",anchorEl:p,keepMounted:!0,open:!!p,onClose:j=>m(j,!1),children:[e.jsxs(K,{onClick:j=>{m(j,!1),window.open(Ue(t.endpoint?Tt(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx(G,{children:x("common.open")})]}),e.jsxs(K,{onClick:j=>{m(j,!1),window.open(Ue(Dt(t.endpoint),{allowDomains:null}))},children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(G,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!a&&r&&e.jsxs(K,{onClick:A,children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(Ge,{fontSize:"small"})}),e.jsx(G,{children:x("storage.spaces.connect.switchToSpace")})]}),o&&e.jsxs(K,{onClick:b,children:[e.jsx(V,{style:{minWidth:24},children:e.jsx(Mt,{fontSize:"small"})}),e.jsx(G,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!o&&e.jsx(Te,{spaceGateway:t,onConfirm:async()=>{c(null),await(n==null?void 0:n(t))},onCancel:()=>c(null)})]})]})}De.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};De.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const os=Se(({className:t,...a})=>e.jsx(je,{...a,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function we({spaceGateway:t,spaceStatus:a,selected:n,onConnected:s,onDeleted:r,onBackedUp:o}){const{t:i,locale:l}=E(),{blocklet:p}=O(),{api:c,info:{did:x}}=z(),{appDid:u,appName:S,appDescription:m,scopes:A,appUrl:b,referrer:j}=Ne({blocklet:p}),{backupProgress:d,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=U(),[P,L]=y.useState(!1),[R,D]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:i("storage.spaces.authorize.title",{appName:S},l),scan:i("storage.spaces.authorize.scan",{appName:S},l),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:i("storage.spaces.authorize.success")})},onClose:()=>{D(B=>({...B,open:!1}))}}),ae=n&&!P&&a===pe.DISCONNECTED,re=n&&!P&&!t.loading&&a===pe.CONNECTED,Q=n&&P&&a===pe.CONNECTED&&(d==null?void 0:d.progress)>=0,q=async()=>{try{if(await wt(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[p.meta.did],configs:[{key:F.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),k.success(i("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(B){console.error(B),s==null||s(B,t);return}D(B=>({...B,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Pe.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:S,appDescription:m,scopes:A,appUrl:b,referrer:j,nodeDid:x,spaceDid:t.did}}))},ie=async(B,Z)=>{const h=Z(B.endpoint),N=ge(h),I=B.space?Z(B.space):{};if(t.did&&N!==t.did){D(de=>({...de,open:!1}));const H=i("storage.spaces.gateway.switch.failedForMismatchSpace",{name:I!=null&&I.name?I.name:""});k.error(H),s==null||s(new Error(H),t);return}const M={...t,name:I.name??"DID Space",did:I.did??ge(h),endpoint:h};await te(M),D(H=>({...H,open:!1})),s==null||s(null,M)},ce=async()=>{try{if(P)return;L(!0),await c.backupBlocklet({input:{appDid:p.appDid,to:"spaces"}})}catch(B){console.error(B),k.error(B.message),o==null||o(B,t)}finally{L(!0)}},le=async()=>{try{await se(t),k.success(i("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r==null||r(null,t)}catch(B){console.error(B),r==null||r(B,t)}};return y.useEffect(()=>{d!=null&&d.completed?(n&&((d==null?void 0:d.progress)===100?(k.success(i("storage.spaces.backupSuccessfully")),o==null||o(null,t)):d.message&&(o==null||o(new Error(d==null?void 0:d.message),t)),d.progress=0,d.message=""),L(!1),setTimeout(()=>{oe(),ne()},1e3)):d.progress&&L(!0)},[d]),e.jsxs(e.Fragment,{children:[e.jsxs(g,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[re&&e.jsx(ue,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:i("storage.spaces.strategy.backupNow")}),ae&&e.jsx(ue,{className:"action-btn",variant:"outlined",size:"small",onClick:q,children:i("storage.spaces.disconnected.reconnectNow")}),Q&&e.jsx(os,{title:(d==null?void 0:d.message)&&e.jsx(g,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:d.message})}),children:e.jsxs(ue,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(w,{variant:"determinate",value:d==null?void 0:d.progress,size:14,sx:{mr:1}}),d==null?void 0:d.progress,"%"]})}),e.jsx(ft,{forceConnected:!1,saveConnect:!1,prefix:R.prefix,open:R.open,popup:!0,action:R.action,baseUrl:R.baseUrl,checkFn:R.checkFn,onSuccess:ie,onClose:R.onClose,checkTimeout:R.checkTimeout,extraParams:R.extraParams,messages:R.messages,locale:l},"get-endpoint")]}),e.jsx(De,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:q,enableSwitchToSpace:(d==null?void 0:d.completed)||W(d==null?void 0:d.message),backupInProgress:Q})]})}we.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};we.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function We({...t}){const{t:a}=E();return e.jsxs(g,{...t,children:[e.jsx(g,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:a("storage.spaces.backup.records")})}),e.jsx(Be,{}),e.jsx(Ie,{})]})}We.propTypes={};function Xe({...t}){const{t:a}=E(),{autoBackup:n,updateAutoBackup:s}=U(),r=async()=>{try{const o=!(n!=null&&n.enabled);await s({enabled:o}),k.success(a(o?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(o){k.error(o.message)}};return e.jsx(zt,{checked:!!(n!=null&&n.enabled),onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:a("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Xe.propTypes={};function ns(){const{t}=E(),{spaceGateways:a,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=U(),r=n&&!(a!=null&&a.length),o=({spaceGateway:i,spaceStatus:l,selected:p,refresh:c})=>e.jsx(we,{spaceGateway:i,spaceStatus:l,selected:p,onConnected:()=>c(),onBackedUp:x=>x&&c()});return e.jsxs(g,{display:"flex",flexDirection:"column",children:[e.jsx(xe,{sx:{button:{fontSize:"revert",fontWeight:500}},left:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Xe,{}),e.jsx(ee,{})]})}),e.jsx(g,{mt:2,children:r?e.jsx(g,{display:"flex",justifyContent:"center",children:e.jsx(w,{})}):e.jsx(Oe,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:a.map(i=>e.jsx(Oe,{item:!0,xs:12,md:6,children:e.jsx(pt,{endpoint:i.endpoint,selected:s(i),action:o},i.endpoint)}))})})}),e.jsx(We,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ze,{})]})}function as(){const{spaceGatewaysFirstLoading:t,spaceGateways:a}=U();return t?e.jsx(Fe,{relative:"parent",children:e.jsx(w,{})}):W(a)?e.jsx(Ke,{}):e.jsx(ns,{})}function rs(){return e.jsx(Ae,{children:e.jsx(as,{})})}function is(){const{spaceGateway:t,settingStorageEndpoint:a,updateSpaceGateway:n,hasStorageEndpoint:s,loading:r,storageEndpoint:o}=Nt(),i=he(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Fe,{relative:"parent",children:e.jsx(w,{})}):e.jsxs(g,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(Bt,{spaceGateway:t,settingStorageEndpoint:a}):e.jsx(bt,{}),e.jsx(g,{sx:i,children:e.jsx(kt,{onConnect:n,storageEndpoint:o})})]})}function cs(){const{t}=E();return e.jsxs(Pt,{children:[e.jsxs(J,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(is,{})]})}function qe({navOrientation:t,...a}){const{t:n,locale:s}=E(),{blocklet:r}=O(),o=yt({key:"md"}),[i,l]=at(),p=i.get("tab")||"backup",c=o?"horizontal":t,x=he(()=>{var d;const b=[{label:n("common.backup"),value:"backup"}],j=(d=r==null?void 0:r.capabilities)==null?void 0:d.didSpace;return(j===F.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||j===F.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&b.push({label:n("common.storage"),value:"storage"}),b},[s,c]),S=he(()=>({backup:e.jsx(rs,{}),storage:e.jsx(cs,{})}))[p],m=b=>{l(j=>(b==="backup"?j.delete("tab"):j.set("tab",b),j))};if(x.length<=1)return e.jsx(me,{children:S});const A=e.jsx(gt,{tabs:x,current:p,orientation:c,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(g,{...a,children:e.jsxs(J,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(g,{sx:{flexShrink:0},children:e.jsx(xe,{left:A})}),e.jsx(g,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:S})})]})});if(c==="horizontal")return e.jsxs(g,{...a,children:[e.jsx(xe,{left:A}),e.jsx(me,{sx:{mt:2},children:S})]})}qe.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};qe.defaultProps={navOrientation:"vertical"};const me=Se(g)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1,4 +1,4 @@
1
- import{r as j}from"./vendor-react-DEoibe3W.js";import{j as e,H as d,a9 as Pe,ad as jt,T as J,aa as C,E as _e,bp as Fe,bA as et,bR as Te,bt as Re,bS as Ie,y as Se,b4 as Ee,ab as tt,ah as ce,a1 as st,m as yt,bc as Xe,bs as vt,bo as St,q as Ze,c0 as Ct}from"./vendor-mui-core-UZpb7wT7.js";import{e as ie,aB as ue,C as Nt}from"./vendor-utils-rHXShPKm.js";import{_ as Z,j as P,b8 as wt,r as ke,A as Tt,u as te,bR as Rt,Z as nt,B as De,a7 as at,bo as je,am as It,as as Et,bv as Dt}from"./vendor-ux-did-connect-TEE6cGq6.js";import{z as At,t as V,l as Ot,I as Je}from"./index-u-w3iMC9.js";import{f as ee,a as Ae}from"./vendor-hooks-rDgu5KV9.js";import{S as he}from"./shorten-label-Dq7bVuNa.js";import{I as it}from"./index-C0SLCehH.js";import{A as Lt,S as Pt,a as _t,b as Ft,B as kt}from"./list-TP-VNuzL.js";import{R as Be}from"./relative-time-Cl7lOTkO.js";import{a as ze}from"./dashboard-C124DXmc.js";import{W as Bt}from"./did-address-BKBBjFqv.js";import{p as ot}from"./util-Bg0WSJ-t.js";import{D as zt,g as Wt}from"./traffic-CY9Vj6w7.js";import{i as Mt,e as qt}from"./use-blocklet-logo-sEJnYyNL.js";import{B as rt}from"./bundle-avatar-Db5l8MQ4.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CN2B_oTr.js";import"./index-DjLLC6N3.js";import"./InfoOutlined-Dy7jTc7H.js";import"./CheckCircle-Dvhgeo9j.js";import"./index-Ce2NSVmU.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-CEvgWyL5.js";import"./session-6XaVDQaE.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./base32-BbrXtXL6.js";import"./iframe-CIVgAJuH.js";import"./LaunchOutlined-BIq6YUU8.js";import"./ChevronLeft-DE33N57i.js";import"./ChevronRight-BfbPIE2b.js";import"./index-wXCx8TFU.js";import"./vendor-mui-x-whuSO90H.js";import"./AdapterDayjs-BiPHzcUP.js";const lt=j.createContext({}),{Provider:Kt,Consumer:mn}=lt;function $t({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=At(),[a,x]=j.useState([]),[u,R]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=j.useState([]),[I,M]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const _={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=_;let Q="";B&&B.includes("system")&&(Q="system");const z=B?B.filter(f=>f!=="system"):[],oe={...q,source:Q,componentDids:z},se=await n.getNotificationSendLog({input:oe});return M(oe),x(se.list),R(se.paging),se.list}catch(_){return Z.error(_.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var _;return((_=A.meta)==null?void 0:_.did)===h});if(O)return O.ancestors=[s],O},[s]),$=async({notificationId:h,receivers:O,channels:A,..._})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?P.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?P.NOTIFICATION_SEND_CHANNEL.PUSH:B),..._}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const _={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:_})}catch(_){throw Z.error(_.message),_}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(P.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(P.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const k={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:$,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(Kt,{value:{notificationRecords:k},children:t})}function We(){const{notificationRecords:t}=j.useContext(lt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(wt,{type:Ht[t],children:t})}var Me={},Ut=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var ct=Me.default=void 0,Vt=Ut(ke()),Gt=e;ct=Me.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},Yt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var dt=qe.default=void 0,Xt=Yt(ke()),Zt=e;dt=qe.default=(0,Xt.default)((0,Zt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var Ke={},Jt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Qt=Jt(ke()),es=e;ut=Ke.default=(0,Qt.default)((0,es.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const ts=(t,s,n="")=>{if(!n||!s)return"";switch(n){case P.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:Ot(o,s)}):"",R=ts(t,x,a);return r===P.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===P.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Qe=["info","success","error","warning"],ft=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},mt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},ss=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ns=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},as=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),is=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),os=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},rs=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ls=t=>{switch(t){case P.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case P.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case P.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case P.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>Tt({typography:{fontSize:14,button:{textTransform:"none"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,R=[a,u].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:R}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(J,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(a=>{const x=pt(r,o,{status:a});return e.jsx(_e,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:R=>{const m=[...t];R.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx($e,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=pt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}He.propTypes={value:d.array.isRequired,onChange:d.func};function He({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Z.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Z.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Je(t[0],n)," - ",Je(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Wt(r),onChange:R})})]})}Ue.propTypes={itemComponent:d.elementType.isRequired};function Ue({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Rt.TableFilterList,{...s,ItemComponent:t})})]})}function Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(_e,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const cs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(cs),[x,u]=j.useState(!0),R=(v,S)=>{S.checked=v.target.checked;const I=o.map(M=>({...M,checked:M.value===S.value?S.checked:M.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(J,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>R(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),r("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=We(),[v,S]=j.useState(!1),[I,M]=j.useState([]),E=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[D,G]=j.useState(null),[$,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,k]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));M(l),H(i.paging),S(!1)}catch(i){Z.error(i.message),S(!1)}};j.useEffect(()=>{_()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},q=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Q={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:$.page-1,rowsPerPage:$.pageSize,count:$.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:q},z=({page:i,rowsPerPage:l,searchText:c,filterList:y})=>{const[,F=[],U=[],K=[]]=y;N.pageSize!==l?k(W=>({...W,pageSize:l,page:1})):N.page!==i+1?k(W=>({...W,page:i+1})):N.searchText!==c?k(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue(U,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||k(W=>({...W,emailSendStatus:K,page:1})):k(W=>({...W,pushKitSendStatus:U,page:1})):k(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?as(c):i==="email"?ss(m,c):i==="pushKit"?ns(m,c):i==="webhook"?is(c):!0:!1},[R,m]),se=j.useCallback(i=>os(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Z.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),rs(l,c)>=4){Z.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Nt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],F),L.anchorEl||(await xe(.5),f()))}catch(K){Z.error(K.message)}},Y=i=>{k(l=>({...l,dateRange:i,page:1}))},X=(i,l,c,y)=>{i.stopPropagation();const F=c.filter(U=>U!==l);k(U=>({...U,[y]:F,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(Bt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,F]=c,U=F[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:y},y),e.jsx(de,{status:U.status,updatedAt:U.sendAt,reason:U.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Be,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),Ye=[e.jsx(He,{value:N.dateRange,onChange:Y},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(us,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Q,customButtons:Ye,components:{TableFilterList:i=>e.jsx(Ue,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ps,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,U;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(U=D==null?void 0:D.result)!=null&&U[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:y})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:b})})]})})})}const ds=j.memo(gt),us=ce.div`
1
+ import{r as j}from"./vendor-react-DEoibe3W.js";import{j as e,H as d,a9 as Pe,ad as jt,T as J,aa as C,E as _e,bp as Fe,bA as et,bR as Te,bt as Re,bS as Ie,y as Se,b4 as Ee,ab as tt,ah as ce,a1 as st,m as yt,bc as Xe,bs as vt,bo as St,q as Ze,c0 as Ct}from"./vendor-mui-core-UZpb7wT7.js";import{e as ie,aB as ue,C as Nt}from"./vendor-utils-rHXShPKm.js";import{_ as Z,j as P,b8 as wt,r as ke,A as Tt,u as te,bR as Rt,Z as nt,B as De,a7 as at,bo as je,am as It,as as Et,bv as Dt}from"./vendor-ux-did-connect-TEE6cGq6.js";import{z as At,t as V,l as Ot,I as Je}from"./index-u-w3iMC9.js";import{f as ee,a as Ae}from"./vendor-hooks-rDgu5KV9.js";import{S as he}from"./shorten-label-Dq7bVuNa.js";import{I as it}from"./index-C0SLCehH.js";import{A as Lt,S as Pt,a as _t,b as Ft,B as kt}from"./list-TP-VNuzL.js";import{R as Be}from"./relative-time-Cl7lOTkO.js";import{a as ze}from"./dashboard-C124DXmc.js";import{W as Bt}from"./did-address-BKBBjFqv.js";import{p as ot}from"./util-Bg0WSJ-t.js";import{D as zt,g as Wt}from"./traffic-CY9Vj6w7.js";import{i as Mt,e as qt}from"./use-blocklet-logo-sEJnYyNL.js";import{B as rt}from"./bundle-avatar-Db5l8MQ4.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CN2B_oTr.js";import"./index-DjLLC6N3.js";import"./InfoOutlined-Dy7jTc7H.js";import"./CheckCircle-Dvhgeo9j.js";import"./index-Ce2NSVmU.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./base32-BbrXtXL6.js";import"./iframe-CIVgAJuH.js";import"./LaunchOutlined-BIq6YUU8.js";import"./ChevronLeft-DE33N57i.js";import"./ChevronRight-BfbPIE2b.js";import"./index-wXCx8TFU.js";import"./vendor-mui-x-whuSO90H.js";import"./AdapterDayjs-BiPHzcUP.js";const lt=j.createContext({}),{Provider:Kt,Consumer:mn}=lt;function $t({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=At(),[a,x]=j.useState([]),[u,R]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=j.useState([]),[I,M]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const _={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=_;let Q="";B&&B.includes("system")&&(Q="system");const z=B?B.filter(f=>f!=="system"):[],oe={...q,source:Q,componentDids:z},se=await n.getNotificationSendLog({input:oe});return M(oe),x(se.list),R(se.paging),se.list}catch(_){return Z.error(_.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var _;return((_=A.meta)==null?void 0:_.did)===h});if(O)return O.ancestors=[s],O},[s]),$=async({notificationId:h,receivers:O,channels:A,..._})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?P.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?P.NOTIFICATION_SEND_CHANNEL.PUSH:B),..._}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const _={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:_})}catch(_){throw Z.error(_.message),_}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(P.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(P.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const k={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:$,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(Kt,{value:{notificationRecords:k},children:t})}function We(){const{notificationRecords:t}=j.useContext(lt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(wt,{type:Ht[t],children:t})}var Me={},Ut=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var ct=Me.default=void 0,Vt=Ut(ke()),Gt=e;ct=Me.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},Yt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var dt=qe.default=void 0,Xt=Yt(ke()),Zt=e;dt=qe.default=(0,Xt.default)((0,Zt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var Ke={},Jt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Qt=Jt(ke()),es=e;ut=Ke.default=(0,Qt.default)((0,es.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const ts=(t,s,n="")=>{if(!n||!s)return"";switch(n){case P.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:Ot(o,s)}):"",R=ts(t,x,a);return r===P.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===P.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Qe=["info","success","error","warning"],ft=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},mt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},ss=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ns=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},as=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),is=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),os=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},rs=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ls=t=>{switch(t){case P.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case P.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case P.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case P.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>Tt({typography:{fontSize:14,button:{textTransform:"none"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,R=[a,u].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:R}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(J,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(a=>{const x=pt(r,o,{status:a});return e.jsx(_e,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:R=>{const m=[...t];R.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx($e,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=pt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}He.propTypes={value:d.array.isRequired,onChange:d.func};function He({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Z.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Z.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Je(t[0],n)," - ",Je(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Wt(r),onChange:R})})]})}Ue.propTypes={itemComponent:d.elementType.isRequired};function Ue({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Rt.TableFilterList,{...s,ItemComponent:t})})]})}function Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(_e,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const cs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(cs),[x,u]=j.useState(!0),R=(v,S)=>{S.checked=v.target.checked;const I=o.map(M=>({...M,checked:M.value===S.value?S.checked:M.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(J,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>R(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),r("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=We(),[v,S]=j.useState(!1),[I,M]=j.useState([]),E=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[D,G]=j.useState(null),[$,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,k]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));M(l),H(i.paging),S(!1)}catch(i){Z.error(i.message),S(!1)}};j.useEffect(()=>{_()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},q=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Q={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:$.page-1,rowsPerPage:$.pageSize,count:$.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:q},z=({page:i,rowsPerPage:l,searchText:c,filterList:y})=>{const[,F=[],U=[],K=[]]=y;N.pageSize!==l?k(W=>({...W,pageSize:l,page:1})):N.page!==i+1?k(W=>({...W,page:i+1})):N.searchText!==c?k(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue(U,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||k(W=>({...W,emailSendStatus:K,page:1})):k(W=>({...W,pushKitSendStatus:U,page:1})):k(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?as(c):i==="email"?ss(m,c):i==="pushKit"?ns(m,c):i==="webhook"?is(c):!0:!1},[R,m]),se=j.useCallback(i=>os(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Z.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),rs(l,c)>=4){Z.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Nt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],F),L.anchorEl||(await xe(.5),f()))}catch(K){Z.error(K.message)}},Y=i=>{k(l=>({...l,dateRange:i,page:1}))},X=(i,l,c,y)=>{i.stopPropagation();const F=c.filter(U=>U!==l);k(U=>({...U,[y]:F,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(Bt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,F]=c,U=F[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:y},y),e.jsx(de,{status:U.status,updatedAt:U.sendAt,reason:U.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Be,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),Ye=[e.jsx(He,{value:N.dateRange,onChange:Y},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(us,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Q,customButtons:Ye,components:{TableFilterList:i=>e.jsx(Ue,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ps,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,U;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(U=D==null?void 0:D.result)!=null&&U[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:y})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:b})})]})})})}const ds=j.memo(gt),us=ce.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{u as ne,_ as U,c0 as Ee,c1 as ze,I as K,b_ as Ue,b$ as We,ad as Me,ac as _e,c2 as Ve,b4 as Ie,j as pe,r as $e,b2 as X,c3 as he,am as ge,B as E,bO as Ne,a6 as Je,c4 as He,a7 as Ke,a3 as Ge,a0 as Ze,as as De}from"./vendor-ux-did-connect-TEE6cGq6.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-rDgu5KV9.js";import{r as R}from"./vendor-react-DEoibe3W.js";import{j as e,aa as m,bt as W,bp as z,O,y as V,H as N,T as xe,I as ae,X as re,ah as Pe,al as H,cI as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-UZpb7wT7.js";import{a7 as tt,M as Ce,T as nt,c as st}from"./vendor-arcblock-CN2B_oTr.js";import{J as Y,a8 as ot,c as qe,D as at,n as Z,aJ as rt,A as it,b as lt}from"./vendor-utils-rHXShPKm.js";import{z as J,C as $,E as oe,F as I,aD as Fe}from"./index-u-w3iMC9.js";import{S as ie}from"./switch-control-D6CqAlDY.js";import{S as D}from"./dashboard-C124DXmc.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-C0SLCehH.js";import{b as ut}from"./base32-BbrXtXL6.js";import{u as mt}from"./use-mobile-BAjFH6d8.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-CEvgWyL5.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";const le={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...le},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async a=>{var T,o;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:a})}}),u=Object.assign({...le},((o=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:o.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.domainDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ht(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ce},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ft(){var i,a,T;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...ue},((T=(a=r==null?void 0:r.settings)==null?void 0:a.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async o=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:o})}}),A=Object.assign({...ue},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const gt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=Ee({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const a=y.index,T=s;if(a===T)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-o.top;a<T&&A<u||a>T&&A>u||(w(a,T),y.index=T)}}),[{isDragging:x},g]=ze({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:gt})}),e.jsx(xe,{sx:{flex:1},children:S}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:ct,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!1};const jt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:tt}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:Me}),component:e.jsx(xt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:_e}),component:e.jsx(ft,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ve}),component:e.jsx(pt,{})}],bt=["github","google","apple","auth0"];function vt(){var k,L;const{api:S}=J(),{blocklet:r}=$(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of bt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...jt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ue,{backend:We,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const G={ttl:pe.SESSION_TTL,cacheTtl:pe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(nt,{...S,sx:{transform:"scale(0.75)"}})}function me(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function yt(){var o,j;const{api:S}=J(),{blocklet:r}=$(),n=(o=r==null?void 0:r.meta)==null?void 0:o.did,s=ot({},G,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=G.ttl),qe(s.cacheTtl)&&(s.cacheTtl=G.cacheTtl),s.phone||(s.phone=G.phone),s.email||(s.email=G.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=oe({defaultValues:Y(me(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:a}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:at(me(u,!0),["phone"])}}),_=Object.assign({},G,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(me(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(St,{onSubmit:w(T),children:e.jsxs(H,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(H,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(H,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>b(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>a(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(H,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(H,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(z,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(Xe,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const St=Pe.form`
1
+ import{u as ne,_ as U,c0 as Ee,c1 as ze,I as K,b_ as Ue,b$ as We,ad as Me,ac as _e,c2 as Ve,b4 as Ie,j as pe,r as $e,b2 as X,c3 as he,am as ge,B as E,bO as Ne,a6 as Je,c4 as He,a7 as Ke,a3 as Ge,a0 as Ze,as as De}from"./vendor-ux-did-connect-TEE6cGq6.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-rDgu5KV9.js";import{r as R}from"./vendor-react-DEoibe3W.js";import{j as e,aa as m,bt as W,bp as z,O,y as V,H as N,T as xe,I as ae,X as re,ah as Pe,al as H,cI as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-UZpb7wT7.js";import{a7 as tt,M as Ce,T as nt,c as st}from"./vendor-arcblock-CN2B_oTr.js";import{J as Y,a8 as ot,c as qe,D as at,n as Z,aJ as rt,A as it,b as lt}from"./vendor-utils-rHXShPKm.js";import{z as J,C as $,E as oe,F as I,aD as Fe}from"./index-u-w3iMC9.js";import{S as ie}from"./switch-control-D6CqAlDY.js";import{S as D}from"./dashboard-C124DXmc.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-C0SLCehH.js";import{b as ut}from"./base32-BbrXtXL6.js";import{u as mt}from"./use-mobile-BAjFH6d8.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";const le={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...le},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async a=>{var T,o;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:a})}}),u=Object.assign({...le},((o=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:o.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.domainDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ht(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ce},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ft(){var i,a,T;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...ue},((T=(a=r==null?void 0:r.settings)==null?void 0:a.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async o=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:o})}}),A=Object.assign({...ue},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const gt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=Ee({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const a=y.index,T=s;if(a===T)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-o.top;a<T&&A<u||a>T&&A>u||(w(a,T),y.index=T)}}),[{isDragging:x},g]=ze({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:gt})}),e.jsx(xe,{sx:{flex:1},children:S}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:ct,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!1};const jt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:tt}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:Me}),component:e.jsx(xt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:_e}),component:e.jsx(ft,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ve}),component:e.jsx(pt,{})}],bt=["github","google","apple","auth0"];function vt(){var k,L;const{api:S}=J(),{blocklet:r}=$(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of bt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...jt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ue,{backend:We,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const G={ttl:pe.SESSION_TTL,cacheTtl:pe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(nt,{...S,sx:{transform:"scale(0.75)"}})}function me(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function yt(){var o,j;const{api:S}=J(),{blocklet:r}=$(),n=(o=r==null?void 0:r.meta)==null?void 0:o.did,s=ot({},G,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=G.ttl),qe(s.cacheTtl)&&(s.cacheTtl=G.cacheTtl),s.phone||(s.phone=G.phone),s.email||(s.email=G.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=oe({defaultValues:Y(me(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:a}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:at(me(u,!0),["phone"])}}),_=Object.assign({},G,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(me(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(St,{onSubmit:w(T),children:e.jsxs(H,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(H,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(H,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>b(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>a(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(H,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(H,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(z,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(Xe,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const St=Pe.form`
2
2
  max-width: 1536px;
3
3
 
4
4
  .advanced-config {