@abtnode/blocklet-services 1.16.44-beta-20250605-131649-6eaf56d9 → 1.16.44
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-DkeS-Y2W.js → access-control-f_Q0xNEr.js} +1 -1
- package/dist/assets/{add-component-core-5xfa41gL.js → add-component-core-lxVDVv-g.js} +1 -1
- package/dist/assets/{add-resource-CZ45K84J.js → add-resource-DHuVcGqm.js} +1 -1
- package/dist/assets/{advanced-D982J0EW.js → advanced-iHTV3yj0.js} +1 -1
- package/dist/assets/{appearance-DF2Q-9wo.js → appearance-CjjdXxDr.js} +1 -1
- package/dist/assets/{audit-logs-B6myuBkp.js → audit-logs-9UAh1pea.js} +1 -1
- package/dist/assets/{authorize-CpLnq95p.js → authorize-f7rwXyK0.js} +1 -1
- package/dist/assets/{branding-jEBmRmCH.js → branding-DgYdp8Fj.js} +1 -1
- package/dist/assets/{branding-B9ARskao.js → branding-DyNgn-Bl.js} +2 -2
- package/dist/assets/{bundle-avatar-C5z-Q7gP.js → bundle-avatar-eYIyRJCN.js} +1 -1
- package/dist/assets/{complete-SRR_Ho9p.js → complete-x6sLfw6B.js} +1 -1
- package/dist/assets/{component-AEvoLt8e.js → component-B-zaossI.js} +1 -1
- package/dist/assets/{config-KaVrOXZX.js → config-BedCVCOB.js} +1 -1
- package/dist/assets/{config-navigation-BsFFLNsu.js → config-navigation-DWYn0QbT.js} +3 -3
- package/dist/assets/{config-space-DkXBTOUO.js → config-space-BKyIMqyn.js} +1 -1
- package/dist/assets/{confirm-BVbxEEUe.js → confirm-W9aiB3ZK.js} +1 -1
- package/dist/assets/{connect-BNqgYzxi.js → connect-7xjSPaIL.js} +1 -1
- package/dist/assets/{connect-sD2a0wrt.js → connect-BDcfioWR.js} +1 -1
- package/dist/assets/{connect-to-Dz516DWl.js → connect-to-CjAmbMcq.js} +1 -1
- package/dist/assets/{dashboard-COhzj5M7.js → dashboard-DTpUsE7s.js} +3 -3
- package/dist/assets/{delete-confirm-zw7cAUaD.js → delete-confirm-CR9GWuZW.js} +1 -1
- package/dist/assets/{domain-gair362n.js → domain-C5GTtUcW.js} +1 -1
- package/dist/assets/{domain-action-card-BPfmBnjz.js → domain-action-card-DZFY_-cJ.js} +1 -1
- package/dist/assets/{domains-5bxsm2rm.js → domains-BjYCkCPj.js} +1 -1
- package/dist/assets/{email-DN1YBd8B.js → email-0L0UoCI5.js} +1 -1
- package/dist/assets/{exchange-passport-EkyjW3S5.js → exchange-passport-Cz76Mvqo.js} +1 -1
- package/dist/assets/{fuel-Dqd_Qaae.js → fuel-H0bbfYDc.js} +1 -1
- package/dist/assets/{gen-access-key-DFZF7xLX.js → gen-access-key-CVMgx_Do.js} +1 -1
- package/dist/assets/{index-aGeSyFQB.js → index-B778V4Al.js} +4 -4
- package/dist/assets/{index-YYMO-UJx.js → index-BFxPxs1o.js} +1 -1
- package/dist/assets/{index-BcnWMI1z.js → index-Bp39ibX1.js} +1 -1
- package/dist/assets/{index-tC3H8qVI.js → index-C0jIKgVd.js} +1 -1
- package/dist/assets/{index-DaNh-dfo.js → index-C9xycxde.js} +1 -1
- package/dist/assets/{index-DIn4sPJ9.js → index-CNP49TJ1.js} +1 -1
- package/dist/assets/{index-CjBkZq6J.js → index-CTJ98R3F.js} +1 -1
- package/dist/assets/{index-C49mY51b.js → index-CXZIC-uq.js} +1 -1
- package/dist/assets/{index-DRAAkiVz.js → index-Ch5CE_Xo.js} +1 -1
- package/dist/assets/{index-DDmP9DuI.js → index-CmGpTnGy.js} +1 -1
- package/dist/assets/{index-CHxs-s-X.js → index-CqQ_qPcW.js} +1 -1
- package/dist/assets/{index-Bq3dOwAR.js → index-CsOtcFM5.js} +1 -1
- package/dist/assets/{index-mztNzjgQ.js → index-D2TrKFIL.js} +1 -1
- package/dist/assets/{index-K0KT3hZ2.js → index-DVfId0OB.js} +1 -1
- package/dist/assets/{index-zB7QNT2N.js → index-DtuVp5SU.js} +3 -3
- package/dist/assets/{index-DZhGBW-J.js → index-Rx6rf5TL.js} +27 -27
- package/dist/assets/{invitation-B_l2X5Qw.js → invitation-BrPENaxX.js} +1 -1
- package/dist/assets/{invite-CcjMpgtm.js → invite-B0YEiWAC.js} +1 -1
- package/dist/assets/{issue-passport-DaxUL0i_.js → issue-passport-Dz3BWjAa.js} +1 -1
- package/dist/assets/{item-B2UOncuL.js → item-CALJuG3t.js} +1 -1
- package/dist/assets/{layout-DoXsIwDE.js → layout-BpG5xw8B.js} +1 -1
- package/dist/assets/{list-Bq9JBnDc.js → list-BZl1XCaf.js} +2 -2
- package/dist/assets/{list-CrgY2BaT.js → list-DyU1G1ER.js} +1 -1
- package/dist/assets/{log-DhcU-SNo.js → log-CTKJhZ_E.js} +1 -1
- package/dist/assets/{login-Cz2vAxZm.js → login-Cg8geEoU.js} +1 -1
- package/dist/assets/{logo-uploader-Bm1m7G40.js → logo-uploader-oD7wBJlZ.js} +2 -2
- package/dist/assets/{lost-passport-CJ5clpDC.js → lost-passport-BxZlOTiO.js} +1 -1
- package/dist/assets/{overview-DPGILp0U.js → overview-B_ZqHpwj.js} +1 -1
- package/dist/assets/{passport-item-M7I1ZSM4.js → passport-item-D1UYvMW_.js} +1 -1
- package/dist/assets/{publish-resource-CtNG3o6l.js → publish-resource-H3WaTgcl.js} +1 -1
- package/dist/assets/{runtime-B4wmcZ_1.js → runtime-BGMX9PTT.js} +1 -1
- package/dist/assets/{security-BTqTOcaw.js → security-DDqACA_P.js} +1 -1
- package/dist/assets/{setup-BSXJMMCu.js → setup--FMKBbd7.js} +3 -3
- package/dist/assets/{start-MrV1gr0v.js → start-D7GkMfm4.js} +1 -1
- package/dist/assets/{status-TW6ELj4F.js → status-D5ypXFOB.js} +1 -1
- package/dist/assets/{step-actions-Dcey2Y5_.js → step-actions-X0m-Hu2A.js} +1 -1
- package/dist/assets/{traffic-Crbb9B1Y.js → traffic-GgX3Erg7.js} +1 -1
- package/dist/assets/{transfer-Dc9VGCo3.js → transfer-Dq6dS0l-.js} +1 -1
- package/dist/assets/{unsubscribe-nahLjfgf.js → unsubscribe-BZAVKPXL.js} +1 -1
- package/dist/assets/{use-blocklet-logo-C3eb15_j.js → use-blocklet-logo-CmMzePwG.js} +1 -1
- package/dist/assets/{user-center-C9fjBKRB.js → user-center-DVO5FZd_.js} +1 -1
- package/dist/assets/{util-DrLJYW9Z.js → util-DZiavuQJ.js} +1 -1
- package/dist/assets/{wrap-locale-9CFPTGzs.js → wrap-locale-BD27EgAf.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as j,f as Et,l as ut,L as we,g as Hn,u as Gn,i as Jn,j as wt}from"./vendor-react-DEoibe3W.js";import{a9 as Ie,j as e,v as Ve,aa as c,aq as Lt,H as s,ad as ye,I as de,T as A,s as Xn,c6 as Go,D as pt,ah as Re,ax as Yn,bS as ot,ak as ht,bt as nt,bx as st,y as ee,ab as Se,P as Jo,G as Xo,w as qt,a8 as Yo,M as Qo,q as be,X as Qn,aj as Zo,t as Ko,bU as Zn,N as Ye,z as en,O as re,al as Ce,aw as tn,L as on,A as Nt,b9 as nn,bK as sn,by as Kn,e as rn,at as es,b_ as ts,af as os,U as ln,W as rt,bF as ns,bG as ss,c7 as rs,c8 as ls,bo as It,bp as is,br as cs,bv as as,bw as Rt}from"./vendor-mui-core-wlbruq2I.js";import{D as ke,G as Te,ag as ds,a8 as us,f as Io,ah as To,ac as ps,ai as hs,aj as fs,ak as bs}from"./index-DZhGBW-J.js";import{r as $e,k as X,a as Z,bH as cn,i as ms,B as Le,bg as an,$ as dn,bd as un,at as xs,bI as gs,ac as At,a3 as M,a8 as js,I as ue,bJ as ks,bn as ys,_ as pn,b as Me,ar as ft,be as vs,ax as hn}from"./vendor-ux-did-connect-Bh011lgb.js";import{v as bt,c as fe,i as ws,z as Rs,B as Ee,p as Cs}from"./vendor-arcblock-CATQui2x.js";import{d as Ss}from"./Error-7F2F0yXi.js";import{C as mt}from"./confirm-BVbxEEUe.js";import{u as Fe}from"./session-N9ogZkBO.js";import{W as Tt}from"./did-address-C3GRjuMv.js";import{E as Qe}from"./empty-spinner-DSwpCqdd.js";import{B as zt}from"./bundle-avatar-C5z-Q7gP.js";import{S as De}from"./shorten-label-CTSJhlwO.js";import{L as Ot}from"./list-header-D976e09p.js";import{a0 as Ds,A as pe,J as Wt,E as fn}from"./vendor-utils-CxrPpJZS.js";import{d as Is}from"./Download-CSPVh6pQ.js";import{C as bn}from"./click-to-copy-BBibsDSl.js";import{Q as Ts}from"./QuestionMarkCircle-BMcwgPWr.js";import{x as $s,u as Ps}from"./vendor-hooks-TMGmpw5W.js";import{_ as Xe}from"./useSetState-CWq0AVWn.js";import{c as Bt}from"./index-DVQCgvFb.js";import{d as Mt}from"./Launch-akp2B3sE.js";import{E as Vt}from"./index-DU8cx_m6.js";import"./api-DB7tZ-Xo.js";import{d as _s}from"./ChevronRight-CB-tzzK0.js";import{T as Es,a as Ls}from"./vendor-mui-x-BKgL6hAa.js";import{d as lt}from"./DeleteOutline-D--wbiEJ.js";import{D as $o,C as Po,P as _o}from"./react-beautiful-dnd.esm-CaWQHB2l.js";import{c as qs,A as mn,u as xn,S as Ns,a as As,b as zs,e as Os,U as Ws,f as Ct,g as gn,n as Bs,h as Ms,i as Eo,k as Vs,l as Us}from"./item-B2UOncuL.js";import{d as Fs}from"./ArrowDropDown-QAD1r6CI.js";import{f as je}from"./index-8eXqqyHQ.js";import{d as jn}from"./Done-D5w4g3Ux.js";import{D as Hs}from"./delete-confirm-zw7cAUaD.js";import{g as kn}from"./get-safe-url-DvHrYSqa.js";import{M as Gs}from"./index-BXjOxZPH.js";import{r as Js}from"./index-DWgnwzKO.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ut={},Xs=Ie;Object.defineProperty(Ut,"__esModule",{value:!0});var yn=Ut.default=void 0,Ys=Xs($e()),Qs=e;yn=Ut.default=(0,Ys.default)((0,Qs.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Ft={},Zs=Ie;Object.defineProperty(Ft,"__esModule",{value:!0});var vn=Ft.default=void 0,Ks=Zs($e()),er=e;vn=Ft.default=(0,Ks.default)((0,er.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Ht={},tr=Ie;Object.defineProperty(Ht,"__esModule",{value:!0});var wn=Ht.default=void 0,or=tr($e()),nr=e;wn=Ht.default=(0,or.default)((0,nr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Gt({did:t,projectId:o,title:n,logo:r,describe:i}){const l=`${`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,d]=j.useState(!1),x=Ve(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),children:[e.jsx(Lt,{sx:{borderRadius:1},src:l}),e.jsxs(c,{children:[e.jsx(De,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:n||"/"}),e.jsx(De,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Gt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Jt({initUrl:t}){const o=Et(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:r,locale:i}=Z(),{api:a}=ke(),{api:l}=Fe(),[u,d]=j.useState(!0),{blocklet:x}=Te(),[b,p]=j.useState(null),[h,m]=j.useState(!1),f=Ve(C=>C.breakpoints.down("xl")),y=Ve(C=>C.breakpoints.down("md")),{componentDid:v=""}=ut(),[g,k]=j.useState(null),S=`publish-${x.meta.did}`,R=cn(S),[T,D]=j.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),B=()=>{a.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:n}}).then(C=>{const _=(C==null?void 0:C.projects)||[];d(!1),k(_)}).catch(C=>{d(!1),M.error(C.message)})},$=()=>{o(`${X.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=C=>{p(C)},G=()=>{d(!1),m(!0)},U=()=>{m(!1),p(null)},w=C=>{M.error(C.message),m(!1),p(null)},I=C=>{if(!(C!=null&&C.deleted)){M.error("Delete project failed");return}B(),m(!1),p(null)};j.useEffect(()=>{B()},[]);const q=j.useMemo(()=>{var _;if(!T.searchText)return g;let C=(_=T.searchText)==null?void 0:_.trim();return C?(C=ms.toAddress(C).toLocaleLowerCase(),g.filter(J=>J.blockletTitle.toLowerCase().includes(C)||J.blockletDid.toLowerCase().includes(C))):g},[g,T.searchText]);if(!g&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Qe,{})});if(!g)return null;if(!g.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Le,{onClick:$,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const P=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:C=>{const _=g[C];return e.jsx(we,{to:`${_.id}`,children:e.jsx(Gt,{did:x.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:C=>C?e.jsx(an,{type:"success",children:C}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:C=>C?e.jsx(Tt,{size:14,compact:!0,responsive:!1,did:C}):null}},f||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:C=>C?e.jsx(Tt,{onClick:()=>{o(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${C}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:C}):null}},f||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:C=>{const _=(x.children||[]).find(J=>J.meta.did===C);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(zt,{size:14,blocklet:_,ancestors:[x]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},C):""}}},f||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:C=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(De,{children:C})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:C=>e.jsx(dn,{value:Number(C),locale:i})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:C=>{const _=g[C];return e.jsxs(c,{display:"flex",children:[e.jsx(we,{to:`${_.id}/new-release/none/${_.lastReleaseId}`,children:e.jsx(ye,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"create",children:e.jsx(yn,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(ye,{title:r("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}/${_.blockletVersion}`,children:e.jsx(vn,{sx:{fontSize:18}})})})}),e.jsx(ye,{title:r("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>z(_),children:e.jsx(un,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),N=({page:C,rowsPerPage:_,searchText:J})=>{T.pageSize!==_?D(F=>({...F,searchText:"",pageSize:_,page:1})):T.page!==C+1?D(F=>({...F,searchText:"",page:C+1})):T.searchText!==J&&D(F=>({...F,searchText:J,page:1}))},H=h?e.jsx(xs,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:I,onError:w,extraParams:{projectId:b.id,did:x.meta.did,name:b.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(sr,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ye,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(wn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(gs,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:y},search:T.searchText,searchText:T.searchText,searchTextUpdate:C=>D(_=>({..._,searchText:C})),searchClose:()=>D(C=>({...C,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Le,{onClick:$,variant:"contained",children:[e.jsx(bt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:i,data:q,columns:P,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:S,onChange:N}),b&&e.jsx(mt,{title:`${r("common.delete")} ${b.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:G,onCancel:()=>p(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(C=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Ss,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:C})]}))})}),H]})}const sr=Xn(c)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DtuVp5SU.js","assets/vendor-ux-did-connect-Bh011lgb.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-CxrPpJZS.js","assets/vendor-mui-core-wlbruq2I.js","assets/vendor-hooks-TMGmpw5W.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-CATQui2x.js","assets/index-DZ-_hefE.js","assets/index-Rx6rf5TL.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as j,f as Et,l as ut,L as we,g as Hn,u as Gn,i as Jn,j as wt}from"./vendor-react-DEoibe3W.js";import{a9 as Ie,j as e,v as Ve,aa as c,aq as Lt,H as s,ad as ye,I as de,T as A,s as Xn,c6 as Go,D as pt,ah as Re,ax as Yn,bS as ot,ak as ht,bt as nt,bx as st,y as ee,ab as Se,P as Jo,G as Xo,w as qt,a8 as Yo,M as Qo,q as be,X as Qn,aj as Zo,t as Ko,bU as Zn,N as Ye,z as en,O as re,al as Ce,aw as tn,L as on,A as Nt,b9 as nn,bK as sn,by as Kn,e as rn,at as es,b_ as ts,af as os,U as ln,W as rt,bF as ns,bG as ss,c7 as rs,c8 as ls,bo as It,bp as is,br as cs,bv as as,bw as Rt}from"./vendor-mui-core-wlbruq2I.js";import{D as ke,G as Te,ag as ds,a8 as us,f as Io,ah as To,ac as ps,ai as hs,aj as fs,ak as bs}from"./index-Rx6rf5TL.js";import{r as $e,k as X,a as Z,bH as cn,i as ms,B as Le,bg as an,$ as dn,bd as un,at as xs,bI as gs,ac as At,a3 as M,a8 as js,I as ue,bJ as ks,bn as ys,_ as pn,b as Me,ar as ft,be as vs,ax as hn}from"./vendor-ux-did-connect-Bh011lgb.js";import{v as bt,c as fe,i as ws,z as Rs,B as Ee,p as Cs}from"./vendor-arcblock-CATQui2x.js";import{d as Ss}from"./Error-7F2F0yXi.js";import{C as mt}from"./confirm-W9aiB3ZK.js";import{u as Fe}from"./session-N9ogZkBO.js";import{W as Tt}from"./did-address-C3GRjuMv.js";import{E as Qe}from"./empty-spinner-DSwpCqdd.js";import{B as zt}from"./bundle-avatar-eYIyRJCN.js";import{S as De}from"./shorten-label-CTSJhlwO.js";import{L as Ot}from"./list-header-D976e09p.js";import{a0 as Ds,A as pe,J as Wt,E as fn}from"./vendor-utils-CxrPpJZS.js";import{d as Is}from"./Download-CSPVh6pQ.js";import{C as bn}from"./click-to-copy-BBibsDSl.js";import{Q as Ts}from"./QuestionMarkCircle-BMcwgPWr.js";import{x as $s,u as Ps}from"./vendor-hooks-TMGmpw5W.js";import{_ as Xe}from"./useSetState-CWq0AVWn.js";import{c as Bt}from"./index-DVQCgvFb.js";import{d as Mt}from"./Launch-akp2B3sE.js";import{E as Vt}from"./index-DU8cx_m6.js";import"./api-DB7tZ-Xo.js";import{d as _s}from"./ChevronRight-CB-tzzK0.js";import{T as Es,a as Ls}from"./vendor-mui-x-BKgL6hAa.js";import{d as lt}from"./DeleteOutline-D--wbiEJ.js";import{D as $o,C as Po,P as _o}from"./react-beautiful-dnd.esm-CaWQHB2l.js";import{c as qs,A as mn,u as xn,S as Ns,a as As,b as zs,e as Os,U as Ws,f as Ct,g as gn,n as Bs,h as Ms,i as Eo,k as Vs,l as Us}from"./item-CALJuG3t.js";import{d as Fs}from"./ArrowDropDown-QAD1r6CI.js";import{f as je}from"./index-8eXqqyHQ.js";import{d as jn}from"./Done-D5w4g3Ux.js";import{D as Hs}from"./delete-confirm-CR9GWuZW.js";import{g as kn}from"./get-safe-url-DvHrYSqa.js";import{M as Gs}from"./index-BXjOxZPH.js";import{r as Js}from"./index-DWgnwzKO.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ut={},Xs=Ie;Object.defineProperty(Ut,"__esModule",{value:!0});var yn=Ut.default=void 0,Ys=Xs($e()),Qs=e;yn=Ut.default=(0,Ys.default)((0,Qs.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Ft={},Zs=Ie;Object.defineProperty(Ft,"__esModule",{value:!0});var vn=Ft.default=void 0,Ks=Zs($e()),er=e;vn=Ft.default=(0,Ks.default)((0,er.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Ht={},tr=Ie;Object.defineProperty(Ht,"__esModule",{value:!0});var wn=Ht.default=void 0,or=tr($e()),nr=e;wn=Ht.default=(0,or.default)((0,nr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Gt({did:t,projectId:o,title:n,logo:r,describe:i}){const l=`${`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,d]=j.useState(!1),x=Ve(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),children:[e.jsx(Lt,{sx:{borderRadius:1},src:l}),e.jsxs(c,{children:[e.jsx(De,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:n||"/"}),e.jsx(De,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Gt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Jt({initUrl:t}){const o=Et(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:r,locale:i}=Z(),{api:a}=ke(),{api:l}=Fe(),[u,d]=j.useState(!0),{blocklet:x}=Te(),[b,p]=j.useState(null),[h,m]=j.useState(!1),f=Ve(C=>C.breakpoints.down("xl")),y=Ve(C=>C.breakpoints.down("md")),{componentDid:v=""}=ut(),[g,k]=j.useState(null),S=`publish-${x.meta.did}`,R=cn(S),[T,D]=j.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),B=()=>{a.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:n}}).then(C=>{const _=(C==null?void 0:C.projects)||[];d(!1),k(_)}).catch(C=>{d(!1),M.error(C.message)})},$=()=>{o(`${X.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=C=>{p(C)},G=()=>{d(!1),m(!0)},U=()=>{m(!1),p(null)},w=C=>{M.error(C.message),m(!1),p(null)},I=C=>{if(!(C!=null&&C.deleted)){M.error("Delete project failed");return}B(),m(!1),p(null)};j.useEffect(()=>{B()},[]);const q=j.useMemo(()=>{var _;if(!T.searchText)return g;let C=(_=T.searchText)==null?void 0:_.trim();return C?(C=ms.toAddress(C).toLocaleLowerCase(),g.filter(J=>J.blockletTitle.toLowerCase().includes(C)||J.blockletDid.toLowerCase().includes(C))):g},[g,T.searchText]);if(!g&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Qe,{})});if(!g)return null;if(!g.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Le,{onClick:$,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const P=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:C=>{const _=g[C];return e.jsx(we,{to:`${_.id}`,children:e.jsx(Gt,{did:x.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:C=>C?e.jsx(an,{type:"success",children:C}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:C=>C?e.jsx(Tt,{size:14,compact:!0,responsive:!1,did:C}):null}},f||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:C=>C?e.jsx(Tt,{onClick:()=>{o(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${C}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:C}):null}},f||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:C=>{const _=(x.children||[]).find(J=>J.meta.did===C);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(zt,{size:14,blocklet:_,ancestors:[x]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},C):""}}},f||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:C=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(De,{children:C})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:C=>e.jsx(dn,{value:Number(C),locale:i})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:C=>{const _=g[C];return e.jsxs(c,{display:"flex",children:[e.jsx(we,{to:`${_.id}/new-release/none/${_.lastReleaseId}`,children:e.jsx(ye,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"create",children:e.jsx(yn,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(ye,{title:r("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}/${_.blockletVersion}`,children:e.jsx(vn,{sx:{fontSize:18}})})})}),e.jsx(ye,{title:r("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>z(_),children:e.jsx(un,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),N=({page:C,rowsPerPage:_,searchText:J})=>{T.pageSize!==_?D(F=>({...F,searchText:"",pageSize:_,page:1})):T.page!==C+1?D(F=>({...F,searchText:"",page:C+1})):T.searchText!==J&&D(F=>({...F,searchText:J,page:1}))},H=h?e.jsx(xs,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:I,onError:w,extraParams:{projectId:b.id,did:x.meta.did,name:b.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(sr,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ye,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(wn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(gs,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:y},search:T.searchText,searchText:T.searchText,searchTextUpdate:C=>D(_=>({..._,searchText:C})),searchClose:()=>D(C=>({...C,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Le,{onClick:$,variant:"contained",children:[e.jsx(bt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:i,data:q,columns:P,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:S,onChange:N}),b&&e.jsx(mt,{title:`${r("common.delete")} ${b.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:G,onCancel:()=>p(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(C=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Ss,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:C})]}))})}),H]})}const sr=Xn(c)`
|
|
3
3
|
${({theme:t})=>t.breakpoints.down("md")} {
|
|
4
4
|
.MuiTableRow-root {
|
|
5
5
|
border-color: ${({theme:t})=>t.palette.divider};
|
|
@@ -142,7 +142,7 @@ import{r as j,f as Et,l as ut,L as we,g as Hn,u as Gn,i as Jn,j as wt}from"./ven
|
|
|
142
142
|
background: #fff;
|
|
143
143
|
z-index: 10;
|
|
144
144
|
}
|
|
145
|
-
`;var no={},Lr=Ie;Object.defineProperty(no,"__esModule",{value:!0});var $t=no.default=void 0,qr=Lr($e()),Nr=e;$t=no.default=(0,qr.default)((0,Nr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const zo="lastWantToConnectStoreId";function Ar(t){var u,d;const[o,n]=j.useState(null),{session:r}=Fe(),i=j.useCallback(x=>{n(x),localStorage.setItem(zo,x==null?void 0:x.id)},[n]),a=j.useMemo(()=>{var h,m,f,y;const x=localStorage.getItem(zo),b=x?(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(v=>v.id===x):null;if(b)return b;let p=(((m=t==null?void 0:t.settings)==null?void 0:m.storeList)||[]).find(v=>{var g;return!(v.id!==X.BLOCKLET_STORE.id||v.scope&&v.scope!=="studio"&&v.scope!==((g=r==null?void 0:r.user)==null?void 0:g.did))});return p||(p=(y=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:y[0]),p},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(d=r==null?void 0:r.user)==null?void 0:d.did]);return[o||a||{},i]}const Dt={};async function so(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:i=""}){Dt[i]&&clearTimeout(Dt[i]),await new Promise(u=>setTimeout(u,r));const a=Date.now(),l=async(u,d)=>{try{const x=await t();u(x)}catch(x){Date.now()-a>n?d(x):i?Dt[i]=setTimeout(()=>l(u,d),o):setTimeout(()=>l(u,d),o)}};return new Promise(l)}function zr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Or(t,{did:o,projectId:n,messageId:r}){return so(async()=>{var a;const i=await t.getProject({input:{did:o,projectId:n,messageId:r}});if(!((a=i==null?void 0:i.project)!=null&&a.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Wr(t,{did:o,projectId:n,storeId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(d=>d.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}function Br(t,{did:o,projectId:n,endpointId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(d=>d.endpointId===r))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${r}`})}const Mr=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:r})=>{var l,u;const i=t?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let a=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(a)||(a=[]),a=a.filter(d=>d.protected||!d.scope||d.scope==="studio"||d.scope===r),{teamDid:i,storeList:a}},ro=Mr;function lo({blocklet:t,store:o={},onChangeStore:n,onClick:r,disabled:i,loading:a,componentDid:l}){var w,I,q;const{t:u}=Z(),{session:d}=Fe(),{api:x,info:b,inService:p}=ke(),h=Te(),[m,f]=j.useState(!1),y=j.useRef(null),[v,g]=j.useState(!1),[k,S]=j.useState(null),R=P=>{n(P),f(!1)},T=()=>{f(!m)},D=P=>{y.current&&y.current.contains(P.target)||f(!1)},B=()=>{g(!0)},$=()=>{g(!1)},z=async()=>{var P;if(k)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((P=h==null?void 0:h.actions)==null?void 0:P.refreshBlocklet())}catch(N){M.error(`Remove Blocklet Store Error: ${je(N)}`)}finally{S(null)}},{storeList:G}=ro({fromBlocklet:p,blocklet:t,nodeInfo:b,componentDid:l,userDid:(w=d==null?void 0:d.user)==null?void 0:w.did}),U=(I=t==null?void 0:t.meta)==null?void 0:I.did;return e.jsxs(e.Fragment,{children:[e.jsxs(st,{disabled:i,ref:y,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(ee,{onClick:r,children:[a&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(ee,{size:"small","aria-controls":m?"split-button-menu":void 0,"aria-expanded":m?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:T,children:e.jsx(Fs,{})})]}),e.jsx(Jo,{sx:{zIndex:10},open:m,anchorEl:y.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:P})=>e.jsx(Xo,{...P,style:{transformOrigin:"center top"},children:e.jsx(qt,{children:e.jsx(Yo,{onClickAway:D,children:e.jsxs(Qo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[G==null?void 0:G.map(N=>{var H;return e.jsxs(be,{selected:N.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>R(N),children:[e.jsxs(c,{children:[e.jsx(De,{sx:{fontSize:"16px"},maxLength:24,children:N.name}),e.jsx(De,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:N.url})]}),qs({store:N,userDid:(H=d==null?void 0:d.user)==null?void 0:H.did})&&e.jsx(de,{sx:{ml:1},onClick:C=>{C.preventDefault(),C.stopPropagation(),S(N)},children:e.jsx(ue,{icon:"ic:outline-delete"})})]},N.url)}),e.jsx(Qn,{}),e.jsxs(be,{onClick:B,children:[e.jsx(bt,{font:!0}),e.jsx(A,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(mn,{hiddenChildren:!0,open:!0,onClose:$,teamDid:U,storeList:G,scope:"studio",onAdd:(q=h==null?void 0:h.actions)==null?void 0:q.refreshBlocklet}),k&&e.jsx(mt,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:z,onCancel:()=>S(null)})]})}lo.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};lo.defaultProps={store:null,blocklet:null};const Vr=(t,o,n)=>{const r=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${r}/${t.blockletLogo}`:`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,l=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:a,screenshotUrls:l,uploadLogoPrefix:r,uploadScreenshotPrefix:i}},$n=Vr,Ur=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function xt({url:t,style:o,controls:n,modestbranding:r}){var u;const{t:i}=Z(),a=t.includes("youtube.com")||t.includes("youtu.be"),l=t.includes("vimeo.com");if(a){const d=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(l){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ue,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(A,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}xt.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};xt.defaultProps={style:{},controls:1,modestbranding:1};function Pn({setParams:t,onClose:o,params:n}){const{t:r}=Z(),[i,a]=j.useState(""),l=i&&n.blockletVideos.includes(i),u=Ur(i),d=()=>{t(x=>{const b=[...x.blockletVideos];return b.push(i),{...x,blockletVideos:b}}),o()};return e.jsxs(pt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Zo,{children:r("studio.videoDialogTitle")}),e.jsxs(Ko,{children:[e.jsx(Zn,{fullWidth:!0,value:i,onChange:x=>a(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:i?e.jsx(Ye,{position:"end",children:e.jsx(de,{onClick:()=>a(""),children:e.jsx(ys,{})})}):null,error:l}),l&&e.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(xt,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(en,{children:[e.jsx(ee,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(ee,{disabled:!u||l,onClick:d,children:r("studio.confirm")})]})]})}Pn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Pt({errors:t,storeList:o,...n}){const{t:r}=Z();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,a])=>{const l=Object.values(a),u=o.find(d=>d.url===i);return l.length>0&&e.jsxs(c,{children:[e.jsx(ye,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),l.map(d=>e.jsx(c,{component:"li",ml:2,sx:{wordBreak:!0},children:d},d))]},i)})]})}Pt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const Oo=j.lazy(()=>pn(()=>import("./index-zB7QNT2N.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function io({projectId:t,readOnly:o,loading:n,blocklet:r,params:i,setParams:a,paramsErrTip:l,setParamsErrTip:u,warning:d,setLoading:x,initUrl:b,initLogoUrl:p,setInitLogoUrl:h,componentDid:m}){const{t:f,locale:y}=Z(),{api:v}=ke(),g=Et(),k=j.useRef(null),S=j.useRef(null),[R,T]=Ar(r),[D,B]=j.useState(!1),$=xn({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async E=>{const Q=setTimeout(()=>{x(!1)},2e4),Y=await Or(v,E);x(!1),clearTimeout(Q),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),g(window.location.pathname.replace(`${X.UNOWNED_DID}/create`,`${Y}/create`),{replace:!0})},G=()=>{if(!i.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const E=zr();$(async(Q,Y)=>{var oe,le,te;try{const ne=await v.connectByStudio({input:{did:(oe=r==null?void 0:r.meta)==null?void 0:oe.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((le=i==null?void 0:i.blockletComponents)==null?void 0:le.length)>0?"pack":"resource",componentDid:m,messageId:E,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ne!=null&&ne.url)){M.error("failed to connect to store");return}Y(ne.url),z({did:(te=r==null?void 0:r.meta)==null?void 0:te.did,projectId:"",messageId:E})}catch(ne){const ae=je(ne);M.error(ae),x(!1)}})},{logoUrl:U,screenshotUrls:w,uploadLogoPrefix:I,uploadScreenshotPrefix:q}=$n(i,r,t),{logoErrors:P,screenshotErrors:N,storeList:H,hasLogoWarning:C,hasScreenshotWarning:_}=d,J=()=>o?!1:!t||t===X.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=E=>{if(!E.destination)return;const Q=Array.from(i.blockletScreenshots),[Y]=Q.splice(E.source.index,1);Q.splice(E.destination.index,0,Y),a(oe=>({...oe,blockletScreenshots:Q}))},K=E=>{if(!E.destination)return;const Q=Array.from(i.blockletVideos),[Y]=Q.splice(E.source.index,1);Q.splice(E.destination.index,0,Y),a(oe=>({...oe,blockletVideos:Q}))};return e.jsxs(Fr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:E=>{u({blockletTitle:""}),a({blockletTitle:E.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===X.UNOWNED_DID&&e.jsx(Ye,{position:"end",children:e.jsx(lo,{blocklet:r,store:R,componentDid:m,onChangeStore:T,disabled:!i.blockletTitle||o||n,loading:n,onClick:G})})},error:!!l.projectId,helperText:l.projectId||"",value:t===X.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:E=>{u({blockletDescription:""}),a({blockletDescription:E.target.value.slice(0,159)})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:E.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:E.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(E.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:E.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:E=>{E.target.value&&!/^(git|https|svn)/.test(E.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:E.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Lt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:p||U,onClick:()=>{var E;J()&&((E=k.current)==null||E.open())}})})]}),C&&e.jsx(Pt,{errors:P,storeList:H,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:F,children:e.jsx(Po,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(E,Q)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Q.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[w.map((Y,oe)=>e.jsx(_o,{draggableId:Y,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:Y}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletScreenshots];return ae.splice(oe,1),{...ne,blockletScreenshots:ae}})},children:e.jsx(lt,{})})]})},Y)),E.placeholder,w.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var Y;J()&&((Y=S.current)==null||Y.open())},children:"+"})]})})})]}),_&&e.jsx(Pt,{errors:N,storeList:H}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:K,children:e.jsx(Po,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(E,Q)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[i.blockletVideos.map((Y,oe)=>e.jsx(_o,{draggableId:Y,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(xt,{url:Y,style:{pointerEvents:te.isDragging?"none":"auto"}}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletVideos];return ae.splice(oe,1),{...ne,blockletVideos:ae}})},children:e.jsx(lt,{})})]})},Y)),E.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{J()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(j.Suspense,{fallback:e.jsx(Qe,{}),children:[e.jsx(Oo,{ref:k,locale:y,popup:!0,onUploadFinish:E=>{var Q;a({blockletLogo:E.data.filename}),h(""),(Q=k.current)==null||Q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:I,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),D&&e.jsx(Pn,{onClose:()=>B(!1),params:i,setParams:a}),e.jsx(Oo,{ref:S,locale:y,popup:!0,onUploadFinish:E=>{var Q;a(Y=>{var le;const oe=Y.blockletScreenshots||[];return oe.push((le=E.data)==null?void 0:le.filename),{...Y,blockletScreenshots:oe}}),(Q=S.current)==null||Q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-w.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}io.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object,componentDid:s.string,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};io.defaultProps={initUrl:null,componentDid:""};const Fr=Re.div`
|
|
145
|
+
`;var no={},Lr=Ie;Object.defineProperty(no,"__esModule",{value:!0});var $t=no.default=void 0,qr=Lr($e()),Nr=e;$t=no.default=(0,qr.default)((0,Nr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const zo="lastWantToConnectStoreId";function Ar(t){var u,d;const[o,n]=j.useState(null),{session:r}=Fe(),i=j.useCallback(x=>{n(x),localStorage.setItem(zo,x==null?void 0:x.id)},[n]),a=j.useMemo(()=>{var h,m,f,y;const x=localStorage.getItem(zo),b=x?(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(v=>v.id===x):null;if(b)return b;let p=(((m=t==null?void 0:t.settings)==null?void 0:m.storeList)||[]).find(v=>{var g;return!(v.id!==X.BLOCKLET_STORE.id||v.scope&&v.scope!=="studio"&&v.scope!==((g=r==null?void 0:r.user)==null?void 0:g.did))});return p||(p=(y=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:y[0]),p},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(d=r==null?void 0:r.user)==null?void 0:d.did]);return[o||a||{},i]}const Dt={};async function so(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:i=""}){Dt[i]&&clearTimeout(Dt[i]),await new Promise(u=>setTimeout(u,r));const a=Date.now(),l=async(u,d)=>{try{const x=await t();u(x)}catch(x){Date.now()-a>n?d(x):i?Dt[i]=setTimeout(()=>l(u,d),o):setTimeout(()=>l(u,d),o)}};return new Promise(l)}function zr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Or(t,{did:o,projectId:n,messageId:r}){return so(async()=>{var a;const i=await t.getProject({input:{did:o,projectId:n,messageId:r}});if(!((a=i==null?void 0:i.project)!=null&&a.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Wr(t,{did:o,projectId:n,storeId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(d=>d.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}function Br(t,{did:o,projectId:n,endpointId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(d=>d.endpointId===r))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${r}`})}const Mr=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:r})=>{var l,u;const i=t?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let a=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(a)||(a=[]),a=a.filter(d=>d.protected||!d.scope||d.scope==="studio"||d.scope===r),{teamDid:i,storeList:a}},ro=Mr;function lo({blocklet:t,store:o={},onChangeStore:n,onClick:r,disabled:i,loading:a,componentDid:l}){var w,I,q;const{t:u}=Z(),{session:d}=Fe(),{api:x,info:b,inService:p}=ke(),h=Te(),[m,f]=j.useState(!1),y=j.useRef(null),[v,g]=j.useState(!1),[k,S]=j.useState(null),R=P=>{n(P),f(!1)},T=()=>{f(!m)},D=P=>{y.current&&y.current.contains(P.target)||f(!1)},B=()=>{g(!0)},$=()=>{g(!1)},z=async()=>{var P;if(k)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((P=h==null?void 0:h.actions)==null?void 0:P.refreshBlocklet())}catch(N){M.error(`Remove Blocklet Store Error: ${je(N)}`)}finally{S(null)}},{storeList:G}=ro({fromBlocklet:p,blocklet:t,nodeInfo:b,componentDid:l,userDid:(w=d==null?void 0:d.user)==null?void 0:w.did}),U=(I=t==null?void 0:t.meta)==null?void 0:I.did;return e.jsxs(e.Fragment,{children:[e.jsxs(st,{disabled:i,ref:y,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(ee,{onClick:r,children:[a&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(ee,{size:"small","aria-controls":m?"split-button-menu":void 0,"aria-expanded":m?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:T,children:e.jsx(Fs,{})})]}),e.jsx(Jo,{sx:{zIndex:10},open:m,anchorEl:y.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:P})=>e.jsx(Xo,{...P,style:{transformOrigin:"center top"},children:e.jsx(qt,{children:e.jsx(Yo,{onClickAway:D,children:e.jsxs(Qo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[G==null?void 0:G.map(N=>{var H;return e.jsxs(be,{selected:N.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>R(N),children:[e.jsxs(c,{children:[e.jsx(De,{sx:{fontSize:"16px"},maxLength:24,children:N.name}),e.jsx(De,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:N.url})]}),qs({store:N,userDid:(H=d==null?void 0:d.user)==null?void 0:H.did})&&e.jsx(de,{sx:{ml:1},onClick:C=>{C.preventDefault(),C.stopPropagation(),S(N)},children:e.jsx(ue,{icon:"ic:outline-delete"})})]},N.url)}),e.jsx(Qn,{}),e.jsxs(be,{onClick:B,children:[e.jsx(bt,{font:!0}),e.jsx(A,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(mn,{hiddenChildren:!0,open:!0,onClose:$,teamDid:U,storeList:G,scope:"studio",onAdd:(q=h==null?void 0:h.actions)==null?void 0:q.refreshBlocklet}),k&&e.jsx(mt,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:z,onCancel:()=>S(null)})]})}lo.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};lo.defaultProps={store:null,blocklet:null};const Vr=(t,o,n)=>{const r=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${r}/${t.blockletLogo}`:`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,l=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:a,screenshotUrls:l,uploadLogoPrefix:r,uploadScreenshotPrefix:i}},$n=Vr,Ur=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function xt({url:t,style:o,controls:n,modestbranding:r}){var u;const{t:i}=Z(),a=t.includes("youtube.com")||t.includes("youtu.be"),l=t.includes("vimeo.com");if(a){const d=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(l){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ue,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(A,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}xt.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};xt.defaultProps={style:{},controls:1,modestbranding:1};function Pn({setParams:t,onClose:o,params:n}){const{t:r}=Z(),[i,a]=j.useState(""),l=i&&n.blockletVideos.includes(i),u=Ur(i),d=()=>{t(x=>{const b=[...x.blockletVideos];return b.push(i),{...x,blockletVideos:b}}),o()};return e.jsxs(pt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Zo,{children:r("studio.videoDialogTitle")}),e.jsxs(Ko,{children:[e.jsx(Zn,{fullWidth:!0,value:i,onChange:x=>a(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:i?e.jsx(Ye,{position:"end",children:e.jsx(de,{onClick:()=>a(""),children:e.jsx(ys,{})})}):null,error:l}),l&&e.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(xt,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(en,{children:[e.jsx(ee,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(ee,{disabled:!u||l,onClick:d,children:r("studio.confirm")})]})]})}Pn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Pt({errors:t,storeList:o,...n}){const{t:r}=Z();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,a])=>{const l=Object.values(a),u=o.find(d=>d.url===i);return l.length>0&&e.jsxs(c,{children:[e.jsx(ye,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),l.map(d=>e.jsx(c,{component:"li",ml:2,sx:{wordBreak:!0},children:d},d))]},i)})]})}Pt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const Oo=j.lazy(()=>pn(()=>import("./index-DtuVp5SU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function io({projectId:t,readOnly:o,loading:n,blocklet:r,params:i,setParams:a,paramsErrTip:l,setParamsErrTip:u,warning:d,setLoading:x,initUrl:b,initLogoUrl:p,setInitLogoUrl:h,componentDid:m}){const{t:f,locale:y}=Z(),{api:v}=ke(),g=Et(),k=j.useRef(null),S=j.useRef(null),[R,T]=Ar(r),[D,B]=j.useState(!1),$=xn({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async E=>{const Q=setTimeout(()=>{x(!1)},2e4),Y=await Or(v,E);x(!1),clearTimeout(Q),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),g(window.location.pathname.replace(`${X.UNOWNED_DID}/create`,`${Y}/create`),{replace:!0})},G=()=>{if(!i.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const E=zr();$(async(Q,Y)=>{var oe,le,te;try{const ne=await v.connectByStudio({input:{did:(oe=r==null?void 0:r.meta)==null?void 0:oe.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((le=i==null?void 0:i.blockletComponents)==null?void 0:le.length)>0?"pack":"resource",componentDid:m,messageId:E,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ne!=null&&ne.url)){M.error("failed to connect to store");return}Y(ne.url),z({did:(te=r==null?void 0:r.meta)==null?void 0:te.did,projectId:"",messageId:E})}catch(ne){const ae=je(ne);M.error(ae),x(!1)}})},{logoUrl:U,screenshotUrls:w,uploadLogoPrefix:I,uploadScreenshotPrefix:q}=$n(i,r,t),{logoErrors:P,screenshotErrors:N,storeList:H,hasLogoWarning:C,hasScreenshotWarning:_}=d,J=()=>o?!1:!t||t===X.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=E=>{if(!E.destination)return;const Q=Array.from(i.blockletScreenshots),[Y]=Q.splice(E.source.index,1);Q.splice(E.destination.index,0,Y),a(oe=>({...oe,blockletScreenshots:Q}))},K=E=>{if(!E.destination)return;const Q=Array.from(i.blockletVideos),[Y]=Q.splice(E.source.index,1);Q.splice(E.destination.index,0,Y),a(oe=>({...oe,blockletVideos:Q}))};return e.jsxs(Fr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:E=>{u({blockletTitle:""}),a({blockletTitle:E.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===X.UNOWNED_DID&&e.jsx(Ye,{position:"end",children:e.jsx(lo,{blocklet:r,store:R,componentDid:m,onChangeStore:T,disabled:!i.blockletTitle||o||n,loading:n,onClick:G})})},error:!!l.projectId,helperText:l.projectId||"",value:t===X.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:E=>{u({blockletDescription:""}),a({blockletDescription:E.target.value.slice(0,159)})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:E.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:E.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(E.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:E.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:E=>{E.target.value&&!/^(git|https|svn)/.test(E.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:E.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Lt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:p||U,onClick:()=>{var E;J()&&((E=k.current)==null||E.open())}})})]}),C&&e.jsx(Pt,{errors:P,storeList:H,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:F,children:e.jsx(Po,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(E,Q)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Q.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[w.map((Y,oe)=>e.jsx(_o,{draggableId:Y,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:Y}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletScreenshots];return ae.splice(oe,1),{...ne,blockletScreenshots:ae}})},children:e.jsx(lt,{})})]})},Y)),E.placeholder,w.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var Y;J()&&((Y=S.current)==null||Y.open())},children:"+"})]})})})]}),_&&e.jsx(Pt,{errors:N,storeList:H}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:K,children:e.jsx(Po,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(E,Q)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[i.blockletVideos.map((Y,oe)=>e.jsx(_o,{draggableId:Y,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(xt,{url:Y,style:{pointerEvents:te.isDragging?"none":"auto"}}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletVideos];return ae.splice(oe,1),{...ne,blockletVideos:ae}})},children:e.jsx(lt,{})})]})},Y)),E.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{J()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(j.Suspense,{fallback:e.jsx(Qe,{}),children:[e.jsx(Oo,{ref:k,locale:y,popup:!0,onUploadFinish:E=>{var Q;a({blockletLogo:E.data.filename}),h(""),(Q=k.current)==null||Q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:I,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),D&&e.jsx(Pn,{onClose:()=>B(!1),params:i,setParams:a}),e.jsx(Oo,{ref:S,locale:y,popup:!0,onUploadFinish:E=>{var Q;a(Y=>{var le;const oe=Y.blockletScreenshots||[];return oe.push((le=E.data)==null?void 0:le.filename),{...Y,blockletScreenshots:oe}}),(Q=S.current)==null||Q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-w.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}io.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object,componentDid:s.string,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};io.defaultProps={initUrl:null,componentDid:""};const Fr=Re.div`
|
|
146
146
|
margin-top: 24px;
|
|
147
147
|
.screenshot {
|
|
148
148
|
margin-bottom: 16px;
|
|
@@ -190,7 +190,7 @@ import{r as j,f as Et,l as ut,L as we,g as Hn,u as Gn,i as Jn,j as wt}from"./ven
|
|
|
190
190
|
padding-bottom: 12px;
|
|
191
191
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
192
192
|
}
|
|
193
|
-
`;function Nn({text:t}){const{palette:o}=rn();return t?e.jsx(Gs,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:Cs.sanitize(t),rehypePlugins:[[Js,{target:"_blank"}]]}):e.jsx(Ue,{Icon:Vt})}Nn.propTypes={text:s.string.isRequired};function An({params:t,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:i,readOnly:a}){var b;const{t:l}=Z(),[u,d]=j.useState(a?"preview":"write"),x=(p,h)=>{d(h)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(A,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),e.jsxs(ln,{value:u,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(rt,{value:"write",label:"Write"}),e.jsx(rt,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(re,{disabled:r||a,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Ye,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{i({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Nn,{text:t.blockletIntroduction||""})})]})}An.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var go={},nl=Ie;Object.defineProperty(go,"__esModule",{value:!0});var _t=go.default=void 0,sl=nl($e()),Mo=e;_t=go.default=(0,sl.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function jo({step:t,ok:o,active:n,error:r,warning:i}){let a="grey.500",l=t+1;return o&&(l=e.jsx(jn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>t?(a="error.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):i?(a="warning.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(a="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:a,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}jo.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};jo.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function ko({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:i,loading:a,paramsErrTip:l,warning:u,viewMode:d,projectId:x}){const{t:b}=Z(),p=()=>{n(y=>y+1)},h=()=>{n(y=>y-1)},m=y=>y===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):y===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):y>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",f=d||En({hasSelectedResources:r,params:i,projectId:x,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(ns,{activeStep:o,orientation:"vertical",children:t.map((y,v)=>{const g={},k=a||!Kr({hasSelectedResources:r,params:i,projectId:x,step:v,t:b}),S=a?"":m(v);return S&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:S}),g.error=!0),e.jsxs(ss,{children:[e.jsx(rs,{icon:e.jsx(jo,{error:S,warning:v===0?u.hasWarning:!1,active:f?99:o,step:v,ok:k}),sx:{cursor:"pointer",color:S?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:S||!k&&o>v?"error.main":"inherit",children:y.label})}),e.jsxs(ls,{children:[e.jsx(A,{fontSize:12,children:y.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(ee,{variant:"contained",onClick:p,sx:{mt:1,mr:1},disabled:S||!k,children:b("common.continue")}),v>0&&e.jsx(ee,{disabled:v===0,onClick:h,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},y.label)})}),o>=t.length-1&&e.jsx(qt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}ko.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.oneOfType([s.string,s.bool]),loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.oneOfType([s.string,s.bool]),warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};ko.defaultProps={hasSelectedResources:!1,viewMode:""};const rl=[".zip",".gz"],ll=1024*1024*100,il=j.lazy(()=>pn(()=>import("./index-zB7QNT2N.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function yo({app:t,projectId:o,readOnly:n,params:r,setParams:i,setParamsErrTip:a,error:l}){const{t:u,locale:d}=Z(),x=j.useRef(null),b=()=>n?!1:!o||o===X.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,p=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Ce,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(A,{component:"a",href:`${p}/params.uploadedResource`,children:r.uploadedResource}),!n&&e.jsx(ee,{variant:"outlined",size:"small",onClick:()=>{var h;b()&&((h=x.current)==null||h.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(j.Suspense,{fallback:e.jsx(Qe,{}),children:e.jsx(il,{ref:x,locale:d,popup:!0,onUploadFinish:h=>{var m;i({uploadedResource:h.data.filename}),a({blockletResource:""}),(m=x.current)==null||m.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:p,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:rl,maxFileSize:ll,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l})]})}yo.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};yo.defaultProps={};function at({readOnly:t,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:i,loading:a}){var u;const{t:l}=Z();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:a||t,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{i({blockletVersion:""}),n({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(re,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ye,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{i({note:""}),n({note:d.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}at.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};at.defaultProps={};function zn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&zn(t[o]);return t}function dt({index:t,item:o,dockerParams:n,setDockerParams:r,dataKey:i,t:a,readOnly:l}){const u=(o==null?void 0:o.value)||"",[d,x]=j.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),r({...n,[i]:[...n[i]]})},p=(U,w)=>{var I;(I=n[i])!=null&&I[t]&&(w?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${Ct(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),r({...n,[i]:[...n[i]]})},h=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],secure:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},m=(U,w)=>{n[i][t]={...n[i][t],shared:w},r({...n,[i]:[...n[i]]})},f=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],required:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},y=(U,w)=>{n[i][t]={...n[i][t],value:w?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[i]:[...n[i]]})},v=U=>{n[i][t]={...n[i][t],description:U.target.value},r({...n,[i]:[...n[i]]})},g=U=>{const w=U.target.value==="web"?"web":"docker";w==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"});const q=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:w,path:w==="docker"?q:"/",protocol:"http",prefix:w==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},r({...n,dockerArgs:[...n.dockerArgs]})},S=U=>{const w=U.target.value;n[i][t]={...n[i][t],prefix:w,path:w==="*"?"/":w},r({...n,[i]:[...n[i]]})},R=U=>{var w;(w=n[i])!=null&&w[t]&&(n[i][t].value=U.target.value),r({...n,[i]:[...n[i]]})},T=u===`$${Ct(o.key)}`||o.custom,D=i==="dockerArgs"&&!gn[o.key],B=Bs[o.key],$=i==="dockerEnvs",z=o.key==="--publish";let G=o.key;return z&&o.type==="web"?G="--publish (Web)":$&&(G=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:G})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(re,{disabled:l||T||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:T?`$${Ct(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ye,{position:"end",sx:{zoom:.9},children:[(!(B||D)||$||z)&&e.jsx(de,{onClick:()=>x(!0),children:e.jsx(ue,{icon:"icon-park-outline:setting-config"})}),!l&&e.jsx(de,{onClick:b,color:D?"error":"default",children:e.jsx(ue,{icon:"ic:round-delete"})})]})},error:D,onChange:R}),D&&e.jsx(A,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(A,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ms[o.key](u)&&e.jsx(A,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),d&&e.jsx(ft,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||D||$?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(Ee,{disabled:l,checked:T,onChange:p,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.shared")}),e.jsx(Ee,{disabled:l,checked:o.shared,onChange:m,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.required")}),e.jsx(Ee,{disabled:l,checked:o.required,onChange:f,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.secure")}),e.jsx(Ee,{disabled:l,checked:o.secure,onChange:h,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(Ee,{disabled:l,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:y,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(re,{disabled:l,value:o.description,onChange:v,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(It,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(It,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:l,value:o.prefix,onChange:S,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}dt.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};dt.defaultProps={};const cl=`
|
|
193
|
+
`;function Nn({text:t}){const{palette:o}=rn();return t?e.jsx(Gs,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:Cs.sanitize(t),rehypePlugins:[[Js,{target:"_blank"}]]}):e.jsx(Ue,{Icon:Vt})}Nn.propTypes={text:s.string.isRequired};function An({params:t,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:i,readOnly:a}){var b;const{t:l}=Z(),[u,d]=j.useState(a?"preview":"write"),x=(p,h)=>{d(h)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(A,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),e.jsxs(ln,{value:u,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(rt,{value:"write",label:"Write"}),e.jsx(rt,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(re,{disabled:r||a,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Ye,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{i({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Nn,{text:t.blockletIntroduction||""})})]})}An.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var go={},nl=Ie;Object.defineProperty(go,"__esModule",{value:!0});var _t=go.default=void 0,sl=nl($e()),Mo=e;_t=go.default=(0,sl.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function jo({step:t,ok:o,active:n,error:r,warning:i}){let a="grey.500",l=t+1;return o&&(l=e.jsx(jn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>t?(a="error.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):i?(a="warning.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(a="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:a,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}jo.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};jo.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function ko({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:i,loading:a,paramsErrTip:l,warning:u,viewMode:d,projectId:x}){const{t:b}=Z(),p=()=>{n(y=>y+1)},h=()=>{n(y=>y-1)},m=y=>y===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):y===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):y>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",f=d||En({hasSelectedResources:r,params:i,projectId:x,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(ns,{activeStep:o,orientation:"vertical",children:t.map((y,v)=>{const g={},k=a||!Kr({hasSelectedResources:r,params:i,projectId:x,step:v,t:b}),S=a?"":m(v);return S&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:S}),g.error=!0),e.jsxs(ss,{children:[e.jsx(rs,{icon:e.jsx(jo,{error:S,warning:v===0?u.hasWarning:!1,active:f?99:o,step:v,ok:k}),sx:{cursor:"pointer",color:S?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:S||!k&&o>v?"error.main":"inherit",children:y.label})}),e.jsxs(ls,{children:[e.jsx(A,{fontSize:12,children:y.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(ee,{variant:"contained",onClick:p,sx:{mt:1,mr:1},disabled:S||!k,children:b("common.continue")}),v>0&&e.jsx(ee,{disabled:v===0,onClick:h,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},y.label)})}),o>=t.length-1&&e.jsx(qt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}ko.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.oneOfType([s.string,s.bool]),loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.oneOfType([s.string,s.bool]),warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};ko.defaultProps={hasSelectedResources:!1,viewMode:""};const rl=[".zip",".gz"],ll=1024*1024*100,il=j.lazy(()=>pn(()=>import("./index-DtuVp5SU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function yo({app:t,projectId:o,readOnly:n,params:r,setParams:i,setParamsErrTip:a,error:l}){const{t:u,locale:d}=Z(),x=j.useRef(null),b=()=>n?!1:!o||o===X.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,p=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Ce,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(A,{component:"a",href:`${p}/params.uploadedResource`,children:r.uploadedResource}),!n&&e.jsx(ee,{variant:"outlined",size:"small",onClick:()=>{var h;b()&&((h=x.current)==null||h.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(j.Suspense,{fallback:e.jsx(Qe,{}),children:e.jsx(il,{ref:x,locale:d,popup:!0,onUploadFinish:h=>{var m;i({uploadedResource:h.data.filename}),a({blockletResource:""}),(m=x.current)==null||m.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:p,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:rl,maxFileSize:ll,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l})]})}yo.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};yo.defaultProps={};function at({readOnly:t,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:i,loading:a}){var u;const{t:l}=Z();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:a||t,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{i({blockletVersion:""}),n({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(re,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ye,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{i({note:""}),n({note:d.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}at.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};at.defaultProps={};function zn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&zn(t[o]);return t}function dt({index:t,item:o,dockerParams:n,setDockerParams:r,dataKey:i,t:a,readOnly:l}){const u=(o==null?void 0:o.value)||"",[d,x]=j.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),r({...n,[i]:[...n[i]]})},p=(U,w)=>{var I;(I=n[i])!=null&&I[t]&&(w?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${Ct(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),r({...n,[i]:[...n[i]]})},h=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],secure:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},m=(U,w)=>{n[i][t]={...n[i][t],shared:w},r({...n,[i]:[...n[i]]})},f=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],required:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},y=(U,w)=>{n[i][t]={...n[i][t],value:w?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[i]:[...n[i]]})},v=U=>{n[i][t]={...n[i][t],description:U.target.value},r({...n,[i]:[...n[i]]})},g=U=>{const w=U.target.value==="web"?"web":"docker";w==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"});const q=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:w,path:w==="docker"?q:"/",protocol:"http",prefix:w==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},r({...n,dockerArgs:[...n.dockerArgs]})},S=U=>{const w=U.target.value;n[i][t]={...n[i][t],prefix:w,path:w==="*"?"/":w},r({...n,[i]:[...n[i]]})},R=U=>{var w;(w=n[i])!=null&&w[t]&&(n[i][t].value=U.target.value),r({...n,[i]:[...n[i]]})},T=u===`$${Ct(o.key)}`||o.custom,D=i==="dockerArgs"&&!gn[o.key],B=Bs[o.key],$=i==="dockerEnvs",z=o.key==="--publish";let G=o.key;return z&&o.type==="web"?G="--publish (Web)":$&&(G=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:G})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(re,{disabled:l||T||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:T?`$${Ct(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ye,{position:"end",sx:{zoom:.9},children:[(!(B||D)||$||z)&&e.jsx(de,{onClick:()=>x(!0),children:e.jsx(ue,{icon:"icon-park-outline:setting-config"})}),!l&&e.jsx(de,{onClick:b,color:D?"error":"default",children:e.jsx(ue,{icon:"ic:round-delete"})})]})},error:D,onChange:R}),D&&e.jsx(A,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(A,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ms[o.key](u)&&e.jsx(A,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),d&&e.jsx(ft,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||D||$?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(Ee,{disabled:l,checked:T,onChange:p,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.shared")}),e.jsx(Ee,{disabled:l,checked:o.shared,onChange:m,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.required")}),e.jsx(Ee,{disabled:l,checked:o.required,onChange:f,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.secure")}),e.jsx(Ee,{disabled:l,checked:o.secure,onChange:h,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(Ee,{disabled:l,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:y,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(re,{disabled:l,value:o.description,onChange:v,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(It,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(It,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:l,value:o.prefix,onChange:S,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}dt.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};dt.defaultProps={};const cl=`
|
|
194
194
|
docker run --name postgrest
|
|
195
195
|
-p 3000:3000
|
|
196
196
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bp as Y,br as w,O as S,q as j,aa as v}from"./vendor-mui-core-wlbruq2I.js";import{y as s}from"./index-
|
|
1
|
+
import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bp as Y,br as w,O as S,q as j,aa as v}from"./vendor-mui-core-wlbruq2I.js";import{y as s}from"./index-Rx6rf5TL.js";import{a as H}from"./vendor-ux-did-connect-Bh011lgb.js";import{A as M}from"./vendor-arcblock-CATQui2x.js";import{b as _}from"./vendor-hooks-TMGmpw5W.js";import{L as A,D as y}from"./vendor-mui-x-BKgL6hAa.js";import{A as C}from"./AdapterDayjs-eMGLd9qK.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const d=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:d,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,d]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(d(o),o==="custom"){const f=s().toDate();D(f),m(f)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(f=>s(f.value).isSame(i))||(d("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";import{a9 as Ot,j as e,aa as E,bp as Fe,bs as $e,bo as We,q as je,T as Q,O as me,ab as ie,by as He,ak as oe,H as v,ah as z,e as Cn,ad as ue,w as jn,y as Nt,b8 as Sn,b9 as wn,I as Pn,bi as kn,bt as In,bS as Tn}from"./vendor-mui-core-wlbruq2I.js";import{B as St,e as ze,a0 as Dn,ay as An,n as wt,A as Rn,b as Ln}from"./vendor-utils-CxrPpJZS.js";import{r as _t,aR as Ut,bK as En,i as On,a as V,a2 as Nn,a1 as _n,a3 as Y,ar as se,B as W,f as Un,at as Bn,d as Fn,bb as fe,bB as $n,k as J,a5 as Bt,an as Wn,bs as Ft,bt as $t,bu as zn,I as Mn,ax as qn,$ as Me,bd as Hn,ac as Wt,ab as zt,bH as Vn}from"./vendor-ux-did-connect-Bh011lgb.js";import{c as X,a as Kn,G as Mt,v as Se,n as Zn,I as Yn}from"./vendor-arcblock-CATQui2x.js";import{d as Gn}from"./ViewList-BqZC98em.js";import{a2 as Qn,f as Jn,D as q,ay as we,n as pe,a3 as Xn,V as re,az as es,G as qt,aA as Ht,y as ts,b as ns,aB as ss}from"./index-DZhGBW-J.js";import{k as rs,u as Ve,a as Ke,c as os,m as is,b as as}from"./vendor-hooks-TMGmpw5W.js";import{l as ls}from"./index-BPMh7nrj.js";import{u as K,d as Pt,W as Vt}from"./dashboard-COhzj5M7.js";import{W as Ze}from"./did-address-C3GRjuMv.js";import{P as ee}from"./permission-CMjo9z-z.js";import{C as Te}from"./click-to-copy-BBibsDSl.js";import{T as Kt}from"./index-YYMO-UJx.js";import{f as te}from"./index-8eXqqyHQ.js";import{_ as cs}from"./useAsync-QkUcWOv0.js";import{I as M}from"./index-Dsf-Dx7V.js";import{d as ds}from"./DeleteOutline-D--wbiEJ.js";import{C as ge}from"./confirm-BVbxEEUe.js";import{u as he}from"./session-N9ogZkBO.js";import{i as Zt,a as Pe,p as Yt}from"./util-Ayf5_DBX.js";import{b as ms}from"./sdk-b4mKK9kW.js";import{A as us}from"./actions-DBL5WgL-.js";import{S as ps}from"./shorten-label-CTSJhlwO.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-COrhSWV-.js";import"./PlayArrow-RuC30CX1.js";import"./get-safe-url-DvHrYSqa.js";import"./use-blocklet-logo-C3eb15_j.js";import"./InfoOutlined-Bpx0eOkP.js";import"./dot-DGdAPqTT.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CiFFAdJf.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-eMGLd9qK.js";import"./base32-BwYE-4Kz.js";import"./MoreHoriz-B0f55Tf5.js";var Ye={},fs=Ot;Object.defineProperty(Ye,"__esModule",{value:!0});var Gt=Ye.default=void 0,gs=fs(_t()),hs=e;Gt=Ye.default=(0,gs.default)((0,hs.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 Ge=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)"})})})]})};Ge.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ge.displayName="person";const xs=Ge;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 Ce={},ys=t=>encodeURIComponent(t).replace(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),Jt="%[a-f0-9]{2}",kt=new RegExp("("+Jt+")|([^%]+?)","gi"),It=new RegExp("("+Jt+")+","gi");function qe(t,o){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;o=o||1;var c=t.slice(0,o),u=t.slice(o);return Array.prototype.concat.call([],qe(c),qe(u))}function vs(t){try{return decodeURIComponent(t)}catch{for(var o=t.match(kt)||[],c=1;c<o.length;c++)t=qe(o,c).join(""),o=t.match(kt)||[];return t}}function bs(t){for(var o={"%FE%FF":"��","%FF%FE":"��"},c=It.exec(t);c;){try{o[c[0]]=decodeURIComponent(c[0])}catch{var u=vs(c[0]);u!==c[0]&&(o[c[0]]=u)}c=It.exec(t)}o["%C2"]="�";for(var d=Object.keys(o),h=0;h<d.length;h++){var S=d[h];t=t.replace(new RegExp(S,"g"),o[S])}return t}var Cs=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 bs(t)}},js=(t,o)=>{if(!(typeof t=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(o==="")return[t];const c=t.indexOf(o);return c===-1?[t]:[t.slice(0,c),t.slice(c+o.length)]},Ss=function(t,o){for(var c={},u=Object.keys(t),d=Array.isArray(o),h=0;h<u.length;h++){var S=u[h],p=t[S];(d?o.indexOf(S)!==-1:o(S,p,t))&&(c[S]=p)}return c};(function(t){const o=ys,c=Cs,u=js,d=Ss,h=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(l,r)=>{const x=l.length;return r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[",x,"]"].join("")]:[...l,[g(s,n),"[",g(x,n),"]=",g(r,n)].join("")]};case"bracket":return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[]"].join("")]:[...l,[g(s,n),"[]=",g(r,n)].join("")];case"comma":case"separator":return s=>(l,r)=>r==null||r.length===0?l:l.length===0?[[g(s,n),"=",g(r,n)].join("")]:[[l,g(r,n)].join(n.arrayFormatSeparator)];default:return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,g(s,n)]:[...l,[g(s,n),"=",g(r,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(l,r,x)=>{if(s=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!s){x[l]=r;return}x[l]===void 0&&(x[l]={}),x[l][s[1]]=r};case"bracket":return(l,r,x)=>{if(s=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!s){x[l]=r;return}if(x[l]===void 0){x[l]=[r];return}x[l]=[].concat(x[l],r)};case"comma":case"separator":return(l,r,x)=>{const y=typeof r=="string"&&r.includes(n.arrayFormatSeparator),w=typeof r=="string"&&!y&&i(r,n).includes(n.arrayFormatSeparator);r=w?i(r,n):r;const _=y||w?r.split(n.arrayFormatSeparator).map(F=>i(F,n)):r===null?r:i(r,n);x[l]=_};default:return(l,r,x)=>{if(x[l]===void 0){x[l]=r;return}x[l]=[].concat(x[l],r)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(n,s){return s.encode?s.strict?o(n):encodeURIComponent(n):n}function i(n,s){return s.decode?c(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,l)=>Number(s)-Number(l)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const l=n.indexOf("#");return l!==-1&&(s=n.slice(l)),s}function a(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function I(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 l=p(s),r=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return r;for(const x of n.split("&")){if(x==="")continue;let[y,w]=u(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:i(w,s),l(i(y,s),w,r)}for(const x of Object.keys(r)){const y=r[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=I(y[w],s);else r[x]=I(y,s)}return s.sort===!1?r:(s.sort===!0?Object.keys(r).sort():Object.keys(r).sort(s.sort)).reduce((x,y)=>{const w=r[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=a,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 l=w=>s.skipNull&&h(n[w])||s.skipEmptyString&&n[w]==="",r=S(s),x={};for(const w of Object.keys(n))l(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const _=n[w];return _===void 0?"":_===null?g(w,s):Array.isArray(_)?_.reduce(r(w),[]).join("&"):g(w,s)+"="+g(_,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[l,r]=u(n,"#");return Object.assign({url:l.split("?")[0]||"",query:m(a(n),s)},s&&s.parseFragmentIdentifier&&r?{fragmentIdentifier:i(r,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const l=C(n.url).split("?")[0]||"",r=t.extract(n.url),x=t.parse(r,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let _=k(n.url);return n.fragmentIdentifier&&(_=`#${g(n.fragmentIdentifier,s)}`),`${l}${w}${_}`},t.pick=(n,s,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:r,query:x,fragmentIdentifier:y}=t.parseUrl(n,l);return t.stringifyUrl({url:r,query:d(x,s),fragmentIdentifier:y},l)},t.exclude=(n,s,l)=>{const r=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,r,l)}})(Ce);const le=yn,ws={parseNumbers:!1,parseBooleans:!1},Ps={skipNull:!1,skipEmptyString:!1},ks=(t,o)=>{var c,u;const{navigateMode:d="push",parseOptions:h,stringifyOptions:S}={},p=Object.assign(Object.assign({},ws),h),b=Object.assign(Object.assign({},Ps),S),g=le.useLocation(),i=(c=le.useHistory)===null||c===void 0?void 0:c.call(le),T=(u=le.useNavigate)===null||u===void 0?void 0:u.call(le),C=rs(),k=P.useRef(typeof t=="function"?t():t||{}),a=P.useMemo(()=>Ce.parse(g.search,p),[g.search]),I=P.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[I,Ve(n=>{const s=typeof n=="function"?n(I):n;C(),i&&i[d]({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},g.state),T&&T({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},{replace:d==="replace",state:g.state})})]},Is=ks,Ts=Ut,_e=En,Ue=On,Ds=ls,Tt={role:Ts.types.RoleType.ROLE_APPLICATION},As=(t,o,c,u)=>{let d=c||Tt;const h=(0,Ue.isEthereumType)((0,Ue.DidType)(c));if(h?d=(0,_e.WalletType)(c):d=(0,_e.WalletType)(Tt),!(0,Ue.isValid)(t)){let S="";try{return h?S=t.slice(0,66):S=t,(0,_e.fromSecretKey)(S,d)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!o)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ds.fromAppDid)(t,o,d,u||0)};var Rs=As,Xt=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const ce=Xt(Qn),Ls=Ut,ve=Xt(Rs),Es=Jn,Os=(t,o,{returnWallet:c=!0}={})=>{var F,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,ce.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:d=[]}=t,h=[...d,...u],S=h.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=h.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=h.find(D=>D.key==="BLOCKLET_APP_URL"),g=h.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:T}=t.meta,C=(0,Es.getDisplayName)(t),k=(0,ce.default)(S,"value",t.meta.description),a=(0,ce.default)(p,"value","auto"),I=(0,ce.default)(b,"value",""),m=(0,ce.default)(g,"value","");if(!c)return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=h.find(D=>D.key==="BLOCKLET_APP_SK"),s=h.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||h.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),l=h.find(D=>D.key==="BLOCKLET_APP_PSK");let r;s&&(s.value==="ethereum"||s.value==="eth")&&(r=s.value);let x=null,y=null;if(n&&n.value)x=(0,ve.default)(n.value,void 0,r),l&&l.value&&l.value!==n.value&&(y=(0,ve.default)(l.value,void 0,r));else{if(!o||typeof o!="string")throw new Error("Node secret key must be a string");s?x=(0,ve.default)(t.meta.did,o,r):x=(0,ve.default)(t.meta.did,o)}const w=((R=(F=t.settings)==null?void 0:F.session)==null?void 0:R.salt)||"",_=Ls.Hasher.SHA3.hash256(St.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>St.from(D))));return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:_,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ns=Os;const _s=vn(Ns);function Je({teamDid:t,roles:o,apps:c,onCancel:u,onSuccess:d,onError:h,endpoint:S}){var I;const{api:p}=q(),{t:b,locale:g}=V(),i=Ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:c.length>0?c[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!i.role){i.error=b("team.member.error.passportEmpty");return}const m=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:m,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:l}=await p.createMemberInvitation({input:s});i.inviteInfo=l,i.activeStep=1}catch(n){const s=te(n);i.error=s,h(n)}finally{i.loading=!1}},C=o.find(m=>m.name===i.role),a=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[c.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx($e,{children:b("common.sourceApp")}),e.jsx(We,{value:i.sourceAppPid,onChange:m=>{i.error=null,i.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,children:c.map(m=>e.jsx(je,{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(Nn,{did:m.appPid,size:28}),m.appName]}),e.jsx(_n,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx($e,{children:b("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:i.role,onChange:m=>{i.error=null,i.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:o.filter(m=>m.name!=="owner").map(m=>e.jsx(je,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Q,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Q,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((I=C==null?void 0:C.extra)==null?void 0:I.display)==="custom"&&e.jsx(me,{label:b("common.display"),type:"url",value:i.display,onChange:m=>{i.error=null,i.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(me,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:m=>{i.error=null,i.remark=m.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Kt,{value:i.passportExpireTime,onChange:m=>{i.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:T},{body:()=>{var n,s;const m=we({inviteId:(n=i.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=i.inviteInfo)==null?void 0:s.expireDate,g)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});os(m),Y.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:u}][i.activeStep];return e.jsxs(se,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!i.error&&e.jsx(oe,{severity:"error",variant:"icon",children:i.error})]})}Je.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};Je.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:o,onSuccess:c,onError:u,endpoint:d}){const{api:h,info:S}=q(),{api:p}=P.useContext(Un),[b,g]=P.useState(!1),{t:i,locale:T}=V(),[C,k]=P.useState(""),[a,I]=P.useState(!1),[m,n]=P.useState(0),[s,l]=P.useState(""),[r,x]=P.useState(""),y=!!ze(S,"ownerNft.did"),w=cs(async()=>{if(y){const{state:A}=await h.getDelegationState();return A}return{delegated:!0}});if(w.loading)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx(oe,{severity:"error",variant:"icon",children:te(w.error)})});const _=async()=>{k(null),g(!0);try{const{inviteInfo:A}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:r.trim()}});l(A),n(D.length-1)}catch(A){const H=te(A);k(H),u(A)}finally{g(!1)}},F=()=>{I(!0),n(1)},R=()=>{I(!1),n(0)},D=[{body:e.jsxs(Q,{component:"div",children:[e.jsxs(oe,{severity:"warning",children:[e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(oe,{severity:"warning",children:e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(me,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:r,onChange:A=>{k(null),x(A.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:o,onConfirm:y&&!ze(w,"value.delegated")?F:_},{body:()=>e.jsx(Bn,{action:"delegate-transfer-nft",open:a,locale:T,checkFn:p.get,onClose:R,onSuccess:_,checkTimeout:5*60*1e3,webWalletUrl:Xn(S),extraParams:{targetDID:S.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const A=we({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Us,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:A})]})},confirm:i("common.confirm"),onConfirm:c}],O=D[m];return e.jsxs(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(W,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(W,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(ie,{size:16}),O.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(oe,{severity:"error",variant:"icon",children:C})]})}Xe.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Xe.defaultProps={onError:()=>{},endpoint:""};const Us=z.div`
|
|
1
|
+
import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";import{a9 as Ot,j as e,aa as E,bp as Fe,bs as $e,bo as We,q as je,T as Q,O as me,ab as ie,by as He,ak as oe,H as v,ah as z,e as Cn,ad as ue,w as jn,y as Nt,b8 as Sn,b9 as wn,I as Pn,bi as kn,bt as In,bS as Tn}from"./vendor-mui-core-wlbruq2I.js";import{B as St,e as ze,a0 as Dn,ay as An,n as wt,A as Rn,b as Ln}from"./vendor-utils-CxrPpJZS.js";import{r as _t,aR as Ut,bK as En,i as On,a as V,a2 as Nn,a1 as _n,a3 as Y,ar as se,B as W,f as Un,at as Bn,d as Fn,bb as fe,bB as $n,k as J,a5 as Bt,an as Wn,bs as Ft,bt as $t,bu as zn,I as Mn,ax as qn,$ as Me,bd as Hn,ac as Wt,ab as zt,bH as Vn}from"./vendor-ux-did-connect-Bh011lgb.js";import{c as X,a as Kn,G as Mt,v as Se,n as Zn,I as Yn}from"./vendor-arcblock-CATQui2x.js";import{d as Gn}from"./ViewList-BqZC98em.js";import{a2 as Qn,f as Jn,D as q,ay as we,n as pe,a3 as Xn,V as re,az as es,G as qt,aA as Ht,y as ts,b as ns,aB as ss}from"./index-Rx6rf5TL.js";import{k as rs,u as Ve,a as Ke,c as os,m as is,b as as}from"./vendor-hooks-TMGmpw5W.js";import{l as ls}from"./index-BPMh7nrj.js";import{u as K,d as Pt,W as Vt}from"./dashboard-DTpUsE7s.js";import{W as Ze}from"./did-address-C3GRjuMv.js";import{P as ee}from"./permission-CMjo9z-z.js";import{C as Te}from"./click-to-copy-BBibsDSl.js";import{T as Kt}from"./index-BFxPxs1o.js";import{f as te}from"./index-8eXqqyHQ.js";import{_ as cs}from"./useAsync-QkUcWOv0.js";import{I as M}from"./index-Dsf-Dx7V.js";import{d as ds}from"./DeleteOutline-D--wbiEJ.js";import{C as ge}from"./confirm-W9aiB3ZK.js";import{u as he}from"./session-N9ogZkBO.js";import{i as Zt,a as Pe,p as Yt}from"./util-Ayf5_DBX.js";import{b as ms}from"./sdk-b4mKK9kW.js";import{A as us}from"./actions-DBL5WgL-.js";import{S as ps}from"./shorten-label-CTSJhlwO.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-COrhSWV-.js";import"./PlayArrow-RuC30CX1.js";import"./get-safe-url-DvHrYSqa.js";import"./use-blocklet-logo-CmMzePwG.js";import"./InfoOutlined-Bpx0eOkP.js";import"./dot-DGdAPqTT.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CiFFAdJf.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-eMGLd9qK.js";import"./base32-BwYE-4Kz.js";import"./MoreHoriz-B0f55Tf5.js";var Ye={},fs=Ot;Object.defineProperty(Ye,"__esModule",{value:!0});var Gt=Ye.default=void 0,gs=fs(_t()),hs=e;Gt=Ye.default=(0,gs.default)((0,hs.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 Ge=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)"})})})]})};Ge.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ge.displayName="person";const xs=Ge;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 Ce={},ys=t=>encodeURIComponent(t).replace(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),Jt="%[a-f0-9]{2}",kt=new RegExp("("+Jt+")|([^%]+?)","gi"),It=new RegExp("("+Jt+")+","gi");function qe(t,o){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;o=o||1;var c=t.slice(0,o),u=t.slice(o);return Array.prototype.concat.call([],qe(c),qe(u))}function vs(t){try{return decodeURIComponent(t)}catch{for(var o=t.match(kt)||[],c=1;c<o.length;c++)t=qe(o,c).join(""),o=t.match(kt)||[];return t}}function bs(t){for(var o={"%FE%FF":"��","%FF%FE":"��"},c=It.exec(t);c;){try{o[c[0]]=decodeURIComponent(c[0])}catch{var u=vs(c[0]);u!==c[0]&&(o[c[0]]=u)}c=It.exec(t)}o["%C2"]="�";for(var d=Object.keys(o),h=0;h<d.length;h++){var S=d[h];t=t.replace(new RegExp(S,"g"),o[S])}return t}var Cs=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 bs(t)}},js=(t,o)=>{if(!(typeof t=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(o==="")return[t];const c=t.indexOf(o);return c===-1?[t]:[t.slice(0,c),t.slice(c+o.length)]},Ss=function(t,o){for(var c={},u=Object.keys(t),d=Array.isArray(o),h=0;h<u.length;h++){var S=u[h],p=t[S];(d?o.indexOf(S)!==-1:o(S,p,t))&&(c[S]=p)}return c};(function(t){const o=ys,c=Cs,u=js,d=Ss,h=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(l,r)=>{const x=l.length;return r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[",x,"]"].join("")]:[...l,[g(s,n),"[",g(x,n),"]=",g(r,n)].join("")]};case"bracket":return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[]"].join("")]:[...l,[g(s,n),"[]=",g(r,n)].join("")];case"comma":case"separator":return s=>(l,r)=>r==null||r.length===0?l:l.length===0?[[g(s,n),"=",g(r,n)].join("")]:[[l,g(r,n)].join(n.arrayFormatSeparator)];default:return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,g(s,n)]:[...l,[g(s,n),"=",g(r,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(l,r,x)=>{if(s=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!s){x[l]=r;return}x[l]===void 0&&(x[l]={}),x[l][s[1]]=r};case"bracket":return(l,r,x)=>{if(s=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!s){x[l]=r;return}if(x[l]===void 0){x[l]=[r];return}x[l]=[].concat(x[l],r)};case"comma":case"separator":return(l,r,x)=>{const y=typeof r=="string"&&r.includes(n.arrayFormatSeparator),w=typeof r=="string"&&!y&&i(r,n).includes(n.arrayFormatSeparator);r=w?i(r,n):r;const _=y||w?r.split(n.arrayFormatSeparator).map(F=>i(F,n)):r===null?r:i(r,n);x[l]=_};default:return(l,r,x)=>{if(x[l]===void 0){x[l]=r;return}x[l]=[].concat(x[l],r)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(n,s){return s.encode?s.strict?o(n):encodeURIComponent(n):n}function i(n,s){return s.decode?c(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,l)=>Number(s)-Number(l)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const l=n.indexOf("#");return l!==-1&&(s=n.slice(l)),s}function a(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function I(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 l=p(s),r=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return r;for(const x of n.split("&")){if(x==="")continue;let[y,w]=u(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:i(w,s),l(i(y,s),w,r)}for(const x of Object.keys(r)){const y=r[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=I(y[w],s);else r[x]=I(y,s)}return s.sort===!1?r:(s.sort===!0?Object.keys(r).sort():Object.keys(r).sort(s.sort)).reduce((x,y)=>{const w=r[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=a,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 l=w=>s.skipNull&&h(n[w])||s.skipEmptyString&&n[w]==="",r=S(s),x={};for(const w of Object.keys(n))l(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const _=n[w];return _===void 0?"":_===null?g(w,s):Array.isArray(_)?_.reduce(r(w),[]).join("&"):g(w,s)+"="+g(_,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[l,r]=u(n,"#");return Object.assign({url:l.split("?")[0]||"",query:m(a(n),s)},s&&s.parseFragmentIdentifier&&r?{fragmentIdentifier:i(r,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const l=C(n.url).split("?")[0]||"",r=t.extract(n.url),x=t.parse(r,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let _=k(n.url);return n.fragmentIdentifier&&(_=`#${g(n.fragmentIdentifier,s)}`),`${l}${w}${_}`},t.pick=(n,s,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:r,query:x,fragmentIdentifier:y}=t.parseUrl(n,l);return t.stringifyUrl({url:r,query:d(x,s),fragmentIdentifier:y},l)},t.exclude=(n,s,l)=>{const r=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,r,l)}})(Ce);const le=yn,ws={parseNumbers:!1,parseBooleans:!1},Ps={skipNull:!1,skipEmptyString:!1},ks=(t,o)=>{var c,u;const{navigateMode:d="push",parseOptions:h,stringifyOptions:S}={},p=Object.assign(Object.assign({},ws),h),b=Object.assign(Object.assign({},Ps),S),g=le.useLocation(),i=(c=le.useHistory)===null||c===void 0?void 0:c.call(le),T=(u=le.useNavigate)===null||u===void 0?void 0:u.call(le),C=rs(),k=P.useRef(typeof t=="function"?t():t||{}),a=P.useMemo(()=>Ce.parse(g.search,p),[g.search]),I=P.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[I,Ve(n=>{const s=typeof n=="function"?n(I):n;C(),i&&i[d]({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},g.state),T&&T({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},{replace:d==="replace",state:g.state})})]},Is=ks,Ts=Ut,_e=En,Ue=On,Ds=ls,Tt={role:Ts.types.RoleType.ROLE_APPLICATION},As=(t,o,c,u)=>{let d=c||Tt;const h=(0,Ue.isEthereumType)((0,Ue.DidType)(c));if(h?d=(0,_e.WalletType)(c):d=(0,_e.WalletType)(Tt),!(0,Ue.isValid)(t)){let S="";try{return h?S=t.slice(0,66):S=t,(0,_e.fromSecretKey)(S,d)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!o)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ds.fromAppDid)(t,o,d,u||0)};var Rs=As,Xt=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const ce=Xt(Qn),Ls=Ut,ve=Xt(Rs),Es=Jn,Os=(t,o,{returnWallet:c=!0}={})=>{var F,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,ce.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:d=[]}=t,h=[...d,...u],S=h.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=h.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=h.find(D=>D.key==="BLOCKLET_APP_URL"),g=h.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:T}=t.meta,C=(0,Es.getDisplayName)(t),k=(0,ce.default)(S,"value",t.meta.description),a=(0,ce.default)(p,"value","auto"),I=(0,ce.default)(b,"value",""),m=(0,ce.default)(g,"value","");if(!c)return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=h.find(D=>D.key==="BLOCKLET_APP_SK"),s=h.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||h.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),l=h.find(D=>D.key==="BLOCKLET_APP_PSK");let r;s&&(s.value==="ethereum"||s.value==="eth")&&(r=s.value);let x=null,y=null;if(n&&n.value)x=(0,ve.default)(n.value,void 0,r),l&&l.value&&l.value!==n.value&&(y=(0,ve.default)(l.value,void 0,r));else{if(!o||typeof o!="string")throw new Error("Node secret key must be a string");s?x=(0,ve.default)(t.meta.did,o,r):x=(0,ve.default)(t.meta.did,o)}const w=((R=(F=t.settings)==null?void 0:F.session)==null?void 0:R.salt)||"",_=Ls.Hasher.SHA3.hash256(St.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>St.from(D))));return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:_,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ns=Os;const _s=vn(Ns);function Je({teamDid:t,roles:o,apps:c,onCancel:u,onSuccess:d,onError:h,endpoint:S}){var I;const{api:p}=q(),{t:b,locale:g}=V(),i=Ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:c.length>0?c[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!i.role){i.error=b("team.member.error.passportEmpty");return}const m=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:m,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:l}=await p.createMemberInvitation({input:s});i.inviteInfo=l,i.activeStep=1}catch(n){const s=te(n);i.error=s,h(n)}finally{i.loading=!1}},C=o.find(m=>m.name===i.role),a=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[c.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx($e,{children:b("common.sourceApp")}),e.jsx(We,{value:i.sourceAppPid,onChange:m=>{i.error=null,i.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,children:c.map(m=>e.jsx(je,{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(Nn,{did:m.appPid,size:28}),m.appName]}),e.jsx(_n,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx($e,{children:b("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:i.role,onChange:m=>{i.error=null,i.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:o.filter(m=>m.name!=="owner").map(m=>e.jsx(je,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Q,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Q,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((I=C==null?void 0:C.extra)==null?void 0:I.display)==="custom"&&e.jsx(me,{label:b("common.display"),type:"url",value:i.display,onChange:m=>{i.error=null,i.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(me,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:m=>{i.error=null,i.remark=m.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Kt,{value:i.passportExpireTime,onChange:m=>{i.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:T},{body:()=>{var n,s;const m=we({inviteId:(n=i.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=i.inviteInfo)==null?void 0:s.expireDate,g)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});os(m),Y.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:u}][i.activeStep];return e.jsxs(se,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!i.error&&e.jsx(oe,{severity:"error",variant:"icon",children:i.error})]})}Je.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};Je.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:o,onSuccess:c,onError:u,endpoint:d}){const{api:h,info:S}=q(),{api:p}=P.useContext(Un),[b,g]=P.useState(!1),{t:i,locale:T}=V(),[C,k]=P.useState(""),[a,I]=P.useState(!1),[m,n]=P.useState(0),[s,l]=P.useState(""),[r,x]=P.useState(""),y=!!ze(S,"ownerNft.did"),w=cs(async()=>{if(y){const{state:A}=await h.getDelegationState();return A}return{delegated:!0}});if(w.loading)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx(oe,{severity:"error",variant:"icon",children:te(w.error)})});const _=async()=>{k(null),g(!0);try{const{inviteInfo:A}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:r.trim()}});l(A),n(D.length-1)}catch(A){const H=te(A);k(H),u(A)}finally{g(!1)}},F=()=>{I(!0),n(1)},R=()=>{I(!1),n(0)},D=[{body:e.jsxs(Q,{component:"div",children:[e.jsxs(oe,{severity:"warning",children:[e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(oe,{severity:"warning",children:e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(me,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:r,onChange:A=>{k(null),x(A.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:o,onConfirm:y&&!ze(w,"value.delegated")?F:_},{body:()=>e.jsx(Bn,{action:"delegate-transfer-nft",open:a,locale:T,checkFn:p.get,onClose:R,onSuccess:_,checkTimeout:5*60*1e3,webWalletUrl:Xn(S),extraParams:{targetDID:S.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const A=we({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Us,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:A})]})},confirm:i("common.confirm"),onConfirm:c}],O=D[m];return e.jsxs(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(W,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(W,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(ie,{size:16}),O.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(oe,{severity:"error",variant:"icon",children:C})]})}Xe.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Xe.defaultProps={onError:()=>{},endpoint:""};const Us=z.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
`;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"})]})};et.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};et.displayName="forbid-login";const en=et;var tt=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)"})]})};tt.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};tt.displayName="allow-login";const tn=tt;function ke(t){const{passport:o,onDelete:c,...u}=t;return e.jsxs(Bs,{...u,children:[o.title||o.name," ",!!c&&e.jsx(Fn,{"data-cy":"delete-issuance",className:"delete",onClick:c})]})}ke.propTypes={passport:v.object.isRequired,onDelete:v.func};ke.defaultProps={onDelete:null};const Bs=z.span`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as Je,ce as Ke,bd as Ce,k as oe,r as Ae,bb as G,cf as xe,ar as ge,B as z,b_ as Ge,ab as Ze,cg as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-Bh011lgb.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-TMGmpw5W.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bt as U,bp as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-wlbruq2I.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-CATQui2x.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-CxrPpJZS.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-DZhGBW-J.js";import{S as ce}from"./switch-control-ByXecLFy.js";import{S as C}from"./section-Bb547IGJ.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-Dsf-Dx7V.js";import{b as xt}from"./base32-BwYE-4Kz.js";import{u as ft}from"./use-mobile-CXU9YBvX.js";import"./lottie-web-jYmAQWuC.js";const de={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({...de},((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(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),_.success(n("oauth.saveSuccess"))}catch(b){_.error(b.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;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:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={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({...ue},((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(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T: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(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{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($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={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({...me},((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(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T: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(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{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($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;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({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),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})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),_.success(n("oauth.saveSuccess"))}catch(R){_.error(R.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T: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(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{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(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{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(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{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(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{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($,{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]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)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,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(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(ie,{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(le,{})]}),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,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.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($e,{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:oe.SESSION_TTL,cacheTtl:oe.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 he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){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(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=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"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),_.success(l("common.configSuccess"))}catch(A){_.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{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:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{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(C,{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(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(U,{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:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{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($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
|
|
1
|
+
import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as Je,ce as Ke,bd as Ce,k as oe,r as Ae,bb as G,cf as xe,ar as ge,B as z,b_ as Ge,ab as Ze,cg as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-Bh011lgb.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-TMGmpw5W.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bt as U,bp as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-wlbruq2I.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-CATQui2x.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-CxrPpJZS.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-Rx6rf5TL.js";import{S as ce}from"./switch-control-ByXecLFy.js";import{S as C}from"./section-Bb547IGJ.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-Dsf-Dx7V.js";import{b as xt}from"./base32-BwYE-4Kz.js";import{u as ft}from"./use-mobile-CXU9YBvX.js";import"./lottie-web-jYmAQWuC.js";const de={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({...de},((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(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),_.success(n("oauth.saveSuccess"))}catch(b){_.error(b.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;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:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={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({...ue},((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(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T: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(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{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($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={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({...me},((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(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T: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(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{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($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;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({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),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})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),_.success(n("oauth.saveSuccess"))}catch(R){_.error(R.message||n("oauth.saveFailed"))}}),T=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(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T: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(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{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(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{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(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{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(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{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($,{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]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)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,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(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(ie,{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(le,{})]}),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,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.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($e,{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:oe.SESSION_TTL,cacheTtl:oe.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 he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){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(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=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"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),_.success(l("common.configSuccess"))}catch(A){_.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{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:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{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(C,{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(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(U,{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:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{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($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
|
|
2
2
|
max-width: 1536px;
|
|
3
3
|
|
|
4
4
|
.advanced-config {
|