@abtnode/blocklet-services 1.16.39-beta-20250213-085550-20ef6d4f → 1.16.39-beta-20250215-130252-43410928
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.js +4 -0
- package/api/libs/connect/session.js +5 -3
- package/api/services/did-space/index.js +15 -0
- package/api/validators/login.js +2 -2
- package/dist/assets/Add-TglZpKpw.js +1 -0
- package/dist/assets/ArrowDropDown-DCM27ed6.js +1 -0
- package/dist/assets/CheckCircle-CH8SYy4d.js +1 -0
- package/dist/assets/ChevronLeft-B7m8AFzR.js +1 -0
- package/dist/assets/ChevronRight-DeRklga5.js +1 -0
- package/dist/assets/DeleteOutline-DZA1YKE4.js +1 -0
- package/dist/assets/Done-CVdTMvGH.js +1 -0
- package/dist/assets/Download-DECMRaRC.js +1 -0
- package/dist/assets/Error-B61ZB0Rr.js +1 -0
- package/dist/assets/{Google-CSRPwRzS.js → Google-D_UbrpMW.js} +1 -1
- package/dist/assets/InfoOutlined-QBw5AmWP.js +1 -0
- package/dist/assets/Launch-Cpp3LVnV.js +1 -0
- package/dist/assets/LaunchOutlined-WdAKKV2H.js +1 -0
- package/dist/assets/Loop-CbPhaPlF.js +1 -0
- package/dist/assets/MoreHoriz-BsTY94ce.js +1 -0
- package/dist/assets/PlayArrow-BgVzxA9Q.js +1 -0
- package/dist/assets/ViewList-DBUe2NSG.js +1 -0
- package/dist/assets/{access-control-DdkKjkTj.js → access-control-DeqFMOm5.js} +1 -1
- package/dist/assets/{actions-DDpgZ17S.js → actions-DP_Rm54e.js} +1 -1
- package/dist/assets/{add-component-core-CF05FURP.js → add-component-core-BnP0_g-C.js} +17 -17
- package/dist/assets/{add-resource-u9CnYHQ7.js → add-resource-B26HHRU4.js} +1 -1
- package/dist/assets/{addon-BCk9L1CD.js → addon-DH34oI6i.js} +1 -1
- package/dist/assets/{analytics-sm8oL_To.js → analytics-DPn53GmC.js} +1 -1
- package/dist/assets/audit-logs-C1oUmr2S.js +35 -0
- package/dist/assets/{base32-LsxuOFGQ.js → base32-CwwDjweV.js} +1 -1
- package/dist/assets/branding-DFfBkuOI.js +40 -0
- package/dist/assets/bundle-avatar-Cv2R2iWI.js +1 -0
- package/dist/assets/button-4qfNeG4u.js +1 -0
- package/dist/assets/{click-to-copy-BLRxskBB.js → click-to-copy-886R1sA9.js} +1 -1
- package/dist/assets/{complete-DY43z8bC.js → complete-Cz6Vt9yr.js} +4 -4
- package/dist/assets/{component-C3wYVoFz.js → component-BOGOOyWw.js} +2 -2
- package/dist/assets/config-BBRmjpUL.js +1 -0
- package/dist/assets/{config--1vdfQxl.js → config-CE9eJ5Ce.js} +2 -2
- package/dist/assets/{config-navigation-xcMpeduS.js → config-navigation-ZGyHDU_V.js} +6 -6
- package/dist/assets/config-space-Bgt2MtPU.js +1 -0
- package/dist/assets/{confirm-DfsY08eB.js → confirm-f60NfF3X.js} +1 -1
- package/dist/assets/{connect-5VLKxKh7.js → connect-B2VVyCQY.js} +1 -1
- package/dist/assets/connect-D9S16wyT.js +1 -0
- package/dist/assets/{connect-to-B_2lM0_9.js → connect-to-BSmtnPV9.js} +1 -1
- package/dist/assets/{dashboard-DQnfagMU.js → dashboard-BoV1-CrH.js} +7 -7
- package/dist/assets/{did-address-CsW_VsB3.js → did-address-CgDvtQbT.js} +1 -1
- package/dist/assets/domain-DLGsAByD.js +9 -0
- package/dist/assets/domain-list-BLV11Y6_.js +15 -0
- package/dist/assets/{email-D3sOIREb.js → email-Fgr58FLV.js} +2 -2
- package/dist/assets/{exchange-passport-CS0Md1xZ.js → exchange-passport-CcsLEfpo.js} +1 -1
- package/dist/assets/form-text-input-CbMAGh7u.js +11 -0
- package/dist/assets/{fuel-CEtlY46W.js → fuel-B8r20ueU.js} +1 -1
- package/dist/assets/{fullpage-Ce9Y2TSP.js → fullpage-DLk_Ap1u.js} +1 -1
- package/dist/assets/{get-safe-url-BVbIl2hB.js → get-safe-url-BzE2b8Zw.js} +1 -1
- package/dist/assets/{get-safe-url-SccGjxz4.js → get-safe-url-C2hTfmjV.js} +1 -1
- package/dist/assets/{home-BI67JVLT.js → home-B30MMEWW.js} +1 -1
- package/dist/assets/{iframe-De6QHL_6.js → iframe-DvysnY8O.js} +1 -1
- package/dist/assets/index-4zAH1uuX.js +5 -0
- package/dist/assets/{index-BdfWmlqh.js → index-B4_ve2gt.js} +1 -1
- package/dist/assets/{index-C9lMjZBr.js → index-B6CyLMos.js} +7 -7
- package/dist/assets/{index-CxW3Q7hC.js → index-BkZLaapf.js} +3 -3
- package/dist/assets/{index-DUVrFM9m.js → index-C-yw0A3M.js} +1 -1
- package/dist/assets/{index-Dq1yoqB-.js → index-CM-Ew9KZ.js} +1 -1
- package/dist/assets/{index-o2FFW-yx.js → index-DFM7u7wl.js} +1 -1
- package/dist/assets/{index-R7D5qhDv.js → index-EDdyNc1F.js} +1 -1
- package/dist/assets/{index-D-6G7He6.js → index-EIsfexf1.js} +1 -1
- package/dist/assets/index-RoF9rzF3.js +77 -0
- package/dist/assets/index-U8kTDDEm.js +228 -0
- package/dist/assets/{index-DsrVmpPp.js → index-V7v6XM-s.js} +1 -1
- package/dist/assets/{index-NTlhnYZO.js → index-j5s7Rpz_.js} +1 -1
- package/dist/assets/{index-DVfi3VUs.js → index-r2Lf0YIw.js} +29 -29
- package/dist/assets/{index-BoVroYzD.js → index-uSZNIR4c.js} +33 -33
- package/dist/assets/{invitation-DWG-KySA.js → invitation-ZW3n52Yc.js} +6 -6
- package/dist/assets/{invite-Lcgs0Fhi.js → invite-B8cpjqrT.js} +1 -1
- package/dist/assets/{issue-passport-pkmrmS7N.js → issue-passport-DrbTLcdD.js} +1 -1
- package/dist/assets/item-BVrq9ZQD.js +2 -0
- package/dist/assets/{layout-CF6TreKX.js → layout-Dw2Qx7hs.js} +1 -1
- package/dist/assets/{list-D3MtvbeT.js → list-BwH5q_Zc.js} +5 -5
- package/dist/assets/{list-header-DxG3xooH.js → list-header-BBHpD8dC.js} +1 -1
- package/dist/assets/{localization-BOHiIJhm.js → localization-Ciwo-y3M.js} +1 -1
- package/dist/assets/{log-ZG0PJXpX.js → log-Ba7iTEJj.js} +1 -1
- package/dist/assets/login-BewdlPwi.js +1 -0
- package/dist/assets/{login-oauth-callback-VhHKXVPh.js → login-oauth-callback-D_bP2yYx.js} +1 -1
- package/dist/assets/{logo-uploader-DZitXtFf.js → logo-uploader-CneV6CnS.js} +3 -3
- package/dist/assets/{lost-passport-C9bxtr1Q.js → lost-passport-CNuZ281r.js} +3 -3
- package/dist/assets/{open-window-YQ4vV2tF.js → open-window-Q0PVNWdu.js} +1 -1
- package/dist/assets/{overview-GoLeUZDo.js → overview-giDiT6rf.js} +1 -1
- package/dist/assets/{page-header-DZTCF7io.js → page-header-BDwGXuEW.js} +1 -1
- package/dist/assets/{permission-BQ0E8FmL.js → permission-Cqed8iP-.js} +1 -1
- package/dist/assets/{preferences-CjipuYyV.js → preferences-CBm0eML7.js} +1 -1
- package/dist/assets/{publish-resource-Czivui9b.js → publish-resource-CQLawfAh.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-B0xxfe7i.js → react-beautiful-dnd.esm-BTWrOgJp.js} +1 -1
- package/dist/assets/{relative-time-Bkhqzrgv.js → relative-time-Bt6RtG4o.js} +1 -1
- package/dist/assets/sdk-B4wNFenI.js +1 -0
- package/dist/assets/session-BKdZFtFw.js +1 -0
- package/dist/assets/{setup-6BkYc-NJ.js → setup-BdFkCCIb.js} +4 -4
- package/dist/assets/{start-C6UPvOLP.js → start-Cy0MNYb6.js} +1 -1
- package/dist/assets/{step-actions-BmiH863e.js → step-actions-CPEQpBG3.js} +1 -1
- package/dist/assets/studio-BzK2t7MU.js +6 -0
- package/dist/assets/{switch-control-1mrS2A0x.js → switch-control-BSKk9hbF.js} +1 -1
- package/dist/assets/traffic-BQRcq8gg.js +37 -0
- package/dist/assets/{transfer-bCXNyiiH.js → transfer-DhNfOwE1.js} +2 -2
- package/dist/assets/{unsubscribe-DruGK6Ne.js → unsubscribe-C0PztwA5.js} +1 -1
- package/dist/assets/{useLocalStorage-DYSzZAco.js → useLocalStorage-Bx8dJwZw.js} +1 -1
- package/dist/assets/user-center-BshF32Jc.js +71 -0
- package/dist/assets/util-BPubgk5p.js +1 -0
- package/dist/assets/util-CWVLbRLp.js +1 -0
- package/dist/assets/vendor-arcblock-HzAExiTd.js +3512 -0
- package/dist/assets/{wrap-locale-CLuwhKrO.js → wrap-locale-DrPh3OVK.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/service-worker.js +1 -1
- package/package.json +29 -29
- package/dist/assets/Add-CuIZWfjH.js +0 -1
- package/dist/assets/ArrowDropDown-Cv3eCDY6.js +0 -1
- package/dist/assets/CheckCircle-D-unagro.js +0 -1
- package/dist/assets/ChevronLeft-Gy0Fh2PP.js +0 -1
- package/dist/assets/ChevronRight-DSecMzs8.js +0 -1
- package/dist/assets/DeleteOutline-CnjMnu1G.js +0 -1
- package/dist/assets/Done-C8ZSABDp.js +0 -1
- package/dist/assets/Download-BpCGsakQ.js +0 -1
- package/dist/assets/Error-CIVKKbPu.js +0 -1
- package/dist/assets/InfoOutlined-C8xfkBe6.js +0 -1
- package/dist/assets/Launch-BfiIdCmh.js +0 -1
- package/dist/assets/LaunchOutlined-DmwI20ey.js +0 -1
- package/dist/assets/Loop-Dlnais4C.js +0 -1
- package/dist/assets/MoreHoriz-DbMNKpjF.js +0 -1
- package/dist/assets/PlayArrow-CZfWYrXK.js +0 -1
- package/dist/assets/ViewList-CV3Yxakp.js +0 -1
- package/dist/assets/audit-logs-Cre3WUIo.js +0 -18
- package/dist/assets/branding-BTgKt5ES.js +0 -40
- package/dist/assets/bundle-avatar-7g1gtR_Q.js +0 -1
- package/dist/assets/button-DlYlZH8h.js +0 -1
- package/dist/assets/config-5CfgPrCe.js +0 -1
- package/dist/assets/config-space-C59Z4PGK.js +0 -1
- package/dist/assets/connect-hKwHeTo3.js +0 -1
- package/dist/assets/domain-PLy6pooV.js +0 -9
- package/dist/assets/domain-list-Bc7A7RER.js +0 -15
- package/dist/assets/form-text-input-AT4HfkHl.js +0 -11
- package/dist/assets/index-B9Bc9vnG.js +0 -77
- package/dist/assets/index-C9UnRN7C.js +0 -228
- package/dist/assets/index-p0322yKe.js +0 -5
- package/dist/assets/item-B6N6t3kF.js +0 -2
- package/dist/assets/login-BbaHO4Ca.js +0 -1
- package/dist/assets/sdk-CBf7wJy0.js +0 -1
- package/dist/assets/session-DKWhsUi1.js +0 -1
- package/dist/assets/studio-BdNJR01R.js +0 -6
- package/dist/assets/traffic-CoKCU9bb.js +0 -37
- package/dist/assets/user-center-B33739jv.js +0 -71
- package/dist/assets/util-BTCA4Hee.js +0 -1
- package/dist/assets/util-BblN2lT9.js +0 -1
- package/dist/assets/vendor-arcblock-DE69EmW_.js +0 -3512
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BkZLaapf.js","assets/vendor-arcblock-HzAExiTd.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-r2Lf0YIw.js","assets/index-DoZ2YM4T.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as w,k as Rt,l as st,L as le,f as Jn,h as Qn,i as at}from"./vendor-react-D-afvo_7.js";import{a1 as he,j as t,t as Me,a3 as u,aM as Vo,E as d,a4 as de,I as oe,T as A,bU as Wo,aa as ae,aE as Yn,bL as Ge,ad as Uo,aN as Xe,bq as bt,x as Y,a2 as Ye,P as Fo,G as Ho,v as St,$ as Go,ar as Xo,al as ue,ah as Zn,D as It,ab as Jo,r as Qo,bK as Kn,K as Be,y as Yo,M as K,ac as ke,aL as es,L as ts,z as os,bn as ns,aA as Zo,az as Ze,bt as ss,bu as rs,bV as is,bW as ls,aP as Ko,bH as cs,bN as as,bx as ds,by as dt}from"./vendor-mui-core-xF5F4eT7.js";import{z as me,C as _e,h as re,a6 as us,f as fo,_ as en,ae as ho}from"./index-r2Lf0YIw.js";import{a0 as be,b as H,e as Q,a3 as Ke,ac as tn,aV as on,aa as nn,_ as ps,aW as Dt,j as W,n as fs,aX as hs,aY as ms,y as bs,aD as ne,aZ as xs,ap as gs,aN as Ie,a7 as Tt,a_ as ye,ai as js,an as ks}from"./vendor-arcblock-HzAExiTd.js";import{d as _t}from"./Add-TglZpKpw.js";import{d as ys}from"./Error-B61ZB0Rr.js";import{C as Pt}from"./confirm-f60NfF3X.js";import{u as rt}from"./session-BKdZFtFw.js";import{W as mo}from"./did-address-CgDvtQbT.js";import{E as Ve,D as bo,C as xo,P as go}from"./react-beautiful-dnd.esm-BTWrOgJp.js";import{B as Lt}from"./bundle-avatar-Cv2R2iWI.js";import{S as pe}from"./shorten-label-J69eHfMN.js";import{T as vs,x as ce,G as qt,C as sn}from"./vendor-utils-5TjOM6td.js";import{d as ws}from"./Download-DECMRaRC.js";import{d as Cs}from"./QuestionMarkCircle-BvUTckGB.js";import{u as Rs}from"./vendor-hooks-BKxTDk_P.js";import{_ as Se}from"./useSetState-Crt4S51m.js";import{c as $t}from"./index-DoZ2YM4T.js";import{E as Nt}from"./index-CHFvfli7.js";import{p as et}from"./index-DFM7u7wl.js";import"./api-K65cLqol.js";import{d as Ss}from"./ChevronRight-DeRklga5.js";import{T as Is,a as Ds}from"./vendor-mui-x-CSUdon8K.js";import{d as jo}from"./DeleteOutline-DZA1YKE4.js";import{c as Ts,A as rn,u as _s,S as Ps,U as Ls,a as ut,b as ln,n as qs,e as $s,f as ko,g as Ns}from"./item-BVrq9ZQD.js";import{d as Es}from"./ArrowDropDown-DCM27ed6.js";import{f as De}from"./format-error-C0Ke3VXF.js";import{C as As}from"./click-to-copy-886R1sA9.js";import{d as Os}from"./Launch-Cpp3LVnV.js";import{M as zs}from"./index-ChSPqVLh.js";import{r as Ms}from"./index-DtwN19zv.js";import{d as Bs}from"./Done-CVdTMvGH.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-C2hTfmjV.js";var Et={},Vs=he;Object.defineProperty(Et,"__esModule",{value:!0});var cn=Et.default=void 0,Ws=Vs(be()),Us=t;cn=Et.default=(0,Ws.default)((0,Us.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 At={},Fs=he;Object.defineProperty(At,"__esModule",{value:!0});var an=At.default=void 0,Hs=Fs(be()),Gs=t;an=At.default=(0,Hs.default)((0,Gs.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 Ot={},Xs=he;Object.defineProperty(Ot,"__esModule",{value:!0});var dn=Ot.default=void 0,Js=Xs(be()),Qs=t;dn=Ot.default=(0,Js.default)((0,Qs.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 zt({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]=w.useState(!1),f=Me(m=>m.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Vo,{sx:{borderRadius:1},src:i}),t.jsxs(u,{children:[t.jsx(pe,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(pe,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}zt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Mt({initUrl:e}){const o=Rt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:l}=me(),{api:i}=rt(),[a,c]=w.useState(!0),{blocklet:f}=_e(),[m,g]=w.useState(null),[b,p]=w.useState(!1),y=Me(h=>h.breakpoints.down("xl")),{componentDid:v=""}=st(),[I,k]=w.useState(null),x=()=>{l.getProjects({input:{did:f.meta.did,componentDid:v,tenantScope:n}}).then(h=>{const S=(h==null?void 0:h.projects)||[];c(!1),k(S)}).catch(h=>{c(!1),W.error(h.message)})},C=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},P=h=>{g(h)},D=()=>{c(!1),p(!0)},j=()=>{p(!1),g(null)},T=h=>{W.error(h.message),p(!1),g(null)},O=h=>{if(!(h!=null&&h.deleted)){W.error("Delete project failed");return}x(),p(!1),g(null)},U=(h,S,E)=>{let V=h==null?void 0:h.trim();return V?(V=fs.toAddress(V).toLocaleLowerCase(),E.some((M,R)=>{const q=S[R];return q&&M.searchable&&M.display!=="excluded"&&M.display!=="false"&&q.toLocaleLowerCase().includes(V)})):!0};if(w.useEffect(()=>{x()},[]),!I&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!I)return null;if(!I.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(Ke,{onClick:C,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const L=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:h=>{const S=I[h];return t.jsx(le,{to:`${S.id}`,children:t.jsx(zt,{did:f.meta.did,projectId:S.id,logo:S.blockletLogo,title:S.blockletTitle,describe:S.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:h=>h?t.jsx(tn,{type:"success",children:h}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:h=>h?t.jsx(mo,{size:14,compact:!0,responsive:!1,did:h}):null}},y||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:h=>h?t.jsx(mo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${h}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:h}):null}},y||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:h=>{const S=(f.children||[]).find(E=>E.meta.did===h);return S?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:14,blocklet:S,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:S.meta.title})]},h):""}}},y||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:h=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(pe,{children:h})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:h=>t.jsx(on,{value:Number(h),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:h=>{const S=I[h];return t.jsxs(u,{display:"flex",children:[t.jsx(le,{to:`${S.id}/new-release/${S.lastReleaseId}`,children:t.jsx(de,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"create",children:t.jsx(cn,{style:{fontSize:18}})})})}),!!S.lastReleaseId&&t.jsx(de,{title:r("blocklet.publish.viewLastRelease",{name:S.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx(le,{style:{display:"flex"},to:`${S.id}/view/${S.lastReleaseId}`,children:t.jsx(an,{sx:{fontSize:18}})})})}),t.jsx(de,{title:r("blocklet.publish.delete",{name:S.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>P(S),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),_=b?t.jsx(ps,{open:!0,popup:!0,onClose:j,action:"check-has-project-id",locale:s,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:O,onError:T,extraParams:{projectId:m.id,did:f.meta.did,name:m.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(de,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(dn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(Ke,{onClick:C,variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Dt,{className:"main-table",locale:s,data:I,columns:L,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}}),m&&t.jsx(Pt,{title:`${r("common.delete")} ${m.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(h=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(ys,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:h})]}))})}),_]})}Mt.propTypes={initUrl:d.object};Mt.defaultProps={initUrl:null};var Bt={},Ys=he;Object.defineProperty(Bt,"__esModule",{value:!0});var un=Bt.default=void 0,Zs=Ys(be()),yo=t;un=Bt.default=(0,Zs.default)([(0,yo.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,yo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Ks(){var D;const{t:e,locale:o}=Q(),{projectId:n}=st(),{api:r}=me(),[s,l]=w.useState(!0),{blocklet:i}=_e(),a=Me(j=>j.breakpoints.down("md")),[c,f]=w.useState(null),[m,g]=w.useState(null),[b,p]=w.useState(null),y=(D=window.env)==null?void 0:D.serverEndpoint,v=()=>{r.getReleases({input:{did:i.meta.did,projectId:n}}).then(j=>{const T=(j==null?void 0:j.releases)||[];l(!1),f(T)}).catch(j=>{l(!1),W.error(j.message)})},I=()=>{r.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:n}},getReleases:{input:{did:i.meta.did,projectId:n}}}).then(j=>{g(j.getProject.project||{}),f(j.getReleases.releases||[]),l(!1)}).catch(j=>{l(!1),W.error(j.message)})};w.useEffect(()=>{I()},[]);const k=()=>{l(!1);const j=b.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:j}}).then(()=>{l(!1),v(),W.success(e("common.removeSuccess")),p(null)}).catch(T=>{l(!1),W.error(T.message)})},x=j=>{p(j)};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 C=t.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(le,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(pe,{maxLength:a?6:30,children:m.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[C,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(le,{to:"create/none",children:t.jsx(Ke,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const P=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:j=>{const T=c[j];return t.jsx(le,{to:`view/${T.id}`,children:t.jsx(zt,{did:i.meta.did,projectId:m.id,logo:T.blockletLogo,title:T.blockletVersion,describe:T.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:j=>{const T=c[j];return t.jsx(A,{className:"note",children:T.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:j=>t.jsx(tn,{type:j==="published"?"success":"warning",children:j==="published"?"Released":vs(j)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const T=c[j];return T.status!==re.PROJECT.RELEASE_STATUS.published?"":t.jsx(on,{value:Number(T.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:j=>{var h;const T=c[j];let O="",U="";const L=T.status==="published";if(L){const S=ce(y,`/api/project/${i.meta.did}/${m.id}/${m.lastReleaseId}/release/blocklet.json`),E=new URL(y);E.pathname=ce(E.pathname,"/launch-blocklet/agreement"),E.searchParams.set("blocklet_meta_url",S),O=E.href,U=ce(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${m.id}/${m.lastReleaseId}/download/${(m.lastReleaseFiles||[])[0]}`)}const _=(h=m.blockletComponents)!=null&&h.some(S=>S.included)||T.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[L&&_==="pack"&&t.jsx(de,{title:e("blocklet.publish.install",{name:m.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:O,target:"_blank",rel:"noreferrer",children:t.jsx(un,{sx:{fontSize:18}})})})}),L&&t.jsx(de,{title:e("blocklet.publish.download",{name:m.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:U,children:t.jsx(ws,{sx:{fontSize:18}})})})}),t.jsx(de,{title:e("blocklet.publish.delete",{name:m.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>x(T),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(er,{children:[t.jsxs(u,{className:"header",children:[C,t.jsx(le,{to:"new-release/none",children:t.jsxs(Ke,{variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Dt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:P,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),b&&t.jsx(Pt,{title:e(`${e("common.delete")} ${b.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:k,onCancel:()=>p(null)})]})}const er=ae(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 Vt={},tr=he;Object.defineProperty(Vt,"__esModule",{value:!0});var pn=Vt.default=void 0,or=tr(be()),nr=t;pn=Vt.default=(0,or.default)((0,nr.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 Te({children:e,Icon:o}){return t.jsxs(Yn,{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})]})}Te.propTypes={children:d.node.isRequired,Icon:d.elementType};Te.defaultProps={Icon:pn};function Wt({value:e,app:o,onChange:n,onChangeBlockletResourceType:r,disabled:s,resourceRelateComponents:l,projectType:i,dependentComponentsMode:a,blockletResourceType:c}){const{t:f,locale:m}=Q(),g=a==="readonly",b=w.useMemo(()=>{const C=e.reduce((P,D)=>(P[D.did]=D.included,P),{});return(o.children||[]).filter(P=>g?l[P.meta.did]||C[P.meta.did]:!0)},[o.children,e,l,g]),p=w.useMemo(()=>b.map(C=>e.find(D=>D.did===C.meta.did)||{did:C.meta.did}),[b,e]),y=p.reduce((C,P)=>(C[P.did]=qt(P,["required","included"]),C),{}),v=C=>{const P=p.map(D=>{if(D.did===C){const j=!D.included;return{...D,included:j,required:j}}return D});n(P)},I=C=>{const P=p.map(D=>D.did===C?{...D,required:!D.required}:D);n(P)},k=C=>{r(C.target.checked?"resource":"")},x=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:C=>{var j;const P=b[C],D=(j=y[P.meta.did])==null?void 0:j.included;return t.jsxs(u,{display:"flex",alignItems:"center",children:[t.jsx(Lt,{size:24,blocklet:P,ancestors:[o]}),t.jsx(u,{ml:"4px",className:$t("text",{excluded:!D}),children:t.jsx(u,{children:P.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:C=>{var T;const P=b[C],D=l[P.meta.did],j=!!((T=y[P.meta.did])!=null&&T.included);return t.jsx(Ge,{size:"small",checked:D||j,onClick:()=>v(P.meta.did),disabled:g||D||s})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:C=>{var O,U;const P=b[C],D=l[P.meta.did],j=!!((O=y[P.meta.did])!=null&&O.included),T=!!((U=y[P.meta.did])!=null&&U.required);return t.jsx(Ge,{size:"small",checked:D||T&&j,onClick:()=>I(P.meta.did),disabled:g||D||s||!j})}}}];return t.jsx(sr,{children:b!=null&&b.length?t.jsxs(t.Fragment,{children:[t.jsxs(Uo,{severity:"info",style:{width:"100%"},children:[t.jsx(u,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:f(i==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),t.jsxs(u,{component:"label",style:{cursor:"pointer"},children:[t.jsx(Ge,{size:"small",style:{marginLeft:"0px"},disabled:s,checked:c==="resource",onChange:k}),f("blocklet.publish.forceResourceBlocklet")]})]}),t.jsx(Dt,{className:"main-table",verticalKeyWidth:100,locale:m,data:b,columns:x,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):t.jsx(Te,{Icon:Nt,children:f("blocklet.publish.blockletEmptyTip")})})}Wt.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};Wt.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const sr=ae(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 rr(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 Ut({src:e,alt:o,...n}){const[r,s]=w.useState(!1),l=w.useRef(null);return w.useEffect(()=>{if(!("IntersectionObserver"in window))return s(!0),()=>{};const i=new IntersectionObserver(a=>{a.forEach(c=>{c.isIntersecting&&(s(!0),i.disconnect())})},{threshold:.1});return l.current&&i.observe(l.current),()=>{i.disconnect()}},[]),t.jsx("img",{ref:l,src:r?e:void 0,alt:o,...n})}Ut.propTypes={src:d.string.isRequired,alt:d.string};Ut.defaultProps={alt:""};function Ft({data:e,lazy:o,...n}){return!e||!e.length?null:t.jsx(ir,{...n,children:e.map(r=>t.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:o?t.jsx(Ut,{src:r.url,alt:r.alt||""}):t.jsx("img",{src:r.url,alt:r.alt||""})},r.url))})}Ft.propTypes={data:d.arrayOf(d.shape({url:d.string,alt:d.string})),lazy:d.bool};Ft.defaultProps={data:[],lazy:!1};const ir=ae(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
|
+
`,pt=(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 Ht({icon:e}){return e?bs(e)?t.jsx("img",{className:"resource-icon",src:e,alt:"icon"}):t.jsx(ne,{className:"resource-icon",icon:e}):null}Ht.propTypes={icon:d.string};Ht.defaultProps={icon:""};function Gt({disabled:e,data:o,onChange:n,value:r}){const s=r;function l(p,y=[]){return y.push(p.id),p.children&&p.children.forEach(v=>l(v,y)),y}const i=p=>l(pt(o,p)),a=(p,y=[])=>{const v=pt(o,p);return v.parent?(y.push(v.parent),a(v.parent,y)):y};function c(p,y){const v=i(p.id),I=v.indexOf(p.id);return v.splice(I,1),v.every(k=>s.concat(y).includes(k))}const f=(p,y)=>{p.stopPropagation();const v=i(y),I=a(y);if(s.includes(y)){const k=s.filter(x=>!v.concat(I).includes(x));n(k)}else{const k=v;for(let x=0;x<I.length;++x)c(pt(o,I[x]),k)&&k.push(I[x]);n([...s].concat(k))}},m=p=>{p.stopPropagation()},g=o.some(p=>{var y;return((y=p.children)==null?void 0:y.length)>0}),b=p=>{var x;const y=s.indexOf(p.id)!==-1,v=Array.isArray(p.children),I=i(p.id),k=v&&!y&&s.some(C=>I.includes(C));return t.jsx(Is,{nodeId:p.id,label:t.jsx(Xe,{onClick:m,control:t.jsx(Ge,{size:"small",checked:y,indeterminate:k,tabIndex:-1,disableRipple:!0,onClick:C=>f(C,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(Ht,{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(ms,{className:"link-icon"})})]}),!!p.description&&t.jsx(u,{className:"description",children:p.description}),!!((x=p.images)!=null&&x.length)&&t.jsx(Ft,{className:"images",data:p.images,lazy:!0})]})}),children:v?p.children.map(b):null},p.id)};return t.jsx(lr,{className:$t(!g&&"no-children"),multiSelect:!0,defaultCollapseIcon:t.jsx(hs,{}),defaultExpandIcon:t.jsx(Ss,{}),selected:s,children:o.map(p=>b(p))})}Gt.propTypes={data:d.array,value:d.array,onChange:d.func,disabled:d.bool};Gt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const lr=ae(Ds)`
|
|
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
|
+
`,vo={},cr=(e,o,{key:n,cacheTime:r=1e3*3}={})=>{const s=n+JSON.stringify({params:o}),l=vo[s];if(l&&l.timestamp>Date.now()-r)return l.promise;const i=e(...o);return vo[s]={promise:i,timestamp:Date.now()},i},fn=cr,hn=(e,o)=>(e.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(r=>{r.parent=n.id,hn(r.children||[],r.id)})}),e),mn=(e,o,n,r,s)=>{const{exportApi:l="/"}=(e==null?void 0:e.meta.resource)||{},i=new URL(ce("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}`},ar=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 sn.post(mn(n,r,s,l,i),{resources:a,projectId:r,releaseId:s,locale:l,...c?{resourcesParams:c}:{}},{headers:{"x-csrf-token":xs()},timeout:60*1e3}),await e.updateSelectedResources({input:{did:o,projectId:r,releaseId:s,componentDid:n.meta.did,resources:a}})},dr=(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 Xt({app:e,component:o,projectId:n,release:r,loading:s,error:l,saveSelectedEventsRef:i,readOnly:a,componentDid:c,initialResources:f={},setResourceComponentsMap:m,selectedResourceIds:g,setSelectedResourceIds:b,showTree:p,initUrl:y}){var _;const{t:v,locale:I}=Q(),{api:k}=me(),[x,C]=Se({}),P=w.useRef({}),D=w.useRef(!1),j=r.id;P.current.projectId=n,P.current.releaseId=j;const T=(h,S,E)=>{if(!S)return;const V=dr(S,E);m==null||m({[h]:Object.keys(V)})},O=h=>{i.current[o.meta.did]={resources:h,component:o},b({[o.meta.did]:h}),T(o.meta.did,x[o.meta.did],h)},U=w.useCallback(async h=>{var S;try{const E=await fn(sn.get,[mn(h,n,j,I,y),{timeout:6e4}],{key:"getResources"});return hn(((S=E==null?void 0:E.data)==null?void 0:S.resources)||[])}catch{return[]}},[n,j,I,y]);w.useEffect(()=>{x[o==null?void 0:o.meta.did]||U(o).then(h=>{C({[o==null?void 0:o.meta.did]:h})}).catch(h=>{W.error(h.message)})},[o,C,x,U]),w.useEffect(()=>{j&&n&&!D.current&&et(e.children.map(h=>async()=>{var S,E;if(!(c&&c!==h.meta.did)&&!(!(h!=null&&h.mountPoint)||!us.hasStartEngine(h==null?void 0:h.meta)||!((E=(S=h==null?void 0:h.meta)==null?void 0:S.resource)!=null&&E.exportApi)))try{const V=await U(h);C({[h==null?void 0:h.meta.did]:V});const M=await k.getSelectedResources({input:{did:e.meta.did,projectId:n,releaseId:j,componentDid:h.meta.did}}),R=(M==null?void 0:M.resources)||[];R!=null&&R.length&&(b({[h.meta.did]:rr(V,R)}),T(h.meta.did,V,R),a||(i.current[h==null?void 0:h.meta.did]={resources:R,component:h}))}catch(V){W.error(V.message)}}),{concurrency:2}).then(()=>{D.current=!0})},[j,n,a,I,y,C]),w.useEffect(()=>{f&&Object.keys(f).length&&et(e.children.map(async h=>{const S=f[h.meta.did];if(S!=null&&S.length){const E=await U(h);b({[h.meta.did]:S}),T(h.meta.did,E,S),a||(i.current[h==null?void 0:h.meta.did]={resources:S,component:h})}}))},[e,f,a]);let L=null;return(!o||!((_=x[o.meta.did])!=null&&_.length))&&(L=t.jsx(Te,{Icon:Nt,children:v("blocklet.publish.resourceEmptyTip",{name:fo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(L=t.jsx(Te,{children:v("blocklet.publish.componentNotRunning",{name:fo.getDisplayName(o)})})),t.jsxs(t.Fragment,{children:[t.jsx(ur,{className:$t(l&&"error"),children:p&&t.jsx(u,{pb:2,width:"100%",children:L||t.jsx(Gt,{data:x[o.meta.did]||[],value:g[o.meta.did]||[],onChange:O,disabled:s||a})})}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}Xt.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,showTree:d.bool.isRequired};Xt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const ur=ae(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 Jt={},pr=he;Object.defineProperty(Jt,"__esModule",{value:!0});var xt=Jt.default=void 0,fr=pr(be()),hr=t;xt=Jt.default=(0,fr.default)((0,hr.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 wo="lastWantToConnectStoreId";function mr(e){var a,c;const[o,n]=w.useState(null),{session:r}=rt(),s=w.useCallback(f=>{n(f),localStorage.setItem(wo,f==null?void 0:f.id)},[n]),l=w.useMemo(()=>{var b,p,y,v;const f=localStorage.getItem(wo),m=f?(((b=e==null?void 0:e.settings)==null?void 0:b.storeList)||[]).find(I=>I.id===f):null;if(m)return m;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(I=>{var k;return!(I.id!==H.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((k=r==null?void 0:r.user)==null?void 0:k.did))});return g||(g=(v=(y=e==null?void 0:e.settings)==null?void 0:y.storeList)==null?void 0:v[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 ft={};async function bn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){ft[s]&&clearTimeout(ft[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?ft[s]=setTimeout(()=>i(a,c),o):setTimeout(()=>i(a,c),o)}};return new Promise(i)}function br(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function xr(e,{did:o,projectId:n,messageId:r}){return bn(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 gr(e,{did:o,projectId:n,storeId:r}){return bn(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 xn=({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 Qt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:l,componentDid:i}){var h,S,E;const{t:a}=Q(),{session:c}=rt(),{api:f,info:m,inService:g}=me(),b=_e(),[p,y]=w.useState(!1),v=w.useRef(null),[I,k]=w.useState(!1),[x,C]=w.useState(null),P=V=>{n(V),y(!1)},D=()=>{y(!p)},j=V=>{v.current&&v.current.contains(V.target)||y(!1)},T=()=>{k(!0)},O=()=>{k(!1)},U=async()=>{var V;if(x)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:x.url,projectId:"",scope:x.scope||"studio"}}),await((V=b==null?void 0:b.actions)==null?void 0:V.refreshBlocklet())}catch(M){W.error(`Remove Blocklet Store Error: ${De(M)}`)}finally{C(null)}},{storeList:L}=xn({fromBlocklet:g,blocklet:e,nodeInfo:m,componentDid:i,userDid:(h=c==null?void 0:c.user)==null?void 0:h.did}),_=(S=e==null?void 0:e.meta)==null?void 0:S.did;return t.jsxs(t.Fragment,{children:[t.jsxs(bt,{disabled:s,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Y,{onClick:r,children:[l&&t.jsx(Ye,{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(Es,{})})]}),t.jsx(Fo,{sx:{zIndex:10},open:p,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:V})=>t.jsx(Ho,{...V,style:{transformOrigin:"center top"},children:t.jsx(St,{children:t.jsx(Go,{onClickAway:j,children:t.jsxs(Xo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[L==null?void 0:L.map(M=>{var R;return t.jsxs(ue,{selected:M.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>P(M),children:[t.jsxs(u,{children:[t.jsx(pe,{sx:{fontSize:"16px"},maxLength:24,children:M.name}),t.jsx(pe,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:M.url})]}),Ts({store:M,userDid:(R=c==null?void 0:c.user)==null?void 0:R.did})&&t.jsx(oe,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),C(M)},children:t.jsx(ne,{icon:"ic:outline-delete"})})]},M.url)}),t.jsx(Zn,{}),t.jsxs(ue,{onClick:T,children:[t.jsx(_t,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&t.jsx(rn,{hiddenChildren:!0,open:!0,onClose:O,teamDid:_,storeList:L,scope:"studio",onAdd:(E=b==null?void 0:b.actions)==null?void 0:E.refreshBlocklet}),x&&t.jsx(Pt,{displayError:!0,title:`${a("common.delete")} ${x.name}`,description:a("blocklet.publish.deleteStoreTip",{name:x.name}),confirm:a("common.confirm"),onConfirm:U,onCancel:()=>C(null)})]})}Qt.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};Qt.defaultProps={store:null,blocklet:null};var fe=w;const Ee=/^[a-z0-9]+(-[a-z0-9]+)*$/,it=(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&&!Je(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&&!Je(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:l};return o&&!Je(a,n)?null:a}return null},Je=(e,o)=>e?!!((e.provider===""||e.provider.match(Ee))&&(o&&e.prefix===""||e.prefix.match(Ee))&&e.name.match(Ee)):!1,gn=Object.freeze({left:0,top:0,width:16,height:16}),tt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Yt=Object.freeze({...gn,...tt}),gt=Object.freeze({...Yt,body:"",hidden:!1});function jr(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 Co(e,o){const n=jr(e,o);for(const r in gt)r in tt?r in e&&!(r in n)&&(n[r]=tt[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function kr(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 yr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let l={};function i(a){l=Co(r[a]||s[a],l)}return i(o),n.forEach(i),Co(e,l)}function jn(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=kr(e);for(const s in r){const l=r[s];l&&(o(s,yr(e,s,l)),n.push(s))}return n}const vr={provider:"",aliases:{},not_found:{},...gn};function ht(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function kn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!ht(e,vr))return null;const n=o.icons;for(const s in n){const l=n[s];if(!s.match(Ee)||typeof l.body!="string"||!ht(l,gt))return null}const r=o.aliases||Object.create(null);for(const s in r){const l=r[s],i=l.parent;if(!s.match(Ee)||typeof i!="string"||!n[i]&&!r[i]||!ht(l,gt))return null}return o}const Ro=Object.create(null);function wr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ve(e,o){const n=Ro[e]||(Ro[e]=Object.create(null));return n[o]||(n[o]=wr(e,o))}function Zt(e,o){return kn(o)?jn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function Cr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Oe=!1;function yn(e){return typeof e=="boolean"&&(Oe=e),Oe}function Rr(e){const o=typeof e=="string"?it(e,!0,Oe):e;if(o){const n=ve(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Sr(e,o){const n=it(e,!0,Oe);if(!n)return!1;const r=ve(n.provider,n.prefix);return Cr(r,n.name,o)}function Ir(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Oe&&!o&&!e.prefix){let s=!1;return kn(e)&&(e.prefix="",jn(e,(l,i)=>{i&&Sr(l,i)&&(s=!0)})),s}const n=e.prefix;if(!Je({provider:o,prefix:n,name:"a"}))return!1;const r=ve(o,n);return!!Zt(r,e)}const vn=Object.freeze({width:null,height:null}),wn=Object.freeze({...vn,...tt}),Dr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Tr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function So(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(Dr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=Tr.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 _r=e=>e==="unset"||e==="undefined"||e==="none";function Pr(e,o){const n={...Yt,...e},r={...wn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let l=n.body;[n,r].forEach(y=>{const v=[],I=y.hFlip,k=y.vFlip;let x=y.rotate;I?k?x+=2:(v.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),v.push("scale(-1 1)"),s.top=s.left=0):k&&(v.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),v.push("scale(1 -1)"),s.top=s.left=0);let C;switch(x<0&&(x-=Math.floor(x/4)*4),x=x%4,x){case 1:C=s.height/2+s.top,v.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:v.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:C=s.width/2+s.left,v.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}x%2===1&&(s.left!==s.top&&(C=s.left,s.left=s.top,s.top=C),s.width!==s.height&&(C=s.width,s.width=s.height,s.height=C)),v.length&&(l='<g transform="'+v.join(" ")+'">'+l+"</g>")});const i=r.width,a=r.height,c=s.width,f=s.height;let m,g;i===null?(g=a===null?"1em":a==="auto"?f:a,m=So(g,c/f)):(m=i==="auto"?c:i,g=a===null?So(m,f/c):a==="auto"?f:a);const b={},p=(y,v)=>{_r(v)||(b[y]=v.toString())};return p("width",m),p("height",g),b.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:b,body:l}}const Lr=/\sid="(\S+)"/g,qr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let $r=0;function Nr(e,o=qr){const n=[];let r;for(;r=Lr.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 jt=Object.create(null);function Er(e,o){jt[e]=o}function kt(e){return jt[e]||jt[""]}function Kt(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 eo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Qe=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Qe.push(Ne.shift()):Qe.push(Ne.pop());eo[""]=Kt({resources:["https://api.iconify.design"].concat(Qe)});function Ar(e,o){const n=Kt(o);return n===null?!1:(eo[e]=n,!0)}function to(e){return eo[e]}const Or=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Io=Or();function zr(e,o){const n=to(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 Mr(e){return e===404}const Br=(e,o,n)=>{const r=[],s=zr(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 Vr(e){if(typeof e=="string"){const o=to(e);if(o)return o.path}return"/"}const Wr=(e,o,n)=>{if(!Io){n("abort",424);return}let r=Vr(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;Io(e+r).then(l=>{const i=l.status;if(i!==200){setTimeout(()=>{n(Mr(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)})},Ur={prepare:Br,send:Wr};function Fr(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]=ve(l,i));let m;a in f.icons?m=o.loaded:i===""||f.missing.has(a)?m=o.missing:m=o.pending;const g={provider:l,prefix:i,name:a};m.push(g)}),o}function Cn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Hr(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||Cn([e],l.id),l.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),l.abort))})}))}let Gr=0;function Xr(e,o,n){const r=Gr++,s=Cn.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 Jr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const l=typeof s=="string"?it(s,o,n):s;l&&r.push(l)}),r}var Qr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Yr(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 j=e.resources.slice(0);for(i=[];j.length>1;){const T=Math.floor(Math.random()*j.length);i.push(j[T]),j=j.slice(0,T).concat(j.slice(T+1))}i=i.concat(j)}else i=e.resources.slice(l).concat(e.resources.slice(0,l));const a=Date.now();let c="pending",f=0,m,g=null,b=[],p=[];typeof r=="function"&&p.push(r);function y(){g&&(clearTimeout(g),g=null)}function v(){c==="pending"&&(c="aborted"),y(),b.forEach(j=>{j.status==="pending"&&(j.status="aborted")}),b=[]}function I(j,T){T&&(p=[]),typeof j=="function"&&p.push(j)}function k(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:b.length,subscribe:I,abort:v}}function x(){c="failed",p.forEach(j=>{j(void 0,m)})}function C(){b.forEach(j=>{j.status==="pending"&&(j.status="aborted")}),b=[]}function P(j,T,O){const U=T!=="success";switch(b=b.filter(L=>L!==j),c){case"pending":break;case"failed":if(U||!e.dataAfterTimeout)return;break;default:return}if(T==="abort"){m=O,x();return}if(U){m=O,b.length||(i.length?D():x());return}if(y(),C(),!e.random){const L=e.resources.indexOf(j.resource);L!==-1&&L!==e.index&&(e.index=L)}c="completed",p.forEach(L=>{L(O)})}function D(){if(c!=="pending")return;y();const j=i.shift();if(j===void 0){if(b.length){g=setTimeout(()=>{y(),c==="pending"&&(C(),x())},e.timeout);return}x();return}const T={status:"pending",resource:j,callback:(O,U)=>{P(T,O,U)}};b.push(T),f++,g=setTimeout(D,e.rotate),n(j,o,T.callback)}return setTimeout(D),k}function Rn(e){const o={...Qr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const m=Yr(o,a,c,(g,b)=>{r(),f&&f(g,b)});return n.push(m),m}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 Do(){}const mt=Object.create(null);function Zr(e){if(!mt[e]){const o=to(e);if(!o)return;const n=Rn(o),r={config:o,redundancy:n};mt[e]=r}return mt[e]}function Kr(e,o,n){let r,s;if(typeof e=="string"){const l=kt(e);if(!l)return n(void 0,424),Do;s=l.send;const i=Zr(e);i&&(r=i.redundancy)}else{const l=Kt(e);if(l){r=Rn(l);const i=e.resources?e.resources[0]:"",a=kt(i);a&&(s=a.send)}}return!r||!s?(n(void 0,424),Do):r.query(o,s,n)().abort}const To="iconify2",ze="iconify",Sn=ze+"-count",_o=ze+"-version",In=36e5,ei=168;function yt(e,o){try{return e.getItem(o)}catch{}}function oo(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Po(e,o){try{e.removeItem(o)}catch{}}function vt(e,o){return oo(e,Sn,o.toString())}function wt(e){return parseInt(yt(e,Sn))||0}const lt={local:!0,session:!0},Dn={local:new Set,session:new Set};let no=!1;function ti(e){no=e}let He=typeof window>"u"?{}:window;function Tn(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}lt[e]=!1}function _n(e,o){const n=Tn(e);if(!n)return;const r=yt(n,_o);if(r!==To){if(r){const a=wt(n);for(let c=0;c<a;c++)Po(n,ze+c.toString())}oo(n,_o,To),vt(n,0);return}const s=Math.floor(Date.now()/In)-ei,l=a=>{const c=ze+a.toString(),f=yt(n,c);if(typeof f=="string"){try{const m=JSON.parse(f);if(typeof m=="object"&&typeof m.cached=="number"&&m.cached>s&&typeof m.provider=="string"&&typeof m.data=="object"&&typeof m.data.prefix=="string"&&o(m,a))return!0}catch{}Po(n,c)}};let i=wt(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,vt(n,i)):Dn[e].add(a))}function Pn(){if(!no){ti(!0);for(const e in lt)_n(e,o=>{const n=o.data,r=o.provider,s=n.prefix,l=ve(r,s);if(!Zt(l,n).length)return!1;const i=n.lastModified||-1;return l.lastModifiedCached=l.lastModifiedCached?Math.min(l.lastModifiedCached,i):i,!0})}}function oi(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in lt)_n(r,s=>{const l=s.data;return s.provider!==e.provider||l.prefix!==e.prefix||l.lastModified===o});return!0}function ni(e,o){no||Pn();function n(r){let s;if(!lt[r]||!(s=Tn(r)))return;const l=Dn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=wt(s),!vt(s,i+1))return;const a={cached:Math.floor(Date.now()/In),provider:e.provider,data:o};return oo(s,ze+i.toString(),JSON.stringify(a))}o.lastModified&&!oi(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function Lo(){}function si(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Hr(e)}))}function ri(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=kt(n)))return;l.prepare(n,r,s).forEach(a=>{Kr(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=Zt(e,c);if(!f.length)return;const m=e.pendingIcons;m&&f.forEach(g=>{m.delete(g)}),ni(e,c)}catch(f){console.error(f)}si(e)})})}))}const ii=(e,o)=>{const n=Jr(e,!0,yn()),r=Fr(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,Lo)}),()=>{c=!1}}const s=Object.create(null),l=[];let i,a;return r.pending.forEach(c=>{const{provider:f,prefix:m}=c;if(m===a&&f===i)return;i=f,a=m,l.push(ve(f,m));const g=s[f]||(s[f]=Object.create(null));g[m]||(g[m]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:m,name:g}=c,b=ve(f,m),p=b.pendingIcons||(b.pendingIcons=new Set);p.has(g)||(p.add(g),s[f][m].push(g))}),l.forEach(c=>{const{provider:f,prefix:m}=c;s[f][m].length&&ri(c,s[f][m])}),o?Xr(o,r,l):Lo};function li(e,o){const n={...e};for(const r in o){const s=o[r],l=typeof s;r in vn?(s===null||s&&(l==="string"||l==="number"))&&(n[r]=s):l===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const ci=/[\s,]+/;function ai(e,o){o.split(ci).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function di(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 ui(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 pi(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function fi(e){return"data:image/svg+xml,"+pi(e)}function hi(e){return'url("'+fi(e)+'")'}let Ae;function mi(){try{Ae=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ae=null}}function bi(e){return Ae===void 0&&mi(),Ae?Ae.createHTML(e):e}const Ln={...wn,inline:!1},xi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},gi={display:"inline-block"},Ct={backgroundColor:"currentColor"},qn={backgroundColor:"transparent"},qo={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},$o={WebkitMask:Ct,mask:Ct,background:qn};for(const e in $o){const o=$o[e];for(const n in qo)o[e+n]=qo[n]}const ji={...Ln,inline:!0};function No(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const ki=(e,o,n,r)=>{const s=n?ji:Ln,l=li(s,o),i=o.mode||"svg",a={},c=o.style||{},f={...i==="svg"?xi:{},ref:r};for(let k in o){const x=o[k];if(x!==void 0)switch(k){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":l[k]=x===!0||x==="true"||x===1;break;case"flip":typeof x=="string"&&ai(l,x);break;case"color":a.color=x;break;case"rotate":typeof x=="string"?l[k]=di(x):typeof x=="number"&&(l[k]=x);break;case"ariaHidden":case"aria-hidden":x!==!0&&x!=="true"&&delete f["aria-hidden"];break;default:s[k]===void 0&&(f[k]=x)}}const m=Pr(e,l),g=m.attributes;if(l.inline&&(a.verticalAlign="-0.125em"),i==="svg"){f.style={...a,...c},Object.assign(f,g);let k=0,x=o.id;return typeof x=="string"&&(x=x.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:bi(Nr(m.body,x?()=>x+"ID"+k++:"iconifyReact"))},fe.createElement("svg",f)}const{body:b,width:p,height:y}=e,v=i==="mask"||(i==="bg"?!1:b.indexOf("currentColor")!==-1),I=ui(b,{...g,width:p+"",height:y+""});return f.style={...a,"--svg":hi(I),width:No(g.width),height:No(g.height),...gi,...v?Ct:qn,...c},fe.createElement("span",f)};yn(!0);Er("",Ur);if(typeof document<"u"&&typeof window<"u"){Pn();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"||!Ir(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;Ar(n,s)||console.error(r)}catch{console.error(r)}}}}class $n extends fe.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=it(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const l=Rr(s);if(!l){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),l!==null&&(this._loading={name:r,abort:ii([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const i=["iconify"];s.prefix!==""&&i.push("iconify--"+s.prefix),s.provider!==""&&i.push("iconify--"+s.provider),this._setData({data:l,classes:i}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:fe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),ki({...Yt,...n.data},r,o._inline,o._ref)}}const yi=fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return fe.createElement($n,r)});fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return fe.createElement($n,r)});var vi=yi;const wi=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ct({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(vi,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(A,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ct.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ct.defaultProps={style:{},controls:1,modestbranding:1};function Nn({setParams:e,onClose:o,params:n}){const{t:r}=Q(),[s,l]=w.useState(""),i=s&&n.blockletVideos.includes(s),a=wi(s),c=()=>{e(f=>{const m=[...f.blockletVideos];return m.push(s),{...f,blockletVideos:m}}),o()};return t.jsxs(It,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Jo,{children:r("studio.videoDialogTitle")}),t.jsxs(Qo,{children:[t.jsx(Kn,{fullWidth:!0,value:s,onChange:f=>l(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Be,{position:"end",children:t.jsx(oe,{onClick:()=>l(""),children:t.jsx(gs,{})})}):null,error:i}),i&&t.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ct,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Yo,{children:[t.jsx(Y,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Y,{disabled:!a||i,onClick:c,children:r("studio.confirm")})]})]})}Nn.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Eo=w.lazy(()=>en(()=>import("./index-BkZLaapf.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function En({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:l,paramsErrTip:i,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:m,setInitLogoUrl:g,componentDid:b}){const{t:p,locale:y}=Q(),{api:v}=me(),I=Rt(),k=w.useRef(null),x=w.useRef(null),[C,P]=mr(r),[D,j]=w.useState(!1),T=_s({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),O=async R=>{const q=setTimeout(()=>{c(!1)},2e4),B=await xr(v,R);c(!1),clearTimeout(q),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),I(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${B}/create`),{replace:!0})},U=()=>{if(!s.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(C!=null&&C.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const R=br();T(async(q,B)=>{var G,J,ee;try{const X=await v.connectByStudio({input:{did:(G=r==null?void 0:r.meta)==null?void 0:G.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:C.url,storeId:C.id,storeName:C.name,type:((J=s==null?void 0:s.blockletComponents)==null?void 0:J.length)>0?"pack":"resource",componentDid:b,messageId:R,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(X!=null&&X.url)){W.error("failed to connect to store");return}B(X.url),O({did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,projectId:"",messageId:R})}catch(X){const se=De(X);W.error(se),c(!1)}})},L=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,_=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,h=s!=null&&s.blockletLogo?`${L}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,S=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(R=>`${_}/${R}`),E=()=>o?!1:!e||e===H.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,V=R=>{if(!R.destination)return;const q=Array.from(s.blockletScreenshots),[B]=q.splice(R.source.index,1);q.splice(R.destination.index,0,B),l(G=>({...G,blockletScreenshots:q}))},M=R=>{if(!R.destination)return;const q=Array.from(s.blockletVideos),[B]=q.splice(R.source.index,1);q.splice(R.destination.index,0,B),l(G=>({...G,blockletVideos:q}))};return t.jsxs(Ci,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(K,{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(K,{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(Qt,{blocklet:r,store:C,componentDid:b,onChangeStore:P,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(K,{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(K,{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(K,{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(K,{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(K,{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(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(ke,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||h,onClick:()=>{var R;E()&&((R=k.current)==null||R.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(ke,{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(bo,{onDragEnd:o?void 0:V,children:t.jsx(xo,{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:[S.map((B,G)=>t.jsx(go,{draggableId:B,index:G,isDragDisabled:o,children:(J,ee)=>t.jsxs(u,{ref:J.innerRef,...J.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:B}),!o&&t.jsx(oe,{...J.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(xt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(X=>{const se=[...X.blockletScreenshots];return se.splice(G,1),{...X,blockletScreenshots:se}})},children:t.jsx(jo,{})})]})},B)),R.placeholder,S.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 B;E()&&((B=x.current)==null||B.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(ke,{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(bo,{onDragEnd:o?void 0:M,children:t.jsx(xo,{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((B,G)=>t.jsx(go,{draggableId:B,index:G,isDragDisabled:o,children:(J,ee)=>t.jsxs(u,{ref:J.innerRef,...J.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ct,{url:B,style:{pointerEvents:ee.isDragging?"none":"auto"}}),!o&&t.jsx(oe,{...J.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(xt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(X=>{const se=[...X.blockletVideos];return se.splice(G,1),{...X,blockletVideos:se}})},children:t.jsx(jo,{})})]})},B)),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()&&j(!0)},children:"+"})]})})})]})]})}),t.jsxs(w.Suspense,{fallback:t.jsx(Ve,{}),children:[t.jsx(Eo,{ref:k,locale:y,popup:!0,onUploadFinish:R=>{var q;l({blockletLogo:R.data.filename}),g(""),(q=k.current)==null||q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:L,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(Nn,{onClose:()=>j(!1),params:s,setParams:l}),t.jsx(Eo,{ref:x,popup:!0,onUploadFinish:R=>{var q;l(B=>{var J;const G=B.blockletScreenshots||[];return G.push((J=R.data)==null?void 0:J.filename),{...B,blockletScreenshots:G}}),(q=x.current)==null||q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:_,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-S.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")]})]})}En.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 Ci=ae.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 so={},Ri=he;Object.defineProperty(so,"__esModule",{value:!0});var An=so.default=void 0,Si=Ri(be()),Ii=t;An=so.default=(0,Si.default)((0,Ii.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 Di=(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},Ti=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*_i(e,o){let n=0;for(;n<e.size;)yield e.slice(n,n+o),n+=o}const Pi=async({did:e,projectId:o,uploadType:n="logo",imageUrl:r})=>{const s=await Ti(r);new FormData().append("file",s);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(s.name),name:encodeURIComponent(s.name),type:s.type},c=(await ho.post(ce(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(b=>`${b} ${btoa(i[b])}`).join(",")}})).headers.location,f=2*1024*1024;let m=0,g="";for(const b of _i(s,f)){const p=await ho.patch(ce(H.WELLKNOWN_SERVICE_PATH_PREFIX,c),b,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":m,"Content-Type":"application/offset+octet-stream"}});m+=b.size,g=p.data.filename}return g},On=({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?Ie.valid(e.blockletVersion)||s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===re.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},Li=({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(!Ie.valid(e.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!e.note)return n("blocklet.publish.errorTip.noNote")}return""};function ro({blocklet:e,releaseId:o,connectedStores:n,projectId:r,releaseType:s,publishedStoreIds:l,onPublish:i,onDelete:a,projectType:c,componentDid:f,onOpenConnectStore:m,behavior:g,onSelectConnectStore:b}){var C,P;const{t:p}=Q(),{actions:{refreshBlocklet:y}}=_e(),{session:v}=rt(),{storeList:I}=xn({fromBlocklet:!0,blocklet:e,componentDid:f,userDid:(C=v==null?void 0:v.user)==null?void 0:C.did}),k=w.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((D,j)=>(D[j.storeId]=j,D),{}):{},[n]),x=(P=e==null?void 0:e.meta)==null?void 0:P.did;return t.jsxs(t.Fragment,{children:[g==="connect"&&!!(I!=null&&I.length)&&t.jsx(Uo,{severity:"info",style:{width:"100%"},children:t.jsxs(u,{color:es[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(Os,{sx:{marginLeft:1}})]})}),t.jsx(ts,{children:I==null?void 0:I.map(D=>t.jsx(os,{"data-cy":"store-switch",children:t.jsx(ns,{children:t.jsx(Ps,{behavior:g,onSelectConnectStore:b,releaseId:o,projectId:r,releaseType:s,kind:"publish",teamDid:x,store:D,published:(l==null?void 0:l.indexOf(D.id))>-1,connectedStore:k[D.id],onPublish:i,onDelete:a,scope:D.scope||"studio",onOpenConnectStore:m})})},D.url))}),t.jsx(rn,{teamDid:x,storeList:I,scope:"studio",onAdd:y})]})}ro.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};ro.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function zn({did:e,params:o,setParams:n,projectId:r,open:s,onClose:l}){const{t:i}=Q(),[a,c]=w.useState(!1),{api:f}=me(),[m,g]=w.useState(!1),[b,p]=w.useState(!1),y=()=>{g(o.autoUpload),p(o.possibleSameStore),c(!1),l(!1)},v=async()=>{c(!0);try{await f.updateProject({input:{did:e,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!m,possibleSameStore:!!b}}),n({autoUpload:m,possibleSameStore:b}),l(!1)}catch(k){W.error(k.message)}c(!1)};w.useEffect(()=>{g(o.autoUpload),p(o.possibleSameStore)},[o]);const I=!!(r&&r!==H.UNOWNED_DID);return t.jsx(Tt,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:s,onClose:y,actions:t.jsxs(t.Fragment,{children:[t.jsx(Y,{onClick:k=>{k.stopPropagation(),l()},color:"inherit",children:i("common.cancel")}),I&&t.jsxs(Y,{onClick:k=>{k.stopPropagation(),v()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a,variant:"contained",autoFocus:!0,children:[a&&t.jsx(Ye,{size:16}),i("common.confirm")]})]}),children:I?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:ne,icon:"ph:upload",sx:{fontSize:24,mr:2}}),t.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),t.jsx(ye,{checked:m,onChange:(k,x)=>g(x)})]}),t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:ne,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(ye,{checked:b,onChange:(k,x)=>p(x)})]})]}):t.jsxs(u,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[t.jsx(u,{component:ne,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),t.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}zn.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 Mn({downloadUrl:e,installUrl:o,handleSetTip:n,isPack:r,disabled:s}){const{t:l}=Q(),[i,a]=w.useState(!1),c=w.useRef(null),f=()=>{a(!i)},m=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:ne,sx:{fontSize:18},icon:"bxs:download"})}),t.jsx(Fo,{sx:{zIndex:10},open:i,anchorEl:c.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>t.jsx(Ho,{...g,style:{transformOrigin:"center top"},children:t.jsx(St,{children:t.jsx(Go,{onClickAway:m,children:t.jsxs(Xo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&t.jsx(u,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(ue,{sx:{color:"#333"},children:[t.jsx(u,{component:ne,sx:{mr:1},icon:"ic:round-install-desktop"}),t.jsx(A,{variant:"inherit",children:l("blocklet.publish.installToThisServer")})]})}),t.jsxs(ue,{onClick:n,children:[t.jsx(u,{component:ne,sx:{mr:1},icon:"iconamoon:copy"}),t.jsx(A,{variant:"inherit",children:l("blocklet.publish.copyInstallUrl")})]}),t.jsx(u,{component:"a",href:e,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(ue,{sx:{color:"#333"},children:[t.jsx(u,{component:ne,sx:{mr:1},icon:"ph:download"}),t.jsx(A,{variant:"inherit",children:l("common.download")})]})})]})})})})})]})}Mn.propTypes={disabled:d.bool.isRequired,isPack:d.bool.isRequired,downloadUrl:d.string.isRequired,installUrl:d.string.isRequired,handleSetTip:d.func.isRequired};var Bo;const Ao=(Bo=window.env)==null?void 0:Bo.serverEndpoint;function Bn({projectId:e,params:o,setParamsErrTip:n,initUrl:r,setParams:s,mode:l,loading:i,blocklet:a,release:c,isPublished:f,releaseId:m,getData:g,getRelease:b,paramsErrTip:p,componentDid:y,resourceRelateComponents:v,disabledSelectComponents:I,saveSelectedEventsRef:k,hasSelectedResources:x,initLogoUrl:C,setLoading:P,releaseUsedLast:D,setReleaseUsedLast:j,projectType:T}){var qe;const{t:O,locale:U}=Q(),{api:L}=me(),_=Rt(),[h,S]=w.useState(!1),[E,V]=w.useState(!1),[M,R]=w.useState(),q=Me(te=>te.breakpoints.down("md")),B=w.useMemo(()=>{var te;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((te=o==null?void 0:o.blockletComponents)==null?void 0:te.length)>0?(o==null?void 0:o.blockletComponents.find($=>$.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),G=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:y},"*"),b()},J=async te=>{var $e,Re,We,Ue;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 ge=On({params:o,hasSelectedResources:x,projectId:e,status:te,t:O});if(ge){W.error(ge.map(F=>F.message).join("; ")),n(ge.reduce((F,Z)=>({...F,[Z.param]:Z.message}),{}));return}const $={...o};if($.blockletComponents=Di($.blockletComponents,a,v,I),$.blockletVersion=Ie.valid($.blockletVersion),!$.blockletVersion){W.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(C)try{const F=await Pi({did:a.meta.did,projectId:e,imageUrl:C});$.blockletLogo=F,s({blockletLogo:F})}catch(F){W.error(F.message);return}if(o.resourceFromSelect){$.uploadedResource="";try{const F=Object.keys(k.current);await et(F.map(Z=>()=>{const Fe=k.current[Z];return ar({api:L,locale:U,projectId:e,releaseId:D?"":m,appDid:a.meta.did,component:Fe.component,resources:Fe.resources,initUrl:r})}),{concurrency:2})}catch(F){W.error(((We=(Re=($e=F==null?void 0:F.response)==null?void 0:$e.data)==null?void 0:Re.error)==null?void 0:We.message)||F.message),n({blockletResource:"Invalid save the resource"});return}}else(Ue=o.blockletDocker)!=null&&Ue.dockerImage||($.blockletComponents=[]);$.blockletTitle=($.blockletTitle||"").trim(),$.blockletDescription=($.blockletDescription||"").trim(),$.blockletSupport=($.blockletSupport||"").trim(),$.blockletHomepage=($.blockletHomepage||"").trim(),$.blockletCommunity=($.blockletCommunity||"").trim(),$.blockletRepository=($.blockletRepository||"").trim(),$.blockletIntroduction=($.blockletIntroduction||"").trim(),$.note=($.note||"").trim(),$.blockletComponents=(($==null?void 0:$.blockletComponents)||[]).filter(F=>F.included).map(F=>qt(F,["did","required"])).map(JSON.stringify),$.contentType!=="docker"&&($.blockletDocker={dockerImage:"",dockerArgs:[],dockerEnvs:[]});try{await L.createRelease({input:{...$,did:a.meta.did,projectId:e,releaseId:D?"":m,status:te}}),te==="draft"?W.success(O("blocklet.publish.saveDraftSuccess")):(j(!1),W.success(O("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:y},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(F){const Z=De(F);W.error(Z),(/resource/.test(Z)||/zip/.test(Z))&&n({blockletResource:Z});return}const we=await L.getProject({input:{did:a.meta.did,projectId:e}}),Ce=we.project.lastReleaseId;o.autoUpload&&await et(we.project.connectedStores.map(F=>async()=>{try{const Z=await L.publishToStore({input:{did:a.meta.did,storeId:F.storeId,storeName:F.storeName,projectId:e,releaseId:Ce,type:B}});W.success(t.jsx(Ls,{storeName:F.storeName,storeUrl:F.storeUrl,developerDid:F.developerDid,published:Z.url==="published"}),{duration:1e4})}catch(Z){W.error(De(Z))}}),{concurrency:4}),G==null||G(),_(`../${e}/view/${Ce}`,{replace:!0})},ee=te=>(P(!0),J(te).finally(()=>{P(!1)})),X=async te=>{await gr(L,te),g()},se=()=>{V(!0)},ie=ce(Ao,`/api/project/${a.meta.did}/${e}/${m}/release/blocklet.json`),xe=new URL(Ao);xe.pathname=ce(xe.pathname,"/launch-blocklet/agreement"),xe.searchParams.set("blocklet_meta_url",ie);const Pe=xe.href,Le=()=>R(ie);return t.jsxs(t.Fragment,{children:[t.jsx(qi,{className:"sticky-header",children:t.jsxs(u,{display:"flex",alignItems:"center",flexDirection:"row",children:[t.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(le,{to:"../",children:O("common.blockletStudio")}),e===H.UNOWNED_DID?t.jsx(A,{color:"text.primary",children:t.jsx(pe,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):t.jsx(le,{to:`../${e}`,children:t.jsx(pe,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),t.jsx(A,{color:"text.primary",children:l==="create"?O("common.create"):(o==null?void 0:o.blockletVersion)||O("common.edit")})]}),t.jsx(u,{flex:"1"}),!f&&t.jsxs(bt,{disabled:i,variant:"contained",children:[t.jsxs(Y,{variant:"contained",onClick:()=>ee(re.PROJECT.RELEASE_STATUS.published),children:[i&&t.jsx(Ye,{size:14,sx:{mr:.5},color:"inherit"}),O("blocklet.publish.createRelease")]}),t.jsx(Y,{variant:"contained",onClick:se,children:t.jsx(ne,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(It,{fullWidth:!0,maxWidth:"sm",open:M,onClose:()=>R(""),children:t.jsxs(u,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(A,{variant:"h6",sx:{mb:2},children:O("blocklet.publish.installResourceTip")}),t.jsx(As,{children:M}),t.jsxs(A,{sx:{mt:2},children:[O("blocklet.publish.installResourceTip2"),t.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:O("blocklet.publish.installResourceHelp")})]})]})}),t.jsxs(bt,{disabled:i,variant:"contained",children:[t.jsxs(Y,{onClick:()=>S(!0),children:[i?t.jsx(Ye,{size:14,sx:{mr:1},color:"inherit"}):t.jsx(An,{sx:{fontSize:"1.3em",mr:1}}),O(q?"common.upload":"blocklet.publish.connectOrUpload")]}),t.jsx(Mn,{isPack:B==="pack",downloadUrl:ce(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${m}/download/${(c.files||[])[0]}`),installUrl:Pe,handleSetTip:Le}),t.jsx(Y,{onClick:se,children:t.jsx(ne,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),t.jsx(Tt,{title:O("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:h,onClose:()=>S(!1),children:t.jsx(ro,{projectType:T,blocklet:a,releaseType:B,projectId:e,releaseId:m,componentDid:y,onPublish:G,onOpenConnectStore:X,onDelete:g,connectedStores:o.connectedStores||[],publishedStoreIds:c==null?void 0:c.publishedStoreIds})}),t.jsx(zn,{did:(qe=a==null?void 0:a.meta)==null?void 0:qe.did,params:o,projectId:e,open:E,setParams:s,onClose:()=>V(!1)})]})}Bn.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 qi=ae.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 Vn({text:e}){return e?t.jsx(zs,{wrapperElement:{"data-color-mode":"light"},source:js.sanitize(e),rehypePlugins:[[Ms,{target:"_blank"}]]}):t.jsx(Te,{Icon:Nt})}Vn.propTypes={text:d.string.isRequired};function Wn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var m;const{t:i}=Q(),[a,c]=w.useState(l?"preview":"write"),f=(g,b)=>{c(b)};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(Zo,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(Ze,{value:"write",label:"Write"}),t.jsx(Ze,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(K,{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:[((m=e==null?void 0:e.blockletIntroduction)==null?void 0:m.length)||0," / ",re.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,re.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(Vn,{text:e.blockletIntroduction||""})})]})}Wn.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 io={},$i=he;Object.defineProperty(io,"__esModule",{value:!0});var Un=io.default=void 0,Ni=$i(be()),Oo=t;Un=io.default=(0,Ni.default)([(0,Oo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Oo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function lo({step:e,ok:o,active:n,error:r}){let s="grey.500",l=e+1;return o&&(l=t.jsx(Bs,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",l=t.jsx(Un,{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})}lo.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};lo.defaultProps={step:0,ok:!1,active:0,error:""};function Fn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:f}=Q(),m=()=>{n(y=>y+1)},g=()=>{n(y=>y-1)},b=y=>y===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription)||(i==null?void 0:i.blockletHomepage)||(i==null?void 0:i.blockletSupport)||(i==null?void 0:i.blockletCommunity)||(i==null?void 0:i.blockletRepository):y===2?(i==null?void 0:i.blockletResource)||(i==null?void 0:i.blockletDocker)||(i==null?void 0:i.dockerImageName):y>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||On({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(ss,{activeStep:o,orientation:"vertical",children:e.map((y,v)=>{const I={},k=l||!Li({hasSelectedResources:r,params:s,projectId:c,step:v,t:f}),x=l?"":b(v);return x&&(I.optional=t.jsx(A,{variant:"caption",color:"error",children:x}),I.error=!0),t.jsxs(rs,{children:[t.jsx(is,{icon:t.jsx(lo,{error:x,active:p?99:o,step:v,ok:k}),sx:{cursor:"pointer",color:x?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...I,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:x||!k&&o>v?"error.main":"inherit",children:y.label})}),t.jsxs(ls,{children:[t.jsx(A,{fontSize:12,children:y.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[v<e.length-1&&t.jsx(Y,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:x||!k,children:f("common.continue")}),v>0&&t.jsx(Y,{disabled:v===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},y.label)})}),o>=e.length-1&&t.jsx(St,{square:!0,elevation:0,sx:{p:3},children:t.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Fn.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 Ei=[".zip",".gz"],Ai=1024*1024*100,Oi=w.lazy(()=>en(()=>import("./index-BkZLaapf.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function co({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a,locale:c}=Q(),f=w.useRef(null),m=()=>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(ke,{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 b;m()&&((b=f.current)==null||b.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(w.Suspense,{fallback:t.jsx(Ve,{}),children:t.jsx(Oi,{ref:f,locale:c,popup:!0,onUploadFinish:b=>{var p;s({uploadedResource:b.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:Ei,maxFileSize:Ai,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:i})]})}co.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};co.defaultProps={};function ot({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(K,{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(K,{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," / ",re.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,re.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}ot.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};ot.defaultProps={};function Hn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Hn(e[o]);return e}function nt({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:l,readOnly:i}){const a=(o==null?void 0:o.value)||"",[c,f]=w.useState(!1),m=()=>{var L;(L=n[s])==null||L.splice(e,1),r({...n,[s]:[...n[s]]})},g=(L,_)=>{var h;(h=n[s])!=null&&h[e]&&(_?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${ut(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},b=(L,_)=>{var S;const h=((S=n[s][e])==null?void 0:S.value)||"";n[s][e]={...n[s][e],secure:_,value:_&&h===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":h},r({...n,[s]:[...n[s]]})},p=(L,_)=>{n[s][e]={...n[s][e],shared:_},r({...n,[s]:[...n[s]]})},y=(L,_)=>{var S;const h=((S=n[s][e])==null?void 0:S.value)||"";n[s][e]={...n[s][e],required:_,value:_&&h===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":h},r({...n,[s]:[...n[s]]})},v=(L,_)=>{n[s][e]={...n[s][e],value:_?re.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},I=L=>{n[s][e]={...n[s][e],description:L.target.value},r({...n,[s]:[...n[s]]})},k=L=>{const _=L.target.value==="web"?"web":"docker";_==="web"&&n.dockerArgs.forEach(E=>{E.type="docker"});const S=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:_,path:_==="docker"?S:"/",protocol:"http",prefix:_==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},x=L=>{const _=L.target.value;n[s][e]={...n[s][e],prefix:_,path:_==="*"?"/":_},r({...n,[s]:[...n[s]]})},C=L=>{var _;(_=n[s])!=null&&_[e]&&(n[s][e].value=L.target.value),r({...n,[s]:[...n[s]]})},P=a===`$${ut(o.key)}`||o.custom,D=s==="dockerArgs"&&!ln[o.key],j=qs[o.key],T=s==="dockerEnvs",O=o.key==="--publish";let U=o.key;return O&&o.type==="web"?U="--publish (Web)":T&&(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(K,{disabled:i||P||D||o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:P?`$${ut(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Be,{position:"end",sx:{zoom:.9},children:[(!(j||D)||T||O)&&t.jsx(oe,{onClick:()=>f(!0),children:t.jsx(ne,{icon:"icon-park-outline:setting-config"})}),!i&&t.jsx(oe,{onClick:m,color:D?"error":"default",children:t.jsx(ne,{icon:"ic:round-delete"})})]})},error:D,onChange:C}),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"&&$s[o.key](a)&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Tt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:l(T?"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:[j||D||T?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(ye,{disabled:i,checked:P,onChange:g,sx:{zoom:.9}})]}),T&&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(ye,{disabled:i,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),T&&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(ye,{disabled:i,checked:o.required,onChange:y,sx:{zoom:.9}})]}),T&&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(ye,{disabled:i,checked:o.secure,onChange:b,sx:{zoom:.9}})]}),T&&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(ye,{disabled:i,checked:o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),T&&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(K,{disabled:i,value:o.description,onChange:I,sx:{flex:1},label:l("blocklet.publish.docker.description")})]}),O&&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(Ko,{value:o.type||"docker",onChange:k,children:[t.jsx(ue,{value:"docker",children:"Docker"}),t.jsx(ue,{value:"web",children:"Web"})]})]}),O&&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(K,{disabled:i,value:o.prefix,onChange:x,sx:{flex:1},label:l("blocklet.publish.docker.prefix")})]})]})})]})}nt.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};nt.defaultProps={};const zi=`
|
|
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 ao({readOnly:e,paramsErrTip:o,setParamsErrTip:n,error:r,params:s,setParams:l}){const{t:i}=Q(),[a,c]=w.useState("dockerParams"),[f,m]=w.useState(""),[g,b]=w.useState(!1),[p,y]=w.useState("--volume"),[v,I]=w.useState(""),[k,x]=w.useState(ko(f)),C=k.dockerArgs||[],P=k.dockerEnvs||[],D=k.dockerImage||"",j=_=>{const{value:h}=_.target;m(h)};w.useEffect(()=>{s.blockletDocker&&s.blockletDocker.dockerImage&&!D&&x(s.blockletDocker)},[s,D,x]);const T=_=>{const h=ko(_.target.value);x(S=>{let E,V=!1;return h.dockerArgs.forEach(M=>{const R=S.dockerArgs.find(q=>q.key===M.key);R&&(Object.entries(R).forEach(([q,B])=>{B!=null&&q!=="value"&&(M[q]=B)}),M.type==="web"&&(M.path="/",M.protocol="http",M.prefix="/",M.name="publicUrl",M.port="BLOCKLET_PORT",V=!0),!E&&M.key==="--publish"&&(E=M))}),!V&&E&&(E.type="web",E.path="/",E.protocol="http",E.prefix="/",E.name="publicUrl",E.port="BLOCKLET_PORT"),h.dockerEnvs.forEach(M=>{const R=S.dockerEnvs.find(q=>q.key===M.key);R&&Object.entries(R).forEach(([q,B])=>{B!=null&&q!=="value"&&(M[q]=B)})}),h})},O=()=>{if(b(!1),p==="--env"){x({...k,dockerEnvs:[...P,{key:v,value:"",custom:"",secure:!1,shared:!1,required:!1,description:v}]}),I("");return}x({...k,dockerArgs:[...C,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},U=()=>{b(!1),I("")},L=_=>{const{value:h}=_.target;x({...k,dockerImage:h}),h.indexOf(" ")>-1?n({...o,dockerImageName:i("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})};return w.useEffect(()=>{a==="dockerCommand"&&m(Ns(k))},[k,a]),w.useEffect(()=>{l(_=>({..._,blockletDocker:{dockerImage:k.dockerImage,dockerArgs:k.dockerArgs,dockerEnvs:k.dockerEnvs}}))},[k,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(Zo,{value:a,onChange:(_,h)=>c(h),children:[t.jsx(Ze,{value:"dockerParams",label:i("blocklet.publish.docker.dockerParams")}),t.jsx(Ze,{value:"dockerCommand",label:i("blocklet.publish.docker.dockerCommand")})]})}),a==="dockerCommand"&&t.jsx(K,{disabled:e,label:i("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:zi,InputProps:{"data-cy":"blocklet-docker-command",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:j,onBlur:T}),a==="dockerParams"&&t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx(K,{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:L}),t.jsx(A,{variant:"caption",color:"text.secondary",children:"Example: docker.io/postgrest/postgrest:latest"}),t.jsx(u,{sx:{height:4}}),C.map((_,h)=>t.jsx(nt,{index:h,item:_,dockerParams:k,setDockerParams:x,dataKey:"dockerArgs",t:i,readOnly:e},`${_.key}-${h}`)),P.map((_,h)=>t.jsx(nt,{index:h,item:_,dockerParams:k,setDockerParams:x,dataKey:"dockerEnvs",t:i,readOnly:e},`${_.key}-${h}`)),!e&&t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{flex:1}}),t.jsx(Y,{onClick:()=>b(!0),children:i("blocklet.publish.docker.addItem")})]})]})]}),!!r&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:r}),g&&t.jsxs(It,{fullWidth:!0,open:!0,children:[t.jsx(Jo,{children:i("blocklet.publish.docker.addItem")}),t.jsx(Qo,{children:t.jsxs(cs,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[t.jsx(Ko,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:_=>y(_.target.value),children:Object.keys(ln).map(_=>t.jsx(ue,{value:_,children:_}))}),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(K,{value:v,onChange:_=>I(_.target.value),sx:{width:"100%"},label:i("blocklet.publish.docker.envKey")}),t.jsx(as,{children:i("blocklet.publish.docker.dockerArgValue")})]})]})}),t.jsxs(Yo,{children:[t.jsx(Y,{onClick:U,children:i("common.cancel")}),t.jsx(Y,{onClick:O,children:i("common.confirm")})]})]})]})}ao.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};ao.defaultProps={};const Mi=({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(Lt,{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=qt(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},Bi={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Mo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function uo({initUrl:e,...o}){var po;const{projectId:n,mode:r,releaseId:s,componentDid:l=""}=st(),{t:i}=Q(),{blocklet:a}=_e(),[c,f]=Se({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[m,g]=Se({}),[b,p]=w.useState(!1),[y,v]=Se(null),{api:I}=me(),k=Me(N=>N.breakpoints.down("md")),[x,C]=w.useState({}),[P,D]=w.useState(!1),j=w.useRef({}),[T,O]=Se({}),[U,L]=w.useState(""),[_,h]=Se({}),S=e==null?void 0:e.searchParams.get("dependentComponentsMode"),E=S==="readonly",V=w.useMemo(()=>{const N={};return Object.keys(_).forEach(z=>{const je=_[z];je&&je.forEach(Xn=>{N[Xn]=!0})}),N},[_]),M=w.useCallback(N=>{E&&f({blockletComponents:[]}),h(N)},[E,h,f]),R=w.useCallback((...N)=>{O(...N),g({blockletResource:"",blockletDocker:""})},[]),q=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[B,G]=w.useState(r==="new-release"?4:0),J=e==null?void 0:e.searchParams.get("resourcesTitle"),ee=e==null?void 0:e.searchParams.get("componentsTitle"),X=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:J||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:ee||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],se=X[B]||X[X.length-1],ie=Bi[B];w.useEffect(()=>{n&&g({projectId:""})},[n,g]);const xe=w.useMemo(()=>{var N;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":(N=c==null?void 0:c.blockletComponents)!=null&&N.some(z=>z.included)||Object.keys(V).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,V,c==null?void 0:c.blockletResourceType]),Pe=[],Le=((a==null?void 0:a.children)||[]).filter(N=>{var z;return(z=N.meta.resource)==null?void 0:z.exportApi}).filter(N=>!l||N.meta.did===l);Le.forEach(N=>{Mi({tabs:Pe,blocklet:N,t:i,ancestors:[a]})});const[qe,te]=w.useState((po=Pe[0])==null?void 0:po.value),ge=!P&&(y==null?void 0:y.status)==="published",$=ge,we=Rs(()=>{if(!e)return;L(e.searchParams.get("logo")),f(z=>{var je;return{...z,blockletTitle:(z==null?void 0:z.blockletTitle)||e.searchParams.get("title"),blockletDescription:(z==null?void 0:z.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(z==null?void 0:z.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(je=z==null?void 0:z.blockletComponents)!=null&&je.length?z==null?void 0:z.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(z==null?void 0:z.note)||e.searchParams.get("note")||"No note"}});const N=e.searchParams.get("resources");try{const z=JSON.parse(N);C(z)}catch{}}),Ce=async()=>{if(q)try{const N=await I.getRelease({input:{did:a.meta.did,projectId:n,releaseId:q}});if(p(!1),!N.release){W.error("Release not found");return}N.release=Hn(N.release),r!=="view"&&(N.release.note=""),f(z=>zo({...z,...N.release,blockletVersion:r==="create"||r==="new-release"?Ie.inc(N.release.blockletVersion,"patch"):N.release.blockletVersion},a)),v(N.release)}catch(N){p(!1),W.error(De(N))}},$e=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 z=(await fn(I.getProject,[{input:{did:a.meta.did,projectId:n}}],{key:"getProject"})).project||{};z.blockletVersion?(r==="create"||r==="new-release")&&Ie.valid(z.blockletVersion)&&(z.blockletVersion=Ie.inc(z.blockletVersion,"patch")):z.blockletVersion="0.0.1";const je=zo(z,a);f(je),z.lastReleaseId||we()}catch(N){W.error(De(N))}},Re=w.useCallback(async()=>{p(!0);try{if(r==="view"){if(!q){W.error("Empty release id");return}await $e(),await Ce();return}await $e(),q&&(D(!0),await Ce())}finally{p(!1)}},[r,q]),We=N=>{f({blockletComponents:N})},Ue=N=>{f({blockletResourceType:N})};w.useEffect(()=>{Re()},[Re]),w.useEffect(()=>{n===H.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&we()},[n,e,r,we]),w.useEffect(()=>{c.contentType==="docker"?f({resourceFromSelect:!1}):c.contentType==="blocklet"?f({resourceFromSelect:!0}):c.contentType==="upload"&&f({resourceFromSelect:!1})},[c.contentType,f]);const F=w.useMemo(()=>!!Object.keys(T).find(N=>!!T[N].length),[T]);if(!c&&b)return t.jsx(Ve,{});if(!c)return null;const Z=Le.find(N=>N.meta.did===qe),Fe=N=>{te(N)};return t.jsxs(Vi,{...o,children:[t.jsx(Bn,{blocklet:a,release:y,getData:Re,getRelease:Ce,mode:r,params:c,setParams:f,setParamsErrTip:g,readOnly:$,isPublished:ge,loading:b,setLoading:p,initLogoUrl:U,releaseId:q,projectId:n,projectType:xe,resourceComponents:Le,resourceComponentsMap:_,resourceRelateComponents:V,resourceItem:Z,saveSelectedEventsRef:j,hasSelectedResources:F,releaseUsedLast:P,setReleaseUsedLast:D,setRelease:v,paramsErrTip:m}),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:k?"column":"row",children:[!k&&t.jsx(Fn,{steps:X,loading:b,viewMode:r==="view",params:c,hasSelectedResources:F||c.uploadedResource,paramsErrTip:m,activeStep:B,setActiveStep:G,projectId:n,resourcesUrlTitle:J,componentsUrlTitle:ee}),t.jsxs(u,{flex:"1",maxWidth:"720px",children:[!k&&ie!=="introduction"&&t.jsxs(A,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[se.label,ie==="branding"&&t.jsx(de,{title:i("blocklet.publish.brandingHelp"),placement:"right",children:t.jsx(u,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:t.jsx(Cs,{})})})]}),(k||ie==="branding")&&t.jsx(u,{flexDirection:"column",children:t.jsx(En,{projectId:n,setParams:f,setParamsErrTip:g,params:c,componentDid:l,blocklet:a,initUrl:e,loading:b,setLoading:p,paramsErrTip:m,readOnly:$,initLogoUrl:U,setInitLogoUrl:L})}),k&&t.jsx(u,{flexDirection:"column",children:t.jsx(ot,{loading:b,params:c,paramsErrTip:m,setParams:f,setParamsErrTip:g,readOnly:$})}),(k||ie==="introduction")&&t.jsx(u,{display:"flex",flexDirection:"column",sx:{mt:k?5:0,width:"100%"},children:t.jsx(Wn,{loading:b,readOnly:$,params:c,setParams:f,paramsErrTip:m,setParamsErrTip:g})}),k&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:X[Mo.resources].label}),t.jsx(u,{sx:{maxWidth:720},display:k||ie==="resources"?"flex":"none",flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(ds,{onChange:N=>f({contentType:N.target.value}),children:[t.jsx(Xe,{value:"blocklet",disabled:$,control:t.jsx(dt,{size:"small",checked:c.contentType==="blocklet"}),label:i("blocklet.publish.resourceSelect")}),t.jsx(Xe,{value:"upload",disabled:$,control:t.jsx(dt,{size:"small",checked:c.contentType==="upload"}),label:i("blocklet.publish.resourceUpload")}),t.jsx(Xe,{value:"docker",disabled:$,control:t.jsx(dt,{size:"small",checked:c.contentType==="docker"}),label:i("blocklet.publish.resourceDocker")})]}),t.jsxs(u,{display:c.contentType==="blocklet"?"block":"none",children:[!l&&t.jsx(ks,{tabs:Pe,current:qe,onChange:Fe,sx:{ml:-2,mt:2,maxWidth:k?window.innerWidth-24:"100%"}}),t.jsx(Xt,{loading:b,initialResources:x,saveSelectedEventsRef:j,selectedResourceIds:T,setSelectedResourceIds:R,setResourceComponentsMap:M,error:m.blockletResource,app:a,readOnly:$,component:Z,componentDid:l,initUrl:e,params:c,showTree:c.contentType==="blocklet",setParams:f,projectId:n===H.UNOWNED_DID?"":n,releaseUsedLast:P,release:{...y,id:q}})]}),c.contentType==="upload"&&t.jsx(co,{app:a,readOnly:$,projectId:n===H.UNOWNED_DID?"":n,params:c,error:m.blockletResource,setParams:f,setParamsErrTip:g}),c.contentType==="docker"&&t.jsx(ao,{app:a,readOnly:$,projectId:n===H.UNOWNED_DID?"":n,params:c,error:m.blockletResource,setParams:f,setParamsErrTip:g,paramsErrTip:m})]})})}),k&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:X[Mo.blocklets].label}),(k||ie==="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(Wt,{projectType:xe,disabled:b||$,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:We,onChangeBlockletResourceType:Ue,resourceRelateComponents:V,dependentComponentsMode:S})})})}),!k&&ie==="version"&&t.jsx(u,{flexDirection:"column",children:t.jsx(ot,{loading:b,params:c,paramsErrTip:m,setParams:f,setParamsErrTip:g,readOnly:$})})]})]})]})]})}uo.propTypes={initUrl:d.object};uo.defaultProps={initUrl:null};const Vi=ae.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 Gn({padding:e,initUrl:o}){const{blocklet:n}=_e(),r=Jn(),{componentDid:s}=st();if(w.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(Wi,{style:l,children:t.jsxs(Qn,{children:[t.jsx(at,{path:"/",element:t.jsx(Mt,{initUrl:o})}),t.jsx(at,{path:"/:projectId",element:t.jsx(Ks,{})}),t.jsx(at,{path:"/:projectId/:mode/:releaseId",element:t.jsx(uo,{initUrl:o})})]})})}Gn.propTypes={padding:d.oneOfType([d.string,d.number]),initUrl:d.object};Gn.defaultProps={padding:"",initUrl:null};const Wi=ae(u)`
|
|
225
|
+
a {
|
|
226
|
+
color: ${({theme:e})=>e.palette.primary.main};
|
|
227
|
+
}
|
|
228
|
+
`;export{Gn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,aa as r}from"./vendor-mui-core-xF5F4eT7.js";import{r as s}from"./vendor-react-D-afvo_7.js";import{
|
|
1
|
+
import{j as t,aa as r}from"./vendor-mui-core-xF5F4eT7.js";import{r as s}from"./vendor-react-D-afvo_7.js";import{a2 as a,R as e}from"./vendor-arcblock-HzAExiTd.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";function u(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{u as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d}from"./vendor-react-D-afvo_7.js";import{E as l,j as n,a3 as g,aj as A,M as G,I as L,a2 as H,bS as U,aa as Y}from"./vendor-mui-core-xF5F4eT7.js";import{
|
|
1
|
+
import{r as d}from"./vendor-react-D-afvo_7.js";import{E as l,j as n,a3 as g,aj as A,M as G,I as L,a2 as H,bS as U,aa as Y}from"./vendor-mui-core-xF5F4eT7.js";import{a2 as J,w as Q,af as Z}from"./vendor-arcblock-HzAExiTd.js";import{d as v}from"./Done-CVdTMvGH.js";import{C as ee}from"./Google-D_UbrpMW.js";import{ab as te,f as ne}from"./index-r2Lf0YIw.js";import{R as re,F as oe,L as se}from"./logo-uploader-CneV6CnS.js";const S={description:l.string,editing:l.bool,onChange:l.func,required:l.bool,value:l.any,componentProps:l.object,render:l.func,renderFormItem:l.func};function N({editing:r,value:o,onChange:a}){const[c,u]=d.useState(!1),m=d.useRef(),p=d.useRef(o);d.useEffect(()=>{let s=null;return r&&(s=setTimeout(()=>{u(!0)},50)),()=>{clearTimeout(s)}},[r]);const k=s=>{p.current=s,a(s)},b=()=>{u(!1),a(p.current)},I=n.jsx(g,{className:"form-item-input slot",px:1,children:n.jsxs(g,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&n.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=n.jsxs(g,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:b,children:[n.jsx(g,{display:"flex",alignItems:"center",onClick:()=>u(!0),children:n.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),n.jsx(A,{open:c,anchorEl:m.current,onClose:()=>u(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:n.jsx(ee,{color:o,onChange:s=>k(s.hex)})})]});return r?f:I}N.propTypes=S;function _({editing:r,description:o,value:a,onChange:c,componentProps:u,...m}){const{placeholder:p}=u,k=d.useRef(a),{t:b}=d.useContext(J),I=s=>{s.key==="Enter"&&c(k.current,"confirm")},f=s=>{k.current=s,c(s)};return r?n.jsx(G,{style:{flex:1},fullWidth:!0,value:a,onChange:s=>{s.persist(),f(s.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||p,onKeyDown:I,...m}):n.jsx(g,{px:1,className:"form-item-input slot",children:a||n.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:o||p})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function T({editing:r,value:o,onChange:a,componentProps:c,...u}){const{blocklet:m}=c,p=o==="auto"?Q.getPassportColorFromDid(m.appDid):o;return n.jsxs(g,{display:"flex",alignItems:"center",children:[n.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:te({title:"Owner",issuer:ne.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:o||"auto"})}}),n.jsx(N,{...u,editing:r,value:r?p:o,onChange:a,componentProps:c})]})}T.propTypes={...S,componentProps:l.shape({blocklet:l.object.isRequired}).isRequired};T.defaultProps={};const ie=U`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|