@abtnode/blocklet-services 1.16.44-beta-20250523-232943-369d21c5 → 1.16.44-beta-20250524-065731-c62fd374
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{access-control-EYKfTdyZ.js → access-control-CHRw2bbp.js} +1 -1
- package/dist/assets/{add-component-core-CKSc86QZ.js → add-component-core-eEjKF53n.js} +31 -31
- package/dist/assets/{add-resource-DFFU3s6r.js → add-resource-W-ML3m5q.js} +1 -1
- package/dist/assets/{advanced-dEhSilIC.js → advanced-CPhRkaAJ.js} +1 -1
- package/dist/assets/{appearance-fl_Qmz60.js → appearance-Bgtb4-LE.js} +1 -1
- package/dist/assets/{audit-logs-T_rQofLT.js → audit-logs-DCTnwVQT.js} +1 -1
- package/dist/assets/{authorize-BAWXv5fL.js → authorize-0cAl16_K.js} +1 -1
- package/dist/assets/{branding-BaN8vHON.js → branding-6OsQw5QJ.js} +2 -2
- package/dist/assets/{branding-BTvktwMq.js → branding-Bv8Tk-Am.js} +1 -1
- package/dist/assets/{bundle-avatar-Bn82ny8E.js → bundle-avatar-WoSDDX0E.js} +1 -1
- package/dist/assets/{complete-B3gpz2H0.js → complete-BJLGhmnP.js} +1 -1
- package/dist/assets/{component-CxESL3Iu.js → component-BFi7evus.js} +1 -1
- package/dist/assets/{config-CKVskCpr.js → config-BfjiZ8-q.js} +1 -1
- package/dist/assets/{config-navigation-C40INCPl.js → config-navigation-BkfKynqT.js} +3 -3
- package/dist/assets/{config-space-CPPhaFPB.js → config-space-DID86BbB.js} +1 -1
- package/dist/assets/{confirm-Dg7hYCJT.js → confirm-BnRcXvxs.js} +1 -1
- package/dist/assets/{connect-Ctst7unk.js → connect-DJCBGsCy.js} +1 -1
- package/dist/assets/connect-DyhNsjIB.js +5 -0
- package/dist/assets/{connect-to-DOaPjxw6.js → connect-to-BYS6M9JU.js} +1 -1
- package/dist/assets/{dashboard-i-yx5Pql.js → dashboard-RTzIKcnI.js} +3 -3
- package/dist/assets/{delete-confirm-BvvDet1u.js → delete-confirm-2yiel8lV.js} +1 -1
- package/dist/assets/domain-B7QeQ3KX.js +9 -0
- package/dist/assets/{domain-action-card-DRQUwMj6.js → domain-action-card-CLEjpu-P.js} +1 -1
- package/dist/assets/domains-Bu0iN_az.js +1 -0
- package/dist/assets/dot-itVN8XTt.js +7 -0
- package/dist/assets/{email-B00NK4Kp.js → email-9sDMxuoB.js} +1 -1
- package/dist/assets/{exchange-passport-DZ1Omnfv.js → exchange-passport-CzmhafoN.js} +1 -1
- package/dist/assets/{fuel-DkJB9TXk.js → fuel-D_QIEw1n.js} +1 -1
- package/dist/assets/{gen-access-key-DME0XOB3.js → gen-access-key-BmDWpAif.js} +1 -1
- package/dist/assets/{index-C9-sIzmv.js → index-B4CzEaVv.js} +1 -1
- package/dist/assets/{index-Cf3pTZQS.js → index-B4rUFDP9.js} +1 -1
- package/dist/assets/{index-Ck-L27nB.js → index-B6g_NzxF.js} +2 -2
- package/dist/assets/{index-Diy9mBRc.js → index-BctwEFbW.js} +1 -1
- package/dist/assets/{index-DWV8Jczt.js → index-Bhwq-PC6.js} +1 -1
- package/dist/assets/{index-v_V1vBsu.js → index-Bw-rbXJI.js} +1 -1
- package/dist/assets/{index-BGbF_TCU.js → index-CGHej0Ek.js} +3 -3
- package/dist/assets/{index-Dmcajroh.js → index-CT4keHaK.js} +1 -1
- package/dist/assets/{index-BOrnIOJA.js → index-CtxraYdM.js} +1 -1
- package/dist/assets/{index-CXjHuFcg.js → index-D45FqXMt.js} +1 -1
- package/dist/assets/{index-AMPo4oen.js → index-DBBjaba5.js} +1 -1
- package/dist/assets/{index-Ddqbpb3u.js → index-DLdz4ykT.js} +1 -1
- package/dist/assets/{index-D669bu3T.js → index-DdKYu9HL.js} +4 -4
- package/dist/assets/{index-BAVIVYtT.js → index-Dq_lSUqL.js} +1 -1
- package/dist/assets/{index-C2FIN4Ee.js → index-DtsBFtZP.js} +1 -1
- package/dist/assets/{index-BnFkiSCK.js → index-Z_7QgoWt.js} +1 -1
- package/dist/assets/{invitation-DgyvRGj7.js → invitation-DG9MWQbS.js} +1 -1
- package/dist/assets/{invite-CpiILEDC.js → invite-DLCj8sz9.js} +1 -1
- package/dist/assets/{issue-passport-BtYhvb89.js → issue-passport-BWxVIA89.js} +1 -1
- package/dist/assets/{item-JiENn3N2.js → item-CUEEdtq7.js} +1 -1
- package/dist/assets/{layout-D40Fy8O5.js → layout-BpHPXY7v.js} +1 -1
- package/dist/assets/{list-vUoPUWDO.js → list-95F7XaG9.js} +1 -1
- package/dist/assets/{list-Dm4NCtd2.js → list-TUiipUoi.js} +2 -2
- package/dist/assets/{log-B2MHND50.js → log-aS7wDHYq.js} +1 -1
- package/dist/assets/{login-CGPNIfmK.js → login-BEhRbdo1.js} +1 -1
- package/dist/assets/{logo-uploader-PUDZmwys.js → logo-uploader-CLz5RPTu.js} +2 -2
- package/dist/assets/{lost-passport-CPgs6iwG.js → lost-passport-C2TUuANu.js} +1 -1
- package/dist/assets/{overview-DnOgyK55.js → overview-CSLXBT0F.js} +1 -1
- package/dist/assets/{passport-item-BugDNovJ.js → passport-item-hLzOrz7-.js} +1 -1
- package/dist/assets/{publish-resource-3814heud.js → publish-resource-BImGOxGu.js} +1 -1
- package/dist/assets/{runtime-DiYnPWFr.js → runtime-BdS45sOH.js} +1 -1
- package/dist/assets/{security-B9_Hq9IS.js → security-bFZAakv0.js} +1 -1
- package/dist/assets/setup-DMmxE-ov.js +30 -0
- package/dist/assets/{start-CGbnYNse.js → start-BXBhW0EF.js} +1 -1
- package/dist/assets/{status-Bcm8tb3P.js → status-CIwF9IiE.js} +1 -1
- package/dist/assets/{step-actions-Cg48h78A.js → step-actions-Cy_Wn9XZ.js} +1 -1
- package/dist/assets/table-tips-BP0JTpDH.js +1 -1
- package/dist/assets/{traffic-B6tOFf5s.js → traffic-Bz2-5BjC.js} +1 -1
- package/dist/assets/{transfer-DgLkTH8K.js → transfer-CZ88q7e8.js} +1 -1
- package/dist/assets/{unsubscribe-BqDBVi9S.js → unsubscribe-Dc0yE6SM.js} +1 -1
- package/dist/assets/{use-blocklet-logo-7IVWq7WH.js → use-blocklet-logo-DeL5Lmpn.js} +1 -1
- package/dist/assets/use-server-logo-CxuMvwKh.js +1 -1
- package/dist/assets/useAsync-510ntT1B.js +1 -0
- package/dist/assets/{user-center-Sntfjt65.js → user-center-3TxDrG6m.js} +1 -1
- package/dist/assets/{util-D9dsxEYk.js → util-KGAW0YJ4.js} +1 -1
- package/dist/assets/{wrap-locale-Q616uqhq.js → wrap-locale-BjqARXGJ.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
- package/dist/assets/connect-C3we9ebX.js +0 -5
- package/dist/assets/domain-CuSKFz52.js +0 -9
- package/dist/assets/domains-QTRMAE0S.js +0 -1
- package/dist/assets/dot-DX56IFTM.js +0 -7
- package/dist/assets/setup-BaybnOtz.js +0 -30
- package/dist/assets/useAsync-Dv214fz8.js +0 -1
- package/dist/assets/useAsync-KYUBhVsb.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as se,Z as U,c0 as Me,c1 as $e,I as K,b_ as Ve,b$ as Ne,ad as He,ac as Je,c2 as Ke,b4 as De,j as he,r as Pe,b2 as G,c3 as xe,am as ge,B as z,bN as Ge,a6 as Ze,c4 as Xe,a7 as Ye,a3 as Qe,a0 as et,as as Ce}from"./vendor-ux-did-connect-DprdyYny.js";import{u as p,a as ae,f as te,c as tt}from"./vendor-hooks-BgUTpb6X.js";import{r as A}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as _,bo as E,O,y as V,H,T as ne,I as oe,X as ie,ah as Oe,al as $,cI as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,be as at}from"./vendor-mui-core-BV2FUxWJ.js";import{a9 as rt,O as qe,X as ot,c as it}from"./vendor-arcblock-CUb0jDdY.js";import{J as Y,a8 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-rHXShPKm.js";import{D as J,G as N,aA as re,aB as L,aJ as Re}from"./index-Ck-L27nB.js";import{S as le}from"./switch-control-DzZXz9Ks.js";import{S as D}from"./section-BB6hVmdO.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-CBALX7k4.js";import{b as xt}from"./base32-DEQDAhbh.js";import{u as ft}from"./use-mobile-BAa0wi8o.js";import"./lottie-web-jYmAQWuC.js";const ce={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...ce},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async r=>{var T,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...ce},((a=(T=b==null?void 0:b.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(m),U.success(n("oauth.saveSuccess"))}catch(b){U.error(b.message||n("oauth.saveFailed"))}}),I=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(L,{name:"domain",control:f,rules:{validate:d?I:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((T=c.errors[r.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 de={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...de},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...de},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.github)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=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(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...ue},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.google)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=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(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,T;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...me},((T=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),P=Object.assign({...me},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(P),U.success(n("oauth.saveSuccess"))}catch(R){U.error(R.message||n("oauth.saveFailed"))}}),I=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:a})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(L,{name:"teamId",control:f,rules:{validate:d?I:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(L,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(L,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(L,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(L,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={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:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=A.useState(t),l=A.useRef(null),d=A.useRef(null),[{handlerId:k},I]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,T=s;if(r===T)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,P=i.getClientOffset().y-a.top;r<T&&P<m||r>T&&P>m||(w(r,T),S.index=T)}}),[{isDragging:x},g]=$e({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),I(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(oe,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(ie,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,I;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((I=o==null?void 0:o.settings)==null?void 0:I.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.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(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ve,{backend:Ne,...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 Z={ttl:he.SESSION_TTL,cacheTtl:he.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 W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function pe(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Tt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(pe(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),I=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),T=p(async m=>{var R;try{const{blocklet:P}=await j.updateAppSessionConfig({input:{did:n,config:ct(pe(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=P==null?void 0:P.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(M)),U.success(l("common.configSuccess"))}catch(P){U.error(P.message)}});return e.jsx(It,{onSubmit:w(T),children:e.jsxs($,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:ie,my:3})]}),e.jsxs($,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),I&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>v(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>r(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs($,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:ie,my:3}),e.jsx($,{direction:"column",spacing:2,children:e.jsx(L,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,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(u,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const It=Oe.form`
|
|
1
|
+
import{a as se,Z as U,c0 as Me,c1 as $e,I as K,b_ as Ve,b$ as Ne,ad as He,ac as Je,c2 as Ke,b4 as De,j as he,r as Pe,b2 as G,c3 as xe,am as ge,B as z,bN as Ge,a6 as Ze,c4 as Xe,a7 as Ye,a3 as Qe,a0 as et,as as Ce}from"./vendor-ux-did-connect-DprdyYny.js";import{u as p,a as ae,f as te,c as tt}from"./vendor-hooks-BgUTpb6X.js";import{r as A}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as _,bo as E,O,y as V,H,T as ne,I as oe,X as ie,ah as Oe,al as $,cI as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,be as at}from"./vendor-mui-core-BV2FUxWJ.js";import{a9 as rt,O as qe,X as ot,c as it}from"./vendor-arcblock-CUb0jDdY.js";import{J as Y,a8 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-rHXShPKm.js";import{D as J,G as N,aA as re,aB as L,aJ as Re}from"./index-B6g_NzxF.js";import{S as le}from"./switch-control-DzZXz9Ks.js";import{S as D}from"./section-BB6hVmdO.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-CBALX7k4.js";import{b as xt}from"./base32-DEQDAhbh.js";import{u as ft}from"./use-mobile-C21X4TYN.js";import"./lottie-web-jYmAQWuC.js";const ce={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...ce},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async r=>{var T,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...ce},((a=(T=b==null?void 0:b.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(m),U.success(n("oauth.saveSuccess"))}catch(b){U.error(b.message||n("oauth.saveFailed"))}}),I=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(L,{name:"domain",control:f,rules:{validate:d?I:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((T=c.errors[r.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 de={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...de},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...de},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.github)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=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(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...ue},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.google)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=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(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,T;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...me},((T=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),P=Object.assign({...me},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(P),U.success(n("oauth.saveSuccess"))}catch(R){U.error(R.message||n("oauth.saveFailed"))}}),I=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:a})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(L,{name:"teamId",control:f,rules:{validate:d?I:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(L,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(L,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(L,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(L,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={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:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=A.useState(t),l=A.useRef(null),d=A.useRef(null),[{handlerId:k},I]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,T=s;if(r===T)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,P=i.getClientOffset().y-a.top;r<T&&P<m||r>T&&P>m||(w(r,T),S.index=T)}}),[{isDragging:x},g]=$e({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),I(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(oe,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(ie,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,I;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((I=o==null?void 0:o.settings)==null?void 0:I.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.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(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ve,{backend:Ne,...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 Z={ttl:he.SESSION_TTL,cacheTtl:he.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 W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function pe(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Tt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(pe(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),I=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),T=p(async m=>{var R;try{const{blocklet:P}=await j.updateAppSessionConfig({input:{did:n,config:ct(pe(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=P==null?void 0:P.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(M)),U.success(l("common.configSuccess"))}catch(P){U.error(P.message)}});return e.jsx(It,{onSubmit:w(T),children:e.jsxs($,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:ie,my:3})]}),e.jsxs($,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),I&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>v(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>r(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs($,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:ie,my:3}),e.jsx($,{direction:"column",spacing:2,children:e.jsx(L,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,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(u,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const It=Oe.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 xn,e as Ct,a as yn}from"./vendor-react-DEoibe3W.js";import{a9 as Et,j as e,aa as E,bo as Be,br as Fe,bn as $e,q as Ce,T as Y,O as de,ab as oe,bx as qe,ak as re,H as v,ah as M,e as vn,ad as me,w as bn,y as Ot,b4 as Cn,b5 as jn,I as Sn,bh as wn,bs as Pn,bR as In}from"./vendor-mui-core-BV2FUxWJ.js";import{B as jt,e as We,$ as kn,ay as Tn,n as St,A as Dn,b as An}from"./vendor-utils-rHXShPKm.js";import{r as Nt,aJ as _t,by as Rn,h as Ln,a as V,Y as En,X as On,Z,am as te,B as z,e as Nn,ao as _n,d as Un,b2 as ue,bo as Bn,j as Q,a0 as Ut,ai as Fn,I as $n,as as Wn,W as ze,b4 as zn,a7 as Bt,a6 as Ft,bu as Mn}from"./vendor-ux-did-connect-DprdyYny.js";import{c as G,a as qn,Z as $t,O as je,I as Hn,_ as Vn}from"./vendor-arcblock-CUb0jDdY.js";import{d as Kn}from"./ViewList-ByzGtByR.js";import{a2 as Zn,f as Yn,D as H,ax as Se,n as pe,a3 as Qn,V as ne,ay as Gn,G as Wt,az as zt,y as Jn,b as Xn}from"./index-Ck-L27nB.js";import{U as Mt,C as qt,I as es}from"./index-iphP5FWX.js";import{k as ts,u as He,a as Ve,c as ns,m as ss,f as rs}from"./vendor-hooks-BgUTpb6X.js";import{l as os}from"./index-C5N0NjEs.js";import{u as K,d as wt,W as Ht}from"./dashboard-i-yx5Pql.js";import{W as Ke}from"./did-address-2a_50VlM.js";import{P as J}from"./permission-BkpeOUF9.js";import{C as ke}from"./click-to-copy-DsH0RQVg.js";import{T as Vt}from"./index-C9-sIzmv.js";import{f as X}from"./index-8eXqqyHQ.js";import{u as is}from"./useAsync-KYUBhVsb.js";import{I as q}from"./index-CBALX7k4.js";import{d as as}from"./DeleteOutline-DIXSGJ49.js";import{C as fe}from"./confirm-Dg7hYCJT.js";import{u as he}from"./session-E0e-X6-a.js";import{i as Kt,a as we,p as Zt}from"./util-IzAdTupy.js";import{b as ls}from"./sdk-DeUOtvaE.js";import{A as cs}from"./actions-XNIU_ion.js";import{S as ds}from"./shorten-label-DPIZ5X7v.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./useLocalStorage-DvcK7KsP.js";import"./PlayArrow-CrmMAssx.js";import"./get-safe-url-BdFxF8pA.js";import"./use-blocklet-logo-7IVWq7WH.js";import"./InfoOutlined-Cxpk0UTX.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-DnsMePpQ.js";import"./base32-DEQDAhbh.js";import"./MoreHoriz-CKCGMlB8.js";var Ze={},ms=Et;Object.defineProperty(Ze,"__esModule",{value:!0});var Yt=Ze.default=void 0,ps=ms(Nt()),us=e;Yt=Ze.default=(0,ps.default)((0,us.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 Ye=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)"})})})]})};Ye.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ye.displayName="person";const fs=Ye;var Qe=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"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var be={},hs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Gt="%[a-f0-9]{2}",Pt=new RegExp("("+Gt+")|([^%]+?)","gi"),It=new RegExp("("+Gt+")+","gi");function Me(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),p=t.slice(r);return Array.prototype.concat.call([],Me(l),Me(p))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(Pt)||[],l=1;l<r.length;l++)t=Me(r,l).join(""),r=t.match(Pt)||[];return t}}function xs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=It.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var p=gs(l[0]);p!==l[0]&&(r[l[0]]=p)}l=It.exec(t)}r["%C2"]="�";for(var d=Object.keys(r),g=0;g<d.length;g++){var S=d[g];t=t.replace(new RegExp(S,"g"),r[S])}return t}var ys=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 xs(t)}},vs=(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)]},bs=function(t,r){for(var l={},p=Object.keys(t),d=Array.isArray(r),g=0;g<p.length;g++){var S=p[g],u=t[S];(d?r.indexOf(S)!==-1:r(S,u,t))&&(l[S]=u)}return l};(function(t){const r=hs,l=ys,p=vs,d=bs,g=n=>n==null;function S(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 u(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 y=typeof c=="string"&&c.includes(n.arrayFormatSeparator),w=typeof c=="string"&&!y&&o(c,n).includes(n.arrayFormatSeparator);c=w?o(c,n):c;const U=y||w?c.split(n.arrayFormatSeparator).map(F=>o(F,n)):c===null?c:o(c,n);x[a]=U};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function b(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 o(n,s){return s.decode?l(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function I(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function i(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function k(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 m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const a=u(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[y,w]=p(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:o(w,s),a(o(y,s),w,c)}for(const x of Object.keys(c)){const y=c[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=k(y[w],s);else c[x]=k(y,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,y)=>{const w=c[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=i,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const a=w=>s.skipNull&&g(n[w])||s.skipEmptyString&&n[w]==="",c=S(s),x={};for(const w of Object.keys(n))a(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const U=n[w];return U===void 0?"":U===null?h(w,s):Array.isArray(U)?U.reduce(c(w),[]).join("&"):h(w,s)+"="+h(U,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=p(n,"#");return Object.assign({url:a.split("?")[0]||"",query:m(i(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:o(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=C(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let U=I(n.url);return n.fragmentIdentifier&&(U=`#${h(n.fragmentIdentifier,s)}`),`${a}${w}${U}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:y}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:d(x,s),fragmentIdentifier:y},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,c,a)}})(be);const ae=gn,Cs={parseNumbers:!1,parseBooleans:!1},js={skipNull:!1,skipEmptyString:!1},Ss=(t,r)=>{var l,p;const{navigateMode:d="push",parseOptions:g,stringifyOptions:S}={},u=Object.assign(Object.assign({},Cs),g),b=Object.assign(Object.assign({},js),S),h=ae.useLocation(),o=(l=ae.useHistory)===null||l===void 0?void 0:l.call(ae),T=(p=ae.useNavigate)===null||p===void 0?void 0:p.call(ae),C=ts(),I=P.useRef(typeof t=="function"?t():t||{}),i=P.useMemo(()=>be.parse(h.search,u),[h.search]),k=P.useMemo(()=>Object.assign(Object.assign({},I.current),i),[i]);return[k,He(n=>{const s=typeof n=="function"?n(k):n;C(),o&&o[d]({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},h.state),T&&T({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},{replace:d==="replace",state:h.state})})]},ws=Ss,Ps=_t,Ne=Rn,_e=Ln,Is=os,kt={role:Ps.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,p)=>{let d=l||kt;const g=(0,_e.isEthereumType)((0,_e.DidType)(l));if(g?d=(0,Ne.WalletType)(l):d=(0,Ne.WalletType)(kt),!(0,_e.isValid)(t)){let S="";try{return g?S=t.slice(0,66):S=t,(0,Ne.fromSecretKey)(S,d)}catch(u){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${u.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Is.fromAppDid)(t,r,d,p||0)};var Ts=ks,Jt=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const le=Jt(Zn),Ds=_t,ye=Jt(Ts),As=Yn,Rs=(t,r,{returnWallet:l=!0}={})=>{var F,A;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,le.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:p,configs:d=[]}=t,g=[...d,...p],S=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),u=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:o,version:T}=t.meta,C=(0,As.getDisplayName)(t),I=(0,le.default)(S,"value",t.meta.description),i=(0,le.default)(u,"value","auto"),k=(0,le.default)(b,"value",""),m=(0,le.default)(h,"value","");if(!l)return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:"",wallet:null,permanentWallet:null,tenantMode:m};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,y=null;if(n&&n.value)x=(0,ye.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(y=(0,ye.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,ye.default)(t.meta.did,r,c):x=(0,ye.default)(t.meta.did,r)}const w=((A=(F=t.settings)==null?void 0:F.session)==null?void 0:A.salt)||"",U=Ds.Hasher.SHA3.hash256(jt.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>jt.from(D))));return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:U,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ls=Rs;const Es=xn(Ls);function Ge({teamDid:t,roles:r,apps:l,onCancel:p,onSuccess:d,onError:g,endpoint:S}){var k;const{api:u}=H(),{t:b,locale:h}=V(),o=Ve({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!o.role){o.error=b("team.member.error.passportEmpty");return}const m=o.remark.trim();o.error=null,o.loading=!0;try{let n=o.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:o.role,remark:m,sourceAppPid:n,passportExpireTime:o.passportExpireTime?o.passportExpireTime.toISOString():""};o.display&&(s.display={type:"url",content:o.display});const{inviteInfo:a}=await u.createMemberInvitation({input:s});o.inviteInfo=a,o.activeStep=1}catch(n){const s=X(n);o.error=s,g(n)}finally{o.loading=!1}},C=r.find(m=>m.name===o.role),i=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(Be,{fullWidth:!0,children:[e.jsx(Fe,{children:b("common.sourceApp")}),e.jsx($e,{value:o.sourceAppPid,onChange:m=>{o.error=null,o.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,children:l.map(m=>e.jsx(Ce,{value:m.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(En,{did:m.appPid,size:28}),m.appName]}),e.jsx(On,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Be,{fullWidth:!0,variant:"outlined",children:[e.jsx(Fe,{children:b("common.passport")}),e.jsx($e,{"data-cy":"invite-member-select-role",value:o.role,onChange:m=>{o.error=null,o.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:r.filter(m=>m.name!=="owner").map(m=>e.jsx(Ce,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Y,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Y,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((k=C==null?void 0:C.extra)==null?void 0:k.display)==="custom"&&e.jsx(de,{label:b("common.display"),type:"url",value:o.display,onChange:m=>{o.error=null,o.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.remark,onChange:m=>{o.error=null,o.remark=m.target.value},disabled:o.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Vt,{value:o.passportExpireTime,onChange:m=>{o.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:p,onConfirm:T},{body:()=>{var n,s;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=o.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});ns(m),Z.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:p}][o.activeStep];return e.jsxs(te,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[i.cancel&&e.jsx(z,{onClick:i.onCancel,color:"inherit",children:i.cancel}),e.jsxs(z,{onClick:i.onConfirm,color:"primary",disabled:o.loading||!o.role,variant:"contained",autoFocus:!0,children:[o.loading&&e.jsx(oe,{size:16}),i.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof i.body=="function"?i.body():i.body}),!!o.error&&e.jsx(re,{severity:"error",variant:"icon",children:o.error})]})}Ge.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Ge.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Je({teamDid:t,onCancel:r,onSuccess:l,onError:p,endpoint:d}){const{api:g,info:S}=H(),{api:u}=P.useContext(Nn),[b,h]=P.useState(!1),{t:o,locale:T}=V(),[C,I]=P.useState(""),[i,k]=P.useState(!1),[m,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),y=!!We(S,"ownerNft.did"),w=is(async()=>{if(y){const{state:R}=await g.getDelegationState();return R}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(oe,{})})});if(w.error)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(re,{severity:"error",variant:"icon",children:X(w.error)})});const U=async()=>{I(null),h(!0);try{const{inviteInfo:R}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(R),n(D.length-1)}catch(R){const W=X(R);I(W),p(R)}finally{h(!1)}},F=()=>{k(!0),n(1)},A=()=>{k(!1),n(0)},D=[{body:e.jsxs(Y,{component:"div",children:[e.jsxs(re,{severity:"warning",children:[e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(re,{severity:"warning",children:e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:R=>{I(null),x(R.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:o("common.cancel"),confirm:o("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:y&&!We(w,"value.delegated")?F:U},{body:()=>e.jsx(_n,{action:"delegate-transfer-nft",open:i,locale:T,checkFn:u.get,onClose:A,onSuccess:U,checkTimeout:5*60*1e3,webWalletUrl:Qn(S),extraParams:{targetDID:S.did},messages:{title:o("team.transferNode.delegateDialog.title"),scan:o("team.transferNode.delegateDialog.scan"),confirm:o("team.transferNode.delegateDialog.confirm"),success:o("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const R=Se({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Os,{children:o("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:R})]})},confirm:o("common.confirm"),onConfirm:l}],O=D[m];return e.jsxs(te,{title:o("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:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(oe,{size:16}),O.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(re,{severity:"error",variant:"icon",children:C})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Je.defaultProps={onError:()=>{},endpoint:""};const Os=M.div`
|
|
1
|
+
import{r as P,t as gn,g as xn,e as Ct,a as yn}from"./vendor-react-DEoibe3W.js";import{a9 as Et,j as e,aa as E,bo as Be,br as Fe,bn as $e,q as Ce,T as Y,O as de,ab as oe,bx as qe,ak as re,H as v,ah as M,e as vn,ad as me,w as bn,y as Ot,b4 as Cn,b5 as jn,I as Sn,bh as wn,bs as Pn,bR as In}from"./vendor-mui-core-BV2FUxWJ.js";import{B as jt,e as We,$ as kn,ay as Tn,n as St,A as Dn,b as An}from"./vendor-utils-rHXShPKm.js";import{r as Nt,aJ as _t,by as Rn,h as Ln,a as V,Y as En,X as On,Z,am as te,B as z,e as Nn,ao as _n,d as Un,b2 as ue,bo as Bn,j as Q,a0 as Ut,ai as Fn,I as $n,as as Wn,W as ze,b4 as zn,a7 as Bt,a6 as Ft,bu as Mn}from"./vendor-ux-did-connect-DprdyYny.js";import{c as G,a as qn,Z as $t,O as je,I as Hn,_ as Vn}from"./vendor-arcblock-CUb0jDdY.js";import{d as Kn}from"./ViewList-ByzGtByR.js";import{a2 as Zn,f as Yn,D as H,ax as Se,n as pe,a3 as Qn,V as ne,ay as Gn,G as Wt,az as zt,y as Jn,b as Xn}from"./index-B6g_NzxF.js";import{U as Mt,C as qt,I as es}from"./index-iphP5FWX.js";import{k as ts,u as He,a as Ve,c as ns,m as ss,f as rs}from"./vendor-hooks-BgUTpb6X.js";import{l as os}from"./index-C5N0NjEs.js";import{u as K,d as wt,W as Ht}from"./dashboard-RTzIKcnI.js";import{W as Ke}from"./did-address-2a_50VlM.js";import{P as J}from"./permission-BkpeOUF9.js";import{C as ke}from"./click-to-copy-DsH0RQVg.js";import{T as Vt}from"./index-B4CzEaVv.js";import{f as X}from"./index-8eXqqyHQ.js";import{_ as is}from"./useAsync-510ntT1B.js";import{I as q}from"./index-CBALX7k4.js";import{d as as}from"./DeleteOutline-DIXSGJ49.js";import{C as fe}from"./confirm-BnRcXvxs.js";import{u as he}from"./session-E0e-X6-a.js";import{i as Kt,a as we,p as Zt}from"./util-IzAdTupy.js";import{b as ls}from"./sdk-DeUOtvaE.js";import{A as cs}from"./actions-XNIU_ion.js";import{S as ds}from"./shorten-label-DPIZ5X7v.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./useLocalStorage-DvcK7KsP.js";import"./PlayArrow-CrmMAssx.js";import"./get-safe-url-BdFxF8pA.js";import"./use-blocklet-logo-DeL5Lmpn.js";import"./InfoOutlined-Cxpk0UTX.js";import"./dot-itVN8XTt.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAa0wi8o.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-DnsMePpQ.js";import"./base32-DEQDAhbh.js";import"./MoreHoriz-CKCGMlB8.js";var Ze={},ms=Et;Object.defineProperty(Ze,"__esModule",{value:!0});var Yt=Ze.default=void 0,ps=ms(Nt()),us=e;Yt=Ze.default=(0,ps.default)((0,us.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 Ye=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)"})})})]})};Ye.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ye.displayName="person";const fs=Ye;var Qe=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"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var be={},hs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Gt="%[a-f0-9]{2}",Pt=new RegExp("("+Gt+")|([^%]+?)","gi"),It=new RegExp("("+Gt+")+","gi");function Me(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),p=t.slice(r);return Array.prototype.concat.call([],Me(l),Me(p))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(Pt)||[],l=1;l<r.length;l++)t=Me(r,l).join(""),r=t.match(Pt)||[];return t}}function xs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=It.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var p=gs(l[0]);p!==l[0]&&(r[l[0]]=p)}l=It.exec(t)}r["%C2"]="�";for(var d=Object.keys(r),g=0;g<d.length;g++){var S=d[g];t=t.replace(new RegExp(S,"g"),r[S])}return t}var ys=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 xs(t)}},vs=(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)]},bs=function(t,r){for(var l={},p=Object.keys(t),d=Array.isArray(r),g=0;g<p.length;g++){var S=p[g],u=t[S];(d?r.indexOf(S)!==-1:r(S,u,t))&&(l[S]=u)}return l};(function(t){const r=hs,l=ys,p=vs,d=bs,g=n=>n==null;function S(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 u(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 y=typeof c=="string"&&c.includes(n.arrayFormatSeparator),w=typeof c=="string"&&!y&&o(c,n).includes(n.arrayFormatSeparator);c=w?o(c,n):c;const U=y||w?c.split(n.arrayFormatSeparator).map(F=>o(F,n)):c===null?c:o(c,n);x[a]=U};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function b(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 o(n,s){return s.decode?l(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function I(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function i(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function k(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 m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const a=u(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[y,w]=p(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:o(w,s),a(o(y,s),w,c)}for(const x of Object.keys(c)){const y=c[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=k(y[w],s);else c[x]=k(y,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,y)=>{const w=c[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=i,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const a=w=>s.skipNull&&g(n[w])||s.skipEmptyString&&n[w]==="",c=S(s),x={};for(const w of Object.keys(n))a(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const U=n[w];return U===void 0?"":U===null?h(w,s):Array.isArray(U)?U.reduce(c(w),[]).join("&"):h(w,s)+"="+h(U,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=p(n,"#");return Object.assign({url:a.split("?")[0]||"",query:m(i(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:o(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=C(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let U=I(n.url);return n.fragmentIdentifier&&(U=`#${h(n.fragmentIdentifier,s)}`),`${a}${w}${U}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:y}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:d(x,s),fragmentIdentifier:y},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,c,a)}})(be);const ae=gn,Cs={parseNumbers:!1,parseBooleans:!1},js={skipNull:!1,skipEmptyString:!1},Ss=(t,r)=>{var l,p;const{navigateMode:d="push",parseOptions:g,stringifyOptions:S}={},u=Object.assign(Object.assign({},Cs),g),b=Object.assign(Object.assign({},js),S),h=ae.useLocation(),o=(l=ae.useHistory)===null||l===void 0?void 0:l.call(ae),T=(p=ae.useNavigate)===null||p===void 0?void 0:p.call(ae),C=ts(),I=P.useRef(typeof t=="function"?t():t||{}),i=P.useMemo(()=>be.parse(h.search,u),[h.search]),k=P.useMemo(()=>Object.assign(Object.assign({},I.current),i),[i]);return[k,He(n=>{const s=typeof n=="function"?n(k):n;C(),o&&o[d]({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},h.state),T&&T({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},{replace:d==="replace",state:h.state})})]},ws=Ss,Ps=_t,Ne=Rn,_e=Ln,Is=os,kt={role:Ps.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,p)=>{let d=l||kt;const g=(0,_e.isEthereumType)((0,_e.DidType)(l));if(g?d=(0,Ne.WalletType)(l):d=(0,Ne.WalletType)(kt),!(0,_e.isValid)(t)){let S="";try{return g?S=t.slice(0,66):S=t,(0,Ne.fromSecretKey)(S,d)}catch(u){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${u.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Is.fromAppDid)(t,r,d,p||0)};var Ts=ks,Jt=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const le=Jt(Zn),Ds=_t,ye=Jt(Ts),As=Yn,Rs=(t,r,{returnWallet:l=!0}={})=>{var F,A;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,le.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:p,configs:d=[]}=t,g=[...d,...p],S=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),u=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:o,version:T}=t.meta,C=(0,As.getDisplayName)(t),I=(0,le.default)(S,"value",t.meta.description),i=(0,le.default)(u,"value","auto"),k=(0,le.default)(b,"value",""),m=(0,le.default)(h,"value","");if(!l)return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:"",wallet:null,permanentWallet:null,tenantMode:m};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,y=null;if(n&&n.value)x=(0,ye.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(y=(0,ye.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,ye.default)(t.meta.did,r,c):x=(0,ye.default)(t.meta.did,r)}const w=((A=(F=t.settings)==null?void 0:F.session)==null?void 0:A.salt)||"",U=Ds.Hasher.SHA3.hash256(jt.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>jt.from(D))));return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:U,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ls=Rs;const Es=xn(Ls);function Ge({teamDid:t,roles:r,apps:l,onCancel:p,onSuccess:d,onError:g,endpoint:S}){var k;const{api:u}=H(),{t:b,locale:h}=V(),o=Ve({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!o.role){o.error=b("team.member.error.passportEmpty");return}const m=o.remark.trim();o.error=null,o.loading=!0;try{let n=o.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:o.role,remark:m,sourceAppPid:n,passportExpireTime:o.passportExpireTime?o.passportExpireTime.toISOString():""};o.display&&(s.display={type:"url",content:o.display});const{inviteInfo:a}=await u.createMemberInvitation({input:s});o.inviteInfo=a,o.activeStep=1}catch(n){const s=X(n);o.error=s,g(n)}finally{o.loading=!1}},C=r.find(m=>m.name===o.role),i=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(Be,{fullWidth:!0,children:[e.jsx(Fe,{children:b("common.sourceApp")}),e.jsx($e,{value:o.sourceAppPid,onChange:m=>{o.error=null,o.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,children:l.map(m=>e.jsx(Ce,{value:m.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(En,{did:m.appPid,size:28}),m.appName]}),e.jsx(On,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Be,{fullWidth:!0,variant:"outlined",children:[e.jsx(Fe,{children:b("common.passport")}),e.jsx($e,{"data-cy":"invite-member-select-role",value:o.role,onChange:m=>{o.error=null,o.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:r.filter(m=>m.name!=="owner").map(m=>e.jsx(Ce,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Y,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Y,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((k=C==null?void 0:C.extra)==null?void 0:k.display)==="custom"&&e.jsx(de,{label:b("common.display"),type:"url",value:o.display,onChange:m=>{o.error=null,o.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.remark,onChange:m=>{o.error=null,o.remark=m.target.value},disabled:o.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Vt,{value:o.passportExpireTime,onChange:m=>{o.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:p,onConfirm:T},{body:()=>{var n,s;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=o.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});ns(m),Z.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:p}][o.activeStep];return e.jsxs(te,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[i.cancel&&e.jsx(z,{onClick:i.onCancel,color:"inherit",children:i.cancel}),e.jsxs(z,{onClick:i.onConfirm,color:"primary",disabled:o.loading||!o.role,variant:"contained",autoFocus:!0,children:[o.loading&&e.jsx(oe,{size:16}),i.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof i.body=="function"?i.body():i.body}),!!o.error&&e.jsx(re,{severity:"error",variant:"icon",children:o.error})]})}Ge.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Ge.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Je({teamDid:t,onCancel:r,onSuccess:l,onError:p,endpoint:d}){const{api:g,info:S}=H(),{api:u}=P.useContext(Nn),[b,h]=P.useState(!1),{t:o,locale:T}=V(),[C,I]=P.useState(""),[i,k]=P.useState(!1),[m,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),y=!!We(S,"ownerNft.did"),w=is(async()=>{if(y){const{state:R}=await g.getDelegationState();return R}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(oe,{})})});if(w.error)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(re,{severity:"error",variant:"icon",children:X(w.error)})});const U=async()=>{I(null),h(!0);try{const{inviteInfo:R}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(R),n(D.length-1)}catch(R){const W=X(R);I(W),p(R)}finally{h(!1)}},F=()=>{k(!0),n(1)},A=()=>{k(!1),n(0)},D=[{body:e.jsxs(Y,{component:"div",children:[e.jsxs(re,{severity:"warning",children:[e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(re,{severity:"warning",children:e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:R=>{I(null),x(R.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:o("common.cancel"),confirm:o("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:y&&!We(w,"value.delegated")?F:U},{body:()=>e.jsx(_n,{action:"delegate-transfer-nft",open:i,locale:T,checkFn:u.get,onClose:A,onSuccess:U,checkTimeout:5*60*1e3,webWalletUrl:Qn(S),extraParams:{targetDID:S.did},messages:{title:o("team.transferNode.delegateDialog.title"),scan:o("team.transferNode.delegateDialog.scan"),confirm:o("team.transferNode.delegateDialog.confirm"),success:o("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const R=Se({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Os,{children:o("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:R})]})},confirm:o("common.confirm"),onConfirm:l}],O=D[m];return e.jsxs(te,{title:o("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:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(oe,{size:16}),O.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(re,{severity:"error",variant:"icon",children:C})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Je.defaultProps={onError:()=>{},endpoint:""};const Os=M.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
`;var Xe=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"})]})};Xe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Xe.displayName="forbid-login";const Xt=Xe;var et=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)"})]})};et.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};et.displayName="allow-login";const en=et;function Pe(t){const{passport:r,onDelete:l,...p}=t;return e.jsxs(Ns,{...p,children:[r.title||r.name," ",!!l&&e.jsx(Un,{"data-cy":"delete-issuance",className:"delete",onClick:l})]})}Pe.propTypes={passport:v.object.isRequired,onDelete:v.func};Pe.defaultProps={onDelete:null};const Ns=M.span`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,H as h,ah as Ze,T as C,ab as A,e as Je,cF as J,ae as G,cG as Ge,aa as j,al as W,s as ge,ad as Se,be as et,cH as ze,a9 as ye,q as Y,b4 as q,b5 as H,y as tt,ap as st,bb as Ae}from"./vendor-mui-core-BV2FUxWJ.js";import{l as nt,i as Pe,f as fe}from"./vendor-hooks-BgUTpb6X.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,V as rt,a6 as at,$ as it,a7 as ct,w as lt,P as dt,a8 as ue,Q as ut}from"./vendor-arcblock-CUb0jDdY.js";import{Z as B,a as w,b2 as pt,j as R,b7 as V,a7 as mt,r as je,br as ft,B as pe,ao as ht,C as _e,as as xt}from"./vendor-ux-did-connect-DprdyYny.js";import{G as O,D as M,y as E,a3 as gt,af as St,aD as yt}from"./index-
|
|
1
|
+
import{j as e,H as h,ah as Ze,T as C,ab as A,e as Je,cF as J,ae as G,cG as Ge,aa as j,al as W,s as ge,ad as Se,be as et,cH as ze,a9 as ye,q as Y,b4 as q,b5 as H,y as tt,ap as st,bb as Ae}from"./vendor-mui-core-BV2FUxWJ.js";import{l as nt,i as Pe,f as fe}from"./vendor-hooks-BgUTpb6X.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,V as rt,a6 as at,$ as it,a7 as ct,w as lt,P as dt,a8 as ue,Q as ut}from"./vendor-arcblock-CUb0jDdY.js";import{Z as B,a as w,b2 as pt,j as R,b7 as V,a7 as mt,r as je,br as ft,B as pe,ao as ht,C as _e,as as xt}from"./vendor-ux-did-connect-DprdyYny.js";import{G as O,D as M,y as E,a3 as gt,af as St,aD as yt}from"./index-B6g_NzxF.js";import{u as jt}from"./use-mobile-C21X4TYN.js";import{b as Q,d as Me,a7 as bt,I as Ct,E as Ue,A as he}from"./vendor-utils-rHXShPKm.js";import"./api-BjteVZFg.js";import{u as Ne,C as kt,D as Dt,a as Bt}from"./connect-to-BYS6M9JU.js";import{b as Et,c as Tt,d as wt,i as It,e as xe,f as Rt,h as vt,j as At}from"./spaces-BKlIkPYo.js";import{f as X}from"./index-8eXqqyHQ.js";import{I as Ot}from"./index-CBALX7k4.js";import{R as Lt}from"./index-J3Tqz9ZT.js";import{d as zt}from"./MoreHoriz-CKCGMlB8.js";import{c as Pt}from"./dashboard-RTzIKcnI.js";import{d as _t}from"./DeleteOutline-DIXSGJ49.js";import{g as Oe}from"./get-safe-url-BdFxF8pA.js";import{S as Mt}from"./switch-control-DzZXz9Ks.js";import{C as Ut,u as Nt}from"./config-space-DID86BbB.js";import{L as Le}from"./list-header-xt282ZMS.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DvcK7KsP.js";import"./confirm-BnRcXvxs.js";import"./PlayArrow-CrmMAssx.js";import"./session-E0e-X6-a.js";import"./use-blocklet-logo-DeL5Lmpn.js";import"./InfoOutlined-Cxpk0UTX.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAa0wi8o.js";async function Wt({blockletDid:s,nodeApi:r,spaceGateways:o}){let t=!1;const a=await Promise.all(o.map(async n=>{let{name:i}=n;const d=await Et(n.endpoint);return!Q(d)&&d!==i&&(i=d,t=!0),{...n,name:i}}));return t&&await Promise.all(a.filter(n=>n.did).map(n=>r.updateBlockletSpaceGateway({input:{did:s,where:{did:n.did},spaceGateway:{...n}}}))),a}function Ft({refresh:s}={}){var a;const{blocklet:r}=O(),o=(a=r==null?void 0:r.meta)==null?void 0:a.did,{api:t}=M();return nt(async()=>{if(!o)return[];const{spaceGateways:n}=await t.getBlockletSpaceGateways({input:{did:o}});return await Wt({blockletDid:o,nodeApi:t,spaceGateways:n})??[]},{refreshDeps:[o,s],onError(n){var i;(i=n==null?void 0:n.message)!=null&&i.includes("not logged")?console.warn(n):(console.error(n),B.error(X(n)))}})}function We({deps:s,setLoading:r,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:t}=O(),[a,n]=y.useState([]),{api:i}=M(),[d,u]=y.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),c=Me(async()=>{try{if(r(!0),!t){n([]);return}const{backups:p}=await i.getBlockletBackups({input:{did:t.meta.did,startTime:d,endTime:u}});n(p??[])}catch(p){console.error(p),B.error(X(p))}finally{r(!1)}},1e3);return Pe(async()=>{c()},[(x=t==null?void 0:t.meta)==null?void 0:x.did].concat(s)),{backups:a}}function Kt({appDid:s}){const{backups:r}=We(),[o,t]=y.useState({message:"",progress:0,completed:!1}),a=M(),{ws:{useSubscription:n}}=a;return n(_.BlockletEvents.backupProgress,i=>{s===(i==null?void 0:i.appDid)&&t(()=>({...i}))},[s]),y.useEffect(()=>{var i;if(r!=null&&r.length&&bt((i=r[0])==null?void 0:i.status)){const[d]=r;t(()=>({message:d.message,progress:d.progress,completed:d.progress>=100}))}},[r]),o}function $t({deps:s=[],setLoading:r=()=>{}}={}){var d;const{blocklet:o}=O(),[t,a]=y.useState([]),{api:n}=M(),i=y.useCallback(Me(async()=>{var u;if(!n||!((u=o==null?void 0:o.meta)!=null&&u.did)){a([]);return}try{r(!0);const c=E(),x=c.subtract(1,"year"),{summary:p}=await n.getBlockletBackupSummary({input:{did:o.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});a(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),a([])}finally{r(!1)}},1e3),[]);return Pe(async()=>(await i(),()=>{i.cancel()}),[(d=o==null?void 0:o.meta)==null?void 0:d.did].concat(s)),{backupSummary:t}}const Fe=y.createContext({}),{Provider:Yt,Consumer:Ws}=Fe;function be({children:s}){var K;const{t:r}=w(),{api:o}=M(),{blocklet:t}=O(),[a,n]=y.useState(null),[i,d]=y.useState(!1),{data:u,loading:c,mutate:x}=Ft({refresh:i}),p=Ct(u),g=Kt({appDid:t==null?void 0:t.appDid}),f=y.useMemo(()=>Tt(t==null?void 0:t.environments),[t==null?void 0:t.environments]),[b,D]=y.useState(!1),[S,l]=y.useState(!1),{backups:te}=We({deps:[S,a],setLoading:D,backupDate:a}),[se,ne]=y.useState(!1),{backupSummary:oe}=$t({deps:[se]}),[U,z]=y.useState(u==null?void 0:u.find(m=>m.endpoint===f)),I=(K=t==null?void 0:t.settings)==null?void 0:K.autoBackup,v=()=>{d(m=>!m)},re=()=>{ne(m=>!m)},ae=()=>{l(m=>!m)},F=async m=>{await o.updateAutoBackup({input:{did:t.meta.did,autoBackup:m}})},Z=async()=>{await o.abortBlockletBackup({input:{appPid:t.meta.did}})},ie=async(m,N)=>{try{x(T=>{const P=[...T];return P.push({...m,loading:!0}),P}),await o.addBlockletSpaceGateway({input:{did:t.meta.did,spaceGateway:m}}),f!==N&&await o.configBlocklet({input:{did:[t.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),z(m),v(),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(T){throw console.error(T),x(P=>[...P].filter(de=>de.did!==m.did)),T}},ce=async m=>{m&&(m.endpoint===f&&(await o.configBlocklet({input:{did:[t.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await F({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:t.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),x(N=>{const T=[...N];return T.splice(T.indexOf(m),1),T}),z(m),v())},le=async m=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:t.meta.did,where:{did:m.did},spaceGateway:m}}),f!==m.endpoint&&o.configBlocklet({input:{did:[t.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===f;return e.jsx(Yt,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:F,abortBlockletBackup:Z,backupEndpoint:f,backupProgress:g,backups:te,backupSummary:oe,refreshBackupSummary:re,refreshBackups:ae,setBackupDate:n,backupsLoading:b,autoBackup:I},children:s})}be.propTypes={children:h.any.isRequired};be.defaultProps={};function L(){return y.useContext(Fe)}function ee({...s}){const{blocklet:r}=O(),{info:o}=M(),{t}=w(),a=Ne({blocklet:r}),n=gt(o),{spaceGateways:i,addSpaceGateway:d}=L(),u={checkFn:Ue.create({baseURL:he(window.location.origin,St())}).get,webWalletUrl:n,extraParams:{appPid:r.appPid,appDid:a.appDid,appName:a.appName,appDescription:a.appDescription,appUrl:a.appUrl,referrer:a.referrer,scopes:a.scopes,nodeDid:o.did}},c=async({endpoint:p,name:g,did:f})=>{const b=await wt(p);if(!await It(b)){B.error(t("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(l=>l.endpoint===p)){B.error(t("storage.spaces.gateway.add.duplicate",{name:g}));return}await d({name:g,did:f,url:b,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await c(p)}catch(g){console.error(g),B.error(X(g))}};return e.jsx(rt,{...s,options:u,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ke({...s}){const{t:r}=y.useContext(pt),{blocklet:o,loadingDiskInfo:t,actions:a}=O();if(y.useEffect(()=>{a==null||a.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),o.diskInfo){const n=(u,c,x)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?yt(c):"empty"})]}),i=o.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),d=[{key:"appDir",name:r("blocklet.diskInfo.appDir"),value:n(i.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:r("blocklet.diskInfo.dataDir"),value:n(i.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:r("blocklet.diskInfo.logDir"),value:n(i.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:r("blocklet.diskInfo.cacheDir"),value:n(i.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(qt,{component:"div",...s,children:d.map(u=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return t?e.jsx(A,{}):e.jsx(C,{children:r("blocklet.diskInfo.empty")})}const qt=Ze(C)``;function Ce(){const{t:s}=w(),{setBackupDate:r,backupSummary:o}=L(),t=at({key:"lg"}),a=y.useRef(null),n=Je(),i=y.useCallback(c=>{r(c)},[r]),d=y.useMemo(()=>{const c=E().add(1,"day"),x=t?E().subtract(5,"month").startOf("month"):E().subtract(1,"year"),p=new Map(o.map(f=>[f.date,{date:f.date,successCount:f.successCount,errorCount:f.errorCount}])),g=[];for(let f=x.clone();E(f).isBefore(c);f=f.add(1,"day")){const b=f.format("YYYY-MM-DD");g.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return g},[o,t]),u=y.useMemo(()=>({grid:{containLabel:!0,right:t?1:10,top:t?20:30,bottom:t?2:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:l}=d[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${s("common.time")}: ${D}</div>`,`<div>${s("common.succeeded")}: ${S}</div>`,`<div>${s("common.failed")}: ${l}</div>`].join(`
|
|
2
2
|
`)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:t?20:30,left:t?15:42,right:t?1:5,bottom:t?2:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:t?2:4,borderColor:n.palette.background.default,borderRadius:0,color:n.palette.background.default},dayLabel:{show:!t,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:t?6:12,fontSize:t?11:14,color:n.palette.text.primary,fontWeight:"400",width:t?20:32},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:t?14:16,position:"start",margin:t?4:12,width:t?24:32,padding:t?[0,2]:[0,4]},yearLabel:{show:!1},range:[t?E().subtract(5,"month").startOf("month").format("YYYY-MM-DD"):E().subtract(1,"year").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:d.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:t?.5:1.5,borderColor:n.palette.background.default,borderRadius:t?1:5},emphasis:{itemStyle:{borderWidth:2.5,borderColor:Ge[200],color:"inherit"}}}}),[d,s,n,t]);return y.useEffect(()=>{a.current&&t&&setTimeout(()=>{a.current.scrollLeft=a.current.scrollWidth},100)},[t,d]),e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:a,sx:{border:"1px solid",borderColor:"divider",padding:"8px"},children:e.jsx(j,{sx:{width:"100%",height:t?"150px":"240px",position:"relative"},children:e.jsx(Lt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&i(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:t?2:5,mb:2,children:e.jsxs(W,{direction:t?"column":"row",spacing:t?2:1,width:"100%",justifyContent:t?"flex-start":"flex-end",alignItems:t?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:s("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:s("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:s("storage.spaces.backup.succeeded")})]})]})})]})}Ce.propTypes={};const Ht=ge(({className:s,...r})=>e.jsx(Se,{...r,classes:{popper:s}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ke({status:s,message:r,createdAt:o}){const{t}=w(),a=s===R.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=R.BACKUPS.TIMEOUT_HOURS,n=a&&t("common.timeoutError"),i=s===R.BACKUPS.STATUS.PROGRESS&&!a,d=s===R.BACKUPS.STATUS.SUCCEEDED&&!a;return i?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):d?e.jsx(V,{type:"success",children:t("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"error",children:t("common.failed")})," ",e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:r||n,children:e.jsx(ze,{children:e.jsx(it,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ke.propTypes={status:h.string.isRequired,message:h.string,createdAt:h.string.isRequired};ke.defaultProps={message:""};function De({metadata:s}){const{t:r}=w();if(Q(s))return e.jsx(V,{type:"success",children:r("common.succeeded")});const o=s.count||0,t=s.size||0,a=ct(t,{iec:!0}),n=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[r("common.fileCount"),": ",o]}),e.jsxs(C,{variant:"body2",children:[r("common.fileSize"),": ",a]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"success",children:r("common.succeeded")})," ",e.jsx(Ht,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ze,{children:e.jsx(lt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}De.propTypes={metadata:h.object};De.defaultProps={metadata:{}};function Be(){const{t:s,locale:r}=w(),{spaceGateways:o,backups:t,backupsLoading:a}=L(),n=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:d=>{var D;const{targetUrl:u,targetName:c,status:x,createdAt:p}=t[d],g=x===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,f=x===R.BACKUPS.STATUS.SUCCEEDED&&!g,b=c||((D=o.find(S=>u==null?void 0:u.includes(xe(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return f?e.jsx(et,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:s("common.strategy"),name:"strategy",options:{customBodyRender:d=>{const u=s(d===0?"common.auto":"common.manual");return e.jsx(V,{children:u})}}},{label:s("common.startTime"),name:"createdAt",options:{customBodyRender:d=>E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:s("common.endTime"),name:"updatedAt",options:{customBodyRender:d=>Q(d)?"":E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:d=>{const u=(t==null?void 0:t[d])??{},{status:c,message:x,createdAt:p,metadata:g}=u,f=c===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!f,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!f;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):D?e.jsx(De,{metadata:g}):e.jsx(ke,{status:c,message:x,createdAt:p})}}}],[t,o,s]),i=y.useMemo(()=>!(t!=null&&t.length),[t]);return e.jsx(e.Fragment,{children:i?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:s("storage.spaces.record.emptyData")}):e.jsx(mt,{title:"",loading:a,data:t,columns:n,emptyNode:s("storage.spaces.record.emptyData",r),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Be.propTypes={};function $e(){const{t:s}=w();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(dt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:s("storage.spaces.connect.provider")}),e.jsx(ee,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:s("storage.spaces.backup.records")})}),e.jsx(Ce,{})]})]}),e.jsx(Be,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:s("common.dataStorage")}),e.jsx(Ke,{})]})}$e.propTypes={};var Ee={},Vt=ye;Object.defineProperty(Ee,"__esModule",{value:!0});var Ye=Ee.default=void 0,Qt=Vt(je()),Xt=e;Ye=Ee.default=(0,Qt.default)((0,Xt.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Te={},Zt=ye;Object.defineProperty(Te,"__esModule",{value:!0});var qe=Te.default=void 0,Jt=Zt(je()),Gt=e;qe=Te.default=(0,Jt.default)((0,Gt.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var we={},es=ye;Object.defineProperty(we,"__esModule",{value:!0});var He=we.default=void 0,ts=es(je()),ss=e;He=we.default=(0,ts.default)((0,ss.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function Ie({spaceGateway:s,onConfirm:r,onCancel:o}){const{t}=w(),[a,n]=y.useState(!1),[i,d]=y.useState(!1),u=(p,g)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),n(g)},c=async p=>{try{p==null||p.stopPropagation(),d(!0),await(r==null?void 0:r(s)),n(!1)}catch(g){console.error(g),B.error(`${t("storage.space.gateway.delete.failed")}: ${X(g)}`)}finally{n(!1),d(!1)}},x=p=>{u(p,!1),o==null||o(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(q,{style:{minWidth:24,color:"red"},children:e.jsx(_t,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:t("common.delete")})]}),e.jsx(ft,{title:t("storage.spaces.gateway.delete.title"),open:a,confirmButton:{text:t("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:i}},cancelButton:{text:t("common.cancel"),props:{size:"small",variant:"outlined",disabled:i}},onConfirm:c,onCancel:x,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:t("storage.spaces.gateway.delete.descForBackup",{name:`${s==null?void 0:s.name}`})})})]})}Ie.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool}).isRequired,onConfirm:h.func,onCancel:h.func};Ie.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function Re({spaceGateway:s,selected:r,onDelete:o,onConnect:t,enableSwitchToSpace:a,backupInProgress:n,...i}){const{abortBlockletBackup:d}=L(),[u,c]=y.useState(null),{t:x}=w(),[p,g]=y.useState(!1),f=(S,l)=>{S.stopPropagation(),S.preventDefault(),c(l&&S.currentTarget)},b=async S=>{try{g(!0),f(S,!1),await t(s)}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}},D=async S=>{try{g(!0),f(S,!1),await d()}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[p||s!=null&&s.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(tt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>f(S,!0),...i,children:e.jsx(zt,{})}),e.jsxs(st,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>f(S,!1),children:[e.jsxs(Y,{onClick:S=>{f(S,!1),window.open(Oe(s.endpoint?Rt(s.endpoint):s.url,{allowDomains:null}))},children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(H,{children:x("common.open")})]}),e.jsxs(Y,{onClick:S=>{f(S,!1),window.open(Oe(vt(s.endpoint),{allowDomains:null}))},children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!r&&a&&e.jsxs(Y,{onClick:b,children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(qe,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(Y,{onClick:D,children:[e.jsx(q,{style:{minWidth:24},children:e.jsx(Pt,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Ie,{spaceGateway:s,onConfirm:async()=>{c(null),await(o==null?void 0:o(s))},onCancel:()=>c(null)})]})]})}Re.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool,endpoint:h.string.isRequired,loading:h.bool}).isRequired,selected:h.bool.isRequired,enableSwitchToSpace:h.bool,onDelete:h.func,onConnect:h.func,backupInProgress:h.bool};Re.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const ns=ge(({className:s,...r})=>e.jsx(Se,{...r,classes:{popper:s}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({spaceGateway:s,spaceStatus:r,selected:o,onConnected:t,onDeleted:a,onBackedUp:n}){const{t:i,locale:d}=w(),{blocklet:u}=O(),{api:c,info:{did:x}}=M(),{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S}=Ne({blocklet:u}),{backupProgress:l,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:ne,refreshBackups:oe}=L(),[U,z]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:i("storage.spaces.authorize.title",{appName:g},d),scan:i("storage.spaces.authorize.scan",{appName:g},d),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:i("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),re=o&&!U&&r===ue.DISCONNECTED,ae=o&&!U&&!s.loading&&r===ue.CONNECTED,F=o&&U&&r===ue.CONNECTED&&(l==null?void 0:l.progress)>=0,Z=async()=>{try{if(await At(s==null?void 0:s.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:s.endpoint}]}}),B.success(i("storage.spaces.connect.switchToSpaceSucceeded",{name:s.name?`(${s.name})`:""})),t==null||t(null,s);return}}catch(k){console.error(k),t==null||t(k,s);return}v(k=>({...k,open:!0,prefix:he(s.url,"space/api/did"),baseUrl:new URL(s.url).origin,checkFn:Ue.create({baseURL:he(s.url,"space")}).get,extraParams:{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S,nodeDid:x,spaceDid:s.did}}))},ie=async(k,K)=>{const m=K(k.endpoint),N=xe(m),T=k.space?K(k.space):{};if(s.did&&N!==s.did){v(de=>({...de,open:!1}));const $=i("storage.spaces.gateway.switch.failedForMismatchSpace",{name:T!=null&&T.name?T.name:""});B.error($),t==null||t(new Error($),s);return}const P={...s,name:T.name??"DID Space",did:T.did??xe(m),endpoint:m};await te(P),v($=>({...$,open:!1})),t==null||t(null,P)},ce=async()=>{try{if(U)return;z(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),n==null||n(k,s)}finally{z(!0)}},le=async()=>{try{await se(s),B.success(i("storage.spaces.gateway.delete.succeeded",{name:s.name?`(${s.name})`:""})),a==null||a(null,s)}catch(k){console.error(k),a==null||a(k,s)}};return y.useEffect(()=>{l!=null&&l.completed?(o&&((l==null?void 0:l.progress)===100?(B.success(i("storage.spaces.backupSuccessfully")),n==null||n(null,s)):l.message&&(n==null||n(new Error(l==null?void 0:l.message),s)),l.progress=0,l.message=""),z(!1),setTimeout(()=>{ne(),oe()},1e3)):l.progress&&z(!0)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:i("storage.spaces.strategy.backupNow")}),re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Z,children:i("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(ns,{title:(l==null?void 0:l.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:l.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:l==null?void 0:l.progress,size:14,sx:{mr:1}}),l==null?void 0:l.progress,"%"]})}),e.jsx(ht,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:d},"get-endpoint")]}),e.jsx(Re,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:s,selected:o,onDelete:le,onConnect:Z,enableSwitchToSpace:(l==null?void 0:l.completed)||Q(l==null?void 0:l.message),backupInProgress:F})]})}ve.propTypes={spaceGateway:h.shape({did:h.string.isRequired,name:h.string.isRequired,url:h.string.isRequired,endpoint:h.string.isRequired,protected:h.bool,loading:h.bool}).isRequired,spaceStatus:h.string.isRequired,selected:h.bool.isRequired,onConnected:h.func,onDeleted:h.func,onBackedUp:h.func};ve.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Ve({...s}){const{t:r}=w();return e.jsxs(j,{...s,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:r("storage.spaces.backup.records")})}),e.jsx(Ce,{}),e.jsx(Be,{})]})}Ve.propTypes={};function Qe({...s}){const{t:r}=w(),{autoBackup:o,updateAutoBackup:t}=L(),a=async()=>{try{const n=!(o!=null&&o.enabled);await t({enabled:n}),B.success(r(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(Mt,{checked:!!(o!=null&&o.enabled),onChange:a,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:r("storage.spaces.autoBackup.title")})})},style:{...s.style}})}Qe.propTypes={};function os(){const{t:s}=w(),{spaceGateways:r,spaceGatewaysLoading:o,spaceGatewayIsSelected:t}=L(),a=o&&!(r!=null&&r.length),n=({spaceGateway:i,spaceStatus:d,selected:u,refresh:c})=>e.jsx(ve,{spaceGateway:i,spaceStatus:d,selected:u,onConnected:()=>c(),onBackedUp:x=>x&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:s("storage.spaces.connected.title")}),e.jsx(Qe,{}),e.jsx(ee,{})]}),e.jsx(j,{mt:2,children:a?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(A,{})}):e.jsx(Ae,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:r.map(i=>e.jsx(Ae,{item:!0,xs:12,md:6,children:e.jsx(ut,{endpoint:i.endpoint,selected:t(i),action:n},i.endpoint)}))})})}),e.jsx(Ve,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:s("common.dataStorage")}),e.jsx(Ke,{})]})}function rs(){const{spaceGatewaysFirstLoading:s,spaceGateways:r}=L();return s?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):Q(r)?e.jsx($e,{}):e.jsx(os,{})}function as(){return e.jsx(be,{children:e.jsx(rs,{})})}function is(){const{spaceGateway:s,settingStorageEndpoint:r,updateSpaceGateway:o,hasStorageEndpoint:t,loading:a,storageEndpoint:n}=Nt(),i=fe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return a?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[t?e.jsx(kt,{spaceGateway:s,settingStorageEndpoint:r}):e.jsx(Dt,{}),e.jsx(j,{sx:i,children:e.jsx(Bt,{onConnect:o,storageEndpoint:n})})]})}function cs(){const{t:s}=w();return e.jsxs(Ut,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:s("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:s("storage.appLevel.description")})]}),e.jsx(is,{})]})}function Xe({navOrientation:s,...r}){const{t:o,locale:t}=w(),{blocklet:a}=O(),n=jt({key:"md"}),[i,d]=ot(),u=i.get("tab")||"backup",c=n?"horizontal":s,x=fe(()=>{var l;const D=[{label:o("common.backup"),value:"backup"}],S=(l=a==null?void 0:a.capabilities)==null?void 0:l.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:o("common.storage"),value:"storage"}),D},[t,c]),g=fe(()=>({backup:e.jsx(as,{}),storage:e.jsx(cs,{})}))[u],f=D=>{d(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(x.length<=1)return e.jsx(me,{children:g});const b=e.jsx(xt,{tabs:x,current:u,orientation:c,onChange:f,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...r,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(Le,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:g})})]})});if(c==="horizontal")return e.jsxs(j,{...r,children:[e.jsx(Le,{left:b}),e.jsx(me,{sx:{mt:2},children:g})]})}Xe.propTypes={navOrientation:h.oneOf(["vertical","horizontal"])};Xe.defaultProps={navOrientation:"vertical"};const me=ge(j)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|