@abtnode/blocklet-services 1.16.39-beta-20250218-132815-6baaf20e → 1.16.39-beta-20250220-073620-4f1d9e2b
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/libs/push-kit/index.js +2 -2
- package/api/services/notification/notification-queue.js +77 -165
- package/api/socket/channel/did.js +44 -32
- package/dist/assets/{Add-meGhscd6.js → Add-DFSveMnk.js} +1 -1
- package/dist/assets/{ArrowDropDown-B7S4xnEe.js → ArrowDropDown-7bhybSNS.js} +1 -1
- package/dist/assets/{CheckCircle-CnvZ4oB1.js → CheckCircle-v1VkHRMG.js} +1 -1
- package/dist/assets/{ChevronLeft-D1qkw0FM.js → ChevronLeft-DRxUR95x.js} +1 -1
- package/dist/assets/{ChevronRight-CEkTH0up.js → ChevronRight-i646QaQM.js} +1 -1
- package/dist/assets/{DeleteOutline-BjrgG_HY.js → DeleteOutline-Bz_v29yL.js} +1 -1
- package/dist/assets/{Done-7hvoRcVZ.js → Done-DgXsjFiE.js} +1 -1
- package/dist/assets/{Download-CMvqPsK9.js → Download-B4jg-r_R.js} +1 -1
- package/dist/assets/{EditIcon-BOr0kf6I.js → EditIcon-Mm3W5DE6.js} +1 -1
- package/dist/assets/{Error-D3I1nNnO.js → Error-BmZqW6ED.js} +1 -1
- package/dist/assets/{Google-TNOfJ3uU.js → Google-DommwMxL.js} +1 -1
- package/dist/assets/{InfoOutlined-CwoytfGr.js → InfoOutlined-O-yom1i3.js} +1 -1
- package/dist/assets/{Launch-wyBVNKfb.js → Launch-DdeGpTqR.js} +1 -1
- package/dist/assets/{LaunchOutlined-B2ZU9fkg.js → LaunchOutlined-CqCuGAlJ.js} +1 -1
- package/dist/assets/{LockIcon-D-W4Rph6.js → LockIcon-BbWIWjve.js} +1 -1
- package/dist/assets/{Loop-CQAI5rIS.js → Loop-BLtclgGI.js} +1 -1
- package/dist/assets/{MoreHoriz-CyCcv2bV.js → MoreHoriz-ZQMFN5Xr.js} +1 -1
- package/dist/assets/{PlayArrow-B5ZFUKPq.js → PlayArrow-BwPeitOG.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-BvUTckGB.js → QuestionMarkCircle-D5Im4T0u.js} +1 -1
- package/dist/assets/{ServerLogo-BDEZRDcg.js → ServerLogo-DWgX8KHy.js} +1 -1
- package/dist/assets/{ViewList-C8AcRueZ.js → ViewList-DXzyy-yJ.js} +1 -1
- package/dist/assets/access-control-DyE6zHOK.js +13 -0
- package/dist/assets/{actions-C0a0eUYM.js → actions-CnBTZ7ol.js} +1 -1
- package/dist/assets/{add-component-core-CK3SAdlQ.js → add-component-core-D7dzV3Qd.js} +35 -35
- package/dist/assets/add-resource-D05K6Dv6.js +1 -0
- package/dist/assets/{addon-C7fx4MJ0.js → addon-CgdcWRru.js} +1 -1
- package/dist/assets/{analytics-CjaAB5m2.js → analytics-C8YyBJKc.js} +1 -1
- package/dist/assets/ar-CEnzg81O.js +3 -0
- package/dist/assets/{ar-DoIWDL3Q.js → ar-cJwIGRaP.js} +1 -1
- package/dist/assets/{audit-logs-bl5st5Lr.js → audit-logs-P3wQXAao.js} +1 -1
- package/dist/assets/{base32-9oQoOkFy.js → base32-CJh0eRRM.js} +1 -1
- package/dist/assets/branding-Ncf_YrEF.js +40 -0
- package/dist/assets/{bundle-avatar-Dnk7mw7b.js → bundle-avatar-CWErnWDS.js} +1 -1
- package/dist/assets/button-D8dCYKMu.js +1 -0
- package/dist/assets/{click-to-copy-C9X-UQyL.js → click-to-copy-U6qR4HAG.js} +1 -1
- package/dist/assets/{complete-C3yyjx_N.js → complete-CWreL5lV.js} +1 -1
- package/dist/assets/{component-B0WI6_H4.js → component-CVXkLilJ.js} +96 -88
- package/dist/assets/{config-DINcJX6A.js → config-BursEDKY.js} +1 -1
- package/dist/assets/{config-C0wq7rMr.js → config-CEnHCyaW.js} +1 -1
- package/dist/assets/{config-navigation-Dskr7Yic.js → config-navigation-7bbsR1c5.js} +3 -3
- package/dist/assets/{config-space-BYYAVRcS.js → config-space-DWTUkGA7.js} +1 -1
- package/dist/assets/{confirm-BmLsHbj9.js → confirm-R-3mjfrE.js} +1 -1
- package/dist/assets/{connect-hhGPDSK8.js → connect-D99JO5F1.js} +1 -1
- package/dist/assets/{connect-06lWrPrR.js → connect-DeAQgH0y.js} +1 -1
- package/dist/assets/{connect-to-DIJ57-hM.js → connect-to-B_177EMY.js} +1 -1
- package/dist/assets/{content-layout-cWwRTmIc.js → content-layout-CE2kjm54.js} +1 -1
- package/dist/assets/{dashboard-PlqPcVrd.js → dashboard-DvxSnwfd.js} +10 -10
- package/dist/assets/{de-BVgb1fEg.js → de-CwhZYhES.js} +1 -1
- package/dist/assets/de-nDH0KZYC.js +3 -0
- package/dist/assets/delete-confirm-CO-OBmsy.js +1 -0
- package/dist/assets/{did-address-Bl2N44vc.js → did-address-Cg3bCLTF.js} +1 -1
- package/dist/assets/domain-DjAqr47g.js +9 -0
- package/dist/assets/domain-action-card-CtYAFJMQ.js +15 -0
- package/dist/assets/domains-BAkyeUtK.js +1 -0
- package/dist/assets/{email-9CbD02fM.js → email-DubyyWP-.js} +1 -1
- package/dist/assets/{es-CWcVPAna.js → es-Cw5ZN2jL.js} +1 -1
- package/dist/assets/es-NUrGcplI.js +3 -0
- package/dist/assets/{exchange-passport-ZTeqENxf.js → exchange-passport-C0_ELMge.js} +1 -1
- package/dist/assets/{form-text-input-DEadnM80.js → form-text-input-DXbUuC1I.js} +1 -1
- package/dist/assets/fr-8uzI0ztX.js +3 -0
- package/dist/assets/{fr-C8Jr_C8u.js → fr-au5rpiTp.js} +1 -1
- package/dist/assets/{fuel-AxStjHWS.js → fuel-DJOYYGMp.js} +1 -1
- package/dist/assets/{fullpage-BXvfrD1C.js → fullpage-D4VuPAFa.js} +1 -1
- package/dist/assets/{get-safe-url-BVjMxmwp.js → get-safe-url-D9gDTOPT.js} +1 -1
- package/dist/assets/{get-safe-url-BxZD1oA_.js → get-safe-url-DQLIWkQo.js} +1 -1
- package/dist/assets/{hi-DTqZQNNB.js → hi-DBPvM90p.js} +1 -1
- package/dist/assets/hi-DsL0Qpdc.js +1 -0
- package/dist/assets/{home-CrkVy1DG.js → home-dxFc3wRZ.js} +1 -1
- package/dist/assets/id-BbsIe6fu.js +3 -0
- package/dist/assets/{id-CUsGyKYW.js → id-CmJlzYVA.js} +1 -1
- package/dist/assets/{iframe-BcWepstA.js → iframe-6gS_ODJa.js} +1 -1
- package/dist/assets/{index-uYcwdGZL.js → index-B7_xeF0z.js} +21 -21
- package/dist/assets/index-BdfFmrlk.js +52 -0
- package/dist/assets/{index-CDvqNewi.js → index-BkvRoX7I.js} +1 -1
- package/dist/assets/{index-Be9vrMiA.js → index-C3vLeBLv.js} +1 -1
- package/dist/assets/{index-CHFvfli7.js → index-CF4Aobpk.js} +1 -1
- package/dist/assets/{index-BXlJ03I_.js → index-CPQbFQvu.js} +1 -1
- package/dist/assets/{index-DIQ33Q8Z.js → index-CbY5jzJ1.js} +1 -1
- package/dist/assets/index-ClijH1KU.js +228 -0
- package/dist/assets/index-Cx-u2b1r.js +192 -0
- package/dist/assets/{index-DtwN19zv.js → index-DIP3om2u.js} +1 -1
- package/dist/assets/{index-C-D-nCB1.js → index-DQ3_atB3.js} +1 -1
- package/dist/assets/{index-ChSPqVLh.js → index-DcvnbXW2.js} +1 -1
- package/dist/assets/{index-BSC2apzE.js → index-PMG7ikk5.js} +1 -1
- package/dist/assets/index-T6-QS5Qh.js +109 -0
- package/dist/assets/{index-DfBNyFsV.js → index-XGnyowjM.js} +1 -1
- package/dist/assets/{index-DkVoxpR-.js → index-g5Holpv4.js} +7 -7
- package/dist/assets/{index-BBOSdbE7.js → index-jjJ9S0nm.js} +1 -1
- package/dist/assets/{index-DgaUl_lv.js → index-jkazPG2A.js} +1 -1
- package/dist/assets/{index-BtFCAsqh.js → index-oxDvnRnk.js} +1 -1
- package/dist/assets/{invitation-BzHMoDRH.js → invitation-CRTc-7F5.js} +6 -6
- package/dist/assets/{invite-BBcuJaUv.js → invite-BpFDZ5-a.js} +1 -1
- package/dist/assets/{issue-passport-sgBfFZ4Y.js → issue-passport-fnOu8MGg.js} +1 -1
- package/dist/assets/item-C5q00bCP.js +2 -0
- package/dist/assets/{ja-B0U7M2t1.js → ja-DqY-EkRB.js} +1 -1
- package/dist/assets/ja-bjSIThln.js +3 -0
- package/dist/assets/ko-BjX8mQKL.js +3 -0
- package/dist/assets/{ko-CpDA9JjF.js → ko-CZIpaPXf.js} +1 -1
- package/dist/assets/{launch-result-message-keU5grqY.js → launch-result-message-B237vj_f.js} +1 -1
- package/dist/assets/{layout-CGas_HfS.js → layout-DztchTRR.js} +1 -1
- package/dist/assets/{list-cZ-OXxN0.js → list-CM99uwf8.js} +1 -1
- package/dist/assets/{list-header-Dd4BEf4y.js → list-header-Bvl4MqSl.js} +1 -1
- package/dist/assets/localization-Ddv2MmrZ.js +1 -0
- package/dist/assets/{log-BFj6TDz5.js → log-BJ_7gOwg.js} +1 -1
- package/dist/assets/{login-B-6s411x.js → login-Bkg5cKeY.js} +1 -1
- package/dist/assets/login-oauth-callback-5wm53L-h.js +1 -0
- package/dist/assets/{logo-uploader-pyVqJwKp.js → logo-uploader-BDepocdq.js} +3 -3
- package/dist/assets/{lost-passport-DKkxzCH8.js → lost-passport-DPzX8lrb.js} +1 -1
- package/dist/assets/{open-window-Cvetj9Mn.js → open-window-DhCTV7Bc.js} +1 -1
- package/dist/assets/overview-VqjuJhSH.js +12 -0
- package/dist/assets/{page-header--y63DY5K.js → page-header-BltW3zCL.js} +1 -1
- package/dist/assets/{permission-Be_APIVZ.js → permission-BlstaDqI.js} +1 -1
- package/dist/assets/{preferences-D-NDmLhf.js → preferences-DXoyvj-J.js} +1 -1
- package/dist/assets/{pt-7r06GaNd.js → pt-D8E5L8AA.js} +1 -1
- package/dist/assets/pt-FXpLOB0Y.js +1 -0
- package/dist/assets/publish-resource-4NNLT144.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-Czr1mmuu.js → react-beautiful-dnd.esm-C4CQz9M9.js} +1 -1
- package/dist/assets/{relative-time-D0P0AJUI.js → relative-time-D6fIGce1.js} +1 -1
- package/dist/assets/ru-BnGih0Ix.js +1 -0
- package/dist/assets/{ru-MS-ksi2g.js → ru-D3jVM1bn.js} +1 -1
- package/dist/assets/sdk-9YRmE3Kk.js +1 -0
- package/dist/assets/{session-CV6ez46v.js → session-BwIJ2AMz.js} +1 -1
- package/dist/assets/setup-XOZiTiWW.js +19 -0
- package/dist/assets/{shorten-label-J69eHfMN.js → shorten-label-la5sIm_0.js} +1 -1
- package/dist/assets/{simple-select-D06JmA0a.js → simple-select-Cu-p9eCv.js} +1 -1
- package/dist/assets/{slicedToArray-CXBLQZX4.js → slicedToArray-DBh5Z78L.js} +2 -2
- package/dist/assets/{start-BjFFihjS.js → start-DqBWR6sD.js} +1 -1
- package/dist/assets/{step-actions-qXq3r5tX.js → step-actions-B0Ln8Y3M.js} +1 -1
- package/dist/assets/{studio-BNGylnt7.js → studio-D2tmKoYZ.js} +1 -1
- package/dist/assets/{switch-control-DmKC0hpm.js → switch-control-DUPDUbJY.js} +1 -1
- package/dist/assets/th-C1ZTykFq.js +1 -0
- package/dist/assets/{th-gcuRSNHo.js → th-PmtZzBF0.js} +1 -1
- package/dist/assets/{traffic-Djmt2Ph8.js → traffic-CtRInz6z.js} +1 -1
- package/dist/assets/{transfer-B9ohZjja.js → transfer-CFQNTYY4.js} +1 -1
- package/dist/assets/{unsubscribe-6xRksnNz.js → unsubscribe-CucwJ1I1.js} +1 -1
- package/dist/assets/{use-mobile-DnWfrhc7.js → use-mobile-B7gJcr5J.js} +1 -1
- package/dist/assets/{useAsync-Ua5iss51.js → useAsync-CEZQNMFX.js} +1 -1
- package/dist/assets/{useAsyncRetry-Bmo6a1Zp.js → useAsyncRetry-BEB-tWmQ.js} +2 -2
- package/dist/assets/{useLocalStorage-B5t6MEw6.js → useLocalStorage-DyOKhTaE.js} +1 -1
- package/dist/assets/{user-center-DEGm9vzv.js → user-center-ByJfst4h.js} +1 -1
- package/dist/assets/{util-Bl4vyFsm.js → util-BpyQ3K0Z.js} +1 -1
- package/dist/assets/util-lWapOC8r.js +1 -0
- package/dist/assets/{vendor-arcblock-BFUPp1Ez.js → vendor-arcblock-EnQG-qe7.js} +14 -14
- package/dist/assets/{vendor-hooks-BKxTDk_P.js → vendor-hooks-ZnvK17j8.js} +2 -2
- package/dist/assets/vendor-mui-core-DrGFkjqr.js +266 -0
- package/dist/assets/{vendor-mui-x-CSUdon8K.js → vendor-mui-x-vjsTA-wt.js} +1 -1
- package/dist/assets/vi-I3mwa-6h.js +1 -0
- package/dist/assets/{vi-CGYOhf_R.js → vi-mGKYGc30.js} +1 -1
- package/dist/assets/wrap-locale-DUxawgkX.js +1 -0
- package/dist/assets/zh-DB42-Qer.js +4 -0
- package/dist/assets/zh-tw-9ERTu6uD.js +3 -0
- package/dist/assets/{zh-tw-BR5CO3an.js → zh-tw-Bq7yIqtg.js} +1 -1
- package/dist/assets/{zh-BYS_9r4v.js → zh-wUbdzdUJ.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/package.json +31 -31
- package/dist/assets/access-control-ClVHa3J1.js +0 -13
- package/dist/assets/add-resource-hs_iM1xk.js +0 -1
- package/dist/assets/ar-BFUPmTkR.js +0 -3
- package/dist/assets/branding-5S3zjZlC.js +0 -40
- package/dist/assets/button-BTVoaDd7.js +0 -1
- package/dist/assets/de-hV0yD3gq.js +0 -3
- package/dist/assets/domain-DDa_Ldun.js +0 -9
- package/dist/assets/domain-list-DXbfS21Z.js +0 -15
- package/dist/assets/es-BcSAobJW.js +0 -3
- package/dist/assets/fr-8qti32p1.js +0 -3
- package/dist/assets/hi-DDEUhQcX.js +0 -1
- package/dist/assets/id-DkUYINLx.js +0 -3
- package/dist/assets/index-BJA4YPaC.js +0 -243
- package/dist/assets/index-CoxJ8G1A.js +0 -77
- package/dist/assets/index-DcfIKM1A.js +0 -9
- package/dist/assets/index-DkufOgYs.js +0 -125
- package/dist/assets/index-MxM82EtU.js +0 -228
- package/dist/assets/item-C5sAxGxS.js +0 -2
- package/dist/assets/ja-C2LP4WQG.js +0 -3
- package/dist/assets/ko-C-DMeONa.js +0 -3
- package/dist/assets/localization-Z_CTe1Z8.js +0 -1
- package/dist/assets/login-oauth-callback-aKbzfltj.js +0 -1
- package/dist/assets/overview-BxbJCUbS.js +0 -12
- package/dist/assets/pt-CbxvF__Z.js +0 -1
- package/dist/assets/publish-resource-CxkiI4_n.js +0 -1
- package/dist/assets/ru-DLHrAeE7.js +0 -1
- package/dist/assets/sdk-NKQJT0FS.js +0 -1
- package/dist/assets/setup-CF2VhAxD.js +0 -19
- package/dist/assets/th-Dil9kwjH.js +0 -1
- package/dist/assets/util-PzCAH0nE.js +0 -1
- package/dist/assets/vendor-mui-core-xF5F4eT7.js +0 -266
- package/dist/assets/vi-B46hyfUM.js +0 -1
- package/dist/assets/wrap-locale-6MxBCfA2.js +0 -1
- package/dist/assets/zh-DWWuPzr1.js +0 -4
- package/dist/assets/zh-tw-Ci21sS2Y.js +0 -3
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BdfFmrlk.js","assets/vendor-arcblock-EnQG-qe7.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-5TjOM6td.js","assets/vendor-mui-core-DrGFkjqr.js","assets/vendor-hooks-ZnvK17j8.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-C2fPoxDR.js","assets/index-B7_xeF0z.js","assets/index-DoZ2YM4T.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as C,k as Rt,l as st,L as le,f as Jn,h as Qn,i as at}from"./vendor-react-D-afvo_7.js";import{a1 as he,j as t,t as Oe,a3 as u,aM as Vo,E as d,a4 as de,I as oe,T as E,bU as Wo,aa as ae,aE as Yn,bL as Ge,ad as Uo,aN as Xe,bq as bt,x as Z,a2 as Ye,P as Fo,G as Ho,v as St,$ as Go,ar as Xo,al as ue,ah as Zn,D as It,ab as Jo,r as Qo,bK as Kn,K as Be,y as Yo,M as Y,ac as ke,aL as es,L as ts,z as os,bn as ns,aA as Zo,az as Ze,bt as ss,bu as rs,bV as is,bW as ls,aP as Ko,bH as cs,bN as as,bx as ds,by as dt}from"./vendor-mui-core-DrGFkjqr.js";import{z as me,C as _e,h as re,a6 as us,f as fo,_ as en,ae as ho}from"./index-B7_xeF0z.js";import{a0 as be,b as X,e as Q,a3 as Ke,ac as tn,aV as on,aa as nn,_ as ps,aW as Dt,j as W,n as fs,aX as hs,aY as ms,z as bs,aD as ne,aZ as xs,ap as gs,aN as Ie,a7 as Tt,a_ as ye,ai as js,an as ks}from"./vendor-arcblock-EnQG-qe7.js";import{d as _t}from"./Add-DFSveMnk.js";import{d as ys}from"./Error-BmZqW6ED.js";import{C as Pt}from"./confirm-R-3mjfrE.js";import{u as rt}from"./session-BwIJ2AMz.js";import{W as mo}from"./did-address-Cg3bCLTF.js";import{E as Ve,D as bo,C as xo,P as go}from"./react-beautiful-dnd.esm-C4CQz9M9.js";import{B as Lt}from"./bundle-avatar-CWErnWDS.js";import{S as pe}from"./shorten-label-la5sIm_0.js";import{T as vs,x as ce,G as qt,C as sn}from"./vendor-utils-5TjOM6td.js";import{d as ws}from"./Download-B4jg-r_R.js";import{d as Cs}from"./QuestionMarkCircle-D5Im4T0u.js";import{u as Rs}from"./vendor-hooks-ZnvK17j8.js";import{_ as Se}from"./useSetState-Crt4S51m.js";import{c as $t}from"./index-DoZ2YM4T.js";import{E as Nt}from"./index-CF4Aobpk.js";import{p as et}from"./index-PMG7ikk5.js";import"./api-K65cLqol.js";import{d as Ss}from"./ChevronRight-i646QaQM.js";import{T as Is,a as Ds}from"./vendor-mui-x-vjsTA-wt.js";import{d as jo}from"./DeleteOutline-Bz_v29yL.js";import{c as Ts,A as rn,u as _s,S as Ps,U as Ls,a as ut,b as ln,n as qs,e as $s,f as ko,g as Ns,h as As}from"./item-C5q00bCP.js";import{d as Es}from"./ArrowDropDown-7bhybSNS.js";import{f as De}from"./format-error-C0Ke3VXF.js";import{C as Ms}from"./click-to-copy-U6qR4HAG.js";import{d as zs}from"./Launch-DdeGpTqR.js";import{M as Os}from"./index-DcvnbXW2.js";import{r as Bs}from"./index-DIP3om2u.js";import{d as Vs}from"./Done-DgXsjFiE.js";import"./raf-schd.esm-Cxhj8umC.js";import"./delete-confirm-CO-OBmsy.js";import"./get-safe-url-DQLIWkQo.js";var At={},Ws=he;Object.defineProperty(At,"__esModule",{value:!0});var cn=At.default=void 0,Us=Ws(be()),Fs=t;cn=At.default=(0,Us.default)((0,Fs.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 Et={},Hs=he;Object.defineProperty(Et,"__esModule",{value:!0});var an=Et.default=void 0,Gs=Hs(be()),Xs=t;an=Et.default=(0,Gs.default)((0,Xs.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 Mt={},Js=he;Object.defineProperty(Mt,"__esModule",{value:!0});var dn=Mt.default=void 0,Qs=Js(be()),Ys=t;dn=Mt.default=(0,Qs.default)((0,Ys.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function zt({did:e,projectId:o,title:n,logo:r,describe:s}){const i=`${`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=C.useState(!1),f=Oe(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Vo,{sx:{borderRadius:1},src:i}),t.jsxs(u,{children:[t.jsx(pe,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(pe,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}zt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Ot({initUrl:e}){const o=Rt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:l}=me(),{api:i}=rt(),[a,c]=C.useState(!0),{blocklet:f}=_e(),[h,g]=C.useState(null),[b,p]=C.useState(!1),v=Oe(m=>m.breakpoints.down("xl")),{componentDid:w=""}=st(),[I,j]=C.useState(null),x=()=>{l.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(m=>{const y=(m==null?void 0:m.projects)||[];c(!1),j(y)}).catch(m=>{c(!1),W.error(m.message)})},R=()=>{o(`${X.UNOWNED_DID}/create/none`,{replace:!0})},_=m=>{g(m)},D=()=>{c(!1),p(!0)},k=()=>{p(!1),g(null)},T=m=>{W.error(m.message),p(!1),g(null)},M=m=>{if(!(m!=null&&m.deleted)){W.error("Delete project failed");return}x(),p(!1),g(null)},U=(m,y,P)=>{let O=m==null?void 0:m.trim();return O?(O=fs.toAddress(O).toLocaleLowerCase(),P.some((V,S)=>{const L=y[S];return L&&V.searchable&&V.display!=="excluded"&&V.display!=="false"&&L.toLocaleLowerCase().includes(O)})):!0};if(C.useEffect(()=>{x()},[]),!I&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!I)return null;if(!I.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(Ke,{onClick:R,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const q=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:m=>{const y=I[m];return t.jsx(le,{to:`${y.id}`,children:t.jsx(zt,{did:f.meta.did,projectId:y.id,logo:y.blockletLogo,title:y.blockletTitle,describe:y.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:m=>m?t.jsx(tn,{type:"success",children:m}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:m=>m?t.jsx(mo,{size:14,compact:!0,responsive:!1,did:m}):null}},v||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:m=>m?t.jsx(mo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${m}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:m}):null}},v||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:m=>{const y=(f.children||[]).find(P=>P.meta.did===m);return y?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:14,blocklet:y,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:y.meta.title})]},m):""}}},v||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:m=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(pe,{children:m})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:m=>t.jsx(on,{value:Number(m),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:m=>{const y=I[m];return t.jsxs(u,{display:"flex",children:[t.jsx(le,{to:`${y.id}/new-release/${y.lastReleaseId}`,children:t.jsx(de,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"create",children:t.jsx(cn,{style:{fontSize:18}})})})}),!!y.lastReleaseId&&t.jsx(de,{title:r("blocklet.publish.viewLastRelease",{name:y.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx(le,{style:{display:"flex"},to:`${y.id}/view/${y.lastReleaseId}`,children:t.jsx(an,{sx:{fontSize:18}})})})}),t.jsx(de,{title:r("blocklet.publish.delete",{name:y.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>_(y),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),A=b?t.jsx(ps,{open:!0,popup:!0,onClose:k,action:"check-has-project-id",locale:s,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:M,onError:T,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(de,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(dn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(Ke,{onClick:R,variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Dt,{className:"main-table",locale:s,data:I,columns:q,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:U}}),h&&t.jsx(Pt,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:D,onCancel:()=>g(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(m=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(ys,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:m})]}))})}),A]})}Ot.propTypes={initUrl:d.object};Ot.defaultProps={initUrl:null};var Bt={},Zs=he;Object.defineProperty(Bt,"__esModule",{value:!0});var un=Bt.default=void 0,Ks=Zs(be()),yo=t;un=Bt.default=(0,Ks.default)([(0,yo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,yo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function er(){var D;const{t:e,locale:o}=Q(),{projectId:n}=st(),{api:r}=me(),[s,l]=C.useState(!0),{blocklet:i}=_e(),a=Oe(k=>k.breakpoints.down("md")),[c,f]=C.useState(null),[h,g]=C.useState(null),[b,p]=C.useState(null),v=(D=window.env)==null?void 0:D.serverEndpoint,w=()=>{r.getReleases({input:{did:i.meta.did,projectId:n}}).then(k=>{const T=(k==null?void 0:k.releases)||[];l(!1),f(T)}).catch(k=>{l(!1),W.error(k.message)})},I=()=>{r.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:n}},getReleases:{input:{did:i.meta.did,projectId:n}}}).then(k=>{g(k.getProject.project||{}),f(k.getReleases.releases||[]),l(!1)}).catch(k=>{l(!1),W.error(k.message)})};C.useEffect(()=>{I()},[]);const j=()=>{l(!1);const k=b.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:k}}).then(()=>{l(!1),w(),W.success(e("common.removeSuccess")),p(null)}).catch(T=>{l(!1),W.error(T.message)})},x=k=>{p(k)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!c)return null;const R=t.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(le,{to:"..",children:e("common.blockletStudio")}),t.jsx(E,{color:"text.primary",children:t.jsx(pe,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[R,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(le,{to:"create/none",children:t.jsx(Ke,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const _=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:k=>{const T=c[k];return t.jsx(le,{to:`view/${T.id}`,children:t.jsx(zt,{did:i.meta.did,projectId:h.id,logo:T.blockletLogo,title:T.blockletVersion,describe:T.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:k=>{const T=c[k];return t.jsx(E,{className:"note",children:T.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:k=>t.jsx(tn,{type:k==="published"?"success":"warning",children:k==="published"?"Released":vs(k)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const T=c[k];return T.status!==re.PROJECT.RELEASE_STATUS.published?"":t.jsx(on,{value:Number(T.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var m;const T=c[k];let M="",U="";const q=T.status==="published";if(q){const y=ce(v,`/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),P=new URL(v);P.pathname=ce(P.pathname,"/launch-blocklet/agreement"),P.searchParams.set("blocklet_meta_url",y),M=P.href,U=ce(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const A=(m=h.blockletComponents)!=null&&m.some(y=>y.included)||T.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[q&&A==="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(un,{sx:{fontSize:18}})})})}),q&&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:U,children:t.jsx(ws,{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(T),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(tr,{children:[t.jsxs(u,{className:"header",children:[R,t.jsx(le,{to:"new-release/none",children:t.jsxs(Ke,{variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Dt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),b&&t.jsx(Pt,{title:e(`${e("common.delete")} ${b.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:j,onCancel:()=>p(null)})]})}const tr=ae(u)`
|
|
3
|
+
.header {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
}
|
|
8
|
+
.main-table {
|
|
9
|
+
margin-top: 24px;
|
|
10
|
+
}
|
|
11
|
+
.main-table > div:first-child {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
.note {
|
|
15
|
+
word-break: break-all;
|
|
16
|
+
white-space: pre-line;
|
|
17
|
+
}
|
|
18
|
+
`;var Vt={},or=he;Object.defineProperty(Vt,"__esModule",{value:!0});var pn=Vt.default=void 0,nr=or(be()),sr=t;pn=Vt.default=(0,nr.default)((0,sr.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"DoDisturbAlt");function Te({children:e,Icon:o}){return t.jsxs(Yn,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[t.jsx(u,{sx:{opacity:.3,fontSize:32},children:t.jsx(o,{})}),t.jsx(u,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:e})]})}Te.propTypes={children:d.node.isRequired,Icon:d.elementType};Te.defaultProps={Icon:pn};function Wt({value:e,app:o,onChange:n,onChangeBlockletResourceType:r,disabled:s,resourceRelateComponents:l,projectType:i,dependentComponentsMode:a,blockletResourceType:c}){const{t:f,locale:h}=Q(),g=a==="readonly",b=C.useMemo(()=>{const R=e.reduce((_,D)=>(_[D.did]=D.included,_),{});return(o.children||[]).filter(_=>g?l[_.meta.did]||R[_.meta.did]:!0)},[o.children,e,l,g]),p=C.useMemo(()=>b.map(R=>e.find(D=>D.did===R.meta.did)||{did:R.meta.did}),[b,e]),v=p.reduce((R,_)=>(R[_.did]=qt(_,["required","included"]),R),{}),w=R=>{const _=p.map(D=>{if(D.did===R){const k=!D.included;return{...D,included:k,required:k}}return D});n(_)},I=R=>{const _=p.map(D=>D.did===R?{...D,required:!D.required}:D);n(_)},j=R=>{r(R.target.checked?"resource":"")},x=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:R=>{var k;const _=b[R],D=(k=v[_.meta.did])==null?void 0:k.included;return t.jsxs(u,{display:"flex",alignItems:"center",children:[t.jsx(Lt,{size:24,blocklet:_,ancestors:[o]}),t.jsx(u,{ml:"4px",className:$t("text",{excluded:!D}),children:t.jsx(u,{children:_.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:R=>{var T;const _=b[R],D=l[_.meta.did],k=!!((T=v[_.meta.did])!=null&&T.included);return t.jsx(Ge,{size:"small",checked:D||k,onClick:()=>w(_.meta.did),disabled:g||D||s})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:R=>{var M,U;const _=b[R],D=l[_.meta.did],k=!!((M=v[_.meta.did])!=null&&M.included),T=!!((U=v[_.meta.did])!=null&&U.required);return t.jsx(Ge,{size:"small",checked:D||T&&k,onClick:()=>I(_.meta.did),disabled:g||D||s||!k})}}}];return t.jsx(rr,{children:b!=null&&b.length?t.jsxs(t.Fragment,{children:[t.jsxs(Uo,{severity:"info",style:{width:"100%"},children:[t.jsx(u,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:f(i==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),t.jsxs(u,{component:"label",style:{cursor:"pointer"},children:[t.jsx(Ge,{size:"small",style:{marginLeft:"0px"},disabled:s,checked:c==="resource",onChange:j}),f("blocklet.publish.forceResourceBlocklet")]})]}),t.jsx(Dt,{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(Te,{Icon:Nt,children:f("blocklet.publish.blockletEmptyTip")})})}Wt.propTypes={app:d.object.isRequired,value:d.arrayOf(d.shape({did:d.string.isRequired,required:d.bool,included:d.bool})),onChange:d.func,onChangeBlockletResourceType:d.func,disabled:d.bool,dependentComponentsMode:d.string,resourceRelateComponents:d.object,blockletResourceType:d.string,projectType:d.string.isRequired};Wt.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const rr=ae(u)`
|
|
19
|
+
.main-table {
|
|
20
|
+
.text.excluded {
|
|
21
|
+
color: #999;
|
|
22
|
+
}
|
|
23
|
+
width: 400px;
|
|
24
|
+
${({theme:e})=>e.breakpoints.down("md")} {
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
> div:first-child {
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
30
|
+
.MuiTableCell-head {
|
|
31
|
+
padding-top: 0;
|
|
32
|
+
padding-bottom: 0;
|
|
33
|
+
}
|
|
34
|
+
.MuiTableCell-body {
|
|
35
|
+
padding-top: 6px;
|
|
36
|
+
padding-bottom: 6px;
|
|
37
|
+
}
|
|
38
|
+
.datatable-footer {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;function ir(e,o){const n=new Set(o||[]),r=[];function s(l){n.has(l==null?void 0:l.id)&&r.push(l==null?void 0:l.id),l!=null&&l.children&&l.children.forEach(s)}return(e||[]).forEach(s),r}function Ut({src:e,alt:o,...n}){const[r,s]=C.useState(!1),l=C.useRef(null);return C.useEffect(()=>{if(!("IntersectionObserver"in window))return s(!0),()=>{};const i=new IntersectionObserver(a=>{a.forEach(c=>{c.isIntersecting&&(s(!0),i.disconnect())})},{threshold:.1});return l.current&&i.observe(l.current),()=>{i.disconnect()}},[]),t.jsx("img",{ref:l,src:r?e:void 0,alt:o,...n})}Ut.propTypes={src:d.string.isRequired,alt:d.string};Ut.defaultProps={alt:""};function Ft({data:e,lazy:o,...n}){return!e||!e.length?null:t.jsx(lr,{...n,children:e.map(r=>t.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:o?t.jsx(Ut,{src:r.url,alt:r.alt||""}):t.jsx("img",{src:r.url,alt:r.alt||""})},r.url))})}Ft.propTypes={data:d.arrayOf(d.shape({url:d.string,alt:d.string})),lazy:d.bool};Ft.defaultProps={data:[],lazy:!1};const lr=ae(u)`
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
margin-bottom: -12px;
|
|
47
|
+
a {
|
|
48
|
+
display: flex;
|
|
49
|
+
}
|
|
50
|
+
img {
|
|
51
|
+
height: 128px;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
margin-right: 12px;
|
|
54
|
+
margin-bottom: 12px;
|
|
55
|
+
}
|
|
56
|
+
`,pt=(e,o)=>{const n=[...e];for(;n.length>0;){const r=n.shift();if(r.id===o)return r;r.children&&n.push(...r.children)}return[]};function Ht({icon:e}){return e?bs(e)?t.jsx("img",{className:"resource-icon",src:e,alt:"icon"}):t.jsx(ne,{className:"resource-icon",icon:e}):null}Ht.propTypes={icon:d.string};Ht.defaultProps={icon:""};function Gt({disabled:e,data:o,onChange:n,value:r}){const s=r;function l(p,v=[]){return v.push(p.id),p.children&&p.children.forEach(w=>l(w,v)),v}const i=p=>l(pt(o,p)),a=(p,v=[])=>{const w=pt(o,p);return w.parent?(v.push(w.parent),a(w.parent,v)):v};function c(p,v){const w=i(p.id),I=w.indexOf(p.id);return w.splice(I,1),w.every(j=>s.concat(v).includes(j))}const f=(p,v)=>{p.stopPropagation();const w=i(v),I=a(v);if(s.includes(v)){const j=s.filter(x=>!w.concat(I).includes(x));n(j)}else{const j=w;for(let x=0;x<I.length;++x)c(pt(o,I[x]),j)&&j.push(I[x]);n([...s].concat(j))}},h=p=>{p.stopPropagation()},g=o.some(p=>{var v;return((v=p.children)==null?void 0:v.length)>0}),b=p=>{var x;const v=s.indexOf(p.id)!==-1,w=Array.isArray(p.children),I=i(p.id),j=w&&!v&&s.some(R=>I.includes(R));return t.jsx(Is,{nodeId:p.id,label:t.jsx(Xe,{onClick:h,control:t.jsx(Ge,{size:"small",checked:v,indeterminate:j,tabIndex:-1,disableRipple:!0,onClick:R=>f(R,p.id),disabled:p.disabled||e}),label:t.jsxs(u,{className:"content",children:[t.jsxs(u,{display:"flex",alignItems:"center",children:[p.icon&&t.jsx(Ht,{icon:p.icon}),t.jsx(u,{className:"name",children:p.name}),p.url&&t.jsx("a",{href:p.url,target:"_blank",rel:"noreferrer",className:"link",children:t.jsx(ms,{className:"link-icon"})})]}),!!p.description&&t.jsx(u,{className:"description",children:p.description}),!!((x=p.images)!=null&&x.length)&&t.jsx(Ft,{className:"images",data:p.images,lazy:!0})]})}),children:w?p.children.map(b):null},p.id)};return t.jsx(cr,{className:$t(!g&&"no-children"),multiSelect:!0,defaultCollapseIcon:t.jsx(hs,{}),defaultExpandIcon:t.jsx(Ss,{}),selected:s,children:o.map(p=>b(p))})}Gt.propTypes={data:d.array,value:d.array,onChange:d.func,disabled:d.bool};Gt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const cr=ae(Ds)`
|
|
57
|
+
&.no-children {
|
|
58
|
+
.MuiTreeItem-content {
|
|
59
|
+
padding: 0;
|
|
60
|
+
.MuiTreeItem-iconContainer {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
.MuiTreeItem-label {
|
|
64
|
+
padding-left: 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.MuiTreeItem-content {
|
|
69
|
+
align-items: flex-start;
|
|
70
|
+
.MuiTreeItem-iconContainer {
|
|
71
|
+
transform: translateY(10px);
|
|
72
|
+
}
|
|
73
|
+
&.Mui-selected {
|
|
74
|
+
background-color: transparent;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
.MuiTreeItem-label {
|
|
78
|
+
cursor: default;
|
|
79
|
+
}
|
|
80
|
+
.MuiFormControlLabel-root {
|
|
81
|
+
align-items: flex-start;
|
|
82
|
+
}
|
|
83
|
+
.content {
|
|
84
|
+
padding-top: 6px;
|
|
85
|
+
}
|
|
86
|
+
.name {
|
|
87
|
+
font-size: 16px;
|
|
88
|
+
font-weight: 700;
|
|
89
|
+
}
|
|
90
|
+
.resource-icon {
|
|
91
|
+
margin-right: 2px;
|
|
92
|
+
font-size: 16px;
|
|
93
|
+
}
|
|
94
|
+
img.resource-icon {
|
|
95
|
+
width: 1rem;
|
|
96
|
+
height: 1rem;
|
|
97
|
+
}
|
|
98
|
+
.link {
|
|
99
|
+
margin-left: 8px;
|
|
100
|
+
font-size: 16px;
|
|
101
|
+
color: ${({theme:e})=>e.palette.primary.main};
|
|
102
|
+
display: flex;
|
|
103
|
+
}
|
|
104
|
+
.link-icon {
|
|
105
|
+
font-size: inherit;
|
|
106
|
+
}
|
|
107
|
+
.description {
|
|
108
|
+
font-size: 14px;
|
|
109
|
+
color: ${({theme:e})=>e.palette.text.secondary};
|
|
110
|
+
}
|
|
111
|
+
`,vo={},ar=(e,o,{key:n,cacheTime:r=1e3*3}={})=>{const s=n+JSON.stringify({params:o}),l=vo[s];if(l&&l.timestamp>Date.now()-r)return l.promise;const i=e(...o);return vo[s]={promise:i,timestamp:Date.now()},i},fn=ar,hn=(e,o)=>(e.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(r=>{r.parent=n.id,hn(r.children||[],r.id)})}),e),mn=(e,o,n,r,s)=>{const{exportApi:l="/"}=(e==null?void 0:e.meta.resource)||{},i=new URL(ce("http://127.0.0.1",e==null?void 0:e.mountPoint,l||"/").replace(/\/+/g,"/"));return i.searchParams.set("projectId",o),i.searchParams.set("releaseId",n),i.searchParams.set("local",r),s&&i.searchParams.set("resourcesParams",s.searchParams.get("resourcesParams")),`${i.pathname}${i.search}`},dr=async({api:e,appDid:o,component:n,projectId:r,releaseId:s,locale:l,initUrl:i,resources:a})=>{let c;if(i&&i.searchParams.get("resourcesParams"))try{c=JSON.parse(i.searchParams.get("resourcesParams"))}catch(f){W.error(f.message);return}await sn.post(mn(n,r,s,l,i),{resources:a,projectId:r,releaseId:s,locale:l,...c?{resourcesParams:c}:{}},{headers:{"x-csrf-token":xs()},timeout:60*1e3}),await e.updateSelectedResources({input:{did:o,projectId:r,releaseId:s,componentDid:n.meta.did,resources:a}})},ur=(e,o)=>{if(!e)return{};const n=o.reduce((s,l)=>(s[l]=!0,s),{}),r=(s,l)=>(s.forEach(i=>{var a;n[i.id]&&((a=i.dependentComponents)!=null&&a.length)&&i.dependentComponents.forEach(c=>{l[c]=!0}),i.children&&r(i.children,l)}),l);return r(e,{})};function Xt({app:e,component:o,projectId:n,release:r,loading:s,error:l,saveSelectedEventsRef:i,readOnly:a,componentDid:c,initialResources:f={},setResourceComponentsMap:h,selectedResourceIds:g,setSelectedResourceIds:b,showTree:p,initUrl:v}){var A;const{t:w,locale:I}=Q(),{api:j}=me(),[x,R]=Se({}),_=C.useRef({}),D=C.useRef(!1),k=r.id;_.current.projectId=n,_.current.releaseId=k;const T=(m,y,P)=>{if(!y)return;const O=ur(y,P);h==null||h({[m]:Object.keys(O)})},M=m=>{i.current[o.meta.did]={resources:m,component:o},b({[o.meta.did]:m}),T(o.meta.did,x[o.meta.did],m)},U=C.useCallback(async m=>{var y;try{const P=await fn(sn.get,[mn(m,n,k,I,v),{timeout:6e4}],{key:"getResources"});return hn(((y=P==null?void 0:P.data)==null?void 0:y.resources)||[])}catch{return[]}},[n,k,I,v]);C.useEffect(()=>{x[o==null?void 0:o.meta.did]||U(o).then(m=>{R({[o==null?void 0:o.meta.did]:m})}).catch(m=>{W.error(m.message)})},[o,R,x,U]),C.useEffect(()=>{k&&n&&!D.current&&et(e.children.map(m=>async()=>{var y,P;if(!(c&&c!==m.meta.did)&&!(!(m!=null&&m.mountPoint)||!us.hasStartEngine(m==null?void 0:m.meta)||!((P=(y=m==null?void 0:m.meta)==null?void 0:y.resource)!=null&&P.exportApi)))try{const O=await U(m);R({[m==null?void 0:m.meta.did]:O});const V=await j.getSelectedResources({input:{did:e.meta.did,projectId:n,releaseId:k,componentDid:m.meta.did}}),S=(V==null?void 0:V.resources)||[];S!=null&&S.length&&(b({[m.meta.did]:ir(O,S)}),T(m.meta.did,O,S),a||(i.current[m==null?void 0:m.meta.did]={resources:S,component:m}))}catch(O){W.error(O.message)}}),{concurrency:2}).then(()=>{D.current=!0})},[k,n,a,I,v,R]),C.useEffect(()=>{f&&Object.keys(f).length&&et(e.children.map(async m=>{const y=f[m.meta.did];if(y!=null&&y.length){const P=await U(m);b({[m.meta.did]:y}),T(m.meta.did,P,y),a||(i.current[m==null?void 0:m.meta.did]={resources:y,component:m})}}))},[e,f,a]);let q=null;return(!o||!((A=x[o.meta.did])!=null&&A.length))&&(q=t.jsx(Te,{Icon:Nt,children:w("blocklet.publish.resourceEmptyTip",{name:fo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(q=t.jsx(Te,{children:w("blocklet.publish.componentNotRunning",{name:fo.getDisplayName(o)})})),t.jsxs(t.Fragment,{children:[t.jsx(pr,{className:$t(l&&"error"),children:p&&t.jsx(u,{pb:2,width:"100%",children:q||t.jsx(Gt,{data:x[o.meta.did]||[],value:g[o.meta.did]||[],onChange:M,disabled:s||a})})}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}Xt.propTypes={component:d.object.isRequired,app:d.object.isRequired,projectId:d.string.isRequired,error:d.string,saveSelectedEventsRef:d.object.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired,release:d.shape({id:d.string.isRequired,status:d.string}),initialResources:d.object,initUrl:d.object,setResourceComponentsMap:d.func,componentDid:d.string,selectedResourceIds:d.array.isRequired,setSelectedResourceIds:d.func.isRequired,showTree:d.bool.isRequired};Xt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const pr=ae(u)`
|
|
112
|
+
border: 1px solid #ccc;
|
|
113
|
+
max-height: 600px;
|
|
114
|
+
width: 100%;
|
|
115
|
+
&.error {
|
|
116
|
+
border-color: ${e=>e.theme.palette.error.main};
|
|
117
|
+
}
|
|
118
|
+
border-radius: 4px;
|
|
119
|
+
padding: 16px;
|
|
120
|
+
padding-bottom: 0px;
|
|
121
|
+
overflow-y: auto;
|
|
122
|
+
.footer {
|
|
123
|
+
border-top: 1px solid #ddd;
|
|
124
|
+
display: flex;
|
|
125
|
+
padding: 12px 0;
|
|
126
|
+
margin-top: 12px;
|
|
127
|
+
position: sticky;
|
|
128
|
+
bottom: 0;
|
|
129
|
+
background: #fff;
|
|
130
|
+
z-index: 10;
|
|
131
|
+
}
|
|
132
|
+
`;var Jt={},fr=he;Object.defineProperty(Jt,"__esModule",{value:!0});var xt=Jt.default=void 0,hr=fr(be()),mr=t;xt=Jt.default=(0,hr.default)((0,mr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const wo="lastWantToConnectStoreId";function br(e){var a,c;const[o,n]=C.useState(null),{session:r}=rt(),s=C.useCallback(f=>{n(f),localStorage.setItem(wo,f==null?void 0:f.id)},[n]),l=C.useMemo(()=>{var b,p,v,w;const f=localStorage.getItem(wo),h=f?(((b=e==null?void 0:e.settings)==null?void 0:b.storeList)||[]).find(I=>I.id===f):null;if(h)return h;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(I=>{var j;return!(I.id!==X.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((j=r==null?void 0:r.user)==null?void 0:j.did))});return g||(g=(w=(v=e==null?void 0:e.settings)==null?void 0:v.storeList)==null?void 0:w[0]),g},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||l||{},s]}const ft={};async function bn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){ft[s]&&clearTimeout(ft[s]),await new Promise(a=>setTimeout(a,r));const l=Date.now(),i=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-l>n?c(f):s?ft[s]=setTimeout(()=>i(a,c),o):setTimeout(()=>i(a,c),o)}};return new Promise(i)}function xr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function gr(e,{did:o,projectId:n,messageId:r}){return bn(async()=>{var l;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((l=s==null?void 0:s.project)!=null&&l.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function jr(e,{did:o,projectId:n,storeId:r}){return bn(async()=>{var i,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(i=s==null?void 0:s.project)==null?void 0:i.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const xn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var i,a;const s=e?(i=n==null?void 0:n.meta)==null?void 0:i.did:o==null?void 0:o.did;let l=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(l)||(l=[]),l=l.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:l}};function Qt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:l,componentDid:i}){var m,y,P;const{t:a}=Q(),{session:c}=rt(),{api:f,info:h,inService:g}=me(),b=_e(),[p,v]=C.useState(!1),w=C.useRef(null),[I,j]=C.useState(!1),[x,R]=C.useState(null),_=O=>{n(O),v(!1)},D=()=>{v(!p)},k=O=>{w.current&&w.current.contains(O.target)||v(!1)},T=()=>{j(!0)},M=()=>{j(!1)},U=async()=>{var O;if(x)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:x.url,projectId:"",scope:x.scope||"studio"}}),await((O=b==null?void 0:b.actions)==null?void 0:O.refreshBlocklet())}catch(V){W.error(`Remove Blocklet Store Error: ${De(V)}`)}finally{R(null)}},{storeList:q}=xn({fromBlocklet:g,blocklet:e,nodeInfo:h,componentDid:i,userDid:(m=c==null?void 0:c.user)==null?void 0:m.did}),A=(y=e==null?void 0:e.meta)==null?void 0:y.did;return t.jsxs(t.Fragment,{children:[t.jsxs(bt,{disabled:s,ref:w,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Z,{onClick:r,children:[l&&t.jsx(Ye,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(Z,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:D,children:t.jsx(Es,{})})]}),t.jsx(Fo,{sx:{zIndex:10},open:p,anchorEl:w.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:O})=>t.jsx(Ho,{...O,style:{transformOrigin:"center top"},children:t.jsx(St,{children:t.jsx(Go,{onClickAway:k,children:t.jsxs(Xo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[q==null?void 0:q.map(V=>{var S;return t.jsxs(ue,{selected:V.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>_(V),children:[t.jsxs(u,{children:[t.jsx(pe,{sx:{fontSize:"16px"},maxLength:24,children:V.name}),t.jsx(pe,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:V.url})]}),Ts({store:V,userDid:(S=c==null?void 0:c.user)==null?void 0:S.did})&&t.jsx(oe,{sx:{ml:1},onClick:L=>{L.preventDefault(),L.stopPropagation(),R(V)},children:t.jsx(ne,{icon:"ic:outline-delete"})})]},V.url)}),t.jsx(Zn,{}),t.jsxs(ue,{onClick:T,children:[t.jsx(_t,{font:!0}),t.jsx(E,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&t.jsx(rn,{hiddenChildren:!0,open:!0,onClose:M,teamDid:A,storeList:q,scope:"studio",onAdd:(P=b==null?void 0:b.actions)==null?void 0:P.refreshBlocklet}),x&&t.jsx(Pt,{displayError:!0,title:`${a("common.delete")} ${x.name}`,description:a("blocklet.publish.deleteStoreTip",{name:x.name}),confirm:a("common.confirm"),onConfirm:U,onCancel:()=>R(null)})]})}Qt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Qt.defaultProps={store:null,blocklet:null};var fe=C;const Ae=/^[a-z0-9]+(-[a-z0-9]+)*$/,it=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Je(f)?null:f}const l=s[0],i=l.split("-");if(i.length>1){const a={provider:r,prefix:i.shift(),name:i.join("-")};return o&&!Je(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:l};return o&&!Je(a,n)?null:a}return null},Je=(e,o)=>e?!!((e.provider===""||e.provider.match(Ae))&&(o&&e.prefix===""||e.prefix.match(Ae))&&e.name.match(Ae)):!1,gn=Object.freeze({left:0,top:0,width:16,height:16}),tt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Yt=Object.freeze({...gn,...tt}),gt=Object.freeze({...Yt,body:"",hidden:!1});function kr(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function Co(e,o){const n=kr(e,o);for(const r in gt)r in tt?r in e&&!(r in n)&&(n[r]=tt[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function yr(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 vr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let l={};function i(a){l=Co(r[a]||s[a],l)}return i(o),n.forEach(i),Co(e,l)}function jn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=yr(e);for(const s in r){const l=r[s];l&&(o(s,vr(e,s,l)),n.push(s))}return n}const wr={provider:"",aliases:{},not_found:{},...gn};function ht(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function kn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!ht(e,wr))return null;const n=o.icons;for(const s in n){const l=n[s];if(!s.match(Ae)||typeof l.body!="string"||!ht(l,gt))return null}const r=o.aliases||Object.create(null);for(const s in r){const l=r[s],i=l.parent;if(!s.match(Ae)||typeof i!="string"||!n[i]&&!r[i]||!ht(l,gt))return null}return o}const Ro=Object.create(null);function Cr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ve(e,o){const n=Ro[e]||(Ro[e]=Object.create(null));return n[o]||(n[o]=Cr(e,o))}function Zt(e,o){return kn(o)?jn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function Rr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Me=!1;function yn(e){return typeof e=="boolean"&&(Me=e),Me}function Sr(e){const o=typeof e=="string"?it(e,!0,Me):e;if(o){const n=ve(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Ir(e,o){const n=it(e,!0,Me);if(!n)return!1;const r=ve(n.provider,n.prefix);return Rr(r,n.name,o)}function Dr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Me&&!o&&!e.prefix){let s=!1;return kn(e)&&(e.prefix="",jn(e,(l,i)=>{i&&Ir(l,i)&&(s=!0)})),s}const n=e.prefix;if(!Je({provider:o,prefix:n,name:"a"}))return!1;const r=ve(o,n);return!!Zt(r,e)}const vn=Object.freeze({width:null,height:null}),wn=Object.freeze({...vn,...tt}),Tr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,_r=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function So(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Tr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=_r.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 Pr=e=>e==="unset"||e==="undefined"||e==="none";function Lr(e,o){const n={...Yt,...e},r={...wn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let l=n.body;[n,r].forEach(v=>{const w=[],I=v.hFlip,j=v.vFlip;let x=v.rotate;I?j?x+=2:(w.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),w.push("scale(-1 1)"),s.top=s.left=0):j&&(w.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),w.push("scale(1 -1)"),s.top=s.left=0);let R;switch(x<0&&(x-=Math.floor(x/4)*4),x=x%4,x){case 1:R=s.height/2+s.top,w.unshift("rotate(90 "+R.toString()+" "+R.toString()+")");break;case 2:w.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:R=s.width/2+s.left,w.unshift("rotate(-90 "+R.toString()+" "+R.toString()+")");break}x%2===1&&(s.left!==s.top&&(R=s.left,s.left=s.top,s.top=R),s.width!==s.height&&(R=s.width,s.width=s.height,s.height=R)),w.length&&(l='<g transform="'+w.join(" ")+'">'+l+"</g>")});const i=r.width,a=r.height,c=s.width,f=s.height;let h,g;i===null?(g=a===null?"1em":a==="auto"?f:a,h=So(g,c/f)):(h=i==="auto"?c:i,g=a===null?So(h,f/c):a==="auto"?f:a);const b={},p=(v,w)=>{Pr(w)||(b[v]=w.toString())};return p("width",h),p("height",g),b.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:b,body:l}}const qr=/\sid="(\S+)"/g,$r="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Nr=0;function Ar(e,o=$r){const n=[];let r;for(;r=qr.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+(Nr++).toString(),a=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+i+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const jt=Object.create(null);function Er(e,o){jt[e]=o}function kt(e){return jt[e]||jt[""]}function Kt(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const eo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Qe=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Qe.push(Ne.shift()):Qe.push(Ne.pop());eo[""]=Kt({resources:["https://api.iconify.design"].concat(Qe)});function Mr(e,o){const n=Kt(o);return n===null?!1:(eo[e]=n,!0)}function to(e){return eo[e]}const zr=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Io=zr();function Or(e,o){const n=to(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(i=>{s=Math.max(s,i.length)});const l=o+".json?icons=";r=n.maxURL-s-n.path.length-l.length}return r}function Br(e){return e===404}const Vr=(e,o,n)=>{const r=[],s=Or(e,o),l="icons";let i={type:l,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(i),i={type:l,provider:e,prefix:o,icons:[]},a=c.length),i.icons.push(c)}),r.push(i),r};function Wr(e){if(typeof e=="string"){const o=to(e);if(o)return o.path}return"/"}const Ur=(e,o,n)=>{if(!Io){n("abort",424);return}let r=Wr(o.provider);switch(o.type){case"icons":{const l=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=l+".json?"+c.toString();break}case"custom":{const l=o.uri;r+=l.slice(0,1)==="/"?l.slice(1):l;break}default:n("abort",400);return}let s=503;Io(e+r).then(l=>{const i=l.status;if(i!==200){setTimeout(()=>{n(Br(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)})},Fr={prepare:Vr,send:Ur};function Hr(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,l)=>s.provider!==l.provider?s.provider.localeCompare(l.provider):s.prefix!==l.prefix?s.prefix.localeCompare(l.prefix):s.name.localeCompare(l.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const l=s.provider,i=s.prefix,a=s.name,c=n[l]||(n[l]=Object.create(null)),f=c[i]||(c[i]=ve(l,i));let h;a in f.icons?h=o.loaded:i===""||f.missing.has(a)?h=o.missing:h=o.pending;const g={provider:l,prefix:i,name:a};h.push(g)}),o}function Cn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Gr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(l=>{const i=l.icons,a=i.pending.length;i.pending=i.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])i.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))i.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),i.pending.length!==a&&(n||Cn([e],l.id),l.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),l.abort))})}))}let Xr=0;function Jr(e,o,n){const r=Xr++,s=Cn.bind(null,n,r);if(!o.pending.length)return s;const l={id:r,icons:o,callback:e,abort:s};return n.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(l)}),s}function Qr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const l=typeof s=="string"?it(s,o,n):s;l&&r.push(l)}),r}var Yr={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 k=e.resources.slice(0);for(i=[];k.length>1;){const T=Math.floor(Math.random()*k.length);i.push(k[T]),k=k.slice(0,T).concat(k.slice(T+1))}i=i.concat(k)}else i=e.resources.slice(l).concat(e.resources.slice(0,l));const a=Date.now();let c="pending",f=0,h,g=null,b=[],p=[];typeof r=="function"&&p.push(r);function v(){g&&(clearTimeout(g),g=null)}function w(){c==="pending"&&(c="aborted"),v(),b.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),b=[]}function I(k,T){T&&(p=[]),typeof k=="function"&&p.push(k)}function j(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:b.length,subscribe:I,abort:w}}function x(){c="failed",p.forEach(k=>{k(void 0,h)})}function R(){b.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),b=[]}function _(k,T,M){const U=T!=="success";switch(b=b.filter(q=>q!==k),c){case"pending":break;case"failed":if(U||!e.dataAfterTimeout)return;break;default:return}if(T==="abort"){h=M,x();return}if(U){h=M,b.length||(i.length?D():x());return}if(v(),R(),!e.random){const q=e.resources.indexOf(k.resource);q!==-1&&q!==e.index&&(e.index=q)}c="completed",p.forEach(q=>{q(M)})}function D(){if(c!=="pending")return;v();const k=i.shift();if(k===void 0){if(b.length){g=setTimeout(()=>{v(),c==="pending"&&(R(),x())},e.timeout);return}x();return}const T={status:"pending",resource:k,callback:(M,U)=>{_(T,M,U)}};b.push(T),f++,g=setTimeout(D,e.rotate),n(k,o,T.callback)}return setTimeout(D),j}function Rn(e){const o={...Yr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Zr(o,a,c,(g,b)=>{r(),f&&f(g,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 Do(){}const mt=Object.create(null);function Kr(e){if(!mt[e]){const o=to(e);if(!o)return;const n=Rn(o),r={config:o,redundancy:n};mt[e]=r}return mt[e]}function ei(e,o,n){let r,s;if(typeof e=="string"){const l=kt(e);if(!l)return n(void 0,424),Do;s=l.send;const i=Kr(e);i&&(r=i.redundancy)}else{const l=Kt(e);if(l){r=Rn(l);const i=e.resources?e.resources[0]:"",a=kt(i);a&&(s=a.send)}}return!r||!s?(n(void 0,424),Do):r.query(o,s,n)().abort}const To="iconify2",ze="iconify",Sn=ze+"-count",_o=ze+"-version",In=36e5,ti=168;function yt(e,o){try{return e.getItem(o)}catch{}}function oo(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Po(e,o){try{e.removeItem(o)}catch{}}function vt(e,o){return oo(e,Sn,o.toString())}function wt(e){return parseInt(yt(e,Sn))||0}const lt={local:!0,session:!0},Dn={local:new Set,session:new Set};let no=!1;function oi(e){no=e}let He=typeof window>"u"?{}:window;function Tn(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}lt[e]=!1}function _n(e,o){const n=Tn(e);if(!n)return;const r=yt(n,_o);if(r!==To){if(r){const a=wt(n);for(let c=0;c<a;c++)Po(n,ze+c.toString())}oo(n,_o,To),vt(n,0);return}const s=Math.floor(Date.now()/In)-ti,l=a=>{const c=ze+a.toString(),f=yt(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Po(n,c)}};let i=wt(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,vt(n,i)):Dn[e].add(a))}function Pn(){if(!no){oi(!0);for(const e in lt)_n(e,o=>{const n=o.data,r=o.provider,s=n.prefix,l=ve(r,s);if(!Zt(l,n).length)return!1;const i=n.lastModified||-1;return l.lastModifiedCached=l.lastModifiedCached?Math.min(l.lastModifiedCached,i):i,!0})}}function ni(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in lt)_n(r,s=>{const l=s.data;return s.provider!==e.provider||l.prefix!==e.prefix||l.lastModified===o});return!0}function si(e,o){no||Pn();function n(r){let s;if(!lt[r]||!(s=Tn(r)))return;const l=Dn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=wt(s),!vt(s,i+1))return;const a={cached:Math.floor(Date.now()/In),provider:e.provider,data:o};return oo(s,ze+i.toString(),JSON.stringify(a))}o.lastModified&&!ni(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function Lo(){}function ri(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Gr(e)}))}function ii(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let l;if(!s||!(l=kt(n)))return;l.prepare(n,r,s).forEach(a=>{ei(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=Zt(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(g=>{h.delete(g)}),si(e,c)}catch(f){console.error(f)}ri(e)})})}))}const li=(e,o)=>{const n=Qr(e,!0,yn()),r=Hr(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,Lo)}),()=>{c=!1}}const s=Object.create(null),l=[];let i,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===i)return;i=f,a=h,l.push(ve(f,h));const g=s[f]||(s[f]=Object.create(null));g[h]||(g[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:g}=c,b=ve(f,h),p=b.pendingIcons||(b.pendingIcons=new Set);p.has(g)||(p.add(g),s[f][h].push(g))}),l.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ii(c,s[f][h])}),o?Jr(o,r,l):Lo};function ci(e,o){const n={...e};for(const r in o){const s=o[r],l=typeof s;r in vn?(s===null||s&&(l==="string"||l==="number"))&&(n[r]=s):l===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const ai=/[\s,]+/;function di(e,o){o.split(ai).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ui(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 pi(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 fi(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function hi(e){return"data:image/svg+xml,"+fi(e)}function mi(e){return'url("'+hi(e)+'")'}let Ee;function bi(){try{Ee=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ee=null}}function xi(e){return Ee===void 0&&bi(),Ee?Ee.createHTML(e):e}const Ln={...wn,inline:!1},gi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ji={display:"inline-block"},Ct={backgroundColor:"currentColor"},qn={backgroundColor:"transparent"},qo={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},$o={WebkitMask:Ct,mask:Ct,background:qn};for(const e in $o){const o=$o[e];for(const n in qo)o[e+n]=qo[n]}const ki={...Ln,inline:!0};function No(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const yi=(e,o,n,r)=>{const s=n?ki:Ln,l=ci(s,o),i=o.mode||"svg",a={},c=o.style||{},f={...i==="svg"?gi:{},ref:r};for(let j in o){const x=o[j];if(x!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":l[j]=x===!0||x==="true"||x===1;break;case"flip":typeof x=="string"&&di(l,x);break;case"color":a.color=x;break;case"rotate":typeof x=="string"?l[j]=ui(x):typeof x=="number"&&(l[j]=x);break;case"ariaHidden":case"aria-hidden":x!==!0&&x!=="true"&&delete f["aria-hidden"];break;default:s[j]===void 0&&(f[j]=x)}}const h=Lr(e,l),g=h.attributes;if(l.inline&&(a.verticalAlign="-0.125em"),i==="svg"){f.style={...a,...c},Object.assign(f,g);let j=0,x=o.id;return typeof x=="string"&&(x=x.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:xi(Ar(h.body,x?()=>x+"ID"+j++:"iconifyReact"))},fe.createElement("svg",f)}const{body:b,width:p,height:v}=e,w=i==="mask"||(i==="bg"?!1:b.indexOf("currentColor")!==-1),I=pi(b,{...g,width:p+"",height:v+""});return f.style={...a,"--svg":mi(I),width:No(g.width),height:No(g.height),...ji,...w?Ct:qn,...c},fe.createElement("span",f)};yn(!0);Er("",Fr);if(typeof document<"u"&&typeof window<"u"){Pn();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Dr(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;Mr(n,s)||console.error(r)}catch{console.error(r)}}}}class $n extends fe.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=it(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const l=Sr(s);if(!l){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),l!==null&&(this._loading={name:r,abort:li([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const i=["iconify"];s.prefix!==""&&i.push("iconify--"+s.prefix),s.provider!==""&&i.push("iconify--"+s.provider),this._setData({data:l,classes:i}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:fe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),yi({...Yt,...n.data},r,o._inline,o._ref)}}const vi=fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return fe.createElement($n,r)});fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return fe.createElement($n,r)});var wi=vi;const Ci=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ct({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Q(),l=e.includes("youtube.com")||e.includes("youtu.be"),i=e.includes("vimeo.com");if(l){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[t.jsx(wi,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(E,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ct.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ct.defaultProps={style:{},controls:1,modestbranding:1};function Nn({setParams:e,onClose:o,params:n}){const{t:r}=Q(),[s,l]=C.useState(""),i=s&&n.blockletVideos.includes(s),a=Ci(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(It,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Jo,{children:r("studio.videoDialogTitle")}),t.jsxs(Qo,{children:[t.jsx(Kn,{fullWidth:!0,value:s,onChange:f=>l(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Be,{position:"end",children:t.jsx(oe,{onClick:()=>l(""),children:t.jsx(gs,{})})}):null,error:i}),i&&t.jsx(E,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ct,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Yo,{children:[t.jsx(Z,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Z,{disabled:!a||i,onClick:c,children:r("studio.confirm")})]})]})}Nn.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Ao=C.lazy(()=>en(()=>import("./index-BdfFmrlk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function An({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:l,paramsErrTip:i,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:g,componentDid:b}){const{t:p,locale:v}=Q(),{api:w}=me(),I=Rt(),j=C.useRef(null),x=C.useRef(null),[R,_]=br(r),[D,k]=C.useState(!1),T=_s({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),M=async S=>{const L=setTimeout(()=>{c(!1)},2e4),B=await gr(w,S);c(!1),clearTimeout(L),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),I(window.location.pathname.replace(`${X.UNOWNED_DID}/create`,`${B}/create`),{replace:!0})},U=()=>{if(!s.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const S=xr();T(async(L,B)=>{var F,G,ee;try{const J=await w.connectByStudio({input:{did:(F=r==null?void 0:r.meta)==null?void 0:F.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((G=s==null?void 0:s.blockletComponents)==null?void 0:G.length)>0?"pack":"resource",componentDid:b,messageId:S,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){W.error("failed to connect to store");return}B(J.url),M({did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,projectId:"",messageId:S})}catch(J){const se=De(J);W.error(se),c(!1)}})},q=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,A=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,m=s!=null&&s.blockletLogo?`${q}/${s.blockletLogo}`:`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,y=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(S=>`${A}/${S}`),P=()=>o?!1:!e||e===X.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,O=S=>{if(!S.destination)return;const L=Array.from(s.blockletScreenshots),[B]=L.splice(S.source.index,1);L.splice(S.destination.index,0,B),l(F=>({...F,blockletScreenshots:L}))},V=S=>{if(!S.destination)return;const L=Array.from(s.blockletVideos),[B]=L.splice(S.source.index,1);L.splice(S.destination.index,0,B),l(F=>({...F,blockletVideos:L}))};return t.jsxs(Ri,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:s.blockletTitle||"",onChange:S=>{a({blockletTitle:""}),l({blockletTitle:S.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),t.jsx(Y,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===X.UNOWNED_DID&&t.jsx(Be,{position:"end",children:t.jsx(Qt,{blocklet:r,store:R,componentDid:b,onChangeStore:_,disabled:!s.blockletTitle||o||n,loading:n,onClick:U})})},error:!!i.projectId,helperText:i.projectId||"",value:e===X.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletDescription||"",onChange:S=>{a({blockletDescription:""}),l({blockletDescription:S.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletHomepage||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),l({blockletHomepage:S.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletCommunity||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),l({blockletCommunity:S.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletSupport||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),l({blockletSupport:S.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletRepository||"",onChange:S=>{S.target.value&&!/^(git|https|svn)/.test(S.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),l({blockletRepository:S.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(ke,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||m,onClick:()=>{var S;P()&&((S=j.current)==null||S.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(ke,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(bo,{onDragEnd:o?void 0:O,children:t.jsx(xo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(S,L)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:L.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:L.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:S.innerRef,...S.droppableProps,children:[y.map((B,F)=>t.jsx(go,{draggableId:B,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:B}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(xt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletScreenshots];return se.splice(F,1),{...J,blockletScreenshots:se}})},children:t.jsx(jo,{})})]})},B)),S.placeholder,y.length<5&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var B;P()&&((B=x.current)==null||B.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(ke,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(bo,{onDragEnd:o?void 0:V,children:t.jsx(xo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(S,L)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:L.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:L.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:S.innerRef,...S.droppableProps,children:[s.blockletVideos.map((B,F)=>t.jsx(go,{draggableId:B,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ct,{url:B,style:{pointerEvents:ee.isDragging?"none":"auto"}}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(xt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletVideos];return se.splice(F,1),{...J,blockletVideos:se}})},children:t.jsx(jo,{})})]})},B)),S.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{P()&&k(!0)},children:"+"})]})})})]})]})}),t.jsxs(C.Suspense,{fallback:t.jsx(Ve,{}),children:[t.jsx(Ao,{ref:j,locale:v,popup:!0,onUploadFinish:S=>{var L;l({blockletLogo:S.data.filename}),g(""),(L=j.current)==null||L.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),D&&t.jsx(Nn,{onClose:()=>k(!1),params:s,setParams:l}),t.jsx(Ao,{ref:x,popup:!0,onUploadFinish:S=>{var L;l(B=>{var G;const F=B.blockletScreenshots||[];return F.push((G=S.data)==null?void 0:G.filename),{...B,blockletScreenshots:F}}),(L=x.current)==null||L.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:A,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-y.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")]})]})}An.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 Ri=ae.div`
|
|
133
|
+
margin-top: 24px;
|
|
134
|
+
.screenshot {
|
|
135
|
+
margin-bottom: 16px;
|
|
136
|
+
max-width: 240px;
|
|
137
|
+
max-height: 135px;
|
|
138
|
+
width: 240px;
|
|
139
|
+
height: 135px;
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
background-color: #eee;
|
|
145
|
+
margin-right: 16px;
|
|
146
|
+
position: relative;
|
|
147
|
+
.action {
|
|
148
|
+
visibility: hidden;
|
|
149
|
+
position: absolute;
|
|
150
|
+
width: 42px;
|
|
151
|
+
height: 42px;
|
|
152
|
+
right: 6px;
|
|
153
|
+
top: 6px;
|
|
154
|
+
border-radius: 4px;
|
|
155
|
+
background-color: rgba(0, 0, 0, 1);
|
|
156
|
+
color: rgba(255, 255, 255, 1);
|
|
157
|
+
}
|
|
158
|
+
&:hover .action {
|
|
159
|
+
visibility: visible;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
.screenshot img {
|
|
163
|
+
width: 100%; /* 图像宽度填充容器 */
|
|
164
|
+
height: auto; /* 图像高度自适应 */
|
|
165
|
+
}
|
|
166
|
+
`;var so={},Si=he;Object.defineProperty(so,"__esModule",{value:!0});var En=so.default=void 0,Ii=Si(be()),Di=t;En=so.default=(0,Ii.default)((0,Di.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 Ti=(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},_i=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*Pi(e,o){let n=0;for(;n<e.size;)yield e.slice(n,n+o),n+=o}const Li=async({did:e,projectId:o,uploadType:n="logo",imageUrl:r})=>{const s=await _i(r);new FormData().append("file",s);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(s.name),name:encodeURIComponent(s.name),type:s.type},c=(await ho.post(ce(X.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",e,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":s.size,"X-Uploader-File-Ext":s.name.split(".").pop(),"Upload-Metadata":Object.keys(i).map(b=>`${b} ${btoa(i[b])}`).join(",")}})).headers.location,f=2*1024*1024;let h=0,g="";for(const b of Pi(s,f)){const p=await ho.patch(ce(X.WELLKNOWN_SERVICE_PATH_PREFIX,c),b,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":h,"Content-Type":"application/offset+octet-stream"}});h+=b.size,g=p.data.filename}return g},Mn=({params:e,projectId:o,status:n,t:r})=>{const s=[];return e.blockletTitle||s.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),(!o||o===X.UNOWNED_DID)&&s.push({param:"projectId",message:r("blocklet.publish.errorTip.noDid")}),e.blockletVersion?Ie.valid(e.blockletVersion)||s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===re.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||s.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),e.note||s.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),s.length?s:null},qi=({params:e,step:o,t:n,projectId:r})=>{if(o===0){if(!e.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!r||r===X.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!e.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!Ie.valid(e.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!e.note)return n("blocklet.publish.errorTip.noNote")}return""};function ro({blocklet:e,releaseId:o,connectedStores:n,projectId:r,releaseType:s,publishedStoreIds:l,onPublish:i,onDelete:a,projectType:c,componentDid:f,onOpenConnectStore:h,behavior:g,onSelectConnectStore:b}){var R,_;const{t:p}=Q(),{actions:{refreshBlocklet:v}}=_e(),{session:w}=rt(),{storeList:I}=xn({fromBlocklet:!0,blocklet:e,componentDid:f,userDid:(R=w==null?void 0:w.user)==null?void 0:R.did}),j=C.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((D,k)=>(D[k.storeId]=k,D),{}):{},[n]),x=(_=e==null?void 0:e.meta)==null?void 0:_.did;return t.jsxs(t.Fragment,{children:[g==="connect"&&!!(I!=null&&I.length)&&t.jsx(Uo,{severity:"info",style:{width:"100%"},children:t.jsxs(u,{color:es[400],component:"a",href:c==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[p(c==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),t.jsx(zs,{sx:{marginLeft:1}})]})}),t.jsx(ts,{children:I==null?void 0:I.map(D=>t.jsx(os,{"data-cy":"store-switch",children:t.jsx(ns,{children:t.jsx(Ps,{behavior:g,onSelectConnectStore:b,releaseId:o,projectId:r,releaseType:s,kind:"publish",teamDid:x,store:D,published:(l==null?void 0:l.indexOf(D.id))>-1,connectedStore:j[D.id],onPublish:i,onDelete:a,scope:D.scope||"studio",onOpenConnectStore:h})})},D.url))}),t.jsx(rn,{teamDid:x,storeList:I,scope:"studio",onAdd:v})]})}ro.propTypes={blocklet:d.object.isRequired,projectId:d.string.isRequired,releaseId:d.string.isRequired,releaseType:d.string.isRequired,onPublish:d.func,onDelete:d.func,publishedStoreIds:d.arrayOf(d.string),connectedStores:d.arrayOf(d.object).isRequired,projectType:d.string,componentDid:d.string,onOpenConnectStore:d.func,onSelectConnectStore:d.func,behavior:d.string};ro.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function zn({did:e,params:o,setParams:n,projectId:r,open:s,onClose:l}){const{t:i}=Q(),[a,c]=C.useState(!1),{api:f}=me(),[h,g]=C.useState(!1),[b,p]=C.useState(!1),v=()=>{g(o.autoUpload),p(o.possibleSameStore),c(!1),l(!1)},w=async()=>{c(!0);try{await f.updateProject({input:{did:e,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!h,possibleSameStore:!!b}}),n({autoUpload:h,possibleSameStore:b}),l(!1)}catch(j){W.error(j.message)}c(!1)};C.useEffect(()=>{g(o.autoUpload),p(o.possibleSameStore)},[o]);const I=!!(r&&r!==X.UNOWNED_DID);return t.jsx(Tt,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:s,onClose:v,actions:t.jsxs(t.Fragment,{children:[t.jsx(Z,{onClick:j=>{j.stopPropagation(),l()},color:"inherit",children:i("common.cancel")}),I&&t.jsxs(Z,{onClick:j=>{j.stopPropagation(),w()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a,variant:"contained",autoFocus:!0,children:[a&&t.jsx(Ye,{size:16}),i("common.confirm")]})]}),children:I?t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:ne,icon:"ph:upload",sx:{fontSize:24,mr:2}}),t.jsx(E,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),t.jsx(ye,{checked:h,onChange:(j,x)=>g(x)})]}),t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:ne,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),t.jsx(E,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.possibleSameStoreTip")}),t.jsx(ye,{checked:b,onChange:(j,x)=>p(x)})]})]}):t.jsxs(u,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[t.jsx(u,{component:ne,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),t.jsx(E,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}zn.propTypes={did:d.string.isRequired,params:d.object.isRequired,open:d.bool.isRequired,onClose:d.func.isRequired,setParams:d.func.isRequired,projectId:d.string.isRequired};function On({downloadUrl:e,installUrl:o,handleSetTip:n,isPack:r,disabled:s}){const{t:l}=Q(),[i,a]=C.useState(!1),c=C.useRef(null),f=()=>{a(!i)},h=g=>{c.current&&c.current.contains(g.target)||a(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(Z,{disabled:s,ref:c,onClick:f,children:t.jsx(u,{component:ne,sx:{fontSize:18},icon:"bxs:download"})}),t.jsx(Fo,{sx:{zIndex:10},open:i,anchorEl:c.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>t.jsx(Ho,{...g,style:{transformOrigin:"center top"},children:t.jsx(St,{children:t.jsx(Go,{onClickAway:h,children:t.jsxs(Xo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&t.jsx(u,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(ue,{sx:{color:"#333"},children:[t.jsx(u,{component:ne,sx:{mr:1},icon:"ic:round-install-desktop"}),t.jsx(E,{variant:"inherit",children:l("blocklet.publish.installToThisServer")})]})}),t.jsxs(ue,{onClick:n,children:[t.jsx(u,{component:ne,sx:{mr:1},icon:"iconamoon:copy"}),t.jsx(E,{variant:"inherit",children:l("blocklet.publish.copyInstallUrl")})]}),t.jsx(u,{component:"a",href:e,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(ue,{sx:{color:"#333"},children:[t.jsx(u,{component:ne,sx:{mr:1},icon:"ph:download"}),t.jsx(E,{variant:"inherit",children:l("common.download")})]})})]})})})})})]})}On.propTypes={disabled:d.bool.isRequired,isPack:d.bool.isRequired,downloadUrl:d.string.isRequired,installUrl:d.string.isRequired,handleSetTip:d.func.isRequired};var Bo;const Eo=(Bo=window.env)==null?void 0:Bo.serverEndpoint;function Bn({projectId:e,params:o,setParamsErrTip:n,initUrl:r,setParams:s,mode:l,loading:i,blocklet:a,release:c,isPublished:f,releaseId:h,getData:g,getRelease:b,paramsErrTip:p,componentDid:v,resourceRelateComponents:w,disabledSelectComponents:I,saveSelectedEventsRef:j,hasSelectedResources:x,initLogoUrl:R,setLoading:_,releaseUsedLast:D,setReleaseUsedLast:k,projectType:T}){var qe;const{t:M,locale:U}=Q(),{api:q}=me(),A=Rt(),[m,y]=C.useState(!1),[P,O]=C.useState(!1),[V,S]=C.useState(),L=Oe(te=>te.breakpoints.down("md")),B=C.useMemo(()=>{var te;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((te=o==null?void 0:o.blockletComponents)==null?void 0:te.length)>0?(o==null?void 0:o.blockletComponents.find($=>$.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),F=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),b()},G=async te=>{var $e,Re,We,Ue;if(p!=null&&p.blockletHomepage||p!=null&&p.blockletSupport||p!=null&&p.blockletCommunity){W.error((p==null?void 0:p.blockletHomepage)||(p==null?void 0:p.blockletSupport)||(p==null?void 0:p.blockletCommunity));return}const ge=Mn({params:o,hasSelectedResources:x,projectId:e,status:te,t:M});if(ge){W.error(ge.map(H=>H.message).join("; ")),n(ge.reduce((H,K)=>({...H,[K.param]:K.message}),{}));return}const $={...o};if($.blockletComponents=Ti($.blockletComponents,a,w,I),$.blockletVersion=Ie.valid($.blockletVersion),!$.blockletVersion){W.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(R)try{const H=await Li({did:a.meta.did,projectId:e,imageUrl:R});$.blockletLogo=H,s({blockletLogo:H})}catch(H){W.error(H.message);return}if(o.resourceFromSelect){$.uploadedResource="";try{const H=Object.keys(j.current);await et(H.map(K=>()=>{const Fe=j.current[K];return dr({api:q,locale:U,projectId:e,releaseId:D?"":h,appDid:a.meta.did,component:Fe.component,resources:Fe.resources,initUrl:r})}),{concurrency:2})}catch(H){W.error(((We=(Re=($e=H==null?void 0:H.response)==null?void 0:$e.data)==null?void 0:Re.error)==null?void 0:We.message)||H.message),n({blockletResource:"Invalid save the resource"});return}}else(Ue=o.blockletDocker)!=null&&Ue.dockerImage||($.blockletComponents=[]);$.blockletTitle=($.blockletTitle||"").trim(),$.blockletDescription=($.blockletDescription||"").trim(),$.blockletSupport=($.blockletSupport||"").trim(),$.blockletHomepage=($.blockletHomepage||"").trim(),$.blockletCommunity=($.blockletCommunity||"").trim(),$.blockletRepository=($.blockletRepository||"").trim(),$.blockletIntroduction=($.blockletIntroduction||"").trim(),$.note=($.note||"").trim(),$.blockletComponents=(($==null?void 0:$.blockletComponents)||[]).filter(H=>H.included).map(H=>qt(H,["did","required"])).map(JSON.stringify),$.contentType!=="docker"&&($.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]});try{await q.createRelease({input:{...$,did:a.meta.did,projectId:e,releaseId:D?"":h,status:te}}),te==="draft"?W.success(M("blocklet.publish.saveDraftSuccess")):(k(!1),W.success(M("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(H){const K=De(H);W.error(K),(/resource/.test(K)||/zip/.test(K))&&n({blockletResource:K});return}const we=await q.getProject({input:{did:a.meta.did,projectId:e}}),Ce=we.project.lastReleaseId;o.autoUpload&&await et(we.project.connectedStores.map(H=>async()=>{try{const K=await q.publishToStore({input:{did:a.meta.did,storeId:H.storeId,storeName:H.storeName,projectId:e,releaseId:Ce,type:B}});W.success(t.jsx(Ls,{storeName:H.storeName,storeUrl:H.storeUrl,developerDid:H.developerDid,published:K.url==="published"}),{duration:1e4})}catch(K){W.error(De(K))}}),{concurrency:4}),F==null||F(),A(`../${e}/view/${Ce}`,{replace:!0})},ee=te=>(_(!0),G(te).finally(()=>{_(!1)})),J=async te=>{await jr(q,te),g()},se=()=>{O(!0)},ie=ce(Eo,`/api/project/${a.meta.did}/${e}/${h}/release/blocklet.json`),xe=new URL(Eo);xe.pathname=ce(xe.pathname,"/launch-blocklet/agreement"),xe.searchParams.set("blocklet_meta_url",ie);const Pe=xe.href,Le=()=>S(ie);return t.jsxs(t.Fragment,{children:[t.jsx($i,{className:"sticky-header",children:t.jsxs(u,{display:"flex",alignItems:"center",flexDirection:"row",children:[t.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(le,{to:"../",children:M("common.blockletStudio")}),e===X.UNOWNED_DID?t.jsx(E,{color:"text.primary",children:t.jsx(pe,{maxLength:L?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):t.jsx(le,{to:`../${e}`,children:t.jsx(pe,{maxLength:L?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),t.jsx(E,{color:"text.primary",children:l==="create"?M("common.create"):(o==null?void 0:o.blockletVersion)||M("common.edit")})]}),t.jsx(u,{flex:"1"}),!f&&t.jsxs(bt,{disabled:i,variant:"contained",children:[t.jsxs(Z,{variant:"contained",onClick:()=>ee(re.PROJECT.RELEASE_STATUS.published),children:[i&&t.jsx(Ye,{size:14,sx:{mr:.5},color:"inherit"}),M("blocklet.publish.createRelease")]}),t.jsx(Z,{variant:"contained",onClick:se,children:t.jsx(ne,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(It,{fullWidth:!0,maxWidth:"sm",open:V,onClose:()=>S(""),children:t.jsxs(u,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(E,{variant:"h6",sx:{mb:2},children:M("blocklet.publish.installResourceTip")}),t.jsx(Ms,{children:V}),t.jsxs(E,{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(bt,{disabled:i,variant:"contained",children:[t.jsxs(Z,{onClick:()=>y(!0),children:[i?t.jsx(Ye,{size:14,sx:{mr:1},color:"inherit"}):t.jsx(En,{sx:{fontSize:"1.3em",mr:1}}),M(L?"common.upload":"blocklet.publish.connectOrUpload")]}),t.jsx(On,{isPack:B==="pack",downloadUrl:ce(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${h}/download/${(c.files||[])[0]}`),installUrl:Pe,handleSetTip:Le}),t.jsx(Z,{onClick:se,children:t.jsx(ne,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),t.jsx(Tt,{title:M("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:m,onClose:()=>y(!1),children:t.jsx(ro,{projectType:T,blocklet:a,releaseType:B,projectId:e,releaseId:h,componentDid:v,onPublish:F,onOpenConnectStore:J,onDelete:g,connectedStores:o.connectedStores||[],publishedStoreIds:c==null?void 0:c.publishedStoreIds})}),t.jsx(zn,{did:(qe=a==null?void 0:a.meta)==null?void 0:qe.did,params:o,projectId:e,open:P,setParams:s,onClose:()=>O(!1)})]})}Bn.propTypes={projectId:d.string.isRequired,params:d.object.isRequired,mode:d.string.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,release:d.object.isRequired,isPublished:d.bool.isRequired,releaseId:d.string.isRequired,getData:d.func.isRequired,getRelease:d.func.isRequired,componentDid:d.string.isRequired,resourceRelateComponents:d.object.isRequired,disabledSelectComponents:d.bool.isRequired,saveSelectedEventsRef:d.object.isRequired,hasSelectedResources:d.bool.isRequired,initLogoUrl:d.string.isRequired,setLoading:d.func.isRequired,releaseUsedLast:d.bool.isRequired,setReleaseUsedLast:d.func.isRequired,projectType:d.string.isRequired,setParamsErrTip:d.func.isRequired,setParams:d.func.isRequired,initUrl:d.object.isRequired,paramsErrTip:d.object.isRequired};const $i=ae.div`
|
|
167
|
+
.sticky-header {
|
|
168
|
+
margin-top: -12px;
|
|
169
|
+
padding: 12px 0;
|
|
170
|
+
position: sticky;
|
|
171
|
+
top: 0;
|
|
172
|
+
z-index: 99;
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
justify-content: space-between;
|
|
176
|
+
background-color: #fff;
|
|
177
|
+
padding-bottom: 12px;
|
|
178
|
+
border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
|
|
179
|
+
}
|
|
180
|
+
`;function Vn({text:e}){return e?t.jsx(Os,{wrapperElement:{"data-color-mode":"light"},source:js.sanitize(e),rehypePlugins:[[Bs,{target:"_blank"}]]}):t.jsx(Te,{Icon:Nt})}Vn.propTypes={text:d.string.isRequired};function Wn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var h;const{t:i}=Q(),[a,c]=C.useState(l?"preview":"write"),f=(g,b)=>{c(b)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),t.jsxs(Zo,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(Ze,{value:"write",label:"Write"}),t.jsx(Ze,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Y,{disabled:r||l,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:l,endAdornment:t.jsxs(Be,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",re.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{s({blockletIntroduction:""}),o({blockletIntroduction:g.target.value.slice(0,re.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(Vn,{text:e.blockletIntroduction||""})})]})}Wn.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var io={},Ni=he;Object.defineProperty(io,"__esModule",{value:!0});var Un=io.default=void 0,Ai=Ni(be()),Mo=t;Un=io.default=(0,Ai.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function lo({step:e,ok:o,active:n,error:r}){let s="grey.500",l=e+1;return o&&(l=t.jsx(Vs,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",l=t.jsx(Un,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}lo.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};lo.defaultProps={step:0,ok:!1,active:0,error:""};function Fn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:f}=Q(),h=()=>{n(v=>v+1)},g=()=>{n(v=>v-1)},b=v=>v===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription)||(i==null?void 0:i.blockletHomepage)||(i==null?void 0:i.blockletSupport)||(i==null?void 0:i.blockletCommunity)||(i==null?void 0:i.blockletRepository):v===2?(i==null?void 0:i.blockletResource)||(i==null?void 0:i.blockletDocker)||(i==null?void 0:i.dockerImageName):v>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||Mn({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(ss,{activeStep:o,orientation:"vertical",children:e.map((v,w)=>{const I={},j=l||!qi({hasSelectedResources:r,params:s,projectId:c,step:w,t:f}),x=l?"":b(w);return x&&(I.optional=t.jsx(E,{variant:"caption",color:"error",children:x}),I.error=!0),t.jsxs(rs,{children:[t.jsx(is,{icon:t.jsx(lo,{error:x,active:p?99:o,step:w,ok:j}),sx:{cursor:"pointer",color:x?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...I,children:t.jsx(E,{fontSize:"14px",fontWeight:"500",color:x||!j&&o>w?"error.main":"inherit",children:v.label})}),t.jsxs(ls,{children:[t.jsx(E,{fontSize:12,children:v.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[w<e.length-1&&t.jsx(Z,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:x||!j,children:f("common.continue")}),w>0&&t.jsx(Z,{disabled:w===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},v.label)})}),o>=e.length-1&&t.jsx(St,{square:!0,elevation:0,sx:{p:3},children:t.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Fn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const Ei=[".zip",".gz"],Mi=1024*1024*100,zi=C.lazy(()=>en(()=>import("./index-BdfFmrlk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function co({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a,locale:c}=Q(),f=C.useRef(null),h=()=>n?!1:!o||o===X.UNOWNED_DID?(W.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,g=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(E,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(ke,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(E,{component:"a",href:`${g}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Z,{variant:"outlined",size:"small",onClick:()=>{var b;h()&&((b=f.current)==null||b.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(C.Suspense,{fallback:t.jsx(Ve,{}),children:t.jsx(zi,{ref:f,locale:c,popup:!0,onUploadFinish:b=>{var p;s({uploadedResource:b.data.filename}),l({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Ei,maxFileSize:Mi,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:i})]})}co.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};co.defaultProps={};function ot({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:l}){var a;const{t:i}=Q();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{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(Y,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:l||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Be,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",re.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,re.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}ot.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};ot.defaultProps={};function Hn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Hn(e[o]);return e}function nt({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:l,readOnly:i}){const a=(o==null?void 0:o.value)||"",[c,f]=C.useState(!1),h=()=>{var q;(q=n[s])==null||q.splice(e,1),r({...n,[s]:[...n[s]]})},g=(q,A)=>{var m;(m=n[s])!=null&&m[e]&&(A?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${ut(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},b=(q,A)=>{var y;const m=((y=n[s][e])==null?void 0:y.value)||"";n[s][e]={...n[s][e],secure:A,value:A&&m===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":m},r({...n,[s]:[...n[s]]})},p=(q,A)=>{n[s][e]={...n[s][e],shared:A},r({...n,[s]:[...n[s]]})},v=(q,A)=>{var y;const m=((y=n[s][e])==null?void 0:y.value)||"";n[s][e]={...n[s][e],required:A,value:A&&m===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":m},r({...n,[s]:[...n[s]]})},w=(q,A)=>{n[s][e]={...n[s][e],value:A?re.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},I=q=>{n[s][e]={...n[s][e],description:q.target.value},r({...n,[s]:[...n[s]]})},j=q=>{const A=q.target.value==="web"?"web":"docker";A==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"});const y=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:A,path:A==="docker"?y:"/",protocol:"http",prefix:A==="docker"?y:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},x=q=>{const A=q.target.value;n[s][e]={...n[s][e],prefix:A,path:A==="*"?"/":A},r({...n,[s]:[...n[s]]})},R=q=>{var A;(A=n[s])!=null&&A[e]&&(n[s][e].value=q.target.value),r({...n,[s]:[...n[s]]})},_=a===`$${ut(o.key)}`||o.custom,D=s==="dockerArgs"&&!ln[o.key],k=qs[o.key],T=s==="dockerEnvs",M=o.key==="--publish";let U=o.key;return M&&o.type==="web"?U="--publish (Web)":T&&(U=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:U})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Y,{disabled:i||_||D||o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:_?`$${ut(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Be,{position:"end",sx:{zoom:.9},children:[(!(k||D)||T||M)&&t.jsx(oe,{onClick:()=>f(!0),children:t.jsx(ne,{icon:"icon-park-outline:setting-config"})}),!i&&t.jsx(oe,{onClick:h,color:D?"error":"default",children:t.jsx(ne,{icon:"ic:round-delete"})})]})},error:D,onChange:R}),D&&t.jsx(E,{variant:"caption",color:"error",children:l("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(E,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&$s[o.key](a)&&t.jsx(E,{variant:"caption",color:"error",children:l("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Tt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:l(T?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[k||D||T?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.needCustomInput")}),t.jsx(ye,{disabled:i,checked:_,onChange:g,sx:{zoom:.9}})]}),T&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.shared")}),t.jsx(ye,{disabled:i,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),T&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.required")}),t.jsx(ye,{disabled:i,checked:o.required,onChange:v,sx:{zoom:.9}})]}),T&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.secure")}),t.jsx(ye,{disabled:i,checked:o.secure,onChange:b,sx:{zoom:.9}})]}),T&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.autoGenerated")}),t.jsx(ye,{disabled:i,checked:o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:w,sx:{zoom:.9}})]}),T&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{sx:{flex:1},children:l("blocklet.publish.docker.description")}),t.jsx(Y,{disabled:i,value:o.description,onChange:I,sx:{flex:1},label:l("blocklet.publish.docker.description")})]}),M&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{sx:{flex:1},children:l("blocklet.publish.docker.portType")}),t.jsxs(Ko,{value:o.type||"docker",onChange:j,children:[t.jsx(ue,{value:"docker",children:"Docker"}),t.jsx(ue,{value:"web",children:"Web"})]})]}),M&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{sx:{flex:1},children:l("blocklet.publish.docker.prefix")}),t.jsx(Y,{disabled:i,value:o.prefix,onChange:x,sx:{flex:1},label:l("blocklet.publish.docker.prefix")})]})]})})]})}nt.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};nt.defaultProps={};const Oi=`
|
|
181
|
+
docker run --name postgrest
|
|
182
|
+
-p 3000:3000
|
|
183
|
+
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
184
|
+
-e PGRST_DB_SCHEMA="public"
|
|
185
|
+
-e PGRST_DB_ANON_ROLE="anon"
|
|
186
|
+
postgrest/postgrest
|
|
187
|
+
`.trim();function ao({readOnly:e,paramsErrTip:o,setParamsErrTip:n,error:r,params:s,setParams:l}){const{t:i}=Q(),[a,c]=C.useState("dockerParams"),[f,h]=C.useState(""),[g,b]=C.useState(!1),[p,v]=C.useState("--volume"),[w,I]=C.useState(""),[j,x]=C.useState(ko(f)),R=j.dockerArgs||[],_=j.dockerEnvs||[],D=j.dockerImage||"",k=j.dockerCommand||"",T=y=>{const{value:P}=y.target;h(P)};C.useEffect(()=>{s.blockletDocker&&s.blockletDocker.dockerImage&&!D&&x(s.blockletDocker)},[s,D,x]);const M=y=>{const P=ko(y.target.value);x(O=>{let V,S=!1;return P.dockerArgs.forEach(L=>{const B=O.dockerArgs.find(F=>F.key===L.key);B&&(Object.entries(B).forEach(([F,G])=>{G!=null&&F!=="value"&&(L[F]=G)}),L.type==="web"&&(L.path="/",L.protocol="http",L.prefix="/",L.name="publicUrl",L.port="BLOCKLET_PORT",S=!0),!V&&L.key==="--publish"&&(V=L))}),!S&&V&&(V.type="web",V.path="/",V.protocol="http",V.prefix="/",V.name="publicUrl",V.port="BLOCKLET_PORT"),P.dockerEnvs.forEach(L=>{const B=O.dockerEnvs.find(F=>F.key===L.key);B&&Object.entries(B).forEach(([F,G])=>{G!=null&&F!=="value"&&(L[F]=G)})}),P})},U=()=>{if(b(!1),p==="--env"){x({...j,dockerEnvs:[..._,{key:w,value:"",custom:"",secure:!1,shared:!1,required:!1,description:w}]}),I("");return}x({...j,dockerArgs:[...R,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},q=()=>{b(!1),I("")},A=y=>{const{value:P}=y.target;x({...j,dockerImage:P}),P.indexOf(" ")>-1?n({...o,dockerImageName:i("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},m=y=>{const{value:P}=y.target;x({...j,dockerCommand:P});try{As(P),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:i("blocklet.publish.docker.dockerCMDError")})}};return C.useEffect(()=>{a==="dockerCommand"&&h(Ns(j))},[j,a]),C.useEffect(()=>{l(y=>({...y,blockletDocker:{dockerImage:j.dockerImage,dockerCommand:j.dockerCommand,dockerArgs:j.dockerArgs,dockerEnvs:j.dockerEnvs}}))},[j,l]),t.jsxs(u,{sx:{mt:3},children:[t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[t.jsx(u,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:t.jsxs(Zo,{value:a,onChange:(y,P)=>c(P),children:[t.jsx(Ze,{value:"dockerParams",label:i("blocklet.publish.docker.dockerParams")}),t.jsx(Ze,{value:"dockerCommand",label:i("blocklet.publish.docker.dockerCommand")})]})}),a==="dockerCommand"&&t.jsx(Y,{disabled:e,label:i("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Oi,InputProps:{"data-cy":"blocklet-docker-command",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:T,onBlur:M}),a==="dockerParams"&&t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx(Y,{disabled:e,label:i("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:D,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:A}),t.jsx(Y,{disabled:e,label:`Docker CMD (${i("common.optional")})`,placeholder:"Docker CMD",value:k,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:m}),t.jsx(u,{sx:{height:4}}),R.map((y,P)=>t.jsx(nt,{index:P,item:y,dockerParams:j,setDockerParams:x,dataKey:"dockerArgs",t:i,readOnly:e},`${y.key}-${P}`)),_.map((y,P)=>t.jsx(nt,{index:P,item:y,dockerParams:j,setDockerParams:x,dataKey:"dockerEnvs",t:i,readOnly:e},`${y.key}-${P}`)),!e&&t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{flex:1}}),t.jsx(Z,{onClick:()=>b(!0),children:i("blocklet.publish.docker.addItem")})]})]})]}),!!r&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:r}),g&&t.jsxs(It,{fullWidth:!0,open:!0,children:[t.jsx(Jo,{children:i("blocklet.publish.docker.addItem")}),t.jsx(Qo,{children:t.jsxs(cs,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[t.jsx(Ko,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:y=>v(y.target.value),children:Object.keys(ln).map(y=>t.jsx(ue,{value:y,children:y}))}),p==="--publish"&&t.jsx(E,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.publishTips")}),p==="--volume"&&t.jsx(E,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.volumeTips")}),p==="--env"&&t.jsxs(u,{sx:{mt:3,width:"100%"},children:[t.jsx(Y,{value:w,onChange:y=>I(y.target.value),sx:{width:"100%"},label:i("blocklet.publish.docker.envKey")}),t.jsx(as,{children:i("blocklet.publish.docker.dockerArgValue")})]})]})}),t.jsxs(Yo,{children:[t.jsx(Z,{onClick:q,children:i("common.cancel")}),t.jsx(Z,{onClick:U,children:i("common.confirm")})]})]})]})}ao.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired,paramsErrTip:d.func.isRequired};ao.defaultProps={};const Bi=({tabs:e,blocklet:o,ancestors:n=[]})=>{const r=o.meta.did;e.push({label:t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:24,blocklet:o,ancestors:n}),t.jsx(u,{ml:"4px",className:"text",children:t.jsx(u,{children:o.meta.title})})]},r),value:r})},zo=(e,o)=>{const n=qt(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(r=>({...r,included:!0})):n.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),n},Vi={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Oo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function uo({initUrl:e,...o}){var po;const{projectId:n,mode:r,releaseId:s,componentDid:l=""}=st(),{t:i}=Q(),{blocklet:a}=_e(),[c,f]=Se({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[h,g]=Se({}),[b,p]=C.useState(!1),[v,w]=Se(null),{api:I}=me(),j=Oe(N=>N.breakpoints.down("md")),[x,R]=C.useState({}),[_,D]=C.useState(!1),k=C.useRef({}),[T,M]=Se({}),[U,q]=C.useState(""),[A,m]=Se({}),y=e==null?void 0:e.searchParams.get("dependentComponentsMode"),P=y==="readonly",O=C.useMemo(()=>{const N={};return Object.keys(A).forEach(z=>{const je=A[z];je&&je.forEach(Xn=>{N[Xn]=!0})}),N},[A]),V=C.useCallback(N=>{P&&f({blockletComponents:[]}),m(N)},[P,m,f]),S=C.useCallback((...N)=>{M(...N),g({blockletResource:"",blockletDocker:""})},[]),L=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[B,F]=C.useState(r==="new-release"?4:0),G=e==null?void 0:e.searchParams.get("resourcesTitle"),ee=e==null?void 0:e.searchParams.get("componentsTitle"),J=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:G||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:ee||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],se=J[B]||J[J.length-1],ie=Vi[B];C.useEffect(()=>{n&&g({projectId:""})},[n,g]);const xe=C.useMemo(()=>{var N;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":(N=c==null?void 0:c.blockletComponents)!=null&&N.some(z=>z.included)||Object.keys(O).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,O,c==null?void 0:c.blockletResourceType]),Pe=[],Le=((a==null?void 0:a.children)||[]).filter(N=>{var z;return(z=N.meta.resource)==null?void 0:z.exportApi}).filter(N=>!l||N.meta.did===l);Le.forEach(N=>{Bi({tabs:Pe,blocklet:N,t:i,ancestors:[a]})});const[qe,te]=C.useState((po=Pe[0])==null?void 0:po.value),ge=!_&&(v==null?void 0:v.status)==="published",$=ge,we=Rs(()=>{if(!e)return;q(e.searchParams.get("logo")),f(z=>{var je;return{...z,blockletTitle:(z==null?void 0:z.blockletTitle)||e.searchParams.get("title"),blockletDescription:(z==null?void 0:z.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(z==null?void 0:z.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(je=z==null?void 0:z.blockletComponents)!=null&&je.length?z==null?void 0:z.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(z==null?void 0:z.note)||e.searchParams.get("note")||"No note"}});const N=e.searchParams.get("resources");try{const z=JSON.parse(N);R(z)}catch{}}),Ce=async()=>{if(L)try{const N=await I.getRelease({input:{did:a.meta.did,projectId:n,releaseId:L}});if(p(!1),!N.release){W.error("Release not found");return}N.release=Hn(N.release),r!=="view"&&(N.release.note=""),f(z=>zo({...z,...N.release,blockletVersion:r==="create"||r==="new-release"?Ie.inc(N.release.blockletVersion,"patch"):N.release.blockletVersion},a)),w(N.release)}catch(N){p(!1),W.error(De(N))}},$e=async()=>{if(n===X.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){W.error(i("blocklet.publish.errorTip.noDid"));return}try{const z=(await fn(I.getProject,[{input:{did:a.meta.did,projectId:n}}],{key:"getProject"})).project||{};z.blockletVersion?(r==="create"||r==="new-release")&&Ie.valid(z.blockletVersion)&&(z.blockletVersion=Ie.inc(z.blockletVersion,"patch")):z.blockletVersion="0.0.1";const je=zo(z,a);f(je),z.lastReleaseId||we()}catch(N){W.error(De(N))}},Re=C.useCallback(async()=>{p(!0);try{if(r==="view"){if(!L){W.error("Empty release id");return}await $e(),await Ce();return}await $e(),L&&(D(!0),await Ce())}finally{p(!1)}},[r,L]),We=N=>{f({blockletComponents:N})},Ue=N=>{f({blockletResourceType:N})};C.useEffect(()=>{Re()},[Re]),C.useEffect(()=>{n===X.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&we()},[n,e,r,we]),C.useEffect(()=>{c.contentType==="docker"?f({resourceFromSelect:!1}):c.contentType==="blocklet"?f({resourceFromSelect:!0}):c.contentType==="upload"&&f({resourceFromSelect:!1})},[c.contentType,f]);const H=C.useMemo(()=>!!Object.keys(T).find(N=>!!T[N].length),[T]);if(!c&&b)return t.jsx(Ve,{});if(!c)return null;const K=Le.find(N=>N.meta.did===qe),Fe=N=>{te(N)};return t.jsxs(Wi,{...o,children:[t.jsx(Bn,{blocklet:a,release:v,getData:Re,getRelease:Ce,mode:r,params:c,setParams:f,setParamsErrTip:g,readOnly:$,isPublished:ge,loading:b,setLoading:p,initLogoUrl:U,releaseId:L,projectId:n,projectType:xe,resourceComponents:Le,resourceComponentsMap:A,resourceRelateComponents:O,resourceItem:K,saveSelectedEventsRef:k,hasSelectedResources:H,releaseUsedLast:_,setReleaseUsedLast:D,setRelease:w,paramsErrTip:h}),t.jsxs(u,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[t.jsx(u,{pt:3}),t.jsxs(u,{sx:{gap:3},display:"flex",flexDirection:j?"column":"row",children:[!j&&t.jsx(Fn,{steps:J,loading:b,viewMode:r==="view",params:c,hasSelectedResources:H||c.uploadedResource,paramsErrTip:h,activeStep:B,setActiveStep:F,projectId:n,resourcesUrlTitle:G,componentsUrlTitle:ee}),t.jsxs(u,{flex:"1",maxWidth:"720px",children:[!j&&ie!=="introduction"&&t.jsxs(E,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[se.label,ie==="branding"&&t.jsx(de,{title:i("blocklet.publish.brandingHelp"),placement:"right",children:t.jsx(u,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:t.jsx(Cs,{})})})]}),(j||ie==="branding")&&t.jsx(u,{flexDirection:"column",children:t.jsx(An,{projectId:n,setParams:f,setParamsErrTip:g,params:c,componentDid:l,blocklet:a,initUrl:e,loading:b,setLoading:p,paramsErrTip:h,readOnly:$,initLogoUrl:U,setInitLogoUrl:q})}),j&&t.jsx(u,{flexDirection:"column",children:t.jsx(ot,{loading:b,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:$})}),(j||ie==="introduction")&&t.jsx(u,{display:"flex",flexDirection:"column",sx:{mt:j?5:0,width:"100%"},children:t.jsx(Wn,{loading:b,readOnly:$,params:c,setParams:f,paramsErrTip:h,setParamsErrTip:g})}),j&&t.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:J[Oo.resources].label}),t.jsx(u,{sx:{maxWidth:720},display:j||ie==="resources"?"flex":"none",flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(ds,{onChange:N=>f({contentType:N.target.value}),children:[t.jsx(Xe,{value:"blocklet",disabled:$,control:t.jsx(dt,{size:"small",checked:c.contentType==="blocklet"}),label:i("blocklet.publish.resourceSelect")}),t.jsx(Xe,{value:"upload",disabled:$,control:t.jsx(dt,{size:"small",checked:c.contentType==="upload"}),label:i("blocklet.publish.resourceUpload")}),t.jsx(Xe,{value:"docker",disabled:$,control:t.jsx(dt,{size:"small",checked:c.contentType==="docker"}),label:i("blocklet.publish.resourceDocker")})]}),t.jsxs(u,{display:c.contentType==="blocklet"?"block":"none",children:[!l&&t.jsx(ks,{tabs:Pe,current:qe,onChange:Fe,sx:{ml:-2,mt:2,maxWidth:j?window.innerWidth-24:"100%"}}),t.jsx(Xt,{loading:b,initialResources:x,saveSelectedEventsRef:k,selectedResourceIds:T,setSelectedResourceIds:S,setResourceComponentsMap:V,error:h.blockletResource,app:a,readOnly:$,component:K,componentDid:l,initUrl:e,params:c,showTree:c.contentType==="blocklet",setParams:f,projectId:n===X.UNOWNED_DID?"":n,releaseUsedLast:_,release:{...v,id:L}})]}),c.contentType==="upload"&&t.jsx(co,{app:a,readOnly:$,projectId:n===X.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g}),c.contentType==="docker"&&t.jsx(ao,{app:a,readOnly:$,projectId:n===X.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g,paramsErrTip:h})]})})}),j&&t.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:J[Oo.blocklets].label}),(j||ie==="blocklets")&&t.jsx(u,{flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsx(u,{sx:{flex:1},children:t.jsx(Wt,{projectType:xe,disabled:b||$,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:We,onChangeBlockletResourceType:Ue,resourceRelateComponents:O,dependentComponentsMode:y})})})}),!j&&ie==="version"&&t.jsx(u,{flexDirection:"column",children:t.jsx(ot,{loading:b,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:$})})]})]})]})]})}uo.propTypes={initUrl:d.object};uo.defaultProps={initUrl:null};const Wi=ae.div`
|
|
188
|
+
.section {
|
|
189
|
+
&.full-width {
|
|
190
|
+
max-width: 100%;
|
|
191
|
+
}
|
|
192
|
+
.MuiTypography-h3 {
|
|
193
|
+
font-size: 1.1rem;
|
|
194
|
+
font-weight: 700;
|
|
195
|
+
}
|
|
196
|
+
.left {
|
|
197
|
+
flex-shrink: 0;
|
|
198
|
+
width: 140px;
|
|
199
|
+
}
|
|
200
|
+
.MuiTabs-indicator {
|
|
201
|
+
display: none;
|
|
202
|
+
}
|
|
203
|
+
.MuiTypography-subtitle1 {
|
|
204
|
+
width: 120px;
|
|
205
|
+
font-weight: 700;
|
|
206
|
+
font-size: 1rem;
|
|
207
|
+
${({theme:e})=>e.breakpoints.down("sm")} {
|
|
208
|
+
width: 80px;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
.MuiButtonBase-root {
|
|
213
|
+
a {
|
|
214
|
+
color: inherit;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
.MuiInputBase-multiline .MuiInputAdornment-positionEnd {
|
|
218
|
+
align-self: flex-end;
|
|
219
|
+
.MuiTypography-root {
|
|
220
|
+
font-size: 0.8rem;
|
|
221
|
+
}
|
|
222
|
+
font-size: 0.8rem;
|
|
223
|
+
}
|
|
224
|
+
`;function Gn({padding:e,initUrl:o}){const{blocklet:n}=_e(),r=Jn(),{componentDid:s}=st();if(C.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(Ui,{style:l,children:t.jsxs(Qn,{children:[t.jsx(at,{path:"/",element:t.jsx(Ot,{initUrl:o})}),t.jsx(at,{path:"/:projectId",element:t.jsx(er,{})}),t.jsx(at,{path:"/:projectId/:mode/:releaseId",element:t.jsx(uo,{initUrl:o})})]})})}Gn.propTypes={padding:d.oneOfType([d.string,d.number]),initUrl:d.object};Gn.defaultProps={padding:"",initUrl:null};const Ui=ae(u)`
|
|
225
|
+
a {
|
|
226
|
+
color: ${({theme:e})=>e.palette.primary.main};
|
|
227
|
+
}
|
|
228
|
+
`;export{Gn as default};
|