@abtnode/blocklet-services 1.16.43-beta-20250420-132156-d732158a → 1.16.43-beta-20250422-042711-c40bec75
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/services/auth/connect/gen-access-key.js +9 -2
- package/api/services/auth/session.js +7 -4
- package/dist/assets/{AdapterDayjs-Bq_2AanQ.js → AdapterDayjs-DcprbhsV.js} +1 -1
- package/dist/assets/{ArrowDropDown-CnO3M65x.js → ArrowDropDown-BHNhtNqo.js} +1 -1
- package/dist/assets/{CheckCircle-vHBx3yBd.js → CheckCircle-C7lAzkFm.js} +1 -1
- package/dist/assets/{ChevronLeft-J2DjxamT.js → ChevronLeft-fcaEvvT2.js} +1 -1
- package/dist/assets/{ChevronRight-CbbryV_W.js → ChevronRight-BWcj-otI.js} +1 -1
- package/dist/assets/{Community-eISlOOkV.js → Community-BXFIKoZW.js} +1 -1
- package/dist/assets/{DeleteOutline-D3rMfe5l.js → DeleteOutline-CMgoFNHT.js} +1 -1
- package/dist/assets/{Done-BKjm-wNl.js → Done-CkkNExgL.js} +1 -1
- package/dist/assets/{Download-dWBmoIIz.js → Download-B1KcU2Zd.js} +1 -1
- package/dist/assets/{Edit-BsIdXKZ9.js → Edit-C-ChSGAK.js} +1 -1
- package/dist/assets/{EditIcon-CQgpOLLT.js → EditIcon-BRKobKzh.js} +1 -1
- package/dist/assets/{Email-BWTg6iJI.js → Email-7cDhevM1.js} +1 -1
- package/dist/assets/{Error-BhDI-TWw.js → Error-Du9QXuYs.js} +1 -1
- package/dist/assets/{ExpandLess-ap4H2881.js → ExpandLess-Cdn0T-U2.js} +1 -1
- package/dist/assets/{Google-yY5m8tgo.js → Google-3Ox3gIL3.js} +1 -1
- package/dist/assets/{Holiday-C3bRTVlx.js → Holiday-BtexoPxk.js} +1 -1
- package/dist/assets/{InfoOutlined-xdatqyfu.js → InfoOutlined-ZIQMeu0p.js} +1 -1
- package/dist/assets/{Launch-C6_9RwNa.js → Launch-qJWNGQwX.js} +1 -1
- package/dist/assets/{LaunchOutlined-CG63jbPx.js → LaunchOutlined-BVUDVgft.js} +1 -1
- package/dist/assets/LoadingButton-D_tuQuaP.js +1 -0
- package/dist/assets/{Location-C_mUMqZP.js → Location-BF9BwrVf.js} +1 -1
- package/dist/assets/{LockIcon-G8zLxYzV.js → LockIcon-L5QI4AoC.js} +1 -1
- package/dist/assets/{Meeting-vvmUKHs1.js → Meeting-gc3Ts6jN.js} +1 -1
- package/dist/assets/{MoreHoriz-ylsvAqcI.js → MoreHoriz-ByNTWUxY.js} +1 -1
- package/dist/assets/{OffSick-BTxtVws3.js → OffSick-_EZgqU01.js} +1 -1
- package/dist/assets/{Phone-Cz_yY8ed.js → Phone-oJLFEdfI.js} +1 -1
- package/dist/assets/{PlayArrow-B-b0Dvp8.js → PlayArrow-rSzT1Thf.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-DeAbZuzW.js → QuestionMarkCircle-Cw7EtCDd.js} +1 -1
- package/dist/assets/{ServerLogo-UZVUmHWK.js → ServerLogo-zdbLsMaw.js} +1 -1
- package/dist/assets/{Timezone-5RxC7sK-.js → Timezone-BtCtoEo9.js} +1 -1
- package/dist/assets/{TuneOutlined-DJ2Nw9gU.js → TuneOutlined-BnxAi8kP.js} +1 -1
- package/dist/assets/{ViewList-DYqpQSjn.js → ViewList-DbzNMeex.js} +1 -1
- package/dist/assets/{WorkingRemotely-_QD8QN72.js → WorkingRemotely-YBya8rZT.js} +1 -1
- package/dist/assets/{access-control-DcIGjdcM.js → access-control-q2DA79L8.js} +1 -1
- package/dist/assets/actions-J8MFA_6y.js +1 -0
- package/dist/assets/{add-component-core-BpT5fbHq.js → add-component-core-IYRc9eac.js} +24 -24
- package/dist/assets/{add-resource-BVgzn5lM.js → add-resource-8w2aCwfA.js} +1 -1
- package/dist/assets/{addon-DXuj5GtV.js → addon-BQEpbqTR.js} +1 -1
- package/dist/assets/{advanced-CIJNFJAE.js → advanced-CX8tZItX.js} +1 -1
- package/dist/assets/api-BrU7j0QA.js +1 -0
- package/dist/assets/{appearance-CCLVRyLq.js → appearance-C5895lZP.js} +1 -1
- package/dist/assets/{audit-logs-brXiMrw_.js → audit-logs-DukS3LSM.js} +3 -3
- package/dist/assets/authorize-CEHLfOxJ.js +1 -0
- package/dist/assets/{base32-Dd6rPCV6.js → base32--dljmFCF.js} +1 -1
- package/dist/assets/{branding-31ZnkyoG.js → branding-Abk6CVlX.js} +1 -1
- package/dist/assets/branding-Cczews7F.js +40 -0
- package/dist/assets/bundle-avatar-DFwyxj9P.js +1 -0
- package/dist/assets/button-CJk6Iiza.js +1 -0
- package/dist/assets/click-to-copy-CbKZyfyr.js +1 -0
- package/dist/assets/cloneDeep-SfcdeqEN.js +1 -0
- package/dist/assets/{complete-Cpcoq6Ge.js → complete-ejUOC1cY.js} +2 -2
- package/dist/assets/{component-Djsamap6.js → component-BOLQzzEI.js} +2 -2
- package/dist/assets/{config-BK2qWQnO.js → config-Bv0DcfgY.js} +2 -2
- package/dist/assets/{config-BQ9p6EgE.js → config-efFznM9P.js} +1 -1
- package/dist/assets/{config-navigation-D2PpiTzz.js → config-navigation-1cuUaRsL.js} +6 -6
- package/dist/assets/{config-space-BFcXXNuJ.js → config-space-DEku2tJv.js} +1 -1
- package/dist/assets/confirm-miQS3Z1c.js +7 -0
- package/dist/assets/connect-0B3z_kZV.js +5 -0
- package/dist/assets/{connect-rWOVXBvz.js → connect-OYujfpaQ.js} +1 -1
- package/dist/assets/connect-to-C-vFK0ym.js +1 -0
- package/dist/assets/{content-layout-Cg5RRv1R.js → content-layout-JixQ7owc.js} +1 -1
- package/dist/assets/dashboard-C9tAGBV0.js +280 -0
- package/dist/assets/{delete-confirm-B2Ye1_SC.js → delete-confirm-kKb8VxbQ.js} +1 -1
- package/dist/assets/{did-address-gmPYOGuy.js → did-address-DNf_-NM-.js} +1 -1
- package/dist/assets/domain-RAN90v9n.js +9 -0
- package/dist/assets/domain-action-card-BNybk5kq.js +25 -0
- package/dist/assets/domains-B51g2OQM.js +1 -0
- package/dist/assets/dot-xwsgXXMo.js +7 -0
- package/dist/assets/{email-BAajjNQV.js → email-CBFKGDtB.js} +3 -3
- package/dist/assets/{empty-spinner-yzHJfTIe.js → empty-spinner-Rr_2DR73.js} +1 -1
- package/dist/assets/{exchange-passport-EldPKAEU.js → exchange-passport-2U7cUaM-.js} +1 -1
- package/dist/assets/{format-error-LAoTjvJe.js → format-error-BrmqJs5a.js} +1 -1
- package/dist/assets/{fuel-g6aTZdFA.js → fuel-Ctl6kh4M.js} +1 -1
- package/dist/assets/{gen-access-key-CXCl8SEM.js → gen-access-key-CIrRotRy.js} +2 -2
- package/dist/assets/{get-safe-url-BpQyWsMx.js → get-safe-url-BXaepgsm.js} +1 -1
- package/dist/assets/{get-safe-url-DGJYpGp-.js → get-safe-url-MZ-ksvtD.js} +1 -1
- package/dist/assets/{home-DBeMBDeM.js → home-C2Bgs4zS.js} +1 -1
- package/dist/assets/{iframe-DTWkOiY8.js → iframe-oHkt22fl.js} +1 -1
- package/dist/assets/{index-Bh63LaOx.js → index-51ncOoae.js} +2 -2
- package/dist/assets/{index-BY0gjHeR.js → index-B1-S-x6B.js} +32 -32
- package/dist/assets/{index-D7Oq5q89.js → index-B1EwWGHW.js} +4 -4
- package/dist/assets/index-B1ljmpu4.css +1 -0
- package/dist/assets/{index-C9TPKuLt.js → index-BRXM9-_y.js} +1 -1
- package/dist/assets/{index-C8lvmI4i.js → index-BT3gX_Gs.js} +1 -1
- package/dist/assets/{index-Cg_v1vT_.js → index-BWx6ivvZ.js} +650 -55
- package/dist/assets/{index-lk2RMFv-.js → index-BaU0U5xc.js} +10 -10
- package/dist/assets/index-BiIKWZTs.js +113 -0
- package/dist/assets/{index-B0Z8409R.js → index-C3XAI9I7.js} +1 -1
- package/dist/assets/{index-C6wFIF6L.js → index-C7UL-KG1.js} +2 -2
- package/dist/assets/{index-BGnWzg98.js → index-CILVFQJH.js} +4 -4
- package/dist/assets/{index-B1r8E4TH.js → index-CNpN35y4.js} +1 -1
- package/dist/assets/{index-pV_0wOyY.js → index-CPE8Apzb.js} +1 -1
- package/dist/assets/{index-haYY8BAk.js → index-CYeIiQ6Q.js} +1 -1
- package/dist/assets/index-CzzLOOSx.js +55 -0
- package/dist/assets/{index-BkHi7e8i.js → index-DGPhY8xp.js} +2 -2
- package/dist/assets/{index-DhAVA9HZ.js → index-DHdYd4nT.js} +3 -3
- package/dist/assets/index-DHjPgdgK.js +1 -0
- package/dist/assets/{index-CEMXycV7.js → index-DQc29-JM.js} +1 -1
- package/dist/assets/{index-tUQxVYYQ.js → index-DVQCgvFb.js} +1 -1
- package/dist/assets/{index-CgtY16Wm.js → index-DhGZEbPZ.js} +1 -1
- package/dist/assets/index-Ds7z-vG7.js +10 -0
- package/dist/assets/{index-BfbxxLBr.js → index-GJgyTjK2.js} +9 -9
- package/dist/assets/{index-Xi3jaVFs.js → index-Hl4sXXdc.js} +1 -1
- package/dist/assets/{index-BjmnM2sd.js → index-ILkKQT7G.js} +1 -1
- package/dist/assets/{index-kqlC8JFQ.js → index-YbJjfDTR.js} +1 -1
- package/dist/assets/{index-KWGv7rf_.js → index-qcSTfn8X.js} +2 -2
- package/dist/assets/{invitation-DnZ_Ex8p.js → invitation-CPSru_8S.js} +5 -5
- package/dist/assets/invite-DquuAqEb.js +1 -0
- package/dist/assets/issue-passport-DW27M9Fi.js +1 -0
- package/dist/assets/{item-VCJ7-Z3r.js → item-CdEFLc19.js} +1 -1
- package/dist/assets/{landing-page-QhzHIr--.js → landing-page-DPD1zNWJ.js} +1 -1
- package/dist/assets/{launch-result-message-Ckk5lRW7.js → launch-result-message-yorrVgpQ.js} +1 -1
- package/dist/assets/{layout-0YBKzIlI.js → layout-DBsOgAhr.js} +1 -1
- package/dist/assets/{list-Dw9DDKoC.js → list-BNd4p4TF.js} +9 -8
- package/dist/assets/{list-header-BYlc5SI1.js → list-header-BTUducS9.js} +1 -1
- package/dist/assets/localization-CS7BsCef.js +1 -0
- package/dist/assets/{log-BLTzXOlE.js → log-R8TIkchf.js} +1 -1
- package/dist/assets/logger-d2Lh_KCF.js +1 -0
- package/dist/assets/{login-tmff27IK.js → login-Dgvm6HMJ.js} +1 -1
- package/dist/assets/{login-oauth-callback-DnYvzeVx.js → login-oauth-callback-rmUYgE44.js} +1 -1
- package/dist/assets/logo-uploader-Bv2ZSxJV.js +133 -0
- package/dist/assets/{lost-passport-DiKkPtUB.js → lost-passport-CiVM9B2L.js} +4 -4
- package/dist/assets/{lottie-react.esm-CPHH620R.js → lottie-react.esm-D2t-u0YU.js} +1 -1
- package/dist/assets/{lottie-web-B6s7dDoL.js → lottie-web-jYmAQWuC.js} +1 -1
- package/dist/assets/omit-bLid3PKQ.js +1 -0
- package/dist/assets/{open-window-DjL5TW3X.js → open-window-D2wkW326.js} +1 -1
- package/dist/assets/{overview-zOWtcWbm.js → overview-C_fDcPQA.js} +2 -2
- package/dist/assets/{page-header-BhpaMk9g.js → page-header-C86YQnHE.js} +1 -1
- package/dist/assets/{passport-item-Cxkhzo-W.js → passport-item-C4X2VZeo.js} +1 -1
- package/dist/assets/{permission-_ttLx53e.js → permission-CbDCh9eS.js} +1 -1
- package/dist/assets/preferences-Cdzon7pe.js +1 -0
- package/dist/assets/profile-embed-Dr2ZxkvM.js +1 -0
- package/dist/assets/publish-resource-DumHfLtC.js +1 -0
- package/dist/assets/{raf-schd.esm-GV-XhwE0.js → raf-schd.esm-B3j6BePR.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-gUY08qHq.js → react-beautiful-dnd.esm-kcYalw4r.js} +1 -1
- package/dist/assets/{relative-time-DYjTOclf.js → relative-time-Dkz5qmEb.js} +1 -1
- package/dist/assets/runtime-HBzWjxDb.js +1 -0
- package/dist/assets/sdk-DuZx5LYY.js +1 -0
- package/dist/assets/{security-BD2-azah.js → security-BFBpBlQy.js} +4 -4
- package/dist/assets/session-CdQbSkeB.js +1 -0
- package/dist/assets/setup-BSfklNq4.js +19 -0
- package/dist/assets/{shorten-label-8jfEkawx.js → shorten-label-Dz7RgJfj.js} +1 -1
- package/dist/assets/{simple-select-CNZc1N7Q.js → simple-select-BlUQXxNL.js} +1 -1
- package/dist/assets/{slicedToArray-gyBkcGHe.js → slicedToArray-lOWXD6Th.js} +1 -1
- package/dist/assets/{spaces-B_YG3iE7.js → spaces-CcTi9vap.js} +1 -1
- package/dist/assets/{start-DIhK4VNY.js → start-BitVK7fH.js} +1 -1
- package/dist/assets/{status-CQCKGmiV.js → status-F7OR8ZWk.js} +1 -1
- package/dist/assets/{step-actions-DGcZdY1e.js → step-actions-Cmh5n2jE.js} +1 -1
- package/dist/assets/{studio-CC8lU96f.js → studio-CW2bLcBh.js} +1 -1
- package/dist/assets/{switch-control-BWuo2NQH.js → switch-control-BjOmRKBW.js} +1 -1
- package/dist/assets/{traffic-BIz-TYy2.js → traffic-CcfffSvS.js} +2 -2
- package/dist/assets/{transfer-OroSS_fF.js → transfer-DHcMO-R4.js} +1 -1
- package/dist/assets/{unsubscribe-cKpP6HeV.js → unsubscribe-DnPmucfC.js} +1 -1
- package/dist/assets/{use-app-logo-C5KrAQp3.js → use-app-logo-DnfizCGM.js} +1 -1
- package/dist/assets/{use-mobile-BbxjRR_q.js → use-mobile-Bgy7gTTP.js} +1 -1
- package/dist/assets/{use-mobile-T-9_nK_m.js → use-mobile-CcdVxg80.js} +1 -1
- package/dist/assets/useAsync-70zHrUMr.js +1 -0
- package/dist/assets/useAsync-BquSRC77.js +1 -0
- package/dist/assets/{useLocalStorage-BTc2ONSy.js → useLocalStorage-BJb7uGDO.js} +1 -1
- package/dist/assets/{useSetState-BL3ktMon.js → useSetState-CWq0AVWn.js} +1 -1
- package/dist/assets/user-center-u43jJYr4.js +77 -0
- package/dist/assets/{util-DA84MxE0.js → util-BYLEVYA_.js} +1 -1
- package/dist/assets/{util-Dvapjz4O.js → util-CJbxj6IE.js} +1 -1
- package/dist/assets/{vendor-arcblock-Dd-d3bxC.js → vendor-arcblock-CWji6U03.js} +300 -300
- package/dist/assets/{vendor-hooks-jg6xPUPF.js → vendor-hooks-DftG_2gV.js} +2 -2
- package/dist/assets/{vendor-mui-core-DiDsSLd-.js → vendor-mui-core-CfA4EdRA.js} +26 -26
- package/dist/assets/{vendor-mui-x-mVhD3N7n.js → vendor-mui-x-DSNWmGVo.js} +1 -1
- package/dist/assets/{vendor-react-DoD83n6N.js → vendor-react-DEoibe3W.js} +1 -1
- package/dist/assets/vendor-utils-BNHJB5U7.js +208 -0
- package/dist/assets/vendor-ux-did-connect-zBIy2ulO.js +2265 -0
- package/dist/assets/{wrap-locale-CyEJqSC4.js → wrap-locale-BSYWBgCo.js} +1 -1
- package/dist/assets/zh-_GYrLCB8.js +1 -0
- package/dist/index.html +9 -8
- package/dist/service-worker.js +1 -1
- package/package.json +30 -29
- package/dist/assets/actions-54wIQrhQ.js +0 -1
- package/dist/assets/api-DwjKcjK8.js +0 -1
- package/dist/assets/authorize-DVVvHvmA.js +0 -1
- package/dist/assets/branding-CY0aknSo.js +0 -40
- package/dist/assets/bundle-avatar-BcZExfqu.js +0 -1
- package/dist/assets/button-Cfb46ee0.js +0 -1
- package/dist/assets/click-to-copy-D4Cmyemb.js +0 -1
- package/dist/assets/cloneDeep-DUYD8ZBI.js +0 -1
- package/dist/assets/confirm-Bi4_XwxH.js +0 -7
- package/dist/assets/connect-Bzett2rh.js +0 -5
- package/dist/assets/connect-to-nP4HS-Z0.js +0 -1
- package/dist/assets/dashboard-27JnEnGY.js +0 -279
- package/dist/assets/domain-5-nsJfDM.js +0 -9
- package/dist/assets/domain-action-card-DrjkSQwC.js +0 -25
- package/dist/assets/domains-CD91MGQk.js +0 -1
- package/dist/assets/dot-BBxUn__M.js +0 -7
- package/dist/assets/index-B-h0rpyF.js +0 -10
- package/dist/assets/index-BeXUaMlG.js +0 -55
- package/dist/assets/index-Ca99ESdg.js +0 -1
- package/dist/assets/index-o53rWfYr.js +0 -113
- package/dist/assets/invite-BC0OYJxG.js +0 -1
- package/dist/assets/issue-passport-CD5ylk7Y.js +0 -1
- package/dist/assets/localization-Bqeaav45.js +0 -1
- package/dist/assets/logger-DzZIANXq.js +0 -1
- package/dist/assets/logo-uploader-BKxncdN2.js +0 -133
- package/dist/assets/omit-B1LDXfkq.js +0 -1
- package/dist/assets/preferences-C0eu3vgg.js +0 -1
- package/dist/assets/profile-embed-DfDaKcjJ.js +0 -1
- package/dist/assets/publish-resource-BEIDgQwd.js +0 -1
- package/dist/assets/runtime-B8E7DTqn.js +0 -1
- package/dist/assets/sdk-K0wUtuBQ.js +0 -1
- package/dist/assets/session-BPop7wxF.js +0 -1
- package/dist/assets/setup-DW_rcwsG.js +0 -19
- package/dist/assets/useAsync-B_98ShEr.js +0 -1
- package/dist/assets/user-center-DGFt0-Nt.js +0 -77
- package/dist/assets/vendor-utils-DMClavLd.js +0 -11
- package/dist/assets/vendor-ux-did-connect-qEfzi7sf.js +0 -1832
- package/dist/assets/zh-yJzqRkfw.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./vendor-react-DoD83n6N.js";import{a8 as ke,j as e,v as Le,aa as c,bl as wo,H as i,ab as me,I as ce,T as L,c0 as So,D as ot,ag as ge,au as ws,bO as Ge,aj as Io,bs as Xe,bw as ht,y as ne,a9 as Ye,P as Do,G as To,w as jt,a6 as _o,M as Po,q as fe,X as Ss,ai as $o,t as qo,bR as Is,N as Ve,z as Lo,O as se,ak as Se,av as Ds,L as Ts,A as _s,b5 as Ps,U as Ao,W as Qe,bB as $s,bC as qs,c1 as Ls,c2 as As,bn as ft,bo as Ns,bq as Es,bu as zs,bv as at}from"./vendor-mui-core-DiDsSLd-.js";import{z as ye,C as Ee,aa as Bs,a2 as Os,f as ro,ab as lo}from"./index-Cg_v1vT_.js";import{r as Re,p as Y,u as oe,bs as No,l as Ws,B as Me,b5 as Eo,V as zo,b3 as Bo,an as Ms,bt as Vs,a5 as kt,Y as U,a1 as Us,h as ae,bu as Fs,b8 as Hs,g as qe,al as yt,ar as Js}from"./vendor-ux-did-connect-qEfzi7sf.js";import{B as Rt,c as ue,l as Gs,I as Xs,_ as Oo,J as De,p as Ys}from"./vendor-arcblock-Dd-d3bxC.js";import{d as Qs}from"./Error-BhDI-TWw.js";import{C as vt}from"./confirm-Bi4_XwxH.js";import{u as Ue}from"./session-BPop7wxF.js";import{W as io}from"./did-address-gmPYOGuy.js";import{E as Fe}from"./empty-spinner-yzHJfTIe.js";import{B as Ct}from"./bundle-avatar-BcZExfqu.js";import{S as je}from"./shorten-label-8jfEkawx.js";import{L as wt}from"./list-header-BYlc5SI1.js";import{Z as Zs,y as be,I as St,D as Wo}from"./vendor-utils-DMClavLd.js";import{d as Ks}from"./Download-dWBmoIIz.js";import{C as Mo}from"./click-to-copy-D4Cmyemb.js";import{Q as en}from"./QuestionMarkCircle-DeAbZuzW.js";import{u as tn}from"./vendor-hooks-jg6xPUPF.js";import{_ as Ie}from"./useSetState-BL3ktMon.js";import{c as It}from"./index-tUQxVYYQ.js";import{E as Dt}from"./index-B0Z8409R.js";import"./api-DwjKcjK8.js";import{d as on}from"./ChevronRight-CbbryV_W.js";import{T as sn,a as nn}from"./vendor-mui-x-mVhD3N7n.js";import{d as co}from"./DeleteOutline-D3rMfe5l.js";import{D as ao,C as uo,P as po}from"./react-beautiful-dnd.esm-gUY08qHq.js";import{c as rn,A as Vo,u as ln,S as cn,U as an,a as dt,b as Uo,n as dn,e as un,f as ho,g as pn,h as hn}from"./item-VCJ7-Z3r.js";import{d as fn}from"./ArrowDropDown-CnO3M65x.js";import{f as Ae}from"./format-error-LAoTjvJe.js";import{d as bn}from"./Launch-C6_9RwNa.js";import{M as xn}from"./index-CEMXycV7.js";import{r as mn}from"./index-BjmnM2sd.js";import{d as gn}from"./Done-BKjm-wNl.js";import"./lottie-web-B6s7dDoL.js";import"./raf-schd.esm-GV-XhwE0.js";import"./delete-confirm-B2Ye1_SC.js";import"./get-safe-url-DGJYpGp-.js";var Tt={},jn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Fo=Tt.default=void 0,kn=jn(Re()),yn=e;Fo=Tt.default=(0,kn.default)((0,yn.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 _t={},Rn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Ho=_t.default=void 0,vn=Rn(Re()),Cn=e;Ho=_t.default=(0,vn.default)((0,Cn.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 Pt={},wn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Jo=Pt.default=void 0,Sn=wn(Re()),In=e;Jo=Pt.default=(0,Sn.default)((0,In.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 $t({did:t,projectId:o,title:s,logo:r,describe:l}){const n=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,d]=j.useState(!1),f=Le(x=>x.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),children:[e.jsx(wo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:l||"/"})]})]})}$t.propTypes={projectId:i.string.isRequired,did:i.string.isRequired,title:i.string.isRequired,logo:i.string.isRequired,describe:i.string.isRequired};function qt({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:r,locale:l}=oe(),{api:a}=ye(),{api:n}=Ue(),[u,d]=j.useState(!0),{blocklet:f}=Ee(),[x,S]=j.useState(null),[C,p]=j.useState(!1),h=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:w=""}=tt(),[k,I]=j.useState(null),v=`publish-${f.meta.did}`,D=No(v),[_,q]=j.useState({searchText:D.searchText||"",pageSize:D.rowsPerPage||10,page:1}),E=()=>{a.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:s}}).then(g=>{const A=(g==null?void 0:g.projects)||[];d(!1),I(A)}).catch(g=>{d(!1),U.error(g.message)})},M=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},$=g=>{S(g)},Q=()=>{d(!1),p(!0)},O=()=>{p(!1),S(null)},m=g=>{U.error(g.message),p(!1),S(null)},b=g=>{if(!(g!=null&&g.deleted)){U.error("Delete project failed");return}E(),p(!1),S(null)};j.useEffect(()=>{E()},[]);const y=j.useMemo(()=>{var A;if(!_.searchText)return k;let g=(A=_.searchText)==null?void 0:A.trim();return g?(g=Ws.toAddress(g).toLocaleLowerCase(),k.filter(H=>H.blockletTitle.toLowerCase().includes(g)||H.blockletDid.toLowerCase().includes(g))):k},[k,_.searchText]);if(!k&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!k)return null;if(!k.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Me,{onClick:M,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const A=k[g];return e.jsx(xe,{to:`${A.id}`,children:e.jsx($t,{did:f.meta.did,projectId:A.id,logo:A.blockletLogo,title:A.blockletTitle,describe:A.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Eo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},h||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},h||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const A=(f.children||[]).find(H=>H.meta.did===g);return A?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:A,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:A.meta.title})]},g):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(zo,{value:Number(g),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const A=k[g];return e.jsxs(c,{display:"flex",children:[e.jsx(xe,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(me,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Fo,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(me,{title:r("blocklet.publish.viewLastRelease",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(xe,{style:{display:"flex"},to:`${A.id}/view/${A.lastReleaseId}`,children:e.jsx(Ho,{sx:{fontSize:18}})})})}),e.jsx(me,{title:r("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>$(A),children:e.jsx(Bo,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),z=({page:g,rowsPerPage:A,searchText:H})=>{_.pageSize!==A?q(J=>({...J,searchText:"",pageSize:A,page:1})):_.page!==g+1?q(J=>({...J,searchText:"",page:g+1})):_.searchText!==H&&q(J=>({...J,searchText:H,page:1}))},G=C?e.jsx(Ms,{open:!0,popup:!0,onClose:O,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:b,onError:m,extraParams:{projectId:x.id,did:f.meta.did,name:x.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(me,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Jo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Vs,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:_.searchText,searchText:_.searchText,searchTextUpdate:g=>q(A=>({...A,searchText:g})),searchClose:()=>q(g=>({...g,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Me,{onClick:M,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:y,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:v,onChange:z}),x&&e.jsx(vt,{title:`${r("common.delete")} ${x.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:Q,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Qs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),G]})}qt.propTypes={initUrl:i.object};qt.defaultProps={initUrl:null};var Lt={},Dn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Go=Lt.default=void 0,Tn=Dn(Re()),fo=e;Go=Lt.default=(0,Tn.default)([(0,fo.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,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const _n=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Xo=_n;function Pn(){var m;const{t,locale:o}=oe(),{projectId:s}=tt(),{api:r}=ye(),[l,a]=j.useState(!0),{blocklet:n}=Ee(),u=Le(b=>b.breakpoints.down("md")),[d,f]=j.useState(null),[x,S]=j.useState(null),[C,p]=j.useState(null),h=(m=window.env)==null?void 0:m.serverEndpoint,R=`releases-${n.meta.did}-${s}`,w=No(R),[k,I]=j.useState({searchText:w.searchText||"",pageSize:w.rowsPerPage||10,page:1}),v=()=>{r.getReleases({input:{did:n.meta.did,projectId:s}}).then(b=>{const y=(b==null?void 0:b.releases)||[];a(!1),f(y)}).catch(b=>{a(!1),U.error(b.message)})},D=()=>{r.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(b=>{S(b.getProject.project||{}),f(b.getReleases.releases||[]),a(!1)}).catch(b=>{a(!1),U.error(b.message)})};j.useEffect(()=>{D()},[]);const[_,q]=j.useState(""),E=()=>{a(!1);const b=C.id;r.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:b}}).then(()=>{a(!1),v(),U.success(t("common.removeSuccess")),p(null)}).catch(y=>{a(!1),U.error(y.message)})},M=b=>{p(b)};if(!d&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!d)return null;const $=e.jsxs(So,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"..",children:t("common.blockletStudio")}),e.jsx(L,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:x.blockletTitle})})]});if(!d.length)return e.jsxs(e.Fragment,{children:[$,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(xe,{to:"create/none",children:e.jsx(Me,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Q=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:b=>{const y=d[b];return e.jsx(xe,{to:`view/${y.id}`,children:e.jsx($t,{did:n.meta.did,projectId:x.id,logo:y.blockletLogo,title:y.blockletVersion,describe:y.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:b=>{const y=d[b];return e.jsx(L,{className:"note",children:Xo(y.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:b=>e.jsx(Eo,{type:b==="published"?"success":"warning",children:b==="published"?"Released":Zs(b)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:b=>{const y=d[b];return y.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(zo,{value:Number(y.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:b=>{var A;const y=d[b];let W="",z="";const G=y.status==="published";if(G){const H=be(h,`/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/release/blocklet.json`),J=new URL(h);J.pathname=be(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",H),W=J.href,z=be(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/download/${(x.lastReleaseFiles||[])[0]}`)}const g=(A=x.blockletComponents)!=null&&A.some(H=>H.included)||y.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[G&&g==="pack"&&e.jsx(me,{title:t("blocklet.publish.install",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:W,target:"_blank",rel:"noreferrer",children:e.jsx(Go,{sx:{fontSize:18}})})})}),G&&e.jsx(me,{title:t("blocklet.publish.download",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:z,children:e.jsx(Ks,{sx:{fontSize:18}})})})}),e.jsx(me,{title:t("blocklet.publish.delete",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>M(y),children:e.jsx(Bo,{sx:{fontSize:18}})})})]})}}}],O=({page:b,rowsPerPage:y,searchText:W})=>{k.pageSize!==y?I(z=>({...z,searchText:"",pageSize:y,page:1})):k.page!==b+1?I(z=>({...z,searchText:"",page:b+1})):k.searchText!==W&&I(z=>({...z,searchText:W,page:1}))};return e.jsxs($n,{children:[e.jsx(wt,{sx:{mb:2},left:$,actions:e.jsxs(e.Fragment,{children:[e.jsx(Me,{variant:"outlined",onClick:()=>{const b=be(h,`/api/project/${n.meta.did}/${s}/blocklet.json`);q(b)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(xe,{to:"new-release/none",children:e.jsxs(Me,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:_,onClose:()=>q(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Mo,{children:_}),e.jsxs(L,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:d,columns:Q,durable:R,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:O}),C&&e.jsx(vt,{title:t(`${t("common.delete")} ${C.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:E,onCancel:()=>p(null)})]})}const $n=ge(c)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DHdYd4nT.js","assets/vendor-ux-did-connect-zBIy2ulO.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BNHJB5U7.js","assets/vendor-mui-core-CfA4EdRA.js","assets/vendor-hooks-DftG_2gV.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-CWji6U03.js","assets/index-YbJjfDTR.js","assets/index-BWx6ivvZ.js","assets/index-B1ljmpu4.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as j,f as gt,l as tt,L as xe,g as Rs,u as vs,i as Cs,j as ct}from"./vendor-react-DEoibe3W.js";import{a8 as ke,j as e,v as Le,a9 as c,bc as wo,H as i,ac as me,I as ce,T as L,c4 as So,D as ot,ag as ge,at as ws,bS as Je,aj as Io,bs as Xe,bw as ht,y as ne,aa as Ye,P as Do,G as To,w as jt,a6 as _o,M as Po,q as fe,X as Ss,ai as $o,t as qo,bV as Is,N as Ve,z as Lo,O as se,ak as Se,as as Ds,L as Ts,A as _s,b5 as Ps,U as Ao,W as Qe,bF as $s,bG as qs,c5 as Ls,c6 as As,bn as ft,bo as Ns,bq as Es,bu as zs,bv as at}from"./vendor-mui-core-CfA4EdRA.js";import{z as ye,C as Ee,af as Bs,a7 as Os,f as ro,ag as lo}from"./index-BWx6ivvZ.js";import{r as Re,j as Y,u as oe,bt as No,f as Ws,B as Me,b6 as Eo,V as zo,b4 as Bo,an as Ms,bu as Vs,a5 as kt,Y as U,a1 as Us,I as ae,bv as Fs,b9 as Hs,a as qe,al as yt,ar as Gs}from"./vendor-ux-did-connect-zBIy2ulO.js";import{K as Rt,c as ue,q as Js,P as Xs,_ as Oo,Q as De,p as Ys}from"./vendor-arcblock-CWji6U03.js";import{d as Qs}from"./Error-Du9QXuYs.js";import{C as vt}from"./confirm-miQS3Z1c.js";import{u as Ue}from"./session-CdQbSkeB.js";import{W as io}from"./did-address-DNf_-NM-.js";import{E as Fe}from"./empty-spinner-Rr_2DR73.js";import{B as Ct}from"./bundle-avatar-DFwyxj9P.js";import{S as je}from"./shorten-label-Dz7RgJfj.js";import{L as wt}from"./list-header-BTUducS9.js";import{Z as Zs,y as be,I as St,D as Wo}from"./vendor-utils-BNHJB5U7.js";import{d as Ks}from"./Download-B1KcU2Zd.js";import{C as Mo}from"./click-to-copy-CbKZyfyr.js";import{Q as en}from"./QuestionMarkCircle-Cw7EtCDd.js";import{u as tn}from"./vendor-hooks-DftG_2gV.js";import{_ as Ie}from"./useSetState-CWq0AVWn.js";import{c as It}from"./index-DVQCgvFb.js";import{E as Dt}from"./index-C3XAI9I7.js";import"./api-BrU7j0QA.js";import{d as on}from"./ChevronRight-BWcj-otI.js";import{T as sn,a as nn}from"./vendor-mui-x-DSNWmGVo.js";import{d as co}from"./DeleteOutline-CMgoFNHT.js";import{D as ao,C as uo,P as po}from"./react-beautiful-dnd.esm-kcYalw4r.js";import{c as rn,A as Vo,u as ln,S as cn,U as an,a as dt,b as Uo,n as dn,e as un,f as ho,g as pn,h as hn}from"./item-CdEFLc19.js";import{d as fn}from"./ArrowDropDown-BHNhtNqo.js";import{f as Ae}from"./format-error-BrmqJs5a.js";import{d as bn}from"./Launch-qJWNGQwX.js";import{M as xn}from"./index-DQc29-JM.js";import{r as mn}from"./index-ILkKQT7G.js";import{d as gn}from"./Done-CkkNExgL.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";import"./delete-confirm-kKb8VxbQ.js";import"./get-safe-url-MZ-ksvtD.js";var Tt={},jn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Fo=Tt.default=void 0,kn=jn(Re()),yn=e;Fo=Tt.default=(0,kn.default)((0,yn.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 _t={},Rn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Ho=_t.default=void 0,vn=Rn(Re()),Cn=e;Ho=_t.default=(0,vn.default)((0,Cn.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 Pt={},wn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Go=Pt.default=void 0,Sn=wn(Re()),In=e;Go=Pt.default=(0,Sn.default)((0,In.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 $t({did:t,projectId:o,title:s,logo:r,describe:l}){const n=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,d]=j.useState(!1),f=Le(x=>x.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),children:[e.jsx(wo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:l||"/"})]})]})}$t.propTypes={projectId:i.string.isRequired,did:i.string.isRequired,title:i.string.isRequired,logo:i.string.isRequired,describe:i.string.isRequired};function qt({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:r,locale:l}=oe(),{api:a}=ye(),{api:n}=Ue(),[u,d]=j.useState(!0),{blocklet:f}=Ee(),[x,S]=j.useState(null),[C,p]=j.useState(!1),h=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:w=""}=tt(),[k,I]=j.useState(null),v=`publish-${f.meta.did}`,D=No(v),[_,q]=j.useState({searchText:D.searchText||"",pageSize:D.rowsPerPage||10,page:1}),E=()=>{a.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:s}}).then(g=>{const A=(g==null?void 0:g.projects)||[];d(!1),I(A)}).catch(g=>{d(!1),U.error(g.message)})},M=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},$=g=>{S(g)},Q=()=>{d(!1),p(!0)},O=()=>{p(!1),S(null)},m=g=>{U.error(g.message),p(!1),S(null)},b=g=>{if(!(g!=null&&g.deleted)){U.error("Delete project failed");return}E(),p(!1),S(null)};j.useEffect(()=>{E()},[]);const y=j.useMemo(()=>{var A;if(!_.searchText)return k;let g=(A=_.searchText)==null?void 0:A.trim();return g?(g=Ws.toAddress(g).toLocaleLowerCase(),k.filter(H=>H.blockletTitle.toLowerCase().includes(g)||H.blockletDid.toLowerCase().includes(g))):k},[k,_.searchText]);if(!k&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!k)return null;if(!k.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Me,{onClick:M,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const A=k[g];return e.jsx(xe,{to:`${A.id}`,children:e.jsx($t,{did:f.meta.did,projectId:A.id,logo:A.blockletLogo,title:A.blockletTitle,describe:A.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Eo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},h||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},h||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const A=(f.children||[]).find(H=>H.meta.did===g);return A?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:A,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:A.meta.title})]},g):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(zo,{value:Number(g),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const A=k[g];return e.jsxs(c,{display:"flex",children:[e.jsx(xe,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(me,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Fo,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(me,{title:r("blocklet.publish.viewLastRelease",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(xe,{style:{display:"flex"},to:`${A.id}/view/${A.lastReleaseId}`,children:e.jsx(Ho,{sx:{fontSize:18}})})})}),e.jsx(me,{title:r("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>$(A),children:e.jsx(Bo,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),z=({page:g,rowsPerPage:A,searchText:H})=>{_.pageSize!==A?q(G=>({...G,searchText:"",pageSize:A,page:1})):_.page!==g+1?q(G=>({...G,searchText:"",page:g+1})):_.searchText!==H&&q(G=>({...G,searchText:H,page:1}))},J=C?e.jsx(Ms,{open:!0,popup:!0,onClose:O,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:b,onError:m,extraParams:{projectId:x.id,did:f.meta.did,name:x.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(me,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Go,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Vs,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:_.searchText,searchText:_.searchText,searchTextUpdate:g=>q(A=>({...A,searchText:g})),searchClose:()=>q(g=>({...g,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Me,{onClick:M,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:y,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:v,onChange:z}),x&&e.jsx(vt,{title:`${r("common.delete")} ${x.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:Q,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Qs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),J]})}qt.propTypes={initUrl:i.object};qt.defaultProps={initUrl:null};var Lt={},Dn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Jo=Lt.default=void 0,Tn=Dn(Re()),fo=e;Jo=Lt.default=(0,Tn.default)([(0,fo.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,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const _n=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Xo=_n;function Pn(){var m;const{t,locale:o}=oe(),{projectId:s}=tt(),{api:r}=ye(),[l,a]=j.useState(!0),{blocklet:n}=Ee(),u=Le(b=>b.breakpoints.down("md")),[d,f]=j.useState(null),[x,S]=j.useState(null),[C,p]=j.useState(null),h=(m=window.env)==null?void 0:m.serverEndpoint,R=`releases-${n.meta.did}-${s}`,w=No(R),[k,I]=j.useState({searchText:w.searchText||"",pageSize:w.rowsPerPage||10,page:1}),v=()=>{r.getReleases({input:{did:n.meta.did,projectId:s}}).then(b=>{const y=(b==null?void 0:b.releases)||[];a(!1),f(y)}).catch(b=>{a(!1),U.error(b.message)})},D=()=>{r.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(b=>{S(b.getProject.project||{}),f(b.getReleases.releases||[]),a(!1)}).catch(b=>{a(!1),U.error(b.message)})};j.useEffect(()=>{D()},[]);const[_,q]=j.useState(""),E=()=>{a(!1);const b=C.id;r.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:b}}).then(()=>{a(!1),v(),U.success(t("common.removeSuccess")),p(null)}).catch(y=>{a(!1),U.error(y.message)})},M=b=>{p(b)};if(!d&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!d)return null;const $=e.jsxs(So,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"..",children:t("common.blockletStudio")}),e.jsx(L,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:x.blockletTitle})})]});if(!d.length)return e.jsxs(e.Fragment,{children:[$,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(xe,{to:"create/none",children:e.jsx(Me,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Q=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:b=>{const y=d[b];return e.jsx(xe,{to:`view/${y.id}`,children:e.jsx($t,{did:n.meta.did,projectId:x.id,logo:y.blockletLogo,title:y.blockletVersion,describe:y.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:b=>{const y=d[b];return e.jsx(L,{className:"note",children:Xo(y.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:b=>e.jsx(Eo,{type:b==="published"?"success":"warning",children:b==="published"?"Released":Zs(b)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:b=>{const y=d[b];return y.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(zo,{value:Number(y.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:b=>{var A;const y=d[b];let W="",z="";const J=y.status==="published";if(J){const H=be(h,`/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/release/blocklet.json`),G=new URL(h);G.pathname=be(G.pathname,"/launch-blocklet/agreement"),G.searchParams.set("blocklet_meta_url",H),W=G.href,z=be(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/download/${(x.lastReleaseFiles||[])[0]}`)}const g=(A=x.blockletComponents)!=null&&A.some(H=>H.included)||y.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[J&&g==="pack"&&e.jsx(me,{title:t("blocklet.publish.install",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:W,target:"_blank",rel:"noreferrer",children:e.jsx(Jo,{sx:{fontSize:18}})})})}),J&&e.jsx(me,{title:t("blocklet.publish.download",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:z,children:e.jsx(Ks,{sx:{fontSize:18}})})})}),e.jsx(me,{title:t("blocklet.publish.delete",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>M(y),children:e.jsx(Bo,{sx:{fontSize:18}})})})]})}}}],O=({page:b,rowsPerPage:y,searchText:W})=>{k.pageSize!==y?I(z=>({...z,searchText:"",pageSize:y,page:1})):k.page!==b+1?I(z=>({...z,searchText:"",page:b+1})):k.searchText!==W&&I(z=>({...z,searchText:W,page:1}))};return e.jsxs($n,{children:[e.jsx(wt,{sx:{mb:2},left:$,actions:e.jsxs(e.Fragment,{children:[e.jsx(Me,{variant:"outlined",onClick:()=>{const b=be(h,`/api/project/${n.meta.did}/${s}/blocklet.json`);q(b)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(xe,{to:"new-release/none",children:e.jsxs(Me,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:_,onClose:()=>q(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Mo,{children:_}),e.jsxs(L,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:d,columns:Q,durable:R,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:O}),C&&e.jsx(vt,{title:t(`${t("common.delete")} ${C.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:E,onCancel:()=>p(null)})]})}const $n=ge(c)`
|
|
3
3
|
.main-table > div:first-child {
|
|
4
4
|
display: none;
|
|
5
5
|
}
|
|
@@ -7,7 +7,7 @@ import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./ven
|
|
|
7
7
|
word-break: break-all;
|
|
8
8
|
white-space: pre-line;
|
|
9
9
|
}
|
|
10
|
-
`;var At={},qn=ke;Object.defineProperty(At,"__esModule",{value:!0});var Yo=At.default=void 0,Ln=qn(Re()),An=e;Yo=At.default=(0,Ln.default)((0,An.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 Ne({children:t,Icon:o}){return e.jsxs(ws,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[e.jsx(c,{sx:{opacity:.3,fontSize:32},children:e.jsx(o,{})}),e.jsx(c,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:t})]})}Ne.propTypes={children:i.node.isRequired,Icon:i.elementType};Ne.defaultProps={Icon:Yo};function Nt({value:t,app:o,onChange:s,onChangeBlockletResourceType:r,disabled:l,resourceRelateComponents:a,projectType:n,dependentComponentsMode:u,blockletResourceType:d}){const{t:f,locale:x}=oe(),S=u==="readonly",C=j.useMemo(()=>{const v=t.reduce((D,_)=>(D[_.did]=_.included,D),{});return(o.children||[]).filter(D=>S?a[D.meta.did]||v[D.meta.did]:!0)},[o.children,t,a,S]),p=j.useMemo(()=>C.map(v=>t.find(_=>_.did===v.meta.did)||{did:v.meta.did}),[C,t]),h=p.reduce((v,D)=>(v[D.did]=St(D,["required","included"]),v),{}),R=v=>{const D=p.map(_=>{if(_.did===v){const q=!_.included;return{..._,included:q,required:q}}return _});s(D)},w=v=>{const D=p.map(_=>_.did===v?{..._,required:!_.required}:_);s(D)},k=v=>{r(v.target.checked?"resource":"")},I=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:v=>{var q;const D=C[v],_=(q=h[D.meta.did])==null?void 0:q.included;return e.jsxs(c,{display:"flex",alignItems:"center",children:[e.jsx(Ct,{size:24,blocklet:D,ancestors:[o]}),e.jsx(c,{ml:"4px",className:It("text",{excluded:!_}),children:e.jsx(c,{children:D.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:v=>{var E;const D=C[v],_=a[D.meta.did],q=!!((E=h[D.meta.did])!=null&&E.included);return e.jsx(
|
|
10
|
+
`;var At={},qn=ke;Object.defineProperty(At,"__esModule",{value:!0});var Yo=At.default=void 0,Ln=qn(Re()),An=e;Yo=At.default=(0,Ln.default)((0,An.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 Ne({children:t,Icon:o}){return e.jsxs(ws,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[e.jsx(c,{sx:{opacity:.3,fontSize:32},children:e.jsx(o,{})}),e.jsx(c,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:t})]})}Ne.propTypes={children:i.node.isRequired,Icon:i.elementType};Ne.defaultProps={Icon:Yo};function Nt({value:t,app:o,onChange:s,onChangeBlockletResourceType:r,disabled:l,resourceRelateComponents:a,projectType:n,dependentComponentsMode:u,blockletResourceType:d}){const{t:f,locale:x}=oe(),S=u==="readonly",C=j.useMemo(()=>{const v=t.reduce((D,_)=>(D[_.did]=_.included,D),{});return(o.children||[]).filter(D=>S?a[D.meta.did]||v[D.meta.did]:!0)},[o.children,t,a,S]),p=j.useMemo(()=>C.map(v=>t.find(_=>_.did===v.meta.did)||{did:v.meta.did}),[C,t]),h=p.reduce((v,D)=>(v[D.did]=St(D,["required","included"]),v),{}),R=v=>{const D=p.map(_=>{if(_.did===v){const q=!_.included;return{..._,included:q,required:q}}return _});s(D)},w=v=>{const D=p.map(_=>_.did===v?{..._,required:!_.required}:_);s(D)},k=v=>{r(v.target.checked?"resource":"")},I=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:v=>{var q;const D=C[v],_=(q=h[D.meta.did])==null?void 0:q.included;return e.jsxs(c,{display:"flex",alignItems:"center",children:[e.jsx(Ct,{size:24,blocklet:D,ancestors:[o]}),e.jsx(c,{ml:"4px",className:It("text",{excluded:!_}),children:e.jsx(c,{children:D.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:v=>{var E;const D=C[v],_=a[D.meta.did],q=!!((E=h[D.meta.did])!=null&&E.included);return e.jsx(Je,{size:"small",checked:_||q,onClick:()=>R(D.meta.did),disabled:S||_||l})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:v=>{var M,$;const D=C[v],_=a[D.meta.did],q=!!((M=h[D.meta.did])!=null&&M.included),E=!!(($=h[D.meta.did])!=null&&$.required);return e.jsx(Je,{size:"small",checked:_||E&&q,onClick:()=>w(D.meta.did),disabled:S||_||l||!q})}}}];return e.jsx(Nn,{children:C!=null&&C.length?e.jsxs(e.Fragment,{children:[e.jsxs(Io,{severity:"info",style:{width:"100%"},children:[e.jsx(c,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:f(n==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),e.jsxs(c,{component:"label",style:{cursor:"pointer"},children:[e.jsx(Je,{size:"small",style:{marginLeft:"0px"},disabled:l,checked:d==="resource",onChange:k}),f("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:x,data:C,columns:I,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):e.jsx(Ne,{Icon:Dt,children:f("blocklet.publish.blockletEmptyTip")})})}Nt.propTypes={app:i.object.isRequired,value:i.arrayOf(i.shape({did:i.string.isRequired,required:i.bool,included:i.bool})),onChange:i.func,onChangeBlockletResourceType:i.func,disabled:i.bool,dependentComponentsMode:i.string,resourceRelateComponents:i.object,blockletResourceType:i.string,projectType:i.string.isRequired};Nt.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const Nn=ge(c)`
|
|
11
11
|
.main-table {
|
|
12
12
|
.text.excluded {
|
|
13
13
|
color: #999;
|
|
@@ -35,7 +35,7 @@ import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./ven
|
|
|
35
35
|
`).filter(s=>{const r=s.match(xo);if(r===null||!r[1])return!0;const l=r[1];return l.includes(".app/Contents/Resources/electron.asar")||l.includes(".app/Contents/Resources/default_app.asar")?!1:!zn.test(l)}).filter(s=>s.trim()!=="").map(s=>o.pretty?s.replace(xo,(r,l)=>r.replace(l,l.replace(Bn,"~"))):s).join(`
|
|
36
36
|
`));const Wn=En,Mn=On,Vn=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let Un=class extends Error{constructor(o){if(!Array.isArray(o))throw new TypeError(`Expected input to be an Array, got ${typeof o}`);o=[...o].map(r=>r instanceof Error?r:r!==null&&typeof r=="object"?Object.assign(new Error(r.message),r):new Error(r));let s=o.map(r=>typeof r.stack=="string"?Vn(Mn(r.stack)):String(r)).join(`
|
|
37
37
|
`);s=`
|
|
38
|
-
`+Wn(s,4),super(s),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var Fn=Un;const Hn=Fn;var
|
|
38
|
+
`+Wn(s,4),super(s),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var Fn=Un;const Hn=Fn;var Gn=async(t,o,{concurrency:s=1/0,stopOnError:r=!0}={})=>new Promise((l,a)=>{if(typeof o!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(s)||s===1/0)&&s>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${s}\` (${typeof s})`);const n=[],u=[],d=t[Symbol.iterator]();let f=!1,x=!1,S=0,C=0;const p=()=>{if(f)return;const h=d.next(),R=C;if(C++,h.done){x=!0,S===0&&(!r&&u.length!==0?a(new Hn(u)):l(n));return}S++,(async()=>{try{const w=await h.value;n[R]=await o(w,R),S--,p()}catch(w){r?(f=!0,a(w)):(u.push(w),S--,p())}})()};for(let h=0;h<s&&(p(),!x);h++);});const Jn=Gn;var Xn=(t,o)=>Jn(t,s=>s(),o);const Ze=Rs(Xn);function Yn(t,o){const s=new Set(o||[]),r=[];function l(a){s.has(a==null?void 0:a.id)&&r.push(a==null?void 0:a.id),a!=null&&a.children&&a.children.forEach(l)}return(t||[]).forEach(l),r}function Et({src:t,alt:o,...s}){const[r,l]=j.useState(!1),a=j.useRef(null);return j.useEffect(()=>{if(!("IntersectionObserver"in window))return l(!0),()=>{};const n=new IntersectionObserver(u=>{u.forEach(d=>{d.isIntersecting&&(l(!0),n.disconnect())})},{threshold:.1});return a.current&&n.observe(a.current),()=>{n.disconnect()}},[]),e.jsx("img",{ref:a,src:r?t:void 0,alt:o,...s})}Et.propTypes={src:i.string.isRequired,alt:i.string};Et.defaultProps={alt:""};function zt({data:t,lazy:o,...s}){return!t||!t.length?null:e.jsx(Qn,{...s,children:t.map(r=>e.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Et,{src:r.url,alt:r.alt||""}):e.jsx("img",{src:r.url,alt:r.alt||""})},r.url))})}zt.propTypes={data:i.arrayOf(i.shape({url:i.string,alt:i.string})),lazy:i.bool};zt.defaultProps={data:[],lazy:!1};const Qn=ge(c)`
|
|
39
39
|
display: flex;
|
|
40
40
|
justify-content: flex-start;
|
|
41
41
|
flex-wrap: wrap;
|
|
@@ -49,7 +49,7 @@ import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./ven
|
|
|
49
49
|
margin-right: 12px;
|
|
50
50
|
margin-bottom: 12px;
|
|
51
51
|
}
|
|
52
|
-
`,ut=(t,o)=>{const s=[...t];for(;s.length>0;){const r=s.shift();if(r.id===o)return r;r.children&&s.push(...r.children)}return[]};function Bt({icon:t}){return t?Us(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ae,{className:"resource-icon",icon:t}):null}Bt.propTypes={icon:i.string};Bt.defaultProps={icon:""};function Ot({disabled:t,data:o,onChange:s,value:r}){const l=r;function a(p,h=[]){return h.push(p.id),p.children&&p.children.forEach(R=>a(R,h)),h}const n=p=>a(ut(o,p)),u=(p,h=[])=>{const R=ut(o,p);return R.parent?(h.push(R.parent),u(R.parent,h)):h};function d(p,h){const R=n(p.id),w=R.indexOf(p.id);return R.splice(w,1),R.every(k=>l.concat(h).includes(k))}const f=(p,h)=>{p.stopPropagation();const R=n(h),w=u(h);if(l.includes(h)){const k=l.filter(I=>!R.concat(w).includes(I));s(k)}else{const k=R;for(let I=0;I<w.length;++I)d(ut(o,w[I]),k)&&k.push(w[I]);s([...l].concat(k))}},x=p=>{p.stopPropagation()},S=o.some(p=>{var h;return((h=p.children)==null?void 0:h.length)>0}),C=p=>{var I;const h=l.indexOf(p.id)!==-1,R=Array.isArray(p.children),w=n(p.id),k=R&&!h&&l.some(v=>w.includes(v));return e.jsx(sn,{nodeId:p.id,label:e.jsx(Xe,{onClick:x,control:e.jsx(
|
|
52
|
+
`,ut=(t,o)=>{const s=[...t];for(;s.length>0;){const r=s.shift();if(r.id===o)return r;r.children&&s.push(...r.children)}return[]};function Bt({icon:t}){return t?Us(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ae,{className:"resource-icon",icon:t}):null}Bt.propTypes={icon:i.string};Bt.defaultProps={icon:""};function Ot({disabled:t,data:o,onChange:s,value:r}){const l=r;function a(p,h=[]){return h.push(p.id),p.children&&p.children.forEach(R=>a(R,h)),h}const n=p=>a(ut(o,p)),u=(p,h=[])=>{const R=ut(o,p);return R.parent?(h.push(R.parent),u(R.parent,h)):h};function d(p,h){const R=n(p.id),w=R.indexOf(p.id);return R.splice(w,1),R.every(k=>l.concat(h).includes(k))}const f=(p,h)=>{p.stopPropagation();const R=n(h),w=u(h);if(l.includes(h)){const k=l.filter(I=>!R.concat(w).includes(I));s(k)}else{const k=R;for(let I=0;I<w.length;++I)d(ut(o,w[I]),k)&&k.push(w[I]);s([...l].concat(k))}},x=p=>{p.stopPropagation()},S=o.some(p=>{var h;return((h=p.children)==null?void 0:h.length)>0}),C=p=>{var I;const h=l.indexOf(p.id)!==-1,R=Array.isArray(p.children),w=n(p.id),k=R&&!h&&l.some(v=>w.includes(v));return e.jsx(sn,{nodeId:p.id,label:e.jsx(Xe,{onClick:x,control:e.jsx(Je,{size:"small",checked:h,indeterminate:k,tabIndex:-1,disableRipple:!0,onClick:v=>f(v,p.id),disabled:p.disabled||t}),label:e.jsxs(c,{className:"content",children:[e.jsxs(c,{display:"flex",alignItems:"center",children:[p.icon&&e.jsx(Bt,{icon:p.icon}),e.jsx(c,{className:"name",children:p.name}),p.url&&e.jsx("a",{href:p.url,target:"_blank",rel:"noreferrer",className:"link",children:e.jsx(Xs,{className:"link-icon"})})]}),!!p.description&&e.jsx(c,{className:"description",children:p.description}),!!((I=p.images)!=null&&I.length)&&e.jsx(zt,{className:"images",data:p.images,lazy:!0})]})}),children:R?p.children.map(C):null},p.id)};return e.jsx(Zn,{className:It(!S&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(Js,{}),defaultExpandIcon:e.jsx(on,{}),selected:l,children:o.map(p=>C(p))})}Ot.propTypes={data:i.array,value:i.array,onChange:i.func,disabled:i.bool};Ot.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const Zn=ge(nn)`
|
|
53
53
|
&.no-children {
|
|
54
54
|
.MuiTreeItem-content {
|
|
55
55
|
padding: 0;
|
|
@@ -104,7 +104,7 @@ import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./ven
|
|
|
104
104
|
font-size: 14px;
|
|
105
105
|
color: ${({theme:t})=>t.palette.text.secondary};
|
|
106
106
|
}
|
|
107
|
-
`,mo={},Kn=(t,o,{key:s,cacheTime:r=1e3*3}={})=>{const l=s+JSON.stringify({params:o}),a=mo[l];if(a&&a.timestamp>Date.now()-r)return a.promise;const n=t(...o);return mo[l]={promise:n,timestamp:Date.now()},n},Qo=Kn,Zo=(t,o)=>(t.forEach(s=>{o&&(s.parent=o),(s.children||[]).forEach(r=>{r.parent=s.id,Zo(r.children||[],r.id)})}),t),Ko=(t,o,s,r,l)=>{const{exportApi:a="/"}=(t==null?void 0:t.meta.resource)||{},n=new URL(be("http://127.0.0.1",t==null?void 0:t.mountPoint,a||"/").replace(/\/+/g,"/"));return n.searchParams.set("projectId",o),n.searchParams.set("releaseId",s),n.searchParams.set("local",r),l&&n.searchParams.set("resourcesParams",l.searchParams.get("resourcesParams")),`${n.pathname}${n.search}`},er=async({api:t,appDid:o,component:s,projectId:r,releaseId:l,locale:a,initUrl:n,resources:u})=>{let d;if(n&&n.searchParams.get("resourcesParams"))try{d=JSON.parse(n.searchParams.get("resourcesParams"))}catch(f){U.error(f.message);return}await Wo.post(Ko(s,r,l,a,n),{resources:u,projectId:r,releaseId:l,locale:a,...d?{resourcesParams:d}:{}},{headers:{"x-csrf-token":Fs()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:r,releaseId:l,componentDid:s.meta.did,resources:u}})},tr=(t,o)=>{if(!t)return{};const s=o.reduce((l,a)=>(l[a]=!0,l),{}),r=(l,a)=>(l.forEach(n=>{var u;s[n.id]&&((u=n.dependentComponents)!=null&&u.length)&&n.dependentComponents.forEach(d=>{a[d]=!0}),n.children&&r(n.children,a)}),a);return r(t,{})};function Wt({app:t,component:o,projectId:s,release:r,loading:l,error:a,saveSelectedEventsRef:n,readOnly:u,componentDid:d,initialResources:f={},setResourceComponentsMap:x,selectedResourceIds:S,setSelectedResourceIds:C,showTree:p,initUrl:h}){var O;const{t:R,locale:w}=oe(),{api:k}=ye(),[I,v]=Ie({}),D=j.useRef({}),_=j.useRef(!1),q=r.id;D.current.projectId=s,D.current.releaseId=q;const E=(m,b,y)=>{if(!b)return;const W=tr(b,y);x==null||x({[m]:Object.keys(W)})},M=m=>{n.current[o.meta.did]={resources:m,component:o},C({[o.meta.did]:m}),E(o.meta.did,I[o.meta.did],m)},$=j.useCallback(async m=>{var b;try{const y=await Qo(Wo.get,[Ko(m,s,q,w,h),{timeout:6e4}],{key:"getResources"});return Zo(((b=y==null?void 0:y.data)==null?void 0:b.resources)||[])}catch{return[]}},[s,q,w,h]);j.useEffect(()=>{I[o==null?void 0:o.meta.did]||$(o).then(m=>{v({[o==null?void 0:o.meta.did]:m})}).catch(m=>{U.error(m.message)})},[o,v,I,$]),j.useEffect(()=>{q&&s&&!_.current&&Ze(t.children.map(m=>async()=>{var b,y;if(!(d&&d!==m.meta.did)&&!(!(m!=null&&m.mountPoint)||!Os.hasStartEngine(m==null?void 0:m.meta)||!((y=(b=m==null?void 0:m.meta)==null?void 0:b.resource)!=null&&y.exportApi)))try{const W=await $(m);v({[m==null?void 0:m.meta.did]:W});const z=await k.getSelectedResources({input:{did:t.meta.did,projectId:s,releaseId:q,componentDid:m.meta.did}}),
|
|
107
|
+
`,mo={},Kn=(t,o,{key:s,cacheTime:r=1e3*3}={})=>{const l=s+JSON.stringify({params:o}),a=mo[l];if(a&&a.timestamp>Date.now()-r)return a.promise;const n=t(...o);return mo[l]={promise:n,timestamp:Date.now()},n},Qo=Kn,Zo=(t,o)=>(t.forEach(s=>{o&&(s.parent=o),(s.children||[]).forEach(r=>{r.parent=s.id,Zo(r.children||[],r.id)})}),t),Ko=(t,o,s,r,l)=>{const{exportApi:a="/"}=(t==null?void 0:t.meta.resource)||{},n=new URL(be("http://127.0.0.1",t==null?void 0:t.mountPoint,a||"/").replace(/\/+/g,"/"));return n.searchParams.set("projectId",o),n.searchParams.set("releaseId",s),n.searchParams.set("local",r),l&&n.searchParams.set("resourcesParams",l.searchParams.get("resourcesParams")),`${n.pathname}${n.search}`},er=async({api:t,appDid:o,component:s,projectId:r,releaseId:l,locale:a,initUrl:n,resources:u})=>{let d;if(n&&n.searchParams.get("resourcesParams"))try{d=JSON.parse(n.searchParams.get("resourcesParams"))}catch(f){U.error(f.message);return}await Wo.post(Ko(s,r,l,a,n),{resources:u,projectId:r,releaseId:l,locale:a,...d?{resourcesParams:d}:{}},{headers:{"x-csrf-token":Fs()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:r,releaseId:l,componentDid:s.meta.did,resources:u}})},tr=(t,o)=>{if(!t)return{};const s=o.reduce((l,a)=>(l[a]=!0,l),{}),r=(l,a)=>(l.forEach(n=>{var u;s[n.id]&&((u=n.dependentComponents)!=null&&u.length)&&n.dependentComponents.forEach(d=>{a[d]=!0}),n.children&&r(n.children,a)}),a);return r(t,{})};function Wt({app:t,component:o,projectId:s,release:r,loading:l,error:a,saveSelectedEventsRef:n,readOnly:u,componentDid:d,initialResources:f={},setResourceComponentsMap:x,selectedResourceIds:S,setSelectedResourceIds:C,showTree:p,initUrl:h}){var O;const{t:R,locale:w}=oe(),{api:k}=ye(),[I,v]=Ie({}),D=j.useRef({}),_=j.useRef(!1),q=r.id;D.current.projectId=s,D.current.releaseId=q;const E=(m,b,y)=>{if(!b)return;const W=tr(b,y);x==null||x({[m]:Object.keys(W)})},M=m=>{n.current[o.meta.did]={resources:m,component:o},C({[o.meta.did]:m}),E(o.meta.did,I[o.meta.did],m)},$=j.useCallback(async m=>{var b;try{const y=await Qo(Wo.get,[Ko(m,s,q,w,h),{timeout:6e4}],{key:"getResources"});return Zo(((b=y==null?void 0:y.data)==null?void 0:b.resources)||[])}catch{return[]}},[s,q,w,h]);j.useEffect(()=>{I[o==null?void 0:o.meta.did]||$(o).then(m=>{v({[o==null?void 0:o.meta.did]:m})}).catch(m=>{U.error(m.message)})},[o,v,I,$]),j.useEffect(()=>{q&&s&&!_.current&&Ze(t.children.map(m=>async()=>{var b,y;if(!(d&&d!==m.meta.did)&&!(!(m!=null&&m.mountPoint)||!Os.hasStartEngine(m==null?void 0:m.meta)||!((y=(b=m==null?void 0:m.meta)==null?void 0:b.resource)!=null&&y.exportApi)))try{const W=await $(m);v({[m==null?void 0:m.meta.did]:W});const z=await k.getSelectedResources({input:{did:t.meta.did,projectId:s,releaseId:q,componentDid:m.meta.did}}),J=(z==null?void 0:z.resources)||[];J!=null&&J.length&&(C({[m.meta.did]:Yn(W,J)}),E(m.meta.did,W,J),u||(n.current[m==null?void 0:m.meta.did]={resources:J,component:m}))}catch(W){U.error(W.message)}}),{concurrency:2}).then(()=>{_.current=!0})},[q,s,u,w,h,v]),j.useEffect(()=>{f&&Object.keys(f).length&&Ze(t.children.map(async m=>{const b=f[m.meta.did];if(b!=null&&b.length){const y=await $(m);C({[m.meta.did]:b}),E(m.meta.did,y,b),u||(n.current[m==null?void 0:m.meta.did]={resources:b,component:m})}}))},[t,f,u]);let Q=null;return(!o||!((O=I[o.meta.did])!=null&&O.length))&&(Q=e.jsx(Ne,{Icon:Dt,children:R("blocklet.publish.resourceEmptyTip",{name:ro.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(Q=e.jsx(Ne,{children:R("blocklet.publish.componentNotRunning",{name:ro.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(or,{className:It(a&&"error"),children:p&&e.jsx(c,{pb:2,width:"100%",children:Q||e.jsx(Ot,{data:I[o.meta.did]||[],value:S[o.meta.did]||[],onChange:M,disabled:l||u})})}),!!a&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:a})]})}Wt.propTypes={component:i.object.isRequired,app:i.object.isRequired,projectId:i.string.isRequired,error:i.string,saveSelectedEventsRef:i.object.isRequired,readOnly:i.bool.isRequired,loading:i.bool.isRequired,release:i.shape({id:i.string.isRequired,status:i.string}),initialResources:i.object,initUrl:i.object,setResourceComponentsMap:i.func,componentDid:i.string,selectedResourceIds:i.array.isRequired,setSelectedResourceIds:i.func.isRequired,showTree:i.bool.isRequired};Wt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const or=ge(c)`
|
|
108
108
|
border: 1px solid #ccc;
|
|
109
109
|
max-height: 600px;
|
|
110
110
|
width: 100%;
|
|
@@ -125,7 +125,7 @@ import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./ven
|
|
|
125
125
|
background: #fff;
|
|
126
126
|
z-index: 10;
|
|
127
127
|
}
|
|
128
|
-
`;var Mt={},sr=ke;Object.defineProperty(Mt,"__esModule",{value:!0});var bt=Mt.default=void 0,nr=sr(Re()),rr=e;bt=Mt.default=(0,nr.default)((0,rr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const go="lastWantToConnectStoreId";function lr(t){var u,d;const[o,s]=j.useState(null),{session:r}=Ue(),l=j.useCallback(f=>{s(f),localStorage.setItem(go,f==null?void 0:f.id)},[s]),a=j.useMemo(()=>{var C,p,h,R;const f=localStorage.getItem(go),x=f?(((C=t==null?void 0:t.settings)==null?void 0:C.storeList)||[]).find(w=>w.id===f):null;if(x)return x;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(w=>{var k;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((k=r==null?void 0:r.user)==null?void 0:k.did))});return S||(S=(R=(h=t==null?void 0:t.settings)==null?void 0:h.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(d=r==null?void 0:r.user)==null?void 0:d.did]);return[o||a||{},l]}const pt={};async function es(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:r=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,r));const a=Date.now(),n=async(u,d)=>{try{const f=await t();u(f)}catch(f){Date.now()-a>s?d(f):l?pt[l]=setTimeout(()=>n(u,d),o):setTimeout(()=>n(u,d),o)}};return new Promise(n)}function ir(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function cr(t,{did:o,projectId:s,messageId:r}){return es(async()=>{var a;const l=await t.getProject({input:{did:o,projectId:s,messageId:r}});if(!((a=l==null?void 0:l.project)!=null&&a.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function ar(t,{did:o,projectId:s,storeId:r}){return es(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(d=>d.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const dr=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let a=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(a)||(a=[]),a=a.filter(d=>d.protected||!d.scope||d.scope==="studio"||d.scope===r),{teamDid:l,storeList:a}},Vt=dr;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:r,disabled:l,loading:a,componentDid:n}){var m,b,y;const{t:u}=oe(),{session:d}=Ue(),{api:f,info:x,inService:S}=ye(),C=Ee(),[p,h]=j.useState(!1),R=j.useRef(null),[w,k]=j.useState(!1),[I,v]=j.useState(null),D=W=>{s(W),h(!1)},_=()=>{h(!p)},q=W=>{R.current&&R.current.contains(W.target)||h(!1)},E=()=>{k(!0)},M=()=>{k(!1)},$=async()=>{var W;if(I)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:I.url,projectId:"",scope:I.scope||"studio"}}),await((W=C==null?void 0:C.actions)==null?void 0:W.refreshBlocklet())}catch(z){U.error(`Remove Blocklet Store Error: ${Ae(z)}`)}finally{v(null)}},{storeList:Q}=Vt({fromBlocklet:S,blocklet:t,nodeInfo:x,componentDid:n,userDid:(m=d==null?void 0:d.user)==null?void 0:m.did}),O=(b=t==null?void 0:t.meta)==null?void 0:b.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(ne,{onClick:r,children:[a&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(ne,{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:_,children:e.jsx(fn,{})})]}),e.jsx(Do,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(To,{...W,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(_o,{onClickAway:q,children:e.jsxs(Po,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Q==null?void 0:Q.map(z=>{var G;return e.jsxs(fe,{selected:z.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>D(z),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:z.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:z.url})]}),rn({store:z,userDid:(G=d==null?void 0:d.user)==null?void 0:G.did})&&e.jsx(ce,{sx:{ml:1},onClick:g=>{g.preventDefault(),g.stopPropagation(),v(z)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},z.url)}),e.jsx(Ss,{}),e.jsxs(fe,{onClick:E,children:[e.jsx(Rt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(Vo,{hiddenChildren:!0,open:!0,onClose:M,teamDid:O,storeList:Q,scope:"studio",onAdd:(y=C==null?void 0:C.actions)==null?void 0:y.refreshBlocklet}),I&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${I.name}`,description:u("blocklet.publish.deleteStoreTip",{name:I.name}),confirm:u("common.confirm"),onConfirm:$,onCancel:()=>v(null)})]})}Ut.propTypes={store:i.object,blocklet:i.object,onChangeStore:i.func.isRequired,onClick:i.func.isRequired,loading:i.bool.isRequired,disabled:i.bool.isRequired,componentDid:i.string.isRequired,projectType:i.string.isRequired,getData:i.func.isRequired};Ut.defaultProps={store:null,blocklet:null};const ur=(t,o,s)=>{const r=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${r}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:a,screenshotUrls:n,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},ts=ur,pr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:r}){var u;const{t:l}=oe(),a=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(a){const d=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&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(n){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,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 e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{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:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:i.string.isRequired,style:i.object,controls:i.number,modestbranding:i.number};st.defaultProps={style:{},controls:1,modestbranding:1};function os({setParams:t,onClose:o,params:s}){const{t:r}=oe(),[l,a]=j.useState(""),n=l&&s.blockletVideos.includes(l),u=pr(l),d=()=>{t(f=>{const x=[...f.blockletVideos];return x.push(l),{...f,blockletVideos:x}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx($o,{children:r("studio.videoDialogTitle")}),e.jsxs(qo,{children:[e.jsx(Is,{fullWidth:!0,value:l,onChange:f=>a(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(Ve,{position:"end",children:e.jsx(ce,{onClick:()=>a(""),children:e.jsx(Hs,{})})}):null,error:n}),n&&e.jsx(L,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Lo,{children:[e.jsx(ne,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(ne,{disabled:!u||n,onClick:d,children:r("studio.confirm")})]})]})}os.propTypes={onClose:i.func.isRequired,params:i.object.isRequired,setParams:i.func.isRequired};function xt({errors:t,storeList:o,...s}){const{t:r}=oe();return e.jsxs(c,{...s,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(L,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,a])=>{const n=Object.values(a),u=o.find(d=>d.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(me,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(d=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:d},d))]},l)})]})}xt.propTypes={errors:i.object.isRequired,storeList:i.array.isRequired};const jo=j.lazy(()=>Oo(()=>import("./index-DhAVA9HZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function ss({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:a,paramsErrTip:n,setParamsErrTip:u,warning:d,setLoading:f,initUrl:x,initLogoUrl:S,setInitLogoUrl:C,componentDid:p}){const{t:h,locale:R}=oe(),{api:w}=ye(),k=gt(),I=j.useRef(null),v=j.useRef(null),[D,_]=lr(r),[q,E]=j.useState(!1),M=ln({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),$=async P=>{const F=setTimeout(()=>{f(!1)},2e4),X=await cr(w,P);f(!1),clearTimeout(F),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),k(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Q=()=>{if(!l.blockletTitle){U.error(h("blocklet.publish.errorTip.noTitle"));return}if(!(D!=null&&D.url)){U.error(h("blocklet.publish.noStoreSelected"));return}const P=ir();M(async(F,X)=>{var ee,Z,ie;try{const K=await w.connectByStudio({input:{did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:D.url,storeId:D.id,storeName:D.name,type:((Z=l==null?void 0:l.blockletComponents)==null?void 0:Z.length)>0?"pack":"resource",componentDid:p,messageId:P,tenantScope:(x==null?void 0:x.searchParams.get("tenantScope"))||""}});if(!(K!=null&&K.url)){U.error("failed to connect to store");return}X(K.url),$({did:(ie=r==null?void 0:r.meta)==null?void 0:ie.did,projectId:"",messageId:P})}catch(K){const de=Ae(K);U.error(de),f(!1)}})},{logoUrl:O,screenshotUrls:m,uploadLogoPrefix:b,uploadScreenshotPrefix:y}=ts(l,r,t),{logoErrors:W,screenshotErrors:z,storeList:G,hasLogoWarning:g,hasScreenshotWarning:A}=d,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(U.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,J=P=>{if(!P.destination)return;const F=Array.from(l.blockletScreenshots),[X]=F.splice(P.source.index,1);F.splice(P.destination.index,0,X),a(ee=>({...ee,blockletScreenshots:F}))},ze=P=>{if(!P.destination)return;const F=Array.from(l.blockletVideos),[X]=F.splice(P.source.index,1);F.splice(P.destination.index,0,X),a(ee=>({...ee,blockletVideos:F}))};return e.jsxs(hr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:P=>{u({blockletTitle:""}),a({blockletTitle:P.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(se,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Ve,{position:"end",children:e.jsx(Ut,{blocklet:r,store:D,componentDid:p,onChangeStore:_,disabled:!l.blockletTitle||o||s,loading:s,onClick:Q})})},error:!!n.projectId,helperText:n.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:P=>{u({blockletDescription:""}),a({blockletDescription:P.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?u({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:P.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?u({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:P.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(P.target.value)?u({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:P.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:P=>{P.target.value&&!/^(git|https|svn)/.test(P.target.value)?u({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:P.target.value})},error:!!n.blockletRepository,helperText:n.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(wo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||O,onClick:()=>{var P;H()&&((P=I.current)==null||P.open())}})})]}),g&&e.jsx(xt,{errors:W,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:h("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:J,children:e.jsx(uo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(P,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:P.innerRef,...P.droppableProps,children:[m.map((X,ee)=>e.jsx(po,{draggableId:X,index:ee,isDragDisabled:o,children:(Z,ie)=>e.jsxs(c,{ref:Z.innerRef,...Z.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ce,{...Z.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{a(K=>{const de=[...K.blockletScreenshots];return de.splice(ee,1),{...K,blockletScreenshots:de}})},children:e.jsx(co,{})})]})},X)),P.placeholder,m.length<5&&e.jsx(c,{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 X;H()&&((X=v.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(xt,{errors:z,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:h("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:ze,children:e.jsx(uo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(P,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:P.innerRef,...P.droppableProps,children:[l.blockletVideos.map((X,ee)=>e.jsx(po,{draggableId:X,index:ee,isDragDisabled:o,children:(Z,ie)=>e.jsxs(c,{ref:Z.innerRef,...Z.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:X,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...Z.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{a(K=>{const de=[...K.blockletVideos];return de.splice(ee,1),{...K,blockletVideos:de}})},children:e.jsx(co,{})})]})},X)),P.placeholder,l.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&E(!0)},children:"+"})]})})})]})]})}),e.jsxs(j.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(jo,{ref:I,locale:R,popup:!0,onUploadFinish:P=>{var F;a({blockletLogo:P.data.filename}),C(""),(F=I.current)==null||F.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:b,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/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"),q&&e.jsx(os,{onClose:()=>E(!1),params:l,setParams:a}),e.jsx(jo,{ref:v,locale:R,popup:!0,onUploadFinish:P=>{var F;a(X=>{var Z;const ee=X.blockletScreenshots||[];return ee.push((Z=P.data)==null?void 0:Z.filename),{...X,blockletScreenshots:ee}}),(F=v.current)==null||F.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:y,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-m.length}},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")]})]})}ss.propTypes={projectId:i.string.isRequired,readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,paramsErrTip:i.object.isRequired,setParamsErrTip:i.func.isRequired,warning:i.object.isRequired,loading:i.bool.isRequired,blocklet:i.object.isRequired,setLoading:i.func.isRequired,initUrl:i.object.isRequired,componentDid:i.isRequired,initLogoUrl:i.string.isRequired,setInitLogoUrl:i.func.isRequired};const hr=ge.div`
|
|
128
|
+
`;var Mt={},sr=ke;Object.defineProperty(Mt,"__esModule",{value:!0});var bt=Mt.default=void 0,nr=sr(Re()),rr=e;bt=Mt.default=(0,nr.default)((0,rr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const go="lastWantToConnectStoreId";function lr(t){var u,d;const[o,s]=j.useState(null),{session:r}=Ue(),l=j.useCallback(f=>{s(f),localStorage.setItem(go,f==null?void 0:f.id)},[s]),a=j.useMemo(()=>{var C,p,h,R;const f=localStorage.getItem(go),x=f?(((C=t==null?void 0:t.settings)==null?void 0:C.storeList)||[]).find(w=>w.id===f):null;if(x)return x;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(w=>{var k;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((k=r==null?void 0:r.user)==null?void 0:k.did))});return S||(S=(R=(h=t==null?void 0:t.settings)==null?void 0:h.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(d=r==null?void 0:r.user)==null?void 0:d.did]);return[o||a||{},l]}const pt={};async function es(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:r=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,r));const a=Date.now(),n=async(u,d)=>{try{const f=await t();u(f)}catch(f){Date.now()-a>s?d(f):l?pt[l]=setTimeout(()=>n(u,d),o):setTimeout(()=>n(u,d),o)}};return new Promise(n)}function ir(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function cr(t,{did:o,projectId:s,messageId:r}){return es(async()=>{var a;const l=await t.getProject({input:{did:o,projectId:s,messageId:r}});if(!((a=l==null?void 0:l.project)!=null&&a.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function ar(t,{did:o,projectId:s,storeId:r}){return es(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(d=>d.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const dr=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let a=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(a)||(a=[]),a=a.filter(d=>d.protected||!d.scope||d.scope==="studio"||d.scope===r),{teamDid:l,storeList:a}},Vt=dr;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:r,disabled:l,loading:a,componentDid:n}){var m,b,y;const{t:u}=oe(),{session:d}=Ue(),{api:f,info:x,inService:S}=ye(),C=Ee(),[p,h]=j.useState(!1),R=j.useRef(null),[w,k]=j.useState(!1),[I,v]=j.useState(null),D=W=>{s(W),h(!1)},_=()=>{h(!p)},q=W=>{R.current&&R.current.contains(W.target)||h(!1)},E=()=>{k(!0)},M=()=>{k(!1)},$=async()=>{var W;if(I)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:I.url,projectId:"",scope:I.scope||"studio"}}),await((W=C==null?void 0:C.actions)==null?void 0:W.refreshBlocklet())}catch(z){U.error(`Remove Blocklet Store Error: ${Ae(z)}`)}finally{v(null)}},{storeList:Q}=Vt({fromBlocklet:S,blocklet:t,nodeInfo:x,componentDid:n,userDid:(m=d==null?void 0:d.user)==null?void 0:m.did}),O=(b=t==null?void 0:t.meta)==null?void 0:b.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(ne,{onClick:r,children:[a&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(ne,{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:_,children:e.jsx(fn,{})})]}),e.jsx(Do,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(To,{...W,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(_o,{onClickAway:q,children:e.jsxs(Po,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Q==null?void 0:Q.map(z=>{var J;return e.jsxs(fe,{selected:z.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>D(z),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:z.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:z.url})]}),rn({store:z,userDid:(J=d==null?void 0:d.user)==null?void 0:J.did})&&e.jsx(ce,{sx:{ml:1},onClick:g=>{g.preventDefault(),g.stopPropagation(),v(z)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},z.url)}),e.jsx(Ss,{}),e.jsxs(fe,{onClick:E,children:[e.jsx(Rt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(Vo,{hiddenChildren:!0,open:!0,onClose:M,teamDid:O,storeList:Q,scope:"studio",onAdd:(y=C==null?void 0:C.actions)==null?void 0:y.refreshBlocklet}),I&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${I.name}`,description:u("blocklet.publish.deleteStoreTip",{name:I.name}),confirm:u("common.confirm"),onConfirm:$,onCancel:()=>v(null)})]})}Ut.propTypes={store:i.object,blocklet:i.object,onChangeStore:i.func.isRequired,onClick:i.func.isRequired,loading:i.bool.isRequired,disabled:i.bool.isRequired,componentDid:i.string.isRequired,projectType:i.string.isRequired,getData:i.func.isRequired};Ut.defaultProps={store:null,blocklet:null};const ur=(t,o,s)=>{const r=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${r}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:a,screenshotUrls:n,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},ts=ur,pr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:r}){var u;const{t:l}=oe(),a=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(a){const d=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&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(n){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,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 e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{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:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:i.string.isRequired,style:i.object,controls:i.number,modestbranding:i.number};st.defaultProps={style:{},controls:1,modestbranding:1};function os({setParams:t,onClose:o,params:s}){const{t:r}=oe(),[l,a]=j.useState(""),n=l&&s.blockletVideos.includes(l),u=pr(l),d=()=>{t(f=>{const x=[...f.blockletVideos];return x.push(l),{...f,blockletVideos:x}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx($o,{children:r("studio.videoDialogTitle")}),e.jsxs(qo,{children:[e.jsx(Is,{fullWidth:!0,value:l,onChange:f=>a(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(Ve,{position:"end",children:e.jsx(ce,{onClick:()=>a(""),children:e.jsx(Hs,{})})}):null,error:n}),n&&e.jsx(L,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Lo,{children:[e.jsx(ne,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(ne,{disabled:!u||n,onClick:d,children:r("studio.confirm")})]})]})}os.propTypes={onClose:i.func.isRequired,params:i.object.isRequired,setParams:i.func.isRequired};function xt({errors:t,storeList:o,...s}){const{t:r}=oe();return e.jsxs(c,{...s,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(L,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,a])=>{const n=Object.values(a),u=o.find(d=>d.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(me,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(d=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:d},d))]},l)})]})}xt.propTypes={errors:i.object.isRequired,storeList:i.array.isRequired};const jo=j.lazy(()=>Oo(()=>import("./index-DHdYd4nT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ss({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:a,paramsErrTip:n,setParamsErrTip:u,warning:d,setLoading:f,initUrl:x,initLogoUrl:S,setInitLogoUrl:C,componentDid:p}){const{t:h,locale:R}=oe(),{api:w}=ye(),k=gt(),I=j.useRef(null),v=j.useRef(null),[D,_]=lr(r),[q,E]=j.useState(!1),M=ln({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),$=async P=>{const F=setTimeout(()=>{f(!1)},2e4),X=await cr(w,P);f(!1),clearTimeout(F),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),k(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Q=()=>{if(!l.blockletTitle){U.error(h("blocklet.publish.errorTip.noTitle"));return}if(!(D!=null&&D.url)){U.error(h("blocklet.publish.noStoreSelected"));return}const P=ir();M(async(F,X)=>{var ee,Z,ie;try{const K=await w.connectByStudio({input:{did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:D.url,storeId:D.id,storeName:D.name,type:((Z=l==null?void 0:l.blockletComponents)==null?void 0:Z.length)>0?"pack":"resource",componentDid:p,messageId:P,tenantScope:(x==null?void 0:x.searchParams.get("tenantScope"))||""}});if(!(K!=null&&K.url)){U.error("failed to connect to store");return}X(K.url),$({did:(ie=r==null?void 0:r.meta)==null?void 0:ie.did,projectId:"",messageId:P})}catch(K){const de=Ae(K);U.error(de),f(!1)}})},{logoUrl:O,screenshotUrls:m,uploadLogoPrefix:b,uploadScreenshotPrefix:y}=ts(l,r,t),{logoErrors:W,screenshotErrors:z,storeList:J,hasLogoWarning:g,hasScreenshotWarning:A}=d,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(U.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,G=P=>{if(!P.destination)return;const F=Array.from(l.blockletScreenshots),[X]=F.splice(P.source.index,1);F.splice(P.destination.index,0,X),a(ee=>({...ee,blockletScreenshots:F}))},ze=P=>{if(!P.destination)return;const F=Array.from(l.blockletVideos),[X]=F.splice(P.source.index,1);F.splice(P.destination.index,0,X),a(ee=>({...ee,blockletVideos:F}))};return e.jsxs(hr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:P=>{u({blockletTitle:""}),a({blockletTitle:P.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(se,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Ve,{position:"end",children:e.jsx(Ut,{blocklet:r,store:D,componentDid:p,onChangeStore:_,disabled:!l.blockletTitle||o||s,loading:s,onClick:Q})})},error:!!n.projectId,helperText:n.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:P=>{u({blockletDescription:""}),a({blockletDescription:P.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?u({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:P.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)?u({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:P.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:P=>{P.target.value&&!/^(http|https):\/\//.test(P.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(P.target.value)?u({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:P.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(se,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:P=>{P.target.value&&!/^(git|https|svn)/.test(P.target.value)?u({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:P.target.value})},error:!!n.blockletRepository,helperText:n.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(wo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||O,onClick:()=>{var P;H()&&((P=I.current)==null||P.open())}})})]}),g&&e.jsx(xt,{errors:W,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:h("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:G,children:e.jsx(uo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(P,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:P.innerRef,...P.droppableProps,children:[m.map((X,ee)=>e.jsx(po,{draggableId:X,index:ee,isDragDisabled:o,children:(Z,ie)=>e.jsxs(c,{ref:Z.innerRef,...Z.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ce,{...Z.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{a(K=>{const de=[...K.blockletScreenshots];return de.splice(ee,1),{...K,blockletScreenshots:de}})},children:e.jsx(co,{})})]})},X)),P.placeholder,m.length<5&&e.jsx(c,{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 X;H()&&((X=v.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(xt,{errors:z,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[h("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:h("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:ze,children:e.jsx(uo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(P,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:P.innerRef,...P.droppableProps,children:[l.blockletVideos.map((X,ee)=>e.jsx(po,{draggableId:X,index:ee,isDragDisabled:o,children:(Z,ie)=>e.jsxs(c,{ref:Z.innerRef,...Z.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:X,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...Z.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{a(K=>{const de=[...K.blockletVideos];return de.splice(ee,1),{...K,blockletVideos:de}})},children:e.jsx(co,{})})]})},X)),P.placeholder,l.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&E(!0)},children:"+"})]})})})]})]})}),e.jsxs(j.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(jo,{ref:I,locale:R,popup:!0,onUploadFinish:P=>{var F;a({blockletLogo:P.data.filename}),C(""),(F=I.current)==null||F.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:b,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/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"),q&&e.jsx(os,{onClose:()=>E(!1),params:l,setParams:a}),e.jsx(jo,{ref:v,locale:R,popup:!0,onUploadFinish:P=>{var F;a(X=>{var Z;const ee=X.blockletScreenshots||[];return ee.push((Z=P.data)==null?void 0:Z.filename),{...X,blockletScreenshots:ee}}),(F=v.current)==null||F.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:y,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-m.length}},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")]})]})}ss.propTypes={projectId:i.string.isRequired,readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,paramsErrTip:i.object.isRequired,setParamsErrTip:i.func.isRequired,warning:i.object.isRequired,loading:i.bool.isRequired,blocklet:i.object.isRequired,setLoading:i.func.isRequired,initUrl:i.object.isRequired,componentDid:i.isRequired,initLogoUrl:i.string.isRequired,setInitLogoUrl:i.func.isRequired};const hr=ge.div`
|
|
129
129
|
margin-top: 24px;
|
|
130
130
|
.screenshot {
|
|
131
131
|
margin-bottom: 16px;
|
|
@@ -159,7 +159,7 @@ import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./ven
|
|
|
159
159
|
width: 100%; /* 图像宽度填充容器 */
|
|
160
160
|
height: auto; /* 图像高度自适应 */
|
|
161
161
|
}
|
|
162
|
-
`;var Ft={},fr=ke;Object.defineProperty(Ft,"__esModule",{value:!0});var ns=Ft.default=void 0,br=fr(Re()),xr=e;ns=Ft.default=(0,br.default)((0,xr.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 mr=(t,o,s,r)=>{const l=t?[...t]:[],a=((o==null?void 0:o.children)||[]).reduce((n,u)=>(n[u.meta.did]=!0,n),{});return Object.keys(s).forEach(n=>{if(!a[n])return;let u=!1;r||l.forEach(d=>{d.did===n&&(d.included=!0,d.required=!0,u=!0)}),u||l.push({did:n,included:!0,required:!0})}),l},gr=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],r=await(await fetch(t)).blob();return new File([r],o,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*jr(t,o){let s=0;for(;s<t.size;)yield t.slice(s,s+o),s+=o}const kr=async({did:t,projectId:o,uploadType:s="logo",imageUrl:r})=>{const l=await gr(r);new FormData().append("file",l);const n={uploaderId:"Uploader",relativePath:encodeURIComponent(l.name),name:encodeURIComponent(l.name),type:l.type},d=(await lo.post(be(Y.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,s,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":l.size,"X-Uploader-File-Ext":l.name.split(".").pop(),"Upload-Metadata":Object.keys(n).map(C=>`${C} ${btoa(n[C])}`).join(",")}})).headers.location,f=2*1024*1024;let x=0,S="";for(const C of jr(l,f)){const p=await lo.patch(be(Y.WELLKNOWN_SERVICE_PATH_PREFIX,d),C,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":x,"Content-Type":"application/offset+octet-stream"}});x+=C.size,S=p.data.filename}return S},rs=({params:t,projectId:o,status:s,t:r})=>{const l=[];return t.blockletTitle||l.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),(!o||o===Y.UNOWNED_DID)&&l.push({param:"projectId",message:r("blocklet.publish.errorTip.noDid")}),t.blockletVersion?qe.valid(t.blockletVersion)||l.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):l.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),s===ue.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||l.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),t.note||l.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),l.length?l:null},yr=({params:t,step:o,t:s,projectId:r})=>{if(o===0){if(!t.blockletTitle)return s("blocklet.publish.errorTip.noTitle");if(!r||r===Y.UNOWNED_DID)return s("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return s("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return s("blocklet.publish.errorTip.noVersion");if(!qe.valid(t.blockletVersion))return s("blocklet.publish.errorTip.inValidVersion");if(!t.note)return s("blocklet.publish.errorTip.noNote")}return""};function Ht({blocklet:t,releaseId:o,connectedStores:s,projectId:r,releaseType:l,publishedStoreIds:a,onPublish:n,onDelete:u,warning:d,projectType:f,componentDid:x,onOpenConnectStore:S,behavior:C,onSelectConnectStore:p}){var _,q;const{t:h}=oe(),{actions:{refreshBlocklet:R}}=Ee(),{session:w}=Ue(),{storeList:k}=Vt({fromBlocklet:!0,blocklet:t,componentDid:x,userDid:(_=w==null?void 0:w.user)==null?void 0:_.did}),I=j.useMemo(()=>s!=null&&s.length?s==null?void 0:s.reduce((E,M)=>(E[M.storeId]=M,E),{}):{},[s]),v=(q=t==null?void 0:t.meta)==null?void 0:q.did,D={};return Object.entries((d==null?void 0:d.logoErrors)||{}).forEach(([E,M])=>{const $=Object.values(M);$.length>0&&(D[E]=$)}),Object.entries((d==null?void 0:d.screenshotErrors)||{}).forEach(([E,M])=>{const $=Object.values(M);$.length>0&&(D[E]=D[E]?[...D[E],...$]:$)}),e.jsxs(e.Fragment,{children:[C==="connect"&&!!(k!=null&&k.length)&&e.jsx(Io,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Ds[400],component:"a",href:f==="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:[h(f==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(bn,{sx:{marginLeft:1}})]})}),e.jsx(Ts,{children:k==null?void 0:k.map(E=>e.jsx(_s,{"data-cy":"store-switch",children:e.jsx(Ps,{children:e.jsx(cn,{behavior:C,onSelectConnectStore:p,releaseId:o,projectId:r,releaseType:l,kind:"publish",teamDid:v,warningList:D[E.url],store:E,published:(a==null?void 0:a.indexOf(E.id))>-1,connectedStore:I[E.id],onPublish:n,onDelete:u,scope:E.scope||"studio",onOpenConnectStore:S})})},E.url))}),e.jsx(Vo,{teamDid:v,storeList:k,scope:"studio",onAdd:R})]})}Ht.propTypes={blocklet:i.object.isRequired,projectId:i.string.isRequired,releaseId:i.string.isRequired,releaseType:i.string.isRequired,onPublish:i.func,onDelete:i.func,publishedStoreIds:i.arrayOf(i.string),connectedStores:i.arrayOf(i.object).isRequired,projectType:i.string,componentDid:i.string,warning:i.object,onOpenConnectStore:i.func,onSelectConnectStore:i.func,behavior:i.string};Ht.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function ls({did:t,params:o,setParams:s,projectId:r,open:l,onClose:a}){const{t:n}=oe(),[u,d]=j.useState(!1),{api:f}=ye(),[x,S]=j.useState(!1),[C,p]=j.useState(!1),h=()=>{S(o.autoUpload),p(o.possibleSameStore),d(!1),a(!1)},R=async()=>{d(!0);try{await f.updateProject({input:{did:t,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!x,possibleSameStore:!!C}}),s({autoUpload:x,possibleSameStore:C}),a(!1)}catch(k){U.error(k.message)}d(!1)};j.useEffect(()=>{S(o.autoUpload),p(o.possibleSameStore)},[o]);const w=!!(r&&r!==Y.UNOWNED_DID);return e.jsx(yt,{title:n("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:l,onClose:h,actions:e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:k=>{k.stopPropagation(),a()},color:"inherit",children:n("common.cancel")}),w&&e.jsxs(ne,{onClick:k=>{k.stopPropagation(),R()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Ye,{size:16}),n("common.confirm")]})]}),children:w?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.autoUploadTip")}),e.jsx(De,{checked:x,onChange:(k,I)=>S(I)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.possibleSameStoreTip")}),e.jsx(De,{checked:C,onChange:(k,I)=>p(I)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.needProjectId")})]})})}ls.propTypes={did:i.string.isRequired,params:i.object.isRequired,open:i.bool.isRequired,onClose:i.func.isRequired,setParams:i.func.isRequired,projectId:i.string.isRequired};function is({downloadUrl:t,installUrl:o,handleSetTip:s,isPack:r,disabled:l}){const{t:a}=oe(),[n,u]=j.useState(!1),d=j.useRef(null),f=()=>{u(!n)},x=S=>{d.current&&d.current.contains(S.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(ne,{disabled:l,ref:d,onClick:f,children:e.jsx(c,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Do,{sx:{zIndex:10},open:n,anchorEl:d.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:S})=>e.jsx(To,{...S,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(_o,{onClickAway:x,children:e.jsxs(Po,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(L,{variant:"inherit",children:a("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:s,children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(L,{variant:"inherit",children:a("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(L,{variant:"inherit",children:a("common.download")})]})})]})})})})})]})}is.propTypes={disabled:i.bool.isRequired,isPack:i.bool.isRequired,downloadUrl:i.string.isRequired,installUrl:i.string.isRequired,handleSetTip:i.func.isRequired};var Co;const ko=(Co=window.env)==null?void 0:Co.serverEndpoint;function cs({projectId:t,params:o,setParamsErrTip:s,initUrl:r,setParams:l,mode:a,loading:n,blocklet:u,release:d,isPublished:f,releaseId:x,getData:S,getRelease:C,paramsErrTip:p,warning:h,componentDid:R,resourceRelateComponents:w,disabledSelectComponents:k,saveSelectedEventsRef:I,hasSelectedResources:v,initLogoUrl:D,setLoading:_,releaseUsedLast:q,setReleaseUsedLast:E,projectType:M}){var de;const{t:$,locale:Q}=oe(),{api:O}=ye(),m=gt(),[b,y]=j.useState(!1),[W,z]=j.useState(!1),[G,g]=j.useState(),A=Le(te=>te.breakpoints.down("md")),H=j.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(B=>B.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),J=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:R},"*"),C()},ze=async te=>{var He,Oe,le,_e;if(p!=null&&p.blockletHomepage||p!=null&&p.blockletSupport||p!=null&&p.blockletCommunity){U.error((p==null?void 0:p.blockletHomepage)||(p==null?void 0:p.blockletSupport)||(p==null?void 0:p.blockletCommunity));return}const ve=rs({params:o,hasSelectedResources:v,projectId:t,status:te,t:$});if(ve){U.error(ve.map(V=>V.message).join("; ")),s(ve.reduce((V,re)=>({...V,[re.param]:re.message}),{}));return}const B={...o};if(B.blockletComponents=mr(B.blockletComponents,u,w,k),B.blockletVersion=qe.valid(B.blockletVersion),!B.blockletVersion){U.error("Invalid Blocklet Version"),s({blockletVersion:"Invalid Blocklet Version"});return}if(D)try{const V=await kr({did:u.meta.did,projectId:t,imageUrl:D});B.blockletLogo=V,l({blockletLogo:V})}catch(V){U.error(V.message);return}if(o.resourceFromSelect){B.uploadedResource="";try{const V=Object.keys(I.current);await Ze(V.map(re=>()=>{const Pe=I.current[re];return er({api:O,locale:Q,projectId:t,releaseId:q?"":x,appDid:u.meta.did,component:Pe.component,resources:Pe.resources,initUrl:r})}),{concurrency:2})}catch(V){U.error(((le=(Oe=(He=V==null?void 0:V.response)==null?void 0:He.data)==null?void 0:Oe.error)==null?void 0:le.message)||V.message),s({blockletResource:"Invalid save the resource"});return}}else(_e=o.blockletDocker)!=null&&_e.dockerImage||(B.blockletComponents=[]);B.blockletTitle=(B.blockletTitle||"").trim(),B.blockletDescription=(B.blockletDescription||"").trim(),B.blockletSupport=(B.blockletSupport||"").trim(),B.blockletHomepage=(B.blockletHomepage||"").trim(),B.blockletCommunity=(B.blockletCommunity||"").trim(),B.blockletRepository=(B.blockletRepository||"").trim(),B.blockletIntroduction=(B.blockletIntroduction||"").trim(),B.note=(B.note||"").trim(),B.blockletComponents=((B==null?void 0:B.blockletComponents)||[]).filter(V=>V.included).map(V=>St(V,["did","required"])).map(JSON.stringify),B.contentType!=="docker"&&(B.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),B.blockletDocker.dockerImage=B.blockletDocker.dockerImage||"",B.blockletDocker.dockerArgs.length>0&&B.blockletDocker.dockerArgs.forEach(V=>{V.proxyBehavior=V.proxyBehavior||"service"});try{await O.createRelease({input:{...B,note:JSON.stringify({note:B.note}),did:u.meta.did,projectId:t,releaseId:q?"":x,status:te}}),te==="draft"?U.success($("blocklet.publish.saveDraftSuccess")):(E(!1),U.success($("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:R},"*")),s({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(V){const re=Ae(V);U.error(re),(/resource/.test(re)||/zip/.test(re))&&s({blockletResource:re});return}const Te=await O.getProject({input:{did:u.meta.did,projectId:t}}),Be=Te.project.lastReleaseId;o.autoUpload&&await Ze(Te.project.connectedStores.map(V=>async()=>{try{const re=await O.publishToStore({input:{did:u.meta.did,storeId:V.storeId,storeName:V.storeName,projectId:t,releaseId:Be,type:H}});U.success(e.jsx(an,{storeName:V.storeName,storeUrl:V.storeUrl,developerDid:V.developerDid,did:u.meta.did,published:re.url==="published"}),{duration:1e4})}catch(re){U.error(Ae(re))}}),{concurrency:4}),J==null||J(),m(`../${t}/view/${Be}`,{replace:!0})},P=te=>(_(!0),ze(te).finally(()=>{_(!1)})),F=async te=>{await ar(O,te),S()},X=()=>{z(!0)},ee=be(ko,`/api/project/${u.meta.did}/${t}/${x}/release/blocklet.json`),Z=new URL(ko);Z.pathname=be(Z.pathname,"/launch-blocklet/agreement"),Z.searchParams.set("blocklet_meta_url",ee);const ie=Z.href,K=()=>g(ee);return e.jsxs(e.Fragment,{children:[e.jsx(Rr,{className:"sticky-header",children:e.jsx(wt,{left:e.jsxs(So,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"../",children:$("common.blockletStudio")}),t===Y.UNOWNED_DID?e.jsx(L,{color:"text.primary",children:e.jsx(je,{maxLength:A?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(xe,{to:`../${t}`,children:e.jsx(je,{maxLength:A?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(L,{color:"text.primary",children:a==="create"?$("common.create"):(o==null?void 0:o.blockletVersion)||$("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!f&&e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(ne,{variant:"contained",onClick:()=>P(ue.PROJECT.RELEASE_STATUS.published),children:[n&&e.jsx(Ye,{size:14,sx:{mr:.5},color:"inherit"}),$("blocklet.publish.createRelease")]}),e.jsx(ne,{variant:"contained",onClick:X,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:G,onClose:()=>g(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:$("blocklet.publish.installResourceTip")}),e.jsx(Mo,{children:G}),e.jsxs(L,{sx:{mt:2},children:[$("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:$("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(ne,{onClick:()=>y(!0),children:[n?e.jsx(Ye,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(ns,{sx:{fontSize:"1.3em",mr:1}}),$(A?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(is,{isPack:H==="pack",downloadUrl:be(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${x}/download/${(d.files||[])[0]}`),installUrl:ie,handleSetTip:K}),e.jsx(ne,{onClick:X,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(yt,{title:$("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:b,onClose:()=>y(!1),children:e.jsx(Ht,{projectType:M,blocklet:u,releaseType:H,projectId:t,releaseId:x,componentDid:R,warning:h,onPublish:J,onOpenConnectStore:F,onDelete:S,connectedStores:o.connectedStores||[],publishedStoreIds:d==null?void 0:d.publishedStoreIds})}),e.jsx(ls,{did:(de=u==null?void 0:u.meta)==null?void 0:de.did,params:o,projectId:t,open:W,setParams:l,onClose:()=>z(!1)})]})}cs.propTypes={projectId:i.string.isRequired,params:i.object.isRequired,mode:i.string.isRequired,loading:i.bool.isRequired,blocklet:i.object.isRequired,release:i.object.isRequired,isPublished:i.bool.isRequired,releaseId:i.string.isRequired,getData:i.func.isRequired,getRelease:i.func.isRequired,componentDid:i.string.isRequired,resourceRelateComponents:i.object.isRequired,disabledSelectComponents:i.bool.isRequired,saveSelectedEventsRef:i.object.isRequired,hasSelectedResources:i.bool.isRequired,initLogoUrl:i.string.isRequired,setLoading:i.func.isRequired,releaseUsedLast:i.bool.isRequired,setReleaseUsedLast:i.func.isRequired,projectType:i.string.isRequired,setParamsErrTip:i.func.isRequired,warning:i.object.isRequired,setParams:i.func.isRequired,initUrl:i.object.isRequired,paramsErrTip:i.object.isRequired};const Rr=ge.div`
|
|
162
|
+
`;var Ft={},fr=ke;Object.defineProperty(Ft,"__esModule",{value:!0});var ns=Ft.default=void 0,br=fr(Re()),xr=e;ns=Ft.default=(0,br.default)((0,xr.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 mr=(t,o,s,r)=>{const l=t?[...t]:[],a=((o==null?void 0:o.children)||[]).reduce((n,u)=>(n[u.meta.did]=!0,n),{});return Object.keys(s).forEach(n=>{if(!a[n])return;let u=!1;r||l.forEach(d=>{d.did===n&&(d.included=!0,d.required=!0,u=!0)}),u||l.push({did:n,included:!0,required:!0})}),l},gr=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],r=await(await fetch(t)).blob();return new File([r],o,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*jr(t,o){let s=0;for(;s<t.size;)yield t.slice(s,s+o),s+=o}const kr=async({did:t,projectId:o,uploadType:s="logo",imageUrl:r})=>{const l=await gr(r);new FormData().append("file",l);const n={uploaderId:"Uploader",relativePath:encodeURIComponent(l.name),name:encodeURIComponent(l.name),type:l.type},d=(await lo.post(be(Y.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,s,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":l.size,"X-Uploader-File-Ext":l.name.split(".").pop(),"Upload-Metadata":Object.keys(n).map(C=>`${C} ${btoa(n[C])}`).join(",")}})).headers.location,f=2*1024*1024;let x=0,S="";for(const C of jr(l,f)){const p=await lo.patch(be(Y.WELLKNOWN_SERVICE_PATH_PREFIX,d),C,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":x,"Content-Type":"application/offset+octet-stream"}});x+=C.size,S=p.data.filename}return S},rs=({params:t,projectId:o,status:s,t:r})=>{const l=[];return t.blockletTitle||l.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),(!o||o===Y.UNOWNED_DID)&&l.push({param:"projectId",message:r("blocklet.publish.errorTip.noDid")}),t.blockletVersion?qe.valid(t.blockletVersion)||l.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):l.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),s===ue.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||l.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),t.note||l.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),l.length?l:null},yr=({params:t,step:o,t:s,projectId:r})=>{if(o===0){if(!t.blockletTitle)return s("blocklet.publish.errorTip.noTitle");if(!r||r===Y.UNOWNED_DID)return s("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return s("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return s("blocklet.publish.errorTip.noVersion");if(!qe.valid(t.blockletVersion))return s("blocklet.publish.errorTip.inValidVersion");if(!t.note)return s("blocklet.publish.errorTip.noNote")}return""};function Ht({blocklet:t,releaseId:o,connectedStores:s,projectId:r,releaseType:l,publishedStoreIds:a,onPublish:n,onDelete:u,warning:d,projectType:f,componentDid:x,onOpenConnectStore:S,behavior:C,onSelectConnectStore:p}){var _,q;const{t:h}=oe(),{actions:{refreshBlocklet:R}}=Ee(),{session:w}=Ue(),{storeList:k}=Vt({fromBlocklet:!0,blocklet:t,componentDid:x,userDid:(_=w==null?void 0:w.user)==null?void 0:_.did}),I=j.useMemo(()=>s!=null&&s.length?s==null?void 0:s.reduce((E,M)=>(E[M.storeId]=M,E),{}):{},[s]),v=(q=t==null?void 0:t.meta)==null?void 0:q.did,D={};return Object.entries((d==null?void 0:d.logoErrors)||{}).forEach(([E,M])=>{const $=Object.values(M);$.length>0&&(D[E]=$)}),Object.entries((d==null?void 0:d.screenshotErrors)||{}).forEach(([E,M])=>{const $=Object.values(M);$.length>0&&(D[E]=D[E]?[...D[E],...$]:$)}),e.jsxs(e.Fragment,{children:[C==="connect"&&!!(k!=null&&k.length)&&e.jsx(Io,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Ds[400],component:"a",href:f==="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:[h(f==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(bn,{sx:{marginLeft:1}})]})}),e.jsx(Ts,{children:k==null?void 0:k.map(E=>e.jsx(_s,{"data-cy":"store-switch",children:e.jsx(Ps,{children:e.jsx(cn,{behavior:C,onSelectConnectStore:p,releaseId:o,projectId:r,releaseType:l,kind:"publish",teamDid:v,warningList:D[E.url],store:E,published:(a==null?void 0:a.indexOf(E.id))>-1,connectedStore:I[E.id],onPublish:n,onDelete:u,scope:E.scope||"studio",onOpenConnectStore:S})})},E.url))}),e.jsx(Vo,{teamDid:v,storeList:k,scope:"studio",onAdd:R})]})}Ht.propTypes={blocklet:i.object.isRequired,projectId:i.string.isRequired,releaseId:i.string.isRequired,releaseType:i.string.isRequired,onPublish:i.func,onDelete:i.func,publishedStoreIds:i.arrayOf(i.string),connectedStores:i.arrayOf(i.object).isRequired,projectType:i.string,componentDid:i.string,warning:i.object,onOpenConnectStore:i.func,onSelectConnectStore:i.func,behavior:i.string};Ht.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function ls({did:t,params:o,setParams:s,projectId:r,open:l,onClose:a}){const{t:n}=oe(),[u,d]=j.useState(!1),{api:f}=ye(),[x,S]=j.useState(!1),[C,p]=j.useState(!1),h=()=>{S(o.autoUpload),p(o.possibleSameStore),d(!1),a(!1)},R=async()=>{d(!0);try{await f.updateProject({input:{did:t,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!x,possibleSameStore:!!C}}),s({autoUpload:x,possibleSameStore:C}),a(!1)}catch(k){U.error(k.message)}d(!1)};j.useEffect(()=>{S(o.autoUpload),p(o.possibleSameStore)},[o]);const w=!!(r&&r!==Y.UNOWNED_DID);return e.jsx(yt,{title:n("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:l,onClose:h,actions:e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:k=>{k.stopPropagation(),a()},color:"inherit",children:n("common.cancel")}),w&&e.jsxs(ne,{onClick:k=>{k.stopPropagation(),R()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Ye,{size:16}),n("common.confirm")]})]}),children:w?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.autoUploadTip")}),e.jsx(De,{checked:x,onChange:(k,I)=>S(I)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.possibleSameStoreTip")}),e.jsx(De,{checked:C,onChange:(k,I)=>p(I)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:n("blocklet.publish.needProjectId")})]})})}ls.propTypes={did:i.string.isRequired,params:i.object.isRequired,open:i.bool.isRequired,onClose:i.func.isRequired,setParams:i.func.isRequired,projectId:i.string.isRequired};function is({downloadUrl:t,installUrl:o,handleSetTip:s,isPack:r,disabled:l}){const{t:a}=oe(),[n,u]=j.useState(!1),d=j.useRef(null),f=()=>{u(!n)},x=S=>{d.current&&d.current.contains(S.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(ne,{disabled:l,ref:d,onClick:f,children:e.jsx(c,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Do,{sx:{zIndex:10},open:n,anchorEl:d.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:S})=>e.jsx(To,{...S,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(_o,{onClickAway:x,children:e.jsxs(Po,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(L,{variant:"inherit",children:a("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:s,children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(L,{variant:"inherit",children:a("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(L,{variant:"inherit",children:a("common.download")})]})})]})})})})})]})}is.propTypes={disabled:i.bool.isRequired,isPack:i.bool.isRequired,downloadUrl:i.string.isRequired,installUrl:i.string.isRequired,handleSetTip:i.func.isRequired};var Co;const ko=(Co=window.env)==null?void 0:Co.serverEndpoint;function cs({projectId:t,params:o,setParamsErrTip:s,initUrl:r,setParams:l,mode:a,loading:n,blocklet:u,release:d,isPublished:f,releaseId:x,getData:S,getRelease:C,paramsErrTip:p,warning:h,componentDid:R,resourceRelateComponents:w,disabledSelectComponents:k,saveSelectedEventsRef:I,hasSelectedResources:v,initLogoUrl:D,setLoading:_,releaseUsedLast:q,setReleaseUsedLast:E,projectType:M}){var de;const{t:$,locale:Q}=oe(),{api:O}=ye(),m=gt(),[b,y]=j.useState(!1),[W,z]=j.useState(!1),[J,g]=j.useState(),A=Le(te=>te.breakpoints.down("md")),H=j.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(B=>B.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),G=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:R},"*"),C()},ze=async te=>{var He,Oe,le,_e;if(p!=null&&p.blockletHomepage||p!=null&&p.blockletSupport||p!=null&&p.blockletCommunity){U.error((p==null?void 0:p.blockletHomepage)||(p==null?void 0:p.blockletSupport)||(p==null?void 0:p.blockletCommunity));return}const ve=rs({params:o,hasSelectedResources:v,projectId:t,status:te,t:$});if(ve){U.error(ve.map(V=>V.message).join("; ")),s(ve.reduce((V,re)=>({...V,[re.param]:re.message}),{}));return}const B={...o};if(B.blockletComponents=mr(B.blockletComponents,u,w,k),B.blockletVersion=qe.valid(B.blockletVersion),!B.blockletVersion){U.error("Invalid Blocklet Version"),s({blockletVersion:"Invalid Blocklet Version"});return}if(D)try{const V=await kr({did:u.meta.did,projectId:t,imageUrl:D});B.blockletLogo=V,l({blockletLogo:V})}catch(V){U.error(V.message);return}if(o.resourceFromSelect){B.uploadedResource="";try{const V=Object.keys(I.current);await Ze(V.map(re=>()=>{const Pe=I.current[re];return er({api:O,locale:Q,projectId:t,releaseId:q?"":x,appDid:u.meta.did,component:Pe.component,resources:Pe.resources,initUrl:r})}),{concurrency:2})}catch(V){U.error(((le=(Oe=(He=V==null?void 0:V.response)==null?void 0:He.data)==null?void 0:Oe.error)==null?void 0:le.message)||V.message),s({blockletResource:"Invalid save the resource"});return}}else(_e=o.blockletDocker)!=null&&_e.dockerImage||(B.blockletComponents=[]);B.blockletTitle=(B.blockletTitle||"").trim(),B.blockletDescription=(B.blockletDescription||"").trim(),B.blockletSupport=(B.blockletSupport||"").trim(),B.blockletHomepage=(B.blockletHomepage||"").trim(),B.blockletCommunity=(B.blockletCommunity||"").trim(),B.blockletRepository=(B.blockletRepository||"").trim(),B.blockletIntroduction=(B.blockletIntroduction||"").trim(),B.note=(B.note||"").trim(),B.blockletComponents=((B==null?void 0:B.blockletComponents)||[]).filter(V=>V.included).map(V=>St(V,["did","required"])).map(JSON.stringify),B.contentType!=="docker"&&(B.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),B.blockletDocker.dockerImage=B.blockletDocker.dockerImage||"",B.blockletDocker.dockerArgs.length>0&&B.blockletDocker.dockerArgs.forEach(V=>{V.proxyBehavior=V.proxyBehavior||"service"});try{await O.createRelease({input:{...B,note:JSON.stringify({note:B.note}),did:u.meta.did,projectId:t,releaseId:q?"":x,status:te}}),te==="draft"?U.success($("blocklet.publish.saveDraftSuccess")):(E(!1),U.success($("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:R},"*")),s({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(V){const re=Ae(V);U.error(re),(/resource/.test(re)||/zip/.test(re))&&s({blockletResource:re});return}const Te=await O.getProject({input:{did:u.meta.did,projectId:t}}),Be=Te.project.lastReleaseId;o.autoUpload&&await Ze(Te.project.connectedStores.map(V=>async()=>{try{const re=await O.publishToStore({input:{did:u.meta.did,storeId:V.storeId,storeName:V.storeName,projectId:t,releaseId:Be,type:H}});U.success(e.jsx(an,{storeName:V.storeName,storeUrl:V.storeUrl,developerDid:V.developerDid,did:u.meta.did,published:re.url==="published"}),{duration:1e4})}catch(re){U.error(Ae(re))}}),{concurrency:4}),G==null||G(),m(`../${t}/view/${Be}`,{replace:!0})},P=te=>(_(!0),ze(te).finally(()=>{_(!1)})),F=async te=>{await ar(O,te),S()},X=()=>{z(!0)},ee=be(ko,`/api/project/${u.meta.did}/${t}/${x}/release/blocklet.json`),Z=new URL(ko);Z.pathname=be(Z.pathname,"/launch-blocklet/agreement"),Z.searchParams.set("blocklet_meta_url",ee);const ie=Z.href,K=()=>g(ee);return e.jsxs(e.Fragment,{children:[e.jsx(Rr,{className:"sticky-header",children:e.jsx(wt,{left:e.jsxs(So,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"../",children:$("common.blockletStudio")}),t===Y.UNOWNED_DID?e.jsx(L,{color:"text.primary",children:e.jsx(je,{maxLength:A?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(xe,{to:`../${t}`,children:e.jsx(je,{maxLength:A?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(L,{color:"text.primary",children:a==="create"?$("common.create"):(o==null?void 0:o.blockletVersion)||$("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!f&&e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(ne,{variant:"contained",onClick:()=>P(ue.PROJECT.RELEASE_STATUS.published),children:[n&&e.jsx(Ye,{size:14,sx:{mr:.5},color:"inherit"}),$("blocklet.publish.createRelease")]}),e.jsx(ne,{variant:"contained",onClick:X,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:J,onClose:()=>g(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:$("blocklet.publish.installResourceTip")}),e.jsx(Mo,{children:J}),e.jsxs(L,{sx:{mt:2},children:[$("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:$("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(ht,{disabled:n,variant:"contained",children:[e.jsxs(ne,{onClick:()=>y(!0),children:[n?e.jsx(Ye,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(ns,{sx:{fontSize:"1.3em",mr:1}}),$(A?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(is,{isPack:H==="pack",downloadUrl:be(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${x}/download/${(d.files||[])[0]}`),installUrl:ie,handleSetTip:K}),e.jsx(ne,{onClick:X,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(yt,{title:$("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:b,onClose:()=>y(!1),children:e.jsx(Ht,{projectType:M,blocklet:u,releaseType:H,projectId:t,releaseId:x,componentDid:R,warning:h,onPublish:G,onOpenConnectStore:F,onDelete:S,connectedStores:o.connectedStores||[],publishedStoreIds:d==null?void 0:d.publishedStoreIds})}),e.jsx(ls,{did:(de=u==null?void 0:u.meta)==null?void 0:de.did,params:o,projectId:t,open:W,setParams:l,onClose:()=>z(!1)})]})}cs.propTypes={projectId:i.string.isRequired,params:i.object.isRequired,mode:i.string.isRequired,loading:i.bool.isRequired,blocklet:i.object.isRequired,release:i.object.isRequired,isPublished:i.bool.isRequired,releaseId:i.string.isRequired,getData:i.func.isRequired,getRelease:i.func.isRequired,componentDid:i.string.isRequired,resourceRelateComponents:i.object.isRequired,disabledSelectComponents:i.bool.isRequired,saveSelectedEventsRef:i.object.isRequired,hasSelectedResources:i.bool.isRequired,initLogoUrl:i.string.isRequired,setLoading:i.func.isRequired,releaseUsedLast:i.bool.isRequired,setReleaseUsedLast:i.func.isRequired,projectType:i.string.isRequired,setParamsErrTip:i.func.isRequired,warning:i.object.isRequired,setParams:i.func.isRequired,initUrl:i.object.isRequired,paramsErrTip:i.object.isRequired};const Rr=ge.div`
|
|
163
163
|
.sticky-header {
|
|
164
164
|
margin-top: -12px;
|
|
165
165
|
padding: 12px 0;
|
|
@@ -173,14 +173,14 @@ import{r as j,k as gt,l as tt,L as xe,g as Rs,u as vs,h as Cs,i as ct}from"./ven
|
|
|
173
173
|
padding-bottom: 12px;
|
|
174
174
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
175
175
|
}
|
|
176
|
-
`;function as({text:t}){return t?e.jsx(xn,{wrapperElement:{"data-color-mode":"light"},source:Ys.sanitize(t),rehypePlugins:[[mn,{target:"_blank"}]]}):e.jsx(Ne,{Icon:Dt})}as.propTypes={text:i.string.isRequired};function ds({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:a}){var x;const{t:n}=oe(),[u,d]=j.useState(a?"preview":"write"),f=(S,C)=>{d(C)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(L,{variant:"h6",fontWeight:"bold",sx:{},children:n("common.introduction")}),e.jsxs(Ao,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(se,{disabled:r||a,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Ve,{position:"end",children:[((x=t==null?void 0:t.blockletIntroduction)==null?void 0:x.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(as,{text:t.blockletIntroduction||""})})]})}ds.propTypes={params:i.object.isRequired,setParams:i.func.isRequired,paramsErrTip:i.object.isRequired,setParamsErrTip:i.func.isRequired,readOnly:i.bool.isRequired,loading:i.bool.isRequired};var Jt={},vr=ke;Object.defineProperty(Jt,"__esModule",{value:!0});var mt=Jt.default=void 0,Cr=vr(Re()),yo=e;mt=Jt.default=(0,Cr.default)([(0,yo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,yo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Gt({step:t,ok:o,active:s,error:r,warning:l}){let a="grey.500",n=t+1;return o&&(n=e.jsx(gn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(a="error.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):l?(a="warning.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(a="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:a,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Gt.propTypes={step:i.number,ok:i.bool,active:i.number,error:i.string,warning:i.bool};Gt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function us({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r,params:l,loading:a,paramsErrTip:n,warning:u,viewMode:d,projectId:f}){const{t:x}=oe(),S=()=>{s(R=>R+1)},C=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",h=d||rs({hasSelectedResources:r,params:l,projectId:f,t:x})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx($s,{activeStep:o,orientation:"vertical",children:t.map((R,w)=>{const k={},I=a||!yr({hasSelectedResources:r,params:l,projectId:f,step:w,t:x}),v=a?"":p(w);return v&&(k.optional=e.jsx(L,{variant:"caption",color:"error",children:v}),k.error=!0),e.jsxs(qs,{children:[e.jsx(Ls,{icon:e.jsx(Gt,{error:v,warning:w===0?u.hasWarning:!1,active:h?99:o,step:w,ok:I}),sx:{cursor:"pointer",color:v?"error.main":"inherit"},disabled:!1,onClick:()=>s(w),...k,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:v||!I&&o>w?"error.main":"inherit",children:R.label})}),e.jsxs(As,{children:[e.jsx(L,{fontSize:12,children:R.description}),!h&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(ne,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:v||!I,children:x("common.continue")}),w>0&&e.jsx(ne,{disabled:w===0,onClick:C,sx:{mt:1,mr:1},children:x("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}us.propTypes={steps:i.array.isRequired,activeStep:i.number.isRequired,setActiveStep:i.func.isRequired,params:i.object.isRequired,viewMode:i.string.isRequired,loading:i.bool.isRequired,projectId:i.string.isRequired,hasSelectedResources:i.bool.isRequired,warning:i.object.isRequired,paramsErrTip:i.shape({projectId:i.string,blockletVersion:i.string,blockletTitle:i.string,blockletDescription:i.string,note:i.string,blockletResource:i.string,blockletHomepage:i.string,blockletSupport:i.string,blockletCommunity:i.string,blockletRepository:i.string,blockletDocker:i.object,dockerImageName:i.string}).isRequired};const wr=[".zip",".gz"],Sr=1024*1024*100,Ir=j.lazy(()=>Oo(()=>import("./index-DhAVA9HZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:a,error:n}){const{t:u,locale:d}=oe(),f=j.useRef(null),x=()=>s?!1:!o||o===Y.UNOWNED_DID?(U.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(L,{component:"a",href:`${S}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(ne,{variant:"outlined",size:"small",onClick:()=>{var C;x()&&((C=f.current)==null||C.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(j.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(Ir,{ref:f,locale:d,popup:!0,onUploadFinish:C=>{var p;l({uploadedResource:C.data.filename}),a({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:wr,maxFileSize:Sr,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.propTypes={app:i.object.isRequired,projectId:i.string.isRequired,readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,error:i.string.isRequired,setParamsErrTip:i.func.isRequired};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:a}){var u;const{t:n}=oe();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(se,{required:!0,disabled:a||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(se,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ve,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}Ke.propTypes={readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,paramsErrTip:i.object.isRequired,setParamsErrTip:i.func.isRequired,loading:i.bool.isRequired};Ke.defaultProps={};function ps(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&ps(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:r,dataKey:l,t:a,readOnly:n}){const u=(o==null?void 0:o.value)||"",[d,f]=j.useState(!1),x=()=>{var O;(O=s[l])==null||O.splice(t,1),r({...s,[l]:[...s[l]]})},S=(O,m)=>{var b;(b=s[l])!=null&&b[t]&&(m?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),r({...s,[l]:[...s[l]]})},C=(O,m)=>{var y;const b=((y=s[l][t])==null?void 0:y.value)||"";s[l][t]={...s[l][t],secure:m,value:m&&b===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":b},r({...s,[l]:[...s[l]]})},p=(O,m)=>{s[l][t]={...s[l][t],shared:m},r({...s,[l]:[...s[l]]})},h=(O,m)=>{var y;const b=((y=s[l][t])==null?void 0:y.value)||"";s[l][t]={...s[l][t],required:m,value:m&&b===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":b},r({...s,[l]:[...s[l]]})},R=(O,m)=>{s[l][t]={...s[l][t],value:m?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...s,[l]:[...s[l]]})},w=O=>{s[l][t]={...s[l][t],description:O.target.value},r({...s,[l]:[...s[l]]})},k=O=>{const m=O.target.value==="web"?"web":"docker";m==="web"&&s.dockerArgs.forEach(W=>{W.type="docker"});const y=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:m,path:m==="docker"?y:"/",protocol:"http",prefix:m==="docker"?y:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...s,dockerArgs:[...s.dockerArgs]})},I=O=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:O.target.value==="direct"?"direct":"service"},r({...s,dockerArgs:[...s.dockerArgs]})},v=O=>{const m=O.target.value;s[l][t]={...s[l][t],prefix:m,path:m==="*"?"/":m},r({...s,[l]:[...s[l]]})},D=O=>{var m;(m=s[l])!=null&&m[t]&&(s[l][t].value=O.target.value),r({...s,[l]:[...s[l]]})},_=u===`$${dt(o.key)}`||o.custom,q=l==="dockerArgs"&&!Uo[o.key],E=dn[o.key],M=l==="dockerEnvs",$=o.key==="--publish";let Q=o.key;return $&&o.type==="web"?Q="--publish (Web)":M&&(Q=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(L,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Q})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(se,{disabled:n||_||q||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:_?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ve,{position:"end",sx:{zoom:.9},children:[(!(E||q)||M||$)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:x,color:q?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:q,onChange:D}),q&&e.jsx(L,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&un[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),d&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a(M?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[E||q||M?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:_,onChange:S,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:h,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:C,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(se,{disabled:n,value:o.description,onChange:w,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),$&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:k,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),$&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:I,children:[e.jsx(fe,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),$&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(se,{disabled:n,value:o.prefix,onChange:v,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}et.propTypes={dockerParams:i.object.isRequired,setDockerParams:i.func.isRequired,dataKey:i.string.isRequired,item:i.object.isRequired,t:i.func.isRequired,readOnly:i.bool.isRequired,index:i.number.isRequired};et.defaultProps={};const Dr=`
|
|
176
|
+
`;function as({text:t}){return t?e.jsx(xn,{wrapperElement:{"data-color-mode":"light"},source:Ys.sanitize(t),rehypePlugins:[[mn,{target:"_blank"}]]}):e.jsx(Ne,{Icon:Dt})}as.propTypes={text:i.string.isRequired};function ds({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:a}){var x;const{t:n}=oe(),[u,d]=j.useState(a?"preview":"write"),f=(S,C)=>{d(C)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(L,{variant:"h6",fontWeight:"bold",sx:{},children:n("common.introduction")}),e.jsxs(Ao,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(se,{disabled:r||a,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Ve,{position:"end",children:[((x=t==null?void 0:t.blockletIntroduction)==null?void 0:x.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(as,{text:t.blockletIntroduction||""})})]})}ds.propTypes={params:i.object.isRequired,setParams:i.func.isRequired,paramsErrTip:i.object.isRequired,setParamsErrTip:i.func.isRequired,readOnly:i.bool.isRequired,loading:i.bool.isRequired};var Gt={},vr=ke;Object.defineProperty(Gt,"__esModule",{value:!0});var mt=Gt.default=void 0,Cr=vr(Re()),yo=e;mt=Gt.default=(0,Cr.default)([(0,yo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,yo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Jt({step:t,ok:o,active:s,error:r,warning:l}){let a="grey.500",n=t+1;return o&&(n=e.jsx(gn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(a="error.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):l?(a="warning.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(a="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:a,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Jt.propTypes={step:i.number,ok:i.bool,active:i.number,error:i.string,warning:i.bool};Jt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function us({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r,params:l,loading:a,paramsErrTip:n,warning:u,viewMode:d,projectId:f}){const{t:x}=oe(),S=()=>{s(R=>R+1)},C=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",h=d||rs({hasSelectedResources:r,params:l,projectId:f,t:x})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx($s,{activeStep:o,orientation:"vertical",children:t.map((R,w)=>{const k={},I=a||!yr({hasSelectedResources:r,params:l,projectId:f,step:w,t:x}),v=a?"":p(w);return v&&(k.optional=e.jsx(L,{variant:"caption",color:"error",children:v}),k.error=!0),e.jsxs(qs,{children:[e.jsx(Ls,{icon:e.jsx(Jt,{error:v,warning:w===0?u.hasWarning:!1,active:h?99:o,step:w,ok:I}),sx:{cursor:"pointer",color:v?"error.main":"inherit"},disabled:!1,onClick:()=>s(w),...k,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:v||!I&&o>w?"error.main":"inherit",children:R.label})}),e.jsxs(As,{children:[e.jsx(L,{fontSize:12,children:R.description}),!h&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(ne,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:v||!I,children:x("common.continue")}),w>0&&e.jsx(ne,{disabled:w===0,onClick:C,sx:{mt:1,mr:1},children:x("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}us.propTypes={steps:i.array.isRequired,activeStep:i.number.isRequired,setActiveStep:i.func.isRequired,params:i.object.isRequired,viewMode:i.string.isRequired,loading:i.bool.isRequired,projectId:i.string.isRequired,hasSelectedResources:i.bool.isRequired,warning:i.object.isRequired,paramsErrTip:i.shape({projectId:i.string,blockletVersion:i.string,blockletTitle:i.string,blockletDescription:i.string,note:i.string,blockletResource:i.string,blockletHomepage:i.string,blockletSupport:i.string,blockletCommunity:i.string,blockletRepository:i.string,blockletDocker:i.object,dockerImageName:i.string}).isRequired};const wr=[".zip",".gz"],Sr=1024*1024*100,Ir=j.lazy(()=>Oo(()=>import("./index-DHdYd4nT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:a,error:n}){const{t:u,locale:d}=oe(),f=j.useRef(null),x=()=>s?!1:!o||o===Y.UNOWNED_DID?(U.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(L,{component:"a",href:`${S}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(ne,{variant:"outlined",size:"small",onClick:()=>{var C;x()&&((C=f.current)==null||C.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(j.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(Ir,{ref:f,locale:d,popup:!0,onUploadFinish:C=>{var p;l({uploadedResource:C.data.filename}),a({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:wr,maxFileSize:Sr,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.propTypes={app:i.object.isRequired,projectId:i.string.isRequired,readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,error:i.string.isRequired,setParamsErrTip:i.func.isRequired};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:a}){var u;const{t:n}=oe();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(se,{required:!0,disabled:a||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(se,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ve,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}Ke.propTypes={readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,paramsErrTip:i.object.isRequired,setParamsErrTip:i.func.isRequired,loading:i.bool.isRequired};Ke.defaultProps={};function ps(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&ps(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:r,dataKey:l,t:a,readOnly:n}){const u=(o==null?void 0:o.value)||"",[d,f]=j.useState(!1),x=()=>{var O;(O=s[l])==null||O.splice(t,1),r({...s,[l]:[...s[l]]})},S=(O,m)=>{var b;(b=s[l])!=null&&b[t]&&(m?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),r({...s,[l]:[...s[l]]})},C=(O,m)=>{var y;const b=((y=s[l][t])==null?void 0:y.value)||"";s[l][t]={...s[l][t],secure:m,value:m&&b===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":b},r({...s,[l]:[...s[l]]})},p=(O,m)=>{s[l][t]={...s[l][t],shared:m},r({...s,[l]:[...s[l]]})},h=(O,m)=>{var y;const b=((y=s[l][t])==null?void 0:y.value)||"";s[l][t]={...s[l][t],required:m,value:m&&b===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":b},r({...s,[l]:[...s[l]]})},R=(O,m)=>{s[l][t]={...s[l][t],value:m?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...s,[l]:[...s[l]]})},w=O=>{s[l][t]={...s[l][t],description:O.target.value},r({...s,[l]:[...s[l]]})},k=O=>{const m=O.target.value==="web"?"web":"docker";m==="web"&&s.dockerArgs.forEach(W=>{W.type="docker"});const y=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:m,path:m==="docker"?y:"/",protocol:"http",prefix:m==="docker"?y:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...s,dockerArgs:[...s.dockerArgs]})},I=O=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:O.target.value==="direct"?"direct":"service"},r({...s,dockerArgs:[...s.dockerArgs]})},v=O=>{const m=O.target.value;s[l][t]={...s[l][t],prefix:m,path:m==="*"?"/":m},r({...s,[l]:[...s[l]]})},D=O=>{var m;(m=s[l])!=null&&m[t]&&(s[l][t].value=O.target.value),r({...s,[l]:[...s[l]]})},_=u===`$${dt(o.key)}`||o.custom,q=l==="dockerArgs"&&!Uo[o.key],E=dn[o.key],M=l==="dockerEnvs",$=o.key==="--publish";let Q=o.key;return $&&o.type==="web"?Q="--publish (Web)":M&&(Q=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(L,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Q})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(se,{disabled:n||_||q||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:_?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ve,{position:"end",sx:{zoom:.9},children:[(!(E||q)||M||$)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:x,color:q?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:q,onChange:D}),q&&e.jsx(L,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&un[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),d&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a(M?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[E||q||M?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:_,onChange:S,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:h,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:C,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),M&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(se,{disabled:n,value:o.description,onChange:w,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),$&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:k,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),$&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:I,children:[e.jsx(fe,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),$&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(se,{disabled:n,value:o.prefix,onChange:v,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}et.propTypes={dockerParams:i.object.isRequired,setDockerParams:i.func.isRequired,dataKey:i.string.isRequired,item:i.object.isRequired,t:i.func.isRequired,readOnly:i.bool.isRequired,index:i.number.isRequired};et.defaultProps={};const Dr=`
|
|
177
177
|
docker run --name postgrest
|
|
178
178
|
-p 3000:3000
|
|
179
179
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
180
180
|
-e PGRST_DB_SCHEMA="public"
|
|
181
181
|
-e PGRST_DB_ANON_ROLE="anon"
|
|
182
182
|
postgrest/postgrest
|
|
183
|
-
`.trim();function Yt({readOnly:t,paramsErrTip:o,setParamsErrTip:s,error:r,params:l,setParams:a}){const{t:n}=oe(),[u,d]=j.useState("dockerParams"),[f,x]=j.useState(""),[S,C]=j.useState(!1),[p,h]=j.useState("--volume"),[R,w]=j.useState(""),[k,I]=j.useState(ho(f)),v=k.dockerArgs||[],D=k.dockerEnvs||[],_=k.dockerImage||"",q=k.dockerCommand||"",E=b=>{const{value:y}=b.target;x(y)};j.useEffect(()=>{l.blockletDocker&&l.blockletDocker.dockerImage&&!_&&I(l.blockletDocker)},[l,_,I]);const M=b=>{const y=ho(b.target.value);I(W=>{let z,G=!1;return y.dockerArgs.forEach(g=>{const A=W.dockerArgs.find(H=>H.key===g.key);A&&(Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(g[H]=J)}),g.proxyBehavior=g.proxyBehavior||"server",g.type==="web"&&(g.path="/",g.protocol="http",g.prefix="/",g.name="publicUrl",g.port="BLOCKLET_PORT",G=!0),!z&&g.key==="--publish"&&(z=g))}),!G&&z&&(z.type="web",z.path="/",z.protocol="http",z.prefix="/",z.name="publicUrl",z.port="BLOCKLET_PORT"),y.dockerEnvs.forEach(g=>{const A=W.dockerEnvs.find(H=>H.key===g.key);A&&Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(g[H]=J)})}),y})},$=()=>{if(C(!1),p==="--env"){I({...k,dockerEnvs:[...D,{key:R,value:"",custom:"",secure:!1,shared:!1,required:!1,description:R}]}),w("");return}I({...k,dockerArgs:[...v,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Q=()=>{C(!1),w("")},O=b=>{const{value:y}=b.target;I({...k,dockerImage:y}),y.indexOf(" ")>-1?s({...o,dockerImageName:n("blocklet.publish.docker.dockerImageNameError")}):s({...o,dockerImageName:""})},m=b=>{const{value:y}=b.target;I({...k,dockerCommand:y});try{hn(y),s({...o,dockerCMD:""})}catch{s({...o,dockerCMD:n("blocklet.publish.docker.dockerCMDError")})}};return j.useEffect(()=>{u==="dockerCommand"&&x(pn(k))},[k,u]),j.useEffect(()=>{a(b=>({...b,blockletDocker:{dockerImage:k.dockerImage,dockerCommand:k.dockerCommand,dockerArgs:k.dockerArgs,dockerEnvs:k.dockerEnvs}}))},[k,a]),e.jsxs(c,{sx:{mt:3},children:[e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[e.jsx(c,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:e.jsxs(Ao,{value:u,onChange:(b,y)=>d(y),children:[e.jsx(Qe,{value:"dockerParams",label:n("blocklet.publish.docker.dockerParams")}),e.jsx(Qe,{value:"dockerCommand",label:n("blocklet.publish.docker.dockerCommand")})]})}),u==="dockerCommand"&&e.jsx(se,{disabled:t,label:n("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Dr,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:E,onBlur:M}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(se,{disabled:t,label:n("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:_,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:O}),e.jsx(se,{disabled:t,label:`Docker CMD (${n("common.optional")})`,placeholder:"Docker CMD",value:q,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:m}),e.jsx(c,{sx:{height:4}}),v.map((b,y)=>e.jsx(et,{index:y,item:b,dockerParams:k,setDockerParams:I,dataKey:"dockerArgs",t:n,readOnly:t},`${b.key}-${y}`)),D.map((b,y)=>e.jsx(et,{index:y,item:b,dockerParams:k,setDockerParams:I,dataKey:"dockerEnvs",t:n,readOnly:t},`${b.key}-${y}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(ne,{onClick:()=>C(!0),children:n("blocklet.publish.docker.addItem")})]})]})]}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r}),S&&e.jsxs(ot,{fullWidth:!0,open:!0,children:[e.jsx($o,{children:n("blocklet.publish.docker.addItem")}),e.jsx(qo,{children:e.jsxs(Ns,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(ft,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:b=>h(b.target.value),children:Object.keys(Uo).map(b=>e.jsx(fe,{value:b,children:b}))}),p==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:n("blocklet.publish.docker.publishTips")}),p==="--volume"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:n("blocklet.publish.docker.volumeTips")}),p==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(se,{value:R,onChange:b=>w(b.target.value),sx:{width:"100%"},label:n("blocklet.publish.docker.envKey")}),e.jsx(Es,{children:n("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Lo,{children:[e.jsx(ne,{onClick:Q,children:n("common.cancel")}),e.jsx(ne,{onClick:$,children:n("common.confirm")})]})]})]})}Yt.propTypes={readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,error:i.string.isRequired,setParamsErrTip:i.func.isRequired,paramsErrTip:i.func.isRequired};Yt.defaultProps={};const Tr=({tabs:t,blocklet:o,ancestors:s=[]})=>{const r=o.meta.did;t.push({label:e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:24,blocklet:o,ancestors:s}),e.jsx(c,{ml:"4px",className:"text",children:e.jsx(c,{children:o.meta.title})})]},r),value:r})},Ro=(t,o)=>{const s=St(t,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return s.blockletComponents?s.blockletComponents=s.blockletComponents.map(r=>({...r,included:!0})):s.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),s},_r={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},vo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function Qt({initUrl:t,...o}){var eo,to;const{projectId:s,mode:r,releaseId:l,componentDid:a=""}=tt(),{t:n}=oe(),{blocklet:u}=Ee(),[d,f]=Ie({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[x,S]=Ie({}),[C,p]=Ie({}),[h,R]=j.useState(!1),[w,k]=Ie(null),{api:I}=ye(),v=Le(T=>T.breakpoints.down("md")),[D,_]=j.useState({}),[q,E]=j.useState(!1),M=j.useRef({}),[$,Q]=Ie({}),[O,m]=j.useState(""),[b,y]=Ie({}),W=t==null?void 0:t.searchParams.get("dependentComponentsMode"),z=W==="readonly",{session:G}=Ue(),{storeList:g}=Vt({fromBlocklet:!0,blocklet:u,componentDid:a,userDid:(eo=G==null?void 0:G.user)==null?void 0:eo.did}),[A,H]=j.useState([]);j.useEffect(()=>{Array.isArray(g)&&g.length>0&&Promise.all(g.map(async T=>({...(await(await fetch(`${T.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:T}))).then(T=>{H(T)})},[g.length]),j.useEffect(()=>{const T={},N={},{logoUrl:pe,screenshotUrls:Ce}=ts(d,u,s);Promise.all(A.map(async he=>{const{maxImageCount:$e,minImageCount:nt,logoImageType:we,imageMinHeight:oo,imageMinWidth:so}=he,Je=Array.isArray(we)?we:we.split(",");T[he.storeInfo.url]||(T[he.storeInfo.url]={}),N[he.storeInfo.url]||(N[he.storeInfo.url]={});const rt=N[he.storeInfo.url],ms=T[he.storeInfo.url];Number($e)<=Ce.length&&(rt.maxImageCount=n("blocklet.publish.storeRule.maxImageCount",{max:$e,count:Ce.length,unit:$e>1?n("blocklet.publish.storeRule.screenshots"):n("blocklet.publish.storeRule.screenshot")})),Number(he.minImageCount)>Ce.length&&(rt.minImageCount=n("blocklet.publish.storeRule.minImageCount",{min:nt,count:Ce.length,unit:nt>1?n("blocklet.publish.storeRule.screenshots"):n("blocklet.publish.storeRule.screenshot")}));const no=pe?pe.split(".").pop():"";no&&!(Je.includes("jpg")?[...Je,"jpeg"]:Je).includes(no)&&(ms.logoFormat=n("blocklet.publish.storeRule.logoFormat",{format:Je.join(",")})),await Promise.all(Ce.map((gs,lt)=>{const it=new Image;return it.src=gs,new Promise(js=>{it.onload=()=>{const{width:ks,height:ys}=it;if(ks<Number(so)||ys<Number(oo)){let We="";switch(lt+1){case 1:We=n("blocklet.publish.storeRule.first");break;case 2:We=n("blocklet.publish.storeRule.second");break;case 3:We=n("blocklet.publish.storeRule.third");break;default:We=`${lt+1}`;break}rt[`imageSize-${lt+1}`]=n("blocklet.publish.storeRule.minImageSize",{width:so,height:oo,name:We})}js()}})}))})).then(()=>{const he=Object.values(T).some(we=>Object.values(we).length>0),$e=Object.values(N).some(we=>Object.values(we).length>0);p({logoErrors:T,screenshotErrors:N,storeList:g,hasWarning:he||$e,hasLogoWarning:he,hasScreenshotWarning:$e})})},[d,u.did,s,A,n]);const J=j.useMemo(()=>{const T={};return Object.keys(b).forEach(N=>{const pe=b[N];pe&&pe.forEach(Ce=>{T[Ce]=!0})}),T},[b]),ze=j.useCallback(T=>{z&&f({blockletComponents:[]}),y(T)},[z,y,f]),P=j.useCallback((...T)=>{Q(...T),S({blockletResource:"",blockletDocker:""})},[]),F=l==="none"?(d==null?void 0:d.lastReleaseId)||"":l,[X,ee]=j.useState(r==="new-release"?4:0),Z=t==null?void 0:t.searchParams.get("resourcesTitle"),ie=t==null?void 0:t.searchParams.get("componentsTitle"),K=[{label:n("blocklet.publish.branding"),description:n("blocklet.publish.steps.branding")},{label:n("common.introduction"),description:n("blocklet.publish.steps.introduction")},{label:Z||n("blocklet.publish.resourceTitle"),description:n("blocklet.publish.steps.resources")},{label:ie||n("common.components"),description:n("blocklet.publish.steps.blocklets")},{label:n("blocklet.publish.versionTitle"),description:n("blocklet.publish.steps.version")}],de=K[X]||K[K.length-1],te=_r[X];j.useEffect(()=>{s&&S({projectId:""})},[s,S]);const ve=j.useMemo(()=>{var T;return(d==null?void 0:d.blockletResourceType)==="resource"?"resource":(T=d==null?void 0:d.blockletComponents)!=null&&T.some(N=>N.included)||Object.keys(J).length||d!=null&&d.uploadedResource?"pack":"resource"},[d==null?void 0:d.blockletComponents,d==null?void 0:d.uploadedResource,J,d==null?void 0:d.blockletResourceType]),B=[],Te=((u==null?void 0:u.children)||[]).filter(T=>{var N;return(N=T.meta.resource)==null?void 0:N.exportApi}).filter(T=>!a||T.meta.did===a);Te.forEach(T=>{Tr({tabs:B,blocklet:T,t:n,ancestors:[u]})});const[Be,He]=j.useState((to=B[0])==null?void 0:to.value),Oe=!q&&(w==null?void 0:w.status)==="published",le=Oe,_e=tn(()=>{if(!t)return;m(t.searchParams.get("logo")),f(N=>{var pe;return{...N,blockletTitle:(N==null?void 0:N.blockletTitle)||t.searchParams.get("title"),blockletDescription:(N==null?void 0:N.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(N==null?void 0:N.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(pe=N==null?void 0:N.blockletComponents)!=null&&pe.length?N==null?void 0:N.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(N==null?void 0:N.note)||t.searchParams.get("note")||"No note"}});const T=t.searchParams.get("resources");try{const N=JSON.parse(T);_(N)}catch{}}),V=async()=>{if(F)try{const T=await I.getRelease({input:{did:u.meta.did,projectId:s,releaseId:F}});if(R(!1),!T.release){U.error("Release not found");return}T.release.note=Xo(T.release.note,"note"),T.release=ps(T.release),r!=="view"&&(T.release.note=""),f(N=>Ro({...N,...T.release,blockletVersion:r==="create"||r==="new-release"?qe.inc(T.release.blockletVersion,"patch"):T.release.blockletVersion},u)),k(T.release)}catch(T){R(!1),U.error(Ae(T))}},re=async()=>{if(s===Y.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!s){U.error(n("blocklet.publish.errorTip.noDid"));return}try{const N=(await Qo(I.getProject,[{input:{did:u.meta.did,projectId:s}}],{key:"getProject"})).project||{};N.blockletVersion?(r==="create"||r==="new-release")&&qe.valid(N.blockletVersion)&&(N.blockletVersion=qe.inc(N.blockletVersion,"patch")):N.blockletVersion="0.0.1";const pe=Ro(N,u);f(pe),N.lastReleaseId||_e()}catch(T){U.error(Ae(T))}},Pe=j.useCallback(async()=>{R(!0);try{if(r==="view"){if(!F){U.error("Empty release id");return}await re(),await V();return}await re(),F&&(E(!0),await V())}finally{R(!1)}},[r,F]),fs=T=>{f({blockletComponents:T})},bs=T=>{f({blockletResourceType:T})};j.useEffect(()=>{Pe()},[Pe]),j.useEffect(()=>{s===Y.UNOWNED_DID&&(r==="create"||r==="new-release")&&t&&_e()},[s,t,r,_e]),j.useEffect(()=>{d.contentType==="docker"?f({resourceFromSelect:!1}):d.contentType==="blocklet"?f({resourceFromSelect:!0}):d.contentType==="upload"&&f({resourceFromSelect:!1})},[d.contentType,f]);const Zt=j.useMemo(()=>!!Object.keys($).find(T=>!!$[T].length),[$]);if(!d&&h)return e.jsx(Fe,{});if(!d)return null;const Kt=Te.find(T=>T.meta.did===Be),xs=T=>{He(T)};return e.jsxs(Pr,{...o,children:[e.jsx(cs,{blocklet:u,release:w,getData:Pe,getRelease:V,mode:r,params:d,setParams:f,setParamsErrTip:S,warning:C,readOnly:le,isPublished:Oe,loading:h,setLoading:R,initLogoUrl:O,releaseId:F,projectId:s,projectType:ve,resourceComponents:Te,resourceComponentsMap:b,resourceRelateComponents:J,resourceItem:Kt,saveSelectedEventsRef:M,hasSelectedResources:Zt,releaseUsedLast:q,setReleaseUsedLast:E,setRelease:k,paramsErrTip:x}),e.jsxs(c,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[e.jsx(c,{pt:3}),e.jsxs(c,{sx:{gap:3},display:"flex",flexDirection:v?"column":"row",children:[!v&&e.jsx(us,{steps:K,loading:h,viewMode:r==="view",params:d,hasSelectedResources:Zt||d.uploadedResource,paramsErrTip:x,warning:C,activeStep:X,setActiveStep:ee,projectId:s,resourcesUrlTitle:Z,componentsUrlTitle:ie}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!v&&te!=="introduction"&&e.jsxs(L,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[de.label,te==="branding"&&e.jsx(me,{title:n("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(c,{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:e.jsx(en,{})})})]}),(v||te==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(ss,{projectId:s,setParams:f,setParamsErrTip:S,warning:C,params:d,componentDid:a,blocklet:u,initUrl:t,loading:h,setLoading:R,paramsErrTip:x,readOnly:le,initLogoUrl:O,setInitLogoUrl:m})}),v&&e.jsx(c,{flexDirection:"column",children:e.jsx(Ke,{loading:h,params:d,paramsErrTip:x,setParams:f,setParamsErrTip:S,readOnly:le})}),(v||te==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:v?5:0,width:"100%"},children:e.jsx(ds,{loading:h,readOnly:le,params:d,setParams:f,paramsErrTip:x,setParamsErrTip:S})}),v&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:K[vo.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:v||te==="resources"?"flex":"none",flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{sx:{flex:1},children:[e.jsxs(zs,{onChange:T=>f({contentType:T.target.value}),children:[e.jsx(Xe,{value:"blocklet",disabled:le,control:e.jsx(at,{size:"small",checked:d.contentType==="blocklet"}),label:n("blocklet.publish.resourceSelect")}),e.jsx(Xe,{value:"upload",disabled:le,control:e.jsx(at,{size:"small",checked:d.contentType==="upload"}),label:n("blocklet.publish.resourceUpload")}),e.jsx(Xe,{value:"docker",disabled:le,control:e.jsx(at,{size:"small",checked:d.contentType==="docker"}),label:n("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:d.contentType==="blocklet"?"block":"none",children:[!a&&e.jsx(Js,{tabs:B,current:Be,onChange:xs,sx:{ml:-2,mt:2,maxWidth:v?window.innerWidth-24:"100%"}}),e.jsx(Wt,{loading:h,initialResources:D,saveSelectedEventsRef:M,selectedResourceIds:$,setSelectedResourceIds:P,setResourceComponentsMap:ze,error:x.blockletResource,app:u,readOnly:le,component:Kt,componentDid:a,initUrl:t,params:d,showTree:d.contentType==="blocklet",setParams:f,projectId:s===Y.UNOWNED_DID?"":s,releaseUsedLast:q,release:{...w,id:F}})]}),d.contentType==="upload"&&e.jsx(Xt,{app:u,readOnly:le,projectId:s===Y.UNOWNED_DID?"":s,params:d,error:x.blockletResource,setParams:f,setParamsErrTip:S}),d.contentType==="docker"&&e.jsx(Yt,{app:u,readOnly:le,projectId:s===Y.UNOWNED_DID?"":s,params:d,error:x.blockletResource,setParams:f,setParamsErrTip:S,paramsErrTip:x})]})})}),v&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:K[vo.blocklets].label}),(v||te==="blocklets")&&e.jsx(c,{flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsx(c,{sx:{flex:1},children:e.jsx(Nt,{projectType:ve,disabled:h||le,app:u,value:(d==null?void 0:d.blockletComponents)||[],blockletResourceType:(d==null?void 0:d.blockletResourceType)||"",onChange:fs,onChangeBlockletResourceType:bs,resourceRelateComponents:J,dependentComponentsMode:W})})})}),!v&&te==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(Ke,{loading:h,params:d,paramsErrTip:x,setParams:f,setParamsErrTip:S,readOnly:le})})]})]})]})]})}Qt.propTypes={initUrl:i.object};Qt.defaultProps={initUrl:null};const Pr=ge.div`
|
|
183
|
+
`.trim();function Yt({readOnly:t,paramsErrTip:o,setParamsErrTip:s,error:r,params:l,setParams:a}){const{t:n}=oe(),[u,d]=j.useState("dockerParams"),[f,x]=j.useState(""),[S,C]=j.useState(!1),[p,h]=j.useState("--volume"),[R,w]=j.useState(""),[k,I]=j.useState(ho(f)),v=k.dockerArgs||[],D=k.dockerEnvs||[],_=k.dockerImage||"",q=k.dockerCommand||"",E=b=>{const{value:y}=b.target;x(y)};j.useEffect(()=>{l.blockletDocker&&l.blockletDocker.dockerImage&&!_&&I(l.blockletDocker)},[l,_,I]);const M=b=>{const y=ho(b.target.value);I(W=>{let z,J=!1;return y.dockerArgs.forEach(g=>{const A=W.dockerArgs.find(H=>H.key===g.key);A&&(Object.entries(A).forEach(([H,G])=>{G!=null&&H!=="value"&&(g[H]=G)}),g.proxyBehavior=g.proxyBehavior||"server",g.type==="web"&&(g.path="/",g.protocol="http",g.prefix="/",g.name="publicUrl",g.port="BLOCKLET_PORT",J=!0),!z&&g.key==="--publish"&&(z=g))}),!J&&z&&(z.type="web",z.path="/",z.protocol="http",z.prefix="/",z.name="publicUrl",z.port="BLOCKLET_PORT"),y.dockerEnvs.forEach(g=>{const A=W.dockerEnvs.find(H=>H.key===g.key);A&&Object.entries(A).forEach(([H,G])=>{G!=null&&H!=="value"&&(g[H]=G)})}),y})},$=()=>{if(C(!1),p==="--env"){I({...k,dockerEnvs:[...D,{key:R,value:"",custom:"",secure:!1,shared:!1,required:!1,description:R}]}),w("");return}I({...k,dockerArgs:[...v,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Q=()=>{C(!1),w("")},O=b=>{const{value:y}=b.target;I({...k,dockerImage:y}),y.indexOf(" ")>-1?s({...o,dockerImageName:n("blocklet.publish.docker.dockerImageNameError")}):s({...o,dockerImageName:""})},m=b=>{const{value:y}=b.target;I({...k,dockerCommand:y});try{hn(y),s({...o,dockerCMD:""})}catch{s({...o,dockerCMD:n("blocklet.publish.docker.dockerCMDError")})}};return j.useEffect(()=>{u==="dockerCommand"&&x(pn(k))},[k,u]),j.useEffect(()=>{a(b=>({...b,blockletDocker:{dockerImage:k.dockerImage,dockerCommand:k.dockerCommand,dockerArgs:k.dockerArgs,dockerEnvs:k.dockerEnvs}}))},[k,a]),e.jsxs(c,{sx:{mt:3},children:[e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[e.jsx(c,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:e.jsxs(Ao,{value:u,onChange:(b,y)=>d(y),children:[e.jsx(Qe,{value:"dockerParams",label:n("blocklet.publish.docker.dockerParams")}),e.jsx(Qe,{value:"dockerCommand",label:n("blocklet.publish.docker.dockerCommand")})]})}),u==="dockerCommand"&&e.jsx(se,{disabled:t,label:n("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Dr,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:E,onBlur:M}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(se,{disabled:t,label:n("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:_,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:O}),e.jsx(se,{disabled:t,label:`Docker CMD (${n("common.optional")})`,placeholder:"Docker CMD",value:q,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:m}),e.jsx(c,{sx:{height:4}}),v.map((b,y)=>e.jsx(et,{index:y,item:b,dockerParams:k,setDockerParams:I,dataKey:"dockerArgs",t:n,readOnly:t},`${b.key}-${y}`)),D.map((b,y)=>e.jsx(et,{index:y,item:b,dockerParams:k,setDockerParams:I,dataKey:"dockerEnvs",t:n,readOnly:t},`${b.key}-${y}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(ne,{onClick:()=>C(!0),children:n("blocklet.publish.docker.addItem")})]})]})]}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r}),S&&e.jsxs(ot,{fullWidth:!0,open:!0,children:[e.jsx($o,{children:n("blocklet.publish.docker.addItem")}),e.jsx(qo,{children:e.jsxs(Ns,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(ft,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:b=>h(b.target.value),children:Object.keys(Uo).map(b=>e.jsx(fe,{value:b,children:b}))}),p==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:n("blocklet.publish.docker.publishTips")}),p==="--volume"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:n("blocklet.publish.docker.volumeTips")}),p==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(se,{value:R,onChange:b=>w(b.target.value),sx:{width:"100%"},label:n("blocklet.publish.docker.envKey")}),e.jsx(Es,{children:n("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Lo,{children:[e.jsx(ne,{onClick:Q,children:n("common.cancel")}),e.jsx(ne,{onClick:$,children:n("common.confirm")})]})]})]})}Yt.propTypes={readOnly:i.bool.isRequired,params:i.object.isRequired,setParams:i.func.isRequired,error:i.string.isRequired,setParamsErrTip:i.func.isRequired,paramsErrTip:i.func.isRequired};Yt.defaultProps={};const Tr=({tabs:t,blocklet:o,ancestors:s=[]})=>{const r=o.meta.did;t.push({label:e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:24,blocklet:o,ancestors:s}),e.jsx(c,{ml:"4px",className:"text",children:e.jsx(c,{children:o.meta.title})})]},r),value:r})},Ro=(t,o)=>{const s=St(t,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return s.blockletComponents?s.blockletComponents=s.blockletComponents.map(r=>({...r,included:!0})):s.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),s},_r={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},vo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function Qt({initUrl:t,...o}){var eo,to;const{projectId:s,mode:r,releaseId:l,componentDid:a=""}=tt(),{t:n}=oe(),{blocklet:u}=Ee(),[d,f]=Ie({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[x,S]=Ie({}),[C,p]=Ie({}),[h,R]=j.useState(!1),[w,k]=Ie(null),{api:I}=ye(),v=Le(T=>T.breakpoints.down("md")),[D,_]=j.useState({}),[q,E]=j.useState(!1),M=j.useRef({}),[$,Q]=Ie({}),[O,m]=j.useState(""),[b,y]=Ie({}),W=t==null?void 0:t.searchParams.get("dependentComponentsMode"),z=W==="readonly",{session:J}=Ue(),{storeList:g}=Vt({fromBlocklet:!0,blocklet:u,componentDid:a,userDid:(eo=J==null?void 0:J.user)==null?void 0:eo.did}),[A,H]=j.useState([]);j.useEffect(()=>{Array.isArray(g)&&g.length>0&&Promise.all(g.map(async T=>({...(await(await fetch(`${T.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:T}))).then(T=>{H(T)})},[g.length]),j.useEffect(()=>{const T={},N={},{logoUrl:pe,screenshotUrls:Ce}=ts(d,u,s);Promise.all(A.map(async he=>{const{maxImageCount:$e,minImageCount:nt,logoImageType:we,imageMinHeight:oo,imageMinWidth:so}=he,Ge=Array.isArray(we)?we:we.split(",");T[he.storeInfo.url]||(T[he.storeInfo.url]={}),N[he.storeInfo.url]||(N[he.storeInfo.url]={});const rt=N[he.storeInfo.url],ms=T[he.storeInfo.url];Number($e)<=Ce.length&&(rt.maxImageCount=n("blocklet.publish.storeRule.maxImageCount",{max:$e,count:Ce.length,unit:$e>1?n("blocklet.publish.storeRule.screenshots"):n("blocklet.publish.storeRule.screenshot")})),Number(he.minImageCount)>Ce.length&&(rt.minImageCount=n("blocklet.publish.storeRule.minImageCount",{min:nt,count:Ce.length,unit:nt>1?n("blocklet.publish.storeRule.screenshots"):n("blocklet.publish.storeRule.screenshot")}));const no=pe?pe.split(".").pop():"";no&&!(Ge.includes("jpg")?[...Ge,"jpeg"]:Ge).includes(no)&&(ms.logoFormat=n("blocklet.publish.storeRule.logoFormat",{format:Ge.join(",")})),await Promise.all(Ce.map((gs,lt)=>{const it=new Image;return it.src=gs,new Promise(js=>{it.onload=()=>{const{width:ks,height:ys}=it;if(ks<Number(so)||ys<Number(oo)){let We="";switch(lt+1){case 1:We=n("blocklet.publish.storeRule.first");break;case 2:We=n("blocklet.publish.storeRule.second");break;case 3:We=n("blocklet.publish.storeRule.third");break;default:We=`${lt+1}`;break}rt[`imageSize-${lt+1}`]=n("blocklet.publish.storeRule.minImageSize",{width:so,height:oo,name:We})}js()}})}))})).then(()=>{const he=Object.values(T).some(we=>Object.values(we).length>0),$e=Object.values(N).some(we=>Object.values(we).length>0);p({logoErrors:T,screenshotErrors:N,storeList:g,hasWarning:he||$e,hasLogoWarning:he,hasScreenshotWarning:$e})})},[d,u.did,s,A,n]);const G=j.useMemo(()=>{const T={};return Object.keys(b).forEach(N=>{const pe=b[N];pe&&pe.forEach(Ce=>{T[Ce]=!0})}),T},[b]),ze=j.useCallback(T=>{z&&f({blockletComponents:[]}),y(T)},[z,y,f]),P=j.useCallback((...T)=>{Q(...T),S({blockletResource:"",blockletDocker:""})},[]),F=l==="none"?(d==null?void 0:d.lastReleaseId)||"":l,[X,ee]=j.useState(r==="new-release"?4:0),Z=t==null?void 0:t.searchParams.get("resourcesTitle"),ie=t==null?void 0:t.searchParams.get("componentsTitle"),K=[{label:n("blocklet.publish.branding"),description:n("blocklet.publish.steps.branding")},{label:n("common.introduction"),description:n("blocklet.publish.steps.introduction")},{label:Z||n("blocklet.publish.resourceTitle"),description:n("blocklet.publish.steps.resources")},{label:ie||n("common.components"),description:n("blocklet.publish.steps.blocklets")},{label:n("blocklet.publish.versionTitle"),description:n("blocklet.publish.steps.version")}],de=K[X]||K[K.length-1],te=_r[X];j.useEffect(()=>{s&&S({projectId:""})},[s,S]);const ve=j.useMemo(()=>{var T;return(d==null?void 0:d.blockletResourceType)==="resource"?"resource":(T=d==null?void 0:d.blockletComponents)!=null&&T.some(N=>N.included)||Object.keys(G).length||d!=null&&d.uploadedResource?"pack":"resource"},[d==null?void 0:d.blockletComponents,d==null?void 0:d.uploadedResource,G,d==null?void 0:d.blockletResourceType]),B=[],Te=((u==null?void 0:u.children)||[]).filter(T=>{var N;return(N=T.meta.resource)==null?void 0:N.exportApi}).filter(T=>!a||T.meta.did===a);Te.forEach(T=>{Tr({tabs:B,blocklet:T,t:n,ancestors:[u]})});const[Be,He]=j.useState((to=B[0])==null?void 0:to.value),Oe=!q&&(w==null?void 0:w.status)==="published",le=Oe,_e=tn(()=>{if(!t)return;m(t.searchParams.get("logo")),f(N=>{var pe;return{...N,blockletTitle:(N==null?void 0:N.blockletTitle)||t.searchParams.get("title"),blockletDescription:(N==null?void 0:N.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(N==null?void 0:N.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(pe=N==null?void 0:N.blockletComponents)!=null&&pe.length?N==null?void 0:N.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(N==null?void 0:N.note)||t.searchParams.get("note")||"No note"}});const T=t.searchParams.get("resources");try{const N=JSON.parse(T);_(N)}catch{}}),V=async()=>{if(F)try{const T=await I.getRelease({input:{did:u.meta.did,projectId:s,releaseId:F}});if(R(!1),!T.release){U.error("Release not found");return}T.release.note=Xo(T.release.note,"note"),T.release=ps(T.release),r!=="view"&&(T.release.note=""),f(N=>Ro({...N,...T.release,blockletVersion:r==="create"||r==="new-release"?qe.inc(T.release.blockletVersion,"patch"):T.release.blockletVersion},u)),k(T.release)}catch(T){R(!1),U.error(Ae(T))}},re=async()=>{if(s===Y.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!s){U.error(n("blocklet.publish.errorTip.noDid"));return}try{const N=(await Qo(I.getProject,[{input:{did:u.meta.did,projectId:s}}],{key:"getProject"})).project||{};N.blockletVersion?(r==="create"||r==="new-release")&&qe.valid(N.blockletVersion)&&(N.blockletVersion=qe.inc(N.blockletVersion,"patch")):N.blockletVersion="0.0.1";const pe=Ro(N,u);f(pe),N.lastReleaseId||_e()}catch(T){U.error(Ae(T))}},Pe=j.useCallback(async()=>{R(!0);try{if(r==="view"){if(!F){U.error("Empty release id");return}await re(),await V();return}await re(),F&&(E(!0),await V())}finally{R(!1)}},[r,F]),fs=T=>{f({blockletComponents:T})},bs=T=>{f({blockletResourceType:T})};j.useEffect(()=>{Pe()},[Pe]),j.useEffect(()=>{s===Y.UNOWNED_DID&&(r==="create"||r==="new-release")&&t&&_e()},[s,t,r,_e]),j.useEffect(()=>{d.contentType==="docker"?f({resourceFromSelect:!1}):d.contentType==="blocklet"?f({resourceFromSelect:!0}):d.contentType==="upload"&&f({resourceFromSelect:!1})},[d.contentType,f]);const Zt=j.useMemo(()=>!!Object.keys($).find(T=>!!$[T].length),[$]);if(!d&&h)return e.jsx(Fe,{});if(!d)return null;const Kt=Te.find(T=>T.meta.did===Be),xs=T=>{He(T)};return e.jsxs(Pr,{...o,children:[e.jsx(cs,{blocklet:u,release:w,getData:Pe,getRelease:V,mode:r,params:d,setParams:f,setParamsErrTip:S,warning:C,readOnly:le,isPublished:Oe,loading:h,setLoading:R,initLogoUrl:O,releaseId:F,projectId:s,projectType:ve,resourceComponents:Te,resourceComponentsMap:b,resourceRelateComponents:G,resourceItem:Kt,saveSelectedEventsRef:M,hasSelectedResources:Zt,releaseUsedLast:q,setReleaseUsedLast:E,setRelease:k,paramsErrTip:x}),e.jsxs(c,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[e.jsx(c,{pt:3}),e.jsxs(c,{sx:{gap:3},display:"flex",flexDirection:v?"column":"row",children:[!v&&e.jsx(us,{steps:K,loading:h,viewMode:r==="view",params:d,hasSelectedResources:Zt||d.uploadedResource,paramsErrTip:x,warning:C,activeStep:X,setActiveStep:ee,projectId:s,resourcesUrlTitle:Z,componentsUrlTitle:ie}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!v&&te!=="introduction"&&e.jsxs(L,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[de.label,te==="branding"&&e.jsx(me,{title:n("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(c,{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:e.jsx(en,{})})})]}),(v||te==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(ss,{projectId:s,setParams:f,setParamsErrTip:S,warning:C,params:d,componentDid:a,blocklet:u,initUrl:t,loading:h,setLoading:R,paramsErrTip:x,readOnly:le,initLogoUrl:O,setInitLogoUrl:m})}),v&&e.jsx(c,{flexDirection:"column",children:e.jsx(Ke,{loading:h,params:d,paramsErrTip:x,setParams:f,setParamsErrTip:S,readOnly:le})}),(v||te==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:v?5:0,width:"100%"},children:e.jsx(ds,{loading:h,readOnly:le,params:d,setParams:f,paramsErrTip:x,setParamsErrTip:S})}),v&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:K[vo.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:v||te==="resources"?"flex":"none",flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{sx:{flex:1},children:[e.jsxs(zs,{onChange:T=>f({contentType:T.target.value}),children:[e.jsx(Xe,{value:"blocklet",disabled:le,control:e.jsx(at,{size:"small",checked:d.contentType==="blocklet"}),label:n("blocklet.publish.resourceSelect")}),e.jsx(Xe,{value:"upload",disabled:le,control:e.jsx(at,{size:"small",checked:d.contentType==="upload"}),label:n("blocklet.publish.resourceUpload")}),e.jsx(Xe,{value:"docker",disabled:le,control:e.jsx(at,{size:"small",checked:d.contentType==="docker"}),label:n("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:d.contentType==="blocklet"?"block":"none",children:[!a&&e.jsx(Gs,{tabs:B,current:Be,onChange:xs,sx:{ml:-2,mt:2,maxWidth:v?window.innerWidth-24:"100%"}}),e.jsx(Wt,{loading:h,initialResources:D,saveSelectedEventsRef:M,selectedResourceIds:$,setSelectedResourceIds:P,setResourceComponentsMap:ze,error:x.blockletResource,app:u,readOnly:le,component:Kt,componentDid:a,initUrl:t,params:d,showTree:d.contentType==="blocklet",setParams:f,projectId:s===Y.UNOWNED_DID?"":s,releaseUsedLast:q,release:{...w,id:F}})]}),d.contentType==="upload"&&e.jsx(Xt,{app:u,readOnly:le,projectId:s===Y.UNOWNED_DID?"":s,params:d,error:x.blockletResource,setParams:f,setParamsErrTip:S}),d.contentType==="docker"&&e.jsx(Yt,{app:u,readOnly:le,projectId:s===Y.UNOWNED_DID?"":s,params:d,error:x.blockletResource,setParams:f,setParamsErrTip:S,paramsErrTip:x})]})})}),v&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:K[vo.blocklets].label}),(v||te==="blocklets")&&e.jsx(c,{flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsx(c,{sx:{flex:1},children:e.jsx(Nt,{projectType:ve,disabled:h||le,app:u,value:(d==null?void 0:d.blockletComponents)||[],blockletResourceType:(d==null?void 0:d.blockletResourceType)||"",onChange:fs,onChangeBlockletResourceType:bs,resourceRelateComponents:G,dependentComponentsMode:W})})})}),!v&&te==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(Ke,{loading:h,params:d,paramsErrTip:x,setParams:f,setParamsErrTip:S,readOnly:le})})]})]})]})]})}Qt.propTypes={initUrl:i.object};Qt.defaultProps={initUrl:null};const Pr=ge.div`
|
|
184
184
|
.section {
|
|
185
185
|
&.full-width {
|
|
186
186
|
max-width: 100%;
|