@module-federation/bridge-vue3 2.3.2 → 2.3.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @module-federation/bridge-vue3
2
2
 
3
+ ## 2.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - b883505: fix(bridge-vue3): fix route processing for relative paths and default child routes with basename
8
+
9
+ Two issues in `routeUtils` are fixed:
10
+ 1. **Relative child paths no longer get double-prefixed.** `prefixPath` now skips paths that don't start with `/`, letting Vue Router resolve them against the already-prefixed parent. This prevents breakage with nested route children like `path: 'history'` or `path: ':id?'`.
11
+ 2. **Default child routes (`path: ''`) no longer cause infinite recursion.** `flatRoutesMap` now stores arrays of candidates per path, and child matching skips the current parent route and uses the child's `name` when available. This correctly handles the case where a parent and its default child resolve to the same absolute path.
12
+ - @module-federation/runtime@2.3.3
13
+ - @module-federation/sdk@2.3.3
14
+ - @module-federation/bridge-shared@2.3.3
15
+
3
16
  ## 2.3.2
4
17
 
5
18
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("vue"),Oe=require("vue-router");function ze(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Gt=ze(v),ce=ze(Oe),xt=".json",Ut="FEDERATION_DEBUG",Vt=":";let $e=function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e}({});const H=typeof ENV_TARGET<"u"?ENV_TARGET==="web":typeof window<"u"&&typeof window.document<"u";function Je(){return H}function Xe(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function Bt(){try{if(Je()&&window.localStorage)return!!localStorage.getItem(Ut)}catch{return!1}return!1}function we(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:Bt()}const Wt="[ Federation Runtime ]",Ye=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}${Vt}${r}`:r:t,""):""},Ne=(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?!Je()&&!Xe()&&"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),"")},Ze=e=>{console.warn(`${Wt}: ${e}`)};function Qe(e){try{return JSON.stringify(e,null,2)}catch{return""}}const oe=(e,t)=>{if(!e)return t;const n=(o=>{if(o===".")return"";if(o.startsWith("./"))return o.replace("./","");if(o.startsWith("/")){const s=o.slice(1);return s.endsWith("/")?s.slice(0,-1):s}return o})(e);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function jt(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function qt(e,t={}){var E,b,S;const{remotes:r={},overrides:n={},version:o}=t;let s;const i=()=>"publicPath"in e.metaData?(e.metaData.publicPath==="auto"||e.metaData.publicPath==="")&&o?jt(o):e.metaData.publicPath:e.metaData.getPublicPath,a=Object.keys(n);let l={};Object.keys(r).length||(l=((E=e.remotes)==null?void 0:E.reduce((_,w)=>{let R;const N=w.federationContainerName;return a.includes(N)?R=n[N]:"version"in w?R=w.version:R=w.entry,_[N]={matchedVersion:R},_},{}))||{}),Object.keys(r).forEach(_=>l[_]={matchedVersion:a.includes(_)?n[_]:r[_]});const{remoteEntry:{path:c,name:u,type:d},types:h={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:f},globalName:p,ssrRemoteEntry:m}=e.metaData,{exposes:g}=e;let y={version:o||"",buildVersion:f,globalName:p,remoteEntry:oe(c,u),remoteEntryType:d,remoteTypes:oe(h.path,h.name),remoteTypesZip:h.zip||"",remoteTypesAPI:h.api||"",remotesInfo:l,shared:e==null?void 0:e.shared.map(_=>({assets:_.assets,sharedName:_.name,version:_.version,usedExports:_.referenceExports||[]})),modules:g==null?void 0:g.map(_=>({moduleName:_.name,modulePath:_.path,assets:_.assets}))};if((b=e.metaData)!=null&&b.prefetchInterface){const _=e.metaData.prefetchInterface;y={...y,prefetchInterface:_}}if((S=e.metaData)!=null&&S.prefetchEntry){const{path:_,name:w,type:R}=e.metaData.prefetchEntry;y={...y,prefetchEntry:oe(_,w),prefetchEntryType:R}}if("publicPath"in e.metaData?(s={...y,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(s.ssrPublicPath=e.metaData.ssrPublicPath)):s={...y,getPublicPath:i()},m){const _=oe(m.path,m.name);s.ssrRemoteEntry=_,s.ssrRemoteEntryType=m.type||"commonjs-module"}return s}function et(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(xt))}const Kt="[ Module Federation ]",X=console,zt=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function Jt(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("vue"),Oe=require("vue-router");function ze(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Gt=ze(v),ce=ze(Oe),xt=".json",Ut="FEDERATION_DEBUG",Vt=":";let we=function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e}({});const H=typeof ENV_TARGET<"u"?ENV_TARGET==="web":typeof window<"u"&&typeof window.document<"u";function Je(){return H}function Xe(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function Bt(){try{if(Je()&&window.localStorage)return!!localStorage.getItem(Ut)}catch{return!1}return!1}function Ne(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:Bt()}const Wt="[ Federation Runtime ]",Ye=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}${Vt}${r}`:r:t,""):""},Te=(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?!Je()&&!Xe()&&"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),"")},Ze=e=>{console.warn(`${Wt}: ${e}`)};function Qe(e){try{return JSON.stringify(e,null,2)}catch{return""}}const oe=(e,t)=>{if(!e)return t;const n=(o=>{if(o===".")return"";if(o.startsWith("./"))return o.replace("./","");if(o.startsWith("/")){const s=o.slice(1);return s.endsWith("/")?s.slice(0,-1):s}return o})(e);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function jt(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function qt(e,t={}){var _,b,R;const{remotes:r={},overrides:n={},version:o}=t;let s;const i=()=>"publicPath"in e.metaData?(e.metaData.publicPath==="auto"||e.metaData.publicPath==="")&&o?jt(o):e.metaData.publicPath:e.metaData.getPublicPath,a=Object.keys(n);let l={};Object.keys(r).length||(l=((_=e.remotes)==null?void 0:_.reduce((E,w)=>{let S;const N=w.federationContainerName;return a.includes(N)?S=n[N]:"version"in w?S=w.version:S=w.entry,E[N]={matchedVersion:S},E},{}))||{}),Object.keys(r).forEach(E=>l[E]={matchedVersion:a.includes(E)?n[E]:r[E]});const{remoteEntry:{path:c,name:u,type:d},types:h={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:f},globalName:p,ssrRemoteEntry:m}=e.metaData,{exposes:g}=e;let y={version:o||"",buildVersion:f,globalName:p,remoteEntry:oe(c,u),remoteEntryType:d,remoteTypes:oe(h.path,h.name),remoteTypesZip:h.zip||"",remoteTypesAPI:h.api||"",remotesInfo:l,shared:e==null?void 0:e.shared.map(E=>({assets:E.assets,sharedName:E.name,version:E.version,usedExports:E.referenceExports||[]})),modules:g==null?void 0:g.map(E=>({moduleName:E.name,modulePath:E.path,assets:E.assets}))};if((b=e.metaData)!=null&&b.prefetchInterface){const E=e.metaData.prefetchInterface;y={...y,prefetchInterface:E}}if((R=e.metaData)!=null&&R.prefetchEntry){const{path:E,name:w,type:S}=e.metaData.prefetchEntry;y={...y,prefetchEntry:oe(E,w),prefetchEntryType:S}}if("publicPath"in e.metaData?(s={...y,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(s.ssrPublicPath=e.metaData.ssrPublicPath)):s={...y,getPublicPath:i()},m){const E=oe(m.path,m.name);s.ssrRemoteEntry=E,s.ssrRemoteEntryType=m.type||"commonjs-module"}return s}function et(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(xt))}const Kt="[ Module Federation ]",X=console,zt=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function Jt(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
2
2
  `),r=t.filter(n=>!zt.some(o=>n.includes(o)));return r.length?`Stack trace:
3
3
  ${r.slice(0,5).join(`
4
- `)}`:void 0}catch{return}}var tt=class{constructor(e,t=X){this.prefix=e,this.delegate=t??X}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??X}emit(e,t){const r=this.delegate,n=we()?Jt():void 0,o=n?[...t,n]: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 a=r[i];if(typeof a=="function"){a.call(r,this.prefix,...o);return}}for(const i of s){const a=X[i];if(typeof a=="function"){a.call(X,this.prefix,...o);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){we()&&this.emit("debug",e)}};function rt(e){return new tt(e)}function Xt(e){const t=new tt(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Xt(Kt);async function nt(e,t){try{return await e()}catch(r){Ze(r);return}}function Ie(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function ot(e){let t=null,r=!0,n=2e4,o;const s=document.getElementsByTagName("script");for(let c=0;c<s.length;c++){const u=s[c],d=u.getAttribute("src");if(d&&Ie(d,e.url)){t=u,r=!1;break}}if(!t){const c=e.attrs;t=document.createElement("script"),t.type=(c==null?void 0:c.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&&(n=u.timeout))),t.src||(t.src=e.url),c&&!u&&Object.keys(c).forEach(d=>{t&&(d==="async"||d==="defer"?t[d]=c[d]:t.getAttribute(d)||t.setAttribute(d,c[d]))})}let i=null;const a=typeof window<"u"?c=>{if(c.filename&&Ie(c.filename,e.url)){const u=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${c.message} (${c.filename}:${c.lineno}:${c.colno})`);u.name="ScriptExecutionError",i=u}}:null;a&&window.addEventListener("error",a);const l=async(c,u)=>{clearTimeout(o),a&&window.removeEventListener("error",a);const d=()=>{if((u==null?void 0:u.type)==="error"){const h=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.)`);h.name="ScriptNetworkError",e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(h))}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,nt(()=>{const{needDeleteScript:h=!0}=e;h&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),c&&typeof c=="function")){const h=c(u);if(h instanceof Promise){const f=await h;return d(),f}return d(),h}d()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o=setTimeout(()=>{l(null,{type:"error",isTimeout:!0})},n),{script:t,needAttach:r}}function Ee(e){let t=null,r=!0;const n=document.getElementsByTagName("link");for(let s=0;s<n.length;s++){const i=n[s],a=i.getAttribute("href"),l=i.getAttribute("rel");if(a&&Ie(a,e.url)&&l===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let s;const i=e.attrs;e.createLinkHook&&(s=e.createLinkHook(e.url,i),s instanceof HTMLLinkElement&&(t=s)),i&&!s&&Object.keys(i).forEach(a=>{t&&!t.getAttribute(a)&&t.setAttribute(a,i[a])})}const o=(s,i)=>{const a=()=>{(i==null?void 0:i.type)==="error"?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,nt(()=>{const{needDeleteLink:l=!0}=e;l&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),s)){const l=s(i);return a(),l}a()};return t.onerror=o.bind(null,t.onerror),t.onload=o.bind(null,t.onload),{link:t,needAttach:r}}function Yt(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((o,s)=>{const{script:i,needAttach:a}=ot({url:e,cb:o,onErrorCallback:s,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});a&&document.head.appendChild(i)})}const se=new Map;function B(e){if(!e)throw new Error("import specifier is required");if(se.has(e))return se.get(e);const t=new Function("name","return import(name)")(e).then(r=>r).catch(r=>{throw console.error(`Error importing module ${e}:`,r),se.delete(e),r});return se.set(e,t),t}const st=async()=>{const e=await B("node-fetch");return e.default||e},Zt=async(e,t,r)=>{const o=await((s,i)=>r.lifecycle.fetch.emit(s,i))(e,t||{});return!o||!(o instanceof Response)?(typeof fetch>"u"?await st():fetch)(e,t||{}):o},Qt=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t,r,n)=>{if(n!=null&&n.createScriptHook){const a=n.createScriptHook(e);a&&typeof a=="object"&&"url"in a&&(e=a.url)}let o;try{o=new URL(e)}catch(a){console.error("Error constructing URL:",a),t(new Error(`Invalid URL: ${a}`));return}const s=async()=>n!=null&&n.fetch?(a,l)=>Zt(a,l,n):typeof fetch>"u"?st():fetch,i=async(a,l)=>{var c;try{const d=await(await a(l.href)).text(),[h,f]=await Promise.all([B("path"),B("vm")]),p={exports:{},module:{exports:{}}},m=l.pathname.split("/").slice(0,-1).join("/"),g=h.basename(l.pathname),y=new f.Script(`(function(exports, module, require, __dirname, __filename) {${d}
5
- })`,{filename:g,importModuleDynamically:((c=f.constants)==null?void 0:c.USE_MAIN_CONTEXT_DEFAULT_LOADER)??B});let E;E=(await B("node:module")).createRequire(l.protocol==="file:"||l.protocol==="node:"?l.href:h.join(process.cwd(),"__mf_require_base__.js")),y.runInThisContext()(p.exports,p.module,E,m,g);const b=p.module.exports||p.exports;if(r&&b&&r.globalName){t(void 0,b[r.globalName]||b);return}t(void 0,b)}catch(u){t(u instanceof Error?u:new Error(`Script execution error: ${u}`))}};s().then(async a=>{if((r==null?void 0:r.type)==="esm"||(r==null?void 0:r.type)==="module")return Te(o.href,{fetch:a,vm:await B("vm")}).then(async l=>{await l.evaluate(),t(void 0,l.namespace)}).catch(l=>{t(l instanceof Error?l:new Error(`Script execution error: ${l}`))});i(a,o)}).catch(a=>{t(a)})}:(e,t,r,n)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},er=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t)=>new Promise((r,n)=>{Qt(e,(o,s)=>{var i,a;if(o)n(o);else{const l=((i=t==null?void 0:t.attrs)==null?void 0:i.globalName)||`__FEDERATION_${(a=t==null?void 0:t.attrs)==null?void 0:a.name}:custom__`;r(globalThis[l]=s)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},_e=new Map;async function Te(e,t){if(_e.has(e))return _e.get(e);const{fetch:r,vm:n}=t,o=await(await r(e)).text(),s=new n.SourceTextModule(o,{importModuleDynamically:async(i,a)=>{const l=new URL(i,e).href;return Te(l,t)}});return _e.set(e,s),await s.link(async i=>{const a=new URL(i,e).href;return await Te(a,t)}),s}const D=rt("[ Module Federation Bridge Vue3 ]"),tr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,it=(e,t,r,n)=>{const o=[`${[t[e]]} #${e}`];return r&&o.push(`args: ${JSON.stringify(r)}`),o.push(tr(e)),n&&o.push(`Original Error Message:
4
+ `)}`:void 0}catch{return}}var tt=class{constructor(e,t=X){this.prefix=e,this.delegate=t??X}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??X}emit(e,t){const r=this.delegate,n=Ne()?Jt():void 0,o=n?[...t,n]: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 a=r[i];if(typeof a=="function"){a.call(r,this.prefix,...o);return}}for(const i of s){const a=X[i];if(typeof a=="function"){a.call(X,this.prefix,...o);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){Ne()&&this.emit("debug",e)}};function rt(e){return new tt(e)}function Xt(e){const t=new tt(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Xt(Kt);async function nt(e,t){try{return await e()}catch(r){Ze(r);return}}function Ie(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function ot(e){let t=null,r=!0,n=2e4,o;const s=document.getElementsByTagName("script");for(let c=0;c<s.length;c++){const u=s[c],d=u.getAttribute("src");if(d&&Ie(d,e.url)){t=u,r=!1;break}}if(!t){const c=e.attrs;t=document.createElement("script"),t.type=(c==null?void 0:c.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&&(n=u.timeout))),t.src||(t.src=e.url),c&&!u&&Object.keys(c).forEach(d=>{t&&(d==="async"||d==="defer"?t[d]=c[d]:t.getAttribute(d)||t.setAttribute(d,c[d]))})}let i=null;const a=typeof window<"u"?c=>{if(c.filename&&Ie(c.filename,e.url)){const u=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${c.message} (${c.filename}:${c.lineno}:${c.colno})`);u.name="ScriptExecutionError",i=u}}:null;a&&window.addEventListener("error",a);const l=async(c,u)=>{clearTimeout(o),a&&window.removeEventListener("error",a);const d=()=>{if((u==null?void 0:u.type)==="error"){const h=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.)`);h.name="ScriptNetworkError",e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(h))}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,nt(()=>{const{needDeleteScript:h=!0}=e;h&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),c&&typeof c=="function")){const h=c(u);if(h instanceof Promise){const f=await h;return d(),f}return d(),h}d()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o=setTimeout(()=>{l(null,{type:"error",isTimeout:!0})},n),{script:t,needAttach:r}}function _e(e){let t=null,r=!0;const n=document.getElementsByTagName("link");for(let s=0;s<n.length;s++){const i=n[s],a=i.getAttribute("href"),l=i.getAttribute("rel");if(a&&Ie(a,e.url)&&l===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let s;const i=e.attrs;e.createLinkHook&&(s=e.createLinkHook(e.url,i),s instanceof HTMLLinkElement&&(t=s)),i&&!s&&Object.keys(i).forEach(a=>{t&&!t.getAttribute(a)&&t.setAttribute(a,i[a])})}const o=(s,i)=>{const a=()=>{(i==null?void 0:i.type)==="error"?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,nt(()=>{const{needDeleteLink:l=!0}=e;l&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),s)){const l=s(i);return a(),l}a()};return t.onerror=o.bind(null,t.onerror),t.onload=o.bind(null,t.onload),{link:t,needAttach:r}}function Yt(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((o,s)=>{const{script:i,needAttach:a}=ot({url:e,cb:o,onErrorCallback:s,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});a&&document.head.appendChild(i)})}const se=new Map;function B(e){if(!e)throw new Error("import specifier is required");if(se.has(e))return se.get(e);const t=new Function("name","return import(name)")(e).then(r=>r).catch(r=>{throw console.error(`Error importing module ${e}:`,r),se.delete(e),r});return se.set(e,t),t}const st=async()=>{const e=await B("node-fetch");return e.default||e},Zt=async(e,t,r)=>{const o=await((s,i)=>r.lifecycle.fetch.emit(s,i))(e,t||{});return!o||!(o instanceof Response)?(typeof fetch>"u"?await st():fetch)(e,t||{}):o},Qt=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t,r,n)=>{if(n!=null&&n.createScriptHook){const a=n.createScriptHook(e);a&&typeof a=="object"&&"url"in a&&(e=a.url)}let o;try{o=new URL(e)}catch(a){console.error("Error constructing URL:",a),t(new Error(`Invalid URL: ${a}`));return}const s=async()=>n!=null&&n.fetch?(a,l)=>Zt(a,l,n):typeof fetch>"u"?st():fetch,i=async(a,l)=>{var c;try{const d=await(await a(l.href)).text(),[h,f]=await Promise.all([B("path"),B("vm")]),p={exports:{},module:{exports:{}}},m=l.pathname.split("/").slice(0,-1).join("/"),g=h.basename(l.pathname),y=new f.Script(`(function(exports, module, require, __dirname, __filename) {${d}
5
+ })`,{filename:g,importModuleDynamically:((c=f.constants)==null?void 0:c.USE_MAIN_CONTEXT_DEFAULT_LOADER)??B});let _;_=(await B("node:module")).createRequire(l.protocol==="file:"||l.protocol==="node:"?l.href:h.join(process.cwd(),"__mf_require_base__.js")),y.runInThisContext()(p.exports,p.module,_,m,g);const b=p.module.exports||p.exports;if(r&&b&&r.globalName){t(void 0,b[r.globalName]||b);return}t(void 0,b)}catch(u){t(u instanceof Error?u:new Error(`Script execution error: ${u}`))}};s().then(async a=>{if((r==null?void 0:r.type)==="esm"||(r==null?void 0:r.type)==="module")return ve(o.href,{fetch:a,vm:await B("vm")}).then(async l=>{await l.evaluate(),t(void 0,l.namespace)}).catch(l=>{t(l instanceof Error?l:new Error(`Script execution error: ${l}`))});i(a,o)}).catch(a=>{t(a)})}:(e,t,r,n)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},er=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t)=>new Promise((r,n)=>{Qt(e,(o,s)=>{var i,a;if(o)n(o);else{const l=((i=t==null?void 0:t.attrs)==null?void 0:i.globalName)||`__FEDERATION_${(a=t==null?void 0:t.attrs)==null?void 0:a.name}:custom__`;r(globalThis[l]=s)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},be=new Map;async function ve(e,t){if(be.has(e))return be.get(e);const{fetch:r,vm:n}=t,o=await(await r(e)).text(),s=new n.SourceTextModule(o,{importModuleDynamically:async(i,a)=>{const l=new URL(i,e).href;return ve(l,t)}});return be.set(e,s),await s.link(async i=>{const a=new URL(i,e).href;return await ve(a,t)}),s}const D=rt("[ Module Federation Bridge Vue3 ]"),tr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,it=(e,t,r,n)=>{const o=[`${[t[e]]} #${e}`];return r&&o.push(`args: ${JSON.stringify(r)}`),o.push(tr(e)),n&&o.push(`Original Error Message:
6
6
  ${n}`),o.join(`
7
- `)};function rr(e,t,r,n,o,s){return n(it(e,t,r,o))}const G="[ Federation Runtime ]",ve=rt(G);function k(e,t,r,n,o){e||$(t)}function $(e,t,r,n,o){if(t!==void 0)return rr(e,t,r??{},i=>{throw new Error(`${G}: ${i}`)},n);const s=e;throw s instanceof Error?(s.message.startsWith(G)||(s.message=`${G}: ${s.message}`),s):new Error(`${G}: ${s}`)}function Le(e){e instanceof Error&&(e.message.startsWith(G)||(e.message=`${G}: ${e.message}`)),ve.warn(e)}function nr(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function Q(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Me(e){return typeof e.entry<"u"}function at(e){return!e.entry.includes(".json")}function Ce(e){return e&&typeof e=="object"}const or=Object.prototype.toString;function sr(e){return or.call(e)==="[object Object]"}function ct(e){return Array.isArray(e)?e:[e]}function lt(e){const t={url:"",type:"global",globalName:""};return H||Xe()||!("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 ir=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},I=typeof globalThis=="object"?globalThis:window,O=(()=>{try{return document.defaultView}catch{return I}})(),ee=O;function le(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function ue(e,t){return Object.hasOwnProperty.call(e,t)}ue(I,"__GLOBAL_LOADING_REMOTE_ENTRY__")||le(I,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const W=I.__GLOBAL_LOADING_REMOTE_ENTRY__;function ut(e){var t,r,n,o,s,i;ue(e,"__VMOK__")&&!ue(e,"__FEDERATION__")&&le(e,"__FEDERATION__",e.__VMOK__),ue(e,"__FEDERATION__")||(le(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),le(e,"__VMOK__",e.__FEDERATION__)),(t=e.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(r=e.__FEDERATION__).__INSTANCES__??(r.__INSTANCES__=[]),(n=e.__FEDERATION__).moduleInfo??(n.moduleInfo={}),(o=e.__FEDERATION__).__SHARE__??(o.__SHARE__={}),(s=e.__FEDERATION__).__MANIFEST_LOADING__??(s.__MANIFEST_LOADING__={}),(i=e.__FEDERATION__).__PRELOADED_MAP__??(i.__PRELOADED_MAP__=new Map)}ut(I);ut(O);function ar(e,t=we()){t&&(I.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.3.2")}function K(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const n of r){const[o,s]=n.split(":"),i=`${o}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}else $(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const xe=()=>O.__FEDERATION__.moduleInfo,cr=(e,t)=>{const r=K(t,Q(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:n,...o}=e,s=Q(o),i=K(O.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===n)return i}},fe=e=>cr(e,O.__FEDERATION__.moduleInfo),Ue=(e,t)=>{const r=Q(e);return O.__FEDERATION__.moduleInfo[r]=t,O.__FEDERATION__.moduleInfo},lr=e=>(O.__FEDERATION__.moduleInfo={...O.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete O.__FEDERATION__.moduleInfo[r]}),De=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:I[r]}},ur=()=>O.__FEDERATION__.__GLOBAL_PLUGIN__,fr=e=>I.__FEDERATION__.__PRELOADED_MAP__.get(e),hr=e=>I.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Ve="[0-9A-Za-z-]+",Fe=`(?:\\+(${Ve}(?:\\.${Ve})*))`,Z="0|[1-9]\\d*",he="[0-9]+",ft="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Be=`(?:${he}|${ft})`,dr=`(?:-?(${Be}(?:\\.${Be})*))`,We=`(?:${Z}|${ft})`,ht=`(?:-(${We}(?:\\.${We})*))`,be=`${Z}|x|X|\\*`,z=`[v=\\s]*(${be})(?:\\.(${be})(?:\\.(${be})(?:${ht})?${Fe}?)?)?`,pr=`^\\s*(${z})\\s+-\\s+(${z})\\s*$`,mr=`[v=\\s]*${`(${he})\\.(${he})\\.(${he})`}${dr}?${Fe}?`,He="((?:<|>)?=?)",yr=`(\\s*)${He}\\s*(${mr}|${z})`,dt="(?:~>?)",gr=`(\\s*)${dt}\\s+`,pt="(?:\\^)",Er=`(\\s*)${pt}\\s+`,_r="(<|>)?=?\\s*\\*",br=`^${pt}${z}$`,Rr=`v?${`(${Z})\\.(${Z})\\.(${Z})`}${ht}?${Fe}?`,Sr=`^${dt}${z}$`,$r=`^${He}\\s*${z}$`,wr=`^${He}\\s*(${Rr})$|^$`,Nr="^\\s*>=\\s*0.0.0\\s*$";function C(e){return new RegExp(e)}function T(e){return!e||e.toLowerCase()==="x"||e==="*"}function mt(...e){return t=>e.reduce((r,n)=>n(r),t)}function je(e){return e.match(C(wr))}function qe(e,t,r,n){const o=`${e}.${t}.${r}`;return n?`${o}-${n}`:o}function Ir(e){return e.replace(C(pr),(t,r,n,o,s,i,a,l,c,u,d,h)=>(T(n)?r="":T(o)?r=`>=${n}.0.0`:T(s)?r=`>=${n}.${o}.0`:r=`>=${r}`,T(c)?l="":T(u)?l=`<${Number(c)+1}.0.0-0`:T(d)?l=`<${c}.${Number(u)+1}.0-0`:h?l=`<=${c}.${u}.${d}-${h}`:l=`<=${l}`,`${r} ${l}`.trim()))}function Tr(e){return e.replace(C(yr),"$1$2$3")}function vr(e){return e.replace(C(gr),"$1~")}function Ar(e){return e.replace(C(Er),"$1^")}function Pr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(br),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(s)?n==="0"?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.0 <${Number(n)+1}.0.0-0`:i?n==="0"?o==="0"?`>=${n}.${o}.${s}-${i} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s}-${i} <${Number(n)+1}.0.0-0`:n==="0"?o==="0"?`>=${n}.${o}.${s} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${Number(n)+1}.0.0-0`)).join(" ")}function kr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(Sr),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(s)?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:i?`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`)).join(" ")}function Or(e){return e.split(/\s+/).map(t=>t.trim().replace(C($r),(r,n,o,s,i,a)=>{const l=T(o),c=l||T(s),u=c||T(i);return n==="="&&u&&(n=""),a="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&u?(c&&(s=0),i=0,n===">"?(n=">=",c?(o=Number(o)+1,s=0,i=0):(s=Number(s)+1,i=0)):n==="<="&&(n="<",c?o=Number(o)+1:s=Number(s)+1),n==="<"&&(a="-0"),`${n+o}.${s}.${i}${a}`):c?`>=${o}.0.0${a} <${Number(o)+1}.0.0-0`:u?`>=${o}.${s}.0${a} <${o}.${Number(s)+1}.0-0`:r})).join(" ")}function Lr(e){return e.trim().replace(C(_r),"")}function Mr(e){return e.trim().replace(C(Nr),"")}function de(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Cr(e,t){const{preRelease:r}=e,{preRelease:n}=t;if(r===void 0&&n)return 1;if(r&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let o=0,s=r.length;o<=s;o++){const i=r[o],a=n[o];if(i!==a)return i===void 0&&a===void 0?0:i?a?de(i,a):-1:1}return 0}function ie(e,t){return de(e.major,t.major)||de(e.minor,t.minor)||de(e.patch,t.patch)||Cr(e,t)}function Re(e,t){return e.version===t.version}function Dr(e,t){switch(e.operator){case"":case"=":return Re(e,t);case">":return ie(e,t)<0;case">=":return Re(e,t)||ie(e,t)<0;case"<":return ie(e,t)>0;case"<=":return Re(e,t)||ie(e,t)>0;case void 0:return!0;default:return!1}}function Fr(e){return mt(Pr,kr,Or,Lr)(e)}function Hr(e){return mt(Ir,Tr,vr,Ar)(e.trim()).split(/\s+/).join(" ")}function Y(e,t){if(!e)return!1;const r=je(e);if(!r)return!1;const[,n,,o,s,i,a]=r,l={operator:n,version:qe(o,s,i,a),major:o,minor:s,patch:i,preRelease:a==null?void 0:a.split(".")},c=t.split("||");for(const u of c){const d=u.trim();if(!d||d==="*"||d==="x")return!0;try{const h=Hr(d);if(!h.trim())return!0;const f=h.split(" ").map(g=>Fr(g)).join(" ");if(!f.trim())return!0;const p=f.split(/\s+/).map(g=>Mr(g)).filter(Boolean);if(p.length===0)continue;let m=!0;for(const g of p){const y=je(g);if(!y){m=!1;break}const[,E,,b,S,_,w]=y;if(!Dr({operator:E,version:qe(b,S,_,w),major:b,minor:S,patch:_,preRelease:w==null?void 0:w.split(".")},l)){m=!1;break}}if(m)return!0}catch(h){console.error(`[semver] Error processing range part "${d}":`,h);continue}}return!1}const ne="default",yt="global";function Gr(e,t,r,n){var s,i;let o;return"get"in e?o=e.get:"lib"in e?o=()=>Promise.resolve(e.lib):o=()=>Promise.resolve(()=>{$(`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)&&$(`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:o,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??n)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??$e.UNKNOWN,useIn:[]}:void 0}}function gt(e,t){const r=t.shared||{},n=t.name,o=Object.keys(r).reduce((i,a)=>{const l=ct(r[a]);return i[a]=i[a]||[],l.forEach(c=>{i[a].push(Gr(c,n,a,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(o).forEach(i=>{s[i]?o[i].forEach(a=>{s[i].find(l=>l.version===a.version)||s[i].push(a)}):s[i]=o[i]}),{allShareInfos:s,newShareInfos:o}}function te(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===$e.NO_USE?!1:r===$e.CALCULATED?!0:n==="runtime-infer"?t?Ur(e,t):!0:!1}function x(e,t){const r=n=>{if(!Number.isNaN(Number(n))){const o=n.split(".");let s=n;for(let i=0;i<3-o.length;i++)s+=".0";return s}return n};return!!Y(r(e),`<=${r(t)}`)}const re=(e,t)=>{const r=t||function(n,o){return x(n,o)};return Object.keys(e).reduce((n,o)=>!n||r(n,o)||n==="0"?o:n,0)},me=e=>!!e.loaded||typeof e.lib=="function",xr=e=>!!e.loading,Ur=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function Vr(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){return i?o[l].treeShaking?o[c].treeShaking?!me(o[l].treeShaking)&&x(l,c):!1:!0:!me(o[l])&&x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}const U=e=>me(e)||xr(e);function Br(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){if(i){if(!o[l].treeShaking)return!0;if(!o[c].treeShaking)return!1;if(U(o[c].treeShaking))return U(o[l].treeShaking)?!!x(l,c):!0;if(U(o[l].treeShaking))return!1}return U(o[c])?U(o[l])?!!x(l,c):!0:U(o[l])?!1:x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}function Wr(e){return e==="loaded-first"?Br:Vr}function pe(e,t,r,n){if(!e)return;const{shareConfig:o,scope:s=ne,strategy:i,treeShaking:a}=r,l=Array.isArray(s)?s:[s];for(const c of l)if(o&&e[c]&&e[c][t]){const{requiredVersion:u}=o,{version:d,useTreesShaking:h}=Wr(i)(e,c,t,a),f=()=>{const m=e[c][t][d];if(o.singleton){if(typeof u=="string"&&!Y(d,u)){const g=`Version ${d} from ${d&&m.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;o.strictVersion?$(g):Le(g)}return{shared:m,useTreesShaking:h}}else{if(u===!1||u==="*")return{shared:m,useTreesShaking:h};if(Y(d,u))return{shared:m,useTreesShaking:h};const g=te(a);if(g){for(const[y,E]of Object.entries(e[c][t]))if(te(E.treeShaking,a==null?void 0:a.usedExports)&&Y(y,u))return{shared:E,useTreesShaking:g}}for(const[y,E]of Object.entries(e[c][t]))if(Y(y,u))return{shared:E,useTreesShaking:!1}}},p={shareScopeMap:e,scope:c,pkgName:t,version:d,GlobalFederation:ee.__FEDERATION__,shareInfo:r,resolver:f};return(n.emit(p)||p).resolver()}}function Et(){return ee.__FEDERATION__.__SHARE__}function Ke(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,o=l=>{if(!l)return;const c={};return l.forEach(d=>{c[d.version]=d}),c[re(c,function(d,h){return!me(c[d])&&x(d,h)})]},s=(r==null?void 0:r.resolver)??o,i=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),a=(...l)=>{const c={};for(const u of l)if(u)for(const[d,h]of Object.entries(u)){const f=c[d];i(f)&&i(h)?c[d]=a(f,h):h!==void 0&&(c[d]=h)}return c};return a(s(n[t]),r==null?void 0:r.customShareInfo)}const V=(e,t)=>{e.useIn||(e.useIn=[]),nr(e.useIn,t)};function ae(e,t){return t&&e.treeShaking?e.treeShaking:e}function jr(e,t){for(const r of e){const n=t.startsWith(r.name);let o=t.replace(r.name,"");if(n){if(o.startsWith("/")){const a=r.name;return o=`.${o}`,{pkgNameOrAlias:a,expose:o,remote:r}}else if(o==="")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 a=r.alias;return i=`.${i}`,{pkgNameOrAlias:a,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function qr(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const _t="RUNTIME-001",bt="RUNTIME-002",Rt="RUNTIME-003",St="RUNTIME-004",$t="RUNTIME-005",Ae="RUNTIME-006",wt="RUNTIME-007",Ge="RUNTIME-008",Kr="RUNTIME-009",Nt="RUNTIME-010",It="RUNTIME-011",zr="RUNTIME-012",L={[_t]:"Failed to get remoteEntry exports.",[bt]:'The remote entry interface does not contain "init"',[Rt]:"Failed to get manifest.",[St]:"Failed to locate remote.",[$t]:"Invalid loadShareSync function call from bundler runtime",[Ae]:"Invalid loadShareSync function call from runtime",[wt]:"Failed to get remote snapshot.",[Ge]:"Failed to load script resources.",[Kr]:"Please call createInstance first.",[Nt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[It]:"The remoteEntry URL is missing from the remote snapshot.",[zr]:'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.'};({...L});const Tt=".then(callbacks[0]).catch(callbacks[1])";async function Jr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Tt}`)([r,n]):import(e).then(r).catch(n)}catch(o){$(`Failed to load ESM entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}async function Xr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(n):new Function("callbacks",`System.import("${e}")${Tt}`)([r,n])}catch(o){$(`Failed to load SystemJS entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}function vt(e,t,r){const{remoteEntryKey:n,entryExports:o}=De(e,t);return o||$(_t,L,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),o}async function Yr({name:e,globalName:t,entry:r,loaderHook:n,getEntryUrl:o}){const{entryExports:s}=De(e,t);if(s)return s;const i=o?o(r):r;return Yt(i,{attrs:{},createScriptHook:(a,l)=>{const c=n.lifecycle.createScript.emit({url:a,attrs:l});if(c&&(c instanceof HTMLScriptElement||"script"in c||"timeout"in c))return c}}).then(()=>vt(e,t,r),a=>{const l=a instanceof Error?a.message:String(a);$(Ge,L,{remoteName:e,resourceUrl:i},l)})}async function Zr({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:o,entryGlobalName:s,name:i,type:a}=e;switch(a){case"esm":case"module":return Jr({entry:o,remoteEntryExports:t});case"system":return Xr({entry:o,remoteEntryExports:t});default:return Yr({entry:o,globalName:s,name:i,loaderHook:r,getEntryUrl:n})}}async function Qr({remoteInfo:e,loaderHook:t}){const{entry:r,entryGlobalName:n,name:o,type:s}=e,{entryExports:i}=De(o,n);return i||er(r,{attrs:{name:o,globalName:n,type:s},loaderHook:{createScriptHook:(a,l={})=>{const c=t.lifecycle.createScript.emit({url:a,attrs:l});if(c&&"url"in c)return c}}}).then(()=>vt(o,n,r)).catch(a=>{$(`Failed to load Node.js entry for remote "${o}" from "${r}". ${a instanceof Error?a.message:String(a)}`)})}function Pe(e){const{entry:t,name:r}=e;return Ye(r,t)}async function ye(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:o,_inErrorHandling:s=!1}=e,i=Pe(n);if(r)return r;if(!W[i]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;W[i]=a.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:r}).then(c=>c||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":H)?Zr({remoteInfo:n,remoteEntryExports:r,loaderHook:l,getEntryUrl:o}):Qr({remoteInfo:n,loaderHook:l}))).catch(async c=>{const u=Pe(n),d=c instanceof Error&&c.message.includes("ScriptExecutionError");if(c instanceof Error&&c.message.includes(Ge)&&!d&&!s){const h=p=>ye({...p,_inErrorHandling:!0}),f=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:W,uniqueKey:u});if(f)return f}throw c})}return W[i]}function ke(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||yt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ne}}function en(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function tn(e,t){const r=ur(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(o=>{e!=null&&e.find(s=>s.name!==o.name)&&e.push(o)}),e&&e.length>0&&e.forEach(o=>{n.forEach(s=>{s.applyPlugin(o,t)})}),e}function rn(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 J(e){var r,n,o,s,i,a;const t={};for(const[l,c]of Object.entries(e.shared)){const u=c[0];u&&(t[l]={version:u.version,singleton:(r=u.shareConfig)==null?void 0:r.singleton,requiredVersion:((n=u.shareConfig)==null?void 0:n.requiredVersion)===!1?!1:(o=u.shareConfig)==null?void 0:o.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:((a=e.remotes)==null?void 0:a.map(rn))??[],shared:t}}}function At(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...e}}function nn(e,t){return t.map(r=>{const n=qr(e,r.nameOrAlias);return k(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Qe({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:At(r)}})}function on(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Pt(e,t,r,n=!0){const{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(a=>{const{moduleInfo:l}=a,c=t.moduleCache.get(e.name);ye(c?{origin:t,remoteInfo:l,remoteEntryExports:c.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const a={rel:"preload",as:"style"};o.forEach(l=>{const{link:c,needAttach:u}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(d,h)=>{const f=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:h});if(f instanceof HTMLLinkElement)return f}});u&&document.head.appendChild(c)})}else{const a={rel:"stylesheet",type:"text/css"};o.forEach(l=>{const{link:c,needAttach:u}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(d,h)=>{const f=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:h});if(f instanceof HTMLLinkElement)return f},needDeleteLink:!1});u&&document.head.appendChild(c)})}if(n){const a={rel:"preload",as:"script"};s.forEach(l=>{const{link:c,needAttach:u}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(d,h)=>{const f=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:h});if(f instanceof HTMLLinkElement)return f}});u&&document.head.appendChild(c)})}else{const a={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};s.forEach(l=>{const{script:c,needAttach:u}=ot({url:l,cb:()=>{},attrs:a,createScriptHook:(d,h)=>{const f=t.loaderHook.lifecycle.createScript.emit({url:d,attrs:h});if(f instanceof HTMLScriptElement)return f},needDeleteScript:!0});u&&document.head.appendChild(c)})}}}function sn(e,t,r){const n=t,o=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];o.length||o.push("default"),o.forEach(i=>{n[i]||(n[i]={})});const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?o:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:n,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:n[o[0]],initScope:r??[]}}var kt=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const e=await ye({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return k(e,`remoteEntryExports is undefined
8
- ${Qe(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async init(e,t,r){const n=await this.getEntry();if(this.inited)return n;if(this.initPromise)return await this.initPromise,n;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:o,shareScope:s,initScope:i}=sn(this.remoteInfo,this.host.shareScopeMap,r),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:s,remoteEntryInitOptions:o,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&$(bt,L,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,J(this.host.options)),await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,n){const{loadFactory:o=!0}=r||{loadFactory:!0},s=await this.init(e,n);this.lib=s;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo}),i||(i=await s.get(t)),k(i,`${Q(this.remoteInfo)} remote don't export ${t}.`);const a=ir(this.remoteInfo.name,t),l=this.wraperFactory(i,a);return o?await l():l}wraperFactory(e,t){function r(n,o){n&&typeof n=="object"&&Object.isExtensible(n)&&!Object.getOwnPropertyDescriptor(n,Symbol.for("mf_module_id"))&&Object.defineProperty(n,Symbol.for("mf_module_id"),{value:o,enumerable:!1})}return e instanceof Promise?async()=>{const n=await e();return r(n,t),n}:()=>{const n=e();return r(n,t),n}}},A=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(...n){return t.remove(r),e.apply(null,n)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},P=class extends A{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let n=0;const o=s=>s===!1?!1:n<r.length?Promise.resolve(r[n++].apply(null,e)).then(o):s;t=o()}return Promise.resolve(t)}};function Ot(e,t){if(!Ce(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var j=class extends A{constructor(e){super(),this.onerror=$,this.type=e}emit(e){Ce(e)||$(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(Ot(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Le(r),this.onerror(r)}return e}},F=class extends A{constructor(e){super(),this.onerror=$,this.type=e}emit(e){Ce(e)||$(`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 n=s=>(Le(s),this.onerror(s),e),o=s=>{if(Ot(e,s)){if(e=s,r<t.length)try{return Promise.resolve(t[r++](e)).then(o,n)}catch(i){return n(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(o(e))}return Promise.resolve(e)}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var n;k(sr(e),"Plugin configuration is invalid.");const r=e.name;k(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,(n=e.apply)==null||n.call(e,t),Object.keys(this.lifecycle).forEach(o=>{const s=e[o];s&&this.lifecycle[o].on(s)}))}removePlugin(e){k(e,"A name is required.");const t=this.registerPlugins[e];k(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Lt(e,t){const r=lt(t);r.url||$(It,L,{remoteName:e.name});let n=Ne(t,r.url);!H&&!n.startsWith("http")&&(n=`https:${n}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function an(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:o,remoteInfo:s,id:i}=e;if(!Me(t)||!at(t)){const{remoteSnapshot:a,globalSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Lt(s,a);const c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await o.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:c,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:l});return u&&Pt(s,o,u,!1),{...e,remoteSnapshot:a}}return e}}}function cn(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 Mt(e,t,r,n,o={},s){const{value:i}=K(e,Q(t)),a=s||i;if(a&&!et(a)&&(r(a,t,n),a.remotesInfo)){const l=Object.keys(a.remotesInfo);for(const c of l){if(o[c])continue;o[c]=!0;const u=cn(c),d=a.remotesInfo[c];Mt(e,{name:u.name,version:d.matchedVersion},r,!1,o,void 0)}}}const Se=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function ln(e,t,r,n,o){const s=[],i=[],a=[],l=new Set,c=new Set,{options:u}=e,{preloadConfig:d}=t,{depsRemote:h}=d;if(Mt(n,r,(p,m,g)=>{var w;let y;if(g)y=d;else if(Array.isArray(h)){const R=h.find(N=>N.nameOrAlias===m.name||N.nameOrAlias===m.alias);if(!R)return;y=At(R)}else if(h===!0)y=d;else return;const E=Ne(p,lt(p).url);E&&a.push({name:m.name,moduleInfo:{name:m.name,entry:E,type:"remoteEntryType"in p?p.remoteEntryType:"global",entryGlobalName:"globalName"in p?p.globalName:m.name,shareScope:"",version:"version"in p?p.version:void 0},url:E});let b="modules"in p?p.modules:[];const S=on(y.exposes);S.length&&"modules"in p&&(b=(w=p==null?void 0:p.modules)==null?void 0:w.reduce((R,N)=>((S==null?void 0:S.indexOf(N.moduleName))!==-1&&R.push(N),R),[]));function _(R){const N=R.map(M=>Ne(p,M));return y.filter?N.filter(y.filter):N}if(b){const R=b.length;for(let N=0;N<R;N++){const M=b[N],ge=`${m.name}/${M.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?m.name:ge,name:m.name,remoteSnapshot:p,preloadConfig:y,remote:m,origin:e}),!fr(ge)&&(y.resourceCategory==="all"?(s.push(..._(M.assets.css.async)),s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.async)),i.push(..._(M.assets.js.sync))):y.resourceCategory==="sync"&&(s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.sync))),hr(ge))}}},!0,{},o),o.shared&&o.shared.length>0){const p=(m,g)=>{const{shared:y}=pe(e.shareScopeMap,g.sharedName,m,e.sharedHandler.hooks.lifecycle.resolveShare)||{};y&&typeof y.lib=="function"&&(g.assets.js.sync.forEach(E=>{l.add(E)}),g.assets.css.sync.forEach(E=>{c.add(E)}))};o.shared.forEach(m=>{var E;const g=(E=u.shared)==null?void 0:E[m.sharedName];if(!g)return;const y=m.version?g.find(b=>b.version===m.version):g;y&&ct(y).forEach(b=>{p(b,m)})})}const f=i.filter(p=>!l.has(p)&&!Se("script",p));return{cssAssets:s.filter(p=>!c.has(p)&&!Se("link",p)),jsAssetsWithoutEntry:f,entryAssets:a.filter(p=>!Se("script",p.url))}}const un=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:n,remote:o,globalSnapshot:s,remoteSnapshot:i}=e;return H?Me(o)&&at(o)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:o.name,url:o.entry,moduleInfo:{name:n.name,entry:o.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Lt(n,i),ln(t,r,n,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Ct(e,t){const r=fe({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&K(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:"version"in e?e.version:void 0})}}var fn=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new P("beforeLoadRemoteSnapshot"),loadSnapshot:new F("loadGlobalSnapshot"),loadRemoteSnapshot:new F("loadRemoteSnapshot"),afterLoadSnapshot:new F("afterLoadSnapshot")}),this.manifestLoading=ee.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){const{options:n}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:n,moduleInfo:e});let o=fe({name:this.HostInstance.options.name,version:this.HostInstance.options.version});o||(o={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},lr({[this.HostInstance.options.name]:o})),o&&"remotesInfo"in o&&!K(o.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(o.remotesInfo={...o==null?void 0:o.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a}=this.getGlobalRemoteInfo(e),{remoteSnapshot:l,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a});let u,d;if(l)if(et(l)){const h=H?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||"",f=await this.getManifestJson(h,e,{}),p=Ue({...e,entry:h},f);u=f,d=p}else{const{remoteSnapshot:h}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:"global"});u=h,d=c}else if(Me(e)){const h=await this.getManifestJson(e.entry,e,{}),f=Ue(e,h),{remoteSnapshot:p}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:h,from:"global"});u=p,d=f}else $(wt,L,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(c)},void 0,J(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:d}}getGlobalRemoteInfo(e){return Ct(e,this.HostInstance)}async getManifestJson(e,t,r){const n=async()=>{let s=this.manifestCache.get(e);if(s)return s;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{});(!i||!(i instanceof Response))&&(i=await fetch(e,{})),s=await i.json()}catch(i){s=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),s||(delete this.manifestLoading[e],$(Rt,L,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,J(this.HostInstance.options)))}return k(s.metaData&&s.exposes&&s.shared,`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${[!s.metaData&&"metaData",!s.exposes&&"exposes",!s.shared&&"shared"].filter(Boolean).join(", ")}.`),this.manifestCache.set(e,s),s},o=async()=>{const s=await n(),i=qt(s,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=o().then(s=>s)),this.manifestLoading[e]}},hn=class{constructor(e){this.hooks=new q({beforeRegisterShare:new j("beforeRegisterShare"),afterResolve:new F("afterResolve"),beforeLoadShare:new F("beforeLoadShare"),loadShare:new P,resolveShare:new j("resolveShare"),initContainerShareScopeMap:new j("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=gt(e,t);return Object.keys(r).forEach(o=>{r[o].forEach(s=>{s.scope.forEach(i=>{var a;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:o,shared:s}),(a=this.shareScopeMap[i])!=null&&a[o]||this.setShared({pkgName:o,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name})})})}),{newShareInfos:r,allShareInfos:n}}async loadShare(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&await Promise.all(n.scope.map(async a=>{await Promise.all(this.initializeSharing(a,{strategy:n.strategy}))}));const{shareInfo:o}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});k(o,`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{shared:s,useTreesShaking:i}=pe(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(s){const a=ae(s,i);if(a.lib)return V(a,r.options.name),a.lib;if(a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),V(a,r.options.name),l}else{const c=(async()=>{const u=await a.get();return V(a,r.options.name),a.loaded=!0,a.lib=u,u})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:c,treeShaking:i?a:void 0}),c}}else{if(t!=null&&t.customShareInfo)return!1;const a=te(o.treeShaking),l=ae(o,a),u=(async()=>{const d=await l.get();l.lib=d,l.loaded=!0,V(l,r.options.name);const{shared:h,useTreesShaking:f}=pe(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(h){const p=ae(h,f);p.lib=d,p.loaded=!0,h.from=o.from}return d})();return this.setShared({pkgName:e,loaded:!1,shared:o,from:r.options.name,lib:null,loading:u,treeShaking:a?l:void 0}),u}}initializeSharing(e=ne,t){const{host:r}=this,n=t==null?void 0:t.from,o=t==null?void 0:t.strategy;let s=t==null?void 0:t.initScope;const i=[];if(n!=="build"){const{initTokens:h}=this;s||(s=[]);let f=h[e];if(f||(f=h[e]={from:this.host.name}),s.indexOf(f)>=0)return i;s.push(f)}const a=this.shareScopeMap,l=r.options.name;a[e]||(a[e]={});const c=a[e],u=(h,f)=>{var b;const{version:p,eager:m}=f;c[h]=c[h]||{};const g=c[h],y=g[p]&&ae(g[p]),E=!!(y&&("eager"in y&&y.eager||"shareConfig"in y&&((b=y.shareConfig)!=null&&b.eager)));(!y||y.strategy!=="loaded-first"&&!y.loaded&&(!m!=!E?m:l>g[p].from))&&(g[p]=f)},d=async h=>{const{module:f}=await r.remoteHandler.getRemoteModuleAndOptions({id:h});let p;try{p=await f.getEntry()}catch(m){if(p=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:h,error:m,from:"runtime",lifecycle:"beforeLoadShare",origin:r}),!p)return}finally{p!=null&&p.init&&!f.initing&&(f.remoteEntryExports=p,await f.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(h=>{r.options.shared[h].forEach(f=>{f.scope.includes(e)&&u(h,f)})}),(r.options.shareStrategy==="version-first"||o==="version-first")&&r.options.remotes.forEach(h=>{h.shareScope===e&&i.push(d(h.name))}),i}loadShareSync(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy})});const{shared:o,useTreesShaking:s}=pe(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(o){if(typeof o.lib=="function")return V(o,r.options.name),o.loaded||(o.loaded=!0,o.from===r.options.name&&(n.loaded=!0)),o.lib;if(typeof o.get=="function"){const i=o.get();if(!(i instanceof Promise))return V(o,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:o}),i}}if(n.lib)return n.loaded||(n.loaded=!0),n.lib;if(n.get){const i=n.get();return i instanceof Promise&&$((t==null?void 0:t.from)==="build"?$t:Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}$(Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options))}initShareScopeMap(e,t,r={}){const{host:n}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:n.options,origin:n,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:n,loading:o,loaded:s,get:i,treeShaking:a}){const{version:l,scope:c="default",...u}=t,d=Array.isArray(c)?c:[c],h=f=>{const p=(g,y,E)=>{E&&!g[y]&&(g[y]=E)},m=a?f.treeShaking:f;p(m,"loaded",s),p(m,"loading",o),p(m,"get",i)};d.forEach(f=>{this.shareScopeMap[f]||(this.shareScopeMap[f]={}),this.shareScopeMap[f][e]||(this.shareScopeMap[f][e]={}),this.shareScopeMap[f][e][l]||(this.shareScopeMap[f][e][l]={version:l,scope:[f],...u,lib:n});const p=this.shareScopeMap[f][e][l];h(p),r&&p.from!==r&&(p.from=r)})}_setGlobalShareScopeMap(e){const t=Et(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},dn=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new j("beforeRegisterRemote"),registerRemote:new j("registerRemote"),beforeRequest:new F("beforeRequest"),onLoad:new P("onLoad"),handlePreloadModule:new A("handlePreloadModule"),errorLoadRemote:new P("errorLoadRemote"),beforePreloadRemote:new P("beforePreloadRemote"),generatePreloadAssets:new P("generatePreloadAssets"),afterPreloadRemote:new P,loadEntry:new P}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,n)=>(this.registerRemote(n,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:n}=t,{name:o,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:n},s&&e.startsWith(o)){const i=e.replace(o,s);this.idToRemoteMap[i]={name:r.name,expose:n};return}if(s&&e.startsWith(s)){const i=e.replace(s,o);this.idToRemoteMap[i]={name:r.name,expose:n}}}async loadRemote(e,t){const{host:r}=this;try{const{loadFactory:n=!0}=t||{loadFactory:!0},{module:o,moduleOptions:s,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:a,remote:l,expose:c,id:u,remoteSnapshot:d}=i,h=await o.get(u,c,t,d),f=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:a,expose:c,exposeModule:n?h:void 0,exposeModuleFactory:n?void 0:h,remote:l,options:s,moduleInstance:o,origin:r});return this.setIdToRemoteMap(e,i),typeof f=="function"?f:h}catch(n){const{from:o="runtime"}=t||{from:"runtime"},s=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:o,lifecycle:"onLoad",origin:r});if(!s)throw n;return s}}async preloadRemote(e){const{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=nn(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:o}=n,s=ke(o),{globalSnapshot:i,remoteSnapshot:a}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:o}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:o,remoteInfo:s,globalSnapshot:i,remoteSnapshot:a});l&&Pt(s,t,l)}))}registerRemotes(e,t){const{host:r}=this;e.forEach(n=>{this.registerRemote(n,r.options.remotes,{force:t==null?void 0:t.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let n;try{n=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(f){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:f,lifecycle:"beforeRequest"}),!n)throw f}const{id:o}=n,s=jr(t.options.remotes,o);s||$(St,L,{hostName:t.options.name,requestId:o},void 0,J(t.options));const{remote:i}=s,a=ke(i),l=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:o,...s,options:t.options,origin:t,remoteInfo:a}),{remote:c,expose:u}=l;k(c&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${o}.`);let d=t.moduleCache.get(c.name);const h={host:t,remoteInfo:a};return d||(d=new kt(h),t.moduleCache.set(c.name,d)),{module:d,moduleOptions:h,remoteMatchInfo:l}}registerRemote(e,t,r){const{host:n}=this,o=()=>{if(e.alias){const i=t.find(a=>{var l;return e.alias&&(a.name.startsWith(e.alias)||((l=a.alias)==null?void 0:l.startsWith(e.alias)))});k(!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&&H&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ne),e.type||(e.type=yt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:n});const s=t.find(i=>i.name===e.name);if(!s)o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n});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),o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n}),Ze(i.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:n}=e,o=r.options.remotes.findIndex(i=>i.name===n);o!==-1&&r.options.remotes.splice(o,1);const s=r.moduleCache.get(e.name);if(s){const i=s.remoteInfo,a=i.entryGlobalName;I[a]&&((t=Object.getOwnPropertyDescriptor(I,a))!=null&&t.configurable?delete I[a]:I[a]=void 0);const l=Pe(s.remoteInfo);W[l]&&delete W[l],r.snapshotHandler.manifestCache.delete(i.entry);let c=i.buildVersion?Ye(i.name,i.buildVersion):i.name;const u=I.__FEDERATION__.__INSTANCES__.findIndex(h=>i.buildVersion?h.options.id===c:h.name===c);if(u!==-1){const h=I.__FEDERATION__.__INSTANCES__[u];c=h.options.id||c;const f=Et();let p=!0;const m=[];Object.keys(f).forEach(g=>{const y=f[g];y&&Object.keys(y).forEach(E=>{const b=y[E];b&&Object.keys(b).forEach(S=>{const _=b[S];_&&Object.keys(_).forEach(w=>{const R=_[w];R&&typeof R=="object"&&R.from===i.name&&(R.loaded||R.loading?(R.useIn=R.useIn.filter(N=>N!==i.name),R.useIn.length?p=!1:m.push([g,E,S,w])):m.push([g,E,S,w]))})})})}),p&&(h.shareScopeMap={},delete f[c]),m.forEach(([g,y,E,b])=>{var S,_,w;(w=(_=(S=f[g])==null?void 0:S[y])==null?void 0:_[E])==null||delete w[b]}),I.__FEDERATION__.__INSTANCES__.splice(u,1)}const{hostGlobalSnapshot:d}=Ct(e,r);if(d){const h=d&&"remotesInfo"in d&&d.remotesInfo&&K(d.remotesInfo,e.name).key;h&&(delete d.remotesInfo[h],ee.__FEDERATION__.__MANIFEST_LOADING__[h]&&delete ee.__FEDERATION__.__MANIFEST_LOADING__[h])}r.moduleCache.delete(e.name)}}catch(r){ve.error(`removeRemote failed: ${r instanceof Error?r.message:String(r)}`)}}};const pn=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var mn=class{constructor(e){this.hooks=new q({beforeInit:new j("beforeInit"),init:new A,beforeInitContainer:new F("beforeInitContainer"),initContainer:new F("initContainer")}),this.version="2.3.2",this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new A,createScript:new A,createLink:new A,fetch:new P,loadEntryError:new P,getModuleFactory:new P}),this.bridgeHook=new q({beforeBridgeRender:new A,afterBridgeRender:new A,beforeBridgeDestroy:new A,afterBridgeDestroy:new A});const t=pn?[an(),un()]:[],r={id:en(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:H};this.name=e.name,this.options=r,this.snapshotHandler=new fn(this),this.sharedHandler=new hn(this),this.remoteHandler=new dn(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&&$(it(Nt,L)),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=ne,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=ke({name:e,entry:t}),o=new kt({host:this,remoteInfo:n});return o.remoteEntryExports=r,this.moduleCache.set(e,o),o}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}=gt(e,t),{userOptions:n,options:o}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(o,n),{allShareInfos:i}=this.sharedHandler.registerShared(o,n),a=[...o.plugins];n.plugins&&n.plugins.forEach(c=>{a.includes(c)||a.push(c)});const l={...e,...t,plugins:a,remotes:s,shared:i};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){const t=tn(e,this);this.options.plugins=this.options.plugins.reduce((r,n)=>(n&&r&&!r.find(o=>o.name===n.name)&&r.push(n),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};let yn=null;function Dt(){return yn}ar(mn);function Ft(e,t){const r=n=>{const o=n.length>1&&n.endsWith("/"),s=`${t}/${n}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/";return o?`${s}/`:s};return e.map(n=>{const o={...n,path:r(n.path)};return typeof n.redirect=="string"?o.redirect=r(n.redirect):n.redirect&&typeof n.redirect=="object"&&"path"in n.redirect&&typeof n.redirect.path=="string"&&(o.redirect={...n.redirect,path:r(n.redirect.path)}),n.children&&n.children.length>0&&(o.children=Ft(n.children,t)),o})}function gn(e){const t=e.replace(/\/+$/,""),r=s=>s.startsWith("/")&&s!==t&&!s.startsWith(t+"/"),n=s=>`${t}${s}`.replace(/\/+/g,"/"),o=s=>typeof s=="string"?r(s)?n(s):s:"path"in s&&typeof s.path=="string"&&r(s.path)?{...s,path:n(s.path)}:s;return s=>{const i=s.push.bind(s),a=s.replace.bind(s),l=s.resolve.bind(s);s.push=c=>i(o(c)),s.replace=c=>a(o(c)),s.resolve=(c,...u)=>l(o(c),...u)}}function En(e){const{router:t,basename:r,memoryRoute:n,hashRoute:o}=e,s=t.getRoutes().sort((f,p)=>f.path.split("/").filter(m=>m).length-p.path.split("/").filter(m=>m).length),i=new Map,a=new Set;s.forEach(f=>{i.set(f.path,f)});const l=(f,p)=>`${f}/${p}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",c=(f,p="")=>{if(!f.children||f.children.length===0)return f;for(let m=0;m<f.children.length;m++){const g=f.children[m],y=l(p,g.path),E=i.get(y);if(E&&!a.has(E)){const b={...E,path:g.path};f.children[m]=b,a.add(E),c(b,y)}}return f};let u=[];for(const f of s)if(!a.has(f)){const p=c(f,f.path);a.add(f),u.push(p)}let d,h;return n?d=ce.createMemoryHistory(r):o?(d=ce.createWebHashHistory(),r&&(u=Ft(u,r),h=gn(r))):d=ce.createWebHistory(r),{history:d,routes:u,patchRouter:h}}function _n(e){const t=new Map,r=Dt();return()=>({__APP_VERSION__:"2.3.2",async render(n){var p,m,g;D.debug("createBridgeComponent render Info",n);const{moduleName:o,dom:s,basename:i,memoryRoute:a,hashRoute:l,...c}=n,u=Gt.createApp(e.rootComponent,c);t.set(s,u);const d=await((g=(m=(p=r==null?void 0:r.bridgeHook)==null?void 0:p.lifecycle)==null?void 0:m.beforeBridgeRender)==null?void 0:g.emit(n)),h=d&&typeof d=="object"&&(d!=null&&d.extraProps)?d==null?void 0:d.extraProps:{},f=e.appOptions({app:u,basename:i,memoryRoute:a,hashRoute:l,...c,...h});if(f!=null&&f.router){const{history:y,routes:E,patchRouter:b}=En({router:f.router,basename:n.basename,memoryRoute:n.memoryRoute,hashRoute:n.hashRoute}),S=ce.createRouter({...f.router.options,history:y,routes:E});b&&b(S),f.afterRouterCreate&&f.afterRouterCreate(S),D.debug("createBridgeComponent render router info>>>",{moduleName:o,router:S}),a&&await S.push(a.entryPath),u.use(S)}u.mount(s)},destroy(n){D.debug("createBridgeComponent destroy Info",n);const o=t.get(n==null?void 0:n.dom);o==null||o.unmount()}})}function bn(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const Rn=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),n=v.ref(""),o=Oe.useRoute(),s=Dt(),i=v.useAttrs(),a=async()=>{var h,f,p,m;const c=(h=e.providerInfo)==null?void 0:h.call(e);r.value=c;let u={...i,moduleName:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute};D.debug("createRemoteAppComponent LazyComponent render >>>",u);const d=await((m=(p=(f=s==null?void 0:s.bridgeHook)==null?void 0:f.lifecycle)==null?void 0:p.beforeBridgeRender)==null?void 0:m.emit(u))||{};u={...u,...d.extraProps},c.render(u)},l=v.watch(()=>o==null?void 0:o.path,c=>{c!==o.path&&a(),n.value!==""&&n.value!==c&&(D.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:o.path}),bn()),n.value=c});return v.onMounted(()=>{a()}),v.onBeforeUnmount(()=>{var c;D.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e}),l(),(c=r.value)==null||c.destroy({dom:t.value})}),()=>v.createVNode("div",v.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function Ht(e){return v.defineAsyncComponent({__APP_VERSION__:"2.3.2",...e.asyncComponentOptions,loader:async()=>{var l,c;const t=Oe.useRoute();let r="/";const n=(c=(l=t==null?void 0:t.matched)==null?void 0:l[0])==null?void 0:c.path;n&&(n.endsWith("/:pathMatch(.*)*")?r=n.replace("/:pathMatch(.*)*",""):r=t.matched[0].path);const o=(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")],a=s[o];if(D.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:i,module:s,exportName:o,basename:r,route:t}),o in s&&typeof a=="function")return{render(){return v.h(Rn,{moduleName:i,providerInfo:a,basename:r,rootAttrs:e.rootAttrs,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute})}};throw new Error("module not found")}})}function Sn(e){return D.warn("createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"),Ht(e)}exports.createBridgeComponent=_n;exports.createRemoteAppComponent=Ht;exports.createRemoteComponent=Sn;
7
+ `)};function rr(e,t,r,n,o,s){return n(it(e,t,r,o))}const G="[ Federation Runtime ]",Ae=rt(G);function k(e,t,r,n,o){e||$(t)}function $(e,t,r,n,o){if(t!==void 0)return rr(e,t,r??{},i=>{throw new Error(`${G}: ${i}`)},n);const s=e;throw s instanceof Error?(s.message.startsWith(G)||(s.message=`${G}: ${s.message}`),s):new Error(`${G}: ${s}`)}function Le(e){e instanceof Error&&(e.message.startsWith(G)||(e.message=`${G}: ${e.message}`)),Ae.warn(e)}function nr(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function Q(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Me(e){return typeof e.entry<"u"}function at(e){return!e.entry.includes(".json")}function Ce(e){return e&&typeof e=="object"}const or=Object.prototype.toString;function sr(e){return or.call(e)==="[object Object]"}function ct(e){return Array.isArray(e)?e:[e]}function lt(e){const t={url:"",type:"global",globalName:""};return H||Xe()||!("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 ir=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},T=typeof globalThis=="object"?globalThis:window,O=(()=>{try{return document.defaultView}catch{return T}})(),ee=O;function le(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function ue(e,t){return Object.hasOwnProperty.call(e,t)}ue(T,"__GLOBAL_LOADING_REMOTE_ENTRY__")||le(T,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const W=T.__GLOBAL_LOADING_REMOTE_ENTRY__;function ut(e){var t,r,n,o,s,i;ue(e,"__VMOK__")&&!ue(e,"__FEDERATION__")&&le(e,"__FEDERATION__",e.__VMOK__),ue(e,"__FEDERATION__")||(le(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),le(e,"__VMOK__",e.__FEDERATION__)),(t=e.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(r=e.__FEDERATION__).__INSTANCES__??(r.__INSTANCES__=[]),(n=e.__FEDERATION__).moduleInfo??(n.moduleInfo={}),(o=e.__FEDERATION__).__SHARE__??(o.__SHARE__={}),(s=e.__FEDERATION__).__MANIFEST_LOADING__??(s.__MANIFEST_LOADING__={}),(i=e.__FEDERATION__).__PRELOADED_MAP__??(i.__PRELOADED_MAP__=new Map)}ut(T);ut(O);function ar(e,t=Ne()){t&&(T.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,T.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.3.3")}function K(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const n of r){const[o,s]=n.split(":"),i=`${o}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}else $(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const xe=()=>O.__FEDERATION__.moduleInfo,cr=(e,t)=>{const r=K(t,Q(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:n,...o}=e,s=Q(o),i=K(O.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===n)return i}},fe=e=>cr(e,O.__FEDERATION__.moduleInfo),Ue=(e,t)=>{const r=Q(e);return O.__FEDERATION__.moduleInfo[r]=t,O.__FEDERATION__.moduleInfo},lr=e=>(O.__FEDERATION__.moduleInfo={...O.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete O.__FEDERATION__.moduleInfo[r]}),De=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:T[r]}},ur=()=>O.__FEDERATION__.__GLOBAL_PLUGIN__,fr=e=>T.__FEDERATION__.__PRELOADED_MAP__.get(e),hr=e=>T.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Ve="[0-9A-Za-z-]+",Fe=`(?:\\+(${Ve}(?:\\.${Ve})*))`,Z="0|[1-9]\\d*",he="[0-9]+",ft="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Be=`(?:${he}|${ft})`,dr=`(?:-?(${Be}(?:\\.${Be})*))`,We=`(?:${Z}|${ft})`,ht=`(?:-(${We}(?:\\.${We})*))`,Re=`${Z}|x|X|\\*`,z=`[v=\\s]*(${Re})(?:\\.(${Re})(?:\\.(${Re})(?:${ht})?${Fe}?)?)?`,pr=`^\\s*(${z})\\s+-\\s+(${z})\\s*$`,mr=`[v=\\s]*${`(${he})\\.(${he})\\.(${he})`}${dr}?${Fe}?`,He="((?:<|>)?=?)",yr=`(\\s*)${He}\\s*(${mr}|${z})`,dt="(?:~>?)",gr=`(\\s*)${dt}\\s+`,pt="(?:\\^)",Er=`(\\s*)${pt}\\s+`,_r="(<|>)?=?\\s*\\*",br=`^${pt}${z}$`,Rr=`v?${`(${Z})\\.(${Z})\\.(${Z})`}${ht}?${Fe}?`,Sr=`^${dt}${z}$`,$r=`^${He}\\s*${z}$`,wr=`^${He}\\s*(${Rr})$|^$`,Nr="^\\s*>=\\s*0.0.0\\s*$";function C(e){return new RegExp(e)}function I(e){return!e||e.toLowerCase()==="x"||e==="*"}function mt(...e){return t=>e.reduce((r,n)=>n(r),t)}function je(e){return e.match(C(wr))}function qe(e,t,r,n){const o=`${e}.${t}.${r}`;return n?`${o}-${n}`:o}function Tr(e){return e.replace(C(pr),(t,r,n,o,s,i,a,l,c,u,d,h)=>(I(n)?r="":I(o)?r=`>=${n}.0.0`:I(s)?r=`>=${n}.${o}.0`:r=`>=${r}`,I(c)?l="":I(u)?l=`<${Number(c)+1}.0.0-0`:I(d)?l=`<${c}.${Number(u)+1}.0-0`:h?l=`<=${c}.${u}.${d}-${h}`:l=`<=${l}`,`${r} ${l}`.trim()))}function Ir(e){return e.replace(C(yr),"$1$2$3")}function vr(e){return e.replace(C(gr),"$1~")}function Ar(e){return e.replace(C(Er),"$1^")}function Pr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(br),(r,n,o,s,i)=>I(n)?"":I(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:I(s)?n==="0"?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.0 <${Number(n)+1}.0.0-0`:i?n==="0"?o==="0"?`>=${n}.${o}.${s}-${i} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s}-${i} <${Number(n)+1}.0.0-0`:n==="0"?o==="0"?`>=${n}.${o}.${s} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${Number(n)+1}.0.0-0`)).join(" ")}function kr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(Sr),(r,n,o,s,i)=>I(n)?"":I(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:I(s)?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:i?`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`)).join(" ")}function Or(e){return e.split(/\s+/).map(t=>t.trim().replace(C($r),(r,n,o,s,i,a)=>{const l=I(o),c=l||I(s),u=c||I(i);return n==="="&&u&&(n=""),a="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&u?(c&&(s=0),i=0,n===">"?(n=">=",c?(o=Number(o)+1,s=0,i=0):(s=Number(s)+1,i=0)):n==="<="&&(n="<",c?o=Number(o)+1:s=Number(s)+1),n==="<"&&(a="-0"),`${n+o}.${s}.${i}${a}`):c?`>=${o}.0.0${a} <${Number(o)+1}.0.0-0`:u?`>=${o}.${s}.0${a} <${o}.${Number(s)+1}.0-0`:r})).join(" ")}function Lr(e){return e.trim().replace(C(_r),"")}function Mr(e){return e.trim().replace(C(Nr),"")}function de(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Cr(e,t){const{preRelease:r}=e,{preRelease:n}=t;if(r===void 0&&n)return 1;if(r&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let o=0,s=r.length;o<=s;o++){const i=r[o],a=n[o];if(i!==a)return i===void 0&&a===void 0?0:i?a?de(i,a):-1:1}return 0}function ie(e,t){return de(e.major,t.major)||de(e.minor,t.minor)||de(e.patch,t.patch)||Cr(e,t)}function Se(e,t){return e.version===t.version}function Dr(e,t){switch(e.operator){case"":case"=":return Se(e,t);case">":return ie(e,t)<0;case">=":return Se(e,t)||ie(e,t)<0;case"<":return ie(e,t)>0;case"<=":return Se(e,t)||ie(e,t)>0;case void 0:return!0;default:return!1}}function Fr(e){return mt(Pr,kr,Or,Lr)(e)}function Hr(e){return mt(Tr,Ir,vr,Ar)(e.trim()).split(/\s+/).join(" ")}function Y(e,t){if(!e)return!1;const r=je(e);if(!r)return!1;const[,n,,o,s,i,a]=r,l={operator:n,version:qe(o,s,i,a),major:o,minor:s,patch:i,preRelease:a==null?void 0:a.split(".")},c=t.split("||");for(const u of c){const d=u.trim();if(!d||d==="*"||d==="x")return!0;try{const h=Hr(d);if(!h.trim())return!0;const f=h.split(" ").map(g=>Fr(g)).join(" ");if(!f.trim())return!0;const p=f.split(/\s+/).map(g=>Mr(g)).filter(Boolean);if(p.length===0)continue;let m=!0;for(const g of p){const y=je(g);if(!y){m=!1;break}const[,_,,b,R,E,w]=y;if(!Dr({operator:_,version:qe(b,R,E,w),major:b,minor:R,patch:E,preRelease:w==null?void 0:w.split(".")},l)){m=!1;break}}if(m)return!0}catch(h){console.error(`[semver] Error processing range part "${d}":`,h);continue}}return!1}const ne="default",yt="global";function Gr(e,t,r,n){var s,i;let o;return"get"in e?o=e.get:"lib"in e?o=()=>Promise.resolve(e.lib):o=()=>Promise.resolve(()=>{$(`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)&&$(`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:o,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??n)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??we.UNKNOWN,useIn:[]}:void 0}}function gt(e,t){const r=t.shared||{},n=t.name,o=Object.keys(r).reduce((i,a)=>{const l=ct(r[a]);return i[a]=i[a]||[],l.forEach(c=>{i[a].push(Gr(c,n,a,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(o).forEach(i=>{s[i]?o[i].forEach(a=>{s[i].find(l=>l.version===a.version)||s[i].push(a)}):s[i]=o[i]}),{allShareInfos:s,newShareInfos:o}}function te(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===we.NO_USE?!1:r===we.CALCULATED?!0:n==="runtime-infer"?t?Ur(e,t):!0:!1}function x(e,t){const r=n=>{if(!Number.isNaN(Number(n))){const o=n.split(".");let s=n;for(let i=0;i<3-o.length;i++)s+=".0";return s}return n};return!!Y(r(e),`<=${r(t)}`)}const re=(e,t)=>{const r=t||function(n,o){return x(n,o)};return Object.keys(e).reduce((n,o)=>!n||r(n,o)||n==="0"?o:n,0)},me=e=>!!e.loaded||typeof e.lib=="function",xr=e=>!!e.loading,Ur=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function Vr(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){return i?o[l].treeShaking?o[c].treeShaking?!me(o[l].treeShaking)&&x(l,c):!1:!0:!me(o[l])&&x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}const U=e=>me(e)||xr(e);function Br(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){if(i){if(!o[l].treeShaking)return!0;if(!o[c].treeShaking)return!1;if(U(o[c].treeShaking))return U(o[l].treeShaking)?!!x(l,c):!0;if(U(o[l].treeShaking))return!1}return U(o[c])?U(o[l])?!!x(l,c):!0:U(o[l])?!1:x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}function Wr(e){return e==="loaded-first"?Br:Vr}function pe(e,t,r,n){if(!e)return;const{shareConfig:o,scope:s=ne,strategy:i,treeShaking:a}=r,l=Array.isArray(s)?s:[s];for(const c of l)if(o&&e[c]&&e[c][t]){const{requiredVersion:u}=o,{version:d,useTreesShaking:h}=Wr(i)(e,c,t,a),f=()=>{const m=e[c][t][d];if(o.singleton){if(typeof u=="string"&&!Y(d,u)){const g=`Version ${d} from ${d&&m.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;o.strictVersion?$(g):Le(g)}return{shared:m,useTreesShaking:h}}else{if(u===!1||u==="*")return{shared:m,useTreesShaking:h};if(Y(d,u))return{shared:m,useTreesShaking:h};const g=te(a);if(g){for(const[y,_]of Object.entries(e[c][t]))if(te(_.treeShaking,a==null?void 0:a.usedExports)&&Y(y,u))return{shared:_,useTreesShaking:g}}for(const[y,_]of Object.entries(e[c][t]))if(Y(y,u))return{shared:_,useTreesShaking:!1}}},p={shareScopeMap:e,scope:c,pkgName:t,version:d,GlobalFederation:ee.__FEDERATION__,shareInfo:r,resolver:f};return(n.emit(p)||p).resolver()}}function Et(){return ee.__FEDERATION__.__SHARE__}function Ke(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,o=l=>{if(!l)return;const c={};return l.forEach(d=>{c[d.version]=d}),c[re(c,function(d,h){return!me(c[d])&&x(d,h)})]},s=(r==null?void 0:r.resolver)??o,i=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),a=(...l)=>{const c={};for(const u of l)if(u)for(const[d,h]of Object.entries(u)){const f=c[d];i(f)&&i(h)?c[d]=a(f,h):h!==void 0&&(c[d]=h)}return c};return a(s(n[t]),r==null?void 0:r.customShareInfo)}const V=(e,t)=>{e.useIn||(e.useIn=[]),nr(e.useIn,t)};function ae(e,t){return t&&e.treeShaking?e.treeShaking:e}function jr(e,t){for(const r of e){const n=t.startsWith(r.name);let o=t.replace(r.name,"");if(n){if(o.startsWith("/")){const a=r.name;return o=`.${o}`,{pkgNameOrAlias:a,expose:o,remote:r}}else if(o==="")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 a=r.alias;return i=`.${i}`,{pkgNameOrAlias:a,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function qr(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const _t="RUNTIME-001",bt="RUNTIME-002",Rt="RUNTIME-003",St="RUNTIME-004",$t="RUNTIME-005",Pe="RUNTIME-006",wt="RUNTIME-007",Ge="RUNTIME-008",Kr="RUNTIME-009",Nt="RUNTIME-010",Tt="RUNTIME-011",zr="RUNTIME-012",L={[_t]:"Failed to get remoteEntry exports.",[bt]:'The remote entry interface does not contain "init"',[Rt]:"Failed to get manifest.",[St]:"Failed to locate remote.",[$t]:"Invalid loadShareSync function call from bundler runtime",[Pe]:"Invalid loadShareSync function call from runtime",[wt]:"Failed to get remote snapshot.",[Ge]:"Failed to load script resources.",[Kr]:"Please call createInstance first.",[Nt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[Tt]:"The remoteEntry URL is missing from the remote snapshot.",[zr]:'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.'};({...L});const It=".then(callbacks[0]).catch(callbacks[1])";async function Jr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${It}`)([r,n]):import(e).then(r).catch(n)}catch(o){$(`Failed to load ESM entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}async function Xr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(n):new Function("callbacks",`System.import("${e}")${It}`)([r,n])}catch(o){$(`Failed to load SystemJS entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}function vt(e,t,r){const{remoteEntryKey:n,entryExports:o}=De(e,t);return o||$(_t,L,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),o}async function Yr({name:e,globalName:t,entry:r,remoteInfo:n,loaderHook:o,getEntryUrl:s}){const{entryExports:i}=De(e,t);if(i)return i;const a=s?s(r):r;return Yt(a,{attrs:{},createScriptHook:(l,c)=>{const u=o.lifecycle.createScript.emit({url:l,attrs:c,remoteInfo:n});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>vt(e,t,r),l=>{const c=l instanceof Error?l.message:String(l);$(Ge,L,{remoteName:e,resourceUrl:a},c)})}async function Zr({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:o,entryGlobalName:s,name:i,type:a}=e;switch(a){case"esm":case"module":return Jr({entry:o,remoteEntryExports:t});case"system":return Xr({entry:o,remoteEntryExports:t});default:return Yr({entry:o,globalName:s,name:i,remoteInfo:e,loaderHook:r,getEntryUrl:n})}}async function Qr({remoteInfo:e,loaderHook:t}){const{entry:r,entryGlobalName:n,name:o,type:s}=e,{entryExports:i}=De(o,n);return i||er(r,{attrs:{name:o,globalName:n,type:s},loaderHook:{createScriptHook:(a,l={})=>{const c=t.lifecycle.createScript.emit({url:a,attrs:l,remoteInfo:e});if(c&&"url"in c)return c}}}).then(()=>vt(o,n,r)).catch(a=>{$(`Failed to load Node.js entry for remote "${o}" from "${r}". ${a instanceof Error?a.message:String(a)}`)})}function ke(e){const{entry:t,name:r}=e;return Ye(r,t)}async function ye(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:o,_inErrorHandling:s=!1}=e,i=ke(n);if(r)return r;if(!W[i]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;W[i]=a.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:r}).then(c=>c||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":H)?Zr({remoteInfo:n,remoteEntryExports:r,loaderHook:l,getEntryUrl:o}):Qr({remoteInfo:n,loaderHook:l}))).catch(async c=>{const u=ke(n),d=c instanceof Error&&c.message.includes("ScriptExecutionError");if(c instanceof Error&&c.message.includes(Ge)&&!d&&!s){const h=p=>ye({...p,_inErrorHandling:!0}),f=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:W,uniqueKey:u});if(f)return f}throw c})}return W[i]}function ge(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||yt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ne}}function en(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function tn(e,t){const r=ur(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(o=>{e!=null&&e.find(s=>s.name!==o.name)&&e.push(o)}),e&&e.length>0&&e.forEach(o=>{n.forEach(s=>{s.applyPlugin(o,t)})}),e}function rn(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 J(e){var r,n,o,s,i,a;const t={};for(const[l,c]of Object.entries(e.shared)){const u=c[0];u&&(t[l]={version:u.version,singleton:(r=u.shareConfig)==null?void 0:r.singleton,requiredVersion:((n=u.shareConfig)==null?void 0:n.requiredVersion)===!1?!1:(o=u.shareConfig)==null?void 0:o.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:((a=e.remotes)==null?void 0:a.map(rn))??[],shared:t}}}function At(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...e}}function nn(e,t){return t.map(r=>{const n=qr(e,r.nameOrAlias);return k(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Qe({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:At(r)}})}function on(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Pt(e,t,r,n=!0){const{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(a=>{const{moduleInfo:l}=a,c=t.moduleCache.get(e.name);ye(c?{origin:t,remoteInfo:l,remoteEntryExports:c.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const a={rel:"preload",as:"style"};o.forEach(l=>{const{link:c,needAttach:u}=_e({url:l,cb:()=>{},attrs:a,createLinkHook:(d,h)=>{const f=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:h,remoteInfo:e});if(f instanceof HTMLLinkElement)return f}});u&&document.head.appendChild(c)})}else{const a={rel:"stylesheet",type:"text/css"};o.forEach(l=>{const{link:c,needAttach:u}=_e({url:l,cb:()=>{},attrs:a,createLinkHook:(d,h)=>{const f=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:h,remoteInfo:e});if(f instanceof HTMLLinkElement)return f},needDeleteLink:!1});u&&document.head.appendChild(c)})}if(n){const a={rel:"preload",as:"script"};s.forEach(l=>{const{link:c,needAttach:u}=_e({url:l,cb:()=>{},attrs:a,createLinkHook:(d,h)=>{const f=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:h,remoteInfo:e});if(f instanceof HTMLLinkElement)return f}});u&&document.head.appendChild(c)})}else{const a={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};s.forEach(l=>{const{script:c,needAttach:u}=ot({url:l,cb:()=>{},attrs:a,createScriptHook:(d,h)=>{const f=t.loaderHook.lifecycle.createScript.emit({url:d,attrs:h,remoteInfo:e});if(f instanceof HTMLScriptElement)return f},needDeleteScript:!0});u&&document.head.appendChild(c)})}}}function sn(e,t,r){const n=t,o=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];o.length||o.push("default"),o.forEach(i=>{n[i]||(n[i]={})});const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?o:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:n,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:n[o[0]],initScope:r??[]}}var kt=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const e=await ye({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return k(e,`remoteEntryExports is undefined
8
+ ${Qe(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async init(e,t,r){const n=await this.getEntry();if(this.inited)return n;if(this.initPromise)return await this.initPromise,n;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:o,shareScope:s,initScope:i}=sn(this.remoteInfo,this.host.shareScopeMap,r),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:s,remoteEntryInitOptions:o,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&$(bt,L,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,J(this.host.options)),await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,n){const{loadFactory:o=!0}=r||{loadFactory:!0},s=await this.init(e,n);this.lib=s;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo}),i||(i=await s.get(t)),k(i,`${Q(this.remoteInfo)} remote don't export ${t}.`);const a=ir(this.remoteInfo.name,t),l=this.wraperFactory(i,a);return o?await l():l}wraperFactory(e,t){function r(n,o){n&&typeof n=="object"&&Object.isExtensible(n)&&!Object.getOwnPropertyDescriptor(n,Symbol.for("mf_module_id"))&&Object.defineProperty(n,Symbol.for("mf_module_id"),{value:o,enumerable:!1})}return e instanceof Promise?async()=>{const n=await e();return r(n,t),n}:()=>{const n=e();return r(n,t),n}}},A=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(...n){return t.remove(r),e.apply(null,n)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},P=class extends A{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let n=0;const o=s=>s===!1?!1:n<r.length?Promise.resolve(r[n++].apply(null,e)).then(o):s;t=o()}return Promise.resolve(t)}};function Ot(e,t){if(!Ce(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var j=class extends A{constructor(e){super(),this.onerror=$,this.type=e}emit(e){Ce(e)||$(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(Ot(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Le(r),this.onerror(r)}return e}},F=class extends A{constructor(e){super(),this.onerror=$,this.type=e}emit(e){Ce(e)||$(`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 n=s=>(Le(s),this.onerror(s),e),o=s=>{if(Ot(e,s)){if(e=s,r<t.length)try{return Promise.resolve(t[r++](e)).then(o,n)}catch(i){return n(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(o(e))}return Promise.resolve(e)}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var n;k(sr(e),"Plugin configuration is invalid.");const r=e.name;k(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,(n=e.apply)==null||n.call(e,t),Object.keys(this.lifecycle).forEach(o=>{const s=e[o];s&&this.lifecycle[o].on(s)}))}removePlugin(e){k(e,"A name is required.");const t=this.registerPlugins[e];k(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Lt(e,t){const r=lt(t);r.url||$(Tt,L,{remoteName:e.name});let n=Te(t,r.url);!H&&!n.startsWith("http")&&(n=`https:${n}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function an(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:o,remoteInfo:s,id:i}=e;if(!Me(t)||!at(t)){const{remoteSnapshot:a,globalSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Lt(s,a);const c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await o.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:c,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:l});return u&&Pt(s,o,u,!1),{...e,remoteSnapshot:a}}return e}}}function cn(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 Mt(e,t,r,n,o={},s){const{value:i}=K(e,Q(t)),a=s||i;if(a&&!et(a)&&(r(a,t,n),a.remotesInfo)){const l=Object.keys(a.remotesInfo);for(const c of l){if(o[c])continue;o[c]=!0;const u=cn(c),d=a.remotesInfo[c];Mt(e,{name:u.name,version:d.matchedVersion},r,!1,o,void 0)}}}const $e=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function ln(e,t,r,n,o){const s=[],i=[],a=[],l=new Set,c=new Set,{options:u}=e,{preloadConfig:d}=t,{depsRemote:h}=d;if(Mt(n,r,(p,m,g)=>{var w;let y;if(g)y=d;else if(Array.isArray(h)){const S=h.find(N=>N.nameOrAlias===m.name||N.nameOrAlias===m.alias);if(!S)return;y=At(S)}else if(h===!0)y=d;else return;const _=Te(p,lt(p).url);_&&a.push({name:m.name,moduleInfo:{name:m.name,entry:_,type:"remoteEntryType"in p?p.remoteEntryType:"global",entryGlobalName:"globalName"in p?p.globalName:m.name,shareScope:"",version:"version"in p?p.version:void 0},url:_});let b="modules"in p?p.modules:[];const R=on(y.exposes);R.length&&"modules"in p&&(b=(w=p==null?void 0:p.modules)==null?void 0:w.reduce((S,N)=>((R==null?void 0:R.indexOf(N.moduleName))!==-1&&S.push(N),S),[]));function E(S){const N=S.map(M=>Te(p,M));return y.filter?N.filter(y.filter):N}if(b){const S=b.length;for(let N=0;N<S;N++){const M=b[N],Ee=`${m.name}/${M.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?m.name:Ee,name:m.name,remoteSnapshot:p,preloadConfig:y,remote:m,origin:e}),!fr(Ee)&&(y.resourceCategory==="all"?(s.push(...E(M.assets.css.async)),s.push(...E(M.assets.css.sync)),i.push(...E(M.assets.js.async)),i.push(...E(M.assets.js.sync))):y.resourceCategory==="sync"&&(s.push(...E(M.assets.css.sync)),i.push(...E(M.assets.js.sync))),hr(Ee))}}},!0,{},o),o.shared&&o.shared.length>0){const p=(m,g)=>{const{shared:y}=pe(e.shareScopeMap,g.sharedName,m,e.sharedHandler.hooks.lifecycle.resolveShare)||{};y&&typeof y.lib=="function"&&(g.assets.js.sync.forEach(_=>{l.add(_)}),g.assets.css.sync.forEach(_=>{c.add(_)}))};o.shared.forEach(m=>{var _;const g=(_=u.shared)==null?void 0:_[m.sharedName];if(!g)return;const y=m.version?g.find(b=>b.version===m.version):g;y&&ct(y).forEach(b=>{p(b,m)})})}const f=i.filter(p=>!l.has(p)&&!$e("script",p));return{cssAssets:s.filter(p=>!c.has(p)&&!$e("link",p)),jsAssetsWithoutEntry:f,entryAssets:a.filter(p=>!$e("script",p.url))}}const un=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:n,remote:o,globalSnapshot:s,remoteSnapshot:i}=e;return H?Me(o)&&at(o)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:o.name,url:o.entry,moduleInfo:{name:n.name,entry:o.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Lt(n,i),ln(t,r,n,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Ct(e,t){const r=fe({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&K(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:"version"in e?e.version:void 0})}}var fn=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new P("beforeLoadRemoteSnapshot"),loadSnapshot:new F("loadGlobalSnapshot"),loadRemoteSnapshot:new F("loadRemoteSnapshot"),afterLoadSnapshot:new F("afterLoadSnapshot")}),this.manifestLoading=ee.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){const{options:n}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:n,moduleInfo:e});let o=fe({name:this.HostInstance.options.name,version:this.HostInstance.options.version});o||(o={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},lr({[this.HostInstance.options.name]:o})),o&&"remotesInfo"in o&&!K(o.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(o.remotesInfo={...o==null?void 0:o.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a}=this.getGlobalRemoteInfo(e),{remoteSnapshot:l,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a});let u,d;if(l)if(et(l)){const h=H?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||"",f=await this.getManifestJson(h,e,{}),p=Ue({...e,entry:h},f);u=f,d=p}else{const{remoteSnapshot:h}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:"global"});u=h,d=c}else if(Me(e)){const h=await this.getManifestJson(e.entry,e,{}),f=Ue(e,h),{remoteSnapshot:p}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:h,from:"global"});u=p,d=f}else $(wt,L,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(c)},void 0,J(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:d}}getGlobalRemoteInfo(e){return Ct(e,this.HostInstance)}async getManifestJson(e,t,r){const n=async()=>{let s=this.manifestCache.get(e);if(s)return s;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{},ge(t));(!i||!(i instanceof Response))&&(i=await fetch(e,{})),s=await i.json()}catch(i){s=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),s||(delete this.manifestLoading[e],$(Rt,L,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,J(this.HostInstance.options)))}return k(s.metaData&&s.exposes&&s.shared,`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${[!s.metaData&&"metaData",!s.exposes&&"exposes",!s.shared&&"shared"].filter(Boolean).join(", ")}.`),this.manifestCache.set(e,s),s},o=async()=>{const s=await n(),i=qt(s,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=o().then(s=>s)),this.manifestLoading[e]}},hn=class{constructor(e){this.hooks=new q({beforeRegisterShare:new j("beforeRegisterShare"),afterResolve:new F("afterResolve"),beforeLoadShare:new F("beforeLoadShare"),loadShare:new P,resolveShare:new j("resolveShare"),initContainerShareScopeMap:new j("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=gt(e,t);return Object.keys(r).forEach(o=>{r[o].forEach(s=>{s.scope.forEach(i=>{var a;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:o,shared:s}),(a=this.shareScopeMap[i])!=null&&a[o]||this.setShared({pkgName:o,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name})})})}),{newShareInfos:r,allShareInfos:n}}async loadShare(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&await Promise.all(n.scope.map(async a=>{await Promise.all(this.initializeSharing(a,{strategy:n.strategy}))}));const{shareInfo:o}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});k(o,`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{shared:s,useTreesShaking:i}=pe(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(s){const a=ae(s,i);if(a.lib)return V(a,r.options.name),a.lib;if(a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),V(a,r.options.name),l}else{const c=(async()=>{const u=await a.get();return V(a,r.options.name),a.loaded=!0,a.lib=u,u})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:c,treeShaking:i?a:void 0}),c}}else{if(t!=null&&t.customShareInfo)return!1;const a=te(o.treeShaking),l=ae(o,a),u=(async()=>{const d=await l.get();l.lib=d,l.loaded=!0,V(l,r.options.name);const{shared:h,useTreesShaking:f}=pe(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(h){const p=ae(h,f);p.lib=d,p.loaded=!0,h.from=o.from}return d})();return this.setShared({pkgName:e,loaded:!1,shared:o,from:r.options.name,lib:null,loading:u,treeShaking:a?l:void 0}),u}}initializeSharing(e=ne,t){const{host:r}=this,n=t==null?void 0:t.from,o=t==null?void 0:t.strategy;let s=t==null?void 0:t.initScope;const i=[];if(n!=="build"){const{initTokens:h}=this;s||(s=[]);let f=h[e];if(f||(f=h[e]={from:this.host.name}),s.indexOf(f)>=0)return i;s.push(f)}const a=this.shareScopeMap,l=r.options.name;a[e]||(a[e]={});const c=a[e],u=(h,f)=>{var b;const{version:p,eager:m}=f;c[h]=c[h]||{};const g=c[h],y=g[p]&&ae(g[p]),_=!!(y&&("eager"in y&&y.eager||"shareConfig"in y&&((b=y.shareConfig)!=null&&b.eager)));(!y||y.strategy!=="loaded-first"&&!y.loaded&&(!m!=!_?m:l>g[p].from))&&(g[p]=f)},d=async h=>{const{module:f}=await r.remoteHandler.getRemoteModuleAndOptions({id:h});let p;try{p=await f.getEntry()}catch(m){if(p=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:h,error:m,from:"runtime",lifecycle:"beforeLoadShare",origin:r}),!p)return}finally{p!=null&&p.init&&!f.initing&&(f.remoteEntryExports=p,await f.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(h=>{r.options.shared[h].forEach(f=>{f.scope.includes(e)&&u(h,f)})}),(r.options.shareStrategy==="version-first"||o==="version-first")&&r.options.remotes.forEach(h=>{h.shareScope===e&&i.push(d(h.name))}),i}loadShareSync(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy})});const{shared:o,useTreesShaking:s}=pe(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(o){if(typeof o.lib=="function")return V(o,r.options.name),o.loaded||(o.loaded=!0,o.from===r.options.name&&(n.loaded=!0)),o.lib;if(typeof o.get=="function"){const i=o.get();if(!(i instanceof Promise))return V(o,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:o}),i}}if(n.lib)return n.loaded||(n.loaded=!0),n.lib;if(n.get){const i=n.get();return i instanceof Promise&&$((t==null?void 0:t.from)==="build"?$t:Pe,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}$(Pe,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options))}initShareScopeMap(e,t,r={}){const{host:n}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:n.options,origin:n,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:n,loading:o,loaded:s,get:i,treeShaking:a}){const{version:l,scope:c="default",...u}=t,d=Array.isArray(c)?c:[c],h=f=>{const p=(g,y,_)=>{_&&!g[y]&&(g[y]=_)},m=a?f.treeShaking:f;p(m,"loaded",s),p(m,"loading",o),p(m,"get",i)};d.forEach(f=>{this.shareScopeMap[f]||(this.shareScopeMap[f]={}),this.shareScopeMap[f][e]||(this.shareScopeMap[f][e]={}),this.shareScopeMap[f][e][l]||(this.shareScopeMap[f][e][l]={version:l,scope:[f],...u,lib:n});const p=this.shareScopeMap[f][e][l];h(p),r&&p.from!==r&&(p.from=r)})}_setGlobalShareScopeMap(e){const t=Et(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},dn=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new j("beforeRegisterRemote"),registerRemote:new j("registerRemote"),beforeRequest:new F("beforeRequest"),onLoad:new P("onLoad"),handlePreloadModule:new A("handlePreloadModule"),errorLoadRemote:new P("errorLoadRemote"),beforePreloadRemote:new P("beforePreloadRemote"),generatePreloadAssets:new P("generatePreloadAssets"),afterPreloadRemote:new P,loadEntry:new P}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,n)=>(this.registerRemote(n,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:n}=t,{name:o,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:n},s&&e.startsWith(o)){const i=e.replace(o,s);this.idToRemoteMap[i]={name:r.name,expose:n};return}if(s&&e.startsWith(s)){const i=e.replace(s,o);this.idToRemoteMap[i]={name:r.name,expose:n}}}async loadRemote(e,t){const{host:r}=this;try{const{loadFactory:n=!0}=t||{loadFactory:!0},{module:o,moduleOptions:s,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:a,remote:l,expose:c,id:u,remoteSnapshot:d}=i,h=await o.get(u,c,t,d),f=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:a,expose:c,exposeModule:n?h:void 0,exposeModuleFactory:n?void 0:h,remote:l,options:s,moduleInstance:o,origin:r});return this.setIdToRemoteMap(e,i),typeof f=="function"?f:h}catch(n){const{from:o="runtime"}=t||{from:"runtime"},s=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:o,lifecycle:"onLoad",origin:r});if(!s)throw n;return s}}async preloadRemote(e){const{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=nn(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:o}=n,s=ge(o),{globalSnapshot:i,remoteSnapshot:a}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:o}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:o,remoteInfo:s,globalSnapshot:i,remoteSnapshot:a});l&&Pt(s,t,l)}))}registerRemotes(e,t){const{host:r}=this;e.forEach(n=>{this.registerRemote(n,r.options.remotes,{force:t==null?void 0:t.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let n;try{n=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(f){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:f,lifecycle:"beforeRequest"}),!n)throw f}const{id:o}=n,s=jr(t.options.remotes,o);s||$(St,L,{hostName:t.options.name,requestId:o},void 0,J(t.options));const{remote:i}=s,a=ge(i),l=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:o,...s,options:t.options,origin:t,remoteInfo:a}),{remote:c,expose:u}=l;k(c&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${o}.`);let d=t.moduleCache.get(c.name);const h={host:t,remoteInfo:a};return d||(d=new kt(h),t.moduleCache.set(c.name,d)),{module:d,moduleOptions:h,remoteMatchInfo:l}}registerRemote(e,t,r){const{host:n}=this,o=()=>{if(e.alias){const i=t.find(a=>{var l;return e.alias&&(a.name.startsWith(e.alias)||((l=a.alias)==null?void 0:l.startsWith(e.alias)))});k(!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&&H&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ne),e.type||(e.type=yt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:n});const s=t.find(i=>i.name===e.name);if(!s)o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n});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),o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n}),Ze(i.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:n}=e,o=r.options.remotes.findIndex(i=>i.name===n);o!==-1&&r.options.remotes.splice(o,1);const s=r.moduleCache.get(e.name);if(s){const i=s.remoteInfo,a=i.entryGlobalName;T[a]&&((t=Object.getOwnPropertyDescriptor(T,a))!=null&&t.configurable?delete T[a]:T[a]=void 0);const l=ke(s.remoteInfo);W[l]&&delete W[l],r.snapshotHandler.manifestCache.delete(i.entry);let c=i.buildVersion?Ye(i.name,i.buildVersion):i.name;const u=T.__FEDERATION__.__INSTANCES__.findIndex(h=>i.buildVersion?h.options.id===c:h.name===c);if(u!==-1){const h=T.__FEDERATION__.__INSTANCES__[u];c=h.options.id||c;const f=Et();let p=!0;const m=[];Object.keys(f).forEach(g=>{const y=f[g];y&&Object.keys(y).forEach(_=>{const b=y[_];b&&Object.keys(b).forEach(R=>{const E=b[R];E&&Object.keys(E).forEach(w=>{const S=E[w];S&&typeof S=="object"&&S.from===i.name&&(S.loaded||S.loading?(S.useIn=S.useIn.filter(N=>N!==i.name),S.useIn.length?p=!1:m.push([g,_,R,w])):m.push([g,_,R,w]))})})})}),p&&(h.shareScopeMap={},delete f[c]),m.forEach(([g,y,_,b])=>{var R,E,w;(w=(E=(R=f[g])==null?void 0:R[y])==null?void 0:E[_])==null||delete w[b]}),T.__FEDERATION__.__INSTANCES__.splice(u,1)}const{hostGlobalSnapshot:d}=Ct(e,r);if(d){const h=d&&"remotesInfo"in d&&d.remotesInfo&&K(d.remotesInfo,e.name).key;h&&(delete d.remotesInfo[h],ee.__FEDERATION__.__MANIFEST_LOADING__[h]&&delete ee.__FEDERATION__.__MANIFEST_LOADING__[h])}r.moduleCache.delete(e.name)}}catch(r){Ae.error(`removeRemote failed: ${r instanceof Error?r.message:String(r)}`)}}};const pn=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var mn=class{constructor(e){this.hooks=new q({beforeInit:new j("beforeInit"),init:new A,beforeInitContainer:new F("beforeInitContainer"),initContainer:new F("initContainer")}),this.version="2.3.3",this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new A,createScript:new A,createLink:new A,fetch:new P,loadEntryError:new P,getModuleFactory:new P}),this.bridgeHook=new q({beforeBridgeRender:new A,afterBridgeRender:new A,beforeBridgeDestroy:new A,afterBridgeDestroy:new A});const t=pn?[an(),un()]:[],r={id:en(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:H};this.name=e.name,this.options=r,this.snapshotHandler=new fn(this),this.sharedHandler=new hn(this),this.remoteHandler=new dn(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&&$(it(Nt,L)),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=ne,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=ge({name:e,entry:t}),o=new kt({host:this,remoteInfo:n});return o.remoteEntryExports=r,this.moduleCache.set(e,o),o}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}=gt(e,t),{userOptions:n,options:o}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(o,n),{allShareInfos:i}=this.sharedHandler.registerShared(o,n),a=[...o.plugins];n.plugins&&n.plugins.forEach(c=>{a.includes(c)||a.push(c)});const l={...e,...t,plugins:a,remotes:s,shared:i};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){const t=tn(e,this);this.options.plugins=this.options.plugins.reduce((r,n)=>(n&&r&&!r.find(o=>o.name===n.name)&&r.push(n),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};let yn=null;function Dt(){return yn}ar(mn);function Ft(e,t){const r=n=>{if(!n.startsWith("/"))return n;const o=n.length>1&&n.endsWith("/"),s=`${t}/${n}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/";return o?`${s}/`:s};return e.map(n=>{const o={...n,path:r(n.path)};return typeof n.redirect=="string"?o.redirect=r(n.redirect):n.redirect&&typeof n.redirect=="object"&&"path"in n.redirect&&typeof n.redirect.path=="string"&&(o.redirect={...n.redirect,path:r(n.redirect.path)}),n.children&&n.children.length>0&&(o.children=Ft(n.children,t)),o})}function gn(e){const t=e.replace(/\/+$/,""),r=s=>s.startsWith("/")&&s!==t&&!s.startsWith(t+"/"),n=s=>`${t}${s}`.replace(/\/+/g,"/"),o=s=>typeof s=="string"?r(s)?n(s):s:"path"in s&&typeof s.path=="string"&&r(s.path)?{...s,path:n(s.path)}:s;return s=>{const i=s.push.bind(s),a=s.replace.bind(s),l=s.resolve.bind(s);s.push=c=>i(o(c)),s.replace=c=>a(o(c)),s.resolve=(c,...u)=>l(o(c),...u)}}function En(e){const{router:t,basename:r,memoryRoute:n,hashRoute:o}=e,s=t.getRoutes().sort((f,p)=>f.path.split("/").filter(m=>m).length-p.path.split("/").filter(m=>m).length),i=new Map,a=new Set;s.forEach(f=>{const p=i.get(f.path)||[];p.push(f),i.set(f.path,p)});const l=(f,p)=>`${f}/${p}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",c=(f,p="")=>{if(!f.children||f.children.length===0)return f;for(let m=0;m<f.children.length;m++){const g=f.children[m],y=l(p,g.path),b=(i.get(y)||[]).find(R=>!a.has(R)&&R!==f&&(g.name==null||R.name===g.name));if(b){const R={...b,path:g.path};f.children[m]=R,a.add(b),c(R,y)}}return f};let u=[];for(const f of s)if(!a.has(f)){const p=c(f,f.path);a.add(f),u.push(p)}let d,h;return n?d=ce.createMemoryHistory(r):o?(d=ce.createWebHashHistory(),r&&(u=Ft(u,r),h=gn(r))):d=ce.createWebHistory(r),{history:d,routes:u,patchRouter:h}}function _n(e){const t=new Map,r=Dt();return()=>({__APP_VERSION__:"2.3.3",async render(n){var p,m,g;D.debug("createBridgeComponent render Info",n);const{moduleName:o,dom:s,basename:i,memoryRoute:a,hashRoute:l,...c}=n,u=Gt.createApp(e.rootComponent,c);t.set(s,u);const d=await((g=(m=(p=r==null?void 0:r.bridgeHook)==null?void 0:p.lifecycle)==null?void 0:m.beforeBridgeRender)==null?void 0:g.emit(n)),h=d&&typeof d=="object"&&(d!=null&&d.extraProps)?d==null?void 0:d.extraProps:{},f=e.appOptions({app:u,basename:i,memoryRoute:a,hashRoute:l,...c,...h});if(f!=null&&f.router){const{history:y,routes:_,patchRouter:b}=En({router:f.router,basename:n.basename,memoryRoute:n.memoryRoute,hashRoute:n.hashRoute}),R=ce.createRouter({...f.router.options,history:y,routes:_});b&&b(R),f.afterRouterCreate&&f.afterRouterCreate(R),D.debug("createBridgeComponent render router info>>>",{moduleName:o,router:R}),a&&await R.push(a.entryPath),u.use(R)}u.mount(s)},destroy(n){D.debug("createBridgeComponent destroy Info",n);const o=t.get(n==null?void 0:n.dom);o==null||o.unmount()}})}function bn(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const Rn=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),n=v.ref(""),o=Oe.useRoute(),s=Dt(),i=v.useAttrs(),a=async()=>{var h,f,p,m;const c=(h=e.providerInfo)==null?void 0:h.call(e);r.value=c;let u={...i,moduleName:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute};D.debug("createRemoteAppComponent LazyComponent render >>>",u);const d=await((m=(p=(f=s==null?void 0:s.bridgeHook)==null?void 0:f.lifecycle)==null?void 0:p.beforeBridgeRender)==null?void 0:m.emit(u))||{};u={...u,...d.extraProps},c.render(u)},l=v.watch(()=>o==null?void 0:o.path,c=>{c!==o.path&&a(),n.value!==""&&n.value!==c&&(D.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:o.path}),bn()),n.value=c});return v.onMounted(()=>{a()}),v.onBeforeUnmount(()=>{var c;D.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e}),l(),(c=r.value)==null||c.destroy({dom:t.value})}),()=>v.createVNode("div",v.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function Ht(e){return v.defineAsyncComponent({__APP_VERSION__:"2.3.3",...e.asyncComponentOptions,loader:async()=>{var l,c;const t=Oe.useRoute();let r="/";const n=(c=(l=t==null?void 0:t.matched)==null?void 0:l[0])==null?void 0:c.path;n&&(n.endsWith("/:pathMatch(.*)*")?r=n.replace("/:pathMatch(.*)*",""):r=t.matched[0].path);const o=(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")],a=s[o];if(D.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:i,module:s,exportName:o,basename:r,route:t}),o in s&&typeof a=="function")return{render(){return v.h(Rn,{moduleName:i,providerInfo:a,basename:r,rootAttrs:e.rootAttrs,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute})}};throw new Error("module not found")}})}function Sn(e){return D.warn("createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"),Ht(e)}exports.createBridgeComponent=_n;exports.createRemoteAppComponent=Ht;exports.createRemoteComponent=Sn;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as Ft from "vue";
2
- import { defineComponent as Ht, ref as ge, useAttrs as Gt, watch as xt, onMounted as Ut, onBeforeUnmount as Bt, createVNode as Vt, mergeProps as Wt, defineAsyncComponent as jt, h as qt } from "vue";
2
+ import { defineComponent as Ht, ref as Ee, useAttrs as Gt, watch as xt, onMounted as Ut, onBeforeUnmount as Bt, createVNode as Vt, mergeProps as Wt, defineAsyncComponent as jt, h as qt } from "vue";
3
3
  import * as ae from "vue-router";
4
4
  import { useRoute as Ke } from "vue-router";
5
5
  const Kt = ".json", zt = "FEDERATION_DEBUG", Jt = ":";
6
- let $e = /* @__PURE__ */ function(e) {
6
+ let we = /* @__PURE__ */ function(e) {
7
7
  return e[e.UNKNOWN = 1] = "UNKNOWN", e[e.CALCULATED = 2] = "CALCULATED", e[e.NO_USE = 0] = "NO_USE", e;
8
8
  }({});
9
9
  const F = typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : typeof window < "u" && typeof window.document < "u";
@@ -21,12 +21,12 @@ function Xt() {
21
21
  }
22
22
  return !1;
23
23
  }
24
- function we() {
24
+ function Ne() {
25
25
  return typeof process < "u" && process.env && process.env.FEDERATION_DEBUG ? !!process.env.FEDERATION_DEBUG : typeof FEDERATION_DEBUG < "u" && FEDERATION_DEBUG ? !0 : Xt();
26
26
  }
27
27
  const Yt = "[ Federation Runtime ]", Xe = function(...e) {
28
28
  return e.length ? e.reduce((t, r) => r ? t ? `${t}${Jt}${r}` : r : t, "") : "";
29
- }, Ne = (e, t) => {
29
+ }, Ie = (e, t) => {
30
30
  if ("getPublicPath" in e) {
31
31
  let r;
32
32
  return e.getPublicPath.startsWith("function") ? r = new Function("return " + e.getPublicPath)()() : r = new Function(e.getPublicPath)(), `${r}${t}`;
@@ -58,16 +58,16 @@ function Zt(e) {
58
58
  return e.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
59
59
  }
60
60
  function Qt(e, t = {}) {
61
- var E, b, S;
61
+ var _, b, R;
62
62
  const { remotes: r = {}, overrides: n = {}, version: o } = t;
63
63
  let s;
64
64
  const i = () => "publicPath" in e.metaData ? (e.metaData.publicPath === "auto" || e.metaData.publicPath === "") && o ? Zt(o) : e.metaData.publicPath : e.metaData.getPublicPath, a = Object.keys(n);
65
65
  let l = {};
66
- Object.keys(r).length || (l = ((E = e.remotes) == null ? void 0 : E.reduce((_, w) => {
67
- let R;
66
+ Object.keys(r).length || (l = ((_ = e.remotes) == null ? void 0 : _.reduce((E, w) => {
67
+ let S;
68
68
  const N = w.federationContainerName;
69
- return a.includes(N) ? R = n[N] : "version" in w ? R = w.version : R = w.entry, _[N] = { matchedVersion: R }, _;
70
- }, {})) || {}), Object.keys(r).forEach((_) => l[_] = { matchedVersion: a.includes(_) ? n[_] : r[_] });
69
+ return a.includes(N) ? S = n[N] : "version" in w ? S = w.version : S = w.entry, E[N] = { matchedVersion: S }, E;
70
+ }, {})) || {}), Object.keys(r).forEach((E) => l[E] = { matchedVersion: a.includes(E) ? n[E] : r[E] });
71
71
  const { remoteEntry: { path: c, name: u, type: d }, types: h = {
72
72
  path: "",
73
73
  name: "",
@@ -84,31 +84,31 @@ function Qt(e, t = {}) {
84
84
  remoteTypesZip: h.zip || "",
85
85
  remoteTypesAPI: h.api || "",
86
86
  remotesInfo: l,
87
- shared: e == null ? void 0 : e.shared.map((_) => ({
88
- assets: _.assets,
89
- sharedName: _.name,
90
- version: _.version,
91
- usedExports: _.referenceExports || []
87
+ shared: e == null ? void 0 : e.shared.map((E) => ({
88
+ assets: E.assets,
89
+ sharedName: E.name,
90
+ version: E.version,
91
+ usedExports: E.referenceExports || []
92
92
  })),
93
- modules: g == null ? void 0 : g.map((_) => ({
94
- moduleName: _.name,
95
- modulePath: _.path,
96
- assets: _.assets
93
+ modules: g == null ? void 0 : g.map((E) => ({
94
+ moduleName: E.name,
95
+ modulePath: E.path,
96
+ assets: E.assets
97
97
  }))
98
98
  };
99
99
  if ((b = e.metaData) != null && b.prefetchInterface) {
100
- const _ = e.metaData.prefetchInterface;
100
+ const E = e.metaData.prefetchInterface;
101
101
  y = {
102
102
  ...y,
103
- prefetchInterface: _
103
+ prefetchInterface: E
104
104
  };
105
105
  }
106
- if ((S = e.metaData) != null && S.prefetchEntry) {
107
- const { path: _, name: w, type: R } = e.metaData.prefetchEntry;
106
+ if ((R = e.metaData) != null && R.prefetchEntry) {
107
+ const { path: E, name: w, type: S } = e.metaData.prefetchEntry;
108
108
  y = {
109
109
  ...y,
110
- prefetchEntry: ne(_, w),
111
- prefetchEntryType: R
110
+ prefetchEntry: ne(E, w),
111
+ prefetchEntryType: S
112
112
  };
113
113
  }
114
114
  if ("publicPath" in e.metaData ? (s = {
@@ -118,8 +118,8 @@ function Qt(e, t = {}) {
118
118
  ...y,
119
119
  getPublicPath: i()
120
120
  }, m) {
121
- const _ = ne(m.path, m.name);
122
- s.ssrRemoteEntry = _, s.ssrRemoteEntryType = m.type || "commonjs-module";
121
+ const E = ne(m.path, m.name);
122
+ s.ssrRemoteEntry = E, s.ssrRemoteEntryType = m.type || "commonjs-module";
123
123
  }
124
124
  return s;
125
125
  }
@@ -161,7 +161,7 @@ var et = class {
161
161
  this.delegate = e ?? J;
162
162
  }
163
163
  emit(e, t) {
164
- const r = this.delegate, n = we() ? rr() : void 0, o = n ? [...t, n] : t, s = (() => {
164
+ const r = this.delegate, n = Ne() ? rr() : void 0, o = n ? [...t, n] : t, s = (() => {
165
165
  switch (e) {
166
166
  case "log":
167
167
  return ["log", "info"];
@@ -217,7 +217,7 @@ var et = class {
217
217
  this.emit("info", e);
218
218
  }
219
219
  debug(...e) {
220
- we() && this.emit("debug", e);
220
+ Ne() && this.emit("debug", e);
221
221
  }
222
222
  };
223
223
  function tt(e) {
@@ -240,7 +240,7 @@ async function rt(e, t) {
240
240
  return;
241
241
  }
242
242
  }
243
- function Ie(e, t) {
243
+ function Te(e, t) {
244
244
  const r = /^(https?:)?\/\//i;
245
245
  return e.replace(r, "").replace(/\/$/, "") === t.replace(r, "").replace(/\/$/, "");
246
246
  }
@@ -249,7 +249,7 @@ function nt(e) {
249
249
  const s = document.getElementsByTagName("script");
250
250
  for (let c = 0; c < s.length; c++) {
251
251
  const u = s[c], d = u.getAttribute("src");
252
- if (d && Ie(d, e.url)) {
252
+ if (d && Te(d, e.url)) {
253
253
  t = u, r = !1;
254
254
  break;
255
255
  }
@@ -264,7 +264,7 @@ function nt(e) {
264
264
  }
265
265
  let i = null;
266
266
  const a = typeof window < "u" ? (c) => {
267
- if (c.filename && Ie(c.filename, e.url)) {
267
+ if (c.filename && Te(c.filename, e.url)) {
268
268
  const u = /* @__PURE__ */ new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${c.message} (${c.filename}:${c.lineno}:${c.colno})`);
269
269
  u.name = "ScriptExecutionError", i = u;
270
270
  }
@@ -301,12 +301,12 @@ function nt(e) {
301
301
  needAttach: r
302
302
  };
303
303
  }
304
- function Ee(e) {
304
+ function _e(e) {
305
305
  let t = null, r = !0;
306
306
  const n = document.getElementsByTagName("link");
307
307
  for (let s = 0; s < n.length; s++) {
308
308
  const i = n[s], a = i.getAttribute("href"), l = i.getAttribute("rel");
309
- if (a && Ie(a, e.url) && l === e.attrs.rel) {
309
+ if (a && Te(a, e.url) && l === e.attrs.rel) {
310
310
  t = i, r = !1;
311
311
  break;
312
312
  }
@@ -392,8 +392,8 @@ const ot = async () => {
392
392
  filename: g,
393
393
  importModuleDynamically: ((c = f.constants) == null ? void 0 : c.USE_MAIN_CONTEXT_DEFAULT_LOADER) ?? B
394
394
  });
395
- let E;
396
- E = (await B("node:module")).createRequire(l.protocol === "file:" || l.protocol === "node:" ? l.href : h.join(process.cwd(), "__mf_require_base__.js")), y.runInThisContext()(p.exports, p.module, E, m, g);
395
+ let _;
396
+ _ = (await B("node:module")).createRequire(l.protocol === "file:" || l.protocol === "node:" ? l.href : h.join(process.cwd(), "__mf_require_base__.js")), y.runInThisContext()(p.exports, p.module, _, m, g);
397
397
  const b = p.module.exports || p.exports;
398
398
  if (r && b && r.globalName) {
399
399
  t(void 0, b[r.globalName] || b);
@@ -405,7 +405,7 @@ const ot = async () => {
405
405
  }
406
406
  };
407
407
  s().then(async (a) => {
408
- if ((r == null ? void 0 : r.type) === "esm" || (r == null ? void 0 : r.type) === "module") return Te(o.href, {
408
+ if ((r == null ? void 0 : r.type) === "esm" || (r == null ? void 0 : r.type) === "module") return ve(o.href, {
409
409
  fetch: a,
410
410
  vm: await B("vm")
411
411
  }).then(async (l) => {
@@ -430,16 +430,16 @@ const ot = async () => {
430
430
  }, t.attrs, t.loaderHook);
431
431
  }) : (e, t) => {
432
432
  throw new Error("loadScriptNode is disabled in non-Node.js environment");
433
- }, _e = /* @__PURE__ */ new Map();
434
- async function Te(e, t) {
435
- if (_e.has(e)) return _e.get(e);
433
+ }, be = /* @__PURE__ */ new Map();
434
+ async function ve(e, t) {
435
+ if (be.has(e)) return be.get(e);
436
436
  const { fetch: r, vm: n } = t, o = await (await r(e)).text(), s = new n.SourceTextModule(o, { importModuleDynamically: async (i, a) => {
437
437
  const l = new URL(i, e).href;
438
- return Te(l, t);
438
+ return ve(l, t);
439
439
  } });
440
- return _e.set(e, s), await s.link(async (i) => {
440
+ return be.set(e, s), await s.link(async (i) => {
441
441
  const a = new URL(i, e).href;
442
- return await Te(a, t);
442
+ return await ve(a, t);
443
443
  }), s;
444
444
  }
445
445
  const C = tt("[ Module Federation Bridge Vue3 ]"), cr = (e) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`, st = (e, t, r, n) => {
@@ -451,7 +451,7 @@ const C = tt("[ Module Federation Bridge Vue3 ]"), cr = (e) => `View the docs to
451
451
  function lr(e, t, r, n, o, s) {
452
452
  return n(st(e, t, r, o));
453
453
  }
454
- const H = "[ Federation Runtime ]", ve = tt(H);
454
+ const H = "[ Federation Runtime ]", Ae = tt(H);
455
455
  function P(e, t, r, n, o) {
456
456
  e || $(t);
457
457
  }
@@ -463,7 +463,7 @@ function $(e, t, r, n, o) {
463
463
  throw s instanceof Error ? (s.message.startsWith(H) || (s.message = `${H}: ${s.message}`), s) : new Error(`${H}: ${s}`);
464
464
  }
465
465
  function Oe(e) {
466
- e instanceof Error && (e.message.startsWith(H) || (e.message = `${H}: ${e.message}`)), ve.warn(e);
466
+ e instanceof Error && (e.message.startsWith(H) || (e.message = `${H}: ${e.message}`)), Ae.warn(e);
467
467
  }
468
468
  function ur(e, t) {
469
469
  return e.findIndex((r) => r === t) === -1 && e.push(t), e;
@@ -538,8 +538,8 @@ function lt(e) {
538
538
  }
539
539
  lt(I);
540
540
  lt(k);
541
- function pr(e, t = we()) {
542
- t && (I.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = e, I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.3.2");
541
+ function pr(e, t = Ne()) {
542
+ t && (I.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = e, I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.3.3");
543
543
  }
544
544
  function q(e, t) {
545
545
  if (typeof t == "string") {
@@ -585,7 +585,7 @@ const Ge = () => k.__FEDERATION__.moduleInfo, mr = (e, t) => {
585
585
  remoteEntryKey: r,
586
586
  entryExports: I[r]
587
587
  };
588
- }, gr = () => k.__FEDERATION__.__GLOBAL_PLUGIN__, Er = (e) => I.__FEDERATION__.__PRELOADED_MAP__.get(e), _r = (e) => I.__FEDERATION__.__PRELOADED_MAP__.set(e, !0), Ue = "[0-9A-Za-z-]+", De = `(?:\\+(${Ue}(?:\\.${Ue})*))`, Y = "0|[1-9]\\d*", fe = "[0-9]+", ut = "\\d*[a-zA-Z-][a-zA-Z0-9-]*", Be = `(?:${fe}|${ut})`, br = `(?:-?(${Be}(?:\\.${Be})*))`, Ve = `(?:${Y}|${ut})`, ft = `(?:-(${Ve}(?:\\.${Ve})*))`, be = `${Y}|x|X|\\*`, K = `[v=\\s]*(${be})(?:\\.(${be})(?:\\.(${be})(?:${ft})?${De}?)?)?`, Rr = `^\\s*(${K})\\s+-\\s+(${K})\\s*$`, Sr = `[v=\\s]*${`(${fe})\\.(${fe})\\.(${fe})`}${br}?${De}?`, Fe = "((?:<|>)?=?)", $r = `(\\s*)${Fe}\\s*(${Sr}|${K})`, ht = "(?:~>?)", wr = `(\\s*)${ht}\\s+`, dt = "(?:\\^)", Nr = `(\\s*)${dt}\\s+`, Ir = "(<|>)?=?\\s*\\*", Tr = `^${dt}${K}$`, vr = `v?${`(${Y})\\.(${Y})\\.(${Y})`}${ft}?${De}?`, Ar = `^${ht}${K}$`, Pr = `^${Fe}\\s*${K}$`, kr = `^${Fe}\\s*(${vr})$|^$`, Or = "^\\s*>=\\s*0.0.0\\s*$";
588
+ }, gr = () => k.__FEDERATION__.__GLOBAL_PLUGIN__, Er = (e) => I.__FEDERATION__.__PRELOADED_MAP__.get(e), _r = (e) => I.__FEDERATION__.__PRELOADED_MAP__.set(e, !0), Ue = "[0-9A-Za-z-]+", De = `(?:\\+(${Ue}(?:\\.${Ue})*))`, Y = "0|[1-9]\\d*", fe = "[0-9]+", ut = "\\d*[a-zA-Z-][a-zA-Z0-9-]*", Be = `(?:${fe}|${ut})`, br = `(?:-?(${Be}(?:\\.${Be})*))`, Ve = `(?:${Y}|${ut})`, ft = `(?:-(${Ve}(?:\\.${Ve})*))`, Re = `${Y}|x|X|\\*`, K = `[v=\\s]*(${Re})(?:\\.(${Re})(?:\\.(${Re})(?:${ft})?${De}?)?)?`, Rr = `^\\s*(${K})\\s+-\\s+(${K})\\s*$`, Sr = `[v=\\s]*${`(${fe})\\.(${fe})\\.(${fe})`}${br}?${De}?`, Fe = "((?:<|>)?=?)", $r = `(\\s*)${Fe}\\s*(${Sr}|${K})`, ht = "(?:~>?)", wr = `(\\s*)${ht}\\s+`, dt = "(?:\\^)", Nr = `(\\s*)${dt}\\s+`, Ir = "(<|>)?=?\\s*\\*", Tr = `^${dt}${K}$`, vr = `v?${`(${Y})\\.(${Y})\\.(${Y})`}${ft}?${De}?`, Ar = `^${ht}${K}$`, Pr = `^${Fe}\\s*${K}$`, kr = `^${Fe}\\s*(${vr})$|^$`, Or = "^\\s*>=\\s*0.0.0\\s*$";
589
589
  function M(e) {
590
590
  return new RegExp(e);
591
591
  }
@@ -650,22 +650,22 @@ function Br(e, t) {
650
650
  function se(e, t) {
651
651
  return he(e.major, t.major) || he(e.minor, t.minor) || he(e.patch, t.patch) || Br(e, t);
652
652
  }
653
- function Re(e, t) {
653
+ function Se(e, t) {
654
654
  return e.version === t.version;
655
655
  }
656
656
  function Vr(e, t) {
657
657
  switch (e.operator) {
658
658
  case "":
659
659
  case "=":
660
- return Re(e, t);
660
+ return Se(e, t);
661
661
  case ">":
662
662
  return se(e, t) < 0;
663
663
  case ">=":
664
- return Re(e, t) || se(e, t) < 0;
664
+ return Se(e, t) || se(e, t) < 0;
665
665
  case "<":
666
666
  return se(e, t) > 0;
667
667
  case "<=":
668
- return Re(e, t) || se(e, t) > 0;
668
+ return Se(e, t) || se(e, t) > 0;
669
669
  case void 0:
670
670
  return !0;
671
671
  default:
@@ -707,13 +707,13 @@ function X(e, t) {
707
707
  m = !1;
708
708
  break;
709
709
  }
710
- const [, E, , b, S, _, w] = y;
710
+ const [, _, , b, R, E, w] = y;
711
711
  if (!Vr({
712
- operator: E,
713
- version: je(b, S, _, w),
712
+ operator: _,
713
+ version: je(b, R, E, w),
714
714
  major: b,
715
- minor: S,
716
- patch: _,
715
+ minor: R,
716
+ patch: E,
717
717
  preRelease: w == null ? void 0 : w.split(".")
718
718
  }, l)) {
719
719
  m = !1;
@@ -755,7 +755,7 @@ function qr(e, t, r, n) {
755
755
  treeShaking: e.treeShaking ? {
756
756
  ...e.treeShaking,
757
757
  mode: e.treeShaking.mode ?? "server-calc",
758
- status: e.treeShaking.status ?? $e.UNKNOWN,
758
+ status: e.treeShaking.status ?? we.UNKNOWN,
759
759
  useIn: []
760
760
  } : void 0
761
761
  };
@@ -779,7 +779,7 @@ function yt(e, t) {
779
779
  function ee(e, t) {
780
780
  if (!e) return !1;
781
781
  const { status: r, mode: n } = e;
782
- return r === $e.NO_USE ? !1 : r === $e.CALCULATED ? !0 : n === "runtime-infer" ? t ? zr(e, t) : !0 : !1;
782
+ return r === we.NO_USE ? !1 : r === we.CALCULATED ? !0 : n === "runtime-infer" ? t ? zr(e, t) : !0 : !1;
783
783
  }
784
784
  function G(e, t) {
785
785
  const r = (n) => {
@@ -875,15 +875,15 @@ function de(e, t, r, n) {
875
875
  };
876
876
  const g = ee(a);
877
877
  if (g) {
878
- for (const [y, E] of Object.entries(e[c][t]))
879
- if (ee(E.treeShaking, a == null ? void 0 : a.usedExports) && X(y, u))
878
+ for (const [y, _] of Object.entries(e[c][t]))
879
+ if (ee(_.treeShaking, a == null ? void 0 : a.usedExports) && X(y, u))
880
880
  return {
881
- shared: E,
881
+ shared: _,
882
882
  useTreesShaking: g
883
883
  };
884
884
  }
885
- for (const [y, E] of Object.entries(e[c][t])) if (X(y, u)) return {
886
- shared: E,
885
+ for (const [y, _] of Object.entries(e[c][t])) if (X(y, u)) return {
886
+ shared: _,
887
887
  useTreesShaking: !1
888
888
  };
889
889
  }
@@ -969,13 +969,13 @@ function Qr(e, t) {
969
969
  for (const r of e)
970
970
  if (t === r.name || r.alias && t === r.alias) return r;
971
971
  }
972
- const Et = "RUNTIME-001", _t = "RUNTIME-002", bt = "RUNTIME-003", Rt = "RUNTIME-004", St = "RUNTIME-005", Ae = "RUNTIME-006", $t = "RUNTIME-007", He = "RUNTIME-008", en = "RUNTIME-009", wt = "RUNTIME-010", Nt = "RUNTIME-011", tn = "RUNTIME-012", O = {
972
+ const Et = "RUNTIME-001", _t = "RUNTIME-002", bt = "RUNTIME-003", Rt = "RUNTIME-004", St = "RUNTIME-005", Pe = "RUNTIME-006", $t = "RUNTIME-007", He = "RUNTIME-008", en = "RUNTIME-009", wt = "RUNTIME-010", Nt = "RUNTIME-011", tn = "RUNTIME-012", O = {
973
973
  [Et]: "Failed to get remoteEntry exports.",
974
974
  [_t]: 'The remote entry interface does not contain "init"',
975
975
  [bt]: "Failed to get manifest.",
976
976
  [Rt]: "Failed to locate remote.",
977
977
  [St]: "Invalid loadShareSync function call from bundler runtime",
978
- [Ae]: "Invalid loadShareSync function call from runtime",
978
+ [Pe]: "Invalid loadShareSync function call from runtime",
979
979
  [$t]: "Failed to get remote snapshot.",
980
980
  [He]: "Failed to load script resources.",
981
981
  [en]: "Please call createInstance first.",
@@ -1017,26 +1017,27 @@ function Tt(e, t, r) {
1017
1017
  remoteEntryKey: n
1018
1018
  }), o;
1019
1019
  }
1020
- async function on({ name: e, globalName: t, entry: r, loaderHook: n, getEntryUrl: o }) {
1021
- const { entryExports: s } = Ce(e, t);
1022
- if (s) return s;
1023
- const i = o ? o(r) : r;
1024
- return or(i, {
1020
+ async function on({ name: e, globalName: t, entry: r, remoteInfo: n, loaderHook: o, getEntryUrl: s }) {
1021
+ const { entryExports: i } = Ce(e, t);
1022
+ if (i) return i;
1023
+ const a = s ? s(r) : r;
1024
+ return or(a, {
1025
1025
  attrs: {},
1026
- createScriptHook: (a, l) => {
1027
- const c = n.lifecycle.createScript.emit({
1028
- url: a,
1029
- attrs: l
1026
+ createScriptHook: (l, c) => {
1027
+ const u = o.lifecycle.createScript.emit({
1028
+ url: l,
1029
+ attrs: c,
1030
+ remoteInfo: n
1030
1031
  });
1031
- if (c && (c instanceof HTMLScriptElement || "script" in c || "timeout" in c))
1032
- return c;
1032
+ if (u && (u instanceof HTMLScriptElement || "script" in u || "timeout" in u))
1033
+ return u;
1033
1034
  }
1034
- }).then(() => Tt(e, t, r), (a) => {
1035
- const l = a instanceof Error ? a.message : String(a);
1035
+ }).then(() => Tt(e, t, r), (l) => {
1036
+ const c = l instanceof Error ? l.message : String(l);
1036
1037
  $(He, O, {
1037
1038
  remoteName: e,
1038
- resourceUrl: i
1039
- }, l);
1039
+ resourceUrl: a
1040
+ }, c);
1040
1041
  });
1041
1042
  }
1042
1043
  async function sn({ remoteInfo: e, remoteEntryExports: t, loaderHook: r, getEntryUrl: n }) {
@@ -1058,6 +1059,7 @@ async function sn({ remoteInfo: e, remoteEntryExports: t, loaderHook: r, getEntr
1058
1059
  entry: o,
1059
1060
  globalName: s,
1060
1061
  name: i,
1062
+ remoteInfo: e,
1061
1063
  loaderHook: r,
1062
1064
  getEntryUrl: n
1063
1065
  });
@@ -1074,7 +1076,8 @@ async function an({ remoteInfo: e, loaderHook: t }) {
1074
1076
  loaderHook: { createScriptHook: (a, l = {}) => {
1075
1077
  const c = t.lifecycle.createScript.emit({
1076
1078
  url: a,
1077
- attrs: l
1079
+ attrs: l,
1080
+ remoteInfo: e
1078
1081
  });
1079
1082
  if (c && "url" in c)
1080
1083
  return c;
@@ -1083,12 +1086,12 @@ async function an({ remoteInfo: e, loaderHook: t }) {
1083
1086
  $(`Failed to load Node.js entry for remote "${o}" from "${r}". ${a instanceof Error ? a.message : String(a)}`);
1084
1087
  });
1085
1088
  }
1086
- function Pe(e) {
1089
+ function ke(e) {
1087
1090
  const { entry: t, name: r } = e;
1088
1091
  return Xe(r, t);
1089
1092
  }
1090
1093
  async function me(e) {
1091
- const { origin: t, remoteEntryExports: r, remoteInfo: n, getEntryUrl: o, _inErrorHandling: s = !1 } = e, i = Pe(n);
1094
+ const { origin: t, remoteEntryExports: r, remoteInfo: n, getEntryUrl: o, _inErrorHandling: s = !1 } = e, i = ke(n);
1092
1095
  if (r) return r;
1093
1096
  if (!V[i]) {
1094
1097
  const a = t.remoteHandler.hooks.lifecycle.loadEntry, l = t.loaderHook;
@@ -1105,7 +1108,7 @@ async function me(e) {
1105
1108
  remoteInfo: n,
1106
1109
  loaderHook: l
1107
1110
  }))).catch(async (c) => {
1108
- const u = Pe(n), d = c instanceof Error && c.message.includes("ScriptExecutionError");
1111
+ const u = ke(n), d = c instanceof Error && c.message.includes("ScriptExecutionError");
1109
1112
  if (c instanceof Error && c.message.includes(He) && !d && !s) {
1110
1113
  const h = (p) => me({
1111
1114
  ...p,
@@ -1125,7 +1128,7 @@ async function me(e) {
1125
1128
  }
1126
1129
  return V[i];
1127
1130
  }
1128
- function ke(e) {
1131
+ function ye(e) {
1129
1132
  return {
1130
1133
  ...e,
1131
1134
  entry: "entry" in e ? e.entry : "",
@@ -1234,7 +1237,7 @@ function At(e, t, r, n = !0) {
1234
1237
  as: "style"
1235
1238
  };
1236
1239
  o.forEach((l) => {
1237
- const { link: c, needAttach: u } = Ee({
1240
+ const { link: c, needAttach: u } = _e({
1238
1241
  url: l,
1239
1242
  cb: () => {
1240
1243
  },
@@ -1242,7 +1245,8 @@ function At(e, t, r, n = !0) {
1242
1245
  createLinkHook: (d, h) => {
1243
1246
  const f = t.loaderHook.lifecycle.createLink.emit({
1244
1247
  url: d,
1245
- attrs: h
1248
+ attrs: h,
1249
+ remoteInfo: e
1246
1250
  });
1247
1251
  if (f instanceof HTMLLinkElement) return f;
1248
1252
  }
@@ -1255,7 +1259,7 @@ function At(e, t, r, n = !0) {
1255
1259
  type: "text/css"
1256
1260
  };
1257
1261
  o.forEach((l) => {
1258
- const { link: c, needAttach: u } = Ee({
1262
+ const { link: c, needAttach: u } = _e({
1259
1263
  url: l,
1260
1264
  cb: () => {
1261
1265
  },
@@ -1263,7 +1267,8 @@ function At(e, t, r, n = !0) {
1263
1267
  createLinkHook: (d, h) => {
1264
1268
  const f = t.loaderHook.lifecycle.createLink.emit({
1265
1269
  url: d,
1266
- attrs: h
1270
+ attrs: h,
1271
+ remoteInfo: e
1267
1272
  });
1268
1273
  if (f instanceof HTMLLinkElement) return f;
1269
1274
  },
@@ -1278,7 +1283,7 @@ function At(e, t, r, n = !0) {
1278
1283
  as: "script"
1279
1284
  };
1280
1285
  s.forEach((l) => {
1281
- const { link: c, needAttach: u } = Ee({
1286
+ const { link: c, needAttach: u } = _e({
1282
1287
  url: l,
1283
1288
  cb: () => {
1284
1289
  },
@@ -1286,7 +1291,8 @@ function At(e, t, r, n = !0) {
1286
1291
  createLinkHook: (d, h) => {
1287
1292
  const f = t.loaderHook.lifecycle.createLink.emit({
1288
1293
  url: d,
1289
- attrs: h
1294
+ attrs: h,
1295
+ remoteInfo: e
1290
1296
  });
1291
1297
  if (f instanceof HTMLLinkElement) return f;
1292
1298
  }
@@ -1307,7 +1313,8 @@ function At(e, t, r, n = !0) {
1307
1313
  createScriptHook: (d, h) => {
1308
1314
  const f = t.loaderHook.lifecycle.createScript.emit({
1309
1315
  url: d,
1310
- attrs: h
1316
+ attrs: h,
1317
+ remoteInfo: e
1311
1318
  });
1312
1319
  if (f instanceof HTMLScriptElement) return f;
1313
1320
  },
@@ -1518,7 +1525,7 @@ var W = class extends v {
1518
1525
  function Ot(e, t) {
1519
1526
  const r = ct(t);
1520
1527
  r.url || $(Nt, O, { remoteName: e.name });
1521
- let n = Ne(t, r.url);
1528
+ let n = Ie(t, r.url);
1522
1529
  !F && !n.startsWith("http") && (n = `https:${n}`), e.type = r.type, e.entryGlobalName = r.globalName, e.entry = n, e.version = t.version, e.buildVersion = t.buildVersion;
1523
1530
  }
1524
1531
  function pn() {
@@ -1586,7 +1593,7 @@ function Lt(e, t, r, n, o = {}, s) {
1586
1593
  }
1587
1594
  }
1588
1595
  }
1589
- const Se = (e, t) => document.querySelector(`${e}[${e === "link" ? "href" : "src"}="${t}"]`);
1596
+ const $e = (e, t) => document.querySelector(`${e}[${e === "link" ? "href" : "src"}="${t}"]`);
1590
1597
  function yn(e, t, r, n, o) {
1591
1598
  const s = [], i = [], a = [], l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), { options: u } = e, { preloadConfig: d } = t, { depsRemote: h } = d;
1592
1599
  if (Lt(n, r, (p, m, g) => {
@@ -1594,57 +1601,57 @@ function yn(e, t, r, n, o) {
1594
1601
  let y;
1595
1602
  if (g) y = d;
1596
1603
  else if (Array.isArray(h)) {
1597
- const R = h.find((N) => N.nameOrAlias === m.name || N.nameOrAlias === m.alias);
1598
- if (!R) return;
1599
- y = vt(R);
1604
+ const S = h.find((N) => N.nameOrAlias === m.name || N.nameOrAlias === m.alias);
1605
+ if (!S) return;
1606
+ y = vt(S);
1600
1607
  } else if (h === !0) y = d;
1601
1608
  else return;
1602
- const E = Ne(p, ct(p).url);
1603
- E && a.push({
1609
+ const _ = Ie(p, ct(p).url);
1610
+ _ && a.push({
1604
1611
  name: m.name,
1605
1612
  moduleInfo: {
1606
1613
  name: m.name,
1607
- entry: E,
1614
+ entry: _,
1608
1615
  type: "remoteEntryType" in p ? p.remoteEntryType : "global",
1609
1616
  entryGlobalName: "globalName" in p ? p.globalName : m.name,
1610
1617
  shareScope: "",
1611
1618
  version: "version" in p ? p.version : void 0
1612
1619
  },
1613
- url: E
1620
+ url: _
1614
1621
  });
1615
1622
  let b = "modules" in p ? p.modules : [];
1616
- const S = hn(y.exposes);
1617
- S.length && "modules" in p && (b = (w = p == null ? void 0 : p.modules) == null ? void 0 : w.reduce((R, N) => ((S == null ? void 0 : S.indexOf(N.moduleName)) !== -1 && R.push(N), R), []));
1618
- function _(R) {
1619
- const N = R.map((L) => Ne(p, L));
1623
+ const R = hn(y.exposes);
1624
+ R.length && "modules" in p && (b = (w = p == null ? void 0 : p.modules) == null ? void 0 : w.reduce((S, N) => ((R == null ? void 0 : R.indexOf(N.moduleName)) !== -1 && S.push(N), S), []));
1625
+ function E(S) {
1626
+ const N = S.map((L) => Ie(p, L));
1620
1627
  return y.filter ? N.filter(y.filter) : N;
1621
1628
  }
1622
1629
  if (b) {
1623
- const R = b.length;
1624
- for (let N = 0; N < R; N++) {
1625
- const L = b[N], ye = `${m.name}/${L.moduleName}`;
1630
+ const S = b.length;
1631
+ for (let N = 0; N < S; N++) {
1632
+ const L = b[N], ge = `${m.name}/${L.moduleName}`;
1626
1633
  e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
1627
- id: L.moduleName === "." ? m.name : ye,
1634
+ id: L.moduleName === "." ? m.name : ge,
1628
1635
  name: m.name,
1629
1636
  remoteSnapshot: p,
1630
1637
  preloadConfig: y,
1631
1638
  remote: m,
1632
1639
  origin: e
1633
- }), !Er(ye) && (y.resourceCategory === "all" ? (s.push(..._(L.assets.css.async)), s.push(..._(L.assets.css.sync)), i.push(..._(L.assets.js.async)), i.push(..._(L.assets.js.sync))) : y.resourceCategory === "sync" && (s.push(..._(L.assets.css.sync)), i.push(..._(L.assets.js.sync))), _r(ye));
1640
+ }), !Er(ge) && (y.resourceCategory === "all" ? (s.push(...E(L.assets.css.async)), s.push(...E(L.assets.css.sync)), i.push(...E(L.assets.js.async)), i.push(...E(L.assets.js.sync))) : y.resourceCategory === "sync" && (s.push(...E(L.assets.css.sync)), i.push(...E(L.assets.js.sync))), _r(ge));
1634
1641
  }
1635
1642
  }
1636
1643
  }, !0, {}, o), o.shared && o.shared.length > 0) {
1637
1644
  const p = (m, g) => {
1638
1645
  const { shared: y } = de(e.shareScopeMap, g.sharedName, m, e.sharedHandler.hooks.lifecycle.resolveShare) || {};
1639
- y && typeof y.lib == "function" && (g.assets.js.sync.forEach((E) => {
1640
- l.add(E);
1641
- }), g.assets.css.sync.forEach((E) => {
1642
- c.add(E);
1646
+ y && typeof y.lib == "function" && (g.assets.js.sync.forEach((_) => {
1647
+ l.add(_);
1648
+ }), g.assets.css.sync.forEach((_) => {
1649
+ c.add(_);
1643
1650
  }));
1644
1651
  };
1645
1652
  o.shared.forEach((m) => {
1646
- var E;
1647
- const g = (E = u.shared) == null ? void 0 : E[m.sharedName];
1653
+ var _;
1654
+ const g = (_ = u.shared) == null ? void 0 : _[m.sharedName];
1648
1655
  if (!g) return;
1649
1656
  const y = m.version ? g.find((b) => b.version === m.version) : g;
1650
1657
  y && at(y).forEach((b) => {
@@ -1652,11 +1659,11 @@ function yn(e, t, r, n, o) {
1652
1659
  });
1653
1660
  });
1654
1661
  }
1655
- const f = i.filter((p) => !l.has(p) && !Se("script", p));
1662
+ const f = i.filter((p) => !l.has(p) && !$e("script", p));
1656
1663
  return {
1657
- cssAssets: s.filter((p) => !c.has(p) && !Se("link", p)),
1664
+ cssAssets: s.filter((p) => !c.has(p) && !$e("link", p)),
1658
1665
  jsAssetsWithoutEntry: f,
1659
- entryAssets: a.filter((p) => !Se("script", p.url))
1666
+ entryAssets: a.filter((p) => !$e("script", p.url))
1660
1667
  };
1661
1668
  }
1662
1669
  const gn = function() {
@@ -1790,7 +1797,7 @@ var En = class {
1790
1797
  let s = this.manifestCache.get(e);
1791
1798
  if (s) return s;
1792
1799
  try {
1793
- let i = await this.loaderHook.lifecycle.fetch.emit(e, {});
1800
+ let i = await this.loaderHook.lifecycle.fetch.emit(e, {}, ye(t));
1794
1801
  (!i || !(i instanceof Response)) && (i = await fetch(e, {})), s = await i.json();
1795
1802
  } catch (i) {
1796
1803
  s = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
@@ -1943,8 +1950,8 @@ var En = class {
1943
1950
  var b;
1944
1951
  const { version: p, eager: m } = f;
1945
1952
  c[h] = c[h] || {};
1946
- const g = c[h], y = g[p] && ie(g[p]), E = !!(y && ("eager" in y && y.eager || "shareConfig" in y && ((b = y.shareConfig) != null && b.eager)));
1947
- (!y || y.strategy !== "loaded-first" && !y.loaded && (!m != !E ? m : l > g[p].from)) && (g[p] = f);
1953
+ const g = c[h], y = g[p] && ie(g[p]), _ = !!(y && ("eager" in y && y.eager || "shareConfig" in y && ((b = y.shareConfig) != null && b.eager)));
1954
+ (!y || y.strategy !== "loaded-first" && !y.loaded && (!m != !_ ? m : l > g[p].from)) && (g[p] = f);
1948
1955
  }, d = async (h) => {
1949
1956
  const { module: f } = await r.remoteHandler.getRemoteModuleAndOptions({ id: h });
1950
1957
  let p;
@@ -1999,7 +2006,7 @@ var En = class {
1999
2006
  return n.loaded || (n.loaded = !0), n.lib;
2000
2007
  if (n.get) {
2001
2008
  const i = n.get();
2002
- return i instanceof Promise && $((t == null ? void 0 : t.from) === "build" ? St : Ae, O, {
2009
+ return i instanceof Promise && $((t == null ? void 0 : t.from) === "build" ? St : Pe, O, {
2003
2010
  hostName: r.options.name,
2004
2011
  sharedPkgName: e
2005
2012
  }, void 0, z(r.options)), n.lib = i, this.setShared({
@@ -2010,7 +2017,7 @@ var En = class {
2010
2017
  shared: n
2011
2018
  }), n.lib;
2012
2019
  }
2013
- $(Ae, O, {
2020
+ $(Pe, O, {
2014
2021
  hostName: r.options.name,
2015
2022
  sharedPkgName: e
2016
2023
  }, void 0, z(r.options));
@@ -2027,8 +2034,8 @@ var En = class {
2027
2034
  }
2028
2035
  setShared({ pkgName: e, shared: t, from: r, lib: n, loading: o, loaded: s, get: i, treeShaking: a }) {
2029
2036
  const { version: l, scope: c = "default", ...u } = t, d = Array.isArray(c) ? c : [c], h = (f) => {
2030
- const p = (g, y, E) => {
2031
- E && !g[y] && (g[y] = E);
2037
+ const p = (g, y, _) => {
2038
+ _ && !g[y] && (g[y] = _);
2032
2039
  }, m = a ? f.treeShaking : f;
2033
2040
  p(m, "loaded", s), p(m, "loading", o), p(m, "get", i);
2034
2041
  };
@@ -2122,7 +2129,7 @@ var En = class {
2122
2129
  });
2123
2130
  const r = fn(t.options.remotes, e);
2124
2131
  await Promise.all(r.map(async (n) => {
2125
- const { remote: o } = n, s = ke(o), { globalSnapshot: i, remoteSnapshot: a } = await t.snapshotHandler.loadRemoteSnapshotInfo({ moduleInfo: o }), l = await this.hooks.lifecycle.generatePreloadAssets.emit({
2132
+ const { remote: o } = n, s = ye(o), { globalSnapshot: i, remoteSnapshot: a } = await t.snapshotHandler.loadRemoteSnapshotInfo({ moduleInfo: o }), l = await this.hooks.lifecycle.generatePreloadAssets.emit({
2126
2133
  origin: t,
2127
2134
  preloadOptions: n,
2128
2135
  remote: o,
@@ -2163,7 +2170,7 @@ var En = class {
2163
2170
  hostName: t.options.name,
2164
2171
  requestId: o
2165
2172
  }, void 0, z(t.options));
2166
- const { remote: i } = s, a = ke(i), l = await t.sharedHandler.hooks.lifecycle.afterResolve.emit({
2173
+ const { remote: i } = s, a = ye(i), l = await t.sharedHandler.hooks.lifecycle.afterResolve.emit({
2167
2174
  id: o,
2168
2175
  ...s,
2169
2176
  options: t.options,
@@ -2220,7 +2227,7 @@ var En = class {
2220
2227
  if (s) {
2221
2228
  const i = s.remoteInfo, a = i.entryGlobalName;
2222
2229
  I[a] && ((t = Object.getOwnPropertyDescriptor(I, a)) != null && t.configurable ? delete I[a] : I[a] = void 0);
2223
- const l = Pe(s.remoteInfo);
2230
+ const l = ke(s.remoteInfo);
2224
2231
  V[l] && delete V[l], r.snapshotHandler.manifestCache.delete(i.entry);
2225
2232
  let c = i.buildVersion ? Xe(i.name, i.buildVersion) : i.name;
2226
2233
  const u = I.__FEDERATION__.__INSTANCES__.findIndex((h) => i.buildVersion ? h.options.id === c : h.name === c);
@@ -2232,29 +2239,29 @@ var En = class {
2232
2239
  const m = [];
2233
2240
  Object.keys(f).forEach((g) => {
2234
2241
  const y = f[g];
2235
- y && Object.keys(y).forEach((E) => {
2236
- const b = y[E];
2237
- b && Object.keys(b).forEach((S) => {
2238
- const _ = b[S];
2239
- _ && Object.keys(_).forEach((w) => {
2240
- const R = _[w];
2241
- R && typeof R == "object" && R.from === i.name && (R.loaded || R.loading ? (R.useIn = R.useIn.filter((N) => N !== i.name), R.useIn.length ? p = !1 : m.push([
2242
+ y && Object.keys(y).forEach((_) => {
2243
+ const b = y[_];
2244
+ b && Object.keys(b).forEach((R) => {
2245
+ const E = b[R];
2246
+ E && Object.keys(E).forEach((w) => {
2247
+ const S = E[w];
2248
+ S && typeof S == "object" && S.from === i.name && (S.loaded || S.loading ? (S.useIn = S.useIn.filter((N) => N !== i.name), S.useIn.length ? p = !1 : m.push([
2242
2249
  g,
2243
- E,
2244
- S,
2250
+ _,
2251
+ R,
2245
2252
  w
2246
2253
  ])) : m.push([
2247
2254
  g,
2248
- E,
2249
- S,
2255
+ _,
2256
+ R,
2250
2257
  w
2251
2258
  ]));
2252
2259
  });
2253
2260
  });
2254
2261
  });
2255
- }), p && (h.shareScopeMap = {}, delete f[c]), m.forEach(([g, y, E, b]) => {
2256
- var S, _, w;
2257
- (w = (_ = (S = f[g]) == null ? void 0 : S[y]) == null ? void 0 : _[E]) == null || delete w[b];
2262
+ }), p && (h.shareScopeMap = {}, delete f[c]), m.forEach(([g, y, _, b]) => {
2263
+ var R, E, w;
2264
+ (w = (E = (R = f[g]) == null ? void 0 : R[y]) == null ? void 0 : E[_]) == null || delete w[b];
2258
2265
  }), I.__FEDERATION__.__INSTANCES__.splice(u, 1);
2259
2266
  }
2260
2267
  const { hostGlobalSnapshot: d } = Mt(e, r);
@@ -2265,7 +2272,7 @@ var En = class {
2265
2272
  r.moduleCache.delete(e.name);
2266
2273
  }
2267
2274
  } catch (r) {
2268
- ve.error(`removeRemote failed: ${r instanceof Error ? r.message : String(r)}`);
2275
+ Ae.error(`removeRemote failed: ${r instanceof Error ? r.message : String(r)}`);
2269
2276
  }
2270
2277
  }
2271
2278
  };
@@ -2277,7 +2284,7 @@ var Sn = class {
2277
2284
  init: new v(),
2278
2285
  beforeInitContainer: new D("beforeInitContainer"),
2279
2286
  initContainer: new D("initContainer")
2280
- }), this.version = "2.3.2", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new j({
2287
+ }), this.version = "2.3.3", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new j({
2281
2288
  getModuleInfo: new v(),
2282
2289
  createScript: new v(),
2283
2290
  createLink: new v(),
@@ -2315,7 +2322,7 @@ var Sn = class {
2315
2322
  return this.sharedHandler.initializeSharing(e, t);
2316
2323
  }
2317
2324
  initRawContainer(e, t, r) {
2318
- const n = ke({
2325
+ const n = ye({
2319
2326
  name: e,
2320
2327
  entry: t
2321
2328
  }), o = new Pt({
@@ -2376,6 +2383,7 @@ function Ct() {
2376
2383
  pr(Sn);
2377
2384
  function Dt(e, t) {
2378
2385
  const r = (n) => {
2386
+ if (!n.startsWith("/")) return n;
2379
2387
  const o = n.length > 1 && n.endsWith("/"), s = `${t}/${n}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
2380
2388
  return o ? `${s}/` : s;
2381
2389
  };
@@ -2405,20 +2413,23 @@ function Nn(e) {
2405
2413
  (f, p) => f.path.split("/").filter((m) => m).length - p.path.split("/").filter((m) => m).length
2406
2414
  ), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
2407
2415
  s.forEach((f) => {
2408
- i.set(f.path, f);
2416
+ const p = i.get(f.path) || [];
2417
+ p.push(f), i.set(f.path, p);
2409
2418
  });
2410
2419
  const l = (f, p) => `${f}/${p}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/", c = (f, p = "") => {
2411
2420
  if (!f.children || f.children.length === 0)
2412
2421
  return f;
2413
2422
  for (let m = 0; m < f.children.length; m++) {
2414
- const g = f.children[m], y = l(p, g.path), E = i.get(y);
2415
- if (E && !a.has(E)) {
2416
- const b = {
2417
- ...E,
2423
+ const g = f.children[m], y = l(p, g.path), b = (i.get(y) || []).find(
2424
+ (R) => !a.has(R) && R !== f && (g.name == null || R.name === g.name)
2425
+ );
2426
+ if (b) {
2427
+ const R = {
2428
+ ...b,
2418
2429
  path: g.path
2419
2430
  // Keep the original relative path from static route
2420
2431
  };
2421
- f.children[m] = b, a.add(E), c(b, y);
2432
+ f.children[m] = R, a.add(b), c(R, y);
2422
2433
  }
2423
2434
  }
2424
2435
  return f;
@@ -2435,7 +2446,7 @@ function Nn(e) {
2435
2446
  function kn(e) {
2436
2447
  const t = /* @__PURE__ */ new Map(), r = Ct();
2437
2448
  return () => ({
2438
- __APP_VERSION__: "2.3.2",
2449
+ __APP_VERSION__: "2.3.3",
2439
2450
  async render(n) {
2440
2451
  var p, m, g;
2441
2452
  C.debug("createBridgeComponent render Info", n);
@@ -2457,20 +2468,20 @@ function kn(e) {
2457
2468
  ...h
2458
2469
  });
2459
2470
  if (f != null && f.router) {
2460
- const { history: y, routes: E, patchRouter: b } = Nn({
2471
+ const { history: y, routes: _, patchRouter: b } = Nn({
2461
2472
  router: f.router,
2462
2473
  basename: n.basename,
2463
2474
  memoryRoute: n.memoryRoute,
2464
2475
  hashRoute: n.hashRoute
2465
- }), S = ae.createRouter({
2476
+ }), R = ae.createRouter({
2466
2477
  ...f.router.options,
2467
2478
  history: y,
2468
- routes: E
2479
+ routes: _
2469
2480
  });
2470
- b && b(S), f.afterRouterCreate && f.afterRouterCreate(S), C.debug("createBridgeComponent render router info>>>", {
2481
+ b && b(R), f.afterRouterCreate && f.afterRouterCreate(R), C.debug("createBridgeComponent render router info>>>", {
2471
2482
  moduleName: o,
2472
- router: S
2473
- }), a && await S.push(a.entryPath), u.use(S);
2483
+ router: R
2484
+ }), a && await R.push(a.entryPath), u.use(R);
2474
2485
  }
2475
2486
  u.mount(s);
2476
2487
  },
@@ -2497,7 +2508,7 @@ const Tn = /* @__PURE__ */ Ht({
2497
2508
  },
2498
2509
  inheritAttrs: !1,
2499
2510
  setup(e) {
2500
- const t = ge(null), r = ge(null), n = ge(""), o = Ke(), s = Ct(), i = Gt(), a = async () => {
2511
+ const t = Ee(null), r = Ee(null), n = Ee(""), o = Ke(), s = Ct(), i = Gt(), a = async () => {
2501
2512
  var h, f, p, m;
2502
2513
  const c = (h = e.providerInfo) == null ? void 0 : h.call(e);
2503
2514
  r.value = c;
@@ -2537,7 +2548,7 @@ const Tn = /* @__PURE__ */ Ht({
2537
2548
  });
2538
2549
  function vn(e) {
2539
2550
  return jt({
2540
- __APP_VERSION__: "2.3.2",
2551
+ __APP_VERSION__: "2.3.3",
2541
2552
  ...e.asyncComponentOptions,
2542
2553
  //@ts-ignore
2543
2554
  loader: async () => {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/module-federation/core.git",
8
8
  "directory": "packages/bridge/vue3-bridge"
9
9
  },
10
- "version": "2.3.2",
10
+ "version": "2.3.3",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -31,9 +31,9 @@
31
31
  "vue-router": "=4"
32
32
  },
33
33
  "dependencies": {
34
- "@module-federation/bridge-shared": "2.3.2",
35
- "@module-federation/sdk": "2.3.2",
36
- "@module-federation/runtime": "2.3.2"
34
+ "@module-federation/bridge-shared": "2.3.3",
35
+ "@module-federation/runtime": "2.3.3",
36
+ "@module-federation/sdk": "2.3.3"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/react": "^18.3.11",
package/src/routeUtils.ts CHANGED
@@ -28,8 +28,13 @@ function addBasenameToNestedRoutes(
28
28
  * Join two path segments, collapse multiple slashes, and optionally
29
29
  * preserve a trailing slash that was present in the original value.
30
30
  * A bare '/' root is never considered an intentional trailing slash.
31
+ *
32
+ * Relative paths (not starting with '/') are left untouched — Vue Router
33
+ * resolves them against the parent route, which already carries the basename.
31
34
  */
32
35
  const prefixPath = (original: string): string => {
36
+ if (!original.startsWith('/')) return original;
37
+
33
38
  const hasTrailingSlash = original.length > 1 && original.endsWith('/');
34
39
  const normalized =
35
40
  `${basename}/${original}`.replace(/\/+/g, '/').replace(/\/$/, '') || '/';
@@ -143,11 +148,15 @@ export function processRoutes(
143
148
  );
144
149
 
145
150
  // Use Map/Set for O(1) lookup performance
146
- const flatRoutesMap = new Map<string, VueRouter.RouteRecordNormalized>();
151
+ // Store arrays because multiple routes can resolve to the same path
152
+ // (e.g. a parent and a default child with path: '')
153
+ const flatRoutesMap = new Map<string, VueRouter.RouteRecordNormalized[]>();
147
154
  const processedRoutes = new Set<VueRouter.RouteRecordNormalized>();
148
155
 
149
156
  flatRoutes.forEach((route) => {
150
- flatRoutesMap.set(route.path, route);
157
+ const existing = flatRoutesMap.get(route.path) || [];
158
+ existing.push(route);
159
+ flatRoutesMap.set(route.path, existing);
151
160
  });
152
161
 
153
162
  /**
@@ -169,9 +178,20 @@ export function processRoutes(
169
178
  for (let j = 0; j < route.children.length; j++) {
170
179
  const child = route.children[j];
171
180
  const fullPath = normalizePath(prefix, child.path);
172
- const childRoute = flatRoutesMap.get(fullPath);
181
+ const candidates = flatRoutesMap.get(fullPath) || [];
182
+ // Find a matching route that:
183
+ // 1. Hasn't been processed yet
184
+ // 2. Isn't the current parent route (avoids circular references when
185
+ // a child with path: '' resolves to the same absolute path)
186
+ // 3. Matches by name when the child definition specifies one
187
+ const childRoute = candidates.find(
188
+ (r) =>
189
+ !processedRoutes.has(r) &&
190
+ r !== route &&
191
+ (child.name == null || r.name === child.name),
192
+ );
173
193
 
174
- if (childRoute && !processedRoutes.has(childRoute)) {
194
+ if (childRoute) {
175
195
  // Create a new optimized route object with relative path for nested routes
176
196
  const relativeChildRoute: VueRouter.RouteRecordNormalized = {
177
197
  ...childRoute,