@module-federation/bridge-vue3 2.7.0 → 2.8.0
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/create.d.ts +28 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +4 -1
- package/dist/index.js +751 -698
- package/dist/provider.d.ts +27 -0
- package/dist/remoteApp.d.ts +18 -0
- package/dist/routeUtils.d.ts +21 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +6 -7
package/dist/create.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AsyncComponentOptions } from 'vue';
|
|
2
|
+
export declare function createRemoteAppComponent(info: {
|
|
3
|
+
loader: () => Promise<any>;
|
|
4
|
+
export?: string;
|
|
5
|
+
asyncComponentOptions?: Omit<AsyncComponentOptions, 'loader'>;
|
|
6
|
+
rootAttrs?: Record<string, unknown>;
|
|
7
|
+
memoryRoute?: {
|
|
8
|
+
entryPath: string;
|
|
9
|
+
};
|
|
10
|
+
hashRoute?: boolean;
|
|
11
|
+
}): {
|
|
12
|
+
render(): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated createRemoteComponent is deprecated, please use createRemoteAppComponent instead!
|
|
18
|
+
*/
|
|
19
|
+
export declare function createRemoteComponent(info: {
|
|
20
|
+
loader: () => Promise<any>;
|
|
21
|
+
export?: string;
|
|
22
|
+
asyncComponentOptions?: Omit<AsyncComponentOptions, 'loader'>;
|
|
23
|
+
rootAttrs?: Record<string, unknown>;
|
|
24
|
+
}): {
|
|
25
|
+
render(): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`),r=t.filter(o=>!
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("vue"),Ce=require("vue-router");function ot(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Yt=ot(v),he=ot(Ce),Qt=".json",er="FEDERATION_DEBUG",tr=":";let Ne=function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e}({});const U=typeof ENV_TARGET<"u"?ENV_TARGET==="web":typeof window<"u"&&typeof window.document<"u";function nt(){return U}function st(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function rr(){try{if(nt()&&window.localStorage)return!!localStorage.getItem(er)}catch{return!1}return!1}function Ae(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:rr()}const or="[ Federation Runtime ]",it=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}${tr}${r}`:r:t,""):""},Me=(e,t)=>{if("getPublicPath"in e){let r;return e.getPublicPath.startsWith("function")?r=new Function("return "+e.getPublicPath)()():r=new Function(e.getPublicPath)(),`${r}${t}`}else return"publicPath"in e?!nt()&&!st()&&"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),"")},at=e=>{console.warn(`${or}: ${e}`)};function ct(e){try{return JSON.stringify(e,null,2)}catch{return""}}const Se=(e,t)=>{if(!e)return t;const o=(n=>{if(n===".")return"";if(n.startsWith("./"))return n.replace("./","");if(n.startsWith("/")){const s=n.slice(1);return s.endsWith("/")?s.slice(0,-1):s}return n})(e);return o?o.endsWith("/")?`${o}${t}`:`${o}/${t}`:t};function nr(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function sr(e,t={}){var R;const{remotes:r={},overrides:o={},version:n}=t;let s;const i=()=>"publicPath"in e.metaData?(e.metaData.publicPath==="auto"||e.metaData.publicPath==="")&&n?nr(n):e.metaData.publicPath:e.metaData.getPublicPath,c=Object.keys(o);let a={};Object.keys(r).length||(a=((R=e.remotes)==null?void 0:R.reduce((g,_)=>{let b;const I=_.federationContainerName;return c.includes(I)?b=o[I]:"version"in _?b=_.version:b=_.entry,g[I]={matchedVersion:b},g},{}))||{}),Object.keys(r).forEach(g=>a[g]={matchedVersion:c.includes(g)?o[g]:r[g]});const{remoteEntry:{path:l,name:u,type:f},types:m={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:h},globalName:d,ssrRemoteEntry:p}=e.metaData,{exposes:E}=e;let y={version:n||"",buildVersion:h,globalName:d,remoteEntry:Se(l,u),remoteEntryType:f,remoteTypes:Se(m.path,m.name),remoteTypesZip:m.zip||"",remoteTypesAPI:m.api||"",remotesInfo:a,shared:e==null?void 0:e.shared.map(g=>({assets:g.assets,sharedName:g.name,version:g.version,usedExports:g.referenceExports||[]})),modules:E==null?void 0:E.map(g=>({moduleName:g.name,modulePath:g.path,assets:g.assets}))};if("publicPath"in e.metaData?(s={...y,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(s.ssrPublicPath=e.metaData.ssrPublicPath)):s={...y,getPublicPath:i()},p){const g=Se(p.path,p.name);s.ssrRemoteEntry=g,s.ssrRemoteEntryType=p.type||"commonjs-module"}return s}function lt(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(Qt))}const ir="[ Module Federation ]",Q=console,ar=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function cr(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
|
|
2
|
+
`),r=t.filter(o=>!ar.some(n=>o.includes(n)));return r.length?`Stack trace:
|
|
3
3
|
${r.slice(0,5).join(`
|
|
4
|
-
`)}`:void 0}catch{return}}var
|
|
5
|
-
})`,{filename:E,importModuleDynamically:((l=h.constants)==null?void 0:l.USE_MAIN_CONTEXT_DEFAULT_LOADER)??
|
|
4
|
+
`)}`:void 0}catch{return}}var ut=class{constructor(e,t=Q){this.prefix=e,this.delegate=t??Q}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??Q}emit(e,t){const r=this.delegate,o=Ae()?cr():void 0,n=o?[...t,o]:t,s=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(const i of s){const c=r[i];if(typeof c=="function"){c.call(r,this.prefix,...n);return}}for(const i of s){const c=Q[i];if(typeof c=="function"){c.call(Q,this.prefix,...n);return}}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){Ae()&&this.emit("debug",e)}};function ft(e){return new ut(e)}function lr(e){const t=new ut(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}lr(ir);async function ht(e,t){try{return await e()}catch(r){at(r);return}}function Pe(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function dt(e){let t=null,r=!0,o=2e4,n;const s=document.getElementsByTagName("script");for(let l=0;l<s.length;l++){const u=s[l],f=u.getAttribute("src");if(f&&Pe(f,e.url)){t=u,r=!1;break}}if(!t){const l=e.attrs;t=document.createElement("script"),t.type=(l==null?void 0:l.type)==="module"?"module":"text/javascript";let u;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=>{t&&(f==="async"||f==="defer"?t[f]=l[f]:t.getAttribute(f)||t.setAttribute(f,l[f]))})}let i=null;const c=typeof window<"u"?l=>{if(l.filename&&Pe(l.filename,e.url)){const u=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${l.message} (${l.filename}:${l.lineno}:${l.colno})`);u.name="ScriptExecutionError",i=u}}:null;c&&window.addEventListener("error",c);const a=async(l,u)=>{clearTimeout(n),c&&window.removeEventListener("error",c);const f=()=>{if((u==null?void 0:u.type)==="error"){const m=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.)`);m.name="ScriptNetworkError",e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(m))}else i?e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(i)):e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,ht(()=>{const{needDeleteScript:m=!0}=e;m&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),l&&typeof l=="function")){const m=l(u);if(m instanceof Promise){const h=await m;return f(),h}return f(),m}f()};return t.onerror=a.bind(null,t.onerror),t.onload=a.bind(null,t.onload),n=setTimeout(()=>{a(null,{type:"error",isTimeout:!0})},o),{script:t,needAttach:r}}function ur(e){let t=null,r=!0,o=2e4,n;const s=document.getElementsByTagName("link");for(let c=0;c<s.length;c++){const a=s[c],l=a.getAttribute("href"),u=a.getAttribute("rel");if(l&&Pe(l,e.url)&&u===e.attrs.rel){t=a,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let c,a=!0;const l=e.attrs;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=>{t&&!t.getAttribute(u)&&t.setAttribute(u,l[u])})}if(!r)return Promise.resolve().then(()=>{e!=null&&e.cb&&(e==null||e.cb())}),{link:t,needAttach:r};const i=(c,a)=>{n&&clearTimeout(n);const l=()=>{if((a==null?void 0:a.type)==="error"){const u=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.`);u.name="LinkNetworkError",e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(u))}else e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,ht(()=>{const{needDeleteLink:u=!0}=e;u&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),c)){const u=c(a);return l(),u}l()};return t.onerror=i.bind(null,t.onerror),t.onload=i.bind(null,t.onload),n=setTimeout(()=>{i(null,{type:"error",isTimeout:!0})},o),{link:t,needAttach:r}}function fr(e,t){const{attrs:r={},createScriptHook:o}=t;return new Promise((n,s)=>{const{script:i,needAttach:c}=dt({url:e,cb:n,onErrorCallback:s,attrs:{fetchpriority:"high",...r},createScriptHook:o,needDeleteScript:!0});c&&document.head.appendChild(i)})}const le=new Map;function G(e){if(!e)throw new Error("import specifier is required");if(le.has(e))return le.get(e);const t=new Function("name","return import(name)")(e).then(r=>r).catch(r=>{throw console.error(`Error importing module ${e}:`,r),le.delete(e),r});return le.set(e,t),t}const hr=async(e,t,r)=>{const n=await((s,i)=>r.lifecycle.fetch.emit(s,i))(e,t||{});return!n||!(n instanceof Response)?fetch(e,t||{}):n},dr=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t,r,o)=>{if(o!=null&&o.createScriptHook){const c=o.createScriptHook(e);c&&typeof c=="object"&&"url"in c&&(e=c.url)}let n;try{n=new URL(e)}catch(c){console.error("Error constructing URL:",c),t(new Error(`Invalid URL: ${c}`));return}const s=async()=>o!=null&&o.fetch?(c,a)=>hr(c,a,o):fetch,i=async(c,a)=>{var l;try{const f=await(await c(a.href)).text(),[m,h]=await Promise.all([G("path"),G("vm")]),d={exports:{},module:{exports:{}}},p=a.pathname.split("/").slice(0,-1).join("/"),E=m.basename(a.pathname),y=new h.Script(`(function(exports, module, require, __dirname, __filename) {${f}
|
|
5
|
+
})`,{filename:E,importModuleDynamically:((l=h.constants)==null?void 0:l.USE_MAIN_CONTEXT_DEFAULT_LOADER)??G});let R;R=(await G("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);const g=d.module.exports||d.exports;if(r&&g&&r.globalName){t(void 0,g[r.globalName]||g);return}t(void 0,g)}catch(u){t(u instanceof Error?u:new Error(`Script execution error: ${u}`))}};s().then(async c=>{if((r==null?void 0:r.type)==="esm"||(r==null?void 0:r.type)==="module")return yt(n.href,{fetch:c,vm:await G("vm")}).then(async a=>{await a.evaluate(),t(void 0,a.namespace)}).catch(a=>{t(a instanceof Error?a:new Error(`Script execution error: ${a}`))});i(c,n)}).catch(c=>{t(c)})}:(e,t,r,o)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},mr=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t)=>new Promise((r,o)=>{dr(e,(n,s)=>{var i,c;if(n)o(n);else{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__`;r(globalThis[a]=s)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},Z=new Map,mt=e=>e.startsWith("http:")||e.startsWith("https:"),pt=e=>!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("/")&&!e.includes(":");function pr(e){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}`);return`/${r}/${o}${n}${s?`/${s}`:""}`}function yr(e,t){const r=t.endsWith("/")?t:`${t}/`;return new URL(`__module_federation_remote__${pr(e)}`,r).href}async function Er(e){return e.startsWith("node:")?!0:pt(e)?(await G("node:module")).builtinModules.includes(e):!1}function gr(e){const t=e&&(typeof e=="object"||typeof e=="function")?e:{default:e},r={...t};return Object.prototype.hasOwnProperty.call(r,"default")||(r.default=t),r}async function Rr(e,t,r){if(typeof r.SyntheticModule!="function")throw new Error("vm.SyntheticModule is required to load Node.js built-in modules in ESM remote entries.");const o=gr(t),n=Object.keys(o),s=new r.SyntheticModule(n,function(){for(const c of n)this.setExport(c,o[c])},{identifier:e});return Z.set(e,s),await s.link(async()=>{throw new Error(`Node.js built-in module "${e}" should not request child modules.`)}),await s.evaluate(),s}async function _r(e,t){const r=`node-builtin:${e}`;return Z.has(r)?Z.get(r):Rr(r,await G(e),t)}async function We(e,t,r){if(await Er(e))return _r(e,r.vm);if(pt(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.`);const o=new URL(e,t).href;if(!mt(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.`);return yt(o,r)}async function br(e){if(e.status==="linked"&&await e.evaluate(),e.status==="errored")throw e.error;return e}async function yt(e,t){if(Z.has(e))return Z.get(e);const{fetch:r,vm:o}=t;if(!mt(e))throw new Error(`Unsupported ESM module URL "${e}". Only http(s) remote modules and Node.js built-in modules are supported.`);const n=await(await r(e)).text(),s=(await G("node:url")).pathToFileURL(process.cwd()).href,i=new o.SourceTextModule(n,{identifier:e,initializeImportMeta:c=>{c.url=yr(e,s)},importModuleDynamically:async c=>br(await We(c,e,t))});return Z.set(e,i),await i.link(async c=>We(c,e,t)),i}const D=ft("[ Module Federation Bridge Vue3 ]"),Sr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,Et=(e,t,r,o)=>{const n=[`${[t[e]]} #${e}`];return r&&n.push(`args: ${JSON.stringify(r)}`),n.push(Sr(e)),o&&n.push(`Original Error Message:
|
|
6
6
|
${o}`),n.join(`
|
|
7
|
-
`)};function _r(e,t,r,o,n,s){return o(dt(e,t,r,n))}const U="[ Federation Runtime ]",Pe=at(U);function C(e,t,r,o,n){e||w(t)}function w(e,t,r,o,n){if(t!==void 0)return _r(e,t,r??{},i=>{throw new Error(`${U}: ${i}`)},o);const s=e;throw s instanceof Error?(s.message.startsWith(U)||(s.message=`${U}: ${s.message}`),s):new Error(`${U}: ${s}`)}function oe(e){e instanceof Error&&(e.message.startsWith(U)||(e.message=`${U}: ${e.message}`)),Pe.warn(e)}function br(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function ne(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Oe(e){return typeof e.entry<"u"}function mt(e){return!e.entry.includes(".json")}function Ce(e){return e&&typeof e=="object"}const Sr=Object.prototype.toString;function wr(e){return Sr.call(e)==="[object Object]"}function pt(e){return Array.isArray(e)?e:[e]}function yt(e){const t={url:"",type:"global",globalName:""};return G||tt()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}const $r=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},T=typeof globalThis=="object"?globalThis:window,L=(()=>{try{return document.defaultView}catch{return T}})(),Re=L;function he(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function de(e,t){return Object.hasOwnProperty.call(e,t)}de(T,"__GLOBAL_LOADING_REMOTE_ENTRY__")||he(T,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const K=T.__GLOBAL_LOADING_REMOTE_ENTRY__;function Et(e){var t,r,o,n,s,i;de(e,"__VMOK__")&&!de(e,"__FEDERATION__")&&he(e,"__FEDERATION__",e.__VMOK__),de(e,"__FEDERATION__")||(he(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),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__=new Map)}Et(T);Et(L);function Ir(e,t=Ne()){t&&(T.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,T.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.7.0")}function V(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const o of r){const[n,s]=o.split(":"),i=`${n}:${t}`,c=e[i];if(c)return{value:c,key:i}}return{value:void 0,key:t}}}else w(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const Ve=()=>L.__FEDERATION__.moduleInfo,vr=(e,t)=>{const r=V(t,ne(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){const{version:o,...n}=e,s=ne(n),i=V(L.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===o)return i}},me=e=>vr(e,L.__FEDERATION__.moduleInfo),We=(e,t)=>{const r=ne(e);return L.__FEDERATION__.moduleInfo[r]=t,L.__FEDERATION__.moduleInfo},Nr=e=>(L.__FEDERATION__.moduleInfo={...L.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete L.__FEDERATION__.moduleInfo[r]}),Fe=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:T[r]}},Tr=()=>L.__FEDERATION__.__GLOBAL_PLUGIN__,Ar=e=>T.__FEDERATION__.__PRELOADED_MAP__.get(e),Pr=e=>T.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),qe="[0-9A-Za-z-]+",He=`(?:\\+(${qe}(?:\\.${qe})*))`,re="0|[1-9]\\d*",pe="[0-9]+",gt="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Ke=`(?:${pe}|${gt})`,kr=`(?:-?(${Ke}(?:\\.${Ke})*))`,ze=`(?:${re}|${gt})`,Rt=`(?:-(${ze}(?:\\.${ze})*))`,Se=`${re}|x|X|\\*`,Z=`[v=\\s]*(${Se})(?:\\.(${Se})(?:\\.(${Se})(?:${Rt})?${He}?)?)?`,Mr=`^\\s*(${Z})\\s+-\\s+(${Z})\\s*$`,Lr=`[v=\\s]*${`(${pe})\\.(${pe})\\.(${pe})`}${kr}?${He}?`,De="((?:<|>)?=?)",Or=`(\\s*)${De}\\s*(${Lr}|${Z})`,_t="(?:~>?)",Cr=`(\\s*)${_t}\\s+`,bt="(?:\\^)",Fr=`(\\s*)${bt}\\s+`,Hr="(<|>)?=?\\s*\\*",Dr=`^${bt}${Z}$`,xr=`v?${`(${re})\\.(${re})\\.(${re})`}${Rt}?${He}?`,Gr=`^${_t}${Z}$`,Ur=`^${De}\\s*${Z}$`,Br=`^${De}\\s*(${xr})$|^$`,jr="^\\s*>=\\s*0.0.0\\s*$";function O(e){return new RegExp(e)}function A(e){return!e||e.toLowerCase()==="x"||e==="*"}function St(...e){return t=>e.reduce((r,o)=>o(r),t)}function Je(e){return e.match(O(Br))}function Xe(e,t,r,o){const n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function Vr(e){return e.replace(O(Mr),(t,r,o,n,s,i,c,a,l,u,f,m)=>(A(o)?r="":A(n)?r=`>=${o}.0.0`:A(s)?r=`>=${o}.${n}.0`:r=`>=${r}`,A(l)?a="":A(u)?a=`<${Number(l)+1}.0.0-0`:A(f)?a=`<${l}.${Number(u)+1}.0-0`:m?a=`<=${l}.${u}.${f}-${m}`:a=`<=${a}`,`${r} ${a}`.trim()))}function Wr(e){return e.replace(O(Or),"$1$2$3")}function qr(e){return e.replace(O(Cr),"$1~")}function Kr(e){return e.replace(O(Fr),"$1^")}function zr(e){return e.trim().split(/\s+/).map(t=>t.replace(O(Dr),(r,o,n,s,i)=>A(o)?"":A(n)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:A(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(" ")}function Jr(e){return e.trim().split(/\s+/).map(t=>t.replace(O(Gr),(r,o,n,s,i)=>A(o)?"":A(n)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:A(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(" ")}function Xr(e){return e.split(/\s+/).map(t=>t.trim().replace(O(Ur),(r,o,n,s,i,c)=>{const a=A(n),l=a||A(s),u=l||A(i);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})).join(" ")}function Yr(e){return e.trim().replace(O(Hr),"")}function Zr(e){return e.trim().replace(O(jr),"")}function ye(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Qr(e,t){const{preRelease:r}=e,{preRelease:o}=t;if(r===void 0&&o)return 1;if(r&&o===void 0)return-1;if(r===void 0&&o===void 0)return 0;for(let n=0,s=r.length;n<=s;n++){const i=r[n],c=o[n];if(i!==c)return i===void 0&&c===void 0?0:i?c?ye(i,c):-1:1}return 0}function le(e,t){return ye(e.major,t.major)||ye(e.minor,t.minor)||ye(e.patch,t.patch)||Qr(e,t)}function we(e,t){return e.version===t.version}function eo(e,t){switch(e.operator){case"":case"=":return we(e,t);case">":return le(e,t)<0;case">=":return we(e,t)||le(e,t)<0;case"<":return le(e,t)>0;case"<=":return we(e,t)||le(e,t)>0;case void 0:return!0;default:return!1}}function to(e){return St(zr,Jr,Xr,Yr)(e)}function ro(e){return St(Vr,Wr,qr,Kr)(e.trim()).split(/\s+/).join(" ")}function te(e,t){if(!e)return!1;const r=Je(e);if(!r)return!1;const[,o,,n,s,i,c]=r,a={operator:o,version:Xe(n,s,i,c),major:n,minor:s,patch:i,preRelease:c==null?void 0:c.split(".")},l=t.split("||");for(const u of l){const f=u.trim();if(!f||f==="*"||f==="x")return!0;try{const m=ro(f);if(!m.trim())return!0;const h=m.split(" ").map(E=>to(E)).join(" ");if(!h.trim())return!0;const d=h.split(/\s+/).map(E=>Zr(E)).filter(Boolean);if(d.length===0)continue;let p=!0;for(const E of d){const y=Je(E);if(!y){p=!1;break}const[,R,,g,_,b,$]=y;if(!eo({operator:R,version:Xe(g,_,b,$),major:g,minor:_,patch:b,preRelease:$==null?void 0:$.split(".")},a)){p=!1;break}}if(p)return!0}catch(m){console.error(`[semver] Error processing range part "${f}":`,m);continue}}return!1}const ae="default",wt="global";function oo(e,t,r,o){var s,i;let n;return"get"in e?n=e.get:"lib"in e?n=()=>Promise.resolve(e.lib):n=()=>Promise.resolve(()=>{w(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),(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.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:n,loaded:e!=null&&e.loaded||"lib"in e?!0:void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??o)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??ve.UNKNOWN,useIn:[]}:void 0}}function $t(e,t){const r=t.shared||{},o=t.name,n=Object.keys(r).reduce((i,c)=>{const a=pt(r[c]);return i[c]=i[c]||[],a.forEach(l=>{i[c].push(oo(l,o,c,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(n).forEach(i=>{s[i]?n[i].forEach(c=>{s[i].find(a=>a.version===c.version)||s[i].push(c)}):s[i]=n[i]}),{allShareInfos:s,newShareInfos:n}}function se(e,t){if(!e)return!1;const{status:r,mode:o}=e;return r===ve.NO_USE?!1:r===ve.CALCULATED?!0:o==="runtime-infer"?t?so(e,t):!0:!1}function B(e,t){const r=o=>{if(!Number.isNaN(Number(o))){const n=o.split(".");let s=o;for(let i=0;i<3-n.length;i++)s+=".0";return s}return o};return!!te(r(e),`<=${r(t)}`)}const ie=(e,t)=>{const r=t||function(o,n){return B(o,n)};return Object.keys(e).reduce((o,n)=>!o||r(o,n)||o==="0"?n:o,0)},ge=e=>!!e.loaded||typeof e.lib=="function",no=e=>!!e.loading,so=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(o=>r.includes(o)):!1};function io(e,t,r,o){const n=e[t][r];let s="",i=se(o);const c=function(a,l){return i?n[a].treeShaking?n[l].treeShaking?!ge(n[a].treeShaking)&&B(a,l):!1:!0:!ge(n[a])&&B(a,l)};if(i){if(s=ie(e[t][r],c),s)return{version:s,useTreesShaking:i};i=!1}return{version:ie(e[t][r],c),useTreesShaking:i}}const W=e=>ge(e)||no(e);function ao(e,t,r,o){const n=e[t][r];let s="",i=se(o);const c=function(a,l){if(i){if(!n[a].treeShaking)return!0;if(!n[l].treeShaking)return!1;if(W(n[l].treeShaking))return W(n[a].treeShaking)?!!B(a,l):!0;if(W(n[a].treeShaking))return!1}return W(n[l])?W(n[a])?!!B(a,l):!0:W(n[a])?!1:B(a,l)};if(i){if(s=ie(e[t][r],c),s)return{version:s,useTreesShaking:i};i=!1}return{version:ie(e[t][r],c),useTreesShaking:i}}function co(e){return e==="loaded-first"?ao:io}function Ee(e,t,r,o){if(!e)return;const{shareConfig:n,scope:s=ae,strategy:i,treeShaking:c}=r,a=Array.isArray(s)?s:[s];for(const l of a)if(n&&e[l]&&e[l][t]){const{requiredVersion:u}=n,{version:f,useTreesShaking:m}=co(i)(e,l,t,c),h=()=>{const p=e[l][t][f];if(n.singleton){if(typeof u=="string"&&!te(f,u)){const E=`Version ${f} from ${f&&p.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;n.strictVersion?w(E):oe(E)}return{shared:p,useTreesShaking:m}}else{if(u===!1||u==="*")return{shared:p,useTreesShaking:m};if(te(f,u))return{shared:p,useTreesShaking:m};const E=se(c);if(E){for(const[y,R]of Object.entries(e[l][t]))if(se(R.treeShaking,c==null?void 0:c.usedExports)&&te(y,u))return{shared:R,useTreesShaking:E}}for(const[y,R]of Object.entries(e[l][t]))if(te(y,u))return{shared:R,useTreesShaking:!1}}},d={shareScopeMap:e,scope:l,pkgName:t,version:f,GlobalFederation:Re.__FEDERATION__,shareInfo:r,resolver:h};return(o.emit(d)||d).resolver()}}function It(){return Re.__FEDERATION__.__SHARE__}function Ye(e){const{pkgName:t,extraOptions:r,shareInfos:o}=e,n=a=>{if(!a)return;const l={};return a.forEach(f=>{l[f.version]=f}),l[ie(l,function(f,m){return!ge(l[f])&&B(f,m)})]},s=(r==null?void 0:r.resolver)??n,i=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),c=(...a)=>{const l={};for(const u of a)if(u)for(const[f,m]of Object.entries(u)){const h=l[f];i(h)&&i(m)?l[f]=c(h,m):m!==void 0&&(l[f]=m)}return l};return c(s(o[t]),r==null?void 0:r.customShareInfo)}const q=(e,t)=>{e.useIn||(e.useIn=[]),br(e.useIn,t)};function ue(e,t){return t&&e.treeShaking?e.treeShaking:e}function xe(e,t){return!t||t==="."?e:`${e}/${t.replace(/^\.\//,"")}`}function Ze(e,t){for(const r of e){const o=t.startsWith(r.name);let n=t.replace(r.name,"");if(o){if(n.startsWith("/")){const c=r.name;return n=`.${n}`,{pkgNameOrAlias:c,expose:n,remote:r}}else if(n==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const s=r.alias&&t.startsWith(r.alias);let i=r.alias&&t.replace(r.alias,"");if(r.alias&&s){if(i&&i.startsWith("/")){const c=r.alias;return i=`.${i}`,{pkgNameOrAlias:c,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function lo(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const vt="RUNTIME-001",Nt="RUNTIME-002",Tt="RUNTIME-003",At="RUNTIME-004",Pt="RUNTIME-005",ke="RUNTIME-006",kt="RUNTIME-007",Ge="RUNTIME-008",uo="RUNTIME-009",Mt="RUNTIME-010",Lt="RUNTIME-011",fo="RUNTIME-012",Ot="RUNTIME-013",Ct="RUNTIME-014",Ft="RUNTIME-015",k={[vt]:"Failed to get remoteEntry exports.",[Nt]:'The remote entry interface does not contain "init"',[Tt]:"Failed to get manifest.",[At]:"Failed to locate remote.",[Pt]:"Invalid loadShareSync function call from bundler runtime",[ke]:"Invalid loadShareSync function call from runtime",[kt]:"Failed to get remote snapshot.",[Ge]:"Failed to load script resources.",[uo]:"Please call createInstance first.",[Mt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[Lt]:"The remoteEntry URL is missing from the remote snapshot.",[fo]:'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.',[Ot]:"The manifest is not a valid Module Federation manifest.",[Ct]:"The remote does not expose the requested module.",[Ft]:"Remote container initialization failed."};({...k});const Ht=".then(callbacks[0]).catch(callbacks[1])";async function ho({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Ht}`)([r,o]):import(e).then(r).catch(o)}catch(n){w(`Failed to load ESM entry from "${e}". ${n instanceof Error?n.message:String(n)}`)}})}async function mo({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(o):new Function("callbacks",`System.import("${e}")${Ht}`)([r,o])}catch(n){w(`Failed to load SystemJS entry from "${e}". ${n instanceof Error?n.message:String(n)}`)}})}function Dt(e,t,r){const{remoteEntryKey:o,entryExports:n}=Fe(e,t);return n||w(vt,k,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o}),n}async function po({name:e,globalName:t,entry:r,remoteInfo:o,loaderHook:n,getEntryUrl:s,resourceContext:i}){const{entryExports:c}=Fe(e,t);if(c)return c;const a=s?s(r):r;return cr(a,{attrs:{},createScriptHook:(l,u)=>{const f=n.lifecycle.createScript.emit({url:l,attrs:u,remoteInfo:o,resourceContext:i?{...i,url:l}:void 0});if(f&&(f instanceof HTMLScriptElement||"script"in f||"timeout"in f))return f}}).then(()=>Dt(e,t,r),l=>{const u=l instanceof Error?l.message:String(l);w(Ge,k,{remoteName:e,resourceUrl:a},u)})}async function yo({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o,resourceContext:n}){const{entry:s,entryGlobalName:i,name:c,type:a}=e;switch(a){case"esm":case"module":return ho({entry:s,remoteEntryExports:t});case"system":return mo({entry:s,remoteEntryExports:t});default:return po({entry:s,globalName:i,name:c,remoteInfo:e,loaderHook:r,getEntryUrl:o,resourceContext:n})}}async function Eo({remoteInfo:e,loaderHook:t,resourceContext:r}){const{entry:o,entryGlobalName:n,name:s,type:i}=e,{entryExports:c}=Fe(s,n);return c||fr(o,{attrs:{name:s,globalName:n,type:i},loaderHook:{createScriptHook:(a,l={})=>{const u=t.lifecycle.createScript.emit({url:a,attrs:l,remoteInfo:e,resourceContext:r?{...r,url:a}:void 0});if(u&&"url"in u)return u}}}).then(()=>Dt(s,n,o)).catch(a=>{w(`Failed to load Node.js entry for remote "${s}" from "${o}". ${a instanceof Error?a.message:String(a)}`)})}function Me(e){const{entry:t,name:r}=e;return rt(r,t)}async function Ue(e){const{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,resourceContext:s,_inErrorHandling:i=!1}=e,c=Me(o);if(r)return r;if(!K[c]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;K[c]=a.emit({origin:t,loaderHook:l,remoteInfo:o,remoteEntryExports:r}).then(u=>u||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":G)?yo({remoteInfo:o,remoteEntryExports:r,loaderHook:l,getEntryUrl:n,resourceContext:s}):Eo({remoteInfo:o,loaderHook:l,resourceContext:s}))).then(async u=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:u}),u)).catch(async u=>{const f=Me(o),m=u instanceof Error&&u.message.includes("ScriptExecutionError");if(u instanceof Error&&u.message.includes(Ge)&&!m&&!i){const h=p=>Ue({...p,_inErrorHandling:!0}),d=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:o,remoteEntryExports:r,globalLoading:K,uniqueKey:f});if(d)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:d,recovered:!0}),d}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,error:u}),u})}return K[c]}function z(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||wt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ae}}function go(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function Ro(e,t){const r=Tr(),o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(n=>{e!=null&&e.find(s=>s.name!==n.name)&&e.push(n)}),e&&e.length>0&&e.forEach(n=>{o.forEach(s=>{s.applyPlugin(n,t)})}),e}function _o(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function H(e){var r,o,n,s,i,c;const t={};for(const[a,l]of Object.entries(e.shared)){const u=l[0];u&&(t[a]={version:u.version,singleton:(r=u.shareConfig)==null?void 0:r.singleton,requiredVersion:((o=u.shareConfig)==null?void 0:o.requiredVersion)===!1?!1:(n=u.shareConfig)==null?void 0:n.requiredVersion,eager:u.eager,strictVersion:(s=u.shareConfig)==null?void 0:s.strictVersion})}return{project:{name:e.name,mfRole:((i=e.remotes)==null?void 0:i.length)>0?"host":"unknown"},mfConfig:{name:e.name,remotes:((c=e.remotes)==null?void 0:c.map(_o))??[],shared:t}}}function xt(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function bo(e,t){return t.map(r=>{const o=lo(e,r.nameOrAlias);return C(o,`Unable to preload ${r.nameOrAlias} as it is not included in ${!o&&nt({remoteInfo:o,remotes:e})}`),{remote:o,preloadConfig:xt(r)}})}function So(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Be(e){return e instanceof Error?e.message.includes("timed out")||e.name.includes("Timeout"):!1}function j(e,t,r,o){return{url:t,status:r,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:o}}async function wo(e,t,r,o){const n=e.moduleCache.get(r.name),s=r.entry;if(n!=null&&n.remoteEntryExports)return j(o,s,"cached");try{if(!await Ue({origin:e,remoteInfo:r,remoteEntryExports:n==null?void 0:n.remoteEntryExports,resourceContext:{...o,url:s}}))throw new Error(`Failed to load remoteEntry "${s}".`);return j(o,s,"success")}catch(i){return j(o,s,Be(i)?"timeout":"error",i)}}function $e({host:e,remoteInfo:t,url:r,attrs:o,context:n,needDeleteLink:s}){return new Promise(i=>{const{link:c,needAttach:a}=ar({url:r,cb:()=>{i(j(n,r,a?"success":"cached"))},onErrorCallback:l=>{i(j(n,r,Be(l)?"timeout":"error",l))},attrs:o,createLinkHook:(l,u)=>{const f=e.loaderHook.lifecycle.createLink.emit({url:l,attrs:u,remoteInfo:t,resourceContext:{...n,url:l}});return f instanceof HTMLLinkElement,f},needDeleteLink:s});a&&document.head.appendChild(c)})}function $o({host:e,remoteInfo:t,url:r,attrs:o,context:n}){return new Promise(s=>{const{script:i,needAttach:c}=lt({url:r,cb:()=>{s(j(n,r,c?"success":"cached"))},onErrorCallback:a=>{s(j(n,r,Be(a)?"timeout":"error",a))},attrs:o,createScriptHook:(a,l)=>{const u=e.loaderHook.lifecycle.createScript.emit({url:a,attrs:l,remoteInfo:t,resourceContext:{...n,url:a}});return u instanceof HTMLScriptElement,u},needDeleteScript:!0});c&&document.head.appendChild(i)})}function ee(e,t){return{...e,resourceType:t}}function Gt(e,t,r,o=!0,n={initiator:"preloadRemote",id:e.name}){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:c}=r,a=[];if(t.options.inBrowser){if(c.forEach(l=>{const{moduleInfo:u}=l;a.push(wo(t,e,u,ee(n,"remoteEntry")))}),o){const l={rel:"preload",as:"style"};s.forEach(u=>{a.push($e({host:t,remoteInfo:e,url:u,attrs:l,context:ee(n,"css")}))})}else{const l={rel:"stylesheet",type:"text/css"};s.forEach(u=>{a.push($e({host:t,remoteInfo:e,url:u,attrs:l,needDeleteLink:!1,context:ee(n,"css")}))})}if(o){const l={rel:"preload",as:"script"};i.forEach(u=>{a.push($e({host:t,remoteInfo:e,url:u,attrs:l,context:ee(n,"js")}))})}else{const l={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};i.forEach(u=>{a.push($o({host:t,remoteInfo:e,url:u,attrs:l,context:ee(n,"js")}))})}}return Promise.all(a)}function Io(e){if(!e||!("modules"in e)||!Array.isArray(e.modules))return;const t=e.modules.map(r=>r.moduleName).filter(Boolean);return t.length?t.join(","):void 0}function vo(e,t,r){const o=t,n=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];n.length||n.push("default"),n.forEach(i=>{o[i]||(o[i]={})});const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?n:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:o,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:o[n[0]],initScope:r??[]}}var Ut=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e){if(this.remoteEntryExports)return this.remoteEntryExports;const t=await Ue({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:{initiator:"loadRemote",id:xe(this.remoteInfo.name,e),resourceType:"remoteEntry"}});return C(t,`remoteEntryExports is undefined
|
|
8
|
-
${nt(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async init(e,t,r,o){const n=await this.getEntry(o);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host}),n;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host})}catch(s){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:s,cached:!0,origin:this.host}),s}return n}this.initing=!0,this.initPromise=(async()=>{await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});const{remoteEntryInitOptions:s,shareScope:i,initScope:c}=vo(this.remoteInfo,this.host.shareScopeMap,r),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:i,remoteEntryInitOptions:s,initScope:c,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&w(Nt,k,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,H(this.host.options));try{await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions)}catch(l){w(Ft,k,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${l}`,H(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,origin:this.host})}catch(s){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:s,origin:this.host}),s}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,o){const{loadFactory:n=!0}=r||{loadFactory:!0},s=await this.init(e,o,void 0,t);this.lib=s,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,origin:this.host});let i;try{const l=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo});i=typeof l=="function"?l:void 0,i||(i=await s.get(t)),i||w(Ct,k,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:Io(o)},void 0,H(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,moduleFactory:i,origin:this.host})}catch(l){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,error:l,origin:this.host}),l}const c=$r(this.remoteInfo.name,t),a=this.wraperFactory(i,c);if(!n)return a;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,origin:this.host});try{const l=await a();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,exposeModule:l,origin:this.host}),l}catch(l){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,error:l,origin:this.host}),l}}wraperFactory(e,t){function r(o,n){o&&typeof o=="object"&&Object.isExtensible(o)&&!Object.getOwnPropertyDescriptor(o,Symbol.for("mf_module_id"))&&Object.defineProperty(o,Symbol.for("mf_module_id"),{value:n,enumerable:!1})}return()=>{const o=e();return o instanceof Promise?o.then(n=>(r(n,t),n)):(r(o,t),o)}}},P=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const t=this;this.on(function r(...o){return t.remove(r),e.apply(null,o)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{const o=r(...e);o!==void 0&&(t=o)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},v=class extends P{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let o=0;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;t=n()}return Promise.resolve(t)}};function Bt(e,t){if(!Ce(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var X=class extends P{constructor(e){super(),this.onerror=w,this.type=e}emit(e){Ce(e)||w(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(r===void 0)continue;if(Bt(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){oe(r),this.onerror(r)}return e}},x=class extends P{constructor(e){super(),this.onerror=w,this.type=e}emit(e){Ce(e)||w(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let r=0;const o=s=>(oe(s),this.onerror(s),e),n=s=>{if(s!==void 0&&Bt(e,s))e=s;else if(s!==void 0)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(r<t.length)try{return Promise.resolve(t[r++](e)).then(n,o)}catch(i){return o(i)}return e};return Promise.resolve(n(e))}return Promise.resolve(e)}},Y=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var o;C(wr(e),"Plugin configuration is invalid.");const r=e.name;C(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=>{const s=e[n];s&&this.lifecycle[n].on(s)}))}removePlugin(e){C(e,"A name is required.");const t=this.registerPlugins[e];C(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function jt(e,t){const r=yt(t);r.url||w(Lt,k,{remoteName:e.name});let o=Te(t,r.url);!G&&!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}function No(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:s,id:i}=e;if(!Oe(t)||!mt(t)){const{remoteSnapshot:c,globalSnapshot:a}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:xe(t.name,o)});jt(s,c);const l={remote:t,preloadConfig:{nameOrAlias:r,exposes:[o],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:l,remoteInfo:s,remote:t,remoteSnapshot:c,globalSnapshot:a});return u&&Gt(s,n,u,!1,{initiator:"loadRemote",id:i}).catch(()=>{}),{...e,remoteSnapshot:c}}return e}}}function To(e){const t=e.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function Vt(e,t,r,o,n={},s){const{value:i}=V(e,ne(t)),c=s||i;if(c&&!st(c)&&(r(c,t,o),c.remotesInfo)){const a=Object.keys(c.remotesInfo);for(const l of a){if(n[l])continue;n[l]=!0;const u=To(l),f=c.remotesInfo[l];Vt(e,{name:u.name,version:f.matchedVersion},r,!1,n,void 0)}}}const Ie=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function Ao(e,t,r,o,n){const s=[],i=[],c=[],a=new Set,l=new Set,{options:u}=e,{preloadConfig:f}=t,{depsRemote:m}=f;if(Vt(o,r,(d,p,E)=>{var $;let y;if(E)y=f;else if(Array.isArray(m)){const S=m.find(I=>I.nameOrAlias===p.name||I.nameOrAlias===p.alias);if(!S)return;y=xt(S)}else if(m===!0)y=f;else return;const R=Te(d,yt(d).url);R&&c.push({name:p.name,moduleInfo:{name:p.name,entry:R,type:"remoteEntryType"in d?d.remoteEntryType:"global",entryGlobalName:"globalName"in d?d.globalName:p.name,shareScope:"",version:"version"in d?d.version:void 0},url:R});let g="modules"in d?d.modules:[];const _=So(y.exposes);_.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),[]));function b(S){const I=S.map(M=>Te(d,M));return y.filter?I.filter(y.filter):I}if(g){const S=g.length;for(let I=0;I<S;I++){const M=g[I],_e=`${p.name}/${M.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?p.name:_e,name:p.name,remoteSnapshot:d,preloadConfig:y,remote:p,origin:e}),!Ar(_e)&&(y.resourceCategory==="all"?(s.push(...b(M.assets.css.async)),s.push(...b(M.assets.css.sync)),i.push(...b(M.assets.js.async)),i.push(...b(M.assets.js.sync))):y.resourceCategory==="sync"&&(s.push(...b(M.assets.css.sync)),i.push(...b(M.assets.js.sync))),Pr(_e))}}},!0,{},n),n.shared&&n.shared.length>0){const d=(p,E)=>{const{shared:y}=Ee(e.shareScopeMap,E.sharedName,p,e.sharedHandler.hooks.lifecycle.resolveShare)||{};y&&typeof y.lib=="function"&&(E.assets.js.sync.forEach(R=>{a.add(R)}),E.assets.css.sync.forEach(R=>{l.add(R)}))};n.shared.forEach(p=>{var R;const E=(R=u.shared)==null?void 0:R[p.sharedName];if(!E)return;const y=p.version?E.find(g=>g.version===p.version):E;y&&pt(y).forEach(g=>{d(g,p)})})}const h=i.filter(d=>!a.has(d)&&!Ie("script",d));return{cssAssets:s.filter(d=>!l.has(d)&&!Ie("link",d)),jsAssetsWithoutEntry:h,entryAssets:c.filter(d=>!Ie("script",d.url))}}const Po=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:s,remoteSnapshot:i}=e;return G?Oe(n)&&mt(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(jt(o,i),Ao(t,r,o,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Wt(e,t){const r=me({name:t.name,version:t.options.version}),o=r&&"remotesInfo"in r&&r.remotesInfo&&V(r.remotesInfo,e.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:Ve(),remoteSnapshot:me({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:Ve(),remoteSnapshot:me({name:e.name,version:"version"in e?e.version:void 0})}}var ko=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new Y({beforeLoadRemoteSnapshot:new v("beforeLoadRemoteSnapshot"),loadSnapshot:new x("loadGlobalSnapshot"),loadRemoteSnapshot:new x("loadRemoteSnapshot"),afterLoadSnapshot:new x("afterLoadSnapshot")}),this.manifestLoading=Re.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:r="loadRemote"}){const{options:o}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:o,moduleInfo:e,origin:this.HostInstance});let n=me({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},Nr({[this.HostInstance.options.name]:n})),n&&"remotesInfo"in n&&!V(n.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(n.remotesInfo={...n==null?void 0:n.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:c}=this.getGlobalRemoteInfo(e),{remoteSnapshot:a,globalSnapshot:l}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:c});let u,f;if(a)if(st(a)){const m=G?a.remoteEntry:a.ssrRemoteEntry||a.remoteEntry||"",h=await this.loadManifestSnapshot(m,e,{},{initiator:r,id:t||e.name}),d=We({...e,entry:m},h);u=h,f=d}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:a,from:"global"});u=m,f=l}else if(Oe(e)){const m=await this.loadManifestSnapshot(e.entry,e,{},{initiator:r,id:t||e.name}),h=We(e,m);u=m,f=h}else w(kt,k,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(l)},void 0,H(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:o,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:f}}getGlobalRemoteInfo(e){return Wt(e,this.HostInstance)}async getManifestJson(e,t,r,o){return(async()=>{const s=z(t);let i=this.manifestCache.get(e);if(i)return i;try{let a=await this.loaderHook.lifecycle.fetch.emit(e,{},s,o?{...o,url:e,resourceType:"manifest"}:void 0);(!a||!(a instanceof Response))&&(a=await fetch(e,{})),i=await a.json()}catch(a){i=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:a,from:"runtime",lifecycle:"afterResolve",remote:s,origin:this.HostInstance}),i||(delete this.manifestLoading[e],w(Tt,k,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${a}`,H(this.HostInstance.options)))}const c=[!i.metaData&&"metaData",!i.exposes&&"exposes",!i.shared&&"shared"].filter(Boolean);return c.length>0&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:new Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${c.join(", ")}.`),from:"runtime",lifecycle:"afterResolve",remote:s,origin:this.HostInstance}),c.length>0&&w(Ot,k,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:c.join(",")},void 0,H(this.HostInstance.options)),this.manifestCache.set(e,i),i})()}async loadManifestSnapshot(e,t,r,o){const n=async()=>{const s=await this.getManifestJson(e,t,r,o),i=rr(s,{version:e}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return c};return this.manifestLoading[e]||(this.manifestLoading[e]=n().then(s=>s)),this.manifestLoading[e]}},Mo=class{constructor(e){this.hooks=new Y({beforeRegisterShare:new X("beforeRegisterShare"),afterResolve:new x("afterResolve"),beforeLoadShare:new x("beforeLoadShare"),loadShare:new v,afterLoadShare:new P("afterLoadShare"),errorLoadShare:new P("errorLoadShare"),resolveShare:new X("resolveShare"),initContainerShareScopeMap:new X("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:r,selectedShared:o}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:r,selectedShared:o,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host})}catch(n){oe(n)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:r,error:o,recovered:n}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:o,recovered:n})}catch(s){oe(s)}}registerShared(e,t){const{newShareInfos:r,allShareInfos:o}=$t(e,t);return Object.keys(r).forEach(n=>{r[n].forEach(s=>{s.scope.forEach(i=>{var c;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:n,shared:s}),(c=this.shareScopeMap[i])!=null&&c[n]||this.setShared({pkgName:n,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name})})})}),{newShareInfos:r,allShareInfos:o}}async loadShare(e,t){const{host:r}=this,o=Ye({pkgName:e,extraOptions:t,shareInfos:r.options.shared});let n=o;try{o!=null&&o.scope&&await Promise.all(o.scope.map(async a=>{await Promise.all(this.initializeSharing(a,{strategy:o.strategy}))})),n=(await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:o,shared:r.options.shared,origin:r})).shareInfo,C(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.`);const s=n,{shared:i,useTreesShaking:c}=Ee(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(i){const a=ue(i,c);if(a.lib)return q(a,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),a.lib;if(a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),q(a,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),l}else{const u=(async()=>{const m=await a.get();return q(a,r.options.name),a.loaded=!0,a.lib=m,m})();this.setShared({pkgName:e,loaded:!1,shared:i,from:r.options.name,lib:null,loading:u,treeShaking:c?a:void 0});const f=await u;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),f}}else{if(t!=null&&t.customShareInfo)return this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,recovered:!0}),!1;const a=se(s.treeShaking),l=ue(s,a),f=(async()=>{const h=await l.get();l.lib=h,l.loaded=!0,q(l,r.options.name);const{shared:d,useTreesShaking:p}=Ee(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(d){const E=ue(d,p);E.lib=h,E.loaded=!0,d.from=s.from}return h})();this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:f,treeShaking:a?l:void 0});const m=await f;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:s}),m}}catch(s){throw this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:n,error:s}),s}}initializeSharing(e=ae,t){const{host:r}=this,o=t==null?void 0:t.from,n=t==null?void 0:t.strategy;let s=t==null?void 0:t.initScope;const i=[];if(o!=="build"){const{initTokens:m}=this;s||(s=[]);let h=m[e];if(h||(h=m[e]={from:this.host.name}),s.indexOf(h)>=0)return i;s.push(h)}const c=this.shareScopeMap,a=r.options.name;c[e]||(c[e]={});const l=c[e],u=(m,h)=>{var g;const{version:d,eager:p}=h;l[m]=l[m]||{};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)));(!y||y.strategy!=="loaded-first"&&!y.loaded&&(!p!=!R?p:a>E[d].from))&&(E[d]=h)},f=async m=>{const{module:h}=await r.remoteHandler.getRemoteModuleAndOptions({id:m});let d;try{d=await h.getEntry()}catch(p){if(d=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:m,error:p,from:"runtime",lifecycle:"beforeLoadShare",remote:h.remoteInfo,origin:r}),!d)return}finally{d!=null&&d.init&&!h.initing&&(h.remoteEntryExports=d,await h.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(m=>{r.options.shared[m].forEach(h=>{h.scope.includes(e)&&u(m,h)})}),(r.options.shareStrategy==="version-first"||n==="version-first")&&r.options.remotes.forEach(m=>{m.shareScope===e&&i.push(f(m.name))}),i}loadShareSync(e,t){const{host:r}=this,o=Ye({pkgName:e,extraOptions:t,shareInfos:r.options.shared});try{o!=null&&o.scope&&o.scope.forEach(s=>{this.initializeSharing(s,{strategy:o.strategy})});const{shared:n}=Ee(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(n){if(typeof n.lib=="function")return q(n,r.options.name),n.loaded||(n.loaded=!0,n.from===r.options.name&&(o.loaded=!0)),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),n.lib;if(typeof n.get=="function"){const s=n.get();if(!(s instanceof Promise))return q(n,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:s,shared:n}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),s}}if(o.lib)return o.loaded||(o.loaded=!0),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib;if(o.get){const s=o.get();return s instanceof Promise&&w((t==null?void 0:t.from)==="build"?Pt:ke,k,{hostName:r.options.name,sharedPkgName:e},void 0,H(r.options)),o.lib=s,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:o.lib,shared:o}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib}w(ke,k,{hostName:r.options.name,sharedPkgName:e},void 0,H(r.options))}catch(n){throw this.emitErrorLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,error:n}),n}}initShareScopeMap(e,t,r={}){const{host:o}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:o.options,origin:o,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:o,loading:n,loaded:s,get:i,treeShaking:c}){const{version:a,scope:l="default",...u}=t,f=Array.isArray(l)?l:[l],m=h=>{const d=(E,y,R)=>{R&&!E[y]&&(E[y]=R)},p=c?h.treeShaking:h;d(p,"loaded",s),d(p,"loading",n),d(p,"get",i)};f.forEach(h=>{this.shareScopeMap[h]||(this.shareScopeMap[h]={}),this.shareScopeMap[h][e]||(this.shareScopeMap[h][e]={}),this.shareScopeMap[h][e][a]||(this.shareScopeMap[h][e][a]={version:a,scope:[h],...u,lib:o});const d=this.shareScopeMap[h][e][a];m(d),r&&d.from!==r&&(d.from=r)})}_setGlobalShareScopeMap(e){const t=It(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},Lo=class{constructor(e){this.hooks=new Y({beforeRegisterRemote:new X("beforeRegisterRemote"),registerRemote:new X("registerRemote"),beforeRequest:new x("beforeRequest"),afterMatchRemote:new v("afterMatchRemote"),onLoad:new v("onLoad"),afterLoadRemote:new v("afterLoadRemote"),handlePreloadModule:new P("handlePreloadModule"),errorLoadRemote:new v("errorLoadRemote"),beforePreloadRemote:new v("beforePreloadRemote"),generatePreloadAssets:new v("generatePreloadAssets"),afterPreloadRemote:new v("afterPreloadRemote"),loadEntry:new v}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,o)=>(this.registerRemote(o,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:o}=t,{name:n,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:o},s&&e.startsWith(n)){const i=e.replace(n,s);this.idToRemoteMap[i]={name:r.name,expose:o};return}if(s&&e.startsWith(s)){const i=e.replace(s,n);this.idToRemoteMap[i]={name:r.name,expose:o}}}async loadRemote(e,t){const{host:r}=this,o=Ze(r.options.remotes,e);let n=e,s=o==null?void 0:o.expose,i=o?z(o.remote):void 0,c;try{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;n=p,s=d,i=z(h);const y=await l.get(p,d,t,E),R=await this.hooks.lifecycle.onLoad.emit({id:p,pkgNameOrAlias:m,expose:d,exposeModule:a?y:void 0,exposeModuleFactory:a?void 0:y,remote:h,options:u,moduleInstance:l,origin:r});return this.setIdToRemoteMap(e,f),c={id:n,expose:s,remote:i,options:t,origin:r},typeof R=="function"?R:y}catch(a){const{from:l="runtime"}=t||{from:"runtime"};let u;try{u=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:a,from:l,lifecycle:"onLoad",expose:s,remote:i,origin:r})}catch(f){throw c={id:n,expose:s,remote:i,options:t,error:f,origin:r},f}if(!u)throw c={id:n,expose:s,remote:i,options:t,error:a,origin:r},a;return c={id:n,expose:s,remote:i,options:t,error:a,origin:r,recovered:!0},u}finally{c&&await this.hooks.lifecycle.afterLoadRemote.emit(c)}}async preloadRemote(e){const{host:t}=this,r=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const o=bo(t.options.remotes,e),n=c=>{const{preloadConfig:a,remote:l}=c,u=a.exposes||[];return u.length?u.map(f=>({ops:{...c,preloadConfig:{...a,exposes:[f]}},id:xe(l.name,f)})):[{ops:c,id:`${l.name}/*`}]};let s;await Promise.all(o.flatMap(n).map(async c=>{const{ops:a,id:l}=c,{remote:u,preloadConfig:f}=a,m=z(u);try{const{globalSnapshot:h,remoteSnapshot:d}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:u,id:l,initiator:"preloadRemote"}),p=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:a,remote:u,remoteInfo:m,globalSnapshot:h,remoteSnapshot:d});if(!p)return;const E=await Gt(m,t,p,!0,{initiator:"preloadRemote",id:l});r.push({remote:u,remoteInfo:m,preloadConfig:f,id:l,results:E})}catch(h){r.push({remote:u,remoteInfo:m,preloadConfig:f,id:l,results:[{url:m.entry,status:"error",resourceType:/\.json(?:$|[?#])/i.test(m.entry)?"manifest":"remoteEntry",initiator:"preloadRemote",id:l,error:h}]})}}));const i=r.flatMap(c=>c.results.filter(a=>a.status==="error"||a.status==="timeout"));if(i.length>0&&(s=new Error(`preloadRemote failed to load ${i.length} resource(s).`),Object.assign(s,{results:r,failedResults:i})),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:t.options,origin:t,results:r,error:s}),s)throw s}registerRemotes(e,t){const{host:r}=this;e.forEach(o=>{this.registerRemote(o,r.options.remotes,{force:t==null?void 0:t.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let o;try{o=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(h){if(o=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:h,lifecycle:"beforeRequest"}),!o)throw h}const{id:n}=o,s=Ze(t.options.remotes,n);if(!s)try{w(At,k,{hostName:t.options.name,requestId:n},void 0,H(t.options))}catch(h){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:n,options:t.options,error:h,origin:t}),h}const{remote:i}=s,c=z(i);await this.hooks.lifecycle.afterMatchRemote.emit({id:n,...s,options:t.options,remoteInfo:c,origin:t});const a=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:n,...s,options:t.options,origin:t,remoteInfo:c}),{remote:l,expose:u}=a;C(l&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let f=t.moduleCache.get(l.name);const m={host:t,remoteInfo:c};return f||(f=new Ut(m),t.moduleCache.set(l.name,f)),{module:f,moduleOptions:m,remoteMatchInfo:a}}registerRemote(e,t,r){const{host:o}=this,n=()=>{if(e.alias){const i=t.find(c=>{var a;return e.alias&&(c.name.startsWith(e.alias)||((a=c.alias)==null?void 0:a.startsWith(e.alias)))});C(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in e&&G&&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=wt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});const s=t.find(i=>i.name===e.name);if(!s)n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o});else{const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(s),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o}),ot(i.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:o}=e,n=r.options.remotes.findIndex(a=>a.name===o);n!==-1&&r.options.remotes.splice(n,1);const s=V(T.__FEDERATION__.moduleInfo,ne(e)).key;delete T.__FEDERATION__.moduleInfo[s],"entry"in e&&(r.snapshotHandler.manifestCache.delete(e.entry),delete Re.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);const{hostGlobalSnapshot:i}=Wt(e,r);if(i){const a=i&&"remotesInfo"in i&&i.remotesInfo&&V(i.remotesInfo,e.name).key;a&&delete i.remotesInfo[a]}const c=r.moduleCache.get(e.name);if(c){const a=c.remoteInfo,l=a.entryGlobalName;T[l]&&((t=Object.getOwnPropertyDescriptor(T,l))!=null&&t.configurable?delete T[l]:T[l]=void 0);const u=Me(c.remoteInfo);K[u]&&delete K[u];let f=a.buildVersion?rt(a.name,a.buildVersion):a.name;const m=T.__FEDERATION__.__INSTANCES__.findIndex(h=>a.buildVersion?h.options.id===f:h.name===f);if(m!==-1){const h=T.__FEDERATION__.__INSTANCES__[m];f=h.options.id||f;const d=It();let p=!0;const E=[];Object.keys(d).forEach(y=>{const R=d[y];R&&Object.keys(R).forEach(g=>{const _=R[g];_&&Object.keys(_).forEach(b=>{const $=_[b];$&&Object.keys($).forEach(S=>{const I=$[S];I&&typeof I=="object"&&I.from===a.name&&(I.loaded||I.loading?(I.useIn=I.useIn.filter(M=>M!==a.name),I.useIn.length?p=!1:E.push([y,g,b,S])):E.push([y,g,b,S]))})})})}),p&&(h.shareScopeMap={},delete d[f]),E.forEach(([y,R,g,_])=>{var b,$,S;(S=($=(b=d[y])==null?void 0:b[R])==null?void 0:$[g])==null||delete S[_]}),T.__FEDERATION__.__INSTANCES__.splice(m,1)}r.moduleCache.delete(e.name)}}catch(r){Pe.error(`removeRemote failed: ${r instanceof Error?r.message:String(r)}`)}}};const Oo=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var Co=class{constructor(e){this.hooks=new Y({beforeInit:new X("beforeInit"),init:new P,beforeInitContainer:new x("beforeInitContainer"),initContainer:new x("initContainer")}),this.version="2.7.0",this.moduleCache=new Map,this.loaderHook=new Y({getModuleInfo:new P,createScript:new P,createLink:new P,fetch:new v,loadEntryError:new v,afterLoadEntry:new v("afterLoadEntry"),beforeInitRemote:new v("beforeInitRemote"),afterInitRemote:new v("afterInitRemote"),beforeGetExpose:new v("beforeGetExpose"),afterGetExpose:new v("afterGetExpose"),beforeExecuteFactory:new v("beforeExecuteFactory"),afterExecuteFactory:new v("afterExecuteFactory"),getModuleFactory:new v}),this.bridgeHook=new Y({beforeBridgeRender:new P,afterBridgeRender:new P,beforeBridgeDestroy:new P,afterBridgeDestroy:new P});const t=Oo?[No(),Po()]:[],r={id:go(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:G};this.name=e.name,this.options=r,this.snapshotHandler=new ko(this),this.sharedHandler=new Mo(this),this.remoteHandler=new Lo(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&w(dt(Mt,k)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=ae,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const o=z({name:e,entry:t}),n=new Ut({host:this,remoteInfo:o});return n.remoteEntryExports=r,this.moduleCache.set(e,n),n}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){const{allShareInfos:r}=$t(e,t),{userOptions:o,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(n,o),{allShareInfos:i}=this.sharedHandler.registerShared(n,o),c=[...n.plugins];o.plugins&&o.plugins.forEach(l=>{c.includes(l)||c.push(l)});const a={...e,...t,plugins:c,remotes:s,shared:i,id:o.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:a}),a}registerPlugins(e){const t=Ro(e,this);this.options.plugins=this.options.plugins.reduce((r,o)=>(o&&r&&!r.find(n=>n.name===o.name)&&r.push(o),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};let Fo=null;function qt(e){return Fo}Ir(Co);function Kt(e,t){const r=o=>{if(!o.startsWith("/"))return o;const n=o.length>1&&o.endsWith("/"),s=`${t}/${o}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/";return n?`${s}/`:s};return e.map(o=>{const n={...o,path:r(o.path)};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={...o.redirect,path:r(o.redirect.path)}),o.children&&o.children.length>0&&(n.children=Kt(o.children,t)),n})}function Ho(e){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;return s=>{const i=s.push.bind(s),c=s.replace.bind(s),a=s.resolve.bind(s);s.push=l=>i(n(l)),s.replace=l=>c(n(l)),s.resolve=(l,...u)=>a(n(l),...u)}}function Do(e){const{router:t,basename:r,memoryRoute:o,hashRoute:n}=e,s=t.getRoutes().sort((h,d)=>h.path.split("/").filter(p=>p).length-d.path.split("/").filter(p=>p).length),i=new Map,c=new Set;s.forEach(h=>{const d=i.get(h.path)||[];d.push(h),i.set(h.path,d)});const a=(h,d)=>`${h}/${d}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",l=(h,d="")=>{if(!h.children||h.children.length===0)return h;for(let p=0;p<h.children.length;p++){const E=h.children[p],y=a(d,E.path),g=(i.get(y)||[]).find(_=>!c.has(_)&&_!==h&&(E.name==null||_.name===E.name));if(g){const _={...g,path:E.path};h.children[p]=_,c.add(g),l(_,y)}}return h};let u=[];for(const h of s)if(!c.has(h)){const d=l(h,h.path);c.add(h),u.push(d)}let f,m;return o?f=fe.createMemoryHistory(r):n?(f=fe.createWebHashHistory(),r&&(u=Kt(u,r),m=Ho(r))):f=fe.createWebHistory(r),{history:f,routes:u,patchRouter:m}}function xo(e){const t=new Map,r=qt();return()=>({__APP_VERSION__:"2.7.0",async render(o){var d,p,E,y,R,g;F.debug("createBridgeComponent render Info",o);const{moduleName:n,dom:s,basename:i,memoryRoute:c,hashRoute:a,...l}=o,u=Jt.createApp(e.rootComponent,l);t.set(s,u);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({app:u,basename:i,memoryRoute:c,hashRoute:a,...l,...m});if(h!=null&&h.router){const{history:_,routes:b,patchRouter:$}=Do({router:h.router,basename:o.basename,memoryRoute:o.memoryRoute,hashRoute:o.hashRoute}),S=fe.createRouter({...h.router.options,history:_,routes:b});$&&$(S),h.afterRouterCreate&&h.afterRouterCreate(S),F.debug("createBridgeComponent render router info>>>",{moduleName:n,router:S}),c&&await S.push(c.entryPath),u.use(S)}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)},destroy(o){var s,i,c,a,l,u;F.debug("createBridgeComponent destroy Info",o);const n=t.get(o==null?void 0:o.dom);(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)}})}function Go(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const Uo=N.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(e){const t=N.ref(null),r=N.ref(null),o=N.ref(""),n=N.ref(!1),s=N.ref(!1),i=N.ref(!1),c=Le.useRoute(),a=qt(),l=N.useAttrs(),u=()=>({name:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute}),f=async()=>{var y,R,g,_,b,$,S;if(!t.value||n.value)return;const d=(y=e.providerInfo)==null?void 0:y.call(e);r.value=d;let p={...l,moduleName:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute};F.debug("createRemoteAppComponent LazyComponent render >>>",p);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))||{};p={...p,...E.extraProps},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)},m=()=>{var E,y,R,g,_,b;const d=r.value;if(!d||!n.value)return;F.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e});const p=u();(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({dom:t.value}),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)},h=N.watch(()=>c==null?void 0:c.path,d=>{s.value&&o.value!==""&&o.value!==d&&(F.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:c.path}),Go()),o.value=d});return N.onMounted(()=>{s.value=!0,f()}),N.onActivated(async()=>{s.value=!0,i.value&&(i.value=!1,await N.nextTick(),f())}),N.onDeactivated(()=>{s.value=!1,i.value=!0,m()}),N.onBeforeUnmount(()=>{h(),m()}),()=>N.createVNode("div",N.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function zt(e){return N.defineAsyncComponent({__APP_VERSION__:"2.7.0",...e.asyncComponentOptions,loader:async()=>{var a,l;const t=Le.useRoute();let r="/";const o=(l=(a=t==null?void 0:t.matched)==null?void 0:a[0])==null?void 0:l.path;o&&(o.endsWith("/:pathMatch(.*)*")?r=o.replace("/:pathMatch(.*)*",""):r=t.matched[0].path);const n=(e==null?void 0:e.export)||"default";F.debug("createRemoteAppComponent LazyComponent create >>>",{basename:r,info:e});const s=await e.loader(),i=s&&s[Symbol.for("mf_module_id")],c=s[n];if(F.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:i,module:s,exportName:n,basename:r,route:t}),n in s&&typeof c=="function")return{render(){return N.h(Uo,{moduleName:i,providerInfo:c,basename:r,rootAttrs:e.rootAttrs,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute})}};throw new Error("module not found")}})}function Bo(e){return F.warn("createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"),zt(e)}exports.createBridgeComponent=xo;exports.createRemoteAppComponent=zt;exports.createRemoteComponent=Bo;
|
|
7
|
+
`)};function wr(e,t,r,o,n,s){return o(Et(e,t,r,n))}const B="[ Federation Runtime ]",ke=ft(B);function C(e,t,r,o,n){e||w(t)}function w(e,t,r,o,n){if(t!==void 0)return wr(e,t,r??{},i=>{throw new Error(`${B}: ${i}`)},o);const s=e;throw s instanceof Error?(s.message.startsWith(B)||(s.message=`${B}: ${s.message}`),s):new Error(`${B}: ${s}`)}function ne(e){e instanceof Error&&(e.message.startsWith(B)||(e.message=`${B}: ${e.message}`)),ke.warn(e)}function Ir(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function se(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function De(e){return typeof e.entry<"u"}function gt(e){return!e.entry.includes(".json")}function Fe(e){return e&&typeof e=="object"}const $r=Object.prototype.toString;function Tr(e){return $r.call(e)==="[object Object]"}function Rt(e){return Array.isArray(e)?e:[e]}function _t(e){const t={url:"",type:"global",globalName:""};return U||st()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}const vr=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},N=typeof globalThis=="object"?globalThis:window,O=(()=>{try{return document.defaultView}catch{return N}})(),_e=O;function de(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function me(e,t){return Object.hasOwnProperty.call(e,t)}me(N,"__GLOBAL_LOADING_REMOTE_ENTRY__")||de(N,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const J=N.__GLOBAL_LOADING_REMOTE_ENTRY__;function bt(e){var t,r,o,n,s,i;me(e,"__VMOK__")&&!me(e,"__FEDERATION__")&&de(e,"__FEDERATION__",e.__VMOK__),me(e,"__FEDERATION__")||(de(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),de(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__=new Map)}bt(N);bt(O);function Nr(e,t=Ae()){t&&(N.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,N.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.8.0")}function W(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const o of r){const[n,s]=o.split(":"),i=`${n}:${t}`,c=e[i];if(c)return{value:c,key:i}}return{value:void 0,key:t}}}else w(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const qe=()=>O.__FEDERATION__.moduleInfo,Ar=(e,t)=>{const r=W(t,se(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){const{version:o,...n}=e,s=se(n),i=W(O.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===o)return i}},pe=e=>Ar(e,O.__FEDERATION__.moduleInfo),ze=(e,t)=>{const r=se(e);return O.__FEDERATION__.moduleInfo[r]=t,O.__FEDERATION__.moduleInfo},Mr=e=>(O.__FEDERATION__.moduleInfo={...O.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete O.__FEDERATION__.moduleInfo[r]}),He=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:N[r]}},Pr=()=>O.__FEDERATION__.__GLOBAL_PLUGIN__,kr=e=>N.__FEDERATION__.__PRELOADED_MAP__.get(e),Or=e=>N.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Ke="[0-9A-Za-z-]+",xe=`(?:\\+(${Ke}(?:\\.${Ke})*))`,oe="0|[1-9]\\d*",ye="[0-9]+",St="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Je=`(?:${ye}|${St})`,Lr=`(?:-?(${Je}(?:\\.${Je})*))`,Ze=`(?:${oe}|${St})`,wt=`(?:-(${Ze}(?:\\.${Ze})*))`,we=`${oe}|x|X|\\*`,Y=`[v=\\s]*(${we})(?:\\.(${we})(?:\\.(${we})(?:${wt})?${xe}?)?)?`,Cr=`^\\s*(${Y})\\s+-\\s+(${Y})\\s*$`,Dr=`[v=\\s]*${`(${ye})\\.(${ye})\\.(${ye})`}${Lr}?${xe}?`,Ge="((?:<|>)?=?)",Fr=`(\\s*)${Ge}\\s*(${Dr}|${Y})`,It="(?:~>?)",Hr=`(\\s*)${It}\\s+`,$t="(?:\\^)",xr=`(\\s*)${$t}\\s+`,Gr="(<|>)?=?\\s*\\*",Ur=`^${$t}${Y}$`,Br=`v?${`(${oe})\\.(${oe})\\.(${oe})`}${wt}?${xe}?`,jr=`^${It}${Y}$`,Vr=`^${Ge}\\s*${Y}$`,Wr=`^${Ge}\\s*(${Br})$|^$`,qr="^\\s*>=\\s*0.0.0\\s*$";function L(e){return new RegExp(e)}function A(e){return!e||e.toLowerCase()==="x"||e==="*"}function Tt(...e){return t=>e.reduce((r,o)=>o(r),t)}function Xe(e){return e.match(L(Wr))}function Ye(e,t,r,o){const n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function zr(e){return e.replace(L(Cr),(t,r,o,n,s,i,c,a,l,u,f,m)=>(A(o)?r="":A(n)?r=`>=${o}.0.0`:A(s)?r=`>=${o}.${n}.0`:r=`>=${r}`,A(l)?a="":A(u)?a=`<${Number(l)+1}.0.0-0`:A(f)?a=`<${l}.${Number(u)+1}.0-0`:m?a=`<=${l}.${u}.${f}-${m}`:a=`<=${a}`,`${r} ${a}`.trim()))}function Kr(e){return e.replace(L(Fr),"$1$2$3")}function Jr(e){return e.replace(L(Hr),"$1~")}function Zr(e){return e.replace(L(xr),"$1^")}function Xr(e){return e.trim().split(/\s+/).map(t=>t.replace(L(Ur),(r,o,n,s,i)=>A(o)?"":A(n)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:A(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(" ")}function Yr(e){return e.trim().split(/\s+/).map(t=>t.replace(L(jr),(r,o,n,s,i)=>A(o)?"":A(n)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:A(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(" ")}function Qr(e){return e.split(/\s+/).map(t=>t.trim().replace(L(Vr),(r,o,n,s,i,c)=>{const a=A(n),l=a||A(s),u=l||A(i);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})).join(" ")}function eo(e){return e.trim().replace(L(Gr),"")}function to(e){return e.trim().replace(L(qr),"")}function Ee(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function ro(e,t){const{preRelease:r}=e,{preRelease:o}=t;if(r===void 0&&o)return 1;if(r&&o===void 0)return-1;if(r===void 0&&o===void 0)return 0;for(let n=0,s=r.length;n<=s;n++){const i=r[n],c=o[n];if(i!==c)return i===void 0&&c===void 0?0:i?c?Ee(i,c):-1:1}return 0}function ue(e,t){return Ee(e.major,t.major)||Ee(e.minor,t.minor)||Ee(e.patch,t.patch)||ro(e,t)}function Ie(e,t){return e.version===t.version}function oo(e,t){switch(e.operator){case"":case"=":return Ie(e,t);case">":return ue(e,t)<0;case">=":return Ie(e,t)||ue(e,t)<0;case"<":return ue(e,t)>0;case"<=":return Ie(e,t)||ue(e,t)>0;case void 0:return!0;default:return!1}}function no(e){return Tt(Xr,Yr,Qr,eo)(e)}function so(e){return Tt(zr,Kr,Jr,Zr)(e.trim()).split(/\s+/).join(" ")}function re(e,t){if(!e)return!1;const r=Xe(e);if(!r)return!1;const[,o,,n,s,i,c]=r,a={operator:o,version:Ye(n,s,i,c),major:n,minor:s,patch:i,preRelease:c==null?void 0:c.split(".")},l=t.split("||");for(const u of l){const f=u.trim();if(!f||f==="*"||f==="x")return!0;try{const m=so(f);if(!m.trim())return!0;const h=m.split(" ").map(E=>no(E)).join(" ");if(!h.trim())return!0;const d=h.split(/\s+/).map(E=>to(E)).filter(Boolean);if(d.length===0)continue;let p=!0;for(const E of d){const y=Xe(E);if(!y){p=!1;break}const[,R,,g,_,b,I]=y;if(!oo({operator:R,version:Ye(g,_,b,I),major:g,minor:_,patch:b,preRelease:I==null?void 0:I.split(".")},a)){p=!1;break}}if(p)return!0}catch(m){console.error(`[semver] Error processing range part "${f}":`,m);continue}}return!1}const ce="default",vt="global";function io(e,t,r,o){var s,i;let n;return"get"in e?n=e.get:"lib"in e?n=()=>Promise.resolve(e.lib):n=()=>Promise.resolve(()=>{w(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),(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.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:n,loaded:e!=null&&e.loaded||"lib"in e?!0:void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??o)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??Ne.UNKNOWN,useIn:[]}:void 0}}function Nt(e,t){const r=t.shared||{},o=t.name,n=Object.keys(r).reduce((i,c)=>{const a=Rt(r[c]);return i[c]=i[c]||[],a.forEach(l=>{i[c].push(io(l,o,c,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(n).forEach(i=>{s[i]?n[i].forEach(c=>{s[i].find(a=>a.version===c.version)||s[i].push(c)}):s[i]=n[i]}),{allShareInfos:s,newShareInfos:n}}function ie(e,t){if(!e)return!1;const{status:r,mode:o}=e;return r===Ne.NO_USE?!1:r===Ne.CALCULATED?!0:o==="runtime-infer"?t?co(e,t):!0:!1}function j(e,t){const r=o=>{if(!Number.isNaN(Number(o))){const n=o.split(".");let s=o;for(let i=0;i<3-n.length;i++)s+=".0";return s}return o};return!!re(r(e),`<=${r(t)}`)}const ae=(e,t)=>{const r=t||function(o,n){return j(o,n)};return Object.keys(e).reduce((o,n)=>!o||r(o,n)||o==="0"?n:o,0)},Re=e=>!!e.loaded||typeof e.lib=="function",ao=e=>!!e.loading,co=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(o=>r.includes(o)):!1};function lo(e,t,r,o){const n=e[t][r];let s="",i=ie(o);const c=function(a,l){return i?n[a].treeShaking?n[l].treeShaking?!Re(n[a].treeShaking)&&j(a,l):!1:!0:!Re(n[a])&&j(a,l)};if(i){if(s=ae(e[t][r],c),s)return{version:s,useTreesShaking:i};i=!1}return{version:ae(e[t][r],c),useTreesShaking:i}}const q=e=>Re(e)||ao(e);function uo(e,t,r,o){const n=e[t][r];let s="",i=ie(o);const c=function(a,l){if(i){if(!n[a].treeShaking)return!0;if(!n[l].treeShaking)return!1;if(q(n[l].treeShaking))return q(n[a].treeShaking)?!!j(a,l):!0;if(q(n[a].treeShaking))return!1}return q(n[l])?q(n[a])?!!j(a,l):!0:q(n[a])?!1:j(a,l)};if(i){if(s=ae(e[t][r],c),s)return{version:s,useTreesShaking:i};i=!1}return{version:ae(e[t][r],c),useTreesShaking:i}}function fo(e){return e==="loaded-first"?uo:lo}function ge(e,t,r,o){if(!e)return;const{shareConfig:n,scope:s=ce,strategy:i,treeShaking:c}=r,a=Array.isArray(s)?s:[s];for(const l of a)if(n&&e[l]&&e[l][t]){const{requiredVersion:u}=n,{version:f,useTreesShaking:m}=fo(i)(e,l,t,c),h=()=>{const p=e[l][t][f];if(n.singleton){if(typeof u=="string"&&!re(f,u)){const E=`Version ${f} from ${f&&p.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;n.strictVersion?w(E):ne(E)}return{shared:p,useTreesShaking:m}}else{if(u===!1||u==="*")return{shared:p,useTreesShaking:m};if(re(f,u))return{shared:p,useTreesShaking:m};const E=ie(c);if(E){for(const[y,R]of Object.entries(e[l][t]))if(ie(R.treeShaking,c==null?void 0:c.usedExports)&&re(y,u))return{shared:R,useTreesShaking:E}}for(const[y,R]of Object.entries(e[l][t]))if(re(y,u))return{shared:R,useTreesShaking:!1}}},d={shareScopeMap:e,scope:l,pkgName:t,version:f,GlobalFederation:_e.__FEDERATION__,shareInfo:r,resolver:h};return(o.emit(d)||d).resolver()}}function At(){return _e.__FEDERATION__.__SHARE__}function Qe(e){const{pkgName:t,extraOptions:r,shareInfos:o}=e,n=a=>{if(!a)return;const l={};return a.forEach(f=>{l[f.version]=f}),l[ae(l,function(f,m){return!Re(l[f])&&j(f,m)})]},s=(r==null?void 0:r.resolver)??n,i=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),c=(...a)=>{const l={};for(const u of a)if(u)for(const[f,m]of Object.entries(u)){const h=l[f];i(h)&&i(m)?l[f]=c(h,m):m!==void 0&&(l[f]=m)}return l};return c(s(o[t]),r==null?void 0:r.customShareInfo)}const z=(e,t)=>{e.useIn||(e.useIn=[]),Ir(e.useIn,t)};function fe(e,t){return t&&e.treeShaking?e.treeShaking:e}function Ue(e,t){return!t||t==="."?e:`${e}/${t.replace(/^\.\//,"")}`}function et(e,t){for(const r of e){const o=t.startsWith(r.name);let n=t.replace(r.name,"");if(o){if(n.startsWith("/")){const c=r.name;return n=`.${n}`,{pkgNameOrAlias:c,expose:n,remote:r}}else if(n==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const s=r.alias&&t.startsWith(r.alias);let i=r.alias&&t.replace(r.alias,"");if(r.alias&&s){if(i&&i.startsWith("/")){const c=r.alias;return i=`.${i}`,{pkgNameOrAlias:c,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function ho(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const Mt="RUNTIME-001",Pt="RUNTIME-002",kt="RUNTIME-003",Ot="RUNTIME-004",Lt="RUNTIME-005",Oe="RUNTIME-006",Ct="RUNTIME-007",Be="RUNTIME-008",mo="RUNTIME-009",Dt="RUNTIME-010",Ft="RUNTIME-011",po="RUNTIME-012",Ht="RUNTIME-013",xt="RUNTIME-014",Gt="RUNTIME-015",P={[Mt]:"Failed to get remoteEntry exports.",[Pt]:'The remote entry interface does not contain "init"',[kt]:"Failed to get manifest.",[Ot]:"Failed to locate remote.",[Lt]:"Invalid loadShareSync function call from bundler runtime",[Oe]:"Invalid loadShareSync function call from runtime",[Ct]:"Failed to get remote snapshot.",[Be]:"Failed to load script resources.",[mo]:"Please call createInstance first.",[Dt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[Ft]:"The remoteEntry URL is missing from the remote snapshot.",[po]:'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.',[Ht]:"The manifest is not a valid Module Federation manifest.",[xt]:"The remote does not expose the requested module.",[Gt]:"Remote container initialization failed."};({...P});const Ut=".then(callbacks[0]).catch(callbacks[1])";async function yo({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Ut}`)([r,o]):import(e).then(r).catch(o)}catch(n){w(`Failed to load ESM entry from "${e}". ${n instanceof Error?n.message:String(n)}`)}})}async function Eo({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(o):new Function("callbacks",`System.import("${e}")${Ut}`)([r,o])}catch(n){w(`Failed to load SystemJS entry from "${e}". ${n instanceof Error?n.message:String(n)}`)}})}function Bt(e,t,r){const{remoteEntryKey:o,entryExports:n}=He(e,t);return n||w(Mt,P,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o}),n}async function go({name:e,globalName:t,entry:r,remoteInfo:o,loaderHook:n,getEntryUrl:s,resourceContext:i}){const{entryExports:c}=He(e,t);if(c)return c;const a=s?s(r):r;return fr(a,{attrs:{},createScriptHook:(l,u)=>{const f=n.lifecycle.createScript.emit({url:l,attrs:u,remoteInfo:o,resourceContext:i?{...i,url:l}:void 0});if(f&&(f instanceof HTMLScriptElement||"script"in f||"timeout"in f))return f}}).then(()=>Bt(e,t,r),l=>{const u=l instanceof Error?l.message:String(l);w(Be,P,{remoteName:e,resourceUrl:a},u)})}async function Ro({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o,resourceContext:n}){const{entry:s,entryGlobalName:i,name:c,type:a}=e;switch(a){case"esm":case"module":return yo({entry:s,remoteEntryExports:t});case"system":return Eo({entry:s,remoteEntryExports:t});default:return go({entry:s,globalName:i,name:c,remoteInfo:e,loaderHook:r,getEntryUrl:o,resourceContext:n})}}async function _o({remoteInfo:e,loaderHook:t,resourceContext:r}){const{entry:o,entryGlobalName:n,name:s,type:i}=e,{entryExports:c}=He(s,n);return c||mr(o,{attrs:{name:s,globalName:n,type:i},loaderHook:{createScriptHook:(a,l={})=>{const u=t.lifecycle.createScript.emit({url:a,attrs:l,remoteInfo:e,resourceContext:r?{...r,url:a}:void 0});if(u&&"url"in u)return u}}}).then(()=>Bt(s,n,o)).catch(a=>{w(`Failed to load Node.js entry for remote "${s}" from "${o}". ${a instanceof Error?a.message:String(a)}`)})}function Le(e){const{entry:t,name:r}=e;return it(r,t)}async function je(e){const{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,resourceContext:s,_inErrorHandling:i=!1}=e,c=Le(o);if(r)return r;if(!J[c]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;J[c]=a.emit({origin:t,loaderHook:l,remoteInfo:o,remoteEntryExports:r}).then(u=>u||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":U)?Ro({remoteInfo:o,remoteEntryExports:r,loaderHook:l,getEntryUrl:n,resourceContext:s}):_o({remoteInfo:o,loaderHook:l,resourceContext:s}))).then(async u=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:u}),u)).catch(async u=>{const f=Le(o),m=u instanceof Error&&u.message.includes("ScriptExecutionError");if(u instanceof Error&&u.message.includes(Be)&&!m&&!i){const h=p=>je({...p,_inErrorHandling:!0}),d=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:o,remoteEntryExports:r,globalLoading:J,uniqueKey:f});if(d)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:d,recovered:!0}),d}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,error:u}),u})}return J[c]}function K(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||vt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ce}}function bo(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function So(e,t){const r=Pr(),o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(n=>{e!=null&&e.find(s=>s.name!==n.name)&&e.push(n)}),e&&e.length>0&&e.forEach(n=>{o.forEach(s=>{s.applyPlugin(n,t)})}),e}function wo(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function F(e){var r,o,n,s,i,c;const t={};for(const[a,l]of Object.entries(e.shared)){const u=l[0];u&&(t[a]={version:u.version,singleton:(r=u.shareConfig)==null?void 0:r.singleton,requiredVersion:((o=u.shareConfig)==null?void 0:o.requiredVersion)===!1?!1:(n=u.shareConfig)==null?void 0:n.requiredVersion,eager:u.eager,strictVersion:(s=u.shareConfig)==null?void 0:s.strictVersion})}return{project:{name:e.name,mfRole:((i=e.remotes)==null?void 0:i.length)>0?"host":"unknown"},mfConfig:{name:e.name,remotes:((c=e.remotes)==null?void 0:c.map(wo))??[],shared:t}}}function jt(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function Io(e,t){return t.map(r=>{const o=ho(e,r.nameOrAlias);return C(o,`Unable to preload ${r.nameOrAlias} as it is not included in ${!o&&ct({remoteInfo:o,remotes:e})}`),{remote:o,preloadConfig:jt(r)}})}function $o(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Ve(e){return e instanceof Error?e.message.includes("timed out")||e.name.includes("Timeout"):!1}function V(e,t,r,o){return{url:t,status:r,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:o}}async function To(e,t,r,o){const n=e.moduleCache.get(r.name),s=r.entry;if(n!=null&&n.remoteEntryExports)return V(o,s,"cached");try{if(!await je({origin:e,remoteInfo:r,remoteEntryExports:n==null?void 0:n.remoteEntryExports,resourceContext:{...o,url:s}}))throw new Error(`Failed to load remoteEntry "${s}".`);return V(o,s,"success")}catch(i){return V(o,s,Ve(i)?"timeout":"error",i)}}function $e({host:e,remoteInfo:t,url:r,attrs:o,context:n,needDeleteLink:s}){return new Promise(i=>{const{link:c,needAttach:a}=ur({url:r,cb:()=>{i(V(n,r,a?"success":"cached"))},onErrorCallback:l=>{i(V(n,r,Ve(l)?"timeout":"error",l))},attrs:o,createLinkHook:(l,u)=>{const f=e.loaderHook.lifecycle.createLink.emit({url:l,attrs:u,remoteInfo:t,resourceContext:{...n,url:l}});return f instanceof HTMLLinkElement,f},needDeleteLink:s});a&&document.head.appendChild(c)})}function vo({host:e,remoteInfo:t,url:r,attrs:o,context:n}){return new Promise(s=>{const{script:i,needAttach:c}=dt({url:r,cb:()=>{s(V(n,r,c?"success":"cached"))},onErrorCallback:a=>{s(V(n,r,Ve(a)?"timeout":"error",a))},attrs:o,createScriptHook:(a,l)=>{const u=e.loaderHook.lifecycle.createScript.emit({url:a,attrs:l,remoteInfo:t,resourceContext:{...n,url:a}});return u instanceof HTMLScriptElement,u},needDeleteScript:!0});c&&document.head.appendChild(i)})}function ee(e,t){return{...e,resourceType:t}}function Vt(e,t,r,o=!0,n={initiator:"preloadRemote",id:e.name}){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:c}=r,a=[];if(t.options.inBrowser){if(c.forEach(l=>{const{moduleInfo:u}=l;a.push(To(t,e,u,ee(n,"remoteEntry")))}),o){const l={rel:"preload",as:"style"};s.forEach(u=>{a.push($e({host:t,remoteInfo:e,url:u,attrs:l,context:ee(n,"css")}))})}else{const l={rel:"stylesheet",type:"text/css"};s.forEach(u=>{a.push($e({host:t,remoteInfo:e,url:u,attrs:l,needDeleteLink:!1,context:ee(n,"css")}))})}if(o){const l={rel:"preload",as:"script"};i.forEach(u=>{a.push($e({host:t,remoteInfo:e,url:u,attrs:l,context:ee(n,"js")}))})}else{const l={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};i.forEach(u=>{a.push(vo({host:t,remoteInfo:e,url:u,attrs:l,context:ee(n,"js")}))})}}return Promise.all(a)}function No(e){if(!e||!("modules"in e)||!Array.isArray(e.modules))return;const t=e.modules.map(r=>r.moduleName).filter(Boolean);return t.length?t.join(","):void 0}function Ao(e,t,r){const o=t,n=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];n.length||n.push("default"),n.forEach(i=>{o[i]||(o[i]={})});const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?n:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:o,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:o[n[0]],initScope:r??[]}}var tt=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e){if(this.remoteEntryExports)return this.remoteEntryExports;const t=await je({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:{initiator:"loadRemote",id:Ue(this.remoteInfo.name,e),resourceType:"remoteEntry"}});return C(t,`remoteEntryExports is undefined
|
|
8
|
+
${ct(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async init(e,t,r,o){const n=await this.getEntry(o);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host}),n;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host})}catch(s){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:s,cached:!0,origin:this.host}),s}return n}this.initing=!0,this.initPromise=(async()=>{await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});const{remoteEntryInitOptions:s,shareScope:i,initScope:c}=Ao(this.remoteInfo,this.host.shareScopeMap,r),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:i,remoteEntryInitOptions:s,initScope:c,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&w(Pt,P,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,F(this.host.options));try{await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions)}catch(l){w(Gt,P,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${l}`,F(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,origin:this.host})}catch(s){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:s,origin:this.host}),s}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,o){const{loadFactory:n=!0}=r||{loadFactory:!0},s=await this.init(e,o,void 0,t);this.lib=s,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,origin:this.host});let i;try{const l=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo});i=typeof l=="function"?l:void 0,i||(i=await s.get(t)),i||w(xt,P,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:No(o)},void 0,F(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,moduleFactory:i,origin:this.host})}catch(l){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,error:l,origin:this.host}),l}const c=vr(this.remoteInfo.name,t),a=this.wraperFactory(i,c);if(!n)return a;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,origin:this.host});try{const l=await a();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,exposeModule:l,origin:this.host}),l}catch(l){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,error:l,origin:this.host}),l}}wraperFactory(e,t){function r(o,n){o&&typeof o=="object"&&Object.isExtensible(o)&&!Object.getOwnPropertyDescriptor(o,Symbol.for("mf_module_id"))&&Object.defineProperty(o,Symbol.for("mf_module_id"),{value:n,enumerable:!1})}return()=>{const o=e();return o instanceof Promise?o.then(n=>(r(n,t),n)):(r(o,t),o)}}},H=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var o;C(Tr(e),"Plugin configuration is invalid.");const r=e.name;C(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=>{const s=e[n];s&&this.lifecycle[n].on(s)}))}removePlugin(e){C(e,"A name is required.");const t=this.registerPlugins[e];C(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}},M=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const t=this;this.on(function r(...o){return t.remove(r),e.apply(null,o)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{const o=r(...e);o!==void 0&&(t=o)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},T=class extends M{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let o=0;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;t=n()}return Promise.resolve(t)}};function Wt(e,t){if(!Fe(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var X=class extends M{constructor(e){super(),this.onerror=w,this.type=e}emit(e){Fe(e)||w(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(r===void 0)continue;if(Wt(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){ne(r),this.onerror(r)}return e}},x=class extends M{constructor(e){super(),this.onerror=w,this.type=e}emit(e){Fe(e)||w(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let r=0;const o=s=>(ne(s),this.onerror(s),e),n=s=>{if(s!==void 0&&Wt(e,s))e=s;else if(s!==void 0)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(r<t.length)try{return Promise.resolve(t[r++](e)).then(n,o)}catch(i){return o(i)}return e};return Promise.resolve(n(e))}return Promise.resolve(e)}};const te="Remote loading is disabled by experiments.optimization.disableRemote.";var Mo=class{constructor(){this.hooks=new H({})}formatAndRegisterRemote(){return[]}loadRemote(){throw new Error(te)}preloadRemote(){throw new Error(te)}registerRemotes(){throw new Error(te)}getRemoteModuleAndOptions(){throw new Error(te)}initRawContainer(){throw new Error(te)}};function qt(e,t){const r=_t(t);r.url||w(Ft,P,{remoteName:e.name});let o=Me(t,r.url);!U&&!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}function Po(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:s,id:i}=e;if(!De(t)||!gt(t)){const{remoteSnapshot:c,globalSnapshot:a}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:Ue(t.name,o)});qt(s,c);const l={remote:t,preloadConfig:{nameOrAlias:r,exposes:[o],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:l,remoteInfo:s,remote:t,remoteSnapshot:c,globalSnapshot:a});return u&&Vt(s,n,u,!1,{initiator:"loadRemote",id:i}).catch(()=>{}),{...e,remoteSnapshot:c}}return e}}}function ko(e){const t=e.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function zt(e,t,r,o,n={},s){const{value:i}=W(e,se(t)),c=s||i;if(c&&!lt(c)&&(r(c,t,o),c.remotesInfo)){const a=Object.keys(c.remotesInfo);for(const l of a){if(n[l])continue;n[l]=!0;const u=ko(l),f=c.remotesInfo[l];zt(e,{name:u.name,version:f.matchedVersion},r,!1,n,void 0)}}}const Te=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function Oo(e,t,r,o,n){const s=[],i=[],c=[],a=new Set,l=new Set,{options:u}=e,{preloadConfig:f}=t,{depsRemote:m}=f;if(zt(o,r,(d,p,E)=>{var I;let y;if(E)y=f;else if(Array.isArray(m)){const S=m.find($=>$.nameOrAlias===p.name||$.nameOrAlias===p.alias);if(!S)return;y=jt(S)}else if(m===!0)y=f;else return;const R=Me(d,_t(d).url);R&&c.push({name:p.name,moduleInfo:{name:p.name,entry:R,type:"remoteEntryType"in d?d.remoteEntryType:"global",entryGlobalName:"globalName"in d?d.globalName:p.name,shareScope:"",version:"version"in d?d.version:void 0},url:R});let g="modules"in d?d.modules:[];const _=$o(y.exposes);_.length&&"modules"in d&&(g=(I=d==null?void 0:d.modules)==null?void 0:I.reduce((S,$)=>((_==null?void 0:_.indexOf($.moduleName))!==-1&&S.push($),S),[]));function b(S){const $=S.map(k=>Me(d,k));return y.filter?$.filter(y.filter):$}if(g){const S=g.length;for(let $=0;$<S;$++){const k=g[$],be=`${p.name}/${k.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:k.moduleName==="."?p.name:be,name:p.name,remoteSnapshot:d,preloadConfig:y,remote:p,origin:e}),!kr(be)&&(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))),Or(be))}}},!0,{},n),n.shared&&n.shared.length>0){const d=(p,E)=>{const{shared:y}=ge(e.shareScopeMap,E.sharedName,p,e.sharedHandler.hooks.lifecycle.resolveShare)||{};y&&typeof y.lib=="function"&&(E.assets.js.sync.forEach(R=>{a.add(R)}),E.assets.css.sync.forEach(R=>{l.add(R)}))};n.shared.forEach(p=>{var R;const E=(R=u.shared)==null?void 0:R[p.sharedName];if(!E)return;const y=p.version?E.find(g=>g.version===p.version):E;y&&Rt(y).forEach(g=>{d(g,p)})})}const h=i.filter(d=>!a.has(d)&&!Te("script",d));return{cssAssets:s.filter(d=>!l.has(d)&&!Te("link",d)),jsAssetsWithoutEntry:h,entryAssets:c.filter(d=>!Te("script",d.url))}}const Lo=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:s,remoteSnapshot:i}=e;return U?De(n)&>(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(qt(o,i),Oo(t,r,o,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Kt(e,t){const r=pe({name:t.name,version:t.options.version}),o=r&&"remotesInfo"in r&&r.remotesInfo&&W(r.remotesInfo,e.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:qe(),remoteSnapshot:pe({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:qe(),remoteSnapshot:pe({name:e.name,version:"version"in e?e.version:void 0})}}var Co=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new H({beforeLoadRemoteSnapshot:new T("beforeLoadRemoteSnapshot"),loadSnapshot:new x("loadGlobalSnapshot"),loadRemoteSnapshot:new x("loadRemoteSnapshot"),afterLoadSnapshot:new x("afterLoadSnapshot")}),this.manifestLoading=_e.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:r="loadRemote"}){const{options:o}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:o,moduleInfo:e,origin:this.HostInstance});let n=pe({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},Mr({[this.HostInstance.options.name]:n})),n&&"remotesInfo"in n&&!W(n.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(n.remotesInfo={...n==null?void 0:n.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:c}=this.getGlobalRemoteInfo(e),{remoteSnapshot:a,globalSnapshot:l}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:c});let u,f;if(a)if(lt(a)){const m=U?a.remoteEntry:a.ssrRemoteEntry||a.remoteEntry||"",h=await this.loadManifestSnapshot(m,e,{},{initiator:r,id:t||e.name}),d=ze({...e,entry:m},h);u=h,f=d}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:a,from:"global"});u=m,f=l}else if(De(e)){const m=await this.loadManifestSnapshot(e.entry,e,{},{initiator:r,id:t||e.name}),h=ze(e,m);u=m,f=h}else w(Ct,P,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(l)},void 0,F(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:o,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:f}}getGlobalRemoteInfo(e){return Kt(e,this.HostInstance)}async getManifestJson(e,t,r,o){return(async()=>{const s=K(t);let i=this.manifestCache.get(e);if(i)return i;try{let a=await this.loaderHook.lifecycle.fetch.emit(e,{},s,o?{...o,url:e,resourceType:"manifest"}:void 0);(!a||!(a instanceof Response))&&(a=await fetch(e,{})),i=await a.json()}catch(a){i=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:a,from:"runtime",lifecycle:"afterResolve",remote:s,origin:this.HostInstance}),i||(delete this.manifestLoading[e],w(kt,P,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${a}`,F(this.HostInstance.options)))}const c=[!i.metaData&&"metaData",!i.exposes&&"exposes",!i.shared&&"shared"].filter(Boolean);return c.length>0&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:new Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${c.join(", ")}.`),from:"runtime",lifecycle:"afterResolve",remote:s,origin:this.HostInstance}),c.length>0&&w(Ht,P,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:c.join(",")},void 0,F(this.HostInstance.options)),this.manifestCache.set(e,i),i})()}async loadManifestSnapshot(e,t,r,o){const n=async()=>{const s=await this.getManifestJson(e,t,r,o),i=sr(s,{version:e}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return c};return this.manifestLoading[e]||(this.manifestLoading[e]=n().then(s=>s)),this.manifestLoading[e]}},Do=class{constructor(){this.hooks=new H({})}},Fo=class{constructor(e){this.hooks=new H({beforeRegisterShare:new X("beforeRegisterShare"),afterResolve:new x("afterResolve"),beforeLoadShare:new x("beforeLoadShare"),loadShare:new T,afterLoadShare:new M("afterLoadShare"),errorLoadShare:new M("errorLoadShare"),resolveShare:new X("resolveShare"),initContainerShareScopeMap:new X("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:r,selectedShared:o}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:r,selectedShared:o,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host})}catch(n){ne(n)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:r,error:o,recovered:n}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:o,recovered:n})}catch(s){ne(s)}}registerShared(e,t){const{newShareInfos:r,allShareInfos:o}=Nt(e,t);return Object.keys(r).forEach(n=>{r[n].forEach(s=>{s.scope.forEach(i=>{var c;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:n,shared:s}),(c=this.shareScopeMap[i])!=null&&c[n]||this.setShared({pkgName:n,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name})})})}),{newShareInfos:r,allShareInfos:o}}async loadShare(e,t){const{host:r}=this,o=Qe({pkgName:e,extraOptions:t,shareInfos:r.options.shared});let n=o;try{o!=null&&o.scope&&await Promise.all(o.scope.map(async a=>{await Promise.all(this.initializeSharing(a,{strategy:o.strategy}))})),n=(await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:o,shared:r.options.shared,origin:r})).shareInfo,C(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.`);const s=n,{shared:i,useTreesShaking:c}=ge(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(i){const a=fe(i,c);if(a.lib)return z(a,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),a.lib;if(a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),z(a,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),l}else{const u=(async()=>{const m=await a.get();return z(a,r.options.name),a.loaded=!0,a.lib=m,m})();this.setShared({pkgName:e,loaded:!1,shared:i,from:r.options.name,lib:null,loading:u,treeShaking:c?a:void 0});const f=await u;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),f}}else{if(t!=null&&t.customShareInfo)return this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,recovered:!0}),!1;const a=ie(s.treeShaking),l=fe(s,a),f=(async()=>{const h=await l.get();l.lib=h,l.loaded=!0,z(l,r.options.name);const{shared:d,useTreesShaking:p}=ge(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(d){const E=fe(d,p);E.lib=h,E.loaded=!0,d.from=s.from}return h})();this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:f,treeShaking:a?l:void 0});const m=await f;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:s}),m}}catch(s){throw this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:n,error:s}),s}}initializeSharing(e=ce,t){const{host:r}=this,o=t==null?void 0:t.from,n=t==null?void 0:t.strategy;let s=t==null?void 0:t.initScope;const i=[];if(o!=="build"){const{initTokens:m}=this;s||(s=[]);let h=m[e];if(h||(h=m[e]={from:this.host.name}),s.indexOf(h)>=0)return i;s.push(h)}const c=this.shareScopeMap,a=r.options.name;c[e]||(c[e]={});const l=c[e],u=(m,h)=>{var g;const{version:d,eager:p}=h;l[m]=l[m]||{};const E=l[m],y=E[d]&&fe(E[d]),R=!!(y&&("eager"in y&&y.eager||"shareConfig"in y&&((g=y.shareConfig)!=null&&g.eager)));(!y||y.strategy!=="loaded-first"&&!y.loaded&&(!p!=!R?p:a>E[d].from))&&(E[d]=h)},f=async m=>{const{module:h}=await r.remoteHandler.getRemoteModuleAndOptions({id:m});let d;try{d=await h.getEntry()}catch(p){if(d=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:m,error:p,from:"runtime",lifecycle:"beforeLoadShare",remote:h.remoteInfo,origin:r}),!d)return}finally{d!=null&&d.init&&!h.initing&&(h.remoteEntryExports=d,await h.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(m=>{r.options.shared[m].forEach(h=>{h.scope.includes(e)&&u(m,h)})}),(r.options.shareStrategy==="version-first"||n==="version-first")&&r.options.remotes.forEach(m=>{m.shareScope===e&&i.push(f(m.name))}),i}loadShareSync(e,t){const{host:r}=this,o=Qe({pkgName:e,extraOptions:t,shareInfos:r.options.shared});try{o!=null&&o.scope&&o.scope.forEach(s=>{this.initializeSharing(s,{strategy:o.strategy})});const{shared:n}=ge(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(n){if(typeof n.lib=="function")return z(n,r.options.name),n.loaded||(n.loaded=!0,n.from===r.options.name&&(o.loaded=!0)),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),n.lib;if(typeof n.get=="function"){const s=n.get();if(!(s instanceof Promise))return z(n,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:s,shared:n}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),s}}if(o.lib)return o.loaded||(o.loaded=!0),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib;if(o.get){const s=o.get();return s instanceof Promise&&w((t==null?void 0:t.from)==="build"?Lt:Oe,P,{hostName:r.options.name,sharedPkgName:e},void 0,F(r.options)),o.lib=s,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:o.lib,shared:o}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib}w(Oe,P,{hostName:r.options.name,sharedPkgName:e},void 0,F(r.options))}catch(n){throw this.emitErrorLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,error:n}),n}}initShareScopeMap(e,t,r={}){const{host:o}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:o.options,origin:o,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:o,loading:n,loaded:s,get:i,treeShaking:c}){const{version:a,scope:l="default",...u}=t,f=Array.isArray(l)?l:[l],m=h=>{const d=(E,y,R)=>{R&&!E[y]&&(E[y]=R)},p=c?h.treeShaking:h;d(p,"loaded",s),d(p,"loading",n),d(p,"get",i)};f.forEach(h=>{this.shareScopeMap[h]||(this.shareScopeMap[h]={}),this.shareScopeMap[h][e]||(this.shareScopeMap[h][e]={}),this.shareScopeMap[h][e][a]||(this.shareScopeMap[h][e][a]={version:a,scope:[h],...u,lib:o});const d=this.shareScopeMap[h][e][a];m(d),r&&d.from!==r&&(d.from=r)})}_setGlobalShareScopeMap(e){const t=At(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},Ho=class{constructor(){this.shareScopeMap={},this.hooks=new H({afterResolve:new x("afterResolve")})}registerShared(){return{newShareInfos:{},allShareInfos:{}}}loadShare(){throw new Error("Shared dependency loading is disabled by experiments.optimization.disableShared.")}loadShareSync(){throw new Error("Shared dependency loading is disabled by experiments.optimization.disableShared.")}initializeSharing(){return[]}initShareScopeMap(e,t){this.shareScopeMap[e]=t}},xo=class{constructor(e){this.hooks=new H({beforeRegisterRemote:new X("beforeRegisterRemote"),registerRemote:new X("registerRemote"),beforeRequest:new x("beforeRequest"),afterMatchRemote:new T("afterMatchRemote"),onLoad:new T("onLoad"),afterLoadRemote:new T("afterLoadRemote"),handlePreloadModule:new M("handlePreloadModule"),errorLoadRemote:new T("errorLoadRemote"),beforePreloadRemote:new T("beforePreloadRemote"),generatePreloadAssets:new T("generatePreloadAssets"),afterPreloadRemote:new T("afterPreloadRemote"),loadEntry:new T}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,o)=>(this.registerRemote(o,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:o}=t,{name:n,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:o},s&&e.startsWith(n)){const i=e.replace(n,s);this.idToRemoteMap[i]={name:r.name,expose:o};return}if(s&&e.startsWith(s)){const i=e.replace(s,n);this.idToRemoteMap[i]={name:r.name,expose:o}}}async loadRemote(e,t){const{host:r}=this,o=et(r.options.remotes,e);let n=e,s=o==null?void 0:o.expose,i=o?K(o.remote):void 0,c;try{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;n=p,s=d,i=K(h);const y=await l.get(p,d,t,E),R=await this.hooks.lifecycle.onLoad.emit({id:p,pkgNameOrAlias:m,expose:d,exposeModule:a?y:void 0,exposeModuleFactory:a?void 0:y,remote:h,options:u,moduleInstance:l,origin:r});return this.setIdToRemoteMap(e,f),c={id:n,expose:s,remote:i,options:t,origin:r},typeof R=="function"?R:y}catch(a){const{from:l="runtime"}=t||{from:"runtime"};let u;try{u=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:a,from:l,lifecycle:"onLoad",expose:s,remote:i,origin:r})}catch(f){throw c={id:n,expose:s,remote:i,options:t,error:f,origin:r},f}if(!u)throw c={id:n,expose:s,remote:i,options:t,error:a,origin:r},a;return c={id:n,expose:s,remote:i,options:t,error:a,origin:r,recovered:!0},u}finally{c&&await this.hooks.lifecycle.afterLoadRemote.emit(c)}}async preloadRemote(e){const{host:t}=this,r=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const o=Io(t.options.remotes,e),n=c=>{const{preloadConfig:a,remote:l}=c,u=a.exposes||[];return u.length?u.map(f=>({ops:{...c,preloadConfig:{...a,exposes:[f]}},id:Ue(l.name,f)})):[{ops:c,id:`${l.name}/*`}]};let s;await Promise.all(o.flatMap(n).map(async c=>{const{ops:a,id:l}=c,{remote:u,preloadConfig:f}=a,m=K(u);try{const{globalSnapshot:h,remoteSnapshot:d}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:u,id:l,initiator:"preloadRemote"}),p=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:a,remote:u,remoteInfo:m,globalSnapshot:h,remoteSnapshot:d});if(!p)return;const E=await Vt(m,t,p,!0,{initiator:"preloadRemote",id:l});r.push({remote:u,remoteInfo:m,preloadConfig:f,id:l,results:E})}catch(h){r.push({remote:u,remoteInfo:m,preloadConfig:f,id:l,results:[{url:m.entry,status:"error",resourceType:/\.json(?:$|[?#])/i.test(m.entry)?"manifest":"remoteEntry",initiator:"preloadRemote",id:l,error:h}]})}}));const i=r.flatMap(c=>c.results.filter(a=>a.status==="error"||a.status==="timeout"));if(i.length>0&&(s=new Error(`preloadRemote failed to load ${i.length} resource(s).`),Object.assign(s,{results:r,failedResults:i})),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:t.options,origin:t,results:r,error:s}),s)throw s}registerRemotes(e,t){const{host:r}=this;e.forEach(o=>{this.registerRemote(o,r.options.remotes,{force:t==null?void 0:t.force})})}initRawContainer(e,t,r){const{host:o}=this,n=new tt({host:o,remoteInfo:K({name:e,entry:t})});return n.remoteEntryExports=r,o.moduleCache.set(e,n),n}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let o;try{o=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(h){if(o=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:h,lifecycle:"beforeRequest"}),!o)throw h}const{id:n}=o,s=et(t.options.remotes,n);if(!s)try{w(Ot,P,{hostName:t.options.name,requestId:n},void 0,F(t.options))}catch(h){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:n,options:t.options,error:h,origin:t}),h}const{remote:i}=s,c=K(i);await this.hooks.lifecycle.afterMatchRemote.emit({id:n,...s,options:t.options,remoteInfo:c,origin:t});const a=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:n,...s,options:t.options,origin:t,remoteInfo:c}),{remote:l,expose:u}=a;C(l&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let f=t.moduleCache.get(l.name);const m={host:t,remoteInfo:c};return f||(f=new tt(m),t.moduleCache.set(l.name,f)),{module:f,moduleOptions:m,remoteMatchInfo:a}}registerRemote(e,t,r){const{host:o}=this,n=()=>{if(e.alias){const i=t.find(c=>{var a;return e.alias&&(c.name.startsWith(e.alias)||((a=c.alias)==null?void 0:a.startsWith(e.alias)))});C(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in e&&U&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ce),e.type||(e.type=vt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});const s=t.find(i=>i.name===e.name);if(!s)n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o});else{const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(s),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o}),at(i.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:o}=e,n=r.options.remotes.findIndex(a=>a.name===o);n!==-1&&r.options.remotes.splice(n,1);const s=W(N.__FEDERATION__.moduleInfo,se(e)).key;delete N.__FEDERATION__.moduleInfo[s],"entry"in e&&(r.snapshotHandler.manifestCache.delete(e.entry),delete _e.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);const{hostGlobalSnapshot:i}=Kt(e,r);if(i){const a=i&&"remotesInfo"in i&&i.remotesInfo&&W(i.remotesInfo,e.name).key;a&&delete i.remotesInfo[a]}const c=r.moduleCache.get(e.name);if(c){const a=c.remoteInfo,l=a.entryGlobalName;N[l]&&((t=Object.getOwnPropertyDescriptor(N,l))!=null&&t.configurable?delete N[l]:N[l]=void 0);const u=Le(c.remoteInfo);J[u]&&delete J[u];let f=a.buildVersion?it(a.name,a.buildVersion):a.name;const m=N.__FEDERATION__.__INSTANCES__.findIndex(h=>a.buildVersion?h.options.id===f:h.name===f);if(m!==-1){const h=N.__FEDERATION__.__INSTANCES__[m];f=h.options.id||f;const d=At();let p=!0;const E=[];Object.keys(d).forEach(y=>{const R=d[y];R&&Object.keys(R).forEach(g=>{const _=R[g];_&&Object.keys(_).forEach(b=>{const I=_[b];I&&Object.keys(I).forEach(S=>{const $=I[S];$&&typeof $=="object"&&$.from===a.name&&($.loaded||$.loading?($.useIn=$.useIn.filter(k=>k!==a.name),$.useIn.length?p=!1:E.push([y,g,b,S])):E.push([y,g,b,S]))})})})}),p&&(h.shareScopeMap={},delete d[f]),E.forEach(([y,R,g,_])=>{var b,I,S;(S=(I=(b=d[y])==null?void 0:b[R])==null?void 0:I[g])==null||delete S[_]}),N.__FEDERATION__.__INSTANCES__.splice(m,1)}r.moduleCache.delete(e.name)}}catch(r){ke.error(`removeRemote failed: ${r instanceof Error?r.message:String(r)}`)}}};const Go=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0,ve=typeof FEDERATION_OPTIMIZE_NO_REMOTE=="boolean"?!FEDERATION_OPTIMIZE_NO_REMOTE:!0,rt=typeof FEDERATION_OPTIMIZE_NO_SHARED=="boolean"?!FEDERATION_OPTIMIZE_NO_SHARED:!0;var Uo=class{constructor(e){this.hooks=new H({beforeInit:new X("beforeInit"),init:new M,beforeInitContainer:new x("beforeInitContainer"),initContainer:new x("initContainer")}),this.version="2.8.0",this.moduleCache=new Map,this.loaderHook=new H({getModuleInfo:new M,createScript:new M,createLink:new M,fetch:new T,loadEntryError:new T,afterLoadEntry:new T("afterLoadEntry"),beforeInitRemote:new T("beforeInitRemote"),afterInitRemote:new T("afterInitRemote"),beforeGetExpose:new T("beforeGetExpose"),afterGetExpose:new T("afterGetExpose"),beforeExecuteFactory:new T("beforeExecuteFactory"),afterExecuteFactory:new T("afterExecuteFactory"),getModuleFactory:new T}),this.bridgeHook=new H({beforeBridgeRender:new M,afterBridgeRender:new M,beforeBridgeDestroy:new M,afterBridgeDestroy:new M});const t=ve&&Go?[Po(),Lo()]:[],r={id:bo(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:U};this.name=e.name,this.options=r,this.snapshotHandler=ve?new Co(this):new Do,this.sharedHandler=rt?new Fo(this):new Ho,this.remoteHandler=ve?new xo(this):new Mo,this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&w(Et(Dt,P)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=ce,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){return this.remoteHandler.initRawContainer(e,t,r)}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){const r=rt?Nt(e,t).allShareInfos:{},{userOptions:o,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(n,o),{allShareInfos:i}=this.sharedHandler.registerShared(n,o),c=[...n.plugins];o.plugins&&o.plugins.forEach(l=>{c.includes(l)||c.push(l)});const a={...e,...t,plugins:c,remotes:s,shared:i,id:o.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:a}),a}registerPlugins(e){const t=So(e,this);this.options.plugins=this.options.plugins.reduce((r,o)=>(o&&r&&!r.find(n=>n.name===o.name)&&r.push(o),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};let Bo=null;function Jt(e){return Bo}Nr(Uo);function Zt(e,t){const r=o=>{if(!o.startsWith("/"))return o;const n=o.length>1&&o.endsWith("/"),s=`${t}/${o}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/";return n?`${s}/`:s};return e.map(o=>{const n={...o,path:r(o.path)};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={...o.redirect,path:r(o.redirect.path)}),o.children&&o.children.length>0&&(n.children=Zt(o.children,t)),n})}function jo(e){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;return s=>{const i=s.push.bind(s),c=s.replace.bind(s),a=s.resolve.bind(s);s.push=l=>i(n(l)),s.replace=l=>c(n(l)),s.resolve=(l,...u)=>a(n(l),...u)}}function Vo(e){const{router:t,basename:r,memoryRoute:o,hashRoute:n}=e,s=t.getRoutes().sort((h,d)=>h.path.split("/").filter(p=>p).length-d.path.split("/").filter(p=>p).length),i=new Map,c=new Set;s.forEach(h=>{const d=i.get(h.path)||[];d.push(h),i.set(h.path,d)});const a=(h,d)=>`${h}/${d}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",l=(h,d="")=>{if(!h.children||h.children.length===0)return h;for(let p=0;p<h.children.length;p++){const E=h.children[p],y=a(d,E.path),g=(i.get(y)||[]).find(_=>!c.has(_)&&_!==h&&(E.name==null||_.name===E.name));if(g){const _={...g,path:E.path};h.children[p]=_,c.add(g),l(_,y)}}return h};let u=[];for(const h of s)if(!c.has(h)){const d=l(h,h.path);c.add(h),u.push(d)}let f,m;return o?f=he.createMemoryHistory(r):n?(f=he.createWebHashHistory(),r&&(u=Zt(u,r),m=jo(r))):f=he.createWebHistory(r),{history:f,routes:u,patchRouter:m}}function Wo(e){const t=new Map,r=Jt();return()=>({__APP_VERSION__:"2.8.0",async render(o){var d,p,E,y,R,g;D.debug("createBridgeComponent render Info",o);const{moduleName:n,dom:s,basename:i,memoryRoute:c,hashRoute:a,...l}=o,u=Yt.createApp(e.rootComponent,l);t.set(s,u);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({app:u,basename:i,memoryRoute:c,hashRoute:a,...l,...m});if(h!=null&&h.router){const{history:_,routes:b,patchRouter:I}=Vo({router:h.router,basename:o.basename,memoryRoute:o.memoryRoute,hashRoute:o.hashRoute}),S=he.createRouter({...h.router.options,history:_,routes:b});I&&I(S),h.afterRouterCreate&&h.afterRouterCreate(S),D.debug("createBridgeComponent render router info>>>",{moduleName:n,router:S}),c&&await S.push(c.entryPath),u.use(S)}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)},destroy(o){var s,i,c,a,l,u;D.debug("createBridgeComponent destroy Info",o);const n=t.get(o==null?void 0:o.dom);(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)}})}function qo(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const zo=v.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(e){const t=v.ref(null),r=v.ref(null),o=v.ref(""),n=v.ref(!1),s=v.ref(!1),i=v.ref(!1),c=Ce.useRoute(),a=Jt(),l=v.useAttrs(),u=()=>({name:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute}),f=async()=>{var y,R,g,_,b,I,S;if(!t.value||n.value)return;const d=(y=e.providerInfo)==null?void 0:y.call(e);r.value=d;let p={...l,moduleName:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute};D.debug("createRemoteAppComponent LazyComponent render >>>",p);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))||{};p={...p,...E.extraProps},d.render(p),n.value=!0,(S=(I=(b=a==null?void 0:a.bridgeHook)==null?void 0:b.lifecycle)==null?void 0:I.afterBridgeRender)==null||S.emit(p)},m=()=>{var E,y,R,g,_,b;const d=r.value;if(!d||!n.value)return;D.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e});const p=u();(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({dom:t.value}),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)},h=v.watch(()=>c==null?void 0:c.path,d=>{s.value&&o.value!==""&&o.value!==d&&(D.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:c.path}),qo()),o.value=d});return v.onMounted(()=>{s.value=!0,f()}),v.onActivated(async()=>{s.value=!0,i.value&&(i.value=!1,await v.nextTick(),f())}),v.onDeactivated(()=>{s.value=!1,i.value=!0,m()}),v.onBeforeUnmount(()=>{h(),m()}),()=>v.createVNode("div",v.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function Xt(e){return v.defineAsyncComponent({__APP_VERSION__:"2.8.0",...e.asyncComponentOptions,loader:async()=>{var a,l;const t=Ce.useRoute();let r="/";const o=(l=(a=t==null?void 0:t.matched)==null?void 0:a[0])==null?void 0:l.path;o&&(o.endsWith("/:pathMatch(.*)*")?r=o.replace("/:pathMatch(.*)*",""):r=t.matched[0].path);const n=(e==null?void 0:e.export)||"default";D.debug("createRemoteAppComponent LazyComponent create >>>",{basename:r,info:e});const s=await e.loader(),i=s&&s[Symbol.for("mf_module_id")],c=s[n];if(D.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:i,module:s,exportName:n,basename:r,route:t}),n in s&&typeof c=="function")return{render(){return v.h(zo,{moduleName:i,providerInfo:c,basename:r,rootAttrs:e.rootAttrs,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute})}};throw new Error("module not found")}})}function Ko(e){return D.warn("createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"),Xt(e)}exports.createBridgeComponent=Wo;exports.createRemoteAppComponent=Xt;exports.createRemoteComponent=Ko;
|
package/dist/index.d.ts
CHANGED