@abtnode/blocklet-services 1.16.43-beta-20250430-124448-4edc5502 → 1.16.43-beta-20250501-232525-d2306530

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/log-B4LRFTNR.js","assets/vendor-mui-core-B6POpIBB.js","assets/vendor-react-DEoibe3W.js","assets/useLocalStorage-CXDkfohf.js","assets/vendor-ux-did-connect-D4-ZeZHm.js","assets/vendor-utils-CjMBJT5V.js","assets/vendor-hooks-DXGUREV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-CksPySYI.js","assets/vendor-arcblock-Dkhgjlzn.js","assets/index-DOq-_YXu.css","assets/Download-DKz_gZX5.js","assets/bundle-avatar-BXQsJw7m.js","assets/log-D33dFtt_.css","assets/index-17ov_POl.js","assets/ViewList-Ca1IEB31.js","assets/index-C-rU1lEd.js","assets/Phone-CKzC4712.js","assets/Location-BQhEvGNL.js","assets/Email-B0n6rLUZ.js","assets/Timezone-C3hiNX6j.js","assets/did-address-C6ni99I7.js","assets/permission-PNXSTeNL.js","assets/session-DLQ0rbYE.js","assets/click-to-copy-0s0a7Ak5.js","assets/index-DdLPuFP7.js","assets/vendor-mui-x-CATHW1QL.js","assets/AdapterDayjs-BWhMsmQP.js","assets/format-error-BrmqJs5a.js","assets/useAsync-GjVghrwi.js","assets/index-D_z5kVUS.js","assets/DeleteOutline-D_I07sPe.js","assets/confirm-BqrhdaU7.js","assets/util-D-LnEy9h.js","assets/base32-C_EKY5vU.js","assets/sdk-BXECCi1q.js","assets/actions-BW0Vx00_.js","assets/MoreHoriz-DHyMdwpT.js","assets/shorten-label-SbKUBkvs.js","assets/PlayArrow-zDVVYX6u.js","assets/get-safe-url-cyoeQ7Mw.js","assets/use-blocklet-logo-BOYeM9RY.js","assets/InfoOutlined-BjII93aR.js","assets/dot-WAAJ-O65.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-BKvZ6hcv.js","assets/index-BAstW3VS.js","assets/ExpandLess-TUium4RQ.js","assets/index-DxR1P6Lh.js","assets/Error-js7ePZ5o.js","assets/empty-spinner-BYUFR95o.js","assets/list-header-8k1_C0K0.js","assets/QuestionMarkCircle-DpFFQWud.js","assets/index-DVQCgvFb.js","assets/index-DIe9psLc.js","assets/api-Bf1onQOz.js","assets/ChevronRight-BsdsjNxw.js","assets/react-beautiful-dnd.esm-C1Wt0pHO.js","assets/raf-schd.esm-B3j6BePR.js","assets/item-CCsztPdL.js","assets/Launch-ryL3I8d9.js","assets/Done-DLTvHdZB.js","assets/delete-confirm-CmXluMcs.js","assets/ArrowDropDown-DUCtp8oo.js","assets/index-CMFOn8T3.js","assets/index-C0Iiqot3.css","assets/index-Bt7GP-dU.js","assets/overview-CJRHh92f.js","assets/keyboard-arrow-down-rounded-DadBVmpO.js","assets/status-BKlS-OSq.js","assets/omit-DNeUY6_X.js","assets/spaces-CP1iyRKS.js","assets/domains-DV-Gl3-a.js","assets/domain-action-card-DIGUxqW7.js","assets/util-DJFgW-07.js","assets/CheckCircle-yKW43XdV.js","assets/index-BugTfB-J.js","assets/passport-item-jrknj0MQ.js","assets/Google-C7d25Q5r.js","assets/cloneDeep-WT_kDeVd.js","assets/EditIcon-DWRQ3fi6.js","assets/LockIcon-Bd69pSJI.js","assets/appearance-D9WrcbPF.js","assets/audit-logs-CVUuBgdy.js","assets/relative-time-cijkMMnc.js","assets/index-C8EYAWok.js","assets/list-BgP6u-5j.js","assets/traffic-BzRbyLJ-.js","assets/iframe-DZlnwo40.js","assets/LaunchOutlined-D21Xchdf.js","assets/ChevronLeft-6AvuBihM.js","assets/index-BUHlfcy3.js","assets/config-navigation-DhvlW96p.js","assets/index-DODYa3Im.js","assets/slicedToArray-C0YDCVwK.js","assets/simple-select-CLc0Q9sm.js","assets/index-CLD6I2fv.js","assets/use-mobile-BNUwcWCH.js","assets/connect-to-C1xSYa-8.js","assets/config-space-CHI2AzS5.js","assets/index--MMFwLMX.js","assets/switch-control-yJOWKqcv.js","assets/index-C0x4zVBW.js","assets/security-Y5seZEn6.js","assets/config-e3P85n7z.js","assets/branding-Cywl-fod.js","assets/logo-uploader-DMxsEq63.js","assets/advanced-mJXTlRFz.js","assets/runtime-71FSw-R0.js","assets/index-DJeuTVoT.js","assets/Edit-odNPT5GK.js","assets/component-C3maTG8x.js","assets/TuneOutlined-Bv7cSbWT.js","assets/add-component-core-DXp_ntZ3.js","assets/launch-result-message-B_fS-f90.js","assets/page-header-MKUHlyAT.js","assets/index-htPha6tP.js","assets/content-layout-C3Yd4mK9.js","assets/add-component-core-D-IRi6XF.css","assets/index-C4pzdyRW.js"])))=>i.map(i=>d[i]);
2
- import{c as me,u as er,p as Ls,h as nt,f as tr,g as nr,i as Ds,j as As,k as Os,m as Ms,l as Pn,n as $s,E as Ns,o as zs,H as Us,_ as M,R as Bs}from"./vendor-arcblock-Dkhgjlzn.js";import{H as j,j as s,a9 as Z,ah as V,I as ut,aq as Hs,ak as rr,X as Ft,q as qs,b5 as Fs,ab as le,b6 as Vs,bx as Ws,T as B,bv as Ks,bt as De,bw as kn,aa as E,bJ as Gs,v as se,a6 as dt,bK as Qs,ae as Zs,bg as Js,e as de,ap as Vt,bL as sr,ad as Ae,bM as Xs,ar as Ys,ai as eo,al as rt,O as re,bu as Tt,bp as ae,bN as or,bO as ir,bP as ar,E as he,b4 as cr,y as to,bi as no}from"./vendor-mui-core-B6POpIBB.js";import{r as w,L as lr,f as ur,g as dr,u as ro,l as so}from"./vendor-react-DEoibe3W.js";import{r as J,b7 as oo,b5 as ft,b8 as io,a as xe,n as U,a7 as Ln,a2 as N,u as W,as as ao,p as fr,b9 as pr,o as co,d as lo,a_ as uo,a0 as Wt,aa as mr,av as hr,ba as fo,I as po,G as st,bb as mo,bc as ho,a4 as go,aq as xo}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{z as Ie,f as F,A as vt,B as vo,b as yo,C as Kt,D as bo,E as gr,F as te,G as xr,t as Se,H as vr,I as jo,n as Te,J as wo,K as So,u as _o,j as Dn,g as Co,L as An,h as Io,l as yt,k as To,m as Ro,M as Eo,O as Po,Q as Ze,e as Ve,R as ko,T as Lo,U as Do,N as Ao,V as bt,c as On}from"./index-CksPySYI.js";import{ae as Oo,A as _e,af as Mo,b as Je,p as yr,z as br,ag as $o}from"./vendor-utils-CjMBJT5V.js";import{_ as Mn}from"./useLocalStorage-CXDkfohf.js";import{C as $n}from"./confirm-BqrhdaU7.js";import{d as No}from"./PlayArrow-zDVVYX6u.js";import{g as Nn}from"./get-safe-url-cyoeQ7Mw.js";import{f as Gt}from"./format-error-BrmqJs5a.js";import{u as jr}from"./session-DLQ0rbYE.js";import{f as ve,a as wr,u as q,w as zo}from"./vendor-hooks-DXGUREV9.js";import{i as Uo,u as Bo,M as Ho,c as Oe,s as ot,H as qo,p as Sr,a as Fo}from"./use-blocklet-logo-BOYeM9RY.js";import{d as Vo}from"./InfoOutlined-BjII93aR.js";import{_ as _r,D as Wo}from"./dot-WAAJ-O65.js";import{_ as Cr}from"./useSetState-CWq0AVWn.js";import{u as Ir}from"./use-mobile-BKvZ6hcv.js";const Tr=w.createContext({});function Qt({children:e,type:t}){const[n,r]=w.useState([]),o=w.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(f=>f!==c);r(u),o.current=u}},l=c=>{const u=n.filter(h=>c.find(p=>p===h));Oo(u,n).forEach(h=>a(h))};return s.jsx(Tr.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:i,removeDeletingDid:a,matchDeletingDid:l},children:e})}Qt.propTypes={type:j.string,children:j.node.isRequired};Qt.defaultProps={type:"blocklets"};function Vl(){return w.useContext(Tr)}var Zt={},Ko=Z;Object.defineProperty(Zt,"__esModule",{value:!0});var Rr=Zt.default=void 0,Go=Ko(J()),Qo=s;Rr=Zt.default=(0,Go.default)((0,Qo.jsx)("path",{d:"M6 6h12v12H6z"}),"Stop");var Jt={},Zo=Z;Object.defineProperty(Jt,"__esModule",{value:!0});var Er=Jt.default=void 0,Jo=Zo(J()),Xo=s;Er=Jt.default=(0,Jo.default)((0,Xo.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 Xt={},Yo=Z;Object.defineProperty(Xt,"__esModule",{value:!0});var Pr=Xt.default=void 0,ei=Yo(J()),ti=s;Pr=Xt.default=(0,ei.default)((0,ti.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 Yt={},ni=Z;Object.defineProperty(Yt,"__esModule",{value:!0});var en=Yt.default=void 0,ri=ni(J()),si=s;en=Yt.default=(0,ri.default)((0,si.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 tn={},oi=Z;Object.defineProperty(tn,"__esModule",{value:!0});var kr=tn.default=void 0,ii=oi(J()),ai=s;kr=tn.default=(0,ii.default)((0,ai.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 nn={},ci=Z;Object.defineProperty(nn,"__esModule",{value:!0});var Lr=nn.default=void 0,li=ci(J()),ui=s;Lr=nn.default=(0,li.default)((0,ui.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 rn={},di=Z;Object.defineProperty(rn,"__esModule",{value:!0});var Dr=rn.default=void 0,fi=di(J()),pi=s;Dr=rn.default=(0,fi.default)((0,pi.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 sn=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"})})};sn.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};sn.displayName="dashboard";var on={},mi=Z;Object.defineProperty(on,"__esModule",{value:!0});var Ar=on.default=void 0,hi=mi(J()),gi=s;Ar=on.default=(0,hi.default)((0,gi.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 we={Start:No,Stop:Rr,Restart:Er,Reload:Pr,Remove:oo,Config:en,Log:kr,Group:Lr,Cancel:Dr,Dashboard:sn,Overview:Ar},xi=(e,t)=>{if(!e)return"";const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(_e(n.origin,t));return o.search=r.toString(),o.toString()},vi="internal",yi="external";function an({blocklet:e,onStart:t,onComplete:n,variant:r,hasPermission:o,getComponentUrl:i,useBlockletUrlEvaluation:a,...l}){const c=Ie(),[u,f]=w.useState(null),[h,p]=w.useState(null),[v,S]=w.useState(!1),[b,P]=w.useState(null),{t:d}=w.useContext(ft),[x]=Mn("skip-blocklet-setup",!1),{loading:g,recommendedUrl:k}=a(e),[L]=Mn("blocklet-type-filter",vi),y=F.isInProgress(e.status),[T,C]=w.useState(!1);w.useEffect(()=>{var $,G;if(!(e!=null&&e.controller))return;C(((G=($=e==null?void 0:e.controller)==null?void 0:$.status)==null?void 0:G.value)===me.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{var X,ie,fe;try{const Y=await c.api.getLauncherSession({input:{launcherSessionId:(X=e==null?void 0:e.controller)==null?void 0:X.launcherSessionId,launcherUrl:(ie=e==null?void 0:e.controller)==null?void 0:ie.launcherUrl}});if(Y!=null&&Y.error){console.error("get launcher session failed",Y.error);return}C([U.LAUNCH_SESSION_STATUS.overdue,U.LAUNCH_SESSION_STATUS.canceled,U.LAUNCH_SESSION_STATUS.terminated].includes((fe=Y==null?void 0:Y.launcherSession)==null?void 0:fe.status))}catch(Y){console.error("call getLauncherSession error",Y)}})()},[]);const{inService:I}=c,m=(R,$,G=!1)=>async()=>{const X=async He=>{var Fe;t({action:R,blocklet:e}),S(!0),p(R);let qe=!1;try{if(R==="remove")await $(He);else if(R==="start"){if(!F.hasRunnableComponent(e)){N.error(d("blocklet.noComponent"));return}if(!I&&!x&&!((Fe=e.settings)!=null&&Fe.initialized)&&e.mode!==me.BLOCKLET_MODES.DEVELOPMENT){if(!k||!Ln(k)){N.error(d("blocklet.gotoVisitError"));return}const ne=vo(c.info),En=new URL(k);En.searchParams.set("serverUrl",ne),window.open(Nn(En.href,{allowDomains:null})),n({action:R,blocklet:e});return}const pe=e.children.filter(ne=>!F.isInProgress(ne.status)&&ne.status!=="running").map(ne=>ne.meta.did),je={did:e.meta.did,componentDids:pe};await $({input:je})}else if(["stop","restart","reload"].includes(R)){const pe=e.children.filter(ne=>ne.status==="running").map(ne=>ne.meta.did),je={did:e.meta.did,componentDids:pe};await $({input:je})}else{const pe={did:e.meta.did};await $({input:pe})}R==="remove"?qe=!0:await yo(1e3),R==="reload"&&N.success(d("blocklet.reloadSuccess")),P(null),n({action:R,blocklet:e})}catch(pe){const je=`Blocklet ${R} failed: ${Gt(pe)}`;throw n({action:R,blocklet:e,error:new Error(je)}),new Error(je)}finally{qe||S(!1)}},ie=()=>{S(!1),P(null)},fe=F.getDisplayName(e,!0),Y=e.mode===me.BLOCKLET_MODES.DEVELOPMENT?{description:()=>s.jsx(B,{component:"div",children:s.jsx(B,{gutterBottom:!0,children:d("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(He,qe)=>s.jsxs(B,{component:"div",children:[s.jsx(B,{gutterBottom:!0,children:d("blocklet.action.removeApplicationDescription")}),s.jsxs(Ks,{name:"removeType",value:He.removeType,onChange:Fe=>qe({...He,removeType:Fe.target.value}),children:[s.jsx(De,{value:"backup",control:s.jsx(kn,{}),label:d("blocklet.action.removeApplicationAfterBackup")}),s.jsx(De,{value:"complete",control:s.jsx(kn,{}),label:d("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},ks={stop:{title:`${d("common.stop")} ${fe}`,description:d("blocklet.action.stopDescription"),confirm:d("blocklet.action.confirmStop"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie},restart:{title:`${d("common.restart")} ${fe}`,description:d("blocklet.action.restartDescription"),confirm:d("blocklet.action.confirmRestart"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie},remove:{title:`${d("common.remove")} ${fe}`,confirm:d("blocklet.action.confirmRemove"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie,...Y},cancelDownload:{title:`${d("common.cancel")}`,description:d("blocklet.action.cancelDownloadDescription",{name:fe}),confirm:d("common.confirm"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie}};G?P(ks[R]):await X()},_=!!u,A=R=>{try{R.stopPropagation(),R.preventDefault()}catch{}f(R.currentTarget)},D=R=>{try{R.stopPropagation(),R.preventDefault()}catch{}f(null)},H=async(R,$)=>{try{$.stopPropagation(),$.preventDefault()}catch{}if(typeof R.handler=="function")try{S(!0),p(R.action),await R.handler()}catch(G){console.error(`Blocklet ${R.name} failed: `,G)}finally{S(!1),f(null)}else f(null)},K=!I&&F.isDeletableBlocklet(e)?{action:"remove",icon:we.Remove,name:d("common.remove"),handler:m("remove",async({removeType:R})=>{R==="backup"&&await c.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await c.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:y}:null,xt={action:"remove",icon:({sx:R,...$})=>s.jsx(we.Cancel,{sx:{...R,paddingRight:"2px",zoom:.95},...$}),name:d("common.cancel"),handler:m("cancelDownload",c.api.cancelDownloadBlocklet,!0)},Es=F.getAppMissingConfigs(e),Ps=()=>{var X;const R=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),$=i==null?void 0:i({mountPoint:R,blocklet:e});if(!$||!Ln($)){N.error(d("blocklet.gotoVisitError"));return}const G=(X=e==null?void 0:e.site)==null?void 0:X.domainAliases;window.open(Nn(xi($,".well-known/service/admin"),{allowDomains:G==null?void 0:G.map(ie=>ie.value)}))};let Be=[{action:"start",icon:we.Start,inExternal:!0,name:d("common.start"),handler:m("start",c.api.startBlocklet),disabled:T||e.children.every(R=>R.status==="running")||vt(e.status)||g||y},{action:"stop",icon:we.Stop,inExternal:!0,name:d("common.stop"),handler:m("stop",c.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:we.Restart,name:d("common.restart"),handler:m("restart",c.api.restartBlocklet,!0),disabled:T||e.status!=="running"},vt(e.status)?xt:K,{separator:!0},I?null:{action:"dashboard",icon:({style:R,...$})=>s.jsx(we.Dashboard,{...$,style:{...R,width:"26px",height:"26px",paddingRight:"3px"}}),name:d("sidebar.dashboard"),handler:Ps}].filter(Boolean);return L===yi&&(Be=Be.filter(R=>R.inExternal)),r==="menu"?s.jsxs(zn,{"data-cy":"blocklet-actions",children:[s.jsx(ut,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:A,size:"small",disabled:!o||!vt(e.status)&&v,children:s.jsx(io,{})}),s.jsxs(Hs,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:_,onClose:D,PaperProps:{},children:[Es.length>0&&s.jsxs(rr,{style:{maxWidth:"400px"},severity:"error",children:[d("blocklet.config.missingRequired"),s.jsx("br",{}),s.jsx(lr,{to:`/blocklets/${e.meta.did}/components`,children:d("blocklet.config.gotoFix")})]}),Be.map((R,$)=>R.separator?s.jsx(Ft,{},`separator-${$}`):s.jsxs(qs,{dense:!0,onClick:G=>H(R,G),disabled:v||R.disabled,"data-cy":`${R.action}-blocklet`,children:[s.jsx(Fs,{style:{minWidth:24},children:h===R.action&&v?s.jsx(le,{size:16,sx:{marginRight:1}}):s.jsx(R.icon,{fontSize:"small"})}),s.jsx(Vs,{primary:R.name})]},R.name))]}),b&&s.jsx($n,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]}):s.jsxs(zn,{"data-cy":"blocklet-actions",...l,children:[s.jsx(Ws,{children:Be.filter(R=>!R.separator&&!R.onlyInMenu).map(R=>s.jsxs(xe,{title:R.name,"data-cy":`${R.action}-blocklet`,onClick:()=>H(R),disabled:!!R.disabled||v,children:[h===R.action&&v?s.jsx(le,{size:16,sx:{marginRight:1}}):s.jsx(R.icon,{}),s.jsx("span",{className:"blocklet-action-text",children:R.name})]},R.name))}),b&&s.jsx($n,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]})}an.propTypes={getComponentUrl:j.func,blocklet:j.object.isRequired,onStart:j.func.isRequired,onComplete:j.func.isRequired,variant:j.oneOf(["menu","group"]),hasPermission:j.bool,useBlockletUrlEvaluation:j.func};an.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 zn=V.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/log-B4LRFTNR.js","assets/vendor-mui-core-B6POpIBB.js","assets/vendor-react-DEoibe3W.js","assets/useLocalStorage-CXDkfohf.js","assets/vendor-ux-did-connect-D4-ZeZHm.js","assets/vendor-utils-CjMBJT5V.js","assets/vendor-hooks-DXGUREV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-CksPySYI.js","assets/vendor-arcblock-Dkhgjlzn.js","assets/index-DOq-_YXu.css","assets/Download-DKz_gZX5.js","assets/bundle-avatar-BXQsJw7m.js","assets/log-D33dFtt_.css","assets/index-17ov_POl.js","assets/ViewList-Ca1IEB31.js","assets/index-C-rU1lEd.js","assets/Phone-CKzC4712.js","assets/Location-BQhEvGNL.js","assets/Email-B0n6rLUZ.js","assets/Timezone-C3hiNX6j.js","assets/did-address-C6ni99I7.js","assets/permission-PNXSTeNL.js","assets/session-DLQ0rbYE.js","assets/click-to-copy-0s0a7Ak5.js","assets/index-DdLPuFP7.js","assets/vendor-mui-x-CATHW1QL.js","assets/AdapterDayjs-BWhMsmQP.js","assets/format-error-BrmqJs5a.js","assets/useAsync-GjVghrwi.js","assets/index-D_z5kVUS.js","assets/DeleteOutline-D_I07sPe.js","assets/confirm-BqrhdaU7.js","assets/util-D-LnEy9h.js","assets/base32-C_EKY5vU.js","assets/sdk-BXECCi1q.js","assets/actions-BW0Vx00_.js","assets/MoreHoriz-DHyMdwpT.js","assets/shorten-label-SbKUBkvs.js","assets/PlayArrow-zDVVYX6u.js","assets/get-safe-url-cyoeQ7Mw.js","assets/use-blocklet-logo-BOYeM9RY.js","assets/InfoOutlined-BjII93aR.js","assets/dot-WAAJ-O65.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-BNUwcWCH.js","assets/index-BAstW3VS.js","assets/ExpandLess-TUium4RQ.js","assets/index-DxR1P6Lh.js","assets/Error-js7ePZ5o.js","assets/empty-spinner-BYUFR95o.js","assets/list-header-8k1_C0K0.js","assets/QuestionMarkCircle-DpFFQWud.js","assets/index-DVQCgvFb.js","assets/index-DIe9psLc.js","assets/api-Bf1onQOz.js","assets/ChevronRight-BsdsjNxw.js","assets/react-beautiful-dnd.esm-C1Wt0pHO.js","assets/raf-schd.esm-B3j6BePR.js","assets/item-CCsztPdL.js","assets/Launch-ryL3I8d9.js","assets/Done-DLTvHdZB.js","assets/delete-confirm-CmXluMcs.js","assets/ArrowDropDown-DUCtp8oo.js","assets/index-CMFOn8T3.js","assets/index-C0Iiqot3.css","assets/index-Bt7GP-dU.js","assets/overview-CJRHh92f.js","assets/keyboard-arrow-down-rounded-DadBVmpO.js","assets/status-BKlS-OSq.js","assets/omit-DNeUY6_X.js","assets/spaces-CP1iyRKS.js","assets/domains-DV-Gl3-a.js","assets/domain-action-card-DIGUxqW7.js","assets/util-DJFgW-07.js","assets/CheckCircle-yKW43XdV.js","assets/index-BugTfB-J.js","assets/passport-item-jrknj0MQ.js","assets/Google-C7d25Q5r.js","assets/cloneDeep-WT_kDeVd.js","assets/EditIcon-DWRQ3fi6.js","assets/LockIcon-Bd69pSJI.js","assets/appearance-D9WrcbPF.js","assets/audit-logs-CVUuBgdy.js","assets/relative-time-cijkMMnc.js","assets/index-C8EYAWok.js","assets/list-BgP6u-5j.js","assets/traffic-BzRbyLJ-.js","assets/iframe-DZlnwo40.js","assets/LaunchOutlined-D21Xchdf.js","assets/ChevronLeft-6AvuBihM.js","assets/index-BUHlfcy3.js","assets/config-navigation-DhvlW96p.js","assets/index-DODYa3Im.js","assets/slicedToArray-C0YDCVwK.js","assets/simple-select-CLc0Q9sm.js","assets/index-CLD6I2fv.js","assets/use-mobile-BKvZ6hcv.js","assets/connect-to-C1xSYa-8.js","assets/config-space-CHI2AzS5.js","assets/index--MMFwLMX.js","assets/switch-control-yJOWKqcv.js","assets/index-C0x4zVBW.js","assets/security-Y5seZEn6.js","assets/config-e3P85n7z.js","assets/branding-Cywl-fod.js","assets/logo-uploader-DMxsEq63.js","assets/advanced-mJXTlRFz.js","assets/runtime-71FSw-R0.js","assets/index-DJeuTVoT.js","assets/Edit-odNPT5GK.js","assets/component-C3maTG8x.js","assets/TuneOutlined-Bv7cSbWT.js","assets/add-component-core-DXp_ntZ3.js","assets/launch-result-message-B_fS-f90.js","assets/page-header-MKUHlyAT.js","assets/index-htPha6tP.js","assets/content-layout-C3Yd4mK9.js","assets/add-component-core-D-IRi6XF.css","assets/index-C4pzdyRW.js"])))=>i.map(i=>d[i]);
2
+ import{c as me,u as er,p as Ls,h as nt,f as tr,g as nr,i as Ds,j as As,k as Os,m as Ms,l as Pn,n as $s,E as Ns,o as zs,H as Us,_ as M,R as Bs}from"./vendor-arcblock-Dkhgjlzn.js";import{H as j,j as s,a9 as Z,ah as V,I as ut,aq as Hs,ak as rr,X as Ft,q as qs,b5 as Fs,ab as le,b6 as Vs,bx as Ws,T as B,bv as Ks,bt as De,bw as kn,aa as E,bJ as Gs,v as se,a6 as dt,bK as Qs,ae as Zs,bg as Js,e as de,ap as Vt,bL as sr,ad as Ae,bM as Xs,ar as Ys,ai as eo,al as rt,O as re,bu as Tt,bp as ae,bN as or,bO as ir,bP as ar,E as he,b4 as cr,y as to,bi as no}from"./vendor-mui-core-B6POpIBB.js";import{r as w,L as lr,f as ur,g as dr,u as ro,l as so}from"./vendor-react-DEoibe3W.js";import{r as J,b7 as oo,b5 as ft,b8 as io,a as xe,n as U,a7 as Ln,a2 as N,u as W,as as ao,p as fr,b9 as pr,o as co,d as lo,a_ as uo,a0 as Wt,aa as mr,av as hr,ba as fo,I as po,G as st,bb as mo,bc as ho,a4 as go,aq as xo}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{z as Ie,f as F,A as vt,B as vo,b as yo,C as Kt,D as bo,E as gr,F as te,G as xr,t as Se,H as vr,I as jo,n as Te,J as wo,K as So,u as _o,j as Dn,g as Co,L as An,h as Io,l as yt,k as To,m as Ro,M as Eo,O as Po,Q as Ze,e as Ve,R as ko,T as Lo,U as Do,N as Ao,V as bt,c as On}from"./index-CksPySYI.js";import{ae as Oo,A as _e,af as Mo,b as Je,p as yr,z as br,ag as $o}from"./vendor-utils-CjMBJT5V.js";import{_ as Mn}from"./useLocalStorage-CXDkfohf.js";import{C as $n}from"./confirm-BqrhdaU7.js";import{d as No}from"./PlayArrow-zDVVYX6u.js";import{g as Nn}from"./get-safe-url-cyoeQ7Mw.js";import{f as Gt}from"./format-error-BrmqJs5a.js";import{u as jr}from"./session-DLQ0rbYE.js";import{f as ve,a as wr,u as q,w as zo}from"./vendor-hooks-DXGUREV9.js";import{i as Uo,u as Bo,M as Ho,c as Oe,s as ot,H as qo,p as Sr,a as Fo}from"./use-blocklet-logo-BOYeM9RY.js";import{d as Vo}from"./InfoOutlined-BjII93aR.js";import{_ as _r,D as Wo}from"./dot-WAAJ-O65.js";import{_ as Cr}from"./useSetState-CWq0AVWn.js";import{u as Ir}from"./use-mobile-BNUwcWCH.js";const Tr=w.createContext({});function Qt({children:e,type:t}){const[n,r]=w.useState([]),o=w.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(f=>f!==c);r(u),o.current=u}},l=c=>{const u=n.filter(h=>c.find(p=>p===h));Oo(u,n).forEach(h=>a(h))};return s.jsx(Tr.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:i,removeDeletingDid:a,matchDeletingDid:l},children:e})}Qt.propTypes={type:j.string,children:j.node.isRequired};Qt.defaultProps={type:"blocklets"};function Vl(){return w.useContext(Tr)}var Zt={},Ko=Z;Object.defineProperty(Zt,"__esModule",{value:!0});var Rr=Zt.default=void 0,Go=Ko(J()),Qo=s;Rr=Zt.default=(0,Go.default)((0,Qo.jsx)("path",{d:"M6 6h12v12H6z"}),"Stop");var Jt={},Zo=Z;Object.defineProperty(Jt,"__esModule",{value:!0});var Er=Jt.default=void 0,Jo=Zo(J()),Xo=s;Er=Jt.default=(0,Jo.default)((0,Xo.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 Xt={},Yo=Z;Object.defineProperty(Xt,"__esModule",{value:!0});var Pr=Xt.default=void 0,ei=Yo(J()),ti=s;Pr=Xt.default=(0,ei.default)((0,ti.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 Yt={},ni=Z;Object.defineProperty(Yt,"__esModule",{value:!0});var en=Yt.default=void 0,ri=ni(J()),si=s;en=Yt.default=(0,ri.default)((0,si.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 tn={},oi=Z;Object.defineProperty(tn,"__esModule",{value:!0});var kr=tn.default=void 0,ii=oi(J()),ai=s;kr=tn.default=(0,ii.default)((0,ai.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 nn={},ci=Z;Object.defineProperty(nn,"__esModule",{value:!0});var Lr=nn.default=void 0,li=ci(J()),ui=s;Lr=nn.default=(0,li.default)((0,ui.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 rn={},di=Z;Object.defineProperty(rn,"__esModule",{value:!0});var Dr=rn.default=void 0,fi=di(J()),pi=s;Dr=rn.default=(0,fi.default)((0,pi.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 sn=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"})})};sn.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};sn.displayName="dashboard";var on={},mi=Z;Object.defineProperty(on,"__esModule",{value:!0});var Ar=on.default=void 0,hi=mi(J()),gi=s;Ar=on.default=(0,hi.default)((0,gi.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 we={Start:No,Stop:Rr,Restart:Er,Reload:Pr,Remove:oo,Config:en,Log:kr,Group:Lr,Cancel:Dr,Dashboard:sn,Overview:Ar},xi=(e,t)=>{if(!e)return"";const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(_e(n.origin,t));return o.search=r.toString(),o.toString()},vi="internal",yi="external";function an({blocklet:e,onStart:t,onComplete:n,variant:r,hasPermission:o,getComponentUrl:i,useBlockletUrlEvaluation:a,...l}){const c=Ie(),[u,f]=w.useState(null),[h,p]=w.useState(null),[v,S]=w.useState(!1),[b,P]=w.useState(null),{t:d}=w.useContext(ft),[x]=Mn("skip-blocklet-setup",!1),{loading:g,recommendedUrl:k}=a(e),[L]=Mn("blocklet-type-filter",vi),y=F.isInProgress(e.status),[T,C]=w.useState(!1);w.useEffect(()=>{var $,G;if(!(e!=null&&e.controller))return;C(((G=($=e==null?void 0:e.controller)==null?void 0:$.status)==null?void 0:G.value)===me.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{var X,ie,fe;try{const Y=await c.api.getLauncherSession({input:{launcherSessionId:(X=e==null?void 0:e.controller)==null?void 0:X.launcherSessionId,launcherUrl:(ie=e==null?void 0:e.controller)==null?void 0:ie.launcherUrl}});if(Y!=null&&Y.error){console.error("get launcher session failed",Y.error);return}C([U.LAUNCH_SESSION_STATUS.overdue,U.LAUNCH_SESSION_STATUS.canceled,U.LAUNCH_SESSION_STATUS.terminated].includes((fe=Y==null?void 0:Y.launcherSession)==null?void 0:fe.status))}catch(Y){console.error("call getLauncherSession error",Y)}})()},[]);const{inService:I}=c,m=(R,$,G=!1)=>async()=>{const X=async He=>{var Fe;t({action:R,blocklet:e}),S(!0),p(R);let qe=!1;try{if(R==="remove")await $(He);else if(R==="start"){if(!F.hasRunnableComponent(e)){N.error(d("blocklet.noComponent"));return}if(!I&&!x&&!((Fe=e.settings)!=null&&Fe.initialized)&&e.mode!==me.BLOCKLET_MODES.DEVELOPMENT){if(!k||!Ln(k)){N.error(d("blocklet.gotoVisitError"));return}const ne=vo(c.info),En=new URL(k);En.searchParams.set("serverUrl",ne),window.open(Nn(En.href,{allowDomains:null})),n({action:R,blocklet:e});return}const pe=e.children.filter(ne=>!F.isInProgress(ne.status)&&ne.status!=="running").map(ne=>ne.meta.did),je={did:e.meta.did,componentDids:pe};await $({input:je})}else if(["stop","restart","reload"].includes(R)){const pe=e.children.filter(ne=>ne.status==="running").map(ne=>ne.meta.did),je={did:e.meta.did,componentDids:pe};await $({input:je})}else{const pe={did:e.meta.did};await $({input:pe})}R==="remove"?qe=!0:await yo(1e3),R==="reload"&&N.success(d("blocklet.reloadSuccess")),P(null),n({action:R,blocklet:e})}catch(pe){const je=`Blocklet ${R} failed: ${Gt(pe)}`;throw n({action:R,blocklet:e,error:new Error(je)}),new Error(je)}finally{qe||S(!1)}},ie=()=>{S(!1),P(null)},fe=F.getDisplayName(e,!0),Y=e.mode===me.BLOCKLET_MODES.DEVELOPMENT?{description:()=>s.jsx(B,{component:"div",children:s.jsx(B,{gutterBottom:!0,children:d("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(He,qe)=>s.jsxs(B,{component:"div",children:[s.jsx(B,{gutterBottom:!0,children:d("blocklet.action.removeApplicationDescription")}),s.jsxs(Ks,{name:"removeType",value:He.removeType,onChange:Fe=>qe({...He,removeType:Fe.target.value}),children:[s.jsx(De,{value:"backup",control:s.jsx(kn,{}),label:d("blocklet.action.removeApplicationAfterBackup")}),s.jsx(De,{value:"complete",control:s.jsx(kn,{}),label:d("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},ks={stop:{title:`${d("common.stop")} ${fe}`,description:d("blocklet.action.stopDescription"),confirm:d("blocklet.action.confirmStop"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie},restart:{title:`${d("common.restart")} ${fe}`,description:d("blocklet.action.restartDescription"),confirm:d("blocklet.action.confirmRestart"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie},remove:{title:`${d("common.remove")} ${fe}`,confirm:d("blocklet.action.confirmRemove"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie,...Y},cancelDownload:{title:`${d("common.cancel")}`,description:d("blocklet.action.cancelDownloadDescription",{name:fe}),confirm:d("common.confirm"),cancel:d("common.cancel"),onConfirm:X,onCancel:ie}};G?P(ks[R]):await X()},_=!!u,A=R=>{try{R.stopPropagation(),R.preventDefault()}catch{}f(R.currentTarget)},D=R=>{try{R.stopPropagation(),R.preventDefault()}catch{}f(null)},H=async(R,$)=>{try{$.stopPropagation(),$.preventDefault()}catch{}if(typeof R.handler=="function")try{S(!0),p(R.action),await R.handler()}catch(G){console.error(`Blocklet ${R.name} failed: `,G)}finally{S(!1),f(null)}else f(null)},K=!I&&F.isDeletableBlocklet(e)?{action:"remove",icon:we.Remove,name:d("common.remove"),handler:m("remove",async({removeType:R})=>{R==="backup"&&await c.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await c.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:y}:null,xt={action:"remove",icon:({sx:R,...$})=>s.jsx(we.Cancel,{sx:{...R,paddingRight:"2px",zoom:.95},...$}),name:d("common.cancel"),handler:m("cancelDownload",c.api.cancelDownloadBlocklet,!0)},Es=F.getAppMissingConfigs(e),Ps=()=>{var X;const R=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),$=i==null?void 0:i({mountPoint:R,blocklet:e});if(!$||!Ln($)){N.error(d("blocklet.gotoVisitError"));return}const G=(X=e==null?void 0:e.site)==null?void 0:X.domainAliases;window.open(Nn(xi($,".well-known/service/admin"),{allowDomains:G==null?void 0:G.map(ie=>ie.value)}))};let Be=[{action:"start",icon:we.Start,inExternal:!0,name:d("common.start"),handler:m("start",c.api.startBlocklet),disabled:T||e.children.every(R=>R.status==="running")||vt(e.status)||g||y},{action:"stop",icon:we.Stop,inExternal:!0,name:d("common.stop"),handler:m("stop",c.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:we.Restart,name:d("common.restart"),handler:m("restart",c.api.restartBlocklet,!0),disabled:T||e.status!=="running"},vt(e.status)?xt:K,{separator:!0},I?null:{action:"dashboard",icon:({style:R,...$})=>s.jsx(we.Dashboard,{...$,style:{...R,width:"26px",height:"26px",paddingRight:"3px"}}),name:d("sidebar.dashboard"),handler:Ps}].filter(Boolean);return L===yi&&(Be=Be.filter(R=>R.inExternal)),r==="menu"?s.jsxs(zn,{"data-cy":"blocklet-actions",children:[s.jsx(ut,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:A,size:"small",disabled:!o||!vt(e.status)&&v,children:s.jsx(io,{})}),s.jsxs(Hs,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:_,onClose:D,PaperProps:{},children:[Es.length>0&&s.jsxs(rr,{style:{maxWidth:"400px"},severity:"error",children:[d("blocklet.config.missingRequired"),s.jsx("br",{}),s.jsx(lr,{to:`/blocklets/${e.meta.did}/components`,children:d("blocklet.config.gotoFix")})]}),Be.map((R,$)=>R.separator?s.jsx(Ft,{},`separator-${$}`):s.jsxs(qs,{dense:!0,onClick:G=>H(R,G),disabled:v||R.disabled,"data-cy":`${R.action}-blocklet`,children:[s.jsx(Fs,{style:{minWidth:24},children:h===R.action&&v?s.jsx(le,{size:16,sx:{marginRight:1}}):s.jsx(R.icon,{fontSize:"small"})}),s.jsx(Vs,{primary:R.name})]},R.name))]}),b&&s.jsx($n,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]}):s.jsxs(zn,{"data-cy":"blocklet-actions",...l,children:[s.jsx(Ws,{children:Be.filter(R=>!R.separator&&!R.onlyInMenu).map(R=>s.jsxs(xe,{title:R.name,"data-cy":`${R.action}-blocklet`,onClick:()=>H(R),disabled:!!R.disabled||v,children:[h===R.action&&v?s.jsx(le,{size:16,sx:{marginRight:1}}):s.jsx(R.icon,{}),s.jsx("span",{className:"blocklet-action-text",children:R.name})]},R.name))}),b&&s.jsx($n,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]})}an.propTypes={getComponentUrl:j.func,blocklet:j.object.isRequired,onStart:j.func.isRequired,onComplete:j.func.isRequired,variant:j.oneOf(["menu","group"]),hasPermission:j.bool,useBlockletUrlEvaluation:j.func};an.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 zn=V.div`
3
3
  display: flex;
4
4
  align-items: center;
5
5
 
@@ -1,4 +1,4 @@
1
- import{j as o,aa as e,H as h,ah as v}from"./vendor-mui-core-B6POpIBB.js";import{n as C,f as k,ai as b,d as B}from"./index-CksPySYI.js";import{D as w,a as I,b as E}from"./domain-action-card-DIGUxqW7.js";import{b5 as T}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{P as A}from"./page-header-MKUHlyAT.js";import{r}from"./vendor-react-DEoibe3W.js";import{_ as L}from"./useSetState-CWq0AVWn.js";import{S as x}from"./button-h00yLUET.js";import{S as W}from"./layout-DV03YuuA.js";import{S as H}from"./step-actions-DMwF4axn.js";import"./vendor-arcblock-Dkhgjlzn.js";import"./vendor-utils-CjMBJT5V.js";import"./vendor-hooks-DXGUREV9.js";import"./lottie-web-jYmAQWuC.js";import"./ExpandLess-TUium4RQ.js";import"./permission-PNXSTeNL.js";import"./session-DLQ0rbYE.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./confirm-BqrhdaU7.js";import"./format-error-BrmqJs5a.js";import"./actions-BW0Vx00_.js";import"./MoreHoriz-DHyMdwpT.js";import"./delete-confirm-CmXluMcs.js";import"./click-to-copy-0s0a7Ak5.js";import"./util-DJFgW-07.js";import"./InfoOutlined-BjII93aR.js";import"./index-D_z5kVUS.js";import"./CheckCircle-yKW43XdV.js";import"./content-layout-C3Yd4mK9.js";import"./use-mobile-BKvZ6hcv.js";function d({onNext:s,onPrevious:D}){var u,f;const{t:n}=r.useContext(T),[S,p]=r.useState(!1),{blocklet:i}=C(),[l,j]=r.useState(""),y=(((i==null?void 0:i.site)||{}).domainAliases||[]).map(t=>k.replaceSlotToIp(t.value,l)),[a,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=(f=(u=i.environments)==null?void 0:u.find(t=>t.key==="BLOCKLET_APP_PK"))==null?void 0:f.value,P=y.find(t=>b.isDidDomain(t));return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{j(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(_,{children:[o.jsx(e,{className:"header",children:o.jsx(A,{title:n("setup.domain.title"),subTitle:n("setup.domain.subTitle"),onClickBack:D})}),o.jsxs(e,{className:"form",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(e,{children:[o.jsx(e,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",children:o.jsx(e,{display:"inline",children:`${n("setup.domain.buyOrConnect")} (${n("common.optional")})`})}),o.jsx(e,{mt:1,children:o.jsx(I,{blocklet:i,bugDidDomainProps:{appPk:c,appId:i.appPid,siteId:i.site.id,teamDid:i.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:i.appPid,siteId:i.site.id,teamDid:i.meta.did,cnameDomain:P,currentIp:l,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),p(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const g={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};m(g),s()},onError:p}})})]}),o.jsx(e,{children:o.jsx(E,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(e,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1,children:o.jsx(e,{display:"inline",children:n("setup.domain.skipDescription")})})})})]}),o.jsx(H,{mt:8,disabled:!!a.addDomainState.text,blocklet:i,onStartNow:()=>s("complete"),children:a.domain?o.jsx(x,{variant:"contained",loading:!!a.addDomainState.text,disabled:S||!!a.addDomainState.text||!a.domain,onClick:()=>s(),children:a.addDomainState.text||n("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!a.addDomainState.text,onClick:()=>s(),children:n("setup.continue")})})]})}function xt(s){return o.jsx(w,{children:o.jsx(d,{...s})})}d.propTypes={onNext:h.func,onPrevious:h.func};d.defaultProps={onNext:()=>{},onPrevious:()=>{}};const _=v(W)`
1
+ import{j as o,aa as e,H as h,ah as v}from"./vendor-mui-core-B6POpIBB.js";import{n as C,f as k,ai as b,d as B}from"./index-CksPySYI.js";import{D as w,a as I,b as E}from"./domain-action-card-DIGUxqW7.js";import{b5 as T}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{P as A}from"./page-header-MKUHlyAT.js";import{r}from"./vendor-react-DEoibe3W.js";import{_ as L}from"./useSetState-CWq0AVWn.js";import{S as x}from"./button-h00yLUET.js";import{S as W}from"./layout-DV03YuuA.js";import{S as H}from"./step-actions-DMwF4axn.js";import"./vendor-arcblock-Dkhgjlzn.js";import"./vendor-utils-CjMBJT5V.js";import"./vendor-hooks-DXGUREV9.js";import"./lottie-web-jYmAQWuC.js";import"./ExpandLess-TUium4RQ.js";import"./permission-PNXSTeNL.js";import"./session-DLQ0rbYE.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./confirm-BqrhdaU7.js";import"./format-error-BrmqJs5a.js";import"./actions-BW0Vx00_.js";import"./MoreHoriz-DHyMdwpT.js";import"./delete-confirm-CmXluMcs.js";import"./click-to-copy-0s0a7Ak5.js";import"./util-DJFgW-07.js";import"./InfoOutlined-BjII93aR.js";import"./index-D_z5kVUS.js";import"./CheckCircle-yKW43XdV.js";import"./content-layout-C3Yd4mK9.js";import"./use-mobile-BNUwcWCH.js";function d({onNext:s,onPrevious:D}){var u,f;const{t:n}=r.useContext(T),[S,p]=r.useState(!1),{blocklet:i}=C(),[l,j]=r.useState(""),y=(((i==null?void 0:i.site)||{}).domainAliases||[]).map(t=>k.replaceSlotToIp(t.value,l)),[a,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=(f=(u=i.environments)==null?void 0:u.find(t=>t.key==="BLOCKLET_APP_PK"))==null?void 0:f.value,P=y.find(t=>b.isDidDomain(t));return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{j(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(_,{children:[o.jsx(e,{className:"header",children:o.jsx(A,{title:n("setup.domain.title"),subTitle:n("setup.domain.subTitle"),onClickBack:D})}),o.jsxs(e,{className:"form",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(e,{children:[o.jsx(e,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",children:o.jsx(e,{display:"inline",children:`${n("setup.domain.buyOrConnect")} (${n("common.optional")})`})}),o.jsx(e,{mt:1,children:o.jsx(I,{blocklet:i,bugDidDomainProps:{appPk:c,appId:i.appPid,siteId:i.site.id,teamDid:i.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:i.appPid,siteId:i.site.id,teamDid:i.meta.did,cnameDomain:P,currentIp:l,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),p(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const g={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};m(g),s()},onError:p}})})]}),o.jsx(e,{children:o.jsx(E,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(e,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1,children:o.jsx(e,{display:"inline",children:n("setup.domain.skipDescription")})})})})]}),o.jsx(H,{mt:8,disabled:!!a.addDomainState.text,blocklet:i,onStartNow:()=>s("complete"),children:a.domain?o.jsx(x,{variant:"contained",loading:!!a.addDomainState.text,disabled:S||!!a.addDomainState.text||!a.domain,onClick:()=>s(),children:a.addDomainState.text||n("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!a.addDomainState.text,onClick:()=>s(),children:n("setup.continue")})})]})}function xt(s){return o.jsx(w,{children:o.jsx(d,{...s})})}d.propTypes={onNext:h.func,onPrevious:h.func};d.defaultProps={onNext:()=>{},onPrevious:()=>{}};const _=v(W)`
2
2
  height: 100%;
3
3
  overflow-y: hidden;
4
4
 
@@ -1,4 +1,4 @@
1
- import{j as e,aa as t,ab as P,ap as W,H as d,ah as B}from"./vendor-mui-core-B6POpIBB.js";import{r as l}from"./vendor-react-DEoibe3W.js";import{A as v}from"./vendor-utils-CjMBJT5V.js";import{d as I}from"./Launch-ryL3I8d9.js";import{b5 as L,as as $}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{W as A}from"./did-address-C6ni99I7.js";import{P as E}from"./page-header-MKUHlyAT.js";import{n as T,u as z}from"./index-CksPySYI.js";import{S as D}from"./layout-DV03YuuA.js";import{S as F}from"./step-actions-DMwF4axn.js";import{S as m}from"./button-h00yLUET.js";import"./vendor-hooks-DXGUREV9.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-Dkhgjlzn.js";import"./content-layout-C3Yd4mK9.js";import"./use-mobile-BKvZ6hcv.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(H,{children:[e.jsx("div",{className:"header",children:e.jsx(E,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(I,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx($,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const H=B(D)`
1
+ import{j as e,aa as t,ab as P,ap as W,H as d,ah as B}from"./vendor-mui-core-B6POpIBB.js";import{r as l}from"./vendor-react-DEoibe3W.js";import{A as v}from"./vendor-utils-CjMBJT5V.js";import{d as I}from"./Launch-ryL3I8d9.js";import{b5 as L,as as $}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{W as A}from"./did-address-C6ni99I7.js";import{P as E}from"./page-header-MKUHlyAT.js";import{n as T,u as z}from"./index-CksPySYI.js";import{S as D}from"./layout-DV03YuuA.js";import{S as F}from"./step-actions-DMwF4axn.js";import{S as m}from"./button-h00yLUET.js";import"./vendor-hooks-DXGUREV9.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-Dkhgjlzn.js";import"./content-layout-C3Yd4mK9.js";import"./use-mobile-BNUwcWCH.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(H,{children:[e.jsx("div",{className:"header",children:e.jsx(E,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(I,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx($,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const H=B(D)`
2
2
  .qr-body {
3
3
  width: 580px;
4
4
  ${n=>n.theme.breakpoints.down("md")} {
@@ -1,4 +1,4 @@
1
- import{r as Z,t as $n,g as Vn,e as Or,a as zn}from"./vendor-react-DEoibe3W.js";import{a9 as rn,j as n,aa as ae,bp as Yt,bs as Zt,bo as Qt,q as xt,T as Be,O as lt,ab as rt,by as nr,ak as tt,H as K,ah as Se,e as Wn,ad as wt,w as Hn,y as nn,b5 as Gn,b6 as Yn,I as Zn,bi as Qn,bt as Xn,bS as Jn}from"./vendor-mui-core-B6POpIBB.js";import{v as Ie,B as Xt,e as Jt,_ as ei,ax as ti,n as Rr,A as ri,b as ni}from"./vendor-utils-CjMBJT5V.js";import{r as on,bA as ut,bB as ii,bC as oi,bD as an,bE as ai,bF as si,bG as ci,bH as sn,bI as li,bJ as ir,bK as ui,bL as fi,bM as di,bN as pi,aM as or,bO as cn,aD as mi,k as hi,u as Te,a1 as gi,a0 as yi,aq as Ye,a as je,i as vi,as as bi,d as xi,b5 as ft,a2 as Fe,bq as wi,n as Ze,a4 as ln,am as Ei,I as ji,av as Si,b7 as Ci,ab as un,aa as fn,bw as Pi,$ as Ai}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{c as Ke,a as Ii,X as dn,O as Et,I as Oi,Y as Ri}from"./vendor-arcblock-Dkhgjlzn.js";import{d as Ti}from"./ViewList-Ca1IEB31.js";import{a1 as Ni,f as Di,z as Ae,at as ar,l as Qe,a2 as _i,U as Xe,au as Li,C as pn,av as mn,t as Ui,b as ki}from"./index-CksPySYI.js";import{U as hn,C as gn,I as qi}from"./index-C-rU1lEd.js";import{k as Bi,u as sr,a as cr,l as Ki,f as Mi}from"./vendor-hooks-DXGUREV9.js";import{u as Ne,d as Tr,W as yn}from"./dashboard-CvJ8cVy-.js";import{W as lr}from"./did-address-C6ni99I7.js";import{P as Me}from"./permission-PNXSTeNL.js";import{C as At}from"./click-to-copy-0s0a7Ak5.js";import{T as vn}from"./index-DdLPuFP7.js";import{f as $e}from"./format-error-BrmqJs5a.js";import{_ as Fi}from"./useAsync-GjVghrwi.js";import{I as Pe}from"./index-D_z5kVUS.js";import{d as $i}from"./DeleteOutline-D_I07sPe.js";import{C as dt}from"./confirm-BqrhdaU7.js";import{u as pt}from"./session-DLQ0rbYE.js";import{i as bn,a as jt,p as xn}from"./util-D-LnEy9h.js";import{b as Vi}from"./sdk-BXECCi1q.js";import{A as zi}from"./actions-BW0Vx00_.js";import{S as Wi}from"./shorten-label-SbKUBkvs.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-CKzC4712.js";import"./Location-BQhEvGNL.js";import"./Email-B0n6rLUZ.js";import"./Timezone-C3hiNX6j.js";import"./useLocalStorage-CXDkfohf.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./InfoOutlined-BjII93aR.js";import"./dot-WAAJ-O65.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BKvZ6hcv.js";import"./vendor-mui-x-CATHW1QL.js";import"./AdapterDayjs-BWhMsmQP.js";import"./base32-C_EKY5vU.js";import"./MoreHoriz-DHyMdwpT.js";var ur={},Hi=rn;Object.defineProperty(ur,"__esModule",{value:!0});var wn=ur.default=void 0,Gi=Hi(on()),Yi=n;wn=ur.default=(0,Gi.default)((0,Yi.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var fr=function(e){return n.jsxs("svg",{...e,children:[n.jsx("g",{clipPath:"url(#clip0)",children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0",children:n.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};fr.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};fr.displayName="person";const Zi=fr;var dr=function(e){return n.jsxs("svg",{...e,children:[n.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};dr.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};dr.displayName="external-issuer";const En=dr;var vt={},Qi=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),jn="%[a-f0-9]{2}",Nr=new RegExp("("+jn+")|([^%]+?)","gi"),Dr=new RegExp("("+jn+")+","gi");function er(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;var r=e.slice(0,t),i=e.slice(t);return Array.prototype.concat.call([],er(r),er(i))}function Xi(e){try{return decodeURIComponent(e)}catch{for(var t=e.match(Nr)||[],r=1;r<t.length;r++)e=er(t,r).join(""),t=e.match(Nr)||[];return e}}function Ji(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=Dr.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{var i=Xi(r[0]);i!==r[0]&&(t[r[0]]=i)}r=Dr.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),u=0;u<a.length;u++){var m=a[u];e=e.replace(new RegExp(m,"g"),t[m])}return e}var eo=function(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch{return Ji(e)}},to=(e,t)=>{if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[e];const r=e.indexOf(t);return r===-1?[e]:[e.slice(0,r),e.slice(r+t.length)]},ro=function(e,t){for(var r={},i=Object.keys(e),a=Array.isArray(t),u=0;u<i.length;u++){var m=i[u],x=e[m];(a?t.indexOf(m)!==-1:t(m,x,e))&&(r[m]=x)}return r};(function(e){const t=Qi,r=eo,i=to,a=ro,u=s=>s==null;function m(s){switch(s.arrayFormat){case"index":return o=>(l,d)=>{const E=l.length;return d===void 0||s.skipNull&&d===null||s.skipEmptyString&&d===""?l:d===null?[...l,[b(o,s),"[",E,"]"].join("")]:[...l,[b(o,s),"[",b(E,s),"]=",b(d,s)].join("")]};case"bracket":return o=>(l,d)=>d===void 0||s.skipNull&&d===null||s.skipEmptyString&&d===""?l:d===null?[...l,[b(o,s),"[]"].join("")]:[...l,[b(o,s),"[]=",b(d,s)].join("")];case"comma":case"separator":return o=>(l,d)=>d==null||d.length===0?l:l.length===0?[[b(o,s),"=",b(d,s)].join("")]:[[l,b(d,s)].join(s.arrayFormatSeparator)];default:return o=>(l,d)=>d===void 0||s.skipNull&&d===null||s.skipEmptyString&&d===""?l:d===null?[...l,b(o,s)]:[...l,[b(o,s),"=",b(d,s)].join("")]}}function x(s){let o;switch(s.arrayFormat){case"index":return(l,d,E)=>{if(o=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!o){E[l]=d;return}E[l]===void 0&&(E[l]={}),E[l][o[1]]=d};case"bracket":return(l,d,E)=>{if(o=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!o){E[l]=d;return}if(E[l]===void 0){E[l]=[d];return}E[l]=[].concat(E[l],d)};case"comma":case"separator":return(l,d,E)=>{const P=typeof d=="string"&&d.includes(s.arrayFormatSeparator),S=typeof d=="string"&&!P&&h(d,s).includes(s.arrayFormatSeparator);d=S?h(d,s):d;const J=P||S?d.split(s.arrayFormatSeparator).map(G=>h(G,s)):d===null?d:h(d,s);E[l]=J};default:return(l,d,E)=>{if(E[l]===void 0){E[l]=d;return}E[l]=[].concat(E[l],d)}}}function j(s){if(typeof s!="string"||s.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(s,o){return o.encode?o.strict?t(s):encodeURIComponent(s):s}function h(s,o){return o.decode?r(s):s}function N(s){return Array.isArray(s)?s.sort():typeof s=="object"?N(Object.keys(s)).sort((o,l)=>Number(o)-Number(l)).map(o=>s[o]):s}function C(s){const o=s.indexOf("#");return o!==-1&&(s=s.slice(0,o)),s}function A(s){let o="";const l=s.indexOf("#");return l!==-1&&(o=s.slice(l)),o}function y(s){s=C(s);const o=s.indexOf("?");return o===-1?"":s.slice(o+1)}function B(s,o){return o.parseNumbers&&!Number.isNaN(Number(s))&&typeof s=="string"&&s.trim()!==""?s=Number(s):o.parseBooleans&&s!==null&&(s.toLowerCase()==="true"||s.toLowerCase()==="false")&&(s=s.toLowerCase()==="true"),s}function w(s,o){o=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},o),j(o.arrayFormatSeparator);const l=x(o),d=Object.create(null);if(typeof s!="string"||(s=s.trim().replace(/^[?#&]/,""),!s))return d;for(const E of s.split("&")){if(E==="")continue;let[P,S]=i(o.decode?E.replace(/\+/g," "):E,"=");S=S===void 0?null:["comma","separator"].includes(o.arrayFormat)?S:h(S,o),l(h(P,o),S,d)}for(const E of Object.keys(d)){const P=d[E];if(typeof P=="object"&&P!==null)for(const S of Object.keys(P))P[S]=B(P[S],o);else d[E]=B(P,o)}return o.sort===!1?d:(o.sort===!0?Object.keys(d).sort():Object.keys(d).sort(o.sort)).reduce((E,P)=>{const S=d[P];return S&&typeof S=="object"&&!Array.isArray(S)?E[P]=N(S):E[P]=S,E},Object.create(null))}e.extract=y,e.parse=w,e.stringify=(s,o)=>{if(!s)return"";o=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},o),j(o.arrayFormatSeparator);const l=S=>o.skipNull&&u(s[S])||o.skipEmptyString&&s[S]==="",d=m(o),E={};for(const S of Object.keys(s))l(S)||(E[S]=s[S]);const P=Object.keys(E);return o.sort!==!1&&P.sort(o.sort),P.map(S=>{const J=s[S];return J===void 0?"":J===null?b(S,o):Array.isArray(J)?J.reduce(d(S),[]).join("&"):b(S,o)+"="+b(J,o)}).filter(S=>S.length>0).join("&")},e.parseUrl=(s,o)=>{o=Object.assign({decode:!0},o);const[l,d]=i(s,"#");return Object.assign({url:l.split("?")[0]||"",query:w(y(s),o)},o&&o.parseFragmentIdentifier&&d?{fragmentIdentifier:h(d,o)}:{})},e.stringifyUrl=(s,o)=>{o=Object.assign({encode:!0,strict:!0},o);const l=C(s.url).split("?")[0]||"",d=e.extract(s.url),E=e.parse(d,{sort:!1}),P=Object.assign(E,s.query);let S=e.stringify(P,o);S&&(S=`?${S}`);let J=A(s.url);return s.fragmentIdentifier&&(J=`#${b(s.fragmentIdentifier,o)}`),`${l}${S}${J}`},e.pick=(s,o,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:d,query:E,fragmentIdentifier:P}=e.parseUrl(s,l);return e.stringifyUrl({url:d,query:a(E,o),fragmentIdentifier:P},l)},e.exclude=(s,o,l)=>{const d=Array.isArray(o)?E=>!o.includes(E):(E,P)=>!o(E,P);return e.pick(s,d,l)}})(vt);const at=$n,no={parseNumbers:!1,parseBooleans:!1},io={skipNull:!1,skipEmptyString:!1},oo=(e,t)=>{var r,i;const{navigateMode:a="push",parseOptions:u,stringifyOptions:m}={},x=Object.assign(Object.assign({},no),u),j=Object.assign(Object.assign({},io),m),b=at.useLocation(),h=(r=at.useHistory)===null||r===void 0?void 0:r.call(at),N=(i=at.useNavigate)===null||i===void 0?void 0:i.call(at),C=Bi(),A=Z.useRef(typeof e=="function"?e():e||{}),y=Z.useMemo(()=>vt.parse(b.search,x),[b.search]),B=Z.useMemo(()=>Object.assign(Object.assign({},A.current),y),[y]);return[B,sr(s=>{const o=typeof s=="function"?s(B):s;C(),h&&h[a]({hash:b.hash,search:vt.stringify(Object.assign(Object.assign({},y),o),j)||"?"},b.state),N&&N({hash:b.hash,search:vt.stringify(Object.assign(Object.assign({},y),o),j)||"?"},{replace:a==="replace",state:b.state})})]},ao=oo;var Dt={exports:{}},_t={},_r;function Sn(){if(_r)return _t;_r=1;function e(o){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},e(o)}function t(o,l,d){return Object.defineProperty(o,"prototype",{writable:!1}),o}function r(o,l){if(!(o instanceof l))throw new TypeError("Cannot call a class as a function")}function i(o,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(l&&l.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),l&&a(o,l)}function a(o,l){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(E,P){return E.__proto__=P,E},a(o,l)}function u(o){var l=j();return function(){var E=b(o),P;if(l){var S=b(this).constructor;P=Reflect.construct(E,arguments,S)}else P=E.apply(this,arguments);return m(this,P)}}function m(o,l){if(l&&(e(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x(o)}function x(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function j(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function b(o){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(d){return d.__proto__||Object.getPrototypeOf(d)},b(o)}var h={},N,C;function A(o,l,d){d||(d=Error);function E(S,J,G){return typeof l=="string"?l:l(S,J,G)}var P=function(S){i(G,S);var J=u(G);function G(Y,W,$){var H;return r(this,G),H=J.call(this,E(Y,W,$)),H.code=o,H}return t(G)}(d);h[o]=P}function y(o,l){if(Array.isArray(o)){var d=o.length;return o=o.map(function(E){return String(E)}),d>2?"one of ".concat(l," ").concat(o.slice(0,d-1).join(", "),", or ")+o[d-1]:d===2?"one of ".concat(l," ").concat(o[0]," or ").concat(o[1]):"of ".concat(l," ").concat(o[0])}else return"of ".concat(l," ").concat(String(o))}function B(o,l,d){return o.substr(0,l.length)===l}function w(o,l,d){return(d===void 0||d>o.length)&&(d=o.length),o.substring(d-l.length,d)===l}function s(o,l,d){return typeof d!="number"&&(d=0),d+l.length>o.length?!1:o.indexOf(l,d)!==-1}return A("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),A("ERR_INVALID_ARG_TYPE",function(o,l,d){N===void 0&&(N=tr()),N(typeof o=="string","'name' must be a string");var E;typeof l=="string"&&B(l,"not ")?(E="must not be",l=l.replace(/^not /,"")):E="must be";var P;if(w(o," argument"))P="The ".concat(o," ").concat(E," ").concat(y(l,"type"));else{var S=s(o,".")?"property":"argument";P='The "'.concat(o,'" ').concat(S," ").concat(E," ").concat(y(l,"type"))}return P+=". Received type ".concat(e(d)),P},TypeError),A("ERR_INVALID_ARG_VALUE",function(o,l){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";C===void 0&&(C=ut);var E=C.inspect(l);return E.length>128&&(E="".concat(E.slice(0,128),"...")),"The argument '".concat(o,"' ").concat(d,". Received ").concat(E)},TypeError),A("ERR_INVALID_RETURN_VALUE",function(o,l,d){var E;return d&&d.constructor&&d.constructor.name?E="instance of ".concat(d.constructor.name):E="type ".concat(e(d)),"Expected ".concat(o,' to be returned from the "').concat(l,'"')+" function but got ".concat(E,".")},TypeError),A("ERR_MISSING_ARGS",function(){for(var o=arguments.length,l=new Array(o),d=0;d<o;d++)l[d]=arguments[d];N===void 0&&(N=tr()),N(l.length>0,"At least one arg needs to be specified");var E="The ",P=l.length;switch(l=l.map(function(S){return'"'.concat(S,'"')}),P){case 1:E+="".concat(l[0]," argument");break;case 2:E+="".concat(l[0]," and ").concat(l[1]," arguments");break;default:E+=l.slice(0,P-1).join(", "),E+=", and ".concat(l[P-1]," arguments");break}return"".concat(E," must be specified")},TypeError),_t.codes=h,_t}var Lt,Lr;function so(){if(Lr)return Lt;Lr=1;function e(I,O){var M=Object.keys(I);if(Object.getOwnPropertySymbols){var q=Object.getOwnPropertySymbols(I);O&&(q=q.filter(function(k){return Object.getOwnPropertyDescriptor(I,k).enumerable})),M.push.apply(M,q)}return M}function t(I){for(var O=1;O<arguments.length;O++){var M=arguments[O]!=null?arguments[O]:{};O%2?e(Object(M),!0).forEach(function(q){r(I,q,M[q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(M)):e(Object(M)).forEach(function(q){Object.defineProperty(I,q,Object.getOwnPropertyDescriptor(M,q))})}return I}function r(I,O,M){return O=m(O),O in I?Object.defineProperty(I,O,{value:M,enumerable:!0,configurable:!0,writable:!0}):I[O]=M,I}function i(I,O){if(!(I instanceof O))throw new TypeError("Cannot call a class as a function")}function a(I,O){for(var M=0;M<O.length;M++){var q=O[M];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,m(q.key),q)}}function u(I,O,M){return O&&a(I.prototype,O),Object.defineProperty(I,"prototype",{writable:!1}),I}function m(I){var O=x(I,"string");return o(O)==="symbol"?O:String(O)}function x(I,O){if(o(I)!=="object"||I===null)return I;var M=I[Symbol.toPrimitive];if(M!==void 0){var q=M.call(I,O||"default");if(o(q)!=="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(O==="string"?String:Number)(I)}function j(I,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(O&&O.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),Object.defineProperty(I,"prototype",{writable:!1}),O&&w(I,O)}function b(I){var O=y();return function(){var q=s(I),k;if(O){var g=s(this).constructor;k=Reflect.construct(q,arguments,g)}else k=q.apply(this,arguments);return h(this,k)}}function h(I,O){if(O&&(o(O)==="object"||typeof O=="function"))return O;if(O!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return N(I)}function N(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function C(I){var O=typeof Map=="function"?new Map:void 0;return C=function(q){if(q===null||!B(q))return q;if(typeof q!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O<"u"){if(O.has(q))return O.get(q);O.set(q,k)}function k(){return A(q,arguments,s(this).constructor)}return k.prototype=Object.create(q.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),w(k,q)},C(I)}function A(I,O,M){return y()?A=Reflect.construct.bind():A=function(k,g,p){var v=[null];v.push.apply(v,g);var _=Function.bind.apply(k,v),R=new _;return p&&w(R,p.prototype),R},A.apply(null,arguments)}function y(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(I){return Function.toString.call(I).indexOf("[native code]")!==-1}function w(I,O){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(q,k){return q.__proto__=k,q},w(I,O)}function s(I){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(M){return M.__proto__||Object.getPrototypeOf(M)},s(I)}function o(I){"@babel/helpers - typeof";return o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(O){return typeof O}:function(O){return O&&typeof Symbol=="function"&&O.constructor===Symbol&&O!==Symbol.prototype?"symbol":typeof O},o(I)}var l=ut,d=l.inspect,E=Sn(),P=E.codes.ERR_INVALID_ARG_TYPE;function S(I,O,M){return(M===void 0||M>I.length)&&(M=I.length),I.substring(M-O.length,M)===O}function J(I,O){if(O=Math.floor(O),I.length==0||O==0)return"";var M=I.length*O;for(O=Math.floor(Math.log(O)/Math.log(2));O;)I+=I,O--;return I+=I.substring(0,M-I.length),I}var G="",Y="",W="",$="",H={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},de=10;function we(I){var O=Object.keys(I),M=Object.create(Object.getPrototypeOf(I));return O.forEach(function(q){M[q]=I[q]}),Object.defineProperty(M,"message",{value:I.message}),M}function Q(I){return d(I,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function me(I,O,M){var q="",k="",g=0,p="",v=!1,_=Q(I),R=_.split(`
1
+ import{r as Z,t as $n,g as Vn,e as Or,a as zn}from"./vendor-react-DEoibe3W.js";import{a9 as rn,j as n,aa as ae,bp as Yt,bs as Zt,bo as Qt,q as xt,T as Be,O as lt,ab as rt,by as nr,ak as tt,H as K,ah as Se,e as Wn,ad as wt,w as Hn,y as nn,b5 as Gn,b6 as Yn,I as Zn,bi as Qn,bt as Xn,bS as Jn}from"./vendor-mui-core-B6POpIBB.js";import{v as Ie,B as Xt,e as Jt,_ as ei,ax as ti,n as Rr,A as ri,b as ni}from"./vendor-utils-CjMBJT5V.js";import{r as on,bA as ut,bB as ii,bC as oi,bD as an,bE as ai,bF as si,bG as ci,bH as sn,bI as li,bJ as ir,bK as ui,bL as fi,bM as di,bN as pi,aM as or,bO as cn,aD as mi,k as hi,u as Te,a1 as gi,a0 as yi,aq as Ye,a as je,i as vi,as as bi,d as xi,b5 as ft,a2 as Fe,bq as wi,n as Ze,a4 as ln,am as Ei,I as ji,av as Si,b7 as Ci,ab as un,aa as fn,bw as Pi,$ as Ai}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{c as Ke,a as Ii,X as dn,O as Et,I as Oi,Y as Ri}from"./vendor-arcblock-Dkhgjlzn.js";import{d as Ti}from"./ViewList-Ca1IEB31.js";import{a1 as Ni,f as Di,z as Ae,at as ar,l as Qe,a2 as _i,U as Xe,au as Li,C as pn,av as mn,t as Ui,b as ki}from"./index-CksPySYI.js";import{U as hn,C as gn,I as qi}from"./index-C-rU1lEd.js";import{k as Bi,u as sr,a as cr,l as Ki,f as Mi}from"./vendor-hooks-DXGUREV9.js";import{u as Ne,d as Tr,W as yn}from"./dashboard-CvJ8cVy-.js";import{W as lr}from"./did-address-C6ni99I7.js";import{P as Me}from"./permission-PNXSTeNL.js";import{C as At}from"./click-to-copy-0s0a7Ak5.js";import{T as vn}from"./index-DdLPuFP7.js";import{f as $e}from"./format-error-BrmqJs5a.js";import{_ as Fi}from"./useAsync-GjVghrwi.js";import{I as Pe}from"./index-D_z5kVUS.js";import{d as $i}from"./DeleteOutline-D_I07sPe.js";import{C as dt}from"./confirm-BqrhdaU7.js";import{u as pt}from"./session-DLQ0rbYE.js";import{i as bn,a as jt,p as xn}from"./util-D-LnEy9h.js";import{b as Vi}from"./sdk-BXECCi1q.js";import{A as zi}from"./actions-BW0Vx00_.js";import{S as Wi}from"./shorten-label-SbKUBkvs.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-CKzC4712.js";import"./Location-BQhEvGNL.js";import"./Email-B0n6rLUZ.js";import"./Timezone-C3hiNX6j.js";import"./useLocalStorage-CXDkfohf.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./InfoOutlined-BjII93aR.js";import"./dot-WAAJ-O65.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BNUwcWCH.js";import"./vendor-mui-x-CATHW1QL.js";import"./AdapterDayjs-BWhMsmQP.js";import"./base32-C_EKY5vU.js";import"./MoreHoriz-DHyMdwpT.js";var ur={},Hi=rn;Object.defineProperty(ur,"__esModule",{value:!0});var wn=ur.default=void 0,Gi=Hi(on()),Yi=n;wn=ur.default=(0,Gi.default)((0,Yi.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var fr=function(e){return n.jsxs("svg",{...e,children:[n.jsx("g",{clipPath:"url(#clip0)",children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0",children:n.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};fr.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};fr.displayName="person";const Zi=fr;var dr=function(e){return n.jsxs("svg",{...e,children:[n.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};dr.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};dr.displayName="external-issuer";const En=dr;var vt={},Qi=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),jn="%[a-f0-9]{2}",Nr=new RegExp("("+jn+")|([^%]+?)","gi"),Dr=new RegExp("("+jn+")+","gi");function er(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;var r=e.slice(0,t),i=e.slice(t);return Array.prototype.concat.call([],er(r),er(i))}function Xi(e){try{return decodeURIComponent(e)}catch{for(var t=e.match(Nr)||[],r=1;r<t.length;r++)e=er(t,r).join(""),t=e.match(Nr)||[];return e}}function Ji(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=Dr.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{var i=Xi(r[0]);i!==r[0]&&(t[r[0]]=i)}r=Dr.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),u=0;u<a.length;u++){var m=a[u];e=e.replace(new RegExp(m,"g"),t[m])}return e}var eo=function(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch{return Ji(e)}},to=(e,t)=>{if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[e];const r=e.indexOf(t);return r===-1?[e]:[e.slice(0,r),e.slice(r+t.length)]},ro=function(e,t){for(var r={},i=Object.keys(e),a=Array.isArray(t),u=0;u<i.length;u++){var m=i[u],x=e[m];(a?t.indexOf(m)!==-1:t(m,x,e))&&(r[m]=x)}return r};(function(e){const t=Qi,r=eo,i=to,a=ro,u=s=>s==null;function m(s){switch(s.arrayFormat){case"index":return o=>(l,d)=>{const E=l.length;return d===void 0||s.skipNull&&d===null||s.skipEmptyString&&d===""?l:d===null?[...l,[b(o,s),"[",E,"]"].join("")]:[...l,[b(o,s),"[",b(E,s),"]=",b(d,s)].join("")]};case"bracket":return o=>(l,d)=>d===void 0||s.skipNull&&d===null||s.skipEmptyString&&d===""?l:d===null?[...l,[b(o,s),"[]"].join("")]:[...l,[b(o,s),"[]=",b(d,s)].join("")];case"comma":case"separator":return o=>(l,d)=>d==null||d.length===0?l:l.length===0?[[b(o,s),"=",b(d,s)].join("")]:[[l,b(d,s)].join(s.arrayFormatSeparator)];default:return o=>(l,d)=>d===void 0||s.skipNull&&d===null||s.skipEmptyString&&d===""?l:d===null?[...l,b(o,s)]:[...l,[b(o,s),"=",b(d,s)].join("")]}}function x(s){let o;switch(s.arrayFormat){case"index":return(l,d,E)=>{if(o=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!o){E[l]=d;return}E[l]===void 0&&(E[l]={}),E[l][o[1]]=d};case"bracket":return(l,d,E)=>{if(o=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!o){E[l]=d;return}if(E[l]===void 0){E[l]=[d];return}E[l]=[].concat(E[l],d)};case"comma":case"separator":return(l,d,E)=>{const P=typeof d=="string"&&d.includes(s.arrayFormatSeparator),S=typeof d=="string"&&!P&&h(d,s).includes(s.arrayFormatSeparator);d=S?h(d,s):d;const J=P||S?d.split(s.arrayFormatSeparator).map(G=>h(G,s)):d===null?d:h(d,s);E[l]=J};default:return(l,d,E)=>{if(E[l]===void 0){E[l]=d;return}E[l]=[].concat(E[l],d)}}}function j(s){if(typeof s!="string"||s.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(s,o){return o.encode?o.strict?t(s):encodeURIComponent(s):s}function h(s,o){return o.decode?r(s):s}function N(s){return Array.isArray(s)?s.sort():typeof s=="object"?N(Object.keys(s)).sort((o,l)=>Number(o)-Number(l)).map(o=>s[o]):s}function C(s){const o=s.indexOf("#");return o!==-1&&(s=s.slice(0,o)),s}function A(s){let o="";const l=s.indexOf("#");return l!==-1&&(o=s.slice(l)),o}function y(s){s=C(s);const o=s.indexOf("?");return o===-1?"":s.slice(o+1)}function B(s,o){return o.parseNumbers&&!Number.isNaN(Number(s))&&typeof s=="string"&&s.trim()!==""?s=Number(s):o.parseBooleans&&s!==null&&(s.toLowerCase()==="true"||s.toLowerCase()==="false")&&(s=s.toLowerCase()==="true"),s}function w(s,o){o=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},o),j(o.arrayFormatSeparator);const l=x(o),d=Object.create(null);if(typeof s!="string"||(s=s.trim().replace(/^[?#&]/,""),!s))return d;for(const E of s.split("&")){if(E==="")continue;let[P,S]=i(o.decode?E.replace(/\+/g," "):E,"=");S=S===void 0?null:["comma","separator"].includes(o.arrayFormat)?S:h(S,o),l(h(P,o),S,d)}for(const E of Object.keys(d)){const P=d[E];if(typeof P=="object"&&P!==null)for(const S of Object.keys(P))P[S]=B(P[S],o);else d[E]=B(P,o)}return o.sort===!1?d:(o.sort===!0?Object.keys(d).sort():Object.keys(d).sort(o.sort)).reduce((E,P)=>{const S=d[P];return S&&typeof S=="object"&&!Array.isArray(S)?E[P]=N(S):E[P]=S,E},Object.create(null))}e.extract=y,e.parse=w,e.stringify=(s,o)=>{if(!s)return"";o=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},o),j(o.arrayFormatSeparator);const l=S=>o.skipNull&&u(s[S])||o.skipEmptyString&&s[S]==="",d=m(o),E={};for(const S of Object.keys(s))l(S)||(E[S]=s[S]);const P=Object.keys(E);return o.sort!==!1&&P.sort(o.sort),P.map(S=>{const J=s[S];return J===void 0?"":J===null?b(S,o):Array.isArray(J)?J.reduce(d(S),[]).join("&"):b(S,o)+"="+b(J,o)}).filter(S=>S.length>0).join("&")},e.parseUrl=(s,o)=>{o=Object.assign({decode:!0},o);const[l,d]=i(s,"#");return Object.assign({url:l.split("?")[0]||"",query:w(y(s),o)},o&&o.parseFragmentIdentifier&&d?{fragmentIdentifier:h(d,o)}:{})},e.stringifyUrl=(s,o)=>{o=Object.assign({encode:!0,strict:!0},o);const l=C(s.url).split("?")[0]||"",d=e.extract(s.url),E=e.parse(d,{sort:!1}),P=Object.assign(E,s.query);let S=e.stringify(P,o);S&&(S=`?${S}`);let J=A(s.url);return s.fragmentIdentifier&&(J=`#${b(s.fragmentIdentifier,o)}`),`${l}${S}${J}`},e.pick=(s,o,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:d,query:E,fragmentIdentifier:P}=e.parseUrl(s,l);return e.stringifyUrl({url:d,query:a(E,o),fragmentIdentifier:P},l)},e.exclude=(s,o,l)=>{const d=Array.isArray(o)?E=>!o.includes(E):(E,P)=>!o(E,P);return e.pick(s,d,l)}})(vt);const at=$n,no={parseNumbers:!1,parseBooleans:!1},io={skipNull:!1,skipEmptyString:!1},oo=(e,t)=>{var r,i;const{navigateMode:a="push",parseOptions:u,stringifyOptions:m}={},x=Object.assign(Object.assign({},no),u),j=Object.assign(Object.assign({},io),m),b=at.useLocation(),h=(r=at.useHistory)===null||r===void 0?void 0:r.call(at),N=(i=at.useNavigate)===null||i===void 0?void 0:i.call(at),C=Bi(),A=Z.useRef(typeof e=="function"?e():e||{}),y=Z.useMemo(()=>vt.parse(b.search,x),[b.search]),B=Z.useMemo(()=>Object.assign(Object.assign({},A.current),y),[y]);return[B,sr(s=>{const o=typeof s=="function"?s(B):s;C(),h&&h[a]({hash:b.hash,search:vt.stringify(Object.assign(Object.assign({},y),o),j)||"?"},b.state),N&&N({hash:b.hash,search:vt.stringify(Object.assign(Object.assign({},y),o),j)||"?"},{replace:a==="replace",state:b.state})})]},ao=oo;var Dt={exports:{}},_t={},_r;function Sn(){if(_r)return _t;_r=1;function e(o){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},e(o)}function t(o,l,d){return Object.defineProperty(o,"prototype",{writable:!1}),o}function r(o,l){if(!(o instanceof l))throw new TypeError("Cannot call a class as a function")}function i(o,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(l&&l.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),l&&a(o,l)}function a(o,l){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(E,P){return E.__proto__=P,E},a(o,l)}function u(o){var l=j();return function(){var E=b(o),P;if(l){var S=b(this).constructor;P=Reflect.construct(E,arguments,S)}else P=E.apply(this,arguments);return m(this,P)}}function m(o,l){if(l&&(e(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x(o)}function x(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function j(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function b(o){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(d){return d.__proto__||Object.getPrototypeOf(d)},b(o)}var h={},N,C;function A(o,l,d){d||(d=Error);function E(S,J,G){return typeof l=="string"?l:l(S,J,G)}var P=function(S){i(G,S);var J=u(G);function G(Y,W,$){var H;return r(this,G),H=J.call(this,E(Y,W,$)),H.code=o,H}return t(G)}(d);h[o]=P}function y(o,l){if(Array.isArray(o)){var d=o.length;return o=o.map(function(E){return String(E)}),d>2?"one of ".concat(l," ").concat(o.slice(0,d-1).join(", "),", or ")+o[d-1]:d===2?"one of ".concat(l," ").concat(o[0]," or ").concat(o[1]):"of ".concat(l," ").concat(o[0])}else return"of ".concat(l," ").concat(String(o))}function B(o,l,d){return o.substr(0,l.length)===l}function w(o,l,d){return(d===void 0||d>o.length)&&(d=o.length),o.substring(d-l.length,d)===l}function s(o,l,d){return typeof d!="number"&&(d=0),d+l.length>o.length?!1:o.indexOf(l,d)!==-1}return A("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),A("ERR_INVALID_ARG_TYPE",function(o,l,d){N===void 0&&(N=tr()),N(typeof o=="string","'name' must be a string");var E;typeof l=="string"&&B(l,"not ")?(E="must not be",l=l.replace(/^not /,"")):E="must be";var P;if(w(o," argument"))P="The ".concat(o," ").concat(E," ").concat(y(l,"type"));else{var S=s(o,".")?"property":"argument";P='The "'.concat(o,'" ').concat(S," ").concat(E," ").concat(y(l,"type"))}return P+=". Received type ".concat(e(d)),P},TypeError),A("ERR_INVALID_ARG_VALUE",function(o,l){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";C===void 0&&(C=ut);var E=C.inspect(l);return E.length>128&&(E="".concat(E.slice(0,128),"...")),"The argument '".concat(o,"' ").concat(d,". Received ").concat(E)},TypeError),A("ERR_INVALID_RETURN_VALUE",function(o,l,d){var E;return d&&d.constructor&&d.constructor.name?E="instance of ".concat(d.constructor.name):E="type ".concat(e(d)),"Expected ".concat(o,' to be returned from the "').concat(l,'"')+" function but got ".concat(E,".")},TypeError),A("ERR_MISSING_ARGS",function(){for(var o=arguments.length,l=new Array(o),d=0;d<o;d++)l[d]=arguments[d];N===void 0&&(N=tr()),N(l.length>0,"At least one arg needs to be specified");var E="The ",P=l.length;switch(l=l.map(function(S){return'"'.concat(S,'"')}),P){case 1:E+="".concat(l[0]," argument");break;case 2:E+="".concat(l[0]," and ").concat(l[1]," arguments");break;default:E+=l.slice(0,P-1).join(", "),E+=", and ".concat(l[P-1]," arguments");break}return"".concat(E," must be specified")},TypeError),_t.codes=h,_t}var Lt,Lr;function so(){if(Lr)return Lt;Lr=1;function e(I,O){var M=Object.keys(I);if(Object.getOwnPropertySymbols){var q=Object.getOwnPropertySymbols(I);O&&(q=q.filter(function(k){return Object.getOwnPropertyDescriptor(I,k).enumerable})),M.push.apply(M,q)}return M}function t(I){for(var O=1;O<arguments.length;O++){var M=arguments[O]!=null?arguments[O]:{};O%2?e(Object(M),!0).forEach(function(q){r(I,q,M[q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(M)):e(Object(M)).forEach(function(q){Object.defineProperty(I,q,Object.getOwnPropertyDescriptor(M,q))})}return I}function r(I,O,M){return O=m(O),O in I?Object.defineProperty(I,O,{value:M,enumerable:!0,configurable:!0,writable:!0}):I[O]=M,I}function i(I,O){if(!(I instanceof O))throw new TypeError("Cannot call a class as a function")}function a(I,O){for(var M=0;M<O.length;M++){var q=O[M];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,m(q.key),q)}}function u(I,O,M){return O&&a(I.prototype,O),Object.defineProperty(I,"prototype",{writable:!1}),I}function m(I){var O=x(I,"string");return o(O)==="symbol"?O:String(O)}function x(I,O){if(o(I)!=="object"||I===null)return I;var M=I[Symbol.toPrimitive];if(M!==void 0){var q=M.call(I,O||"default");if(o(q)!=="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(O==="string"?String:Number)(I)}function j(I,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(O&&O.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),Object.defineProperty(I,"prototype",{writable:!1}),O&&w(I,O)}function b(I){var O=y();return function(){var q=s(I),k;if(O){var g=s(this).constructor;k=Reflect.construct(q,arguments,g)}else k=q.apply(this,arguments);return h(this,k)}}function h(I,O){if(O&&(o(O)==="object"||typeof O=="function"))return O;if(O!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return N(I)}function N(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function C(I){var O=typeof Map=="function"?new Map:void 0;return C=function(q){if(q===null||!B(q))return q;if(typeof q!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O<"u"){if(O.has(q))return O.get(q);O.set(q,k)}function k(){return A(q,arguments,s(this).constructor)}return k.prototype=Object.create(q.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),w(k,q)},C(I)}function A(I,O,M){return y()?A=Reflect.construct.bind():A=function(k,g,p){var v=[null];v.push.apply(v,g);var _=Function.bind.apply(k,v),R=new _;return p&&w(R,p.prototype),R},A.apply(null,arguments)}function y(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(I){return Function.toString.call(I).indexOf("[native code]")!==-1}function w(I,O){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(q,k){return q.__proto__=k,q},w(I,O)}function s(I){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(M){return M.__proto__||Object.getPrototypeOf(M)},s(I)}function o(I){"@babel/helpers - typeof";return o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(O){return typeof O}:function(O){return O&&typeof Symbol=="function"&&O.constructor===Symbol&&O!==Symbol.prototype?"symbol":typeof O},o(I)}var l=ut,d=l.inspect,E=Sn(),P=E.codes.ERR_INVALID_ARG_TYPE;function S(I,O,M){return(M===void 0||M>I.length)&&(M=I.length),I.substring(M-O.length,M)===O}function J(I,O){if(O=Math.floor(O),I.length==0||O==0)return"";var M=I.length*O;for(O=Math.floor(Math.log(O)/Math.log(2));O;)I+=I,O--;return I+=I.substring(0,M-I.length),I}var G="",Y="",W="",$="",H={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},de=10;function we(I){var O=Object.keys(I),M=Object.create(Object.getPrototypeOf(I));return O.forEach(function(q){M[q]=I[q]}),Object.defineProperty(M,"message",{value:I.message}),M}function Q(I){return d(I,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function me(I,O,M){var q="",k="",g=0,p="",v=!1,_=Q(I),R=_.split(`
2
2
  `),L=Q(O).split(`
3
3
  `),V=0,ne="";if(M==="strictEqual"&&o(I)==="object"&&o(O)==="object"&&I!==null&&O!==null&&(M="strictEqualObject"),R.length===1&&L.length===1&&R[0]!==L[0]){var ce=R[0].length+L[0].length;if(ce<=de){if((o(I)!=="object"||I===null)&&(o(O)!=="object"||O===null)&&(I!==0||O!==0))return"".concat(H[M],`
4
4
 
@@ -1,4 +1,4 @@
1
- import{u as q,a2 as z,bP as K,I as be,bQ as ge,a4 as fe,ab as je,bw as ye}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{t as we,m as de,j as ke}from"./vendor-hooks-DXGUREV9.js";import{r as C,b as X}from"./vendor-react-DEoibe3W.js";import{d as Z}from"./InfoOutlined-BjII93aR.js";import{z as F,E as ve,F as Y,C as ce,t as Ee}from"./index-CksPySYI.js";import{u as N}from"./dashboard-CvJ8cVy-.js";import{H as o,j as e,D as Ce,aj as Te,t as Se,aa as g,O as ie,T as S,ab as U,ak as ee,z as Re,y as B,bt as le,bS as V,ad as W,L as Q,A as G,be as Ie,E as A,I as _,C as Me,br as Pe,al as P,ch as De,X as $e,bd as J,bq as ze,b5 as We,ci as Ae,cj as Oe,b6 as qe,an as Le,c1 as Be,s as pe,v as He,ck as Fe,cl as Ne,cm as Ue,cn as _e,co as Ke}from"./vendor-mui-core-B6POpIBB.js";import{q as Ye}from"./vendor-arcblock-Dkhgjlzn.js";import{d as Ve}from"./ExpandLess-TUium4RQ.js";import{b as ue,z as Je,A as Qe}from"./vendor-utils-CjMBJT5V.js";import{C as Ge}from"./confirm-BqrhdaU7.js";import{A as Xe}from"./actions-BW0Vx00_.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CXDkfohf.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./format-error-BrmqJs5a.js";import"./session-DLQ0rbYE.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BKvZ6hcv.js";import"./MoreHoriz-DHyMdwpT.js";const Ze=t=>{var j,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=ce(),l=(y=(j=s==null?void 0:s.site)==null?void 0:j.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const x={};return d&&(d.sources.forEach(r=>{x[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{x[r.source]&&(x[r.source].events.push(r),x[r.source].count+=1)})),x},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(x){p(x instanceof Error?x:new Error(String(x)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:a,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=q(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:f}])=>{const E=f.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},j=r=>{const w=`${r.type}-${r.source}`;c(f=>({...f,[w]:!f[w]}))},y=(r,w)=>{const f={};r.forEach(E=>{const u=`${E.type}-${E.source}`;f[u]=!w}),c(E=>({...E,...f}))},x=r=>{const w={};Object.values(t).forEach(({events:f})=>{f.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(g,{sx:{width:"100%"},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(V,{onChange:x,checked:l>0&&l===v}),label:e.jsxs(g,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(g,{sx:{display:"flex",alignItems:"center"},children:e.jsx(W,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(g,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(Q,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:f,count:E}],u)=>{const M=s[r]>0,i=s[r]===f.length&&f.length>0,h=R[r];return e.jsxs(X.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(g,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(g,{sx:{display:"flex",alignItems:"center"},children:f.length>0&&e.jsx(le,{control:e.jsx(V,{checked:i,indeterminate:M&&!i,onChange:n=>{n.stopPropagation(),y(f,i)}}),label:e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Ie,{src:w.logo,sx:{width:24,height:24}}),e.jsx(g,{children:w.title||r}),M&&e.jsx(A,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),f.length>0&&e.jsx(_,{size:"small",edge:"end",children:h?e.jsx(Ve,{}):e.jsx(Ye,{})})]})]})}),f.length>0&&e.jsx(Me,{in:h,timeout:"auto",unmountOnExit:!0,children:e.jsx(Q,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:f.map(n=>{const m=`${n.type}-${n.source}`,k=!!d[m];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>j(n),children:e.jsxs(g,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:k,sx:{mr:1}}),e.jsxs(g,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Pe,{error:!0,sx:{mt:1},children:a})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=q(),[s,l]=C.useState({}),{teamDid:v}=N(),{api:T}=F(),{loading:j,error:y,eventsBySource:x}=Ze(),{control:r,handleSubmit:w,formState:{errors:f},reset:E,setValue:u,trigger:M}=ve({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[s,u,M]);const i=()=>{l({}),E(),R()},h=async m=>{const k=Object.keys(s).filter(I=>s[I]),D={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[O,L]=I.split("-");return!O||!L?null:{type:O,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:D}});z.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:D}});z.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){z.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(Ce,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(h),children:[e.jsx(Te,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Se,{children:e.jsxs(g,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Y,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!f.url,helperText:(k=f.url)==null?void 0:k.message})}}),e.jsx(Y,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!f.description,helperText:(k=f.description)==null?void 0:k.message})}}),e.jsx(Y,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!j&&x&&Object.keys(x).length>0&&e.jsx(te,{eventsBySource:x,selectedEvents:s,setSelectedEvents:l,error:(n=f.selectedEvents)==null?void 0:n.message}),!j&&(!x||Object.keys(x).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),j&&e.jsx(g,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(U,{size:20})}),y&&e.jsx(ee,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Re,{sx:{p:"8px 24px 24px"},children:[e.jsx(B,{onClick:i,children:p("common.cancel")}),e.jsx(B,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const et=(t="en")=>t==="tw"?"zh":t;function H(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Ee(t).locale(et(c)).format(d):"-"}function tt(t){return typeof t=="number"?!1:ue(t)}function ot(t){return t>=200&&t<300}function $(t){const d=tt(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(W,{title:t.tip,children:e.jsx(De,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx($e,{orientation:"vertical",flexItem:!0})]})}$.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};$.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const nt=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=F(),{t:b}=q(),{teamDid:R}=N(),{blocklet:p}=ce(),{data:s,loadMore:l,loadingMore:v,loading:T}=we(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),j=(s==null?void 0:s.list)||[],[y,x]=C.useState(null),r=nt(j);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&x(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{x(u)};if(T)return e.jsx(U,{});const f=s&&s.list.length<s.paging.total,E=u=>{var M,i,h,n,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((h=u.responseBody)!=null&&h.agentId)){const k=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,D=(p.children||[]).find(O=>{var L;return((L=O==null?void 0:O.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Qe(`https://${k}`,(D==null?void 0:D.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(_,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(g,{component:be,icon:ge})})}return null};return e.jsxs(J,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(J,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(X.Fragment,{children:[e.jsx(ze,{children:u}),M.map(i=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:H(i.createdAt,"HH:mm:ss")}),children:[e.jsx(We,{sx:{minWidth:0,mr:1.5},children:ot(i.responseStatus)===!1?e.jsx(Ae,{color:"error"}):e.jsx(Oe,{color:"success"})}),e.jsx(qe,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),f&&e.jsx(g,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(B,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(J,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(g,{children:E(y)})]}),e.jsxs(g,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(K,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(g,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(g,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function he({id:t,onClose:d}){var v,T,j,y;const{t:c}=q(),{api:a}=F(),{teamDid:b}=N(),{loading:R,error:p,data:s}=de(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(ee,{severity:"error",children:p.message}):R||!l?e.jsx(g,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(U,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(g,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(W,{title:l.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(_,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Be,{})})})]}),e.jsx(g,{mt:2,children:e.jsxs(P,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx($,{label:c("common.status"),value:e.jsx(A,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx($,{label:c("webhookEndpoint.listen"),value:e.jsx(W,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(x=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:x==null?void 0:x.type},x))}),children:e.jsx(A,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx($,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx($,{label:c("common.createdAt"),value:H(l.createdAt),divider:!0}),e.jsx($,{label:c("common.updatedAt"),value:H(l.updatedAt),divider:!0}),e.jsx($,{label:c("common.createdBy"),value:e.jsx(W,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(A,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx($,{label:c("common.updatedBy"),value:e.jsx(W,{arrow:!0,title:(j=l.updateUser)==null?void 0:j.did,children:e.jsx(A,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:l.id})})]})]})}he.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx(Le,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(g,{sx:{height:"100vh",p:3},children:e.jsx(he,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function ae(){return null}const re=X.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=q(),l=He(j=>j.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=ae),a||(T.TableFooter=ae),e.jsx(rt,{locale:s,options:{...v,...t},columns:(d||[]).map(j=>(j.options=j.options||{},j.options.filter=j.options.filter||!1,j.options.sort=j.options.sort||!1,j)),emptyNode:e.jsx(fe,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(je)`
1
+ import{u as q,a2 as z,bP as K,I as be,bQ as ge,a4 as fe,ab as je,bw as ye}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{t as we,m as de,j as ke}from"./vendor-hooks-DXGUREV9.js";import{r as C,b as X}from"./vendor-react-DEoibe3W.js";import{d as Z}from"./InfoOutlined-BjII93aR.js";import{z as F,E as ve,F as Y,C as ce,t as Ee}from"./index-CksPySYI.js";import{u as N}from"./dashboard-CvJ8cVy-.js";import{H as o,j as e,D as Ce,aj as Te,t as Se,aa as g,O as ie,T as S,ab as U,ak as ee,z as Re,y as B,bt as le,bS as V,ad as W,L as Q,A as G,be as Ie,E as A,I as _,C as Me,br as Pe,al as P,ch as De,X as $e,bd as J,bq as ze,b5 as We,ci as Ae,cj as Oe,b6 as qe,an as Le,c1 as Be,s as pe,v as He,ck as Fe,cl as Ne,cm as Ue,cn as _e,co as Ke}from"./vendor-mui-core-B6POpIBB.js";import{q as Ye}from"./vendor-arcblock-Dkhgjlzn.js";import{d as Ve}from"./ExpandLess-TUium4RQ.js";import{b as ue,z as Je,A as Qe}from"./vendor-utils-CjMBJT5V.js";import{C as Ge}from"./confirm-BqrhdaU7.js";import{A as Xe}from"./actions-BW0Vx00_.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CXDkfohf.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./format-error-BrmqJs5a.js";import"./session-DLQ0rbYE.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BNUwcWCH.js";import"./MoreHoriz-DHyMdwpT.js";const Ze=t=>{var j,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=ce(),l=(y=(j=s==null?void 0:s.site)==null?void 0:j.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const x={};return d&&(d.sources.forEach(r=>{x[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{x[r.source]&&(x[r.source].events.push(r),x[r.source].count+=1)})),x},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(x){p(x instanceof Error?x:new Error(String(x)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:a,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=q(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:f}])=>{const E=f.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},j=r=>{const w=`${r.type}-${r.source}`;c(f=>({...f,[w]:!f[w]}))},y=(r,w)=>{const f={};r.forEach(E=>{const u=`${E.type}-${E.source}`;f[u]=!w}),c(E=>({...E,...f}))},x=r=>{const w={};Object.values(t).forEach(({events:f})=>{f.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(g,{sx:{width:"100%"},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(V,{onChange:x,checked:l>0&&l===v}),label:e.jsxs(g,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(g,{sx:{display:"flex",alignItems:"center"},children:e.jsx(W,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(g,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(Q,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:f,count:E}],u)=>{const M=s[r]>0,i=s[r]===f.length&&f.length>0,h=R[r];return e.jsxs(X.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(g,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(g,{sx:{display:"flex",alignItems:"center"},children:f.length>0&&e.jsx(le,{control:e.jsx(V,{checked:i,indeterminate:M&&!i,onChange:n=>{n.stopPropagation(),y(f,i)}}),label:e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Ie,{src:w.logo,sx:{width:24,height:24}}),e.jsx(g,{children:w.title||r}),M&&e.jsx(A,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),f.length>0&&e.jsx(_,{size:"small",edge:"end",children:h?e.jsx(Ve,{}):e.jsx(Ye,{})})]})]})}),f.length>0&&e.jsx(Me,{in:h,timeout:"auto",unmountOnExit:!0,children:e.jsx(Q,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:f.map(n=>{const m=`${n.type}-${n.source}`,k=!!d[m];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>j(n),children:e.jsxs(g,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:k,sx:{mr:1}}),e.jsxs(g,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Pe,{error:!0,sx:{mt:1},children:a})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=q(),[s,l]=C.useState({}),{teamDid:v}=N(),{api:T}=F(),{loading:j,error:y,eventsBySource:x}=Ze(),{control:r,handleSubmit:w,formState:{errors:f},reset:E,setValue:u,trigger:M}=ve({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[s,u,M]);const i=()=>{l({}),E(),R()},h=async m=>{const k=Object.keys(s).filter(I=>s[I]),D={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[O,L]=I.split("-");return!O||!L?null:{type:O,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:D}});z.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:D}});z.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){z.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(Ce,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(h),children:[e.jsx(Te,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Se,{children:e.jsxs(g,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Y,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!f.url,helperText:(k=f.url)==null?void 0:k.message})}}),e.jsx(Y,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!f.description,helperText:(k=f.description)==null?void 0:k.message})}}),e.jsx(Y,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!j&&x&&Object.keys(x).length>0&&e.jsx(te,{eventsBySource:x,selectedEvents:s,setSelectedEvents:l,error:(n=f.selectedEvents)==null?void 0:n.message}),!j&&(!x||Object.keys(x).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),j&&e.jsx(g,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(U,{size:20})}),y&&e.jsx(ee,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Re,{sx:{p:"8px 24px 24px"},children:[e.jsx(B,{onClick:i,children:p("common.cancel")}),e.jsx(B,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const et=(t="en")=>t==="tw"?"zh":t;function H(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Ee(t).locale(et(c)).format(d):"-"}function tt(t){return typeof t=="number"?!1:ue(t)}function ot(t){return t>=200&&t<300}function $(t){const d=tt(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(W,{title:t.tip,children:e.jsx(De,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx($e,{orientation:"vertical",flexItem:!0})]})}$.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};$.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const nt=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=F(),{t:b}=q(),{teamDid:R}=N(),{blocklet:p}=ce(),{data:s,loadMore:l,loadingMore:v,loading:T}=we(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),j=(s==null?void 0:s.list)||[],[y,x]=C.useState(null),r=nt(j);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&x(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{x(u)};if(T)return e.jsx(U,{});const f=s&&s.list.length<s.paging.total,E=u=>{var M,i,h,n,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((h=u.responseBody)!=null&&h.agentId)){const k=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,D=(p.children||[]).find(O=>{var L;return((L=O==null?void 0:O.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Qe(`https://${k}`,(D==null?void 0:D.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(_,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(g,{component:be,icon:ge})})}return null};return e.jsxs(J,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(J,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(X.Fragment,{children:[e.jsx(ze,{children:u}),M.map(i=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:H(i.createdAt,"HH:mm:ss")}),children:[e.jsx(We,{sx:{minWidth:0,mr:1.5},children:ot(i.responseStatus)===!1?e.jsx(Ae,{color:"error"}):e.jsx(Oe,{color:"success"})}),e.jsx(qe,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),f&&e.jsx(g,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(B,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(J,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(g,{children:E(y)})]}),e.jsxs(g,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(K,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(g,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(g,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function he({id:t,onClose:d}){var v,T,j,y;const{t:c}=q(),{api:a}=F(),{teamDid:b}=N(),{loading:R,error:p,data:s}=de(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(ee,{severity:"error",children:p.message}):R||!l?e.jsx(g,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(U,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(g,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(W,{title:l.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(_,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Be,{})})})]}),e.jsx(g,{mt:2,children:e.jsxs(P,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx($,{label:c("common.status"),value:e.jsx(A,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx($,{label:c("webhookEndpoint.listen"),value:e.jsx(W,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(x=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:x==null?void 0:x.type},x))}),children:e.jsx(A,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx($,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx($,{label:c("common.createdAt"),value:H(l.createdAt),divider:!0}),e.jsx($,{label:c("common.updatedAt"),value:H(l.updatedAt),divider:!0}),e.jsx($,{label:c("common.createdBy"),value:e.jsx(W,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(A,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx($,{label:c("common.updatedBy"),value:e.jsx(W,{arrow:!0,title:(j=l.updateUser)==null?void 0:j.did,children:e.jsx(A,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:l.id})})]})]})}he.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx(Le,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(g,{sx:{height:"100vh",p:3},children:e.jsx(he,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function ae(){return null}const re=X.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=q(),l=He(j=>j.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=ae),a||(T.TableFooter=ae),e.jsx(rt,{locale:s,options:{...v,...t},columns:(d||[]).map(j=>(j.options=j.options||{},j.options.filter=j.options.filter||!1,j.options.sort=j.options.sort||!1,j)),emptyNode:e.jsx(fe,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(je)`
2
2
  .MuiPaper-root {
3
3
  border-radius: 8px;
4
4
  overflow: hidden;
@@ -1,4 +1,4 @@
1
- import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m as oe}from"./vendor-hooks-DXGUREV9.js";import{j as e,aa as g,H as w,ah as H,E as pt,T as E,X as ut,al as te,ad as K,ab as O,ak as Oe,a9 as mt,I as W,O as q,q as ie,N as ft,bs as $e,cp as Me,cq as ee,bV as qe,br as We,by as ht,bt as xt,bS as gt,v as yt,y as jt,bo as vt,s as bt}from"./vendor-mui-core-B6POpIBB.js";import{u as L,aq as U,av as Ct,a2 as F,ab as xe,n as G,aQ as St,a as _,r as Tt,a4 as ge,bx as He,k as wt,ba as Pt,bR as Fe,bk as It,bw as Rt}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{z as A,l as ne,t as Ue,U as J,C as Dt,ac as kt,f as Ft,b as re,aw as At,R as Ge}from"./index-CksPySYI.js";import{w as Nt,c as Lt,O as ye,a0 as X}from"./vendor-arcblock-Dkhgjlzn.js";import{W as je}from"./did-address-C6ni99I7.js";import{u as $}from"./dashboard-CvJ8cVy-.js";import{r as ve,a as be,b as Ce,c as le,d as zt,e as Ve,u as Bt,f as _t}from"./passport-item-jrknj0MQ.js";import{p as Ye}from"./util-D-LnEy9h.js";import{w as V,P as Ke}from"./permission-PNXSTeNL.js";import{C as Et}from"./Google-C7d25Q5r.js";import{L as Z,az as Ot,J as $t}from"./vendor-utils-CjMBJT5V.js";import{E as ce}from"./EditIcon-DWRQ3fi6.js";import{C as Se}from"./confirm-BqrhdaU7.js";import{L as Ze}from"./list-header-8k1_C0K0.js";import{f as se}from"./format-error-BrmqJs5a.js";import{_ as Mt}from"./useSetState-CWq0AVWn.js";import{L as qt}from"./LockIcon-Bd69pSJI.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CXDkfohf.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./session-DLQ0rbYE.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./InfoOutlined-BjII93aR.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./use-mobile-BKvZ6hcv.js";import"./index-C-rU1lEd.js";import"./Phone-CKzC4712.js";import"./Location-BQhEvGNL.js";import"./Email-B0n6rLUZ.js";import"./Timezone-C3hiNX6j.js";import"./base32-C_EKY5vU.js";import"./cloneDeep-WT_kDeVd.js";const Ae="info";function Te({createPassportSvg:c,passport:o,onCancel:d,onSwitchPassport:f}){const{t:u}=L(),l=dt({tab:Ae}),h={info:{label:u("common.basicInfo"),value:Ae,component:()=>e.jsx(Je,{passport:o,createPassportSvg:c})},logs:{label:u("common.logs"),value:"logs",component:()=>e.jsx(et,{passport:o})},related:{label:u("team.passport.related"),value:"related",component:()=>e.jsx(tt,{passport:o,onSwitchPassport:f})}},s=Object.values(h).map(({label:n,value:t})=>({label:n,value:t})).filter(n=>n.value==="related"?o.parentDid:!0),m=h[l.tab]||h.info,a=n=>{l.tab=n};return e.jsx(U,{title:u("common.passport"),onClose:d,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Wt,{children:[e.jsx(g,{className:"tabs",children:e.jsx(Ct,{tabs:s,current:l.tab,onChange:a,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(m.component,{})})]})})}Te.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};Te.defaultProps={onSwitchPassport:()=>{}};const Wt=H(g)`
1
+ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,m as oe}from"./vendor-hooks-DXGUREV9.js";import{j as e,aa as g,H as w,ah as H,E as pt,T as E,X as ut,al as te,ad as K,ab as O,ak as Oe,a9 as mt,I as W,O as q,q as ie,N as ft,bs as $e,cp as Me,cq as ee,bV as qe,br as We,by as ht,bt as xt,bS as gt,v as yt,y as jt,bo as vt,s as bt}from"./vendor-mui-core-B6POpIBB.js";import{u as L,aq as U,av as Ct,a2 as F,ab as xe,n as G,aQ as St,a as _,r as Tt,a4 as ge,bx as He,k as wt,ba as Pt,bR as Fe,bk as It,bw as Rt}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{z as A,l as ne,t as Ue,U as J,C as Dt,ac as kt,f as Ft,b as re,aw as At,R as Ge}from"./index-CksPySYI.js";import{w as Nt,c as Lt,O as ye,a0 as X}from"./vendor-arcblock-Dkhgjlzn.js";import{W as je}from"./did-address-C6ni99I7.js";import{u as $}from"./dashboard-CvJ8cVy-.js";import{r as ve,a as be,b as Ce,c as le,d as zt,e as Ve,u as Bt,f as _t}from"./passport-item-jrknj0MQ.js";import{p as Ye}from"./util-D-LnEy9h.js";import{w as V,P as Ke}from"./permission-PNXSTeNL.js";import{C as Et}from"./Google-C7d25Q5r.js";import{L as Z,az as Ot,J as $t}from"./vendor-utils-CjMBJT5V.js";import{E as ce}from"./EditIcon-DWRQ3fi6.js";import{C as Se}from"./confirm-BqrhdaU7.js";import{L as Ze}from"./list-header-8k1_C0K0.js";import{f as se}from"./format-error-BrmqJs5a.js";import{_ as Mt}from"./useSetState-CWq0AVWn.js";import{L as qt}from"./LockIcon-Bd69pSJI.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CXDkfohf.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./session-DLQ0rbYE.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./InfoOutlined-BjII93aR.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./use-mobile-BNUwcWCH.js";import"./index-C-rU1lEd.js";import"./Phone-CKzC4712.js";import"./Location-BQhEvGNL.js";import"./Email-B0n6rLUZ.js";import"./Timezone-C3hiNX6j.js";import"./base32-C_EKY5vU.js";import"./cloneDeep-WT_kDeVd.js";const Ae="info";function Te({createPassportSvg:c,passport:o,onCancel:d,onSwitchPassport:f}){const{t:u}=L(),l=dt({tab:Ae}),h={info:{label:u("common.basicInfo"),value:Ae,component:()=>e.jsx(Je,{passport:o,createPassportSvg:c})},logs:{label:u("common.logs"),value:"logs",component:()=>e.jsx(et,{passport:o})},related:{label:u("team.passport.related"),value:"related",component:()=>e.jsx(tt,{passport:o,onSwitchPassport:f})}},s=Object.values(h).map(({label:n,value:t})=>({label:n,value:t})).filter(n=>n.value==="related"?o.parentDid:!0),m=h[l.tab]||h.info,a=n=>{l.tab=n};return e.jsx(U,{title:u("common.passport"),onClose:d,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Wt,{children:[e.jsx(g,{className:"tabs",children:e.jsx(Ct,{tabs:s,current:l.tab,onChange:a,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(m.component,{})})]})})}Te.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};Te.defaultProps={onSwitchPassport:()=>{}};const Wt=H(g)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {
@@ -1,4 +1,4 @@
1
- import{u as ne,a2 as U,c1 as Ee,c2 as ze,I as K,b$ as Ue,c0 as We,ah as Me,ag as _e,c3 as Ve,b7 as Ie,n as pe,r as $e,b5 as X,c4 as he,aq as ge,a as E,bP as Ne,aa as Je,c5 as He,ab as Ke,a7 as Ge,a4 as Ze,av as De}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-DXGUREV9.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 oe,X as re,ah as Pe,al as H,cJ as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-B6POpIBB.js";import{a8 as tt,O as Ce,V as nt,c as st}from"./vendor-arcblock-Dkhgjlzn.js";import{p as Y,a7 as at,c as qe,D as ot,n as Z,aI as rt,A as it,b as lt}from"./vendor-utils-CjMBJT5V.js";import{z as J,C as $,E as ae,F as I,aD as Fe}from"./index-CksPySYI.js";import{S as ie}from"./switch-control-yJOWKqcv.js";import{S as D}from"./dashboard-CvJ8cVy-.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-D_z5kVUS.js";import{b as ut}from"./base32-C_EKY5vU.js";import{u as mt}from"./use-mobile-BNUwcWCH.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CXDkfohf.js";import"./confirm-BqrhdaU7.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./session-DLQ0rbYE.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./InfoOutlined-BjII93aR.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BKvZ6hcv.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}=ae({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async o=>{var T,a;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:o})}}),u=Object.assign({...le},((a=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.domainDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(o=>o!=null&&o.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:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:o})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[o.name],helperText:((T=c.errors[o.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:o})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[o.name],helperText:((T=c.errors[o.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:o})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[o.name],helperText:((T=c.errors[o.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}=ae({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.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 o;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.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 o;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:((o=c.errors[i.name])==null?void 0:o.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}=ae({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.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 o;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.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 o;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:((o=c.errors[i.name])==null?void 0:o.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,o,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=(o=r==null?void 0:r.settings)==null?void 0:o.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async a=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),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(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(a=>a!=null&&a.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:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((j=c.errors[a.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 o=y.index,T=s;if(o===T)return;const a=(_=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-a.top;o<T&&A<u||o>T&&A>u||(w(o,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(oe,{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 a,j;const{api:S}=J(),{blocklet:r}=$(),n=(a=r==null?void 0:r.meta)==null?void 0:a.did,s=at({},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}=ae({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:o}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:ot(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(oe,{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(oe,{onClick:()=>o(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,a2 as U,c1 as Ee,c2 as ze,I as K,b$ as Ue,c0 as We,ah as Me,ag as _e,c3 as Ve,b7 as Ie,n as pe,r as $e,b5 as X,c4 as he,aq as ge,a as E,bP as Ne,aa as Je,c5 as He,ab as Ke,a7 as Ge,a4 as Ze,av as De}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-DXGUREV9.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 oe,X as re,ah as Pe,al as H,cJ as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-B6POpIBB.js";import{a8 as tt,O as Ce,V as nt,c as st}from"./vendor-arcblock-Dkhgjlzn.js";import{p as Y,a7 as at,c as qe,D as ot,n as Z,aI as rt,A as it,b as lt}from"./vendor-utils-CjMBJT5V.js";import{z as J,C as $,E as ae,F as I,aD as Fe}from"./index-CksPySYI.js";import{S as ie}from"./switch-control-yJOWKqcv.js";import{S as D}from"./dashboard-CvJ8cVy-.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-D_z5kVUS.js";import{b as ut}from"./base32-C_EKY5vU.js";import{u as mt}from"./use-mobile-BKvZ6hcv.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CXDkfohf.js";import"./confirm-BqrhdaU7.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-zDVVYX6u.js";import"./get-safe-url-cyoeQ7Mw.js";import"./session-DLQ0rbYE.js";import"./use-blocklet-logo-BOYeM9RY.js";import"./InfoOutlined-BjII93aR.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BNUwcWCH.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}=ae({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async o=>{var T,a;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:o})}}),u=Object.assign({...le},((a=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.domainDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(o=>o!=null&&o.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:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:o})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[o.name],helperText:((T=c.errors[o.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:o})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[o.name],helperText:((T=c.errors[o.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:o})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[o.name],helperText:((T=c.errors[o.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}=ae({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.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 o;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.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 o;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:((o=c.errors[i.name])==null?void 0:o.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}=ae({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.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 o;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.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 o;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:((o=c.errors[i.name])==null?void 0:o.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,o,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=(o=r==null?void 0:r.settings)==null?void 0:o.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async a=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),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(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(a=>a!=null&&a.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:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.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:a})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((j=c.errors[a.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 o=y.index,T=s;if(o===T)return;const a=(_=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-a.top;o<T&&A<u||o>T&&A>u||(w(o,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(oe,{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 a,j;const{api:S}=J(),{blocklet:r}=$(),n=(a=r==null?void 0:r.meta)==null?void 0:a.did,s=at({},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}=ae({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:o}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:ot(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(oe,{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(oe,{onClick:()=>o(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 {