@abtnode/blocklet-services 1.17.7-beta-20251225-073259-cb6ecf68 → 1.17.7-beta-20251229-085620-84f09930
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 +16 -4
- package/api/libs/auth/adapters/apple.js +1 -1
- package/api/libs/auth/adapters/auth0.js +1 -1
- package/api/libs/auth/adapters/github.js +1 -1
- package/api/libs/auth/adapters/google.js +1 -1
- package/api/middlewares/serve-static-engine.js +179 -0
- package/api/routes/env.js +3 -4
- package/api/routes/oauth/client.js +7 -5
- package/api/services/notification/queue.js +2 -2
- package/api/socket/channel/component.js +19 -13
- package/api/socket/util.js +6 -1
- package/dist/assets/{AdapterDayjs-BUbxoXbD.js → AdapterDayjs-DYIVeXBV.js} +1 -1
- package/dist/assets/{Google-Cwpw9PRe.js → Google-D9N2NN29.js} +1 -1
- package/dist/assets/{access-control-DwlD3_cw.js → access-control-UTVMJtLa.js} +1 -1
- package/dist/assets/{add-component-core-BITgGwN0.js → add-component-core-Cu9Tohbt.js} +31 -31
- package/dist/assets/add-resource-CqOi5S87.js +1 -0
- package/dist/assets/{addon-C2qdiHVb.js → addon-DSFDYYiP.js} +1 -1
- package/dist/assets/{advanced-BosetBVE.js → advanced-CkJs81iC.js} +1 -1
- package/dist/assets/{aigne-DbMeOdg9.js → aigne-Dt8mwR8G.js} +1 -1
- package/dist/assets/api-FQQlzPOP.js +1 -0
- package/dist/assets/{appearance-DhUAX-xn.js → appearance-Bs9dCa2z.js} +1 -1
- package/dist/assets/ar-B4BSOV5G.js +7 -0
- package/dist/assets/{audit-logs-BHPPGieH.js → audit-logs-Bk0Y0aey.js} +3 -3
- package/dist/assets/{authorize-Dfo70g1t.js → authorize-C6B5tUkA.js} +1 -1
- package/dist/assets/{base-chart-Cs8rd9f2.js → base-chart-ChBZtUEG.js} +1 -1
- package/dist/assets/{base32-CXgP3JJ5.js → base32-BccrNIeO.js} +1 -1
- package/dist/assets/{bind-account-Drs3IDFN.js → bind-account-CLV9q3E3.js} +1 -1
- package/dist/assets/branding-BGRUKKNR.js +1 -0
- package/dist/assets/{branding-ByK6n-fM.js → branding-Cwk5a8ly.js} +1 -1
- package/dist/assets/{branding-BhvacExo.js → branding-JmTDNoIq.js} +1 -1
- package/dist/assets/{bundle-avatar-DVOaAXid.js → bundle-avatar-CLRiyhwo.js} +1 -1
- package/dist/assets/{button-D6RwAFss.js → button-Bfs8GG-V.js} +1 -1
- package/dist/assets/{click-to-copy-B2HIKJMV.js → click-to-copy-fgcvdv-u.js} +1 -1
- package/dist/assets/cloneDeep-C2rlAYcK.js +1 -0
- package/dist/assets/{complete-Djtuko3J.js → complete-Bb_Zgfxn.js} +2 -2
- package/dist/assets/{component-UsgyDUkb.js → component-BEiiKeGh.js} +2 -2
- package/dist/assets/{config-DuS3gx_m.js → config-CAUPVWd8.js} +2 -2
- package/dist/assets/{config-CUYR0yDP.js → config-Crd4mTZS.js} +2 -2
- package/dist/assets/{config-Co1ZhGgP.js → config-DEeSuJty.js} +1 -1
- package/dist/assets/{config-navigation-DjF2jJY9.js → config-navigation-DcFoMJlj.js} +7 -7
- package/dist/assets/{config-space-zEV0JkDF.js → config-space-DVE2CBUC.js} +1 -1
- package/dist/assets/{confirm-DTx9f3Ke.js → confirm-BSaTCzrs.js} +1 -1
- package/dist/assets/{connect-nknm0LHt.js → connect-B0W5gXFT.js} +1 -1
- package/dist/assets/connect-ChbbAHB_.js +5 -0
- package/dist/assets/{connect-to-eBtGI4_9.js → connect-to-D7rrqt6m.js} +1 -1
- package/dist/assets/{create-passport-svg-BQhmIwWD.js → create-passport-svg-BJX-WFnl.js} +1 -1
- package/dist/assets/{createClass-dudiLlP7.js → createClass-CH1sG4Vj.js} +1 -1
- package/dist/assets/dashboard-DDFp-UB6.js +103 -0
- package/dist/assets/de-EFAP4yzZ.js +7 -0
- package/dist/assets/{delete-confirm-HiRqbh9-.js → delete-confirm-BzmT7bQV.js} +1 -1
- package/dist/assets/{did-address-DqhneWXa.js → did-address-cHTriZHu.js} +1 -1
- package/dist/assets/{domain-Xaa2OTQZ.js → domain-CLaCd92M.js} +1 -1
- package/dist/assets/{domain-action-card-BzceZepB.js → domain-action-card-ClVrHE96.js} +2 -2
- package/dist/assets/domains-C5X5bi_z.js +1 -0
- package/dist/assets/edit-rounded-CnMn6J-D.js +1 -0
- package/dist/assets/{email-CaObtYNf.js → email-DddZUTON.js} +2 -2
- package/dist/assets/engine-CvmlyswD.js +1 -0
- package/dist/assets/es-BqFCfGn2.js +9 -0
- package/dist/assets/{exchange-passport-BA6t_lld.js → exchange-passport-CKEOdyU9.js} +1 -1
- package/dist/assets/{form-DNo4HCRt.js → form-poId1OU3.js} +1 -1
- package/dist/assets/{form-text-input-BjQKx89L.js → form-text-input-DwerOWgK.js} +1 -1
- package/dist/assets/fr-CksqMtzK.js +7 -0
- package/dist/assets/{fuel-Cr5W3cGy.js → fuel-Bly8lXId.js} +1 -1
- package/dist/assets/{gen-access-key-Bw62ox39.js → gen-access-key-5kekGzt_.js} +1 -1
- package/dist/assets/{gen-simple-access-key-QTWh5kxW.js → gen-simple-access-key-l4SGe3J5.js} +1 -1
- package/dist/assets/get-safe-url-D7ti-zln.js +1 -0
- package/dist/assets/hi-Bztwk-sg.js +5 -0
- package/dist/assets/{hi-DNSN9klG.js → hi-Cra5bbq9.js} +1 -1
- package/dist/assets/{home-iaPbLBtv.js → home-yA5fXQmP.js} +1 -1
- package/dist/assets/id-C5p-l7lp.js +7 -0
- package/dist/assets/{iframe-C8myLb4U.js → iframe-XKq6kg_r.js} +1 -1
- package/dist/assets/{index-CaQnmN3Y.js → index--Zp6K5Sp.js} +1 -1
- package/dist/assets/{index-C4nyPKIr.js → index-5haA_ZtH.js} +1 -1
- package/dist/assets/{index-9h1okNKA.js → index-9N4EluXF.js} +6 -6
- package/dist/assets/{index-D3g5TOJl.js → index-B0wPyjk9.js} +2 -2
- package/dist/assets/{index-SCaAOhtj.js → index-B1-cYl7K.js} +2 -2
- package/dist/assets/{index-DHvO7Oyu.js → index-BBwTMTLp.js} +1 -1
- package/dist/assets/{index-SACCniHf.js → index-BOWGgkTH.js} +4 -4
- package/dist/assets/{index-B7jV3her.js → index-BT901ij8.js} +1 -1
- package/dist/assets/index-BjqoIwBE.js +281 -0
- package/dist/assets/index-BotTPbWD.js +1 -0
- package/dist/assets/{index-C2HNVEZ0.js → index-Bt8QUMaz.js} +1 -1
- package/dist/assets/index-CGOBEhzW.js +1039 -0
- package/dist/assets/{index-BzU09Azd.js → index-CKhKxswY.js} +2 -2
- package/dist/assets/{index-CtJhxyJT.js → index-CQqn5TFD.js} +18 -18
- package/dist/assets/{index-DeG3Ee92.js → index-CSwcQdlI.js} +1 -1
- package/dist/assets/index-Ce9omzTp.js +1 -0
- package/dist/assets/{index-CzvNhDIJ.js → index-ChQX9ze3.js} +2 -2
- package/dist/assets/{index-BP_Fl0Mu.js → index-CiKhg0ut.js} +1 -1
- package/dist/assets/{index-BleAAm7x.js → index-Cu8TdzKM.js} +1 -1
- package/dist/assets/{index-YLno1Cst.js → index-CuC130U2.js} +3 -3
- package/dist/assets/{index-1azOxnKy.js → index-CvVZvUh7.js} +1 -1
- package/dist/assets/{index-CnWFrsC2.js → index-CzlJLWz5.js} +4 -4
- package/dist/assets/{index-B5vc0eG5.js → index-D1SIrheh.js} +1 -1
- package/dist/assets/{index-Dk6ZABgc.js → index-D95ZNJ3d.js} +1 -1
- package/dist/assets/{index-Dnd0o2ng.js → index-DA8b2Fwx.js} +3 -3
- package/dist/assets/{index-B8sa2W5r.js → index-DGd0GDc4.js} +6 -6
- package/dist/assets/{index-CHuKoofS.js → index-HU-v7OeI.js} +1 -1
- package/dist/assets/{index-Bxd7kK_i.js → index-_haoumSc.js} +1 -1
- package/dist/assets/{index-DURonUPJ.js → index-pm6H84lU.js} +1 -1
- package/dist/assets/index-tgy1TTjM.js +81 -0
- package/dist/assets/{index-seQ_ufVM.js → index-v9hCHxKp.js} +1 -1
- package/dist/assets/{invitation-DwMnPB2W.js → invitation-OInDimvS.js} +2 -2
- package/dist/assets/{invitations-mhxsPoWR.js → invitations-BFTtG6X1.js} +1 -1
- package/dist/assets/{invite-DpZe41tL.js → invite-sUgPlE4Z.js} +1 -1
- package/dist/assets/{isURL-CASPeQFe.js → isURL-CJrtALFi.js} +1 -1
- package/dist/assets/{issue-passport-ClIYXZHr.js → issue-passport-D779MB0S.js} +1 -1
- package/dist/assets/{item-B3LlwO_A.js → item-D0S77pRh.js} +1 -1
- package/dist/assets/ja-2cGMwCig.js +9 -0
- package/dist/assets/ko-DDVloIXx.js +9 -0
- package/dist/assets/{landing-page-Cv6belCa.js → landing-page-BoqVRFrg.js} +1 -1
- package/dist/assets/{layout-DkW-u1GX.js → layout-BumaOQ7l.js} +1 -1
- package/dist/assets/{list-CBP3Lj7-.js → list-Bcp4RDC0.js} +1 -1
- package/dist/assets/{list-Dqz9X41o.js → list-C0ACtiK5.js} +1 -1
- package/dist/assets/localization-DAkSbh2g.js +1 -0
- package/dist/assets/{log-Ch1_gOOt.js → log-CpIPOvLt.js} +1 -1
- package/dist/assets/logger-DUjWrC8_.js +1 -0
- package/dist/assets/{login-_zzURN5A.js → login-cMKzStm-.js} +1 -1
- package/dist/assets/{login-oauth-callback-BiIj9E0o.js → login-oauth-callback-I8wjhibA.js} +1 -1
- package/dist/assets/{logo-uploader-BmnoHisE.js → logo-uploader-CeXSNxdi.js} +1 -1
- package/dist/assets/{lost-passport-DYnJRD_t.js → lost-passport-VCPPPILz.js} +2 -2
- package/dist/assets/{cloneDeep-BbaR0xRl.js → omit-spWLSLbo.js} +1 -1
- package/dist/assets/{open-window-Btzsgc7g.js → open-window-DY3mWojp.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-BFDFMUwK.js → over-due-invoice-payment-C9HTfbWA.js} +1 -1
- package/dist/assets/overview-Bv3cq2I0.js +116 -0
- package/dist/assets/passport-DMm48qRk.js +1 -0
- package/dist/assets/{passport-item-Dx140DTL.js → passport-item-DD8VG51j.js} +1 -1
- package/dist/assets/{permission-HtrJm1h2.js → permission-B3ddwA-4.js} +1 -1
- package/dist/assets/{preferences-Dri2a4fE.js → preferences-CmMbfbTw.js} +1 -1
- package/dist/assets/profile-embed-DAY5ZrDb.js +1 -0
- package/dist/assets/{pt-BPAfyek8.js → pt-BB0AKqMq.js} +1 -1
- package/dist/assets/pt-FIIPCfqU.js +5 -0
- package/dist/assets/{publish-resource-CruXcF2L.js → publish-resource-DJRigGuM.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-89LKdt03.js → react-beautiful-dnd.esm-Bn87vJFI.js} +1 -1
- package/dist/assets/ru-BjRgz8OF.js +5 -0
- package/dist/assets/{ru-CVlekA3F.js → ru-CnPeybtU.js} +1 -1
- package/dist/assets/{runtime-Ck_rDqm2.js → runtime-gljMK2qS.js} +1 -1
- package/dist/assets/{sanitize-DyRfEGVu.js → sanitize-yVk8VEIO.js} +1 -1
- package/dist/assets/sdk-Be-u0PfZ.js +1 -0
- package/dist/assets/security-b4k0fa20.js +22 -0
- package/dist/assets/{session-Cm8j8XeZ.js → session-vM0SwFQZ.js} +1 -1
- package/dist/assets/{setup-COruOAew.js → setup-BPnqbGIk.js} +1 -1
- package/dist/assets/simple-select-6nihrL7w.js +1 -0
- package/dist/assets/{spaces-BuZf3GoQ.js → spaces-ypzuCaPe.js} +1 -1
- package/dist/assets/{start-D_yHRXzR.js → start-CgUu2djm.js} +1 -1
- package/dist/assets/{starting-progress-DahUM5Xo.js → starting-progress-B15yvlvv.js} +1 -1
- package/dist/assets/{status-DVjLoqLm.js → status-Cy7fzuR3.js} +1 -1
- package/dist/assets/{step-actions-DkehnzsP.js → step-actions-D3sZvhKo.js} +1 -1
- package/dist/assets/{studio-D4hiQNwZ.js → studio-D9ZxOiyo.js} +1 -1
- package/dist/assets/{switch-CO2el_yA.js → switch-CjDalLJU.js} +1 -1
- package/dist/assets/{switch-control-Bw0oiZZh.js → switch-control-CioN_5qg.js} +1 -1
- package/dist/assets/{table-tips-C-6Sm2ed.js → table-tips-DEqFBQFt.js} +1 -1
- package/dist/assets/{team-DNuHMrzV.js → team-DHhtcW5C.js} +1 -1
- package/dist/assets/th-DKiwQ6t6.js +5 -0
- package/dist/assets/{traffic-B0WH67Yr.js → traffic-DDO0-htp.js} +1 -1
- package/dist/assets/{transfer-BpjPR3S_.js → transfer-CEk3StHa.js} +1 -1
- package/dist/assets/{unsubscribe-CzgQXfYP.js → unsubscribe-DZF4NKei.js} +1 -1
- package/dist/assets/{use-app-logo-CZWb8lrs.js → use-app-logo-DSdF3M62.js} +1 -1
- package/dist/assets/{use-window-close-DDL8fcOm.js → use-window-close-va-vKf7G.js} +1 -1
- package/dist/assets/{useAsync-VEqKX7rF.js → useAsync-DVl73fmG.js} +1 -1
- package/dist/assets/{useAsync-xXSiXzwr.js → useAsync-Dotoxibi.js} +1 -1
- package/dist/assets/{useAsyncRetry--1T7wYe2.js → useAsyncRetry-r8dEPb-x.js} +1 -1
- package/dist/assets/{useLocalStorage-BV1BIwfo.js → useLocalStorage-A7dcJ6ce.js} +1 -1
- package/dist/assets/{user-center-DndqALOV.js → user-center-C2hlh2we.js} +1 -1
- package/dist/assets/{user-follower-Bzb2ZR_9.js → user-follower-BmcrANUM.js} +1 -1
- package/dist/assets/{util-DIVJQVg1.js → util-C_d0oDd4.js} +1 -1
- package/dist/assets/{util-CVjlaHo_.js → util-D9UZY2ZN.js} +1 -1
- package/dist/assets/{vendor-arcblock-CPCSE54a.js → vendor-arcblock-Dr30TSIK.js} +1 -1
- package/dist/assets/{vendor-hooks-cYMUGE4V.js → vendor-hooks-qxhUUbW5.js} +1 -1
- package/dist/assets/vendor-utils-CxWN1dT3.js +213 -0
- package/dist/assets/{vendor-ux-DfSgTRg5.js → vendor-ux-7TwTLXf8.js} +19 -19
- package/dist/assets/vi-C4aNShnq.js +5 -0
- package/dist/assets/{wait-connect-Be1Dmt0P.js → wait-connect-B2sGoXaJ.js} +1 -1
- package/dist/assets/{wizard-components-D3PqSMGt.js → wizard-components-BRsabxoD.js} +2 -2
- package/dist/assets/{wizard-BhUdbQos.js → wizard-qaZ9pS3q.js} +1 -1
- package/dist/assets/wrap-locale-DGVkhpYh.js +1 -0
- package/dist/assets/zh-Cb0McG4r.js +10 -0
- package/dist/assets/{zh-B_cpka88.js → zh-D1XHANJI.js} +1 -1
- package/dist/assets/zh-tw-PfYv9beR.js +9 -0
- package/dist/index.html +1 -1
- package/package.json +49 -49
- package/dist/assets/add-resource-ENVSA34x.js +0 -1
- package/dist/assets/api-C_w0YD2j.js +0 -1
- package/dist/assets/ar-BBr9bsOg.js +0 -7
- package/dist/assets/branding-B-5oLD-k.js +0 -1
- package/dist/assets/connect-BX2QwOaU.js +0 -5
- package/dist/assets/dashboard-DbjH3qe4.js +0 -103
- package/dist/assets/de-CDBOH3k5.js +0 -7
- package/dist/assets/domains-D_GcYdME.js +0 -1
- package/dist/assets/engine-BzngvK61.js +0 -1
- package/dist/assets/es-BJ8CsIZi.js +0 -9
- package/dist/assets/fr-DSXQFpNy.js +0 -7
- package/dist/assets/get-safe-url-CqAaHb9L.js +0 -1
- package/dist/assets/hi-DLsQ4VdX.js +0 -5
- package/dist/assets/id-AzAQyOHL.js +0 -7
- package/dist/assets/index-BHa1_Bjz.js +0 -1039
- package/dist/assets/index-BNeXCm1B.js +0 -1
- package/dist/assets/index-Df4GSKx6.js +0 -1
- package/dist/assets/index-DoVbUHDU.js +0 -55
- package/dist/assets/index-pAjb_WaG.js +0 -281
- package/dist/assets/ja-C3ccbBe-.js +0 -9
- package/dist/assets/keyboard-arrow-down-rounded-8U0_i9QO.js +0 -1
- package/dist/assets/ko-9Vbo8tR2.js +0 -9
- package/dist/assets/localization-gLf4FT3Q.js +0 -1
- package/dist/assets/logger-CWnnO-wn.js +0 -1
- package/dist/assets/omit-BgmLPtMY.js +0 -1
- package/dist/assets/overview-Bf86Sw9l.js +0 -116
- package/dist/assets/passport-D6ZhqZ1F.js +0 -1
- package/dist/assets/profile-embed-BpG6-Rqz.js +0 -1
- package/dist/assets/pt-iqygmSLa.js +0 -5
- package/dist/assets/ru-BkfMvpq6.js +0 -5
- package/dist/assets/sdk-C3wBexZ2.js +0 -1
- package/dist/assets/security-Duf_ZEVi.js +0 -22
- package/dist/assets/simple-select-DbXWLzPn.js +0 -1
- package/dist/assets/th-D-pgFsDa.js +0 -5
- package/dist/assets/vendor-utils-drLlzTVq.js +0 -213
- package/dist/assets/vi-BuffIn3I.js +0 -5
- package/dist/assets/wrap-locale-DtcRIeKF.js +0 -1
- package/dist/assets/zh-CSl2KD_S.js +0 -10
- package/dist/assets/zh-tw-BiloxWNq.js +0 -9
package/api/index.js
CHANGED
|
@@ -98,6 +98,7 @@ const attachSharedUtils = require('./util/attach-shared-utils');
|
|
|
98
98
|
const createMediaRoutes = require('./routes/media');
|
|
99
99
|
const createMCPRoutes = require('./routes/mcp');
|
|
100
100
|
const bodyParser = require('./middlewares/body-parser');
|
|
101
|
+
const serveStaticEngine = require('./middlewares/serve-static-engine');
|
|
101
102
|
const federatedUtil = require('./util/federated');
|
|
102
103
|
const { cdn } = require('./middlewares/cdn');
|
|
103
104
|
|
|
@@ -373,6 +374,7 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
373
374
|
if (isUrl(info?.registerUrl)) {
|
|
374
375
|
whitelist.system.push(new URL(info.registerUrl).origin);
|
|
375
376
|
}
|
|
377
|
+
|
|
376
378
|
whitelist.system = whitelist.system.filter((x) => removeIfOverlap(x, whitelist.official));
|
|
377
379
|
|
|
378
380
|
// blocklet custom domains (optimized: single pass with flatMap)
|
|
@@ -478,11 +480,17 @@ module.exports = function createServer(node, serverOptions = {}) {
|
|
|
478
480
|
};
|
|
479
481
|
}
|
|
480
482
|
|
|
483
|
+
const mergedConfig = {
|
|
484
|
+
...DEFAULT_HELMET_CONFIG,
|
|
485
|
+
...omitBy(config, isUndefined),
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
if (process.env.ABT_NODE_ALLOW_BLOCKLET_IFRAME_EMBEDDING) {
|
|
489
|
+
mergedConfig.xFrameOptions = false;
|
|
490
|
+
}
|
|
491
|
+
|
|
481
492
|
try {
|
|
482
|
-
helmet(
|
|
483
|
-
...DEFAULT_HELMET_CONFIG,
|
|
484
|
-
...omitBy(config, isUndefined),
|
|
485
|
-
})(req, res, next);
|
|
493
|
+
helmet(mergedConfig)(req, res, next);
|
|
486
494
|
} catch (error) {
|
|
487
495
|
console.error('helmet error', { error });
|
|
488
496
|
next();
|
|
@@ -866,6 +874,10 @@ self.blocklet = {
|
|
|
866
874
|
next();
|
|
867
875
|
});
|
|
868
876
|
|
|
877
|
+
// Serve static files directly for engine-based blocklets using built-in static-server
|
|
878
|
+
// This eliminates the need for a separate static-server process
|
|
879
|
+
server.use(serveStaticEngine());
|
|
880
|
+
|
|
869
881
|
// After all service middleware, we can now safely pass all traffic to blocklets
|
|
870
882
|
server.use(async (req, res) => {
|
|
871
883
|
try {
|
|
@@ -14,7 +14,7 @@ function GitHub(options) {
|
|
|
14
14
|
params: {
|
|
15
15
|
scope: 'read:user user:email',
|
|
16
16
|
// HACK: prompt: login 对 github 没效果,如果当前只登录了一个 github 账号,则会跳过登录页面直接成功,只能设置为 consent,让页面不直接登录
|
|
17
|
-
prompt: '
|
|
17
|
+
prompt: 'none',
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
token: `${baseUrl}/login/oauth/access_token`,
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const express = require('express');
|
|
3
|
+
const { LRUCache } = require('lru-cache');
|
|
4
|
+
const { getBlockletEngine } = require('@blocklet/meta/lib/engine');
|
|
5
|
+
const { findComponentByIdV2 } = require('@blocklet/meta/lib/util');
|
|
6
|
+
const { RESOURCE_PATTERN, STATIC_SERVER_ENGINE_DID } = require('@blocklet/constant');
|
|
7
|
+
|
|
8
|
+
const logger = require('../libs/logger')('serve-static-engine');
|
|
9
|
+
|
|
10
|
+
// LRU cache for static middleware instances (keyed by staticRoot)
|
|
11
|
+
// This is the only cache needed - express.static() creation has real cost
|
|
12
|
+
const staticMiddlewares = new LRUCache({
|
|
13
|
+
max: 100,
|
|
14
|
+
ttl: 60 * 60 * 1000, // 1 hour TTL
|
|
15
|
+
dispose: (value, key) => {
|
|
16
|
+
logger.debug('Evicting static middleware from cache', { staticRoot: key });
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get static root path for a component
|
|
22
|
+
* Same logic as static-server: BLOCKLET_APP_DIR + meta.main
|
|
23
|
+
* @param {object} component - Blocklet component
|
|
24
|
+
* @returns {string|null} - Absolute path to static files root
|
|
25
|
+
*/
|
|
26
|
+
const getStaticRoot = (component) => {
|
|
27
|
+
const appDir = component.environments?.find((e) => e.key === 'BLOCKLET_APP_DIR')?.value;
|
|
28
|
+
if (!appDir) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return component.meta?.main ? path.join(appDir, component.meta.main) : path.resolve(appDir);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Check if a component can be served directly by blocklet-service
|
|
36
|
+
* Conditions:
|
|
37
|
+
* 1. Engine-based blocklet using 'blocklet' interpreter
|
|
38
|
+
* 2. Engine source is the built-in static-server (not a custom engine)
|
|
39
|
+
*
|
|
40
|
+
* @param {object} component - Blocklet component
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
*/
|
|
43
|
+
const canServeStaticEngine = (component) => {
|
|
44
|
+
if (component.meta?.group === 'static') {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
const engine = getBlockletEngine(component?.meta);
|
|
48
|
+
return engine?.interpreter === 'blocklet' && engine.source?.name === STATIC_SERVER_ENGINE_DID;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Middleware to serve static files directly for engine-based blocklets
|
|
53
|
+
* This eliminates the need for a separate static-server process
|
|
54
|
+
*
|
|
55
|
+
* Matches static-server logic:
|
|
56
|
+
* 1. express.static with { maxAge: '30d', index: false }
|
|
57
|
+
* 2. SPA fallback to index.html for HTML requests (non-resource paths)
|
|
58
|
+
*/
|
|
59
|
+
const serveStaticEngine = () => {
|
|
60
|
+
// eslint-disable-next-line consistent-return
|
|
61
|
+
return async (req, res, next) => {
|
|
62
|
+
try {
|
|
63
|
+
const blocklet = await req.getBlocklet();
|
|
64
|
+
if (!blocklet) {
|
|
65
|
+
return next();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const componentId = req.getBlockletComponentId();
|
|
69
|
+
const component = componentId ? findComponentByIdV2(blocklet, componentId) : blocklet;
|
|
70
|
+
|
|
71
|
+
if (!component) {
|
|
72
|
+
return next();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Check if this component can be served directly
|
|
76
|
+
if (!canServeStaticEngine(component)) {
|
|
77
|
+
return next();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Get static root from component environments (same logic as static-server)
|
|
81
|
+
const staticRoot = getStaticRoot(component);
|
|
82
|
+
if (!staticRoot) {
|
|
83
|
+
return next();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Get or create static middleware for this root
|
|
87
|
+
// Match static-server: { maxAge: '30d', index: false }
|
|
88
|
+
let staticMiddleware = staticMiddlewares.get(staticRoot);
|
|
89
|
+
if (!staticMiddleware) {
|
|
90
|
+
staticMiddleware = express.static(staticRoot, {
|
|
91
|
+
maxAge: '30d',
|
|
92
|
+
index: false, // Don't serve index.html for directory requests, let fallback handle it
|
|
93
|
+
});
|
|
94
|
+
staticMiddlewares.set(staticRoot, staticMiddleware);
|
|
95
|
+
logger.info('Created static middleware for engine-based blocklet', {
|
|
96
|
+
staticRoot,
|
|
97
|
+
componentDid: component.meta?.did,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Try to serve the static file
|
|
102
|
+
// eslint-disable-next-line consistent-return
|
|
103
|
+
staticMiddleware(req, res, (err) => {
|
|
104
|
+
if (err) {
|
|
105
|
+
return next(err);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// File not found - apply SPA fallback logic (same as @blocklet/sdk/lib/middlewares/fallback)
|
|
109
|
+
// Skip non-HTML requests and resource requests
|
|
110
|
+
if (!(req.method === 'GET' || req.method === 'HEAD') || !req.accepts('html')) {
|
|
111
|
+
return next();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Skip resource requests (JS, CSS, images, fonts, etc.)
|
|
115
|
+
// This matches the RESOURCE_PATTERN check in @blocklet/sdk fallback
|
|
116
|
+
if (RESOURCE_PATTERN.test(req.path)) {
|
|
117
|
+
// Return 404 for missing resources instead of falling back to index.html
|
|
118
|
+
return res.status(404).send('Static Server: File Not Found');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Serve index.html for SPA routing
|
|
122
|
+
const indexPath = path.join(staticRoot, 'index.html');
|
|
123
|
+
res.sendFile(
|
|
124
|
+
indexPath,
|
|
125
|
+
{
|
|
126
|
+
headers: {
|
|
127
|
+
// Match fallback middleware: no-cache for HTML
|
|
128
|
+
'Surrogate-Control': 'no-store',
|
|
129
|
+
'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate',
|
|
130
|
+
Expires: '0',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
(sendErr) => {
|
|
134
|
+
if (sendErr) {
|
|
135
|
+
// If index.html not found, return 404 like static-server
|
|
136
|
+
logger.warn('Failed to serve index.html for SPA fallback', {
|
|
137
|
+
staticRoot,
|
|
138
|
+
error: sendErr,
|
|
139
|
+
});
|
|
140
|
+
res.status(404).send('Static Server: File Not Found');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
});
|
|
145
|
+
} catch (err) {
|
|
146
|
+
logger.error('Error in serve-static-engine middleware', { error: err });
|
|
147
|
+
return next(err);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Clear middleware cache for a specific static root path
|
|
154
|
+
* @param {string} staticRoot - The static root path to clear
|
|
155
|
+
*/
|
|
156
|
+
const clearCache = (staticRoot) => {
|
|
157
|
+
if (!staticRoot) return;
|
|
158
|
+
staticMiddlewares.delete(staticRoot);
|
|
159
|
+
logger.debug('Cleared static middleware cache', { staticRoot });
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Clear all middleware caches
|
|
164
|
+
*/
|
|
165
|
+
const clearAllCaches = () => {
|
|
166
|
+
staticMiddlewares.clear();
|
|
167
|
+
logger.info('Cleared all static middleware caches');
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Get cache size for monitoring
|
|
172
|
+
* @returns {number} Number of cached middlewares
|
|
173
|
+
*/
|
|
174
|
+
const getCacheSize = () => staticMiddlewares.size;
|
|
175
|
+
|
|
176
|
+
module.exports = serveStaticEngine;
|
|
177
|
+
module.exports.clearCache = clearCache;
|
|
178
|
+
module.exports.clearAllCaches = clearAllCaches;
|
|
179
|
+
module.exports.getCacheSize = getCacheSize;
|
package/api/routes/env.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const get = require('lodash/get');
|
|
2
2
|
const { joinURL } = require('ufo');
|
|
3
|
-
const {
|
|
3
|
+
const { WELLKNOWN_SERVICE_PATH_PREFIX, MAX_UPLOAD_FILE_SIZE } = require('@abtnode/constant');
|
|
4
4
|
const { BLOCKLET_CONFIGURABLE_KEY } = require('@blocklet/constant');
|
|
5
5
|
const { getDidDomainForBlocklet } = require('@abtnode/util/lib/get-domain-for-blocklet');
|
|
6
6
|
|
|
@@ -9,10 +9,9 @@ module.exports = {
|
|
|
9
9
|
server.get(`**${WELLKNOWN_SERVICE_PATH_PREFIX}/api/env`, async (req, res) => {
|
|
10
10
|
res.type('js');
|
|
11
11
|
|
|
12
|
-
const [blockletInfo, blocklet,
|
|
12
|
+
const [blockletInfo, blocklet, info] = await Promise.all([
|
|
13
13
|
req.getBlockletInfo(),
|
|
14
14
|
req.getBlocklet(),
|
|
15
|
-
req.getServiceConfig(NODE_SERVICES.AUTH),
|
|
16
15
|
req.getNodeInfo(),
|
|
17
16
|
]);
|
|
18
17
|
const pathPrefix = req.headers['x-path-prefix'] || '/';
|
|
@@ -38,7 +37,7 @@ module.exports = {
|
|
|
38
37
|
pathPrefix: "${pathPrefix}",
|
|
39
38
|
apiPrefix: "${pathPrefix.replace(/\/+$/, '')}${WELLKNOWN_SERVICE_PATH_PREFIX}",
|
|
40
39
|
${groupPathPrefix ? `groupPathPrefix: "${groupPathPrefix}",` : ''}
|
|
41
|
-
webWalletUrl: "${info.webWalletUrl ||
|
|
40
|
+
webWalletUrl: "${info.webWalletUrl || opts.webWalletUrl}",
|
|
42
41
|
nftDomainUrl: "${info.nftDomainUrl || ''}",
|
|
43
42
|
passportColor: "${passportColor}",
|
|
44
43
|
serverDid: "${info.did}",
|
|
@@ -11,7 +11,7 @@ const { getWalletDid, getConnectedAccounts, getSourceProvider } = require('@bloc
|
|
|
11
11
|
const formatContext = require('@abtnode/util/lib/format-context');
|
|
12
12
|
const createTranslator = require('@abtnode/util/lib/translate');
|
|
13
13
|
const { CustomError } = require('@blocklet/error');
|
|
14
|
-
const { LOGIN_PROVIDER } = require('@blocklet/constant');
|
|
14
|
+
const { LOGIN_PROVIDER, OAUTH_PROVIDER_PUBLIC_FIELDS } = require('@blocklet/constant');
|
|
15
15
|
const { withHttps, withTrailingSlash } = require('ufo');
|
|
16
16
|
const { getLastUsedPassport } = require('@abtnode/auth/lib/passport');
|
|
17
17
|
const { getAvatarByEmail, getAvatarByUrl } = require('@abtnode/util/lib/user');
|
|
@@ -132,7 +132,7 @@ async function getOAuthFederatedUserInfo(req, { blocklet, locale = 'en' }) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
function getAuthClient(blocklet, provider, { legacy = false, appPid } = {}) {
|
|
135
|
-
const oauthConfig = cloneDeep(blocklet?.settings?.
|
|
135
|
+
const oauthConfig = cloneDeep(blocklet?.settings?.authentication || {});
|
|
136
136
|
const providerConfig = oauthConfig?.[provider];
|
|
137
137
|
if (!providerConfig) {
|
|
138
138
|
throw new CustomError(400, `Provider ${provider} is not valid`);
|
|
@@ -620,7 +620,7 @@ module.exports = {
|
|
|
620
620
|
|
|
621
621
|
router.get(`${prefixApi}/configs`, async (req, res) => {
|
|
622
622
|
const blocklet = await req.getBlocklet();
|
|
623
|
-
const oauthConfig = blocklet?.settings?.
|
|
623
|
+
const oauthConfig = pick(blocklet?.settings?.authentication || {}, OAUTH_PROVIDER_PUBLIC_FIELDS);
|
|
624
624
|
res.send(oauthConfig);
|
|
625
625
|
});
|
|
626
626
|
|
|
@@ -723,8 +723,10 @@ module.exports = {
|
|
|
723
723
|
router.get(`${prefix}/login/:provider`, checkReferrerMiddleware(), async (req, res) => {
|
|
724
724
|
const { provider } = req.params;
|
|
725
725
|
const blocklet = await req.getBlocklet();
|
|
726
|
-
const availableProviderList = Object.keys(blocklet.settings?.
|
|
727
|
-
(x) =>
|
|
726
|
+
const availableProviderList = Object.keys(blocklet.settings?.authentication).filter(
|
|
727
|
+
(x) =>
|
|
728
|
+
blocklet.settings?.authentication[x]?.enabled === true &&
|
|
729
|
+
blocklet.settings?.authentication[x]?.type === 'oauth'
|
|
728
730
|
);
|
|
729
731
|
if (!availableProviderList.includes(provider)) {
|
|
730
732
|
res.status(400).send(`Provider: ${provider} is not supported`);
|
|
@@ -9,7 +9,7 @@ const { isSlackWebhookUrl } = require('@abtnode/util/lib/url-evaluation');
|
|
|
9
9
|
const { wipeSensitiveData } = require('@blocklet/meta/lib/util');
|
|
10
10
|
const cloneDeep = require('@abtnode/util/lib/deep-clone');
|
|
11
11
|
const { NOTIFICATION_TYPES } = require('@blocklet/sdk/lib/validators/notification');
|
|
12
|
-
const {
|
|
12
|
+
const { isWorkerInstance } = require('@abtnode/util/lib/pm2/is-instance-worker');
|
|
13
13
|
const {
|
|
14
14
|
NODE_MODES,
|
|
15
15
|
EVENTS,
|
|
@@ -829,7 +829,7 @@ const init = ({ node, notificationService }) => {
|
|
|
829
829
|
teamDid: data?.teamDid,
|
|
830
830
|
notificationId: data?.notification?.id,
|
|
831
831
|
});
|
|
832
|
-
if (
|
|
832
|
+
if (isWorkerInstance()) {
|
|
833
833
|
return;
|
|
834
834
|
}
|
|
835
835
|
if (!data.notification) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const JWT = require('@arcblock/jwt');
|
|
2
2
|
const { CHANNEL_TYPE, parseChannel, getComponentChannel } = require('@blocklet/meta/lib/channel');
|
|
3
3
|
const { findComponentByIdV2 } = require('@blocklet/meta/lib/util');
|
|
4
|
+
const { canReceiveMessages } = require('@blocklet/meta/lib/engine');
|
|
4
5
|
const { getComponentApiKey } = require('@abtnode/util/lib/blocklet');
|
|
5
6
|
const Lock = require('@abtnode/util/lib/lock');
|
|
6
7
|
|
|
@@ -77,14 +78,23 @@ const onJoin = async ({ channel, wsServer }) => {
|
|
|
77
78
|
const onMessage = () => {};
|
|
78
79
|
|
|
79
80
|
const sendToAppComponents = async ({ event, appDid, componentDid: inputComponentDid, data, node, wsServer }) => {
|
|
80
|
-
const senderInfo = await getSenderServer({ node });
|
|
81
|
-
|
|
82
81
|
const app = await node.getBlocklet({ did: appDid, useCache: true });
|
|
83
|
-
|
|
84
82
|
if (!app) {
|
|
85
83
|
throw new Error(`App not found: ${appDid}`);
|
|
86
84
|
}
|
|
87
85
|
|
|
86
|
+
// Early exit: check if there are any eligible components before expensive operations
|
|
87
|
+
const eligibleComponents = (app.children || []).filter((component) => {
|
|
88
|
+
const componentDid = component.meta.did;
|
|
89
|
+
return canReceiveMessages(component.meta) && (!inputComponentDid || componentDid === inputComponentDid);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (eligibleComponents.length === 0) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const senderInfo = await getSenderServer({ node });
|
|
97
|
+
|
|
88
98
|
const notification = {
|
|
89
99
|
data,
|
|
90
100
|
time: Date.now(),
|
|
@@ -96,18 +106,14 @@ const sendToAppComponents = async ({ event, appDid, componentDid: inputComponent
|
|
|
96
106
|
},
|
|
97
107
|
};
|
|
98
108
|
|
|
99
|
-
for (const component of
|
|
109
|
+
for (const component of eligibleComponents) {
|
|
100
110
|
const componentDid = component.meta.did;
|
|
111
|
+
// appPid is diff with appDid when app development mode
|
|
112
|
+
// appPid is diff with appDid when app has been rotated
|
|
113
|
+
const appPid = app.appPid || appDid;
|
|
101
114
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// appPid is diff with appDid when app has been rotated
|
|
105
|
-
const appPid = app.appPid || appDid;
|
|
106
|
-
|
|
107
|
-
// eslint-disable-next-line no-loop-func
|
|
108
|
-
// 移除掉消息推送失败时缓存逻辑
|
|
109
|
-
broadcast(wsServer, getComponentChannel(appPid, componentDid), event, notification);
|
|
110
|
-
}
|
|
115
|
+
// 移除掉消息推送失败时缓存逻辑
|
|
116
|
+
broadcast(wsServer, getComponentChannel(appPid, componentDid), event, notification);
|
|
111
117
|
}
|
|
112
118
|
};
|
|
113
119
|
|
package/api/socket/util.js
CHANGED
|
@@ -40,7 +40,12 @@ const broadcast = (...args) => {
|
|
|
40
40
|
const [wsServer, channel, event, data, options] = args;
|
|
41
41
|
|
|
42
42
|
wsServer.broadcast(channel, event, data, options || {}, ({ count } = {}) => {
|
|
43
|
-
|
|
43
|
+
// Only log when there are actual subscribers to reduce noise
|
|
44
|
+
if (count > 0) {
|
|
45
|
+
logger.info('Broadcast message to channel', { channel, sendCount: count });
|
|
46
|
+
} else {
|
|
47
|
+
logger.debug('Broadcast message to channel (no subscribers)', { channel });
|
|
48
|
+
}
|
|
44
49
|
cb(count);
|
|
45
50
|
});
|
|
46
51
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as lt}from"./vendor-mui-core-DnR6WYuU.js";import{d as c}from"./vendor-hooks-
|
|
1
|
+
import{_ as lt}from"./vendor-mui-core-DnR6WYuU.js";import{d as c}from"./vendor-hooks-qxhUUbW5.js";import{g as G}from"./vendor-react-CTtPmzVP.js";import{u as yt}from"./vendor-ux-7TwTLXf8.js";var b={exports:{}},pt=b.exports,rt;function Mt(){return rt||(rt=1,function(Y,z){(function(m,t){Y.exports=t()})(pt,function(){var m="week",t="year";return function(e,i,a){var r=i.prototype;r.week=function(s){if(s===void 0&&(s=null),s!==null)return this.add(7*(s-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=a(this).startOf(t).add(1,t).date(u),l=a(this).endOf(m);if(h.isBefore(l))return 1}var O=a(this).startOf(t).date(u).startOf(m).subtract(1,"millisecond"),$=this.diff(O,m,!0);return $<0?a(this).startOf("week").week():Math.ceil($)},r.weeks=function(s){return s===void 0&&(s=null),this.week(s)}}})}(b)),b.exports}var Tt=Mt();const gt=G(Tt);var I={exports:{}},Dt=I.exports,st;function wt(){return st||(st=1,function(Y,z){(function(m,t){Y.exports=t()})(Dt,function(){var m={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,e=/\d/,i=/\d\d/,a=/\d\d?/,r=/\d*[^-_:/,()\s\d]+/,s={},u=function(n){return(n=+n)+(n>68?1900:2e3)},h=function(n){return function(o){this[n]=+o}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(n){(this.zone||(this.zone={})).offset=function(o){if(!o||o==="Z")return 0;var f=o.match(/([+-]|\d\d)/g),d=60*f[1]+(+f[2]||0);return d===0?0:f[0]==="+"?-d:d}(n)}],O=function(n){var o=s[n];return o&&(o.indexOf?o:o.s.concat(o.f))},$=function(n,o){var f,d=s.meridiem;if(d){for(var T=1;T<=24;T+=1)if(n.indexOf(d(T,0,o))>-1){f=T>12;break}}else f=n===(o?"pm":"PM");return f},ot={A:[r,function(n){this.afternoon=$(n,!1)}],a:[r,function(n){this.afternoon=$(n,!0)}],Q:[e,function(n){this.month=3*(n-1)+1}],S:[e,function(n){this.milliseconds=100*+n}],SS:[i,function(n){this.milliseconds=10*+n}],SSS:[/\d{3}/,function(n){this.milliseconds=+n}],s:[a,h("seconds")],ss:[a,h("seconds")],m:[a,h("minutes")],mm:[a,h("minutes")],H:[a,h("hours")],h:[a,h("hours")],HH:[a,h("hours")],hh:[a,h("hours")],D:[a,h("day")],DD:[i,h("day")],Do:[r,function(n){var o=s.ordinal,f=n.match(/\d+/);if(this.day=f[0],o)for(var d=1;d<=31;d+=1)o(d).replace(/\[|\]/g,"")===n&&(this.day=d)}],w:[a,h("week")],ww:[i,h("week")],M:[a,h("month")],MM:[i,h("month")],MMM:[r,function(n){var o=O("months"),f=(O("monthsShort")||o.map(function(d){return d.slice(0,3)})).indexOf(n)+1;if(f<1)throw new Error;this.month=f%12||f}],MMMM:[r,function(n){var o=O("months").indexOf(n)+1;if(o<1)throw new Error;this.month=o%12||o}],Y:[/[+-]?\d+/,h("year")],YY:[i,function(n){this.year=u(n)}],YYYY:[/\d{4}/,h("year")],Z:l,ZZ:l};function ht(n){var o,f;o=n,f=s&&s.formats;for(var d=(n=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(C,x,M){var p=M&&M.toUpperCase();return x||f[M]||m[M]||f[p].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(k,L,j){return L||j.slice(1)})})).match(t),T=d.length,g=0;g<T;g+=1){var U=d[g],S=ot[U],D=S&&S[0],w=S&&S[1];d[g]=w?{regex:D,parser:w}:U.replace(/^\[|\]$/g,"")}return function(C){for(var x={},M=0,p=0;M<T;M+=1){var k=d[M];if(typeof k=="string")p+=k.length;else{var L=k.regex,j=k.parser,A=C.slice(p),v=L.exec(A)[0];j.call(x,v),C=C.replace(v,"")}}return function(P){var F=P.afternoon;if(F!==void 0){var y=P.hours;F?y<12&&(P.hours+=12):y===12&&(P.hours=0),delete P.afternoon}}(x),x}}return function(n,o,f){f.p.customParseFormat=!0,n&&n.parseTwoDigitYear&&(u=n.parseTwoDigitYear);var d=o.prototype,T=d.parse;d.parse=function(g){var U=g.date,S=g.utc,D=g.args;this.$u=S;var w=D[1];if(typeof w=="string"){var C=D[2]===!0,x=D[3]===!0,M=C||x,p=D[2];x&&(p=D[2]),s=this.$locale(),!C&&p&&(s=f.Ls[p]),this.$d=function(A,v,P,F){try{if(["x","X"].indexOf(v)>-1)return new Date((v==="X"?1e3:1)*A);var y=ht(v)(A),Z=y.year,W=y.month,ut=y.day,ft=y.hours,dt=y.minutes,ct=y.seconds,mt=y.milliseconds,tt=y.zone,et=y.week,N=new Date,_=ut||(Z||W?1:N.getDate()),q=Z||N.getFullYear(),H=0;Z&&!W||(H=W>0?W-1:N.getMonth());var B,R=ft||0,Q=dt||0,X=ct||0,J=mt||0;return tt?new Date(Date.UTC(q,H,_,R,Q,X,J+60*tt.offset*1e3)):P?new Date(Date.UTC(q,H,_,R,Q,X,J)):(B=new Date(q,H,_,R,Q,X,J),et&&(B=F(B).week(et).toDate()),B)}catch{return new Date("")}}(U,w,S,f),this.init(),p&&p!==!0&&(this.$L=this.locale(p).$L),M&&U!=this.format(w)&&(this.$d=new Date("")),s={}}else if(w instanceof Array)for(var k=w.length,L=1;L<=k;L+=1){D[1]=w[L-1];var j=f.apply(this,D);if(j.isValid()){this.$d=j.$d,this.$L=j.$L,this.init();break}L===k&&(this.$d=new Date(""))}else T.call(this,g)}}})}(I)),I.exports}var Yt=wt();const Ot=G(Yt);var E={exports:{}},xt=E.exports,nt;function kt(){return nt||(nt=1,function(Y,z){(function(m,t){Y.exports=t()})(xt,function(){return function(m,t,e){t.prototype.isBetween=function(i,a,r,s){var u=e(i),h=e(a),l=(s=s||"()")[0]==="(",O=s[1]===")";return(l?this.isAfter(u,r):!this.isBefore(u,r))&&(O?this.isBefore(h,r):!this.isAfter(h,r))||(l?this.isBefore(u,r):!this.isAfter(u,r))&&(O?this.isAfter(h,r):!this.isBefore(h,r))}}})}(E)),E.exports}var Lt=kt();const zt=G(Lt);var V={exports:{}},St=V.exports,it;function Ct(){return it||(it=1,function(Y,z){(function(m,t){Y.exports=t()})(St,function(){return function(m,t){var e=t.prototype,i=e.format;e.format=function(a){var r=this,s=this.$locale();if(!this.isValid())return i.bind(this)(a);var u=this.$utils(),h=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(l){switch(l){case"Q":return Math.ceil((r.$M+1)/3);case"Do":return s.ordinal(r.$D);case"gggg":return r.weekYear();case"GGGG":return r.isoWeekYear();case"wo":return s.ordinal(r.week(),"W");case"w":case"ww":return u.s(r.week(),l==="w"?1:2,"0");case"W":case"WW":return u.s(r.isoWeek(),l==="W"?1:2,"0");case"k":case"kk":return u.s(String(r.$H===0?24:r.$H),l==="k"?1:2,"0");case"X":return Math.floor(r.$d.getTime()/1e3);case"x":return r.$d.getTime();case"z":return"["+r.offsetName()+"]";case"zzz":return"["+r.offsetName("long")+"]";default:return l}});return i.bind(this)(h)}}})}(V)),V.exports}var jt=Ct();const Pt=G(jt);c.extend(yt);c.extend(gt);c.extend(zt);c.extend(Pt);const vt={YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},d:{sectionType:"weekDay",contentType:"digit",maxLength:2},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},$t={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"dd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},K=["Missing UTC plugin","To be able to use UTC or timezones, you have to enable the `utc` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join(`
|
|
2
2
|
`),at=["Missing timezone plugin","To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join(`
|
|
3
3
|
`);class Bt{constructor({locale:z,formats:m}={}){this.isMUIAdapter=!0,this.isTimezoneCompatible=!0,this.lib="dayjs",this.locale=void 0,this.formats=void 0,this.escapedCharacters={start:"[",end:"]"},this.formatTokenMap=vt,this.setLocaleToValue=t=>{const e=this.getCurrentLocaleCode();return e===t.locale()?t:t.locale(e)},this.hasUTCPlugin=()=>typeof c.utc<"u",this.hasTimezonePlugin=()=>typeof c.tz<"u",this.isSame=(t,e,i)=>{const a=this.setTimezone(e,this.getTimezone(t));return t.format(i)===a.format(i)},this.cleanTimezone=t=>{switch(t){case"default":return;case"system":return c.tz.guess();default:return t}},this.createSystemDate=t=>{let e;if(this.hasUTCPlugin()&&this.hasTimezonePlugin()){const i=c.tz.guess();i==="UTC"?e=c(t):e=c.tz(t,i)}else e=c(t);return this.setLocaleToValue(e)},this.createUTCDate=t=>{if(!this.hasUTCPlugin())throw new Error(K);return this.setLocaleToValue(c.utc(t))},this.createTZDate=(t,e)=>{if(!this.hasUTCPlugin())throw new Error(K);if(!this.hasTimezonePlugin())throw new Error(at);const i=t!==void 0&&!t.endsWith("Z");return this.setLocaleToValue(c(t).tz(this.cleanTimezone(e),i))},this.getLocaleFormats=()=>{const t=c.Ls,e=this.locale||"en";let i=t[e];return i===void 0&&(i=t.en),i.formats},this.adjustOffset=t=>{if(!this.hasTimezonePlugin())return t;const e=this.getTimezone(t);if(e!=="UTC"){const i=t.tz(this.cleanTimezone(e),!0);if(i.$offset===(t.$offset??0))return t;t.$offset=i.$offset}return t},this.date=(t,e="default")=>t===null?null:e==="UTC"?this.createUTCDate(t):e==="system"||e==="default"&&!this.hasTimezonePlugin()?this.createSystemDate(t):this.createTZDate(t,e),this.getInvalidDate=()=>c(new Date("Invalid date")),this.getTimezone=t=>{if(this.hasTimezonePlugin()){const e=t.$x?.$timezone;if(e)return e}return this.hasUTCPlugin()&&t.isUTC()?"UTC":"system"},this.setTimezone=(t,e)=>{if(this.getTimezone(t)===e)return t;if(e==="UTC"){if(!this.hasUTCPlugin())throw new Error(K);return t.utc()}if(e==="system")return t.local();if(!this.hasTimezonePlugin()){if(e==="default")return t;throw new Error(at)}return this.setLocaleToValue(c.tz(t,this.cleanTimezone(e)))},this.toJsDate=t=>t.toDate(),this.parse=(t,e)=>t===""?null:c(t,e,this.locale,!0),this.getCurrentLocaleCode=()=>this.locale||"en",this.is12HourCycleInCurrentLocale=()=>/A|a/.test(this.getLocaleFormats().LT||""),this.expandFormat=t=>{const e=this.getLocaleFormats(),i=a=>a.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(r,s,u)=>s||u.slice(1));return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(a,r,s)=>{const u=s&&s.toUpperCase();return r||e[s]||i(e[u])})},this.isValid=t=>t==null?!1:t.isValid(),this.format=(t,e)=>this.formatByString(t,this.formats[e]),this.formatByString=(t,e)=>this.setLocaleToValue(t).format(e),this.formatNumber=t=>t,this.isEqual=(t,e)=>t===null&&e===null?!0:t===null||e===null?!1:t.toDate().getTime()===e.toDate().getTime(),this.isSameYear=(t,e)=>this.isSame(t,e,"YYYY"),this.isSameMonth=(t,e)=>this.isSame(t,e,"YYYY-MM"),this.isSameDay=(t,e)=>this.isSame(t,e,"YYYY-MM-DD"),this.isSameHour=(t,e)=>t.isSame(e,"hour"),this.isAfter=(t,e)=>t>e,this.isAfterYear=(t,e)=>this.hasUTCPlugin()?!this.isSameYear(t,e)&&t.utc()>e.utc():t.isAfter(e,"year"),this.isAfterDay=(t,e)=>this.hasUTCPlugin()?!this.isSameDay(t,e)&&t.utc()>e.utc():t.isAfter(e,"day"),this.isBefore=(t,e)=>t<e,this.isBeforeYear=(t,e)=>this.hasUTCPlugin()?!this.isSameYear(t,e)&&t.utc()<e.utc():t.isBefore(e,"year"),this.isBeforeDay=(t,e)=>this.hasUTCPlugin()?!this.isSameDay(t,e)&&t.utc()<e.utc():t.isBefore(e,"day"),this.isWithinRange=(t,[e,i])=>t>=e&&t<=i,this.startOfYear=t=>this.adjustOffset(t.startOf("year")),this.startOfMonth=t=>this.adjustOffset(t.startOf("month")),this.startOfWeek=t=>this.adjustOffset(this.setLocaleToValue(t).startOf("week")),this.startOfDay=t=>this.adjustOffset(t.startOf("day")),this.endOfYear=t=>this.adjustOffset(t.endOf("year")),this.endOfMonth=t=>this.adjustOffset(t.endOf("month")),this.endOfWeek=t=>this.adjustOffset(this.setLocaleToValue(t).endOf("week")),this.endOfDay=t=>this.adjustOffset(t.endOf("day")),this.addYears=(t,e)=>this.adjustOffset(t.add(e,"year")),this.addMonths=(t,e)=>this.adjustOffset(t.add(e,"month")),this.addWeeks=(t,e)=>this.adjustOffset(t.add(e,"week")),this.addDays=(t,e)=>this.adjustOffset(t.add(e,"day")),this.addHours=(t,e)=>this.adjustOffset(t.add(e,"hour")),this.addMinutes=(t,e)=>this.adjustOffset(t.add(e,"minute")),this.addSeconds=(t,e)=>this.adjustOffset(t.add(e,"second")),this.getYear=t=>t.year(),this.getMonth=t=>t.month(),this.getDate=t=>t.date(),this.getHours=t=>t.hour(),this.getMinutes=t=>t.minute(),this.getSeconds=t=>t.second(),this.getMilliseconds=t=>t.millisecond(),this.setYear=(t,e)=>this.adjustOffset(t.set("year",e)),this.setMonth=(t,e)=>this.adjustOffset(t.set("month",e)),this.setDate=(t,e)=>this.adjustOffset(t.set("date",e)),this.setHours=(t,e)=>this.adjustOffset(t.set("hour",e)),this.setMinutes=(t,e)=>this.adjustOffset(t.set("minute",e)),this.setSeconds=(t,e)=>this.adjustOffset(t.set("second",e)),this.setMilliseconds=(t,e)=>this.adjustOffset(t.set("millisecond",e)),this.getDaysInMonth=t=>t.daysInMonth(),this.getWeekArray=t=>{const e=this.startOfWeek(this.startOfMonth(t)),i=this.endOfWeek(this.endOfMonth(t));let a=0,r=e;const s=[];for(;r<i;){const u=Math.floor(a/7);s[u]=s[u]||[],s[u].push(r),r=this.addDays(r,1),a+=1}return s},this.getWeekNumber=t=>t.week(),this.getYearRange=([t,e])=>{const i=this.startOfYear(t),a=this.endOfYear(e),r=[];let s=i;for(;this.isBefore(s,a);)r.push(s),s=this.addYears(s,1);return r},this.locale=z,this.formats=lt({},$t,m),c.extend(Ot)}getDayOfWeek(z){return z.day()+1}}export{Bt as A};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as Ce,d as xe,g as ke,a as s,r as A}from"./vendor-react-CTtPmzVP.js";import{W as g}from"./vendor-mui-core-DnR6WYuU.js";import{al as wt,am as Et,an as St,$ as R,t as Ct,ao as kt,d as Rt,ap as N,c as We}from"./vendor-utils-drLlzTVq.js";import{bo as _t}from"./vendor-ux-DfSgTRg5.js";import{r as Ot}from"./cloneDeep-BbaR0xRl.js";var k={},$={};const Re=Ce(wt),Mt=Ce(Et),Ft=Ce(St);var Ie;function Bt(){if(Ie)return $;Ie=1,Object.defineProperty($,"__esModule",{value:!0}),$.flattenNames=void 0;var a=_t,e=h(a),t=Re,r=h(t),n=Mt,i=h(n),o=Ft,l=h(o);function h(c){return c&&c.__esModule?c:{default:c}}var p=$.flattenNames=function c(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=[];return(0,l.default)(u,function(f){Array.isArray(f)?c(f).map(function(v){return d.push(v)}):(0,i.default)(f)?(0,r.default)(f,function(v,b){v===!0&&d.push(b),d.push(b+"-"+v)}):(0,e.default)(f)&&d.push(f)}),d};return $.default=p,$}var L={},qe;function At(){if(qe)return L;qe=1,Object.defineProperty(L,"__esModule",{value:!0}),L.mergeClasses=void 0;var a=Re,e=i(a),t=Ot,r=i(t),n=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(l[c]=p[c])}return l};function i(l){return l&&l.__esModule?l:{default:l}}var o=L.mergeClasses=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],c=h.default&&(0,r.default)(h.default)||{};return p.map(function(u){var d=h[u];return d&&(0,e.default)(d,function(f,v){c[v]||(c[v]={}),c[v]=n({},c[v],d[v])}),u}),c};return L.default=o,L}var j={},Ve;function Ht(){if(Ve)return j;Ve=1,Object.defineProperty(j,"__esModule",{value:!0}),j.autoprefix=void 0;var a=Re,e=r(a),t=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(o[p]=h[p])}return o};function r(o){return o&&o.__esModule?o:{default:o}}var n={borderRadius:function(l){return{msBorderRadius:l,MozBorderRadius:l,OBorderRadius:l,WebkitBorderRadius:l,borderRadius:l}},boxShadow:function(l){return{msBoxShadow:l,MozBoxShadow:l,OBoxShadow:l,WebkitBoxShadow:l,boxShadow:l}},userSelect:function(l){return{WebkitTouchCallout:l,KhtmlUserSelect:l,MozUserSelect:l,msUserSelect:l,WebkitUserSelect:l,userSelect:l}},flex:function(l){return{WebkitBoxFlex:l,MozBoxFlex:l,WebkitFlex:l,msFlex:l,flex:l}},flexBasis:function(l){return{WebkitFlexBasis:l,flexBasis:l}},justifyContent:function(l){return{WebkitJustifyContent:l,justifyContent:l}},transition:function(l){return{msTransition:l,MozTransition:l,OTransition:l,WebkitTransition:l,transition:l}},transform:function(l){return{msTransform:l,MozTransform:l,OTransform:l,WebkitTransform:l,transform:l}},absolute:function(l){var h=l&&l.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(l,h){var p=h[l];return p||{extend:l}}},i=j.autoprefix=function(l){var h={};return(0,e.default)(l,function(p,c){var u={};(0,e.default)(p,function(d,f){var v=n[f];v?u=t({},u,v(d)):u[f]=d}),h[c]=u}),h};return j.default=i,j}var z={},Xe;function Pt(){if(Xe)return z;Xe=1,Object.defineProperty(z,"__esModule",{value:!0}),z.hover=void 0;var a=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var c=arguments[p];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(h[u]=c[u])}return h},e=xe(),t=r(e);function r(h){return h&&h.__esModule?h:{default:h}}function n(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function i(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function o(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var l=z.hover=function(p){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;n(this,d);for(var E=arguments.length,O=Array(E),C=0;C<E;C++)O[C]=arguments[C];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(O))),b),b.state={hover:!1},b.handleMouseOver=function(){return b.setState({hover:!0})},b.handleMouseOut=function(){return b.setState({hover:!1})},b.render=function(){return t.default.createElement(c,{onMouseOver:b.handleMouseOver,onMouseOut:b.handleMouseOut},t.default.createElement(p,a({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return z.default=l,z}var G={},Ye;function Tt(){if(Ye)return G;Ye=1,Object.defineProperty(G,"__esModule",{value:!0}),G.active=void 0;var a=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var c=arguments[p];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(h[u]=c[u])}return h},e=xe(),t=r(e);function r(h){return h&&h.__esModule?h:{default:h}}function n(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function i(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function o(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var l=G.active=function(p){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;n(this,d);for(var E=arguments.length,O=Array(E),C=0;C<E;C++)O[C]=arguments[C];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(O))),b),b.state={active:!1},b.handleMouseDown=function(){return b.setState({active:!0})},b.handleMouseUp=function(){return b.setState({active:!1})},b.render=function(){return t.default.createElement(c,{onMouseDown:b.handleMouseDown,onMouseUp:b.handleMouseUp},t.default.createElement(p,a({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return G.default=l,G}var fe={},Ke;function Nt(){if(Ke)return fe;Ke=1,Object.defineProperty(fe,"__esModule",{value:!0});var a=function(t,r){var n={},i=function(l){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n[l]=h};return t===0&&i("first-child"),t===r-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),n};return fe.default=a,fe}var Ze;function Dt(){if(Ze)return k;Ze=1,Object.defineProperty(k,"__esModule",{value:!0}),k.ReactCSS=k.loop=k.handleActive=k.handleHover=k.hover=void 0;var a=Bt(),e=d(a),t=At(),r=d(t),n=Ht(),i=d(n),o=Pt(),l=d(o),h=Tt(),p=d(h),c=Nt(),u=d(c);function d(v){return v&&v.__esModule?v:{default:v}}k.hover=l.default,k.handleHover=l.default,k.handleActive=p.default,k.loop=u.default;var f=k.ReactCSS=function(b){for(var m=arguments.length,E=Array(m>1?m-1:0),O=1;O<m;O++)E[O-1]=arguments[O];var C=(0,e.default)(E),P=(0,r.default)(b,C);return(0,i.default)(P)};return k.default=f,k}var _e=Dt();const y=ke(_e);var $t=function(e,t,r,n,i){var o=i.clientWidth,l=i.clientHeight,h=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,p=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=h-(i.getBoundingClientRect().left+window.pageXOffset),u=p-(i.getBoundingClientRect().top+window.pageYOffset);if(r==="vertical"){var d=void 0;if(u<0?d=0:u>l?d=1:d=Math.round(u*100/l)/100,t.a!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}else{var f=void 0;if(c<0?f=0:c>o?f=1:f=Math.round(c*100/o)/100,n!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}return null},we={},Lt=function(e,t,r,n){if(typeof document>"u"&&!n)return null;var i=n?new n:document.createElement("canvas");i.width=r*2,i.height=r*2;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),i.toDataURL()):null},jt=function(e,t,r,n){var i=e+"-"+t+"-"+r+(n?"-server":"");if(we[i])return we[i];var o=Lt(e,t,r,n);return we[i]=o,o},Je=Object.assign||function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(a[r]=t[r])}return a},oe=function(e){var t=e.white,r=e.grey,n=e.size,i=e.renderers,o=e.borderRadius,l=e.boxShadow,h=e.children,p=y({default:{grid:{borderRadius:o,boxShadow:l,absolute:"0px 0px 0px 0px",background:"url("+jt(t,r,n,i.canvas)+") center left"}}});return A.isValidElement(h)?s.cloneElement(h,Je({},h.props,{style:Je({},h.props.style,p.grid)})):s.createElement("div",{style:p.grid})};oe.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var zt=Object.assign||function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(a[r]=t[r])}return a},Gt=function(){function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}}();function Ut(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}function Qe(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:a}function Wt(a,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}var Oe=function(a){Wt(e,a);function e(){var t,r,n,i;Ut(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(r=(n=Qe(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),n),n.handleChange=function(p){var c=$t(p,n.props.hsl,n.props.direction,n.props.a,n.container);c&&typeof n.props.onChange=="function"&&n.props.onChange(c,p)},n.handleMouseDown=function(p){n.handleChange(p),window.addEventListener("mousemove",n.handleChange),window.addEventListener("mouseup",n.handleMouseUp)},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleChange),window.removeEventListener("mouseup",n.handleMouseUp)},r),Qe(n,i)}return Gt(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var r=this,n=this.props.rgb,i=y({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+n.r+","+n.g+","+n.b+`, 0) 0%,
|
|
1
|
+
import{e as Ce,d as xe,g as ke,a as s,r as A}from"./vendor-react-CTtPmzVP.js";import{W as g}from"./vendor-mui-core-DnR6WYuU.js";import{ak as wt,al as Et,am as St,_ as R,t as Ct,an as kt,d as Rt,ao as N,c as We}from"./vendor-utils-CxWN1dT3.js";import{bo as _t}from"./vendor-ux-7TwTLXf8.js";import{r as Ot}from"./cloneDeep-C2rlAYcK.js";var k={},$={};const Re=Ce(wt),Mt=Ce(Et),Ft=Ce(St);var Ie;function Bt(){if(Ie)return $;Ie=1,Object.defineProperty($,"__esModule",{value:!0}),$.flattenNames=void 0;var a=_t,e=h(a),t=Re,r=h(t),n=Mt,i=h(n),o=Ft,l=h(o);function h(c){return c&&c.__esModule?c:{default:c}}var p=$.flattenNames=function c(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=[];return(0,l.default)(u,function(f){Array.isArray(f)?c(f).map(function(v){return d.push(v)}):(0,i.default)(f)?(0,r.default)(f,function(v,b){v===!0&&d.push(b),d.push(b+"-"+v)}):(0,e.default)(f)&&d.push(f)}),d};return $.default=p,$}var L={},qe;function At(){if(qe)return L;qe=1,Object.defineProperty(L,"__esModule",{value:!0}),L.mergeClasses=void 0;var a=Re,e=i(a),t=Ot,r=i(t),n=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(l[c]=p[c])}return l};function i(l){return l&&l.__esModule?l:{default:l}}var o=L.mergeClasses=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],c=h.default&&(0,r.default)(h.default)||{};return p.map(function(u){var d=h[u];return d&&(0,e.default)(d,function(f,v){c[v]||(c[v]={}),c[v]=n({},c[v],d[v])}),u}),c};return L.default=o,L}var j={},Ve;function Ht(){if(Ve)return j;Ve=1,Object.defineProperty(j,"__esModule",{value:!0}),j.autoprefix=void 0;var a=Re,e=r(a),t=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(o[p]=h[p])}return o};function r(o){return o&&o.__esModule?o:{default:o}}var n={borderRadius:function(l){return{msBorderRadius:l,MozBorderRadius:l,OBorderRadius:l,WebkitBorderRadius:l,borderRadius:l}},boxShadow:function(l){return{msBoxShadow:l,MozBoxShadow:l,OBoxShadow:l,WebkitBoxShadow:l,boxShadow:l}},userSelect:function(l){return{WebkitTouchCallout:l,KhtmlUserSelect:l,MozUserSelect:l,msUserSelect:l,WebkitUserSelect:l,userSelect:l}},flex:function(l){return{WebkitBoxFlex:l,MozBoxFlex:l,WebkitFlex:l,msFlex:l,flex:l}},flexBasis:function(l){return{WebkitFlexBasis:l,flexBasis:l}},justifyContent:function(l){return{WebkitJustifyContent:l,justifyContent:l}},transition:function(l){return{msTransition:l,MozTransition:l,OTransition:l,WebkitTransition:l,transition:l}},transform:function(l){return{msTransform:l,MozTransform:l,OTransform:l,WebkitTransform:l,transform:l}},absolute:function(l){var h=l&&l.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(l,h){var p=h[l];return p||{extend:l}}},i=j.autoprefix=function(l){var h={};return(0,e.default)(l,function(p,c){var u={};(0,e.default)(p,function(d,f){var v=n[f];v?u=t({},u,v(d)):u[f]=d}),h[c]=u}),h};return j.default=i,j}var z={},Xe;function Pt(){if(Xe)return z;Xe=1,Object.defineProperty(z,"__esModule",{value:!0}),z.hover=void 0;var a=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var c=arguments[p];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(h[u]=c[u])}return h},e=xe(),t=r(e);function r(h){return h&&h.__esModule?h:{default:h}}function n(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function i(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function o(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var l=z.hover=function(p){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;n(this,d);for(var E=arguments.length,O=Array(E),C=0;C<E;C++)O[C]=arguments[C];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(O))),b),b.state={hover:!1},b.handleMouseOver=function(){return b.setState({hover:!0})},b.handleMouseOut=function(){return b.setState({hover:!1})},b.render=function(){return t.default.createElement(c,{onMouseOver:b.handleMouseOver,onMouseOut:b.handleMouseOut},t.default.createElement(p,a({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return z.default=l,z}var G={},Ye;function Tt(){if(Ye)return G;Ye=1,Object.defineProperty(G,"__esModule",{value:!0}),G.active=void 0;var a=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var c=arguments[p];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(h[u]=c[u])}return h},e=xe(),t=r(e);function r(h){return h&&h.__esModule?h:{default:h}}function n(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function i(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function o(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var l=G.active=function(p){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;n(this,d);for(var E=arguments.length,O=Array(E),C=0;C<E;C++)O[C]=arguments[C];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(O))),b),b.state={active:!1},b.handleMouseDown=function(){return b.setState({active:!0})},b.handleMouseUp=function(){return b.setState({active:!1})},b.render=function(){return t.default.createElement(c,{onMouseDown:b.handleMouseDown,onMouseUp:b.handleMouseUp},t.default.createElement(p,a({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return G.default=l,G}var fe={},Ke;function Nt(){if(Ke)return fe;Ke=1,Object.defineProperty(fe,"__esModule",{value:!0});var a=function(t,r){var n={},i=function(l){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n[l]=h};return t===0&&i("first-child"),t===r-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),n};return fe.default=a,fe}var Ze;function Dt(){if(Ze)return k;Ze=1,Object.defineProperty(k,"__esModule",{value:!0}),k.ReactCSS=k.loop=k.handleActive=k.handleHover=k.hover=void 0;var a=Bt(),e=d(a),t=At(),r=d(t),n=Ht(),i=d(n),o=Pt(),l=d(o),h=Tt(),p=d(h),c=Nt(),u=d(c);function d(v){return v&&v.__esModule?v:{default:v}}k.hover=l.default,k.handleHover=l.default,k.handleActive=p.default,k.loop=u.default;var f=k.ReactCSS=function(b){for(var m=arguments.length,E=Array(m>1?m-1:0),O=1;O<m;O++)E[O-1]=arguments[O];var C=(0,e.default)(E),P=(0,r.default)(b,C);return(0,i.default)(P)};return k.default=f,k}var _e=Dt();const y=ke(_e);var $t=function(e,t,r,n,i){var o=i.clientWidth,l=i.clientHeight,h=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,p=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=h-(i.getBoundingClientRect().left+window.pageXOffset),u=p-(i.getBoundingClientRect().top+window.pageYOffset);if(r==="vertical"){var d=void 0;if(u<0?d=0:u>l?d=1:d=Math.round(u*100/l)/100,t.a!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}else{var f=void 0;if(c<0?f=0:c>o?f=1:f=Math.round(c*100/o)/100,n!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}return null},we={},Lt=function(e,t,r,n){if(typeof document>"u"&&!n)return null;var i=n?new n:document.createElement("canvas");i.width=r*2,i.height=r*2;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),i.toDataURL()):null},jt=function(e,t,r,n){var i=e+"-"+t+"-"+r+(n?"-server":"");if(we[i])return we[i];var o=Lt(e,t,r,n);return we[i]=o,o},Je=Object.assign||function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(a[r]=t[r])}return a},oe=function(e){var t=e.white,r=e.grey,n=e.size,i=e.renderers,o=e.borderRadius,l=e.boxShadow,h=e.children,p=y({default:{grid:{borderRadius:o,boxShadow:l,absolute:"0px 0px 0px 0px",background:"url("+jt(t,r,n,i.canvas)+") center left"}}});return A.isValidElement(h)?s.cloneElement(h,Je({},h.props,{style:Je({},h.props.style,p.grid)})):s.createElement("div",{style:p.grid})};oe.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var zt=Object.assign||function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(a[r]=t[r])}return a},Gt=function(){function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}}();function Ut(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}function Qe(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:a}function Wt(a,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}var Oe=function(a){Wt(e,a);function e(){var t,r,n,i;Ut(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(r=(n=Qe(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),n),n.handleChange=function(p){var c=$t(p,n.props.hsl,n.props.direction,n.props.a,n.container);c&&typeof n.props.onChange=="function"&&n.props.onChange(c,p)},n.handleMouseDown=function(p){n.handleChange(p),window.addEventListener("mousemove",n.handleChange),window.addEventListener("mouseup",n.handleMouseUp)},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleChange),window.removeEventListener("mouseup",n.handleMouseUp)},r),Qe(n,i)}return Gt(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var r=this,n=this.props.rgb,i=y({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+n.r+","+n.g+","+n.b+`, 0) 0%,
|
|
2
2
|
rgba(`+n.r+","+n.g+","+n.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:n.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+n.r+","+n.g+","+n.b+`, 0) 0%,
|
|
3
3
|
rgba(`+n.r+","+n.g+","+n.b+", 1) 100%)"},pointer:{left:0,top:n.a*100+"%"}},overwrite:zt({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return s.createElement("div",{style:i.alpha},s.createElement("div",{style:i.checkboard},s.createElement(oe,{renderers:this.props.renderers})),s.createElement("div",{style:i.gradient}),s.createElement("div",{style:i.container,ref:function(l){return r.container=l},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("div",{style:i.pointer},this.props.pointer?s.createElement(this.props.pointer,this.props):s.createElement("div",{style:i.slider}))))}}]),e}(A.PureComponent||A.Component),It=function(){function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}}();function qt(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Vt(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}function Xt(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:a}function Yt(a,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}var Kt=1,ft=38,Zt=40,Jt=[ft,Zt],Qt=function(e){return Jt.indexOf(e)>-1},er=function(e){return Number(String(e).replace(/%/g,""))},tr=1,w=function(a){Yt(e,a);function e(t){Vt(this,e);var r=Xt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(n){r.setUpdatedValue(n.target.value,n)},r.handleKeyDown=function(n){var i=er(n.target.value);if(!isNaN(i)&&Qt(n.keyCode)){var o=r.getArrowOffset(),l=n.keyCode===ft?i+o:i-o;r.setUpdatedValue(l,n)}},r.handleDrag=function(n){if(r.props.dragLabel){var i=Math.round(r.props.value+n.movementX);i>=0&&i<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(i),n)}},r.handleMouseDown=function(n){r.props.dragLabel&&(n.preventDefault(),r.handleDrag(n),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},r.inputId="rc-editable-input-"+tr++,r}return It(e,[{key:"componentDidUpdate",value:function(r,n){this.props.value!==this.state.value&&(r.value!==this.props.value||n.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return qt({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||Kt}},{key:"setUpdatedValue",value:function(r,n){var i=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(i,n),this.setState({value:r})}},{key:"render",value:function(){var r=this,n=y({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return s.createElement("div",{style:n.wrap},s.createElement("input",{id:this.inputId,style:n.input,ref:function(o){return r.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?s.createElement("label",{htmlFor:this.inputId,style:n.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(A.PureComponent||A.Component),rr=function(e,t,r,n){var i=n.clientWidth,o=n.clientHeight,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,h=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,p=l-(n.getBoundingClientRect().left+window.pageXOffset),c=h-(n.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(c<0)u=359;else if(c>o)u=0;else{var d=-(c*100/o)+100;u=360*d/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var f=void 0;if(p<0)f=0;else if(p>i)f=359;else{var v=p*100/i;f=360*v/100}if(r.h!==f)return{h:f,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},nr=function(){function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}}();function ar(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}function et(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:a}function ir(a,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}var le=function(a){ir(e,a);function e(){var t,r,n,i;ar(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(r=(n=et(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),n),n.handleChange=function(p){var c=rr(p,n.props.direction,n.props.hsl,n.container);c&&typeof n.props.onChange=="function"&&n.props.onChange(c,p)},n.handleMouseDown=function(p){n.handleChange(p),window.addEventListener("mousemove",n.handleChange),window.addEventListener("mouseup",n.handleMouseUp)},n.handleMouseUp=function(){n.unbindEventListeners()},r),et(n,i)}return nr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var r=this,n=this.props.direction,i=n===void 0?"horizontal":n,o=y({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:i==="vertical"});return s.createElement("div",{style:o.hue},s.createElement("div",{className:"hue-"+i,style:o.container,ref:function(h){return r.container=h},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("style",null,`
|
|
4
4
|
.hue-horizontal {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as E,j as e,ak as l,y as h,bW as A,bX as g,bY as y,at as L,W as N}from"./vendor-mui-core-DnR6WYuU.js";import{r as m}from"./vendor-react-CTtPmzVP.js";import{V as I,H as j}from"./vendor-ux-
|
|
1
|
+
import{D as E,j as e,ak as l,y as h,bW as A,bX as g,bY as y,at as L,W as N}from"./vendor-mui-core-DnR6WYuU.js";import{r as m}from"./vendor-react-CTtPmzVP.js";import{V as I,H as j}from"./vendor-ux-7TwTLXf8.js";import{A as b}from"./config-DEeSuJty.js";import{a as O}from"./page-header-CHAwrgX-.js";import{y as v,q as R,c as o,r as Y}from"./index-CGOBEhzW.js";import{S as T}from"./layout-BumaOQ7l.js";import{S as W}from"./step-actions-D3sZvhKo.js";import{S as D}from"./button-Bfs8GG-V.js";import"./vendor-utils-CxWN1dT3.js";import"./vendor-hooks-qxhUUbW5.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Dr30TSIK.js";import"./content-layout-DmSBGGVm.js";import"./use-mobile-D5clNlrm.js";function P({onNext:a=()=>{}}){const C=E(),{t:n,locale:p}=I(),[i,c]=m.useState(!1),[S,d]=m.useState(""),{blocklet:r}=v();m.useEffect(()=>{const t=R.findServiceFromMeta(r.meta,o.NODE_SERVICES.AUTH);d(t?.config?.whoCanAccess||o.WHO_CAN_ACCESS.ALL)},[r]);const f=async t=>{let s=o.ACCESS_POLICY_PUBLIC;t===o.WHO_CAN_ACCESS.ALL?s=o.ACCESS_POLICY_PUBLIC:t===o.WHO_CAN_ACCESS.INVITED?s=o.ACCESS_POLICY_INVITED_ONLY:t===o.WHO_CAN_ACCESS.OWNER?s=o.ACCESS_POLICY_OWNER_ONLY:t===o.WHO_CAN_ACCESS.ADMIN&&(s=o.ACCESS_POLICY_ADMIN_ONLY);try{c(!0),await Y.updateBlockletSecurityRule({input:{did:r.meta.did,data:{id:o.SECURITY_RULE_DEFAULT_ID,accessPolicyId:s}}}),c(!1)}catch(_){c(!1),j.error(_.message)}},x=async t=>{i||(d(t.target.value),await f(t.target.value))},u={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:C.palette.text.secondary};return e.jsxs(k,{children:[e.jsx(l,{className:"header",children:e.jsx(O,{title:n("blocklet.config.access.title"),subTitle:n("blocklet.config.access.description")})}),e.jsx(l,{className:"form-container",children:e.jsx(h,{component:"fieldset",children:e.jsx(A,{name:"inherit",value:S,onChange:x,children:b.map(t=>e.jsxs(l,{sx:{mb:2,"&:last-child":{mb:0}},children:[e.jsx(g,{value:t.value,control:e.jsx(y,{size:"small",color:"primary"}),label:e.jsxs("span",{style:{display:"flex",alignItems:"center",position:"relative"},children:[e.jsx(t.icon,{style:u}),e.jsx("span",{style:{marginTop:2},children:t.title[p]})]})}),e.jsx(l,{className:"tip",children:t.description[p]})]},t.value))})})}),e.jsx(W,{mt:8,disabled:i,blocklet:r,onStartNow:()=>a("complete"),children:e.jsx(D,{loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:n("setup.continue")})})]})}P.propTypes={onNext:N.func};const k=L(T)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
.header {
|