@empjs/share 3.11.4 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter.d.cts +1 -1
- package/dist/adapter.d.ts +1 -1
- package/dist/{index-Db0Os_5A.d.cts → index-DaSrQPN9.d.cts} +4 -4
- package/dist/{index-Db0Os_5A.d.ts → index-DaSrQPN9.d.ts} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.cjs.map +1 -1
- package/dist/rspack.d.cts +27 -1
- package/dist/rspack.d.ts +27 -1
- package/dist/rspack.js.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/sdk.cjs +2 -0
- package/dist/sdk.cjs.map +1 -0
- package/dist/sdk.d.cts +33 -0
- package/dist/sdk.d.ts +33 -0
- package/dist/sdk.js +2 -0
- package/dist/sdk.js.map +1 -0
- package/dist/vue.d.cts +1 -1
- package/dist/vue.d.ts +1 -1
- package/output/sdk.js +1 -1
- package/package.json +18 -5
package/dist/rspack.d.ts
CHANGED
|
@@ -82,6 +82,32 @@ type frameworkOptions = {
|
|
|
82
82
|
type EMPPluginShareType = ModuleFederationPluginOptions & {
|
|
83
83
|
empRuntime?: EMPSHARERuntimeOptions;
|
|
84
84
|
};
|
|
85
|
+
type ExternalsItemType = {
|
|
86
|
+
/**
|
|
87
|
+
* 模块名
|
|
88
|
+
* @example react-dom
|
|
89
|
+
*/
|
|
90
|
+
module?: string;
|
|
91
|
+
/**
|
|
92
|
+
* 全局变量
|
|
93
|
+
* @example ReactDom
|
|
94
|
+
*/
|
|
95
|
+
global?: string;
|
|
96
|
+
/**
|
|
97
|
+
* 入口地址
|
|
98
|
+
* 不填则可以通过 emp-config 里的 html.files.js[url] 传入合并后的请求
|
|
99
|
+
* 如 http://...?react&react-dom&react-router&mobx
|
|
100
|
+
* @example http://
|
|
101
|
+
*/
|
|
102
|
+
entry?: string;
|
|
103
|
+
/**
|
|
104
|
+
* 类型入口
|
|
105
|
+
* @default js
|
|
106
|
+
* @enum js | css
|
|
107
|
+
* @example css
|
|
108
|
+
*/
|
|
109
|
+
type?: string;
|
|
110
|
+
};
|
|
85
111
|
|
|
86
112
|
declare const externalReact: (o: any, globalVal: string) => any;
|
|
87
113
|
|
|
@@ -92,4 +118,4 @@ declare const pluginRspackEmpShare: (o?: EMPPluginShareType) => {
|
|
|
92
118
|
rsConfig(store: GlobalStore): Promise<void>;
|
|
93
119
|
};
|
|
94
120
|
|
|
95
|
-
export { pluginRspackEmpShare as default, externalReact, externalVue, pluginRspackEmpShare };
|
|
121
|
+
export { type EMPPluginShareType, type EMPSHARERuntimeOptions, type ExternalsItemType, type ModuleFederationPluginOptions, pluginRspackEmpShare as default, externalReact, externalVue, type frameworLibType, type frameworkOptions, pluginRspackEmpShare, type runtimeLibType };
|
package/dist/rspack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/helper/index.ts","../src/helper/config.ts","../src/helper/rspack.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/utils.ts","../src/plugins/rspack/share.ts","../src/framework/react/config.ts","../src/framework/vue/config.ts","../src/plugins/rspack/index.ts"],"sourcesContent":["export const importJsVm = (content: string) => `data:text/javascript,${content}`\n\nexport function deepAssign<T>(target: any, ...sources: any): T {\n for (const source of sources) {\n for (const k in source) {\n const vs = source[k],\n vt = target[k]\n if (Object(vs) == vs && Object(vt) === vt) {\n target[k] = deepAssign(vt, vs)\n continue\n }\n target[k] = source[k]\n }\n }\n return target\n}\n\nexport const checkVersion = (version: string) => (version ? Number(version.split('.')[0]) : 0)\nexport const isPromise = (p: any) => p && Object.prototype.toString.call(p) === '[object Promise]'\n\n//\nexport const isDev = process.env.EMPSHARE_ENV === 'dev'\nexport const log = isDev ? console.log.bind(console, '[EMP Share]') : () => {}\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","export {ModuleFederationPlugin} from '@module-federation/rspack'\n","import {Compiler} from '@empjs/cli'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\n\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\n// 当没有设置 runtimeLib 时候需要内置\nexport class EmpShareRemoteLibPlugin {\n options: EMPSHARERuntimeOptions\n constructor(op: EMPSHARERuntimeOptions) {\n this.options = op\n }\n apply(compiler: Compiler) {\n const {webpack} = compiler\n const entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string, entry = 'runtime') {\n if (typeof host === 'string') {\n if (entry === 'runtime') {\n return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n } else {\n return `${host}/${entry}.${mode}.umd.js`\n }\n } else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {deepAssign} from 'src/helper'\nimport {shareGlobalName} from 'src/helper/config'\nimport {ModuleFederationPlugin} from 'src/helper/rspack'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport type {\n EMPPluginShareType,\n ExternalsItemType,\n frameworkOptions,\n ModuleFederationPluginOptions,\n runtimeLibType,\n} from './types'\nimport {getRuntimeLib} from './utils'\n\nconst exp = /^([0-9a-zA-Z_\\s]+)@(.*)/\nexport class EmpShare {\n private op: EMPPluginShareType\n private store: GlobalStore\n /**\n * 注入资源\n */\n private injectHtml: any[] = []\n /**\n * 兼容 shareLib\n */\n private externalsLib: ExternalsItemType[] = []\n constructor(op: EMPPluginShareType, store: GlobalStore) {\n this.op = op || {}\n this.store = store\n }\n setup() {\n this.resetRuntime()\n this.resetFramework()\n this.setMfName() //设置 mfName 默认为 uniqueName\n this.setMF() // 设置 MF 配置\n this.injectGlobalVal() // 插入全局变量 方便emp外的项目调用\n this.injectFramework() // 插入ui框架库\n this.setShareLib() //兼容 emp Sharelib的共享模型设置\n this.setRuntimeLib() // 设置 MF SDK\n this.injectToHtml() //触发插入动作\n this.setExternal() // 设置 external 降低包体\n }\n private injectToHtml() {\n const {store, injectHtml} = this\n if (injectHtml.length > 0) {\n store.injectTags(injectHtml, 'EMPShare')\n }\n }\n private injectFramework() {\n if (this.fk && this.fk.libs.length > 0) {\n return this.injectFkLibs(this.fk.libs)\n }\n if (!this.op.empRuntime || !this.fk.lib) return\n const {store, injectHtml} = this\n if (this.fk.lib) {\n const url = getRuntimeLib(this.fk.lib, store.mode, this.fk.entry)\n injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n }\n }\n private injectFkLibs(libs: string[]) {\n libs.map(url => {\n if (url.endsWith('.css')) {\n return this.injectHtml.push({\n attributes: {\n href: url,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n this.injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n })\n }\n private injectGlobalVal() {\n if (!this.op.empRuntime) return\n const {empRuntime} = this.op\n const {injectHtml} = this\n const frameworkGlobal = this.fk.global || (empRuntime.shareLib ? 'window' : '')\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false || !this.rt.lib ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n const injectData: any = {frameworkLib: frameworkGlobal, runtimeLib: this.rt.global}\n if (this.fk.name && this.fk.name !== 'none') injectData.framework = this.fk.name\n injectHtml.push({\n // type: 'js',\n tagName: 'script',\n innerHTML: `EMPShareGlobalVal=${JSON.stringify(injectData)}`,\n })\n }\n }\n public fk!: Required<frameworkOptions>\n private resetFramework() {\n if (!this.op.empRuntime) return\n const {framework, frameworkGlobal, frameworkLib} = this.op.empRuntime\n //\n this.fk = {\n name: 'none',\n version: 0,\n entry: '',\n global: frameworkGlobal || '',\n lib: frameworkLib || '',\n libs: [],\n }\n //\n if (typeof framework === 'string') {\n this.fk.name = framework as any\n }\n // TODO 通用 CDN 的适配方案\n else if (typeof framework === 'object' && Object.keys(framework).length > 0) {\n // 默认 框架名 为入口\n framework.entry = framework.entry ? framework.entry : framework.name\n this.fk = deepAssign(this.fk, framework)\n }\n }\n public rt!: Required<runtimeLibType>\n private resetRuntime() {\n const {empRuntime} = this.op\n if (!empRuntime) return\n const global = empRuntime.runtimeGlobal || shareGlobalName\n const lib = empRuntime.runtimeLib ? empRuntime.runtimeLib : empRuntime.runtime?.lib ? empRuntime.runtime.lib : ''\n this.rt = {\n lib,\n global,\n }\n }\n private setExternal() {\n if (!this.op.empRuntime) return\n const {store, externalsLib} = this\n const {empRuntime} = this.op\n const {shareLib} = empRuntime\n //\n const externalRuntime = this.rt.lib\n ? {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n : {}\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${this.rt.global}.${value}`\n }\n /**\n * TODO\n * 框架相关内容需要移除 share 由外部简化配置实现\n */\n if (this.fk.name === 'react' && !shareLib && this.fk.global) {\n const version = this.fk.version\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n if (this.fk.entry === 'reactRouter') {\n externalReact['react-router-dom'] = 'ReactRouterDOM'\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${this.fk.global}.${value}`\n }\n if ([17, 18, 19].includes(version)) {\n externals['react-dom/client'] = this.fk.global\n externals['react/jsx-runtime'] = this.fk.global\n externals['react/jsx-dev-runtime'] = this.fk.global\n }\n }\n if (shareLib) {\n externalsLib.map(v => {\n if (v.type === 'js' && v.module && v.global) {\n externals[v.module] = `${this.fk.global}.${v.global}`\n }\n })\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals, this.fk.global, this.rt.global)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n private setRuntimeLib() {\n if (!this.op.empRuntime) return\n\n const {shareLib} = this.op.empRuntime\n const {store, injectHtml} = this\n const {empRuntime} = this.op\n if (!this.rt.lib) {\n // 内置 this.rt.lib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (this.rt.lib === 'useFrameworkLib' && !shareLib) {\n } else {\n // 插入 runtime\n injectHtml.push({tagName: 'script', pos: 'head', attributes: {src: this.rt.lib}})\n }\n }\n private setMfName() {\n if (this.op.name) {\n this.op.name = this.store.encodeVarName(this.op.name)\n if (this.op.name !== this.store.empConfig.output.uniqueName) {\n this.store.chain.output.set('uniqueName', this.op.name)\n }\n } else {\n this.op.name = this.store.empConfig.output.uniqueName\n }\n }\n private setMF() {\n const o = this.op\n const {store} = this\n if (o.name) {\n const op = store.deepAssign<ModuleFederationPluginOptions & {empRuntime: any}>(\n {\n filename: 'emp.js',\n manifest: false,\n dts: false,\n dev: {\n disableDynamicRemoteTypeHints: true,\n },\n },\n o,\n )\n //\n if (o.dev === false) op.dev = false\n //\n if (op.empRuntime) {\n delete op.empRuntime\n }\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n }\n private setShareLib() {\n if (!this.op.empRuntime) return\n const {shareLib} = this.op.empRuntime\n const {externalsLib, injectHtml} = this\n if (shareLib && typeof shareLib === 'object') {\n for (const [k, v] of Object.entries(shareLib)) {\n let externalsItem: ExternalsItemType = {}\n externalsItem.module = k\n //增加下划线 支持lodash 等特殊符号的问题 如 _@http\n\n if (typeof v === 'string') {\n const cb: any = v.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n } else {\n externalsItem.global = ''\n externalsItem.entry = v\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n } else if (Array.isArray(v)) {\n v.map(vo => {\n if (!vo) return\n const isCSS = vo.split('?')[0].endsWith('.css')\n if (isCSS) {\n externalsItem.entry = vo\n externalsItem.type = 'css'\n } else {\n const cb: any = vo.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n } else {\n externalsItem.global = ''\n externalsItem.entry = vo\n externalsItem.type = 'js'\n }\n }\n externalsLib.push(externalsItem)\n externalsItem = {}\n })\n } else if (typeof v === 'object' && v.entry) {\n externalsItem.entry = v.entry\n externalsItem.global = v.global\n externalsItem.type = v.type\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n }\n // console.log(externalsLib)\n externalsLib.map(v => {\n if (v.type === 'js') {\n injectHtml.push({\n attributes: {\n src: v.entry,\n },\n tagName: 'script',\n })\n } else if (v.type === 'css') {\n injectHtml.push({\n attributes: {\n href: v.entry,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n })\n }\n }\n}\n","export const externalReact = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n react: `${globalVal}.React`,\n 'react-dom': `${globalVal}.ReactDOM`,\n 'react-dom/client': globalVal,\n 'react/jsx-runtime': globalVal,\n 'react/jsx-dev-runtime': globalVal,\n 'react-router-dom': `${globalVal}.ReactRouterDOM`,\n })\n return o\n}\n","export const externalVue = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n vue: `${globalVal}.Vue`,\n 'vue-router': `${globalVal}.VueRouter`,\n })\n return o\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {EmpShare} from './share'\nimport type {EMPPluginShareType} from './types'\n\n//\nexport * from 'src/framework/react/config'\nexport * from 'src/framework/vue/config'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n //\n if (o.manifest === true) {\n o.manifest = {\n fileName: 'emp.json',\n }\n } else if (typeof o.manifest === 'object') {\n o.manifest = store.deepAssign({fileName: 'emp.json'}, o.manifest)\n }\n const empShare = new EmpShare(o, store)\n empShare.setup()\n },\n }\n}\nexport default pluginRspackEmpShare\n"],"mappings":"AAAO,IAAMA,EAAcC,GAAoB,wBAAwBA,CAAO,GAEvE,SAASC,EAAcC,KAAgBC,EAAiB,CAC7D,QAAWC,KAAUD,EACnB,QAAWE,KAAKD,EAAQ,CACtB,IAAME,EAAKF,EAAOC,CAAC,EACjBE,EAAKL,EAAOG,CAAC,EACf,GAAI,OAAOC,CAAE,GAAKA,GAAM,OAAOC,CAAE,IAAMA,EAAI,CACzCL,EAAOG,CAAC,EAAIJ,EAAWM,EAAID,CAAE,EAC7B,QACF,CACAJ,EAAOG,CAAC,EAAID,EAAOC,CAAC,CACtB,CAEF,OAAOH,CACT,CAMO,IAAMM,EAAQ,GACRC,EAAMD,EAAQ,QAAQ,IAAI,KAAK,QAAS,aAAa,EAAI,IAAM,CAAC,ECtBtE,IAAME,EAAkB,oBCA/B,OAAQ,0BAAAC,MAA6B,4BCIrC,IAAMC,EAAuBC,GAAO,CAClC,IAAMC,EAAU,CAAC,WAAWD,CAAG,GAAG,EAAE,KAAK;AAAA,CAAI,EAC7C,OAAOE,EAAWD,CAAO,CAC3B,EAEaE,EAAN,KAA8B,CACnC,QACA,YAAYC,EAA4B,CACtC,KAAK,QAAUA,CACjB,CACA,MAAMC,EAAoB,CACxB,GAAM,CAAC,QAAAC,CAAO,EAAID,EACZE,EAAQR,EAAqB,sBAAsB,EACzD,IAAIO,EAAQ,YAAYD,EAAS,QAASE,EAAO,CAC/C,KAAM,MACR,CAAC,EAAE,MAAMF,CAAQ,CACnB,CACF,ECpBO,SAASG,EAAcC,EAA8CC,EAAcC,EAAQ,UAAW,CAC3G,OAAI,OAAOF,GAAS,SACdE,IAAU,UACL,GAAG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AAS,OACpBrB,EAAW,KAAK,CACd,WAAY,CACV,KAAMqB,EAAE,MACR,IAAK,YACP,EACA,QAAS,MACX,CAAC,CAEL,CAAC,CACH,CACF,CACF,ECxTO,IAAMQ,EAAgB,CAACC,EAAQC,KACpCD,EAAI,OAAO,OAAOA,EAAG,CACnB,MAAO,GAAGC,CAAS,SACnB,YAAa,GAAGA,CAAS,YACzB,mBAAoBA,EACpB,oBAAqBA,EACrB,wBAAyBA,EACzB,mBAAoB,GAAGA,CAAS,iBAClC,CAAC,EACMD,GCTF,IAAME,EAAc,CAACC,EAAQC,KAClCD,EAAI,OAAO,OAAOA,EAAG,CACnB,IAAK,GAAGC,CAAS,OACjB,aAAc,GAAGA,CAAS,YAC5B,CAAC,EACMD,GCGF,IAAME,EAAuB,CAACC,EAAwB,CAAC,KACrD,CACL,KAAM,eACN,MAAM,SAASC,EAAoB,CAE7BD,EAAE,WAAa,GACjBA,EAAE,SAAW,CACX,SAAU,UACZ,EACS,OAAOA,EAAE,UAAa,WAC/BA,EAAE,SAAWC,EAAM,WAAW,CAAC,SAAU,UAAU,EAAGD,EAAE,QAAQ,GAEjD,IAAIE,EAASF,EAAGC,CAAK,EAC7B,MAAM,CACjB,CACF,GAEKE,EAAQJ","names":["importJsVm","content","deepAssign","target","sources","source","k","vs","vt","isDev","log","shareGlobalName","ModuleFederationPlugin","getShareRuntimeEntry","url","content","importJsVm","EmpShareRemoteLibPlugin","op","compiler","webpack","entry","getRuntimeLib","host","mode","entry","exp","EmpShare","op","store","injectHtml","url","getRuntimeLib","libs","empRuntime","frameworkGlobal","injectData","framework","frameworkLib","deepAssign","global","shareGlobalName","lib","externalsLib","shareLib","externalRuntime","externals","key","value","version","externalReact","v","EmpShareRemoteLibPlugin","o","ModuleFederationPlugin","k","externalsItem","cb","vo","externalReact","o","globalVal","externalVue","o","globalVal","pluginRspackEmpShare","o","store","EmpShare","rspack_default"]}
|
|
1
|
+
{"version":3,"sources":["../src/helper/index.ts","../src/helper/config.ts","../src/helper/rspack.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/utils.ts","../src/plugins/rspack/share.ts","../src/framework/react/config.ts","../src/framework/vue/config.ts","../src/plugins/rspack/index.ts"],"sourcesContent":["export const importJsVm = (content: string) => `data:text/javascript,${content}`\n\nexport function deepAssign<T>(target: any, ...sources: any): T {\n for (const source of sources) {\n for (const k in source) {\n const vs = source[k],\n vt = target[k]\n if (Object(vs) == vs && Object(vt) === vt) {\n target[k] = deepAssign(vt, vs)\n continue\n }\n target[k] = source[k]\n }\n }\n return target\n}\n\nexport const checkVersion = (version: string) => (version ? Number(version.split('.')[0]) : 0)\nexport const isPromise = (p: any) => p && Object.prototype.toString.call(p) === '[object Promise]'\n\n//\nexport const isDev = process.env.EMPSHARE_ENV === 'dev'\nexport const log = isDev ? console.log.bind(console, '[EMP Share]') : () => {}\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","export {ModuleFederationPlugin} from '@module-federation/rspack'\n","import {Compiler} from '@empjs/cli'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\n\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\n// 当没有设置 runtimeLib 时候需要内置\nexport class EmpShareRemoteLibPlugin {\n options: EMPSHARERuntimeOptions\n constructor(op: EMPSHARERuntimeOptions) {\n this.options = op\n }\n apply(compiler: Compiler) {\n const {webpack} = compiler\n const entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string, entry = 'runtime') {\n if (typeof host === 'string') {\n if (entry === 'runtime') {\n return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n } else {\n return `${host}/${entry}.${mode}.umd.js`\n }\n } else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {deepAssign} from 'src/helper'\nimport {shareGlobalName} from 'src/helper/config'\nimport {ModuleFederationPlugin} from 'src/helper/rspack'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport type {\n EMPPluginShareType,\n ExternalsItemType,\n frameworkOptions,\n ModuleFederationPluginOptions,\n runtimeLibType,\n} from './types'\nimport {getRuntimeLib} from './utils'\n\nconst exp = /^([0-9a-zA-Z_\\s]+)@(.*)/\nexport class EmpShare {\n private op: EMPPluginShareType\n private store: GlobalStore\n /**\n * 注入资源\n */\n private injectHtml: any[] = []\n /**\n * 兼容 shareLib\n */\n private externalsLib: ExternalsItemType[] = []\n constructor(op: EMPPluginShareType, store: GlobalStore) {\n this.op = op || {}\n this.store = store\n }\n setup() {\n this.resetRuntime()\n this.resetFramework()\n this.setMfName() //设置 mfName 默认为 uniqueName\n this.setMF() // 设置 MF 配置\n this.injectGlobalVal() // 插入全局变量 方便emp外的项目调用\n this.injectFramework() // 插入ui框架库\n this.setShareLib() //兼容 emp Sharelib的共享模型设置\n this.setRuntimeLib() // 设置 MF SDK\n this.injectToHtml() //触发插入动作\n this.setExternal() // 设置 external 降低包体\n }\n private injectToHtml() {\n const {store, injectHtml} = this\n if (injectHtml.length > 0) {\n store.injectTags(injectHtml, 'EMPShare')\n }\n }\n private injectFramework() {\n if (this.fk && this.fk.libs.length > 0) {\n return this.injectFkLibs(this.fk.libs)\n }\n if (!this.op.empRuntime || !this.fk.lib) return\n const {store, injectHtml} = this\n if (this.fk.lib) {\n const url = getRuntimeLib(this.fk.lib, store.mode, this.fk.entry)\n injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n }\n }\n private injectFkLibs(libs: string[]) {\n libs.map(url => {\n if (url.endsWith('.css')) {\n return this.injectHtml.push({\n attributes: {\n href: url,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n this.injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n })\n }\n private injectGlobalVal() {\n if (!this.op.empRuntime) return\n const {empRuntime} = this.op\n const {injectHtml} = this\n const frameworkGlobal = this.fk.global || (empRuntime.shareLib ? 'window' : '')\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false || !this.rt.lib ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n const injectData: any = {frameworkLib: frameworkGlobal, runtimeLib: this.rt.global}\n if (this.fk.name && this.fk.name !== 'none') injectData.framework = this.fk.name\n injectHtml.push({\n // type: 'js',\n tagName: 'script',\n innerHTML: `EMPShareGlobalVal=${JSON.stringify(injectData)}`,\n })\n }\n }\n public fk!: Required<frameworkOptions>\n private resetFramework() {\n if (!this.op.empRuntime) return\n const {framework, frameworkGlobal, frameworkLib} = this.op.empRuntime\n //\n this.fk = {\n name: 'none',\n version: 0,\n entry: '',\n global: frameworkGlobal || '',\n lib: frameworkLib || '',\n libs: [],\n }\n //\n if (typeof framework === 'string') {\n this.fk.name = framework as any\n }\n // TODO 通用 CDN 的适配方案\n else if (typeof framework === 'object' && Object.keys(framework).length > 0) {\n // 默认 框架名 为入口\n framework.entry = framework.entry ? framework.entry : framework.name\n this.fk = deepAssign(this.fk, framework)\n }\n }\n public rt!: Required<runtimeLibType>\n private resetRuntime() {\n const {empRuntime} = this.op\n if (!empRuntime) return\n const global = empRuntime.runtimeGlobal || shareGlobalName\n const lib = empRuntime.runtimeLib ? empRuntime.runtimeLib : empRuntime.runtime?.lib ? empRuntime.runtime.lib : ''\n this.rt = {\n lib,\n global,\n }\n }\n private setExternal() {\n if (!this.op.empRuntime) return\n const {store, externalsLib} = this\n const {empRuntime} = this.op\n const {shareLib} = empRuntime\n //\n const externalRuntime = this.rt.lib\n ? {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n : {}\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${this.rt.global}.${value}`\n }\n /**\n * TODO\n * 框架相关内容需要移除 share 由外部简化配置实现\n */\n if (this.fk.name === 'react' && !shareLib && this.fk.global) {\n const version = this.fk.version\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n if (this.fk.entry === 'reactRouter') {\n externalReact['react-router-dom'] = 'ReactRouterDOM'\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${this.fk.global}.${value}`\n }\n if ([17, 18, 19].includes(version)) {\n externals['react-dom/client'] = this.fk.global\n externals['react/jsx-runtime'] = this.fk.global\n externals['react/jsx-dev-runtime'] = this.fk.global\n }\n }\n if (shareLib) {\n externalsLib.map(v => {\n if (v.type === 'js' && v.module && v.global) {\n externals[v.module] = `${this.fk.global}.${v.global}`\n }\n })\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals, this.fk.global, this.rt.global)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n private setRuntimeLib() {\n if (!this.op.empRuntime) return\n\n const {shareLib} = this.op.empRuntime\n const {store, injectHtml} = this\n const {empRuntime} = this.op\n if (!this.rt.lib) {\n // 内置 this.rt.lib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (this.rt.lib === 'useFrameworkLib' && !shareLib) {\n } else {\n // 插入 runtime\n injectHtml.push({tagName: 'script', pos: 'head', attributes: {src: this.rt.lib}})\n }\n }\n private setMfName() {\n if (this.op.name) {\n this.op.name = this.store.encodeVarName(this.op.name)\n if (this.op.name !== this.store.empConfig.output.uniqueName) {\n this.store.chain.output.set('uniqueName', this.op.name)\n }\n } else {\n this.op.name = this.store.empConfig.output.uniqueName\n }\n }\n private setMF() {\n const o = this.op\n const {store} = this\n if (o.name) {\n const op = store.deepAssign<ModuleFederationPluginOptions & {empRuntime: any}>(\n {\n filename: 'emp.js',\n manifest: false,\n dts: false,\n dev: {\n disableDynamicRemoteTypeHints: true,\n },\n },\n o,\n )\n //\n if (o.dev === false) op.dev = false\n //\n if (op.empRuntime) {\n delete op.empRuntime\n }\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n }\n private setShareLib() {\n if (!this.op.empRuntime) return\n const {shareLib} = this.op.empRuntime\n const {externalsLib, injectHtml} = this\n if (shareLib && typeof shareLib === 'object') {\n for (const [k, v] of Object.entries(shareLib)) {\n let externalsItem: ExternalsItemType = {}\n externalsItem.module = k\n //增加下划线 支持lodash 等特殊符号的问题 如 _@http\n\n if (typeof v === 'string') {\n const cb: any = v.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n } else {\n externalsItem.global = ''\n externalsItem.entry = v\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n } else if (Array.isArray(v)) {\n v.map(vo => {\n if (!vo) return\n const isCSS = vo.split('?')[0].endsWith('.css')\n if (isCSS) {\n externalsItem.entry = vo\n externalsItem.type = 'css'\n } else {\n const cb: any = vo.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n } else {\n externalsItem.global = ''\n externalsItem.entry = vo\n externalsItem.type = 'js'\n }\n }\n externalsLib.push(externalsItem)\n externalsItem = {}\n })\n } else if (typeof v === 'object' && v.entry) {\n externalsItem.entry = v.entry\n externalsItem.global = v.global\n externalsItem.type = v.type\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n }\n // console.log(externalsLib)\n externalsLib.map(v => {\n if (v.type === 'js') {\n injectHtml.push({\n attributes: {\n src: v.entry,\n },\n tagName: 'script',\n })\n } else if (v.type === 'css') {\n injectHtml.push({\n attributes: {\n href: v.entry,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n })\n }\n }\n}\n","export const externalReact = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n react: `${globalVal}.React`,\n 'react-dom': `${globalVal}.ReactDOM`,\n 'react-dom/client': globalVal,\n 'react/jsx-runtime': globalVal,\n 'react/jsx-dev-runtime': globalVal,\n 'react-router-dom': `${globalVal}.ReactRouterDOM`,\n })\n return o\n}\n","export const externalVue = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n vue: `${globalVal}.Vue`,\n 'vue-router': `${globalVal}.VueRouter`,\n })\n return o\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {EmpShare} from './share'\nimport type {EMPPluginShareType} from './types'\nexport type {EMPPluginShareType}\n//\nexport * from 'src/framework/react/config'\nexport * from 'src/framework/vue/config'\nexport * from './types'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n //\n if (o.manifest === true) {\n o.manifest = {\n fileName: 'emp.json',\n }\n } else if (typeof o.manifest === 'object') {\n o.manifest = store.deepAssign({fileName: 'emp.json'}, o.manifest)\n }\n const empShare = new EmpShare(o, store)\n empShare.setup()\n },\n }\n}\nexport default pluginRspackEmpShare\n"],"mappings":"AAAO,IAAMA,EAAcC,GAAoB,wBAAwBA,CAAO,GAEvE,SAASC,EAAcC,KAAgBC,EAAiB,CAC7D,QAAWC,KAAUD,EACnB,QAAWE,KAAKD,EAAQ,CACtB,IAAME,EAAKF,EAAOC,CAAC,EACjBE,EAAKL,EAAOG,CAAC,EACf,GAAI,OAAOC,CAAE,GAAKA,GAAM,OAAOC,CAAE,IAAMA,EAAI,CACzCL,EAAOG,CAAC,EAAIJ,EAAWM,EAAID,CAAE,EAC7B,QACF,CACAJ,EAAOG,CAAC,EAAID,EAAOC,CAAC,CACtB,CAEF,OAAOH,CACT,CAMO,IAAMM,EAAQ,GACRC,EAAMD,EAAQ,QAAQ,IAAI,KAAK,QAAS,aAAa,EAAI,IAAM,CAAC,ECtBtE,IAAME,EAAkB,oBCA/B,OAAQ,0BAAAC,MAA6B,4BCIrC,IAAMC,EAAuB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AQJ","names":["importJsVm","content","deepAssign","target","sources","source","k","vs","vt","isDev","log","shareGlobalName","ModuleFederationPlugin","getShareRuntimeEntry","url","content","importJsVm","EmpShareRemoteLibPlugin","op","compiler","webpack","entry","getRuntimeLib","host","mode","entry","exp","EmpShare","op","store","injectHtml","url","getRuntimeLib","libs","empRuntime","frameworkGlobal","injectData","framework","frameworkLib","deepAssign","global","shareGlobalName","lib","externalsLib","shareLib","externalRuntime","externals","key","value","version","externalReact","v","EmpShareRemoteLibPlugin","o","ModuleFederationPlugin","k","externalsItem","cb","vo","externalReact","o","globalVal","externalVue","o","globalVal","pluginRspackEmpShare","o","store","EmpShare","rspack_default"]}
|
package/dist/runtime.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleFederation } from '@module-federation/runtime';
|
|
2
|
-
import { E as EMPShareRuntimeType, I as InitOptionsType, a as EmpRuntimeOptions, L as LoadRemoteType } from './index-
|
|
2
|
+
import { E as EMPShareRuntimeType, I as InitOptionsType, a as EmpRuntimeOptions, L as LoadRemoteType } from './index-DaSrQPN9.cjs';
|
|
3
3
|
import '@module-federation/sdk';
|
|
4
4
|
|
|
5
5
|
type EmpInitOptionsType = Partial<InitOptionsType>;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleFederation } from '@module-federation/runtime';
|
|
2
|
-
import { E as EMPShareRuntimeType, I as InitOptionsType, a as EmpRuntimeOptions, L as LoadRemoteType } from './index-
|
|
2
|
+
import { E as EMPShareRuntimeType, I as InitOptionsType, a as EmpRuntimeOptions, L as LoadRemoteType } from './index-DaSrQPN9.js';
|
|
3
3
|
import '@module-federation/sdk';
|
|
4
4
|
|
|
5
5
|
type EmpInitOptionsType = Partial<InitOptionsType>;
|
package/dist/sdk.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of c(t))!f.call(e,n)&&n!==r&&s(e,n,{get:()=>t[n],enumerable:!(a=m(t,n))||a.enumerable});return e};var R=e=>l(s({},"__esModule",{value:!0}),e);var P={};p(P,{createInstance:()=>g,getInstance:()=>u,getReactShare:()=>I,init:()=>d,loadRemote:()=>S,loadShare:()=>v,preloadRemote:()=>b,registerPlugins:()=>y,registerRemotes:()=>x,registerShared:()=>h});module.exports=R(P);var i=window,o=i[i.EMPShareGlobalVal.runtimeLib].MFRuntime,u=o.getInstance,g=o.createInstance,d=o.init,h=o.registerShared,x=o.registerRemotes,y=o.registerPlugins,S=o.loadRemote,b=o.preloadRemote,v=o.loadShare,I=()=>{let{React:e,ReactDOM:t,scope:r="default"}=i[i.EMPShareGlobalVal.frameworkLib];return{react:{lib:()=>e,version:e.version,scope:r,shareConfig:{singleton:!0,requiredVersion:`^${e.version}`}},"react-dom":{lib:()=>t,version:t.version,scope:r,shareConfig:{singleton:!0,requiredVersion:`^${e.version}`}}}};0&&(module.exports={createInstance,getInstance,getReactShare,init,loadRemote,loadShare,preloadRemote,registerPlugins,registerRemotes,registerShared});
|
|
2
|
+
//# sourceMappingURL=sdk.cjs.map
|
package/dist/sdk.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/sdk.ts"],"sourcesContent":["import * as mfRuntime from '@module-federation/runtime'\n\nconst win: any = window\nconst mf = win[win.EMPShareGlobalVal.runtimeLib]['MFRuntime']\n\n//\nexport const getInstance: typeof mfRuntime.getInstance = mf.getInstance\nexport const createInstance: typeof mfRuntime.createInstance = mf.createInstance\nexport const init: typeof mfRuntime.init = mf.init\nexport const registerShared: typeof mfRuntime.registerShared = mf.registerShared\nexport const registerRemotes: typeof mfRuntime.registerRemotes = mf.registerRemotes\nexport const registerPlugins: typeof mfRuntime.registerPlugins = mf.registerPlugins\nexport const loadRemote: typeof mfRuntime.loadRemote = mf.loadRemote\nexport const preloadRemote: typeof mfRuntime.preloadRemote = mf.preloadRemote\nexport const loadShare: typeof mfRuntime.loadShare = mf.loadShare\n\nexport const getReactShare = () => {\n const {React, ReactDOM, scope = 'default'} = win[win.EMPShareGlobalVal.frameworkLib]\n return {\n react: {\n lib: () => React,\n version: React.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n 'react-dom': {\n lib: () => ReactDOM,\n version: ReactDOM.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,gBAAAC,EAAA,kBAAAC,EAAA,SAAAC,EAAA,eAAAC,EAAA,cAAAC,EAAA,kBAAAC,EAAA,oBAAAC,EAAA,oBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAZ,GAEA,IAAMa,EAAW,OACXC,EAAKD,EAAIA,EAAI,kBAAkB,UAAU,EAAE,UAGpCV,EAA4CW,EAAG,YAC/CZ,EAAkDY,EAAG,eACrDT,EAA8BS,EAAG,KACjCH,EAAkDG,EAAG,eACrDJ,EAAoDI,EAAG,gBACvDL,EAAoDK,EAAG,gBACvDR,EAA0CQ,EAAG,WAC7CN,EAAgDM,EAAG,cACnDP,EAAwCO,EAAG,UAE3CV,EAAgB,IAAM,CACjC,GAAM,CAAC,MAAAW,EAAO,SAAAC,EAAU,MAAAC,EAAQ,SAAS,EAAIJ,EAAIA,EAAI,kBAAkB,YAAY,EACnF,MAAO,CACL,MAAO,CACL,IAAK,IAAME,EACX,QAASA,EAAM,QACf,MAAAE,EACA,YAAa,CACX,UAAW,GACX,gBAAiB,IAAIF,EAAM,OAAO,EACpC,CACF,EACA,YAAa,CACX,IAAK,IAAMC,EACX,QAASA,EAAS,QAClB,MAAAC,EACA,YAAa,CACX,UAAW,GACX,gBAAiB,IAAIF,EAAM,OAAO,EACpC,CACF,CACF,CACF","names":["sdk_exports","__export","createInstance","getInstance","getReactShare","init","loadRemote","loadShare","preloadRemote","registerPlugins","registerRemotes","registerShared","__toCommonJS","win","mf","React","ReactDOM","scope"]}
|
package/dist/sdk.d.cts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as mfRuntime from '@module-federation/runtime';
|
|
2
|
+
|
|
3
|
+
declare const getInstance: typeof mfRuntime.getInstance;
|
|
4
|
+
declare const createInstance: typeof mfRuntime.createInstance;
|
|
5
|
+
declare const init: typeof mfRuntime.init;
|
|
6
|
+
declare const registerShared: typeof mfRuntime.registerShared;
|
|
7
|
+
declare const registerRemotes: typeof mfRuntime.registerRemotes;
|
|
8
|
+
declare const registerPlugins: typeof mfRuntime.registerPlugins;
|
|
9
|
+
declare const loadRemote: typeof mfRuntime.loadRemote;
|
|
10
|
+
declare const preloadRemote: typeof mfRuntime.preloadRemote;
|
|
11
|
+
declare const loadShare: typeof mfRuntime.loadShare;
|
|
12
|
+
declare const getReactShare: () => {
|
|
13
|
+
react: {
|
|
14
|
+
lib: () => any;
|
|
15
|
+
version: any;
|
|
16
|
+
scope: any;
|
|
17
|
+
shareConfig: {
|
|
18
|
+
singleton: boolean;
|
|
19
|
+
requiredVersion: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
'react-dom': {
|
|
23
|
+
lib: () => any;
|
|
24
|
+
version: any;
|
|
25
|
+
scope: any;
|
|
26
|
+
shareConfig: {
|
|
27
|
+
singleton: boolean;
|
|
28
|
+
requiredVersion: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { createInstance, getInstance, getReactShare, init, loadRemote, loadShare, preloadRemote, registerPlugins, registerRemotes, registerShared };
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as mfRuntime from '@module-federation/runtime';
|
|
2
|
+
|
|
3
|
+
declare const getInstance: typeof mfRuntime.getInstance;
|
|
4
|
+
declare const createInstance: typeof mfRuntime.createInstance;
|
|
5
|
+
declare const init: typeof mfRuntime.init;
|
|
6
|
+
declare const registerShared: typeof mfRuntime.registerShared;
|
|
7
|
+
declare const registerRemotes: typeof mfRuntime.registerRemotes;
|
|
8
|
+
declare const registerPlugins: typeof mfRuntime.registerPlugins;
|
|
9
|
+
declare const loadRemote: typeof mfRuntime.loadRemote;
|
|
10
|
+
declare const preloadRemote: typeof mfRuntime.preloadRemote;
|
|
11
|
+
declare const loadShare: typeof mfRuntime.loadShare;
|
|
12
|
+
declare const getReactShare: () => {
|
|
13
|
+
react: {
|
|
14
|
+
lib: () => any;
|
|
15
|
+
version: any;
|
|
16
|
+
scope: any;
|
|
17
|
+
shareConfig: {
|
|
18
|
+
singleton: boolean;
|
|
19
|
+
requiredVersion: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
'react-dom': {
|
|
23
|
+
lib: () => any;
|
|
24
|
+
version: any;
|
|
25
|
+
scope: any;
|
|
26
|
+
shareConfig: {
|
|
27
|
+
singleton: boolean;
|
|
28
|
+
requiredVersion: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { createInstance, getInstance, getReactShare, init, loadRemote, loadShare, preloadRemote, registerPlugins, registerRemotes, registerShared };
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var o=window,e=o[o.EMPShareGlobalVal.runtimeLib].MFRuntime,i=e.getInstance,s=e.createInstance,a=e.init,m=e.registerShared,c=e.registerRemotes,f=e.registerPlugins,p=e.loadRemote,l=e.preloadRemote,R=e.loadShare,u=()=>{let{React:t,ReactDOM:r,scope:n="default"}=o[o.EMPShareGlobalVal.frameworkLib];return{react:{lib:()=>t,version:t.version,scope:n,shareConfig:{singleton:!0,requiredVersion:`^${t.version}`}},"react-dom":{lib:()=>r,version:r.version,scope:n,shareConfig:{singleton:!0,requiredVersion:`^${t.version}`}}}};export{s as createInstance,i as getInstance,u as getReactShare,a as init,p as loadRemote,R as loadShare,l as preloadRemote,f as registerPlugins,c as registerRemotes,m as registerShared};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
package/dist/sdk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/sdk.ts"],"sourcesContent":["import * as mfRuntime from '@module-federation/runtime'\n\nconst win: any = window\nconst mf = win[win.EMPShareGlobalVal.runtimeLib]['MFRuntime']\n\n//\nexport const getInstance: typeof mfRuntime.getInstance = mf.getInstance\nexport const createInstance: typeof mfRuntime.createInstance = mf.createInstance\nexport const init: typeof mfRuntime.init = mf.init\nexport const registerShared: typeof mfRuntime.registerShared = mf.registerShared\nexport const registerRemotes: typeof mfRuntime.registerRemotes = mf.registerRemotes\nexport const registerPlugins: typeof mfRuntime.registerPlugins = mf.registerPlugins\nexport const loadRemote: typeof mfRuntime.loadRemote = mf.loadRemote\nexport const preloadRemote: typeof mfRuntime.preloadRemote = mf.preloadRemote\nexport const loadShare: typeof mfRuntime.loadShare = mf.loadShare\n\nexport const getReactShare = () => {\n const {React, ReactDOM, scope = 'default'} = win[win.EMPShareGlobalVal.frameworkLib]\n return {\n react: {\n lib: () => React,\n version: React.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n 'react-dom': {\n lib: () => ReactDOM,\n version: ReactDOM.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n }\n}\n"],"mappings":"AAEA,IAAMA,EAAW,OACXC,EAAKD,EAAIA,EAAI,kBAAkB,UAAU,EAAE,UAGpCE,EAA4CD,EAAG,YAC/CE,EAAkDF,EAAG,eACrDG,EAA8BH,EAAG,KACjCI,EAAkDJ,EAAG,eACrDK,EAAoDL,EAAG,gBACvDM,EAAoDN,EAAG,gBACvDO,EAA0CP,EAAG,WAC7CQ,EAAgDR,EAAG,cACnDS,EAAwCT,EAAG,UAE3CU,EAAgB,IAAM,CACjC,GAAM,CAAC,MAAAC,EAAO,SAAAC,EAAU,MAAAC,EAAQ,SAAS,EAAId,EAAIA,EAAI,kBAAkB,YAAY,EACnF,MAAO,CACL,MAAO,CACL,IAAK,IAAMY,EACX,QAASA,EAAM,QACf,MAAAE,EACA,YAAa,CACX,UAAW,GACX,gBAAiB,IAAIF,EAAM,OAAO,EACpC,CACF,EACA,YAAa,CACX,IAAK,IAAMC,EACX,QAASA,EAAS,QAClB,MAAAC,EACA,YAAa,CACX,UAAW,GACX,gBAAiB,IAAIF,EAAM,OAAO,EACpC,CACF,CACF,CACF","names":["win","mf","getInstance","createInstance","init","registerShared","registerRemotes","registerPlugins","loadRemote","preloadRemote","loadShare","getReactShare","React","ReactDOM","scope"]}
|
package/dist/vue.d.cts
CHANGED
package/dist/vue.d.ts
CHANGED
package/output/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var EMP_SHARE_RUNTIME=function(exports){"use strict";var bt=Object.defineProperty,pr=Object.defineProperties,mr=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable,gt=(e,t,r)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>{for(var r in t||(t={}))Rt.call(t,r)&>(e,r,t[r]);if(ye)for(var r of ye(t))St.call(t,r)&>(e,r,t[r]);return e},M=(e,t)=>pr(e,mr(t)),xe=(e,t)=>{var r={};for(var o in e)Rt.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&ye)for(var o of ye(e))t.indexOf(o)<0&&St.call(e,o)&&(r[o]=e[o]);return r},It=(e,t)=>{for(var r in t)bt(e,r,{get:t[r],enumerable:!0})},Et={};It(Et,{Module:()=>oe,ModuleFederation:()=>Y,createInstance:()=>hr,getInstance:()=>ao,getRemoteEntry:()=>ne,getRemoteInfo:()=>pe,init:()=>eo,loadRemote:()=>to,loadScript:()=>J,loadScriptNode:()=>Z,loadShare:()=>ro,loadShareSync:()=>no,preloadRemote:()=>oo,registerGlobalPlugins:()=>Xt,registerPlugins:()=>io,registerRemotes:()=>so,registerShared:()=>co});var Ye={};It(Ye,{BROWSER_LOG_KEY:()=>$t,ENCODE_NAME_PREFIX:()=>gr,EncodedNameTransformMap:()=>Ee,FederationModuleManifest:()=>yr,MANIFEST_EXT:()=>Be,MFModuleType:()=>_r,MFPrefetchCommon:()=>Rr,MODULE_DEVTOOL_IDENTIFIER:()=>Er,ManifestFileName:()=>Ue,NameTransformMap:()=>k,NameTransformSymbol:()=>w,SEPARATOR:()=>We,StatsFileName:()=>je,TEMP_DIR:()=>br,assert:()=>Mr,bindLoggerToCompiler:()=>Hr,composeKeyWithSeparator:()=>Re,containerPlugin:()=>Sr,containerReferencePlugin:()=>Ir,createInfrastructureLogger:()=>Ot,createLink:()=>le,createLogger:()=>Ne,createModuleFederationConfig:()=>jr,createScript:()=>Te,createScriptNode:()=>Lt,decodeName:()=>Ar,encodeName:()=>Ke,error:()=>wt,generateExposeFilename:()=>Pr,generateShareFilename:()=>Or,generateSnapshotFromManifest:()=>qe,getManifestFileName:()=>vr,getProcessEnv:()=>Nt,getResourceUrl:()=>ce,inferAutoPublicPath:()=>At,infrastructureLogger:()=>xr,isBrowserEnv:()=>U,isDebugMode:()=>ae,isManifestProvider:()=>$e,isReactNativeEnv:()=>be,isRequiredVersion:()=>Fr,isStaticResourcesEqual:()=>Xe,loadScript:()=>J,loadScriptNode:()=>Z,logger:()=>Cr,moduleFederationPlugin:()=>$r,normalizeOptions:()=>Ur,parseEntry:()=>wr,safeToString:()=>Ie,safeWrapper:()=>ze,sharePlugin:()=>Nr,simpleJoinRemoteEntry:()=>z,warn:()=>Se});var yr="federation-manifest.json",Be=".json",$t="FEDERATION_DEBUG",w={AT:"@",HYPHEN:"-",SLASH:"/"},k={[w.AT]:"scope_",[w.HYPHEN]:"_",[w.SLASH]:"__"},Ee={[k[w.AT]]:w.AT,[k[w.HYPHEN]]:w.HYPHEN,[k[w.SLASH]]:w.SLASH},We=":",Ue="mf-manifest.json",je="mf-stats.json",_r={NPM:"npm",APP:"app"},Er="__MF_DEVTOOLS_MODULE_INFO__",gr="ENCODE_NAME_PREFIX",br=".federation",Rr={identifier:"MFDataPrefetch",globalKey:"__PREFETCH__",library:"mf-data-prefetch",exportsKey:"__PREFETCH_EXPORTS__",fileName:"bootstrap.js"},Sr=Object.freeze({__proto__:null}),Ir=Object.freeze({__proto__:null}),$r=Object.freeze({__proto__:null}),Nr=Object.freeze({__proto__:null});function U(){return"undefined"!=typeof window&&void 0!==window.document}function be(){return"undefined"!=typeof navigator&&"ReactNative"===(null==navigator?void 0:navigator.product)}function Tr(){try{if(U()&&window.localStorage)return!!localStorage.getItem($t)}catch(e){return!1}return!1}function ae(){return"undefined"!=typeof process&&process.env,Tr()}var Nt=function(){return"undefined"!=typeof process&&process.env?process.env:{}},Tt="[ Federation Runtime ]",wr=(e,t,r=We)=>{let o=e.split(r),n="development"===Nt().NODE_ENV&&t,i=e=>e.startsWith("http")||e.includes(Be);if(o.length>=2){let[t,...a]=o;e.startsWith(r)&&(t=o.slice(0,2).join(r),a=[n||o.slice(2).join(r)]);let s=n||a.join(r);return i(s)?{name:t,entry:s}:{name:t,version:s||"*"}}if(1===o.length){let[e]=o;return n&&i(n)?{name:e,entry:n}:{name:e,version:n||"*"}}throw`Invalid entry value: ${e}`},Re=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}${We}${t}`:t:e,""):""},Ke=function(e,t="",r=!1){try{let o=r?".js":"";return`${t}${e.replace(new RegExp(`${w.AT}`,"g"),k[w.AT]).replace(new RegExp(`${w.HYPHEN}`,"g"),k[w.HYPHEN]).replace(new RegExp(`${w.SLASH}`,"g"),k[w.SLASH])}${o}`}catch(e){throw e}},Ar=function(e,t,r){try{let o=e;if(t){if(!o.startsWith(t))return o;o=o.replace(new RegExp(t,"g"),"")}return o=o.replace(new RegExp(`${k[w.AT]}`,"g"),Ee[k[w.AT]]).replace(new RegExp(`${k[w.SLASH]}`,"g"),Ee[k[w.SLASH]]).replace(new RegExp(`${k[w.HYPHEN]}`,"g"),Ee[k[w.HYPHEN]]),r&&(o=o.replace(".js","")),o}catch(e){throw e}},Pr=(e,t)=>{if(!e)return"";let r=e;return"."===r&&(r="default_export"),r.startsWith("./")&&(r=r.replace("./","")),Ke(r,"__federation_expose_",t)},Or=(e,t)=>e?Ke(e,"__federation_shared_",t):"",ce=(e,t)=>{if("getPublicPath"in e){let r;return r=e.getPublicPath.startsWith("function")?new Function("return "+e.getPublicPath)()():new Function(e.getPublicPath)(),`${r}${t}`}return"publicPath"in e?U()||be()||!("ssrPublicPath"in e)?`${e.publicPath}${t}`:`${e.ssrPublicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")},Mr=(e,t)=>{e||wt(t)},wt=e=>{throw new Error(`${Tt}: ${e}`)},Se=e=>{console.warn(`${Tt}: ${e}`)};function Ie(e){try{return JSON.stringify(e,null,2)}catch(e){return""}}var Lr=/^([\d^=v<>~]|[*xX]$)/;function Fr(e){return Lr.test(e)}var z=(e,t)=>{if(!e)return t;let r=(e=>{if("."===e)return"";if(e.startsWith("./"))return e.replace("./","");if(e.startsWith("/")){let t=e.slice(1);return t.endsWith("/")?t.slice(0,-1):t}return e})(e);return r?r.endsWith("/")?`${r}${t}`:`${r}/${t}`:t};function At(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function qe(e,t={}){var r,o,n;let i,{remotes:a={},overrides:s={},version:l}=t,c=()=>"publicPath"in e.metaData?"auto"===e.metaData.publicPath&&l?At(l):e.metaData.publicPath:e.metaData.getPublicPath,u=Object.keys(s),m={};Object.keys(a).length||(m=(null==(r=e.remotes)?void 0:r.reduce((e,t)=>{let r,o=t.federationContainerName;return r=u.includes(o)?s[o]:"version"in t?t.version:t.entry,e[o]={matchedVersion:r},e},{}))||{}),Object.keys(a).forEach(e=>m[e]={matchedVersion:u.includes(e)?s[e]:a[e]});let{remoteEntry:{path:h,name:f,type:p},types:d={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:y},globalName:_,ssrRemoteEntry:g}=e.metaData,{exposes:E}=e,b={version:l||"",buildVersion:y,globalName:_,remoteEntry:z(h,f),remoteEntryType:p,remoteTypes:z(d.path,d.name),remoteTypesZip:d.zip||"",remoteTypesAPI:d.api||"",remotesInfo:m,shared:null==e?void 0:e.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version})),modules:null==E?void 0:E.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if(null!=(o=e.metaData)&&o.prefetchInterface){let t=e.metaData.prefetchInterface;b=M(R({},b),{prefetchInterface:t})}if(null!=(n=e.metaData)&&n.prefetchEntry){let{path:t,name:r,type:o}=e.metaData.prefetchEntry;b=M(R({},b),{prefetchEntry:z(t,r),prefetchEntryType:o})}if(i="publicPath"in e.metaData?M(R({},b),{publicPath:c(),ssrPublicPath:e.metaData.ssrPublicPath}):M(R({},b),{getPublicPath:c()}),g){let e=z(g.path,g.name);i.ssrRemoteEntry=e,i.ssrRemoteEntryType=g.type||"commonjs-module"}return i}function $e(e){return!(!("remoteEntry"in e)||!e.remoteEntry.includes(Be))}function vr(e){if(!e)return{statsFileName:je,manifestFileName:Ue};let t="boolean"==typeof e?"":e.filePath||"",r="boolean"==typeof e?"":e.fileName||"",o=".json",n=r?(a=r).endsWith(o)?a:`${a}${o}`:Ue,i=r?((e,t)=>e.replace(o,`${t}${o}`))(n,"-stats"):je;var a;return{statsFileName:z(t,i),manifestFileName:z(t,n)}}var Pt="[ Module Federation ]",se=console,Dr=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function kr(){try{let e=(new Error).stack;if(!e)return;let[,...t]=e.split("\n"),r=t.filter(e=>!Dr.some(t=>e.includes(t)));return r.length?`Stack trace:\n${r.slice(0,5).join("\n")}`:void 0}catch(e){return}}var ge=class{constructor(e,t=se){this.prefix=e,this.delegate=null!=t?t:se}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=null!=e?e:se}emit(e,t){let r=this.delegate,o=ae()?kr():void 0,n=o?[...t,o]:t,i=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(let e of i){let t=r[e];if("function"==typeof t)return void t.call(r,this.prefix,...n)}for(let e of i){let t=se[e];if("function"==typeof t)return void t.call(se,this.prefix,...n)}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){ae()&&this.emit("debug",e)}};function Ne(e){return new ge(e)}function Ot(e){let t=new ge(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}function Hr(e,t,r){if(e.__mf_infrastructure_logger__&&null!=t&&t.getInfrastructureLogger)try{let o=t.getInfrastructureLogger(r);o&&"object"==typeof o&&("function"==typeof o.log||"function"==typeof o.info||"function"==typeof o.warn||"function"==typeof o.error)&&e.setDelegate(o)}catch(t){e.setDelegate(void 0)}}var Cr=Ne(Pt),xr=Ot(Pt);async function ze(e,t){try{return await e()}catch(e){return void(!t&&Se(e))}}function Xe(e,t){let r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function Te(e){let t,r=null,o=!0,n=2e4,i=document.getElementsByTagName("script");for(let t=0;t<i.length;t++){let n=i[t],a=n.getAttribute("src");if(a&&Xe(a,e.url)){r=n,o=!1;break}}if(!r){let t,o=e.attrs;r=document.createElement("script"),r.type="module"===(null==o?void 0:o.type)?"module":"text/javascript",e.createScriptHook&&(t=e.createScriptHook(e.url,e.attrs),t instanceof HTMLScriptElement?r=t:"object"==typeof t&&("script"in t&&t.script&&(r=t.script),"timeout"in t&&t.timeout&&(n=t.timeout))),r.src||(r.src=e.url),o&&!t&&Object.keys(o).forEach(e=>{r&&("async"===e||"defer"===e?r[e]=o[e]:r.getAttribute(e)||r.setAttribute(e,o[e]))})}let a=async(o,n)=>{clearTimeout(t);let i=()=>{"error"===(null==n?void 0:n.type)?null!=e&&e.onErrorCallback&&(null==e||e.onErrorCallback(n)):null!=e&&e.cb&&(null==e||e.cb())};if(r&&(r.onerror=null,r.onload=null,ze(()=>{let{needDeleteScript:t=!0}=e;t&&null!=r&&r.parentNode&&r.parentNode.removeChild(r)}),o&&"function"==typeof o)){let e=o(n);if(e instanceof Promise){let t=await e;return i(),t}return i(),e}i()};return r.onerror=a.bind(null,r.onerror),r.onload=a.bind(null,r.onload),t=setTimeout(()=>{a(null,new Error(`Remote script "${e.url}" time-outed.`))},n),{script:r,needAttach:o}}function le(e){let t=null,r=!0,o=document.getElementsByTagName("link");for(let n=0;n<o.length;n++){let i=o[n],a=i.getAttribute("href"),s=i.getAttribute("rel");if(a&&Xe(a,e.url)&&s===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let r,o=e.attrs;e.createLinkHook&&(r=e.createLinkHook(e.url,o),r instanceof HTMLLinkElement&&(t=r)),o&&!r&&Object.keys(o).forEach(e=>{t&&!t.getAttribute(e)&&t.setAttribute(e,o[e])})}let n=(r,o)=>{let n=()=>{"error"===(null==o?void 0:o.type)?null!=e&&e.onErrorCallback&&(null==e||e.onErrorCallback(o)):null!=e&&e.cb&&(null==e||e.cb())};if(t&&(t.onerror=null,t.onload=null,ze(()=>{let{needDeleteLink:r=!0}=e;r&&null!=t&&t.parentNode&&t.parentNode.removeChild(t)}),r)){let e=r(o);return n(),e}n()};return t.onerror=n.bind(null,t.onerror),t.onload=n.bind(null,t.onload),{link:t,needAttach:r}}function J(e,t){let{attrs:r={},createScriptHook:o}=t;return new Promise((t,n)=>{let{script:i,needAttach:a}=Te({url:e,cb:t,onErrorCallback:n,attrs:R({fetchpriority:"high"},r),createScriptHook:o,needDeleteScript:!0});a&&document.head.appendChild(i)})}var _e=new Map;function ie(e){if(!e)throw new Error("import specifier is required");if(_e.has(e))return _e.get(e);let t=new Function("name","return import(name)")(e).then(e=>e).catch(t=>{throw console.error(`Error importing module ${e}:`,t),_e.delete(e),t});return _e.set(e,t),t}var Mt=async()=>{let e=await ie("node-fetch");return e.default||e},Gr=async(e,t,r)=>{let o=await(n=e,i=t||{},r.lifecycle.fetch.emit(n,i));var n,i;return o&&o instanceof Response?o:("undefined"==typeof fetch?await Mt():fetch)(e,t||{})},Lt="undefined"==typeof ENV_TARGET||"web"!==ENV_TARGET?(url,cb,attrs,loaderHook)=>{if(null!=loaderHook&&loaderHook.createScriptHook){let e=loaderHook.createScriptHook(url);e&&"object"==typeof e&&"url"in e&&(url=e.url)}let urlObj;try{urlObj=new URL(url)}catch(e){return console.error("Error constructing URL:",e),void cb(new Error(`Invalid URL: ${e}`))}let getFetch=async()=>null!=loaderHook&&loaderHook.fetch?(e,t)=>Gr(e,t,loaderHook):"undefined"==typeof fetch?Mt():fetch,handleScriptFetch=async(f,urlObj)=>{var t,e;try{let res=await f(urlObj.href),data=await res.text(),[path,vm]=await Promise.all([ie("path"),ie("vm")]),scriptContext={exports:{},module:{exports:{}}},urlDirname=urlObj.pathname.split("/").slice(0,-1).join("/"),filename=path.basename(urlObj.pathname),script=new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`,{filename:filename,importModuleDynamically:null!=(e=null==(t=vm.constants)?void 0:t.USE_MAIN_CONTEXT_DEFAULT_LOADER)?e:ie});script.runInThisContext()(scriptContext.exports,scriptContext.module,eval("require"),urlDirname,filename);let exportedInterface=scriptContext.module.exports||scriptContext.exports;if(attrs&&exportedInterface&&attrs.globalName){let e=exportedInterface[attrs.globalName]||exportedInterface;return void cb(void 0,e)}cb(void 0,exportedInterface)}catch(e){cb(e instanceof Error?e:new Error(`Script execution error: ${e}`))}};getFetch().then(async e=>{if("esm"===(null==attrs?void 0:attrs.type)||"module"===(null==attrs?void 0:attrs.type))return Ve(urlObj.href,{fetch:e,vm:await ie("vm")}).then(async e=>{await e.evaluate(),cb(void 0,e.namespace)}).catch(e=>{cb(e instanceof Error?e:new Error(`Script execution error: ${e}`))});handleScriptFetch(e,urlObj)}).catch(e=>{cb(e)})}:(e,t,r,o)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},Z="undefined"==typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t)=>new Promise((r,o)=>{Lt(e,(e,n)=>{var i,a;if(e)o(e);else{let e=(null==(i=null==t?void 0:t.attrs)?void 0:i.globalName)||`__FEDERATION_${null==(a=null==t?void 0:t.attrs)?void 0:a.name}:custom__`,o=globalThis[e]=n;r(o)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},Ge=new Map;async function Ve(e,t){if(Ge.has(e))return Ge.get(e);let{fetch:r,vm:o}=t,n=await(await r(e)).text(),i=new o.SourceTextModule(n,{importModuleDynamically:async(r,o)=>Ve(new URL(r,e).href,t)});return Ge.set(e,i),await i.link(async r=>{let o=new URL(r,e).href;return await Ve(o,t)}),i}function Ur(e,t,r){return function(o){if(!1===o)return!1;if(void 0===o)return!!e&&t;if(!0===o)return t;if(o&&"object"==typeof o)return R(R({},t),o);throw new Error(`Unexpected type for \`${r}\`, expect boolean/undefined/object, got: ${typeof o}`)}}var jr=e=>e,Je="RUNTIME-001",Ze="RUNTIME-002",Qe="RUNTIME-003",et="RUNTIME-004",tt="RUNTIME-005",we="RUNTIME-006",rt="RUNTIME-007",Ae="RUNTIME-008",K="RUNTIME-009",Vr="TYPE-001",Br="BUILD-001",Wr="BUILD-002",Kr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}/${e}`,L=(e,t,r,o)=>{let n=[`${[t[e]]} #${e}`];return r&&n.push(`args: ${JSON.stringify(r)}`),n.push(Kr(e)),o&&n.push(`Original Error Message:\n ${o}`),n.join("\n")},O={[Je]:"Failed to get remoteEntry exports.",[Ze]:'The remote entry interface does not contain "init"',[Qe]:"Failed to get manifest.",[et]:"Failed to locate remote.",[tt]:"Invalid loadShareSync function call from bundler runtime",[we]:"Invalid loadShareSync function call from runtime",[rt]:"Failed to get remote snapshot.",[Ae]:"Failed to load script resources.",[K]:"Please call createInstance first."},qr={[Vr]:"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."},zr={[Br]:"Failed to find expose module.",[Wr]:"PublicPath is required in prod mode."};R(R(R({},O),qr),zr);var ee="[ Federation Runtime ]",it=Ne(ee);function A(e,t){e||B(t)}function B(e){throw e instanceof Error?(e.message.startsWith(ee)||(e.message=`${ee}: ${e.message}`),e):new Error(`${ee}: ${e}`)}function He(e){e instanceof Error&&(e.message.startsWith(ee)||(e.message=`${ee}: ${e.message}`)),it.warn(e)}function Ft(e,t){return-1===e.findIndex(e=>e===t)&&e.push(t),e}function fe(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function ft(e){return void 0!==e.entry}function jt(e){return!e.entry.includes(".json")}function dt(e){return e&&"object"==typeof e}var Xr=Object.prototype.toString;function Yr(e){return"[object Object]"===Xr.call(e)}function Vt(e){return Array.isArray(e)?e:[e]}function Bt(e){let t={url:"",type:"global",globalName:""};return U()||be()?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}var Jr=(e,t)=>{let r;return r=e.endsWith("/")?e.slice(0,-1):e,t.startsWith(".")&&(t=t.slice(1)),r+=t,r},P="object"==typeof globalThis?globalThis:window,x=(()=>{try{return document.defaultView}catch(e){return P}})(),de=x;function Oe(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function Me(e,t){return Object.hasOwnProperty.call(e,t)}Me(P,"__GLOBAL_LOADING_REMOTE_ENTRY__")||Oe(P,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});var Q=P.__GLOBAL_LOADING_REMOTE_ENTRY__;function Wt(e){var t,r,o,n,i,a;Me(e,"__VMOK__")&&!Me(e,"__FEDERATION__")&&Oe(e,"__FEDERATION__",e.__VMOK__),Me(e,"__FEDERATION__")||(Oe(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),Oe(e,"__VMOK__",e.__FEDERATION__)),null!=(t=e.__FEDERATION__).__GLOBAL_PLUGIN__||(t.__GLOBAL_PLUGIN__=[]),null!=(r=e.__FEDERATION__).__INSTANCES__||(r.__INSTANCES__=[]),null!=(o=e.__FEDERATION__).moduleInfo||(o.moduleInfo={}),null!=(n=e.__FEDERATION__).__SHARE__||(n.__SHARE__={}),null!=(i=e.__FEDERATION__).__MANIFEST_LOADING__||(i.__MANIFEST_LOADING__={}),null!=(a=e.__FEDERATION__).__PRELOADED_MAP__||(a.__PRELOADED_MAP__=new Map)}function Kt(e){P.__FEDERATION__.__INSTANCES__.push(e)}function qt(){return P.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function zt(e,t=ae()){t&&(P.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,P.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.21.4")}function te(e,t){if("string"==typeof t){if(e[t])return{value:e[t],key:t};{let r=Object.keys(e);for(let o of r){let[r,n]=o.split(":"),i=`${r}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}throw new Error("key must be string")}Wt(P),Wt(x);var vt=()=>x.__FEDERATION__.moduleInfo,Zr=(e,t)=>{let r=te(t,fe(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){let t=e,{version:r}=t,o=fe(xe(t,["version"])),n=te(x.__FEDERATION__.moduleInfo,o).value;if((null==n?void 0:n.version)===r)return n}},Le=e=>Zr(e,x.__FEDERATION__.moduleInfo),Dt=(e,t)=>{let r=fe(e);return x.__FEDERATION__.moduleInfo[r]=t,x.__FEDERATION__.moduleInfo},Qr=e=>(x.__FEDERATION__.moduleInfo=R(R({},x.__FEDERATION__.moduleInfo),e),()=>{let t=Object.keys(e);for(let e of t)delete x.__FEDERATION__.moduleInfo[e]}),ht=(e,t)=>{let r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:P[r]}},Xt=e=>{let{__GLOBAL_PLUGIN__:t}=x.__FEDERATION__;e.forEach(e=>{-1===t.findIndex(t=>t.name===e.name)?t.push(e):He(`The plugin ${e.name} has been registered.`)})},en=()=>x.__FEDERATION__.__GLOBAL_PLUGIN__,tn=e=>P.__FEDERATION__.__PRELOADED_MAP__.get(e),rn=e=>P.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),me="default",Yt="global",kt="[0-9A-Za-z-]+",pt=`(?:\\+(${kt}(?:\\.${kt})*))`,ue="0|[1-9]\\d*",Fe="[0-9]+",Jt="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Ht=`(?:${Fe}|${Jt})`,nn=`(?:-?(${Ht}(?:\\.${Ht})*))`,Ct=`(?:${ue}|${Jt})`,Zt=`(?:-(${Ct}(?:\\.${Ct})*))`,nt=`${ue}|x|X|\\*`,re=`[v=\\s]*(${nt})(?:\\.(${nt})(?:\\.(${nt})(?:${Zt})?${pt}?)?)?`,on=`^\\s*(${re})\\s+-\\s+(${re})\\s*$`,sn=`(${Fe})\\.(${Fe})\\.(${Fe})`,an=`[v=\\s]*${sn}${nn}?${pt}?`,mt="((?:<|>)?=?)",cn=`(\\s*)${mt}\\s*(${an}|${re})`,Qt="(?:~>?)",ln=`(\\s*)${Qt}\\s+`,er="(?:\\^)",un=`(\\s*)${er}\\s+`,fn="(<|>)?=?\\s*\\*",dn=`^${er}${re}$`,hn=`(${ue})\\.(${ue})\\.(${ue})`,pn=`v?${hn}${Zt}?${pt}?`,mn=`^${Qt}${re}$`,yn=`^${mt}\\s*${re}$`,_n=`^${mt}\\s*(${pn})$|^$`,En="^\\s*>=\\s*0.0.0\\s*$";function W(e){return new RegExp(e)}function v(e){return!e||"x"===e.toLowerCase()||"*"===e}function tr(...e){return t=>e.reduce((e,t)=>t(e),t)}function xt(e){return e.match(W(_n))}function Gt(e,t,r,o){let n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function gn(e){return e.replace(W(on),(e,t,r,o,n,i,a,s,l,c,u,m)=>`${t=v(r)?"":v(o)?`>=${r}.0.0`:v(n)?`>=${r}.${o}.0`:`>=${t}`} ${s=v(l)?"":v(c)?`<${Number(l)+1}.0.0-0`:v(u)?`<${l}.${Number(c)+1}.0-0`:m?`<=${l}.${c}.${u}-${m}`:`<=${s}`}`.trim())}function bn(e){return e.replace(W(cn),"$1$2$3")}function Rn(e){return e.replace(W(ln),"$1~")}function Sn(e){return e.replace(W(un),"$1^")}function In(e){return e.trim().split(/\s+/).map(e=>e.replace(W(dn),(e,t,r,o,n)=>v(t)?"":v(r)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:v(o)?"0"===t?`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.0 <${Number(t)+1}.0.0-0`:n?"0"===t?"0"===r?`>=${t}.${r}.${o}-${n} <${t}.${r}.${Number(o)+1}-0`:`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o}-${n} <${Number(t)+1}.0.0-0`:"0"===t?"0"===r?`>=${t}.${r}.${o} <${t}.${r}.${Number(o)+1}-0`:`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o} <${Number(t)+1}.0.0-0`)).join(" ")}function $n(e){return e.trim().split(/\s+/).map(e=>e.replace(W(mn),(e,t,r,o,n)=>v(t)?"":v(r)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:v(o)?`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`:n?`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`)).join(" ")}function Nn(e){return e.split(/\s+/).map(e=>e.trim().replace(W(yn),(e,t,r,o,n,i)=>{let a=v(r),s=a||v(o),l=s||v(n);return"="===t&&l&&(t=""),i="",a?">"===t||"<"===t?"<0.0.0-0":"*":t&&l?(s&&(o=0),n=0,">"===t?(t=">=",s?(r=Number(r)+1,o=0,n=0):(o=Number(o)+1,n=0)):"<="===t&&(t="<",s?r=Number(r)+1:o=Number(o)+1),"<"===t&&(i="-0"),`${t+r}.${o}.${n}${i}`):s?`>=${r}.0.0${i} <${Number(r)+1}.0.0-0`:l?`>=${r}.${o}.0${i} <${r}.${Number(o)+1}.0-0`:e})).join(" ")}function Tn(e){return e.trim().replace(W(fn),"")}function wn(e){return e.trim().replace(W(En),"")}function ve(e,t){return(e=Number(e)||e)>(t=Number(t)||t)?1:e===t?0:-1}function An(e,t){let{preRelease:r}=e,{preRelease:o}=t;if(void 0===r&&o)return 1;if(r&&void 0===o)return-1;if(void 0===r&&void 0===o)return 0;for(let e=0,t=r.length;e<=t;e++){let t=r[e],n=o[e];if(t!==n)return void 0===t&&void 0===n?0:t?n?ve(t,n):-1:1}return 0}function Pe(e,t){return ve(e.major,t.major)||ve(e.minor,t.minor)||ve(e.patch,t.patch)||An(e,t)}function ot(e,t){return e.version===t.version}function Pn(e,t){switch(e.operator){case"":case"=":return ot(e,t);case">":return Pe(e,t)<0;case">=":return ot(e,t)||Pe(e,t)<0;case"<":return Pe(e,t)>0;case"<=":return ot(e,t)||Pe(e,t)>0;case void 0:return!0;default:return!1}}function On(e){return tr(In,$n,Nn,Tn)(e)}function Mn(e){return tr(gn,bn,Rn,Sn)(e.trim()).split(/\s+/).join(" ")}function De(e,t){if(!e)return!1;let r=xt(e);if(!r)return!1;let[,o,,n,i,a,s]=r,l={operator:o,version:Gt(n,i,a,s),major:n,minor:i,patch:a,preRelease:null==s?void 0:s.split(".")},c=t.split("||");for(let e of c){let t=e.trim();if(!t||"*"===t||"x"===t)return!0;try{let e=Mn(t);if(!e.trim())return!0;let r=e.split(" ").map(e=>On(e)).join(" ");if(!r.trim())return!0;let o=r.split(/\s+/).map(e=>wn(e)).filter(Boolean);if(0===o.length)continue;let n=!0;for(let e of o){let t=xt(e);if(!t){n=!1;break}let[,r,,o,i,a,s]=t;if(!Pn({operator:r,version:Gt(o,i,a,s),major:o,minor:i,patch:a,preRelease:null==s?void 0:s.split(".")},l)){n=!1;break}}if(n)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}function Ln(e,t,r,o){var n,i,a;let s;return s="get"in e?e.get:"lib"in e?()=>Promise.resolve(e.lib):()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${r}'!`)}),M(R({deps:[],useIn:[],from:t,loading:null},e),{shareConfig:R({requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1},e.shareConfig),get:s,loaded:!!(null!=e&&e.loaded||"lib"in e)||void 0,version:null!=(n=e.version)?n:"0",scope:Array.isArray(e.scope)?e.scope:[null!=(i=e.scope)?i:"default"],strategy:(null!=(a=e.strategy)?a:o)||"version-first"})}function rr(e,t){let r=t.shared||{},o=t.name,n=Object.keys(r).reduce((e,n)=>{let i=Vt(r[n]);return e[n]=e[n]||[],i.forEach(r=>{e[n].push(Ln(r,o,n,t.shareStrategy))}),e},{}),i=R({},e.shared);return Object.keys(n).forEach(e=>{i[e]?n[e].forEach(t=>{i[e].find(e=>e.version===t.version)||i[e].push(t)}):i[e]=n[e]}),{shared:i,shareInfos:n}}function he(e,t){let r=e=>{if(!Number.isNaN(Number(e))){let t=e.split("."),r=e;for(let e=0;e<3-t.length;e++)r+=".0";return r}return e};return!!De(r(e),`<=${r(t)}`)}var yt=(e,t)=>{let r=t||function(e,t){return he(e,t)};return Object.keys(e).reduce((e,t)=>!e||r(e,t)||"0"===e?t:e,0)},_t=e=>!!e.loaded||"function"==typeof e.lib,Fn=e=>!!e.loading;function vn(e,t,r){let o=e[t][r];return yt(e[t][r],function(e,t){return!_t(o[e])&&he(e,t)})}function Dn(e,t,r){let o=e[t][r];return yt(e[t][r],function(e,t){let r=e=>_t(e)||Fn(e);return r(o[t])?!r(o[e])||!!he(e,t):!r(o[e])&&he(e,t)})}function kn(e){return"loaded-first"===e?Dn:vn}function ke(e,t,r,o){if(!e)return;let{shareConfig:n,scope:i=me,strategy:a}=r,s=Array.isArray(i)?i:[i];for(let i of s)if(n&&e[i]&&e[i][t]){let{requiredVersion:s}=n,l=kn(a)(e,i,t),c=()=>{if(n.singleton){if("string"==typeof s&&!De(l,s)){let o=`Version ${l} from ${l&&e[i][t][l].from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${s})`;n.strictVersion?B(o):He(o)}return e[i][t][l]}if(!1===s||"*"===s||De(l,s))return e[i][t][l];for(let[r,o]of Object.entries(e[i][t]))if(De(r,s))return o},u={shareScopeMap:e,scope:i,pkgName:t,version:l,GlobalFederation:de.__FEDERATION__,resolver:c};return(o.emit(u)||u).resolver()}}function nr(){return de.__FEDERATION__.__SHARE__}function Ut(e){var t;let{pkgName:r,extraOptions:o,shareInfos:n}=e,i=null!=(t=null==o?void 0:o.resolver)?t:e=>{if(!e)return;let t={};e.forEach(e=>{t[e.version]=e});let r=yt(t,function(e,r){return!_t(t[e])&&he(e,r)});return t[r]};return Object.assign({},i(n[r]),null==o?void 0:o.customShareInfo)}function Hn(){return"undefined"!=typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:""}function Cn(e,t){for(let r of e){let e=t.startsWith(r.name),o=t.replace(r.name,"");if(e){if(o.startsWith("/")){return o=`.${o}`,{pkgNameOrAlias:r.name,expose:o,remote:r}}if(""===o)return{pkgNameOrAlias:r.name,expose:".",remote:r}}let n=r.alias&&t.startsWith(r.alias),i=r.alias&&t.replace(r.alias,"");if(r.alias&&n){if(i&&i.startsWith("/")){return i=`.${i}`,{pkgNameOrAlias:r.alias,expose:i,remote:r}}if(""===i)return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function xn(e,t){for(let r of e)if(t===r.name||r.alias&&t===r.alias)return r}function Gn(e,t){let r=en(),o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(t=>{null!=e&&e.find(e=>e.name!==t.name)&&e.push(t)}),e&&e.length>0&&e.forEach(e=>{o.forEach(r=>{r.applyPlugin(e,t)})}),e}var or=".then(callbacks[0]).catch(callbacks[1])";async function Un({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):new Function("callbacks",`import("${e}")${or}`)([r,o])}catch(e){o(e)}})}async function jn({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):"undefined"==typeof __system_context__?System.import(e).then(r).catch(o):new Function("callbacks",`System.import("${e}")${or}`)([r,o])}catch(e){o(e)}})}function sr(e,t,r){let{remoteEntryKey:o,entryExports:n}=ht(e,t);return A(n,L(Je,O,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o})),n}async function Vn({name:e,globalName:t,entry:r,loaderHook:o,getEntryUrl:n}){let{entryExports:i}=ht(e,t);return i||J(n?n(r):r,{attrs:{},createScriptHook:(e,t)=>{let r=o.lifecycle.createScript.emit({url:e,attrs:t});if(r&&(r instanceof HTMLScriptElement||"script"in r||"timeout"in r))return r}}).then(()=>sr(e,t,r)).catch(t=>{throw A(void 0,L(Ae,O,{remoteName:e,resourceUrl:r})),t})}async function Bn({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o}){let{entry:n,entryGlobalName:i,name:a,type:s}=e;switch(s){case"esm":case"module":return Un({entry:n,remoteEntryExports:t});case"system":return jn({entry:n,remoteEntryExports:t});default:return Vn({entry:n,globalName:i,name:a,loaderHook:r,getEntryUrl:o})}}async function Wn({remoteInfo:e,loaderHook:t}){let{entry:r,entryGlobalName:o,name:n,type:i}=e,{entryExports:a}=ht(n,o);return a||Z(r,{attrs:{name:n,globalName:o,type:i},loaderHook:{createScriptHook:(e,r={})=>{let o=t.lifecycle.createScript.emit({url:e,attrs:r});if(o&&"url"in o)return o}}}).then(()=>sr(n,o,r)).catch(e=>{throw e})}function at(e){let{entry:t,name:r}=e;return Re(r,t)}async function ne(e){let{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,_inErrorHandling:i=!1}=e,a=at(o);if(r)return r;if(!Q[a]){let e=t.remoteHandler.hooks.lifecycle.loadEntry,s=t.loaderHook;Q[a]=e.emit({loaderHook:s,remoteInfo:o,remoteEntryExports:r}).then(e=>e||(("undefined"!=typeof ENV_TARGET?"web"===ENV_TARGET:U())?Bn({remoteInfo:o,remoteEntryExports:r,loaderHook:s,getEntryUrl:n}):Wn({remoteInfo:o,loaderHook:s}))).catch(async e=>{let n=at(o);if(e instanceof Error&&e.message.includes(Ae)&&!i){let e=e=>ne(M(R({},e),{_inErrorHandling:!0})),i=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e,origin:t,remoteInfo:o,remoteEntryExports:r,globalLoading:Q,uniqueKey:n});if(i)return i}throw e})}return Q[a]}function pe(e){return M(R({},e),{entry:"entry"in e?e.entry:"",type:e.type||Yt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||me})}function ir(e){return R({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},e)}function Kn(e,t){return t.map(t=>{let r=xn(e,t.nameOrAlias);return A(r,`Unable to preload ${t.nameOrAlias} as it is not included in ${!r&&Ie({remoteInfo:r,remotes:e})}`),{remote:r,preloadConfig:ir(t)}})}function qn(e){return e?e.map(e=>"."===e?e:e.startsWith("./")?e.replace("./",""):e):[]}function ar(e,t,r,o=!0){let{cssAssets:n,jsAssetsWithoutEntry:i,entryAssets:a}=r;if(t.options.inBrowser){if(a.forEach(r=>{let{moduleInfo:o}=r,n=t.moduleCache.get(e.name);ne(n?{origin:t,remoteInfo:o,remoteEntryExports:n.remoteEntryExports}:{origin:t,remoteInfo:o,remoteEntryExports:void 0})}),o){let e={rel:"preload",as:"style"};n.forEach(r=>{let{link:o,needAttach:n}=le({url:r,cb:()=>{},attrs:e,createLinkHook:(e,r)=>{let o=t.loaderHook.lifecycle.createLink.emit({url:e,attrs:r});if(o instanceof HTMLLinkElement)return o}});n&&document.head.appendChild(o)})}else{let e={rel:"stylesheet",type:"text/css"};n.forEach(r=>{let{link:o,needAttach:n}=le({url:r,cb:()=>{},attrs:e,createLinkHook:(e,r)=>{let o=t.loaderHook.lifecycle.createLink.emit({url:e,attrs:r});if(o instanceof HTMLLinkElement)return o},needDeleteLink:!1});n&&document.head.appendChild(o)})}if(o){let e={rel:"preload",as:"script"};i.forEach(r=>{let{link:o,needAttach:n}=le({url:r,cb:()=>{},attrs:e,createLinkHook:(e,r)=>{let o=t.loaderHook.lifecycle.createLink.emit({url:e,attrs:r});if(o instanceof HTMLLinkElement)return o}});n&&document.head.appendChild(o)})}else{let r={fetchpriority:"high",type:"module"===(null==e?void 0:e.type)?"module":"text/javascript"};i.forEach(e=>{let{script:o,needAttach:n}=Te({url:e,cb:()=>{},attrs:r,createScriptHook:(e,r)=>{let o=t.loaderHook.lifecycle.createScript.emit({url:e,attrs:r});if(o instanceof HTMLScriptElement)return o},needDeleteScript:!0});n&&document.head.appendChild(o)})}}}var oe=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let e;return e=await ne({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports}),A(e,`remoteEntryExports is undefined \n ${Ie(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async get(e,t,r,o){let n,{loadFactory:i=!0}=r||{loadFactory:!0},a=await this.getEntry();if(!this.inited){let t=this.host.shareScopeMap,r=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];r.length||r.push("default"),r.forEach(e=>{t[e]||(t[e]={})});let n=t[r[0]],i=[],s={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?r:this.remoteInfo.shareScope||"default"};Object.defineProperty(s,"shareScopeMap",{value:t,enumerable:!1});let l=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:n,remoteEntryInitOptions:s,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});void 0===(null==a?void 0:a.init)&&B(L(Ze,O,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await a.init(l.shareScope,l.initScope,l.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(M(R({},l),{id:e,remoteSnapshot:o,remoteEntryExports:a}))}this.lib=a,this.inited=!0,n=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:t,moduleInfo:this.remoteInfo}),n||(n=await a.get(t)),A(n,`${fe(this.remoteInfo)} remote don't export ${t}.`);let s=Jr(this.remoteInfo.name,t),l=this.wraperFactory(n,s);return i?await l():l}wraperFactory(e,t){function r(e,t){e&&"object"==typeof e&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for("mf_module_id"))&&Object.defineProperty(e,Symbol.for("mf_module_id"),{value:t,enumerable:!1})}return e instanceof Promise?async()=>{let o=await e();return r(o,t),o}:()=>{let o=e();return r(o,t),o}}},D=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){"function"==typeof e&&this.listeners.add(e)}once(e){let t=this;this.on(function r(...o){return t.remove(r),e.apply(null,o)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},H=class extends D{emit(...e){let t,r=Array.from(this.listeners);if(r.length>0){let o=0,n=t=>!1!==t&&(o<r.length?Promise.resolve(r[o++].apply(null,e)).then(n):t);t=n()}return Promise.resolve(t)}};function cr(e,t){if(!dt(t))return!1;if(e!==t)for(let r in e)if(!(r in t))return!1;return!0}var X=class extends D{constructor(e){super(),this.onerror=B,this.type=e}emit(e){dt(e)||B(`The data for the "${this.type}" hook should be an object.`);for(let t of this.listeners)try{let r=t(e);if(!cr(e,r)){this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}e=r}catch(e){He(e),this.onerror(e)}return e}},V=class extends D{constructor(e){super(),this.onerror=B,this.type=e}emit(e){dt(e)||B(`The response data for the "${this.type}" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let r=0,o=t=>(He(t),this.onerror(t),e),n=i=>{if(cr(e,i)){if(e=i,r<t.length)try{return Promise.resolve(t[r++](e)).then(n,o)}catch(e){return o(e)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(n(e))}return Promise.resolve(e)}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var r;A(Yr(e),"Plugin configuration is invalid.");let o=e.name;A(o,"A name must be provided by the plugin."),this.registerPlugins[o]||(this.registerPlugins[o]=e,null==(r=e.apply)||r.call(e,t),Object.keys(this.lifecycle).forEach(t=>{let r=e[t];r&&this.lifecycle[t].on(r)}))}removePlugin(e){A(e,"A name is required.");let t=this.registerPlugins[e];A(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(e=>{"name"!==e&&this.lifecycle[e].remove(t[e])})}};function lr(e,t){let r=Bt(t);r.url||B(`The attribute remoteEntry of ${e.name} must not be undefined.`);let o=ce(t,r.url);!U()&&!o.startsWith("http")&&(o=`https:${o}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=o,e.version=t.version,e.buildVersion=t.buildVersion}function zn(){return{name:"snapshot-plugin",async afterResolve(e){let{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:i,id:a}=e;if(!ft(t)||!jt(t)){let{remoteSnapshot:s,globalSnapshot:l}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:a});lr(i,s);let c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[o],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:c,remoteInfo:i,remote:t,remoteSnapshot:s,globalSnapshot:l});return u&&ar(i,n,u,!1),M(R({},e),{remoteSnapshot:s})}return e}}}function Xn(e){let t=e.split(":");return 1===t.length?{name:t[0],version:void 0}:2===t.length?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function ur(e,t,r,o,n={},i){let a=fe(t),{value:s}=te(e,a),l=i||s;if(l&&!$e(l)&&(r(l,t,o),l.remotesInfo)){let t=Object.keys(l.remotesInfo);for(let o of t){if(n[o])continue;n[o]=!0;let t=Xn(o),i=l.remotesInfo[o];ur(e,{name:t.name,version:i.matchedVersion},r,!1,n,void 0)}}}var st=(e,t)=>document.querySelector(`${e}[${"link"===e?"href":"src"}="${t}"]`);function Yn(e,t,r,o,n){let i=[],a=[],s=[],l=new Set,c=new Set,{options:u}=e,{preloadConfig:m}=t,{depsRemote:h}=m;if(ur(o,r,(t,r,o)=>{var n;let l;if(o)l=m;else if(Array.isArray(h)){let e=h.find(e=>e.nameOrAlias===r.name||e.nameOrAlias===r.alias);if(!e)return;l=ir(e)}else{if(!0!==h)return;l=m}let c=ce(t,Bt(t).url);c&&s.push({name:r.name,moduleInfo:{name:r.name,entry:c,type:"remoteEntryType"in t?t.remoteEntryType:"global",entryGlobalName:"globalName"in t?t.globalName:r.name,shareScope:"",version:"version"in t?t.version:void 0},url:c});let u="modules"in t?t.modules:[],f=qn(l.exposes);function p(e){let r=e.map(e=>ce(t,e));return l.filter?r.filter(l.filter):r}if(f.length&&"modules"in t&&(u=null==(n=null==t?void 0:t.modules)?void 0:n.reduce((e,t)=>(-1!==(null==f?void 0:f.indexOf(t.moduleName))&&e.push(t),e),[])),u){let o=u.length;for(let n=0;n<o;n++){let o=u[n],s=`${r.name}/${o.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:"."===o.moduleName?r.name:s,name:r.name,remoteSnapshot:t,preloadConfig:l,remote:r,origin:e}),!tn(s)&&("all"===l.resourceCategory?(i.push(...p(o.assets.css.async)),i.push(...p(o.assets.css.sync)),a.push(...p(o.assets.js.async)),a.push(...p(o.assets.js.sync))):(l.resourceCategory="sync")&&(i.push(...p(o.assets.css.sync)),a.push(...p(o.assets.js.sync))),rn(s))}}},!0,{},n),n.shared&&n.shared.length>0){let t=(t,r)=>{let o=ke(e.shareScopeMap,r.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare);o&&"function"==typeof o.lib&&(r.assets.js.sync.forEach(e=>{l.add(e)}),r.assets.css.sync.forEach(e=>{c.add(e)}))};n.shared.forEach(e=>{var r;let o=null==(r=u.shared)?void 0:r[e.sharedName];if(!o)return;let n=e.version?o.find(t=>t.version===e.version):o;n&&Vt(n).forEach(r=>{t(r,e)})})}let f=a.filter(e=>!l.has(e)&&!st("script",e));return{cssAssets:i.filter(e=>!c.has(e)&&!st("link",e)),jsAssetsWithoutEntry:f,entryAssets:s.filter(e=>!st("script",e.url))}}var Jn=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){let{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:i,remoteSnapshot:a}=e;return U()?ft(n)&&jt(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(lr(o,a),Yn(t,r,o,i,a)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function fr(e,t){let r=Le({name:t.name,version:t.options.version}),o=r&&"remotesInfo"in r&&r.remotesInfo&&te(r.remotesInfo,e.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:vt(),remoteSnapshot:Le({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:vt(),remoteSnapshot:Le({name:e.name,version:"version"in e?e.version:void 0})}}var ct=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new H("beforeLoadRemoteSnapshot"),loadSnapshot:new V("loadGlobalSnapshot"),loadRemoteSnapshot:new V("loadRemoteSnapshot"),afterLoadSnapshot:new V("afterLoadSnapshot")}),this.manifestLoading=de.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){let{options:o}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:o,moduleInfo:e});let n=Le({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},Qr({[this.HostInstance.options.name]:n})),n&&"remotesInfo"in n&&!te(n.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(n.remotesInfo=M(R({},null==n?void 0:n.remotesInfo),{[e.name]:{matchedVersion:"version"in e?e.version:e.entry}}));let i,a,{hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:c}=this.getGlobalRemoteInfo(e),{remoteSnapshot:u,globalSnapshot:m}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:c});if(u)if($e(u)){let t=U()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",r=await this.getManifestJson(t,e,{});i=r,a=Dt(M(R({},e),{entry:t}),r)}else{let{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:u,from:"global"});i=t,a=m}else if(ft(e)){let t=await this.getManifestJson(e.entry,e,{}),r=Dt(e,t),{remoteSnapshot:o}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:t,from:"global"});i=o,a=r}else B(L(rt,O,{hostName:e.name,hostVersion:e.version,globalSnapshot:JSON.stringify(m)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:o,moduleInfo:e,remoteSnapshot:i}),{remoteSnapshot:i,globalSnapshot:a}}getGlobalRemoteInfo(e){return fr(e,this.HostInstance)}async getManifestJson(e,t,r){let o=async()=>{let r=this.manifestCache.get(e);if(r)return r;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{});(!t||!(t instanceof Response))&&(t=await fetch(e,{})),r=await t.json()}catch(o){r=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:o,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),r||(delete this.manifestLoading[e],B(L(Qe,O,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${o}`)))}return A(r.metaData&&r.exposes&&r.shared,`${e} is not a federation manifest`),this.manifestCache.set(e,r),r};return this.manifestLoading[e]||(this.manifestLoading[e]=(async()=>{let r=await o(),n=qe(r,{version:e}),{remoteSnapshot:i}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:r,remoteSnapshot:n,manifestUrl:e,from:"manifest"});return i})().then(e=>e)),this.manifestLoading[e]}},lt=class{constructor(e){this.hooks=new q({afterResolve:new V("afterResolve"),beforeLoadShare:new V("beforeLoadShare"),loadShare:new H,resolveShare:new X("resolveShare"),initContainerShareScopeMap:new X("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){let{shareInfos:r,shared:o}=rr(e,t);return Object.keys(r).forEach(e=>{r[e].forEach(r=>{r.scope.forEach(o=>{var n;(null==(n=this.shareScopeMap[o])?void 0:n[e])||this.setShared({pkgName:e,lib:r.lib,get:r.get,loaded:r.loaded||!!r.lib,shared:r,from:t.name})})})}),{shareInfos:r,shared:o}}async loadShare(e,t){let{host:r}=this,o=Ut({pkgName:e,extraOptions:t,shareInfos:r.options.shared});null!=o&&o.scope&&await Promise.all(o.scope.map(async e=>{await Promise.all(this.initializeSharing(e,{strategy:o.strategy}))}));let n=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:o,shared:r.options.shared,origin:r}),{shareInfo:i}=n;A(i,`Cannot find ${e} Share in the ${r.options.name}. Please ensure that the ${e} Share parameters have been injected`);let a=ke(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare),s=e=>{e.useIn||(e.useIn=[]),Ft(e.useIn,r.options.name)};if(a&&a.lib)return s(a),a.lib;if(a&&a.loading&&!a.loaded){let e=await a.loading;return a.loaded=!0,a.lib||(a.lib=e),s(a),e}if(a){let t=(async()=>{let e=await a.get();return s(a),a.loaded=!0,a.lib=e,e})();return this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:t}),t}{if(null!=t&&t.customShareInfo)return!1;let o=(async()=>{let t=await i.get();i.lib=t,i.loaded=!0,s(i);let r=ke(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare);return r&&(r.lib=t,r.loaded=!0,r.from=i.from),t})();return this.setShared({pkgName:e,loaded:!1,shared:i,from:r.options.name,lib:null,loading:o}),o}}initializeSharing(e=me,t){let{host:r}=this,o=null==t?void 0:t.from,n=null==t?void 0:t.strategy,i=null==t?void 0:t.initScope,a=[];if("build"!==o){let{initTokens:t}=this;i||(i=[]);let r=t[e];if(r||(r=t[e]={from:this.host.name}),i.indexOf(r)>=0)return a;i.push(r)}let s=this.shareScopeMap,l=r.options.name;s[e]||(s[e]={});let c=s[e],u=async t=>{let{module:o}=await r.remoteHandler.getRemoteModuleAndOptions({id:t});if(o.getEntry){let n;try{n=await o.getEntry()}catch(e){n=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:e,from:"runtime",lifecycle:"beforeLoadShare",origin:r})}o.inited||(await(t=>t&&t.init&&t.init(s[e],i))(n),o.inited=!0)}};return Object.keys(r.options.shared).forEach(t=>{r.options.shared[t].forEach(r=>{r.scope.includes(e)&&((e,t)=>{var r;let{version:o,eager:n}=t;c[e]=c[e]||{};let i=c[e],a=i[o],s=!(!a||!(a.eager||null!=(r=a.shareConfig)&&r.eager));(!a||"loaded-first"!==a.strategy&&!a.loaded&&(!n!=!s?n:l>a.from))&&(i[o]=t)})(t,r)})}),("version-first"===r.options.shareStrategy||"version-first"===n)&&r.options.remotes.forEach(t=>{t.shareScope===e&&a.push(u(t.name))}),a}loadShareSync(e,t){let{host:r}=this,o=Ut({pkgName:e,extraOptions:t,shareInfos:r.options.shared});null!=o&&o.scope&&o.scope.forEach(e=>{this.initializeSharing(e,{strategy:o.strategy})});let n=ke(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare),i=e=>{e.useIn||(e.useIn=[]),Ft(e.useIn,r.options.name)};if(n){if("function"==typeof n.lib)return i(n),n.loaded||(n.loaded=!0,n.from===r.options.name&&(o.loaded=!0)),n.lib;if("function"==typeof n.get){let t=n.get();if(!(t instanceof Promise))return i(n),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:t,shared:n}),t}}if(o.lib)return o.loaded||(o.loaded=!0),o.lib;if(o.get){let n=o.get();if(n instanceof Promise){let o="build"===(null==t?void 0:t.from)?tt:we;throw new Error(L(o,O,{hostName:r.options.name,sharedPkgName:e}))}return o.lib=n,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:o.lib,shared:o}),o.lib}throw new Error(L(we,O,{hostName:r.options.name,sharedPkgName:e}))}initShareScopeMap(e,t,r={}){let{host:o}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:o.options,origin:o,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:o,loading:n,loaded:i,get:a}){let s=t,{version:l,scope:c="default"}=s,u=xe(s,["version","scope"]);(Array.isArray(c)?c:[c]).forEach(t=>{if(this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),!this.shareScopeMap[t][e][l])return this.shareScopeMap[t][e][l]=M(R({version:l,scope:[t]},u),{lib:o,loaded:i,loading:n}),void(a&&(this.shareScopeMap[t][e][l].get=a));let s=this.shareScopeMap[t][e][l];n&&!s.loading&&(s.loading=n),i&&!s.loaded&&(s.loaded=i),r&&s.from!==r&&(s.from=r)})}_setGlobalShareScopeMap(e){let t=nr(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},ut=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new X("beforeRegisterRemote"),registerRemote:new X("registerRemote"),beforeRequest:new V("beforeRequest"),onLoad:new H("onLoad"),handlePreloadModule:new D("handlePreloadModule"),errorLoadRemote:new H("errorLoadRemote"),beforePreloadRemote:new H("beforePreloadRemote"),generatePreloadAssets:new H("generatePreloadAssets"),afterPreloadRemote:new H,loadEntry:new H}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((e,t)=>(this.registerRemote(t,e,{force:!1}),e),e.remotes)}setIdToRemoteMap(e,t){let{remote:r,expose:o}=t,{name:n,alias:i}=r;if(this.idToRemoteMap[e]={name:r.name,expose:o},i&&e.startsWith(n)){let t=e.replace(n,i);return void(this.idToRemoteMap[t]={name:r.name,expose:o})}if(i&&e.startsWith(i)){let t=e.replace(i,n);this.idToRemoteMap[t]={name:r.name,expose:o}}}async loadRemote(e,t){let{host:r}=this;try{let{loadFactory:o=!0}=t||{loadFactory:!0},{module:n,moduleOptions:i,remoteMatchInfo:a}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:s,remote:l,expose:c,id:u,remoteSnapshot:m}=a,h=await n.get(u,c,t,m),f=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:s,expose:c,exposeModule:o?h:void 0,exposeModuleFactory:o?void 0:h,remote:l,options:i,moduleInstance:n,origin:r});return this.setIdToRemoteMap(e,a),"function"==typeof f?f:h}catch(o){let{from:n="runtime"}=t||{from:"runtime"},i=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:o,from:n,lifecycle:"onLoad",origin:r});if(!i)throw o;return i}}async preloadRemote(e){let{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});let r=Kn(t.options.remotes,e);await Promise.all(r.map(async e=>{let{remote:r}=e,o=pe(r),{globalSnapshot:n,remoteSnapshot:i}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:r}),a=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:e,remote:r,remoteInfo:o,globalSnapshot:n,remoteSnapshot:i});a&&ar(o,t,a)}))}registerRemotes(e,t){let{host:r}=this;e.forEach(e=>{this.registerRemote(e,r.options.remotes,{force:null==t?void 0:t.force})})}async getRemoteModuleAndOptions(e){let t,{host:r}=this,{id:o}=e;try{t=await this.hooks.lifecycle.beforeRequest.emit({id:o,options:r.options,origin:r})}catch(e){if(t=await this.hooks.lifecycle.errorLoadRemote.emit({id:o,options:r.options,origin:r,from:"runtime",error:e,lifecycle:"beforeRequest"}),!t)throw e}let{id:n}=t,i=Cn(r.options.remotes,n);A(i,L(et,O,{hostName:r.options.name,requestId:n}));let{remote:a}=i,s=pe(a),l=await r.sharedHandler.hooks.lifecycle.afterResolve.emit(M(R({id:n},i),{options:r.options,origin:r,remoteInfo:s})),{remote:c,expose:u}=l;A(c&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let m=r.moduleCache.get(c.name),h={host:r,remoteInfo:s};return m||(m=new oe(h),r.moduleCache.set(c.name,m)),{module:m,moduleOptions:h,remoteMatchInfo:l}}registerRemote(e,t,r){let{host:o}=this,n=()=>{if(e.alias){let r=t.find(t=>{var r;return e.alias&&(t.name.startsWith(e.alias)||(null==(r=t.alias)?void 0:r.startsWith(e.alias)))});A(!r,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${r&&r.name} name or alias`)}"entry"in e&&U()&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=me),e.type||(e.type=Yt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});let i=t.find(t=>t.name===e.name);if(i){let a=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];null!=r&&r.force&&(this.removeRemote(i),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o}),Se(a.join(" ")))}else n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o})}removeRemote(e){var t;try{let{host:r}=this,{name:o}=e,n=r.options.remotes.findIndex(e=>e.name===o);-1!==n&&r.options.remotes.splice(n,1);let i=r.moduleCache.get(e.name);if(i){let o=i.remoteInfo,n=o.entryGlobalName;P[n]&&(null!=(t=Object.getOwnPropertyDescriptor(P,n))&&t.configurable?delete P[n]:P[n]=void 0);let a=at(i.remoteInfo);Q[a]&&delete Q[a],r.snapshotHandler.manifestCache.delete(o.entry);let s=o.buildVersion?Re(o.name,o.buildVersion):o.name,l=P.__FEDERATION__.__INSTANCES__.findIndex(e=>o.buildVersion?e.options.id===s:e.name===s);if(-1!==l){let e=P.__FEDERATION__.__INSTANCES__[l];s=e.options.id||s;let t=nr(),r=!0,n=[];Object.keys(t).forEach(e=>{let i=t[e];i&&Object.keys(i).forEach(t=>{let a=i[t];a&&Object.keys(a).forEach(i=>{let s=a[i];s&&Object.keys(s).forEach(a=>{let l=s[a];l&&"object"==typeof l&&l.from===o.name&&(l.loaded||l.loading?(l.useIn=l.useIn.filter(e=>e!==o.name),l.useIn.length?r=!1:n.push([e,t,i,a])):n.push([e,t,i,a]))})})})}),r&&(e.shareScopeMap={},delete t[s]),n.forEach(([e,r,o,n])=>{var i,a,s;null==(s=null==(a=null==(i=t[e])?void 0:i[r])?void 0:a[o])||delete s[n]}),P.__FEDERATION__.__INSTANCES__.splice(l,1)}let{hostGlobalSnapshot:c}=fr(e,r);if(c){let t=c&&"remotesInfo"in c&&c.remotesInfo&&te(c.remotesInfo,e.name).key;t&&(delete c.remotesInfo[t],de.__FEDERATION__.__MANIFEST_LOADING__[t]&&delete de.__FEDERATION__.__MANIFEST_LOADING__[t])}r.moduleCache.delete(e.name)}}catch(e){it.log("removeRemote fail: ",e)}}},Zn="boolean"!=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN||!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN,Y=class{constructor(e){this.hooks=new q({beforeInit:new X("beforeInit"),init:new D,beforeInitContainer:new V("beforeInitContainer"),initContainer:new V("initContainer")}),this.version="0.21.4",this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new D,createScript:new D,createLink:new D,fetch:new H,loadEntryError:new H,getModuleFactory:new H}),this.bridgeHook=new q({beforeBridgeRender:new D,afterBridgeRender:new D,beforeBridgeDestroy:new D,afterBridgeDestroy:new D});let t=Zn?[zn(),Jn()]:[],r={id:Hn(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:U()};this.name=e.name,this.options=r,this.snapshotHandler=new ct(this),this.sharedHandler=new lt(this),this.remoteHandler=new ut(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){this.registerPlugins(e.plugins);let t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=me,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){let o=pe({name:e,entry:t}),n=new oe({host:this,remoteInfo:o});return n.remoteEntryExports=r,this.moduleCache.set(e,n),n}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){let{shared:r}=rr(e,t),{userOptions:o,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),i=this.remoteHandler.formatAndRegisterRemote(n,o),{shared:a}=this.sharedHandler.registerShared(n,o),s=[...n.plugins];o.plugins&&o.plugins.forEach(e=>{s.includes(e)||s.push(e)});let l=M(R(R({},e),t),{plugins:s,remotes:i,shared:a});return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){let t=Gn(e,this);this.options.plugins=this.options.plugins.reduce((e,t)=>(t&&e&&!e.find(e=>e.name===t.name)&&e.push(t),e),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,M(R({},this.options),{shared:e}))}};function Qn(){return"undefined"!=typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:""}function dr(e,t){let r=Qn();return P.__FEDERATION__.__INSTANCES__.find(o=>!!(r&&o.options.id===r||o.options.name===e&&!o.options.version&&!t||o.options.name===e&&t&&o.options.version===t))}function hr(e){let t=new(qt()||Y)(e);return Kt(t),t}var I=null;function eo(e){let t=dr(e.name,e.version);return t?(t.initOptions(e),I||(I=t),t):I=hr(e)}function to(...e){return A(I,L(K,O)),I.loadRemote.apply(I,e)}function ro(...e){return A(I,L(K,O)),I.loadShare.apply(I,e)}function no(...e){return A(I,L(K,O)),I.loadShareSync.apply(I,e)}function oo(...e){return A(I,L(K,O)),I.preloadRemote.apply(I,e)}function so(...e){return A(I,L(K,O)),I.registerRemotes.apply(I,e)}function io(...e){return A(I,L(K,O)),I.registerPlugins.apply(I,e)}function ao(){return I}function co(...e){return A(I,L(K,O)),I.registerShared.apply(I,e)}return zt(Y),exports.MFRuntime=Et,exports.MFSDK=Ye,exports}({});
|
|
1
|
+
var EMP_SHARE_RUNTIME=function(exports){"use strict";var bt=Object.defineProperty,pr=Object.defineProperties,mr=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable,gt=(e,t,r)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>{for(var r in t||(t={}))Rt.call(t,r)&>(e,r,t[r]);if(ye)for(var r of ye(t))St.call(t,r)&>(e,r,t[r]);return e},M=(e,t)=>pr(e,mr(t)),xe=(e,t)=>{var r={};for(var o in e)Rt.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&ye)for(var o of ye(e))t.indexOf(o)<0&&St.call(e,o)&&(r[o]=e[o]);return r},It=(e,t)=>{for(var r in t)bt(e,r,{get:t[r],enumerable:!0})},Et={};It(Et,{Module:()=>oe,ModuleFederation:()=>Y,createInstance:()=>hr,getInstance:()=>ao,getRemoteEntry:()=>ne,getRemoteInfo:()=>pe,init:()=>eo,loadRemote:()=>to,loadScript:()=>J,loadScriptNode:()=>Z,loadShare:()=>ro,loadShareSync:()=>no,preloadRemote:()=>oo,registerGlobalPlugins:()=>Xt,registerPlugins:()=>io,registerRemotes:()=>so,registerShared:()=>co});var Ye={};It(Ye,{BROWSER_LOG_KEY:()=>$t,ENCODE_NAME_PREFIX:()=>gr,EncodedNameTransformMap:()=>Ee,FederationModuleManifest:()=>yr,MANIFEST_EXT:()=>Be,MFModuleType:()=>_r,MFPrefetchCommon:()=>Rr,MODULE_DEVTOOL_IDENTIFIER:()=>Er,ManifestFileName:()=>Ue,NameTransformMap:()=>k,NameTransformSymbol:()=>w,SEPARATOR:()=>We,StatsFileName:()=>je,TEMP_DIR:()=>br,assert:()=>Mr,bindLoggerToCompiler:()=>Hr,composeKeyWithSeparator:()=>Re,containerPlugin:()=>Sr,containerReferencePlugin:()=>Ir,createInfrastructureLogger:()=>Ot,createLink:()=>le,createLogger:()=>Ne,createModuleFederationConfig:()=>jr,createScript:()=>Te,createScriptNode:()=>Lt,decodeName:()=>Ar,encodeName:()=>Ke,error:()=>wt,generateExposeFilename:()=>Pr,generateShareFilename:()=>Or,generateSnapshotFromManifest:()=>qe,getManifestFileName:()=>vr,getProcessEnv:()=>Nt,getResourceUrl:()=>ce,inferAutoPublicPath:()=>At,infrastructureLogger:()=>xr,isBrowserEnv:()=>U,isDebugMode:()=>ae,isManifestProvider:()=>$e,isReactNativeEnv:()=>be,isRequiredVersion:()=>Fr,isStaticResourcesEqual:()=>Xe,loadScript:()=>J,loadScriptNode:()=>Z,logger:()=>Cr,moduleFederationPlugin:()=>$r,normalizeOptions:()=>Ur,parseEntry:()=>wr,safeToString:()=>Ie,safeWrapper:()=>ze,sharePlugin:()=>Nr,simpleJoinRemoteEntry:()=>z,warn:()=>Se});var yr="federation-manifest.json",Be=".json",$t="FEDERATION_DEBUG",w={AT:"@",HYPHEN:"-",SLASH:"/"},k={[w.AT]:"scope_",[w.HYPHEN]:"_",[w.SLASH]:"__"},Ee={[k[w.AT]]:w.AT,[k[w.HYPHEN]]:w.HYPHEN,[k[w.SLASH]]:w.SLASH},We=":",Ue="mf-manifest.json",je="mf-stats.json",_r={NPM:"npm",APP:"app"},Er="__MF_DEVTOOLS_MODULE_INFO__",gr="ENCODE_NAME_PREFIX",br=".federation",Rr={identifier:"MFDataPrefetch",globalKey:"__PREFETCH__",library:"mf-data-prefetch",exportsKey:"__PREFETCH_EXPORTS__",fileName:"bootstrap.js"},Sr=Object.freeze({__proto__:null}),Ir=Object.freeze({__proto__:null}),$r=Object.freeze({__proto__:null}),Nr=Object.freeze({__proto__:null});function U(){return"undefined"!=typeof window&&void 0!==window.document}function be(){return"undefined"!=typeof navigator&&"ReactNative"===(null==navigator?void 0:navigator.product)}function Tr(){try{if(U()&&window.localStorage)return!!localStorage.getItem($t)}catch(e){return!1}return!1}function ae(){return"undefined"!=typeof process&&process.env,Tr()}var Nt=function(){return"undefined"!=typeof process&&process.env?process.env:{}},Tt="[ Federation Runtime ]",wr=(e,t,r=We)=>{let o=e.split(r),n="development"===Nt().NODE_ENV&&t,i=e=>e.startsWith("http")||e.includes(Be);if(o.length>=2){let[t,...a]=o;e.startsWith(r)&&(t=o.slice(0,2).join(r),a=[n||o.slice(2).join(r)]);let s=n||a.join(r);return i(s)?{name:t,entry:s}:{name:t,version:s||"*"}}if(1===o.length){let[e]=o;return n&&i(n)?{name:e,entry:n}:{name:e,version:n||"*"}}throw`Invalid entry value: ${e}`},Re=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}${We}${t}`:t:e,""):""},Ke=function(e,t="",r=!1){try{let o=r?".js":"";return`${t}${e.replace(new RegExp(`${w.AT}`,"g"),k[w.AT]).replace(new RegExp(`${w.HYPHEN}`,"g"),k[w.HYPHEN]).replace(new RegExp(`${w.SLASH}`,"g"),k[w.SLASH])}${o}`}catch(e){throw e}},Ar=function(e,t,r){try{let o=e;if(t){if(!o.startsWith(t))return o;o=o.replace(new RegExp(t,"g"),"")}return o=o.replace(new RegExp(`${k[w.AT]}`,"g"),Ee[k[w.AT]]).replace(new RegExp(`${k[w.SLASH]}`,"g"),Ee[k[w.SLASH]]).replace(new RegExp(`${k[w.HYPHEN]}`,"g"),Ee[k[w.HYPHEN]]),r&&(o=o.replace(".js","")),o}catch(e){throw e}},Pr=(e,t)=>{if(!e)return"";let r=e;return"."===r&&(r="default_export"),r.startsWith("./")&&(r=r.replace("./","")),Ke(r,"__federation_expose_",t)},Or=(e,t)=>e?Ke(e,"__federation_shared_",t):"",ce=(e,t)=>{if("getPublicPath"in e){let r;return r=e.getPublicPath.startsWith("function")?new Function("return "+e.getPublicPath)()():new Function(e.getPublicPath)(),`${r}${t}`}return"publicPath"in e?U()||be()||!("ssrPublicPath"in e)?`${e.publicPath}${t}`:`${e.ssrPublicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")},Mr=(e,t)=>{e||wt(t)},wt=e=>{throw new Error(`${Tt}: ${e}`)},Se=e=>{console.warn(`${Tt}: ${e}`)};function Ie(e){try{return JSON.stringify(e,null,2)}catch(e){return""}}var Lr=/^([\d^=v<>~]|[*xX]$)/;function Fr(e){return Lr.test(e)}var z=(e,t)=>{if(!e)return t;let r=(e=>{if("."===e)return"";if(e.startsWith("./"))return e.replace("./","");if(e.startsWith("/")){let t=e.slice(1);return t.endsWith("/")?t.slice(0,-1):t}return e})(e);return r?r.endsWith("/")?`${r}${t}`:`${r}/${t}`:t};function At(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function qe(e,t={}){var r,o,n;let i,{remotes:a={},overrides:s={},version:l}=t,c=()=>"publicPath"in e.metaData?"auto"===e.metaData.publicPath&&l?At(l):e.metaData.publicPath:e.metaData.getPublicPath,u=Object.keys(s),m={};Object.keys(a).length||(m=(null==(r=e.remotes)?void 0:r.reduce((e,t)=>{let r,o=t.federationContainerName;return r=u.includes(o)?s[o]:"version"in t?t.version:t.entry,e[o]={matchedVersion:r},e},{}))||{}),Object.keys(a).forEach(e=>m[e]={matchedVersion:u.includes(e)?s[e]:a[e]});let{remoteEntry:{path:h,name:f,type:p},types:d={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:y},globalName:_,ssrRemoteEntry:g}=e.metaData,{exposes:E}=e,b={version:l||"",buildVersion:y,globalName:_,remoteEntry:z(h,f),remoteEntryType:p,remoteTypes:z(d.path,d.name),remoteTypesZip:d.zip||"",remoteTypesAPI:d.api||"",remotesInfo:m,shared:null==e?void 0:e.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version})),modules:null==E?void 0:E.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if(null!=(o=e.metaData)&&o.prefetchInterface){let t=e.metaData.prefetchInterface;b=M(R({},b),{prefetchInterface:t})}if(null!=(n=e.metaData)&&n.prefetchEntry){let{path:t,name:r,type:o}=e.metaData.prefetchEntry;b=M(R({},b),{prefetchEntry:z(t,r),prefetchEntryType:o})}if(i="publicPath"in e.metaData?M(R({},b),{publicPath:c(),ssrPublicPath:e.metaData.ssrPublicPath}):M(R({},b),{getPublicPath:c()}),g){let e=z(g.path,g.name);i.ssrRemoteEntry=e,i.ssrRemoteEntryType=g.type||"commonjs-module"}return i}function $e(e){return!(!("remoteEntry"in e)||!e.remoteEntry.includes(Be))}function vr(e){if(!e)return{statsFileName:je,manifestFileName:Ue};let t="boolean"==typeof e?"":e.filePath||"",r="boolean"==typeof e?"":e.fileName||"",o=".json",n=r?(a=r).endsWith(o)?a:`${a}${o}`:Ue,i=r?((e,t)=>e.replace(o,`${t}${o}`))(n,"-stats"):je;var a;return{statsFileName:z(t,i),manifestFileName:z(t,n)}}var Pt="[ Module Federation ]",se=console,Dr=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function kr(){try{let e=(new Error).stack;if(!e)return;let[,...t]=e.split("\n"),r=t.filter(e=>!Dr.some(t=>e.includes(t)));return r.length?`Stack trace:\n${r.slice(0,5).join("\n")}`:void 0}catch(e){return}}var ge=class{constructor(e,t=se){this.prefix=e,this.delegate=null!=t?t:se}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=null!=e?e:se}emit(e,t){let r=this.delegate,o=ae()?kr():void 0,n=o?[...t,o]:t,i=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(let e of i){let t=r[e];if("function"==typeof t)return void t.call(r,this.prefix,...n)}for(let e of i){let t=se[e];if("function"==typeof t)return void t.call(se,this.prefix,...n)}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){ae()&&this.emit("debug",e)}};function Ne(e){return new ge(e)}function Ot(e){let t=new ge(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}function Hr(e,t,r){if(e.__mf_infrastructure_logger__&&null!=t&&t.getInfrastructureLogger)try{let o=t.getInfrastructureLogger(r);o&&"object"==typeof o&&("function"==typeof o.log||"function"==typeof o.info||"function"==typeof o.warn||"function"==typeof o.error)&&e.setDelegate(o)}catch(t){e.setDelegate(void 0)}}var Cr=Ne(Pt),xr=Ot(Pt);async function ze(e,t){try{return await e()}catch(e){return void(!t&&Se(e))}}function Xe(e,t){let r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function Te(e){let t,r=null,o=!0,n=2e4,i=document.getElementsByTagName("script");for(let t=0;t<i.length;t++){let n=i[t],a=n.getAttribute("src");if(a&&Xe(a,e.url)){r=n,o=!1;break}}if(!r){let t,o=e.attrs;r=document.createElement("script"),r.type="module"===(null==o?void 0:o.type)?"module":"text/javascript",e.createScriptHook&&(t=e.createScriptHook(e.url,e.attrs),t instanceof HTMLScriptElement?r=t:"object"==typeof t&&("script"in t&&t.script&&(r=t.script),"timeout"in t&&t.timeout&&(n=t.timeout))),r.src||(r.src=e.url),o&&!t&&Object.keys(o).forEach(e=>{r&&("async"===e||"defer"===e?r[e]=o[e]:r.getAttribute(e)||r.setAttribute(e,o[e]))})}let a=async(o,n)=>{clearTimeout(t);let i=()=>{"error"===(null==n?void 0:n.type)?null!=e&&e.onErrorCallback&&(null==e||e.onErrorCallback(n)):null!=e&&e.cb&&(null==e||e.cb())};if(r&&(r.onerror=null,r.onload=null,ze(()=>{let{needDeleteScript:t=!0}=e;t&&null!=r&&r.parentNode&&r.parentNode.removeChild(r)}),o&&"function"==typeof o)){let e=o(n);if(e instanceof Promise){let t=await e;return i(),t}return i(),e}i()};return r.onerror=a.bind(null,r.onerror),r.onload=a.bind(null,r.onload),t=setTimeout(()=>{a(null,new Error(`Remote script "${e.url}" time-outed.`))},n),{script:r,needAttach:o}}function le(e){let t=null,r=!0,o=document.getElementsByTagName("link");for(let n=0;n<o.length;n++){let i=o[n],a=i.getAttribute("href"),s=i.getAttribute("rel");if(a&&Xe(a,e.url)&&s===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let r,o=e.attrs;e.createLinkHook&&(r=e.createLinkHook(e.url,o),r instanceof HTMLLinkElement&&(t=r)),o&&!r&&Object.keys(o).forEach(e=>{t&&!t.getAttribute(e)&&t.setAttribute(e,o[e])})}let n=(r,o)=>{let n=()=>{"error"===(null==o?void 0:o.type)?null!=e&&e.onErrorCallback&&(null==e||e.onErrorCallback(o)):null!=e&&e.cb&&(null==e||e.cb())};if(t&&(t.onerror=null,t.onload=null,ze(()=>{let{needDeleteLink:r=!0}=e;r&&null!=t&&t.parentNode&&t.parentNode.removeChild(t)}),r)){let e=r(o);return n(),e}n()};return t.onerror=n.bind(null,t.onerror),t.onload=n.bind(null,t.onload),{link:t,needAttach:r}}function J(e,t){let{attrs:r={},createScriptHook:o}=t;return new Promise((t,n)=>{let{script:i,needAttach:a}=Te({url:e,cb:t,onErrorCallback:n,attrs:R({fetchpriority:"high"},r),createScriptHook:o,needDeleteScript:!0});a&&document.head.appendChild(i)})}var _e=new Map;function ie(e){if(!e)throw new Error("import specifier is required");if(_e.has(e))return _e.get(e);let t=new Function("name","return import(name)")(e).then(e=>e).catch(t=>{throw console.error(`Error importing module ${e}:`,t),_e.delete(e),t});return _e.set(e,t),t}var Mt=async()=>{let e=await ie("node-fetch");return e.default||e},Gr=async(e,t,r)=>{let o=await(n=e,i=t||{},r.lifecycle.fetch.emit(n,i));var n,i;return o&&o instanceof Response?o:("undefined"==typeof fetch?await Mt():fetch)(e,t||{})},Lt="undefined"==typeof ENV_TARGET||"web"!==ENV_TARGET?(url,cb,attrs,loaderHook)=>{if(null!=loaderHook&&loaderHook.createScriptHook){let e=loaderHook.createScriptHook(url);e&&"object"==typeof e&&"url"in e&&(url=e.url)}let urlObj;try{urlObj=new URL(url)}catch(e){return console.error("Error constructing URL:",e),void cb(new Error(`Invalid URL: ${e}`))}let getFetch=async()=>null!=loaderHook&&loaderHook.fetch?(e,t)=>Gr(e,t,loaderHook):"undefined"==typeof fetch?Mt():fetch,handleScriptFetch=async(f,urlObj)=>{var t,e;try{let res=await f(urlObj.href),data=await res.text(),[path,vm]=await Promise.all([ie("path"),ie("vm")]),scriptContext={exports:{},module:{exports:{}}},urlDirname=urlObj.pathname.split("/").slice(0,-1).join("/"),filename=path.basename(urlObj.pathname),script=new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`,{filename:filename,importModuleDynamically:null!=(e=null==(t=vm.constants)?void 0:t.USE_MAIN_CONTEXT_DEFAULT_LOADER)?e:ie});script.runInThisContext()(scriptContext.exports,scriptContext.module,eval("require"),urlDirname,filename);let exportedInterface=scriptContext.module.exports||scriptContext.exports;if(attrs&&exportedInterface&&attrs.globalName){let e=exportedInterface[attrs.globalName]||exportedInterface;return void cb(void 0,e)}cb(void 0,exportedInterface)}catch(e){cb(e instanceof Error?e:new Error(`Script execution error: ${e}`))}};getFetch().then(async e=>{if("esm"===(null==attrs?void 0:attrs.type)||"module"===(null==attrs?void 0:attrs.type))return Ve(urlObj.href,{fetch:e,vm:await ie("vm")}).then(async e=>{await e.evaluate(),cb(void 0,e.namespace)}).catch(e=>{cb(e instanceof Error?e:new Error(`Script execution error: ${e}`))});handleScriptFetch(e,urlObj)}).catch(e=>{cb(e)})}:(e,t,r,o)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},Z="undefined"==typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t)=>new Promise((r,o)=>{Lt(e,(e,n)=>{var i,a;if(e)o(e);else{let e=(null==(i=null==t?void 0:t.attrs)?void 0:i.globalName)||`__FEDERATION_${null==(a=null==t?void 0:t.attrs)?void 0:a.name}:custom__`,o=globalThis[e]=n;r(o)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},Ge=new Map;async function Ve(e,t){if(Ge.has(e))return Ge.get(e);let{fetch:r,vm:o}=t,n=await(await r(e)).text(),i=new o.SourceTextModule(n,{importModuleDynamically:async(r,o)=>Ve(new URL(r,e).href,t)});return Ge.set(e,i),await i.link(async r=>{let o=new URL(r,e).href;return await Ve(o,t)}),i}function Ur(e,t,r){return function(o){if(!1===o)return!1;if(void 0===o)return!!e&&t;if(!0===o)return t;if(o&&"object"==typeof o)return R(R({},t),o);throw new Error(`Unexpected type for \`${r}\`, expect boolean/undefined/object, got: ${typeof o}`)}}var jr=e=>e,Je="RUNTIME-001",Ze="RUNTIME-002",Qe="RUNTIME-003",et="RUNTIME-004",tt="RUNTIME-005",we="RUNTIME-006",rt="RUNTIME-007",Ae="RUNTIME-008",K="RUNTIME-009",Vr="TYPE-001",Br="BUILD-001",Wr="BUILD-002",Kr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}/${e}`,L=(e,t,r,o)=>{let n=[`${[t[e]]} #${e}`];return r&&n.push(`args: ${JSON.stringify(r)}`),n.push(Kr(e)),o&&n.push(`Original Error Message:\n ${o}`),n.join("\n")},O={[Je]:"Failed to get remoteEntry exports.",[Ze]:'The remote entry interface does not contain "init"',[Qe]:"Failed to get manifest.",[et]:"Failed to locate remote.",[tt]:"Invalid loadShareSync function call from bundler runtime",[we]:"Invalid loadShareSync function call from runtime",[rt]:"Failed to get remote snapshot.",[Ae]:"Failed to load script resources.",[K]:"Please call createInstance first."},qr={[Vr]:"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."},zr={[Br]:"Failed to find expose module.",[Wr]:"PublicPath is required in prod mode."};R(R(R({},O),qr),zr);var ee="[ Federation Runtime ]",it=Ne(ee);function A(e,t){e||B(t)}function B(e){throw e instanceof Error?(e.message.startsWith(ee)||(e.message=`${ee}: ${e.message}`),e):new Error(`${ee}: ${e}`)}function He(e){e instanceof Error&&(e.message.startsWith(ee)||(e.message=`${ee}: ${e.message}`)),it.warn(e)}function Ft(e,t){return-1===e.findIndex(e=>e===t)&&e.push(t),e}function fe(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function ft(e){return void 0!==e.entry}function jt(e){return!e.entry.includes(".json")}function dt(e){return e&&"object"==typeof e}var Xr=Object.prototype.toString;function Yr(e){return"[object Object]"===Xr.call(e)}function Vt(e){return Array.isArray(e)?e:[e]}function Bt(e){let t={url:"",type:"global",globalName:""};return U()||be()?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}var Jr=(e,t)=>{let r;return r=e.endsWith("/")?e.slice(0,-1):e,t.startsWith(".")&&(t=t.slice(1)),r+=t,r},P="object"==typeof globalThis?globalThis:window,x=(()=>{try{return document.defaultView}catch(e){return P}})(),de=x;function Oe(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function Me(e,t){return Object.hasOwnProperty.call(e,t)}Me(P,"__GLOBAL_LOADING_REMOTE_ENTRY__")||Oe(P,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});var Q=P.__GLOBAL_LOADING_REMOTE_ENTRY__;function Wt(e){var t,r,o,n,i,a;Me(e,"__VMOK__")&&!Me(e,"__FEDERATION__")&&Oe(e,"__FEDERATION__",e.__VMOK__),Me(e,"__FEDERATION__")||(Oe(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),Oe(e,"__VMOK__",e.__FEDERATION__)),null!=(t=e.__FEDERATION__).__GLOBAL_PLUGIN__||(t.__GLOBAL_PLUGIN__=[]),null!=(r=e.__FEDERATION__).__INSTANCES__||(r.__INSTANCES__=[]),null!=(o=e.__FEDERATION__).moduleInfo||(o.moduleInfo={}),null!=(n=e.__FEDERATION__).__SHARE__||(n.__SHARE__={}),null!=(i=e.__FEDERATION__).__MANIFEST_LOADING__||(i.__MANIFEST_LOADING__={}),null!=(a=e.__FEDERATION__).__PRELOADED_MAP__||(a.__PRELOADED_MAP__=new Map)}function Kt(e){P.__FEDERATION__.__INSTANCES__.push(e)}function qt(){return P.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function zt(e,t=ae()){t&&(P.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,P.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.22.0")}function te(e,t){if("string"==typeof t){if(e[t])return{value:e[t],key:t};{let r=Object.keys(e);for(let o of r){let[r,n]=o.split(":"),i=`${r}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}throw new Error("key must be string")}Wt(P),Wt(x);var vt=()=>x.__FEDERATION__.moduleInfo,Zr=(e,t)=>{let r=te(t,fe(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){let t=e,{version:r}=t,o=fe(xe(t,["version"])),n=te(x.__FEDERATION__.moduleInfo,o).value;if((null==n?void 0:n.version)===r)return n}},Le=e=>Zr(e,x.__FEDERATION__.moduleInfo),Dt=(e,t)=>{let r=fe(e);return x.__FEDERATION__.moduleInfo[r]=t,x.__FEDERATION__.moduleInfo},Qr=e=>(x.__FEDERATION__.moduleInfo=R(R({},x.__FEDERATION__.moduleInfo),e),()=>{let t=Object.keys(e);for(let e of t)delete x.__FEDERATION__.moduleInfo[e]}),ht=(e,t)=>{let r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:P[r]}},Xt=e=>{let{__GLOBAL_PLUGIN__:t}=x.__FEDERATION__;e.forEach(e=>{-1===t.findIndex(t=>t.name===e.name)?t.push(e):He(`The plugin ${e.name} has been registered.`)})},en=()=>x.__FEDERATION__.__GLOBAL_PLUGIN__,tn=e=>P.__FEDERATION__.__PRELOADED_MAP__.get(e),rn=e=>P.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),me="default",Yt="global",kt="[0-9A-Za-z-]+",pt=`(?:\\+(${kt}(?:\\.${kt})*))`,ue="0|[1-9]\\d*",Fe="[0-9]+",Jt="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Ht=`(?:${Fe}|${Jt})`,nn=`(?:-?(${Ht}(?:\\.${Ht})*))`,Ct=`(?:${ue}|${Jt})`,Zt=`(?:-(${Ct}(?:\\.${Ct})*))`,nt=`${ue}|x|X|\\*`,re=`[v=\\s]*(${nt})(?:\\.(${nt})(?:\\.(${nt})(?:${Zt})?${pt}?)?)?`,on=`^\\s*(${re})\\s+-\\s+(${re})\\s*$`,sn=`(${Fe})\\.(${Fe})\\.(${Fe})`,an=`[v=\\s]*${sn}${nn}?${pt}?`,mt="((?:<|>)?=?)",cn=`(\\s*)${mt}\\s*(${an}|${re})`,Qt="(?:~>?)",ln=`(\\s*)${Qt}\\s+`,er="(?:\\^)",un=`(\\s*)${er}\\s+`,fn="(<|>)?=?\\s*\\*",dn=`^${er}${re}$`,hn=`(${ue})\\.(${ue})\\.(${ue})`,pn=`v?${hn}${Zt}?${pt}?`,mn=`^${Qt}${re}$`,yn=`^${mt}\\s*${re}$`,_n=`^${mt}\\s*(${pn})$|^$`,En="^\\s*>=\\s*0.0.0\\s*$";function W(e){return new RegExp(e)}function v(e){return!e||"x"===e.toLowerCase()||"*"===e}function tr(...e){return t=>e.reduce((e,t)=>t(e),t)}function xt(e){return e.match(W(_n))}function Gt(e,t,r,o){let n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function gn(e){return e.replace(W(on),(e,t,r,o,n,i,a,s,l,c,u,m)=>`${t=v(r)?"":v(o)?`>=${r}.0.0`:v(n)?`>=${r}.${o}.0`:`>=${t}`} ${s=v(l)?"":v(c)?`<${Number(l)+1}.0.0-0`:v(u)?`<${l}.${Number(c)+1}.0-0`:m?`<=${l}.${c}.${u}-${m}`:`<=${s}`}`.trim())}function bn(e){return e.replace(W(cn),"$1$2$3")}function Rn(e){return e.replace(W(ln),"$1~")}function Sn(e){return e.replace(W(un),"$1^")}function In(e){return e.trim().split(/\s+/).map(e=>e.replace(W(dn),(e,t,r,o,n)=>v(t)?"":v(r)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:v(o)?"0"===t?`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.0 <${Number(t)+1}.0.0-0`:n?"0"===t?"0"===r?`>=${t}.${r}.${o}-${n} <${t}.${r}.${Number(o)+1}-0`:`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o}-${n} <${Number(t)+1}.0.0-0`:"0"===t?"0"===r?`>=${t}.${r}.${o} <${t}.${r}.${Number(o)+1}-0`:`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o} <${Number(t)+1}.0.0-0`)).join(" ")}function $n(e){return e.trim().split(/\s+/).map(e=>e.replace(W(mn),(e,t,r,o,n)=>v(t)?"":v(r)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:v(o)?`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`:n?`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`)).join(" ")}function Nn(e){return e.split(/\s+/).map(e=>e.trim().replace(W(yn),(e,t,r,o,n,i)=>{let a=v(r),s=a||v(o),l=s||v(n);return"="===t&&l&&(t=""),i="",a?">"===t||"<"===t?"<0.0.0-0":"*":t&&l?(s&&(o=0),n=0,">"===t?(t=">=",s?(r=Number(r)+1,o=0,n=0):(o=Number(o)+1,n=0)):"<="===t&&(t="<",s?r=Number(r)+1:o=Number(o)+1),"<"===t&&(i="-0"),`${t+r}.${o}.${n}${i}`):s?`>=${r}.0.0${i} <${Number(r)+1}.0.0-0`:l?`>=${r}.${o}.0${i} <${r}.${Number(o)+1}.0-0`:e})).join(" ")}function Tn(e){return e.trim().replace(W(fn),"")}function wn(e){return e.trim().replace(W(En),"")}function ve(e,t){return(e=Number(e)||e)>(t=Number(t)||t)?1:e===t?0:-1}function An(e,t){let{preRelease:r}=e,{preRelease:o}=t;if(void 0===r&&o)return 1;if(r&&void 0===o)return-1;if(void 0===r&&void 0===o)return 0;for(let e=0,t=r.length;e<=t;e++){let t=r[e],n=o[e];if(t!==n)return void 0===t&&void 0===n?0:t?n?ve(t,n):-1:1}return 0}function Pe(e,t){return ve(e.major,t.major)||ve(e.minor,t.minor)||ve(e.patch,t.patch)||An(e,t)}function ot(e,t){return e.version===t.version}function Pn(e,t){switch(e.operator){case"":case"=":return ot(e,t);case">":return Pe(e,t)<0;case">=":return ot(e,t)||Pe(e,t)<0;case"<":return Pe(e,t)>0;case"<=":return ot(e,t)||Pe(e,t)>0;case void 0:return!0;default:return!1}}function On(e){return tr(In,$n,Nn,Tn)(e)}function Mn(e){return tr(gn,bn,Rn,Sn)(e.trim()).split(/\s+/).join(" ")}function De(e,t){if(!e)return!1;let r=xt(e);if(!r)return!1;let[,o,,n,i,a,s]=r,l={operator:o,version:Gt(n,i,a,s),major:n,minor:i,patch:a,preRelease:null==s?void 0:s.split(".")},c=t.split("||");for(let e of c){let t=e.trim();if(!t||"*"===t||"x"===t)return!0;try{let e=Mn(t);if(!e.trim())return!0;let r=e.split(" ").map(e=>On(e)).join(" ");if(!r.trim())return!0;let o=r.split(/\s+/).map(e=>wn(e)).filter(Boolean);if(0===o.length)continue;let n=!0;for(let e of o){let t=xt(e);if(!t){n=!1;break}let[,r,,o,i,a,s]=t;if(!Pn({operator:r,version:Gt(o,i,a,s),major:o,minor:i,patch:a,preRelease:null==s?void 0:s.split(".")},l)){n=!1;break}}if(n)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}function Ln(e,t,r,o){var n,i,a;let s;return s="get"in e?e.get:"lib"in e?()=>Promise.resolve(e.lib):()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${r}'!`)}),M(R({deps:[],useIn:[],from:t,loading:null},e),{shareConfig:R({requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1},e.shareConfig),get:s,loaded:!!(null!=e&&e.loaded||"lib"in e)||void 0,version:null!=(n=e.version)?n:"0",scope:Array.isArray(e.scope)?e.scope:[null!=(i=e.scope)?i:"default"],strategy:(null!=(a=e.strategy)?a:o)||"version-first"})}function rr(e,t){let r=t.shared||{},o=t.name,n=Object.keys(r).reduce((e,n)=>{let i=Vt(r[n]);return e[n]=e[n]||[],i.forEach(r=>{e[n].push(Ln(r,o,n,t.shareStrategy))}),e},{}),i=R({},e.shared);return Object.keys(n).forEach(e=>{i[e]?n[e].forEach(t=>{i[e].find(e=>e.version===t.version)||i[e].push(t)}):i[e]=n[e]}),{shared:i,shareInfos:n}}function he(e,t){let r=e=>{if(!Number.isNaN(Number(e))){let t=e.split("."),r=e;for(let e=0;e<3-t.length;e++)r+=".0";return r}return e};return!!De(r(e),`<=${r(t)}`)}var yt=(e,t)=>{let r=t||function(e,t){return he(e,t)};return Object.keys(e).reduce((e,t)=>!e||r(e,t)||"0"===e?t:e,0)},_t=e=>!!e.loaded||"function"==typeof e.lib,Fn=e=>!!e.loading;function vn(e,t,r){let o=e[t][r];return yt(e[t][r],function(e,t){return!_t(o[e])&&he(e,t)})}function Dn(e,t,r){let o=e[t][r];return yt(e[t][r],function(e,t){let r=e=>_t(e)||Fn(e);return r(o[t])?!r(o[e])||!!he(e,t):!r(o[e])&&he(e,t)})}function kn(e){return"loaded-first"===e?Dn:vn}function ke(e,t,r,o){if(!e)return;let{shareConfig:n,scope:i=me,strategy:a}=r,s=Array.isArray(i)?i:[i];for(let i of s)if(n&&e[i]&&e[i][t]){let{requiredVersion:s}=n,l=kn(a)(e,i,t),c=()=>{if(n.singleton){if("string"==typeof s&&!De(l,s)){let o=`Version ${l} from ${l&&e[i][t][l].from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${s})`;n.strictVersion?B(o):He(o)}return e[i][t][l]}if(!1===s||"*"===s||De(l,s))return e[i][t][l];for(let[r,o]of Object.entries(e[i][t]))if(De(r,s))return o},u={shareScopeMap:e,scope:i,pkgName:t,version:l,GlobalFederation:de.__FEDERATION__,resolver:c};return(o.emit(u)||u).resolver()}}function nr(){return de.__FEDERATION__.__SHARE__}function Ut(e){var t;let{pkgName:r,extraOptions:o,shareInfos:n}=e,i=null!=(t=null==o?void 0:o.resolver)?t:e=>{if(!e)return;let t={};e.forEach(e=>{t[e.version]=e});let r=yt(t,function(e,r){return!_t(t[e])&&he(e,r)});return t[r]};return Object.assign({},i(n[r]),null==o?void 0:o.customShareInfo)}function Hn(){return"undefined"!=typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:""}function Cn(e,t){for(let r of e){let e=t.startsWith(r.name),o=t.replace(r.name,"");if(e){if(o.startsWith("/")){return o=`.${o}`,{pkgNameOrAlias:r.name,expose:o,remote:r}}if(""===o)return{pkgNameOrAlias:r.name,expose:".",remote:r}}let n=r.alias&&t.startsWith(r.alias),i=r.alias&&t.replace(r.alias,"");if(r.alias&&n){if(i&&i.startsWith("/")){return i=`.${i}`,{pkgNameOrAlias:r.alias,expose:i,remote:r}}if(""===i)return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function xn(e,t){for(let r of e)if(t===r.name||r.alias&&t===r.alias)return r}function Gn(e,t){let r=en(),o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(t=>{null!=e&&e.find(e=>e.name!==t.name)&&e.push(t)}),e&&e.length>0&&e.forEach(e=>{o.forEach(r=>{r.applyPlugin(e,t)})}),e}var or=".then(callbacks[0]).catch(callbacks[1])";async function Un({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):new Function("callbacks",`import("${e}")${or}`)([r,o])}catch(e){o(e)}})}async function jn({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):"undefined"==typeof __system_context__?System.import(e).then(r).catch(o):new Function("callbacks",`System.import("${e}")${or}`)([r,o])}catch(e){o(e)}})}function sr(e,t,r){let{remoteEntryKey:o,entryExports:n}=ht(e,t);return A(n,L(Je,O,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o})),n}async function Vn({name:e,globalName:t,entry:r,loaderHook:o,getEntryUrl:n}){let{entryExports:i}=ht(e,t);return i||J(n?n(r):r,{attrs:{},createScriptHook:(e,t)=>{let r=o.lifecycle.createScript.emit({url:e,attrs:t});if(r&&(r instanceof HTMLScriptElement||"script"in r||"timeout"in r))return r}}).then(()=>sr(e,t,r)).catch(t=>{throw A(void 0,L(Ae,O,{remoteName:e,resourceUrl:r})),t})}async function Bn({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o}){let{entry:n,entryGlobalName:i,name:a,type:s}=e;switch(s){case"esm":case"module":return Un({entry:n,remoteEntryExports:t});case"system":return jn({entry:n,remoteEntryExports:t});default:return Vn({entry:n,globalName:i,name:a,loaderHook:r,getEntryUrl:o})}}async function Wn({remoteInfo:e,loaderHook:t}){let{entry:r,entryGlobalName:o,name:n,type:i}=e,{entryExports:a}=ht(n,o);return a||Z(r,{attrs:{name:n,globalName:o,type:i},loaderHook:{createScriptHook:(e,r={})=>{let o=t.lifecycle.createScript.emit({url:e,attrs:r});if(o&&"url"in o)return o}}}).then(()=>sr(n,o,r)).catch(e=>{throw e})}function at(e){let{entry:t,name:r}=e;return Re(r,t)}async function ne(e){let{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,_inErrorHandling:i=!1}=e,a=at(o);if(r)return r;if(!Q[a]){let e=t.remoteHandler.hooks.lifecycle.loadEntry,s=t.loaderHook;Q[a]=e.emit({loaderHook:s,remoteInfo:o,remoteEntryExports:r}).then(e=>e||(("undefined"!=typeof ENV_TARGET?"web"===ENV_TARGET:U())?Bn({remoteInfo:o,remoteEntryExports:r,loaderHook:s,getEntryUrl:n}):Wn({remoteInfo:o,loaderHook:s}))).catch(async e=>{let n=at(o);if(e instanceof Error&&e.message.includes(Ae)&&!i){let e=e=>ne(M(R({},e),{_inErrorHandling:!0})),i=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e,origin:t,remoteInfo:o,remoteEntryExports:r,globalLoading:Q,uniqueKey:n});if(i)return i}throw e})}return Q[a]}function pe(e){return M(R({},e),{entry:"entry"in e?e.entry:"",type:e.type||Yt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||me})}function ir(e){return R({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},e)}function Kn(e,t){return t.map(t=>{let r=xn(e,t.nameOrAlias);return A(r,`Unable to preload ${t.nameOrAlias} as it is not included in ${!r&&Ie({remoteInfo:r,remotes:e})}`),{remote:r,preloadConfig:ir(t)}})}function qn(e){return e?e.map(e=>"."===e?e:e.startsWith("./")?e.replace("./",""):e):[]}function ar(e,t,r,o=!0){let{cssAssets:n,jsAssetsWithoutEntry:i,entryAssets:a}=r;if(t.options.inBrowser){if(a.forEach(r=>{let{moduleInfo:o}=r,n=t.moduleCache.get(e.name);ne(n?{origin:t,remoteInfo:o,remoteEntryExports:n.remoteEntryExports}:{origin:t,remoteInfo:o,remoteEntryExports:void 0})}),o){let e={rel:"preload",as:"style"};n.forEach(r=>{let{link:o,needAttach:n}=le({url:r,cb:()=>{},attrs:e,createLinkHook:(e,r)=>{let o=t.loaderHook.lifecycle.createLink.emit({url:e,attrs:r});if(o instanceof HTMLLinkElement)return o}});n&&document.head.appendChild(o)})}else{let e={rel:"stylesheet",type:"text/css"};n.forEach(r=>{let{link:o,needAttach:n}=le({url:r,cb:()=>{},attrs:e,createLinkHook:(e,r)=>{let o=t.loaderHook.lifecycle.createLink.emit({url:e,attrs:r});if(o instanceof HTMLLinkElement)return o},needDeleteLink:!1});n&&document.head.appendChild(o)})}if(o){let e={rel:"preload",as:"script"};i.forEach(r=>{let{link:o,needAttach:n}=le({url:r,cb:()=>{},attrs:e,createLinkHook:(e,r)=>{let o=t.loaderHook.lifecycle.createLink.emit({url:e,attrs:r});if(o instanceof HTMLLinkElement)return o}});n&&document.head.appendChild(o)})}else{let r={fetchpriority:"high",type:"module"===(null==e?void 0:e.type)?"module":"text/javascript"};i.forEach(e=>{let{script:o,needAttach:n}=Te({url:e,cb:()=>{},attrs:r,createScriptHook:(e,r)=>{let o=t.loaderHook.lifecycle.createScript.emit({url:e,attrs:r});if(o instanceof HTMLScriptElement)return o},needDeleteScript:!0});n&&document.head.appendChild(o)})}}}var oe=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let e;return e=await ne({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports}),A(e,`remoteEntryExports is undefined \n ${Ie(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async get(e,t,r,o){let n,{loadFactory:i=!0}=r||{loadFactory:!0},a=await this.getEntry();if(!this.inited){let t=this.host.shareScopeMap,r=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];r.length||r.push("default"),r.forEach(e=>{t[e]||(t[e]={})});let n=t[r[0]],i=[],s={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?r:this.remoteInfo.shareScope||"default"};Object.defineProperty(s,"shareScopeMap",{value:t,enumerable:!1});let l=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:n,remoteEntryInitOptions:s,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});void 0===(null==a?void 0:a.init)&&B(L(Ze,O,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await a.init(l.shareScope,l.initScope,l.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(M(R({},l),{id:e,remoteSnapshot:o,remoteEntryExports:a}))}this.lib=a,this.inited=!0,n=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:t,moduleInfo:this.remoteInfo}),n||(n=await a.get(t)),A(n,`${fe(this.remoteInfo)} remote don't export ${t}.`);let s=Jr(this.remoteInfo.name,t),l=this.wraperFactory(n,s);return i?await l():l}wraperFactory(e,t){function r(e,t){e&&"object"==typeof e&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for("mf_module_id"))&&Object.defineProperty(e,Symbol.for("mf_module_id"),{value:t,enumerable:!1})}return e instanceof Promise?async()=>{let o=await e();return r(o,t),o}:()=>{let o=e();return r(o,t),o}}},D=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){"function"==typeof e&&this.listeners.add(e)}once(e){let t=this;this.on(function r(...o){return t.remove(r),e.apply(null,o)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},H=class extends D{emit(...e){let t,r=Array.from(this.listeners);if(r.length>0){let o=0,n=t=>!1!==t&&(o<r.length?Promise.resolve(r[o++].apply(null,e)).then(n):t);t=n()}return Promise.resolve(t)}};function cr(e,t){if(!dt(t))return!1;if(e!==t)for(let r in e)if(!(r in t))return!1;return!0}var X=class extends D{constructor(e){super(),this.onerror=B,this.type=e}emit(e){dt(e)||B(`The data for the "${this.type}" hook should be an object.`);for(let t of this.listeners)try{let r=t(e);if(!cr(e,r)){this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}e=r}catch(e){He(e),this.onerror(e)}return e}},V=class extends D{constructor(e){super(),this.onerror=B,this.type=e}emit(e){dt(e)||B(`The response data for the "${this.type}" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let r=0,o=t=>(He(t),this.onerror(t),e),n=i=>{if(cr(e,i)){if(e=i,r<t.length)try{return Promise.resolve(t[r++](e)).then(n,o)}catch(e){return o(e)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(n(e))}return Promise.resolve(e)}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var r;A(Yr(e),"Plugin configuration is invalid.");let o=e.name;A(o,"A name must be provided by the plugin."),this.registerPlugins[o]||(this.registerPlugins[o]=e,null==(r=e.apply)||r.call(e,t),Object.keys(this.lifecycle).forEach(t=>{let r=e[t];r&&this.lifecycle[t].on(r)}))}removePlugin(e){A(e,"A name is required.");let t=this.registerPlugins[e];A(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(e=>{"name"!==e&&this.lifecycle[e].remove(t[e])})}};function lr(e,t){let r=Bt(t);r.url||B(`The attribute remoteEntry of ${e.name} must not be undefined.`);let o=ce(t,r.url);!U()&&!o.startsWith("http")&&(o=`https:${o}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=o,e.version=t.version,e.buildVersion=t.buildVersion}function zn(){return{name:"snapshot-plugin",async afterResolve(e){let{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:i,id:a}=e;if(!ft(t)||!jt(t)){let{remoteSnapshot:s,globalSnapshot:l}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:a});lr(i,s);let c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[o],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:c,remoteInfo:i,remote:t,remoteSnapshot:s,globalSnapshot:l});return u&&ar(i,n,u,!1),M(R({},e),{remoteSnapshot:s})}return e}}}function Xn(e){let t=e.split(":");return 1===t.length?{name:t[0],version:void 0}:2===t.length?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function ur(e,t,r,o,n={},i){let a=fe(t),{value:s}=te(e,a),l=i||s;if(l&&!$e(l)&&(r(l,t,o),l.remotesInfo)){let t=Object.keys(l.remotesInfo);for(let o of t){if(n[o])continue;n[o]=!0;let t=Xn(o),i=l.remotesInfo[o];ur(e,{name:t.name,version:i.matchedVersion},r,!1,n,void 0)}}}var st=(e,t)=>document.querySelector(`${e}[${"link"===e?"href":"src"}="${t}"]`);function Yn(e,t,r,o,n){let i=[],a=[],s=[],l=new Set,c=new Set,{options:u}=e,{preloadConfig:m}=t,{depsRemote:h}=m;if(ur(o,r,(t,r,o)=>{var n;let l;if(o)l=m;else if(Array.isArray(h)){let e=h.find(e=>e.nameOrAlias===r.name||e.nameOrAlias===r.alias);if(!e)return;l=ir(e)}else{if(!0!==h)return;l=m}let c=ce(t,Bt(t).url);c&&s.push({name:r.name,moduleInfo:{name:r.name,entry:c,type:"remoteEntryType"in t?t.remoteEntryType:"global",entryGlobalName:"globalName"in t?t.globalName:r.name,shareScope:"",version:"version"in t?t.version:void 0},url:c});let u="modules"in t?t.modules:[],f=qn(l.exposes);function p(e){let r=e.map(e=>ce(t,e));return l.filter?r.filter(l.filter):r}if(f.length&&"modules"in t&&(u=null==(n=null==t?void 0:t.modules)?void 0:n.reduce((e,t)=>(-1!==(null==f?void 0:f.indexOf(t.moduleName))&&e.push(t),e),[])),u){let o=u.length;for(let n=0;n<o;n++){let o=u[n],s=`${r.name}/${o.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:"."===o.moduleName?r.name:s,name:r.name,remoteSnapshot:t,preloadConfig:l,remote:r,origin:e}),!tn(s)&&("all"===l.resourceCategory?(i.push(...p(o.assets.css.async)),i.push(...p(o.assets.css.sync)),a.push(...p(o.assets.js.async)),a.push(...p(o.assets.js.sync))):(l.resourceCategory="sync")&&(i.push(...p(o.assets.css.sync)),a.push(...p(o.assets.js.sync))),rn(s))}}},!0,{},n),n.shared&&n.shared.length>0){let t=(t,r)=>{let o=ke(e.shareScopeMap,r.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare);o&&"function"==typeof o.lib&&(r.assets.js.sync.forEach(e=>{l.add(e)}),r.assets.css.sync.forEach(e=>{c.add(e)}))};n.shared.forEach(e=>{var r;let o=null==(r=u.shared)?void 0:r[e.sharedName];if(!o)return;let n=e.version?o.find(t=>t.version===e.version):o;n&&Vt(n).forEach(r=>{t(r,e)})})}let f=a.filter(e=>!l.has(e)&&!st("script",e));return{cssAssets:i.filter(e=>!c.has(e)&&!st("link",e)),jsAssetsWithoutEntry:f,entryAssets:s.filter(e=>!st("script",e.url))}}var Jn=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){let{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:i,remoteSnapshot:a}=e;return U()?ft(n)&&jt(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(lr(o,a),Yn(t,r,o,i,a)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function fr(e,t){let r=Le({name:t.name,version:t.options.version}),o=r&&"remotesInfo"in r&&r.remotesInfo&&te(r.remotesInfo,e.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:vt(),remoteSnapshot:Le({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:vt(),remoteSnapshot:Le({name:e.name,version:"version"in e?e.version:void 0})}}var ct=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new H("beforeLoadRemoteSnapshot"),loadSnapshot:new V("loadGlobalSnapshot"),loadRemoteSnapshot:new V("loadRemoteSnapshot"),afterLoadSnapshot:new V("afterLoadSnapshot")}),this.manifestLoading=de.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){let{options:o}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:o,moduleInfo:e});let n=Le({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},Qr({[this.HostInstance.options.name]:n})),n&&"remotesInfo"in n&&!te(n.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(n.remotesInfo=M(R({},null==n?void 0:n.remotesInfo),{[e.name]:{matchedVersion:"version"in e?e.version:e.entry}}));let i,a,{hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:c}=this.getGlobalRemoteInfo(e),{remoteSnapshot:u,globalSnapshot:m}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:c});if(u)if($e(u)){let t=U()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",r=await this.getManifestJson(t,e,{});i=r,a=Dt(M(R({},e),{entry:t}),r)}else{let{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:u,from:"global"});i=t,a=m}else if(ft(e)){let t=await this.getManifestJson(e.entry,e,{}),r=Dt(e,t),{remoteSnapshot:o}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:t,from:"global"});i=o,a=r}else B(L(rt,O,{hostName:e.name,hostVersion:e.version,globalSnapshot:JSON.stringify(m)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:o,moduleInfo:e,remoteSnapshot:i}),{remoteSnapshot:i,globalSnapshot:a}}getGlobalRemoteInfo(e){return fr(e,this.HostInstance)}async getManifestJson(e,t,r){let o=async()=>{let r=this.manifestCache.get(e);if(r)return r;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{});(!t||!(t instanceof Response))&&(t=await fetch(e,{})),r=await t.json()}catch(o){r=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:o,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),r||(delete this.manifestLoading[e],B(L(Qe,O,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${o}`)))}return A(r.metaData&&r.exposes&&r.shared,`${e} is not a federation manifest`),this.manifestCache.set(e,r),r};return this.manifestLoading[e]||(this.manifestLoading[e]=(async()=>{let r=await o(),n=qe(r,{version:e}),{remoteSnapshot:i}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:r,remoteSnapshot:n,manifestUrl:e,from:"manifest"});return i})().then(e=>e)),this.manifestLoading[e]}},lt=class{constructor(e){this.hooks=new q({afterResolve:new V("afterResolve"),beforeLoadShare:new V("beforeLoadShare"),loadShare:new H,resolveShare:new X("resolveShare"),initContainerShareScopeMap:new X("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){let{shareInfos:r,shared:o}=rr(e,t);return Object.keys(r).forEach(e=>{r[e].forEach(r=>{r.scope.forEach(o=>{var n;(null==(n=this.shareScopeMap[o])?void 0:n[e])||this.setShared({pkgName:e,lib:r.lib,get:r.get,loaded:r.loaded||!!r.lib,shared:r,from:t.name})})})}),{shareInfos:r,shared:o}}async loadShare(e,t){let{host:r}=this,o=Ut({pkgName:e,extraOptions:t,shareInfos:r.options.shared});null!=o&&o.scope&&await Promise.all(o.scope.map(async e=>{await Promise.all(this.initializeSharing(e,{strategy:o.strategy}))}));let n=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:o,shared:r.options.shared,origin:r}),{shareInfo:i}=n;A(i,`Cannot find ${e} Share in the ${r.options.name}. Please ensure that the ${e} Share parameters have been injected`);let a=ke(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare),s=e=>{e.useIn||(e.useIn=[]),Ft(e.useIn,r.options.name)};if(a&&a.lib)return s(a),a.lib;if(a&&a.loading&&!a.loaded){let e=await a.loading;return a.loaded=!0,a.lib||(a.lib=e),s(a),e}if(a){let t=(async()=>{let e=await a.get();return s(a),a.loaded=!0,a.lib=e,e})();return this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:t}),t}{if(null!=t&&t.customShareInfo)return!1;let o=(async()=>{let t=await i.get();i.lib=t,i.loaded=!0,s(i);let r=ke(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare);return r&&(r.lib=t,r.loaded=!0,r.from=i.from),t})();return this.setShared({pkgName:e,loaded:!1,shared:i,from:r.options.name,lib:null,loading:o}),o}}initializeSharing(e=me,t){let{host:r}=this,o=null==t?void 0:t.from,n=null==t?void 0:t.strategy,i=null==t?void 0:t.initScope,a=[];if("build"!==o){let{initTokens:t}=this;i||(i=[]);let r=t[e];if(r||(r=t[e]={from:this.host.name}),i.indexOf(r)>=0)return a;i.push(r)}let s=this.shareScopeMap,l=r.options.name;s[e]||(s[e]={});let c=s[e],u=async t=>{let{module:o}=await r.remoteHandler.getRemoteModuleAndOptions({id:t});if(o.getEntry){let n;try{n=await o.getEntry()}catch(e){n=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:e,from:"runtime",lifecycle:"beforeLoadShare",origin:r})}o.inited||(await(t=>t&&t.init&&t.init(s[e],i))(n),o.inited=!0)}};return Object.keys(r.options.shared).forEach(t=>{r.options.shared[t].forEach(r=>{r.scope.includes(e)&&((e,t)=>{var r;let{version:o,eager:n}=t;c[e]=c[e]||{};let i=c[e],a=i[o],s=!(!a||!(a.eager||null!=(r=a.shareConfig)&&r.eager));(!a||"loaded-first"!==a.strategy&&!a.loaded&&(!n!=!s?n:l>a.from))&&(i[o]=t)})(t,r)})}),("version-first"===r.options.shareStrategy||"version-first"===n)&&r.options.remotes.forEach(t=>{t.shareScope===e&&a.push(u(t.name))}),a}loadShareSync(e,t){let{host:r}=this,o=Ut({pkgName:e,extraOptions:t,shareInfos:r.options.shared});null!=o&&o.scope&&o.scope.forEach(e=>{this.initializeSharing(e,{strategy:o.strategy})});let n=ke(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare),i=e=>{e.useIn||(e.useIn=[]),Ft(e.useIn,r.options.name)};if(n){if("function"==typeof n.lib)return i(n),n.loaded||(n.loaded=!0,n.from===r.options.name&&(o.loaded=!0)),n.lib;if("function"==typeof n.get){let t=n.get();if(!(t instanceof Promise))return i(n),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:t,shared:n}),t}}if(o.lib)return o.loaded||(o.loaded=!0),o.lib;if(o.get){let n=o.get();if(n instanceof Promise){let o="build"===(null==t?void 0:t.from)?tt:we;throw new Error(L(o,O,{hostName:r.options.name,sharedPkgName:e}))}return o.lib=n,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:o.lib,shared:o}),o.lib}throw new Error(L(we,O,{hostName:r.options.name,sharedPkgName:e}))}initShareScopeMap(e,t,r={}){let{host:o}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:o.options,origin:o,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:o,loading:n,loaded:i,get:a}){let s=t,{version:l,scope:c="default"}=s,u=xe(s,["version","scope"]);(Array.isArray(c)?c:[c]).forEach(t=>{if(this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),!this.shareScopeMap[t][e][l])return this.shareScopeMap[t][e][l]=M(R({version:l,scope:[t]},u),{lib:o,loaded:i,loading:n}),void(a&&(this.shareScopeMap[t][e][l].get=a));let s=this.shareScopeMap[t][e][l];n&&!s.loading&&(s.loading=n),i&&!s.loaded&&(s.loaded=i),r&&s.from!==r&&(s.from=r)})}_setGlobalShareScopeMap(e){let t=nr(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},ut=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new X("beforeRegisterRemote"),registerRemote:new X("registerRemote"),beforeRequest:new V("beforeRequest"),onLoad:new H("onLoad"),handlePreloadModule:new D("handlePreloadModule"),errorLoadRemote:new H("errorLoadRemote"),beforePreloadRemote:new H("beforePreloadRemote"),generatePreloadAssets:new H("generatePreloadAssets"),afterPreloadRemote:new H,loadEntry:new H}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((e,t)=>(this.registerRemote(t,e,{force:!1}),e),e.remotes)}setIdToRemoteMap(e,t){let{remote:r,expose:o}=t,{name:n,alias:i}=r;if(this.idToRemoteMap[e]={name:r.name,expose:o},i&&e.startsWith(n)){let t=e.replace(n,i);return void(this.idToRemoteMap[t]={name:r.name,expose:o})}if(i&&e.startsWith(i)){let t=e.replace(i,n);this.idToRemoteMap[t]={name:r.name,expose:o}}}async loadRemote(e,t){let{host:r}=this;try{let{loadFactory:o=!0}=t||{loadFactory:!0},{module:n,moduleOptions:i,remoteMatchInfo:a}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:s,remote:l,expose:c,id:u,remoteSnapshot:m}=a,h=await n.get(u,c,t,m),f=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:s,expose:c,exposeModule:o?h:void 0,exposeModuleFactory:o?void 0:h,remote:l,options:i,moduleInstance:n,origin:r});return this.setIdToRemoteMap(e,a),"function"==typeof f?f:h}catch(o){let{from:n="runtime"}=t||{from:"runtime"},i=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:o,from:n,lifecycle:"onLoad",origin:r});if(!i)throw o;return i}}async preloadRemote(e){let{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});let r=Kn(t.options.remotes,e);await Promise.all(r.map(async e=>{let{remote:r}=e,o=pe(r),{globalSnapshot:n,remoteSnapshot:i}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:r}),a=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:e,remote:r,remoteInfo:o,globalSnapshot:n,remoteSnapshot:i});a&&ar(o,t,a)}))}registerRemotes(e,t){let{host:r}=this;e.forEach(e=>{this.registerRemote(e,r.options.remotes,{force:null==t?void 0:t.force})})}async getRemoteModuleAndOptions(e){let t,{host:r}=this,{id:o}=e;try{t=await this.hooks.lifecycle.beforeRequest.emit({id:o,options:r.options,origin:r})}catch(e){if(t=await this.hooks.lifecycle.errorLoadRemote.emit({id:o,options:r.options,origin:r,from:"runtime",error:e,lifecycle:"beforeRequest"}),!t)throw e}let{id:n}=t,i=Cn(r.options.remotes,n);A(i,L(et,O,{hostName:r.options.name,requestId:n}));let{remote:a}=i,s=pe(a),l=await r.sharedHandler.hooks.lifecycle.afterResolve.emit(M(R({id:n},i),{options:r.options,origin:r,remoteInfo:s})),{remote:c,expose:u}=l;A(c&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let m=r.moduleCache.get(c.name),h={host:r,remoteInfo:s};return m||(m=new oe(h),r.moduleCache.set(c.name,m)),{module:m,moduleOptions:h,remoteMatchInfo:l}}registerRemote(e,t,r){let{host:o}=this,n=()=>{if(e.alias){let r=t.find(t=>{var r;return e.alias&&(t.name.startsWith(e.alias)||(null==(r=t.alias)?void 0:r.startsWith(e.alias)))});A(!r,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${r&&r.name} name or alias`)}"entry"in e&&U()&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=me),e.type||(e.type=Yt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});let i=t.find(t=>t.name===e.name);if(i){let a=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];null!=r&&r.force&&(this.removeRemote(i),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o}),Se(a.join(" ")))}else n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o})}removeRemote(e){var t;try{let{host:r}=this,{name:o}=e,n=r.options.remotes.findIndex(e=>e.name===o);-1!==n&&r.options.remotes.splice(n,1);let i=r.moduleCache.get(e.name);if(i){let o=i.remoteInfo,n=o.entryGlobalName;P[n]&&(null!=(t=Object.getOwnPropertyDescriptor(P,n))&&t.configurable?delete P[n]:P[n]=void 0);let a=at(i.remoteInfo);Q[a]&&delete Q[a],r.snapshotHandler.manifestCache.delete(o.entry);let s=o.buildVersion?Re(o.name,o.buildVersion):o.name,l=P.__FEDERATION__.__INSTANCES__.findIndex(e=>o.buildVersion?e.options.id===s:e.name===s);if(-1!==l){let e=P.__FEDERATION__.__INSTANCES__[l];s=e.options.id||s;let t=nr(),r=!0,n=[];Object.keys(t).forEach(e=>{let i=t[e];i&&Object.keys(i).forEach(t=>{let a=i[t];a&&Object.keys(a).forEach(i=>{let s=a[i];s&&Object.keys(s).forEach(a=>{let l=s[a];l&&"object"==typeof l&&l.from===o.name&&(l.loaded||l.loading?(l.useIn=l.useIn.filter(e=>e!==o.name),l.useIn.length?r=!1:n.push([e,t,i,a])):n.push([e,t,i,a]))})})})}),r&&(e.shareScopeMap={},delete t[s]),n.forEach(([e,r,o,n])=>{var i,a,s;null==(s=null==(a=null==(i=t[e])?void 0:i[r])?void 0:a[o])||delete s[n]}),P.__FEDERATION__.__INSTANCES__.splice(l,1)}let{hostGlobalSnapshot:c}=fr(e,r);if(c){let t=c&&"remotesInfo"in c&&c.remotesInfo&&te(c.remotesInfo,e.name).key;t&&(delete c.remotesInfo[t],de.__FEDERATION__.__MANIFEST_LOADING__[t]&&delete de.__FEDERATION__.__MANIFEST_LOADING__[t])}r.moduleCache.delete(e.name)}}catch(e){it.log("removeRemote fail: ",e)}}},Zn="boolean"!=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN||!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN,Y=class{constructor(e){this.hooks=new q({beforeInit:new X("beforeInit"),init:new D,beforeInitContainer:new V("beforeInitContainer"),initContainer:new V("initContainer")}),this.version="0.22.0",this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new D,createScript:new D,createLink:new D,fetch:new H,loadEntryError:new H,getModuleFactory:new H}),this.bridgeHook=new q({beforeBridgeRender:new D,afterBridgeRender:new D,beforeBridgeDestroy:new D,afterBridgeDestroy:new D});let t=Zn?[zn(),Jn()]:[],r={id:Hn(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:U()};this.name=e.name,this.options=r,this.snapshotHandler=new ct(this),this.sharedHandler=new lt(this),this.remoteHandler=new ut(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){this.registerPlugins(e.plugins);let t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=me,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){let o=pe({name:e,entry:t}),n=new oe({host:this,remoteInfo:o});return n.remoteEntryExports=r,this.moduleCache.set(e,n),n}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){let{shared:r}=rr(e,t),{userOptions:o,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),i=this.remoteHandler.formatAndRegisterRemote(n,o),{shared:a}=this.sharedHandler.registerShared(n,o),s=[...n.plugins];o.plugins&&o.plugins.forEach(e=>{s.includes(e)||s.push(e)});let l=M(R(R({},e),t),{plugins:s,remotes:i,shared:a});return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){let t=Gn(e,this);this.options.plugins=this.options.plugins.reduce((e,t)=>(t&&e&&!e.find(e=>e.name===t.name)&&e.push(t),e),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,M(R({},this.options),{shared:e}))}};function Qn(){return"undefined"!=typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:""}function dr(e,t){let r=Qn();return P.__FEDERATION__.__INSTANCES__.find(o=>!!(r&&o.options.id===r||o.options.name===e&&!o.options.version&&!t||o.options.name===e&&t&&o.options.version===t))}function hr(e){let t=new(qt()||Y)(e);return Kt(t),t}var I=null;function eo(e){let t=dr(e.name,e.version);return t?(t.initOptions(e),I||(I=t),t):I=hr(e)}function to(...e){return A(I,L(K,O)),I.loadRemote.apply(I,e)}function ro(...e){return A(I,L(K,O)),I.loadShare.apply(I,e)}function no(...e){return A(I,L(K,O)),I.loadShareSync.apply(I,e)}function oo(...e){return A(I,L(K,O)),I.preloadRemote.apply(I,e)}function so(...e){return A(I,L(K,O)),I.registerRemotes.apply(I,e)}function io(...e){return A(I,L(K,O)),I.registerPlugins.apply(I,e)}function ao(){return I}function co(...e){return A(I,L(K,O)),I.registerShared.apply(I,e)}return zt(Y),exports.MFRuntime=Et,exports.MFSDK=Ye,exports}({});
|