@abtnode/blocklet-services 1.16.47-beta-20250714-035905-f63c5239 → 1.16.47-beta-20250715-034905-11207b15

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.
Files changed (113) hide show
  1. package/api/cache.js +18 -0
  2. package/api/index.js +3 -1
  3. package/api/routes/user.js +39 -24
  4. package/api/services/auth/session.js +26 -1
  5. package/api/util/attach-shared-utils.js +6 -0
  6. package/dist/assets/{access-control-BTl2b0_r.js → access-control-Ccw74KG_.js} +1 -1
  7. package/dist/assets/{add-component-core-BOoCneV-.js → add-component-core-CbHoe5zJ.js} +1 -1
  8. package/dist/assets/{add-resource-BDCkbNIh.js → add-resource-Cq_fc1jD.js} +1 -1
  9. package/dist/assets/{addon-BeC_aHOu.js → addon-DZMRJstX.js} +1 -1
  10. package/dist/assets/{advanced-CHM2QKVn.js → advanced-2-zZxGm_.js} +1 -1
  11. package/dist/assets/{appearance-Clh0JdWn.js → appearance-DpzMSH9F.js} +1 -1
  12. package/dist/assets/{arrow-down.svg-DeuTsvwW.js → arrow-down.svg-CAhyD6_b.js} +1 -1
  13. package/dist/assets/{audit-logs-Bx2GRj51.js → audit-logs-ChoY3Mh6.js} +1 -1
  14. package/dist/assets/{authorize-BfoNT0Qc.js → authorize-CRwwOLYT.js} +1 -1
  15. package/dist/assets/{branding-Mzvrkrgp.js → branding-1Tnui43I.js} +2 -2
  16. package/dist/assets/{branding-BPSId1bW.js → branding-BFlQm__X.js} +1 -1
  17. package/dist/assets/{bundle-avatar-ILqcOXfQ.js → bundle-avatar-cdYjPEnW.js} +1 -1
  18. package/dist/assets/{complete-BTTVqsFH.js → complete-B-DZw0Xp.js} +1 -1
  19. package/dist/assets/{component-CZsqaEGa.js → component-B7p437A9.js} +3 -3
  20. package/dist/assets/{config-pwqw6mKI.js → config-CpnLJaUO.js} +1 -1
  21. package/dist/assets/{config-CsfaL3tp.js → config-CxEXdwoA.js} +1 -1
  22. package/dist/assets/{config-navigation-BScenIA7.js → config-navigation-CU19NqaO.js} +3 -3
  23. package/dist/assets/{config-space-BR2sk-vG.js → config-space-B6WEaHVR.js} +1 -1
  24. package/dist/assets/{confirm-BheJ2Ufd.js → confirm-B0IPtkVS.js} +1 -1
  25. package/dist/assets/{connect-B9pUUEJT.js → connect-BOc7_s4F.js} +1 -1
  26. package/dist/assets/{connect-zmlPofkl.js → connect-NXiMoe1T.js} +1 -1
  27. package/dist/assets/{connect-to-BhkfbcZn.js → connect-to-RFZZSI5s.js} +1 -1
  28. package/dist/assets/{dashboard-BNgYy0di.js → dashboard-ClQmhIHS.js} +3 -3
  29. package/dist/assets/{delete-confirm-CUBrOHBo.js → delete-confirm-DeAivjJv.js} +1 -1
  30. package/dist/assets/{domain-B3eQWEOO.js → domain-Cx4UiImS.js} +1 -1
  31. package/dist/assets/{domain-action-card-CBTVUEnd.js → domain-action-card-BMJauDDL.js} +1 -1
  32. package/dist/assets/{domains-8hb8xbui.js → domains-D8HTnCBf.js} +1 -1
  33. package/dist/assets/{email-BzzQ7YHo.js → email-_MWdgnCs.js} +1 -1
  34. package/dist/assets/engine-C3CQWke3.js +1 -0
  35. package/dist/assets/{exchange-passport-BWzbqk8T.js → exchange-passport-B5Avk2mv.js} +1 -1
  36. package/dist/assets/{form-DpZdkoSu.js → form-Cfox3G5b.js} +1 -1
  37. package/dist/assets/{fuel-DxwQFDm7.js → fuel--qkuIoAW.js} +1 -1
  38. package/dist/assets/{gen-access-key-Ohdhh-5N.js → gen-access-key-B4DsFFIf.js} +1 -1
  39. package/dist/assets/{get-safe-url-OoUcjrQf.js → get-safe-url-Cch2GZCp.js} +1 -1
  40. package/dist/assets/{home-BxrggRGV.js → home-DIigPTxS.js} +1 -1
  41. package/dist/assets/{iframe-DhNKb9Jt.js → iframe-CQ_bWNrw.js} +1 -1
  42. package/dist/assets/{index-BGaB1moG.js → index-8pSMU0so.js} +1 -1
  43. package/dist/assets/{index-DmO-2vsC.js → index-BEq2q2jr.js} +1 -1
  44. package/dist/assets/{index-kNB6-E_A.js → index-B_4qd0Ji.js} +1 -1
  45. package/dist/assets/{index-BbEkQqX9.js → index-BcuyH8tS.js} +3 -3
  46. package/dist/assets/{index-C3Oin-rp.js → index-Bo6LJIBD.js} +1 -1
  47. package/dist/assets/{index-C3_BZaQ8.js → index-BpL1e-bN.js} +1 -1
  48. package/dist/assets/{index-B-8dOK-Y.js → index-BsdYXeYP.js} +1 -1
  49. package/dist/assets/{index-Cs05i-2B.js → index-Bv6qc7SO.js} +1 -1
  50. package/dist/assets/{index-D395izvx.js → index-C4mYBCsd.js} +1 -1
  51. package/dist/assets/{index-Cg6pvT4l.js → index-CQb3b4r6.js} +1 -1
  52. package/dist/assets/{index-O-lXWVIy.js → index-CSSFAW5K.js} +1 -1
  53. package/dist/assets/{index-CorCl-pq.js → index-ChVoQcrO.js} +1 -1
  54. package/dist/assets/{index-DU3TZEl3.js → index-CjiaOjxw.js} +1 -1
  55. package/dist/assets/{index-DS5fiq8O.js → index-CnoeBPbk.js} +1 -1
  56. package/dist/assets/{index-BuVnqwoA.js → index-CzB-WPWn.js} +1 -1
  57. package/dist/assets/{index-DZWmwO2T.js → index-D1bv9ooM.js} +1 -1
  58. package/dist/assets/{index-BqnBQH2g.js → index-D27Eda5K.js} +1 -1
  59. package/dist/assets/{index-DUDL3BD9.js → index-DEPyMifK.js} +1 -1
  60. package/dist/assets/{index-Cv05o3sv.js → index-DawEtQPD.js} +1 -1
  61. package/dist/assets/{index-B0W6E--0.js → index-DdCAwzrE.js} +1 -1
  62. package/dist/assets/{index-DKMFPAvn.js → index-b_dnNRMF.js} +2 -2
  63. package/dist/assets/{index-1KOtJL2Z.js → index-dIkcxCDN.js} +61 -61
  64. package/dist/assets/{index-CHGxveAN.js → index-pq4T68Se.js} +4 -4
  65. package/dist/assets/{index-DbGh6qKc.js → index-thbUUXKQ.js} +1 -1
  66. package/dist/assets/{invitation-CT4PmJ8m.js → invitation-D4tu3NNd.js} +1 -1
  67. package/dist/assets/{invite-DckurcYp.js → invite-DdCiERzE.js} +1 -1
  68. package/dist/assets/{issue-passport-C1XqnwRq.js → issue-passport-CmU7CVx7.js} +1 -1
  69. package/dist/assets/{item-COV9xs9_.js → item-7fmoiGq1.js} +1 -1
  70. package/dist/assets/{landing-page-BEJgKdih.js → landing-page-DrswynDN.js} +1 -1
  71. package/dist/assets/{layout-BaT-7chZ.js → layout-u6VjgU9W.js} +1 -1
  72. package/dist/assets/{list-yYy6WE3K.js → list-DLQOcQSS.js} +2 -2
  73. package/dist/assets/{list-51eHRDeU.js → list-s4SRm3p5.js} +1 -1
  74. package/dist/assets/{localization-CpB2cS1V.js → localization-CJSvysj8.js} +1 -1
  75. package/dist/assets/{log-BwgRDuS2.js → log-BCe-iHkk.js} +1 -1
  76. package/dist/assets/login-CJ9QT17a.js +1 -0
  77. package/dist/assets/{login-oauth-callback-uUI5nP9s.js → login-oauth-callback-Bn54mlE7.js} +1 -1
  78. package/dist/assets/{logo-uploader-Ds-ORNyZ.js → logo-uploader-Cct_Tgp9.js} +2 -2
  79. package/dist/assets/{lost-passport-Cutdtz69.js → lost-passport-JFuuT2LW.js} +1 -1
  80. package/dist/assets/{open-window-YipQlD-R.js → open-window-okQkGylu.js} +1 -1
  81. package/dist/assets/{over-due-invoice-payment-BBHQI0Py.js → over-due-invoice-payment-CorS-0Po.js} +1 -1
  82. package/dist/assets/{overview-LHE9mcVq.js → overview-CDbOiDio.js} +1 -1
  83. package/dist/assets/{passport-item-DGHxcu69.js → passport-item-BejfMK1X.js} +1 -1
  84. package/dist/assets/{permission-CkJCud9p.js → permission-B4PsiDVD.js} +1 -1
  85. package/dist/assets/{preferences-Dt_WlI3m.js → preferences-DmEdhu1e.js} +1 -1
  86. package/dist/assets/{profile-embed-DxhFRKuy.js → profile-embed-BK2tobXZ.js} +1 -1
  87. package/dist/assets/{publish-resource-CSCAzPp8.js → publish-resource-M4It07oz.js} +1 -1
  88. package/dist/assets/{runtime-CN3ZLyoC.js → runtime-DaXsDIcp.js} +1 -1
  89. package/dist/assets/sdk-CzxAlOgp.js +1 -0
  90. package/dist/assets/{security-CUVhaPjm.js → security-BGWWSAkV.js} +1 -1
  91. package/dist/assets/{session-CRCJ7U0D.js → session-DgH_dTEB.js} +1 -1
  92. package/dist/assets/{setup-d7D4B5vR.js → setup-9fDp38sd.js} +3 -3
  93. package/dist/assets/{spaces-Dd-MKcUF.js → spaces-CISW823t.js} +1 -1
  94. package/dist/assets/{start-BYakq8hm.js → start-BtjRI2FT.js} +1 -1
  95. package/dist/assets/{status-D2qmTwnQ.js → status-kBSo0EE3.js} +1 -1
  96. package/dist/assets/{step-actions-BZumDL_w.js → step-actions-CSysf55Z.js} +1 -1
  97. package/dist/assets/{studio-ZCHXWZLi.js → studio-DRi8O4nl.js} +1 -1
  98. package/dist/assets/{team-03A1FYUk.js → team-DA9xMdEQ.js} +1 -1
  99. package/dist/assets/{traffic-haCt0cSP.js → traffic-BQj5L64I.js} +1 -1
  100. package/dist/assets/{transfer-C66TnWBB.js → transfer-DQ-esQ54.js} +1 -1
  101. package/dist/assets/{unsubscribe-S9W0FpYV.js → unsubscribe-dC1x4NuC.js} +1 -1
  102. package/dist/assets/{user-center-9kkvIb0O.js → user-center-Dx-CKzHU.js} +3 -3
  103. package/dist/assets/{user-sessions-qOf0SwzW.js → user-sessions-CP2hMWvQ.js} +1 -1
  104. package/dist/assets/{util-rixYG6Oq.js → util-Cn9ZyU8l.js} +1 -1
  105. package/dist/assets/{util-ChXKYX5P.js → util-DLU48yb8.js} +1 -1
  106. package/dist/assets/{wrap-locale-B_DF88uA.js → wrap-locale-DOTYikON.js} +1 -1
  107. package/dist/assets/{zh-CX7yQ7kK.js → zh-BcwVs5BX.js} +1 -1
  108. package/dist/index.html +1 -1
  109. package/dist/service-worker.js +1 -1
  110. package/package.json +39 -39
  111. package/dist/assets/engine-BDb0Jr8Z.js +0 -1
  112. package/dist/assets/login-CHIxp76E.js +0 -1
  113. package/dist/assets/sdk-iEtxKj9x.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BbEkQqX9.js","assets/index-1KOtJL2Z.js","assets/vendor-mui-core-BwwTYUH3.js","assets/vendor-react-x2lQvn4m.js","assets/vendor-ux-BglKGRhr.js","assets/vendor-utils-DQY0X1ND.js","assets/vendor-hooks-uwq5Zgdd.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-BEuhHuNQ.js","assets/index-DrVXX4fX.css","assets/index-MGxe3V9B.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
- import{r as k,i as Et,j as nt,L as we,g as go,k as Ns,l as _s,m as bt}from"./vendor-react-x2lQvn4m.js";import{J as Oe,j as e,ak as a,b4 as Pt,W as r,am as ke,I as ce,dz as Ws,dA as Os,c9 as ko,cd as rt,dB as zs,a_ as Bs,T as A,s as jo,dC as yo,dD as Vs,cM as Us,Y as lt,at as ve,av as Ms,dE as Fs,a5 as Ye,aX as it,bc as Lt,c6 as Hs,bf as Js,b6 as Ze,d6 as Gs,bg as et,Q as X,a6 as Se,c0 as Xs,O as wo,K as vo,P as $t,ai as Co,o as Ro,M as be,a3 as Ks,bB as So,$ as To,bv as Ys,A as He,aJ as Zs,R as Do,z as re,b1 as Re,dF as Kt,bR as tt,dG as Io,V as Eo,S as At,aP as Po,bC as Qs,D as Lo,cs as en,aQ as tn,aR as on,ct as sn,cu as nn,bH as $o,aq as rn,dH as ln,a1 as Ao,a0 as ot,bi as Yt,bE as cn,bF as an,dI as dn,dJ as un,bb as Ct,y as pn,F as hn,bp as mn,bq as ft}from"./vendor-mui-core-BwwTYUH3.js";import{c as F,O as ge,Z as De,$ as bn,M as me,c3 as fn,N as xn,f as Zt,c4 as gn,c5 as Qt,ai as We,a_ as kn,bD as jn,c6 as yn,c7 as wn,c8 as vn}from"./index-1KOtJL2Z.js";import{T as G,L as qo,q as Cn,n as $e,a0 as No,z as _o,M as Rn,D as qt,H as W,A as Nt,aP as _t,I as ae,_ as Wo,a as ct,h as Oo}from"./vendor-ux-BglKGRhr.js";import{C as at}from"./confirm-BheJ2Ufd.js";import{u as ze}from"./session-CRCJ7U0D.js";import{W as Rt}from"./did-address-D7SiJUQw.js";import{E as Je}from"./empty-spinner-DoD2SObf.js";import{B as Wt}from"./bundle-avatar-ILqcOXfQ.js";import{S as Te}from"./shorten-label-BG5illgA.js";import{L as Ot}from"./list-header-BROuC1JD.js";import{K as Sn,C as ue,A as zt,D as zo}from"./vendor-utils-DQY0X1ND.js";import{C as Bo}from"./click-to-copy-DPQ0tcO7.js";import{t as Tn}from"./question-mark-circle.svg-YsMacl4Q.js";import{l as Dn,b as In}from"./vendor-hooks-uwq5Zgdd.js";import{u as Me}from"./useSetState-BWrXo9eH.js";import{e as En}from"./engine-BDb0Jr8Z.js";import"./api-CpymM8cn.js";import{T as Pn,S as Ln}from"./vendor-mui-x-DDx3HEvj.js";import{D as eo,C as to,P as oo}from"./react-beautiful-dnd.esm-ByowwdW2.js";import{c as $n,A as Vo,u as Uo,S as An,U as qn,r as Nn}from"./item-COV9xs9_.js";import{f as xe}from"./index-DBs9Ljax.js";import{D as _n}from"./delete-confirm-CUBrOHBo.js";import{g as Mo}from"./get-safe-url-OoUcjrQf.js";import{u as Le}from"./index-Dhyyek4_.js";import{M as Wn}from"./index-BEyKlMs9.js";import{r as On}from"./index-C5pKXOxF.js";import"./vendor-arcblock-BEuhHuNQ.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-BZ5FB5HD.js";function Bt({did:t,projectId:o,title:s,logo:n,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${n}`,[d,u]=k.useState(!1),f=Oe(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(Pt,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||d?"primary.main":"grey.700"},children:l||"/"})]})]})}Bt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function Fo({initUrl:t=null}){const o=Et(),s=t?.searchParams.get("tenantScope")||"",{t:n,locale:l}=G(),{api:c}=ge(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:f}=De(),[p,m]=k.useState(null),[x,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=nt(),[g,C]=k.useState(null),D=`publish-${f.meta.did}`,R=qo(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:f.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},L=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=Cn.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.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(Je,{})});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:n("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:n("blocklet.publish.createBlockletTip")}),e.jsx($e,{onClick:N,variant:"contained",children:n("blocklet.publish.createBlocklet")})]});const Z=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(Bt,{did:f.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(No,{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:n("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Rt,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:n("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(f.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(Wt,{size:14,blocklet:I,ancestors:[f]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:n("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:n("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(_o,{value:Number(E),locale:l})}},{label:n("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(ke,{title:n("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Ws,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(ke,{title:n("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(Os,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:n("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(ko,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=x?e.jsx(bn,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:L,extraParams:{projectId:p.id,did:f.meta.did,name:p.blockletTitle},messages:{title:n("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:n("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:n("blocklet.publish.deleteProject.confirm"),success:n("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(zn,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("common.blockletStudio")}),e.jsx(ke,{title:n("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(zs,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Rn,{options:{searchPlaceholder:n("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs($e,{onClick:N,variant:"contained",children:[e.jsx(rt,{style:{fontSize:"1.3em",marginRight:4}}),n("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{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:D,onChange:H}),p&&e.jsx(at,{title:`${n("common.delete")} ${p.blockletTitle}`,description:n("blocklet.publish.deleteProject.description"),confirm:n("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[n("blocklet.publish.deleteProject.tip1"),n("blocklet.publish.deleteProject.tip2"),n("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Bs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const zn=jo(a)`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BcuyH8tS.js","assets/index-dIkcxCDN.js","assets/vendor-mui-core-BwwTYUH3.js","assets/vendor-react-x2lQvn4m.js","assets/vendor-ux-BglKGRhr.js","assets/vendor-utils-DQY0X1ND.js","assets/vendor-hooks-uwq5Zgdd.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-BEuhHuNQ.js","assets/index-DrVXX4fX.css","assets/index-MGxe3V9B.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
+ import{r as k,i as Et,j as nt,L as we,g as go,k as Ns,l as _s,m as bt}from"./vendor-react-x2lQvn4m.js";import{J as Oe,j as e,ak as a,b4 as Pt,W as r,am as ke,I as ce,dz as Ws,dA as Os,c9 as ko,cd as rt,dB as zs,a_ as Bs,T as A,s as jo,dC as yo,dD as Vs,cM as Us,Y as lt,at as ve,av as Ms,dE as Fs,a5 as Ye,aX as it,bc as Lt,c6 as Hs,bf as Js,b6 as Ze,d6 as Gs,bg as et,Q as X,a6 as Se,c0 as Xs,O as wo,K as vo,P as $t,ai as Co,o as Ro,M as be,a3 as Ks,bB as So,$ as To,bv as Ys,A as He,aJ as Zs,R as Do,z as re,b1 as Re,dF as Kt,bR as tt,dG as Io,V as Eo,S as At,aP as Po,bC as Qs,D as Lo,cs as en,aQ as tn,aR as on,ct as sn,cu as nn,bH as $o,aq as rn,dH as ln,a1 as Ao,a0 as ot,bi as Yt,bE as cn,bF as an,dI as dn,dJ as un,bb as Ct,y as pn,F as hn,bp as mn,bq as ft}from"./vendor-mui-core-BwwTYUH3.js";import{c as F,O as ge,Z as De,$ as bn,M as me,c3 as fn,N as xn,f as Zt,c4 as gn,c5 as Qt,ai as We,a_ as kn,bD as jn,c6 as yn,c7 as wn,c8 as vn}from"./index-dIkcxCDN.js";import{T as G,L as qo,q as Cn,n as $e,a0 as No,z as _o,M as Rn,D as qt,H as W,A as Nt,aP as _t,I as ae,_ as Wo,a as ct,h as Oo}from"./vendor-ux-BglKGRhr.js";import{C as at}from"./confirm-B0IPtkVS.js";import{u as ze}from"./session-DgH_dTEB.js";import{W as Rt}from"./did-address-D7SiJUQw.js";import{E as Je}from"./empty-spinner-DoD2SObf.js";import{B as Wt}from"./bundle-avatar-cdYjPEnW.js";import{S as Te}from"./shorten-label-BG5illgA.js";import{L as Ot}from"./list-header-BROuC1JD.js";import{K as Sn,C as ue,A as zt,D as zo}from"./vendor-utils-DQY0X1ND.js";import{C as Bo}from"./click-to-copy-DPQ0tcO7.js";import{t as Tn}from"./question-mark-circle.svg-YsMacl4Q.js";import{l as Dn,b as In}from"./vendor-hooks-uwq5Zgdd.js";import{u as Me}from"./useSetState-BWrXo9eH.js";import{e as En}from"./engine-C3CQWke3.js";import"./api-CpymM8cn.js";import{T as Pn,S as Ln}from"./vendor-mui-x-DDx3HEvj.js";import{D as eo,C as to,P as oo}from"./react-beautiful-dnd.esm-ByowwdW2.js";import{c as $n,A as Vo,u as Uo,S as An,U as qn,r as Nn}from"./item-7fmoiGq1.js";import{f as xe}from"./index-DBs9Ljax.js";import{D as _n}from"./delete-confirm-DeAivjJv.js";import{g as Mo}from"./get-safe-url-Cch2GZCp.js";import{u as Le}from"./index-Dhyyek4_.js";import{M as Wn}from"./index-BEyKlMs9.js";import{r as On}from"./index-C5pKXOxF.js";import"./vendor-arcblock-BEuhHuNQ.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-BZ5FB5HD.js";function Bt({did:t,projectId:o,title:s,logo:n,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${n}`,[d,u]=k.useState(!1),f=Oe(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(Pt,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||d?"primary.main":"grey.700"},children:l||"/"})]})]})}Bt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function Fo({initUrl:t=null}){const o=Et(),s=t?.searchParams.get("tenantScope")||"",{t:n,locale:l}=G(),{api:c}=ge(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:f}=De(),[p,m]=k.useState(null),[x,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=nt(),[g,C]=k.useState(null),D=`publish-${f.meta.did}`,R=qo(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:f.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},L=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=Cn.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.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(Je,{})});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:n("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:n("blocklet.publish.createBlockletTip")}),e.jsx($e,{onClick:N,variant:"contained",children:n("blocklet.publish.createBlocklet")})]});const Z=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(Bt,{did:f.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(No,{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:n("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Rt,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:n("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(f.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(Wt,{size:14,blocklet:I,ancestors:[f]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:n("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:n("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(_o,{value:Number(E),locale:l})}},{label:n("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(ke,{title:n("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Ws,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(ke,{title:n("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(Os,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:n("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(ko,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=x?e.jsx(bn,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:L,extraParams:{projectId:p.id,did:f.meta.did,name:p.blockletTitle},messages:{title:n("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:n("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:n("blocklet.publish.deleteProject.confirm"),success:n("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(zn,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("common.blockletStudio")}),e.jsx(ke,{title:n("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(zs,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Rn,{options:{searchPlaceholder:n("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs($e,{onClick:N,variant:"contained",children:[e.jsx(rt,{style:{fontSize:"1.3em",marginRight:4}}),n("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{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:D,onChange:H}),p&&e.jsx(at,{title:`${n("common.delete")} ${p.blockletTitle}`,description:n("blocklet.publish.deleteProject.description"),confirm:n("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[n("blocklet.publish.deleteProject.tip1"),n("blocklet.publish.deleteProject.tip2"),n("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Bs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const zn=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,i as Et,j as nt,L as we,g as go,k as Ns,l as _s,m as bt}from"./ven
142
142
  background: #fff;
143
143
  z-index: 10;
144
144
  }
145
- `,ao="lastWantToConnectStoreId";function or(t){const[o,s]=k.useState(null),{session:n}=ze(),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 f=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==n?.user?.did));return f||(f=t?.settings?.storeList?.[0]),f},[t?.settings?.storeList,n?.user?.did]);return[o||c||{},l]}const vt={};async function Vt(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:n=4e3,timerKey:l=""}){vt[l]&&clearTimeout(vt[l]),await new Promise(d=>setTimeout(d,n));const c=Date.now(),i=async(d,u)=>{try{const f=await t();d(f)}catch(f){Date.now()-c>s?u(f):l?vt[l]=setTimeout(()=>i(d,u),o):setTimeout(()=>i(d,u),o)}};return new Promise(i)}function sr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function nr(t,{did:o,projectId:s,messageId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:n}});if(!l?.project?.blockletDid)throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function rr(t,{did:o,projectId:s,storeId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!l?.project?.connectedStores?.length)throw new Error("Connected store not found");if(!l.project.connectedStores.find(i=>i.storeId===n))throw new Error("Connected store not found")},{timerKey:`connect-store-${n}`})}function lr(t,{did:o,projectId:s,endpointId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!l?.project?.connectedEndpoints?.length)throw new Error("Connected endpoint not found");if(!l.project.connectedEndpoints.find(i=>i.endpointId===n))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${n}`})}const Ut=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:n})=>{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||!i.scope||i.scope==="studio"||i.scope===n),{teamDid:l,storeList:c}};function os({blocklet:t=null,store:o=null,onChangeStore:s,onClick:n,disabled:l,loading:c,componentDid:i}){const{t:d}=G(),{session:u}=ze(),{api:f,info:p,inService:m}=ge(),x=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=L=>{s(L),h(!1)},y=()=>{h(!b)},T=L=>{j.current&&j.current.contains(L.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await x?.actions?.refreshBlocklet()}catch(L){W.error(`Remove Blocklet Store Error: ${xe(L)}`)}finally{D(null)}},{storeList:K}=Ut({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(X,{onClick:n,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(X,{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:L})=>e.jsx(vo,{...L,style:{transformOrigin:"center top"},children:e.jsx($t,{children:e.jsx(Co,{onClickAway:T,children:e.jsxs(Ro,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),$n({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Ks,{}),e.jsxs(be,{onClick:O,children:[e.jsx(rt,{font:!0}),e.jsx(A,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Vo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:x?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}os.propTypes={store:r.object,blocklet:r.object,onChangeStore:r.func.isRequired,onClick:r.func.isRequired,loading:r.bool.isRequired,disabled:r.bool.isRequired,componentDid:r.string.isRequired,projectType:r.string.isRequired,getData:r.func.isRequired};const ss=(t,o,s)=>{const n=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${n}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:n,uploadScreenshotPrefix:l}},ir=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:n=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=${n}&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(A,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Mt.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};function ns({setParams:t,onClose:o,params:s}){const{t:n}=G(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=ir(l),u=()=>{t(f=>{const p=[...f.blockletVideos];return p.push(l),{...f,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(So,{children:n("studio.videoDialogTitle")}),e.jsxs(To,{children:[e.jsx(Ys,{fullWidth:!0,value:l,onChange:f=>c(f.target.value),placeholder:n("studio.videoInputLabel"),endAdornment:l?e.jsx(He,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Zs,{})})}):null,error:i}),i&&e.jsx(A,{variant:"body2",color:"error",children:n("studio.duplicateVideo")}),e.jsx(Mt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Do,{children:[e.jsx(X,{onClick:()=>o(),children:n("studio.cancel")}),e.jsx(X,{disabled:!d||i,onClick:u,children:n("studio.confirm")})]})]})}ns.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function St({errors:t,storeList:o,...s}){const{t:n}=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(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:n("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(ke,{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:r.object.isRequired,storeList:r.array.isRequired};const uo=k.lazy(()=>Wo(()=>import("./index-BbEkQqX9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function rs({projectId:t,readOnly:o,loading:s,blocklet:n,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:f,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:x,componentDid:b=""}){const{t:h,locale:j}=G(),{api:v}=ge(),g=Et(),C=k.useRef(null),D=k.useRef(null),[R,y]=or(n),[T,O]=k.useState(!1),N=Uo({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),z=async q=>{const Y=setTimeout(()=>{f(!1)},2e4),J=await nr(v,q);f(!1),clearTimeout(Y),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=sr();N(async(Y,J)=>{try{const se=await v.connectByStudio({input:{did:n?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:n?.meta?.did,projectId:"",messageId:q})}catch(se){const de=xe(se);W.error(de),f(!1)}})},{logoUrl:P,screenshotUrls:L,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ss(l,n,t),{logoErrors:Z,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Y=Array.from(l.blockletScreenshots),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Y}))},ee=q=>{if(!q.destination)return;const Y=Array.from(l.blockletVideos),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Y}))};return e.jsxs(cr,{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:q=>{d({blockletTitle:""}),c({blockletTitle:q.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===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(He,{position:"end",children:e.jsx(os,{blocklet:n,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),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:q=>{d({blockletDescription:""}),c({blockletDescription:q.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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.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:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.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(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{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(Pt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(St,{errors:Z,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{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:U,children:e.jsx(to,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.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:[L.map((J,se)=>e.jsx(oo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.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:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Kt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,L.length<5&&e.jsx(a,{onClick:()=>{V()&&D.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:"+"})]})})})]}),I&&e.jsx(St,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{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:ee,children:e.jsx(to,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.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((J,se)=>e.jsx(oo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.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:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Kt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!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(Je,{}),children:[e.jsx(uo,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),x(""),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(ns,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(uo,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Y=>{const J=Y.blockletScreenshots||[];return J.push(q.data?.filename),{...Y,blockletScreenshots:J}}),D.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-L.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")]})]})}rs.propTypes={projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,setLoading:r.func.isRequired,initUrl:r.object,componentDid:r.string,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const cr=ve.div`
145
+ `,ao="lastWantToConnectStoreId";function or(t){const[o,s]=k.useState(null),{session:n}=ze(),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 f=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==n?.user?.did));return f||(f=t?.settings?.storeList?.[0]),f},[t?.settings?.storeList,n?.user?.did]);return[o||c||{},l]}const vt={};async function Vt(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:n=4e3,timerKey:l=""}){vt[l]&&clearTimeout(vt[l]),await new Promise(d=>setTimeout(d,n));const c=Date.now(),i=async(d,u)=>{try{const f=await t();d(f)}catch(f){Date.now()-c>s?u(f):l?vt[l]=setTimeout(()=>i(d,u),o):setTimeout(()=>i(d,u),o)}};return new Promise(i)}function sr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function nr(t,{did:o,projectId:s,messageId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:n}});if(!l?.project?.blockletDid)throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function rr(t,{did:o,projectId:s,storeId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!l?.project?.connectedStores?.length)throw new Error("Connected store not found");if(!l.project.connectedStores.find(i=>i.storeId===n))throw new Error("Connected store not found")},{timerKey:`connect-store-${n}`})}function lr(t,{did:o,projectId:s,endpointId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!l?.project?.connectedEndpoints?.length)throw new Error("Connected endpoint not found");if(!l.project.connectedEndpoints.find(i=>i.endpointId===n))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${n}`})}const Ut=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:n})=>{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||!i.scope||i.scope==="studio"||i.scope===n),{teamDid:l,storeList:c}};function os({blocklet:t=null,store:o=null,onChangeStore:s,onClick:n,disabled:l,loading:c,componentDid:i}){const{t:d}=G(),{session:u}=ze(),{api:f,info:p,inService:m}=ge(),x=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=L=>{s(L),h(!1)},y=()=>{h(!b)},T=L=>{j.current&&j.current.contains(L.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await x?.actions?.refreshBlocklet()}catch(L){W.error(`Remove Blocklet Store Error: ${xe(L)}`)}finally{D(null)}},{storeList:K}=Ut({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(X,{onClick:n,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(X,{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:L})=>e.jsx(vo,{...L,style:{transformOrigin:"center top"},children:e.jsx($t,{children:e.jsx(Co,{onClickAway:T,children:e.jsxs(Ro,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),$n({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Ks,{}),e.jsxs(be,{onClick:O,children:[e.jsx(rt,{font:!0}),e.jsx(A,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Vo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:x?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}os.propTypes={store:r.object,blocklet:r.object,onChangeStore:r.func.isRequired,onClick:r.func.isRequired,loading:r.bool.isRequired,disabled:r.bool.isRequired,componentDid:r.string.isRequired,projectType:r.string.isRequired,getData:r.func.isRequired};const ss=(t,o,s)=>{const n=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${n}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:n,uploadScreenshotPrefix:l}},ir=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:n=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=${n}&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(A,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Mt.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};function ns({setParams:t,onClose:o,params:s}){const{t:n}=G(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=ir(l),u=()=>{t(f=>{const p=[...f.blockletVideos];return p.push(l),{...f,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(So,{children:n("studio.videoDialogTitle")}),e.jsxs(To,{children:[e.jsx(Ys,{fullWidth:!0,value:l,onChange:f=>c(f.target.value),placeholder:n("studio.videoInputLabel"),endAdornment:l?e.jsx(He,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Zs,{})})}):null,error:i}),i&&e.jsx(A,{variant:"body2",color:"error",children:n("studio.duplicateVideo")}),e.jsx(Mt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Do,{children:[e.jsx(X,{onClick:()=>o(),children:n("studio.cancel")}),e.jsx(X,{disabled:!d||i,onClick:u,children:n("studio.confirm")})]})]})}ns.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function St({errors:t,storeList:o,...s}){const{t:n}=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(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:n("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(ke,{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:r.object.isRequired,storeList:r.array.isRequired};const uo=k.lazy(()=>Wo(()=>import("./index-BcuyH8tS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function rs({projectId:t,readOnly:o,loading:s,blocklet:n,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:f,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:x,componentDid:b=""}){const{t:h,locale:j}=G(),{api:v}=ge(),g=Et(),C=k.useRef(null),D=k.useRef(null),[R,y]=or(n),[T,O]=k.useState(!1),N=Uo({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),z=async q=>{const Y=setTimeout(()=>{f(!1)},2e4),J=await nr(v,q);f(!1),clearTimeout(Y),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=sr();N(async(Y,J)=>{try{const se=await v.connectByStudio({input:{did:n?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:n?.meta?.did,projectId:"",messageId:q})}catch(se){const de=xe(se);W.error(de),f(!1)}})},{logoUrl:P,screenshotUrls:L,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ss(l,n,t),{logoErrors:Z,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Y=Array.from(l.blockletScreenshots),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Y}))},ee=q=>{if(!q.destination)return;const Y=Array.from(l.blockletVideos),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Y}))};return e.jsxs(cr,{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:q=>{d({blockletTitle:""}),c({blockletTitle:q.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===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(He,{position:"end",children:e.jsx(os,{blocklet:n,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),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:q=>{d({blockletDescription:""}),c({blockletDescription:q.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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.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:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.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(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{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(Pt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(St,{errors:Z,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{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:U,children:e.jsx(to,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.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:[L.map((J,se)=>e.jsx(oo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.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:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Kt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,L.length<5&&e.jsx(a,{onClick:()=>{V()&&D.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:"+"})]})})})]}),I&&e.jsx(St,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{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:ee,children:e.jsx(to,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.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((J,se)=>e.jsx(oo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.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:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Kt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!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(Je,{}),children:[e.jsx(uo,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),x(""),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(ns,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(uo,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Y=>{const J=Y.blockletScreenshots||[];return J.push(q.data?.filename),{...Y,blockletScreenshots:J}}),D.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-L.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")]})]})}rs.propTypes={projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,setLoading:r.func.isRequired,initUrl:r.object,componentDid:r.string,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const cr=ve.div`
146
146
  margin-top: 24px;
147
147
  .screenshot {
148
148
  margin-bottom: 16px;
@@ -190,7 +190,7 @@ import{r as k,i as Et,j as nt,L as we,g as go,k as Ns,l as _s,m as bt}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}=Lo();return t?e.jsx(Wn,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:jn.sanitize(t),rehypePlugins:[[On,{target:"_blank"}]]}):e.jsx(Fe,{Icon:_t})}xs.propTypes={text:r.string.isRequired};function gs({params:t,setParams:o,paramsErrTip:s,loading:n,setParamsErrTip:l,readOnly:c}){const{t:i}=G(),[d,u]=k.useState(c?"preview":"write"),f=(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(A,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Ao,{value:d,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(re,{disabled:n||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(He,{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:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired};function ks({step:t=0,ok:o=!1,active:s=0,error:n="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx($o,{sx:{fontSize:18,margin:0},color:"white"})),n||!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:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};function js({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:n=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:f}){const{t:p}=G(),m=()=>{s(j=>j+1)},x=()=>{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:f,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(cn,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!hr({params:l,projectId:f,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(an,{children:[e.jsx(dn,{icon:e.jsx(ks,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(un,{children:[e.jsx(A,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(X,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(X,{disabled:v===0,onClick:x,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx($t,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}js.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.oneOfType([r.string,r.bool]),loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.oneOfType([r.string,r.bool]),warning:r.object.isRequired,paramsErrTip:r.shape({projectId:r.string,blockletVersion:r.string,blockletTitle:r.string,blockletDescription:r.string,note:r.string,blockletResource:r.string,blockletHomepage:r.string,blockletSupport:r.string,blockletCommunity:r.string,blockletRepository:r.string,blockletDocker:r.object,dockerImageName:r.string}).isRequired};const br=[".zip",".gz"],fr=1024*1024*100,xr=k.lazy(()=>Wo(()=>import("./index-BbEkQqX9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ys({app:t,projectId:o,readOnly:s,params:n,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=G(),f=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!n.uploadedResource&&e.jsx(A,{component:"a",href:`${m}/params.uploadedResource`,children:n.uploadedResource}),!s&&e.jsx(X,{variant:"outlined",size:"small",onClick:()=>{p()&&f.current?.open()},children:n.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Je,{}),children:e.jsx(xr,{ref:f,locale:u,popup:!0,onUploadFinish:x=>{l({uploadedResource:x.data.filename}),c({blockletResource:""}),f.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:br,maxFileSize:fr,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ys.propTypes={app:r.object.isRequired,projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired};function Dt({readOnly:t,params:o,setParams:s,paramsErrTip:n,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:!!n.blockletVersion,helperText:n.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:!!n.note,helperText:n.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(He,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Dt.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,loading:r.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 gr=Nn();const oe=go(gr),kr={"-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"},Ft={"--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},jr={"--volume":!0,"--publish":!0},yr=new Set(["--publish","--volume"]),vs=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function wr(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,...n]=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,...n].join(":")}})}function vr(t){let o=!0;return t.find(n=>n.key==="--publish"&&n.type==="web")?t.map(n=>{if(n.key==="--publish"){const l={...n,type:o?"docker":n.type};return o=n.type==="web",l}return n}):t.map(n=>{if(n.key==="--publish"){const l={...n,type:o?"web":"docker"};return o=!1,l}return n})}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 n=[],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]||"",[x,...b]=m.split("=");if(x){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:x,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let x=p,b=null;m!==-1&&(x=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=kr[x];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,n.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),n.push({key:h,value:j}),c+=2;continue}else{n.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){n.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");n.push({key:h,value:j}),c+=2;continue}else{n.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const f=[];for(const p of n)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(yr.has(p.key)&&p.value==="true")&&f.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:vr(wr(f)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function Cr({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:n}){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 f=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${f} \\`)}else if(!l.some(f=>f.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const f=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${f} \\`)}}for(const i of o){const{key:d,value:u}=i,f=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${f} \\`)}return s&&l.push(` ${s} \\`),n&&l.push(` ${n} \\`),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}=Lo();return t?e.jsx(Wn,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:jn.sanitize(t),rehypePlugins:[[On,{target:"_blank"}]]}):e.jsx(Fe,{Icon:_t})}xs.propTypes={text:r.string.isRequired};function gs({params:t,setParams:o,paramsErrTip:s,loading:n,setParamsErrTip:l,readOnly:c}){const{t:i}=G(),[d,u]=k.useState(c?"preview":"write"),f=(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(A,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Ao,{value:d,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(re,{disabled:n||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(He,{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:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired};function ks({step:t=0,ok:o=!1,active:s=0,error:n="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx($o,{sx:{fontSize:18,margin:0},color:"white"})),n||!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:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};function js({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:n=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:f}){const{t:p}=G(),m=()=>{s(j=>j+1)},x=()=>{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:f,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(cn,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!hr({params:l,projectId:f,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(an,{children:[e.jsx(dn,{icon:e.jsx(ks,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(un,{children:[e.jsx(A,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(X,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(X,{disabled:v===0,onClick:x,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx($t,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}js.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.oneOfType([r.string,r.bool]),loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.oneOfType([r.string,r.bool]),warning:r.object.isRequired,paramsErrTip:r.shape({projectId:r.string,blockletVersion:r.string,blockletTitle:r.string,blockletDescription:r.string,note:r.string,blockletResource:r.string,blockletHomepage:r.string,blockletSupport:r.string,blockletCommunity:r.string,blockletRepository:r.string,blockletDocker:r.object,dockerImageName:r.string}).isRequired};const br=[".zip",".gz"],fr=1024*1024*100,xr=k.lazy(()=>Wo(()=>import("./index-BcuyH8tS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ys({app:t,projectId:o,readOnly:s,params:n,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=G(),f=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!n.uploadedResource&&e.jsx(A,{component:"a",href:`${m}/params.uploadedResource`,children:n.uploadedResource}),!s&&e.jsx(X,{variant:"outlined",size:"small",onClick:()=>{p()&&f.current?.open()},children:n.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Je,{}),children:e.jsx(xr,{ref:f,locale:u,popup:!0,onUploadFinish:x=>{l({uploadedResource:x.data.filename}),c({blockletResource:""}),f.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:br,maxFileSize:fr,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ys.propTypes={app:r.object.isRequired,projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired};function Dt({readOnly:t,params:o,setParams:s,paramsErrTip:n,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:!!n.blockletVersion,helperText:n.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:!!n.note,helperText:n.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(He,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Dt.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,loading:r.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 gr=Nn();const oe=go(gr),kr={"-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"},Ft={"--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},jr={"--volume":!0,"--publish":!0},yr=new Set(["--publish","--volume"]),vs=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function wr(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,...n]=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,...n].join(":")}})}function vr(t){let o=!0;return t.find(n=>n.key==="--publish"&&n.type==="web")?t.map(n=>{if(n.key==="--publish"){const l={...n,type:o?"docker":n.type};return o=n.type==="web",l}return n}):t.map(n=>{if(n.key==="--publish"){const l={...n,type:o?"web":"docker"};return o=!1,l}return n})}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 n=[],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]||"",[x,...b]=m.split("=");if(x){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:x,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let x=p,b=null;m!==-1&&(x=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=kr[x];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,n.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),n.push({key:h,value:j}),c+=2;continue}else{n.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){n.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");n.push({key:h,value:j}),c+=2;continue}else{n.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const f=[];for(const p of n)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(yr.has(p.key)&&p.value==="true")&&f.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:vr(wr(f)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function Cr({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:n}){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 f=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${f} \\`)}else if(!l.some(f=>f.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const f=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${f} \\`)}}for(const i of o){const{key:d,value:u}=i,f=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${f} \\`)}return s&&l.push(` ${s} \\`),n&&l.push(` ${n} \\`),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"}},Qe=t=>t.replace(/^[-]+/,"").replace(/-([a-z])/g,(n,l)=>l.toUpperCase()),Rr=t=>`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`,Sr=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],Tr=["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(Tr.some(l=>s.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(Sr.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 Dr=Array.from(new Set(Object.keys(Ft).map(Qe))),Ir=["publish","volume"];oe.object({workdir:oe.string().trim().optional(),image:oe.string().trim().regex(/^[^\s]+$/).optional(),shell:oe.string().trim().optional(),volumes:oe.array().items(oe.string().trim()).optional(),script:oe.string().trim().optional(),installNodeModules:oe.boolean().optional(),skipWrapDockerfile:oe.boolean().optional(),command:oe.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:oe.boolean().optional(),...Dr.reduce((t,o)=>{const s=Cs[Rr(o)];return Ir.includes(o)?(t[o]=oe.array().items(oe.string().trim()).optional(),s?t[o]=oe.array().items(oe.string().trim().custom((n,l)=>{const c=s(n);return c?l.message(c):n})).optional():t[o]=oe.array().items(oe.string().trim()).optional(),t):(s?t[o]=oe.string().trim().custom((n,l)=>{const c=s(n);return c?l.message(c):n}).optional():t[o]=oe.string().trim().optional(),t)},{})}).optional();function It({index:t,item:o,dockerParams:s,setDockerParams:n,dataKey:l,t:c,readOnly:i}){const d=o?.value||"",[u,f]=k.useState(!1),p=()=>{s[l]?.splice(t,1),n({...s,[l]:[...s[l]]})},m=(P,L)=>{s[l]?.[t]&&(L?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${Qe(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),n({...s,[l]:[...s[l]]})},x=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],secure:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},n({...s,[l]:[...s[l]]})},b=(P,L)=>{s[l][t]={...s[l][t],shared:L},n({...s,[l]:[...s[l]]})},h=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],required:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},n({...s,[l]:[...s[l]]})},j=(P,L)=>{s[l][t]={...s[l][t],value:L?me.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},n({...s,[l]:[...s[l]]})},v=P=>{s[l][t]={...s[l][t],description:P.target.value},n({...s,[l]:[...s[l]]})},g=P=>{const L=P.target.value==="web"?"web":"docker";L==="web"&&s.dockerArgs.forEach(Z=>{Z.type="docker"});const S=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:L,path:L==="docker"?S:"/",protocol:"http",prefix:L==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},n({...s,dockerArgs:[...s.dockerArgs]})},C=P=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:P.target.value==="direct"?"direct":"service"},n({...s,dockerArgs:[...s.dockerArgs]})},D=P=>{const L=P.target.value;s[l][t]={...s[l][t],prefix:L,path:L==="*"?"/":L},n({...s,[l]:[...s[l]]})},R=P=>{s[l]?.[t]&&(s[l][t].value=P.target.value),n({...s,[l]:[...s[l]]})},y=d===`$${Qe(o.key)}`||o.custom,T=l==="dockerArgs"&&!Ft[o.key],O=jr[o.key],N=l==="dockerEnvs",z=o.key==="--publish";let K=o.key;return z&&o.type==="web"?K="--publish (Web)":N&&(K=`--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(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:K})}),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?`$${Qe(o.key)}`:d,sx:{flex:1},error:T,onChange:R,slotProps:{input:{endAdornment:e.jsxs(He,{position:"end",sx:{zoom:.9},children:[(!(O||T)||N||z)&&e.jsx(ce,{onClick:()=>f(!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(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:c("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Cs[o.key](d)&&e.jsx(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.volumeTips")})]}),u&&e.jsx(ct,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:c(N?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[O||T||N?null:e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.needCustomInput")}),e.jsx(Le,{disabled:i,checked:y,onChange:m,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.shared")}),e.jsx(Le,{disabled:i,checked:o.shared,onChange:b,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.required")}),e.jsx(Le,{disabled:i,checked:o.required,onChange:h,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.secure")}),e.jsx(Le,{disabled:i,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.autoGenerated")}),e.jsx(Le,{disabled:i,checked:o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:j,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{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")})]}),z&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{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"})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{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")})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:i,value:o.prefix,onChange:D,sx:{flex:1},label:c("blocklet.publish.docker.prefix")})]})]})})]})}It.propTypes={dockerParams:r.object.isRequired,setDockerParams:r.func.isRequired,dataKey:r.string.isRequired,item:r.object.isRequired,t:r.func.isRequired,readOnly:r.bool.isRequired,index:r.number.isRequired};const Er=`
195
195
  docker run --name postgrest
196
196
  -p 3000:3000
@@ -1,4 +1,4 @@
1
- import{r as C,g as _e,a as ut}from"./vendor-react-x2lQvn4m.js";import{g as mt,k as re}from"./vendor-hooks-uwq5Zgdd.js";import{j as e,ak as g,at as W,b1 as ee,a6 as _,aX as Me,am as K,cv as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as q,cE as $e,cd as me,A as gt,x as Oe,bZ as qe,b_ as X,bv as We,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as Tt}from"./vendor-mui-core-BwwTYUH3.js";import{T as F,a as H,h as wt,D as fe,z as le,H as R,n as L,C as xe,M as Ue,q as Ge,a0 as Dt,a9 as Ie,S as It,L as Pt}from"./vendor-ux-BglKGRhr.js";import{O as k,p as Rt,ad as Ve,c as U,ax as J,Z as kt,aw as At,f as Ft,M as Nt,af as se,b3 as Lt,b5 as Ye}from"./index-1KOtJL2Z.js";import{W as he}from"./did-address-D7SiJUQw.js";import{u as M}from"./team-03A1FYUk.js";import{r as ge,a as ye,b as je,c as Ke,d as ne,e as zt,u as Bt,f as Et}from"./passport-item-DGHxcu69.js";import{p as Ze}from"./util-rixYG6Oq.js";import{u as _t}from"./use-mobile-DHiqEjn5.js";import{v as Q}from"./index-BGTKxy_q.js";import{w as G,P as Je}from"./permission-CkJCud9p.js";import{C as Mt}from"./Google-BdWLCoXr.js";import{A as $t}from"./vendor-arcblock-BEuhHuNQ.js";import{G as Z,a0 as Ot,H as qt}from"./vendor-utils-DQY0X1ND.js";import{e as oe}from"./edit.svg-D-deOViK.js";import{C as ve}from"./confirm-BheJ2Ufd.js";import{L as Qe}from"./list-header-BROuC1JD.js";import{f as te}from"./index-DBs9Ljax.js";import{u as Wt}from"./useSetState-BWrXo9eH.js";import{C as Ht}from"./lock.svg-xPuKHQ-O.js";import"./lottie-web-4koyQiv_.js";import"./session-CRCJ7U0D.js";import"./index-B0W6E--0.js";import"./base32-CkijRzDY.js";import"./cloneDeep-BnFQZ0zY.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=W(g)`
1
+ import{r as C,g as _e,a as ut}from"./vendor-react-x2lQvn4m.js";import{g as mt,k as re}from"./vendor-hooks-uwq5Zgdd.js";import{j as e,ak as g,at as W,b1 as ee,a6 as _,aX as Me,am as K,cv as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as q,cE as $e,cd as me,A as gt,x as Oe,bZ as qe,b_ as X,bv as We,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as Tt}from"./vendor-mui-core-BwwTYUH3.js";import{T as F,a as H,h as wt,D as fe,z as le,H as R,n as L,C as xe,M as Ue,q as Ge,a0 as Dt,a9 as Ie,S as It,L as Pt}from"./vendor-ux-BglKGRhr.js";import{O as k,p as Rt,ad as Ve,c as U,ax as J,Z as kt,aw as At,f as Ft,M as Nt,af as se,b3 as Lt,b5 as Ye}from"./index-dIkcxCDN.js";import{W as he}from"./did-address-D7SiJUQw.js";import{u as M}from"./team-DA9xMdEQ.js";import{r as ge,a as ye,b as je,c as Ke,d as ne,e as zt,u as Bt,f as Et}from"./passport-item-BejfMK1X.js";import{p as Ze}from"./util-Cn9ZyU8l.js";import{u as _t}from"./use-mobile-DHiqEjn5.js";import{v as Q}from"./index-BGTKxy_q.js";import{w as G,P as Je}from"./permission-B4PsiDVD.js";import{C as Mt}from"./Google-BdWLCoXr.js";import{A as $t}from"./vendor-arcblock-BEuhHuNQ.js";import{G as Z,a0 as Ot,H as qt}from"./vendor-utils-DQY0X1ND.js";import{e as oe}from"./edit.svg-D-deOViK.js";import{C as ve}from"./confirm-B0IPtkVS.js";import{L as Qe}from"./list-header-BROuC1JD.js";import{f as te}from"./index-DBs9Ljax.js";import{u as Wt}from"./useSetState-BWrXo9eH.js";import{C as Ht}from"./lock.svg-xPuKHQ-O.js";import"./lottie-web-4koyQiv_.js";import"./session-DgH_dTEB.js";import"./index-DdCAwzrE.js";import"./base32-CkijRzDY.js";import"./cloneDeep-BnFQZ0zY.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=W(g)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {
@@ -1,4 +1,4 @@
1
- import{j as i,c3 as $,at as x,W as s,ak as y,b0 as L,a6 as T,s as A}from"./vendor-mui-core-BwwTYUH3.js";import{g as E,h as M,b as h,k as q}from"./vendor-hooks-uwq5Zgdd.js";import{ad as D,a6 as U,c as H,az as F,aA as j,aB as b,t as O}from"./index-1KOtJL2Z.js";import{r as m}from"./vendor-react-x2lQvn4m.js";import{b as B,a as Y,T as _,$ as W}from"./vendor-ux-BglKGRhr.js";import{N as V}from"./index-DUDL3BD9.js";import{a as k}from"./index--E0qCGk-.js";import{C as J}from"./vendor-utils-DQY0X1ND.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as X}from"./session-CRCJ7U0D.js";import{b as G}from"./sdk-iEtxKj9x.js";import{w as Q}from"./wrap-locale-B_DF88uA.js";function P({invitation:e,createPassportSvg:a,passportColor:c="auto"}){const[p,n]=m.useState(!1),{t}=m.useContext(B),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),d=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:D(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),u=m.useCallback(()=>{n(!0)},[]),o=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(V,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:d}})]})}),i.jsx(Y,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(r=>i.jsx("li",{style:{listStyle:"circle"},children:r.description},r.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx($,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const Z=x.div`
1
+ import{j as i,c3 as $,at as x,W as s,ak as y,b0 as L,a6 as T,s as A}from"./vendor-mui-core-BwwTYUH3.js";import{g as E,h as M,b as h,k as q}from"./vendor-hooks-uwq5Zgdd.js";import{ad as D,a6 as U,c as H,az as F,aA as j,aB as b,t as O}from"./index-dIkcxCDN.js";import{r as m}from"./vendor-react-x2lQvn4m.js";import{b as B,a as Y,T as _,$ as W}from"./vendor-ux-BglKGRhr.js";import{N as V}from"./index-DEPyMifK.js";import{a as k}from"./index--E0qCGk-.js";import{C as J}from"./vendor-utils-DQY0X1ND.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as X}from"./session-DgH_dTEB.js";import{b as G}from"./sdk-CzxAlOgp.js";import{w as Q}from"./wrap-locale-DOTYikON.js";function P({invitation:e,createPassportSvg:a,passportColor:c="auto"}){const[p,n]=m.useState(!1),{t}=m.useContext(B),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),d=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:D(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),u=m.useCallback(()=>{n(!0)},[]),o=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(V,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:d}})]})}),i.jsx(Y,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(r=>i.jsx("li",{style:{listStyle:"circle"},children:r.description},r.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx($,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const Z=x.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1 +1 @@
1
- import{j as i,ak as l}from"./vendor-mui-core-BwwTYUH3.js";import{i as x,r as g}from"./vendor-react-x2lQvn4m.js";import{b as v}from"./vendor-hooks-uwq5Zgdd.js";import{I as w}from"./invitation-CT4PmJ8m.js";import{K as u}from"./landing-page-BEJgKdih.js";import{T as I,w as S}from"./vendor-ux-BglKGRhr.js";import{a as T,e as k,s as E,b as j,c as P,H as R,d as W}from"./index-1KOtJL2Z.js";import{g as b}from"./get-safe-url-OoUcjrQf.js";import"./vendor-utils-DQY0X1ND.js";import"./index-DUDL3BD9.js";import"./index--E0qCGk-.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CRCJ7U0D.js";import"./sdk-iEtxKj9x.js";import"./wrap-locale-B_DF88uA.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BEuhHuNQ.js";function y(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:m,session:p}=T(),{t:d}=I(),r=s.get("inviteId"),a=s.get("redirect"),f=g.useCallback(async()=>{const{data:t}=await k.get("invitation",{params:{inviteId:r}});return t},[r]),h=v(async(t,o=e=>e)=>{t&&(E(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await p.refresh(),setTimeout(()=>{if(a){const e=decodeURIComponent(a);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(e,{replace:!0}):window.location.href=b(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(u,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsx("title",{children:d("pageTitle.invite")})}),i.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...n,getDataFn:f,checkFn:m.get,createPassportSvg:t=>W({...t}),onLoginSuccess:h,inService:!0})})]})}export{y as default};
1
+ import{j as i,ak as l}from"./vendor-mui-core-BwwTYUH3.js";import{i as x,r as g}from"./vendor-react-x2lQvn4m.js";import{b as v}from"./vendor-hooks-uwq5Zgdd.js";import{I as w}from"./invitation-D4tu3NNd.js";import{K as u}from"./landing-page-DrswynDN.js";import{T as I,w as S}from"./vendor-ux-BglKGRhr.js";import{a as T,e as k,s as E,b as j,c as P,H as R,d as W}from"./index-dIkcxCDN.js";import{g as b}from"./get-safe-url-Cch2GZCp.js";import"./vendor-utils-DQY0X1ND.js";import"./index-DEPyMifK.js";import"./index--E0qCGk-.js";import"./use-passport-id-B-b-_oYF.js";import"./session-DgH_dTEB.js";import"./sdk-CzxAlOgp.js";import"./wrap-locale-DOTYikON.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BEuhHuNQ.js";function y(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:m,session:p}=T(),{t:d}=I(),r=s.get("inviteId"),a=s.get("redirect"),f=g.useCallback(async()=>{const{data:t}=await k.get("invitation",{params:{inviteId:r}});return t},[r]),h=v(async(t,o=e=>e)=>{t&&(E(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await p.refresh(),setTimeout(()=>{if(a){const e=decodeURIComponent(a);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(e,{replace:!0}):window.location.href=b(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(u,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsx("title",{children:d("pageTitle.invite")})}),i.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...n,getDataFn:f,checkFn:m.get,createPassportSvg:t=>W({...t}),onLoginSuccess:h,inService:!0})})]})}export{y as default};
@@ -1 +1 @@
1
- import{j as s,a6 as x,ak as w}from"./vendor-mui-core-BwwTYUH3.js";import{g as v,k as T,b as p}from"./vendor-hooks-uwq5Zgdd.js";import{I as k}from"./invitation-CT4PmJ8m.js";import{K as I}from"./landing-page-BEJgKdih.js";import{T as P,w as j}from"./vendor-ux-BglKGRhr.js";import{a as R,s as S,b as E,c as W,H as C,d as F}from"./index-1KOtJL2Z.js";import{g as L}from"./get-safe-url-OoUcjrQf.js";import{i as N}from"./vendor-react-x2lQvn4m.js";import"./vendor-utils-DQY0X1ND.js";import"./index-DUDL3BD9.js";import"./index--E0qCGk-.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CRCJ7U0D.js";import"./sdk-iEtxKj9x.js";import"./wrap-locale-B_DF88uA.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BEuhHuNQ.js";function Q(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=N(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),i=T(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=p(()=>{if(i.error)throw i.error;return i?.data}),l=p(async(t,o=e=>e)=>{t&&(t.sessionToken&&S(o(t.sessionToken)),t.refreshToken&&E(o(t.refreshToken)),t.visitorId&&j(o(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(W.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=L(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.loading?s.jsx(x,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(C,{children:s.jsx("title",{children:h("pageTitle.issuePassport")})}),s.jsx(w,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(k,{...m,action:"issue-passport",getDataFn:g,checkFn:a.get,createPassportSvg:F,onLoginSuccess:l,inService:!0,status:u.state})})]})}export{Q as default};
1
+ import{j as s,a6 as x,ak as w}from"./vendor-mui-core-BwwTYUH3.js";import{g as v,k as T,b as p}from"./vendor-hooks-uwq5Zgdd.js";import{I as k}from"./invitation-D4tu3NNd.js";import{K as I}from"./landing-page-DrswynDN.js";import{T as P,w as j}from"./vendor-ux-BglKGRhr.js";import{a as R,s as S,b as E,c as W,H as C,d as F}from"./index-dIkcxCDN.js";import{g as L}from"./get-safe-url-Cch2GZCp.js";import{i as N}from"./vendor-react-x2lQvn4m.js";import"./vendor-utils-DQY0X1ND.js";import"./index-DEPyMifK.js";import"./index--E0qCGk-.js";import"./use-passport-id-B-b-_oYF.js";import"./session-DgH_dTEB.js";import"./sdk-CzxAlOgp.js";import"./wrap-locale-DOTYikON.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BEuhHuNQ.js";function Q(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=N(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),i=T(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=p(()=>{if(i.error)throw i.error;return i?.data}),l=p(async(t,o=e=>e)=>{t&&(t.sessionToken&&S(o(t.sessionToken)),t.refreshToken&&E(o(t.refreshToken)),t.visitorId&&j(o(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(W.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=L(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.loading?s.jsx(x,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(C,{children:s.jsx("title",{children:h("pageTitle.issuePassport")})}),s.jsx(w,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(k,{...m,action:"issue-passport",getDataFn:g,checkFn:a.get,createPassportSvg:F,onLoginSuccess:l,inService:!0,status:u.state})})]})}export{Q as default};