@module-federation/bridge-vue3 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +4 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -4,5 +4,5 @@ ${r.slice(0,5).join(`
|
|
|
4
4
|
`)}`:void 0}catch{return}}var tt=class{constructor(e,t=X){this.prefix=e,this.delegate=t??X}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??X}emit(e,t){const r=this.delegate,n=we()?Jt():void 0,o=n?[...t,n]:t,s=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(const i of s){const a=r[i];if(typeof a=="function"){a.call(r,this.prefix,...o);return}}for(const i of s){const a=X[i];if(typeof a=="function"){a.call(X,this.prefix,...o);return}}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){we()&&this.emit("debug",e)}};function rt(e){return new tt(e)}function Xt(e){const t=new tt(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Xt(Kt);async function nt(e,t){try{return await e()}catch(r){Ze(r);return}}function Ie(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function ot(e){let t=null,r=!0,n=2e4,o;const s=document.getElementsByTagName("script");for(let c=0;c<s.length;c++){const f=s[c],h=f.getAttribute("src");if(h&&Ie(h,e.url)){t=f,r=!1;break}}if(!t){const c=e.attrs;t=document.createElement("script"),t.type=(c==null?void 0:c.type)==="module"?"module":"text/javascript";let f;e.createScriptHook&&(f=e.createScriptHook(e.url,e.attrs),f instanceof HTMLScriptElement?t=f:typeof f=="object"&&("script"in f&&f.script&&(t=f.script),"timeout"in f&&f.timeout&&(n=f.timeout))),t.src||(t.src=e.url),c&&!f&&Object.keys(c).forEach(h=>{t&&(h==="async"||h==="defer"?t[h]=c[h]:t.getAttribute(h)||t.setAttribute(h,c[h]))})}let i=null;const a=typeof window<"u"?c=>{if(c.filename&&Ie(c.filename,e.url)){const f=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${c.message} (${c.filename}:${c.lineno}:${c.colno})`);f.name="ScriptExecutionError",i=f}}:null;a&&window.addEventListener("error",a);const l=async(c,f)=>{clearTimeout(o),a&&window.removeEventListener("error",a);const h=()=>{if((f==null?void 0:f.type)==="error"){const u=new Error(f!=null&&f.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);u.name="ScriptNetworkError",e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(u))}else i?e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(i)):e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,nt(()=>{const{needDeleteScript:u=!0}=e;u&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),c&&typeof c=="function")){const u=c(f);if(u instanceof Promise){const d=await u;return h(),d}return h(),u}h()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o=setTimeout(()=>{l(null,{type:"error",isTimeout:!0})},n),{script:t,needAttach:r}}function Ee(e){let t=null,r=!0;const n=document.getElementsByTagName("link");for(let s=0;s<n.length;s++){const i=n[s],a=i.getAttribute("href"),l=i.getAttribute("rel");if(a&&Ie(a,e.url)&&l===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let s;const i=e.attrs;e.createLinkHook&&(s=e.createLinkHook(e.url,i),s instanceof HTMLLinkElement&&(t=s)),i&&!s&&Object.keys(i).forEach(a=>{t&&!t.getAttribute(a)&&t.setAttribute(a,i[a])})}const o=(s,i)=>{const a=()=>{(i==null?void 0:i.type)==="error"?e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(i)):e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,nt(()=>{const{needDeleteLink:l=!0}=e;l&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),s)){const l=s(i);return a(),l}a()};return t.onerror=o.bind(null,t.onerror),t.onload=o.bind(null,t.onload),{link:t,needAttach:r}}function Yt(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((o,s)=>{const{script:i,needAttach:a}=ot({url:e,cb:o,onErrorCallback:s,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});a&&document.head.appendChild(i)})}const se=new Map;function B(e){if(!e)throw new Error("import specifier is required");if(se.has(e))return se.get(e);const t=new Function("name","return import(name)")(e).then(r=>r).catch(r=>{throw console.error(`Error importing module ${e}:`,r),se.delete(e),r});return se.set(e,t),t}const st=async()=>{const e=await B("node-fetch");return e.default||e},Zt=async(e,t,r)=>{const o=await((s,i)=>r.lifecycle.fetch.emit(s,i))(e,t||{});return!o||!(o instanceof Response)?(typeof fetch>"u"?await st():fetch)(e,t||{}):o},Qt=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t,r,n)=>{if(n!=null&&n.createScriptHook){const a=n.createScriptHook(e);a&&typeof a=="object"&&"url"in a&&(e=a.url)}let o;try{o=new URL(e)}catch(a){console.error("Error constructing URL:",a),t(new Error(`Invalid URL: ${a}`));return}const s=async()=>n!=null&&n.fetch?(a,l)=>Zt(a,l,n):typeof fetch>"u"?st():fetch,i=async(a,l)=>{var c;try{const h=await(await a(l.href)).text(),[u,d]=await Promise.all([B("path"),B("vm")]),m={exports:{},module:{exports:{}}},y=l.pathname.split("/").slice(0,-1).join("/"),g=u.basename(l.pathname),p=new d.Script(`(function(exports, module, require, __dirname, __filename) {${h}
|
|
5
5
|
})`,{filename:g,importModuleDynamically:((c=d.constants)==null?void 0:c.USE_MAIN_CONTEXT_DEFAULT_LOADER)??B});let E;E=(await B("node:module")).createRequire(l.protocol==="file:"||l.protocol==="node:"?l.href:u.join(process.cwd(),"__mf_require_base__.js")),p.runInThisContext()(m.exports,m.module,E,y,g);const b=m.module.exports||m.exports;if(r&&b&&r.globalName){t(void 0,b[r.globalName]||b);return}t(void 0,b)}catch(f){t(f instanceof Error?f:new Error(`Script execution error: ${f}`))}};s().then(async a=>{if((r==null?void 0:r.type)==="esm"||(r==null?void 0:r.type)==="module")return Te(o.href,{fetch:a,vm:await B("vm")}).then(async l=>{await l.evaluate(),t(void 0,l.namespace)}).catch(l=>{t(l instanceof Error?l:new Error(`Script execution error: ${l}`))});i(a,o)}).catch(a=>{t(a)})}:(e,t,r,n)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},er=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t)=>new Promise((r,n)=>{Qt(e,(o,s)=>{var i,a;if(o)n(o);else{const l=((i=t==null?void 0:t.attrs)==null?void 0:i.globalName)||`__FEDERATION_${(a=t==null?void 0:t.attrs)==null?void 0:a.name}:custom__`;r(globalThis[l]=s)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},_e=new Map;async function Te(e,t){if(_e.has(e))return _e.get(e);const{fetch:r,vm:n}=t,o=await(await r(e)).text(),s=new n.SourceTextModule(o,{importModuleDynamically:async(i,a)=>{const l=new URL(i,e).href;return Te(l,t)}});return _e.set(e,s),await s.link(async i=>{const a=new URL(i,e).href;return await Te(a,t)}),s}const D=rt("[ Module Federation Bridge Vue3 ]"),tr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,it=(e,t,r,n)=>{const o=[`${[t[e]]} #${e}`];return r&&o.push(`args: ${JSON.stringify(r)}`),o.push(tr(e)),n&&o.push(`Original Error Message:
|
|
6
6
|
${n}`),o.join(`
|
|
7
|
-
`)};function rr(e,t,r,n,o,s){return n(it(e,t,r,o))}const G="[ Federation Runtime ]",ve=rt(G);function k(e,t,r,n,o){e||S(t)}function S(e,t,r,n,o){if(t!==void 0)return rr(e,t,r??{},i=>{throw new Error(`${G}: ${i}`)},n);const s=e;throw s instanceof Error?(s.message.startsWith(G)||(s.message=`${G}: ${s.message}`),s):new Error(`${G}: ${s}`)}function Le(e){e instanceof Error&&(e.message.startsWith(G)||(e.message=`${G}: ${e.message}`)),ve.warn(e)}function nr(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function Q(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Me(e){return typeof e.entry<"u"}function at(e){return!e.entry.includes(".json")}function Ce(e){return e&&typeof e=="object"}const or=Object.prototype.toString;function sr(e){return or.call(e)==="[object Object]"}function ct(e){return Array.isArray(e)?e:[e]}function lt(e){const t={url:"",type:"global",globalName:""};return H||Xe()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}const ir=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},I=typeof globalThis=="object"?globalThis:window,O=(()=>{try{return document.defaultView}catch{return I}})(),ee=O;function le(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function ue(e,t){return Object.hasOwnProperty.call(e,t)}ue(I,"__GLOBAL_LOADING_REMOTE_ENTRY__")||le(I,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const W=I.__GLOBAL_LOADING_REMOTE_ENTRY__;function ut(e){var t,r,n,o,s,i;ue(e,"__VMOK__")&&!ue(e,"__FEDERATION__")&&le(e,"__FEDERATION__",e.__VMOK__),ue(e,"__FEDERATION__")||(le(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),le(e,"__VMOK__",e.__FEDERATION__)),(t=e.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(r=e.__FEDERATION__).__INSTANCES__??(r.__INSTANCES__=[]),(n=e.__FEDERATION__).moduleInfo??(n.moduleInfo={}),(o=e.__FEDERATION__).__SHARE__??(o.__SHARE__={}),(s=e.__FEDERATION__).__MANIFEST_LOADING__??(s.__MANIFEST_LOADING__={}),(i=e.__FEDERATION__).__PRELOADED_MAP__??(i.__PRELOADED_MAP__=new Map)}ut(I);ut(O);function ar(e,t=we()){t&&(I.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.3.0")}function K(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const n of r){const[o,s]=n.split(":"),i=`${o}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}else S(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const xe=()=>O.__FEDERATION__.moduleInfo,cr=(e,t)=>{const r=K(t,Q(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){const{version:n,...o}=e,s=Q(o),i=K(O.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===n)return i}},fe=e=>cr(e,O.__FEDERATION__.moduleInfo),Ue=(e,t)=>{const r=Q(e);return O.__FEDERATION__.moduleInfo[r]=t,O.__FEDERATION__.moduleInfo},lr=e=>(O.__FEDERATION__.moduleInfo={...O.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete O.__FEDERATION__.moduleInfo[r]}),De=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:I[r]}},ur=()=>O.__FEDERATION__.__GLOBAL_PLUGIN__,fr=e=>I.__FEDERATION__.__PRELOADED_MAP__.get(e),hr=e=>I.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Ve="[0-9A-Za-z-]+",Fe=`(?:\\+(${Ve}(?:\\.${Ve})*))`,Z="0|[1-9]\\d*",he="[0-9]+",ft="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Be=`(?:${he}|${ft})`,dr=`(?:-?(${Be}(?:\\.${Be})*))`,We=`(?:${Z}|${ft})`,ht=`(?:-(${We}(?:\\.${We})*))`,be=`${Z}|x|X|\\*`,z=`[v=\\s]*(${be})(?:\\.(${be})(?:\\.(${be})(?:${ht})?${Fe}?)?)?`,mr=`^\\s*(${z})\\s+-\\s+(${z})\\s*$`,pr=`[v=\\s]*${`(${he})\\.(${he})\\.(${he})`}${dr}?${Fe}?`,He="((?:<|>)?=?)",yr=`(\\s*)${He}\\s*(${pr}|${z})`,dt="(?:~>?)",gr=`(\\s*)${dt}\\s+`,mt="(?:\\^)",Er=`(\\s*)${mt}\\s+`,_r="(<|>)?=?\\s*\\*",br=`^${mt}${z}$`,Rr=`v?${`(${Z})\\.(${Z})\\.(${Z})`}${ht}?${Fe}?`,Sr=`^${dt}${z}$`,$r=`^${He}\\s*${z}$`,wr=`^${He}\\s*(${Rr})$|^$`,Nr="^\\s*>=\\s*0.0.0\\s*$";function C(e){return new RegExp(e)}function T(e){return!e||e.toLowerCase()==="x"||e==="*"}function pt(...e){return t=>e.reduce((r,n)=>n(r),t)}function je(e){return e.match(C(wr))}function qe(e,t,r,n){const o=`${e}.${t}.${r}`;return n?`${o}-${n}`:o}function Ir(e){return e.replace(C(mr),(t,r,n,o,s,i,a,l,c,f,h,u)=>(T(n)?r="":T(o)?r=`>=${n}.0.0`:T(s)?r=`>=${n}.${o}.0`:r=`>=${r}`,T(c)?l="":T(f)?l=`<${Number(c)+1}.0.0-0`:T(h)?l=`<${c}.${Number(f)+1}.0-0`:u?l=`<=${c}.${f}.${h}-${u}`:l=`<=${l}`,`${r} ${l}`.trim()))}function Tr(e){return e.replace(C(yr),"$1$2$3")}function vr(e){return e.replace(C(gr),"$1~")}function Ar(e){return e.replace(C(Er),"$1^")}function Pr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(br),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(s)?n==="0"?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.0 <${Number(n)+1}.0.0-0`:i?n==="0"?o==="0"?`>=${n}.${o}.${s}-${i} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s}-${i} <${Number(n)+1}.0.0-0`:n==="0"?o==="0"?`>=${n}.${o}.${s} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${Number(n)+1}.0.0-0`)).join(" ")}function kr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(Sr),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(s)?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:i?`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`)).join(" ")}function Or(e){return e.split(/\s+/).map(t=>t.trim().replace(C($r),(r,n,o,s,i,a)=>{const l=T(o),c=l||T(s),f=c||T(i);return n==="="&&f&&(n=""),a="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&f?(c&&(s=0),i=0,n===">"?(n=">=",c?(o=Number(o)+1,s=0,i=0):(s=Number(s)+1,i=0)):n==="<="&&(n="<",c?o=Number(o)+1:s=Number(s)+1),n==="<"&&(a="-0"),`${n+o}.${s}.${i}${a}`):c?`>=${o}.0.0${a} <${Number(o)+1}.0.0-0`:f?`>=${o}.${s}.0${a} <${o}.${Number(s)+1}.0-0`:r})).join(" ")}function Lr(e){return e.trim().replace(C(_r),"")}function Mr(e){return e.trim().replace(C(Nr),"")}function de(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Cr(e,t){const{preRelease:r}=e,{preRelease:n}=t;if(r===void 0&&n)return 1;if(r&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let o=0,s=r.length;o<=s;o++){const i=r[o],a=n[o];if(i!==a)return i===void 0&&a===void 0?0:i?a?de(i,a):-1:1}return 0}function ie(e,t){return de(e.major,t.major)||de(e.minor,t.minor)||de(e.patch,t.patch)||Cr(e,t)}function Re(e,t){return e.version===t.version}function Dr(e,t){switch(e.operator){case"":case"=":return Re(e,t);case">":return ie(e,t)<0;case">=":return Re(e,t)||ie(e,t)<0;case"<":return ie(e,t)>0;case"<=":return Re(e,t)||ie(e,t)>0;case void 0:return!0;default:return!1}}function Fr(e){return pt(Pr,kr,Or,Lr)(e)}function Hr(e){return pt(Ir,Tr,vr,Ar)(e.trim()).split(/\s+/).join(" ")}function Y(e,t){if(!e)return!1;const r=je(e);if(!r)return!1;const[,n,,o,s,i,a]=r,l={operator:n,version:qe(o,s,i,a),major:o,minor:s,patch:i,preRelease:a==null?void 0:a.split(".")},c=t.split("||");for(const f of c){const h=f.trim();if(!h||h==="*"||h==="x")return!0;try{const u=Hr(h);if(!u.trim())return!0;const d=u.split(" ").map(g=>Fr(g)).join(" ");if(!d.trim())return!0;const m=d.split(/\s+/).map(g=>Mr(g)).filter(Boolean);if(m.length===0)continue;let y=!0;for(const g of m){const p=je(g);if(!p){y=!1;break}const[,E,,b,N,_,$]=p;if(!Dr({operator:E,version:qe(b,N,_,$),major:b,minor:N,patch:_,preRelease:$==null?void 0:$.split(".")},l)){y=!1;break}}if(y)return!0}catch(u){console.error(`[semver] Error processing range part "${h}":`,u);continue}}return!1}const ne="default",yt="global";function Gr(e,t,r,n){var s,i;let o;return"get"in e?o=e.get:"lib"in e?o=()=>Promise.resolve(e.lib):o=()=>Promise.resolve(()=>{S(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),(s=e.shareConfig)!=null&&s.eager&&((i=e.treeShaking)!=null&&i.mode)&&S(`Invalid shared config for "${r}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:o,loaded:e!=null&&e.loaded||"lib"in e?!0:void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??n)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??$e.UNKNOWN,useIn:[]}:void 0}}function gt(e,t){const r=t.shared||{},n=t.name,o=Object.keys(r).reduce((i,a)=>{const l=ct(r[a]);return i[a]=i[a]||[],l.forEach(c=>{i[a].push(Gr(c,n,a,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(o).forEach(i=>{s[i]?o[i].forEach(a=>{s[i].find(l=>l.version===a.version)||s[i].push(a)}):s[i]=o[i]}),{allShareInfos:s,newShareInfos:o}}function te(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===$e.NO_USE?!1:r===$e.CALCULATED?!0:n==="runtime-infer"?t?Ur(e,t):!0:!1}function x(e,t){const r=n=>{if(!Number.isNaN(Number(n))){const o=n.split(".");let s=n;for(let i=0;i<3-o.length;i++)s+=".0";return s}return n};return!!Y(r(e),`<=${r(t)}`)}const re=(e,t)=>{const r=t||function(n,o){return x(n,o)};return Object.keys(e).reduce((n,o)=>!n||r(n,o)||n==="0"?o:n,0)},pe=e=>!!e.loaded||typeof e.lib=="function",xr=e=>!!e.loading,Ur=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function Vr(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){return i?o[l].treeShaking?o[c].treeShaking?!pe(o[l].treeShaking)&&x(l,c):!1:!0:!pe(o[l])&&x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}const U=e=>pe(e)||xr(e);function Br(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){if(i){if(!o[l].treeShaking)return!0;if(!o[c].treeShaking)return!1;if(U(o[c].treeShaking))return U(o[l].treeShaking)?!!x(l,c):!0;if(U(o[l].treeShaking))return!1}return U(o[c])?U(o[l])?!!x(l,c):!0:U(o[l])?!1:x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}function Wr(e){return e==="loaded-first"?Br:Vr}function me(e,t,r,n){if(!e)return;const{shareConfig:o,scope:s=ne,strategy:i,treeShaking:a}=r,l=Array.isArray(s)?s:[s];for(const c of l)if(o&&e[c]&&e[c][t]){const{requiredVersion:f}=o,{version:h,useTreesShaking:u}=Wr(i)(e,c,t,a),d=()=>{const y=e[c][t][h];if(o.singleton){if(typeof f=="string"&&!Y(h,f)){const g=`Version ${h} from ${h&&y.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${f})`;o.strictVersion?S(g):Le(g)}return{shared:y,useTreesShaking:u}}else{if(f===!1||f==="*")return{shared:y,useTreesShaking:u};if(Y(h,f))return{shared:y,useTreesShaking:u};const g=te(a);if(g){for(const[p,E]of Object.entries(e[c][t]))if(te(E.treeShaking,a==null?void 0:a.usedExports)&&Y(p,f))return{shared:E,useTreesShaking:g}}for(const[p,E]of Object.entries(e[c][t]))if(Y(p,f))return{shared:E,useTreesShaking:!1}}},m={shareScopeMap:e,scope:c,pkgName:t,version:h,GlobalFederation:ee.__FEDERATION__,shareInfo:r,resolver:d};return(n.emit(m)||m).resolver()}}function Et(){return ee.__FEDERATION__.__SHARE__}function Ke(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,o=l=>{if(!l)return;const c={};return l.forEach(h=>{c[h.version]=h}),c[re(c,function(h,u){return!pe(c[h])&&x(h,u)})]},s=(r==null?void 0:r.resolver)??o,i=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),a=(...l)=>{const c={};for(const f of l)if(f)for(const[h,u]of Object.entries(f)){const d=c[h];i(d)&&i(u)?c[h]=a(d,u):u!==void 0&&(c[h]=u)}return c};return a(s(n[t]),r==null?void 0:r.customShareInfo)}const V=(e,t)=>{e.useIn||(e.useIn=[]),nr(e.useIn,t)};function ae(e,t){return t&&e.treeShaking?e.treeShaking:e}function jr(e,t){for(const r of e){const n=t.startsWith(r.name);let o=t.replace(r.name,"");if(n){if(o.startsWith("/")){const a=r.name;return o=`.${o}`,{pkgNameOrAlias:a,expose:o,remote:r}}else if(o==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const s=r.alias&&t.startsWith(r.alias);let i=r.alias&&t.replace(r.alias,"");if(r.alias&&s){if(i&&i.startsWith("/")){const a=r.alias;return i=`.${i}`,{pkgNameOrAlias:a,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function qr(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const _t="RUNTIME-001",bt="RUNTIME-002",Rt="RUNTIME-003",St="RUNTIME-004",$t="RUNTIME-005",Ae="RUNTIME-006",wt="RUNTIME-007",Ge="RUNTIME-008",Kr="RUNTIME-009",Nt="RUNTIME-010",It="RUNTIME-011",zr="RUNTIME-012",L={[_t]:"Failed to get remoteEntry exports.",[bt]:'The remote entry interface does not contain "init"',[Rt]:"Failed to get manifest.",[St]:"Failed to locate remote.",[$t]:"Invalid loadShareSync function call from bundler runtime",[Ae]:"Invalid loadShareSync function call from runtime",[wt]:"Failed to get remote snapshot.",[Ge]:"Failed to load script resources.",[Kr]:"Please call createInstance first.",[Nt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[It]:"The remoteEntry URL is missing from the remote snapshot.",[zr]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'};({...L});const Tt=".then(callbacks[0]).catch(callbacks[1])";async function Jr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Tt}`)([r,n]):import(e).then(r).catch(n)}catch(o){S(`Failed to load ESM entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}async function Xr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(n):new Function("callbacks",`System.import("${e}")${Tt}`)([r,n])}catch(o){S(`Failed to load SystemJS entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}function vt(e,t,r){const{remoteEntryKey:n,entryExports:o}=De(e,t);return o||S(_t,L,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),o}async function Yr({name:e,globalName:t,entry:r,loaderHook:n,getEntryUrl:o}){const{entryExports:s}=De(e,t);if(s)return s;const i=o?o(r):r;return Yt(i,{attrs:{},createScriptHook:(a,l)=>{const c=n.lifecycle.createScript.emit({url:a,attrs:l});if(c&&(c instanceof HTMLScriptElement||"script"in c||"timeout"in c))return c}}).then(()=>vt(e,t,r),a=>{const l=a instanceof Error?a.message:String(a);S(Ge,L,{remoteName:e,resourceUrl:i},l)})}async function Zr({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:o,entryGlobalName:s,name:i,type:a}=e;switch(a){case"esm":case"module":return Jr({entry:o,remoteEntryExports:t});case"system":return Xr({entry:o,remoteEntryExports:t});default:return Yr({entry:o,globalName:s,name:i,loaderHook:r,getEntryUrl:n})}}async function Qr({remoteInfo:e,loaderHook:t}){const{entry:r,entryGlobalName:n,name:o,type:s}=e,{entryExports:i}=De(o,n);return i||er(r,{attrs:{name:o,globalName:n,type:s},loaderHook:{createScriptHook:(a,l={})=>{const c=t.lifecycle.createScript.emit({url:a,attrs:l});if(c&&"url"in c)return c}}}).then(()=>vt(o,n,r)).catch(a=>{S(`Failed to load Node.js entry for remote "${o}" from "${r}". ${a instanceof Error?a.message:String(a)}`)})}function Pe(e){const{entry:t,name:r}=e;return Ye(r,t)}async function ye(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:o,_inErrorHandling:s=!1}=e,i=Pe(n);if(r)return r;if(!W[i]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;W[i]=a.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:r}).then(c=>c||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":H)?Zr({remoteInfo:n,remoteEntryExports:r,loaderHook:l,getEntryUrl:o}):Qr({remoteInfo:n,loaderHook:l}))).catch(async c=>{const f=Pe(n),h=c instanceof Error&&c.message.includes("ScriptExecutionError");if(c instanceof Error&&c.message.includes(Ge)&&!h&&!s){const u=m=>ye({...m,_inErrorHandling:!0}),d=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:u,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:W,uniqueKey:f});if(d)return d}throw c})}return W[i]}function ke(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||yt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ne}}function en(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function tn(e,t){const r=ur(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(o=>{e!=null&&e.find(s=>s.name!==o.name)&&e.push(o)}),e&&e.length>0&&e.forEach(o=>{n.forEach(s=>{s.applyPlugin(o,t)})}),e}function rn(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function J(e){var r,n,o,s,i,a;const t={};for(const[l,c]of Object.entries(e.shared)){const f=c[0];f&&(t[l]={version:f.version,singleton:(r=f.shareConfig)==null?void 0:r.singleton,requiredVersion:((n=f.shareConfig)==null?void 0:n.requiredVersion)===!1?!1:(o=f.shareConfig)==null?void 0:o.requiredVersion,eager:f.eager,strictVersion:(s=f.shareConfig)==null?void 0:s.strictVersion})}return{project:{name:e.name,mfRole:((i=e.remotes)==null?void 0:i.length)>0?"host":"unknown"},mfConfig:{name:e.name,remotes:((a=e.remotes)==null?void 0:a.map(rn))??[],shared:t}}}function At(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...e}}function nn(e,t){return t.map(r=>{const n=qr(e,r.nameOrAlias);return k(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Qe({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:At(r)}})}function on(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Pt(e,t,r,n=!0){const{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(a=>{const{moduleInfo:l}=a,c=t.moduleCache.get(e.name);ye(c?{origin:t,remoteInfo:l,remoteEntryExports:c.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const a={rel:"preload",as:"style"};o.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d}});f&&document.head.appendChild(c)})}else{const a={rel:"stylesheet",type:"text/css"};o.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d},needDeleteLink:!1});f&&document.head.appendChild(c)})}if(n){const a={rel:"preload",as:"script"};s.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d}});f&&document.head.appendChild(c)})}else{const a={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};s.forEach(l=>{const{script:c,needAttach:f}=ot({url:l,cb:()=>{},attrs:a,createScriptHook:(h,u)=>{const d=t.loaderHook.lifecycle.createScript.emit({url:h,attrs:u});if(d instanceof HTMLScriptElement)return d},needDeleteScript:!0});f&&document.head.appendChild(c)})}}}function sn(e,t,r){const n=t,o=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];o.length||o.push("default"),o.forEach(i=>{n[i]||(n[i]={})});const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?o:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:n,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:n[o[0]],initScope:r??[]}}var kt=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const e=await ye({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return k(e,`remoteEntryExports is undefined
|
|
8
|
-
${Qe(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async init(e,t,r){const n=await this.getEntry();if(this.inited)return n;if(this.initPromise)return await this.initPromise,n;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:o,shareScope:s,initScope:i}=sn(this.remoteInfo,this.host.shareScopeMap,r),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:s,remoteEntryInitOptions:o,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&S(bt,L,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,J(this.host.options)),await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,n){const{loadFactory:o=!0}=r||{loadFactory:!0},s=await this.init(e,n);this.lib=s;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo}),i||(i=await s.get(t)),k(i,`${Q(this.remoteInfo)} remote don't export ${t}.`);const a=ir(this.remoteInfo.name,t),l=this.wraperFactory(i,a);return o?await l():l}wraperFactory(e,t){function r(n,o){n&&typeof n=="object"&&Object.isExtensible(n)&&!Object.getOwnPropertyDescriptor(n,Symbol.for("mf_module_id"))&&Object.defineProperty(n,Symbol.for("mf_module_id"),{value:o,enumerable:!1})}return e instanceof Promise?async()=>{const n=await e();return r(n,t),n}:()=>{const n=e();return r(n,t),n}}},A=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const t=this;this.on(function r(...n){return t.remove(r),e.apply(null,n)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},P=class extends A{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let n=0;const o=s=>s===!1?!1:n<r.length?Promise.resolve(r[n++].apply(null,e)).then(o):s;t=o()}return Promise.resolve(t)}};function Ot(e,t){if(!Ce(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var j=class extends A{constructor(e){super(),this.onerror=S,this.type=e}emit(e){Ce(e)||S(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(Ot(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Le(r),this.onerror(r)}return e}},F=class extends A{constructor(e){super(),this.onerror=S,this.type=e}emit(e){Ce(e)||S(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let r=0;const n=s=>(Le(s),this.onerror(s),e),o=s=>{if(Ot(e,s)){if(e=s,r<t.length)try{return Promise.resolve(t[r++](e)).then(o,n)}catch(i){return n(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(o(e))}return Promise.resolve(e)}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var n;k(sr(e),"Plugin configuration is invalid.");const r=e.name;k(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,(n=e.apply)==null||n.call(e,t),Object.keys(this.lifecycle).forEach(o=>{const s=e[o];s&&this.lifecycle[o].on(s)}))}removePlugin(e){k(e,"A name is required.");const t=this.registerPlugins[e];k(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Lt(e,t){const r=lt(t);r.url||S(It,L,{remoteName:e.name});let n=Ne(t,r.url);!H&&!n.startsWith("http")&&(n=`https:${n}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function an(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:o,remoteInfo:s,id:i}=e;if(!Me(t)||!at(t)){const{remoteSnapshot:a,globalSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Lt(s,a);const c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},f=await o.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:c,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:l});return f&&Pt(s,o,f,!1),{...e,remoteSnapshot:a}}return e}}}function cn(e){const t=e.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function Mt(e,t,r,n,o={},s){const{value:i}=K(e,Q(t)),a=s||i;if(a&&!et(a)&&(r(a,t,n),a.remotesInfo)){const l=Object.keys(a.remotesInfo);for(const c of l){if(o[c])continue;o[c]=!0;const f=cn(c),h=a.remotesInfo[c];Mt(e,{name:f.name,version:h.matchedVersion},r,!1,o,void 0)}}}const Se=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function ln(e,t,r,n,o){const s=[],i=[],a=[],l=new Set,c=new Set,{options:f}=e,{preloadConfig:h}=t,{depsRemote:u}=h;if(Mt(n,r,(m,y,g)=>{var $;let p;if(g)p=h;else if(Array.isArray(u)){const R=u.find(w=>w.nameOrAlias===y.name||w.nameOrAlias===y.alias);if(!R)return;p=At(R)}else if(u===!0)p=h;else return;const E=Ne(m,lt(m).url);E&&a.push({name:y.name,moduleInfo:{name:y.name,entry:E,type:"remoteEntryType"in m?m.remoteEntryType:"global",entryGlobalName:"globalName"in m?m.globalName:y.name,shareScope:"",version:"version"in m?m.version:void 0},url:E});let b="modules"in m?m.modules:[];const N=on(p.exposes);N.length&&"modules"in m&&(b=($=m==null?void 0:m.modules)==null?void 0:$.reduce((R,w)=>((N==null?void 0:N.indexOf(w.moduleName))!==-1&&R.push(w),R),[]));function _(R){const w=R.map(M=>Ne(m,M));return p.filter?w.filter(p.filter):w}if(b){const R=b.length;for(let w=0;w<R;w++){const M=b[w],ge=`${y.name}/${M.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?y.name:ge,name:y.name,remoteSnapshot:m,preloadConfig:p,remote:y,origin:e}),!fr(ge)&&(p.resourceCategory==="all"?(s.push(..._(M.assets.css.async)),s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.async)),i.push(..._(M.assets.js.sync))):p.resourceCategory==="sync"&&(s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.sync))),hr(ge))}}},!0,{},o),o.shared&&o.shared.length>0){const m=(y,g)=>{const{shared:p}=me(e.shareScopeMap,g.sharedName,y,e.sharedHandler.hooks.lifecycle.resolveShare)||{};p&&typeof p.lib=="function"&&(g.assets.js.sync.forEach(E=>{l.add(E)}),g.assets.css.sync.forEach(E=>{c.add(E)}))};o.shared.forEach(y=>{var E;const g=(E=f.shared)==null?void 0:E[y.sharedName];if(!g)return;const p=y.version?g.find(b=>b.version===y.version):g;p&&ct(p).forEach(b=>{m(b,y)})})}const d=i.filter(m=>!l.has(m)&&!Se("script",m));return{cssAssets:s.filter(m=>!c.has(m)&&!Se("link",m)),jsAssetsWithoutEntry:d,entryAssets:a.filter(m=>!Se("script",m.url))}}const un=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:n,remote:o,globalSnapshot:s,remoteSnapshot:i}=e;return H?Me(o)&&at(o)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:o.name,url:o.entry,moduleInfo:{name:n.name,entry:o.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Lt(n,i),ln(t,r,n,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Ct(e,t){const r=fe({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&K(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:"version"in e?e.version:void 0})}}var fn=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new P("beforeLoadRemoteSnapshot"),loadSnapshot:new F("loadGlobalSnapshot"),loadRemoteSnapshot:new F("loadRemoteSnapshot"),afterLoadSnapshot:new F("afterLoadSnapshot")}),this.manifestLoading=ee.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){const{options:n}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:n,moduleInfo:e});let o=fe({name:this.HostInstance.options.name,version:this.HostInstance.options.version});o||(o={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},lr({[this.HostInstance.options.name]:o})),o&&"remotesInfo"in o&&!K(o.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(o.remotesInfo={...o==null?void 0:o.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a}=this.getGlobalRemoteInfo(e),{remoteSnapshot:l,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a});let f,h;if(l)if(et(l)){const u=H?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||"",d=await this.getManifestJson(u,e,{}),m=Ue({...e,entry:u},d);f=d,h=m}else{const{remoteSnapshot:u}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:"global"});f=u,h=c}else if(Me(e)){const u=await this.getManifestJson(e.entry,e,{}),d=Ue(e,u),{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:u,from:"global"});f=m,h=d}else S(wt,L,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(c)},void 0,J(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:f}),{remoteSnapshot:f,globalSnapshot:h}}getGlobalRemoteInfo(e){return Ct(e,this.HostInstance)}async getManifestJson(e,t,r){const n=async()=>{let s=this.manifestCache.get(e);if(s)return s;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{});(!i||!(i instanceof Response))&&(i=await fetch(e,{})),s=await i.json()}catch(i){s=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),s||(delete this.manifestLoading[e],S(Rt,L,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,J(this.HostInstance.options)))}return k(s.metaData&&s.exposes&&s.shared,`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${[!s.metaData&&"metaData",!s.exposes&&"exposes",!s.shared&&"shared"].filter(Boolean).join(", ")}.`),this.manifestCache.set(e,s),s},o=async()=>{const s=await n(),i=qt(s,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=o().then(s=>s)),this.manifestLoading[e]}},hn=class{constructor(e){this.hooks=new q({beforeRegisterShare:new j("beforeRegisterShare"),afterResolve:new F("afterResolve"),beforeLoadShare:new F("beforeLoadShare"),loadShare:new P,resolveShare:new j("resolveShare"),initContainerShareScopeMap:new j("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=gt(e,t);return Object.keys(r).forEach(o=>{r[o].forEach(s=>{s.scope.forEach(i=>{var a;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:o,shared:s}),(a=this.shareScopeMap[i])!=null&&a[o]||this.setShared({pkgName:o,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name})})})}),{newShareInfos:r,allShareInfos:n}}async loadShare(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&await Promise.all(n.scope.map(async a=>{await Promise.all(this.initializeSharing(a,{strategy:n.strategy}))}));const{shareInfo:o}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});k(o,`Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);const{shared:s,useTreesShaking:i}=me(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(s){const a=ae(s,i);if(a.lib)return V(a,r.options.name),a.lib;if(a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),V(a,r.options.name),l}else{const c=(async()=>{const f=await a.get();return V(a,r.options.name),a.loaded=!0,a.lib=f,f})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:c,treeShaking:i?a:void 0}),c}}else{if(t!=null&&t.customShareInfo)return!1;const a=te(o.treeShaking),l=ae(o,a),f=(async()=>{const h=await l.get();l.lib=h,l.loaded=!0,V(l,r.options.name);const{shared:u,useTreesShaking:d}=me(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(u){const m=ae(u,d);m.lib=h,m.loaded=!0,u.from=o.from}return h})();return this.setShared({pkgName:e,loaded:!1,shared:o,from:r.options.name,lib:null,loading:f,treeShaking:a?l:void 0}),f}}initializeSharing(e=ne,t){const{host:r}=this,n=t==null?void 0:t.from,o=t==null?void 0:t.strategy;let s=t==null?void 0:t.initScope;const i=[];if(n!=="build"){const{initTokens:u}=this;s||(s=[]);let d=u[e];if(d||(d=u[e]={from:this.host.name}),s.indexOf(d)>=0)return i;s.push(d)}const a=this.shareScopeMap,l=r.options.name;a[e]||(a[e]={});const c=a[e],f=(u,d)=>{var b;const{version:m,eager:y}=d;c[u]=c[u]||{};const g=c[u],p=g[m]&&ae(g[m]),E=!!(p&&("eager"in p&&p.eager||"shareConfig"in p&&((b=p.shareConfig)!=null&&b.eager)));(!p||p.strategy!=="loaded-first"&&!p.loaded&&(!y!=!E?y:l>g[m].from))&&(g[m]=d)},h=async u=>{const{module:d}=await r.remoteHandler.getRemoteModuleAndOptions({id:u});let m;try{m=await d.getEntry()}catch(y){if(m=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:u,error:y,from:"runtime",lifecycle:"beforeLoadShare",origin:r}),!m)return}finally{m!=null&&m.init&&!d.initing&&(d.remoteEntryExports=m,await d.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(u=>{r.options.shared[u].forEach(d=>{d.scope.includes(e)&&f(u,d)})}),(r.options.shareStrategy==="version-first"||o==="version-first")&&r.options.remotes.forEach(u=>{u.shareScope===e&&i.push(h(u.name))}),i}loadShareSync(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy})});const{shared:o,useTreesShaking:s}=me(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(o){if(typeof o.lib=="function")return V(o,r.options.name),o.loaded||(o.loaded=!0,o.from===r.options.name&&(n.loaded=!0)),o.lib;if(typeof o.get=="function"){const i=o.get();if(!(i instanceof Promise))return V(o,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:o}),i}}if(n.lib)return n.loaded||(n.loaded=!0),n.lib;if(n.get){const i=n.get();return i instanceof Promise&&S((t==null?void 0:t.from)==="build"?$t:Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}S(Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options))}initShareScopeMap(e,t,r={}){const{host:n}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:n.options,origin:n,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:n,loading:o,loaded:s,get:i,treeShaking:a}){const{version:l,scope:c="default",...f}=t,h=Array.isArray(c)?c:[c],u=d=>{const m=(g,p,E)=>{E&&!g[p]&&(g[p]=E)},y=a?d.treeShaking:d;m(y,"loaded",s),m(y,"loading",o),m(y,"get",i)};h.forEach(d=>{this.shareScopeMap[d]||(this.shareScopeMap[d]={}),this.shareScopeMap[d][e]||(this.shareScopeMap[d][e]={}),this.shareScopeMap[d][e][l]||(this.shareScopeMap[d][e][l]={version:l,scope:[d],...f,lib:n});const m=this.shareScopeMap[d][e][l];u(m),r&&m.from!==r&&(m.from=r)})}_setGlobalShareScopeMap(e){const t=Et(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},dn=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new j("beforeRegisterRemote"),registerRemote:new j("registerRemote"),beforeRequest:new F("beforeRequest"),onLoad:new P("onLoad"),handlePreloadModule:new A("handlePreloadModule"),errorLoadRemote:new P("errorLoadRemote"),beforePreloadRemote:new P("beforePreloadRemote"),generatePreloadAssets:new P("generatePreloadAssets"),afterPreloadRemote:new P,loadEntry:new P}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,n)=>(this.registerRemote(n,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:n}=t,{name:o,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:n},s&&e.startsWith(o)){const i=e.replace(o,s);this.idToRemoteMap[i]={name:r.name,expose:n};return}if(s&&e.startsWith(s)){const i=e.replace(s,o);this.idToRemoteMap[i]={name:r.name,expose:n}}}async loadRemote(e,t){const{host:r}=this;try{const{loadFactory:n=!0}=t||{loadFactory:!0},{module:o,moduleOptions:s,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:a,remote:l,expose:c,id:f,remoteSnapshot:h}=i,u=await o.get(f,c,t,h),d=await this.hooks.lifecycle.onLoad.emit({id:f,pkgNameOrAlias:a,expose:c,exposeModule:n?u:void 0,exposeModuleFactory:n?void 0:u,remote:l,options:s,moduleInstance:o,origin:r});return this.setIdToRemoteMap(e,i),typeof d=="function"?d:u}catch(n){const{from:o="runtime"}=t||{from:"runtime"},s=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:o,lifecycle:"onLoad",origin:r});if(!s)throw n;return s}}async preloadRemote(e){const{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=nn(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:o}=n,s=ke(o),{globalSnapshot:i,remoteSnapshot:a}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:o}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:o,remoteInfo:s,globalSnapshot:i,remoteSnapshot:a});l&&Pt(s,t,l)}))}registerRemotes(e,t){const{host:r}=this;e.forEach(n=>{this.registerRemote(n,r.options.remotes,{force:t==null?void 0:t.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let n;try{n=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(d){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:d,lifecycle:"beforeRequest"}),!n)throw d}const{id:o}=n,s=jr(t.options.remotes,o);s||S(St,L,{hostName:t.options.name,requestId:o},void 0,J(t.options));const{remote:i}=s,a=ke(i),l=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:o,...s,options:t.options,origin:t,remoteInfo:a}),{remote:c,expose:f}=l;k(c&&f,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${o}.`);let h=t.moduleCache.get(c.name);const u={host:t,remoteInfo:a};return h||(h=new kt(u),t.moduleCache.set(c.name,h)),{module:h,moduleOptions:u,remoteMatchInfo:l}}registerRemote(e,t,r){const{host:n}=this,o=()=>{if(e.alias){const i=t.find(a=>{var l;return e.alias&&(a.name.startsWith(e.alias)||((l=a.alias)==null?void 0:l.startsWith(e.alias)))});k(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in e&&H&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ne),e.type||(e.type=yt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:n});const s=t.find(i=>i.name===e.name);if(!s)o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n});else{const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(s),o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n}),Ze(i.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:n}=e,o=r.options.remotes.findIndex(i=>i.name===n);o!==-1&&r.options.remotes.splice(o,1);const s=r.moduleCache.get(e.name);if(s){const i=s.remoteInfo,a=i.entryGlobalName;I[a]&&((t=Object.getOwnPropertyDescriptor(I,a))!=null&&t.configurable?delete I[a]:I[a]=void 0);const l=Pe(s.remoteInfo);W[l]&&delete W[l],r.snapshotHandler.manifestCache.delete(i.entry);let c=i.buildVersion?Ye(i.name,i.buildVersion):i.name;const f=I.__FEDERATION__.__INSTANCES__.findIndex(u=>i.buildVersion?u.options.id===c:u.name===c);if(f!==-1){const u=I.__FEDERATION__.__INSTANCES__[f];c=u.options.id||c;const d=Et();let m=!0;const y=[];Object.keys(d).forEach(g=>{const p=d[g];p&&Object.keys(p).forEach(E=>{const b=p[E];b&&Object.keys(b).forEach(N=>{const _=b[N];_&&Object.keys(_).forEach($=>{const R=_[$];R&&typeof R=="object"&&R.from===i.name&&(R.loaded||R.loading?(R.useIn=R.useIn.filter(w=>w!==i.name),R.useIn.length?m=!1:y.push([g,E,N,$])):y.push([g,E,N,$]))})})})}),m&&(u.shareScopeMap={},delete d[c]),y.forEach(([g,p,E,b])=>{var N,_,$;($=(_=(N=d[g])==null?void 0:N[p])==null?void 0:_[E])==null||delete $[b]}),I.__FEDERATION__.__INSTANCES__.splice(f,1)}const{hostGlobalSnapshot:h}=Ct(e,r);if(h){const u=h&&"remotesInfo"in h&&h.remotesInfo&&K(h.remotesInfo,e.name).key;u&&(delete h.remotesInfo[u],ee.__FEDERATION__.__MANIFEST_LOADING__[u]&&delete ee.__FEDERATION__.__MANIFEST_LOADING__[u])}r.moduleCache.delete(e.name)}}catch(r){ve.error(`removeRemote failed: ${r instanceof Error?r.message:String(r)}`)}}};const mn=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var pn=class{constructor(e){this.hooks=new q({beforeInit:new j("beforeInit"),init:new A,beforeInitContainer:new F("beforeInitContainer"),initContainer:new F("initContainer")}),this.version="2.3.0",this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new A,createScript:new A,createLink:new A,fetch:new P,loadEntryError:new P,getModuleFactory:new P}),this.bridgeHook=new q({beforeBridgeRender:new A,afterBridgeRender:new A,beforeBridgeDestroy:new A,afterBridgeDestroy:new A});const t=mn?[an(),un()]:[],r={id:en(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:H};this.name=e.name,this.options=r,this.snapshotHandler=new fn(this),this.sharedHandler=new hn(this),this.remoteHandler=new dn(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&S(it(Nt,L)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=ne,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=ke({name:e,entry:t}),o=new kt({host:this,remoteInfo:n});return o.remoteEntryExports=r,this.moduleCache.set(e,o),o}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){const{allShareInfos:r}=gt(e,t),{userOptions:n,options:o}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(o,n),{allShareInfos:i}=this.sharedHandler.registerShared(o,n),a=[...o.plugins];n.plugins&&n.plugins.forEach(c=>{a.includes(c)||a.push(c)});const l={...e,...t,plugins:a,remotes:s,shared:i};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){const t=tn(e,this);this.options.plugins=this.options.plugins.reduce((r,n)=>(n&&r&&!r.find(o=>o.name===n.name)&&r.push(n),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};let yn=null;function Dt(){return yn}ar(pn);function Ft(e,t){const r=n=>{const o=n.length>1&&n.endsWith("/"),s=`${t}/${n}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/";return o?`${s}/`:s};return e.map(n=>{const o={...n,path:r(n.path)};return typeof n.redirect=="string"?o.redirect=r(n.redirect):n.redirect&&typeof n.redirect=="object"&&"path"in n.redirect&&typeof n.redirect.path=="string"&&(o.redirect={...n.redirect,path:r(n.redirect.path)}),n.children&&n.children.length>0&&(o.children=Ft(n.children,t)),o})}function gn(e){const{router:t,basename:r,memoryRoute:n,hashRoute:o}=e,s=t.getRoutes().sort((u,d)=>u.path.split("/").filter(m=>m).length-d.path.split("/").filter(m=>m).length),i=new Map,a=new Set;s.forEach(u=>{i.set(u.path,u)});const l=(u,d)=>`${u}/${d}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",c=(u,d="")=>{if(!u.children||u.children.length===0)return u;for(let m=0;m<u.children.length;m++){const y=u.children[m],g=l(d,y.path),p=i.get(g);if(p&&!a.has(p)){const E={...p,path:y.path};u.children[m]=E,a.add(p),c(E,g)}}return u};let f=[];for(const u of s)if(!a.has(u)){const d=c(u,u.path);a.add(u),f.push(d)}let h;return n?h=ce.createMemoryHistory(r):o?(h=ce.createWebHashHistory(),r&&(f=Ft(f,r))):h=ce.createWebHistory(r),{history:h,routes:f}}function En(e){const t=new Map,r=Dt();return()=>({__APP_VERSION__:"2.3.0",async render(n){var m,y,g;D.debug("createBridgeComponent render Info",n);const{moduleName:o,dom:s,basename:i,memoryRoute:a,hashRoute:l,...c}=n,f=Gt.createApp(e.rootComponent,c);t.set(s,f);const h=await((g=(y=(m=r==null?void 0:r.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:y.beforeBridgeRender)==null?void 0:g.emit(n)),u=h&&typeof h=="object"&&(h!=null&&h.extraProps)?h==null?void 0:h.extraProps:{},d=e.appOptions({app:f,basename:i,memoryRoute:a,hashRoute:l,...c,...u});if(d!=null&&d.router){const{history:p,routes:E}=gn({router:d.router,basename:n.basename,memoryRoute:n.memoryRoute,hashRoute:n.hashRoute}),b=ce.createRouter({...d.router.options,history:p,routes:E});D.debug("createBridgeComponent render router info>>>",{moduleName:o,router:b}),a&&await b.push(a.entryPath),f.use(b)}f.mount(s)},destroy(n){D.debug("createBridgeComponent destroy Info",n);const o=t.get(n==null?void 0:n.dom);o==null||o.unmount()}})}function _n(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const bn=v.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(e){const t=v.ref(null),r=v.ref(null),n=v.ref(""),o=Oe.useRoute(),s=Dt(),i=v.useAttrs(),a=async()=>{var u,d,m,y;const c=(u=e.providerInfo)==null?void 0:u.call(e);r.value=c;let f={...i,moduleName:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute};D.debug("createRemoteAppComponent LazyComponent render >>>",f);const h=await((y=(m=(d=s==null?void 0:s.bridgeHook)==null?void 0:d.lifecycle)==null?void 0:m.beforeBridgeRender)==null?void 0:y.emit(f))||{};f={...f,...h.extraProps},c.render(f)},l=v.watch(()=>o==null?void 0:o.path,c=>{c!==o.path&&a(),n.value!==""&&n.value!==c&&(D.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:o.path}),_n()),n.value=c});return v.onMounted(()=>{a()}),v.onBeforeUnmount(()=>{var c;D.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e}),l(),(c=r.value)==null||c.destroy({dom:t.value})}),()=>v.createVNode("div",v.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function Ht(e){return v.defineAsyncComponent({__APP_VERSION__:"2.3.0",...e.asyncComponentOptions,loader:async()=>{var l,c;const t=Oe.useRoute();let r="/";const n=(c=(l=t==null?void 0:t.matched)==null?void 0:l[0])==null?void 0:c.path;n&&(n.endsWith("/:pathMatch(.*)*")?r=n.replace("/:pathMatch(.*)*",""):r=t.matched[0].path);const o=(e==null?void 0:e.export)||"default";D.debug("createRemoteAppComponent LazyComponent create >>>",{basename:r,info:e});const s=await e.loader(),i=s&&s[Symbol.for("mf_module_id")],a=s[o];if(D.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:i,module:s,exportName:o,basename:r,route:t}),o in s&&typeof a=="function")return{render(){return v.h(bn,{moduleName:i,providerInfo:a,basename:r,rootAttrs:e.rootAttrs,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute})}};throw new Error("module not found")}})}function Rn(e){return D.warn("createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"),Ht(e)}exports.createBridgeComponent=En;exports.createRemoteAppComponent=Ht;exports.createRemoteComponent=Rn;
|
|
7
|
+
`)};function rr(e,t,r,n,o,s){return n(it(e,t,r,o))}const G="[ Federation Runtime ]",ve=rt(G);function k(e,t,r,n,o){e||S(t)}function S(e,t,r,n,o){if(t!==void 0)return rr(e,t,r??{},i=>{throw new Error(`${G}: ${i}`)},n);const s=e;throw s instanceof Error?(s.message.startsWith(G)||(s.message=`${G}: ${s.message}`),s):new Error(`${G}: ${s}`)}function Le(e){e instanceof Error&&(e.message.startsWith(G)||(e.message=`${G}: ${e.message}`)),ve.warn(e)}function nr(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function Q(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Me(e){return typeof e.entry<"u"}function at(e){return!e.entry.includes(".json")}function Ce(e){return e&&typeof e=="object"}const or=Object.prototype.toString;function sr(e){return or.call(e)==="[object Object]"}function ct(e){return Array.isArray(e)?e:[e]}function lt(e){const t={url:"",type:"global",globalName:""};return H||Xe()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}const ir=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},I=typeof globalThis=="object"?globalThis:window,O=(()=>{try{return document.defaultView}catch{return I}})(),ee=O;function le(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function ue(e,t){return Object.hasOwnProperty.call(e,t)}ue(I,"__GLOBAL_LOADING_REMOTE_ENTRY__")||le(I,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const W=I.__GLOBAL_LOADING_REMOTE_ENTRY__;function ut(e){var t,r,n,o,s,i;ue(e,"__VMOK__")&&!ue(e,"__FEDERATION__")&&le(e,"__FEDERATION__",e.__VMOK__),ue(e,"__FEDERATION__")||(le(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),le(e,"__VMOK__",e.__FEDERATION__)),(t=e.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(r=e.__FEDERATION__).__INSTANCES__??(r.__INSTANCES__=[]),(n=e.__FEDERATION__).moduleInfo??(n.moduleInfo={}),(o=e.__FEDERATION__).__SHARE__??(o.__SHARE__={}),(s=e.__FEDERATION__).__MANIFEST_LOADING__??(s.__MANIFEST_LOADING__={}),(i=e.__FEDERATION__).__PRELOADED_MAP__??(i.__PRELOADED_MAP__=new Map)}ut(I);ut(O);function ar(e,t=we()){t&&(I.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.3.1")}function K(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const n of r){const[o,s]=n.split(":"),i=`${o}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}else S(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const xe=()=>O.__FEDERATION__.moduleInfo,cr=(e,t)=>{const r=K(t,Q(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){const{version:n,...o}=e,s=Q(o),i=K(O.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===n)return i}},fe=e=>cr(e,O.__FEDERATION__.moduleInfo),Ue=(e,t)=>{const r=Q(e);return O.__FEDERATION__.moduleInfo[r]=t,O.__FEDERATION__.moduleInfo},lr=e=>(O.__FEDERATION__.moduleInfo={...O.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete O.__FEDERATION__.moduleInfo[r]}),De=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:I[r]}},ur=()=>O.__FEDERATION__.__GLOBAL_PLUGIN__,fr=e=>I.__FEDERATION__.__PRELOADED_MAP__.get(e),hr=e=>I.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Ve="[0-9A-Za-z-]+",Fe=`(?:\\+(${Ve}(?:\\.${Ve})*))`,Z="0|[1-9]\\d*",he="[0-9]+",ft="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Be=`(?:${he}|${ft})`,dr=`(?:-?(${Be}(?:\\.${Be})*))`,We=`(?:${Z}|${ft})`,ht=`(?:-(${We}(?:\\.${We})*))`,be=`${Z}|x|X|\\*`,z=`[v=\\s]*(${be})(?:\\.(${be})(?:\\.(${be})(?:${ht})?${Fe}?)?)?`,mr=`^\\s*(${z})\\s+-\\s+(${z})\\s*$`,pr=`[v=\\s]*${`(${he})\\.(${he})\\.(${he})`}${dr}?${Fe}?`,He="((?:<|>)?=?)",yr=`(\\s*)${He}\\s*(${pr}|${z})`,dt="(?:~>?)",gr=`(\\s*)${dt}\\s+`,mt="(?:\\^)",Er=`(\\s*)${mt}\\s+`,_r="(<|>)?=?\\s*\\*",br=`^${mt}${z}$`,Rr=`v?${`(${Z})\\.(${Z})\\.(${Z})`}${ht}?${Fe}?`,Sr=`^${dt}${z}$`,$r=`^${He}\\s*${z}$`,wr=`^${He}\\s*(${Rr})$|^$`,Nr="^\\s*>=\\s*0.0.0\\s*$";function C(e){return new RegExp(e)}function T(e){return!e||e.toLowerCase()==="x"||e==="*"}function pt(...e){return t=>e.reduce((r,n)=>n(r),t)}function je(e){return e.match(C(wr))}function qe(e,t,r,n){const o=`${e}.${t}.${r}`;return n?`${o}-${n}`:o}function Ir(e){return e.replace(C(mr),(t,r,n,o,s,i,a,l,c,f,h,u)=>(T(n)?r="":T(o)?r=`>=${n}.0.0`:T(s)?r=`>=${n}.${o}.0`:r=`>=${r}`,T(c)?l="":T(f)?l=`<${Number(c)+1}.0.0-0`:T(h)?l=`<${c}.${Number(f)+1}.0-0`:u?l=`<=${c}.${f}.${h}-${u}`:l=`<=${l}`,`${r} ${l}`.trim()))}function Tr(e){return e.replace(C(yr),"$1$2$3")}function vr(e){return e.replace(C(gr),"$1~")}function Ar(e){return e.replace(C(Er),"$1^")}function Pr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(br),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(s)?n==="0"?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.0 <${Number(n)+1}.0.0-0`:i?n==="0"?o==="0"?`>=${n}.${o}.${s}-${i} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s}-${i} <${Number(n)+1}.0.0-0`:n==="0"?o==="0"?`>=${n}.${o}.${s} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${Number(n)+1}.0.0-0`)).join(" ")}function kr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(Sr),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(s)?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:i?`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`)).join(" ")}function Or(e){return e.split(/\s+/).map(t=>t.trim().replace(C($r),(r,n,o,s,i,a)=>{const l=T(o),c=l||T(s),f=c||T(i);return n==="="&&f&&(n=""),a="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&f?(c&&(s=0),i=0,n===">"?(n=">=",c?(o=Number(o)+1,s=0,i=0):(s=Number(s)+1,i=0)):n==="<="&&(n="<",c?o=Number(o)+1:s=Number(s)+1),n==="<"&&(a="-0"),`${n+o}.${s}.${i}${a}`):c?`>=${o}.0.0${a} <${Number(o)+1}.0.0-0`:f?`>=${o}.${s}.0${a} <${o}.${Number(s)+1}.0-0`:r})).join(" ")}function Lr(e){return e.trim().replace(C(_r),"")}function Mr(e){return e.trim().replace(C(Nr),"")}function de(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Cr(e,t){const{preRelease:r}=e,{preRelease:n}=t;if(r===void 0&&n)return 1;if(r&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let o=0,s=r.length;o<=s;o++){const i=r[o],a=n[o];if(i!==a)return i===void 0&&a===void 0?0:i?a?de(i,a):-1:1}return 0}function ie(e,t){return de(e.major,t.major)||de(e.minor,t.minor)||de(e.patch,t.patch)||Cr(e,t)}function Re(e,t){return e.version===t.version}function Dr(e,t){switch(e.operator){case"":case"=":return Re(e,t);case">":return ie(e,t)<0;case">=":return Re(e,t)||ie(e,t)<0;case"<":return ie(e,t)>0;case"<=":return Re(e,t)||ie(e,t)>0;case void 0:return!0;default:return!1}}function Fr(e){return pt(Pr,kr,Or,Lr)(e)}function Hr(e){return pt(Ir,Tr,vr,Ar)(e.trim()).split(/\s+/).join(" ")}function Y(e,t){if(!e)return!1;const r=je(e);if(!r)return!1;const[,n,,o,s,i,a]=r,l={operator:n,version:qe(o,s,i,a),major:o,minor:s,patch:i,preRelease:a==null?void 0:a.split(".")},c=t.split("||");for(const f of c){const h=f.trim();if(!h||h==="*"||h==="x")return!0;try{const u=Hr(h);if(!u.trim())return!0;const d=u.split(" ").map(g=>Fr(g)).join(" ");if(!d.trim())return!0;const m=d.split(/\s+/).map(g=>Mr(g)).filter(Boolean);if(m.length===0)continue;let y=!0;for(const g of m){const p=je(g);if(!p){y=!1;break}const[,E,,b,N,_,$]=p;if(!Dr({operator:E,version:qe(b,N,_,$),major:b,minor:N,patch:_,preRelease:$==null?void 0:$.split(".")},l)){y=!1;break}}if(y)return!0}catch(u){console.error(`[semver] Error processing range part "${h}":`,u);continue}}return!1}const ne="default",yt="global";function Gr(e,t,r,n){var s,i;let o;return"get"in e?o=e.get:"lib"in e?o=()=>Promise.resolve(e.lib):o=()=>Promise.resolve(()=>{S(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),(s=e.shareConfig)!=null&&s.eager&&((i=e.treeShaking)!=null&&i.mode)&&S(`Invalid shared config for "${r}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:o,loaded:e!=null&&e.loaded||"lib"in e?!0:void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??n)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??$e.UNKNOWN,useIn:[]}:void 0}}function gt(e,t){const r=t.shared||{},n=t.name,o=Object.keys(r).reduce((i,a)=>{const l=ct(r[a]);return i[a]=i[a]||[],l.forEach(c=>{i[a].push(Gr(c,n,a,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(o).forEach(i=>{s[i]?o[i].forEach(a=>{s[i].find(l=>l.version===a.version)||s[i].push(a)}):s[i]=o[i]}),{allShareInfos:s,newShareInfos:o}}function te(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===$e.NO_USE?!1:r===$e.CALCULATED?!0:n==="runtime-infer"?t?Ur(e,t):!0:!1}function x(e,t){const r=n=>{if(!Number.isNaN(Number(n))){const o=n.split(".");let s=n;for(let i=0;i<3-o.length;i++)s+=".0";return s}return n};return!!Y(r(e),`<=${r(t)}`)}const re=(e,t)=>{const r=t||function(n,o){return x(n,o)};return Object.keys(e).reduce((n,o)=>!n||r(n,o)||n==="0"?o:n,0)},pe=e=>!!e.loaded||typeof e.lib=="function",xr=e=>!!e.loading,Ur=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function Vr(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){return i?o[l].treeShaking?o[c].treeShaking?!pe(o[l].treeShaking)&&x(l,c):!1:!0:!pe(o[l])&&x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}const U=e=>pe(e)||xr(e);function Br(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){if(i){if(!o[l].treeShaking)return!0;if(!o[c].treeShaking)return!1;if(U(o[c].treeShaking))return U(o[l].treeShaking)?!!x(l,c):!0;if(U(o[l].treeShaking))return!1}return U(o[c])?U(o[l])?!!x(l,c):!0:U(o[l])?!1:x(l,c)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}function Wr(e){return e==="loaded-first"?Br:Vr}function me(e,t,r,n){if(!e)return;const{shareConfig:o,scope:s=ne,strategy:i,treeShaking:a}=r,l=Array.isArray(s)?s:[s];for(const c of l)if(o&&e[c]&&e[c][t]){const{requiredVersion:f}=o,{version:h,useTreesShaking:u}=Wr(i)(e,c,t,a),d=()=>{const y=e[c][t][h];if(o.singleton){if(typeof f=="string"&&!Y(h,f)){const g=`Version ${h} from ${h&&y.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${f})`;o.strictVersion?S(g):Le(g)}return{shared:y,useTreesShaking:u}}else{if(f===!1||f==="*")return{shared:y,useTreesShaking:u};if(Y(h,f))return{shared:y,useTreesShaking:u};const g=te(a);if(g){for(const[p,E]of Object.entries(e[c][t]))if(te(E.treeShaking,a==null?void 0:a.usedExports)&&Y(p,f))return{shared:E,useTreesShaking:g}}for(const[p,E]of Object.entries(e[c][t]))if(Y(p,f))return{shared:E,useTreesShaking:!1}}},m={shareScopeMap:e,scope:c,pkgName:t,version:h,GlobalFederation:ee.__FEDERATION__,shareInfo:r,resolver:d};return(n.emit(m)||m).resolver()}}function Et(){return ee.__FEDERATION__.__SHARE__}function Ke(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,o=l=>{if(!l)return;const c={};return l.forEach(h=>{c[h.version]=h}),c[re(c,function(h,u){return!pe(c[h])&&x(h,u)})]},s=(r==null?void 0:r.resolver)??o,i=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),a=(...l)=>{const c={};for(const f of l)if(f)for(const[h,u]of Object.entries(f)){const d=c[h];i(d)&&i(u)?c[h]=a(d,u):u!==void 0&&(c[h]=u)}return c};return a(s(n[t]),r==null?void 0:r.customShareInfo)}const V=(e,t)=>{e.useIn||(e.useIn=[]),nr(e.useIn,t)};function ae(e,t){return t&&e.treeShaking?e.treeShaking:e}function jr(e,t){for(const r of e){const n=t.startsWith(r.name);let o=t.replace(r.name,"");if(n){if(o.startsWith("/")){const a=r.name;return o=`.${o}`,{pkgNameOrAlias:a,expose:o,remote:r}}else if(o==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const s=r.alias&&t.startsWith(r.alias);let i=r.alias&&t.replace(r.alias,"");if(r.alias&&s){if(i&&i.startsWith("/")){const a=r.alias;return i=`.${i}`,{pkgNameOrAlias:a,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function qr(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const _t="RUNTIME-001",bt="RUNTIME-002",Rt="RUNTIME-003",St="RUNTIME-004",$t="RUNTIME-005",Ae="RUNTIME-006",wt="RUNTIME-007",Ge="RUNTIME-008",Kr="RUNTIME-009",Nt="RUNTIME-010",It="RUNTIME-011",zr="RUNTIME-012",L={[_t]:"Failed to get remoteEntry exports.",[bt]:'The remote entry interface does not contain "init"',[Rt]:"Failed to get manifest.",[St]:"Failed to locate remote.",[$t]:"Invalid loadShareSync function call from bundler runtime",[Ae]:"Invalid loadShareSync function call from runtime",[wt]:"Failed to get remote snapshot.",[Ge]:"Failed to load script resources.",[Kr]:"Please call createInstance first.",[Nt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[It]:"The remoteEntry URL is missing from the remote snapshot.",[zr]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'};({...L});const Tt=".then(callbacks[0]).catch(callbacks[1])";async function Jr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Tt}`)([r,n]):import(e).then(r).catch(n)}catch(o){S(`Failed to load ESM entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}async function Xr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(n):new Function("callbacks",`System.import("${e}")${Tt}`)([r,n])}catch(o){S(`Failed to load SystemJS entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}function vt(e,t,r){const{remoteEntryKey:n,entryExports:o}=De(e,t);return o||S(_t,L,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),o}async function Yr({name:e,globalName:t,entry:r,loaderHook:n,getEntryUrl:o}){const{entryExports:s}=De(e,t);if(s)return s;const i=o?o(r):r;return Yt(i,{attrs:{},createScriptHook:(a,l)=>{const c=n.lifecycle.createScript.emit({url:a,attrs:l});if(c&&(c instanceof HTMLScriptElement||"script"in c||"timeout"in c))return c}}).then(()=>vt(e,t,r),a=>{const l=a instanceof Error?a.message:String(a);S(Ge,L,{remoteName:e,resourceUrl:i},l)})}async function Zr({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:o,entryGlobalName:s,name:i,type:a}=e;switch(a){case"esm":case"module":return Jr({entry:o,remoteEntryExports:t});case"system":return Xr({entry:o,remoteEntryExports:t});default:return Yr({entry:o,globalName:s,name:i,loaderHook:r,getEntryUrl:n})}}async function Qr({remoteInfo:e,loaderHook:t}){const{entry:r,entryGlobalName:n,name:o,type:s}=e,{entryExports:i}=De(o,n);return i||er(r,{attrs:{name:o,globalName:n,type:s},loaderHook:{createScriptHook:(a,l={})=>{const c=t.lifecycle.createScript.emit({url:a,attrs:l});if(c&&"url"in c)return c}}}).then(()=>vt(o,n,r)).catch(a=>{S(`Failed to load Node.js entry for remote "${o}" from "${r}". ${a instanceof Error?a.message:String(a)}`)})}function Pe(e){const{entry:t,name:r}=e;return Ye(r,t)}async function ye(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:o,_inErrorHandling:s=!1}=e,i=Pe(n);if(r)return r;if(!W[i]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;W[i]=a.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:r}).then(c=>c||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":H)?Zr({remoteInfo:n,remoteEntryExports:r,loaderHook:l,getEntryUrl:o}):Qr({remoteInfo:n,loaderHook:l}))).catch(async c=>{const f=Pe(n),h=c instanceof Error&&c.message.includes("ScriptExecutionError");if(c instanceof Error&&c.message.includes(Ge)&&!h&&!s){const u=m=>ye({...m,_inErrorHandling:!0}),d=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:u,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:W,uniqueKey:f});if(d)return d}throw c})}return W[i]}function ke(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||yt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ne}}function en(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function tn(e,t){const r=ur(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(o=>{e!=null&&e.find(s=>s.name!==o.name)&&e.push(o)}),e&&e.length>0&&e.forEach(o=>{n.forEach(s=>{s.applyPlugin(o,t)})}),e}function rn(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function J(e){var r,n,o,s,i,a;const t={};for(const[l,c]of Object.entries(e.shared)){const f=c[0];f&&(t[l]={version:f.version,singleton:(r=f.shareConfig)==null?void 0:r.singleton,requiredVersion:((n=f.shareConfig)==null?void 0:n.requiredVersion)===!1?!1:(o=f.shareConfig)==null?void 0:o.requiredVersion,eager:f.eager,strictVersion:(s=f.shareConfig)==null?void 0:s.strictVersion})}return{project:{name:e.name,mfRole:((i=e.remotes)==null?void 0:i.length)>0?"host":"unknown"},mfConfig:{name:e.name,remotes:((a=e.remotes)==null?void 0:a.map(rn))??[],shared:t}}}function At(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...e}}function nn(e,t){return t.map(r=>{const n=qr(e,r.nameOrAlias);return k(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Qe({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:At(r)}})}function on(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Pt(e,t,r,n=!0){const{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(a=>{const{moduleInfo:l}=a,c=t.moduleCache.get(e.name);ye(c?{origin:t,remoteInfo:l,remoteEntryExports:c.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const a={rel:"preload",as:"style"};o.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d}});f&&document.head.appendChild(c)})}else{const a={rel:"stylesheet",type:"text/css"};o.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d},needDeleteLink:!1});f&&document.head.appendChild(c)})}if(n){const a={rel:"preload",as:"script"};s.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d}});f&&document.head.appendChild(c)})}else{const a={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};s.forEach(l=>{const{script:c,needAttach:f}=ot({url:l,cb:()=>{},attrs:a,createScriptHook:(h,u)=>{const d=t.loaderHook.lifecycle.createScript.emit({url:h,attrs:u});if(d instanceof HTMLScriptElement)return d},needDeleteScript:!0});f&&document.head.appendChild(c)})}}}function sn(e,t,r){const n=t,o=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];o.length||o.push("default"),o.forEach(i=>{n[i]||(n[i]={})});const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?o:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:n,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:n[o[0]],initScope:r??[]}}var kt=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const e=await ye({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return k(e,`remoteEntryExports is undefined
|
|
8
|
+
${Qe(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async init(e,t,r){const n=await this.getEntry();if(this.inited)return n;if(this.initPromise)return await this.initPromise,n;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:o,shareScope:s,initScope:i}=sn(this.remoteInfo,this.host.shareScopeMap,r),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:s,remoteEntryInitOptions:o,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&S(bt,L,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,J(this.host.options)),await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,n){const{loadFactory:o=!0}=r||{loadFactory:!0},s=await this.init(e,n);this.lib=s;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo}),i||(i=await s.get(t)),k(i,`${Q(this.remoteInfo)} remote don't export ${t}.`);const a=ir(this.remoteInfo.name,t),l=this.wraperFactory(i,a);return o?await l():l}wraperFactory(e,t){function r(n,o){n&&typeof n=="object"&&Object.isExtensible(n)&&!Object.getOwnPropertyDescriptor(n,Symbol.for("mf_module_id"))&&Object.defineProperty(n,Symbol.for("mf_module_id"),{value:o,enumerable:!1})}return e instanceof Promise?async()=>{const n=await e();return r(n,t),n}:()=>{const n=e();return r(n,t),n}}},A=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const t=this;this.on(function r(...n){return t.remove(r),e.apply(null,n)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},P=class extends A{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let n=0;const o=s=>s===!1?!1:n<r.length?Promise.resolve(r[n++].apply(null,e)).then(o):s;t=o()}return Promise.resolve(t)}};function Ot(e,t){if(!Ce(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var j=class extends A{constructor(e){super(),this.onerror=S,this.type=e}emit(e){Ce(e)||S(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(Ot(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Le(r),this.onerror(r)}return e}},F=class extends A{constructor(e){super(),this.onerror=S,this.type=e}emit(e){Ce(e)||S(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let r=0;const n=s=>(Le(s),this.onerror(s),e),o=s=>{if(Ot(e,s)){if(e=s,r<t.length)try{return Promise.resolve(t[r++](e)).then(o,n)}catch(i){return n(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(o(e))}return Promise.resolve(e)}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var n;k(sr(e),"Plugin configuration is invalid.");const r=e.name;k(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,(n=e.apply)==null||n.call(e,t),Object.keys(this.lifecycle).forEach(o=>{const s=e[o];s&&this.lifecycle[o].on(s)}))}removePlugin(e){k(e,"A name is required.");const t=this.registerPlugins[e];k(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Lt(e,t){const r=lt(t);r.url||S(It,L,{remoteName:e.name});let n=Ne(t,r.url);!H&&!n.startsWith("http")&&(n=`https:${n}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function an(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:o,remoteInfo:s,id:i}=e;if(!Me(t)||!at(t)){const{remoteSnapshot:a,globalSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Lt(s,a);const c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},f=await o.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:c,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:l});return f&&Pt(s,o,f,!1),{...e,remoteSnapshot:a}}return e}}}function cn(e){const t=e.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function Mt(e,t,r,n,o={},s){const{value:i}=K(e,Q(t)),a=s||i;if(a&&!et(a)&&(r(a,t,n),a.remotesInfo)){const l=Object.keys(a.remotesInfo);for(const c of l){if(o[c])continue;o[c]=!0;const f=cn(c),h=a.remotesInfo[c];Mt(e,{name:f.name,version:h.matchedVersion},r,!1,o,void 0)}}}const Se=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function ln(e,t,r,n,o){const s=[],i=[],a=[],l=new Set,c=new Set,{options:f}=e,{preloadConfig:h}=t,{depsRemote:u}=h;if(Mt(n,r,(m,y,g)=>{var $;let p;if(g)p=h;else if(Array.isArray(u)){const R=u.find(w=>w.nameOrAlias===y.name||w.nameOrAlias===y.alias);if(!R)return;p=At(R)}else if(u===!0)p=h;else return;const E=Ne(m,lt(m).url);E&&a.push({name:y.name,moduleInfo:{name:y.name,entry:E,type:"remoteEntryType"in m?m.remoteEntryType:"global",entryGlobalName:"globalName"in m?m.globalName:y.name,shareScope:"",version:"version"in m?m.version:void 0},url:E});let b="modules"in m?m.modules:[];const N=on(p.exposes);N.length&&"modules"in m&&(b=($=m==null?void 0:m.modules)==null?void 0:$.reduce((R,w)=>((N==null?void 0:N.indexOf(w.moduleName))!==-1&&R.push(w),R),[]));function _(R){const w=R.map(M=>Ne(m,M));return p.filter?w.filter(p.filter):w}if(b){const R=b.length;for(let w=0;w<R;w++){const M=b[w],ge=`${y.name}/${M.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?y.name:ge,name:y.name,remoteSnapshot:m,preloadConfig:p,remote:y,origin:e}),!fr(ge)&&(p.resourceCategory==="all"?(s.push(..._(M.assets.css.async)),s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.async)),i.push(..._(M.assets.js.sync))):p.resourceCategory==="sync"&&(s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.sync))),hr(ge))}}},!0,{},o),o.shared&&o.shared.length>0){const m=(y,g)=>{const{shared:p}=me(e.shareScopeMap,g.sharedName,y,e.sharedHandler.hooks.lifecycle.resolveShare)||{};p&&typeof p.lib=="function"&&(g.assets.js.sync.forEach(E=>{l.add(E)}),g.assets.css.sync.forEach(E=>{c.add(E)}))};o.shared.forEach(y=>{var E;const g=(E=f.shared)==null?void 0:E[y.sharedName];if(!g)return;const p=y.version?g.find(b=>b.version===y.version):g;p&&ct(p).forEach(b=>{m(b,y)})})}const d=i.filter(m=>!l.has(m)&&!Se("script",m));return{cssAssets:s.filter(m=>!c.has(m)&&!Se("link",m)),jsAssetsWithoutEntry:d,entryAssets:a.filter(m=>!Se("script",m.url))}}const un=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:n,remote:o,globalSnapshot:s,remoteSnapshot:i}=e;return H?Me(o)&&at(o)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:o.name,url:o.entry,moduleInfo:{name:n.name,entry:o.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Lt(n,i),ln(t,r,n,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Ct(e,t){const r=fe({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&K(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:"version"in e?e.version:void 0})}}var fn=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new P("beforeLoadRemoteSnapshot"),loadSnapshot:new F("loadGlobalSnapshot"),loadRemoteSnapshot:new F("loadRemoteSnapshot"),afterLoadSnapshot:new F("afterLoadSnapshot")}),this.manifestLoading=ee.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){const{options:n}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:n,moduleInfo:e});let o=fe({name:this.HostInstance.options.name,version:this.HostInstance.options.version});o||(o={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},lr({[this.HostInstance.options.name]:o})),o&&"remotesInfo"in o&&!K(o.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(o.remotesInfo={...o==null?void 0:o.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a}=this.getGlobalRemoteInfo(e),{remoteSnapshot:l,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a});let f,h;if(l)if(et(l)){const u=H?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||"",d=await this.getManifestJson(u,e,{}),m=Ue({...e,entry:u},d);f=d,h=m}else{const{remoteSnapshot:u}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:"global"});f=u,h=c}else if(Me(e)){const u=await this.getManifestJson(e.entry,e,{}),d=Ue(e,u),{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:u,from:"global"});f=m,h=d}else S(wt,L,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(c)},void 0,J(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:f}),{remoteSnapshot:f,globalSnapshot:h}}getGlobalRemoteInfo(e){return Ct(e,this.HostInstance)}async getManifestJson(e,t,r){const n=async()=>{let s=this.manifestCache.get(e);if(s)return s;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{});(!i||!(i instanceof Response))&&(i=await fetch(e,{})),s=await i.json()}catch(i){s=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),s||(delete this.manifestLoading[e],S(Rt,L,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,J(this.HostInstance.options)))}return k(s.metaData&&s.exposes&&s.shared,`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${[!s.metaData&&"metaData",!s.exposes&&"exposes",!s.shared&&"shared"].filter(Boolean).join(", ")}.`),this.manifestCache.set(e,s),s},o=async()=>{const s=await n(),i=qt(s,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=o().then(s=>s)),this.manifestLoading[e]}},hn=class{constructor(e){this.hooks=new q({beforeRegisterShare:new j("beforeRegisterShare"),afterResolve:new F("afterResolve"),beforeLoadShare:new F("beforeLoadShare"),loadShare:new P,resolveShare:new j("resolveShare"),initContainerShareScopeMap:new j("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=gt(e,t);return Object.keys(r).forEach(o=>{r[o].forEach(s=>{s.scope.forEach(i=>{var a;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:o,shared:s}),(a=this.shareScopeMap[i])!=null&&a[o]||this.setShared({pkgName:o,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name})})})}),{newShareInfos:r,allShareInfos:n}}async loadShare(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&await Promise.all(n.scope.map(async a=>{await Promise.all(this.initializeSharing(a,{strategy:n.strategy}))}));const{shareInfo:o}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});k(o,`Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);const{shared:s,useTreesShaking:i}=me(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(s){const a=ae(s,i);if(a.lib)return V(a,r.options.name),a.lib;if(a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),V(a,r.options.name),l}else{const c=(async()=>{const f=await a.get();return V(a,r.options.name),a.loaded=!0,a.lib=f,f})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:c,treeShaking:i?a:void 0}),c}}else{if(t!=null&&t.customShareInfo)return!1;const a=te(o.treeShaking),l=ae(o,a),f=(async()=>{const h=await l.get();l.lib=h,l.loaded=!0,V(l,r.options.name);const{shared:u,useTreesShaking:d}=me(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(u){const m=ae(u,d);m.lib=h,m.loaded=!0,u.from=o.from}return h})();return this.setShared({pkgName:e,loaded:!1,shared:o,from:r.options.name,lib:null,loading:f,treeShaking:a?l:void 0}),f}}initializeSharing(e=ne,t){const{host:r}=this,n=t==null?void 0:t.from,o=t==null?void 0:t.strategy;let s=t==null?void 0:t.initScope;const i=[];if(n!=="build"){const{initTokens:u}=this;s||(s=[]);let d=u[e];if(d||(d=u[e]={from:this.host.name}),s.indexOf(d)>=0)return i;s.push(d)}const a=this.shareScopeMap,l=r.options.name;a[e]||(a[e]={});const c=a[e],f=(u,d)=>{var b;const{version:m,eager:y}=d;c[u]=c[u]||{};const g=c[u],p=g[m]&&ae(g[m]),E=!!(p&&("eager"in p&&p.eager||"shareConfig"in p&&((b=p.shareConfig)!=null&&b.eager)));(!p||p.strategy!=="loaded-first"&&!p.loaded&&(!y!=!E?y:l>g[m].from))&&(g[m]=d)},h=async u=>{const{module:d}=await r.remoteHandler.getRemoteModuleAndOptions({id:u});let m;try{m=await d.getEntry()}catch(y){if(m=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:u,error:y,from:"runtime",lifecycle:"beforeLoadShare",origin:r}),!m)return}finally{m!=null&&m.init&&!d.initing&&(d.remoteEntryExports=m,await d.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(u=>{r.options.shared[u].forEach(d=>{d.scope.includes(e)&&f(u,d)})}),(r.options.shareStrategy==="version-first"||o==="version-first")&&r.options.remotes.forEach(u=>{u.shareScope===e&&i.push(h(u.name))}),i}loadShareSync(e,t){const{host:r}=this,n=Ke({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy})});const{shared:o,useTreesShaking:s}=me(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(o){if(typeof o.lib=="function")return V(o,r.options.name),o.loaded||(o.loaded=!0,o.from===r.options.name&&(n.loaded=!0)),o.lib;if(typeof o.get=="function"){const i=o.get();if(!(i instanceof Promise))return V(o,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:o}),i}}if(n.lib)return n.loaded||(n.loaded=!0),n.lib;if(n.get){const i=n.get();return i instanceof Promise&&S((t==null?void 0:t.from)==="build"?$t:Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}S(Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options))}initShareScopeMap(e,t,r={}){const{host:n}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:n.options,origin:n,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:n,loading:o,loaded:s,get:i,treeShaking:a}){const{version:l,scope:c="default",...f}=t,h=Array.isArray(c)?c:[c],u=d=>{const m=(g,p,E)=>{E&&!g[p]&&(g[p]=E)},y=a?d.treeShaking:d;m(y,"loaded",s),m(y,"loading",o),m(y,"get",i)};h.forEach(d=>{this.shareScopeMap[d]||(this.shareScopeMap[d]={}),this.shareScopeMap[d][e]||(this.shareScopeMap[d][e]={}),this.shareScopeMap[d][e][l]||(this.shareScopeMap[d][e][l]={version:l,scope:[d],...f,lib:n});const m=this.shareScopeMap[d][e][l];u(m),r&&m.from!==r&&(m.from=r)})}_setGlobalShareScopeMap(e){const t=Et(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},dn=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new j("beforeRegisterRemote"),registerRemote:new j("registerRemote"),beforeRequest:new F("beforeRequest"),onLoad:new P("onLoad"),handlePreloadModule:new A("handlePreloadModule"),errorLoadRemote:new P("errorLoadRemote"),beforePreloadRemote:new P("beforePreloadRemote"),generatePreloadAssets:new P("generatePreloadAssets"),afterPreloadRemote:new P,loadEntry:new P}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,n)=>(this.registerRemote(n,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:n}=t,{name:o,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:n},s&&e.startsWith(o)){const i=e.replace(o,s);this.idToRemoteMap[i]={name:r.name,expose:n};return}if(s&&e.startsWith(s)){const i=e.replace(s,o);this.idToRemoteMap[i]={name:r.name,expose:n}}}async loadRemote(e,t){const{host:r}=this;try{const{loadFactory:n=!0}=t||{loadFactory:!0},{module:o,moduleOptions:s,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:a,remote:l,expose:c,id:f,remoteSnapshot:h}=i,u=await o.get(f,c,t,h),d=await this.hooks.lifecycle.onLoad.emit({id:f,pkgNameOrAlias:a,expose:c,exposeModule:n?u:void 0,exposeModuleFactory:n?void 0:u,remote:l,options:s,moduleInstance:o,origin:r});return this.setIdToRemoteMap(e,i),typeof d=="function"?d:u}catch(n){const{from:o="runtime"}=t||{from:"runtime"},s=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:o,lifecycle:"onLoad",origin:r});if(!s)throw n;return s}}async preloadRemote(e){const{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=nn(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:o}=n,s=ke(o),{globalSnapshot:i,remoteSnapshot:a}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:o}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:o,remoteInfo:s,globalSnapshot:i,remoteSnapshot:a});l&&Pt(s,t,l)}))}registerRemotes(e,t){const{host:r}=this;e.forEach(n=>{this.registerRemote(n,r.options.remotes,{force:t==null?void 0:t.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let n;try{n=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(d){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:d,lifecycle:"beforeRequest"}),!n)throw d}const{id:o}=n,s=jr(t.options.remotes,o);s||S(St,L,{hostName:t.options.name,requestId:o},void 0,J(t.options));const{remote:i}=s,a=ke(i),l=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:o,...s,options:t.options,origin:t,remoteInfo:a}),{remote:c,expose:f}=l;k(c&&f,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${o}.`);let h=t.moduleCache.get(c.name);const u={host:t,remoteInfo:a};return h||(h=new kt(u),t.moduleCache.set(c.name,h)),{module:h,moduleOptions:u,remoteMatchInfo:l}}registerRemote(e,t,r){const{host:n}=this,o=()=>{if(e.alias){const i=t.find(a=>{var l;return e.alias&&(a.name.startsWith(e.alias)||((l=a.alias)==null?void 0:l.startsWith(e.alias)))});k(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in e&&H&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ne),e.type||(e.type=yt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:n});const s=t.find(i=>i.name===e.name);if(!s)o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n});else{const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(s),o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n}),Ze(i.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:n}=e,o=r.options.remotes.findIndex(i=>i.name===n);o!==-1&&r.options.remotes.splice(o,1);const s=r.moduleCache.get(e.name);if(s){const i=s.remoteInfo,a=i.entryGlobalName;I[a]&&((t=Object.getOwnPropertyDescriptor(I,a))!=null&&t.configurable?delete I[a]:I[a]=void 0);const l=Pe(s.remoteInfo);W[l]&&delete W[l],r.snapshotHandler.manifestCache.delete(i.entry);let c=i.buildVersion?Ye(i.name,i.buildVersion):i.name;const f=I.__FEDERATION__.__INSTANCES__.findIndex(u=>i.buildVersion?u.options.id===c:u.name===c);if(f!==-1){const u=I.__FEDERATION__.__INSTANCES__[f];c=u.options.id||c;const d=Et();let m=!0;const y=[];Object.keys(d).forEach(g=>{const p=d[g];p&&Object.keys(p).forEach(E=>{const b=p[E];b&&Object.keys(b).forEach(N=>{const _=b[N];_&&Object.keys(_).forEach($=>{const R=_[$];R&&typeof R=="object"&&R.from===i.name&&(R.loaded||R.loading?(R.useIn=R.useIn.filter(w=>w!==i.name),R.useIn.length?m=!1:y.push([g,E,N,$])):y.push([g,E,N,$]))})})})}),m&&(u.shareScopeMap={},delete d[c]),y.forEach(([g,p,E,b])=>{var N,_,$;($=(_=(N=d[g])==null?void 0:N[p])==null?void 0:_[E])==null||delete $[b]}),I.__FEDERATION__.__INSTANCES__.splice(f,1)}const{hostGlobalSnapshot:h}=Ct(e,r);if(h){const u=h&&"remotesInfo"in h&&h.remotesInfo&&K(h.remotesInfo,e.name).key;u&&(delete h.remotesInfo[u],ee.__FEDERATION__.__MANIFEST_LOADING__[u]&&delete ee.__FEDERATION__.__MANIFEST_LOADING__[u])}r.moduleCache.delete(e.name)}}catch(r){ve.error(`removeRemote failed: ${r instanceof Error?r.message:String(r)}`)}}};const mn=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var pn=class{constructor(e){this.hooks=new q({beforeInit:new j("beforeInit"),init:new A,beforeInitContainer:new F("beforeInitContainer"),initContainer:new F("initContainer")}),this.version="2.3.1",this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new A,createScript:new A,createLink:new A,fetch:new P,loadEntryError:new P,getModuleFactory:new P}),this.bridgeHook=new q({beforeBridgeRender:new A,afterBridgeRender:new A,beforeBridgeDestroy:new A,afterBridgeDestroy:new A});const t=mn?[an(),un()]:[],r={id:en(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:H};this.name=e.name,this.options=r,this.snapshotHandler=new fn(this),this.sharedHandler=new hn(this),this.remoteHandler=new dn(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&S(it(Nt,L)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=ne,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=ke({name:e,entry:t}),o=new kt({host:this,remoteInfo:n});return o.remoteEntryExports=r,this.moduleCache.set(e,o),o}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){const{allShareInfos:r}=gt(e,t),{userOptions:n,options:o}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(o,n),{allShareInfos:i}=this.sharedHandler.registerShared(o,n),a=[...o.plugins];n.plugins&&n.plugins.forEach(c=>{a.includes(c)||a.push(c)});const l={...e,...t,plugins:a,remotes:s,shared:i};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){const t=tn(e,this);this.options.plugins=this.options.plugins.reduce((r,n)=>(n&&r&&!r.find(o=>o.name===n.name)&&r.push(n),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};let yn=null;function Dt(){return yn}ar(pn);function Ft(e,t){const r=n=>{const o=n.length>1&&n.endsWith("/"),s=`${t}/${n}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/";return o?`${s}/`:s};return e.map(n=>{const o={...n,path:r(n.path)};return typeof n.redirect=="string"?o.redirect=r(n.redirect):n.redirect&&typeof n.redirect=="object"&&"path"in n.redirect&&typeof n.redirect.path=="string"&&(o.redirect={...n.redirect,path:r(n.redirect.path)}),n.children&&n.children.length>0&&(o.children=Ft(n.children,t)),o})}function gn(e){const{router:t,basename:r,memoryRoute:n,hashRoute:o}=e,s=t.getRoutes().sort((u,d)=>u.path.split("/").filter(m=>m).length-d.path.split("/").filter(m=>m).length),i=new Map,a=new Set;s.forEach(u=>{i.set(u.path,u)});const l=(u,d)=>`${u}/${d}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",c=(u,d="")=>{if(!u.children||u.children.length===0)return u;for(let m=0;m<u.children.length;m++){const y=u.children[m],g=l(d,y.path),p=i.get(g);if(p&&!a.has(p)){const E={...p,path:y.path};u.children[m]=E,a.add(p),c(E,g)}}return u};let f=[];for(const u of s)if(!a.has(u)){const d=c(u,u.path);a.add(u),f.push(d)}let h;return n?h=ce.createMemoryHistory(r):o?(h=ce.createWebHashHistory(),r&&(f=Ft(f,r))):h=ce.createWebHistory(r),{history:h,routes:f}}function En(e){const t=new Map,r=Dt();return()=>({__APP_VERSION__:"2.3.1",async render(n){var m,y,g;D.debug("createBridgeComponent render Info",n);const{moduleName:o,dom:s,basename:i,memoryRoute:a,hashRoute:l,...c}=n,f=Gt.createApp(e.rootComponent,c);t.set(s,f);const h=await((g=(y=(m=r==null?void 0:r.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:y.beforeBridgeRender)==null?void 0:g.emit(n)),u=h&&typeof h=="object"&&(h!=null&&h.extraProps)?h==null?void 0:h.extraProps:{},d=e.appOptions({app:f,basename:i,memoryRoute:a,hashRoute:l,...c,...u});if(d!=null&&d.router){const{history:p,routes:E}=gn({router:d.router,basename:n.basename,memoryRoute:n.memoryRoute,hashRoute:n.hashRoute}),b=ce.createRouter({...d.router.options,history:p,routes:E});D.debug("createBridgeComponent render router info>>>",{moduleName:o,router:b}),a&&await b.push(a.entryPath),f.use(b)}f.mount(s)},destroy(n){D.debug("createBridgeComponent destroy Info",n);const o=t.get(n==null?void 0:n.dom);o==null||o.unmount()}})}function _n(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const bn=v.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(e){const t=v.ref(null),r=v.ref(null),n=v.ref(""),o=Oe.useRoute(),s=Dt(),i=v.useAttrs(),a=async()=>{var u,d,m,y;const c=(u=e.providerInfo)==null?void 0:u.call(e);r.value=c;let f={...i,moduleName:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute};D.debug("createRemoteAppComponent LazyComponent render >>>",f);const h=await((y=(m=(d=s==null?void 0:s.bridgeHook)==null?void 0:d.lifecycle)==null?void 0:m.beforeBridgeRender)==null?void 0:y.emit(f))||{};f={...f,...h.extraProps},c.render(f)},l=v.watch(()=>o==null?void 0:o.path,c=>{c!==o.path&&a(),n.value!==""&&n.value!==c&&(D.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:o.path}),_n()),n.value=c});return v.onMounted(()=>{a()}),v.onBeforeUnmount(()=>{var c;D.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e}),l(),(c=r.value)==null||c.destroy({dom:t.value})}),()=>v.createVNode("div",v.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function Ht(e){return v.defineAsyncComponent({__APP_VERSION__:"2.3.1",...e.asyncComponentOptions,loader:async()=>{var l,c;const t=Oe.useRoute();let r="/";const n=(c=(l=t==null?void 0:t.matched)==null?void 0:l[0])==null?void 0:c.path;n&&(n.endsWith("/:pathMatch(.*)*")?r=n.replace("/:pathMatch(.*)*",""):r=t.matched[0].path);const o=(e==null?void 0:e.export)||"default";D.debug("createRemoteAppComponent LazyComponent create >>>",{basename:r,info:e});const s=await e.loader(),i=s&&s[Symbol.for("mf_module_id")],a=s[o];if(D.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:i,module:s,exportName:o,basename:r,route:t}),o in s&&typeof a=="function")return{render(){return v.h(bn,{moduleName:i,providerInfo:a,basename:r,rootAttrs:e.rootAttrs,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute})}};throw new Error("module not found")}})}function Rn(e){return D.warn("createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"),Ht(e)}exports.createBridgeComponent=En;exports.createRemoteAppComponent=Ht;exports.createRemoteComponent=Rn;
|
package/dist/index.js
CHANGED
|
@@ -539,7 +539,7 @@ function lt(e) {
|
|
|
539
539
|
lt(I);
|
|
540
540
|
lt(k);
|
|
541
541
|
function mr(e, t = we()) {
|
|
542
|
-
t && (I.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = e, I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.3.
|
|
542
|
+
t && (I.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = e, I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.3.1");
|
|
543
543
|
}
|
|
544
544
|
function q(e, t) {
|
|
545
545
|
if (typeof t == "string") {
|
|
@@ -2277,7 +2277,7 @@ var Sn = class {
|
|
|
2277
2277
|
init: new v(),
|
|
2278
2278
|
beforeInitContainer: new D("beforeInitContainer"),
|
|
2279
2279
|
initContainer: new D("initContainer")
|
|
2280
|
-
}), this.version = "2.3.
|
|
2280
|
+
}), this.version = "2.3.1", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new j({
|
|
2281
2281
|
getModuleInfo: new v(),
|
|
2282
2282
|
createScript: new v(),
|
|
2283
2283
|
createLink: new v(),
|
|
@@ -2431,7 +2431,7 @@ function wn(e) {
|
|
|
2431
2431
|
function Pn(e) {
|
|
2432
2432
|
const t = /* @__PURE__ */ new Map(), r = Ct();
|
|
2433
2433
|
return () => ({
|
|
2434
|
-
__APP_VERSION__: "2.3.
|
|
2434
|
+
__APP_VERSION__: "2.3.1",
|
|
2435
2435
|
async render(n) {
|
|
2436
2436
|
var m, y, g;
|
|
2437
2437
|
C.debug("createBridgeComponent render Info", n);
|
|
@@ -2533,7 +2533,7 @@ const In = /* @__PURE__ */ Ht({
|
|
|
2533
2533
|
});
|
|
2534
2534
|
function Tn(e) {
|
|
2535
2535
|
return jt({
|
|
2536
|
-
__APP_VERSION__: "2.3.
|
|
2536
|
+
__APP_VERSION__: "2.3.1",
|
|
2537
2537
|
...e.asyncComponentOptions,
|
|
2538
2538
|
//@ts-ignore
|
|
2539
2539
|
loader: async () => {
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "git+https://github.com/module-federation/core.git",
|
|
8
8
|
"directory": "packages/bridge/vue3-bridge"
|
|
9
9
|
},
|
|
10
|
-
"version": "2.3.
|
|
10
|
+
"version": "2.3.1",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"vue-router": "=4"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@module-federation/bridge-shared": "2.3.
|
|
35
|
-
"@module-federation/runtime": "2.3.
|
|
36
|
-
"@module-federation/sdk": "2.3.
|
|
34
|
+
"@module-federation/bridge-shared": "2.3.1",
|
|
35
|
+
"@module-federation/runtime": "2.3.1",
|
|
36
|
+
"@module-federation/sdk": "2.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/react": "^18.3.11",
|