@linagora/linid-im-front-corelib 0.0.11 → 0.0.13

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.
@@ -1,2901 +1,329 @@
1
- import { defineAsyncComponent, hasInjectionContext, inject, getCurrentInstance, ref, reactive, markRaw, effectScope, isRef, isReactive, toRef, toRaw, nextTick, computed, getCurrentScope, onScopeDispose, watch, toRefs, defineComponent, watchEffect, createElementBlock, openBlock, Fragment, renderSlot, createCommentVNode, renderList, createBlock, resolveDynamicComponent, mergeProps, createElementVNode } from "vue";
2
- var runtime = {}, runtime_cjs = {}, index_cjs$3 = {}, index_cjs$2 = {}, index_cjs$1 = {}, hasRequiredIndex_cjs$3;
3
- function requireIndex_cjs$3() {
4
- if (hasRequiredIndex_cjs$3) return index_cjs$1;
5
- hasRequiredIndex_cjs$3 = 1;
6
- const FederationModuleManifest = "federation-manifest.json", MANIFEST_EXT = ".json", BROWSER_LOG_KEY = "FEDERATION_DEBUG", NameTransformSymbol = {
7
- AT: "@",
8
- HYPHEN: "-",
9
- SLASH: "/"
10
- }, NameTransformMap = {
11
- [NameTransformSymbol.AT]: "scope_",
12
- [NameTransformSymbol.HYPHEN]: "_",
13
- [NameTransformSymbol.SLASH]: "__"
14
- }, EncodedNameTransformMap = {
15
- [NameTransformMap[NameTransformSymbol.AT]]: NameTransformSymbol.AT,
16
- [NameTransformMap[NameTransformSymbol.HYPHEN]]: NameTransformSymbol.HYPHEN,
17
- [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH
18
- }, SEPARATOR = ":", ManifestFileName = "mf-manifest.json", StatsFileName = "mf-stats.json", MFModuleType = {
19
- NPM: "npm",
20
- APP: "app"
21
- }, MODULE_DEVTOOL_IDENTIFIER = "__MF_DEVTOOLS_MODULE_INFO__", ENCODE_NAME_PREFIX = "ENCODE_NAME_PREFIX", TEMP_DIR = ".federation", MFPrefetchCommon = {
22
- identifier: "MFDataPrefetch",
23
- globalKey: "__PREFETCH__",
24
- library: "mf-data-prefetch",
25
- exportsKey: "__PREFETCH_EXPORTS__",
26
- fileName: "bootstrap.js"
27
- };
28
- var ContainerPlugin = /* @__PURE__ */ Object.freeze({
29
- __proto__: null
30
- }), ContainerReferencePlugin = /* @__PURE__ */ Object.freeze({
31
- __proto__: null
32
- }), ModuleFederationPlugin = /* @__PURE__ */ Object.freeze({
33
- __proto__: null
34
- }), SharePlugin = /* @__PURE__ */ Object.freeze({
35
- __proto__: null
36
- });
37
- function isBrowserEnv() {
38
- return typeof window < "u" && typeof window.document < "u";
39
- }
40
- function isReactNativeEnv() {
41
- return typeof navigator < "u" && navigator?.product === "ReactNative";
42
- }
43
- function isBrowserDebug() {
44
- try {
45
- if (isBrowserEnv() && window.localStorage)
46
- return !!localStorage.getItem(BROWSER_LOG_KEY);
47
- } catch {
48
- return !1;
49
- }
50
- return !1;
51
- }
52
- function isDebugMode() {
53
- return typeof process < "u" && process.env && process.env.FEDERATION_DEBUG ? !!process.env.FEDERATION_DEBUG : typeof FEDERATION_DEBUG < "u" && FEDERATION_DEBUG ? !0 : isBrowserDebug();
54
- }
55
- const getProcessEnv = function() {
56
- return typeof process < "u" && process.env ? process.env : {};
57
- }, LOG_CATEGORY = "[ Federation Runtime ]", parseEntry = (t, s, d = SEPARATOR) => {
58
- const u = t.split(d), h = getProcessEnv().NODE_ENV === "development" && s, E = "*", _ = (y) => y.startsWith("http") || y.includes(MANIFEST_EXT);
59
- if (u.length >= 2) {
60
- let [y, ...R] = u;
61
- t.startsWith(d) && (y = u.slice(0, 2).join(d), R = [
62
- h || u.slice(2).join(d)
63
- ]);
64
- let $ = h || R.join(d);
65
- return _($) ? {
66
- name: y,
67
- entry: $
68
- } : {
69
- name: y,
70
- version: $ || E
71
- };
72
- } else if (u.length === 1) {
73
- const [y] = u;
74
- return h && _(h) ? {
75
- name: y,
76
- entry: h
77
- } : {
78
- name: y,
79
- version: h || E
80
- };
81
- } else
82
- throw `Invalid entry value: ${t}`;
83
- }, composeKeyWithSeparator = function(...t) {
84
- return t.length ? t.reduce((s, d) => d ? s ? `${s}${SEPARATOR}${d}` : d : s, "") : "";
85
- }, encodeName = function(t, s = "", d = !1) {
86
- try {
87
- const u = d ? ".js" : "";
88
- return `${s}${t.replace(new RegExp(`${NameTransformSymbol.AT}`, "g"), NameTransformMap[NameTransformSymbol.AT]).replace(new RegExp(`${NameTransformSymbol.HYPHEN}`, "g"), NameTransformMap[NameTransformSymbol.HYPHEN]).replace(new RegExp(`${NameTransformSymbol.SLASH}`, "g"), NameTransformMap[NameTransformSymbol.SLASH])}${u}`;
89
- } catch (u) {
90
- throw u;
91
- }
92
- }, decodeName = function(t, s, d) {
93
- try {
94
- let u = t;
95
- if (s) {
96
- if (!u.startsWith(s))
97
- return u;
98
- u = u.replace(new RegExp(s, "g"), "");
99
- }
100
- return u = u.replace(new RegExp(`${NameTransformMap[NameTransformSymbol.AT]}`, "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.AT]]).replace(new RegExp(`${NameTransformMap[NameTransformSymbol.SLASH]}`, "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.SLASH]]).replace(new RegExp(`${NameTransformMap[NameTransformSymbol.HYPHEN]}`, "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.HYPHEN]]), d && (u = u.replace(".js", "")), u;
101
- } catch (u) {
102
- throw u;
103
- }
104
- }, generateExposeFilename = (t, s) => {
105
- if (!t)
106
- return "";
107
- let d = t;
108
- return d === "." && (d = "default_export"), d.startsWith("./") && (d = d.replace("./", "")), encodeName(d, "__federation_expose_", s);
109
- }, generateShareFilename = (t, s) => t ? encodeName(t, "__federation_shared_", s) : "", getResourceUrl = (t, s) => {
110
- if ("getPublicPath" in t) {
111
- let d;
112
- return t.getPublicPath.startsWith("function") ? d = new Function("return " + t.getPublicPath)()() : d = new Function(t.getPublicPath)(), `${d}${s}`;
113
- } else return "publicPath" in t ? !isBrowserEnv() && !isReactNativeEnv() && "ssrPublicPath" in t ? `${t.ssrPublicPath}${s}` : `${t.publicPath}${s}` : (console.warn("Cannot get resource URL. If in debug mode, please ignore.", t, s), "");
114
- }, assert = (t, s) => {
115
- t || error(s);
116
- }, error = (t) => {
117
- throw new Error(`${LOG_CATEGORY}: ${t}`);
118
- }, warn = (t) => {
119
- console.warn(`${LOG_CATEGORY}: ${t}`);
120
- };
121
- function safeToString(t) {
122
- try {
123
- return JSON.stringify(t, null, 2);
124
- } catch {
125
- return "";
126
- }
127
- }
128
- const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
129
- function isRequiredVersion(t) {
130
- return VERSION_PATTERN_REGEXP.test(t);
131
- }
132
- const simpleJoinRemoteEntry = (t, s) => {
133
- if (!t)
134
- return s;
135
- const u = ((h) => {
136
- if (h === ".")
137
- return "";
138
- if (h.startsWith("./"))
139
- return h.replace("./", "");
140
- if (h.startsWith("/")) {
141
- const E = h.slice(1);
142
- return E.endsWith("/") ? E.slice(0, -1) : E;
143
- }
144
- return h;
145
- })(t);
146
- return u ? u.endsWith("/") ? `${u}${s}` : `${u}/${s}` : s;
147
- };
148
- function inferAutoPublicPath(t) {
149
- return t.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
150
- }
151
- function generateSnapshotFromManifest(t, s = {}) {
152
- const { remotes: d = {}, overrides: u = {}, version: h } = s;
153
- let E;
154
- const _ = () => "publicPath" in t.metaData ? t.metaData.publicPath === "auto" && h ? inferAutoPublicPath(h) : t.metaData.publicPath : t.metaData.getPublicPath, y = Object.keys(u);
155
- let R = {};
156
- Object.keys(d).length || (R = t.remotes?.reduce((D, P) => {
157
- let F;
158
- const V = P.federationContainerName;
159
- return y.includes(V) ? F = u[V] : "version" in P ? F = P.version : F = P.entry, D[V] = {
160
- matchedVersion: F
161
- }, D;
162
- }, {}) || {}), Object.keys(d).forEach((D) => R[D] = {
163
- // overrides will override dependencies
164
- matchedVersion: y.includes(D) ? u[D] : d[D]
165
- });
166
- const { remoteEntry: { path: $, name: w, type: k }, types: H = { path: "", name: "", zip: "", api: "" }, buildInfo: { buildVersion: B }, globalName: j, ssrRemoteEntry: U } = t.metaData, { exposes: Q } = t;
167
- let J = {
168
- version: h || "",
169
- buildVersion: B,
170
- globalName: j,
171
- remoteEntry: simpleJoinRemoteEntry($, w),
172
- remoteEntryType: k,
173
- remoteTypes: simpleJoinRemoteEntry(H.path, H.name),
174
- remoteTypesZip: H.zip || "",
175
- remoteTypesAPI: H.api || "",
176
- remotesInfo: R,
177
- shared: t?.shared.map((D) => ({
178
- assets: D.assets,
179
- sharedName: D.name,
180
- version: D.version
181
- })),
182
- modules: Q?.map((D) => ({
183
- moduleName: D.name,
184
- modulePath: D.path,
185
- assets: D.assets
186
- }))
187
- };
188
- if (t.metaData?.prefetchInterface) {
189
- const D = t.metaData.prefetchInterface;
190
- J = {
191
- ...J,
192
- prefetchInterface: D
193
- };
194
- }
195
- if (t.metaData?.prefetchEntry) {
196
- const { path: D, name: P, type: F } = t.metaData.prefetchEntry;
197
- J = {
198
- ...J,
199
- prefetchEntry: simpleJoinRemoteEntry(D, P),
200
- prefetchEntryType: F
201
- };
202
- }
203
- if ("publicPath" in t.metaData ? E = {
204
- ...J,
205
- publicPath: _(),
206
- ssrPublicPath: t.metaData.ssrPublicPath
207
- } : E = {
208
- ...J,
209
- getPublicPath: _()
210
- }, U) {
211
- const D = simpleJoinRemoteEntry(U.path, U.name);
212
- E.ssrRemoteEntry = D, E.ssrRemoteEntryType = U.type || "commonjs-module";
213
- }
214
- return E;
215
- }
216
- function isManifestProvider(t) {
217
- return !!("remoteEntry" in t && t.remoteEntry.includes(MANIFEST_EXT));
218
- }
219
- function getManifestFileName(t) {
220
- if (!t)
221
- return {
222
- statsFileName: StatsFileName,
223
- manifestFileName: ManifestFileName
224
- };
225
- let s = typeof t == "boolean" ? "" : t.filePath || "", d = typeof t == "boolean" ? "" : t.fileName || "";
226
- const u = ".json", h = (R) => R.endsWith(u) ? R : `${R}${u}`, E = (R, $) => R.replace(u, `${$}${u}`), _ = d ? h(d) : ManifestFileName, y = d ? E(_, "-stats") : StatsFileName;
227
- return {
228
- statsFileName: simpleJoinRemoteEntry(s, y),
229
- manifestFileName: simpleJoinRemoteEntry(s, _)
230
- };
231
- }
232
- const PREFIX = "[ Module Federation ]", DEFAULT_DELEGATE = console, LOGGER_STACK_SKIP_TOKENS = [
233
- "logger.ts",
234
- "logger.js",
235
- "captureStackTrace",
236
- "Logger.emit",
237
- "Logger.log",
238
- "Logger.info",
239
- "Logger.warn",
240
- "Logger.error",
241
- "Logger.debug"
242
- ];
243
- function captureStackTrace() {
244
- try {
245
- const t = new Error().stack;
246
- if (!t)
247
- return;
248
- const [, ...s] = t.split(`
249
- `), d = s.filter((h) => !LOGGER_STACK_SKIP_TOKENS.some((E) => h.includes(E)));
250
- return d.length ? `Stack trace:
251
- ${d.slice(0, 5).join(`
252
- `)}` : void 0;
253
- } catch {
254
- return;
255
- }
256
- }
257
- class Logger {
258
- constructor(s, d = DEFAULT_DELEGATE) {
259
- this.prefix = s, this.delegate = d ?? DEFAULT_DELEGATE;
260
- }
261
- setPrefix(s) {
262
- this.prefix = s;
263
- }
264
- setDelegate(s) {
265
- this.delegate = s ?? DEFAULT_DELEGATE;
266
- }
267
- emit(s, d) {
268
- const u = this.delegate, E = isDebugMode() ? captureStackTrace() : void 0, _ = E ? [...d, E] : d, y = (() => {
269
- switch (s) {
270
- case "log":
271
- return ["log", "info"];
272
- case "info":
273
- return ["info", "log"];
274
- case "warn":
275
- return ["warn", "info", "log"];
276
- case "error":
277
- return ["error", "warn", "log"];
278
- case "debug":
279
- default:
280
- return ["debug", "log"];
281
- }
282
- })();
283
- for (const R of y) {
284
- const $ = u[R];
285
- if (typeof $ == "function") {
286
- $.call(u, this.prefix, ..._);
287
- return;
288
- }
289
- }
290
- for (const R of y) {
291
- const $ = DEFAULT_DELEGATE[R];
292
- if (typeof $ == "function") {
293
- $.call(DEFAULT_DELEGATE, this.prefix, ..._);
294
- return;
295
- }
296
- }
297
- }
298
- log(...s) {
299
- this.emit("log", s);
300
- }
301
- warn(...s) {
302
- this.emit("warn", s);
303
- }
304
- error(...s) {
305
- this.emit("error", s);
306
- }
307
- success(...s) {
308
- this.emit("info", s);
309
- }
310
- info(...s) {
311
- this.emit("info", s);
312
- }
313
- ready(...s) {
314
- this.emit("info", s);
315
- }
316
- debug(...s) {
317
- isDebugMode() && this.emit("debug", s);
318
- }
319
- }
320
- function createLogger(t) {
321
- return new Logger(t);
322
- }
323
- function createInfrastructureLogger(t) {
324
- const s = new Logger(t);
325
- return Object.defineProperty(s, "__mf_infrastructure_logger__", {
326
- value: !0,
327
- enumerable: !1,
328
- configurable: !1
329
- }), s;
330
- }
331
- function bindLoggerToCompiler(t, s, d) {
332
- if (t.__mf_infrastructure_logger__ && s?.getInfrastructureLogger)
333
- try {
334
- const u = s.getInfrastructureLogger(d);
335
- u && typeof u == "object" && (typeof u.log == "function" || typeof u.info == "function" || typeof u.warn == "function" || typeof u.error == "function") && t.setDelegate(u);
336
- } catch {
337
- t.setDelegate(void 0);
338
- }
339
- }
340
- const logger = createLogger(PREFIX), infrastructureLogger = createInfrastructureLogger(PREFIX);
341
- async function safeWrapper(t, s) {
342
- try {
343
- return await t();
344
- } catch (d) {
345
- !s && warn(d);
346
- return;
347
- }
348
- }
349
- function isStaticResourcesEqual(t, s) {
350
- const d = /^(https?:)?\/\//i, u = t.replace(d, "").replace(/\/$/, ""), h = s.replace(d, "").replace(/\/$/, "");
351
- return u === h;
352
- }
353
- function createScript(t) {
354
- let s = null, d = !0, u = 2e4, h;
355
- const E = document.getElementsByTagName("script");
356
- for (let y = 0; y < E.length; y++) {
357
- const R = E[y], $ = R.getAttribute("src");
358
- if ($ && isStaticResourcesEqual($, t.url)) {
359
- s = R, d = !1;
360
- break;
361
- }
362
- }
363
- if (!s) {
364
- const y = t.attrs;
365
- s = document.createElement("script"), s.type = y?.type === "module" ? "module" : "text/javascript";
366
- let R;
367
- t.createScriptHook && (R = t.createScriptHook(t.url, t.attrs), R instanceof HTMLScriptElement ? s = R : typeof R == "object" && ("script" in R && R.script && (s = R.script), "timeout" in R && R.timeout && (u = R.timeout))), s.src || (s.src = t.url), y && !R && Object.keys(y).forEach(($) => {
368
- s && ($ === "async" || $ === "defer" ? s[$] = y[$] : s.getAttribute($) || s.setAttribute($, y[$]));
369
- });
370
- }
371
- const _ = async (y, R) => {
372
- clearTimeout(h);
373
- const $ = () => {
374
- R?.type === "error" ? t?.onErrorCallback && t?.onErrorCallback(R) : t?.cb && t?.cb();
375
- };
376
- if (s && (s.onerror = null, s.onload = null, safeWrapper(() => {
377
- const { needDeleteScript: w = !0 } = t;
378
- w && s?.parentNode && s.parentNode.removeChild(s);
379
- }), y && typeof y == "function")) {
380
- const w = y(R);
381
- if (w instanceof Promise) {
382
- const k = await w;
383
- return $(), k;
384
- }
385
- return $(), w;
386
- }
387
- $();
388
- };
389
- return s.onerror = _.bind(null, s.onerror), s.onload = _.bind(null, s.onload), h = setTimeout(() => {
390
- _(null, new Error(`Remote script "${t.url}" time-outed.`));
391
- }, u), { script: s, needAttach: d };
392
- }
393
- function createLink(t) {
394
- let s = null, d = !0;
395
- const u = document.getElementsByTagName("link");
396
- for (let E = 0; E < u.length; E++) {
397
- const _ = u[E], y = _.getAttribute("href"), R = _.getAttribute("rel");
398
- if (y && isStaticResourcesEqual(y, t.url) && R === t.attrs.rel) {
399
- s = _, d = !1;
400
- break;
401
- }
402
- }
403
- if (!s) {
404
- s = document.createElement("link"), s.setAttribute("href", t.url);
405
- let E;
406
- const _ = t.attrs;
407
- t.createLinkHook && (E = t.createLinkHook(t.url, _), E instanceof HTMLLinkElement && (s = E)), _ && !E && Object.keys(_).forEach((y) => {
408
- s && !s.getAttribute(y) && s.setAttribute(y, _[y]);
409
- });
410
- }
411
- const h = (E, _) => {
412
- const y = () => {
413
- _?.type === "error" ? t?.onErrorCallback && t?.onErrorCallback(_) : t?.cb && t?.cb();
414
- };
415
- if (s && (s.onerror = null, s.onload = null, safeWrapper(() => {
416
- const { needDeleteLink: R = !0 } = t;
417
- R && s?.parentNode && s.parentNode.removeChild(s);
418
- }), E)) {
419
- const R = E(_);
420
- return y(), R;
421
- }
422
- y();
423
- };
424
- return s.onerror = h.bind(null, s.onerror), s.onload = h.bind(null, s.onload), { link: s, needAttach: d };
425
- }
426
- function loadScript(t, s) {
427
- const { attrs: d = {}, createScriptHook: u } = s;
428
- return new Promise((h, E) => {
429
- const { script: _, needAttach: y } = createScript({
430
- url: t,
431
- cb: h,
432
- onErrorCallback: E,
433
- attrs: {
434
- fetchpriority: "high",
435
- ...d
436
- },
437
- createScriptHook: u,
438
- needDeleteScript: !0
439
- });
440
- y && document.head.appendChild(_);
441
- });
442
- }
443
- const sdkImportCache = /* @__PURE__ */ new Map();
444
- function importNodeModule(t) {
445
- if (!t)
446
- throw new Error("import specifier is required");
447
- if (sdkImportCache.has(t))
448
- return sdkImportCache.get(t);
449
- const d = new Function("name", "return import(name)")(t).then((u) => u).catch((u) => {
450
- throw console.error(`Error importing module ${t}:`, u), sdkImportCache.delete(t), u;
451
- });
452
- return sdkImportCache.set(t, d), d;
453
- }
454
- const loadNodeFetch = async () => {
455
- const t = await importNodeModule("node-fetch");
456
- return t.default || t;
457
- }, lazyLoaderHookFetch = async (t, s, d) => {
458
- const h = await ((E, _) => d.lifecycle.fetch.emit(E, _))(t, s || {});
459
- return !h || !(h instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(t, s || {}) : h;
460
- }, createScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
461
- if (loaderHook?.createScriptHook) {
462
- const t = loaderHook.createScriptHook(url);
463
- t && typeof t == "object" && "url" in t && (url = t.url);
464
- }
465
- let urlObj;
466
- try {
467
- urlObj = new URL(url);
468
- } catch (t) {
469
- console.error("Error constructing URL:", t), cb(new Error(`Invalid URL: ${t}`));
470
- return;
471
- }
472
- const getFetch = async () => loaderHook?.fetch ? (t, s) => lazyLoaderHookFetch(t, s, loaderHook) : typeof fetch > "u" ? loadNodeFetch() : fetch, handleScriptFetch = async (f, urlObj) => {
473
- try {
474
- const res = await f(urlObj.href), data = await res.text(), [path, vm] = await Promise.all([
475
- importNodeModule("path"),
476
- importNodeModule("vm")
477
- ]), scriptContext = { exports: {}, module: { exports: {} } }, urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/"), filename = path.basename(urlObj.pathname), script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
478
- })`, {
479
- filename,
480
- importModuleDynamically: (
481
- //@ts-ignore
482
- vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ?? importNodeModule
483
- )
484
- });
485
- script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
486
- const exportedInterface = scriptContext.module.exports || scriptContext.exports;
487
- if (attrs && exportedInterface && attrs.globalName) {
488
- const t = exportedInterface[attrs.globalName] || exportedInterface;
489
- cb(void 0, t);
490
- return;
491
- }
492
- cb(void 0, exportedInterface);
493
- } catch (t) {
494
- cb(t instanceof Error ? t : new Error(`Script execution error: ${t}`));
495
- }
496
- };
497
- getFetch().then(async (t) => {
498
- if (attrs?.type === "esm" || attrs?.type === "module")
499
- return loadModule(urlObj.href, {
500
- fetch: t,
501
- vm: await importNodeModule("vm")
502
- }).then(async (s) => {
503
- await s.evaluate(), cb(void 0, s.namespace);
504
- }).catch((s) => {
505
- cb(s instanceof Error ? s : new Error(`Script execution error: ${s}`));
506
- });
507
- handleScriptFetch(t, urlObj);
508
- }).catch((t) => {
509
- cb(t);
510
- });
511
- } : (t, s, d, u) => {
512
- s(new Error("createScriptNode is disabled in non-Node.js environment"));
513
- }, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (t, s) => new Promise((d, u) => {
514
- createScriptNode(t, (h, E) => {
515
- if (h)
516
- u(h);
517
- else {
518
- const _ = s?.attrs?.globalName || `__FEDERATION_${s?.attrs?.name}:custom__`, y = globalThis[_] = E;
519
- d(y);
520
- }
521
- }, s.attrs, s.loaderHook);
522
- }) : (t, s) => {
523
- throw new Error("loadScriptNode is disabled in non-Node.js environment");
524
- }, esmModuleCache = /* @__PURE__ */ new Map();
525
- async function loadModule(t, s) {
526
- if (esmModuleCache.has(t))
527
- return esmModuleCache.get(t);
528
- const { fetch: d, vm: u } = s, E = await (await d(t)).text(), _ = new u.SourceTextModule(E, {
529
- // @ts-ignore
530
- importModuleDynamically: async (y, R) => {
531
- const $ = new URL(y, t).href;
532
- return loadModule($, s);
533
- }
534
- });
535
- return esmModuleCache.set(t, _), await _.link(async (y) => {
536
- const R = new URL(y, t).href;
537
- return await loadModule(R, s);
538
- }), _;
539
- }
540
- function normalizeOptions(t, s, d) {
541
- return function(u) {
542
- if (u === !1)
543
- return !1;
544
- if (typeof u > "u")
545
- return t ? s : !1;
546
- if (u === !0)
547
- return s;
548
- if (u && typeof u == "object")
549
- return {
550
- ...s,
551
- ...u
552
- };
553
- throw new Error(`Unexpected type for \`${d}\`, expect boolean/undefined/object, got: ${typeof u}`);
554
- };
555
- }
556
- const createModuleFederationConfig = (t) => t;
557
- return index_cjs$1.BROWSER_LOG_KEY = BROWSER_LOG_KEY, index_cjs$1.ENCODE_NAME_PREFIX = ENCODE_NAME_PREFIX, index_cjs$1.EncodedNameTransformMap = EncodedNameTransformMap, index_cjs$1.FederationModuleManifest = FederationModuleManifest, index_cjs$1.MANIFEST_EXT = MANIFEST_EXT, index_cjs$1.MFModuleType = MFModuleType, index_cjs$1.MFPrefetchCommon = MFPrefetchCommon, index_cjs$1.MODULE_DEVTOOL_IDENTIFIER = MODULE_DEVTOOL_IDENTIFIER, index_cjs$1.ManifestFileName = ManifestFileName, index_cjs$1.NameTransformMap = NameTransformMap, index_cjs$1.NameTransformSymbol = NameTransformSymbol, index_cjs$1.SEPARATOR = SEPARATOR, index_cjs$1.StatsFileName = StatsFileName, index_cjs$1.TEMP_DIR = TEMP_DIR, index_cjs$1.assert = assert, index_cjs$1.bindLoggerToCompiler = bindLoggerToCompiler, index_cjs$1.composeKeyWithSeparator = composeKeyWithSeparator, index_cjs$1.containerPlugin = ContainerPlugin, index_cjs$1.containerReferencePlugin = ContainerReferencePlugin, index_cjs$1.createInfrastructureLogger = createInfrastructureLogger, index_cjs$1.createLink = createLink, index_cjs$1.createLogger = createLogger, index_cjs$1.createModuleFederationConfig = createModuleFederationConfig, index_cjs$1.createScript = createScript, index_cjs$1.createScriptNode = createScriptNode, index_cjs$1.decodeName = decodeName, index_cjs$1.encodeName = encodeName, index_cjs$1.error = error, index_cjs$1.generateExposeFilename = generateExposeFilename, index_cjs$1.generateShareFilename = generateShareFilename, index_cjs$1.generateSnapshotFromManifest = generateSnapshotFromManifest, index_cjs$1.getManifestFileName = getManifestFileName, index_cjs$1.getProcessEnv = getProcessEnv, index_cjs$1.getResourceUrl = getResourceUrl, index_cjs$1.inferAutoPublicPath = inferAutoPublicPath, index_cjs$1.infrastructureLogger = infrastructureLogger, index_cjs$1.isBrowserEnv = isBrowserEnv, index_cjs$1.isDebugMode = isDebugMode, index_cjs$1.isManifestProvider = isManifestProvider, index_cjs$1.isReactNativeEnv = isReactNativeEnv, index_cjs$1.isRequiredVersion = isRequiredVersion, index_cjs$1.isStaticResourcesEqual = isStaticResourcesEqual, index_cjs$1.loadScript = loadScript, index_cjs$1.loadScriptNode = loadScriptNode, index_cjs$1.logger = logger, index_cjs$1.moduleFederationPlugin = ModuleFederationPlugin, index_cjs$1.normalizeOptions = normalizeOptions, index_cjs$1.parseEntry = parseEntry, index_cjs$1.safeToString = safeToString, index_cjs$1.safeWrapper = safeWrapper, index_cjs$1.sharePlugin = SharePlugin, index_cjs$1.simpleJoinRemoteEntry = simpleJoinRemoteEntry, index_cjs$1.warn = warn, index_cjs$1;
558
- }
559
- var index_cjs = {}, hasRequiredIndex_cjs$2;
560
- function requireIndex_cjs$2() {
561
- if (hasRequiredIndex_cjs$2) return index_cjs;
562
- hasRequiredIndex_cjs$2 = 1;
563
- const t = "RUNTIME-001", s = "RUNTIME-002", d = "RUNTIME-003", u = "RUNTIME-004", h = "RUNTIME-005", E = "RUNTIME-006", _ = "RUNTIME-007", y = "RUNTIME-008", R = "RUNTIME-009", $ = "TYPE-001", w = "BUILD-001", k = "BUILD-002", H = (D) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${D.split("-")[0].toLowerCase()}/${D}`, B = (D, P, F, V) => {
564
- const ee = [`${[P[D]]} #${D}`];
565
- return F && ee.push(`args: ${JSON.stringify(F)}`), ee.push(H(D)), V && ee.push(`Original Error Message:
566
- ${V}`), ee.join(`
567
- `);
568
- }, j = {
569
- [t]: "Failed to get remoteEntry exports.",
570
- [s]: 'The remote entry interface does not contain "init"',
571
- [d]: "Failed to get manifest.",
572
- [u]: "Failed to locate remote.",
573
- [h]: "Invalid loadShareSync function call from bundler runtime",
574
- [E]: "Invalid loadShareSync function call from runtime",
575
- [_]: "Failed to get remote snapshot.",
576
- [y]: "Failed to load script resources.",
577
- [R]: "Please call createInstance first."
578
- }, U = {
579
- [$]: "Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."
580
- }, Q = {
581
- [w]: "Failed to find expose module.",
582
- [k]: "PublicPath is required in prod mode."
583
- }, J = {
584
- ...j,
585
- ...U,
586
- ...Q
587
- };
588
- return index_cjs.BUILD_001 = w, index_cjs.BUILD_002 = k, index_cjs.RUNTIME_001 = t, index_cjs.RUNTIME_002 = s, index_cjs.RUNTIME_003 = d, index_cjs.RUNTIME_004 = u, index_cjs.RUNTIME_005 = h, index_cjs.RUNTIME_006 = E, index_cjs.RUNTIME_007 = _, index_cjs.RUNTIME_008 = y, index_cjs.RUNTIME_009 = R, index_cjs.TYPE_001 = $, index_cjs.buildDescMap = Q, index_cjs.errorDescMap = J, index_cjs.getShortErrorMsg = B, index_cjs.runtimeDescMap = j, index_cjs.typeDescMap = U, index_cjs;
589
- }
590
- var hasRequiredIndex_cjs$1;
591
- function requireIndex_cjs$1() {
592
- if (hasRequiredIndex_cjs$1) return index_cjs$2;
593
- hasRequiredIndex_cjs$1 = 1;
594
- var t = /* @__PURE__ */ requireIndex_cjs$3(), s = /* @__PURE__ */ requireIndex_cjs$2();
595
- const d = "[ Federation Runtime ]", u = t.createLogger(d);
596
- function h(n, e) {
597
- n || E(e);
598
- }
599
- function E(n) {
600
- throw n instanceof Error ? (n.message.startsWith(d) || (n.message = `${d}: ${n.message}`), n) : new Error(`${d}: ${n}`);
601
- }
602
- function _(n) {
603
- n instanceof Error && (n.message.startsWith(d) || (n.message = `${d}: ${n.message}`)), u.warn(n);
604
- }
605
- function y(n, e) {
606
- return n.findIndex((r) => r === e) === -1 && n.push(e), n;
607
- }
608
- function R(n) {
609
- return "version" in n && n.version ? `${n.name}:${n.version}` : "entry" in n && n.entry ? `${n.name}:${n.entry}` : `${n.name}`;
610
- }
611
- function $(n) {
612
- return typeof n.entry < "u";
613
- }
614
- function w(n) {
615
- return !n.entry.includes(".json");
616
- }
617
- async function k(n, e) {
618
- try {
619
- return await n();
620
- } catch (r) {
621
- !e && _(r);
622
- return;
623
- }
624
- }
625
- function H(n) {
626
- return n && typeof n == "object";
627
- }
628
- const B = Object.prototype.toString;
629
- function j(n) {
630
- return B.call(n) === "[object Object]";
631
- }
632
- function U(n, e) {
633
- const r = /^(https?:)?\/\//i, o = n.replace(r, "").replace(/\/$/, ""), i = e.replace(r, "").replace(/\/$/, "");
634
- return o === i;
635
- }
636
- function Q(n) {
637
- return Array.isArray(n) ? n : [n];
638
- }
639
- function J(n) {
640
- const e = {
641
- url: "",
642
- type: "global",
643
- globalName: ""
644
- };
645
- return t.isBrowserEnv() || t.isReactNativeEnv() ? "remoteEntry" in n ? {
646
- url: n.remoteEntry,
647
- type: n.remoteEntryType,
648
- globalName: n.globalName
649
- } : e : "ssrRemoteEntry" in n ? {
650
- url: n.ssrRemoteEntry || e.url,
651
- type: n.ssrRemoteEntryType || e.type,
652
- globalName: n.globalName
653
- } : e;
654
- }
655
- const D = (n, e) => {
656
- let r;
657
- return n.endsWith("/") ? r = n.slice(0, -1) : r = n, e.startsWith(".") && (e = e.slice(1)), r = r + e, r;
658
- }, P = typeof globalThis == "object" ? globalThis : window, F = (() => {
659
- try {
660
- return document.defaultView;
661
- } catch {
662
- return P;
663
- }
664
- })(), V = F;
665
- function ee(n, e, r) {
666
- Object.defineProperty(n, e, {
667
- value: r,
668
- configurable: !1,
669
- writable: !0
670
- });
671
- }
672
- function O(n, e) {
673
- return Object.hasOwnProperty.call(n, e);
674
- }
675
- O(P, "__GLOBAL_LOADING_REMOTE_ENTRY__") || ee(P, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
676
- const ce = P.__GLOBAL_LOADING_REMOTE_ENTRY__;
677
- function re(n) {
678
- O(n, "__VMOK__") && !O(n, "__FEDERATION__") && ee(n, "__FEDERATION__", n.__VMOK__), O(n, "__FEDERATION__") || (ee(n, "__FEDERATION__", {
679
- __GLOBAL_PLUGIN__: [],
680
- __INSTANCES__: [],
681
- moduleInfo: {},
682
- __SHARE__: {},
683
- __MANIFEST_LOADING__: {},
684
- __PRELOADED_MAP__: /* @__PURE__ */ new Map()
685
- }), ee(n, "__VMOK__", n.__FEDERATION__)), n.__FEDERATION__.__GLOBAL_PLUGIN__ ??= [], n.__FEDERATION__.__INSTANCES__ ??= [], n.__FEDERATION__.moduleInfo ??= {}, n.__FEDERATION__.__SHARE__ ??= {}, n.__FEDERATION__.__MANIFEST_LOADING__ ??= {}, n.__FEDERATION__.__PRELOADED_MAP__ ??= /* @__PURE__ */ new Map();
686
- }
687
- re(P), re(F);
688
- function I() {
689
- P.__FEDERATION__.__GLOBAL_PLUGIN__ = [], P.__FEDERATION__.__INSTANCES__ = [], P.__FEDERATION__.moduleInfo = {}, P.__FEDERATION__.__SHARE__ = {}, P.__FEDERATION__.__MANIFEST_LOADING__ = {}, Object.keys(ce).forEach((n) => {
690
- delete ce[n];
691
- });
692
- }
693
- function N(n) {
694
- P.__FEDERATION__.__INSTANCES__.push(n);
695
- }
696
- function C() {
697
- return P.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
698
- }
699
- function K(n, e = t.isDebugMode()) {
700
- e && (P.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = n, P.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.21.6");
701
- }
702
- function Z(n, e) {
703
- if (typeof e == "string") {
704
- if (n[e])
705
- return {
706
- value: n[e],
707
- key: e
708
- };
709
- {
710
- const o = Object.keys(n);
711
- for (const i of o) {
712
- const [c, a] = i.split(":"), l = `${c}:${e}`, p = n[l];
713
- if (p)
714
- return {
715
- value: p,
716
- key: l
717
- };
718
- }
719
- return {
720
- value: void 0,
721
- key: e
722
- };
723
- }
724
- } else
725
- throw new Error("key must be string");
726
- }
727
- const fe = () => F.__FEDERATION__.moduleInfo, Ie = (n, e) => {
728
- const r = R(n), o = Z(e, r).value;
729
- if (o && !o.version && "version" in n && n.version && (o.version = n.version), o)
730
- return o;
731
- if ("version" in n && n.version) {
732
- const { version: i, ...c } = n, a = R(c), l = Z(F.__FEDERATION__.moduleInfo, a).value;
733
- if (l?.version === i)
734
- return l;
735
- }
736
- }, he = (n) => Ie(n, F.__FEDERATION__.moduleInfo), le = (n, e) => {
737
- const r = R(n);
738
- return F.__FEDERATION__.moduleInfo[r] = e, F.__FEDERATION__.moduleInfo;
739
- }, z = (n) => (F.__FEDERATION__.moduleInfo = {
740
- ...F.__FEDERATION__.moduleInfo,
741
- ...n
742
- }, () => {
743
- const e = Object.keys(n);
744
- for (const r of e)
745
- delete F.__FEDERATION__.moduleInfo[r];
746
- }), $e = (n, e) => {
747
- const r = e || `__FEDERATION_${n}:custom__`, o = P[r];
748
- return {
749
- remoteEntryKey: r,
750
- entryExports: o
751
- };
752
- }, Ge = (n) => {
753
- const { __GLOBAL_PLUGIN__: e } = F.__FEDERATION__;
754
- n.forEach((r) => {
755
- e.findIndex((o) => o.name === r.name) === -1 ? e.push(r) : _(`The plugin ${r.name} has been registered.`);
756
- });
757
- }, Ve = () => F.__FEDERATION__.__GLOBAL_PLUGIN__, Be = (n) => P.__FEDERATION__.__PRELOADED_MAP__.get(n), qe = (n) => P.__FEDERATION__.__PRELOADED_MAP__.set(n, !0), Ee = "default", We = "global", ze = "[0-9A-Za-z-]+", Me = `(?:\\+(${ze}(?:\\.${ze})*))`, ye = "0|[1-9]\\d*", Te = "[0-9]+", Ke = "\\d*[a-zA-Z-][a-zA-Z0-9-]*", Xe = `(?:${Te}|${Ke})`, dt = `(?:-?(${Xe}(?:\\.${Xe})*))`, Ye = `(?:${ye}|${Ke})`, Je = `(?:-(${Ye}(?:\\.${Ye})*))`, Pe = `${ye}|x|X|\\*`, pe = `[v=\\s]*(${Pe})(?:\\.(${Pe})(?:\\.(${Pe})(?:${Je})?${Me}?)?)?`, ht = `^\\s*(${pe})\\s+-\\s+(${pe})\\s*$`, pt = `[v=\\s]*${`(${Te})\\.(${Te})\\.(${Te})`}${dt}?${Me}?`, we = "((?:<|>)?=?)", mt = `(\\s*)${we}\\s*(${pt}|${pe})`, Ze = "(?:~>?)", _t = `(\\s*)${Ze}\\s+`, Qe = "(?:\\^)", Et = `(\\s*)${Qe}\\s+`, yt = "(<|>)?=?\\s*\\*", gt = `^${Qe}${pe}$`, bt = `v?${`(${ye})\\.(${ye})\\.(${ye})`}${Je}?${Me}?`, St = `^${Ze}${pe}$`, Rt = `^${we}\\s*${pe}$`, Nt = `^${we}\\s*(${bt})$|^$`, It = "^\\s*>=\\s*0.0.0\\s*$";
758
- function ie(n) {
759
- return new RegExp(n);
760
- }
761
- function X(n) {
762
- return !n || n.toLowerCase() === "x" || n === "*";
763
- }
764
- function et(...n) {
765
- return (e) => n.reduce((r, o) => o(r), e);
766
- }
767
- function tt(n) {
768
- return n.match(ie(Nt));
769
- }
770
- function nt(n, e, r, o) {
771
- const i = `${n}.${e}.${r}`;
772
- return o ? `${i}-${o}` : i;
773
- }
774
- function $t(n) {
775
- return n.replace(ie(ht), (e, r, o, i, c, a, l, p, m, b, S, g) => (X(o) ? r = "" : X(i) ? r = `>=${o}.0.0` : X(c) ? r = `>=${o}.${i}.0` : r = `>=${r}`, X(m) ? p = "" : X(b) ? p = `<${Number(m) + 1}.0.0-0` : X(S) ? p = `<${m}.${Number(b) + 1}.0-0` : g ? p = `<=${m}.${b}.${S}-${g}` : p = `<=${p}`, `${r} ${p}`.trim()));
776
- }
777
- function Tt(n) {
778
- return n.replace(ie(mt), "$1$2$3");
779
- }
780
- function vt(n) {
781
- return n.replace(ie(_t), "$1~");
782
- }
783
- function Ot(n) {
784
- return n.replace(ie(Et), "$1^");
785
- }
786
- function Mt(n) {
787
- return n.trim().split(/\s+/).map((e) => e.replace(ie(gt), (r, o, i, c, a) => X(o) ? "" : X(i) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : X(c) ? o === "0" ? `>=${o}.${i}.0 <${o}.${Number(i) + 1}.0-0` : `>=${o}.${i}.0 <${Number(o) + 1}.0.0-0` : a ? o === "0" ? i === "0" ? `>=${o}.${i}.${c}-${a} <${o}.${i}.${Number(c) + 1}-0` : `>=${o}.${i}.${c}-${a} <${o}.${Number(i) + 1}.0-0` : `>=${o}.${i}.${c}-${a} <${Number(o) + 1}.0.0-0` : o === "0" ? i === "0" ? `>=${o}.${i}.${c} <${o}.${i}.${Number(c) + 1}-0` : `>=${o}.${i}.${c} <${o}.${Number(i) + 1}.0-0` : `>=${o}.${i}.${c} <${Number(o) + 1}.0.0-0`)).join(" ");
788
- }
789
- function Pt(n) {
790
- return n.trim().split(/\s+/).map((e) => e.replace(ie(St), (r, o, i, c, a) => X(o) ? "" : X(i) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : X(c) ? `>=${o}.${i}.0 <${o}.${Number(i) + 1}.0-0` : a ? `>=${o}.${i}.${c}-${a} <${o}.${Number(i) + 1}.0-0` : `>=${o}.${i}.${c} <${o}.${Number(i) + 1}.0-0`)).join(" ");
791
- }
792
- function wt(n) {
793
- return n.split(/\s+/).map((e) => e.trim().replace(ie(Rt), (r, o, i, c, a, l) => {
794
- const p = X(i), m = p || X(c), b = m || X(a);
795
- return o === "=" && b && (o = ""), l = "", p ? o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && b ? (m && (c = 0), a = 0, o === ">" ? (o = ">=", m ? (i = Number(i) + 1, c = 0, a = 0) : (c = Number(c) + 1, a = 0)) : o === "<=" && (o = "<", m ? i = Number(i) + 1 : c = Number(c) + 1), o === "<" && (l = "-0"), `${o + i}.${c}.${a}${l}`) : m ? `>=${i}.0.0${l} <${Number(i) + 1}.0.0-0` : b ? `>=${i}.${c}.0${l} <${i}.${Number(c) + 1}.0-0` : r;
796
- })).join(" ");
797
- }
798
- function jt(n) {
799
- return n.trim().replace(ie(yt), "");
800
- }
801
- function xt(n) {
802
- return n.trim().replace(ie(It), "");
803
- }
804
- function ve(n, e) {
805
- return n = Number(n) || n, e = Number(e) || e, n > e ? 1 : n === e ? 0 : -1;
806
- }
807
- function At(n, e) {
808
- const { preRelease: r } = n, { preRelease: o } = e;
809
- if (r === void 0 && o)
810
- return 1;
811
- if (r && o === void 0)
812
- return -1;
813
- if (r === void 0 && o === void 0)
814
- return 0;
815
- for (let i = 0, c = r.length; i <= c; i++) {
816
- const a = r[i], l = o[i];
817
- if (a !== l)
818
- return a === void 0 && l === void 0 ? 0 : a ? l ? ve(a, l) : -1 : 1;
819
- }
820
- return 0;
821
- }
822
- function Oe(n, e) {
823
- return ve(n.major, e.major) || ve(n.minor, e.minor) || ve(n.patch, e.patch) || At(n, e);
824
- }
825
- function je(n, e) {
826
- return n.version === e.version;
827
- }
828
- function Dt(n, e) {
829
- switch (n.operator) {
830
- case "":
831
- case "=":
832
- return je(n, e);
833
- case ">":
834
- return Oe(n, e) < 0;
835
- case ">=":
836
- return je(n, e) || Oe(n, e) < 0;
837
- case "<":
838
- return Oe(n, e) > 0;
839
- case "<=":
840
- return je(n, e) || Oe(n, e) > 0;
841
- case void 0:
842
- return !0;
843
- default:
844
- return !1;
845
- }
846
- }
847
- function Lt(n) {
848
- return et(
849
- // handle caret
850
- // ^ --> * (any, kinda silly)
851
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
852
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
853
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
854
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
855
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
856
- Mt,
857
- // handle tilde
858
- // ~, ~> --> * (any, kinda silly)
859
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
860
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
861
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
862
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
863
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
864
- Pt,
865
- wt,
866
- jt
867
- )(n);
868
- }
869
- function Ft(n) {
870
- return et(
871
- // handle hyphenRange
872
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
873
- $t,
874
- // handle trim comparator
875
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
876
- Tt,
877
- // handle trim tilde
878
- // `~ 1.2.3` => `~1.2.3`
879
- vt,
880
- // handle trim caret
881
- // `^ 1.2.3` => `^1.2.3`
882
- Ot
883
- )(n.trim()).split(/\s+/).join(" ");
884
- }
885
- function ge(n, e) {
886
- if (!n)
887
- return !1;
888
- const r = tt(n);
889
- if (!r)
890
- return !1;
891
- const [, o, , i, c, a, l] = r, p = {
892
- operator: o,
893
- version: nt(i, c, a, l),
894
- // exclude build atom
895
- major: i,
896
- minor: c,
897
- patch: a,
898
- preRelease: l?.split(".")
899
- }, m = e.split("||");
900
- for (const b of m) {
901
- const S = b.trim();
902
- if (!S || S === "*" || S === "x")
903
- return !0;
904
- try {
905
- const g = Ft(S);
906
- if (!g.trim())
907
- return !0;
908
- const v = g.split(" ").map((T) => Lt(T)).join(" ");
909
- if (!v.trim())
910
- return !0;
911
- const M = v.split(/\s+/).map((T) => xt(T)).filter(Boolean);
912
- if (M.length === 0)
913
- continue;
914
- let x = !0;
915
- for (const T of M) {
916
- const A = tt(T);
917
- if (!A) {
918
- x = !1;
919
- break;
920
- }
921
- const [, G, , L, q, Y, ue] = A, W = {
922
- operator: G,
923
- version: nt(L, q, Y, ue),
924
- major: L,
925
- minor: q,
926
- patch: Y,
927
- preRelease: ue?.split(".")
928
- };
929
- if (!Dt(W, p)) {
930
- x = !1;
931
- break;
932
- }
933
- }
934
- if (x)
935
- return !0;
936
- } catch (g) {
937
- console.error(`[semver] Error processing range part "${S}":`, g);
938
- continue;
939
- }
940
- }
941
- return !1;
942
- }
943
- function Ct(n, e, r, o) {
944
- let i;
945
- return "get" in n ? i = n.get : "lib" in n ? i = () => Promise.resolve(n.lib) : i = () => Promise.resolve(() => {
946
- throw new Error(`Can not get shared '${r}'!`);
947
- }), {
948
- deps: [],
949
- useIn: [],
950
- from: e,
951
- loading: null,
952
- ...n,
953
- shareConfig: {
954
- requiredVersion: `^${n.version}`,
955
- singleton: !1,
956
- eager: !1,
957
- strictVersion: !1,
958
- ...n.shareConfig
959
- },
960
- get: i,
961
- loaded: n?.loaded || "lib" in n ? !0 : void 0,
962
- version: n.version ?? "0",
963
- scope: Array.isArray(n.scope) ? n.scope : [n.scope ?? "default"],
964
- strategy: (n.strategy ?? o) || "version-first"
965
- };
966
- }
967
- function rt(n, e) {
968
- const r = e.shared || {}, o = e.name, i = Object.keys(r).reduce((a, l) => {
969
- const p = Q(r[l]);
970
- return a[l] = a[l] || [], p.forEach((m) => {
971
- a[l].push(Ct(m, o, l, e.shareStrategy));
972
- }), a;
973
- }, {}), c = {
974
- ...n.shared
975
- };
976
- return Object.keys(i).forEach((a) => {
977
- c[a] ? i[a].forEach((l) => {
978
- c[a].find((m) => m.version === l.version) || c[a].push(l);
979
- }) : c[a] = i[a];
980
- }), { shared: c, shareInfos: i };
981
- }
982
- function be(n, e) {
983
- const r = (o) => {
984
- if (!Number.isNaN(Number(o))) {
985
- const c = o.split(".");
986
- let a = o;
987
- for (let l = 0; l < 3 - c.length; l++)
988
- a += ".0";
989
- return a;
990
- }
991
- return o;
992
- };
993
- return !!ge(r(n), `<=${r(e)}`);
994
- }
995
- const xe = (n, e) => {
996
- const r = e || function(o, i) {
997
- return be(o, i);
998
- };
999
- return Object.keys(n).reduce((o, i) => !o || r(o, i) || o === "0" ? i : o, 0);
1000
- }, Ae = (n) => !!n.loaded || typeof n.lib == "function", kt = (n) => !!n.loading;
1001
- function Ht(n, e, r) {
1002
- const o = n[e][r], i = function(c, a) {
1003
- return !Ae(o[c]) && be(c, a);
1004
- };
1005
- return xe(n[e][r], i);
1006
- }
1007
- function Ut(n, e, r) {
1008
- const o = n[e][r], i = function(c, a) {
1009
- const l = (p) => Ae(p) || kt(p);
1010
- return l(o[a]) ? l(o[c]) ? !!be(c, a) : !0 : l(o[c]) ? !1 : be(c, a);
1011
- };
1012
- return xe(n[e][r], i);
1013
- }
1014
- function Gt(n) {
1015
- return n === "loaded-first" ? Ut : Ht;
1016
- }
1017
- function me(n, e, r, o) {
1018
- if (!n)
1019
- return;
1020
- const { shareConfig: i, scope: c = Ee, strategy: a } = r, l = Array.isArray(c) ? c : [c];
1021
- for (const p of l)
1022
- if (i && n[p] && n[p][e]) {
1023
- const { requiredVersion: m } = i, S = Gt(a)(n, p, e), g = () => {
1024
- if (i.singleton) {
1025
- if (typeof m == "string" && !ge(S, m)) {
1026
- const x = `Version ${S} from ${S && n[p][e][S].from} of shared singleton module ${e} does not satisfy the requirement of ${r.from} which needs ${m})`;
1027
- i.strictVersion ? E(x) : _(x);
1028
- }
1029
- return n[p][e][S];
1030
- } else {
1031
- if (m === !1 || m === "*" || ge(S, m))
1032
- return n[p][e][S];
1033
- for (const [x, T] of Object.entries(n[p][e]))
1034
- if (ge(x, m))
1035
- return T;
1036
- }
1037
- }, v = {
1038
- shareScopeMap: n,
1039
- scope: p,
1040
- pkgName: e,
1041
- version: S,
1042
- GlobalFederation: V.__FEDERATION__,
1043
- resolver: g
1044
- };
1045
- return (o.emit(v) || v).resolver();
1046
- }
1047
- }
1048
- function De() {
1049
- return V.__FEDERATION__.__SHARE__;
1050
- }
1051
- function ot(n) {
1052
- const { pkgName: e, extraOptions: r, shareInfos: o } = n, i = (a) => {
1053
- if (!a)
1054
- return;
1055
- const l = {};
1056
- a.forEach((b) => {
1057
- l[b.version] = b;
1058
- });
1059
- const m = xe(l, function(b, S) {
1060
- return !Ae(l[b]) && be(b, S);
1061
- });
1062
- return l[m];
1063
- }, c = r?.resolver ?? i;
1064
- return Object.assign({}, c(o[e]), r?.customShareInfo);
1065
- }
1066
- function Vt() {
1067
- return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? (
1068
- //@ts-ignore
1069
- FEDERATION_BUILD_IDENTIFIER
1070
- ) : "";
1071
- }
1072
- function Le(n, e) {
1073
- for (const r of n) {
1074
- const o = e.startsWith(r.name);
1075
- let i = e.replace(r.name, "");
1076
- if (o) {
1077
- if (i.startsWith("/")) {
1078
- const l = r.name;
1079
- return i = `.${i}`, {
1080
- pkgNameOrAlias: l,
1081
- expose: i,
1082
- remote: r
1083
- };
1084
- } else if (i === "")
1085
- return {
1086
- pkgNameOrAlias: r.name,
1087
- expose: ".",
1088
- remote: r
1089
- };
1090
- }
1091
- const c = r.alias && e.startsWith(r.alias);
1092
- let a = r.alias && e.replace(r.alias, "");
1093
- if (r.alias && c) {
1094
- if (a && a.startsWith("/")) {
1095
- const l = r.alias;
1096
- return a = `.${a}`, {
1097
- pkgNameOrAlias: l,
1098
- expose: a,
1099
- remote: r
1100
- };
1101
- } else if (a === "")
1102
- return {
1103
- pkgNameOrAlias: r.alias,
1104
- expose: ".",
1105
- remote: r
1106
- };
1107
- }
1108
- }
1109
- }
1110
- function Bt(n, e) {
1111
- for (const r of n)
1112
- if (e === r.name || r.alias && e === r.alias)
1113
- return r;
1114
- }
1115
- function qt(n, e) {
1116
- const r = Ve(), o = [
1117
- e.hooks,
1118
- e.remoteHandler.hooks,
1119
- e.sharedHandler.hooks,
1120
- e.snapshotHandler.hooks,
1121
- e.loaderHook,
1122
- e.bridgeHook
1123
- ];
1124
- return r.length > 0 && r.forEach((i) => {
1125
- n?.find((c) => c.name !== i.name) && n.push(i);
1126
- }), n && n.length > 0 && n.forEach((i) => {
1127
- o.forEach((c) => {
1128
- c.applyPlugin(i, e);
1129
- });
1130
- }), n;
1131
- }
1132
- const st = ".then(callbacks[0]).catch(callbacks[1])";
1133
- async function Wt({ entry: n, remoteEntryExports: e }) {
1134
- return new Promise((r, o) => {
1135
- try {
1136
- e ? r(e) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${n}")${st}`)([
1137
- r,
1138
- o
1139
- ]) : import(
1140
- /* webpackIgnore: true */
1141
- /* @vite-ignore */
1142
- n
1143
- ).then(r).catch(o);
1144
- } catch (i) {
1145
- o(i);
1146
- }
1147
- });
1148
- }
1149
- async function zt({ entry: n, remoteEntryExports: e }) {
1150
- return new Promise((r, o) => {
1151
- try {
1152
- e ? r(e) : typeof __system_context__ > "u" ? System.import(n).then(r).catch(o) : new Function("callbacks", `System.import("${n}")${st}`)([r, o]);
1153
- } catch (i) {
1154
- o(i);
1155
- }
1156
- });
1157
- }
1158
- function it(n, e, r) {
1159
- const { remoteEntryKey: o, entryExports: i } = $e(n, e);
1160
- return h(i, s.getShortErrorMsg(s.RUNTIME_001, s.runtimeDescMap, {
1161
- remoteName: n,
1162
- remoteEntryUrl: r,
1163
- remoteEntryKey: o
1164
- })), i;
1165
- }
1166
- async function Kt({ name: n, globalName: e, entry: r, loaderHook: o, getEntryUrl: i }) {
1167
- const { entryExports: c } = $e(n, e);
1168
- if (c)
1169
- return c;
1170
- const a = i ? i(r) : r;
1171
- return t.loadScript(a, {
1172
- attrs: {},
1173
- createScriptHook: (l, p) => {
1174
- const m = o.lifecycle.createScript.emit({ url: l, attrs: p });
1175
- if (m && (m instanceof HTMLScriptElement || "script" in m || "timeout" in m))
1176
- return m;
1177
- }
1178
- }).then(() => it(n, e, r)).catch((l) => {
1179
- throw h(void 0, s.getShortErrorMsg(s.RUNTIME_008, s.runtimeDescMap, {
1180
- remoteName: n,
1181
- resourceUrl: r
1182
- })), l;
1183
- });
1184
- }
1185
- async function Xt({ remoteInfo: n, remoteEntryExports: e, loaderHook: r, getEntryUrl: o }) {
1186
- const { entry: i, entryGlobalName: c, name: a, type: l } = n;
1187
- switch (l) {
1188
- case "esm":
1189
- case "module":
1190
- return Wt({ entry: i, remoteEntryExports: e });
1191
- case "system":
1192
- return zt({ entry: i, remoteEntryExports: e });
1193
- default:
1194
- return Kt({
1195
- entry: i,
1196
- globalName: c,
1197
- name: a,
1198
- loaderHook: r,
1199
- getEntryUrl: o
1200
- });
1201
- }
1202
- }
1203
- async function Yt({ remoteInfo: n, loaderHook: e }) {
1204
- const { entry: r, entryGlobalName: o, name: i, type: c } = n, { entryExports: a } = $e(i, o);
1205
- return a || t.loadScriptNode(r, {
1206
- attrs: { name: i, globalName: o, type: c },
1207
- loaderHook: {
1208
- createScriptHook: (l, p = {}) => {
1209
- const m = e.lifecycle.createScript.emit({ url: l, attrs: p });
1210
- if (m && "url" in m)
1211
- return m;
1212
- }
1213
- }
1214
- }).then(() => it(i, o, r)).catch((l) => {
1215
- throw l;
1216
- });
1217
- }
1218
- function Fe(n) {
1219
- const { entry: e, name: r } = n;
1220
- return t.composeKeyWithSeparator(r, e);
1221
- }
1222
- async function Se(n) {
1223
- const { origin: e, remoteEntryExports: r, remoteInfo: o, getEntryUrl: i, _inErrorHandling: c = !1 } = n, a = Fe(o);
1224
- if (r)
1225
- return r;
1226
- if (!ce[a]) {
1227
- const l = e.remoteHandler.hooks.lifecycle.loadEntry, p = e.loaderHook;
1228
- ce[a] = l.emit({
1229
- loaderHook: p,
1230
- remoteInfo: o,
1231
- remoteEntryExports: r
1232
- }).then((m) => m || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : t.isBrowserEnv()) ? Xt({
1233
- remoteInfo: o,
1234
- remoteEntryExports: r,
1235
- loaderHook: p,
1236
- getEntryUrl: i
1237
- }) : Yt({ remoteInfo: o, loaderHook: p }))).catch(async (m) => {
1238
- const b = Fe(o);
1239
- if (m instanceof Error && m.message.includes(s.RUNTIME_008) && !c) {
1240
- const g = (M) => Se({ ...M, _inErrorHandling: !0 }), v = await e.loaderHook.lifecycle.loadEntryError.emit({
1241
- getRemoteEntry: g,
1242
- origin: e,
1243
- remoteInfo: o,
1244
- remoteEntryExports: r,
1245
- globalLoading: ce,
1246
- uniqueKey: b
1247
- });
1248
- if (v)
1249
- return v;
1250
- }
1251
- throw m;
1252
- });
1253
- }
1254
- return ce[a];
1255
- }
1256
- function Re(n) {
1257
- return {
1258
- ...n,
1259
- entry: "entry" in n ? n.entry : "",
1260
- type: n.type || We,
1261
- entryGlobalName: n.entryGlobalName || n.name,
1262
- shareScope: n.shareScope || Ee
1263
- };
1264
- }
1265
- function at(n) {
1266
- return {
1267
- resourceCategory: "sync",
1268
- share: !0,
1269
- depsRemote: !0,
1270
- prefetchInterface: !1,
1271
- ...n
1272
- };
1273
- }
1274
- function Jt(n, e) {
1275
- return e.map((r) => {
1276
- const o = Bt(n, r.nameOrAlias);
1277
- return h(o, `Unable to preload ${r.nameOrAlias} as it is not included in ${!o && t.safeToString({
1278
- remoteInfo: o,
1279
- remotes: n
1280
- })}`), {
1281
- remote: o,
1282
- preloadConfig: at(r)
1283
- };
1284
- });
1285
- }
1286
- function Zt(n) {
1287
- return n ? n.map((e) => e === "." ? e : e.startsWith("./") ? e.replace("./", "") : e) : [];
1288
- }
1289
- function Ce(n, e, r, o = !0) {
1290
- const { cssAssets: i, jsAssetsWithoutEntry: c, entryAssets: a } = r;
1291
- if (e.options.inBrowser) {
1292
- if (a.forEach((l) => {
1293
- const { moduleInfo: p } = l, m = e.moduleCache.get(n.name);
1294
- Se(m ? {
1295
- origin: e,
1296
- remoteInfo: p,
1297
- remoteEntryExports: m.remoteEntryExports
1298
- } : {
1299
- origin: e,
1300
- remoteInfo: p,
1301
- remoteEntryExports: void 0
1302
- });
1303
- }), o) {
1304
- const l = {
1305
- rel: "preload",
1306
- as: "style"
1307
- };
1308
- i.forEach((p) => {
1309
- const { link: m, needAttach: b } = t.createLink({
1310
- url: p,
1311
- cb: () => {
1312
- },
1313
- attrs: l,
1314
- createLinkHook: (S, g) => {
1315
- const v = e.loaderHook.lifecycle.createLink.emit({
1316
- url: S,
1317
- attrs: g
1318
- });
1319
- if (v instanceof HTMLLinkElement)
1320
- return v;
1321
- }
1322
- });
1323
- b && document.head.appendChild(m);
1324
- });
1325
- } else {
1326
- const l = {
1327
- rel: "stylesheet",
1328
- type: "text/css"
1329
- };
1330
- i.forEach((p) => {
1331
- const { link: m, needAttach: b } = t.createLink({
1332
- url: p,
1333
- cb: () => {
1334
- },
1335
- attrs: l,
1336
- createLinkHook: (S, g) => {
1337
- const v = e.loaderHook.lifecycle.createLink.emit({
1338
- url: S,
1339
- attrs: g
1340
- });
1341
- if (v instanceof HTMLLinkElement)
1342
- return v;
1343
- },
1344
- needDeleteLink: !1
1345
- });
1346
- b && document.head.appendChild(m);
1347
- });
1348
- }
1349
- if (o) {
1350
- const l = {
1351
- rel: "preload",
1352
- as: "script"
1353
- };
1354
- c.forEach((p) => {
1355
- const { link: m, needAttach: b } = t.createLink({
1356
- url: p,
1357
- cb: () => {
1358
- },
1359
- attrs: l,
1360
- createLinkHook: (S, g) => {
1361
- const v = e.loaderHook.lifecycle.createLink.emit({
1362
- url: S,
1363
- attrs: g
1364
- });
1365
- if (v instanceof HTMLLinkElement)
1366
- return v;
1367
- }
1368
- });
1369
- b && document.head.appendChild(m);
1370
- });
1371
- } else {
1372
- const l = {
1373
- fetchpriority: "high",
1374
- type: n?.type === "module" ? "module" : "text/javascript"
1375
- };
1376
- c.forEach((p) => {
1377
- const { script: m, needAttach: b } = t.createScript({
1378
- url: p,
1379
- cb: () => {
1380
- },
1381
- attrs: l,
1382
- createScriptHook: (S, g) => {
1383
- const v = e.loaderHook.lifecycle.createScript.emit({
1384
- url: S,
1385
- attrs: g
1386
- });
1387
- if (v instanceof HTMLScriptElement)
1388
- return v;
1389
- },
1390
- needDeleteScript: !0
1391
- });
1392
- b && document.head.appendChild(m);
1393
- });
1394
- }
1395
- }
1396
- }
1397
- var Qt = {
1398
- global: {
1399
- Global: V,
1400
- nativeGlobal: F,
1401
- resetFederationGlobalInfo: I,
1402
- setGlobalFederationInstance: N,
1403
- getGlobalFederationConstructor: C,
1404
- setGlobalFederationConstructor: K,
1405
- getInfoWithoutType: Z,
1406
- getGlobalSnapshot: fe,
1407
- getTargetSnapshotInfoByModuleInfo: Ie,
1408
- getGlobalSnapshotInfoByModuleInfo: he,
1409
- setGlobalSnapshotInfoByModuleInfo: le,
1410
- addGlobalSnapshot: z,
1411
- getRemoteEntryExports: $e,
1412
- registerGlobalPlugins: Ge,
1413
- getGlobalHostPlugins: Ve,
1414
- getPreloaded: Be,
1415
- setPreloaded: qe
1416
- },
1417
- share: {
1418
- getRegisteredShare: me,
1419
- getGlobalShareScope: De
1420
- },
1421
- utils: {
1422
- matchRemoteWithNameAndExpose: Le,
1423
- preloadAssets: Ce,
1424
- getRemoteInfo: Re
1425
- }
1426
- };
1427
- class ke {
1428
- constructor({ remoteInfo: e, host: r }) {
1429
- this.inited = !1, this.lib = void 0, this.remoteInfo = e, this.host = r;
1430
- }
1431
- async getEntry() {
1432
- if (this.remoteEntryExports)
1433
- return this.remoteEntryExports;
1434
- let e;
1435
- return e = await Se({
1436
- origin: this.host,
1437
- remoteInfo: this.remoteInfo,
1438
- remoteEntryExports: this.remoteEntryExports
1439
- }), h(e, `remoteEntryExports is undefined
1440
- ${t.safeToString(this.remoteInfo)}`), this.remoteEntryExports = e, this.remoteEntryExports;
1441
- }
1442
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1443
- async get(e, r, o, i) {
1444
- const { loadFactory: c = !0 } = o || { loadFactory: !0 }, a = await this.getEntry();
1445
- if (!this.inited) {
1446
- const S = this.host.shareScopeMap, g = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [this.remoteInfo.shareScope];
1447
- g.length || g.push("default"), g.forEach((A) => {
1448
- S[A] || (S[A] = {});
1449
- });
1450
- const v = S[g[0]], M = [], x = {
1451
- version: this.remoteInfo.version || "",
1452
- shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? g : this.remoteInfo.shareScope || "default"
1453
- };
1454
- Object.defineProperty(x, "shareScopeMap", {
1455
- value: S,
1456
- // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
1457
- enumerable: !1
1458
- });
1459
- const T = await this.host.hooks.lifecycle.beforeInitContainer.emit({
1460
- shareScope: v,
1461
- // @ts-ignore shareScopeMap will be set by Object.defineProperty
1462
- remoteEntryInitOptions: x,
1463
- initScope: M,
1464
- remoteInfo: this.remoteInfo,
1465
- origin: this.host
1466
- });
1467
- typeof a?.init > "u" && E(s.getShortErrorMsg(s.RUNTIME_002, s.runtimeDescMap, {
1468
- hostName: this.host.name,
1469
- remoteName: this.remoteInfo.name,
1470
- remoteEntryUrl: this.remoteInfo.entry,
1471
- remoteEntryKey: this.remoteInfo.entryGlobalName
1472
- })), await a.init(T.shareScope, T.initScope, T.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit({
1473
- ...T,
1474
- id: e,
1475
- remoteSnapshot: i,
1476
- remoteEntryExports: a
1477
- });
1478
- }
1479
- this.lib = a, this.inited = !0;
1480
- let l;
1481
- l = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
1482
- remoteEntryExports: a,
1483
- expose: r,
1484
- moduleInfo: this.remoteInfo
1485
- }), l || (l = await a.get(r)), h(l, `${R(this.remoteInfo)} remote don't export ${r}.`);
1486
- const p = D(this.remoteInfo.name, r), m = this.wraperFactory(l, p);
1487
- return c ? await m() : m;
1488
- }
1489
- wraperFactory(e, r) {
1490
- function o(i, c) {
1491
- i && typeof i == "object" && Object.isExtensible(i) && !Object.getOwnPropertyDescriptor(i, Symbol.for("mf_module_id")) && Object.defineProperty(i, Symbol.for("mf_module_id"), {
1492
- value: c,
1493
- enumerable: !1
1494
- });
1495
- }
1496
- return e instanceof Promise ? async () => {
1497
- const i = await e();
1498
- return o(i, r), i;
1499
- } : () => {
1500
- const i = e();
1501
- return o(i, r), i;
1502
- };
1503
- }
1504
- }
1505
- class te {
1506
- constructor(e) {
1507
- this.type = "", this.listeners = /* @__PURE__ */ new Set(), e && (this.type = e);
1508
- }
1509
- on(e) {
1510
- typeof e == "function" && this.listeners.add(e);
1511
- }
1512
- once(e) {
1513
- const r = this;
1514
- this.on(function o(...i) {
1515
- return r.remove(o), e.apply(null, i);
1516
- });
1517
- }
1518
- emit(...e) {
1519
- let r;
1520
- return this.listeners.size > 0 && this.listeners.forEach((o) => {
1521
- r = o(...e);
1522
- }), r;
1523
- }
1524
- remove(e) {
1525
- this.listeners.delete(e);
1526
- }
1527
- removeAll() {
1528
- this.listeners.clear();
1529
- }
1530
- }
1531
- class oe extends te {
1532
- emit(...e) {
1533
- let r;
1534
- const o = Array.from(this.listeners);
1535
- if (o.length > 0) {
1536
- let i = 0;
1537
- const c = (a) => a === !1 ? !1 : i < o.length ? Promise.resolve(o[i++].apply(null, e)).then(c) : a;
1538
- r = c();
1539
- }
1540
- return Promise.resolve(r);
1541
- }
1542
- }
1543
- function ct(n, e) {
1544
- if (!H(e))
1545
- return !1;
1546
- if (n !== e) {
1547
- for (const r in n)
1548
- if (!(r in e))
1549
- return !1;
1550
- }
1551
- return !0;
1552
- }
1553
- class Ne extends te {
1554
- constructor(e) {
1555
- super(), this.onerror = E, this.type = e;
1556
- }
1557
- emit(e) {
1558
- H(e) || E(`The data for the "${this.type}" hook should be an object.`);
1559
- for (const r of this.listeners)
1560
- try {
1561
- const o = r(e);
1562
- if (ct(e, o))
1563
- e = o;
1564
- else {
1565
- this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
1566
- break;
1567
- }
1568
- } catch (o) {
1569
- _(o), this.onerror(o);
1570
- }
1571
- return e;
1572
- }
1573
- }
1574
- class de extends te {
1575
- constructor(e) {
1576
- super(), this.onerror = E, this.type = e;
1577
- }
1578
- emit(e) {
1579
- H(e) || E(`The response data for the "${this.type}" hook must be an object.`);
1580
- const r = Array.from(this.listeners);
1581
- if (r.length > 0) {
1582
- let o = 0;
1583
- const i = (a) => (_(a), this.onerror(a), e), c = (a) => {
1584
- if (ct(e, a)) {
1585
- if (e = a, o < r.length)
1586
- try {
1587
- return Promise.resolve(r[o++](e)).then(c, i);
1588
- } catch (l) {
1589
- return i(l);
1590
- }
1591
- } else
1592
- this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
1593
- return e;
1594
- };
1595
- return Promise.resolve(c(e));
1596
- }
1597
- return Promise.resolve(e);
1598
- }
1599
- }
1600
- class _e {
1601
- constructor(e) {
1602
- this.registerPlugins = {}, this.lifecycle = e, this.lifecycleKeys = Object.keys(e);
1603
- }
1604
- applyPlugin(e, r) {
1605
- h(j(e), "Plugin configuration is invalid.");
1606
- const o = e.name;
1607
- h(o, "A name must be provided by the plugin."), this.registerPlugins[o] || (this.registerPlugins[o] = e, e.apply?.(r), Object.keys(this.lifecycle).forEach((i) => {
1608
- const c = e[i];
1609
- c && this.lifecycle[i].on(c);
1610
- }));
1611
- }
1612
- removePlugin(e) {
1613
- h(e, "A name is required.");
1614
- const r = this.registerPlugins[e];
1615
- h(r, `The plugin "${e}" is not registered.`), Object.keys(r).forEach((o) => {
1616
- o !== "name" && this.lifecycle[o].remove(r[o]);
1617
- });
1618
- }
1619
- }
1620
- function lt(n, e) {
1621
- const r = J(e);
1622
- r.url || E(`The attribute remoteEntry of ${n.name} must not be undefined.`);
1623
- let o = t.getResourceUrl(e, r.url);
1624
- !t.isBrowserEnv() && !o.startsWith("http") && (o = `https:${o}`), n.type = r.type, n.entryGlobalName = r.globalName, n.entry = o, n.version = e.version, n.buildVersion = e.buildVersion;
1625
- }
1626
- function en() {
1627
- return {
1628
- name: "snapshot-plugin",
1629
- async afterResolve(n) {
1630
- const { remote: e, pkgNameOrAlias: r, expose: o, origin: i, remoteInfo: c, id: a } = n;
1631
- if (!$(e) || !w(e)) {
1632
- const { remoteSnapshot: l, globalSnapshot: p } = await i.snapshotHandler.loadRemoteSnapshotInfo({
1633
- moduleInfo: e,
1634
- id: a
1635
- });
1636
- lt(c, l);
1637
- const m = {
1638
- remote: e,
1639
- preloadConfig: {
1640
- nameOrAlias: r,
1641
- exposes: [o],
1642
- resourceCategory: "sync",
1643
- share: !1,
1644
- depsRemote: !1
1645
- }
1646
- }, b = await i.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
1647
- origin: i,
1648
- preloadOptions: m,
1649
- remoteInfo: c,
1650
- remote: e,
1651
- remoteSnapshot: l,
1652
- globalSnapshot: p
1653
- });
1654
- return b && Ce(c, i, b, !1), {
1655
- ...n,
1656
- remoteSnapshot: l
1657
- };
1658
- }
1659
- return n;
1660
- }
1661
- };
1662
- }
1663
- function tn(n) {
1664
- const e = n.split(":");
1665
- return e.length === 1 ? {
1666
- name: e[0],
1667
- version: void 0
1668
- } : e.length === 2 ? {
1669
- name: e[0],
1670
- version: e[1]
1671
- } : {
1672
- name: e[1],
1673
- version: e[2]
1674
- };
1675
- }
1676
- function ut(n, e, r, o, i = {}, c) {
1677
- const a = R(e), { value: l } = Z(n, a), p = c || l;
1678
- if (p && !t.isManifestProvider(p) && (r(p, e, o), p.remotesInfo)) {
1679
- const m = Object.keys(p.remotesInfo);
1680
- for (const b of m) {
1681
- if (i[b])
1682
- continue;
1683
- i[b] = !0;
1684
- const S = tn(b), g = p.remotesInfo[b];
1685
- ut(n, {
1686
- name: S.name,
1687
- version: g.matchedVersion
1688
- }, r, !1, i, void 0);
1689
- }
1690
- }
1691
- }
1692
- const He = (n, e) => document.querySelector(`${n}[${n === "link" ? "href" : "src"}="${e}"]`);
1693
- function nn(n, e, r, o, i) {
1694
- const c = [], a = [], l = [], p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), { options: b } = n, { preloadConfig: S } = e, { depsRemote: g } = S;
1695
- if (ut(o, r, (T, A, G) => {
1696
- let L;
1697
- if (G)
1698
- L = S;
1699
- else if (Array.isArray(g)) {
1700
- const se = g.find((ne) => ne.nameOrAlias === A.name || ne.nameOrAlias === A.alias);
1701
- if (!se)
1702
- return;
1703
- L = at(se);
1704
- } else if (g === !0)
1705
- L = S;
1706
- else
1707
- return;
1708
- const q = t.getResourceUrl(T, J(T).url);
1709
- q && l.push({
1710
- name: A.name,
1711
- moduleInfo: {
1712
- name: A.name,
1713
- entry: q,
1714
- type: "remoteEntryType" in T ? T.remoteEntryType : "global",
1715
- entryGlobalName: "globalName" in T ? T.globalName : A.name,
1716
- shareScope: "",
1717
- version: "version" in T ? T.version : void 0
1718
- },
1719
- url: q
1720
- });
1721
- let Y = "modules" in T ? T.modules : [];
1722
- const ue = Zt(L.exposes);
1723
- ue.length && "modules" in T && (Y = T?.modules?.reduce((se, ne) => (ue?.indexOf(ne.moduleName) !== -1 && se.push(ne), se), []));
1724
- function W(se) {
1725
- const ne = se.map((ae) => t.getResourceUrl(T, ae));
1726
- return L.filter ? ne.filter(L.filter) : ne;
1727
- }
1728
- if (Y) {
1729
- const se = Y.length;
1730
- for (let ne = 0; ne < se; ne++) {
1731
- const ae = Y[ne], Ue = `${A.name}/${ae.moduleName}`;
1732
- n.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
1733
- id: ae.moduleName === "." ? A.name : Ue,
1734
- name: A.name,
1735
- remoteSnapshot: T,
1736
- preloadConfig: L,
1737
- remote: A,
1738
- origin: n
1739
- }), !Be(Ue) && (L.resourceCategory === "all" ? (c.push(...W(ae.assets.css.async)), c.push(...W(ae.assets.css.sync)), a.push(...W(ae.assets.js.async)), a.push(...W(ae.assets.js.sync))) : (L.resourceCategory = "sync") && (c.push(...W(ae.assets.css.sync)), a.push(...W(ae.assets.js.sync))), qe(Ue));
1740
- }
1741
- }
1742
- }, !0, {}, i), i.shared && i.shared.length > 0) {
1743
- const T = (A, G) => {
1744
- const L = me(n.shareScopeMap, G.sharedName, A, n.sharedHandler.hooks.lifecycle.resolveShare);
1745
- L && typeof L.lib == "function" && (G.assets.js.sync.forEach((q) => {
1746
- p.add(q);
1747
- }), G.assets.css.sync.forEach((q) => {
1748
- m.add(q);
1749
- }));
1750
- };
1751
- i.shared.forEach((A) => {
1752
- const G = b.shared?.[A.sharedName];
1753
- if (!G)
1754
- return;
1755
- const L = A.version ? G.find((Y) => Y.version === A.version) : G;
1756
- if (!L)
1757
- return;
1758
- Q(L).forEach((Y) => {
1759
- T(Y, A);
1760
- });
1761
- });
1762
- }
1763
- const M = a.filter((T) => !p.has(T) && !He("script", T));
1764
- return {
1765
- cssAssets: c.filter((T) => !m.has(T) && !He("link", T)),
1766
- jsAssetsWithoutEntry: M,
1767
- entryAssets: l.filter((T) => !He("script", T.url))
1768
- };
1769
- }
1770
- const rn = function() {
1771
- return {
1772
- name: "generate-preload-assets-plugin",
1773
- async generatePreloadAssets(n) {
1774
- const { origin: e, preloadOptions: r, remoteInfo: o, remote: i, globalSnapshot: c, remoteSnapshot: a } = n;
1775
- return t.isBrowserEnv() ? $(i) && w(i) ? {
1776
- cssAssets: [],
1777
- jsAssetsWithoutEntry: [],
1778
- entryAssets: [
1779
- {
1780
- name: i.name,
1781
- url: i.entry,
1782
- moduleInfo: {
1783
- name: o.name,
1784
- entry: i.entry,
1785
- type: o.type || "global",
1786
- entryGlobalName: "",
1787
- shareScope: ""
1788
- }
1789
- }
1790
- ]
1791
- } : (lt(o, a), nn(e, r, o, c, a)) : {
1792
- cssAssets: [],
1793
- jsAssetsWithoutEntry: [],
1794
- entryAssets: []
1795
- };
1796
- }
1797
- };
1798
- };
1799
- function ft(n, e) {
1800
- const r = he({
1801
- name: e.name,
1802
- version: e.options.version
1803
- }), o = r && "remotesInfo" in r && r.remotesInfo && Z(r.remotesInfo, n.name).value;
1804
- return o && o.matchedVersion ? {
1805
- hostGlobalSnapshot: r,
1806
- globalSnapshot: fe(),
1807
- remoteSnapshot: he({
1808
- name: n.name,
1809
- version: o.matchedVersion
1810
- })
1811
- } : {
1812
- hostGlobalSnapshot: void 0,
1813
- globalSnapshot: fe(),
1814
- remoteSnapshot: he({
1815
- name: n.name,
1816
- version: "version" in n ? n.version : void 0
1817
- })
1818
- };
1819
- }
1820
- class on {
1821
- constructor(e) {
1822
- this.loadingHostSnapshot = null, this.manifestCache = /* @__PURE__ */ new Map(), this.hooks = new _e({
1823
- beforeLoadRemoteSnapshot: new oe("beforeLoadRemoteSnapshot"),
1824
- loadSnapshot: new de("loadGlobalSnapshot"),
1825
- loadRemoteSnapshot: new de("loadRemoteSnapshot"),
1826
- afterLoadSnapshot: new de("afterLoadSnapshot")
1827
- }), this.manifestLoading = V.__FEDERATION__.__MANIFEST_LOADING__, this.HostInstance = e, this.loaderHook = e.loaderHook;
1828
- }
1829
- // eslint-disable-next-line max-lines-per-function
1830
- async loadRemoteSnapshotInfo({ moduleInfo: e, id: r, expose: o }) {
1831
- const { options: i } = this.HostInstance;
1832
- await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
1833
- options: i,
1834
- moduleInfo: e
1835
- });
1836
- let c = he({
1837
- name: this.HostInstance.options.name,
1838
- version: this.HostInstance.options.version
1839
- });
1840
- c || (c = {
1841
- version: this.HostInstance.options.version || "",
1842
- remoteEntry: "",
1843
- remotesInfo: {}
1844
- }, z({
1845
- [this.HostInstance.options.name]: c
1846
- })), c && "remotesInfo" in c && !Z(c.remotesInfo, e.name).value && ("version" in e || "entry" in e) && (c.remotesInfo = {
1847
- ...c?.remotesInfo,
1848
- [e.name]: {
1849
- matchedVersion: "version" in e ? e.version : e.entry
1850
- }
1851
- });
1852
- const { hostGlobalSnapshot: a, remoteSnapshot: l, globalSnapshot: p } = this.getGlobalRemoteInfo(e), { remoteSnapshot: m, globalSnapshot: b } = await this.hooks.lifecycle.loadSnapshot.emit({
1853
- options: i,
1854
- moduleInfo: e,
1855
- hostGlobalSnapshot: a,
1856
- remoteSnapshot: l,
1857
- globalSnapshot: p
1858
- });
1859
- let S, g;
1860
- if (m)
1861
- if (t.isManifestProvider(m)) {
1862
- const v = t.isBrowserEnv() ? m.remoteEntry : m.ssrRemoteEntry || m.remoteEntry || "", M = await this.getManifestJson(v, e, {}), x = le({
1863
- ...e,
1864
- // The global remote may be overridden
1865
- // Therefore, set the snapshot key to the global address of the actual request
1866
- entry: v
1867
- }, M);
1868
- S = M, g = x;
1869
- } else {
1870
- const { remoteSnapshot: v } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1871
- options: this.HostInstance.options,
1872
- moduleInfo: e,
1873
- remoteSnapshot: m,
1874
- from: "global"
1875
- });
1876
- S = v, g = b;
1877
- }
1878
- else if ($(e)) {
1879
- const v = await this.getManifestJson(e.entry, e, {}), M = le(e, v), { remoteSnapshot: x } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1880
- options: this.HostInstance.options,
1881
- moduleInfo: e,
1882
- remoteSnapshot: v,
1883
- from: "global"
1884
- });
1885
- S = x, g = M;
1886
- } else
1887
- E(s.getShortErrorMsg(s.RUNTIME_007, s.runtimeDescMap, {
1888
- hostName: e.name,
1889
- hostVersion: e.version,
1890
- globalSnapshot: JSON.stringify(b)
1891
- }));
1892
- return await this.hooks.lifecycle.afterLoadSnapshot.emit({
1893
- id: r,
1894
- host: this.HostInstance,
1895
- options: i,
1896
- moduleInfo: e,
1897
- remoteSnapshot: S
1898
- }), {
1899
- remoteSnapshot: S,
1900
- globalSnapshot: g
1901
- };
1902
- }
1903
- getGlobalRemoteInfo(e) {
1904
- return ft(e, this.HostInstance);
1905
- }
1906
- async getManifestJson(e, r, o) {
1907
- const i = async () => {
1908
- let a = this.manifestCache.get(e);
1909
- if (a)
1910
- return a;
1911
- try {
1912
- let l = await this.loaderHook.lifecycle.fetch.emit(e, {});
1913
- (!l || !(l instanceof Response)) && (l = await fetch(e, {})), a = await l.json();
1914
- } catch (l) {
1915
- a = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1916
- id: e,
1917
- error: l,
1918
- from: "runtime",
1919
- lifecycle: "afterResolve",
1920
- origin: this.HostInstance
1921
- }), a || (delete this.manifestLoading[e], E(s.getShortErrorMsg(s.RUNTIME_003, s.runtimeDescMap, {
1922
- manifestUrl: e,
1923
- moduleName: r.name,
1924
- hostName: this.HostInstance.options.name
1925
- }, `${l}`)));
1926
- }
1927
- return h(a.metaData && a.exposes && a.shared, `${e} is not a federation manifest`), this.manifestCache.set(e, a), a;
1928
- }, c = async () => {
1929
- const a = await i(), l = t.generateSnapshotFromManifest(a, {
1930
- version: e
1931
- }), { remoteSnapshot: p } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1932
- options: this.HostInstance.options,
1933
- moduleInfo: r,
1934
- manifestJson: a,
1935
- remoteSnapshot: l,
1936
- manifestUrl: e,
1937
- from: "manifest"
1938
- });
1939
- return p;
1940
- };
1941
- return this.manifestLoading[e] || (this.manifestLoading[e] = c().then((a) => a)), this.manifestLoading[e];
1942
- }
1943
- }
1944
- class sn {
1945
- constructor(e) {
1946
- this.hooks = new _e({
1947
- afterResolve: new de("afterResolve"),
1948
- beforeLoadShare: new de("beforeLoadShare"),
1949
- // not used yet
1950
- loadShare: new oe(),
1951
- resolveShare: new Ne("resolveShare"),
1952
- // maybe will change, temporarily for internal use only
1953
- initContainerShareScopeMap: new Ne("initContainerShareScopeMap")
1954
- }), this.host = e, this.shareScopeMap = {}, this.initTokens = {}, this._setGlobalShareScopeMap(e.options);
1955
- }
1956
- // register shared in shareScopeMap
1957
- registerShared(e, r) {
1958
- const { shareInfos: o, shared: i } = rt(e, r);
1959
- return Object.keys(o).forEach((a) => {
1960
- o[a].forEach((p) => {
1961
- p.scope.forEach((m) => {
1962
- this.shareScopeMap[m]?.[a] || this.setShared({
1963
- pkgName: a,
1964
- lib: p.lib,
1965
- get: p.get,
1966
- loaded: p.loaded || !!p.lib,
1967
- shared: p,
1968
- from: r.name
1969
- });
1970
- });
1971
- });
1972
- }), {
1973
- shareInfos: o,
1974
- shared: i
1975
- };
1976
- }
1977
- async loadShare(e, r) {
1978
- const { host: o } = this, i = ot({
1979
- pkgName: e,
1980
- extraOptions: r,
1981
- shareInfos: o.options.shared
1982
- });
1983
- i?.scope && await Promise.all(i.scope.map(async (m) => {
1984
- await Promise.all(this.initializeSharing(m, {
1985
- strategy: i.strategy
1986
- }));
1987
- }));
1988
- const c = await this.hooks.lifecycle.beforeLoadShare.emit({
1989
- pkgName: e,
1990
- shareInfo: i,
1991
- shared: o.options.shared,
1992
- origin: o
1993
- }), { shareInfo: a } = c;
1994
- h(a, `Cannot find ${e} Share in the ${o.options.name}. Please ensure that the ${e} Share parameters have been injected`);
1995
- const l = me(this.shareScopeMap, e, a, this.hooks.lifecycle.resolveShare), p = (m) => {
1996
- m.useIn || (m.useIn = []), y(m.useIn, o.options.name);
1997
- };
1998
- if (l && l.lib)
1999
- return p(l), l.lib;
2000
- if (l && l.loading && !l.loaded) {
2001
- const m = await l.loading;
2002
- return l.loaded = !0, l.lib || (l.lib = m), p(l), m;
2003
- } else if (l) {
2004
- const b = (async () => {
2005
- const S = await l.get();
2006
- return p(l), l.loaded = !0, l.lib = S, S;
2007
- })();
2008
- return this.setShared({
2009
- pkgName: e,
2010
- loaded: !1,
2011
- shared: l,
2012
- from: o.options.name,
2013
- lib: null,
2014
- loading: b
2015
- }), b;
2016
- } else {
2017
- if (r?.customShareInfo)
2018
- return !1;
2019
- const b = (async () => {
2020
- const S = await a.get();
2021
- a.lib = S, a.loaded = !0, p(a);
2022
- const g = me(this.shareScopeMap, e, a, this.hooks.lifecycle.resolveShare);
2023
- return g && (g.lib = S, g.loaded = !0, g.from = a.from), S;
2024
- })();
2025
- return this.setShared({
2026
- pkgName: e,
2027
- loaded: !1,
2028
- shared: a,
2029
- from: o.options.name,
2030
- lib: null,
2031
- loading: b
2032
- }), b;
2033
- }
2034
- }
2035
- /**
2036
- * This function initializes the sharing sequence (executed only once per share scope).
2037
- * It accepts one argument, the name of the share scope.
2038
- * If the share scope does not exist, it creates one.
2039
- */
2040
- // eslint-disable-next-line @typescript-eslint/member-ordering
2041
- initializeSharing(e = Ee, r) {
2042
- const { host: o } = this, i = r?.from, c = r?.strategy;
2043
- let a = r?.initScope;
2044
- const l = [];
2045
- if (i !== "build") {
2046
- const { initTokens: M } = this;
2047
- a || (a = []);
2048
- let x = M[e];
2049
- if (x || (x = M[e] = { from: this.host.name }), a.indexOf(x) >= 0)
2050
- return l;
2051
- a.push(x);
2052
- }
2053
- const p = this.shareScopeMap, m = o.options.name;
2054
- p[e] || (p[e] = {});
2055
- const b = p[e], S = (M, x) => {
2056
- const { version: T, eager: A } = x;
2057
- b[M] = b[M] || {};
2058
- const G = b[M], L = G[T], q = !!(L && (L.eager || L.shareConfig?.eager));
2059
- (!L || L.strategy !== "loaded-first" && !L.loaded && (!A != !q ? A : m > L.from)) && (G[T] = x);
2060
- }, g = (M) => M && M.init && M.init(p[e], a), v = async (M) => {
2061
- const { module: x } = await o.remoteHandler.getRemoteModuleAndOptions({
2062
- id: M
2063
- });
2064
- if (x.getEntry) {
2065
- let T;
2066
- try {
2067
- T = await x.getEntry();
2068
- } catch (A) {
2069
- T = await o.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
2070
- id: M,
2071
- error: A,
2072
- from: "runtime",
2073
- lifecycle: "beforeLoadShare",
2074
- origin: o
2075
- });
2076
- }
2077
- x.inited || (await g(T), x.inited = !0);
2078
- }
2079
- };
2080
- return Object.keys(o.options.shared).forEach((M) => {
2081
- o.options.shared[M].forEach((T) => {
2082
- T.scope.includes(e) && S(M, T);
2083
- });
2084
- }), (o.options.shareStrategy === "version-first" || c === "version-first") && o.options.remotes.forEach((M) => {
2085
- M.shareScope === e && l.push(v(M.name));
2086
- }), l;
2087
- }
2088
- // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
2089
- // 1. If the loaded shared already exists globally, then it will be reused
2090
- // 2. If lib exists in local shared, it will be used directly
2091
- // 3. If the local get returns something other than Promise, then it will be used directly
2092
- loadShareSync(e, r) {
2093
- const { host: o } = this, i = ot({
2094
- pkgName: e,
2095
- extraOptions: r,
2096
- shareInfos: o.options.shared
2097
- });
2098
- i?.scope && i.scope.forEach((l) => {
2099
- this.initializeSharing(l, { strategy: i.strategy });
2100
- });
2101
- const c = me(this.shareScopeMap, e, i, this.hooks.lifecycle.resolveShare), a = (l) => {
2102
- l.useIn || (l.useIn = []), y(l.useIn, o.options.name);
2103
- };
2104
- if (c) {
2105
- if (typeof c.lib == "function")
2106
- return a(c), c.loaded || (c.loaded = !0, c.from === o.options.name && (i.loaded = !0)), c.lib;
2107
- if (typeof c.get == "function") {
2108
- const l = c.get();
2109
- if (!(l instanceof Promise))
2110
- return a(c), this.setShared({
2111
- pkgName: e,
2112
- loaded: !0,
2113
- from: o.options.name,
2114
- lib: l,
2115
- shared: c
2116
- }), l;
2117
- }
2118
- }
2119
- if (i.lib)
2120
- return i.loaded || (i.loaded = !0), i.lib;
2121
- if (i.get) {
2122
- const l = i.get();
2123
- if (l instanceof Promise) {
2124
- const p = r?.from === "build" ? s.RUNTIME_005 : s.RUNTIME_006;
2125
- throw new Error(s.getShortErrorMsg(p, s.runtimeDescMap, {
2126
- hostName: o.options.name,
2127
- sharedPkgName: e
2128
- }));
2129
- }
2130
- return i.lib = l, this.setShared({
2131
- pkgName: e,
2132
- loaded: !0,
2133
- from: o.options.name,
2134
- lib: i.lib,
2135
- shared: i
2136
- }), i.lib;
2137
- }
2138
- throw new Error(s.getShortErrorMsg(s.RUNTIME_006, s.runtimeDescMap, {
2139
- hostName: o.options.name,
2140
- sharedPkgName: e
2141
- }));
2142
- }
2143
- initShareScopeMap(e, r, o = {}) {
2144
- const { host: i } = this;
2145
- this.shareScopeMap[e] = r, this.hooks.lifecycle.initContainerShareScopeMap.emit({
2146
- shareScope: r,
2147
- options: i.options,
2148
- origin: i,
2149
- scopeName: e,
2150
- hostShareScopeMap: o.hostShareScopeMap
2151
- });
2152
- }
2153
- setShared({ pkgName: e, shared: r, from: o, lib: i, loading: c, loaded: a, get: l }) {
2154
- const { version: p, scope: m = "default", ...b } = r;
2155
- (Array.isArray(m) ? m : [m]).forEach((g) => {
2156
- if (this.shareScopeMap[g] || (this.shareScopeMap[g] = {}), this.shareScopeMap[g][e] || (this.shareScopeMap[g][e] = {}), !this.shareScopeMap[g][e][p]) {
2157
- this.shareScopeMap[g][e][p] = {
2158
- version: p,
2159
- scope: [g],
2160
- ...b,
2161
- lib: i,
2162
- loaded: a,
2163
- loading: c
2164
- }, l && (this.shareScopeMap[g][e][p].get = l);
2165
- return;
2166
- }
2167
- const v = this.shareScopeMap[g][e][p];
2168
- c && !v.loading && (v.loading = c), a && !v.loaded && (v.loaded = a), o && v.from !== o && (v.from = o);
2169
- });
2170
- }
2171
- _setGlobalShareScopeMap(e) {
2172
- const r = De(), o = e.id || e.name;
2173
- o && !r[o] && (r[o] = this.shareScopeMap);
2174
- }
2175
- }
2176
- class an {
2177
- constructor(e) {
2178
- this.hooks = new _e({
2179
- beforeRegisterRemote: new Ne("beforeRegisterRemote"),
2180
- registerRemote: new Ne("registerRemote"),
2181
- beforeRequest: new de("beforeRequest"),
2182
- onLoad: new oe("onLoad"),
2183
- handlePreloadModule: new te("handlePreloadModule"),
2184
- errorLoadRemote: new oe("errorLoadRemote"),
2185
- beforePreloadRemote: new oe("beforePreloadRemote"),
2186
- generatePreloadAssets: new oe("generatePreloadAssets"),
2187
- // not used yet
2188
- afterPreloadRemote: new oe(),
2189
- loadEntry: new oe()
2190
- }), this.host = e, this.idToRemoteMap = {};
2191
- }
2192
- formatAndRegisterRemote(e, r) {
2193
- return (r.remotes || []).reduce((i, c) => (this.registerRemote(c, i, { force: !1 }), i), e.remotes);
2194
- }
2195
- setIdToRemoteMap(e, r) {
2196
- const { remote: o, expose: i } = r, { name: c, alias: a } = o;
2197
- if (this.idToRemoteMap[e] = { name: o.name, expose: i }, a && e.startsWith(c)) {
2198
- const l = e.replace(c, a);
2199
- this.idToRemoteMap[l] = { name: o.name, expose: i };
2200
- return;
2201
- }
2202
- if (a && e.startsWith(a)) {
2203
- const l = e.replace(a, c);
2204
- this.idToRemoteMap[l] = { name: o.name, expose: i };
2205
- }
2206
- }
2207
- // eslint-disable-next-line max-lines-per-function
2208
- // eslint-disable-next-line @typescript-eslint/member-ordering
2209
- async loadRemote(e, r) {
2210
- const { host: o } = this;
2211
- try {
2212
- const { loadFactory: i = !0 } = r || {
2213
- loadFactory: !0
2214
- }, { module: c, moduleOptions: a, remoteMatchInfo: l } = await this.getRemoteModuleAndOptions({
2215
- id: e
2216
- }), { pkgNameOrAlias: p, remote: m, expose: b, id: S, remoteSnapshot: g } = l, v = await c.get(S, b, r, g), M = await this.hooks.lifecycle.onLoad.emit({
2217
- id: S,
2218
- pkgNameOrAlias: p,
2219
- expose: b,
2220
- exposeModule: i ? v : void 0,
2221
- exposeModuleFactory: i ? void 0 : v,
2222
- remote: m,
2223
- options: a,
2224
- moduleInstance: c,
2225
- origin: o
2226
- });
2227
- return this.setIdToRemoteMap(e, l), typeof M == "function" ? M : v;
2228
- } catch (i) {
2229
- const { from: c = "runtime" } = r || { from: "runtime" }, a = await this.hooks.lifecycle.errorLoadRemote.emit({
2230
- id: e,
2231
- error: i,
2232
- from: c,
2233
- lifecycle: "onLoad",
2234
- origin: o
2235
- });
2236
- if (!a)
2237
- throw i;
2238
- return a;
2239
- }
2240
- }
2241
- // eslint-disable-next-line @typescript-eslint/member-ordering
2242
- async preloadRemote(e) {
2243
- const { host: r } = this;
2244
- await this.hooks.lifecycle.beforePreloadRemote.emit({
2245
- preloadOps: e,
2246
- options: r.options,
2247
- origin: r
2248
- });
2249
- const o = Jt(r.options.remotes, e);
2250
- await Promise.all(o.map(async (i) => {
2251
- const { remote: c } = i, a = Re(c), { globalSnapshot: l, remoteSnapshot: p } = await r.snapshotHandler.loadRemoteSnapshotInfo({
2252
- moduleInfo: c
2253
- }), m = await this.hooks.lifecycle.generatePreloadAssets.emit({
2254
- origin: r,
2255
- preloadOptions: i,
2256
- remote: c,
2257
- remoteInfo: a,
2258
- globalSnapshot: l,
2259
- remoteSnapshot: p
2260
- });
2261
- m && Ce(a, r, m);
2262
- }));
2263
- }
2264
- registerRemotes(e, r) {
2265
- const { host: o } = this;
2266
- e.forEach((i) => {
2267
- this.registerRemote(i, o.options.remotes, {
2268
- force: r?.force
2269
- });
2270
- });
2271
- }
2272
- async getRemoteModuleAndOptions(e) {
2273
- const { host: r } = this, { id: o } = e;
2274
- let i;
2275
- try {
2276
- i = await this.hooks.lifecycle.beforeRequest.emit({
2277
- id: o,
2278
- options: r.options,
2279
- origin: r
2280
- });
2281
- } catch (M) {
2282
- if (i = await this.hooks.lifecycle.errorLoadRemote.emit({
2283
- id: o,
2284
- options: r.options,
2285
- origin: r,
2286
- from: "runtime",
2287
- error: M,
2288
- lifecycle: "beforeRequest"
2289
- }), !i)
2290
- throw M;
2291
- }
2292
- const { id: c } = i, a = Le(r.options.remotes, c);
2293
- h(a, s.getShortErrorMsg(s.RUNTIME_004, s.runtimeDescMap, {
2294
- hostName: r.options.name,
2295
- requestId: c
2296
- }));
2297
- const { remote: l } = a, p = Re(l), m = await r.sharedHandler.hooks.lifecycle.afterResolve.emit({
2298
- id: c,
2299
- ...a,
2300
- options: r.options,
2301
- origin: r,
2302
- remoteInfo: p
2303
- }), { remote: b, expose: S } = m;
2304
- h(b && S, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${c}.`);
2305
- let g = r.moduleCache.get(b.name);
2306
- const v = {
2307
- host: r,
2308
- remoteInfo: p
2309
- };
2310
- return g || (g = new ke(v), r.moduleCache.set(b.name, g)), {
2311
- module: g,
2312
- moduleOptions: v,
2313
- remoteMatchInfo: m
2314
- };
2315
- }
2316
- registerRemote(e, r, o) {
2317
- const { host: i } = this, c = () => {
2318
- if (e.alias) {
2319
- const l = r.find((p) => e.alias && (p.name.startsWith(e.alias) || p.alias?.startsWith(e.alias)));
2320
- h(!l, `The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${l && l.name} name or alias`);
2321
- }
2322
- "entry" in e && t.isBrowserEnv() && !e.entry.startsWith("http") && (e.entry = new URL(e.entry, window.location.origin).href), e.shareScope || (e.shareScope = Ee), e.type || (e.type = We);
2323
- };
2324
- this.hooks.lifecycle.beforeRegisterRemote.emit({ remote: e, origin: i });
2325
- const a = r.find((l) => l.name === e.name);
2326
- if (!a)
2327
- c(), r.push(e), this.hooks.lifecycle.registerRemote.emit({ remote: e, origin: i });
2328
- else {
2329
- const l = [
2330
- `The remote "${e.name}" is already registered.`,
2331
- "Please note that overriding it may cause unexpected errors."
2332
- ];
2333
- o?.force && (this.removeRemote(a), c(), r.push(e), this.hooks.lifecycle.registerRemote.emit({ remote: e, origin: i }), t.warn(l.join(" ")));
2334
- }
2335
- }
2336
- removeRemote(e) {
2337
- try {
2338
- const { host: r } = this, { name: o } = e, i = r.options.remotes.findIndex((a) => a.name === o);
2339
- i !== -1 && r.options.remotes.splice(i, 1);
2340
- const c = r.moduleCache.get(e.name);
2341
- if (c) {
2342
- const a = c.remoteInfo, l = a.entryGlobalName;
2343
- P[l] && (Object.getOwnPropertyDescriptor(P, l)?.configurable ? delete P[l] : P[l] = void 0);
2344
- const p = Fe(c.remoteInfo);
2345
- ce[p] && delete ce[p], r.snapshotHandler.manifestCache.delete(a.entry);
2346
- let m = a.buildVersion ? t.composeKeyWithSeparator(a.name, a.buildVersion) : a.name;
2347
- const b = P.__FEDERATION__.__INSTANCES__.findIndex((g) => a.buildVersion ? g.options.id === m : g.name === m);
2348
- if (b !== -1) {
2349
- const g = P.__FEDERATION__.__INSTANCES__[b];
2350
- m = g.options.id || m;
2351
- const v = De();
2352
- let M = !0;
2353
- const x = [];
2354
- Object.keys(v).forEach((T) => {
2355
- const A = v[T];
2356
- A && Object.keys(A).forEach((G) => {
2357
- const L = A[G];
2358
- L && Object.keys(L).forEach((q) => {
2359
- const Y = L[q];
2360
- Y && Object.keys(Y).forEach((ue) => {
2361
- const W = Y[ue];
2362
- W && typeof W == "object" && W.from === a.name && (W.loaded || W.loading ? (W.useIn = W.useIn.filter((se) => se !== a.name), W.useIn.length ? M = !1 : x.push([
2363
- T,
2364
- G,
2365
- q,
2366
- ue
2367
- ])) : x.push([
2368
- T,
2369
- G,
2370
- q,
2371
- ue
2372
- ]));
2373
- });
2374
- });
2375
- });
2376
- }), M && (g.shareScopeMap = {}, delete v[m]), x.forEach(([T, A, G, L]) => {
2377
- delete v[T]?.[A]?.[G]?.[L];
2378
- }), P.__FEDERATION__.__INSTANCES__.splice(b, 1);
2379
- }
2380
- const { hostGlobalSnapshot: S } = ft(e, r);
2381
- if (S) {
2382
- const g = S && "remotesInfo" in S && S.remotesInfo && Z(S.remotesInfo, e.name).key;
2383
- g && (delete S.remotesInfo[g], V.__FEDERATION__.__MANIFEST_LOADING__[g] && delete V.__FEDERATION__.__MANIFEST_LOADING__[g]);
2384
- }
2385
- r.moduleCache.delete(e.name);
2386
- }
2387
- } catch (r) {
2388
- u.log("removeRemote fail: ", r);
2389
- }
2390
- }
2391
- }
2392
- const cn = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN == "boolean" ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : !0;
2393
- class ln {
2394
- constructor(e) {
2395
- this.hooks = new _e({
2396
- beforeInit: new Ne("beforeInit"),
2397
- init: new te(),
2398
- // maybe will change, temporarily for internal use only
2399
- beforeInitContainer: new de("beforeInitContainer"),
2400
- // maybe will change, temporarily for internal use only
2401
- initContainer: new de("initContainer")
2402
- }), this.version = "0.21.6", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new _e({
2403
- // FIXME: may not be suitable , not open to the public yet
2404
- getModuleInfo: new te(),
2405
- createScript: new te(),
2406
- createLink: new te(),
2407
- fetch: new oe(),
2408
- loadEntryError: new oe(),
2409
- getModuleFactory: new oe()
2410
- }), this.bridgeHook = new _e({
2411
- beforeBridgeRender: new te(),
2412
- afterBridgeRender: new te(),
2413
- beforeBridgeDestroy: new te(),
2414
- afterBridgeDestroy: new te()
2415
- });
2416
- const r = cn ? [en(), rn()] : [], o = {
2417
- id: Vt(),
2418
- name: e.name,
2419
- plugins: r,
2420
- remotes: [],
2421
- shared: {},
2422
- inBrowser: t.isBrowserEnv()
2423
- };
2424
- this.name = e.name, this.options = o, this.snapshotHandler = new on(this), this.sharedHandler = new sn(this), this.remoteHandler = new an(this), this.shareScopeMap = this.sharedHandler.shareScopeMap, this.registerPlugins([
2425
- ...o.plugins,
2426
- ...e.plugins || []
2427
- ]), this.options = this.formatOptions(o, e);
2428
- }
2429
- initOptions(e) {
2430
- this.registerPlugins(e.plugins);
2431
- const r = this.formatOptions(this.options, e);
2432
- return this.options = r, r;
2433
- }
2434
- async loadShare(e, r) {
2435
- return this.sharedHandler.loadShare(e, r);
2436
- }
2437
- // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
2438
- // 1. If the loaded shared already exists globally, then it will be reused
2439
- // 2. If lib exists in local shared, it will be used directly
2440
- // 3. If the local get returns something other than Promise, then it will be used directly
2441
- loadShareSync(e, r) {
2442
- return this.sharedHandler.loadShareSync(e, r);
2443
- }
2444
- initializeSharing(e = Ee, r) {
2445
- return this.sharedHandler.initializeSharing(e, r);
2446
- }
2447
- initRawContainer(e, r, o) {
2448
- const i = Re({ name: e, entry: r }), c = new ke({ host: this, remoteInfo: i });
2449
- return c.remoteEntryExports = o, this.moduleCache.set(e, c), c;
2450
- }
2451
- // eslint-disable-next-line max-lines-per-function
2452
- // eslint-disable-next-line @typescript-eslint/member-ordering
2453
- async loadRemote(e, r) {
2454
- return this.remoteHandler.loadRemote(e, r);
2455
- }
2456
- // eslint-disable-next-line @typescript-eslint/member-ordering
2457
- async preloadRemote(e) {
2458
- return this.remoteHandler.preloadRemote(e);
2459
- }
2460
- initShareScopeMap(e, r, o = {}) {
2461
- this.sharedHandler.initShareScopeMap(e, r, o);
2462
- }
2463
- formatOptions(e, r) {
2464
- const { shared: o } = rt(e, r), { userOptions: i, options: c } = this.hooks.lifecycle.beforeInit.emit({
2465
- origin: this,
2466
- userOptions: r,
2467
- options: e,
2468
- shareInfo: o
2469
- }), a = this.remoteHandler.formatAndRegisterRemote(c, i), { shared: l } = this.sharedHandler.registerShared(c, i), p = [...c.plugins];
2470
- i.plugins && i.plugins.forEach((b) => {
2471
- p.includes(b) || p.push(b);
2472
- });
2473
- const m = {
2474
- ...e,
2475
- ...r,
2476
- plugins: p,
2477
- remotes: a,
2478
- shared: l
2479
- };
2480
- return this.hooks.lifecycle.init.emit({
2481
- origin: this,
2482
- options: m
2483
- }), m;
2484
- }
2485
- registerPlugins(e) {
2486
- const r = qt(e, this);
2487
- this.options.plugins = this.options.plugins.reduce((o, i) => (i && o && !o.find((c) => c.name === i.name) && o.push(i), o), r || []);
2488
- }
2489
- registerRemotes(e, r) {
2490
- return this.remoteHandler.registerRemotes(e, r);
2491
- }
2492
- registerShared(e) {
2493
- this.sharedHandler.registerShared(this.options, {
2494
- ...this.options,
2495
- shared: e
2496
- });
2497
- }
2498
- }
2499
- var un = /* @__PURE__ */ Object.freeze({
2500
- __proto__: null
2501
- });
2502
- return index_cjs$2.loadScript = t.loadScript, index_cjs$2.loadScriptNode = t.loadScriptNode, index_cjs$2.CurrentGlobal = P, index_cjs$2.Global = V, index_cjs$2.Module = ke, index_cjs$2.ModuleFederation = ln, index_cjs$2.addGlobalSnapshot = z, index_cjs$2.assert = h, index_cjs$2.getGlobalFederationConstructor = C, index_cjs$2.getGlobalSnapshot = fe, index_cjs$2.getInfoWithoutType = Z, index_cjs$2.getRegisteredShare = me, index_cjs$2.getRemoteEntry = Se, index_cjs$2.getRemoteInfo = Re, index_cjs$2.helpers = Qt, index_cjs$2.isStaticResourcesEqual = U, index_cjs$2.matchRemoteWithNameAndExpose = Le, index_cjs$2.registerGlobalPlugins = Ge, index_cjs$2.resetFederationGlobalInfo = I, index_cjs$2.safeWrapper = k, index_cjs$2.satisfy = ge, index_cjs$2.setGlobalFederationConstructor = K, index_cjs$2.setGlobalFederationInstance = N, index_cjs$2.types = un, index_cjs$2;
2503
- }
2504
- var utils_cjs = {}, hasRequiredUtils_cjs;
2505
- function requireUtils_cjs() {
2506
- if (hasRequiredUtils_cjs) return utils_cjs;
2507
- hasRequiredUtils_cjs = 1;
2508
- var t = requireIndex_cjs$1();
2509
- function s() {
2510
- return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? (
2511
- //@ts-ignore
2512
- FEDERATION_BUILD_IDENTIFIER
2513
- ) : "";
2514
- }
2515
- function d(u, h) {
2516
- const E = s();
2517
- return t.CurrentGlobal.__FEDERATION__.__INSTANCES__.find((_) => !!(E && _.options.id === E || _.options.name === u && !_.options.version && !h || _.options.name === u && h && _.options.version === h));
2518
- }
2519
- return utils_cjs.getGlobalFederationInstance = d, utils_cjs;
2520
- }
2521
- var hasRequiredIndex_cjs;
2522
- function requireIndex_cjs() {
2523
- if (hasRequiredIndex_cjs) return index_cjs$3;
2524
- hasRequiredIndex_cjs = 1;
2525
- var t = requireIndex_cjs$1(), s = /* @__PURE__ */ requireIndex_cjs$2(), d = requireUtils_cjs();
2526
- function u(j) {
2527
- const U = t.getGlobalFederationConstructor() || t.ModuleFederation, Q = new U(j);
2528
- return t.setGlobalFederationInstance(Q), Q;
2529
- }
2530
- let h = null;
2531
- function E(j) {
2532
- const U = d.getGlobalFederationInstance(j.name, j.version);
2533
- return U ? (U.initOptions(j), h || (h = U), U) : (h = u(j), h);
2534
- }
2535
- function _(...j) {
2536
- return t.assert(h, s.getShortErrorMsg(s.RUNTIME_009, s.runtimeDescMap)), h.loadRemote.apply(h, j);
2537
- }
2538
- function y(...j) {
2539
- return t.assert(h, s.getShortErrorMsg(s.RUNTIME_009, s.runtimeDescMap)), h.loadShare.apply(h, j);
2540
- }
2541
- function R(...j) {
2542
- return t.assert(h, s.getShortErrorMsg(s.RUNTIME_009, s.runtimeDescMap)), h.loadShareSync.apply(h, j);
2543
- }
2544
- function $(...j) {
2545
- return t.assert(h, s.getShortErrorMsg(s.RUNTIME_009, s.runtimeDescMap)), h.preloadRemote.apply(h, j);
2546
- }
2547
- function w(...j) {
2548
- return t.assert(h, s.getShortErrorMsg(s.RUNTIME_009, s.runtimeDescMap)), h.registerRemotes.apply(h, j);
2549
- }
2550
- function k(...j) {
2551
- return t.assert(h, s.getShortErrorMsg(s.RUNTIME_009, s.runtimeDescMap)), h.registerPlugins.apply(h, j);
2552
- }
2553
- function H() {
2554
- return h;
2555
- }
2556
- function B(...j) {
2557
- return t.assert(h, s.getShortErrorMsg(s.RUNTIME_009, s.runtimeDescMap)), h.registerShared.apply(h, j);
1
+ import { defineAsyncComponent as ye, hasInjectionContext as W, inject as q, getCurrentInstance as _e, ref as k, reactive as Ne, markRaw as I, effectScope as be, isRef as j, isReactive as G, toRef as B, toRaw as De, nextTick as ne, computed as X, getCurrentScope as Oe, onScopeDispose as Pe, watch as we, toRefs as oe, defineComponent as Ce, watchEffect as Ve, createElementBlock as re, openBlock as M, Fragment as se, renderSlot as Se, createCommentVNode as Ie, renderList as $e, createBlock as je, resolveDynamicComponent as Le, mergeProps as Re, createElementVNode as ke } from "vue";
2
+ let z = null;
3
+ function Je(e) {
4
+ if (z !== null) {
5
+ console.warn(
6
+ "[LinID CoreLib] Module Federation has already been initialized. Re-initialization is ignored."
7
+ );
8
+ return;
2558
9
  }
2559
- return t.setGlobalFederationConstructor(t.ModuleFederation), index_cjs$3.Module = t.Module, index_cjs$3.ModuleFederation = t.ModuleFederation, index_cjs$3.getRemoteEntry = t.getRemoteEntry, index_cjs$3.getRemoteInfo = t.getRemoteInfo, index_cjs$3.loadScript = t.loadScript, index_cjs$3.loadScriptNode = t.loadScriptNode, index_cjs$3.registerGlobalPlugins = t.registerGlobalPlugins, index_cjs$3.createInstance = u, index_cjs$3.getInstance = H, index_cjs$3.init = E, index_cjs$3.loadRemote = _, index_cjs$3.loadShare = y, index_cjs$3.loadShareSync = R, index_cjs$3.preloadRemote = $, index_cjs$3.registerPlugins = k, index_cjs$3.registerRemotes = w, index_cjs$3.registerShared = B, index_cjs$3;
10
+ z = e;
2560
11
  }
2561
- var hasRequiredRuntime_cjs;
2562
- function requireRuntime_cjs() {
2563
- return hasRequiredRuntime_cjs || (hasRequiredRuntime_cjs = 1, (function(t) {
2564
- var s = requireIndex_cjs();
2565
- Object.prototype.hasOwnProperty.call(s, "__proto__") && !Object.prototype.hasOwnProperty.call(t, "__proto__") && Object.defineProperty(t, "__proto__", {
2566
- enumerable: !0,
2567
- value: s.__proto__
2568
- }), Object.keys(s).forEach(function(d) {
2569
- d !== "default" && !Object.prototype.hasOwnProperty.call(t, d) && (t[d] = s[d]);
2570
- });
2571
- })(runtime_cjs)), runtime_cjs;
2572
- }
2573
- var hasRequiredRuntime;
2574
- function requireRuntime() {
2575
- return hasRequiredRuntime || (hasRequiredRuntime = 1, (function(t) {
2576
- var s = runtime && runtime.__createBinding || (Object.create ? (function(u, h, E, _) {
2577
- _ === void 0 && (_ = E);
2578
- var y = Object.getOwnPropertyDescriptor(h, E);
2579
- (!y || ("get" in y ? !h.__esModule : y.writable || y.configurable)) && (y = { enumerable: !0, get: function() {
2580
- return h[E];
2581
- } }), Object.defineProperty(u, _, y);
2582
- }) : (function(u, h, E, _) {
2583
- _ === void 0 && (_ = E), u[_] = h[E];
2584
- })), d = runtime && runtime.__exportStar || function(u, h) {
2585
- for (var E in u) E !== "default" && !Object.prototype.hasOwnProperty.call(h, E) && s(h, u, E);
2586
- };
2587
- Object.defineProperty(t, "__esModule", { value: !0 }), d(requireRuntime_cjs(), t);
2588
- })(runtime)), runtime;
12
+ function ze() {
13
+ if (z === null)
14
+ throw new Error(
15
+ "[LinID CoreLib] Module Federation is not initialized. Call setModuleFederation() first."
16
+ );
17
+ return z;
2589
18
  }
2590
- var runtimeExports = requireRuntime();
2591
- const loadAsyncComponent = (t) => defineAsyncComponent(
2592
- () => runtimeExports.loadRemote(t).then((s) => {
2593
- if (!s?.default)
2594
- throw new Error(`Failed to load component from ${t}`);
2595
- return s.default;
19
+ const Fe = (e) => ye(
20
+ () => ze().loadRemote(e).then((o) => {
21
+ if (!o?.default)
22
+ throw new Error(`Failed to load component from ${e}`);
23
+ return o.default;
2596
24
  })
2597
25
  );
2598
- const IS_CLIENT = typeof window < "u";
2599
- let activePinia;
2600
- const setActivePinia = (t) => activePinia = t;
26
+ const C = typeof window < "u";
27
+ let b;
28
+ const F = (e) => b = e;
2601
29
  process.env.NODE_ENV;
2602
- const piniaSymbol = process.env.NODE_ENV !== "production" ? Symbol("pinia") : (
30
+ const J = process.env.NODE_ENV !== "production" ? Symbol("pinia") : (
2603
31
  /* istanbul ignore next */
2604
32
  Symbol()
2605
33
  );
2606
- function isPlainObject(t) {
2607
- return t && typeof t == "object" && Object.prototype.toString.call(t) === "[object Object]" && typeof t.toJSON != "function";
34
+ function D(e) {
35
+ return e && typeof e == "object" && Object.prototype.toString.call(e) === "[object Object]" && typeof e.toJSON != "function";
2608
36
  }
2609
- var MutationType;
2610
- (function(t) {
2611
- t.direct = "direct", t.patchObject = "patch object", t.patchFunction = "patch function";
2612
- })(MutationType || (MutationType = {}));
2613
- function patchObject(t, s) {
2614
- for (const d in s) {
2615
- const u = s[d];
2616
- if (!(d in t))
37
+ var $;
38
+ (function(e) {
39
+ e.direct = "direct", e.patchObject = "patch object", e.patchFunction = "patch function";
40
+ })($ || ($ = {}));
41
+ function fe(e, o) {
42
+ for (const n in o) {
43
+ const t = o[n];
44
+ if (!(n in e))
2617
45
  continue;
2618
- const h = t[d];
2619
- isPlainObject(h) && isPlainObject(u) && !isRef(u) && !isReactive(u) ? t[d] = patchObject(h, u) : t[d] = u;
46
+ const i = e[n];
47
+ D(i) && D(t) && !j(t) && !G(t) ? e[n] = fe(i, t) : e[n] = t;
2620
48
  }
2621
- return t;
49
+ return e;
2622
50
  }
2623
- const noop = () => {
51
+ const de = () => {
2624
52
  };
2625
- function addSubscription(t, s, d, u = noop) {
2626
- t.add(s);
2627
- const h = () => {
2628
- t.delete(s) && u();
53
+ function ie(e, o, n, t = de) {
54
+ e.add(o);
55
+ const i = () => {
56
+ e.delete(o) && t();
2629
57
  };
2630
- return !d && getCurrentScope() && onScopeDispose(h), h;
58
+ return !n && Oe() && Pe(i), i;
2631
59
  }
2632
- function triggerSubscriptions(t, ...s) {
2633
- t.forEach((d) => {
2634
- d(...s);
60
+ function w(e, ...o) {
61
+ e.forEach((n) => {
62
+ n(...o);
2635
63
  });
2636
64
  }
2637
- const fallbackRunWithContext = (t) => t(), ACTION_MARKER = Symbol(), ACTION_NAME = Symbol();
2638
- function mergeReactiveObjects(t, s) {
2639
- t instanceof Map && s instanceof Map ? s.forEach((d, u) => t.set(u, d)) : t instanceof Set && s instanceof Set && s.forEach(t.add, t);
2640
- for (const d in s) {
2641
- if (!s.hasOwnProperty(d))
65
+ const Ue = (e) => e(), ce = Symbol(), Z = Symbol();
66
+ function Q(e, o) {
67
+ e instanceof Map && o instanceof Map ? o.forEach((n, t) => e.set(t, n)) : e instanceof Set && o instanceof Set && o.forEach(e.add, e);
68
+ for (const n in o) {
69
+ if (!o.hasOwnProperty(n))
2642
70
  continue;
2643
- const u = s[d], h = t[d];
2644
- isPlainObject(h) && isPlainObject(u) && t.hasOwnProperty(d) && !isRef(u) && !isReactive(u) ? t[d] = mergeReactiveObjects(h, u) : t[d] = u;
71
+ const t = o[n], i = e[n];
72
+ D(i) && D(t) && e.hasOwnProperty(n) && !j(t) && !G(t) ? e[n] = Q(i, t) : e[n] = t;
2645
73
  }
2646
- return t;
74
+ return e;
2647
75
  }
2648
- const skipHydrateSymbol = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : (
76
+ const xe = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : (
2649
77
  /* istanbul ignore next */
2650
78
  Symbol()
2651
79
  );
2652
- function shouldHydrate(t) {
2653
- return !isPlainObject(t) || !Object.prototype.hasOwnProperty.call(t, skipHydrateSymbol);
80
+ function Ae(e) {
81
+ return !D(e) || !Object.prototype.hasOwnProperty.call(e, xe);
2654
82
  }
2655
- const { assign } = Object;
2656
- function isComputed(t) {
2657
- return !!(isRef(t) && t.effect);
83
+ const { assign: v } = Object;
84
+ function ae(e) {
85
+ return !!(j(e) && e.effect);
2658
86
  }
2659
- function createOptionsStore(t, s, d, u) {
2660
- const { state: h, actions: E, getters: _ } = s, y = d.state.value[t];
2661
- let R;
2662
- function $() {
2663
- !y && (process.env.NODE_ENV === "production" || !u) && (d.state.value[t] = h ? h() : {});
2664
- const w = process.env.NODE_ENV !== "production" && u ? (
87
+ function ue(e, o, n, t) {
88
+ const { state: i, actions: f, getters: a } = o, d = n.state.value[e];
89
+ let _;
90
+ function p() {
91
+ !d && (process.env.NODE_ENV === "production" || !t) && (n.state.value[e] = i ? i() : {});
92
+ const l = process.env.NODE_ENV !== "production" && t ? (
2665
93
  // use ref() to unwrap refs inside state TODO: check if this is still necessary
2666
- toRefs(ref(h ? h() : {}).value)
2667
- ) : toRefs(d.state.value[t]);
2668
- return assign(w, E, Object.keys(_ || {}).reduce((k, H) => (process.env.NODE_ENV !== "production" && H in w && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${H}" in store "${t}".`), k[H] = markRaw(computed(() => {
2669
- setActivePinia(d);
2670
- const B = d._s.get(t);
2671
- return _[H].call(B, B);
2672
- })), k), {}));
2673
- }
2674
- return R = createSetupStore(t, $, s, d, u, !0), R;
94
+ oe(k(i ? i() : {}).value)
95
+ ) : oe(n.state.value[e]);
96
+ return v(l, f, Object.keys(a || {}).reduce((h, m) => (process.env.NODE_ENV !== "production" && m in l && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${m}" in store "${e}".`), h[m] = I(X(() => {
97
+ F(n);
98
+ const y = n._s.get(e);
99
+ return a[m].call(y, y);
100
+ })), h), {}));
101
+ }
102
+ return _ = Y(e, p, o, n, t, !0), _;
2675
103
  }
2676
- function createSetupStore(t, s, d = {}, u, h, E) {
2677
- let _;
2678
- const y = assign({ actions: {} }, d);
2679
- if (process.env.NODE_ENV !== "production" && !u._e.active)
104
+ function Y(e, o, n = {}, t, i, f) {
105
+ let a;
106
+ const d = v({ actions: {} }, n);
107
+ if (process.env.NODE_ENV !== "production" && !t._e.active)
2680
108
  throw new Error("Pinia destroyed");
2681
- const R = { deep: !0 };
2682
- process.env.NODE_ENV !== "production" && (R.onTrigger = (I) => {
2683
- $ ? B = I : $ == !1 && !O._hotUpdating && (Array.isArray(B) ? B.push(I) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
109
+ const _ = { deep: !0 };
110
+ process.env.NODE_ENV !== "production" && (_.onTrigger = (s) => {
111
+ p ? y = s : p == !1 && !c._hotUpdating && (Array.isArray(y) ? y.push(s) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
2684
112
  });
2685
- let $, w, k = /* @__PURE__ */ new Set(), H = /* @__PURE__ */ new Set(), B;
2686
- const j = u.state.value[t];
2687
- !E && !j && (process.env.NODE_ENV === "production" || !h) && (u.state.value[t] = {});
2688
- const U = ref({});
2689
- let Q;
2690
- function J(I) {
2691
- let N;
2692
- $ = w = !1, process.env.NODE_ENV !== "production" && (B = []), typeof I == "function" ? (I(u.state.value[t]), N = {
2693
- type: MutationType.patchFunction,
2694
- storeId: t,
2695
- events: B
2696
- }) : (mergeReactiveObjects(u.state.value[t], I), N = {
2697
- type: MutationType.patchObject,
2698
- payload: I,
2699
- storeId: t,
2700
- events: B
113
+ let p, l, h = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), y;
114
+ const P = t.state.value[e];
115
+ !f && !P && (process.env.NODE_ENV === "production" || !i) && (t.state.value[e] = {});
116
+ const A = k({});
117
+ let K;
118
+ function ee(s) {
119
+ let r;
120
+ p = l = !1, process.env.NODE_ENV !== "production" && (y = []), typeof s == "function" ? (s(t.state.value[e]), r = {
121
+ type: $.patchFunction,
122
+ storeId: e,
123
+ events: y
124
+ }) : (Q(t.state.value[e], s), r = {
125
+ type: $.patchObject,
126
+ payload: s,
127
+ storeId: e,
128
+ events: y
2701
129
  });
2702
- const C = Q = Symbol();
2703
- nextTick().then(() => {
2704
- Q === C && ($ = !0);
2705
- }), w = !0, triggerSubscriptions(k, N, u.state.value[t]);
2706
- }
2707
- const D = E ? function() {
2708
- const { state: N } = d, C = N ? N() : {};
2709
- this.$patch((K) => {
2710
- assign(K, C);
130
+ const u = K = Symbol();
131
+ ne().then(() => {
132
+ K === u && (p = !0);
133
+ }), l = !0, w(h, r, t.state.value[e]);
134
+ }
135
+ const Ee = f ? function() {
136
+ const { state: r } = n, u = r ? r() : {};
137
+ this.$patch((E) => {
138
+ v(E, u);
2711
139
  });
2712
140
  } : (
2713
141
  /* istanbul ignore next */
2714
142
  process.env.NODE_ENV !== "production" ? () => {
2715
- throw new Error(`🍍: Store "${t}" is built using the setup syntax and does not implement $reset().`);
2716
- } : noop
143
+ throw new Error(`🍍: Store "${e}" is built using the setup syntax and does not implement $reset().`);
144
+ } : de
2717
145
  );
2718
- function P() {
2719
- _.stop(), k.clear(), H.clear(), u._s.delete(t);
2720
- }
2721
- const F = (I, N = "") => {
2722
- if (ACTION_MARKER in I)
2723
- return I[ACTION_NAME] = N, I;
2724
- const C = function() {
2725
- setActivePinia(u);
2726
- const K = Array.from(arguments), Z = /* @__PURE__ */ new Set(), fe = /* @__PURE__ */ new Set();
2727
- function Ie(z) {
2728
- Z.add(z);
2729
- }
2730
- function he(z) {
2731
- fe.add(z);
2732
- }
2733
- triggerSubscriptions(H, {
2734
- args: K,
2735
- name: C[ACTION_NAME],
2736
- store: O,
2737
- after: Ie,
2738
- onError: he
146
+ function ge() {
147
+ a.stop(), h.clear(), m.clear(), t._s.delete(e);
148
+ }
149
+ const H = (s, r = "") => {
150
+ if (ce in s)
151
+ return s[Z] = r, s;
152
+ const u = function() {
153
+ F(t);
154
+ const E = Array.from(arguments), V = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set();
155
+ function ve(g) {
156
+ V.add(g);
157
+ }
158
+ function me(g) {
159
+ T.add(g);
160
+ }
161
+ w(m, {
162
+ args: E,
163
+ name: u[Z],
164
+ store: c,
165
+ after: ve,
166
+ onError: me
2739
167
  });
2740
- let le;
168
+ let S;
2741
169
  try {
2742
- le = I.apply(this && this.$id === t ? this : O, K);
2743
- } catch (z) {
2744
- throw triggerSubscriptions(fe, z), z;
170
+ S = s.apply(this && this.$id === e ? this : c, E);
171
+ } catch (g) {
172
+ throw w(T, g), g;
2745
173
  }
2746
- return le instanceof Promise ? le.then((z) => (triggerSubscriptions(Z, z), z)).catch((z) => (triggerSubscriptions(fe, z), Promise.reject(z))) : (triggerSubscriptions(Z, le), le);
174
+ return S instanceof Promise ? S.then((g) => (w(V, g), g)).catch((g) => (w(T, g), Promise.reject(g))) : (w(V, S), S);
2747
175
  };
2748
- return C[ACTION_MARKER] = !0, C[ACTION_NAME] = N, C;
2749
- }, V = /* @__PURE__ */ markRaw({
176
+ return u[ce] = !0, u[Z] = r, u;
177
+ }, R = /* @__PURE__ */ I({
2750
178
  actions: {},
2751
179
  getters: {},
2752
180
  state: [],
2753
- hotState: U
2754
- }), ee = {
2755
- _p: u,
181
+ hotState: A
182
+ }), te = {
183
+ _p: t,
2756
184
  // _s: scope,
2757
- $id: t,
2758
- $onAction: addSubscription.bind(null, H),
2759
- $patch: J,
2760
- $reset: D,
2761
- $subscribe(I, N = {}) {
2762
- const C = addSubscription(k, I, N.detached, () => K()), K = _.run(() => watch(() => u.state.value[t], (Z) => {
2763
- (N.flush === "sync" ? w : $) && I({
2764
- storeId: t,
2765
- type: MutationType.direct,
2766
- events: B
2767
- }, Z);
2768
- }, assign({}, R, N)));
2769
- return C;
185
+ $id: e,
186
+ $onAction: ie.bind(null, m),
187
+ $patch: ee,
188
+ $reset: Ee,
189
+ $subscribe(s, r = {}) {
190
+ const u = ie(h, s, r.detached, () => E()), E = a.run(() => we(() => t.state.value[e], (V) => {
191
+ (r.flush === "sync" ? l : p) && s({
192
+ storeId: e,
193
+ type: $.direct,
194
+ events: y
195
+ }, V);
196
+ }, v({}, _, r)));
197
+ return u;
2770
198
  },
2771
- $dispose: P
2772
- }, O = reactive(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && IS_CLIENT ? assign(
199
+ $dispose: ge
200
+ }, c = Ne(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && C ? v(
2773
201
  {
2774
- _hmrPayload: V,
2775
- _customProperties: markRaw(/* @__PURE__ */ new Set())
202
+ _hmrPayload: R,
203
+ _customProperties: I(/* @__PURE__ */ new Set())
2776
204
  // devtools custom properties
2777
205
  },
2778
- ee
206
+ te
2779
207
  // must be added later
2780
208
  // setupStore
2781
- ) : ee);
2782
- u._s.set(t, O);
2783
- const re = (u._a && u._a.runWithContext || fallbackRunWithContext)(() => u._e.run(() => (_ = effectScope()).run(() => s({ action: F }))));
2784
- for (const I in re) {
2785
- const N = re[I];
2786
- if (isRef(N) && !isComputed(N) || isReactive(N))
2787
- process.env.NODE_ENV !== "production" && h ? U.value[I] = toRef(re, I) : E || (j && shouldHydrate(N) && (isRef(N) ? N.value = j[I] : mergeReactiveObjects(N, j[I])), u.state.value[t][I] = N), process.env.NODE_ENV !== "production" && V.state.push(I);
2788
- else if (typeof N == "function") {
2789
- const C = process.env.NODE_ENV !== "production" && h ? N : F(N, I);
2790
- re[I] = C, process.env.NODE_ENV !== "production" && (V.actions[I] = N), y.actions[I] = N;
2791
- } else process.env.NODE_ENV !== "production" && isComputed(N) && (V.getters[I] = E ? (
209
+ ) : te);
210
+ t._s.set(e, c);
211
+ const N = (t._a && t._a.runWithContext || Ue)(() => t._e.run(() => (a = be()).run(() => o({ action: H }))));
212
+ for (const s in N) {
213
+ const r = N[s];
214
+ if (j(r) && !ae(r) || G(r))
215
+ process.env.NODE_ENV !== "production" && i ? A.value[s] = B(N, s) : f || (P && Ae(r) && (j(r) ? r.value = P[s] : Q(r, P[s])), t.state.value[e][s] = r), process.env.NODE_ENV !== "production" && R.state.push(s);
216
+ else if (typeof r == "function") {
217
+ const u = process.env.NODE_ENV !== "production" && i ? r : H(r, s);
218
+ N[s] = u, process.env.NODE_ENV !== "production" && (R.actions[s] = r), d.actions[s] = r;
219
+ } else process.env.NODE_ENV !== "production" && ae(r) && (R.getters[s] = f ? (
2792
220
  // @ts-expect-error
2793
- d.getters[I]
2794
- ) : N, IS_CLIENT && (re._getters || // @ts-expect-error: same
2795
- (re._getters = markRaw([]))).push(I));
2796
- }
2797
- if (assign(O, re), assign(toRaw(O), re), Object.defineProperty(O, "$state", {
2798
- get: () => process.env.NODE_ENV !== "production" && h ? U.value : u.state.value[t],
2799
- set: (I) => {
2800
- if (process.env.NODE_ENV !== "production" && h)
221
+ n.getters[s]
222
+ ) : r, C && (N._getters || // @ts-expect-error: same
223
+ (N._getters = I([]))).push(s));
224
+ }
225
+ if (v(c, N), v(De(c), N), Object.defineProperty(c, "$state", {
226
+ get: () => process.env.NODE_ENV !== "production" && i ? A.value : t.state.value[e],
227
+ set: (s) => {
228
+ if (process.env.NODE_ENV !== "production" && i)
2801
229
  throw new Error("cannot set hotState");
2802
- J((N) => {
2803
- assign(N, I);
230
+ ee((r) => {
231
+ v(r, s);
2804
232
  });
2805
233
  }
2806
- }), process.env.NODE_ENV !== "production" && (O._hotUpdate = markRaw((I) => {
2807
- O._hotUpdating = !0, I._hmrPayload.state.forEach((N) => {
2808
- if (N in O.$state) {
2809
- const C = I.$state[N], K = O.$state[N];
2810
- typeof C == "object" && isPlainObject(C) && isPlainObject(K) ? patchObject(C, K) : I.$state[N] = K;
2811
- }
2812
- O[N] = toRef(I.$state, N);
2813
- }), Object.keys(O.$state).forEach((N) => {
2814
- N in I.$state || delete O[N];
2815
- }), $ = !1, w = !1, u.state.value[t] = toRef(I._hmrPayload, "hotState"), w = !0, nextTick().then(() => {
2816
- $ = !0;
234
+ }), process.env.NODE_ENV !== "production" && (c._hotUpdate = I((s) => {
235
+ c._hotUpdating = !0, s._hmrPayload.state.forEach((r) => {
236
+ if (r in c.$state) {
237
+ const u = s.$state[r], E = c.$state[r];
238
+ typeof u == "object" && D(u) && D(E) ? fe(u, E) : s.$state[r] = E;
239
+ }
240
+ c[r] = B(s.$state, r);
241
+ }), Object.keys(c.$state).forEach((r) => {
242
+ r in s.$state || delete c[r];
243
+ }), p = !1, l = !1, t.state.value[e] = B(s._hmrPayload, "hotState"), l = !0, ne().then(() => {
244
+ p = !0;
2817
245
  });
2818
- for (const N in I._hmrPayload.actions) {
2819
- const C = I[N];
2820
- O[N] = //
2821
- F(C, N);
246
+ for (const r in s._hmrPayload.actions) {
247
+ const u = s[r];
248
+ c[r] = //
249
+ H(u, r);
2822
250
  }
2823
- for (const N in I._hmrPayload.getters) {
2824
- const C = I._hmrPayload.getters[N], K = E ? (
251
+ for (const r in s._hmrPayload.getters) {
252
+ const u = s._hmrPayload.getters[r], E = f ? (
2825
253
  // special handling of options api
2826
- computed(() => (setActivePinia(u), C.call(O, O)))
2827
- ) : C;
2828
- O[N] = //
2829
- K;
2830
- }
2831
- Object.keys(O._hmrPayload.getters).forEach((N) => {
2832
- N in I._hmrPayload.getters || delete O[N];
2833
- }), Object.keys(O._hmrPayload.actions).forEach((N) => {
2834
- N in I._hmrPayload.actions || delete O[N];
2835
- }), O._hmrPayload = I._hmrPayload, O._getters = I._getters, O._hotUpdating = !1;
2836
- })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && IS_CLIENT) {
2837
- const I = {
254
+ X(() => (F(t), u.call(c, c)))
255
+ ) : u;
256
+ c[r] = //
257
+ E;
258
+ }
259
+ Object.keys(c._hmrPayload.getters).forEach((r) => {
260
+ r in s._hmrPayload.getters || delete c[r];
261
+ }), Object.keys(c._hmrPayload.actions).forEach((r) => {
262
+ r in s._hmrPayload.actions || delete c[r];
263
+ }), c._hmrPayload = s._hmrPayload, c._getters = s._getters, c._hotUpdating = !1;
264
+ })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && C) {
265
+ const s = {
2838
266
  writable: !0,
2839
267
  configurable: !0,
2840
268
  // avoid warning on devtools trying to display this property
2841
269
  enumerable: !1
2842
270
  };
2843
- ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((N) => {
2844
- Object.defineProperty(O, N, assign({ value: O[N] }, I));
271
+ ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((r) => {
272
+ Object.defineProperty(c, r, v({ value: c[r] }, s));
2845
273
  });
2846
274
  }
2847
- return u._p.forEach((I) => {
2848
- if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && IS_CLIENT) {
2849
- const N = _.run(() => I({
2850
- store: O,
2851
- app: u._a,
2852
- pinia: u,
2853
- options: y
275
+ return t._p.forEach((s) => {
276
+ if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && C) {
277
+ const r = a.run(() => s({
278
+ store: c,
279
+ app: t._a,
280
+ pinia: t,
281
+ options: d
2854
282
  }));
2855
- Object.keys(N || {}).forEach((C) => O._customProperties.add(C)), assign(O, N);
283
+ Object.keys(r || {}).forEach((u) => c._customProperties.add(u)), v(c, r);
2856
284
  } else
2857
- assign(O, _.run(() => I({
2858
- store: O,
2859
- app: u._a,
2860
- pinia: u,
2861
- options: y
285
+ v(c, a.run(() => s({
286
+ store: c,
287
+ app: t._a,
288
+ pinia: t,
289
+ options: d
2862
290
  })));
2863
- }), process.env.NODE_ENV !== "production" && O.$state && typeof O.$state == "object" && typeof O.$state.constructor == "function" && !O.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
291
+ }), process.env.NODE_ENV !== "production" && c.$state && typeof c.$state == "object" && typeof c.$state.constructor == "function" && !c.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
2864
292
  state: () => new MyClass()
2865
- Found in store "${O.$id}".`), j && E && d.hydrate && d.hydrate(O.$state, j), $ = !0, w = !0, O;
293
+ Found in store "${c.$id}".`), P && f && n.hydrate && n.hydrate(c.$state, P), p = !0, l = !0, c;
2866
294
  }
2867
295
  // @__NO_SIDE_EFFECTS__
2868
- function defineStore(t, s, d) {
2869
- let u;
2870
- const h = typeof s == "function";
2871
- u = h ? d : s;
2872
- function E(_, y) {
2873
- const R = hasInjectionContext();
2874
- if (_ = // in test mode, ignore the argument provided as we can always retrieve a
296
+ function pe(e, o, n) {
297
+ let t;
298
+ const i = typeof o == "function";
299
+ t = i ? n : o;
300
+ function f(a, d) {
301
+ const _ = W();
302
+ if (a = // in test mode, ignore the argument provided as we can always retrieve a
2875
303
  // pinia instance with getActivePinia()
2876
- (process.env.NODE_ENV === "test" && activePinia && activePinia._testing ? null : _) || (R ? inject(piniaSymbol, null) : null), _ && setActivePinia(_), process.env.NODE_ENV !== "production" && !activePinia)
304
+ (process.env.NODE_ENV === "test" && b && b._testing ? null : a) || (_ ? q(J, null) : null), a && F(a), process.env.NODE_ENV !== "production" && !b)
2877
305
  throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
2878
306
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
2879
307
  This will fail in production.`);
2880
- _ = activePinia, _._s.has(t) || (h ? createSetupStore(t, s, u, _) : createOptionsStore(t, u, _), process.env.NODE_ENV !== "production" && (E._pinia = _));
2881
- const $ = _._s.get(t);
2882
- if (process.env.NODE_ENV !== "production" && y) {
2883
- const w = "__hot:" + t, k = h ? createSetupStore(w, s, u, _, !0) : createOptionsStore(w, assign({}, u), _, !0);
2884
- y._hotUpdate(k), delete _.state.value[w], _._s.delete(w);
308
+ a = b, a._s.has(e) || (i ? Y(e, o, t, a) : ue(e, t, a), process.env.NODE_ENV !== "production" && (f._pinia = a));
309
+ const p = a._s.get(e);
310
+ if (process.env.NODE_ENV !== "production" && d) {
311
+ const l = "__hot:" + e, h = i ? Y(l, o, t, a, !0) : ue(l, v({}, t), a, !0);
312
+ d._hotUpdate(h), delete a.state.value[l], a._s.delete(l);
2885
313
  }
2886
- if (process.env.NODE_ENV !== "production" && IS_CLIENT) {
2887
- const w = getCurrentInstance();
2888
- if (w && w.proxy && // avoid adding stores that are just built for hot module replacement
2889
- !y) {
2890
- const k = w.proxy, H = "_pStores" in k ? k._pStores : k._pStores = {};
2891
- H[t] = $;
314
+ if (process.env.NODE_ENV !== "production" && C) {
315
+ const l = _e();
316
+ if (l && l.proxy && // avoid adding stores that are just built for hot module replacement
317
+ !d) {
318
+ const h = l.proxy, m = "_pStores" in h ? h._pStores : h._pStores = {};
319
+ m[e] = p;
2892
320
  }
2893
321
  }
2894
- return $;
322
+ return p;
2895
323
  }
2896
- return E.$id = t, E;
324
+ return f.$id = e, f;
2897
325
  }
2898
- const useLinidZoneStore = /* @__PURE__ */ defineStore("linidZoneStore", {
326
+ const He = /* @__PURE__ */ pe("linidZoneStore", {
2899
327
  state: () => ({
2900
328
  zones: {}
2901
329
  }),
@@ -2905,101 +333,122 @@ const useLinidZoneStore = /* @__PURE__ */ defineStore("linidZoneStore", {
2905
333
  * @param zone - The name of the zone.
2906
334
  * @param entry - The entry to register.
2907
335
  */
2908
- register(t, s) {
2909
- this.zones[t] || (this.zones[t] = []), this.zones[t].push(s);
336
+ register(e, o) {
337
+ this.zones[e] || (this.zones[e] = []), this.zones[e].push(o);
2910
338
  }
2911
339
  }
2912
- }), _sfc_main = /* @__PURE__ */ defineComponent({
340
+ }), Qe = /* @__PURE__ */ Ce({
2913
341
  __name: "LinidZoneRenderer",
2914
342
  props: {
2915
343
  zone: {}
2916
344
  },
2917
- setup(t) {
2918
- const s = t, d = useLinidZoneStore(), u = ref([]), h = ref(!1);
2919
- return watchEffect(() => {
2920
- h.value = !1;
2921
- const E = d.zones[s.zone] || [];
2922
- u.value = E.map((_) => ({
2923
- ..._,
2924
- component: loadAsyncComponent(_.plugin)
345
+ setup(e) {
346
+ const o = e, n = He(), t = k([]), i = k(!1);
347
+ return Ve(() => {
348
+ i.value = !1;
349
+ const f = n.zones[o.zone] || [];
350
+ t.value = f.map((a) => ({
351
+ ...a,
352
+ component: Fe(a.plugin)
2925
353
  })), Promise.resolve().then(() => {
2926
- h.value = !0;
354
+ i.value = !0;
2927
355
  });
2928
- }), (E, _) => (openBlock(), createElementBlock(Fragment, null, [
2929
- (openBlock(!0), createElementBlock(Fragment, null, renderList(u.value, (y, R) => (openBlock(), createBlock(resolveDynamicComponent(y.component), mergeProps({
2930
- key: y.plugin + R
2931
- }, { ref_for: !0 }, y.props), null, 16))), 128)),
2932
- h.value && u.value.length === 0 ? renderSlot(E.$slots, "default", { key: 0 }, () => [
2933
- _[0] || (_[0] = createElementVNode("div", null, "No components to render in this zone.", -1))
2934
- ]) : createCommentVNode("", !0)
356
+ }), (f, a) => (M(), re(se, null, [
357
+ (M(!0), re(se, null, $e(t.value, (d, _) => (M(), je(Le(d.component), Re({
358
+ key: d.plugin + _
359
+ }, { ref_for: !0 }, d.props), null, 16))), 128)),
360
+ i.value && t.value.length === 0 ? Se(f.$slots, "default", { key: 0 }, () => [
361
+ a[0] || (a[0] = ke("div", null, "No components to render in this zone.", -1))
362
+ ]) : Ie("", !0)
2935
363
  ], 64));
2936
364
  }
2937
365
  });
2938
- let uiDesign = null;
2939
- function setUiDesign(t) {
2940
- if (uiDesign !== null) {
366
+ function Ye() {
367
+ function e(n) {
368
+ return {
369
+ page: (n.page || 1) - 1,
370
+ size: n.rowsPerPage || 5,
371
+ sort: n.sortBy || "updateDate",
372
+ direction: n.descending ? "desc" : "asc"
373
+ };
374
+ }
375
+ function o(n) {
376
+ return {
377
+ page: n.number + 1,
378
+ rowsPerPage: n.size,
379
+ rowsNumber: n.totalElements
380
+ };
381
+ }
382
+ return {
383
+ toPagination: e,
384
+ toQuasarPagination: o
385
+ };
386
+ }
387
+ let U = null;
388
+ function Ge(e) {
389
+ if (U !== null) {
2941
390
  console.warn(
2942
391
  "[LinID CoreLib] UI Design has already been initialized. Re-initialization is ignored."
2943
392
  );
2944
393
  return;
2945
394
  }
2946
- uiDesign = t;
395
+ U = e;
2947
396
  }
2948
- function getUiDesign() {
2949
- if (uiDesign === null)
397
+ function Te() {
398
+ if (U === null)
2950
399
  throw new Error(
2951
400
  "[LinID CoreLib] UI Design is not initialized. Call setUiDesign() first."
2952
401
  );
2953
- return uiDesign;
402
+ return U;
2954
403
  }
2955
- function getNested(t, s) {
2956
- return s.split(".").reduce((d, u) => {
2957
- if (d && typeof d == "object")
2958
- return d[u];
2959
- }, t);
404
+ function le(e, o) {
405
+ return o.split(".").reduce((n, t) => {
406
+ if (n && typeof n == "object")
407
+ return n[t];
408
+ }, e);
2960
409
  }
2961
- function useUiDesign() {
2962
- const t = computed(() => getUiDesign());
2963
- function s(d, u) {
2964
- let h = getNested(t.value, `${d}.${u}`);
2965
- if (h === void 0 && (h = getNested(t.value, `default.${u}`)), h === void 0)
410
+ function Xe() {
411
+ const e = X(() => Te());
412
+ function o(n, t) {
413
+ let i = le(e.value, `${n}.${t}`);
414
+ if (i === void 0 && (i = le(e.value, `default.${t}`)), i === void 0)
2966
415
  throw new Error(
2967
- `[UiDesign] Value not found for '${d}.${u}' and no default fallback.`
416
+ `[UiDesign] Value not found for '${n}.${t}' and no default fallback.`
2968
417
  );
2969
- if (typeof h == "object")
418
+ if (typeof i == "object")
2970
419
  throw new Error(
2971
- `[UiDesign] Value for '${d}.${u}' is a nested object or null, expected a primitive.`
420
+ `[UiDesign] Value for '${n}.${t}' is a nested object or null, expected a primitive.`
2972
421
  );
2973
- return h;
422
+ return i;
2974
423
  }
2975
- return { ui: s };
424
+ return { ui: o };
2976
425
  }
2977
- let httpClient = null;
2978
- function setHttpClient(t) {
2979
- if (httpClient !== null) {
426
+ let x = null;
427
+ function Ke(e) {
428
+ if (x !== null) {
2980
429
  console.warn(
2981
430
  "[LinID CoreLib] HTTP client has already been initialized. Re-initialization is ignored."
2982
431
  );
2983
432
  return;
2984
433
  }
2985
- httpClient = t;
434
+ x = e;
2986
435
  }
2987
- function getHttpClient() {
2988
- if (httpClient === null)
436
+ function O() {
437
+ if (x === null)
2989
438
  throw new Error(
2990
439
  "[LinID CoreLib] HTTP client is not initialized. Call setHttpClient() first."
2991
440
  );
2992
- return httpClient;
441
+ return x;
2993
442
  }
2994
- async function getEntitiesConfiguration() {
2995
- return (await getHttpClient().get("/metadata/entities")).data;
443
+ async function Be() {
444
+ return (await O().get("/metadata/entities")).data;
2996
445
  }
2997
- async function getApiEndpointsConfiguration() {
2998
- return (await getHttpClient().get(
446
+ async function Me() {
447
+ return (await O().get(
2999
448
  "/metadata/routes"
3000
449
  )).data;
3001
450
  }
3002
- const useLinidConfigurationStore = /* @__PURE__ */ defineStore(
451
+ const et = /* @__PURE__ */ pe(
3003
452
  "LinidConfigurationStore",
3004
453
  {
3005
454
  state: () => ({
@@ -3014,14 +463,14 @@ const useLinidConfigurationStore = /* @__PURE__ */ defineStore(
3014
463
  * @param state - The store state.
3015
464
  * @returns A function that takes an entity name and returns the configuration.
3016
465
  */
3017
- getEntityByName: (t) => (s) => t.entities.find((d) => d.name === s),
466
+ getEntityByName: (e) => (o) => e.entities.find((n) => n.name === o),
3018
467
  /**
3019
468
  * Returns all api endpoints for a specific entity.
3020
469
  * @param state - The store state.
3021
470
  * @returns A function that takes an entity name and returns its api endpoints.
3022
471
  */
3023
- getApiEndpointsByEntity: (t) => (s) => t.apiEndpoints.filter(
3024
- (d) => d.entity === s
472
+ getApiEndpointsByEntity: (e) => (o) => e.apiEndpoints.filter(
473
+ (n) => n.entity === o
3025
474
  )
3026
475
  },
3027
476
  actions: {
@@ -3031,22 +480,55 @@ const useLinidConfigurationStore = /* @__PURE__ */ defineStore(
3031
480
  async fetchConfiguration() {
3032
481
  this.loading = !0, this.error = null;
3033
482
  try {
3034
- const [t, s] = await Promise.all([
3035
- getEntitiesConfiguration(),
3036
- getApiEndpointsConfiguration()
483
+ const [e, o] = await Promise.all([
484
+ Be(),
485
+ Me()
3037
486
  ]);
3038
- this.entities = t, this.apiEndpoints = s;
3039
- } catch (t) {
3040
- this.error = t instanceof Error ? t.message : "Failed to fetch configuration", console.error("[Linid CoreLib] Failed to fetch configuration:", t);
487
+ this.entities = e, this.apiEndpoints = o;
488
+ } catch (e) {
489
+ this.error = e instanceof Error ? e.message : "Failed to fetch configuration", console.error("[Linid CoreLib] Failed to fetch configuration:", e);
3041
490
  } finally {
3042
491
  this.loading = !1;
3043
492
  }
3044
493
  }
3045
494
  }
3046
495
  }
3047
- );
3048
- var ModuleLifecyclePhase = /* @__PURE__ */ ((t) => (t.SETUP = "setup", t.CONFIGURE = "configure", t.INITIALIZE = "initialize", t.READY = "ready", t.POST_INIT = "postInit", t))(ModuleLifecyclePhase || {});
3049
- class BasicRemoteModule {
496
+ ), he = /* @__PURE__ */ new Map();
497
+ function tt(e) {
498
+ he.set(e.instanceId, e);
499
+ }
500
+ function L(e) {
501
+ const o = he.get(e);
502
+ if (!o)
503
+ throw new Error(
504
+ `[LinID CoreLib] No module host configuration found for instanceId: ${e}`
505
+ );
506
+ return o;
507
+ }
508
+ async function nt(e, o) {
509
+ const n = L(e);
510
+ return O().post(`/${n.apiEndpoint}`, o).then(({ data: t }) => t);
511
+ }
512
+ async function ot(e, o, n) {
513
+ const t = L(e);
514
+ return O().put(`/${t.apiEndpoint}/${o}`, n).then(({ data: i }) => i);
515
+ }
516
+ async function rt(e, o, n) {
517
+ const t = L(e);
518
+ return O().get(`/${t.apiEndpoint}`, {
519
+ params: { ...o, ...n }
520
+ }).then(({ data: i }) => i);
521
+ }
522
+ async function st(e, o) {
523
+ const n = L(e);
524
+ return O().get(`/${n.apiEndpoint}/${o}`).then(({ data: t }) => t);
525
+ }
526
+ async function it(e, o) {
527
+ const n = L(e);
528
+ return O().delete(`/${n.apiEndpoint}/${o}`);
529
+ }
530
+ var Ze = /* @__PURE__ */ ((e) => (e.SETUP = "setup", e.CONFIGURE = "configure", e.INITIALIZE = "initialize", e.READY = "ready", e.POST_INIT = "postInit", e))(Ze || {});
531
+ class ct {
3050
532
  /**
3051
533
  * Unique identifier for the module.
3052
534
  *
@@ -3072,8 +554,8 @@ class BasicRemoteModule {
3072
554
  * @param version - Module version (semver).
3073
555
  * @param description - Optional module description.
3074
556
  */
3075
- constructor(s, d, u, h) {
3076
- this.id = s, this.name = d, this.version = u, this.description = h;
557
+ constructor(o, n, t, i) {
558
+ this.id = o, this.name = n, this.version = t, this.description = i;
3077
559
  }
3078
560
  /**
3079
561
  * Setup phase - validate dependencies and prepare the module.
@@ -3099,7 +581,7 @@ class BasicRemoteModule {
3099
581
  * @param config - Module-specific configuration from host.
3100
582
  * @returns Promise resolving to the lifecycle result.
3101
583
  */
3102
- async configure(s) {
584
+ async configure(o) {
3103
585
  return { success: !0 };
3104
586
  }
3105
587
  /**
@@ -3143,15 +625,25 @@ class BasicRemoteModule {
3143
625
  }
3144
626
  }
3145
627
  export {
3146
- BasicRemoteModule,
3147
- _sfc_main as LinidZoneRenderer,
3148
- ModuleLifecyclePhase,
3149
- getHttpClient,
3150
- getUiDesign,
3151
- loadAsyncComponent,
3152
- setHttpClient,
3153
- setUiDesign,
3154
- useLinidConfigurationStore,
3155
- useLinidZoneStore,
3156
- useUiDesign
628
+ ct as BasicRemoteModule,
629
+ Qe as LinidZoneRenderer,
630
+ Ze as ModuleLifecyclePhase,
631
+ it as deleteEntityById,
632
+ rt as getEntities,
633
+ st as getEntityById,
634
+ O as getHttpClient,
635
+ ze as getModuleFederation,
636
+ L as getModuleHostConfiguration,
637
+ Te as getUiDesign,
638
+ Fe as loadAsyncComponent,
639
+ tt as registerModuleHostConfiguration,
640
+ nt as saveEntity,
641
+ Ke as setHttpClient,
642
+ Je as setModuleFederation,
643
+ Ge as setUiDesign,
644
+ ot as updateEntity,
645
+ et as useLinidConfigurationStore,
646
+ He as useLinidZoneStore,
647
+ Ye as usePagination,
648
+ Xe as useUiDesign
3157
649
  };