signalk-multihelm 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -11
- package/package.json +10 -4
- package/plugin/chunks/_virtual_mf-localSharedImportMap___mfe_internal__signalk_multihelm__mf_owner__1-GfsGDlYi.js +1 -0
- package/plugin/chunks/dist-BL3MB09X.js +4 -0
- package/plugin/chunks/hostInit-Bmen-Aym.js +1 -0
- package/plugin/chunks/pendingShares-DbC_Kacf.js +1 -0
- package/plugin/chunks/vite-preload-helper-DygEbaNj.js +1 -0
- package/plugin/configpanel-entry.js +1 -0
- package/plugin/index.js +600 -170
- package/plugin/index.js.map +1 -1
- package/plugin/remoteEntry.js +1 -0
- package/public/chunks/_virtual_mf-localSharedImportMap___mfe_internal__signalk_multihelm__mf_owner__1-GfsGDlYi.js +1 -0
- package/public/chunks/dist-BL3MB09X.js +4 -0
- package/public/chunks/hostInit-Bmen-Aym.js +1 -0
- package/public/chunks/pendingShares-DbC_Kacf.js +1 -0
- package/public/chunks/vite-preload-helper-DygEbaNj.js +1 -0
- package/public/configpanel-entry.js +1 -0
- package/public/remoteEntry.js +1 -0
package/README.md
CHANGED
|
@@ -15,11 +15,31 @@ chart files and shared ENC cells.
|
|
|
15
15
|
|
|
16
16
|
## Pairing
|
|
17
17
|
|
|
18
|
-
Install Multihelm on every server
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
Install Multihelm on every server and set **This server is the boat's
|
|
19
|
+
master** on one of them ([The master](#the-master)). Then, on each of the
|
|
20
|
+
others, open **Server → Plugin Config → Multihelm** and:
|
|
21
|
+
|
|
22
|
+
1. **Pair** with the master: pick it from the servers found on the network,
|
|
23
|
+
or enter its address.
|
|
24
|
+
2. **Approve on the master**: log in there and approve the request
|
|
25
|
+
“Multihelm on _this server_” under **Security → Access Requests**. The
|
|
26
|
+
settings link to it and show the pairing as soon as it is approved.
|
|
27
|
+
3. **Allow on this server**: once paired, the settings ask for admin access
|
|
28
|
+
to this server, to write the master's vessel data, metadata and source
|
|
29
|
+
priorities here. Click **Allow**.
|
|
30
|
+
|
|
31
|
+
A server without security needs no approval. Every plugin that uses
|
|
32
|
+
Multihelm shares the pairing.
|
|
33
|
+
|
|
34
|
+
A server takes over what the servers it is paired with share. Pairing a
|
|
35
|
+
server with the master is enough for the master's settings, history and
|
|
36
|
+
services; for datasets that go both ways, such as charts, pair the other
|
|
37
|
+
server with it too.
|
|
38
|
+
|
|
39
|
+
The settings show each paired server online or offline, with its Signal K
|
|
40
|
+
and Multihelm versions and why it cannot be reached. Every server also lists
|
|
41
|
+
the servers paired with it, so the master shows the others; a server on an
|
|
42
|
+
older Multihelm version is not listed there until it is updated.
|
|
23
43
|
|
|
24
44
|
Needs Signal K server 2.31 or later: peers read the replication routes with a
|
|
25
45
|
readonly device token.
|
|
@@ -38,19 +58,30 @@ minutes no longer counts.
|
|
|
38
58
|
When several servers are set, the one with the smallest server id is the
|
|
39
59
|
master, and the plugin status says to set one only.
|
|
40
60
|
|
|
41
|
-
## Vessel data and
|
|
61
|
+
## Vessel data, metadata and source priorities from the master
|
|
42
62
|
|
|
43
63
|
The vessel is described once, on the master. The other servers take over its
|
|
44
64
|
vessel data from **Server -> Settings** (name, MMSI, call sign, length, beam,
|
|
45
65
|
draft, air height, ship type) and the metadata set for paths (display names,
|
|
46
|
-
units, zones, alarm limits)
|
|
47
|
-
|
|
48
|
-
|
|
66
|
+
units, zones, alarm limits) and the source priorities from **Data -> Source
|
|
67
|
+
Priorities**, and follow every change once a minute. A change made on another
|
|
68
|
+
server is replaced by the master's. GPS antenna positions stay with each
|
|
69
|
+
server, and so does the metadata of a path the master has none for, such as
|
|
70
|
+
a device that only one server reads; metadata the master removes goes on the
|
|
71
|
+
other servers too. Each of the three can be turned off per server in the
|
|
49
72
|
plugin settings.
|
|
50
73
|
|
|
74
|
+
Source priorities name a source by its connection, such as `can0.115`, so
|
|
75
|
+
they match on another server only where the source comes in under the same
|
|
76
|
+
connection name: give the NMEA 2000 bus the same connection name on every
|
|
77
|
+
server. Once the master has priorities set, a server's own are replaced by
|
|
78
|
+
them as a whole, so groups and overrides set only there are gone, and a
|
|
79
|
+
source only that server has is in none of the master's groups. While none
|
|
80
|
+
are set on the master, each server keeps its own.
|
|
81
|
+
|
|
51
82
|
To write them so they survive a restart, Multihelm asks its own server once
|
|
52
|
-
for admin access:
|
|
53
|
-
|
|
83
|
+
for admin access: click **Allow** in its settings on each server that is not
|
|
84
|
+
the master, or approve it under **Security -> Access Requests** there. A
|
|
54
85
|
server without security needs nothing. A new MMSI takes effect on that server
|
|
55
86
|
at its next restart, as when it is changed by hand.
|
|
56
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signalk-multihelm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Keeps several Signal K servers on one boat in step, one per nav station, without depending on a single one",
|
|
5
5
|
"author": "Dirk Wahrheit",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"format": "prettier --write . && eslint --fix .",
|
|
11
11
|
"ci-lint": "eslint . && prettier --check .",
|
|
12
|
-
"build": "vite build",
|
|
13
|
-
"typecheck": "tsc --noEmit -p tsconfig.eslint.json",
|
|
12
|
+
"build": "vite build && vite build -c vite.panel.config.ts",
|
|
13
|
+
"typecheck": "tsc --noEmit -p tsconfig.eslint.json && tsc -p src/configpanel/tsconfig.json",
|
|
14
14
|
"test": "vitest run",
|
|
15
15
|
"build:all": "npm run ci-lint && npm run typecheck && npm run build && npm run test",
|
|
16
16
|
"prepublishOnly": "npm run build"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"signalk-node-server-plugin",
|
|
20
|
+
"signalk-plugin-configurator",
|
|
20
21
|
"signalk-category-utility",
|
|
21
22
|
"multihelm",
|
|
22
23
|
"sync",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"signalk-plugin-enabled-by-default": true,
|
|
37
38
|
"files": [
|
|
38
39
|
"plugin/**/*",
|
|
40
|
+
"public/**/*",
|
|
39
41
|
"icon.svg",
|
|
40
42
|
"docs/screenshots/*.png"
|
|
41
43
|
],
|
|
@@ -49,20 +51,24 @@
|
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@eslint/js": "^10.0.1",
|
|
54
|
+
"@module-federation/vite": "^1.24.0",
|
|
52
55
|
"@signalk/server-api": "^2.33.0",
|
|
53
56
|
"@types/express": "^5.0.3",
|
|
54
57
|
"@types/multicast-dns": "^7.2.4",
|
|
55
58
|
"@types/node": "^24.0.0",
|
|
59
|
+
"@types/react": "^19.3.0",
|
|
60
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
56
61
|
"eslint": "^10.12.0",
|
|
57
62
|
"eslint-config-prettier": "^10.1.8",
|
|
58
63
|
"eslint-plugin-prettier": "^5.5.6",
|
|
59
64
|
"express": "^5.2.1",
|
|
60
65
|
"jiti": "^2.7.0",
|
|
61
66
|
"prettier": "^3.0.0",
|
|
67
|
+
"react": "^19.3.1",
|
|
62
68
|
"typescript": "^6.0.3",
|
|
63
69
|
"typescript-eslint": "^8.71.0",
|
|
64
70
|
"vite": "^8.3.2",
|
|
65
|
-
"vite-plugin-checker": "^0.
|
|
71
|
+
"vite-plugin-checker": "^1.0.0",
|
|
66
72
|
"vitest": "^5.0.0"
|
|
67
73
|
},
|
|
68
74
|
"repository": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./dist-BL3MB09X.js";var e={},t=[];export{t as usedRemotes,e as usedShared};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var e={AT:`@`,HYPHEN:`-`,SLASH:`/`},t={[e.AT]:`scope_`,[e.HYPHEN]:`_`,[e.SLASH]:`__`};t[e.AT],e.AT,t[e.HYPHEN],e.HYPHEN,t[e.SLASH],e.SLASH;var n=function(e){return e[e.UNKNOWN=1]=`UNKNOWN`,e[e.CALCULATED=2]=`CALCULATED`,e[e.NO_USE=0]=`NO_USE`,e}({});function r(){return!0}function i(){return typeof navigator<`u`&&navigator?.product===`ReactNative`}function a(){try{if(r()&&window.localStorage)return!!localStorage.getItem(`FEDERATION_DEBUG`)}catch{return!1}return!1}function o(){return typeof process<`u`&&{}.FEDERATION_DEBUG?!!{}.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<`u`&&FEDERATION_DEBUG?!0:a()}var s=`[ Federation Runtime ]`,c=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}:${t}`:t:e,``):``};function l(e,t){if(`getPublicPath`in e){let n;return n=e.getPublicPath.startsWith(`function`)?Function(`return `+e.getPublicPath)()():Function(e.getPublicPath)(),`${n}${t}`}return`publicPath`in e?!r()&&!i()&&`ssrPublicPath`in e&&typeof e.ssrPublicPath==`string`?`${e.ssrPublicPath}${t}`:`${e.publicPath}${t}`:(console.warn(`Cannot get resource URL. If in debug mode, please ignore.`,e,t),``)}var u=e=>{console.warn(`${s}: ${e}`)};function d(e){try{return JSON.stringify(e,null,2)}catch{return``}}var f=(e,t)=>{if(!e)return t;let n=(e=>{if(e===`.`)return``;if(e.startsWith(`./`))return e.replace(`./`,``);if(e.startsWith(`/`)){let t=e.slice(1);return t.endsWith(`/`)?t.slice(0,-1):t}return e})(e);return n?n.endsWith(`/`)?`${n}${t}`:`${n}/${t}`:t};function p(e){return e.replace(/#.*$/,``).replace(/\?.*$/,``).replace(/\/[^\/]+$/,`/`)}function m(e,t={}){let{remotes:n={},overrides:r={},version:i}=t,a,o=()=>`publicPath`in e.metaData?(e.metaData.publicPath===`auto`||e.metaData.publicPath===``)&&i?p(i):e.metaData.publicPath:e.metaData.getPublicPath,s=Object.keys(r),c={};Object.keys(n).length||(c=e.remotes?.reduce((e,t)=>{let n,i=t.federationContainerName;return n=s.includes(i)?r[i]:`version`in t?t.version:t.entry,e[i]={matchedVersion:n},e},{})||{}),Object.keys(n).forEach(e=>c[e]={matchedVersion:s.includes(e)?r[e]:n[e]});let{remoteEntry:{path:l,name:u,type:d},types:m={path:``,name:``,zip:``,api:``},buildInfo:{buildVersion:ee},globalName:h,ssrRemoteEntry:g}=e.metaData,{exposes:te}=e,ne={version:i||``,buildVersion:ee,globalName:h,remoteEntry:f(l,u),remoteEntryType:d,remoteTypes:f(m.path,m.name),remoteTypesZip:m.zip||``,remoteTypesAPI:m.api||``,remotesInfo:c,shared:e?.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version,usedExports:e.referenceExports||[]})),modules:te?.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if(`publicPath`in e.metaData?(a={...ne,publicPath:o()},typeof e.metaData.ssrPublicPath==`string`&&(a.ssrPublicPath=e.metaData.ssrPublicPath)):a={...ne,getPublicPath:o()},g){let e=f(g.path,g.name);a.ssrRemoteEntry=e,a.ssrRemoteEntryType=g.type||`commonjs-module`}return a}function ee(e){return!!(`remoteEntry`in e&&e.remoteEntry.includes(`.json`))}var h=`[ Module Federation ]`,g=console,te=[`logger.ts`,`logger.js`,`captureStackTrace`,`Logger.emit`,`Logger.log`,`Logger.info`,`Logger.warn`,`Logger.error`,`Logger.debug`];function ne(){try{let e=Error().stack;if(!e)return;let[,...t]=e.split(`
|
|
2
|
+
`),n=t.filter(e=>!te.some(t=>e.includes(t)));return n.length?`Stack trace:\n${n.slice(0,5).join(`
|
|
3
|
+
`)}`:void 0}catch{return}}var re=class{constructor(e,t=g){this.prefix=e,this.delegate=t??g}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??g}emit(e,t){let n=this.delegate,r=o()?ne():void 0,i=r?[...t,r]:t,a=(()=>{switch(e){case`log`:return[`log`,`info`];case`info`:return[`info`,`log`];case`warn`:return[`warn`,`info`,`log`];case`error`:return[`error`,`warn`,`log`];default:return[`debug`,`log`]}})();for(let e of a){let t=n[e];if(typeof t==`function`){t.call(n,this.prefix,...i);return}}for(let e of a){let t=g[e];if(typeof t==`function`){t.call(g,this.prefix,...i);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){o()&&this.emit(`debug`,e)}};function ie(e){return new re(e)}function ae(e){let t=new re(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}ie(h),ae(h);async function oe(e,t){try{return await e()}catch(e){!t&&u(e);return}}function se(e,t){let n=/^(https?:)?\/\//i;return e.replace(n,``).replace(/\/$/,``)===t.replace(n,``).replace(/\/$/,``)}function ce(e){let t=null,n=!0,r=2e4,i,a=document.getElementsByTagName(`script`);for(let r=0;r<a.length;r++){let i=a[r],o=i.getAttribute(`src`);if(o&&se(o,e.url)){t=i,n=!1;break}}if(!t){let n=e.attrs;t=document.createElement(`script`),t.type=n?.type===`module`?`module`:`text/javascript`;let i;e.createScriptHook&&(i=e.createScriptHook(e.url,e.attrs),i instanceof HTMLScriptElement?t=i:typeof i==`object`&&(`script`in i&&i.script&&(t=i.script),`timeout`in i&&i.timeout&&(r=i.timeout))),t.src||(t.src=e.url),n&&!i&&Object.keys(n).forEach(e=>{t&&(e===`async`||e===`defer`?t[e]=n[e]:t.getAttribute(e)||t.setAttribute(e,n[e]))})}let o=null,s=typeof window<`u`?t=>{if(t.filename&&se(t.filename,e.url)){let n=Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`);n.name=`ScriptExecutionError`,o=n}}:null;s&&window.addEventListener(`error`,s);let c=async(n,r)=>{clearTimeout(i),s&&window.removeEventListener(`error`,s);let a=()=>{if(r?.type===`error`){let t=Error(r?.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.)`);t.name=`ScriptNetworkError`,e?.onErrorCallback&&e?.onErrorCallback(t)}else o?e?.onErrorCallback&&e?.onErrorCallback(o):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,oe(()=>{let{needDeleteScript:n=!0}=e;n&&t?.parentNode&&t.parentNode.removeChild(t)}),n&&typeof n==`function`)){let e=n(r);if(e instanceof Promise){let t=await e;return a(),t}return a(),e}a()};return t.onerror=c.bind(null,t.onerror),t.onload=c.bind(null,t.onload),i=setTimeout(()=>{c(null,{type:`error`,isTimeout:!0})},r),{script:t,needAttach:n}}function le(e){let t=null,n=!0,r=2e4,i,a=document.getElementsByTagName(`link`);for(let r=0;r<a.length;r++){let i=a[r],o=i.getAttribute(`href`),s=i.getAttribute(`rel`);if(o&&se(o,e.url)&&s===e.attrs.rel){t=i,n=!1;break}}if(!t){t=document.createElement(`link`),t.setAttribute(`href`,e.url);let n,i=!0,a=e.attrs;e.createLinkHook&&(n=e.createLinkHook(e.url,a),n instanceof HTMLLinkElement?(t=n,i=!1):typeof n==`object`&&(`link`in n&&n.link&&(t=n.link,i=!1),`timeout`in n&&n.timeout&&(r=n.timeout))),a&&i&&Object.keys(a).forEach(e=>{t&&!t.getAttribute(e)&&t.setAttribute(e,a[e])})}if(!n)return Promise.resolve().then(()=>{e?.cb&&e?.cb()}),{link:t,needAttach:n};let o=(n,r)=>{i&&clearTimeout(i);let a=()=>{if(r?.type===`error`){let t=Error(r?.isTimeout?`LinkNetworkError: Link "${e.url}" timed out.`:`LinkNetworkError: Failed to load link "${e.url}" - the URL is unreachable or the server returned an error.`);t.name=`LinkNetworkError`,e?.onErrorCallback&&e?.onErrorCallback(t)}else e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,oe(()=>{let{needDeleteLink:n=!0}=e;n&&t?.parentNode&&t.parentNode.removeChild(t)}),n)){let e=n(r);return a(),e}a()};return t.onerror=o.bind(null,t.onerror),t.onload=o.bind(null,t.onload),i=setTimeout(()=>{o(null,{type:`error`,isTimeout:!0})},r),{link:t,needAttach:n}}function ue(e,t){let{attrs:n={},createScriptHook:r}=t;return new Promise((t,i)=>{let{script:a,needAttach:o}=ce({url:e,cb:t,onErrorCallback:i,attrs:{fetchpriority:`high`,...n},createScriptHook:r,needDeleteScript:!0});o&&document.head.appendChild(a)})}var de=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split(`-`)[0].toLowerCase()}#${e.toLowerCase()}`,fe=(e,t,n,r)=>{let i=[`${[t[e]]} #${e}`];return n&&i.push(`args: ${JSON.stringify(n)}`),i.push(de(e)),r&&i.push(`Original Error Message:\n ${r}`),i.join(`
|
|
4
|
+
`)};function pe(e,t,n,r,i,a){return r(fe(e,t,n,i))}var _=`[ Federation Runtime ]`,me=ie(_);function v(e,t,n,r,i){e||(n===void 0?y(t):y(t,n,r,void 0,i))}function y(e,t,n,r,i){if(t!==void 0)return pe(e,t,n??{},e=>{throw Error(`${_}: ${e}`)},r,i);let a=e;throw a instanceof Error?(a.message.startsWith(_)||(a.message=`${_}: ${a.message}`),a):Error(`${_}: ${a}`)}function b(e){e instanceof Error&&(e.message.startsWith(_)||(e.message=`${_}: ${e.message}`)),me.warn(e)}function he(e,t){return e.findIndex(e=>e===t)===-1&&e.push(t),e}function x(e){return`version`in e&&e.version?`${e.name}:${e.version}`:`entry`in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function ge(e){return e.entry!==void 0}function _e(e){return!e.entry.includes(`.json`)}function ve(e){return e&&typeof e==`object`}var ye=Object.prototype.toString;function be(e){return ye.call(e)===`[object Object]`}function xe(e){return Array.isArray(e)?e:[e]}function Se(e){return`remoteEntry`in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:{url:``,type:`global`,globalName:``}}var Ce=(e,t)=>{let n;return n=e.endsWith(`/`)?e.slice(0,-1):e,t.startsWith(`.`)&&(t=t.slice(1)),n+=t,n},we=2e3,S=typeof globalThis==`object`?globalThis:window,C=(()=>{try{return document.defaultView}catch{return S}})(),Te=C;function Ee(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!1,writable:!0})}function De(e,t){return Object.hasOwnProperty.call(e,t)}De(S,`__GLOBAL_LOADING_REMOTE_ENTRY__`)||Ee(S,`__GLOBAL_LOADING_REMOTE_ENTRY__`,{});var w=S.__GLOBAL_LOADING_REMOTE_ENTRY__;function Oe(e){De(e,`__VMOK__`)&&!De(e,`__FEDERATION__`)&&Ee(e,`__FEDERATION__`,e.__VMOK__),De(e,`__FEDERATION__`)||(Ee(e,`__FEDERATION__`,{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map,__PRELOADED_ASSETS__:new Set}),Ee(e,`__VMOK__`,e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map,e.__FEDERATION__.__PRELOADED_ASSETS__??=new Set}Oe(S),Oe(C);function ke(e){S.__FEDERATION__.__INSTANCES__.push(e)}function Ae(){return S.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function je(e,t=o()){t&&(S.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,S.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__=`2.9.3`)}function T(e,t){if(typeof t==`string`){if(e[t])return{value:e[t],key:t};{let n=Object.keys(e);for(let r of n){let[n,i]=r.split(`:`),a=`${n}:${t}`,o=e[a];if(o)return{value:o,key:a}}return{value:void 0,key:t}}}y(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}var Me=()=>C.__FEDERATION__.moduleInfo,Ne=(e,t)=>{let n=T(t,x(e)).value;if(n&&!n.version&&`version`in e&&e.version&&(n.version=e.version),n)return n;if(`version`in e&&e.version){let{version:t,...n}=e,r=x(n),i=T(C.__FEDERATION__.moduleInfo,r).value;if(i?.version===t)return i}},E=e=>Ne(e,C.__FEDERATION__.moduleInfo),Pe=(e,t)=>{let n=x(e);return C.__FEDERATION__.moduleInfo[n]=t,C.__FEDERATION__.moduleInfo},Fe=e=>(C.__FEDERATION__.moduleInfo={...C.__FEDERATION__.moduleInfo,...e},()=>{let t=Object.keys(e);for(let e of t)delete C.__FEDERATION__.moduleInfo[e]}),Ie=(e,t)=>{let n=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:n,entryExports:S[n]}},Le=()=>C.__FEDERATION__.__GLOBAL_PLUGIN__,Re=e=>S.__FEDERATION__.__PRELOADED_MAP__.get(e),ze=e=>S.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Be=e=>S.__FEDERATION__.__PRELOADED_ASSETS__.has(e),Ve=e=>{let t=S.__FEDERATION__.__PRELOADED_ASSETS__;if(t.add(e),t.size>we){let e=t.values().next().value;e!==void 0&&t.delete(e)}},He=`[0-9A-Za-z-]+`,Ue=`(?:\\+(${He}(?:\\.${He})*))`,D=`0|[1-9]\\d*`,O=`[0-9]+`,We=`\\d*[a-zA-Z-][a-zA-Z0-9-]*`,Ge=`(?:${O}|${We})`,Ke=`(?:-?(${Ge}(?:\\.${Ge})*))`,qe=`(?:${D}|${We})`,Je=`(?:-(${qe}(?:\\.${qe})*))`,Ye=`${D}|x|X|\\*`,k=`[v=\\s]*(${Ye})(?:\\.(${Ye})(?:\\.(${Ye})(?:${Je})?${Ue}?)?)?`,Xe=`^\\s*(${k})\\s+-\\s+(${k})\\s*$`,Ze=`[v=\\s]*${`(${O})\\.(${O})\\.(${O})`}${Ke}?${Ue}?`,Qe=`((?:<|>)?=?)`,$e=`(\\s*)${Qe}\\s*(${Ze}|${k})`,et=`(?:~>?)`,tt=`(\\s*)${et}\\s+`,nt=`(?:\\^)`,rt=`(\\s*)${nt}\\s+`,it=`(<|>)?=?\\s*\\*`,at=`^${nt}${k}$`,ot=`v?${`(${D})\\.(${D})\\.(${D})`}${Je}?${Ue}?`,st=`^${et}${k}$`,ct=`^${Qe}\\s*${k}$`,lt=`^${Qe}\\s*(${ot})$|^$`,ut=`^\\s*>=\\s*0.0.0\\s*$`;function A(e){return new RegExp(e)}function j(e){return!e||e.toLowerCase()===`x`||e===`*`}function dt(...e){return t=>e.reduce((e,t)=>t(e),t)}function ft(e){return e.match(A(lt))}function pt(e,t,n,r){let i=`${e}.${t}.${n}`;return r?`${i}-${r}`:i}function mt(e){return e.replace(A(Xe),(e,t,n,r,i,a,o,s,c,l,u,d)=>(t=j(n)?``:j(r)?`>=${n}.0.0`:j(i)?`>=${n}.${r}.0`:`>=${t}`,s=j(c)?``:j(l)?`<${Number(c)+1}.0.0-0`:j(u)?`<${c}.${Number(l)+1}.0-0`:d?`<=${c}.${l}.${u}-${d}`:`<=${s}`,`${t} ${s}`.trim()))}function ht(e){return e.replace(A($e),`$1$2$3`)}function gt(e){return e.replace(A(tt),`$1~`)}function _t(e){return e.replace(A(rt),`$1^`)}function vt(e){return e.trim().split(/\s+/).map(e=>e.replace(A(at),(e,t,n,r,i)=>j(t)?``:j(n)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:j(r)?t===`0`?`>=${t}.${n}.0 <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.0 <${Number(t)+1}.0.0-0`:i?t===`0`?n===`0`?`>=${t}.${n}.${r}-${i} <${t}.${n}.${Number(r)+1}-0`:`>=${t}.${n}.${r}-${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r}-${i} <${Number(t)+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${r} <${t}.${n}.${Number(r)+1}-0`:`>=${t}.${n}.${r} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r} <${Number(t)+1}.0.0-0`)).join(` `)}function yt(e){return e.trim().split(/\s+/).map(e=>e.replace(A(st),(e,t,n,r,i)=>j(t)?``:j(n)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:j(r)?`>=${t}.${n}.0 <${t}.${Number(n)+1}.0-0`:i?`>=${t}.${n}.${r}-${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r} <${t}.${Number(n)+1}.0-0`)).join(` `)}function bt(e){return e.split(/\s+/).map(e=>e.trim().replace(A(ct),(e,t,n,r,i,a)=>{let o=j(n),s=o||j(r),c=s||j(i);return t===`=`&&c&&(t=``),a=``,o?t===`>`||t===`<`?`<0.0.0-0`:`*`:t&&c?(s&&(r=0),i=0,t===`>`?(t=`>=`,s?(n=Number(n)+1,r=0,i=0):(r=Number(r)+1,i=0)):t===`<=`&&(t=`<`,s?n=Number(n)+1:r=Number(r)+1),t===`<`&&(a=`-0`),`${t+n}.${r}.${i}${a}`):s?`>=${n}.0.0${a} <${Number(n)+1}.0.0-0`:c?`>=${n}.${r}.0${a} <${n}.${Number(r)+1}.0-0`:e})).join(` `)}function xt(e){return e.trim().replace(A(it),``)}function St(e){return e.trim().replace(A(ut),``)}function M(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Ct(e,t){let{preRelease:n}=e,{preRelease:r}=t;if(n===void 0&&r)return 1;if(n&&r===void 0)return-1;if(n===void 0&&r===void 0)return 0;for(let e=0,t=n.length;e<=t;e++){let t=n[e],i=r[e];if(t!==i)return t===void 0&&i===void 0?0:t?i?M(t,i):-1:1}return 0}function wt(e,t){return M(e.major,t.major)||M(e.minor,t.minor)||M(e.patch,t.patch)||Ct(e,t)}function Tt(e,t){return e.version===t.version}function Et(e,t){switch(e.operator){case``:case`=`:return Tt(e,t);case`>`:return wt(e,t)<0;case`>=`:return Tt(e,t)||wt(e,t)<0;case`<`:return wt(e,t)>0;case`<=`:return Tt(e,t)||wt(e,t)>0;case void 0:return!0;default:return!1}}function Dt(e){return dt(vt,yt,bt,xt)(e)}function Ot(e){return dt(mt,ht,gt,_t)(e.trim()).split(/\s+/).join(` `)}function N(e,t){if(!e)return!1;let n=ft(e);if(!n)return!1;let[,r,,i,a,o,s]=n,c={operator:r,version:pt(i,a,o,s),major:i,minor:a,patch:o,preRelease:s?.split(`.`)},l=t.split(`||`);for(let e of l){let t=e.trim();if(!t||t===`*`||t===`x`)return!0;try{let e=Ot(t);if(!e.trim())return!0;let n=e.split(` `).map(e=>Dt(e)).join(` `);if(!n.trim())return!0;let r=n.split(/\s+/).map(e=>St(e)).filter(Boolean);if(r.length===0)continue;let i=!0;for(let e of r){let t=ft(e);if(!t){i=!1;break}let[,n,,r,a,o,s]=t;if(!Et({operator:n,version:pt(r,a,o,s),major:r,minor:a,patch:o,preRelease:s?.split(`.`)},c)){i=!1;break}}if(i)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}var kt=`default`,At=`global`;function jt(e,t,r,i){let a;return a=`get`in e?e.get:`lib`in e?()=>Promise.resolve(e.lib):()=>Promise.resolve(()=>{y(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),e.shareConfig?.eager&&e.treeShaking?.mode&&y(`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:a,loaded: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??i)||`version-first`,treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??`server-calc`,status:e.treeShaking.status??n.UNKNOWN,useIn:[]}:void 0}}function Mt(e,t){let n=t.shared||{},r=t.name,i=Object.keys(n).reduce((e,i)=>{let a=xe(n[i]);return e[i]=e[i]||[],a.forEach(n=>{e[i].push(jt(n,r,i,t.shareStrategy))}),e},{}),a={...e.shared};return Object.keys(i).forEach(e=>{a[e]?i[e].forEach(t=>{a[e].find(e=>e.version===t.version)||a[e].push(t)}):a[e]=i[e]}),{allShareInfos:a,newShareInfos:i}}function P(e,t){if(!e)return!1;let{status:r,mode:i}=e;return r===n.NO_USE?!1:r===n.CALCULATED?!0:i===`runtime-infer`?!t||Pt(e,t):!1}function F(e,t){let n=e=>{if(!Number.isNaN(Number(e))){let t=e.split(`.`),n=e;for(let e=0;e<3-t.length;e++)n+=`.0`;return n}return e};return!!N(n(e),`<=${n(t)}`)}var I=(e,t)=>{let n=t||function(e,t){return F(e,t)};return Object.keys(e).reduce((e,t)=>!e||n(e,t)||e===`0`?t:e,0)},L=e=>!!e.loaded||typeof e.lib==`function`,Nt=e=>!!e.loading,Pt=(e,t)=>{if(!e||!t)return!1;let{usedExports:n}=e;return n?!!t.every(e=>n.includes(e)):!1};function Ft(e,t,n,r){let i=e[t][n],a=``,o=P(r),s=function(e,t){return o?i[e].treeShaking?i[t].treeShaking?!L(i[e].treeShaking)&&F(e,t):!1:!0:!L(i[e])&&F(e,t)};if(o){if(a=I(e[t][n],s),a)return{version:a,useTreesShaking:o};o=!1}return{version:I(e[t][n],s),useTreesShaking:o}}var R=e=>L(e)||Nt(e);function It(e,t,n,r){let i=e[t][n],a=``,o=P(r),s=function(e,t){if(o){if(!i[e].treeShaking)return!0;if(!i[t].treeShaking)return!1;if(R(i[t].treeShaking))return!R(i[e].treeShaking)||!!F(e,t);if(R(i[e].treeShaking))return!1}return R(i[t])?!R(i[e])||!!F(e,t):!R(i[e])&&F(e,t)};if(o){if(a=I(e[t][n],s),a)return{version:a,useTreesShaking:o};o=!1}return{version:I(e[t][n],s),useTreesShaking:o}}function Lt(e){return e===`loaded-first`?It:Ft}function z(e,t,n,r,i){if(!e)return;let{shareConfig:a,scope:o=kt,strategy:s,treeShaking:c}=n,l=Array.isArray(o)?o:[o];for(let o of l)if(a&&e[o]&&e[o][t]){let{requiredVersion:l}=a,{version:u,useTreesShaking:d}=Lt(s)(e,o,t,c),f={shareScopeMap:e,scope:o,pkgName:t,version:u,GlobalFederation:Te.__FEDERATION__,shareInfo:n,resolver:()=>{let r=e[o][t][u];if(a.singleton){if(typeof l==`string`&&!N(u,l)){let e=`Version ${u} from ${u&&r.from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${l})`;a.strictVersion?y(e):b(e)}return{shared:r,useTreesShaking:d}}{if(l===!1||l===`*`||N(u,l))return{shared:r,useTreesShaking:d};let n=P(c);if(n){for(let[r,i]of Object.entries(e[o][t]))if(P(i.treeShaking,c?.usedExports)&&N(r,l))return{shared:i,useTreesShaking:n}}for(let[n,r]of Object.entries(e[o][t]))if(N(n,l))return{shared:r,useTreesShaking:!1}}},loadContext:i};return(r.emit(f)||f).resolver()}}function Rt(){return Te.__FEDERATION__.__SHARE__}function zt(e){let{pkgName:t,extraOptions:n,shareInfos:r}=e,i=n?.resolver??(e=>{if(!e)return;let t={};return e.forEach(e=>{t[e.version]=e}),t[I(t,function(e,n){return!L(t[e])&&F(e,n)})]}),a=e=>typeof e==`object`&&!!e&&!Array.isArray(e),o=(...e)=>{let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n)){let n=t[e];a(n)&&a(r)?t[e]=o(n,r):r!==void 0&&(t[e]=r)}return t};return o(i(r[t]),n?.customShareInfo)}var B=(e,t)=>{e.useIn||=[],he(e.useIn,t)};function V(e,t){return t&&e.treeShaking?e.treeShaking:e}function Bt(e,t){return!t||t===`.`?e:`${e}/${t.replace(/^\.\//,``)}`}function Vt(e,t){for(let n of e){let e=t.startsWith(n.name),r=t.replace(n.name,``);if(e){if(r.startsWith(`/`)){let e=n.name;return r=`.${r}`,{pkgNameOrAlias:e,expose:r,remote:n}}if(r===``)return{pkgNameOrAlias:n.name,expose:`.`,remote:n}}let i=n.alias&&t.startsWith(n.alias),a=n.alias&&t.replace(n.alias,``);if(n.alias&&i){if(a&&a.startsWith(`/`)){let e=n.alias;return a=`.${a}`,{pkgNameOrAlias:e,expose:a,remote:n}}if(a===``)return{pkgNameOrAlias:n.alias,expose:`.`,remote:n}}}}function Ht(e,t){for(let n of e)if(t===n.name||n.alias&&t===n.alias)return n}var Ut=`RUNTIME-001`,Wt=`RUNTIME-002`,Gt=`RUNTIME-003`,Kt=`RUNTIME-004`,qt=`RUNTIME-005`,Jt=`RUNTIME-006`,Yt=`RUNTIME-007`,Xt=`RUNTIME-008`,Zt=`RUNTIME-009`,Qt=`RUNTIME-010`,$t=`RUNTIME-011`,en=`RUNTIME-012`,tn=`RUNTIME-013`,nn=`RUNTIME-014`,rn=`RUNTIME-015`,an=`TYPE-001`,on=`BUILD-001`,sn=`BUILD-002`,H={[Ut]:`Failed to get remoteEntry exports.`,[Wt]:`The remote entry interface does not contain "init"`,[Gt]:`Failed to get manifest.`,[Kt]:`Failed to locate remote.`,[qt]:`Invalid loadShareSync function call from bundler runtime`,[Jt]:`Invalid loadShareSync function call from runtime`,[Yt]:`Failed to get remote snapshot.`,[Xt]:`Failed to load script resources.`,[Zt]:`Please call createInstance first.`,[Qt]:`The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.`,[$t]:`The remoteEntry URL is missing from the remote snapshot.`,[en]:`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.`,[tn]:`The manifest is not a valid Module Federation manifest.`,[nn]:`The remote does not expose the requested module.`,[rn]:`Remote container initialization failed.`},cn={[an]:`Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.`},ln={[on]:`Failed to find expose module.`,[sn]:`PublicPath is required in prod mode.`};({...H,...cn,...ln});var un=`.then(callbacks[0]).catch(callbacks[1])`,dn=new WeakMap,fn=[`Failed to fetch dynamically imported module`,`Importing a module script failed`,`error loading dynamically imported module`];function pn(e){return e instanceof TypeError&&fn.some(t=>e.message.includes(t))}function mn(e){return e===`esm`||e===`module`}async function hn({entry:e,remoteEntryExports:t,name:n,getEntryUrl:r}){return new Promise((i,a)=>{let o=e=>{if(pn(e)){let t=e instanceof Error?e.message:String(e);try{y(Xt,H,{remoteName:n,resourceUrl:s},t)}catch(e){a(e);return}}a(e)},s=r?r(e):e;try{t?i(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<`u`?Function(`callbacks`,`import("${s}")${un}`)([i,o]):import(s).then(i).catch(o)}catch(e){y(`Failed to load ESM entry from "${s}". ${e instanceof Error?e.message:String(e)}`)}})}async function gn({entry:e,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof __system_context__>`u`?System.import(e).then(n).catch(r):Function(`callbacks`,`System.import("${e}")${un}`)([n,r])}catch(t){y(`Failed to load SystemJS entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}function _n(e,t,n){let{remoteEntryKey:r,entryExports:i}=Ie(e,t);return i||y(Ut,H,{remoteName:e,remoteEntryUrl:n,remoteEntryKey:r}),i}async function vn({name:e,globalName:t,entry:n,remoteInfo:r,loaderHook:i,getEntryUrl:a,resourceContext:o}){let{entryExports:s}=Ie(e,t);if(s)return s;let c=a?a(n):n;return ue(c,{attrs:{},createScriptHook:(e,t)=>{let n=i.lifecycle.createScript.emit({url:e,attrs:t,remoteInfo:r,resourceContext:o?{...o,url:e}:void 0});if(n&&(n instanceof HTMLScriptElement||`script`in n||`timeout`in n))return n}}).then(()=>_n(e,t,n),t=>{let n=t instanceof Error?t.message:String(t);y(Xt,H,{remoteName:e,resourceUrl:c},n)})}async function yn({remoteInfo:e,remoteEntryExports:t,loaderHook:n,getEntryUrl:r,resourceContext:i}){let{entry:a,entryGlobalName:o,name:s,type:c}=e;return mn(c)?hn({entry:a,remoteEntryExports:t,name:s,getEntryUrl:r}):c===`system`?gn({entry:a,remoteEntryExports:t}):vn({entry:a,globalName:o,name:s,remoteInfo:e,loaderHook:n,getEntryUrl:r,resourceContext:i})}function bn(e){let{entry:t,name:n}=e;return c(n,t)}async function xn(e){let{origin:t,remoteEntryExports:n,remoteInfo:r,getEntryUrl:i,resourceContext:a,_inErrorHandling:o=!1}=e,s=bn(r);if(n)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:n,resourceContext:a,cached:!0}),n;if(!w[s]){let e=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook,l=e.emit({origin:t,loaderHook:c,remoteInfo:r,remoteEntryExports:n,resourceContext:a}).then(e=>e||yn({remoteInfo:r,remoteEntryExports:n,loaderHook:c,getEntryUrl:i,resourceContext:a})).then(async e=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:e,resourceContext:a}),e)).catch(async e=>{let i=e instanceof Error&&e.message.includes(`ScriptExecutionError`);if(e instanceof Error&&e.message.includes(`RUNTIME-008`)&&!i&&!o){let i=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e=>xn({...e,_inErrorHandling:!0}),origin:t,remoteInfo:r,remoteEntryExports:n,globalLoading:w,uniqueKey:s});if(i)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:i,resourceContext:a,error:e,recovered:!0}),i}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,resourceContext:a,error:e}),e});w[s]=l,l.then(void 0,()=>{w[s]===l&&delete w[s]}),dn.set(l,t)}let c=w[s];if(dn.get(c)!==t)try{let e=await c;return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:e,resourceContext:a}),e}catch(e){throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,resourceContext:a,error:e}),e}return c}function U(e){return{...e,entry:`entry`in e?e.entry:``,type:e.type||`global`,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||`default`}}function Sn(){return typeof FEDERATION_BUILD_IDENTIFIER<`u`?FEDERATION_BUILD_IDENTIFIER:``}function Cn(e){let t=new Map;return[...e||[],...Le()].forEach(e=>{e&&(v(be(e),`Plugin configuration is invalid.`),v(e.name,`A name must be provided by the plugin.`),t.has(e.name)||t.set(e.name,e))}),Array.from(t.values())}function wn(e,t){return t===void 0?e:{...t,name:e.name,version:e.version}}function Tn(e,t){let n=new Map;t.options.plugins.forEach(e=>{e&&n.set(e.name,e)});let r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return Cn(e).forEach(e=>{if(n.set(e.name,e),t.hooks.registerPlugins[e.name])return;let i=wn(e,e.apply?.(t));r.forEach(e=>{e.applyPlugin(i)})}),Array.from(n.values())}function En(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 W(e){let t={};for(let[n,r]of Object.entries(e.shared)){let e=r[0];e&&(t[n]={version:e.version,singleton:e.shareConfig?.singleton,requiredVersion:e.shareConfig?.requiredVersion!==!1&&e.shareConfig?.requiredVersion,eager:e.eager,strictVersion:e.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?`host`:`unknown`},mfConfig:{name:e.name,remotes:e.remotes?.map(En)??[],shared:t}}}function Dn(e){return{resourceCategory:`sync`,share:!0,depsRemote:!0,recordPreloadedAssets:!0,...e}}function On(e,t){return t.map(t=>{let n=Ht(e,t.nameOrAlias);return v(n,`Unable to preload ${t.nameOrAlias} as it is not included in ${!n&&d({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:Dn(t)}})}function kn(e){return e?e.map(e=>e===`.`?e:e.startsWith(`./`)?e.replace(`./`,``):e):[]}function An(e){return e instanceof Error?e.message.includes(`timed out`)||e.name.includes(`Timeout`):!1}function G(e,t,n,r){return{url:t,status:n,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:r}}function jn(e,t,n,r){return n?Be(t)?Promise.resolve(G(e,t,`cached`)):(Ve(t),r()):r()}async function Mn(e,t,n,r){let i=e.moduleCache.get(n.name),a=n.entry;if(i?.remoteEntryExports)return G(r,a,`cached`);try{if(!await xn({origin:e,remoteInfo:n,remoteEntryExports:i?.remoteEntryExports,resourceContext:{...r,url:a}}))throw Error(`Failed to load remoteEntry "${a}".`);return G(r,a,`success`)}catch(e){return G(r,a,An(e)?`timeout`:`error`,e)}}function K({host:e,remoteInfo:t,url:n,attrs:r,context:i,needDeleteLink:a}){return new Promise(o=>{let{link:s,needAttach:c}=le({url:n,cb:()=>{o(G(i,n,c?`success`:`cached`))},onErrorCallback:e=>{o(G(i,n,An(e)?`timeout`:`error`,e))},attrs:r,createLinkHook:(n,r)=>{let a=e.loaderHook.lifecycle.createLink.emit({url:n,attrs:r,remoteInfo:t,resourceContext:{...i,url:n}});return a instanceof HTMLLinkElement,a},needDeleteLink:a});c&&document.head.appendChild(s)})}function Nn({host:e,remoteInfo:t,url:n,attrs:r,context:i}){return new Promise(a=>{let{script:o,needAttach:s}=ce({url:n,cb:()=>{a(G(i,n,s?`success`:`cached`))},onErrorCallback:e=>{a(G(i,n,An(e)?`timeout`:`error`,e))},attrs:r,createScriptHook:(n,r)=>{let a=e.loaderHook.lifecycle.createScript.emit({url:n,attrs:r,remoteInfo:t,resourceContext:{...i,url:n}});return a instanceof HTMLScriptElement,a},needDeleteScript:!0});s&&document.head.appendChild(o)})}function q(e,t){return{...e,resourceType:t}}function Pn(e,t,n,r=!0,i={initiator:`preloadRemote`,id:e.name},a=!0){let{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:c}=n,l=[];if(t.options.inBrowser){if(c.forEach(n=>{let{moduleInfo:r}=n;l.push(Mn(t,e,r,q(i,`remoteEntry`)))}),r){let n={rel:`preload`,as:`style`};o.forEach(r=>{let o=q(i,`css`);l.push(jn(o,r,a,()=>K({host:t,remoteInfo:e,url:r,attrs:n,context:o})))})}else{let n={rel:`stylesheet`,type:`text/css`};o.forEach(r=>{let o=q(i,`css`);l.push(jn(o,r,a,()=>K({host:t,remoteInfo:e,url:r,attrs:n,needDeleteLink:!1,context:o})))})}let n=Nn,u={fetchpriority:`high`,type:`text/javascript`};r?(n=K,u={rel:`preload`,as:`script`}):mn(e.type)&&(n=K,u={rel:`modulepreload`,fetchpriority:`high`}),s.forEach(r=>{let o=q(i,`js`);l.push(jn(o,r,a,()=>n({host:t,remoteInfo:e,url:r,attrs:u,context:o})))})}return Promise.all(l)}function Fn(e){if(!e||!(`modules`in e)||!Array.isArray(e.modules))return;let t=e.modules.map(e=>e.moduleName).filter(Boolean);return t.length?t.join(`,`):void 0}function In(e,t,n){let r=t,i=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];i.length||i.push(`default`),i.forEach(e=>{r[e]||(r[e]={})});let a={version:e.version||``,shareScopeKeys:Array.isArray(e.shareScope)?i:e.shareScope||`default`};return Object.defineProperty(a,"shareScopeMap",{value:r,enumerable:!1}),{remoteEntryInitOptions:a,shareScope:r[i[0]],initScope:n??[]}}var Ln=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e,t){let n=t||{initiator:`loadRemote`,id:Bt(this.remoteInfo.name,e),resourceType:`remoteEntry`,url:this.remoteInfo.entry,expose:e},r=await xn({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:n});return v(r,`remoteEntryExports is undefined \n ${d(this.remoteInfo)}`),this.remoteEntryExports=r,this.remoteEntryExports}async init(e,t,n,r,i){let a=await this.getEntry(r,i);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,cached:!0,origin:this.host}),a;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,cached:!0,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,error:n,cached:!0,origin:this.host}),n}return a}this.initing=!0,this.initPromise=(async()=>{await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});let{remoteEntryInitOptions:r,shareScope:i,initScope:o}=In(this.remoteInfo,this.host.shareScopeMap,n),s=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:i,remoteEntryInitOptions:r,initScope:o,remoteInfo:this.remoteInfo,origin:this.host});a?.init===void 0&&y(Wt,H,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,W(this.host.options));try{await a.init(s.shareScope,s.initScope,s.remoteEntryInitOptions)}catch(e){y(rn,H,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${e}`,W(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...s,id:e,remoteSnapshot:t,remoteEntryExports:a}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,error:n,origin:this.host}),n}finally{this.initing=!1,this.initPromise=void 0}return a}async get(e,t,n,r){let{loadFactory:i=!0}=n||{loadFactory:!0},a=await this.init(e,r,void 0,t);this.lib=a,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:a,origin:this.host});let o;try{let n=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:t,moduleInfo:this.remoteInfo});o=typeof n==`function`?n:void 0,o||=await a.get(t),o||y(nn,H,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:Fn(r)},void 0,W(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:a,moduleFactory:o,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:a,error:n,origin:this.host}),n}let s=Ce(this.remoteInfo.name,t),c=this.wraperFactory(o,s);if(!i)return c;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:i,origin:this.host});try{let n=await c();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:i,exposeModule:n,origin:this.host}),n}catch(n){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:i,error:n,origin:this.host}),n}}wraperFactory(e,t){function n(e,t){e&&typeof e==`object`&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for(`mf_module_id`))&&Object.defineProperty(e,Symbol.for(`mf_module_id`),{value:t,enumerable:!1})}return()=>{let r=e();return r instanceof Promise?r.then(e=>(n(e,t),e)):(n(r,t),r)}}},J=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e){v(be(e),`Plugin configuration is invalid.`);let t=e.name;v(t,`A name must be provided by the plugin.`),this.registerPlugins[t]||(this.registerPlugins[t]=e,this.lifecycleKeys.forEach(t=>{let n=e[t];n&&this.lifecycle[t].on(n)}))}removePlugin(e){v(e,`A name is required.`);let t=this.registerPlugins[e];v(t,`The plugin "${e}" is not registered.`),this.lifecycleKeys.forEach(e=>{let n=t[e];n&&this.lifecycle[e].remove(n)}),delete this.registerPlugins[e]}},Y=class{constructor(e){this.type=``,this.listeners=new Set,e&&(this.type=e)}on(e){typeof e==`function`&&this.listeners.add(e)}once(e){let t=this;this.on(function n(...r){return t.remove(n),e.apply(null,r)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(n=>{let r=n(...e);r!==void 0&&(t=r)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},X=class extends Y{emit(...e){let t,n=Array.from(this.listeners);if(n.length>0){let r=0,i=t=>t===!1?!1:r<n.length?Promise.resolve(n[r++].apply(null,e)).then(n=>n===void 0||e.length===1&&n===e[0]?i(t):i(n)):t;t=i()}return Promise.resolve(t)}};function Rn(e,t){if(!ve(t))return!1;if(e!==t){for(let n in e)if(!(n in t))return!1}return!0}var Z=class extends Y{constructor(e){super(),this.onerror=y,this.type=e}emit(e){ve(e)||y(`The data for the "${this.type}" hook should be an object.`);for(let t of this.listeners)try{let n=t(e);if(n===void 0)continue;if(Rn(e,n))e=n;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(e){b(e),this.onerror(e)}return e}},Q=class extends Y{constructor(e){super(),this.onerror=y,this.type=e}emit(e){ve(e)||y(`The response data for the "${this.type}" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let n=0,r=t=>(b(t),this.onerror(t),e),i=a=>{if(a!==void 0&&Rn(e,a))e=a;else if(a!==void 0)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(n<t.length)try{return Promise.resolve(t[n++](e)).then(i,r)}catch(e){return r(e)}return e};return Promise.resolve(i(e))}return Promise.resolve(e)}},$=`Remote loading is disabled by experiments.optimization.disableRemote.`,zn=class{constructor(){this.hooks=new J({})}formatAndRegisterRemote(){return[]}loadRemote(){throw Error($)}preloadRemote(){throw Error($)}registerRemotes(){throw Error($)}getRemoteModuleAndOptions(){throw Error($)}initRawContainer(){throw Error($)}};function Bn(e,t){let n=Se(t);n.url||y($t,H,{remoteName:e.name});let r=l(t,n.url);e.type=n.type,e.entryGlobalName=n.globalName,e.entry=r,e.version=t.version,e.buildVersion=t.buildVersion}function Vn(){return{name:`snapshot-plugin`,async afterResolve(e){let{remote:t,pkgNameOrAlias:n,expose:r,origin:i,remoteInfo:a,id:o}=e;if(!ge(t)||!_e(t)){let{remoteSnapshot:s,globalSnapshot:c}=await i.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:Bt(t.name,r)});Bn(a,s);let l=[{nameOrAlias:n,exposes:[r],resourceCategory:`sync`,share:!1,depsRemote:!1,recordPreloadedAssets:!0}];await i.remoteHandler.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:l,options:i.options,origin:i});let[u]=l;if(u){let e={remote:t,preloadConfig:u},n=await i.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:i,preloadOptions:e,remoteInfo:a,remote:t,remoteSnapshot:s,globalSnapshot:c});n&&Pn(a,i,n,!1,{initiator:`loadRemote`,id:o},u.recordPreloadedAssets).catch(()=>void 0)}return{...e,remoteSnapshot:s}}return e}}}function Hn(e){let 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 Un(e,t,n,r,i={},a){let{value:o}=T(e,x(t)),s=a||o;if(s&&!ee(s)&&(n(s,t,r),s.remotesInfo)){let t=Object.keys(s.remotesInfo);for(let r of t){if(i[r])continue;i[r]=!0;let t=Hn(r),a=s.remotesInfo[r];Un(e,{name:t.name,version:a.matchedVersion},n,!1,i,void 0)}}}var Wn=(e,t)=>document.querySelector(`${e}[${e===`link`?`href`:`src`}="${t}"]`);function Gn(e,t,n,r,i){let a=[],o=[],s=[],c=new Set,u=new Set,{options:d}=e,{preloadConfig:f}=t,{depsRemote:p}=f;if(Un(r,n,(t,n,r)=>{let i;if(r)i=f;else if(Array.isArray(p)){let e=p.find(e=>e.nameOrAlias===n.name||e.nameOrAlias===n.alias);if(!e)return;i=Dn(e)}else if(p===!0)i=f;else return;let c=l(t,Se(t).url);c&&s.push({name:n.name,moduleInfo:{name:n.name,entry:c,type:`remoteEntryType`in t?t.remoteEntryType:`global`,entryGlobalName:`globalName`in t?t.globalName:n.name,shareScope:``,version:`version`in t?t.version:void 0},url:c});let u=`modules`in t?t.modules:[],d=kn(i.exposes);d.length&&`modules`in t&&(u=t?.modules?.reduce((e,t)=>(d?.indexOf(t.moduleName)!==-1&&e.push(t),e),[]));function m(e){let n=e.map(e=>l(t,e));return i.filter?n.filter(i.filter):n}if(u){let r=u.length;for(let s=0;s<r;s++){let r=u[s],c=`${n.name}/${r.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:r.moduleName===`.`?n.name:c,name:n.name,remoteSnapshot:t,preloadConfig:i,remote:n,origin:e}),Re(c)||(i.resourceCategory===`all`?(a.push(...m(r.assets.css.async)),a.push(...m(r.assets.css.sync)),o.push(...m(r.assets.js.async)),o.push(...m(r.assets.js.sync))):i.resourceCategory===`sync`&&(a.push(...m(r.assets.css.sync)),o.push(...m(r.assets.js.sync))),ze(c))}}},!0,{},i),i.shared&&i.shared.length>0){let t=(t,n)=>{let{shared:r}=z(e.shareScopeMap,n.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare)||{};r&&typeof r.lib==`function`&&(n.assets.js.sync.forEach(e=>{c.add(e)}),n.assets.css.sync.forEach(e=>{u.add(e)}))};i.shared.forEach(e=>{let n=d.shared?.[e.sharedName];if(!n)return;let r=e.version?n.find(t=>t.version===e.version):n;r&&xe(r).forEach(n=>{t(n,e)})})}let m=o.filter(e=>!c.has(e)&&!Wn(`script`,e));return{cssAssets:a.filter(e=>!u.has(e)&&!Wn(`link`,e)),jsAssetsWithoutEntry:m,entryAssets:s.filter(e=>!Wn(`script`,e.url))}}var Kn=function(){return{name:`generate-preload-assets-plugin`,async generatePreloadAssets(e){let{origin:t,preloadOptions:n,remoteInfo:r,remote:i,globalSnapshot:a,remoteSnapshot:o}=e;return ge(i)&&_e(i)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:i.name,url:i.entry,moduleInfo:{name:r.name,entry:i.entry,type:r.type||`global`,entryGlobalName:``,shareScope:``}}]}:(Bn(r,o),Gn(t,n,r,a,o))}}};function qn(e,t){let n=E({name:t.name,version:t.options.version}),r=n&&`remotesInfo`in n&&n.remotesInfo&&T(n.remotesInfo,e.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:n,globalSnapshot:Me(),remoteSnapshot:E({name:e.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:Me(),remoteSnapshot:E({name:e.name,version:`version`in e?e.version:void 0})}}var Jn=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new J({beforeLoadRemoteSnapshot:new X(`beforeLoadRemoteSnapshot`),loadSnapshot:new Q(`loadGlobalSnapshot`),loadRemoteSnapshot:new Q(`loadRemoteSnapshot`),afterLoadSnapshot:new Q(`afterLoadSnapshot`),beforeLoadManifest:new X(`beforeLoadManifest`),afterLoadManifest:new X(`afterLoadManifest`)}),this.manifestLoading=Te.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:n=`loadRemote`}){let{options:r}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:r,moduleInfo:e,origin:this.HostInstance});let i=E({name:this.HostInstance.options.name,version:this.HostInstance.options.version});i||(i={version:this.HostInstance.options.version||``,remoteEntry:``,remotesInfo:{}},Fe({[this.HostInstance.options.name]:i})),i&&`remotesInfo`in i&&!T(i.remotesInfo,e.name).value&&(`version`in e||`entry`in e)&&(i.remotesInfo={...i?.remotesInfo,[e.name]:{matchedVersion:`version`in e?e.version:e.entry}});let{hostGlobalSnapshot:a,remoteSnapshot:o,globalSnapshot:s}=this.getGlobalRemoteInfo(e),{remoteSnapshot:c,globalSnapshot:l}=await this.hooks.lifecycle.loadSnapshot.emit({options:r,moduleInfo:e,hostGlobalSnapshot:a,remoteSnapshot:o,globalSnapshot:s}),u,d;if(c){if(ee(c)){let r=c.remoteEntry,i=await this.loadManifestSnapshot(r,e,{},{initiator:n,id:t||e.name}),a=Pe({...e,entry:r},i);u=i,d=a}else{let{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:c,from:`global`});u=t,d=l}}else if(ge(e)){let r=await this.loadManifestSnapshot(e.entry,e,{},{initiator:n,id:t||e.name}),i=Pe(e,r);u=r,d=i}else y(Yt,H,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(l)},void 0,W(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:r,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:d}}getGlobalRemoteInfo(e){return qn(e,this.HostInstance)}async getManifestJson(e,t,n,r){return(async()=>{let n=U(t),i=this.manifestCache.get(e);if(i)return await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,manifestJson:i,cached:!0,origin:this.HostInstance}),i;await this.hooks.lifecycle.beforeLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,origin:this.HostInstance});let a,o,s=!1;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{},n,r?{...r,url:e,resourceType:`manifest`}:void 0);t&&t instanceof Response||(t=await fetch(e,{})),a=t,i=await t.json()}catch(c){o=c,i=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:c,from:`runtime`,lifecycle:`afterResolve`,remote:n,origin:this.HostInstance}),i||(delete this.manifestLoading[e],await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,response:a,error:c,origin:this.HostInstance}),y(Gt,H,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${c}`,W(this.HostInstance.options))),s=!0}let c=[!i.metaData&&`metaData`,!i.exposes&&`exposes`,!i.shared&&`shared`].filter(Boolean),l=c.length>0?Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${c.join(`, `)}.`):void 0;return l&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:l,from:`runtime`,lifecycle:`afterResolve`,remote:n,origin:this.HostInstance}),await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,manifestJson:i,response:a,error:l||o,recovered:l?void 0:s||void 0,origin:this.HostInstance}),l&&y(tn,H,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:c.join(`,`)},void 0,W(this.HostInstance.options)),this.manifestCache.set(e,i),i})()}async loadManifestSnapshot(e,t,n,r){let i=async()=>{let i=await this.getManifestJson(e,t,n,r),a=m(i,{version:e}),{remoteSnapshot:o}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:i,remoteSnapshot:a,manifestUrl:e,from:`manifest`});return o};return this.manifestLoading[e]||(this.manifestLoading[e]=i().then(e=>e)),this.manifestLoading[e]}},Yn=class{constructor(){this.hooks=new J({})}},Xn=class{constructor(e){this.hooks=new J({beforeRegisterShare:new Z(`beforeRegisterShare`),afterRegisterShare:new Y(`afterRegisterShare`),afterResolve:new Q(`afterResolve`),beforeLoadShare:new Q(`beforeLoadShare`),loadShare:new X,afterLoadShare:new Y(`afterLoadShare`),errorLoadShare:new Y(`errorLoadShare`),resolveShare:new Z(`resolveShare`),initContainerShareScopeMap:new Z(`initContainerShareScopeMap`)}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterRegisterShare(e,t){this.hooks.lifecycle.afterRegisterShare.emit({pkgName:e,...t,shareScopeMap:this.shareScopeMap,origin:this.host})}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:n,selectedShared:r,loadContext:i}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:n,selectedShared:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,loadContext:i,origin:this.host})}catch(e){b(e)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:n,error:r,recovered:i,loadContext:a}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:n,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:r,recovered:i,loadContext:a})}catch(e){b(e)}}registerShared(e,t){let{newShareInfos:n,allShareInfos:r}=Mt(e,t);return Object.keys(n).forEach(e=>{n[e].forEach(n=>{n.scope.forEach(r=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:e,shared:n});let i=this.shareScopeMap[r]?.[e],a=i?.[n.version];i||this.setShared({pkgName:e,lib:n.lib,get:n.get,loaded:n.loaded||!!n.lib,shared:n,from:t.name}),this.emitAfterRegisterShare(e,{scope:r,shared:n,previousShared:a,registeredShared:this.shareScopeMap[r]?.[e]?.[n.version],trigger:`runtime`})})})}),{newShareInfos:n,allShareInfos:r}}async loadShare(e,t){let{host:n}=this,r=t?.context,i=zt({pkgName:e,extraOptions:t,shareInfos:n.options.shared}),a=i;try{i?.scope&&await Promise.all(i.scope.map(async e=>{await Promise.all(this.initializeSharing(e,{strategy:i.strategy,context:r}))}));let o=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:i,shared:n.options.shared,origin:n,loadContext:r});a=o.shareInfo,r=o.loadContext||r,v(a,`Cannot find shared "${e}" in host "${n.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);let s=a,{shared:c,useTreesShaking:l}=z(this.shareScopeMap,e,a,this.hooks.lifecycle.resolveShare,r)||{};if(c){let t=V(c,l);if(t.lib)return B(t,n.options.name),this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:c,loadContext:r}),t.lib;if(t.loading&&!t.loaded){let i=await t.loading;return t.loaded=!0,t.lib||=i,B(t,n.options.name),this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:c,loadContext:r}),i}{let i=(async()=>{let e=await t.get();return B(t,n.options.name),t.loaded=!0,t.lib=e,e})();this.setShared({pkgName:e,loaded:!1,shared:c,from:n.options.name,lib:null,loading:i,treeShaking:l?t:void 0});let a=await i;return this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:c,loadContext:r}),a}}{if(t?.customShareInfo)return this.emitErrorLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,recovered:!0,loadContext:r}),!1;let i=P(s.treeShaking),a=V(s,i),o=(async()=>{let t=await a.get();a.lib=t,a.loaded=!0,B(a,n.options.name);let{shared:i,useTreesShaking:o}=z(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare,r)||{};if(i){let e=V(i,o);e.lib=t,e.loaded=!0,i.from=s.from}return t})();this.setShared({pkgName:e,loaded:!1,shared:s,from:n.options.name,lib:null,loading:o,treeShaking:i?a:void 0});let c=await o;return this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:s,loadContext:r}),c}}catch(t){throw this.emitErrorLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:a,error:t,loadContext:r}),t}}initializeSharing(e=kt,t){let{host:n}=this,r=t?.from,i=t?.strategy,a=t?.context?.trigger||r||`runtime`,o=t?.initScope,s=[];if(r!==`build`){let{initTokens:t}=this;o||=[];let n=t[e];if(n||=t[e]={from:this.host.name},o.indexOf(n)>=0)return s;o.push(n)}let c=this.shareScopeMap,l=n.options.name;c[e]||(c[e]={});let u=c[e],d=(t,n)=>{let{version:r,eager:i}=n;u[t]=u[t]||{};let o=u[t],s=o[r],c=s&&V(s),d=!!(c&&(`eager`in c&&c.eager||`shareConfig`in c&&c.shareConfig?.eager));(!c||c.strategy!==`loaded-first`&&!c.loaded&&(!i==!d?l>o[r].from:i))&&(o[r]=n),this.emitAfterRegisterShare(t,{scope:e,shared:n,previousShared:s,registeredShared:o[r],trigger:a})},f=async e=>{let{module:t}=await n.remoteHandler.getRemoteModuleAndOptions({id:e}),r,i={initiator:`loadShare`,id:e,resourceType:`remoteEntry`,url:t.remoteInfo.entry};try{r=await t.getEntry(void 0,i)}catch(i){if(r=await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:`runtime`,lifecycle:`beforeLoadShare`,remote:t.remoteInfo,origin:n}),!r)return}finally{r?.init&&!t.initing&&(t.remoteEntryExports=r,await t.init(void 0,void 0,o,void 0,i))}};return Object.keys(n.options.shared).forEach(t=>{n.options.shared[t].forEach(n=>{n.scope.includes(e)&&d(t,n)})}),(n.options.shareStrategy===`version-first`||i===`version-first`)&&n.options.remotes.forEach(t=>{t.shareScope===e&&s.push(f(t.name))}),s}loadShareSync(e,t){let{host:n}=this,r=t?.context,i=zt({pkgName:e,extraOptions:t,shareInfos:n.options.shared});try{i?.scope&&i.scope.forEach(e=>{this.initializeSharing(e,{strategy:i.strategy,from:t?.from,context:r})});let{shared:a}=z(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare,r)||{};if(a){if(typeof a.lib==`function`)return B(a,n.options.name),a.loaded||(a.loaded=!0,a.from===n.options.name&&(i.loaded=!0)),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:a,loadContext:r}),a.lib;if(typeof a.get==`function`){let t=a.get();if(!(t instanceof Promise))return B(a,n.options.name),this.setShared({pkgName:e,loaded:!0,from:n.options.name,lib:t,shared:a}),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:a,loadContext:r}),t}}if(i.lib)return i.loaded||=!0,this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:i,loadContext:r}),i.lib;if(i.get){let a=i.get();return a instanceof Promise&&y(t?.from===`build`?qt:Jt,H,{hostName:n.options.name,sharedPkgName:e},void 0,W(n.options)),i.lib=a,this.setShared({pkgName:e,loaded:!0,from:n.options.name,lib:i.lib,shared:i}),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:i,loadContext:r}),i.lib}y(Jt,H,{hostName:n.options.name,sharedPkgName:e},void 0,W(n.options))}catch(t){throw this.emitErrorLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,error:t,loadContext:r}),t}}initShareScopeMap(e,t,n={}){let{host:r}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:r.options,origin:r,scopeName:e,hostShareScopeMap:n.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:n,lib:r,loading:i,loaded:a,get:o,treeShaking:s}){let{version:c,scope:l=`default`,...u}=t,d=Array.isArray(l)?l:[l],f=e=>{let t=(e,t,n)=>{n&&!e[t]&&(e[t]=n)},n=s?e.treeShaking:e;t(n,`loaded`,a),t(n,`loading`,i),t(n,`get`,o),t(n,`lib`,r)};d.forEach(t=>{this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),this.shareScopeMap[t][e][c]||(this.shareScopeMap[t][e][c]={version:c,scope:[t],...u,lib:r});let i=this.shareScopeMap[t][e][c];f(i),n&&i.from!==n&&(i.from=n)})}_setGlobalShareScopeMap(e){let t=Rt(),n=e.id||e.name;n&&!t[n]&&(t[n]=this.shareScopeMap)}},Zn=class{constructor(){this.shareScopeMap={},this.hooks=new J({afterResolve:new Q(`afterResolve`)})}registerShared(){return{newShareInfos:{},allShareInfos:{}}}loadShare(){throw Error(`Shared dependency loading is disabled by experiments.optimization.disableShared.`)}loadShareSync(){throw Error(`Shared dependency loading is disabled by experiments.optimization.disableShared.`)}initializeSharing(){return[]}initShareScopeMap(e,t){this.shareScopeMap[e]=t}},Qn=class{constructor(e){this.hooks=new J({beforeRegisterRemote:new Z(`beforeRegisterRemote`),registerRemote:new Z(`registerRemote`),beforeRequest:new Q(`beforeRequest`),afterMatchRemote:new X(`afterMatchRemote`),onLoad:new X(`onLoad`),afterLoadRemote:new X(`afterLoadRemote`),handlePreloadModule:new Y(`handlePreloadModule`),errorLoadRemote:new X(`errorLoadRemote`),beforePreloadRemote:new X(`beforePreloadRemote`),generatePreloadAssets:new X(`generatePreloadAssets`),afterPreloadRemote:new X(`afterPreloadRemote`),loadEntry:new X}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((e,t)=>(this.registerRemote(t,e,{force:!1}),e),e.remotes)}setIdToRemoteMap(e,t){let{remote:n,expose:r}=t,{name:i,alias:a}=n;if(this.idToRemoteMap[e]={name:n.name,expose:r},a&&e.startsWith(i)){let t=e.replace(i,a);this.idToRemoteMap[t]={name:n.name,expose:r}}else if(a&&e.startsWith(a)){let t=e.replace(a,i);this.idToRemoteMap[t]={name:n.name,expose:r}}}async loadRemote(e,t){let{host:n}=this,r=Vt(n.options.remotes,e),i=e,a=r?.expose,o=r?U(r.remote):void 0,s;try{let{loadFactory:r=!0}=t||{loadFactory:!0},{module:c,moduleOptions:l,remoteMatchInfo:u}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:d,remote:f,expose:p,id:m,remoteSnapshot:ee}=u;i=m,a=p,o=U(f);let h=await c.get(m,p,t,ee),g=await this.hooks.lifecycle.onLoad.emit({id:m,pkgNameOrAlias:d,expose:p,exposeModule:r?h:void 0,exposeModuleFactory:r?void 0:h,remote:f,options:l,moduleInstance:c,origin:n});return this.setIdToRemoteMap(e,u),s={id:i,expose:a,remote:o,options:t,origin:n},typeof g==`function`?g:h}catch(r){let{from:c=`runtime`}=t||{from:`runtime`},l;try{l=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:r,from:c,lifecycle:`onLoad`,expose:a,remote:o,origin:n})}catch(e){throw s={id:i,expose:a,remote:o,options:t,error:e,origin:n},e}if(!l)throw s={id:i,expose:a,remote:o,options:t,error:r,origin:n},r;return s={id:i,expose:a,remote:o,options:t,error:r,origin:n,recovered:!0},l}finally{s&&await this.hooks.lifecycle.afterLoadRemote.emit(s)}}async preloadRemote(e){let{host:t}=this,n=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});let r=On(t.options.remotes,e),i=e=>{let{preloadConfig:t,remote:n}=e,r=t.exposes||[];return r.length?r.map(r=>({ops:{...e,preloadConfig:{...t,exposes:[r]}},id:Bt(n.name,r)})):[{ops:e,id:`${n.name}/*`}]},a;await Promise.all(r.flatMap(i).map(async e=>{let{ops:r,id:i}=e,{remote:a,preloadConfig:o}=r,s=U(a);try{let{globalSnapshot:e,remoteSnapshot:c}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:a,id:i,initiator:`preloadRemote`}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:r,remote:a,remoteInfo:s,globalSnapshot:e,remoteSnapshot:c});if(!l)return;let u=await Pn(s,t,l,!0,{initiator:`preloadRemote`,id:i},o.recordPreloadedAssets);n.push({remote:a,remoteInfo:s,preloadConfig:o,id:i,results:u})}catch(e){n.push({remote:a,remoteInfo:s,preloadConfig:o,id:i,results:[{url:s.entry,status:`error`,resourceType:/\.json(?:$|[?#])/i.test(s.entry)?`manifest`:`remoteEntry`,initiator:`preloadRemote`,id:i,error:e}]})}}));let o=n.flatMap(e=>e.results.filter(e=>e.status===`error`||e.status===`timeout`));if(o.length>0&&(a=Error(`preloadRemote failed to load ${o.length} resource(s).`),Object.assign(a,{results:n,failedResults:o})),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:t.options,origin:t,results:n,error:a}),a)throw a}registerRemotes(e,t){let{host:n}=this;e.forEach(e=>{this.registerRemote(e,n.options.remotes,{force:t?.force})})}initRawContainer(e,t,n){let{host:r}=this,i=new Ln({host:r,remoteInfo:U({name:e,entry:t})});return i.remoteEntryExports=n,r.moduleCache.set(e,i),i}async getRemoteModuleAndOptions(e){let{host:t}=this,{id:n}=e,r;try{r=await this.hooks.lifecycle.beforeRequest.emit({id:n,options:t.options,origin:t})}catch(e){if(r=await this.hooks.lifecycle.errorLoadRemote.emit({id:n,options:t.options,origin:t,from:`runtime`,error:e,lifecycle:`beforeRequest`}),!r)throw e}let{id:i}=r,a=Vt(t.options.remotes,i);if(!a)try{y(Kt,H,{hostName:t.options.name,requestId:i},void 0,W(t.options))}catch(e){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:i,options:t.options,error:e,origin:t}),e}let{remote:o}=a,s=U(o);await this.hooks.lifecycle.afterMatchRemote.emit({id:i,...a,options:t.options,remoteInfo:s,origin:t});let c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:i,...a,options:t.options,origin:t,remoteInfo:s}),{remote:l,expose:u}=c;v(l&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);let d=t.moduleCache.get(l.name),f={host:t,remoteInfo:s};return d||(d=new Ln(f),t.moduleCache.set(l.name,d)),{module:d,moduleOptions:f,remoteMatchInfo:c}}registerRemote(e,t,n){let{host:r}=this,i=()=>{if(e.alias){let n=t.find(t=>e.alias&&(t.name.startsWith(e.alias)||t.alias?.startsWith(e.alias)));v(!n,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${n&&n.name} name or alias`)}`entry`in e&&typeof window<`u`&&!e.entry.startsWith(`http`)&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||=kt,e.type||=At};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:r});let a=t.find(t=>t.name===e.name);if(!a)i(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r});else{let o=[`The remote "${e.name}" is already registered.`,`Please note that overriding it may cause unexpected errors.`];n?.force&&(this.removeRemote(a),i(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r}),u(o.join(` `)))}}removeRemote(e){try{let{host:t}=this,{name:n}=e,r=t.options.remotes.findIndex(e=>e.name===n);r!==-1&&t.options.remotes.splice(r,1);let i=T(S.__FEDERATION__.moduleInfo,x(e)).key;delete S.__FEDERATION__.moduleInfo[i],`entry`in e&&(t.snapshotHandler.manifestCache.delete(e.entry),delete Te.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);let{hostGlobalSnapshot:a}=qn(e,t);if(a){let t=a&&`remotesInfo`in a&&a.remotesInfo&&T(a.remotesInfo,e.name).key;t&&delete a.remotesInfo[t]}let o=t.moduleCache.get(e.name);if(o){let n=o.remoteInfo,r=n.entryGlobalName;S[r]&&(Object.getOwnPropertyDescriptor(S,r)?.configurable?delete S[r]:S[r]=void 0);let i=bn(o.remoteInfo);w[i]&&delete w[i];let a=n.buildVersion?c(n.name,n.buildVersion):n.name,s=S.__FEDERATION__.__INSTANCES__.findIndex(e=>n.buildVersion?e.options.id===a:e.name===a);if(s!==-1){let e=S.__FEDERATION__.__INSTANCES__[s];a=e.options.id||a;let t=Rt(),r=!0,i=[];Object.keys(t).forEach(e=>{let a=t[e];a&&Object.keys(a).forEach(t=>{let o=a[t];o&&Object.keys(o).forEach(a=>{let s=o[a];s&&Object.keys(s).forEach(o=>{let c=s[o];c&&typeof c==`object`&&c.from===n.name&&(c.loaded||c.loading?(c.useIn=c.useIn.filter(e=>e!==n.name),c.useIn.length?r=!1:i.push([e,t,a,o])):i.push([e,t,a,o]))})})})}),r&&(e.shareScopeMap={},delete t[a]),i.forEach(([e,n,r,i])=>{delete t[e]?.[n]?.[r]?.[i]}),S.__FEDERATION__.__INSTANCES__.splice(s,1)}t.moduleCache.delete(e.name)}}catch(e){me.error(`removeRemote failed: ${e instanceof Error?e.message:String(e)}`)}}},$n=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN!=`boolean`||!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN,er=typeof FEDERATION_OPTIMIZE_NO_REMOTE!=`boolean`||!FEDERATION_OPTIMIZE_NO_REMOTE,tr=typeof FEDERATION_OPTIMIZE_NO_SHARED!=`boolean`||!FEDERATION_OPTIMIZE_NO_SHARED,nr=class{constructor(e){this.hooks=new J({beforeInit:new Z(`beforeInit`),init:new Y,beforeInitContainer:new Q(`beforeInitContainer`),initContainer:new Q(`initContainer`)}),this.version=`2.9.3`,this.moduleCache=new Map,this.loaderHook=new J({getModuleInfo:new Y,createScript:new Y,createLink:new Y,fetch:new X,loadEntryError:new X,afterLoadEntry:new X(`afterLoadEntry`),beforeInitRemote:new X(`beforeInitRemote`),afterInitRemote:new X(`afterInitRemote`),beforeGetExpose:new X(`beforeGetExpose`),afterGetExpose:new X(`afterGetExpose`),beforeExecuteFactory:new X(`beforeExecuteFactory`),afterExecuteFactory:new X(`afterExecuteFactory`),getModuleFactory:new X}),this.bridgeHook=new J({beforeBridgeRender:new Y,afterBridgeRender:new Y,beforeBridgeDestroy:new Y,afterBridgeDestroy:new Y,afterBridgeRouteSync:new Y});let t=er&&$n?[Vn(),Kn()]:[],n={id:Sn(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:!0};this.name=e.name,this.options=n,this.snapshotHandler=er?new Jn(this):new Yn,this.sharedHandler=tr?new Xn(this):new Zn,this.remoteHandler=er?new Qn(this):new zn,this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...n.plugins,...e.plugins||[]]),this.options=this.formatOptions(n,e)}initOptions(e){e.name&&e.name!==this.options.name&&y(fe(Qt,H)),this.registerPlugins(e.plugins);let t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=kt,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,n){return this.remoteHandler.initRawContainer(e,t,n)}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,n={}){this.sharedHandler.initShareScopeMap(e,t,n)}formatOptions(e,t){let n=tr?Mt(e,t).allShareInfos:{},{userOptions:r,options:i}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:n}),a=this.remoteHandler.formatAndRegisterRemote(i,r),{allShareInfos:o}=this.sharedHandler.registerShared(i,r),s=[...i.plugins];r.plugins&&r.plugins.forEach(e=>{s.includes(e)||s.push(e)});let c={...e,...t,plugins:s,remotes:a,shared:o,id:r.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:c}),c}registerPlugins(e){this.options.plugins=Tn(e,this)}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};function rr(){return typeof FEDERATION_BUILD_IDENTIFIER<`u`?FEDERATION_BUILD_IDENTIFIER:``}function ir(e,t){let n=rr();return S.__FEDERATION__.__INSTANCES__.find(r=>!!(n&&r.options.id===n||r.options.name===e&&!r.options.version&&!t||r.options.name===e&&t&&r.options.version===t))}function ar(e){let t=new((Ae())||nr)({id:`${e.name}@${e.version||Date.now()}`,...e});return ke(t),t}var or=null;function sr(e){let t=ir(e.name,e.version),n={...e,id:e.id||``};return t?(t.initOptions(n),or||=t,t):(or=ar(n),or)}je(nr);export{sr as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vite-preload-helper-DygEbaNj.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}var r;async function i(){return r||=(async()=>{let t=function(e,t,n,r){let i=(Array.isArray(r)?r[0]:r)||`default`,a=t||!n?e:e+`@`+n,o={canonical:i+`:`+a};return i==="default"&&(o.aliases=[a]),o},r=(e,t)=>{let n=e[t.canonical];if(n!==void 0)return n;let r=t.aliases||[];for(let n of r){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];if(r!==void 0)return e[t.canonical]=r,r}},i=Symbol.for(`module-federation.shared-cache-listeners`),a=Symbol.for(`module-federation.shared-cache-owners`),o=e=>{let t=e[a];return t===void 0&&(t=Object.create(null),Object.defineProperty(e,a,{value:t,enumerable:!1,configurable:!1,writable:!1})),t},s=(e,t)=>e[a]?.[t.canonical],c=e=>{let t=[e,e?.default];for(let e of t)if(e&&typeof e==`object`){for(let t of[`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`,`__TEST_INTERNALS`,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`]){let n=e[t];if(n&&typeof n==`object`)return{internals:n}}if(typeof e.useState==`function`)return{hook:e.useState}}},l=(e,t)=>{if(e===t)return!0;let n=c(e),r=c(t);if(!n||!r)return!1;let i=n.internals,a=r.internals;return i!==void 0||a!==void 0?i!==void 0&&i===a:typeof n.hook==`function`&&n.hook===r.hook},u=(e,t,n,s)=>{let c=r(e,t);if(c!==void 0&&l(c,n))return n;e[t.canonical]=n;let u=t.aliases||[];for(let t of u)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});let d=e[a];s===void 0?d&&delete d[t.canonical]:o(e)[t.canonical]=s;let f=e[i]?.[t.canonical];if(f)for(let e of f)e(n);return n},d=await(await e(()=>import(`../remoteEntry.js`),[])).init(),{usedShared:f}=await e(async()=>{let{usedShared:e}=await import(`./_virtual_mf-localSharedImportMap___mfe_internal__signalk_multihelm__mf_owner__1-GfsGDlYi.js`);return{usedShared:e}},[]),p=e=>{let t=e;for(let e=0;e<5;e++){let e=t?.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype)break;let r=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(r.length>0&&r.some(e=>e!==void 0))break;t=e}return t},m=(e,t)=>__mfGetShareScopeNames(t).some(n=>Object.keys(d.shareScopeMap?.[n]?.[e]||{}).some(e=>e!==t.version)),h=[];{let e=new Set(h.flat()),t=Object.keys(f).filter(t=>!e.has(t));t.length&&h.push(t)}let g=n.pinnedShareOwners||=new Set,_=n.hostShareInit,v;n.hostShareInit=new Promise(e=>{v=e}),await _;try{for(let e of h)await Promise.all(e.map(async e=>{let i=f[e];if(!i||i.materialize===!1&&!i.lazy||i.treeShaking)return;let a=t(e,i.shareConfig?.singleton,i.version,i.scope),o=()=>{if(!i.shareConfig?.singleton||r(n.share,a)===void 0)return!1;let e=s(n.share,a);return e===void 0?!1:e===`signalk_multihelm`?g.has(e):!(d.options?.remotes||[]).some(t=>t.name===e)&&(g.add(e),!0)};if(!o()&&(r(n.share,a)===void 0||m(e,i)||!i.shareConfig?.singleton&&s(n.share,a)!==`signalk_multihelm`)){if(i.shareConfig?.import===!1){let t=__mfGetShareScopeNames(i),n=t=>!__mfHasUsableProvider(d.shareScopeMap?.[t]?.[e],e,i,t);if(t.some(n)){d.__mfKeepAdoptedProviders||(d.__mfKeepAdoptedProviders=!0,d.sharedHandler?.hooks?.lifecycle?.afterRegisterShare?.on?.(e=>{let{shared:t,previousShared:n,registeredShared:r}=e||{},i=d.shareScopeMap?.[e.scope]?.[e.pkgName];t&&i&&(t.shareConfig?.import===!1?r===t&&n&&n.shareConfig?.import!==!1&&i[t.version]===t&&(i[t.version]=n):r!==t&&r?.shareConfig?.import===!1&&!r.loaded&&i[t.version]===r&&(i[t.version]=t))}));for(let r of globalThis.__FEDERATION__?.__INSTANCES__||[])for(let a of t){let t=r?.shareScopeMap?.[a]?.[e];if(!__mfHasUsableProvider(t,e,i,a)||!n(a))continue;let o=(d.shareScopeMap[a]||={})[e]||={};for(let[e,n]of Object.entries(t))n?.shareConfig?.import!==!1&&(o[e]&&o[e].shareConfig?.import!==!1||(o[e]=n))}}if(t.every(n))return}await d.loadShare(e,{customShareInfo:{shareConfig:i.shareConfig}}).then(async e=>{if(e===!1||o())return;let t=typeof e==`function`?e():e,r=p(await Promise.resolve(t));u(n.share,a,r,`signalk_multihelm`)})}}))}finally{v()}for(let[e,r]of Object.entries(f)){if(!r.lib||r.treeShaking||r.shareConfig?.import===!1)continue;let i=t(e,r.shareConfig?.singleton,r.version,r.scope);if(s(n.share,i)===`signalk_multihelm`)for(let t of Array.isArray(r.scope)?r.scope:[r.scope||`default`]){let n=d.shareScopeMap?.[t]?.[e],i=n?.[r.version];i&&i.get===r.get&&!i.lib&&(Object.values(n).some(e=>e!==i&&(e?.lib||e?.loaded))||(i.lib=r.lib,i.loaded=!0))}}return d})(),r}r=i();export{r as hostInitPromise,i as initHost};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vite-preload-helper-DygEbaNj.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}var r=function(e,t,n,r){let i=(Array.isArray(r)?r[0]:r)||`default`,a=t||!n?e:e+`@`+n,o={canonical:i+`:`+a};return i==="default"&&(o.aliases=[a]),o},i=(e,t)=>{let n=e[t.canonical];if(n!==void 0)return n;let r=t.aliases||[];for(let n of r){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];if(r!==void 0)return e[t.canonical]=r,r}},a=[];async function o(){if(a.length===0)return;let t=`react-dom/client`,{usedShared:o}=await e(async()=>{let{usedShared:e}=await import(`./_virtual_mf-localSharedImportMap___mfe_internal__signalk_multihelm__mf_owner__1-GfsGDlYi.js`);return{usedShared:e}},[]);await Promise.all(a.map(async([e,a])=>{let s=o[e],c=s??(e===t?o[`react-dom`]:void 0);if(!c||c.treeShaking||c.shareConfig?.import===!1||s&&s.materialize===!1&&e!==t)return;let l=r(e,c.shareConfig?.singleton,c.version,c.scope);i(n.share,l)===void 0&&await a().catch(t=>console.warn(`[module-federation] shared preload failed:`,e,t))}))}export{o as preloadPendingShares};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),t=function(e){return new URL("..\u002F"+e,import.meta.url).href},n={},r=function(e){return e.pathname.endsWith(`.css`)},i=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},a=function(a,o,s){let c=Promise.resolve();if(o&&o.length>0){let a,l=document.querySelector(`meta[property=csp-nonce]`),u=l?.nonce||l?.getAttribute(`nonce`);function d(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function f(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}c=d(o.map(o=>{o=t(o,s);let c=f(o),l=r(c);return i(n,c.href,()=>{if(a===void 0){a={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];a.all.add(n.href),n.rel===`stylesheet`&&a.styles.add(n.href)}}if((l?a.styles:a.all).has(c.href))return;let t=document.createElement(`link`);if(t.rel=l?`stylesheet`:e,l||(t.as=`script`),t.crossOrigin=``,t.href=c.href,u&&t.setAttribute(`nonce`,u),document.head.appendChild(t),l)return new Promise((e,n)=>{let r=i=>{t.removeEventListener(`load`,r),t.removeEventListener(`error`,r),i.type===`error`?n(Error(`Unable to preload CSS for ${c}`)):e(i)};t.addEventListener(`load`,r),t.addEventListener(`error`,r)})})}).filter(e=>e!==void 0))}function l(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return c.then(e=>{for(let t of e||[])t.status===`rejected`&&l(t.reason);return a().catch(l)})};export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=window.__SK_REACT__;if(!e)throw Error(`signalk-multihelm: the admin UI does not expose React (Signal K 2.27 or later)`);var{Children:t,Component:n,Fragment:r,Profiler:i,PureComponent:a,StrictMode:o,Suspense:s,cloneElement:c,createContext:l,createElement:u,createRef:d,forwardRef:f,isValidElement:p,lazy:m,memo:h,startTransition:g,use:_,useActionState:v,useCallback:y,useContext:ee,useDebugValue:b,useDeferredValue:te,useEffect:x,useId:ne,useImperativeHandle:S,useInsertionEffect:C,useLayoutEffect:w,useMemo:re,useOptimistic:ie,useReducer:ae,useRef:T,useState:E,useSyncExternalStore:oe,useTransition:se,version:ce}=e;function D(e){return e===1?`1 server`:`${String(e)} servers`}function O(e,t){if(!e.running)return{tone:`danger`,text:`Multihelm is not running. Enable it above.`};if(e.masterConflict)return{tone:`danger`,text:`More than one server is set to be the boat's master. Set one only.`};if(e.role===`master`){let t=e.pairedBy.length,n=e.pairedBy.filter(e=>e.online).length;return{tone:`info`,text:t===0?`This server is the boat's master. No other server is paired with it yet.`:`This server is the boat's master. ${String(n)} of the ${D(t)} paired with it ${n===1?`is`:`are`} online.`}}if(e.master)return{tone:`success`,text:`The boat's master is ${e.master.name}; it answered ${F(e.master.lastSeen,t)}.`};let n=e.peers.filter(e=>e.state===`paired`),r=n.filter(e=>e.online===!1);return r.length>0?{tone:`danger`,text:`No master found: ${r.map(e=>e.name).join(`, `)} ${r.length===1?`is`:`are`} not reachable.`}:n.length===0?{tone:`warning`,text:`No master found: this server is not paired yet. Pair it with the server set to be the boat's master below.`}:{tone:`warning`,text:`No master found: none of the paired servers is set to be the boat's master.`}}function k(e,t){return e.url===t.url||e.name.toLowerCase()===t.name.toLowerCase()}function A(e){return e.discovered.filter(t=>!e.peers.some(e=>k(t,e)))}function j(e,t){return e.id===``?t.find(t=>t.url===e.url)?.name??e.name:e.name}function M(e){return`/skServer/security/access/requests/${encodeURIComponent(e)}/approved`}function N(e){return[e.signalk&&`Signal K ${e.signalk}`,e.multihelm&&`Multihelm ${e.multihelm}`].filter(Boolean).join(` · `)}function P(e){return`${e}/admin/#/security/access/requests`}function F(e,t){if(e===void 0)return`never`;let n=Math.max(0,Math.round((t-e)/1e3));if(n<10)return`just now`;if(n<90)return`${String(n)} s ago`;let r=Math.round(n/60);if(r<90)return`${String(r)} min ago`;let i=Math.round(r/60);return i<36?`${String(i)} h ago`:`${String(Math.round(i/24))} days ago`}var I=window.__SK_REACT_JSX_RUNTIME__;if(!I)throw Error(`signalk-multihelm: the admin UI does not expose React (Signal K 2.27 or later)`);var{Fragment:L,jsx:R,jsxs:z}=I,B=`/plugins/signalk-multihelm`,V=3e3,H=`own-access`;async function U(e,t){let n=await fetch(e,{credentials:`same-origin`,...t}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(typeof r.error==`string`?r.error:`HTTP ${String(n.status)}`);return r}function W(e){return e instanceof Error?e.message:String(e)}function G(e){return{master:e?.master===!0,followVessel:e?.followVessel!==!1,followMetadata:e?.followMetadata!==!1,followSourcePriorities:e?.followSourcePriorities!==!1,historyFromMaster:e?.historyFromMaster!==!1}}function K({configuration:e,save:t}){let[n,r]=E(null),[i,a]=E(null),[o,s]=E(null),[c,l]=E(null),[u,d]=E(``),f=y(async()=>{try{r(await U(`${B}/status`)),a(null)}catch(e){a(W(e))}},[]);x(()=>{f();let e=setInterval(()=>void f(),V);return()=>{clearInterval(e)}},[f]);let p=async(e,t)=>{s(e),l(null);try{return await t(),!0}catch(t){return l({key:e,text:W(t)}),!1}finally{s(null),await f()}},m=e=>p(e,()=>U(`${B}/peers`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})})),h=(e,t)=>{window.confirm(`Stop keeping this server in step with ${t}?`)&&p(e.url,()=>U(`${B}/peers?url=${encodeURIComponent(e.url)}`,{method:`DELETE`}))},g=e=>{window.confirm(`Take ${e.name} off this list? It comes back once it asks this server again.`)&&p(e.id,()=>U(`${B}/paired-by?id=${encodeURIComponent(e.id)}`,{method:`DELETE`}))},_=e=>{p(H,()=>U(M(e),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({permissions:`admin`})}))},v=async e=>{e.preventDefault(),u.trim()!==``&&await m(u.trim())&&d(``)};return z(`div`,{children:[i&&z(`div`,{className:`alert alert-danger`,children:[`Cannot read Multihelm's status: `,i,n&&`. What is shown below may be out of date.`]}),n&&R(q,{status:n,allowing:o===H,allowError:c?.key===H?c.text:null,onAllow:_}),n?.running&&z(L,{children:[n.role===`master`&&R(Z,{status:n,busy:o,onForget:g}),R(J,{status:n,busy:o,onPair:m,onUnpair:h}),n.role!==`master`&&n.pairedBy.length>0&&R(Z,{status:n,busy:o,onForget:g}),z(`div`,{className:`card mb-3`,children:[R(`div`,{className:`card-header`,children:`Pair with another server`}),z(`div`,{className:`card-body`,children:[R(`p`,{className:`small text-body-secondary`,children:n.role===`master`?`The other servers pair with this one in their own Multihelm settings. Pair this one with another only to replicate charts both ways.`:`Each server takes over what the servers it is paired with share. Pair this one with the boat's master; to replicate charts both ways, pair the other server with this one too.`}),R(Q,{status:n,busy:o,onPair:m}),z(`form`,{className:`row g-2 mt-1`,onSubmit:e=>void v(e),children:[R(`div`,{className:`col-sm`,children:R(`input`,{className:`form-control`,value:u,onChange:e=>{d(e.target.value)},placeholder:`Or enter its address, e.g. 192.168.1.10 or helm.local:3000`,"aria-label":`Address of the other server`})}),R(`div`,{className:`col-sm-auto`,children:R(`button`,{type:`submit`,className:`btn btn-primary`,disabled:o!==null||u.trim()===``,children:o===u.trim()?`Pairing…`:`Pair`})})]}),c&&c.key!==H&&R(`div`,{className:`alert alert-danger mt-3 mb-0`,children:c.text})]})]})]}),R($,{configuration:e,save:t})]})}function q({status:e,allowing:t,allowError:n,onAllow:r}){let i=O(e,Date.now()),a=e.ownAccess;return z(L,{children:[R(`div`,{className:`alert alert-${i.tone}`,children:i.text}),!e.available&&R(`div`,{className:`alert alert-danger`,children:`This Signal K server is older than 2.31, so the other servers cannot read from it. Update it.`}),a?.state===`waiting-approval`&&z(`div`,{className:`alert alert-warning`,children:[z(`p`,{children:[R(`strong`,{children:`One more step:`}),` Multihelm needs admin access to this server to write the master's vessel data, path metadata and source priorities here.`]}),R(`button`,{type:`button`,className:`btn btn-primary`,disabled:t,onClick:()=>{r(a.request)},children:t?`Allowing…`:`Allow`}),z(`div`,{className:`small mt-2`,children:[`This approves the request “Multihelm: take the vessel settings over from the master” under `,R(`a`,{href:`#/security/access/requests`,children:`Security → Access Requests`}),`.`]}),n&&R(`div`,{className:`text-danger mt-2`,children:n})]}),a?.state===`denied`&&R(`div`,{className:`alert alert-danger`,children:`The access request on this server was denied, so the vessel settings are not taken over from the master. Save the settings below to ask again.`})]})}function J({status:e,busy:t,onPair:n,onUnpair:r}){let i=Date.now();return z(`div`,{className:`card mb-3`,children:[R(`div`,{className:`card-header`,children:`Paired servers`}),R(`div`,{className:`card-body`,children:e.peers.length===0?R(`p`,{className:`text-body-secondary mb-0`,children:e.role===`master`?`This server takes nothing over from another.`:`This server is not paired with another yet.`}):R(`table`,{className:`table table-sm align-middle mb-0`,children:R(`tbody`,{children:e.peers.map(a=>{let o=j(a,e.discovered);return z(`tr`,{children:[z(`td`,{children:[R(`strong`,{children:o}),a.master&&R(`span`,{className:`badge text-bg-primary ms-2`,children:`master`}),R(`div`,{className:`small text-body-secondary`,children:a.url}),N(a)&&R(`div`,{className:`small text-body-secondary`,children:N(a)})]}),R(`td`,{children:R(Y,{peer:a,name:o,status:e,now:i})}),z(`td`,{className:`text-end text-nowrap`,children:[a.state===`needs-pairing`&&R(`button`,{type:`button`,className:`btn btn-sm btn-primary me-2`,disabled:t!==null,onClick:()=>void n(a.url),children:`Pair again`}),R(`button`,{type:`button`,className:`btn btn-sm btn-outline-danger`,disabled:t!==null,onClick:()=>{r(a,o)},children:`Remove`})]})]},a.url)})})})})]})}function Y({peer:e,name:t,status:n,now:r}){return z(L,{children:[e.state===`paired`&&z(L,{children:[R(X,{online:e.online===!0}),z(`span`,{className:`small text-body-secondary ms-2`,children:[`seen `,F(e.lastSeen,r)]})]}),e.state===`waiting-approval`&&z(L,{children:[R(`span`,{className:`badge text-bg-warning`,children:`Waiting for approval`}),z(`div`,{className:`small mt-1`,children:[`On `,t,`, approve “Multihelm on `,n.name,`” under`,` `,R(`a`,{href:P(e.url),target:`_blank`,rel:`noreferrer`,children:`Security → Access Requests`}),`.`]})]}),e.state===`needs-pairing`&&R(`span`,{className:`badge text-bg-danger`,children:`Not paired`}),e.lastError&&R(`div`,{className:`small text-danger mt-1`,children:e.lastError})]})}function X({online:e}){return e?R(`span`,{className:`badge text-bg-success`,children:`Online`}):R(`span`,{className:`badge text-bg-secondary`,children:`Offline`})}function Z({status:e,busy:t,onForget:n}){let r=Date.now();return z(`div`,{className:`card mb-3`,children:[R(`div`,{className:`card-header`,children:`Servers paired with this one`}),R(`div`,{className:`card-body`,children:e.pairedBy.length===0?R(`p`,{className:`text-body-secondary mb-0`,children:`No other server is paired with this one yet. Pair the others with it in their Multihelm settings.`}):R(`table`,{className:`table table-sm align-middle mb-0`,children:R(`tbody`,{children:e.pairedBy.map(e=>z(`tr`,{children:[z(`td`,{children:[R(`strong`,{children:e.name}),N(e)&&R(`div`,{className:`small text-body-secondary`,children:N(e)})]}),z(`td`,{children:[R(X,{online:e.online}),z(`span`,{className:`small text-body-secondary ms-2`,children:[`seen `,F(e.lastSeen,r)]})]}),R(`td`,{className:`text-end`,children:!e.online&&R(`button`,{type:`button`,className:`btn btn-sm btn-outline-secondary`,disabled:t!==null,onClick:()=>{n(e)},children:`Forget`})})]},e.id))})})})]})}function Q({status:e,busy:t,onPair:n}){let r=A(e);return r.length===0?R(`p`,{className:`text-body-secondary`,children:`No other Signal K server that is not paired yet was found on the network.`}):R(`table`,{className:`table table-sm align-middle`,children:R(`tbody`,{children:r.map(e=>z(`tr`,{children:[z(`td`,{children:[R(`strong`,{children:e.name}),e.vessel&&z(`span`,{className:`text-body-secondary ms-2`,children:[`vessel `,e.vessel]}),R(`div`,{className:`small text-body-secondary`,children:e.url})]}),R(`td`,{className:`text-end`,children:R(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:t!==null,onClick:()=>void n(e.url),children:t===e.url?`Pairing…`:`Pair`})})]},e.url))})})}function $({configuration:e,save:t}){let[n,r]=E(()=>G(e)),i=(e,t)=>{r(n=>({...n,[e]:t}))},a=(e,t,r,a=!1)=>z(`div`,{className:`form-check mb-3`,children:[R(`input`,{className:`form-check-input`,type:`checkbox`,id:`multihelm-${e}`,checked:n[e],disabled:a,onChange:t=>{i(e,t.target.checked)}}),R(`label`,{className:`form-check-label`,htmlFor:`multihelm-${e}`,children:t}),R(`div`,{className:`form-text`,children:r})]}),o=n.master;return z(`div`,{className:`card mb-3`,children:[R(`div`,{className:`card-header`,children:`Settings`}),z(`div`,{className:`card-body`,children:[a(`master`,`This server is the boat's master`,`Set this on one server only. Plugins that run on the master alone run here, and the other servers use them through this one.`),o&&R(`p`,{className:`small text-body-secondary`,children:`The options below apply to the servers that are not the master.`}),a(`followVessel`,`Take the vessel data over from the master`,`Name, MMSI, call sign, dimensions and ship type from Server → Settings. Changes made here are replaced by the master's.`,o),a(`followMetadata`,`Take the path metadata over from the master`,`Display names, units, zones and alarm limits set for paths. Changes made here are replaced by the master's.`,o),a(`followSourcePriorities`,`Take the source priorities over from the master`,`Which source wins for a path, from Data → Source Priorities. They name sources by connection, so give the NMEA 2000 bus the same connection name on every server. Changes made here are replaced by the master's.`,o),a(`historyFromMaster`,`Answer this server's History API from the master`,`While the master has a history provider (signalk-questdb, for example), history graphs on this server show the master's history, so it is kept once on the boat. Needs Signal K 2.32.0 or later.`,o),R(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>{t({...e,...n})},children:`Save settings`})]})]})}export{K as default};
|