@abtnode/blocklet-services 1.16.47-beta-20250721-130532-61549a96 → 1.16.47-beta-20250724-080141-d80ab374
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.js +3 -0
- package/api/libs/image.js +5 -1
- package/api/routes/access-key.js +59 -0
- package/api/routes/oauth/client.js +9 -0
- package/api/services/auth/session.js +14 -11
- package/api/util/attach-shared-utils.js +11 -8
- package/dist/assets/{AdapterDayjs-Dc_cn1Wv.js → AdapterDayjs-DJ-f1i8A.js} +1 -1
- package/dist/assets/{Google-BYGsR9Bd.js → Google-BvsSmJCS.js} +3 -3
- package/dist/assets/{access-control-oCszV5zC.js → access-control-DgyeLhBf.js} +1 -1
- package/dist/assets/actions-CRUvIBLz.js +1 -0
- package/dist/assets/{add-component-core-GYYnyhPI.js → add-component-core-CshRctcL.js} +29 -29
- package/dist/assets/add-resource-C6AR_ENP.js +1 -0
- package/dist/assets/{addon-m7dEcFSm.js → addon-Cioeq7ZM.js} +1 -1
- package/dist/assets/{advanced-BhS7b_np.js → advanced-DF-eCD_V.js} +3 -3
- package/dist/assets/aigne-DPVDIAAv.js +10 -0
- package/dist/assets/api-BfIB6faS.js +1 -0
- package/dist/assets/appearance-CL1LSpJB.js +1 -0
- package/dist/assets/ar-CcCysAXs.js +7 -0
- package/dist/assets/ar-VhkYkk5Z.js +1 -0
- package/dist/assets/{arrow-down.svg-6steA5un.js → arrow-down.svg-B9dO_KDq.js} +1 -1
- package/dist/assets/{audit-logs-gbfUafHi.js → audit-logs-EC_F2BOT.js} +2 -2
- package/dist/assets/{authorize-Bfey1QAy.js → authorize-DgLJOPDK.js} +1 -1
- package/dist/assets/{base-chart-u6OIGONc.js → base-chart-2nBOSo9s.js} +1 -1
- package/dist/assets/{base32-DBDFptL1.js → base32-TX5fATAF.js} +1 -1
- package/dist/assets/branding-7KMxNl9d.js +44 -0
- package/dist/assets/{branding-itFeNCQ6.js → branding-B6_aWuFR.js} +2 -2
- package/dist/assets/{bundle-avatar-DkLBEfff.js → bundle-avatar-BPnP6pIL.js} +1 -1
- package/dist/assets/button-CEiQto3g.js +1 -0
- package/dist/assets/{click-to-copy-m7BzOuWH.js → click-to-copy-BqGY_Kr7.js} +1 -1
- package/dist/assets/{cloneDeep-BpNWeRQ9.js → cloneDeep-CKVXBkcT.js} +1 -1
- package/dist/assets/{collapse-DfvukfIl.js → collapse-jk2ONGPl.js} +1 -1
- package/dist/assets/{complete-B4B7REuC.js → complete-zgzlWGY3.js} +4 -4
- package/dist/assets/{component-DMzCzNlm.js → component-BiE6SG5y.js} +63 -63
- package/dist/assets/{config-D-z5vAfP.js → config-Bra9VdE1.js} +2 -2
- package/dist/assets/config-CPpGYWww.js +28 -0
- package/dist/assets/{config-D3XTFUmZ.js → config-W_iStCFi.js} +1 -1
- package/dist/assets/{config-navigation-CfGhB5-E.js → config-navigation-D63aLfma.js} +9 -9
- package/dist/assets/config-space-DFnzGBOV.js +1 -0
- package/dist/assets/{confirm-B4BzkG04.js → confirm-5JMMSGdh.js} +1 -1
- package/dist/assets/{connect-JlblxSAY.js → connect-55nmllvA.js} +1 -1
- package/dist/assets/connect-Cph9RbRv.js +1 -0
- package/dist/assets/connect-to-CvyIrlXc.js +1 -0
- package/dist/assets/{content-layout-BaDbLmL5.js → content-layout-Mn94hzXe.js} +1 -1
- package/dist/assets/{createClass-g8bSPTyV.js → createClass-Ig9AWyIK.js} +1 -1
- package/dist/assets/{dashboard-CBpVHcLw.js → dashboard-BXgUTFa6.js} +8 -8
- package/dist/assets/de-BTXwRUYy.js +7 -0
- package/dist/assets/de-BYci0FoU.js +1 -0
- package/dist/assets/{delete-confirm-DhfRzwF1.js → delete-confirm-saPgrAIL.js} +1 -1
- package/dist/assets/{did-address-CdYAzzjR.js → did-address-D4l1uYd1.js} +1 -1
- package/dist/assets/domain-ClY1yq1j.js +9 -0
- package/dist/assets/domain-action-card-Ds6lQa7Z.js +28 -0
- package/dist/assets/domains-C_XAIIRT.js +1 -0
- package/dist/assets/{dot-OPeVWPUi.js → dot-BOuza8rS.js} +1 -1
- package/dist/assets/{email-BTKvn_fl.js → email-D07y9XJo.js} +1 -1
- package/dist/assets/empty-DhZfJeme.js +1 -0
- package/dist/assets/{empty-spinner-C6wgiyAQ.js → empty-spinner-D_3bEG2p.js} +1 -1
- package/dist/assets/engine-Bm7Qp-7f.js +1 -0
- package/dist/assets/es-1PoIOrwC.js +1 -0
- package/dist/assets/es-DCyLy_vM.js +9 -0
- package/dist/assets/{exchange-passport-B-9fNsX9.js → exchange-passport-B0LodWCE.js} +1 -1
- package/dist/assets/{form-BX4g8soo.js → form-D55muuDj.js} +1 -1
- package/dist/assets/form-text-input-BHd2ybwR.js +11 -0
- package/dist/assets/form-wrapper-DuJOKczF.js +99 -0
- package/dist/assets/fr-CNGOyo0v.js +7 -0
- package/dist/assets/fr-m47FzEWr.js +1 -0
- package/dist/assets/{fuel-DYTqXaPb.js → fuel-CYEtfdZk.js} +1 -1
- package/dist/assets/gen-access-key-BDWXKS6s.js +1 -0
- package/dist/assets/gen-simple-access-key-C-Aym19M.js +1 -0
- package/dist/assets/get-safe-url-CZlaSf1L.js +1 -0
- package/dist/assets/hi-Dcj1EDTy.js +1 -0
- package/dist/assets/hi-DsFnKfzk.js +5 -0
- package/dist/assets/{home-BL8xoBlc.js → home-CAJwSYRb.js} +1 -1
- package/dist/assets/id-CsK9Cnbo.js +7 -0
- package/dist/assets/id-UvUReF_3.js +1 -0
- package/dist/assets/{iframe-BTaRNGRY.js → iframe-DCdtoFjc.js} +1 -1
- package/dist/assets/{index-lf4wyjkd.js → index-1WiLWIAu.js} +6 -6
- package/dist/assets/index-B0pGy8t9.js +55 -0
- package/dist/assets/{index-D3qROm47.js → index-B36DERG2.js} +1 -1
- package/dist/assets/{index-BC395sak.js → index-B5_zLKFf.js} +1 -1
- package/dist/assets/index-BCWYWGPf.js +124 -0
- package/dist/assets/{index-CgCJ2qDh.js → index-BGoUXEmc.js} +88 -88
- package/dist/assets/{index-DseoFU10.js → index-BL2NEiva.js} +1 -1
- package/dist/assets/index-BSJbc4Ic.js +1 -0
- package/dist/assets/{index-DjKmasIZ.js → index-B_CAM-3t.js} +2 -2
- package/dist/assets/{index-Dy8syryD.js → index-BmCyA4MW.js} +3 -3
- package/dist/assets/index-Bzde7Bh8.js +113 -0
- package/dist/assets/{index-DyH1BrER.js → index-C7DDH7Uf.js} +10 -10
- package/dist/assets/{index-EIX4798q.js → index-C80MI1u_.js} +1 -1
- package/dist/assets/index-C8T12jiJ.js +1 -0
- package/dist/assets/{index-BaBIefeb.js → index-CGngFFes.js} +1 -1
- package/dist/assets/{index-CW67obch.js → index-CRFxmuV0.js} +1 -1
- package/dist/assets/index-CZXuMAQy.js +242 -0
- package/dist/assets/index-Ce_ilge5.js +271 -0
- package/dist/assets/index-CtENECgD.js +11 -0
- package/dist/assets/index-Cycplgtw.js +4 -0
- package/dist/assets/{index-DUnVGFh6.js → index-CzttGWll.js} +1 -1
- package/dist/assets/{index-BUJ5QfC4.js → index-D2MS4PNu.js} +6 -6
- package/dist/assets/{index-C-AuC2Mk.js → index-D3pV4Lj0.js} +1 -1
- package/dist/assets/{index-DcwzA8G_.js → index-DLHMwUmK.js} +1 -1
- package/dist/assets/{index-LvmCZD51.js → index-DpP3MEz0.js} +3 -3
- package/dist/assets/{index-D6kePAD5.js → index-DwEMr0X-.js} +6 -6
- package/dist/assets/{index-Cbxz8oHT.js → index-ElG08lIx.js} +1 -1
- package/dist/assets/{index-cCGBx0sL.js → index-Ft5IyfHH.js} +10 -10
- package/dist/assets/{index-D_5DFMMK.js → index-JVicMopH.js} +1 -1
- package/dist/assets/{index-SrN5SE_r.js → index-NVKZ_ZUS.js} +1 -1
- package/dist/assets/{index-Bo2cFOuR.js → index-UTcxT75j.js} +1 -1
- package/dist/assets/index-iY8rmPEZ.js +7 -0
- package/dist/assets/{invitation-CC5hPf7T.js → invitation-BEd7MxhL.js} +3 -3
- package/dist/assets/{invite-CreQ98MA.js → invite-C2gqMFFc.js} +1 -1
- package/dist/assets/isURL-sHTYO46x.js +2 -0
- package/dist/assets/{issue-passport-CIYcm6iB.js → issue-passport-ZvHPiNMo.js} +1 -1
- package/dist/assets/item-BlUr7rKO.js +1 -0
- package/dist/assets/ja-Cw02X6OV.js +1 -0
- package/dist/assets/ja-bb6qPt27.js +9 -0
- package/dist/assets/ko-DZSgmgs9.js +1 -0
- package/dist/assets/ko-DxiDEd1I.js +9 -0
- package/dist/assets/{landing-page-DOi_4Ca6.js → landing-page-CTjTjqyj.js} +1 -1
- package/dist/assets/{launch-result-message-Dwnqr8Lq.js → launch-result-message-3VxQH2Cy.js} +1 -1
- package/dist/assets/{layout-CIen07bA.js → layout-YAJmqZE8.js} +1 -1
- package/dist/assets/list-Bty_q29b.js +2 -0
- package/dist/assets/{list-B8ZhwNC1.js → list-Y-a4PO0u.js} +2 -2
- package/dist/assets/{list-header-CGX6Hi0X.js → list-header-DLhxtl5g.js} +1 -1
- package/dist/assets/localization-Bd37mWlD.js +1 -0
- package/dist/assets/{log-C9DU0cCG.js → log-B9tZ4qc6.js} +1 -1
- package/dist/assets/logger-MT1V7vOw.js +1 -0
- package/dist/assets/login-D-903-kb.js +1 -0
- package/dist/assets/{login-oauth-callback-C2SqP1bW.js → login-oauth-callback-B8e--CGo.js} +1 -1
- package/dist/assets/logo-uploader-BDvl-p1h.js +30 -0
- package/dist/assets/lost-passport-C-bcfQGt.js +168 -0
- package/dist/assets/observability-hUM5rYTW.js +1 -0
- package/dist/assets/{omit-CxEI1_wm.js → omit-CXy6Rymi.js} +1 -1
- package/dist/assets/{open-window-RuAUils2.js → open-window-BeKV58_Y.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-DhK6jNNQ.js → over-due-invoice-payment-YS7NZYQD.js} +1 -1
- package/dist/assets/{overview-BVSh5o7h.js → overview-re3EXfMP.js} +3 -3
- package/dist/assets/{page-header-BycH8S9r.js → page-header-DMbjH45Q.js} +1 -1
- package/dist/assets/{passport-item-D7sQ_FxN.js → passport-item-8olNdxYA.js} +1 -1
- package/dist/assets/{permission-C79TpiNV.js → permission-D-kAjshH.js} +1 -1
- package/dist/assets/playground-wmO_IQQj.js +1 -0
- package/dist/assets/preferences-Blutv5lP.js +1 -0
- package/dist/assets/profile-embed-BOKrgfV5.js +1 -0
- package/dist/assets/pt-Yj5llJx7.js +5 -0
- package/dist/assets/pt-fKCXneeH.js +1 -0
- package/dist/assets/publish-resource-D_O5YA9z.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DwkY3sYg.js → react-beautiful-dnd.esm-D2jtRKWT.js} +1 -1
- package/dist/assets/{react-stripe.esm-BGPt6Wk8.js → react-stripe.esm-OZTdjjoB.js} +1 -1
- package/dist/assets/required-BE3i31mZ.js +6 -0
- package/dist/assets/ru-D59vFs72.js +1 -0
- package/dist/assets/ru-DaVu35Yr.js +5 -0
- package/dist/assets/runtime-BPzGyz-O.js +1 -0
- package/dist/assets/{sanitize-DSvGhymV.js → sanitize-DTRB99ZZ.js} +1 -1
- package/dist/assets/sdk-C6BkT6-0.js +1 -0
- package/dist/assets/section-dVgXR9AT.js +40 -0
- package/dist/assets/{security-BwF3YzTL.js → security-DnTqhJwZ.js} +4 -4
- package/dist/assets/session-ulvrJT-t.js +1 -0
- package/dist/assets/setup-DhVk3qh7.js +30 -0
- package/dist/assets/{shorten-label-BKNhALWt.js → shorten-label--tw3nR45.js} +1 -1
- package/dist/assets/{simple-select-DiucBfFO.js → simple-select-6w3ryEQx.js} +1 -1
- package/dist/assets/{spaces-D2uHzDSf.js → spaces-wJwcbibW.js} +1 -1
- package/dist/assets/{start-CCbI2h7_.js → start-DpiGz6e_.js} +1 -1
- package/dist/assets/{starting-progress-C2KBufhS.js → starting-progress-DQSw_Bxk.js} +1 -1
- package/dist/assets/status-T58XBbiV.js +1 -0
- package/dist/assets/{step-actions-C6aMtUZh.js → step-actions-DIkPOD9c.js} +1 -1
- package/dist/assets/{studio-B-QwZrdc.js → studio-BYS275wi.js} +1 -1
- package/dist/assets/{switch-control-88oLMAWm.js → switch-control-BuqCLgsC.js} +1 -1
- package/dist/assets/{table-tips-ZIxKRomr.js → table-tips-DQHiKZsk.js} +1 -1
- package/dist/assets/team-BESj-ofA.js +146 -0
- package/dist/assets/th-CmipfeuV.js +1 -0
- package/dist/assets/th-DEoqTEHf.js +5 -0
- package/dist/assets/traffic-Ck4_JTUO.js +1 -0
- package/dist/assets/{transfer-DWvn8JDa.js → transfer-D9h-sDAW.js} +2 -2
- package/dist/assets/{unsubscribe-DPIGic1H.js → unsubscribe-xEh30JTV.js} +1 -1
- package/dist/assets/{use-mobile-BhzP2Rp3.js → use-mobile-CiJJ-F32.js} +1 -1
- package/dist/assets/{use-mobile-BtGrkCtZ.js → use-mobile-DXb1p_2Q.js} +1 -1
- package/dist/assets/use-promise-window-open-I4QIABtm.js +1 -0
- package/dist/assets/{use-server-logo-BFuFRBQG.js → use-server-logo-BoNyOffw.js} +1 -1
- package/dist/assets/use-window-close-0exfy1za.js +2 -0
- package/dist/assets/{useAsync-DGzYJlYv.js → useAsync-NmGtaPYZ.js} +1 -1
- package/dist/assets/{useAsync-DcK0UTnz.js → useAsync-kpO9-9ye.js} +1 -1
- package/dist/assets/{useLocalStorage-BRPtTalQ.js → useLocalStorage-oSchpz1c.js} +1 -1
- package/dist/assets/user-center-yL13yU5N.js +126 -0
- package/dist/assets/{user-sessions-C2LvHnd6.js → user-sessions-7gxEZAmB.js} +1 -1
- package/dist/assets/{util-DtXj9fc3.js → util-D52ViY5P.js} +1 -1
- package/dist/assets/{util-BGfTex9R.js → util-H8b0otwY.js} +1 -1
- package/dist/assets/{vendor-arcblock-B78OG6SS.js → vendor-arcblock-C7W5M07l.js} +1 -1
- package/dist/assets/{vendor-hooks-HB6DqcLv.js → vendor-hooks-0NQwJuRY.js} +2 -2
- package/dist/assets/{vendor-mui-core-DWYIngcn.js → vendor-mui-core-CiGwt5P_.js} +2 -2
- package/dist/assets/{vendor-mui-x-nEbm5eNb.js → vendor-mui-x-CXaju64L.js} +1 -1
- package/dist/assets/{vendor-utils-J7aLFpEq.js → vendor-utils-DAj75QpF.js} +1 -1
- package/dist/assets/{vendor-ux-Dln42oC3.js → vendor-ux-CF8ziO7Y.js} +81 -80
- package/dist/assets/vi-D7Q19sbd.js +5 -0
- package/dist/assets/vi-DpNkWLxz.js +1 -0
- package/dist/assets/wait-connect-Cll9F6lE.js +1 -0
- package/dist/assets/wrap-locale-CsXU2piR.js +1 -0
- package/dist/assets/zh-BChkzbvC.js +1 -0
- package/dist/assets/{zh-C3O8IIjK.js → zh-BrUcq0vn.js} +1 -1
- package/dist/assets/zh-DkzyaEBh.js +10 -0
- package/dist/assets/zh-tw-BNjyxfNh.js +9 -0
- package/dist/assets/zh-tw-CjDPzOCU.js +1 -0
- package/dist/images/aigne-hub.jpg +0 -0
- package/dist/images/anthropic.png +0 -0
- package/dist/images/bedrock.png +0 -0
- package/dist/images/deepseek.png +0 -0
- package/dist/images/gemini.png +0 -0
- package/dist/images/ollama.png +0 -0
- package/dist/images/open-router.png +0 -0
- package/dist/images/openai.png +0 -0
- package/dist/images/xai.png +0 -0
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +47 -47
- package/dist/assets/actions-CeSIZN0M.js +0 -1
- package/dist/assets/add-resource-vcL8WXJK.js +0 -1
- package/dist/assets/api-BV16dSSm.js +0 -1
- package/dist/assets/appearance-BF-F41U0.js +0 -1
- package/dist/assets/ar-C5ipiHf8.js +0 -7
- package/dist/assets/ar-DCQblmBa.js +0 -1
- package/dist/assets/branding-Co1T-6R4.js +0 -54
- package/dist/assets/button-Cnj6R5bV.js +0 -1
- package/dist/assets/config-space-a6OXiuM7.js +0 -1
- package/dist/assets/connect-B-9mXcqo.js +0 -1
- package/dist/assets/connect-to-BL3HAXmC.js +0 -1
- package/dist/assets/de-D2XMSiJO.js +0 -7
- package/dist/assets/de-qK31O6-T.js +0 -1
- package/dist/assets/domain-action-card-B-0EUHm9.js +0 -28
- package/dist/assets/domain-q2p-uq0P.js +0 -9
- package/dist/assets/domains-BvFskQMv.js +0 -1
- package/dist/assets/engine-DHKpyPwC.js +0 -1
- package/dist/assets/es-BbK8BUZe.js +0 -9
- package/dist/assets/es-if48ykIx.js +0 -1
- package/dist/assets/fr-BGG_0fyt.js +0 -7
- package/dist/assets/fr-CgLauWUq.js +0 -1
- package/dist/assets/gen-access-key-DVBJadXn.js +0 -2
- package/dist/assets/get-safe-url-Ce6hawV-.js +0 -1
- package/dist/assets/hi-Xr6quGTW.js +0 -1
- package/dist/assets/hi-u6UuLwjV.js +0 -5
- package/dist/assets/id-C2MXmMK4.js +0 -1
- package/dist/assets/id-CIzxbBpP.js +0 -7
- package/dist/assets/index-5klv_mrK.js +0 -4
- package/dist/assets/index-B9-tuTku.js +0 -242
- package/dist/assets/index-B9GdL3BM.js +0 -124
- package/dist/assets/index-BVPDkm__.js +0 -1
- package/dist/assets/index-C_CqbmyE.js +0 -7
- package/dist/assets/index-CeczUnUx.js +0 -284
- package/dist/assets/index-CgRDnxac.js +0 -55
- package/dist/assets/index-D8X_0Jj0.js +0 -1
- package/dist/assets/index-gkhmzgqt.js +0 -113
- package/dist/assets/index-n78OcMXJ.js +0 -11
- package/dist/assets/item-C8OCvu8j.js +0 -1
- package/dist/assets/ja-Cfsi5Ugj.js +0 -9
- package/dist/assets/ja-YE6rPAFZ.js +0 -1
- package/dist/assets/ko-D-4Akfw8.js +0 -1
- package/dist/assets/ko-DXnv35ZL.js +0 -9
- package/dist/assets/list-DZy6xsmU.js +0 -2
- package/dist/assets/localization-CKs8paiI.js +0 -1
- package/dist/assets/logger-BAwrOeMG.js +0 -1
- package/dist/assets/login-Bnu0F5eS.js +0 -1
- package/dist/assets/logo-uploader-DgG1moIj.js +0 -133
- package/dist/assets/lost-passport-DtNgA2rm.js +0 -168
- package/dist/assets/preferences-DfEKF75U.js +0 -1
- package/dist/assets/profile-embed-LKUTgx9A.js +0 -1
- package/dist/assets/pt-BWEktz2b.js +0 -1
- package/dist/assets/pt-bwAs6AHq.js +0 -5
- package/dist/assets/publish-resource-BzjWpXe-.js +0 -1
- package/dist/assets/ru-BdE3cdVi.js +0 -5
- package/dist/assets/ru-CivYXtU3.js +0 -1
- package/dist/assets/runtime-Sobb0AXT.js +0 -1
- package/dist/assets/sdk-DzqJHXyQ.js +0 -1
- package/dist/assets/section-BqJWD2MT.js +0 -41
- package/dist/assets/session-BV5HR2vD.js +0 -1
- package/dist/assets/setup-Bll35TpG.js +0 -30
- package/dist/assets/status-fhCB_pM_.js +0 -1
- package/dist/assets/team-DplrCM_m.js +0 -147
- package/dist/assets/th-BtarXxEz.js +0 -5
- package/dist/assets/th-DmB7Kg4h.js +0 -1
- package/dist/assets/traffic-BU5sjdLg.js +0 -1
- package/dist/assets/user-center-D4QgyhnU.js +0 -126
- package/dist/assets/vi-BMiy6Nrg.js +0 -1
- package/dist/assets/vi-CkIA1NEb.js +0 -5
- package/dist/assets/wrap-locale-BylAyLRV.js +0 -1
- package/dist/assets/zh-Ch3TJh3i.js +0 -10
- package/dist/assets/zh-CubVjUHy.js +0 -1
- package/dist/assets/zh-tw-Bza_uiUD.js +0 -9
- package/dist/assets/zh-tw-oBCLhAEX.js +0 -1
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-LvmCZD51.js","assets/index-CgCJ2qDh.js","assets/vendor-mui-core-DWYIngcn.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-Dln42oC3.js","assets/vendor-utils-J7aLFpEq.js","assets/vendor-hooks-HB6DqcLv.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-B78OG6SS.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as k,i as Et,j as nt,L as we,g as go,k as Ns,l as _s,m as bt}from"./vendor-react-Dvs43sk9.js";import{J as Oe,j as e,ak as a,b4 as Pt,W as r,am as ke,I as ce,dz as Ws,dA as Os,c9 as ko,cd as rt,dB as zs,a_ as Bs,T as A,s as jo,dC as yo,dD as Vs,cM as Us,Y as lt,at as ve,av as Ms,dE as Fs,a5 as Ye,aX as it,bc as Lt,c6 as Hs,bf as Js,b6 as Ze,d6 as Gs,bg as et,Q as X,a6 as Se,c0 as Xs,O as wo,K as vo,P as $t,ai as Co,o as Ro,M as be,a3 as Ks,bB as So,$ as To,bv as Ys,A as He,aJ as Zs,R as Do,z as re,b1 as Re,dF as Kt,bR as tt,dG as Io,V as Eo,S as At,aP as Po,bC as Qs,D as Lo,cs as en,aQ as tn,aR as on,ct as sn,cu as nn,bH as $o,aq as rn,dH as ln,a1 as Ao,a0 as ot,bi as Yt,bE as cn,bF as an,dI as dn,dJ as un,bb as Ct,y as pn,F as hn,bp as mn,bq as ft}from"./vendor-mui-core-DWYIngcn.js";import{c as F,O as ge,Z as De,$ as bn,M as me,c3 as fn,N as xn,f as Zt,c4 as gn,c5 as Qt,ai as We,a_ as kn,bD as jn,c6 as yn,c7 as wn,c8 as vn}from"./index-CgCJ2qDh.js";import{T as G,L as qo,q as Cn,n as $e,a0 as No,z as _o,M as Rn,D as qt,H as W,A as Nt,aP as _t,I as ae,_ as Wo,a as ct,h as Oo}from"./vendor-ux-Dln42oC3.js";import{C as at}from"./confirm-B4BzkG04.js";import{u as ze}from"./session-BV5HR2vD.js";import{W as Rt}from"./did-address-CdYAzzjR.js";import{E as Je}from"./empty-spinner-C6wgiyAQ.js";import{B as Wt}from"./bundle-avatar-DkLBEfff.js";import{S as Te}from"./shorten-label-BKNhALWt.js";import{L as Ot}from"./list-header-CGX6Hi0X.js";import{K as Sn,C as ue,A as zt,D as zo}from"./vendor-utils-J7aLFpEq.js";import{C as Bo}from"./click-to-copy-m7BzOuWH.js";import{t as Tn}from"./question-mark-circle.svg-B4stD6SS.js";import{l as Dn,b as In}from"./vendor-hooks-HB6DqcLv.js";import{u as Me}from"./useSetState-DFuQZPPV.js";import{e as En}from"./engine-DHKpyPwC.js";import"./api-BV16dSSm.js";import{T as Pn,S as Ln}from"./vendor-mui-x-nEbm5eNb.js";import{D as eo,C as to,P as oo}from"./react-beautiful-dnd.esm-DwkY3sYg.js";import{c as $n,A as Vo,u as Uo,S as An,U as qn,r as Nn}from"./item-C8OCvu8j.js";import{f as xe}from"./index-DBs9Ljax.js";import{D as _n}from"./delete-confirm-DhfRzwF1.js";import{g as Mo}from"./get-safe-url-Ce6hawV-.js";import{u as Le}from"./index-SrN5SE_r.js";import{M as Wn}from"./index-CW67obch.js";import{r as On}from"./index-BaBIefeb.js";import"./vendor-arcblock-B78OG6SS.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-CHNehTG3.js";function Bt({did:t,projectId:o,title:s,logo:n,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${n}`,[d,u]=k.useState(!1),f=Oe(p=>p.breakpoints.down("md"));return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",color:d?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[e.jsx(Pt,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||d?"primary.main":"grey.700"},children:l||"/"})]})]})}Bt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function Fo({initUrl:t=null}){const o=Et(),s=t?.searchParams.get("tenantScope")||"",{t:n,locale:l}=G(),{api:c}=ge(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:f}=De(),[p,m]=k.useState(null),[x,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=nt(),[g,C]=k.useState(null),D=`publish-${f.meta.did}`,R=qo(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:f.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},L=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=Cn.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.blockletDid.toLowerCase().includes(E))):g},[g,y.searchText]);if(!g&&d)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Je,{})});if(!g)return null;if(!g.length)return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:n("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:n("blocklet.publish.createBlockletTip")}),e.jsx($e,{onClick:N,variant:"contained",children:n("blocklet.publish.createBlocklet")})]});const Z=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(Bt,{did:f.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(No,{type:"success",children:E}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:E=>E?e.jsx(Rt,{size:14,compact:!0,responsive:!1,did:E}):null}},h||v?null:{label:n("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Rt,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:n("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(f.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(Wt,{size:14,blocklet:I,ancestors:[f]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:n("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:n("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(_o,{value:Number(E),locale:l})}},{label:n("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(ke,{title:n("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Ws,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(ke,{title:n("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(Os,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:n("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(ko,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=x?e.jsx(bn,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:L,extraParams:{projectId:p.id,did:f.meta.did,name:p.blockletTitle},messages:{title:n("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:n("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:n("blocklet.publish.deleteProject.confirm"),success:n("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(zn,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("common.blockletStudio")}),e.jsx(ke,{title:n("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(zs,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Rn,{options:{searchPlaceholder:n("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs($e,{onClick:N,variant:"contained",children:[e.jsx(rt,{style:{fontSize:"1.3em",marginRight:4}}),n("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:l,data:S,columns:Z,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:D,onChange:H}),p&&e.jsx(at,{title:`${n("common.delete")} ${p.blockletTitle}`,description:n("blocklet.publish.deleteProject.description"),confirm:n("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[n("blocklet.publish.deleteProject.tip1"),n("blocklet.publish.deleteProject.tip2"),n("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Bs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const zn=jo(a)`
|
|
3
|
-
${({theme:t})=>t.breakpoints.down("md")} {
|
|
4
|
-
.MuiTableRow-root {
|
|
5
|
-
border-color: ${({theme:t})=>t.palette.divider};
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
`;Fo.propTypes={initUrl:r.object};const Ho=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t};function Bn(){const{t,locale:o}=G(),{projectId:s}=nt(),{api:n}=ge(),[l,c]=k.useState(!0),{blocklet:i}=De(),d=Oe(w=>w.breakpoints.down("md")),[u,f]=k.useState(null),[p,m]=k.useState(null),[x,b]=k.useState(null),h=window.env?.serverEndpoint,j=`releases-${i.meta.did}-${s}`,v=qo(j),[g,C]=k.useState({searchText:v.searchText||"",pageSize:v.rowsPerPage||10,page:1}),D=()=>{n.getReleases({input:{did:i.meta.did,projectId:s}}).then(w=>{const S=w?.releases||[];c(!1),f(S)}).catch(w=>{c(!1),W.error(w.message)})},R=()=>{n.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:s}},getReleases:{input:{did:i.meta.did,projectId:s}}}).then(w=>{m(w.getProject.project||{}),f(w.getReleases.releases||[]),c(!1)}).catch(w=>{c(!1),W.error(w.message)})};k.useEffect(()=>{R()},[]);const[y,T]=k.useState(""),O=()=>{c(!1);const w=x.id;n.deleteRelease({input:{did:i.meta.did,projectId:s,releaseId:w}}).then(()=>{c(!1),D(),W.success(t("common.removeSuccess")),b(null)}).catch(S=>{c(!1),W.error(S.message)})},N=w=>{b(w)};if(!u&&l)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Je,{})});if(!u)return null;const z=e.jsxs(yo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(we,{to:"..",children:t("common.blockletStudio")}),e.jsx(A,{sx:{color:"text.primary"},children:e.jsx(Te,{maxLength:d?6:30,children:p.blockletTitle})})]});if(!u.length)return e.jsxs(e.Fragment,{children:[z,e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(we,{to:"create/none",children:e.jsx($e,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const K=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:w=>{const S=u[w];return e.jsx(we,{to:`view/${S.id}/${S.blockletVersion}`,children:e.jsx(Bt,{did:i.meta.did,projectId:p.id,logo:S.blockletLogo,title:S.blockletVersion,describe:S.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:w=>{const S=u[w];return e.jsx(A,{className:"note",children:Ho(S.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:w=>e.jsx(No,{type:w==="published"?"success":"warning",children:w==="published"?"Released":Sn(w)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:w=>{const S=u[w];return S.status!==me.PROJECT.RELEASE_STATUS.published?"":e.jsx(_o,{value:Number(S.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:w=>{const S=u[w];let Z="",H="";const Q=S.status==="published";if(Q){const I=ue(h,`/api/project/${i.meta.did}/${p.id}/${p.lastReleaseId}/release/blocklet.json`),V=new URL(h);V.pathname=ue(V.pathname,"/launch-blocklet/agreement"),V.searchParams.set("blocklet_meta_url",I),Z=V.href,H=ue(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${p.id}/${S.id}/download/${(S.files||[])[0]}`)}const E=p.blockletComponents?.some(I=>I.included)||S.uploadedResource?"pack":"resource";return e.jsxs(a,{sx:{display:"flex",alignItems:"center"},children:[Q&&E==="pack"&&e.jsx(ke,{title:t("blocklet.publish.install",{name:p.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:Z,target:"_blank",rel:"noreferrer",children:e.jsx(Vs,{sx:{fontSize:18}})})})}),Q&&e.jsx(ke,{title:t("blocklet.publish.download",{name:p.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:H,children:e.jsx(Us,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:t("blocklet.publish.delete",{name:p.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>N(S),children:e.jsx(ko,{sx:{fontSize:18}})})})]})}}}],P=({page:w,rowsPerPage:S,searchText:Z})=>{g.pageSize!==S?C(H=>({...H,searchText:"",pageSize:S,page:1})):g.page!==w+1?C(H=>({...H,searchText:"",page:w+1})):g.searchText!==Z&&C(H=>({...H,searchText:Z,page:1}))},L=u?.[0]?.blockletVersion||"0.0.0";return e.jsxs(Vn,{children:[e.jsx(Ot,{sx:{mb:2},left:z,actions:e.jsxs(e.Fragment,{children:[e.jsx($e,{variant:"outlined",onClick:()=>{const w=ue(h,`/api/project/${i.meta.did}/${s}/blocklet.json`);T(w)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(we,{to:`new-release/none/${L}`,children:e.jsxs($e,{variant:"contained",children:[e.jsx(rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(lt,{fullWidth:!0,maxWidth:"sm",open:y,onClose:()=>T(""),children:e.jsxs(a,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(A,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Bo,{children:y}),e.jsxs(A,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:o,data:u,columns:K,durable:j,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:P}),x&&e.jsx(at,{title:t(`${t("common.delete")} ${x.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:O,onCancel:()=>b(null)})]})}const Vn=ve(a)`
|
|
9
|
-
.main-table > div:first-child {
|
|
10
|
-
display: none;
|
|
11
|
-
}
|
|
12
|
-
.note {
|
|
13
|
-
word-break: break-all;
|
|
14
|
-
white-space: pre-line;
|
|
15
|
-
}
|
|
16
|
-
${({theme:t})=>t.breakpoints.down("md")} {
|
|
17
|
-
.MuiTableRow-root {
|
|
18
|
-
border-color: ${({theme:t})=>t.palette.divider};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`;function Fe({children:t,Icon:o=Fs}){return e.jsxs(Ms,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[e.jsx(a,{sx:{opacity:.3,fontSize:32},children:e.jsx(o,{})}),e.jsx(a,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:t})]})}Fe.propTypes={children:r.node.isRequired,Icon:r.elementType};function Jo({value:t=[],app:o,onChange:s=()=>{},onChangeBlockletResourceType:n=()=>{},disabled:l=!1,resourceRelateComponents:c={},projectType:i,dependentComponentsMode:d="auto",blockletResourceType:u=""}){const{t:f,locale:p}=G(),m=d==="readonly",x=k.useMemo(()=>{const D=t.reduce((R,y)=>(R[y.did]=y.included,R),{});return(o.children||[]).filter(R=>m?c[R.meta.did]||D[R.meta.did]:!0)},[o.children,t,c,m]),b=k.useMemo(()=>x.map(D=>t.find(y=>y.did===D.meta.did)||{did:D.meta.did}),[x,t]),h=b.reduce((D,R)=>(D[R.did]=zt(R,["required","included"]),D),{}),j=D=>{const R=b.map(y=>{if(y.did===D){const T=!y.included;return{...y,included:T,required:T}}return y});s(R)},v=D=>{const R=b.map(y=>y.did===D?{...y,required:!y.required}:y);s(R)},g=D=>{n(D.target.checked?"resource":"")},C=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:D=>{const R=x[D],y=h[R.meta.did]?.included;return e.jsxs(a,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(Wt,{size:24,blocklet:R,ancestors:[o]}),e.jsx(a,{className:Nt("text",{excluded:!y}),sx:{ml:"4px"},children:e.jsx(a,{children:R.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:D=>{const R=x[D],y=c[R.meta.did],T=!!h[R.meta.did]?.included;return e.jsx(Ye,{size:"small",checked:y||T,onClick:()=>j(R.meta.did),disabled:m||y||l})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:D=>{const R=x[D],y=c[R.meta.did],T=!!h[R.meta.did]?.included,O=!!h[R.meta.did]?.required;return e.jsx(Ye,{size:"small",checked:y||O&&T,onClick:()=>v(R.meta.did),disabled:m||y||l||!T})}}}];return e.jsx(Un,{children:x?.length?e.jsxs(e.Fragment,{children:[e.jsxs(it,{severity:"info",style:{width:"100%"},children:[e.jsxs(a,{rel:"noreferrer",sx:{display:"flex",alignItems:"center",ml:"13px"},children:[f(i==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip"),e.jsx(a,{component:"a",target:"_blank",href:i==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",children:e.jsx(Lt,{sx:{marginLeft:1}})})]}),e.jsxs(a,{component:"label",style:{cursor:"pointer"},children:[e.jsx(Ye,{size:"small",style:{marginLeft:"0px"},disabled:l,checked:u==="resource",onChange:g}),f("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:p,data:x,columns:C,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):e.jsx(Fe,{Icon:_t,children:f("blocklet.publish.blockletEmptyTip")})})}Jo.propTypes={app:r.object.isRequired,value:r.arrayOf(r.shape({did:r.string.isRequired,required:r.bool,included:r.bool})),onChange:r.func,onChangeBlockletResourceType:r.func,disabled:r.bool,dependentComponentsMode:r.string,resourceRelateComponents:r.object,blockletResourceType:r.string,projectType:r.string.isRequired};const Un=ve(a)`
|
|
22
|
-
.main-table {
|
|
23
|
-
.text.excluded {
|
|
24
|
-
color: ${({theme:t})=>t.palette.grey[400]};
|
|
25
|
-
}
|
|
26
|
-
width: 400px;
|
|
27
|
-
${({theme:t})=>t.breakpoints.down("md")} {
|
|
28
|
-
width: 100%;
|
|
29
|
-
}
|
|
30
|
-
> div:first-child {
|
|
31
|
-
display: none;
|
|
32
|
-
}
|
|
33
|
-
.MuiTableCell-head {
|
|
34
|
-
padding-top: 0;
|
|
35
|
-
padding-bottom: 0;
|
|
36
|
-
}
|
|
37
|
-
.MuiTableCell-body {
|
|
38
|
-
padding-top: 6px;
|
|
39
|
-
padding-bottom: 6px;
|
|
40
|
-
}
|
|
41
|
-
.datatable-footer {
|
|
42
|
-
display: none;
|
|
43
|
-
}
|
|
44
|
-
${({theme:t})=>t.breakpoints.down("md")} {
|
|
45
|
-
.MuiTableRow-root {
|
|
46
|
-
border-color: ${({theme:t})=>t.palette.divider};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`;var xt,so;function Mn(){return so||(so=1,xt=(t,o=1,s)=>{if(s={indent:" ",includeEmptyLines:!1,...s},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof o!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof o}\``);if(typeof s.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof s.indent}\``);if(o===0)return t;const n=s.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(n,s.indent.repeat(o))}),xt}var gt,no;function Fn(){if(no)return gt;no=1;const t=fn(),o=/\s+at.*(?:\(|\s)(.*)\)?/,s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,n=typeof t.homedir>"u"?"":t.homedir();return gt=(l,c)=>(c=Object.assign({pretty:!1},c),l.replace(/\\/g,"/").split(`
|
|
51
|
-
`).filter(i=>{const d=i.match(o);if(d===null||!d[1])return!0;const u=d[1];return u.includes(".app/Contents/Resources/electron.asar")||u.includes(".app/Contents/Resources/default_app.asar")?!1:!s.test(u)}).filter(i=>i.trim()!=="").map(i=>c.pretty?i.replace(o,(d,u)=>d.replace(u,u.replace(n,"~"))):i).join(`
|
|
52
|
-
`)),gt}var kt,ro;function Hn(){if(ro)return kt;ro=1;const t=Mn(),o=Fn(),s=l=>l.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");class n extends Error{constructor(c){if(!Array.isArray(c))throw new TypeError(`Expected input to be an Array, got ${typeof c}`);c=[...c].map(d=>d instanceof Error?d:d!==null&&typeof d=="object"?Object.assign(new Error(d.message),d):new Error(d));let i=c.map(d=>typeof d.stack=="string"?s(o(d.stack)):String(d)).join(`
|
|
53
|
-
`);i=`
|
|
54
|
-
`+t(i,4),super(i),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:c})}*[Symbol.iterator](){for(const c of this._errors)yield c}}return kt=n,kt}var jt,lo;function Jn(){if(lo)return jt;lo=1;const t=Hn();return jt=async(o,s,{concurrency:n=1/0,stopOnError:l=!0}={})=>new Promise((c,i)=>{if(typeof s!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(n)||n===1/0)&&n>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${n}\` (${typeof n})`);const d=[],u=[],f=o[Symbol.iterator]();let p=!1,m=!1,x=0,b=0;const h=()=>{if(p)return;const j=f.next(),v=b;if(b++,j.done){m=!0,x===0&&(!l&&u.length!==0?i(new t(u)):c(d));return}x++,(async()=>{try{const g=await j.value;d[v]=await s(g,v),x--,h()}catch(g){l?(p=!0,i(g)):(u.push(g),x--,h())}})()};for(let j=0;j<n&&(h(),!m);j++);}),jt}var yt,io;function Gn(){if(io)return yt;io=1;const t=Jn();return yt=(o,s)=>t(o,n=>n(),s),yt}var Xn=Gn();const st=go(Xn);function Kn(t,o){const s=new Set(o||[]),n=[];function l(c){s.has(c?.id)&&n.push(c?.id),c?.children&&c.children.forEach(l)}return(t||[]).forEach(l),n}function Go({src:t,alt:o="",...s}){const[n,l]=k.useState(!1),c=k.useRef(null);return k.useEffect(()=>{if(!("IntersectionObserver"in window))return l(!0),()=>{};const i=new IntersectionObserver(d=>{d.forEach(u=>{u.isIntersecting&&(l(!0),i.disconnect())})},{threshold:.1});return c.current&&i.observe(c.current),()=>{i.disconnect()}},[]),e.jsx("img",{ref:c,src:n?t:void 0,alt:o,...s})}Go.propTypes={src:r.string.isRequired,alt:r.string};function Xo({data:t=[],lazy:o=!1,...s}){return!t||!t.length?null:e.jsx(Yn,{...s,children:t.map(n=>e.jsx("a",{href:n.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Go,{src:n.url,alt:n.alt||""}):e.jsx("img",{src:n.url,alt:n.alt||""})},n.url))})}Xo.propTypes={data:r.arrayOf(r.shape({url:r.string,alt:r.string})),lazy:r.bool};const Yn=ve(a)`
|
|
55
|
-
display: flex;
|
|
56
|
-
justify-content: flex-start;
|
|
57
|
-
flex-wrap: wrap;
|
|
58
|
-
margin-bottom: -12px;
|
|
59
|
-
a {
|
|
60
|
-
display: flex;
|
|
61
|
-
}
|
|
62
|
-
img {
|
|
63
|
-
height: 128px;
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
margin-right: 12px;
|
|
66
|
-
margin-bottom: 12px;
|
|
67
|
-
}
|
|
68
|
-
`,wt=(t,o)=>{const s=[...t];for(;s.length>0;){const n=s.shift();if(n.id===o)return n;n.children&&s.push(...n.children)}return[]};function Ko({icon:t=""}){return t?xn(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ae,{className:"resource-icon",icon:t}):null}Ko.propTypes={icon:r.string};function Yo({disabled:t=!1,data:o=[],onChange:s=()=>{},value:n=[]}){const l=n;function c(b,h=[]){return h.push(b.id),b.children&&b.children.forEach(j=>c(j,h)),h}const i=b=>c(wt(o,b)),d=(b,h=[])=>{const j=wt(o,b);return j.parent?(h.push(j.parent),d(j.parent,h)):h};function u(b,h){const j=i(b.id),v=j.indexOf(b.id);return j.splice(v,1),j.every(g=>l.concat(h).includes(g))}const f=(b,h)=>{b.stopPropagation();const j=i(h),v=d(h);if(l.includes(h)){const g=l.filter(C=>!j.concat(v).includes(C));s(g)}else{const g=j;for(let C=0;C<v.length;++C)u(wt(o,v[C]),g)&&g.push(v[C]);s([...l].concat(g))}},p=b=>{b.stopPropagation()},m=o.some(b=>b.children?.length>0),x=b=>{const h=l.indexOf(b.id)!==-1,j=Array.isArray(b.children),v=i(b.id),g=j&&!h&&l.some(C=>v.includes(C));return e.jsx(Pn,{itemId:b.id,label:e.jsx(Ze,{onClick:p,control:e.jsx(Ye,{size:"small",checked:h,indeterminate:g,tabIndex:-1,disableRipple:!0,onClick:C=>f(C,b.id),disabled:b.disabled||t}),label:e.jsxs(a,{className:"content",children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center"},children:[b.icon&&e.jsx(Ko,{icon:b.icon}),e.jsx(a,{className:"name",children:b.name}),b.url&&e.jsx("a",{href:b.url,target:"_blank",rel:"noreferrer",className:"link",children:e.jsx(Gs,{className:"link-icon"})})]}),!!b.description&&e.jsx(a,{className:"description",children:b.description}),!!b.images?.length&&e.jsx(Xo,{className:"images",data:b.images,lazy:!0})]})}),children:j?b.children.map(x):null},b.id)};return e.jsx(Zn,{className:Nt(!m&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(Js,{}),defaultExpandIcon:e.jsx(Hs,{}),selected:l,children:o.map(b=>x(b))})}Yo.propTypes={data:r.array,value:r.array,onChange:r.func,disabled:r.bool};const Zn=ve(Ln)`
|
|
69
|
-
&.no-children {
|
|
70
|
-
.MuiTreeItem-content {
|
|
71
|
-
padding: 0;
|
|
72
|
-
.MuiTreeItem-iconContainer {
|
|
73
|
-
display: none;
|
|
74
|
-
}
|
|
75
|
-
.MuiTreeItem-label {
|
|
76
|
-
padding-left: 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
.MuiTreeItem-content {
|
|
81
|
-
align-items: flex-start;
|
|
82
|
-
.MuiTreeItem-iconContainer {
|
|
83
|
-
transform: translateY(10px);
|
|
84
|
-
}
|
|
85
|
-
&.Mui-selected {
|
|
86
|
-
background-color: transparent;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
.MuiTreeItem-label {
|
|
90
|
-
cursor: default;
|
|
91
|
-
}
|
|
92
|
-
.MuiFormControlLabel-root {
|
|
93
|
-
align-items: flex-start;
|
|
94
|
-
}
|
|
95
|
-
.content {
|
|
96
|
-
padding-top: 6px;
|
|
97
|
-
}
|
|
98
|
-
.name {
|
|
99
|
-
font-size: 16px;
|
|
100
|
-
font-weight: 700;
|
|
101
|
-
}
|
|
102
|
-
.resource-icon {
|
|
103
|
-
margin-right: 2px;
|
|
104
|
-
font-size: 16px;
|
|
105
|
-
}
|
|
106
|
-
img.resource-icon {
|
|
107
|
-
width: 1rem;
|
|
108
|
-
height: 1rem;
|
|
109
|
-
}
|
|
110
|
-
.link {
|
|
111
|
-
margin-left: 8px;
|
|
112
|
-
font-size: 16px;
|
|
113
|
-
color: ${({theme:t})=>t.palette.primary.main};
|
|
114
|
-
display: flex;
|
|
115
|
-
}
|
|
116
|
-
.link-icon {
|
|
117
|
-
font-size: inherit;
|
|
118
|
-
}
|
|
119
|
-
.description {
|
|
120
|
-
font-size: 14px;
|
|
121
|
-
color: ${({theme:t})=>t.palette.text.secondary};
|
|
122
|
-
}
|
|
123
|
-
`,co={},Zo=(t,o,{key:s,cacheTime:n=1e3*3}={})=>{const l=s+JSON.stringify({params:o}),c=co[l];if(c&&c.timestamp>Date.now()-n)return c.promise;const i=t(...o);return co[l]={promise:i,timestamp:Date.now()},i},Qo=(t,o)=>(t.forEach(s=>{o&&(s.parent=o),(s.children||[]).forEach(n=>{n.parent=s.id,Qo(n.children||[],n.id)})}),t),es=(t,o,s,n,l)=>{const{exportApi:c="/"}=t?.meta.resource||{},i=new URL(ue("http://127.0.0.1",t?.mountPoint,c||"/").replace(/\/+/g,"/"));return i.searchParams.set("projectId",o),i.searchParams.set("releaseId",s),i.searchParams.set("local",n),l&&i.searchParams.set("resourcesParams",l.searchParams.get("resourcesParams")),`${i.pathname}${i.search}`},Qn=async({api:t,appDid:o,component:s,projectId:n,releaseId:l,locale:c,initUrl:i,resources:d})=>{let u;if(i&&i.searchParams.get("resourcesParams"))try{u=JSON.parse(i.searchParams.get("resourcesParams"))}catch(f){W.error(f.message);return}await zo.post(es(s,n,l,c,i),{resources:d,projectId:n,releaseId:l,locale:c,...u?{resourcesParams:u}:{}},{headers:{"x-csrf-token":gn()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:n,releaseId:"",componentDid:s.meta.did,resources:d}})},er=(t,o)=>{if(!t)return{};const s=o.reduce((l,c)=>(l[c]=!0,l),{}),n=(l,c)=>(l.forEach(i=>{s[i.id]&&i.dependentComponents?.length&&i.dependentComponents.forEach(d=>{c[d]=!0}),i.children&&n(i.children,c)}),c);return n(t,{})};function ts({app:t,component:o,projectId:s,release:n={id:""},loading:l=!1,error:c="",saveSelectedEventsRef:i,readOnly:d,componentDid:u="",initialResources:f={},setResourceComponentsMap:p=()=>{},selectedResourceIds:m,setSelectedResourceIds:x,showTree:b,initUrl:h=null}){const{t:j,locale:v}=G(),{api:g}=ge(),[C,D]=Me({}),R=k.useRef({}),y=k.useRef(!1),T=n.id;R.current.projectId=s,R.current.releaseId=T;const O=(P,L,w)=>{if(!L)return;const S=er(L,w);p?.({[P]:Object.keys(S)})},N=P=>{i.current[o.meta.did]={resources:P,component:o},x({[o.meta.did]:P}),O(o.meta.did,C[o.meta.did],P)},z=k.useCallback(async P=>{try{const L=await Zo(zo.get,[es(P,s,T,v,h),{timeout:6e4}],{key:"getResources"});return Qo(L?.data?.resources||[])}catch{return[]}},[s,T,v,h]);k.useEffect(()=>{C[o?.meta.did]||z(o).then(P=>{D({[o?.meta.did]:P})}).catch(P=>{W.error(P.message)})},[o,D,C,z]),k.useEffect(()=>{T&&s&&!y.current&&st(t.children.map(P=>async()=>{if(!(u&&u!==P.meta.did)&&!(!P?.mountPoint||!En.hasStartEngine(P?.meta)||!P?.meta?.resource?.exportApi))try{const L=await z(P);D({[P?.meta.did]:L});const S=(await g.getSelectedResources({input:{did:t.meta.did,projectId:s,releaseId:T,componentDid:P.meta.did}}))?.resources||[];S?.length&&(x({[P.meta.did]:Kn(L,S)}),O(P.meta.did,L,S),d||(i.current[P?.meta.did]={resources:S,component:P}))}catch(L){W.error(L.message)}}),{concurrency:2}).then(()=>{y.current=!0})},[T,s,d,v,h,D]),k.useEffect(()=>{f&&Object.keys(f).length&&st(t.children.map(async P=>{const L=f[P.meta.did];if(L?.length){const w=await z(P);x({[P.meta.did]:L}),O(P.meta.did,w,L),d||(i.current[P?.meta.did]={resources:L,component:P})}}))},[t,f,d]);let K=null;return(!o||!C[o.meta.did]?.length)&&(K=e.jsx(Fe,{Icon:_t,children:j("blocklet.publish.resourceEmptyTip",{name:Zt.getDisplayName(o)})})),o?.status!=="running"&&(K=e.jsx(Fe,{children:j("blocklet.publish.componentNotRunning",{name:Zt.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(tr,{className:Nt(c&&"error"),children:b&&e.jsx(a,{sx:{pb:2,width:"100%"},children:K||e.jsx(Yo,{data:C[o.meta.did]||[],value:m[o.meta.did]||[],onChange:N,disabled:l||d})})}),!!c&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:c})]})}ts.propTypes={component:r.object.isRequired,app:r.object.isRequired,projectId:r.string.isRequired,error:r.string,saveSelectedEventsRef:r.object.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired,release:r.shape({id:r.string.isRequired,status:r.string}),initialResources:r.object,initUrl:r.object,setResourceComponentsMap:r.func,componentDid:r.string,selectedResourceIds:r.object.isRequired,setSelectedResourceIds:r.func.isRequired,showTree:r.bool.isRequired};const tr=ve(a)`
|
|
124
|
-
border: 1px solid;
|
|
125
|
-
border-color: ${({theme:t})=>t.palette.divider};
|
|
126
|
-
max-height: 600px;
|
|
127
|
-
width: 100%;
|
|
128
|
-
&.error {
|
|
129
|
-
border-color: ${({theme:t})=>t.palette.error.main};
|
|
130
|
-
}
|
|
131
|
-
border-radius: 4px;
|
|
132
|
-
padding: 16px;
|
|
133
|
-
padding-bottom: 0px;
|
|
134
|
-
overflow-y: auto;
|
|
135
|
-
.footer {
|
|
136
|
-
border-top: 1px solid #ddd;
|
|
137
|
-
display: flex;
|
|
138
|
-
padding: 12px 0;
|
|
139
|
-
margin-top: 12px;
|
|
140
|
-
position: sticky;
|
|
141
|
-
bottom: 0;
|
|
142
|
-
background: #fff;
|
|
143
|
-
z-index: 10;
|
|
144
|
-
}
|
|
145
|
-
`,ao="lastWantToConnectStoreId";function or(t){const[o,s]=k.useState(null),{session:n}=ze(),l=k.useCallback(d=>{s(d),localStorage.setItem(ao,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(ao),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let f=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==n?.user?.did));return f||(f=t?.settings?.storeList?.[0]),f},[t?.settings?.storeList,n?.user?.did]);return[o||c||{},l]}const vt={};async function Vt(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:n=4e3,timerKey:l=""}){vt[l]&&clearTimeout(vt[l]),await new Promise(d=>setTimeout(d,n));const c=Date.now(),i=async(d,u)=>{try{const f=await t();d(f)}catch(f){Date.now()-c>s?u(f):l?vt[l]=setTimeout(()=>i(d,u),o):setTimeout(()=>i(d,u),o)}};return new Promise(i)}function sr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function nr(t,{did:o,projectId:s,messageId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:n}});if(!l?.project?.blockletDid)throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function rr(t,{did:o,projectId:s,storeId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!l?.project?.connectedStores?.length)throw new Error("Connected store not found");if(!l.project.connectedStores.find(i=>i.storeId===n))throw new Error("Connected store not found")},{timerKey:`connect-store-${n}`})}function lr(t,{did:o,projectId:s,endpointId:n}){return Vt(async()=>{const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!l?.project?.connectedEndpoints?.length)throw new Error("Connected endpoint not found");if(!l.project.connectedEndpoints.find(i=>i.endpointId===n))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${n}`})}const Ut=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:n})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||!i.scope||i.scope==="studio"||i.scope===n),{teamDid:l,storeList:c}};function os({blocklet:t=null,store:o=null,onChangeStore:s,onClick:n,disabled:l,loading:c,componentDid:i}){const{t:d}=G(),{session:u}=ze(),{api:f,info:p,inService:m}=ge(),x=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=L=>{s(L),h(!1)},y=()=>{h(!b)},T=L=>{j.current&&j.current.contains(L.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await x?.actions?.refreshBlocklet()}catch(L){W.error(`Remove Blocklet Store Error: ${xe(L)}`)}finally{D(null)}},{storeList:K}=Ut({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(X,{onClick:n,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(X,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Xs,{})})]}),e.jsx(wo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:L})=>e.jsx(vo,{...L,style:{transformOrigin:"center top"},children:e.jsx($t,{children:e.jsx(Co,{onClickAway:T,children:e.jsxs(Ro,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),$n({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Ks,{}),e.jsxs(be,{onClick:O,children:[e.jsx(rt,{font:!0}),e.jsx(A,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Vo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:x?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}os.propTypes={store:r.object,blocklet:r.object,onChangeStore:r.func.isRequired,onClick:r.func.isRequired,loading:r.bool.isRequired,disabled:r.bool.isRequired,componentDid:r.string.isRequired,projectType:r.string.isRequired,getData:r.func.isRequired};const ss=(t,o,s)=>{const n=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${n}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:n,uploadScreenshotPrefix:l}},ir=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Mt({url:t,style:o={},controls:s=1,modestbranding:n=1}){const{t:l}=G(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||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://www.youtube.com/embed/${d}?modestbranding=${n}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(A,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Mt.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};function ns({setParams:t,onClose:o,params:s}){const{t:n}=G(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=ir(l),u=()=>{t(f=>{const p=[...f.blockletVideos];return p.push(l),{...f,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(So,{children:n("studio.videoDialogTitle")}),e.jsxs(To,{children:[e.jsx(Ys,{fullWidth:!0,value:l,onChange:f=>c(f.target.value),placeholder:n("studio.videoInputLabel"),endAdornment:l?e.jsx(He,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Zs,{})})}):null,error:i}),i&&e.jsx(A,{variant:"body2",color:"error",children:n("studio.duplicateVideo")}),e.jsx(Mt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Do,{children:[e.jsx(X,{onClick:()=>o(),children:n("studio.cancel")}),e.jsx(X,{disabled:!d||i,onClick:u,children:n("studio.confirm")})]})]})}ns.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function St({errors:t,storeList:o,...s}){const{t:n}=G();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:n("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(ke,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}St.propTypes={errors:r.object.isRequired,storeList:r.array.isRequired};const uo=k.lazy(()=>Wo(()=>import("./index-LvmCZD51.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function rs({projectId:t,readOnly:o,loading:s,blocklet:n,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:f,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:x,componentDid:b=""}){const{t:h,locale:j}=G(),{api:v}=ge(),g=Et(),C=k.useRef(null),D=k.useRef(null),[R,y]=or(n),[T,O]=k.useState(!1),N=Uo({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),z=async q=>{const Y=setTimeout(()=>{f(!1)},2e4),J=await nr(v,q);f(!1),clearTimeout(Y),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=sr();N(async(Y,J)=>{try{const se=await v.connectByStudio({input:{did:n?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:n?.meta?.did,projectId:"",messageId:q})}catch(se){const de=xe(se);W.error(de),f(!1)}})},{logoUrl:P,screenshotUrls:L,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ss(l,n,t),{logoErrors:Z,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Y=Array.from(l.blockletScreenshots),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Y}))},ee=q=>{if(!q.destination)return;const Y=Array.from(l.blockletVideos),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Y}))};return e.jsxs(cr,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:q=>{d({blockletTitle:""}),c({blockletTitle:q.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(He,{position:"end",children:e.jsx(os,{blocklet:n,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:q=>{d({blockletDescription:""}),c({blockletDescription:q.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.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)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(re,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Pt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(St,{errors:Z,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(eo,{onDragEnd:o?void 0:U,children:e.jsx(to,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[L.map((J,se)=>e.jsx(oo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.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:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Kt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,L.length<5&&e.jsx(a,{onClick:()=>{V()&&D.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),I&&e.jsx(St,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{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(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(eo,{onDragEnd:o?void 0:ee,children:e.jsx(to,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((J,se)=>e.jsx(oo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Mt,{url:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Kt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Je,{}),children:[e.jsx(uo,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),x(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,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"),T&&e.jsx(ns,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(uo,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Y=>{const J=Y.blockletScreenshots||[];return J.push(q.data?.filename),{...Y,blockletScreenshots:J}}),D.current?.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-L.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")]})]})}rs.propTypes={projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,setLoading:r.func.isRequired,initUrl:r.object,componentDid:r.string,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const cr=ve.div`
|
|
146
|
-
margin-top: 24px;
|
|
147
|
-
.screenshot {
|
|
148
|
-
margin-bottom: 16px;
|
|
149
|
-
max-width: 240px;
|
|
150
|
-
max-height: 135px;
|
|
151
|
-
width: 240px;
|
|
152
|
-
height: 135px;
|
|
153
|
-
overflow: hidden;
|
|
154
|
-
display: flex;
|
|
155
|
-
align-items: center;
|
|
156
|
-
justify-content: center;
|
|
157
|
-
background-color: #eee;
|
|
158
|
-
margin-right: 16px;
|
|
159
|
-
position: relative;
|
|
160
|
-
.action {
|
|
161
|
-
visibility: hidden;
|
|
162
|
-
position: absolute;
|
|
163
|
-
width: 42px;
|
|
164
|
-
height: 42px;
|
|
165
|
-
right: 6px;
|
|
166
|
-
top: 6px;
|
|
167
|
-
border-radius: 4px;
|
|
168
|
-
background-color: rgba(0, 0, 0, 1);
|
|
169
|
-
color: rgba(255, 255, 255, 1);
|
|
170
|
-
}
|
|
171
|
-
&:hover .action {
|
|
172
|
-
visibility: visible;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
.screenshot img {
|
|
176
|
-
width: 100%; /* 图像宽度填充容器 */
|
|
177
|
-
height: auto; /* 图像高度自适应 */
|
|
178
|
-
}
|
|
179
|
-
`,ar=(t,o,s,n)=>{const l=t?[...t]:[],c=(o?.children||[]).reduce((i,d)=>(i[d.meta.did]=!0,i),{});return Object.keys(s).forEach(i=>{if(!c[i])return;let d=!1;n||l.forEach(u=>{u.did===i&&(u.included=!0,u.required=!0,d=!0)}),d||l.push({did:i,included:!0,required:!0})}),l},dr=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],n=await(await fetch(t)).blob();return new File([n],o,{type:n.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*ur(t,o){let s=0;for(;s<t.size;)yield t.slice(s,s+o),s+=o}const pr=async({did:t,projectId:o,uploadType:s="logo",imageUrl:n})=>{const l=await dr(n);new FormData().append("file",l);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(l.name),name:encodeURIComponent(l.name),type:l.type},u=(await Qt.post(ue(F.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,s,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":l.size,"X-Uploader-File-Ext":l.name.split(".").pop(),"Upload-Metadata":Object.keys(i).map(x=>`${x} ${btoa(i[x])}`).join(",")}})).headers.location,f=2*1024*1024;let p=0,m="";for(const x of ur(l,f)){const b=await Qt.patch(ue(F.WELLKNOWN_SERVICE_PATH_PREFIX,u),x,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":p,"Content-Type":"application/offset+octet-stream"}});p+=x.size,m=b.data.filename}return m},ls=({params:t,projectId:o,status:s,t:n})=>{const l=[];return t.blockletTitle||l.push({param:"blockletTitle",message:n("blocklet.publish.errorTip.noTitle")}),(!o||o===F.UNOWNED_DID)&&l.push({param:"projectId",message:n("blocklet.publish.errorTip.noDid")}),t.blockletVersion?We.valid(t.blockletVersion)||l.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.inValidVersion")}):l.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.noVersion")}),s===me.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||l.push({param:"blockletDescription",message:n("blocklet.publish.errorTip.noDescription")}),t.note||l.push({param:"note",message:n("blocklet.publish.errorTip.noNote")})),l.length?l:null},hr=({params:t,step:o,t:s,projectId:n})=>{if(o===0){if(!t.blockletTitle)return s("blocklet.publish.errorTip.noTitle");if(!n||n===F.UNOWNED_DID)return s("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return s("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return s("blocklet.publish.errorTip.noVersion");if(!We.valid(t.blockletVersion))return s("blocklet.publish.errorTip.inValidVersion");if(!t.note)return s("blocklet.publish.errorTip.noNote")}return""};function is({blocklet:t,releaseId:o,connectedStores:s,projectId:n,releaseType:l,publishedStoreIds:c=[],onPublish:i=()=>{},onDelete:d=()=>{},warning:u={},projectType:f="",componentDid:p="",onOpenConnectStore:m=()=>{},behavior:x="connect",version:b,onSelectConnectStore:h=()=>{}}){const{t:j}=G(),{actions:{refreshBlocklet:v}}=De(),{session:g}=ze(),{storeList:C}=Ut({fromBlocklet:!0,blocklet:t,userDid:g?.user?.did}),D=k.useMemo(()=>s?.length?s?.reduce((T,O)=>(T[O.storeId]=O,T),{}):{},[s]),R=t?.meta?.did,y={};return Object.entries(u?.logoErrors||{}).forEach(([T,O])=>{const N=Object.values(O);N.length>0&&(y[T]=N)}),Object.entries(u?.screenshotErrors||{}).forEach(([T,O])=>{const N=Object.values(O);N.length>0&&(y[T]=y[T]?[...y[T],...N]:N)}),e.jsxs(e.Fragment,{children:[x==="connect"&&!!C?.length&&e.jsx(it,{severity:"info",style:{width:"100%"},children:e.jsxs(a,{component:"a",href:f==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",rel:"noreferrer",sx:{color:Io[400],display:"flex",alignItems:"center"},children:[j(f==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(Lt,{sx:{marginLeft:1}})]})}),e.jsx(Eo,{children:C?.map(T=>e.jsx(At,{"data-cy":"store-switch",children:e.jsx(Po,{children:e.jsx(An,{behavior:x,onSelectConnectStore:h,releaseId:o,projectId:n,releaseType:l,kind:"publish",teamDid:R,warningList:y[T.url],store:T,version:b,published:c?.indexOf(T.id)>-1,connectedStore:D[T.id],onPublish:i,onDelete:d,scope:T.scope||"studio",onOpenConnectStore:m})})},T.url))}),e.jsx(Vo,{teamDid:R,storeList:C,scope:"studio",onAdd:v})]})}is.propTypes={blocklet:r.object.isRequired,projectId:r.string.isRequired,releaseId:r.string.isRequired,releaseType:r.string.isRequired,onPublish:r.func,onDelete:r.func,publishedStoreIds:r.arrayOf(r.string),connectedStores:r.arrayOf(r.object).isRequired,projectType:r.string,componentDid:r.string,warning:r.object,onOpenConnectStore:r.func,onSelectConnectStore:r.func,behavior:r.string,version:r.string.isRequired};function cs({disabled:t=!1,endpointList:o=[],teamDid:s,onAdd:n=()=>{},hiddenChildren:l=!1,open:c=!1,onClose:i=()=>{}}){const{api:d}=ge(),[u,f]=k.useState(!1),[p,m]=k.useState(!0),[x,b]=k.useState(!1),[h,j]=k.useState(""),[v,g]=k.useState(""),{t:C}=G(),D=()=>{j(""),b(!1),i()},R=async()=>{f(!0);try{const{decoded:y}=kn(h,o);await d.addUploadEndpoint({input:{teamDid:s,url:y}}),n(y),D()}catch(y){const T=`${C("blocklet.publish.endpoint.addFailed")} ${xe(y)}`;g(T)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[!l&&e.jsxs(At,{button:!0,disabled:t,sx:y=>({marginTop:"8px",justifyContent:"center",color:y.palette.primary.main,lineHeight:"3.2"}),onClick:()=>{b(!0)},children:[e.jsx(rt,{font:!0}),e.jsx(A,{variant:"inherit",children:C("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ct,{title:C("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:c||x,onClose:D,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx($e,{onClick:y=>{y.stopPropagation(),D()},color:"inherit",children:C("common.cancel")}),e.jsxs($e,{onClick:y=>{y.stopPropagation(),R()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u||!h||p,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Se,{size:16}),C("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Qs,{component:"div",children:e.jsx(A,{component:"div",children:e.jsx(re,{label:C("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:h,onChange:y=>{g(null);let T=!1;y.target.value.trim()||(T=!0),y.target.value.trim()||g(C("blocklet.publish.endpoint.urlEmpty")),j(y.target.value),m(T)},disabled:u,onKeyPress:y=>{y.key==="Enter"&&(y.preventDefault(),y.target.value.trim()?R():g(C("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!v&&e.jsx(it,{severity:"error",style:{width:"100%"},children:v})]})]})}cs.propTypes={teamDid:r.string.isRequired,disabled:r.bool,endpointList:r.array,onAdd:r.func,hiddenChildren:r.bool,open:r.bool,onClose:r.func};function as({endpoint:t,teamDid:o,onDelete:s="",projectId:n="",children:l=null}){const{api:c}=ge(),{t:i}=G(),d=Lo(),u=De(),[f,p]=k.useState(!1),[m,x]=k.useState(null),b=()=>{p(!1),x(null)},h=async()=>{try{p(!0),await c.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:n}}),await u?.actions?.refreshBlocklet(),s?.()}catch(g){W.error(`${i("blocklet.publish.endpoint.deleteFailed")}: ${xe(g)}`)}finally{p(!1),x(null)}},j={keyName:t.url,title:i("blocklet.publish.endpoint.deleteEndpoint"),description:i("blocklet.publish.endpoint.deleteDesc",{name:`<b>${t.url}</b>`,color:d.palette.error.main}),confirmPlaceholder:i("blocklet.publish.endpoint.confirmDesc",{name:t.url}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:h,onCancel:b},v=g=>{t.protected||(g.stopPropagation(),x(j))};return e.jsxs(e.Fragment,{children:[l?e.jsx(a,{component:"span",onClick:v,children:l}):e.jsx(X,{"data-cy":"endpoint-action-delete",color:"primary",disabled:f,onClick:v,size:"small",children:e.jsx(tt,{sx:{zoom:.95}})}),m?e.jsx(_n,{keyName:m.keyName,title:m.title,description:m.description,confirmPlaceholder:m.confirmPlaceholder,confirm:m.confirm,cancel:m.cancel,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel}):null]})}as.propTypes={endpoint:r.object.isRequired,teamDid:r.string.isRequired,onDelete:r.func,projectId:r.string,children:r.node};function ds({connectedEndpoint:t,onDisconnect:o=()=>{},onDelete:s=()=>{},endpoint:n,teamDid:l,projectId:c=""}){const[i,d]=k.useState(null),u=!!i,{t:f}=G(),[p,m]=k.useState(!1),x=g=>{g.stopPropagation(),window.open(Mo(`${ue(n.url)}`,{allowDomains:null}))},b=g=>{d(g.currentTarget)},h=()=>{d(null)},j=()=>{m(!1),o()},v=[{label:f("blocklet.publish.endpoint.visitEndpoint"),action:x,icon:Lt},{label:f("common.disconnect"),action:()=>{h(),m(!0)},icon:en,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(X,{ref:i,color:"primary",onClick:b,size:"small",children:e.jsx(tn,{sx:{zoom:.95}})}),e.jsxs(on,{anchorEl:i,open:u,onClose:h,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[v.map(g=>g.hidden?null:e.jsxs(be,{dense:!0,onClick:g.action,disabled:g.disabled,children:[g.icon&&e.jsx(g.icon,{color:"action",sx:{marginRight:1}}),e.jsx(a,{sx:{color:"action"},children:g.label})]},g.label)),e.jsx(as,{endpoint:n,teamDid:l,onDelete:s,projectId:c,children:e.jsxs(be,{dense:!0,disabled:n.protected,children:[e.jsx(tt,{sx:{color:n.protected?"action":"error.main",marginRight:1}}),e.jsx(a,{sx:{color:n.protected?"action":"error.main"},children:f("common.delete")})]})})]}),p&&e.jsx(at,{displayError:!0,title:`${f("common.disconnect")} ${n.appName}`,description:f("blocklet.publish.endpoint.disconnectEndpointTip",{url:n.url}),confirm:f("common.confirm"),onConfirm:j,onCancel:()=>m(!1)})]})}ds.propTypes={connectedEndpoint:r.object.isRequired,onDisconnect:r.func,onDelete:r.func,endpoint:r.object.isRequired,teamDid:r.string.isRequired,projectId:r.string};function Tt({developerUrl:t,developerDid:o,sx:s={},...n}){return e.jsx(Pt,{sx:{width:24,height:24,...s},src:ue(new URL(t).origin,F.WELLKNOWN_SERVICE_PATH_PREFIX,`/user/avatar/${o}?imageFilter=resize&w=120&h=120`),...n})}Tt.propTypes={developerDid:r.string.isRequired,developerUrl:r.string.isRequired,sx:r.object};function us({endpoint:t,published:o}){const{t:s}=G(),n=()=>{window.open(Mo(`${ue(t.url)}`,{allowDomains:null}))};return e.jsxs(a,{children:[e.jsx(A,{variant:"subtitle2",children:s(o?"blocklet.publish.endpoint.publishToEndpointSuccess":"blocklet.publish.endpoint.uploadToEndpointSuccess",{name:t.appName})}),e.jsx(X,{size:"small",sx:{mt:1},onClick:n,variant:"contained",color:"success",children:s("common.visitTarget",{name:t.appName})})]})}us.propTypes={endpoint:r.object.isRequired,published:r.bool.isRequired};const po=jo(({className:t,...o})=>e.jsx(ke,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${rn.tooltip}`]:{backgroundColor:"#fff",color:"rgba(0, 0, 0, 0.87)",borderRadius:8,padding:t.spacing(2),fontSize:t.typography.pxToRem(12),border:"1px solid rgba(0,0,0,0.08)",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.05)"}}));function ps({teamDid:t,projectId:o="",releaseId:s="",endpoint:n,warningList:l=[],onDelete:c=()=>{},published:i=!1,onPublish:d=()=>{},connectedEndpoint:u=null,onOpenConnectEndpoint:f=()=>{}}){const{t:p}=G(),{api:m}=ge(),[x,b]=k.useState(!1),h=Uo({messageType:"connect-endpoint-message",onOpen:()=>b(!0),onClose:()=>b(!1)}),j=!!u,v=()=>{h(async(y,T)=>{try{const O=await m.connectToEndpoint({input:{did:t,endpointId:n.id,projectId:o}});if(!O?.url){W.error("failed to connect to endpoint");return}T(O.url),await f({did:t,projectId:o,endpointId:n.id}),b(!1)}catch(O){const N=xe(O);W.error(N),b(!1)}})},g=async()=>{try{await m.disconnectFromEndpoint({input:{did:t,endpointId:n.id,projectId:o}}),c()}catch(y){W.error(xe(y))}},C=()=>{b(!0),m.publishToEndpoint({input:{did:t,endpointId:n.id,projectId:o,releaseId:s}}).then(()=>{W.success(e.jsx(us,{endpoint:n,published:!0}),{duration:1e4}),d?.(null)}).catch(y=>{W.error(xe(y)),d?.(y)}).finally(()=>{b(!1)})};k.useEffect(()=>{j&&b(!1)},[j]);const D=l.length>0,R=e.jsxs(X,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:D,onClick:C,children:[x?e.jsx(Se,{sx:{marginRight:1},size:16}):e.jsx(sn,{sx:{marginRight:1,fontSize:20}}),p("common.upload")]});return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",overflow:"hidden",width:"100%"},children:[e.jsxs(a,{sx:{flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden",flex:1},children:[e.jsx(a,{sx:{display:"flex",flexDirection:"row"},children:e.jsx(A,{component:"span",sx:{fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},variant:"subtitle1",children:n.appName})}),e.jsx(A,{sx:{fontSize:14,opacity:.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},component:"span",variant:"inherit",children:`${n.url}`})]}),e.jsxs(a,{sx:{flex:1,display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},children:[u&&e.jsx(po,{placement:"top",title:e.jsxs(a,{children:[e.jsx(A,{component:"span",variant:"caption",sx:{opacity:.7},children:p("blocklet.publish.developerInfo")}),e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(Tt,{developerUrl:n.url,developerDid:u.developerDid,sx:{width:42,height:42}}),e.jsxs(a,{sx:{flex:1},children:[e.jsx(A,{component:"span",variant:"subtitle1",children:u.developerName}),e.jsx(Rt,{size:14,copyable:!0,compact:!0,responsive:!1,did:u.developerDid})]})]})]}),children:e.jsx(a,{children:e.jsx(Tt,{developerUrl:n.url,developerDid:u.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(et,{disabled:x,variant:"outlined",sx:{height:38},size:"small",children:[!j&&e.jsxs(X,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:v,children:[x?e.jsx(Se,{sx:{marginRight:1},size:16}):e.jsx(nn,{sx:{marginRight:1}}),p("common.connect")]}),j&&i&&e.jsxs(X,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[x?e.jsx(Se,{sx:{marginRight:1},size:16}):e.jsx($o,{sx:{marginRight:1}}),p("common.uploaded")]}),j&&!i&&(D?e.jsx(po,{title:e.jsxs(a,{children:[e.jsx(a,{sx:{color:"error.main",mb:.5},children:p("blocklet.publish.storeRule.warning")}),l.map((y,T)=>e.jsxs(a,{sx:{color:"error.main"},children:[T+1,". ",y]},y))]}),children:e.jsx("div",{children:R})}):R),e.jsx(ds,{projectId:o,endpoint:n,teamDid:t,connectedEndpoint:u,onDisconnect:g,onDelete:c})]})]})]})}ps.propTypes={teamDid:r.string.isRequired,published:r.bool,connectedEndpoint:r.shape({endpointId:r.string,accessKeyId:r.string,accessKeySecret:r.string,createdBy:r.string,developerDid:r.string,developerName:r.string,developerEmail:r.string}),warningList:r.array,projectId:r.string,releaseId:r.string,endpoint:r.shape({id:r.string.isRequired,appName:r.string,url:r.string.isRequired,endpoint:r.string.isRequired,protected:r.bool,connected:r.bool}).isRequired,onDelete:r.func,onOpenConnectEndpoint:r.func,onPublish:r.func};function hs({releaseId:t,blocklet:o,connectedEndpoints:s,projectId:n,publishedEndpointIds:l=[],onPublish:c=()=>{},onDelete:i=()=>{},warning:d={},onOpenConnectEndpoint:u=()=>{}}){const{actions:{refreshBlocklet:f}}=De(),{session:p}=ze(),{t:m}=G(),x=(o?.settings?.endpointList||[]).filter(v=>v.scope===p?.user?.did),b=k.useMemo(()=>s?.length?s?.reduce((v,g)=>(v[g.endpointId]=g,v),{}):{},[s]),h=o?.meta?.did,j={};return Object.entries(d?.logoErrors||{}).forEach(([v,g])=>{const C=Object.values(g);C.length>0&&(j[v]=C)}),Object.entries(d?.screenshotErrors||{}).forEach(([v,g])=>{const C=Object.values(g);C.length>0&&(j[v]=j[v]?[...j[v],...C]:C)}),e.jsxs(e.Fragment,{children:[!!x?.length&&e.jsx(it,{severity:"info",style:{width:"100%"},children:e.jsx(a,{sx:{color:Io[400]},children:m("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(Eo,{sx:{flex:1},children:x?.map(v=>e.jsx(At,{"data-cy":"endpoint-switch",children:e.jsx(Po,{children:e.jsx(ps,{releaseId:t,projectId:n,teamDid:h,warningList:j[v.url],endpoint:v,published:l?.indexOf(v.id)>-1,connectedEndpoint:b[v.id],onPublish:c,onDelete:i,onOpenConnectEndpoint:u})})},v.url))}),e.jsx(cs,{teamDid:h,endpointList:x,onAdd:f})]})}hs.propTypes={releaseId:r.string.isRequired,blocklet:r.object.isRequired,projectId:r.string.isRequired,warning:r.object,onPublish:r.func,onOpenConnectEndpoint:r.func,onDelete:r.func,connectedEndpoints:r.arrayOf(r.object).isRequired,publishedEndpointIds:r.arrayOf(r.string)};function ms({did:t,params:o,setParams:s,projectId:n,open:l,onClose:c}){const{t:i}=G(),[d,u]=k.useState(!1),{api:f}=ge(),[p,m]=k.useState(!1),[x,b]=k.useState(!1),h=()=>{m(o.autoUpload),b(o.possibleSameStore),u(!1),c(!1)},j=async()=>{u(!0);try{await f.updateProject({input:{did:t,projectId:n,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!p,possibleSameStore:!!x}}),s({autoUpload:p,possibleSameStore:x}),c(!1)}catch(g){W.error(g.message)}u(!1)};k.useEffect(()=>{m(o.autoUpload),b(o.possibleSameStore)},[o]);const v=!!(n&&n!==F.UNOWNED_DID);return e.jsx(ct,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:l,onClose:h,actions:e.jsxs(e.Fragment,{children:[e.jsx(X,{onClick:g=>{g.stopPropagation(),c()},color:"inherit",children:i("common.cancel")}),v&&e.jsxs(X,{onClick:g=>{g.stopPropagation(),j()},color:"primary","data-cy":"install-blocklet-next-step",disabled:d,variant:"contained",autoFocus:!0,children:[d&&e.jsx(Se,{size:16}),i("common.confirm")]})]}),children:v?e.jsxs(a,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{component:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),e.jsx(Le,{checked:p,onChange:(g,C)=>m(C)})]}),e.jsxs(a,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.possibleSameStoreTip")}),e.jsx(Le,{checked:x,onChange:(g,C)=>b(C)})]})]}):e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(a,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(A,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}ms.propTypes={did:r.string.isRequired,params:r.object.isRequired,open:r.bool.isRequired,onClose:r.func.isRequired,setParams:r.func.isRequired,projectId:r.string.isRequired};function bs({downloadUrl:t,installUrl:o,handleSetTip:s,isPack:n,disabled:l}){const{t:c}=G(),[i,d]=k.useState(!1),u=k.useRef(null),f=()=>{d(!i)},p=m=>{u.current&&u.current.contains(m.target)||d(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(X,{disabled:l,ref:u,onClick:f,children:e.jsx(a,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(wo,{sx:{zIndex:10},open:i,anchorEl:u.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:m})=>e.jsx(vo,{...m,style:{transformOrigin:"center top"},children:e.jsx($t,{children:e.jsx(Co,{onClickAway:p,children:e.jsxs(Ro,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[n&&e.jsx(a,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(be,{sx:{color:"#333"},children:[e.jsx(a,{component:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(A,{variant:"inherit",children:c("blocklet.publish.installToThisServer")})]})}),e.jsxs(be,{onClick:s,children:[e.jsx(a,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(A,{variant:"inherit",children:c("blocklet.publish.copyInstallUrl")})]}),e.jsx(a,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(be,{sx:{color:"#333"},children:[e.jsx(a,{component:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(A,{variant:"inherit",children:c("common.download")})]})})]})})})})})]})}bs.propTypes={disabled:r.bool.isRequired,isPack:r.bool.isRequired,downloadUrl:r.string.isRequired,installUrl:r.string.isRequired,handleSetTip:r.func.isRequired};const ho=window.env?.serverEndpoint;function fs({projectId:t,params:o,setParamsErrTip:s,initUrl:n=null,setParams:l,mode:c,loading:i,blocklet:d,release:u=null,releaseId:f,getData:p,getRelease:m,paramsErrTip:x,warning:b,componentDid:h="",resourceRelateComponents:j,disabledSelectComponents:v=!1,saveSelectedEventsRef:g,hasSelectedResources:C,initLogoUrl:D,setLoading:R,clearHistoryParams:y,projectType:T,readOnly:O}){const{t:N,locale:z}=G(),K=[{label:e.jsx(a,{sx:{textAlign:"center",width:"100%"},children:N("blocklet.publish.store")}),value:"store"},{label:e.jsx(a,{sx:{textAlign:"center",width:"100%"},children:N("blocklet.publish.endpoint.tab")}),value:"endpoint"}],[P,L]=k.useState(K[0].value),{api:w}=ge(),S=Et(),[Z,H]=k.useState(!1),[Q,E]=k.useState(!1),[I,V]=k.useState(),U=Oe(ne=>ne.breakpoints.down("md")),ee=k.useMemo(()=>o?.blockletResourceType?o?.blockletResourceType:o?.blockletComponents?.length>0?o?.blockletComponents.find(Ie=>Ie.included)?"resource":"pack":"resource",[o?.blockletComponents,o?.blockletResourceType]),q=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:h},"*"),m()},Y=async ne=>{if(x?.blockletHomepage||x?.blockletSupport||x?.blockletCommunity){W.error(x?.blockletHomepage||x?.blockletSupport||x?.blockletCommunity);return}const Ie=ls({params:o,projectId:t,status:ne,t:N});if(Ie){W.error(Ie.map(B=>B.message).join("; ")),s(Ie.reduce((B,te)=>({...B,[te.param]:te.message}),{}));return}const _={...o};if(_.blockletComponents=ar(_.blockletComponents,d,j,v),_.blockletVersion=We.valid(_.blockletVersion),!_.blockletVersion){W.error("Invalid Blocklet Version"),s({blockletVersion:"Invalid Blocklet Version"});return}if(D)try{const B=await pr({did:d.meta.did,projectId:t,imageUrl:D});_.blockletLogo=B,l({blockletLogo:B})}catch(B){W.error(B.message);return}if(o.resourceFromSelect){_.uploadedResource="";try{const B=Object.keys(g.current);await st(B.map(te=>()=>{const je=g.current[te];return Qn({api:w,locale:z,projectId:t,releaseId:"",appDid:d.meta.did,component:je.component,resources:je.resources,initUrl:n})}),{concurrency:2})}catch(B){W.error(B?.response?.data?.error?.message||B.message),s({blockletResource:"Invalid save the resource"});return}}else o.blockletDocker?.dockerImage||(_.blockletComponents=[]);_.blockletTitle=(_.blockletTitle||"").trim(),_.blockletDescription=(_.blockletDescription||"").trim(),_.blockletSupport=(_.blockletSupport||"").trim(),_.blockletHomepage=(_.blockletHomepage||"").trim(),_.blockletCommunity=(_.blockletCommunity||"").trim(),_.blockletRepository=(_.blockletRepository||"").trim(),_.blockletIntroduction=(_.blockletIntroduction||"").trim(),_.note=(_.note||"").trim(),_.blockletComponents=(_?.blockletComponents||[]).filter(B=>B.included).map(B=>zt(B,["did","required"])).map(JSON.stringify),_.contentType!=="docker"&&(_.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),_.blockletDocker.dockerImage=_.blockletDocker.dockerImage||"",_.blockletDocker.dockerArgs.length>0&&_.blockletDocker.dockerArgs.forEach(B=>{B.proxyBehavior=B.proxyBehavior||"service"});try{await w.createRelease({input:{..._,note:JSON.stringify({note:_.note}),did:d.meta.did,projectId:t,releaseId:"",status:ne}}),y(),W.success(N("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:h},"*"),s({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(B){const te=xe(B);W.error(te),(/resource/.test(te)||/zip/.test(te))&&s({blockletResource:te});return}const Be=await w.getProject({input:{did:d.meta.did,projectId:t}}),Ae=Be.project.lastReleaseId;o.autoUpload&&await st(Be.project.connectedStores.map(B=>async()=>{try{const te=b.logoErrors[B.storeUrl];if(te){const ye=Object.keys(te).find(Ee=>!!te[Ee]);if(ye){W.warning(N("blocklet.publish.autoPublishErrorTip",{storeName:B.storeName,error:te[ye]}));return}}const je=b.screenshotErrors[B.storeUrl];if(je){const ye=Object.keys(je).find(Ee=>!!je[Ee]);if(ye){W.warning(N("blocklet.publish.autoPublishErrorTip",{storeName:B.storeName,error:je[ye]}));return}}const ie=await w.publishToStore({input:{did:d.meta.did,storeId:B.storeId,storeName:B.storeName,projectId:t,releaseId:Ae,type:ee}});W.success(e.jsx(qn,{storeName:B.storeName,storeUrl:B.storeUrl,developerDid:B.developerDid,did:t,published:ie.url==="published",version:_.blockletVersion}),{duration:1e4})}catch(te){W.error(xe(te))}}),{concurrency:4}),q?.(),S(`../${t}/view/${Ae}/${_.blockletVersion}`,{replace:!0})},J=ne=>(R(!0),Y(ne).finally(()=>{R(!1)})),se=async ne=>{await rr(w,ne),p()},de=async ne=>{await lr(w,ne),p()},le=()=>{E(!0)},pe=ue(ho,`/api/project/${d.meta.did}/${t}/${f}/release/blocklet.json`),he=new URL(ho);he.pathname=ue(he.pathname,"/launch-blocklet/agreement"),he.searchParams.set("blocklet_meta_url",pe);const Ge=he.href,Xe=()=>V(pe);return e.jsxs(e.Fragment,{children:[e.jsx(mr,{className:"sticky-header",children:e.jsx(Ot,{left:e.jsxs(yo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(we,{to:"../",children:N("common.blockletStudio")}),t===F.UNOWNED_DID?e.jsx(A,{sx:{color:"text.primary"},children:e.jsx(Te,{maxLength:U?6:30,children:o?.blockletTitle||"Blocklet"})}):e.jsx(we,{to:`../${t}`,children:e.jsx(Te,{maxLength:U?6:30,children:o?.blockletTitle||"Blocklet"})}),e.jsx(A,{sx:{color:"text.primary"},children:c==="create"?N("common.create"):o?.blockletVersion||N("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!O&&e.jsxs(et,{disabled:i,variant:"contained",children:[e.jsxs(X,{variant:"contained",onClick:()=>J(me.PROJECT.RELEASE_STATUS.published),children:[i&&e.jsx(Se,{size:14,sx:{mr:.5},color:"inherit"}),N("blocklet.publish.createRelease")]}),e.jsx(X,{variant:"contained",onClick:le,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),O&&e.jsxs(e.Fragment,{children:[e.jsx(lt,{fullWidth:!0,maxWidth:"sm",open:I,onClose:()=>V(""),children:e.jsxs(a,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(A,{variant:"h6",sx:{mb:2},children:N("blocklet.publish.installResourceTip")}),e.jsx(Bo,{children:I}),e.jsxs(A,{sx:{mt:2},children:[N("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:N("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(et,{disabled:i,variant:"contained",children:[e.jsxs(X,{onClick:()=>H(!0),children:[i?e.jsx(Se,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(ln,{sx:{fontSize:"1.3em",mr:1}}),N(U?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(bs,{isPack:ee==="pack",downloadUrl:ue(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${d.meta.did}/${t}/${f}/download/${(u?.files||[])[0]}`),installUrl:Ge,handleSetTip:Xe}),e.jsx(X,{onClick:le,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(ct,{title:N("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:Z,onClose:()=>H(!1),children:e.jsxs(a,{children:[e.jsx(a,{sx:{mt:-2,mb:2},children:e.jsx(Oo,{tabs:K,current:P,onChange:L})}),P==="store"&&e.jsx(is,{projectType:T,blocklet:d,version:o.blockletVersion,releaseType:ee,projectId:t,releaseId:f,componentDid:h,warning:b,onPublish:q,onOpenConnectStore:se,onDelete:p,connectedStores:o.connectedStores||[],publishedStoreIds:u?.publishedStoreIds}),P==="endpoint"&&e.jsx(Re,{sx:{minHeight:400},children:e.jsx(hs,{blocklet:d,releaseType:ee,projectId:t,releaseId:f,warning:b,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:q,onOpenConnectEndpoint:de,onDelete:p})})]})}),e.jsx(ms,{did:d?.meta?.did,params:o,projectId:t,open:Q,setParams:l,onClose:()=>E(!1)})]})}fs.propTypes={projectId:r.string.isRequired,params:r.object.isRequired,mode:r.string.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,release:r.object,releaseId:r.string.isRequired,getData:r.func.isRequired,getRelease:r.func.isRequired,componentDid:r.string,resourceRelateComponents:r.object.isRequired,disabledSelectComponents:r.bool,saveSelectedEventsRef:r.object.isRequired,hasSelectedResources:r.bool.isRequired,initLogoUrl:r.string.isRequired,setLoading:r.func.isRequired,projectType:r.string.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,setParams:r.func.isRequired,initUrl:r.object,paramsErrTip:r.object.isRequired,clearHistoryParams:r.func.isRequired,readOnly:r.bool.isRequired};const mr=ve.div`
|
|
180
|
-
.sticky-header {
|
|
181
|
-
margin-top: -12px;
|
|
182
|
-
padding: 12px 0;
|
|
183
|
-
position: sticky;
|
|
184
|
-
top: 0;
|
|
185
|
-
z-index: 99;
|
|
186
|
-
display: flex;
|
|
187
|
-
align-items: center;
|
|
188
|
-
justify-content: space-between;
|
|
189
|
-
background-color: #fff;
|
|
190
|
-
padding-bottom: 12px;
|
|
191
|
-
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
192
|
-
}
|
|
193
|
-
`;function xs({text:t}){const{palette:o}=Lo();return t?e.jsx(Wn,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:jn.sanitize(t),rehypePlugins:[[On,{target:"_blank"}]]}):e.jsx(Fe,{Icon:_t})}xs.propTypes={text:r.string.isRequired};function gs({params:t,setParams:o,paramsErrTip:s,loading:n,setParamsErrTip:l,readOnly:c}){const{t:i}=G(),[d,u]=k.useState(c?"preview":"write"),f=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(A,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Ao,{value:d,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(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(re,{disabled:n||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(He,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(xs,{text:t.blockletIntroduction||""})})]})}gs.propTypes={params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired};function ks({step:t=0,ok:o=!1,active:s=0,error:n="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx($o,{sx:{fontSize:18,margin:0},color:"white"})),n||!o&&s>t?(c="error.main",i=e.jsx(Yt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Yt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}ks.propTypes={step:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};function js({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:n=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:f}){const{t:p}=G(),m=()=>{s(j=>j+1)},x=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||ls({params:l,projectId:f,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(cn,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!hr({params:l,projectId:f,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(an,{children:[e.jsx(dn,{icon:e.jsx(ks,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(un,{children:[e.jsx(A,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(X,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(X,{disabled:v===0,onClick:x,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx($t,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}js.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.oneOfType([r.string,r.bool]),loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.oneOfType([r.string,r.bool]),warning:r.object.isRequired,paramsErrTip:r.shape({projectId:r.string,blockletVersion:r.string,blockletTitle:r.string,blockletDescription:r.string,note:r.string,blockletResource:r.string,blockletHomepage:r.string,blockletSupport:r.string,blockletCommunity:r.string,blockletRepository:r.string,blockletDocker:r.object,dockerImageName:r.string}).isRequired};const br=[".zip",".gz"],fr=1024*1024*100,xr=k.lazy(()=>Wo(()=>import("./index-LvmCZD51.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ys({app:t,projectId:o,readOnly:s,params:n,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=G(),f=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!n.uploadedResource&&e.jsx(A,{component:"a",href:`${m}/params.uploadedResource`,children:n.uploadedResource}),!s&&e.jsx(X,{variant:"outlined",size:"small",onClick:()=>{p()&&f.current?.open()},children:n.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Je,{}),children:e.jsx(xr,{ref:f,locale:u,popup:!0,onUploadFinish:x=>{l({uploadedResource:x.data.filename}),c({blockletResource:""}),f.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:br,maxFileSize:fr,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ys.propTypes={app:r.object.isRequired,projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired};function Dt({readOnly:t,params:o,setParams:s,paramsErrTip:n,setParamsErrTip:l,loading:c}){const{t:i}=G();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!n.blockletVersion,helperText:n.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(re,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!n.note,helperText:n.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(He,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Dt.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,loading:r.bool.isRequired};function ws(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&ws(t[o]);return t}var gr=Nn();const oe=go(gr),kr={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ft={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},jr={"--volume":!0,"--publish":!0},yr=new Set(["--publish","--volume"]),vs=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function wr(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...n]=o.value.split(":");if(!s||!vs(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...n].join(":")}})}function vr(t){let o=!0;return t.find(n=>n.key==="--publish"&&n.type==="web")?t.map(n=>{if(n.key==="--publish"){const l={...n,type:o?"docker":n.type};return o=n.type==="web",l}return n}):t.map(n=>{if(n.key==="--publish"){const l={...n,type:o?"web":"docker"};return o=!1,l}return n})}function mo(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const n=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[x,...b]=m.split("=");if(x){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:x,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let x=p,b=null;m!==-1&&(x=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=kr[x];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,n.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),n.push({key:h,value:j}),c+=2;continue}else{n.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){n.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");n.push({key:h,value:j}),c+=2;continue}else{n.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const f=[];for(const p of n)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(yr.has(p.key)&&p.value==="true")&&f.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:vr(wr(f)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function Cr({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:n}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const f=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${f} \\`)}else if(!l.some(f=>f.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const f=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${f} \\`)}}for(const i of o){const{key:d,value:u}=i,f=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${f} \\`)}return s&&l.push(` ${s} \\`),n&&l.push(` ${n} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
|
|
194
|
-
`)}const Cs={"--volume":t=>{const[o]=t.split(":");return o?vs(t)&&!t.startsWith("$BLOCKLET_APP_DIR/")&&!t.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":t.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},Qe=t=>t.replace(/^[-]+/,"").replace(/-([a-z])/g,(n,l)=>l.toUpperCase()),Rr=t=>`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`,Sr=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],Tr=["rm ","sudo "];function Rs(t){if(t==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(t))throw new Error("Docker CMD is invalid");const s=t.toLocaleLowerCase();if(Tr.some(l=>s.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(Sr.some(l=>t.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(t))throw new Error("Docker CMD is invalid")}const Dr=Array.from(new Set(Object.keys(Ft).map(Qe))),Ir=["publish","volume"];oe.object({workdir:oe.string().trim().optional(),image:oe.string().trim().regex(/^[^\s]+$/).optional(),shell:oe.string().trim().optional(),volumes:oe.array().items(oe.string().trim()).optional(),script:oe.string().trim().optional(),installNodeModules:oe.boolean().optional(),skipWrapDockerfile:oe.boolean().optional(),command:oe.string().allow("").default("").optional().custom((t,o)=>{try{return Rs(t),t}catch(s){return o.error("any.invalid",{message:s.message})}},"Docker CMD validation"),runBaseScript:oe.boolean().optional(),...Dr.reduce((t,o)=>{const s=Cs[Rr(o)];return Ir.includes(o)?(t[o]=oe.array().items(oe.string().trim()).optional(),s?t[o]=oe.array().items(oe.string().trim().custom((n,l)=>{const c=s(n);return c?l.message(c):n})).optional():t[o]=oe.array().items(oe.string().trim()).optional(),t):(s?t[o]=oe.string().trim().custom((n,l)=>{const c=s(n);return c?l.message(c):n}).optional():t[o]=oe.string().trim().optional(),t)},{})}).optional();function It({index:t,item:o,dockerParams:s,setDockerParams:n,dataKey:l,t:c,readOnly:i}){const d=o?.value||"",[u,f]=k.useState(!1),p=()=>{s[l]?.splice(t,1),n({...s,[l]:[...s[l]]})},m=(P,L)=>{s[l]?.[t]&&(L?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${Qe(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),n({...s,[l]:[...s[l]]})},x=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],secure:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},n({...s,[l]:[...s[l]]})},b=(P,L)=>{s[l][t]={...s[l][t],shared:L},n({...s,[l]:[...s[l]]})},h=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],required:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},n({...s,[l]:[...s[l]]})},j=(P,L)=>{s[l][t]={...s[l][t],value:L?me.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},n({...s,[l]:[...s[l]]})},v=P=>{s[l][t]={...s[l][t],description:P.target.value},n({...s,[l]:[...s[l]]})},g=P=>{const L=P.target.value==="web"?"web":"docker";L==="web"&&s.dockerArgs.forEach(Z=>{Z.type="docker"});const S=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:L,path:L==="docker"?S:"/",protocol:"http",prefix:L==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},n({...s,dockerArgs:[...s.dockerArgs]})},C=P=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:P.target.value==="direct"?"direct":"service"},n({...s,dockerArgs:[...s.dockerArgs]})},D=P=>{const L=P.target.value;s[l][t]={...s[l][t],prefix:L,path:L==="*"?"/":L},n({...s,[l]:[...s[l]]})},R=P=>{s[l]?.[t]&&(s[l][t].value=P.target.value),n({...s,[l]:[...s[l]]})},y=d===`$${Qe(o.key)}`||o.custom,T=l==="dockerArgs"&&!Ft[o.key],O=jr[o.key],N=l==="dockerEnvs",z=o.key==="--publish";let K=o.key;return z&&o.type==="web"?K="--publish (Web)":N&&(K=`--env ${o.key}`),e.jsxs(a,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(a,{sx:{width:250},children:e.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:K})}),e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(re,{disabled:i||y||T||o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:y?`$${Qe(o.key)}`:d,sx:{flex:1},error:T,onChange:R,slotProps:{input:{endAdornment:e.jsxs(He,{position:"end",sx:{zoom:.9},children:[(!(O||T)||N||z)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!i&&e.jsx(ce,{onClick:p,color:T?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})}}}),T&&e.jsx(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:c("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Cs[o.key](d)&&e.jsx(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.volumeTips")})]}),u&&e.jsx(ct,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:c(N?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[O||T||N?null:e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.needCustomInput")}),e.jsx(Le,{disabled:i,checked:y,onChange:m,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.shared")}),e.jsx(Le,{disabled:i,checked:o.shared,onChange:b,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.required")}),e.jsx(Le,{disabled:i,checked:o.required,onChange:h,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.secure")}),e.jsx(Le,{disabled:i,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.autoGenerated")}),e.jsx(Le,{disabled:i,checked:o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:j,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.description")}),e.jsx(re,{disabled:i,value:o.description,onChange:v,sx:{flex:1},label:c("blocklet.publish.docker.description")})]}),z&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.portType")}),e.jsxs(Ct,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.proxyBehavior")}),e.jsxs(Ct,{value:o.proxyBehavior||"service",onChange:C,children:[e.jsx(be,{value:"service",children:c("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:c("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:i,value:o.prefix,onChange:D,sx:{flex:1},label:c("blocklet.publish.docker.prefix")})]})]})})]})}It.propTypes={dockerParams:r.object.isRequired,setDockerParams:r.func.isRequired,dataKey:r.string.isRequired,item:r.object.isRequired,t:r.func.isRequired,readOnly:r.bool.isRequired,index:r.number.isRequired};const Er=`
|
|
195
|
-
docker run --name postgrest
|
|
196
|
-
-p 3000:3000
|
|
197
|
-
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
198
|
-
-e PGRST_DB_SCHEMA="public"
|
|
199
|
-
-e PGRST_DB_ANON_ROLE="anon"
|
|
200
|
-
postgrest/postgrest
|
|
201
|
-
`.trim();function Ss({readOnly:t,paramsErrTip:o,setParamsErrTip:s,error:n,params:l,setParams:c}){const{t:i}=G(),[d,u]=k.useState("dockerCommand"),[f,p]=k.useState(""),[m,x]=k.useState(!1),[b,h]=k.useState("--volume"),[j,v]=k.useState(""),[g,C]=k.useState(mo(f)),D=g.dockerArgs||[],R=g.dockerEnvs||[],y=g.dockerImage||"",T=g.dockerCommand||"",O=w=>{const{value:S}=w.target;p(S)};k.useEffect(()=>{l.blockletDocker&&l.blockletDocker.dockerImage&&!y&&C(l.blockletDocker)},[l,y,C]);const N=w=>{const S=mo(w.target.value);C(Z=>{const H=Z.dockerArgs.find(I=>I.key==="--publish"&&I.type==="web");let Q=!1;const E=I=>{I.type="web",I.path=H.path||"/",I.protocol=H.protocol||"http",I.prefix=H.prefix||"/",I.name=H.name||"publicUrl",I.port=H.port||"BLOCKLET_PORT"};if(S.dockerArgs.forEach(I=>{const V=Z.dockerArgs.find(U=>U.key===I.key);V&&(Object.entries(V).forEach(([U,ee])=>{ee!=null&&U!=="value"&&(I[U]=ee)}),I.proxyBehavior=I.proxyBehavior||"server",I.key==="--publish"&&I.type==="web"&&(Q?I.type="docker":(E(I),Q=!0)))}),H&&!S.dockerArgs.find(V=>V.key==="--publish"&&V.type==="web")){const V=S.dockerArgs.find(U=>U.key==="--publish"&&U.value===H.value);V?E(V):(Q=!1,S.dockerArgs.forEach(U=>{U.key==="--publish"&&!Q&&(E(U),Q=!0)}))}return S.dockerEnvs.forEach(I=>{const V=Z.dockerEnvs.find(U=>U.key===I.key);V&&Object.entries(V).forEach(([U,ee])=>{ee!=null&&U!=="value"&&(I[U]=ee)})}),S})},z=()=>{if(x(!1),b==="--env"){C({...g,dockerEnvs:[...R,{key:j,value:"",custom:"",secure:!1,shared:!1,required:!1,description:j}]}),v("");return}C({...g,dockerArgs:[...D,{key:b,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},K=()=>{x(!1),v("")},P=w=>{const{value:S}=w.target;C({...g,dockerImage:S}),S.indexOf(" ")>-1?s({...o,dockerImageName:i("blocklet.publish.docker.dockerImageNameError")}):s({...o,dockerImageName:""})},L=w=>{const{value:S}=w.target;C({...g,dockerCommand:S});try{Rs(S),s({...o,dockerCMD:""})}catch{s({...o,dockerCMD:i("blocklet.publish.docker.dockerCMDError")})}};return k.useEffect(()=>{d==="dockerCommand"&&p(Cr(g))},[g,d]),k.useEffect(()=>{c(w=>({...w,blockletDocker:{dockerImage:g.dockerImage,dockerCommand:g.dockerCommand,dockerArgs:g.dockerArgs,dockerEnvs:g.dockerEnvs}}))},[g,c]),e.jsxs(a,{sx:{mt:3},children:[e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[e.jsx(a,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:e.jsxs(Ao,{value:d,onChange:(w,S)=>u(S),children:[e.jsx(ot,{value:"dockerCommand",label:i("blocklet.publish.docker.dockerCommand")}),e.jsx(ot,{value:"dockerParams",label:i("blocklet.publish.docker.dockerParams")})]})}),d==="dockerCommand"&&e.jsxs(a,{children:[e.jsx(re,{disabled:t,label:i("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Er,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:O,onBlur:N,slotProps:{input:{"data-cy":"blocklet-docker-command",readOnly:t}}}),e.jsxs(a,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(a,{sx:{flex:1}}),e.jsx(X,{sx:{mt:2},variant:"contained",onClick:()=>u("dockerParams"),children:i("blocklet.publish.docker.nextTab")})]})]}),d==="dockerParams"&&e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(re,{disabled:t,label:i("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:y,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:P}),e.jsx(re,{disabled:t,label:`Docker CMD (${i("common.optional")})`,placeholder:"Docker CMD",value:T,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:L}),e.jsx(a,{sx:{height:4}}),D.map((w,S)=>e.jsx(It,{index:S,item:w,dockerParams:g,setDockerParams:C,dataKey:"dockerArgs",t:i,readOnly:t},`${w.key}-${S}`)),R.map((w,S)=>e.jsx(It,{index:S,item:w,dockerParams:g,setDockerParams:C,dataKey:"dockerEnvs",t:i,readOnly:t},`${w.key}-${S}`)),!t&&e.jsxs(a,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(a,{sx:{flex:1}}),e.jsx(X,{onClick:()=>x(!0),children:i("blocklet.publish.docker.addItem")})]})]})]}),!!n&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:n}),m&&e.jsxs(lt,{fullWidth:!0,open:!0,children:[e.jsx(So,{children:i("blocklet.publish.docker.addItem")}),e.jsx(To,{children:e.jsxs(pn,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(Ct,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:b,sx:{width:"100%"},onChange:w=>h(w.target.value),children:Object.keys(Ft).map(w=>e.jsx(be,{value:w,children:w}))}),b==="--publish"&&e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:i("blocklet.publish.docker.publishTips")}),b==="--volume"&&e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:i("blocklet.publish.docker.volumeTips")}),b==="--env"&&e.jsxs(a,{sx:{mt:3,width:"100%"},children:[e.jsx(re,{value:j,onChange:w=>v(w.target.value),sx:{width:"100%"},label:i("blocklet.publish.docker.envKey")}),e.jsx(hn,{children:i("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Do,{children:[e.jsx(X,{onClick:K,children:i("common.cancel")}),e.jsx(X,{onClick:z,children:i("common.confirm")})]})]})]})}Ss.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired,paramsErrTip:r.func.isRequired};function bo(t,o,{ttl:s=1e3*60*60,skipStorage:n=!1,onUpdate:l=()=>{}}={}){const[c,i]=Dn(o),d=k.useRef(null),u=k.useRef(l);k.useEffect(()=>{if(n)return;const p=yn(t);p&&(i(p),d.current=p),u.current(p)},[t,i,n]);const f=k.useCallback(p=>{i(m=>{const x=typeof p=="function"?p(m):{...m,...p};return wn(t,x,s,100),x})},[t,s,i]);return{state:c,setState:n?i:f,historyStateRef:d,removeStorage:()=>{vn(t)}}}const Pr=({tabs:t,blocklet:o,ancestors:s=[]})=>{const n=o.meta.did;t.push({label:e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(Wt,{size:24,blocklet:o,ancestors:s}),e.jsx(a,{className:"text",sx:{ml:"4px"},children:e.jsx(a,{children:o.meta.title})})]},n),value:n})},fo=(t,o)=>{const s=zt(t,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note","connectedEndpoints"]);return s.blockletComponents?s.blockletComponents=s.blockletComponents.map(n=>({...n,included:!0})):s.blockletComponents=(o.children||[]).map(n=>({did:n.meta.did,included:!1,required:!1})),s},Lr={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},xo={resources:2,blocklets:3};function Ts({initUrl:t=null,...o}){const{projectId:s,mode:n,releaseId:l,lastVersion:c,componentDid:i=""}=nt(),d=s===F.UNOWNED_DID||n==="view",{t:u,locale:f}=G(),{blocklet:p}=De(),{state:m,setState:x,historyStateRef:b,removeStorage:h}=bo(`blocklet-studio-params-${s}-${c}`,{blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}},{skipStorage:d}),[j,v]=Me({}),[g,C]=Me({}),D=k.useRef(""),[R,y]=k.useState(!1),[T,O]=Me(null),{api:N}=ge(),z=Oe($=>$.breakpoints.down("md")),[K,P]=k.useState({}),L=k.useRef({}),{state:w,setState:S}=bo(`blocklet-studio-selectedResourceIds-${s}-${c}`,{},{skipStorage:s===F.UNOWNED_DID||n==="view"}),[Z,H]=k.useState(""),[Q,E]=Me({}),I=t?.searchParams.get("dependentComponentsMode"),V=I==="readonly",{session:U}=ze(),{storeList:ee}=Ut({fromBlocklet:!0,blocklet:p,userDid:U?.user?.did}),[q,Y]=k.useState([]);k.useEffect(()=>{Array.isArray(ee)&&ee.length>0&&Promise.all(ee.map(async $=>({...(await(await fetch(`${$.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:$}))).then($=>{Y($)})},[ee.length]),k.useEffect(()=>{const $={},M={},{logoUrl:Ce,screenshotUrls:Pe}=ss(m,p,s);Promise.all(q.map(async fe=>{const{maxImageCount:qe,minImageCount:ut,logoImageType:Ne,imageMinHeight:Ve,imageMinWidth:_e}=fe,Ke=Array.isArray(Ne)?Ne:Ne.split(",");$[fe.storeInfo.url]||($[fe.storeInfo.url]={}),M[fe.storeInfo.url]||(M[fe.storeInfo.url]={});const pt=M[fe.storeInfo.url],Ps=$[fe.storeInfo.url];Number(qe)<=Pe.length&&(pt.maxImageCount=u("blocklet.publish.storeRule.maxImageCount",{max:qe,count:Pe.length,unit:qe>1?u("blocklet.publish.storeRule.screenshots"):u("blocklet.publish.storeRule.screenshot")})),Number(fe.minImageCount)>Pe.length&&(pt.minImageCount=u("blocklet.publish.storeRule.minImageCount",{min:ut,count:Pe.length,unit:ut>1?u("blocklet.publish.storeRule.screenshots"):u("blocklet.publish.storeRule.screenshot")}));const Xt=Ce?Ce.split(".").pop():"";Xt&&!(Ke.includes("jpg")?[...Ke,"jpeg"]:Ke).includes(Xt)&&(Ps.logoFormat=u("blocklet.publish.storeRule.logoFormat",{format:Ke.join(",")})),await Promise.all(Pe.map((Ls,ht)=>{const mt=new Image;return mt.src=Ls,new Promise($s=>{mt.onload=()=>{const{width:As,height:qs}=mt;if(As<Number(_e)||qs<Number(Ve)){let Ue="";switch(ht+1){case 1:Ue=u("blocklet.publish.storeRule.first");break;case 2:Ue=u("blocklet.publish.storeRule.second");break;case 3:Ue=u("blocklet.publish.storeRule.third");break;default:Ue=`${ht+1}`;break}pt[`imageSize-${ht+1}`]=u("blocklet.publish.storeRule.minImageSize",{width:_e,height:Ve,name:Ue})}$s()}})}))})).then(()=>{const fe=Object.values($).some(_e=>Object.values(_e).length>0),qe=Object.values(M).some(_e=>Object.values(_e).length>0),Ne={logoErrors:$,screenshotErrors:M,storeList:ee,hasWarning:fe||qe,hasLogoWarning:fe,hasScreenshotWarning:qe},Ve=JSON.stringify(Ne);Ve!==D.current&&(C(Ne),D.current=Ve)})},[m,p.did,s,q,u]);const J=k.useMemo(()=>{const $={};return Object.keys(Q).forEach(M=>{const Ce=Q[M];Ce&&Ce.forEach(Pe=>{$[Pe]=!0})}),$},[Q]),se=k.useCallback($=>{V&&x({blockletComponents:[]}),E($)},[V,E,x]),de=k.useCallback((...$)=>{S(...$),v({blockletResource:"",blockletDocker:""})},[]),le=l==="none"?m?.lastReleaseId||"":l,[pe,he]=k.useState(n==="new-release"?4:0),Ge=t?.searchParams.get("resourcesTitle"),Xe=t?.searchParams.get("componentsTitle"),ne=[{label:u("blocklet.publish.branding"),description:u("blocklet.publish.steps.branding")},{label:u("common.introduction"),description:u("blocklet.publish.steps.introduction")},{label:Ge||u("blocklet.publish.resourceTitle"),description:u("blocklet.publish.steps.resources")},{label:Xe||u("common.components"),description:u("blocklet.publish.steps.blocklets")},{label:u("blocklet.publish.versionTitle"),description:u("blocklet.publish.steps.version")}],Ie=ne[pe]||ne[ne.length-1],_=Lr[pe];k.useEffect(()=>{s&&v({projectId:""})},[s,v]);const Be=k.useMemo(()=>m?.blockletResourceType==="resource"?"resource":m?.blockletComponents?.some($=>$.included)||Object.keys(J).length||m?.uploadedResource?"pack":"resource",[m?.blockletComponents,m?.uploadedResource,J,m?.blockletResourceType]),Ae=[],B=(p?.children||[]).filter($=>$.meta.resource?.exportApi).filter($=>!i||$.meta.did===i);B.forEach($=>{Pr({tabs:Ae,blocklet:$,ancestors:[p]})});const[te,je]=k.useState(Ae[0]?.value),ie=n==="view",ye=In(()=>{if(!t)return;H(t.searchParams.get("logo")),x(M=>({...M,blockletTitle:M?.blockletTitle||t.searchParams.get("title"),blockletDescription:M?.blockletDescription||t.searchParams.get("description"),blockletIntroduction:M?.blockletIntroduction||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:M?.blockletComponents?.length?M?.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:M?.note||t.searchParams.get("note")||"No note"}));const $=t.searchParams.get("resources");try{const M=JSON.parse($);P(M)}catch{}}),Ee=async()=>{if(le)try{const $=await N.getRelease({input:{did:p.meta.did,projectId:s,releaseId:le}});if(y(!1),!$.release){W.error("Release not found");return}$.release.note=Ho($.release.note,"note"),$.release=ws($.release),n!=="view"&&($.release.note=""),x(M=>({...fo({...M,...$.release,blockletVersion:n==="create"||n==="new-release"?We.inc($.release.blockletVersion,"patch"):$.release.blockletVersion},p)})),O($.release)}catch($){y(!1),W.error(xe($))}},Ht=async()=>{if(s===F.UNOWNED_DID){x({blockletVersion:"0.0.1",blockletTitle:""});return}if(!s){W.error(u("blocklet.publish.errorTip.noDid"));return}try{const M=(await Zo(N.getProject,[{input:{did:p.meta.did,projectId:s}}],{key:"getProject"})).project||{};M.blockletVersion?(n==="create"||n==="new-release")&&We.valid(M.blockletVersion)&&(M.blockletVersion=We.inc(M.blockletVersion,"patch")):M.blockletVersion="0.0.1";const Ce=fo(M,p);x({...Ce}),M.lastReleaseId||ye()}catch($){W.error(xe($))}},dt=k.useCallback(async()=>{if(!R){y(!0);try{if(n==="view"){if(!le){W.error("Empty release id");return}await Ht(),await Ee();return}await Ht(),le&&await Ee()}finally{n!=="view"&&x($=>({...$,...b.current})),y(!1)}}},[n,le]),Ds=$=>{x({blockletComponents:$})},Is=$=>{x({blockletResourceType:$})};k.useEffect(()=>{dt()},[dt]),k.useEffect(()=>{s===F.UNOWNED_DID&&(n==="create"||n==="new-release")&&t&&ye()},[s,t,n,ye]),k.useEffect(()=>{m.contentType==="docker"?x({resourceFromSelect:!1}):m.contentType==="blocklet"?x({resourceFromSelect:!0}):m.contentType==="upload"&&x({resourceFromSelect:!1})},[m.contentType,x]);const Jt=k.useMemo(()=>!!Object.keys(w).find($=>!!w[$].length),[w]);if(!m&&R)return e.jsx(Je,{});if(!m)return null;const Gt=B.find($=>$.meta.did===te),Es=$=>{je($)};return e.jsxs($r,{...o,children:[e.jsx(fs,{blocklet:p,release:T,getData:dt,getRelease:Ee,mode:n,params:m,setParams:x,setParamsErrTip:v,warning:g,readOnly:ie,loading:R,setLoading:y,initLogoUrl:Z,releaseId:le,projectId:s,projectType:Be,resourceComponents:B,resourceComponentsMap:Q,resourceRelateComponents:J,resourceItem:Gt,saveSelectedEventsRef:L,hasSelectedResources:Jt,setRelease:O,paramsErrTip:j,clearHistoryParams:h}),e.jsxs(a,{sx:{display:"flex",flexDirection:"column",width:"100%"},children:[e.jsx(a,{sx:{pt:3}}),e.jsxs(a,{sx:{display:"flex",flexDirection:z?"column":"row",gap:3},children:[!z&&e.jsx(js,{steps:ne,loading:R,viewMode:n==="view",params:m,hasSelectedResources:Jt||m.uploadedResource,paramsErrTip:j,warning:g,activeStep:pe,setActiveStep:he,projectId:s,resourcesUrlTitle:Ge,componentsUrlTitle:Xe}),e.jsxs(a,{sx:{flex:"1",maxWidth:"720px"},children:[!z&&_!=="introduction"&&e.jsxs(A,{variant:"h6",sx:{fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center"},children:[Ie.label,_==="branding"&&e.jsx(ke,{title:u("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(a,{component:"a",target:"_blank",href:`https://www.arcblock.io/docs/blocklet-store/${f}/blocklet-detail-page`,sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:e.jsx(Tn,{})})})]}),(z||_==="branding")&&e.jsx(a,{sx:{flexDirection:"column"},children:e.jsx(rs,{projectId:s,setParams:x,setParamsErrTip:v,warning:g,params:m,componentDid:i,blocklet:p,initUrl:t,loading:R,setLoading:y,paramsErrTip:j,readOnly:ie,initLogoUrl:Z,setInitLogoUrl:H})}),z&&e.jsx(a,{sx:{flexDirection:"column"},children:e.jsx(Dt,{loading:R,params:m,paramsErrTip:j,setParams:x,setParamsErrTip:v,readOnly:ie})}),(z||_==="introduction")&&e.jsx(a,{sx:{display:"flex",flexDirection:"column",mt:z?5:0,width:"100%"},children:e.jsx(gs,{loading:R,readOnly:ie,params:m,setParams:x,paramsErrTip:j,setParamsErrTip:v})}),z&&e.jsx(A,{variant:"h6",sx:{fontWeight:"bold",mt:5},children:ne[xo.resources].label}),e.jsx(a,{sx:{display:z||_==="resources"?"flex":"none",flexDirection:"column",maxWidth:720},children:e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsxs(mn,{onChange:$=>x({contentType:$.target.value}),children:[e.jsx(Ze,{value:"blocklet",disabled:ie,control:e.jsx(ft,{size:"small",checked:m.contentType==="blocklet"}),label:u("blocklet.publish.resourceSelect")}),e.jsx(Ze,{value:"upload",disabled:ie,control:e.jsx(ft,{size:"small",checked:m.contentType==="upload"}),label:u("blocklet.publish.resourceUpload")}),e.jsx(Ze,{value:"docker",disabled:ie,control:e.jsx(ft,{size:"small",checked:m.contentType==="docker"}),label:u("blocklet.publish.resourceDocker")})]}),e.jsxs(a,{sx:{display:m.contentType==="blocklet"?"block":"none"},children:[!i&&e.jsx(Oo,{tabs:Ae,current:te,onChange:Es,sx:{ml:-2,mt:2,maxWidth:z?window.innerWidth-24:"100%"}}),e.jsx(ts,{loading:R,initialResources:K,saveSelectedEventsRef:L,selectedResourceIds:w,setSelectedResourceIds:de,setResourceComponentsMap:se,error:j.blockletResource,app:p,readOnly:ie,component:Gt,componentDid:i,initUrl:t,params:m,showTree:m.contentType==="blocklet",setParams:x,projectId:s===F.UNOWNED_DID?"":s,release:{...T,id:le}})]}),m.contentType==="upload"&&e.jsx(ys,{app:p,readOnly:ie,projectId:s===F.UNOWNED_DID?"":s,params:m,error:j.blockletResource,setParams:x,setParamsErrTip:v}),m.contentType==="docker"&&e.jsx(Ss,{app:p,readOnly:ie,projectId:s===F.UNOWNED_DID?"":s,params:m,error:j.blockletResource,setParams:x,setParamsErrTip:v,paramsErrTip:j})]})})}),z&&e.jsx(A,{variant:"h6",sx:{fontWeight:"bold",mt:5},children:ne[xo.blocklets].label}),(z||_==="blocklets")&&e.jsx(a,{sx:{flexDirection:"column"},children:e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsx(a,{sx:{flex:1},children:e.jsx(Jo,{projectType:Be,disabled:R||ie,app:p,value:m?.blockletComponents||[],blockletResourceType:m?.blockletResourceType||"",onChange:Ds,onChangeBlockletResourceType:Is,resourceRelateComponents:J,dependentComponentsMode:I})})})}),!z&&_==="version"&&e.jsx(a,{sx:{flexDirection:"column"},children:e.jsx(Dt,{loading:R,params:m,paramsErrTip:j,setParams:x,setParamsErrTip:v,readOnly:ie})})]})]})]})]})}Ts.propTypes={initUrl:r.object};const $r=ve.div`
|
|
202
|
-
.section {
|
|
203
|
-
&.full-width {
|
|
204
|
-
max-width: 100%;
|
|
205
|
-
}
|
|
206
|
-
.MuiTypography-h3 {
|
|
207
|
-
font-size: 1.1rem;
|
|
208
|
-
font-weight: 700;
|
|
209
|
-
}
|
|
210
|
-
.left {
|
|
211
|
-
flex-shrink: 0;
|
|
212
|
-
width: 140px;
|
|
213
|
-
}
|
|
214
|
-
.MuiTabs-indicator {
|
|
215
|
-
display: none;
|
|
216
|
-
}
|
|
217
|
-
.MuiTypography-subtitle1 {
|
|
218
|
-
width: 120px;
|
|
219
|
-
font-weight: 700;
|
|
220
|
-
font-size: 1rem;
|
|
221
|
-
${({theme:t})=>t.breakpoints.down("sm")} {
|
|
222
|
-
width: 80px;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
.MuiButtonBase-root {
|
|
227
|
-
a {
|
|
228
|
-
color: inherit;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
.MuiInputBase-multiline .MuiInputAdornment-positionEnd {
|
|
232
|
-
align-self: flex-end;
|
|
233
|
-
.MuiTypography-root {
|
|
234
|
-
font-size: 0.8rem;
|
|
235
|
-
}
|
|
236
|
-
font-size: 0.8rem;
|
|
237
|
-
}
|
|
238
|
-
`;function Ar({padding:t="",initUrl:o=null}){const{blocklet:s}=De(),n=Ns(),{componentDid:l}=nt();if(k.useEffect(()=>{if(l&&window.parent){const i=`${n.pathname}${n.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:l,path:i},"*")}},[l,n]),!s)return null;const c={};return t&&(c.padding=t),e.jsx(qr,{style:c,children:e.jsxs(_s,{children:[e.jsx(bt,{path:"/",element:e.jsx(Fo,{initUrl:o})}),e.jsx(bt,{path:"/:projectId",element:e.jsx(Bn,{})}),e.jsx(bt,{path:"/:projectId/:mode/:releaseId/:lastVersion",element:e.jsx(Ts,{initUrl:o})})]})})}Ar.propTypes={padding:r.oneOfType([r.string,r.number]),initUrl:r.object};const qr=ve(a)`
|
|
239
|
-
a {
|
|
240
|
-
color: ${({theme:t})=>t.palette.primary.main};
|
|
241
|
-
}
|
|
242
|
-
`;export{Ar as default};
|