@module-federation/bridge-vue3 2.6.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 -68
- package/dist/index.js +1061 -969
- 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 +9 -8
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 fr(e,t,r,o,n,s){return o(ft(e,t,r,n))}const G="[ Federation Runtime ]",ke=at(G);function C(e,t,r,o,n){e||w(t)}function w(e,t,r,o,n){if(t!==void 0)return fr(e,t,r??{},a=>{throw new Error(`${G}: ${a}`)},o);const s=e;throw s instanceof Error?(s.message.startsWith(G)||(s.message=`${G}: ${s.message}`),s):new Error(`${G}: ${s}`)}function re(e){e instanceof Error&&(e.message.startsWith(G)||(e.message=`${G}: ${e.message}`)),ke.warn(e)}function hr(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function oe(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Ce(e){return typeof e.entry<"u"}function ht(e){return!e.entry.includes(".json")}function Fe(e){return e&&typeof e=="object"}const dr=Object.prototype.toString;function mr(e){return dr.call(e)==="[object Object]"}function dt(e){return Array.isArray(e)?e:[e]}function mt(e){const t={url:"",type:"global",globalName:""};return x||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 pr=(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,M=(()=>{try{return document.defaultView}catch{return N}})(),ge=M;function fe(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function he(e,t){return Object.hasOwnProperty.call(e,t)}he(N,"__GLOBAL_LOADING_REMOTE_ENTRY__")||fe(N,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const K=N.__GLOBAL_LOADING_REMOTE_ENTRY__;function pt(e){var t,r,o,n,s,a;he(e,"__VMOK__")&&!he(e,"__FEDERATION__")&&fe(e,"__FEDERATION__",e.__VMOK__),he(e,"__FEDERATION__")||(fe(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),fe(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__={}),(a=e.__FEDERATION__).__PRELOADED_MAP__??(a.__PRELOADED_MAP__=new Map)}pt(N);pt(M);function yr(e,t=Te()){t&&(N.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,N.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.6.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(":"),a=`${n}:${t}`,c=e[a];if(c)return{value:c,key:a}}return{value:void 0,key:t}}}else w(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const je=()=>M.__FEDERATION__.moduleInfo,Er=(e,t)=>{const r=V(t,oe(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=oe(n),a=V(M.__FEDERATION__.moduleInfo,s).value;if((a==null?void 0:a.version)===o)return a}},de=e=>Er(e,M.__FEDERATION__.moduleInfo),We=(e,t)=>{const r=oe(e);return M.__FEDERATION__.moduleInfo[r]=t,M.__FEDERATION__.moduleInfo},gr=e=>(M.__FEDERATION__.moduleInfo={...M.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete M.__FEDERATION__.moduleInfo[r]}),He=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:N[r]}},_r=()=>M.__FEDERATION__.__GLOBAL_PLUGIN__,Rr=e=>N.__FEDERATION__.__PRELOADED_MAP__.get(e),br=e=>N.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),qe="[0-9A-Za-z-]+",De=`(?:\\+(${qe}(?:\\.${qe})*))`,te="0|[1-9]\\d*",me="[0-9]+",yt="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Ke=`(?:${me}|${yt})`,Sr=`(?:-?(${Ke}(?:\\.${Ke})*))`,ze=`(?:${te}|${yt})`,Et=`(?:-(${ze}(?:\\.${ze})*))`,Se=`${te}|x|X|\\*`,Y=`[v=\\s]*(${Se})(?:\\.(${Se})(?:\\.(${Se})(?:${Et})?${De}?)?)?`,wr=`^\\s*(${Y})\\s+-\\s+(${Y})\\s*$`,$r=`[v=\\s]*${`(${me})\\.(${me})\\.(${me})`}${Sr}?${De}?`,xe="((?:<|>)?=?)",Ir=`(\\s*)${xe}\\s*(${$r}|${Y})`,gt="(?:~>?)",vr=`(\\s*)${gt}\\s+`,_t="(?:\\^)",Tr=`(\\s*)${_t}\\s+`,Nr="(<|>)?=?\\s*\\*",Ar=`^${_t}${Y}$`,Pr=`v?${`(${te})\\.(${te})\\.(${te})`}${Et}?${De}?`,kr=`^${gt}${Y}$`,Lr=`^${xe}\\s*${Y}$`,Mr=`^${xe}\\s*(${Pr})$|^$`,Or="^\\s*>=\\s*0.0.0\\s*$";function O(e){return new RegExp(e)}function A(e){return!e||e.toLowerCase()==="x"||e==="*"}function Rt(...e){return t=>e.reduce((r,o)=>o(r),t)}function Je(e){return e.match(O(Mr))}function Xe(e,t,r,o){const n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function Cr(e){return e.replace(O(wr),(t,r,o,n,s,a,c,i,l,u,f,m)=>(A(o)?r="":A(n)?r=`>=${o}.0.0`:A(s)?r=`>=${o}.${n}.0`:r=`>=${r}`,A(l)?i="":A(u)?i=`<${Number(l)+1}.0.0-0`:A(f)?i=`<${l}.${Number(u)+1}.0-0`:m?i=`<=${l}.${u}.${f}-${m}`:i=`<=${i}`,`${r} ${i}`.trim()))}function Fr(e){return e.replace(O(Ir),"$1$2$3")}function Hr(e){return e.replace(O(vr),"$1~")}function Dr(e){return e.replace(O(Tr),"$1^")}function xr(e){return e.trim().split(/\s+/).map(t=>t.replace(O(Ar),(r,o,n,s,a)=>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`:a?o==="0"?n==="0"?`>=${o}.${n}.${s}-${a} <${o}.${n}.${Number(s)+1}-0`:`>=${o}.${n}.${s}-${a} <${o}.${Number(n)+1}.0-0`:`>=${o}.${n}.${s}-${a} <${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 Gr(e){return e.trim().split(/\s+/).map(t=>t.replace(O(kr),(r,o,n,s,a)=>A(o)?"":A(n)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:A(s)?`>=${o}.${n}.0 <${o}.${Number(n)+1}.0-0`:a?`>=${o}.${n}.${s}-${a} <${o}.${Number(n)+1}.0-0`:`>=${o}.${n}.${s} <${o}.${Number(n)+1}.0-0`)).join(" ")}function Ur(e){return e.split(/\s+/).map(t=>t.trim().replace(O(Lr),(r,o,n,s,a,c)=>{const i=A(n),l=i||A(s),u=l||A(a);return o==="="&&u&&(o=""),c="",i?o===">"||o==="<"?"<0.0.0-0":"*":o&&u?(l&&(s=0),a=0,o===">"?(o=">=",l?(n=Number(n)+1,s=0,a=0):(s=Number(s)+1,a=0)):o==="<="&&(o="<",l?n=Number(n)+1:s=Number(s)+1),o==="<"&&(c="-0"),`${o+n}.${s}.${a}${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 Br(e){return e.trim().replace(O(Nr),"")}function Vr(e){return e.trim().replace(O(Or),"")}function pe(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function jr(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 a=r[n],c=o[n];if(a!==c)return a===void 0&&c===void 0?0:a?c?pe(a,c):-1:1}return 0}function ce(e,t){return pe(e.major,t.major)||pe(e.minor,t.minor)||pe(e.patch,t.patch)||jr(e,t)}function we(e,t){return e.version===t.version}function Wr(e,t){switch(e.operator){case"":case"=":return we(e,t);case">":return ce(e,t)<0;case">=":return we(e,t)||ce(e,t)<0;case"<":return ce(e,t)>0;case"<=":return we(e,t)||ce(e,t)>0;case void 0:return!0;default:return!1}}function qr(e){return Rt(xr,Gr,Ur,Br)(e)}function Kr(e){return Rt(Cr,Fr,Hr,Dr)(e.trim()).split(/\s+/).join(" ")}function ee(e,t){if(!e)return!1;const r=Je(e);if(!r)return!1;const[,o,,n,s,a,c]=r,i={operator:o,version:Xe(n,s,a,c),major:n,minor:s,patch:a,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=Kr(f);if(!m.trim())return!0;const h=m.split(" ").map(E=>qr(E)).join(" ");if(!h.trim())return!0;const d=h.split(/\s+/).map(E=>Vr(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[,_,,g,R,b,$]=y;if(!Wr({operator:_,version:Xe(g,R,b,$),major:g,minor:R,patch:b,preRelease:$==null?void 0:$.split(".")},i)){p=!1;break}}if(p)return!0}catch(m){console.error(`[semver] Error processing range part "${f}":`,m);continue}}return!1}const ie="default",bt="global";function zr(e,t,r,o){var s,a;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&&((a=e.treeShaking)!=null&&a.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 St(e,t){const r=t.shared||{},o=t.name,n=Object.keys(r).reduce((a,c)=>{const i=dt(r[c]);return a[c]=a[c]||[],i.forEach(l=>{a[c].push(zr(l,o,c,t.shareStrategy))}),a},{}),s={...e.shared};return Object.keys(n).forEach(a=>{s[a]?n[a].forEach(c=>{s[a].find(i=>i.version===c.version)||s[a].push(c)}):s[a]=n[a]}),{allShareInfos:s,newShareInfos:n}}function ne(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?Xr(e,t):!0:!1}function U(e,t){const r=o=>{if(!Number.isNaN(Number(o))){const n=o.split(".");let s=o;for(let a=0;a<3-n.length;a++)s+=".0";return s}return o};return!!ee(r(e),`<=${r(t)}`)}const se=(e,t)=>{const r=t||function(o,n){return U(o,n)};return Object.keys(e).reduce((o,n)=>!o||r(o,n)||o==="0"?n:o,0)},Ee=e=>!!e.loaded||typeof e.lib=="function",Jr=e=>!!e.loading,Xr=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(o=>r.includes(o)):!1};function Yr(e,t,r,o){const n=e[t][r];let s="",a=ne(o);const c=function(i,l){return a?n[i].treeShaking?n[l].treeShaking?!Ee(n[i].treeShaking)&&U(i,l):!1:!0:!Ee(n[i])&&U(i,l)};if(a){if(s=se(e[t][r],c),s)return{version:s,useTreesShaking:a};a=!1}return{version:se(e[t][r],c),useTreesShaking:a}}const j=e=>Ee(e)||Jr(e);function Zr(e,t,r,o){const n=e[t][r];let s="",a=ne(o);const c=function(i,l){if(a){if(!n[i].treeShaking)return!0;if(!n[l].treeShaking)return!1;if(j(n[l].treeShaking))return j(n[i].treeShaking)?!!U(i,l):!0;if(j(n[i].treeShaking))return!1}return j(n[l])?j(n[i])?!!U(i,l):!0:j(n[i])?!1:U(i,l)};if(a){if(s=se(e[t][r],c),s)return{version:s,useTreesShaking:a};a=!1}return{version:se(e[t][r],c),useTreesShaking:a}}function Qr(e){return e==="loaded-first"?Zr:Yr}function ye(e,t,r,o){if(!e)return;const{shareConfig:n,scope:s=ie,strategy:a,treeShaking:c}=r,i=Array.isArray(s)?s:[s];for(const l of i)if(n&&e[l]&&e[l][t]){const{requiredVersion:u}=n,{version:f,useTreesShaking:m}=Qr(a)(e,l,t,c),h=()=>{const p=e[l][t][f];if(n.singleton){if(typeof u=="string"&&!ee(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):re(E)}return{shared:p,useTreesShaking:m}}else{if(u===!1||u==="*")return{shared:p,useTreesShaking:m};if(ee(f,u))return{shared:p,useTreesShaking:m};const E=ne(c);if(E){for(const[y,_]of Object.entries(e[l][t]))if(ne(_.treeShaking,c==null?void 0:c.usedExports)&&ee(y,u))return{shared:_,useTreesShaking:E}}for(const[y,_]of Object.entries(e[l][t]))if(ee(y,u))return{shared:_,useTreesShaking:!1}}},d={shareScopeMap:e,scope:l,pkgName:t,version:f,GlobalFederation:ge.__FEDERATION__,shareInfo:r,resolver:h};return(o.emit(d)||d).resolver()}}function wt(){return ge.__FEDERATION__.__SHARE__}function Ye(e){const{pkgName:t,extraOptions:r,shareInfos:o}=e,n=i=>{if(!i)return;const l={};return i.forEach(f=>{l[f.version]=f}),l[se(l,function(f,m){return!Ee(l[f])&&U(f,m)})]},s=(r==null?void 0:r.resolver)??n,a=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),c=(...i)=>{const l={};for(const u of i)if(u)for(const[f,m]of Object.entries(u)){const h=l[f];a(h)&&a(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 W=(e,t)=>{e.useIn||(e.useIn=[]),hr(e.useIn,t)};function le(e,t){return t&&e.treeShaking?e.treeShaking:e}function Ge(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 a=r.alias&&t.replace(r.alias,"");if(r.alias&&s){if(a&&a.startsWith("/")){const c=r.alias;return a=`.${a}`,{pkgNameOrAlias:c,expose:a,remote:r}}else if(a==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function eo(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const $t="RUNTIME-001",It="RUNTIME-002",vt="RUNTIME-003",Tt="RUNTIME-004",Nt="RUNTIME-005",Le="RUNTIME-006",At="RUNTIME-007",Ue="RUNTIME-008",to="RUNTIME-009",Pt="RUNTIME-010",kt="RUNTIME-011",ro="RUNTIME-012",Lt="RUNTIME-013",Mt="RUNTIME-014",Ot="RUNTIME-015",k={[$t]:"Failed to get remoteEntry exports.",[It]:'The remote entry interface does not contain "init"',[vt]:"Failed to get manifest.",[Tt]:"Failed to locate remote.",[Nt]:"Invalid loadShareSync function call from bundler runtime",[Le]:"Invalid loadShareSync function call from runtime",[At]:"Failed to get remote snapshot.",[Ue]:"Failed to load script resources.",[to]:"Please call createInstance first.",[Pt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[kt]:"The remoteEntry URL is missing from the remote snapshot.",[ro]:'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.',[Lt]:"The manifest is not a valid Module Federation manifest.",[Mt]:"The remote does not expose the requested module.",[Ot]:"Remote container initialization failed."};({...k});const Ct=".then(callbacks[0]).catch(callbacks[1])";async function oo({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Ct}`)([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 no({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}")${Ct}`)([r,o])}catch(n){w(`Failed to load SystemJS entry from "${e}". ${n instanceof Error?n.message:String(n)}`)}})}function Ft(e,t,r){const{remoteEntryKey:o,entryExports:n}=He(e,t);return n||w($t,k,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o}),n}async function so({name:e,globalName:t,entry:r,remoteInfo:o,loaderHook:n,getEntryUrl:s,resourceContext:a}){const{entryExports:c}=He(e,t);if(c)return c;const i=s?s(r):r;return ir(i,{attrs:{},createScriptHook:(l,u)=>{const f=n.lifecycle.createScript.emit({url:l,attrs:u,remoteInfo:o,resourceContext:a?{...a,url:l}:void 0});if(f&&(f instanceof HTMLScriptElement||"script"in f||"timeout"in f))return f}}).then(()=>Ft(e,t,r),l=>{const u=l instanceof Error?l.message:String(l);w(Ue,k,{remoteName:e,resourceUrl:i},u)})}async function io({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o,resourceContext:n}){const{entry:s,entryGlobalName:a,name:c,type:i}=e;switch(i){case"esm":case"module":return oo({entry:s,remoteEntryExports:t});case"system":return no({entry:s,remoteEntryExports:t});default:return so({entry:s,globalName:a,name:c,remoteInfo:e,loaderHook:r,getEntryUrl:o,resourceContext:n})}}async function ao({remoteInfo:e,loaderHook:t,resourceContext:r}){const{entry:o,entryGlobalName:n,name:s,type:a}=e,{entryExports:c}=He(s,n);return c||lr(o,{attrs:{name:s,globalName:n,type:a},loaderHook:{createScriptHook:(i,l={})=>{const u=t.lifecycle.createScript.emit({url:i,attrs:l,remoteInfo:e,resourceContext:r?{...r,url:i}:void 0});if(u&&"url"in u)return u}}}).then(()=>Ft(s,n,o)).catch(i=>{w(`Failed to load Node.js entry for remote "${s}" from "${o}". ${i instanceof Error?i.message:String(i)}`)})}function Me(e){const{entry:t,name:r}=e;return rt(r,t)}async function Be(e){const{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,resourceContext:s,_inErrorHandling:a=!1}=e,c=Me(o);if(r)return r;if(!K[c]){const i=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;K[c]=i.emit({origin:t,loaderHook:l,remoteInfo:o,remoteEntryExports:r}).then(u=>u||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":x)?io({remoteInfo:o,remoteEntryExports:r,loaderHook:l,getEntryUrl:n,resourceContext:s}):ao({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(Ue)&&!m&&!a){const h=p=>Be({...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||bt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ie}}function co(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function lo(e,t){const r=_r(),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 uo(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,a,c;const t={};for(const[i,l]of Object.entries(e.shared)){const u=l[0];u&&(t[i]={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:((a=e.remotes)==null?void 0:a.length)>0?"host":"unknown"},mfConfig:{name:e.name,remotes:((c=e.remotes)==null?void 0:c.map(uo))??[],shared:t}}}function Ht(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function fo(e,t){return t.map(r=>{const o=eo(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:Ht(r)}})}function ho(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 B(e,t,r,o){return{url:t,status:r,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:o}}async function mo(e,t,r,o){const n=e.moduleCache.get(r.name),s=r.entry;if(n!=null&&n.remoteEntryExports)return B(o,s,"cached");try{if(!await Be({origin:e,remoteInfo:r,remoteEntryExports:n==null?void 0:n.remoteEntryExports,resourceContext:{...o,url:s}}))throw new Error(`Failed to load remoteEntry "${s}".`);return B(o,s,"success")}catch(a){return B(o,s,Ve(a)?"timeout":"error",a)}}function $e({host:e,remoteInfo:t,url:r,attrs:o,context:n,needDeleteLink:s}){return new Promise(a=>{const{link:c,needAttach:i}=sr({url:r,cb:()=>{a(B(n,r,i?"success":"cached"))},onErrorCallback:l=>{a(B(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});i&&document.head.appendChild(c)})}function po({host:e,remoteInfo:t,url:r,attrs:o,context:n}){return new Promise(s=>{const{script:a,needAttach:c}=lt({url:r,cb:()=>{s(B(n,r,c?"success":"cached"))},onErrorCallback:i=>{s(B(n,r,Ve(i)?"timeout":"error",i))},attrs:o,createScriptHook:(i,l)=>{const u=e.loaderHook.lifecycle.createScript.emit({url:i,attrs:l,remoteInfo:t,resourceContext:{...n,url:i}});return u instanceof HTMLScriptElement,u},needDeleteScript:!0});c&&document.head.appendChild(a)})}function Q(e,t){return{...e,resourceType:t}}function Dt(e,t,r,o=!0,n={initiator:"preloadRemote",id:e.name}){const{cssAssets:s,jsAssetsWithoutEntry:a,entryAssets:c}=r,i=[];if(t.options.inBrowser){if(c.forEach(l=>{const{moduleInfo:u}=l;i.push(mo(t,e,u,Q(n,"remoteEntry")))}),o){const l={rel:"preload",as:"style"};s.forEach(u=>{i.push($e({host:t,remoteInfo:e,url:u,attrs:l,context:Q(n,"css")}))})}else{const l={rel:"stylesheet",type:"text/css"};s.forEach(u=>{i.push($e({host:t,remoteInfo:e,url:u,attrs:l,needDeleteLink:!1,context:Q(n,"css")}))})}if(o){const l={rel:"preload",as:"script"};a.forEach(u=>{i.push($e({host:t,remoteInfo:e,url:u,attrs:l,context:Q(n,"js")}))})}else{const l={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};a.forEach(u=>{i.push(po({host:t,remoteInfo:e,url:u,attrs:l,context:Q(n,"js")}))})}}return Promise.all(i)}function yo(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 Eo(e,t,r){const o=t,n=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];n.length||n.push("default"),n.forEach(a=>{o[a]||(o[a]={})});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 xt=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 Be({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:{initiator:"loadRemote",id:Ge(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:a,initScope:c}=Eo(this.remoteInfo,this.host.shareScopeMap,r),i=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:a,remoteEntryInitOptions:s,initScope:c,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&w(It,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(i.shareScope,i.initScope,i.remoteEntryInitOptions)}catch(l){w(Ot,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({...i,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 a;try{const l=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo});a=typeof l=="function"?l:void 0,a||(a=await s.get(t)),a||w(Mt,k,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:yo(o)},void 0,H(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,moduleFactory:a,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=pr(this.remoteInfo.name,t),i=this.wraperFactory(a,c);if(!n)return i;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,origin:this.host});try{const l=await i();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(a=>a===void 0||e.length===1&&a===e[0]?n(s):n(a)):s;t=n()}return Promise.resolve(t)}};function Gt(e,t){if(!Fe(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var J=class extends P{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(Gt(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){re(r),this.onerror(r)}return e}},D=class extends P{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=>(re(s),this.onerror(s),e),n=s=>{if(s!==void 0&&Gt(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(a){return o(a)}return e};return Promise.resolve(n(e))}return Promise.resolve(e)}},X=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var o;C(mr(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 Ut(e,t){const r=mt(t);r.url||w(kt,k,{remoteName:e.name});let o=Ne(t,r.url);!x&&!o.startsWith("http")&&(o=`https:${o}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=o,e.version=t.version,e.buildVersion=t.buildVersion}function go(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:s,id:a}=e;if(!Ce(t)||!ht(t)){const{remoteSnapshot:c,globalSnapshot:i}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:Ge(t.name,o)});Ut(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:i});return u&&Dt(s,n,u,!1,{initiator:"loadRemote",id:a}).catch(()=>{}),{...e,remoteSnapshot:c}}return e}}}function _o(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 Bt(e,t,r,o,n={},s){const{value:a}=V(e,oe(t)),c=s||a;if(c&&!st(c)&&(r(c,t,o),c.remotesInfo)){const i=Object.keys(c.remotesInfo);for(const l of i){if(n[l])continue;n[l]=!0;const u=_o(l),f=c.remotesInfo[l];Bt(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 Ro(e,t,r,o,n){const s=[],a=[],c=[],i=new Set,l=new Set,{options:u}=e,{preloadConfig:f}=t,{depsRemote:m}=f;if(Bt(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=Ht(S)}else if(m===!0)y=f;else return;const _=Ne(d,mt(d).url);_&&c.push({name:p.name,moduleInfo:{name:p.name,entry:_,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:_});let g="modules"in d?d.modules:[];const R=ho(y.exposes);R.length&&"modules"in d&&(g=($=d==null?void 0:d.modules)==null?void 0:$.reduce((S,I)=>((R==null?void 0:R.indexOf(I.moduleName))!==-1&&S.push(I),S),[]));function b(S){const I=S.map(L=>Ne(d,L));return y.filter?I.filter(y.filter):I}if(g){const S=g.length;for(let I=0;I<S;I++){const L=g[I],_e=`${p.name}/${L.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:L.moduleName==="."?p.name:_e,name:p.name,remoteSnapshot:d,preloadConfig:y,remote:p,origin:e}),!Rr(_e)&&(y.resourceCategory==="all"?(s.push(...b(L.assets.css.async)),s.push(...b(L.assets.css.sync)),a.push(...b(L.assets.js.async)),a.push(...b(L.assets.js.sync))):y.resourceCategory==="sync"&&(s.push(...b(L.assets.css.sync)),a.push(...b(L.assets.js.sync))),br(_e))}}},!0,{},n),n.shared&&n.shared.length>0){const d=(p,E)=>{const{shared:y}=ye(e.shareScopeMap,E.sharedName,p,e.sharedHandler.hooks.lifecycle.resolveShare)||{};y&&typeof y.lib=="function"&&(E.assets.js.sync.forEach(_=>{i.add(_)}),E.assets.css.sync.forEach(_=>{l.add(_)}))};n.shared.forEach(p=>{var _;const E=(_=u.shared)==null?void 0:_[p.sharedName];if(!E)return;const y=p.version?E.find(g=>g.version===p.version):E;y&&dt(y).forEach(g=>{d(g,p)})})}const h=a.filter(d=>!i.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 bo=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:s,remoteSnapshot:a}=e;return x?Ce(n)&&ht(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(Ut(o,a),Ro(t,r,o,s,a)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Vt(e,t){const r=de({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:je(),remoteSnapshot:de({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:je(),remoteSnapshot:de({name:e.name,version:"version"in e?e.version:void 0})}}var So=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new X({beforeLoadRemoteSnapshot:new v("beforeLoadRemoteSnapshot"),loadSnapshot:new D("loadGlobalSnapshot"),loadRemoteSnapshot:new D("loadRemoteSnapshot"),afterLoadSnapshot:new D("afterLoadSnapshot")}),this.manifestLoading=ge.__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=de({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},gr({[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:a,globalSnapshot:c}=this.getGlobalRemoteInfo(e),{remoteSnapshot:i,globalSnapshot:l}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:a,globalSnapshot:c});let u,f;if(i)if(st(i)){const m=x?i.remoteEntry:i.ssrRemoteEntry||i.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:i,from:"global"});u=m,f=l}else if(Ce(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(At,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 Vt(e,this.HostInstance)}async getManifestJson(e,t,r,o){return(async()=>{const s=z(t);let a=this.manifestCache.get(e);if(a)return a;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{},s,o?{...o,url:e,resourceType:"manifest"}:void 0);(!i||!(i instanceof Response))&&(i=await fetch(e,{})),a=await i.json()}catch(i){a=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",remote:s,origin:this.HostInstance}),a||(delete this.manifestLoading[e],w(vt,k,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,H(this.HostInstance.options)))}const c=[!a.metaData&&"metaData",!a.exposes&&"exposes",!a.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(Lt,k,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:c.join(",")},void 0,H(this.HostInstance.options)),this.manifestCache.set(e,a),a})()}async loadManifestSnapshot(e,t,r,o){const n=async()=>{const s=await this.getManifestJson(e,t,r,o),a=er(s,{version:e}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:a,manifestUrl:e,from:"manifest"});return c};return this.manifestLoading[e]||(this.manifestLoading[e]=n().then(s=>s)),this.manifestLoading[e]}},wo=class{constructor(e){this.hooks=new X({beforeRegisterShare:new J("beforeRegisterShare"),afterResolve:new D("afterResolve"),beforeLoadShare:new D("beforeLoadShare"),loadShare:new v,afterLoadShare:new P("afterLoadShare"),errorLoadShare:new P("errorLoadShare"),resolveShare:new J("resolveShare"),initContainerShareScopeMap:new J("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){re(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){re(s)}}registerShared(e,t){const{newShareInfos:r,allShareInfos:o}=St(e,t);return Object.keys(r).forEach(n=>{r[n].forEach(s=>{s.scope.forEach(a=>{var c;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:n,shared:s}),(c=this.shareScopeMap[a])!=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 i=>{await Promise.all(this.initializeSharing(i,{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:a,useTreesShaking:c}=ye(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(a){const i=le(a,c);if(i.lib)return W(i,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:a}),i.lib;if(i.loading&&!i.loaded){const l=await i.loading;return i.loaded=!0,i.lib||(i.lib=l),W(i,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:a}),l}else{const u=(async()=>{const m=await i.get();return W(i,r.options.name),i.loaded=!0,i.lib=m,m})();this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:u,treeShaking:c?i:void 0});const f=await u;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:a}),f}}else{if(t!=null&&t.customShareInfo)return this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,recovered:!0}),!1;const i=ne(s.treeShaking),l=le(s,i),f=(async()=>{const h=await l.get();l.lib=h,l.loaded=!0,W(l,r.options.name);const{shared:d,useTreesShaking:p}=ye(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(d){const E=le(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:i?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=ie,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 a=[];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 a;s.push(h)}const c=this.shareScopeMap,i=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]&&le(E[d]),_=!!(y&&("eager"in y&&y.eager||"shareConfig"in y&&((g=y.shareConfig)!=null&&g.eager)));(!y||y.strategy!=="loaded-first"&&!y.loaded&&(!p!=!_?p:i>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&&a.push(f(m.name))}),a}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}=ye(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(n){if(typeof n.lib=="function")return W(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 W(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"?Nt:Le,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(Le,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:a,treeShaking:c}){const{version:i,scope:l="default",...u}=t,f=Array.isArray(l)?l:[l],m=h=>{const d=(E,y,_)=>{_&&!E[y]&&(E[y]=_)},p=c?h.treeShaking:h;d(p,"loaded",s),d(p,"loading",n),d(p,"get",a)};f.forEach(h=>{this.shareScopeMap[h]||(this.shareScopeMap[h]={}),this.shareScopeMap[h][e]||(this.shareScopeMap[h][e]={}),this.shareScopeMap[h][e][i]||(this.shareScopeMap[h][e][i]={version:i,scope:[h],...u,lib:o});const d=this.shareScopeMap[h][e][i];m(d),r&&d.from!==r&&(d.from=r)})}_setGlobalShareScopeMap(e){const t=wt(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},$o=class{constructor(e){this.hooks=new X({beforeRegisterRemote:new J("beforeRegisterRemote"),registerRemote:new J("registerRemote"),beforeRequest:new D("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 a=e.replace(n,s);this.idToRemoteMap[a]={name:r.name,expose:o};return}if(s&&e.startsWith(s)){const a=e.replace(s,n);this.idToRemoteMap[a]={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,a=o?z(o.remote):void 0,c;try{const{loadFactory:i=!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,a=z(h);const y=await l.get(p,d,t,E),_=await this.hooks.lifecycle.onLoad.emit({id:p,pkgNameOrAlias:m,expose:d,exposeModule:i?y:void 0,exposeModuleFactory:i?void 0:y,remote:h,options:u,moduleInstance:l,origin:r});return this.setIdToRemoteMap(e,f),c={id:n,expose:s,remote:a,options:t,origin:r},typeof _=="function"?_:y}catch(i){const{from:l="runtime"}=t||{from:"runtime"};let u;try{u=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:l,lifecycle:"onLoad",expose:s,remote:a,origin:r})}catch(f){throw c={id:n,expose:s,remote:a,options:t,error:f,origin:r},f}if(!u)throw c={id:n,expose:s,remote:a,options:t,error:i,origin:r},i;return c={id:n,expose:s,remote:a,options:t,error:i,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=fo(t.options.remotes,e),n=c=>{const{preloadConfig:i,remote:l}=c,u=i.exposes||[];return u.length?u.map(f=>({ops:{...c,preloadConfig:{...i,exposes:[f]}},id:Ge(l.name,f)})):[{ops:c,id:`${l.name}/*`}]};let s;await Promise.all(o.flatMap(n).map(async c=>{const{ops:i,id:l}=c,{remote:u,preloadConfig:f}=i,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:i,remote:u,remoteInfo:m,globalSnapshot:h,remoteSnapshot:d});if(!p)return;const E=await Dt(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 a=r.flatMap(c=>c.results.filter(i=>i.status==="error"||i.status==="timeout"));if(a.length>0&&(s=new Error(`preloadRemote failed to load ${a.length} resource(s).`),Object.assign(s,{results:r,failedResults:a})),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(Tt,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:a}=s,c=z(a);await this.hooks.lifecycle.afterMatchRemote.emit({id:n,...s,options:t.options,remoteInfo:c,origin:t});const i=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:n,...s,options:t.options,origin:t,remoteInfo:c}),{remote:l,expose:u}=i;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 xt(m),t.moduleCache.set(l.name,f)),{module:f,moduleOptions:m,remoteMatchInfo:i}}registerRemote(e,t,r){const{host:o}=this,n=()=>{if(e.alias){const a=t.find(c=>{var i;return e.alias&&(c.name.startsWith(e.alias)||((i=c.alias)==null?void 0:i.startsWith(e.alias)))});C(!a,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${a&&a.name} name or alias`)}"entry"in e&&x&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ie),e.type||(e.type=bt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});const s=t.find(a=>a.name===e.name);if(!s)n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o});else{const a=[`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(a.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:o}=e,n=r.options.remotes.findIndex(i=>i.name===o);n!==-1&&r.options.remotes.splice(n,1);const s=V(N.__FEDERATION__.moduleInfo,oe(e)).key;delete N.__FEDERATION__.moduleInfo[s],"entry"in e&&(r.snapshotHandler.manifestCache.delete(e.entry),delete ge.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);const{hostGlobalSnapshot:a}=Vt(e,r);if(a){const i=a&&"remotesInfo"in a&&a.remotesInfo&&V(a.remotesInfo,e.name).key;i&&delete a.remotesInfo[i]}const c=r.moduleCache.get(e.name);if(c){const i=c.remoteInfo,l=i.entryGlobalName;N[l]&&((t=Object.getOwnPropertyDescriptor(N,l))!=null&&t.configurable?delete N[l]:N[l]=void 0);const u=Me(c.remoteInfo);K[u]&&delete K[u];let f=i.buildVersion?rt(i.name,i.buildVersion):i.name;const m=N.__FEDERATION__.__INSTANCES__.findIndex(h=>i.buildVersion?h.options.id===f:h.name===f);if(m!==-1){const h=N.__FEDERATION__.__INSTANCES__[m];f=h.options.id||f;const d=wt();let p=!0;const E=[];Object.keys(d).forEach(y=>{const _=d[y];_&&Object.keys(_).forEach(g=>{const R=_[g];R&&Object.keys(R).forEach(b=>{const $=R[b];$&&Object.keys($).forEach(S=>{const I=$[S];I&&typeof I=="object"&&I.from===i.name&&(I.loaded||I.loading?(I.useIn=I.useIn.filter(L=>L!==i.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,_,g,R])=>{var b,$,S;(S=($=(b=d[y])==null?void 0:b[_])==null?void 0:$[g])==null||delete S[R]}),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 Io=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var vo=class{constructor(e){this.hooks=new X({beforeInit:new J("beforeInit"),init:new P,beforeInitContainer:new D("beforeInitContainer"),initContainer:new D("initContainer")}),this.version="2.6.0",this.moduleCache=new Map,this.loaderHook=new X({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 X({beforeBridgeRender:new P,afterBridgeRender:new P,beforeBridgeDestroy:new P,afterBridgeDestroy:new P});const t=Io?[go(),bo()]:[],r={id:co(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:x};this.name=e.name,this.options=r,this.snapshotHandler=new So(this),this.sharedHandler=new wo(this),this.remoteHandler=new $o(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(ft(Pt,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=ie,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const o=z({name:e,entry:t}),n=new xt({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}=St(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:a}=this.sharedHandler.registerShared(n,o),c=[...n.plugins];o.plugins&&o.plugins.forEach(l=>{c.includes(l)||c.push(l)});const i={...e,...t,plugins:c,remotes:s,shared:a,id:o.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:i}),i}registerPlugins(e){const t=lo(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 To=null;function jt(e){return To}yr(vo);function Wt(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=Wt(o.children,t)),n})}function No(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 a=s.push.bind(s),c=s.replace.bind(s),i=s.resolve.bind(s);s.push=l=>a(n(l)),s.replace=l=>c(n(l)),s.resolve=(l,...u)=>i(n(l),...u)}}function Ao(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),a=new Map,c=new Set;s.forEach(h=>{const d=a.get(h.path)||[];d.push(h),a.set(h.path,d)});const i=(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=i(d,E.path),g=(a.get(y)||[]).find(R=>!c.has(R)&&R!==h&&(E.name==null||R.name===E.name));if(g){const R={...g,path:E.path};h.children[p]=R,c.add(g),l(R,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=ue.createMemoryHistory(r):n?(f=ue.createWebHashHistory(),r&&(u=Wt(u,r),m=No(r))):f=ue.createWebHistory(r),{history:f,routes:u,patchRouter:m}}function Po(e){const t=new Map,r=jt();return()=>({__APP_VERSION__:"2.6.0",async render(o){var d,p,E,y,_,g;F.debug("createBridgeComponent render Info",o);const{moduleName:n,dom:s,basename:a,memoryRoute:c,hashRoute:i,...l}=o,u=Kt.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:a,memoryRoute:c,hashRoute:i,...l,...m});if(h!=null&&h.router){const{history:R,routes:b,patchRouter:$}=Ao({router:h.router,basename:o.basename,memoryRoute:o.memoryRoute,hashRoute:o.hashRoute}),S=ue.createRouter({...h.router.options,history:R,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=(_=(y=r==null?void 0:r.bridgeHook)==null?void 0:y.lifecycle)==null?void 0:_.afterBridgeRender)==null||g.emit(o)},destroy(o){var s,a,c,i,l,u;F.debug("createBridgeComponent destroy Info",o);const n=t.get(o==null?void 0:o.dom);(c=(a=(s=r==null?void 0:r.bridgeHook)==null?void 0:s.lifecycle)==null?void 0:a.beforeBridgeDestroy)==null||c.emit(o),n==null||n.unmount(),(u=(l=(i=r==null?void 0:r.bridgeHook)==null?void 0:i.lifecycle)==null?void 0:l.afterBridgeDestroy)==null||u.emit(o)}})}function ko(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const Lo=T.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(e){const t=T.ref(null),r=T.ref(null),o=T.ref(""),n=T.ref(!1),s=T.ref(!1),a=T.ref(!1),c=Oe.useRoute(),i=jt(),l=T.useAttrs(),u=()=>({name:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute}),f=async()=>{var y,_,g,R,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((R=(g=(_=i==null?void 0:i.bridgeHook)==null?void 0:_.lifecycle)==null?void 0:g.beforeBridgeRender)==null?void 0:R.emit(p))||{};p={...p,...E.extraProps},d.render(p),n.value=!0,(S=($=(b=i==null?void 0:i.bridgeHook)==null?void 0:b.lifecycle)==null?void 0:$.afterBridgeRender)==null||S.emit(p)},m=()=>{var E,y,_,g,R,b;const d=r.value;if(!d||!n.value)return;F.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e});const p=u();(_=(y=(E=i==null?void 0:i.bridgeHook)==null?void 0:E.lifecycle)==null?void 0:y.beforeBridgeDestroy)==null||_.emit(p),d.destroy({dom:t.value}),r.value=null,n.value=!1,(b=(R=(g=i==null?void 0:i.bridgeHook)==null?void 0:g.lifecycle)==null?void 0:R.afterBridgeDestroy)==null||b.emit(p)},h=T.watch(()=>c==null?void 0:c.path,d=>{s.value&&o.value!==""&&o.value!==d&&(F.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:c.path}),ko()),o.value=d});return T.onMounted(()=>{s.value=!0,f()}),T.onActivated(async()=>{s.value=!0,a.value&&(a.value=!1,await T.nextTick(),f())}),T.onDeactivated(()=>{s.value=!1,a.value=!0,m()}),T.onBeforeUnmount(()=>{h(),m()}),()=>T.createVNode("div",T.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function qt(e){return T.defineAsyncComponent({__APP_VERSION__:"2.6.0",...e.asyncComponentOptions,loader:async()=>{var i,l;const t=Oe.useRoute();let r="/";const o=(l=(i=t==null?void 0:t.matched)==null?void 0:i[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(),a=s&&s[Symbol.for("mf_module_id")],c=s[n];if(F.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:a,module:s,exportName:n,basename:r,route:t}),n in s&&typeof c=="function")return{render(){return T.h(Lo,{moduleName:a,providerInfo:c,basename:r,rootAttrs:e.rootAttrs,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute})}};throw new Error("module not found")}})}function Mo(e){return F.warn("createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"),qt(e)}exports.createBridgeComponent=Po;exports.createRemoteAppComponent=qt;exports.createRemoteComponent=Mo;
|
|
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
|
@@ -1,68 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare type AddOptionsFnParams = {
|
|
7
|
-
app: Vue.App<Vue.Component>;
|
|
8
|
-
basename: RenderFnParams['basename'];
|
|
9
|
-
memoryRoute: RenderFnParams['memoryRoute'];
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export declare function createBridgeComponent(bridgeInfo: ProviderFnParams): () => {
|
|
14
|
-
__APP_VERSION__: string;
|
|
15
|
-
render(info: RenderFnParams): Promise<void>;
|
|
16
|
-
destroy(info: {
|
|
17
|
-
dom: HTMLElement;
|
|
18
|
-
}): void;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export declare function createRemoteAppComponent(info: {
|
|
22
|
-
loader: () => Promise<any>;
|
|
23
|
-
export?: string;
|
|
24
|
-
asyncComponentOptions?: Omit<AsyncComponentOptions, 'loader'>;
|
|
25
|
-
rootAttrs?: Record<string, unknown>;
|
|
26
|
-
memoryRoute?: {
|
|
27
|
-
entryPath: string;
|
|
28
|
-
};
|
|
29
|
-
hashRoute?: boolean;
|
|
30
|
-
}): new () => ComponentPublicInstance;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated createRemoteComponent is deprecated, please use createRemoteAppComponent instead!
|
|
34
|
-
*/
|
|
35
|
-
export declare function createRemoteComponent(info: {
|
|
36
|
-
loader: () => Promise<any>;
|
|
37
|
-
export?: string;
|
|
38
|
-
asyncComponentOptions?: Omit<AsyncComponentOptions, 'loader'>;
|
|
39
|
-
rootAttrs?: Record<string, unknown>;
|
|
40
|
-
}): new () => ComponentPublicInstance;
|
|
41
|
-
|
|
42
|
-
export declare type ProviderFnParams = {
|
|
43
|
-
rootComponent: Vue.Component;
|
|
44
|
-
appOptions: (params: AddOptionsFnParams) => {
|
|
45
|
-
router?: VueRouter.Router;
|
|
46
|
-
/** Called with the bridge's internal router after creation but before navigation.
|
|
47
|
-
* Use this to register global guards (beforeEach, afterEach, etc.) that would
|
|
48
|
-
* otherwise be lost when the bridge recreates the router. */
|
|
49
|
-
afterRouterCreate?: (router: VueRouter.Router) => void;
|
|
50
|
-
} | void;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
declare interface ProviderParams {
|
|
54
|
-
moduleName?: string;
|
|
55
|
-
basename?: string;
|
|
56
|
-
memoryRoute?: {
|
|
57
|
-
entryPath: string;
|
|
58
|
-
};
|
|
59
|
-
hashRoute?: boolean;
|
|
60
|
-
style?: React.CSSProperties;
|
|
61
|
-
className?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export declare interface RenderFnParams extends ProviderParams {
|
|
65
|
-
dom: HTMLElement;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { }
|
|
1
|
+
export { createBridgeComponent } from './provider';
|
|
2
|
+
export type { ProviderFnParams } from './provider';
|
|
3
|
+
export { createRemoteComponent, createRemoteAppComponent } from './create';
|
|
4
|
+
export type { RenderFnParams } from '@module-federation/bridge-shared';
|