@abtnode/blocklet-services 1.16.37 → 1.16.38-beta-20250110-003414-d3c1bfbd
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 +24 -1
- package/api/libs/open-graph/index.js +9 -15
- package/api/libs/open-graph/template.js +15 -10
- package/api/middlewares/proxy-to-daemon.js +2 -23
- package/api/routes/blocklet.js +37 -1
- package/api/services/static.js +11 -1
- package/dist/assets/{Add-WwBlcqNF.js → Add-2VCvBnGd.js} +1 -1
- package/dist/assets/{ArrowDropDown-B6VSNrNX.js → ArrowDropDown-BdHlAt9a.js} +1 -1
- package/dist/assets/{CheckCircle-n23HoB1l.js → CheckCircle-BElcljFC.js} +1 -1
- package/dist/assets/{ChevronLeft-DV-sPxhr.js → ChevronLeft-BfF37o7u.js} +1 -1
- package/dist/assets/{ChevronRight-UF0hSKpL.js → ChevronRight-B8pf890W.js} +1 -1
- package/dist/assets/{DeleteOutline-1Utxk_IX.js → DeleteOutline-VzoIEqow.js} +1 -1
- package/dist/assets/{Done-BbnQSLvu.js → Done-BCESxXX2.js} +1 -1
- package/dist/assets/{Download-DRJvwpLt.js → Download-BJmwtO6i.js} +1 -1
- package/dist/assets/{EditIcon-DDucSncy.js → EditIcon-BF2eKBD0.js} +1 -1
- package/dist/assets/{Error-CL8m4Xu6.js → Error-CpAOVH8t.js} +1 -1
- package/dist/assets/{Google-CSKRQW0F.js → Google-rxW6OGq8.js} +1 -1
- package/dist/assets/{InfoOutlined-7hC78o3_.js → InfoOutlined-BFP30UJa.js} +1 -1
- package/dist/assets/{Launch-D9iyATKb.js → Launch-BOCFiYoz.js} +1 -1
- package/dist/assets/{LaunchOutlined-D37WOXmf.js → LaunchOutlined-B-PaS5ms.js} +1 -1
- package/dist/assets/{LockIcon-BIlUQ2kd.js → LockIcon-DQtUl5vk.js} +1 -1
- package/dist/assets/{Loop-Clmz6DRv.js → Loop-n5c7A0qE.js} +1 -1
- package/dist/assets/{MoreHoriz-CtnQ7uqf.js → MoreHoriz-DnFq43xg.js} +1 -1
- package/dist/assets/{PlayArrow-IJdeSlbo.js → PlayArrow-oA7gV2MA.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-2fDrHopp.js → QuestionMarkCircle-gL_QM35Z.js} +1 -1
- package/dist/assets/{ServerLogo-DsurTeGQ.js → ServerLogo-UNPlRpuM.js} +1 -1
- package/dist/assets/{ViewList-B-HVv7GT.js → ViewList-IMqkd2Sv.js} +1 -1
- package/dist/assets/{_createAggregator-BgG70oKG.js → _createAggregator-B4i0o6gy.js} +1 -1
- package/dist/assets/{access-control-BP0rhxZ_.js → access-control-DcliPEX2.js} +1 -1
- package/dist/assets/{actions-DsY16tuf.js → actions-BEpPU26q.js} +1 -1
- package/dist/assets/add-component-core-DSlHbXth.js +716 -0
- package/dist/assets/{add-resource-DZFTdNIy.js → add-resource-B9SUcn9b.js} +1 -1
- package/dist/assets/{addon-DUnQ9eC0.js → addon-C8Ytd8YY.js} +1 -1
- package/dist/assets/{analytics-Cym7YiQM.js → analytics-BVmtToBr.js} +1 -1
- package/dist/assets/api-C0C4sDJA.js +1 -0
- package/dist/assets/ar-DuHAbPhE.js +3 -0
- package/dist/assets/{ar-BAnh0kq-.js → ar-hiIrGdss.js} +1 -1
- package/dist/assets/{audit-logs-DtJdynVz.js → audit-logs-DOpEhbRi.js} +1 -1
- package/dist/assets/{base32-DZ5GWnEl.js → base32-COJTblwx.js} +1 -1
- package/dist/assets/{branding-DEKXfpdd.js → branding-BIbnR-Yt.js} +2 -2
- package/dist/assets/{bundle-avatar-CtN88KlG.js → bundle-avatar-DqROxHMq.js} +1 -1
- package/dist/assets/button-Bo5ZAcJk.js +1 -0
- package/dist/assets/{click-to-copy-D-rDpTU1.js → click-to-copy-DNu8CktB.js} +1 -1
- package/dist/assets/{complete-DfhluUOU.js → complete-B_C_fwut.js} +1 -1
- package/dist/assets/{component-DET9TWBv.js → component-eAmweIYL.js} +1 -1
- package/dist/assets/{config-Dx3rVqe3.js → config-CWoxBu0J.js} +1 -1
- package/dist/assets/{config-Bh1NLHps.js → config-d41PVAVu.js} +1 -1
- package/dist/assets/{config-navigation-Cn0fwBBG.js → config-navigation-jKhcoDId.js} +3 -3
- package/dist/assets/{config-space-CT9a0s7Q.js → config-space-Dofzrh5m.js} +1 -1
- package/dist/assets/{confirm-DhCXP8vW.js → confirm-C0rryr4e.js} +1 -1
- package/dist/assets/{connect-GHQ2pLWc.js → connect-CfWNBUY4.js} +1 -1
- package/dist/assets/{connect-CA2-olTo.js → connect-Wiz0Gw9I.js} +1 -1
- package/dist/assets/{connect-to-kYFiSkqc.js → connect-to-Dsq1ST9l.js} +1 -1
- package/dist/assets/{content-layout-C8ThavEP.js → content-layout-CK_AzZZ-.js} +1 -1
- package/dist/assets/{dashboard-B3UhGh-u.js → dashboard-Ca8O6iHB.js} +3 -3
- package/dist/assets/de-CJi7wiel.js +3 -0
- package/dist/assets/{de-CYAy3iib.js → de-D_LJn5nm.js} +1 -1
- package/dist/assets/{did-address-B-umhomj.js → did-address-49U3oRW2.js} +1 -1
- package/dist/assets/{domain-DzFcoe7i.js → domain-DJyjDPmO.js} +1 -1
- package/dist/assets/{domain-list-C9eJrdcx.js → domain-list-BEjAE8hh.js} +1 -1
- package/dist/assets/{email-BEr-8TYu.js → email-C3ggDSGp.js} +1 -1
- package/dist/assets/{es-Bn01DRSJ.js → es-B0ocJhTd.js} +1 -1
- package/dist/assets/es-ClwhOFrW.js +3 -0
- package/dist/assets/{exchange-passport-DGUT_ZCy.js → exchange-passport-4QuzoW2F.js} +1 -1
- package/dist/assets/{form-text-input-E0Z0s35O.js → form-text-input-CT57jMfW.js} +1 -1
- package/dist/assets/fr-CAkkNKvy.js +3 -0
- package/dist/assets/{fr-D3J0B-tk.js → fr-eolYJCOV.js} +1 -1
- package/dist/assets/{fuel-alylOU0b.js → fuel-CJ-CsgDu.js} +1 -1
- package/dist/assets/{fullpage-DZPI7F_L.js → fullpage-CFp4hSHz.js} +1 -1
- package/dist/assets/{get-safe-url-ByH0hntp.js → get-safe-url-CVhAz4Qr.js} +1 -1
- package/dist/assets/{get-safe-url-yHkHYeNB.js → get-safe-url-RTzyOi09.js} +1 -1
- package/dist/assets/hi-CGrG89HI.js +1 -0
- package/dist/assets/{hi-DdEYPkL3.js → hi-DSwvTH0x.js} +1 -1
- package/dist/assets/{home-DG81Vlwd.js → home-D1QP6Ilh.js} +1 -1
- package/dist/assets/{id-C6kfQsmT.js → id-5G9oPRk4.js} +1 -1
- package/dist/assets/id-D6PyIa8m.js +3 -0
- package/dist/assets/{iframe-BB-pL0gd.js → iframe-BUonayoL.js} +1 -1
- package/dist/assets/{index-Cp3ZCh7o.js → index-BGO2DsWz.js} +1 -1
- package/dist/assets/{index-BRPzwIuP.js → index-BP6sEHV5.js} +1 -1
- package/dist/assets/index-BPF3oif7.js +228 -0
- package/dist/assets/{index-BaA1-UNL.js → index-BQCwe2Vs.js} +1 -1
- package/dist/assets/{index-CxWy6IEg.js → index-BQxL3qXG.js} +1 -1
- package/dist/assets/{index-B8B9jSby.js → index-BZnWmdZ0.js} +1 -1
- package/dist/assets/{index-7gknQYQQ.js → index-Bi1xb9O8.js} +1 -1
- package/dist/assets/{index-e4kRKwa5.js → index-Bxg1LKG8.js} +1 -1
- package/dist/assets/index-CQT4qLcx.js +1 -0
- package/dist/assets/{index-jViTGvBx.js → index-CqPx8QUY.js} +1 -1
- package/dist/assets/{index-CU_Y2Ics.js → index-CrvlY8Z5.js} +1 -1
- package/dist/assets/{index-CEyrfuix.js → index-D7mJIWyJ.js} +1 -1
- package/dist/assets/{index-DjDooCTg.js → index-DMelUylN.js} +4 -4
- package/dist/assets/{index-CcsFwEG1.js → index-DQSF6ElG.js} +1 -1
- package/dist/assets/{index-DNd_40WG.js → index-IdPbsC-k.js} +1 -1
- package/dist/assets/{index-SrY9WLdy.js → index-ROkOEO9F.js} +1 -1
- package/dist/assets/index-l4yaELph.js +144 -0
- package/dist/assets/{index-Dk8-Ibsd.js → index-mnKcDZP2.js} +1 -1
- package/dist/assets/{index-tDqjC_e2.js → index-wG4Kh8A_.js} +6 -6
- package/dist/assets/{invitation-BNOVM03D.js → invitation-Dn2JFqk3.js} +1 -1
- package/dist/assets/{invite-CDXZxcmB.js → invite-k-THgUaE.js} +1 -1
- package/dist/assets/{issue-passport-1v1d15DW.js → issue-passport-Cp0z7zOC.js} +1 -1
- package/dist/assets/item-DqTNLhw3.js +2 -0
- package/dist/assets/{ja-DN837plG.js → ja-B2h7onKc.js} +1 -1
- package/dist/assets/ja-C82Szos_.js +3 -0
- package/dist/assets/{ko-LU148n3o.js → ko-B8lz4XE7.js} +1 -1
- package/dist/assets/ko-zaXquvPm.js +3 -0
- package/dist/assets/{launch-result-message-BEuCq9h1.js → launch-result-message-zXOcVqEr.js} +1 -1
- package/dist/assets/{layout-PlCf3Rtw.js → layout-BRN0uPvp.js} +1 -1
- package/dist/assets/{list-header-DdT6PG1D.js → list-header-Bn1GhGok.js} +1 -1
- package/dist/assets/localization-L03Lvx4v.js +1 -0
- package/dist/assets/{log-B5iPDWZ_.js → log-D1ShKaDY.js} +1 -1
- package/dist/assets/{login-DvM79Mfd.js → login-D9awP98G.js} +1 -1
- package/dist/assets/{login-oauth-callback-CO19RzCL.js → login-oauth-callback-DHA7e6Ar.js} +1 -1
- package/dist/assets/{logo-uploader-CNnYMPxh.js → logo-uploader-BA8U554_.js} +3 -3
- package/dist/assets/{lost-passport-DsG6aS5u.js → lost-passport-kJqVsdV1.js} +1 -1
- package/dist/assets/{open-window-Km_9DMrz.js → open-window-B-5Hms7z.js} +1 -1
- package/dist/assets/{overview-Dc_26DuW.js → overview-4bff7RWe.js} +1 -1
- package/dist/assets/{page-header-B3m4UCOV.js → page-header-6EUz18Qu.js} +1 -1
- package/dist/assets/{permission-C7OYX2OJ.js → permission-SgzW7fBj.js} +1 -1
- package/dist/assets/{preferences-Ci4dS6YC.js → preferences-RkqN3i2t.js} +1 -1
- package/dist/assets/pt-CMq2TmiV.js +1 -0
- package/dist/assets/{pt-CSZkEO8C.js → pt-JWdcQImo.js} +1 -1
- package/dist/assets/publish-resource-BhQQlAPL.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-D6d5Zfr8.js → react-beautiful-dnd.esm-C8vTtkBe.js} +1 -1
- package/dist/assets/{relative-time-BHAJs1ji.js → relative-time-BXb5Mt72.js} +1 -1
- package/dist/assets/ru-BwmmHWZS.js +1 -0
- package/dist/assets/{ru-CPz1NiGU.js → ru-CWgdu04g.js} +1 -1
- package/dist/assets/sdk-Dqc91xl4.js +1 -0
- package/dist/assets/{session-UImnJahL.js → session-ocxAyn6f.js} +1 -1
- package/dist/assets/{setup-LHpIYQbe.js → setup-DTQXAoXZ.js} +3 -3
- package/dist/assets/{shorten-label-CKNjZbhF.js → shorten-label-BnvWOC_s.js} +1 -1
- package/dist/assets/{simple-select-BMYrmYam.js → simple-select-BwufbE2b.js} +1 -1
- package/dist/assets/{slicedToArray-BPEJIbVV.js → slicedToArray-DNAGECrJ.js} +1 -1
- package/dist/assets/{start-DxAs4dHz.js → start-DNpygdxp.js} +1 -1
- package/dist/assets/{step-actions-FdD-71wr.js → step-actions-ClTz1KhK.js} +1 -1
- package/dist/assets/{studio-g2uaz9WG.js → studio-DPoV-6q9.js} +1 -1
- package/dist/assets/{switch-control-BMO1MVhi.js → switch-control-D-IROOaC.js} +1 -1
- package/dist/assets/{th-DN9Th20c.js → th-BnfuNX_7.js} +1 -1
- package/dist/assets/{th-CKxPcxWD.js → th-C-hKn9xa.js} +1 -1
- package/dist/assets/{toUpper-DUImrX4s.js → toUpper-BQrWudMF.js} +1 -1
- package/dist/assets/{transfer-Bq5kjW_S.js → transfer-A_yTwCWw.js} +1 -1
- package/dist/assets/{unsubscribe-DUmfJRPR.js → unsubscribe-uaBnibKD.js} +1 -1
- package/dist/assets/{use-mobile-DOkke39c.js → use-mobile-DAR0hmJd.js} +1 -1
- package/dist/assets/{useAsync-BfmmMB4I.js → useAsync-cdOzMWPw.js} +1 -1
- package/dist/assets/{useAsyncRetry-m5oMMmVh.js → useAsyncRetry-KXMle3o0.js} +1 -1
- package/dist/assets/{useLocalStorage-ganqTrK6.js → useLocalStorage-CSyjxtUy.js} +1 -1
- package/dist/assets/{user-center-CYnDNkIf.js → user-center-B3stHKHJ.js} +1 -1
- package/dist/assets/{util-CmcVraD_.js → util-ao8gSgii.js} +1 -1
- package/dist/assets/{vendor-arcblock-Dn16DH88.js → vendor-arcblock-CiLB_TiI.js} +8 -8
- package/dist/assets/{vendor-hooks-DzETutIU.js → vendor-hooks-CLzfFpO7.js} +1 -1
- package/dist/assets/{vendor-mui-core-COxJgW9_.js → vendor-mui-core-BlX2BJoA.js} +31 -31
- package/dist/assets/{vendor-mui-x-Be0GxtOJ.js → vendor-mui-x-Bq1FyQ7S.js} +1 -1
- package/dist/assets/{vendor-utils-CV7RLr7b.js → vendor-utils-DCpRgzMR.js} +4 -4
- package/dist/assets/{vi-DsheN6LQ.js → vi-C_iM9J2X.js} +1 -1
- package/dist/assets/{vi-ChReTICx.js → vi-D7HQHu1T.js} +1 -1
- package/dist/assets/wrap-locale-DNve09jN.js +1 -0
- package/dist/assets/{zh-BJMvTFip.js → zh-DNY792IC.js} +1 -1
- package/dist/assets/zh-tw-9sY6BN2s.js +3 -0
- package/dist/assets/{zh-tw-DkLkQUwb.js → zh-tw-jFbTVB_K.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/manifest.webmanifest +1 -0
- package/dist/registerSW.js +1 -0
- package/dist/service-worker.js +1 -1
- package/dist/share/shared-service-worker.js +55 -26
- package/package.json +32 -31
- package/dist/assets/add-component-core-C8hvHJq0.js +0 -716
- package/dist/assets/api-C7qcY4XU.js +0 -1
- package/dist/assets/ar-DJ10cGfc.js +0 -3
- package/dist/assets/button-CPeDg26t.js +0 -1
- package/dist/assets/de-5ORoKwiw.js +0 -3
- package/dist/assets/es-CWClvbjs.js +0 -3
- package/dist/assets/fr-CE8mlhdK.js +0 -3
- package/dist/assets/hi-DVuJdQme.js +0 -1
- package/dist/assets/id-L6JUyxUh.js +0 -3
- package/dist/assets/index-B-0OFwWF.js +0 -144
- package/dist/assets/index-CYh2QqLk.js +0 -1
- package/dist/assets/index-DHmJ4NAw.js +0 -221
- package/dist/assets/item-DoetJFaA.js +0 -1
- package/dist/assets/ja-C5orBePq.js +0 -3
- package/dist/assets/ko-BeIurXFC.js +0 -3
- package/dist/assets/localization-Cm0dNj2B.js +0 -1
- package/dist/assets/pt-BED0VqHV.js +0 -1
- package/dist/assets/publish-resource-BumbS1yx.js +0 -1
- package/dist/assets/ru-B5wj2v7e.js +0 -1
- package/dist/assets/sdk-0UwYHc-i.js +0 -1
- package/dist/assets/wrap-locale-DTO386nY.js +0 -1
- package/dist/assets/zh-tw-B_su4eMW.js +0 -3
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DjDooCTg.js","assets/vendor-arcblock-Dn16DH88.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-CV7RLr7b.js","assets/vendor-hooks-DzETutIU.js","assets/vendor-mui-core-COxJgW9_.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-Cp3ZCh7o.js","assets/index-tDqjC_e2.js","assets/_createAggregator-BgG70oKG.js","assets/index-DoZ2YM4T.js","assets/toUpper-DUImrX4s.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as v,k as St,l as tt,L as ie,f as zn,h as En,i as ct}from"./vendor-react-D-afvo_7.js";import{a1 as fe,j as t,t as Ee,a3 as f,aM as zo,E as d,a4 as de,I as oe,T as A,bT as Eo,aa as ce,aE as On,bJ as Fe,ad as Oo,aN as ft,aR as ht,x as ee,a2 as Je,P as Bo,G as Ao,v as wt,$ as Wo,ar as Vo,al as qe,ah as Bn,D as Fo,ab as An,r as Wn,bH as Vn,K as ot,y as Fn,M as se,ac as je,aL as Un,L as Hn,z as Kn,bq as Gn,aA as Xn,az as io,bt as Jn,bu as Qn,bU as Yn,bV as Zn,bx as es,by as lo}from"./vendor-mui-core-COxJgW9_.js";import{y as he,B as Ie,h as ke,aa as ts,f as co,_ as Uo,ac as ao}from"./index-tDqjC_e2.js";import{ad as me,d as U,g as J,ag as Qe,aq as Ho,by as Ko,ao as Go,ab as os,bz as vt,z as E,E as ns,bm as ss,bA as Ct,bB as rs,bC as is,aa as ls,b2 as ne,bD as cs,aO as as,bh as ve,al as Xo,bE as uo,aL as ds,aG as us}from"./vendor-arcblock-Dn16DH88.js";import{d as It}from"./Add-WwBlcqNF.js";import{d as ps}from"./Error-CL8m4Xu6.js";import{C as Dt}from"./confirm-DhCXP8vW.js";import{u as nt}from"./session-UImnJahL.js";import{W as po}from"./did-address-B-umhomj.js";import{E as Oe,D as fo,C as ho,P as mo}from"./react-beautiful-dnd.esm-D6d5Zfr8.js";import{B as Pt}from"./bundle-avatar-CtN88KlG.js";import{S as ue}from"./shorten-label-CKNjZbhF.js";import{j as le,a as Ue}from"./vendor-utils-CV7RLr7b.js";import{d as fs}from"./Download-DRJvwpLt.js";import{d as hs}from"./QuestionMarkCircle-2fDrHopp.js";import{u as ms}from"./vendor-hooks-DzETutIU.js";import{_ as we}from"./useSetState-Crt4S51m.js";import{c as Tt}from"./index-DoZ2YM4T.js";import{E as _t}from"./index-CcsFwEG1.js";import{p as Ye}from"./index-e4kRKwa5.js";import"./api-C7qcY4XU.js";import{d as bs}from"./ChevronRight-UF0hSKpL.js";import{T as xs,a as gs}from"./vendor-mui-x-Be0GxtOJ.js";import{d as bo}from"./DeleteOutline-1Utxk_IX.js";import{c as js,A as Jo,u as ks,S as ys,U as Rs}from"./item-DoetJFaA.js";import{d as Ss}from"./ArrowDropDown-B6VSNrNX.js";import{f as Ce}from"./format-error-C0Ke3VXF.js";import{C as ws}from"./click-to-copy-D-rDpTU1.js";import{d as vs}from"./Launch-D9iyATKb.js";import{M as Cs}from"./index-7gknQYQQ.js";import{r as Is}from"./index-CEyrfuix.js";import{d as Ds}from"./Done-BbnQSLvu.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-ByH0hntp.js";var Lt={},Ps=fe;Object.defineProperty(Lt,"__esModule",{value:!0});var Qo=Lt.default=void 0,Ts=Ps(me()),_s=t;Qo=Lt.default=(0,Ts.default)((0,_s.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 qt={},Ls=fe;Object.defineProperty(qt,"__esModule",{value:!0});var Yo=qt.default=void 0,qs=Ls(me()),$s=t;Yo=qt.default=(0,qs.default)((0,$s.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 $t={},Ns=fe;Object.defineProperty($t,"__esModule",{value:!0});var Zo=$t.default=void 0,Ms=Ns(me()),zs=t;Zo=$t.default=(0,Ms.default)((0,zs.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 Nt({did:e,projectId:o,title:n,logo:r,describe:s}){const i=`${`${U.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=v.useState(!1),p=Ee(h=>h.breakpoints.down("md"));return t.jsxs(f,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(zo,{sx:{borderRadius:1},src:i}),t.jsxs(f,{children:[t.jsx(ue,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:p?"primary.main":""},children:n||"/"}),t.jsx(ue,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:p||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Nt.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=St(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=J(),{api:l}=he(),{api:i}=nt(),[a,c]=v.useState(!0),{blocklet:p}=Ie(),[h,m]=v.useState(null),[b,u]=v.useState(!1),g=Ee(w=>w.breakpoints.down("xl")),{componentDid:y=""}=tt(),[C,k]=v.useState(null),x=()=>{l.getProjects({input:{did:p.meta.did,componentDid:y,tenantScope:n}}).then(w=>{const _=(w==null?void 0:w.projects)||[];c(!1),k(_)}).catch(w=>{c(!1),E.error(w.message)})},I=()=>{o(`${U.UNOWNED_DID}/create/none`,{replace:!0})},T=w=>{m(w)},D=()=>{c(!1),u(!0)},j=()=>{u(!1),m(null)},P=w=>{E.error(w.message),u(!1),m(null)},M=w=>{if(!(w!=null&&w.deleted)){E.error("Delete project failed");return}x(),u(!1),m(null)},F=(w,_,V)=>{let W=w==null?void 0:w.trim();return W?(W=ns.toAddress(W).toLocaleLowerCase(),V.some((R,q)=>{const $=_[q];return $&&R.searchable&&R.display!=="excluded"&&R.display!=="false"&&$.toLocaleLowerCase().includes(W)})):!0};if(v.useEffect(()=>{x()},[]),!C&&a)return t.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Oe,{})});if(!C)return null;if(!C.length)return t.jsxs(f,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(f,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(f,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(Qe,{onClick:I,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const S=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:w=>{const _=C[w];return t.jsx(ie,{to:`${_.id}`,children:t.jsx(Nt,{did:p.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:w=>w?t.jsx(Ho,{type:"success",children:w}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:w=>w?t.jsx(po,{size:14,compact:!0,responsive:!1,did:w}):null}},g||y?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:w=>w?t.jsx(po,{onClick:()=>{o(`/.well-known/service/admin/members?did=${w}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:w}):null}},g||y?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:w=>{const _=(p.children||[]).find(V=>V.meta.did===w);return _?t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Pt,{size:14,blocklet:_,ancestors:[p]}),t.jsx(f,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},w):""}}},g||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:w=>t.jsx(f,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(ue,{children:w})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:w=>t.jsx(Ko,{value:Number(w),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:w=>{const _=C[w];return t.jsxs(f,{display:"flex",children:[t.jsx(ie,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:t.jsx(de,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"create",children:t.jsx(Qo,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&t.jsx(de,{title:r("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx(ie,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}`,children:t.jsx(Yo,{sx:{fontSize:18}})})})}),t.jsx(de,{title:r("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>T(_),children:t.jsx(Go,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),B=b?t.jsx(os,{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:M,onError:P,extraParams:{projectId:h.id,did:p.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(f,{children:[t.jsxs(f,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(f,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(f,{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(Zo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(Qe,{onClick:I,variant:"contained",children:[t.jsx(It,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(vt,{className:"main-table",locale:s,data:C,columns:S,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:F}}),h&&t.jsx(Dt,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:D,onCancel:()=>m(null),children:t.jsx(f,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(w=>t.jsxs(f,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(ps,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:w})]}))})}),B]})}Mt.propTypes={initUrl:d.object};Mt.defaultProps={initUrl:null};var zt={},Es=fe;Object.defineProperty(zt,"__esModule",{value:!0});var en=zt.default=void 0,Os=Es(me()),xo=t;en=zt.default=(0,Os.default)([(0,xo.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,xo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Bs(){var D;const{t:e,locale:o}=J(),{projectId:n}=tt(),{api:r}=he(),[s,l]=v.useState(!0),{blocklet:i}=Ie(),a=Ee(j=>j.breakpoints.down("md")),[c,p]=v.useState(null),[h,m]=v.useState(null),[b,u]=v.useState(null),g=(D=window.env)==null?void 0:D.serverEndpoint,y=()=>{r.getReleases({input:{did:i.meta.did,projectId:n}}).then(j=>{const P=(j==null?void 0:j.releases)||[];l(!1),p(P)}).catch(j=>{l(!1),E.error(j.message)})},C=()=>{r.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:n}},getReleases:{input:{did:i.meta.did,projectId:n}}}).then(j=>{m(j.getProject.project||{}),p(j.getReleases.releases||[]),l(!1)}).catch(j=>{l(!1),E.error(j.message)})};v.useEffect(()=>{C()},[]);const k=()=>{l(!1);const j=b.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:j}}).then(()=>{l(!1),y(),E.success(e("common.removeSuccess")),u(null)}).catch(P=>{l(!1),E.error(P.message)})},x=j=>{u(j)};if(!c&&s)return t.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Oe,{})});if(!c)return null;const I=t.jsxs(Eo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ie,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(ue,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[I,t.jsxs(f,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(f,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(f,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(ie,{to:"create/none",children:t.jsx(Qe,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const T=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:j=>{const P=c[j];return t.jsx(ie,{to:`view/${P.id}`,children:t.jsx(Nt,{did:i.meta.did,projectId:h.id,logo:P.blockletLogo,title:P.blockletVersion,describe:P.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:j=>{const P=c[j];return t.jsx(A,{className:"note",children:P.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:j=>t.jsx(Ho,{type:j==="published"?"success":"warning",children:j==="published"?"Released":ss(j)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const P=c[j];return P.status!==ke.PROJECT.RELEASE_STATUS.published?"":t.jsx(Ko,{value:Number(P.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:j=>{var w;const P=c[j];let M="",F="";const S=P.status==="published";if(S){const _=le(g,`/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),V=new URL(g);V.pathname=le(V.pathname,"/launch-blocklet/agreement"),V.searchParams.set("blocklet_meta_url",_),M=V.href,F=le(`${U.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const B=(w=h.blockletComponents)!=null&&w.some(_=>_.included)||P.uploadedResource?"pack":"resource";return t.jsxs(f,{display:"flex",alignItems:"center",children:[S&&B==="pack"&&t.jsx(de,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:M,target:"_blank",rel:"noreferrer",children:t.jsx(en,{sx:{fontSize:18}})})})}),S&&t.jsx(de,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:F,children:t.jsx(fs,{sx:{fontSize:18}})})})}),t.jsx(de,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>x(P),children:t.jsx(Go,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(As,{children:[t.jsxs(f,{className:"header",children:[I,t.jsx(ie,{to:"new-release/none",children:t.jsxs(Qe,{variant:"contained",children:[t.jsx(It,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(vt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:T,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),b&&t.jsx(Dt,{title:e(`${e("common.delete")} ${b.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:k,onCancel:()=>u(null)})]})}const As=ce(f)`
|
|
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 Et={},Ws=fe;Object.defineProperty(Et,"__esModule",{value:!0});var tn=Et.default=void 0,Vs=Ws(me()),Fs=t;tn=Et.default=(0,Vs.default)((0,Fs.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 ye({children:e,Icon:o}){return t.jsxs(On,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[t.jsx(f,{sx:{opacity:.3,fontSize:32},children:t.jsx(o,{})}),t.jsx(f,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:e})]})}ye.propTypes={children:d.node.isRequired,Icon:d.elementType};ye.defaultProps={Icon:tn};function Ot({value:e,app:o,onChange:n,onChangeBlockletResourceType:r,disabled:s,resourceRelateComponents:l,projectType:i,dependentComponentsMode:a,blockletResourceType:c}){const{t:p,locale:h}=J(),m=a==="readonly",b=v.useMemo(()=>{const I=e.reduce((T,D)=>(T[D.did]=D.included,T),{});return(o.children||[]).filter(T=>m?l[T.meta.did]||I[T.meta.did]:!0)},[o.children,e,l,m]),u=v.useMemo(()=>b.map(I=>e.find(D=>D.did===I.meta.did)||{did:I.meta.did}),[b,e]),g=u.reduce((I,T)=>(I[T.did]=Ct(T,["required","included"]),I),{}),y=I=>{const T=u.map(D=>{if(D.did===I){const j=!D.included;return{...D,included:j,required:j}}return D});n(T)},C=I=>{const T=u.map(D=>D.did===I?{...D,required:!D.required}:D);n(T)},k=I=>{r(I.target.checked?"resource":"")},x=[{label:p("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:I=>{var j;const T=b[I],D=(j=g[T.meta.did])==null?void 0:j.included;return t.jsxs(f,{display:"flex",alignItems:"center",children:[t.jsx(Pt,{size:24,blocklet:T,ancestors:[o]}),t.jsx(f,{ml:"4px",className:Tt("text",{excluded:!D}),children:t.jsx(f,{children:T.meta.title})})]})}}},{label:p("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:I=>{var P;const T=b[I],D=l[T.meta.did],j=!!((P=g[T.meta.did])!=null&&P.included);return t.jsx(Fe,{size:"small",checked:D||j,onClick:()=>y(T.meta.did),disabled:m||D||s})}}},{label:p("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:I=>{var M,F;const T=b[I],D=l[T.meta.did],j=!!((M=g[T.meta.did])!=null&&M.included),P=!!((F=g[T.meta.did])!=null&&F.required);return t.jsx(Fe,{size:"small",checked:D||P&&j,onClick:()=>C(T.meta.did),disabled:m||D||s||!j})}}}];return t.jsx(Us,{children:b!=null&&b.length?t.jsxs(t.Fragment,{children:[t.jsxs(Oo,{severity:"info",style:{width:"100%"},children:[t.jsx(f,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:p(i==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),t.jsxs(f,{component:"label",style:{cursor:"pointer"},children:[t.jsx(Fe,{size:"small",style:{marginLeft:"0px"},disabled:s,checked:c==="resource",onChange:k}),p("blocklet.publish.forceResourceBlocklet")]})]}),t.jsx(vt,{className:"main-table",verticalKeyWidth:100,locale:h,data:b,columns:x,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):t.jsx(ye,{Icon:_t,children:p("blocklet.publish.blockletEmptyTip")})})}Ot.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};Ot.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const Us=ce(f)`
|
|
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 Hs(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 Bt({data:e,...o}){return!e||!e.length?null:t.jsx(Ks,{...o,children:e.map(n=>t.jsx("a",{href:n.url,target:"_blank",rel:"noreferrer",children:t.jsx("img",{src:n.url,alt:n.alt||""})},n.url))})}Bt.propTypes={data:d.arrayOf(d.shape({url:d.string,alt:d.string}))};Bt.defaultProps={data:[]};const Ks=ce(f)`
|
|
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
|
-
`,at=(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 At({icon:e}){return e?ls(e)?t.jsx("img",{className:"resource-icon",src:e,alt:"icon"}):t.jsx(ne,{className:"resource-icon",icon:e}):null}At.propTypes={icon:d.string};At.defaultProps={icon:""};function Wt({disabled:e,data:o,onChange:n,value:r}){const s=r;function l(u,g=[]){return g.push(u.id),u.children&&u.children.forEach(y=>l(y,g)),g}const i=u=>l(at(o,u)),a=(u,g=[])=>{const y=at(o,u);return y.parent?(g.push(y.parent),a(y.parent,g)):g};function c(u,g){const y=i(u.id),C=y.indexOf(u.id);return y.splice(C,1),y.every(k=>s.concat(g).includes(k))}const p=(u,g)=>{u.stopPropagation();const y=i(g),C=a(g);if(s.includes(g)){const k=s.filter(x=>!y.concat(C).includes(x));n(k)}else{const k=y;for(let x=0;x<C.length;++x)c(at(o,C[x]),k)&&k.push(C[x]);n([...s].concat(k))}},h=u=>{u.stopPropagation()},m=o.some(u=>{var g;return((g=u.children)==null?void 0:g.length)>0}),b=u=>{var x;const g=s.indexOf(u.id)!==-1,y=Array.isArray(u.children),C=i(u.id),k=y&&!g&&s.some(I=>C.includes(I));return t.jsx(xs,{nodeId:u.id,label:t.jsx(ft,{onClick:h,control:t.jsx(Fe,{size:"small",checked:g,indeterminate:k,tabIndex:-1,disableRipple:!0,onClick:I=>p(I,u.id),disabled:u.disabled||e}),label:t.jsxs(f,{className:"content",children:[t.jsxs(f,{display:"flex",alignItems:"center",children:[u.icon&&t.jsx(At,{icon:u.icon}),t.jsx(f,{className:"name",children:u.name}),u.url&&t.jsx("a",{href:u.url,target:"_blank",rel:"noreferrer",className:"link",children:t.jsx(is,{className:"link-icon"})})]}),!!u.description&&t.jsx(f,{className:"description",children:u.description}),!!((x=u.images)!=null&&x.length)&&t.jsx(Bt,{className:"images",data:u.images})]})}),children:y?u.children.map(b):null},u.id)};return t.jsx(Gs,{className:Tt(!m&&"no-children"),multiSelect:!0,defaultCollapseIcon:t.jsx(rs,{}),defaultExpandIcon:t.jsx(bs,{}),selected:s,children:o.map(u=>b(u))})}Wt.propTypes={data:d.array,value:d.array,onChange:d.func,disabled:d.bool};Wt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const Gs=ce(gs)`
|
|
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
|
-
`,He=(e,o)=>(e.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(r=>{r.parent=n.id,He(r.children||[],r.id)})}),e),Ke=(e,o,n,r,s)=>{const{exportApi:l="/"}=(e==null?void 0:e.meta.resource)||{},i=new URL(le("http://127.0.0.1",e==null?void 0:e.mountPoint,l||"/").replace(/\/+/g,"/"));return i.searchParams.set("projectId",o),i.searchParams.set("releaseId",n),i.searchParams.set("local",r),s&&i.searchParams.set("resourcesParams",s.searchParams.get("resourcesParams")),`${i.pathname}${i.search}`},Xs=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(p){E.error(p.message);return}await Ue.post(Ke(n,r,s,l,i),{resources:a,projectId:r,releaseId:s,locale:l,...c?{resourcesParams:c}:{}},{headers:{"x-csrf-token":cs()}}),await e.updateSelectedResources({input:{did:o,projectId:r,releaseId:s,componentDid:n.meta.did,resources:a}})},Js=(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 Vt({app:e,component:o,projectId:n,release:r,loading:s,error:l,saveSelectedEventsRef:i,readOnly:a,componentDid:c,initialResources:p={},setResourceComponentsMap:h,selectedResourceIds:m,setSelectedResourceIds:b,initUrl:u}){var F;const{t:g,locale:y}=J(),{api:C}=he(),[k,x]=we({}),I=v.useRef({}),T=v.useRef(!1),D=r.id;I.current.projectId=n,I.current.releaseId=D;const j=(S,B,w)=>{if(!B)return;const _=Js(B,w);h==null||h({[S]:Object.keys(_)})},P=S=>{i.current[o.meta.did]={resources:S,component:o},b({[o.meta.did]:S}),j(o.meta.did,k[o.meta.did],S)};v.useEffect(()=>{k[o==null?void 0:o.meta.did]||Ue.get(Ke(o,n,D,y,u)).then(S=>{var w;const B=He(((w=S.data)==null?void 0:w.resources)||[]);x({[o==null?void 0:o.meta.did]:B})}).catch(S=>{E.error(S.message)})},[o,n,r,y,u,x,k,D]),v.useEffect(()=>{D&&n&&!T.current&&Ye(e.children.map(S=>async()=>{var B,w,_;if(!(c&&c!==S.meta.did)&&!(!(S!=null&&S.mountPoint)||!ts.hasStartEngine(S==null?void 0:S.meta)||!((w=(B=S==null?void 0:S.meta)==null?void 0:B.resource)!=null&&w.exportApi)))try{const V=await Ue.get(Ke(S,n,D,y,u)),W=He(((_=V==null?void 0:V.data)==null?void 0:_.resources)||[]);x({[S==null?void 0:S.meta.did]:W});const R=await C.getSelectedResources({input:{did:e.meta.did,projectId:n,releaseId:D,componentDid:S.meta.did}}),q=(R==null?void 0:R.resources)||[];q!=null&&q.length&&(b({[S.meta.did]:Hs(W,q)}),j(S.meta.did,W,q),a||(i.current[S==null?void 0:S.meta.did]={resources:q,component:S}))}catch(V){E.error(V.message)}}),{concurrency:2}).then(()=>{T.current=!0})},[D,n,a,y,u,x]),v.useEffect(()=>{p&&Object.keys(p).length&&Ye(e.children.map(async S=>{var w;const B=p[S.meta.did];if(B!=null&&B.length){const _=await Ue.get(Ke(S,n,D,y,u)),V=He(((w=_==null?void 0:_.data)==null?void 0:w.resources)||[]);b({[S.meta.did]:B}),j(S.meta.did,V,B),a||(i.current[S==null?void 0:S.meta.did]={resources:B,component:S})}}))},[e,p,a]);let M=null;return(!o||!((F=k[o.meta.did])!=null&&F.length))&&(M=t.jsx(ye,{Icon:_t,children:g("blocklet.publish.resourceEmptyTip",{name:co.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(M=t.jsx(ye,{children:g("blocklet.publish.componentNotRunning",{name:co.getDisplayName(o)})})),t.jsxs(t.Fragment,{children:[t.jsx(Qs,{className:Tt(l&&"error"),children:t.jsx(f,{pb:2,width:"100%",children:M||t.jsx(Wt,{data:k[o.meta.did]||[],value:m[o.meta.did]||[],onChange:P,disabled:s||a})})}),!!l&&t.jsx(f,{color:"error.main",mt:1,fontSize:14,children:l})]})}Vt.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};Vt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const Qs=ce(f)`
|
|
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 Ft={},Ys=fe;Object.defineProperty(Ft,"__esModule",{value:!0});var mt=Ft.default=void 0,Zs=Ys(me()),er=t;mt=Ft.default=(0,Zs.default)((0,er.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 go="lastWantToConnectStoreId";function tr(e){var a,c;const[o,n]=v.useState(null),{session:r}=nt(),s=v.useCallback(p=>{n(p),localStorage.setItem(go,p==null?void 0:p.id)},[n]),l=v.useMemo(()=>{var b,u,g,y;const p=localStorage.getItem(go),h=p?(((b=e==null?void 0:e.settings)==null?void 0:b.storeList)||[]).find(C=>C.id===p):null;if(h)return h;let m=(((u=e==null?void 0:e.settings)==null?void 0:u.storeList)||[]).find(C=>{var k;return!(C.id!==U.BLOCKLET_STORE.id||C.scope&&C.scope!=="studio"&&C.scope!==((k=r==null?void 0:r.user)==null?void 0:k.did))});return m||(m=(y=(g=e==null?void 0:e.settings)==null?void 0:g.storeList)==null?void 0:y[0]),m},[(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 dt={};async function on(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){dt[s]&&clearTimeout(dt[s]),await new Promise(a=>setTimeout(a,r));const l=Date.now(),i=async(a,c)=>{try{const p=await e();a(p)}catch(p){Date.now()-l>n?c(p):s?dt[s]=setTimeout(()=>i(a,c),o):setTimeout(()=>i(a,c),o)}};return new Promise(i)}function or(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function nr(e,{did:o,projectId:n,messageId:r}){return on(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 sr(e,{did:o,projectId:n,storeId:r}){return on(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 nn=({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 Ut({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:l,componentDid:i}){var w,_,V;const{t:a}=J(),{session:c}=nt(),{api:p,info:h,inService:m}=he(),b=Ie(),[u,g]=v.useState(!1),y=v.useRef(null),[C,k]=v.useState(!1),[x,I]=v.useState(null),T=W=>{n(W),g(!1)},D=()=>{g(!u)},j=W=>{y.current&&y.current.contains(W.target)||g(!1)},P=()=>{k(!0)},M=()=>{k(!1)},F=async()=>{var W;if(x)try{await p.deleteBlockletStore({input:{teamDid:e.meta.did,url:x.url,projectId:"",scope:x.scope||"studio"}}),await((W=b==null?void 0:b.actions)==null?void 0:W.refreshBlocklet())}catch(R){E.error(`Remove Blocklet Store Error: ${Ce(R)}`)}finally{I(null)}},{storeList:S}=nn({fromBlocklet:m,blocklet:e,nodeInfo:h,componentDid:i,userDid:(w=c==null?void 0:c.user)==null?void 0:w.did}),B=(_=e==null?void 0:e.meta)==null?void 0:_.did;return t.jsxs(t.Fragment,{children:[t.jsxs(ht,{disabled:s,ref:y,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(ee,{onClick:r,children:[l&&t.jsx(Je,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(ee,{size:"small","aria-controls":u?"split-button-menu":void 0,"aria-expanded":u?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:D,children:t.jsx(Ss,{})})]}),t.jsx(Bo,{sx:{zIndex:10},open:u,anchorEl:y.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>t.jsx(Ao,{...W,style:{transformOrigin:"center top"},children:t.jsx(wt,{children:t.jsx(Wo,{onClickAway:j,children:t.jsxs(Vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[S==null?void 0:S.map(R=>{var q;return t.jsxs(qe,{selected:R.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(R),children:[t.jsxs(f,{children:[t.jsx(ue,{sx:{fontSize:"16px"},maxLength:24,children:R.name}),t.jsx(ue,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:R.url})]}),js({store:R,userDid:(q=c==null?void 0:c.user)==null?void 0:q.did})&&t.jsx(oe,{sx:{ml:1},onClick:$=>{$.preventDefault(),$.stopPropagation(),I(R)},children:t.jsx(ne,{icon:"ic:outline-delete"})})]},R.url)}),t.jsx(Bn,{}),t.jsxs(qe,{onClick:P,children:[t.jsx(It,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),C&&t.jsx(Jo,{hiddenChildren:!0,open:!0,onClose:M,teamDid:B,storeList:S,scope:"studio",onAdd:(V=b==null?void 0:b.actions)==null?void 0:V.refreshBlocklet}),x&&t.jsx(Dt,{displayError:!0,title:`${a("common.delete")} ${x.name}`,description:a("blocklet.publish.deleteStoreTip",{name:x.name}),confirm:a("common.confirm"),onConfirm:F,onCancel:()=>I(null)})]})}Ut.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};Ut.defaultProps={store:null,blocklet:null};var pe=v;const $e=/^[a-z0-9]+(-[a-z0-9]+)*$/,st=(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(),p={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Ge(p)?null:p}const l=s[0],i=l.split("-");if(i.length>1){const a={provider:r,prefix:i.shift(),name:i.join("-")};return o&&!Ge(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:l};return o&&!Ge(a,n)?null:a}return null},Ge=(e,o)=>e?!!((e.provider===""||e.provider.match($e))&&(o&&e.prefix===""||e.prefix.match($e))&&e.name.match($e)):!1,sn=Object.freeze({left:0,top:0,width:16,height:16}),Ze=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ht=Object.freeze({...sn,...Ze}),bt=Object.freeze({...Ht,body:"",hidden:!1});function rr(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 jo(e,o){const n=rr(e,o);for(const r in bt)r in Ze?r in e&&!(r in n)&&(n[r]=Ze[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function ir(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 lr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let l={};function i(a){l=jo(r[a]||s[a],l)}return i(o),n.forEach(i),jo(e,l)}function rn(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=ir(e);for(const s in r){const l=r[s];l&&(o(s,lr(e,s,l)),n.push(s))}return n}const cr={provider:"",aliases:{},not_found:{},...sn};function ut(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function ln(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!ut(e,cr))return null;const n=o.icons;for(const s in n){const l=n[s];if(!s.match($e)||typeof l.body!="string"||!ut(l,bt))return null}const r=o.aliases||Object.create(null);for(const s in r){const l=r[s],i=l.parent;if(!s.match($e)||typeof i!="string"||!n[i]&&!r[i]||!ut(l,bt))return null}return o}const ko=Object.create(null);function ar(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function Re(e,o){const n=ko[e]||(ko[e]=Object.create(null));return n[o]||(n[o]=ar(e,o))}function Kt(e,o){return ln(o)?rn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function dr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Me=!1;function cn(e){return typeof e=="boolean"&&(Me=e),Me}function ur(e){const o=typeof e=="string"?st(e,!0,Me):e;if(o){const n=Re(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function pr(e,o){const n=st(e,!0,Me);if(!n)return!1;const r=Re(n.provider,n.prefix);return dr(r,n.name,o)}function fr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Me&&!o&&!e.prefix){let s=!1;return ln(e)&&(e.prefix="",rn(e,(l,i)=>{i&&pr(l,i)&&(s=!0)})),s}const n=e.prefix;if(!Ge({provider:o,prefix:n,name:"a"}))return!1;const r=Re(o,n);return!!Kt(r,e)}const an=Object.freeze({width:null,height:null}),dn=Object.freeze({...an,...Ze}),hr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,mr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function yo(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(hr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=mr.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 br=e=>e==="unset"||e==="undefined"||e==="none";function xr(e,o){const n={...Ht,...e},r={...dn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let l=n.body;[n,r].forEach(g=>{const y=[],C=g.hFlip,k=g.vFlip;let x=g.rotate;C?k?x+=2:(y.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),y.push("scale(-1 1)"),s.top=s.left=0):k&&(y.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),y.push("scale(1 -1)"),s.top=s.left=0);let I;switch(x<0&&(x-=Math.floor(x/4)*4),x=x%4,x){case 1:I=s.height/2+s.top,y.unshift("rotate(90 "+I.toString()+" "+I.toString()+")");break;case 2:y.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:I=s.width/2+s.left,y.unshift("rotate(-90 "+I.toString()+" "+I.toString()+")");break}x%2===1&&(s.left!==s.top&&(I=s.left,s.left=s.top,s.top=I),s.width!==s.height&&(I=s.width,s.width=s.height,s.height=I)),y.length&&(l='<g transform="'+y.join(" ")+'">'+l+"</g>")});const i=r.width,a=r.height,c=s.width,p=s.height;let h,m;i===null?(m=a===null?"1em":a==="auto"?p:a,h=yo(m,c/p)):(h=i==="auto"?c:i,m=a===null?yo(h,p/c):a==="auto"?p:a);const b={},u=(g,y)=>{br(y)||(b[g]=y.toString())};return u("width",h),u("height",m),b.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+p.toString(),{attributes:b,body:l}}const gr=/\sid="(\S+)"/g,jr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let kr=0;function yr(e,o=jr){const n=[];let r;for(;r=gr.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+(kr++).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 xt=Object.create(null);function Rr(e,o){xt[e]=o}function gt(e){return xt[e]||xt[""]}function Gt(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 Xt=Object.create(null),Le=["https://api.simplesvg.com","https://api.unisvg.com"],Xe=[];for(;Le.length>0;)Le.length===1||Math.random()>.5?Xe.push(Le.shift()):Xe.push(Le.pop());Xt[""]=Gt({resources:["https://api.iconify.design"].concat(Xe)});function Sr(e,o){const n=Gt(o);return n===null?!1:(Xt[e]=n,!0)}function Jt(e){return Xt[e]}const wr=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ro=wr();function vr(e,o){const n=Jt(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 Cr(e){return e===404}const Ir=(e,o,n)=>{const r=[],s=vr(e,o),l="icons";let i={type:l,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,p)=>{a+=c.length+1,a>=s&&p>0&&(r.push(i),i={type:l,provider:e,prefix:o,icons:[]},a=c.length),i.icons.push(c)}),r.push(i),r};function Dr(e){if(typeof e=="string"){const o=Jt(e);if(o)return o.path}return"/"}const Pr=(e,o,n)=>{if(!Ro){n("abort",424);return}let r=Dr(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;Ro(e+r).then(l=>{const i=l.status;if(i!==200){setTimeout(()=>{n(Cr(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)})},Tr={prepare:Ir,send:Pr};function _r(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)),p=c[i]||(c[i]=Re(l,i));let h;a in p.icons?h=o.loaded:i===""||p.missing.has(a)?h=o.missing:h=o.pending;const m={provider:l,prefix:i,name:a};h.push(m)}),o}function un(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Lr(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 p=c.name;if(e.icons[p])i.loaded.push({provider:r,prefix:s,name:p});else if(e.missing.has(p))i.missing.push({provider:r,prefix:s,name:p});else return n=!0,!0;return!1}),i.pending.length!==a&&(n||un([e],l.id),l.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),l.abort))})}))}let qr=0;function $r(e,o,n){const r=qr++,s=un.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 Nr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const l=typeof s=="string"?st(s,o,n):s;l&&r.push(l)}),r}var Mr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function zr(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 P=Math.floor(Math.random()*j.length);i.push(j[P]),j=j.slice(0,P).concat(j.slice(P+1))}i=i.concat(j)}else i=e.resources.slice(l).concat(e.resources.slice(0,l));const a=Date.now();let c="pending",p=0,h,m=null,b=[],u=[];typeof r=="function"&&u.push(r);function g(){m&&(clearTimeout(m),m=null)}function y(){c==="pending"&&(c="aborted"),g(),b.forEach(j=>{j.status==="pending"&&(j.status="aborted")}),b=[]}function C(j,P){P&&(u=[]),typeof j=="function"&&u.push(j)}function k(){return{startTime:a,payload:o,status:c,queriesSent:p,queriesPending:b.length,subscribe:C,abort:y}}function x(){c="failed",u.forEach(j=>{j(void 0,h)})}function I(){b.forEach(j=>{j.status==="pending"&&(j.status="aborted")}),b=[]}function T(j,P,M){const F=P!=="success";switch(b=b.filter(S=>S!==j),c){case"pending":break;case"failed":if(F||!e.dataAfterTimeout)return;break;default:return}if(P==="abort"){h=M,x();return}if(F){h=M,b.length||(i.length?D():x());return}if(g(),I(),!e.random){const S=e.resources.indexOf(j.resource);S!==-1&&S!==e.index&&(e.index=S)}c="completed",u.forEach(S=>{S(M)})}function D(){if(c!=="pending")return;g();const j=i.shift();if(j===void 0){if(b.length){m=setTimeout(()=>{g(),c==="pending"&&(I(),x())},e.timeout);return}x();return}const P={status:"pending",resource:j,callback:(M,F)=>{T(P,M,F)}};b.push(P),p++,m=setTimeout(D,e.rotate),n(j,o,P.callback)}return setTimeout(D),k}function pn(e){const o={...Mr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,p){const h=zr(o,a,c,(m,b)=>{r(),p&&p(m,b)});return n.push(h),h}function l(a){return n.find(c=>a(c))||null}return{query:s,find:l,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function So(){}const pt=Object.create(null);function Er(e){if(!pt[e]){const o=Jt(e);if(!o)return;const n=pn(o),r={config:o,redundancy:n};pt[e]=r}return pt[e]}function Or(e,o,n){let r,s;if(typeof e=="string"){const l=gt(e);if(!l)return n(void 0,424),So;s=l.send;const i=Er(e);i&&(r=i.redundancy)}else{const l=Gt(e);if(l){r=pn(l);const i=e.resources?e.resources[0]:"",a=gt(i);a&&(s=a.send)}}return!r||!s?(n(void 0,424),So):r.query(o,s,n)().abort}const wo="iconify2",ze="iconify",fn=ze+"-count",vo=ze+"-version",hn=36e5,Br=168;function jt(e,o){try{return e.getItem(o)}catch{}}function Qt(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Co(e,o){try{e.removeItem(o)}catch{}}function kt(e,o){return Qt(e,fn,o.toString())}function yt(e){return parseInt(jt(e,fn))||0}const rt={local:!0,session:!0},mn={local:new Set,session:new Set};let Yt=!1;function Ar(e){Yt=e}let Ve=typeof window>"u"?{}:window;function bn(e){const o=e+"Storage";try{if(Ve&&Ve[o]&&typeof Ve[o].length=="number")return Ve[o]}catch{}rt[e]=!1}function xn(e,o){const n=bn(e);if(!n)return;const r=jt(n,vo);if(r!==wo){if(r){const a=yt(n);for(let c=0;c<a;c++)Co(n,ze+c.toString())}Qt(n,vo,wo),kt(n,0);return}const s=Math.floor(Date.now()/hn)-Br,l=a=>{const c=ze+a.toString(),p=jt(n,c);if(typeof p=="string"){try{const h=JSON.parse(p);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Co(n,c)}};let i=yt(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,kt(n,i)):mn[e].add(a))}function gn(){if(!Yt){Ar(!0);for(const e in rt)xn(e,o=>{const n=o.data,r=o.provider,s=n.prefix,l=Re(r,s);if(!Kt(l,n).length)return!1;const i=n.lastModified||-1;return l.lastModifiedCached=l.lastModifiedCached?Math.min(l.lastModifiedCached,i):i,!0})}}function Wr(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in rt)xn(r,s=>{const l=s.data;return s.provider!==e.provider||l.prefix!==e.prefix||l.lastModified===o});return!0}function Vr(e,o){Yt||gn();function n(r){let s;if(!rt[r]||!(s=bn(r)))return;const l=mn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=yt(s),!kt(s,i+1))return;const a={cached:Math.floor(Date.now()/hn),provider:e.provider,data:o};return Qt(s,ze+i.toString(),JSON.stringify(a))}o.lastModified&&!Wr(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function Io(){}function Fr(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Lr(e)}))}function Ur(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=gt(n)))return;l.prepare(n,r,s).forEach(a=>{Or(n,a,c=>{if(typeof c!="object")a.icons.forEach(p=>{e.missing.add(p)});else try{const p=Kt(e,c);if(!p.length)return;const h=e.pendingIcons;h&&p.forEach(m=>{h.delete(m)}),Vr(e,c)}catch(p){console.error(p)}Fr(e)})})}))}const Hr=(e,o)=>{const n=Nr(e,!0,cn()),r=_r(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,Io)}),()=>{c=!1}}const s=Object.create(null),l=[];let i,a;return r.pending.forEach(c=>{const{provider:p,prefix:h}=c;if(h===a&&p===i)return;i=p,a=h,l.push(Re(p,h));const m=s[p]||(s[p]=Object.create(null));m[h]||(m[h]=[])}),r.pending.forEach(c=>{const{provider:p,prefix:h,name:m}=c,b=Re(p,h),u=b.pendingIcons||(b.pendingIcons=new Set);u.has(m)||(u.add(m),s[p][h].push(m))}),l.forEach(c=>{const{provider:p,prefix:h}=c;s[p][h].length&&Ur(c,s[p][h])}),o?$r(o,r,l):Io};function Kr(e,o){const n={...e};for(const r in o){const s=o[r],l=typeof s;r in an?(s===null||s&&(l==="string"||l==="number"))&&(n[r]=s):l===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const Gr=/[\s,]+/;function Xr(e,o){o.split(Gr).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Jr(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 Qr(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 Yr(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Zr(e){return"data:image/svg+xml,"+Yr(e)}function ei(e){return'url("'+Zr(e)+'")'}let Ne;function ti(){try{Ne=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ne=null}}function oi(e){return Ne===void 0&&ti(),Ne?Ne.createHTML(e):e}const jn={...dn,inline:!1},ni={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},si={display:"inline-block"},Rt={backgroundColor:"currentColor"},kn={backgroundColor:"transparent"},Do={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Po={WebkitMask:Rt,mask:Rt,background:kn};for(const e in Po){const o=Po[e];for(const n in Do)o[e+n]=Do[n]}const ri={...jn,inline:!0};function To(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const ii=(e,o,n,r)=>{const s=n?ri:jn,l=Kr(s,o),i=o.mode||"svg",a={},c=o.style||{},p={...i==="svg"?ni:{},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"&&Xr(l,x);break;case"color":a.color=x;break;case"rotate":typeof x=="string"?l[k]=Jr(x):typeof x=="number"&&(l[k]=x);break;case"ariaHidden":case"aria-hidden":x!==!0&&x!=="true"&&delete p["aria-hidden"];break;default:s[k]===void 0&&(p[k]=x)}}const h=xr(e,l),m=h.attributes;if(l.inline&&(a.verticalAlign="-0.125em"),i==="svg"){p.style={...a,...c},Object.assign(p,m);let k=0,x=o.id;return typeof x=="string"&&(x=x.replace(/-/g,"_")),p.dangerouslySetInnerHTML={__html:oi(yr(h.body,x?()=>x+"ID"+k++:"iconifyReact"))},pe.createElement("svg",p)}const{body:b,width:u,height:g}=e,y=i==="mask"||(i==="bg"?!1:b.indexOf("currentColor")!==-1),C=Qr(b,{...m,width:u+"",height:g+""});return p.style={...a,"--svg":ei(C),width:To(m.width),height:To(m.height),...si,...y?Rt:kn,...c},pe.createElement("span",p)};cn(!0);Rr("",Tr);if(typeof document<"u"&&typeof window<"u"){gn();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"||!fr(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;Sr(n,s)||console.error(r)}catch{console.error(r)}}}}class yn extends pe.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=st(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const l=ur(s);if(!l){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),l!==null&&(this._loading={name:r,abort:Hr([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:pe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),ii({...Ht,...n.data},r,o._inline,o._ref)}}const li=pe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return pe.createElement(yn,r)});pe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return pe.createElement(yn,r)});var ci=li;const ai=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function it({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=J(),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(f,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(f,{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(ci,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(A,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}it.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};it.defaultProps={style:{},controls:1,modestbranding:1};function Rn({setParams:e,onClose:o,params:n}){const{t:r}=J(),[s,l]=v.useState(""),i=s&&n.blockletVideos.includes(s),a=ai(s),c=()=>{e(p=>{const h=[...p.blockletVideos];return h.push(s),{...p,blockletVideos:h}}),o()};return t.jsxs(Fo,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(An,{children:r("studio.videoDialogTitle")}),t.jsxs(Wn,{children:[t.jsx(Vn,{fullWidth:!0,value:s,onChange:p=>l(p.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(ot,{position:"end",children:t.jsx(oe,{onClick:()=>l(""),children:t.jsx(as,{})})}):null,error:i}),i&&t.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(it,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Fn,{children:[t.jsx(ee,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(ee,{disabled:!a||i,onClick:c,children:r("studio.confirm")})]})]})}Rn.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const _o=v.lazy(()=>Uo(()=>import("./index-DjDooCTg.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function Sn({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:l,paramsErrTip:i,setParamsErrTip:a,setLoading:c,initUrl:p,initLogoUrl:h,setInitLogoUrl:m,componentDid:b}){const{t:u}=J(),{api:g}=he(),y=St(),C=v.useRef(null),k=v.useRef(null),[x,I]=tr(r),[T,D]=v.useState(!1),j=ks({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),P=async R=>{const q=setTimeout(()=>{c(!1)},2e4),$=await nr(g,R);c(!1),clearTimeout(q),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),y(window.location.pathname.replace(`${U.UNOWNED_DID}/create`,`${$}/create`),{replace:!0})},M=()=>{if(!s.blockletTitle){E.error(u("blocklet.publish.errorTip.noTitle"));return}if(!(x!=null&&x.url)){E.error(u("blocklet.publish.noStoreSelected"));return}const R=or();j(async(q,$)=>{var H,K,Z;try{const G=await g.connectByStudio({input:{did:(H=r==null?void 0:r.meta)==null?void 0:H.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:x.url,storeId:x.id,storeName:x.name,type:((K=s==null?void 0:s.blockletComponents)==null?void 0:K.length)>0?"pack":"resource",componentDid:b,messageId:R,tenantScope:(p==null?void 0:p.searchParams.get("tenantScope"))||""}});if(!(G!=null&&G.url)){E.error("failed to connect to store");return}$(G.url),P({did:(Z=r==null?void 0:r.meta)==null?void 0:Z.did,projectId:"",messageId:R})}catch(G){const X=Ce(G);E.error(X),c(!1)}})},F=`${U.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,S=`${U.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,B=s!=null&&s.blockletLogo?`${F}/${s.blockletLogo}`:`${U.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,w=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(R=>`${S}/${R}`),_=()=>o?!1:!e||e===U.UNOWNED_DID?(E.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,V=R=>{if(!R.destination)return;const q=Array.from(s.blockletScreenshots),[$]=q.splice(R.source.index,1);q.splice(R.destination.index,0,$),l(H=>({...H,blockletScreenshots:q}))},W=R=>{if(!R.destination)return;const q=Array.from(s.blockletVideos),[$]=q.splice(R.source.index,1);q.splice(R.destination.index,0,$),l(H=>({...H,blockletVideos:q}))};return t.jsxs(di,{children:[t.jsx(f,{display:"flex",className:"section",children:t.jsxs(f,{sx:{flex:1},children:[t.jsx(se,{disabled:n||o,label:`Blocklet ${u("common.title")}`,placeholder:`Blocklet ${u("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(se,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===U.UNOWNED_DID&&t.jsx(ot,{position:"end",children:t.jsx(Ut,{blocklet:r,store:x,componentDid:b,onChangeStore:I,disabled:!s.blockletTitle||o||n,loading:n,onClick:M})})},error:!!i.projectId,helperText:i.projectId||"",value:e===U.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(se,{disabled:n||o,label:`Blocklet ${u("common.description")}`,placeholder:`Blocklet ${u("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(se,{disabled:n||o,label:`Blocklet ${u("common.homepageTip")}`,placeholder:`Blocklet ${u("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:u("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),l({blockletHomepage:R.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3}}),t.jsx(se,{disabled:n||o,label:`Blocklet ${u("common.community")}`,placeholder:`Blocklet ${u("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:u("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),l({blockletCommunity:R.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3}}),t.jsx(se,{disabled:n||o,label:`Blocklet ${u("common.support")}`,placeholder:`Blocklet ${u("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:u("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),l({blockletSupport:R.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3}}),t.jsx(se,{disabled:n||o,label:`Blocklet ${u("common.repository")}`,placeholder:`Blocklet ${u("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:u("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),l({blockletRepository:R.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(f,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(f,{sx:{flex:1},children:[t.jsxs(f,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:u("common.logo")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.type"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.ratio"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.size"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(f,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(zo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||B,onClick:()=>{var R;_()&&((R=C.current)==null||R.open())}})})]}),t.jsxs(f,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:u("common.screenshot")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(f,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.ratio"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.count"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.size"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.order"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:u("studio.orderTip")})]})})]})]}),t.jsx(fo,{onDragEnd:o?void 0:V,children:t.jsx(ho,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(f,{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:[w.map(($,H)=>t.jsx(mo,{draggableId:$,index:H,isDragDisabled:o,children:(K,Z)=>t.jsxs(f,{ref:K.innerRef,...K.draggableProps,className:"screenshot",sx:{transform:Z.isDragging?"scale(1.05)":"none",boxShadow:Z.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:$}),!o&&t.jsx(oe,{...K.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(mt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(G=>{const X=[...G.blockletScreenshots];return X.splice(H,1),{...G,blockletScreenshots:X}})},children:t.jsx(bo,{})})]})},$)),R.placeholder,w.length<5&&t.jsx(f,{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 $;_()&&(($=k.current)==null||$.open())},children:"+"})]})})})]}),t.jsxs(f,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:u("studio.video")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.videoType"),":"," "]}),t.jsxs(f,{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(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.count"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(f,{children:t.jsxs(f,{component:"span",children:[t.jsxs(f,{component:"span",sx:{color:"#555"},children:[u("studio.order"),":"," "]}),t.jsx(f,{component:"span",sx:{color:"#007ec6"},children:u("studio.orderTip")})]})})]})]}),t.jsx(fo,{onDragEnd:o?void 0:W,children:t.jsx(ho,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(f,{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(($,H)=>t.jsx(mo,{draggableId:$,index:H,isDragDisabled:o,children:(K,Z)=>t.jsxs(f,{ref:K.innerRef,...K.draggableProps,className:"screenshot",sx:{transform:Z.isDragging?"scale(1.05)":"none",boxShadow:Z.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(it,{url:$,style:{pointerEvents:Z.isDragging?"none":"auto"}}),!o&&t.jsx(oe,{...K.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(mt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(G=>{const X=[...G.blockletVideos];return X.splice(H,1),{...G,blockletVideos:X}})},children:t.jsx(bo,{})})]})},$)),R.placeholder,s.blockletVideos.length<3&&t.jsx(f,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{_()&&D(!0)},children:"+"})]})})})]})]})}),t.jsxs(v.Suspense,{fallback:t.jsx(Oe,{}),children:[t.jsx(_o,{ref:C,popup:!0,onUploadFinish:R=>{var q;l({blockletLogo:R.data.filename}),m(""),(q=C.current)==null||q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:F,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"),T&&t.jsx(Rn,{onClose:()=>D(!1),params:s,setParams:l}),t.jsx(_o,{ref:k,popup:!0,onUploadFinish:R=>{var q;l($=>{var K;const H=$.blockletScreenshots||[];return H.push((K=R.data)==null?void 0:K.filename),{...$,blockletScreenshots:H}}),(q=k.current)==null||q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-w.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")]})]})}Sn.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 di=ce.div`
|
|
133
|
-
margin-top: 24px;
|
|
134
|
-
.screenshot {
|
|
135
|
-
margin-bottom: 16px;
|
|
136
|
-
max-width: 240px;
|
|
137
|
-
max-height: 135px;
|
|
138
|
-
width: 240px;
|
|
139
|
-
height: 135px;
|
|
140
|
-
overflow: hidden;
|
|
141
|
-
display: flex;
|
|
142
|
-
align-items: center;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
background-color: #eee;
|
|
145
|
-
margin-right: 16px;
|
|
146
|
-
position: relative;
|
|
147
|
-
.action {
|
|
148
|
-
visibility: hidden;
|
|
149
|
-
position: absolute;
|
|
150
|
-
width: 42px;
|
|
151
|
-
height: 42px;
|
|
152
|
-
right: 6px;
|
|
153
|
-
top: 6px;
|
|
154
|
-
border-radius: 4px;
|
|
155
|
-
background-color: rgba(0, 0, 0, 1);
|
|
156
|
-
color: rgba(255, 255, 255, 1);
|
|
157
|
-
}
|
|
158
|
-
&:hover .action {
|
|
159
|
-
visibility: visible;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
.screenshot img {
|
|
163
|
-
width: 100%; /* 图像宽度填充容器 */
|
|
164
|
-
height: auto; /* 图像高度自适应 */
|
|
165
|
-
}
|
|
166
|
-
`;var Zt={},ui=fe;Object.defineProperty(Zt,"__esModule",{value:!0});var wn=Zt.default=void 0,pi=ui(me()),fi=t;wn=Zt.default=(0,pi.default)((0,fi.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 hi=(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},mi=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*bi(e,o){let n=0;for(;n<e.size;)yield e.slice(n,n+o),n+=o}const xi=async({did:e,projectId:o,uploadType:n="logo",imageUrl:r})=>{const s=await mi(r);new FormData().append("file",s);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(s.name),name:encodeURIComponent(s.name),type:s.type},c=(await ao.post(le(U.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,p=2*1024*1024;let h=0,m="";for(const b of bi(s,p)){const u=await ao.patch(le(U.WELLKNOWN_SERVICE_PATH_PREFIX,c),b,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":h,"Content-Type":"application/offset+octet-stream"}});h+=b.size,m=u.data.filename}return m},vn=({params:e,hasSelectedResources:o,projectId:n,status:r,t:s})=>{const l=[];return e.blockletTitle||l.push({param:"blockletTitle",message:s("blocklet.publish.errorTip.noTitle")}),(!n||n===U.UNOWNED_DID)&&l.push({param:"projectId",message:s("blocklet.publish.errorTip.noDid")}),!e.uploadedResource&&!o&&l.push({param:"blockletResource",message:s("blocklet.publish.errorTip.noResource")}),e.blockletVersion?ve.valid(e.blockletVersion)||l.push({param:"blockletVersion",message:s("blocklet.publish.errorTip.inValidVersion")}):l.push({param:"blockletVersion",message:s("blocklet.publish.errorTip.noVersion")}),r===ke.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||l.push({param:"blockletDescription",message:s("blocklet.publish.errorTip.noDescription")}),e.note||l.push({param:"note",message:s("blocklet.publish.errorTip.noNote")})),l.length?l:null},gi=({params:e,hasSelectedResources:o,step:n,t:r,projectId:s})=>{if(n===0){if(!e.blockletTitle)return r("blocklet.publish.errorTip.noTitle");if(!s||s===U.UNOWNED_DID)return r("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return r("blocklet.publish.errorTip.noDescription")}if(n===2&&!e.uploadedResource&&!o)return r("blocklet.publish.errorTip.noResource");if(n>=4){if(!e.blockletVersion)return r("blocklet.publish.errorTip.noVersion");if(!ve.valid(e.blockletVersion))return r("blocklet.publish.errorTip.inValidVersion");if(!e.note)return r("blocklet.publish.errorTip.noNote")}return""};function eo({blocklet:e,releaseId:o,connectedStores:n,projectId:r,releaseType:s,publishedStoreIds:l,onPublish:i,onDelete:a,projectType:c,componentDid:p,onOpenConnectStore:h,behavior:m,onSelectConnectStore:b}){var I,T;const{t:u}=J(),{actions:{refreshBlocklet:g}}=Ie(),{session:y}=nt(),{storeList:C}=nn({fromBlocklet:!0,blocklet:e,componentDid:p,userDid:(I=y==null?void 0:y.user)==null?void 0:I.did}),k=v.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((D,j)=>(D[j.storeId]=j,D),{}):{},[n]),x=(T=e==null?void 0:e.meta)==null?void 0:T.did;return t.jsxs(t.Fragment,{children:[m==="connect"&&!!(C!=null&&C.length)&&t.jsx(Oo,{severity:"info",style:{width:"100%"},children:t.jsxs(f,{color:Un[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:[u(c==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),t.jsx(vs,{sx:{marginLeft:1}})]})}),t.jsx(Hn,{children:C==null?void 0:C.map(D=>t.jsx(Kn,{"data-cy":"store-switch",children:t.jsx(Gn,{children:t.jsx(ys,{behavior:m,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:h})})},D.url))}),t.jsx(Jo,{teamDid:x,storeList:C,scope:"studio",onAdd:g})]})}eo.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};eo.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function Cn({did:e,params:o,setParams:n,projectId:r,open:s,onClose:l}){const{t:i}=J(),[a,c]=v.useState(!1),{api:p}=he(),[h,m]=v.useState(!1),[b,u]=v.useState(!1),g=()=>{m(o.autoUpload),u(o.possibleSameStore),c(!1),l(!1)},y=async()=>{c(!0);try{await p.updateProject({input:{did:e,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!h,possibleSameStore:!!b}}),n({autoUpload:h,possibleSameStore:b}),l(!1)}catch(k){E.error(k.message)}c(!1)};v.useEffect(()=>{m(o.autoUpload),u(o.possibleSameStore)},[o]);const C=!!(r&&r!==U.UNOWNED_DID);return t.jsx(Xo,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:s,onClose:g,actions:t.jsxs(t.Fragment,{children:[t.jsx(ee,{onClick:k=>{k.stopPropagation(),l()},color:"inherit",children:i("common.cancel")}),C&&t.jsxs(ee,{onClick:k=>{k.stopPropagation(),y()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a,variant:"contained",autoFocus:!0,children:[a&&t.jsx(Je,{size:16}),i("common.confirm")]})]}),children:C?t.jsxs(f,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs(f,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(f,{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(uo,{checked:h,onChange:(k,x)=>m(x)})]}),t.jsxs(f,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(f,{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(uo,{checked:b,onChange:(k,x)=>u(x)})]})]}):t.jsxs(f,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[t.jsx(f,{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")})]})})}Cn.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 In({downloadUrl:e,installUrl:o,handleSetTip:n,isPack:r,disabled:s}){const{t:l}=J(),[i,a]=v.useState(!1),c=v.useRef(null),p=()=>{a(!i)},h=m=>{c.current&&c.current.contains(m.target)||a(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(ee,{disabled:s,ref:c,onClick:p,children:t.jsx(f,{component:ne,sx:{fontSize:18},icon:"bxs:download"})}),t.jsx(Bo,{sx:{zIndex:10},open:i,anchorEl:c.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:m})=>t.jsx(Ao,{...m,style:{transformOrigin:"center top"},children:t.jsx(wt,{children:t.jsx(Wo,{onClickAway:h,children:t.jsxs(Vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&t.jsx(f,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(qe,{sx:{color:"#333"},children:[t.jsx(f,{component:ne,sx:{mr:1},icon:"ic:round-install-desktop"}),t.jsx(A,{variant:"inherit",children:l("blocklet.publish.installToThisServer")})]})}),t.jsxs(qe,{onClick:n,children:[t.jsx(f,{component:ne,sx:{mr:1},icon:"iconamoon:copy"}),t.jsx(A,{variant:"inherit",children:l("blocklet.publish.copyInstallUrl")})]}),t.jsx(f,{component:"a",href:e,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(qe,{sx:{color:"#333"},children:[t.jsx(f,{component:ne,sx:{mr:1},icon:"ph:download"}),t.jsx(A,{variant:"inherit",children:l("common.download")})]})})]})})})})})]})}In.propTypes={disabled:d.bool.isRequired,isPack:d.bool.isRequired,downloadUrl:d.string.isRequired,installUrl:d.string.isRequired,handleSetTip:d.func.isRequired};var Mo;const Lo=(Mo=window.env)==null?void 0:Mo.serverEndpoint;function Dn({projectId:e,params:o,setParamsErrTip:n,initUrl:r,setParams:s,mode:l,loading:i,blocklet:a,release:c,isPublished:p,releaseId:h,getData:m,getRelease:b,paramsErrTip:u,componentDid:g,resourceRelateComponents:y,disabledSelectComponents:C,saveSelectedEventsRef:k,hasSelectedResources:x,initLogoUrl:I,setLoading:T,releaseUsedLast:D,setReleaseUsedLast:j,projectType:P}){var Se;const{t:M,locale:F}=J(),{api:S}=he(),B=St(),[w,_]=v.useState(!1),[V,W]=v.useState(!1),[R,q]=v.useState(),$=Ee(Y=>Y.breakpoints.down("md")),H=v.useMemo(()=>{var Y;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((Y=o==null?void 0:o.blockletComponents)==null?void 0:Y.length)>0?(o==null?void 0:o.blockletComponents.find(z=>z.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),K=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:g},"*"),b()},Z=async Y=>{var _e,lt,We;if(u!=null&&u.blockletHomepage||u!=null&&u.blockletSupport||u!=null&&u.blockletCommunity){E.error((u==null?void 0:u.blockletHomepage)||(u==null?void 0:u.blockletSupport)||(u==null?void 0:u.blockletCommunity));return}const ae=vn({params:o,hasSelectedResources:x,projectId:e,status:Y,t:M});if(ae){E.error(ae.map(O=>O.message).join("; ")),n(ae.reduce((O,Q)=>({...O,[Q.param]:Q.message}),{}));return}const z={...o};if(z.blockletComponents=hi(z.blockletComponents,a,y,C),z.blockletVersion=ve.valid(z.blockletVersion),!z.blockletVersion){E.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(I)try{const O=await xi({did:a.meta.did,projectId:e,imageUrl:I});z.blockletLogo=O,s({blockletLogo:O})}catch(O){E.error(O.message);return}if(o.resourceFromSelect){z.uploadedResource="";try{const O=Object.keys(k.current);await Ye(O.map(Q=>()=>{const re=k.current[Q];return Xs({api:S,locale:F,projectId:e,releaseId:D?"":h,appDid:a.meta.did,component:re.component,resources:re.resources,initUrl:r})}),{concurrency:2})}catch(O){E.error(((We=(lt=(_e=O==null?void 0:O.response)==null?void 0:_e.data)==null?void 0:lt.error)==null?void 0:We.message)||O.message),n({blockletResource:"Invalid save the resource"});return}}else z.blockletComponents=[];z.blockletTitle=(z.blockletTitle||"").trim(),z.blockletDescription=(z.blockletDescription||"").trim(),z.blockletSupport=(z.blockletSupport||"").trim(),z.blockletHomepage=(z.blockletHomepage||"").trim(),z.blockletCommunity=(z.blockletCommunity||"").trim(),z.blockletRepository=(z.blockletRepository||"").trim(),z.blockletIntroduction=(z.blockletIntroduction||"").trim(),z.note=(z.note||"").trim(),z.blockletComponents=((z==null?void 0:z.blockletComponents)||[]).filter(O=>O.included).map(O=>Ct(O,["did","required"])).map(JSON.stringify);try{await S.createRelease({input:{...z,did:a.meta.did,projectId:e,releaseId:D?"":h,status:Y}}),Y==="draft"?E.success(M("blocklet.publish.saveDraftSuccess")):(j(!1),E.success(M("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:g},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(O){const Q=Ce(O);E.error(Q),(/resource/.test(Q)||/zip/.test(Q))&&n({blockletResource:Q});return}const Ae=await S.getProject({input:{did:a.meta.did,projectId:e}}),Te=Ae.project.lastReleaseId;o.autoUpload&&await Ye(Ae.project.connectedStores.map(O=>async()=>{try{const Q=await S.publishToStore({input:{did:a.meta.did,storeId:O.storeId,storeName:O.storeName,projectId:e,releaseId:Te,type:H}});E.success(t.jsx(Rs,{storeName:O.storeName,storeUrl:O.storeUrl,developerDid:O.developerDid,published:Q.url==="published"}),{duration:1e4})}catch(Q){E.error(Ce(Q))}}),{concurrency:4}),K==null||K(),B(`../${e}/view/${Te}`,{replace:!0})},G=Y=>(T(!0),Z(Y).finally(()=>{T(!1)})),X=async Y=>{await sr(S,Y),m()},De=()=>{W(!0)},Be=le(Lo,`/api/project/${a.meta.did}/${e}/${h}/release/blocklet.json`),be=new URL(Lo);be.pathname=le(be.pathname,"/launch-blocklet/agreement"),be.searchParams.set("blocklet_meta_url",Be);const te=be.href,Pe=()=>q(Be);return t.jsxs(t.Fragment,{children:[t.jsx(ji,{className:"sticky-header",children:t.jsxs(f,{display:"flex",alignItems:"center",flexDirection:"row",children:[t.jsxs(Eo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ie,{to:"../",children:M("common.blockletStudio")}),e===U.UNOWNED_DID?t.jsx(A,{color:"text.primary",children:t.jsx(ue,{maxLength:$?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):t.jsx(ie,{to:`../${e}`,children:t.jsx(ue,{maxLength:$?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),t.jsx(A,{color:"text.primary",children:l==="create"?M("common.create"):(o==null?void 0:o.blockletVersion)||M("common.edit")})]}),t.jsx(f,{flex:"1"}),!p&&t.jsxs(ht,{disabled:i,variant:"contained",children:[t.jsxs(ee,{variant:"contained",onClick:()=>G(ke.PROJECT.RELEASE_STATUS.published),children:[i&&t.jsx(Je,{size:14,sx:{mr:.5},color:"inherit"}),M("blocklet.publish.createRelease")]}),t.jsx(ee,{variant:"contained",onClick:De,children:t.jsx(ne,{icon:"mage:settings-fill",fontSize:"16px"})})]}),p&&t.jsxs(t.Fragment,{children:[t.jsx(Fo,{fullWidth:!0,maxWidth:"sm",open:R,onClose:()=>q(""),children:t.jsxs(f,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(A,{variant:"h6",sx:{mb:2},children:M("blocklet.publish.installResourceTip")}),t.jsx(ws,{children:R}),t.jsxs(A,{sx:{mt:2},children:[M("blocklet.publish.installResourceTip2"),t.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:M("blocklet.publish.installResourceHelp")})]})]})}),t.jsxs(ht,{disabled:i,variant:"contained",children:[t.jsxs(ee,{onClick:()=>_(!0),children:[i?t.jsx(Je,{size:14,sx:{mr:1},color:"inherit"}):t.jsx(wn,{sx:{fontSize:"1.3em",mr:1}}),M($?"common.upload":"blocklet.publish.connectOrUpload")]}),t.jsx(In,{isPack:H==="pack",downloadUrl:le(`${U.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${h}/download/${(c.files||[])[0]}`),installUrl:te,handleSetTip:Pe}),t.jsx(ee,{onClick:De,children:t.jsx(ne,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),t.jsx(Xo,{title:M("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:w,onClose:()=>_(!1),children:t.jsx(eo,{projectType:P,blocklet:a,releaseType:H,projectId:e,releaseId:h,componentDid:g,onPublish:K,onOpenConnectStore:X,onDelete:m,connectedStores:o.connectedStores||[],publishedStoreIds:c==null?void 0:c.publishedStoreIds})}),t.jsx(Cn,{did:(Se=a==null?void 0:a.meta)==null?void 0:Se.did,params:o,projectId:e,open:V,setParams:s,onClose:()=>W(!1)})]})}Dn.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 ji=ce.div`
|
|
167
|
-
.sticky-header {
|
|
168
|
-
margin-top: -12px;
|
|
169
|
-
padding: 12px 0;
|
|
170
|
-
position: sticky;
|
|
171
|
-
top: 0;
|
|
172
|
-
z-index: 99;
|
|
173
|
-
display: flex;
|
|
174
|
-
align-items: center;
|
|
175
|
-
justify-content: space-between;
|
|
176
|
-
background-color: #fff;
|
|
177
|
-
padding-bottom: 12px;
|
|
178
|
-
border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
|
|
179
|
-
}
|
|
180
|
-
`;function Pn({text:e}){return e?t.jsx(Cs,{wrapperElement:{"data-color-mode":"light"},source:ds.sanitize(e),rehypePlugins:[[Is,{target:"_blank"}]]}):t.jsx(ye,{Icon:_t})}Pn.propTypes={text:d.string.isRequired};function Tn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var h;const{t:i}=J(),[a,c]=v.useState(l?"preview":"write"),p=(m,b)=>{c(b)};return t.jsxs(f,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(f,{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(Xn,{value:a,onChange:p,"aria-label":"wrapped label tabs example",children:[t.jsx(io,{value:"write",label:"Write"}),t.jsx(io,{value:"preview",label:"Preview"})]})]}),t.jsx(f,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(se,{disabled:r||l,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:l,endAdornment:t.jsxs(ot,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",ke.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:m=>{s({blockletIntroduction:""}),o({blockletIntroduction:m.target.value.slice(0,ke.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(f,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(Pn,{text:e.blockletIntroduction||""})})]})}Tn.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 to={},ki=fe;Object.defineProperty(to,"__esModule",{value:!0});var _n=to.default=void 0,yi=ki(me()),qo=t;_n=to.default=(0,yi.default)([(0,qo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,qo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function oo({step:e,ok:o,active:n,error:r}){let s="grey.500",l=e+1;return o&&(l=t.jsx(Ds,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",l=t.jsx(_n,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(f,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}oo.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};oo.defaultProps={step:0,ok:!1,active:0,error:""};function Ln({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:p}=J(),h=()=>{n(g=>g+1)},m=()=>{n(g=>g-1)},b=g=>g===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):g===2?i==null?void 0:i.blockletResource:g>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",u=a||vn({hasSelectedResources:r,params:s,projectId:c,t:p})===null;return t.jsxs(f,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(Jn,{activeStep:o,orientation:"vertical",children:e.map((g,y)=>{const C={},k=l||!gi({hasSelectedResources:r,params:s,projectId:c,step:y,t:p}),x=l?"":b(y);return x&&(C.optional=t.jsx(A,{variant:"caption",color:"error",children:x}),C.error=!0),t.jsxs(Qn,{children:[t.jsx(Yn,{icon:t.jsx(oo,{error:x,active:u?99:o,step:y,ok:k}),sx:{cursor:"pointer",color:x?"error.main":"inherit"},disabled:!1,onClick:()=>n(y),...C,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:x||!k&&o>y?"error.main":"inherit",children:g.label})}),t.jsxs(Zn,{children:[t.jsx(A,{fontSize:12,children:g.description}),!u&&t.jsx(f,{sx:{mb:2},children:t.jsxs("div",{children:[y<e.length-1&&t.jsx(ee,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:x||!k,children:p("common.continue")}),y>0&&t.jsx(ee,{disabled:y===0,onClick:m,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},g.label)})}),o>=e.length-1&&t.jsx(wt,{square:!0,elevation:0,sx:{p:3},children:t.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Ln.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}).isRequired};const Ri=[".zip",".gz"],Si=1024*1024*100,wi=v.lazy(()=>Uo(()=>import("./index-DjDooCTg.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function no({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a}=J(),c=v.useRef(null),p=()=>n?!1:!o||o===U.UNOWNED_DID?(E.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,h=`${U.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(f,{sx:{mt:3},children:[t.jsx(A,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(je,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(A,{component:"a",href:`${h}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(ee,{variant:"outlined",size:"small",onClick:()=>{var m;p()&&((m=c.current)==null||m.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(v.Suspense,{fallback:t.jsx(Oe,{}),children:t.jsx(wi,{ref:c,popup:!0,onUploadFinish:m=>{var b;s({uploadedResource:m.data.filename}),l({blockletResource:""}),(b=c.current)==null||b.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:h,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Ri,maxFileSize:Si,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&t.jsx(f,{color:"error.main",mt:1,fontSize:14,children:i})]})}no.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};no.defaultProps={};function et({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:l}){var a;const{t:i}=J();return t.jsx(f,{display:"flex",mt:3,className:"section",children:t.jsxs(f,{sx:{flex:1},children:[t.jsx(se,{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(se,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:l||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(ot,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",ke.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,ke.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}et.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};et.defaultProps={};function qn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&qn(e[o]);return e}const vi=({tabs:e,blocklet:o,ancestors:n=[]})=>{const r=o.meta.did;e.push({label:t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Pt,{size:24,blocklet:o,ancestors:n}),t.jsx(f,{ml:"4px",className:"text",children:t.jsx(f,{children:o.meta.title})})]},r),value:r})},$o=(e,o)=>{const n=Ct(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","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.resourceFromSelect=!n.uploadedResource,n},Ci={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},No={branding:0,introduction:1,resources:2,blocklets:3,version:4};function so({initUrl:e,...o}){var ro;const{projectId:n,mode:r,releaseId:s,componentDid:l=""}=tt(),{t:i}=J(),{blocklet:a}=Ie(),[c,p]=we({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",resourceFromSelect:!0}),[h,m]=we({}),[b,u]=v.useState(!1),[g,y]=we(null),{api:C}=he(),k=Ee(L=>L.breakpoints.down("md")),[x,I]=v.useState({}),[T,D]=v.useState(!1),j=v.useRef({}),[P,M]=we({}),[F,S]=v.useState(""),[B,w]=we({}),_=e==null?void 0:e.searchParams.get("dependentComponentsMode"),V=_==="readonly",W=v.useMemo(()=>{const L={};return Object.keys(B).forEach(N=>{const ge=B[N];ge&&ge.forEach(Mn=>{L[Mn]=!0})}),L},[B]),R=v.useCallback(L=>{V&&p({blockletComponents:[]}),w(L)},[V,w,p]),q=v.useCallback((...L)=>{M(...L),m({blockletResource:""})},[]),$=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[H,K]=v.useState(r==="new-release"?4:0);v.useEffect(()=>{n&&m({projectId:""})},[n,m]);const Z=v.useMemo(()=>{var L;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":(L=c==null?void 0:c.blockletComponents)!=null&&L.some(N=>N.included)||Object.keys(W).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,W,c==null?void 0:c.blockletResourceType]),G=[],X=((a==null?void 0:a.children)||[]).filter(L=>{var N;return(N=L.meta.resource)==null?void 0:N.exportApi}).filter(L=>!l||L.meta.did===l);X.forEach(L=>{vi({tabs:G,blocklet:L,t:i,ancestors:[a]})});const[De,Be]=v.useState((ro=G[0])==null?void 0:ro.value),be=!T&&(g==null?void 0:g.status)==="published",te=be,Pe=ms(()=>{if(!e)return;S(e.searchParams.get("logo")),p(N=>{var ge;return{...N,blockletTitle:(N==null?void 0:N.blockletTitle)||e.searchParams.get("title"),blockletDescription:(N==null?void 0:N.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(N==null?void 0:N.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(ge=N==null?void 0:N.blockletComponents)!=null&&ge.length?N==null?void 0:N.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(N==null?void 0:N.note)||e.searchParams.get("note")||"No note"}});const L=e.searchParams.get("resources");try{const N=JSON.parse(L);I(N)}catch{}}),Se=async()=>{if($)try{const L=await C.getRelease({input:{did:a.meta.did,projectId:n,releaseId:$}});if(u(!1),!L.release){E.error("Release not found");return}L.release=qn(L.release),r!=="view"&&(L.release.note=""),p(N=>$o({...N,...L.release,blockletVersion:r==="create"||r==="new-release"?ve.inc(L.release.blockletVersion,"patch"):L.release.blockletVersion},a)),y(L.release)}catch(L){u(!1),E.error(Ce(L))}},Y=async()=>{if(n===U.UNOWNED_DID){p({blockletVersion:"1.0.0",blockletTitle:""});return}if(!n){E.error(i("blocklet.publish.errorTip.noDid"));return}try{const N=(await C.getProject({input:{did:a.meta.did,projectId:n}})).project||{};N.blockletVersion?(r==="create"||r==="new-release")&&ve.valid(N.blockletVersion)&&(N.blockletVersion=ve.inc(N.blockletVersion,"patch")):N.blockletVersion="1.0.0";const ge=$o(N,a);p(ge),N.lastReleaseId||Pe()}catch(L){E.error(Ce(L))}},ae=v.useCallback(async()=>{u(!0);try{if(r==="view"){if(!$){E.error("Empty release id");return}await Y(),await Se();return}await Y(),$&&(D(!0),await Se())}finally{u(!1)}},[r,$]),z=L=>{p({blockletComponents:L})},Ae=L=>{p({blockletResourceType:L})};v.useEffect(()=>{ae()},[ae]),v.useEffect(()=>{n===U.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&Pe()},[n,e,r,Pe]);const Te=v.useMemo(()=>!!Object.keys(P).find(L=>!!P[L].length),[P]);if(!c&&b)return t.jsx(Oe,{});if(!c)return null;const _e=X.find(L=>L.meta.did===De);if(X.every(L=>L.status!=="running")&&(X!=null&&X.length))return t.jsx(ye,{children:i("blocklet.publish.allComponentsNotRunning")});const We=L=>{Be(L)},O=e==null?void 0:e.searchParams.get("resourcesTitle"),Q=e==null?void 0:e.searchParams.get("componentsTitle"),re=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:O||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:Q||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],Nn=re[H]||re[re.length-1],xe=Ci[H];return t.jsxs(Ii,{...o,children:[t.jsx(Dn,{blocklet:a,release:g,getData:ae,getRelease:Se,mode:r,params:c,setParams:p,setParamsErrTip:m,readOnly:te,isPublished:be,loading:b,setLoading:u,initLogoUrl:F,releaseId:$,projectId:n,projectType:Z,resourceComponents:X,resourceComponentsMap:B,resourceRelateComponents:W,resourceItem:_e,saveSelectedEventsRef:j,hasSelectedResources:Te,releaseUsedLast:T,setReleaseUsedLast:D,setRelease:y,paramsErrTip:h}),t.jsxs(f,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[t.jsx(f,{pt:3}),t.jsxs(f,{sx:{gap:3},display:"flex",flexDirection:k?"column":"row",children:[!k&&t.jsx(Ln,{steps:re,loading:b,viewMode:r==="view",params:c,hasSelectedResources:Te||c.uploadedResource,paramsErrTip:h,activeStep:H,setActiveStep:K,projectId:n,resourcesUrlTitle:O,componentsUrlTitle:Q}),t.jsxs(f,{flex:"1",maxWidth:"720px",children:[!k&&xe!=="introduction"&&t.jsxs(A,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[Nn.label,xe==="branding"&&t.jsx(de,{title:i("blocklet.publish.brandingHelp"),placement:"right",children:t.jsx(f,{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(hs,{})})})]}),(k||xe==="branding")&&t.jsx(f,{flexDirection:"column",children:t.jsx(Sn,{projectId:n,setParams:p,setParamsErrTip:m,params:c,componentDid:l,blocklet:a,initUrl:e,loading:b,setLoading:u,paramsErrTip:h,readOnly:te,initLogoUrl:F,setInitLogoUrl:S})}),k&&t.jsx(f,{flexDirection:"column",children:t.jsx(et,{loading:b,params:c,paramsErrTip:h,setParams:p,setParamsErrTip:m,readOnly:te})}),(k||xe==="introduction")&&t.jsx(f,{display:"flex",flexDirection:"column",sx:{mt:k?5:0,width:"100%"},children:t.jsx(Tn,{loading:b,readOnly:te,params:c,setParams:p,paramsErrTip:h,setParamsErrTip:m})}),k&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:re[No.resources].label}),t.jsx(f,{display:k||xe==="resources"?"flex":"none",sx:{maxWidth:720},flexDirection:"column",children:t.jsx(f,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(f,{sx:{flex:1},children:[t.jsxs(es,{onChange:()=>p({resourceFromSelect:!c.resourceFromSelect}),children:[t.jsx(ft,{value:"select",disabled:te,control:t.jsx(lo,{size:"small",checked:c.resourceFromSelect}),label:i("blocklet.publish.resourceSelect")}),t.jsx(ft,{value:"select",disabled:te,control:t.jsx(lo,{size:"small",checked:!c.resourceFromSelect}),label:i("blocklet.publish.resourceUpload")})]}),c.resourceFromSelect&&t.jsxs(t.Fragment,{children:[!l&&t.jsx(us,{tabs:G,current:De,onChange:We,sx:{ml:-2,mt:2,maxWidth:k?window.innerWidth-24:"100%"}}),t.jsx(Vt,{loading:b,initialResources:x,saveSelectedEventsRef:j,selectedResourceIds:P,setSelectedResourceIds:q,setResourceComponentsMap:R,error:h.blockletResource,app:a,readOnly:te,component:_e,componentDid:l,initUrl:e,params:c,setParams:p,projectId:n===U.UNOWNED_DID?"":n,releaseUsedLast:T,release:{...g,id:$}})]}),!c.resourceFromSelect&&t.jsx(no,{app:a,readOnly:te,projectId:n===U.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:p,setParamsErrTip:m})]})})}),k&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:re[No.blocklets].label}),(k||xe==="blocklets")&&t.jsx(f,{flexDirection:"column",children:t.jsx(f,{display:"flex",mt:3,className:"section full-width",children:t.jsx(f,{sx:{flex:1},children:t.jsx(Ot,{projectType:Z,disabled:b||te,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:z,onChangeBlockletResourceType:Ae,resourceRelateComponents:W,dependentComponentsMode:_})})})}),!k&&xe==="version"&&t.jsx(f,{flexDirection:"column",children:t.jsx(et,{loading:b,params:c,paramsErrTip:h,setParams:p,setParamsErrTip:m,readOnly:te})})]})]})]})]})}so.propTypes={initUrl:d.object};so.defaultProps={initUrl:null};const Ii=ce.div`
|
|
181
|
-
.section {
|
|
182
|
-
&.full-width {
|
|
183
|
-
max-width: 100%;
|
|
184
|
-
}
|
|
185
|
-
.MuiTypography-h3 {
|
|
186
|
-
font-size: 1.1rem;
|
|
187
|
-
font-weight: 700;
|
|
188
|
-
}
|
|
189
|
-
.left {
|
|
190
|
-
flex-shrink: 0;
|
|
191
|
-
width: 140px;
|
|
192
|
-
}
|
|
193
|
-
.MuiTabs-indicator {
|
|
194
|
-
display: none;
|
|
195
|
-
}
|
|
196
|
-
.MuiTypography-subtitle1 {
|
|
197
|
-
width: 120px;
|
|
198
|
-
font-weight: 700;
|
|
199
|
-
font-size: 1rem;
|
|
200
|
-
${({theme:e})=>e.breakpoints.down("sm")} {
|
|
201
|
-
width: 80px;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
.MuiButtonBase-root {
|
|
206
|
-
a {
|
|
207
|
-
color: inherit;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
.MuiInputBase-multiline .MuiInputAdornment-positionEnd {
|
|
211
|
-
align-self: flex-end;
|
|
212
|
-
.MuiTypography-root {
|
|
213
|
-
font-size: 0.8rem;
|
|
214
|
-
}
|
|
215
|
-
font-size: 0.8rem;
|
|
216
|
-
}
|
|
217
|
-
`;function $n({padding:e,initUrl:o}){const{blocklet:n}=Ie(),r=zn(),{componentDid:s}=tt();if(v.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(Di,{style:l,children:t.jsxs(En,{children:[t.jsx(ct,{path:"/",element:t.jsx(Mt,{initUrl:o})}),t.jsx(ct,{path:"/:projectId",element:t.jsx(Bs,{})}),t.jsx(ct,{path:"/:projectId/:mode/:releaseId",element:t.jsx(so,{initUrl:o})})]})})}$n.propTypes={padding:d.oneOfType([d.string,d.number]),initUrl:d.object};$n.defaultProps={padding:"",initUrl:null};const Di=ce(f)`
|
|
218
|
-
a {
|
|
219
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
220
|
-
}
|
|
221
|
-
`;export{$n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as x}from"./vendor-react-D-afvo_7.js";import{j as e,z as ye,T as k,a2 as O,aS as be,M as Z,ad as ee,bK as te,E as t,a1 as U,e as we,x as _,ak as Ce,al as G,a3 as E,aM as Se,aR as X,bO as Re,a6 as ke,a4 as De}from"./vendor-mui-core-COxJgW9_.js";import{d as ne,g as N,al as Te,ag as Y,ad as W,z as T,ap as _e}from"./vendor-arcblock-Dn16DH88.js";import{d as Ee}from"./Add-WwBlcqNF.js";import{y as A,a7 as Ie,B as Le,h as $e}from"./index-tDqjC_e2.js";import{f as M}from"./format-error-C0Ke3VXF.js";import{d as oe}from"./Launch-D9iyATKb.js";import{d as ze}from"./Done-BbnQSLvu.js";import{B as re,j as z}from"./vendor-utils-CV7RLr7b.js";import{d as ie}from"./DeleteOutline-1Utxk_IX.js";import{C as Ne}from"./click-to-copy-D-rDpTU1.js";import{S as Oe}from"./shorten-label-CKNjZbhF.js";import{C as se}from"./confirm-DhCXP8vW.js";import{u as Me}from"./session-UImnJahL.js";import{g as I}from"./get-safe-url-ByH0hntp.js";import{W as qe}from"./did-address-B-umhomj.js";import{u as Pe}from"./vendor-hooks-DzETutIU.js";const{NODE_MODES:Q}=ne,Be=({mode:o,previousMode:s}={})=>o===Q.SERVERLESS||s===Q.SERVERLESS;var Ue={isInServerlessMode:Be};const We=te(o=>({addMenuItemRoot:{marginTop:"8px",justifyContent:"center",color:o.palette.primary.main,lineHeight:"3.2"}}));function ae({disabled:o,storeList:s,teamDid:a,onAdd:n,scope:m,hiddenChildren:v,open:f,onClose:l}){const{api:h}=A(),[r,d]=x.useState(!1),[u,j]=x.useState(!0),[C,p]=x.useState(!1),[y,S]=x.useState(""),[w,g]=x.useState(""),{t:i}=N(),b=We(),q=async()=>{d(!0);try{const{decoded:c}=Ie(y,s);await h.addBlockletStore({input:{teamDid:a,url:c,scope:m}}),n(c),p(!1),l()}catch(c){const L=`${i("store.blockletRegistry.addFailed")} ${M(c)}`;g(L)}finally{d(!1)}},D=()=>{p(!1),l()};return e.jsxs(e.Fragment,{children:[!v&&e.jsxs(ye,{button:!0,disabled:o,className:b.addMenuItemRoot,onClick:()=>{p(!0)},children:[e.jsx(Ee,{font:!0}),e.jsx(k,{variant:"inherit",children:i("store.blockletRegistry.addRegistry")})]}),e.jsxs(Te,{title:i("store.blockletRegistry.addRegistry"),fullWidth:!0,maxWidth:"md",open:f||C,onClose:D,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(Y,{onClick:c=>{c.stopPropagation(),D()},color:"inherit",children:i("common.cancel")}),e.jsxs(Y,{onClick:c=>{c.stopPropagation(),q()},color:"primary","data-cy":"install-blocklet-next-step",disabled:r||!y||u,variant:"contained",autoFocus:!0,children:[r&&e.jsx(O,{size:16}),i("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(be,{component:"div",children:e.jsx(k,{component:"div",children:e.jsx(Z,{label:i("store.blockletRegistry.registryUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-store-url",fullWidth:!0,value:y,onChange:c=>{g(null);let L=!1;c.target.value.trim()||(L=!0),c.target.value.trim()||g(i("store.blockletRegistry.registryUrlEmpty")),S(c.target.value),j(L)},disabled:r,onKeyPress:c=>{c.key==="Enter"&&(c.preventDefault(),c.target.value.trim()?q():g(i("store.blockletRegistry.registryUrlEmpty")))}})})})}),!!w&&e.jsx(ee,{severity:"error",style:{width:"100%"},children:w})]})]})}ae.propTypes={teamDid:t.string.isRequired,disabled:t.bool,storeList:t.array,onAdd:t.func,scope:t.string,hiddenChildren:t.bool,open:t.bool,onClose:t.func};ae.defaultProps={disabled:!1,storeList:[],onAdd:()=>{},scope:"",hiddenChildren:!1,open:!1,onClose:()=>{}};var F={},Ae=U;Object.defineProperty(F,"__esModule",{value:!0});var le=F.default=void 0,Fe=Ae(W()),He=e;le=F.default=(0,Fe.default)((0,He.jsx)("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5m-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4zm-3-4h8v2H8z"}),"LinkOutlined");var H={},Ve=U;Object.defineProperty(H,"__esModule",{value:!0});var ce=H.default=void 0,Ke=Ve(W()),Je=e;ce=H.default=(0,Ke.default)((0,Je.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.96M19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3M8 13h2.55v3h2.9v-3H16l-4-4z"}),"BackupOutlined");function V({title:o,description:s,confirmPlaceholder:a,cancel:n,confirm:m,params:v,onCancel:f,onConfirm:l,keyName:h}){const{t:r}=N(),d={title:()=>e.jsxs("div",{children:[o,e.jsx(Oe,{sx:{fontSize:"14px"},maxLength:64,children:` (${h})`})]}),description:(u,j)=>{const C=p=>{j({...p,__disableConfirm:p.__disableConfirm})};return e.jsxs("div",{children:[e.jsx(ee,{severity:"warning",style:{width:"100%"},children:r("common.notice")}),e.jsx("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:s}}),e.jsxs("div",{style:{marginBottom:24},children:[r("common.click"),":",e.jsx(Ne,{"data-cy":"click-copy",children:h})]}),e.jsx(k,{component:"div",children:e.jsx(Z,{label:a,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:u.inputVal,onChange:p=>{C({...u,inputVal:p.target.value,__disableConfirm:h!==p.target.value})}})})]})},confirm:m,cancel:n,onConfirm:l,onCancel:f,params:{inputVal:"",__disableConfirm:!0,...v}};return e.jsx(se,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})}V.propTypes={title:t.any.isRequired,keyName:t.any.isRequired,description:t.any.isRequired,confirmPlaceholder:t.any.isRequired,cancel:t.string,confirm:t.string,params:t.object,onCancel:t.func,onConfirm:t.func.isRequired};V.defaultProps={onCancel:()=>{},cancel:"",confirm:"Confirm",params:{}};function B({store:o,teamDid:s,onDelete:a,children:n,projectId:m="",scope:v=""}){const{api:f}=A(),{t:l}=N(),h=Le(),[r,d]=x.useState(!1),[u,j]=x.useState(null),C=we(),p=()=>{d(!1),j(null)},y=async()=>{var g;try{d(!0),await f.deleteBlockletStore({input:{teamDid:s,url:o.url,projectId:m,scope:v}}),await((g=h==null?void 0:h.actions)==null?void 0:g.refreshBlocklet()),a&&typeof a=="function"&&a()}catch(i){T.error(`Remove Blocklet Store Error: ${M(i)}`)}finally{d(!1),j(null)}},S={keyName:o.url,title:l("store.blockletRegistry.deleteRegistry"),description:l("store.blockletRegistry.deleteDesc",{name:`<b>${o.url}</b>`,color:C.palette.error.main}),confirmPlaceholder:l("store.blockletRegistry.confirmDesc",{name:o.url}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:y,onCancel:p},w=g=>{o.protected||(g.stopPropagation(),j(S))};return e.jsxs(e.Fragment,{children:[n?e.jsx("span",{onClick:w,children:n}):e.jsx(_,{"data-cy":"store-action-delete",color:"primary",disabled:r,onClick:w,size:"small",children:e.jsx(ie,{sx:{zoom:.95}})}),u&&e.jsx(V,{keyName:u.keyName,title:u.title,description:u.description,confirmPlaceholder:u.confirmPlaceholder,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}B.propTypes={children:t.node,teamDid:t.string.isRequired,store:t.object.isRequired,onDelete:t.func,projectId:t.string,scope:t.string};B.defaultProps={children:null,projectId:"",scope:"",onDelete:()=>{}};var K={},Ge=U;Object.defineProperty(K,"__esModule",{value:!0});var de=K.default=void 0,Xe=Ge(W()),Ye=e;de=K.default=(0,Xe.default)((0,Ye.jsx)("path",{d:"M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5m-1 4h-2.19l2 2H16zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3z"}),"LinkOff");const Qe=({store:o,userDid:s})=>{var n;const a=((n=window.blocklet)==null?void 0:n.tenantMode)!==$e.BLOCKLET_TENANT_MODES.MULTIPLE;return o.protected?!1:o.scope&&o.scope===s?!0:a?o.scope==="studio":!1};function J({connectedStore:o,onDisconnect:s,onDelete:a,store:n,teamDid:m,projectId:v}){var g;const[f,l]=x.useState(null),h=!!f,{t:r}=N(),{session:d}=Me(),[u,j]=x.useState(!1),C=i=>{if(i.stopPropagation(),o!=null&&o.developerDid){const b=re.from(JSON.stringify({forceConnected:o==null?void 0:o.developerDid}),"utf8").toString("base64");window.open(I(`${z(n.url,"developer/blocklets")}?__did-connect__=${b}`,{allowDomains:null}))}else window.open(I(`${z(n.url,"developer/blocklets")}`,{allowDomains:null}))},p=i=>{l(i.currentTarget)},y=()=>{l(null)},S=()=>{j(!1),s()},w=[{label:r("common.visitStore"),action:C,icon:oe},{label:r("common.disconnect"),action:()=>{y(),j(!0)},icon:de,hidden:!o}];return e.jsxs(e.Fragment,{children:[e.jsx(_,{ref:f,color:"primary",onClick:p,size:"small",children:e.jsx(_e,{sx:{zoom:.95}})}),e.jsxs(Ce,{anchorEl:f,open:h,onClose:y,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[w.map(i=>i.hidden?null:e.jsxs(G,{dense:!0,onClick:i.action,disabled:i.disabled,children:[i.icon&&e.jsx(i.icon,{color:"action",sx:{marginRight:1}}),e.jsx(E,{color:"action",children:i.label})]},i.label)),Qe({store:n,userDid:(g=d==null?void 0:d.user)==null?void 0:g.did})&&e.jsx(B,{store:n,onDelete:a,teamDid:m,projectId:v,scope:n.scope||"studio",children:e.jsxs(G,{dense:!0,disabled:n.protected,children:[e.jsx(ie,{sx:{color:n.protected?"action":"error.main",marginRight:1}}),e.jsx(E,{color:n.protected?"action":"error.main",children:r("common.delete")})]})})]}),u&&e.jsx(se,{displayError:!0,title:`${r("common.disconnect")} ${n.name}`,description:r("blocklet.publish.disconnectStoreTip"),confirm:r("common.confirm"),onConfirm:S,onCancel:()=>j(!1)})]})}J.propTypes={connectedStore:t.object.isRequired,onDisconnect:t.func,onDelete:t.func,store:t.object.isRequired,teamDid:t.string.isRequired,projectId:t.string};J.defaultProps={projectId:"",onDelete:()=>{},onDisconnect:()=>{}};function Ze({messageType:o,onOpen:s,onClose:a}){const n=x.useRef(null),m=x.useRef(null),v=async l=>{setTimeout(()=>{try{a==null||a()}catch{}},10*1e3),n.current&&(clearInterval(m.current),n.current.close());const h=Math.random().toString(36).slice(2);n.current=window.open(`${ne.WELLKNOWN_SERVICE_PATH_PREFIX}/open-window?key=${h}`,"_blank"),s==null||s(n.current),m.current=setInterval(()=>{(!n.current||n.current.closed)&&(n.current=null,clearInterval(m.current),setTimeout(()=>{a==null||a()},1100))},200),await Promise.resolve(l(n.current,r=>{if(!n.current){localStorage.setItem(`open-window-url-${h}`,JSON.stringify({url:r,time:Date.now()}));return}n.current.location.href=I(r,{allowDomains:null})}))},f=Pe(l=>{const{type:h,error:r}=l.data;n.current&&h===o&&r&&(T.error(r),a==null||a())});return x.useEffect(()=>(window.addEventListener("message",f),()=>{window.removeEventListener("message",f)}),[f]),v}function P({connectedStore:o,sx:s,...a}){return e.jsx(Se,{sx:{width:24,height:24,...s},src:z(o.storeUrl,`/.well-known/service/user/avatar/${o.developerDid}?imageFilter=resize&w=120&h=120`),...a})}P.propTypes={connectedStore:t.object.isRequired,sx:t.object};P.defaultProps={sx:{}};function ue({storeUrl:o,storeName:s,developerDid:a,published:n}){const{t:m}=N(),v=()=>{if(a){const f=re.from(JSON.stringify({forceConnected:a}),"utf8").toString("base64");window.open(I(`${z(o,"developer/blocklets")}?__did-connect__=${f}`,{allowDomains:null}))}else window.open(I(`${z(o,"developer/blocklets")}`,{allowDomains:null}))};return e.jsxs(E,{children:[e.jsx(k,{variant:"subtitle2",children:m(n?"blocklet.publish.publishToStoreSuccess":"blocklet.publish.uploadToStoreSuccess",{name:s})}),e.jsx(_,{size:"small",sx:{mt:1},onClick:v,variant:"contained",color:"success",children:m("common.visitTarget",{name:s})})]})}ue.propTypes={storeName:t.string.isRequired,storeUrl:t.string.isRequired,developerDid:t.string.isRequired,published:t.bool.isRequired};const pe={CONNECT:"connect",SELECT:"select"},et=te(()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},box:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",overflow:"hidden",width:"100%"},menuName:{flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden",flex:1},actions:{flex:1,display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},title:{fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},url:{fontSize:14,opacity:.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},buttonLine:{height:"100%",width:"1px",backgroundColor:"#e0e0e0"}})),tt=Re(({className:o,...s})=>e.jsx(De,{...s,classes:{popper:o}}))(({theme:o})=>({[`& .${ke.tooltip}`]:{backgroundColor:"#fff",color:"rgba(0, 0, 0, 0.87)",borderRadius:8,padding:o.spacing(2),fontSize:o.typography.pxToRem(12),border:"1px solid rgba(0,0,0,0.08)",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.05)"}}));function me({teamDid:o,projectId:s,releaseId:a,store:n,onDelete:m,kind:v,published:f,connectedStore:l,releaseType:h,onPublish:r,onOpenConnectStore:d,onSelectConnectStore:u,behavior:j,scope:C=""}){const p=et(),{t:y}=N(),{api:S,info:w,inService:g}=A(),[i,b]=x.useState(!1),q=Ze({messageType:"connect-store-message",onOpen:()=>b(!0),onClose:()=>b(!1)}),D=v==="publish",c=!!l,L=R=>{if(R.stopPropagation(),D){window.open(I(z(n.url,"developer/blocklets"),{allowDomains:null}));return}window.open(I(n.url,{allowDomains:null}))},fe=()=>{if(j===pe.SELECT){u(n);return}q(async(R,ve)=>{try{const $=await S.connectToStore({input:{did:o,storeUrl:n.url,storeId:n.id,storeName:n.name,projectId:s}});if(!($!=null&&$.url)){T.error("failed to connect to store");return}ve($.url),await d({did:o,projectId:s,storeId:n.id}),b(!1)}catch($){const je=M($);T.error(je),b(!1)}})},he=async()=>{try{await S.disconnectFromStore({input:{did:o,storeId:n.id,projectId:s,storeScope:C}}),m()}catch(R){T.error(M(R))}},ge=()=>{b(!0),S.publishToStore({input:{did:o,storeId:n.id,storeName:n.name,projectId:s,releaseId:a,type:h}}).then(R=>{T.success(e.jsx(ue,{storeName:l.storeName,storeUrl:l.storeUrl,developerDid:l.developerDid,published:R.url==="published"}),{duration:1e4}),r==null||r(null)}).catch(R=>{T.error(M(R)),r==null||r(R)}).finally(()=>{b(!1)})};x.useEffect(()=>{c&&b(!1)},[c]);const xe=x.useMemo(()=>!(g&&Ue.isInServerlessMode(w)),[g,w]);return e.jsxs("div",{className:p.box,children:[!D&&i&&e.jsx(O,{sx:{marginRight:2},size:16}),e.jsxs("div",{className:p.menuName,children:[e.jsx(E,{sx:{display:"flex",flexDirection:"row"},children:e.jsx(k,{component:"span",className:p.title,variant:"subtitle1",children:n.name})}),e.jsx(k,{className:p.url,component:"span",variant:"inherit",children:`${n.url}`})]}),e.jsxs("div",{className:p.actions,children:[l&&e.jsx(tt,{placement:"top",title:e.jsxs(E,{children:[e.jsx(k,{component:"span",variant:"caption",sx:{opacity:.7},children:y("blocklet.publish.developerInfo")}),e.jsxs(E,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(P,{connectedStore:l,sx:{width:42,height:42}}),e.jsxs(E,{sx:{flex:1},children:[e.jsx(k,{component:"span",variant:"subtitle1",children:l.developerName}),e.jsx(qe,{size:14,copyable:!0,compact:!0,responsive:!1,did:l.developerDid})]})]})]}),children:e.jsx("div",{children:e.jsx(P,{connectedStore:l,sx:{marginRight:1,cursor:"help"}})})}),D&&e.jsxs(X,{disabled:i,variant:"outlined",sx:{height:38},size:"small",children:[!c&&e.jsxs(_,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:fe,children:[i?e.jsx(O,{sx:{marginRight:1},size:16}):e.jsx(le,{sx:{marginRight:1}}),y("common.connect")]}),c&&f&&e.jsxs(_,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[i?e.jsx(O,{sx:{marginRight:1},size:16}):e.jsx(ze,{sx:{marginRight:1}}),y("common.uploaded")]}),c&&!f&&e.jsxs(_,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:ge,children:[i?e.jsx(O,{sx:{marginRight:1},size:16}):e.jsx(ce,{sx:{marginRight:1,fontSize:20}}),y("common.upload")]}),e.jsx(J,{projectId:s,connectedStore:l,store:n,onDelete:m,teamDid:o,onDisconnect:he})]}),!D&&e.jsxs(X,{disabled:i,variant:"outlined",sx:{height:36},size:"small",children:[e.jsx(_,{"data-cy":"store-open-url",onClick:L,children:e.jsx(oe,{sx:{zoom:.9}})}),!n.protected&&xe&&e.jsx(B,{store:n,onDelete:m,teamDid:o,scope:""})]})]})]})}me.propTypes={kind:t.string,teamDid:t.string.isRequired,published:t.bool,connectedStore:t.shape({storeName:t.string,storeId:t.string,storeUrl:t.string,developerDid:t.string,developerName:t.string}),projectId:t.string,releaseId:t.string,releaseType:t.string,store:t.shape({id:t.string.isRequired,name:t.string.isRequired,url:t.string.isRequired,protected:t.bool,connected:t.bool}).isRequired,scope:t.string,onDelete:t.func,onPublish:t.func,onOpenConnectStore:t.func,behavior:t.string,onSelectConnectStore:t.func};me.defaultProps={kind:"store",published:!1,connectedStore:null,releaseId:"",projectId:"",releaseType:"",scope:"",behavior:pe.CONNECT,onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{}};export{ae as A,V as C,me as S,ue as U,Qe as c,Ue as s,Ze as u};
|