@abtnode/blocklet-services 1.17.8 → 1.17.9
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/{Google-CG1lv5ol.js → Google-BpkBLSiL.js} +1 -1
- package/dist/assets/{access-control-CWoVUHgh.js → access-control-BIhY5wfd.js} +1 -1
- package/dist/assets/{actions-rfPaFLCj.js → actions-Cqfaor6G.js} +1 -1
- package/dist/assets/{add-component-core-D0UktG5E.js → add-component-core-B8HzULLJ.js} +1 -1
- package/dist/assets/{add-resource-B7lRLkA_.js → add-resource-CEddRkJz.js} +1 -1
- package/dist/assets/{advanced-ymKehsrI.js → advanced-DkQUAOtW.js} +1 -1
- package/dist/assets/{aigne-yDpeUg7z.js → aigne-BXMpb7iF.js} +1 -1
- package/dist/assets/{appearance-CG-6r2py.js → appearance-xmocGS9K.js} +1 -1
- package/dist/assets/{audit-logs-C-OsN7ub.js → audit-logs-BJPoC3sp.js} +1 -1
- package/dist/assets/{authorize-DjikDURs.js → authorize-CeTEulz5.js} +1 -1
- package/dist/assets/{base32-BFSrw7-h.js → base32-Cx5Qjcq5.js} +1 -1
- package/dist/assets/{bind-account-BVdU9BOU.js → bind-account-Dpc4iwR3.js} +1 -1
- package/dist/assets/{branding-D6MicIet.js → branding-Bz1ajNEX.js} +1 -1
- package/dist/assets/{branding-C42_zeHW.js → branding-OeU_TRNz.js} +1 -1
- package/dist/assets/{branding-CqLoLW7D.js → branding-vz6onXUa.js} +1 -1
- package/dist/assets/{bundle-avatar-7Wt_FbiF.js → bundle-avatar-CQ5BcuIS.js} +1 -1
- package/dist/assets/{complete-ziHMeIgC.js → complete-RloCU6Dp.js} +1 -1
- package/dist/assets/{component-Djqgi00F.js → component-Cjmzo-fv.js} +2 -2
- package/dist/assets/{config-Bko_B6fT.js → config-Bb4cFHRC.js} +1 -1
- package/dist/assets/{config-BQiW0tZA.js → config-CJmL1lNg.js} +1 -1
- package/dist/assets/{config-navigation-BwAXHqA4.js → config-navigation-CV6BVvIo.js} +2 -2
- package/dist/assets/{config-DtX2hGRq.js → config-rELfdDu6.js} +1 -1
- package/dist/assets/{config-space-DMk4apM9.js → config-space-CjtdFXkd.js} +1 -1
- package/dist/assets/{confirm-BMWka5pp.js → confirm-DhDNorbd.js} +1 -1
- package/dist/assets/{connect-D7P92kCs.js → connect-DrvWw6WK.js} +1 -1
- package/dist/assets/{connect-BP5XU00d.js → connect-J76vh4nC.js} +1 -1
- package/dist/assets/{connect-CzwZd1QL.js → connect-pvi_9C1U.js} +1 -1
- package/dist/assets/{connect-to-D5tNZXTo.js → connect-to-BRIhV6_s.js} +1 -1
- package/dist/assets/{dashboard-BZs_YRr4.js → dashboard-OrVG8J2E.js} +2 -2
- package/dist/assets/{delete-confirm-CwOFci6r.js → delete-confirm-C0N4quT9.js} +1 -1
- package/dist/assets/{domain-CvkFdrHE.js → domain-DRBQmuep.js} +1 -1
- package/dist/assets/{domain-action-card-D9LF4Rpy.js → domain-action-card-BXg1GQv4.js} +1 -1
- package/dist/assets/{domains-BeQB_OAv.js → domains-ClxiW6KS.js} +1 -1
- package/dist/assets/{email-DmH_Ukt2.js → email-QHwvdq0F.js} +1 -1
- package/dist/assets/engine-BmJsBu5Z.js +1 -0
- package/dist/assets/{exchange-passport-CidDSOuv.js → exchange-passport-_nLFQuN2.js} +1 -1
- package/dist/assets/{federated-detail-dialog-CkIKuPwA.js → federated-detail-dialog-B3FXukx8.js} +1 -1
- package/dist/assets/{form-DwiizKm1.js → form-BEZi0to4.js} +1 -1
- package/dist/assets/{fuel-D1KEpJ7m.js → fuel-D3ouL-7h.js} +1 -1
- package/dist/assets/{gen-access-key-rsAO4mAP.js → gen-access-key-DDpUJQ6-.js} +1 -1
- package/dist/assets/{gen-simple-access-key-DGcsvu3t.js → gen-simple-access-key-BTB-PYVK.js} +1 -1
- package/dist/assets/{get-safe-url-C1Ml6qBb.js → get-safe-url-uxJSMQTF.js} +1 -1
- package/dist/assets/{home-DKIZCHrI.js → home-BuvlMo1H.js} +1 -1
- package/dist/assets/{iframe-eNnbtEC_.js → iframe-CVEnFycA.js} +1 -1
- package/dist/assets/{index-DliNbpRr.js → index--yN2lwQm.js} +1 -1
- package/dist/assets/{index-BDz_o8O7.js → index-8APBdkv_.js} +1 -1
- package/dist/assets/{index-BVgxwS3B.js → index-BLYrVxV3.js} +1 -1
- package/dist/assets/{index-3rd8tEjJ.js → index-BLi7-52u.js} +1 -1
- package/dist/assets/{index-CPwDD0Vr.js → index-BaK_cJO7.js} +1 -1
- package/dist/assets/{index-B4YwAnux.js → index-Bz8EYhmA.js} +1 -1
- package/dist/assets/{index-DtobDjZ_.js → index-C0ZPC8OS.js} +1 -1
- package/dist/assets/{index-BjD8juw_.js → index-C2_MQP4T.js} +1 -1
- package/dist/assets/{index-BKqykGJ0.js → index-C2jYGrXX.js} +1 -1
- package/dist/assets/{index-ChjBQq8c.js → index-C9rUhDwd.js} +1 -1
- package/dist/assets/{index-fulV4VYn.js → index-CBR-Vn-z.js} +1 -1
- package/dist/assets/{index-BqN4XYa3.js → index-CEH7q22l.js} +1 -1
- package/dist/assets/{index-QkGGubJA.js → index-CNX69Q5e.js} +1 -1
- package/dist/assets/{index-qy92cIq_.js → index-CUa0qHck.js} +1 -1
- package/dist/assets/{index-DPBkkhMC.js → index-CZWagtq4.js} +1 -1
- package/dist/assets/{index-C_8V6Zdm.js → index-C_LVs1QE.js} +1 -1
- package/dist/assets/{index-CRVOCdMR.js → index-CbgqxO1V.js} +1 -1
- package/dist/assets/{index-BgdIPmn8.js → index-CeSwZI3Q.js} +1 -1
- package/dist/assets/{index-DOtXGGiB.js → index-CeaSaqPE.js} +1 -1
- package/dist/assets/{index-DcM4ljaV.js → index-CgSpL7jz.js} +4 -4
- package/dist/assets/{index-dA_JPQDw.js → index-CiGaRVW9.js} +1 -1
- package/dist/assets/{index-6ovPLp0y.js → index-D0mTUcjJ.js} +2 -2
- package/dist/assets/{index-BtpVtm9d.js → index-DI80KOep.js} +1 -1
- package/dist/assets/{index-EZZK7Nyo.js → index-DwaBdfGv.js} +3 -3
- package/dist/assets/{index-CEsBpdP3.js → index-DzOChX1R.js} +1 -1
- package/dist/assets/{index-rwBbhEdR.js → index-WAnZs-pf.js} +1 -1
- package/dist/assets/{index-DjpY9R14.js → index-_llkmI7F.js} +1 -1
- package/dist/assets/{index-t0K-45aJ.js → index-k0OLPTEM.js} +1 -1
- package/dist/assets/{info-outline-rounded-CxbBCZbx.js → info-outline-rounded-CmLwPXzn.js} +1 -1
- package/dist/assets/{invitation-tRY9vnXE.js → invitation-CcqRXA0x.js} +1 -1
- package/dist/assets/{invitations-Db5hitbJ.js → invitations-Rtn4ZgkA.js} +1 -1
- package/dist/assets/{invite-FhylBBBB.js → invite-BVCWrw1u.js} +1 -1
- package/dist/assets/{issue-passport-BMFNH3nj.js → issue-passport-D9KC0G_A.js} +1 -1
- package/dist/assets/{item-CHfrpFLz.js → item-Cno3GsuG.js} +1 -1
- package/dist/assets/{layout-ej-JNJCP.js → layout-DkUZePxy.js} +1 -1
- package/dist/assets/{list-CIMWgr08.js → list-BaZEqvv_.js} +1 -1
- package/dist/assets/{list-DX9meaEq.js → list-qpUoyhan.js} +1 -1
- package/dist/assets/{localization-DJF_aQrB.js → localization-VWhLouBc.js} +1 -1
- package/dist/assets/{log-C-XJlJmX.js → log-CGsJ5N6b.js} +1 -1
- package/dist/assets/{login-WWa0obto.js → login-BUZAiJi7.js} +1 -1
- package/dist/assets/{login-oauth-callback-558tm7Kk.js → login-oauth-callback-D7IVWJCK.js} +1 -1
- package/dist/assets/{logo-uploader-C_AnxhNP.js → logo-uploader-CEZXDf8O.js} +1 -1
- package/dist/assets/{lost-passport-DauVMfLO.js → lost-passport-BShdkOY2.js} +1 -1
- package/dist/assets/{metadata-CbEG9b2n.js → metadata-iEUnwzkK.js} +1 -1
- package/dist/assets/{open-window-hkynwoL5.js → open-window-CKutfNqx.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-CPLJV5KG.js → over-due-invoice-payment-D6491JHf.js} +1 -1
- package/dist/assets/{overview-JVbZ7hCB.js → overview-ns7CHx6H.js} +1 -1
- package/dist/assets/{passport-bxIQRuHM.js → passport-2AVRJTQK.js} +1 -1
- package/dist/assets/{passport-item-C7svpOMT.js → passport-item-CeYGFFGn.js} +1 -1
- package/dist/assets/{permission-CiRkLVwn.js → permission-C2bdzuoM.js} +1 -1
- package/dist/assets/{preferences-DgvuFkNS.js → preferences-Bm3lpvWM.js} +1 -1
- package/dist/assets/{profile-embed-DyHkusY5.js → profile-embed-CBiaNgfm.js} +1 -1
- package/dist/assets/{publish-resource-DqQSmKCy.js → publish-resource-Cb8cFftb.js} +1 -1
- package/dist/assets/{runtime-OuwOSzER.js → runtime-W3sVCToB.js} +1 -1
- package/dist/assets/sdk-CuoW9qgj.js +1 -0
- package/dist/assets/{security-DwWYfqfY.js → security-FuAWjgqg.js} +1 -1
- package/dist/assets/{session-D6Z4R7oi.js → session-BEf_KK-i.js} +1 -1
- package/dist/assets/{setup-N7vDP87_.js → setup-BUrG-d2H.js} +1 -1
- package/dist/assets/{spaces-B8t2gKsu.js → spaces-DiyZ082O.js} +1 -1
- package/dist/assets/{start-D0WlW7li.js → start-Rwj2OQ5m.js} +1 -1
- package/dist/assets/{starting-progress--6NzzPU1.js → starting-progress-s-XqSluO.js} +1 -1
- package/dist/assets/{status-DI89bjlc.js → status-CTDbw135.js} +1 -1
- package/dist/assets/{step-actions-D0ooBDiZ.js → step-actions-Ezqn_AMv.js} +1 -1
- package/dist/assets/{studio-fGrv4L1C.js → studio-CYIn9aNz.js} +1 -1
- package/dist/assets/{team-sypU8pIA.js → team-Bso_Sjaa.js} +1 -1
- package/dist/assets/{traffic-CB937Mlw.js → traffic-BqxYiIWh.js} +1 -1
- package/dist/assets/{transfer-C29v213E.js → transfer-OPn3RlKK.js} +1 -1
- package/dist/assets/{unsubscribe-D4mqt-ru.js → unsubscribe-CdltWhMv.js} +1 -1
- package/dist/assets/{use-app-logo-Dt5Rf_oh.js → use-app-logo-DcBQK--f.js} +1 -1
- package/dist/assets/{user-center-BNVLcFuw.js → user-center-Bc5-qHT9.js} +2 -2
- package/dist/assets/{user-follower-BF8dghPj.js → user-follower-D8zGIprF.js} +1 -1
- package/dist/assets/{util-BKm61knf.js → util-CIgNPQhV.js} +1 -1
- package/dist/assets/{util-C7ejGMZd.js → util-Cz5-V-1E.js} +1 -1
- package/dist/assets/{utils-yU0z64Pf.js → utils-CWRBZd9l.js} +1 -1
- package/dist/assets/{wait-connect-B1z3SEpN.js → wait-connect-2CirehkG.js} +1 -1
- package/dist/assets/{wallet-hidden-topbar-SQtOXLKg.js → wallet-hidden-topbar-CZaZNW94.js} +1 -1
- package/dist/assets/{wizard-components-Dxf0c0dt.js → wizard-components-BwA5watz.js} +1 -1
- package/dist/assets/{wizard-DwUESHQa.js → wizard-xTNgKfB7.js} +1 -1
- package/dist/assets/{wrap-locale-Ck3xud_e.js → wrap-locale-AxlzuLIu.js} +1 -1
- package/dist/assets/{zh-oZCQbfAf.js → zh-BYHnQ2ca.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +23 -23
- package/dist/assets/engine-CvxZhwAf.js +0 -1
- package/dist/assets/sdk-BDbUPswI.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a,G as M,T as _,c9 as L,R as W,ca as J,aW as Q,al as h,cb as X,aV as Y,aS as B,f as C,cc as Z,cd as K}from"./vendor-mui-core-CDEc-eG6.js";import{r as d,i as I,L as z,n as ee,o as ae}from"./vendor-react-DX7tU9aY.js";import{H as E}from"./index-
|
|
1
|
+
import{j as a,G as M,T as _,c9 as L,R as W,ca as J,aW as Q,al as h,cb as X,aV as Y,aS as B,f as C,cc as Z,cd as K}from"./vendor-mui-core-CDEc-eG6.js";import{r as d,i as I,L as z,n as ee,o as ae}from"./vendor-react-DX7tU9aY.js";import{H as E}from"./index-CgSpL7jz.js";import{g as te}from"./vendor-hooks-Ca2cSNuD.js";import{M as ie,l as m,bI as S,bJ as A}from"./vendor-ux-PO0jFgJf.js";import{z as re}from"./vendor-arcblock-BVQTtbN-.js";import{G as oe}from"./nav-menu-CFJ8S6L5.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(ie,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
|
|
2
2
|
position: relative;
|
|
3
3
|
.badge-point {
|
|
4
4
|
position: absolute;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrCTi6nm.css"),window.__toCdnUrl("assets/index-_3Fxot8G.css")])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as k,u as Et,m as nt,L as ve,g as go,i as zs,k as Bs,l as ft}from"./vendor-react-DX7tU9aY.js";import{L as We,j as e,al as a,aY as $t,X as n,an as xe,I as ce,d5 as Os,d6 as Ns,cs as ko,cu as lt,T as L,d7 as Ws,bo as Vs,s as jo,cp as yo,d8 as _s,d9 as Ms,Z as it,aT as Ce,aS as Us,da as Fs,a6 as Ge,b4 as ct,cC as qt,cR as Hs,bR as Gs,bK as Fe,bW as Js,bI as tt,R as J,a7 as Te,cG as Xs,Q as wo,N as vo,P as At,aj as Co,p as Ro,M as be,a4 as Ys,b1 as So,a0 as To,c3 as Zs,C as Xe,aH as Ks,S as Io,A as re,b3 as Se,db as Xt,bB as ot,dc as Do,W as Eo,U as Lt,aN as $o,cn as Qs,G as qo,cU as er,aO as tr,aP as or,cV as sr,cW as rr,bk as Ao,ar as nr,dd as lr,a2 as Lo,a1 as st,cX as Yt,bh as ir,bi as cr,de as ar,df as dr,bN as Ct,z as ur,F as pr,bJ as hr,bL as xt}from"./vendor-mui-core-CDEc-eG6.js";import{W as ge,X as je,V as De,w as mr,bL as le,F as me,bG as br,j as fr,n as Zt,bM as xr,bN as gr,ad as Kt,bB as kr,bO as jr,bP as yr,bQ as wr}from"./index-
|
|
2
|
+
import{r as k,u as Et,m as nt,L as ve,g as go,i as zs,k as Bs,l as ft}from"./vendor-react-DX7tU9aY.js";import{L as We,j as e,al as a,aY as $t,X as n,an as xe,I as ce,d5 as Os,d6 as Ns,cs as ko,cu as lt,T as L,d7 as Ws,bo as Vs,s as jo,cp as yo,d8 as _s,d9 as Ms,Z as it,aT as Ce,aS as Us,da as Fs,a6 as Ge,b4 as ct,cC as qt,cR as Hs,bR as Gs,bK as Fe,bW as Js,bI as tt,R as J,a7 as Te,cG as Xs,Q as wo,N as vo,P as At,aj as Co,p as Ro,M as be,a4 as Ys,b1 as So,a0 as To,c3 as Zs,C as Xe,aH as Ks,S as Io,A as re,b3 as Se,db as Xt,bB as ot,dc as Do,W as Eo,U as Lt,aN as $o,cn as Qs,G as qo,cU as er,aO as tr,aP as or,cV as sr,cW as rr,bk as Ao,ar as nr,dd as lr,a2 as Lo,a1 as st,cX as Yt,bh as ir,bi as cr,de as ar,df as dr,bN as Ct,z as ur,F as pr,bJ as hr,bL as xt}from"./vendor-mui-core-CDEc-eG6.js";import{W as ge,X as je,V as De,w as mr,bL as le,F as me,bG as br,j as fr,n as Zt,bM as xr,bN as gr,ad as Kt,bB as kr,bO as jr,bP as yr,bQ as wr}from"./index-CgSpL7jz.js";import{v as vr,y as ue,x as Pt,D as Po,p as Cr}from"./vendor-utils-_C9URqjS.js";import{aa as G,bS as zo,W as Rr,bk as Le,bp as Bo,bA as Oo,ce as Sr,b3 as zt,a3 as O,cd as Bt,cf as Ot,ab as ae,J as No,aD as Ne,b1 as at,br as Wo}from"./vendor-ux-PO0jFgJf.js";import{C as dt}from"./confirm-DhDNorbd.js";import{u as Ve}from"./session-BEf_KK-i.js";import{W as Rt}from"./did-address-BNKX5oDP.js";import{E as Ye}from"./empty-spinner-2fS4Uw6Z.js";import{B as Nt}from"./bundle-avatar-CQ5BcuIS.js";import{S as Ie}from"./shorten-label-CEQFm35C.js";import{L as Wt}from"./list-header-BKicL0iB.js";import{C as Vo}from"./click-to-copy-BmatCVrP.js";import{t as Qt}from"./question-mark-circle.svg-B0bcUgC5.js";import{w as Tr,b as Ir}from"./vendor-hooks-Ca2cSNuD.js";import{u as He}from"./useSetState-CUbypYGT.js";import{e as Dr}from"./engine-BmJsBu5Z.js";import"./api-Bo6lutcq.js";import{T as Er,S as $r}from"./vendor-mui-x-Bk3pxGrO.js";import{D as eo,C as to,P as oo}from"./react-beautiful-dnd.esm-C9wbL7D6.js";import{u as _o,a as qr,b as Ar,d as Lr,e as Pr}from"./wait-connect-2CirehkG.js";import{f as ke}from"./index-DBs9Ljax.js";import{c as zr,A as Mo,S as Br,U as Or,r as Nr}from"./item-Cno3GsuG.js";import{D as Wr}from"./delete-confirm-C0N4quT9.js";import{g as Uo}from"./get-safe-url-uxJSMQTF.js";import{u as Ae}from"./index-BObu-fIz.js";import{M as Vr}from"./index-B0cxyMBd.js";import{p as _r}from"./purify.es-HRjpPm7y.js";import{r as Mr}from"./index-BUN3g9UB.js";import"./vendor-arcblock-BVQTtbN-.js";import"./raf-schd.esm-BZ-2sjAE.js";function Vt({did:t,projectId:o,title:s,logo:r,describe:l}){const i=`${`${ge}/api/project/${t}/${o}/logo/upload`}/${r}`,[d,u]=k.useState(!1),x=We(p=>p.breakpoints.down("md"));return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",color:d?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Ie,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:s||"/"}),e.jsx(Ie,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||d?"primary.main":"grey.700"},children:l||"/"})]})]})}Vt.propTypes={projectId:n.string.isRequired,did:n.string.isRequired,title:n.string.isRequired,logo:n.string.isRequired,describe:n.string.isRequired};function Fo({initUrl:t=null}){const o=Et(),s=t?.searchParams.get("tenantScope")||"",{t:r,locale:l}=G(),{api:c}=je(),{api:i}=Ve(),[d,u]=k.useState(!0),{blocklet:x}=De(),[p,m]=k.useState(null),[f,b]=k.useState(!1),h=We(E=>E.breakpoints.down("xl")),j=We(E=>E.breakpoints.down("md")),{componentDid:v=""}=nt(),[g,C]=k.useState(null),I=`publish-${x.meta.did}`,R=zo(I),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),N=()=>{c.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const D=E?.projects||[];u(!1),C(D)}).catch(E=>{u(!1),O.error(E.message)})},z=()=>{o(`${le}/create/none/0.0.0`,{replace:!0})},W=E=>{m(E)},X=()=>{u(!1),b(!0)},$=()=>{b(!1),m(null)},A=E=>{O.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){O.error("Delete project failed");return}N(),b(!1),m(null)};k.useEffect(()=>{N()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=Rr(E).toLocaleLowerCase(),g.filter(D=>D.blockletTitle.toLowerCase().includes(E)||D.blockletDid.toLowerCase().includes(E))):g},[g,y.searchText]);if(!g&&d)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Ye,{})});if(!g)return null;if(!g.length)return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Le,{onClick:z,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const Z=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const D=g[E];return e.jsx(ve,{to:`${D.id}`,children:e.jsx(Vt,{did:x.meta.did,projectId:D.id,logo:D.blockletLogo,title:D.blockletTitle,describe:D.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(Bo,{type:"success",children:E}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:E=>E?e.jsx(Rt,{size:14,compact:!0,responsive:!1,did:E}):null}},h||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Rt,{onClick:()=>{o(`${ge}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const D=(x.children||[]).find(_=>_.meta.did===E);return D?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(Nt,{size:14,blocklet:D,ancestors:[x]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:D.meta.title})]},E):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ie,{children:E})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(Oo,{value:Number(E),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const D=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(ve,{to:`${D.id}/new-release/none/${D.lastReleaseId}`,children:e.jsx(xe,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Os,{style:{fontSize:18}})})})}),!!D.lastReleaseId&&e.jsx(xe,{title:r("blocklet.publish.viewLastRelease",{name:D.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(ve,{style:{display:"flex"},to:`${D.id}/view/${D.lastReleaseId}/${D.blockletVersion}`,children:e.jsx(Ns,{sx:{fontSize:18}})})})}),e.jsx(xe,{title:r("blocklet.publish.delete",{name:D.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>W(D),children:e.jsx(ko,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),F=({page:E,rowsPerPage:D,searchText:_})=>{y.pageSize!==D?T(M=>({...M,searchText:"",pageSize:D,page:1})):y.page!==E+1?T(M=>({...M,searchText:"",page:E+1})):y.searchText!==_&&T(M=>({...M,searchText:_,page:1}))},K=f?e.jsx(mr,{open:!0,popup:!0,onClose:$,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:300*1e3,onSuccess:w,onError:A,extraParams:{projectId:p.id,did:x.meta.did,name:p.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ur,{children:[e.jsx(Wt,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs(L,{variant:"h4",children:[r("common.blocklets")," (",S.length,")"]}),e.jsx(xe,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Ws,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Sr,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(D=>({...D,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Le,{onClick:z,variant:"contained",children:[e.jsx(lt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(zt,{className:"main-table",locale:l,data:S,columns:Z,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:I,onChange:F}),p&&e.jsx(dt,{title:`${r("common.delete")} ${p.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:X,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Vs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),K]})}const Ur=jo(a)`
|
|
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 k,u as Et,m as nt,L as ve,g as go,i as zs,k as Bs,l as ft}from"./ven
|
|
|
142
142
|
background: #fff;
|
|
143
143
|
z-index: 10;
|
|
144
144
|
}
|
|
145
|
-
`,ao="lastWantToConnectStoreId";function ln(t){const[o,s]=k.useState(null),{session:r}=Ve(),l=k.useCallback(d=>{s(d),localStorage.setItem(ao,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(ao),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==gr.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const _t=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Cr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function os({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=G(),{session:u}=Ve(),{api:x,info:p,inService:m}=je(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,I]=k.useState(null),R=A=>{s(A),h(!1)},y=()=>{h(!b)},T=A=>{j.current&&j.current.contains(A.target)||h(!1)},N=()=>{g(!0)},z=()=>{g(!1)},W=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(A){O.error(`Remove Blocklet Store Error: ${ke(A)}`)}finally{I(null)}},{storeList:X}=_t({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),$=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(J,{onClick:r,children:[c&&e.jsx(Te,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(J,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Xs,{})})]}),e.jsx(wo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:A})=>e.jsx(vo,{...A,style:{transformOrigin:"center top"},children:e.jsx(At,{children:e.jsx(Co,{onClickAway:T,children:e.jsxs(Ro,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[X?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Ie,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Ie,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),zr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),I(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Ys,{}),e.jsxs(be,{onClick:N,children:[e.jsx(lt,{font:!0}),e.jsx(L,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Mo,{hiddenChildren:!0,open:!0,onClose:z,teamDid:$,storeList:X,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(dt,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:W,onCancel:()=>I(null)})]})}os.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const ss=(t,o,s)=>{const r=`${ge}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${ge}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${ge}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},cn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Mt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=G(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||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://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&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(i){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(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{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(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Mt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function rs({setParams:t,onClose:o,params:s}){const{t:r}=G(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=cn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(it,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(So,{children:r("studio.videoDialogTitle")}),e.jsxs(To,{children:[e.jsx(Zs,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(Xe,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ks,{})})}):null,error:i}),i&&e.jsx(L,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Mt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Io,{children:[e.jsx(J,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(J,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}rs.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function St({errors:t,storeList:o,...s}){const{t:r}=G();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx(L,{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(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(xe,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}St.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const uo=k.lazy(()=>No(()=>import("./index-6ovPLp0y.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function ns({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=G(),{api:v}=je(),g=Et(),C=k.useRef(null),I=k.useRef(null),[R,y]=ln(r),[T,N]=k.useState(!1),z=_o({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),W=async P=>{const Y=setTimeout(()=>{x(!1)},2e4),H=await Ar(v,P);x(!1),clearTimeout(Y),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${le}/create`,`${H}/create`),{replace:!0})},X=()=>{if(!l.blockletTitle){O.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){O.error(h("blocklet.publish.noStoreSelected"));return}const P=qr();z(async(Y,H)=>{try{const oe=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:P,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!oe?.url){O.error("failed to connect to store");return}H(oe.url),W({did:r?.meta?.did,projectId:"",messageId:P})}catch(oe){const de=ke(oe);O.error(de),x(!1)}})},{logoUrl:$,screenshotUrls:A,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ss(l,r,t),{logoErrors:Z,screenshotErrors:F,storeList:K,hasLogoWarning:E,hasScreenshotWarning:D}=u,_=()=>o?!1:!t||t===le?(O.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,M=P=>{if(!P.destination)return;const Y=Array.from(l.blockletScreenshots),[H]=Y.splice(P.source.index,1);Y.splice(P.destination.index,0,H),c(oe=>({...oe,blockletScreenshots:Y}))},Q=P=>{if(!P.destination)return;const Y=Array.from(l.blockletVideos),[H]=Y.splice(P.source.index,1);Y.splice(P.destination.index,0,H),c(oe=>({...oe,blockletVideos:Y}))};return e.jsxs(an,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:P=>{d({blockletTitle:""}),c({blockletTitle:P.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===le?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===le&&e.jsx(Xe,{position:"end",children:e.jsx(os,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:X})})}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:P=>{d({blockletDescription:""}),c({blockletDescription:P.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:P.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:P.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(P.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:P.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:P=>{P.target.value&&!/^(git|https|svn)/.test(P.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:P.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Se,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||$,onClick:()=>{_()&&C.current?.open()}})})]}),E&&e.jsx(St,{errors:Z,storeList:K,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Se,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(eo,{onDragEnd:o?void 0:M,children:e.jsx(to,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(P,Y)=>e.jsxs(a,{ref:P.innerRef,...P.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[A.map((H,oe)=>e.jsx(oo,{draggableId:H,index:oe,isDragDisabled:o,children:(de,ne)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:ne.isDragging?"scale(1.05)":"none",boxShadow:ne.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:H}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(oe,1),{...pe,blockletScreenshots:he}})},children:e.jsx(ot,{})})]})},H)),P.placeholder,A.length<5&&e.jsx(a,{onClick:()=>{_()&&I.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),D&&e.jsx(St,{errors:F,storeList:K}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Se,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{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(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(eo,{onDragEnd:o?void 0:Q,children:e.jsx(to,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(P,Y)=>e.jsxs(a,{ref:P.innerRef,...P.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((H,oe)=>e.jsx(oo,{draggableId:H,index:oe,isDragDisabled:o,children:(de,ne)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:ne.isDragging?"scale(1.05)":"none",boxShadow:ne.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Mt,{url:H,style:{pointerEvents:ne.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(oe,1),{...pe,blockletVideos:he}})},children:e.jsx(ot,{})})]})},H)),P.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{_()&&N(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Ye,{}),children:[e.jsx(uo,{ref:C,locale:j,popup:!0,onUploadFinish:P=>{c({blockletLogo:P.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,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"),T&&e.jsx(rs,{onClose:()=>N(!1),params:l,setParams:c}),e.jsx(uo,{ref:I,locale:j,popup:!0,onUploadFinish:P=>{c(Y=>{const H=Y.blockletScreenshots||[];return H.push(P.data?.filename),{...Y,blockletScreenshots:H}}),I.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-A.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")]})]})}ns.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const an=Ce.div`
|
|
145
|
+
`,ao="lastWantToConnectStoreId";function ln(t){const[o,s]=k.useState(null),{session:r}=Ve(),l=k.useCallback(d=>{s(d),localStorage.setItem(ao,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(ao),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==gr.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const _t=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Cr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function os({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=G(),{session:u}=Ve(),{api:x,info:p,inService:m}=je(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,I]=k.useState(null),R=A=>{s(A),h(!1)},y=()=>{h(!b)},T=A=>{j.current&&j.current.contains(A.target)||h(!1)},N=()=>{g(!0)},z=()=>{g(!1)},W=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(A){O.error(`Remove Blocklet Store Error: ${ke(A)}`)}finally{I(null)}},{storeList:X}=_t({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),$=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(J,{onClick:r,children:[c&&e.jsx(Te,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(J,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Xs,{})})]}),e.jsx(wo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:A})=>e.jsx(vo,{...A,style:{transformOrigin:"center top"},children:e.jsx(At,{children:e.jsx(Co,{onClickAway:T,children:e.jsxs(Ro,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[X?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Ie,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Ie,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),zr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),I(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Ys,{}),e.jsxs(be,{onClick:N,children:[e.jsx(lt,{font:!0}),e.jsx(L,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Mo,{hiddenChildren:!0,open:!0,onClose:z,teamDid:$,storeList:X,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(dt,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:W,onCancel:()=>I(null)})]})}os.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const ss=(t,o,s)=>{const r=`${ge}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${ge}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${ge}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},cn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Mt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=G(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||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://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&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(i){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(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{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(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Mt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function rs({setParams:t,onClose:o,params:s}){const{t:r}=G(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=cn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(it,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(So,{children:r("studio.videoDialogTitle")}),e.jsxs(To,{children:[e.jsx(Zs,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(Xe,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ks,{})})}):null,error:i}),i&&e.jsx(L,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Mt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Io,{children:[e.jsx(J,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(J,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}rs.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function St({errors:t,storeList:o,...s}){const{t:r}=G();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx(L,{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(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(xe,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}St.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const uo=k.lazy(()=>No(()=>import("./index-D0mTUcjJ.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function ns({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=G(),{api:v}=je(),g=Et(),C=k.useRef(null),I=k.useRef(null),[R,y]=ln(r),[T,N]=k.useState(!1),z=_o({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),W=async P=>{const Y=setTimeout(()=>{x(!1)},2e4),H=await Ar(v,P);x(!1),clearTimeout(Y),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${le}/create`,`${H}/create`),{replace:!0})},X=()=>{if(!l.blockletTitle){O.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){O.error(h("blocklet.publish.noStoreSelected"));return}const P=qr();z(async(Y,H)=>{try{const oe=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:P,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!oe?.url){O.error("failed to connect to store");return}H(oe.url),W({did:r?.meta?.did,projectId:"",messageId:P})}catch(oe){const de=ke(oe);O.error(de),x(!1)}})},{logoUrl:$,screenshotUrls:A,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ss(l,r,t),{logoErrors:Z,screenshotErrors:F,storeList:K,hasLogoWarning:E,hasScreenshotWarning:D}=u,_=()=>o?!1:!t||t===le?(O.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,M=P=>{if(!P.destination)return;const Y=Array.from(l.blockletScreenshots),[H]=Y.splice(P.source.index,1);Y.splice(P.destination.index,0,H),c(oe=>({...oe,blockletScreenshots:Y}))},Q=P=>{if(!P.destination)return;const Y=Array.from(l.blockletVideos),[H]=Y.splice(P.source.index,1);Y.splice(P.destination.index,0,H),c(oe=>({...oe,blockletVideos:Y}))};return e.jsxs(an,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:P=>{d({blockletTitle:""}),c({blockletTitle:P.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===le?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===le&&e.jsx(Xe,{position:"end",children:e.jsx(os,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:X})})}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:P=>{d({blockletDescription:""}),c({blockletDescription:P.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:P.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:P.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(P.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:P.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:P=>{P.target.value&&!/^(git|https|svn)/.test(P.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:P.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Se,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||$,onClick:()=>{_()&&C.current?.open()}})})]}),E&&e.jsx(St,{errors:Z,storeList:K,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Se,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(eo,{onDragEnd:o?void 0:M,children:e.jsx(to,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(P,Y)=>e.jsxs(a,{ref:P.innerRef,...P.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[A.map((H,oe)=>e.jsx(oo,{draggableId:H,index:oe,isDragDisabled:o,children:(de,ne)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:ne.isDragging?"scale(1.05)":"none",boxShadow:ne.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:H}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(oe,1),{...pe,blockletScreenshots:he}})},children:e.jsx(ot,{})})]})},H)),P.placeholder,A.length<5&&e.jsx(a,{onClick:()=>{_()&&I.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),D&&e.jsx(St,{errors:F,storeList:K}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Se,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{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(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(eo,{onDragEnd:o?void 0:Q,children:e.jsx(to,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(P,Y)=>e.jsxs(a,{ref:P.innerRef,...P.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((H,oe)=>e.jsx(oo,{draggableId:H,index:oe,isDragDisabled:o,children:(de,ne)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:ne.isDragging?"scale(1.05)":"none",boxShadow:ne.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Mt,{url:H,style:{pointerEvents:ne.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(oe,1),{...pe,blockletVideos:he}})},children:e.jsx(ot,{})})]})},H)),P.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{_()&&N(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Ye,{}),children:[e.jsx(uo,{ref:C,locale:j,popup:!0,onUploadFinish:P=>{c({blockletLogo:P.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,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"),T&&e.jsx(rs,{onClose:()=>N(!1),params:l,setParams:c}),e.jsx(uo,{ref:I,locale:j,popup:!0,onUploadFinish:P=>{c(Y=>{const H=Y.blockletScreenshots||[];return H.push(P.data?.filename),{...Y,blockletScreenshots:H}}),I.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-A.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")]})]})}ns.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const an=Ce.div`
|
|
146
146
|
margin-top: 24px;
|
|
147
147
|
.screenshot {
|
|
148
148
|
margin-bottom: 16px;
|
|
@@ -190,7 +190,7 @@ import{r as k,u as Et,m as nt,L as ve,g as go,i as zs,k as Bs,l as ft}from"./ven
|
|
|
190
190
|
padding-bottom: 12px;
|
|
191
191
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
192
192
|
}
|
|
193
|
-
`;function xs({text:t}){const{palette:o}=qo();return t?e.jsx(Vr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:_r.sanitize(t),rehypePlugins:[[Mr,{target:"_blank"}]]}):e.jsx(Je,{Icon:Ot})}xs.propTypes={text:n.string.isRequired};function gs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=G(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(L,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Lo,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(st,{value:"write",label:"Write"}),e.jsx(st,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(re,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(Xe,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(xs,{text:t.blockletIntroduction||""})})]})}gs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function ks({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Ao,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Yt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Yt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}ks.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function js({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=G(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||ls({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(ir,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!mn({params:l,projectId:x,step:v,t:p}),I=c?"":b(v);return I&&(g.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:I}),g.error=!0),e.jsxs(cr,{children:[e.jsx(ar,{icon:e.jsx(ks,{error:I,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:I?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:I||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(dr,{children:[e.jsx(L,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(J,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:I||!C,children:p("common.continue")}),v>0&&e.jsx(J,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(At,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}js.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const fn=[".zip",".gz"],xn=1024*1024*100,gn=k.lazy(()=>No(()=>import("./index-6ovPLp0y.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function ys({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=G(),x=k.useRef(null),p=()=>s?!1:!o||o===le?(O.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${ge}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(L,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(J,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Ye,{}),children:e.jsx(gn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:fn,maxFileSize:xn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ys.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function It({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=G();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(re,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Xe,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}It.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function ws(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&ws(t[o]);return t}var kn=Nr();const ee=go(kn),jn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},yn={"--volume":!0,"--publish":!0},wn=new Set(["--publish","--volume"]),vs=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function vn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!vs(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function Cn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function mo(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=jn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(wn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:Cn(vn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function Rn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
|
|
193
|
+
`;function xs({text:t}){const{palette:o}=qo();return t?e.jsx(Vr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:_r.sanitize(t),rehypePlugins:[[Mr,{target:"_blank"}]]}):e.jsx(Je,{Icon:Ot})}xs.propTypes={text:n.string.isRequired};function gs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=G(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(L,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Lo,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(st,{value:"write",label:"Write"}),e.jsx(st,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(re,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(Xe,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(xs,{text:t.blockletIntroduction||""})})]})}gs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function ks({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Ao,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Yt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Yt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}ks.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function js({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=G(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||ls({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(ir,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!mn({params:l,projectId:x,step:v,t:p}),I=c?"":b(v);return I&&(g.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:I}),g.error=!0),e.jsxs(cr,{children:[e.jsx(ar,{icon:e.jsx(ks,{error:I,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:I?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:I||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(dr,{children:[e.jsx(L,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(J,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:I||!C,children:p("common.continue")}),v>0&&e.jsx(J,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(At,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}js.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const fn=[".zip",".gz"],xn=1024*1024*100,gn=k.lazy(()=>No(()=>import("./index-D0mTUcjJ.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function ys({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=G(),x=k.useRef(null),p=()=>s?!1:!o||o===le?(O.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${ge}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(L,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(J,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Ye,{}),children:e.jsx(gn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:fn,maxFileSize:xn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ys.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function It({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=G();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(re,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Xe,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}It.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function ws(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&ws(t[o]);return t}var kn=Nr();const ee=go(kn),jn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},yn={"--volume":!0,"--publish":!0},wn=new Set(["--publish","--volume"]),vs=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function vn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!vs(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function Cn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function mo(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=jn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(wn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:Cn(vn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function Rn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
|
|
194
194
|
`)}const Cs={"--volume":t=>{const[o]=t.split(":");return o?vs(t)&&!t.startsWith("$BLOCKLET_APP_DIR/")&&!t.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":t.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},et=t=>t.replace(/^[-]+/,"").replace(/-([a-z])/g,(r,l)=>l.toUpperCase()),Sn=t=>`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`,Tn=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],In=["rm ","sudo "];function Rs(t){if(t==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(t))throw new Error("Docker CMD is invalid");const s=t.toLocaleLowerCase();if(In.some(l=>s.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(Tn.some(l=>t.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(t))throw new Error("Docker CMD is invalid")}const Dn=Array.from(new Set(Object.keys(Ut).map(et))),En=["publish","volume"];ee.object({workdir:ee.string().trim().optional(),image:ee.string().trim().regex(/^[^\s]+$/).optional(),shell:ee.string().trim().optional(),volumes:ee.array().items(ee.string().trim()).optional(),script:ee.string().trim().optional(),installNodeModules:ee.boolean().optional(),skipWrapDockerfile:ee.boolean().optional(),tmpfs:ee.string().trim().optional(),command:ee.string().allow("").default("").optional().custom((t,o)=>{try{return Rs(t),t}catch(s){return o.error("any.invalid",{message:s.message})}},"Docker CMD validation"),runBaseScript:ee.boolean().optional(),...Dn.reduce((t,o)=>{const s=Cs[Sn(o)];return En.includes(o)?(t[o]=ee.array().items(ee.string().trim()).optional(),s?t[o]=ee.array().items(ee.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r})).optional():t[o]=ee.array().items(ee.string().trim()).optional(),t):(s?t[o]=ee.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r}).optional():t[o]=ee.string().trim().optional(),t)},{})}).optional();function Dt({index:t,item:o,dockerParams:s,setDockerParams:r,dataKey:l,t:c,readOnly:i}){const d=o?.value||"",[u,x]=k.useState(!1),p=()=>{s[l]?.splice(t,1),r({...s,[l]:[...s[l]]})},m=($,A)=>{s[l]?.[t]&&(A?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${et(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),r({...s,[l]:[...s[l]]})},f=($,A)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],secure:A,value:A&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},b=($,A)=>{s[l][t]={...s[l][t],shared:A},r({...s,[l]:[...s[l]]})},h=($,A)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],required:A,value:A&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},j=($,A)=>{s[l][t]={...s[l][t],value:A?me.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...s,[l]:[...s[l]]})},v=$=>{s[l][t]={...s[l][t],description:$.target.value},r({...s,[l]:[...s[l]]})},g=$=>{const A=$.target.value==="web"?"web":"docker";A==="web"&&s.dockerArgs.forEach(Z=>{Z.type="docker"});const S=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:A,path:A==="docker"?S:"/",protocol:"http",prefix:A==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...s,dockerArgs:[...s.dockerArgs]})},C=$=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:$.target.value==="direct"?"direct":"service"},r({...s,dockerArgs:[...s.dockerArgs]})},I=$=>{const A=$.target.value;s[l][t]={...s[l][t],prefix:A,path:A==="*"?"/":A},r({...s,[l]:[...s[l]]})},R=$=>{s[l]?.[t]&&(s[l][t].value=$.target.value),r({...s,[l]:[...s[l]]})},y=d===`$${et(o.key)}`||o.custom,T=l==="dockerArgs"&&!Ut[o.key],N=yn[o.key],z=l==="dockerEnvs",W=o.key==="--publish";let X=o.key;return W&&o.type==="web"?X="--publish (Web)":z&&(X=`--env ${o.key}`),e.jsxs(a,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(a,{sx:{width:250},children:e.jsx(L,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:X})}),e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(re,{disabled:i||y||T||o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:y?`$${et(o.key)}`:d,sx:{flex:1},error:T,onChange:R,slotProps:{input:{endAdornment:e.jsxs(Xe,{position:"end",sx:{zoom:.9},children:[(!(N||T)||z||W)&&e.jsx(ce,{onClick:()=>x(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!i&&e.jsx(ce,{onClick:p,color:T?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})}}}),T&&e.jsx(L,{variant:"caption",color:"error",children:c("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",sx:{color:"text.secondary"},children:c("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Cs[o.key](d)&&e.jsx(L,{variant:"caption",color:"error",children:c("blocklet.publish.docker.volumeTips")})]}),u&&e.jsx(at,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:c(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[N||T||z?null:e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:c("blocklet.publish.docker.needCustomInput")}),e.jsx(Ae,{disabled:i,checked:y,onChange:m,sx:{zoom:.9}})]}),z&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:c("blocklet.publish.docker.shared")}),e.jsx(Ae,{disabled:i,checked:o.shared,onChange:b,sx:{zoom:.9}})]}),z&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:c("blocklet.publish.docker.required")}),e.jsx(Ae,{disabled:i,checked:o.required,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:c("blocklet.publish.docker.secure")}),e.jsx(Ae,{disabled:i,checked:o.secure,onChange:f,sx:{zoom:.9}})]}),z&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:c("blocklet.publish.docker.autoGenerated")}),e.jsx(Ae,{disabled:i,checked:o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:c("blocklet.publish.docker.description")}),e.jsx(re,{disabled:i,value:o.description,onChange:v,sx:{flex:1},label:c("blocklet.publish.docker.description")})]}),W&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:c("blocklet.publish.docker.portType")}),e.jsxs(Ct,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),W&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:c("blocklet.publish.docker.proxyBehavior")}),e.jsxs(Ct,{value:o.proxyBehavior||"service",onChange:C,children:[e.jsx(be,{value:"service",children:c("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:c("blocklet.publish.docker.directProxy")})]})]}),W&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:c("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:i,value:o.prefix,onChange:I,sx:{flex:1},label:c("blocklet.publish.docker.prefix")})]})]})})]})}Dt.propTypes={dockerParams:n.object.isRequired,setDockerParams:n.func.isRequired,dataKey:n.string.isRequired,item:n.object.isRequired,t:n.func.isRequired,readOnly:n.bool.isRequired,index:n.number.isRequired};const $n=`
|
|
195
195
|
docker run --name postgrest
|
|
196
196
|
-p 3000:3000
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aa as $,a3 as A,ab as de,bT as ve,dv as ft,dw as jt,bj as pe,aF as U,b1 as we,bk as _,aj as Y,dx as bt,dy as vt,bq as yt,dz as kt,b3 as St,br as We}from"./vendor-ux-PO0jFgJf.js";import{b as x,a as se,h as wt,i as ye,f as Lt}from"./vendor-hooks-Ca2cSNuD.js";import{r as C,L as Ct}from"./vendor-react-DX7tU9aY.js";import{j as e,al as m,z as H,A as z,X as l,bK as Q,R as ee,T as te,I as me,a4 as ue,G as qe,b3 as V,cs as Re,cu as Oe,e1 as Tt,aT as He,ai as It,d$ as Dt,an as At,a7 as Pt,e2 as Ot,bb as qt,d2 as Et,d3 as zt,dX as Bt,bB as Ft,bR as Wt,d4 as Rt,V as Me,Z as Ut,b1 as Nt,a0 as Vt,bN as Ht,M as Mt,S as _t,e3 as $t}from"./vendor-mui-core-CDEc-eG6.js";import{M as oe}from"./provider-icon-BHmm2FYJ.js";import{x as ae,n as N,y as he,F as Ue,E as _e,b as fe,$ as $e,a as Jt}from"./vendor-utils-_C9URqjS.js";import{X as G,V as J,W as ke,cJ as Ee,L as Gt,av as Je,cS as Kt,cT as Zt,F as ze,j as Yt}from"./index-DcM4ljaV.js";import{u as ne,C as I,a as Ne}from"./index.esm-C4tuRtuv.js";import{S as L}from"./section-CC2BHD5s.js";import{S as Qt}from"./switch-control-BfU6EhtX.js";import{d as Xt,a as en}from"./edit-rounded-CnMn6J-D.js";import{S as tn}from"./simple-select-BYJ6vXN1.js";import{u as Ge}from"./index-BObu-fIz.js";import{F as nn}from"./federated-detail-dialog-CkIKuPwA.js";import{C as on}from"./click-to-copy-BmatCVrP.js";import{u as sn}from"./use-mobile-CnCzXOEv.js";import"./google-icon-vNOJy67F.js";import"./passkey-rounded-_WDHIZVd.js";import"./vendor-arcblock-BVQTtbN-.js";import"./required-BO8emcue.js";import"./arrow-down.svg-Dz9H9vM-.js";import"./index-BEbBg3NW.js";import"./base32-BFSrw7-h.js";const Le={domain:"",clientId:"",clientSecret:""};function Ke({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Le},a?.settings?.authentication?.auth0||{}),h=(a.environments||[]).find(o=>o.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Le))}),g=x(async o=>{try{const{blocklet:i}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,auth0:{...o,order:d.auth0?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),w=Object.assign({...Le},i?.settings?.authentication?.auth0||{});j(w),A.success(t("common.saveSuccess")),r()}catch(i){A.error(i.message||t("common.saveFailed"))}}),P=x(o=>o?.trim()?!0:t("authentication.auth0.domainDescription")),D=x(o=>o?.trim()?!0:t("authentication.auth0.clientIdDescription")),T=x(o=>o?.trim()?!0:t("authentication.auth0.clientSecretDescription")),S=se(()=>c==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[c]),b=he(h,ke,"oauth/callback/auth0");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{onSubmit:v(g),disabled:!0,children:[e.jsx(L,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:S,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[S,e.jsx(m,{component:de,icon:Ee,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[b,e.jsx(ve,{locale:c,content:b,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.auth0.domain"),children:e.jsx(I,{name:"domain",control:k,rules:{validate:P},render:({field:o})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...o,size:"small",label:t("authentication.auth0.domain"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:D},render:({field:o})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...o,size:"small",label:t("authentication.auth0.clientId"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:T},render:({field:o})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...o,size:"small",type:"password",label:t("authentication.auth0.clientSecret"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})})]})})}Ke.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Ce={clientId:"",clientSecret:""};function Ze({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Ce},a?.settings?.authentication?.github||{}),h=(a.environments||[]).find(b=>b.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Ce))}),g=x(async b=>{try{const{blocklet:o}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,github:{...b,order:d.github?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),i=Object.assign({...Ce},o?.settings?.authentication?.github||{});j(i),A.success(t("common.saveSuccess")),r()}catch(o){A.error(o.message||t("common.saveFailed"))}}),P=x(b=>b?.trim()?!0:t("authentication.github.clientIdDescription")),D=x(b=>b?.trim()?!0:t("authentication.github.clientSecretDescription")),T=se(()=>c==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[c]),S=he(h,ke,"oauth/callback/github");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{disabled:!0,children:[e.jsx(L,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:de,icon:Ee,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[S,e.jsx(ve,{locale:c,content:S,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.github.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:P},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",label:t("authentication.github.clientId"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:D},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",type:"password",label:t("authentication.github.clientSecret"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})})]})})}Ze.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Te={showQrcode:!0};function Ye({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t}=$(),c=a?.meta?.did,u=Object.assign({...Te},a?.settings?.authentication?.wallet||{}),{handleSubmit:f,control:h,reset:v}=ne({defaultValues:ae(u,Object.keys(Te))}),k=x(async p=>{try{const{blocklet:j}=await n.configAuthentication({input:{did:c,authentication:JSON.stringify({...d,wallet:{...p,order:d.wallet?.order??Object.keys(d).length,enabled:!0,type:"builtin"}})}}),g=Object.assign({...Te},j?.settings?.authentication?.wallet||{});v(g),A.success(t("common.saveSuccess")),r()}catch(j){A.error(j.message||t("common.saveFailed"))}});return C.useImperativeHandle(s,()=>({submit:f(k)}),[f,k]),e.jsx(m,{children:e.jsx("form",{children:e.jsx(L,{title:t("authentication.wallet.showQrcode"),children:e.jsx(I,{name:"showQrcode",control:h,render:({field:p})=>e.jsx(Q,{control:e.jsx(Qt,{sx:{ml:1},checked:p.value,...p})})})})})})}Ye.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};function Qe({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n,inService:a}=G(),{blocklet:t}=J(),{t:c}=$(),u=t?.meta?.did,f=x(async()=>{try{await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,email:{order:d.email?.order??Object.keys(d).length,enabled:!0,type:"builtin"}})}}),A.success(c("common.saveSuccess")),r()}catch(v){A.error(v.message||c("common.saveFailed"))}}),h=se(()=>a?Ue(he(Gt,"/notification/settings"),{type:"email"}):Ue(he("/blocklets",t.appPid,"/configuration"),{tab:"notification",type:"email"}),[a,t.appPid]);return C.useImperativeHandle(s,()=>({submit:f}),[f]),e.jsxs(m,{children:[c("authentication.emailLoginDescription"),e.jsx("br",{}),c("authentication.emailNotificationRequired"),e.jsx("br",{}),e.jsx(m,{component:Ct,to:h,sx:{mt:1,display:"inline-block"},children:e.jsx(ee,{size:"small",variant:"outlined",children:c("authentication.gotoEmailNotification")})})]})}Qe.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};function Xe({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t}=$(),c=a?.meta?.did,u=x(async()=>{try{await n.configAuthentication({input:{did:c,authentication:JSON.stringify({...d,passkey:{order:d.passkey?.order??Object.keys(d).length,enabled:!0,type:"builtin"}})}}),A.success(t("common.saveSuccess")),r()}catch(f){A.error(f.message||t("common.saveFailed"))}});return C.useImperativeHandle(s,()=>({submit:u}),[u]),null}Xe.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Ie={clientId:"",clientSecret:""};function et({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Ie},a?.settings?.authentication?.google||{}),h=(a.environments||[]).find(b=>b.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Ie))}),g=x(async b=>{try{const{blocklet:o}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,google:{...b,order:d.google?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),i=Object.assign({...Ie},o?.settings?.authentication?.google||{});j(i),A.success(t("common.saveSuccess")),r()}catch(o){A.error(o.message||t("common.saveFailed"))}}),P=x(b=>b?.trim()?!0:t("authentication.google.clientIdDescription")),D=x(b=>b?.trim()?!0:t("authentication.google.clientSecretDescription")),T=se(()=>c==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[c]),S=he(h,ke,"oauth/callback/google");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{onSubmit:v(g),disabled:!0,children:[e.jsx(L,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:de,icon:Ee,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[S,e.jsx(ve,{locale:c,content:S,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.google.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:P},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",label:t("authentication.google.clientId"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:D},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",type:"password",label:t("authentication.google.clientSecret"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})})]})})}et.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const De={teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function tt({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...De},a?.settings?.authentication?.apple||{}),h=(a.environments||[]).find(i=>i.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(De))}),g=x(async i=>{try{const{blocklet:w}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,apple:{...i,order:d.apple?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),F=Object.assign({...De},w?.settings?.authentication?.apple||{});j(F),A.success(t("common.saveSuccess")),r()}catch(w){A.error(w.message||t("common.saveFailed"))}}),P=x(i=>i?.trim()?!0:t("authentication.apple.teamIdDescription")),D=x(i=>i?.trim()?!0:t("authentication.apple.serviceIdDescription")),T=x(i=>i?.trim()?!0:t("authentication.apple.keyIdDescription")),S=x(i=>i?.trim()?!0:t("authentication.apple.authKeyDescription")),b=x(i=>i?.trim()?!0:t("authentication.apple.bundleIdDescription")),o=he(h,ke,"oauth/callback/apple");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{children:[e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[o,e.jsx(ve,{locale:c,content:o,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.apple.teamId"),children:e.jsx(I,{name:"teamId",control:k,rules:{validate:P},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.teamId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:k,rules:{validate:b},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.bundleId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:k,rules:{validate:D},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.serviceId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.keyId"),children:e.jsx(I,{name:"keyId",control:k,rules:{validate:T},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.keyId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.authKey"),children:e.jsx(I,{name:"authKey",control:k,rules:{validate:S},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",type:"password",label:t("authentication.apple.authKey"),multiline:!0,rows:4,error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",slotProps:{input:{sx:{WebkitTextSecurity:"disc",fontFamily:"text-security-disc, monospace"}}}})})})})]})})}tt.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Ae={clientId:"",clientSecret:""};function nt({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Ae},a?.settings?.authentication?.twitter||{}),h=(a.environments||[]).find(S=>S.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Ae))}),g=x(async S=>{try{const{blocklet:b}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,twitter:{...S,order:d.twitter?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),o=Object.assign({...Ae},b?.settings?.authentication?.twitter||{});j(o),A.success(t("common.saveSuccess")),r()}catch(b){A.error(b.message||t("common.saveFailed"))}}),P=x(S=>S?.trim()?!0:t("authentication.twitter.clientIdDescription")),D=x(S=>S?.trim()?!0:t("authentication.twitter.clientSecretDescription")),T=he(h,ke,"oauth/callback/twitter");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{onSubmit:v(g),disabled:!0,children:[e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[T,e.jsx(ve,{locale:c,content:T,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.twitter.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:P},render:({field:S})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...S,size:"small",label:t("authentication.twitter.clientId"),error:!!p.errors[S.name],helperText:p.errors[S.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.twitter.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:D},render:({field:S})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...S,size:"small",type:"password",label:t("authentication.twitter.clientSecret"),error:!!p.errors[S.name],helperText:p.errors[S.name]?.message||" "})})})})]})})}nt.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const an={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 it({id:s,title:r,index:d,onBegin:n=N,onMove:a,onEnd:t,onEditItem:c=N,onDeleteItem:u=N,disableDelete:f=!1,icon:h=null}){const v=C.useRef(null),k=C.useRef(null),[{handlerId:p},j]=ft({accept:"dragItem",collect(T){return{handlerId:T.getHandlerId()}},hover(T,S){if(!v.current)return;const b=T.index,o=d;if(b===o)return;const i=v.current?.getBoundingClientRect(),w=k.current?.getBoundingClientRect(),F=(w.bottom-w.top)/2,xe=S.getClientOffset().y-i.top;b<o&&xe<F||b>o&&xe>F||(a(b,o),T.index=o)}}),[{isDragging:g},P]=jt({item:{index:d,type:"dragItem"},collect:T=>({isDragging:T.isDragging()}),begin:n,end:t});P(k),j(v);const D=g?.3:1;return e.jsx(m,{ref:v,children:e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:k,"data-handler-id":p,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:D,display:"flex",alignItems:"center",gap:.5},draggable:!1,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(de,{fontSize:20,icon:an})}),e.jsx(m,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:h}),e.jsx(te,{sx:{flex:1},children:r}),e.jsx(me,{size:"small",color:"primary",onClick:()=>{c(s)},children:e.jsx(de,{icon:Xt})}),e.jsx(me,{size:"small",color:"error",onClick:()=>{u(s)},disabled:f,children:e.jsx(de,{icon:en})})]}),e.jsx(ue,{})]})})}it.propTypes={title:l.string.isRequired,id:l.string.isRequired,index:l.number.isRequired,onBegin:l.func,onMove:l.func.isRequired,onEnd:l.func.isRequired,onEditItem:l.func,onDeleteItem:l.func,disableDelete:l.bool,icon:l.any};function ot({ref:s=null,providers:r=[],sortMaps:d={}}){const n=C.useRef(null),{t:a}=C.useContext(pe),t=qe(),{control:c,watch:u,setValue:f,reset:h}=ne({mode:"onChange",defaultValues:{provider:""}}),v=u("provider"),k=r.find(o=>o.name===v),p=wt(k),j=t?.transitions?.duration?.leavingScreen||300,g=ye({initMode:"add",mode:"add",show:!1,callback:N,get dialogTitle(){return this.mode==="edit"?a("authentication.updateLoginProvider",{provider:p.current?.title}):a("authentication.addLoginProvider")}}),P=x(()=>{h(),g.mode="add",g.initMode="add"}),D=x(()=>{g.show=!1,setTimeout(()=>{P()},j)}),T=x((o,i=null)=>{if(g.show=!0,i)g.initMode="edit",g.mode="edit",f("provider",i.provider);else{const w=r.find(F=>F.enabled===!1)?.name||r[0]?.name||U.WALLET;f("provider",w)}o?g.callback=o:g.callback=N});C.useImperativeHandle(s,()=>({open:T,close:D}),[T,D]);const S=x(()=>{n.current.submit()}),b=r.map(o=>({value:o.name,title:o.title,description:o.enabled?a("common.enabled"):""}));return C.useEffect(()=>{k?.enabled?g.mode="edit":g.mode="add"},[k?.enabled]),e.jsxs(we,{open:g.show,title:g.dialogTitle,onClose:D,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(_,{color:"primary",autoFocus:!0,variant:"contained",onClick:S,disabled:!v,children:g.mode==="add"?a("common.confirm"):a("common.update")}),children:[g.initMode==="edit"?null:e.jsx(I,{name:"provider",control:c,render:({field:o})=>e.jsx(tn,{required:!0,fullWidth:!0,margin:"dense",size:"small",label:a("authentication.chooseProvider"),placeholder:a("authentication.chooseProviderPlaceholder"),options:b,..._e(o,"ref"),slotProps:{optionItem:{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"}}}})}),e.jsx(m,{sx:{mt:2,".section":{mb:1,gap:4},".section-left":{width:150}},children:k?.component&&e.jsx(k.component,{ref:n,onSuccess:D,sortMaps:d})})]})}ot.propTypes={ref:l.any,providers:l.array,sortMaps:l.object};function rn(){const{confirmApi:s,confirmHolder:r}=Je(),d=C.useRef(),{t:n}=$(),{api:a}=G(),{blocklet:t}=J(),c=t?.meta?.did,u=t?.settings?.authentication||{},f=[{name:U.WALLET,title:Y[U.WALLET],icon:e.jsx(oe,{provider:"wallet",sx:{width:20,height:20,scale:.9}}),component:Ye},{name:U.EMAIL,title:Y[U.EMAIL],icon:e.jsx(oe,{provider:"email",sx:{width:20,height:20,scale:.9}}),component:Qe},{name:U.PASSKEY,title:Y[U.PASSKEY],icon:e.jsx(oe,{provider:"passkey",sx:{width:20,height:20,scale:.9}}),component:Xe},{name:U.GOOGLE,title:Y[U.GOOGLE],icon:e.jsx(oe,{provider:"google",sx:{width:20,height:20}}),component:et},{name:U.APPLE,title:Y[U.APPLE],icon:e.jsx(oe,{provider:"apple",sx:{width:20,height:20}}),component:tt},{name:U.GITHUB,title:Y[U.GITHUB],icon:e.jsx(oe,{provider:"github",sx:{width:20,height:20}}),component:Ze},{name:U.TWITTER,title:Y[U.TWITTER],icon:e.jsx(oe,{provider:"twitter",sx:{width:20,height:20}}),component:nt},{name:U.AUTH0,title:Y[U.AUTH0],icon:e.jsx(oe,{provider:"auth0",sx:{width:20,height:20}}),component:Ke,hidden:!0}].map(o=>({...o,enabled:u[o.name]?.enabled??!1,order:u[o.name]?.order??null})),h=f.filter(o=>o.enabled),v=h.sort((o,i)=>!fe(o?.order)&&!fe(i?.order)?o.order-i.order:fe(o?.order)?1:-1),k=v.reduce((o,i,w)=>Object.assign(o,{[i.name]:{order:w}}),{}),p=ye(v.reduce((o,i,w)=>Object.assign(o,{[i.name]:w}),{})),j=[...h].sort((o,i)=>p[o.name]-p[i.name]),g={};typeof window<"u"&&(g.context=window);const P=x((o,i)=>{const w=j[o],F=j[i];p[w.name]=i,p[F.name]=o}),D=x(async()=>{const o=Object.keys(p).reduce((i,w)=>(i[w]={order:p[w]},i),{});await a.configAuthentication({input:{did:c,authentication:JSON.stringify(o)}})}),T=()=>{d.current.open(()=>{d.current.close()})},S=x(o=>{d.current.open(N,{provider:o})}),b=x(o=>{s.open({title:n("authentication.deleteLoginProvider",{provider:Y[o]}),content:n("authentication.deleteLoginProviderDescription",{provider:Y[o]}),confirmButtonText:n("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:n("common.cancel"),async onConfirm(i){try{await a.configAuthentication({input:{did:c,authentication:JSON.stringify({[o]:{enabled:!1,order:null}})}}),delete p[o],A.success(n("common.removeSuccess")),i()}catch(w){A.error(w.message||n("common.deleteFailed"))}}})});return e.jsxs(m,{children:[e.jsx(_,{variant:"contained",onClick:T,sx:{mb:1},children:n("authentication.addLoginProvider")}),e.jsx(bt,{backend:vt,...g,children:j.map((o,i)=>e.jsx(it,{index:i,id:o.name,title:o.title,icon:o.icon,onMove:P,onEnd:D,onEditItem:S,onDeleteItem:b,disableDelete:v.length<=1,children:o.component},o.name))}),e.jsx(ot,{ref:d,providers:f,sortMaps:k}),r]})}const ce={ttl:Zt,cacheTtl:Kt,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:[]},enableBlacklist:!1};function Z(s){return e.jsx(Ge,{...s,sx:{transform:"scale(0.75)"}})}function Pe(s,r=!1){const d=r?s.ttl*86400:s.ttl/86400;return{...s,ttl:d}}function ln(){const{api:s}=G(),{blocklet:r}=J(),d=r?.meta?.did,n=$e({},ce,r?.settings?.session||{});fe(n.ttl)&&(n.ttl=ce.ttl),fe(n.cacheTtl)&&(n.cacheTtl=ce.cacheTtl),n.phone||(n.phone=ce.phone),n.email||(n.email=ce.email),fe(n.enableBlacklist)&&(n.enableBlacklist=ce.enableBlacklist);const{handleSubmit:a,control:t,formState:c,reset:u,watch:f}=ne({defaultValues:ae(Pe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:h}=$(),v=f("email.enabled"),k=f("phone.enabled"),p=f("email.enableDomainBlackList"),j=f("email.enableDomainWhiteList"),{fields:g,append:P,remove:D}=Ne({control:t,name:"email.domainBlackList"}),{fields:T,append:S,remove:b}=Ne({control:t,name:"email.domainWhiteList"}),o=x(async i=>{try{const{blocklet:w}=await s.updateAppSessionConfig({input:{did:d,config:_e(Pe(i,!0),["phone"])}}),F=Object.assign({},ce,ae(w?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));u(Pe(F)),A.success(h("common.configSuccess"))}catch(w){A.error(w.message)}});return e.jsx(cn,{onSubmit:a(o),children:e.jsxs(V,{direction:"column",sx:{gap:6},children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.profile")}),e.jsx(m,{component:ue,sx:{my:3}})]}),e.jsxs(V,{sx:{gap:2},children:[e.jsx(L,{title:h("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(L,{title:h("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(L,{title:h("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:i})=>e.jsx(Z,{...i,checked:i.value})})})}),v&&e.jsxs(V,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(L,{title:h("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),p&&e.jsxs(m,{children:[g.map((i,w)=>e.jsxs(V,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(I,{name:`email.domainBlackList.${w}`,control:t,render:F=>e.jsx(z,{...F.field,size:"small",fullWidth:!0})}),e.jsx(me,{onClick:()=>D(w),children:e.jsx(Re,{})})]},i.id)),e.jsx(ee,{startIcon:e.jsx(Oe,{}),onClick:()=>P(""),children:h("blocklet.config.session.addDomain")})]}),e.jsx(L,{title:h("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),j&&e.jsxs(m,{children:[T.map((i,w)=>e.jsxs(V,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(I,{name:`email.domainWhiteList.${w}`,control:t,render:F=>e.jsx(z,{...F.field,size:"small",fullWidth:!0})}),e.jsx(me,{onClick:()=>b(w),children:e.jsx(Re,{})})]},i.id)),e.jsx(ee,{startIcon:e.jsx(Oe,{}),onClick:()=>S(""),children:h("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(L,{title:h("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),k&&e.jsxs(V,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(L,{title:h("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.period")}),e.jsx(m,{component:ue,sx:{my:3}}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:i})=>e.jsx(H,{fullWidth:!0,sx:{mb:2},children:e.jsx(L,{title:h("blocklet.config.session.ttl",{day:i.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Tt,{...i,defaultValue:7,step:1,marks:[{value:1,label:h("blocklet.config.session.day",{day:1})},{value:7,label:h("blocklet.config.session.days",{day:7})},{value:14,label:h("blocklet.config.session.days",{day:14})},{value:21,label:h("blocklet.config.session.days",{day:21})},{value:30,label:h("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.experimentalSettings")}),e.jsx(m,{component:ue,sx:{my:3}}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(L,{title:h("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"enableBlacklist",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})})})]}),e.jsx(m,{children:e.jsx(ee,{type:"submit",variant:"contained",disabled:!c.isDirty,children:h("common.save")})})]})})}const cn=He.form`
|
|
1
|
+
import{aa as $,a3 as A,ab as de,bT as ve,dv as ft,dw as jt,bj as pe,aF as U,b1 as we,bk as _,aj as Y,dx as bt,dy as vt,bq as yt,dz as kt,b3 as St,br as We}from"./vendor-ux-PO0jFgJf.js";import{b as x,a as se,h as wt,i as ye,f as Lt}from"./vendor-hooks-Ca2cSNuD.js";import{r as C,L as Ct}from"./vendor-react-DX7tU9aY.js";import{j as e,al as m,z as H,A as z,X as l,bK as Q,R as ee,T as te,I as me,a4 as ue,G as qe,b3 as V,cs as Re,cu as Oe,e1 as Tt,aT as He,ai as It,d$ as Dt,an as At,a7 as Pt,e2 as Ot,bb as qt,d2 as Et,d3 as zt,dX as Bt,bB as Ft,bR as Wt,d4 as Rt,V as Me,Z as Ut,b1 as Nt,a0 as Vt,bN as Ht,M as Mt,S as _t,e3 as $t}from"./vendor-mui-core-CDEc-eG6.js";import{M as oe}from"./provider-icon-BHmm2FYJ.js";import{x as ae,n as N,y as he,F as Ue,E as _e,b as fe,$ as $e,a as Jt}from"./vendor-utils-_C9URqjS.js";import{X as G,V as J,W as ke,cJ as Ee,L as Gt,av as Je,cS as Kt,cT as Zt,F as ze,j as Yt}from"./index-CgSpL7jz.js";import{u as ne,C as I,a as Ne}from"./index.esm-C4tuRtuv.js";import{S as L}from"./section-CC2BHD5s.js";import{S as Qt}from"./switch-control-BfU6EhtX.js";import{d as Xt,a as en}from"./edit-rounded-CnMn6J-D.js";import{S as tn}from"./simple-select-BYJ6vXN1.js";import{u as Ge}from"./index-BObu-fIz.js";import{F as nn}from"./federated-detail-dialog-B3FXukx8.js";import{C as on}from"./click-to-copy-BmatCVrP.js";import{u as sn}from"./use-mobile-CnCzXOEv.js";import"./google-icon-vNOJy67F.js";import"./passkey-rounded-_WDHIZVd.js";import"./vendor-arcblock-BVQTtbN-.js";import"./required-BO8emcue.js";import"./arrow-down.svg-Dz9H9vM-.js";import"./index-BEbBg3NW.js";import"./base32-Cx5Qjcq5.js";const Le={domain:"",clientId:"",clientSecret:""};function Ke({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Le},a?.settings?.authentication?.auth0||{}),h=(a.environments||[]).find(o=>o.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Le))}),g=x(async o=>{try{const{blocklet:i}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,auth0:{...o,order:d.auth0?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),w=Object.assign({...Le},i?.settings?.authentication?.auth0||{});j(w),A.success(t("common.saveSuccess")),r()}catch(i){A.error(i.message||t("common.saveFailed"))}}),P=x(o=>o?.trim()?!0:t("authentication.auth0.domainDescription")),D=x(o=>o?.trim()?!0:t("authentication.auth0.clientIdDescription")),T=x(o=>o?.trim()?!0:t("authentication.auth0.clientSecretDescription")),S=se(()=>c==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[c]),b=he(h,ke,"oauth/callback/auth0");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{onSubmit:v(g),disabled:!0,children:[e.jsx(L,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:S,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[S,e.jsx(m,{component:de,icon:Ee,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[b,e.jsx(ve,{locale:c,content:b,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.auth0.domain"),children:e.jsx(I,{name:"domain",control:k,rules:{validate:P},render:({field:o})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...o,size:"small",label:t("authentication.auth0.domain"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:D},render:({field:o})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...o,size:"small",label:t("authentication.auth0.clientId"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:T},render:({field:o})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...o,size:"small",type:"password",label:t("authentication.auth0.clientSecret"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})})]})})}Ke.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Ce={clientId:"",clientSecret:""};function Ze({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Ce},a?.settings?.authentication?.github||{}),h=(a.environments||[]).find(b=>b.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Ce))}),g=x(async b=>{try{const{blocklet:o}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,github:{...b,order:d.github?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),i=Object.assign({...Ce},o?.settings?.authentication?.github||{});j(i),A.success(t("common.saveSuccess")),r()}catch(o){A.error(o.message||t("common.saveFailed"))}}),P=x(b=>b?.trim()?!0:t("authentication.github.clientIdDescription")),D=x(b=>b?.trim()?!0:t("authentication.github.clientSecretDescription")),T=se(()=>c==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[c]),S=he(h,ke,"oauth/callback/github");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{disabled:!0,children:[e.jsx(L,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:de,icon:Ee,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[S,e.jsx(ve,{locale:c,content:S,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.github.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:P},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",label:t("authentication.github.clientId"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:D},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",type:"password",label:t("authentication.github.clientSecret"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})})]})})}Ze.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Te={showQrcode:!0};function Ye({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t}=$(),c=a?.meta?.did,u=Object.assign({...Te},a?.settings?.authentication?.wallet||{}),{handleSubmit:f,control:h,reset:v}=ne({defaultValues:ae(u,Object.keys(Te))}),k=x(async p=>{try{const{blocklet:j}=await n.configAuthentication({input:{did:c,authentication:JSON.stringify({...d,wallet:{...p,order:d.wallet?.order??Object.keys(d).length,enabled:!0,type:"builtin"}})}}),g=Object.assign({...Te},j?.settings?.authentication?.wallet||{});v(g),A.success(t("common.saveSuccess")),r()}catch(j){A.error(j.message||t("common.saveFailed"))}});return C.useImperativeHandle(s,()=>({submit:f(k)}),[f,k]),e.jsx(m,{children:e.jsx("form",{children:e.jsx(L,{title:t("authentication.wallet.showQrcode"),children:e.jsx(I,{name:"showQrcode",control:h,render:({field:p})=>e.jsx(Q,{control:e.jsx(Qt,{sx:{ml:1},checked:p.value,...p})})})})})})}Ye.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};function Qe({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n,inService:a}=G(),{blocklet:t}=J(),{t:c}=$(),u=t?.meta?.did,f=x(async()=>{try{await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,email:{order:d.email?.order??Object.keys(d).length,enabled:!0,type:"builtin"}})}}),A.success(c("common.saveSuccess")),r()}catch(v){A.error(v.message||c("common.saveFailed"))}}),h=se(()=>a?Ue(he(Gt,"/notification/settings"),{type:"email"}):Ue(he("/blocklets",t.appPid,"/configuration"),{tab:"notification",type:"email"}),[a,t.appPid]);return C.useImperativeHandle(s,()=>({submit:f}),[f]),e.jsxs(m,{children:[c("authentication.emailLoginDescription"),e.jsx("br",{}),c("authentication.emailNotificationRequired"),e.jsx("br",{}),e.jsx(m,{component:Ct,to:h,sx:{mt:1,display:"inline-block"},children:e.jsx(ee,{size:"small",variant:"outlined",children:c("authentication.gotoEmailNotification")})})]})}Qe.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};function Xe({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t}=$(),c=a?.meta?.did,u=x(async()=>{try{await n.configAuthentication({input:{did:c,authentication:JSON.stringify({...d,passkey:{order:d.passkey?.order??Object.keys(d).length,enabled:!0,type:"builtin"}})}}),A.success(t("common.saveSuccess")),r()}catch(f){A.error(f.message||t("common.saveFailed"))}});return C.useImperativeHandle(s,()=>({submit:u}),[u]),null}Xe.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Ie={clientId:"",clientSecret:""};function et({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Ie},a?.settings?.authentication?.google||{}),h=(a.environments||[]).find(b=>b.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Ie))}),g=x(async b=>{try{const{blocklet:o}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,google:{...b,order:d.google?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),i=Object.assign({...Ie},o?.settings?.authentication?.google||{});j(i),A.success(t("common.saveSuccess")),r()}catch(o){A.error(o.message||t("common.saveFailed"))}}),P=x(b=>b?.trim()?!0:t("authentication.google.clientIdDescription")),D=x(b=>b?.trim()?!0:t("authentication.google.clientSecretDescription")),T=se(()=>c==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[c]),S=he(h,ke,"oauth/callback/google");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{onSubmit:v(g),disabled:!0,children:[e.jsx(L,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:de,icon:Ee,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[S,e.jsx(ve,{locale:c,content:S,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.google.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:P},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",label:t("authentication.google.clientId"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:D},render:({field:b})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...b,size:"small",type:"password",label:t("authentication.google.clientSecret"),error:!!p.errors[b.name],helperText:p.errors[b.name]?.message||" "})})})})]})})}et.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const De={teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function tt({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...De},a?.settings?.authentication?.apple||{}),h=(a.environments||[]).find(i=>i.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(De))}),g=x(async i=>{try{const{blocklet:w}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,apple:{...i,order:d.apple?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),F=Object.assign({...De},w?.settings?.authentication?.apple||{});j(F),A.success(t("common.saveSuccess")),r()}catch(w){A.error(w.message||t("common.saveFailed"))}}),P=x(i=>i?.trim()?!0:t("authentication.apple.teamIdDescription")),D=x(i=>i?.trim()?!0:t("authentication.apple.serviceIdDescription")),T=x(i=>i?.trim()?!0:t("authentication.apple.keyIdDescription")),S=x(i=>i?.trim()?!0:t("authentication.apple.authKeyDescription")),b=x(i=>i?.trim()?!0:t("authentication.apple.bundleIdDescription")),o=he(h,ke,"oauth/callback/apple");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{children:[e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[o,e.jsx(ve,{locale:c,content:o,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.apple.teamId"),children:e.jsx(I,{name:"teamId",control:k,rules:{validate:P},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.teamId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:k,rules:{validate:b},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.bundleId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:k,rules:{validate:D},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.serviceId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.keyId"),children:e.jsx(I,{name:"keyId",control:k,rules:{validate:T},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",label:t("authentication.apple.keyId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.apple.authKey"),children:e.jsx(I,{name:"authKey",control:k,rules:{validate:S},render:({field:i})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...i,size:"small",type:"password",label:t("authentication.apple.authKey"),multiline:!0,rows:4,error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",slotProps:{input:{sx:{WebkitTextSecurity:"disc",fontFamily:"text-security-disc, monospace"}}}})})})})]})})}tt.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const Ae={clientId:"",clientSecret:""};function nt({ref:s=null,onSuccess:r=N,sortMaps:d={}}){const{api:n}=G(),{blocklet:a}=J(),{t,locale:c}=$(),u=a?.meta?.did,f=Object.assign({...Ae},a?.settings?.authentication?.twitter||{}),h=(a.environments||[]).find(S=>S.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:v,control:k,formState:p,reset:j}=ne({defaultValues:ae(f,Object.keys(Ae))}),g=x(async S=>{try{const{blocklet:b}=await n.configAuthentication({input:{did:u,authentication:JSON.stringify({...d,twitter:{...S,order:d.twitter?.order??Object.keys(d).length,enabled:!0,type:"oauth"}})}}),o=Object.assign({...Ae},b?.settings?.authentication?.twitter||{});j(o),A.success(t("common.saveSuccess")),r()}catch(b){A.error(b.message||t("common.saveFailed"))}}),P=x(S=>S?.trim()?!0:t("authentication.twitter.clientIdDescription")),D=x(S=>S?.trim()?!0:t("authentication.twitter.clientSecretDescription")),T=he(h,ke,"oauth/callback/twitter");return C.useImperativeHandle(s,()=>({submit:v(g)}),[v,g]),e.jsx(m,{children:e.jsxs("form",{onSubmit:v(g),disabled:!0,children:[e.jsx(L,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[T,e.jsx(ve,{locale:c,content:T,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(L,{title:t("authentication.twitter.clientId"),children:e.jsx(I,{name:"clientId",control:k,rules:{validate:P},render:({field:S})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...S,size:"small",label:t("authentication.twitter.clientId"),error:!!p.errors[S.name],helperText:p.errors[S.name]?.message||" "})})})}),e.jsx(L,{title:t("authentication.twitter.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:k,rules:{validate:D},render:({field:S})=>e.jsx(H,{fullWidth:!0,children:e.jsx(z,{...S,size:"small",type:"password",label:t("authentication.twitter.clientSecret"),error:!!p.errors[S.name],helperText:p.errors[S.name]?.message||" "})})})})]})})}nt.propTypes={ref:l.any,onSuccess:l.func,sortMaps:l.object};const an={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 it({id:s,title:r,index:d,onBegin:n=N,onMove:a,onEnd:t,onEditItem:c=N,onDeleteItem:u=N,disableDelete:f=!1,icon:h=null}){const v=C.useRef(null),k=C.useRef(null),[{handlerId:p},j]=ft({accept:"dragItem",collect(T){return{handlerId:T.getHandlerId()}},hover(T,S){if(!v.current)return;const b=T.index,o=d;if(b===o)return;const i=v.current?.getBoundingClientRect(),w=k.current?.getBoundingClientRect(),F=(w.bottom-w.top)/2,xe=S.getClientOffset().y-i.top;b<o&&xe<F||b>o&&xe>F||(a(b,o),T.index=o)}}),[{isDragging:g},P]=jt({item:{index:d,type:"dragItem"},collect:T=>({isDragging:T.isDragging()}),begin:n,end:t});P(k),j(v);const D=g?.3:1;return e.jsx(m,{ref:v,children:e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:k,"data-handler-id":p,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:D,display:"flex",alignItems:"center",gap:.5},draggable:!1,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(de,{fontSize:20,icon:an})}),e.jsx(m,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:h}),e.jsx(te,{sx:{flex:1},children:r}),e.jsx(me,{size:"small",color:"primary",onClick:()=>{c(s)},children:e.jsx(de,{icon:Xt})}),e.jsx(me,{size:"small",color:"error",onClick:()=>{u(s)},disabled:f,children:e.jsx(de,{icon:en})})]}),e.jsx(ue,{})]})})}it.propTypes={title:l.string.isRequired,id:l.string.isRequired,index:l.number.isRequired,onBegin:l.func,onMove:l.func.isRequired,onEnd:l.func.isRequired,onEditItem:l.func,onDeleteItem:l.func,disableDelete:l.bool,icon:l.any};function ot({ref:s=null,providers:r=[],sortMaps:d={}}){const n=C.useRef(null),{t:a}=C.useContext(pe),t=qe(),{control:c,watch:u,setValue:f,reset:h}=ne({mode:"onChange",defaultValues:{provider:""}}),v=u("provider"),k=r.find(o=>o.name===v),p=wt(k),j=t?.transitions?.duration?.leavingScreen||300,g=ye({initMode:"add",mode:"add",show:!1,callback:N,get dialogTitle(){return this.mode==="edit"?a("authentication.updateLoginProvider",{provider:p.current?.title}):a("authentication.addLoginProvider")}}),P=x(()=>{h(),g.mode="add",g.initMode="add"}),D=x(()=>{g.show=!1,setTimeout(()=>{P()},j)}),T=x((o,i=null)=>{if(g.show=!0,i)g.initMode="edit",g.mode="edit",f("provider",i.provider);else{const w=r.find(F=>F.enabled===!1)?.name||r[0]?.name||U.WALLET;f("provider",w)}o?g.callback=o:g.callback=N});C.useImperativeHandle(s,()=>({open:T,close:D}),[T,D]);const S=x(()=>{n.current.submit()}),b=r.map(o=>({value:o.name,title:o.title,description:o.enabled?a("common.enabled"):""}));return C.useEffect(()=>{k?.enabled?g.mode="edit":g.mode="add"},[k?.enabled]),e.jsxs(we,{open:g.show,title:g.dialogTitle,onClose:D,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(_,{color:"primary",autoFocus:!0,variant:"contained",onClick:S,disabled:!v,children:g.mode==="add"?a("common.confirm"):a("common.update")}),children:[g.initMode==="edit"?null:e.jsx(I,{name:"provider",control:c,render:({field:o})=>e.jsx(tn,{required:!0,fullWidth:!0,margin:"dense",size:"small",label:a("authentication.chooseProvider"),placeholder:a("authentication.chooseProviderPlaceholder"),options:b,..._e(o,"ref"),slotProps:{optionItem:{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"}}}})}),e.jsx(m,{sx:{mt:2,".section":{mb:1,gap:4},".section-left":{width:150}},children:k?.component&&e.jsx(k.component,{ref:n,onSuccess:D,sortMaps:d})})]})}ot.propTypes={ref:l.any,providers:l.array,sortMaps:l.object};function rn(){const{confirmApi:s,confirmHolder:r}=Je(),d=C.useRef(),{t:n}=$(),{api:a}=G(),{blocklet:t}=J(),c=t?.meta?.did,u=t?.settings?.authentication||{},f=[{name:U.WALLET,title:Y[U.WALLET],icon:e.jsx(oe,{provider:"wallet",sx:{width:20,height:20,scale:.9}}),component:Ye},{name:U.EMAIL,title:Y[U.EMAIL],icon:e.jsx(oe,{provider:"email",sx:{width:20,height:20,scale:.9}}),component:Qe},{name:U.PASSKEY,title:Y[U.PASSKEY],icon:e.jsx(oe,{provider:"passkey",sx:{width:20,height:20,scale:.9}}),component:Xe},{name:U.GOOGLE,title:Y[U.GOOGLE],icon:e.jsx(oe,{provider:"google",sx:{width:20,height:20}}),component:et},{name:U.APPLE,title:Y[U.APPLE],icon:e.jsx(oe,{provider:"apple",sx:{width:20,height:20}}),component:tt},{name:U.GITHUB,title:Y[U.GITHUB],icon:e.jsx(oe,{provider:"github",sx:{width:20,height:20}}),component:Ze},{name:U.TWITTER,title:Y[U.TWITTER],icon:e.jsx(oe,{provider:"twitter",sx:{width:20,height:20}}),component:nt},{name:U.AUTH0,title:Y[U.AUTH0],icon:e.jsx(oe,{provider:"auth0",sx:{width:20,height:20}}),component:Ke,hidden:!0}].map(o=>({...o,enabled:u[o.name]?.enabled??!1,order:u[o.name]?.order??null})),h=f.filter(o=>o.enabled),v=h.sort((o,i)=>!fe(o?.order)&&!fe(i?.order)?o.order-i.order:fe(o?.order)?1:-1),k=v.reduce((o,i,w)=>Object.assign(o,{[i.name]:{order:w}}),{}),p=ye(v.reduce((o,i,w)=>Object.assign(o,{[i.name]:w}),{})),j=[...h].sort((o,i)=>p[o.name]-p[i.name]),g={};typeof window<"u"&&(g.context=window);const P=x((o,i)=>{const w=j[o],F=j[i];p[w.name]=i,p[F.name]=o}),D=x(async()=>{const o=Object.keys(p).reduce((i,w)=>(i[w]={order:p[w]},i),{});await a.configAuthentication({input:{did:c,authentication:JSON.stringify(o)}})}),T=()=>{d.current.open(()=>{d.current.close()})},S=x(o=>{d.current.open(N,{provider:o})}),b=x(o=>{s.open({title:n("authentication.deleteLoginProvider",{provider:Y[o]}),content:n("authentication.deleteLoginProviderDescription",{provider:Y[o]}),confirmButtonText:n("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:n("common.cancel"),async onConfirm(i){try{await a.configAuthentication({input:{did:c,authentication:JSON.stringify({[o]:{enabled:!1,order:null}})}}),delete p[o],A.success(n("common.removeSuccess")),i()}catch(w){A.error(w.message||n("common.deleteFailed"))}}})});return e.jsxs(m,{children:[e.jsx(_,{variant:"contained",onClick:T,sx:{mb:1},children:n("authentication.addLoginProvider")}),e.jsx(bt,{backend:vt,...g,children:j.map((o,i)=>e.jsx(it,{index:i,id:o.name,title:o.title,icon:o.icon,onMove:P,onEnd:D,onEditItem:S,onDeleteItem:b,disableDelete:v.length<=1,children:o.component},o.name))}),e.jsx(ot,{ref:d,providers:f,sortMaps:k}),r]})}const ce={ttl:Zt,cacheTtl:Kt,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:[]},enableBlacklist:!1};function Z(s){return e.jsx(Ge,{...s,sx:{transform:"scale(0.75)"}})}function Pe(s,r=!1){const d=r?s.ttl*86400:s.ttl/86400;return{...s,ttl:d}}function ln(){const{api:s}=G(),{blocklet:r}=J(),d=r?.meta?.did,n=$e({},ce,r?.settings?.session||{});fe(n.ttl)&&(n.ttl=ce.ttl),fe(n.cacheTtl)&&(n.cacheTtl=ce.cacheTtl),n.phone||(n.phone=ce.phone),n.email||(n.email=ce.email),fe(n.enableBlacklist)&&(n.enableBlacklist=ce.enableBlacklist);const{handleSubmit:a,control:t,formState:c,reset:u,watch:f}=ne({defaultValues:ae(Pe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:h}=$(),v=f("email.enabled"),k=f("phone.enabled"),p=f("email.enableDomainBlackList"),j=f("email.enableDomainWhiteList"),{fields:g,append:P,remove:D}=Ne({control:t,name:"email.domainBlackList"}),{fields:T,append:S,remove:b}=Ne({control:t,name:"email.domainWhiteList"}),o=x(async i=>{try{const{blocklet:w}=await s.updateAppSessionConfig({input:{did:d,config:_e(Pe(i,!0),["phone"])}}),F=Object.assign({},ce,ae(w?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));u(Pe(F)),A.success(h("common.configSuccess"))}catch(w){A.error(w.message)}});return e.jsx(cn,{onSubmit:a(o),children:e.jsxs(V,{direction:"column",sx:{gap:6},children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.profile")}),e.jsx(m,{component:ue,sx:{my:3}})]}),e.jsxs(V,{sx:{gap:2},children:[e.jsx(L,{title:h("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(L,{title:h("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(L,{title:h("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:i})=>e.jsx(Z,{...i,checked:i.value})})})}),v&&e.jsxs(V,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(L,{title:h("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),p&&e.jsxs(m,{children:[g.map((i,w)=>e.jsxs(V,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(I,{name:`email.domainBlackList.${w}`,control:t,render:F=>e.jsx(z,{...F.field,size:"small",fullWidth:!0})}),e.jsx(me,{onClick:()=>D(w),children:e.jsx(Re,{})})]},i.id)),e.jsx(ee,{startIcon:e.jsx(Oe,{}),onClick:()=>P(""),children:h("blocklet.config.session.addDomain")})]}),e.jsx(L,{title:h("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),j&&e.jsxs(m,{children:[T.map((i,w)=>e.jsxs(V,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(I,{name:`email.domainWhiteList.${w}`,control:t,render:F=>e.jsx(z,{...F.field,size:"small",fullWidth:!0})}),e.jsx(me,{onClick:()=>b(w),children:e.jsx(Re,{})})]},i.id)),e.jsx(ee,{startIcon:e.jsx(Oe,{}),onClick:()=>S(""),children:h("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(L,{title:h("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),k&&e.jsxs(V,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(L,{title:h("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})}),e.jsx(L,{title:h("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.period")}),e.jsx(m,{component:ue,sx:{my:3}}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:i})=>e.jsx(H,{fullWidth:!0,sx:{mb:2},children:e.jsx(L,{title:h("blocklet.config.session.ttl",{day:i.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Tt,{...i,defaultValue:7,step:1,marks:[{value:1,label:h("blocklet.config.session.day",{day:1})},{value:7,label:h("blocklet.config.session.days",{day:7})},{value:14,label:h("blocklet.config.session.days",{day:14})},{value:21,label:h("blocklet.config.session.days",{day:21})},{value:30,label:h("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.experimentalSettings")}),e.jsx(m,{component:ue,sx:{my:3}}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(L,{title:h("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"enableBlacklist",control:t,render:({field:i})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...i,checked:i.value})})})})})})]}),e.jsx(m,{children:e.jsx(ee,{type:"submit",variant:"contained",disabled:!c.isDirty,children:h("common.save")})})]})})}const cn=He.form`
|
|
2
2
|
max-width: 1536px;
|
|
3
3
|
|
|
4
4
|
.advanced-config {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as B,al as z,T as pe,A as gt,z as ht,bN as dt,M as Ct,R as Me,aT as ce,as as lt,cs as xt,eh as Et,ei as Rt,I as mt,ej as yt,G as bt,a_ as le,ak as wt,a7 as vt}from"./vendor-mui-core-CDEc-eG6.js";import{r as oe,p as je,g as It}from"./vendor-react-DX7tU9aY.js";import{P as St,i as Ze,u as Lt,p as Bt,g as _t,r as Tt}from"./vendor-hooks-Ca2cSNuD.js";import{D as Ht,bV as Ot,J as he,cc as ct}from"./vendor-ux-PO0jFgJf.js";import{aL as Nt}from"./vendor-utils-_C9URqjS.js";import{mediaKitApi as Qt}from"./index-6ovPLp0y.js";import{r as De}from"./index-jIvFgWDS.js";import"./index-DcM4ljaV.js";import"./vendor-arcblock-BVQTtbN-.js";import"./index-D29L5UKE.js";import"./purify.es-HRjpPm7y.js";const ft=oe.createContext({}),pt=()=>oe.useContext(ft);function qt({children:h,restrictions:f,i18n:w,theme:R}){const[x,b]=St({loading:!1}),n=t=>b(a=>({...a,loading:t})),e=oe.useMemo(()=>({...x,onLoading:n,restrictions:f,i18n:w}),[x]);return B.jsx(Ht,{theme:R,children:B.jsx(ft.Provider,{value:e,children:h})})}const Wt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAskSURBVHgB7d3RcdTIGoZhcSJYMoAMIAIgAiACIALIwBCBIQIgA4jAkAEZQAYmAx+6iqnjM+vxjD3qX/qk56niYm92wYve6W790ty5+GMACPCfASCEYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECY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Q7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWECM/wKc/Y0zpWLfuAAAAABJRU5ErkJggg==",Mt=""+window.__toCdnUrl("assets/bedrock-yFRPpe__.png"),Zt=""+window.__toCdnUrl("assets/deepseek-C3x42pq3.png"),Dt=""+window.__toCdnUrl("assets/doubao-yPqHSkLx.png"),Gt=""+window.__toCdnUrl("assets/gemini-DffKpc81.png"),Vt=""+window.__toCdnUrl("assets/google-DT1VSJ0m.png"),jt=""+window.__toCdnUrl("assets/ideogram-REIjy0Er.png"),Ft=""+window.__toCdnUrl("assets/ollama-C7MZn2d_.png"),Yt=""+window.__toCdnUrl("assets/openai-DlpqJdrb.png"),kt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0dSURBVHgB7d1Nb1XXucDxlahAogQUUi6VSG+iQCT7CmJyS0FB5WYQRreT209wP1w7yqhpB3QSKrUgEYWQFkIlLCW4aTASxrGRbRryIqX7OXBSILzY2Od4P2v9ftIRBKkDv5x/13r23us89V2nACTwdAFIQrCANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwqM7J9y+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QgsoIz/AWP7oZ6cDDZCAAAAAElFTkSuQmCC",ge={anthropic:Wt,bedrock:Mt,deepseek:Zt,doubao:Dt,gemini:Gt,google:Vt,ideogram:jt,ollama:Ft,openai:Yt,openrouter:kt,poe:Pt,xai:Ut},Fe={width:16,height:16,borderRadius:"2px",objectFit:"contain",backgroundColor:"transparent"};function Kt({onSubmit:h,models:f}){const{loading:w,i18n:R}=pt(),x=Ze({model:"",prompt:"",number:1}),b=()=>{const t=JSON.parse(JSON.stringify(x));Object.values(x).every(E=>!!E)&&h(t)},{run:n}=Lt(b,{wait:500}),e=oe.useMemo(()=>{const t=JSON.parse(JSON.stringify(x));return Object.values(t).some(a=>!a)},[JSON.stringify(x)]);return B.jsxs(zt,{onSubmit:t=>t.preventDefault(),children:[B.jsxs(z,{sx:{flex:1,height:"100%",overflow:"hidden",flexDirection:"column",display:"flex",mt:2,gap:2},children:[B.jsxs(z,{sx:{mx:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:R("aiImagePrompt")}),B.jsx(gt,{sx:{width:1},size:"small",type:"text",required:!0,placeholder:R("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:x.prompt??"",onChange:t=>{t.stopPropagation(),x.prompt=t.target.value},slotProps:{htmlInput:{maxLength:1e3}}})]}),B.jsxs(z,{sx:{px:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${R("aiImageModel")}`}),B.jsx(ht,{fullWidth:!0,size:"small",children:B.jsx(dt,{sx:{width:1},value:x.model,onChange:t=>{x.number=1,x.model=t.target.value},MenuProps:{disablePortal:!0},renderValue:t=>{const a=f.find(i=>`${i.provider}/${i.model}`===t);return a?B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1},children:[ge[a.provider]&&B.jsx(z,{component:"img",src:ge[a.provider],alt:a.provider,style:Fe}),B.jsx(pe,{variant:"body2",children:a.model})]}):t},children:f.map(t=>B.jsx(Ct,{value:`${t.provider}/${t.model}`,children:B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[ge[t.provider]&&B.jsx(z,{component:"img",src:ge[t.provider],alt:t.provider,style:Fe}),B.jsx(pe,{variant:"body2",sx:{flex:1},children:t.model})]})},`${t.provider}/${t.model}`))})})]})]}),B.jsx(Me,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:n,disabled:w||e,children:R(w?"aiImageGenerating":"aiImageGenerate")},w?"loading-submit":"submit")]})}const zt=ce(z)`
|
|
1
|
+
import{j as B,al as z,T as pe,A as gt,z as ht,bN as dt,M as Ct,R as Me,aT as ce,as as lt,cs as xt,eh as Et,ei as Rt,I as mt,ej as yt,G as bt,a_ as le,ak as wt,a7 as vt}from"./vendor-mui-core-CDEc-eG6.js";import{r as oe,p as je,g as It}from"./vendor-react-DX7tU9aY.js";import{P as St,i as Ze,u as Lt,p as Bt,g as _t,r as Tt}from"./vendor-hooks-Ca2cSNuD.js";import{D as Ht,bV as Ot,J as he,cc as ct}from"./vendor-ux-PO0jFgJf.js";import{aL as Nt}from"./vendor-utils-_C9URqjS.js";import{mediaKitApi as Qt}from"./index-D0mTUcjJ.js";import{r as De}from"./index-jIvFgWDS.js";import"./index-CgSpL7jz.js";import"./vendor-arcblock-BVQTtbN-.js";import"./index-D29L5UKE.js";import"./purify.es-HRjpPm7y.js";const ft=oe.createContext({}),pt=()=>oe.useContext(ft);function qt({children:h,restrictions:f,i18n:w,theme:R}){const[x,b]=St({loading:!1}),n=t=>b(a=>({...a,loading:t})),e=oe.useMemo(()=>({...x,onLoading:n,restrictions:f,i18n:w}),[x]);return B.jsx(Ht,{theme:R,children:B.jsx(ft.Provider,{value:e,children:h})})}const Wt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAAR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SyC9VfVp9jS38xwKDNZhzOT9T+CNdTOXlWdfcxd5aM6ZrKWQ7CG2k+wtd4d3Fb9qI6ZrGVYfbCq33u1pkdx9qncFprJWobVB6tyqb32w/ZtlfNMZrKWYfXB8maGaVWd6ZnJWgZfVQ/EcOgOxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWECM/wKc/Y0zpWLfuAAAAABJRU5ErkJggg==",Mt=""+window.__toCdnUrl("assets/bedrock-yFRPpe__.png"),Zt=""+window.__toCdnUrl("assets/deepseek-C3x42pq3.png"),Dt=""+window.__toCdnUrl("assets/doubao-yPqHSkLx.png"),Gt=""+window.__toCdnUrl("assets/gemini-DffKpc81.png"),Vt=""+window.__toCdnUrl("assets/google-DT1VSJ0m.png"),jt=""+window.__toCdnUrl("assets/ideogram-REIjy0Er.png"),Ft=""+window.__toCdnUrl("assets/ollama-C7MZn2d_.png"),Yt=""+window.__toCdnUrl("assets/openai-DlpqJdrb.png"),kt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0dSURBVHgB7d1Nb1XXucDxlahAogQUUi6VSG+iQCT7CmJyS0FB5WYQRreT209wP1w7yqhpB3QSKrUg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QLCANwQLSECwgDcEC0hAsIA3BAtIQLCANwQLSECwgDcEC0hAsIA3BAtIQLCANwQLSECwgDcEC0vgXkv5P8wQTb/sAAAAASUVORK5CYII=",Pt=""+window.__toCdnUrl("assets/poe-B588TgZu.png"),Ut="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA1dSURBVHgB7d3tbRXXFgbg8dX9T1wBoQPSQejAVBBTgXEFSSogqQBcgdMBdAAdkA6gg3O9kCwhX3POfO5Za+Z5JCdSZBIfO+f1Xnve2XN2uNMBFPCfDqAIgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGw2J1///23e/bsWXd2drb6x6tXrzr6Ozvc6WBHXrx40X348KFb288//9y9f//+29/pxwqLXfnzzz9ThFV48+aNsBrICovduB8FM7i6uur++uuvjmEEFrsRYRWhtbZYVX3+/LljOCMhuxCjYIawCrFvxTgCi82LPas//vijy+D333+3bzWBkZBNi1VVXBXMsLp6/vx59/Hjx47xrLDYtCyj4E8//dTd3t52TCOw2Kx37959+8hAhWEeRkI2KdMoeHl52b19+7ZjOoHFJmmzb5ORkM3J1GY/dVUwS9WiCissNqVam/3ly5c24wcQWGxKpjZ7VBji6uCP/P33393r1687b8H+jIRsRrY2+7Gwiq8zwophBBabUK3NHhcFGE5gUV6sVrIchBdBdSo4v18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6pf5CKyRMrXZs5xkei/LaKgFvz0Ca4S9tNnHylR1mNKC10bPR2ANtLc2+1jZWvBGw20QWAPstc0+VqYWfJxNRn0Ca4C9ttnHynSDdLTgs5z+GlwlHOfscKcDKMAKCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoIz/AWP7oZ6cDDZCAAAAAElFTkSuQmCC",ge={anthropic:Wt,bedrock:Mt,deepseek:Zt,doubao:Dt,gemini:Gt,google:Vt,ideogram:jt,ollama:Ft,openai:Yt,openrouter:kt,poe:Pt,xai:Ut},Fe={width:16,height:16,borderRadius:"2px",objectFit:"contain",backgroundColor:"transparent"};function Kt({onSubmit:h,models:f}){const{loading:w,i18n:R}=pt(),x=Ze({model:"",prompt:"",number:1}),b=()=>{const t=JSON.parse(JSON.stringify(x));Object.values(x).every(E=>!!E)&&h(t)},{run:n}=Lt(b,{wait:500}),e=oe.useMemo(()=>{const t=JSON.parse(JSON.stringify(x));return Object.values(t).some(a=>!a)},[JSON.stringify(x)]);return B.jsxs(zt,{onSubmit:t=>t.preventDefault(),children:[B.jsxs(z,{sx:{flex:1,height:"100%",overflow:"hidden",flexDirection:"column",display:"flex",mt:2,gap:2},children:[B.jsxs(z,{sx:{mx:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:R("aiImagePrompt")}),B.jsx(gt,{sx:{width:1},size:"small",type:"text",required:!0,placeholder:R("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:x.prompt??"",onChange:t=>{t.stopPropagation(),x.prompt=t.target.value},slotProps:{htmlInput:{maxLength:1e3}}})]}),B.jsxs(z,{sx:{px:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${R("aiImageModel")}`}),B.jsx(ht,{fullWidth:!0,size:"small",children:B.jsx(dt,{sx:{width:1},value:x.model,onChange:t=>{x.number=1,x.model=t.target.value},MenuProps:{disablePortal:!0},renderValue:t=>{const a=f.find(i=>`${i.provider}/${i.model}`===t);return a?B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1},children:[ge[a.provider]&&B.jsx(z,{component:"img",src:ge[a.provider],alt:a.provider,style:Fe}),B.jsx(pe,{variant:"body2",children:a.model})]}):t},children:f.map(t=>B.jsx(Ct,{value:`${t.provider}/${t.model}`,children:B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[ge[t.provider]&&B.jsx(z,{component:"img",src:ge[t.provider],alt:t.provider,style:Fe}),B.jsx(pe,{variant:"body2",sx:{flex:1},children:t.model})]})},`${t.provider}/${t.model}`))})})]})]}),B.jsx(Me,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:n,disabled:w||e,children:R(w?"aiImageGenerating":"aiImageGenerate")},w?"loading-submit":"submit")]})}const zt=ce(z)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|