@abtnode/blocklet-services 1.16.41-beta-20250319-034744-5c62f533 → 1.16.41-beta-20250321-223009-25dace48

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 (112) hide show
  1. package/api/libs/email.js +78 -58
  2. package/api/libs/open-graph/template.js +2 -3
  3. package/api/services/kyc/index.js +1 -0
  4. package/api/socket/channel/did.js +2 -1
  5. package/dist/assets/{access-control-DyHt8ppX.js → access-control-DhtMFrrc.js} +1 -1
  6. package/dist/assets/{add-component-core-DOdhiJes.js → add-component-core-duRCoSri.js} +1 -1
  7. package/dist/assets/{add-resource-CGPM0kPR.js → add-resource-BFCxRUjw.js} +1 -1
  8. package/dist/assets/analytics-BzYDejNJ.js +11 -0
  9. package/dist/assets/ar-BYhFX1RC.js +3 -0
  10. package/dist/assets/{audit-logs-D1W37Cj4.js → audit-logs-Boixygak.js} +1 -1
  11. package/dist/assets/{branding-DR3Jnq-d.js → branding-DRuzH-TI.js} +2 -2
  12. package/dist/assets/{bundle-avatar-Eqwd2qUG.js → bundle-avatar-ByTSTw6q.js} +1 -1
  13. package/dist/assets/{complete-BzSPyjUA.js → complete-Dcrfpetb.js} +1 -1
  14. package/dist/assets/{component--_f-xKi7.js → component-BQWq8U2p.js} +1 -1
  15. package/dist/assets/{config-BDpdqYom.js → config-Ho-e6TmS.js} +1 -1
  16. package/dist/assets/{config-navigation-BrXS6Zm4.js → config-navigation-CiIrM1Fo.js} +3 -3
  17. package/dist/assets/{config-space-BZu4nd7t.js → config-space-C0DOvHCl.js} +1 -1
  18. package/dist/assets/{confirm-CCmbVvGp.js → confirm-Bk48-qWj.js} +1 -1
  19. package/dist/assets/{connect-Bgm2clKz.js → connect-C3MWBgHk.js} +1 -1
  20. package/dist/assets/{connect-C1EdscR7.js → connect-TboxsI7I.js} +1 -1
  21. package/dist/assets/{connect-to-CAjdR1Vi.js → connect-to-BKKH2Cvc.js} +1 -1
  22. package/dist/assets/{dashboard-C2dbiNOp.js → dashboard-C07uhZlB.js} +3 -3
  23. package/dist/assets/de-BGb-B8X8.js +3 -0
  24. package/dist/assets/{delete-confirm-CVo1ye7X.js → delete-confirm-BMM7KvBu.js} +1 -1
  25. package/dist/assets/domain-D7OtVpWm.js +9 -0
  26. package/dist/assets/domain-action-card-CgDTJRIU.js +29 -0
  27. package/dist/assets/domains-C4ORv-aP.js +1 -0
  28. package/dist/assets/{email-BHF0jLjs.js → email-CQ7-0SMy.js} +1 -1
  29. package/dist/assets/es-7qfy0ZFR.js +3 -0
  30. package/dist/assets/{exchange-passport-C6TpmUyM.js → exchange-passport-Dz30tcA6.js} +1 -1
  31. package/dist/assets/{form-text-input-C8x5debf.js → form-text-input-BnAspRzv.js} +1 -1
  32. package/dist/assets/fr-D45_Vbdp.js +3 -0
  33. package/dist/assets/{fuel-DQMzXBHQ.js → fuel-iMiQT_Y0.js} +1 -1
  34. package/dist/assets/hi-DZgSSG0g.js +1 -0
  35. package/dist/assets/{home-CfRR-l78.js → home-A4FborU_.js} +1 -1
  36. package/dist/assets/id-ClLYhQcd.js +3 -0
  37. package/dist/assets/{iframe-C0FAfo1V.js → iframe-CrXg6lQs.js} +1 -1
  38. package/dist/assets/{index-BsMTGy4m.js → index-B67Mm1i9.js} +1 -1
  39. package/dist/assets/{index-BVjGveR4.js → index-BP3Y-5Lk.js} +1 -1
  40. package/dist/assets/{index-DojJOk-8.js → index-BTiNa1bp.js} +1 -1
  41. package/dist/assets/{index-D2qwAqco.js → index-BXjJechq.js} +1 -1
  42. package/dist/assets/{index-Db8S8FOW.js → index-BakF-08E.js} +1 -1
  43. package/dist/assets/{index-KP4WZslk.js → index-Bs92gDoG.js} +1 -1
  44. package/dist/assets/{index-CYdNDqQ1.js → index-CBS4EwIH.js} +6 -6
  45. package/dist/assets/{index-DJJGXGi6.js → index-CtLsy_jW.js} +1 -1
  46. package/dist/assets/index-D2FJkd1U.js +6 -0
  47. package/dist/assets/{index-D8WxMgot.js → index-D58h54sQ.js} +3 -3
  48. package/dist/assets/{index-BL64rJ3g.js → index-D5oVpOhg.js} +1 -1
  49. package/dist/assets/{index-Dal_0cM6.js → index-DJCrE6Wk.js} +1 -1
  50. package/dist/assets/{index-Dv43WFu_.js → index-Di80FuhU.js} +5 -5
  51. package/dist/assets/{index-Bv_udrJr.js → index-DmZVGf4-.js} +1 -1
  52. package/dist/assets/{index-Hc4fe8tE.js → index-DwGRFFPu.js} +1 -1
  53. package/dist/assets/{analytics-BRjS4mY-.js → index-ZhFE0VPc.js} +29 -39
  54. package/dist/assets/{invitation-CDtK_Uyv.js → invitation-CIPRNDhh.js} +1 -1
  55. package/dist/assets/{invite-DSQnWK9o.js → invite-CA2lONVP.js} +1 -1
  56. package/dist/assets/{issue-passport-Bb_7kKPQ.js → issue-passport-D_79TMoj.js} +1 -1
  57. package/dist/assets/{item-C1U0HVPR.js → item-CSshCCU4.js} +2 -2
  58. package/dist/assets/ja-Bt-ViiAE.js +3 -0
  59. package/dist/assets/ko-BEKHcSck.js +3 -0
  60. package/dist/assets/{layout-Bkn9nC3f.js → layout-DfxD4-7B.js} +1 -1
  61. package/dist/assets/{list-BIXoIHH2.js → list-YzyHuFx0.js} +1 -1
  62. package/dist/assets/{localization-Cf41fenL.js → localization-DXr2qb5k.js} +1 -1
  63. package/dist/assets/{log-CuiY798z.js → log-DwhEj58A.js} +1 -1
  64. package/dist/assets/{login-Ds2aHi-M.js → login-aikPs5C4.js} +1 -1
  65. package/dist/assets/{login-oauth-callback-DAKHXtVv.js → login-oauth-callback-BQ3BcD5g.js} +1 -1
  66. package/dist/assets/{logo-uploader-DQCS5qZW.js → logo-uploader-BiPAPqlc.js} +3 -3
  67. package/dist/assets/{lost-passport-DdbK0_Yc.js → lost-passport-CdpQ1c6a.js} +1 -1
  68. package/dist/assets/{overview-DFNGZZos.js → overview-CEq2dp-I.js} +1 -1
  69. package/dist/assets/{preferences-Dx29Tgc2.js → preferences-D5E_lTTa.js} +1 -1
  70. package/dist/assets/{profile-embed-C_yYlnVt.js → profile-embed-C5ZGYP34.js} +1 -1
  71. package/dist/assets/pt-B0dqFDL5.js +1 -0
  72. package/dist/assets/{publish-resource-CPSJ7Gd2.js → publish-resource-CHXi7gR6.js} +1 -1
  73. package/dist/assets/{relative-time-xM8Zc84I.js → relative-time-BMk6-Cz4.js} +1 -1
  74. package/dist/assets/ru-CQaxksxw.js +1 -0
  75. package/dist/assets/{setup-CkUck5w6.js → setup-5CzEE7u_.js} +3 -3
  76. package/dist/assets/{start-CRCAeTDI.js → start-bvp0eBWn.js} +1 -1
  77. package/dist/assets/{status-D8ugfvVU.js → status-CvHaULR6.js} +1 -1
  78. package/dist/assets/{step-actions-C83ykph7.js → step-actions-BQ7v9BTH.js} +1 -1
  79. package/dist/assets/{studio-Cb_GlvSi.js → studio-uVz4gu18.js} +1 -1
  80. package/dist/assets/{switch-control-CJ1duVKM.js → switch-control-DD9yYD7L.js} +1 -1
  81. package/dist/assets/{th-KPXdcBJ0.js → th-CjA3_x5X.js} +1 -1
  82. package/dist/assets/{traffic-DjeUj5sV.js → traffic-D-ugFE9e.js} +1 -1
  83. package/dist/assets/{transfer-B_MO7Mf7.js → transfer-Bx1MySon.js} +1 -1
  84. package/dist/assets/{unsubscribe-ajBobtwD.js → unsubscribe-B9kFqlcu.js} +1 -1
  85. package/dist/assets/{user-center-D62gRjAl.js → user-center-Di3tptHr.js} +1 -1
  86. package/dist/assets/{util-CohOBosL.js → util-CzeZDYqJ.js} +1 -1
  87. package/dist/assets/{vendor-arcblock-E5QJEgSK.js → vendor-arcblock-CZsH3o1m.js} +1 -1
  88. package/dist/assets/vi-CEplaB_p.js +1 -0
  89. package/dist/assets/wrap-locale-RuOaicAg.js +1 -0
  90. package/dist/assets/zh-CDegQD7Y.js +4 -0
  91. package/dist/assets/zh-tw-BunOPLC9.js +3 -0
  92. package/dist/index.html +2 -2
  93. package/dist/service-worker.js +1 -1
  94. package/package.json +21 -21
  95. package/dist/assets/ar-A7PXaQSB.js +0 -3
  96. package/dist/assets/de-DQLOqs4x.js +0 -3
  97. package/dist/assets/domain-BQkRhwGe.js +0 -9
  98. package/dist/assets/domain-action-card-Dlgq4rsm.js +0 -29
  99. package/dist/assets/domains-DaOwHgX-.js +0 -1
  100. package/dist/assets/es-Wyib4tkS.js +0 -3
  101. package/dist/assets/fr-CTdi8lPh.js +0 -3
  102. package/dist/assets/hi-Dk3MVpw6.js +0 -1
  103. package/dist/assets/id-BqyOVEFD.js +0 -3
  104. package/dist/assets/index-CmyG8bip.js +0 -5
  105. package/dist/assets/ja-BIiN349J.js +0 -3
  106. package/dist/assets/ko-D9z_sjE3.js +0 -3
  107. package/dist/assets/pt-DbNy95wU.js +0 -1
  108. package/dist/assets/ru-BEliZjDL.js +0 -1
  109. package/dist/assets/vi-ChkGdSKU.js +0 -1
  110. package/dist/assets/wrap-locale-lZatlhee.js +0 -1
  111. package/dist/assets/zh-DDAGRLEd.js +0 -4
  112. package/dist/assets/zh-tw-DIWT2k6_.js +0 -3
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D8WxMgot.js","assets/vendor-ux-did-connect-D75Zatzm.js","assets/vendor-react-DoD83n6N.js","assets/vendor-utils-CbeKtci8.js","assets/vendor-mui-core-O22FPGM4.js","assets/vendor-hooks-CYyfK9g3.js","assets/lottie-web-B6s7dDoL.js","assets/vendor-ux-did-connect-DhgPdlEj.css","assets/vendor-arcblock-E5QJEgSK.js","assets/index-DQKEK30u.js","assets/index-CYdNDqQ1.js","assets/index-tUQxVYYQ.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
- import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-react-DoD83n6N.js";import{a1 as ke,j as e,t as Le,a3 as c,bg as vo,E as r,a4 as me,I as ce,T as N,bV as Co,D as ot,a9 as ge,as as ys,bO as Je,ac as wo,bn as Xe,bq as ht,x as se,a2 as Ye,P as So,G as Io,v as jt,$ as Do,am as To,ai as fe,ak as Rs,ab as _o,r as Po,bK as vs,K as Me,y as qo,M as oe,ad as Se,at as Cs,L as ws,z as Ss,b2 as Is,ar as $o,aq as Qe,bv as Ds,bw as Ts,bW as _s,bX as Ps,bi as ft,bj as qs,bl as $s,bz as Ls,bA as at}from"./vendor-mui-core-O22FPGM4.js";import{z as ye,C as ze,h as ue,a5 as Ns,f as lo,ad as ro}from"./index-CYdNDqQ1.js";import{r as Re,p as G,u as te,aj as As,B as Ve,a$ as Lo,R as No,aZ as Ao,am as zs,bk as Bs,a2 as kt,V,_ as Es,i as ae,bl as Ws,b4 as Os,ai as $e,ak as yt,aq as Vs}from"./vendor-ux-did-connect-D75Zatzm.js";import{h as Rt,n as Ms,q as Us,_ as zo,r as De,p as Fs}from"./vendor-arcblock-E5QJEgSK.js";import{d as Hs}from"./Error-wKO1hXtU.js";import{C as vt}from"./confirm-CCmbVvGp.js";import{u as Ue}from"./session-CD9NaM-v.js";import{W as io}from"./did-address-DIKoCoBp.js";import{E as Fe,D as co,C as ao,P as uo}from"./react-beautiful-dnd.esm-DcDZ_Ghe.js";import{B as Ct}from"./bundle-avatar-Eqwd2qUG.js";import{S as je}from"./shorten-label-DXrhdUJE.js";import{L as wt}from"./list-header-Bzt7zKtS.js";import{X as Gs,x as be,G as St,C as Bo}from"./vendor-utils-CbeKtci8.js";import{d as Js}from"./Download-DANYdeZR.js";import{C as Eo}from"./click-to-copy-Dc16fHKA.js";import{Q as Xs}from"./QuestionMarkCircle-D4HZAY1P.js";import{u as Ys}from"./vendor-hooks-CYyfK9g3.js";import{_ as Ie}from"./useSetState-BL3ktMon.js";import{c as It}from"./index-tUQxVYYQ.js";import{E as Dt}from"./index-C46rA4HG.js";import{p as Ze}from"./index-DojJOk-8.js";import"./api-CvDkueg1.js";import{d as Qs}from"./ChevronRight-Bpkf9aqI.js";import{T as Zs,a as Ks}from"./vendor-mui-x-K-9WHqhO.js";import{d as po}from"./DeleteOutline-D4DYIaUj.js";import{c as en,A as Wo,u as tn,S as on,U as sn,a as dt,b as Oo,n as nn,e as ln,f as ho,g as rn,h as cn}from"./item-C1U0HVPR.js";import{d as an}from"./ArrowDropDown-ydRfHJ2x.js";import{f as Ne}from"./format-error-LAoTjvJe.js";import{d as dn}from"./Launch-XvyEoGhF.js";import{M as un}from"./index-oXEi5lCg.js";import{r as pn}from"./index-Aq7Gmh7c.js";import{d as hn}from"./Done-B8c93MpP.js";import"./lottie-web-B6s7dDoL.js";import"./raf-schd.esm-GV-XhwE0.js";import"./delete-confirm-CVo1ye7X.js";import"./get-safe-url-BvS0hy8W.js";var Tt={},fn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Vo=Tt.default=void 0,bn=fn(Re()),xn=e;Vo=Tt.default=(0,bn.default)((0,xn.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var _t={},mn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Mo=_t.default=void 0,gn=mn(Re()),jn=e;Mo=_t.default=(0,gn.default)((0,jn.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Pt={},kn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Uo=Pt.default=void 0,yn=kn(Re()),Rn=e;Uo=Pt.default=(0,yn.default)((0,Rn.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function qt({did:t,projectId:o,title:s,logo:i,describe:l}){const n=`${`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${i}`,[u,a]=x.useState(!1),h=Le(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(vo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||u?"primary.main":"grey.700"},children:l||"/"})]})]})}qt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function $t({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:i,locale:l}=te(),{api:d}=ye(),{api:n}=Ue(),[u,a]=x.useState(!0),{blocklet:h}=ze(),[m,S]=x.useState(null),[y,p]=x.useState(!1),f=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:I=""}=tt(),[j,D]=x.useState(null),[k,T]=x.useState(""),L=()=>{d.getProjects({input:{did:h.meta.did,componentDid:I,tenantScope:s}}).then(g=>{const _=(g==null?void 0:g.projects)||[];a(!1),D(_)}).catch(g=>{a(!1),V.error(g.message)})},z=()=>{o(`${G.UNOWNED_DID}/create/none`,{replace:!0})},B=g=>{S(g)},v=()=>{a(!1),p(!0)},C=()=>{p(!1),S(null)},H=g=>{V.error(g.message),p(!1),S(null)},W=g=>{if(!(g!=null&&g.deleted)){V.error("Delete project failed");return}L(),p(!1),S(null)};x.useEffect(()=>{L()},[]);const b=x.useMemo(()=>{if(!k)return j;let g=k==null?void 0:k.trim();return g?(g=As.toAddress(g).toLocaleLowerCase(),j.filter(_=>_.blockletTitle.toLowerCase().includes(g)||_.blockletDid.toLowerCase().includes(g))):j},[j,k]);if(!j&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!j)return null;if(!j.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:i("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:i("blocklet.publish.createBlockletTip")}),e.jsx(Ve,{onClick:z,variant:"contained",children:i("blocklet.publish.createBlocklet")})]});const w=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const _=j[g];return e.jsx(xe,{to:`${_.id}`,children:e.jsx(qt,{did:h.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Lo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},f||I?null:{label:i("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},f||I?null:{label:i("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const _=(h.children||[]).find(J=>J.meta.did===g);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:_,ancestors:[h]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},g):""}}},f||s?null:{label:i("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:i("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(No,{value:Number(g),locale:l})}},{label:i("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const _=j[g];return e.jsxs(c,{display:"flex",children:[e.jsx(xe,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(me,{title:i("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Vo,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(me,{title:i("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(xe,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}`,children:e.jsx(Mo,{sx:{fontSize:18}})})})}),e.jsx(me,{title:i("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>B(_),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),q=y?e.jsx(zs,{open:!0,popup:!0,onClose:C,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:W,onError:H,extraParams:{projectId:m.id,did:h.meta.did,name:m.blockletTitle},messages:{title:i("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:i("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:i("blocklet.publish.deleteProject.confirm"),success:i("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:i("common.blockletStudio")}),e.jsx(me,{title:i("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Uo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{options:{searchPlaceholder:i("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:k,searchText:k,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),e.jsxs(Ve,{onClick:z,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),i("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:b,columns:w,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]}}),m&&e.jsx(vt,{title:`${i("common.delete")} ${m.blockletTitle}`,description:i("blocklet.publish.deleteProject.description"),confirm:i("common.confirm"),onConfirm:v,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[i("blocklet.publish.deleteProject.tip1"),i("blocklet.publish.deleteProject.tip2"),i("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Hs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),q]})}$t.propTypes={initUrl:r.object};$t.defaultProps={initUrl:null};var Lt={},vn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Fo=Lt.default=void 0,Cn=vn(Re()),fo=e;Fo=Lt.default=(0,Cn.default)([(0,fo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const wn=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Ho=wn;function Sn(){var B;const{t,locale:o}=te(),{projectId:s}=tt(),{api:i}=ye(),[l,d]=x.useState(!0),{blocklet:n}=ze(),u=Le(v=>v.breakpoints.down("md")),[a,h]=x.useState(null),[m,S]=x.useState(null),[y,p]=x.useState(null),f=(B=window.env)==null?void 0:B.serverEndpoint,R=()=>{i.getReleases({input:{did:n.meta.did,projectId:s}}).then(v=>{const C=(v==null?void 0:v.releases)||[];d(!1),h(C)}).catch(v=>{d(!1),V.error(v.message)})},I=()=>{i.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(v=>{S(v.getProject.project||{}),h(v.getReleases.releases||[]),d(!1)}).catch(v=>{d(!1),V.error(v.message)})};x.useEffect(()=>{I()},[]);const[j,D]=x.useState(""),k=()=>{d(!1);const v=y.id;i.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:v}}).then(()=>{d(!1),R(),V.success(t("common.removeSuccess")),p(null)}).catch(C=>{d(!1),V.error(C.message)})},T=v=>{p(v)};if(!a&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!a)return null;const L=e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"..",children:t("common.blockletStudio")}),e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:m.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[L,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(xe,{to:"create/none",children:e.jsx(Ve,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(xe,{to:`view/${C.id}`,children:e.jsx(qt,{did:n.meta.did,projectId:m.id,logo:C.blockletLogo,title:C.blockletVersion,describe:C.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(N,{className:"note",children:Ho(C.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:v=>e.jsx(Lo,{type:v==="published"?"success":"warning",children:v==="published"?"Released":Gs(v)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:v=>{const C=a[v];return C.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(No,{value:Number(C.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:v=>{var q;const C=a[v];let H="",W="";const b=C.status==="published";if(b){const g=be(f,`/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/release/blocklet.json`),_=new URL(f);_.pathname=be(_.pathname,"/launch-blocklet/agreement"),_.searchParams.set("blocklet_meta_url",g),H=_.href,W=be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/download/${(m.lastReleaseFiles||[])[0]}`)}const w=(q=m.blockletComponents)!=null&&q.some(g=>g.included)||C.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[b&&w==="pack"&&e.jsx(me,{title:t("blocklet.publish.install",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:H,target:"_blank",rel:"noreferrer",children:e.jsx(Fo,{sx:{fontSize:18}})})})}),b&&e.jsx(me,{title:t("blocklet.publish.download",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:W,children:e.jsx(Js,{sx:{fontSize:18}})})})}),e.jsx(me,{title:t("blocklet.publish.delete",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>T(C),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}];return e.jsxs(In,{children:[e.jsx(wt,{sx:{mb:2},left:L,actions:e.jsxs(e.Fragment,{children:[e.jsx(Ve,{variant:"outlined",onClick:()=>{const v=be(f,`/api/project/${n.meta.did}/${s}/blocklet.json`);D(v)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(xe,{to:"new-release/none",children:e.jsxs(Ve,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:j,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:j}),e.jsxs(N,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),y&&e.jsx(vt,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:k,onCancel:()=>p(null)})]})}const In=ge(c)`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D58h54sQ.js","assets/vendor-ux-did-connect-D75Zatzm.js","assets/vendor-react-DoD83n6N.js","assets/vendor-utils-CbeKtci8.js","assets/vendor-mui-core-O22FPGM4.js","assets/vendor-hooks-CYyfK9g3.js","assets/lottie-web-B6s7dDoL.js","assets/vendor-ux-did-connect-DhgPdlEj.css","assets/vendor-arcblock-CZsH3o1m.js","assets/index-DQKEK30u.js","assets/index-CBS4EwIH.js","assets/index-tUQxVYYQ.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-react-DoD83n6N.js";import{a1 as ke,j as e,t as Le,a3 as c,bg as vo,E as r,a4 as me,I as ce,T as N,bV as Co,D as ot,a9 as ge,as as ys,bO as Je,ac as wo,bn as Xe,bq as ht,x as se,a2 as Ye,P as So,G as Io,v as jt,$ as Do,am as To,ai as fe,ak as Rs,ab as _o,r as Po,bK as vs,K as Me,y as qo,M as oe,ad as Se,at as Cs,L as ws,z as Ss,b2 as Is,ar as $o,aq as Qe,bv as Ds,bw as Ts,bW as _s,bX as Ps,bi as ft,bj as qs,bl as $s,bz as Ls,bA as at}from"./vendor-mui-core-O22FPGM4.js";import{z as ye,C as ze,h as ue,a5 as Ns,f as lo,ad as ro}from"./index-CBS4EwIH.js";import{r as Re,p as G,u as te,aj as As,B as Ve,a$ as Lo,R as No,aZ as Ao,am as zs,bk as Bs,a2 as kt,V,_ as Es,i as ae,bl as Ws,b4 as Os,ai as $e,ak as yt,aq as Vs}from"./vendor-ux-did-connect-D75Zatzm.js";import{h as Rt,n as Ms,q as Us,_ as zo,r as De,p as Fs}from"./vendor-arcblock-CZsH3o1m.js";import{d as Hs}from"./Error-wKO1hXtU.js";import{C as vt}from"./confirm-Bk48-qWj.js";import{u as Ue}from"./session-CD9NaM-v.js";import{W as io}from"./did-address-DIKoCoBp.js";import{E as Fe,D as co,C as ao,P as uo}from"./react-beautiful-dnd.esm-DcDZ_Ghe.js";import{B as Ct}from"./bundle-avatar-ByTSTw6q.js";import{S as je}from"./shorten-label-DXrhdUJE.js";import{L as wt}from"./list-header-Bzt7zKtS.js";import{X as Gs,x as be,G as St,C as Bo}from"./vendor-utils-CbeKtci8.js";import{d as Js}from"./Download-DANYdeZR.js";import{C as Eo}from"./click-to-copy-Dc16fHKA.js";import{Q as Xs}from"./QuestionMarkCircle-D4HZAY1P.js";import{u as Ys}from"./vendor-hooks-CYyfK9g3.js";import{_ as Ie}from"./useSetState-BL3ktMon.js";import{c as It}from"./index-tUQxVYYQ.js";import{E as Dt}from"./index-C46rA4HG.js";import{p as Ze}from"./index-BTiNa1bp.js";import"./api-CvDkueg1.js";import{d as Qs}from"./ChevronRight-Bpkf9aqI.js";import{T as Zs,a as Ks}from"./vendor-mui-x-K-9WHqhO.js";import{d as po}from"./DeleteOutline-D4DYIaUj.js";import{c as en,A as Wo,u as tn,S as on,U as sn,a as dt,b as Oo,n as nn,e as ln,f as ho,g as rn,h as cn}from"./item-CSshCCU4.js";import{d as an}from"./ArrowDropDown-ydRfHJ2x.js";import{f as Ne}from"./format-error-LAoTjvJe.js";import{d as dn}from"./Launch-XvyEoGhF.js";import{M as un}from"./index-oXEi5lCg.js";import{r as pn}from"./index-Aq7Gmh7c.js";import{d as hn}from"./Done-B8c93MpP.js";import"./lottie-web-B6s7dDoL.js";import"./raf-schd.esm-GV-XhwE0.js";import"./delete-confirm-BMM7KvBu.js";import"./get-safe-url-BvS0hy8W.js";var Tt={},fn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Vo=Tt.default=void 0,bn=fn(Re()),xn=e;Vo=Tt.default=(0,bn.default)((0,xn.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var _t={},mn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Mo=_t.default=void 0,gn=mn(Re()),jn=e;Mo=_t.default=(0,gn.default)((0,jn.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Pt={},kn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Uo=Pt.default=void 0,yn=kn(Re()),Rn=e;Uo=Pt.default=(0,yn.default)((0,Rn.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function qt({did:t,projectId:o,title:s,logo:i,describe:l}){const n=`${`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${i}`,[u,a]=x.useState(!1),h=Le(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(vo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||u?"primary.main":"grey.700"},children:l||"/"})]})]})}qt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function $t({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:i,locale:l}=te(),{api:d}=ye(),{api:n}=Ue(),[u,a]=x.useState(!0),{blocklet:h}=ze(),[m,S]=x.useState(null),[y,p]=x.useState(!1),f=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:I=""}=tt(),[j,D]=x.useState(null),[k,T]=x.useState(""),L=()=>{d.getProjects({input:{did:h.meta.did,componentDid:I,tenantScope:s}}).then(g=>{const _=(g==null?void 0:g.projects)||[];a(!1),D(_)}).catch(g=>{a(!1),V.error(g.message)})},z=()=>{o(`${G.UNOWNED_DID}/create/none`,{replace:!0})},B=g=>{S(g)},v=()=>{a(!1),p(!0)},C=()=>{p(!1),S(null)},H=g=>{V.error(g.message),p(!1),S(null)},W=g=>{if(!(g!=null&&g.deleted)){V.error("Delete project failed");return}L(),p(!1),S(null)};x.useEffect(()=>{L()},[]);const b=x.useMemo(()=>{if(!k)return j;let g=k==null?void 0:k.trim();return g?(g=As.toAddress(g).toLocaleLowerCase(),j.filter(_=>_.blockletTitle.toLowerCase().includes(g)||_.blockletDid.toLowerCase().includes(g))):j},[j,k]);if(!j&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!j)return null;if(!j.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:i("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:i("blocklet.publish.createBlockletTip")}),e.jsx(Ve,{onClick:z,variant:"contained",children:i("blocklet.publish.createBlocklet")})]});const w=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const _=j[g];return e.jsx(xe,{to:`${_.id}`,children:e.jsx(qt,{did:h.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Lo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},f||I?null:{label:i("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},f||I?null:{label:i("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const _=(h.children||[]).find(J=>J.meta.did===g);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:_,ancestors:[h]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},g):""}}},f||s?null:{label:i("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:i("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(No,{value:Number(g),locale:l})}},{label:i("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const _=j[g];return e.jsxs(c,{display:"flex",children:[e.jsx(xe,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(me,{title:i("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Vo,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(me,{title:i("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(xe,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}`,children:e.jsx(Mo,{sx:{fontSize:18}})})})}),e.jsx(me,{title:i("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>B(_),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),q=y?e.jsx(zs,{open:!0,popup:!0,onClose:C,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:W,onError:H,extraParams:{projectId:m.id,did:h.meta.did,name:m.blockletTitle},messages:{title:i("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:i("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:i("blocklet.publish.deleteProject.confirm"),success:i("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:i("common.blockletStudio")}),e.jsx(me,{title:i("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Uo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{options:{searchPlaceholder:i("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:k,searchText:k,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),e.jsxs(Ve,{onClick:z,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),i("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:b,columns:w,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]}}),m&&e.jsx(vt,{title:`${i("common.delete")} ${m.blockletTitle}`,description:i("blocklet.publish.deleteProject.description"),confirm:i("common.confirm"),onConfirm:v,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[i("blocklet.publish.deleteProject.tip1"),i("blocklet.publish.deleteProject.tip2"),i("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Hs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),q]})}$t.propTypes={initUrl:r.object};$t.defaultProps={initUrl:null};var Lt={},vn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Fo=Lt.default=void 0,Cn=vn(Re()),fo=e;Fo=Lt.default=(0,Cn.default)([(0,fo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const wn=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Ho=wn;function Sn(){var B;const{t,locale:o}=te(),{projectId:s}=tt(),{api:i}=ye(),[l,d]=x.useState(!0),{blocklet:n}=ze(),u=Le(v=>v.breakpoints.down("md")),[a,h]=x.useState(null),[m,S]=x.useState(null),[y,p]=x.useState(null),f=(B=window.env)==null?void 0:B.serverEndpoint,R=()=>{i.getReleases({input:{did:n.meta.did,projectId:s}}).then(v=>{const C=(v==null?void 0:v.releases)||[];d(!1),h(C)}).catch(v=>{d(!1),V.error(v.message)})},I=()=>{i.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(v=>{S(v.getProject.project||{}),h(v.getReleases.releases||[]),d(!1)}).catch(v=>{d(!1),V.error(v.message)})};x.useEffect(()=>{I()},[]);const[j,D]=x.useState(""),k=()=>{d(!1);const v=y.id;i.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:v}}).then(()=>{d(!1),R(),V.success(t("common.removeSuccess")),p(null)}).catch(C=>{d(!1),V.error(C.message)})},T=v=>{p(v)};if(!a&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!a)return null;const L=e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"..",children:t("common.blockletStudio")}),e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:m.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[L,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(xe,{to:"create/none",children:e.jsx(Ve,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(xe,{to:`view/${C.id}`,children:e.jsx(qt,{did:n.meta.did,projectId:m.id,logo:C.blockletLogo,title:C.blockletVersion,describe:C.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(N,{className:"note",children:Ho(C.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:v=>e.jsx(Lo,{type:v==="published"?"success":"warning",children:v==="published"?"Released":Gs(v)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:v=>{const C=a[v];return C.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(No,{value:Number(C.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:v=>{var q;const C=a[v];let H="",W="";const b=C.status==="published";if(b){const g=be(f,`/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/release/blocklet.json`),_=new URL(f);_.pathname=be(_.pathname,"/launch-blocklet/agreement"),_.searchParams.set("blocklet_meta_url",g),H=_.href,W=be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/download/${(m.lastReleaseFiles||[])[0]}`)}const w=(q=m.blockletComponents)!=null&&q.some(g=>g.included)||C.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[b&&w==="pack"&&e.jsx(me,{title:t("blocklet.publish.install",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:H,target:"_blank",rel:"noreferrer",children:e.jsx(Fo,{sx:{fontSize:18}})})})}),b&&e.jsx(me,{title:t("blocklet.publish.download",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:W,children:e.jsx(Js,{sx:{fontSize:18}})})})}),e.jsx(me,{title:t("blocklet.publish.delete",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>T(C),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}];return e.jsxs(In,{children:[e.jsx(wt,{sx:{mb:2},left:L,actions:e.jsxs(e.Fragment,{children:[e.jsx(Ve,{variant:"outlined",onClick:()=>{const v=be(f,`/api/project/${n.meta.did}/${s}/blocklet.json`);D(v)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(xe,{to:"new-release/none",children:e.jsxs(Ve,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:j,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:j}),e.jsxs(N,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),y&&e.jsx(vt,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:k,onCancel:()=>p(null)})]})}const In=ge(c)`
3
3
  .main-table > div:first-child {
4
4
  display: none;
5
5
  }
@@ -121,7 +121,7 @@ import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-reac
121
121
  background: #fff;
122
122
  z-index: 10;
123
123
  }
124
- `;var Vt={},En=ke;Object.defineProperty(Vt,"__esModule",{value:!0});var bt=Vt.default=void 0,Wn=En(Re()),On=e;bt=Vt.default=(0,Wn.default)((0,On.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const xo="lastWantToConnectStoreId";function Vn(t){var u,a;const[o,s]=x.useState(null),{session:i}=Ue(),l=x.useCallback(h=>{s(h),localStorage.setItem(xo,h==null?void 0:h.id)},[s]),d=x.useMemo(()=>{var y,p,f,R;const h=localStorage.getItem(xo),m=h?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(I=>I.id===h):null;if(m)return m;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(I=>{var j;return!(I.id!==G.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((j=i==null?void 0:i.user)==null?void 0:j.did))});return S||(S=(R=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=i==null?void 0:i.user)==null?void 0:a.did]);return[o||d||{},l]}const pt={};async function Qo(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:i=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,i));const d=Date.now(),n=async(u,a)=>{try{const h=await t();u(h)}catch(h){Date.now()-d>s?a(h):l?pt[l]=setTimeout(()=>n(u,a),o):setTimeout(()=>n(u,a),o)}};return new Promise(n)}function Mn(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Un(t,{did:o,projectId:s,messageId:i}){return Qo(async()=>{var d;const l=await t.getProject({input:{did:o,projectId:s,messageId:i}});if(!((d=l==null?void 0:l.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function Fn(t,{did:o,projectId:s,storeId:i}){return Qo(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(a=>a.storeId===i))throw new Error("Connected store not found")},{timerKey:`connect-store-${i}`})}const Hn=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:i})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let d=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===i),{teamDid:l,storeList:d}},Mt=Hn;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:i,disabled:l,loading:d,componentDid:n}){var b,w,q;const{t:u}=te(),{session:a}=Ue(),{api:h,info:m,inService:S}=ye(),y=ze(),[p,f]=x.useState(!1),R=x.useRef(null),[I,j]=x.useState(!1),[D,k]=x.useState(null),T=g=>{s(g),f(!1)},L=()=>{f(!p)},z=g=>{R.current&&R.current.contains(g.target)||f(!1)},B=()=>{j(!0)},v=()=>{j(!1)},C=async()=>{var g;if(D)try{await h.deleteBlockletStore({input:{teamDid:t.meta.did,url:D.url,projectId:"",scope:D.scope||"studio"}}),await((g=y==null?void 0:y.actions)==null?void 0:g.refreshBlocklet())}catch(_){V.error(`Remove Blocklet Store Error: ${Ne(_)}`)}finally{k(null)}},{storeList:H}=Mt({fromBlocklet:S,blocklet:t,nodeInfo:m,componentDid:n,userDid:(b=a==null?void 0:a.user)==null?void 0:b.did}),W=(w=t==null?void 0:t.meta)==null?void 0:w.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(se,{onClick:i,children:[d&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(se,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:L,children:e.jsx(an,{})})]}),e.jsx(So,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>e.jsx(Io,{...g,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:z,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[H==null?void 0:H.map(_=>{var J;return e.jsxs(fe,{selected:_.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(_),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:_.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:_.url})]}),en({store:_,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ce,{sx:{ml:1},onClick:U=>{U.preventDefault(),U.stopPropagation(),k(_)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},_.url)}),e.jsx(Rs,{}),e.jsxs(fe,{onClick:B,children:[e.jsx(Rt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&e.jsx(Wo,{hiddenChildren:!0,open:!0,onClose:v,teamDid:W,storeList:H,scope:"studio",onAdd:(q=y==null?void 0:y.actions)==null?void 0:q.refreshBlocklet}),D&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${D.name}`,description:u("blocklet.publish.deleteStoreTip",{name:D.name}),confirm:u("common.confirm"),onConfirm:C,onCancel:()=>k(null)})]})}Ut.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};Ut.defaultProps={store:null,blocklet:null};const Gn=(t,o,s)=>{const i=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${i}/${t.blockletLogo}`:`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:d,screenshotUrls:n,uploadLogoPrefix:i,uploadScreenshotPrefix:l}},Zo=Gn,Jn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:i}){var u;const{t:l}=te(),d=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${i}&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(n){const a=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/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};st.defaultProps={style:{},controls:1,modestbranding:1};function Ko({setParams:t,onClose:o,params:s}){const{t:i}=te(),[l,d]=x.useState(""),n=l&&s.blockletVideos.includes(l),u=Jn(l),a=()=>{t(h=>{const m=[...h.blockletVideos];return m.push(l),{...h,blockletVideos:m}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(_o,{children:i("studio.videoDialogTitle")}),e.jsxs(Po,{children:[e.jsx(vs,{fullWidth:!0,value:l,onChange:h=>d(h.target.value),placeholder:i("studio.videoInputLabel"),endAdornment:l?e.jsx(Me,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(Os,{})})}):null,error:n}),n&&e.jsx(N,{variant:"body2",color:"error",children:i("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(qo,{children:[e.jsx(se,{onClick:()=>o(),children:i("studio.cancel")}),e.jsx(se,{disabled:!u||n,onClick:a,children:i("studio.confirm")})]})]})}Ko.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function xt({errors:t,storeList:o,...s}){const{t:i}=te();return e.jsxs(c,{...s,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(N,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:i("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,d])=>{const n=Object.values(d),u=o.find(a=>a.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(me,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},l)})]})}xt.propTypes={errors:r.object.isRequired,storeList:r.array.isRequired};const mo=x.lazy(()=>zo(()=>import("./index-D8WxMgot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function es({projectId:t,readOnly:o,loading:s,blocklet:i,params:l,setParams:d,paramsErrTip:n,setParamsErrTip:u,warning:a,setLoading:h,initUrl:m,initLogoUrl:S,setInitLogoUrl:y,componentDid:p}){const{t:f,locale:R}=te(),{api:I}=ye(),j=gt(),D=x.useRef(null),k=x.useRef(null),[T,L]=Vn(i),[z,B]=x.useState(!1),v=tn({messageType:"connect-store-message",onOpen:()=>h(!0),onClose:()=>h(!1)}),C=async $=>{const M=setTimeout(()=>{h(!1)},2e4),F=await Un(I,$);h(!1),clearTimeout(M),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),j(window.location.pathname.replace(`${G.UNOWNED_DID}/create`,`${F}/create`),{replace:!0})},H=()=>{if(!l.blockletTitle){V.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){V.error(f("blocklet.publish.noStoreSelected"));return}const $=Mn();v(async(M,F)=>{var Q,X,ie;try{const Y=await I.connectByStudio({input:{did:(Q=i==null?void 0:i.meta)==null?void 0:Q.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((X=l==null?void 0:l.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:p,messageId:$,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(Y!=null&&Y.url)){V.error("failed to connect to store");return}F(Y.url),C({did:(ie=i==null?void 0:i.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(Y){const de=Ne(Y);V.error(de),h(!1)}})},{logoUrl:W,screenshotUrls:b,uploadLogoPrefix:w,uploadScreenshotPrefix:q}=Zo(l,i,t),{logoErrors:g,screenshotErrors:_,storeList:J,hasLogoWarning:U,hasScreenshotWarning:re}=a,K=()=>o?!1:!t||t===G.UNOWNED_DID?(V.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,ee=$=>{if(!$.destination)return;const M=Array.from(l.blockletScreenshots),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletScreenshots:M}))},Be=$=>{if(!$.destination)return;const M=Array.from(l.blockletVideos),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletVideos:M}))};return e.jsxs(Xn,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(oe,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===G.UNOWNED_DID&&e.jsx(Me,{position:"end",children:e.jsx(Ut,{blocklet:i,store:T,componentDid:p,onChangeStore:L,disabled:!l.blockletTitle||o||s,loading:s,onClick:H})})},error:!!n.projectId,helperText:n.projectId||"",value:t===G.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!n.blockletRepository,helperText:n.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||W,onClick:()=>{var $;K()&&(($=D.current)==null||$.open())}})})]}),U&&e.jsx(xt,{errors:g,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:ee,children:e.jsx(ao,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[b.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.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:F}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletScreenshots];return de.splice(Q,1),{...Y,blockletScreenshots:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,b.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var F;K()&&((F=k.current)==null||F.open())},children:"+"})]})})})]}),re&&e.jsx(xt,{errors:_,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:Be,children:e.jsx(ao,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[l.blockletVideos.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:F,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletVideos];return de.splice(Q,1),{...Y,blockletVideos:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,l.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{K()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(mo,{ref:D,locale:R,popup:!0,onUploadFinish:$=>{var M;d({blockletLogo:$.data.filename}),y(""),(M=D.current)==null||M.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/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"),z&&e.jsx(Ko,{onClose:()=>B(!1),params:l,setParams:d}),e.jsx(mo,{ref:k,popup:!0,onUploadFinish:$=>{var M;d(F=>{var X;const Q=F.blockletScreenshots||[];return Q.push((X=$.data)==null?void 0:X.filename),{...F,blockletScreenshots:Q}}),(M=k.current)==null||M.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-b.length}},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,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}es.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.isRequired,componentDid:r.isRequired,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const Xn=ge.div`
124
+ `;var Vt={},En=ke;Object.defineProperty(Vt,"__esModule",{value:!0});var bt=Vt.default=void 0,Wn=En(Re()),On=e;bt=Vt.default=(0,Wn.default)((0,On.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const xo="lastWantToConnectStoreId";function Vn(t){var u,a;const[o,s]=x.useState(null),{session:i}=Ue(),l=x.useCallback(h=>{s(h),localStorage.setItem(xo,h==null?void 0:h.id)},[s]),d=x.useMemo(()=>{var y,p,f,R;const h=localStorage.getItem(xo),m=h?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(I=>I.id===h):null;if(m)return m;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(I=>{var j;return!(I.id!==G.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((j=i==null?void 0:i.user)==null?void 0:j.did))});return S||(S=(R=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=i==null?void 0:i.user)==null?void 0:a.did]);return[o||d||{},l]}const pt={};async function Qo(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:i=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,i));const d=Date.now(),n=async(u,a)=>{try{const h=await t();u(h)}catch(h){Date.now()-d>s?a(h):l?pt[l]=setTimeout(()=>n(u,a),o):setTimeout(()=>n(u,a),o)}};return new Promise(n)}function Mn(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Un(t,{did:o,projectId:s,messageId:i}){return Qo(async()=>{var d;const l=await t.getProject({input:{did:o,projectId:s,messageId:i}});if(!((d=l==null?void 0:l.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function Fn(t,{did:o,projectId:s,storeId:i}){return Qo(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(a=>a.storeId===i))throw new Error("Connected store not found")},{timerKey:`connect-store-${i}`})}const Hn=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:i})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let d=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===i),{teamDid:l,storeList:d}},Mt=Hn;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:i,disabled:l,loading:d,componentDid:n}){var b,w,q;const{t:u}=te(),{session:a}=Ue(),{api:h,info:m,inService:S}=ye(),y=ze(),[p,f]=x.useState(!1),R=x.useRef(null),[I,j]=x.useState(!1),[D,k]=x.useState(null),T=g=>{s(g),f(!1)},L=()=>{f(!p)},z=g=>{R.current&&R.current.contains(g.target)||f(!1)},B=()=>{j(!0)},v=()=>{j(!1)},C=async()=>{var g;if(D)try{await h.deleteBlockletStore({input:{teamDid:t.meta.did,url:D.url,projectId:"",scope:D.scope||"studio"}}),await((g=y==null?void 0:y.actions)==null?void 0:g.refreshBlocklet())}catch(_){V.error(`Remove Blocklet Store Error: ${Ne(_)}`)}finally{k(null)}},{storeList:H}=Mt({fromBlocklet:S,blocklet:t,nodeInfo:m,componentDid:n,userDid:(b=a==null?void 0:a.user)==null?void 0:b.did}),W=(w=t==null?void 0:t.meta)==null?void 0:w.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(se,{onClick:i,children:[d&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(se,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:L,children:e.jsx(an,{})})]}),e.jsx(So,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>e.jsx(Io,{...g,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:z,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[H==null?void 0:H.map(_=>{var J;return e.jsxs(fe,{selected:_.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(_),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:_.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:_.url})]}),en({store:_,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ce,{sx:{ml:1},onClick:U=>{U.preventDefault(),U.stopPropagation(),k(_)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},_.url)}),e.jsx(Rs,{}),e.jsxs(fe,{onClick:B,children:[e.jsx(Rt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&e.jsx(Wo,{hiddenChildren:!0,open:!0,onClose:v,teamDid:W,storeList:H,scope:"studio",onAdd:(q=y==null?void 0:y.actions)==null?void 0:q.refreshBlocklet}),D&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${D.name}`,description:u("blocklet.publish.deleteStoreTip",{name:D.name}),confirm:u("common.confirm"),onConfirm:C,onCancel:()=>k(null)})]})}Ut.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};Ut.defaultProps={store:null,blocklet:null};const Gn=(t,o,s)=>{const i=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${i}/${t.blockletLogo}`:`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:d,screenshotUrls:n,uploadLogoPrefix:i,uploadScreenshotPrefix:l}},Zo=Gn,Jn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:i}){var u;const{t:l}=te(),d=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${i}&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(n){const a=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/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};st.defaultProps={style:{},controls:1,modestbranding:1};function Ko({setParams:t,onClose:o,params:s}){const{t:i}=te(),[l,d]=x.useState(""),n=l&&s.blockletVideos.includes(l),u=Jn(l),a=()=>{t(h=>{const m=[...h.blockletVideos];return m.push(l),{...h,blockletVideos:m}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(_o,{children:i("studio.videoDialogTitle")}),e.jsxs(Po,{children:[e.jsx(vs,{fullWidth:!0,value:l,onChange:h=>d(h.target.value),placeholder:i("studio.videoInputLabel"),endAdornment:l?e.jsx(Me,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(Os,{})})}):null,error:n}),n&&e.jsx(N,{variant:"body2",color:"error",children:i("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(qo,{children:[e.jsx(se,{onClick:()=>o(),children:i("studio.cancel")}),e.jsx(se,{disabled:!u||n,onClick:a,children:i("studio.confirm")})]})]})}Ko.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function xt({errors:t,storeList:o,...s}){const{t:i}=te();return e.jsxs(c,{...s,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(N,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:i("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,d])=>{const n=Object.values(d),u=o.find(a=>a.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(me,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},l)})]})}xt.propTypes={errors:r.object.isRequired,storeList:r.array.isRequired};const mo=x.lazy(()=>zo(()=>import("./index-D58h54sQ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function es({projectId:t,readOnly:o,loading:s,blocklet:i,params:l,setParams:d,paramsErrTip:n,setParamsErrTip:u,warning:a,setLoading:h,initUrl:m,initLogoUrl:S,setInitLogoUrl:y,componentDid:p}){const{t:f,locale:R}=te(),{api:I}=ye(),j=gt(),D=x.useRef(null),k=x.useRef(null),[T,L]=Vn(i),[z,B]=x.useState(!1),v=tn({messageType:"connect-store-message",onOpen:()=>h(!0),onClose:()=>h(!1)}),C=async $=>{const M=setTimeout(()=>{h(!1)},2e4),F=await Un(I,$);h(!1),clearTimeout(M),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),j(window.location.pathname.replace(`${G.UNOWNED_DID}/create`,`${F}/create`),{replace:!0})},H=()=>{if(!l.blockletTitle){V.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){V.error(f("blocklet.publish.noStoreSelected"));return}const $=Mn();v(async(M,F)=>{var Q,X,ie;try{const Y=await I.connectByStudio({input:{did:(Q=i==null?void 0:i.meta)==null?void 0:Q.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((X=l==null?void 0:l.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:p,messageId:$,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(Y!=null&&Y.url)){V.error("failed to connect to store");return}F(Y.url),C({did:(ie=i==null?void 0:i.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(Y){const de=Ne(Y);V.error(de),h(!1)}})},{logoUrl:W,screenshotUrls:b,uploadLogoPrefix:w,uploadScreenshotPrefix:q}=Zo(l,i,t),{logoErrors:g,screenshotErrors:_,storeList:J,hasLogoWarning:U,hasScreenshotWarning:re}=a,K=()=>o?!1:!t||t===G.UNOWNED_DID?(V.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,ee=$=>{if(!$.destination)return;const M=Array.from(l.blockletScreenshots),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletScreenshots:M}))},Be=$=>{if(!$.destination)return;const M=Array.from(l.blockletVideos),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletVideos:M}))};return e.jsxs(Xn,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(oe,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===G.UNOWNED_DID&&e.jsx(Me,{position:"end",children:e.jsx(Ut,{blocklet:i,store:T,componentDid:p,onChangeStore:L,disabled:!l.blockletTitle||o||s,loading:s,onClick:H})})},error:!!n.projectId,helperText:n.projectId||"",value:t===G.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!n.blockletRepository,helperText:n.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||W,onClick:()=>{var $;K()&&(($=D.current)==null||$.open())}})})]}),U&&e.jsx(xt,{errors:g,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:ee,children:e.jsx(ao,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[b.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.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:F}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletScreenshots];return de.splice(Q,1),{...Y,blockletScreenshots:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,b.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var F;K()&&((F=k.current)==null||F.open())},children:"+"})]})})})]}),re&&e.jsx(xt,{errors:_,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:Be,children:e.jsx(ao,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[l.blockletVideos.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:F,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletVideos];return de.splice(Q,1),{...Y,blockletVideos:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,l.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{K()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(mo,{ref:D,locale:R,popup:!0,onUploadFinish:$=>{var M;d({blockletLogo:$.data.filename}),y(""),(M=D.current)==null||M.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/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"),z&&e.jsx(Ko,{onClose:()=>B(!1),params:l,setParams:d}),e.jsx(mo,{ref:k,popup:!0,onUploadFinish:$=>{var M;d(F=>{var X;const Q=F.blockletScreenshots||[];return Q.push((X=$.data)==null?void 0:X.filename),{...F,blockletScreenshots:Q}}),(M=k.current)==null||M.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-b.length}},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,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}es.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.isRequired,componentDid:r.isRequired,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const Xn=ge.div`
125
125
  margin-top: 24px;
126
126
  .screenshot {
127
127
  margin-bottom: 16px;
@@ -155,7 +155,7 @@ import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-reac
155
155
  width: 100%; /* 图像宽度填充容器 */
156
156
  height: auto; /* 图像高度自适应 */
157
157
  }
158
- `;var Ft={},Yn=ke;Object.defineProperty(Ft,"__esModule",{value:!0});var ts=Ft.default=void 0,Qn=Yn(Re()),Zn=e;ts=Ft.default=(0,Qn.default)((0,Zn.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l4.65-4.65c.2-.2.51-.2.71 0L17 13z"}),"CloudUploadRounded");const Kn=(t,o,s,i)=>{const l=t?[...t]:[],d=((o==null?void 0:o.children)||[]).reduce((n,u)=>(n[u.meta.did]=!0,n),{});return Object.keys(s).forEach(n=>{if(!d[n])return;let u=!1;i||l.forEach(a=>{a.did===n&&(a.included=!0,a.required=!0,u=!0)}),u||l.push({did:n,included:!0,required:!0})}),l},el=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],i=await(await fetch(t)).blob();return new File([i],o,{type:i.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*tl(t,o){let s=0;for(;s<t.size;)yield t.slice(s,s+o),s+=o}const ol=async({did:t,projectId:o,uploadType:s="logo",imageUrl:i})=>{const l=await el(i);new FormData().append("file",l);const n={uploaderId:"Uploader",relativePath:encodeURIComponent(l.name),name:encodeURIComponent(l.name),type:l.type},a=(await ro.post(be(G.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,s,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":l.size,"X-Uploader-File-Ext":l.name.split(".").pop(),"Upload-Metadata":Object.keys(n).map(y=>`${y} ${btoa(n[y])}`).join(",")}})).headers.location,h=2*1024*1024;let m=0,S="";for(const y of tl(l,h)){const p=await ro.patch(be(G.WELLKNOWN_SERVICE_PATH_PREFIX,a),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":m,"Content-Type":"application/offset+octet-stream"}});m+=y.size,S=p.data.filename}return S},os=({params:t,projectId:o,status:s,t:i})=>{const l=[];return t.blockletTitle||l.push({param:"blockletTitle",message:i("blocklet.publish.errorTip.noTitle")}),(!o||o===G.UNOWNED_DID)&&l.push({param:"projectId",message:i("blocklet.publish.errorTip.noDid")}),t.blockletVersion?$e.valid(t.blockletVersion)||l.push({param:"blockletVersion",message:i("blocklet.publish.errorTip.inValidVersion")}):l.push({param:"blockletVersion",message:i("blocklet.publish.errorTip.noVersion")}),s===ue.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||l.push({param:"blockletDescription",message:i("blocklet.publish.errorTip.noDescription")}),t.note||l.push({param:"note",message:i("blocklet.publish.errorTip.noNote")})),l.length?l:null},sl=({params:t,step:o,t:s,projectId:i})=>{if(o===0){if(!t.blockletTitle)return s("blocklet.publish.errorTip.noTitle");if(!i||i===G.UNOWNED_DID)return s("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return s("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return s("blocklet.publish.errorTip.noVersion");if(!$e.valid(t.blockletVersion))return s("blocklet.publish.errorTip.inValidVersion");if(!t.note)return s("blocklet.publish.errorTip.noNote")}return""};function Ht({blocklet:t,releaseId:o,connectedStores:s,projectId:i,releaseType:l,publishedStoreIds:d,onPublish:n,onDelete:u,warning:a,projectType:h,componentDid:m,onOpenConnectStore:S,behavior:y,onSelectConnectStore:p}){var L,z;const{t:f}=te(),{actions:{refreshBlocklet:R}}=ze(),{session:I}=Ue(),{storeList:j}=Mt({fromBlocklet:!0,blocklet:t,componentDid:m,userDid:(L=I==null?void 0:I.user)==null?void 0:L.did}),D=x.useMemo(()=>s!=null&&s.length?s==null?void 0:s.reduce((B,v)=>(B[v.storeId]=v,B),{}):{},[s]),k=(z=t==null?void 0:t.meta)==null?void 0:z.did,T={};return Object.entries((a==null?void 0:a.logoErrors)||{}).forEach(([B,v])=>{const C=Object.values(v);C.length>0&&(T[B]=C)}),Object.entries((a==null?void 0:a.screenshotErrors)||{}).forEach(([B,v])=>{const C=Object.values(v);C.length>0&&(T[B]=T[B]?[...T[B],...C]:C)}),e.jsxs(e.Fragment,{children:[y==="connect"&&!!(j!=null&&j.length)&&e.jsx(wo,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Cs[400],component:"a",href:h==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[f(h==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(dn,{sx:{marginLeft:1}})]})}),e.jsx(ws,{children:j==null?void 0:j.map(B=>e.jsx(Ss,{"data-cy":"store-switch",children:e.jsx(Is,{children:e.jsx(on,{behavior:y,onSelectConnectStore:p,releaseId:o,projectId:i,releaseType:l,kind:"publish",teamDid:k,warningList:T[B.url],store:B,published:(d==null?void 0:d.indexOf(B.id))>-1,connectedStore:D[B.id],onPublish:n,onDelete:u,scope:B.scope||"studio",onOpenConnectStore:S})})},B.url))}),e.jsx(Wo,{teamDid:k,storeList:j,scope:"studio",onAdd:R})]})}Ht.propTypes={blocklet:r.object.isRequired,projectId:r.string.isRequired,releaseId:r.string.isRequired,releaseType:r.string.isRequired,onPublish:r.func,onDelete:r.func,publishedStoreIds:r.arrayOf(r.string),connectedStores:r.arrayOf(r.object).isRequired,projectType:r.string,componentDid:r.string,warning:r.object,onOpenConnectStore:r.func,onSelectConnectStore:r.func,behavior:r.string};Ht.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function ss({did:t,params:o,setParams:s,projectId:i,open:l,onClose:d}){const{t:n}=te(),[u,a]=x.useState(!1),{api:h}=ye(),[m,S]=x.useState(!1),[y,p]=x.useState(!1),f=()=>{S(o.autoUpload),p(o.possibleSameStore),a(!1),d(!1)},R=async()=>{a(!0);try{await h.updateProject({input:{did:t,projectId:i,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!m,possibleSameStore:!!y}}),s({autoUpload:m,possibleSameStore:y}),d(!1)}catch(j){V.error(j.message)}a(!1)};x.useEffect(()=>{S(o.autoUpload),p(o.possibleSameStore)},[o]);const I=!!(i&&i!==G.UNOWNED_DID);return e.jsx(yt,{title:n("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:l,onClose:f,actions:e.jsxs(e.Fragment,{children:[e.jsx(se,{onClick:j=>{j.stopPropagation(),d()},color:"inherit",children:n("common.cancel")}),I&&e.jsxs(se,{onClick:j=>{j.stopPropagation(),R()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Ye,{size:16}),n("common.confirm")]})]}),children:I?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.autoUploadTip")}),e.jsx(De,{checked:m,onChange:(j,D)=>S(D)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.possibleSameStoreTip")}),e.jsx(De,{checked:y,onChange:(j,D)=>p(D)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.needProjectId")})]})})}ss.propTypes={did:r.string.isRequired,params:r.object.isRequired,open:r.bool.isRequired,onClose:r.func.isRequired,setParams:r.func.isRequired,projectId:r.string.isRequired};function ns({downloadUrl:t,installUrl:o,handleSetTip:s,isPack:i,disabled:l}){const{t:d}=te(),[n,u]=x.useState(!1),a=x.useRef(null),h=()=>{u(!n)},m=S=>{a.current&&a.current.contains(S.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(se,{disabled:l,ref:a,onClick:h,children:e.jsx(c,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(So,{sx:{zIndex:10},open:n,anchorEl:a.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:S})=>e.jsx(Io,{...S,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:m,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[i&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(N,{variant:"inherit",children:d("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:s,children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(N,{variant:"inherit",children:d("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(N,{variant:"inherit",children:d("common.download")})]})})]})})})})})]})}ns.propTypes={disabled:r.bool.isRequired,isPack:r.bool.isRequired,downloadUrl:r.string.isRequired,installUrl:r.string.isRequired,handleSetTip:r.func.isRequired};var Ro;const go=(Ro=window.env)==null?void 0:Ro.serverEndpoint;function ls({projectId:t,params:o,setParamsErrTip:s,initUrl:i,setParams:l,mode:d,loading:n,blocklet:u,release:a,isPublished:h,releaseId:m,getData:S,getRelease:y,paramsErrTip:p,warning:f,componentDid:R,resourceRelateComponents:I,disabledSelectComponents:j,saveSelectedEventsRef:D,hasSelectedResources:k,initLogoUrl:T,setLoading:L,releaseUsedLast:z,setReleaseUsedLast:B,projectType:v}){var de;const{t:C,locale:H}=te(),{api:W}=ye(),b=gt(),[w,q]=x.useState(!1),[g,_]=x.useState(!1),[J,U]=x.useState(),re=Le(Z=>Z.breakpoints.down("md")),K=x.useMemo(()=>{var Z;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((Z=o==null?void 0:o.blockletComponents)==null?void 0:Z.length)>0?(o==null?void 0:o.blockletComponents.find(E=>E.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),ee=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:R},"*"),y()},Be=async Z=>{var He,We,le,_e;if(p!=null&&p.blockletHomepage||p!=null&&p.blockletSupport||p!=null&&p.blockletCommunity){V.error((p==null?void 0:p.blockletHomepage)||(p==null?void 0:p.blockletSupport)||(p==null?void 0:p.blockletCommunity));return}const ve=os({params:o,hasSelectedResources:k,projectId:t,status:Z,t:C});if(ve){V.error(ve.map(O=>O.message).join("; ")),s(ve.reduce((O,ne)=>({...O,[ne.param]:ne.message}),{}));return}const E={...o};if(E.blockletComponents=Kn(E.blockletComponents,u,I,j),E.blockletVersion=$e.valid(E.blockletVersion),!E.blockletVersion){V.error("Invalid Blocklet Version"),s({blockletVersion:"Invalid Blocklet Version"});return}if(T)try{const O=await ol({did:u.meta.did,projectId:t,imageUrl:T});E.blockletLogo=O,l({blockletLogo:O})}catch(O){V.error(O.message);return}if(o.resourceFromSelect){E.uploadedResource="";try{const O=Object.keys(D.current);await Ze(O.map(ne=>()=>{const Pe=D.current[ne];return An({api:W,locale:H,projectId:t,releaseId:z?"":m,appDid:u.meta.did,component:Pe.component,resources:Pe.resources,initUrl:i})}),{concurrency:2})}catch(O){V.error(((le=(We=(He=O==null?void 0:O.response)==null?void 0:He.data)==null?void 0:We.error)==null?void 0:le.message)||O.message),s({blockletResource:"Invalid save the resource"});return}}else(_e=o.blockletDocker)!=null&&_e.dockerImage||(E.blockletComponents=[]);E.blockletTitle=(E.blockletTitle||"").trim(),E.blockletDescription=(E.blockletDescription||"").trim(),E.blockletSupport=(E.blockletSupport||"").trim(),E.blockletHomepage=(E.blockletHomepage||"").trim(),E.blockletCommunity=(E.blockletCommunity||"").trim(),E.blockletRepository=(E.blockletRepository||"").trim(),E.blockletIntroduction=(E.blockletIntroduction||"").trim(),E.note=(E.note||"").trim(),E.blockletComponents=((E==null?void 0:E.blockletComponents)||[]).filter(O=>O.included).map(O=>St(O,["did","required"])).map(JSON.stringify),E.contentType!=="docker"&&(E.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),E.blockletDocker.dockerImage=E.blockletDocker.dockerImage||"",E.blockletDocker.dockerArgs.length>0&&E.blockletDocker.dockerArgs.forEach(O=>{O.proxyBehavior=O.proxyBehavior||"service"});try{await W.createRelease({input:{...E,note:JSON.stringify({note:E.note}),did:u.meta.did,projectId:t,releaseId:z?"":m,status:Z}}),Z==="draft"?V.success(C("blocklet.publish.saveDraftSuccess")):(B(!1),V.success(C("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:R},"*")),s({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(O){const ne=Ne(O);V.error(ne),(/resource/.test(ne)||/zip/.test(ne))&&s({blockletResource:ne});return}const Te=await W.getProject({input:{did:u.meta.did,projectId:t}}),Ee=Te.project.lastReleaseId;o.autoUpload&&await Ze(Te.project.connectedStores.map(O=>async()=>{try{const ne=await W.publishToStore({input:{did:u.meta.did,storeId:O.storeId,storeName:O.storeName,projectId:t,releaseId:Ee,type:K}});V.success(e.jsx(sn,{storeName:O.storeName,storeUrl:O.storeUrl,developerDid:O.developerDid,published:ne.url==="published"}),{duration:1e4})}catch(ne){V.error(Ne(ne))}}),{concurrency:4}),ee==null||ee(),b(`../${t}/view/${Ee}`,{replace:!0})},$=Z=>(L(!0),Be(Z).finally(()=>{L(!1)})),M=async Z=>{await Fn(W,Z),S()},F=()=>{_(!0)},Q=be(go,`/api/project/${u.meta.did}/${t}/${m}/release/blocklet.json`),X=new URL(go);X.pathname=be(X.pathname,"/launch-blocklet/agreement"),X.searchParams.set("blocklet_meta_url",Q);const ie=X.href,Y=()=>U(Q);return e.jsxs(e.Fragment,{children:[e.jsx(nl,{className:"sticky-header",children:e.jsx(wt,{left:e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"../",children:C("common.blockletStudio")}),t===G.UNOWNED_DID?e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:re?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(xe,{to:`../${t}`,children:e.jsx(je,{maxLength:re?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(N,{color:"text.primary",children:d==="create"?C("common.create"):(o==null?void 0:o.blockletVersion)||C("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!h&&e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(se,{variant:"contained",onClick:()=>$(ue.PROJECT.RELEASE_STATUS.published),children:[n&&e.jsx(Ye,{size:14,sx:{mr:.5},color:"inherit"}),C("blocklet.publish.createRelease")]}),e.jsx(se,{variant:"contained",onClick:F,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),h&&e.jsxs(e.Fragment,{children:[e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:J,onClose:()=>U(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:C("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:J}),e.jsxs(N,{sx:{mt:2},children:[C("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:C("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(se,{onClick:()=>q(!0),children:[n?e.jsx(Ye,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(ts,{sx:{fontSize:"1.3em",mr:1}}),C(re?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(ns,{isPack:K==="pack",downloadUrl:be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${m}/download/${(a.files||[])[0]}`),installUrl:ie,handleSetTip:Y}),e.jsx(se,{onClick:F,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(yt,{title:C("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:w,onClose:()=>q(!1),children:e.jsx(Ht,{projectType:v,blocklet:u,releaseType:K,projectId:t,releaseId:m,componentDid:R,warning:f,onPublish:ee,onOpenConnectStore:M,onDelete:S,connectedStores:o.connectedStores||[],publishedStoreIds:a==null?void 0:a.publishedStoreIds})}),e.jsx(ss,{did:(de=u==null?void 0:u.meta)==null?void 0:de.did,params:o,projectId:t,open:g,setParams:l,onClose:()=>_(!1)})]})}ls.propTypes={projectId:r.string.isRequired,params:r.object.isRequired,mode:r.string.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,release:r.object.isRequired,isPublished:r.bool.isRequired,releaseId:r.string.isRequired,getData:r.func.isRequired,getRelease:r.func.isRequired,componentDid:r.string.isRequired,resourceRelateComponents:r.object.isRequired,disabledSelectComponents:r.bool.isRequired,saveSelectedEventsRef:r.object.isRequired,hasSelectedResources:r.bool.isRequired,initLogoUrl:r.string.isRequired,setLoading:r.func.isRequired,releaseUsedLast:r.bool.isRequired,setReleaseUsedLast:r.func.isRequired,projectType:r.string.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,setParams:r.func.isRequired,initUrl:r.object.isRequired,paramsErrTip:r.object.isRequired};const nl=ge.div`
158
+ `;var Ft={},Yn=ke;Object.defineProperty(Ft,"__esModule",{value:!0});var ts=Ft.default=void 0,Qn=Yn(Re()),Zn=e;ts=Ft.default=(0,Qn.default)((0,Zn.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l4.65-4.65c.2-.2.51-.2.71 0L17 13z"}),"CloudUploadRounded");const Kn=(t,o,s,i)=>{const l=t?[...t]:[],d=((o==null?void 0:o.children)||[]).reduce((n,u)=>(n[u.meta.did]=!0,n),{});return Object.keys(s).forEach(n=>{if(!d[n])return;let u=!1;i||l.forEach(a=>{a.did===n&&(a.included=!0,a.required=!0,u=!0)}),u||l.push({did:n,included:!0,required:!0})}),l},el=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],i=await(await fetch(t)).blob();return new File([i],o,{type:i.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*tl(t,o){let s=0;for(;s<t.size;)yield t.slice(s,s+o),s+=o}const ol=async({did:t,projectId:o,uploadType:s="logo",imageUrl:i})=>{const l=await el(i);new FormData().append("file",l);const n={uploaderId:"Uploader",relativePath:encodeURIComponent(l.name),name:encodeURIComponent(l.name),type:l.type},a=(await ro.post(be(G.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,s,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":l.size,"X-Uploader-File-Ext":l.name.split(".").pop(),"Upload-Metadata":Object.keys(n).map(y=>`${y} ${btoa(n[y])}`).join(",")}})).headers.location,h=2*1024*1024;let m=0,S="";for(const y of tl(l,h)){const p=await ro.patch(be(G.WELLKNOWN_SERVICE_PATH_PREFIX,a),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":m,"Content-Type":"application/offset+octet-stream"}});m+=y.size,S=p.data.filename}return S},os=({params:t,projectId:o,status:s,t:i})=>{const l=[];return t.blockletTitle||l.push({param:"blockletTitle",message:i("blocklet.publish.errorTip.noTitle")}),(!o||o===G.UNOWNED_DID)&&l.push({param:"projectId",message:i("blocklet.publish.errorTip.noDid")}),t.blockletVersion?$e.valid(t.blockletVersion)||l.push({param:"blockletVersion",message:i("blocklet.publish.errorTip.inValidVersion")}):l.push({param:"blockletVersion",message:i("blocklet.publish.errorTip.noVersion")}),s===ue.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||l.push({param:"blockletDescription",message:i("blocklet.publish.errorTip.noDescription")}),t.note||l.push({param:"note",message:i("blocklet.publish.errorTip.noNote")})),l.length?l:null},sl=({params:t,step:o,t:s,projectId:i})=>{if(o===0){if(!t.blockletTitle)return s("blocklet.publish.errorTip.noTitle");if(!i||i===G.UNOWNED_DID)return s("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return s("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return s("blocklet.publish.errorTip.noVersion");if(!$e.valid(t.blockletVersion))return s("blocklet.publish.errorTip.inValidVersion");if(!t.note)return s("blocklet.publish.errorTip.noNote")}return""};function Ht({blocklet:t,releaseId:o,connectedStores:s,projectId:i,releaseType:l,publishedStoreIds:d,onPublish:n,onDelete:u,warning:a,projectType:h,componentDid:m,onOpenConnectStore:S,behavior:y,onSelectConnectStore:p}){var L,z;const{t:f}=te(),{actions:{refreshBlocklet:R}}=ze(),{session:I}=Ue(),{storeList:j}=Mt({fromBlocklet:!0,blocklet:t,componentDid:m,userDid:(L=I==null?void 0:I.user)==null?void 0:L.did}),D=x.useMemo(()=>s!=null&&s.length?s==null?void 0:s.reduce((B,v)=>(B[v.storeId]=v,B),{}):{},[s]),k=(z=t==null?void 0:t.meta)==null?void 0:z.did,T={};return Object.entries((a==null?void 0:a.logoErrors)||{}).forEach(([B,v])=>{const C=Object.values(v);C.length>0&&(T[B]=C)}),Object.entries((a==null?void 0:a.screenshotErrors)||{}).forEach(([B,v])=>{const C=Object.values(v);C.length>0&&(T[B]=T[B]?[...T[B],...C]:C)}),e.jsxs(e.Fragment,{children:[y==="connect"&&!!(j!=null&&j.length)&&e.jsx(wo,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Cs[400],component:"a",href:h==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[f(h==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(dn,{sx:{marginLeft:1}})]})}),e.jsx(ws,{children:j==null?void 0:j.map(B=>e.jsx(Ss,{"data-cy":"store-switch",children:e.jsx(Is,{children:e.jsx(on,{behavior:y,onSelectConnectStore:p,releaseId:o,projectId:i,releaseType:l,kind:"publish",teamDid:k,warningList:T[B.url],store:B,published:(d==null?void 0:d.indexOf(B.id))>-1,connectedStore:D[B.id],onPublish:n,onDelete:u,scope:B.scope||"studio",onOpenConnectStore:S})})},B.url))}),e.jsx(Wo,{teamDid:k,storeList:j,scope:"studio",onAdd:R})]})}Ht.propTypes={blocklet:r.object.isRequired,projectId:r.string.isRequired,releaseId:r.string.isRequired,releaseType:r.string.isRequired,onPublish:r.func,onDelete:r.func,publishedStoreIds:r.arrayOf(r.string),connectedStores:r.arrayOf(r.object).isRequired,projectType:r.string,componentDid:r.string,warning:r.object,onOpenConnectStore:r.func,onSelectConnectStore:r.func,behavior:r.string};Ht.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function ss({did:t,params:o,setParams:s,projectId:i,open:l,onClose:d}){const{t:n}=te(),[u,a]=x.useState(!1),{api:h}=ye(),[m,S]=x.useState(!1),[y,p]=x.useState(!1),f=()=>{S(o.autoUpload),p(o.possibleSameStore),a(!1),d(!1)},R=async()=>{a(!0);try{await h.updateProject({input:{did:t,projectId:i,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!m,possibleSameStore:!!y}}),s({autoUpload:m,possibleSameStore:y}),d(!1)}catch(j){V.error(j.message)}a(!1)};x.useEffect(()=>{S(o.autoUpload),p(o.possibleSameStore)},[o]);const I=!!(i&&i!==G.UNOWNED_DID);return e.jsx(yt,{title:n("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:l,onClose:f,actions:e.jsxs(e.Fragment,{children:[e.jsx(se,{onClick:j=>{j.stopPropagation(),d()},color:"inherit",children:n("common.cancel")}),I&&e.jsxs(se,{onClick:j=>{j.stopPropagation(),R()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Ye,{size:16}),n("common.confirm")]})]}),children:I?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.autoUploadTip")}),e.jsx(De,{checked:m,onChange:(j,D)=>S(D)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.possibleSameStoreTip")}),e.jsx(De,{checked:y,onChange:(j,D)=>p(D)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.needProjectId")})]})})}ss.propTypes={did:r.string.isRequired,params:r.object.isRequired,open:r.bool.isRequired,onClose:r.func.isRequired,setParams:r.func.isRequired,projectId:r.string.isRequired};function ns({downloadUrl:t,installUrl:o,handleSetTip:s,isPack:i,disabled:l}){const{t:d}=te(),[n,u]=x.useState(!1),a=x.useRef(null),h=()=>{u(!n)},m=S=>{a.current&&a.current.contains(S.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(se,{disabled:l,ref:a,onClick:h,children:e.jsx(c,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(So,{sx:{zIndex:10},open:n,anchorEl:a.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:S})=>e.jsx(Io,{...S,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:m,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[i&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(N,{variant:"inherit",children:d("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:s,children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(N,{variant:"inherit",children:d("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(N,{variant:"inherit",children:d("common.download")})]})})]})})})})})]})}ns.propTypes={disabled:r.bool.isRequired,isPack:r.bool.isRequired,downloadUrl:r.string.isRequired,installUrl:r.string.isRequired,handleSetTip:r.func.isRequired};var Ro;const go=(Ro=window.env)==null?void 0:Ro.serverEndpoint;function ls({projectId:t,params:o,setParamsErrTip:s,initUrl:i,setParams:l,mode:d,loading:n,blocklet:u,release:a,isPublished:h,releaseId:m,getData:S,getRelease:y,paramsErrTip:p,warning:f,componentDid:R,resourceRelateComponents:I,disabledSelectComponents:j,saveSelectedEventsRef:D,hasSelectedResources:k,initLogoUrl:T,setLoading:L,releaseUsedLast:z,setReleaseUsedLast:B,projectType:v}){var de;const{t:C,locale:H}=te(),{api:W}=ye(),b=gt(),[w,q]=x.useState(!1),[g,_]=x.useState(!1),[J,U]=x.useState(),re=Le(Z=>Z.breakpoints.down("md")),K=x.useMemo(()=>{var Z;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((Z=o==null?void 0:o.blockletComponents)==null?void 0:Z.length)>0?(o==null?void 0:o.blockletComponents.find(E=>E.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),ee=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:R},"*"),y()},Be=async Z=>{var He,We,le,_e;if(p!=null&&p.blockletHomepage||p!=null&&p.blockletSupport||p!=null&&p.blockletCommunity){V.error((p==null?void 0:p.blockletHomepage)||(p==null?void 0:p.blockletSupport)||(p==null?void 0:p.blockletCommunity));return}const ve=os({params:o,hasSelectedResources:k,projectId:t,status:Z,t:C});if(ve){V.error(ve.map(O=>O.message).join("; ")),s(ve.reduce((O,ne)=>({...O,[ne.param]:ne.message}),{}));return}const E={...o};if(E.blockletComponents=Kn(E.blockletComponents,u,I,j),E.blockletVersion=$e.valid(E.blockletVersion),!E.blockletVersion){V.error("Invalid Blocklet Version"),s({blockletVersion:"Invalid Blocklet Version"});return}if(T)try{const O=await ol({did:u.meta.did,projectId:t,imageUrl:T});E.blockletLogo=O,l({blockletLogo:O})}catch(O){V.error(O.message);return}if(o.resourceFromSelect){E.uploadedResource="";try{const O=Object.keys(D.current);await Ze(O.map(ne=>()=>{const Pe=D.current[ne];return An({api:W,locale:H,projectId:t,releaseId:z?"":m,appDid:u.meta.did,component:Pe.component,resources:Pe.resources,initUrl:i})}),{concurrency:2})}catch(O){V.error(((le=(We=(He=O==null?void 0:O.response)==null?void 0:He.data)==null?void 0:We.error)==null?void 0:le.message)||O.message),s({blockletResource:"Invalid save the resource"});return}}else(_e=o.blockletDocker)!=null&&_e.dockerImage||(E.blockletComponents=[]);E.blockletTitle=(E.blockletTitle||"").trim(),E.blockletDescription=(E.blockletDescription||"").trim(),E.blockletSupport=(E.blockletSupport||"").trim(),E.blockletHomepage=(E.blockletHomepage||"").trim(),E.blockletCommunity=(E.blockletCommunity||"").trim(),E.blockletRepository=(E.blockletRepository||"").trim(),E.blockletIntroduction=(E.blockletIntroduction||"").trim(),E.note=(E.note||"").trim(),E.blockletComponents=((E==null?void 0:E.blockletComponents)||[]).filter(O=>O.included).map(O=>St(O,["did","required"])).map(JSON.stringify),E.contentType!=="docker"&&(E.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),E.blockletDocker.dockerImage=E.blockletDocker.dockerImage||"",E.blockletDocker.dockerArgs.length>0&&E.blockletDocker.dockerArgs.forEach(O=>{O.proxyBehavior=O.proxyBehavior||"service"});try{await W.createRelease({input:{...E,note:JSON.stringify({note:E.note}),did:u.meta.did,projectId:t,releaseId:z?"":m,status:Z}}),Z==="draft"?V.success(C("blocklet.publish.saveDraftSuccess")):(B(!1),V.success(C("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:R},"*")),s({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(O){const ne=Ne(O);V.error(ne),(/resource/.test(ne)||/zip/.test(ne))&&s({blockletResource:ne});return}const Te=await W.getProject({input:{did:u.meta.did,projectId:t}}),Ee=Te.project.lastReleaseId;o.autoUpload&&await Ze(Te.project.connectedStores.map(O=>async()=>{try{const ne=await W.publishToStore({input:{did:u.meta.did,storeId:O.storeId,storeName:O.storeName,projectId:t,releaseId:Ee,type:K}});V.success(e.jsx(sn,{storeName:O.storeName,storeUrl:O.storeUrl,developerDid:O.developerDid,did:u.meta.did,published:ne.url==="published"}),{duration:1e4})}catch(ne){V.error(Ne(ne))}}),{concurrency:4}),ee==null||ee(),b(`../${t}/view/${Ee}`,{replace:!0})},$=Z=>(L(!0),Be(Z).finally(()=>{L(!1)})),M=async Z=>{await Fn(W,Z),S()},F=()=>{_(!0)},Q=be(go,`/api/project/${u.meta.did}/${t}/${m}/release/blocklet.json`),X=new URL(go);X.pathname=be(X.pathname,"/launch-blocklet/agreement"),X.searchParams.set("blocklet_meta_url",Q);const ie=X.href,Y=()=>U(Q);return e.jsxs(e.Fragment,{children:[e.jsx(nl,{className:"sticky-header",children:e.jsx(wt,{left:e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"../",children:C("common.blockletStudio")}),t===G.UNOWNED_DID?e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:re?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(xe,{to:`../${t}`,children:e.jsx(je,{maxLength:re?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(N,{color:"text.primary",children:d==="create"?C("common.create"):(o==null?void 0:o.blockletVersion)||C("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!h&&e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(se,{variant:"contained",onClick:()=>$(ue.PROJECT.RELEASE_STATUS.published),children:[n&&e.jsx(Ye,{size:14,sx:{mr:.5},color:"inherit"}),C("blocklet.publish.createRelease")]}),e.jsx(se,{variant:"contained",onClick:F,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),h&&e.jsxs(e.Fragment,{children:[e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:J,onClose:()=>U(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:C("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:J}),e.jsxs(N,{sx:{mt:2},children:[C("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:C("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(se,{onClick:()=>q(!0),children:[n?e.jsx(Ye,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(ts,{sx:{fontSize:"1.3em",mr:1}}),C(re?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(ns,{isPack:K==="pack",downloadUrl:be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${m}/download/${(a.files||[])[0]}`),installUrl:ie,handleSetTip:Y}),e.jsx(se,{onClick:F,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(yt,{title:C("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:w,onClose:()=>q(!1),children:e.jsx(Ht,{projectType:v,blocklet:u,releaseType:K,projectId:t,releaseId:m,componentDid:R,warning:f,onPublish:ee,onOpenConnectStore:M,onDelete:S,connectedStores:o.connectedStores||[],publishedStoreIds:a==null?void 0:a.publishedStoreIds})}),e.jsx(ss,{did:(de=u==null?void 0:u.meta)==null?void 0:de.did,params:o,projectId:t,open:g,setParams:l,onClose:()=>_(!1)})]})}ls.propTypes={projectId:r.string.isRequired,params:r.object.isRequired,mode:r.string.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,release:r.object.isRequired,isPublished:r.bool.isRequired,releaseId:r.string.isRequired,getData:r.func.isRequired,getRelease:r.func.isRequired,componentDid:r.string.isRequired,resourceRelateComponents:r.object.isRequired,disabledSelectComponents:r.bool.isRequired,saveSelectedEventsRef:r.object.isRequired,hasSelectedResources:r.bool.isRequired,initLogoUrl:r.string.isRequired,setLoading:r.func.isRequired,releaseUsedLast:r.bool.isRequired,setReleaseUsedLast:r.func.isRequired,projectType:r.string.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,setParams:r.func.isRequired,initUrl:r.object.isRequired,paramsErrTip:r.object.isRequired};const nl=ge.div`
159
159
  .sticky-header {
160
160
  margin-top: -12px;
161
161
  padding: 12px 0;
@@ -169,7 +169,7 @@ import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-reac
169
169
  padding-bottom: 12px;
170
170
  border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
171
171
  }
172
- `;function rs({text:t}){return t?e.jsx(un,{wrapperElement:{"data-color-mode":"light"},source:Fs.sanitize(t),rehypePlugins:[[pn,{target:"_blank"}]]}):e.jsx(Ae,{Icon:Dt})}rs.propTypes={text:r.string.isRequired};function is({params:t,setParams:o,paramsErrTip:s,loading:i,setParamsErrTip:l,readOnly:d}){var m;const{t:n}=te(),[u,a]=x.useState(d?"preview":"write"),h=(S,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(N,{variant:"h6",fontWeight:"bold",sx:{},children:n("common.introduction")}),e.jsxs($o,{value:u,onChange:h,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(oe,{disabled:i||d,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Me,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(rs,{text:t.blockletIntroduction||""})})]})}is.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};var Gt={},ll=ke;Object.defineProperty(Gt,"__esModule",{value:!0});var mt=Gt.default=void 0,rl=ll(Re()),jo=e;mt=Gt.default=(0,rl.default)([(0,jo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,jo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Jt({step:t,ok:o,active:s,error:i,warning:l}){let d="grey.500",n=t+1;return o&&(n=e.jsx(hn,{sx:{fontSize:18,margin:0},color:"white"})),i||!o&&s>t?(d="error.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):l?(d="warning.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Jt.propTypes={step:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};Jt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function cs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:i,params:l,loading:d,paramsErrTip:n,warning:u,viewMode:a,projectId:h}){const{t:m}=te(),S=()=>{s(R=>R+1)},y=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",f=a||os({hasSelectedResources:i,params:l,projectId:h,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Ds,{activeStep:o,orientation:"vertical",children:t.map((R,I)=>{const j={},D=d||!sl({hasSelectedResources:i,params:l,projectId:h,step:I,t:m}),k=d?"":p(I);return k&&(j.optional=e.jsx(N,{variant:"caption",color:"error",children:k}),j.error=!0),e.jsxs(Ts,{children:[e.jsx(_s,{icon:e.jsx(Jt,{error:k,warning:I===0?u.hasWarning:!1,active:f?99:o,step:I,ok:D}),sx:{cursor:"pointer",color:k?"error.main":"inherit"},disabled:!1,onClick:()=>s(I),...j,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:k||!D&&o>I?"error.main":"inherit",children:R.label})}),e.jsxs(Ps,{children:[e.jsx(N,{fontSize:12,children:R.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[I<t.length-1&&e.jsx(se,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:k||!D,children:m("common.continue")}),I>0&&e.jsx(se,{disabled:I===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}cs.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.string.isRequired,loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.bool.isRequired,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 il=[".zip",".gz"],cl=1024*1024*100,al=x.lazy(()=>zo(()=>import("./index-D8WxMgot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:i,setParams:l,setParamsErrTip:d,error:n}){const{t:u,locale:a}=te(),h=x.useRef(null),m=()=>s?!1:!o||o===G.UNOWNED_DID?(V.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(N,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!i.uploadedResource&&e.jsx(N,{component:"a",href:`${S}/params.uploadedResource`,children:i.uploadedResource}),!s&&e.jsx(se,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=h.current)==null||y.open())},children:i.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(al,{ref:h,locale:a,popup:!0,onUploadFinish:y=>{var p;l({uploadedResource:y.data.filename}),d({blockletResource:""}),(p=h.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:il,maxFileSize:cl,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.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};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:i,setParamsErrTip:l,loading:d}){var u;const{t:n}=te();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{required:!0,disabled:d||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{l({blockletVersion:""}),s({blockletVersion:a.target.value})},error:!!i.blockletVersion,helperText:i.blockletVersion||""}),e.jsx(oe,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Me,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{l({note:""}),s({note:a.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!i.note,helperText:i.note||"",sx:{mt:3}})]})})}Ke.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};Ke.defaultProps={};function as(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&as(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:i,dataKey:l,t:d,readOnly:n}){const u=(o==null?void 0:o.value)||"",[a,h]=x.useState(!1),m=()=>{var W;(W=s[l])==null||W.splice(t,1),i({...s,[l]:[...s[l]]})},S=(W,b)=>{var w;(w=s[l])!=null&&w[t]&&(b?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),i({...s,[l]:[...s[l]]})},y=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],secure:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},p=(W,b)=>{s[l][t]={...s[l][t],shared:b},i({...s,[l]:[...s[l]]})},f=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],required:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},R=(W,b)=>{s[l][t]={...s[l][t],value:b?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},i({...s,[l]:[...s[l]]})},I=W=>{s[l][t]={...s[l][t],description:W.target.value},i({...s,[l]:[...s[l]]})},j=W=>{const b=W.target.value==="web"?"web":"docker";b==="web"&&s.dockerArgs.forEach(g=>{g.type="docker"});const q=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:b,path:b==="docker"?q:"/",protocol:"http",prefix:b==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},i({...s,dockerArgs:[...s.dockerArgs]})},D=W=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:W.target.value==="direct"?"direct":"service"},i({...s,dockerArgs:[...s.dockerArgs]})},k=W=>{const b=W.target.value;s[l][t]={...s[l][t],prefix:b,path:b==="*"?"/":b},i({...s,[l]:[...s[l]]})},T=W=>{var b;(b=s[l])!=null&&b[t]&&(s[l][t].value=W.target.value),i({...s,[l]:[...s[l]]})},L=u===`$${dt(o.key)}`||o.custom,z=l==="dockerArgs"&&!Oo[o.key],B=nn[o.key],v=l==="dockerEnvs",C=o.key==="--publish";let H=o.key;return C&&o.type==="web"?H="--publish (Web)":v&&(H=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(N,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:H})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(oe,{disabled:n||L||z||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Me,{position:"end",sx:{zoom:.9},children:[(!(B||z)||v||C)&&e.jsx(ce,{onClick:()=>h(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:m,color:z?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:z,onChange:T}),z&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ln[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(v?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>h(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||z||v?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:L,onChange:S,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:f,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(oe,{disabled:n,value:o.description,onChange:I,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),C&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:j,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:D,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(oe,{disabled:n,value:o.prefix,onChange:k,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}et.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};et.defaultProps={};const dl=`
172
+ `;function rs({text:t}){return t?e.jsx(un,{wrapperElement:{"data-color-mode":"light"},source:Fs.sanitize(t),rehypePlugins:[[pn,{target:"_blank"}]]}):e.jsx(Ae,{Icon:Dt})}rs.propTypes={text:r.string.isRequired};function is({params:t,setParams:o,paramsErrTip:s,loading:i,setParamsErrTip:l,readOnly:d}){var m;const{t:n}=te(),[u,a]=x.useState(d?"preview":"write"),h=(S,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(N,{variant:"h6",fontWeight:"bold",sx:{},children:n("common.introduction")}),e.jsxs($o,{value:u,onChange:h,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(oe,{disabled:i||d,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Me,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(rs,{text:t.blockletIntroduction||""})})]})}is.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};var Gt={},ll=ke;Object.defineProperty(Gt,"__esModule",{value:!0});var mt=Gt.default=void 0,rl=ll(Re()),jo=e;mt=Gt.default=(0,rl.default)([(0,jo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,jo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Jt({step:t,ok:o,active:s,error:i,warning:l}){let d="grey.500",n=t+1;return o&&(n=e.jsx(hn,{sx:{fontSize:18,margin:0},color:"white"})),i||!o&&s>t?(d="error.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):l?(d="warning.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Jt.propTypes={step:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};Jt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function cs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:i,params:l,loading:d,paramsErrTip:n,warning:u,viewMode:a,projectId:h}){const{t:m}=te(),S=()=>{s(R=>R+1)},y=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",f=a||os({hasSelectedResources:i,params:l,projectId:h,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Ds,{activeStep:o,orientation:"vertical",children:t.map((R,I)=>{const j={},D=d||!sl({hasSelectedResources:i,params:l,projectId:h,step:I,t:m}),k=d?"":p(I);return k&&(j.optional=e.jsx(N,{variant:"caption",color:"error",children:k}),j.error=!0),e.jsxs(Ts,{children:[e.jsx(_s,{icon:e.jsx(Jt,{error:k,warning:I===0?u.hasWarning:!1,active:f?99:o,step:I,ok:D}),sx:{cursor:"pointer",color:k?"error.main":"inherit"},disabled:!1,onClick:()=>s(I),...j,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:k||!D&&o>I?"error.main":"inherit",children:R.label})}),e.jsxs(Ps,{children:[e.jsx(N,{fontSize:12,children:R.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[I<t.length-1&&e.jsx(se,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:k||!D,children:m("common.continue")}),I>0&&e.jsx(se,{disabled:I===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}cs.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.string.isRequired,loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.bool.isRequired,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 il=[".zip",".gz"],cl=1024*1024*100,al=x.lazy(()=>zo(()=>import("./index-D58h54sQ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:i,setParams:l,setParamsErrTip:d,error:n}){const{t:u,locale:a}=te(),h=x.useRef(null),m=()=>s?!1:!o||o===G.UNOWNED_DID?(V.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(N,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!i.uploadedResource&&e.jsx(N,{component:"a",href:`${S}/params.uploadedResource`,children:i.uploadedResource}),!s&&e.jsx(se,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=h.current)==null||y.open())},children:i.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(al,{ref:h,locale:a,popup:!0,onUploadFinish:y=>{var p;l({uploadedResource:y.data.filename}),d({blockletResource:""}),(p=h.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:il,maxFileSize:cl,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.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};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:i,setParamsErrTip:l,loading:d}){var u;const{t:n}=te();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{required:!0,disabled:d||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{l({blockletVersion:""}),s({blockletVersion:a.target.value})},error:!!i.blockletVersion,helperText:i.blockletVersion||""}),e.jsx(oe,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Me,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{l({note:""}),s({note:a.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!i.note,helperText:i.note||"",sx:{mt:3}})]})})}Ke.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};Ke.defaultProps={};function as(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&as(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:i,dataKey:l,t:d,readOnly:n}){const u=(o==null?void 0:o.value)||"",[a,h]=x.useState(!1),m=()=>{var W;(W=s[l])==null||W.splice(t,1),i({...s,[l]:[...s[l]]})},S=(W,b)=>{var w;(w=s[l])!=null&&w[t]&&(b?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),i({...s,[l]:[...s[l]]})},y=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],secure:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},p=(W,b)=>{s[l][t]={...s[l][t],shared:b},i({...s,[l]:[...s[l]]})},f=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],required:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},R=(W,b)=>{s[l][t]={...s[l][t],value:b?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},i({...s,[l]:[...s[l]]})},I=W=>{s[l][t]={...s[l][t],description:W.target.value},i({...s,[l]:[...s[l]]})},j=W=>{const b=W.target.value==="web"?"web":"docker";b==="web"&&s.dockerArgs.forEach(g=>{g.type="docker"});const q=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:b,path:b==="docker"?q:"/",protocol:"http",prefix:b==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},i({...s,dockerArgs:[...s.dockerArgs]})},D=W=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:W.target.value==="direct"?"direct":"service"},i({...s,dockerArgs:[...s.dockerArgs]})},k=W=>{const b=W.target.value;s[l][t]={...s[l][t],prefix:b,path:b==="*"?"/":b},i({...s,[l]:[...s[l]]})},T=W=>{var b;(b=s[l])!=null&&b[t]&&(s[l][t].value=W.target.value),i({...s,[l]:[...s[l]]})},L=u===`$${dt(o.key)}`||o.custom,z=l==="dockerArgs"&&!Oo[o.key],B=nn[o.key],v=l==="dockerEnvs",C=o.key==="--publish";let H=o.key;return C&&o.type==="web"?H="--publish (Web)":v&&(H=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(N,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:H})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(oe,{disabled:n||L||z||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Me,{position:"end",sx:{zoom:.9},children:[(!(B||z)||v||C)&&e.jsx(ce,{onClick:()=>h(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:m,color:z?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:z,onChange:T}),z&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ln[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(v?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>h(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||z||v?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:L,onChange:S,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:f,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(oe,{disabled:n,value:o.description,onChange:I,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),C&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:j,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:D,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(oe,{disabled:n,value:o.prefix,onChange:k,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}et.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};et.defaultProps={};const dl=`
173
173
  docker run --name postgrest
174
174
  -p 3000:3000
175
175
  -e PGRST_DB_URI="postgres://username:password@host:port/database"
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lottie-react.esm-CPHH620R.js","assets/vendor-react-DoD83n6N.js"])))=>i.map(i=>d[i]);
2
- import{j as a,a3 as m,bd as y,T as V,M as R,bz as L,bn as _,bA as U,c0 as j,x as v,a9 as D,aa as w,cM as J,dh as W,di as q,I as H,dj as X,e as K,bS as Y}from"./vendor-mui-core-O22FPGM4.js";import{r as u}from"./vendor-react-DoD83n6N.js";import{G as Q,a as M,e as Z,i as a0,b as i0}from"./vendor-hooks-CYyfK9g3.js";import{T as r0,bj as x0}from"./vendor-ux-did-connect-D75Zatzm.js";import{_ as t0}from"./vendor-arcblock-E5QJEgSK.js";import{aH as k0}from"./vendor-utils-CbeKtci8.js";import{getAIKitComponent as s0}from"./index-D8WxMgot.js";import"./lottie-web-B6s7dDoL.js";import"./index-DQKEK30u.js";import"./index-CYdNDqQ1.js";import"./index-tUQxVYYQ.js";const O=u.createContext({}),I=()=>u.useContext(O);function m0({children:i,restrictions:n,i18n:s,theme:r}){const[e,h]=Q({loading:!1}),l=x=>h(f=>({...f,loading:x})),c=u.useMemo(()=>({...e,onLoading:l,restrictions:n,i18n:s}),[e]);return a.jsx(r0,{theme:r,children:a.jsx(O.Provider,{value:c,children:i})})}const e0=["1024x1024","1024x1792","1792x1024"],o0=["256x256","512x512","1024x1024"],n0=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function l0({onSubmit:i}){const{loading:n,i18n:s}=I(),r=M({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),e=()=>{const x=JSON.parse(JSON.stringify(r));Object.values(r).every(G=>!!G)&&i(x)},{run:h}=Z(e,{wait:500}),l={width:"100%",pl:"12px",pr:"16px"},c=r.model==="dall-e-2"?o0:e0;return a.jsxs(p0,{onSubmit:x=>x.preventDefault(),children:[a.jsx(m,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:a.jsxs(y,{container:!0,gap:2.5,children:[a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:s("aiImagePrompt")}),a.jsx(R,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:r.prompt??"",onChange:x=>{x.stopPropagation(),r.prompt=x.target.value},inputProps:{maxLength:1e3}})]}),a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageModel")}`}),a.jsx(L,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px"}},value:r.model,onChange:x=>{r.number=1,r.size="1024x1024",r.model=x.target.value},children:n0.map(x=>a.jsx(_,{value:x.value,control:a.jsx(U,{size:"small"}),label:x.label},x.label))})]}),a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageSize")}: ${r.size}`}),a.jsx(y,{container:!0,sx:{gap:2.5,pt:1},children:a.jsx(m,{flex:1,children:a.jsx(m,{...l,children:a.jsx(j,{size:"small",min:0,max:c.length-1,step:1,value:c.findIndex(x=>x==r.size),onChange:(x,f)=>{r.size=c[f]}})})})})]}),r.model==="dall-e-2"&&a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageNumber")}: ${r.number}`}),a.jsx(m,{...l,children:a.jsx(j,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:r.number,onChange:(x,f)=>{x.stopPropagation(),r.number=Number(f)}})})]})]})}),a.jsx(v,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:h,disabled:n,children:s(n?"aiImageGenerating":"aiImageGenerate")},n?"loading-submit":"submit")]})}const p0=D(m)`
2
+ import{j as a,a3 as m,bd as y,T as V,M as R,bz as L,bn as _,bA as U,c0 as j,x as v,a9 as D,aa as w,cM as J,dh as W,di as q,I as H,dj as X,e as K,bS as Y}from"./vendor-mui-core-O22FPGM4.js";import{r as u}from"./vendor-react-DoD83n6N.js";import{G as Q,a as M,e as Z,i as a0,b as i0}from"./vendor-hooks-CYyfK9g3.js";import{T as r0,bj as x0}from"./vendor-ux-did-connect-D75Zatzm.js";import{_ as t0}from"./vendor-arcblock-CZsH3o1m.js";import{aH as k0}from"./vendor-utils-CbeKtci8.js";import{getAIKitComponent as s0}from"./index-D58h54sQ.js";import"./lottie-web-B6s7dDoL.js";import"./index-DQKEK30u.js";import"./index-CBS4EwIH.js";import"./index-tUQxVYYQ.js";const O=u.createContext({}),I=()=>u.useContext(O);function m0({children:i,restrictions:n,i18n:s,theme:r}){const[e,h]=Q({loading:!1}),l=x=>h(f=>({...f,loading:x})),c=u.useMemo(()=>({...e,onLoading:l,restrictions:n,i18n:s}),[e]);return a.jsx(r0,{theme:r,children:a.jsx(O.Provider,{value:c,children:i})})}const e0=["1024x1024","1024x1792","1792x1024"],o0=["256x256","512x512","1024x1024"],n0=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function l0({onSubmit:i}){const{loading:n,i18n:s}=I(),r=M({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),e=()=>{const x=JSON.parse(JSON.stringify(r));Object.values(r).every(G=>!!G)&&i(x)},{run:h}=Z(e,{wait:500}),l={width:"100%",pl:"12px",pr:"16px"},c=r.model==="dall-e-2"?o0:e0;return a.jsxs(p0,{onSubmit:x=>x.preventDefault(),children:[a.jsx(m,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:a.jsxs(y,{container:!0,gap:2.5,children:[a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:s("aiImagePrompt")}),a.jsx(R,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:r.prompt??"",onChange:x=>{x.stopPropagation(),r.prompt=x.target.value},inputProps:{maxLength:1e3}})]}),a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageModel")}`}),a.jsx(L,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px"}},value:r.model,onChange:x=>{r.number=1,r.size="1024x1024",r.model=x.target.value},children:n0.map(x=>a.jsx(_,{value:x.value,control:a.jsx(U,{size:"small"}),label:x.label},x.label))})]}),a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageSize")}: ${r.size}`}),a.jsx(y,{container:!0,sx:{gap:2.5,pt:1},children:a.jsx(m,{flex:1,children:a.jsx(m,{...l,children:a.jsx(j,{size:"small",min:0,max:c.length-1,step:1,value:c.findIndex(x=>x==r.size),onChange:(x,f)=>{r.size=c[f]}})})})})]}),r.model==="dall-e-2"&&a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageNumber")}: ${r.number}`}),a.jsx(m,{...l,children:a.jsx(j,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:r.number,onChange:(x,f)=>{x.stopPropagation(),r.number=Number(f)}})})]})]})}),a.jsx(v,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:h,disabled:n,children:s(n?"aiImageGenerating":"aiImageGenerate")},n?"loading-submit":"submit")]})}const p0=D(m)`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  height: 100%;
@@ -1 +1 @@
1
- import{j as t,a9 as r}from"./vendor-mui-core-O22FPGM4.js";import{r as s}from"./vendor-react-DoD83n6N.js";import{aX as a}from"./vendor-ux-did-connect-D75Zatzm.js";import{R as e}from"./vendor-arcblock-E5QJEgSK.js";import"./vendor-utils-CbeKtci8.js";import"./vendor-hooks-CYyfK9g3.js";import"./lottie-web-B6s7dDoL.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};
1
+ import{j as t,a9 as r}from"./vendor-mui-core-O22FPGM4.js";import{r as s}from"./vendor-react-DoD83n6N.js";import{aX as a}from"./vendor-ux-did-connect-D75Zatzm.js";import{R as e}from"./vendor-arcblock-CZsH3o1m.js";import"./vendor-utils-CbeKtci8.js";import"./vendor-hooks-CYyfK9g3.js";import"./lottie-web-B6s7dDoL.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};