@abtnode/blocklet-services 1.16.38-beta-20250118-033334-2da05ae8 → 1.16.38-beta-20250120-112111-55c032e8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/routes/env.js +2 -0
- package/dist/assets/{Add-DA06or_T.js → Add-DwDyMZjP.js} +1 -1
- package/dist/assets/{ArrowDropDown-ByvmY1fG.js → ArrowDropDown-6xgUlX8W.js} +1 -1
- package/dist/assets/{CheckCircle-61kAAbS7.js → CheckCircle-D3qBEHQS.js} +1 -1
- package/dist/assets/{ChevronLeft-BEMgr19u.js → ChevronLeft-DgLREh72.js} +1 -1
- package/dist/assets/{ChevronRight-C9Sf_Tx7.js → ChevronRight-IFh5bkgF.js} +1 -1
- package/dist/assets/{DeleteOutline-CUlVP0SU.js → DeleteOutline-DQMkPBvg.js} +1 -1
- package/dist/assets/{Done-DBzH2QOU.js → Done-DLCsccPu.js} +1 -1
- package/dist/assets/{Download-CufGBMcn.js → Download-DTpNGuLl.js} +1 -1
- package/dist/assets/{Error-BRj42iX7.js → Error-UtB5QYSZ.js} +1 -1
- package/dist/assets/{Google-C9fXfahB.js → Google-BOAVI-Xc.js} +1 -1
- package/dist/assets/{InfoOutlined-CB0cJwBU.js → InfoOutlined-DQLlyyVh.js} +1 -1
- package/dist/assets/{Launch-DhDcxyle.js → Launch-Dh_xOrs9.js} +1 -1
- package/dist/assets/{LaunchOutlined--NsW2V4X.js → LaunchOutlined-foAf5c3n.js} +1 -1
- package/dist/assets/{Loop-DecQ6hrf.js → Loop-C4-HT3aE.js} +1 -1
- package/dist/assets/{MoreHoriz-jR1hvlRv.js → MoreHoriz-CUpIy534.js} +1 -1
- package/dist/assets/{PlayArrow-BQPL8ZKx.js → PlayArrow-DXnaLQNG.js} +1 -1
- package/dist/assets/{ViewList-COpI8i9D.js → ViewList-CRla7mfM.js} +1 -1
- package/dist/assets/_createAggregator-B36dTDyD.js +1 -0
- package/dist/assets/{access-control-DRWHWy3M.js → access-control-vt3SOToF.js} +1 -1
- package/dist/assets/{actions-DDDMPf_w.js → actions-Ca8zHti6.js} +1 -1
- package/dist/assets/add-component-core-CacRzL5C.js +716 -0
- package/dist/assets/{add-resource-BsYmNHG4.js → add-resource-ZEGylpES.js} +1 -1
- package/dist/assets/{addon-DRWTut9y.js → addon-CD5JNqbI.js} +1 -1
- package/dist/assets/{analytics-DJeRvifL.js → analytics-hNGjKcAT.js} +1 -1
- package/dist/assets/api-CjgpDSsI.js +1 -0
- package/dist/assets/ar-4M8AtNpp.js +3 -0
- package/dist/assets/{audit-logs-Dm5FbBZf.js → audit-logs-BKvkrneR.js} +1 -1
- package/dist/assets/{base32-BJ0zdvwj.js → base32-uGF9kxBw.js} +1 -1
- package/dist/assets/{branding-CJaxWW-w.js → branding-BfuJue_R.js} +2 -2
- package/dist/assets/{bundle-avatar-C5AcmC3p.js → bundle-avatar-BkNNM9he.js} +1 -1
- package/dist/assets/{button-bqdvVuzW.js → button-6RO042tO.js} +1 -1
- package/dist/assets/{click-to-copy-CmMy3CrF.js → click-to-copy-DSvEXBYz.js} +1 -1
- package/dist/assets/{complete-DrVsBs5y.js → complete-DOx-lUao.js} +1 -1
- package/dist/assets/{component-C5IX8wdu.js → component-DuXXl9Wb.js} +1 -1
- package/dist/assets/{config-10aPmzrE.js → config-BY9NHNw2.js} +2 -2
- package/dist/assets/{config-CJbVE0vv.js → config-_Ff2iSUC.js} +1 -1
- package/dist/assets/{config-navigation-CE_c3uZg.js → config-navigation-m1gKN3Qh.js} +3 -3
- package/dist/assets/{config-space-vTcG8SS6.js → config-space-DFc6Pvuv.js} +1 -1
- package/dist/assets/{confirm-CCF7Eh83.js → confirm-DUAXonUU.js} +1 -1
- package/dist/assets/{connect-DjXf6uie.js → connect-B8cD_Man.js} +1 -1
- package/dist/assets/{connect-DLAivc8W.js → connect-CywmqoEu.js} +1 -1
- package/dist/assets/{connect-to-DDEY8_e3.js → connect-to-DrkQpX8j.js} +1 -1
- package/dist/assets/{dashboard-D7d4Tags.js → dashboard-ChoAkepn.js} +3 -3
- package/dist/assets/{de-BYtQQOr-.js → de-BVgb1fEg.js} +1 -1
- package/dist/assets/de-D7CG0ov1.js +3 -0
- package/dist/assets/{did-address-DsOFwsmU.js → did-address-BD4xjcb5.js} +1 -1
- package/dist/assets/{domain-ZudrUt0P.js → domain-C3fxr6Yg.js} +1 -1
- package/dist/assets/{domain-list-DmocBvA0.js → domain-list-Do_JR9rl.js} +2 -2
- package/dist/assets/{email-DiKDXKCR.js → email-Bne33m4E.js} +3 -3
- package/dist/assets/es-DDr-aesw.js +3 -0
- package/dist/assets/{exchange-passport-CTKeYxYs.js → exchange-passport-De6icZUJ.js} +1 -1
- package/dist/assets/{form-text-input-juPY5e76.js → form-text-input-BCHcrKD9.js} +1 -1
- package/dist/assets/fr-CsECkLCu.js +3 -0
- package/dist/assets/{fuel-kHIIeGc9.js → fuel-BCXVQ7L0.js} +1 -1
- package/dist/assets/{fullpage-vhYlt62g.js → fullpage-Dd-4ilXd.js} +1 -1
- package/dist/assets/{get-safe-url-Bg-eYJFz.js → get-safe-url-CWTjw4O_.js} +1 -1
- package/dist/assets/{get-safe-url-CUm2E-jn.js → get-safe-url-g5s2_Tjs.js} +1 -1
- package/dist/assets/hi-Bojespkc.js +1 -0
- package/dist/assets/{home-X6wxlptK.js → home-Cy8ZPRh3.js} +1 -1
- package/dist/assets/{id-CgtYzmhQ.js → id-CUsGyKYW.js} +1 -1
- package/dist/assets/id-PvpxFUDg.js +3 -0
- package/dist/assets/{iframe-CVBJbqTp.js → iframe-B1rCM9Eo.js} +1 -1
- package/dist/assets/{index-H5hAQJcb.js → index-0YXNPVgm.js} +26 -26
- package/dist/assets/index-3ytyTrcC.js +2 -0
- package/dist/assets/{index-CYWGE7K9.js → index-BEw2AyDT.js} +7 -7
- package/dist/assets/{index-BnQkyyTO.js → index-BJ7_xt0j.js} +29 -29
- package/dist/assets/{index-NpTIA0Yh.js → index-Bj0uuh8o.js} +1 -1
- package/dist/assets/{index-JFhSGIs6.js → index-BnIb4VTf.js} +1 -1
- package/dist/assets/{index-C9c6FdP7.js → index-C1Xq6XBK.js} +1 -1
- package/dist/assets/{index-CuxhzgqO.js → index-C73dl7Hb.js} +1 -1
- package/dist/assets/{index-XdZHSkHK.js → index-CWMVCzCZ.js} +1 -1
- package/dist/assets/{index-BguQHm2Z.js → index-CfrumxV3.js} +1 -1
- package/dist/assets/index-D2ZJq7sT.js +228 -0
- package/dist/assets/{index-CUlGef8y.js → index-D5GvmQYq.js} +15 -15
- package/dist/assets/{index-CEmXvpjH.js → index-DKA7-XNE.js} +1 -1
- package/dist/assets/{index-BGO2DsWz.js → index-Dtif7RsI.js} +1 -1
- package/dist/assets/{index-B-my800N.js → index-HfngL4ZQ.js} +1 -1
- package/dist/assets/{index-BbrJG83p.js → index-wVbkSf51.js} +1 -1
- package/dist/assets/{invitation-CVhobKZ4.js → invitation-HSZrTxov.js} +1 -1
- package/dist/assets/{invite-CEfQ9Xdu.js → invite-Bq0wk8ts.js} +1 -1
- package/dist/assets/{issue-passport-C-sKKAKS.js → issue-passport-CVJgqjoO.js} +1 -1
- package/dist/assets/{item-BueNp2tn.js → item-ClsWGBWW.js} +2 -2
- package/dist/assets/ja-B9wMKQOb.js +3 -0
- package/dist/assets/ko-C_Flkwn-.js +3 -0
- package/dist/assets/{layout-CTddQfyh.js → layout-C4CjSZo6.js} +1 -1
- package/dist/assets/{list-header-Bce1kvpA.js → list-header-DH99VXjo.js} +1 -1
- package/dist/assets/localization-CBcpjiaX.js +1 -0
- package/dist/assets/{log-DV5xJK8V.js → log-DURqeXoL.js} +1 -1
- package/dist/assets/{login-CW9RVbaj.js → login-Bspf2QPd.js} +1 -1
- package/dist/assets/{login-oauth-callback-BVkafEHi.js → login-oauth-callback-C_wyWhiQ.js} +1 -1
- package/dist/assets/{logo-uploader-BuW1IV_-.js → logo-uploader-Dd2aFjos.js} +3 -3
- package/dist/assets/{lost-passport-C6Doyr0n.js → lost-passport-BSTbRq2w.js} +1 -1
- package/dist/assets/{open-window-CIN-c_8i.js → open-window-CbZilAH2.js} +1 -1
- package/dist/assets/{overview-Cx1NHKw_.js → overview-fXNI1ek4.js} +1 -1
- package/dist/assets/{page-header-PFRlhj0j.js → page-header-CjQ-ywzU.js} +1 -1
- package/dist/assets/{permission-BwvfjqYI.js → permission-7KeKIEKG.js} +1 -1
- package/dist/assets/{preferences-DY1qnOCx.js → preferences-BvdZgVe4.js} +1 -1
- package/dist/assets/pt-BqEVlA-1.js +1 -0
- package/dist/assets/publish-resource-DKGi8v_y.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DZo8yE8C.js → react-beautiful-dnd.esm-1AJr8vv6.js} +4 -4
- package/dist/assets/{relative-time-C-6wlxmy.js → relative-time-DXGmoAYD.js} +1 -1
- package/dist/assets/ru-u0x_icQc.js +1 -0
- package/dist/assets/sdk-iUaLet3q.js +1 -0
- package/dist/assets/session-Cz3pOVxP.js +1 -0
- package/dist/assets/{setup-Ejw_ADHH.js → setup-BoMrIrRo.js} +3 -3
- package/dist/assets/{start-mCJ8IO-s.js → start-DbCciQyK.js} +1 -1
- package/dist/assets/{step-actions-BbCSiBWz.js → step-actions-BF4Z-WD4.js} +1 -1
- package/dist/assets/{studio-C8ceaGGk.js → studio-DJOlNVRZ.js} +1 -1
- package/dist/assets/{switch-control-DzGhrJO3.js → switch-control-Df6SSLH9.js} +1 -1
- package/dist/assets/th-BX_96cb2.js +1 -0
- package/dist/assets/{toUpper-Ch8IcBS5.js → toUpper-BYBs387H.js} +1 -1
- package/dist/assets/{transfer-B7yyybIU.js → transfer-CoIJ2-Fh.js} +1 -1
- package/dist/assets/{unsubscribe-DqJ3ZVmc.js → unsubscribe-DHlZPuAs.js} +1 -1
- package/dist/assets/{useAsync-cdOzMWPw.js → useAsync-D2wKH3Wq.js} +1 -1
- package/dist/assets/{useAsyncRetry-ng-QDeMG.js → useAsyncRetry-B87-aW-H.js} +1 -1
- package/dist/assets/{useLocalStorage-CM8R1gkX.js → useLocalStorage-Dsxa7zZV.js} +1 -1
- package/dist/assets/user-center-BY7PdrGc.js +203 -0
- package/dist/assets/{util-D8HyMwt2.js → util-DzhfzPwC.js} +1 -1
- package/dist/assets/vendor-arcblock-D-SOxQ_x.js +3509 -0
- package/dist/assets/{vendor-hooks-CLzfFpO7.js → vendor-hooks-CAfthYak.js} +1 -1
- package/dist/assets/vendor-utils-B7sI0FpJ.js +11 -0
- package/dist/assets/vi-7r8InJhP.js +1 -0
- package/dist/assets/wrap-locale-CjCBeQlY.js +1 -0
- package/dist/assets/zh-D0JQ3A7z.js +4 -0
- package/dist/assets/{zh-tw-B8oIFv7R.js → zh-tw-CnxtpiBO.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
- package/dist/assets/_createAggregator-D73d37er.js +0 -1
- package/dist/assets/add-component-core-Cz5AqUoX.js +0 -716
- package/dist/assets/api-C0C4sDJA.js +0 -1
- package/dist/assets/ar-Dr7fntBt.js +0 -3
- package/dist/assets/de-GmIXK1UD.js +0 -3
- package/dist/assets/es-DVK5-peZ.js +0 -3
- package/dist/assets/fr-CjZFjFm5.js +0 -3
- package/dist/assets/hi-8hECDYim.js +0 -1
- package/dist/assets/id-Dv6VZG0f.js +0 -3
- package/dist/assets/index-iNTIfB79.js +0 -228
- package/dist/assets/ja-Cdy8ZhTC.js +0 -3
- package/dist/assets/ko-DrTpzs7q.js +0 -3
- package/dist/assets/localization-_hzGA-9a.js +0 -1
- package/dist/assets/pt-CMTeSYTi.js +0 -1
- package/dist/assets/publish-resource-ByN4rwnZ.js +0 -1
- package/dist/assets/ru-C9ShBb28.js +0 -1
- package/dist/assets/sdk-CrCNIpAP.js +0 -1
- package/dist/assets/session-Ku4cwX2M.js +0 -1
- package/dist/assets/th-Ci6_lraJ.js +0 -1
- package/dist/assets/user-center-BEkeBApB.js +0 -202
- package/dist/assets/vendor-arcblock-BlPSuvWz.js +0 -3506
- package/dist/assets/vendor-utils-DCpRgzMR.js +0 -11
- package/dist/assets/vi-CzSsX7fL.js +0 -1
- package/dist/assets/wrap-locale-CQCi4c6m.js +0 -1
- package/dist/assets/zh-Bo-Td4CQ.js +0 -4
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CUlGef8y.js","assets/vendor-arcblock-BlPSuvWz.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-DCpRgzMR.js","assets/vendor-hooks-CLzfFpO7.js","assets/vendor-mui-core-jh6OMVvU.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-BGO2DsWz.js","assets/index-BnQkyyTO.js","assets/_createAggregator-D73d37er.js","assets/index-DoZ2YM4T.js","assets/toUpper-Ch8IcBS5.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as R,k as Dt,l as lt,L as ie,f as Hn,h as Gn,i as pt}from"./vendor-react-D-afvo_7.js";import{a1 as he,j as t,t as Oe,a3 as u,aM as Vo,E as d,a4 as de,I as oe,T as A,bT as Fo,aa as ce,aE as Xn,bJ as Ge,ad as Uo,aN as Xe,bq as jt,x as Y,a2 as et,P as Ho,G as Go,v as Tt,$ as Xo,ar as Jo,al as ue,ah as Jn,D as Pt,ab as Qo,r as Yo,bH as Qn,K as Be,y as Zo,M as J,ac as je,aL as Yn,L as Zn,z as Kn,bn as es,aA as Ko,az as tt,bt as ts,bu as os,bU as ns,bV as ss,aP as en,bE as rs,bM as is,bx as ls,by as ft}from"./vendor-mui-core-jh6OMVvU.js";import{y as me,B as De,h as ke,aa as cs,f as mo,_ as tn,ac as bo}from"./index-BnQkyyTO.js";import{ad as be,d as H,g as Q,ag as ot,aq as on,bx as nn,ao as sn,ab as as,by as _t,z as V,E as ds,bm as us,bz as Lt,bA as ps,bB as fs,aa as hs,b2 as se,bC as ms,aP as bs,bh as Re,al as qt,bD as Se,aM as xs,aG as gs}from"./vendor-arcblock-BlPSuvWz.js";import{d as $t}from"./Add-DA06or_T.js";import{d as js}from"./Error-BRj42iX7.js";import{C as Nt}from"./confirm-CCF7Eh83.js";import{u as ct}from"./session-Ku4cwX2M.js";import{W as xo}from"./did-address-DsOFwsmU.js";import{E as We,D as go,C as jo,P as ko}from"./react-beautiful-dnd.esm-DZo8yE8C.js";import{B as Et}from"./bundle-avatar-C5AcmC3p.js";import{S as pe}from"./shorten-label-B08EnqgB.js";import{j as le,a as Je}from"./vendor-utils-DCpRgzMR.js";import{d as ks}from"./Download-CufGBMcn.js";import{d as ys}from"./QuestionMarkCircle-yIKrKrCO.js";import{u as vs}from"./vendor-hooks-CLzfFpO7.js";import{_ as we}from"./useSetState-Crt4S51m.js";import{c as At}from"./index-DoZ2YM4T.js";import{E as zt}from"./index-DvtOujRp.js";import{p as nt}from"./index-CuxhzgqO.js";import"./api-C0C4sDJA.js";import{d as ws}from"./ChevronRight-C9Sf_Tx7.js";import{T as Ss,a as Rs}from"./vendor-mui-x-BRRfPRl8.js";import{d as yo}from"./DeleteOutline-CUlVP0SU.js";import{c as Cs,A as rn,u as Is,S as Ds,U as Ts,a as ht,b as ln,n as Ps,e as _s,f as vo,g as Ls}from"./item-BueNp2tn.js";import{d as qs}from"./ArrowDropDown-ByvmY1fG.js";import{f as Ce}from"./format-error-C0Ke3VXF.js";import{C as $s}from"./click-to-copy-CmMy3CrF.js";import{d as Ns}from"./Launch-DhDcxyle.js";import{M as Es}from"./index-CzV3SmGK.js";import{r as As}from"./index-DwFu84UU.js";import{d as zs}from"./Done-DBzH2QOU.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-Bg-eYJFz.js";var Mt={},Ms=he;Object.defineProperty(Mt,"__esModule",{value:!0});var cn=Mt.default=void 0,Os=Ms(be()),Bs=t;cn=Mt.default=(0,Os.default)((0,Bs.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 Ot={},Ws=he;Object.defineProperty(Ot,"__esModule",{value:!0});var an=Ot.default=void 0,Vs=Ws(be()),Fs=t;an=Ot.default=(0,Vs.default)((0,Fs.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 Bt={},Us=he;Object.defineProperty(Bt,"__esModule",{value:!0});var dn=Bt.default=void 0,Hs=Us(be()),Gs=t;dn=Bt.default=(0,Hs.default)((0,Gs.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 Wt({did:e,projectId:o,title:n,logo:r,describe:s}){const i=`${`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=R.useState(!1),f=Oe(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Vo,{sx:{borderRadius:1},src:i}),t.jsxs(u,{children:[t.jsx(pe,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(pe,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Wt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Vt({initUrl:e}){const o=Dt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:l}=me(),{api:i}=ct(),[a,c]=R.useState(!0),{blocklet:f}=De(),[h,g]=R.useState(null),[x,p]=R.useState(!1),y=Oe(m=>m.breakpoints.down("xl")),{componentDid:w=""}=lt(),[D,j]=R.useState(null),b=()=>{l.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(m=>{const P=(m==null?void 0:m.projects)||[];c(!1),j(P)}).catch(m=>{c(!1),V.error(m.message)})},T=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},L=m=>{g(m)},I=()=>{c(!1),p(!0)},k=()=>{p(!1),g(null)},_=m=>{V.error(m.message),p(!1),g(null)},$=m=>{if(!(m!=null&&m.deleted)){V.error("Delete project failed");return}b(),p(!1),g(null)},B=(m,P,M)=>{let U=m==null?void 0:m.trim();return U?(U=ds.toAddress(U).toLocaleLowerCase(),M.some((v,N)=>{const q=P[N];return q&&v.searchable&&v.display!=="excluded"&&v.display!=="false"&&q.toLocaleLowerCase().includes(U)})):!0};if(R.useEffect(()=>{b()},[]),!D&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(We,{})});if(!D)return null;if(!D.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(ot,{onClick:T,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const S=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:m=>{const P=D[m];return t.jsx(ie,{to:`${P.id}`,children:t.jsx(Wt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:m=>m?t.jsx(on,{type:"success",children:m}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:m=>m?t.jsx(xo,{size:14,compact:!0,responsive:!1,did:m}):null}},y||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:m=>m?t.jsx(xo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${m}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:m}):null}},y||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:m=>{const P=(f.children||[]).find(M=>M.meta.did===m);return P?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Et,{size:14,blocklet:P,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},m):""}}},y||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:m=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(pe,{children:m})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:m=>t.jsx(nn,{value:Number(m),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:m=>{const P=D[m];return t.jsxs(u,{display:"flex",children:[t.jsx(ie,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:t.jsx(de,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"create",children:t.jsx(cn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&t.jsx(de,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx(ie,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:t.jsx(an,{sx:{fontSize:18}})})})}),t.jsx(de,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>L(P),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),C=x?t.jsx(as,{open:!0,popup:!0,onClose:k,action:"check-has-project-id",locale:s,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:$,onError:_,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(de,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(dn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(ot,{onClick:T,variant:"contained",children:[t.jsx($t,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(_t,{className:"main-table",locale:s,data:D,columns:S,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:B}}),h&&t.jsx(Nt,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:I,onCancel:()=>g(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(m=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:m})]}))})}),C]})}Vt.propTypes={initUrl:d.object};Vt.defaultProps={initUrl:null};var Ft={},Xs=he;Object.defineProperty(Ft,"__esModule",{value:!0});var un=Ft.default=void 0,Js=Xs(be()),wo=t;un=Ft.default=(0,Js.default)([(0,wo.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,wo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Qs(){var I;const{t:e,locale:o}=Q(),{projectId:n}=lt(),{api:r}=me(),[s,l]=R.useState(!0),{blocklet:i}=De(),a=Oe(k=>k.breakpoints.down("md")),[c,f]=R.useState(null),[h,g]=R.useState(null),[x,p]=R.useState(null),y=(I=window.env)==null?void 0:I.serverEndpoint,w=()=>{r.getReleases({input:{did:i.meta.did,projectId:n}}).then(k=>{const _=(k==null?void 0:k.releases)||[];l(!1),f(_)}).catch(k=>{l(!1),V.error(k.message)})},D=()=>{r.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:n}},getReleases:{input:{did:i.meta.did,projectId:n}}}).then(k=>{g(k.getProject.project||{}),f(k.getReleases.releases||[]),l(!1)}).catch(k=>{l(!1),V.error(k.message)})};R.useEffect(()=>{D()},[]);const j=()=>{l(!1);const k=x.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:k}}).then(()=>{l(!1),w(),V.success(e("common.removeSuccess")),p(null)}).catch(_=>{l(!1),V.error(_.message)})},b=k=>{p(k)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(We,{})});if(!c)return null;const T=t.jsxs(Fo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ie,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(pe,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[T,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(ie,{to:"create/none",children:t.jsx(ot,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const L=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(ie,{to:`view/${_.id}`,children:t.jsx(Wt,{did:i.meta.did,projectId:h.id,logo:_.blockletLogo,title:_.blockletVersion,describe:_.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(A,{className:"note",children:_.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:k=>t.jsx(on,{type:k==="published"?"success":"warning",children:k==="published"?"Released":us(k)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const _=c[k];return _.status!==ke.PROJECT.RELEASE_STATUS.published?"":t.jsx(nn,{value:Number(_.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var m;const _=c[k];let $="",B="";const S=_.status==="published";if(S){const P=le(y,`/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),M=new URL(y);M.pathname=le(M.pathname,"/launch-blocklet/agreement"),M.searchParams.set("blocklet_meta_url",P),$=M.href,B=le(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const C=(m=h.blockletComponents)!=null&&m.some(P=>P.included)||_.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[S&&C==="pack"&&t.jsx(de,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:$,target:"_blank",rel:"noreferrer",children:t.jsx(un,{sx:{fontSize:18}})})})}),S&&t.jsx(de,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:B,children:t.jsx(ks,{sx:{fontSize:18}})})})}),t.jsx(de,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>b(_),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(Ys,{children:[t.jsxs(u,{className:"header",children:[T,t.jsx(ie,{to:"new-release/none",children:t.jsxs(ot,{variant:"contained",children:[t.jsx($t,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(_t,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:L,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&t.jsx(Nt,{title:e(`${e("common.delete")} ${x.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:j,onCancel:()=>p(null)})]})}const Ys=ce(u)`
|
|
3
|
-
.header {
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
justify-content: space-between;
|
|
7
|
-
}
|
|
8
|
-
.main-table {
|
|
9
|
-
margin-top: 24px;
|
|
10
|
-
}
|
|
11
|
-
.main-table > div:first-child {
|
|
12
|
-
display: none;
|
|
13
|
-
}
|
|
14
|
-
.note {
|
|
15
|
-
word-break: break-all;
|
|
16
|
-
white-space: pre-line;
|
|
17
|
-
}
|
|
18
|
-
`;var Ut={},Zs=he;Object.defineProperty(Ut,"__esModule",{value:!0});var pn=Ut.default=void 0,Ks=Zs(be()),er=t;pn=Ut.default=(0,Ks.default)((0,er.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"DoDisturbAlt");function Ie({children:e,Icon:o}){return t.jsxs(Xn,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[t.jsx(u,{sx:{opacity:.3,fontSize:32},children:t.jsx(o,{})}),t.jsx(u,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:e})]})}Ie.propTypes={children:d.node.isRequired,Icon:d.elementType};Ie.defaultProps={Icon:pn};function Ht({value:e,app:o,onChange:n,onChangeBlockletResourceType:r,disabled:s,resourceRelateComponents:l,projectType:i,dependentComponentsMode:a,blockletResourceType:c}){const{t:f,locale:h}=Q(),g=a==="readonly",x=R.useMemo(()=>{const T=e.reduce((L,I)=>(L[I.did]=I.included,L),{});return(o.children||[]).filter(L=>g?l[L.meta.did]||T[L.meta.did]:!0)},[o.children,e,l,g]),p=R.useMemo(()=>x.map(T=>e.find(I=>I.did===T.meta.did)||{did:T.meta.did}),[x,e]),y=p.reduce((T,L)=>(T[L.did]=Lt(L,["required","included"]),T),{}),w=T=>{const L=p.map(I=>{if(I.did===T){const k=!I.included;return{...I,included:k,required:k}}return I});n(L)},D=T=>{const L=p.map(I=>I.did===T?{...I,required:!I.required}:I);n(L)},j=T=>{r(T.target.checked?"resource":"")},b=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:T=>{var k;const L=x[T],I=(k=y[L.meta.did])==null?void 0:k.included;return t.jsxs(u,{display:"flex",alignItems:"center",children:[t.jsx(Et,{size:24,blocklet:L,ancestors:[o]}),t.jsx(u,{ml:"4px",className:At("text",{excluded:!I}),children:t.jsx(u,{children:L.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:T=>{var _;const L=x[T],I=l[L.meta.did],k=!!((_=y[L.meta.did])!=null&&_.included);return t.jsx(Ge,{size:"small",checked:I||k,onClick:()=>w(L.meta.did),disabled:g||I||s})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:T=>{var $,B;const L=x[T],I=l[L.meta.did],k=!!(($=y[L.meta.did])!=null&&$.included),_=!!((B=y[L.meta.did])!=null&&B.required);return t.jsx(Ge,{size:"small",checked:I||_&&k,onClick:()=>D(L.meta.did),disabled:g||I||s||!k})}}}];return t.jsx(tr,{children:x!=null&&x.length?t.jsxs(t.Fragment,{children:[t.jsxs(Uo,{severity:"info",style:{width:"100%"},children:[t.jsx(u,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:f(i==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),t.jsxs(u,{component:"label",style:{cursor:"pointer"},children:[t.jsx(Ge,{size:"small",style:{marginLeft:"0px"},disabled:s,checked:c==="resource",onChange:j}),f("blocklet.publish.forceResourceBlocklet")]})]}),t.jsx(_t,{className:"main-table",verticalKeyWidth:100,locale:h,data:x,columns:b,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):t.jsx(Ie,{Icon:zt,children:f("blocklet.publish.blockletEmptyTip")})})}Ht.propTypes={app:d.object.isRequired,value:d.arrayOf(d.shape({did:d.string.isRequired,required:d.bool,included:d.bool})),onChange:d.func,onChangeBlockletResourceType:d.func,disabled:d.bool,dependentComponentsMode:d.string,resourceRelateComponents:d.object,blockletResourceType:d.string,projectType:d.string.isRequired};Ht.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const tr=ce(u)`
|
|
19
|
-
.main-table {
|
|
20
|
-
.text.excluded {
|
|
21
|
-
color: #999;
|
|
22
|
-
}
|
|
23
|
-
width: 400px;
|
|
24
|
-
${({theme:e})=>e.breakpoints.down("md")} {
|
|
25
|
-
width: 100%;
|
|
26
|
-
}
|
|
27
|
-
> div:first-child {
|
|
28
|
-
display: none;
|
|
29
|
-
}
|
|
30
|
-
.MuiTableCell-head {
|
|
31
|
-
padding-top: 0;
|
|
32
|
-
padding-bottom: 0;
|
|
33
|
-
}
|
|
34
|
-
.MuiTableCell-body {
|
|
35
|
-
padding-top: 6px;
|
|
36
|
-
padding-bottom: 6px;
|
|
37
|
-
}
|
|
38
|
-
.datatable-footer {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`;function or(e,o){const n=new Set(o||[]),r=[];function s(l){n.has(l==null?void 0:l.id)&&r.push(l==null?void 0:l.id),l!=null&&l.children&&l.children.forEach(s)}return(e||[]).forEach(s),r}function Gt({data:e,...o}){return!e||!e.length?null:t.jsx(nr,{...o,children:e.map(n=>t.jsx("a",{href:n.url,target:"_blank",rel:"noreferrer",children:t.jsx("img",{src:n.url,alt:n.alt||""})},n.url))})}Gt.propTypes={data:d.arrayOf(d.shape({url:d.string,alt:d.string}))};Gt.defaultProps={data:[]};const nr=ce(u)`
|
|
43
|
-
display: flex;
|
|
44
|
-
justify-content: flex-start;
|
|
45
|
-
flex-wrap: wrap;
|
|
46
|
-
margin-bottom: -12px;
|
|
47
|
-
a {
|
|
48
|
-
display: flex;
|
|
49
|
-
}
|
|
50
|
-
img {
|
|
51
|
-
height: 128px;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
margin-right: 12px;
|
|
54
|
-
margin-bottom: 12px;
|
|
55
|
-
}
|
|
56
|
-
`,mt=(e,o)=>{const n=[...e];for(;n.length>0;){const r=n.shift();if(r.id===o)return r;r.children&&n.push(...r.children)}return[]};function Xt({icon:e}){return e?hs(e)?t.jsx("img",{className:"resource-icon",src:e,alt:"icon"}):t.jsx(se,{className:"resource-icon",icon:e}):null}Xt.propTypes={icon:d.string};Xt.defaultProps={icon:""};function Jt({disabled:e,data:o,onChange:n,value:r}){const s=r;function l(p,y=[]){return y.push(p.id),p.children&&p.children.forEach(w=>l(w,y)),y}const i=p=>l(mt(o,p)),a=(p,y=[])=>{const w=mt(o,p);return w.parent?(y.push(w.parent),a(w.parent,y)):y};function c(p,y){const w=i(p.id),D=w.indexOf(p.id);return w.splice(D,1),w.every(j=>s.concat(y).includes(j))}const f=(p,y)=>{p.stopPropagation();const w=i(y),D=a(y);if(s.includes(y)){const j=s.filter(b=>!w.concat(D).includes(b));n(j)}else{const j=w;for(let b=0;b<D.length;++b)c(mt(o,D[b]),j)&&j.push(D[b]);n([...s].concat(j))}},h=p=>{p.stopPropagation()},g=o.some(p=>{var y;return((y=p.children)==null?void 0:y.length)>0}),x=p=>{var b;const y=s.indexOf(p.id)!==-1,w=Array.isArray(p.children),D=i(p.id),j=w&&!y&&s.some(T=>D.includes(T));return t.jsx(Ss,{nodeId:p.id,label:t.jsx(Xe,{onClick:h,control:t.jsx(Ge,{size:"small",checked:y,indeterminate:j,tabIndex:-1,disableRipple:!0,onClick:T=>f(T,p.id),disabled:p.disabled||e}),label:t.jsxs(u,{className:"content",children:[t.jsxs(u,{display:"flex",alignItems:"center",children:[p.icon&&t.jsx(Xt,{icon:p.icon}),t.jsx(u,{className:"name",children:p.name}),p.url&&t.jsx("a",{href:p.url,target:"_blank",rel:"noreferrer",className:"link",children:t.jsx(fs,{className:"link-icon"})})]}),!!p.description&&t.jsx(u,{className:"description",children:p.description}),!!((b=p.images)!=null&&b.length)&&t.jsx(Gt,{className:"images",data:p.images})]})}),children:w?p.children.map(x):null},p.id)};return t.jsx(sr,{className:At(!g&&"no-children"),multiSelect:!0,defaultCollapseIcon:t.jsx(ps,{}),defaultExpandIcon:t.jsx(ws,{}),selected:s,children:o.map(p=>x(p))})}Jt.propTypes={data:d.array,value:d.array,onChange:d.func,disabled:d.bool};Jt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const sr=ce(Rs)`
|
|
57
|
-
&.no-children {
|
|
58
|
-
.MuiTreeItem-content {
|
|
59
|
-
padding: 0;
|
|
60
|
-
.MuiTreeItem-iconContainer {
|
|
61
|
-
display: none;
|
|
62
|
-
}
|
|
63
|
-
.MuiTreeItem-label {
|
|
64
|
-
padding-left: 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
.MuiTreeItem-content {
|
|
69
|
-
align-items: flex-start;
|
|
70
|
-
.MuiTreeItem-iconContainer {
|
|
71
|
-
transform: translateY(10px);
|
|
72
|
-
}
|
|
73
|
-
&.Mui-selected {
|
|
74
|
-
background-color: transparent;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
.MuiTreeItem-label {
|
|
78
|
-
cursor: default;
|
|
79
|
-
}
|
|
80
|
-
.MuiFormControlLabel-root {
|
|
81
|
-
align-items: flex-start;
|
|
82
|
-
}
|
|
83
|
-
.content {
|
|
84
|
-
padding-top: 6px;
|
|
85
|
-
}
|
|
86
|
-
.name {
|
|
87
|
-
font-size: 16px;
|
|
88
|
-
font-weight: 700;
|
|
89
|
-
}
|
|
90
|
-
.resource-icon {
|
|
91
|
-
margin-right: 2px;
|
|
92
|
-
font-size: 16px;
|
|
93
|
-
}
|
|
94
|
-
img.resource-icon {
|
|
95
|
-
width: 1rem;
|
|
96
|
-
height: 1rem;
|
|
97
|
-
}
|
|
98
|
-
.link {
|
|
99
|
-
margin-left: 8px;
|
|
100
|
-
font-size: 16px;
|
|
101
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
102
|
-
display: flex;
|
|
103
|
-
}
|
|
104
|
-
.link-icon {
|
|
105
|
-
font-size: inherit;
|
|
106
|
-
}
|
|
107
|
-
.description {
|
|
108
|
-
font-size: 14px;
|
|
109
|
-
color: ${({theme:e})=>e.palette.text.secondary};
|
|
110
|
-
}
|
|
111
|
-
`,Qe=(e,o)=>(e.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(r=>{r.parent=n.id,Qe(r.children||[],r.id)})}),e),Ye=(e,o,n,r,s)=>{const{exportApi:l="/"}=(e==null?void 0:e.meta.resource)||{},i=new URL(le("http://127.0.0.1",e==null?void 0:e.mountPoint,l||"/").replace(/\/+/g,"/"));return i.searchParams.set("projectId",o),i.searchParams.set("releaseId",n),i.searchParams.set("local",r),s&&i.searchParams.set("resourcesParams",s.searchParams.get("resourcesParams")),`${i.pathname}${i.search}`},rr=async({api:e,appDid:o,component:n,projectId:r,releaseId:s,locale:l,initUrl:i,resources:a})=>{let c;if(i&&i.searchParams.get("resourcesParams"))try{c=JSON.parse(i.searchParams.get("resourcesParams"))}catch(f){V.error(f.message);return}await Je.post(Ye(n,r,s,l,i),{resources:a,projectId:r,releaseId:s,locale:l,...c?{resourcesParams:c}:{}},{headers:{"x-csrf-token":ms()}}),await e.updateSelectedResources({input:{did:o,projectId:r,releaseId:s,componentDid:n.meta.did,resources:a}})},ir=(e,o)=>{if(!e)return{};const n=o.reduce((s,l)=>(s[l]=!0,s),{}),r=(s,l)=>(s.forEach(i=>{var a;n[i.id]&&((a=i.dependentComponents)!=null&&a.length)&&i.dependentComponents.forEach(c=>{l[c]=!0}),i.children&&r(i.children,l)}),l);return r(e,{})};function Qt({app:e,component:o,projectId:n,release:r,loading:s,error:l,saveSelectedEventsRef:i,readOnly:a,componentDid:c,initialResources:f={},setResourceComponentsMap:h,selectedResourceIds:g,setSelectedResourceIds:x,initUrl:p}){var B;const{t:y,locale:w}=Q(),{api:D}=me(),[j,b]=we({}),T=R.useRef({}),L=R.useRef(!1),I=r.id;T.current.projectId=n,T.current.releaseId=I;const k=(S,C,m)=>{if(!C)return;const P=ir(C,m);h==null||h({[S]:Object.keys(P)})},_=S=>{i.current[o.meta.did]={resources:S,component:o},x({[o.meta.did]:S}),k(o.meta.did,j[o.meta.did],S)};R.useEffect(()=>{j[o==null?void 0:o.meta.did]||Je.get(Ye(o,n,I,w,p)).then(S=>{var m;const C=Qe(((m=S.data)==null?void 0:m.resources)||[]);b({[o==null?void 0:o.meta.did]:C})}).catch(S=>{V.error(S.message)})},[o,n,r,w,p,b,j,I]),R.useEffect(()=>{I&&n&&!L.current&&nt(e.children.map(S=>async()=>{var C,m,P;if(!(c&&c!==S.meta.did)&&!(!(S!=null&&S.mountPoint)||!cs.hasStartEngine(S==null?void 0:S.meta)||!((m=(C=S==null?void 0:S.meta)==null?void 0:C.resource)!=null&&m.exportApi)))try{const M=await Je.get(Ye(S,n,I,w,p)),U=Qe(((P=M==null?void 0:M.data)==null?void 0:P.resources)||[]);b({[S==null?void 0:S.meta.did]:U});const v=await D.getSelectedResources({input:{did:e.meta.did,projectId:n,releaseId:I,componentDid:S.meta.did}}),N=(v==null?void 0:v.resources)||[];N!=null&&N.length&&(x({[S.meta.did]:or(U,N)}),k(S.meta.did,U,N),a||(i.current[S==null?void 0:S.meta.did]={resources:N,component:S}))}catch(M){V.error(M.message)}}),{concurrency:2}).then(()=>{L.current=!0})},[I,n,a,w,p,b]),R.useEffect(()=>{f&&Object.keys(f).length&&nt(e.children.map(async S=>{var m;const C=f[S.meta.did];if(C!=null&&C.length){const P=await Je.get(Ye(S,n,I,w,p)),M=Qe(((m=P==null?void 0:P.data)==null?void 0:m.resources)||[]);x({[S.meta.did]:C}),k(S.meta.did,M,C),a||(i.current[S==null?void 0:S.meta.did]={resources:C,component:S})}}))},[e,f,a]);let $=null;return(!o||!((B=j[o.meta.did])!=null&&B.length))&&($=t.jsx(Ie,{Icon:zt,children:y("blocklet.publish.resourceEmptyTip",{name:mo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&($=t.jsx(Ie,{children:y("blocklet.publish.componentNotRunning",{name:mo.getDisplayName(o)})})),t.jsxs(t.Fragment,{children:[t.jsx(lr,{className:At(l&&"error"),children:t.jsx(u,{pb:2,width:"100%",children:$||t.jsx(Jt,{data:j[o.meta.did]||[],value:g[o.meta.did]||[],onChange:_,disabled:s||a})})}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}Qt.propTypes={component:d.object.isRequired,app:d.object.isRequired,projectId:d.string.isRequired,error:d.string,saveSelectedEventsRef:d.object.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired,release:d.shape({id:d.string.isRequired,status:d.string}),initialResources:d.object,initUrl:d.object,setResourceComponentsMap:d.func,componentDid:d.string,selectedResourceIds:d.array.isRequired,setSelectedResourceIds:d.func.isRequired};Qt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const lr=ce(u)`
|
|
112
|
-
border: 1px solid #ccc;
|
|
113
|
-
max-height: 600px;
|
|
114
|
-
width: 100%;
|
|
115
|
-
&.error {
|
|
116
|
-
border-color: ${e=>e.theme.palette.error.main};
|
|
117
|
-
}
|
|
118
|
-
border-radius: 4px;
|
|
119
|
-
padding: 16px;
|
|
120
|
-
padding-bottom: 0px;
|
|
121
|
-
overflow-y: auto;
|
|
122
|
-
.footer {
|
|
123
|
-
border-top: 1px solid #ddd;
|
|
124
|
-
display: flex;
|
|
125
|
-
padding: 12px 0;
|
|
126
|
-
margin-top: 12px;
|
|
127
|
-
position: sticky;
|
|
128
|
-
bottom: 0;
|
|
129
|
-
background: #fff;
|
|
130
|
-
z-index: 10;
|
|
131
|
-
}
|
|
132
|
-
`;var Yt={},cr=he;Object.defineProperty(Yt,"__esModule",{value:!0});var kt=Yt.default=void 0,ar=cr(be()),dr=t;kt=Yt.default=(0,ar.default)((0,dr.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 So="lastWantToConnectStoreId";function ur(e){var a,c;const[o,n]=R.useState(null),{session:r}=ct(),s=R.useCallback(f=>{n(f),localStorage.setItem(So,f==null?void 0:f.id)},[n]),l=R.useMemo(()=>{var x,p,y,w;const f=localStorage.getItem(So),h=f?(((x=e==null?void 0:e.settings)==null?void 0:x.storeList)||[]).find(D=>D.id===f):null;if(h)return h;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(D=>{var j;return!(D.id!==H.BLOCKLET_STORE.id||D.scope&&D.scope!=="studio"&&D.scope!==((j=r==null?void 0:r.user)==null?void 0:j.did))});return g||(g=(w=(y=e==null?void 0:e.settings)==null?void 0:y.storeList)==null?void 0:w[0]),g},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||l||{},s]}const bt={};async function fn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){bt[s]&&clearTimeout(bt[s]),await new Promise(a=>setTimeout(a,r));const l=Date.now(),i=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-l>n?c(f):s?bt[s]=setTimeout(()=>i(a,c),o):setTimeout(()=>i(a,c),o)}};return new Promise(i)}function pr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function fr(e,{did:o,projectId:n,messageId:r}){return fn(async()=>{var l;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((l=s==null?void 0:s.project)!=null&&l.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function hr(e,{did:o,projectId:n,storeId:r}){return fn(async()=>{var i,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(i=s==null?void 0:s.project)==null?void 0:i.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const hn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var i,a;const s=e?(i=n==null?void 0:n.meta)==null?void 0:i.did:o==null?void 0:o.did;let l=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(l)||(l=[]),l=l.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:l}};function Zt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:l,componentDid:i}){var m,P,M;const{t:a}=Q(),{session:c}=ct(),{api:f,info:h,inService:g}=me(),x=De(),[p,y]=R.useState(!1),w=R.useRef(null),[D,j]=R.useState(!1),[b,T]=R.useState(null),L=U=>{n(U),y(!1)},I=()=>{y(!p)},k=U=>{w.current&&w.current.contains(U.target)||y(!1)},_=()=>{j(!0)},$=()=>{j(!1)},B=async()=>{var U;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((U=x==null?void 0:x.actions)==null?void 0:U.refreshBlocklet())}catch(v){V.error(`Remove Blocklet Store Error: ${Ce(v)}`)}finally{T(null)}},{storeList:S}=hn({fromBlocklet:g,blocklet:e,nodeInfo:h,componentDid:i,userDid:(m=c==null?void 0:c.user)==null?void 0:m.did}),C=(P=e==null?void 0:e.meta)==null?void 0:P.did;return t.jsxs(t.Fragment,{children:[t.jsxs(jt,{disabled:s,ref:w,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Y,{onClick:r,children:[l&&t.jsx(et,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(Y,{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:I,children:t.jsx(qs,{})})]}),t.jsx(Ho,{sx:{zIndex:10},open:p,anchorEl:w.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:U})=>t.jsx(Go,{...U,style:{transformOrigin:"center top"},children:t.jsx(Tt,{children:t.jsx(Xo,{onClickAway:k,children:t.jsxs(Jo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[S==null?void 0:S.map(v=>{var N;return t.jsxs(ue,{selected:v.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>L(v),children:[t.jsxs(u,{children:[t.jsx(pe,{sx:{fontSize:"16px"},maxLength:24,children:v.name}),t.jsx(pe,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:v.url})]}),Cs({store:v,userDid:(N=c==null?void 0:c.user)==null?void 0:N.did})&&t.jsx(oe,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),T(v)},children:t.jsx(se,{icon:"ic:outline-delete"})})]},v.url)}),t.jsx(Jn,{}),t.jsxs(ue,{onClick:_,children:[t.jsx($t,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),D&&t.jsx(rn,{hiddenChildren:!0,open:!0,onClose:$,teamDid:C,storeList:S,scope:"studio",onAdd:(M=x==null?void 0:x.actions)==null?void 0:M.refreshBlocklet}),b&&t.jsx(Nt,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:B,onCancel:()=>T(null)})]})}Zt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Zt.defaultProps={store:null,blocklet:null};var fe=R;const Ee=/^[a-z0-9]+(-[a-z0-9]+)*$/,at=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Ze(f)?null:f}const l=s[0],i=l.split("-");if(i.length>1){const a={provider:r,prefix:i.shift(),name:i.join("-")};return o&&!Ze(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:l};return o&&!Ze(a,n)?null:a}return null},Ze=(e,o)=>e?!!((e.provider===""||e.provider.match(Ee))&&(o&&e.prefix===""||e.prefix.match(Ee))&&e.name.match(Ee)):!1,mn=Object.freeze({left:0,top:0,width:16,height:16}),st=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Kt=Object.freeze({...mn,...st}),yt=Object.freeze({...Kt,body:"",hidden:!1});function mr(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function Ro(e,o){const n=mr(e,o);for(const r in yt)r in st?r in e&&!(r in n)&&(n[r]=st[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function br(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function l(i){if(n[i])return s[i]=[];if(!(i in s)){s[i]=null;const a=r[i]&&r[i].parent,c=a&&l(a);c&&(s[i]=[a].concat(c))}return s[i]}return Object.keys(n).concat(Object.keys(r)).forEach(l),s}function xr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let l={};function i(a){l=Ro(r[a]||s[a],l)}return i(o),n.forEach(i),Ro(e,l)}function bn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=br(e);for(const s in r){const l=r[s];l&&(o(s,xr(e,s,l)),n.push(s))}return n}const gr={provider:"",aliases:{},not_found:{},...mn};function xt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function xn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!xt(e,gr))return null;const n=o.icons;for(const s in n){const l=n[s];if(!s.match(Ee)||typeof l.body!="string"||!xt(l,yt))return null}const r=o.aliases||Object.create(null);for(const s in r){const l=r[s],i=l.parent;if(!s.match(Ee)||typeof i!="string"||!n[i]&&!r[i]||!xt(l,yt))return null}return o}const Co=Object.create(null);function jr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ye(e,o){const n=Co[e]||(Co[e]=Object.create(null));return n[o]||(n[o]=jr(e,o))}function eo(e,o){return xn(o)?bn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function kr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let ze=!1;function gn(e){return typeof e=="boolean"&&(ze=e),ze}function yr(e){const o=typeof e=="string"?at(e,!0,ze):e;if(o){const n=ye(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function vr(e,o){const n=at(e,!0,ze);if(!n)return!1;const r=ye(n.provider,n.prefix);return kr(r,n.name,o)}function wr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),ze&&!o&&!e.prefix){let s=!1;return xn(e)&&(e.prefix="",bn(e,(l,i)=>{i&&vr(l,i)&&(s=!0)})),s}const n=e.prefix;if(!Ze({provider:o,prefix:n,name:"a"}))return!1;const r=ye(o,n);return!!eo(r,e)}const jn=Object.freeze({width:null,height:null}),kn=Object.freeze({...jn,...st}),Sr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Rr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Io(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Sr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=Rr.test(l);for(;;){if(i){const a=parseFloat(l);isNaN(a)?s.push(l):s.push(Math.ceil(a*o*n)/n)}else s.push(l);if(l=r.shift(),l===void 0)return s.join("");i=!i}}const Cr=e=>e==="unset"||e==="undefined"||e==="none";function Ir(e,o){const n={...Kt,...e},r={...kn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let l=n.body;[n,r].forEach(y=>{const w=[],D=y.hFlip,j=y.vFlip;let b=y.rotate;D?j?b+=2:(w.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),w.push("scale(-1 1)"),s.top=s.left=0):j&&(w.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),w.push("scale(1 -1)"),s.top=s.left=0);let T;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:T=s.height/2+s.top,w.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:w.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:T=s.width/2+s.left,w.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}b%2===1&&(s.left!==s.top&&(T=s.left,s.left=s.top,s.top=T),s.width!==s.height&&(T=s.width,s.width=s.height,s.height=T)),w.length&&(l='<g transform="'+w.join(" ")+'">'+l+"</g>")});const i=r.width,a=r.height,c=s.width,f=s.height;let h,g;i===null?(g=a===null?"1em":a==="auto"?f:a,h=Io(g,c/f)):(h=i==="auto"?c:i,g=a===null?Io(h,f/c):a==="auto"?f:a);const x={},p=(y,w)=>{Cr(w)||(x[y]=w.toString())};return p("width",h),p("height",g),x.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:x,body:l}}const Dr=/\sid="(\S+)"/g,Tr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Pr=0;function _r(e,o=Tr){const n=[];let r;for(;r=Dr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(l=>{const i=typeof o=="function"?o(l):o+(Pr++).toString(),a=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+i+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const vt=Object.create(null);function Lr(e,o){vt[e]=o}function wt(e){return vt[e]||vt[""]}function to(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const oo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Ke=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Ke.push(Ne.shift()):Ke.push(Ne.pop());oo[""]=to({resources:["https://api.iconify.design"].concat(Ke)});function qr(e,o){const n=to(o);return n===null?!1:(oo[e]=n,!0)}function no(e){return oo[e]}const $r=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Do=$r();function Nr(e,o){const n=no(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(i=>{s=Math.max(s,i.length)});const l=o+".json?icons=";r=n.maxURL-s-n.path.length-l.length}return r}function Er(e){return e===404}const Ar=(e,o,n)=>{const r=[],s=Nr(e,o),l="icons";let i={type:l,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(i),i={type:l,provider:e,prefix:o,icons:[]},a=c.length),i.icons.push(c)}),r.push(i),r};function zr(e){if(typeof e=="string"){const o=no(e);if(o)return o.path}return"/"}const Mr=(e,o,n)=>{if(!Do){n("abort",424);return}let r=zr(o.provider);switch(o.type){case"icons":{const l=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=l+".json?"+c.toString();break}case"custom":{const l=o.uri;r+=l.slice(0,1)==="/"?l.slice(1):l;break}default:n("abort",400);return}let s=503;Do(e+r).then(l=>{const i=l.status;if(i!==200){setTimeout(()=>{n(Er(i)?"abort":"next",i)});return}return s=501,l.json()}).then(l=>{if(typeof l!="object"||l===null){setTimeout(()=>{l===404?n("abort",l):n("next",s)});return}setTimeout(()=>{n("success",l)})}).catch(()=>{n("next",s)})},Or={prepare:Ar,send:Mr};function Br(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,l)=>s.provider!==l.provider?s.provider.localeCompare(l.provider):s.prefix!==l.prefix?s.prefix.localeCompare(l.prefix):s.name.localeCompare(l.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const l=s.provider,i=s.prefix,a=s.name,c=n[l]||(n[l]=Object.create(null)),f=c[i]||(c[i]=ye(l,i));let h;a in f.icons?h=o.loaded:i===""||f.missing.has(a)?h=o.missing:h=o.pending;const g={provider:l,prefix:i,name:a};h.push(g)}),o}function yn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Wr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(l=>{const i=l.icons,a=i.pending.length;i.pending=i.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])i.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))i.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),i.pending.length!==a&&(n||yn([e],l.id),l.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),l.abort))})}))}let Vr=0;function Fr(e,o,n){const r=Vr++,s=yn.bind(null,n,r);if(!o.pending.length)return s;const l={id:r,icons:o,callback:e,abort:s};return n.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(l)}),s}function Ur(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const l=typeof s=="string"?at(s,o,n):s;l&&r.push(l)}),r}var Hr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Gr(e,o,n,r){const s=e.resources.length,l=e.random?Math.floor(Math.random()*s):e.index;let i;if(e.random){let k=e.resources.slice(0);for(i=[];k.length>1;){const _=Math.floor(Math.random()*k.length);i.push(k[_]),k=k.slice(0,_).concat(k.slice(_+1))}i=i.concat(k)}else i=e.resources.slice(l).concat(e.resources.slice(0,l));const a=Date.now();let c="pending",f=0,h,g=null,x=[],p=[];typeof r=="function"&&p.push(r);function y(){g&&(clearTimeout(g),g=null)}function w(){c==="pending"&&(c="aborted"),y(),x.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),x=[]}function D(k,_){_&&(p=[]),typeof k=="function"&&p.push(k)}function j(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:x.length,subscribe:D,abort:w}}function b(){c="failed",p.forEach(k=>{k(void 0,h)})}function T(){x.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),x=[]}function L(k,_,$){const B=_!=="success";switch(x=x.filter(S=>S!==k),c){case"pending":break;case"failed":if(B||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){h=$,b();return}if(B){h=$,x.length||(i.length?I():b());return}if(y(),T(),!e.random){const S=e.resources.indexOf(k.resource);S!==-1&&S!==e.index&&(e.index=S)}c="completed",p.forEach(S=>{S($)})}function I(){if(c!=="pending")return;y();const k=i.shift();if(k===void 0){if(x.length){g=setTimeout(()=>{y(),c==="pending"&&(T(),b())},e.timeout);return}b();return}const _={status:"pending",resource:k,callback:($,B)=>{L(_,$,B)}};x.push(_),f++,g=setTimeout(I,e.rotate),n(k,o,_.callback)}return setTimeout(I),j}function vn(e){const o={...Hr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Gr(o,a,c,(g,x)=>{r(),f&&f(g,x)});return n.push(h),h}function l(a){return n.find(c=>a(c))||null}return{query:s,find:l,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function To(){}const gt=Object.create(null);function Xr(e){if(!gt[e]){const o=no(e);if(!o)return;const n=vn(o),r={config:o,redundancy:n};gt[e]=r}return gt[e]}function Jr(e,o,n){let r,s;if(typeof e=="string"){const l=wt(e);if(!l)return n(void 0,424),To;s=l.send;const i=Xr(e);i&&(r=i.redundancy)}else{const l=to(e);if(l){r=vn(l);const i=e.resources?e.resources[0]:"",a=wt(i);a&&(s=a.send)}}return!r||!s?(n(void 0,424),To):r.query(o,s,n)().abort}const Po="iconify2",Me="iconify",wn=Me+"-count",_o=Me+"-version",Sn=36e5,Qr=168;function St(e,o){try{return e.getItem(o)}catch{}}function so(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Lo(e,o){try{e.removeItem(o)}catch{}}function Rt(e,o){return so(e,wn,o.toString())}function Ct(e){return parseInt(St(e,wn))||0}const dt={local:!0,session:!0},Rn={local:new Set,session:new Set};let ro=!1;function Yr(e){ro=e}let He=typeof window>"u"?{}:window;function Cn(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}dt[e]=!1}function In(e,o){const n=Cn(e);if(!n)return;const r=St(n,_o);if(r!==Po){if(r){const a=Ct(n);for(let c=0;c<a;c++)Lo(n,Me+c.toString())}so(n,_o,Po),Rt(n,0);return}const s=Math.floor(Date.now()/Sn)-Qr,l=a=>{const c=Me+a.toString(),f=St(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Lo(n,c)}};let i=Ct(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,Rt(n,i)):Rn[e].add(a))}function Dn(){if(!ro){Yr(!0);for(const e in dt)In(e,o=>{const n=o.data,r=o.provider,s=n.prefix,l=ye(r,s);if(!eo(l,n).length)return!1;const i=n.lastModified||-1;return l.lastModifiedCached=l.lastModifiedCached?Math.min(l.lastModifiedCached,i):i,!0})}}function Zr(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in dt)In(r,s=>{const l=s.data;return s.provider!==e.provider||l.prefix!==e.prefix||l.lastModified===o});return!0}function Kr(e,o){ro||Dn();function n(r){let s;if(!dt[r]||!(s=Cn(r)))return;const l=Rn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=Ct(s),!Rt(s,i+1))return;const a={cached:Math.floor(Date.now()/Sn),provider:e.provider,data:o};return so(s,Me+i.toString(),JSON.stringify(a))}o.lastModified&&!Zr(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function qo(){}function ei(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Wr(e)}))}function ti(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let l;if(!s||!(l=wt(n)))return;l.prepare(n,r,s).forEach(a=>{Jr(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=eo(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(g=>{h.delete(g)}),Kr(e,c)}catch(f){console.error(f)}ei(e)})})}))}const oi=(e,o)=>{const n=Ur(e,!0,gn()),r=Br(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,qo)}),()=>{c=!1}}const s=Object.create(null),l=[];let i,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===i)return;i=f,a=h,l.push(ye(f,h));const g=s[f]||(s[f]=Object.create(null));g[h]||(g[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:g}=c,x=ye(f,h),p=x.pendingIcons||(x.pendingIcons=new Set);p.has(g)||(p.add(g),s[f][h].push(g))}),l.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ti(c,s[f][h])}),o?Fr(o,r,l):qo};function ni(e,o){const n={...e};for(const r in o){const s=o[r],l=typeof s;r in jn?(s===null||s&&(l==="string"||l==="number"))&&(n[r]=s):l===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const si=/[\s,]+/;function ri(e,o){o.split(si).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ii(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let l=parseFloat(e.slice(0,e.length-n.length));return isNaN(l)?0:(l=l/s,l%1===0?r(l):0)}}return o}function li(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function ci(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ai(e){return"data:image/svg+xml,"+ci(e)}function di(e){return'url("'+ai(e)+'")'}let Ae;function ui(){try{Ae=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ae=null}}function pi(e){return Ae===void 0&&ui(),Ae?Ae.createHTML(e):e}const Tn={...kn,inline:!1},fi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},hi={display:"inline-block"},It={backgroundColor:"currentColor"},Pn={backgroundColor:"transparent"},$o={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},No={WebkitMask:It,mask:It,background:Pn};for(const e in No){const o=No[e];for(const n in $o)o[e+n]=$o[n]}const mi={...Tn,inline:!0};function Eo(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const bi=(e,o,n,r)=>{const s=n?mi:Tn,l=ni(s,o),i=o.mode||"svg",a={},c=o.style||{},f={...i==="svg"?fi:{},ref:r};for(let j in o){const b=o[j];if(b!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":l[j]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&ri(l,b);break;case"color":a.color=b;break;case"rotate":typeof b=="string"?l[j]=ii(b):typeof b=="number"&&(l[j]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[j]===void 0&&(f[j]=b)}}const h=Ir(e,l),g=h.attributes;if(l.inline&&(a.verticalAlign="-0.125em"),i==="svg"){f.style={...a,...c},Object.assign(f,g);let j=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:pi(_r(h.body,b?()=>b+"ID"+j++:"iconifyReact"))},fe.createElement("svg",f)}const{body:x,width:p,height:y}=e,w=i==="mask"||(i==="bg"?!1:x.indexOf("currentColor")!==-1),D=li(x,{...g,width:p+"",height:y+""});return f.style={...a,"--svg":di(D),width:Eo(g.width),height:Eo(g.height),...hi,...w?It:Pn,...c},fe.createElement("span",f)};gn(!0);Lr("",Or);if(typeof document<"u"&&typeof window<"u"){Dn();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!wr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;qr(n,s)||console.error(r)}catch{console.error(r)}}}}class _n extends fe.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=at(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const l=yr(s);if(!l){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),l!==null&&(this._loading={name:r,abort:oi([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const i=["iconify"];s.prefix!==""&&i.push("iconify--"+s.prefix),s.provider!==""&&i.push("iconify--"+s.provider),this._setData({data:l,classes:i}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:fe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),bi({...Kt,...n.data},r,o._inline,o._ref)}}const xi=fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return fe.createElement(_n,r)});fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return fe.createElement(_n,r)});var gi=xi;const ji=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ut({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Q(),l=e.includes("youtube.com")||e.includes("youtu.be"),i=e.includes("vimeo.com");if(l){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,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 t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{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:[t.jsx(gi,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(A,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ut.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ut.defaultProps={style:{},controls:1,modestbranding:1};function Ln({setParams:e,onClose:o,params:n}){const{t:r}=Q(),[s,l]=R.useState(""),i=s&&n.blockletVideos.includes(s),a=ji(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(Pt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Qo,{children:r("studio.videoDialogTitle")}),t.jsxs(Yo,{children:[t.jsx(Qn,{fullWidth:!0,value:s,onChange:f=>l(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Be,{position:"end",children:t.jsx(oe,{onClick:()=>l(""),children:t.jsx(bs,{})})}):null,error:i}),i&&t.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ut,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Zo,{children:[t.jsx(Y,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Y,{disabled:!a||i,onClick:c,children:r("studio.confirm")})]})]})}Ln.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Ao=R.lazy(()=>tn(()=>import("./index-CUlGef8y.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function qn({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:l,paramsErrTip:i,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:g,componentDid:x}){const{t:p}=Q(),{api:y}=me(),w=Dt(),D=R.useRef(null),j=R.useRef(null),[b,T]=ur(r),[L,I]=R.useState(!1),k=Is({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),_=async v=>{const N=setTimeout(()=>{c(!1)},2e4),q=await fr(y,v);c(!1),clearTimeout(N),window.parent.postMessage({event:"studioDialog.connected",componentDid:x},"*"),w(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${q}/create`),{replace:!0})},$=()=>{if(!s.blockletTitle){V.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(b!=null&&b.url)){V.error(p("blocklet.publish.noStoreSelected"));return}const v=pr();k(async(N,q)=>{var F,G,ee;try{const X=await y.connectByStudio({input:{did:(F=r==null?void 0:r.meta)==null?void 0:F.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:b.url,storeId:b.id,storeName:b.name,type:((G=s==null?void 0:s.blockletComponents)==null?void 0:G.length)>0?"pack":"resource",componentDid:x,messageId:v,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(X!=null&&X.url)){V.error("failed to connect to store");return}q(X.url),_({did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,projectId:"",messageId:v})}catch(X){const ne=Ce(X);V.error(ne),c(!1)}})},B=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,S=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,C=s!=null&&s.blockletLogo?`${B}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,m=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(v=>`${S}/${v}`),P=()=>o?!1:!e||e===H.UNOWNED_DID?(V.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,M=v=>{if(!v.destination)return;const N=Array.from(s.blockletScreenshots),[q]=N.splice(v.source.index,1);N.splice(v.destination.index,0,q),l(F=>({...F,blockletScreenshots:N}))},U=v=>{if(!v.destination)return;const N=Array.from(s.blockletVideos),[q]=N.splice(v.source.index,1);N.splice(v.destination.index,0,q),l(F=>({...F,blockletVideos:N}))};return t.jsxs(ki,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(J,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:s.blockletTitle||"",onChange:v=>{a({blockletTitle:""}),l({blockletTitle:v.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),t.jsx(J,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===H.UNOWNED_DID&&t.jsx(Be,{position:"end",children:t.jsx(Zt,{blocklet:r,store:b,componentDid:x,onChangeStore:T,disabled:!s.blockletTitle||o||n,loading:n,onClick:$})})},error:!!i.projectId,helperText:i.projectId||"",value:e===H.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(J,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletDescription||"",onChange:v=>{a({blockletDescription:""}),l({blockletDescription:v.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}}),t.jsx(J,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletHomepage||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),l({blockletHomepage:v.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3}}),t.jsx(J,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletCommunity||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),l({blockletCommunity:v.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3}}),t.jsx(J,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletSupport||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(v.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),l({blockletSupport:v.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3}}),t.jsx(J,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletRepository||"",onChange:v=>{v.target.value&&!/^(git|https|svn)/.test(v.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),l({blockletRepository:v.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||C,onClick:()=>{var v;P()&&((v=D.current)==null||v.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:M,children:t.jsx(jo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(v,N)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:N.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:N.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:v.innerRef,...v.droppableProps,children:[m.map((q,F)=>t.jsx(ko,{draggableId:q,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:q}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(X=>{const ne=[...X.blockletScreenshots];return ne.splice(F,1),{...X,blockletScreenshots:ne}})},children:t.jsx(yo,{})})]})},q)),v.placeholder,m.length<5&&t.jsx(u,{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 q;P()&&((q=j.current)==null||q.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:U,children:t.jsx(jo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(v,N)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:N.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:N.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:v.innerRef,...v.droppableProps,children:[s.blockletVideos.map((q,F)=>t.jsx(ko,{draggableId:q,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ut,{url:q,style:{pointerEvents:ee.isDragging?"none":"auto"}}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(X=>{const ne=[...X.blockletVideos];return ne.splice(F,1),{...X,blockletVideos:ne}})},children:t.jsx(yo,{})})]})},q)),v.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{P()&&I(!0)},children:"+"})]})})})]})]})}),t.jsxs(R.Suspense,{fallback:t.jsx(We,{}),children:[t.jsx(Ao,{ref:D,popup:!0,onUploadFinish:v=>{var N;l({blockletLogo:v.data.filename}),g(""),(N=D.current)==null||N.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:B,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"),L&&t.jsx(Ln,{onClose:()=>I(!1),params:s,setParams:l}),t.jsx(Ao,{ref:j,popup:!0,onUploadFinish:v=>{var N;l(q=>{var G;const F=q.blockletScreenshots||[];return F.push((G=v.data)==null?void 0:G.filename),{...q,blockletScreenshots:F}}),(N=j.current)==null||N.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-m.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")]})]})}qn.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const ki=ce.div`
|
|
133
|
-
margin-top: 24px;
|
|
134
|
-
.screenshot {
|
|
135
|
-
margin-bottom: 16px;
|
|
136
|
-
max-width: 240px;
|
|
137
|
-
max-height: 135px;
|
|
138
|
-
width: 240px;
|
|
139
|
-
height: 135px;
|
|
140
|
-
overflow: hidden;
|
|
141
|
-
display: flex;
|
|
142
|
-
align-items: center;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
background-color: #eee;
|
|
145
|
-
margin-right: 16px;
|
|
146
|
-
position: relative;
|
|
147
|
-
.action {
|
|
148
|
-
visibility: hidden;
|
|
149
|
-
position: absolute;
|
|
150
|
-
width: 42px;
|
|
151
|
-
height: 42px;
|
|
152
|
-
right: 6px;
|
|
153
|
-
top: 6px;
|
|
154
|
-
border-radius: 4px;
|
|
155
|
-
background-color: rgba(0, 0, 0, 1);
|
|
156
|
-
color: rgba(255, 255, 255, 1);
|
|
157
|
-
}
|
|
158
|
-
&:hover .action {
|
|
159
|
-
visibility: visible;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
.screenshot img {
|
|
163
|
-
width: 100%; /* 图像宽度填充容器 */
|
|
164
|
-
height: auto; /* 图像高度自适应 */
|
|
165
|
-
}
|
|
166
|
-
`;var io={},yi=he;Object.defineProperty(io,"__esModule",{value:!0});var $n=io.default=void 0,vi=yi(be()),wi=t;$n=io.default=(0,vi.default)((0,wi.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 Si=(e,o,n,r)=>{const s=e?[...e]:[],l=((o==null?void 0:o.children)||[]).reduce((i,a)=>(i[a.meta.did]=!0,i),{});return Object.keys(n).forEach(i=>{if(!l[i])return;let a=!1;r||s.forEach(c=>{c.did===i&&(c.included=!0,c.required=!0,a=!0)}),a||s.push({did:i,included:!0,required:!0})}),s},Ri=async e=>{if(typeof e!="string")throw new Error("URL must be a string");try{const o=e.split("/").pop().split("?")[0],r=await(await fetch(e)).blob();return new File([r],o,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Ci(e,o){let n=0;for(;n<e.size;)yield e.slice(n,n+o),n+=o}const Ii=async({did:e,projectId:o,uploadType:n="logo",imageUrl:r})=>{const s=await Ri(r);new FormData().append("file",s);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(s.name),name:encodeURIComponent(s.name),type:s.type},c=(await bo.post(le(H.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",e,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":s.size,"X-Uploader-File-Ext":s.name.split(".").pop(),"Upload-Metadata":Object.keys(i).map(x=>`${x} ${btoa(i[x])}`).join(",")}})).headers.location,f=2*1024*1024;let h=0,g="";for(const x of Ci(s,f)){const p=await bo.patch(le(H.WELLKNOWN_SERVICE_PATH_PREFIX,c),x,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":h,"Content-Type":"application/offset+octet-stream"}});h+=x.size,g=p.data.filename}return g},Nn=({params:e,projectId:o,status:n,t:r})=>{const s=[];return e.blockletTitle||s.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),(!o||o===H.UNOWNED_DID)&&s.push({param:"projectId",message:r("blocklet.publish.errorTip.noDid")}),e.blockletVersion?Re.valid(e.blockletVersion)||s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===ke.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||s.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),e.note||s.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),s.length?s:null},Di=({params:e,step:o,t:n,projectId:r})=>{if(o===0){if(!e.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!r||r===H.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!e.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!Re.valid(e.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!e.note)return n("blocklet.publish.errorTip.noNote")}return""};function lo({blocklet:e,releaseId:o,connectedStores:n,projectId:r,releaseType:s,publishedStoreIds:l,onPublish:i,onDelete:a,projectType:c,componentDid:f,onOpenConnectStore:h,behavior:g,onSelectConnectStore:x}){var T,L;const{t:p}=Q(),{actions:{refreshBlocklet:y}}=De(),{session:w}=ct(),{storeList:D}=hn({fromBlocklet:!0,blocklet:e,componentDid:f,userDid:(T=w==null?void 0:w.user)==null?void 0:T.did}),j=R.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((I,k)=>(I[k.storeId]=k,I),{}):{},[n]),b=(L=e==null?void 0:e.meta)==null?void 0:L.did;return t.jsxs(t.Fragment,{children:[g==="connect"&&!!(D!=null&&D.length)&&t.jsx(Uo,{severity:"info",style:{width:"100%"},children:t.jsxs(u,{color:Yn[400],component:"a",href:c==="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:[p(c==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),t.jsx(Ns,{sx:{marginLeft:1}})]})}),t.jsx(Zn,{children:D==null?void 0:D.map(I=>t.jsx(Kn,{"data-cy":"store-switch",children:t.jsx(es,{children:t.jsx(Ds,{behavior:g,onSelectConnectStore:x,releaseId:o,projectId:r,releaseType:s,kind:"publish",teamDid:b,store:I,published:(l==null?void 0:l.indexOf(I.id))>-1,connectedStore:j[I.id],onPublish:i,onDelete:a,scope:I.scope||"studio",onOpenConnectStore:h})})},I.url))}),t.jsx(rn,{teamDid:b,storeList:D,scope:"studio",onAdd:y})]})}lo.propTypes={blocklet:d.object.isRequired,projectId:d.string.isRequired,releaseId:d.string.isRequired,releaseType:d.string.isRequired,onPublish:d.func,onDelete:d.func,publishedStoreIds:d.arrayOf(d.string),connectedStores:d.arrayOf(d.object).isRequired,projectType:d.string,componentDid:d.string,onOpenConnectStore:d.func,onSelectConnectStore:d.func,behavior:d.string};lo.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function En({did:e,params:o,setParams:n,projectId:r,open:s,onClose:l}){const{t:i}=Q(),[a,c]=R.useState(!1),{api:f}=me(),[h,g]=R.useState(!1),[x,p]=R.useState(!1),y=()=>{g(o.autoUpload),p(o.possibleSameStore),c(!1),l(!1)},w=async()=>{c(!0);try{await f.updateProject({input:{did:e,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!h,possibleSameStore:!!x}}),n({autoUpload:h,possibleSameStore:x}),l(!1)}catch(j){V.error(j.message)}c(!1)};R.useEffect(()=>{g(o.autoUpload),p(o.possibleSameStore)},[o]);const D=!!(r&&r!==H.UNOWNED_DID);return t.jsx(qt,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:s,onClose:y,actions:t.jsxs(t.Fragment,{children:[t.jsx(Y,{onClick:j=>{j.stopPropagation(),l()},color:"inherit",children:i("common.cancel")}),D&&t.jsxs(Y,{onClick:j=>{j.stopPropagation(),w()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a,variant:"contained",autoFocus:!0,children:[a&&t.jsx(et,{size:16}),i("common.confirm")]})]}),children:D?t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:se,icon:"ph:upload",sx:{fontSize:24,mr:2}}),t.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),t.jsx(Se,{checked:h,onChange:(j,b)=>g(b)})]}),t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:se,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),t.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.possibleSameStoreTip")}),t.jsx(Se,{checked:x,onChange:(j,b)=>p(b)})]})]}):t.jsxs(u,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[t.jsx(u,{component:se,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),t.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}En.propTypes={did:d.string.isRequired,params:d.object.isRequired,open:d.bool.isRequired,onClose:d.func.isRequired,setParams:d.func.isRequired,projectId:d.string.isRequired};function An({downloadUrl:e,installUrl:o,handleSetTip:n,isPack:r,disabled:s}){const{t:l}=Q(),[i,a]=R.useState(!1),c=R.useRef(null),f=()=>{a(!i)},h=g=>{c.current&&c.current.contains(g.target)||a(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(Y,{disabled:s,ref:c,onClick:f,children:t.jsx(u,{component:se,sx:{fontSize:18},icon:"bxs:download"})}),t.jsx(Ho,{sx:{zIndex:10},open:i,anchorEl:c.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>t.jsx(Go,{...g,style:{transformOrigin:"center top"},children:t.jsx(Tt,{children:t.jsx(Xo,{onClickAway:h,children:t.jsxs(Jo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&t.jsx(u,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(ue,{sx:{color:"#333"},children:[t.jsx(u,{component:se,sx:{mr:1},icon:"ic:round-install-desktop"}),t.jsx(A,{variant:"inherit",children:l("blocklet.publish.installToThisServer")})]})}),t.jsxs(ue,{onClick:n,children:[t.jsx(u,{component:se,sx:{mr:1},icon:"iconamoon:copy"}),t.jsx(A,{variant:"inherit",children:l("blocklet.publish.copyInstallUrl")})]}),t.jsx(u,{component:"a",href:e,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(ue,{sx:{color:"#333"},children:[t.jsx(u,{component:se,sx:{mr:1},icon:"ph:download"}),t.jsx(A,{variant:"inherit",children:l("common.download")})]})})]})})})})})]})}An.propTypes={disabled:d.bool.isRequired,isPack:d.bool.isRequired,downloadUrl:d.string.isRequired,installUrl:d.string.isRequired,handleSetTip:d.func.isRequired};var Wo;const zo=(Wo=window.env)==null?void 0:Wo.serverEndpoint;function zn({projectId:e,params:o,setParamsErrTip:n,initUrl:r,setParams:s,mode:l,loading:i,blocklet:a,release:c,isPublished:f,releaseId:h,getData:g,getRelease:x,paramsErrTip:p,componentDid:y,resourceRelateComponents:w,disabledSelectComponents:D,saveSelectedEventsRef:j,hasSelectedResources:b,initLogoUrl:T,setLoading:L,releaseUsedLast:I,setReleaseUsedLast:k,projectType:_}){var ve;const{t:$,locale:B}=Q(),{api:S}=me(),C=Dt(),[m,P]=R.useState(!1),[M,U]=R.useState(!1),[v,N]=R.useState(),q=Oe(Z=>Z.breakpoints.down("md")),F=R.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(O=>O.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),G=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:y},"*"),x()},ee=async Z=>{var Le,Ue,qe,$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 ae=Nn({params:o,hasSelectedResources:b,projectId:e,status:Z,t:$});if(ae){V.error(ae.map(W=>W.message).join("; ")),n(ae.reduce((W,K)=>({...W,[K.param]:K.message}),{}));return}const O={...o};if(O.blockletComponents=Si(O.blockletComponents,a,w,D),O.blockletVersion=Re.valid(O.blockletVersion),!O.blockletVersion){V.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(T)try{const W=await Ii({did:a.meta.did,projectId:e,imageUrl:T});O.blockletLogo=W,s({blockletLogo:W})}catch(W){V.error(W.message);return}if(o.resourceFromSelect){O.uploadedResource="";try{const W=Object.keys(j.current);await nt(W.map(K=>()=>{const re=j.current[K];return rr({api:S,locale:B,projectId:e,releaseId:I?"":h,appDid:a.meta.did,component:re.component,resources:re.resources,initUrl:r})}),{concurrency:2})}catch(W){V.error(((qe=(Ue=(Le=W==null?void 0:W.response)==null?void 0:Le.data)==null?void 0:Ue.error)==null?void 0:qe.message)||W.message),n({blockletResource:"Invalid save the resource"});return}}else($e=o.blockletDocker)!=null&&$e.dockerImage||(O.blockletComponents=[]);O.blockletTitle=(O.blockletTitle||"").trim(),O.blockletDescription=(O.blockletDescription||"").trim(),O.blockletSupport=(O.blockletSupport||"").trim(),O.blockletHomepage=(O.blockletHomepage||"").trim(),O.blockletCommunity=(O.blockletCommunity||"").trim(),O.blockletRepository=(O.blockletRepository||"").trim(),O.blockletIntroduction=(O.blockletIntroduction||"").trim(),O.note=(O.note||"").trim(),O.blockletComponents=((O==null?void 0:O.blockletComponents)||[]).filter(W=>W.included).map(W=>Lt(W,["did","required"])).map(JSON.stringify),O.contentType!=="docker"&&(O.blockletDocker={dockerImage:"",dockerArgs:[],dockerEnvs:[]});try{await S.createRelease({input:{...O,did:a.meta.did,projectId:e,releaseId:I?"":h,status:Z}}),Z==="draft"?V.success($("blocklet.publish.saveDraftSuccess")):(k(!1),V.success($("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:y},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(W){const K=Ce(W);V.error(K),(/resource/.test(K)||/zip/.test(K))&&n({blockletResource:K});return}const Fe=await S.getProject({input:{did:a.meta.did,projectId:e}}),_e=Fe.project.lastReleaseId;o.autoUpload&&await nt(Fe.project.connectedStores.map(W=>async()=>{try{const K=await S.publishToStore({input:{did:a.meta.did,storeId:W.storeId,storeName:W.storeName,projectId:e,releaseId:_e,type:F}});V.success(t.jsx(Ts,{storeName:W.storeName,storeUrl:W.storeUrl,developerDid:W.developerDid,published:K.url==="published"}),{duration:1e4})}catch(K){V.error(Ce(K))}}),{concurrency:4}),G==null||G(),C(`../${e}/view/${_e}`,{replace:!0})},X=Z=>(L(!0),ee(Z).finally(()=>{L(!1)})),ne=async Z=>{await hr(S,Z),g()},Te=()=>{U(!0)},Ve=le(zo,`/api/project/${a.meta.did}/${e}/${h}/release/blocklet.json`),xe=new URL(zo);xe.pathname=le(xe.pathname,"/launch-blocklet/agreement"),xe.searchParams.set("blocklet_meta_url",Ve);const te=xe.href,Pe=()=>N(Ve);return t.jsxs(t.Fragment,{children:[t.jsx(Ti,{className:"sticky-header",children:t.jsxs(u,{display:"flex",alignItems:"center",flexDirection:"row",children:[t.jsxs(Fo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ie,{to:"../",children:$("common.blockletStudio")}),e===H.UNOWNED_DID?t.jsx(A,{color:"text.primary",children:t.jsx(pe,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):t.jsx(ie,{to:`../${e}`,children:t.jsx(pe,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),t.jsx(A,{color:"text.primary",children:l==="create"?$("common.create"):(o==null?void 0:o.blockletVersion)||$("common.edit")})]}),t.jsx(u,{flex:"1"}),!f&&t.jsxs(jt,{disabled:i,variant:"contained",children:[t.jsxs(Y,{variant:"contained",onClick:()=>X(ke.PROJECT.RELEASE_STATUS.published),children:[i&&t.jsx(et,{size:14,sx:{mr:.5},color:"inherit"}),$("blocklet.publish.createRelease")]}),t.jsx(Y,{variant:"contained",onClick:Te,children:t.jsx(se,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(Pt,{fullWidth:!0,maxWidth:"sm",open:v,onClose:()=>N(""),children:t.jsxs(u,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(A,{variant:"h6",sx:{mb:2},children:$("blocklet.publish.installResourceTip")}),t.jsx($s,{children:v}),t.jsxs(A,{sx:{mt:2},children:[$("blocklet.publish.installResourceTip2"),t.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:$("blocklet.publish.installResourceHelp")})]})]})}),t.jsxs(jt,{disabled:i,variant:"contained",children:[t.jsxs(Y,{onClick:()=>P(!0),children:[i?t.jsx(et,{size:14,sx:{mr:1},color:"inherit"}):t.jsx($n,{sx:{fontSize:"1.3em",mr:1}}),$(q?"common.upload":"blocklet.publish.connectOrUpload")]}),t.jsx(An,{isPack:F==="pack",downloadUrl:le(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${h}/download/${(c.files||[])[0]}`),installUrl:te,handleSetTip:Pe}),t.jsx(Y,{onClick:Te,children:t.jsx(se,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),t.jsx(qt,{title:$("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:m,onClose:()=>P(!1),children:t.jsx(lo,{projectType:_,blocklet:a,releaseType:F,projectId:e,releaseId:h,componentDid:y,onPublish:G,onOpenConnectStore:ne,onDelete:g,connectedStores:o.connectedStores||[],publishedStoreIds:c==null?void 0:c.publishedStoreIds})}),t.jsx(En,{did:(ve=a==null?void 0:a.meta)==null?void 0:ve.did,params:o,projectId:e,open:M,setParams:s,onClose:()=>U(!1)})]})}zn.propTypes={projectId:d.string.isRequired,params:d.object.isRequired,mode:d.string.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,release:d.object.isRequired,isPublished:d.bool.isRequired,releaseId:d.string.isRequired,getData:d.func.isRequired,getRelease:d.func.isRequired,componentDid:d.string.isRequired,resourceRelateComponents:d.object.isRequired,disabledSelectComponents:d.bool.isRequired,saveSelectedEventsRef:d.object.isRequired,hasSelectedResources:d.bool.isRequired,initLogoUrl:d.string.isRequired,setLoading:d.func.isRequired,releaseUsedLast:d.bool.isRequired,setReleaseUsedLast:d.func.isRequired,projectType:d.string.isRequired,setParamsErrTip:d.func.isRequired,setParams:d.func.isRequired,initUrl:d.object.isRequired,paramsErrTip:d.object.isRequired};const Ti=ce.div`
|
|
167
|
-
.sticky-header {
|
|
168
|
-
margin-top: -12px;
|
|
169
|
-
padding: 12px 0;
|
|
170
|
-
position: sticky;
|
|
171
|
-
top: 0;
|
|
172
|
-
z-index: 99;
|
|
173
|
-
display: flex;
|
|
174
|
-
align-items: center;
|
|
175
|
-
justify-content: space-between;
|
|
176
|
-
background-color: #fff;
|
|
177
|
-
padding-bottom: 12px;
|
|
178
|
-
border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
|
|
179
|
-
}
|
|
180
|
-
`;function Mn({text:e}){return e?t.jsx(Es,{wrapperElement:{"data-color-mode":"light"},source:xs.sanitize(e),rehypePlugins:[[As,{target:"_blank"}]]}):t.jsx(Ie,{Icon:zt})}Mn.propTypes={text:d.string.isRequired};function On({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var h;const{t:i}=Q(),[a,c]=R.useState(l?"preview":"write"),f=(g,x)=>{c(x)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(A,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),t.jsxs(Ko,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(tt,{value:"write",label:"Write"}),t.jsx(tt,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(J,{disabled:r||l,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:l,endAdornment:t.jsxs(Be,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",ke.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{s({blockletIntroduction:""}),o({blockletIntroduction:g.target.value.slice(0,ke.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(Mn,{text:e.blockletIntroduction||""})})]})}On.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var co={},Pi=he;Object.defineProperty(co,"__esModule",{value:!0});var Bn=co.default=void 0,_i=Pi(be()),Mo=t;Bn=co.default=(0,_i.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function ao({step:e,ok:o,active:n,error:r}){let s="grey.500",l=e+1;return o&&(l=t.jsx(zs,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",l=t.jsx(Bn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}ao.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};ao.defaultProps={step:0,ok:!1,active:0,error:""};function Wn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:f}=Q(),h=()=>{n(y=>y+1)},g=()=>{n(y=>y-1)},x=y=>y===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription)||(i==null?void 0:i.blockletHomepage)||(i==null?void 0:i.blockletSupport)||(i==null?void 0:i.blockletCommunity)||(i==null?void 0:i.blockletRepository):y===2?(i==null?void 0:i.blockletResource)||(i==null?void 0:i.blockletDocker)||(i==null?void 0:i.dockerImageName):y>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||Nn({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(ts,{activeStep:o,orientation:"vertical",children:e.map((y,w)=>{const D={},j=l||!Di({hasSelectedResources:r,params:s,projectId:c,step:w,t:f}),b=l?"":x(w);return b&&(D.optional=t.jsx(A,{variant:"caption",color:"error",children:b}),D.error=!0),t.jsxs(os,{children:[t.jsx(ns,{icon:t.jsx(ao,{error:b,active:p?99:o,step:w,ok:j}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...D,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:b||!j&&o>w?"error.main":"inherit",children:y.label})}),t.jsxs(ss,{children:[t.jsx(A,{fontSize:12,children:y.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[w<e.length-1&&t.jsx(Y,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:b||!j,children:f("common.continue")}),w>0&&t.jsx(Y,{disabled:w===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},y.label)})}),o>=e.length-1&&t.jsx(Tt,{square:!0,elevation:0,sx:{p:3},children:t.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Wn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const Li=[".zip",".gz"],qi=1024*1024*100,$i=R.lazy(()=>tn(()=>import("./index-CUlGef8y.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function uo({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a}=Q(),c=R.useRef(null),f=()=>n?!1:!o||o===H.UNOWNED_DID?(V.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,h=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(A,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(je,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(A,{component:"a",href:`${h}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Y,{variant:"outlined",size:"small",onClick:()=>{var g;f()&&((g=c.current)==null||g.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(R.Suspense,{fallback:t.jsx(We,{}),children:t.jsx($i,{ref:c,popup:!0,onUploadFinish:g=>{var x;s({uploadedResource:g.data.filename}),l({blockletResource:""}),(x=c.current)==null||x.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:h,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Li,maxFileSize:qi,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:i})]})}uo.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};uo.defaultProps={};function rt({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:l}){var a;const{t:i}=Q();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(J,{required:!0,disabled:l||e,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(J,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:l||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Be,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",ke.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,ke.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}rt.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};rt.defaultProps={};function Vn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Vn(e[o]);return e}function it({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:l,readOnly:i}){const a=(o==null?void 0:o.value)||"",[c,f]=R.useState(!1),h=()=>{var C;(C=n[s])==null||C.splice(e,1),r({...n,[s]:[...n[s]]})},g=(C,m)=>{var P;(P=n[s])!=null&&P[e]&&(m?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${ht(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},x=(C,m)=>{n[s][e]={...n[s][e],secure:m},r({...n,[s]:[...n[s]]})},p=(C,m)=>{n[s][e]={...n[s][e],shared:m},r({...n,[s]:[...n[s]]})},y=(C,m)=>{n[s][e]={...n[s][e],required:m},r({...n,[s]:[...n[s]]})},w=C=>{n[s][e]={...n[s][e],description:C.target.value},r({...n,[s]:[...n[s]]})},D=C=>{n[s][e]={...n[s][e],path:C.target.value},r({...n,[s]:[...n[s]]})},j=C=>{n[s][e]={...n[s][e],prefix:C.target.value},r({...n,[s]:[...n[s]]})},b=C=>{const m=C.target.value==="web"?"web":"docker";m==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"}),n.dockerArgs[e]={...n.dockerArgs[e],type:m,path:"/",protocol:"http",prefix:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},T=C=>{var m;(m=n[s])!=null&&m[e]&&(n[s][e].name=C.target.value),r({...n,[s]:[...n[s]]})},L=C=>{var m;(m=n[s])!=null&&m[e]&&(n[s][e].value=C.target.value),r({...n,[s]:[...n[s]]})},I=a===`$${ht(o.key)}`||o.custom,k=s==="dockerArgs"&&!ln[o.key],_=Ps[o.key],$=s==="dockerEnvs",B=o.key==="--publish";let S=o.key;return B&&o.type==="web"?S="--publish (Web)":$&&(S=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:S})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(J,{disabled:i||I||k,placeholder:"",value:I?`$${ht(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Be,{position:"end",sx:{zoom:.9},children:[(!(_||k)||$||B)&&t.jsx(oe,{onClick:()=>f(!0),children:t.jsx(se,{icon:"icon-park-outline:setting-config"})}),!i&&t.jsx(oe,{onClick:h,color:k?"error":"default",children:t.jsx(se,{icon:"ic:round-delete"})})]})},error:k,onChange:L}),k&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&_s[o.key](a)&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(qt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:l($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[_||k||$?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.needCustomInput")}),t.jsx(Se,{disabled:i,checked:I,onChange:g,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.secure")}),t.jsx(Se,{disabled:i,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.shared")}),t.jsx(Se,{disabled:i,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.required")}),t.jsx(Se,{disabled:i,checked:o.required,onChange:y,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.description")}),t.jsx(J,{disabled:i,value:o.description,onChange:w,sx:{flex:1},label:l("blocklet.publish.docker.description")})]}),B&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.portType")}),t.jsxs(en,{value:o.type||"docker",onChange:b,children:[t.jsx(ue,{value:"docker",children:"Docker"}),t.jsx(ue,{value:"web",children:"Web"})]})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.path")}),t.jsx(J,{disabled:i,value:o.path,onChange:D,sx:{flex:1},label:l("blocklet.publish.docker.path")})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.name")}),t.jsx(J,{disabled:i,value:o.name,onChange:T,sx:{flex:1},label:l("blocklet.publish.docker.name")})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.prefix")}),t.jsx(J,{disabled:i,value:o.prefix,onChange:j,sx:{flex:1},label:l("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};it.defaultProps={};const Ni=`
|
|
181
|
-
docker run --name postgrest
|
|
182
|
-
-p 3000:3000
|
|
183
|
-
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
184
|
-
-e PGRST_DB_SCHEMA="public"
|
|
185
|
-
-e PGRST_DB_ANON_ROLE="anon"
|
|
186
|
-
postgrest/postgrest
|
|
187
|
-
`.trim();function po({readOnly:e,paramsErrTip:o,setParamsErrTip:n,error:r,params:s,setParams:l}){const{t:i}=Q(),[a,c]=R.useState("dockerParams"),[f,h]=R.useState(""),[g,x]=R.useState(!1),[p,y]=R.useState("--volume"),[w,D]=R.useState(""),[j,b]=R.useState(vo(f)),T=j.dockerArgs||[],L=j.dockerEnvs||[],I=j.dockerImage||"",k=C=>{const{value:m}=C.target;h(m)};R.useEffect(()=>{s.blockletDocker&&s.blockletDocker.dockerImage&&!I&&b(s.blockletDocker)},[s,I,b]);const _=C=>{const m=vo(C.target.value);b(P=>{let M,U=!1;return m.dockerArgs.forEach(v=>{const N=P.dockerArgs.find(q=>q.key===v.key);N&&(Object.entries(N).forEach(([q,F])=>{F!=null&&q!=="value"&&(v[q]=F)}),v.type==="web"&&(v.path="/",v.protocol="http",v.prefix="/",v.name="publicUrl",v.port="BLOCKLET_PORT",U=!0),!M&&v.key==="--publish"&&(M=v))}),!U&&M&&(M.type="web",M.path="/",M.protocol="http",M.prefix="/",M.name="publicUrl",M.port="BLOCKLET_PORT"),m.dockerEnvs.forEach(v=>{const N=P.dockerEnvs.find(q=>q.key===v.key);N&&Object.entries(N).forEach(([q,F])=>{F!=null&&q!=="value"&&(v[q]=F)})}),m})},$=()=>{if(x(!1),p==="--env"){b({...j,dockerEnvs:[...L,{key:w,value:"",custom:"",secure:!1,shared:!1,required:!1,description:w}]}),D("");return}b({...j,dockerArgs:[...T,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},B=()=>{x(!1),D("")},S=C=>{const{value:m}=C.target;b({...j,dockerImage:m}),m.indexOf(" ")>-1?n({...o,dockerImageName:i("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})};return R.useEffect(()=>{a==="dockerCommand"&&h(Ls(j))},[j,a]),R.useEffect(()=>{l(C=>({...C,blockletDocker:{dockerImage:j.dockerImage,dockerArgs:j.dockerArgs,dockerEnvs:j.dockerEnvs}}))},[j,l]),t.jsxs(u,{sx:{mt:3},children:[t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[t.jsx(u,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:t.jsxs(Ko,{value:a,onChange:(C,m)=>c(m),children:[t.jsx(tt,{value:"dockerParams",label:i("blocklet.publish.docker.dockerParams")}),t.jsx(tt,{value:"dockerCommand",label:i("blocklet.publish.docker.dockerCommand")})]})}),a==="dockerCommand"&&t.jsx(J,{disabled:e,label:i("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Ni,InputProps:{"data-cy":"blocklet-docker-command",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:k,onBlur:_}),a==="dockerParams"&&t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx(J,{disabled:e,label:i("blocklet.publish.docker.dockerImageName"),placeholder:i("blocklet.publish.docker.dockerImageName"),value:I,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:S}),t.jsx(A,{variant:"caption",color:"text.secondary",children:"Example: docker.io/postgrest/postgrest:latest"}),t.jsx(u,{sx:{height:4}}),T.map((C,m)=>t.jsx(it,{index:m,item:C,dockerParams:j,setDockerParams:b,dataKey:"dockerArgs",t:i,readOnly:e},`${C.key}-${m}`)),L.map((C,m)=>t.jsx(it,{index:m,item:C,dockerParams:j,setDockerParams:b,dataKey:"dockerEnvs",t:i,readOnly:e},`${C.key}-${m}`)),!e&&t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{flex:1}}),t.jsx(Y,{onClick:()=>x(!0),children:i("blocklet.publish.docker.addItem")})]})]})]}),!!r&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:r}),g&&t.jsxs(Pt,{fullWidth:!0,open:!0,children:[t.jsx(Qo,{children:i("blocklet.publish.docker.addItem")}),t.jsx(Yo,{children:t.jsxs(rs,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[t.jsx(en,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:C=>y(C.target.value),children:Object.keys(ln).map(C=>t.jsx(ue,{value:C,children:C}))}),p==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.publishTips")}),p==="--volume"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.volumeTips")}),p==="--env"&&t.jsxs(u,{sx:{mt:3,width:"100%"},children:[t.jsx(J,{value:w,onChange:C=>D(C.target.value),sx:{width:"100%"},label:i("blocklet.publish.docker.envKey")}),t.jsx(is,{children:i("blocklet.publish.docker.dockerArgValue")})]})]})}),t.jsxs(Zo,{children:[t.jsx(Y,{onClick:B,children:i("common.cancel")}),t.jsx(Y,{onClick:$,children:i("common.confirm")})]})]})]})}po.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired,paramsErrTip:d.func.isRequired};po.defaultProps={};const Ei=({tabs:e,blocklet:o,ancestors:n=[]})=>{const r=o.meta.did;e.push({label:t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Et,{size:24,blocklet:o,ancestors:n}),t.jsx(u,{ml:"4px",className:"text",children:t.jsx(u,{children:o.meta.title})})]},r),value:r})},Oo=(e,o)=>{const n=Lt(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(r=>({...r,included:!0})):n.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),n},Ai={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Bo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function fo({initUrl:e,...o}){var ho;const{projectId:n,mode:r,releaseId:s,componentDid:l=""}=lt(),{t:i}=Q(),{blocklet:a}=De(),[c,f]=we({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[h,g]=we({}),[x,p]=R.useState(!1),[y,w]=we(null),{api:D}=me(),j=Oe(E=>E.breakpoints.down("md")),[b,T]=R.useState({}),[L,I]=R.useState(!1),k=R.useRef({}),[_,$]=we({}),[B,S]=R.useState(""),[C,m]=we({}),P=e==null?void 0:e.searchParams.get("dependentComponentsMode"),M=P==="readonly",U=R.useMemo(()=>{const E={};return Object.keys(C).forEach(z=>{const ge=C[z];ge&&ge.forEach(Un=>{E[Un]=!0})}),E},[C]),v=R.useCallback(E=>{M&&f({blockletComponents:[]}),m(E)},[M,m,f]),N=R.useCallback((...E)=>{$(...E),g({blockletResource:"",blockletDocker:""})},[]),q=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[F,G]=R.useState(r==="new-release"?4:0);R.useEffect(()=>{n&&g({projectId:""})},[n,g]);const ee=R.useMemo(()=>{var E;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":(E=c==null?void 0:c.blockletComponents)!=null&&E.some(z=>z.included)||Object.keys(U).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,U,c==null?void 0:c.blockletResourceType]),X=[],ne=((a==null?void 0:a.children)||[]).filter(E=>{var z;return(z=E.meta.resource)==null?void 0:z.exportApi}).filter(E=>!l||E.meta.did===l);ne.forEach(E=>{Ei({tabs:X,blocklet:E,t:i,ancestors:[a]})});const[Te,Ve]=R.useState((ho=X[0])==null?void 0:ho.value),xe=!L&&(y==null?void 0:y.status)==="published",te=xe,Pe=vs(()=>{if(!e)return;S(e.searchParams.get("logo")),f(z=>{var ge;return{...z,blockletTitle:(z==null?void 0:z.blockletTitle)||e.searchParams.get("title"),blockletDescription:(z==null?void 0:z.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(z==null?void 0:z.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(ge=z==null?void 0:z.blockletComponents)!=null&&ge.length?z==null?void 0:z.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(z==null?void 0:z.note)||e.searchParams.get("note")||"No note"}});const E=e.searchParams.get("resources");try{const z=JSON.parse(E);T(z)}catch{}}),ve=async()=>{if(q)try{const E=await D.getRelease({input:{did:a.meta.did,projectId:n,releaseId:q}});if(p(!1),!E.release){V.error("Release not found");return}E.release=Vn(E.release),r!=="view"&&(E.release.note=""),f(z=>Oo({...z,...E.release,blockletVersion:r==="create"||r==="new-release"?Re.inc(E.release.blockletVersion,"patch"):E.release.blockletVersion},a)),w(E.release)}catch(E){p(!1),V.error(Ce(E))}},Z=async()=>{if(n===H.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){V.error(i("blocklet.publish.errorTip.noDid"));return}try{const z=(await D.getProject({input:{did:a.meta.did,projectId:n}})).project||{};z.blockletVersion?(r==="create"||r==="new-release")&&Re.valid(z.blockletVersion)&&(z.blockletVersion=Re.inc(z.blockletVersion,"patch")):z.blockletVersion="0.0.1";const ge=Oo(z,a);f(ge),z.lastReleaseId||Pe()}catch(E){V.error(Ce(E))}},ae=R.useCallback(async()=>{p(!0);try{if(r==="view"){if(!q){V.error("Empty release id");return}await Z(),await ve();return}await Z(),q&&(I(!0),await ve())}finally{p(!1)}},[r,q]),O=E=>{f({blockletComponents:E})},Fe=E=>{f({blockletResourceType:E})};R.useEffect(()=>{ae()},[ae]),R.useEffect(()=>{n===H.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&Pe()},[n,e,r,Pe]),R.useEffect(()=>{c.contentType==="docker"?f({resourceFromSelect:!1}):c.contentType==="blocklet"?f({resourceFromSelect:!0}):c.contentType==="upload"&&f({resourceFromSelect:!1})},[c.contentType,f]);const _e=R.useMemo(()=>!!Object.keys(_).find(E=>!!_[E].length),[_]);if(!c&&x)return t.jsx(We,{});if(!c)return null;const Le=ne.find(E=>E.meta.did===Te),Ue=E=>{Ve(E)},qe=e==null?void 0:e.searchParams.get("resourcesTitle"),$e=e==null?void 0:e.searchParams.get("componentsTitle"),W=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:qe||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:$e||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],K=W[F]||W[W.length-1],re=Ai[F];return t.jsxs(zi,{...o,children:[t.jsx(zn,{blocklet:a,release:y,getData:ae,getRelease:ve,mode:r,params:c,setParams:f,setParamsErrTip:g,readOnly:te,isPublished:xe,loading:x,setLoading:p,initLogoUrl:B,releaseId:q,projectId:n,projectType:ee,resourceComponents:ne,resourceComponentsMap:C,resourceRelateComponents:U,resourceItem:Le,saveSelectedEventsRef:k,hasSelectedResources:_e,releaseUsedLast:L,setReleaseUsedLast:I,setRelease:w,paramsErrTip:h}),t.jsxs(u,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[t.jsx(u,{pt:3}),t.jsxs(u,{sx:{gap:3},display:"flex",flexDirection:j?"column":"row",children:[!j&&t.jsx(Wn,{steps:W,loading:x,viewMode:r==="view",params:c,hasSelectedResources:_e||c.uploadedResource,paramsErrTip:h,activeStep:F,setActiveStep:G,projectId:n,resourcesUrlTitle:qe,componentsUrlTitle:$e}),t.jsxs(u,{flex:"1",maxWidth:"720px",children:[!j&&re!=="introduction"&&t.jsxs(A,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[K.label,re==="branding"&&t.jsx(de,{title:i("blocklet.publish.brandingHelp"),placement:"right",children:t.jsx(u,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:t.jsx(ys,{})})})]}),(j||re==="branding")&&t.jsx(u,{flexDirection:"column",children:t.jsx(qn,{projectId:n,setParams:f,setParamsErrTip:g,params:c,componentDid:l,blocklet:a,initUrl:e,loading:x,setLoading:p,paramsErrTip:h,readOnly:te,initLogoUrl:B,setInitLogoUrl:S})}),j&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:x,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:te})}),(j||re==="introduction")&&t.jsx(u,{display:"flex",flexDirection:"column",sx:{mt:j?5:0,width:"100%"},children:t.jsx(On,{loading:x,readOnly:te,params:c,setParams:f,paramsErrTip:h,setParamsErrTip:g})}),j&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:W[Bo.resources].label}),t.jsx(u,{display:j||re==="resources"?"flex":"none",sx:{maxWidth:720},flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(ls,{onChange:E=>f({contentType:E.target.value}),children:[t.jsx(Xe,{value:"blocklet",disabled:te,control:t.jsx(ft,{size:"small",checked:c.contentType==="blocklet"}),label:i("blocklet.publish.resourceSelect")}),t.jsx(Xe,{value:"upload",disabled:te,control:t.jsx(ft,{size:"small",checked:c.contentType==="upload"}),label:i("blocklet.publish.resourceUpload")}),t.jsx(Xe,{value:"docker",disabled:te,control:t.jsx(ft,{size:"small",checked:c.contentType==="docker"}),label:i("blocklet.publish.resourceDocker")})]}),c.contentType==="blocklet"&&t.jsxs(t.Fragment,{children:[!l&&t.jsx(gs,{tabs:X,current:Te,onChange:Ue,sx:{ml:-2,mt:2,maxWidth:j?window.innerWidth-24:"100%"}}),t.jsx(Qt,{loading:x,initialResources:b,saveSelectedEventsRef:k,selectedResourceIds:_,setSelectedResourceIds:N,setResourceComponentsMap:v,error:h.blockletResource,app:a,readOnly:te,component:Le,componentDid:l,initUrl:e,params:c,setParams:f,projectId:n===H.UNOWNED_DID?"":n,releaseUsedLast:L,release:{...y,id:q}})]}),c.contentType==="upload"&&t.jsx(uo,{app:a,readOnly:te,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g}),c.contentType==="docker"&&t.jsx(po,{app:a,readOnly:te,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g,paramsErrTip:h})]})})}),j&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:W[Bo.blocklets].label}),(j||re==="blocklets")&&t.jsx(u,{flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsx(u,{sx:{flex:1},children:t.jsx(Ht,{projectType:ee,disabled:x||te,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:O,onChangeBlockletResourceType:Fe,resourceRelateComponents:U,dependentComponentsMode:P})})})}),!j&&re==="version"&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:x,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:te})})]})]})]})]})}fo.propTypes={initUrl:d.object};fo.defaultProps={initUrl:null};const zi=ce.div`
|
|
188
|
-
.section {
|
|
189
|
-
&.full-width {
|
|
190
|
-
max-width: 100%;
|
|
191
|
-
}
|
|
192
|
-
.MuiTypography-h3 {
|
|
193
|
-
font-size: 1.1rem;
|
|
194
|
-
font-weight: 700;
|
|
195
|
-
}
|
|
196
|
-
.left {
|
|
197
|
-
flex-shrink: 0;
|
|
198
|
-
width: 140px;
|
|
199
|
-
}
|
|
200
|
-
.MuiTabs-indicator {
|
|
201
|
-
display: none;
|
|
202
|
-
}
|
|
203
|
-
.MuiTypography-subtitle1 {
|
|
204
|
-
width: 120px;
|
|
205
|
-
font-weight: 700;
|
|
206
|
-
font-size: 1rem;
|
|
207
|
-
${({theme:e})=>e.breakpoints.down("sm")} {
|
|
208
|
-
width: 80px;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
.MuiButtonBase-root {
|
|
213
|
-
a {
|
|
214
|
-
color: inherit;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
.MuiInputBase-multiline .MuiInputAdornment-positionEnd {
|
|
218
|
-
align-self: flex-end;
|
|
219
|
-
.MuiTypography-root {
|
|
220
|
-
font-size: 0.8rem;
|
|
221
|
-
}
|
|
222
|
-
font-size: 0.8rem;
|
|
223
|
-
}
|
|
224
|
-
`;function Fn({padding:e,initUrl:o}){const{blocklet:n}=De(),r=Hn(),{componentDid:s}=lt();if(R.useEffect(()=>{if(s&&window.parent){const i=`${r.pathname}${r.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:s,path:i},"*")}},[s,r]),!n)return null;const l={};return e&&(l.padding=e),t.jsx(Mi,{style:l,children:t.jsxs(Gn,{children:[t.jsx(pt,{path:"/",element:t.jsx(Vt,{initUrl:o})}),t.jsx(pt,{path:"/:projectId",element:t.jsx(Qs,{})}),t.jsx(pt,{path:"/:projectId/:mode/:releaseId",element:t.jsx(fo,{initUrl:o})})]})})}Fn.propTypes={padding:d.oneOfType([d.string,d.number]),initUrl:d.object};Fn.defaultProps={padding:"",initUrl:null};const Mi=ce(u)`
|
|
225
|
-
a {
|
|
226
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
227
|
-
}
|
|
228
|
-
`;export{Fn as default};
|