@module-federation/bridge-vue3 0.18.1 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @module-federation/bridge-vue3
2
2
 
3
+ ## 0.18.2
4
+
5
+ ### Patch Changes
6
+
7
+ - @module-federation/runtime@0.18.2
8
+ - @module-federation/sdk@0.18.2
9
+ - @module-federation/bridge-shared@0.18.2
10
+
3
11
  ## 0.18.1
4
12
 
5
13
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const n in o)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(o,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>o[n]})}}return t.default=o,Object.freeze(t)}const Vue__namespace=_interopNamespaceDefault(Vue),VueRouter__namespace=_interopNamespaceDefault(VueRouter);function _extends$2(){return _extends$2=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends$2.apply(this,arguments)}const MANIFEST_EXT=".json",BROWSER_LOG_KEY="FEDERATION_DEBUG",SEPARATOR=":";function isBrowserEnv(){return typeof window<"u"&&typeof window.document<"u"}function isReactNativeEnv(){var o;return typeof navigator<"u"&&((o=navigator)==null?void 0:o.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(...o){return o.length?o.reduce((t,n)=>n?t?`${t}${SEPARATOR}${n}`:n:t,""):""},getResourceUrl=(o,t)=>{if("getPublicPath"in o){let n;return o.getPublicPath.startsWith("function")?n=new Function("return "+o.getPublicPath)()():n=new Function(o.getPublicPath)(),`${n}${t}`}else return"publicPath"in o?!isBrowserEnv()&&!isReactNativeEnv()&&"ssrPublicPath"in o?`${o.ssrPublicPath}${t}`:`${o.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",o,t),"")},warn$1=o=>{console.warn(`${LOG_CATEGORY$1}: ${o}`)};function safeToString(o){try{return JSON.stringify(o,null,2)}catch{return""}}const simpleJoinRemoteEntry=(o,t)=>{if(!o)return t;const r=(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})(o);return r?r.endsWith("/")?`${r}${t}`:`${r}/${t}`:t};function inferAutoPublicPath(o){return o.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function generateSnapshotFromManifest(o,t={}){var n,r;const{remotes:s={},overrides:i={},version:l}=t;let a;const c=()=>"publicPath"in o.metaData?o.metaData.publicPath==="auto"&&l?inferAutoPublicPath(l):o.metaData.publicPath:o.metaData.getPublicPath,u=Object.keys(i);let h={};if(!Object.keys(s).length){var d;h=((d=o.remotes)==null?void 0:d.reduce((b,v)=>{let $;const A=v.federationContainerName;return u.includes(A)?$=i[A]:"version"in v?$=v.version:$=v.entry,b[A]={matchedVersion:$},b},{}))||{}}Object.keys(s).forEach(b=>h[b]={matchedVersion:u.includes(b)?i[b]:s[b]});const{remoteEntry:{path:p,name:m,type:_},types:g,buildInfo:{buildVersion:y},globalName:E,ssrRemoteEntry:I}=o.metaData,{exposes:S}=o;let R={version:l||"",buildVersion:y,globalName:E,remoteEntry:simpleJoinRemoteEntry(p,m),remoteEntryType:_,remoteTypes:simpleJoinRemoteEntry(g.path,g.name),remoteTypesZip:g.zip||"",remoteTypesAPI:g.api||"",remotesInfo:h,shared:o==null?void 0:o.shared.map(b=>({assets:b.assets,sharedName:b.name,version:b.version})),modules:S==null?void 0:S.map(b=>({moduleName:b.name,modulePath:b.path,assets:b.assets}))};if((n=o.metaData)!=null&&n.prefetchInterface){const b=o.metaData.prefetchInterface;R=_extends$2({},R,{prefetchInterface:b})}if((r=o.metaData)!=null&&r.prefetchEntry){const{path:b,name:v,type:$}=o.metaData.prefetchEntry;R=_extends$2({},R,{prefetchEntry:simpleJoinRemoteEntry(b,v),prefetchEntryType:$})}if("publicPath"in o.metaData?a=_extends$2({},R,{publicPath:c(),ssrPublicPath:o.metaData.ssrPublicPath}):a=_extends$2({},R,{getPublicPath:c()}),I){const b=simpleJoinRemoteEntry(I.path,I.name);a.ssrRemoteEntry=b,a.ssrRemoteEntryType=I.type||"commonjs-module"}return a}function isManifestProvider(o){return!!("remoteEntry"in o&&o.remoteEntry.includes(MANIFEST_EXT))}let Logger=class{setPrefix(t){this.prefix=t}log(...t){console.log(this.prefix,...t)}warn(...t){console.log(this.prefix,...t)}error(...t){console.log(this.prefix,...t)}success(...t){console.log(this.prefix,...t)}info(...t){console.log(this.prefix,...t)}ready(...t){console.log(this.prefix,...t)}debug(...t){isDebugMode()&&console.log(this.prefix,...t)}constructor(t){this.prefix=t}};function createLogger(o){return new Logger(o)}async function safeWrapper(o,t){try{return await o()}catch(n){warn$1(n);return}}function isStaticResourcesEqual(o,t){const n=/^(https?:)?\/\//i,r=o.replace(n,"").replace(/\/$/,""),s=t.replace(n,"").replace(/\/$/,"");return r===s}function createScript(o){let t=null,n=!0,r=2e4,s;const i=document.getElementsByTagName("script");for(let a=0;a<i.length;a++){const c=i[a],u=c.getAttribute("src");if(u&&isStaticResourcesEqual(u,o.url)){t=c,n=!1;break}}if(!t){const a=o.attrs;t=document.createElement("script"),t.type=(a==null?void 0:a.type)==="module"?"module":"text/javascript";let c;o.createScriptHook&&(c=o.createScriptHook(o.url,o.attrs),c instanceof HTMLScriptElement?t=c:typeof c=="object"&&("script"in c&&c.script&&(t=c.script),"timeout"in c&&c.timeout&&(r=c.timeout))),t.src||(t.src=o.url),a&&!c&&Object.keys(a).forEach(u=>{t&&(u==="async"||u==="defer"?t[u]=a[u]:t.getAttribute(u)||t.setAttribute(u,a[u]))})}const l=async(a,c)=>{clearTimeout(s);const u=()=>{(c==null?void 0:c.type)==="error"?o!=null&&o.onErrorCallback&&(o==null||o.onErrorCallback(c)):o!=null&&o.cb&&(o==null||o.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteScript:h=!0}=o;h&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),a&&typeof a=="function")){const h=a(c);if(h instanceof Promise){const d=await h;return u(),d}return u(),h}u()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),s=setTimeout(()=>{l(null,new Error(`Remote script "${o.url}" time-outed.`))},r),{script:t,needAttach:n}}function createLink(o){let t=null,n=!0;const r=document.getElementsByTagName("link");for(let i=0;i<r.length;i++){const l=r[i],a=l.getAttribute("href"),c=l.getAttribute("rel");if(a&&isStaticResourcesEqual(a,o.url)&&c===o.attrs.rel){t=l,n=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",o.url);let i;const l=o.attrs;o.createLinkHook&&(i=o.createLinkHook(o.url,l),i instanceof HTMLLinkElement&&(t=i)),l&&!i&&Object.keys(l).forEach(a=>{t&&!t.getAttribute(a)&&t.setAttribute(a,l[a])})}const s=(i,l)=>{const a=()=>{(l==null?void 0:l.type)==="error"?o!=null&&o.onErrorCallback&&(o==null||o.onErrorCallback(l)):o!=null&&o.cb&&(o==null||o.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteLink:c=!0}=o;c&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),i)){const c=i(l);return a(),c}a()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:n}}function loadScript(o,t){const{attrs:n={},createScriptHook:r}=t;return new Promise((s,i)=>{const{script:l,needAttach:a}=createScript({url:o,cb:s,onErrorCallback:i,attrs:_extends$2({fetchpriority:"high"},n),createScriptHook:r,needDeleteScript:!0});a&&document.head.appendChild(l)})}const sdkImportCache=new Map;function importNodeModule(o){if(!o)throw new Error("import specifier is required");if(sdkImportCache.has(o))return sdkImportCache.get(o);const n=new Function("name","return import(name)")(o).then(r=>r).catch(r=>{throw console.error(`Error importing module ${o}:`,r),sdkImportCache.delete(o),r});return sdkImportCache.set(o,n),n}const loadNodeFetch=async()=>{const o=await importNodeModule("node-fetch");return o.default||o},lazyLoaderHookFetch=async(o,t,n)=>{const s=await((i,l)=>n.lifecycle.fetch.emit(i,l))(o,t||{});return!s||!(s instanceof Response)?(typeof fetch>"u"?await loadNodeFetch():fetch)(o,t||{}):s},createScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(url,cb,attrs,loaderHook)=>{if(loaderHook!=null&&loaderHook.createScriptHook){const o=loaderHook.createScriptHook(url);o&&typeof o=="object"&&"url"in o&&(url=o.url)}let urlObj;try{urlObj=new URL(url)}catch(o){console.error("Error constructing URL:",o),cb(new Error(`Invalid URL: ${o}`));return}const getFetch=async()=>loaderHook!=null&&loaderHook.fetch?(o,t)=>lazyLoaderHookFetch(o,t,loaderHook):typeof fetch>"u"?loadNodeFetch():fetch,handleScriptFetch=async(f,urlObj)=>{try{var _vm_constants;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);var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;const script=new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
2
2
  })`,{filename,importModuleDynamically:(_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER=(_vm_constants=vm.constants)==null?void 0:_vm_constants.USE_MAIN_CONTEXT_DEFAULT_LOADER)!=null?_vm_constants_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 o=exportedInterface[attrs.globalName]||exportedInterface;cb(void 0,o);return}cb(void 0,exportedInterface)}catch(o){cb(o instanceof Error?o:new Error(`Script execution error: ${o}`))}};getFetch().then(async o=>{if((attrs==null?void 0:attrs.type)==="esm"||(attrs==null?void 0:attrs.type)==="module")return loadModule(urlObj.href,{fetch:o,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(o,urlObj)}).catch(o=>{cb(o)})}:(o,t,n,r)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},loadScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(o,t)=>new Promise((n,r)=>{createScriptNode(o,(s,i)=>{if(s)r(s);else{var l,a;const c=(t==null||(l=t.attrs)==null?void 0:l.globalName)||`__FEDERATION_${t==null||(a=t.attrs)==null?void 0:a.name}:custom__`,u=globalThis[c]=i;n(u)}},t.attrs,t.loaderHook)}):(o,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},esmModuleCache=new Map;async function loadModule(o,t){if(esmModuleCache.has(o))return esmModuleCache.get(o);const{fetch:n,vm:r}=t,i=await(await n(o)).text(),l=new r.SourceTextModule(i,{importModuleDynamically:async(a,c)=>{const u=new URL(a,o).href;return loadModule(u,t)}});return esmModuleCache.set(o,l),await l.link(async a=>{const c=new URL(a,o).href;return await loadModule(c,t)}),l}const LoggerInstance=createLogger("[ Module Federation Bridge Vue3 ]");function _extends$1(){return _extends$1=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends$1.apply(this,arguments)}function _object_without_properties_loose(o,t){if(o==null)return{};var n={},r=Object.keys(o),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=o[s]);return n}const 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",TYPE_001="TYPE-001",BUILD_001="BUILD-001",BUILD_002="BUILD-002",getDocsUrl=o=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${o.split("-")[0].toLowerCase()}/${o}`,getShortErrorMsg=(o,t,n,r)=>{const s=[`${[t[o]]} #${o}`];return n&&s.push(`args: ${JSON.stringify(n)}`),s.push(getDocsUrl(o)),r&&s.push(`Original Error Message:
3
3
  ${r}`),s.join(`
4
- `)};function _extends(){return _extends=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends.apply(this,arguments)}const 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."},typeDescMap={[TYPE_001]:"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."},buildDescMap={[BUILD_001]:"Failed to find expose module.",[BUILD_002]:"PublicPath is required in prod mode."};_extends({},runtimeDescMap,typeDescMap,buildDescMap);const LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(o,t){o||error(t)}function error(o){throw o instanceof Error?(o.message.startsWith(LOG_CATEGORY)||(o.message=`${LOG_CATEGORY}: ${o.message}`),o):new Error(`${LOG_CATEGORY}: ${o}`)}function warn(o){o instanceof Error&&(o.message.startsWith(LOG_CATEGORY)||(o.message=`${LOG_CATEGORY}: ${o.message}`)),logger.warn(o)}function addUniqueItem(o,t){return o.findIndex(n=>n===t)===-1&&o.push(t),o}function getFMId(o){return"version"in o&&o.version?`${o.name}:${o.version}`:"entry"in o&&o.entry?`${o.name}:${o.entry}`:`${o.name}`}function isRemoteInfoWithEntry(o){return typeof o.entry<"u"}function isPureRemoteEntry(o){return!o.entry.includes(".json")}function isObject(o){return o&&typeof o=="object"}const objectToString=Object.prototype.toString;function isPlainObject(o){return objectToString.call(o)==="[object Object]"}function arrayOptions(o){return Array.isArray(o)?o:[o]}function getRemoteEntryInfoFromSnapshot(o){const t={url:"",type:"global",globalName:""};return isBrowserEnv()||isReactNativeEnv()?"remoteEntry"in o?{url:o.remoteEntry,type:o.remoteEntryType,globalName:o.globalName}:t:"ssrRemoteEntry"in o?{url:o.ssrRemoteEntry||t.url,type:o.ssrRemoteEntryType||t.type,globalName:o.globalName}:t}const processModuleAlias=(o,t)=>{let n;return o.endsWith("/")?n=o.slice(0,-1):n=o,t.startsWith(".")&&(t=t.slice(1)),n=n+t,n},CurrentGlobal=typeof globalThis=="object"?globalThis:window,nativeGlobal=(()=>{try{return document.defaultView}catch{return CurrentGlobal}})(),Global=nativeGlobal;function definePropertyGlobalVal(o,t,n){Object.defineProperty(o,t,{value:n,configurable:!1,writable:!0})}function includeOwnProperty(o,t){return Object.hasOwnProperty.call(o,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(o){var t,n,r,s,i,l;includeOwnProperty(o,"__VMOK__")&&!includeOwnProperty(o,"__FEDERATION__")&&definePropertyGlobalVal(o,"__FEDERATION__",o.__VMOK__),includeOwnProperty(o,"__FEDERATION__")||(definePropertyGlobalVal(o,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(o,"__VMOK__",o.__FEDERATION__));var a;(a=(t=o.__FEDERATION__).__GLOBAL_PLUGIN__)!=null||(t.__GLOBAL_PLUGIN__=[]);var c;(c=(n=o.__FEDERATION__).__INSTANCES__)!=null||(n.__INSTANCES__=[]);var u;(u=(r=o.__FEDERATION__).moduleInfo)!=null||(r.moduleInfo={});var h;(h=(s=o.__FEDERATION__).__SHARE__)!=null||(s.__SHARE__={});var d;(d=(i=o.__FEDERATION__).__MANIFEST_LOADING__)!=null||(i.__MANIFEST_LOADING__={});var p;(p=(l=o.__FEDERATION__).__PRELOADED_MAP__)!=null||(l.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(o,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=o,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.18.1")}function getInfoWithoutType(o,t){if(typeof t=="string"){if(o[t])return{value:o[t],key:t};{const r=Object.keys(o);for(const s of r){const[i,l]=s.split(":"),a=`${i}:${t}`,c=o[a];if(c)return{value:c,key:a}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(o,t)=>{const n=getFMId(o),r=getInfoWithoutType(t,n).value;if(r&&!r.version&&"version"in o&&o.version&&(r.version=o.version),r)return r;if("version"in o&&o.version){const{version:s}=o,i=_object_without_properties_loose(o,["version"]),l=getFMId(i),a=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,l).value;if((a==null?void 0:a.version)===s)return a}},getGlobalSnapshotInfoByModuleInfo=o=>getTargetSnapshotInfoByModuleInfo(o,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(o,t)=>{const n=getFMId(o);return nativeGlobal.__FEDERATION__.moduleInfo[n]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=o=>(nativeGlobal.__FEDERATION__.moduleInfo=_extends$1({},nativeGlobal.__FEDERATION__.moduleInfo,o),()=>{const t=Object.keys(o);for(const n of t)delete nativeGlobal.__FEDERATION__.moduleInfo[n]}),getRemoteEntryExports=(o,t)=>{const n=t||`__FEDERATION_${o}:custom__`,r=CurrentGlobal[n];return{remoteEntryKey:n,entryExports:r}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=o=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(o),setPreloaded=o=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(o,!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(o){return new RegExp(o)}function isXVersion(o){return!o||o.toLowerCase()==="x"||o==="*"}function pipe(...o){return t=>o.reduce((n,r)=>r(n),t)}function extractComparator(o){return o.match(parseRegex(comparator))}function combineVersion(o,t,n,r){const s=`${o}.${t}.${n}`;return r?`${s}-${r}`:s}function parseHyphen(o){return o.replace(parseRegex(hyphenRange),(t,n,r,s,i,l,a,c,u,h,d,p)=>(isXVersion(r)?n="":isXVersion(s)?n=`>=${r}.0.0`:isXVersion(i)?n=`>=${r}.${s}.0`:n=`>=${n}`,isXVersion(u)?c="":isXVersion(h)?c=`<${Number(u)+1}.0.0-0`:isXVersion(d)?c=`<${u}.${Number(h)+1}.0-0`:p?c=`<=${u}.${h}.${d}-${p}`:c=`<=${c}`,`${n} ${c}`.trim()))}function parseComparatorTrim(o){return o.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(o){return o.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(o){return o.replace(parseRegex(caretTrim),"$1^")}function parseCarets(o){return o.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(n,r,s,i,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(i)?r==="0"?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.0 <${Number(r)+1}.0.0-0`:l?r==="0"?s==="0"?`>=${r}.${s}.${i}-${l} <${r}.${s}.${Number(i)+1}-0`:`>=${r}.${s}.${i}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${i}-${l} <${Number(r)+1}.0.0-0`:r==="0"?s==="0"?`>=${r}.${s}.${i} <${r}.${s}.${Number(i)+1}-0`:`>=${r}.${s}.${i} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${i} <${Number(r)+1}.0.0-0`)).join(" ")}function parseTildes(o){return o.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(n,r,s,i,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(i)?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:l?`>=${r}.${s}.${i}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${i} <${r}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(o){return o.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(n,r,s,i,l,a)=>{const c=isXVersion(s),u=c||isXVersion(i),h=u||isXVersion(l);return r==="="&&h&&(r=""),a="",c?r===">"||r==="<"?"<0.0.0-0":"*":r&&h?(u&&(i=0),l=0,r===">"?(r=">=",u?(s=Number(s)+1,i=0,l=0):(i=Number(i)+1,l=0)):r==="<="&&(r="<",u?s=Number(s)+1:i=Number(i)+1),r==="<"&&(a="-0"),`${r+s}.${i}.${l}${a}`):u?`>=${s}.0.0${a} <${Number(s)+1}.0.0-0`:h?`>=${s}.${i}.0${a} <${s}.${Number(i)+1}.0-0`:n})).join(" ")}function parseStar(o){return o.trim().replace(parseRegex(star),"")}function parseGTE0(o){return o.trim().replace(parseRegex(gte0),"")}function compareAtom(o,t){return o=Number(o)||o,t=Number(t)||t,o>t?1:o===t?0:-1}function comparePreRelease(o,t){const{preRelease:n}=o,{preRelease:r}=t;if(n===void 0&&r)return 1;if(n&&r===void 0)return-1;if(n===void 0&&r===void 0)return 0;for(let s=0,i=n.length;s<=i;s++){const l=n[s],a=r[s];if(l!==a)return l===void 0&&a===void 0?0:l?a?compareAtom(l,a):-1:1}return 0}function compareVersion(o,t){return compareAtom(o.major,t.major)||compareAtom(o.minor,t.minor)||compareAtom(o.patch,t.patch)||comparePreRelease(o,t)}function eq(o,t){return o.version===t.version}function compare(o,t){switch(o.operator){case"":case"=":return eq(o,t);case">":return compareVersion(o,t)<0;case">=":return eq(o,t)||compareVersion(o,t)<0;case"<":return compareVersion(o,t)>0;case"<=":return eq(o,t)||compareVersion(o,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(o){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(o)}function parseRange(o){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(o.trim()).split(/\s+/).join(" ")}function satisfy(o,t){if(!o)return!1;const n=extractComparator(o);if(!n)return!1;const[,r,,s,i,l,a]=n,c={operator:r,version:combineVersion(s,i,l,a),major:s,minor:i,patch:l,preRelease:a==null?void 0:a.split(".")},u=t.split("||");for(const h of u){const d=h.trim();if(!d||d==="*"||d==="x")return!0;try{const p=parseRange(d);if(!p.trim())return!0;const m=p.split(" ").map(y=>parseComparatorString(y)).join(" ");if(!m.trim())return!0;const _=m.split(/\s+/).map(y=>parseGTE0(y)).filter(Boolean);if(_.length===0)continue;let g=!0;for(const y of _){const E=extractComparator(y);if(!E){g=!1;break}const[,I,,S,R,b,v]=E,$={operator:I,version:combineVersion(S,R,b,v),major:S,minor:R,patch:b,preRelease:v==null?void 0:v.split(".")};if(!compare($,c)){g=!1;break}}if(g)return!0}catch(p){console.error(`[semver] Error processing range part "${d}":`,p);continue}}return!1}function formatShare(o,t,n,r){let s;"get"in o?s=o.get:"lib"in o?s=()=>Promise.resolve(o.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${n}'!`)});var i,l,a;return _extends$1({deps:[],useIn:[],from:t,loading:null},o,{shareConfig:_extends$1({requiredVersion:`^${o.version}`,singleton:!1,eager:!1,strictVersion:!1},o.shareConfig),get:s,loaded:o!=null&&o.loaded||"lib"in o?!0:void 0,version:(i=o.version)!=null?i:"0",scope:Array.isArray(o.scope)?o.scope:[(l=o.scope)!=null?l:"default"],strategy:((a=o.strategy)!=null?a:r)||"version-first"})}function formatShareConfigs(o,t){const n=t.shared||{},r=t.name,s=Object.keys(n).reduce((l,a)=>{const c=arrayOptions(n[a]);return l[a]=l[a]||[],c.forEach(u=>{l[a].push(formatShare(u,r,a,t.shareStrategy))}),l},{}),i=_extends$1({},o.shared);return Object.keys(s).forEach(l=>{i[l]?s[l].forEach(a=>{i[l].find(u=>u.version===a.version)||i[l].push(a)}):i[l]=s[l]}),{shared:i,shareInfos:s}}function versionLt(o,t){const n=r=>{if(!Number.isNaN(Number(r))){const i=r.split(".");let l=r;for(let a=0;a<3-i.length;a++)l+=".0";return l}return r};return!!satisfy(n(o),`<=${n(t)}`)}const findVersion=(o,t)=>{const n=t||function(r,s){return versionLt(r,s)};return Object.keys(o).reduce((r,s)=>!r||n(r,s)||r==="0"?s:r,0)},isLoaded=o=>!!o.loaded||typeof o.lib=="function",isLoading=o=>!!o.loading;function findSingletonVersionOrderByVersion(o,t,n){const r=o[t][n],s=function(i,l){return!isLoaded(r[i])&&versionLt(i,l)};return findVersion(o[t][n],s)}function findSingletonVersionOrderByLoaded(o,t,n){const r=o[t][n],s=function(i,l){const a=c=>isLoaded(c)||isLoading(c);return a(r[l])?a(r[i])?!!versionLt(i,l):!0:a(r[i])?!1:versionLt(i,l)};return findVersion(o[t][n],s)}function getFindShareFunction(o){return o==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(o,t,n,r){if(!o)return;const{shareConfig:s,scope:i=DEFAULT_SCOPE,strategy:l}=n,a=Array.isArray(i)?i:[i];for(const c of a)if(s&&o[c]&&o[c][t]){const{requiredVersion:u}=s,d=getFindShareFunction(l)(o,c,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(d,u)){const g=`Version ${d} from ${d&&o[c][t][d].from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${u})`;s.strictVersion?error(g):warn(g)}return o[c][t][d]}else{if(u===!1||u==="*"||satisfy(d,u))return o[c][t][d];for(const[g,y]of Object.entries(o[c][t]))if(satisfy(g,u))return y}},m={shareScopeMap:o,scope:c,pkgName:t,version:d,GlobalFederation:Global.__FEDERATION__,resolver:p};return(r.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(o){const{pkgName:t,extraOptions:n,shareInfos:r}=o,s=a=>{if(!a)return;const c={};a.forEach(d=>{c[d.version]=d});const h=findVersion(c,function(d,p){return!isLoaded(c[d])&&versionLt(d,p)});return c[h]};var i;const l=(i=n==null?void 0:n.resolver)!=null?i:s;return Object.assign({},l(r[t]),n==null?void 0:n.customShareInfo)}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function matchRemoteWithNameAndExpose(o,t){for(const n of o){const r=t.startsWith(n.name);let s=t.replace(n.name,"");if(r){if(s.startsWith("/")){const a=n.name;return s=`.${s}`,{pkgNameOrAlias:a,expose:s,remote:n}}else if(s==="")return{pkgNameOrAlias:n.name,expose:".",remote:n}}const i=n.alias&&t.startsWith(n.alias);let l=n.alias&&t.replace(n.alias,"");if(n.alias&&i){if(l&&l.startsWith("/")){const a=n.alias;return l=`.${l}`,{pkgNameOrAlias:a,expose:l,remote:n}}else if(l==="")return{pkgNameOrAlias:n.alias,expose:".",remote:n}}}}function matchRemote(o,t){for(const n of o)if(t===n.name||n.alias&&t===n.alias)return n}function registerPlugins(o,t){const n=getGlobalHostPlugins(),r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return n.length>0&&n.forEach(s=>{o!=null&&o.find(i=>i.name!==s.name)&&o.push(s)}),o&&o.length>0&&o.forEach(s=>{r.forEach(i=>{i.applyPlugin(s,t)})}),o}const importCallback=".then(callbacks[0]).catch(callbacks[1])";async function loadEsmEntry({entry:o,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${o}")${importCallback}`)([n,r]):import(o).then(n).catch(r)}catch(s){r(s)}})}async function loadSystemJsEntry({entry:o,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof __system_context__>"u"?System.import(o).then(n).catch(r):new Function("callbacks",`System.import("${o}")${importCallback}`)([n,r])}catch(s){r(s)}})}function handleRemoteEntryLoaded(o,t,n){const{remoteEntryKey:r,entryExports:s}=getRemoteEntryExports(o,t);return assert(s,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:o,remoteEntryUrl:n,remoteEntryKey:r})),s}async function loadEntryScript({name:o,globalName:t,entry:n,loaderHook:r}){const{entryExports:s}=getRemoteEntryExports(o,t);return s||loadScript(n,{attrs:{},createScriptHook:(i,l)=>{const a=r.lifecycle.createScript.emit({url:i,attrs:l});if(a&&(a instanceof HTMLScriptElement||"script"in a||"timeout"in a))return a}}).then(()=>handleRemoteEntryLoaded(o,t,n)).catch(i=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:o,resourceUrl:n})),i})}async function loadEntryDom({remoteInfo:o,remoteEntryExports:t,loaderHook:n}){const{entry:r,entryGlobalName:s,name:i,type:l}=o;switch(l){case"esm":case"module":return loadEsmEntry({entry:r,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:r,remoteEntryExports:t});default:return loadEntryScript({entry:r,globalName:s,name:i,loaderHook:n})}}async function loadEntryNode({remoteInfo:o,loaderHook:t}){const{entry:n,entryGlobalName:r,name:s,type:i}=o,{entryExports:l}=getRemoteEntryExports(s,r);return l||loadScriptNode(n,{attrs:{name:s,globalName:r,type:i},loaderHook:{createScriptHook:(a,c={})=>{const u=t.lifecycle.createScript.emit({url:a,attrs:c});if(u&&"url"in u)return u}}}).then(()=>handleRemoteEntryLoaded(s,r,n)).catch(a=>{throw a})}function getRemoteEntryUniqueKey(o){const{entry:t,name:n}=o;return composeKeyWithSeparator(n,t)}async function getRemoteEntry({origin:o,remoteEntryExports:t,remoteInfo:n}){const r=getRemoteEntryUniqueKey(n);if(t)return t;if(!globalLoading[r]){const s=o.remoteHandler.hooks.lifecycle.loadEntry,i=o.loaderHook;globalLoading[r]=s.emit({loaderHook:i,remoteInfo:n,remoteEntryExports:t}).then(l=>l||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":isBrowserEnv())?loadEntryDom({remoteInfo:n,remoteEntryExports:t,loaderHook:i}):loadEntryNode({remoteInfo:n,loaderHook:i})))}return globalLoading[r]}function getRemoteInfo(o){return _extends$1({},o,{entry:"entry"in o?o.entry:"",type:o.type||DEFAULT_REMOTE_TYPE,entryGlobalName:o.entryGlobalName||o.name,shareScope:o.shareScope||DEFAULT_SCOPE})}function defaultPreloadArgs(o){return _extends$1({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},o)}function formatPreloadArgs(o,t){return t.map(n=>{const r=matchRemote(o,n.nameOrAlias);return assert(r,`Unable to preload ${n.nameOrAlias} as it is not included in ${!r&&safeToString({remoteInfo:r,remotes:o})}`),{remote:r,preloadConfig:defaultPreloadArgs(n)}})}function normalizePreloadExposes(o){return o?o.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(o,t,n,r=!0){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:l}=n;if(t.options.inBrowser){if(l.forEach(a=>{const{moduleInfo:c}=a,u=t.moduleCache.get(o.name);getRemoteEntry(u?{origin:t,remoteInfo:c,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),r){const a={rel:"preload",as:"style"};s.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:a,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m}});h&&document.head.appendChild(u)})}else{const a={rel:"stylesheet",type:"text/css"};s.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:a,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m},needDeleteLink:!1});h&&document.head.appendChild(u)})}if(r){const a={rel:"preload",as:"script"};i.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:a,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m}});h&&document.head.appendChild(u)})}else{const a={fetchpriority:"high",type:(o==null?void 0:o.type)==="module"?"module":"text/javascript"};i.forEach(c=>{const{script:u,needAttach:h}=createScript({url:c,cb:()=>{},attrs:a,createScriptHook:(d,p)=>{const m=t.loaderHook.lifecycle.createScript.emit({url:d,attrs:p});if(m instanceof HTMLScriptElement)return m},needDeleteScript:!0});h&&document.head.appendChild(u)})}}}let Module=class{async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let t;try{t=await getRemoteEntry({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports})}catch{const r=getRemoteEntryUniqueKey(this.remoteInfo);t=await this.host.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry,origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,globalLoading,uniqueKey:r})}return assert(t,`remoteEntryExports is undefined
5
- ${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,n,r,s){const{loadFactory:i=!0}=r||{loadFactory:!0},l=await this.getEntry();if(!this.inited){const d=this.host.shareScopeMap,p=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];p.length||p.push("default"),p.forEach(E=>{d[E]||(d[E]={})});const m=d[p[0]],_=[],g={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?p:this.remoteInfo.shareScope||"default"};Object.defineProperty(g,"shareScopeMap",{value:d,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:g,initScope:_,remoteInfo:this.remoteInfo,origin:this.host});typeof(l==null?void 0:l.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await l.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$1({},y,{id:t,remoteSnapshot:s,remoteEntryExports:l}))}this.lib=l,this.inited=!0;let a;a=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:l,expose:n,moduleInfo:this.remoteInfo}),a||(a=await l.get(n)),assert(a,`${getFMId(this.remoteInfo)} remote don't export ${n}.`);const c=processModuleAlias(this.remoteInfo.name,n),u=this.wraperFactory(a,c);return i?await u():u}wraperFactory(t,n){function r(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 r(s,n),s}:()=>{const s=t();return r(s,n),s}}constructor({remoteInfo:t,host:n}){this.inited=!1,this.lib=void 0,this.remoteInfo=t,this.host=n}};class SyncHook{on(t){typeof t=="function"&&this.listeners.add(t)}once(t){const n=this;this.on(function r(...s){return n.remove(r),t.apply(null,s)})}emit(...t){let n;return this.listeners.size>0&&this.listeners.forEach(r=>{n=r(...t)}),n}remove(t){this.listeners.delete(t)}removeAll(){this.listeners.clear()}constructor(t){this.type="",this.listeners=new Set,t&&(this.type=t)}}class AsyncHook extends SyncHook{emit(...t){let n;const r=Array.from(this.listeners);if(r.length>0){let s=0;const i=l=>l===!1?!1:s<r.length?Promise.resolve(r[s++].apply(null,t)).then(i):l;n=i()}return Promise.resolve(n)}}function checkReturnData(o,t){if(!isObject(t))return!1;if(o!==t){for(const n in o)if(!(n in t))return!1}return!0}class SyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The data for the "${this.type}" hook should be an object.`);for(const n of this.listeners)try{const r=n(t);if(checkReturnData(t,r))t=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){warn(r),this.onerror(r)}return t}constructor(t){super(),this.onerror=error,this.type=t}}class AsyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The response data for the "${this.type}" hook must be an object.`);const n=Array.from(this.listeners);if(n.length>0){let r=0;const s=l=>(warn(l),this.onerror(l),t),i=l=>{if(checkReturnData(t,l)){if(t=l,r<n.length)try{return Promise.resolve(n[r++](t)).then(i,s)}catch(a){return s(a)}}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)}constructor(t){super(),this.onerror=error,this.type=t}}class PluginSystem{applyPlugin(t,n){assert(isPlainObject(t),"Plugin configuration is invalid.");const r=t.name;assert(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=t,t.apply==null||t.apply.call(t,n),Object.keys(this.lifecycle).forEach(s=>{const i=t[s];i&&this.lifecycle[s].on(i)}))}removePlugin(t){assert(t,"A name is required.");const n=this.registerPlugins[t];assert(n,`The plugin "${t}" is not registered.`),Object.keys(n).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(n[r])})}constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}}function assignRemoteInfo(o,t){const n=getRemoteEntryInfoFromSnapshot(t);n.url||error(`The attribute remoteEntry of ${o.name} must not be undefined.`);let r=getResourceUrl(t,n.url);!isBrowserEnv()&&!r.startsWith("http")&&(r=`https:${r}`),o.type=n.type,o.entryGlobalName=n.globalName,o.entry=r,o.version=t.version,o.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(o){const{remote:t,pkgNameOrAlias:n,expose:r,origin:s,remoteInfo:i,id:l}=o;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:a,globalSnapshot:c}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:l});assignRemoteInfo(i,a);const u={remote:t,preloadConfig:{nameOrAlias:n,exposes:[r],resourceCategory:"sync",share:!1,depsRemote:!1}},h=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:u,remoteInfo:i,remote:t,remoteSnapshot:a,globalSnapshot:c});return h&&preloadAssets(i,s,h,!1),_extends$1({},o,{remoteSnapshot:a})}return o}}}function splitId(o){const t=o.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(o,t,n,r,s={},i){const l=getFMId(t),{value:a}=getInfoWithoutType(o,l),c=i||a;if(c&&!isManifestProvider(c)&&(n(c,t,r),c.remotesInfo)){const u=Object.keys(c.remotesInfo);for(const h of u){if(s[h])continue;s[h]=!0;const d=splitId(h),p=c.remotesInfo[h];traverseModuleInfo(o,{name:d.name,version:p.matchedVersion},n,!1,s,void 0)}}}const isExisted=(o,t)=>document.querySelector(`${o}[${o==="link"?"href":"src"}="${t}"]`);function generatePreloadAssets(o,t,n,r,s){const i=[],l=[],a=[],c=new Set,u=new Set,{options:h}=o,{preloadConfig:d}=t,{depsRemote:p}=d;if(traverseModuleInfo(r,n,(y,E,I)=>{let S;if(I)S=d;else if(Array.isArray(p)){const N=p.find(T=>T.nameOrAlias===E.name||T.nameOrAlias===E.alias);if(!N)return;S=defaultPreloadArgs(N)}else if(p===!0)S=d;else return;const R=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);R&&a.push({name:E.name,moduleInfo:{name:E.name,entry:R,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:E.name,shareScope:"",version:"version"in y?y.version:void 0},url:R});let b="modules"in y?y.modules:[];const v=normalizePreloadExposes(S.exposes);if(v.length&&"modules"in y){var $;b=y==null||($=y.modules)==null?void 0:$.reduce((N,T)=>((v==null?void 0:v.indexOf(T.moduleName))!==-1&&N.push(T),N),[])}function A(N){const T=N.map(O=>getResourceUrl(y,O));return S.filter?T.filter(S.filter):T}if(b){const N=b.length;for(let T=0;T<N;T++){const O=b[T],w=`${E.name}/${O.moduleName}`;o.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:O.moduleName==="."?E.name:w,name:E.name,remoteSnapshot:y,preloadConfig:S,remote:E,origin:o}),!getPreloaded(w)&&(S.resourceCategory==="all"?(i.push(...A(O.assets.css.async)),i.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.async)),l.push(...A(O.assets.js.sync))):(S.resourceCategory="sync")&&(i.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.sync))),setPreloaded(w))}}},!0,{},s),s.shared&&s.shared.length>0){const y=(E,I)=>{const S=getRegisteredShare(o.shareScopeMap,I.sharedName,E,o.sharedHandler.hooks.lifecycle.resolveShare);S&&typeof S.lib=="function"&&(I.assets.js.sync.forEach(R=>{c.add(R)}),I.assets.css.sync.forEach(R=>{u.add(R)}))};s.shared.forEach(E=>{var I;const S=(I=h.shared)==null?void 0:I[E.sharedName];if(!S)return;const R=E.version?S.find(v=>v.version===E.version):S;if(!R)return;arrayOptions(R).forEach(v=>{y(v,E)})})}const _=l.filter(y=>!c.has(y)&&!isExisted("script",y));return{cssAssets:i.filter(y=>!u.has(y)&&!isExisted("link",y)),jsAssetsWithoutEntry:_,entryAssets:a.filter(y=>!isExisted("script",y.url))}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(o){const{origin:t,preloadOptions:n,remoteInfo:r,remote:s,globalSnapshot:i,remoteSnapshot:l}=o;return isBrowserEnv()?isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:r.name,entry:s.entry,type:r.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(r,l),generatePreloadAssets(t,n,r,i,l)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function getGlobalRemoteInfo(o,t){const n=getGlobalSnapshotInfoByModuleInfo({name:t.name,version:t.options.version}),r=n&&"remotesInfo"in n&&n.remotesInfo&&getInfoWithoutType(n.remotesInfo,o.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:n,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:o.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:o.name,version:"version"in o?o.version:void 0})}}class SnapshotHandler{async loadRemoteSnapshotInfo({moduleInfo:t,id:n,expose:r}){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=_extends$1({},i==null?void 0:i.remotesInfo,{[t.name]:{matchedVersion:"version"in t?t.version:t.entry}}));const{hostGlobalSnapshot:l,remoteSnapshot:a,globalSnapshot:c}=this.getGlobalRemoteInfo(t),{remoteSnapshot:u,globalSnapshot:h}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:l,remoteSnapshot:a,globalSnapshot:c});let d,p;if(u)if(isManifestProvider(u)){const m=isBrowserEnv()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",_=await this.getManifestJson(m,t,{}),g=setGlobalSnapshotInfoByModuleInfo(_extends$1({},t,{entry:m}),_);d=_,p=g}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:u,from:"global"});d=m,p=h}else if(isRemoteInfoWithEntry(t)){const m=await this.getManifestJson(t.entry,t,{}),_=setGlobalSnapshotInfoByModuleInfo(t,m),{remoteSnapshot:g}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:m,from:"global"});d=g,p=_}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(h)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:n,host:this.HostInstance,options:s,moduleInfo:t,remoteSnapshot:d}),{remoteSnapshot:d,globalSnapshot:p}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,n,r){const s=async()=>{let l=this.manifestCache.get(t);if(l)return l;try{let a=await this.loaderHook.lifecycle.fetch.emit(t,{});(!a||!(a instanceof Response))&&(a=await fetch(t,{})),l=await a.json()}catch(a){l=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:a,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),l||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:n.name,hostName:this.HostInstance.options.name},`${a}`)))}return assert(l.metaData&&l.exposes&&l.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,l),l},i=async()=>{const l=await s(),a=generateSnapshotFromManifest(l,{version:t}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:n,manifestJson:l,remoteSnapshot:a,manifestUrl:t,from:"manifest"});return c};return this.manifestLoading[t]||(this.manifestLoading[t]=i().then(l=>l)),this.manifestLoading[t]}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}}class SharedHandler{registerShared(t,n){const{shareInfos:r,shared:s}=formatShareConfigs(t,n);return Object.keys(r).forEach(l=>{r[l].forEach(c=>{!getRegisteredShare(this.shareScopeMap,l,c,this.hooks.lifecycle.resolveShare)&&c&&c.lib&&this.setShared({pkgName:l,lib:c.lib,get:c.get,loaded:!0,shared:c,from:n.name})})}),{shareInfos:r,shared:s}}async loadShare(t,n){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:r.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:r.options.shared,origin:r}),{shareInfo:l}=i;assert(l,`Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);const a=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare),c=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,r.options.name)};if(a&&a.lib)return c(a),a.lib;if(a&&a.loading&&!a.loaded){const u=await a.loading;return a.loaded=!0,a.lib||(a.lib=u),c(a),u}else if(a){const h=(async()=>{const d=await a.get();l.lib=d,l.loaded=!0,c(l);const p=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare);return p&&(p.lib=d,p.loaded=!0,c(p)),d})();return this.setShared({pkgName:t,loaded:!1,shared:a,from:r.options.name,lib:null,loading:h}),h}else{if(n!=null&&n.customShareInfo)return!1;const h=(async()=>{const d=await l.get();l.lib=d,l.loaded=!0,c(l);const p=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare);return p&&(p.lib=d,p.loaded=!0),d})();return this.setShared({pkgName:t,loaded:!1,shared:l,from:r.options.name,lib:null,loading:h}),h}}initializeSharing(t=DEFAULT_SCOPE,n){const{host:r}=this,s=n==null?void 0:n.from,i=n==null?void 0:n.strategy;let l=n==null?void 0:n.initScope;const a=[];if(s!=="build"){const{initTokens:_}=this;l||(l=[]);let g=_[t];if(g||(g=_[t]={from:this.host.name}),l.indexOf(g)>=0)return a;l.push(g)}const c=this.shareScopeMap,u=r.options.name;c[t]||(c[t]={});const h=c[t],d=(_,g)=>{var y;const{version:E,eager:I}=g;h[_]=h[_]||{};const S=h[_],R=S[E],b=!!(R&&(R.eager||(y=R.shareConfig)!=null&&y.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!I!=!b?I:u>R.from))&&(S[E]=g)},p=_=>_&&_.init&&_.init(c[t],l),m=async _=>{const{module:g}=await r.remoteHandler.getRemoteModuleAndOptions({id:_});if(g.getEntry){let y;try{y=await g.getEntry()}catch(E){y=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:_,error:E,from:"runtime",lifecycle:"beforeLoadShare",origin:r})}g.inited||(await p(y),g.inited=!0)}};return Object.keys(r.options.shared).forEach(_=>{r.options.shared[_].forEach(y=>{y.scope.includes(t)&&d(_,y)})}),(r.options.shareStrategy==="version-first"||i==="version-first")&&r.options.remotes.forEach(_=>{_.shareScope===t&&a.push(m(_.name))}),a}loadShareSync(t,n){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:r.options.shared});s!=null&&s.scope&&s.scope.forEach(a=>{this.initializeSharing(a,{strategy:s.strategy})});const i=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),l=a=>{a.useIn||(a.useIn=[]),addUniqueItem(a.useIn,r.options.name)};if(i){if(typeof i.lib=="function")return l(i),i.loaded||(i.loaded=!0,i.from===r.options.name&&(s.loaded=!0)),i.lib;if(typeof i.get=="function"){const a=i.get();if(!(a instanceof Promise))return l(i),this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:a,shared:i}),a}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const a=s.get();if(a instanceof Promise){const c=(n==null?void 0:n.from)==="build"?RUNTIME_005:RUNTIME_006;throw new Error(getShortErrorMsg(c,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}return s.lib=a,this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}initShareScopeMap(t,n,r={}){const{host:s}=this;this.shareScopeMap[t]=n,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:n,options:s.options,origin:s,scopeName:t,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:t,shared:n,from:r,lib:s,loading:i,loaded:l,get:a}){const{version:c,scope:u="default"}=n,h=_object_without_properties_loose(n,["version","scope"]);(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][c]){this.shareScopeMap[p][t][c]=_extends$1({version:c,scope:["default"]},h,{lib:s,loaded:l,loading:i}),a&&(this.shareScopeMap[p][t][c].get=a);return}const m=this.shareScopeMap[p][t][c];i&&!m.loading&&(m.loading=i)})}_setGlobalShareScopeMap(t){const n=getGlobalShareScope(),r=t.id||t.name;r&&!n[r]&&(n[r]=this.shareScopeMap)}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)}}class RemoteHandler{formatAndRegisterRemote(t,n){return(n.remotes||[]).reduce((s,i)=>(this.registerRemote(i,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,n){const{remote:r,expose:s}=n,{name:i,alias:l}=r;if(this.idToRemoteMap[t]={name:r.name,expose:s},l&&t.startsWith(i)){const a=t.replace(i,l);this.idToRemoteMap[a]={name:r.name,expose:s};return}if(l&&t.startsWith(l)){const a=t.replace(l,i);this.idToRemoteMap[a]={name:r.name,expose:s}}}async loadRemote(t,n){const{host:r}=this;try{const{loadFactory:s=!0}=n||{loadFactory:!0},{module:i,moduleOptions:l,remoteMatchInfo:a}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:c,remote:u,expose:h,id:d,remoteSnapshot:p}=a,m=await i.get(d,h,n,p),_=await this.hooks.lifecycle.onLoad.emit({id:d,pkgNameOrAlias:c,expose:h,exposeModule:s?m:void 0,exposeModuleFactory:s?void 0:m,remote:u,options:l,moduleInstance:i,origin:r});return this.setIdToRemoteMap(t,a),typeof _=="function"?_:m}catch(s){const{from:i="runtime"}=n||{from:"runtime"},l=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:i,lifecycle:"onLoad",origin:r});if(!l)throw s;return l}}async preloadRemote(t){const{host:n}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:n.options,origin:n});const r=formatPreloadArgs(n.options.remotes,t);await Promise.all(r.map(async s=>{const{remote:i}=s,l=getRemoteInfo(i),{globalSnapshot:a,remoteSnapshot:c}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i}),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:s,remote:i,remoteInfo:l,globalSnapshot:a,remoteSnapshot:c});u&&preloadAssets(l,n,u)}))}registerRemotes(t,n){const{host:r}=this;t.forEach(s=>{this.registerRemote(s,r.options.remotes,{force:n==null?void 0:n.force})})}async getRemoteModuleAndOptions(t){const{host:n}=this,{id:r}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:n.options,origin:n})}catch(_){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:n.options,origin:n,from:"runtime",error:_,lifecycle:"beforeRequest"}),!s)throw _}const{id:i}=s,l=matchRemoteWithNameAndExpose(n.options.remotes,i);assert(l,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:n.options.name,requestId:i}));const{remote:a}=l,c=getRemoteInfo(a),u=await n.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({id:i},l,{options:n.options,origin:n,remoteInfo:c})),{remote:h,expose:d}=u;assert(h&&d,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);let p=n.moduleCache.get(h.name);const m={host:n,remoteInfo:c};return p||(p=new Module(m),n.moduleCache.set(h.name,p)),{module:p,moduleOptions:m,remoteMatchInfo:u}}registerRemote(t,n,r){const{host:s}=this,i=()=>{if(t.alias){const a=n.find(c=>{var u;return t.alias&&(c.name.startsWith(t.alias)||((u=c.alias)==null?void 0:u.startsWith(t.alias)))});assert(!a,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${a&&a.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 l=n.find(a=>a.name===t.name);if(!l)i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const a=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(l),i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(a.join(" ")))}}removeRemote(t){try{const{host:r}=this,{name:s}=t,i=r.options.remotes.findIndex(a=>a.name===s);i!==-1&&r.options.remotes.splice(i,1);const l=r.moduleCache.get(t.name);if(l){const a=l.remoteInfo,c=a.entryGlobalName;if(CurrentGlobal[c]){var n;(n=Object.getOwnPropertyDescriptor(CurrentGlobal,c))!=null&&n.configurable?delete CurrentGlobal[c]:CurrentGlobal[c]=void 0}const u=getRemoteEntryUniqueKey(l.remoteInfo);globalLoading[u]&&delete globalLoading[u],r.snapshotHandler.manifestCache.delete(a.entry);let h=a.buildVersion?composeKeyWithSeparator(a.name,a.buildVersion):a.name;const d=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(m=>a.buildVersion?m.options.id===h:m.name===h);if(d!==-1){const m=CurrentGlobal.__FEDERATION__.__INSTANCES__[d];h=m.options.id||h;const _=getGlobalShareScope();let g=!0;const y=[];Object.keys(_).forEach(E=>{const I=_[E];I&&Object.keys(I).forEach(S=>{const R=I[S];R&&Object.keys(R).forEach(b=>{const v=R[b];v&&Object.keys(v).forEach($=>{const A=v[$];A&&typeof A=="object"&&A.from===a.name&&(A.loaded||A.loading?(A.useIn=A.useIn.filter(N=>N!==a.name),A.useIn.length?g=!1:y.push([E,S,b,$])):y.push([E,S,b,$]))})})})}),g&&(m.shareScopeMap={},delete _[h]),y.forEach(([E,I,S,R])=>{var b,v,$;($=_[E])==null||(v=$[I])==null||(b=v[S])==null||delete b[R]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(d,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,r);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])}r.moduleCache.delete(t.name)}}catch(r){logger.log("removeRemote fail: ",r)}}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={}}}const USE_SNAPSHOT=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;class ModuleFederation{initOptions(t){this.registerPlugins(t.plugins);const n=this.formatOptions(this.options,t);return this.options=n,n}async loadShare(t,n){return this.sharedHandler.loadShare(t,n)}loadShareSync(t,n){return this.sharedHandler.loadShareSync(t,n)}initializeSharing(t=DEFAULT_SCOPE,n){return this.sharedHandler.initializeSharing(t,n)}initRawContainer(t,n,r){const s=getRemoteInfo({name:t,entry:n}),i=new Module({host:this,remoteInfo:s});return i.remoteEntryExports=r,this.moduleCache.set(t,i),i}async loadRemote(t,n){return this.remoteHandler.loadRemote(t,n)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,n,r={}){this.sharedHandler.initShareScopeMap(t,n,r)}formatOptions(t,n){const{shared:r}=formatShareConfigs(t,n),{userOptions:s,options:i}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:n,options:t,shareInfo:r}),l=this.remoteHandler.formatAndRegisterRemote(i,s),{shared:a}=this.sharedHandler.registerShared(i,s),c=[...i.plugins];s.plugins&&s.plugins.forEach(h=>{c.includes(h)||c.push(h)});const u=_extends$1({},t,n,{plugins:c,remotes:l,shared:a});return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const n=registerPlugins(t,this);this.options.plugins=this.options.plugins.reduce((r,s)=>(s&&r&&!r.find(i=>i.name===s.name)&&r.push(s),r),n||[])}registerRemotes(t,n){return this.remoteHandler.registerRemotes(t,n)}registerShared(t){this.sharedHandler.registerShared(this.options,_extends$1({},this.options,{shared:t}))}constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.18.1",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 n=USE_SNAPSHOT?[snapshotPlugin(),generatePreloadAssetsPlugin()]:[],r={id:getBuilderId(),name:t.name,plugins:n,remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=r,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...t.plugins||[]]),this.options=this.formatOptions(r,t)}}let FederationInstance=null;function getInstance(){return FederationInstance}setGlobalFederationConstructor(ModuleFederation);function createBridgeComponent(o){const t=new Map,n=getInstance();return()=>({__APP_VERSION__:"0.18.1",async render(r){var _,g,y;LoggerInstance.debug("createBridgeComponent render Info",r);const{moduleName:s,dom:i,basename:l,memoryRoute:a,hashRoute:c,...u}=r,h=Vue__namespace.createApp(o.rootComponent,u);t.set(i,h);const d=await((y=(g=(_=n==null?void 0:n.bridgeHook)==null?void 0:_.lifecycle)==null?void 0:g.beforeBridgeRender)==null?void 0:y.emit(r)),p=d&&typeof d=="object"&&(d!=null&&d.extraProps)?d==null?void 0:d.extraProps:{},m=o.appOptions({app:h,basename:l,memoryRoute:a,hashRoute:c,...u,...p});if(m!=null&&m.router){let E,I=m.router.getRoutes();r.memoryRoute?E=VueRouter__namespace.createMemoryHistory(r.basename):r.hashRoute?(E=VueRouter__namespace.createWebHashHistory(),I=I.map(R=>({...R,path:r.basename+R.path}))):E=VueRouter__namespace.createWebHistory(r.basename);const S=VueRouter__namespace.createRouter({...m.router.options,history:E,routes:I});LoggerInstance.debug("createBridgeComponent render router info>>>",{moduleName:s,router:S}),a&&await S.push(a.entryPath),h.use(S)}h.mount(i)},destroy(r){LoggerInstance.debug("createBridgeComponent destroy Info",r);const s=t.get(r==null?void 0:r.dom);s==null||s.unmount()}})}function e(){const o=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(o)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(o){const t=Vue.ref(null),n=Vue.ref(null),r=Vue.ref(""),s=VueRouter.useRoute(),i=getInstance(),l=Vue.useAttrs(),a=async()=>{var p,m,_,g;const u=(p=o.providerInfo)==null?void 0:p.call(o);n.value=u;let h={...l,moduleName:o.moduleName,dom:t.value,basename:o.basename,memoryRoute:o.memoryRoute,hashRoute:o.hashRoute};LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",h);const d=await((g=(_=(m=i==null?void 0:i.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:_.beforeBridgeRender)==null?void 0:g.emit(h))||{};h={...h,...d.extraProps},u.render(h)},c=Vue.watch(()=>s==null?void 0:s.path,u=>{u!==s.path&&a(),r.value!==""&&r.value!==u&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...o,pathname:s.path}),e()),r.value=u});return Vue.onMounted(()=>{a()}),Vue.onBeforeUnmount(()=>{var u;LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>",{...o}),c(),(u=n.value)==null||u.destroy({dom:t.value})}),()=>Vue.createVNode("div",Vue.mergeProps(o.rootAttrs||{},{ref:t}),null)}});function createRemoteAppComponent(o){return Vue.defineAsyncComponent({__APP_VERSION__:"0.18.1",...o.asyncComponentOptions,loader:async()=>{var c,u;const t=VueRouter.useRoute();let n="/";const r=(u=(c=t==null?void 0:t.matched)==null?void 0:c[0])==null?void 0:u.path;r&&(r.endsWith("/:pathMatch(.*)*")?n=r.replace("/:pathMatch(.*)*",""):n=t.matched[0].path);const s=(o==null?void 0:o.export)||"default";LoggerInstance.debug("createRemoteAppComponent LazyComponent create >>>",{basename:n,info:o});const i=await o.loader(),l=i&&i[Symbol.for("mf_module_id")],a=i[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:l,module:i,exportName:s,basename:n,route:t}),s in i&&typeof a=="function")return{render(){return Vue.h(RemoteApp,{moduleName:l,providerInfo:a,basename:n,rootAttrs:o.rootAttrs})}};throw new Error("module not found")}})}function createRemoteComponent(o){return LoggerInstance.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),createRemoteAppComponent(o)}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteAppComponent=createRemoteAppComponent;exports.createRemoteComponent=createRemoteComponent;
4
+ `)};function _extends(){return _extends=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends.apply(this,arguments)}const 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."},typeDescMap={[TYPE_001]:"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."},buildDescMap={[BUILD_001]:"Failed to find expose module.",[BUILD_002]:"PublicPath is required in prod mode."};_extends({},runtimeDescMap,typeDescMap,buildDescMap);const LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(o,t){o||error(t)}function error(o){throw o instanceof Error?(o.message.startsWith(LOG_CATEGORY)||(o.message=`${LOG_CATEGORY}: ${o.message}`),o):new Error(`${LOG_CATEGORY}: ${o}`)}function warn(o){o instanceof Error&&(o.message.startsWith(LOG_CATEGORY)||(o.message=`${LOG_CATEGORY}: ${o.message}`)),logger.warn(o)}function addUniqueItem(o,t){return o.findIndex(n=>n===t)===-1&&o.push(t),o}function getFMId(o){return"version"in o&&o.version?`${o.name}:${o.version}`:"entry"in o&&o.entry?`${o.name}:${o.entry}`:`${o.name}`}function isRemoteInfoWithEntry(o){return typeof o.entry<"u"}function isPureRemoteEntry(o){return!o.entry.includes(".json")}function isObject(o){return o&&typeof o=="object"}const objectToString=Object.prototype.toString;function isPlainObject(o){return objectToString.call(o)==="[object Object]"}function arrayOptions(o){return Array.isArray(o)?o:[o]}function getRemoteEntryInfoFromSnapshot(o){const t={url:"",type:"global",globalName:""};return isBrowserEnv()||isReactNativeEnv()?"remoteEntry"in o?{url:o.remoteEntry,type:o.remoteEntryType,globalName:o.globalName}:t:"ssrRemoteEntry"in o?{url:o.ssrRemoteEntry||t.url,type:o.ssrRemoteEntryType||t.type,globalName:o.globalName}:t}const processModuleAlias=(o,t)=>{let n;return o.endsWith("/")?n=o.slice(0,-1):n=o,t.startsWith(".")&&(t=t.slice(1)),n=n+t,n},CurrentGlobal=typeof globalThis=="object"?globalThis:window,nativeGlobal=(()=>{try{return document.defaultView}catch{return CurrentGlobal}})(),Global=nativeGlobal;function definePropertyGlobalVal(o,t,n){Object.defineProperty(o,t,{value:n,configurable:!1,writable:!0})}function includeOwnProperty(o,t){return Object.hasOwnProperty.call(o,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(o){var t,n,r,s,i,l;includeOwnProperty(o,"__VMOK__")&&!includeOwnProperty(o,"__FEDERATION__")&&definePropertyGlobalVal(o,"__FEDERATION__",o.__VMOK__),includeOwnProperty(o,"__FEDERATION__")||(definePropertyGlobalVal(o,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(o,"__VMOK__",o.__FEDERATION__));var a;(a=(t=o.__FEDERATION__).__GLOBAL_PLUGIN__)!=null||(t.__GLOBAL_PLUGIN__=[]);var c;(c=(n=o.__FEDERATION__).__INSTANCES__)!=null||(n.__INSTANCES__=[]);var u;(u=(r=o.__FEDERATION__).moduleInfo)!=null||(r.moduleInfo={});var h;(h=(s=o.__FEDERATION__).__SHARE__)!=null||(s.__SHARE__={});var d;(d=(i=o.__FEDERATION__).__MANIFEST_LOADING__)!=null||(i.__MANIFEST_LOADING__={});var p;(p=(l=o.__FEDERATION__).__PRELOADED_MAP__)!=null||(l.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(o,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=o,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.18.2")}function getInfoWithoutType(o,t){if(typeof t=="string"){if(o[t])return{value:o[t],key:t};{const r=Object.keys(o);for(const s of r){const[i,l]=s.split(":"),a=`${i}:${t}`,c=o[a];if(c)return{value:c,key:a}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(o,t)=>{const n=getFMId(o),r=getInfoWithoutType(t,n).value;if(r&&!r.version&&"version"in o&&o.version&&(r.version=o.version),r)return r;if("version"in o&&o.version){const{version:s}=o,i=_object_without_properties_loose(o,["version"]),l=getFMId(i),a=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,l).value;if((a==null?void 0:a.version)===s)return a}},getGlobalSnapshotInfoByModuleInfo=o=>getTargetSnapshotInfoByModuleInfo(o,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(o,t)=>{const n=getFMId(o);return nativeGlobal.__FEDERATION__.moduleInfo[n]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=o=>(nativeGlobal.__FEDERATION__.moduleInfo=_extends$1({},nativeGlobal.__FEDERATION__.moduleInfo,o),()=>{const t=Object.keys(o);for(const n of t)delete nativeGlobal.__FEDERATION__.moduleInfo[n]}),getRemoteEntryExports=(o,t)=>{const n=t||`__FEDERATION_${o}:custom__`,r=CurrentGlobal[n];return{remoteEntryKey:n,entryExports:r}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=o=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(o),setPreloaded=o=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(o,!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(o){return new RegExp(o)}function isXVersion(o){return!o||o.toLowerCase()==="x"||o==="*"}function pipe(...o){return t=>o.reduce((n,r)=>r(n),t)}function extractComparator(o){return o.match(parseRegex(comparator))}function combineVersion(o,t,n,r){const s=`${o}.${t}.${n}`;return r?`${s}-${r}`:s}function parseHyphen(o){return o.replace(parseRegex(hyphenRange),(t,n,r,s,i,l,a,c,u,h,d,p)=>(isXVersion(r)?n="":isXVersion(s)?n=`>=${r}.0.0`:isXVersion(i)?n=`>=${r}.${s}.0`:n=`>=${n}`,isXVersion(u)?c="":isXVersion(h)?c=`<${Number(u)+1}.0.0-0`:isXVersion(d)?c=`<${u}.${Number(h)+1}.0-0`:p?c=`<=${u}.${h}.${d}-${p}`:c=`<=${c}`,`${n} ${c}`.trim()))}function parseComparatorTrim(o){return o.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(o){return o.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(o){return o.replace(parseRegex(caretTrim),"$1^")}function parseCarets(o){return o.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(n,r,s,i,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(i)?r==="0"?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.0 <${Number(r)+1}.0.0-0`:l?r==="0"?s==="0"?`>=${r}.${s}.${i}-${l} <${r}.${s}.${Number(i)+1}-0`:`>=${r}.${s}.${i}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${i}-${l} <${Number(r)+1}.0.0-0`:r==="0"?s==="0"?`>=${r}.${s}.${i} <${r}.${s}.${Number(i)+1}-0`:`>=${r}.${s}.${i} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${i} <${Number(r)+1}.0.0-0`)).join(" ")}function parseTildes(o){return o.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(n,r,s,i,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(i)?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:l?`>=${r}.${s}.${i}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${i} <${r}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(o){return o.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(n,r,s,i,l,a)=>{const c=isXVersion(s),u=c||isXVersion(i),h=u||isXVersion(l);return r==="="&&h&&(r=""),a="",c?r===">"||r==="<"?"<0.0.0-0":"*":r&&h?(u&&(i=0),l=0,r===">"?(r=">=",u?(s=Number(s)+1,i=0,l=0):(i=Number(i)+1,l=0)):r==="<="&&(r="<",u?s=Number(s)+1:i=Number(i)+1),r==="<"&&(a="-0"),`${r+s}.${i}.${l}${a}`):u?`>=${s}.0.0${a} <${Number(s)+1}.0.0-0`:h?`>=${s}.${i}.0${a} <${s}.${Number(i)+1}.0-0`:n})).join(" ")}function parseStar(o){return o.trim().replace(parseRegex(star),"")}function parseGTE0(o){return o.trim().replace(parseRegex(gte0),"")}function compareAtom(o,t){return o=Number(o)||o,t=Number(t)||t,o>t?1:o===t?0:-1}function comparePreRelease(o,t){const{preRelease:n}=o,{preRelease:r}=t;if(n===void 0&&r)return 1;if(n&&r===void 0)return-1;if(n===void 0&&r===void 0)return 0;for(let s=0,i=n.length;s<=i;s++){const l=n[s],a=r[s];if(l!==a)return l===void 0&&a===void 0?0:l?a?compareAtom(l,a):-1:1}return 0}function compareVersion(o,t){return compareAtom(o.major,t.major)||compareAtom(o.minor,t.minor)||compareAtom(o.patch,t.patch)||comparePreRelease(o,t)}function eq(o,t){return o.version===t.version}function compare(o,t){switch(o.operator){case"":case"=":return eq(o,t);case">":return compareVersion(o,t)<0;case">=":return eq(o,t)||compareVersion(o,t)<0;case"<":return compareVersion(o,t)>0;case"<=":return eq(o,t)||compareVersion(o,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(o){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(o)}function parseRange(o){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(o.trim()).split(/\s+/).join(" ")}function satisfy(o,t){if(!o)return!1;const n=extractComparator(o);if(!n)return!1;const[,r,,s,i,l,a]=n,c={operator:r,version:combineVersion(s,i,l,a),major:s,minor:i,patch:l,preRelease:a==null?void 0:a.split(".")},u=t.split("||");for(const h of u){const d=h.trim();if(!d||d==="*"||d==="x")return!0;try{const p=parseRange(d);if(!p.trim())return!0;const m=p.split(" ").map(y=>parseComparatorString(y)).join(" ");if(!m.trim())return!0;const _=m.split(/\s+/).map(y=>parseGTE0(y)).filter(Boolean);if(_.length===0)continue;let g=!0;for(const y of _){const E=extractComparator(y);if(!E){g=!1;break}const[,I,,S,R,b,v]=E,$={operator:I,version:combineVersion(S,R,b,v),major:S,minor:R,patch:b,preRelease:v==null?void 0:v.split(".")};if(!compare($,c)){g=!1;break}}if(g)return!0}catch(p){console.error(`[semver] Error processing range part "${d}":`,p);continue}}return!1}function formatShare(o,t,n,r){let s;"get"in o?s=o.get:"lib"in o?s=()=>Promise.resolve(o.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${n}'!`)});var i,l,a;return _extends$1({deps:[],useIn:[],from:t,loading:null},o,{shareConfig:_extends$1({requiredVersion:`^${o.version}`,singleton:!1,eager:!1,strictVersion:!1},o.shareConfig),get:s,loaded:o!=null&&o.loaded||"lib"in o?!0:void 0,version:(i=o.version)!=null?i:"0",scope:Array.isArray(o.scope)?o.scope:[(l=o.scope)!=null?l:"default"],strategy:((a=o.strategy)!=null?a:r)||"version-first"})}function formatShareConfigs(o,t){const n=t.shared||{},r=t.name,s=Object.keys(n).reduce((l,a)=>{const c=arrayOptions(n[a]);return l[a]=l[a]||[],c.forEach(u=>{l[a].push(formatShare(u,r,a,t.shareStrategy))}),l},{}),i=_extends$1({},o.shared);return Object.keys(s).forEach(l=>{i[l]?s[l].forEach(a=>{i[l].find(u=>u.version===a.version)||i[l].push(a)}):i[l]=s[l]}),{shared:i,shareInfos:s}}function versionLt(o,t){const n=r=>{if(!Number.isNaN(Number(r))){const i=r.split(".");let l=r;for(let a=0;a<3-i.length;a++)l+=".0";return l}return r};return!!satisfy(n(o),`<=${n(t)}`)}const findVersion=(o,t)=>{const n=t||function(r,s){return versionLt(r,s)};return Object.keys(o).reduce((r,s)=>!r||n(r,s)||r==="0"?s:r,0)},isLoaded=o=>!!o.loaded||typeof o.lib=="function",isLoading=o=>!!o.loading;function findSingletonVersionOrderByVersion(o,t,n){const r=o[t][n],s=function(i,l){return!isLoaded(r[i])&&versionLt(i,l)};return findVersion(o[t][n],s)}function findSingletonVersionOrderByLoaded(o,t,n){const r=o[t][n],s=function(i,l){const a=c=>isLoaded(c)||isLoading(c);return a(r[l])?a(r[i])?!!versionLt(i,l):!0:a(r[i])?!1:versionLt(i,l)};return findVersion(o[t][n],s)}function getFindShareFunction(o){return o==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(o,t,n,r){if(!o)return;const{shareConfig:s,scope:i=DEFAULT_SCOPE,strategy:l}=n,a=Array.isArray(i)?i:[i];for(const c of a)if(s&&o[c]&&o[c][t]){const{requiredVersion:u}=s,d=getFindShareFunction(l)(o,c,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(d,u)){const g=`Version ${d} from ${d&&o[c][t][d].from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${u})`;s.strictVersion?error(g):warn(g)}return o[c][t][d]}else{if(u===!1||u==="*"||satisfy(d,u))return o[c][t][d];for(const[g,y]of Object.entries(o[c][t]))if(satisfy(g,u))return y}},m={shareScopeMap:o,scope:c,pkgName:t,version:d,GlobalFederation:Global.__FEDERATION__,resolver:p};return(r.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(o){const{pkgName:t,extraOptions:n,shareInfos:r}=o,s=a=>{if(!a)return;const c={};a.forEach(d=>{c[d.version]=d});const h=findVersion(c,function(d,p){return!isLoaded(c[d])&&versionLt(d,p)});return c[h]};var i;const l=(i=n==null?void 0:n.resolver)!=null?i:s;return Object.assign({},l(r[t]),n==null?void 0:n.customShareInfo)}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function matchRemoteWithNameAndExpose(o,t){for(const n of o){const r=t.startsWith(n.name);let s=t.replace(n.name,"");if(r){if(s.startsWith("/")){const a=n.name;return s=`.${s}`,{pkgNameOrAlias:a,expose:s,remote:n}}else if(s==="")return{pkgNameOrAlias:n.name,expose:".",remote:n}}const i=n.alias&&t.startsWith(n.alias);let l=n.alias&&t.replace(n.alias,"");if(n.alias&&i){if(l&&l.startsWith("/")){const a=n.alias;return l=`.${l}`,{pkgNameOrAlias:a,expose:l,remote:n}}else if(l==="")return{pkgNameOrAlias:n.alias,expose:".",remote:n}}}}function matchRemote(o,t){for(const n of o)if(t===n.name||n.alias&&t===n.alias)return n}function registerPlugins(o,t){const n=getGlobalHostPlugins(),r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return n.length>0&&n.forEach(s=>{o!=null&&o.find(i=>i.name!==s.name)&&o.push(s)}),o&&o.length>0&&o.forEach(s=>{r.forEach(i=>{i.applyPlugin(s,t)})}),o}const importCallback=".then(callbacks[0]).catch(callbacks[1])";async function loadEsmEntry({entry:o,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${o}")${importCallback}`)([n,r]):import(o).then(n).catch(r)}catch(s){r(s)}})}async function loadSystemJsEntry({entry:o,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof __system_context__>"u"?System.import(o).then(n).catch(r):new Function("callbacks",`System.import("${o}")${importCallback}`)([n,r])}catch(s){r(s)}})}function handleRemoteEntryLoaded(o,t,n){const{remoteEntryKey:r,entryExports:s}=getRemoteEntryExports(o,t);return assert(s,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:o,remoteEntryUrl:n,remoteEntryKey:r})),s}async function loadEntryScript({name:o,globalName:t,entry:n,loaderHook:r}){const{entryExports:s}=getRemoteEntryExports(o,t);return s||loadScript(n,{attrs:{},createScriptHook:(i,l)=>{const a=r.lifecycle.createScript.emit({url:i,attrs:l});if(a&&(a instanceof HTMLScriptElement||"script"in a||"timeout"in a))return a}}).then(()=>handleRemoteEntryLoaded(o,t,n)).catch(i=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:o,resourceUrl:n})),i})}async function loadEntryDom({remoteInfo:o,remoteEntryExports:t,loaderHook:n}){const{entry:r,entryGlobalName:s,name:i,type:l}=o;switch(l){case"esm":case"module":return loadEsmEntry({entry:r,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:r,remoteEntryExports:t});default:return loadEntryScript({entry:r,globalName:s,name:i,loaderHook:n})}}async function loadEntryNode({remoteInfo:o,loaderHook:t}){const{entry:n,entryGlobalName:r,name:s,type:i}=o,{entryExports:l}=getRemoteEntryExports(s,r);return l||loadScriptNode(n,{attrs:{name:s,globalName:r,type:i},loaderHook:{createScriptHook:(a,c={})=>{const u=t.lifecycle.createScript.emit({url:a,attrs:c});if(u&&"url"in u)return u}}}).then(()=>handleRemoteEntryLoaded(s,r,n)).catch(a=>{throw a})}function getRemoteEntryUniqueKey(o){const{entry:t,name:n}=o;return composeKeyWithSeparator(n,t)}async function getRemoteEntry({origin:o,remoteEntryExports:t,remoteInfo:n}){const r=getRemoteEntryUniqueKey(n);if(t)return t;if(!globalLoading[r]){const s=o.remoteHandler.hooks.lifecycle.loadEntry,i=o.loaderHook;globalLoading[r]=s.emit({loaderHook:i,remoteInfo:n,remoteEntryExports:t}).then(l=>l||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":isBrowserEnv())?loadEntryDom({remoteInfo:n,remoteEntryExports:t,loaderHook:i}):loadEntryNode({remoteInfo:n,loaderHook:i})))}return globalLoading[r]}function getRemoteInfo(o){return _extends$1({},o,{entry:"entry"in o?o.entry:"",type:o.type||DEFAULT_REMOTE_TYPE,entryGlobalName:o.entryGlobalName||o.name,shareScope:o.shareScope||DEFAULT_SCOPE})}function defaultPreloadArgs(o){return _extends$1({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},o)}function formatPreloadArgs(o,t){return t.map(n=>{const r=matchRemote(o,n.nameOrAlias);return assert(r,`Unable to preload ${n.nameOrAlias} as it is not included in ${!r&&safeToString({remoteInfo:r,remotes:o})}`),{remote:r,preloadConfig:defaultPreloadArgs(n)}})}function normalizePreloadExposes(o){return o?o.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(o,t,n,r=!0){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:l}=n;if(t.options.inBrowser){if(l.forEach(a=>{const{moduleInfo:c}=a,u=t.moduleCache.get(o.name);getRemoteEntry(u?{origin:t,remoteInfo:c,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),r){const a={rel:"preload",as:"style"};s.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:a,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m}});h&&document.head.appendChild(u)})}else{const a={rel:"stylesheet",type:"text/css"};s.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:a,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m},needDeleteLink:!1});h&&document.head.appendChild(u)})}if(r){const a={rel:"preload",as:"script"};i.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:a,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m}});h&&document.head.appendChild(u)})}else{const a={fetchpriority:"high",type:(o==null?void 0:o.type)==="module"?"module":"text/javascript"};i.forEach(c=>{const{script:u,needAttach:h}=createScript({url:c,cb:()=>{},attrs:a,createScriptHook:(d,p)=>{const m=t.loaderHook.lifecycle.createScript.emit({url:d,attrs:p});if(m instanceof HTMLScriptElement)return m},needDeleteScript:!0});h&&document.head.appendChild(u)})}}}let Module=class{async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let t;try{t=await getRemoteEntry({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports})}catch{const r=getRemoteEntryUniqueKey(this.remoteInfo);t=await this.host.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry,origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,globalLoading,uniqueKey:r})}return assert(t,`remoteEntryExports is undefined
5
+ ${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,n,r,s){const{loadFactory:i=!0}=r||{loadFactory:!0},l=await this.getEntry();if(!this.inited){const d=this.host.shareScopeMap,p=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];p.length||p.push("default"),p.forEach(E=>{d[E]||(d[E]={})});const m=d[p[0]],_=[],g={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?p:this.remoteInfo.shareScope||"default"};Object.defineProperty(g,"shareScopeMap",{value:d,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:g,initScope:_,remoteInfo:this.remoteInfo,origin:this.host});typeof(l==null?void 0:l.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await l.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$1({},y,{id:t,remoteSnapshot:s,remoteEntryExports:l}))}this.lib=l,this.inited=!0;let a;a=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:l,expose:n,moduleInfo:this.remoteInfo}),a||(a=await l.get(n)),assert(a,`${getFMId(this.remoteInfo)} remote don't export ${n}.`);const c=processModuleAlias(this.remoteInfo.name,n),u=this.wraperFactory(a,c);return i?await u():u}wraperFactory(t,n){function r(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 r(s,n),s}:()=>{const s=t();return r(s,n),s}}constructor({remoteInfo:t,host:n}){this.inited=!1,this.lib=void 0,this.remoteInfo=t,this.host=n}};class SyncHook{on(t){typeof t=="function"&&this.listeners.add(t)}once(t){const n=this;this.on(function r(...s){return n.remove(r),t.apply(null,s)})}emit(...t){let n;return this.listeners.size>0&&this.listeners.forEach(r=>{n=r(...t)}),n}remove(t){this.listeners.delete(t)}removeAll(){this.listeners.clear()}constructor(t){this.type="",this.listeners=new Set,t&&(this.type=t)}}class AsyncHook extends SyncHook{emit(...t){let n;const r=Array.from(this.listeners);if(r.length>0){let s=0;const i=l=>l===!1?!1:s<r.length?Promise.resolve(r[s++].apply(null,t)).then(i):l;n=i()}return Promise.resolve(n)}}function checkReturnData(o,t){if(!isObject(t))return!1;if(o!==t){for(const n in o)if(!(n in t))return!1}return!0}class SyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The data for the "${this.type}" hook should be an object.`);for(const n of this.listeners)try{const r=n(t);if(checkReturnData(t,r))t=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){warn(r),this.onerror(r)}return t}constructor(t){super(),this.onerror=error,this.type=t}}class AsyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The response data for the "${this.type}" hook must be an object.`);const n=Array.from(this.listeners);if(n.length>0){let r=0;const s=l=>(warn(l),this.onerror(l),t),i=l=>{if(checkReturnData(t,l)){if(t=l,r<n.length)try{return Promise.resolve(n[r++](t)).then(i,s)}catch(a){return s(a)}}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)}constructor(t){super(),this.onerror=error,this.type=t}}class PluginSystem{applyPlugin(t,n){assert(isPlainObject(t),"Plugin configuration is invalid.");const r=t.name;assert(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=t,t.apply==null||t.apply.call(t,n),Object.keys(this.lifecycle).forEach(s=>{const i=t[s];i&&this.lifecycle[s].on(i)}))}removePlugin(t){assert(t,"A name is required.");const n=this.registerPlugins[t];assert(n,`The plugin "${t}" is not registered.`),Object.keys(n).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(n[r])})}constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}}function assignRemoteInfo(o,t){const n=getRemoteEntryInfoFromSnapshot(t);n.url||error(`The attribute remoteEntry of ${o.name} must not be undefined.`);let r=getResourceUrl(t,n.url);!isBrowserEnv()&&!r.startsWith("http")&&(r=`https:${r}`),o.type=n.type,o.entryGlobalName=n.globalName,o.entry=r,o.version=t.version,o.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(o){const{remote:t,pkgNameOrAlias:n,expose:r,origin:s,remoteInfo:i,id:l}=o;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:a,globalSnapshot:c}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:l});assignRemoteInfo(i,a);const u={remote:t,preloadConfig:{nameOrAlias:n,exposes:[r],resourceCategory:"sync",share:!1,depsRemote:!1}},h=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:u,remoteInfo:i,remote:t,remoteSnapshot:a,globalSnapshot:c});return h&&preloadAssets(i,s,h,!1),_extends$1({},o,{remoteSnapshot:a})}return o}}}function splitId(o){const t=o.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(o,t,n,r,s={},i){const l=getFMId(t),{value:a}=getInfoWithoutType(o,l),c=i||a;if(c&&!isManifestProvider(c)&&(n(c,t,r),c.remotesInfo)){const u=Object.keys(c.remotesInfo);for(const h of u){if(s[h])continue;s[h]=!0;const d=splitId(h),p=c.remotesInfo[h];traverseModuleInfo(o,{name:d.name,version:p.matchedVersion},n,!1,s,void 0)}}}const isExisted=(o,t)=>document.querySelector(`${o}[${o==="link"?"href":"src"}="${t}"]`);function generatePreloadAssets(o,t,n,r,s){const i=[],l=[],a=[],c=new Set,u=new Set,{options:h}=o,{preloadConfig:d}=t,{depsRemote:p}=d;if(traverseModuleInfo(r,n,(y,E,I)=>{let S;if(I)S=d;else if(Array.isArray(p)){const N=p.find(T=>T.nameOrAlias===E.name||T.nameOrAlias===E.alias);if(!N)return;S=defaultPreloadArgs(N)}else if(p===!0)S=d;else return;const R=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);R&&a.push({name:E.name,moduleInfo:{name:E.name,entry:R,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:E.name,shareScope:"",version:"version"in y?y.version:void 0},url:R});let b="modules"in y?y.modules:[];const v=normalizePreloadExposes(S.exposes);if(v.length&&"modules"in y){var $;b=y==null||($=y.modules)==null?void 0:$.reduce((N,T)=>((v==null?void 0:v.indexOf(T.moduleName))!==-1&&N.push(T),N),[])}function A(N){const T=N.map(O=>getResourceUrl(y,O));return S.filter?T.filter(S.filter):T}if(b){const N=b.length;for(let T=0;T<N;T++){const O=b[T],w=`${E.name}/${O.moduleName}`;o.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:O.moduleName==="."?E.name:w,name:E.name,remoteSnapshot:y,preloadConfig:S,remote:E,origin:o}),!getPreloaded(w)&&(S.resourceCategory==="all"?(i.push(...A(O.assets.css.async)),i.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.async)),l.push(...A(O.assets.js.sync))):(S.resourceCategory="sync")&&(i.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.sync))),setPreloaded(w))}}},!0,{},s),s.shared&&s.shared.length>0){const y=(E,I)=>{const S=getRegisteredShare(o.shareScopeMap,I.sharedName,E,o.sharedHandler.hooks.lifecycle.resolveShare);S&&typeof S.lib=="function"&&(I.assets.js.sync.forEach(R=>{c.add(R)}),I.assets.css.sync.forEach(R=>{u.add(R)}))};s.shared.forEach(E=>{var I;const S=(I=h.shared)==null?void 0:I[E.sharedName];if(!S)return;const R=E.version?S.find(v=>v.version===E.version):S;if(!R)return;arrayOptions(R).forEach(v=>{y(v,E)})})}const _=l.filter(y=>!c.has(y)&&!isExisted("script",y));return{cssAssets:i.filter(y=>!u.has(y)&&!isExisted("link",y)),jsAssetsWithoutEntry:_,entryAssets:a.filter(y=>!isExisted("script",y.url))}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(o){const{origin:t,preloadOptions:n,remoteInfo:r,remote:s,globalSnapshot:i,remoteSnapshot:l}=o;return isBrowserEnv()?isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:r.name,entry:s.entry,type:r.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(r,l),generatePreloadAssets(t,n,r,i,l)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function getGlobalRemoteInfo(o,t){const n=getGlobalSnapshotInfoByModuleInfo({name:t.name,version:t.options.version}),r=n&&"remotesInfo"in n&&n.remotesInfo&&getInfoWithoutType(n.remotesInfo,o.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:n,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:o.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:o.name,version:"version"in o?o.version:void 0})}}class SnapshotHandler{async loadRemoteSnapshotInfo({moduleInfo:t,id:n,expose:r}){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=_extends$1({},i==null?void 0:i.remotesInfo,{[t.name]:{matchedVersion:"version"in t?t.version:t.entry}}));const{hostGlobalSnapshot:l,remoteSnapshot:a,globalSnapshot:c}=this.getGlobalRemoteInfo(t),{remoteSnapshot:u,globalSnapshot:h}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:l,remoteSnapshot:a,globalSnapshot:c});let d,p;if(u)if(isManifestProvider(u)){const m=isBrowserEnv()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",_=await this.getManifestJson(m,t,{}),g=setGlobalSnapshotInfoByModuleInfo(_extends$1({},t,{entry:m}),_);d=_,p=g}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:u,from:"global"});d=m,p=h}else if(isRemoteInfoWithEntry(t)){const m=await this.getManifestJson(t.entry,t,{}),_=setGlobalSnapshotInfoByModuleInfo(t,m),{remoteSnapshot:g}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:m,from:"global"});d=g,p=_}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(h)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:n,host:this.HostInstance,options:s,moduleInfo:t,remoteSnapshot:d}),{remoteSnapshot:d,globalSnapshot:p}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,n,r){const s=async()=>{let l=this.manifestCache.get(t);if(l)return l;try{let a=await this.loaderHook.lifecycle.fetch.emit(t,{});(!a||!(a instanceof Response))&&(a=await fetch(t,{})),l=await a.json()}catch(a){l=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:a,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),l||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:n.name,hostName:this.HostInstance.options.name},`${a}`)))}return assert(l.metaData&&l.exposes&&l.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,l),l},i=async()=>{const l=await s(),a=generateSnapshotFromManifest(l,{version:t}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:n,manifestJson:l,remoteSnapshot:a,manifestUrl:t,from:"manifest"});return c};return this.manifestLoading[t]||(this.manifestLoading[t]=i().then(l=>l)),this.manifestLoading[t]}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}}class SharedHandler{registerShared(t,n){const{shareInfos:r,shared:s}=formatShareConfigs(t,n);return Object.keys(r).forEach(l=>{r[l].forEach(c=>{!getRegisteredShare(this.shareScopeMap,l,c,this.hooks.lifecycle.resolveShare)&&c&&c.lib&&this.setShared({pkgName:l,lib:c.lib,get:c.get,loaded:!0,shared:c,from:n.name})})}),{shareInfos:r,shared:s}}async loadShare(t,n){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:r.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:r.options.shared,origin:r}),{shareInfo:l}=i;assert(l,`Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);const a=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare),c=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,r.options.name)};if(a&&a.lib)return c(a),a.lib;if(a&&a.loading&&!a.loaded){const u=await a.loading;return a.loaded=!0,a.lib||(a.lib=u),c(a),u}else if(a){const h=(async()=>{const d=await a.get();return c(a),a.loaded=!0,a.lib=d,d})();return this.setShared({pkgName:t,loaded:!1,shared:a,from:r.options.name,lib:null,loading:h}),h}else{if(n!=null&&n.customShareInfo)return!1;const h=(async()=>{const d=await l.get();l.lib=d,l.loaded=!0,c(l);const p=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare);return p&&(p.lib=d,p.loaded=!0,p.from=l.from),d})();return this.setShared({pkgName:t,loaded:!1,shared:l,from:r.options.name,lib:null,loading:h}),h}}initializeSharing(t=DEFAULT_SCOPE,n){const{host:r}=this,s=n==null?void 0:n.from,i=n==null?void 0:n.strategy;let l=n==null?void 0:n.initScope;const a=[];if(s!=="build"){const{initTokens:_}=this;l||(l=[]);let g=_[t];if(g||(g=_[t]={from:this.host.name}),l.indexOf(g)>=0)return a;l.push(g)}const c=this.shareScopeMap,u=r.options.name;c[t]||(c[t]={});const h=c[t],d=(_,g)=>{var y;const{version:E,eager:I}=g;h[_]=h[_]||{};const S=h[_],R=S[E],b=!!(R&&(R.eager||(y=R.shareConfig)!=null&&y.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!I!=!b?I:u>R.from))&&(S[E]=g)},p=_=>_&&_.init&&_.init(c[t],l),m=async _=>{const{module:g}=await r.remoteHandler.getRemoteModuleAndOptions({id:_});if(g.getEntry){let y;try{y=await g.getEntry()}catch(E){y=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:_,error:E,from:"runtime",lifecycle:"beforeLoadShare",origin:r})}g.inited||(await p(y),g.inited=!0)}};return Object.keys(r.options.shared).forEach(_=>{r.options.shared[_].forEach(y=>{y.scope.includes(t)&&d(_,y)})}),(r.options.shareStrategy==="version-first"||i==="version-first")&&r.options.remotes.forEach(_=>{_.shareScope===t&&a.push(m(_.name))}),a}loadShareSync(t,n){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:r.options.shared});s!=null&&s.scope&&s.scope.forEach(a=>{this.initializeSharing(a,{strategy:s.strategy})});const i=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),l=a=>{a.useIn||(a.useIn=[]),addUniqueItem(a.useIn,r.options.name)};if(i){if(typeof i.lib=="function")return l(i),i.loaded||(i.loaded=!0,i.from===r.options.name&&(s.loaded=!0)),i.lib;if(typeof i.get=="function"){const a=i.get();if(!(a instanceof Promise))return l(i),this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:a,shared:i}),a}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const a=s.get();if(a instanceof Promise){const c=(n==null?void 0:n.from)==="build"?RUNTIME_005:RUNTIME_006;throw new Error(getShortErrorMsg(c,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}return s.lib=a,this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}initShareScopeMap(t,n,r={}){const{host:s}=this;this.shareScopeMap[t]=n,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:n,options:s.options,origin:s,scopeName:t,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:t,shared:n,from:r,lib:s,loading:i,loaded:l,get:a}){const{version:c,scope:u="default"}=n,h=_object_without_properties_loose(n,["version","scope"]);(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][c]){this.shareScopeMap[p][t][c]=_extends$1({version:c,scope:["default"]},h,{lib:s,loaded:l,loading:i}),a&&(this.shareScopeMap[p][t][c].get=a);return}const m=this.shareScopeMap[p][t][c];i&&!m.loading&&(m.loading=i),l&&!m.loaded&&(m.loaded=l),r&&m.from!==r&&(m.from=r)})}_setGlobalShareScopeMap(t){const n=getGlobalShareScope(),r=t.id||t.name;r&&!n[r]&&(n[r]=this.shareScopeMap)}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)}}class RemoteHandler{formatAndRegisterRemote(t,n){return(n.remotes||[]).reduce((s,i)=>(this.registerRemote(i,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,n){const{remote:r,expose:s}=n,{name:i,alias:l}=r;if(this.idToRemoteMap[t]={name:r.name,expose:s},l&&t.startsWith(i)){const a=t.replace(i,l);this.idToRemoteMap[a]={name:r.name,expose:s};return}if(l&&t.startsWith(l)){const a=t.replace(l,i);this.idToRemoteMap[a]={name:r.name,expose:s}}}async loadRemote(t,n){const{host:r}=this;try{const{loadFactory:s=!0}=n||{loadFactory:!0},{module:i,moduleOptions:l,remoteMatchInfo:a}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:c,remote:u,expose:h,id:d,remoteSnapshot:p}=a,m=await i.get(d,h,n,p),_=await this.hooks.lifecycle.onLoad.emit({id:d,pkgNameOrAlias:c,expose:h,exposeModule:s?m:void 0,exposeModuleFactory:s?void 0:m,remote:u,options:l,moduleInstance:i,origin:r});return this.setIdToRemoteMap(t,a),typeof _=="function"?_:m}catch(s){const{from:i="runtime"}=n||{from:"runtime"},l=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:i,lifecycle:"onLoad",origin:r});if(!l)throw s;return l}}async preloadRemote(t){const{host:n}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:n.options,origin:n});const r=formatPreloadArgs(n.options.remotes,t);await Promise.all(r.map(async s=>{const{remote:i}=s,l=getRemoteInfo(i),{globalSnapshot:a,remoteSnapshot:c}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i}),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:s,remote:i,remoteInfo:l,globalSnapshot:a,remoteSnapshot:c});u&&preloadAssets(l,n,u)}))}registerRemotes(t,n){const{host:r}=this;t.forEach(s=>{this.registerRemote(s,r.options.remotes,{force:n==null?void 0:n.force})})}async getRemoteModuleAndOptions(t){const{host:n}=this,{id:r}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:n.options,origin:n})}catch(_){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:n.options,origin:n,from:"runtime",error:_,lifecycle:"beforeRequest"}),!s)throw _}const{id:i}=s,l=matchRemoteWithNameAndExpose(n.options.remotes,i);assert(l,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:n.options.name,requestId:i}));const{remote:a}=l,c=getRemoteInfo(a),u=await n.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({id:i},l,{options:n.options,origin:n,remoteInfo:c})),{remote:h,expose:d}=u;assert(h&&d,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);let p=n.moduleCache.get(h.name);const m={host:n,remoteInfo:c};return p||(p=new Module(m),n.moduleCache.set(h.name,p)),{module:p,moduleOptions:m,remoteMatchInfo:u}}registerRemote(t,n,r){const{host:s}=this,i=()=>{if(t.alias){const a=n.find(c=>{var u;return t.alias&&(c.name.startsWith(t.alias)||((u=c.alias)==null?void 0:u.startsWith(t.alias)))});assert(!a,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${a&&a.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 l=n.find(a=>a.name===t.name);if(!l)i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const a=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(l),i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(a.join(" ")))}}removeRemote(t){try{const{host:r}=this,{name:s}=t,i=r.options.remotes.findIndex(a=>a.name===s);i!==-1&&r.options.remotes.splice(i,1);const l=r.moduleCache.get(t.name);if(l){const a=l.remoteInfo,c=a.entryGlobalName;if(CurrentGlobal[c]){var n;(n=Object.getOwnPropertyDescriptor(CurrentGlobal,c))!=null&&n.configurable?delete CurrentGlobal[c]:CurrentGlobal[c]=void 0}const u=getRemoteEntryUniqueKey(l.remoteInfo);globalLoading[u]&&delete globalLoading[u],r.snapshotHandler.manifestCache.delete(a.entry);let h=a.buildVersion?composeKeyWithSeparator(a.name,a.buildVersion):a.name;const d=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(m=>a.buildVersion?m.options.id===h:m.name===h);if(d!==-1){const m=CurrentGlobal.__FEDERATION__.__INSTANCES__[d];h=m.options.id||h;const _=getGlobalShareScope();let g=!0;const y=[];Object.keys(_).forEach(E=>{const I=_[E];I&&Object.keys(I).forEach(S=>{const R=I[S];R&&Object.keys(R).forEach(b=>{const v=R[b];v&&Object.keys(v).forEach($=>{const A=v[$];A&&typeof A=="object"&&A.from===a.name&&(A.loaded||A.loading?(A.useIn=A.useIn.filter(N=>N!==a.name),A.useIn.length?g=!1:y.push([E,S,b,$])):y.push([E,S,b,$]))})})})}),g&&(m.shareScopeMap={},delete _[h]),y.forEach(([E,I,S,R])=>{var b,v,$;($=_[E])==null||(v=$[I])==null||(b=v[S])==null||delete b[R]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(d,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,r);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])}r.moduleCache.delete(t.name)}}catch(r){logger.log("removeRemote fail: ",r)}}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={}}}const USE_SNAPSHOT=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;class ModuleFederation{initOptions(t){this.registerPlugins(t.plugins);const n=this.formatOptions(this.options,t);return this.options=n,n}async loadShare(t,n){return this.sharedHandler.loadShare(t,n)}loadShareSync(t,n){return this.sharedHandler.loadShareSync(t,n)}initializeSharing(t=DEFAULT_SCOPE,n){return this.sharedHandler.initializeSharing(t,n)}initRawContainer(t,n,r){const s=getRemoteInfo({name:t,entry:n}),i=new Module({host:this,remoteInfo:s});return i.remoteEntryExports=r,this.moduleCache.set(t,i),i}async loadRemote(t,n){return this.remoteHandler.loadRemote(t,n)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,n,r={}){this.sharedHandler.initShareScopeMap(t,n,r)}formatOptions(t,n){const{shared:r}=formatShareConfigs(t,n),{userOptions:s,options:i}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:n,options:t,shareInfo:r}),l=this.remoteHandler.formatAndRegisterRemote(i,s),{shared:a}=this.sharedHandler.registerShared(i,s),c=[...i.plugins];s.plugins&&s.plugins.forEach(h=>{c.includes(h)||c.push(h)});const u=_extends$1({},t,n,{plugins:c,remotes:l,shared:a});return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const n=registerPlugins(t,this);this.options.plugins=this.options.plugins.reduce((r,s)=>(s&&r&&!r.find(i=>i.name===s.name)&&r.push(s),r),n||[])}registerRemotes(t,n){return this.remoteHandler.registerRemotes(t,n)}registerShared(t){this.sharedHandler.registerShared(this.options,_extends$1({},this.options,{shared:t}))}constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.18.2",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 n=USE_SNAPSHOT?[snapshotPlugin(),generatePreloadAssetsPlugin()]:[],r={id:getBuilderId(),name:t.name,plugins:n,remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=r,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...t.plugins||[]]),this.options=this.formatOptions(r,t)}}let FederationInstance=null;function getInstance(){return FederationInstance}setGlobalFederationConstructor(ModuleFederation);function createBridgeComponent(o){const t=new Map,n=getInstance();return()=>({__APP_VERSION__:"0.18.2",async render(r){var _,g,y;LoggerInstance.debug("createBridgeComponent render Info",r);const{moduleName:s,dom:i,basename:l,memoryRoute:a,hashRoute:c,...u}=r,h=Vue__namespace.createApp(o.rootComponent,u);t.set(i,h);const d=await((y=(g=(_=n==null?void 0:n.bridgeHook)==null?void 0:_.lifecycle)==null?void 0:g.beforeBridgeRender)==null?void 0:y.emit(r)),p=d&&typeof d=="object"&&(d!=null&&d.extraProps)?d==null?void 0:d.extraProps:{},m=o.appOptions({app:h,basename:l,memoryRoute:a,hashRoute:c,...u,...p});if(m!=null&&m.router){let E,I=m.router.getRoutes();r.memoryRoute?E=VueRouter__namespace.createMemoryHistory(r.basename):r.hashRoute?(E=VueRouter__namespace.createWebHashHistory(),I=I.map(R=>({...R,path:r.basename+R.path}))):E=VueRouter__namespace.createWebHistory(r.basename);const S=VueRouter__namespace.createRouter({...m.router.options,history:E,routes:I});LoggerInstance.debug("createBridgeComponent render router info>>>",{moduleName:s,router:S}),a&&await S.push(a.entryPath),h.use(S)}h.mount(i)},destroy(r){LoggerInstance.debug("createBridgeComponent destroy Info",r);const s=t.get(r==null?void 0:r.dom);s==null||s.unmount()}})}function e(){const o=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(o)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(o){const t=Vue.ref(null),n=Vue.ref(null),r=Vue.ref(""),s=VueRouter.useRoute(),i=getInstance(),l=Vue.useAttrs(),a=async()=>{var p,m,_,g;const u=(p=o.providerInfo)==null?void 0:p.call(o);n.value=u;let h={...l,moduleName:o.moduleName,dom:t.value,basename:o.basename,memoryRoute:o.memoryRoute,hashRoute:o.hashRoute};LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",h);const d=await((g=(_=(m=i==null?void 0:i.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:_.beforeBridgeRender)==null?void 0:g.emit(h))||{};h={...h,...d.extraProps},u.render(h)},c=Vue.watch(()=>s==null?void 0:s.path,u=>{u!==s.path&&a(),r.value!==""&&r.value!==u&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...o,pathname:s.path}),e()),r.value=u});return Vue.onMounted(()=>{a()}),Vue.onBeforeUnmount(()=>{var u;LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>",{...o}),c(),(u=n.value)==null||u.destroy({dom:t.value})}),()=>Vue.createVNode("div",Vue.mergeProps(o.rootAttrs||{},{ref:t}),null)}});function createRemoteAppComponent(o){return Vue.defineAsyncComponent({__APP_VERSION__:"0.18.2",...o.asyncComponentOptions,loader:async()=>{var c,u;const t=VueRouter.useRoute();let n="/";const r=(u=(c=t==null?void 0:t.matched)==null?void 0:c[0])==null?void 0:u.path;r&&(r.endsWith("/:pathMatch(.*)*")?n=r.replace("/:pathMatch(.*)*",""):n=t.matched[0].path);const s=(o==null?void 0:o.export)||"default";LoggerInstance.debug("createRemoteAppComponent LazyComponent create >>>",{basename:n,info:o});const i=await o.loader(),l=i&&i[Symbol.for("mf_module_id")],a=i[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:l,module:i,exportName:s,basename:n,route:t}),s in i&&typeof a=="function")return{render(){return Vue.h(RemoteApp,{moduleName:l,providerInfo:a,basename:n,rootAttrs:o.rootAttrs})}};throw new Error("module not found")}})}function createRemoteComponent(o){return LoggerInstance.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),createRemoteAppComponent(o)}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteAppComponent=createRemoteAppComponent;exports.createRemoteComponent=createRemoteComponent;
package/dist/index.js CHANGED
@@ -529,7 +529,7 @@ function setGlobalDefaultVal(o) {
529
529
  setGlobalDefaultVal(CurrentGlobal);
530
530
  setGlobalDefaultVal(nativeGlobal);
531
531
  function setGlobalFederationConstructor(o, t = isDebugMode()) {
532
- t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = o, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.1");
532
+ t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = o, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.2");
533
533
  }
534
534
  function getInfoWithoutType(o, t) {
535
535
  if (typeof t == "string") {
@@ -1514,10 +1514,10 @@ function generatePreloadAssets(o, t, n, r, s) {
1514
1514
  if (v)
1515
1515
  I = d;
1516
1516
  else if (Array.isArray(m)) {
1517
- const w = m.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
1518
- if (!w)
1517
+ const O = m.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
1518
+ if (!O)
1519
1519
  return;
1520
- I = defaultPreloadArgs(w);
1520
+ I = defaultPreloadArgs(O);
1521
1521
  } else if (m === !0)
1522
1522
  I = d;
1523
1523
  else
@@ -1539,24 +1539,24 @@ function generatePreloadAssets(o, t, n, r, s) {
1539
1539
  const A = normalizePreloadExposes(I.exposes);
1540
1540
  if (A.length && "modules" in _) {
1541
1541
  var T;
1542
- R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((w, N) => ((A == null ? void 0 : A.indexOf(N.moduleName)) !== -1 && w.push(N), w), []);
1542
+ R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((O, N) => ((A == null ? void 0 : A.indexOf(N.moduleName)) !== -1 && O.push(N), O), []);
1543
1543
  }
1544
- function $(w) {
1545
- const N = w.map((O) => getResourceUrl(_, O));
1544
+ function $(O) {
1545
+ const N = O.map((w) => getResourceUrl(_, w));
1546
1546
  return I.filter ? N.filter(I.filter) : N;
1547
1547
  }
1548
1548
  if (R) {
1549
- const w = R.length;
1550
- for (let N = 0; N < w; N++) {
1551
- const O = R[N], M = `${b.name}/${O.moduleName}`;
1549
+ const O = R.length;
1550
+ for (let N = 0; N < O; N++) {
1551
+ const w = R[N], M = `${b.name}/${w.moduleName}`;
1552
1552
  o.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
1553
- id: O.moduleName === "." ? b.name : M,
1553
+ id: w.moduleName === "." ? b.name : M,
1554
1554
  name: b.name,
1555
1555
  remoteSnapshot: _,
1556
1556
  preloadConfig: I,
1557
1557
  remote: b,
1558
1558
  origin: o
1559
- }), !getPreloaded(M) && (I.resourceCategory === "all" ? (i.push(...$(O.assets.css.async)), i.push(...$(O.assets.css.sync)), l.push(...$(O.assets.js.async)), l.push(...$(O.assets.js.sync))) : (I.resourceCategory = "sync") && (i.push(...$(O.assets.css.sync)), l.push(...$(O.assets.js.sync))), setPreloaded(M));
1559
+ }), !getPreloaded(M) && (I.resourceCategory === "all" ? (i.push(...$(w.assets.css.async)), i.push(...$(w.assets.css.sync)), l.push(...$(w.assets.js.async)), l.push(...$(w.assets.js.sync))) : (I.resourceCategory = "sync") && (i.push(...$(w.assets.css.sync)), l.push(...$(w.assets.js.sync))), setPreloaded(M));
1560
1560
  }
1561
1561
  }
1562
1562
  }, !0, {}, s), s.shared && s.shared.length > 0) {
@@ -1809,9 +1809,7 @@ class SharedHandler {
1809
1809
  } else if (a) {
1810
1810
  const p = (async () => {
1811
1811
  const d = await a.get();
1812
- l.lib = d, l.loaded = !0, c(l);
1813
- const m = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare);
1814
- return m && (m.lib = d, m.loaded = !0, c(m)), d;
1812
+ return c(a), a.loaded = !0, a.lib = d, d;
1815
1813
  })();
1816
1814
  return this.setShared({
1817
1815
  pkgName: t,
@@ -1828,7 +1826,7 @@ class SharedHandler {
1828
1826
  const d = await l.get();
1829
1827
  l.lib = d, l.loaded = !0, c(l);
1830
1828
  const m = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare);
1831
- return m && (m.lib = d, m.loaded = !0), d;
1829
+ return m && (m.lib = d, m.loaded = !0, m.from = l.from), d;
1832
1830
  })();
1833
1831
  return this.setShared({
1834
1832
  pkgName: t,
@@ -1984,7 +1982,7 @@ class SharedHandler {
1984
1982
  return;
1985
1983
  }
1986
1984
  const y = this.shareScopeMap[m][t][c];
1987
- i && !y.loading && (y.loading = i);
1985
+ i && !y.loading && (y.loading = i), l && !y.loaded && (y.loaded = l), r && y.from !== r && (y.from = r);
1988
1986
  });
1989
1987
  }
1990
1988
  _setGlobalShareScopeMap(t) {
@@ -2202,7 +2200,7 @@ class RemoteHandler {
2202
2200
  const A = S[R];
2203
2201
  A && Object.keys(A).forEach((T) => {
2204
2202
  const $ = A[T];
2205
- $ && typeof $ == "object" && $.from === a.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((w) => w !== a.name), $.useIn.length ? E = !1 : _.push([
2203
+ $ && typeof $ == "object" && $.from === a.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((O) => O !== a.name), $.useIn.length ? E = !1 : _.push([
2206
2204
  b,
2207
2205
  I,
2208
2206
  R,
@@ -2332,7 +2330,7 @@ class ModuleFederation {
2332
2330
  beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
2333
2331
  // maybe will change, temporarily for internal use only
2334
2332
  initContainer: new AsyncWaterfallHook("initContainer")
2335
- }), this.version = "0.18.1", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2333
+ }), this.version = "0.18.2", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2336
2334
  // FIXME: may not be suitable , not open to the public yet
2337
2335
  getModuleInfo: new SyncHook(),
2338
2336
  createScript: new SyncHook(),
@@ -2371,7 +2369,7 @@ setGlobalFederationConstructor(ModuleFederation);
2371
2369
  function createBridgeComponent(o) {
2372
2370
  const t = /* @__PURE__ */ new Map(), n = getInstance();
2373
2371
  return () => ({
2374
- __APP_VERSION__: "0.18.1",
2372
+ __APP_VERSION__: "0.18.2",
2375
2373
  async render(r) {
2376
2374
  var g, E, _;
2377
2375
  LoggerInstance.debug("createBridgeComponent render Info", r);
@@ -2473,7 +2471,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2473
2471
  });
2474
2472
  function createRemoteAppComponent(o) {
2475
2473
  return defineAsyncComponent({
2476
- __APP_VERSION__: "0.18.1",
2474
+ __APP_VERSION__: "0.18.2",
2477
2475
  ...o.asyncComponentOptions,
2478
2476
  //@ts-ignore
2479
2477
  loader: async () => {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/module-federation/core",
8
8
  "directory": "packages/vue3-bridge"
9
9
  },
10
- "version": "0.18.1",
10
+ "version": "0.18.2",
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.18.1",
36
- "@module-federation/sdk": "0.18.1",
37
- "@module-federation/runtime": "0.18.1"
35
+ "@module-federation/bridge-shared": "0.18.2",
36
+ "@module-federation/sdk": "0.18.2",
37
+ "@module-federation/runtime": "0.18.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "^18.3.11",