@abtnode/blocklet-services 1.16.43-beta-20250510-043647-0f042010 → 1.16.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{u as ne,_ as U,c0 as Ee,c1 as ze,I as K,b_ as Ue,b$ as We,ad as Me,ac as _e,c2 as Ve,b4 as Ie,j as pe,r as $e,b2 as X,c3 as he,am as ge,B as E,bO as Ne,a6 as Je,c4 as He,a7 as Ke,a3 as Ge,a0 as Ze,as as De}from"./vendor-ux-did-connect-TEE6cGq6.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-rDgu5KV9.js";import{r as R}from"./vendor-react-DEoibe3W.js";import{j as e,aa as m,bt as W,bp as z,O,y as V,H as N,T as xe,I as ae,X as re,ah as Pe,al as H,cI as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-UZpb7wT7.js";import{a7 as tt,M as Ce,T as nt,c as st}from"./vendor-arcblock-CN2B_oTr.js";import{J as Y,a8 as ot,c as qe,D as at,n as Z,aJ as rt,A as it,b as lt}from"./vendor-utils-rHXShPKm.js";import{z as J,C as $,E as oe,F as I,aD as Fe}from"./index-u-w3iMC9.js";import{S as ie}from"./switch-control-D6CqAlDY.js";import{S as D}from"./dashboard-C124DXmc.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-C0SLCehH.js";import{b as ut}from"./base32-BbrXtXL6.js";import{u as mt}from"./use-mobile-Bh8CHBbH.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAjFH6d8.js";const le={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...le},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async a=>{var T,o;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:a})}}),u=Object.assign({...le},((o=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:o.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.domainDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ht(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ce},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ft(){var i,a,T;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...ue},((T=(a=r==null?void 0:r.settings)==null?void 0:a.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async o=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:o})}}),A=Object.assign({...ue},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const gt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=Ee({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const a=y.index,T=s;if(a===T)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-o.top;a<T&&A<u||a>T&&A>u||(w(a,T),y.index=T)}}),[{isDragging:x},g]=ze({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:gt})}),e.jsx(xe,{sx:{flex:1},children:S}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:ct,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!1};const jt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:tt}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:Me}),component:e.jsx(xt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:_e}),component:e.jsx(ft,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ve}),component:e.jsx(pt,{})}],bt=["github","google","apple","auth0"];function vt(){var k,L;const{api:S}=J(),{blocklet:r}=$(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of bt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...jt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ue,{backend:We,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const G={ttl:pe.SESSION_TTL,cacheTtl:pe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(nt,{...S,sx:{transform:"scale(0.75)"}})}function me(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function yt(){var o,j;const{api:S}=J(),{blocklet:r}=$(),n=(o=r==null?void 0:r.meta)==null?void 0:o.did,s=ot({},G,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=G.ttl),qe(s.cacheTtl)&&(s.cacheTtl=G.cacheTtl),s.phone||(s.phone=G.phone),s.email||(s.email=G.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=oe({defaultValues:Y(me(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:a}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:at(me(u,!0),["phone"])}}),_=Object.assign({},G,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(me(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(St,{onSubmit:w(T),children:e.jsxs(H,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(H,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(H,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>b(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>a(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(H,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(H,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(z,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(Xe,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const St=Pe.form`
1
+ import{u as ne,_ as U,c0 as Ee,c1 as ze,I as K,b_ as Ue,b$ as We,ad as Me,ac as _e,c2 as Ve,b4 as Ie,j as pe,r as $e,b2 as X,c3 as he,am as ge,B as E,bO as Ne,a6 as Je,c4 as He,a7 as Ke,a3 as Ge,a0 as Ze,as as De}from"./vendor-ux-did-connect-TEE6cGq6.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-rDgu5KV9.js";import{r as R}from"./vendor-react-DEoibe3W.js";import{j as e,aa as m,bt as W,bp as z,O,y as V,H as N,T as xe,I as ae,X as re,ah as Pe,al as H,cI as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-UZpb7wT7.js";import{a7 as tt,M as Ce,T as nt,c as st}from"./vendor-arcblock-CN2B_oTr.js";import{J as Y,a8 as ot,c as qe,D as at,n as Z,aJ as rt,A as it,b as lt}from"./vendor-utils-rHXShPKm.js";import{z as J,C as $,E as oe,F as I,aD as Fe}from"./index-u-w3iMC9.js";import{S as ie}from"./switch-control-D6CqAlDY.js";import{S as D}from"./dashboard-C124DXmc.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-C0SLCehH.js";import{b as ut}from"./base32-BbrXtXL6.js";import{u as mt}from"./use-mobile-BAjFH6d8.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";const le={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...le},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async a=>{var T,o;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:a})}}),u=Object.assign({...le},((o=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:o.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.domainDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:a})=>{var T;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ht(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ce},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ft(){var i,a,T;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...ue},((T=(a=r==null?void 0:r.settings)==null?void 0:a.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async o=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:o})}}),A=Object.assign({...ue},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:o})=>{var j;return e.jsx(z,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const gt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=Ee({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const a=y.index,T=s;if(a===T)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-o.top;a<T&&A<u||a>T&&A>u||(w(a,T),y.index=T)}}),[{isDragging:x},g]=ze({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:gt})}),e.jsx(xe,{sx:{flex:1},children:S}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:ct,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!1};const jt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:tt}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:Me}),component:e.jsx(xt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:_e}),component:e.jsx(ft,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ve}),component:e.jsx(pt,{})}],bt=["github","google","apple","auth0"];function vt(){var k,L;const{api:S}=J(),{blocklet:r}=$(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of bt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...jt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ue,{backend:We,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const G={ttl:pe.SESSION_TTL,cacheTtl:pe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(nt,{...S,sx:{transform:"scale(0.75)"}})}function me(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function yt(){var o,j;const{api:S}=J(),{blocklet:r}=$(),n=(o=r==null?void 0:r.meta)==null?void 0:o.did,s=ot({},G,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=G.ttl),qe(s.cacheTtl)&&(s.cacheTtl=G.cacheTtl),s.phone||(s.phone=G.phone),s.email||(s.email=G.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=oe({defaultValues:Y(me(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:a}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:at(me(u,!0),["phone"])}}),_=Object.assign({},G,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(me(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(St,{onSubmit:w(T),children:e.jsxs(H,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(H,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(H,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>b(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>a(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(H,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(H,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(z,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(Xe,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const St=Pe.form`
2
2
  max-width: 1536px;
3
3
 
4
4
  .advanced-config {
@@ -1,4 +1,4 @@
1
- import{r as P,t as gn,g as hn,e as vt,a as xn}from"./vendor-react-DEoibe3W.js";import{a9 as At,j as e,aa as E,bp as _e,bs as Ue,bo as Be,q as be,T as Z,O as pe,ab as ae,by as We,ak as ie,H as b,ah as M,e as yn,ad as Ce,w as vn,y as Lt,b5 as bn,b6 as Cn,I as jn,bh as Sn,bt as wn,bS as Pn}from"./vendor-mui-core-UZpb7wT7.js";import{B as bt,e as Fe,$ as kn,ay as In,n as Ct,A as Tn,b as Dn}from"./vendor-utils-rHXShPKm.js";import{r as Et,aJ as Ot,bz as Rn,h as An,u as V,Z as Ln,Y as En,am as te,B as z,e as On,ao as Nn,d as _n,b2 as ue,_ as G,bp as Un,j as ne,a0 as Nt,ai as Bn,I as Fn,as as $n,b4 as Wn,a7 as _t,a6 as Ut,bv as zn,X as Mn}from"./vendor-ux-did-connect-TEE6cGq6.js";import{c as Y,a as qn,W as Bt,M as je,G as Hn,X as Vn}from"./vendor-arcblock-CN2B_oTr.js";import{d as Kn}from"./ViewList-B4hmqizo.js";import{a1 as Zn,f as Yn,z as H,at as ze,l as se,a2 as Qn,U as re,au as Gn,C as Ft,av as $t,t as Jn,b as Xn}from"./index-u-w3iMC9.js";import{U as Wt,C as zt,I as es}from"./index-Ce2NSVmU.js";import{k as ts,u as Me,a as qe,l as ns,f as ss}from"./vendor-hooks-rDgu5KV9.js";import{l as rs}from"./index-CHDiquXf.js";import{u as K,d as jt,W as Mt}from"./dashboard-C124DXmc.js";import{W as He}from"./did-address-BKBBjFqv.js";import{P as Q}from"./permission-BkNXA8B5.js";import{C as ke}from"./click-to-copy-BxhgzyYL.js";import{T as qt}from"./index-BmWVfEGP.js";import{f as J}from"./format-error-BrmqJs5a.js";import{_ as os}from"./useAsync-DV3NyLhI.js";import{I as q}from"./index-C0SLCehH.js";import{d as is}from"./DeleteOutline-B6efX_Fy.js";import{C as fe}from"./confirm-BvUfAlkx.js";import{u as ge}from"./session-6XaVDQaE.js";import{i as Ht,a as Se,p as Vt}from"./util-Bg0WSJ-t.js";import{b as as}from"./sdk-7yPC_DtN.js";import{A as ls}from"./actions-BCWb2ez1.js";import{S as cs}from"./shorten-label-Dq7bVuNa.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAjFH6d8.js";import"./vendor-mui-x-whuSO90H.js";import"./AdapterDayjs-BiPHzcUP.js";import"./base32-BbrXtXL6.js";import"./MoreHoriz-BxJelL2A.js";var Ve={},ds=At;Object.defineProperty(Ve,"__esModule",{value:!0});var Kt=Ve.default=void 0,ms=ds(Et()),ps=e;Kt=Ve.default=(0,ms.default)((0,ps.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 Ke=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.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"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ke.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ke.displayName="person";const us=Ke;var Ze=function(t){return e.jsxs("svg",{...t,children:[e.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"}),e.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"}),e.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"}),e.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"})]})};Ze.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Ze.displayName="external-issuer";const Zt=Ze;var ve={},fs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Yt="%[a-f0-9]{2}",St=new RegExp("("+Yt+")|([^%]+?)","gi"),wt=new RegExp("("+Yt+")+","gi");function $e(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),u=t.slice(r);return Array.prototype.concat.call([],$e(l),$e(u))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(St)||[],l=1;l<r.length;l++)t=$e(r,l).join(""),r=t.match(St)||[];return t}}function hs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=wt.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var u=gs(l[0]);u!==l[0]&&(r[l[0]]=u)}l=wt.exec(t)}r["%C2"]="�";for(var m=Object.keys(r),g=0;g<m.length;g++){var w=m[g];t=t.replace(new RegExp(w,"g"),r[w])}return t}var xs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return hs(t)}},ys=(t,r)=>{if(!(typeof t=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r==="")return[t];const l=t.indexOf(r);return l===-1?[t]:[t.slice(0,l),t.slice(l+r.length)]},vs=function(t,r){for(var l={},u=Object.keys(t),m=Array.isArray(r),g=0;g<u.length;g++){var w=u[g],p=t[w];(m?r.indexOf(w)!==-1:r(w,p,t))&&(l[w]=p)}return l};(function(t){const r=fs,l=xs,u=ys,m=vs,g=n=>n==null;function w(n){switch(n.arrayFormat){case"index":return s=>(a,c)=>{const x=a.length;return c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[",x,"]"].join("")]:[...a,[h(s,n),"[",h(x,n),"]=",h(c,n)].join("")]};case"bracket":return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[]"].join("")]:[...a,[h(s,n),"[]=",h(c,n)].join("")];case"comma":case"separator":return s=>(a,c)=>c==null||c.length===0?a:a.length===0?[[h(s,n),"=",h(c,n)].join("")]:[[a,h(c,n)].join(n.arrayFormatSeparator)];default:return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,h(s,n)]:[...a,[h(s,n),"=",h(c,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(a,c,x)=>{if(s=/\[(\d*)\]$/.exec(a),a=a.replace(/\[\d*\]$/,""),!s){x[a]=c;return}x[a]===void 0&&(x[a]={}),x[a][s[1]]=c};case"bracket":return(a,c,x)=>{if(s=/(\[\])$/.exec(a),a=a.replace(/\[\]$/,""),!s){x[a]=c;return}if(x[a]===void 0){x[a]=[c];return}x[a]=[].concat(x[a],c)};case"comma":case"separator":return(a,c,x)=>{const v=typeof c=="string"&&c.includes(n.arrayFormatSeparator),S=typeof c=="string"&&!v&&i(c,n).includes(n.arrayFormatSeparator);c=S?i(c,n):c;const _=v||S?c.split(n.arrayFormatSeparator).map(B=>i(B,n)):c===null?c:i(c,n);x[a]=_};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function y(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(n,s){return s.encode?s.strict?r(n):encodeURIComponent(n):n}function i(n,s){return s.decode?l(n):n}function I(n){return Array.isArray(n)?n.sort():typeof n=="object"?I(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function j(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function o(n){n=j(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function T(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function d(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),y(s.arrayFormatSeparator);const a=p(s),c=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return c;for(const x of n.split("&")){if(x==="")continue;let[v,S]=u(s.decode?x.replace(/\+/g," "):x,"=");S=S===void 0?null:["comma","separator"].includes(s.arrayFormat)?S:i(S,s),a(i(v,s),S,c)}for(const x of Object.keys(c)){const v=c[x];if(typeof v=="object"&&v!==null)for(const S of Object.keys(v))v[S]=T(v[S],s);else c[x]=T(v,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,v)=>{const S=c[v];return S&&typeof S=="object"&&!Array.isArray(S)?x[v]=I(S):x[v]=S,x},Object.create(null))}t.extract=o,t.parse=d,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),y(s.arrayFormatSeparator);const a=S=>s.skipNull&&g(n[S])||s.skipEmptyString&&n[S]==="",c=w(s),x={};for(const S of Object.keys(n))a(S)||(x[S]=n[S]);const v=Object.keys(x);return s.sort!==!1&&v.sort(s.sort),v.map(S=>{const _=n[S];return _===void 0?"":_===null?h(S,s):Array.isArray(_)?_.reduce(c(S),[]).join("&"):h(S,s)+"="+h(_,s)}).filter(S=>S.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=u(n,"#");return Object.assign({url:a.split("?")[0]||"",query:d(o(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:i(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=j(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),v=Object.assign(x,n.query);let S=t.stringify(v,s);S&&(S=`?${S}`);let _=k(n.url);return n.fragmentIdentifier&&(_=`#${h(n.fragmentIdentifier,s)}`),`${a}${S}${_}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:v}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:m(x,s),fragmentIdentifier:v},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,v)=>!s(x,v);return t.pick(n,c,a)}})(ve);const ce=gn,bs={parseNumbers:!1,parseBooleans:!1},Cs={skipNull:!1,skipEmptyString:!1},js=(t,r)=>{var l,u;const{navigateMode:m="push",parseOptions:g,stringifyOptions:w}={},p=Object.assign(Object.assign({},bs),g),y=Object.assign(Object.assign({},Cs),w),h=ce.useLocation(),i=(l=ce.useHistory)===null||l===void 0?void 0:l.call(ce),I=(u=ce.useNavigate)===null||u===void 0?void 0:u.call(ce),j=ts(),k=P.useRef(typeof t=="function"?t():t||{}),o=P.useMemo(()=>ve.parse(h.search,p),[h.search]),T=P.useMemo(()=>Object.assign(Object.assign({},k.current),o),[o]);return[T,Me(n=>{const s=typeof n=="function"?n(T):n;j(),i&&i[m]({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},h.state),I&&I({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},{replace:m==="replace",state:h.state})})]},Ss=js,ws=Ot,Ee=Rn,Oe=An,Ps=rs,Pt={role:ws.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,u)=>{let m=l||Pt;const g=(0,Oe.isEthereumType)((0,Oe.DidType)(l));if(g?m=(0,Ee.WalletType)(l):m=(0,Ee.WalletType)(Pt),!(0,Oe.isValid)(t)){let w="";try{return g?w=t.slice(0,66):w=t,(0,Ee.fromSecretKey)(w,m)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ps.fromAppDid)(t,r,m,u||0)};var Is=ks,Qt=vt&&vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const de=Qt(Zn),Ts=Ot,xe=Qt(Is),Ds=Yn,Rs=(t,r,{returnWallet:l=!0}={})=>{var B,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,de.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:m=[]}=t,g=[...m,...u],w=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),y=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:I}=t.meta,j=(0,Ds.getDisplayName)(t),k=(0,de.default)(w,"value",t.meta.description),o=(0,de.default)(p,"value","auto"),T=(0,de.default)(y,"value",""),d=(0,de.default)(h,"value","");if(!l)return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:"",wallet:null,permanentWallet:null,tenantMode:d};const n=g.find(D=>D.key==="BLOCKLET_APP_SK"),s=g.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||g.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),a=g.find(D=>D.key==="BLOCKLET_APP_PSK");let c;s&&(s.value==="ethereum"||s.value==="eth")&&(c=s.value);let x=null,v=null;if(n&&n.value)x=(0,xe.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(v=(0,xe.default)(a.value,void 0,c));else{if(!r||typeof r!="string")throw new Error("Node secret key must be a string");s?x=(0,xe.default)(t.meta.did,r,c):x=(0,xe.default)(t.meta.did,r)}const S=((R=(B=t.settings)==null?void 0:B.session)==null?void 0:R.salt)||"",_=Ts.Hasher.SHA3.hash256(bt.concat([x.secretKey,x.address,S].filter(Boolean).map(D=>bt.from(D))));return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:_,wallet:x,permanentWallet:v||x,tenantMode:d}};var As=Rs;const Ls=hn(As);function Ye({teamDid:t,roles:r,apps:l,onCancel:u,onSuccess:m,onError:g,endpoint:w}){var T;const{api:p}=H(),{t:y,locale:h}=V(),i=qe({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),I=async()=>{if(!i.role){i.error=y("team.member.error.passportEmpty");return}const d=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:d,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:a}=await p.createMemberInvitation({input:s});i.inviteInfo=a,i.activeStep=1}catch(n){const s=J(n);i.error=s,g(n)}finally{i.loading=!1}},j=r.find(d=>d.name===i.role),o=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(_e,{fullWidth:!0,children:[e.jsx(Ue,{children:y("common.sourceApp")}),e.jsx(Be,{value:i.sourceAppPid,onChange:d=>{i.error=null,i.sourceAppPid=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,children:l.map(d=>e.jsx(be,{value:d.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Ln,{did:d.appPid,size:28}),d.appName]}),e.jsx(En,{did:d.appPid,compact:!0,responsive:!1})]})},d.appPid))})]}):null,e.jsxs(_e,{fullWidth:!0,variant:"outlined",children:[e.jsx(Ue,{children:y("common.passport")}),e.jsx(Be,{"data-cy":"invite-member-select-role",value:i.role,onChange:d=>{i.error=null,i.role=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,onKeyPress:d=>{d.key==="Enter"&&(d.preventDefault(),I())},children:r.filter(d=>d.name!=="owner").map(d=>e.jsx(be,{value:d.name,"data-cy":`invite-member-select-option-${d.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Z,{variant:"subtitle1",children:d.title||d.name}),e.jsx(Z,{variant:"caption",sx:{opacity:.7},children:d.description})]})},d.name))})]}),((T=j==null?void 0:j.extra)==null?void 0:T.display)==="custom"&&e.jsx(pe,{label:y("common.display"),type:"url",value:i.display,onChange:d=>{i.error=null,i.display=d.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(pe,{label:y("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:d=>{i.error=null,i.remark=d.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(qt,{value:i.passportExpireTime,onChange:d=>{i.passportExpireTime=d}})]}),cancel:y("common.cancel"),confirm:y("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:I},{body:()=>{var n,s;const d=ze({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:w});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:y("team.member.inviteDialog.createSuccessTip",{expireDate:se((s=i.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:d})]})},confirm:y("common.confirm"),onConfirm:m}][i.activeStep];return e.jsxs(te,{title:y("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[o.cancel&&e.jsx(z,{onClick:o.onCancel,color:"inherit",children:o.cancel}),e.jsxs(z,{onClick:o.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ae,{size:16}),o.confirm]})]}),children:[e.jsx(We,{component:"div",children:typeof o.body=="function"?o.body():o.body}),!!i.error&&e.jsx(ie,{severity:"error",variant:"icon",children:i.error})]})}Ye.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};Ye.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Qe({teamDid:t,onCancel:r,onSuccess:l,onError:u,endpoint:m}){const{api:g,info:w}=H(),{api:p}=P.useContext(On),[y,h]=P.useState(!1),{t:i,locale:I}=V(),[j,k]=P.useState(""),[o,T]=P.useState(!1),[d,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),v=!!Fe(w,"ownerNft.did"),S=os(async()=>{if(v){const{state:L}=await g.getDelegationState();return L}return{delegated:!0}});if(S.loading)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ae,{})})});if(S.error)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(ie,{severity:"error",variant:"icon",children:J(S.error)})});const _=async()=>{k(null),h(!0);try{const{inviteInfo:L}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(L),n(D.length-1)}catch(L){const $=J(L);k($),u(L)}finally{h(!1)}},B=()=>{T(!0),n(1)},R=()=>{T(!1),n(0)},D=[{body:e.jsxs(Z,{component:"div",children:[e.jsxs(ie,{severity:"warning",children:[e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(ie,{severity:"warning",children:e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(pe,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:L=>{k(null),x(L.target.value)},disabled:y,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:v&&!Fe(S,"value.delegated")?B:_},{body:()=>e.jsx(Nn,{action:"delegate-transfer-nft",open:o,locale:I,checkFn:p.get,onClose:R,onSuccess:_,checkTimeout:5*60*1e3,webWalletUrl:Qn(w),extraParams:{targetDID:w.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const L=ze({inviteId:s.inviteId,endpoint:m});return e.jsxs("div",{children:[e.jsx(Es,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:se(s.expireDate,I)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:L})]})},confirm:i("common.confirm"),onConfirm:l}],O=D[d];return e.jsxs(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(z,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(z,{onClick:O.onConfirm,color:"primary",disabled:y,variant:"contained",autoFocus:!0,children:[y&&e.jsx(ae,{size:16}),O.confirm]})]}),children:[e.jsx(We,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!j&&e.jsx(ie,{severity:"error",variant:"icon",children:j})]})}Qe.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};Qe.defaultProps={onError:()=>{},endpoint:""};const Es=M.div`
1
+ import{r as P,t as gn,g as hn,e as vt,a as xn}from"./vendor-react-DEoibe3W.js";import{a9 as At,j as e,aa as E,bp as _e,bs as Ue,bo as Be,q as be,T as Z,O as pe,ab as ae,by as We,ak as ie,H as b,ah as M,e as yn,ad as Ce,w as vn,y as Lt,b5 as bn,b6 as Cn,I as jn,bh as Sn,bt as wn,bS as Pn}from"./vendor-mui-core-UZpb7wT7.js";import{B as bt,e as Fe,$ as kn,ay as In,n as Ct,A as Tn,b as Dn}from"./vendor-utils-rHXShPKm.js";import{r as Et,aJ as Ot,bz as Rn,h as An,u as V,Z as Ln,Y as En,am as te,B as z,e as On,ao as Nn,d as _n,b2 as ue,_ as G,bp as Un,j as ne,a0 as Nt,ai as Bn,I as Fn,as as $n,b4 as Wn,a7 as _t,a6 as Ut,bv as zn,X as Mn}from"./vendor-ux-did-connect-TEE6cGq6.js";import{c as Y,a as qn,W as Bt,M as je,G as Hn,X as Vn}from"./vendor-arcblock-CN2B_oTr.js";import{d as Kn}from"./ViewList-B4hmqizo.js";import{a1 as Zn,f as Yn,z as H,at as ze,l as se,a2 as Qn,U as re,au as Gn,C as Ft,av as $t,t as Jn,b as Xn}from"./index-u-w3iMC9.js";import{U as Wt,C as zt,I as es}from"./index-Ce2NSVmU.js";import{k as ts,u as Me,a as qe,l as ns,f as ss}from"./vendor-hooks-rDgu5KV9.js";import{l as rs}from"./index-CHDiquXf.js";import{u as K,d as jt,W as Mt}from"./dashboard-C124DXmc.js";import{W as He}from"./did-address-BKBBjFqv.js";import{P as Q}from"./permission-BkNXA8B5.js";import{C as ke}from"./click-to-copy-BxhgzyYL.js";import{T as qt}from"./index-BmWVfEGP.js";import{f as J}from"./format-error-BrmqJs5a.js";import{_ as os}from"./useAsync-DV3NyLhI.js";import{I as q}from"./index-C0SLCehH.js";import{d as is}from"./DeleteOutline-B6efX_Fy.js";import{C as fe}from"./confirm-BvUfAlkx.js";import{u as ge}from"./session-6XaVDQaE.js";import{i as Ht,a as Se,p as Vt}from"./util-Bg0WSJ-t.js";import{b as as}from"./sdk-7yPC_DtN.js";import{A as ls}from"./actions-BCWb2ez1.js";import{S as cs}from"./shorten-label-Dq7bVuNa.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./vendor-mui-x-whuSO90H.js";import"./AdapterDayjs-BiPHzcUP.js";import"./base32-BbrXtXL6.js";import"./MoreHoriz-BxJelL2A.js";var Ve={},ds=At;Object.defineProperty(Ve,"__esModule",{value:!0});var Kt=Ve.default=void 0,ms=ds(Et()),ps=e;Kt=Ve.default=(0,ms.default)((0,ps.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 Ke=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.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"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ke.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ke.displayName="person";const us=Ke;var Ze=function(t){return e.jsxs("svg",{...t,children:[e.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"}),e.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"}),e.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"}),e.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"})]})};Ze.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Ze.displayName="external-issuer";const Zt=Ze;var ve={},fs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Yt="%[a-f0-9]{2}",St=new RegExp("("+Yt+")|([^%]+?)","gi"),wt=new RegExp("("+Yt+")+","gi");function $e(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),u=t.slice(r);return Array.prototype.concat.call([],$e(l),$e(u))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(St)||[],l=1;l<r.length;l++)t=$e(r,l).join(""),r=t.match(St)||[];return t}}function hs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=wt.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var u=gs(l[0]);u!==l[0]&&(r[l[0]]=u)}l=wt.exec(t)}r["%C2"]="�";for(var m=Object.keys(r),g=0;g<m.length;g++){var w=m[g];t=t.replace(new RegExp(w,"g"),r[w])}return t}var xs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return hs(t)}},ys=(t,r)=>{if(!(typeof t=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r==="")return[t];const l=t.indexOf(r);return l===-1?[t]:[t.slice(0,l),t.slice(l+r.length)]},vs=function(t,r){for(var l={},u=Object.keys(t),m=Array.isArray(r),g=0;g<u.length;g++){var w=u[g],p=t[w];(m?r.indexOf(w)!==-1:r(w,p,t))&&(l[w]=p)}return l};(function(t){const r=fs,l=xs,u=ys,m=vs,g=n=>n==null;function w(n){switch(n.arrayFormat){case"index":return s=>(a,c)=>{const x=a.length;return c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[",x,"]"].join("")]:[...a,[h(s,n),"[",h(x,n),"]=",h(c,n)].join("")]};case"bracket":return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[]"].join("")]:[...a,[h(s,n),"[]=",h(c,n)].join("")];case"comma":case"separator":return s=>(a,c)=>c==null||c.length===0?a:a.length===0?[[h(s,n),"=",h(c,n)].join("")]:[[a,h(c,n)].join(n.arrayFormatSeparator)];default:return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,h(s,n)]:[...a,[h(s,n),"=",h(c,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(a,c,x)=>{if(s=/\[(\d*)\]$/.exec(a),a=a.replace(/\[\d*\]$/,""),!s){x[a]=c;return}x[a]===void 0&&(x[a]={}),x[a][s[1]]=c};case"bracket":return(a,c,x)=>{if(s=/(\[\])$/.exec(a),a=a.replace(/\[\]$/,""),!s){x[a]=c;return}if(x[a]===void 0){x[a]=[c];return}x[a]=[].concat(x[a],c)};case"comma":case"separator":return(a,c,x)=>{const v=typeof c=="string"&&c.includes(n.arrayFormatSeparator),S=typeof c=="string"&&!v&&i(c,n).includes(n.arrayFormatSeparator);c=S?i(c,n):c;const _=v||S?c.split(n.arrayFormatSeparator).map(B=>i(B,n)):c===null?c:i(c,n);x[a]=_};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function y(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(n,s){return s.encode?s.strict?r(n):encodeURIComponent(n):n}function i(n,s){return s.decode?l(n):n}function I(n){return Array.isArray(n)?n.sort():typeof n=="object"?I(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function j(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function o(n){n=j(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function T(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function d(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),y(s.arrayFormatSeparator);const a=p(s),c=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return c;for(const x of n.split("&")){if(x==="")continue;let[v,S]=u(s.decode?x.replace(/\+/g," "):x,"=");S=S===void 0?null:["comma","separator"].includes(s.arrayFormat)?S:i(S,s),a(i(v,s),S,c)}for(const x of Object.keys(c)){const v=c[x];if(typeof v=="object"&&v!==null)for(const S of Object.keys(v))v[S]=T(v[S],s);else c[x]=T(v,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,v)=>{const S=c[v];return S&&typeof S=="object"&&!Array.isArray(S)?x[v]=I(S):x[v]=S,x},Object.create(null))}t.extract=o,t.parse=d,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),y(s.arrayFormatSeparator);const a=S=>s.skipNull&&g(n[S])||s.skipEmptyString&&n[S]==="",c=w(s),x={};for(const S of Object.keys(n))a(S)||(x[S]=n[S]);const v=Object.keys(x);return s.sort!==!1&&v.sort(s.sort),v.map(S=>{const _=n[S];return _===void 0?"":_===null?h(S,s):Array.isArray(_)?_.reduce(c(S),[]).join("&"):h(S,s)+"="+h(_,s)}).filter(S=>S.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=u(n,"#");return Object.assign({url:a.split("?")[0]||"",query:d(o(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:i(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=j(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),v=Object.assign(x,n.query);let S=t.stringify(v,s);S&&(S=`?${S}`);let _=k(n.url);return n.fragmentIdentifier&&(_=`#${h(n.fragmentIdentifier,s)}`),`${a}${S}${_}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:v}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:m(x,s),fragmentIdentifier:v},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,v)=>!s(x,v);return t.pick(n,c,a)}})(ve);const ce=gn,bs={parseNumbers:!1,parseBooleans:!1},Cs={skipNull:!1,skipEmptyString:!1},js=(t,r)=>{var l,u;const{navigateMode:m="push",parseOptions:g,stringifyOptions:w}={},p=Object.assign(Object.assign({},bs),g),y=Object.assign(Object.assign({},Cs),w),h=ce.useLocation(),i=(l=ce.useHistory)===null||l===void 0?void 0:l.call(ce),I=(u=ce.useNavigate)===null||u===void 0?void 0:u.call(ce),j=ts(),k=P.useRef(typeof t=="function"?t():t||{}),o=P.useMemo(()=>ve.parse(h.search,p),[h.search]),T=P.useMemo(()=>Object.assign(Object.assign({},k.current),o),[o]);return[T,Me(n=>{const s=typeof n=="function"?n(T):n;j(),i&&i[m]({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},h.state),I&&I({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},{replace:m==="replace",state:h.state})})]},Ss=js,ws=Ot,Ee=Rn,Oe=An,Ps=rs,Pt={role:ws.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,u)=>{let m=l||Pt;const g=(0,Oe.isEthereumType)((0,Oe.DidType)(l));if(g?m=(0,Ee.WalletType)(l):m=(0,Ee.WalletType)(Pt),!(0,Oe.isValid)(t)){let w="";try{return g?w=t.slice(0,66):w=t,(0,Ee.fromSecretKey)(w,m)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ps.fromAppDid)(t,r,m,u||0)};var Is=ks,Qt=vt&&vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const de=Qt(Zn),Ts=Ot,xe=Qt(Is),Ds=Yn,Rs=(t,r,{returnWallet:l=!0}={})=>{var B,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,de.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:m=[]}=t,g=[...m,...u],w=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),y=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:I}=t.meta,j=(0,Ds.getDisplayName)(t),k=(0,de.default)(w,"value",t.meta.description),o=(0,de.default)(p,"value","auto"),T=(0,de.default)(y,"value",""),d=(0,de.default)(h,"value","");if(!l)return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:"",wallet:null,permanentWallet:null,tenantMode:d};const n=g.find(D=>D.key==="BLOCKLET_APP_SK"),s=g.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||g.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),a=g.find(D=>D.key==="BLOCKLET_APP_PSK");let c;s&&(s.value==="ethereum"||s.value==="eth")&&(c=s.value);let x=null,v=null;if(n&&n.value)x=(0,xe.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(v=(0,xe.default)(a.value,void 0,c));else{if(!r||typeof r!="string")throw new Error("Node secret key must be a string");s?x=(0,xe.default)(t.meta.did,r,c):x=(0,xe.default)(t.meta.did,r)}const S=((R=(B=t.settings)==null?void 0:B.session)==null?void 0:R.salt)||"",_=Ts.Hasher.SHA3.hash256(bt.concat([x.secretKey,x.address,S].filter(Boolean).map(D=>bt.from(D))));return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:_,wallet:x,permanentWallet:v||x,tenantMode:d}};var As=Rs;const Ls=hn(As);function Ye({teamDid:t,roles:r,apps:l,onCancel:u,onSuccess:m,onError:g,endpoint:w}){var T;const{api:p}=H(),{t:y,locale:h}=V(),i=qe({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),I=async()=>{if(!i.role){i.error=y("team.member.error.passportEmpty");return}const d=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:d,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:a}=await p.createMemberInvitation({input:s});i.inviteInfo=a,i.activeStep=1}catch(n){const s=J(n);i.error=s,g(n)}finally{i.loading=!1}},j=r.find(d=>d.name===i.role),o=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(_e,{fullWidth:!0,children:[e.jsx(Ue,{children:y("common.sourceApp")}),e.jsx(Be,{value:i.sourceAppPid,onChange:d=>{i.error=null,i.sourceAppPid=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,children:l.map(d=>e.jsx(be,{value:d.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Ln,{did:d.appPid,size:28}),d.appName]}),e.jsx(En,{did:d.appPid,compact:!0,responsive:!1})]})},d.appPid))})]}):null,e.jsxs(_e,{fullWidth:!0,variant:"outlined",children:[e.jsx(Ue,{children:y("common.passport")}),e.jsx(Be,{"data-cy":"invite-member-select-role",value:i.role,onChange:d=>{i.error=null,i.role=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,onKeyPress:d=>{d.key==="Enter"&&(d.preventDefault(),I())},children:r.filter(d=>d.name!=="owner").map(d=>e.jsx(be,{value:d.name,"data-cy":`invite-member-select-option-${d.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Z,{variant:"subtitle1",children:d.title||d.name}),e.jsx(Z,{variant:"caption",sx:{opacity:.7},children:d.description})]})},d.name))})]}),((T=j==null?void 0:j.extra)==null?void 0:T.display)==="custom"&&e.jsx(pe,{label:y("common.display"),type:"url",value:i.display,onChange:d=>{i.error=null,i.display=d.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(pe,{label:y("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:d=>{i.error=null,i.remark=d.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(qt,{value:i.passportExpireTime,onChange:d=>{i.passportExpireTime=d}})]}),cancel:y("common.cancel"),confirm:y("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:I},{body:()=>{var n,s;const d=ze({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:w});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:y("team.member.inviteDialog.createSuccessTip",{expireDate:se((s=i.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:d})]})},confirm:y("common.confirm"),onConfirm:m}][i.activeStep];return e.jsxs(te,{title:y("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[o.cancel&&e.jsx(z,{onClick:o.onCancel,color:"inherit",children:o.cancel}),e.jsxs(z,{onClick:o.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ae,{size:16}),o.confirm]})]}),children:[e.jsx(We,{component:"div",children:typeof o.body=="function"?o.body():o.body}),!!i.error&&e.jsx(ie,{severity:"error",variant:"icon",children:i.error})]})}Ye.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};Ye.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Qe({teamDid:t,onCancel:r,onSuccess:l,onError:u,endpoint:m}){const{api:g,info:w}=H(),{api:p}=P.useContext(On),[y,h]=P.useState(!1),{t:i,locale:I}=V(),[j,k]=P.useState(""),[o,T]=P.useState(!1),[d,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),v=!!Fe(w,"ownerNft.did"),S=os(async()=>{if(v){const{state:L}=await g.getDelegationState();return L}return{delegated:!0}});if(S.loading)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ae,{})})});if(S.error)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(ie,{severity:"error",variant:"icon",children:J(S.error)})});const _=async()=>{k(null),h(!0);try{const{inviteInfo:L}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(L),n(D.length-1)}catch(L){const $=J(L);k($),u(L)}finally{h(!1)}},B=()=>{T(!0),n(1)},R=()=>{T(!1),n(0)},D=[{body:e.jsxs(Z,{component:"div",children:[e.jsxs(ie,{severity:"warning",children:[e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(ie,{severity:"warning",children:e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(pe,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:L=>{k(null),x(L.target.value)},disabled:y,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:v&&!Fe(S,"value.delegated")?B:_},{body:()=>e.jsx(Nn,{action:"delegate-transfer-nft",open:o,locale:I,checkFn:p.get,onClose:R,onSuccess:_,checkTimeout:5*60*1e3,webWalletUrl:Qn(w),extraParams:{targetDID:w.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const L=ze({inviteId:s.inviteId,endpoint:m});return e.jsxs("div",{children:[e.jsx(Es,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:se(s.expireDate,I)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:L})]})},confirm:i("common.confirm"),onConfirm:l}],O=D[d];return e.jsxs(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(z,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(z,{onClick:O.onConfirm,color:"primary",disabled:y,variant:"contained",autoFocus:!0,children:[y&&e.jsx(ae,{size:16}),O.confirm]})]}),children:[e.jsx(We,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!j&&e.jsx(ie,{severity:"error",variant:"icon",children:j})]})}Qe.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};Qe.defaultProps={onError:()=>{},endpoint:""};const Es=M.div`
2
2
  font-size: 16px;
3
3
  font-weight: bold;
4
4
  `;var Ge=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"})]})};Ge.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Ge.displayName="forbid-login";const Gt=Ge;var Je=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"}),e.jsx("rect",{x:"15.3125",y:"14.0625",width:"7.5",height:"1.875",rx:"0.9375",transform:"rotate(-90 15.3125 14.0625)"})]})};Je.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Je.displayName="allow-login";const Jt=Je;function we(t){const{passport:r,onDelete:l,...u}=t;return e.jsxs(Os,{...u,children:[r.title||r.name," ",!!l&&e.jsx(_n,{"data-cy":"delete-issuance",className:"delete",onClick:l})]})}we.propTypes={passport:b.object.isRequired,onDelete:b.func};we.defaultProps={onDelete:null};const Os=M.span`
@@ -1,4 +1,4 @@
1
- import{r as g}from"./vendor-react-DEoibe3W.js";import{u as I,X as U,j as ae,B as L,b2 as he,am as le,bO as re,_ as ge,aA as be,bv as je,c3 as Ce,b4 as ve,a7 as Ke}from"./vendor-ux-did-connect-TEE6cGq6.js";import{d as ke}from"./Edit-BLsIdIOp.js";import{r as de}from"./passport-item-BxfGrDcE.js";import{z as B,l as N,aF as Ae,C as Te,f as Se}from"./index-u-w3iMC9.js";import{u as $}from"./dashboard-C124DXmc.js";import{j as e,H as p,bp as F,bs as O,bo as G,q as H,aa as x,al as V,O as M,ab as we,bt as De,bS as Ie,ah as P,T as _,ad as ie,ak as Re}from"./vendor-mui-core-UZpb7wT7.js";import{M as Be,Z as $e}from"./vendor-arcblock-CN2B_oTr.js";import{T as me}from"./index-BmWVfEGP.js";import{C as pe}from"./confirm-BvUfAlkx.js";import{a0 as _e}from"./vendor-utils-rHXShPKm.js";import{C as E}from"./click-to-copy-BxhgzyYL.js";import{D as Ne}from"./delete-confirm-BBaXcAXg.js";import{P as Pe}from"./permission-BkNXA8B5.js";import{m as Ue,G as We}from"./vendor-hooks-rDgu5KV9.js";import{U as qe,C as ze,I as Le}from"./index-Ce2NSVmU.js";import{B as Me}from"./bundle-avatar-Db5l8MQ4.js";import{p as Ee}from"./util-Bg0WSJ-t.js";import{W as ce}from"./did-address-BKBBjFqv.js";import{A as Fe}from"./actions-BCWb2ez1.js";import{f as Oe}from"./format-error-BrmqJs5a.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAjFH6d8.js";import"./vendor-mui-x-whuSO90H.js";import"./AdapterDayjs-BiPHzcUP.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./base32-BbrXtXL6.js";import"./MoreHoriz-BxJelL2A.js";function Q({value:s}){const{t:n,locale:m}=I(),l=new Date;return new Date(s)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(U,{value:s,locale:m}),`${n("setting.accessKey.expired",{time:""})}`]}):e.jsx(U,{value:s,locale:m})}Q.propTypes={value:p.string.isRequired};function X({value:s,onChange:n,...m}){const{t:l}=I(),d=g.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(F,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(O,{children:l("setting.accessKey.authType")}),e.jsx(G,{value:s,onChange:n,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(H,{value:o.value,children:e.jsxs(x,{children:[e.jsx("span",{children:o.title}),e.jsx(x,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}X.propTypes={value:p.string.isRequired,onChange:p.func.isRequired};const W=()=>{const s=ae.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:n}=B(),{roles:m}=$(),l=[...s,...n?m:[]];return _e(l,"name").filter(d=>d.name!==ae.ROLES.OWNER)};function Z(s){const{remark:n,onCreate:m}=s,{api:l}=B(),{teamDid:d}=$(),{t:o}=I(),[C,b]=g.useState(!1),[c,f]=g.useState(null),u=W(),T=()=>{b(!1),f(null)},k=async a=>{const{remark:A,passport:i,authType:t}=a;b(!0);const v=await l.createAccessKey({input:{teamDid:d,remark:A.trim(),passport:i,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:t}}),{data:K}=v;m(K),f(null),b(!1)},y={title:`${o("common.create")} ${o("accessKey")}`,description:(a,A,i)=>e.jsxs(V,{gap:3,children:[e.jsx(M,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:t=>{A({...a,remark:t.target.value,__disableConfirm:!a.passport||!t.target.value.trim()}),t.target.value.trim()?i(""):i(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(F,{style:{width:"100%"},variant:"outlined",children:[e.jsx(O,{children:o("setting.accessKey.passport")}),e.jsx(G,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:t=>{const v=t.target.value;i(null),A({...a,passport:v,__disableConfirm:!a.remark||!v})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:C,children:u.map(t=>e.jsx(H,{value:t.name,"data-cy":`create-access-key-passport-option-${t.name}`,children:e.jsxs(x,{children:[e.jsx("span",{children:t.title||t.name}),e.jsx(x,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:t.description})]})},t.name))})]}),e.jsx(X,{value:a.authType,onChange:t=>{A({...a,authType:t.target.value})}}),e.jsx(me,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:t=>{A({...a,expireAt:t,__disableConfirm:!a.passport||!a.remark||!t})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:n,authType:"signature",__disableConfirm:!n.trim()},onConfirm:k,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>f(y),className:"rule-action",children:[C?e.jsx(we,{size:16}):e.jsx(Be,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(pe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}Z.propTypes={remark:p.string,onCreate:p.func};Z.defaultProps={onCreate:()=>{},remark:""};function J(s){const{onConfirm:n,accessKeyId:m,accessKeySecret:l,hideSecret:d}=s,{t:o}=g.useContext(he),[C,b]=g.useState(!1),[c,f]=g.useState(()=>d),u=()=>{f(!c)},T=a=>{b(a.target.checked)},k=g.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
1
+ import{r as g}from"./vendor-react-DEoibe3W.js";import{u as I,X as U,j as ae,B as L,b2 as he,am as le,bO as re,_ as ge,aA as be,bv as je,c3 as Ce,b4 as ve,a7 as Ke}from"./vendor-ux-did-connect-TEE6cGq6.js";import{d as ke}from"./Edit-BLsIdIOp.js";import{r as de}from"./passport-item-BxfGrDcE.js";import{z as B,l as N,aF as Ae,C as Te,f as Se}from"./index-u-w3iMC9.js";import{u as $}from"./dashboard-C124DXmc.js";import{j as e,H as p,bp as F,bs as O,bo as G,q as H,aa as x,al as V,O as M,ab as we,bt as De,bS as Ie,ah as P,T as _,ad as ie,ak as Re}from"./vendor-mui-core-UZpb7wT7.js";import{M as Be,Z as $e}from"./vendor-arcblock-CN2B_oTr.js";import{T as me}from"./index-BmWVfEGP.js";import{C as pe}from"./confirm-BvUfAlkx.js";import{a0 as _e}from"./vendor-utils-rHXShPKm.js";import{C as E}from"./click-to-copy-BxhgzyYL.js";import{D as Ne}from"./delete-confirm-BBaXcAXg.js";import{P as Pe}from"./permission-BkNXA8B5.js";import{m as Ue,G as We}from"./vendor-hooks-rDgu5KV9.js";import{U as qe,C as ze,I as Le}from"./index-Ce2NSVmU.js";import{B as Me}from"./bundle-avatar-Db5l8MQ4.js";import{p as Ee}from"./util-Bg0WSJ-t.js";import{W as ce}from"./did-address-BKBBjFqv.js";import{A as Fe}from"./actions-BCWb2ez1.js";import{f as Oe}from"./format-error-BrmqJs5a.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./vendor-mui-x-whuSO90H.js";import"./AdapterDayjs-BiPHzcUP.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./base32-BbrXtXL6.js";import"./MoreHoriz-BxJelL2A.js";function Q({value:s}){const{t:n,locale:m}=I(),l=new Date;return new Date(s)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(U,{value:s,locale:m}),`${n("setting.accessKey.expired",{time:""})}`]}):e.jsx(U,{value:s,locale:m})}Q.propTypes={value:p.string.isRequired};function X({value:s,onChange:n,...m}){const{t:l}=I(),d=g.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(F,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(O,{children:l("setting.accessKey.authType")}),e.jsx(G,{value:s,onChange:n,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(H,{value:o.value,children:e.jsxs(x,{children:[e.jsx("span",{children:o.title}),e.jsx(x,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}X.propTypes={value:p.string.isRequired,onChange:p.func.isRequired};const W=()=>{const s=ae.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:n}=B(),{roles:m}=$(),l=[...s,...n?m:[]];return _e(l,"name").filter(d=>d.name!==ae.ROLES.OWNER)};function Z(s){const{remark:n,onCreate:m}=s,{api:l}=B(),{teamDid:d}=$(),{t:o}=I(),[C,b]=g.useState(!1),[c,f]=g.useState(null),u=W(),T=()=>{b(!1),f(null)},k=async a=>{const{remark:A,passport:i,authType:t}=a;b(!0);const v=await l.createAccessKey({input:{teamDid:d,remark:A.trim(),passport:i,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:t}}),{data:K}=v;m(K),f(null),b(!1)},y={title:`${o("common.create")} ${o("accessKey")}`,description:(a,A,i)=>e.jsxs(V,{gap:3,children:[e.jsx(M,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:t=>{A({...a,remark:t.target.value,__disableConfirm:!a.passport||!t.target.value.trim()}),t.target.value.trim()?i(""):i(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(F,{style:{width:"100%"},variant:"outlined",children:[e.jsx(O,{children:o("setting.accessKey.passport")}),e.jsx(G,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:t=>{const v=t.target.value;i(null),A({...a,passport:v,__disableConfirm:!a.remark||!v})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:C,children:u.map(t=>e.jsx(H,{value:t.name,"data-cy":`create-access-key-passport-option-${t.name}`,children:e.jsxs(x,{children:[e.jsx("span",{children:t.title||t.name}),e.jsx(x,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:t.description})]})},t.name))})]}),e.jsx(X,{value:a.authType,onChange:t=>{A({...a,authType:t.target.value})}}),e.jsx(me,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:t=>{A({...a,expireAt:t,__disableConfirm:!a.passport||!a.remark||!t})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:n,authType:"signature",__disableConfirm:!n.trim()},onConfirm:k,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>f(y),className:"rule-action",children:[C?e.jsx(we,{size:16}):e.jsx(Be,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(pe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}Z.propTypes={remark:p.string,onCreate:p.func};Z.defaultProps={onCreate:()=>{},remark:""};function J(s){const{onConfirm:n,accessKeyId:m,accessKeySecret:l,hideSecret:d}=s,{t:o}=g.useContext(he),[C,b]=g.useState(!1),[c,f]=g.useState(()=>d),u=()=>{f(!c)},T=a=>{b(a.target.checked)},k=g.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
2
2
 
3
3
  const client = new Client(fullEndpoint);
4
4
  client.setAuthAccessKey({
@@ -1,4 +1,4 @@
1
- import{u as q,_ as $,bO as U,I as be,bP as fe,a0 as ge,a7 as je,bv as ye}from"./vendor-ux-did-connect-TEE6cGq6.js";import{t as we,m as de,j as ke}from"./vendor-hooks-rDgu5KV9.js";import{r as C,b as G}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-Dy7jTc7H.js";import{l as ve,M as Ee}from"./vendor-arcblock-CN2B_oTr.js";import{z as N,E as Ce,F as K,C as ce,t as Te}from"./index-u-w3iMC9.js";import{u as _}from"./dashboard-C124DXmc.js";import{H as o,j as e,D as Se,aj as Re,t as Ie,aa as f,O as ie,T as S,ab as B,ak as Z,z as Me,y as H,bt as le,bS as Y,ad as W,L as J,A as Q,bd as Pe,E as O,I as ee,C as ze,br as De,al as P,ch as $e,X as We,bc as V,bq as Oe,b5 as Ae,ci as qe,cj as Le,b6 as Be,an as He,c4 as Fe,s as pe,v as Ne,ck as _e,cl as Ue,cm as Ke,cn as Ye}from"./vendor-mui-core-UZpb7wT7.js";import{d as Ve}from"./ExpandLess-CJXkgMMr.js";import{b as ue,z as Je,A as Qe}from"./vendor-utils-rHXShPKm.js";import{C as Ge}from"./confirm-BvUfAlkx.js";import{A as Xe}from"./actions-BCWb2ez1.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./format-error-BrmqJs5a.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAjFH6d8.js";import"./MoreHoriz-BxJelL2A.js";const Ze=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=ce(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.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:j}])=>{const E=j.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]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},x=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:x,checked:l>0&&l===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(W,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{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(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const M=s[r]>0,i=s[r]===j.length&&j.length>0,h=R[r];return e.jsxs(G.Fragment,{children:[e.jsx(Q,{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(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:i,indeterminate:M&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Pe,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{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(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(ee,{size:"small",edge:"end",children:h?e.jsx(Ve,{}):e.jsx(ve,{})})]})]})}),j.length>0&&e.jsx(ze,{in:h,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,k=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:k,sx:{mr:1}}),e.jsxs(f,{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(De,{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}=_(),{api:T}=N(),{loading:g,error:y,eventsBySource:x}=Ze(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:M}=Ce({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]),z={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[A,L]=I.split("-");return!A||!L?null:{type:A,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:z}});$.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:z}});$.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){$.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(Se,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(h),children:[e.jsx(Re,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ie,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{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:!!j.url,helperText:(k=j.url)==null?void 0:k.message})}}),e.jsx(K,{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:!!j.description,helperText:(k=j.description)==null?void 0:k.message})}}),e.jsx(K,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&x&&Object.keys(x).length>0&&e.jsx(te,{eventsBySource:x,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!x||Object.keys(x).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(B,{size:20})}),y&&e.jsx(Z,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Me,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:i,children:p("common.cancel")}),e.jsx(H,{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 F(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Te(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 D(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($e,{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(We,{orientation:"vertical",flexItem:!0})]})}D.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};D.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}=N(),{t:b}=q(),{teamDid:R}=_(),{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]}),g=(s==null?void 0:s.list)||[],[y,x]=C.useState(null),r=nt(g);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(B,{});const j=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,z=(p.children||[]).find(A=>{var L;return((L=A==null?void 0:A.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Qe(`https://${k}`,(z==null?void 0:z.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{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(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(G.Fragment,{children:[e.jsx(Oe,{children:u}),M.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:F(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ae,{sx:{minWidth:0,mr:1.5},children:ot(i.responseStatus)===!1?e.jsx(qe,{color:"error"}):e.jsx(Le,{color:"success"})}),e.jsx(Be,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{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(V,{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(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(U,{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,g,y;const{t:c}=q(),{api:a}=N(),{teamDid:b}=_(),{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(Z,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(B,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{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(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Fe,{})})})]}),e.jsx(f,{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(D,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{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(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:F(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:F(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx(W,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx(W,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx(O,{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(He,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{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=G.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=q(),l=Ne(g=>g.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(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(ge,{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,_ as $,bO as U,I as be,bP as fe,a0 as ge,a7 as je,bv as ye}from"./vendor-ux-did-connect-TEE6cGq6.js";import{t as we,m as de,j as ke}from"./vendor-hooks-rDgu5KV9.js";import{r as C,b as G}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-Dy7jTc7H.js";import{l as ve,M as Ee}from"./vendor-arcblock-CN2B_oTr.js";import{z as N,E as Ce,F as K,C as ce,t as Te}from"./index-u-w3iMC9.js";import{u as _}from"./dashboard-C124DXmc.js";import{H as o,j as e,D as Se,aj as Re,t as Ie,aa as f,O as ie,T as S,ab as B,ak as Z,z as Me,y as H,bt as le,bS as Y,ad as W,L as J,A as Q,bd as Pe,E as O,I as ee,C as ze,br as De,al as P,ch as $e,X as We,bc as V,bq as Oe,b5 as Ae,ci as qe,cj as Le,b6 as Be,an as He,c4 as Fe,s as pe,v as Ne,ck as _e,cl as Ue,cm as Ke,cn as Ye}from"./vendor-mui-core-UZpb7wT7.js";import{d as Ve}from"./ExpandLess-CJXkgMMr.js";import{b as ue,z as Je,A as Qe}from"./vendor-utils-rHXShPKm.js";import{C as Ge}from"./confirm-BvUfAlkx.js";import{A as Xe}from"./actions-BCWb2ez1.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./format-error-BrmqJs5a.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./MoreHoriz-BxJelL2A.js";const Ze=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=ce(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.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:j}])=>{const E=j.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]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},x=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:x,checked:l>0&&l===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(W,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{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(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const M=s[r]>0,i=s[r]===j.length&&j.length>0,h=R[r];return e.jsxs(G.Fragment,{children:[e.jsx(Q,{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(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:i,indeterminate:M&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Pe,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{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(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(ee,{size:"small",edge:"end",children:h?e.jsx(Ve,{}):e.jsx(ve,{})})]})]})}),j.length>0&&e.jsx(ze,{in:h,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,k=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:k,sx:{mr:1}}),e.jsxs(f,{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(De,{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}=_(),{api:T}=N(),{loading:g,error:y,eventsBySource:x}=Ze(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:M}=Ce({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]),z={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[A,L]=I.split("-");return!A||!L?null:{type:A,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:z}});$.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:z}});$.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){$.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(Se,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(h),children:[e.jsx(Re,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ie,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{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:!!j.url,helperText:(k=j.url)==null?void 0:k.message})}}),e.jsx(K,{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:!!j.description,helperText:(k=j.description)==null?void 0:k.message})}}),e.jsx(K,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&x&&Object.keys(x).length>0&&e.jsx(te,{eventsBySource:x,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!x||Object.keys(x).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(B,{size:20})}),y&&e.jsx(Z,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Me,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:i,children:p("common.cancel")}),e.jsx(H,{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 F(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Te(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 D(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($e,{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(We,{orientation:"vertical",flexItem:!0})]})}D.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};D.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}=N(),{t:b}=q(),{teamDid:R}=_(),{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]}),g=(s==null?void 0:s.list)||[],[y,x]=C.useState(null),r=nt(g);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(B,{});const j=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,z=(p.children||[]).find(A=>{var L;return((L=A==null?void 0:A.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Qe(`https://${k}`,(z==null?void 0:z.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{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(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(G.Fragment,{children:[e.jsx(Oe,{children:u}),M.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:F(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ae,{sx:{minWidth:0,mr:1.5},children:ot(i.responseStatus)===!1?e.jsx(qe,{color:"error"}):e.jsx(Le,{color:"success"})}),e.jsx(Be,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{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(V,{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(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(U,{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,g,y;const{t:c}=q(),{api:a}=N(),{teamDid:b}=_(),{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(Z,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(B,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{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(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Fe,{})})})]}),e.jsx(f,{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(D,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{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(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:F(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:F(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx(W,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx(W,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx(O,{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(He,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{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=G.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=q(),l=Ne(g=>g.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(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(ge,{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
  .custom-toobar-btns {
3
3
  gap: 8px;
4
4
  }
@@ -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-rDgu5KV9.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 Y,ab as M,ak as Me,a9 as mt,I as q,O as W,q as ie,N as ft,bs as $e,co as Oe,cp as ee,bV as We,br as qe,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-UZpb7wT7.js";import{u as L,am as U,as as Ct,_ as F,a7 as xe,j as G,aN as St,B as _,r as Tt,a0 as ge,bw as He,h as wt,b8 as Pt,bQ as Fe,bj as It,bv as Rt}from"./vendor-ux-did-connect-TEE6cGq6.js";import{z as A,l as ne,t as Ue,U as Q,C as Dt,ac as kt,f as Ft,b as re,aw as At,R as Ge}from"./index-u-w3iMC9.js";import{w as Nt,c as Lt,M as ye,$ as X}from"./vendor-arcblock-CN2B_oTr.js";import{W as je}from"./did-address-BKBBjFqv.js";import{u as $}from"./dashboard-C124DXmc.js";import{r as ve,a as be,b as Ce,c as le,d as Bt,e as Ve,u as zt,f as _t}from"./passport-item-BxfGrDcE.js";import{p as Ke}from"./util-Bg0WSJ-t.js";import{w as V,P as Ye}from"./permission-BkNXA8B5.js";import{C as Et}from"./Google-BbAgcDQ_.js";import{M as Z,aA as Mt,K as $t}from"./vendor-utils-rHXShPKm.js";import{E as ce}from"./EditIcon-CwTCQzs9.js";import{C as Se}from"./confirm-BvUfAlkx.js";import{L as Ze}from"./list-header-CU9W30JD.js";import{f as se}from"./format-error-BrmqJs5a.js";import{_ as Ot}from"./useSetState-CWq0AVWn.js";import{L as Wt}from"./LockIcon-DIGiHKHl.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./use-mobile-BAjFH6d8.js";import"./index-Ce2NSVmU.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./base32-BbrXtXL6.js";import"./cloneDeep-UpFQ2VNg.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(Qe,{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(qt,{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 qt=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-rDgu5KV9.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 Y,ab as M,ak as Me,a9 as mt,I as q,O as W,q as ie,N as ft,bs as $e,co as Oe,cp as ee,bV as We,br as qe,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-UZpb7wT7.js";import{u as L,am as U,as as Ct,_ as F,a7 as xe,j as G,aN as St,B as _,r as Tt,a0 as ge,bw as He,h as wt,b8 as Pt,bQ as Fe,bj as It,bv as Rt}from"./vendor-ux-did-connect-TEE6cGq6.js";import{z as A,l as ne,t as Ue,U as Q,C as Dt,ac as kt,f as Ft,b as re,aw as At,R as Ge}from"./index-u-w3iMC9.js";import{w as Nt,c as Lt,M as ye,$ as X}from"./vendor-arcblock-CN2B_oTr.js";import{W as je}from"./did-address-BKBBjFqv.js";import{u as $}from"./dashboard-C124DXmc.js";import{r as ve,a as be,b as Ce,c as le,d as Bt,e as Ve,u as zt,f as _t}from"./passport-item-BxfGrDcE.js";import{p as Ke}from"./util-Bg0WSJ-t.js";import{w as V,P as Ye}from"./permission-BkNXA8B5.js";import{C as Et}from"./Google-BbAgcDQ_.js";import{M as Z,aA as Mt,K as $t}from"./vendor-utils-rHXShPKm.js";import{E as ce}from"./EditIcon-CwTCQzs9.js";import{C as Se}from"./confirm-BvUfAlkx.js";import{L as Ze}from"./list-header-CU9W30JD.js";import{f as se}from"./format-error-BrmqJs5a.js";import{_ as Ot}from"./useSetState-CWq0AVWn.js";import{L as Wt}from"./LockIcon-DIGiHKHl.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./use-mobile-Bh8CHBbH.js";import"./index-Ce2NSVmU.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./base32-BbrXtXL6.js";import"./cloneDeep-UpFQ2VNg.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(Qe,{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(qt,{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 qt=H(g)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-arcblock-CN2B_oTr.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-react-DEoibe3W.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/login-BKaJnfFX.js","assets/use-passport-id-B-b-_oYF.js","assets/get-safe-url-CEvgWyL5.js","assets/logger-CQ50TnpL.js","assets/LaunchOutlined-BIq6YUU8.js","assets/login-oauth-callback-LJsgXC8E.js","assets/connect-B2HOOYzS.js","assets/landing-page-q-KgqE9Q.js","assets/exchange-passport-DbNEDTaa.js","assets/wrap-locale-DZ79GW_G.js","assets/get-safe-url-2RcRY8gU.js","assets/issue-passport-C3zUptls.js","assets/invitation-CKfllvl5.js","assets/session-6XaVDQaE.js","assets/sdk-7yPC_DtN.js","assets/CheckCircle-Dvhgeo9j.js","assets/lost-passport-Bk0k4I4s.js","assets/ViewList-B4hmqizo.js","assets/Done-Ct5slWpT.js","assets/did-address-BKBBjFqv.js","assets/start-CHmWCQE9.js","assets/PlayArrow-C9IFmc-j.js","assets/Error-wpqrAfUT.js","assets/ServerLogo-CfbYjQbP.js","assets/addon-ygDS7Fug.js","assets/QuestionMarkCircle-DCM9zW3a.js","assets/starting-progress-CdpkXOrK.js","assets/setup-CifjXQIf.js","assets/config-space-CSKkMgqX.js","assets/spaces-Cp7TgoZP.js","assets/api-BjteVZFg.js","assets/invite-CCCSmPiy.js","assets/transfer-CSeo2FaW.js","assets/dashboard-C124DXmc.js","assets/useLocalStorage-C6U1Aqya.js","assets/confirm-BvUfAlkx.js","assets/format-error-BrmqJs5a.js","assets/use-blocklet-logo-sEJnYyNL.js","assets/InfoOutlined-Dy7jTc7H.js","assets/collapse-Bn_BDlF9.js","assets/dot-C05enzim.js","assets/useAsync-DV3NyLhI.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-BAjFH6d8.js","assets/user-center-BHyd-rRF.js","assets/list-TP-VNuzL.js","assets/index-DjLLC6N3.js","assets/bundle-avatar-Db5l8MQ4.js","assets/relative-time-Cl7lOTkO.js","assets/index-Ce2NSVmU.js","assets/Phone-CoX1qzAs.js","assets/Location-C__VfR4D.js","assets/Email-DOy8vL0N.js","assets/Timezone-CCdgxxpv.js","assets/util-Bg0WSJ-t.js","assets/base32-BbrXtXL6.js","assets/ExpandLess-CJXkgMMr.js","assets/profile-embed-8w4_vg5a.js","assets/home-DXj5oFeO.js","assets/studio-BbeHx14I.js","assets/TuneOutlined-CB7t_nGq.js","assets/preferences-_jTjKHvU.js","assets/iframe-CIVgAJuH.js","assets/branding-BTfb8_b4.js","assets/empty-spinner-BZlBh4vA.js","assets/DeleteOutline-B6efX_Fy.js","assets/react-beautiful-dnd.esm-Cq_dOQ2z.js","assets/raf-schd.esm-B3j6BePR.js","assets/localization-BXLZxF1J.js","assets/add-resource-BDJuVU8K.js","assets/add-component-core-DRAzXCeg.js","assets/item-CkcpHBHM.js","assets/Launch-DBKe0gh0.js","assets/delete-confirm-BBaXcAXg.js","assets/click-to-copy-BxhgzyYL.js","assets/launch-result-message-BaU6oEsi.js","assets/page-header-CpNMTtn_.js","assets/logo-uploader-BYnd80uu.js","assets/index-DVQCgvFb.js","assets/index-D09AfnR1.js","assets/Google-BbAgcDQ_.js","assets/cloneDeep-UpFQ2VNg.js","assets/index-CKheO_aT.js","assets/index-C0Iiqot3.css","assets/index-Bs1kxR8_.js","assets/index-C0SLCehH.js","assets/util-RWes6RwK.js","assets/use-mobile-Bh8CHBbH.js","assets/content-layout-DzqMXifY.js","assets/connect-to-BBtnljQ-.js","assets/ArrowDropDown-Dghek9CI.js","assets/ChevronLeft-DE33N57i.js","assets/ChevronRight-BfbPIE2b.js","assets/add-component-core-D-IRi6XF.css","assets/publish-resource-CcM3RwPR.js","assets/index-DF3gHUuW.js","assets/shorten-label-Dq7bVuNa.js","assets/list-header-CU9W30JD.js","assets/Download-DKQGRFHf.js","assets/vendor-mui-x-whuSO90H.js","assets/index-BMD-pSqT.js","assets/index-BemEiFHE.js","assets/email-Bc5KLu5Q.js","assets/authorize-WekjQ3_M.js","assets/unsubscribe-BLaMmgbM.js","assets/open-window-DV0D-Mov.js","assets/gen-access-key-D-ftFU9F.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-arcblock-CN2B_oTr.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-react-DEoibe3W.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/login-BKaJnfFX.js","assets/use-passport-id-B-b-_oYF.js","assets/get-safe-url-CEvgWyL5.js","assets/logger-CQ50TnpL.js","assets/LaunchOutlined-BIq6YUU8.js","assets/login-oauth-callback-LJsgXC8E.js","assets/connect-B2HOOYzS.js","assets/landing-page-q-KgqE9Q.js","assets/exchange-passport-DbNEDTaa.js","assets/wrap-locale-DZ79GW_G.js","assets/get-safe-url-2RcRY8gU.js","assets/issue-passport-C3zUptls.js","assets/invitation-CKfllvl5.js","assets/session-6XaVDQaE.js","assets/sdk-7yPC_DtN.js","assets/CheckCircle-Dvhgeo9j.js","assets/lost-passport-Bk0k4I4s.js","assets/ViewList-B4hmqizo.js","assets/Done-Ct5slWpT.js","assets/did-address-BKBBjFqv.js","assets/start-CHmWCQE9.js","assets/PlayArrow-C9IFmc-j.js","assets/Error-wpqrAfUT.js","assets/ServerLogo-CfbYjQbP.js","assets/addon-ygDS7Fug.js","assets/QuestionMarkCircle-DCM9zW3a.js","assets/starting-progress-CdpkXOrK.js","assets/setup-CifjXQIf.js","assets/config-space-CSKkMgqX.js","assets/spaces-Cp7TgoZP.js","assets/api-BjteVZFg.js","assets/invite-CCCSmPiy.js","assets/transfer-CSeo2FaW.js","assets/dashboard-C124DXmc.js","assets/useLocalStorage-C6U1Aqya.js","assets/confirm-BvUfAlkx.js","assets/format-error-BrmqJs5a.js","assets/use-blocklet-logo-sEJnYyNL.js","assets/InfoOutlined-Dy7jTc7H.js","assets/collapse-Bn_BDlF9.js","assets/dot-C05enzim.js","assets/useAsync-DV3NyLhI.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-Bh8CHBbH.js","assets/user-center-BHyd-rRF.js","assets/list-TP-VNuzL.js","assets/index-DjLLC6N3.js","assets/bundle-avatar-Db5l8MQ4.js","assets/relative-time-Cl7lOTkO.js","assets/index-Ce2NSVmU.js","assets/Phone-CoX1qzAs.js","assets/Location-C__VfR4D.js","assets/Email-DOy8vL0N.js","assets/Timezone-CCdgxxpv.js","assets/util-Bg0WSJ-t.js","assets/base32-BbrXtXL6.js","assets/ExpandLess-CJXkgMMr.js","assets/profile-embed-8w4_vg5a.js","assets/home-DXj5oFeO.js","assets/studio-BbeHx14I.js","assets/TuneOutlined-CB7t_nGq.js","assets/preferences-_jTjKHvU.js","assets/iframe-CIVgAJuH.js","assets/branding-BTfb8_b4.js","assets/empty-spinner-BZlBh4vA.js","assets/DeleteOutline-B6efX_Fy.js","assets/react-beautiful-dnd.esm-Cq_dOQ2z.js","assets/raf-schd.esm-B3j6BePR.js","assets/localization-BXLZxF1J.js","assets/add-resource-BDJuVU8K.js","assets/add-component-core-DRAzXCeg.js","assets/item-CkcpHBHM.js","assets/Launch-DBKe0gh0.js","assets/delete-confirm-BBaXcAXg.js","assets/click-to-copy-BxhgzyYL.js","assets/launch-result-message-BaU6oEsi.js","assets/page-header-CpNMTtn_.js","assets/logo-uploader-BYnd80uu.js","assets/index-DVQCgvFb.js","assets/index-D09AfnR1.js","assets/Google-BbAgcDQ_.js","assets/cloneDeep-UpFQ2VNg.js","assets/index-CKheO_aT.js","assets/index-C0Iiqot3.css","assets/index-Bs1kxR8_.js","assets/index-C0SLCehH.js","assets/util-RWes6RwK.js","assets/use-mobile-BAjFH6d8.js","assets/content-layout-DzqMXifY.js","assets/connect-to-BBtnljQ-.js","assets/ArrowDropDown-Dghek9CI.js","assets/ChevronLeft-DE33N57i.js","assets/ChevronRight-BfbPIE2b.js","assets/add-component-core-D-IRi6XF.css","assets/publish-resource-CcM3RwPR.js","assets/index-DF3gHUuW.js","assets/shorten-label-Dq7bVuNa.js","assets/list-header-CU9W30JD.js","assets/Download-DKQGRFHf.js","assets/vendor-mui-x-whuSO90H.js","assets/index-BMD-pSqT.js","assets/index-BemEiFHE.js","assets/email-Bc5KLu5Q.js","assets/authorize-WekjQ3_M.js","assets/unsubscribe-BLaMmgbM.js","assets/open-window-DV0D-Mov.js","assets/gen-access-key-D-ftFU9F.js"])))=>i.map(i=>d[i]);
2
2
  var Pd=Object.defineProperty;var Jd=(e,n,t)=>n in e?Pd(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var zn=(e,n,t)=>Jd(e,typeof n!="symbol"?n+"":n,t);import{j as m,ak as Xi,aa as Ce,bA as Vd,O as Lr,N as Ud,T as Fe,e as Fa,v as Fr,a4 as Hd,q as Ns,bo as wd,D as xd,I as Br,t as Md,bB as Cn,ab as Jl,y as pn,al as yn,bC as Gd,s as vr,E as qd,bu as Wd,ad as Ba,af as jd,bD as Kd,H as bt,b7 as Yd,bE as zd,ah as Xd,au as Qd}from"./vendor-mui-core-UZpb7wT7.js";import{d as Zd,e as me,g as cn,b as se,r as _,f as br,a as ft,u as Nr,h as ec,B as nc,i as Os,j as ge,k as Yt}from"./vendor-react-DEoibe3W.js";import{_ as ae,N as si,D as zt,F as oi,R as tc,d as lc,c as Ve,r as ic,u as Qi,H as ac}from"./vendor-arcblock-CN2B_oTr.js";import{au as sc,av as oc,aw as rc,ax as Or,T as uc,aq as pc,ay as Je,az as dc,Q as cc,O as fc,P as mc,aA as ln,aj as yc,aB as _r,f as va,u as hn,_ as Ge,am as Tc,ar as Ac,a0 as gc,a7 as Dc,aC as ba,aD as hc,j as z,aE as Rc,C as Pr,n as kc,aF as Jr,aG as Vr,aH as Sc,aI as Cc,h as Ec,aJ as Ur,aK as Ic,aL as $c,aM as Lc,aN as Fc,aO as Bc,a3 as _s,aP as vc}from"./vendor-ux-did-connect-TEE6cGq6.js";import{S as Na,a4 as bc,a as xn,A as ke,a5 as Nc,a6 as Hr,a7 as Oc,e as gl,d as Oa,a8 as we,a9 as _c,B as An,v as Zi,aa as Pc,ab as Jc,b as Vc,P as Uc,ac as Hc,D as Dl,a0 as wc,L as wr,E as xc}from"./vendor-utils-rHXShPKm.js";import{j as Mc,m as _a,t as Gc,f as Ps,u as qc}from"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";function Wc(e,n){for(var t=0;t<n.length;t++){const l=n[t];if(typeof l!="string"&&!Array.isArray(l)){for(const i in l)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(l,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>l[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))l(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&l(s)}).observe(document,{childList:!0,subtree:!0});function t(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(i){if(i.ep)return;i.ep=!0;const a=t(i);fetch(i.href,a)}})();(function(n){const t={};t.pageView=function(a){l("pv",a)},t.event=function(a){l("evt",a)};function l(i,a){if(typeof a!="string")return;const s=document.createElement("script");s.src=`/.well-known/analytics/${i}/${a.startsWith("/")?a.slice(1):a}`,s.defer=!0,s.async=!0,s.onload=function(){document.head.removeChild(s)},setTimeout(function(){document.head.appendChild(s)},200)}n.tracker=t,n.blocklet&&(n.blocklet.tracker=t)})(window);"serviceWorker"in navigator&&(navigator.serviceWorker.addEventListener("message",e=>{e.data&&e.data.type==="SW_DOCUMENT_UPDATED"&&window.location.reload()}),navigator.serviceWorker.ready.then(()=>{navigator.serviceWorker.controller&&navigator.serviceWorker.controller.postMessage({type:"CLIENT_UPDATE_READY"})}));var xr,Js=Zd;xr=Js.createRoot,Js.hydrateRoot;var Mr={exports:{}};(function(e,n){(function(t,l){e.exports=l(Na)})(me,function(t){function l(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var i=l(t),a={name:"zh",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(s,o){return o==="W"?s+"周":s+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s后",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(s,o){var p=100*s+o;return p<600?"凌晨":p<900?"早上":p<1100?"上午":p<1300?"中午":p<1800?"下午":"晚上"}};return i.default.locale(a,null,!0),a})})(Mr);var Gr=Mr.exports;const jc=cn(Gr),Kc=Wc({__proto__:null,default:jc},[Gr]);var qr={exports:{}};(function(e,n){(function(t,l){e.exports=l()})(me,function(){var t,l,i=1e3,a=6e4,s=36e5,o=864e5,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,r=31536e6,u=2628e6,c=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,f={years:r,months:u,days:o,hours:s,minutes:a,seconds:i,milliseconds:1,weeks:6048e5},y=function(E){return E instanceof x},h=function(E,k,S){return new x(E,S,k.$l)},$=function(E){return l.p(E)+"s"},v=function(E){return E<0},g=function(E){return v(E)?Math.ceil(E):Math.floor(E)},R=function(E){return Math.abs(E)},L=function(E,k){return E?v(E)?{negative:!0,format:""+R(E)+k}:{negative:!1,format:""+E+k}:{negative:!1,format:""}},x=function(){function E(S,U,J){var M=this;if(this.$d={},this.$l=J,S===void 0&&(this.$ms=0,this.parseFromMilliseconds()),U)return h(S*f[$(U)],this);if(typeof S=="number")return this.$ms=S,this.parseFromMilliseconds(),this;if(typeof S=="object")return Object.keys(S).forEach(function(V){M.$d[$(V)]=S[V]}),this.calMilliseconds(),this;if(typeof S=="string"){var F=S.match(c);if(F){var C=F.slice(2).map(function(V){return V!=null?Number(V):0});return this.$d.years=C[0],this.$d.months=C[1],this.$d.weeks=C[2],this.$d.days=C[3],this.$d.hours=C[4],this.$d.minutes=C[5],this.$d.seconds=C[6],this.calMilliseconds(),this}}return this}var k=E.prototype;return k.calMilliseconds=function(){var S=this;this.$ms=Object.keys(this.$d).reduce(function(U,J){return U+(S.$d[J]||0)*f[J]},0)},k.parseFromMilliseconds=function(){var S=this.$ms;this.$d.years=g(S/r),S%=r,this.$d.months=g(S/u),S%=u,this.$d.days=g(S/o),S%=o,this.$d.hours=g(S/s),S%=s,this.$d.minutes=g(S/a),S%=a,this.$d.seconds=g(S/i),S%=i,this.$d.milliseconds=S},k.toISOString=function(){var S=L(this.$d.years,"Y"),U=L(this.$d.months,"M"),J=+this.$d.days||0;this.$d.weeks&&(J+=7*this.$d.weeks);var M=L(J,"D"),F=L(this.$d.hours,"H"),C=L(this.$d.minutes,"M"),V=this.$d.seconds||0;this.$d.milliseconds&&(V+=this.$d.milliseconds/1e3,V=Math.round(1e3*V)/1e3);var W=L(V,"S"),K=S.negative||U.negative||M.negative||F.negative||C.negative||W.negative,oe=F.format||C.format||W.format?"T":"",G=(K?"-":"")+"P"+S.format+U.format+M.format+oe+F.format+C.format+W.format;return G==="P"||G==="-P"?"P0D":G},k.toJSON=function(){return this.toISOString()},k.format=function(S){var U=S||"YYYY-MM-DDTHH:mm:ss",J={Y:this.$d.years,YY:l.s(this.$d.years,2,"0"),YYYY:l.s(this.$d.years,4,"0"),M:this.$d.months,MM:l.s(this.$d.months,2,"0"),D:this.$d.days,DD:l.s(this.$d.days,2,"0"),H:this.$d.hours,HH:l.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:l.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:l.s(this.$d.seconds,2,"0"),SSS:l.s(this.$d.milliseconds,3,"0")};return U.replace(p,function(M,F){return F||String(J[M])})},k.as=function(S){return this.$ms/f[$(S)]},k.get=function(S){var U=this.$ms,J=$(S);return J==="milliseconds"?U%=1e3:U=J==="weeks"?g(U/f[J]):this.$d[J],U||0},k.add=function(S,U,J){var M;return M=U?S*f[$(U)]:y(S)?S.$ms:h(S,this).$ms,h(this.$ms+M*(J?-1:1),this)},k.subtract=function(S,U){return this.add(S,U,!0)},k.locale=function(S){var U=this.clone();return U.$l=S,U},k.clone=function(){return h(this.$ms,this)},k.humanize=function(S){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!S)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},E}(),b=function(E,k,S){return E.add(k.years()*S,"y").add(k.months()*S,"M").add(k.days()*S,"d").add(k.hours()*S,"h").add(k.minutes()*S,"m").add(k.seconds()*S,"s").add(k.milliseconds()*S,"ms")};return function(E,k,S){t=S,l=S().$utils(),S.duration=function(M,F){var C=S.locale();return h(M,{$l:C},F)},S.isDuration=y;var U=k.prototype.add,J=k.prototype.subtract;k.prototype.add=function(M,F){return y(M)?b(this,M,1):U.bind(this)(M,F)},k.prototype.subtract=function(M,F){return y(M)?b(this,M,-1):J.bind(this)(M,F)}}})})(qr);var Wr=qr.exports;const Yc=cn(Wr),mt=Na,zc=sc,Xc=oc,Qc=Wr,Zc=rc,ef=Or;mt.extend(zc);mt.extend(Xc);mt.extend(Qc);mt.extend(Zc);mt.extend(ef);var nf=mt;const Jt=cn(nf);function tf({children:e,theme:n,injectFirst:t,darkSchemeClass:l,prefer:i,disableBlockletTheme:a=!1,enableColorScheme:s,locale:o,fallbackLocale:p,translations:r={},languages:u,onLoadingTranslation:c}){return m.jsx(uc,{theme:n,injectFirst:t,darkSchemeClass:l,prefer:i,disableBlockletTheme:a,enableColorScheme:s,children:m.jsx(pc,{locale:o,fallbackLocale:p,translations:r,onLoadingTranslation:c,languages:u,children:e})})}const lf={common:{invalid:"Invalid",about:"About",access:"Access",buy:"Buy",change:"Change",upload:"Upload",accessKey:"Access Keys",action:"Action",actions:"Actions",add:"Add",refresh:"Refresh",address:"Address",afterTime:"After {time}",allow:"Allow",alreadyExist:"already exists",approve:"Approve",approved:"approved",appUrl:"APP Url",auditLogs:"Audit Trail",auditLogsSearch:"Search by action or content",unrecordedUser:"Unrecorded name",unrecordedRole:"Unrecorded role",notificationRecords:"Notifications",author:"Author",avatar:"Avatar",back:"Back",basic:"Basic",basicInfo:"Basic Information",profile:"Profile",bind:"Bind",blocklet:"Blocklet",blocklets:"Blocklets",blockletsStorage:"Blocklets Storage",cacheStorage:"Cache Storage",cancel:"Cancel",certificate:"certificate",category:"Log Topic",click:"Click to copy",close:"Close",selectAll:"Select All",unselectAll:"Unselect All",collapseAll:"Collapse All",community:"Community URL",complete:"Complete",componentBasicInfo:"Component Basic Information",components:"Blocklets",config:"Configure",configuration:"Configuration",appearance:"Appearance",configNavigation:"Navigation",configSuccess:"Config successfully",confirm:"Confirm",connect:"Connect",console:"Console",continue:"Continue",continueWith:"Continue With",copiedTip:"Copied",optional:"Optional",copyAndClose:"Copy & Close",copyTip:"Click To Copy",coreStorage:"Core Storage",cpu:"CPU",create:"Create",createSuccess:"Create Access Key",created:"Created At",createdAt:"Created At",createdBy:"Created By",dAddress:"Decentralized Identifiers (DID)",dataStorage:"Storage on Local Disk",delConfirm:"Delete",delConfirmDescription:"Confirm delete {data}?",delete:"Delete",dependents:"Dependents",description:"Description",detail:"Detail",did:"DID",disk:"Disk",diskInfo:"Disk Info",docker:"IS Docker",documentation:"Documentation",domain:"Domain",downgradeTo:"Downgrade to",download:"Download",connectToStore:"Connect to Store",blockletStudio:"Studio",uploaded:"Uploaded",downloading:"Downloading",edit:"Edit",email:"Email",phone:"Phone",empty:"Empty",emptyData:"No results found",enable:"Enable",engine:"Engine",env:"Environment",environment:"Environment",expandAll:"Expand All",expired:"Expired",expires:"Expires",export:"Export",externalIp:"External IP",failed:"Failed",filter:"Log Filter",fingerprint:"Fingerprint",finish:"Finish",forbid:"Forbid",free:"Free",general:"General",gitpod:"IS Gitpod",goEULA:'Click to view "End User License Agreement"',group:"Group",image:"IS Image",install:"Install",installed:"Installed",installedAt:"Installed At",installSuccess:"Successfully installed",installing:"Installing",internalIp:"Internal IP",introduction:"Introduction",invite:"Invite",inviting:"Inviting",ip:"IP",isPublic:"Public",issue:"Issue",issuer:"Issuer",item:"Item",joined:"Joined",key:"Key",lastPublishedAt:"Published At",launcher:"Launcher Information",leavePageTip:"Are you sure to leave the page?",link:"Link",loading:"loading",log:"View Logs",logStorage:"Log Storage",login:"Login",logo:"Logo",logout:"Logout",logs:"Logs",manageTeam:"Manage Team",marketplace:"Marketplace",member:"Member",members:"Members",memory:"Memory",meta:"Meta Data",analytics:"Analytics",runtime:"Runtime",traffic:"Traffic",less:"Less",more:"More",mountPoint:"MountPoint",name:"Name",next:"Next",no:"No",noData:"No records to display",notice:"Unexpected bad things will happen if you don't read this!",noticeTitle:"Notice",notification:"Notification",open:"Open",visitStore:"Visit Store",visitTarget:"Visit {name}",management:"Management",os:"Operating System",overview:"Overview",owner:"Owner",page404:"404 Page",passport:"Passport",display:"Display",permission:"Permission",port:"Port",pre:"Previous",preferences:"Preferences",preview:"Preview",protected:"Protected",protocol:"Protocol",purchase:"Purchase",reconnect:"Reconnect",disconnect:"Disconnect",readMore:"More",redirect:"Redirect",redirectCode:"Redirect Code",redirectPermanently:"Permanent Redirect",redirectTemporary:"Temporary Redirect",redirectUrl:"Redirect URL",rewrite:"Rewrite",release:"Release",rewriteUrl:"Rewrite URL",reject:"Reject",reload:"Reload",remark:"Remark",remove:"Remove",removeSuccess:"Remove successfully",renew:"Renew",reportIssue:"Report an issue",required:"Required",requiredErrorText:"{name} is required",resource:"Resource",restart:"Restart",restore:"Restore",retry:"Retry",revoke:"Revoke",role:"Role",running:"running",runtimeInfo:"Runtime Info",save:"Save",saveChanges:"Save Changes",saveSuccess:"Saved successfully",scheduleFailed:"schedule failed",scheduleSuccess:"successfully scheduled",scope:"Scope",screenshot:"Screenshots",search:"Search",security:"Security",serverDid:"Server DID",serverVersion:"Server Version",setting:"Settings",start:"Start",status:"Status",stop:"Stop",storage:"Storage",backup:"Backup",store:"Store",succeeded:"Succeeded",subscription:"Subscription",support:"Support URL or Email",switch:"Switch",team:"Team",the:"The",timeAgo:"{time} ago",title:"Title",type:"Type",unavailable:"Unavailable",update:"Update",updateAvailable:"New version {version} available",updatedAt:"Updated At",updatedBy:"Updated By",upgrade:"Upgrade",upgradeServer:"Upgrade Server",upgradeTo:"Upgrade to",upgrading:"Upgrading",uptime:"Uptime",url:"URL",valid:"Valid",value:"Value",version:"Version",visit:"Visit",waiting:"Waiting",webhook:"Integrations",yes:"Yes",invalidParam:"Invalid Params",launch:"Launch",price:"Price",redirecting:"Redirecting",error:"Error",reminder:"Reminder",normal:"Normal",gateway:"Gateway",verifyNFT:"Verify NFT",errorMessage:"Error Message: ",slugifyHint:"The actual mount point will be: {value}",strategy:"Strategy",auto:"Auto",manual:"Manual",progress:"In progress",fileCount:"File Count",fileSize:"File Size",time:"Time",startTime:"Start time",endTime:"End time",selected:"Selected",timeoutError:"Timeout error",tags:"Tags",sourceApp:"Belong to App",requiredInputPlaceholder:"Please Enter {name}",moveUp:"Move Up",moveDown:"Move Down",enabled:"Enabled",disabled:"Disabled",homepage:"Home Page",homepageTip:"Home Page or Live Demo URL",repository:"Repository",view:"View",expand:"Expand",collapse:"Collapse",all:"All",bugOrConnectDomain:"Purchase or configure existing domain",bugOrConnectDomainTip:"A domain name is your website's unique address on the internet. You can purchase a new domain from DID Names or any domain registrar, or configure an existing domain you already own.",connectExistingDomain:"Configure existing domain",domains:"Domains",didDomains:"DID Domains",didDomainsDescription:"The following domains are automatically managed by the DID:Names service.",systemDomains:"Default Domains",systemDomainsDescription:"The following domains are automatically assigned by default. While they are accessible, they are not intended for production use and should not be shared with customers. These domains are primarily for development purposes.",manualDomains:"My Domains",manualDomainsDescription:"The following domains are managed by your domain provider and have been manually configured to point to here.",timeInfo:"Timing",operator:"Operator",inviter:"Inviter",minutes:"Minutes",hours:"Hours",hour:"Hour",days:"Days",day:"Day",weeks:"Weeks",months:"Months",custom:"Custom",clear:"Clear",ok:"OK",environments:"Environments",sites:"Sites",active:"Active",backupTime:"Backup Time",lastUsedAt:"Last Used At",expiredAt:"Expiration Date",createdVia:"Created Via",neverExpired:"Never",baseInfo:"Basic Information",otherInfo:"Other Information",lightMode:"Light Mode",darkMode:"Dark Mode"},setup:{connect:{title:"Setup Blocklet Server",scan:"Use the following methods to become the owner of this server",confirm:"Review this operation on your DID Wallet",success:"Your account is connected to this server"},keyPair:{title:"Derive KeyPair",scan:"Connect your DID Wallet to generate a key-pair for this app",confirm:"Review this operation on your DID Wallet",success:"Your key pair is securely stored"},verify:{title:"Ownership Credential Required",scan:"Connect your DID Wallet to provide ownership credentials",confirm:"Review this operation on your DID Wallet",success:"Your account is connected to this server"},accept:{title:"Accepting server require ownership certificates",scan:"Connect your DID Wallet to provide ownership credentials",confirm:"Review this operation on your DID Wallet",success:"Your account is connected to this server"},title:"Setup Blocklet Server",steps:{eula:"End User License Agreement",eulaFooter:"I have read and agreed to the terms of the EULA",connect:"Connect Owner DID Wallet",verify:"Verify Ownership",basicSettings:"Basic Settings",launchApp:"Launch Application",complete:"Complete"},congratulation:"Congratulations! Your Blocklet Server is secure and ready to use",redirectButton:"Take me to dashboard!"},login:{login:"Connect",termsOfUse:"Terms of Use",agreeTermsOfUse:"I acknowledge that I have read and agree to the applicable",loginTo:"Connect to",description:"Only server owner and approved members can access the dashboard",switchDid:{title:"Switch Account",scan:"Please use the following methods to add switch account",confirm:"Confirm switch in your DID Wallet",success:"Successfully switched"},switchSpecifiedDid:{title:"Switch Account",scan:"You need switch DID to {did} to complete the following actions",confirm:"Confirm switch in your DID Wallet",success:"Successfully switched"},connect:{title:"Connect",scan:"Only server owner and approved members can access the dashboard",confirm:"Confirm on your DID Wallet",success:"You are successfully connected"},verify:{title:"Verify Access",scan:"Connect your DID Wallet to present owner or admin passport",confirm:"Confirm on your DID Wallet",success:"Your access is verified",abort:"Access verification aborted",description:"You need to provide {roles} passport to perform this operation, you will only be asked to verify again after 1 hour of inactivity.",descriptionForDestroy:"You need to provide {roles} passport to perform this dangerous operation to ensure safety."}},acceptServer:{title:"Claim Server with Ownership NFT",tooltip:"If you received a server ownership nft, you can claim your owner passport with this link."},didConnect:{genKeyPair:{title:"Generate Blocklet DID",scan:"Use the following methods to generate a Blocklet DID",success:"Successfully generate Blocklet DID",successDesc:"The Blocklet DID has been generate successfully (Subsequent publications require the wallet that generated the DID to operate)"},common:{invalidSession:"Invalid Session",invalidSessionDesc:"Session does not exist or has expired",connectionError:"Failed to connect"}},exchangePassport:{title:"Get Passport with NFT",success:"You have successfully get your passport and logged in with the passport",login:"Login",tooltip1:"If you own NFT from collection, ",tooltip2:"you can exchange your passport with this link.",dialog:{title:"Get Passport with NFT",scan:"Connect your DID Wallet to present your NFT to get a passport",confirm:"Select NFT on your DID Wallet",success:"Passport has been successfully exchanged"}},payablePassport:{title:"Purchase passport with payment",tooltip:"If you do not have a passport, you can purchase a passport with this link."},sidebar:{dashboard:"Dashboard",blocklets:"Blocklets",console:"Console",settings:"Settings"},system:{total:"Total",used:"Used",free:"Free",cores:"Number of cores",instances:"Number of instances"},blocklet:{external:"External",usingDocker:"This Blocklet will run using docker",usingIsolation:"This Blocklet will run using network isolation",notFound:"Blocklet not found on this server, maybe it has been deleted",installFromMarket:"Install New Blocklets",installFromUrl:"Install From Url",installFromCreate:"Create Blocklet",titleValidationError:"Title length must be between 3 and 40 characters",descriptionValidationError:"Description length must be between 3 and 80 characters",installFromDiskBackup:"Restore from this server",dockerImage:"Support Docker",installedAt:"Installed At",internal:"Internal",startedAt:"Started At",stoppedAt:"Stopped At",urlEmptyTip:"No Access URL, ",goToAddRule:"Go To Add",services:"Exposed Services",upstreamPort:"Upstream Port",noService:"No Services",appId:"App DID",appPid:"Permanent DID",whyNeedAppPid:"If your application has been migrated, the permanent DID is the DID generated when this Blocklet was originally installed",alsoKnownAs:"Also Known As",skSource:"Owner Wallet",skSourceMigratedTip:"This app was launched with a server managed wallet, and have migrated to DID Wallet for better security.",skSourceManagedTip:"This app is running with a server managed wallet, please migrate to DID Wallet as soon as possible for better security.",mountPoint:{description1:"This change may break URLs containing the old mount point, which may further leads to:",case1:"Broken resource references between blocklets within this app",case2:"Broken URL if you have shared them publicly",description2:"You can setup a redirect from the old mount point to the new one to minimize possible breaking changes."},reloadSuccess:"Blocklet was reloaded successfully",statusTip:"Blocklet is {status}",initialUptime:"Less than 1m",dashboard:"Blocklet Dashboard",noComponent:"Application has no components and cannot be started",gotoVisitError:"Unable to access blocklet url, please try again later",fromUrl:{title:"Install Blocklet",label:"Blocklet Meta URL",description:"The URL should point to the Meta File of the Blocklet. If you need to refer to a local file, please add the file:// prefix, e.g. file:///Users/foo/blocklet.json.",confirm:"Install",step0:"Input URL",step1:"Confirm Meta Info",existTipPrefix:"Blocklet with the same DID already exists, the version is",existTipSuffix:", Please install a higher version."},action:{stopDescription:"Stopping the blocklet will make its public interfaces unaccessible, which may cause end user failures",stopComponentDescription:"Stopping the component will make its public interfaces unaccessible, which may cause end user failures",confirmStop:"Yes, Stop It",cancelDownloadDescription:"Cancel download {name} ?",removeApplicationDescription:"Removing the application will erase code and data generated by this application, which is not recoverable if you do not have any backups",removeApplicationAfterBackup:"Backup and remove the application. You can restore the application from this server if you need",removeApplicationComplete:"Remove both code and data for this application",removeComponentDescription:"Removing the component will erase code and data generated by this component, which is not recoverable if you do not have any backups",removeComponentKeepData:"Keep data for this component, only remove code",removeComponentComplete:"Remove both code and data for this component",confirmRemove:"Yes, Remove It",confirmComponentRemove:"Yes, Remove It",upgradeDescription:"Upgrading the blocklet will make it temporarily unavailable, are you sure to continue?",confirmUpgrade:"Yes, Upgrade It",confirmRestart:"Yes, Restart It",restartDescription:"Restarting the blocklet will temporarily suspended and may not start because of a configuration change"},dev:{modeTip:"Please switch Blocklet Server to DEBUG mode"},index:{tableTitle:"Manage Your Blocklets",noBlocklet:"No blocklets found in this Blocklet Server, install a blocklet from market place to start."},config:{baseInfo:"Basic Information",baseInfoDesc:"The basic information of the website can be set here.",logoSettings:"Visual Information",logoSettingsDesc:"Shape a unique brand image, enhance the website's recognition and visual appeal in various scenarios.",languagesDesc:"Used in: visitor language selection",changeImageTip:"Tip: If you want to change the picture, please click Preview Picture to change it.",name:"App Name",nameDesc:"Used in: DID Connect header, browser tab, website footer, SEO metadata and OpenGraph metadata",description:"App Description",descriptionDesc:"Used in: SEO metadata and OpenGraph metadata",logoSquare:"App Logo",logoSquareDesc:"Used in: DID Connect footer and DID Wallet application list",logoDesc:`
3
3
  Recommended Size: {width}* {height} pixels`,logoRect:"Rect logo",logoRectDesc:"Used in: website header and footer",logoFavicon:"Favicon",logoFaviconDesc:"Used in: browser address bar and tab",splashPortrait:"Splash",splashDesc:`Used in: ArcSphere APP launch screen
4
4