@module-federation/bridge-vue3 0.0.0-refactor-manifest-20251015072237 → 0.0.0-refactor-manifest-20251015104241

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,13 +1,13 @@
1
1
  # @module-federation/bridge-vue3
2
2
 
3
- ## 0.0.0-refactor-manifest-20251015072237
3
+ ## 0.0.0-refactor-manifest-20251015104241
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Updated dependencies [ef4ada0]
8
- - @module-federation/sdk@0.0.0-refactor-manifest-20251015072237
9
- - @module-federation/runtime@0.0.0-refactor-manifest-20251015072237
10
- - @module-federation/bridge-shared@0.0.0-refactor-manifest-20251015072237
8
+ - @module-federation/sdk@0.0.0-refactor-manifest-20251015104241
9
+ - @module-federation/runtime@0.0.0-refactor-manifest-20251015104241
10
+ - @module-federation/bridge-shared@0.0.0-refactor-manifest-20251015104241
11
11
 
12
12
  ## 0.20.0
13
13
 
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>r[o]})}}return t.default=r,Object.freeze(t)}const Vue__namespace=_interopNamespaceDefault(Vue),VueRouter__namespace=_interopNamespaceDefault(VueRouter),MANIFEST_EXT=".json",BROWSER_LOG_KEY="FEDERATION_DEBUG",SEPARATOR=":";function isBrowserEnv(){return typeof window<"u"&&typeof window.document<"u"}function isReactNativeEnv(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function isBrowserDebug(){try{if(isBrowserEnv()&&window.localStorage)return!!localStorage.getItem(BROWSER_LOG_KEY)}catch{return!1}return!1}function isDebugMode(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:isBrowserDebug()}const LOG_CATEGORY$1="[ Federation Runtime ]",composeKeyWithSeparator=function(...r){return r.length?r.reduce((t,o)=>o?t?`${t}${SEPARATOR}${o}`:o:t,""):""},getResourceUrl=(r,t)=>{if("getPublicPath"in r){let o;return r.getPublicPath.startsWith("function")?o=new Function("return "+r.getPublicPath)()():o=new Function(r.getPublicPath)(),`${o}${t}`}else return"publicPath"in r?!isBrowserEnv()&&!isReactNativeEnv()&&"ssrPublicPath"in r?`${r.ssrPublicPath}${t}`:`${r.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",r,t),"")},warn$1=r=>{console.warn(`${LOG_CATEGORY$1}: ${r}`)};function safeToString(r){try{return JSON.stringify(r,null,2)}catch{return""}}const simpleJoinRemoteEntry=(r,t)=>{if(!r)return t;const n=(s=>{if(s===".")return"";if(s.startsWith("./"))return s.replace("./","");if(s.startsWith("/")){const i=s.slice(1);return i.endsWith("/")?i.slice(0,-1):i}return s})(r);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function inferAutoPublicPath(r){return r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function generateSnapshotFromManifest(r,t={}){var S,R,A;const{remotes:o={},overrides:n={},version:s}=t;let i;const a=()=>"publicPath"in r.metaData?r.metaData.publicPath==="auto"&&s?inferAutoPublicPath(s):r.metaData.publicPath:r.metaData.getPublicPath,c=Object.keys(n);let l={};Object.keys(o).length||(l=((S=r.remotes)==null?void 0:S.reduce((_,I)=>{let T;const w=I.federationContainerName;return c.includes(w)?T=n[w]:"version"in I?T=I.version:T=I.entry,_[w]={matchedVersion:T},_},{}))||{}),Object.keys(o).forEach(_=>l[_]={matchedVersion:c.includes(_)?n[_]:o[_]});const{remoteEntry:{path:u,name:d,type:h},types:p,buildInfo:{buildVersion:m},globalName:E,ssrRemoteEntry:b}=r.metaData,{exposes:y}=r;let g={version:s||"",buildVersion:m,globalName:E,remoteEntry:simpleJoinRemoteEntry(u,d),remoteEntryType:h,remoteTypes:simpleJoinRemoteEntry(p.path,p.name),remoteTypesZip:p.zip||"",remoteTypesAPI:p.api||"",remotesInfo:l,shared:r==null?void 0:r.shared.map(_=>({assets:_.assets,sharedName:_.name,version:_.version})),modules:y==null?void 0:y.map(_=>({moduleName:_.name,modulePath:_.path,assets:_.assets}))};if((R=r.metaData)!=null&&R.prefetchInterface){const _=r.metaData.prefetchInterface;g={...g,prefetchInterface:_}}if((A=r.metaData)!=null&&A.prefetchEntry){const{path:_,name:I,type:T}=r.metaData.prefetchEntry;g={...g,prefetchEntry:simpleJoinRemoteEntry(_,I),prefetchEntryType:T}}if("publicPath"in r.metaData?i={...g,publicPath:a(),ssrPublicPath:r.metaData.ssrPublicPath}:i={...g,getPublicPath:a()},b){const _=simpleJoinRemoteEntry(b.path,b.name);i.ssrRemoteEntry=_,i.ssrRemoteEntryType=b.type||"commonjs-module"}return i}function isManifestProvider(r){return!!("remoteEntry"in r&&r.remoteEntry.includes(MANIFEST_EXT))}const PREFIX="[ Module Federation ]",DEFAULT_DELEGATE=console;class Logger{constructor(t,o=DEFAULT_DELEGATE){this.prefix=t,this.delegate=o??DEFAULT_DELEGATE}setPrefix(t){this.prefix=t}setDelegate(t){this.delegate=t??DEFAULT_DELEGATE}emit(t,o){const n=this.delegate,s=(()=>{switch(t){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];case"debug":default:return["debug","log"]}})();for(const i of s){const a=n[i];if(typeof a=="function"){a.call(n,this.prefix,...o);return}}for(const i of s){const a=DEFAULT_DELEGATE[i];if(typeof a=="function"){a.call(DEFAULT_DELEGATE,this.prefix,...o);return}}}log(...t){this.emit("log",t)}warn(...t){this.emit("warn",t)}error(...t){this.emit("error",t)}success(...t){this.emit("info",t)}info(...t){this.emit("info",t)}ready(...t){this.emit("info",t)}debug(...t){isDebugMode()&&this.emit("debug",t)}}function createLogger(r){return new Logger(r)}function createInfrastructureLogger(r){const t=new Logger(r);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}createInfrastructureLogger(PREFIX);async function safeWrapper(r,t){try{return await r()}catch(o){warn$1(o);return}}function isStaticResourcesEqual(r,t){const o=/^(https?:)?\/\//i,n=r.replace(o,"").replace(/\/$/,""),s=t.replace(o,"").replace(/\/$/,"");return n===s}function createScript(r){let t=null,o=!0,n=2e4,s;const i=document.getElementsByTagName("script");for(let c=0;c<i.length;c++){const l=i[c],u=l.getAttribute("src");if(u&&isStaticResourcesEqual(u,r.url)){t=l,o=!1;break}}if(!t){const c=r.attrs;t=document.createElement("script"),t.type=(c==null?void 0:c.type)==="module"?"module":"text/javascript";let l;r.createScriptHook&&(l=r.createScriptHook(r.url,r.attrs),l instanceof HTMLScriptElement?t=l:typeof l=="object"&&("script"in l&&l.script&&(t=l.script),"timeout"in l&&l.timeout&&(n=l.timeout))),t.src||(t.src=r.url),c&&!l&&Object.keys(c).forEach(u=>{t&&(u==="async"||u==="defer"?t[u]=c[u]:t.getAttribute(u)||t.setAttribute(u,c[u]))})}const a=async(c,l)=>{clearTimeout(s);const u=()=>{(l==null?void 0:l.type)==="error"?r!=null&&r.onErrorCallback&&(r==null||r.onErrorCallback(l)):r!=null&&r.cb&&(r==null||r.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteScript:d=!0}=r;d&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),c&&typeof c=="function")){const d=c(l);if(d instanceof Promise){const h=await d;return u(),h}return u(),d}u()};return t.onerror=a.bind(null,t.onerror),t.onload=a.bind(null,t.onload),s=setTimeout(()=>{a(null,new Error(`Remote script "${r.url}" time-outed.`))},n),{script:t,needAttach:o}}function createLink(r){let t=null,o=!0;const n=document.getElementsByTagName("link");for(let i=0;i<n.length;i++){const a=n[i],c=a.getAttribute("href"),l=a.getAttribute("rel");if(c&&isStaticResourcesEqual(c,r.url)&&l===r.attrs.rel){t=a,o=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",r.url);let i;const a=r.attrs;r.createLinkHook&&(i=r.createLinkHook(r.url,a),i instanceof HTMLLinkElement&&(t=i)),a&&!i&&Object.keys(a).forEach(c=>{t&&!t.getAttribute(c)&&t.setAttribute(c,a[c])})}const s=(i,a)=>{const c=()=>{(a==null?void 0:a.type)==="error"?r!=null&&r.onErrorCallback&&(r==null||r.onErrorCallback(a)):r!=null&&r.cb&&(r==null||r.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteLink:l=!0}=r;l&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),i)){const l=i(a);return c(),l}c()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:o}}function loadScript(r,t){const{attrs:o={},createScriptHook:n}=t;return new Promise((s,i)=>{const{script:a,needAttach:c}=createScript({url:r,cb:s,onErrorCallback:i,attrs:{fetchpriority:"high",...o},createScriptHook:n,needDeleteScript:!0});c&&document.head.appendChild(a)})}const sdkImportCache=new Map;function importNodeModule(r){if(!r)throw new Error("import specifier is required");if(sdkImportCache.has(r))return sdkImportCache.get(r);const o=new Function("name","return import(name)")(r).then(n=>n).catch(n=>{throw console.error(`Error importing module ${r}:`,n),sdkImportCache.delete(r),n});return sdkImportCache.set(r,o),o}const loadNodeFetch=async()=>{const r=await importNodeModule("node-fetch");return r.default||r},lazyLoaderHookFetch=async(r,t,o)=>{const s=await((i,a)=>o.lifecycle.fetch.emit(i,a))(r,t||{});return!s||!(s instanceof Response)?(typeof fetch>"u"?await loadNodeFetch():fetch)(r,t||{}):s},createScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(url,cb,attrs,loaderHook)=>{if(loaderHook!=null&&loaderHook.createScriptHook){const r=loaderHook.createScriptHook(url);r&&typeof r=="object"&&"url"in r&&(url=r.url)}let urlObj;try{urlObj=new URL(url)}catch(r){console.error("Error constructing URL:",r),cb(new Error(`Invalid URL: ${r}`));return}const getFetch=async()=>loaderHook!=null&&loaderHook.fetch?(r,t)=>lazyLoaderHookFetch(r,t,loaderHook):typeof fetch>"u"?loadNodeFetch():fetch,handleScriptFetch=async(f,urlObj)=>{var r;try{const res=await f(urlObj.href),data=await res.text(),[path,vm]=await Promise.all([importNodeModule("path"),importNodeModule("vm")]),scriptContext={exports:{},module:{exports:{}}},urlDirname=urlObj.pathname.split("/").slice(0,-1).join("/"),filename=path.basename(urlObj.pathname),script=new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>r[o]})}}return t.default=r,Object.freeze(t)}const Vue__namespace=_interopNamespaceDefault(Vue),VueRouter__namespace=_interopNamespaceDefault(VueRouter),MANIFEST_EXT=".json",BROWSER_LOG_KEY="FEDERATION_DEBUG",SEPARATOR=":";function isBrowserEnv(){return typeof window<"u"&&typeof window.document<"u"}function isReactNativeEnv(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function isBrowserDebug(){try{if(isBrowserEnv()&&window.localStorage)return!!localStorage.getItem(BROWSER_LOG_KEY)}catch{return!1}return!1}function isDebugMode(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:isBrowserDebug()}const LOG_CATEGORY$1="[ Federation Runtime ]",composeKeyWithSeparator=function(...r){return r.length?r.reduce((t,o)=>o?t?`${t}${SEPARATOR}${o}`:o:t,""):""},getResourceUrl=(r,t)=>{if("getPublicPath"in r){let o;return r.getPublicPath.startsWith("function")?o=new Function("return "+r.getPublicPath)()():o=new Function(r.getPublicPath)(),`${o}${t}`}else return"publicPath"in r?!isBrowserEnv()&&!isReactNativeEnv()&&"ssrPublicPath"in r?`${r.ssrPublicPath}${t}`:`${r.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",r,t),"")},warn$1=r=>{console.warn(`${LOG_CATEGORY$1}: ${r}`)};function safeToString(r){try{return JSON.stringify(r,null,2)}catch{return""}}const simpleJoinRemoteEntry=(r,t)=>{if(!r)return t;const n=(s=>{if(s===".")return"";if(s.startsWith("./"))return s.replace("./","");if(s.startsWith("/")){const i=s.slice(1);return i.endsWith("/")?i.slice(0,-1):i}return s})(r);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function inferAutoPublicPath(r){return r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function generateSnapshotFromManifest(r,t={}){var S,R,A;const{remotes:o={},overrides:n={},version:s}=t;let i;const a=()=>"publicPath"in r.metaData?r.metaData.publicPath==="auto"&&s?inferAutoPublicPath(s):r.metaData.publicPath:r.metaData.getPublicPath,c=Object.keys(n);let l={};Object.keys(o).length||(l=((S=r.remotes)==null?void 0:S.reduce((_,I)=>{let T;const w=I.federationContainerName;return c.includes(w)?T=n[w]:"version"in I?T=I.version:T=I.entry,_[w]={matchedVersion:T},_},{}))||{}),Object.keys(o).forEach(_=>l[_]={matchedVersion:c.includes(_)?n[_]:o[_]});const{remoteEntry:{path:u,name:d,type:h},types:p={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:m},globalName:E,ssrRemoteEntry:b}=r.metaData,{exposes:y}=r;let g={version:s||"",buildVersion:m,globalName:E,remoteEntry:simpleJoinRemoteEntry(u,d),remoteEntryType:h,remoteTypes:simpleJoinRemoteEntry(p.path,p.name),remoteTypesZip:p.zip||"",remoteTypesAPI:p.api||"",remotesInfo:l,shared:r==null?void 0:r.shared.map(_=>({assets:_.assets,sharedName:_.name,version:_.version})),modules:y==null?void 0:y.map(_=>({moduleName:_.name,modulePath:_.path,assets:_.assets}))};if((R=r.metaData)!=null&&R.prefetchInterface){const _=r.metaData.prefetchInterface;g={...g,prefetchInterface:_}}if((A=r.metaData)!=null&&A.prefetchEntry){const{path:_,name:I,type:T}=r.metaData.prefetchEntry;g={...g,prefetchEntry:simpleJoinRemoteEntry(_,I),prefetchEntryType:T}}if("publicPath"in r.metaData?i={...g,publicPath:a(),ssrPublicPath:r.metaData.ssrPublicPath}:i={...g,getPublicPath:a()},b){const _=simpleJoinRemoteEntry(b.path,b.name);i.ssrRemoteEntry=_,i.ssrRemoteEntryType=b.type||"commonjs-module"}return i}function isManifestProvider(r){return!!("remoteEntry"in r&&r.remoteEntry.includes(MANIFEST_EXT))}const PREFIX="[ Module Federation ]",DEFAULT_DELEGATE=console;class Logger{constructor(t,o=DEFAULT_DELEGATE){this.prefix=t,this.delegate=o??DEFAULT_DELEGATE}setPrefix(t){this.prefix=t}setDelegate(t){this.delegate=t??DEFAULT_DELEGATE}emit(t,o){const n=this.delegate,s=(()=>{switch(t){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];case"debug":default:return["debug","log"]}})();for(const i of s){const a=n[i];if(typeof a=="function"){a.call(n,this.prefix,...o);return}}for(const i of s){const a=DEFAULT_DELEGATE[i];if(typeof a=="function"){a.call(DEFAULT_DELEGATE,this.prefix,...o);return}}}log(...t){this.emit("log",t)}warn(...t){this.emit("warn",t)}error(...t){this.emit("error",t)}success(...t){this.emit("info",t)}info(...t){this.emit("info",t)}ready(...t){this.emit("info",t)}debug(...t){isDebugMode()&&this.emit("debug",t)}}function createLogger(r){return new Logger(r)}function createInfrastructureLogger(r){const t=new Logger(r);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}createInfrastructureLogger(PREFIX);async function safeWrapper(r,t){try{return await r()}catch(o){warn$1(o);return}}function isStaticResourcesEqual(r,t){const o=/^(https?:)?\/\//i,n=r.replace(o,"").replace(/\/$/,""),s=t.replace(o,"").replace(/\/$/,"");return n===s}function createScript(r){let t=null,o=!0,n=2e4,s;const i=document.getElementsByTagName("script");for(let c=0;c<i.length;c++){const l=i[c],u=l.getAttribute("src");if(u&&isStaticResourcesEqual(u,r.url)){t=l,o=!1;break}}if(!t){const c=r.attrs;t=document.createElement("script"),t.type=(c==null?void 0:c.type)==="module"?"module":"text/javascript";let l;r.createScriptHook&&(l=r.createScriptHook(r.url,r.attrs),l instanceof HTMLScriptElement?t=l:typeof l=="object"&&("script"in l&&l.script&&(t=l.script),"timeout"in l&&l.timeout&&(n=l.timeout))),t.src||(t.src=r.url),c&&!l&&Object.keys(c).forEach(u=>{t&&(u==="async"||u==="defer"?t[u]=c[u]:t.getAttribute(u)||t.setAttribute(u,c[u]))})}const a=async(c,l)=>{clearTimeout(s);const u=()=>{(l==null?void 0:l.type)==="error"?r!=null&&r.onErrorCallback&&(r==null||r.onErrorCallback(l)):r!=null&&r.cb&&(r==null||r.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteScript:d=!0}=r;d&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),c&&typeof c=="function")){const d=c(l);if(d instanceof Promise){const h=await d;return u(),h}return u(),d}u()};return t.onerror=a.bind(null,t.onerror),t.onload=a.bind(null,t.onload),s=setTimeout(()=>{a(null,new Error(`Remote script "${r.url}" time-outed.`))},n),{script:t,needAttach:o}}function createLink(r){let t=null,o=!0;const n=document.getElementsByTagName("link");for(let i=0;i<n.length;i++){const a=n[i],c=a.getAttribute("href"),l=a.getAttribute("rel");if(c&&isStaticResourcesEqual(c,r.url)&&l===r.attrs.rel){t=a,o=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",r.url);let i;const a=r.attrs;r.createLinkHook&&(i=r.createLinkHook(r.url,a),i instanceof HTMLLinkElement&&(t=i)),a&&!i&&Object.keys(a).forEach(c=>{t&&!t.getAttribute(c)&&t.setAttribute(c,a[c])})}const s=(i,a)=>{const c=()=>{(a==null?void 0:a.type)==="error"?r!=null&&r.onErrorCallback&&(r==null||r.onErrorCallback(a)):r!=null&&r.cb&&(r==null||r.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteLink:l=!0}=r;l&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),i)){const l=i(a);return c(),l}c()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:o}}function loadScript(r,t){const{attrs:o={},createScriptHook:n}=t;return new Promise((s,i)=>{const{script:a,needAttach:c}=createScript({url:r,cb:s,onErrorCallback:i,attrs:{fetchpriority:"high",...o},createScriptHook:n,needDeleteScript:!0});c&&document.head.appendChild(a)})}const sdkImportCache=new Map;function importNodeModule(r){if(!r)throw new Error("import specifier is required");if(sdkImportCache.has(r))return sdkImportCache.get(r);const o=new Function("name","return import(name)")(r).then(n=>n).catch(n=>{throw console.error(`Error importing module ${r}:`,n),sdkImportCache.delete(r),n});return sdkImportCache.set(r,o),o}const loadNodeFetch=async()=>{const r=await importNodeModule("node-fetch");return r.default||r},lazyLoaderHookFetch=async(r,t,o)=>{const s=await((i,a)=>o.lifecycle.fetch.emit(i,a))(r,t||{});return!s||!(s instanceof Response)?(typeof fetch>"u"?await loadNodeFetch():fetch)(r,t||{}):s},createScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(url,cb,attrs,loaderHook)=>{if(loaderHook!=null&&loaderHook.createScriptHook){const r=loaderHook.createScriptHook(url);r&&typeof r=="object"&&"url"in r&&(url=r.url)}let urlObj;try{urlObj=new URL(url)}catch(r){console.error("Error constructing URL:",r),cb(new Error(`Invalid URL: ${r}`));return}const getFetch=async()=>loaderHook!=null&&loaderHook.fetch?(r,t)=>lazyLoaderHookFetch(r,t,loaderHook):typeof fetch>"u"?loadNodeFetch():fetch,handleScriptFetch=async(f,urlObj)=>{var r;try{const res=await f(urlObj.href),data=await res.text(),[path,vm]=await Promise.all([importNodeModule("path"),importNodeModule("vm")]),scriptContext={exports:{},module:{exports:{}}},urlDirname=urlObj.pathname.split("/").slice(0,-1).join("/"),filename=path.basename(urlObj.pathname),script=new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
2
2
  })`,{filename,importModuleDynamically:((r=vm.constants)==null?void 0:r.USE_MAIN_CONTEXT_DEFAULT_LOADER)??importNodeModule});script.runInThisContext()(scriptContext.exports,scriptContext.module,eval("require"),urlDirname,filename);const exportedInterface=scriptContext.module.exports||scriptContext.exports;if(attrs&&exportedInterface&&attrs.globalName){const t=exportedInterface[attrs.globalName]||exportedInterface;cb(void 0,t);return}cb(void 0,exportedInterface)}catch(t){cb(t instanceof Error?t:new Error(`Script execution error: ${t}`))}};getFetch().then(async r=>{if((attrs==null?void 0:attrs.type)==="esm"||(attrs==null?void 0:attrs.type)==="module")return loadModule(urlObj.href,{fetch:r,vm:await importNodeModule("vm")}).then(async t=>{await t.evaluate(),cb(void 0,t.namespace)}).catch(t=>{cb(t instanceof Error?t:new Error(`Script execution error: ${t}`))});handleScriptFetch(r,urlObj)}).catch(r=>{cb(r)})}:(r,t,o,n)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},loadScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(r,t)=>new Promise((o,n)=>{createScriptNode(r,(s,i)=>{var a,c;if(s)n(s);else{const l=((a=t==null?void 0:t.attrs)==null?void 0:a.globalName)||`__FEDERATION_${(c=t==null?void 0:t.attrs)==null?void 0:c.name}:custom__`,u=globalThis[l]=i;o(u)}},t.attrs,t.loaderHook)}):(r,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},esmModuleCache=new Map;async function loadModule(r,t){if(esmModuleCache.has(r))return esmModuleCache.get(r);const{fetch:o,vm:n}=t,i=await(await o(r)).text(),a=new n.SourceTextModule(i,{importModuleDynamically:async(c,l)=>{const u=new URL(c,r).href;return loadModule(u,t)}});return esmModuleCache.set(r,a),await a.link(async c=>{const l=new URL(c,r).href;return await loadModule(l,t)}),a}const LoggerInstance=createLogger("[ Module Federation Bridge Vue3 ]"),RUNTIME_001="RUNTIME-001",RUNTIME_002="RUNTIME-002",RUNTIME_003="RUNTIME-003",RUNTIME_004="RUNTIME-004",RUNTIME_005="RUNTIME-005",RUNTIME_006="RUNTIME-006",RUNTIME_007="RUNTIME-007",RUNTIME_008="RUNTIME-008",RUNTIME_009="RUNTIME-009",getDocsUrl=r=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${r.split("-")[0].toLowerCase()}/${r}`,getShortErrorMsg=(r,t,o,n)=>{const s=[`${[t[r]]} #${r}`];return o&&s.push(`args: ${JSON.stringify(o)}`),s.push(getDocsUrl(r)),n&&s.push(`Original Error Message:
3
3
  ${n}`),s.join(`
4
- `)},runtimeDescMap={[RUNTIME_001]:"Failed to get remoteEntry exports.",[RUNTIME_002]:'The remote entry interface does not contain "init"',[RUNTIME_003]:"Failed to get manifest.",[RUNTIME_004]:"Failed to locate remote.",[RUNTIME_005]:"Invalid loadShareSync function call from bundler runtime",[RUNTIME_006]:"Invalid loadShareSync function call from runtime",[RUNTIME_007]:"Failed to get remote snapshot.",[RUNTIME_008]:"Failed to load script resources.",[RUNTIME_009]:"Please call createInstance first."},LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(r,t){r||error(t)}function error(r){throw r instanceof Error?(r.message.startsWith(LOG_CATEGORY)||(r.message=`${LOG_CATEGORY}: ${r.message}`),r):new Error(`${LOG_CATEGORY}: ${r}`)}function warn(r){r instanceof Error&&(r.message.startsWith(LOG_CATEGORY)||(r.message=`${LOG_CATEGORY}: ${r.message}`)),logger.warn(r)}function addUniqueItem(r,t){return r.findIndex(o=>o===t)===-1&&r.push(t),r}function getFMId(r){return"version"in r&&r.version?`${r.name}:${r.version}`:"entry"in r&&r.entry?`${r.name}:${r.entry}`:`${r.name}`}function isRemoteInfoWithEntry(r){return typeof r.entry<"u"}function isPureRemoteEntry(r){return!r.entry.includes(".json")}function isObject(r){return r&&typeof r=="object"}const objectToString=Object.prototype.toString;function isPlainObject(r){return objectToString.call(r)==="[object Object]"}function arrayOptions(r){return Array.isArray(r)?r:[r]}function getRemoteEntryInfoFromSnapshot(r){const t={url:"",type:"global",globalName:""};return isBrowserEnv()||isReactNativeEnv()?"remoteEntry"in r?{url:r.remoteEntry,type:r.remoteEntryType,globalName:r.globalName}:t:"ssrRemoteEntry"in r?{url:r.ssrRemoteEntry||t.url,type:r.ssrRemoteEntryType||t.type,globalName:r.globalName}:t}const processModuleAlias=(r,t)=>{let o;return r.endsWith("/")?o=r.slice(0,-1):o=r,t.startsWith(".")&&(t=t.slice(1)),o=o+t,o},CurrentGlobal=typeof globalThis=="object"?globalThis:window,nativeGlobal=(()=>{try{return document.defaultView}catch{return CurrentGlobal}})(),Global=nativeGlobal;function definePropertyGlobalVal(r,t,o){Object.defineProperty(r,t,{value:o,configurable:!1,writable:!0})}function includeOwnProperty(r,t){return Object.hasOwnProperty.call(r,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(r){var t,o,n,s,i,a;includeOwnProperty(r,"__VMOK__")&&!includeOwnProperty(r,"__FEDERATION__")&&definePropertyGlobalVal(r,"__FEDERATION__",r.__VMOK__),includeOwnProperty(r,"__FEDERATION__")||(definePropertyGlobalVal(r,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(r,"__VMOK__",r.__FEDERATION__)),(t=r.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(o=r.__FEDERATION__).__INSTANCES__??(o.__INSTANCES__=[]),(n=r.__FEDERATION__).moduleInfo??(n.moduleInfo={}),(s=r.__FEDERATION__).__SHARE__??(s.__SHARE__={}),(i=r.__FEDERATION__).__MANIFEST_LOADING__??(i.__MANIFEST_LOADING__={}),(a=r.__FEDERATION__).__PRELOADED_MAP__??(a.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(r,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=r,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.0.0-refactor-manifest-20251015072237")}function getInfoWithoutType(r,t){if(typeof t=="string"){if(r[t])return{value:r[t],key:t};{const n=Object.keys(r);for(const s of n){const[i,a]=s.split(":"),c=`${i}:${t}`,l=r[c];if(l)return{value:l,key:c}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(r,t)=>{const o=getFMId(r),n=getInfoWithoutType(t,o).value;if(n&&!n.version&&"version"in r&&r.version&&(n.version=r.version),n)return n;if("version"in r&&r.version){const{version:s,...i}=r,a=getFMId(i),c=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,a).value;if((c==null?void 0:c.version)===s)return c}},getGlobalSnapshotInfoByModuleInfo=r=>getTargetSnapshotInfoByModuleInfo(r,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(r,t)=>{const o=getFMId(r);return nativeGlobal.__FEDERATION__.moduleInfo[o]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=r=>(nativeGlobal.__FEDERATION__.moduleInfo={...nativeGlobal.__FEDERATION__.moduleInfo,...r},()=>{const t=Object.keys(r);for(const o of t)delete nativeGlobal.__FEDERATION__.moduleInfo[o]}),getRemoteEntryExports=(r,t)=>{const o=t||`__FEDERATION_${r}:custom__`,n=CurrentGlobal[o];return{remoteEntryKey:o,entryExports:n}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(r),setPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(r,!0),DEFAULT_SCOPE="default",DEFAULT_REMOTE_TYPE="global",buildIdentifier="[0-9A-Za-z-]+",build=`(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`,numericIdentifier="0|[1-9]\\d*",numericIdentifierLoose="[0-9]+",nonNumericIdentifier="\\d*[a-zA-Z-][a-zA-Z0-9-]*",preReleaseIdentifierLoose=`(?:${numericIdentifierLoose}|${nonNumericIdentifier})`,preReleaseLoose=`(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`,preReleaseIdentifier=`(?:${numericIdentifier}|${nonNumericIdentifier})`,preRelease=`(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`,xRangeIdentifier=`${numericIdentifier}|x|X|\\*`,xRangePlain=`[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`,hyphenRange=`^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`,mainVersionLoose=`(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`,loosePlain=`[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`,gtlt="((?:<|>)?=?)",comparatorTrim=`(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`,loneTilde="(?:~>?)",tildeTrim=`(\\s*)${loneTilde}\\s+`,loneCaret="(?:\\^)",caretTrim=`(\\s*)${loneCaret}\\s+`,star="(<|>)?=?\\s*\\*",caret=`^${loneCaret}${xRangePlain}$`,mainVersion=`(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`,fullPlain=`v?${mainVersion}${preRelease}?${build}?`,tilde=`^${loneTilde}${xRangePlain}$`,xRange=`^${gtlt}\\s*${xRangePlain}$`,comparator=`^${gtlt}\\s*(${fullPlain})$|^$`,gte0="^\\s*>=\\s*0.0.0\\s*$";function parseRegex(r){return new RegExp(r)}function isXVersion(r){return!r||r.toLowerCase()==="x"||r==="*"}function pipe(...r){return t=>r.reduce((o,n)=>n(o),t)}function extractComparator(r){return r.match(parseRegex(comparator))}function combineVersion(r,t,o,n){const s=`${r}.${t}.${o}`;return n?`${s}-${n}`:s}function parseHyphen(r){return r.replace(parseRegex(hyphenRange),(t,o,n,s,i,a,c,l,u,d,h,p)=>(isXVersion(n)?o="":isXVersion(s)?o=`>=${n}.0.0`:isXVersion(i)?o=`>=${n}.${s}.0`:o=`>=${o}`,isXVersion(u)?l="":isXVersion(d)?l=`<${Number(u)+1}.0.0-0`:isXVersion(h)?l=`<${u}.${Number(d)+1}.0-0`:p?l=`<=${u}.${d}.${h}-${p}`:l=`<=${l}`,`${o} ${l}`.trim()))}function parseComparatorTrim(r){return r.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(r){return r.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(r){return r.replace(parseRegex(caretTrim),"$1^")}function parseCarets(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(o,n,s,i,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(i)?n==="0"?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.0 <${Number(n)+1}.0.0-0`:a?n==="0"?s==="0"?`>=${n}.${s}.${i}-${a} <${n}.${s}.${Number(i)+1}-0`:`>=${n}.${s}.${i}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${i}-${a} <${Number(n)+1}.0.0-0`:n==="0"?s==="0"?`>=${n}.${s}.${i} <${n}.${s}.${Number(i)+1}-0`:`>=${n}.${s}.${i} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${i} <${Number(n)+1}.0.0-0`)).join(" ")}function parseTildes(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(o,n,s,i,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(i)?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:a?`>=${n}.${s}.${i}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${i} <${n}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(r){return r.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(o,n,s,i,a,c)=>{const l=isXVersion(s),u=l||isXVersion(i),d=u||isXVersion(a);return n==="="&&d&&(n=""),c="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&d?(u&&(i=0),a=0,n===">"?(n=">=",u?(s=Number(s)+1,i=0,a=0):(i=Number(i)+1,a=0)):n==="<="&&(n="<",u?s=Number(s)+1:i=Number(i)+1),n==="<"&&(c="-0"),`${n+s}.${i}.${a}${c}`):u?`>=${s}.0.0${c} <${Number(s)+1}.0.0-0`:d?`>=${s}.${i}.0${c} <${s}.${Number(i)+1}.0-0`:o})).join(" ")}function parseStar(r){return r.trim().replace(parseRegex(star),"")}function parseGTE0(r){return r.trim().replace(parseRegex(gte0),"")}function compareAtom(r,t){return r=Number(r)||r,t=Number(t)||t,r>t?1:r===t?0:-1}function comparePreRelease(r,t){const{preRelease:o}=r,{preRelease:n}=t;if(o===void 0&&n)return 1;if(o&&n===void 0)return-1;if(o===void 0&&n===void 0)return 0;for(let s=0,i=o.length;s<=i;s++){const a=o[s],c=n[s];if(a!==c)return a===void 0&&c===void 0?0:a?c?compareAtom(a,c):-1:1}return 0}function compareVersion(r,t){return compareAtom(r.major,t.major)||compareAtom(r.minor,t.minor)||compareAtom(r.patch,t.patch)||comparePreRelease(r,t)}function eq(r,t){return r.version===t.version}function compare(r,t){switch(r.operator){case"":case"=":return eq(r,t);case">":return compareVersion(r,t)<0;case">=":return eq(r,t)||compareVersion(r,t)<0;case"<":return compareVersion(r,t)>0;case"<=":return eq(r,t)||compareVersion(r,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(r){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(r)}function parseRange(r){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(r.trim()).split(/\s+/).join(" ")}function satisfy(r,t){if(!r)return!1;const o=extractComparator(r);if(!o)return!1;const[,n,,s,i,a,c]=o,l={operator:n,version:combineVersion(s,i,a,c),major:s,minor:i,patch:a,preRelease:c==null?void 0:c.split(".")},u=t.split("||");for(const d of u){const h=d.trim();if(!h||h==="*"||h==="x")return!0;try{const p=parseRange(h);if(!p.trim())return!0;const m=p.split(" ").map(y=>parseComparatorString(y)).join(" ");if(!m.trim())return!0;const E=m.split(/\s+/).map(y=>parseGTE0(y)).filter(Boolean);if(E.length===0)continue;let b=!0;for(const y of E){const g=extractComparator(y);if(!g){b=!1;break}const[,S,,R,A,_,I]=g,T={operator:S,version:combineVersion(R,A,_,I),major:R,minor:A,patch:_,preRelease:I==null?void 0:I.split(".")};if(!compare(T,l)){b=!1;break}}if(b)return!0}catch(p){console.error(`[semver] Error processing range part "${h}":`,p);continue}}return!1}function formatShare(r,t,o,n){let s;return"get"in r?s=r.get:"lib"in r?s=()=>Promise.resolve(r.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${o}'!`)}),{deps:[],useIn:[],from:t,loading:null,...r,shareConfig:{requiredVersion:`^${r.version}`,singleton:!1,eager:!1,strictVersion:!1,...r.shareConfig},get:s,loaded:r!=null&&r.loaded||"lib"in r?!0:void 0,version:r.version??"0",scope:Array.isArray(r.scope)?r.scope:[r.scope??"default"],strategy:(r.strategy??n)||"version-first"}}function formatShareConfigs(r,t){const o=t.shared||{},n=t.name,s=Object.keys(o).reduce((a,c)=>{const l=arrayOptions(o[c]);return a[c]=a[c]||[],l.forEach(u=>{a[c].push(formatShare(u,n,c,t.shareStrategy))}),a},{}),i={...r.shared};return Object.keys(s).forEach(a=>{i[a]?s[a].forEach(c=>{i[a].find(u=>u.version===c.version)||i[a].push(c)}):i[a]=s[a]}),{shared:i,shareInfos:s}}function versionLt(r,t){const o=n=>{if(!Number.isNaN(Number(n))){const i=n.split(".");let a=n;for(let c=0;c<3-i.length;c++)a+=".0";return a}return n};return!!satisfy(o(r),`<=${o(t)}`)}const findVersion=(r,t)=>{const o=t||function(n,s){return versionLt(n,s)};return Object.keys(r).reduce((n,s)=>!n||o(n,s)||n==="0"?s:n,0)},isLoaded=r=>!!r.loaded||typeof r.lib=="function",isLoading=r=>!!r.loading;function findSingletonVersionOrderByVersion(r,t,o){const n=r[t][o],s=function(i,a){return!isLoaded(n[i])&&versionLt(i,a)};return findVersion(r[t][o],s)}function findSingletonVersionOrderByLoaded(r,t,o){const n=r[t][o],s=function(i,a){const c=l=>isLoaded(l)||isLoading(l);return c(n[a])?c(n[i])?!!versionLt(i,a):!0:c(n[i])?!1:versionLt(i,a)};return findVersion(r[t][o],s)}function getFindShareFunction(r){return r==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(r,t,o,n){if(!r)return;const{shareConfig:s,scope:i=DEFAULT_SCOPE,strategy:a}=o,c=Array.isArray(i)?i:[i];for(const l of c)if(s&&r[l]&&r[l][t]){const{requiredVersion:u}=s,h=getFindShareFunction(a)(r,l,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(h,u)){const b=`Version ${h} from ${h&&r[l][t][h].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;s.strictVersion?error(b):warn(b)}return r[l][t][h]}else{if(u===!1||u==="*"||satisfy(h,u))return r[l][t][h];for(const[b,y]of Object.entries(r[l][t]))if(satisfy(b,u))return y}},m={shareScopeMap:r,scope:l,pkgName:t,version:h,GlobalFederation:Global.__FEDERATION__,resolver:p};return(n.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(r){const{pkgName:t,extraOptions:o,shareInfos:n}=r,s=a=>{if(!a)return;const c={};a.forEach(d=>{c[d.version]=d});const u=findVersion(c,function(d,h){return!isLoaded(c[d])&&versionLt(d,h)});return c[u]},i=(o==null?void 0:o.resolver)??s;return Object.assign({},i(n[t]),o==null?void 0:o.customShareInfo)}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function matchRemoteWithNameAndExpose(r,t){for(const o of r){const n=t.startsWith(o.name);let s=t.replace(o.name,"");if(n){if(s.startsWith("/")){const c=o.name;return s=`.${s}`,{pkgNameOrAlias:c,expose:s,remote:o}}else if(s==="")return{pkgNameOrAlias:o.name,expose:".",remote:o}}const i=o.alias&&t.startsWith(o.alias);let a=o.alias&&t.replace(o.alias,"");if(o.alias&&i){if(a&&a.startsWith("/")){const c=o.alias;return a=`.${a}`,{pkgNameOrAlias:c,expose:a,remote:o}}else if(a==="")return{pkgNameOrAlias:o.alias,expose:".",remote:o}}}}function matchRemote(r,t){for(const o of r)if(t===o.name||o.alias&&t===o.alias)return o}function registerPlugins(r,t){const o=getGlobalHostPlugins(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return o.length>0&&o.forEach(s=>{r!=null&&r.find(i=>i.name!==s.name)&&r.push(s)}),r&&r.length>0&&r.forEach(s=>{n.forEach(i=>{i.applyPlugin(s,t)})}),r}const importCallback=".then(callbacks[0]).catch(callbacks[1])";async function loadEsmEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${r}")${importCallback}`)([o,n]):import(r).then(o).catch(n)}catch(s){n(s)}})}async function loadSystemJsEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof __system_context__>"u"?System.import(r).then(o).catch(n):new Function("callbacks",`System.import("${r}")${importCallback}`)([o,n])}catch(s){n(s)}})}function handleRemoteEntryLoaded(r,t,o){const{remoteEntryKey:n,entryExports:s}=getRemoteEntryExports(r,t);return assert(s,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:r,remoteEntryUrl:o,remoteEntryKey:n})),s}async function loadEntryScript({name:r,globalName:t,entry:o,loaderHook:n,getEntryUrl:s}){const{entryExports:i}=getRemoteEntryExports(r,t);if(i)return i;const a=s?s(o):o;return loadScript(a,{attrs:{},createScriptHook:(c,l)=>{const u=n.lifecycle.createScript.emit({url:c,attrs:l});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>handleRemoteEntryLoaded(r,t,o)).catch(c=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:r,resourceUrl:o})),c})}async function loadEntryDom({remoteInfo:r,remoteEntryExports:t,loaderHook:o,getEntryUrl:n}){const{entry:s,entryGlobalName:i,name:a,type:c}=r;switch(c){case"esm":case"module":return loadEsmEntry({entry:s,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:s,remoteEntryExports:t});default:return loadEntryScript({entry:s,globalName:i,name:a,loaderHook:o,getEntryUrl:n})}}async function loadEntryNode({remoteInfo:r,loaderHook:t}){const{entry:o,entryGlobalName:n,name:s,type:i}=r,{entryExports:a}=getRemoteEntryExports(s,n);return a||loadScriptNode(o,{attrs:{name:s,globalName:n,type:i},loaderHook:{createScriptHook:(c,l={})=>{const u=t.lifecycle.createScript.emit({url:c,attrs:l});if(u&&"url"in u)return u}}}).then(()=>handleRemoteEntryLoaded(s,n,o)).catch(c=>{throw c})}function getRemoteEntryUniqueKey(r){const{entry:t,name:o}=r;return composeKeyWithSeparator(o,t)}async function getRemoteEntry(r){const{origin:t,remoteEntryExports:o,remoteInfo:n,getEntryUrl:s,_inErrorHandling:i=!1}=r,a=getRemoteEntryUniqueKey(n);if(o)return o;if(!globalLoading[a]){const c=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;globalLoading[a]=c.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:o}).then(u=>u||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":isBrowserEnv())?loadEntryDom({remoteInfo:n,remoteEntryExports:o,loaderHook:l,getEntryUrl:s}):loadEntryNode({remoteInfo:n,loaderHook:l}))).catch(async u=>{const d=getRemoteEntryUniqueKey(n);if(u instanceof Error&&u.message.includes(RUNTIME_008)&&!i){const p=E=>getRemoteEntry({...E,_inErrorHandling:!0}),m=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:p,origin:t,remoteInfo:n,remoteEntryExports:o,globalLoading,uniqueKey:d});if(m)return m}throw u})}return globalLoading[a]}function getRemoteInfo(r){return{...r,entry:"entry"in r?r.entry:"",type:r.type||DEFAULT_REMOTE_TYPE,entryGlobalName:r.entryGlobalName||r.name,shareScope:r.shareScope||DEFAULT_SCOPE}}function defaultPreloadArgs(r){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...r}}function formatPreloadArgs(r,t){return t.map(o=>{const n=matchRemote(r,o.nameOrAlias);return assert(n,`Unable to preload ${o.nameOrAlias} as it is not included in ${!n&&safeToString({remoteInfo:n,remotes:r})}`),{remote:n,preloadConfig:defaultPreloadArgs(o)}})}function normalizePreloadExposes(r){return r?r.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(r,t,o,n=!0){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:a}=o;if(t.options.inBrowser){if(a.forEach(c=>{const{moduleInfo:l}=c,u=t.moduleCache.get(r.name);getRemoteEntry(u?{origin:t,remoteInfo:l,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const c={rel:"preload",as:"style"};s.forEach(l=>{const{link:u,needAttach:d}=createLink({url:l,cb:()=>{},attrs:c,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m}});d&&document.head.appendChild(u)})}else{const c={rel:"stylesheet",type:"text/css"};s.forEach(l=>{const{link:u,needAttach:d}=createLink({url:l,cb:()=>{},attrs:c,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m},needDeleteLink:!1});d&&document.head.appendChild(u)})}if(n){const c={rel:"preload",as:"script"};i.forEach(l=>{const{link:u,needAttach:d}=createLink({url:l,cb:()=>{},attrs:c,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m}});d&&document.head.appendChild(u)})}else{const c={fetchpriority:"high",type:(r==null?void 0:r.type)==="module"?"module":"text/javascript"};i.forEach(l=>{const{script:u,needAttach:d}=createScript({url:l,cb:()=>{},attrs:c,createScriptHook:(h,p)=>{const m=t.loaderHook.lifecycle.createScript.emit({url:h,attrs:p});if(m instanceof HTMLScriptElement)return m},needDeleteScript:!0});d&&document.head.appendChild(u)})}}}class Module{constructor({remoteInfo:t,host:o}){this.inited=!1,this.lib=void 0,this.remoteInfo=t,this.host=o}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let t;return t=await getRemoteEntry({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports}),assert(t,`remoteEntryExports is undefined
5
- ${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,o,n,s){const{loadFactory:i=!0}=n||{loadFactory:!0},a=await this.getEntry();if(!this.inited){const h=this.host.shareScopeMap,p=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];p.length||p.push("default"),p.forEach(g=>{h[g]||(h[g]={})});const m=h[p[0]],E=[],b={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?p:this.remoteInfo.shareScope||"default"};Object.defineProperty(b,"shareScopeMap",{value:h,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:b,initScope:E,remoteInfo:this.remoteInfo,origin:this.host});typeof(a==null?void 0:a.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await a.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...y,id:t,remoteSnapshot:s,remoteEntryExports:a})}this.lib=a,this.inited=!0;let c;c=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:o,moduleInfo:this.remoteInfo}),c||(c=await a.get(o)),assert(c,`${getFMId(this.remoteInfo)} remote don't export ${o}.`);const l=processModuleAlias(this.remoteInfo.name,o),u=this.wraperFactory(c,l);return i?await u():u}wraperFactory(t,o){function n(s,i){s&&typeof s=="object"&&Object.isExtensible(s)&&!Object.getOwnPropertyDescriptor(s,Symbol.for("mf_module_id"))&&Object.defineProperty(s,Symbol.for("mf_module_id"),{value:i,enumerable:!1})}return t instanceof Promise?async()=>{const s=await t();return n(s,o),s}:()=>{const s=t();return n(s,o),s}}}class SyncHook{constructor(t){this.type="",this.listeners=new Set,t&&(this.type=t)}on(t){typeof t=="function"&&this.listeners.add(t)}once(t){const o=this;this.on(function n(...s){return o.remove(n),t.apply(null,s)})}emit(...t){let o;return this.listeners.size>0&&this.listeners.forEach(n=>{o=n(...t)}),o}remove(t){this.listeners.delete(t)}removeAll(){this.listeners.clear()}}class AsyncHook extends SyncHook{emit(...t){let o;const n=Array.from(this.listeners);if(n.length>0){let s=0;const i=a=>a===!1?!1:s<n.length?Promise.resolve(n[s++].apply(null,t)).then(i):a;o=i()}return Promise.resolve(o)}}function checkReturnData(r,t){if(!isObject(t))return!1;if(r!==t){for(const o in r)if(!(o in t))return!1}return!0}class SyncWaterfallHook extends SyncHook{constructor(t){super(),this.onerror=error,this.type=t}emit(t){isObject(t)||error(`The data for the "${this.type}" hook should be an object.`);for(const o of this.listeners)try{const n=o(t);if(checkReturnData(t,n))t=n;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(n){warn(n),this.onerror(n)}return t}}class AsyncWaterfallHook extends SyncHook{constructor(t){super(),this.onerror=error,this.type=t}emit(t){isObject(t)||error(`The response data for the "${this.type}" hook must be an object.`);const o=Array.from(this.listeners);if(o.length>0){let n=0;const s=a=>(warn(a),this.onerror(a),t),i=a=>{if(checkReturnData(t,a)){if(t=a,n<o.length)try{return Promise.resolve(o[n++](t)).then(i,s)}catch(c){return s(c)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return t};return Promise.resolve(i(t))}return Promise.resolve(t)}}class PluginSystem{constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}applyPlugin(t,o){var s;assert(isPlainObject(t),"Plugin configuration is invalid.");const n=t.name;assert(n,"A name must be provided by the plugin."),this.registerPlugins[n]||(this.registerPlugins[n]=t,(s=t.apply)==null||s.call(t,o),Object.keys(this.lifecycle).forEach(i=>{const a=t[i];a&&this.lifecycle[i].on(a)}))}removePlugin(t){assert(t,"A name is required.");const o=this.registerPlugins[t];assert(o,`The plugin "${t}" is not registered.`),Object.keys(o).forEach(n=>{n!=="name"&&this.lifecycle[n].remove(o[n])})}}function assignRemoteInfo(r,t){const o=getRemoteEntryInfoFromSnapshot(t);o.url||error(`The attribute remoteEntry of ${r.name} must not be undefined.`);let n=getResourceUrl(t,o.url);!isBrowserEnv()&&!n.startsWith("http")&&(n=`https:${n}`),r.type=o.type,r.entryGlobalName=o.globalName,r.entry=n,r.version=t.version,r.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(r){const{remote:t,pkgNameOrAlias:o,expose:n,origin:s,remoteInfo:i,id:a}=r;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:c,globalSnapshot:l}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:a});assignRemoteInfo(i,c);const u={remote:t,preloadConfig:{nameOrAlias:o,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},d=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:u,remoteInfo:i,remote:t,remoteSnapshot:c,globalSnapshot:l});return d&&preloadAssets(i,s,d,!1),{...r,remoteSnapshot:c}}return r}}}function splitId(r){const t=r.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 traverseModuleInfo(r,t,o,n,s={},i){const a=getFMId(t),{value:c}=getInfoWithoutType(r,a),l=i||c;if(l&&!isManifestProvider(l)&&(o(l,t,n),l.remotesInfo)){const u=Object.keys(l.remotesInfo);for(const d of u){if(s[d])continue;s[d]=!0;const h=splitId(d),p=l.remotesInfo[d];traverseModuleInfo(r,{name:h.name,version:p.matchedVersion},o,!1,s,void 0)}}}const isExisted=(r,t)=>document.querySelector(`${r}[${r==="link"?"href":"src"}="${t}"]`);function generatePreloadAssets(r,t,o,n,s){const i=[],a=[],c=[],l=new Set,u=new Set,{options:d}=r,{preloadConfig:h}=t,{depsRemote:p}=h;if(traverseModuleInfo(n,o,(y,g,S)=>{var w;let R;if(S)R=h;else if(Array.isArray(p)){const N=p.find($=>$.nameOrAlias===g.name||$.nameOrAlias===g.alias);if(!N)return;R=defaultPreloadArgs(N)}else if(p===!0)R=h;else return;const A=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);A&&c.push({name:g.name,moduleInfo:{name:g.name,entry:A,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:g.name,shareScope:"",version:"version"in y?y.version:void 0},url:A});let _="modules"in y?y.modules:[];const I=normalizePreloadExposes(R.exposes);I.length&&"modules"in y&&(_=(w=y==null?void 0:y.modules)==null?void 0:w.reduce((N,$)=>((I==null?void 0:I.indexOf($.moduleName))!==-1&&N.push($),N),[]));function T(N){const $=N.map(M=>getResourceUrl(y,M));return R.filter?$.filter(R.filter):$}if(_){const N=_.length;for(let $=0;$<N;$++){const M=_[$],P=`${g.name}/${M.moduleName}`;r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?g.name:P,name:g.name,remoteSnapshot:y,preloadConfig:R,remote:g,origin:r}),!getPreloaded(P)&&(R.resourceCategory==="all"?(i.push(...T(M.assets.css.async)),i.push(...T(M.assets.css.sync)),a.push(...T(M.assets.js.async)),a.push(...T(M.assets.js.sync))):(R.resourceCategory="sync")&&(i.push(...T(M.assets.css.sync)),a.push(...T(M.assets.js.sync))),setPreloaded(P))}}},!0,{},s),s.shared&&s.shared.length>0){const y=(g,S)=>{const R=getRegisteredShare(r.shareScopeMap,S.sharedName,g,r.sharedHandler.hooks.lifecycle.resolveShare);R&&typeof R.lib=="function"&&(S.assets.js.sync.forEach(A=>{l.add(A)}),S.assets.css.sync.forEach(A=>{u.add(A)}))};s.shared.forEach(g=>{var _;const S=(_=d.shared)==null?void 0:_[g.sharedName];if(!S)return;const R=g.version?S.find(I=>I.version===g.version):S;if(!R)return;arrayOptions(R).forEach(I=>{y(I,g)})})}const E=a.filter(y=>!l.has(y)&&!isExisted("script",y));return{cssAssets:i.filter(y=>!u.has(y)&&!isExisted("link",y)),jsAssetsWithoutEntry:E,entryAssets:c.filter(y=>!isExisted("script",y.url))}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(r){const{origin:t,preloadOptions:o,remoteInfo:n,remote:s,globalSnapshot:i,remoteSnapshot:a}=r;return isBrowserEnv()?isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(n,a),generatePreloadAssets(t,o,n,i,a)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function getGlobalRemoteInfo(r,t){const o=getGlobalSnapshotInfoByModuleInfo({name:t.name,version:t.options.version}),n=o&&"remotesInfo"in o&&o.remotesInfo&&getInfoWithoutType(o.remotesInfo,r.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:o,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:"version"in r?r.version:void 0})}}class SnapshotHandler{constructor(t){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new PluginSystem({beforeLoadRemoteSnapshot:new AsyncHook("beforeLoadRemoteSnapshot"),loadSnapshot:new AsyncWaterfallHook("loadGlobalSnapshot"),loadRemoteSnapshot:new AsyncWaterfallHook("loadRemoteSnapshot"),afterLoadSnapshot:new AsyncWaterfallHook("afterLoadSnapshot")}),this.manifestLoading=Global.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=t,this.loaderHook=t.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:t,id:o,expose:n}){const{options:s}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:s,moduleInfo:t});let i=getGlobalSnapshotInfoByModuleInfo({name:this.HostInstance.options.name,version:this.HostInstance.options.version});i||(i={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},addGlobalSnapshot({[this.HostInstance.options.name]:i})),i&&"remotesInfo"in i&&!getInfoWithoutType(i.remotesInfo,t.name).value&&("version"in t||"entry"in t)&&(i.remotesInfo={...i==null?void 0:i.remotesInfo,[t.name]:{matchedVersion:"version"in t?t.version:t.entry}});const{hostGlobalSnapshot:a,remoteSnapshot:c,globalSnapshot:l}=this.getGlobalRemoteInfo(t),{remoteSnapshot:u,globalSnapshot:d}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:a,remoteSnapshot:c,globalSnapshot:l});let h,p;if(u)if(isManifestProvider(u)){const m=isBrowserEnv()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",E=await this.getManifestJson(m,t,{}),b=setGlobalSnapshotInfoByModuleInfo({...t,entry:m},E);h=E,p=b}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:u,from:"global"});h=m,p=d}else if(isRemoteInfoWithEntry(t)){const m=await this.getManifestJson(t.entry,t,{}),E=setGlobalSnapshotInfoByModuleInfo(t,m),{remoteSnapshot:b}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:m,from:"global"});h=b,p=E}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(d)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:o,host:this.HostInstance,options:s,moduleInfo:t,remoteSnapshot:h}),{remoteSnapshot:h,globalSnapshot:p}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,o,n){const s=async()=>{let a=this.manifestCache.get(t);if(a)return a;try{let c=await this.loaderHook.lifecycle.fetch.emit(t,{});(!c||!(c instanceof Response))&&(c=await fetch(t,{})),a=await c.json()}catch(c){a=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:c,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),a||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:o.name,hostName:this.HostInstance.options.name},`${c}`)))}return assert(a.metaData&&a.exposes&&a.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,a),a},i=async()=>{const a=await s(),c=generateSnapshotFromManifest(a,{version:t}),{remoteSnapshot:l}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:o,manifestJson:a,remoteSnapshot:c,manifestUrl:t,from:"manifest"});return l};return this.manifestLoading[t]||(this.manifestLoading[t]=i().then(a=>a)),this.manifestLoading[t]}}class SharedHandler{constructor(t){this.hooks=new PluginSystem({afterResolve:new AsyncWaterfallHook("afterResolve"),beforeLoadShare:new AsyncWaterfallHook("beforeLoadShare"),loadShare:new AsyncHook,resolveShare:new SyncWaterfallHook("resolveShare"),initContainerShareScopeMap:new SyncWaterfallHook("initContainerShareScopeMap")}),this.host=t,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(t.options)}registerShared(t,o){const{shareInfos:n,shared:s}=formatShareConfigs(t,o);return Object.keys(n).forEach(a=>{n[a].forEach(l=>{!getRegisteredShare(this.shareScopeMap,a,l,this.hooks.lifecycle.resolveShare)&&l&&l.lib&&this.setShared({pkgName:a,lib:l.lib,get:l.get,loaded:!0,shared:l,from:o.name})})}),{shareInfos:n,shared:s}}async loadShare(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&await Promise.all(s.scope.map(async u=>{await Promise.all(this.initializeSharing(u,{strategy:s.strategy}))}));const i=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:t,shareInfo:s,shared:n.options.shared,origin:n}),{shareInfo:a}=i;assert(a,`Cannot find ${t} Share in the ${n.options.name}. Please ensure that the ${t} Share parameters have been injected`);const c=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare),l=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,n.options.name)};if(c&&c.lib)return l(c),c.lib;if(c&&c.loading&&!c.loaded){const u=await c.loading;return c.loaded=!0,c.lib||(c.lib=u),l(c),u}else if(c){const d=(async()=>{const h=await c.get();return l(c),c.loaded=!0,c.lib=h,h})();return this.setShared({pkgName:t,loaded:!1,shared:c,from:n.options.name,lib:null,loading:d}),d}else{if(o!=null&&o.customShareInfo)return!1;const d=(async()=>{const h=await a.get();a.lib=h,a.loaded=!0,l(a);const p=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare);return p&&(p.lib=h,p.loaded=!0,p.from=a.from),h})();return this.setShared({pkgName:t,loaded:!1,shared:a,from:n.options.name,lib:null,loading:d}),d}}initializeSharing(t=DEFAULT_SCOPE,o){const{host:n}=this,s=o==null?void 0:o.from,i=o==null?void 0:o.strategy;let a=o==null?void 0:o.initScope;const c=[];if(s!=="build"){const{initTokens:E}=this;a||(a=[]);let b=E[t];if(b||(b=E[t]={from:this.host.name}),a.indexOf(b)>=0)return c;a.push(b)}const l=this.shareScopeMap,u=n.options.name;l[t]||(l[t]={});const d=l[t],h=(E,b)=>{var _;const{version:y,eager:g}=b;d[E]=d[E]||{};const S=d[E],R=S[y],A=!!(R&&(R.eager||(_=R.shareConfig)!=null&&_.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!g!=!A?g:u>R.from))&&(S[y]=b)},p=E=>E&&E.init&&E.init(l[t],a),m=async E=>{const{module:b}=await n.remoteHandler.getRemoteModuleAndOptions({id:E});if(b.getEntry){let y;try{y=await b.getEntry()}catch(g){y=await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:E,error:g,from:"runtime",lifecycle:"beforeLoadShare",origin:n})}b.inited||(await p(y),b.inited=!0)}};return Object.keys(n.options.shared).forEach(E=>{n.options.shared[E].forEach(y=>{y.scope.includes(t)&&h(E,y)})}),(n.options.shareStrategy==="version-first"||i==="version-first")&&n.options.remotes.forEach(E=>{E.shareScope===t&&c.push(m(E.name))}),c}loadShareSync(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&s.scope.forEach(c=>{this.initializeSharing(c,{strategy:s.strategy})});const i=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),a=c=>{c.useIn||(c.useIn=[]),addUniqueItem(c.useIn,n.options.name)};if(i){if(typeof i.lib=="function")return a(i),i.loaded||(i.loaded=!0,i.from===n.options.name&&(s.loaded=!0)),i.lib;if(typeof i.get=="function"){const c=i.get();if(!(c instanceof Promise))return a(i),this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:c,shared:i}),c}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const c=s.get();if(c instanceof Promise){const l=(o==null?void 0:o.from)==="build"?RUNTIME_005:RUNTIME_006;throw new Error(getShortErrorMsg(l,runtimeDescMap,{hostName:n.options.name,sharedPkgName:t}))}return s.lib=c,this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:n.options.name,sharedPkgName:t}))}initShareScopeMap(t,o,n={}){const{host:s}=this;this.shareScopeMap[t]=o,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:o,options:s.options,origin:s,scopeName:t,hostShareScopeMap:n.hostShareScopeMap})}setShared({pkgName:t,shared:o,from:n,lib:s,loading:i,loaded:a,get:c}){const{version:l,scope:u="default",...d}=o;(Array.isArray(u)?u:[u]).forEach(p=>{if(this.shareScopeMap[p]||(this.shareScopeMap[p]={}),this.shareScopeMap[p][t]||(this.shareScopeMap[p][t]={}),!this.shareScopeMap[p][t][l]){this.shareScopeMap[p][t][l]={version:l,scope:["default"],...d,lib:s,loaded:a,loading:i},c&&(this.shareScopeMap[p][t][l].get=c);return}const m=this.shareScopeMap[p][t][l];i&&!m.loading&&(m.loading=i),a&&!m.loaded&&(m.loaded=a),n&&m.from!==n&&(m.from=n)})}_setGlobalShareScopeMap(t){const o=getGlobalShareScope(),n=t.id||t.name;n&&!o[n]&&(o[n]=this.shareScopeMap)}}class RemoteHandler{constructor(t){this.hooks=new PluginSystem({beforeRegisterRemote:new SyncWaterfallHook("beforeRegisterRemote"),registerRemote:new SyncWaterfallHook("registerRemote"),beforeRequest:new AsyncWaterfallHook("beforeRequest"),onLoad:new AsyncHook("onLoad"),handlePreloadModule:new SyncHook("handlePreloadModule"),errorLoadRemote:new AsyncHook("errorLoadRemote"),beforePreloadRemote:new AsyncHook("beforePreloadRemote"),generatePreloadAssets:new AsyncHook("generatePreloadAssets"),afterPreloadRemote:new AsyncHook,loadEntry:new AsyncHook}),this.host=t,this.idToRemoteMap={}}formatAndRegisterRemote(t,o){return(o.remotes||[]).reduce((s,i)=>(this.registerRemote(i,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,o){const{remote:n,expose:s}=o,{name:i,alias:a}=n;if(this.idToRemoteMap[t]={name:n.name,expose:s},a&&t.startsWith(i)){const c=t.replace(i,a);this.idToRemoteMap[c]={name:n.name,expose:s};return}if(a&&t.startsWith(a)){const c=t.replace(a,i);this.idToRemoteMap[c]={name:n.name,expose:s}}}async loadRemote(t,o){const{host:n}=this;try{const{loadFactory:s=!0}=o||{loadFactory:!0},{module:i,moduleOptions:a,remoteMatchInfo:c}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:l,remote:u,expose:d,id:h,remoteSnapshot:p}=c,m=await i.get(h,d,o,p),E=await this.hooks.lifecycle.onLoad.emit({id:h,pkgNameOrAlias:l,expose:d,exposeModule:s?m:void 0,exposeModuleFactory:s?void 0:m,remote:u,options:a,moduleInstance:i,origin:n});return this.setIdToRemoteMap(t,c),typeof E=="function"?E:m}catch(s){const{from:i="runtime"}=o||{from:"runtime"},a=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:i,lifecycle:"onLoad",origin:n});if(!a)throw s;return a}}async preloadRemote(t){const{host:o}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:o.options,origin:o});const n=formatPreloadArgs(o.options.remotes,t);await Promise.all(n.map(async s=>{const{remote:i}=s,a=getRemoteInfo(i),{globalSnapshot:c,remoteSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i}),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:s,remote:i,remoteInfo:a,globalSnapshot:c,remoteSnapshot:l});u&&preloadAssets(a,o,u)}))}registerRemotes(t,o){const{host:n}=this;t.forEach(s=>{this.registerRemote(s,n.options.remotes,{force:o==null?void 0:o.force})})}async getRemoteModuleAndOptions(t){const{host:o}=this,{id:n}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:n,options:o.options,origin:o})}catch(E){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:n,options:o.options,origin:o,from:"runtime",error:E,lifecycle:"beforeRequest"}),!s)throw E}const{id:i}=s,a=matchRemoteWithNameAndExpose(o.options.remotes,i);assert(a,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:o.options.name,requestId:i}));const{remote:c}=a,l=getRemoteInfo(c),u=await o.sharedHandler.hooks.lifecycle.afterResolve.emit({id:i,...a,options:o.options,origin:o,remoteInfo:l}),{remote:d,expose:h}=u;assert(d&&h,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);let p=o.moduleCache.get(d.name);const m={host:o,remoteInfo:l};return p||(p=new Module(m),o.moduleCache.set(d.name,p)),{module:p,moduleOptions:m,remoteMatchInfo:u}}registerRemote(t,o,n){const{host:s}=this,i=()=>{if(t.alias){const c=o.find(l=>{var u;return t.alias&&(l.name.startsWith(t.alias)||((u=l.alias)==null?void 0:u.startsWith(t.alias)))});assert(!c,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${c&&c.name} name or alias`)}"entry"in t&&isBrowserEnv()&&!t.entry.startsWith("http")&&(t.entry=new URL(t.entry,window.location.origin).href),t.shareScope||(t.shareScope=DEFAULT_SCOPE),t.type||(t.type=DEFAULT_REMOTE_TYPE)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:t,origin:s});const a=o.find(c=>c.name===t.name);if(!a)i(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const c=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];n!=null&&n.force&&(this.removeRemote(a),i(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(c.join(" ")))}}removeRemote(t){var o;try{const{host:n}=this,{name:s}=t,i=n.options.remotes.findIndex(c=>c.name===s);i!==-1&&n.options.remotes.splice(i,1);const a=n.moduleCache.get(t.name);if(a){const c=a.remoteInfo,l=c.entryGlobalName;CurrentGlobal[l]&&((o=Object.getOwnPropertyDescriptor(CurrentGlobal,l))!=null&&o.configurable?delete CurrentGlobal[l]:CurrentGlobal[l]=void 0);const u=getRemoteEntryUniqueKey(a.remoteInfo);globalLoading[u]&&delete globalLoading[u],n.snapshotHandler.manifestCache.delete(c.entry);let d=c.buildVersion?composeKeyWithSeparator(c.name,c.buildVersion):c.name;const h=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(m=>c.buildVersion?m.options.id===d:m.name===d);if(h!==-1){const m=CurrentGlobal.__FEDERATION__.__INSTANCES__[h];d=m.options.id||d;const E=getGlobalShareScope();let b=!0;const y=[];Object.keys(E).forEach(g=>{const S=E[g];S&&Object.keys(S).forEach(R=>{const A=S[R];A&&Object.keys(A).forEach(_=>{const I=A[_];I&&Object.keys(I).forEach(T=>{const w=I[T];w&&typeof w=="object"&&w.from===c.name&&(w.loaded||w.loading?(w.useIn=w.useIn.filter(N=>N!==c.name),w.useIn.length?b=!1:y.push([g,R,_,T])):y.push([g,R,_,T]))})})})}),b&&(m.shareScopeMap={},delete E[d]),y.forEach(([g,S,R,A])=>{var _,I,T;(T=(I=(_=E[g])==null?void 0:_[S])==null?void 0:I[R])==null||delete T[A]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(h,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,n);if(p){const m=p&&"remotesInfo"in p&&p.remotesInfo&&getInfoWithoutType(p.remotesInfo,t.name).key;m&&(delete p.remotesInfo[m],Global.__FEDERATION__.__MANIFEST_LOADING__[m]&&delete Global.__FEDERATION__.__MANIFEST_LOADING__[m])}n.moduleCache.delete(t.name)}}catch(n){logger.log("removeRemote fail: ",n)}}}const USE_SNAPSHOT=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;class ModuleFederation{constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.0.0-refactor-manifest-20251015072237",this.moduleCache=new Map,this.loaderHook=new PluginSystem({getModuleInfo:new SyncHook,createScript:new SyncHook,createLink:new SyncHook,fetch:new AsyncHook,loadEntryError:new AsyncHook,getModuleFactory:new AsyncHook}),this.bridgeHook=new PluginSystem({beforeBridgeRender:new SyncHook,afterBridgeRender:new SyncHook,beforeBridgeDestroy:new SyncHook,afterBridgeDestroy:new SyncHook});const o=USE_SNAPSHOT?[snapshotPlugin(),generatePreloadAssetsPlugin()]:[],n={id:getBuilderId(),name:t.name,plugins:o,remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=n,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...n.plugins,...t.plugins||[]]),this.options=this.formatOptions(n,t)}initOptions(t){this.registerPlugins(t.plugins);const o=this.formatOptions(this.options,t);return this.options=o,o}async loadShare(t,o){return this.sharedHandler.loadShare(t,o)}loadShareSync(t,o){return this.sharedHandler.loadShareSync(t,o)}initializeSharing(t=DEFAULT_SCOPE,o){return this.sharedHandler.initializeSharing(t,o)}initRawContainer(t,o,n){const s=getRemoteInfo({name:t,entry:o}),i=new Module({host:this,remoteInfo:s});return i.remoteEntryExports=n,this.moduleCache.set(t,i),i}async loadRemote(t,o){return this.remoteHandler.loadRemote(t,o)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,o,n={}){this.sharedHandler.initShareScopeMap(t,o,n)}formatOptions(t,o){const{shared:n}=formatShareConfigs(t,o),{userOptions:s,options:i}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:o,options:t,shareInfo:n}),a=this.remoteHandler.formatAndRegisterRemote(i,s),{shared:c}=this.sharedHandler.registerShared(i,s),l=[...i.plugins];s.plugins&&s.plugins.forEach(d=>{l.includes(d)||l.push(d)});const u={...t,...o,plugins:l,remotes:a,shared:c};return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const o=registerPlugins(t,this);this.options.plugins=this.options.plugins.reduce((n,s)=>(s&&n&&!n.find(i=>i.name===s.name)&&n.push(s),n),o||[])}registerRemotes(t,o){return this.remoteHandler.registerRemotes(t,o)}registerShared(t){this.sharedHandler.registerShared(this.options,{...this.options,shared:t})}}let FederationInstance=null;function getInstance(){return FederationInstance}setGlobalFederationConstructor(ModuleFederation);function createBridgeComponent(r){const t=new Map,o=getInstance();return()=>({__APP_VERSION__:"0.0.0-refactor-manifest-20251015072237",async render(n){var E,b,y;LoggerInstance.debug("createBridgeComponent render Info",n);const{moduleName:s,dom:i,basename:a,memoryRoute:c,hashRoute:l,...u}=n,d=Vue__namespace.createApp(r.rootComponent,u);t.set(i,d);const h=await((y=(b=(E=o==null?void 0:o.bridgeHook)==null?void 0:E.lifecycle)==null?void 0:b.beforeBridgeRender)==null?void 0:y.emit(n)),p=h&&typeof h=="object"&&(h!=null&&h.extraProps)?h==null?void 0:h.extraProps:{},m=r.appOptions({app:d,basename:a,memoryRoute:c,hashRoute:l,...u,...p});if(m!=null&&m.router){let g,S=m.router.getRoutes();n.memoryRoute?g=VueRouter__namespace.createMemoryHistory(n.basename):n.hashRoute?(g=VueRouter__namespace.createWebHashHistory(),S=S.map(A=>({...A,path:n.basename+A.path}))):g=VueRouter__namespace.createWebHistory(n.basename);const R=VueRouter__namespace.createRouter({...m.router.options,history:g,routes:S});LoggerInstance.debug("createBridgeComponent render router info>>>",{moduleName:s,router:R}),c&&await R.push(c.entryPath),d.use(R)}d.mount(i)},destroy(n){LoggerInstance.debug("createBridgeComponent destroy Info",n);const s=t.get(n==null?void 0:n.dom);s==null||s.unmount()}})}function e(){const r=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(r)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(r){const t=Vue.ref(null),o=Vue.ref(null),n=Vue.ref(""),s=VueRouter.useRoute(),i=getInstance(),a=Vue.useAttrs(),c=async()=>{var p,m,E,b;const u=(p=r.providerInfo)==null?void 0:p.call(r);o.value=u;let d={...a,moduleName:r.moduleName,dom:t.value,basename:r.basename,memoryRoute:r.memoryRoute,hashRoute:r.hashRoute};LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",d);const h=await((b=(E=(m=i==null?void 0:i.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:E.beforeBridgeRender)==null?void 0:b.emit(d))||{};d={...d,...h.extraProps},u.render(d)},l=Vue.watch(()=>s==null?void 0:s.path,u=>{u!==s.path&&c(),n.value!==""&&n.value!==u&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...r,pathname:s.path}),e()),n.value=u});return Vue.onMounted(()=>{c()}),Vue.onBeforeUnmount(()=>{var u;LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>",{...r}),l(),(u=o.value)==null||u.destroy({dom:t.value})}),()=>Vue.createVNode("div",Vue.mergeProps(r.rootAttrs||{},{ref:t}),null)}});function createRemoteAppComponent(r){return Vue.defineAsyncComponent({__APP_VERSION__:"0.0.0-refactor-manifest-20251015072237",...r.asyncComponentOptions,loader:async()=>{var l,u;const t=VueRouter.useRoute();let o="/";const n=(u=(l=t==null?void 0:t.matched)==null?void 0:l[0])==null?void 0:u.path;n&&(n.endsWith("/:pathMatch(.*)*")?o=n.replace("/:pathMatch(.*)*",""):o=t.matched[0].path);const s=(r==null?void 0:r.export)||"default";LoggerInstance.debug("createRemoteAppComponent LazyComponent create >>>",{basename:o,info:r});const i=await r.loader(),a=i&&i[Symbol.for("mf_module_id")],c=i[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:a,module:i,exportName:s,basename:o,route:t}),s in i&&typeof c=="function")return{render(){return Vue.h(RemoteApp,{moduleName:a,providerInfo:c,basename:o,rootAttrs:r.rootAttrs})}};throw new Error("module not found")}})}function createRemoteComponent(r){return LoggerInstance.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),createRemoteAppComponent(r)}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteAppComponent=createRemoteAppComponent;exports.createRemoteComponent=createRemoteComponent;
4
+ `)},runtimeDescMap={[RUNTIME_001]:"Failed to get remoteEntry exports.",[RUNTIME_002]:'The remote entry interface does not contain "init"',[RUNTIME_003]:"Failed to get manifest.",[RUNTIME_004]:"Failed to locate remote.",[RUNTIME_005]:"Invalid loadShareSync function call from bundler runtime",[RUNTIME_006]:"Invalid loadShareSync function call from runtime",[RUNTIME_007]:"Failed to get remote snapshot.",[RUNTIME_008]:"Failed to load script resources.",[RUNTIME_009]:"Please call createInstance first."},LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(r,t){r||error(t)}function error(r){throw r instanceof Error?(r.message.startsWith(LOG_CATEGORY)||(r.message=`${LOG_CATEGORY}: ${r.message}`),r):new Error(`${LOG_CATEGORY}: ${r}`)}function warn(r){r instanceof Error&&(r.message.startsWith(LOG_CATEGORY)||(r.message=`${LOG_CATEGORY}: ${r.message}`)),logger.warn(r)}function addUniqueItem(r,t){return r.findIndex(o=>o===t)===-1&&r.push(t),r}function getFMId(r){return"version"in r&&r.version?`${r.name}:${r.version}`:"entry"in r&&r.entry?`${r.name}:${r.entry}`:`${r.name}`}function isRemoteInfoWithEntry(r){return typeof r.entry<"u"}function isPureRemoteEntry(r){return!r.entry.includes(".json")}function isObject(r){return r&&typeof r=="object"}const objectToString=Object.prototype.toString;function isPlainObject(r){return objectToString.call(r)==="[object Object]"}function arrayOptions(r){return Array.isArray(r)?r:[r]}function getRemoteEntryInfoFromSnapshot(r){const t={url:"",type:"global",globalName:""};return isBrowserEnv()||isReactNativeEnv()?"remoteEntry"in r?{url:r.remoteEntry,type:r.remoteEntryType,globalName:r.globalName}:t:"ssrRemoteEntry"in r?{url:r.ssrRemoteEntry||t.url,type:r.ssrRemoteEntryType||t.type,globalName:r.globalName}:t}const processModuleAlias=(r,t)=>{let o;return r.endsWith("/")?o=r.slice(0,-1):o=r,t.startsWith(".")&&(t=t.slice(1)),o=o+t,o},CurrentGlobal=typeof globalThis=="object"?globalThis:window,nativeGlobal=(()=>{try{return document.defaultView}catch{return CurrentGlobal}})(),Global=nativeGlobal;function definePropertyGlobalVal(r,t,o){Object.defineProperty(r,t,{value:o,configurable:!1,writable:!0})}function includeOwnProperty(r,t){return Object.hasOwnProperty.call(r,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(r){var t,o,n,s,i,a;includeOwnProperty(r,"__VMOK__")&&!includeOwnProperty(r,"__FEDERATION__")&&definePropertyGlobalVal(r,"__FEDERATION__",r.__VMOK__),includeOwnProperty(r,"__FEDERATION__")||(definePropertyGlobalVal(r,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(r,"__VMOK__",r.__FEDERATION__)),(t=r.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(o=r.__FEDERATION__).__INSTANCES__??(o.__INSTANCES__=[]),(n=r.__FEDERATION__).moduleInfo??(n.moduleInfo={}),(s=r.__FEDERATION__).__SHARE__??(s.__SHARE__={}),(i=r.__FEDERATION__).__MANIFEST_LOADING__??(i.__MANIFEST_LOADING__={}),(a=r.__FEDERATION__).__PRELOADED_MAP__??(a.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(r,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=r,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.0.0-refactor-manifest-20251015104241")}function getInfoWithoutType(r,t){if(typeof t=="string"){if(r[t])return{value:r[t],key:t};{const n=Object.keys(r);for(const s of n){const[i,a]=s.split(":"),c=`${i}:${t}`,l=r[c];if(l)return{value:l,key:c}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(r,t)=>{const o=getFMId(r),n=getInfoWithoutType(t,o).value;if(n&&!n.version&&"version"in r&&r.version&&(n.version=r.version),n)return n;if("version"in r&&r.version){const{version:s,...i}=r,a=getFMId(i),c=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,a).value;if((c==null?void 0:c.version)===s)return c}},getGlobalSnapshotInfoByModuleInfo=r=>getTargetSnapshotInfoByModuleInfo(r,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(r,t)=>{const o=getFMId(r);return nativeGlobal.__FEDERATION__.moduleInfo[o]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=r=>(nativeGlobal.__FEDERATION__.moduleInfo={...nativeGlobal.__FEDERATION__.moduleInfo,...r},()=>{const t=Object.keys(r);for(const o of t)delete nativeGlobal.__FEDERATION__.moduleInfo[o]}),getRemoteEntryExports=(r,t)=>{const o=t||`__FEDERATION_${r}:custom__`,n=CurrentGlobal[o];return{remoteEntryKey:o,entryExports:n}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(r),setPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(r,!0),DEFAULT_SCOPE="default",DEFAULT_REMOTE_TYPE="global",buildIdentifier="[0-9A-Za-z-]+",build=`(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`,numericIdentifier="0|[1-9]\\d*",numericIdentifierLoose="[0-9]+",nonNumericIdentifier="\\d*[a-zA-Z-][a-zA-Z0-9-]*",preReleaseIdentifierLoose=`(?:${numericIdentifierLoose}|${nonNumericIdentifier})`,preReleaseLoose=`(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`,preReleaseIdentifier=`(?:${numericIdentifier}|${nonNumericIdentifier})`,preRelease=`(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`,xRangeIdentifier=`${numericIdentifier}|x|X|\\*`,xRangePlain=`[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`,hyphenRange=`^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`,mainVersionLoose=`(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`,loosePlain=`[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`,gtlt="((?:<|>)?=?)",comparatorTrim=`(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`,loneTilde="(?:~>?)",tildeTrim=`(\\s*)${loneTilde}\\s+`,loneCaret="(?:\\^)",caretTrim=`(\\s*)${loneCaret}\\s+`,star="(<|>)?=?\\s*\\*",caret=`^${loneCaret}${xRangePlain}$`,mainVersion=`(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`,fullPlain=`v?${mainVersion}${preRelease}?${build}?`,tilde=`^${loneTilde}${xRangePlain}$`,xRange=`^${gtlt}\\s*${xRangePlain}$`,comparator=`^${gtlt}\\s*(${fullPlain})$|^$`,gte0="^\\s*>=\\s*0.0.0\\s*$";function parseRegex(r){return new RegExp(r)}function isXVersion(r){return!r||r.toLowerCase()==="x"||r==="*"}function pipe(...r){return t=>r.reduce((o,n)=>n(o),t)}function extractComparator(r){return r.match(parseRegex(comparator))}function combineVersion(r,t,o,n){const s=`${r}.${t}.${o}`;return n?`${s}-${n}`:s}function parseHyphen(r){return r.replace(parseRegex(hyphenRange),(t,o,n,s,i,a,c,l,u,d,h,p)=>(isXVersion(n)?o="":isXVersion(s)?o=`>=${n}.0.0`:isXVersion(i)?o=`>=${n}.${s}.0`:o=`>=${o}`,isXVersion(u)?l="":isXVersion(d)?l=`<${Number(u)+1}.0.0-0`:isXVersion(h)?l=`<${u}.${Number(d)+1}.0-0`:p?l=`<=${u}.${d}.${h}-${p}`:l=`<=${l}`,`${o} ${l}`.trim()))}function parseComparatorTrim(r){return r.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(r){return r.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(r){return r.replace(parseRegex(caretTrim),"$1^")}function parseCarets(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(o,n,s,i,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(i)?n==="0"?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.0 <${Number(n)+1}.0.0-0`:a?n==="0"?s==="0"?`>=${n}.${s}.${i}-${a} <${n}.${s}.${Number(i)+1}-0`:`>=${n}.${s}.${i}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${i}-${a} <${Number(n)+1}.0.0-0`:n==="0"?s==="0"?`>=${n}.${s}.${i} <${n}.${s}.${Number(i)+1}-0`:`>=${n}.${s}.${i} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${i} <${Number(n)+1}.0.0-0`)).join(" ")}function parseTildes(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(o,n,s,i,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(i)?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:a?`>=${n}.${s}.${i}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${i} <${n}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(r){return r.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(o,n,s,i,a,c)=>{const l=isXVersion(s),u=l||isXVersion(i),d=u||isXVersion(a);return n==="="&&d&&(n=""),c="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&d?(u&&(i=0),a=0,n===">"?(n=">=",u?(s=Number(s)+1,i=0,a=0):(i=Number(i)+1,a=0)):n==="<="&&(n="<",u?s=Number(s)+1:i=Number(i)+1),n==="<"&&(c="-0"),`${n+s}.${i}.${a}${c}`):u?`>=${s}.0.0${c} <${Number(s)+1}.0.0-0`:d?`>=${s}.${i}.0${c} <${s}.${Number(i)+1}.0-0`:o})).join(" ")}function parseStar(r){return r.trim().replace(parseRegex(star),"")}function parseGTE0(r){return r.trim().replace(parseRegex(gte0),"")}function compareAtom(r,t){return r=Number(r)||r,t=Number(t)||t,r>t?1:r===t?0:-1}function comparePreRelease(r,t){const{preRelease:o}=r,{preRelease:n}=t;if(o===void 0&&n)return 1;if(o&&n===void 0)return-1;if(o===void 0&&n===void 0)return 0;for(let s=0,i=o.length;s<=i;s++){const a=o[s],c=n[s];if(a!==c)return a===void 0&&c===void 0?0:a?c?compareAtom(a,c):-1:1}return 0}function compareVersion(r,t){return compareAtom(r.major,t.major)||compareAtom(r.minor,t.minor)||compareAtom(r.patch,t.patch)||comparePreRelease(r,t)}function eq(r,t){return r.version===t.version}function compare(r,t){switch(r.operator){case"":case"=":return eq(r,t);case">":return compareVersion(r,t)<0;case">=":return eq(r,t)||compareVersion(r,t)<0;case"<":return compareVersion(r,t)>0;case"<=":return eq(r,t)||compareVersion(r,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(r){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(r)}function parseRange(r){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(r.trim()).split(/\s+/).join(" ")}function satisfy(r,t){if(!r)return!1;const o=extractComparator(r);if(!o)return!1;const[,n,,s,i,a,c]=o,l={operator:n,version:combineVersion(s,i,a,c),major:s,minor:i,patch:a,preRelease:c==null?void 0:c.split(".")},u=t.split("||");for(const d of u){const h=d.trim();if(!h||h==="*"||h==="x")return!0;try{const p=parseRange(h);if(!p.trim())return!0;const m=p.split(" ").map(y=>parseComparatorString(y)).join(" ");if(!m.trim())return!0;const E=m.split(/\s+/).map(y=>parseGTE0(y)).filter(Boolean);if(E.length===0)continue;let b=!0;for(const y of E){const g=extractComparator(y);if(!g){b=!1;break}const[,S,,R,A,_,I]=g,T={operator:S,version:combineVersion(R,A,_,I),major:R,minor:A,patch:_,preRelease:I==null?void 0:I.split(".")};if(!compare(T,l)){b=!1;break}}if(b)return!0}catch(p){console.error(`[semver] Error processing range part "${h}":`,p);continue}}return!1}function formatShare(r,t,o,n){let s;return"get"in r?s=r.get:"lib"in r?s=()=>Promise.resolve(r.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${o}'!`)}),{deps:[],useIn:[],from:t,loading:null,...r,shareConfig:{requiredVersion:`^${r.version}`,singleton:!1,eager:!1,strictVersion:!1,...r.shareConfig},get:s,loaded:r!=null&&r.loaded||"lib"in r?!0:void 0,version:r.version??"0",scope:Array.isArray(r.scope)?r.scope:[r.scope??"default"],strategy:(r.strategy??n)||"version-first"}}function formatShareConfigs(r,t){const o=t.shared||{},n=t.name,s=Object.keys(o).reduce((a,c)=>{const l=arrayOptions(o[c]);return a[c]=a[c]||[],l.forEach(u=>{a[c].push(formatShare(u,n,c,t.shareStrategy))}),a},{}),i={...r.shared};return Object.keys(s).forEach(a=>{i[a]?s[a].forEach(c=>{i[a].find(u=>u.version===c.version)||i[a].push(c)}):i[a]=s[a]}),{shared:i,shareInfos:s}}function versionLt(r,t){const o=n=>{if(!Number.isNaN(Number(n))){const i=n.split(".");let a=n;for(let c=0;c<3-i.length;c++)a+=".0";return a}return n};return!!satisfy(o(r),`<=${o(t)}`)}const findVersion=(r,t)=>{const o=t||function(n,s){return versionLt(n,s)};return Object.keys(r).reduce((n,s)=>!n||o(n,s)||n==="0"?s:n,0)},isLoaded=r=>!!r.loaded||typeof r.lib=="function",isLoading=r=>!!r.loading;function findSingletonVersionOrderByVersion(r,t,o){const n=r[t][o],s=function(i,a){return!isLoaded(n[i])&&versionLt(i,a)};return findVersion(r[t][o],s)}function findSingletonVersionOrderByLoaded(r,t,o){const n=r[t][o],s=function(i,a){const c=l=>isLoaded(l)||isLoading(l);return c(n[a])?c(n[i])?!!versionLt(i,a):!0:c(n[i])?!1:versionLt(i,a)};return findVersion(r[t][o],s)}function getFindShareFunction(r){return r==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(r,t,o,n){if(!r)return;const{shareConfig:s,scope:i=DEFAULT_SCOPE,strategy:a}=o,c=Array.isArray(i)?i:[i];for(const l of c)if(s&&r[l]&&r[l][t]){const{requiredVersion:u}=s,h=getFindShareFunction(a)(r,l,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(h,u)){const b=`Version ${h} from ${h&&r[l][t][h].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;s.strictVersion?error(b):warn(b)}return r[l][t][h]}else{if(u===!1||u==="*"||satisfy(h,u))return r[l][t][h];for(const[b,y]of Object.entries(r[l][t]))if(satisfy(b,u))return y}},m={shareScopeMap:r,scope:l,pkgName:t,version:h,GlobalFederation:Global.__FEDERATION__,resolver:p};return(n.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(r){const{pkgName:t,extraOptions:o,shareInfos:n}=r,s=a=>{if(!a)return;const c={};a.forEach(d=>{c[d.version]=d});const u=findVersion(c,function(d,h){return!isLoaded(c[d])&&versionLt(d,h)});return c[u]},i=(o==null?void 0:o.resolver)??s;return Object.assign({},i(n[t]),o==null?void 0:o.customShareInfo)}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function matchRemoteWithNameAndExpose(r,t){for(const o of r){const n=t.startsWith(o.name);let s=t.replace(o.name,"");if(n){if(s.startsWith("/")){const c=o.name;return s=`.${s}`,{pkgNameOrAlias:c,expose:s,remote:o}}else if(s==="")return{pkgNameOrAlias:o.name,expose:".",remote:o}}const i=o.alias&&t.startsWith(o.alias);let a=o.alias&&t.replace(o.alias,"");if(o.alias&&i){if(a&&a.startsWith("/")){const c=o.alias;return a=`.${a}`,{pkgNameOrAlias:c,expose:a,remote:o}}else if(a==="")return{pkgNameOrAlias:o.alias,expose:".",remote:o}}}}function matchRemote(r,t){for(const o of r)if(t===o.name||o.alias&&t===o.alias)return o}function registerPlugins(r,t){const o=getGlobalHostPlugins(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return o.length>0&&o.forEach(s=>{r!=null&&r.find(i=>i.name!==s.name)&&r.push(s)}),r&&r.length>0&&r.forEach(s=>{n.forEach(i=>{i.applyPlugin(s,t)})}),r}const importCallback=".then(callbacks[0]).catch(callbacks[1])";async function loadEsmEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${r}")${importCallback}`)([o,n]):import(r).then(o).catch(n)}catch(s){n(s)}})}async function loadSystemJsEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof __system_context__>"u"?System.import(r).then(o).catch(n):new Function("callbacks",`System.import("${r}")${importCallback}`)([o,n])}catch(s){n(s)}})}function handleRemoteEntryLoaded(r,t,o){const{remoteEntryKey:n,entryExports:s}=getRemoteEntryExports(r,t);return assert(s,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:r,remoteEntryUrl:o,remoteEntryKey:n})),s}async function loadEntryScript({name:r,globalName:t,entry:o,loaderHook:n,getEntryUrl:s}){const{entryExports:i}=getRemoteEntryExports(r,t);if(i)return i;const a=s?s(o):o;return loadScript(a,{attrs:{},createScriptHook:(c,l)=>{const u=n.lifecycle.createScript.emit({url:c,attrs:l});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>handleRemoteEntryLoaded(r,t,o)).catch(c=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:r,resourceUrl:o})),c})}async function loadEntryDom({remoteInfo:r,remoteEntryExports:t,loaderHook:o,getEntryUrl:n}){const{entry:s,entryGlobalName:i,name:a,type:c}=r;switch(c){case"esm":case"module":return loadEsmEntry({entry:s,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:s,remoteEntryExports:t});default:return loadEntryScript({entry:s,globalName:i,name:a,loaderHook:o,getEntryUrl:n})}}async function loadEntryNode({remoteInfo:r,loaderHook:t}){const{entry:o,entryGlobalName:n,name:s,type:i}=r,{entryExports:a}=getRemoteEntryExports(s,n);return a||loadScriptNode(o,{attrs:{name:s,globalName:n,type:i},loaderHook:{createScriptHook:(c,l={})=>{const u=t.lifecycle.createScript.emit({url:c,attrs:l});if(u&&"url"in u)return u}}}).then(()=>handleRemoteEntryLoaded(s,n,o)).catch(c=>{throw c})}function getRemoteEntryUniqueKey(r){const{entry:t,name:o}=r;return composeKeyWithSeparator(o,t)}async function getRemoteEntry(r){const{origin:t,remoteEntryExports:o,remoteInfo:n,getEntryUrl:s,_inErrorHandling:i=!1}=r,a=getRemoteEntryUniqueKey(n);if(o)return o;if(!globalLoading[a]){const c=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;globalLoading[a]=c.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:o}).then(u=>u||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":isBrowserEnv())?loadEntryDom({remoteInfo:n,remoteEntryExports:o,loaderHook:l,getEntryUrl:s}):loadEntryNode({remoteInfo:n,loaderHook:l}))).catch(async u=>{const d=getRemoteEntryUniqueKey(n);if(u instanceof Error&&u.message.includes(RUNTIME_008)&&!i){const p=E=>getRemoteEntry({...E,_inErrorHandling:!0}),m=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:p,origin:t,remoteInfo:n,remoteEntryExports:o,globalLoading,uniqueKey:d});if(m)return m}throw u})}return globalLoading[a]}function getRemoteInfo(r){return{...r,entry:"entry"in r?r.entry:"",type:r.type||DEFAULT_REMOTE_TYPE,entryGlobalName:r.entryGlobalName||r.name,shareScope:r.shareScope||DEFAULT_SCOPE}}function defaultPreloadArgs(r){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...r}}function formatPreloadArgs(r,t){return t.map(o=>{const n=matchRemote(r,o.nameOrAlias);return assert(n,`Unable to preload ${o.nameOrAlias} as it is not included in ${!n&&safeToString({remoteInfo:n,remotes:r})}`),{remote:n,preloadConfig:defaultPreloadArgs(o)}})}function normalizePreloadExposes(r){return r?r.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(r,t,o,n=!0){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:a}=o;if(t.options.inBrowser){if(a.forEach(c=>{const{moduleInfo:l}=c,u=t.moduleCache.get(r.name);getRemoteEntry(u?{origin:t,remoteInfo:l,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const c={rel:"preload",as:"style"};s.forEach(l=>{const{link:u,needAttach:d}=createLink({url:l,cb:()=>{},attrs:c,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m}});d&&document.head.appendChild(u)})}else{const c={rel:"stylesheet",type:"text/css"};s.forEach(l=>{const{link:u,needAttach:d}=createLink({url:l,cb:()=>{},attrs:c,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m},needDeleteLink:!1});d&&document.head.appendChild(u)})}if(n){const c={rel:"preload",as:"script"};i.forEach(l=>{const{link:u,needAttach:d}=createLink({url:l,cb:()=>{},attrs:c,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m}});d&&document.head.appendChild(u)})}else{const c={fetchpriority:"high",type:(r==null?void 0:r.type)==="module"?"module":"text/javascript"};i.forEach(l=>{const{script:u,needAttach:d}=createScript({url:l,cb:()=>{},attrs:c,createScriptHook:(h,p)=>{const m=t.loaderHook.lifecycle.createScript.emit({url:h,attrs:p});if(m instanceof HTMLScriptElement)return m},needDeleteScript:!0});d&&document.head.appendChild(u)})}}}class Module{constructor({remoteInfo:t,host:o}){this.inited=!1,this.lib=void 0,this.remoteInfo=t,this.host=o}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let t;return t=await getRemoteEntry({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports}),assert(t,`remoteEntryExports is undefined
5
+ ${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,o,n,s){const{loadFactory:i=!0}=n||{loadFactory:!0},a=await this.getEntry();if(!this.inited){const h=this.host.shareScopeMap,p=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];p.length||p.push("default"),p.forEach(g=>{h[g]||(h[g]={})});const m=h[p[0]],E=[],b={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?p:this.remoteInfo.shareScope||"default"};Object.defineProperty(b,"shareScopeMap",{value:h,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:b,initScope:E,remoteInfo:this.remoteInfo,origin:this.host});typeof(a==null?void 0:a.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await a.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...y,id:t,remoteSnapshot:s,remoteEntryExports:a})}this.lib=a,this.inited=!0;let c;c=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:o,moduleInfo:this.remoteInfo}),c||(c=await a.get(o)),assert(c,`${getFMId(this.remoteInfo)} remote don't export ${o}.`);const l=processModuleAlias(this.remoteInfo.name,o),u=this.wraperFactory(c,l);return i?await u():u}wraperFactory(t,o){function n(s,i){s&&typeof s=="object"&&Object.isExtensible(s)&&!Object.getOwnPropertyDescriptor(s,Symbol.for("mf_module_id"))&&Object.defineProperty(s,Symbol.for("mf_module_id"),{value:i,enumerable:!1})}return t instanceof Promise?async()=>{const s=await t();return n(s,o),s}:()=>{const s=t();return n(s,o),s}}}class SyncHook{constructor(t){this.type="",this.listeners=new Set,t&&(this.type=t)}on(t){typeof t=="function"&&this.listeners.add(t)}once(t){const o=this;this.on(function n(...s){return o.remove(n),t.apply(null,s)})}emit(...t){let o;return this.listeners.size>0&&this.listeners.forEach(n=>{o=n(...t)}),o}remove(t){this.listeners.delete(t)}removeAll(){this.listeners.clear()}}class AsyncHook extends SyncHook{emit(...t){let o;const n=Array.from(this.listeners);if(n.length>0){let s=0;const i=a=>a===!1?!1:s<n.length?Promise.resolve(n[s++].apply(null,t)).then(i):a;o=i()}return Promise.resolve(o)}}function checkReturnData(r,t){if(!isObject(t))return!1;if(r!==t){for(const o in r)if(!(o in t))return!1}return!0}class SyncWaterfallHook extends SyncHook{constructor(t){super(),this.onerror=error,this.type=t}emit(t){isObject(t)||error(`The data for the "${this.type}" hook should be an object.`);for(const o of this.listeners)try{const n=o(t);if(checkReturnData(t,n))t=n;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(n){warn(n),this.onerror(n)}return t}}class AsyncWaterfallHook extends SyncHook{constructor(t){super(),this.onerror=error,this.type=t}emit(t){isObject(t)||error(`The response data for the "${this.type}" hook must be an object.`);const o=Array.from(this.listeners);if(o.length>0){let n=0;const s=a=>(warn(a),this.onerror(a),t),i=a=>{if(checkReturnData(t,a)){if(t=a,n<o.length)try{return Promise.resolve(o[n++](t)).then(i,s)}catch(c){return s(c)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return t};return Promise.resolve(i(t))}return Promise.resolve(t)}}class PluginSystem{constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}applyPlugin(t,o){var s;assert(isPlainObject(t),"Plugin configuration is invalid.");const n=t.name;assert(n,"A name must be provided by the plugin."),this.registerPlugins[n]||(this.registerPlugins[n]=t,(s=t.apply)==null||s.call(t,o),Object.keys(this.lifecycle).forEach(i=>{const a=t[i];a&&this.lifecycle[i].on(a)}))}removePlugin(t){assert(t,"A name is required.");const o=this.registerPlugins[t];assert(o,`The plugin "${t}" is not registered.`),Object.keys(o).forEach(n=>{n!=="name"&&this.lifecycle[n].remove(o[n])})}}function assignRemoteInfo(r,t){const o=getRemoteEntryInfoFromSnapshot(t);o.url||error(`The attribute remoteEntry of ${r.name} must not be undefined.`);let n=getResourceUrl(t,o.url);!isBrowserEnv()&&!n.startsWith("http")&&(n=`https:${n}`),r.type=o.type,r.entryGlobalName=o.globalName,r.entry=n,r.version=t.version,r.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(r){const{remote:t,pkgNameOrAlias:o,expose:n,origin:s,remoteInfo:i,id:a}=r;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:c,globalSnapshot:l}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:a});assignRemoteInfo(i,c);const u={remote:t,preloadConfig:{nameOrAlias:o,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},d=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:u,remoteInfo:i,remote:t,remoteSnapshot:c,globalSnapshot:l});return d&&preloadAssets(i,s,d,!1),{...r,remoteSnapshot:c}}return r}}}function splitId(r){const t=r.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 traverseModuleInfo(r,t,o,n,s={},i){const a=getFMId(t),{value:c}=getInfoWithoutType(r,a),l=i||c;if(l&&!isManifestProvider(l)&&(o(l,t,n),l.remotesInfo)){const u=Object.keys(l.remotesInfo);for(const d of u){if(s[d])continue;s[d]=!0;const h=splitId(d),p=l.remotesInfo[d];traverseModuleInfo(r,{name:h.name,version:p.matchedVersion},o,!1,s,void 0)}}}const isExisted=(r,t)=>document.querySelector(`${r}[${r==="link"?"href":"src"}="${t}"]`);function generatePreloadAssets(r,t,o,n,s){const i=[],a=[],c=[],l=new Set,u=new Set,{options:d}=r,{preloadConfig:h}=t,{depsRemote:p}=h;if(traverseModuleInfo(n,o,(y,g,S)=>{var w;let R;if(S)R=h;else if(Array.isArray(p)){const N=p.find($=>$.nameOrAlias===g.name||$.nameOrAlias===g.alias);if(!N)return;R=defaultPreloadArgs(N)}else if(p===!0)R=h;else return;const A=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);A&&c.push({name:g.name,moduleInfo:{name:g.name,entry:A,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:g.name,shareScope:"",version:"version"in y?y.version:void 0},url:A});let _="modules"in y?y.modules:[];const I=normalizePreloadExposes(R.exposes);I.length&&"modules"in y&&(_=(w=y==null?void 0:y.modules)==null?void 0:w.reduce((N,$)=>((I==null?void 0:I.indexOf($.moduleName))!==-1&&N.push($),N),[]));function T(N){const $=N.map(M=>getResourceUrl(y,M));return R.filter?$.filter(R.filter):$}if(_){const N=_.length;for(let $=0;$<N;$++){const M=_[$],P=`${g.name}/${M.moduleName}`;r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?g.name:P,name:g.name,remoteSnapshot:y,preloadConfig:R,remote:g,origin:r}),!getPreloaded(P)&&(R.resourceCategory==="all"?(i.push(...T(M.assets.css.async)),i.push(...T(M.assets.css.sync)),a.push(...T(M.assets.js.async)),a.push(...T(M.assets.js.sync))):(R.resourceCategory="sync")&&(i.push(...T(M.assets.css.sync)),a.push(...T(M.assets.js.sync))),setPreloaded(P))}}},!0,{},s),s.shared&&s.shared.length>0){const y=(g,S)=>{const R=getRegisteredShare(r.shareScopeMap,S.sharedName,g,r.sharedHandler.hooks.lifecycle.resolveShare);R&&typeof R.lib=="function"&&(S.assets.js.sync.forEach(A=>{l.add(A)}),S.assets.css.sync.forEach(A=>{u.add(A)}))};s.shared.forEach(g=>{var _;const S=(_=d.shared)==null?void 0:_[g.sharedName];if(!S)return;const R=g.version?S.find(I=>I.version===g.version):S;if(!R)return;arrayOptions(R).forEach(I=>{y(I,g)})})}const E=a.filter(y=>!l.has(y)&&!isExisted("script",y));return{cssAssets:i.filter(y=>!u.has(y)&&!isExisted("link",y)),jsAssetsWithoutEntry:E,entryAssets:c.filter(y=>!isExisted("script",y.url))}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(r){const{origin:t,preloadOptions:o,remoteInfo:n,remote:s,globalSnapshot:i,remoteSnapshot:a}=r;return isBrowserEnv()?isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(n,a),generatePreloadAssets(t,o,n,i,a)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function getGlobalRemoteInfo(r,t){const o=getGlobalSnapshotInfoByModuleInfo({name:t.name,version:t.options.version}),n=o&&"remotesInfo"in o&&o.remotesInfo&&getInfoWithoutType(o.remotesInfo,r.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:o,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:"version"in r?r.version:void 0})}}class SnapshotHandler{constructor(t){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new PluginSystem({beforeLoadRemoteSnapshot:new AsyncHook("beforeLoadRemoteSnapshot"),loadSnapshot:new AsyncWaterfallHook("loadGlobalSnapshot"),loadRemoteSnapshot:new AsyncWaterfallHook("loadRemoteSnapshot"),afterLoadSnapshot:new AsyncWaterfallHook("afterLoadSnapshot")}),this.manifestLoading=Global.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=t,this.loaderHook=t.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:t,id:o,expose:n}){const{options:s}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:s,moduleInfo:t});let i=getGlobalSnapshotInfoByModuleInfo({name:this.HostInstance.options.name,version:this.HostInstance.options.version});i||(i={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},addGlobalSnapshot({[this.HostInstance.options.name]:i})),i&&"remotesInfo"in i&&!getInfoWithoutType(i.remotesInfo,t.name).value&&("version"in t||"entry"in t)&&(i.remotesInfo={...i==null?void 0:i.remotesInfo,[t.name]:{matchedVersion:"version"in t?t.version:t.entry}});const{hostGlobalSnapshot:a,remoteSnapshot:c,globalSnapshot:l}=this.getGlobalRemoteInfo(t),{remoteSnapshot:u,globalSnapshot:d}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:a,remoteSnapshot:c,globalSnapshot:l});let h,p;if(u)if(isManifestProvider(u)){const m=isBrowserEnv()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",E=await this.getManifestJson(m,t,{}),b=setGlobalSnapshotInfoByModuleInfo({...t,entry:m},E);h=E,p=b}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:u,from:"global"});h=m,p=d}else if(isRemoteInfoWithEntry(t)){const m=await this.getManifestJson(t.entry,t,{}),E=setGlobalSnapshotInfoByModuleInfo(t,m),{remoteSnapshot:b}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:m,from:"global"});h=b,p=E}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(d)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:o,host:this.HostInstance,options:s,moduleInfo:t,remoteSnapshot:h}),{remoteSnapshot:h,globalSnapshot:p}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,o,n){const s=async()=>{let a=this.manifestCache.get(t);if(a)return a;try{let c=await this.loaderHook.lifecycle.fetch.emit(t,{});(!c||!(c instanceof Response))&&(c=await fetch(t,{})),a=await c.json()}catch(c){a=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:c,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),a||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:o.name,hostName:this.HostInstance.options.name},`${c}`)))}return assert(a.metaData&&a.exposes&&a.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,a),a},i=async()=>{const a=await s(),c=generateSnapshotFromManifest(a,{version:t}),{remoteSnapshot:l}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:o,manifestJson:a,remoteSnapshot:c,manifestUrl:t,from:"manifest"});return l};return this.manifestLoading[t]||(this.manifestLoading[t]=i().then(a=>a)),this.manifestLoading[t]}}class SharedHandler{constructor(t){this.hooks=new PluginSystem({afterResolve:new AsyncWaterfallHook("afterResolve"),beforeLoadShare:new AsyncWaterfallHook("beforeLoadShare"),loadShare:new AsyncHook,resolveShare:new SyncWaterfallHook("resolveShare"),initContainerShareScopeMap:new SyncWaterfallHook("initContainerShareScopeMap")}),this.host=t,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(t.options)}registerShared(t,o){const{shareInfos:n,shared:s}=formatShareConfigs(t,o);return Object.keys(n).forEach(a=>{n[a].forEach(l=>{!getRegisteredShare(this.shareScopeMap,a,l,this.hooks.lifecycle.resolveShare)&&l&&l.lib&&this.setShared({pkgName:a,lib:l.lib,get:l.get,loaded:!0,shared:l,from:o.name})})}),{shareInfos:n,shared:s}}async loadShare(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&await Promise.all(s.scope.map(async u=>{await Promise.all(this.initializeSharing(u,{strategy:s.strategy}))}));const i=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:t,shareInfo:s,shared:n.options.shared,origin:n}),{shareInfo:a}=i;assert(a,`Cannot find ${t} Share in the ${n.options.name}. Please ensure that the ${t} Share parameters have been injected`);const c=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare),l=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,n.options.name)};if(c&&c.lib)return l(c),c.lib;if(c&&c.loading&&!c.loaded){const u=await c.loading;return c.loaded=!0,c.lib||(c.lib=u),l(c),u}else if(c){const d=(async()=>{const h=await c.get();return l(c),c.loaded=!0,c.lib=h,h})();return this.setShared({pkgName:t,loaded:!1,shared:c,from:n.options.name,lib:null,loading:d}),d}else{if(o!=null&&o.customShareInfo)return!1;const d=(async()=>{const h=await a.get();a.lib=h,a.loaded=!0,l(a);const p=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare);return p&&(p.lib=h,p.loaded=!0,p.from=a.from),h})();return this.setShared({pkgName:t,loaded:!1,shared:a,from:n.options.name,lib:null,loading:d}),d}}initializeSharing(t=DEFAULT_SCOPE,o){const{host:n}=this,s=o==null?void 0:o.from,i=o==null?void 0:o.strategy;let a=o==null?void 0:o.initScope;const c=[];if(s!=="build"){const{initTokens:E}=this;a||(a=[]);let b=E[t];if(b||(b=E[t]={from:this.host.name}),a.indexOf(b)>=0)return c;a.push(b)}const l=this.shareScopeMap,u=n.options.name;l[t]||(l[t]={});const d=l[t],h=(E,b)=>{var _;const{version:y,eager:g}=b;d[E]=d[E]||{};const S=d[E],R=S[y],A=!!(R&&(R.eager||(_=R.shareConfig)!=null&&_.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!g!=!A?g:u>R.from))&&(S[y]=b)},p=E=>E&&E.init&&E.init(l[t],a),m=async E=>{const{module:b}=await n.remoteHandler.getRemoteModuleAndOptions({id:E});if(b.getEntry){let y;try{y=await b.getEntry()}catch(g){y=await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:E,error:g,from:"runtime",lifecycle:"beforeLoadShare",origin:n})}b.inited||(await p(y),b.inited=!0)}};return Object.keys(n.options.shared).forEach(E=>{n.options.shared[E].forEach(y=>{y.scope.includes(t)&&h(E,y)})}),(n.options.shareStrategy==="version-first"||i==="version-first")&&n.options.remotes.forEach(E=>{E.shareScope===t&&c.push(m(E.name))}),c}loadShareSync(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&s.scope.forEach(c=>{this.initializeSharing(c,{strategy:s.strategy})});const i=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),a=c=>{c.useIn||(c.useIn=[]),addUniqueItem(c.useIn,n.options.name)};if(i){if(typeof i.lib=="function")return a(i),i.loaded||(i.loaded=!0,i.from===n.options.name&&(s.loaded=!0)),i.lib;if(typeof i.get=="function"){const c=i.get();if(!(c instanceof Promise))return a(i),this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:c,shared:i}),c}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const c=s.get();if(c instanceof Promise){const l=(o==null?void 0:o.from)==="build"?RUNTIME_005:RUNTIME_006;throw new Error(getShortErrorMsg(l,runtimeDescMap,{hostName:n.options.name,sharedPkgName:t}))}return s.lib=c,this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:n.options.name,sharedPkgName:t}))}initShareScopeMap(t,o,n={}){const{host:s}=this;this.shareScopeMap[t]=o,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:o,options:s.options,origin:s,scopeName:t,hostShareScopeMap:n.hostShareScopeMap})}setShared({pkgName:t,shared:o,from:n,lib:s,loading:i,loaded:a,get:c}){const{version:l,scope:u="default",...d}=o;(Array.isArray(u)?u:[u]).forEach(p=>{if(this.shareScopeMap[p]||(this.shareScopeMap[p]={}),this.shareScopeMap[p][t]||(this.shareScopeMap[p][t]={}),!this.shareScopeMap[p][t][l]){this.shareScopeMap[p][t][l]={version:l,scope:["default"],...d,lib:s,loaded:a,loading:i},c&&(this.shareScopeMap[p][t][l].get=c);return}const m=this.shareScopeMap[p][t][l];i&&!m.loading&&(m.loading=i),a&&!m.loaded&&(m.loaded=a),n&&m.from!==n&&(m.from=n)})}_setGlobalShareScopeMap(t){const o=getGlobalShareScope(),n=t.id||t.name;n&&!o[n]&&(o[n]=this.shareScopeMap)}}class RemoteHandler{constructor(t){this.hooks=new PluginSystem({beforeRegisterRemote:new SyncWaterfallHook("beforeRegisterRemote"),registerRemote:new SyncWaterfallHook("registerRemote"),beforeRequest:new AsyncWaterfallHook("beforeRequest"),onLoad:new AsyncHook("onLoad"),handlePreloadModule:new SyncHook("handlePreloadModule"),errorLoadRemote:new AsyncHook("errorLoadRemote"),beforePreloadRemote:new AsyncHook("beforePreloadRemote"),generatePreloadAssets:new AsyncHook("generatePreloadAssets"),afterPreloadRemote:new AsyncHook,loadEntry:new AsyncHook}),this.host=t,this.idToRemoteMap={}}formatAndRegisterRemote(t,o){return(o.remotes||[]).reduce((s,i)=>(this.registerRemote(i,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,o){const{remote:n,expose:s}=o,{name:i,alias:a}=n;if(this.idToRemoteMap[t]={name:n.name,expose:s},a&&t.startsWith(i)){const c=t.replace(i,a);this.idToRemoteMap[c]={name:n.name,expose:s};return}if(a&&t.startsWith(a)){const c=t.replace(a,i);this.idToRemoteMap[c]={name:n.name,expose:s}}}async loadRemote(t,o){const{host:n}=this;try{const{loadFactory:s=!0}=o||{loadFactory:!0},{module:i,moduleOptions:a,remoteMatchInfo:c}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:l,remote:u,expose:d,id:h,remoteSnapshot:p}=c,m=await i.get(h,d,o,p),E=await this.hooks.lifecycle.onLoad.emit({id:h,pkgNameOrAlias:l,expose:d,exposeModule:s?m:void 0,exposeModuleFactory:s?void 0:m,remote:u,options:a,moduleInstance:i,origin:n});return this.setIdToRemoteMap(t,c),typeof E=="function"?E:m}catch(s){const{from:i="runtime"}=o||{from:"runtime"},a=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:i,lifecycle:"onLoad",origin:n});if(!a)throw s;return a}}async preloadRemote(t){const{host:o}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:o.options,origin:o});const n=formatPreloadArgs(o.options.remotes,t);await Promise.all(n.map(async s=>{const{remote:i}=s,a=getRemoteInfo(i),{globalSnapshot:c,remoteSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i}),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:s,remote:i,remoteInfo:a,globalSnapshot:c,remoteSnapshot:l});u&&preloadAssets(a,o,u)}))}registerRemotes(t,o){const{host:n}=this;t.forEach(s=>{this.registerRemote(s,n.options.remotes,{force:o==null?void 0:o.force})})}async getRemoteModuleAndOptions(t){const{host:o}=this,{id:n}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:n,options:o.options,origin:o})}catch(E){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:n,options:o.options,origin:o,from:"runtime",error:E,lifecycle:"beforeRequest"}),!s)throw E}const{id:i}=s,a=matchRemoteWithNameAndExpose(o.options.remotes,i);assert(a,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:o.options.name,requestId:i}));const{remote:c}=a,l=getRemoteInfo(c),u=await o.sharedHandler.hooks.lifecycle.afterResolve.emit({id:i,...a,options:o.options,origin:o,remoteInfo:l}),{remote:d,expose:h}=u;assert(d&&h,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);let p=o.moduleCache.get(d.name);const m={host:o,remoteInfo:l};return p||(p=new Module(m),o.moduleCache.set(d.name,p)),{module:p,moduleOptions:m,remoteMatchInfo:u}}registerRemote(t,o,n){const{host:s}=this,i=()=>{if(t.alias){const c=o.find(l=>{var u;return t.alias&&(l.name.startsWith(t.alias)||((u=l.alias)==null?void 0:u.startsWith(t.alias)))});assert(!c,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${c&&c.name} name or alias`)}"entry"in t&&isBrowserEnv()&&!t.entry.startsWith("http")&&(t.entry=new URL(t.entry,window.location.origin).href),t.shareScope||(t.shareScope=DEFAULT_SCOPE),t.type||(t.type=DEFAULT_REMOTE_TYPE)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:t,origin:s});const a=o.find(c=>c.name===t.name);if(!a)i(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const c=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];n!=null&&n.force&&(this.removeRemote(a),i(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(c.join(" ")))}}removeRemote(t){var o;try{const{host:n}=this,{name:s}=t,i=n.options.remotes.findIndex(c=>c.name===s);i!==-1&&n.options.remotes.splice(i,1);const a=n.moduleCache.get(t.name);if(a){const c=a.remoteInfo,l=c.entryGlobalName;CurrentGlobal[l]&&((o=Object.getOwnPropertyDescriptor(CurrentGlobal,l))!=null&&o.configurable?delete CurrentGlobal[l]:CurrentGlobal[l]=void 0);const u=getRemoteEntryUniqueKey(a.remoteInfo);globalLoading[u]&&delete globalLoading[u],n.snapshotHandler.manifestCache.delete(c.entry);let d=c.buildVersion?composeKeyWithSeparator(c.name,c.buildVersion):c.name;const h=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(m=>c.buildVersion?m.options.id===d:m.name===d);if(h!==-1){const m=CurrentGlobal.__FEDERATION__.__INSTANCES__[h];d=m.options.id||d;const E=getGlobalShareScope();let b=!0;const y=[];Object.keys(E).forEach(g=>{const S=E[g];S&&Object.keys(S).forEach(R=>{const A=S[R];A&&Object.keys(A).forEach(_=>{const I=A[_];I&&Object.keys(I).forEach(T=>{const w=I[T];w&&typeof w=="object"&&w.from===c.name&&(w.loaded||w.loading?(w.useIn=w.useIn.filter(N=>N!==c.name),w.useIn.length?b=!1:y.push([g,R,_,T])):y.push([g,R,_,T]))})})})}),b&&(m.shareScopeMap={},delete E[d]),y.forEach(([g,S,R,A])=>{var _,I,T;(T=(I=(_=E[g])==null?void 0:_[S])==null?void 0:I[R])==null||delete T[A]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(h,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,n);if(p){const m=p&&"remotesInfo"in p&&p.remotesInfo&&getInfoWithoutType(p.remotesInfo,t.name).key;m&&(delete p.remotesInfo[m],Global.__FEDERATION__.__MANIFEST_LOADING__[m]&&delete Global.__FEDERATION__.__MANIFEST_LOADING__[m])}n.moduleCache.delete(t.name)}}catch(n){logger.log("removeRemote fail: ",n)}}}const USE_SNAPSHOT=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;class ModuleFederation{constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.0.0-refactor-manifest-20251015104241",this.moduleCache=new Map,this.loaderHook=new PluginSystem({getModuleInfo:new SyncHook,createScript:new SyncHook,createLink:new SyncHook,fetch:new AsyncHook,loadEntryError:new AsyncHook,getModuleFactory:new AsyncHook}),this.bridgeHook=new PluginSystem({beforeBridgeRender:new SyncHook,afterBridgeRender:new SyncHook,beforeBridgeDestroy:new SyncHook,afterBridgeDestroy:new SyncHook});const o=USE_SNAPSHOT?[snapshotPlugin(),generatePreloadAssetsPlugin()]:[],n={id:getBuilderId(),name:t.name,plugins:o,remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=n,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...n.plugins,...t.plugins||[]]),this.options=this.formatOptions(n,t)}initOptions(t){this.registerPlugins(t.plugins);const o=this.formatOptions(this.options,t);return this.options=o,o}async loadShare(t,o){return this.sharedHandler.loadShare(t,o)}loadShareSync(t,o){return this.sharedHandler.loadShareSync(t,o)}initializeSharing(t=DEFAULT_SCOPE,o){return this.sharedHandler.initializeSharing(t,o)}initRawContainer(t,o,n){const s=getRemoteInfo({name:t,entry:o}),i=new Module({host:this,remoteInfo:s});return i.remoteEntryExports=n,this.moduleCache.set(t,i),i}async loadRemote(t,o){return this.remoteHandler.loadRemote(t,o)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,o,n={}){this.sharedHandler.initShareScopeMap(t,o,n)}formatOptions(t,o){const{shared:n}=formatShareConfigs(t,o),{userOptions:s,options:i}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:o,options:t,shareInfo:n}),a=this.remoteHandler.formatAndRegisterRemote(i,s),{shared:c}=this.sharedHandler.registerShared(i,s),l=[...i.plugins];s.plugins&&s.plugins.forEach(d=>{l.includes(d)||l.push(d)});const u={...t,...o,plugins:l,remotes:a,shared:c};return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const o=registerPlugins(t,this);this.options.plugins=this.options.plugins.reduce((n,s)=>(s&&n&&!n.find(i=>i.name===s.name)&&n.push(s),n),o||[])}registerRemotes(t,o){return this.remoteHandler.registerRemotes(t,o)}registerShared(t){this.sharedHandler.registerShared(this.options,{...this.options,shared:t})}}let FederationInstance=null;function getInstance(){return FederationInstance}setGlobalFederationConstructor(ModuleFederation);function createBridgeComponent(r){const t=new Map,o=getInstance();return()=>({__APP_VERSION__:"0.0.0-refactor-manifest-20251015104241",async render(n){var E,b,y;LoggerInstance.debug("createBridgeComponent render Info",n);const{moduleName:s,dom:i,basename:a,memoryRoute:c,hashRoute:l,...u}=n,d=Vue__namespace.createApp(r.rootComponent,u);t.set(i,d);const h=await((y=(b=(E=o==null?void 0:o.bridgeHook)==null?void 0:E.lifecycle)==null?void 0:b.beforeBridgeRender)==null?void 0:y.emit(n)),p=h&&typeof h=="object"&&(h!=null&&h.extraProps)?h==null?void 0:h.extraProps:{},m=r.appOptions({app:d,basename:a,memoryRoute:c,hashRoute:l,...u,...p});if(m!=null&&m.router){let g,S=m.router.getRoutes();n.memoryRoute?g=VueRouter__namespace.createMemoryHistory(n.basename):n.hashRoute?(g=VueRouter__namespace.createWebHashHistory(),S=S.map(A=>({...A,path:n.basename+A.path}))):g=VueRouter__namespace.createWebHistory(n.basename);const R=VueRouter__namespace.createRouter({...m.router.options,history:g,routes:S});LoggerInstance.debug("createBridgeComponent render router info>>>",{moduleName:s,router:R}),c&&await R.push(c.entryPath),d.use(R)}d.mount(i)},destroy(n){LoggerInstance.debug("createBridgeComponent destroy Info",n);const s=t.get(n==null?void 0:n.dom);s==null||s.unmount()}})}function e(){const r=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(r)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(r){const t=Vue.ref(null),o=Vue.ref(null),n=Vue.ref(""),s=VueRouter.useRoute(),i=getInstance(),a=Vue.useAttrs(),c=async()=>{var p,m,E,b;const u=(p=r.providerInfo)==null?void 0:p.call(r);o.value=u;let d={...a,moduleName:r.moduleName,dom:t.value,basename:r.basename,memoryRoute:r.memoryRoute,hashRoute:r.hashRoute};LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",d);const h=await((b=(E=(m=i==null?void 0:i.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:E.beforeBridgeRender)==null?void 0:b.emit(d))||{};d={...d,...h.extraProps},u.render(d)},l=Vue.watch(()=>s==null?void 0:s.path,u=>{u!==s.path&&c(),n.value!==""&&n.value!==u&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...r,pathname:s.path}),e()),n.value=u});return Vue.onMounted(()=>{c()}),Vue.onBeforeUnmount(()=>{var u;LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>",{...r}),l(),(u=o.value)==null||u.destroy({dom:t.value})}),()=>Vue.createVNode("div",Vue.mergeProps(r.rootAttrs||{},{ref:t}),null)}});function createRemoteAppComponent(r){return Vue.defineAsyncComponent({__APP_VERSION__:"0.0.0-refactor-manifest-20251015104241",...r.asyncComponentOptions,loader:async()=>{var l,u;const t=VueRouter.useRoute();let o="/";const n=(u=(l=t==null?void 0:t.matched)==null?void 0:l[0])==null?void 0:u.path;n&&(n.endsWith("/:pathMatch(.*)*")?o=n.replace("/:pathMatch(.*)*",""):o=t.matched[0].path);const s=(r==null?void 0:r.export)||"default";LoggerInstance.debug("createRemoteAppComponent LazyComponent create >>>",{basename:o,info:r});const i=await r.loader(),a=i&&i[Symbol.for("mf_module_id")],c=i[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:a,module:i,exportName:s,basename:o,route:t}),s in i&&typeof c=="function")return{render(){return Vue.h(RemoteApp,{moduleName:a,providerInfo:c,basename:o,rootAttrs:r.rootAttrs})}};throw new Error("module not found")}})}function createRemoteComponent(r){return LoggerInstance.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),createRemoteAppComponent(r)}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteAppComponent=createRemoteAppComponent;exports.createRemoteComponent=createRemoteComponent;
package/dist/index.js CHANGED
@@ -73,16 +73,16 @@ function generateSnapshotFromManifest(r, t = {}) {
73
73
  // overrides will override dependencies
74
74
  matchedVersion: c.includes(_) ? n[_] : o[_]
75
75
  });
76
- const { remoteEntry: { path: u, name: d, type: m }, types: p, buildInfo: { buildVersion: y }, globalName: g, ssrRemoteEntry: R } = r.metaData, { exposes: E } = r;
76
+ const { remoteEntry: { path: u, name: d, type: p }, types: m = { path: "", name: "", zip: "", api: "" }, buildInfo: { buildVersion: y }, globalName: g, ssrRemoteEntry: R } = r.metaData, { exposes: E } = r;
77
77
  let b = {
78
78
  version: s || "",
79
79
  buildVersion: y,
80
80
  globalName: g,
81
81
  remoteEntry: simpleJoinRemoteEntry(u, d),
82
- remoteEntryType: m,
83
- remoteTypes: simpleJoinRemoteEntry(p.path, p.name),
84
- remoteTypesZip: p.zip || "",
85
- remoteTypesAPI: p.api || "",
82
+ remoteEntryType: p,
83
+ remoteTypes: simpleJoinRemoteEntry(m.path, m.name),
84
+ remoteTypesZip: m.zip || "",
85
+ remoteTypesAPI: m.api || "",
86
86
  remotesInfo: l,
87
87
  shared: r == null ? void 0 : r.shared.map((_) => ({
88
88
  assets: _.assets,
@@ -243,8 +243,8 @@ function createScript(r) {
243
243
  }), c && typeof c == "function")) {
244
244
  const d = c(l);
245
245
  if (d instanceof Promise) {
246
- const m = await d;
247
- return u(), m;
246
+ const p = await d;
247
+ return u(), p;
248
248
  }
249
249
  return u(), d;
250
250
  }
@@ -502,7 +502,7 @@ function setGlobalDefaultVal(r) {
502
502
  setGlobalDefaultVal(CurrentGlobal);
503
503
  setGlobalDefaultVal(nativeGlobal);
504
504
  function setGlobalFederationConstructor(r, t = isDebugMode()) {
505
- t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-refactor-manifest-20251015072237");
505
+ t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-refactor-manifest-20251015104241");
506
506
  }
507
507
  function getInfoWithoutType(r, t) {
508
508
  if (typeof t == "string") {
@@ -572,7 +572,7 @@ function combineVersion(r, t, o, n) {
572
572
  return n ? `${s}-${n}` : s;
573
573
  }
574
574
  function parseHyphen(r) {
575
- return r.replace(parseRegex(hyphenRange), (t, o, n, s, i, a, c, l, u, d, m, p) => (isXVersion(n) ? o = "" : isXVersion(s) ? o = `>=${n}.0.0` : isXVersion(i) ? o = `>=${n}.${s}.0` : o = `>=${o}`, isXVersion(u) ? l = "" : isXVersion(d) ? l = `<${Number(u) + 1}.0.0-0` : isXVersion(m) ? l = `<${u}.${Number(d) + 1}.0-0` : p ? l = `<=${u}.${d}.${m}-${p}` : l = `<=${l}`, `${o} ${l}`.trim()));
575
+ return r.replace(parseRegex(hyphenRange), (t, o, n, s, i, a, c, l, u, d, p, m) => (isXVersion(n) ? o = "" : isXVersion(s) ? o = `>=${n}.0.0` : isXVersion(i) ? o = `>=${n}.${s}.0` : o = `>=${o}`, isXVersion(u) ? l = "" : isXVersion(d) ? l = `<${Number(u) + 1}.0.0-0` : isXVersion(p) ? l = `<${u}.${Number(d) + 1}.0-0` : m ? l = `<=${u}.${d}.${p}-${m}` : l = `<=${l}`, `${o} ${l}`.trim()));
576
576
  }
577
577
  function parseComparatorTrim(r) {
578
578
  return r.replace(parseRegex(comparatorTrim), "$1$2$3");
@@ -698,14 +698,14 @@ function satisfy(r, t) {
698
698
  preRelease: c == null ? void 0 : c.split(".")
699
699
  }, u = t.split("||");
700
700
  for (const d of u) {
701
- const m = d.trim();
702
- if (!m || m === "*" || m === "x")
701
+ const p = d.trim();
702
+ if (!p || p === "*" || p === "x")
703
703
  return !0;
704
704
  try {
705
- const p = parseRange(m);
706
- if (!p.trim())
705
+ const m = parseRange(p);
706
+ if (!m.trim())
707
707
  return !0;
708
- const y = p.split(" ").map((E) => parseComparatorString(E)).join(" ");
708
+ const y = m.split(" ").map((E) => parseComparatorString(E)).join(" ");
709
709
  if (!y.trim())
710
710
  return !0;
711
711
  const g = y.split(/\s+/).map((E) => parseGTE0(E)).filter(Boolean);
@@ -733,8 +733,8 @@ function satisfy(r, t) {
733
733
  }
734
734
  if (R)
735
735
  return !0;
736
- } catch (p) {
737
- console.error(`[semver] Error processing range part "${m}":`, p);
736
+ } catch (m) {
737
+ console.error(`[semver] Error processing range part "${p}":`, m);
738
738
  continue;
739
739
  }
740
740
  }
@@ -820,16 +820,16 @@ function getRegisteredShare(r, t, o, n) {
820
820
  const { shareConfig: s, scope: i = DEFAULT_SCOPE, strategy: a } = o, c = Array.isArray(i) ? i : [i];
821
821
  for (const l of c)
822
822
  if (s && r[l] && r[l][t]) {
823
- const { requiredVersion: u } = s, m = getFindShareFunction(a)(r, l, t), p = () => {
823
+ const { requiredVersion: u } = s, p = getFindShareFunction(a)(r, l, t), m = () => {
824
824
  if (s.singleton) {
825
- if (typeof u == "string" && !satisfy(m, u)) {
826
- const R = `Version ${m} from ${m && r[l][t][m].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;
825
+ if (typeof u == "string" && !satisfy(p, u)) {
826
+ const R = `Version ${p} from ${p && r[l][t][p].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;
827
827
  s.strictVersion ? error(R) : warn(R);
828
828
  }
829
- return r[l][t][m];
829
+ return r[l][t][p];
830
830
  } else {
831
- if (u === !1 || u === "*" || satisfy(m, u))
832
- return r[l][t][m];
831
+ if (u === !1 || u === "*" || satisfy(p, u))
832
+ return r[l][t][p];
833
833
  for (const [R, E] of Object.entries(r[l][t]))
834
834
  if (satisfy(R, u))
835
835
  return E;
@@ -838,9 +838,9 @@ function getRegisteredShare(r, t, o, n) {
838
838
  shareScopeMap: r,
839
839
  scope: l,
840
840
  pkgName: t,
841
- version: m,
841
+ version: p,
842
842
  GlobalFederation: Global.__FEDERATION__,
843
- resolver: p
843
+ resolver: m
844
844
  };
845
845
  return (n.emit(y) || y).resolver();
846
846
  }
@@ -856,8 +856,8 @@ function getTargetSharedOptions(r) {
856
856
  a.forEach((d) => {
857
857
  c[d.version] = d;
858
858
  });
859
- const u = findVersion(c, function(d, m) {
860
- return !isLoaded(c[d]) && versionLt(d, m);
859
+ const u = findVersion(c, function(d, p) {
860
+ return !isLoaded(c[d]) && versionLt(d, p);
861
861
  });
862
862
  return c[u];
863
863
  }, i = (o == null ? void 0 : o.resolver) ?? s;
@@ -1037,8 +1037,8 @@ async function getRemoteEntry(r) {
1037
1037
  }) : loadEntryNode({ remoteInfo: n, loaderHook: l }))).catch(async (u) => {
1038
1038
  const d = getRemoteEntryUniqueKey(n);
1039
1039
  if (u instanceof Error && u.message.includes(RUNTIME_008) && !i) {
1040
- const p = (g) => getRemoteEntry({ ...g, _inErrorHandling: !0 }), y = await t.loaderHook.lifecycle.loadEntryError.emit({
1041
- getRemoteEntry: p,
1040
+ const m = (g) => getRemoteEntry({ ...g, _inErrorHandling: !0 }), y = await t.loaderHook.lifecycle.loadEntryError.emit({
1041
+ getRemoteEntry: m,
1042
1042
  origin: t,
1043
1043
  remoteInfo: n,
1044
1044
  remoteEntryExports: o,
@@ -1111,10 +1111,10 @@ function preloadAssets(r, t, o, n = !0) {
1111
1111
  cb: () => {
1112
1112
  },
1113
1113
  attrs: c,
1114
- createLinkHook: (m, p) => {
1114
+ createLinkHook: (p, m) => {
1115
1115
  const y = t.loaderHook.lifecycle.createLink.emit({
1116
- url: m,
1117
- attrs: p
1116
+ url: p,
1117
+ attrs: m
1118
1118
  });
1119
1119
  if (y instanceof HTMLLinkElement)
1120
1120
  return y;
@@ -1133,10 +1133,10 @@ function preloadAssets(r, t, o, n = !0) {
1133
1133
  cb: () => {
1134
1134
  },
1135
1135
  attrs: c,
1136
- createLinkHook: (m, p) => {
1136
+ createLinkHook: (p, m) => {
1137
1137
  const y = t.loaderHook.lifecycle.createLink.emit({
1138
- url: m,
1139
- attrs: p
1138
+ url: p,
1139
+ attrs: m
1140
1140
  });
1141
1141
  if (y instanceof HTMLLinkElement)
1142
1142
  return y;
@@ -1157,10 +1157,10 @@ function preloadAssets(r, t, o, n = !0) {
1157
1157
  cb: () => {
1158
1158
  },
1159
1159
  attrs: c,
1160
- createLinkHook: (m, p) => {
1160
+ createLinkHook: (p, m) => {
1161
1161
  const y = t.loaderHook.lifecycle.createLink.emit({
1162
- url: m,
1163
- attrs: p
1162
+ url: p,
1163
+ attrs: m
1164
1164
  });
1165
1165
  if (y instanceof HTMLLinkElement)
1166
1166
  return y;
@@ -1179,10 +1179,10 @@ function preloadAssets(r, t, o, n = !0) {
1179
1179
  cb: () => {
1180
1180
  },
1181
1181
  attrs: c,
1182
- createScriptHook: (m, p) => {
1182
+ createScriptHook: (p, m) => {
1183
1183
  const y = t.loaderHook.lifecycle.createScript.emit({
1184
- url: m,
1185
- attrs: p
1184
+ url: p,
1185
+ attrs: m
1186
1186
  });
1187
1187
  if (y instanceof HTMLScriptElement)
1188
1188
  return y;
@@ -1213,16 +1213,16 @@ class Module {
1213
1213
  async get(t, o, n, s) {
1214
1214
  const { loadFactory: i = !0 } = n || { loadFactory: !0 }, a = await this.getEntry();
1215
1215
  if (!this.inited) {
1216
- const m = this.host.shareScopeMap, p = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [this.remoteInfo.shareScope];
1217
- p.length || p.push("default"), p.forEach((b) => {
1218
- m[b] || (m[b] = {});
1216
+ const p = this.host.shareScopeMap, m = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [this.remoteInfo.shareScope];
1217
+ m.length || m.push("default"), m.forEach((b) => {
1218
+ p[b] || (p[b] = {});
1219
1219
  });
1220
- const y = m[p[0]], g = [], R = {
1220
+ const y = p[m[0]], g = [], R = {
1221
1221
  version: this.remoteInfo.version || "",
1222
- shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? p : this.remoteInfo.shareScope || "default"
1222
+ shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? m : this.remoteInfo.shareScope || "default"
1223
1223
  };
1224
1224
  Object.defineProperty(R, "shareScopeMap", {
1225
- value: m,
1225
+ value: p,
1226
1226
  // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
1227
1227
  enumerable: !1
1228
1228
  });
@@ -1452,29 +1452,29 @@ function traverseModuleInfo(r, t, o, n, s = {}, i) {
1452
1452
  if (s[d])
1453
1453
  continue;
1454
1454
  s[d] = !0;
1455
- const m = splitId(d), p = l.remotesInfo[d];
1455
+ const p = splitId(d), m = l.remotesInfo[d];
1456
1456
  traverseModuleInfo(r, {
1457
- name: m.name,
1458
- version: p.matchedVersion
1457
+ name: p.name,
1458
+ version: m.matchedVersion
1459
1459
  }, o, !1, s, void 0);
1460
1460
  }
1461
1461
  }
1462
1462
  }
1463
1463
  const isExisted = (r, t) => document.querySelector(`${r}[${r === "link" ? "href" : "src"}="${t}"]`);
1464
1464
  function generatePreloadAssets(r, t, o, n, s) {
1465
- const i = [], a = [], c = [], l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = r, { preloadConfig: m } = t, { depsRemote: p } = m;
1465
+ const i = [], a = [], c = [], l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = r, { preloadConfig: p } = t, { depsRemote: m } = p;
1466
1466
  if (traverseModuleInfo(n, o, (E, b, I) => {
1467
1467
  var $;
1468
1468
  let S;
1469
1469
  if (I)
1470
- S = m;
1471
- else if (Array.isArray(p)) {
1472
- const M = p.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
1470
+ S = p;
1471
+ else if (Array.isArray(m)) {
1472
+ const M = m.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
1473
1473
  if (!M)
1474
1474
  return;
1475
1475
  S = defaultPreloadArgs(M);
1476
- } else if (p === !0)
1477
- S = m;
1476
+ } else if (m === !0)
1477
+ S = p;
1478
1478
  else
1479
1479
  return;
1480
1480
  const T = getResourceUrl(E, getRemoteEntryInfoFromSnapshot(E).url);
@@ -1629,7 +1629,7 @@ class SnapshotHandler {
1629
1629
  remoteSnapshot: c,
1630
1630
  globalSnapshot: l
1631
1631
  });
1632
- let m, p;
1632
+ let p, m;
1633
1633
  if (u)
1634
1634
  if (isManifestProvider(u)) {
1635
1635
  const y = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "", g = await this.getManifestJson(y, t, {}), R = setGlobalSnapshotInfoByModuleInfo({
@@ -1638,7 +1638,7 @@ class SnapshotHandler {
1638
1638
  // Therefore, set the snapshot key to the global address of the actual request
1639
1639
  entry: y
1640
1640
  }, g);
1641
- m = g, p = R;
1641
+ p = g, m = R;
1642
1642
  } else {
1643
1643
  const { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1644
1644
  options: this.HostInstance.options,
@@ -1646,7 +1646,7 @@ class SnapshotHandler {
1646
1646
  remoteSnapshot: u,
1647
1647
  from: "global"
1648
1648
  });
1649
- m = y, p = d;
1649
+ p = y, m = d;
1650
1650
  }
1651
1651
  else if (isRemoteInfoWithEntry(t)) {
1652
1652
  const y = await this.getManifestJson(t.entry, t, {}), g = setGlobalSnapshotInfoByModuleInfo(t, y), { remoteSnapshot: R } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
@@ -1655,7 +1655,7 @@ class SnapshotHandler {
1655
1655
  remoteSnapshot: y,
1656
1656
  from: "global"
1657
1657
  });
1658
- m = R, p = g;
1658
+ p = R, m = g;
1659
1659
  } else
1660
1660
  error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
1661
1661
  hostName: t.name,
@@ -1667,10 +1667,10 @@ class SnapshotHandler {
1667
1667
  host: this.HostInstance,
1668
1668
  options: s,
1669
1669
  moduleInfo: t,
1670
- remoteSnapshot: m
1670
+ remoteSnapshot: p
1671
1671
  }), {
1672
- remoteSnapshot: m,
1673
- globalSnapshot: p
1672
+ remoteSnapshot: p,
1673
+ globalSnapshot: m
1674
1674
  };
1675
1675
  }
1676
1676
  getGlobalRemoteInfo(t) {
@@ -1773,8 +1773,8 @@ class SharedHandler {
1773
1773
  return c.loaded = !0, c.lib || (c.lib = u), l(c), u;
1774
1774
  } else if (c) {
1775
1775
  const d = (async () => {
1776
- const m = await c.get();
1777
- return l(c), c.loaded = !0, c.lib = m, m;
1776
+ const p = await c.get();
1777
+ return l(c), c.loaded = !0, c.lib = p, p;
1778
1778
  })();
1779
1779
  return this.setShared({
1780
1780
  pkgName: t,
@@ -1788,10 +1788,10 @@ class SharedHandler {
1788
1788
  if (o != null && o.customShareInfo)
1789
1789
  return !1;
1790
1790
  const d = (async () => {
1791
- const m = await a.get();
1792
- a.lib = m, a.loaded = !0, l(a);
1793
- const p = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1794
- return p && (p.lib = m, p.loaded = !0, p.from = a.from), m;
1791
+ const p = await a.get();
1792
+ a.lib = p, a.loaded = !0, l(a);
1793
+ const m = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1794
+ return m && (m.lib = p, m.loaded = !0, m.from = a.from), p;
1795
1795
  })();
1796
1796
  return this.setShared({
1797
1797
  pkgName: t,
@@ -1823,13 +1823,13 @@ class SharedHandler {
1823
1823
  }
1824
1824
  const l = this.shareScopeMap, u = n.options.name;
1825
1825
  l[t] || (l[t] = {});
1826
- const d = l[t], m = (g, R) => {
1826
+ const d = l[t], p = (g, R) => {
1827
1827
  var _;
1828
1828
  const { version: E, eager: b } = R;
1829
1829
  d[g] = d[g] || {};
1830
1830
  const I = d[g], S = I[E], T = !!(S && (S.eager || (_ = S.shareConfig) != null && _.eager));
1831
1831
  (!S || S.strategy !== "loaded-first" && !S.loaded && (!b != !T ? b : u > S.from)) && (I[E] = R);
1832
- }, p = (g) => g && g.init && g.init(l[t], a), y = async (g) => {
1832
+ }, m = (g) => g && g.init && g.init(l[t], a), y = async (g) => {
1833
1833
  const { module: R } = await n.remoteHandler.getRemoteModuleAndOptions({
1834
1834
  id: g
1835
1835
  });
@@ -1846,12 +1846,12 @@ class SharedHandler {
1846
1846
  origin: n
1847
1847
  });
1848
1848
  }
1849
- R.inited || (await p(E), R.inited = !0);
1849
+ R.inited || (await m(E), R.inited = !0);
1850
1850
  }
1851
1851
  };
1852
1852
  return Object.keys(n.options.shared).forEach((g) => {
1853
1853
  n.options.shared[g].forEach((E) => {
1854
- E.scope.includes(t) && m(g, E);
1854
+ E.scope.includes(t) && p(g, E);
1855
1855
  });
1856
1856
  }), (n.options.shareStrategy === "version-first" || i === "version-first") && n.options.remotes.forEach((g) => {
1857
1857
  g.shareScope === t && c.push(y(g.name));
@@ -1924,19 +1924,19 @@ class SharedHandler {
1924
1924
  }
1925
1925
  setShared({ pkgName: t, shared: o, from: n, lib: s, loading: i, loaded: a, get: c }) {
1926
1926
  const { version: l, scope: u = "default", ...d } = o;
1927
- (Array.isArray(u) ? u : [u]).forEach((p) => {
1928
- if (this.shareScopeMap[p] || (this.shareScopeMap[p] = {}), this.shareScopeMap[p][t] || (this.shareScopeMap[p][t] = {}), !this.shareScopeMap[p][t][l]) {
1929
- this.shareScopeMap[p][t][l] = {
1927
+ (Array.isArray(u) ? u : [u]).forEach((m) => {
1928
+ if (this.shareScopeMap[m] || (this.shareScopeMap[m] = {}), this.shareScopeMap[m][t] || (this.shareScopeMap[m][t] = {}), !this.shareScopeMap[m][t][l]) {
1929
+ this.shareScopeMap[m][t][l] = {
1930
1930
  version: l,
1931
1931
  scope: ["default"],
1932
1932
  ...d,
1933
1933
  lib: s,
1934
1934
  loaded: a,
1935
1935
  loading: i
1936
- }, c && (this.shareScopeMap[p][t][l].get = c);
1936
+ }, c && (this.shareScopeMap[m][t][l].get = c);
1937
1937
  return;
1938
1938
  }
1939
- const y = this.shareScopeMap[p][t][l];
1939
+ const y = this.shareScopeMap[m][t][l];
1940
1940
  i && !y.loading && (y.loading = i), a && !y.loaded && (y.loaded = a), n && y.from !== n && (y.from = n);
1941
1941
  });
1942
1942
  }
@@ -1985,8 +1985,8 @@ class RemoteHandler {
1985
1985
  loadFactory: !0
1986
1986
  }, { module: i, moduleOptions: a, remoteMatchInfo: c } = await this.getRemoteModuleAndOptions({
1987
1987
  id: t
1988
- }), { pkgNameOrAlias: l, remote: u, expose: d, id: m, remoteSnapshot: p } = c, y = await i.get(m, d, o, p), g = await this.hooks.lifecycle.onLoad.emit({
1989
- id: m,
1988
+ }), { pkgNameOrAlias: l, remote: u, expose: d, id: p, remoteSnapshot: m } = c, y = await i.get(p, d, o, m), g = await this.hooks.lifecycle.onLoad.emit({
1989
+ id: p,
1990
1990
  pkgNameOrAlias: l,
1991
1991
  expose: d,
1992
1992
  exposeModule: s ? y : void 0,
@@ -2072,15 +2072,15 @@ class RemoteHandler {
2072
2072
  options: o.options,
2073
2073
  origin: o,
2074
2074
  remoteInfo: l
2075
- }), { remote: d, expose: m } = u;
2076
- assert(d && m, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);
2077
- let p = o.moduleCache.get(d.name);
2075
+ }), { remote: d, expose: p } = u;
2076
+ assert(d && p, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);
2077
+ let m = o.moduleCache.get(d.name);
2078
2078
  const y = {
2079
2079
  host: o,
2080
2080
  remoteInfo: l
2081
2081
  };
2082
- return p || (p = new Module(y), o.moduleCache.set(d.name, p)), {
2083
- module: p,
2082
+ return m || (m = new Module(y), o.moduleCache.set(d.name, m)), {
2083
+ module: m,
2084
2084
  moduleOptions: y,
2085
2085
  remoteMatchInfo: u
2086
2086
  };
@@ -2120,9 +2120,9 @@ class RemoteHandler {
2120
2120
  const u = getRemoteEntryUniqueKey(a.remoteInfo);
2121
2121
  globalLoading[u] && delete globalLoading[u], n.snapshotHandler.manifestCache.delete(c.entry);
2122
2122
  let d = c.buildVersion ? composeKeyWithSeparator(c.name, c.buildVersion) : c.name;
2123
- const m = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => c.buildVersion ? y.options.id === d : y.name === d);
2124
- if (m !== -1) {
2125
- const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[m];
2123
+ const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => c.buildVersion ? y.options.id === d : y.name === d);
2124
+ if (p !== -1) {
2125
+ const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[p];
2126
2126
  d = y.options.id || d;
2127
2127
  const g = getGlobalShareScope();
2128
2128
  let R = !0;
@@ -2152,12 +2152,12 @@ class RemoteHandler {
2152
2152
  }), R && (y.shareScopeMap = {}, delete g[d]), E.forEach(([b, I, S, T]) => {
2153
2153
  var _, A, w;
2154
2154
  (w = (A = (_ = g[b]) == null ? void 0 : _[I]) == null ? void 0 : A[S]) == null || delete w[T];
2155
- }), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(m, 1);
2155
+ }), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(p, 1);
2156
2156
  }
2157
- const { hostGlobalSnapshot: p } = getGlobalRemoteInfo(t, n);
2158
- if (p) {
2159
- const y = p && "remotesInfo" in p && p.remotesInfo && getInfoWithoutType(p.remotesInfo, t.name).key;
2160
- y && (delete p.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
2157
+ const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, n);
2158
+ if (m) {
2159
+ const y = m && "remotesInfo" in m && m.remotesInfo && getInfoWithoutType(m.remotesInfo, t.name).key;
2160
+ y && (delete m.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
2161
2161
  }
2162
2162
  n.moduleCache.delete(t.name);
2163
2163
  }
@@ -2176,7 +2176,7 @@ class ModuleFederation {
2176
2176
  beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
2177
2177
  // maybe will change, temporarily for internal use only
2178
2178
  initContainer: new AsyncWaterfallHook("initContainer")
2179
- }), this.version = "0.0.0-refactor-manifest-20251015072237", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2179
+ }), this.version = "0.0.0-refactor-manifest-20251015104241", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2180
2180
  // FIXME: may not be suitable , not open to the public yet
2181
2181
  getModuleInfo: new SyncHook(),
2182
2182
  createScript: new SyncHook(),
@@ -2281,7 +2281,7 @@ setGlobalFederationConstructor(ModuleFederation);
2281
2281
  function createBridgeComponent(r) {
2282
2282
  const t = /* @__PURE__ */ new Map(), o = getInstance();
2283
2283
  return () => ({
2284
- __APP_VERSION__: "0.0.0-refactor-manifest-20251015072237",
2284
+ __APP_VERSION__: "0.0.0-refactor-manifest-20251015104241",
2285
2285
  async render(n) {
2286
2286
  var g, R, E;
2287
2287
  LoggerInstance.debug("createBridgeComponent render Info", n);
@@ -2294,13 +2294,13 @@ function createBridgeComponent(r) {
2294
2294
  ...u
2295
2295
  } = n, d = Vue.createApp(r.rootComponent, u);
2296
2296
  t.set(i, d);
2297
- const m = await ((E = (R = (g = o == null ? void 0 : o.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : R.beforeBridgeRender) == null ? void 0 : E.emit(n)), p = m && typeof m == "object" && (m != null && m.extraProps) ? m == null ? void 0 : m.extraProps : {}, y = r.appOptions({
2297
+ const p = await ((E = (R = (g = o == null ? void 0 : o.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : R.beforeBridgeRender) == null ? void 0 : E.emit(n)), m = p && typeof p == "object" && (p != null && p.extraProps) ? p == null ? void 0 : p.extraProps : {}, y = r.appOptions({
2298
2298
  app: d,
2299
2299
  basename: a,
2300
2300
  memoryRoute: c,
2301
2301
  hashRoute: l,
2302
2302
  ...u,
2303
- ...p
2303
+ ...m
2304
2304
  });
2305
2305
  if (y != null && y.router) {
2306
2306
  let b, I = y.router.getRoutes();
@@ -2344,8 +2344,8 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2344
2344
  inheritAttrs: !1,
2345
2345
  setup(r) {
2346
2346
  const t = ref(null), o = ref(null), n = ref(""), s = useRoute(), i = getInstance(), a = useAttrs(), c = async () => {
2347
- var p, y, g, R;
2348
- const u = (p = r.providerInfo) == null ? void 0 : p.call(r);
2347
+ var m, y, g, R;
2348
+ const u = (m = r.providerInfo) == null ? void 0 : m.call(r);
2349
2349
  o.value = u;
2350
2350
  let d = {
2351
2351
  ...a,
@@ -2356,10 +2356,10 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2356
2356
  hashRoute: r.hashRoute
2357
2357
  };
2358
2358
  LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>", d);
2359
- const m = await ((R = (g = (y = i == null ? void 0 : i.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : R.emit(d)) || {};
2359
+ const p = await ((R = (g = (y = i == null ? void 0 : i.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : R.emit(d)) || {};
2360
2360
  d = {
2361
2361
  ...d,
2362
- ...m.extraProps
2362
+ ...p.extraProps
2363
2363
  }, u.render(d);
2364
2364
  }, l = watch(() => s == null ? void 0 : s.path, (u) => {
2365
2365
  u !== s.path && c(), n.value !== "" && n.value !== u && (LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
@@ -2383,7 +2383,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2383
2383
  });
2384
2384
  function createRemoteAppComponent(r) {
2385
2385
  return defineAsyncComponent({
2386
- __APP_VERSION__: "0.0.0-refactor-manifest-20251015072237",
2386
+ __APP_VERSION__: "0.0.0-refactor-manifest-20251015104241",
2387
2387
  ...r.asyncComponentOptions,
2388
2388
  //@ts-ignore
2389
2389
  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": "0.0.0-refactor-manifest-20251015072237",
10
+ "version": "0.0.0-refactor-manifest-20251015104241",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -32,9 +32,9 @@
32
32
  "vue-router": "=4"
33
33
  },
34
34
  "dependencies": {
35
- "@module-federation/bridge-shared": "0.0.0-refactor-manifest-20251015072237",
36
- "@module-federation/sdk": "0.0.0-refactor-manifest-20251015072237",
37
- "@module-federation/runtime": "0.0.0-refactor-manifest-20251015072237"
35
+ "@module-federation/bridge-shared": "0.0.0-refactor-manifest-20251015104241",
36
+ "@module-federation/sdk": "0.0.0-refactor-manifest-20251015104241",
37
+ "@module-federation/runtime": "0.0.0-refactor-manifest-20251015104241"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "^18.3.11",