@module-federation/bridge-vue3 0.0.0-chore-bump-node-22-20260710161714

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