@abtnode/blocklet-services 1.16.39-beta-20250211-055232-54765cee → 1.16.39-beta-20250212-101102-2d68fc2a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Add-DSPtuudj.js → Add-CuIZWfjH.js} +1 -1
- package/dist/assets/{ArrowDropDown-DM9y1OaN.js → ArrowDropDown-Cv3eCDY6.js} +1 -1
- package/dist/assets/{CheckCircle-BxzRfCun.js → CheckCircle-D-unagro.js} +1 -1
- package/dist/assets/{ChevronLeft-CmbkC1dP.js → ChevronLeft-Gy0Fh2PP.js} +1 -1
- package/dist/assets/{ChevronRight-DlIj8Fj2.js → ChevronRight-DSecMzs8.js} +1 -1
- package/dist/assets/{DeleteOutline-BzV7E1BM.js → DeleteOutline-CnjMnu1G.js} +1 -1
- package/dist/assets/{Done-DJfjmlFC.js → Done-C8ZSABDp.js} +1 -1
- package/dist/assets/{Download-B4M4wwJm.js → Download-BpCGsakQ.js} +1 -1
- package/dist/assets/{Error-CN75ZRlV.js → Error-CIVKKbPu.js} +1 -1
- package/dist/assets/{Google-DTKsjoGP.js → Google-CSRPwRzS.js} +1 -1
- package/dist/assets/{InfoOutlined-C_J3Y0fX.js → InfoOutlined-C8xfkBe6.js} +1 -1
- package/dist/assets/{Launch-BX35m3eH.js → Launch-BfiIdCmh.js} +1 -1
- package/dist/assets/{LaunchOutlined-DaJw5LME.js → LaunchOutlined-DmwI20ey.js} +1 -1
- package/dist/assets/{Loop-B05tzyuy.js → Loop-Dlnais4C.js} +1 -1
- package/dist/assets/{MoreHoriz-JX8PbVXG.js → MoreHoriz-DbMNKpjF.js} +1 -1
- package/dist/assets/{PlayArrow-DZfknrYj.js → PlayArrow-CZfWYrXK.js} +1 -1
- package/dist/assets/{ViewList-CgG45KQv.js → ViewList-CV3Yxakp.js} +1 -1
- package/dist/assets/{access-control-Cvyyosl7.js → access-control-DdkKjkTj.js} +1 -1
- package/dist/assets/{actions-CPjP-DJ-.js → actions-DDpgZ17S.js} +1 -1
- package/dist/assets/{add-component-core-DlH-ksP3.js → add-component-core-CF05FURP.js} +29 -29
- package/dist/assets/{add-resource-Bi7DpPfy.js → add-resource-u9CnYHQ7.js} +1 -1
- package/dist/assets/{addon-B4K2H5lA.js → addon-BCk9L1CD.js} +1 -1
- package/dist/assets/{analytics-D5Wg9yw6.js → analytics-sm8oL_To.js} +1 -1
- package/dist/assets/{audit-logs-CpENNExh.js → audit-logs-Cre3WUIo.js} +1 -1
- package/dist/assets/{base32-BAfsRZF6.js → base32-LsxuOFGQ.js} +1 -1
- package/dist/assets/{branding-D_9x1yUc.js → branding-BTgKt5ES.js} +2 -2
- package/dist/assets/{bundle-avatar-3QSGrsNA.js → bundle-avatar-7g1gtR_Q.js} +1 -1
- package/dist/assets/{button-BZmMffY2.js → button-DlYlZH8h.js} +1 -1
- package/dist/assets/{click-to-copy-Bu9H6mvL.js → click-to-copy-BLRxskBB.js} +1 -1
- package/dist/assets/{complete-DWza6ypd.js → complete-DY43z8bC.js} +1 -1
- package/dist/assets/{component-CMPB9eGw.js → component-C3wYVoFz.js} +1 -1
- package/dist/assets/{config-wRVMZtMQ.js → config--1vdfQxl.js} +1 -1
- package/dist/assets/{config-DjozEU7w.js → config-5CfgPrCe.js} +1 -1
- package/dist/assets/{config-navigation-D-th1tcR.js → config-navigation-xcMpeduS.js} +3 -3
- package/dist/assets/{config-space-DQcEAb4q.js → config-space-C59Z4PGK.js} +1 -1
- package/dist/assets/{confirm-dIU5y9cG.js → confirm-DfsY08eB.js} +1 -1
- package/dist/assets/{connect-BCsAv_0T.js → connect-5VLKxKh7.js} +1 -1
- package/dist/assets/{connect-Bzzh-qas.js → connect-hKwHeTo3.js} +1 -1
- package/dist/assets/{connect-to-BzwS4rD2.js → connect-to-B_2lM0_9.js} +1 -1
- package/dist/assets/dashboard-DQnfagMU.js +217 -0
- package/dist/assets/{did-address-D0Fo5eTl.js → did-address-CsW_VsB3.js} +1 -1
- package/dist/assets/{domain-SUtQ2mKp.js → domain-PLy6pooV.js} +1 -1
- package/dist/assets/{domain-list-C6MW__fO.js → domain-list-Bc7A7RER.js} +1 -1
- package/dist/assets/{email-C1qoJ5wN.js → email-D3sOIREb.js} +1 -1
- package/dist/assets/{exchange-passport-DN1dbwCF.js → exchange-passport-CS0Md1xZ.js} +1 -1
- package/dist/assets/{form-text-input-DixVGGLY.js → form-text-input-AT4HfkHl.js} +1 -1
- package/dist/assets/{fuel-DbSYx7td.js → fuel-CEtlY46W.js} +1 -1
- package/dist/assets/{fullpage-DT2JXUAZ.js → fullpage-Ce9Y2TSP.js} +1 -1
- package/dist/assets/{get-safe-url-DDeO6YpV.js → get-safe-url-BVbIl2hB.js} +1 -1
- package/dist/assets/{get-safe-url-Du4BhDgB.js → get-safe-url-SccGjxz4.js} +1 -1
- package/dist/assets/{home-DqIS-M10.js → home-BI67JVLT.js} +1 -1
- package/dist/assets/{iframe-CU0LfRyS.js → iframe-De6QHL_6.js} +1 -1
- package/dist/assets/index-B9Bc9vnG.js +77 -0
- package/dist/assets/{index-DGzAI_hi.js → index-BdfWmlqh.js} +1 -1
- package/dist/assets/{index-BkTpbxSu.js → index-BoVroYzD.js} +33 -33
- package/dist/assets/index-C9UnRN7C.js +228 -0
- package/dist/assets/{index-Bv_3agvW.js → index-C9lMjZBr.js} +7 -7
- package/dist/assets/{index-_suzTPHn.js → index-CxW3Q7hC.js} +21 -27
- package/dist/assets/{index-B19CQ2ic.js → index-D-6G7He6.js} +1 -1
- package/dist/assets/{index-Cld1HWxz.js → index-DUVrFM9m.js} +1 -1
- package/dist/assets/{index-C85gVBzh.js → index-DVfi3VUs.js} +42 -42
- package/dist/assets/{index-bmafJpME.js → index-Dq1yoqB-.js} +1 -1
- package/dist/assets/{index-BFxdORkH.js → index-DsrVmpPp.js} +1 -1
- package/dist/assets/{index-Bwql_DnM.js → index-NTlhnYZO.js} +1 -1
- package/dist/assets/{index-sPEpq71V.js → index-R7D5qhDv.js} +1 -1
- package/dist/assets/{index-aIv-YSXW.js → index-o2FFW-yx.js} +1 -1
- package/dist/assets/{index-xXoK_djD.js → index-p0322yKe.js} +1 -1
- package/dist/assets/{invitation-CBTcflFA.js → invitation-DWG-KySA.js} +1 -1
- package/dist/assets/{invite-BX9Ow66V.js → invite-Lcgs0Fhi.js} +1 -1
- package/dist/assets/{issue-passport-CgO1vOso.js → issue-passport-pkmrmS7N.js} +1 -1
- package/dist/assets/{item-IntWv1pk.js → item-B6N6t3kF.js} +1 -1
- package/dist/assets/{layout-DNDd_arD.js → layout-CF6TreKX.js} +1 -1
- package/dist/assets/list-D3MtvbeT.js +188 -0
- package/dist/assets/{list-header-BdJ1JRqY.js → list-header-DxG3xooH.js} +1 -1
- package/dist/assets/{localization-Dqw_hZdb.js → localization-BOHiIJhm.js} +1 -1
- package/dist/assets/{log-BQgDF08N.js → log-ZG0PJXpX.js} +1 -1
- package/dist/assets/{login-BUeQyCFg.js → login-BbaHO4Ca.js} +1 -1
- package/dist/assets/{login-oauth-callback-Dua5YLNm.js → login-oauth-callback-VhHKXVPh.js} +1 -1
- package/dist/assets/{logo-uploader-lx0oUxRg.js → logo-uploader-DZitXtFf.js} +3 -3
- package/dist/assets/{lost-passport-C-DfyBDR.js → lost-passport-C9bxtr1Q.js} +1 -1
- package/dist/assets/{open-window-BCSIX9-I.js → open-window-YQ4vV2tF.js} +1 -1
- package/dist/assets/{overview-BZ7IJTY1.js → overview-GoLeUZDo.js} +1 -1
- package/dist/assets/{page-header-xWImGBdx.js → page-header-DZTCF7io.js} +1 -1
- package/dist/assets/{permission-C0p6f4_S.js → permission-BQ0E8FmL.js} +1 -1
- package/dist/assets/{preferences-C1-L0Kuo.js → preferences-CjipuYyV.js} +1 -1
- package/dist/assets/publish-resource-Czivui9b.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DwxjmShi.js → react-beautiful-dnd.esm-B0xxfe7i.js} +1 -1
- package/dist/assets/{relative-time-ChYpdg43.js → relative-time-Bkhqzrgv.js} +1 -1
- package/dist/assets/sdk-CBf7wJy0.js +1 -0
- package/dist/assets/{session-CM1ewS-k.js → session-DKWhsUi1.js} +1 -1
- package/dist/assets/{setup-BlbLoMQQ.js → setup-6BkYc-NJ.js} +3 -3
- package/dist/assets/{start-C_qLBKVg.js → start-C6UPvOLP.js} +1 -1
- package/dist/assets/{step-actions-BYvMcDu2.js → step-actions-BmiH863e.js} +1 -1
- package/dist/assets/{studio-DtUwD8m6.js → studio-BdNJR01R.js} +1 -1
- package/dist/assets/{switch-control-D2qynQm8.js → switch-control-1mrS2A0x.js} +1 -1
- package/dist/assets/{traffic-CctA2CCp.js → traffic-CoKCU9bb.js} +1 -1
- package/dist/assets/{transfer-D5wgUCh5.js → transfer-bCXNyiiH.js} +1 -1
- package/dist/assets/{unsubscribe-Fvp6J_a-.js → unsubscribe-DruGK6Ne.js} +1 -1
- package/dist/assets/{useLocalStorage-DV4AIe5L.js → useLocalStorage-DYSzZAco.js} +1 -1
- package/dist/assets/user-center-B33739jv.js +71 -0
- package/dist/assets/{util-XV_5OnOm.js → util-BTCA4Hee.js} +1 -1
- package/dist/assets/{util-NSOsPZWM.js → util-BblN2lT9.js} +1 -1
- package/dist/assets/vendor-arcblock-DE69EmW_.js +3512 -0
- package/dist/assets/{wrap-locale-BQ1e-7Pm.js → wrap-locale-CLuwhKrO.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/service-worker.js +1 -1
- package/package.json +29 -29
- package/dist/assets/dashboard-DEaIei4u.js +0 -216
- package/dist/assets/index-DUoD69VU.js +0 -77
- package/dist/assets/index-Dz_dMBd6.js +0 -228
- package/dist/assets/list-Cy1my35m.js +0 -159
- package/dist/assets/publish-resource-C6LjZThR.js +0 -1
- package/dist/assets/sdk-TBkp9MgA.js +0 -1
- package/dist/assets/user-center-BPnFfNIW.js +0 -71
- package/dist/assets/vendor-arcblock-DZrZ_x_3.js +0 -3506
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-_suzTPHn.js","assets/vendor-arcblock-DZrZ_x_3.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-5TjOM6td.js","assets/vendor-mui-core-xF5F4eT7.js","assets/vendor-hooks-BKxTDk_P.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-C2fPoxDR.js","assets/index-C85gVBzh.js","assets/index-DoZ2YM4T.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as S,k as Dt,l as lt,L as ce,f as Hn,h as Gn,i as pt}from"./vendor-react-D-afvo_7.js";import{a1 as be,j as t,t as ze,a3 as u,aM as Wo,E as d,a4 as pe,I as ne,T as A,bU as Uo,aa as de,aE as Xn,bL as Ge,ad as Fo,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 fe,ah as Jn,D as _t,ab as Qo,r as Yo,bK as Qn,K as Be,y as Zo,M as Z,ac as ye,aL as Yn,L as Zn,z as Kn,bn as es,aA as Ko,az as tt,bt as ts,bu as os,bV as ns,bW as ss,aP as en,bH as rs,bN as is,bx as ls,by as ft}from"./vendor-mui-core-xF5F4eT7.js";import{y as xe,B as Te,h as ie,a5 as cs,f as mo,_ as tn,ad as bo}from"./index-C85gVBzh.js";import{$ as ge,b as H,e as Q,a2 as ot,ab as on,aT as nn,a9 as sn,Z as as,aU as Pt,j as W,n as ds,aV as us,aW as ps,Y as fs,aB as re,aX as hs,ao as ms,aL as Re,a6 as Lt,aY as ve,ah as bs,am as xs}from"./vendor-arcblock-DZrZ_x_3.js";import{d as qt}from"./Add-DSPtuudj.js";import{d as gs}from"./Error-CN75ZRlV.js";import{C as $t}from"./confirm-dIU5y9cG.js";import{u as ct}from"./session-CM1ewS-k.js";import{W as xo}from"./did-address-D0Fo5eTl.js";import{E as Ve,D as go,C as jo,P as ko}from"./react-beautiful-dnd.esm-DwxjmShi.js";import{B as Nt}from"./bundle-avatar-3QSGrsNA.js";import{S as he}from"./shorten-label-J69eHfMN.js";import{T as js,x as ae,G as At,C as Je}from"./vendor-utils-5TjOM6td.js";import{d as ks}from"./Download-B4M4wwJm.js";import{d as ys}from"./QuestionMarkCircle-BvUTckGB.js";import{u as vs}from"./vendor-hooks-BKxTDk_P.js";import{_ as Se}from"./useSetState-Crt4S51m.js";import{c as Et}from"./index-DoZ2YM4T.js";import{E as Mt}from"./index-CHFvfli7.js";import{p as nt}from"./index-aIv-YSXW.js";import"./api-K65cLqol.js";import{d as ws}from"./ChevronRight-DlIj8Fj2.js";import{T as Cs,a as Ss}from"./vendor-mui-x-CSUdon8K.js";import{d as yo}from"./DeleteOutline-BzV7E1BM.js";import{c as Rs,A as rn,u as Is,S as Ds,U as Ts,a as ht,b as ln,n as _s,e as Ps,f as vo,g as Ls}from"./item-IntWv1pk.js";import{d as qs}from"./ArrowDropDown-DM9y1OaN.js";import{f as Ie}from"./format-error-C0Ke3VXF.js";import{C as $s}from"./click-to-copy-Bu9H6mvL.js";import{d as Ns}from"./Launch-BX35m3eH.js";import{M as As}from"./index-ChSPqVLh.js";import{r as Es}from"./index-DtwN19zv.js";import{d as Ms}from"./Done-DJfjmlFC.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-Du4BhDgB.js";var Ot={},Os=be;Object.defineProperty(Ot,"__esModule",{value:!0});var cn=Ot.default=void 0,zs=Os(ge()),Bs=t;cn=Ot.default=(0,zs.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 zt={},Vs=be;Object.defineProperty(zt,"__esModule",{value:!0});var an=zt.default=void 0,Ws=Vs(ge()),Us=t;an=zt.default=(0,Ws.default)((0,Us.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={},Fs=be;Object.defineProperty(Bt,"__esModule",{value:!0});var dn=Bt.default=void 0,Hs=Fs(ge()),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 Vt({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]=S.useState(!1),f=ze(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(Wo,{sx:{borderRadius:1},src:i}),t.jsxs(u,{children:[t.jsx(he,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(he,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Vt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Wt({initUrl:e}){const o=Dt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:l}=xe(),{api:i}=ct(),[a,c]=S.useState(!0),{blocklet:f}=Te(),[h,g]=S.useState(null),[m,p]=S.useState(!1),v=ze(j=>j.breakpoints.down("xl")),{componentDid:w=""}=lt(),[T,x]=S.useState(null),b=()=>{l.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(j=>{const P=(j==null?void 0:j.projects)||[];c(!1),x(P)}).catch(j=>{c(!1),W.error(j.message)})},I=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},L=j=>{g(j)},D=()=>{c(!1),p(!0)},k=()=>{p(!1),g(null)},_=j=>{W.error(j.message),p(!1),g(null)},N=j=>{if(!(j!=null&&j.deleted)){W.error("Delete project failed");return}b(),p(!1),g(null)},U=(j,P,E)=>{let F=j==null?void 0:j.trim();return F?(F=ds.toAddress(F).toLocaleLowerCase(),E.some((O,R)=>{const q=P[R];return q&&O.searchable&&O.display!=="excluded"&&O.display!=="false"&&q.toLocaleLowerCase().includes(F)})):!0};if(S.useEffect(()=>{b()},[]),!T&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!T)return null;if(!T.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:I,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const y=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:j=>{const P=T[j];return t.jsx(ce,{to:`${P.id}`,children:t.jsx(Vt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:j=>j?t.jsx(on,{type:"success",children:j}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:j=>j?t.jsx(xo,{size:14,compact:!0,responsive:!1,did:j}):null}},v||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:j=>j?t.jsx(xo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${j}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:j}):null}},v||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:j=>{const P=(f.children||[]).find(E=>E.meta.did===j);return P?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Nt,{size:14,blocklet:P,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},j):""}}},v||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:j=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(he,{children:j})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:j=>t.jsx(nn,{value:Number(j),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:j=>{const P=T[j];return t.jsxs(u,{display:"flex",children:[t.jsx(ce,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:t.jsx(pe,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"create",children:t.jsx(cn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&t.jsx(pe,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx(ce,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:t.jsx(an,{sx:{fontSize:18}})})})}),t.jsx(pe,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>L(P),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),C=m?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:N,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(pe,{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:I,variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Pt,{className:"main-table",locale:s,data:T,columns:y,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:U}}),h&&t.jsx($t,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:D,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(j=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(gs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:j})]}))})}),C]})}Wt.propTypes={initUrl:d.object};Wt.defaultProps={initUrl:null};var Ut={},Xs=be;Object.defineProperty(Ut,"__esModule",{value:!0});var un=Ut.default=void 0,Js=Xs(ge()),wo=t;un=Ut.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 D;const{t:e,locale:o}=Q(),{projectId:n}=lt(),{api:r}=xe(),[s,l]=S.useState(!0),{blocklet:i}=Te(),a=ze(k=>k.breakpoints.down("md")),[c,f]=S.useState(null),[h,g]=S.useState(null),[m,p]=S.useState(null),v=(D=window.env)==null?void 0:D.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),W.error(k.message)})},T=()=>{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),W.error(k.message)})};S.useEffect(()=>{T()},[]);const x=()=>{l(!1);const k=m.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:k}}).then(()=>{l(!1),w(),W.success(e("common.removeSuccess")),p(null)}).catch(_=>{l(!1),W.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(Ve,{})});if(!c)return null;const I=t.jsxs(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ce,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(he,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[I,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(ce,{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(ce,{to:`view/${_.id}`,children:t.jsx(Vt,{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":js(k)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const _=c[k];return _.status!==ie.PROJECT.RELEASE_STATUS.published?"":t.jsx(nn,{value:Number(_.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var j;const _=c[k];let N="",U="";const y=_.status==="published";if(y){const P=ae(v,`/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),E=new URL(v);E.pathname=ae(E.pathname,"/launch-blocklet/agreement"),E.searchParams.set("blocklet_meta_url",P),N=E.href,U=ae(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const C=(j=h.blockletComponents)!=null&&j.some(P=>P.included)||_.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[y&&C==="pack"&&t.jsx(pe,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:N,target:"_blank",rel:"noreferrer",children:t.jsx(un,{sx:{fontSize:18}})})})}),y&&t.jsx(pe,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:U,children:t.jsx(ks,{sx:{fontSize:18}})})})}),t.jsx(pe,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{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:[I,t.jsx(ce,{to:"new-release/none",children:t.jsxs(ot,{variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Pt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:L,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),m&&t.jsx($t,{title:e(`${e("common.delete")} ${m.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:x,onCancel:()=>p(null)})]})}const Ys=de(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 Ft={},Zs=be;Object.defineProperty(Ft,"__esModule",{value:!0});var pn=Ft.default=void 0,Ks=Zs(ge()),er=t;pn=Ft.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 De({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})]})}De.propTypes={children:d.node.isRequired,Icon:d.elementType};De.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",m=S.useMemo(()=>{const I=e.reduce((L,D)=>(L[D.did]=D.included,L),{});return(o.children||[]).filter(L=>g?l[L.meta.did]||I[L.meta.did]:!0)},[o.children,e,l,g]),p=S.useMemo(()=>m.map(I=>e.find(D=>D.did===I.meta.did)||{did:I.meta.did}),[m,e]),v=p.reduce((I,L)=>(I[L.did]=At(L,["required","included"]),I),{}),w=I=>{const L=p.map(D=>{if(D.did===I){const k=!D.included;return{...D,included:k,required:k}}return D});n(L)},T=I=>{const L=p.map(D=>D.did===I?{...D,required:!D.required}:D);n(L)},x=I=>{r(I.target.checked?"resource":"")},b=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:I=>{var k;const L=m[I],D=(k=v[L.meta.did])==null?void 0:k.included;return t.jsxs(u,{display:"flex",alignItems:"center",children:[t.jsx(Nt,{size:24,blocklet:L,ancestors:[o]}),t.jsx(u,{ml:"4px",className:Et("text",{excluded:!D}),children:t.jsx(u,{children:L.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:I=>{var _;const L=m[I],D=l[L.meta.did],k=!!((_=v[L.meta.did])!=null&&_.included);return t.jsx(Ge,{size:"small",checked:D||k,onClick:()=>w(L.meta.did),disabled:g||D||s})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:I=>{var N,U;const L=m[I],D=l[L.meta.did],k=!!((N=v[L.meta.did])!=null&&N.included),_=!!((U=v[L.meta.did])!=null&&U.required);return t.jsx(Ge,{size:"small",checked:D||_&&k,onClick:()=>T(L.meta.did),disabled:g||D||s||!k})}}}];return t.jsx(tr,{children:m!=null&&m.length?t.jsxs(t.Fragment,{children:[t.jsxs(Fo,{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:x}),f("blocklet.publish.forceResourceBlocklet")]})]}),t.jsx(Pt,{className:"main-table",verticalKeyWidth:100,locale:h,data:m,columns:b,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):t.jsx(De,{Icon:Mt,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=de(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=de(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?fs(e)?t.jsx("img",{className:"resource-icon",src:e,alt:"icon"}):t.jsx(re,{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,v=[]){return v.push(p.id),p.children&&p.children.forEach(w=>l(w,v)),v}const i=p=>l(mt(o,p)),a=(p,v=[])=>{const w=mt(o,p);return w.parent?(v.push(w.parent),a(w.parent,v)):v};function c(p,v){const w=i(p.id),T=w.indexOf(p.id);return w.splice(T,1),w.every(x=>s.concat(v).includes(x))}const f=(p,v)=>{p.stopPropagation();const w=i(v),T=a(v);if(s.includes(v)){const x=s.filter(b=>!w.concat(T).includes(b));n(x)}else{const x=w;for(let b=0;b<T.length;++b)c(mt(o,T[b]),x)&&x.push(T[b]);n([...s].concat(x))}},h=p=>{p.stopPropagation()},g=o.some(p=>{var v;return((v=p.children)==null?void 0:v.length)>0}),m=p=>{var b;const v=s.indexOf(p.id)!==-1,w=Array.isArray(p.children),T=i(p.id),x=w&&!v&&s.some(I=>T.includes(I));return t.jsx(Cs,{nodeId:p.id,label:t.jsx(Xe,{onClick:h,control:t.jsx(Ge,{size:"small",checked:v,indeterminate:x,tabIndex:-1,disableRipple:!0,onClick:I=>f(I,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(ps,{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(m):null},p.id)};return t.jsx(sr,{className:Et(!g&&"no-children"),multiSelect:!0,defaultCollapseIcon:t.jsx(us,{}),defaultExpandIcon:t.jsx(ws,{}),selected:s,children:o.map(p=>m(p))})}Jt.propTypes={data:d.array,value:d.array,onChange:d.func,disabled:d.bool};Jt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const sr=de(Ss)`
|
|
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(ae("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){W.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":hs()},timeout:60*1e3}),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:m,initUrl:p}){var U;const{t:v,locale:w}=Q(),{api:T}=xe(),[x,b]=Se({}),I=S.useRef({}),L=S.useRef(!1),D=r.id;I.current.projectId=n,I.current.releaseId=D;const k=(y,C,j)=>{if(!C)return;const P=ir(C,j);h==null||h({[y]:Object.keys(P)})},_=y=>{i.current[o.meta.did]={resources:y,component:o},m({[o.meta.did]:y}),k(o.meta.did,x[o.meta.did],y)};S.useEffect(()=>{x[o==null?void 0:o.meta.did]||Je.get(Ye(o,n,D,w,p)).then(y=>{var j;const C=Qe(((j=y.data)==null?void 0:j.resources)||[]);b({[o==null?void 0:o.meta.did]:C})}).catch(y=>{W.error(y.message)})},[o,n,r,w,p,b,x,D]),S.useEffect(()=>{D&&n&&!L.current&&nt(e.children.map(y=>async()=>{var C,j,P;if(!(c&&c!==y.meta.did)&&!(!(y!=null&&y.mountPoint)||!cs.hasStartEngine(y==null?void 0:y.meta)||!((j=(C=y==null?void 0:y.meta)==null?void 0:C.resource)!=null&&j.exportApi)))try{const E=await Je.get(Ye(y,n,D,w,p)),F=Qe(((P=E==null?void 0:E.data)==null?void 0:P.resources)||[]);b({[y==null?void 0:y.meta.did]:F});const O=await T.getSelectedResources({input:{did:e.meta.did,projectId:n,releaseId:D,componentDid:y.meta.did}}),R=(O==null?void 0:O.resources)||[];R!=null&&R.length&&(m({[y.meta.did]:or(F,R)}),k(y.meta.did,F,R),a||(i.current[y==null?void 0:y.meta.did]={resources:R,component:y}))}catch(E){W.error(E.message)}}),{concurrency:2}).then(()=>{L.current=!0})},[D,n,a,w,p,b]),S.useEffect(()=>{f&&Object.keys(f).length&&nt(e.children.map(async y=>{var j;const C=f[y.meta.did];if(C!=null&&C.length){const P=await Je.get(Ye(y,n,D,w,p)),E=Qe(((j=P==null?void 0:P.data)==null?void 0:j.resources)||[]);m({[y.meta.did]:C}),k(y.meta.did,E,C),a||(i.current[y==null?void 0:y.meta.did]={resources:C,component:y})}}))},[e,f,a]);let N=null;return(!o||!((U=x[o.meta.did])!=null&&U.length))&&(N=t.jsx(De,{Icon:Mt,children:v("blocklet.publish.resourceEmptyTip",{name:mo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(N=t.jsx(De,{children:v("blocklet.publish.componentNotRunning",{name:mo.getDisplayName(o)})})),t.jsxs(t.Fragment,{children:[t.jsx(lr,{className:Et(l&&"error"),children:t.jsx(u,{pb:2,width:"100%",children:N||t.jsx(Jt,{data:x[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=de(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=be;Object.defineProperty(Yt,"__esModule",{value:!0});var kt=Yt.default=void 0,ar=cr(ge()),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 Co="lastWantToConnectStoreId";function ur(e){var a,c;const[o,n]=S.useState(null),{session:r}=ct(),s=S.useCallback(f=>{n(f),localStorage.setItem(Co,f==null?void 0:f.id)},[n]),l=S.useMemo(()=>{var m,p,v,w;const f=localStorage.getItem(Co),h=f?(((m=e==null?void 0:e.settings)==null?void 0:m.storeList)||[]).find(T=>T.id===f):null;if(h)return h;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(T=>{var x;return!(T.id!==H.BLOCKLET_STORE.id||T.scope&&T.scope!=="studio"&&T.scope!==((x=r==null?void 0:r.user)==null?void 0:x.did))});return g||(g=(w=(v=e==null?void 0:e.settings)==null?void 0:v.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 j,P,E;const{t:a}=Q(),{session:c}=ct(),{api:f,info:h,inService:g}=xe(),m=Te(),[p,v]=S.useState(!1),w=S.useRef(null),[T,x]=S.useState(!1),[b,I]=S.useState(null),L=F=>{n(F),v(!1)},D=()=>{v(!p)},k=F=>{w.current&&w.current.contains(F.target)||v(!1)},_=()=>{x(!0)},N=()=>{x(!1)},U=async()=>{var F;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((F=m==null?void 0:m.actions)==null?void 0:F.refreshBlocklet())}catch(O){W.error(`Remove Blocklet Store Error: ${Ie(O)}`)}finally{I(null)}},{storeList:y}=hn({fromBlocklet:g,blocklet:e,nodeInfo:h,componentDid:i,userDid:(j=c==null?void 0:c.user)==null?void 0:j.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:D,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:F})=>t.jsx(Go,{...F,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:[y==null?void 0:y.map(O=>{var R;return t.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>L(O),children:[t.jsxs(u,{children:[t.jsx(he,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),t.jsx(he,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Rs({store:O,userDid:(R=c==null?void 0:c.user)==null?void 0:R.did})&&t.jsx(ne,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),I(O)},children:t.jsx(re,{icon:"ic:outline-delete"})})]},O.url)}),t.jsx(Jn,{}),t.jsxs(fe,{onClick:_,children:[t.jsx(qt,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),T&&t.jsx(rn,{hiddenChildren:!0,open:!0,onClose:N,teamDid:C,storeList:y,scope:"studio",onAdd:(E=m==null?void 0:m.actions)==null?void 0:E.refreshBlocklet}),b&&t.jsx($t,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:U,onCancel:()=>I(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 me=S;const Ae=/^[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(Ae))&&(o&&e.prefix===""||e.prefix.match(Ae))&&e.name.match(Ae)):!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 So(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=So(r[a]||s[a],l)}return i(o),n.forEach(i),So(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(Ae)||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(Ae)||typeof i!="string"||!n[i]&&!r[i]||!xt(l,yt))return null}return o}const Ro=Object.create(null);function jr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function we(e,o){const n=Ro[e]||(Ro[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 Me=!1;function gn(e){return typeof e=="boolean"&&(Me=e),Me}function yr(e){const o=typeof e=="string"?at(e,!0,Me):e;if(o){const n=we(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,Me);if(!n)return!1;const r=we(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||""),Me&&!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=we(o,n);return!!eo(r,e)}const jn=Object.freeze({width:null,height:null}),kn=Object.freeze({...jn,...st}),Cr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Sr=/^-?[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(Cr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=Sr.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 Rr=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(v=>{const w=[],T=v.hFlip,x=v.vFlip;let b=v.rotate;T?x?b+=2:(w.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),w.push("scale(-1 1)"),s.top=s.left=0):x&&(w.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),w.push("scale(1 -1)"),s.top=s.left=0);let I;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:I=s.height/2+s.top,w.unshift("rotate(90 "+I.toString()+" "+I.toString()+")");break;case 2:w.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:I=s.width/2+s.left,w.unshift("rotate(-90 "+I.toString()+" "+I.toString()+")");break}b%2===1&&(s.left!==s.top&&(I=s.left,s.left=s.top,s.top=I),s.width!==s.height&&(I=s.width,s.width=s.height,s.height=I)),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 m={},p=(v,w)=>{Rr(w)||(m[v]=w.toString())};return p("width",h),p("height",g),m.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:m,body:l}}const Dr=/\sid="(\S+)"/g,Tr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let _r=0;function Pr(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+(_r++).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 Ar(e){return e===404}const Er=(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 Mr(e){if(typeof e=="string"){const o=no(e);if(o)return o.path}return"/"}const Or=(e,o,n)=>{if(!Do){n("abort",424);return}let r=Mr(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(Ar(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)})},zr={prepare:Er,send:Or};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]=we(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 Vr(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 Wr=0;function Ur(e,o,n){const r=Wr++,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 Fr(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,m=[],p=[];typeof r=="function"&&p.push(r);function v(){g&&(clearTimeout(g),g=null)}function w(){c==="pending"&&(c="aborted"),v(),m.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),m=[]}function T(k,_){_&&(p=[]),typeof k=="function"&&p.push(k)}function x(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:m.length,subscribe:T,abort:w}}function b(){c="failed",p.forEach(k=>{k(void 0,h)})}function I(){m.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),m=[]}function L(k,_,N){const U=_!=="success";switch(m=m.filter(y=>y!==k),c){case"pending":break;case"failed":if(U||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){h=N,b();return}if(U){h=N,m.length||(i.length?D():b());return}if(v(),I(),!e.random){const y=e.resources.indexOf(k.resource);y!==-1&&y!==e.index&&(e.index=y)}c="completed",p.forEach(y=>{y(N)})}function D(){if(c!=="pending")return;v();const k=i.shift();if(k===void 0){if(m.length){g=setTimeout(()=>{v(),c==="pending"&&(I(),b())},e.timeout);return}b();return}const _={status:"pending",resource:k,callback:(N,U)=>{L(_,N,U)}};m.push(_),f++,g=setTimeout(D,e.rotate),n(k,o,_.callback)}return setTimeout(D),x}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,m)=>{r(),f&&f(g,m)});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 _o="iconify2",Oe="iconify",wn=Oe+"-count",Po=Oe+"-version",Cn=36e5,Qr=168;function Ct(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 St(e,o){return so(e,wn,o.toString())}function Rt(e){return parseInt(Ct(e,wn))||0}const dt={local:!0,session:!0},Sn={local:new Set,session:new Set};let ro=!1;function Yr(e){ro=e}let He=typeof window>"u"?{}:window;function Rn(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=Rn(e);if(!n)return;const r=Ct(n,Po);if(r!==_o){if(r){const a=Rt(n);for(let c=0;c<a;c++)Lo(n,Oe+c.toString())}so(n,Po,_o),St(n,0);return}const s=Math.floor(Date.now()/Cn)-Qr,l=a=>{const c=Oe+a.toString(),f=Ct(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=Rt(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,St(n,i)):Sn[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=we(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=Rn(r)))return;const l=Sn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=Rt(s),!St(s,i+1))return;const a={cached:Math.floor(Date.now()/Cn),provider:e.provider,data:o};return so(s,Oe+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,Vr(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=Fr(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(we(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,m=we(f,h),p=m.pendingIcons||(m.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?Ur(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 Ee;function ui(){try{Ee=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ee=null}}function pi(e){return Ee===void 0&&ui(),Ee?Ee.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"},_n={backgroundColor:"transparent"},$o={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},No={WebkitMask:It,mask:It,background:_n};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 Ao(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 x in o){const b=o[x];if(b!==void 0)switch(x){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":l[x]=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[x]=ii(b):typeof b=="number"&&(l[x]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[x]===void 0&&(f[x]=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 x=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:pi(Pr(h.body,b?()=>b+"ID"+x++:"iconifyReact"))},me.createElement("svg",f)}const{body:m,width:p,height:v}=e,w=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),T=li(m,{...g,width:p+"",height:v+""});return f.style={...a,"--svg":di(T),width:Ao(g.width),height:Ao(g.height),...hi,...w?It:_n,...c},me.createElement("span",f)};gn(!0);Lr("",zr);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 Pn extends me.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:me.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=me.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return me.createElement(Pn,r)});me.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return me.createElement(Pn,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]=S.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(_t,{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(ne,{onClick:()=>l(""),children:t.jsx(ms,{})})}):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 Eo=S.lazy(()=>tn(()=>import("./index-_suzTPHn.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).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:m}){const{t:p,locale:v}=Q(),{api:w}=xe(),T=Dt(),x=S.useRef(null),b=S.useRef(null),[I,L]=ur(r),[D,k]=S.useState(!1),_=Is({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),N=async R=>{const q=setTimeout(()=>{c(!1)},2e4),z=await fr(w,R);c(!1),clearTimeout(q),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),T(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${z}/create`),{replace:!0})},U=()=>{if(!s.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const R=pr();_(async(q,z)=>{var G,X,K;try{const J=await w.connectByStudio({input:{did:(G=r==null?void 0:r.meta)==null?void 0:G.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((X=s==null?void 0:s.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:m,messageId:R,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){W.error("failed to connect to store");return}z(J.url),N({did:(K=r==null?void 0:r.meta)==null?void 0:K.did,projectId:"",messageId:R})}catch(J){const se=Ie(J);W.error(se),c(!1)}})},y=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,C=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,j=s!=null&&s.blockletLogo?`${y}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,P=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(R=>`${C}/${R}`),E=()=>o?!1:!e||e===H.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=R=>{if(!R.destination)return;const q=Array.from(s.blockletScreenshots),[z]=q.splice(R.source.index,1);q.splice(R.destination.index,0,z),l(G=>({...G,blockletScreenshots:q}))},O=R=>{if(!R.destination)return;const q=Array.from(s.blockletVideos),[z]=q.splice(R.source.index,1);q.splice(R.destination.index,0,z),l(G=>({...G,blockletVideos:q}))};return t.jsxs(ki,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Z,{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:R=>{a({blockletTitle:""}),l({blockletTitle:R.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),t.jsx(Z,{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:I,componentDid:m,onChangeStore:L,disabled:!s.blockletTitle||o||n,loading:n,onClick:U})})},error:!!i.projectId,helperText:i.projectId||"",value:e===H.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Z,{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:R=>{a({blockletDescription:""}),l({blockletDescription:R.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}}),t.jsx(Z,{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:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),l({blockletHomepage:R.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3}}),t.jsx(Z,{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:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),l({blockletCommunity:R.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3}}),t.jsx(Z,{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:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(R.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),l({blockletSupport:R.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3}}),t.jsx(Z,{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:R=>{R.target.value&&!/^(git|https|svn)/.test(R.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),l({blockletRepository:R.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(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(ye,{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(Wo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||j,onClick:()=>{var R;E()&&((R=x.current)==null||R.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(ye,{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:F,children:t.jsx(jo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:R.innerRef,...R.droppableProps,children:[P.map((z,G)=>t.jsx(ko,{draggableId:z,index:G,isDragDisabled:o,children:(X,K)=>t.jsxs(u,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:K.isDragging?"scale(1.05)":"none",boxShadow:K.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:z}),!o&&t.jsx(ne,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletScreenshots];return se.splice(G,1),{...J,blockletScreenshots:se}})},children:t.jsx(yo,{})})]})},z)),R.placeholder,P.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 z;E()&&((z=b.current)==null||z.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(ye,{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:O,children:t.jsx(jo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:R.innerRef,...R.droppableProps,children:[s.blockletVideos.map((z,G)=>t.jsx(ko,{draggableId:z,index:G,isDragDisabled:o,children:(X,K)=>t.jsxs(u,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:K.isDragging?"scale(1.05)":"none",boxShadow:K.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:z,style:{pointerEvents:K.isDragging?"none":"auto"}}),!o&&t.jsx(ne,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletVideos];return se.splice(G,1),{...J,blockletVideos:se}})},children:t.jsx(yo,{})})]})},z)),R.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:()=>{E()&&k(!0)},children:"+"})]})})})]})]})}),t.jsxs(S.Suspense,{fallback:t.jsx(Ve,{}),children:[t.jsx(Eo,{ref:x,locale:v,popup:!0,onUploadFinish:R=>{var q;l({blockletLogo:R.data.filename}),g(""),(q=x.current)==null||q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:y,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"),D&&t.jsx(Ln,{onClose:()=>k(!1),params:s,setParams:l}),t.jsx(Eo,{ref:b,popup:!0,onUploadFinish:R=>{var q;l(z=>{var X;const G=z.blockletScreenshots||[];return G.push((X=R.data)==null?void 0:X.filename),{...z,blockletScreenshots:G}}),(q=b.current)==null||q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:C,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-P.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=de.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=be;Object.defineProperty(io,"__esModule",{value:!0});var $n=io.default=void 0,vi=yi(ge()),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 Ci=(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},Si=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*Ri(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 Si(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(ae(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(m=>`${m} ${btoa(i[m])}`).join(",")}})).headers.location,f=2*1024*1024;let h=0,g="";for(const m of Ri(s,f)){const p=await bo.patch(ae(H.WELLKNOWN_SERVICE_PATH_PREFIX,c),m,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":h,"Content-Type":"application/offset+octet-stream"}});h+=m.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===ie.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:m}){var I,L;const{t:p}=Q(),{actions:{refreshBlocklet:v}}=Te(),{session:w}=ct(),{storeList:T}=hn({fromBlocklet:!0,blocklet:e,componentDid:f,userDid:(I=w==null?void 0:w.user)==null?void 0:I.did}),x=S.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((D,k)=>(D[k.storeId]=k,D),{}):{},[n]),b=(L=e==null?void 0:e.meta)==null?void 0:L.did;return t.jsxs(t.Fragment,{children:[g==="connect"&&!!(T!=null&&T.length)&&t.jsx(Fo,{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:T==null?void 0:T.map(D=>t.jsx(Kn,{"data-cy":"store-switch",children:t.jsx(es,{children:t.jsx(Ds,{behavior:g,onSelectConnectStore:m,releaseId:o,projectId:r,releaseType:s,kind:"publish",teamDid:b,store:D,published:(l==null?void 0:l.indexOf(D.id))>-1,connectedStore:x[D.id],onPublish:i,onDelete:a,scope:D.scope||"studio",onOpenConnectStore:h})})},D.url))}),t.jsx(rn,{teamDid:b,storeList:T,scope:"studio",onAdd:v})]})}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 An({did:e,params:o,setParams:n,projectId:r,open:s,onClose:l}){const{t:i}=Q(),[a,c]=S.useState(!1),{api:f}=xe(),[h,g]=S.useState(!1),[m,p]=S.useState(!1),v=()=>{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:!!m}}),n({autoUpload:h,possibleSameStore:m}),l(!1)}catch(x){W.error(x.message)}c(!1)};S.useEffect(()=>{g(o.autoUpload),p(o.possibleSameStore)},[o]);const T=!!(r&&r!==H.UNOWNED_DID);return t.jsx(Lt,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:s,onClose:v,actions:t.jsxs(t.Fragment,{children:[t.jsx(Y,{onClick:x=>{x.stopPropagation(),l()},color:"inherit",children:i("common.cancel")}),T&&t.jsxs(Y,{onClick:x=>{x.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:T?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:re,icon:"ph:upload",sx:{fontSize:24,mr:2}}),t.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),t.jsx(ve,{checked:h,onChange:(x,b)=>g(b)})]}),t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:re,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(ve,{checked:m,onChange:(x,b)=>p(b)})]})]}):t.jsxs(u,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[t.jsx(u,{component:re,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),t.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}An.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 En({downloadUrl:e,installUrl:o,handleSetTip:n,isPack:r,disabled:s}){const{t:l}=Q(),[i,a]=S.useState(!1),c=S.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:re,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(fe,{sx:{color:"#333"},children:[t.jsx(u,{component:re,sx:{mr:1},icon:"ic:round-install-desktop"}),t.jsx(A,{variant:"inherit",children:l("blocklet.publish.installToThisServer")})]})}),t.jsxs(fe,{onClick:n,children:[t.jsx(u,{component:re,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(fe,{sx:{color:"#333"},children:[t.jsx(u,{component:re,sx:{mr:1},icon:"ph:download"}),t.jsx(A,{variant:"inherit",children:l("common.download")})]})})]})})})})})]})}En.propTypes={disabled:d.bool.isRequired,isPack:d.bool.isRequired,downloadUrl:d.string.isRequired,installUrl:d.string.isRequired,handleSetTip:d.func.isRequired};var Vo;const Mo=(Vo=window.env)==null?void 0:Vo.serverEndpoint;function Mn({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:m,paramsErrTip:p,componentDid:v,resourceRelateComponents:w,disabledSelectComponents:T,saveSelectedEventsRef:x,hasSelectedResources:b,initLogoUrl:I,setLoading:L,releaseUsedLast:D,setReleaseUsedLast:k,projectType:_}){var Ce;const{t:N,locale:U}=Q(),{api:y}=xe(),C=Dt(),[j,P]=S.useState(!1),[E,F]=S.useState(!1),[O,R]=S.useState(),q=ze(ee=>ee.breakpoints.down("md")),z=S.useMemo(()=>{var ee;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((ee=o==null?void 0:o.blockletComponents)==null?void 0:ee.length)>0?(o==null?void 0:o.blockletComponents.find(B=>B.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),G=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),m()},X=async ee=>{var Le,Fe,qe,$e;if(p!=null&&p.blockletHomepage||p!=null&&p.blockletSupport||p!=null&&p.blockletCommunity){W.error((p==null?void 0:p.blockletHomepage)||(p==null?void 0:p.blockletSupport)||(p==null?void 0:p.blockletCommunity));return}const ue=Nn({params:o,hasSelectedResources:b,projectId:e,status:ee,t:N});if(ue){W.error(ue.map(V=>V.message).join("; ")),n(ue.reduce((V,te)=>({...V,[te.param]:te.message}),{}));return}const B={...o};if(B.blockletComponents=Ci(B.blockletComponents,a,w,T),B.blockletVersion=Re.valid(B.blockletVersion),!B.blockletVersion){W.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(I)try{const V=await Ii({did:a.meta.did,projectId:e,imageUrl:I});B.blockletLogo=V,s({blockletLogo:V})}catch(V){W.error(V.message);return}if(o.resourceFromSelect){B.uploadedResource="";try{const V=Object.keys(x.current);await nt(V.map(te=>()=>{const le=x.current[te];return rr({api:y,locale:U,projectId:e,releaseId:D?"":h,appDid:a.meta.did,component:le.component,resources:le.resources,initUrl:r})}),{concurrency:2})}catch(V){W.error(((qe=(Fe=(Le=V==null?void 0:V.response)==null?void 0:Le.data)==null?void 0:Fe.error)==null?void 0:qe.message)||V.message),n({blockletResource:"Invalid save the resource"});return}}else($e=o.blockletDocker)!=null&&$e.dockerImage||(B.blockletComponents=[]);B.blockletTitle=(B.blockletTitle||"").trim(),B.blockletDescription=(B.blockletDescription||"").trim(),B.blockletSupport=(B.blockletSupport||"").trim(),B.blockletHomepage=(B.blockletHomepage||"").trim(),B.blockletCommunity=(B.blockletCommunity||"").trim(),B.blockletRepository=(B.blockletRepository||"").trim(),B.blockletIntroduction=(B.blockletIntroduction||"").trim(),B.note=(B.note||"").trim(),B.blockletComponents=((B==null?void 0:B.blockletComponents)||[]).filter(V=>V.included).map(V=>At(V,["did","required"])).map(JSON.stringify),B.contentType!=="docker"&&(B.blockletDocker={dockerImage:"",dockerArgs:[],dockerEnvs:[]});try{await y.createRelease({input:{...B,did:a.meta.did,projectId:e,releaseId:D?"":h,status:ee}}),ee==="draft"?W.success(N("blocklet.publish.saveDraftSuccess")):(k(!1),W.success(N("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(V){const te=Ie(V);W.error(te),(/resource/.test(te)||/zip/.test(te))&&n({blockletResource:te});return}const Ue=await y.getProject({input:{did:a.meta.did,projectId:e}}),Pe=Ue.project.lastReleaseId;o.autoUpload&&await nt(Ue.project.connectedStores.map(V=>async()=>{try{const te=await y.publishToStore({input:{did:a.meta.did,storeId:V.storeId,storeName:V.storeName,projectId:e,releaseId:Pe,type:z}});W.success(t.jsx(Ts,{storeName:V.storeName,storeUrl:V.storeUrl,developerDid:V.developerDid,published:te.url==="published"}),{duration:1e4})}catch(te){W.error(Ie(te))}}),{concurrency:4}),G==null||G(),C(`../${e}/view/${Pe}`,{replace:!0})},K=ee=>(L(!0),X(ee).finally(()=>{L(!1)})),J=async ee=>{await hr(y,ee),g()},se=()=>{F(!0)},We=ae(Mo,`/api/project/${a.meta.did}/${e}/${h}/release/blocklet.json`),je=new URL(Mo);je.pathname=ae(je.pathname,"/launch-blocklet/agreement"),je.searchParams.set("blocklet_meta_url",We);const oe=je.href,_e=()=>R(We);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(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ce,{to:"../",children:N("common.blockletStudio")}),e===H.UNOWNED_DID?t.jsx(A,{color:"text.primary",children:t.jsx(he,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):t.jsx(ce,{to:`../${e}`,children:t.jsx(he,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),t.jsx(A,{color:"text.primary",children:l==="create"?N("common.create"):(o==null?void 0:o.blockletVersion)||N("common.edit")})]}),t.jsx(u,{flex:"1"}),!f&&t.jsxs(jt,{disabled:i,variant:"contained",children:[t.jsxs(Y,{variant:"contained",onClick:()=>K(ie.PROJECT.RELEASE_STATUS.published),children:[i&&t.jsx(et,{size:14,sx:{mr:.5},color:"inherit"}),N("blocklet.publish.createRelease")]}),t.jsx(Y,{variant:"contained",onClick:se,children:t.jsx(re,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(_t,{fullWidth:!0,maxWidth:"sm",open:O,onClose:()=>R(""),children:t.jsxs(u,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(A,{variant:"h6",sx:{mb:2},children:N("blocklet.publish.installResourceTip")}),t.jsx($s,{children:O}),t.jsxs(A,{sx:{mt:2},children:[N("blocklet.publish.installResourceTip2"),t.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:N("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}}),N(q?"common.upload":"blocklet.publish.connectOrUpload")]}),t.jsx(En,{isPack:z==="pack",downloadUrl:ae(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${h}/download/${(c.files||[])[0]}`),installUrl:oe,handleSetTip:_e}),t.jsx(Y,{onClick:se,children:t.jsx(re,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),t.jsx(Lt,{title:N("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:j,onClose:()=>P(!1),children:t.jsx(lo,{projectType:_,blocklet:a,releaseType:z,projectId:e,releaseId:h,componentDid:v,onPublish:G,onOpenConnectStore:J,onDelete:g,connectedStores:o.connectedStores||[],publishedStoreIds:c==null?void 0:c.publishedStoreIds})}),t.jsx(An,{did:(Ce=a==null?void 0:a.meta)==null?void 0:Ce.did,params:o,projectId:e,open:E,setParams:s,onClose:()=>F(!1)})]})}Mn.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=de.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 On({text:e}){return e?t.jsx(As,{wrapperElement:{"data-color-mode":"light"},source:bs.sanitize(e),rehypePlugins:[[Es,{target:"_blank"}]]}):t.jsx(De,{Icon:Mt})}On.propTypes={text:d.string.isRequired};function zn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var h;const{t:i}=Q(),[a,c]=S.useState(l?"preview":"write"),f=(g,m)=>{c(m)};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(Z,{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," / ",ie.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,ie.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(On,{text:e.blockletIntroduction||""})})]})}zn.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={},_i=be;Object.defineProperty(co,"__esModule",{value:!0});var Bn=co.default=void 0,Pi=_i(ge()),Oo=t;Bn=co.default=(0,Pi.default)([(0,Oo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Oo.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(Ms,{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 Vn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:f}=Q(),h=()=>{n(v=>v+1)},g=()=>{n(v=>v-1)},m=v=>v===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):v===2?(i==null?void 0:i.blockletResource)||(i==null?void 0:i.blockletDocker)||(i==null?void 0:i.dockerImageName):v>=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((v,w)=>{const T={},x=l||!Di({hasSelectedResources:r,params:s,projectId:c,step:w,t:f}),b=l?"":m(w);return b&&(T.optional=t.jsx(A,{variant:"caption",color:"error",children:b}),T.error=!0),t.jsxs(os,{children:[t.jsx(ns,{icon:t.jsx(ao,{error:b,active:p?99:o,step:w,ok:x}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...T,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:b||!x&&o>w?"error.main":"inherit",children:v.label})}),t.jsxs(ss,{children:[t.jsx(A,{fontSize:12,children:v.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||!x,children:f("common.continue")}),w>0&&t.jsx(Y,{disabled:w===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},v.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"})})]})}Vn.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=S.lazy(()=>tn(()=>import("./index-_suzTPHn.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function uo({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a,locale:c}=Q(),f=S.useRef(null),h=()=>n?!1:!o||o===H.UNOWNED_DID?(W.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,g=`${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(ye,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(A,{component:"a",href:`${g}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Y,{variant:"outlined",size:"small",onClick:()=>{var m;h()&&((m=f.current)==null||m.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(S.Suspense,{fallback:t.jsx(Ve,{}),children:t.jsx($i,{ref:f,locale:c,popup:!0,onUploadFinish:m=>{var p;s({uploadedResource:m.data.filename}),l({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,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(Z,{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(Z,{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," / ",ie.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,ie.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 Wn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Wn(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]=S.useState(!1),h=()=>{var y;(y=n[s])==null||y.splice(e,1),r({...n,[s]:[...n[s]]})},g=(y,C)=>{var j;(j=n[s])!=null&&j[e]&&(C?(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]]})},m=(y,C)=>{var P;const j=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],secure:C,value:C&&j===ie.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[s]:[...n[s]]})},p=(y,C)=>{n[s][e]={...n[s][e],shared:C},r({...n,[s]:[...n[s]]})},v=(y,C)=>{var P;const j=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],required:C,value:C&&j===ie.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[s]:[...n[s]]})},w=(y,C)=>{n[s][e]={...n[s][e],value:C?ie.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},T=y=>{n[s][e]={...n[s][e],description:y.target.value},r({...n,[s]:[...n[s]]})},x=y=>{const C=y.target.value==="web"?"web":"docker";C==="web"&&n.dockerArgs.forEach(E=>{E.type="docker"});const P=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:C,path:C==="docker"?P:"/",protocol:"http",prefix:C==="docker"?P:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},b=y=>{const C=y.target.value;n[s][e]={...n[s][e],prefix:C,path:C==="*"?"/":C},r({...n,[s]:[...n[s]]})},I=y=>{var C;(C=n[s])!=null&&C[e]&&(n[s][e].value=y.target.value),r({...n,[s]:[...n[s]]})},L=a===`$${ht(o.key)}`||o.custom,D=s==="dockerArgs"&&!ln[o.key],k=_s[o.key],_=s==="dockerEnvs",N=o.key==="--publish";let U=o.key;return N&&o.type==="web"?U="--publish (Web)":_&&(U=`--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:U})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Z,{disabled:i||L||D||o.value===ie.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${ht(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Be,{position:"end",sx:{zoom:.9},children:[(!(k||D)||_||N)&&t.jsx(ne,{onClick:()=>f(!0),children:t.jsx(re,{icon:"icon-park-outline:setting-config"})}),!i&&t.jsx(ne,{onClick:h,color:D?"error":"default",children:t.jsx(re,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&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"&&Ps[o.key](a)&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Lt,{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||D||_?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(ve,{disabled:i,checked:L,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.shared")}),t.jsx(ve,{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(ve,{disabled:i,checked:o.required,onChange:v,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(ve,{disabled:i,checked:o.secure,onChange:m,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.autoGenerated")}),t.jsx(ve,{disabled:i,checked:o.value===ie.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:w,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(Z,{disabled:i,value:o.description,onChange:T,sx:{flex:1},label:l("blocklet.publish.docker.description")})]}),N&&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:x,children:[t.jsx(fe,{value:"docker",children:"Docker"}),t.jsx(fe,{value:"web",children:"Web"})]})]}),N&&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(Z,{disabled:i,value:o.prefix,onChange:b,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]=S.useState("dockerParams"),[f,h]=S.useState(""),[g,m]=S.useState(!1),[p,v]=S.useState("--volume"),[w,T]=S.useState(""),[x,b]=S.useState(vo(f)),I=x.dockerArgs||[],L=x.dockerEnvs||[],D=x.dockerImage||"",k=C=>{const{value:j}=C.target;h(j)};S.useEffect(()=>{s.blockletDocker&&s.blockletDocker.dockerImage&&!D&&b(s.blockletDocker)},[s,D,b]);const _=C=>{const j=vo(C.target.value);b(P=>{let E,F=!1;return j.dockerArgs.forEach(O=>{const R=P.dockerArgs.find(q=>q.key===O.key);R&&(Object.entries(R).forEach(([q,z])=>{z!=null&&q!=="value"&&(O[q]=z)}),O.type==="web"&&(O.path="/",O.protocol="http",O.prefix="/",O.name="publicUrl",O.port="BLOCKLET_PORT",F=!0),!E&&O.key==="--publish"&&(E=O))}),!F&&E&&(E.type="web",E.path="/",E.protocol="http",E.prefix="/",E.name="publicUrl",E.port="BLOCKLET_PORT"),j.dockerEnvs.forEach(O=>{const R=P.dockerEnvs.find(q=>q.key===O.key);R&&Object.entries(R).forEach(([q,z])=>{z!=null&&q!=="value"&&(O[q]=z)})}),j})},N=()=>{if(m(!1),p==="--env"){b({...x,dockerEnvs:[...L,{key:w,value:"",custom:"",secure:!1,shared:!1,required:!1,description:w}]}),T("");return}b({...x,dockerArgs:[...I,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},U=()=>{m(!1),T("")},y=C=>{const{value:j}=C.target;b({...x,dockerImage:j}),j.indexOf(" ")>-1?n({...o,dockerImageName:i("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})};return S.useEffect(()=>{a==="dockerCommand"&&h(Ls(x))},[x,a]),S.useEffect(()=>{l(C=>({...C,blockletDocker:{dockerImage:x.dockerImage,dockerArgs:x.dockerArgs,dockerEnvs:x.dockerEnvs}}))},[x,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,j)=>c(j),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(Z,{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(Z,{disabled:e,label:i("blocklet.publish.docker.dockerImageName"),placeholder:i("blocklet.publish.docker.dockerImageName"),value:D,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:y}),t.jsx(A,{variant:"caption",color:"text.secondary",children:"Example: docker.io/postgrest/postgrest:latest"}),t.jsx(u,{sx:{height:4}}),I.map((C,j)=>t.jsx(it,{index:j,item:C,dockerParams:x,setDockerParams:b,dataKey:"dockerArgs",t:i,readOnly:e},`${C.key}-${j}`)),L.map((C,j)=>t.jsx(it,{index:j,item:C,dockerParams:x,setDockerParams:b,dataKey:"dockerEnvs",t:i,readOnly:e},`${C.key}-${j}`)),!e&&t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{flex:1}}),t.jsx(Y,{onClick:()=>m(!0),children:i("blocklet.publish.docker.addItem")})]})]})]}),!!r&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:r}),g&&t.jsxs(_t,{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=>v(C.target.value),children:Object.keys(ln).map(C=>t.jsx(fe,{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(Z,{value:w,onChange:C=>T(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:U,children:i("common.cancel")}),t.jsx(Y,{onClick:N,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 Ai=({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(Nt,{size:24,blocklet:o,ancestors:n}),t.jsx(u,{ml:"4px",className:"text",children:t.jsx(u,{children:o.meta.title})})]},r),value:r})},zo=(e,o)=>{const n=At(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},Ei={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}=Te(),[c,f]=Se({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[h,g]=Se({}),[m,p]=S.useState(!1),[v,w]=Se(null),{api:T}=xe(),x=ze($=>$.breakpoints.down("md")),[b,I]=S.useState({}),[L,D]=S.useState(!1),k=S.useRef({}),[_,N]=Se({}),[U,y]=S.useState(""),[C,j]=Se({}),P=e==null?void 0:e.searchParams.get("dependentComponentsMode"),E=P==="readonly",F=S.useMemo(()=>{const $={};return Object.keys(C).forEach(M=>{const ke=C[M];ke&&ke.forEach(Fn=>{$[Fn]=!0})}),$},[C]),O=S.useCallback($=>{E&&f({blockletComponents:[]}),j($)},[E,j,f]),R=S.useCallback((...$)=>{N(...$),g({blockletResource:"",blockletDocker:""})},[]),q=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[z,G]=S.useState(r==="new-release"?4:0);S.useEffect(()=>{n&&g({projectId:""})},[n,g]);const X=S.useMemo(()=>{var $;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":($=c==null?void 0:c.blockletComponents)!=null&&$.some(M=>M.included)||Object.keys(F).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,F,c==null?void 0:c.blockletResourceType]),K=[],J=((a==null?void 0:a.children)||[]).filter($=>{var M;return(M=$.meta.resource)==null?void 0:M.exportApi}).filter($=>!l||$.meta.did===l);J.forEach($=>{Ai({tabs:K,blocklet:$,t:i,ancestors:[a]})});const[se,We]=S.useState((ho=K[0])==null?void 0:ho.value),je=!L&&(v==null?void 0:v.status)==="published",oe=je,_e=vs(()=>{if(!e)return;y(e.searchParams.get("logo")),f(M=>{var ke;return{...M,blockletTitle:(M==null?void 0:M.blockletTitle)||e.searchParams.get("title"),blockletDescription:(M==null?void 0:M.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(M==null?void 0:M.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(ke=M==null?void 0:M.blockletComponents)!=null&&ke.length?M==null?void 0:M.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(M==null?void 0:M.note)||e.searchParams.get("note")||"No note"}});const $=e.searchParams.get("resources");try{const M=JSON.parse($);I(M)}catch{}}),Ce=async()=>{if(q)try{const $=await T.getRelease({input:{did:a.meta.did,projectId:n,releaseId:q}});if(p(!1),!$.release){W.error("Release not found");return}$.release=Wn($.release),r!=="view"&&($.release.note=""),f(M=>zo({...M,...$.release,blockletVersion:r==="create"||r==="new-release"?Re.inc($.release.blockletVersion,"patch"):$.release.blockletVersion},a)),w($.release)}catch($){p(!1),W.error(Ie($))}},ee=async()=>{if(n===H.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){W.error(i("blocklet.publish.errorTip.noDid"));return}try{const M=(await T.getProject({input:{did:a.meta.did,projectId:n}})).project||{};M.blockletVersion?(r==="create"||r==="new-release")&&Re.valid(M.blockletVersion)&&(M.blockletVersion=Re.inc(M.blockletVersion,"patch")):M.blockletVersion="0.0.1";const ke=zo(M,a);f(ke),M.lastReleaseId||_e()}catch($){W.error(Ie($))}},ue=S.useCallback(async()=>{p(!0);try{if(r==="view"){if(!q){W.error("Empty release id");return}await ee(),await Ce();return}await ee(),q&&(D(!0),await Ce())}finally{p(!1)}},[r,q]),B=$=>{f({blockletComponents:$})},Ue=$=>{f({blockletResourceType:$})};S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{n===H.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&_e()},[n,e,r,_e]),S.useEffect(()=>{c.contentType==="docker"?f({resourceFromSelect:!1}):c.contentType==="blocklet"?f({resourceFromSelect:!0}):c.contentType==="upload"&&f({resourceFromSelect:!1})},[c.contentType,f]);const Pe=S.useMemo(()=>!!Object.keys(_).find($=>!!_[$].length),[_]);if(!c&&m)return t.jsx(Ve,{});if(!c)return null;const Le=J.find($=>$.meta.did===se),Fe=$=>{We($)},qe=e==null?void 0:e.searchParams.get("resourcesTitle"),$e=e==null?void 0:e.searchParams.get("componentsTitle"),V=[{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")}],te=V[z]||V[V.length-1],le=Ei[z];return t.jsxs(Mi,{...o,children:[t.jsx(Mn,{blocklet:a,release:v,getData:ue,getRelease:Ce,mode:r,params:c,setParams:f,setParamsErrTip:g,readOnly:oe,isPublished:je,loading:m,setLoading:p,initLogoUrl:U,releaseId:q,projectId:n,projectType:X,resourceComponents:J,resourceComponentsMap:C,resourceRelateComponents:F,resourceItem:Le,saveSelectedEventsRef:k,hasSelectedResources:Pe,releaseUsedLast:L,setReleaseUsedLast:D,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:x?"column":"row",children:[!x&&t.jsx(Vn,{steps:V,loading:m,viewMode:r==="view",params:c,hasSelectedResources:Pe||c.uploadedResource,paramsErrTip:h,activeStep:z,setActiveStep:G,projectId:n,resourcesUrlTitle:qe,componentsUrlTitle:$e}),t.jsxs(u,{flex:"1",maxWidth:"720px",children:[!x&&le!=="introduction"&&t.jsxs(A,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[te.label,le==="branding"&&t.jsx(pe,{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,{})})})]}),(x||le==="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:m,setLoading:p,paramsErrTip:h,readOnly:oe,initLogoUrl:U,setInitLogoUrl:y})}),x&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:m,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:oe})}),(x||le==="introduction")&&t.jsx(u,{display:"flex",flexDirection:"column",sx:{mt:x?5:0,width:"100%"},children:t.jsx(zn,{loading:m,readOnly:oe,params:c,setParams:f,paramsErrTip:h,setParamsErrTip:g})}),x&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:V[Bo.resources].label}),t.jsx(u,{display:x||le==="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:$=>f({contentType:$.target.value}),children:[t.jsx(Xe,{value:"blocklet",disabled:oe,control:t.jsx(ft,{size:"small",checked:c.contentType==="blocklet"}),label:i("blocklet.publish.resourceSelect")}),t.jsx(Xe,{value:"upload",disabled:oe,control:t.jsx(ft,{size:"small",checked:c.contentType==="upload"}),label:i("blocklet.publish.resourceUpload")}),t.jsx(Xe,{value:"docker",disabled:oe,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(xs,{tabs:K,current:se,onChange:Fe,sx:{ml:-2,mt:2,maxWidth:x?window.innerWidth-24:"100%"}}),t.jsx(Qt,{loading:m,initialResources:b,saveSelectedEventsRef:k,selectedResourceIds:_,setSelectedResourceIds:R,setResourceComponentsMap:O,error:h.blockletResource,app:a,readOnly:oe,component:Le,componentDid:l,initUrl:e,params:c,setParams:f,projectId:n===H.UNOWNED_DID?"":n,releaseUsedLast:L,release:{...v,id:q}})]}),c.contentType==="upload"&&t.jsx(uo,{app:a,readOnly:oe,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g}),c.contentType==="docker"&&t.jsx(po,{app:a,readOnly:oe,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g,paramsErrTip:h})]})})}),x&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:V[Bo.blocklets].label}),(x||le==="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:X,disabled:m||oe,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:B,onChangeBlockletResourceType:Ue,resourceRelateComponents:F,dependentComponentsMode:P})})})}),!x&&le==="version"&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:m,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:oe})})]})]})]})]})}fo.propTypes={initUrl:d.object};fo.defaultProps={initUrl:null};const Mi=de.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 Un({padding:e,initUrl:o}){const{blocklet:n}=Te(),r=Hn(),{componentDid:s}=lt();if(S.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(Oi,{style:l,children:t.jsxs(Gn,{children:[t.jsx(pt,{path:"/",element:t.jsx(Wt,{initUrl:o})}),t.jsx(pt,{path:"/:projectId",element:t.jsx(Qs,{})}),t.jsx(pt,{path:"/:projectId/:mode/:releaseId",element:t.jsx(fo,{initUrl:o})})]})})}Un.propTypes={padding:d.oneOfType([d.string,d.number]),initUrl:d.object};Un.defaultProps={padding:"",initUrl:null};const Oi=de(u)`
|
|
225
|
-
a {
|
|
226
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
227
|
-
}
|
|
228
|
-
`;export{Un as default};
|