@abtnode/blocklet-services 1.16.43-beta-20250509-094134-34c76f98 → 1.16.43-beta-20250510-123357-65a2988c
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/emails/_components/activity.js +1 -1
- package/api/emails/_components/footer.js +12 -4
- package/api/emails/_components/token.js +3 -1
- package/api/emails/_templates/activity-notification.js +2 -2
- package/api/emails/_templates/kyc-code-verify.js +2 -2
- package/api/emails/_templates/new-user-session.js +2 -2
- package/api/emails/_templates/notification.js +2 -2
- package/api/emails/_templates/verify-code.js +2 -2
- package/api/libs/email.js +8 -3
- package/dist/assets/{AdapterDayjs-DWoymUZR.js → AdapterDayjs-BiPHzcUP.js} +1 -1
- package/dist/assets/{ArrowDropDown-oIFrKvRQ.js → ArrowDropDown-Dghek9CI.js} +1 -1
- package/dist/assets/{CheckCircle-DKTlmPGr.js → CheckCircle-Dvhgeo9j.js} +1 -1
- package/dist/assets/{ChevronLeft-CFwnl5kG.js → ChevronLeft-DE33N57i.js} +1 -1
- package/dist/assets/{ChevronRight-8T5vdE8C.js → ChevronRight-BfbPIE2b.js} +1 -1
- package/dist/assets/{Community-BUrh_Kqh.js → Community-2MKVAbIk.js} +1 -1
- package/dist/assets/{DeleteOutline-1ZpdOBb4.js → DeleteOutline-B6efX_Fy.js} +1 -1
- package/dist/assets/{Done-1iBqzwts.js → Done-Ct5slWpT.js} +1 -1
- package/dist/assets/{Download-BZiCoF-V.js → Download-DKQGRFHf.js} +1 -1
- package/dist/assets/{Edit-BGameSEw.js → Edit-BLsIdIOp.js} +1 -1
- package/dist/assets/{EditIcon-Tb4i_lkD.js → EditIcon-CwTCQzs9.js} +1 -1
- package/dist/assets/{Email-DVjqqt2m.js → Email-DOy8vL0N.js} +1 -1
- package/dist/assets/{Error-DmLM9r9y.js → Error-wpqrAfUT.js} +1 -1
- package/dist/assets/{ExpandLess-mzw0LYV7.js → ExpandLess-CJXkgMMr.js} +1 -1
- package/dist/assets/{Google-DknSY4FA.js → Google-BbAgcDQ_.js} +1 -1
- package/dist/assets/{Holiday-Aqm_6mkn.js → Holiday-DT-VjgQP.js} +1 -1
- package/dist/assets/{InfoOutlined-BMdv5FNj.js → InfoOutlined-Dy7jTc7H.js} +1 -1
- package/dist/assets/{Launch-BGXBIBAE.js → Launch-DBKe0gh0.js} +1 -1
- package/dist/assets/{LaunchOutlined-C1cAhHQM.js → LaunchOutlined-BIq6YUU8.js} +1 -1
- package/dist/assets/{Location-9D-5nMVA.js → Location-C__VfR4D.js} +1 -1
- package/dist/assets/{LockIcon-DJgkKDXB.js → LockIcon-DIGiHKHl.js} +1 -1
- package/dist/assets/{Meeting-Drc_0V1u.js → Meeting-Cn2X2Ix7.js} +1 -1
- package/dist/assets/{MoreHoriz-KJHmH0lv.js → MoreHoriz-BxJelL2A.js} +1 -1
- package/dist/assets/{OffSick-C991mOvw.js → OffSick-Cnicwu8x.js} +1 -1
- package/dist/assets/{Phone-BfBgFKKG.js → Phone-CoX1qzAs.js} +1 -1
- package/dist/assets/{PlayArrow-CY4IxSfG.js → PlayArrow-C9IFmc-j.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-dkY86QWO.js → QuestionMarkCircle-DCM9zW3a.js} +1 -1
- package/dist/assets/{ServerLogo-BTwLn5Zv.js → ServerLogo-CfbYjQbP.js} +1 -1
- package/dist/assets/{Timezone-BWB21Pdc.js → Timezone-CCdgxxpv.js} +1 -1
- package/dist/assets/{TuneOutlined-BEZh1SVU.js → TuneOutlined-CB7t_nGq.js} +1 -1
- package/dist/assets/{ViewList-BwVW4Mbn.js → ViewList-B4hmqizo.js} +1 -1
- package/dist/assets/{WorkingRemotely-DHNo6euv.js → WorkingRemotely-DWT54kH1.js} +1 -1
- package/dist/assets/{access-control-BULUPRVa.js → access-control-RJu7xYI3.js} +1 -1
- package/dist/assets/{actions-7FcWNRsN.js → actions-BCWb2ez1.js} +1 -1
- package/dist/assets/{add-component-core-BMiZ7LE5.js → add-component-core-DRAzXCeg.js} +2 -2
- package/dist/assets/add-resource-BDJuVU8K.js +1 -0
- package/dist/assets/{addon-vARTsq3u.js → addon-ygDS7Fug.js} +1 -1
- package/dist/assets/{advanced-u-DAzAIF.js → advanced-CFME3Vrl.js} +3 -3
- package/dist/assets/{appearance-DROrcrHA.js → appearance-BqJwEmtt.js} +1 -1
- package/dist/assets/ar-Blzb8h2o.js +7 -0
- package/dist/assets/{audit-logs-CcVb9ghw.js → audit-logs-CtFZQHby.js} +3 -3
- package/dist/assets/{authorize-ChpWebj3.js → authorize-WekjQ3_M.js} +1 -1
- package/dist/assets/{base32-HzVjc8tz.js → base32-BbrXtXL6.js} +1 -1
- package/dist/assets/{branding-BbyygUCZ.js → branding-BTfb8_b4.js} +2 -2
- package/dist/assets/{branding-Be5nWHmr.js → branding-CS-f1gMT.js} +3 -3
- package/dist/assets/{bundle-avatar-CkhAjy4c.js → bundle-avatar-Db5l8MQ4.js} +1 -1
- package/dist/assets/button-DotKXyjc.js +1 -0
- package/dist/assets/click-to-copy-BxhgzyYL.js +1 -0
- package/dist/assets/collapse-Bn_BDlF9.js +1 -0
- package/dist/assets/{complete-B8pYAeSZ.js → complete-BRApuFsV.js} +1 -1
- package/dist/assets/{component-B79RqFMg.js → component-C7g4FGFm.js} +1 -1
- package/dist/assets/{config-Cr_HvxTH.js → config-C8AXD1JH.js} +1 -1
- package/dist/assets/{config-navigation-BEcY6Wrz.js → config-navigation-B7r4dV5S.js} +4 -4
- package/dist/assets/{config-zGEZcVMw.js → config-qG8JCIJ_.js} +1 -1
- package/dist/assets/{config-space-CxYC75c6.js → config-space-CSKkMgqX.js} +1 -1
- package/dist/assets/{confirm-qyOtSX3L.js → confirm-BvUfAlkx.js} +1 -1
- package/dist/assets/{connect-D3ZxLXkG.js → connect-B2HOOYzS.js} +1 -1
- package/dist/assets/{connect-sAGOXOYo.js → connect-DGPdKMcu.js} +1 -1
- package/dist/assets/{connect-to-DjFFSoXW.js → connect-to-BBtnljQ-.js} +1 -1
- package/dist/assets/{content-layout-HQq6mBBk.js → content-layout-DzqMXifY.js} +1 -1
- package/dist/assets/dashboard-C124DXmc.js +279 -0
- package/dist/assets/de-BxI5dM9K.js +7 -0
- package/dist/assets/{delete-confirm-DQ_YJQpj.js → delete-confirm-BBaXcAXg.js} +1 -1
- package/dist/assets/{did-address-Dd9R3pkY.js → did-address-BKBBjFqv.js} +1 -1
- package/dist/assets/{domain-B2_scx4B.js → domain-DTrwCkop.js} +1 -1
- package/dist/assets/{domain-action-card-DE7xLk29.js → domain-action-card-D-WETV-f.js} +1 -1
- package/dist/assets/domains-BxkmGeZE.js +1 -0
- package/dist/assets/{dot-B5LFAb8e.js → dot-C05enzim.js} +1 -1
- package/dist/assets/{email-CWYkPTia.js → email-Bc5KLu5Q.js} +1 -1
- package/dist/assets/{empty-spinner-g1Jw7iuj.js → empty-spinner-BZlBh4vA.js} +1 -1
- package/dist/assets/{es-BUCdgg9a.js → es-BuUaHPig.js} +3 -3
- package/dist/assets/{exchange-passport-BbC_bBga.js → exchange-passport-DbNEDTaa.js} +1 -1
- package/dist/assets/fr-DezMACmP.js +7 -0
- package/dist/assets/{fuel-BdagEU33.js → fuel-DzWcrU-I.js} +1 -1
- package/dist/assets/{gen-access-key-Cf76OFN7.js → gen-access-key-D-ftFU9F.js} +1 -1
- package/dist/assets/get-safe-url-2RcRY8gU.js +1 -0
- package/dist/assets/get-safe-url-CEvgWyL5.js +1 -0
- package/dist/assets/hi-ClbEozhq.js +5 -0
- package/dist/assets/{home-BSxVGonp.js → home-DXj5oFeO.js} +1 -1
- package/dist/assets/id-CXYm-1K3.js +7 -0
- package/dist/assets/{iframe-DXRYs3PX.js → iframe-CIVgAJuH.js} +1 -1
- package/dist/assets/{index-Djpx18Tz.js → index--HbH1n1_.js} +1 -1
- package/dist/assets/index-9ixwCOkw.js +113 -0
- package/dist/assets/{index-CzGXBMFc.js → index-BMD-pSqT.js} +1 -1
- package/dist/assets/{index-Cc-_2bD1.js → index-BMPpz8ni.js} +1 -1
- package/dist/assets/{index-aMtQhU6T.js → index-BVU8_1Ed.js} +3 -3
- package/dist/assets/index-B_fwtN9z.js +55 -0
- package/dist/assets/{index-DEsvwKlq.js → index-BemEiFHE.js} +1 -1
- package/dist/assets/{index-Cy1Hvxt0.js → index-BmWVfEGP.js} +1 -1
- package/dist/assets/{index-C-RHInKj.js → index-Bxd86KLJ.js} +4 -4
- package/dist/assets/{index-DF0z_zii.js → index-C0SLCehH.js} +1 -1
- package/dist/assets/index-CHDiquXf.js +62 -0
- package/dist/assets/{index-BQJa9ZJC.js → index-CKheO_aT.js} +1 -1
- package/dist/assets/{index-TE82Z_py.js → index-CUfP1M2j.js} +1 -1
- package/dist/assets/{index-mbuQZLIX.js → index-Ce2NSVmU.js} +1 -1
- package/dist/assets/index-CyUXddLG.js +284 -0
- package/dist/assets/index-D09AfnR1.js +11 -0
- package/dist/assets/index-D64RNKdt.js +99 -0
- package/dist/assets/{index-BSuIcvk6.js → index-DF3gHUuW.js} +4 -4
- package/dist/assets/{index-BPuJmMx-.js → index-DjLLC6N3.js} +1 -1
- package/dist/assets/index-DsT9i24r.js +141 -0
- package/dist/assets/{index-DpW-Ik8u.js → index-g0L_1foA.js} +8 -8
- package/dist/assets/{index-BFsMuPKK.js → index-u-w3iMC9.js} +9 -9
- package/dist/assets/{index-yiU4BWrm.js → index-wXCx8TFU.js} +1 -1
- package/dist/assets/{invitation-B8tJTJsE.js → invitation-CKfllvl5.js} +1 -1
- package/dist/assets/{invite-EdScAUQO.js → invite-CCCSmPiy.js} +1 -1
- package/dist/assets/{issue-passport-CStwxDqe.js → issue-passport-C3zUptls.js} +1 -1
- package/dist/assets/{item-B4NAOVBY.js → item-CkcpHBHM.js} +1 -1
- package/dist/assets/ja-B5V7b8Cm.js +7 -0
- package/dist/assets/ko-DP9up1nF.js +7 -0
- package/dist/assets/{landing-page-CBb5_s7o.js → landing-page-q-KgqE9Q.js} +1 -1
- package/dist/assets/{launch-result-message-mW7oxgKT.js → launch-result-message-BaU6oEsi.js} +1 -1
- package/dist/assets/{layout-uc9mKcbg.js → layout-CyCulQBn.js} +1 -1
- package/dist/assets/list-D1dIr8Je.js +2 -0
- package/dist/assets/list-TP-VNuzL.js +236 -0
- package/dist/assets/{list-header-D4MXeBc7.js → list-header-CU9W30JD.js} +1 -1
- package/dist/assets/localization-BXLZxF1J.js +1 -0
- package/dist/assets/{log-BdBIH8S_.js → log-DNpJdgp3.js} +1 -1
- package/dist/assets/{logger-DCttRmHI.js → logger-CQ50TnpL.js} +1 -1
- package/dist/assets/{login-CKa2oQPz.js → login-BKaJnfFX.js} +1 -1
- package/dist/assets/{login-oauth-callback-DVRZRaip.js → login-oauth-callback-LJsgXC8E.js} +1 -1
- package/dist/assets/{logo-uploader-DRH-fnyc.js → logo-uploader-BYnd80uu.js} +3 -3
- package/dist/assets/{lost-passport-ClMglNv0.js → lost-passport-Bk0k4I4s.js} +1 -1
- package/dist/assets/{open-window-Cu3fShwR.js → open-window-DV0D-Mov.js} +1 -1
- package/dist/assets/{overview-D5q1KD9x.js → overview-UIMGVO1S.js} +1 -1
- package/dist/assets/{page-header-C1NOmuYB.js → page-header-CpNMTtn_.js} +1 -1
- package/dist/assets/{passport-item-CjxzZUKR.js → passport-item-BxfGrDcE.js} +1 -1
- package/dist/assets/{permission-DzaDpKIW.js → permission-BkNXA8B5.js} +1 -1
- package/dist/assets/{preferences-Dmcgwjhp.js → preferences-_jTjKHvU.js} +1 -1
- package/dist/assets/{profile-embed-DsYLFLkt.js → profile-embed-8w4_vg5a.js} +1 -1
- package/dist/assets/pt-CG45pWr4.js +5 -0
- package/dist/assets/publish-resource-CcM3RwPR.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CrdGz16R.js → react-beautiful-dnd.esm-Cq_dOQ2z.js} +1 -1
- package/dist/assets/{relative-time-tY0x-ayF.js → relative-time-Cl7lOTkO.js} +1 -1
- package/dist/assets/ru-0VhRQc7t.js +5 -0
- package/dist/assets/runtime-BVDdcpyT.js +1 -0
- package/dist/assets/sdk-7yPC_DtN.js +1 -0
- package/dist/assets/{security-fwRPOvQx.js → security-BQbSLSOe.js} +3 -3
- package/dist/assets/{session-xl6Fb2Wm.js → session-6XaVDQaE.js} +1 -1
- package/dist/assets/setup-CifjXQIf.js +30 -0
- package/dist/assets/{shorten-label-srsBvHNw.js → shorten-label-Dq7bVuNa.js} +1 -1
- package/dist/assets/{simple-select-DyL9G1FX.js → simple-select-C-wGUGQR.js} +1 -1
- package/dist/assets/{slicedToArray-B3Jznk0w.js → slicedToArray-vWe02CJE.js} +1 -1
- package/dist/assets/{spaces-BtThOmfG.js → spaces-Cp7TgoZP.js} +1 -1
- package/dist/assets/{start-DNZ-ulwN.js → start-CHmWCQE9.js} +1 -1
- package/dist/assets/{starting-progress-CN1sTPnO.js → starting-progress-CdpkXOrK.js} +1 -1
- package/dist/assets/{status-kLLmMBy7.js → status-46dMQnxA.js} +1 -1
- package/dist/assets/{step-actions-DSriMOaL.js → step-actions-Bu3Q5M4V.js} +1 -1
- package/dist/assets/{studio-CqjHflyE.js → studio-BbeHx14I.js} +1 -1
- package/dist/assets/{switch-control-DsHfwUN7.js → switch-control-D6CqAlDY.js} +1 -1
- package/dist/assets/th-DwH8cjcw.js +5 -0
- package/dist/assets/{traffic-38eCC37i.js → traffic-CY9Vj6w7.js} +1 -1
- package/dist/assets/{transfer-zdDZ9_KG.js → transfer-CSeo2FaW.js} +1 -1
- package/dist/assets/{unsubscribe-DiFsgDJ8.js → unsubscribe-BLaMmgbM.js} +1 -1
- package/dist/assets/use-blocklet-logo-sEJnYyNL.js +2 -0
- package/dist/assets/{use-mobile-B-WdQWoB.js → use-mobile-BAjFH6d8.js} +1 -1
- package/dist/assets/{use-mobile-PBkFclTq.js → use-mobile-Bh8CHBbH.js} +1 -1
- package/dist/assets/{useLocalStorage-DeyICx-h.js → useLocalStorage-C6U1Aqya.js} +1 -1
- package/dist/assets/user-center-BHyd-rRF.js +76 -0
- package/dist/assets/{util-CZd-jYUF.js → util-Bg0WSJ-t.js} +1 -1
- package/dist/assets/{util-DStpLP3f.js → util-RWes6RwK.js} +1 -1
- package/dist/assets/{vendor-arcblock-CORkwLwW.js → vendor-arcblock-CN2B_oTr.js} +80 -80
- package/dist/assets/{vendor-mui-core-DMvlMpwf.js → vendor-mui-core-UZpb7wT7.js} +1 -1
- package/dist/assets/{vendor-mui-x-mcVodcG2.js → vendor-mui-x-whuSO90H.js} +1 -1
- package/dist/assets/vendor-ux-did-connect-TEE6cGq6.js +2296 -0
- package/dist/assets/vi-CcmTJggB.js +5 -0
- package/dist/assets/wrap-locale-DZ79GW_G.js +1 -0
- package/dist/assets/{zh-BQbRU3Dp.js → zh-C2MKZFZw.js} +3 -3
- package/dist/assets/zh-tw-mW-UVEHx.js +7 -0
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/package.json +43 -43
- package/dist/assets/add-resource-j8u2ovZD.js +0 -1
- package/dist/assets/ar-5Vd7BsNt.js +0 -7
- package/dist/assets/button-Bk6R99H4.js +0 -1
- package/dist/assets/click-to-copy-CzMRt9dA.js +0 -1
- package/dist/assets/dashboard-CuF4binC.js +0 -280
- package/dist/assets/de-oCaVyGvF.js +0 -7
- package/dist/assets/domains-bZXw9tDX.js +0 -1
- package/dist/assets/fr-BDos80TL.js +0 -7
- package/dist/assets/get-safe-url-Dh8rhVin.js +0 -1
- package/dist/assets/get-safe-url-_fT029s-.js +0 -1
- package/dist/assets/hi-DwEZmyg8.js +0 -5
- package/dist/assets/id-BVUMyK9S.js +0 -7
- package/dist/assets/index-B9xM_Hng.js +0 -11
- package/dist/assets/index-CXDRY0Gs.js +0 -99
- package/dist/assets/index-DW75AsWb.js +0 -55
- package/dist/assets/index-aQxEawZE.js +0 -345
- package/dist/assets/index-cs-08BqN.js +0 -113
- package/dist/assets/index-m_po8k60.js +0 -141
- package/dist/assets/ja-CFMQ-LyA.js +0 -7
- package/dist/assets/ko-NIkLevaH.js +0 -7
- package/dist/assets/list-BK68Cxh8.js +0 -236
- package/dist/assets/localization-CJlgb0T8.js +0 -1
- package/dist/assets/pt-CDHE_zWG.js +0 -5
- package/dist/assets/publish-resource--xDHKiTt.js +0 -1
- package/dist/assets/ru-l1raGUU5.js +0 -5
- package/dist/assets/runtime-CRViKGyG.js +0 -1
- package/dist/assets/sdk-D0dqnQoQ.js +0 -1
- package/dist/assets/setup-KZaDiyeL.js +0 -30
- package/dist/assets/th-BBE2_3AB.js +0 -5
- package/dist/assets/use-blocklet-logo-OwFyCoUV.js +0 -1
- package/dist/assets/user-center-D-0-UOTc.js +0 -76
- package/dist/assets/vendor-ux-did-connect-akcz-Ldw.js +0 -2296
- package/dist/assets/vi-CVeuRNnr.js +0 -5
- package/dist/assets/wrap-locale-NyChvVhT.js +0 -1
- package/dist/assets/zh-tw-Ca0tJhqz.js +0 -7
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import{r as g}from"./vendor-react-DEoibe3W.js";import{u as I,X as U,j as ae,B as L,b2 as he,am as le,bO as re,_ as ge,aA as be,bv as je,c3 as Ce,b4 as ve,a7 as Ke}from"./vendor-ux-did-connect-TEE6cGq6.js";import{d as ke}from"./Edit-BLsIdIOp.js";import{r as de}from"./passport-item-BxfGrDcE.js";import{z as B,l as N,aF as Ae,C as Te,f as Se}from"./index-u-w3iMC9.js";import{u as $}from"./dashboard-C124DXmc.js";import{j as e,H as p,bp as F,bs as O,bo as G,q as H,aa as x,al as V,O as M,ab as we,bt as De,bS as Ie,ah as P,T as _,ad as ie,ak as Re}from"./vendor-mui-core-UZpb7wT7.js";import{M as Be,Z as $e}from"./vendor-arcblock-CN2B_oTr.js";import{T as me}from"./index-BmWVfEGP.js";import{C as pe}from"./confirm-BvUfAlkx.js";import{a0 as _e}from"./vendor-utils-rHXShPKm.js";import{C as E}from"./click-to-copy-BxhgzyYL.js";import{D as Ne}from"./delete-confirm-BBaXcAXg.js";import{P as Pe}from"./permission-BkNXA8B5.js";import{m as Ue,G as We}from"./vendor-hooks-rDgu5KV9.js";import{U as qe,C as ze,I as Le}from"./index-Ce2NSVmU.js";import{B as Me}from"./bundle-avatar-Db5l8MQ4.js";import{p as Ee}from"./util-Bg0WSJ-t.js";import{W as ce}from"./did-address-BKBBjFqv.js";import{A as Fe}from"./actions-BCWb2ez1.js";import{f as Oe}from"./format-error-BrmqJs5a.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-CEvgWyL5.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./vendor-mui-x-whuSO90H.js";import"./AdapterDayjs-BiPHzcUP.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./base32-BbrXtXL6.js";import"./MoreHoriz-BxJelL2A.js";function Q({value:s}){const{t:n,locale:m}=I(),l=new Date;return new Date(s)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(U,{value:s,locale:m}),`${n("setting.accessKey.expired",{time:""})}`]}):e.jsx(U,{value:s,locale:m})}Q.propTypes={value:p.string.isRequired};function X({value:s,onChange:n,...m}){const{t:l}=I(),d=g.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(F,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(O,{children:l("setting.accessKey.authType")}),e.jsx(G,{value:s,onChange:n,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(H,{value:o.value,children:e.jsxs(x,{children:[e.jsx("span",{children:o.title}),e.jsx(x,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}X.propTypes={value:p.string.isRequired,onChange:p.func.isRequired};const W=()=>{const s=ae.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:n}=B(),{roles:m}=$(),l=[...s,...n?m:[]];return _e(l,"name").filter(d=>d.name!==ae.ROLES.OWNER)};function Z(s){const{remark:n,onCreate:m}=s,{api:l}=B(),{teamDid:d}=$(),{t:o}=I(),[C,b]=g.useState(!1),[c,f]=g.useState(null),u=W(),T=()=>{b(!1),f(null)},k=async a=>{const{remark:A,passport:i,authType:t}=a;b(!0);const v=await l.createAccessKey({input:{teamDid:d,remark:A.trim(),passport:i,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:t}}),{data:K}=v;m(K),f(null),b(!1)},y={title:`${o("common.create")} ${o("accessKey")}`,description:(a,A,i)=>e.jsxs(V,{gap:3,children:[e.jsx(M,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:t=>{A({...a,remark:t.target.value,__disableConfirm:!a.passport||!t.target.value.trim()}),t.target.value.trim()?i(""):i(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(F,{style:{width:"100%"},variant:"outlined",children:[e.jsx(O,{children:o("setting.accessKey.passport")}),e.jsx(G,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:t=>{const v=t.target.value;i(null),A({...a,passport:v,__disableConfirm:!a.remark||!v})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:C,children:u.map(t=>e.jsx(H,{value:t.name,"data-cy":`create-access-key-passport-option-${t.name}`,children:e.jsxs(x,{children:[e.jsx("span",{children:t.title||t.name}),e.jsx(x,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:t.description})]})},t.name))})]}),e.jsx(X,{value:a.authType,onChange:t=>{A({...a,authType:t.target.value})}}),e.jsx(me,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:t=>{A({...a,expireAt:t,__disableConfirm:!a.passport||!a.remark||!t})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:n,authType:"signature",__disableConfirm:!n.trim()},onConfirm:k,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>f(y),className:"rule-action",children:[C?e.jsx(we,{size:16}):e.jsx(Be,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(pe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}Z.propTypes={remark:p.string,onCreate:p.func};Z.defaultProps={onCreate:()=>{},remark:""};function J(s){const{onConfirm:n,accessKeyId:m,accessKeySecret:l,hideSecret:d}=s,{t:o}=g.useContext(he),[C,b]=g.useState(!1),[c,f]=g.useState(()=>d),u=()=>{f(!c)},T=a=>{b(a.target.checked)},k=g.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
|
|
2
|
+
|
|
3
|
+
const client = new Client(fullEndpoint);
|
|
4
|
+
client.setAuthAccessKey({
|
|
5
|
+
accessKeyId: "${m}",
|
|
6
|
+
accessKeySecret: "${l}",
|
|
7
|
+
});
|
|
8
|
+
`:`curl -H "Authorization: Bearer ${l}" "${(a=window.blocklet)==null?void 0:a.appUrl}/.well-known/service/api/did/session"`},[d,m,l]),y=g.useMemo(()=>{var a;return d?`blocklet deploy --endpoint ${(a=window.blocklet)==null?void 0:a.appUrl} --access-key ${m} --access-secret ${l} {blockletPath}/.blocklet/bundle;`:null},[d,m,l]);return e.jsxs(le,{title:o("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:n,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(L,{disabled:d?!C:!1,onClick:n,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:o("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ge,{children:o(d?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(z,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeyId")}),e.jsx(E,{children:m})]}),e.jsxs(z,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeySecret")}),c?e.jsx(L,{"data-cy":"show-secret-btn",color:"primary",onClick:u,children:o("setting.accessKey.showSecret")}):e.jsx(E,{children:l})]}),!c&&e.jsxs(z,{children:[e.jsx(q,{children:`Access Key ${o("setting.accessKey.usage")}`}),e.jsx(re,{code:k,language:"javascript"}),y&&e.jsx(re,{code:y,language:"bash"})]}),d&&e.jsx("div",{children:e.jsx(De,{value:"end",disabled:c,control:e.jsx(Ie,{checked:C,onChange:T}),label:o("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}J.propTypes={accessKeyId:p.string.isRequired,accessKeySecret:p.string.isRequired,onConfirm:p.func,hideSecret:p.bool};J.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=P.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
align-items: center;
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
margin-bottom: 8px;
|
|
14
|
+
`,z=P.div`
|
|
15
|
+
margin-bottom: 24px;
|
|
16
|
+
`,Ge=P.div`
|
|
17
|
+
font-size: 16px;
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
`;function Y(s){const{t:n,locale:m}=I(),{api:l}=B(),{teamDid:d}=$(),{accessKeyId:o,time:C,remark:b,onDelete:c=()=>{},onClose:f=()=>{}}=s,u=()=>{f()},T=async()=>{try{await l.deleteAccessKey({input:{teamDid:d,accessKeyId:o}}),c()}catch(a){ge.error(a==null?void 0:a.message)}finally{u()}},k=a=>({key:`<b>${o}</b>`,name:`<b>${b}</b>`,time:N(a,m),timeAge:$e(new Date(a),Ae(m))}),y={keyName:b,title:n("setting.accessKey.title"),description:C?`${n("setting.accessKey.description",k(C))}`:`${n("setting.accessKey.descriptionNoTime",{key:`<b>${o}</b>`,name:`<b>${b}</b>`})}`,confirmPlaceholder:n("setting.accessKey.confirm_desc",{name:b}),confirm:n("common.delConfirm"),cancel:n("common.cancel"),onConfirm:T,onCancel:u};return e.jsx(Ne,{keyName:y.keyName,title:y.title,description:y.description,confirmPlaceholder:y.confirmPlaceholder,confirm:y.confirm,cancel:y.cancel,params:y.params,onConfirm:y.onConfirm,onCancel:y.onCancel})}Y.propTypes={accessKeyId:p.string.isRequired,time:p.string.isRequired,remark:p.string.isRequired,onDelete:p.func,onClose:p.func};Y.defaultProps={onDelete:()=>{},onClose:()=>{}};function ee(s){const{accessKeyId:n,remark:m,onUpdate:l,passport:d,expireAt:o,authType:C,onClose:b}=s,{api:c}=B(),{teamDid:f}=$(),{t:u}=I(),[T,k]=g.useState(!1),y=W(),a=()=>{k(!1),b()},A=async t=>{const{accessKeyId:v,remark:K="",passport:h,expireAt:D,authType:R}=t;k(!0),await c.updateAccessKey({input:{teamDid:f,accessKeyId:v,remark:K.trim(),passport:h,expireAt:D?new Date(D).getTime():null,authType:R}}),l(),a()},i={title:`${u("common.update")} ${u("accessKey")}`,description:(t,v,K)=>e.jsxs(V,{gap:3,children:[e.jsx(M,{label:u("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:t.accessKeyId,disabled:!0}),e.jsx(M,{label:u("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:t.remark,onChange:h=>{v({...t,remark:h.target.value,__disableConfirm:!h.target.value.trim()}),h.target.value.trim()?K(""):K(u("setting.accessKey.remarkInvalid"))}}),e.jsxs(F,{style:{width:"100%"},variant:"outlined",children:[e.jsx(O,{children:u("setting.accessKey.passport")}),e.jsx(G,{"data-cy":"update-access-key-select-passport",value:t.passport,onChange:h=>{const D=h.target.value;K(null),v({...t,passport:D,__disableConfirm:!t.remark||!D})},fullWidth:!0,label:u("setting.accessKey.passport"),disabled:T,children:y.map(h=>e.jsx(H,{value:h.name,"data-cy":`update-access-key-passport-option-${h.name}`,children:e.jsxs(x,{children:[e.jsx("span",{children:h.title||h.name}),e.jsx(x,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:h.description})]})},h.name))})]}),e.jsx(X,{disabled:!0,value:t.authType,onChange:h=>{v({...t,authType:h.target.value})}}),e.jsx(me,{placeholder:u("setting.accessKey.expireTime"),value:t.expireAt,onChange:h=>{v({...t,expireAt:h,__disableConfirm:!t.passport||!t.remark||!h})}})]}),confirm:u("common.confirm"),cancel:u("common.cancel"),color:"primary",params:{accessKeyId:n,remark:m,passport:d,expireAt:o,authType:C},onConfirm:A,onCancel:a};return e.jsx(pe,{title:i.title,description:i.description,confirm:i.confirm,color:i.color,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})}ee.propTypes={accessKeyId:p.string.isRequired,remark:p.string,passport:p.string,expireAt:p.string,authType:p.string,onUpdate:p.func,onClose:p.func};ee.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function te({accessKey:s,onCancel:n}){const{t:m}=I();return e.jsx(le,{title:m("accessKey"),onClose:n,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(He,{children:e.jsx(ue,{accessKey:s})})})}te.propTypes={accessKey:p.object.isRequired,onCancel:p.func.isRequired};te.defaultProps={};const He=P(x)`
|
|
20
|
+
margin-top: -16px;
|
|
21
|
+
|
|
22
|
+
.tabs {
|
|
23
|
+
margin-left: 0;
|
|
24
|
+
margin-right: 0;
|
|
25
|
+
}
|
|
26
|
+
`;function ue({accessKey:s}){var a,A;const{t:n,locale:m}=I(),{api:l}=B(),{teamDid:d}=$(),{blocklet:o}=Te(),C=W(),b=g.useCallback(async i=>i?(await l.getUser({input:{teamDid:d,user:{did:i}}})).user:null,[l,d]),c=Ue(()=>b(s.createdBy),{}),f=((o==null?void 0:o.children)||[]).find(i=>{var t;return((t=i==null?void 0:i.meta)==null?void 0:t.did)===s.componentDid}),u=g.useMemo(()=>{var i;return Ee((i=c==null?void 0:c.data)==null?void 0:i.avatar,d,!0)},[(a=c==null?void 0:c.data)==null?void 0:a.avatar,d]),T=C.find(i=>i.name===s.passport),k=T?T.title:s.passport,y=[{title:n("common.baseInfo"),items:[{label:n("setting.accessKey.accessKeyId"),content:e.jsx(ce,{did:s.accessKeyId,showQrcode:!0})},...s.authType==="simple"?[{label:n("setting.accessKey.accessKeySecret"),content:e.jsx(E,{children:`blocklet-${be.toBase58(s.accessKeyPublic)}`})}]:[],{label:n("common.role"),content:e.jsx(x,{children:de(k,s.passport)})},{label:n("common.createdVia"),content:s.createdVia},{label:n("common.createdBy"),content:c!=null&&c.data?e.jsx(x,{sx:{display:"flex",alignItems:"center",".MuiAvatar-root":{width:32,height:32}},children:e.jsx(qe,{user:{...c.data,avatar:u},showDid:!0,cardType:ze.Detailed,infoType:Le.Minimal,sx:{border:0,padding:0}})}):s.createdBy?e.jsx(ce,{did:s.createdBy,showQrcode:!0}):"-"}]},{title:n("common.timeInfo"),items:[{label:n("common.createdAt"),content:s.createdAt?N(s.createdAt,m):"-"},{label:n("common.lastUsedAt"),content:s.lastUsedAt?N(s.lastUsedAt,m):"-"},{label:n("common.expiredAt"),content:s.expireAt?e.jsx(Q,{value:s.expireAt}):n("common.neverExpired")}]},{title:n("common.otherInfo"),items:[{label:n("setting.accessKey.authType"),content:s.authType},{label:n("common.remark"),content:s.remark},...s.authType!=="signature"?[{label:n("setting.accessKey.resourceType"),content:s.resourceType||"-"},{label:n("setting.accessKey.resourceId"),content:s.resourceId||"-"}]:[],...f?[{label:n("setting.accessKey.component"),content:e.jsxs(x,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Me,{blocklet:f,ancestors:[o]}),e.jsx(x,{ml:"16px",sx:{minWidth:0},children:e.jsxs(x,{className:"component-header",children:[e.jsx(x,{className:"component-name",children:Se.getDisplayName(f,!0)}),e.jsx(x,{className:"component-version",children:(A=f==null?void 0:f.meta)==null?void 0:A.version})]})})]},f)}]:[]]}];return e.jsx(Ve,{gap:3,children:e.jsx(x,{className:"info-area",children:y.map(i=>e.jsxs(x,{mb:3,children:[e.jsx(_,{variant:"h6",sx:{mb:1.5},children:i.title}),e.jsx(x,{className:"info-grid",children:i.items.map(t=>e.jsxs(x,{className:"info-item",children:[e.jsx(x,{className:"info-label",children:e.jsx(_,{variant:"subtitle2",color:"textSecondary",children:t.label})}),e.jsx(x,{children:t.content})]},t.label))})]},i.title))})})}ue.propTypes={accessKey:p.object.isRequired};const Ve=P(V)`
|
|
27
|
+
.info-card {
|
|
28
|
+
margin-bottom: 24px;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.card-content {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 32px;
|
|
35
|
+
padding: 24px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.passport-image {
|
|
39
|
+
width: 150px;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
transition: transform 0.2s ease-in-out;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
transform: scale(1.05);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.info-area {
|
|
50
|
+
flex: 1;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.info-header {
|
|
56
|
+
padding-bottom: 16px;
|
|
57
|
+
border-bottom: 1px solid #eee;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.info-grid {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 12px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.info-item {
|
|
67
|
+
display: flex;
|
|
68
|
+
gap: 8px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.info-label {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 8px;
|
|
75
|
+
width: 140px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.logs-card {
|
|
79
|
+
.card-header {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: 8px;
|
|
83
|
+
padding: 16px 24px;
|
|
84
|
+
border-bottom: 1px solid #eee;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.MuiTimeline-root {
|
|
88
|
+
padding: 24px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.MuiTimelineContent-root {
|
|
92
|
+
padding: 0px 16px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.MuiTimelineDot-root {
|
|
96
|
+
margin: 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`;function Pt(){var ne,oe;const{t:s,locale:n}=I(),{api:m,inService:l}=B(),{teamDid:d}=$(),[o,C]=g.useState({}),[b,c]=g.useState(null),[f,u]=g.useState(null),[T,k]=g.useState(null),y=W(),a=g.useRef(null),A=`access-keys-${d}`,i=je(A),[t,v]=g.useState({searchText:i.searchText||"",pageSize:i.rowsPerPage||10,page:1}),K=We(async()=>await m.getAccessKeys({input:{teamDid:d,paging:{page:t.page,pageSize:t.pageSize}}}),[t.page,t.pageSize]),{loading:h,error:D}=K,R=g.useMemo(()=>{var r;return((r=K.value)==null?void 0:r.list)||[]},[(ne=K.value)==null?void 0:ne.list]),xe=g.useMemo(()=>[{label:s("common.name"),name:"remark",options:{customBodyRender:(r,{rowIndex:S})=>{const w=R[S];return e.jsx(x,{display:"flex",alignItems:"center",gap:2,children:e.jsx(_,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:r=>e.jsx(Ce,{showDidLogo:!1,children:r})}},{label:s("common.role"),name:"passport",options:{customBodyRender:r=>{const S=y.find(j=>j.name===r),w=S?S.title:r;return e.jsx(x,{children:de(w,r)})}}},{label:s("common.createdVia"),name:"createdVia",options:{customBodyRender:r=>e.jsx(_,{children:r})}},{label:s("setting.accessKey.authType"),name:"authType",options:{customBodyRender:r=>e.jsx(_,{children:s(`setting.accessKey.${r}`)})}},{label:s("common.createdAt"),name:"createdAt",options:{customBodyRender:r=>e.jsx(ie,{title:N(r,n),children:r?e.jsx(U,{value:r,locale:n}):"-"})}},{label:s("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:r=>e.jsx(ie,{title:N(r,n),children:r?e.jsx(U,{value:r,locale:n}):"-"})}},{label:s("common.expiredAt"),name:"expireAt",options:{customBodyRender:r=>r?e.jsx(Q,{value:r}):s("common.neverExpired")}},{label:s("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(r,{rowIndex:S})=>{const w=R[S];return e.jsx(Fe,{actions:[{icon:e.jsx(ke,{}),text:s("common.edit"),onClick:j=>{j.stopPropagation(),k(w)}},{icon:e.jsx(ve,{}),text:s("common.delete"),onClick:j=>{j.stopPropagation(),u(w)}}]})}}}],[R,n,s,y,u,k]),fe=({page:r,rowsPerPage:S,searchText:w})=>{t.pageSize!==S?v(j=>({...j,searchText:"",pageSize:S,page:1})):t.page!==r+1?v(j=>({...j,searchText:"",page:r+1})):t.searchText!==w&&v(j=>({...j,searchText:w,page:1}))},se=t.searchText?R.filter(r=>r.accessKeyId.toLowerCase().includes(t.searchText.toLowerCase())||(r.remark||"").toLowerCase().includes(t.searchText.toLowerCase())):R;return D?e.jsx(Re,{severity:"error",children:Oe(D)}):e.jsxs(x,{ref:a,sx:{".custom-toobar-btns":{gap:"8px"}},children:[e.jsx(Ke,{durable:A,durableKeys:["page","rowsPerPage"],data:se,columns:xe,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:t.page-1,rowsPerPage:t.pageSize,count:((oe=K.value)==null?void 0:oe.count)||0,searchDebounceTime:600,onRowClick(r,{dataIndex:S},w){var j;if((j=a.current)!=null&&j.contains(w.target)){const ye=se[S];c(ye)}}},loading:h,onChange:fe,customButtons:[e.jsx(Pe,{permission:l?"":"mutate_accessKey",children:e.jsx(Z,{onCreate:r=>{const{accessKeyId:S,accessKeySecret:w,authType:j}=r;C({show:!0,accessKeyId:S,accessKeySecret:w,authType:j})}})})]}),o.show&&e.jsx(J,{hideSecret:o.authType==="signature",onConfirm:()=>{K.retry(),C({show:!1})},...o}),b&&e.jsx(te,{onCancel:()=>c(null),accessKey:b}),f&&e.jsx(Y,{accessKeyId:f.accessKeyId,time:f.lastUsedAt,remark:f.remark||"N/A",onDelete:K.retry,onClose:()=>u(null)}),T&&e.jsx(ee,{...T,onUpdate:K.retry,onClose:()=>k(null)})]})}export{Pt as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Se,j as e,v as Be,aa as c,bd as $t,H as s,ad as ke,I as ae,T as L,s as Fn,c7 as Oo,D as at,ah as ve,au as Hn,bS as Ke,ak as dt,bt as et,bx as tt,y as K,ab as we,P as Wo,G as Bo,w as Pt,a7 as Mo,M as Uo,q as be,X as Gn,aj as Vo,t as Fo,bV as Jn,N as Je,z as Ho,O as ne,al as Re,at as Go,L as Jo,A as _t,b6 as Xo,bK as Yo,by as Xn,e as Qo,aq as Yn,b$ as Qn,af as Zn,U as Zo,W as ot,bF as Kn,bG as es,c8 as ts,c9 as os,bo as wt,bp as ns,br as ss,bv as rs,bw as kt}from"./vendor-mui-core-DMvlMpwf.js";import{z as je,C as De,af as ls,a7 as is,f as yo,ag as vo,ab as cs}from"./index-BFsMuPKK.js";import{r as Ie,j as Y,u as Q,bu as Ko,h as as,B as qe,b7 as en,X as tn,b4 as on,ao as ds,bv as us,a7 as qt,_ as M,a3 as ps,I as de,bw as hs,ba as fs,a as We,am as ut,b5 as bs,as as nn}from"./vendor-ux-did-connect-akcz-Ldw.js";import{M as pt,c as fe,q as ms,Q as xs,_ as sn,T as _e,p as gs}from"./vendor-arcblock-CORkwLwW.js";import{d as js}from"./Error-DmLM9r9y.js";import{C as ht}from"./confirm-qyOtSX3L.js";import{u as Ue}from"./session-xl6Fb2Wm.js";import{W as Ct}from"./did-address-Dd9R3pkY.js";import{E as Xe}from"./empty-spinner-g1Jw7iuj.js";import{B as Et}from"./bundle-avatar-CkhAjy4c.js";import{S as Ce}from"./shorten-label-srsBvHNw.js";import{L as Lt}from"./list-header-D4MXeBc7.js";import{$ as ks,A as ue,J as Nt,E as rn}from"./vendor-utils-rHXShPKm.js";import{d as ys}from"./Download-BZiCoF-V.js";import{C as ln}from"./click-to-copy-CzMRt9dA.js";import{Q as vs}from"./QuestionMarkCircle-dkY86QWO.js";import{u as Rs}from"./vendor-hooks-rDgu5KV9.js";import{_ as Pe}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-BPuJmMx-.js";import"./api-BjteVZFg.js";import{d as ws}from"./ChevronRight-8T5vdE8C.js";import{T as Cs,a as Ss}from"./vendor-mui-x-mcVodcG2.js";import{d as nt}from"./DeleteOutline-1ZpdOBb4.js";import{D as Ro,C as wo,P as Co}from"./react-beautiful-dnd.esm-CrdGz16R.js";import{c as Ds,A as cn,u as an,S as Is,a as Ts,b as $s,e as Ps,U as _s,f as yt,g as dn,n as qs,h as Es,i as So,k as Ls,l as Ns}from"./item-B4NAOVBY.js";import{d as As}from"./ArrowDropDown-oIFrKvRQ.js";import{f as ge}from"./format-error-BrmqJs5a.js";import{d as un}from"./Launch-BGXBIBAE.js";import{d as pn}from"./Done-1iBqzwts.js";import{D as zs}from"./delete-confirm-DQ_YJQpj.js";import{g as hn}from"./get-safe-url-_fT029s-.js";import{M as Os}from"./index-BQJa9ZJC.js";import{r as Ws}from"./index-CzGXBMFc.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=Se;Object.defineProperty(Ot,"__esModule",{value:!0});var fn=Ot.default=void 0,Ms=Bs(Ie()),Us=e;fn=Ot.default=(0,Ms.default)((0,Us.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Wt={},Vs=Se;Object.defineProperty(Wt,"__esModule",{value:!0});var bn=Wt.default=void 0,Fs=Vs(Ie()),Hs=e;bn=Wt.default=(0,Fs.default)((0,Hs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Gs=Se;Object.defineProperty(Bt,"__esModule",{value:!0});var mn=Bt.default=void 0,Js=Gs(Ie()),Xs=e;mn=Bt.default=(0,Js.default)((0,Xs.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 Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=Be(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=je(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=De(),[m,j]=x.useState(null),[y,h]=x.useState(!1),p=Be(T=>T.breakpoints.down("xl")),v=Be(T=>T.breakpoints.down("md")),{componentDid:w=""}=ct(),[b,k]=x.useState(null),C=`publish-${f.meta.did}`,I=Ko(C),[$,D]=x.useState({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),N=()=>{d.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(T=>{const P=(T==null?void 0:T.projects)||[];a(!1),k(P)}).catch(T=>{a(!1),M.error(T.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},E=T=>{j(T)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=T=>{M.error(T.message),h(!1),j(null)},g=T=>{if(!(T!=null&&T.deleted)){M.error("Delete project failed");return}N(),h(!1),j(null)};x.useEffect(()=>{N()},[]);const S=x.useMemo(()=>{var P;if(!$.searchText)return b;let T=(P=$.searchText)==null?void 0:P.trim();return T?(T=as.toAddress(T).toLocaleLowerCase(),b.filter(H=>H.blockletTitle.toLowerCase().includes(T)||H.blockletDid.toLowerCase().includes(T))):b},[b,$.searchText]);if(!b&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!b)return null;if(!b.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:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:T=>{const P=b[T];return e.jsx(ye,{to:`${P.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:T=>T?e.jsx(en,{type:"success",children:T}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:T=>T?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:T}):null}},p||w?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:T=>T?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${T}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:T}):null}},p||w?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:T=>{const P=(f.children||[]).find(H=>H.meta.did===T);return P?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:P,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},T):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:T=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:T})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:T=>e.jsx(tn,{value:Number(T),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:T=>{const P=b[T];return e.jsxs(c,{display:"flex",children:[e.jsx(ye,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:e.jsx(ke,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"create",children:e.jsx(fn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&e.jsx(ke,{title:l("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"secondary","aria-label":"create",children:e.jsx(ye,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:e.jsx(bn,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:l("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>E(P),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),B=({page:T,rowsPerPage:P,searchText:H})=>{$.pageSize!==P?D(V=>({...V,searchText:"",pageSize:P,page:1})):$.page!==T+1?D(V=>({...V,searchText:"",page:T+1})):$.searchText!==H&&D(V=>({...V,searchText:H,page:1}))},J=y?e.jsx(ds,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:m.id,did:f.meta.did,name:m.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ys,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(ke,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(us,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:$.searchText,searchText:$.searchText,searchTextUpdate:T=>D(P=>({...P,searchText:T})),searchClose:()=>D(T=>({...T,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:S,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:C,onChange:B}),m&&e.jsx(ht,{title:`${l("common.delete")} ${m.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(T=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:T})]}))})}),J]})}const Ys=Fn(c)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BVU8_1Ed.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-CN2B_oTr.js","assets/index-Bs1kxR8_.js","assets/index-u-w3iMC9.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Se,j as e,v as Be,aa as c,bd as $t,H as s,ad as ke,I as ae,T as L,s as Fn,c7 as Oo,D as at,ah as ve,au as Hn,bS as Ke,ak as dt,bt as et,bx as tt,y as K,ab as we,P as Wo,G as Bo,w as Pt,a7 as Mo,M as Uo,q as be,X as Gn,aj as Vo,t as Fo,bV as Jn,N as Je,z as Ho,O as ne,al as Re,at as Go,L as Jo,A as _t,b6 as Xo,bK as Yo,by as Xn,e as Qo,aq as Yn,c2 as Qn,af as Zn,U as Zo,W as ot,bF as Kn,bG as es,c8 as ts,c9 as os,bo as wt,bp as ns,br as ss,bv as rs,bw as kt}from"./vendor-mui-core-UZpb7wT7.js";import{z as je,C as De,af as ls,a7 as is,f as yo,ag as vo,ab as cs}from"./index-u-w3iMC9.js";import{r as Ie,j as Y,u as Q,bv as Ko,h as as,B as qe,b8 as en,X as tn,b4 as on,ao as ds,bw as us,a7 as qt,_ as M,a3 as ps,I as de,bx as hs,bb as fs,a as We,am as ut,b5 as bs,as as nn}from"./vendor-ux-did-connect-TEE6cGq6.js";import{M as pt,c as fe,l as ms,Q as xs,_ as sn,T as _e,p as gs}from"./vendor-arcblock-CN2B_oTr.js";import{d as js}from"./Error-wpqrAfUT.js";import{C as ht}from"./confirm-BvUfAlkx.js";import{u as Ue}from"./session-6XaVDQaE.js";import{W as Ct}from"./did-address-BKBBjFqv.js";import{E as Xe}from"./empty-spinner-BZlBh4vA.js";import{B as Et}from"./bundle-avatar-Db5l8MQ4.js";import{S as Ce}from"./shorten-label-Dq7bVuNa.js";import{L as Lt}from"./list-header-CU9W30JD.js";import{$ as ks,A as ue,J as Nt,E as rn}from"./vendor-utils-rHXShPKm.js";import{d as ys}from"./Download-DKQGRFHf.js";import{C as ln}from"./click-to-copy-BxhgzyYL.js";import{Q as vs}from"./QuestionMarkCircle-DCM9zW3a.js";import{u as Rs}from"./vendor-hooks-rDgu5KV9.js";import{_ as Pe}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-DjLLC6N3.js";import"./api-BjteVZFg.js";import{d as ws}from"./ChevronRight-BfbPIE2b.js";import{T as Cs,a as Ss}from"./vendor-mui-x-whuSO90H.js";import{d as nt}from"./DeleteOutline-B6efX_Fy.js";import{D as Ro,C as wo,P as Co}from"./react-beautiful-dnd.esm-Cq_dOQ2z.js";import{c as Ds,A as cn,u as an,S as Is,a as Ts,b as $s,e as Ps,U as _s,f as yt,g as dn,n as qs,h as Es,i as So,k as Ls,l as Ns}from"./item-CkcpHBHM.js";import{d as As}from"./ArrowDropDown-Dghek9CI.js";import{f as ge}from"./format-error-BrmqJs5a.js";import{d as un}from"./Launch-DBKe0gh0.js";import{d as pn}from"./Done-Ct5slWpT.js";import{D as zs}from"./delete-confirm-BBaXcAXg.js";import{g as hn}from"./get-safe-url-CEvgWyL5.js";import{M as Os}from"./index-CKheO_aT.js";import{r as Ws}from"./index-BMD-pSqT.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=Se;Object.defineProperty(Ot,"__esModule",{value:!0});var fn=Ot.default=void 0,Ms=Bs(Ie()),Us=e;fn=Ot.default=(0,Ms.default)((0,Us.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Wt={},Vs=Se;Object.defineProperty(Wt,"__esModule",{value:!0});var bn=Wt.default=void 0,Fs=Vs(Ie()),Hs=e;bn=Wt.default=(0,Fs.default)((0,Hs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Gs=Se;Object.defineProperty(Bt,"__esModule",{value:!0});var mn=Bt.default=void 0,Js=Gs(Ie()),Xs=e;mn=Bt.default=(0,Js.default)((0,Xs.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 Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=Be(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=je(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=De(),[m,j]=x.useState(null),[y,h]=x.useState(!1),p=Be(T=>T.breakpoints.down("xl")),v=Be(T=>T.breakpoints.down("md")),{componentDid:w=""}=ct(),[b,k]=x.useState(null),C=`publish-${f.meta.did}`,I=Ko(C),[$,D]=x.useState({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),N=()=>{d.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(T=>{const P=(T==null?void 0:T.projects)||[];a(!1),k(P)}).catch(T=>{a(!1),M.error(T.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},E=T=>{j(T)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=T=>{M.error(T.message),h(!1),j(null)},g=T=>{if(!(T!=null&&T.deleted)){M.error("Delete project failed");return}N(),h(!1),j(null)};x.useEffect(()=>{N()},[]);const S=x.useMemo(()=>{var P;if(!$.searchText)return b;let T=(P=$.searchText)==null?void 0:P.trim();return T?(T=as.toAddress(T).toLocaleLowerCase(),b.filter(H=>H.blockletTitle.toLowerCase().includes(T)||H.blockletDid.toLowerCase().includes(T))):b},[b,$.searchText]);if(!b&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!b)return null;if(!b.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:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:T=>{const P=b[T];return e.jsx(ye,{to:`${P.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:T=>T?e.jsx(en,{type:"success",children:T}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:T=>T?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:T}):null}},p||w?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:T=>T?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${T}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:T}):null}},p||w?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:T=>{const P=(f.children||[]).find(H=>H.meta.did===T);return P?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:P,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},T):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:T=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:T})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:T=>e.jsx(tn,{value:Number(T),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:T=>{const P=b[T];return e.jsxs(c,{display:"flex",children:[e.jsx(ye,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:e.jsx(ke,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"create",children:e.jsx(fn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&e.jsx(ke,{title:l("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"secondary","aria-label":"create",children:e.jsx(ye,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:e.jsx(bn,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:l("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>E(P),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),B=({page:T,rowsPerPage:P,searchText:H})=>{$.pageSize!==P?D(V=>({...V,searchText:"",pageSize:P,page:1})):$.page!==T+1?D(V=>({...V,searchText:"",page:T+1})):$.searchText!==H&&D(V=>({...V,searchText:H,page:1}))},J=y?e.jsx(ds,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:m.id,did:f.meta.did,name:m.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ys,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(ke,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(us,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:$.searchText,searchText:$.searchText,searchTextUpdate:T=>D(P=>({...P,searchText:T})),searchClose:()=>D(T=>({...T,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:S,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:C,onChange:B}),m&&e.jsx(ht,{title:`${l("common.delete")} ${m.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(T=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:T})]}))})}),J]})}const Ys=Fn(c)`
|
|
3
3
|
${({theme:t})=>t.breakpoints.down("md")} {
|
|
4
4
|
.MuiTableRow-root {
|
|
5
5
|
border-color: ${({theme:t})=>t.palette.divider};
|
|
@@ -142,7 +142,7 @@ import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
142
142
|
background: #fff;
|
|
143
143
|
z-index: 10;
|
|
144
144
|
}
|
|
145
|
-
`;var Zt={},Sr=Se;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Dr=Sr(Ie()),Ir=e;St=Zt.default=(0,Dr.default)((0,Ir.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 Po="lastWantToConnectStoreId";function Tr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(Po),m=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(w=>w.id===f):null;if(m)return m;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(w=>{var b;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((b=l==null?void 0:l.user)==null?void 0:b.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function $r(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Pr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function _r(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function qr(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Er=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=Er;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,S;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:m,inService:j}=je(),y=De(),[h,p]=x.useState(!1),v=x.useRef(null),[w,b]=x.useState(!1),[k,C]=x.useState(null),I=W=>{n(W),p(!1)},$=()=>{p(!h)},D=W=>{v.current&&v.current.contains(W.target)||p(!1)},N=()=>{b(!0)},z=()=>{b(!1)},E=async()=>{var W;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((W=y==null?void 0:y.actions)==null?void 0:W.refreshBlocklet())}catch(B){M.error(`Remove Blocklet Store Error: ${ge(B)}`)}finally{C(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:m,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(we,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:$,children:e.jsx(As,{})})]}),e.jsx(Wo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(Bo,{...W,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:D,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(B=>{var J;return e.jsxs(be,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>I(B),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),Ds({store:B,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ae,{sx:{ml:1},onClick:T=>{T.preventDefault(),T.stopPropagation(),C(B)},children:e.jsx(de,{icon:"ic:outline-delete"})})]},B.url)}),e.jsx(Gn,{}),e.jsxs(be,{onClick:N,children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(cn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(S=y==null?void 0:y.actions)==null?void 0:S.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:E,onCancel:()=>C(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const Lr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},Rn=Lr,Nr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((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/${a}?modestbranding=${l}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(r){const a=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/${a}`,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(de,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function wn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Nr(i),a=()=>{t(f=>{const m=[...f.blockletVideos];return m.push(i),{...f,blockletVideos:m}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Jn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ae,{onClick:()=>d(""),children:e.jsx(fs,{})})}):null,error:r}),r&&e.jsx(L,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}wn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,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:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(ke,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const _o=x.lazy(()=>sn(()=>import("./index-aMtQhU6T.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:m,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:w}=je(),b=Tt(),k=x.useRef(null),C=x.useRef(null),[I,$]=Tr(l),[D,N]=x.useState(!1),z=an({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),E=async q=>{const F=setTimeout(()=>{f(!1)},2e4),X=await Pr(w,q);f(!1),clearTimeout(F),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),b(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){M.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){M.error(p("blocklet.publish.noStoreSelected"));return}const q=$r();z(async(F,X)=>{var te,oe,ce;try{const ee=await w.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:q,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){M.error("failed to connect to store");return}X(ee.url),E({did:(ce=l==null?void 0:l.meta)==null?void 0:ce.did,projectId:"",messageId:q})}catch(ee){const pe=ge(ee);M.error(pe),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:S}=Rn(i,l,t),{logoErrors:W,screenshotErrors:B,storeList:J,hasLogoWarning:T,hasScreenshotWarning:P}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,V=q=>{if(!q.destination)return;const F=Array.from(i.blockletScreenshots),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletScreenshots:F}))},le=q=>{if(!q.destination)return;const F=Array.from(i.blockletVideos),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletVideos:F}))};return e.jsxs(Ar,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:q=>{u({blockletTitle:""}),d({blockletTitle:q.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{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(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:I,componentDid:h,onChangeStore:$,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:q=>{u({blockletDescription:""}),d({blockletDescription:q.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:q.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:q.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:q.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:q.target.value})},error:!!r.blockletRepository,helperText:r.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(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(Re,{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:"text.secondary"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var q;H()&&((q=k.current)==null||q.open())}})})]}),T&&e.jsx(Dt,{errors:W,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(Re,{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:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:V,children:e.jsx(wo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[R.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.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(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletScreenshots];return pe.splice(te,1),{...ee,blockletScreenshots:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,R.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=C.current)==null||X.open())},children:"+"})]})})})]}),P&&e.jsx(Dt,{errors:B,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(Re,{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:"text.secondary"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},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:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:le,children:e.jsx(wo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,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:q.innerRef,...q.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ce.isDragging?"none":"auto"}}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletVideos];return pe.splice(te,1),{...ee,blockletVideos:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,i.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()&&N(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:k,locale:v,popup:!0,onUploadFinish:q=>{var F;d({blockletLogo:q.data.filename}),y(""),(F=k.current)==null||F.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,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"),D&&e.jsx(wn,{onClose:()=>N(!1),params:i,setParams:d}),e.jsx(_o,{ref:C,locale:v,popup:!0,onUploadFinish:q=>{var F;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=q.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(F=C.current)==null||F.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.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")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Ar=ve.div`
|
|
145
|
+
`;var Zt={},Sr=Se;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Dr=Sr(Ie()),Ir=e;St=Zt.default=(0,Dr.default)((0,Ir.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 Po="lastWantToConnectStoreId";function Tr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(Po),m=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(w=>w.id===f):null;if(m)return m;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(w=>{var b;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((b=l==null?void 0:l.user)==null?void 0:b.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function $r(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Pr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function _r(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function qr(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Er=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=Er;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,S;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:m,inService:j}=je(),y=De(),[h,p]=x.useState(!1),v=x.useRef(null),[w,b]=x.useState(!1),[k,C]=x.useState(null),I=W=>{n(W),p(!1)},$=()=>{p(!h)},D=W=>{v.current&&v.current.contains(W.target)||p(!1)},N=()=>{b(!0)},z=()=>{b(!1)},E=async()=>{var W;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((W=y==null?void 0:y.actions)==null?void 0:W.refreshBlocklet())}catch(B){M.error(`Remove Blocklet Store Error: ${ge(B)}`)}finally{C(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:m,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(we,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:$,children:e.jsx(As,{})})]}),e.jsx(Wo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(Bo,{...W,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:D,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(B=>{var J;return e.jsxs(be,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>I(B),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),Ds({store:B,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ae,{sx:{ml:1},onClick:T=>{T.preventDefault(),T.stopPropagation(),C(B)},children:e.jsx(de,{icon:"ic:outline-delete"})})]},B.url)}),e.jsx(Gn,{}),e.jsxs(be,{onClick:N,children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(cn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(S=y==null?void 0:y.actions)==null?void 0:S.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:E,onCancel:()=>C(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const Lr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},Rn=Lr,Nr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((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/${a}?modestbranding=${l}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(r){const a=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/${a}`,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(de,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function wn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Nr(i),a=()=>{t(f=>{const m=[...f.blockletVideos];return m.push(i),{...f,blockletVideos:m}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Jn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ae,{onClick:()=>d(""),children:e.jsx(fs,{})})}):null,error:r}),r&&e.jsx(L,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}wn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,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:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(ke,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const _o=x.lazy(()=>sn(()=>import("./index-BVU8_1Ed.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:m,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:w}=je(),b=Tt(),k=x.useRef(null),C=x.useRef(null),[I,$]=Tr(l),[D,N]=x.useState(!1),z=an({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),E=async q=>{const F=setTimeout(()=>{f(!1)},2e4),X=await Pr(w,q);f(!1),clearTimeout(F),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),b(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){M.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){M.error(p("blocklet.publish.noStoreSelected"));return}const q=$r();z(async(F,X)=>{var te,oe,ce;try{const ee=await w.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:q,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){M.error("failed to connect to store");return}X(ee.url),E({did:(ce=l==null?void 0:l.meta)==null?void 0:ce.did,projectId:"",messageId:q})}catch(ee){const pe=ge(ee);M.error(pe),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:S}=Rn(i,l,t),{logoErrors:W,screenshotErrors:B,storeList:J,hasLogoWarning:T,hasScreenshotWarning:P}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,V=q=>{if(!q.destination)return;const F=Array.from(i.blockletScreenshots),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletScreenshots:F}))},le=q=>{if(!q.destination)return;const F=Array.from(i.blockletVideos),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletVideos:F}))};return e.jsxs(Ar,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:q=>{u({blockletTitle:""}),d({blockletTitle:q.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{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(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:I,componentDid:h,onChangeStore:$,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:q=>{u({blockletDescription:""}),d({blockletDescription:q.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:q.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:q.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:q.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:q.target.value})},error:!!r.blockletRepository,helperText:r.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(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(Re,{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:"text.secondary"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var q;H()&&((q=k.current)==null||q.open())}})})]}),T&&e.jsx(Dt,{errors:W,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(Re,{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:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:V,children:e.jsx(wo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[R.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.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(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletScreenshots];return pe.splice(te,1),{...ee,blockletScreenshots:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,R.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=C.current)==null||X.open())},children:"+"})]})})})]}),P&&e.jsx(Dt,{errors:B,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(Re,{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:"text.secondary"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},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:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:le,children:e.jsx(wo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,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:q.innerRef,...q.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ce.isDragging?"none":"auto"}}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletVideos];return pe.splice(te,1),{...ee,blockletVideos:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,i.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()&&N(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:k,locale:v,popup:!0,onUploadFinish:q=>{var F;d({blockletLogo:q.data.filename}),y(""),(F=k.current)==null||F.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,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"),D&&e.jsx(wn,{onClose:()=>N(!1),params:i,setParams:d}),e.jsx(_o,{ref:C,locale:v,popup:!0,onUploadFinish:q=>{var F;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=q.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(F=C.current)==null||F.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.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")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Ar=ve.div`
|
|
146
146
|
margin-top: 24px;
|
|
147
147
|
.screenshot {
|
|
148
148
|
margin-bottom: 16px;
|
|
@@ -190,7 +190,7 @@ import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
190
190
|
padding-bottom: 12px;
|
|
191
191
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
192
192
|
}
|
|
193
|
-
`;function Pn({text:t}){const{palette:o}=Qo();return t?e.jsx(Os,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(t),rehypePlugins:[[Ws,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var m;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid transparent",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:r("common.introduction")}),e.jsxs(Zo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Xr=Se;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Yr=Xr(Ie()),Lo=e;It=uo.default=(0,Yr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(pn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function qn({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:m}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Dn({hasSelectedResources:l,params:i,projectId:f,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(Kn,{activeStep:o,orientation:"vertical",children:t.map((v,w)=>{const b={},k=d||!Fr({hasSelectedResources:l,params:i,projectId:f,step:w,t:m}),C=d?"":h(w);return C&&(b.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:C}),b.error=!0),e.jsxs(es,{children:[e.jsx(ts,{icon:e.jsx(po,{error:C,warning:w===0?u.hasWarning:!1,active:p?99:o,step:w,ok:k}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...b,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:C||!k&&o>w?"error.main":"inherit",children:v.label})}),e.jsxs(os,{children:[e.jsx(L,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:C||!k,children:m("common.continue")}),w>0&&e.jsx(K,{disabled:w===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}qn.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Qr=[".zip",".gz"],Zr=1024*1024*100,Kr=x.lazy(()=>sn(()=>import("./index-aMtQhU6T.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),m=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${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(Re,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(L,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Kr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Qr,maxFileSize:Zr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function En(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&En(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),m=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},w=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},b=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(W=>{W.type="docker"});const S=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?S:"/",protocol:"http",prefix:R==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},C=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},I=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},$=u===`$${yt(o.key)}`||o.custom,D=i==="dockerArgs"&&!dn[o.key],N=qs[o.key],z=i==="dockerEnvs",E=o.key==="--publish";let Z=o.key;return E&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--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:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||$||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:$?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(N||D)||z||E)&&e.jsx(ae,{onClick:()=>f(!0),children:e.jsx(de,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ae,{onClick:m,color:D?"error":"default",children:e.jsx(de,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Es[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"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:[N||D||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(_e,{disabled:r,checked:$,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.shared")}),e.jsx(_e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.required")}),e.jsx(_e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.secure")}),e.jsx(_e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(_e,{disabled:r,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&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:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),E&&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:d("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:b,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),E&&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:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),E&&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:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const el=`
|
|
193
|
+
`;function Pn({text:t}){const{palette:o}=Qo();return t?e.jsx(Os,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(t),rehypePlugins:[[Ws,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var m;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid transparent",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:r("common.introduction")}),e.jsxs(Zo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Xr=Se;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Yr=Xr(Ie()),Lo=e;It=uo.default=(0,Yr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(pn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function qn({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:m}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Dn({hasSelectedResources:l,params:i,projectId:f,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(Kn,{activeStep:o,orientation:"vertical",children:t.map((v,w)=>{const b={},k=d||!Fr({hasSelectedResources:l,params:i,projectId:f,step:w,t:m}),C=d?"":h(w);return C&&(b.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:C}),b.error=!0),e.jsxs(es,{children:[e.jsx(ts,{icon:e.jsx(po,{error:C,warning:w===0?u.hasWarning:!1,active:p?99:o,step:w,ok:k}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...b,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:C||!k&&o>w?"error.main":"inherit",children:v.label})}),e.jsxs(os,{children:[e.jsx(L,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:C||!k,children:m("common.continue")}),w>0&&e.jsx(K,{disabled:w===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}qn.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Qr=[".zip",".gz"],Zr=1024*1024*100,Kr=x.lazy(()=>sn(()=>import("./index-BVU8_1Ed.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),m=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${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(Re,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(L,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Kr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Qr,maxFileSize:Zr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function En(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&En(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),m=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},w=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},b=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(W=>{W.type="docker"});const S=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?S:"/",protocol:"http",prefix:R==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},C=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},I=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},$=u===`$${yt(o.key)}`||o.custom,D=i==="dockerArgs"&&!dn[o.key],N=qs[o.key],z=i==="dockerEnvs",E=o.key==="--publish";let Z=o.key;return E&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--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:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||$||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:$?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(N||D)||z||E)&&e.jsx(ae,{onClick:()=>f(!0),children:e.jsx(de,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ae,{onClick:m,color:D?"error":"default",children:e.jsx(de,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Es[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"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:[N||D||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(_e,{disabled:r,checked:$,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.shared")}),e.jsx(_e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.required")}),e.jsx(_e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.secure")}),e.jsx(_e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(_e,{disabled:r,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&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:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),E&&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:d("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:b,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),E&&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:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),E&&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:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const el=`
|
|
194
194
|
docker run --name postgrest
|
|
195
195
|
-p 3000:3000
|
|
196
196
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-react-DEoibe3W.js";import{j as L}from"./vendor-mui-core-
|
|
1
|
+
import"./vendor-react-DEoibe3W.js";import{j as L}from"./vendor-mui-core-UZpb7wT7.js";var t=function(e){return L.jsxs("svg",{...e,children:[L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z",fill:"url(#paint0_linear_615_426)"}),L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z",fill:"url(#paint1_linear_615_426)"}),L.jsxs("defs",{children:[L.jsxs("linearGradient",{id:"paint0_linear_615_426",x1:"31.72",y1:"95.7208",x2:"95.488",y2:"34.3249",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]}),L.jsxs("linearGradient",{id:"paint1_linear_615_426",x1:"28.4374",y1:"99.2464",x2:"98.7613",y2:"44.9372",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]})]})]})};t.defaultProps={width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var s=function(e){return L.jsx("svg",{...e,children:L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.36096 2.3999C7.04725 2.3999 6.76249 2.58326 6.63267 2.86886L0.872671 15.5409C0.825415 15.6448 0.800964 15.7577 0.800964 15.8719V15.9999V27.3919C0.800964 27.8337 1.15914 28.1919 1.60096 28.1919H30.401C30.8428 28.1919 31.201 27.8337 31.201 27.3919V15.8719C31.201 15.7577 31.1765 15.6448 31.1293 15.5409L25.3693 2.86886C25.2394 2.58326 24.9547 2.3999 24.641 2.3999H7.36096ZM2.40096 16.7999V26.5919H29.601V16.7932C29.5669 16.7976 29.5321 16.7999 29.4968 16.7999H22.3993L20.3328 19.8997C20.1845 20.1222 19.9347 20.2559 19.6672 20.2559H11.6032C11.3357 20.2559 11.0859 20.1222 10.9375 19.8997L8.87104 16.7999H2.40096ZM29.2167 15.1999H21.9712C21.7037 15.1999 21.4539 15.3336 21.3056 15.5561L19.239 18.6559H12.0313L9.96483 15.5561C9.81645 15.3336 9.56667 15.1999 9.29919 15.1999H2.78519L7.8761 3.9999H24.1258L29.2167 15.1999Z",fill:"currentColor"})})};s.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};export{s as E,t as S};
|