{
  "version": 3,
  "sources": ["../../src/apps/node/utils.ts", "../../src/common/loader/version.ts", "../../src/common/loader/system.ts", "../../src/common/loader/utils.ts", "../../src/common/loader/index.ts", "../../src/apps/node/esm.ts", "../../src/apps/node/events.ts", "../../src/apps/node/platform.ts", "../../src/common/utils/url.ts", "../../src/common/utils/dto.ts", "../../src/common/feed/piral.ts", "../../src/common/feed/discovery.ts", "../../src/common/feed/manifest.ts", "../../src/common/feed/index.ts", "../../src/common/state/container.ts", "../../src/common/state/queue.ts", "../../node_modules/zustand/esm/vanilla.mjs", "../../src/common/state/store.ts", "../../src/common/state/utils.ts", "../../src/common/state/actions.ts", "../../src/common/state/index.ts", "../../src/common/injector/index.ts", "../../src/common/utils/matcher.ts", "../../src/common/server/router.ts", "../../node_modules/entities/src/decode-codepoint.ts", "../../node_modules/entities/src/internal/decode-shared.ts", "../../node_modules/entities/src/generated/decode-data-html.ts", "../../node_modules/entities/src/generated/decode-data-xml.ts", "../../node_modules/entities/src/internal/bin-trie-flags.ts", "../../node_modules/entities/src/decode.ts", "../../node_modules/htmlparser2/src/Tokenizer.ts", "../../node_modules/htmlparser2/src/Parser.ts", "../../node_modules/domelementtype/dist/index.js", "../../node_modules/domhandler/dist/node.js", "../../node_modules/domhandler/dist/index.js", "../../node_modules/entities/src/escape.ts", "../../node_modules/entities/src/index.ts", "../../node_modules/dom-serializer/src/foreign-names.ts", "../../node_modules/dom-serializer/src/index.ts", "../../node_modules/htmlparser2/src/index.ts", "../../src/common/utils/escape.ts", "../../src/common/utils/json.ts", "../../src/common/server/decorator.ts", "../../src/common/server/style-part.ts", "../../src/common/server/script-part.ts", "../../src/common/ui/styles.ts", "../../src/common/utils/lifecycle.ts", "../../src/common/ui/renderer.ts", "../../node_modules/@module-federation/sdk/src/constant.ts", "../../node_modules/@module-federation/sdk/src/env.ts", "../../node_modules/@module-federation/sdk/src/utils.ts", "../../node_modules/@module-federation/sdk/src/generateSnapshotFromManifest.ts", "../../node_modules/@module-federation/sdk/src/logger.ts", "../../node_modules/@module-federation/sdk/src/dom.ts", "../../node_modules/@module-federation/sdk/src/node.ts", "../../node_modules/@module-federation/error-codes/src/getShortErrorMsg.ts", "../../node_modules/@module-federation/error-codes/src/browser.ts", "../../node_modules/@module-federation/runtime-core/src/utils/logger.ts", "../../node_modules/@module-federation/runtime-core/src/utils/tool.ts", "../../node_modules/@module-federation/runtime-core/src/global.ts", "../../node_modules/@module-federation/runtime-core/src/utils/semver/constants.ts", "../../node_modules/@module-federation/runtime-core/src/utils/semver/utils.ts", "../../node_modules/@module-federation/runtime-core/src/utils/semver/parser.ts", "../../node_modules/@module-federation/runtime-core/src/utils/semver/compare.ts", "../../node_modules/@module-federation/runtime-core/src/utils/semver/index.ts", "../../node_modules/@module-federation/runtime-core/src/constant.ts", "../../node_modules/@module-federation/runtime-core/src/utils/share.ts", "../../node_modules/@module-federation/runtime-core/src/utils/manifest.ts", "../../node_modules/@module-federation/error-codes/src/error-codes.ts", "../../node_modules/@module-federation/error-codes/src/desc.ts", "../../node_modules/@module-federation/runtime-core/src/utils/load.ts", "../../node_modules/@module-federation/runtime-core/src/utils/env.ts", "../../node_modules/@module-federation/runtime-core/src/utils/plugin.ts", "../../node_modules/@module-federation/runtime-core/src/utils/context.ts", "../../node_modules/@module-federation/runtime-core/src/utils/preload.ts", "../../node_modules/@module-federation/runtime-core/src/module/index.ts", "../../node_modules/@module-federation/runtime-core/src/utils/hooks/pluginSystem.ts", "../../node_modules/@module-federation/runtime-core/src/utils/hooks/syncHook.ts", "../../node_modules/@module-federation/runtime-core/src/utils/hooks/asyncHook.ts", "../../node_modules/@module-federation/runtime-core/src/utils/hooks/syncWaterfallHook.ts", "../../node_modules/@module-federation/runtime-core/src/utils/hooks/asyncWaterfallHooks.ts", "../../node_modules/@module-federation/runtime-core/src/remote/disabled.ts", "../../node_modules/@module-federation/runtime-core/src/plugins/snapshot/index.ts", "../../node_modules/@module-federation/runtime-core/src/plugins/generate-preload-assets.ts", "../../node_modules/@module-federation/runtime-core/src/plugins/snapshot/SnapshotHandler.ts", "../../node_modules/@module-federation/runtime-core/src/plugins/snapshot/disabled.ts", "../../node_modules/@module-federation/runtime-core/src/shared/index.ts", "../../node_modules/@module-federation/runtime-core/src/shared/disabled.ts", "../../node_modules/@module-federation/runtime-core/src/remote/index.ts", "../../node_modules/@module-federation/runtime-core/src/core.ts", "../../node_modules/@module-federation/runtime/src/index.ts", "../../src/common/formats/module.ts", "../../src/common/formats/native.ts", "../../src/common/formats/pilet.ts", "../../src/common/frameworks/default.ts", "../../src/common/frameworks/html.ts", "../../src/common/slot-rels/router.ts", "embedded:islands", "../../src/apps/node/index.ts"],
  "sourcesContent": ["import * as vm from 'node:vm';\n\nexport function defer(cb: () => void): void {\n  setTimeout(cb, 0);\n}\n\n/**\n * Gets the constructors for ES modules in a VM context. Only available if\n * Node.js runs with the `--experimental-vm-modules` flag. Not imported by\n * name to keep the module working (e.g., for scripts) without the flag.\n */\nexport function getVmModules(): Pick<typeof vm, 'SourceTextModule' | 'SyntheticModule'> {\n  const { SourceTextModule, SyntheticModule } = vm;\n\n  if (typeof SourceTextModule !== 'function' || typeof SyntheticModule !== 'function') {\n    throw new Error('Loading ES modules requires running Node.js with the \"--experimental-vm-modules\" flag.');\n  }\n\n  return { SourceTextModule, SyntheticModule };\n}\n", "const semver =\n  /^[v^~<>=]*?(\\d+)(?:\\.([x*]|\\d+)(?:\\.([x*]|\\d+)(?:\\.([x*]|\\d+))?(?:-([\\da-z\\-]+(?:\\.[\\da-z\\-]+)*))?(?:\\+[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?)?)?$/i;\n\nconst acceptsAll = ['*', 'x', '>=0'];\n\nconst operatorResMap: Record<string, [number, number?]> = {\n  '>': [1],\n  '>=': [0, 1],\n  '=': [0],\n  '<=': [-1, 0],\n  '<': [-1],\n};\n\nfunction indexOrEnd(str: string, q: string) {\n  return str.indexOf(q) === -1 ? str.length : str.indexOf(q);\n}\n\nfunction splitVersion(v: string) {\n  const c = v.replace(/^v/, '').replace(/\\+.*$/, '');\n  const patchIndex = indexOrEnd(c, '-');\n  const arr = c.substring(0, patchIndex).split('.');\n  arr.push(c.substring(patchIndex + 1));\n  return arr;\n}\n\nfunction parseSegment(v: string) {\n  const n = parseInt(v, 10);\n  return isNaN(n) ? v : n;\n}\n\nfunction validateAndParse(v: string) {\n  const match = v.match(semver);\n\n  if (match) {\n    match.shift();\n    return match;\n  }\n\n  return ['', '', ''];\n}\n\nfunction compareStrings(a: string, b: string) {\n  const ap = parseSegment(a);\n  const bp = parseSegment(b);\n\n  if (ap > bp) {\n    return 1;\n  } else if (ap < bp) {\n    return -1;\n  } else {\n    return 0;\n  }\n}\n\nfunction compareSegments(a: [string, string], b: [string, string]) {\n  for (let i = 0; i < 2; i++) {\n    const r = compareStrings(a[i] || '0', b[i] || '0');\n\n    if (r !== 0) {\n      return r;\n    }\n  }\n\n  return 0;\n}\n\nfunction compareVersions(v1: string, v2: string) {\n  const s1 = splitVersion(v1);\n  const s2 = splitVersion(v2);\n  const len = Math.max(s1.length - 1, s2.length - 1);\n\n  for (let i = 0; i < len; i++) {\n    const m1 = s1[i] || '0';\n    const m2 = s2[i] || '0';\n\n    if (m2 === 'x') {\n      return 0;\n    }\n\n    const n1 = parseInt(m1, 10);\n    const n2 = parseInt(m2, 10);\n\n    if (n1 > n2) {\n      return 1;\n    } else if (n2 > n1) {\n      return -1;\n    }\n  }\n\n  const sp1 = s1[s1.length - 1];\n  const sp2 = s2[s2.length - 1];\n\n  if (sp1 && sp2) {\n    const p1 = sp1.split('.').map(parseSegment);\n    const p2 = sp2.split('.').map(parseSegment);\n    const len = Math.max(p1.length, p2.length);\n\n    for (let i = 0; i < len; i++) {\n      if (p1[i] === undefined || (typeof p2[i] === 'string' && typeof p1[i] === 'number')) {\n        return -1;\n      } else if (p2[i] === undefined || (typeof p1[i] === 'string' && typeof p2[i] === 'number')) {\n        return 1;\n      } else if (p1[i] > p2[i]) {\n        return 1;\n      } else if (p2[i] > p1[i]) {\n        return -1;\n      }\n    }\n  } else if (sp1 || sp2) {\n    return sp1 ? -1 : 1;\n  }\n\n  return 0;\n}\n\nfunction compare(v1: string, v2: string, operator: string) {\n  // since result of compareVersions can only be -1 or 0 or 1\n  // a simple map can be used to replace switch\n  const res = compareVersions(v1, v2);\n  return operatorResMap[operator].indexOf(res) > -1;\n}\n\nexport function validate(version: string) {\n  return acceptsAll.includes(version) || semver.test(version);\n}\n\nexport function satisfies(v: string, r: string) {\n  if (!acceptsAll.includes(r)) {\n    // if no range operator then \"=\"\n    const match = r.match(/^([<>=~^]+)/);\n    const op = match ? match[1] : '=';\n\n    // if gt/lt/eq then operator compare\n    if (op !== '^' && op !== '~') {\n      return compare(v, r, op);\n    }\n\n    // else range of either \"~\" or \"^\" is assumed\n    const [v1, v2, v3] = validateAndParse(v);\n    const [m1, m2, m3] = validateAndParse(r);\n\n    if (compareStrings(v1, m1) !== 0) {\n      return false;\n    } else if (op === '^') {\n      return compareSegments([v2, v3], [m2, m3]) >= 0;\n    } else if (compareStrings(v2, m2) !== 0) {\n      return false;\n    }\n\n    return compareStrings(v3, m3) >= 0;\n  }\n\n  return true;\n}\n", "import { validate } from './version';\n\nexport type ModuleNamespace = Record<string, any>;\nexport type ModuleExport = ((name: string, value: any) => any) & ((values: ModuleNamespace) => ModuleNamespace);\nexport type ModuleSetter = (module: ModuleNamespace) => void;\n\nexport interface ModuleDeclaration {\n  setters?: Array<ModuleSetter | undefined>;\n  execute?: () => void | Promise<void>;\n}\n\nexport interface ModuleContext {\n  id: string;\n  meta: { url: string };\n  import(id: string): Promise<ModuleNamespace>;\n  resolve(id: string): string;\n}\n\nexport type ModuleDeclare = (exportModule: ModuleExport, context: ModuleContext) => ModuleDeclaration;\nexport type PackageResolver = (name: string, versionRange: string, parent?: string) => Promise<string | undefined>;\n\ninterface ModuleRecord {\n  id: string;\n  name?: string;\n  version?: string;\n  dependencies: Array<string>;\n  declare?: ModuleDeclare;\n  namespace: ModuleNamespace;\n  importers: Array<ModuleSetter>;\n  state: 'registered' | 'linking' | 'executing' | 'evaluated' | 'failed';\n  error?: unknown;\n  declaration?: ModuleDeclaration;\n  evaluation?: Promise<ModuleNamespace>;\n  waitingFor?: ModuleRecord;\n}\n\nexport interface PicardSystem {\n  register(name: string, dependencies: Array<string>, declare: ModuleDeclare): void;\n  register(dependencies: Array<string>, declare: ModuleDeclare): void;\n  registerRegistry: Record<string, true>;\n  set(id: string, value: any): void;\n  get(id: string): ModuleNamespace | undefined;\n  has(id: string): boolean;\n  entries(): Iterable<[string, ModuleNamespace]>;\n  resolve(id: string, parent?: string): string;\n  import(id: string, parent?: string): Promise<ModuleNamespace>;\n  list(): Array<{ id: string; name: string; version: string }>;\n  setPackageResolver(resolver: PackageResolver): void;\n  setResolveListener(listener: (id: string, parent: string | undefined, result: string) => void): void;\n}\n\nconst exactVersion = /^\\d+\\.\\d+\\.\\d+(?:-[\\da-z-]+(?:\\.[\\da-z-]+)*)?(?:\\+[\\da-z-]+(?:\\.[\\da-z-]+)*)?$/i;\n\nfunction splitPackageId(id: string) {\n  if (/^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(id)) {\n    return undefined;\n  }\n\n  const separator = id.lastIndexOf('@');\n\n  if (separator <= 0) {\n    return undefined;\n  }\n\n  return {\n    name: id.substring(0, separator),\n    version: id.substring(separator + 1),\n  };\n}\n\nfunction getPackageMetadata(id: string) {\n  const packageId = splitPackageId(id);\n\n  if (packageId && exactVersion.test(packageId.version)) {\n    return packageId;\n  }\n\n  return undefined;\n}\n\nexport function createSystem(): PicardSystem {\n  const modules = new Map<string, ModuleRecord>();\n  const loading = new Map<string, Promise<ModuleRecord>>();\n  const resolvingPackages = new Map<string, Promise<ModuleRecord | undefined>>();\n  const registerRegistry: Record<string, true> = Object.create(null);\n  let packageResolver: PackageResolver | undefined;\n  let resolveListener: ((id: string, parent: string | undefined, result: string) => void) | undefined;\n  let registeringUrl: string | undefined;\n\n  function register(...args: [string, Array<string>, ModuleDeclare] | [Array<string>, ModuleDeclare]) {\n    const named = typeof args[0] === 'string';\n    const id = named ? args[0] : registeringUrl || (globalThis as any).document?.currentScript?.src;\n    const dependencies = (named ? args[1] : args[0]) as Array<string>;\n    const declare = (named ? args[2] : args[1]) as ModuleDeclare;\n\n    if (!id) {\n      throw new Error('An anonymous module must be registered from a script with a URL.');\n    }\n\n    const record: ModuleRecord = {\n      id,\n      ...getPackageMetadata(id),\n      dependencies,\n      declare,\n      namespace: {},\n      importers: [],\n      state: 'registered',\n    };\n\n    modules.set(id, record);\n    registerRegistry[id] = true;\n  }\n\n  function resolve(id: string, parent?: string) {\n    let result: string;\n\n    if (/^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(id)) {\n      result = id;\n    } else if (id.startsWith('.') && parent && /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(parent)) {\n      result = new URL(id, parent).href;\n    } else {\n      result = id;\n    }\n\n    resolveListener?.(id, parent, result);\n    return result;\n  }\n\n  function set(id: string, value: any) {\n    const namespace = value && typeof value === 'object' ? value : { default: value };\n    modules.set(id, {\n      id,\n      ...getPackageMetadata(id),\n      dependencies: [],\n      namespace,\n      importers: [],\n      state: 'evaluated',\n    });\n    registerRegistry[id] = true;\n  }\n\n  function registerFromSource(id: string, source: string) {\n    registeringUrl = id;\n\n    try {\n      new Function('System', `${source}\\n//# sourceURL=${id}`)(system);\n    } finally {\n      registeringUrl = undefined;\n    }\n  }\n\n  async function loadScript(id: string): Promise<ModuleRecord> {\n    const existing = modules.get(id);\n\n    if (existing) {\n      return existing;\n    }\n\n    const pending = loading.get(id);\n\n    if (pending) {\n      return pending;\n    }\n\n    const task = (async () => {\n      if (typeof document !== 'undefined') {\n        await new Promise<void>((resolveScript, rejectScript) => {\n          const script = document.createElement('script');\n          script.src = id;\n          script.async = true;\n          script.onload = () => resolveScript();\n          script.onerror = () => rejectScript(new Error(`Failed to load module \"${id}\".`));\n          document.head.appendChild(script);\n        });\n      } else {\n        const response = await fetch(id);\n\n        if (!response.ok) {\n          throw new Error(`Failed to load module \"${id}\": ${response.status} ${response.statusText}`);\n        }\n\n        registerFromSource(id, await response.text());\n      }\n\n      const record = modules.get(id);\n\n      if (!record) {\n        throw new Error(`The script \"${id}\" did not register a module.`);\n      }\n\n      return record;\n    })();\n\n    loading.set(id, task);\n\n    try {\n      return await task;\n    } finally {\n      loading.delete(id);\n    }\n  }\n\n  async function resolveRecord(id: string, parent?: string): Promise<ModuleRecord> {\n    const resolved = resolve(id, parent);\n    const registered = modules.get(resolved);\n\n    if (registered) {\n      return registered;\n    }\n\n    const packageId = splitPackageId(resolved);\n\n    if (packageResolver && packageId && validate(packageId.version)) {\n      const key = `${packageId.name}@${packageId.version}`;\n      let pending = resolvingPackages.get(key);\n\n      if (!pending) {\n        pending = (async () => {\n          const selectedId = await packageResolver!(packageId.name, packageId.version, parent);\n\n          if (!selectedId) {\n            return undefined;\n          }\n\n          resolveListener?.(id, parent, selectedId);\n          return modules.get(selectedId) || (await loadScript(selectedId));\n        })();\n        resolvingPackages.set(key, pending);\n      }\n\n      try {\n        const packageModule = await pending;\n\n        if (packageModule) {\n          return packageModule;\n        }\n      } finally {\n        resolvingPackages.delete(key);\n      }\n    }\n\n    return loadScript(resolved);\n  }\n\n  function instantiate(record: ModuleRecord): Promise<ModuleNamespace> {\n    if (!record.evaluation) {\n      record.evaluation = evaluate(record);\n    }\n\n    return record.evaluation;\n  }\n\n  function createsDependencyCycle(dependency: ModuleRecord, importer: ModuleRecord) {\n    const visited = new Set<ModuleRecord>();\n    let current: ModuleRecord | undefined = dependency;\n\n    while (current && !visited.has(current)) {\n      if (current === importer) {\n        return true;\n      }\n\n      visited.add(current);\n      current = current.waitingFor;\n    }\n\n    return false;\n  }\n\n  async function evaluate(record: ModuleRecord): Promise<ModuleNamespace> {\n    if (record.state === 'evaluated') {\n      return record.namespace;\n    }\n\n    if (record.state === 'failed') {\n      throw record.error;\n    }\n\n    record.state = 'linking';\n\n    const exportModule = ((nameOrValues: string | ModuleNamespace, value?: any) => {\n      const updates = typeof nameOrValues === 'string' ? { [nameOrValues]: value } : nameOrValues;\n      const changed = Object.entries(updates).some(\n        ([name, exported]) =>\n          !Object.prototype.hasOwnProperty.call(record.namespace, name) || !Object.is(record.namespace[name], exported),\n      );\n      Object.assign(record.namespace, updates);\n\n      if (changed) {\n        for (const importer of record.importers) {\n          importer(record.namespace);\n        }\n      }\n\n      return typeof nameOrValues === 'string' ? value : updates;\n    }) as ModuleExport;\n\n    const context: ModuleContext = {\n      id: record.id,\n      meta: { url: record.id },\n      import: (id) => system.import(id, record.id),\n      resolve: (id) => system.resolve(id, record.id),\n    };\n\n    try {\n      record.declaration = record.declare?.(exportModule, context) || {};\n      const setters = record.declaration.setters || [];\n\n      for (let index = 0; index < record.dependencies.length; index++) {\n        const dependencyId = resolve(record.dependencies[index], record.id);\n        const dependency = await resolveRecord(dependencyId, record.id);\n        const setter = setters[index];\n\n        if (setter) {\n          dependency.importers.push(setter);\n        }\n\n        record.waitingFor = dependency;\n        const namespace = createsDependencyCycle(dependency, record) ? dependency.namespace : await instantiate(dependency);\n        record.waitingFor = undefined;\n        setter?.(namespace);\n      }\n\n      record.state = 'executing';\n      await record.declaration.execute?.();\n      record.state = 'evaluated';\n      return record.namespace;\n    } catch (error) {\n      record.state = 'failed';\n      record.error = error;\n      throw error;\n    } finally {\n      record.waitingFor = undefined;\n    }\n  }\n\n  const system: PicardSystem = {\n    register,\n    registerRegistry,\n    set,\n    get(id) {\n      return modules.get(id)?.namespace;\n    },\n    has(id) {\n      return modules.has(id);\n    },\n    entries() {\n      return [...modules].map(([id, record]) => [id, record.namespace]);\n    },\n    list() {\n      return [...modules.values()].flatMap((module) =>\n        module.name && module.version ? [{ id: module.id, name: module.name, version: module.version }] : [],\n      );\n    },\n    resolve,\n    async import(id, parent) {\n      const record = await resolveRecord(id, parent);\n      return instantiate(record);\n    },\n    setResolveListener(listener) {\n      resolveListener = listener;\n    },\n    setPackageResolver(resolver) {\n      packageResolver = resolver;\n    },\n  };\n\n  return system;\n}\n", "import type { ModuleResolver } from '@/types';\n\nimport type { PicardSystem, ModuleExport } from './system';\n\nfunction handleFailure(error: Error, link: string) {\n  console.error('Failed to load Picard module', link, error);\n}\n\n/**\n * Registers a plain module in Picard's module registry.\n * @param name The name of the module\n * @param resolve The resolver for the module's content.\n */\nexport function registerModule(system: PicardSystem, name: string, resolve: ModuleResolver) {\n  system.register(name, [], (_exports) => ({\n    execute() {\n      const content = resolve();\n\n      if (content instanceof Promise) {\n        return content.then((module) => exportContent(_exports, module.default || module));\n      } else {\n        exportContent(_exports, content);\n      }\n    },\n  }));\n}\n\nfunction exportContent(exportModule: ModuleExport, content: any) {\n  if (typeof content === 'function') {\n    exportModule('__esModule', true);\n    Object.keys(content).forEach((property) => exportModule(property, content[property]));\n    exportModule('default', content);\n  } else if (\n    typeof content === 'number' ||\n    typeof content === 'boolean' ||\n    typeof content === 'symbol' ||\n    typeof content === 'string' ||\n    typeof content === 'bigint' ||\n    Array.isArray(content)\n  ) {\n    exportModule('__esModule', true);\n    exportModule('default', content);\n  } else if (content) {\n    exportModule(content);\n\n    if (typeof content === 'object' && !('default' in content)) {\n      exportModule('default', content);\n    }\n  }\n}\n\nfunction registerDependencies(system: PicardSystem, dependencies: Array<[string, ModuleResolver]> = []) {\n  for (const [name, dependency] of dependencies) {\n    if (!system.has(name)) {\n      registerModule(system, name, dependency);\n    }\n  }\n}\n\n/**\n * Registers the given dependency URLs in Picard's module registry.\n * @param dependencyUrls The dependencies to resolve later.\n */\nexport function registerDependencyUrls(system: PicardSystem, dependencyUrls: Record<string, string> = {}) {\n  const dependencies = Object.entries(dependencyUrls).map(([name, url]): [string, ModuleResolver] => [\n    name,\n    () => system.import(url),\n  ]);\n  registerDependencies(system, dependencies);\n}\n\n/**\n * Registers the given dependency resolvers in Picard's module registry.\n * @param dependencies The dependencies to resolve later.\n */\nexport function registerDependencyResolvers(system: PicardSystem, dependencies: Record<string, ModuleResolver> = {}) {\n  registerDependencies(system, Object.entries(dependencies));\n}\n\n/**\n * Imports a module via Picard's module registry.\n * @param url The link to the module's root module.\n * @returns The evaluated module or an empty module in case of an error.\n */\nexport async function loadModule(system: PicardSystem, url: string) {\n  try {\n    return await system.import(url);\n  } catch (error: any) {\n    return handleFailure(error, url);\n  }\n}\n", "import type { DependencyInjector, LoaderService } from '@/types';\n\nimport { createSystem } from './system';\nimport { loadModule, registerDependencyResolvers, registerDependencyUrls } from './utils';\n\nconst system = createSystem();\n\nfunction createLoader(injector: DependencyInjector): LoaderService {\n  const events = injector.get('events');\n  const { dependencies } = injector.get('config');\n\n  system.setResolveListener((id, parentUrl, result) => events.emit('resolved-dependency', { id, parentUrl, result }));\n\n  registerDependencyResolvers(system, dependencies);\n\n  return {\n    registerUrls(dependencies) {\n      registerDependencyUrls(system, dependencies);\n    },\n    registerResolvers(dependencies) {\n      registerDependencyResolvers(system, dependencies);\n    },\n    registerModule(url, content) {\n      system.set(url, content);\n    },\n    load(url) {\n      return loadModule(system, url);\n    },\n    import(entry, parent) {\n      return system.import(entry, parent);\n    },\n    list() {\n      return system.list();\n    },\n    setPackageResolver(resolver) {\n      system.setPackageResolver(resolver);\n    },\n  };\n}\n\n(globalThis as any).System = system;\n\nexport { system, createLoader };\n", "import type { SyntheticModule } from 'node:vm';\nimport { getVmModules } from './utils';\nimport { system } from '@/common/loader';\nimport type { EsmService } from '@/types';\n\nexport function createEsm(): EsmService {\n  async function linkModule(\n    url: string,\n    cache: Record<string, SyntheticModule>,\n    depMap: Record<string, string>,\n    parent: string,\n  ) {\n    const res = await fetch(url);\n    const content = await res.text();\n    const { SourceTextModule, SyntheticModule } = getVmModules();\n    // evaluated in the main context to have the globals (e.g., URL) of Node.js\n    const mod = new SourceTextModule(content, {\n      identifier: url,\n      initializeImportMeta(meta) {\n        meta.url = url;\n      },\n    });\n\n    await mod.link(async (specifier) => {\n      const dep = depMap[specifier];\n      const entry = cache[dep];\n\n      if (entry) {\n        return entry;\n      }\n\n      if (dep) {\n        const result = await system.import(dep, parent);\n        const names = Object.keys(result);\n        return (cache[dep] = new SyntheticModule(names, function () {\n          for (const name of names) {\n            this.setExport(name, result[name]);\n          }\n        }));\n      }\n\n      const newUrl = new URL(specifier, url);\n      return await linkModule(newUrl.href, cache, depMap, parent);\n    });\n\n    await mod.evaluate();\n    return mod;\n  }\n\n  return {\n    async load(url, depMap, parent) {\n      const mod = await linkModule(url, {}, depMap, parent);\n      return mod.namespace;\n    },\n  };\n}\n", "import { EventEmitter } from 'events';\nimport type { EventSystem } from '@/types';\n\n/**\n * Creates a new Piral app shell event emitter.\n * Uses a custom event dispatcher with a state for usage control.\n * @returns The event emitter.\n */\nexport function createListener(): EventSystem {\n  const emitter = new EventEmitter();\n\n  const events: EventSystem = {\n    on(type, callback) {\n      emitter.on(type, callback);\n      return events;\n    },\n    once(type, callback) {\n      emitter.once(type, callback);\n      return events;\n    },\n    off(type, callback) {\n      emitter.off(type, callback);\n      return events;\n    },\n    emit(name, args) {\n      emitter.emit(name, args);\n      emitter.emit('*', { name, args });\n      return events;\n    },\n  };\n\n  return events;\n}\n", "import { createContext, Script, type SourceTextModule } from 'node:vm';\nimport { getVmModules } from './utils';\nimport type { PlatformService } from '@/types';\n\nasync function loadScript(url: string, integrity?: string, crossOrigin?: string): Promise<void> {\n  const res = await fetch(url, {\n    mode: (crossOrigin && 'cors') || undefined,\n  });\n\n  const content = await res.text();\n  const ctx = createContext();\n  const script = new Script(content);\n  script.runInContext(ctx);\n}\n\nasync function linkModule(url: string): Promise<SourceTextModule> {\n  const res = await fetch(url);\n  const content = await res.text();\n  const { SourceTextModule } = getVmModules();\n  // evaluated in the main context to have the globals (e.g., URL) of Node.js\n  const mod = new SourceTextModule(content, { identifier: url });\n  await mod.link((specifier) => {\n    const newUrl = new URL(specifier, url);\n    return linkModule(newUrl.href);\n  });\n  await mod.evaluate();\n  return mod;\n}\n\nasync function loadModule(url: string): Promise<Object> {\n  const res = await linkModule(url);\n  return res.namespace;\n}\n\nasync function loadJson<T = any>(url: string): Promise<T> {\n  const res = await fetch(url);\n  const doc: T = await res.json();\n  return doc;\n}\n\nexport function createPlatform(): PlatformService {\n  return {\n    loadJson,\n    loadModule,\n    loadScript,\n  };\n}\n", "export function getUrl(source: string, baseUrl?: string) {\n  if (baseUrl) {\n    return new URL(source, baseUrl).href;\n  } else if (typeof location !== 'undefined') {\n    return getUrl(source, location.href);\n  } else {\n    return source;\n  }\n}\n", "import { PicardMicrofrontend } from '@/types';\n\nexport function createEmptyMicrofrontend<T extends PicardMicrofrontend['format']>(\n  name: string,\n  format: T,\n  source: string,\n  details: any,\n): PicardMicrofrontend {\n  return {\n    name,\n    source,\n    format,\n    details,\n    flags: 0,\n    assets: [],\n    components: [],\n  };\n}\n", "import { getUrl } from '@/common/utils/url';\nimport { createEmptyMicrofrontend } from '@/common/utils/dto';\nimport type { PicardMicrofrontend, PiletDefinition } from '@/types';\n\nexport function fromPiral(pilet: PiletDefinition, baseUrl?: string): PicardMicrofrontend {\n  const { name, link, spec, custom } = pilet;\n\n  switch (spec) {\n    case 'mf':\n      return createEmptyMicrofrontend(name, 'module', link, {\n        id: custom?.id || name,\n        url: getUrl(link, baseUrl),\n        type: custom?.type,\n        runtime: custom?.runtime,\n        exposes: custom?.exposes,\n        remotes: custom?.remotes,\n        shared: custom?.shared,\n        metaData: custom?.metaData,\n      });\n    case 'nf':\n      return createEmptyMicrofrontend(name, 'native', link, {\n        url: getUrl(link, baseUrl),\n        exposes: custom?.exposes,\n        dependencies: custom?.dependencies,\n      });\n    default:\n      return createEmptyMicrofrontend(name, 'pilet', link, {\n        name,\n        integrity: pilet.integrity,\n        custom,\n        version: pilet.version,\n        dependencies: pilet.dependencies || {},\n        spec,\n        config: pilet.config,\n        url: getUrl(link, baseUrl),\n      });\n  }\n}\n", "import { getUrl } from '@/common/utils/url';\nimport { createEmptyMicrofrontend } from '@/common/utils/dto';\nimport type { DiscoveryResponse, PicardMicrofrontend } from '@/types';\n\nfunction inferKind(url: string, extras: any): PicardMicrofrontend['format'] {\n  const spec = extras.pilet?.spec;\n\n  if (spec === 'mf') {\n    return 'module';\n  } else if (spec === 'nf') {\n    return 'native';\n  } else if (typeof spec === 'string' || typeof extras.pilet === 'object') {\n    return 'pilet';\n  } else if (url.endsWith('.js') || typeof extras.modulefederation === 'object') {\n    return 'module';\n  } else if (url.endsWith('.json') || typeof extras.nativefederation === 'object') {\n    return 'native';\n  }\n\n  // by default assume module federation\n  return 'module';\n}\n\nexport function fromDiscovery(feed: DiscoveryResponse, baseUrl?: string): Array<PicardMicrofrontend> {\n  const mfs = feed.microFrontends || {};\n\n  return Object.entries(mfs)\n    .filter(([, definitions]) => Array.isArray(definitions) && definitions.length > 0)\n    .map(([name, definitions]) => {\n      const [definition] = definitions;\n      const { metadata, extras = {}, url } = definition;\n      const kind = inferKind(url, extras);\n\n      if (kind === 'module') {\n        return createEmptyMicrofrontend(name, kind, url, {\n          id: extras.id || name,\n          url: getUrl(url, baseUrl),\n          type: extras.type,\n          runtime: extras.runtime,\n          exposes: extras.exposes,\n          remotes: extras.remotes,\n          shared: extras.shared,\n          metaData: extras.metaData,\n        });\n      } else if (kind === 'native') {\n        return createEmptyMicrofrontend(name, kind, url, {\n          url: getUrl(url, baseUrl),\n          exposes: extras.exposes,\n          dependencies: extras.dependencies,\n        });\n      } else {\n        return createEmptyMicrofrontend(name, kind, url, {\n          name,\n          integrity: metadata?.integrity,\n          version: metadata?.version,\n          dependencies: extras.dependencies || {},\n          config: extras.config,\n          spec: extras.pilet?.spec,\n          url: getUrl(url, baseUrl),\n        });\n      }\n    });\n}\n", "import { getUrl } from '@/common/utils/url';\nimport { createEmptyMicrofrontend } from '@/common/utils/dto';\nimport type { PicardMicrofrontend } from '@/types';\n\nexport function fromManifest(feed: Record<string, string>, baseUrl?: string): Array<PicardMicrofrontend> {\n  return Object.entries(feed).map(([name, path]) => {\n    return createEmptyMicrofrontend(name, 'native', path, {\n      url: getUrl(path, baseUrl),\n    });\n  });\n}\n", "import { fromPiral } from './piral';\nimport { fromDiscovery } from './discovery';\nimport { fromManifest } from './manifest';\nimport { getUrl } from '@/common/utils/url';\nimport type {\n  FeedDefinition,\n  PicardMicrofrontend,\n  StaticFeed,\n  DependencyInjector,\n  FeedService,\n  DiscoveryResponse,\n  PlatformService,\n} from '@/types';\n\nasync function loadFeed(\n  platform: PlatformService,\n  feed: FeedDefinition | undefined,\n  baseUrl?: string,\n): Promise<Array<PicardMicrofrontend>> {\n  if (typeof feed === 'string') {\n    const url = getUrl(feed, baseUrl);\n    const doc = await platform.loadJson<StaticFeed>(url);\n    return await loadFeed(platform, doc, url);\n  } else if (typeof feed === 'function') {\n    const doc = await feed();\n    return await loadFeed(platform, doc, baseUrl);\n  } else if (Array.isArray(feed)) {\n    return feed.map((pilet) => fromPiral(pilet, baseUrl));\n  } else if (!feed) {\n    // we just ignore a falsy value (must be 0, empty string, undefined, or null)\n  } else if (!feed || typeof feed !== 'object') {\n    console.warn(`Cannot handle a \"feed\" with the following shape:`, feed);\n  } else if ('items' in feed && Array.isArray(feed.items)) {\n    return feed.items.map((pilet) => fromPiral(pilet, baseUrl));\n  } else if ('microFrontends' in feed) {\n    return fromDiscovery(feed as DiscoveryResponse, baseUrl);\n  } else {\n    return fromManifest(feed as Record<string, string>, baseUrl);\n  }\n\n  return [];\n}\n\nexport function createFeed(injector: DependencyInjector): FeedService {\n  const { feed } = injector.get('config');\n  const scope = injector.get('scope');\n  const platform = injector.get('platform');\n  scope.loadMicrofrontends(loadFeed(platform, feed));\n  return {};\n}\n", "import type { ComponentGetter, DependencyInjector, PicardMicrofrontend } from '@/types';\n\nexport async function loadContainer(\n  injector: DependencyInjector,\n  mf: PicardMicrofrontend,\n  containers: Record<string, Promise<ComponentGetter>>,\n) {\n  const { name, format, details } = mf;\n  let container = containers[name];\n\n  if (!container) {\n    const service = injector.get(`format.${format}`);\n    container = service.createContainer(details).then(\n      async (c) => {\n        const assets = c.getAssets();\n        const components = c.getComponents();\n        const scope = injector.get('scope');\n\n        for (const asset of assets) {\n          scope.registerAsset(mf, asset);\n        }\n\n        for (const component of components) {\n          scope.registerComponent(mf, component);\n        }\n\n        return c;\n      },\n      (ex) => {\n        console.warn('Failed to load micro frontend %s:', name, ex);\n\n        return {\n          getAssets() {\n            return [];\n          },\n          getComponents() {\n            return [];\n          },\n          load() {\n            return undefined;\n          },\n        };\n      },\n    );\n    containers[name] = container;\n  }\n\n  return await container;\n}\n", "import type { LoadingQueue } from '@/types';\n\nexport function createNewQueue() {\n  const queue: LoadingQueue = {\n    current: Promise.resolve(),\n    async enqueue(cb) {\n      const next = queue.current.then(cb);\n      queue.current = next.then(() => {});\n      return await next;\n    },\n    depends(cb) {\n      return queue.current.then(cb);\n    },\n  };\n\n  return queue;\n}\n", "const createStoreImpl = (createState) => {\n  let state;\n  const listeners = /* @__PURE__ */ new Set();\n  const setState = (partial, replace) => {\n    const nextState = typeof partial === \"function\" ? partial(state) : partial;\n    if (!Object.is(nextState, state)) {\n      const previousState = state;\n      state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n      listeners.forEach((listener) => listener(state, previousState));\n    }\n  };\n  const getState = () => state;\n  const getInitialState = () => initialState;\n  const subscribe = (listener) => {\n    listeners.add(listener);\n    return () => listeners.delete(listener);\n  };\n  const api = { setState, getState, getInitialState, subscribe };\n  const initialState = state = createState(setState, getState, api);\n  return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n", "import { createStore } from 'zustand/vanilla';\nimport type { PicardState } from '@/types';\n\nexport function initializeStore(initialState: any = {}) {\n  return createStore<PicardState>(() => ({\n    ...initialState,\n    microfrontends: [...(initialState.microfrontends || [])],\n    assets: {\n      ...(initialState.assets || {}),\n    },\n    components: {\n      ...(initialState.components || {}),\n    },\n  }));\n}\n", "import type { PicardComponent, PicardState } from '@/types';\n\nexport function byCid(a: PicardComponent, b: PicardComponent) {\n  return a.id.localeCompare(b.id);\n}\n\nexport function filterItems<U extends { origin: string }, T extends Record<string, Array<U>>>(\n  items: T,\n  names: Array<string>,\n  collector: Array<U>,\n) {\n  return Object.fromEntries(\n    Object.entries(items).map(([key, values]) => [\n      key,\n      values.filter((value) => {\n        if (names.includes(value.origin)) {\n          collector.push(value);\n          return false;\n        }\n\n        return true;\n      }),\n    ]),\n  ) as T;\n}\n\nexport function mergeItems<U extends { origin: string }, T extends Record<string, Array<U>>>(\n  items: T,\n  collector: Array<U>,\n  getKey: (val: U) => string,\n) {\n  return Object.fromEntries(\n    Object.entries(items).map(([key, values]) => [key, [...values, ...collector.filter((v) => getKey(v) === key)]]),\n  ) as T;\n}\n\nexport function getActiveMfNames(state: PicardState) {\n  return state.microfrontends.filter((m) => m.flags === 0).map((m) => m.name);\n}\n", "import { getUrl } from '@/common/utils/url';\nimport { createEmptyMicrofrontend } from '@/common/utils/dto';\nimport type { StoreApi } from 'zustand/vanilla';\nimport type {\n  AssetDefinition,\n  ComponentDefinition,\n  ComponentRef,\n  PicardAsset,\n  PicardComponent,\n  PicardMicrofrontend,\n  PicardState,\n  PicardStore,\n} from '@/types';\n\nfunction generateUID(): string {\n  const a = (Math.random() * 46656) | 0;\n  const b = (Math.random() * 46656) | 0;\n  const first = ('000' + a.toString(36)).slice(-3);\n  const second = ('000' + b.toString(36)).slice(-3);\n  return first + second;\n}\n\nexport function registerAsset(\n  store: StoreApi<PicardState>,\n  mf: PicardMicrofrontend,\n  definition: AssetDefinition,\n): PicardAsset {\n  const id = generateUID();\n  const { url, type } = definition;\n  const asset = {\n    id,\n    url,\n    origin: mf.name,\n    type,\n  };\n\n  store.setState((state) => ({\n    assets: {\n      ...state.assets,\n      [type]: [...(state.assets[type] || []), asset],\n    },\n  }));\n\n  mf.assets.push(id);\n  return asset;\n}\n\nexport function registerComponent(\n  store: StoreApi<PicardState>,\n  mf: PicardMicrofrontend,\n  definition: ComponentDefinition,\n): PicardComponent {\n  const id = generateUID();\n  const { name, meta, type } = definition;\n  const component = {\n    id,\n    name,\n    meta,\n    type,\n    origin: mf.name,\n  };\n\n  store.setState((state) => ({\n    components: {\n      ...state.components,\n      [name]: [...(state.components[name] || []), component],\n    },\n  }));\n\n  mf.components.push(id);\n  return component;\n}\n\nexport function findComponent(store: StoreApi<PicardState>, name: string, origin: string): PicardComponent | undefined {\n  const components = store.getState().components[name] || [];\n  return components.find((m) => m.origin === origin);\n}\n\nexport function findMicrofrontend(scope: PicardStore, origin: string): PicardMicrofrontend | undefined {\n  return scope.readState().microfrontends.find((m) => m.name === origin);\n}\n\nexport function retrieveAsset(store: StoreApi<PicardState>, id: string): PicardAsset | undefined {\n  if (typeof id === 'string') {\n    const { assets } = store.getState();\n\n    for (const list of Object.values(assets)) {\n      const asset = list.find((m) => m.id === id);\n\n      if (asset) {\n        return asset;\n      }\n    }\n  }\n\n  return undefined;\n}\n\nexport function retrieveComponent(store: StoreApi<PicardState>, id: string): PicardComponent | undefined {\n  if (typeof id === 'string') {\n    const { components } = store.getState();\n\n    for (const list of Object.values(components)) {\n      const component = list.find((m) => m.id === id);\n\n      if (component) {\n        return component;\n      }\n    }\n  }\n\n  return undefined;\n}\n\nexport function createMicrofrontend(ref: ComponentRef): PicardMicrofrontend {\n  const { source, format } = ref;\n\n  if (format === 'module') {\n    const { remoteName, remoteType = 'var' } = ref;\n    return createEmptyMicrofrontend(source, format, source, {\n      id: remoteName,\n      type: remoteType,\n      url: getUrl(source),\n    });\n  } else if (format === 'native') {\n    return createEmptyMicrofrontend(source, format, source, {\n      url: getUrl(source),\n    });\n  } else if (format === 'pilet') {\n    return createEmptyMicrofrontend(source, format, source, {\n      url: getUrl(source),\n    });\n  } else {\n    return undefined;\n  }\n}\n", "import { loadContainer } from './container';\nimport { createNewQueue } from './queue';\nimport { initializeStore } from './store';\nimport { getActiveMfNames, filterItems, mergeItems, byCid } from './utils';\nimport {\n  registerComponent,\n  retrieveComponent,\n  createMicrofrontend,\n  findMicrofrontend,\n  registerAsset,\n  retrieveAsset,\n  findComponent,\n} from './actions';\nimport type { ComponentGetter, DependencyInjector, PicardAsset, PicardComponent, PicardStore } from '@/types';\n\n/**\n * Creates a new scope for obtaining MF information.\n */\nexport function createPicardScope(injector: DependencyInjector) {\n  const { state: initialState } = injector.get('config');\n  const events = injector.get('events');\n  const containers: Record<string, Promise<ComponentGetter>> = {};\n  const store = initializeStore(initialState);\n  const queue = createNewQueue();\n  const disabledAssets: Array<PicardAsset> = [];\n  const disabledComponents: Array<PicardComponent> = [];\n\n  const unsubscribe = store.subscribe((currState, prevState) => {\n    if (currState.microfrontends !== prevState.microfrontends) {\n      const currMfs = getActiveMfNames(currState);\n      const prevMfs = getActiveMfNames(prevState);\n      const added = currMfs.filter((m) => !prevMfs.includes(m));\n      const removed = prevMfs.filter((m) => !currMfs.includes(m));\n\n      events.emit('updated-microfrontends', {\n        added,\n        removed,\n      });\n    }\n  });\n\n  const disableMicrofrontends = (names: Array<string>, remove = false) => {\n    const flags = remove ? 2 : 1;\n\n    store.setState((state) => ({\n      ...state,\n      assets: filterItems(state.assets, names, !remove ? disabledAssets : []),\n      components: filterItems(state.components, names, !remove ? disabledComponents : []),\n      microfrontends: state.microfrontends.map((m) => (names.includes(m.name) ? { ...m, flags } : m)),\n    }));\n  };\n\n  const enableMicrofrontend = (name: string) => {\n    store.setState((state) => ({\n      ...state,\n      assets: mergeItems(state.assets, disabledAssets, (a) => a.type),\n      components: mergeItems(state.components, disabledComponents, (c) => c.name),\n      microfrontends: state.microfrontends.map((m) => (m.name === name ? { ...m, flags: 0 } : m)),\n    }));\n  };\n\n  const scope: PicardStore = {\n    dispose() {\n      unsubscribe();\n    },\n    saveSnapshot() {\n      return JSON.stringify(store.getState());\n    },\n    readState() {\n      return store.getState();\n    },\n    subscribe(listener) {\n      return store.subscribe(listener);\n    },\n    registerAsset(mf, asset) {\n      return registerAsset(store, mf, asset);\n    },\n    registerComponent(mf, component) {\n      return registerComponent(store, mf, component);\n    },\n    retrieveComponent(id) {\n      return retrieveComponent(store, id);\n    },\n    retrieveAsset(id) {\n      return retrieveAsset(store, id);\n    },\n    loadAssets(type) {\n      return queue.depends(() => {\n        return scope.readState().assets[type] || [];\n      });\n    },\n    loadMicrofrontends(loader) {\n      return queue.enqueue(async () => {\n        const mfs = await loader;\n        await Promise.all(mfs.filter((mf) => !mf.flags).map((mf) => loadContainer(injector, mf, containers)));\n        scope.appendMicrofrontends(mfs);\n      });\n    },\n    getComponent(ref) {\n      return queue.depends(async () => {\n        const { cid, name, source } = ref;\n\n        if (cid) {\n          const component = scope.retrieveComponent(cid);\n          const mf = findMicrofrontend(scope, component.origin);\n\n          if (mf && !mf.flags) {\n            const container = await loadContainer(injector, mf, containers);\n            const result = await container.load(component.name);\n\n            return {\n              ...component,\n              exports: result,\n            };\n          }\n        } else if (name && source) {\n          const existing = findMicrofrontend(scope, source);\n          const mf = existing || createMicrofrontend(ref);\n\n          if (mf && !mf.flags) {\n            const container = await loadContainer(injector, mf, containers);\n            const result = await container.load(name);\n            const origin = mf.name;\n\n            if (result && !findComponent(store, name, origin)) {\n              registerComponent(store, mf, { name });\n            }\n\n            if (!existing) {\n              scope.appendMicrofrontend(mf);\n            }\n\n            return {\n              ...findComponent(store, name, origin),\n              exports: result,\n            };\n          }\n        }\n\n        return undefined;\n      });\n    },\n    loadComponents(name, options) {\n      return queue.depends(async () => {\n        const result: Array<PicardComponent> = [];\n        const { microfrontends } = store.getState();\n        const orderBy = options?.orderBy || 'none';\n        const mfs = microfrontends.filter((mf) => !mf.flags);\n\n        if (orderBy === 'origin') {\n          mfs.sort((a, b) => a.name.localeCompare(b.name));\n        }\n\n        await Promise.all(\n          mfs.map(async (mf) => {\n            const container = await loadContainer(injector, mf, containers);\n            const { components } = store.getState();\n            let component = components[name]?.find((m) => m.origin === mf.name);\n\n            if (!component) {\n              if (await container.load(name)) {\n                component = registerComponent(store, mf, { name });\n              } else {\n                return;\n              }\n            }\n\n            result.push(component);\n          }),\n        );\n\n        if (orderBy === 'cid') {\n          result.sort(byCid);\n        }\n\n        if (options?.reverse) {\n          result.reverse();\n        }\n\n        return result;\n      });\n    },\n    appendMicrofrontend(mf) {\n      scope.appendMicrofrontends([mf]);\n    },\n    appendMicrofrontends(mfs) {\n      if (mfs.length > 0) {\n        store.setState((state) => ({\n          ...state,\n          microfrontends: [...state.microfrontends, ...mfs],\n        }));\n      }\n    },\n    toggleMicrofrontend(origin) {\n      const { microfrontends } = store.getState();\n      const current = microfrontends.find((m) => m.name === origin);\n\n      if (current?.flags === 0) {\n        disableMicrofrontends([origin]);\n      } else if (current?.flags === 1) {\n        enableMicrofrontend(origin);\n      }\n    },\n    removeMicrofrontend(origin) {\n      scope.removeMicrofrontends([origin]);\n    },\n    removeMicrofrontends(origins) {\n      if (origins.length > 0) {\n        disableMicrofrontends(origins, true);\n      }\n    },\n    updateMicrofrontend(origin, details) {\n      store.setState((state) => ({\n        microfrontends: state.microfrontends.map((item: any) =>\n          item.name === origin\n            ? {\n                ...item,\n                ...details,\n              }\n            : item,\n        ),\n      }));\n    },\n  };\n\n  return scope;\n}\n", "import type { DependencyInjector, ServiceCreator, Services } from '@/types';\n\ntype ServiceInstances = {\n  [TService in keyof Services]: Array<Services[TService]>;\n};\n\nfunction makeServices<TService extends keyof Services>(\n  serviceDefinitions: ServiceDefinitions,\n  name: TService,\n  injector: DependencyInjector,\n): Array<any> {\n  const definition = serviceDefinitions[name];\n\n  if (Array.isArray(definition)) {\n    return definition.map((d) => d(injector));\n  } else if (typeof definition === 'function') {\n    return [definition(injector)];\n  }\n\n  return [];\n}\n\nexport type ServiceDefinitions = {\n  [TService in keyof Services]: ServiceCreator<TService> | Array<ServiceCreator<TService>>;\n};\n\nexport function createInjector(serviceDefinitions: ServiceDefinitions) {\n  const instances: Partial<ServiceInstances> = {};\n  const injector: DependencyInjector = {\n    get(name) {\n      return injector.getAll(name)[0];\n    },\n    getAll(name) {\n      const instance = instances[name];\n\n      if (!instance) {\n        const services = makeServices(serviceDefinitions, name, injector);\n        instances[name] = services;\n        return services;\n      }\n\n      return instance;\n    },\n    instantiate(name) {\n      injector.getAll(name);\n      return injector;\n    }\n  };\n\n  return injector;\n}\n", "type Encode = (value: string) => string;\ntype Decode = (value: string) => string;\ntype Token = string | Key;\ntype Match<P extends ParamData> = false | MatchResult<P>;\ntype MatchFunction<P extends ParamData> = ((path: string) => Match<P>) & { re: RegExp };\ntype ParamData = Partial<Record<string, string | string[]>>;\ntype TokenType =\n  | '{'\n  | '}'\n  | ';'\n  | '*'\n  | '+'\n  | '?'\n  | 'NAME'\n  | 'PATTERN'\n  | 'CHAR'\n  | 'ESCAPED'\n  | 'END'\n  // Reserved for use.\n  | '!'\n  | '@'\n  | ',';\n\ninterface ParseOptions {\n  delimiter?: string;\n  encodePath?: Encode;\n}\n\ninterface PathOptions {\n  sensitive?: boolean;\n}\n\ninterface MatchOptions extends PathOptions {\n  decode?: Decode | false;\n  end?: boolean;\n}\n\ninterface LexToken {\n  type: TokenType;\n  index: number;\n  value: string;\n}\n\ninterface MatchResult<P extends ParamData> {\n  path: string;\n  params: P;\n}\n\ninterface Key {\n  name: string;\n  prefix?: string;\n  suffix?: string;\n  pattern?: string;\n  modifier?: string;\n  separator?: string;\n}\n\nconst DEFAULT_DELIMITER = '/';\nconst ID_START = /^[$_\\p{ID_Start}]$/u;\nconst ID_CONTINUE = /^[$\\u200c\\u200d\\p{ID_Continue}]$/u;\nconst SIMPLE_TOKENS: Record<string, TokenType> = {\n  '!': '!',\n  '@': '@',\n  ';': ';',\n  ',': ',',\n  '*': '*',\n  '+': '+',\n  '?': '?',\n  '{': '{',\n  '}': '}',\n};\n\nfunction NOOP_VALUE(value: string) {\n  return value;\n}\n\nfunction isEnd(input: string, match: string) {\n  return input.length === match.length;\n}\n\nfunction isDelimiterOrEnd(delimiter: string) {\n  return (input: string, match: string) =>\n    match.length === input.length || input.slice(match.length, match.length + delimiter.length) === delimiter;\n}\n\nfunction lexer(str: string) {\n  const chars = [...str];\n  const tokens: LexToken[] = [];\n  let i = 0;\n\n  while (i < chars.length) {\n    const value = chars[i];\n    const type = SIMPLE_TOKENS[value];\n\n    if (type) {\n      tokens.push({ type, index: i++, value });\n      continue;\n    }\n\n    if (value === '\\\\') {\n      tokens.push({ type: 'ESCAPED', index: i++, value: chars[i++] });\n      continue;\n    }\n\n    if (value === ':') {\n      let name = '';\n\n      if (ID_START.test(chars[++i])) {\n        name += chars[i];\n        while (ID_CONTINUE.test(chars[++i])) {\n          name += chars[i];\n        }\n      } else if (chars[i] === '\"') {\n        let pos = i;\n\n        while (i < chars.length) {\n          if (chars[++i] === '\"') {\n            i++;\n            pos = 0;\n            break;\n          }\n\n          if (chars[i] === '\\\\') {\n            name += chars[++i];\n          } else {\n            name += chars[i];\n          }\n        }\n\n        if (pos) {\n          throw new TypeError(`Unterminated quote at ${pos}`);\n        }\n      }\n\n      if (!name) {\n        throw new TypeError(`Missing parameter name at ${i}`);\n      }\n\n      tokens.push({ type: 'NAME', index: i, value: name });\n      continue;\n    }\n\n    if (value === '(') {\n      const pos = i++;\n      let count = 1;\n      let pattern = '';\n\n      if (chars[i] === '?') {\n        throw new TypeError(`Pattern cannot start with \"?\" at ${i}`);\n      }\n\n      while (i < chars.length) {\n        if (chars[i] === '\\\\') {\n          pattern += chars[i++] + chars[i++];\n          continue;\n        }\n\n        if (chars[i] === ')') {\n          count--;\n          if (count === 0) {\n            i++;\n            break;\n          }\n        } else if (chars[i] === '(') {\n          count++;\n          if (chars[i + 1] !== '?') {\n            throw new TypeError(`Capturing groups are not allowed at ${i}`);\n          }\n        }\n\n        pattern += chars[i++];\n      }\n\n      if (count) {\n        throw new TypeError(`Unbalanced pattern at ${pos}`);\n      }\n\n      if (!pattern) {\n        throw new TypeError(`Missing pattern at ${pos}`);\n      }\n\n      tokens.push({ type: 'PATTERN', index: i, value: pattern });\n      continue;\n    }\n\n    if (value === ')') {\n      throw new TypeError(`Unmatched ) at ${i}`);\n    }\n\n    tokens.push({ type: 'CHAR', index: i, value: chars[i++] });\n  }\n\n  tokens.push({ type: 'END', index: i, value: '' });\n\n  return new Iter(tokens);\n}\n\nclass Iter {\n  index = 0;\n\n  constructor(private tokens: LexToken[]) {}\n\n  peek(): LexToken {\n    return this.tokens[this.index];\n  }\n\n  tryConsume(type: LexToken['type']): string | undefined {\n    const token = this.peek();\n    if (token.type !== type) return;\n    this.index++;\n    return token.value;\n  }\n\n  consume(type: LexToken['type']): string {\n    const value = this.tryConsume(type);\n    if (value !== undefined) return value;\n    const { type: nextType, index } = this.peek();\n    throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}`);\n  }\n\n  text(): string {\n    let result = '';\n    let value: string | undefined;\n    while ((value = this.tryConsume('CHAR') || this.tryConsume('ESCAPED'))) {\n      result += value;\n    }\n    return result;\n  }\n\n  modifier(): string | undefined {\n    return this.tryConsume('?') || this.tryConsume('*') || this.tryConsume('+');\n  }\n}\n\nclass TokenData {\n  constructor(\n    public readonly tokens: Token[],\n    public readonly delimiter: string,\n  ) {}\n}\n\nfunction parse(str: string, options: ParseOptions = {}): TokenData {\n  const { encodePath = NOOP_VALUE, delimiter = encodePath(DEFAULT_DELIMITER) } = options;\n  const tokens: Token[] = [];\n  const it = lexer(str);\n  let key = 0;\n\n  do {\n    const path = it.text();\n    if (path) tokens.push(encodePath(path));\n\n    const name = it.tryConsume('NAME');\n    const pattern = it.tryConsume('PATTERN');\n\n    if (name || pattern) {\n      tokens.push({\n        name: name || String(key++),\n        pattern,\n      });\n\n      const next = it.peek();\n      if (next.type === '*') {\n        throw new TypeError(`Unexpected * at ${next.index}, you probably want \\`/*\\` or \\`{/:foo}*\\``);\n      }\n\n      continue;\n    }\n\n    const asterisk = it.tryConsume('*');\n    if (asterisk) {\n      tokens.push({\n        name: String(key++),\n        pattern: `${negate(escape(delimiter))}*`,\n        modifier: '*',\n        separator: delimiter,\n      });\n      continue;\n    }\n\n    const open = it.tryConsume('{');\n    if (open) {\n      const prefix = it.text();\n      const name = it.tryConsume('NAME');\n      const pattern = it.tryConsume('PATTERN');\n      const suffix = it.text();\n      const separator = it.tryConsume(';') && it.text();\n\n      it.consume('}');\n\n      const modifier = it.modifier();\n\n      tokens.push({\n        name: name || (pattern ? String(key++) : ''),\n        prefix: encodePath(prefix),\n        suffix: encodePath(suffix),\n        pattern,\n        modifier,\n        separator,\n      });\n      continue;\n    }\n\n    it.consume('END');\n    break;\n  } while (true);\n\n  return new TokenData(tokens, delimiter);\n}\n\nfunction isRepeat(key: Key) {\n  return key.modifier === '+' || key.modifier === '*';\n}\n\nfunction $match<P extends ParamData>(data: TokenData, options: MatchOptions = {}): MatchFunction<P> {\n  const { decode = decodeURIComponent, end = true } = options;\n  const re = tokensToRegexp(data, options);\n\n  const decoders = re.keys.map((key) => {\n    if (decode && (key.modifier === '+' || key.modifier === '*')) {\n      const { prefix = '', suffix = '', separator = suffix + prefix } = key;\n      return (value: string) => value.split(separator).map(decode);\n    }\n\n    return decode || NOOP_VALUE;\n  });\n\n  const validate = end ? isEnd : isDelimiterOrEnd(data.delimiter);\n\n  return Object.assign(\n    function match(input: string) {\n      const m = re.exec(input);\n      if (!m) return false;\n\n      const { 0: path } = m;\n      if (!validate(input, path)) return false;\n      const params = Object.create(null);\n\n      for (let i = 1; i < m.length; i++) {\n        if (m[i] === undefined) continue;\n\n        const key = re.keys[i - 1];\n        const decoder = decoders[i - 1];\n        params[key.name] = decoder(m[i]);\n      }\n\n      return { path, params };\n    },\n    { re },\n  );\n}\n\nfunction match<P extends ParamData>(path: string, options: MatchOptions & ParseOptions = {}): MatchFunction<P> {\n  return $match(parse(path, options), options);\n}\n\nfunction escape(str: string) {\n  return str.replace(/[.+*?^${}()[\\]|/\\\\]/g, '\\\\$&');\n}\n\nfunction toFlags(options: { sensitive?: boolean }) {\n  return options.sensitive ? 's' : 'is';\n}\n\nfunction tokensToRegexp(data: TokenData, options: PathOptions) {\n  const flags = toFlags(options);\n  const keys: Key[] = [];\n  const sources = toRegExpSource(data, keys);\n  const regexp = new RegExp(`^${sources.join('')}`, flags);\n  return Object.assign(regexp, { keys });\n}\n\nfunction toRegExpSource(data: TokenData, keys: Key[]): string[] {\n  const delim = escape(data.delimiter);\n  const sources = Array(data.tokens.length);\n  let backtrack = '';\n\n  let i = data.tokens.length;\n\n  while (i--) {\n    const token = data.tokens[i];\n\n    if (typeof token === 'string') {\n      sources[i] = backtrack = escape(token);\n      continue;\n    }\n\n    const { prefix = '', suffix = '', separator = suffix + prefix, modifier = '' } = token;\n\n    const pre = escape(prefix);\n    const post = escape(suffix);\n\n    if (token.name) {\n      let pattern = token.pattern || '';\n\n      keys.unshift(token);\n\n      if (isRepeat(token)) {\n        const mod = modifier === '*' ? '?' : '';\n        const sep = escape(separator);\n\n        if (!sep) {\n          throw new TypeError(`Missing separator for \"${token.name}\"`);\n        }\n\n        pattern ||= `${negate(delim, sep, post || backtrack)}+`;\n        sources[i] = `(?:${pre}((?:${pattern})(?:${sep}(?:${pattern}))*)${post})${mod}`;\n      } else {\n        pattern ||= `${negate(delim, post || backtrack)}+`;\n        sources[i] = `(?:${pre}(${pattern})${post})${modifier}`;\n      }\n\n      backtrack = pre || pattern;\n    } else {\n      sources[i] = `(?:${pre}${post})${modifier}`;\n      backtrack = `${pre}${post}`;\n    }\n  }\n\n  return sources;\n}\n\nfunction negate(...args: string[]) {\n  const values = Array.from(new Set(args)).filter(Boolean);\n  return `(?:(?!${values.join('|')}).)`;\n}\n\nfunction makeMatchers(routes: Array<string>) {\n  return routes.map((route) => match(route));\n}\n\nexport function createRouteMatcher(getRoutes: () => Array<string>) {\n  const allRoutes = [];\n  const matchers = makeMatchers(allRoutes);\n\n  return (path: string): [route: string, params: Record<string, string | Array<string>>] | undefined => {\n    if (allRoutes.length === 0) {\n      const newRoutes = getRoutes();\n      allRoutes.push(...newRoutes);\n      matchers.push(...makeMatchers(newRoutes));\n    }\n\n    for (let i = 0; i < matchers.length; i++) {\n      const matcher = matchers[i];\n      const result = matcher(path);\n\n      if (result) {\n        return [allRoutes[i], result.params];\n      }\n    }\n\n    return undefined;\n  };\n}\n", "import { createRouteMatcher } from '@/common/utils/matcher';\nimport type { DependencyInjector, RouterService } from '@/types';\n\nconst pageQualifier = 'page:';\n\nexport function createRouter(injector: DependencyInjector): RouterService {\n  const scope = injector.get('scope');\n\n  const findRoutes = () => {\n    const state = scope.readState();\n    return Object.entries(state.components)\n      .filter(([k, v]) => v.length && k.startsWith(pageQualifier))\n      .map(([k]) => k.substring(pageQualifier.length));\n  };\n\n  const matcher = createRouteMatcher(findRoutes);\n\n  return {\n    dispose() {},\n    findRoutes,\n    navigate() {},\n    matchRoute(name) {\n      if (name.startsWith(pageQualifier)) {\n        const route = name.substring(pageQualifier.length);\n        const result = matcher(route);\n\n        if (result) {\n          const [path, data] = result;\n          return {\n            name: `${pageQualifier}${path}`,\n            data,\n          };\n        }\n      }\n\n      return undefined;\n    },\n  };\n}\n", "// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134\n\n/**\n * C1 Unicode control character reference replacements (code points 128\u2013159).\n * Index i gives the replacement for code point 128+i; 0 means \"no replacement\".\n */\nconst c1: number[] = [\n    8364, 0, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, 8249, 338, 0,\n    381, 0, 0, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250,\n    339, 0, 382, 376,\n];\n\n/**\n * True for NUL, UTF-16 surrogates, and values past U+10FFFF.\n * @param codePoint Unicode code point to check.\n */\nfunction isInvalidCodePoint(codePoint: number): boolean {\n    return (\n        codePoint === 0 ||\n        (codePoint >= 0xd8_00 && codePoint <= 0xdf_ff) ||\n        codePoint > 0x10_ff_ff\n    );\n}\n\n/**\n * Replace the given code point with U+FFFD if it is NUL (0), a surrogate, or\n * outside the valid Unicode range. Code points in the C1 controls range\n * (128\u2013159) are remapped to their Windows-1252 equivalents, following the\n * HTML spec. All other code points are returned unchanged.\n * @param codePoint Unicode code point to convert.\n */\nexport function replaceCodePoint(codePoint: number): number {\n    if (isInvalidCodePoint(codePoint)) {\n        return 0xff_fd;\n    }\n\n    if (codePoint >= 128 && codePoint <= 159) {\n        return c1[codePoint - 128] || codePoint;\n    }\n\n    return codePoint;\n}\n\n/**\n * XML numeric character references are the referenced Unicode code point.\n * Invalid values still become U+FFFD; the HTML Windows-1252 C1 remap is not\n * applied.\n * @see https://www.w3.org/TR/xml/#NT-CharRef\n * @param codePoint Unicode code point to convert.\n */\nexport function replaceCodePointXML(codePoint: number): number {\n    return isInvalidCodePoint(codePoint) ? 0xff_fd : codePoint;\n}\n\n/**\n * Convert the code point of a decoded numeric entity to a string, replacing\n * invalid values.\n *\n * Fast path for plain BMP code points: [1..0x7F] and [0xA0..0xD7FF] pass\n * `replaceCodePoint` unchanged (no NUL, C1 remap, surrogate, or out-of-range\n * handling) and fit a single charCode. 0xd760 = 0xD800 (the first surrogate)\n * - 0xA0.\n * @param codePoint Unicode code point to convert.\n */\nexport function codePointToString(codePoint: number): string {\n    return (codePoint - 1) >>> 0 < 0x7f || (codePoint - 0xa0) >>> 0 < 0xd7_60\n        ? String.fromCharCode(codePoint)\n        : String.fromCodePoint(replaceCodePoint(codePoint));\n}\n", "/*\n * Inverse of the encoder's SAFE alphabet (0x21..0x7E minus 0x22, 0x24, 0x5C),\n * precomputed once at module load. Entries for excluded chars stay 0 but\n * are never read.\n */\nconst BASE91_INVERSE = /* #__PURE__ */ (() => {\n    const table = new Uint8Array(127);\n    let code = 0;\n    for (let char = 0x21; char <= 0x7e; char++) {\n        if (char !== 0x22 && char !== 0x24 && char !== 0x5c) {\n            table[char] = code++;\n        }\n    }\n    return table;\n})();\n\n/**\n * Decode a dictionary-encoded trie string back into its Uint16Array.\n *\n * Stream layout (consumed in this order):\n *   1. dict1 atoms \u2014 `dict1AtomCount` uint16 values, delta+RLE encoded.\n *   2. dict2 atoms \u2014 `atomCount - dict1AtomCount` values, delta+RLE.\n *   3. dict2 ngrams \u2014 `ngramCount - (dictSize - dict1AtomCount)` entries,\n *      each a pair of slot codes that resolve to earlier slots.\n *   4. dict1 ngrams \u2014 `dictSize - dict1AtomCount` entries, same shape.\n *   5. data \u2014 slot codes, each expanding to one or more uint16 values.\n *\n * Codes use a 91-char base (printable ASCII minus `\"`, `$`, `\\`):\n *   - char1 < dictSize  \u2192 1-char code, slot = char1\n *   - char1 \u2265 dictSize  \u2192 2-char code, slot = dictSize + (char1 - dictSize)*91 + char2\n *\n * Slot index \u2192 token kind:\n *   [0, A)                  dict1 atoms     (1-char codes)\n *   [A, dictSize)           dict1 ngrams    (1-char codes)\n *   [dictSize, dictSize+D)  dict2 atoms     (2-char codes)\n *   [dictSize+D, end)       dict2 ngrams    (2-char codes)\n *\n * Both atom dicts decode before any ngram, and dict2 ngrams decode before\n * dict1 ngrams. So every ngram entry references slots whose contents are\n * already filled \u2014 no forward references to handle.\n *\n * This runs on library import. Flat typed arrays store each slot as either\n * a plain value (`single`, covering every atom) or a range in a shared\n * `pool` (ngrams).\n * @param input Packed trie string.\n * @param resultLength Expected number of uint16 values in the output.\n * @param atomCount Total number of distinct uint16 values in the trie.\n * @param dict1AtomCount Atoms in the 1-char range (`A` above).\n * @param ngramCount Total number of ngram entries (dict1 + dict2).\n * @param dictSize Number of 1-char code slots; the rest of `BASE - dictSize`\n *   first-byte values are 2-char codes.\n */\nexport function decodeTrieDict(\n    input: string,\n    resultLength: number,\n    atomCount: number,\n    dict1AtomCount: number,\n    ngramCount: number,\n    dictSize: number,\n): Uint16Array {\n    const base = 91;\n    const inputLength = input.length;\n    // For 2-char codes, slot = char1 * base - twoCharBias + char2.\n    const twoCharBias = dictSize * (base - 1);\n\n    let pos = 0;\n\n    /** Read one slot code at `pos` and return its slot index, advancing pos. */\n    const readSlotCode = (): number => {\n        const c1 = BASE91_INVERSE[input.charCodeAt(pos++)];\n        return c1 < dictSize\n            ? c1\n            : c1 * base - twoCharBias + BASE91_INVERSE[input.charCodeAt(pos++)];\n    };\n\n    const dict2AtomCount = atomCount - dict1AtomCount;\n    const slotCount = atomCount + ngramCount;\n\n    /*\n     * Per-slot contents: atoms (always a single value) live directly in\n     * `single`; ngram slots hold -1 there and expand to\n     * `pool[start[slot] .. start[slot] + length[slot])`.\n     */\n    const single = new Int32Array(slotCount);\n    single.fill(-1, dict1AtomCount, dictSize);\n    single.fill(-1, dictSize + dict2AtomCount, slotCount);\n    const start = new Int32Array(slotCount);\n    const length = new Int32Array(slotCount);\n\n    /**\n     * Decode `count` ascending uint16 values from a delta+RLE stream into\n     * `single[off..off+count)`.\n     *\n     *   code < 89   \u2192 delta = code\n     *   code == 89  \u2192 run-length: next char encodes runLength-2; emit `runLength` consecutive +1 values\n     *   code == 90, next < 90  \u2192 escape: delta = 89 + next * BASE + after-next\n     *   code == 90, next == 90 \u2192 double-escape: extra char for very large deltas\n     * @param count\n     * @param off\n     */\n    function decodeDelta(count: number, off: number): void {\n        let previous = 0;\n        let slot = off;\n        const end = off + count;\n        while (slot < end) {\n            const code = BASE91_INVERSE[input.charCodeAt(pos++)];\n            if (code < 89) {\n                previous += code;\n                single[slot++] = previous;\n            } else if (code === 89) {\n                let runLength = BASE91_INVERSE[input.charCodeAt(pos++)] + 2;\n                while (runLength--) single[slot++] = ++previous;\n            } else {\n                const next = BASE91_INVERSE[input.charCodeAt(pos++)];\n                previous +=\n                    89 +\n                    // eslint-disable-next-line unicorn/prefer-minimal-ternary -- branches read a different number of side-effecting input bytes\n                    (next < 90\n                        ? next * base + BASE91_INVERSE[input.charCodeAt(pos++)]\n                        : BASE91_INVERSE[input.charCodeAt(pos++)] * 8281 +\n                          BASE91_INVERSE[input.charCodeAt(pos++)] * base +\n                          BASE91_INVERSE[input.charCodeAt(pos++)]);\n                single[slot++] = previous;\n            }\n        }\n    }\n\n    // Streams 1 & 2: atoms decoded into their slot ranges.\n    decodeDelta(dict1AtomCount, 0);\n    decodeDelta(dict2AtomCount, dictSize);\n\n    /*\n     * Streams 3 & 4 are read in two passes: first collect every ngram's two\n     * references and derive its expanded length (each ref resolves to an earlier\n     * slot, so lengths are already known), which sizes the shared pool.\n     * Pool ranges are handed out in decode order, so the second pass fills\n     * the pool contiguously with a single write cursor.\n     */\n    const references = new Int32Array(ngramCount * 2);\n    let poolSize = 0;\n    let ngramIndex = 0;\n\n    /**\n     * Read `count` ngram entries (each = 2 slot-code references) for the slots\n     * starting at `startSlot`, recording references and assigning pool ranges.\n     * @param count\n     * @param startSlot\n     */\n    function readNgramReferences(count: number, startSlot: number): void {\n        for (let index = 0; index < count; index++) {\n            const slot = startSlot + index;\n            const a = readSlotCode();\n            const b = readSlotCode();\n            references[ngramIndex * 2] = a;\n            references[ngramIndex * 2 + 1] = b;\n            ngramIndex += 1;\n            start[slot] = poolSize;\n            const entryLength =\n                (single[a] < 0 ? length[a] : 1) +\n                (single[b] < 0 ? length[b] : 1);\n            length[slot] = entryLength;\n            poolSize += entryLength;\n        }\n    }\n    readNgramReferences(\n        ngramCount - dictSize + dict1AtomCount,\n        dictSize + dict2AtomCount,\n    );\n    readNgramReferences(dictSize - dict1AtomCount, dict1AtomCount);\n\n    // Second pass: concatenate each ngram's two halves into the pool.\n    const pool = new Uint16Array(poolSize);\n    let write = 0;\n    for (let index = 0; index < ngramIndex; index++) {\n        for (let half = 0; half < 2; half++) {\n            const source = references[index * 2 + half];\n            const value = single[source];\n            if (value < 0) {\n                let read = start[source];\n                const readEnd = read + length[source];\n                while (read < readEnd) pool[write++] = pool[read++];\n            } else {\n                pool[write++] = value;\n            }\n        }\n    }\n\n    // Stream 5: data. Each code expands to its slot's stored values.\n    const out = new Uint16Array(resultLength);\n    let outIndex = 0;\n    while (pos < inputLength) {\n        let slot = BASE91_INVERSE[input.charCodeAt(pos++)];\n        if (slot >= dictSize) {\n            slot =\n                slot * base -\n                twoCharBias +\n                BASE91_INVERSE[input.charCodeAt(pos++)];\n        }\n        const value = single[slot];\n        if (value < 0) {\n            let read = start[slot];\n            const readEnd = read + length[slot];\n            while (read < readEnd) out[outIndex++] = pool[read++];\n        } else {\n            out[outIndex++] = value;\n        }\n    }\n    return out;\n}\n", "// Generated using scripts/write-decode-map.ts\n\nimport { decodeTrieDict } from \"../internal/decode-shared.js\";\n/** Packed HTML decode trie data. */\nexport const htmlDecodeTree: Uint16Array = /* #__PURE__ */ decodeTrieDict(\n    \"!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#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C::aY?C2F|-:2<BaY?C2F|.5Jvk!a)javYrquJu3x4ia#T)2@SmYM?C2F|HAxPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P\",\n    13_494,\n    2713,\n    49,\n    25,\n    61,\n);\n", "// Generated using scripts/write-decode-map.ts\n\n/** Packed XML decode trie data. */\nexport const xmlDecodeTree: Uint16Array = /* #__PURE__ */ new Uint16Array([\n    512, 26_465, 29_036, 7, 0, 2, 4, 116, 24_638, 116, 24_636, 8693, 29_807,\n    24_610, 621, 1, 0, 0, 3, 112, 24_614, 111, 115, 24_615,\n]);\n", "/**\n * Bit flags & masks for the binary trie encoding used for entity decoding.\n *\n * The trie is a flat `Uint16Array`. Every node starts with one header word:\n *\n *   15..14 VALUE_LENGTH   Number of words the value occupies, +1.\n *                         0 = no value; 1 = value inline in bits 12..0;\n *                         2/3 = value in the 1/2 words after the header.\n *   13     FLAG13         If VALUE_LENGTH > 0: semicolon required (\"strict\"\n *                         entity; `;` is never stored as a branch).\n *                         If VALUE_LENGTH == 0: this node is a compact run.\n *   12..7  BRANCH_LENGTH  Number of branches (or run length for runs).\n *   6..0   JUMP_TABLE     Jump-table offset / single-branch char / first\n *                         run char (see below).\n *\n * Branch data follows the header and any value words. Its shape is selected\n * by (JUMP_TABLE, BRANCH_LENGTH) in the header:\n *\n *   Single branch  JUMP_TABLE = the only child's char, BRANCH_LENGTH = 0.\n *                  No branch words; the child node follows immediately.\n *   Jump table     JUMP_TABLE = first covered char (> 0), BRANCH_LENGTH =\n *                  table length. One word per covered char: 0 = no branch,\n *                  otherwise the child's offset from the END of the table,\n *                  +1 (so 0 stays the no-branch sentinel).\n *   Dictionary     JUMP_TABLE = 0, BRANCH_LENGTH = number of branches.\n *                  ceil(n/2) words of sorted keys packed two per word\n *                  (low byte first), then n pointer words storing the\n *                  child's offset from the END of the branch data.\n *   Compact run    VALUE_LENGTH = 0, FLAG13 set. BRANCH_LENGTH = run\n *                  length (3..63), JUMP_TABLE = first char; remaining run\n *                  chars packed two per word after the header. The target\n *                  node follows the packed words immediately.\n *\n * Pointers are end-relative (rather than relative to the pointer's own\n * position) because that makes the common \"child encoded right after the\n * branch data\" case a small constant, which compresses far better. Offsets\n * to already-encoded (shared) nodes wrap via uint16 modulo arithmetic; the\n * decoder masks navigation results with `& 0xff_ff` to match.\n */\nexport const enum BinTrieFlags {\n    VALUE_LENGTH = 0b1100_0000_0000_0000,\n    FLAG13 = 0b0010_0000_0000_0000,\n    BRANCH_LENGTH = 0b0001_1111_1000_0000,\n    JUMP_TABLE = 0b0000_0000_0111_1111,\n    /** Bits 12..0: the inline value of a VALUE_LENGTH = 1 header word. */\n    VALUE_MASK = 0b0001_1111_1111_1111,\n}\n", "import {\n    codePointToString,\n    replaceCodePoint,\n    replaceCodePointXML,\n} from \"./decode-codepoint.js\";\nimport { htmlDecodeTree } from \"./generated/decode-data-html.js\";\nimport { xmlDecodeTree } from \"./generated/decode-data-xml.js\";\nimport { BinTrieFlags } from \"./internal/bin-trie-flags.js\";\n\nconst enum CharCodes {\n    AMP = 38, // \"&\"\n    NUM = 35, // \"#\"\n    SEMI = 59, // \";\"\n    EQUALS = 61, // \"=\"\n    ZERO = 48, // \"0\"\n    NINE = 57, // \"9\"\n    LOWER_A = 97, // \"a\"\n    LOWER_X = 120, // \"x\"\n}\n\n/** Bit that needs to be set to convert an upper case ASCII character to lower case */\nconst TO_LOWER_BIT = 0b10_0000;\n\n/*\n * `parseNumericEntity` packs its two results into one 32-bit integer:\n * `(consumed << CONSUMED_SHIFT) | codePoint`. The 21-bit code point field\n * fits any valid Unicode value (max 0x10FFFF, clamped before packing); the\n * consumed count excludes `&` and gets the remaining 11 bits. Extract it\n * with `>>>` so the topmost bit isn't treated as a sign.\n *\n * Plain consts rather than a `const enum`: with `isolatedModules`, enum\n * member reads compile to runtime property loads.\n */\nconst CONSUMED_SHIFT = 21;\nconst CODE_POINT_MASK = 0x1f_ff_ff;\n/**\n * Reserved consumed field for counts of at least 2047 characters after `&`.\n * The true count is in `longNumericConsumed`.\n */\nconst CONSUMED_OVERFLOW = 0x7_ff;\n\n/**\n * Side channel for numeric entities of at least 2048 characters including\n * `&`. Set by `parseNumericEntity` when its consumed count reaches the\n * reserved value `CONSUMED_OVERFLOW`; callers read the true count from here.\n * A module-level slot avoids a tuple allocation on the hot path.\n */\nlet longNumericConsumed = 0;\n\n/**\n * Extract the consumed count from a `parseNumericEntity` packed result,\n * recovering the true length from `longNumericConsumed` when the packed\n * field contains the sentinel. Read it before the next `parseNumericEntity`\n * call, which may overwrite the side channel. This helper owns that protocol.\n * @param packed Packed result of `parseNumericEntity`.\n */\nfunction unpackConsumed(packed: number): number {\n    const consumed = packed >>> CONSUMED_SHIFT;\n    return consumed === CONSUMED_OVERFLOW ? longNumericConsumed : consumed;\n}\n\n/**\n * Unsigned subtraction trick: (code - lo) >>> 0 wraps negatives to large\n * values, so a single `<=` covers the entire [lo..hi] range check.\n * @param code Code point to check.\n */\nfunction isNumber(code: number): boolean {\n    return (code - CharCodes.ZERO) >>> 0 <= 9;\n}\n\nfunction isHexadecimalCharacter(code: number): boolean {\n    return ((code | TO_LOWER_BIT) - CharCodes.LOWER_A) >>> 0 <= 5; // F - a\n}\n\nfunction isAlpha(code: number): boolean {\n    return ((code | TO_LOWER_BIT) - CharCodes.LOWER_A) >>> 0 <= 25; // Z - a\n}\n\n/**\n * Checks if the given character is a valid end character for an entity in an attribute.\n *\n * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.\n * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state\n * @param code Code point to check.\n */\nfunction isEntityInAttributeInvalidEnd(code: number): boolean {\n    return code === CharCodes.EQUALS || isAlpha(code) || isNumber(code);\n}\n\nconst enum EntityDecoderState {\n    EntityStart,\n    NumericStart,\n    NumericDecimal,\n    NumericHex,\n    NamedEntity,\n}\n\n/**\n * Decoding mode for named entities.\n */\nexport enum DecodingMode {\n    /** Entities in text nodes that can end with any character. */\n    Legacy = 0,\n    /** Only allow entities terminated with a semicolon. */\n    Strict = 1,\n    /** Entities in attributes have limitations on ending characters. */\n    Attribute = 2,\n}\n\n/**\n * Producers for character reference errors as defined in the HTML spec.\n */\nexport interface EntityErrorProducer {\n    missingSemicolonAfterCharacterReference(): void;\n    absenceOfDigitsInNumericCharacterReference(\n        consumedCharacters: number,\n    ): void;\n    /**\n     * Validate the accumulated numeric value, before Unicode replacement.\n     * Values beyond the JavaScript number range are positive infinity.\n     */\n    validateNumericCharacterReference(code: number): void;\n}\n\n/**\n * Token decoder with support of writing partial entities.\n */\nexport class EntityDecoder {\n    /** The current state of the decoder. */\n    private state: number = EntityDecoderState.EntityStart;\n    /** Characters that were consumed while parsing an entity. */\n    private consumed = 1;\n    /**\n     * The result of the entity.\n     *\n     * For named entities: the trie index of the best legacy match so far\n     * (0 = none). For numeric entities: the accumulated code point.\n     */\n    private result = 0;\n\n    /** The current index in the decode tree. */\n    private treeIndex = 0;\n    /**\n     * Characters consumed since the last recorded legacy match, plus one.\n     * Invariant at the top of the `stateNamedEntity` loop: `excess` equals\n     * the number of unrecorded consumed characters + 1.\n     */\n    // biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive (read via destructuring)\n    private excess = 1;\n    /** The mode in which the decoder is operating. */\n    private decodeMode = DecodingMode.Strict;\n    /** The number of characters that have been consumed in the current run. */\n    // biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive\n    private runConsumed = 0;\n\n    constructor(\n        /** The predefined HTML or XML decode tree. */\n        private readonly decodeTree: Uint16Array,\n        /**\n         * The function that is called when a codepoint is decoded.\n         *\n         * For named entities that decode to multiple code points, this will\n         * be called multiple times, with the second codepoint, and the same\n         * `consumed` value.\n         * @param codepoint The decoded codepoint.\n         * @param consumed The number of characters consumed by the decoder.\n         */\n        private readonly emitCodePoint: (cp: number, consumed: number) => void,\n        /** An object that is used to produce errors. */\n        private readonly errors?: EntityErrorProducer | undefined,\n    ) {}\n\n    /**\n     * Resets the instance to make it reusable.\n     * @param decodeMode Entity decoding mode to use.\n     */\n    startEntity(decodeMode: DecodingMode): void {\n        this.decodeMode = decodeMode;\n        this.state = EntityDecoderState.EntityStart;\n        this.result = 0;\n        this.treeIndex = 0;\n        this.excess = 1;\n        this.consumed = 1;\n        this.runConsumed = 0;\n    }\n\n    /**\n     * Write an entity to the decoder. This can be called multiple times with partial entities.\n     * If the entity is incomplete, the decoder will return -1.\n     *\n     * Mirrors the non-streaming `decodeWithTrie`, but with the ability to stop decoding if the\n     * entity is incomplete, and resume when the next string is written.\n     * @param input The string containing the entity (or a continuation of the entity).\n     * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.\n     * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n     */\n    write(input: string, offset: number): number {\n        switch (this.state) {\n            case EntityDecoderState.EntityStart: {\n                if (input.charCodeAt(offset) === CharCodes.NUM) {\n                    this.state = EntityDecoderState.NumericStart;\n                    this.consumed += 1;\n                    return this.stateNumericStart(input, offset + 1);\n                }\n                this.state = EntityDecoderState.NamedEntity;\n                return this.stateNamedEntity(input, offset);\n            }\n\n            case EntityDecoderState.NumericStart: {\n                return this.stateNumericStart(input, offset);\n            }\n\n            case EntityDecoderState.NumericDecimal: {\n                return this.stateNumericDecimal(input, offset);\n            }\n\n            case EntityDecoderState.NumericHex: {\n                return this.stateNumericHex(input, offset);\n            }\n\n            default: {\n                // NamedEntity \u2014 the only remaining state.\n                return this.stateNamedEntity(input, offset);\n            }\n        }\n    }\n\n    /**\n     * Switches between the numeric decimal and hexadecimal states.\n     *\n     * Equivalent to the `Numeric character reference state` in the HTML spec.\n     * @param input The string containing the entity (or a continuation of the entity).\n     * @param offset The current offset.\n     * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n     */\n    // eslint-disable-next-line unicorn/consistent-class-member-order\n    private stateNumericStart(input: string, offset: number): number {\n        if (offset >= input.length) {\n            return -1;\n        }\n\n        if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {\n            this.state = EntityDecoderState.NumericHex;\n            this.consumed += 1;\n            return this.stateNumericHex(input, offset + 1);\n        }\n\n        this.state = EntityDecoderState.NumericDecimal;\n        return this.stateNumericDecimal(input, offset);\n    }\n\n    /**\n     * Parses a hexadecimal numeric entity.\n     *\n     * Equivalent to the `Hexademical character reference state` in the HTML\n     * spec. Digit parsing matches the hex loop in `parseNumericEntity`.\n     * The accumulated value is preserved for numeric validation callbacks.\n     * @param input The string containing the entity (or a continuation of the entity).\n     * @param offset The current offset.\n     * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n     */\n    private stateNumericHex(input: string, offset: number): number {\n        const inputLength = input.length;\n        // Local accumulators; flushed before any exit (see stateNamedEntity).\n        let { result } = this;\n        let { consumed } = this;\n        while (offset < inputLength) {\n            const char = input.charCodeAt(offset);\n            if (isNumber(char) || isHexadecimalCharacter(char)) {\n                // Convert hex digit to value (0-15); 'a'/'A' -> 10.\n                const digit =\n                    char <= CharCodes.NINE\n                        ? char - CharCodes.ZERO\n                        : (char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10;\n                result = result * 16 + digit;\n                consumed += 1;\n                offset += 1;\n            } else {\n                this.result = result;\n                this.consumed = consumed;\n                return this.emitNumericEntity(char, 3);\n            }\n        }\n        this.result = result;\n        this.consumed = consumed;\n        return -1; // Incomplete entity\n    }\n\n    /**\n     * Parses a decimal numeric entity.\n     *\n     * Equivalent to the `Decimal character reference state` in the HTML\n     * spec. Digit parsing matches the decimal loop in `parseNumericEntity`.\n     * The accumulated value is preserved for numeric validation callbacks.\n     * @param input The string containing the entity (or a continuation of the entity).\n     * @param offset The current offset.\n     * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n     */\n    private stateNumericDecimal(input: string, offset: number): number {\n        const inputLength = input.length;\n        // Local accumulators; flushed before any exit (see stateNamedEntity).\n        let { result } = this;\n        let { consumed } = this;\n        while (offset < inputLength) {\n            const digit = input.charCodeAt(offset) - CharCodes.ZERO;\n            if (digit >>> 0 > 9) {\n                this.result = result;\n                this.consumed = consumed;\n                return this.emitNumericEntity(digit + CharCodes.ZERO, 2);\n            }\n            result = result * 10 + digit;\n            consumed += 1;\n            offset += 1;\n        }\n        this.result = result;\n        this.consumed = consumed;\n        return -1; // Incomplete entity\n    }\n\n    /**\n     * Validate and emit a numeric entity.\n     *\n     * Implements the logic from the `Hexademical character reference start\n     * state` and `Numeric character reference end state` in the HTML spec.\n     * @param lastCp The last code point of the entity. Used to see if the\n     *               entity was terminated with a semicolon.\n     * @param expectedLength The minimum number of characters that should be\n     *                       consumed. Used to validate that at least one digit\n     *                       was consumed.\n     * @returns The number of characters that were consumed.\n     */\n    private emitNumericEntity(lastCp: number, expectedLength: number): number {\n        // Ensure we consumed at least one digit.\n        if (this.consumed <= expectedLength) {\n            this.errors?.absenceOfDigitsInNumericCharacterReference(\n                this.consumed,\n            );\n            return 0;\n        }\n\n        // Figure out if this is a legit end of the entity\n        if (lastCp === CharCodes.SEMI) {\n            this.consumed += 1;\n        } else if (this.decodeMode === DecodingMode.Strict) {\n            return 0;\n        }\n\n        this.emitCodePoint(\n            (this.decodeTree === xmlDecodeTree\n                ? replaceCodePointXML\n                : replaceCodePoint)(this.result),\n            this.consumed,\n        );\n\n        if (this.errors) {\n            if (lastCp !== CharCodes.SEMI) {\n                this.errors.missingSemicolonAfterCharacterReference();\n            }\n\n            this.errors.validateNumericCharacterReference(this.result);\n        }\n\n        return this.consumed;\n    }\n\n    /**\n     * Flush locally-tracked walk state back to the fields, then emit the\n     * recorded legacy match or reject (cold path \u2014 at most once per\n     * entity). Called after failed navigation (leaf node, branch miss, or\n     * compact-run mismatch). In attribute mode, reject if no legacy was\n     * recorded at the current node, if we descended past it, or if the\n     * pending input character is an invalid attribute terminator.\n     * @param consumed Locally-tracked consumed count.\n     * @param excess Locally-tracked excess count.\n     * @param char Pending input character (may be the mismatching char).\n     * @param valueLength Value length at the current trie node.\n     */\n    private flushAndEmitLegacyOrReject(\n        consumed: number,\n        excess: number,\n        char: number,\n        valueLength: number,\n    ): number {\n        this.consumed = consumed;\n        this.excess = excess;\n        return this.result === 0 ||\n            (this.decodeMode === DecodingMode.Attribute &&\n                (valueLength === 0 ||\n                    excess > 1 ||\n                    isEntityInAttributeInvalidEnd(char)))\n            ? 0\n            : this.emitNotTerminatedNamedEntity();\n    }\n\n    /**\n     * Parses a named entity.\n     *\n     * Equivalent to the `Named character reference state` in the HTML spec.\n     * @param input The string containing the entity (or a continuation of the entity).\n     * @param offset The current offset.\n     * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n     */\n    private stateNamedEntity(input: string, offset: number): number {\n        const { decodeTree } = this;\n        const inputLength = input.length;\n        const isStrict = this.decodeMode === DecodingMode.Strict;\n\n        /*\n         * Local copies of the resumable walk state avoid per-character\n         * field writes. They are flushed back to the fields\n         * on every exit (chunk end, and before any emit helper that reads\n         * them). `this.result` is only written at the (rare) record points,\n         * so it stays a direct field write.\n         *\n         * Legacy-match recording happens in two idempotent places: at the\n         * loop top when sitting on a value node, and in the chunk-end\n         * epilogue (so `end()` sees matches that land exactly on a chunk\n         * boundary). Recording applies `consumed += excess - 1; excess = 1`,\n         * which is a no-op when repeated \u2014 the loop-top invariant is\n         * `excess` = unrecorded consumed characters + 1.\n         */\n        let { treeIndex } = this;\n        let { excess } = this;\n        let { consumed } = this;\n        let current = decodeTree[treeIndex];\n\n        while (offset < inputLength) {\n            /*\n             * Descend through value-less jump-table nodes (including the\n             * single-branch encoding) inline, mirroring `decodeWithTrie`:\n             * this avoids a `determineBranch` call per level for the\n             * dominant node shape \u2014 including the root on the first write.\n             */\n            while (\n                (current &\n                    (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n                    0 &&\n                (current & BinTrieFlags.JUMP_TABLE) !== 0\n            ) {\n                const char = input.charCodeAt(offset);\n                const jumpOffset = current & BinTrieFlags.JUMP_TABLE;\n                const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n                if (branchCount === 0) {\n                    // Single branch encoded inline in the jump offset bits.\n                    if (char !== jumpOffset) {\n                        return this.flushAndEmitLegacyOrReject(\n                            consumed,\n                            excess,\n                            char,\n                            0,\n                        );\n                    }\n                    treeIndex += 1;\n                } else {\n                    const slot = char - jumpOffset;\n                    if (slot >>> 0 >= branchCount) {\n                        return this.flushAndEmitLegacyOrReject(\n                            consumed,\n                            excess,\n                            char,\n                            0,\n                        );\n                    }\n                    const stored = decodeTree[treeIndex + 1 + slot];\n                    if (stored === 0) {\n                        return this.flushAndEmitLegacyOrReject(\n                            consumed,\n                            excess,\n                            char,\n                            0,\n                        );\n                    }\n                    // End-relative: branch data ends at treeIndex+1+branchCount.\n                    treeIndex = (treeIndex + branchCount + stored) & 0xff_ff;\n                }\n                current = decodeTree[treeIndex];\n                offset += 1;\n                excess += 1;\n                /*\n                 * `charCodeAt` past the end returns NaN, which would alias\n                 * to slot 0 after `>>> 0` \u2014 bail out explicitly.\n                 */\n                // eslint-disable-next-line unicorn/no-break-in-nested-loop\n                if (offset >= inputLength) break;\n            }\n            if (offset >= inputLength) break;\n\n            // Handle compact runs (resumable across chunks).\n            if (\n                (current &\n                    (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n                BinTrieFlags.FLAG13\n            ) {\n                const runLength =\n                    (current & BinTrieFlags.BRANCH_LENGTH) >> 7; /* 3..63 */\n                let { runConsumed } = this;\n\n                // If we are starting a run, check the first char.\n                if (runConsumed === 0) {\n                    const char = input.charCodeAt(offset);\n                    if (char !== (current & BinTrieFlags.JUMP_TABLE)) {\n                        return this.flushAndEmitLegacyOrReject(\n                            consumed,\n                            excess,\n                            char,\n                            0,\n                        );\n                    }\n                    offset += 1;\n                    excess += 1;\n                    runConsumed = 1;\n                }\n\n                // Check remaining characters in the run (packed two per uint16 word).\n                while (runConsumed < runLength) {\n                    if (offset >= inputLength) {\n                        this.treeIndex = treeIndex;\n                        this.excess = excess;\n                        this.consumed = consumed;\n                        this.runConsumed = runConsumed;\n                        return -1;\n                    }\n\n                    const charIndexInPacked = runConsumed - 1;\n                    const packedWord =\n                        decodeTree[treeIndex + 1 + (charIndexInPacked >> 1)];\n                    const expectedChar =\n                        (packedWord >> ((charIndexInPacked & 1) << 3)) & 0xff;\n\n                    const char = input.charCodeAt(offset);\n                    if (char !== expectedChar) {\n                        this.runConsumed = 0;\n                        return this.flushAndEmitLegacyOrReject(\n                            consumed,\n                            excess,\n                            char,\n                            0,\n                        );\n                    }\n                    offset += 1;\n                    excess += 1;\n                    runConsumed += 1;\n                }\n\n                this.runConsumed = 0;\n                treeIndex += 1 + (runLength >> 1);\n                current = decodeTree[treeIndex];\n                // Loop top handles the landed-on node (record/emit/branch).\n                continue;\n            }\n\n            // Header plus out-of-line value words; 0 means no value.\n            const valueLength = current >>> 14;\n            const char = input.charCodeAt(offset);\n\n            if (valueLength !== 0) {\n                // Record a legacy match (FLAG13 clear = semicolon optional).\n                if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {\n                    this.result = treeIndex;\n                    consumed += excess - 1;\n                    excess = 1;\n                }\n\n                /*\n                 * Implicit semicolon handling: emit immediately. Covers both\n                 * strict (FLAG13 set) and legacy entities \u2014 neither stores\n                 * an explicit `;` branch in the trie.\n                 */\n                if (char === CharCodes.SEMI) {\n                    return this.emitNamedEntityData(\n                        treeIndex,\n                        valueLength,\n                        consumed + excess,\n                    );\n                }\n\n                /*\n                 * `valueLength === 1` packs the codepoint into the header\n                 * word's low 13 bits, where branch metadata also lives. Skip\n                 * the branch lookup on leaves so those value bits aren't\n                 * reinterpreted as branch offsets.\n                 */\n                if (valueLength === 1) {\n                    return this.flushAndEmitLegacyOrReject(\n                        consumed,\n                        excess,\n                        char,\n                        valueLength,\n                    );\n                }\n            }\n\n            // Value-bearing or dictionary node: dispatch through determineBranch.\n            const next = determineBranch(\n                decodeTree,\n                current,\n                treeIndex + (valueLength || 1),\n                char,\n            );\n\n            if (next < 0) {\n                return this.flushAndEmitLegacyOrReject(\n                    consumed,\n                    excess,\n                    char,\n                    valueLength,\n                );\n            }\n\n            treeIndex = next;\n            current = decodeTree[treeIndex];\n            offset += 1;\n            excess += 1;\n        }\n\n        /*\n         * Chunk exhausted. Record a legacy match we may be sitting on, so a\n         * subsequent `end()` emits it, then persist the walk state.\n         */\n        if (\n            !isStrict &&\n            current >>> 14 !== 0 &&\n            (current & BinTrieFlags.FLAG13) === 0\n        ) {\n            this.result = treeIndex;\n            consumed += excess - 1;\n            excess = 1;\n        }\n        this.treeIndex = treeIndex;\n        this.excess = excess;\n        this.consumed = consumed;\n        return -1;\n    }\n\n    /**\n     * Emit a named entity that was not terminated with a semicolon.\n     * @returns The number of characters consumed.\n     */\n    private emitNotTerminatedNamedEntity(): number {\n        const { result, decodeTree } = this;\n\n        const valueLength = decodeTree[result] >>> 14;\n\n        this.emitNamedEntityData(result, valueLength, this.consumed);\n        this.errors?.missingSemicolonAfterCharacterReference();\n\n        return this.consumed;\n    }\n\n    /**\n     * Emit a named entity.\n     * @param result The index of the entity in the decode tree.\n     * @param valueLength Encoded value length (header plus any value words).\n     * @param consumed The number of characters consumed.\n     * @returns The number of characters consumed.\n     */\n    private emitNamedEntityData(\n        result: number,\n        valueLength: number,\n        consumed: number,\n    ): number {\n        const { decodeTree } = this;\n\n        this.emitCodePoint(\n            valueLength === 1\n                ? decodeTree[result] & BinTrieFlags.VALUE_MASK\n                : decodeTree[result + 1],\n            consumed,\n        );\n        if (valueLength === 3) {\n            // Emit the second UTF-16 code unit.\n            this.emitCodePoint(decodeTree[result + 2], consumed);\n        }\n\n        return consumed;\n    }\n\n    /**\n     * Signal to the parser that the end of the input was reached.\n     *\n     * Remaining data will be emitted and relevant errors will be produced.\n     * @returns The number of characters consumed.\n     */\n    end(): number {\n        switch (this.state) {\n            case EntityDecoderState.NamedEntity: {\n                // Emit a named entity if we have one.\n                return this.result !== 0 &&\n                    (this.decodeMode !== DecodingMode.Attribute ||\n                        this.result === this.treeIndex)\n                    ? this.emitNotTerminatedNamedEntity()\n                    : 0;\n            }\n            // Otherwise, emit a numeric entity if we have one.\n            case EntityDecoderState.NumericDecimal: {\n                return this.emitNumericEntity(0, 2);\n            }\n            case EntityDecoderState.NumericHex: {\n                return this.emitNumericEntity(0, 3);\n            }\n            case EntityDecoderState.NumericStart: {\n                this.errors?.absenceOfDigitsInNumericCharacterReference(\n                    this.consumed,\n                );\n                return 0;\n            }\n            default: {\n                // EntityStart or unknown \u2014 return 0.\n                return 0;\n            }\n        }\n    }\n}\n\n/**\n * Determines the branch of the current node that is taken given the current\n * character. This function is used to traverse the trie.\n *\n * See `BinTrieFlags` for the branch-data layouts handled here.\n * @param decodeTree The trie.\n * @param current The current node's header word.\n * @param nodeIndex Index of the node's first branch-data word (the header\n *   plus any value words have been skipped by the caller).\n * @param char The current character.\n * @returns The index of the next node, or -1 if no branch is taken.\n */\nexport function determineBranch(\n    decodeTree: Uint16Array,\n    current: number,\n    nodeIndex: number,\n    char: number,\n): number {\n    const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n    const jumpOffset = current & BinTrieFlags.JUMP_TABLE;\n\n    // Case 1: Single branch or jump table (jumpOffset encodes the first/only char code).\n    if (jumpOffset) {\n        if (branchCount === 0) {\n            // Single branch encoded inline in the jump offset bits.\n            return char === jumpOffset ? nodeIndex : -1;\n        }\n\n        /*\n         * Jump table: branchCount consecutive slots starting at jumpOffset.\n         * Unsigned comparison handles both < 0 and >= branchCount in one check.\n         */\n        const slot = char - jumpOffset;\n        if (slot >>> 0 >= branchCount) return -1;\n        const stored = decodeTree[nodeIndex + slot];\n        /*\n         * 0 = empty slot (no branch); otherwise the child's offset from the\n         * end of the branch array, +1 (end-relative pointers compress\n         * better). `& 0xff_ff` mirrors the encoder's uint16 wrap for\n         * backreferences to already-encoded nodes.\n         */\n        return stored === 0\n            ? -1\n            : (nodeIndex + branchCount + stored - 1) & 0xff_ff;\n    }\n\n    /*\n     * Case 2: Packed dictionary. Linear scan \u2014 over 90% of dict nodes have\n     * <= 4 branches in the HTML trie, where the constant-factor savings\n     * dominate over binary search's asymptotic edge.\n     */\n    if (branchCount === 0) return -1;\n    const packedKeySlots = (branchCount + 1) >> 1;\n    const branchEnd = nodeIndex + packedKeySlots + branchCount;\n    for (let index = 0; index < branchCount; index++) {\n        const packed = decodeTree[nodeIndex + (index >> 1)];\n        const key = (packed >> ((index & 1) << 3)) & 0xff;\n        if (key === char) {\n            const pointerIndex = nodeIndex + packedKeySlots + index;\n            // Pointers are relative to the end of the branch data.\n            return (branchEnd + decodeTree[pointerIndex]) & 0xff_ff;\n        }\n        // Keys are sorted; if we've passed `char`, no match is possible.\n        if (key > char) return -1;\n    }\n    return -1;\n}\n\n/**\n * Read the decoded value from a trie node.\n * @param decodeTree The trie.\n * @param nodeIndex The index of the node.\n * @param valueLength The length of the value (1, 2, or 3).\n * @returns The decoded string.\n */\nfunction readTrieValue(\n    decodeTree: Uint16Array,\n    nodeIndex: number,\n    valueLength: number,\n): string {\n    if (valueLength === 1) {\n        return String.fromCharCode(\n            decodeTree[nodeIndex] & BinTrieFlags.VALUE_MASK,\n        );\n    }\n    if (valueLength === 2) {\n        return String.fromCharCode(decodeTree[nodeIndex + 1]);\n    }\n    return String.fromCharCode(\n        decodeTree[nodeIndex + 1],\n        decodeTree[nodeIndex + 2],\n    );\n}\n\n/**\n * Parse a numeric entity (`&#DDD;` or `&#xHHH;`).\n *\n * Encodes the result as `(consumed << CONSUMED_SHIFT) | codepoint` (see\n * the packing comment at the top of the file; overlong entities spill\n * their length into `longNumericConsumed`). Returns 0 when no digits were\n * found.\n *\n * This is the sync counterpart of the streaming\n * `EntityDecoder#stateNumericDecimal` / `#stateNumericHex`. Digit parsing\n * matches those methods; only this packed result needs a value clamp.\n * @param input       The input string.\n * @param numberStart Index of the `#` character.\n * @param inputLength Cached `input.length`.\n */\nfunction parseNumericEntity(\n    input: string,\n    numberStart: number,\n    inputLength: number,\n): number {\n    let offset = numberStart + 1; // Skip \"#\"\n    let cp = 0;\n    let digitStart = offset;\n\n    /*\n     * Separate decimal and hexadecimal loops: each multiplies by a constant\n     * and runs a single digit test, instead of a per-character base check.\n     */\n    if (\n        offset < inputLength &&\n        (input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X\n    ) {\n        offset += 1;\n        digitStart = offset;\n        while (offset < inputLength) {\n            const char = input.charCodeAt(offset);\n            if (isNumber(char)) {\n                cp = cp * 16 + (char - CharCodes.ZERO);\n            } else if (isHexadecimalCharacter(char)) {\n                cp = cp * 16 + ((char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10);\n            } else {\n                break;\n            }\n            offset += 1;\n        }\n    } else {\n        while (offset < inputLength) {\n            const digit = input.charCodeAt(offset) - CharCodes.ZERO;\n            if (digit >>> 0 > 9) break;\n            cp = cp * 10 + digit;\n            offset += 1;\n        }\n    }\n\n    if (offset === digitStart) return 0;\n\n    // Include the semicolon in consumed when present.\n    if (offset < inputLength && input.charCodeAt(offset) === CharCodes.SEMI) {\n        offset += 1;\n    }\n\n    /*\n     * Clamp out-of-range values to 0x110000 so they fit the 21-bit field\n     * and decode to U+FFFD. Lengths at or above CONSUMED_OVERFLOW use the\n     * side channel described with the packing constants.\n     */\n    if (cp > 0x10_ff_ff) cp = 0x11_00_00;\n    let consumed = offset - numberStart;\n    if (consumed >= CONSUMED_OVERFLOW) {\n        // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- deliberate side channel, see `longNumericConsumed`\n        longNumericConsumed = consumed;\n        consumed = CONSUMED_OVERFLOW;\n    }\n    return (consumed << CONSUMED_SHIFT) | cp;\n}\n\n/**\n * Decode all entities in `input` using the HTML trie.\n *\n * Hard-wired to `htmlDecodeTree`: the inline root navigation below assumes\n * the HTML root's jump-table shape, so this must not be generalized to\n * other tries (the XML trie's dictionary root would silently match no\n * entities \u2014 `decodeXML` has its own hand-coded fast path instead).\n * @param input      The string to decode.\n * @param isStrict Only match semicolon-terminated entities.\n * @param isAttribute Whether to apply attribute-specific parsing rules (disallowing certain non-semicolon terminators).\n * @returns The decoded string.\n */\nfunction decodeWithTrie(\n    input: string,\n    isStrict: boolean,\n    isAttribute: boolean,\n): string {\n    const decodeTree = htmlDecodeTree;\n    // Fast path: no entities at all \u2014 return input without any allocation.\n    let offset = input.indexOf(\"&\");\n    if (offset < 0) return input;\n\n    const inputLength = input.length;\n    /*\n     * `chunkStart` marks the start of the next pending slice. Rejected\n     * entities don't advance it, so consecutive rejections are stitched\n     * into a single `slice` once a real match (or end of input) is hit.\n     */\n    let chunkStart = 0;\n    let result = \"\";\n\n    /*\n     * Root navigation fields, hoisted out of the per-entity loop. The HTML\n     * root is a multi-branch jump-table covering [A-Za-z]; see the inline\n     * first-iteration comment below.\n     */\n    const root = decodeTree[0];\n    const rootJumpOffset = root & BinTrieFlags.JUMP_TABLE;\n    const rootBranchCount = (root & BinTrieFlags.BRANCH_LENGTH) >> 7;\n\n    do {\n        const entityStart = offset + 1;\n\n        // Quick check: entity names must start with [A-Za-z], numeric with #.\n        const firstChar = input.charCodeAt(entityStart);\n        let consumed: number;\n        let value: string;\n        if (firstChar === CharCodes.NUM) {\n            const packed = parseNumericEntity(input, entityStart, inputLength);\n            consumed = unpackConsumed(packed);\n            // In strict mode, require semicolon termination.\n            if (\n                isStrict &&\n                consumed > 0 &&\n                input.charCodeAt(entityStart + consumed - 1) !== CharCodes.SEMI\n            ) {\n                consumed = 0;\n            }\n            value =\n                consumed === 0\n                    ? \"\"\n                    : codePointToString(packed & CODE_POINT_MASK);\n        } else if (isAlpha(firstChar)) {\n            consumed = 0;\n            value = \"\";\n\n            /*\n             * The generator guarantees a jump-table root. Consume the first\n             * character directly, then walk from its child.\n             */\n            const rootSlotIndex = firstChar - rootJumpOffset;\n            let nodeIndex: number;\n            if (rootSlotIndex >>> 0 < rootBranchCount) {\n                const stored = decodeTree[1 + rootSlotIndex];\n                nodeIndex =\n                    stored === 0 ? -1 : (rootBranchCount + stored) & 0xff_ff;\n            } else {\n                nodeIndex = -1;\n            }\n\n            /*\n             * Best legacy (no-semicolon) match so far, as trie coordinates.\n             * Deferring `readTrieValue` to the end avoids allocating a\n             * string for matches that longer matches supersede.\n             */\n            let bestNodeIndex = 0;\n            let bestValueLength = 0;\n            let current = nodeIndex < 0 ? 0 : decodeTree[nodeIndex];\n            let index = entityStart + 1;\n\n            /*\n             * Walk the trie from the root child. The `trie` label lets the\n             * inner descent and compact-run loops abandon the entity (and\n             * fall through to the legacy/reject handling) directly.\n             */\n            trie: while (index < inputLength) {\n                /*\n                 * Inline value-less jump tables and single branches. A miss\n                 * falls through to the recorded legacy match or rejection.\n                 */\n                while (\n                    // Value-less, non-run node with a nonzero jump offset.\n                    (current &\n                        (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n                        0 &&\n                    (current & BinTrieFlags.JUMP_TABLE) !== 0\n                ) {\n                    const jumpOffset = current & BinTrieFlags.JUMP_TABLE;\n                    const branchCount =\n                        (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n                    if (branchCount === 0) {\n                        // Single branch encoded inline in the jump offset bits.\n                        if (input.charCodeAt(index) !== jumpOffset) break trie;\n                        nodeIndex += 1;\n                    } else {\n                        const slot = input.charCodeAt(index) - jumpOffset;\n                        if (slot >>> 0 >= branchCount) break trie;\n                        const stored = decodeTree[nodeIndex + 1 + slot];\n                        if (stored === 0) break trie;\n                        // End-relative: branch data ends at nodeIndex+1+branchCount.\n                        nodeIndex =\n                            (nodeIndex + branchCount + stored) & 0xff_ff;\n                    }\n                    current = decodeTree[nodeIndex];\n                    index += 1;\n                    /*\n                     * `charCodeAt` past the end returns NaN, which would\n                     * alias to slot 0 after `>>> 0` \u2014 bail out explicitly.\n                     */\n                    if (index >= inputLength) break trie;\n                }\n\n                // FLAG13 without a value marks a compact run.\n                if (\n                    (current &\n                        (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n                    BinTrieFlags.FLAG13\n                ) {\n                    const runLength =\n                        (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n\n                    // Check first char (stored in JUMP_TABLE bits).\n                    if (\n                        input.charCodeAt(index) !==\n                        (current & BinTrieFlags.JUMP_TABLE)\n                    ) {\n                        // eslint-disable-next-line unicorn/no-break-in-nested-loop\n                        break;\n                    }\n                    index += 1;\n\n                    // Check remaining characters (packed two per uint16 word).\n                    const remaining = runLength - 1;\n                    let wordIndex = nodeIndex + 1;\n                    let charIndexInPacked = 0;\n\n                    /*\n                     * Process pairs: read one packed word, compare low byte then high byte.\n                     * No explicit bounds check needed \u2014 charCodeAt returns NaN for OOB,\n                     * which never equals an integer, so the mismatch break fires naturally.\n                     */\n                    for (\n                        ;\n                        charIndexInPacked + 1 < remaining;\n                        charIndexInPacked += 2\n                    ) {\n                        const packed = decodeTree[wordIndex];\n                        if (input.charCodeAt(index) !== (packed & 0xff))\n                            break trie;\n                        index += 1;\n                        if (input.charCodeAt(index) !== ((packed >> 8) & 0xff))\n                            break trie;\n                        index += 1;\n                        wordIndex += 1;\n                    }\n                    // Handle odd trailing char.\n                    if (charIndexInPacked < remaining) {\n                        if (\n                            input.charCodeAt(index) !==\n                            (decodeTree[wordIndex] & 0xff)\n                        )\n                            // eslint-disable-next-line unicorn/no-break-in-nested-loop\n                            break;\n                        index += 1;\n                    }\n\n                    nodeIndex += 1 + (runLength >> 1);\n                    current = decodeTree[nodeIndex];\n                    // eslint-disable-next-line unicorn/no-break-in-nested-loop\n                    continue;\n                }\n\n                // Header plus out-of-line value words; 0 means no value.\n                const valueLength = current >>> 14;\n                const char = input.charCodeAt(index);\n\n                /*\n                 * Check current node for a value before navigating.\n                 * This handles both: (a) values reached via compact runs on the\n                 * previous iteration, and (b) values at regular branch targets.\n                 */\n                if (valueLength !== 0) {\n                    // If char is `;`, emit immediately.\n                    if (char === CharCodes.SEMI) {\n                        consumed = index - entityStart + 1;\n                        // Inline leaves carry the value in the low 13 bits.\n                        value =\n                            valueLength === 1\n                                ? String.fromCharCode(\n                                      current & BinTrieFlags.VALUE_MASK,\n                                  )\n                                : readTrieValue(\n                                      decodeTree,\n                                      nodeIndex,\n                                      valueLength,\n                                  );\n                        // eslint-disable-next-line unicorn/no-break-in-nested-loop\n                        break;\n                    }\n\n                    // Record non-terminated (legacy) match (FLAG13 clear = semicolon optional).\n                    if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {\n                        consumed = index - entityStart;\n                        bestNodeIndex = nodeIndex;\n                        bestValueLength = valueLength;\n                    }\n\n                    /*\n                     * A valueLength of 1 means the value is packed inline in the header\n                     * word \u2014 these are always leaf nodes with no branches, so we can\n                     * stop walking the trie.\n                     */\n                    // eslint-disable-next-line unicorn/no-break-in-nested-loop\n                    if (valueLength === 1) break;\n                }\n\n                // Navigate to the next node (valueLength || 1: skip past value words, minimum 1 for header).\n                const next = determineBranch(\n                    decodeTree,\n                    current,\n                    nodeIndex + (valueLength || 1),\n                    char,\n                );\n                // eslint-disable-next-line unicorn/no-break-in-nested-loop\n                if (next < 0) break;\n\n                nodeIndex = next;\n                current = decodeTree[nodeIndex];\n                index += 1;\n            }\n\n            /*\n             * Post-loop: if the semicolon path didn't set value,\n             * check for a final legacy match. The last navigation may\n             * have landed on a legacy node whose value hasn't been\n             * recorded yet (loop exited before the top-of-loop check\n             * could run).\n             */\n            if (value === \"\") {\n                const finalVL = current >>> 14;\n                if (\n                    finalVL !== 0 &&\n                    !isStrict &&\n                    (current & BinTrieFlags.FLAG13) === 0\n                ) {\n                    consumed = index - entityStart;\n                    bestNodeIndex = nodeIndex;\n                    bestValueLength = finalVL;\n                }\n                if (consumed > 0) {\n                    value = readTrieValue(\n                        decodeTree,\n                        bestNodeIndex,\n                        bestValueLength,\n                    );\n                }\n            }\n        } else {\n            consumed = 0;\n            value = \"\";\n        }\n\n        /*\n         * The attribute end-char rule (HTML spec \u00A713.2.5.73) only applies to\n         * unterminated *named* references.  Semicolon-terminated entities and\n         * numeric entities are always accepted, matching EntityDecoder behavior.\n         *\n         * When `attribute` is false (the common case), short-circuit skips all\n         * the unterminated-named checks entirely.\n         */\n        if (\n            consumed === 0 ||\n            (isAttribute &&\n                firstChar !== CharCodes.NUM &&\n                input.charCodeAt(entityStart + consumed - 1) !==\n                    CharCodes.SEMI &&\n                entityStart + consumed < inputLength &&\n                isEntityInAttributeInvalidEnd(\n                    input.charCodeAt(entityStart + consumed),\n                ))\n        ) {\n            // Rejected: leave `&` in the pending chunk, scan past it.\n            offset = entityStart;\n        } else {\n            if (chunkStart < offset) {\n                result += input.slice(chunkStart, offset);\n            }\n            result += value;\n            offset = chunkStart = entityStart + consumed;\n        }\n\n        /*\n         * Adjacent entities (`&x;&y;`) are common in entity-dense input;\n         * checking the single character at `offset` first skips the\n         * `indexOf` call (and its per-call overhead) for that case.\n         */\n        if (input.charCodeAt(offset) !== CharCodes.AMP) {\n            offset = input.indexOf(\"&\", offset);\n        }\n    } while (offset >= 0);\n\n    return result + input.slice(chunkStart);\n}\n\n/**\n * Decodes an HTML string.\n * @param htmlString The string to decode.\n * @param mode The decoding mode.\n * @returns The decoded string.\n */\nexport function decodeHTML(\n    htmlString: string,\n    mode: DecodingMode = DecodingMode.Legacy,\n): string {\n    return decodeWithTrie(\n        htmlString,\n        mode === DecodingMode.Strict,\n        mode === DecodingMode.Attribute,\n    );\n}\n\n/**\n * Decodes an HTML string in an attribute.\n * @param htmlAttribute The string to decode.\n * @returns The decoded string.\n */\nexport function decodeHTMLAttribute(htmlAttribute: string): string {\n    return decodeWithTrie(htmlAttribute, false, true);\n}\n\n/**\n * Decodes an HTML string, requiring all entities to be terminated by a semicolon.\n * @param htmlString The string to decode.\n * @returns The decoded string.\n */\nexport function decodeHTMLStrict(htmlString: string): string {\n    return decodeWithTrie(htmlString, true, false);\n}\n\n/**\n * Decodes an XML string, requiring all entities to be terminated by a semicolon.\n *\n * Uses a hand-coded fast path for the 5 XML named entities (amp, lt, gt,\n * quot, apos) plus numeric entities, bypassing the trie entirely.\n * @param xmlString The string to decode.\n * @returns The decoded string.\n */\nexport function decodeXML(xmlString: string): string {\n    let offset = xmlString.indexOf(\"&\");\n    if (offset < 0) return xmlString;\n\n    let lastIndex = 0;\n    let result = \"\";\n\n    do {\n        const start = offset + 1;\n        let consumed = 0;\n        let value = \"\";\n\n        const c1 = xmlString.charCodeAt(start);\n\n        if (c1 === CharCodes.NUM) {\n            const packed = parseNumericEntity(\n                xmlString,\n                start,\n                xmlString.length,\n            );\n            consumed = unpackConsumed(packed);\n            // XML is always strict \u2014 require semicolon.\n            if (\n                consumed === 0 ||\n                xmlString.charCodeAt(start + consumed - 1) !== CharCodes.SEMI\n            ) {\n                consumed = 0;\n            } else {\n                const codePoint = packed & CODE_POINT_MASK;\n                // Nonzero BMP values below the surrogate range need no replacement.\n                value =\n                    (codePoint - 1) >>> 0 < 0xd7_ff\n                        ? String.fromCharCode(codePoint)\n                        : String.fromCodePoint(replaceCodePointXML(codePoint));\n            }\n        } else {\n            /* eslint-disable unicorn/no-break-in-nested-loop -- Keep XML name dispatch inline with the decode loop. */\n            switch (c1) {\n                // &lt; / &gt;\n                case 0x6c:\n                case 0x67: {\n                    if (\n                        xmlString.charCodeAt(start + 1) === 0x74 &&\n                        xmlString.charCodeAt(start + 2) === CharCodes.SEMI\n                    ) {\n                        consumed = 3;\n                        value = c1 === 0x6c ? \"<\" : \">\";\n                    }\n                    break;\n                }\n                // &amp; / &apos;\n                case 0x61: {\n                    const c2 = xmlString.charCodeAt(start + 1);\n                    if (\n                        c2 === 0x6d &&\n                        xmlString.charCodeAt(start + 2) === 0x70 &&\n                        xmlString.charCodeAt(start + 3) === CharCodes.SEMI\n                    ) {\n                        consumed = 4;\n                        value = \"&\";\n                    } else if (\n                        c2 === 0x70 &&\n                        xmlString.charCodeAt(start + 2) === 0x6f &&\n                        xmlString.charCodeAt(start + 3) === 0x73 &&\n                        xmlString.charCodeAt(start + 4) === CharCodes.SEMI\n                    ) {\n                        consumed = 5;\n                        value = \"'\";\n                    }\n                    break;\n                }\n                // &quot;\n                case 0x71: {\n                    if (\n                        xmlString.charCodeAt(start + 1) === 0x75 &&\n                        xmlString.charCodeAt(start + 2) === 0x6f &&\n                        xmlString.charCodeAt(start + 3) === 0x74 &&\n                        xmlString.charCodeAt(start + 4) === CharCodes.SEMI\n                    ) {\n                        consumed = 5;\n                        value = '\"';\n                    }\n                    break;\n                }\n            }\n            /* eslint-enable unicorn/no-break-in-nested-loop */\n        }\n\n        if (consumed > 0) {\n            if (lastIndex < offset)\n                result += xmlString.slice(lastIndex, offset);\n            result += value;\n            offset = lastIndex = start + consumed;\n        } else {\n            offset = start;\n        }\n        /*\n         * Adjacent entities (`&x;&y;`) are common in entity-dense input;\n         * checking the single character at `lastIndex` first skips the\n         * `indexOf` call (and its per-call overhead) for that case.\n         */\n        offset =\n            xmlString.charCodeAt(offset) === CharCodes.AMP\n                ? offset\n                : xmlString.indexOf(\"&\", offset);\n    } while (offset >= 0);\n\n    return result + xmlString.slice(lastIndex);\n}\n\nexport {\n    replaceCodePoint,\n    replaceCodePointXML,\n} from \"./decode-codepoint.js\";\n// Re-export for use by eg. htmlparser2\nexport { htmlDecodeTree } from \"./generated/decode-data-html.js\";\nexport { xmlDecodeTree } from \"./generated/decode-data-xml.js\";\n", "import {\n    DecodingMode,\n    EntityDecoder,\n    htmlDecodeTree,\n    xmlDecodeTree,\n} from \"entities/decode\";\n\nconst enum CharCodes {\n    Tab = 0x9, // \"\\t\"\n    NewLine = 0xa, // \"\\n\"\n    FormFeed = 0xc, // \"\\f\"\n    CarriageReturn = 0xd, // \"\\r\"\n    Space = 0x20, // \" \"\n    ExclamationMark = 0x21, // \"!\"\n    Number = 0x23, // \"#\"\n    Amp = 0x26, // \"&\"\n    SingleQuote = 0x27, // \"'\"\n    DoubleQuote = 0x22, // '\"'\n    Dash = 0x2d, // \"-\"\n    Slash = 0x2f, // \"/\"\n    Zero = 0x30, // \"0\"\n    Nine = 0x39, // \"9\"\n    Semi = 0x3b, // \";\"\n    Lt = 0x3c, // \"<\"\n    Eq = 0x3d, // \"=\"\n    Gt = 0x3e, // \">\"\n    Questionmark = 0x3f, // \"?\"\n    UpperA = 0x41, // \"A\"\n    LowerA = 0x61, // \"a\"\n    UpperF = 0x46, // \"F\"\n    LowerF = 0x66, // \"f\"\n    UpperZ = 0x5a, // \"Z\"\n    LowerZ = 0x7a, // \"z\"\n    LowerX = 0x78, // \"x\"\n    OpeningSquareBracket = 0x5b, // \"[\"\n}\n\n/** All the states the tokenizer can be in. */\nconst enum State {\n    Text = 1,\n    BeforeTagName, // After <\n    InTagName,\n    InSelfClosingTag,\n    BeforeClosingTagName,\n    InClosingTagName,\n    AfterClosingTagName,\n\n    // Attributes\n    BeforeAttributeName,\n    InAttributeName,\n    AfterAttributeName,\n    BeforeAttributeValue,\n    InAttributeValueDq, // \"\n    InAttributeValueSq, // '\n    InAttributeValueNq,\n\n    // Declarations\n    BeforeDeclaration, // !\n    InDeclaration,\n\n    // Processing instructions\n    InProcessingInstruction, // ?\n\n    // Comments & CDATA\n    BeforeComment,\n    CDATASequence,\n    DeclarationSequence,\n    InSpecialComment,\n    InCommentLike,\n\n    // Special tags\n    SpecialStartSequence,\n    InSpecialTag,\n    InPlainText,\n\n    InEntity,\n}\n\nfunction isWhitespace(c: number): boolean {\n    return (\n        c === CharCodes.Space ||\n        c === CharCodes.NewLine ||\n        c === CharCodes.Tab ||\n        c === CharCodes.FormFeed ||\n        c === CharCodes.CarriageReturn\n    );\n}\n\nfunction isEndOfTagSection(c: number): boolean {\n    return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);\n}\n\nfunction isASCIIAlpha(c: number): boolean {\n    return (\n        (c >= CharCodes.LowerA && c <= CharCodes.LowerZ) ||\n        (c >= CharCodes.UpperA && c <= CharCodes.UpperZ)\n    );\n}\n\n/**\n * Quote style used for parsed attributes.\n */\nexport enum QuoteType {\n    NoValue = 0,\n    Unquoted = 1,\n    Single = 2,\n    Double = 3,\n}\n\n/**\n * Low-level tokenizer callback interface.\n */\nexport interface Callbacks {\n    onattribdata(start: number, endIndex: number): void;\n    onattribentity(codepoint: number): void;\n    onattribend(quote: QuoteType, endIndex: number): void;\n    onattribname(start: number, endIndex: number): void;\n    oncdata(start: number, endIndex: number, endOffset: number): void;\n    onclosetag(start: number, endIndex: number): void;\n    oncomment(start: number, endIndex: number, endOffset: number): void;\n    ondeclaration(start: number, endIndex: number): void;\n    onend(): void;\n    onopentagend(endIndex: number): void;\n    onopentagname(start: number, endIndex: number): void;\n    onprocessinginstruction(start: number, endIndex: number): void;\n    onselfclosingtag(endIndex: number): void;\n    ontext(start: number, endIndex: number): void;\n    ontextentity(codepoint: number, endIndex: number): void;\n    isInForeignContext?(): boolean;\n}\n\n/**\n * Sequences used to match longer strings.\n *\n * We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End\n * sequences with an increased offset.\n */\nconst Sequences = {\n    Empty: new Uint8Array(0),\n    Cdata: new Uint8Array([0x43, 0x44, 0x41, 0x54, 0x41, 0x5b]), // CDATA[\n    CdataEnd: new Uint8Array([0x5d, 0x5d, 0x3e]), // ]]>\n    CommentEnd: new Uint8Array([0x2d, 0x2d, 0x21, 0x3e]), // `--!>`\n    Doctype: new Uint8Array([0x64, 0x6f, 0x63, 0x74, 0x79, 0x70, 0x65]), // `doctype`\n    IframeEnd: new Uint8Array([0x3c, 0x2f, 0x69, 0x66, 0x72, 0x61, 0x6d, 0x65]), // `</iframe`\n    NoembedEnd: new Uint8Array([\n        0x3c, 0x2f, 0x6e, 0x6f, 0x65, 0x6d, 0x62, 0x65, 0x64,\n    ]), // `</noembed`\n    NoframesEnd: new Uint8Array([\n        0x3c, 0x2f, 0x6e, 0x6f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73,\n    ]), // `</noframes`\n    Plaintext: new Uint8Array([\n        0x3c, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74,\n    ]), // `</plaintext`\n    ScriptEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74]), // `</script`\n    StyleEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65]), // `</style`\n    TitleEnd: new Uint8Array([0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65]), // `</title`\n    TextareaEnd: new Uint8Array([\n        0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x61, 0x72, 0x65, 0x61,\n    ]), // `</textarea`\n    XmpEnd: new Uint8Array([0x3c, 0x2f, 0x78, 0x6d, 0x70]), // `</xmp`\n};\n\n/**\n * Maps the first lowercase character of an HTML tag name to the sequence\n * used for special-tag detection.  All sequences share a common layout\n * where index 2 is the first tag-name character, so matching always\n * continues from offset 3.\n */\nconst specialStartSequences = new Map<number, Uint8Array>([\n    [Sequences.IframeEnd[2], Sequences.IframeEnd],\n    [Sequences.NoembedEnd[2], Sequences.NoembedEnd],\n    [Sequences.Plaintext[2], Sequences.Plaintext],\n    [Sequences.ScriptEnd[2], Sequences.ScriptEnd],\n    [Sequences.TitleEnd[2], Sequences.TitleEnd],\n    [Sequences.XmpEnd[2], Sequences.XmpEnd],\n]);\n\n/**\n * Tokenizer implementation used by `Parser`.\n */\nexport default class Tokenizer {\n    /** The current state the tokenizer is in. */\n    private state = State.Text;\n    /** The read buffer. */\n    private buffer = \"\";\n    /** The beginning of the section that is currently being read. */\n    private sectionStart = 0;\n    /** The index within the buffer that we are currently looking at. */\n    private index = 0;\n    /** The start of the last entity. */\n    private entityStart = 0;\n    /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */\n    private baseState = State.Text;\n    /** For special parsing behavior inside of script and style tags. */\n    private isSpecial = false;\n    /** Indicates whether the tokenizer has been paused. */\n    running = true;\n    /** The offset of the current buffer. */\n    private offset = 0;\n\n    private readonly xmlMode: boolean;\n    private readonly decodeEntities: boolean;\n    private readonly recognizeSelfClosing: boolean;\n    private readonly entityDecoder: EntityDecoder;\n\n    constructor(\n        {\n            xmlMode = false,\n            decodeEntities = true,\n            recognizeSelfClosing = xmlMode,\n        }: {\n            xmlMode?: boolean;\n            decodeEntities?: boolean;\n            recognizeSelfClosing?: boolean;\n        },\n        private readonly cbs: Callbacks,\n    ) {\n        this.xmlMode = xmlMode;\n        this.decodeEntities = decodeEntities;\n        this.recognizeSelfClosing = recognizeSelfClosing;\n        this.entityDecoder = new EntityDecoder(\n            xmlMode ? xmlDecodeTree : htmlDecodeTree,\n            (cp, consumed) => this.emitCodePoint(cp, consumed),\n        );\n    }\n\n    reset(): void {\n        this.state = State.Text;\n        this.buffer = \"\";\n        this.sectionStart = 0;\n        this.index = 0;\n        this.baseState = State.Text;\n        this.isSpecial = false;\n        this.currentSequence = Sequences.Empty;\n        this.sequenceIndex = 0;\n        this.running = true;\n        this.offset = 0;\n    }\n\n    write(chunk: string): void {\n        this.offset += this.buffer.length;\n        this.buffer = chunk;\n        this.parse();\n    }\n\n    end(): void {\n        if (this.running) this.finish();\n    }\n\n    pause(): void {\n        this.running = false;\n    }\n\n    resume(): void {\n        this.running = true;\n        if (this.index < this.buffer.length + this.offset) {\n            this.parse();\n        }\n    }\n\n    private stateText(c: number): void {\n        if (\n            c === CharCodes.Lt ||\n            (!this.decodeEntities && this.fastForwardTo(CharCodes.Lt))\n        ) {\n            if (this.index > this.sectionStart) {\n                this.cbs.ontext(this.sectionStart, this.index);\n            }\n            this.state = State.BeforeTagName;\n            this.sectionStart = this.index;\n        } else if (this.decodeEntities && c === CharCodes.Amp) {\n            this.startEntity();\n        }\n    }\n\n    private currentSequence: Uint8Array = Sequences.Empty;\n    private sequenceIndex = 0;\n\n    private enterTagBody(): void {\n        if (this.currentSequence === Sequences.Plaintext) {\n            this.currentSequence = Sequences.Empty;\n            this.state = State.InPlainText;\n        } else if (this.isSpecial) {\n            this.state = State.InSpecialTag;\n            this.sequenceIndex = 0;\n        } else {\n            this.state = State.Text;\n        }\n    }\n\n    /**\n     * Match the opening tag name against an HTML text-only tag sequence.\n     *\n     * Some tags share an initial prefix (`script`/`style`, `title`/`textarea`,\n     * `noembed`/`noframes`), so we may switch to an alternate sequence at the\n     * first distinguishing byte.  On a successful full match we fall back to\n     * the normal tag-name state; a later `>` will enter raw-text, RCDATA, or\n     * plaintext mode based on `currentSequence` / `isSpecial`.\n     * @param c Current character code point.\n     */\n    private stateSpecialStartSequence(c: number): void {\n        const lower = c | 0x20;\n\n        // Still matching \u2014 check for an alternate sequence at branch points.\n        if (this.sequenceIndex < this.currentSequence.length) {\n            if (lower === this.currentSequence[this.sequenceIndex]) {\n                this.sequenceIndex++;\n                return;\n            }\n\n            if (this.sequenceIndex === 3) {\n                if (\n                    this.currentSequence === Sequences.ScriptEnd &&\n                    lower === Sequences.StyleEnd[3]\n                ) {\n                    this.currentSequence = Sequences.StyleEnd;\n                    this.sequenceIndex = 4;\n                    return;\n                }\n\n                if (\n                    this.currentSequence === Sequences.TitleEnd &&\n                    lower === Sequences.TextareaEnd[3]\n                ) {\n                    this.currentSequence = Sequences.TextareaEnd;\n                    this.sequenceIndex = 4;\n                    return;\n                }\n            } else if (\n                this.sequenceIndex === 4 &&\n                this.currentSequence === Sequences.NoembedEnd &&\n                lower === Sequences.NoframesEnd[4]\n            ) {\n                this.currentSequence = Sequences.NoframesEnd;\n                this.sequenceIndex = 5;\n                return;\n            }\n        } else if (isEndOfTagSection(c)) {\n            // Full match on a valid tag boundary \u2014 keep the sequence.\n            this.sequenceIndex = 0;\n            this.state = State.InTagName;\n            this.stateInTagName(c);\n            return;\n        }\n\n        // No match \u2014 abandon special-tag detection.\n        this.isSpecial = false;\n        this.currentSequence = Sequences.Empty;\n        this.sequenceIndex = 0;\n        this.state = State.InTagName;\n        this.stateInTagName(c);\n    }\n\n    private stateCDATASequence(c: number): void {\n        if (c === Sequences.Cdata[this.sequenceIndex]) {\n            if (++this.sequenceIndex === Sequences.Cdata.length) {\n                this.state = State.InCommentLike;\n                this.currentSequence = Sequences.CdataEnd;\n                this.sequenceIndex = 0;\n                this.sectionStart = this.index + 1;\n            }\n        } else {\n            this.sequenceIndex = 0;\n            if (this.xmlMode) {\n                this.state = State.InDeclaration;\n                this.stateInDeclaration(c); // Reconsume the character\n            } else {\n                this.state = State.InSpecialComment;\n                this.stateInSpecialComment(c); // Reconsume the character\n            }\n        }\n    }\n\n    /**\n     * When we wait for one specific character, we can speed things up\n     * by skipping through the buffer until we find it.\n     * @param c Current character code point.\n     * @returns Whether the character was found.\n     */\n    private fastForwardTo(c: number): boolean {\n        while (++this.index < this.buffer.length + this.offset) {\n            if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n                return true;\n            }\n        }\n\n        /*\n         * We increment the index at the end of the `parse` loop,\n         * so set it to `buffer.length - 1` here.\n         *\n         * TODO: Refactor `parse` to increment index before calling states.\n         */\n        this.index = this.buffer.length + this.offset - 1;\n\n        return false;\n    }\n\n    /**\n     * Emit a comment token and return to the text state.\n     * @param offset Number of characters in the end sequence that have already been matched.\n     */\n    private emitComment(offset: number): void {\n        this.cbs.oncomment(this.sectionStart, this.index, offset);\n        this.sequenceIndex = 0;\n        this.sectionStart = this.index + 1;\n        this.state = State.Text;\n    }\n\n    /**\n     * Comments and CDATA end with `-->` and `]]>`.\n     *\n     * Their common qualities are:\n     * - Their end sequences have a distinct character they start with.\n     * - That character is then repeated, so we have to check multiple repeats.\n     * - All characters but the start character of the sequence can be skipped.\n     * @param c Current character code point.\n     */\n    private stateInCommentLike(c: number): void {\n        if (\n            !this.xmlMode &&\n            this.currentSequence === Sequences.CommentEnd &&\n            this.sequenceIndex <= 1 &&\n            /*\n             * We're still at the very start of the comment: the only\n             * characters consumed since `<!--` are the dashes that\n             * advanced sequenceIndex (0 for `<!-->`, 1 for `<!--->`).\n             */\n            this.index === this.sectionStart + this.sequenceIndex &&\n            c === CharCodes.Gt\n        ) {\n            // Abruptly closed empty HTML comment.\n            this.emitComment(this.sequenceIndex);\n        } else if (\n            this.currentSequence === Sequences.CommentEnd &&\n            this.sequenceIndex === 2 &&\n            c === CharCodes.Gt\n        ) {\n            // `!` is optional here, so the same sequence also accepts `-->`.\n            this.emitComment(2);\n        } else if (\n            this.currentSequence === Sequences.CommentEnd &&\n            this.sequenceIndex === this.currentSequence.length - 1 &&\n            c !== CharCodes.Gt\n        ) {\n            this.sequenceIndex = Number(c === CharCodes.Dash);\n        } else if (c === this.currentSequence[this.sequenceIndex]) {\n            if (++this.sequenceIndex === this.currentSequence.length) {\n                if (this.currentSequence === Sequences.CdataEnd) {\n                    this.cbs.oncdata(this.sectionStart, this.index, 2);\n                } else {\n                    this.cbs.oncomment(this.sectionStart, this.index, 3);\n                }\n\n                this.sequenceIndex = 0;\n                this.sectionStart = this.index + 1;\n                this.state = State.Text;\n            }\n        } else if (this.sequenceIndex === 0) {\n            // Fast-forward to the first character of the sequence\n            if (this.fastForwardTo(this.currentSequence[0])) {\n                this.sequenceIndex = 1;\n            }\n        } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n            // Allow long sequences, eg. --->, ]]]>\n            this.sequenceIndex = 0;\n        }\n    }\n\n    /**\n     * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n     *\n     * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n     * We allow anything that wouldn't end the tag.\n     * @param c Current character code point.\n     */\n    private isTagStartChar(c: number) {\n        return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n    }\n\n    /**\n     * Scan raw-text / RCDATA content for the matching end tag.\n     *\n     * For RCDATA tags (`<title>`, `<textarea>`) entities are decoded inline.\n     * For raw-text tags (`<script>`, `<style>`, etc.) we fast-forward to `<`.\n     * @param c Current character code point.\n     */\n    private stateInSpecialTag(c: number): void {\n        if (this.sequenceIndex === this.currentSequence.length) {\n            if (isEndOfTagSection(c)) {\n                const endOfText = this.index - this.currentSequence.length;\n\n                if (this.sectionStart < endOfText) {\n                    // Spoof the index so that reported locations match up.\n                    const actualIndex = this.index;\n                    this.index = endOfText;\n                    this.cbs.ontext(this.sectionStart, endOfText);\n                    this.index = actualIndex;\n                }\n\n                this.isSpecial = false;\n                this.sectionStart = endOfText + 2; // Skip over the `</`\n                this.stateInClosingTagName(c);\n                return; // We are done; skip the rest of the function.\n            }\n\n            this.sequenceIndex = 0;\n        }\n\n        if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) {\n            this.sequenceIndex += 1;\n        } else if (this.sequenceIndex === 0) {\n            if (\n                this.currentSequence === Sequences.TitleEnd ||\n                this.currentSequence === Sequences.TextareaEnd\n            ) {\n                // RCDATA tags have to parse entities while still looking for their end tag.\n                if (this.decodeEntities && c === CharCodes.Amp) {\n                    this.startEntity();\n                }\n            } else if (this.fastForwardTo(CharCodes.Lt)) {\n                // Outside of RCDATA tags, we can fast-forward.\n                this.sequenceIndex = 1;\n            }\n        } else {\n            // If we see a `<`, set the sequence index to 1; useful for eg. `<</script>`.\n            this.sequenceIndex = Number(c === CharCodes.Lt);\n        }\n    }\n\n    private stateBeforeTagName(c: number): void {\n        if (c === CharCodes.ExclamationMark) {\n            this.state = State.BeforeDeclaration;\n            this.sectionStart = this.index + 1;\n        } else if (c === CharCodes.Questionmark) {\n            if (this.xmlMode) {\n                this.state = State.InProcessingInstruction;\n                this.sequenceIndex = 0;\n                this.sectionStart = this.index + 1;\n            } else {\n                this.state = State.InSpecialComment;\n                this.sectionStart = this.index;\n            }\n        } else if (this.isTagStartChar(c)) {\n            this.sectionStart = this.index;\n\n            const special =\n                this.xmlMode || this.cbs.isInForeignContext?.()\n                    ? undefined\n                    : specialStartSequences.get(c | 0x20);\n\n            if (special === undefined) {\n                this.state = State.InTagName;\n            } else {\n                this.isSpecial = true;\n                this.currentSequence = special;\n                this.sequenceIndex = 3;\n                this.state = State.SpecialStartSequence;\n            }\n        } else if (c === CharCodes.Slash) {\n            this.state = State.BeforeClosingTagName;\n        } else {\n            this.state = State.Text;\n            this.stateText(c);\n        }\n    }\n    private stateInTagName(c: number): void {\n        if (isEndOfTagSection(c)) {\n            this.cbs.onopentagname(this.sectionStart, this.index);\n            this.sectionStart = -1;\n            this.state = State.BeforeAttributeName;\n            this.stateBeforeAttributeName(c);\n        }\n    }\n    private stateBeforeClosingTagName(c: number): void {\n        if (isWhitespace(c)) {\n            if (this.xmlMode) {\n                // Ignore\n            } else {\n                this.state = State.InSpecialComment;\n                this.sectionStart = this.index;\n            }\n        } else if (c === CharCodes.Gt) {\n            this.state = State.Text;\n            if (!this.xmlMode) {\n                this.sectionStart = this.index + 1;\n            }\n        } else {\n            this.state = this.isTagStartChar(c)\n                ? State.InClosingTagName\n                : State.InSpecialComment;\n            this.sectionStart = this.index;\n        }\n    }\n    private stateInClosingTagName(c: number): void {\n        if (isEndOfTagSection(c)) {\n            this.cbs.onclosetag(this.sectionStart, this.index);\n            this.sectionStart = -1;\n            this.state = State.AfterClosingTagName;\n            this.stateAfterClosingTagName(c);\n        }\n    }\n    private stateAfterClosingTagName(c: number): void {\n        // Skip everything until \">\"\n        if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n            this.state = State.Text;\n            this.sectionStart = this.index + 1;\n        }\n    }\n    private stateBeforeAttributeName(c: number): void {\n        if (c === CharCodes.Gt) {\n            this.cbs.onopentagend(this.index);\n            this.enterTagBody();\n            this.sectionStart = this.index + 1;\n        } else if (c === CharCodes.Slash) {\n            this.state = State.InSelfClosingTag;\n        } else if (!isWhitespace(c)) {\n            this.state = State.InAttributeName;\n            this.sectionStart = this.index;\n        }\n    }\n    /**\n     * Handle `/` before `>` in an opening tag.\n     *\n     * In HTML mode, text-only tags ignore the self-closing flag and still enter\n     * their raw-text/RCDATA/plaintext state unless self-closing tags are being\n     * recognized. In XML mode, or for ordinary tags, the tokenizer returns to\n     * regular text parsing after emitting the self-closing callback.\n     * @param c Current character code point.\n     */\n    private stateInSelfClosingTag(c: number): void {\n        if (c === CharCodes.Gt) {\n            this.cbs.onselfclosingtag(this.index);\n            this.sectionStart = this.index + 1;\n\n            if (!this.recognizeSelfClosing) {\n                this.enterTagBody();\n                return;\n            }\n\n            this.state = State.Text;\n            this.isSpecial = false; // Reset special state, in case of self-closing special tags\n            this.currentSequence = Sequences.Empty;\n        } else if (!isWhitespace(c)) {\n            this.state = State.BeforeAttributeName;\n            this.stateBeforeAttributeName(c);\n        }\n    }\n    private stateInAttributeName(c: number): void {\n        if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n            this.cbs.onattribname(this.sectionStart, this.index);\n            this.sectionStart = this.index;\n            this.state = State.AfterAttributeName;\n            this.stateAfterAttributeName(c);\n        }\n    }\n    private stateAfterAttributeName(c: number): void {\n        if (c === CharCodes.Eq) {\n            this.state = State.BeforeAttributeValue;\n        } else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n            this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);\n            this.sectionStart = -1;\n            this.state = State.BeforeAttributeName;\n            this.stateBeforeAttributeName(c);\n        } else if (!isWhitespace(c)) {\n            this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);\n            this.state = State.InAttributeName;\n            this.sectionStart = this.index;\n        }\n    }\n    private stateBeforeAttributeValue(c: number): void {\n        if (c === CharCodes.DoubleQuote) {\n            this.state = State.InAttributeValueDq;\n            this.sectionStart = this.index + 1;\n        } else if (c === CharCodes.SingleQuote) {\n            this.state = State.InAttributeValueSq;\n            this.sectionStart = this.index + 1;\n        } else if (!isWhitespace(c)) {\n            this.sectionStart = this.index;\n            this.state = State.InAttributeValueNq;\n            this.stateInAttributeValueNoQuotes(c); // Reconsume token\n        }\n    }\n    private handleInAttributeValue(c: number, quote: number) {\n        if (\n            c === quote ||\n            (!this.decodeEntities && this.fastForwardTo(quote))\n        ) {\n            this.cbs.onattribdata(this.sectionStart, this.index);\n            this.sectionStart = -1;\n            this.cbs.onattribend(\n                quote === CharCodes.DoubleQuote\n                    ? QuoteType.Double\n                    : QuoteType.Single,\n                this.index + 1,\n            );\n            this.state = State.BeforeAttributeName;\n        } else if (this.decodeEntities && c === CharCodes.Amp) {\n            this.startEntity();\n        }\n    }\n    private stateInAttributeValueDoubleQuotes(c: number): void {\n        this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n    }\n    private stateInAttributeValueSingleQuotes(c: number): void {\n        this.handleInAttributeValue(c, CharCodes.SingleQuote);\n    }\n    private stateInAttributeValueNoQuotes(c: number): void {\n        if (isWhitespace(c) || c === CharCodes.Gt) {\n            this.cbs.onattribdata(this.sectionStart, this.index);\n            this.sectionStart = -1;\n            this.cbs.onattribend(QuoteType.Unquoted, this.index);\n            this.state = State.BeforeAttributeName;\n            this.stateBeforeAttributeName(c);\n        } else if (this.decodeEntities && c === CharCodes.Amp) {\n            this.startEntity();\n        }\n    }\n    /**\n     * Distinguish between CDATA, declarations, HTML comments, and HTML bogus\n     * comments after `<!`.\n     *\n     * In HTML mode, only real comments and doctypes stay on declaration paths;\n     * everything else becomes a bogus comment terminated by the next `>`.\n     * @param c Current character code point.\n     */\n    private stateBeforeDeclaration(c: number): void {\n        if (c === CharCodes.OpeningSquareBracket) {\n            this.state = State.CDATASequence;\n            this.sequenceIndex = 0;\n        } else if (this.xmlMode) {\n            this.state =\n                c === CharCodes.Dash\n                    ? State.BeforeComment\n                    : State.InDeclaration;\n        } else if ((c | 0x20) === Sequences.Doctype[0]) {\n            this.state = State.DeclarationSequence;\n            this.currentSequence = Sequences.Doctype;\n            this.sequenceIndex = 1;\n        } else if (c === CharCodes.Gt) {\n            this.cbs.oncomment(this.sectionStart, this.index, 0);\n            this.state = State.Text;\n            this.sectionStart = this.index + 1;\n        } else if (c === CharCodes.Dash) {\n            this.state = State.BeforeComment;\n        } else {\n            this.state = State.InSpecialComment;\n        }\n    }\n    /**\n     * Continue matching `doctype` after `<!d`.\n     *\n     * A full `doctype` match stays on the declaration path; any other name falls\n     * back to an HTML bogus comment, which matches browser behavior for\n     * non-doctype `<!...>` constructs.\n     * @param c Current character code point.\n     */\n    private stateDeclarationSequence(c: number): void {\n        if (this.sequenceIndex === this.currentSequence.length) {\n            this.state = State.InDeclaration;\n            this.stateInDeclaration(c);\n        } else if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) {\n            this.sequenceIndex += 1;\n        } else if (c === CharCodes.Gt) {\n            this.cbs.oncomment(this.sectionStart, this.index, 0);\n            this.state = State.Text;\n            this.sectionStart = this.index + 1;\n        } else {\n            this.state = State.InSpecialComment;\n        }\n    }\n    private stateInDeclaration(c: number): void {\n        if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n            this.cbs.ondeclaration(this.sectionStart, this.index);\n            this.state = State.Text;\n            this.sectionStart = this.index + 1;\n        }\n    }\n    /**\n     * XML processing instructions (`<?...?>`).\n     *\n     * In HTML mode `<?` is routed to `InSpecialComment` instead, so this\n     * state is only reachable in XML mode.\n     * @param c Current character code point.\n     */\n    private stateInProcessingInstruction(c: number): void {\n        if (c === CharCodes.Questionmark) {\n            // Remember that we just consumed `?`, so the next `>` closes the PI.\n            this.sequenceIndex = 1;\n        } else if (c === CharCodes.Gt && this.sequenceIndex === 1) {\n            this.cbs.onprocessinginstruction(this.sectionStart, this.index - 1);\n            this.sequenceIndex = 0;\n            this.state = State.Text;\n            this.sectionStart = this.index + 1;\n        } else {\n            // Keep scanning for the next `?`, which can start a closing `?>`.\n            this.sequenceIndex = Number(\n                this.fastForwardTo(CharCodes.Questionmark),\n            );\n        }\n    }\n    private stateBeforeComment(c: number): void {\n        if (c === CharCodes.Dash) {\n            this.state = State.InCommentLike;\n            this.currentSequence = Sequences.CommentEnd;\n            this.sequenceIndex = 0;\n            this.sectionStart = this.index + 1;\n        } else if (this.xmlMode) {\n            this.state = State.InDeclaration;\n        } else if (c === CharCodes.Gt) {\n            this.cbs.oncomment(this.sectionStart, this.index, 0);\n            this.state = State.Text;\n            this.sectionStart = this.index + 1;\n        } else {\n            this.state = State.InSpecialComment;\n        }\n    }\n    private stateInSpecialComment(c: number): void {\n        if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n            this.cbs.oncomment(this.sectionStart, this.index, 0);\n            this.state = State.Text;\n            this.sectionStart = this.index + 1;\n        }\n    }\n\n    private startEntity() {\n        this.baseState = this.state;\n        this.state = State.InEntity;\n        this.entityStart = this.index;\n        this.entityDecoder.startEntity(\n            this.xmlMode\n                ? DecodingMode.Strict\n                : this.baseState === State.Text ||\n                    this.baseState === State.InSpecialTag\n                  ? DecodingMode.Legacy\n                  : DecodingMode.Attribute,\n        );\n    }\n\n    private stateInEntity(): void {\n        const indexInBuffer = this.index - this.offset;\n        const length = this.entityDecoder.write(this.buffer, indexInBuffer);\n\n        // If `length` is positive, we are done with the entity.\n        if (length >= 0) {\n            this.state = this.baseState;\n\n            if (length === 0) {\n                this.index -= 1;\n            }\n        } else {\n            if (\n                indexInBuffer < this.buffer.length &&\n                this.buffer.charCodeAt(indexInBuffer) === CharCodes.Amp\n            ) {\n                this.state = this.baseState;\n                this.index -= 1;\n                return;\n            }\n\n            // Mark buffer as consumed.\n            this.index = this.offset + this.buffer.length - 1;\n        }\n    }\n\n    /**\n     * Remove data that has already been consumed from the buffer.\n     */\n    private cleanup() {\n        // If we are inside of text or attributes, emit what we already have.\n        if (this.running && this.sectionStart !== this.index) {\n            if (\n                this.state === State.Text ||\n                this.state === State.InPlainText ||\n                (this.state === State.InSpecialTag && this.sequenceIndex === 0)\n            ) {\n                this.cbs.ontext(this.sectionStart, this.index);\n                this.sectionStart = this.index;\n            } else if (\n                this.state === State.InAttributeValueDq ||\n                this.state === State.InAttributeValueSq ||\n                this.state === State.InAttributeValueNq\n            ) {\n                this.cbs.onattribdata(this.sectionStart, this.index);\n                this.sectionStart = this.index;\n            }\n        }\n    }\n\n    private shouldContinue() {\n        return this.index < this.buffer.length + this.offset && this.running;\n    }\n\n    /**\n     * Iterates through the buffer, calling the function corresponding to the current state.\n     *\n     * States that are more likely to be hit are higher up, as a performance improvement.\n     */\n    private parse() {\n        while (this.shouldContinue()) {\n            const c = this.buffer.charCodeAt(this.index - this.offset);\n            switch (this.state) {\n                case State.Text: {\n                    this.stateText(c);\n                    break;\n                }\n                case State.InPlainText: {\n                    // Skip to end of buffer; cleanup() emits the text.\n                    this.index = this.buffer.length + this.offset - 1;\n                    break;\n                }\n                case State.SpecialStartSequence: {\n                    this.stateSpecialStartSequence(c);\n                    break;\n                }\n                case State.InSpecialTag: {\n                    this.stateInSpecialTag(c);\n                    break;\n                }\n                case State.CDATASequence: {\n                    this.stateCDATASequence(c);\n                    break;\n                }\n                case State.DeclarationSequence: {\n                    this.stateDeclarationSequence(c);\n                    break;\n                }\n                case State.InAttributeValueDq: {\n                    this.stateInAttributeValueDoubleQuotes(c);\n                    break;\n                }\n                case State.InAttributeName: {\n                    this.stateInAttributeName(c);\n                    break;\n                }\n                case State.InCommentLike: {\n                    this.stateInCommentLike(c);\n                    break;\n                }\n                case State.InSpecialComment: {\n                    this.stateInSpecialComment(c);\n                    break;\n                }\n                case State.BeforeAttributeName: {\n                    this.stateBeforeAttributeName(c);\n                    break;\n                }\n                case State.InTagName: {\n                    this.stateInTagName(c);\n                    break;\n                }\n                case State.InClosingTagName: {\n                    this.stateInClosingTagName(c);\n                    break;\n                }\n                case State.BeforeTagName: {\n                    this.stateBeforeTagName(c);\n                    break;\n                }\n                case State.AfterAttributeName: {\n                    this.stateAfterAttributeName(c);\n                    break;\n                }\n                case State.InAttributeValueSq: {\n                    this.stateInAttributeValueSingleQuotes(c);\n                    break;\n                }\n                case State.BeforeAttributeValue: {\n                    this.stateBeforeAttributeValue(c);\n                    break;\n                }\n                case State.BeforeClosingTagName: {\n                    this.stateBeforeClosingTagName(c);\n                    break;\n                }\n                case State.AfterClosingTagName: {\n                    this.stateAfterClosingTagName(c);\n                    break;\n                }\n                case State.InAttributeValueNq: {\n                    this.stateInAttributeValueNoQuotes(c);\n                    break;\n                }\n                case State.InSelfClosingTag: {\n                    this.stateInSelfClosingTag(c);\n                    break;\n                }\n                case State.InDeclaration: {\n                    this.stateInDeclaration(c);\n                    break;\n                }\n                case State.BeforeDeclaration: {\n                    this.stateBeforeDeclaration(c);\n                    break;\n                }\n                case State.BeforeComment: {\n                    this.stateBeforeComment(c);\n                    break;\n                }\n                case State.InProcessingInstruction: {\n                    this.stateInProcessingInstruction(c);\n                    break;\n                }\n                case State.InEntity: {\n                    this.stateInEntity();\n                    break;\n                }\n            }\n            this.index++;\n        }\n        this.cleanup();\n    }\n\n    private finish() {\n        if (this.state === State.InEntity) {\n            this.entityDecoder.end();\n            this.state = this.baseState;\n        }\n\n        this.handleTrailingData();\n\n        this.cbs.onend();\n    }\n\n    private handleTrailingCommentLikeData(endIndex: number): boolean {\n        if (this.state !== State.InCommentLike) {\n            return false;\n        }\n\n        if (this.currentSequence === Sequences.CdataEnd) {\n            if (this.xmlMode) {\n                if (this.sectionStart < endIndex) {\n                    this.cbs.oncdata(this.sectionStart, endIndex, 0);\n                }\n            } else {\n                /* In HTML mode, unclosed CDATA is a bogus comment. */\n                const cdataStart =\n                    this.sectionStart - Sequences.Cdata.length - 1;\n                this.cbs.oncomment(cdataStart, endIndex, 0);\n            }\n        } else {\n            const offset = this.xmlMode\n                ? 0\n                : Math.min(this.sequenceIndex, Sequences.CommentEnd.length - 1);\n            this.cbs.oncomment(this.sectionStart, endIndex, offset);\n        }\n\n        return true;\n    }\n\n    private handleTrailingMarkupDeclaration(endIndex: number): boolean {\n        if (this.xmlMode) {\n            switch (this.state) {\n                case State.InSpecialComment:\n                case State.BeforeComment:\n                case State.CDATASequence:\n                case State.DeclarationSequence:\n                case State.InDeclaration: {\n                    this.cbs.ontext(this.sectionStart, endIndex);\n                    return true;\n                }\n                default: {\n                    return false;\n                }\n            }\n        }\n\n        switch (this.state) {\n            case State.BeforeDeclaration:\n            case State.InSpecialComment:\n            case State.BeforeComment:\n            case State.CDATASequence: {\n                this.cbs.oncomment(this.sectionStart, endIndex, 0);\n                return true;\n            }\n            case State.DeclarationSequence: {\n                if (this.sequenceIndex !== Sequences.Doctype.length) {\n                    this.cbs.oncomment(this.sectionStart, endIndex, 0);\n                }\n                return true;\n            }\n            case State.InDeclaration: {\n                return true;\n            }\n            default: {\n                return false;\n            }\n        }\n    }\n\n    /** Handle any trailing data. */\n    private handleTrailingData() {\n        const endIndex = this.buffer.length + this.offset;\n\n        if (\n            this.handleTrailingCommentLikeData(endIndex) ||\n            this.handleTrailingMarkupDeclaration(endIndex)\n        ) {\n            return;\n        }\n\n        // If there is no remaining data, we are done.\n        if (this.sectionStart >= endIndex) {\n            return;\n        }\n\n        switch (this.state) {\n            case State.InTagName:\n            case State.BeforeAttributeName:\n            case State.BeforeAttributeValue:\n            case State.AfterAttributeName:\n            case State.InAttributeName:\n            case State.InAttributeValueSq:\n            case State.InAttributeValueDq:\n            case State.InAttributeValueNq:\n            case State.InClosingTagName: {\n                /*\n                 * If we are currently in an opening or closing tag, us not calling the\n                 * respective callback signals that the tag should be ignored.\n                 */\n                break;\n            }\n            default: {\n                this.cbs.ontext(this.sectionStart, endIndex);\n            }\n        }\n    }\n\n    private emitCodePoint(cp: number, consumed: number): void {\n        if (\n            this.baseState !== State.Text &&\n            this.baseState !== State.InSpecialTag\n        ) {\n            if (this.sectionStart < this.entityStart) {\n                this.cbs.onattribdata(this.sectionStart, this.entityStart);\n            }\n            this.sectionStart = this.entityStart + consumed;\n            this.index = this.sectionStart - 1;\n\n            this.cbs.onattribentity(cp);\n        } else {\n            if (this.sectionStart < this.entityStart) {\n                this.cbs.ontext(this.sectionStart, this.entityStart);\n            }\n            this.sectionStart = this.entityStart + consumed;\n            this.index = this.sectionStart - 1;\n\n            this.cbs.ontextentity(cp, this.sectionStart);\n        }\n    }\n}\n", "const { fromCodePoint } = String;\n\nimport Tokenizer, { type Callbacks, QuoteType } from \"./Tokenizer.js\";\n\nconst formTags = new Set([\n    \"input\",\n    \"option\",\n    \"optgroup\",\n    \"select\",\n    \"button\",\n    \"datalist\",\n    \"textarea\",\n]);\nconst pTag = new Set([\"p\"]);\nconst headingTags = new Set([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"p\"]);\nconst tableSectionTags = new Set([\"thead\", \"tbody\"]);\nconst ddtTags = new Set([\"dd\", \"dt\"]);\nconst rtpTags = new Set([\"rt\", \"rp\"]);\n\nconst openImpliesClose = new Map<string, Set<string>>([\n    [\"tr\", new Set([\"tr\", \"th\", \"td\"])],\n    [\"th\", new Set([\"th\"])],\n    [\"td\", new Set([\"thead\", \"th\", \"td\"])],\n    [\"body\", new Set([\"head\", \"link\", \"script\"])],\n    [\"a\", new Set([\"a\"])],\n    [\"li\", new Set([\"li\"])],\n    [\"p\", pTag],\n    [\"h1\", headingTags],\n    [\"h2\", headingTags],\n    [\"h3\", headingTags],\n    [\"h4\", headingTags],\n    [\"h5\", headingTags],\n    [\"h6\", headingTags],\n    [\"select\", formTags],\n    [\"input\", formTags],\n    [\"output\", formTags],\n    [\"button\", formTags],\n    [\"datalist\", formTags],\n    [\"textarea\", formTags],\n    [\"option\", new Set([\"option\"])],\n    [\"optgroup\", new Set([\"optgroup\", \"option\"])],\n    [\"dd\", ddtTags],\n    [\"dt\", ddtTags],\n    [\"address\", pTag],\n    [\"article\", pTag],\n    [\"aside\", pTag],\n    [\"blockquote\", pTag],\n    [\"details\", pTag],\n    [\"div\", pTag],\n    [\"dl\", pTag],\n    [\"fieldset\", pTag],\n    [\"figcaption\", pTag],\n    [\"figure\", pTag],\n    [\"footer\", pTag],\n    [\"form\", pTag],\n    [\"header\", pTag],\n    [\"hr\", pTag],\n    [\"main\", pTag],\n    [\"nav\", pTag],\n    [\"ol\", pTag],\n    [\"pre\", pTag],\n    [\"section\", pTag],\n    [\"table\", pTag],\n    [\"ul\", pTag],\n    [\"rt\", rtpTags],\n    [\"rp\", rtpTags],\n    [\"tbody\", tableSectionTags],\n    [\"tfoot\", tableSectionTags],\n]);\n\nconst DOCUMENT_TYPE = \"doctype\";\n\nconst voidElements = new Set([\n    \"area\",\n    \"base\",\n    \"basefont\",\n    \"br\",\n    \"col\",\n    \"command\",\n    \"embed\",\n    \"frame\",\n    \"hr\",\n    \"img\",\n    \"input\",\n    \"isindex\",\n    \"keygen\",\n    \"link\",\n    \"meta\",\n    \"param\",\n    \"source\",\n    \"track\",\n    \"wbr\",\n]);\n\nconst foreignContextElements = new Set([\"math\", \"svg\"]);\n\n/**\n * Elements that can be used to integrate HTML content within foreign namespaces (e.g., SVG or MathML).\n *\n * Entries must use the SVG-adjusted casing (e.g. \"foreignObject\" not\n * \"foreignobject\") since they are compared against adjusted tag names.\n */\nconst htmlIntegrationElements = new Set([\n    \"mi\",\n    \"mo\",\n    \"mn\",\n    \"ms\",\n    \"mtext\",\n    \"annotation-xml\",\n    \"foreignObject\",\n    \"desc\",\n    \"title\",\n]);\n\nconst svgTagNameAdjustments = new Map<string, string>([\n    [\"altglyph\", \"altGlyph\"],\n    [\"altglyphdef\", \"altGlyphDef\"],\n    [\"altglyphitem\", \"altGlyphItem\"],\n    [\"animatecolor\", \"animateColor\"],\n    [\"animatemotion\", \"animateMotion\"],\n    [\"animatetransform\", \"animateTransform\"],\n    [\"clippath\", \"clipPath\"],\n    [\"feblend\", \"feBlend\"],\n    [\"fecolormatrix\", \"feColorMatrix\"],\n    [\"fecomponenttransfer\", \"feComponentTransfer\"],\n    [\"fecomposite\", \"feComposite\"],\n    [\"feconvolvematrix\", \"feConvolveMatrix\"],\n    [\"fediffuselighting\", \"feDiffuseLighting\"],\n    [\"fedisplacementmap\", \"feDisplacementMap\"],\n    [\"fedistantlight\", \"feDistantLight\"],\n    [\"fedropshadow\", \"feDropShadow\"],\n    [\"feflood\", \"feFlood\"],\n    [\"fefunca\", \"feFuncA\"],\n    [\"fefuncb\", \"feFuncB\"],\n    [\"fefuncg\", \"feFuncG\"],\n    [\"fefuncr\", \"feFuncR\"],\n    [\"fegaussianblur\", \"feGaussianBlur\"],\n    [\"feimage\", \"feImage\"],\n    [\"femerge\", \"feMerge\"],\n    [\"femergenode\", \"feMergeNode\"],\n    [\"femorphology\", \"feMorphology\"],\n    [\"feoffset\", \"feOffset\"],\n    [\"fepointlight\", \"fePointLight\"],\n    [\"fespecularlighting\", \"feSpecularLighting\"],\n    [\"fespotlight\", \"feSpotLight\"],\n    [\"fetile\", \"feTile\"],\n    [\"feturbulence\", \"feTurbulence\"],\n    [\"foreignobject\", \"foreignObject\"],\n    [\"glyphref\", \"glyphRef\"],\n    [\"lineargradient\", \"linearGradient\"],\n    [\"radialgradient\", \"radialGradient\"],\n    [\"textpath\", \"textPath\"],\n]);\n\nconst enum ForeignContext {\n    None,\n    Svg,\n    MathML,\n}\n\n/**\n * Options for the streaming HTML/XML parser.\n */\nexport interface ParserOptions {\n    /**\n     * Indicates whether special tags (`<script>`, `<style>`, and `<title>`) should get special treatment\n     * and if \"empty\" tags (eg. `<br>`) can have children.  If `false`, the content of special tags\n     * will be text only. For feeds and other XML content (documents that don't consist of HTML),\n     * set this to `true`.\n     * @default false\n     */\n    xmlMode?: boolean;\n\n    /**\n     * Decode entities within the document.\n     * @default true\n     */\n    decodeEntities?: boolean;\n\n    /**\n     * If set to true, all tags will be lowercased.\n     * @default !xmlMode\n     */\n    lowerCaseTags?: boolean;\n\n    /**\n     * If set to `true`, all attribute names will be lowercased. This has noticeable impact on speed.\n     * @default !xmlMode\n     */\n    lowerCaseAttributeNames?: boolean;\n\n    /**\n     * If set to true, CDATA sections will be recognized as text even if the xmlMode option is not enabled.\n     * NOTE: If xmlMode is set to `true` then CDATA sections will always be recognized as text.\n     * @default xmlMode\n     */\n    recognizeCDATA?: boolean;\n\n    /**\n     * If set to `true`, self-closing tags will trigger the onclosetag event even if xmlMode is not set to `true`.\n     * NOTE: If xmlMode is set to `true` then self-closing tags will always be recognized.\n     * @default xmlMode\n     */\n    recognizeSelfClosing?: boolean;\n\n    /**\n     * Allows the default tokenizer to be overwritten.\n     */\n    Tokenizer?: typeof Tokenizer;\n}\n\n/**\n * Parser callback interface used by the tokenizer.\n */\nexport interface Handler {\n    onparserinit(parser: Parser): void;\n\n    /**\n     * Resets the handler back to starting state\n     */\n    onreset(): void;\n\n    /**\n     * Signals the handler that parsing is done\n     */\n    onend(): void;\n    onerror(error: Error): void;\n    onclosetag(name: string, isImplied: boolean): void;\n    onopentagname(name: string): void;\n    /**\n     *\n     * @param name Name of the attribute\n     * @param value Value of the attribute.\n     * @param quote Quotes used around the attribute. `null` if the attribute has no quotes around the value, `undefined` if the attribute has no value.\n     */\n    onattribute(\n        name: string,\n        value: string,\n        quote?: string | undefined | null,\n    ): void;\n    onopentag(\n        name: string,\n        attribs: { [s: string]: string },\n        isImplied: boolean,\n    ): void;\n    ontext(data: string): void;\n    oncomment(data: string): void;\n    oncdatastart(): void;\n    oncdataend(): void;\n    oncommentend(): void;\n    onprocessinginstruction(name: string, data: string): void;\n}\n\nconst reNameEnd = /\\s|\\//;\n\n/**\n * Incremental parser implementation.\n */\nexport class Parser implements Callbacks {\n    /** The start index of the last event. */\n    startIndex = 0;\n    /** The end index of the last event. */\n    endIndex = 0;\n    /**\n     * Store the start index of the current open tag,\n     * so we can update the start index for attributes.\n     */\n    private openTagStart = 0;\n\n    private tagname = \"\";\n    private attribname = \"\";\n    private attribvalue = \"\";\n    private attribs: null | { [key: string]: string } = null;\n    private readonly stack: string[] = [];\n    private readonly foreignContext: ForeignContext[];\n    private readonly cbs: Partial<Handler>;\n    private readonly lowerCaseTagNames: boolean;\n    private readonly lowerCaseAttributeNames: boolean;\n    private readonly recognizeSelfClosing: boolean;\n    /** We are parsing HTML. Inverse of the `xmlMode` option. */\n    private readonly htmlMode: boolean;\n    private readonly tokenizer: Tokenizer;\n\n    private readonly buffers: string[] = [];\n    private bufferOffset = 0;\n    /** The index of the last written buffer. Used when resuming after a `pause()`. */\n    private writeIndex = 0;\n    /** Indicates whether the parser has finished running / `.end` has been called. */\n    private ended = false;\n\n    constructor(\n        cbs?: Partial<Handler> | null,\n        private readonly options: ParserOptions = {},\n    ) {\n        this.cbs = cbs ?? {};\n        this.htmlMode = !this.options.xmlMode;\n        this.lowerCaseTagNames = options.lowerCaseTags ?? this.htmlMode;\n        this.lowerCaseAttributeNames =\n            options.lowerCaseAttributeNames ?? this.htmlMode;\n        this.recognizeSelfClosing =\n            options.recognizeSelfClosing ?? !this.htmlMode;\n        this.tokenizer = new (options.Tokenizer ?? Tokenizer)(\n            this.options,\n            this,\n        );\n        this.foreignContext = [ForeignContext.None];\n        this.cbs.onparserinit?.(this);\n    }\n\n    // Tokenizer event handlers\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    ontext(start: number, endIndex: number): void {\n        const data = this.getSlice(start, endIndex);\n        this.endIndex = endIndex - 1;\n        this.cbs.ontext?.(data);\n        this.startIndex = endIndex;\n    }\n\n    /**\n     * @param cp Current Unicode code point.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    ontextentity(cp: number, endIndex: number): void {\n        this.endIndex = endIndex - 1;\n        this.cbs.ontext?.(fromCodePoint(cp));\n        this.startIndex = endIndex;\n    }\n\n    /** @internal */\n    isInForeignContext(): boolean {\n        return this.foreignContext[0] !== ForeignContext.None;\n    }\n\n    /**\n     * Checks if the current tag is a void element. Override this if you want\n     * to specify your own additional void elements.\n     * @param name Name of the pseudo selector.\n     */\n    protected isVoidElement(name: string): boolean {\n        return this.htmlMode && voidElements.has(name);\n    }\n\n    /**\n     * Read a tag name from the buffer.\n     *\n     * When `lowerCaseTagNames` is enabled (the default in HTML mode), the name\n     * is lowercased and may be adjusted for SVG casing or the `image` \u2192 `img`\n     * alias.\n     * @param start Start index of the tag name in the buffer.\n     * @param endIndex End index of the tag name in the buffer.\n     */\n    private readTagName(start: number, endIndex: number): string {\n        const name = this.lowerCaseTagNames\n            ? this.getSlice(start, endIndex).toLowerCase()\n            : this.getSlice(start, endIndex);\n\n        if (!(this.lowerCaseTagNames && this.htmlMode)) {\n            return name;\n        }\n\n        if (this.foreignContext[0] === ForeignContext.Svg) {\n            return svgTagNameAdjustments.get(name) ?? name;\n        }\n\n        /*\n         * Closing tags for SVG elements inside HTML integration points\n         * (e.g. </foreignObject> while inside its own content) need case\n         * adjustment so the name matches what was pushed to the stack.\n         * `foreignContext.length > 1` means a foreign ancestor exists \u2014\n         * the base [None] entry plus at least one pushed context.\n         */\n        if (this.foreignContext.length > 1) {\n            const adjusted = svgTagNameAdjustments.get(name);\n            if (adjusted !== undefined && this.stack.includes(adjusted)) {\n                return adjusted;\n            }\n        }\n\n        if (!this.isInForeignContext()) {\n            return name === \"image\" ? \"img\" : name;\n        }\n\n        return name;\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onopentagname(start: number, endIndex: number): void {\n        this.endIndex = endIndex;\n        this.emitOpenTag(this.readTagName(start, endIndex));\n    }\n\n    private emitOpenTag(name: string) {\n        this.openTagStart = this.startIndex;\n        this.tagname = name;\n\n        /*\n         * The spec ignores a second <form> when one is already open.\n         * Setting tagname to \"\" suppresses all downstream effects: attribs\n         * stays null so endOpenTag is a no-op, and closeCurrentTag can't\n         * match \"\" on the stack.\n         */\n        if (this.htmlMode && name === \"form\" && this.stack.includes(\"form\")) {\n            this.tagname = \"\";\n            return;\n        }\n\n        const impliesClose = this.htmlMode && openImpliesClose.get(name);\n\n        if (impliesClose) {\n            while (this.stack.length > 0 && impliesClose.has(this.stack[0])) {\n                this.popElement(true);\n            }\n        }\n        if (!this.isVoidElement(name)) {\n            this.stack.unshift(name);\n\n            if (this.htmlMode) {\n                if (name === \"svg\") {\n                    this.foreignContext.unshift(ForeignContext.Svg);\n                } else if (name === \"math\") {\n                    this.foreignContext.unshift(ForeignContext.MathML);\n                } else if (htmlIntegrationElements.has(name)) {\n                    this.foreignContext.unshift(ForeignContext.None);\n                }\n            }\n        }\n        this.cbs.onopentagname?.(name);\n        if (this.cbs.onopentag) this.attribs = {};\n    }\n\n    private endOpenTag(isImplied: boolean) {\n        this.startIndex = this.openTagStart;\n\n        if (this.attribs) {\n            this.cbs.onopentag?.(this.tagname, this.attribs, isImplied);\n            this.attribs = null;\n        }\n        if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {\n            this.cbs.onclosetag(this.tagname, true);\n        }\n\n        this.tagname = \"\";\n    }\n\n    /**\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onopentagend(endIndex: number): void {\n        this.endIndex = endIndex;\n        this.endOpenTag(false);\n\n        // Set `startIndex` for next node\n        this.startIndex = endIndex + 1;\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onclosetag(start: number, endIndex: number): void {\n        this.endIndex = endIndex;\n        const name = this.readTagName(start, endIndex);\n\n        if (!this.isVoidElement(name)) {\n            const pos = this.stack.indexOf(name);\n            if (pos !== -1) {\n                for (let index = 0; index < pos; index++) {\n                    this.popElement(true);\n                }\n                this.popElement(false);\n            } else if (this.htmlMode && name === \"p\") {\n                // Implicit open before close\n                this.emitOpenTag(\"p\");\n                this.closeCurrentTag(true);\n            }\n        } else if (this.htmlMode && name === \"br\") {\n            // We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.\n            this.cbs.onopentagname?.(\"br\");\n            this.cbs.onopentag?.(\"br\", {}, true);\n            this.cbs.onclosetag?.(\"br\", false);\n        }\n\n        // Set `startIndex` for next node\n        this.startIndex = endIndex + 1;\n    }\n\n    /**\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onselfclosingtag(endIndex: number): void {\n        this.endIndex = endIndex;\n        if (this.recognizeSelfClosing || this.isInForeignContext()) {\n            this.closeCurrentTag(false);\n\n            // Set `startIndex` for next node\n            this.startIndex = endIndex + 1;\n        } else {\n            // Ignore the fact that the tag is self-closing.\n            this.onopentagend(endIndex);\n        }\n    }\n\n    /**\n     * Pop the top element off the stack, emit a close event, and maintain\n     * the foreign context stack.\n     * @param implied Whether this close is implied (not from an explicit end tag).\n     */\n    private popElement(implied: boolean): void {\n        // biome-ignore lint/style/noNonNullAssertion: The element is guaranteed to exist.\n        const element = this.stack.shift()!;\n        if (\n            this.htmlMode &&\n            (foreignContextElements.has(element) ||\n                htmlIntegrationElements.has(element))\n        ) {\n            this.foreignContext.shift();\n        }\n        this.cbs.onclosetag?.(element, implied);\n    }\n\n    private closeCurrentTag(isOpenImplied: boolean) {\n        const name = this.tagname;\n        this.endOpenTag(isOpenImplied);\n\n        // Self-closing tags will be on the top of the stack\n        if (this.stack[0] === name) {\n            this.popElement(!isOpenImplied);\n        }\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onattribname(start: number, endIndex: number): void {\n        this.startIndex = start;\n        const name = this.getSlice(start, endIndex);\n\n        this.attribname = this.lowerCaseAttributeNames\n            ? name.toLowerCase()\n            : name;\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onattribdata(start: number, endIndex: number): void {\n        this.attribvalue += this.getSlice(start, endIndex);\n    }\n\n    /**\n     * @param cp Current Unicode code point.\n     * @internal\n     */\n    onattribentity(cp: number): void {\n        this.attribvalue += fromCodePoint(cp);\n    }\n\n    /**\n     * @param quote Quote type used for the current attribute.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onattribend(quote: QuoteType, endIndex: number): void {\n        this.endIndex = endIndex;\n\n        this.cbs.onattribute?.(\n            this.attribname,\n            this.attribvalue,\n            quote === QuoteType.Double\n                ? '\"'\n                : quote === QuoteType.Single\n                  ? \"'\"\n                  : quote === QuoteType.NoValue\n                    ? undefined\n                    : null,\n        );\n\n        if (this.attribs && !Object.hasOwn(this.attribs, this.attribname)) {\n            this.attribs[this.attribname] = this.attribvalue;\n        }\n        this.attribvalue = \"\";\n    }\n\n    private getInstructionName(value: string) {\n        const index = value.search(reNameEnd);\n        let name = index < 0 ? value : value.substr(0, index);\n\n        if (this.lowerCaseTagNames) {\n            name = name.toLowerCase();\n        }\n\n        return name;\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    ondeclaration(start: number, endIndex: number): void {\n        this.endIndex = endIndex;\n        const value = this.getSlice(start, endIndex);\n\n        if (this.cbs.onprocessinginstruction) {\n            /*\n             * In HTML mode, ondeclaration is only reached for DOCTYPE\n             * (the tokenizer routes everything else to bogus comments).\n             */\n            const name = this.htmlMode\n                ? this.lowerCaseTagNames\n                    ? DOCUMENT_TYPE\n                    : value.slice(0, DOCUMENT_TYPE.length)\n                : this.getInstructionName(value);\n            this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);\n        }\n\n        // Set `startIndex` for next node\n        this.startIndex = endIndex + 1;\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @internal\n     */\n    onprocessinginstruction(start: number, endIndex: number): void {\n        this.endIndex = endIndex;\n        const value = this.getSlice(start, endIndex);\n\n        if (this.cbs.onprocessinginstruction) {\n            const name = this.getInstructionName(value);\n            this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);\n        }\n\n        // Set `startIndex` for next node\n        this.startIndex = endIndex + 1;\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @param offset Offset applied when computing parser indices.\n     * @internal\n     */\n    oncomment(start: number, endIndex: number, offset: number): void {\n        this.endIndex = endIndex;\n\n        this.cbs.oncomment?.(this.getSlice(start, endIndex - offset));\n        this.cbs.oncommentend?.();\n\n        // Set `startIndex` for next node\n        this.startIndex = endIndex + 1;\n    }\n\n    /**\n     * @param start Start index for the current parser event.\n     * @param endIndex End index for the current parser event.\n     * @param offset Offset applied when computing parser indices.\n     * @internal\n     */\n    oncdata(start: number, endIndex: number, offset: number): void {\n        this.endIndex = endIndex;\n        const value = this.getSlice(start, endIndex - offset);\n\n        if (!this.htmlMode || this.options.recognizeCDATA) {\n            this.cbs.oncdatastart?.();\n            this.cbs.ontext?.(value);\n            this.cbs.oncdataend?.();\n        } else if (this.isInForeignContext()) {\n            this.cbs.ontext?.(value);\n        } else {\n            this.cbs.oncomment?.(`[CDATA[${value}]]`);\n            this.cbs.oncommentend?.();\n        }\n\n        // Set `startIndex` for next node\n        this.startIndex = endIndex + 1;\n    }\n\n    /** @internal */\n    onend(): void {\n        if (this.cbs.onclosetag) {\n            // Set the end index for all remaining tags\n            this.endIndex = this.startIndex;\n            for (let index = 0; index < this.stack.length; index++) {\n                this.cbs.onclosetag(this.stack[index], true);\n            }\n        }\n        this.cbs.onend?.();\n    }\n\n    /**\n     * Resets the parser to a blank state, ready to parse a new HTML document\n     */\n    reset(): void {\n        this.cbs.onreset?.();\n        this.tokenizer.reset();\n        this.tagname = \"\";\n        this.attribname = \"\";\n        this.attribvalue = \"\";\n        this.attribs = null;\n        this.stack.length = 0;\n        this.startIndex = 0;\n        this.endIndex = 0;\n        this.cbs.onparserinit?.(this);\n        this.buffers.length = 0;\n        this.foreignContext.length = 0;\n        this.foreignContext.unshift(ForeignContext.None);\n        this.bufferOffset = 0;\n        this.writeIndex = 0;\n        this.ended = false;\n    }\n\n    /**\n     * Resets the parser, then parses a complete document and\n     * pushes it to the handler.\n     * @param data Document to parse.\n     */\n    parseComplete(data: string): void {\n        this.reset();\n        this.end(data);\n    }\n\n    private getSlice(start: number, end: number) {\n        if (start === end) {\n            return \"\";\n        }\n\n        while (start - this.bufferOffset >= this.buffers[0].length) {\n            this.shiftBuffer();\n        }\n\n        let slice = this.buffers[0].slice(\n            start - this.bufferOffset,\n            end - this.bufferOffset,\n        );\n\n        while (end - this.bufferOffset > this.buffers[0].length) {\n            this.shiftBuffer();\n            slice += this.buffers[0].slice(0, end - this.bufferOffset);\n        }\n\n        return slice;\n    }\n\n    private shiftBuffer(): void {\n        this.bufferOffset += this.buffers[0].length;\n        this.writeIndex--;\n        this.buffers.shift();\n    }\n\n    /**\n     * Parses a chunk of data and calls the corresponding callbacks.\n     * @param chunk Chunk to parse.\n     */\n    write(chunk: string): void {\n        if (this.ended) {\n            this.cbs.onerror?.(new Error(\".write() after done!\"));\n            return;\n        }\n\n        this.buffers.push(chunk);\n        if (this.tokenizer.running) {\n            this.tokenizer.write(chunk);\n            this.writeIndex++;\n        }\n    }\n\n    /**\n     * Parses the end of the buffer and clears the stack, calls onend.\n     * @param chunk Optional final chunk to parse.\n     */\n    end(chunk?: string): void {\n        if (this.ended) {\n            this.cbs.onerror?.(new Error(\".end() after done!\"));\n            return;\n        }\n\n        if (chunk) this.write(chunk);\n        this.ended = true;\n        this.tokenizer.end();\n    }\n\n    /**\n     * Pauses parsing. The parser won't emit events until `resume` is called.\n     */\n    pause(): void {\n        this.tokenizer.pause();\n    }\n\n    /**\n     * Resumes parsing after `pause` was called.\n     */\n    resume(): void {\n        this.tokenizer.resume();\n\n        while (\n            this.tokenizer.running &&\n            this.writeIndex < this.buffers.length\n        ) {\n            this.tokenizer.write(this.buffers[this.writeIndex++]);\n        }\n\n        if (this.ended) this.tokenizer.end();\n    }\n}\n", "/** Types of elements found in htmlparser2's DOM */\nexport var ElementType;\n(function (ElementType) {\n    /** Type for the root element of a document */\n    ElementType[\"Root\"] = \"root\";\n    /** Type for Text */\n    ElementType[\"Text\"] = \"text\";\n    /** Type for <? ... ?> */\n    ElementType[\"Directive\"] = \"directive\";\n    /** Type for <!-- ... --> */\n    ElementType[\"Comment\"] = \"comment\";\n    /** Type for <script> tags */\n    ElementType[\"Script\"] = \"script\";\n    /** Type for <style> tags */\n    ElementType[\"Style\"] = \"style\";\n    /** Type for Any tag */\n    ElementType[\"Tag\"] = \"tag\";\n    /** Type for <![CDATA[ ... ]]> */\n    ElementType[\"CDATA\"] = \"cdata\";\n    /** Type for <!doctype ...> */\n    ElementType[\"Doctype\"] = \"doctype\";\n})(ElementType || (ElementType = {}));\n/**\n * Tests whether an element is a tag or not.\n * @param element Element to test\n * @param element.type Node type discriminator to check.\n */\nexport function isTag(element) {\n    return (element.type === ElementType.Tag ||\n        element.type === ElementType.Script ||\n        element.type === ElementType.Style);\n}\n// Exports for backwards compatibility\n/** Type for the root element of a document */\n// eslint-disable-next-line prefer-destructuring\nexport const Root = ElementType.Root;\n/** Type for Text */\n// eslint-disable-next-line prefer-destructuring\nexport const Text = ElementType.Text;\n/** Type for <? ... ?> */\n// eslint-disable-next-line prefer-destructuring\nexport const Directive = ElementType.Directive;\n/** Type for <!-- ... --> */\n// eslint-disable-next-line prefer-destructuring\nexport const Comment = ElementType.Comment;\n/** Type for <script> tags */\n// eslint-disable-next-line prefer-destructuring\nexport const Script = ElementType.Script;\n/** Type for <style> tags */\n// eslint-disable-next-line prefer-destructuring\nexport const Style = ElementType.Style;\n/** Type for Any tag */\n// eslint-disable-next-line prefer-destructuring\nexport const Tag = ElementType.Tag;\n/** Type for <![CDATA[ ... ]]> */\n// eslint-disable-next-line prefer-destructuring\nexport const CDATA = ElementType.CDATA;\n/** Type for <!doctype ...> */\n// eslint-disable-next-line prefer-destructuring\nexport const Doctype = ElementType.Doctype;\n", "import { ElementType, isTag as isTagRaw } from \"domelementtype\";\n/**\n * This object will be used as the prototype for Nodes when creating a\n * DOM-Level-1-compliant structure.\n */\nexport class Node {\n    /** Parent of the node */\n    parent = null;\n    /** Previous sibling */\n    prev = null;\n    /** Next sibling */\n    next = null;\n    /** The start index of the node. Requires `withStartIndices` on the handler to be `true. */\n    startIndex = null;\n    /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */\n    endIndex = null;\n    // Read-write aliases for properties\n    /**\n     * Same as {@link parent}.\n     * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n     */\n    get parentNode() {\n        return this.parent;\n    }\n    set parentNode(parent) {\n        this.parent = parent;\n    }\n    /**\n     * Same as {@link prev}.\n     * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n     */\n    get previousSibling() {\n        return this.prev;\n    }\n    set previousSibling(previous) {\n        this.prev = previous;\n    }\n    /**\n     * Same as {@link next}.\n     * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n     */\n    get nextSibling() {\n        return this.next;\n    }\n    set nextSibling(next) {\n        this.next = next;\n    }\n    /**\n     * Clone this node, and optionally its children.\n     * @param recursive Clone child nodes as well.\n     * @returns A clone of the node.\n     */\n    cloneNode(recursive = false) {\n        return cloneNode(this, recursive);\n    }\n}\n/**\n * A node that contains some data.\n */\nexport class DataNode extends Node {\n    data;\n    /**\n     * @param data The content of the data node\n     */\n    constructor(data) {\n        super();\n        this.data = data;\n    }\n    /**\n     * Same as {@link data}.\n     * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n     */\n    get nodeValue() {\n        return this.data;\n    }\n    set nodeValue(data) {\n        this.data = data;\n    }\n}\n/**\n * Text within the document.\n */\nexport class Text extends DataNode {\n    type = ElementType.Text;\n    get nodeType() {\n        return 3;\n    }\n}\n/**\n * Comments within the document.\n */\nexport class Comment extends DataNode {\n    type = ElementType.Comment;\n    get nodeType() {\n        return 8;\n    }\n}\n/**\n * Processing instructions, including doc types.\n */\nexport class ProcessingInstruction extends DataNode {\n    type = ElementType.Directive;\n    name;\n    constructor(name, data) {\n        super(data);\n        this.name = name;\n    }\n    get nodeType() {\n        return 1;\n    }\n    /** If this is a doctype, the document type name (parse5 only). */\n    \"x-name\";\n    /** If this is a doctype, the document type public identifier (parse5 only). */\n    \"x-publicId\";\n    /** If this is a doctype, the document type system identifier (parse5 only). */\n    \"x-systemId\";\n}\n/**\n * A node that can have children.\n */\nexport class NodeWithChildren extends Node {\n    children;\n    /**\n     * @param children Children of the node. Only certain node types can have children.\n     */\n    constructor(children) {\n        super();\n        this.children = children;\n    }\n    // Aliases\n    /** First child of the node. */\n    get firstChild() {\n        return this.children[0] ?? null;\n    }\n    /** Last child of the node. */\n    get lastChild() {\n        return this.children.length > 0\n            ? this.children[this.children.length - 1]\n            : null;\n    }\n    /**\n     * Same as {@link children}.\n     * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n     */\n    get childNodes() {\n        return this.children;\n    }\n    set childNodes(children) {\n        this.children = children;\n    }\n}\n/**\n * CDATA nodes.\n */\nexport class CDATA extends NodeWithChildren {\n    type = ElementType.CDATA;\n    get nodeType() {\n        return 4;\n    }\n}\n/**\n * The root node of the document.\n */\nexport class Document extends NodeWithChildren {\n    type = ElementType.Root;\n    get nodeType() {\n        return 9;\n    }\n}\n/**\n * An element within the DOM.\n */\nexport class Element extends NodeWithChildren {\n    name;\n    attribs;\n    type;\n    /**\n     * @param name Name of the tag, eg. `div`, `span`.\n     * @param attribs Object mapping attribute names to attribute values.\n     * @param children Children of the node.\n     * @param type Node type used for the new node instance.\n     */\n    constructor(name, attribs, children = [], type = name === \"script\"\n        ? ElementType.Script\n        : name === \"style\"\n            ? ElementType.Style\n            : ElementType.Tag) {\n        super(children);\n        this.name = name;\n        this.attribs = attribs;\n        this.type = type;\n    }\n    get nodeType() {\n        return 1;\n    }\n    // DOM Level 1 aliases\n    /**\n     * Same as {@link name}.\n     * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n     */\n    get tagName() {\n        return this.name;\n    }\n    set tagName(name) {\n        this.name = name;\n    }\n    get attributes() {\n        return Object.keys(this.attribs).map((name) => ({\n            name,\n            value: this.attribs[name],\n            namespace: this[\"x-attribsNamespace\"]?.[name],\n            prefix: this[\"x-attribsPrefix\"]?.[name],\n        }));\n    }\n    /** Element namespace (parse5 only). */\n    namespace;\n    /** Element attribute namespaces (parse5 only). */\n    \"x-attribsNamespace\";\n    /** Element attribute namespace-related prefixes (parse5 only). */\n    \"x-attribsPrefix\";\n}\n/**\n * Checks if `node` is an element node.\n * @param node Node to check.\n * @returns `true` if the node is an element node.\n */\nexport function isTag(node) {\n    return isTagRaw(node);\n}\n/**\n * Checks if `node` is a CDATA node.\n * @param node Node to check.\n * @returns `true` if the node is a CDATA node.\n */\nexport function isCDATA(node) {\n    return node.type === ElementType.CDATA;\n}\n/**\n * Checks if `node` is a text node.\n * @param node Node to check.\n * @returns `true` if the node is a text node.\n */\nexport function isText(node) {\n    return node.type === ElementType.Text;\n}\n/**\n * Checks if `node` is a comment node.\n * @param node Node to check.\n * @returns `true` if the node is a comment node.\n */\nexport function isComment(node) {\n    return node.type === ElementType.Comment;\n}\n/**\n * Checks if `node` is a directive node.\n * @param node Node to check.\n * @returns `true` if the node is a directive node.\n */\nexport function isDirective(node) {\n    return node.type === ElementType.Directive;\n}\n/**\n * Checks if `node` is a document node.\n * @param node Node to check.\n * @returns `true` if the node is a document node.\n */\nexport function isDocument(node) {\n    return node.type === ElementType.Root;\n}\n/**\n * Checks if `node` has children.\n * @param node Node to check.\n * @returns `true` if the node has children.\n */\nexport function hasChildren(node) {\n    return Object.hasOwn(node, \"children\");\n}\n/**\n * Clone a node, and optionally its children.\n * @param node Node to clone.\n * @param recursive Clone child nodes as well.\n * @returns A clone of the node.\n */\nexport function cloneNode(node, recursive = false) {\n    let result;\n    if (isText(node)) {\n        result = new Text(node.data);\n    }\n    else if (isComment(node)) {\n        result = new Comment(node.data);\n    }\n    else if (isTag(node)) {\n        const children = recursive ? cloneChildren(node.children) : [];\n        const clone = new Element(node.name, { ...node.attribs }, children);\n        for (const child of children) {\n            child.parent = clone;\n        }\n        if (node.namespace != null) {\n            clone.namespace = node.namespace;\n        }\n        if (node[\"x-attribsNamespace\"]) {\n            clone[\"x-attribsNamespace\"] = { ...node[\"x-attribsNamespace\"] };\n        }\n        if (node[\"x-attribsPrefix\"]) {\n            clone[\"x-attribsPrefix\"] = { ...node[\"x-attribsPrefix\"] };\n        }\n        result = clone;\n    }\n    else if (isCDATA(node)) {\n        const children = recursive ? cloneChildren(node.children) : [];\n        const clone = new CDATA(children);\n        for (const child of children) {\n            child.parent = clone;\n        }\n        result = clone;\n    }\n    else if (isDocument(node)) {\n        const children = recursive ? cloneChildren(node.children) : [];\n        const clone = new Document(children);\n        for (const child of children) {\n            child.parent = clone;\n        }\n        if (node[\"x-mode\"]) {\n            clone[\"x-mode\"] = node[\"x-mode\"];\n        }\n        result = clone;\n    }\n    else if (isDirective(node)) {\n        const instruction = new ProcessingInstruction(node.name, node.data);\n        if (node[\"x-name\"] != null) {\n            instruction[\"x-name\"] = node[\"x-name\"];\n            instruction[\"x-publicId\"] = node[\"x-publicId\"];\n            instruction[\"x-systemId\"] = node[\"x-systemId\"];\n        }\n        result = instruction;\n    }\n    else {\n        throw new Error(`Not implemented yet: ${node.type}`);\n    }\n    result.startIndex = node.startIndex;\n    result.endIndex = node.endIndex;\n    if (node.sourceCodeLocation != null) {\n        result.sourceCodeLocation = node.sourceCodeLocation;\n    }\n    return result;\n}\n/**\n * Clone a list of child nodes.\n * @param childs The child nodes to clone.\n * @returns A list of cloned child nodes.\n */\nfunction cloneChildren(childs) {\n    const children = childs.map((child) => cloneNode(child, true));\n    for (let index = 1; index < children.length; index++) {\n        children[index].prev = children[index - 1];\n        children[index - 1].next = children[index];\n    }\n    return children;\n}\n", "import { ElementType } from \"domelementtype\";\nimport { CDATA, Comment, Document, Element, ProcessingInstruction, Text, } from \"./node.js\";\nexport * from \"./node.js\";\n// Default options\nconst defaultOptions = {\n    withStartIndices: false,\n    withEndIndices: false,\n    xmlMode: false,\n};\n/**\n * Event-based handler that builds a DOM tree from parser callbacks.\n */\nexport class DomHandler {\n    /** The elements of the DOM */\n    dom = [];\n    /** The root element for the DOM */\n    root = new Document(this.dom);\n    /** Called once parsing has completed. */\n    callback;\n    /** Settings for the handler. */\n    options;\n    /** Callback whenever a tag is closed. */\n    elementCB;\n    /** Indicated whether parsing has been completed. */\n    done = false;\n    /** Stack of open tags. */\n    tagStack = [this.root];\n    /** A data node that is still being written to. */\n    lastNode = null;\n    /** Reference to the parser instance. Used for location information. */\n    parser = null;\n    /**\n     * @param callback Called once parsing has completed.\n     * @param options Settings for the handler.\n     * @param elementCB Callback whenever a tag is closed.\n     */\n    constructor(callback, options, elementCB) {\n        // Make it possible to skip arguments, for backwards-compatibility\n        if (typeof options === \"function\") {\n            elementCB = options;\n            options = defaultOptions;\n        }\n        if (typeof callback === \"object\") {\n            options = callback;\n            callback = undefined;\n        }\n        this.callback = callback ?? null;\n        this.options = options ?? defaultOptions;\n        this.elementCB = elementCB ?? null;\n    }\n    onparserinit(parser) {\n        this.parser = parser;\n    }\n    // Resets the handler back to starting state\n    onreset() {\n        this.dom = [];\n        this.root = new Document(this.dom);\n        this.done = false;\n        this.tagStack = [this.root];\n        this.lastNode = null;\n        this.parser = null;\n    }\n    // Signals the handler that parsing is done\n    onend() {\n        if (this.done)\n            return;\n        this.done = true;\n        this.parser = null;\n        this.handleCallback(null);\n    }\n    onerror(error) {\n        this.handleCallback(error);\n    }\n    onclosetag() {\n        this.lastNode = null;\n        const element = this.tagStack.pop();\n        if (this.options.withEndIndices && this.parser) {\n            element.endIndex = this.parser.endIndex;\n        }\n        if (this.elementCB)\n            this.elementCB(element);\n    }\n    onopentag(name, attribs) {\n        const type = this.options.xmlMode ? ElementType.Tag : undefined;\n        const element = new Element(name, attribs, undefined, type);\n        this.addNode(element);\n        this.tagStack.push(element);\n    }\n    ontext(data) {\n        const { lastNode } = this;\n        if (lastNode && lastNode.type === ElementType.Text) {\n            lastNode.data += data;\n            if (this.options.withEndIndices && this.parser) {\n                lastNode.endIndex = this.parser.endIndex;\n            }\n        }\n        else {\n            const node = new Text(data);\n            this.addNode(node);\n            this.lastNode = node;\n        }\n    }\n    oncomment(data) {\n        if (this.lastNode && this.lastNode.type === ElementType.Comment) {\n            this.lastNode.data += data;\n            return;\n        }\n        const node = new Comment(data);\n        this.addNode(node);\n        this.lastNode = node;\n    }\n    oncommentend() {\n        this.lastNode = null;\n    }\n    oncdatastart() {\n        const text = new Text(\"\");\n        const node = new CDATA([text]);\n        this.addNode(node);\n        text.parent = node;\n        this.lastNode = text;\n    }\n    oncdataend() {\n        this.lastNode = null;\n    }\n    onprocessinginstruction(name, data) {\n        const node = new ProcessingInstruction(name, data);\n        this.addNode(node);\n    }\n    handleCallback(error) {\n        if (typeof this.callback === \"function\") {\n            this.callback(error, this.dom);\n        }\n        else if (error) {\n            throw error;\n        }\n    }\n    addNode(node) {\n        const parent = this.tagStack[this.tagStack.length - 1];\n        const previousSibling = parent.children[parent.children.length - 1];\n        if (this.options.withStartIndices && this.parser) {\n            node.startIndex = this.parser.startIndex;\n        }\n        if (this.options.withEndIndices && this.parser) {\n            node.endIndex = this.parser.endIndex;\n        }\n        parent.children.push(node);\n        if (previousSibling) {\n            node.prev = previousSibling;\n            previousSibling.next = node;\n        }\n        node.parent = parent;\n        this.lastNode = null;\n    }\n}\nexport default DomHandler;\n", "/**\n * Get the named reference for an XML special character or U+00A0.\n * @param char Code unit matched by one of the escape regexes.\n */\nfunction getEscape(char: number): string {\n    return char === 34\n        ? \"&quot;\"\n        : char === 38\n          ? \"&amp;\"\n          : char === 39\n            ? \"&apos;\"\n            : char === 60\n              ? \"&lt;\"\n              : char === 62\n                ? \"&gt;\"\n                : \"&nbsp;\";\n}\n\n/**\n * Read a code point at a given index.\n * @param input String to read the code point from.\n * @param index Current read position in the input string.\n * @returns The code point at `index`, or `undefined` if `index` is out of range.\n * @deprecated Use `String.prototype.codePointAt` directly instead; this export\n *   will be removed in the next major.\n */\nexport const getCodePoint: (input: string, index: number) => number = (\n    input: string,\n    index: number,\n): number => input.codePointAt(index)!;\n\n/**\n * Bitset for ASCII characters that need to be escaped in XML.\n */\nexport const XML_BITSET_VALUE = 0x50_00_00_c4; // 32..63 -> 34 (\"),38 (&),39 ('),60 (<),62 (>)\n\n/**\n * Matches exactly the characters `encodeXML` escapes: the five XML special\n * characters plus every non-ASCII code unit (lone surrogates included \u2014 no\n * `u` flag). Kept in sync with `XML_BITSET_VALUE`.\n *\n * Shared with `encodeNonAsciiHTML` in `encode.ts`. Because the regex is\n * stateful (`g` flag), every call site must set `lastIndex` before use.\n */\n// eslint-disable-next-line unicorn/prefer-unicode-code-point-escapes -- the `\\u{...}` form requires the `u` flag, which we deliberately omit so lone surrogates match by code unit\nexport const xmlEncodeRegex: RegExp = /[\"&'<>\\u0080-\\uFFFF]/g;\n\n/**\n * Whether `code` (a UTF-16 code unit) is escaped by {@link encodeXML}: a\n * non-ASCII unit, or one of the five XML specials flagged in\n * `XML_BITSET_VALUE` (which is only meaningful for code units 32-63).\n * @param code Code unit to test.\n */\nfunction isXmlEscapable(code: number): boolean {\n    return (\n        code >= 0x80 ||\n        (code >= 32 && code < 64 && ((XML_BITSET_VALUE >>> code) & 1) === 1)\n    );\n}\n\n/**\n * Encodes all non-ASCII characters, as well as characters not valid in XML\n * documents using XML entities.\n *\n * If a character has no equivalent entity, a numeric hexadecimal reference\n * (eg. `&#xfc;`) will be used.\n * @param input Input string to encode.\n */\nexport function encodeXML(input: string): string {\n    const { length } = input;\n    let out: string | undefined;\n    let last = 0;\n    let index = 0;\n\n    while (index < length) {\n        const char = input.charCodeAt(index);\n\n        /*\n         * Find the next character to escape: scan a short window inline\n         * (escapable characters cluster in markup-heavy input), then fall\n         * back to the regex, which skips clean spans in native code.\n         */\n        if (!isXmlEscapable(char)) {\n            const bound = Math.min(index + 32, length);\n            let next = index + 1;\n            while (next < bound && !isXmlEscapable(input.charCodeAt(next))) {\n                next++;\n            }\n            if (next < bound) {\n                index = next;\n                continue;\n            }\n            if (next >= length) break;\n            xmlEncodeRegex.lastIndex = next;\n            if (!xmlEncodeRegex.test(input)) break;\n            index = xmlEncodeRegex.lastIndex - 1;\n            continue;\n        }\n\n        if (out === undefined) out = input.substring(0, index);\n        else if (last !== index) out += input.substring(last, index);\n\n        if (char < 64) {\n            // Known replacement\n            out += getEscape(char);\n            last = index += 1;\n            continue;\n        }\n\n        // Non-ASCII: encode as numeric entity (handle surrogate pair)\n        const cp = input.codePointAt(index)!;\n        out += `&#x${cp.toString(16)};`;\n        if (cp !== char) index++; // Skip trailing surrogate\n        last = index += 1;\n    }\n\n    if (out === undefined) return input;\n    if (last < length) out += input.substr(last);\n    return out;\n}\n\n/**\n * Encodes all non-ASCII characters, as well as characters not valid in XML\n * documents using numeric hexadecimal reference (eg. `&#xfc;`).\n *\n * Have a look at `escapeUTF8` if you want a more concise output at the expense\n * of reduced transportability.\n * @param data String to escape.\n */\nexport const escape: typeof encodeXML = encodeXML;\n\n/**\n * Escape `data` using `re`, mapping each matched character to its entity.\n * Every match is one UTF-16 code unit, so its index is `lastIndex - 1`.\n * @param re Global regex matching exactly the characters to escape\n *   (`\"`, `&`, `'`, `<`, `>`, `\\u00A0` at most).\n * @param data String to escape.\n */\nfunction escapeWithRegex(re: RegExp, data: string): string {\n    re.lastIndex = 0;\n    if (!re.test(data)) return data;\n\n    let out = \"\";\n    let last = 0;\n    do {\n        const index = re.lastIndex - 1;\n        if (last !== index) out += data.substring(last, index);\n        const char = data.charCodeAt(index);\n        out += getEscape(char);\n        last = index + 1;\n    } while (re.test(data));\n\n    return out + data.substring(last);\n}\n\nconst xmlEscapeRegex = /[\"&'<>]/g;\n/**\n * Encodes all characters not valid in XML documents using XML entities.\n *\n * Note that the output will be character-set dependent.\n * @param data String to escape.\n */\nexport function escapeUTF8(data: string): string {\n    return escapeWithRegex(xmlEscapeRegex, data);\n}\n\nconst attributeEscapeRegex = /[\"&\\u{A0}]/gu;\n\n/**\n * Encodes all characters that have to be escaped in HTML attributes,\n * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.\n * @param data String to escape.\n */\nexport function escapeAttribute(data: string): string {\n    return escapeWithRegex(attributeEscapeRegex, data);\n}\n\nconst textEscapeRegex = /[&<>\\u{A0}]/gu;\n\n/**\n * Encodes all characters that have to be escaped in HTML text,\n * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.\n * @param data String to escape.\n */\nexport function escapeText(data: string): string {\n    return escapeWithRegex(textEscapeRegex, data);\n}\n", "import { type DecodingMode, decodeHTML, decodeXML } from \"./decode.js\";\nimport { encodeHTML, encodeNonAsciiHTML } from \"./encode.js\";\nimport {\n    encodeXML,\n    escapeAttribute,\n    escapeText,\n    escapeUTF8,\n} from \"./escape.js\";\n\n/** The level of entities to support. */\nexport enum EntityLevel {\n    /** Support only XML entities. */\n    XML = 0,\n    /** Support HTML entities, which are a superset of XML entities. */\n    HTML = 1,\n}\n\n/**\n * Encoding strategy used by `encode`.\n */\nexport enum EncodingMode {\n    /**\n     * The output is UTF-8 encoded. Only characters that need escaping within\n     * XML will be escaped.\n     */\n    UTF8,\n    /**\n     * The output consists only of ASCII characters. Characters that need\n     * escaping within HTML, and characters that aren't ASCII characters will\n     * be escaped.\n     */\n    ASCII,\n    /**\n     * Encode all characters that have an equivalent entity, as well as all\n     * characters that are not ASCII characters.\n     */\n    Extensive,\n    /**\n     * Encode all characters that have to be escaped in HTML attributes,\n     * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.\n     */\n    Attribute,\n    /**\n     * Encode all characters that have to be escaped in HTML text,\n     * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.\n     */\n    Text,\n}\n\n/**\n * Options for `decode`.\n */\nexport interface DecodingOptions {\n    /**\n     * The level of entities to support.\n     * @default {@link EntityLevel.XML}\n     */\n    level?: EntityLevel;\n    /**\n     * Decoding mode. If `Legacy`, will support legacy entities not terminated\n     * with a semicolon (`;`).\n     *\n     * Always `Strict` for XML. For HTML, set this to\n     * {@link DecodingMode.Attribute} if you are parsing an attribute value.\n     * @default {@link DecodingMode.Legacy}\n     */\n    mode?: DecodingMode | undefined;\n}\n\n/**\n * Decodes a string with entities.\n * @param input String to decode.\n * @param options Decoding options.\n */\nexport function decode(\n    input: string,\n    options: DecodingOptions | EntityLevel = EntityLevel.XML,\n): string {\n    const level = typeof options === \"number\" ? options : options.level;\n\n    if (level === EntityLevel.HTML) {\n        const mode = typeof options === \"object\" ? options.mode : undefined;\n        return decodeHTML(input, mode);\n    }\n\n    return decodeXML(input);\n}\n\n/**\n * Options for `encode`.\n */\nexport interface EncodingOptions {\n    /**\n     * The level of entities to support.\n     * @default {@link EntityLevel.XML}\n     */\n    level?: EntityLevel;\n    /**\n     * Output format.\n     * @default {@link EncodingMode.Extensive}\n     */\n    mode?: EncodingMode;\n}\n\n/**\n * Encodes a string with entities.\n * @param input String to encode.\n * @param options Encoding options.\n */\nexport function encode(\n    input: string,\n    options: EncodingOptions | EntityLevel = EntityLevel.XML,\n): string {\n    const { mode = EncodingMode.Extensive, level = EntityLevel.XML } =\n        typeof options === \"number\" ? { level: options } : options;\n\n    switch (mode) {\n        case EncodingMode.UTF8: {\n            return escapeUTF8(input);\n        }\n        case EncodingMode.Attribute: {\n            return escapeAttribute(input);\n        }\n        case EncodingMode.Text: {\n            return escapeText(input);\n        }\n        case EncodingMode.ASCII: {\n            return (\n                level === EntityLevel.HTML ? encodeNonAsciiHTML : encodeXML\n            )(input);\n        }\n        // biome-ignore lint/complexity/noUselessSwitchCase: we get an error for the switch not being exhaustive\n        case EncodingMode.Extensive:\n        default: {\n            return (level === EntityLevel.HTML ? encodeHTML : encodeXML)(input);\n        }\n    }\n}\n\nexport {\n    DecodingMode,\n    decodeHTML,\n    decodeHTMLAttribute,\n    decodeHTMLStrict,\n    decodeXML,\n    decodeXML as decodeXMLStrict,\n    EntityDecoder,\n} from \"./decode.js\";\n\nexport {\n    encodeHTML,\n    encodeNonAsciiHTML,\n} from \"./encode.js\";\nexport {\n    encodeXML,\n    escape,\n    escapeAttribute,\n    escapeText,\n    escapeUTF8,\n} from \"./escape.js\";\n", "/**\n * Mixed-case SVG and MathML element names recognized in foreign content.\n * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign\n */\nexport const elementNames = new Map<string, string>(\n  \"altGlyph altGlyphDef altGlyphItem animateColor animateMotion animateTransform clipPath feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence foreignObject glyphRef linearGradient radialGradient textPath\"\n    .split(\" \")\n    .map((name) => [name.toLowerCase(), name]),\n);\n\n/**\n * Mixed-case SVG and MathML attribute names recognized in foreign content.\n * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign\n */\nexport const attributeNames = new Map<string, string>(\n  \"definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan\"\n    .split(\" \")\n    .map((name) => [name.toLowerCase(), name]),\n);\n", "import * as ElementType from \"domelementtype\";\nimport type {\n  AnyNode,\n  CDATA,\n  Comment,\n  Element,\n  ProcessingInstruction,\n  Text,\n} from \"domhandler\";\nimport { encodeXML, escapeAttribute, escapeText } from \"entities\";\nimport { attributeNames, elementNames } from \"./foreign-names.js\";\n\n/**\n * Options for DOM serialization.\n */\nexport interface DomSerializerOptions {\n  /**\n   * Print an empty attribute's value.\n   * @default xmlMode\n   * @example With <code>emptyAttrs: false</code>: <code>&lt;input checked&gt;</code>\n   * @example With <code>emptyAttrs: true</code>: <code>&lt;input checked=\"\"&gt;</code>\n   */\n  emptyAttrs?: boolean;\n  /**\n   * Print self-closing tags for tags without contents. If `xmlMode` is set,\n   * this will apply to all tags. Otherwise, only tags that are defined as\n   * self-closing in the HTML specification will be printed as such.\n   * @default xmlMode\n   * @example With <code>selfClosingTags: false</code>: <code>&lt;foo&gt;&lt;/foo&gt;&lt;br&gt;&lt;/br&gt;</code>\n   * @example With <code>xmlMode: true</code> and <code>selfClosingTags: true</code>: <code>&lt;foo/&gt;&lt;br/&gt;</code>\n   * @example With <code>xmlMode: false</code> and <code>selfClosingTags: true</code>: <code>&lt;foo&gt;&lt;/foo&gt;&lt;br /&gt;</code>\n   */\n  selfClosingTags?: boolean;\n  /**\n   * Treat the input as an XML document; enables the `emptyAttrs` and\n   * `selfClosingTags` options.\n   *\n   * If the value is `\"foreign\"`, it will try to correct mixed-case attribute\n   * names.\n   * @default false\n   */\n  xmlMode?: boolean | \"foreign\";\n  /**\n   * Encode characters reserved in HTML or XML in text and attribute values.\n   *\n   * If `xmlMode` is set or the value is not `'utf8'`, characters outside the\n   * ASCII range will also be encoded as numeric entities.\n   *\n   * **Security:** Setting this to `false` disables encoding of `<`, `>`, `&`,\n   * and (in attribute values) `'` \u2014 only `\"` in attribute values is escaped.\n   * This is safe for the round-trip case (DOM was parsed with\n   * `decodeEntities: false`, so any markup characters in text or attribute\n   * values exist only as entity references), and unsafe otherwise. If text\n   * or attribute values in the DOM contain raw `<`, `>`, or `&`, those\n   * characters will appear literally in the output.\n   * @default `decodeEntities`\n   */\n  encodeEntities?: boolean | \"utf8\";\n  /**\n   * Default for `encodeEntities`. Named to match the parser option of the\n   * same name so a single options object can be threaded through parse and\n   * serialize for a faithful round-trip \u2014 for example, cheerio parses with\n   * `decodeEntities: false` to preserve entity references and passes the\n   * same option here so they are not re-encoded.\n   *\n   * Despite the name, on the serializer this option controls *encoding*.\n   * Setting it to `false` carries the same caveat as `encodeEntities: false`\n   * \u2014 see that option.\n   * @default true\n   */\n  decodeEntities?: boolean;\n}\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Elements whose text content is never entity-encoded. */\nconst unencodedElements = new Set(\n  \"style script xmp iframe noembed noframes plaintext noscript\".split(\" \"),\n);\n\n/** HTML void elements \u2014 they cannot have children. */\nconst voidElements = new Set(\n  \"area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr\".split(\n    \" \",\n  ),\n);\n\n/** Elements that switch the parser into foreign (XML-like) mode. */\nconst foreignElements = new Set([\"svg\", \"math\"]);\n\n/**\n * Foreign-mode integration points: children of these elements are parsed\n * as HTML again, not as foreign content.\n */\nconst foreignModeIntegrationPoints = new Set(\n  \"mi mo mn ms mtext annotation-xml foreignObject desc title\".split(\" \"),\n);\n\n// \u2500\u2500 Public API \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Renders a DOM node or an array of DOM nodes to a string.\n *\n * Can be thought of as the equivalent of the `outerHTML` of the passed\n * node(s).\n * @param node Node to be rendered.\n * @param options Changes serialization behavior\n */\nexport function render(\n  node: AnyNode | ArrayLike<AnyNode>,\n  options: DomSerializerOptions = {},\n): string {\n  const nodes = \"length\" in node ? node : [node];\n\n  /*\n   * `xmlMode` is threaded as a separate argument through the internal\n   * functions so that foreign-mode transitions (svg/mathml \u2194 html) can\n   * adjust it without copying the options object on every element.\n   */\n  const xmlMode = options.xmlMode ?? false;\n\n  let output = \"\";\n  // eslint-disable-next-line unicorn/no-for-loop\n  for (let index = 0; index < nodes.length; index++) {\n    output += renderNode(nodes[index], options, xmlMode);\n  }\n\n  return output;\n}\n\nexport default render;\n\n// \u2500\u2500 Internal rendering \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Render an array of child nodes (skips the single-node wrapping in `render`).\n * @param children The child nodes to render.\n * @param options The serialization options.\n * @param xmlMode The XML mode to use.\n */\nfunction renderChildren(\n  children: ArrayLike<AnyNode>,\n  options: DomSerializerOptions,\n  xmlMode: boolean | \"foreign\",\n): string {\n  let output = \"\";\n  // eslint-disable-next-line unicorn/no-for-loop\n  for (let index = 0; index < children.length; index++) {\n    output += renderNode(children[index], options, xmlMode);\n  }\n  return output;\n}\n\nfunction renderNode(\n  node: AnyNode,\n  options: DomSerializerOptions,\n  xmlMode: boolean | \"foreign\",\n): string {\n  switch (node.type) {\n    case ElementType.Root: {\n      return renderChildren(node.children, options, xmlMode);\n    }\n\n    case ElementType.Directive: {\n      return `<${(node as ProcessingInstruction).data}>`;\n    }\n\n    case ElementType.Comment: {\n      return `<!--${(node as Comment).data}-->`;\n    }\n\n    case ElementType.CDATA: {\n      return `<![CDATA[${((node as CDATA).children[0] as Text).data}]]>`;\n    }\n\n    case ElementType.Script:\n    case ElementType.Style:\n    case ElementType.Tag: {\n      return renderTag(node as Element, options, xmlMode);\n    }\n\n    case ElementType.Text: {\n      const element = node as Text;\n      const data = element.data || \"\";\n\n      /*\n       * Skip encoding when entities weren't decoded on input, or when\n       * inside a raw-text element (script, style, etc.) in HTML mode.\n       */\n      if (\n        (options.encodeEntities ?? options.decodeEntities) !== false &&\n        !(\n          !xmlMode &&\n          element.parent &&\n          unencodedElements.has((element.parent as Element).name)\n        )\n      ) {\n        // `xmlMode: \"foreign\"` is truthy\n        return xmlMode || options.encodeEntities !== \"utf8\"\n          ? encodeXML(data)\n          : escapeText(data);\n      }\n\n      return data;\n    }\n  }\n}\n\nfunction renderTag(\n  element: Element,\n  options: DomSerializerOptions,\n  xmlMode: boolean | \"foreign\",\n) {\n  if (xmlMode === \"foreign\") {\n    // Correct lowercase element names back to their canonical mixed-case form\n    element.name = elementNames.get(element.name) ?? element.name;\n\n    // Integration points exit foreign mode: their children are HTML\n    if (\n      element.parent &&\n      foreignModeIntegrationPoints.has((element.parent as Element).name)\n    ) {\n      xmlMode = false;\n    }\n  }\n\n  if (!xmlMode && foreignElements.has(element.name)) {\n    xmlMode = \"foreign\";\n  }\n\n  const { name, children } = element;\n\n  // Cache the void-element check \u2014 used for both self-closing and closing-tag logic\n  const isVoid = !xmlMode && voidElements.has(name);\n\n  let tag = `<${name}${formatAttributes(element.attribs, options, xmlMode)}`;\n\n  if (\n    children.length === 0 &&\n    (xmlMode\n      ? options.selfClosingTags !== false\n      : options.selfClosingTags && isVoid)\n  ) {\n    // XML: `<br/>`, HTML: `<br />`\n    tag += xmlMode ? \"/>\" : \" />\";\n  } else {\n    tag += \">\";\n\n    if (children.length > 0) {\n      tag += renderChildren(children, options, xmlMode);\n    }\n\n    if (!isVoid) {\n      tag += `</${name}>`;\n    }\n  }\n\n  return tag;\n}\n\n// \u2500\u2500 Attribute formatting \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction replaceQuotes(value: string): string {\n  return value.replaceAll('\"', \"&quot;\");\n}\n\n/**\n * Serialize an element's attribute map to a string.\n *\n * Returns a string with a leading space before each attribute, or an\n * empty string if there are no attributes. This convention lets the\n * caller unconditionally concatenate the result onto the tag name.\n * @param attributes\n * @param options\n * @param xmlMode\n */\nfunction formatAttributes(\n  attributes: Record<string, unknown> | undefined,\n  options: DomSerializerOptions,\n  xmlMode: boolean | \"foreign\",\n) {\n  if (!attributes) return \"\";\n\n  /*\n   * Pick the right encoder:\n   *  - Encoding disabled \u2192 only escape double-quotes (for valid attributes)\n   *  - XML / non-utf8    \u2192 full numeric entity encoding (encodeXML)\n   *  - HTML + utf8       \u2192 minimal escaping (escapeAttribute)\n   */\n  const encode =\n    (options.encodeEntities ?? options.decodeEntities) === false\n      ? replaceQuotes\n      : xmlMode || options.encodeEntities !== \"utf8\"\n        ? encodeXML\n        : escapeAttribute;\n\n  const isForeign = xmlMode === \"foreign\";\n  const showEmpty = !!(options.emptyAttrs ?? xmlMode);\n\n  let result = \"\";\n\n  for (const key in attributes) {\n    if (!Object.hasOwn(attributes, key)) continue;\n\n    const value = attributes[key];\n    const k = isForeign ? (attributeNames.get(key) ?? key) : key;\n\n    result +=\n      !showEmpty && (value == null || value === \"\")\n        ? ` ${k}`\n        : ` ${k}=\"${encode(value == null ? \"\" : String(value))}\"`;\n  }\n\n  return result;\n}\n", "import { Parser, type ParserOptions } from \"./Parser.js\";\n\nexport type { Handler, ParserOptions } from \"./Parser.js\";\nexport { Parser } from \"./Parser.js\";\n\nimport {\n    type Document,\n    DomHandler,\n    type DomHandlerOptions,\n    type Element,\n} from \"domhandler\";\n\nexport {\n    DomHandler,\n    // Old name for DomHandler\n    DomHandler as DefaultHandler,\n    type DomHandlerOptions,\n} from \"domhandler\";\n\n/**\n * Combined parser and handler options.\n */\nexport type Options = ParserOptions & DomHandlerOptions;\n\n// Helper methods\n\n/**\n * Parses the data, returns the resulting document.\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM handler.\n */\nexport function parseDocument(data: string, options?: Options): Document {\n    const handler = new DomHandler(undefined, options);\n    new Parser(handler, options).end(data);\n    return handler.root;\n}\n\n/**\n * Creates a parser instance, with an attached DOM handler.\n * @param callback A callback that will be called once parsing has been completed, with the resulting document.\n * @param options Optional options for the parser and DOM handler.\n * @param elementCallback An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nexport function createDocumentStream(\n    callback: (error: Error | null, document: Document) => void,\n    options?: Options,\n    elementCallback?: (element: Element) => void,\n): Parser {\n    const handler: DomHandler = new DomHandler(\n        (error: Error | null) => callback(error, handler.root),\n        options,\n        elementCallback,\n    );\n    return new Parser(handler, options);\n}\n\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nexport * as ElementType from \"domelementtype\";\nexport {\n    type Callbacks as TokenizerCallbacks,\n    default as Tokenizer,\n    QuoteType,\n} from \"./Tokenizer.js\";\n\nimport { type Feed, getFeed } from \"domutils\";\n\nexport { type Feed, getFeed } from \"domutils\";\n\nconst parseFeedDefaultOptions = { xmlMode: true };\n\n/**\n * Parse a feed.\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nexport function parseFeed(\n    feed: string,\n    options: Options = parseFeedDefaultOptions,\n): Feed | null {\n    return getFeed(parseDocument(feed, options).children);\n}\n\nexport * as DomUtils from \"domutils\";\n", "export function escapeHtml(str: string) {\n  return str.replace(\n    /[&<>'\"]/g,\n    (tag) =>\n      ({\n        '&': '&amp;',\n        '<': '&lt;',\n        '>': '&gt;',\n        \"'\": '&#39;',\n        '\"': '&quot;',\n      })[tag],\n  );\n}\n", "export function tryJson(content: string, fallback: any) {\n  if (content) {\n    try {\n      return JSON.parse(content);\n    } catch {\n      // empty on purpose\n    }\n  }\n  return fallback;\n}\n", "import { parseDocument } from 'htmlparser2';\nimport { render } from 'dom-serializer';\nimport { escapeHtml } from '@/common/utils/escape';\nimport { tryJson } from '@/common/utils/json';\nimport type { ChildNode, Document, Element } from 'domhandler';\nimport type { DecoratorService, DependencyInjector, OrderingOptions } from '@/types';\n\nfunction traverse(nodes: Array<ChildNode>, cb: (node: ChildNode) => boolean) {\n  nodes.forEach((node) => {\n    if (cb(node) && node.type === 'tag') {\n      traverse(node.childNodes, cb);\n    }\n  });\n}\n\nfunction findById(container: Document | Element, id: string): Element {\n  let result: Element = undefined;\n\n  traverse(container.childNodes, (node) => {\n    if (node.type === 'tag' && node.attribs.id === id) {\n      result = node;\n    }\n\n    return !result;\n  });\n\n  return result;\n}\n\nfunction findByName(container: Document | Element, name: string): Element {\n  let result: Element = undefined;\n\n  traverse(container.childNodes, (node) => {\n    if (node.type === 'tag' && node.name === name) {\n      result = node;\n    }\n\n    return !result;\n  });\n\n  return result;\n}\n\ninterface ServerRendering {\n  /**\n   * The content to place inside the element.\n   */\n  content: string;\n  /**\n   * Indicates that the content can be hydrated on the client.\n   */\n  hydrate?: boolean;\n}\n\ntype ServerComponent = (\n  injector: DependencyInjector,\n  attribs: Record<string, string>,\n  document: Document,\n) => Promise<string | ServerRendering>;\n\ntype Marker = [name: string, attribs: Record<string, string>, index: number, length: number, openEnd: number];\n\nfunction getOpenTagEnd(element: Element) {\n  const [first] = element.childNodes;\n  // position of the \">\" of the opening tag\n  return first ? first.startIndex! - 1 : element.endIndex! - element.name.length - 3;\n}\n\nfunction renderFallback(attribs: Record<string, string>, document: Document) {\n  const fallbackTemplateId = attribs['fallback-template-id'];\n\n  if (fallbackTemplateId) {\n    const template = findById(document, fallbackTemplateId);\n\n    if (template) {\n      const copy = template.cloneNode(true);\n      return render(copy.childNodes);\n    }\n  }\n\n  return '';\n}\n\nfunction getSlotParameters(injector: DependencyInjector, attribs: Record<string, string>): [string, any] {\n  const { name, rel } = attribs;\n  const service = rel && injector.get(`slotRel.${rel}`);\n\n  if (!service) {\n    const data = tryJson(attribs.data, {});\n    return [name, data];\n  }\n\n  return service.apply(attribs);\n}\n\nfunction renderMeta(meta: any) {\n  let result = '';\n\n  if (meta) {\n    if (typeof meta.server === 'string') {\n      result += ` server=\"${meta.server}\"`;\n    }\n\n    if (typeof meta.client === 'string') {\n      result += ` client=\"${meta.client}\"`;\n    }\n  }\n\n  return result;\n}\n\nasync function renderComponents(injector: DependencyInjector, name: string, data: any, opts?: OrderingOptions) {\n  const { componentName } = injector.get('config');\n  const scope = injector.get('scope');\n  const components = await scope.loadComponents(name, opts);\n\n  return components.map(\n    ({ id, meta }) =>\n      `<${componentName} cid=${JSON.stringify(id)} data=\"${escapeHtml(JSON.stringify(data))}\"${renderMeta(meta)}></${componentName}>`,\n  );\n}\n\nasync function Component(\n  injector: DependencyInjector,\n  attribs: Record<string, string>,\n  document: Document,\n): Promise<string | ServerRendering> {\n  const data = tryJson(attribs.data, {});\n\n  if (attribs.server === 'none') {\n    return '';\n  }\n\n  if ('cid' in attribs || 'name' in attribs) {\n    const renderer = injector.get('renderer');\n    const lc = renderer.render(attribs, attribs);\n\n    if (lc) {\n      try {\n        await lc.bootstrap?.();\n        const content = await lc.stringify?.(data);\n        return { content, hydrate: !!content };\n      } catch (error) {\n        console.warn('Could not render the component \"%s\"', attribs.cid || attribs.name);\n        console.debug('Rendering the component \"%s\" failed: %O', attribs.cid || attribs.name, error);\n      }\n    }\n  }\n\n  return renderFallback(attribs, document);\n}\n\nasync function Slot(\n  injector: DependencyInjector,\n  attribs: Record<string, string>,\n  document: Document,\n): Promise<string> {\n  const [name, data] = getSlotParameters(injector, attribs);\n  const components = await renderComponents(injector, name, data, {\n    orderBy: attribs['order-by'],\n    // a boolean attribute, i.e., present (usually with an empty value) or not - like in the browser\n    reverse: 'reverse-order' in attribs,\n  });\n\n  if (components.length > 0) {\n    const itemTemplateId = attribs['item-template-id'];\n\n    if (itemTemplateId) {\n      const template = findById(document, itemTemplateId);\n\n      if (template) {\n        const innerDocument = parseDocument(components.join(''));\n        const frags = innerDocument.childNodes.map((item) => {\n          const copy = template.cloneNode(true);\n          const slot = findByName(copy, 'slot');\n\n          if (slot) {\n            const slotIndex = slot.parent.childNodes.indexOf(slot);\n            slot.parent.childNodes[slotIndex] = item;\n          }\n\n          return render(copy.childNodes);\n        });\n\n        return frags.join('');\n      }\n    }\n\n    return components.join('');\n  }\n\n  return renderFallback(attribs, document);\n}\n\nasync function Part(\n  injector: DependencyInjector,\n  attribs: Record<string, string>,\n  document: Document,\n): Promise<string> {\n  const name = attribs.name;\n  const part = injector.get(`part.${name}`);\n  return part?.getReplacement(document, attribs) ?? `<!-- part: \"${name}\" -->`;\n}\n\nexport function createDecorator(injector: DependencyInjector): DecoratorService {\n  const { slotName, componentName, partName } = injector.get('config');\n\n  const renderers: Record<string, ServerComponent> = {\n    [slotName]: Slot,\n    [componentName]: Component,\n    [partName]: Part,\n  };\n\n  const decorate = async (content: string, count = 0) => {\n    if (count === 10) {\n      console.warn('Reached maximum recursion in decorator. Returning content.');\n      return content;\n    }\n\n    const document = parseDocument(content, {\n      withStartIndices: true,\n      withEndIndices: true,\n    });\n    const markers: Array<Marker> = [];\n    traverse(document.childNodes, (m) => {\n      if (m.type !== 'tag') {\n        return false;\n      }\n\n      if (m.name === componentName || m.name === slotName) {\n        const insert = m.endIndex! - 2 - m.name.length;\n        markers.push([m.name, m.attribs, insert, 0, getOpenTagEnd(m)]);\n        return false;\n      } else if (m.name === partName) {\n        const start = m.startIndex!;\n        const end = m.endIndex!;\n        markers.push([m.name, m.attribs, start, end - start + 1, start]);\n      }\n\n      return true;\n    });\n\n    let previous = 0;\n    const parts: Array<string> = [content];\n\n    for (const [name, attribs, index, length, openEnd] of markers) {\n      const renderer = renderers[name];\n      const rendering = await renderer(injector, attribs, document);\n      const { content: replacement, hydrate } = typeof rendering === 'string' ? { content: rendering } : rendering;\n      const result = await decorate(replacement || '', count + 1);\n      parts.pop();\n\n      if (hydrate && !('hydrate' in attribs)) {\n        parts.push(content.substring(previous, openEnd), ' hydrate', content.substring(openEnd, index));\n      } else {\n        parts.push(content.substring(previous, index));\n      }\n\n      parts.push(result);\n      previous = index + length;\n      parts.push(content.substring(previous));\n    }\n\n    return parts.join('');\n  };\n\n  return {\n    async render(name, data, opts) {\n      const components = await renderComponents(injector, name, data, opts);\n      const content = components.join('');\n      return await decorate(content);\n    },\n    decorate,\n  };\n}\n", "import type { DependencyInjector, PartService } from '@/types';\n\nexport function createStylePart(injector: DependencyInjector): PartService {\n  const scope = injector.get('scope');\n  const sheet = injector.get('sheet');\n\n  return {\n    async getReplacement() {\n      const assets = await scope.loadAssets('css');\n      const internals = `<style>${sheet?.content}</style>`;\n      const externals = assets\n        .map(\n          (asset) =>\n            `<link rel=\"stylesheet\" href=${JSON.stringify(asset.url)} data-origin=${JSON.stringify(asset.origin)} data-ref-id=${JSON.stringify(asset.id)}>`,\n        )\n        .join('');\n\n      return `${internals}${externals}`;\n    },\n  };\n}\n", "import type { DependencyInjector, PartService } from '@/types';\n\nfunction serialize(value: any) {\n  // prevent closing the script element or starting a comment from the data\n  return JSON.stringify(value).replace(/</g, '\\\\u003c');\n}\n\nexport function createScriptPart(injector: DependencyInjector): PartService {\n  const scope = injector.get('scope');\n  const { componentName, slotName, fragmentUrl, meta, scriptUrl, client } = injector.get('config');\n\n  return {\n    async getReplacement() {\n      // wait for the pending micro frontends (e.g., from the feed), as the\n      // part may be rendered before any component (e.g., in a separate call)\n      await scope.loadAssets('css');\n      const state = scope.readState();\n      const config = `<script type=\"pi-config\">${serialize({\n        componentName,\n        slotName,\n        fragmentUrl,\n        meta,\n        state,\n        client,\n      })}</script>`;\n      // start loading only after the first paint to keep the client off the critical rendering path\n      const script = `<script type=\"module\">requestAnimationFrame(()=>setTimeout(()=>import(${serialize(scriptUrl)})))</script>`;\n      return `${config}${script}`;\n    },\n  };\n}\n", "import type { DependencyInjector, SheetService } from '@/types';\n\nexport function createSheet(injector: DependencyInjector): SheetService {\n  const { slotName, componentName, partName } = injector.get('config');\n  const content = `${slotName} { display: contents; } ${componentName} { display: contents; } ${partName} { display: none; }`;\n\n  return {\n    content,\n  };\n}\n", "import type { ComponentLifecycle } from '@/types';\n\nexport const emptyLifecycle: ComponentLifecycle = {\n  async load() {},\n  async unload() {},\n  mount() {},\n  unmount() {},\n  update() {},\n  async bootstrap() {},\n  stringify() {\n    return Promise.resolve('');\n  },\n};\n\nexport function createLazyLifecycle(load: () => Promise<any>): ComponentLifecycle {\n  const impl = {\n    ...emptyLifecycle,\n  };\n  const lazy = async () => {\n    const lc = await load();\n    Object.assign(impl, lc.default || lc);\n  };\n  return {\n    async load(...args) {\n      await lazy();\n      return await impl.load(...args);\n    },\n    mount(...args) {\n      return impl.mount(...args);\n    },\n    update(...args) {\n      return impl.update(...args);\n    },\n    unmount(...args) {\n      return impl.unmount(...args);\n    },\n    unload(...args) {\n      return impl.unload(...args);\n    },\n    async bootstrap(...args) {\n      await lazy();\n      return await impl.bootstrap(...args);\n    },\n    stringify(...args) {\n      return impl.stringify(...args);\n    },\n  };\n}\n", "import { createLazyLifecycle } from '@/common/utils/lifecycle';\nimport type { DependencyInjector, RendererService } from '@/types';\n\nexport function createRenderer(injector: DependencyInjector): RendererService {\n  const scope = injector.get('scope');\n\n  function convert(component: any, meta: any, type: string) {\n    const framework = injector.get(`framework.${type}`);\n    return framework && component ? framework.convert(component, meta) : component;\n  }\n\n  return {\n    render(component, opts) {\n      const result = scope.getComponent(component);\n\n      if (result) {\n        return createLazyLifecycle(() =>\n          result.then((c) => {\n            if (!c) {\n              // e.g., the source is neither in the feed nor a URL with a format\n              const name = component.cid || `${component.source}/${component.name}`;\n              throw new Error(`The component \"${name}\" could not be found.`);\n            }\n\n            const { meta, type = 'default' } = c;\n            const { framework = type } = opts;\n            const lc = convert(c.exports, meta, framework);\n\n            if (!lc) {\n              const name = c.name || component.cid || `${component.source}/${component.name}`;\n              throw new Error(`The component \"${name}\" could not be loaded.`);\n            }\n\n            return lc;\n          }),\n        );\n      }\n\n      return undefined;\n    },\n  };\n}\n", "export const FederationModuleManifest = 'federation-manifest.json';\nexport const MANIFEST_EXT = '.json';\n\nexport const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';\n\nexport const NameTransformSymbol = {\n  AT: '@',\n  HYPHEN: '-',\n  SLASH: '/',\n} as const;\nexport const NameTransformMap = {\n  [NameTransformSymbol.AT]: 'scope_',\n  [NameTransformSymbol.HYPHEN]: '_',\n  [NameTransformSymbol.SLASH]: '__',\n} as const;\n\nexport const EncodedNameTransformMap = {\n  [NameTransformMap[NameTransformSymbol.AT]]: NameTransformSymbol.AT,\n  [NameTransformMap[NameTransformSymbol.HYPHEN]]: NameTransformSymbol.HYPHEN,\n  [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH,\n};\n\nexport const SEPARATOR = ':';\n\nexport const ManifestFileName = 'mf-manifest.json';\nexport const StatsFileName = 'mf-stats.json';\n\nexport const MFModuleType = {\n  NPM: 'npm',\n  APP: 'app',\n};\n\nexport const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';\nexport const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';\nexport const TEMP_DIR = '.federation';\n\nexport const enum TreeShakingStatus {\n  /**\n   * Not handled by deploy server, needs to infer by the real runtime period.\n   */\n  UNKNOWN = 1,\n  /**\n   * It means the shared has been calculated , runtime should take this shared as first choice.\n   */\n  CALCULATED = 2,\n  /**\n   * It means the shared has been calculated, and marked as no used\n   */\n  NO_USE = 0,\n}\n", "import { BROWSER_LOG_KEY } from './constant';\n\ndeclare global {\n  // eslint-disable-next-line no-var\n  var FEDERATION_DEBUG: string | undefined;\n}\n\n// Declare the ENV_TARGET constant that will be defined by DefinePlugin\ndeclare const ENV_TARGET: 'web' | 'node';\n\nconst isBrowserEnvValue =\n  typeof ENV_TARGET !== 'undefined'\n    ? ENV_TARGET === 'web'\n    : typeof window !== 'undefined' && typeof window.document !== 'undefined';\n\nfunction isBrowserEnv(): boolean {\n  return isBrowserEnvValue;\n}\n\nfunction isReactNativeEnv(): boolean {\n  return (\n    typeof navigator !== 'undefined' && navigator?.product === 'ReactNative'\n  );\n}\n\nfunction isBrowserDebug() {\n  try {\n    if (isBrowserEnv() && window.localStorage) {\n      return Boolean(localStorage.getItem(BROWSER_LOG_KEY));\n    }\n  } catch (error) {\n    return false;\n  }\n  return false;\n}\n\nfunction isDebugMode(): boolean {\n  if (\n    typeof process !== 'undefined' &&\n    process.env &&\n    process.env['FEDERATION_DEBUG']\n  ) {\n    return Boolean(process.env['FEDERATION_DEBUG']);\n  }\n\n  if (typeof FEDERATION_DEBUG !== 'undefined' && Boolean(FEDERATION_DEBUG)) {\n    return true;\n  }\n\n  return isBrowserDebug();\n}\n\nconst getProcessEnv = function (): Record<string, string | undefined> {\n  return typeof process !== 'undefined' && process.env ? process.env : {};\n};\n\nexport {\n  isBrowserEnv,\n  isBrowserEnvValue,\n  isReactNativeEnv,\n  isDebugMode,\n  getProcessEnv,\n};\n", "import { RemoteEntryInfo, ModuleInfo } from './types';\nimport {\n  NameTransformMap,\n  NameTransformSymbol,\n  EncodedNameTransformMap,\n  SEPARATOR,\n  MANIFEST_EXT,\n} from './constant';\nimport { getProcessEnv, isBrowserEnv, isReactNativeEnv } from './env';\n\nconst LOG_CATEGORY = '[ Federation Runtime ]';\n\n// entry: name:version   version : 1.0.0 | ^1.2.3\n// entry: name:entry  entry:  https://localhost:9000/federation-manifest.json\nconst parseEntry = (\n  str: string,\n  devVerOrUrl?: string,\n  separator = SEPARATOR,\n): RemoteEntryInfo => {\n  const strSplit = str.split(separator);\n  const devVersionOrUrl =\n    getProcessEnv()['NODE_ENV'] === 'development' && devVerOrUrl;\n  const defaultVersion = '*';\n  const isEntry = (s: string) =>\n    s.startsWith('http') || s.includes(MANIFEST_EXT);\n\n  // Check if the string starts with a type\n  if (strSplit.length >= 2) {\n    let [name, ...versionOrEntryArr] = strSplit;\n    // @name@manifest-url.json\n    if (str.startsWith(separator)) {\n      name = strSplit.slice(0, 2).join(separator);\n      versionOrEntryArr = [\n        devVersionOrUrl || strSplit.slice(2).join(separator),\n      ];\n    }\n\n    let versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator);\n\n    if (isEntry(versionOrEntry)) {\n      return {\n        name,\n        entry: versionOrEntry,\n      };\n    } else {\n      // Apply version rule\n      // devVersionOrUrl => inputVersion => defaultVersion\n      return {\n        name,\n        version: versionOrEntry || defaultVersion,\n      };\n    }\n  } else if (strSplit.length === 1) {\n    const [name] = strSplit;\n    if (devVersionOrUrl && isEntry(devVersionOrUrl)) {\n      return {\n        name,\n        entry: devVersionOrUrl,\n      };\n    }\n    return {\n      name,\n      version: devVersionOrUrl || defaultVersion,\n    };\n  } else {\n    throw `Invalid entry value: ${str}`;\n  }\n};\n\ndeclare global {\n  // eslint-disable-next-line no-var\n  var FEDERATION_DEBUG: string | undefined;\n}\n\nconst composeKeyWithSeparator = function (\n  ...args: (string | undefined)[]\n): string {\n  if (!args.length) {\n    return '';\n  }\n\n  return args.reduce((sum, cur) => {\n    if (!cur) {\n      return sum;\n    }\n    if (!sum) {\n      return cur;\n    }\n\n    return `${sum}${SEPARATOR}${cur}`;\n  }, '') as string;\n};\n\nconst encodeName = function (\n  name: string,\n  prefix = '',\n  withExt = false,\n): string {\n  try {\n    const ext = withExt ? '.js' : '';\n    return `${prefix}${name\n      .replace(\n        new RegExp(`${NameTransformSymbol.AT}`, 'g'),\n        NameTransformMap[NameTransformSymbol.AT],\n      )\n      .replace(\n        new RegExp(`${NameTransformSymbol.HYPHEN}`, 'g'),\n        NameTransformMap[NameTransformSymbol.HYPHEN],\n      )\n      .replace(\n        new RegExp(`${NameTransformSymbol.SLASH}`, 'g'),\n        NameTransformMap[NameTransformSymbol.SLASH],\n      )}${ext}`;\n  } catch (err) {\n    throw err;\n  }\n};\n\nconst decodeName = function (\n  name: string,\n  prefix?: string,\n  withExt?: boolean,\n): string {\n  try {\n    let decodedName = name;\n    if (prefix) {\n      if (!decodedName.startsWith(prefix)) {\n        return decodedName;\n      }\n      decodedName = decodedName.replace(new RegExp(prefix, 'g'), '');\n    }\n    decodedName = decodedName\n      .replace(\n        new RegExp(`${NameTransformMap[NameTransformSymbol.AT]}`, 'g'),\n        EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.AT]],\n      )\n      .replace(\n        new RegExp(`${NameTransformMap[NameTransformSymbol.SLASH]}`, 'g'),\n        EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.SLASH]],\n      )\n      .replace(\n        new RegExp(`${NameTransformMap[NameTransformSymbol.HYPHEN]}`, 'g'),\n        EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.HYPHEN]],\n      );\n    if (withExt) {\n      decodedName = decodedName.replace('.js', '');\n    }\n    return decodedName;\n  } catch (err) {\n    throw err;\n  }\n};\n\nconst generateExposeFilename = (\n  exposeName: string,\n  withExt: boolean,\n): string => {\n  if (!exposeName) {\n    return '';\n  }\n\n  let expose = exposeName;\n  if (expose === '.') {\n    expose = 'default_export';\n  }\n  if (expose.startsWith('./')) {\n    expose = expose.replace('./', '');\n  }\n\n  return encodeName(expose, '__federation_expose_', withExt);\n};\n\nconst generateShareFilename = (pkgName: string, withExt: boolean): string => {\n  if (!pkgName) {\n    return '';\n  }\n  return encodeName(pkgName, '__federation_shared_', withExt);\n};\n\ntype ResourceUrlInfo =\n  | { getPublicPath: string }\n  | { publicPath: string; ssrPublicPath?: string };\n\nfunction getResourceUrl(module: ModuleInfo, sourceUrl: string): string;\nfunction getResourceUrl(module: ResourceUrlInfo, sourceUrl: string): string;\nfunction getResourceUrl(\n  module: ModuleInfo | ResourceUrlInfo,\n  sourceUrl: string,\n): string {\n  if ('getPublicPath' in module) {\n    let publicPath;\n\n    if (!module.getPublicPath.startsWith('function')) {\n      publicPath = new Function(module.getPublicPath)();\n    } else {\n      publicPath = new Function('return ' + module.getPublicPath)()();\n    }\n\n    return `${publicPath}${sourceUrl}`;\n  } else if ('publicPath' in module) {\n    if (\n      !isBrowserEnv() &&\n      !isReactNativeEnv() &&\n      'ssrPublicPath' in module &&\n      typeof module.ssrPublicPath === 'string'\n    ) {\n      return `${module.ssrPublicPath}${sourceUrl}`;\n    }\n    return `${module.publicPath}${sourceUrl}`;\n  } else {\n    console.warn(\n      'Cannot get resource URL. If in debug mode, please ignore.',\n      module,\n      sourceUrl,\n    );\n    return '';\n  }\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nconst assert = (condition: any, msg: string): asserts condition => {\n  if (!condition) {\n    error(msg);\n  }\n};\n\nconst error = (msg: string | Error | unknown): never => {\n  throw new Error(`${LOG_CATEGORY}: ${msg}`);\n};\n\nconst warn = (msg: Parameters<typeof console.warn>[0]): void => {\n  console.warn(`${LOG_CATEGORY}: ${msg}`);\n};\n\nfunction safeToString(info: any): string {\n  try {\n    return JSON.stringify(info, null, 2);\n  } catch (e) {\n    return '';\n  }\n}\n\n// RegExp for version string\nconst VERSION_PATTERN_REGEXP: RegExp = /^([\\d^=v<>~]|[*xX]$)/;\n\nfunction isRequiredVersion(str: string): boolean {\n  return VERSION_PATTERN_REGEXP.test(str);\n}\n\nexport {\n  parseEntry,\n  decodeName,\n  encodeName,\n  composeKeyWithSeparator,\n  generateExposeFilename,\n  generateShareFilename,\n  getResourceUrl,\n  assert,\n  error,\n  warn,\n  safeToString,\n  isRequiredVersion,\n};\n", "import {\n  Manifest,\n  ProviderModuleInfo,\n  ModuleInfo,\n  BasicProviderModuleInfo,\n  ConsumerModuleInfo,\n  ManifestProvider,\n  moduleFederationPlugin,\n} from './types';\nimport { MANIFEST_EXT, ManifestFileName, StatsFileName } from './constant';\n\ninterface IOptions {\n  remotes?: Record<string, string>;\n  overrides?: Record<string, string>;\n  version?: string;\n}\n\nexport const simpleJoinRemoteEntry = (rPath: string, rName: string): string => {\n  if (!rPath) {\n    return rName;\n  }\n  const transformPath = (str: string) => {\n    if (str === '.') {\n      return '';\n    }\n    if (str.startsWith('./')) {\n      return str.replace('./', '');\n    }\n    if (str.startsWith('/')) {\n      const strWithoutSlash = str.slice(1);\n      if (strWithoutSlash.endsWith('/')) {\n        return strWithoutSlash.slice(0, -1);\n      }\n      return strWithoutSlash;\n    }\n    return str;\n  };\n\n  const transformedPath = transformPath(rPath);\n\n  if (!transformedPath) {\n    return rName;\n  }\n\n  if (transformedPath.endsWith('/')) {\n    return `${transformedPath}${rName}`;\n  }\n\n  return `${transformedPath}/${rName}`;\n};\n\nexport function inferAutoPublicPath(url: string): string {\n  return url\n    .replace(/#.*$/, '')\n    .replace(/\\?.*$/, '')\n    .replace(/\\/[^\\/]+$/, '/');\n}\n\n// Priority: overrides > remotes\n// eslint-disable-next-line max-lines-per-function\nexport function generateSnapshotFromManifest(\n  manifest: Manifest,\n  options: IOptions = {},\n): ProviderModuleInfo {\n  const { remotes = {}, overrides = {}, version } = options;\n  let remoteSnapshot: ProviderModuleInfo;\n\n  const getPublicPath = (): string => {\n    if ('publicPath' in manifest.metaData) {\n      if (\n        (manifest.metaData.publicPath === 'auto' ||\n          manifest.metaData.publicPath === '') &&\n        version\n      ) {\n        // use same implementation as publicPath auto runtime module implements\n        return inferAutoPublicPath(version);\n      }\n      return manifest.metaData.publicPath;\n    } else {\n      return manifest.metaData.getPublicPath;\n    }\n  };\n\n  const overridesKeys = Object.keys(overrides);\n\n  let remotesInfo: ConsumerModuleInfo['remotesInfo'] = {};\n\n  // If remotes are not provided, only the remotes in the manifest will be read\n  if (!Object.keys(remotes).length) {\n    remotesInfo =\n      manifest.remotes?.reduce(\n        (res, next) => {\n          let matchedVersion: string;\n          const name = next.federationContainerName;\n          // overrides have higher priority\n          if (overridesKeys.includes(name)) {\n            matchedVersion = overrides[name];\n          } else {\n            if ('version' in next) {\n              matchedVersion = next.version;\n            } else {\n              matchedVersion = next.entry;\n            }\n          }\n          res[name] = {\n            matchedVersion,\n          };\n          return res;\n        },\n        {} as ConsumerModuleInfo['remotesInfo'],\n      ) || {};\n  }\n\n  // If remotes (deploy scenario) are specified, they need to be traversed again\n  Object.keys(remotes).forEach(\n    (key) =>\n      (remotesInfo[key] = {\n        // overrides will override dependencies\n        matchedVersion: overridesKeys.includes(key)\n          ? overrides[key]\n          : remotes[key],\n      }),\n  );\n\n  const {\n    remoteEntry: {\n      path: remoteEntryPath,\n      name: remoteEntryName,\n      type: remoteEntryType,\n    },\n    types: remoteTypes = { path: '', name: '', zip: '', api: '' },\n    buildInfo: { buildVersion },\n    globalName,\n    ssrRemoteEntry,\n  } = manifest.metaData;\n  const { exposes } = manifest;\n\n  let basicRemoteSnapshot: BasicProviderModuleInfo = {\n    version: version ? version : '',\n    buildVersion,\n    globalName,\n    remoteEntry: simpleJoinRemoteEntry(remoteEntryPath, remoteEntryName),\n    remoteEntryType,\n    remoteTypes: simpleJoinRemoteEntry(remoteTypes.path, remoteTypes.name),\n    remoteTypesZip: remoteTypes.zip || '',\n    remoteTypesAPI: remoteTypes.api || '',\n    remotesInfo,\n    shared: manifest?.shared.map((item) => ({\n      assets: item.assets,\n      sharedName: item.name,\n      version: item.version,\n      // @ts-ignore\n      usedExports: item.referenceExports || [],\n    })),\n    modules: exposes?.map((expose) => ({\n      moduleName: expose.name,\n      modulePath: expose.path,\n      assets: expose.assets,\n    })),\n  };\n\n  if ('publicPath' in manifest.metaData) {\n    remoteSnapshot = {\n      ...basicRemoteSnapshot,\n      publicPath: getPublicPath(),\n    };\n    if (typeof manifest.metaData.ssrPublicPath === 'string') {\n      remoteSnapshot.ssrPublicPath = manifest.metaData.ssrPublicPath;\n    }\n  } else {\n    remoteSnapshot = {\n      ...basicRemoteSnapshot,\n      getPublicPath: getPublicPath(),\n    };\n  }\n\n  if (ssrRemoteEntry) {\n    const fullSSRRemoteEntry = simpleJoinRemoteEntry(\n      ssrRemoteEntry.path,\n      ssrRemoteEntry.name,\n    );\n    remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;\n    remoteSnapshot.ssrRemoteEntryType =\n      ssrRemoteEntry.type || 'commonjs-module';\n  }\n\n  return remoteSnapshot;\n}\n\nexport function isManifestProvider(\n  moduleInfo: ModuleInfo | ManifestProvider,\n): moduleInfo is ManifestProvider {\n  if (\n    'remoteEntry' in moduleInfo &&\n    moduleInfo.remoteEntry.includes(MANIFEST_EXT)\n  ) {\n    return true;\n  } else {\n    return false;\n  }\n}\n\nexport function getManifestFileName(\n  manifestOptions?: moduleFederationPlugin.ModuleFederationPluginOptions['manifest'],\n): {\n  statsFileName: string;\n  manifestFileName: string;\n} {\n  if (!manifestOptions) {\n    return {\n      statsFileName: StatsFileName,\n      manifestFileName: ManifestFileName,\n    };\n  }\n\n  let filePath =\n    typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';\n  let fileName =\n    typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';\n\n  const JSON_EXT = '.json';\n  const addExt = (name: string): string => {\n    if (name.endsWith(JSON_EXT)) {\n      return name;\n    }\n    return `${name}${JSON_EXT}`;\n  };\n  const insertSuffix = (name: string, suffix: string): string => {\n    return name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);\n  };\n  const manifestFileName = fileName ? addExt(fileName) : ManifestFileName;\n  const statsFileName = fileName\n    ? insertSuffix(manifestFileName, '-stats')\n    : StatsFileName;\n\n  return {\n    statsFileName: simpleJoinRemoteEntry(filePath, statsFileName),\n    manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName),\n  };\n}\n", "import { isDebugMode } from './env';\n\nconst PREFIX = '[ Module Federation ]';\n\ntype LogMethod = 'log' | 'info' | 'warn' | 'error' | 'debug';\n\ntype LoggerDelegate = Partial<Record<LogMethod, (...args: any[]) => void>> & {\n  [key: string]: ((...args: any[]) => void) | undefined;\n};\n\nconst DEFAULT_DELEGATE: LoggerDelegate = console as unknown as LoggerDelegate;\nconst LOGGER_STACK_SKIP_TOKENS = [\n  'logger.ts',\n  'logger.js',\n  'captureStackTrace',\n  'Logger.emit',\n  'Logger.log',\n  'Logger.info',\n  'Logger.warn',\n  'Logger.error',\n  'Logger.debug',\n];\n\nfunction captureStackTrace(): string | undefined {\n  try {\n    const stack = new Error().stack;\n    if (!stack) {\n      return undefined;\n    }\n\n    const [, ...rawLines] = stack.split('\\n');\n    const filtered = rawLines.filter(\n      (line) => !LOGGER_STACK_SKIP_TOKENS.some((token) => line.includes(token)),\n    );\n\n    if (!filtered.length) {\n      return undefined;\n    }\n\n    const stackPreview = filtered.slice(0, 5).join('\\n');\n    return `Stack trace:\\n${stackPreview}`;\n  } catch {\n    return undefined;\n  }\n}\n\nclass Logger {\n  prefix: string;\n  private delegate: LoggerDelegate;\n\n  constructor(prefix: string, delegate: LoggerDelegate = DEFAULT_DELEGATE) {\n    this.prefix = prefix;\n    this.delegate = delegate ?? DEFAULT_DELEGATE;\n  }\n\n  setPrefix(prefix: string) {\n    this.prefix = prefix;\n  }\n\n  setDelegate(delegate?: LoggerDelegate) {\n    this.delegate = delegate ?? DEFAULT_DELEGATE;\n  }\n\n  private emit(method: LogMethod, args: any[]) {\n    const delegate = this.delegate;\n    const debugMode = isDebugMode();\n    const stackTrace = debugMode ? captureStackTrace() : undefined;\n    const enrichedArgs = stackTrace ? [...args, stackTrace] : args;\n\n    const order: LogMethod[] = (() => {\n      switch (method) {\n        case 'log':\n          return ['log', 'info'];\n        case 'info':\n          return ['info', 'log'];\n        case 'warn':\n          return ['warn', 'info', 'log'];\n        case 'error':\n          return ['error', 'warn', 'log'];\n        case 'debug':\n        default:\n          return ['debug', 'log'];\n      }\n    })();\n\n    for (const candidate of order) {\n      const handler = delegate[candidate];\n      if (typeof handler === 'function') {\n        handler.call(delegate, this.prefix, ...enrichedArgs);\n        return;\n      }\n    }\n\n    for (const candidate of order) {\n      const handler = DEFAULT_DELEGATE[candidate];\n      if (typeof handler === 'function') {\n        handler.call(DEFAULT_DELEGATE, this.prefix, ...enrichedArgs);\n        return;\n      }\n    }\n  }\n\n  log(...args: any[]) {\n    this.emit('log', args);\n  }\n  warn(...args: any[]) {\n    this.emit('warn', args);\n  }\n  error(...args: any[]) {\n    this.emit('error', args);\n  }\n\n  success(...args: any[]) {\n    this.emit('info', args);\n  }\n  info(...args: any[]) {\n    this.emit('info', args);\n  }\n  ready(...args: any[]) {\n    this.emit('info', args);\n  }\n\n  debug(...args: any[]) {\n    if (isDebugMode()) {\n      this.emit('debug', args);\n    }\n  }\n}\n\nfunction createLogger(prefix: string) {\n  return new Logger(prefix);\n}\n\ntype InfrastructureLogger = Logger & {\n  __mf_infrastructure_logger__: true;\n};\n\nfunction createInfrastructureLogger(prefix: string): InfrastructureLogger {\n  const infrastructureLogger = new Logger(prefix) as InfrastructureLogger;\n  Object.defineProperty(infrastructureLogger, '__mf_infrastructure_logger__', {\n    value: true,\n    enumerable: false,\n    configurable: false,\n  });\n  return infrastructureLogger;\n}\n\ntype InfrastructureLoggerCapableCompiler = {\n  getInfrastructureLogger?: (name: string) => unknown;\n};\n\nfunction bindLoggerToCompiler(\n  loggerInstance: Logger,\n  compiler: InfrastructureLoggerCapableCompiler,\n  name: string,\n) {\n  if (\n    !(loggerInstance as Partial<InfrastructureLogger>)\n      .__mf_infrastructure_logger__\n  ) {\n    return;\n  }\n  if (!compiler?.getInfrastructureLogger) {\n    return;\n  }\n  try {\n    const infrastructureLogger = compiler.getInfrastructureLogger(name);\n    if (\n      infrastructureLogger &&\n      typeof infrastructureLogger === 'object' &&\n      (typeof (infrastructureLogger as LoggerDelegate).log === 'function' ||\n        typeof (infrastructureLogger as LoggerDelegate).info === 'function' ||\n        typeof (infrastructureLogger as LoggerDelegate).warn === 'function' ||\n        typeof (infrastructureLogger as LoggerDelegate).error === 'function')\n    ) {\n      loggerInstance.setDelegate(\n        infrastructureLogger as unknown as LoggerDelegate,\n      );\n    }\n  } catch {\n    // If the bundler throws (older versions), fall back to default console logger.\n    loggerInstance.setDelegate(undefined);\n  }\n}\n\nconst logger = createLogger(PREFIX);\nconst infrastructureLogger = createInfrastructureLogger(PREFIX);\n\nexport {\n  logger,\n  infrastructureLogger,\n  createLogger,\n  createInfrastructureLogger,\n  bindLoggerToCompiler,\n};\nexport type { Logger, InfrastructureLogger };\n", "import type {\n  CreateLinkHookDom,\n  CreateLinkHookReturnDom,\n  CreateScriptHookDom,\n  CreateScriptHookReturnDom,\n} from './types';\nimport { warn } from './utils';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function safeWrapper<T extends (...args: Array<any>) => any>(\n  callback: T,\n  disableWarn?: boolean,\n): Promise<ReturnType<T> | undefined> {\n  try {\n    const res = await callback();\n    return res;\n  } catch (e) {\n    !disableWarn && warn(e);\n    return;\n  }\n}\n\nexport function isStaticResourcesEqual(url1: string, url2: string): boolean {\n  const REG_EXP = /^(https?:)?\\/\\//i;\n  // Transform url1 and url2 into relative paths\n  const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\\/$/, '');\n  const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\\/$/, '');\n  // Check if the relative paths are identical\n  return relativeUrl1 === relativeUrl2;\n}\n\nexport function createScript(info: {\n  url: string;\n  cb?: (value: void | PromiseLike<void>) => void;\n  onErrorCallback?: (error: Error) => void;\n  attrs?: Record<string, any>;\n  needDeleteScript?: boolean;\n  createScriptHook?: CreateScriptHookDom;\n}): { script: HTMLScriptElement; needAttach: boolean } {\n  // Retrieve the existing script element by its src attribute\n  let script: HTMLScriptElement | null = null;\n  let needAttach = true;\n  let timeout = 20000;\n  let timeoutId: NodeJS.Timeout;\n  const scripts = document.getElementsByTagName('script');\n\n  for (let i = 0; i < scripts.length; i++) {\n    const s = scripts[i];\n    const scriptSrc = s.getAttribute('src');\n    if (scriptSrc && isStaticResourcesEqual(scriptSrc, info.url)) {\n      script = s;\n      needAttach = false;\n      break;\n    }\n  }\n\n  if (!script) {\n    const attrs = info.attrs;\n    script = document.createElement('script');\n    script.type = attrs?.['type'] === 'module' ? 'module' : 'text/javascript';\n    let createScriptRes: CreateScriptHookReturnDom = undefined;\n    if (info.createScriptHook) {\n      createScriptRes = info.createScriptHook(info.url, info.attrs);\n\n      if (createScriptRes instanceof HTMLScriptElement) {\n        script = createScriptRes;\n      } else if (typeof createScriptRes === 'object') {\n        if ('script' in createScriptRes && createScriptRes.script) {\n          script = createScriptRes.script;\n        }\n        if ('timeout' in createScriptRes && createScriptRes.timeout) {\n          timeout = createScriptRes.timeout;\n        }\n      }\n    }\n    if (!script.src) {\n      script.src = info.url;\n    }\n    if (attrs && !createScriptRes) {\n      Object.keys(attrs).forEach((name) => {\n        if (script) {\n          if (name === 'async' || name === 'defer') {\n            script[name] = attrs[name];\n            // Attributes that do not exist are considered overridden\n          } else if (!script.getAttribute(name)) {\n            script.setAttribute(name, attrs[name]);\n          }\n        }\n      });\n    }\n  }\n\n  // Capture JS runtime errors thrown by this script's IIFE during execution.\n  // The browser still fires onload even when the script throws, so without this\n  // listener the execution error would silently become an uncaught global exception.\n  let executionError: Error | null = null;\n  const executionErrorHandler =\n    typeof window !== 'undefined'\n      ? (evt: ErrorEvent) => {\n          if (evt.filename && isStaticResourcesEqual(evt.filename, info.url)) {\n            const err = new Error(\n              `ScriptExecutionError: Script \"${info.url}\" loaded but threw a runtime error during execution: ${evt.message} (${evt.filename}:${evt.lineno}:${evt.colno})`,\n            );\n            err.name = 'ScriptExecutionError';\n            executionError = err;\n          }\n        }\n      : null;\n  if (executionErrorHandler) {\n    window.addEventListener('error', executionErrorHandler);\n  }\n\n  const onScriptComplete = async (\n    prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    event: any,\n  ): Promise<void> => {\n    clearTimeout(timeoutId);\n    if (executionErrorHandler) {\n      window.removeEventListener('error', executionErrorHandler);\n    }\n    const onScriptCompleteCallback = () => {\n      if (event?.type === 'error') {\n        const networkError = new Error(\n          event?.isTimeout\n            ? `ScriptNetworkError: Script \"${info.url}\" timed out.`\n            : `ScriptNetworkError: Failed to load script \"${info.url}\" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`,\n        );\n        networkError.name = 'ScriptNetworkError';\n        info?.onErrorCallback && info?.onErrorCallback(networkError);\n      } else if (executionError) {\n        // Script fetched OK (onload fired) but IIFE threw during execution.\n        info?.onErrorCallback && info?.onErrorCallback(executionError);\n      } else {\n        info?.cb && info?.cb();\n      }\n    };\n\n    // Prevent memory leaks in IE.\n    if (script) {\n      script.onerror = null;\n      script.onload = null;\n      safeWrapper(() => {\n        const { needDeleteScript = true } = info;\n        if (needDeleteScript) {\n          script?.parentNode && script.parentNode.removeChild(script);\n        }\n      });\n      if (prev && typeof prev === 'function') {\n        const result = (prev as any)(event);\n        if (result instanceof Promise) {\n          const res = await result;\n          onScriptCompleteCallback();\n          return res;\n        }\n        onScriptCompleteCallback();\n        return result;\n      }\n    }\n    onScriptCompleteCallback();\n  };\n\n  script.onerror = onScriptComplete.bind(null, script.onerror);\n  script.onload = onScriptComplete.bind(null, script.onload);\n\n  timeoutId = setTimeout(() => {\n    onScriptComplete(null, { type: 'error', isTimeout: true });\n  }, timeout);\n\n  return { script, needAttach };\n}\n\nexport function createLink(info: {\n  url: string;\n  cb?: (value: void | PromiseLike<void>) => void;\n  onErrorCallback?: (error: Error) => void;\n  attrs: Record<string, string>;\n  needDeleteLink?: boolean;\n  createLinkHook?: CreateLinkHookDom;\n}) {\n  // <link rel=\"preload\" href=\"script.js\" as=\"script\">\n\n  // Retrieve the existing script element by its src attribute\n  let link: HTMLLinkElement | null = null;\n  let needAttach = true;\n  let timeout = 20000;\n  let timeoutId: NodeJS.Timeout | undefined;\n  const links = document.getElementsByTagName('link');\n  for (let i = 0; i < links.length; i++) {\n    const l = links[i];\n    const linkHref = l.getAttribute('href');\n    const linkRel = l.getAttribute('rel');\n    if (\n      linkHref &&\n      isStaticResourcesEqual(linkHref, info.url) &&\n      linkRel === info.attrs['rel']\n    ) {\n      link = l;\n      needAttach = false;\n      break;\n    }\n  }\n\n  if (!link) {\n    link = document.createElement('link');\n    link.setAttribute('href', info.url);\n\n    let createLinkRes: CreateLinkHookReturnDom = undefined;\n    let shouldApplyAttrs = true;\n    const attrs = info.attrs;\n\n    if (info.createLinkHook) {\n      createLinkRes = info.createLinkHook(info.url, attrs);\n      if (createLinkRes instanceof HTMLLinkElement) {\n        link = createLinkRes;\n        shouldApplyAttrs = false;\n      } else if (typeof createLinkRes === 'object') {\n        if ('link' in createLinkRes && createLinkRes.link) {\n          link = createLinkRes.link;\n          shouldApplyAttrs = false;\n        }\n        if ('timeout' in createLinkRes && createLinkRes.timeout) {\n          timeout = createLinkRes.timeout;\n        }\n      }\n    }\n\n    if (attrs && shouldApplyAttrs) {\n      Object.keys(attrs).forEach((name) => {\n        if (link && !link.getAttribute(name)) {\n          link.setAttribute(name, attrs[name]);\n        }\n      });\n    }\n  }\n\n  if (!needAttach) {\n    Promise.resolve().then(() => {\n      info?.cb && info?.cb();\n    });\n    return { link, needAttach };\n  }\n\n  const onLinkComplete = (\n    prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    event: any,\n  ): void => {\n    if (timeoutId) {\n      clearTimeout(timeoutId);\n    }\n    const onLinkCompleteCallback = () => {\n      if (event?.type === 'error') {\n        const linkError = new Error(\n          event?.isTimeout\n            ? `LinkNetworkError: Link \"${info.url}\" timed out.`\n            : `LinkNetworkError: Failed to load link \"${info.url}\" - the URL is unreachable or the server returned an error.`,\n        );\n        linkError.name = 'LinkNetworkError';\n        info?.onErrorCallback && info?.onErrorCallback(linkError);\n      } else {\n        info?.cb && info?.cb();\n      }\n    };\n    // Prevent memory leaks in IE.\n    if (link) {\n      link.onerror = null;\n      link.onload = null;\n      safeWrapper(() => {\n        const { needDeleteLink = true } = info;\n        if (needDeleteLink) {\n          link?.parentNode && link.parentNode.removeChild(link);\n        }\n      });\n      if (prev) {\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any\n        const res = (prev as any)(event);\n        onLinkCompleteCallback();\n        return res;\n      }\n    }\n    onLinkCompleteCallback();\n  };\n\n  link.onerror = onLinkComplete.bind(null, link.onerror);\n  link.onload = onLinkComplete.bind(null, link.onload);\n  timeoutId = setTimeout(() => {\n    onLinkComplete(null, { type: 'error', isTimeout: true });\n  }, timeout);\n\n  return { link, needAttach };\n}\n\nexport function loadScript(\n  url: string,\n  info: {\n    attrs?: Record<string, any>;\n    createScriptHook?: CreateScriptHookDom;\n  },\n) {\n  const { attrs = {}, createScriptHook } = info;\n  return new Promise<void>((resolve, reject) => {\n    const { script, needAttach } = createScript({\n      url,\n      cb: resolve,\n      onErrorCallback: reject,\n      attrs: {\n        fetchpriority: 'high',\n        ...attrs,\n      },\n      createScriptHook,\n      needDeleteScript: true,\n    });\n    needAttach && document.head.appendChild(script);\n  });\n}\n", "import { CreateScriptHookNode, FetchHook } from './types';\n\n// Declare the ENV_TARGET constant that will be defined by DefinePlugin\ndeclare const ENV_TARGET: 'web' | 'node';\n\nconst sdkImportCache = new Map<string, Promise<any>>();\n\nfunction importNodeModule<T>(name: string): Promise<T> {\n  if (!name) {\n    throw new Error('import specifier is required');\n  }\n\n  // Check cache to prevent infinite recursion\n  if (sdkImportCache.has(name)) {\n    return sdkImportCache.get(name)!;\n  }\n\n  const importModule = new Function('name', `return import(name)`);\n  const promise = importModule(name)\n    .then((res: any) => res as T)\n    .catch((error: any) => {\n      console.error(`Error importing module ${name}:`, error);\n      // Remove from cache on error so it can be retried\n      sdkImportCache.delete(name);\n      throw error;\n    });\n\n  // Cache the promise to prevent recursive calls\n  sdkImportCache.set(name, promise);\n  return promise;\n}\n\nconst lazyLoaderHookFetch = async (\n  input: RequestInfo | URL,\n  init?: RequestInit,\n  loaderHook?: any,\n): Promise<Response> => {\n  const hook = (url: RequestInfo | URL, init: RequestInit) => {\n    return loaderHook.lifecycle.fetch.emit(url, init);\n  };\n\n  const res = await hook(input, init || {});\n  if (!res || !(res instanceof Response)) {\n    return fetch(input, init || {});\n  }\n\n  return res;\n};\n\nexport const createScriptNode =\n  typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web'\n    ? (\n        url: string,\n        cb: (error?: Error, scriptContext?: any) => void,\n        attrs?: Record<string, any>,\n        loaderHook?: {\n          createScriptHook?: CreateScriptHookNode;\n          fetch?: FetchHook;\n        },\n      ) => {\n        if (loaderHook?.createScriptHook) {\n          const hookResult = loaderHook.createScriptHook(url);\n          if (\n            hookResult &&\n            typeof hookResult === 'object' &&\n            'url' in hookResult\n          ) {\n            url = hookResult.url;\n          }\n        }\n\n        let urlObj: URL;\n        try {\n          urlObj = new URL(url);\n        } catch (e) {\n          console.error('Error constructing URL:', e);\n          cb(new Error(`Invalid URL: ${e}`));\n          return;\n        }\n\n        const getFetch = async (): Promise<typeof fetch> => {\n          if (loaderHook?.fetch) {\n            return (input: RequestInfo | URL, init?: RequestInit) =>\n              lazyLoaderHookFetch(input, init, loaderHook);\n          }\n\n          return fetch;\n        };\n\n        const handleScriptFetch = async (f: typeof fetch, urlObj: URL) => {\n          try {\n            const res = await f(urlObj.href);\n            const data = await res.text();\n            const [path, vm] = await Promise.all([\n              importNodeModule<typeof import('path')>('path'),\n              importNodeModule<typeof import('vm')>('vm'),\n            ]);\n\n            const scriptContext = { exports: {}, module: { exports: {} } };\n            const urlDirname = urlObj.pathname\n              .split('/')\n              .slice(0, -1)\n              .join('/');\n            const filename = path.basename(urlObj.pathname);\n\n            const script = new vm.Script(\n              `(function(exports, module, require, __dirname, __filename) {${data}\\n})`,\n              {\n                filename,\n                importModuleDynamically:\n                  //@ts-ignore\n                  vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ??\n                  importNodeModule,\n              },\n            );\n\n            let requireFn: NodeRequire;\n            if (process.env.IS_ESM_BUILD === 'true') {\n              const nodeModule =\n                await importNodeModule<typeof import('node:module')>(\n                  'node:module',\n                );\n              requireFn = nodeModule.createRequire(\n                urlObj.protocol === 'file:' || urlObj.protocol === 'node:'\n                  ? urlObj.href\n                  : path.join(process.cwd(), '__mf_require_base__.js'),\n              );\n            } else {\n              requireFn = eval('require') as NodeRequire;\n            }\n\n            script.runInThisContext()(\n              scriptContext.exports,\n              scriptContext.module,\n              requireFn,\n              urlDirname,\n              filename,\n            );\n            const exportedInterface: Record<string, any> =\n              scriptContext.module.exports || scriptContext.exports;\n\n            if (attrs && exportedInterface && attrs['globalName']) {\n              const container =\n                exportedInterface[attrs['globalName']] || exportedInterface;\n              cb(\n                undefined,\n                container as keyof typeof scriptContext.module.exports,\n              );\n              return;\n            }\n\n            cb(\n              undefined,\n              exportedInterface as keyof typeof scriptContext.module.exports,\n            );\n          } catch (e) {\n            cb(\n              e instanceof Error\n                ? e\n                : new Error(`Script execution error: ${e}`),\n            );\n          }\n        };\n\n        getFetch()\n          .then(async (f) => {\n            if (attrs?.['type'] === 'esm' || attrs?.['type'] === 'module') {\n              return loadModule(urlObj.href, {\n                fetch: f,\n                vm: await importNodeModule<typeof import('vm')>('vm'),\n              })\n                .then(async (module) => {\n                  await module.evaluate();\n                  cb(undefined, module.namespace);\n                })\n                .catch((e) => {\n                  cb(\n                    e instanceof Error\n                      ? e\n                      : new Error(`Script execution error: ${e}`),\n                  );\n                });\n            }\n            handleScriptFetch(f, urlObj);\n          })\n          .catch((err) => {\n            cb(err);\n          });\n      }\n    : (\n        url: string,\n        cb: (error?: Error, scriptContext?: any) => void,\n        attrs?: Record<string, any>,\n        loaderHook?: {\n          createScriptHook?: CreateScriptHookNode;\n          fetch?: FetchHook;\n        },\n      ) => {\n        cb(\n          new Error('createScriptNode is disabled in non-Node.js environment'),\n        );\n      };\n\nexport const loadScriptNode =\n  typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web'\n    ? (\n        url: string,\n        info: {\n          attrs?: Record<string, any>;\n          loaderHook?: {\n            createScriptHook?: CreateScriptHookNode;\n          };\n        },\n      ) => {\n        return new Promise<void>((resolve, reject) => {\n          createScriptNode(\n            url,\n            (error, scriptContext) => {\n              if (error) {\n                reject(error);\n              } else {\n                const remoteEntryKey =\n                  info?.attrs?.['globalName'] ||\n                  `__FEDERATION_${info?.attrs?.['name']}:custom__`;\n                const entryExports = ((globalThis as any)[remoteEntryKey] =\n                  scriptContext);\n                resolve(entryExports);\n              }\n            },\n            info.attrs,\n            info.loaderHook,\n          );\n        });\n      }\n    : (\n        url: string,\n        info: {\n          attrs?: Record<string, any>;\n          loaderHook?: {\n            createScriptHook?: CreateScriptHookNode;\n          };\n        },\n      ) => {\n        throw new Error(\n          'loadScriptNode is disabled in non-Node.js environment',\n        );\n      };\n\nconst esmModuleCache = new Map<string, any>();\n\ntype LoadModuleOptions = {\n  vm: typeof import('vm') & {\n    SourceTextModule: any;\n    SyntheticModule: any;\n  };\n  fetch: typeof fetch;\n};\n\nconst isFetchableRemoteModuleUrl = (url: string): boolean =>\n  url.startsWith('http:') || url.startsWith('https:');\n\nconst isBareModuleSpecifier = (specifier: string): boolean =>\n  !specifier.startsWith('./') &&\n  !specifier.startsWith('../') &&\n  !specifier.startsWith('/') &&\n  !specifier.includes(':');\n\nfunction encodeRemoteModulePath(url: string): string {\n  const remoteUrl = new URL(url);\n  const encodedProtocol = encodeURIComponent(remoteUrl.protocol.slice(0, -1));\n  const encodedHost = encodeURIComponent(remoteUrl.host);\n  const encodedPathname = remoteUrl.pathname\n    .split('/')\n    .map((segment) => encodeURIComponent(segment))\n    .join('/');\n  const encodedSearchHash = encodeURIComponent(\n    `${remoteUrl.search}${remoteUrl.hash}`,\n  );\n  const encodedSuffix = encodedSearchHash ? `/${encodedSearchHash}` : '';\n\n  return `/${encodedProtocol}/${encodedHost}${encodedPathname}${encodedSuffix}`;\n}\n\nfunction createImportMetaUrl(url: string, baseFileUrl: string): string {\n  const baseUrl = baseFileUrl.endsWith('/') ? baseFileUrl : `${baseFileUrl}/`;\n  return new URL(\n    `__module_federation_remote__${encodeRemoteModulePath(url)}`,\n    baseUrl,\n  ).href;\n}\n\nasync function isNodeBuiltinSpecifier(specifier: string): Promise<boolean> {\n  if (specifier.startsWith('node:')) {\n    return true;\n  }\n\n  if (!isBareModuleSpecifier(specifier)) {\n    return false;\n  }\n\n  const nodeModule =\n    await importNodeModule<typeof import('node:module')>('node:module');\n\n  return nodeModule.builtinModules.includes(specifier);\n}\n\nfunction getSyntheticModuleExports(moduleExports: any): Record<string, any> {\n  const namespaceObject =\n    moduleExports &&\n    (typeof moduleExports === 'object' || typeof moduleExports === 'function')\n      ? moduleExports\n      : { default: moduleExports };\n  const effectiveExports = { ...namespaceObject };\n\n  if (!Object.prototype.hasOwnProperty.call(effectiveExports, 'default')) {\n    effectiveExports.default = namespaceObject;\n  }\n\n  return effectiveExports;\n}\n\nasync function createSyntheticModuleFromExports(\n  identifier: string,\n  moduleExports: any,\n  vm: LoadModuleOptions['vm'],\n) {\n  if (typeof vm.SyntheticModule !== 'function') {\n    throw new Error(\n      'vm.SyntheticModule is required to load Node.js built-in modules in ESM remote entries.',\n    );\n  }\n\n  const effectiveExports = getSyntheticModuleExports(moduleExports);\n  const exportNames = Object.keys(effectiveExports);\n  const syntheticModule = new vm.SyntheticModule(\n    exportNames,\n    function setSyntheticModuleExports(this: {\n      setExport: (name: string, value: any) => void;\n    }) {\n      for (const name of exportNames) {\n        this.setExport(name, effectiveExports[name]);\n      }\n    },\n    { identifier },\n  );\n\n  esmModuleCache.set(identifier, syntheticModule);\n  await syntheticModule.link(async () => {\n    throw new Error(\n      `Node.js built-in module \"${identifier}\" should not request child modules.`,\n    );\n  });\n  await syntheticModule.evaluate();\n\n  return syntheticModule;\n}\n\nasync function loadNodeBuiltinModule(\n  specifier: string,\n  vm: LoadModuleOptions['vm'],\n) {\n  const cacheKey = `node-builtin:${specifier}`;\n  if (esmModuleCache.has(cacheKey)) {\n    return esmModuleCache.get(cacheKey)!;\n  }\n\n  const moduleExports = await importNodeModule(specifier);\n  return createSyntheticModuleFromExports(cacheKey, moduleExports, vm);\n}\n\nasync function loadResolvedModule(\n  specifier: string,\n  parentUrl: string,\n  options: LoadModuleOptions,\n) {\n  if (await isNodeBuiltinSpecifier(specifier)) {\n    return loadNodeBuiltinModule(specifier, options.vm);\n  }\n\n  if (isBareModuleSpecifier(specifier)) {\n    throw new Error(\n      `Unsupported ESM module specifier \"${specifier}\". Only relative or absolute http(s) remote modules and Node.js built-in modules are supported.`,\n    );\n  }\n\n  const resolvedUrl = new URL(specifier, parentUrl).href;\n  if (!isFetchableRemoteModuleUrl(resolvedUrl)) {\n    throw new Error(\n      `Unsupported ESM module specifier \"${specifier}\" resolved to \"${resolvedUrl}\". Only http(s) remote modules and Node.js built-in modules are supported.`,\n    );\n  }\n\n  return loadModule(resolvedUrl, options);\n}\n\nasync function evaluateDynamicModule(module: any) {\n  if (module.status === 'linked') {\n    await module.evaluate();\n  }\n\n  if (module.status === 'errored') {\n    throw module.error;\n  }\n\n  return module;\n}\n\nasync function loadModule(url: string, options: LoadModuleOptions) {\n  // Check cache to prevent infinite recursion in ESM loading\n  if (esmModuleCache.has(url)) {\n    return esmModuleCache.get(url)!;\n  }\n\n  const { fetch, vm } = options;\n  if (!isFetchableRemoteModuleUrl(url)) {\n    throw new Error(\n      `Unsupported ESM module URL \"${url}\". Only http(s) remote modules and Node.js built-in modules are supported.`,\n    );\n  }\n\n  const response = await fetch(url);\n  const code = await response.text();\n  const nodeUrl = await importNodeModule<typeof import('node:url')>('node:url');\n  const cwdFileUrl = nodeUrl.pathToFileURL(process.cwd()).href;\n\n  const sourceTextModule: any = new vm.SourceTextModule(code, {\n    identifier: url,\n    initializeImportMeta: (meta: { url: string }) => {\n      meta.url = createImportMetaUrl(url, cwdFileUrl);\n    },\n    importModuleDynamically: async (specifier: string) => {\n      return evaluateDynamicModule(\n        await loadResolvedModule(specifier, url, options),\n      );\n    },\n  });\n\n  // Cache the module before linking to prevent cycles\n  esmModuleCache.set(url, sourceTextModule);\n\n  await sourceTextModule.link(async (specifier: string) => {\n    return loadResolvedModule(specifier, url, options);\n  });\n\n  return sourceTextModule;\n}\n", "const getDocsUrl = (errorCode: string) => {\n  const type = errorCode.split('-')[0].toLowerCase();\n  return `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${type}#${errorCode.toLowerCase()}`;\n};\n\nexport const getShortErrorMsg = (\n  errorCode: string,\n  errorDescMap: Record<string, string>,\n  args?: Record<string, unknown>,\n  originalErrorMsg?: string,\n) => {\n  const msg = [`${[errorDescMap[errorCode]]} #${errorCode}`];\n  args && msg.push(`args: ${JSON.stringify(args)}`);\n  msg.push(getDocsUrl(errorCode));\n  originalErrorMsg && msg.push(`Original Error Message:\\n ${originalErrorMsg}`);\n  return msg.join('\\n');\n};\n", "import { getShortErrorMsg } from './getShortErrorMsg';\nimport type { MFContext } from './MFContext';\n\nexport function logAndReport<T extends (msg: string) => unknown>(\n  code: string,\n  descMap: Record<string, string>,\n  args: Record<string, unknown>,\n  logger: T,\n  originalErrorMsg?: string,\n  context?: Partial<MFContext>,\n): ReturnType<T> {\n  const msg = getShortErrorMsg(code, descMap, args, originalErrorMsg);\n  return logger(msg) as ReturnType<T>;\n}\n", "import { createLogger } from '@module-federation/sdk';\nimport type { MFContext } from '@module-federation/error-codes';\nimport { logAndReport } from '@module-federation/error-codes/browser';\n\nconst LOG_CATEGORY = '[ Federation Runtime ]';\n// FIXME: pre-bundle ?\nconst logger = createLogger(LOG_CATEGORY);\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function assert(condition: any, msg: string): asserts condition;\nexport function assert(\n  condition: any,\n  code: string,\n  descMap: Record<string, string>,\n  args?: Record<string, unknown>,\n  context?: Partial<MFContext>,\n): asserts condition;\nexport function assert(\n  condition: any,\n  msgOrCode: string,\n  descMap?: Record<string, string>,\n  args?: Record<string, unknown>,\n  context?: Partial<MFContext>,\n): asserts condition {\n  if (!condition) {\n    if (descMap !== undefined) {\n      error(msgOrCode, descMap, args, undefined, context);\n    } else {\n      error(msgOrCode);\n    }\n  }\n}\n\nexport function error(msg: string | Error | unknown): never;\nexport function error(\n  code: string,\n  descMap: Record<string, string>,\n  args?: Record<string, unknown>,\n  originalErrorMsg?: string,\n  context?: Partial<MFContext>,\n): never;\nexport function error(\n  msgOrCode: string | Error | unknown,\n  descMap?: Record<string, string>,\n  args?: Record<string, unknown>,\n  originalErrorMsg?: string,\n  context?: Partial<MFContext>,\n): never {\n  if (descMap !== undefined) {\n    return logAndReport(\n      msgOrCode as string,\n      descMap,\n      args ?? {},\n      (msg) => {\n        throw new Error(`${LOG_CATEGORY}: ${msg}`);\n      },\n      originalErrorMsg,\n      context,\n    );\n  }\n  const msg = msgOrCode;\n  if (msg instanceof Error) {\n    if (!msg.message.startsWith(LOG_CATEGORY)) {\n      msg.message = `${LOG_CATEGORY}: ${msg.message}`;\n    }\n    throw msg;\n  }\n  throw new Error(`${LOG_CATEGORY}: ${msg}`);\n}\n\nexport function warn(msg: Parameters<typeof console.warn>[0]): void {\n  if (msg instanceof Error) {\n    // Check if the message already starts with the log category to avoid duplication\n    if (!msg.message.startsWith(LOG_CATEGORY)) {\n      msg.message = `${LOG_CATEGORY}: ${msg.message}`;\n    }\n    logger.warn(msg);\n  } else {\n    logger.warn(msg);\n  }\n}\n\nexport { logger };\n", "import {\n  RemoteWithEntry,\n  ModuleInfo,\n  RemoteEntryType,\n  isBrowserEnvValue,\n  isReactNativeEnv,\n} from '@module-federation/sdk';\nimport { Remote, RemoteInfoOptionalVersion } from '../type';\nimport { warn } from './logger';\n\nexport function addUniqueItem(arr: Array<string>, item: string): Array<string> {\n  if (arr.findIndex((name) => name === item) === -1) {\n    arr.push(item);\n  }\n  return arr;\n}\n\nexport function getFMId(\n  remoteInfo: RemoteInfoOptionalVersion | RemoteWithEntry,\n): string {\n  if ('version' in remoteInfo && remoteInfo.version) {\n    return `${remoteInfo.name}:${remoteInfo.version}`;\n  } else if ('entry' in remoteInfo && remoteInfo.entry) {\n    return `${remoteInfo.name}:${remoteInfo.entry}`;\n  } else {\n    return `${remoteInfo.name}`;\n  }\n}\n\nexport function isRemoteInfoWithEntry(\n  remote: Remote,\n): remote is RemoteWithEntry {\n  return typeof (remote as RemoteWithEntry).entry !== 'undefined';\n}\n\nexport function isPureRemoteEntry(remote: RemoteWithEntry): boolean {\n  return !remote.entry.includes('.json');\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function safeWrapper<T extends (...args: Array<any>) => any>(\n  callback: T,\n  disableWarn?: boolean,\n): Promise<ReturnType<T> | undefined> {\n  try {\n    const res = await callback();\n    return res;\n  } catch (e) {\n    !disableWarn && warn(e);\n    return;\n  }\n}\n\nexport function isObject(val: any): boolean {\n  return val && typeof val === 'object';\n}\n\nexport const objectToString = Object.prototype.toString;\n\nexport function isPlainObject(val: any): val is object {\n  return objectToString.call(val) === '[object Object]';\n}\n\nexport function isStaticResourcesEqual(url1: string, url2: string): boolean {\n  const REG_EXP = /^(https?:)?\\/\\//i;\n  // Transform url1 and url2 into relative paths\n  const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\\/$/, '');\n  const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\\/$/, '');\n  // Check if the relative paths are identical\n  return relativeUrl1 === relativeUrl2;\n}\n\nexport function arrayOptions<T>(options: T | Array<T>): Array<T> {\n  return Array.isArray(options) ? options : [options];\n}\n\nexport function getRemoteEntryInfoFromSnapshot(snapshot: ModuleInfo): {\n  url: string;\n  type: RemoteEntryType;\n  globalName: string;\n} {\n  const defaultRemoteEntryInfo: {\n    url: string;\n    type: RemoteEntryType;\n    globalName: string;\n  } = {\n    url: '',\n    type: 'global',\n    globalName: '',\n  };\n  if (\n    isBrowserEnvValue ||\n    isReactNativeEnv() ||\n    !('ssrRemoteEntry' in snapshot)\n  ) {\n    return 'remoteEntry' in snapshot\n      ? {\n          url: snapshot.remoteEntry,\n          type: snapshot.remoteEntryType,\n          globalName: snapshot.globalName,\n        }\n      : defaultRemoteEntryInfo;\n  }\n  if ('ssrRemoteEntry' in snapshot) {\n    return {\n      url: snapshot.ssrRemoteEntry || defaultRemoteEntryInfo.url,\n      type: snapshot.ssrRemoteEntryType || defaultRemoteEntryInfo.type,\n      globalName: snapshot.globalName,\n    };\n  }\n  return defaultRemoteEntryInfo;\n}\n\nexport const processModuleAlias = (name: string, subPath: string) => {\n  // @host/ ./button -> @host/button\n  let moduleName;\n  if (name.endsWith('/')) {\n    moduleName = name.slice(0, -1);\n  } else {\n    moduleName = name;\n  }\n\n  if (subPath.startsWith('.')) {\n    subPath = subPath.slice(1);\n  }\n  moduleName = moduleName + subPath;\n  return moduleName;\n};\n", "import { ModuleFederation } from './core';\nimport {\n  RemoteEntryExports,\n  GlobalShareScopeMap,\n  Remote,\n  Optional,\n} from './type';\nimport { getFMId } from './utils/tool';\nimport {\n  GlobalModuleInfo,\n  ModuleInfo,\n  isDebugMode,\n} from '@module-federation/sdk';\nimport { warn, error } from './utils/logger';\nimport { ModuleFederationRuntimePlugin } from './type/plugin';\n\nexport interface Federation {\n  __GLOBAL_PLUGIN__: Array<ModuleFederationRuntimePlugin>;\n  __DEBUG_CONSTRUCTOR_VERSION__?: string;\n  moduleInfo: GlobalModuleInfo;\n  __DEBUG_CONSTRUCTOR__?: typeof ModuleFederation;\n  __INSTANCES__: Array<ModuleFederation>;\n  __SHARE__: GlobalShareScopeMap;\n  __MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;\n  __PRELOADED_MAP__: Map<string, boolean>;\n  __PRELOADED_ASSETS__: Set<string>;\n}\n\nconst MAX_PRELOADED_ASSETS = 2000;\nexport const CurrentGlobal =\n  typeof globalThis === 'object' ? globalThis : window;\nexport const nativeGlobal: typeof global = (() => {\n  try {\n    // get real window (incase of sandbox)\n    return document.defaultView;\n  } catch {\n    // node env\n    return CurrentGlobal;\n  }\n})() as typeof global;\n\nexport const Global = nativeGlobal;\n\ndeclare global {\n  // eslint-disable-next-line no-var\n  var __FEDERATION__: Federation,\n    __VMOK__: Federation,\n    // eslint-disable-next-line no-var\n    __GLOBAL_LOADING_REMOTE_ENTRY__: Record<\n      string,\n      undefined | Promise<RemoteEntryExports | void>\n    >;\n}\n\nfunction definePropertyGlobalVal(\n  target: typeof CurrentGlobal,\n  key: string,\n  val: any,\n) {\n  Object.defineProperty(target, key, {\n    value: val,\n    configurable: false,\n    writable: true,\n  });\n}\n\nfunction includeOwnProperty(target: typeof CurrentGlobal, key: string) {\n  return Object.hasOwnProperty.call(target, key);\n}\n\n// This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.\n// The sandbox in the microfrontend does not replicate the value of 'configurable'.\n// If there is no loading content on the global object, this section defines the loading object.\nif (!includeOwnProperty(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {\n  definePropertyGlobalVal(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__', {});\n}\n\nexport const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;\n\nfunction setGlobalDefaultVal(target: typeof CurrentGlobal) {\n  if (\n    includeOwnProperty(target, '__VMOK__') &&\n    !includeOwnProperty(target, '__FEDERATION__')\n  ) {\n    definePropertyGlobalVal(target, '__FEDERATION__', target.__VMOK__);\n  }\n\n  if (!includeOwnProperty(target, '__FEDERATION__')) {\n    definePropertyGlobalVal(target, '__FEDERATION__', {\n      __GLOBAL_PLUGIN__: [],\n      __INSTANCES__: [],\n      moduleInfo: {},\n      __SHARE__: {},\n      __MANIFEST_LOADING__: {},\n      __PRELOADED_MAP__: new Map(),\n      __PRELOADED_ASSETS__: new Set(),\n    });\n\n    definePropertyGlobalVal(target, '__VMOK__', target.__FEDERATION__);\n  }\n\n  target.__FEDERATION__.__GLOBAL_PLUGIN__ ??= [];\n  target.__FEDERATION__.__INSTANCES__ ??= [];\n  target.__FEDERATION__.moduleInfo ??= {};\n  target.__FEDERATION__.__SHARE__ ??= {};\n  target.__FEDERATION__.__MANIFEST_LOADING__ ??= {};\n  target.__FEDERATION__.__PRELOADED_MAP__ ??= new Map();\n  target.__FEDERATION__.__PRELOADED_ASSETS__ ??= new Set();\n}\n\nsetGlobalDefaultVal(CurrentGlobal);\nsetGlobalDefaultVal(nativeGlobal);\n\nexport function resetFederationGlobalInfo(): void {\n  CurrentGlobal.__FEDERATION__.__GLOBAL_PLUGIN__ = [];\n  CurrentGlobal.__FEDERATION__.__INSTANCES__ = [];\n  CurrentGlobal.__FEDERATION__.moduleInfo = {};\n  CurrentGlobal.__FEDERATION__.__SHARE__ = {};\n  CurrentGlobal.__FEDERATION__.__MANIFEST_LOADING__ = {};\n  CurrentGlobal.__FEDERATION__.__PRELOADED_ASSETS__.clear();\n\n  Object.keys(globalLoading).forEach((key) => {\n    delete globalLoading[key];\n  });\n}\n\nexport function setGlobalFederationInstance(\n  FederationInstance: ModuleFederation,\n): void {\n  CurrentGlobal.__FEDERATION__.__INSTANCES__.push(FederationInstance);\n}\n\nexport function getGlobalFederationConstructor():\n  | typeof ModuleFederation\n  | undefined {\n  return CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__;\n}\n\nexport function setGlobalFederationConstructor(\n  FederationConstructor: typeof ModuleFederation | undefined,\n  isDebug = isDebugMode(),\n): void {\n  if (isDebug) {\n    CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;\n    CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = __VERSION__;\n  }\n}\n\nexport function getInfoWithoutType<T extends object>(\n  target: T,\n  key: keyof T,\n): { value: T[keyof T] | undefined; key: string } {\n  if (typeof key === 'string') {\n    const keyRes = target[key];\n    if (keyRes) {\n      return {\n        value: target[key],\n        key: key as string,\n      };\n    } else {\n      const targetKeys = Object.keys(target);\n      for (const targetKey of targetKeys) {\n        const [targetTypeOrName, _] = targetKey.split(':');\n        const nKey = `${targetTypeOrName}:${key}` as unknown as keyof T;\n        const typeWithKeyRes = target[nKey];\n        if (typeWithKeyRes) {\n          return {\n            value: typeWithKeyRes,\n            key: nKey as string,\n          };\n        }\n      }\n      return {\n        value: undefined,\n        key: key as string,\n      };\n    }\n  } else {\n    error(\n      `getInfoWithoutType: \"key\" must be a string, got ${typeof key} (${JSON.stringify(key)}).`,\n    );\n  }\n}\n\nexport const getGlobalSnapshot = (): GlobalModuleInfo =>\n  nativeGlobal.__FEDERATION__.moduleInfo;\n\nexport const getTargetSnapshotInfoByModuleInfo = (\n  moduleInfo: Optional<Remote, 'alias'>,\n  snapshot: GlobalModuleInfo,\n): GlobalModuleInfo[string] | undefined => {\n  // Check if the remote is included in the hostSnapshot\n  const moduleKey = getFMId(moduleInfo);\n  const getModuleInfo = getInfoWithoutType(snapshot, moduleKey).value;\n\n  // The remoteSnapshot might not include a version\n  if (\n    getModuleInfo &&\n    !getModuleInfo.version &&\n    'version' in moduleInfo &&\n    moduleInfo['version']\n  ) {\n    getModuleInfo.version = moduleInfo['version'];\n  }\n\n  if (getModuleInfo) {\n    return getModuleInfo;\n  }\n\n  // If the remote is not included in the hostSnapshot, deploy a micro app snapshot\n  if ('version' in moduleInfo && moduleInfo['version']) {\n    const { version, ...resModuleInfo } = moduleInfo;\n    const moduleKeyWithoutVersion = getFMId(resModuleInfo);\n    const getModuleInfoWithoutVersion = getInfoWithoutType(\n      nativeGlobal.__FEDERATION__.moduleInfo,\n      moduleKeyWithoutVersion,\n    ).value;\n\n    if (getModuleInfoWithoutVersion?.version === version) {\n      return getModuleInfoWithoutVersion;\n    }\n  }\n\n  return;\n};\n\nexport const getGlobalSnapshotInfoByModuleInfo = (\n  moduleInfo: Optional<Remote, 'alias'>,\n): GlobalModuleInfo[string] | undefined =>\n  getTargetSnapshotInfoByModuleInfo(\n    moduleInfo,\n    nativeGlobal.__FEDERATION__.moduleInfo,\n  );\n\nexport const setGlobalSnapshotInfoByModuleInfo = (\n  remoteInfo: Remote,\n  moduleDetailInfo: GlobalModuleInfo[string],\n): GlobalModuleInfo => {\n  const moduleKey = getFMId(remoteInfo);\n  nativeGlobal.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;\n  return nativeGlobal.__FEDERATION__.moduleInfo;\n};\n\nexport const addGlobalSnapshot = (\n  moduleInfos: GlobalModuleInfo,\n): (() => void) => {\n  nativeGlobal.__FEDERATION__.moduleInfo = {\n    ...nativeGlobal.__FEDERATION__.moduleInfo,\n    ...moduleInfos,\n  };\n  return () => {\n    const keys = Object.keys(moduleInfos);\n    for (const key of keys) {\n      delete nativeGlobal.__FEDERATION__.moduleInfo[key];\n    }\n  };\n};\n\nexport const getRemoteEntryExports = (\n  name: string,\n  globalName: string | undefined,\n): {\n  remoteEntryKey: string;\n  entryExports: RemoteEntryExports | undefined;\n} => {\n  const remoteEntryKey = globalName || `__FEDERATION_${name}:custom__`;\n  const entryExports = (CurrentGlobal as any)[remoteEntryKey];\n  return {\n    remoteEntryKey,\n    entryExports,\n  };\n};\n\n// This function is used to register global plugins.\n// It iterates over the provided plugins and checks if they are already registered.\n// If a plugin is not registered, it is added to the global plugins.\n// If a plugin is already registered, a warning message is logged.\nexport const registerGlobalPlugins = (\n  plugins: Array<ModuleFederationRuntimePlugin>,\n): void => {\n  const { __GLOBAL_PLUGIN__ } = nativeGlobal.__FEDERATION__;\n\n  plugins.forEach((plugin) => {\n    if (__GLOBAL_PLUGIN__.findIndex((p) => p.name === plugin.name) === -1) {\n      __GLOBAL_PLUGIN__.push(plugin);\n    } else {\n      warn(`The plugin ${plugin.name} has been registered.`);\n    }\n  });\n};\n\nexport const getGlobalHostPlugins = (): Array<ModuleFederationRuntimePlugin> =>\n  nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__;\n\nexport const getPreloaded = (id: string) =>\n  CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(id);\n\nexport const setPreloaded = (id: string) =>\n  CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(id, true);\n\nexport const getPreloadedAsset = (url: string) =>\n  CurrentGlobal.__FEDERATION__.__PRELOADED_ASSETS__.has(url);\n\nexport const setPreloadedAsset = (url: string): void => {\n  const preloadedAssets = CurrentGlobal.__FEDERATION__.__PRELOADED_ASSETS__;\n  preloadedAssets.add(url);\n\n  if (preloadedAssets.size > MAX_PRELOADED_ASSETS) {\n    const oldestUrl = preloadedAssets.values().next().value;\n    if (oldestUrl !== undefined) {\n      preloadedAssets.delete(oldestUrl);\n    }\n  }\n};\n", "// fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts\n// those constants are based on https://www.rubydoc.info/gems/semantic_range/3.0.0/SemanticRange#BUILDIDENTIFIER-constant\n// Copyright (c)\n// vite-plugin-federation is licensed under Mulan PSL v2.\n// You can use this software according to the terms and conditions of the Mulan PSL v2.\n// You may obtain a copy of Mulan PSL v2 at:\n//      http://license.coscl.org.cn/MulanPSL2\n// THIS SOFTWARE IS PROVIDED ON AN \"AS IS\" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.\n// See the Mulan PSL v2 for more details.\n\nconst buildIdentifier = '[0-9A-Za-z-]+';\nconst build = `(?:\\\\+(${buildIdentifier}(?:\\\\.${buildIdentifier})*))`;\nconst numericIdentifier = '0|[1-9]\\\\d*';\nconst numericIdentifierLoose = '[0-9]+';\nconst nonNumericIdentifier = '\\\\d*[a-zA-Z-][a-zA-Z0-9-]*';\nconst preReleaseIdentifierLoose = `(?:${numericIdentifierLoose}|${nonNumericIdentifier})`;\nconst preReleaseLoose = `(?:-?(${preReleaseIdentifierLoose}(?:\\\\.${preReleaseIdentifierLoose})*))`;\nconst preReleaseIdentifier = `(?:${numericIdentifier}|${nonNumericIdentifier})`;\nconst preRelease = `(?:-(${preReleaseIdentifier}(?:\\\\.${preReleaseIdentifier})*))`;\nconst xRangeIdentifier = `${numericIdentifier}|x|X|\\\\*`;\nconst xRangePlain = `[v=\\\\s]*(${xRangeIdentifier})(?:\\\\.(${xRangeIdentifier})(?:\\\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`;\nexport const hyphenRange = `^\\\\s*(${xRangePlain})\\\\s+-\\\\s+(${xRangePlain})\\\\s*$`;\nconst mainVersionLoose = `(${numericIdentifierLoose})\\\\.(${numericIdentifierLoose})\\\\.(${numericIdentifierLoose})`;\nconst loosePlain = `[v=\\\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`;\nconst gtlt = '((?:<|>)?=?)';\nexport const comparatorTrim = `(\\\\s*)${gtlt}\\\\s*(${loosePlain}|${xRangePlain})`;\nconst loneTilde = '(?:~>?)';\nexport const tildeTrim = `(\\\\s*)${loneTilde}\\\\s+`;\nconst loneCaret = '(?:\\\\^)';\nexport const caretTrim = `(\\\\s*)${loneCaret}\\\\s+`;\nexport const star = '(<|>)?=?\\\\s*\\\\*';\nexport const caret = `^${loneCaret}${xRangePlain}$`;\nconst mainVersion = `(${numericIdentifier})\\\\.(${numericIdentifier})\\\\.(${numericIdentifier})`;\nconst fullPlain = `v?${mainVersion}${preRelease}?${build}?`;\nexport const tilde = `^${loneTilde}${xRangePlain}$`;\nexport const xRange = `^${gtlt}\\\\s*${xRangePlain}$`;\nexport const comparator = `^${gtlt}\\\\s*(${fullPlain})$|^$`;\n// copy from semver package\nexport const gte0 = '^\\\\s*>=\\\\s*0.0.0\\\\s*$';\n", "// fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts\n// Copyright (c)\n// vite-plugin-federation is licensed under Mulan PSL v2.\n// You can use this software according to the terms and conditions of the Mulan PSL v2.\n// You may obtain a copy of Mulan PSL v2 at:\n//      http://license.coscl.org.cn/MulanPSL2\n// THIS SOFTWARE IS PROVIDED ON AN \"AS IS\" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.\n// See the Mulan PSL v2 for more details.\n\nimport { comparator } from './constants';\n\nexport function parseRegex(source: string): RegExp {\n  return new RegExp(source);\n}\n\nexport function isXVersion(version: string): boolean {\n  return !version || version.toLowerCase() === 'x' || version === '*';\n}\n\nexport function pipe<TArgs extends any[], R1, R2, R3, R4, R5, R6, R7>(\n  f1: (...args: TArgs) => R1,\n  f2: (a: R1) => R2,\n  f3: (a: R2) => R3,\n  f4: (a: R3) => R4,\n  f5: (a: R4) => R5,\n  f6: (a: R5) => R6,\n  f7: (a: R6) => R7,\n): (...args: TArgs) => R7;\nexport function pipe<TArgs extends any[], R1, R2, R3, R4, R5, R6>(\n  f1: (...args: TArgs) => R1,\n  f2: (a: R1) => R2,\n  f3: (a: R2) => R3,\n  f4: (a: R3) => R4,\n  f5: (a: R4) => R5,\n  f6: (a: R5) => R6,\n): (...args: TArgs) => R6;\nexport function pipe<TArgs extends any[], R1, R2, R3, R4, R5>(\n  f1: (...args: TArgs) => R1,\n  f2: (a: R1) => R2,\n  f3: (a: R2) => R3,\n  f4: (a: R3) => R4,\n  f5: (a: R4) => R5,\n): (...args: TArgs) => R5;\nexport function pipe<TArgs extends any[], R1, R2, R3, R4>(\n  f1: (...args: TArgs) => R1,\n  f2: (a: R1) => R2,\n  f3: (a: R2) => R3,\n  f4: (a: R3) => R4,\n): (...args: TArgs) => R4;\nexport function pipe<TArgs extends any[], R1, R2, R3>(\n  f1: (...args: TArgs) => R1,\n  f2: (a: R1) => R2,\n  f3: (a: R2) => R3,\n): (...args: TArgs) => R3;\nexport function pipe<TArgs extends any[], R1, R2>(\n  f1: (...args: TArgs) => R1,\n  f2: (a: R1) => R2,\n): (...args: TArgs) => R2;\nexport function pipe<TArgs extends any[], R1>(\n  f1: (...args: TArgs) => R1,\n): (...args: TArgs) => R1;\nexport function pipe(...fns: ((params: any) => any)[]) {\n  return (x: unknown): any => fns.reduce((v, f) => f(v), x);\n}\n\nexport function extractComparator(\n  comparatorString: string,\n): RegExpMatchArray | null {\n  return comparatorString.match(parseRegex(comparator));\n}\n\nexport function combineVersion(\n  major: string,\n  minor: string,\n  patch: string,\n  preRelease: string,\n): string {\n  const mainVersion = `${major}.${minor}.${patch}`;\n\n  if (preRelease) {\n    return `${mainVersion}-${preRelease}`;\n  }\n\n  return mainVersion;\n}\n", "// fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts\n// Copyright (c)\n// vite-plugin-federation is licensed under Mulan PSL v2.\n// You can use this software according to the terms and conditions of the Mulan PSL v2.\n// You may obtain a copy of Mulan PSL v2 at:\n//      http://license.coscl.org.cn/MulanPSL2\n// THIS SOFTWARE IS PROVIDED ON AN \"AS IS\" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.\n// See the Mulan PSL v2 for more details.\n\nimport { isXVersion, parseRegex } from './utils';\nimport {\n  caret,\n  caretTrim,\n  comparatorTrim,\n  gte0,\n  hyphenRange,\n  star,\n  tilde,\n  tildeTrim,\n  xRange,\n} from './constants';\n\nexport function parseHyphen(range: string): string {\n  return range.replace(\n    parseRegex(hyphenRange),\n    (\n      _range,\n      from,\n      fromMajor,\n      fromMinor,\n      fromPatch,\n      _fromPreRelease,\n      _fromBuild,\n      to,\n      toMajor,\n      toMinor,\n      toPatch,\n      toPreRelease,\n    ) => {\n      if (isXVersion(fromMajor)) {\n        from = '';\n      } else if (isXVersion(fromMinor)) {\n        from = `>=${fromMajor}.0.0`;\n      } else if (isXVersion(fromPatch)) {\n        from = `>=${fromMajor}.${fromMinor}.0`;\n      } else {\n        from = `>=${from}`;\n      }\n\n      if (isXVersion(toMajor)) {\n        to = '';\n      } else if (isXVersion(toMinor)) {\n        to = `<${Number(toMajor) + 1}.0.0-0`;\n      } else if (isXVersion(toPatch)) {\n        to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;\n      } else if (toPreRelease) {\n        to = `<=${toMajor}.${toMinor}.${toPatch}-${toPreRelease}`;\n      } else {\n        to = `<=${to}`;\n      }\n\n      return `${from} ${to}`.trim();\n    },\n  );\n}\n\nexport function parseComparatorTrim(range: string): string {\n  return range.replace(parseRegex(comparatorTrim), '$1$2$3');\n}\n\nexport function parseTildeTrim(range: string): string {\n  return range.replace(parseRegex(tildeTrim), '$1~');\n}\n\nexport function parseCaretTrim(range: string): string {\n  return range.replace(parseRegex(caretTrim), '$1^');\n}\n\nexport function parseCarets(range: string): string {\n  return range\n    .trim()\n    .split(/\\s+/)\n    .map((rangeVersion) =>\n      rangeVersion.replace(\n        parseRegex(caret),\n        (_, major, minor, patch, preRelease) => {\n          if (isXVersion(major)) {\n            return '';\n          } else if (isXVersion(minor)) {\n            return `>=${major}.0.0 <${Number(major) + 1}.0.0-0`;\n          } else if (isXVersion(patch)) {\n            if (major === '0') {\n              return `>=${major}.${minor}.0 <${major}.${Number(minor) + 1}.0-0`;\n            } else {\n              return `>=${major}.${minor}.0 <${Number(major) + 1}.0.0-0`;\n            }\n          } else if (preRelease) {\n            if (major === '0') {\n              if (minor === '0') {\n                return `>=${major}.${minor}.${patch}-${preRelease} <${major}.${minor}.${\n                  Number(patch) + 1\n                }-0`;\n              } else {\n                return `>=${major}.${minor}.${patch}-${preRelease} <${major}.${\n                  Number(minor) + 1\n                }.0-0`;\n              }\n            } else {\n              return `>=${major}.${minor}.${patch}-${preRelease} <${\n                Number(major) + 1\n              }.0.0-0`;\n            }\n          } else {\n            if (major === '0') {\n              if (minor === '0') {\n                return `>=${major}.${minor}.${patch} <${major}.${minor}.${\n                  Number(patch) + 1\n                }-0`;\n              } else {\n                return `>=${major}.${minor}.${patch} <${major}.${\n                  Number(minor) + 1\n                }.0-0`;\n              }\n            }\n\n            return `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;\n          }\n        },\n      ),\n    )\n    .join(' ');\n}\n\nexport function parseTildes(range: string): string {\n  return range\n    .trim()\n    .split(/\\s+/)\n    .map((rangeVersion) =>\n      rangeVersion.replace(\n        parseRegex(tilde),\n        (_, major, minor, patch, preRelease) => {\n          if (isXVersion(major)) {\n            return '';\n          } else if (isXVersion(minor)) {\n            return `>=${major}.0.0 <${Number(major) + 1}.0.0-0`;\n          } else if (isXVersion(patch)) {\n            return `>=${major}.${minor}.0 <${major}.${Number(minor) + 1}.0-0`;\n          } else if (preRelease) {\n            return `>=${major}.${minor}.${patch}-${preRelease} <${major}.${\n              Number(minor) + 1\n            }.0-0`;\n          }\n\n          return `>=${major}.${minor}.${patch} <${major}.${\n            Number(minor) + 1\n          }.0-0`;\n        },\n      ),\n    )\n    .join(' ');\n}\n\nexport function parseXRanges(range: string): string {\n  return range\n    .split(/\\s+/)\n    .map((rangeVersion) =>\n      rangeVersion\n        .trim()\n        .replace(\n          parseRegex(xRange),\n          (ret, gtlt, major, minor, patch, preRelease) => {\n            const isXMajor = isXVersion(major);\n            const isXMinor = isXMajor || isXVersion(minor);\n            const isXPatch = isXMinor || isXVersion(patch);\n\n            if (gtlt === '=' && isXPatch) {\n              gtlt = '';\n            }\n\n            preRelease = '';\n\n            if (isXMajor) {\n              if (gtlt === '>' || gtlt === '<') {\n                // nothing is allowed\n                return '<0.0.0-0';\n              } else {\n                // nothing is forbidden\n                return '*';\n              }\n            } else if (gtlt && isXPatch) {\n              // replace X with 0\n              if (isXMinor) {\n                minor = 0;\n              }\n\n              patch = 0;\n\n              if (gtlt === '>') {\n                // >1 => >=2.0.0\n                // >1.2 => >=1.3.0\n                gtlt = '>=';\n\n                if (isXMinor) {\n                  major = Number(major) + 1;\n                  minor = 0;\n                  patch = 0;\n                } else {\n                  minor = Number(minor) + 1;\n                  patch = 0;\n                }\n              } else if (gtlt === '<=') {\n                // <=0.7.x is actually <0.8.0, since any 0.7.x should pass\n                // Similarly, <=7.x is actually <8.0.0, etc.\n                gtlt = '<';\n\n                if (isXMinor) {\n                  major = Number(major) + 1;\n                } else {\n                  minor = Number(minor) + 1;\n                }\n              }\n\n              if (gtlt === '<') {\n                preRelease = '-0';\n              }\n\n              return `${gtlt + major}.${minor}.${patch}${preRelease}`;\n            } else if (isXMinor) {\n              return `>=${major}.0.0${preRelease} <${Number(major) + 1}.0.0-0`;\n            } else if (isXPatch) {\n              return `>=${major}.${minor}.0${preRelease} <${major}.${\n                Number(minor) + 1\n              }.0-0`;\n            }\n\n            return ret;\n          },\n        ),\n    )\n    .join(' ');\n}\n\nexport function parseStar(range: string): string {\n  return range.trim().replace(parseRegex(star), '');\n}\n\nexport function parseGTE0(comparatorString: string): string {\n  return comparatorString.trim().replace(parseRegex(gte0), '');\n}\n", "// fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts\n// Copyright (c)\n// vite-plugin-federation is licensed under Mulan PSL v2.\n// You can use this software according to the terms and conditions of the Mulan PSL v2.\n// You may obtain a copy of Mulan PSL v2 at:\n//      http://license.coscl.org.cn/MulanPSL2\n// THIS SOFTWARE IS PROVIDED ON AN \"AS IS\" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.\n// See the Mulan PSL v2 for more details.\n\nexport interface CompareAtom {\n  operator: string;\n  version: string;\n  major: string;\n  minor: string;\n  patch: string;\n  preRelease?: string[];\n}\n\nfunction compareAtom(\n  rangeAtom: string | number,\n  versionAtom: string | number,\n): number {\n  rangeAtom = Number(rangeAtom) || rangeAtom;\n  versionAtom = Number(versionAtom) || versionAtom;\n\n  if (rangeAtom > versionAtom) {\n    return 1;\n  }\n\n  if (rangeAtom === versionAtom) {\n    return 0;\n  }\n\n  return -1;\n}\n\nfunction comparePreRelease(\n  rangeAtom: CompareAtom,\n  versionAtom: CompareAtom,\n): number {\n  const { preRelease: rangePreRelease } = rangeAtom;\n  const { preRelease: versionPreRelease } = versionAtom;\n\n  if (rangePreRelease === undefined && Boolean(versionPreRelease)) {\n    return 1;\n  }\n\n  if (Boolean(rangePreRelease) && versionPreRelease === undefined) {\n    return -1;\n  }\n\n  if (rangePreRelease === undefined && versionPreRelease === undefined) {\n    return 0;\n  }\n\n  for (let i = 0, n = rangePreRelease!.length; i <= n; i++) {\n    const rangeElement = rangePreRelease![i];\n    const versionElement = versionPreRelease![i];\n\n    if (rangeElement === versionElement) {\n      continue;\n    }\n\n    if (rangeElement === undefined && versionElement === undefined) {\n      return 0;\n    }\n\n    if (!rangeElement) {\n      return 1;\n    }\n\n    if (!versionElement) {\n      return -1;\n    }\n\n    return compareAtom(rangeElement, versionElement);\n  }\n\n  return 0;\n}\n\nfunction compareVersion(\n  rangeAtom: CompareAtom,\n  versionAtom: CompareAtom,\n): number {\n  return (\n    compareAtom(rangeAtom.major, versionAtom.major) ||\n    compareAtom(rangeAtom.minor, versionAtom.minor) ||\n    compareAtom(rangeAtom.patch, versionAtom.patch) ||\n    comparePreRelease(rangeAtom, versionAtom)\n  );\n}\n\nfunction eq(rangeAtom: CompareAtom, versionAtom: CompareAtom): boolean {\n  return rangeAtom.version === versionAtom.version;\n}\n\nexport function compare(\n  rangeAtom: CompareAtom,\n  versionAtom: CompareAtom,\n): boolean {\n  switch (rangeAtom.operator) {\n    case '':\n    case '=':\n      return eq(rangeAtom, versionAtom);\n    case '>':\n      return compareVersion(rangeAtom, versionAtom) < 0;\n    case '>=':\n      return (\n        eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) < 0\n      );\n    case '<':\n      return compareVersion(rangeAtom, versionAtom) > 0;\n    case '<=':\n      return (\n        eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) > 0\n      );\n    case undefined: {\n      // mean * or x -> all versions\n      return true;\n    }\n    default:\n      return false;\n  }\n}\n", "// fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts\n// Copyright (c)\n// vite-plugin-federation is licensed under Mulan PSL v2.\n// You can use this software according to the terms and conditions of the Mulan PSL v2.\n// You may obtain a copy of Mulan PSL v2 at:\n//      http://license.coscl.org.cn/MulanPSL2\n// THIS SOFTWARE IS PROVIDED ON AN \"AS IS\" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.\n// See the Mulan PSL v2 for more details.\n\nimport { combineVersion, extractComparator, pipe } from './utils';\nimport {\n  parseHyphen,\n  parseComparatorTrim,\n  parseTildeTrim,\n  parseCaretTrim,\n  parseCarets,\n  parseTildes,\n  parseXRanges,\n  parseStar,\n  parseGTE0,\n} from './parser';\nimport { compare } from './compare';\nimport type { CompareAtom } from './compare';\n\nfunction parseComparatorString(range: string): string {\n  return pipe(\n    // handle caret\n    // ^ --> * (any, kinda silly)\n    // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n    // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n    // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n    // ^1.2.3 --> >=1.2.3 <2.0.0-0\n    // ^1.2.0 --> >=1.2.0 <2.0.0-0\n    parseCarets,\n    // handle tilde\n    // ~, ~> --> * (any, kinda silly)\n    // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n    // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n    // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n    // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n    // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n    parseTildes,\n    parseXRanges,\n    parseStar,\n  )(range);\n}\n\nfunction parseRange(range: string) {\n  return pipe(\n    // handle hyphenRange\n    // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n    parseHyphen,\n    // handle trim comparator\n    // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n    parseComparatorTrim,\n    // handle trim tilde\n    // `~ 1.2.3` => `~1.2.3`\n    parseTildeTrim,\n    // handle trim caret\n    // `^ 1.2.3` => `^1.2.3`\n    parseCaretTrim,\n  )(range.trim())\n    .split(/\\s+/)\n    .join(' ');\n}\n\nexport function satisfy(version: string, range: string): boolean {\n  if (!version) {\n    return false;\n  }\n\n  // Extract version details once\n  const extractedVersion = extractComparator(version);\n  if (!extractedVersion) {\n    // If the version string is invalid, it can't satisfy any range\n    return false;\n  }\n  const [\n    ,\n    versionOperator,\n    ,\n    versionMajor,\n    versionMinor,\n    versionPatch,\n    versionPreRelease,\n  ] = extractedVersion;\n  const versionAtom: CompareAtom = {\n    operator: versionOperator,\n    version: combineVersion(\n      versionMajor,\n      versionMinor,\n      versionPatch,\n      versionPreRelease,\n    ), // exclude build atom\n    major: versionMajor,\n    minor: versionMinor,\n    patch: versionPatch,\n    preRelease: versionPreRelease?.split('.'),\n  };\n\n  // Split the range by || to handle OR conditions\n  const orRanges = range.split('||');\n\n  for (const orRange of orRanges) {\n    const trimmedOrRange = orRange.trim();\n    if (!trimmedOrRange) {\n      // An empty range string signifies wildcard *, satisfy any valid version\n      // (We already checked if the version itself is valid)\n      return true;\n    }\n\n    // Handle simple wildcards explicitly before complex parsing\n    if (trimmedOrRange === '*' || trimmedOrRange === 'x') {\n      return true;\n    }\n\n    try {\n      // Apply existing parsing logic to the current OR sub-range\n      const parsedSubRange = parseRange(trimmedOrRange); // Handles hyphens, trims etc.\n\n      // Check if the result of initial parsing is empty, which can happen\n      // for some wildcard cases handled by parseRange/parseComparatorString.\n      // E.g. `parseStar` used in `parseComparatorString` returns ''.\n      if (!parsedSubRange.trim()) {\n        // If parsing results in empty string, treat as wildcard match\n        return true;\n      }\n\n      const parsedComparatorString = parsedSubRange\n        .split(' ')\n        .map((rangeVersion) => parseComparatorString(rangeVersion)) // Expands ^, ~\n        .join(' ');\n\n      // Check again if the comparator string became empty after specific parsing like ^ or ~\n      if (!parsedComparatorString.trim()) {\n        return true;\n      }\n\n      // Split the sub-range by space for implicit AND conditions\n      const comparators = parsedComparatorString\n        .split(/\\s+/)\n        .map((comparator) => parseGTE0(comparator))\n        // Filter out empty strings that might result from multiple spaces\n        .filter(Boolean);\n\n      // If a sub-range becomes empty after parsing (e.g., invalid characters),\n      // it cannot be satisfied. This check might be redundant now but kept for safety.\n      if (comparators.length === 0) {\n        continue;\n      }\n\n      let subRangeSatisfied = true;\n      for (const comparator of comparators) {\n        const extractedComparator = extractComparator(comparator);\n\n        // If any part of the AND sub-range is invalid, the sub-range is not satisfied\n        if (!extractedComparator) {\n          subRangeSatisfied = false;\n          break;\n        }\n\n        const [\n          ,\n          rangeOperator,\n          ,\n          rangeMajor,\n          rangeMinor,\n          rangePatch,\n          rangePreRelease,\n        ] = extractedComparator;\n        const rangeAtom: CompareAtom = {\n          operator: rangeOperator,\n          version: combineVersion(\n            rangeMajor,\n            rangeMinor,\n            rangePatch,\n            rangePreRelease,\n          ),\n          major: rangeMajor,\n          minor: rangeMinor,\n          patch: rangePatch,\n          preRelease: rangePreRelease?.split('.'),\n        };\n\n        // Check if the version satisfies this specific comparator in the AND chain\n        if (!compare(rangeAtom, versionAtom)) {\n          subRangeSatisfied = false; // This part of the AND condition failed\n          break; // No need to check further comparators in this sub-range\n        }\n      }\n\n      // If all AND conditions within this OR sub-range were met, the overall range is satisfied\n      if (subRangeSatisfied) {\n        return true;\n      }\n    } catch (e) {\n      // Log error and treat this sub-range as unsatisfied\n      console.error(\n        `[semver] Error processing range part \"${trimmedOrRange}\":`,\n        e,\n      );\n      continue;\n    }\n  }\n\n  // If none of the OR sub-ranges were satisfied\n  return false;\n}\n\nexport function isLegallyVersion(version: string): boolean {\n  const semverRegex =\n    /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$/;\n  return semverRegex.test(version);\n}\n", "export const DEFAULT_SCOPE = 'default';\nexport const DEFAULT_REMOTE_TYPE = 'global';\n", "import { DEFAULT_SCOPE } from '../constant';\nimport { TreeShakingStatus } from '@module-federation/sdk';\nimport { Global, Federation } from '../global';\nimport {\n  GlobalShareScopeMap,\n  Shared,\n  ShareArgs,\n  ShareInfos,\n  ShareScopeMap,\n  LoadShareExtraOptions,\n  UserOptions,\n  Options,\n  ShareStrategy,\n  TreeShakingArgs,\n  SharedGetter,\n  SharedLoadContext,\n} from '../type';\nimport { warn, error } from './logger';\nimport { satisfy } from './semver';\nimport { SyncWaterfallHook } from './hooks';\nimport { addUniqueItem, arrayOptions } from './tool';\n\nfunction formatShare(\n  shareArgs: ShareArgs,\n  from: string,\n  name: string,\n  shareStrategy?: ShareStrategy,\n): Shared {\n  let get: Shared['get'];\n  if ('get' in shareArgs) {\n    // eslint-disable-next-line prefer-destructuring\n    get = shareArgs.get;\n  } else if ('lib' in shareArgs) {\n    get = () => Promise.resolve(shareArgs.lib);\n  } else {\n    get = () =>\n      Promise.resolve(() => {\n        error(\n          `Cannot get shared \"${name}\" from \"${from}\": neither \"get\" nor \"lib\" is provided in the share config.`,\n        );\n      });\n  }\n\n  if (shareArgs.shareConfig?.eager && shareArgs.treeShaking?.mode) {\n    error(\n      `Invalid shared config for \"${name}\" from \"${from}\": cannot use both \"eager: true\" and \"treeShaking.mode\" simultaneously. Choose one strategy.`,\n    );\n  }\n\n  return {\n    deps: [],\n    useIn: [],\n    from,\n    loading: null,\n    ...shareArgs,\n    shareConfig: {\n      requiredVersion: `^${shareArgs.version}`,\n      singleton: false,\n      eager: false,\n      strictVersion: false,\n      ...shareArgs.shareConfig,\n    },\n    get,\n    loaded: shareArgs?.loaded || 'lib' in shareArgs ? true : undefined,\n    version: shareArgs.version ?? '0',\n    scope: Array.isArray(shareArgs.scope)\n      ? shareArgs.scope\n      : [shareArgs.scope ?? 'default'],\n    strategy: (shareArgs.strategy ?? shareStrategy) || 'version-first',\n    treeShaking: shareArgs.treeShaking\n      ? {\n          ...shareArgs.treeShaking,\n          mode: shareArgs.treeShaking.mode ?? 'server-calc',\n          status: shareArgs.treeShaking.status ?? TreeShakingStatus.UNKNOWN,\n          useIn: [],\n        }\n      : undefined,\n  };\n}\n\nexport function formatShareConfigs(\n  prevOptions: Options,\n  newOptions: UserOptions,\n) {\n  const shareArgs = newOptions.shared || {};\n  const from = newOptions.name;\n\n  const newShareInfos = Object.keys(shareArgs).reduce((res, pkgName) => {\n    const arrayShareArgs = arrayOptions(shareArgs[pkgName]);\n    res[pkgName] = res[pkgName] || [];\n    arrayShareArgs.forEach((shareConfig) => {\n      res[pkgName].push(\n        formatShare(shareConfig, from, pkgName, newOptions.shareStrategy),\n      );\n    });\n    return res;\n  }, {} as ShareInfos);\n\n  const allShareInfos = {\n    ...prevOptions.shared,\n  };\n\n  Object.keys(newShareInfos).forEach((shareKey) => {\n    if (!allShareInfos[shareKey]) {\n      allShareInfos[shareKey] = newShareInfos[shareKey];\n    } else {\n      newShareInfos[shareKey].forEach((newUserSharedOptions) => {\n        const isSameVersion = allShareInfos[shareKey].find(\n          (sharedVal) => sharedVal.version === newUserSharedOptions.version,\n        );\n        if (!isSameVersion) {\n          allShareInfos[shareKey].push(newUserSharedOptions);\n        }\n      });\n    }\n  });\n  return { allShareInfos, newShareInfos };\n}\n\nexport function shouldUseTreeShaking(\n  treeShaking?: TreeShakingArgs,\n  usedExports?: string[],\n) {\n  if (!treeShaking) {\n    return false;\n  }\n  const { status, mode } = treeShaking;\n  if (status === TreeShakingStatus.NO_USE) {\n    return false;\n  }\n\n  if (status === TreeShakingStatus.CALCULATED) {\n    return true;\n  }\n\n  if (mode === 'runtime-infer') {\n    if (!usedExports) {\n      return true;\n    }\n    return isMatchUsedExports(treeShaking, usedExports);\n  }\n\n  return false;\n}\n\n/**\n * compare version a and b, return true if a is less than b\n */\nexport function versionLt(a: string, b: string): boolean {\n  const transformInvalidVersion = (version: string) => {\n    const isNumberVersion = !Number.isNaN(Number(version));\n    if (isNumberVersion) {\n      const splitArr = version.split('.');\n      let validVersion = version;\n      for (let i = 0; i < 3 - splitArr.length; i++) {\n        validVersion += '.0';\n      }\n      return validVersion;\n    }\n    return version;\n  };\n  if (satisfy(transformInvalidVersion(a), `<=${transformInvalidVersion(b)}`)) {\n    return true;\n  } else {\n    return false;\n  }\n}\n\nexport const findVersion = (\n  shareVersionMap: ShareScopeMap[string][string],\n  cb?: (prev: string, cur: string) => boolean,\n): string => {\n  const callback =\n    cb ||\n    function (prev: string, cur: string): boolean {\n      return versionLt(prev, cur);\n    };\n\n  return Object.keys(shareVersionMap).reduce((prev: number | string, cur) => {\n    if (!prev) {\n      return cur;\n    }\n    if (callback(prev as string, cur)) {\n      return cur;\n    }\n\n    // default version is '0' https://github.com/webpack/webpack/blob/main/lib/sharing/ProvideSharedModule.js#L136\n    if (prev === '0') {\n      return cur;\n    }\n\n    return prev;\n  }, 0) as string;\n};\n\nexport const isLoaded = (shared: {\n  loading?: null | Promise<any>;\n  loaded?: boolean;\n  lib?: () => unknown;\n}) => {\n  return Boolean(shared.loaded) || typeof shared.lib === 'function';\n};\n\nconst isLoading = (shared: {\n  loading?: null | Promise<any>;\n  loaded?: boolean;\n  lib?: () => unknown;\n}) => {\n  return Boolean(shared.loading);\n};\n\nconst isMatchUsedExports = (\n  treeShaking?: TreeShakingArgs,\n  usedExports?: string[],\n) => {\n  if (!treeShaking || !usedExports) {\n    return false;\n  }\n\n  const { usedExports: treeShakingUsedExports } = treeShaking;\n\n  if (!treeShakingUsedExports) {\n    return false;\n  }\n\n  if (usedExports.every((e) => treeShakingUsedExports.includes(e))) {\n    return true;\n  }\n\n  return false;\n};\n\nfunction findSingletonVersionOrderByVersion(\n  shareScopeMap: ShareScopeMap,\n  scope: string,\n  pkgName: string,\n  treeShaking?: TreeShakingArgs,\n): {\n  version: string;\n  useTreesShaking: boolean;\n} {\n  const versions = shareScopeMap[scope][pkgName];\n  let version = '';\n  let useTreesShaking = shouldUseTreeShaking(treeShaking);\n  // return false means use prev version\n  const callback = function (prev: string, cur: string): boolean {\n    if (useTreesShaking) {\n      if (!versions[prev].treeShaking) {\n        return true;\n      }\n      if (!versions[cur].treeShaking) {\n        return false;\n      }\n      return !isLoaded(versions[prev].treeShaking) && versionLt(prev, cur);\n    }\n    return !isLoaded(versions[prev]) && versionLt(prev, cur);\n  };\n\n  if (useTreesShaking) {\n    version = findVersion(shareScopeMap[scope][pkgName], callback);\n    if (version) {\n      return {\n        version,\n        useTreesShaking,\n      };\n    }\n    useTreesShaking = false;\n  }\n\n  return {\n    version: findVersion(shareScopeMap[scope][pkgName], callback),\n    useTreesShaking,\n  };\n}\n\nconst isLoadingOrLoaded = (shared: {\n  loading?: null | Promise<any>;\n  loaded?: boolean;\n  lib?: () => unknown;\n}) => {\n  return isLoaded(shared) || isLoading(shared);\n};\n\nfunction findSingletonVersionOrderByLoaded(\n  shareScopeMap: ShareScopeMap,\n  scope: string,\n  pkgName: string,\n  treeShaking?: TreeShakingArgs,\n): {\n  version: string;\n  useTreesShaking: boolean;\n} {\n  const versions = shareScopeMap[scope][pkgName];\n  let version = '';\n  let useTreesShaking = shouldUseTreeShaking(treeShaking);\n\n  // return false means use prev version\n  const callback = function (prev: string, cur: string): boolean {\n    if (useTreesShaking) {\n      if (!versions[prev].treeShaking) {\n        return true;\n      }\n      if (!versions[cur].treeShaking) {\n        return false;\n      }\n      if (isLoadingOrLoaded(versions[cur].treeShaking)) {\n        if (isLoadingOrLoaded(versions[prev].treeShaking)) {\n          return Boolean(versionLt(prev, cur));\n        } else {\n          return true;\n        }\n      }\n      if (isLoadingOrLoaded(versions[prev].treeShaking)) {\n        return false;\n      }\n    }\n\n    if (isLoadingOrLoaded(versions[cur])) {\n      if (isLoadingOrLoaded(versions[prev])) {\n        return Boolean(versionLt(prev, cur));\n      } else {\n        return true;\n      }\n    }\n    if (isLoadingOrLoaded(versions[prev])) {\n      return false;\n    }\n    return versionLt(prev, cur);\n  };\n\n  if (useTreesShaking) {\n    version = findVersion(shareScopeMap[scope][pkgName], callback);\n    if (version) {\n      return {\n        version,\n        useTreesShaking,\n      };\n    }\n    useTreesShaking = false;\n  }\n\n  return {\n    version: findVersion(shareScopeMap[scope][pkgName], callback),\n    useTreesShaking,\n  };\n}\n\nfunction getFindShareFunction(strategy: Shared['strategy']) {\n  if (strategy === 'loaded-first') {\n    return findSingletonVersionOrderByLoaded;\n  }\n  return findSingletonVersionOrderByVersion;\n}\n\nexport function getRegisteredShare(\n  localShareScopeMap: ShareScopeMap,\n  pkgName: string,\n  shareInfo: Shared,\n  resolveShare: SyncWaterfallHook<{\n    shareScopeMap: ShareScopeMap;\n    scope: string;\n    pkgName: string;\n    version: string;\n    shareInfo: Shared;\n    GlobalFederation: Federation;\n    resolver: () => { shared: Shared; useTreesShaking: boolean } | undefined;\n    loadContext?: SharedLoadContext;\n  }>,\n  loadContext?: SharedLoadContext,\n): { shared: Shared; useTreesShaking: boolean } | void {\n  if (!localShareScopeMap) {\n    return;\n  }\n  const {\n    shareConfig,\n    scope = DEFAULT_SCOPE,\n    strategy,\n    treeShaking,\n  } = shareInfo;\n  const scopes = Array.isArray(scope) ? scope : [scope];\n\n  for (const sc of scopes) {\n    if (\n      shareConfig &&\n      localShareScopeMap[sc] &&\n      localShareScopeMap[sc][pkgName]\n    ) {\n      const { requiredVersion } = shareConfig;\n      const findShareFunction = getFindShareFunction(strategy);\n      const { version: maxOrSingletonVersion, useTreesShaking } =\n        findShareFunction(localShareScopeMap, sc, pkgName, treeShaking);\n\n      const defaultResolver = () => {\n        const shared = localShareScopeMap[sc][pkgName][maxOrSingletonVersion];\n        if (shareConfig.singleton) {\n          if (\n            typeof requiredVersion === 'string' &&\n            !satisfy(maxOrSingletonVersion, requiredVersion)\n          ) {\n            const msg = `Version ${maxOrSingletonVersion} from ${\n              maxOrSingletonVersion && shared.from\n            } of shared singleton module ${pkgName} does not satisfy the requirement of ${\n              shareInfo.from\n            } which needs ${requiredVersion})`;\n\n            if (shareConfig.strictVersion) {\n              error(msg);\n            } else {\n              warn(msg);\n            }\n          }\n          return {\n            shared,\n            useTreesShaking,\n          };\n        } else {\n          if (requiredVersion === false || requiredVersion === '*') {\n            return {\n              shared,\n              useTreesShaking,\n            };\n          }\n          if (satisfy(maxOrSingletonVersion, requiredVersion)) {\n            return {\n              shared,\n              useTreesShaking,\n            };\n          }\n\n          const _usedTreeShaking = shouldUseTreeShaking(treeShaking);\n          if (_usedTreeShaking) {\n            for (const [versionKey, versionValue] of Object.entries(\n              localShareScopeMap[sc][pkgName],\n            )) {\n              if (\n                !shouldUseTreeShaking(\n                  versionValue.treeShaking,\n                  treeShaking?.usedExports,\n                )\n              ) {\n                continue;\n              }\n\n              if (satisfy(versionKey, requiredVersion)) {\n                return {\n                  shared: versionValue,\n                  useTreesShaking: _usedTreeShaking,\n                };\n              }\n            }\n          }\n          for (const [versionKey, versionValue] of Object.entries(\n            localShareScopeMap[sc][pkgName],\n          )) {\n            if (satisfy(versionKey, requiredVersion)) {\n              return {\n                shared: versionValue,\n                useTreesShaking: false,\n              };\n            }\n          }\n        }\n        return;\n      };\n      const params = {\n        shareScopeMap: localShareScopeMap,\n        scope: sc,\n        pkgName,\n        version: maxOrSingletonVersion,\n        GlobalFederation: Global.__FEDERATION__,\n        shareInfo,\n        resolver: defaultResolver,\n        loadContext,\n      };\n      const resolveShared = resolveShare.emit(params) || params;\n      return resolveShared.resolver();\n    }\n  }\n}\n\nexport function getGlobalShareScope(): GlobalShareScopeMap {\n  return Global.__FEDERATION__.__SHARE__;\n}\n\nexport function getTargetSharedOptions(options: {\n  pkgName: string;\n  extraOptions?: LoadShareExtraOptions;\n  shareInfos: ShareInfos;\n}) {\n  const { pkgName, extraOptions, shareInfos } = options;\n  const defaultResolver = (sharedOptions: ShareInfos[string]) => {\n    if (!sharedOptions) {\n      return undefined;\n    }\n    const shareVersionMap: ShareScopeMap[string][string] = {};\n    sharedOptions.forEach((shared) => {\n      shareVersionMap[shared.version] = shared;\n    });\n    const callback = function (prev: string, cur: string): boolean {\n      return (\n        // TODO: consider multiple treeShaking shared scenes\n        !isLoaded(shareVersionMap[prev]) && versionLt(prev, cur)\n      );\n    };\n\n    const maxVersion = findVersion(shareVersionMap, callback);\n    return shareVersionMap[maxVersion];\n  };\n\n  const resolver = extraOptions?.resolver ?? defaultResolver;\n  const isPlainObject = (val: unknown): val is Record<string, any> => {\n    return val !== null && typeof val === 'object' && !Array.isArray(val);\n  };\n\n  const merge = <T extends Record<string, any>>(\n    ...sources: Array<Partial<T> | undefined>\n  ): T => {\n    const out = {} as T;\n    for (const src of sources) {\n      if (!src) continue;\n      for (const [key, value] of Object.entries(src)) {\n        const prev = (out as any)[key];\n        if (isPlainObject(prev) && isPlainObject(value)) {\n          (out as any)[key] = merge(prev, value);\n        } else if (value !== undefined) {\n          (out as any)[key] = value;\n        }\n      }\n    }\n    return out;\n  };\n\n  return merge(resolver(shareInfos[pkgName]), extraOptions?.customShareInfo);\n}\n\nexport const addUseIn = (\n  shared: { useIn?: Array<string> },\n  from: string,\n): void => {\n  if (!shared.useIn) {\n    shared.useIn = [];\n  }\n  addUniqueItem(shared.useIn, from);\n};\n\nexport function directShare(\n  shared: Shared,\n  useTreesShaking?: boolean,\n): Shared | TreeShakingArgs {\n  if (useTreesShaking && shared.treeShaking) {\n    return shared.treeShaking;\n  }\n\n  return shared;\n}\n", "import { Remote } from '../type';\n\nexport function composeRemoteRequestId(\n  remoteName: string,\n  expose?: string,\n): string {\n  if (!expose || expose === '.') {\n    return remoteName;\n  }\n\n  return `${remoteName}/${expose.replace(/^\\.\\//, '')}`;\n}\n\n// Function to match a remote with its name and expose\n// id: pkgName(@federation/app1) + expose(button) = @federation/app1/button\n// id: alias(app1) + expose(button) = app1/button\n// id: alias(app1/utils) + expose(loadash/sort) = app1/utils/loadash/sort\nexport function matchRemoteWithNameAndExpose(\n  remotes: Array<Remote>,\n  id: string,\n):\n  | {\n      pkgNameOrAlias: string;\n      expose: string;\n      remote: Remote;\n    }\n  | undefined {\n  for (const remote of remotes) {\n    // match pkgName\n    const isNameMatched = id.startsWith(remote.name);\n    let expose = id.replace(remote.name, '');\n    if (isNameMatched) {\n      if (expose.startsWith('/')) {\n        const pkgNameOrAlias = remote.name;\n        expose = `.${expose}`;\n        return {\n          pkgNameOrAlias,\n          expose,\n          remote,\n        };\n      } else if (expose === '') {\n        return {\n          pkgNameOrAlias: remote.name,\n          expose: '.',\n          remote,\n        };\n      }\n    }\n\n    // match alias\n    const isAliasMatched = remote.alias && id.startsWith(remote.alias);\n    let exposeWithAlias = remote.alias && id.replace(remote.alias, '');\n    if (remote.alias && isAliasMatched) {\n      if (exposeWithAlias && exposeWithAlias.startsWith('/')) {\n        const pkgNameOrAlias = remote.alias;\n        exposeWithAlias = `.${exposeWithAlias}`;\n        return {\n          pkgNameOrAlias,\n          expose: exposeWithAlias,\n          remote,\n        };\n      } else if (exposeWithAlias === '') {\n        return {\n          pkgNameOrAlias: remote.alias,\n          expose: '.',\n          remote,\n        };\n      }\n    }\n  }\n\n  return;\n}\n\n// Function to match a remote with its name or alias\nexport function matchRemote(\n  remotes: Array<Remote>,\n  nameOrAlias: string,\n): Remote | undefined {\n  for (const remote of remotes) {\n    const isNameMatched = nameOrAlias === remote.name;\n    if (isNameMatched) {\n      return remote;\n    }\n\n    const isAliasMatched = remote.alias && nameOrAlias === remote.alias;\n    if (isAliasMatched) {\n      return remote;\n    }\n  }\n  return;\n}\n", "export const RUNTIME_001 = 'RUNTIME-001';\nexport const RUNTIME_002 = 'RUNTIME-002';\nexport const RUNTIME_003 = 'RUNTIME-003';\nexport const RUNTIME_004 = 'RUNTIME-004';\nexport const RUNTIME_005 = 'RUNTIME-005';\nexport const RUNTIME_006 = 'RUNTIME-006';\nexport const RUNTIME_007 = 'RUNTIME-007';\nexport const RUNTIME_008 = 'RUNTIME-008';\nexport const RUNTIME_009 = 'RUNTIME-009';\nexport const RUNTIME_010 = 'RUNTIME-010';\nexport const RUNTIME_011 = 'RUNTIME-011';\nexport const RUNTIME_012 = 'RUNTIME-012';\nexport const RUNTIME_013 = 'RUNTIME-013';\nexport const RUNTIME_014 = 'RUNTIME-014';\nexport const RUNTIME_015 = 'RUNTIME-015';\n\nexport const TYPE_001 = 'TYPE-001';\nexport const BUILD_001 = 'BUILD-001';\nexport const BUILD_002 = 'BUILD-002';\n", "import {\n  RUNTIME_001,\n  RUNTIME_002,\n  RUNTIME_003,\n  RUNTIME_004,\n  RUNTIME_005,\n  RUNTIME_006,\n  RUNTIME_007,\n  RUNTIME_008,\n  RUNTIME_009,\n  RUNTIME_010,\n  RUNTIME_011,\n  RUNTIME_012,\n  RUNTIME_013,\n  RUNTIME_014,\n  RUNTIME_015,\n  TYPE_001,\n  BUILD_001,\n  BUILD_002,\n} from './error-codes';\n\nexport const runtimeDescMap = {\n  [RUNTIME_001]: 'Failed to get remoteEntry exports.',\n  [RUNTIME_002]: 'The remote entry interface does not contain \"init\"',\n  [RUNTIME_003]: 'Failed to get manifest.',\n  [RUNTIME_004]: 'Failed to locate remote.',\n  [RUNTIME_005]: 'Invalid loadShareSync function call from bundler runtime',\n  [RUNTIME_006]: 'Invalid loadShareSync function call from runtime',\n  [RUNTIME_007]: 'Failed to get remote snapshot.',\n  [RUNTIME_008]: 'Failed to load script resources.',\n  [RUNTIME_009]: 'Please call createInstance first.',\n  [RUNTIME_010]:\n    'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use \"createInstance\" api.',\n  [RUNTIME_011]: 'The remoteEntry URL is missing from the remote snapshot.',\n  [RUNTIME_012]:\n    '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.',\n  [RUNTIME_013]: 'The manifest is not a valid Module Federation manifest.',\n  [RUNTIME_014]: 'The remote does not expose the requested module.',\n  [RUNTIME_015]: 'Remote container initialization failed.',\n};\n\nexport const typeDescMap = {\n  [TYPE_001]:\n    'Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.',\n};\n\nexport const buildDescMap = {\n  [BUILD_001]: 'Failed to find expose module.',\n  [BUILD_002]: 'PublicPath is required in prod mode.',\n};\n\nexport const errorDescMap = {\n  ...runtimeDescMap,\n  ...typeDescMap,\n  ...buildDescMap,\n};\n", "import {\n  loadScript,\n  loadScriptNode,\n  composeKeyWithSeparator,\n  isBrowserEnvValue,\n} from '@module-federation/sdk';\nimport { DEFAULT_REMOTE_TYPE, DEFAULT_SCOPE } from '../constant';\nimport { ModuleFederation } from '../core';\nimport { globalLoading, getRemoteEntryExports } from '../global';\nimport {\n  Remote,\n  RemoteEntryExports,\n  RemoteInfo,\n  ResourceLoadContext,\n} from '../type';\nimport { assert, error } from './logger';\nimport {\n  RUNTIME_001,\n  RUNTIME_008,\n  runtimeDescMap,\n} from '@module-federation/error-codes';\n\n// Declare the ENV_TARGET constant that will be defined by DefinePlugin\ndeclare const ENV_TARGET: 'web' | 'node';\nconst importCallback = '.then(callbacks[0]).catch(callbacks[1])';\nconst remoteEntryLoadingOrigins = new WeakMap<\n  Promise<RemoteEntryExports | void>,\n  ModuleFederation\n>();\n\nconst esmRemoteEntryLoadErrorMessages = [\n  'Failed to fetch dynamically imported module',\n  'Importing a module script failed',\n  'error loading dynamically imported module',\n];\n\nfunction isEsmRemoteEntryLoadError(err: unknown): boolean {\n  if (!(err instanceof TypeError)) {\n    return false;\n  }\n\n  return esmRemoteEntryLoadErrorMessages.some((loadErrorMessage) =>\n    err.message.includes(loadErrorMessage),\n  );\n}\n\nexport function isEsmRemoteType(type: RemoteInfo['type']): boolean {\n  return type === 'esm' || type === 'module';\n}\n\nasync function loadEsmEntry({\n  entry,\n  remoteEntryExports,\n  name,\n  getEntryUrl,\n}: {\n  entry: string;\n  remoteEntryExports: RemoteEntryExports | undefined;\n  name: string;\n  getEntryUrl?: (url: string) => string;\n}): Promise<RemoteEntryExports> {\n  return new Promise<RemoteEntryExports>((resolve, reject) => {\n    const rejectEntry = (loadError: unknown) => {\n      if (isEsmRemoteEntryLoadError(loadError)) {\n        const originalMsg =\n          loadError instanceof Error ? loadError.message : String(loadError);\n        try {\n          error(\n            RUNTIME_008,\n            runtimeDescMap,\n            {\n              remoteName: name,\n              resourceUrl: url,\n            },\n            originalMsg,\n          );\n        } catch (runtimeError) {\n          reject(runtimeError);\n          return;\n        }\n      }\n\n      reject(loadError);\n    };\n\n    const url = getEntryUrl ? getEntryUrl(entry) : entry;\n    try {\n      if (!remoteEntryExports) {\n        if (typeof FEDERATION_ALLOW_NEW_FUNCTION !== 'undefined') {\n          new Function('callbacks', `import(\"${url}\")${importCallback}`)([\n            resolve,\n            rejectEntry,\n          ]);\n        } else {\n          import(/* webpackIgnore: true */ /* @vite-ignore */ url)\n            .then(resolve)\n            .catch(rejectEntry);\n        }\n      } else {\n        resolve(remoteEntryExports);\n      }\n    } catch (e) {\n      const msg = e instanceof Error ? e.message : String(e);\n      error(`Failed to load ESM entry from \"${url}\". ${msg}`);\n    }\n  });\n}\n\nasync function loadSystemJsEntry({\n  entry,\n  remoteEntryExports,\n}: {\n  entry: string;\n  remoteEntryExports: RemoteEntryExports | undefined;\n}): Promise<RemoteEntryExports> {\n  return new Promise<RemoteEntryExports>((resolve, reject) => {\n    try {\n      if (!remoteEntryExports) {\n        //@ts-ignore\n        if (typeof __system_context__ === 'undefined') {\n          //@ts-ignore\n          System.import(entry).then(resolve).catch(reject);\n        } else {\n          new Function(\n            'callbacks',\n            `System.import(\"${entry}\")${importCallback}`,\n          )([resolve, reject]);\n        }\n      } else {\n        resolve(remoteEntryExports);\n      }\n    } catch (e) {\n      const msg = e instanceof Error ? e.message : String(e);\n      error(`Failed to load SystemJS entry from \"${entry}\". ${msg}`);\n    }\n  });\n}\n\nfunction handleRemoteEntryLoaded(\n  name: string,\n  globalName: string,\n  entry: string,\n): RemoteEntryExports {\n  const { remoteEntryKey, entryExports } = getRemoteEntryExports(\n    name,\n    globalName,\n  );\n\n  if (!entryExports) {\n    error(RUNTIME_001, runtimeDescMap, {\n      remoteName: name,\n      remoteEntryUrl: entry,\n      remoteEntryKey,\n    });\n  }\n\n  return entryExports;\n}\n\nasync function loadEntryScript({\n  name,\n  globalName,\n  entry,\n  remoteInfo,\n  loaderHook,\n  getEntryUrl,\n  resourceContext,\n}: {\n  name: string;\n  globalName: string;\n  entry: string;\n  remoteInfo: RemoteInfo;\n  loaderHook: ModuleFederation['loaderHook'];\n  getEntryUrl?: (url: string) => string;\n  resourceContext?: ResourceLoadContext;\n}): Promise<RemoteEntryExports> {\n  const { entryExports: remoteEntryExports } = getRemoteEntryExports(\n    name,\n    globalName,\n  );\n\n  if (remoteEntryExports) {\n    return remoteEntryExports;\n  }\n\n  // if getEntryUrl is passed, use the getEntryUrl to get the entry url\n  const url = getEntryUrl ? getEntryUrl(entry) : entry;\n  return loadScript(url, {\n    attrs: {},\n    createScriptHook: (url, attrs) => {\n      const res = loaderHook.lifecycle.createScript.emit({\n        url,\n        attrs,\n        remoteInfo,\n        resourceContext: resourceContext\n          ? {\n              ...resourceContext,\n              url,\n            }\n          : undefined,\n      });\n\n      if (!res) return;\n\n      if (res instanceof HTMLScriptElement) {\n        return res;\n      }\n\n      if ('script' in res || 'timeout' in res) {\n        return res;\n      }\n\n      return;\n    },\n  }).then(\n    () => {\n      // loadScript resolved: script was fetched, executed without throwing, and\n      // did not trigger a ScriptExecutionError listener. Now verify the global was registered.\n      return handleRemoteEntryLoaded(name, globalName, entry);\n    },\n    (loadError: unknown) => {\n      // loadScript rejected — one of three causes, all with descriptive messages:\n      //   ScriptNetworkError  — URL unreachable, 404, CORS, etc.\n      //   ScriptExecutionError — script fetched OK but IIFE threw during execution\n      //   timeout             — script took too long to load\n      // Errors thrown inside handleRemoteEntryLoaded above are NOT caught here.\n      const originalMsg =\n        loadError instanceof Error ? loadError.message : String(loadError);\n      error(\n        RUNTIME_008,\n        runtimeDescMap,\n        {\n          remoteName: name,\n          resourceUrl: url,\n        },\n        originalMsg,\n      );\n    },\n  );\n}\nasync function loadEntryDom({\n  remoteInfo,\n  remoteEntryExports,\n  loaderHook,\n  getEntryUrl,\n  resourceContext,\n}: {\n  remoteInfo: RemoteInfo;\n  remoteEntryExports?: RemoteEntryExports;\n  loaderHook: ModuleFederation['loaderHook'];\n  getEntryUrl?: (url: string) => string;\n  resourceContext?: ResourceLoadContext;\n}) {\n  const { entry, entryGlobalName: globalName, name, type } = remoteInfo;\n  if (isEsmRemoteType(type)) {\n    return loadEsmEntry({ entry, remoteEntryExports, name, getEntryUrl });\n  }\n\n  if (type === 'system') {\n    return loadSystemJsEntry({ entry, remoteEntryExports });\n  }\n\n  return loadEntryScript({\n    entry,\n    globalName,\n    name,\n    remoteInfo,\n    loaderHook,\n    getEntryUrl,\n    resourceContext,\n  });\n}\n\nasync function loadEntryNode({\n  remoteInfo,\n  loaderHook,\n  resourceContext,\n}: {\n  remoteInfo: RemoteInfo;\n  loaderHook: ModuleFederation['loaderHook'];\n  resourceContext?: ResourceLoadContext;\n}) {\n  const { entry, entryGlobalName: globalName, name, type } = remoteInfo;\n  const { entryExports: remoteEntryExports } = getRemoteEntryExports(\n    name,\n    globalName,\n  );\n\n  if (remoteEntryExports) {\n    return remoteEntryExports;\n  }\n\n  return loadScriptNode(entry, {\n    attrs: { name, globalName, type },\n    loaderHook: {\n      createScriptHook: (url: string, attrs: Record<string, any> = {}) => {\n        const res = loaderHook.lifecycle.createScript.emit({\n          url,\n          attrs,\n          remoteInfo,\n          resourceContext: resourceContext\n            ? {\n                ...resourceContext,\n                url,\n              }\n            : undefined,\n        });\n\n        if (!res) return;\n\n        if ('url' in res) {\n          return res;\n        }\n\n        return;\n      },\n    },\n  })\n    .then(() => {\n      return handleRemoteEntryLoaded(name, globalName, entry);\n    })\n    .catch((e) => {\n      const msg = e instanceof Error ? e.message : String(e);\n      error(\n        `Failed to load Node.js entry for remote \"${name}\" from \"${entry}\". ${msg}`,\n      );\n    });\n}\n\nexport function getRemoteEntryUniqueKey(remoteInfo: RemoteInfo): string {\n  const { entry, name } = remoteInfo;\n  return composeKeyWithSeparator(name, entry);\n}\n\nexport async function getRemoteEntry(params: {\n  origin: ModuleFederation;\n  remoteInfo: RemoteInfo;\n  remoteEntryExports?: RemoteEntryExports | undefined;\n  getEntryUrl?: (url: string) => string;\n  _inErrorHandling?: boolean; // Add flag to prevent recursion\n  resourceContext?: ResourceLoadContext;\n}): Promise<RemoteEntryExports | false | void> {\n  const {\n    origin,\n    remoteEntryExports,\n    remoteInfo,\n    getEntryUrl,\n    resourceContext,\n    _inErrorHandling = false,\n  } = params;\n  const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);\n\n  if (remoteEntryExports) {\n    await origin.loaderHook.lifecycle.afterLoadEntry.emit({\n      origin,\n      remoteInfo,\n      remoteEntryExports,\n      resourceContext,\n      cached: true,\n    });\n    return remoteEntryExports;\n  }\n\n  if (!globalLoading[uniqueKey]) {\n    const loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;\n    const loaderHook = origin.loaderHook;\n    const loading = loadEntryHook\n      .emit({\n        origin,\n        loaderHook,\n        remoteInfo,\n        remoteEntryExports,\n        resourceContext,\n      })\n      .then((res) => {\n        if (res) {\n          return res;\n        }\n        const isWebEnvironment =\n          typeof ENV_TARGET !== 'undefined'\n            ? ENV_TARGET === 'web'\n            : isBrowserEnvValue;\n\n        return isWebEnvironment\n          ? loadEntryDom({\n              remoteInfo,\n              remoteEntryExports,\n              loaderHook,\n              getEntryUrl,\n              resourceContext,\n            })\n          : loadEntryNode({ remoteInfo, loaderHook, resourceContext });\n      })\n      .then(async (res) => {\n        await origin.loaderHook.lifecycle.afterLoadEntry.emit({\n          origin,\n          remoteInfo,\n          remoteEntryExports: res,\n          resourceContext,\n        });\n        return res;\n      })\n      .catch(async (loadError) => {\n        const isScriptExecutionError =\n          loadError instanceof Error &&\n          loadError.message.includes('ScriptExecutionError');\n        const isScriptLoadError =\n          loadError instanceof Error &&\n          loadError.message.includes(RUNTIME_008) &&\n          !isScriptExecutionError;\n\n        if (isScriptLoadError && !_inErrorHandling) {\n          const wrappedGetRemoteEntry = (\n            params: Parameters<typeof getRemoteEntry>[0],\n          ) => {\n            return getRemoteEntry({ ...params, _inErrorHandling: true });\n          };\n\n          const recoveredRemoteEntryExports =\n            await origin.loaderHook.lifecycle.loadEntryError.emit({\n              getRemoteEntry: wrappedGetRemoteEntry,\n              origin,\n              remoteInfo,\n              remoteEntryExports,\n              globalLoading,\n              uniqueKey,\n            });\n\n          if (recoveredRemoteEntryExports) {\n            await origin.loaderHook.lifecycle.afterLoadEntry.emit({\n              origin,\n              remoteInfo,\n              remoteEntryExports: recoveredRemoteEntryExports,\n              resourceContext,\n              error: loadError,\n              recovered: true,\n            });\n            return recoveredRemoteEntryExports;\n          }\n        }\n\n        await origin.loaderHook.lifecycle.afterLoadEntry.emit({\n          origin,\n          remoteInfo,\n          resourceContext,\n          error: loadError,\n        });\n        throw loadError;\n      });\n\n    globalLoading[uniqueKey] = loading;\n    // Clear rejected entries so a later call can retry. Keep the original\n    // promise identity in the cache (do not replace with a cleanup thenable).\n    // Identity check: an older rejection must not delete a newer in-flight request.\n    loading.then(undefined, () => {\n      if (globalLoading[uniqueKey] === loading) {\n        delete globalLoading[uniqueKey];\n      }\n    });\n    remoteEntryLoadingOrigins.set(loading, origin);\n  }\n\n  const remoteEntryLoading = globalLoading[uniqueKey];\n  if (remoteEntryLoadingOrigins.get(remoteEntryLoading) !== origin) {\n    try {\n      const result = await remoteEntryLoading;\n      await origin.loaderHook.lifecycle.afterLoadEntry.emit({\n        origin,\n        remoteInfo,\n        remoteEntryExports: result,\n        resourceContext,\n      });\n      return result;\n    } catch (loadError) {\n      await origin.loaderHook.lifecycle.afterLoadEntry.emit({\n        origin,\n        remoteInfo,\n        resourceContext,\n        error: loadError,\n      });\n      throw loadError;\n    }\n  }\n\n  return remoteEntryLoading;\n}\n\nexport function getRemoteInfo(remote: Remote): RemoteInfo {\n  return {\n    ...remote,\n    entry: 'entry' in remote ? remote.entry : '',\n    type: remote.type || DEFAULT_REMOTE_TYPE,\n    entryGlobalName: remote.entryGlobalName || remote.name,\n    shareScope: remote.shareScope || DEFAULT_SCOPE,\n  };\n}\n", "export {\n  isBrowserEnv,\n  isBrowserEnvValue,\n  isDebugMode,\n} from '@module-federation/sdk';\n\nexport function isDevelopmentMode(): boolean {\n  return true;\n}\n\nexport function getBuilderId(): string {\n  //@ts-ignore\n  return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined'\n    ? //@ts-ignore\n      FEDERATION_BUILD_IDENTIFIER\n    : '';\n}\n", "import { ModuleFederation } from '../core';\nimport {\n  ModuleFederationRuntimePlugin,\n  RuntimePluginHooks,\n  UserOptions,\n} from '../type';\nimport { getGlobalHostPlugins } from '../global';\nimport { assert } from './logger';\nimport { isPlainObject } from './tool';\n\nfunction getPluginsToRegister(\n  plugins: UserOptions['plugins'],\n): Array<ModuleFederationRuntimePlugin> {\n  const pluginsByName = new Map<string, ModuleFederationRuntimePlugin>();\n\n  [...(plugins || []), ...getGlobalHostPlugins()].forEach((plugin) => {\n    if (!plugin) {\n      return;\n    }\n\n    assert(isPlainObject(plugin), 'Plugin configuration is invalid.');\n    assert(plugin.name, 'A name must be provided by the plugin.');\n\n    if (!pluginsByName.has(plugin.name)) {\n      pluginsByName.set(plugin.name, plugin);\n    }\n  });\n\n  return Array.from(pluginsByName.values());\n}\n\nfunction getInstancePlugin(\n  plugin: ModuleFederationRuntimePlugin,\n  instanceHooks: void | RuntimePluginHooks,\n): ModuleFederationRuntimePlugin {\n  if (instanceHooks === undefined) {\n    return plugin;\n  }\n\n  return {\n    ...instanceHooks,\n    name: plugin.name,\n    version: plugin.version,\n  };\n}\n\nexport function registerPlugins(\n  plugins: UserOptions['plugins'],\n  instance: ModuleFederation,\n) {\n  const registeredPlugins = new Map<string, ModuleFederationRuntimePlugin>();\n  instance.options.plugins.forEach((plugin) => {\n    if (plugin) {\n      registeredPlugins.set(plugin.name, plugin);\n    }\n  });\n  const hookInstances = [\n    instance.hooks,\n    instance.remoteHandler.hooks,\n    instance.sharedHandler.hooks,\n    instance.snapshotHandler.hooks,\n    instance.loaderHook,\n    instance.bridgeHook,\n  ];\n\n  getPluginsToRegister(plugins).forEach((plugin) => {\n    registeredPlugins.set(plugin.name, plugin);\n\n    if (instance.hooks.registerPlugins[plugin.name]) {\n      return;\n    }\n\n    const instancePlugin = getInstancePlugin(plugin, plugin.apply?.(instance));\n    hookInstances.forEach((hookInstance) => {\n      hookInstance.applyPlugin(instancePlugin);\n    });\n  });\n\n  return Array.from(registeredPlugins.values());\n}\n", "import type { MFContext } from '@module-federation/error-codes';\nimport type { Options, Remote } from '../type';\n\nfunction remoteToEntry(\n  r: Remote,\n): import('@module-federation/error-codes').MFRemoteEntry {\n  return {\n    name: r.name,\n    alias: r.alias,\n    entry: 'entry' in r ? (r as { entry: string }).entry : undefined,\n    version: 'version' in r ? (r as { version: string }).version : undefined,\n    type: r.type,\n    entryGlobalName: r.entryGlobalName,\n    shareScope: r.shareScope,\n  };\n}\n\n/**\n * Build a partial MFContext from runtime Options.\n * Used to enrich diagnostic entries with host context at error sites.\n */\nexport function optionsToMFContext(options: Options): Partial<MFContext> {\n  const shared: MFContext['mfConfig'] extends undefined\n    ? never\n    : NonNullable<MFContext['mfConfig']>['shared'] = {};\n\n  for (const [pkgName, versions] of Object.entries(options.shared)) {\n    const first = versions[0];\n    if (first) {\n      shared[pkgName] = {\n        version: first.version,\n        singleton: first.shareConfig?.singleton,\n        requiredVersion:\n          first.shareConfig?.requiredVersion === false\n            ? false\n            : first.shareConfig?.requiredVersion,\n        eager: first.eager,\n        strictVersion: first.shareConfig?.strictVersion,\n      };\n    }\n  }\n\n  return {\n    project: {\n      name: options.name,\n      mfRole: options.remotes?.length > 0 ? 'host' : 'unknown',\n    },\n    mfConfig: {\n      name: options.name,\n      remotes: options.remotes?.map(remoteToEntry) ?? [],\n      shared,\n    },\n  };\n}\n", "import { createLink, createScript, safeToString } from '@module-federation/sdk';\nimport {\n  PreloadAssets,\n  PreloadAssetResult,\n  PreloadConfig,\n  PreloadOptions,\n  PreloadRemoteArgs,\n  Remote,\n  RemoteInfo,\n  ResourceLoadContext,\n  ResourceLoadType,\n  depsPreloadArg,\n} from '../type';\nimport { matchRemote } from './manifest';\nimport { assert } from './logger';\nimport { ModuleFederation } from '../core';\nimport { getRemoteEntry, isEsmRemoteType } from './load';\nimport { getPreloadedAsset, setPreloadedAsset } from '../global';\n\nexport function defaultPreloadArgs(\n  preloadConfig: PreloadRemoteArgs | depsPreloadArg,\n): PreloadConfig {\n  return {\n    resourceCategory: 'sync',\n    share: true,\n    depsRemote: true,\n    recordPreloadedAssets: true,\n    ...preloadConfig,\n  } as PreloadConfig;\n}\n\nexport function formatPreloadArgs(\n  remotes: Array<Remote>,\n  preloadArgs: Array<PreloadRemoteArgs>,\n): PreloadOptions {\n  return preloadArgs.map((args) => {\n    const remoteInfo = matchRemote(remotes, args.nameOrAlias);\n    assert(\n      remoteInfo,\n      `Unable to preload ${args.nameOrAlias} as it is not included in ${\n        !remoteInfo &&\n        safeToString({\n          remoteInfo,\n          remotes,\n        })\n      }`,\n    );\n    return {\n      remote: remoteInfo,\n      preloadConfig: defaultPreloadArgs(args),\n    };\n  });\n}\n\nexport function normalizePreloadExposes(exposes?: string[]): string[] {\n  if (!exposes) {\n    return [];\n  }\n\n  return exposes.map((expose) => {\n    if (expose === '.') {\n      return expose;\n    }\n    if (expose.startsWith('./')) {\n      return expose.replace('./', '');\n    }\n    return expose;\n  });\n}\n\nfunction isTimeoutError(error: unknown): boolean {\n  if (!(error instanceof Error)) {\n    return false;\n  }\n  return error.message.includes('timed out') || error.name.includes('Timeout');\n}\n\nfunction createAssetResult(\n  context: ResourceLoadContext,\n  url: string,\n  status: PreloadAssetResult['status'],\n  error?: unknown,\n): PreloadAssetResult {\n  return {\n    url,\n    status,\n    resourceType: context.resourceType,\n    initiator: context.initiator,\n    id: context.id,\n    error,\n  };\n}\n\nfunction preloadAssetOnce(\n  context: ResourceLoadContext,\n  url: string,\n  recordPreloadedAssets: boolean,\n  preload: () => Promise<PreloadAssetResult>,\n): Promise<PreloadAssetResult> {\n  if (!recordPreloadedAssets) {\n    return preload();\n  }\n\n  if (getPreloadedAsset(url)) {\n    return Promise.resolve(createAssetResult(context, url, 'cached'));\n  }\n\n  setPreloadedAsset(url);\n  return preload();\n}\n\nasync function waitForRemoteEntryPreload(\n  host: ModuleFederation,\n  remoteInfo: RemoteInfo,\n  entryRemoteInfo: RemoteInfo,\n  context: ResourceLoadContext,\n): Promise<PreloadAssetResult> {\n  const cachedRemote = host.moduleCache.get(entryRemoteInfo.name);\n  const url = entryRemoteInfo.entry;\n  if (cachedRemote?.remoteEntryExports) {\n    return createAssetResult(context, url, 'cached');\n  }\n\n  try {\n    const remoteEntryExports = await getRemoteEntry({\n      origin: host,\n      remoteInfo: entryRemoteInfo,\n      remoteEntryExports: cachedRemote?.remoteEntryExports,\n      resourceContext: {\n        ...context,\n        url,\n      },\n    });\n    if (!remoteEntryExports) {\n      throw new Error(`Failed to load remoteEntry \"${url}\".`);\n    }\n    return createAssetResult(context, url, 'success');\n  } catch (error) {\n    return createAssetResult(\n      context,\n      url,\n      isTimeoutError(error) ? 'timeout' : 'error',\n      error,\n    );\n  }\n}\n\nfunction waitForLinkPreload({\n  host,\n  remoteInfo,\n  url,\n  attrs,\n  context,\n  needDeleteLink,\n}: {\n  host: ModuleFederation;\n  remoteInfo: RemoteInfo;\n  url: string;\n  attrs: Record<string, string>;\n  context: ResourceLoadContext;\n  needDeleteLink?: boolean;\n}): Promise<PreloadAssetResult> {\n  return new Promise((resolve) => {\n    const { link, needAttach } = createLink({\n      url,\n      cb: () => {\n        resolve(\n          createAssetResult(context, url, needAttach ? 'success' : 'cached'),\n        );\n      },\n      onErrorCallback: (error) => {\n        resolve(\n          createAssetResult(\n            context,\n            url,\n            isTimeoutError(error) ? 'timeout' : 'error',\n            error,\n          ),\n        );\n      },\n      attrs,\n      createLinkHook: (hookUrl, hookAttrs) => {\n        const res = host.loaderHook.lifecycle.createLink.emit({\n          url: hookUrl,\n          attrs: hookAttrs,\n          remoteInfo,\n          resourceContext: {\n            ...context,\n            url: hookUrl,\n          },\n        });\n        if (res instanceof HTMLLinkElement) {\n          return res;\n        }\n        return res;\n      },\n      needDeleteLink,\n    });\n\n    needAttach && document.head.appendChild(link);\n  });\n}\n\nfunction waitForScriptPreload({\n  host,\n  remoteInfo,\n  url,\n  attrs,\n  context,\n}: {\n  host: ModuleFederation;\n  remoteInfo: RemoteInfo;\n  url: string;\n  attrs: Record<string, string>;\n  context: ResourceLoadContext;\n}): Promise<PreloadAssetResult> {\n  return new Promise((resolve) => {\n    const { script, needAttach } = createScript({\n      url,\n      cb: () => {\n        resolve(\n          createAssetResult(context, url, needAttach ? 'success' : 'cached'),\n        );\n      },\n      onErrorCallback: (error) => {\n        resolve(\n          createAssetResult(\n            context,\n            url,\n            isTimeoutError(error) ? 'timeout' : 'error',\n            error,\n          ),\n        );\n      },\n      attrs,\n      createScriptHook: (hookUrl: string, hookAttrs: any) => {\n        const res = host.loaderHook.lifecycle.createScript.emit({\n          url: hookUrl,\n          attrs: hookAttrs,\n          remoteInfo,\n          resourceContext: {\n            ...context,\n            url: hookUrl,\n          },\n        });\n        if (res instanceof HTMLScriptElement) {\n          return res;\n        }\n        return res;\n      },\n      needDeleteScript: true,\n    });\n\n    needAttach && document.head.appendChild(script);\n  });\n}\n\nfunction createResourceContext(\n  baseContext: Omit<ResourceLoadContext, 'resourceType'>,\n  resourceType: ResourceLoadType,\n): ResourceLoadContext {\n  return {\n    ...baseContext,\n    resourceType,\n  };\n}\n\nexport function preloadAssets(\n  remoteInfo: RemoteInfo,\n  host: ModuleFederation,\n  assets: PreloadAssets,\n  // It is used to distinguish preload from load remote parallel loading\n  useLinkPreload = true,\n  baseContext: Omit<ResourceLoadContext, 'resourceType'> = {\n    initiator: 'preloadRemote',\n    id: remoteInfo.name,\n  },\n  recordPreloadedAssets = true,\n): Promise<PreloadAssetResult[]> {\n  const { cssAssets, jsAssetsWithoutEntry, entryAssets } = assets;\n  const results: Array<Promise<PreloadAssetResult>> = [];\n\n  if (host.options.inBrowser) {\n    entryAssets.forEach((asset) => {\n      const { moduleInfo: entryRemoteInfo } = asset;\n      results.push(\n        waitForRemoteEntryPreload(\n          host,\n          remoteInfo,\n          entryRemoteInfo,\n          createResourceContext(baseContext, 'remoteEntry'),\n        ),\n      );\n    });\n\n    if (useLinkPreload) {\n      const defaultAttrs = {\n        rel: 'preload',\n        as: 'style',\n      };\n      cssAssets.forEach((cssUrl) => {\n        const context = createResourceContext(baseContext, 'css');\n        results.push(\n          preloadAssetOnce(context, cssUrl, recordPreloadedAssets, () =>\n            waitForLinkPreload({\n              host,\n              remoteInfo,\n              url: cssUrl,\n              attrs: defaultAttrs,\n              context,\n            }),\n          ),\n        );\n      });\n    } else {\n      const defaultAttrs = {\n        rel: 'stylesheet',\n        type: 'text/css',\n      };\n      cssAssets.forEach((cssUrl) => {\n        const context = createResourceContext(baseContext, 'css');\n        results.push(\n          preloadAssetOnce(context, cssUrl, recordPreloadedAssets, () =>\n            waitForLinkPreload({\n              host,\n              remoteInfo,\n              url: cssUrl,\n              attrs: defaultAttrs,\n              needDeleteLink: false,\n              context,\n            }),\n          ),\n        );\n      });\n    }\n\n    let preloadJsAsset = waitForScriptPreload;\n    let defaultAttrs: Record<string, string> = {\n      fetchpriority: 'high',\n      type: 'text/javascript',\n    };\n\n    if (useLinkPreload) {\n      preloadJsAsset = waitForLinkPreload;\n      defaultAttrs = {\n        rel: 'preload',\n        as: 'script',\n      };\n    } else if (isEsmRemoteType(remoteInfo.type)) {\n      preloadJsAsset = waitForLinkPreload;\n      defaultAttrs = {\n        rel: 'modulepreload',\n        fetchpriority: 'high',\n      };\n    }\n\n    jsAssetsWithoutEntry.forEach((jsUrl) => {\n      const context = createResourceContext(baseContext, 'js');\n      results.push(\n        preloadAssetOnce(context, jsUrl, recordPreloadedAssets, () =>\n          preloadJsAsset({\n            host,\n            remoteInfo,\n            url: jsUrl,\n            attrs: defaultAttrs,\n            context,\n          }),\n        ),\n      );\n    });\n  }\n\n  return Promise.all(results);\n}\n", "import {\n  assert,\n  error,\n  processModuleAlias,\n  optionsToMFContext,\n  composeRemoteRequestId,\n} from '../utils';\nimport { safeToString, ModuleInfo } from '@module-federation/sdk';\nimport {\n  RUNTIME_002,\n  RUNTIME_014,\n  RUNTIME_015,\n  runtimeDescMap,\n} from '@module-federation/error-codes';\nimport { getRemoteEntry } from '../utils/load';\nimport { ModuleFederation } from '../core';\nimport {\n  RemoteEntryExports,\n  RemoteInfo,\n  InitScope,\n  ShareScopeMap,\n  ResourceLoadContext,\n} from '../type';\n\nexport type ModuleOptions = ConstructorParameters<typeof Module>[0];\nexport type RemoteModuleFactory = () => unknown | Promise<unknown>;\n\nfunction getAvailableExposeNames(\n  remoteSnapshot?: ModuleInfo,\n): string | undefined {\n  if (\n    !remoteSnapshot ||\n    !('modules' in remoteSnapshot) ||\n    !Array.isArray(remoteSnapshot.modules)\n  ) {\n    return undefined;\n  }\n\n  const exposes = remoteSnapshot.modules\n    .map((module) => module.moduleName)\n    .filter(Boolean);\n\n  return exposes.length ? exposes.join(',') : undefined;\n}\n\nexport function createRemoteEntryInitOptions(\n  remoteInfo: RemoteInfo,\n  hostShareScopeMap: ShareScopeMap,\n  rawInitScope?: InitScope,\n): Record<string, any> {\n  const localShareScopeMap = hostShareScopeMap;\n\n  const shareScopeKeys = Array.isArray(remoteInfo.shareScope)\n    ? remoteInfo.shareScope\n    : [remoteInfo.shareScope];\n\n  if (!shareScopeKeys.length) {\n    shareScopeKeys.push('default');\n  }\n  shareScopeKeys.forEach((shareScopeKey) => {\n    if (!localShareScopeMap[shareScopeKey]) {\n      localShareScopeMap[shareScopeKey] = {};\n    }\n  });\n\n  const remoteEntryInitOptions = {\n    version: remoteInfo.version || '',\n    shareScopeKeys: Array.isArray(remoteInfo.shareScope)\n      ? shareScopeKeys\n      : remoteInfo.shareScope || 'default',\n  };\n\n  // Help to find host instance\n  Object.defineProperty(remoteEntryInitOptions, 'shareScopeMap', {\n    value: localShareScopeMap,\n    // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed\n    enumerable: false,\n  });\n\n  // TODO: compate legacy init params, should use shareScopeMap if exist\n  const shareScope = localShareScopeMap[shareScopeKeys[0]];\n  const initScope: InitScope = rawInitScope ?? [];\n\n  return {\n    remoteEntryInitOptions,\n    shareScope,\n    initScope,\n  };\n}\n\nclass Module {\n  remoteInfo: RemoteInfo;\n  inited = false;\n  initing = false;\n  initPromise?: Promise<void>;\n  remoteEntryExports?: RemoteEntryExports;\n  lib: RemoteEntryExports | undefined = undefined;\n  host: ModuleFederation;\n\n  constructor({\n    remoteInfo,\n    host,\n  }: {\n    remoteInfo: RemoteInfo;\n    host: ModuleFederation;\n  }) {\n    this.remoteInfo = remoteInfo;\n    this.host = host;\n  }\n\n  async getEntry(\n    expose?: string,\n    resourceContext?: ResourceLoadContext,\n  ): Promise<RemoteEntryExports> {\n    const effectiveResourceContext = resourceContext || {\n      initiator: 'loadRemote',\n      id: composeRemoteRequestId(this.remoteInfo.name, expose),\n      resourceType: 'remoteEntry' as const,\n      url: this.remoteInfo.entry,\n      expose,\n    };\n    const remoteEntryExports = await getRemoteEntry({\n      origin: this.host,\n      remoteInfo: this.remoteInfo,\n      remoteEntryExports: this.remoteEntryExports,\n      resourceContext: effectiveResourceContext,\n    });\n\n    assert(\n      remoteEntryExports,\n      `remoteEntryExports is undefined \\n ${safeToString(this.remoteInfo)}`,\n    );\n\n    this.remoteEntryExports = remoteEntryExports;\n    return this.remoteEntryExports;\n  }\n\n  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\n  async init(\n    id?: string,\n    remoteSnapshot?: ModuleInfo,\n    rawInitScope?: InitScope,\n    expose?: string,\n    resourceContext?: ResourceLoadContext,\n  ) {\n    // Get remoteEntry.js\n    const remoteEntryExports = await this.getEntry(expose, resourceContext);\n\n    if (this.inited) {\n      await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n        id,\n        remoteInfo: this.remoteInfo,\n        remoteSnapshot,\n        remoteEntryExports,\n        cached: true,\n        origin: this.host,\n      });\n      return remoteEntryExports;\n    }\n\n    if (this.initPromise) {\n      try {\n        await this.initPromise;\n        await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n          id,\n          remoteInfo: this.remoteInfo,\n          remoteSnapshot,\n          remoteEntryExports,\n          cached: true,\n          origin: this.host,\n        });\n      } catch (initError) {\n        await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n          id,\n          remoteInfo: this.remoteInfo,\n          remoteSnapshot,\n          remoteEntryExports,\n          error: initError,\n          cached: true,\n          origin: this.host,\n        });\n        throw initError;\n      }\n      return remoteEntryExports;\n    }\n\n    this.initing = true;\n    this.initPromise = (async () => {\n      await this.host.loaderHook.lifecycle.beforeInitRemote.emit({\n        id,\n        remoteInfo: this.remoteInfo,\n        remoteSnapshot,\n        origin: this.host,\n      });\n\n      const { remoteEntryInitOptions, shareScope, initScope } =\n        createRemoteEntryInitOptions(\n          this.remoteInfo,\n          this.host.shareScopeMap,\n          rawInitScope,\n        );\n\n      const initContainerOptions =\n        await this.host.hooks.lifecycle.beforeInitContainer.emit({\n          shareScope,\n          // @ts-ignore shareScopeMap will be set by Object.defineProperty\n          remoteEntryInitOptions,\n          initScope,\n          remoteInfo: this.remoteInfo,\n          origin: this.host,\n        });\n\n      if (typeof remoteEntryExports?.init === 'undefined') {\n        error(\n          RUNTIME_002,\n          runtimeDescMap,\n          {\n            hostName: this.host.name,\n            remoteName: this.remoteInfo.name,\n            remoteEntryUrl: this.remoteInfo.entry,\n            remoteEntryKey: this.remoteInfo.entryGlobalName,\n          },\n          undefined,\n          optionsToMFContext(this.host.options),\n        );\n      }\n\n      try {\n        await remoteEntryExports.init(\n          initContainerOptions.shareScope,\n          initContainerOptions.initScope,\n          initContainerOptions.remoteEntryInitOptions,\n        );\n      } catch (initError) {\n        error(\n          RUNTIME_015,\n          runtimeDescMap,\n          {\n            hostName: this.host.name,\n            remoteName: this.remoteInfo.name,\n            remoteEntryUrl: this.remoteInfo.entry,\n            remoteEntryKey: this.remoteInfo.entryGlobalName,\n            shareScope: this.remoteInfo.shareScope,\n          },\n          `${initError}`,\n          optionsToMFContext(this.host.options),\n        );\n      }\n\n      await this.host.hooks.lifecycle.initContainer.emit({\n        ...initContainerOptions,\n        id,\n        remoteSnapshot,\n        remoteEntryExports,\n      });\n      this.inited = true;\n    })();\n\n    try {\n      await this.initPromise;\n      await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n        id,\n        remoteInfo: this.remoteInfo,\n        remoteSnapshot,\n        remoteEntryExports,\n        origin: this.host,\n      });\n    } catch (initError) {\n      await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n        id,\n        remoteInfo: this.remoteInfo,\n        remoteSnapshot,\n        remoteEntryExports,\n        error: initError,\n        origin: this.host,\n      });\n      throw initError;\n    } finally {\n      this.initing = false;\n      this.initPromise = undefined;\n    }\n\n    return remoteEntryExports;\n  }\n\n  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n  async get(\n    id: string,\n    expose: string,\n    options?: { loadFactory?: boolean },\n    remoteSnapshot?: ModuleInfo,\n  ) {\n    const { loadFactory = true } = options || { loadFactory: true };\n\n    const remoteEntryExports = await this.init(\n      id,\n      remoteSnapshot,\n      undefined,\n      expose,\n    );\n    this.lib = remoteEntryExports;\n\n    await this.host.loaderHook.lifecycle.beforeGetExpose.emit({\n      id,\n      expose,\n      moduleInfo: this.remoteInfo,\n      remoteEntryExports,\n      origin: this.host,\n    });\n\n    let moduleFactory: RemoteModuleFactory | undefined;\n    try {\n      const hookModuleFactory =\n        await this.host.loaderHook.lifecycle.getModuleFactory.emit({\n          remoteEntryExports,\n          expose,\n          moduleInfo: this.remoteInfo,\n        });\n      moduleFactory =\n        typeof hookModuleFactory === 'function' ? hookModuleFactory : undefined;\n\n      // get exposeGetter\n      if (!moduleFactory) {\n        moduleFactory = await remoteEntryExports.get(expose);\n      }\n\n      if (!moduleFactory) {\n        error(\n          RUNTIME_014,\n          runtimeDescMap,\n          {\n            hostName: this.host.name,\n            remoteName: this.remoteInfo.name,\n            remoteEntryUrl: this.remoteInfo.entry,\n            expose,\n            requestId: id,\n            availableExposes: getAvailableExposeNames(remoteSnapshot),\n          },\n          undefined,\n          optionsToMFContext(this.host.options),\n        );\n      }\n\n      await this.host.loaderHook.lifecycle.afterGetExpose.emit({\n        id,\n        expose,\n        moduleInfo: this.remoteInfo,\n        remoteEntryExports,\n        moduleFactory,\n        origin: this.host,\n      });\n    } catch (getExposeError) {\n      await this.host.loaderHook.lifecycle.afterGetExpose.emit({\n        id,\n        expose,\n        moduleInfo: this.remoteInfo,\n        remoteEntryExports,\n        error: getExposeError,\n        origin: this.host,\n      });\n      throw getExposeError;\n    }\n\n    // keep symbol for module name always one format\n    const symbolName = processModuleAlias(this.remoteInfo.name, expose);\n    const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);\n\n    if (!loadFactory) {\n      return wrapModuleFactory;\n    }\n\n    await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({\n      id,\n      expose,\n      moduleInfo: this.remoteInfo,\n      loadFactory,\n      origin: this.host,\n    });\n\n    try {\n      const exposeContent = await wrapModuleFactory();\n\n      await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({\n        id,\n        expose,\n        moduleInfo: this.remoteInfo,\n        loadFactory,\n        exposeModule: exposeContent,\n        origin: this.host,\n      });\n\n      return exposeContent;\n    } catch (executeFactoryError) {\n      await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({\n        id,\n        expose,\n        moduleInfo: this.remoteInfo,\n        loadFactory,\n        error: executeFactoryError,\n        origin: this.host,\n      });\n      throw executeFactoryError;\n    }\n  }\n\n  private wraperFactory(moduleFactory: RemoteModuleFactory, id: string) {\n    function defineModuleId(res: unknown, id: string) {\n      if (\n        res &&\n        typeof res === 'object' &&\n        Object.isExtensible(res) &&\n        !Object.getOwnPropertyDescriptor(res, Symbol.for('mf_module_id'))\n      ) {\n        Object.defineProperty(res, Symbol.for('mf_module_id'), {\n          value: id,\n          enumerable: false,\n        });\n      }\n    }\n\n    return () => {\n      const res = moduleFactory();\n\n      if (res instanceof Promise) {\n        return res.then((asyncRes) => {\n          // This parameter is used for bridge debugging\n          defineModuleId(asyncRes, id);\n          return asyncRes;\n        });\n      }\n\n      // This parameter is used for bridge debugging\n      defineModuleId(res, id);\n      return res;\n    };\n  }\n}\n\nexport { Module };\n", "import { assert, isPlainObject } from '../../utils';\n\nexport type Plugin<T extends Record<string, any>> = {\n  [k in keyof T]?: Parameters<T[k]['on']>[0];\n} & {\n  name: string;\n  version?: string;\n};\n\nexport class PluginSystem<T extends Record<string, any>> {\n  lifecycle: T;\n  lifecycleKeys: Array<keyof T>;\n  registerPlugins: Record<string, Plugin<T>> = {};\n\n  constructor(lifecycle: T) {\n    this.lifecycle = lifecycle;\n    this.lifecycleKeys = Object.keys(lifecycle);\n  }\n\n  applyPlugin(plugin: Plugin<T>): void {\n    assert(isPlainObject(plugin), 'Plugin configuration is invalid.');\n    // The plugin's name is mandatory and must be unique\n    const pluginName = plugin.name;\n    assert(pluginName, 'A name must be provided by the plugin.');\n\n    if (!this.registerPlugins[pluginName]) {\n      this.registerPlugins[pluginName] = plugin;\n\n      this.lifecycleKeys.forEach((key) => {\n        const pluginLife = plugin[key];\n        if (pluginLife) {\n          this.lifecycle[key].on(pluginLife);\n        }\n      });\n    }\n  }\n\n  removePlugin(pluginName: string): void {\n    assert(pluginName, 'A name is required.');\n    const plugin = this.registerPlugins[pluginName];\n    assert(plugin, `The plugin \"${pluginName}\" is not registered.`);\n\n    this.lifecycleKeys.forEach((key) => {\n      const pluginLife = plugin[key];\n      if (pluginLife) {\n        this.lifecycle[key].remove(pluginLife);\n      }\n    });\n    delete this.registerPlugins[pluginName];\n  }\n}\n", "export type Callback<T, K> = (...args: ArgsType<T>) => K;\nexport type ArgsType<T> = T extends Array<any> ? T : Array<any>;\n\nexport class SyncHook<T, K> {\n  type = '';\n  listeners = new Set<Callback<T, K>>();\n\n  constructor(type?: string) {\n    if (type) {\n      this.type = type;\n    }\n  }\n\n  on(fn: Callback<T, K>): void {\n    if (typeof fn === 'function') {\n      this.listeners.add(fn);\n    }\n  }\n\n  once(fn: Callback<T, K>): void {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    const self = this;\n    this.on(function wrapper(...args) {\n      self.remove(wrapper);\n      // eslint-disable-next-line prefer-spread\n      return fn.apply(null, args);\n    });\n  }\n\n  emit(...data: ArgsType<T>): void | K | Promise<any> {\n    let result;\n    if (this.listeners.size > 0) {\n      // eslint-disable-next-line prefer-spread\n      this.listeners.forEach((fn) => {\n        const nextResult = fn(...data);\n        if (nextResult !== undefined) {\n          result = nextResult;\n        }\n      });\n    }\n    return result;\n  }\n\n  remove(fn: Callback<T, K>): void {\n    this.listeners.delete(fn);\n  }\n\n  removeAll(): void {\n    this.listeners.clear();\n  }\n}\n", "import { ArgsType, SyncHook } from './syncHook';\n\ntype CallbackReturnType = void | false | Promise<void | false>;\n\nexport class AsyncHook<\n  T,\n  ExternalEmitReturnType = CallbackReturnType,\n> extends SyncHook<T, ExternalEmitReturnType> {\n  override emit(\n    ...data: ArgsType<T>\n  ): Promise<void | false | ExternalEmitReturnType> {\n    let result;\n    const ls = Array.from(this.listeners);\n    if (ls.length > 0) {\n      let i = 0;\n      const call = (prev?: unknown): unknown => {\n        if (prev === false) {\n          return false; // Abort process\n        } else if (i < ls.length) {\n          return Promise.resolve(ls[i++].apply(null, data)).then((result) => {\n            if (\n              result === undefined ||\n              (data.length === 1 && result === data[0])\n            ) {\n              return call(prev);\n            }\n            return call(result);\n          });\n        } else {\n          return prev;\n        }\n      };\n      result = call();\n    }\n    return Promise.resolve(result) as Promise<\n      void | false | ExternalEmitReturnType\n    >;\n  }\n}\n", "import { error, warn } from '../logger';\nimport { isObject } from '../tool';\nimport { SyncHook } from './syncHook';\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function checkReturnData(originalData: any, returnedData: any): boolean {\n  if (!isObject(returnedData)) {\n    return false;\n  }\n  if (originalData !== returnedData) {\n    // eslint-disable-next-line no-restricted-syntax\n    for (const key in originalData) {\n      if (!(key in returnedData)) {\n        return false;\n      }\n    }\n  }\n  return true;\n}\n\nexport class SyncWaterfallHook<T extends Record<string, any>> extends SyncHook<\n  [T],\n  T | void\n> {\n  onerror: (errMsg: string | Error | unknown) => void = error;\n\n  constructor(type: string) {\n    super();\n    this.type = type;\n  }\n\n  override emit(data: T): T {\n    if (!isObject(data)) {\n      error(`The data for the \"${this.type}\" hook should be an object.`);\n    }\n    for (const fn of this.listeners) {\n      try {\n        const tempData = fn(data);\n        if (tempData === undefined) {\n          continue;\n        }\n        if (checkReturnData(data, tempData)) {\n          data = tempData;\n        } else {\n          this.onerror(\n            `A plugin returned an unacceptable value for the \"${this.type}\" type.`,\n          );\n          break;\n        }\n      } catch (e) {\n        warn(e);\n        this.onerror(e);\n      }\n    }\n    return data;\n  }\n}\n", "import { error, warn } from '../logger';\nimport { isObject } from '../tool';\nimport { SyncHook } from './syncHook';\nimport { checkReturnData } from './syncWaterfallHook';\n\ntype CallbackReturnType<T> = T | void | Promise<T | void>;\n\nexport class AsyncWaterfallHook<T extends object> extends SyncHook<\n  [T],\n  CallbackReturnType<T>\n> {\n  onerror: (errMsg: string | Error | unknown) => void = error;\n  constructor(type: string) {\n    super();\n    this.type = type;\n  }\n\n  override emit(data: T): Promise<T> {\n    if (!isObject(data)) {\n      error(`The response data for the \"${this.type}\" hook must be an object.`);\n    }\n    const ls = Array.from(this.listeners);\n\n    if (ls.length > 0) {\n      let i = 0;\n      const processError = (e: unknown): T => {\n        warn(e);\n        this.onerror(e);\n        return data;\n      };\n\n      const call = (prevData?: T | Awaited<T> | void): T | Promise<T> => {\n        if (prevData !== undefined && checkReturnData(data, prevData)) {\n          data = prevData as T;\n        } else if (prevData !== undefined) {\n          this.onerror(\n            `A plugin returned an incorrect value for the \"${this.type}\" type.`,\n          );\n          return data;\n        }\n        if (i < ls.length) {\n          try {\n            return Promise.resolve(ls[i++](data)).then(call, processError);\n          } catch (e) {\n            return processError(e);\n          }\n        }\n        return data;\n      };\n      return Promise.resolve(call(data));\n    }\n    return Promise.resolve(data);\n  }\n}\n", "import { PluginSystem } from '../utils/hooks';\n\nconst REMOTE_DISABLED_MESSAGE =\n  'Remote loading is disabled by experiments.optimization.disableRemote.';\n\nexport class UnavailableRemoteModule {\n  constructor() {\n    throw new Error(REMOTE_DISABLED_MESSAGE);\n  }\n}\n\nexport class DisabledRemoteHandler {\n  hooks = new PluginSystem({});\n\n  formatAndRegisterRemote() {\n    return [];\n  }\n\n  loadRemote(): never {\n    throw new Error(REMOTE_DISABLED_MESSAGE);\n  }\n\n  preloadRemote(): never {\n    throw new Error(REMOTE_DISABLED_MESSAGE);\n  }\n\n  registerRemotes(): never {\n    throw new Error(REMOTE_DISABLED_MESSAGE);\n  }\n\n  getRemoteModuleAndOptions(): never {\n    throw new Error(REMOTE_DISABLED_MESSAGE);\n  }\n\n  initRawContainer(): never {\n    throw new Error(REMOTE_DISABLED_MESSAGE);\n  }\n}\n", "import {\n  ModuleInfo,\n  getResourceUrl,\n  isBrowserEnvValue,\n} from '@module-federation/sdk';\nimport { ModuleFederationRuntimePlugin } from '../../type/plugin';\nimport { RUNTIME_011, runtimeDescMap } from '@module-federation/error-codes';\nimport {\n  error,\n  composeRemoteRequestId,\n  isPureRemoteEntry,\n  isRemoteInfoWithEntry,\n  getRemoteEntryInfoFromSnapshot,\n} from '../../utils';\nimport { PreloadOptions, PreloadRemoteArgs, RemoteInfo } from '../../type';\nimport { preloadAssets } from '../../utils/preload';\n\nexport function assignRemoteInfo(\n  remoteInfo: RemoteInfo,\n  remoteSnapshot: ModuleInfo,\n): void {\n  const remoteEntryInfo = getRemoteEntryInfoFromSnapshot(remoteSnapshot);\n  if (!remoteEntryInfo.url) {\n    error(RUNTIME_011, runtimeDescMap, { remoteName: remoteInfo.name });\n  }\n\n  let entryUrl = getResourceUrl(remoteSnapshot, remoteEntryInfo.url);\n\n  if (!isBrowserEnvValue && !entryUrl.startsWith('http')) {\n    entryUrl = `https:${entryUrl}`;\n  }\n\n  remoteInfo.type = remoteEntryInfo.type;\n  remoteInfo.entryGlobalName = remoteEntryInfo.globalName;\n  remoteInfo.entry = entryUrl;\n  remoteInfo.version = remoteSnapshot.version;\n  remoteInfo.buildVersion = remoteSnapshot.buildVersion;\n}\n\nexport function snapshotPlugin(): ModuleFederationRuntimePlugin {\n  return {\n    name: 'snapshot-plugin',\n    async afterResolve(args) {\n      const { remote, pkgNameOrAlias, expose, origin, remoteInfo, id } = args;\n\n      if (!isRemoteInfoWithEntry(remote) || !isPureRemoteEntry(remote)) {\n        const { remoteSnapshot, globalSnapshot } =\n          await origin.snapshotHandler.loadRemoteSnapshotInfo({\n            moduleInfo: remote,\n            id: composeRemoteRequestId(remote.name, expose),\n          });\n\n        assignRemoteInfo(remoteInfo, remoteSnapshot);\n        // preloading assets\n        const preloadOps: PreloadRemoteArgs[] = [\n          {\n            nameOrAlias: pkgNameOrAlias,\n            exposes: [expose],\n            resourceCategory: 'sync',\n            share: false,\n            depsRemote: false,\n            recordPreloadedAssets: true,\n          },\n        ];\n        await origin.remoteHandler.hooks.lifecycle.beforePreloadRemote.emit({\n          preloadOps,\n          options: origin.options,\n          origin,\n        });\n\n        const [preloadConfig] = preloadOps;\n        if (preloadConfig) {\n          const preloadOptions: PreloadOptions[0] = {\n            remote,\n            preloadConfig,\n          };\n          const assets =\n            await origin.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit(\n              {\n                origin,\n                preloadOptions,\n                remoteInfo,\n                remote,\n                remoteSnapshot,\n                globalSnapshot,\n              },\n            );\n\n          if (assets) {\n            preloadAssets(\n              remoteInfo,\n              origin,\n              assets,\n              false,\n              {\n                initiator: 'loadRemote',\n                id,\n              },\n              preloadConfig.recordPreloadedAssets,\n            ).catch(() => undefined);\n          }\n        }\n\n        return {\n          ...args,\n          remoteSnapshot,\n        };\n      }\n\n      return args;\n    },\n  };\n}\n", "import {\n  GlobalModuleInfo,\n  ModuleInfo,\n  ProviderModuleInfo,\n  isManifestProvider,\n  getResourceUrl,\n  isBrowserEnvValue,\n} from '@module-federation/sdk';\nimport {\n  EntryAssets,\n  ModuleFederationRuntimePlugin,\n  PreloadAssets,\n  PreloadConfig,\n  PreloadOptions,\n  RemoteInfoOptionalVersion,\n  Shared,\n  Remote,\n} from '../type';\nimport { assignRemoteInfo } from './snapshot';\nimport { getInfoWithoutType, getPreloaded, setPreloaded } from '../global';\nimport { ModuleFederation } from '../core';\nimport { defaultPreloadArgs, normalizePreloadExposes } from '../utils/preload';\nimport { getRegisteredShare } from '../utils/share';\nimport {\n  arrayOptions,\n  getFMId,\n  getRemoteEntryInfoFromSnapshot,\n  isPureRemoteEntry,\n  isRemoteInfoWithEntry,\n} from '../utils';\n\ndeclare global {\n  // eslint-disable-next-line no-var\n  var __INIT_VMOK_DEPLOY_GLOBAL_DATA__: boolean | undefined;\n}\n\n// name\n// name:version\nfunction splitId(id: string): {\n  name: string;\n  version: string | undefined;\n} {\n  const splitInfo = id.split(':');\n  if (splitInfo.length === 1) {\n    return {\n      name: splitInfo[0],\n      version: undefined,\n    };\n  } else if (splitInfo.length === 2) {\n    return {\n      name: splitInfo[0],\n      version: splitInfo[1],\n    };\n  } else {\n    return {\n      name: splitInfo[1],\n      version: splitInfo[2],\n    };\n  }\n}\n\n// Traverse all nodes in moduleInfo and traverse the entire snapshot\nfunction traverseModuleInfo(\n  globalSnapshot: GlobalModuleInfo,\n  remoteInfo: RemoteInfoOptionalVersion,\n  traverse: (\n    snapshotInfo: ModuleInfo,\n    remoteInfo: RemoteInfoOptionalVersion,\n    isRoot: boolean,\n  ) => void,\n  isRoot: boolean,\n  memo: Record<string, boolean> = {},\n  remoteSnapshot?: ModuleInfo,\n): void {\n  const id = getFMId(remoteInfo);\n  const { value: snapshotValue } = getInfoWithoutType(globalSnapshot, id);\n  const effectiveRemoteSnapshot = remoteSnapshot || snapshotValue;\n  if (effectiveRemoteSnapshot && !isManifestProvider(effectiveRemoteSnapshot)) {\n    traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);\n    if (effectiveRemoteSnapshot.remotesInfo) {\n      const remoteKeys = Object.keys(effectiveRemoteSnapshot.remotesInfo);\n      for (const key of remoteKeys) {\n        if (memo[key]) {\n          continue;\n        }\n        memo[key] = true;\n        const subRemoteInfo = splitId(key);\n        const remoteValue = effectiveRemoteSnapshot.remotesInfo[key];\n        traverseModuleInfo(\n          globalSnapshot,\n          {\n            name: subRemoteInfo.name,\n            version: remoteValue.matchedVersion,\n          },\n          traverse,\n          false,\n          memo,\n          undefined,\n        );\n      }\n    }\n  }\n}\n\nconst isExisted = (type: 'link' | 'script', url: string) => {\n  return document.querySelector(\n    `${type}[${type === 'link' ? 'href' : 'src'}=\"${url}\"]`,\n  );\n};\n\n// eslint-disable-next-line max-lines-per-function\nexport function generatePreloadAssets(\n  origin: ModuleFederation,\n  preloadOptions: PreloadOptions[number],\n  remote: RemoteInfoOptionalVersion,\n  globalSnapshot: GlobalModuleInfo,\n  remoteSnapshot: ModuleInfo,\n): PreloadAssets {\n  const cssAssets: Array<string> = [];\n  const jsAssets: Array<string> = [];\n  const entryAssets: Array<EntryAssets> = [];\n  const loadedSharedJsAssets = new Set();\n  const loadedSharedCssAssets = new Set();\n  const { options } = origin;\n\n  const { preloadConfig: rootPreloadConfig } = preloadOptions;\n  const { depsRemote } = rootPreloadConfig;\n  const memo = {};\n  traverseModuleInfo(\n    globalSnapshot,\n    remote,\n    (moduleInfoSnapshot: ModuleInfo, remoteInfo, isRoot) => {\n      let preloadConfig: PreloadConfig;\n      if (isRoot) {\n        preloadConfig = rootPreloadConfig;\n      } else {\n        if (Array.isArray(depsRemote)) {\n          // eslint-disable-next-line array-callback-return\n          const findPreloadConfig = depsRemote.find((remoteConfig) => {\n            if (\n              remoteConfig.nameOrAlias === remoteInfo.name ||\n              remoteConfig.nameOrAlias === remoteInfo.alias\n            ) {\n              return true;\n            }\n            return false;\n          });\n          if (!findPreloadConfig) {\n            return;\n          }\n          preloadConfig = defaultPreloadArgs(findPreloadConfig);\n        } else if (depsRemote === true) {\n          preloadConfig = rootPreloadConfig;\n        } else {\n          return;\n        }\n      }\n\n      const remoteEntryUrl = getResourceUrl(\n        moduleInfoSnapshot,\n        getRemoteEntryInfoFromSnapshot(moduleInfoSnapshot).url,\n      );\n\n      if (remoteEntryUrl) {\n        entryAssets.push({\n          name: remoteInfo.name,\n          moduleInfo: {\n            name: remoteInfo.name,\n            entry: remoteEntryUrl,\n            type:\n              'remoteEntryType' in moduleInfoSnapshot\n                ? moduleInfoSnapshot.remoteEntryType\n                : 'global',\n            entryGlobalName:\n              'globalName' in moduleInfoSnapshot\n                ? moduleInfoSnapshot.globalName\n                : remoteInfo.name,\n            shareScope: '',\n            version:\n              'version' in moduleInfoSnapshot\n                ? moduleInfoSnapshot.version\n                : undefined,\n          },\n          url: remoteEntryUrl,\n        });\n      }\n\n      let moduleAssetsInfo: NonNullable<ProviderModuleInfo['modules']> =\n        'modules' in moduleInfoSnapshot ? moduleInfoSnapshot.modules : [];\n      const normalizedPreloadExposes = normalizePreloadExposes(\n        preloadConfig.exposes,\n      );\n      if (normalizedPreloadExposes.length && 'modules' in moduleInfoSnapshot) {\n        moduleAssetsInfo = moduleInfoSnapshot?.modules?.reduce(\n          (assets, moduleAssetInfo) => {\n            if (\n              normalizedPreloadExposes?.indexOf(moduleAssetInfo.moduleName) !==\n              -1\n            ) {\n              assets.push(moduleAssetInfo);\n            }\n            return assets;\n          },\n          [] as NonNullable<(typeof moduleInfoSnapshot)['modules']>,\n        );\n      }\n\n      function handleAssets(assets: string[]): string[] {\n        const assetsRes = assets.map((asset) =>\n          getResourceUrl(moduleInfoSnapshot, asset),\n        );\n        if (preloadConfig.filter) {\n          return assetsRes.filter(preloadConfig.filter);\n        }\n        return assetsRes;\n      }\n\n      if (moduleAssetsInfo) {\n        const assetsLength = moduleAssetsInfo.length;\n        for (let index = 0; index < assetsLength; index++) {\n          const assetsInfo = moduleAssetsInfo[index];\n          const exposeFullPath = `${remoteInfo.name}/${assetsInfo.moduleName}`;\n          origin.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({\n            id:\n              assetsInfo.moduleName === '.' ? remoteInfo.name : exposeFullPath,\n            name: remoteInfo.name,\n            remoteSnapshot: moduleInfoSnapshot,\n            preloadConfig,\n            remote: remoteInfo as Remote,\n            origin,\n          });\n          const preloaded = getPreloaded(exposeFullPath);\n          if (preloaded) {\n            continue;\n          }\n\n          if (preloadConfig.resourceCategory === 'all') {\n            cssAssets.push(...handleAssets(assetsInfo.assets.css.async));\n            cssAssets.push(...handleAssets(assetsInfo.assets.css.sync));\n            jsAssets.push(...handleAssets(assetsInfo.assets.js.async));\n            jsAssets.push(...handleAssets(assetsInfo.assets.js.sync));\n          } else if (preloadConfig.resourceCategory === 'sync') {\n            cssAssets.push(...handleAssets(assetsInfo.assets.css.sync));\n            jsAssets.push(...handleAssets(assetsInfo.assets.js.sync));\n          }\n\n          setPreloaded(exposeFullPath);\n        }\n      }\n    },\n    true,\n    memo,\n    remoteSnapshot,\n  );\n\n  if (remoteSnapshot.shared && remoteSnapshot.shared.length > 0) {\n    const collectSharedAssets = (\n      shareInfo: Shared,\n      snapshotShared: ModuleInfo['shared'][0],\n    ) => {\n      const { shared: registeredShared } =\n        getRegisteredShare(\n          origin.shareScopeMap,\n          snapshotShared.sharedName,\n          shareInfo,\n          origin.sharedHandler.hooks.lifecycle.resolveShare,\n        ) || {};\n      // If the global share does not exist, or the lib function does not exist, it means that the shared has not been loaded yet and can be preloaded.\n\n      if (registeredShared && typeof registeredShared.lib === 'function') {\n        snapshotShared.assets.js.sync.forEach((asset) => {\n          loadedSharedJsAssets.add(asset);\n        });\n        snapshotShared.assets.css.sync.forEach((asset) => {\n          loadedSharedCssAssets.add(asset);\n        });\n      }\n    };\n    remoteSnapshot.shared.forEach((shared) => {\n      const shareInfos = options.shared?.[shared.sharedName];\n      if (!shareInfos) {\n        return;\n      }\n      // if no version, preload all shared\n      const sharedOptions = shared.version\n        ? shareInfos.find((s) => s.version === shared.version)\n        : shareInfos;\n\n      if (!sharedOptions) {\n        return;\n      }\n      const arrayShareInfo = arrayOptions(sharedOptions);\n      arrayShareInfo.forEach((s) => {\n        collectSharedAssets(s, shared);\n      });\n    });\n  }\n\n  const needPreloadJsAssets = jsAssets.filter(\n    (asset) => !loadedSharedJsAssets.has(asset) && !isExisted('script', asset),\n  );\n  const needPreloadCssAssets = cssAssets.filter(\n    (asset) => !loadedSharedCssAssets.has(asset) && !isExisted('link', asset),\n  );\n\n  return {\n    cssAssets: needPreloadCssAssets,\n    jsAssetsWithoutEntry: needPreloadJsAssets,\n    entryAssets: entryAssets.filter((entry) => !isExisted('script', entry.url)),\n  };\n}\n\nexport const generatePreloadAssetsPlugin: () => ModuleFederationRuntimePlugin =\n  function () {\n    return {\n      name: 'generate-preload-assets-plugin',\n      async generatePreloadAssets(args) {\n        const {\n          origin,\n          preloadOptions,\n          remoteInfo,\n          remote,\n          globalSnapshot,\n          remoteSnapshot,\n        } = args;\n        if (!isBrowserEnvValue) {\n          return {\n            cssAssets: [],\n            jsAssetsWithoutEntry: [],\n            entryAssets: [],\n          };\n        }\n\n        if (isRemoteInfoWithEntry(remote) && isPureRemoteEntry(remote)) {\n          return {\n            cssAssets: [],\n            jsAssetsWithoutEntry: [],\n            entryAssets: [\n              {\n                name: remote.name,\n                url: remote.entry,\n                moduleInfo: {\n                  name: remoteInfo.name,\n                  entry: remote.entry,\n                  type: remoteInfo.type || 'global',\n                  entryGlobalName: '',\n                  shareScope: '',\n                },\n              },\n            ],\n          };\n        }\n\n        assignRemoteInfo(remoteInfo, remoteSnapshot);\n\n        const assets = generatePreloadAssets(\n          origin,\n          preloadOptions,\n          remoteInfo,\n          globalSnapshot,\n          remoteSnapshot,\n        );\n\n        return assets;\n      },\n    };\n  };\n", "import {\n  GlobalModuleInfo,\n  Manifest,\n  ModuleInfo,\n  generateSnapshotFromManifest,\n  isManifestProvider,\n  isBrowserEnvValue,\n} from '@module-federation/sdk';\nimport {\n  RUNTIME_003,\n  RUNTIME_007,\n  RUNTIME_013,\n  runtimeDescMap,\n} from '@module-federation/error-codes';\nimport { Options, Remote, ResourceLoadInitiator } from '../../type';\nimport {\n  isRemoteInfoWithEntry,\n  error,\n  optionsToMFContext,\n  getRemoteInfo,\n} from '../../utils';\nimport {\n  getGlobalSnapshot,\n  setGlobalSnapshotInfoByModuleInfo,\n  Global,\n  addGlobalSnapshot,\n  getGlobalSnapshotInfoByModuleInfo,\n  getInfoWithoutType,\n} from '../../global';\nimport { PluginSystem, AsyncHook, AsyncWaterfallHook } from '../../utils/hooks';\nimport { ModuleFederation } from '../../core';\n\nexport function getGlobalRemoteInfo(\n  moduleInfo: Remote,\n  origin: ModuleFederation,\n): {\n  hostGlobalSnapshot: ModuleInfo | undefined;\n  globalSnapshot: ReturnType<typeof getGlobalSnapshot>;\n  remoteSnapshot: GlobalModuleInfo[string] | undefined;\n} {\n  const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({\n    name: origin.name,\n    version: origin.options.version,\n  });\n\n  // get remote detail info from global\n  const globalRemoteInfo =\n    hostGlobalSnapshot &&\n    'remotesInfo' in hostGlobalSnapshot &&\n    hostGlobalSnapshot.remotesInfo &&\n    getInfoWithoutType(hostGlobalSnapshot.remotesInfo, moduleInfo.name).value;\n\n  if (globalRemoteInfo && globalRemoteInfo.matchedVersion) {\n    return {\n      hostGlobalSnapshot,\n      globalSnapshot: getGlobalSnapshot(),\n      remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({\n        name: moduleInfo.name,\n        version: globalRemoteInfo.matchedVersion,\n      }),\n    };\n  }\n\n  return {\n    hostGlobalSnapshot: undefined,\n    globalSnapshot: getGlobalSnapshot(),\n    remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({\n      name: moduleInfo.name,\n      version: 'version' in moduleInfo ? moduleInfo.version : undefined,\n    }),\n  };\n}\n\nexport class SnapshotHandler {\n  loadingHostSnapshot: Promise<GlobalModuleInfo | void> | null = null;\n  HostInstance: ModuleFederation;\n  manifestCache: Map<string, Manifest> = new Map();\n  hooks = new PluginSystem({\n    beforeLoadRemoteSnapshot: new AsyncHook<\n      [\n        {\n          options: Options;\n          moduleInfo: Remote;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('beforeLoadRemoteSnapshot'),\n    loadSnapshot: new AsyncWaterfallHook<{\n      options: Options;\n      moduleInfo: Remote;\n      hostGlobalSnapshot: GlobalModuleInfo[string] | undefined;\n      globalSnapshot: ReturnType<typeof getGlobalSnapshot>;\n      remoteSnapshot?: GlobalModuleInfo[string] | undefined;\n    }>('loadGlobalSnapshot'),\n    loadRemoteSnapshot: new AsyncWaterfallHook<{\n      options: Options;\n      moduleInfo: Remote;\n      manifestJson?: Manifest;\n      manifestUrl?: string;\n      remoteSnapshot: ModuleInfo;\n      from: 'global' | 'manifest';\n    }>('loadRemoteSnapshot'),\n    afterLoadSnapshot: new AsyncWaterfallHook<{\n      id?: string;\n      host: ModuleFederation;\n      options: Options;\n      moduleInfo: Remote;\n      remoteSnapshot: ModuleInfo;\n    }>('afterLoadSnapshot'),\n    beforeLoadManifest: new AsyncHook<\n      [\n        {\n          manifestUrl: string;\n          moduleInfo: Remote;\n          resourceOptions?: {\n            initiator: ResourceLoadInitiator;\n            id: string;\n          };\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('beforeLoadManifest'),\n    afterLoadManifest: new AsyncHook<\n      [\n        {\n          manifestUrl: string;\n          moduleInfo: Remote;\n          resourceOptions?: {\n            initiator: ResourceLoadInitiator;\n            id: string;\n          };\n          manifestJson?: Manifest;\n          response?: Response;\n          error?: unknown;\n          cached?: boolean;\n          recovered?: boolean;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterLoadManifest'),\n  });\n  loaderHook: ModuleFederation['loaderHook'];\n  manifestLoading: Record<string, Promise<ModuleInfo>> =\n    Global.__FEDERATION__.__MANIFEST_LOADING__;\n\n  constructor(HostInstance: ModuleFederation) {\n    this.HostInstance = HostInstance;\n    this.loaderHook = HostInstance.loaderHook;\n  }\n\n  // eslint-disable-next-line max-lines-per-function\n  async loadRemoteSnapshotInfo({\n    moduleInfo,\n    id,\n    initiator = 'loadRemote',\n  }: {\n    moduleInfo: Remote;\n    id?: string;\n    initiator?: ResourceLoadInitiator;\n  }):\n    | Promise<{\n        remoteSnapshot: ModuleInfo;\n        globalSnapshot: GlobalModuleInfo;\n      }>\n    | never {\n    const { options } = this.HostInstance;\n\n    await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({\n      options,\n      moduleInfo,\n      origin: this.HostInstance,\n    });\n\n    let hostSnapshot = getGlobalSnapshotInfoByModuleInfo({\n      name: this.HostInstance.options.name,\n      version: this.HostInstance.options.version,\n    });\n\n    if (!hostSnapshot) {\n      hostSnapshot = {\n        version: this.HostInstance.options.version || '',\n        remoteEntry: '',\n        remotesInfo: {},\n      };\n      addGlobalSnapshot({\n        [this.HostInstance.options.name]: hostSnapshot,\n      });\n    }\n\n    // In dynamic loadRemote scenarios, incomplete remotesInfo delivery may occur. In such cases, the remotesInfo in the host needs to be completed in the snapshot at runtime.\n    // This ensures the snapshot's integrity and helps the chrome plugin correctly identify all producer modules, ensuring that proxyable producer modules will not be missing.\n    if (\n      hostSnapshot &&\n      'remotesInfo' in hostSnapshot &&\n      !getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name).value\n    ) {\n      if ('version' in moduleInfo || 'entry' in moduleInfo) {\n        hostSnapshot.remotesInfo = {\n          ...hostSnapshot?.remotesInfo,\n          [moduleInfo.name]: {\n            matchedVersion:\n              'version' in moduleInfo ? moduleInfo.version : moduleInfo.entry,\n          },\n        };\n      }\n    }\n\n    const { hostGlobalSnapshot, remoteSnapshot, globalSnapshot } =\n      this.getGlobalRemoteInfo(moduleInfo);\n    const {\n      remoteSnapshot: globalRemoteSnapshot,\n      globalSnapshot: globalSnapshotRes,\n    } = await this.hooks.lifecycle.loadSnapshot.emit({\n      options,\n      moduleInfo,\n      hostGlobalSnapshot,\n      remoteSnapshot,\n      globalSnapshot,\n    });\n\n    let mSnapshot;\n    let gSnapshot;\n    // global snapshot includes manifest or module info includes manifest\n    if (globalRemoteSnapshot) {\n      if (isManifestProvider(globalRemoteSnapshot)) {\n        const remoteEntry = isBrowserEnvValue\n          ? globalRemoteSnapshot.remoteEntry\n          : globalRemoteSnapshot.ssrRemoteEntry ||\n            globalRemoteSnapshot.remoteEntry ||\n            '';\n        const moduleSnapshot = await this.loadManifestSnapshot(\n          remoteEntry,\n          moduleInfo,\n          {},\n          {\n            initiator,\n            id: id || moduleInfo.name,\n          },\n        );\n        // eslint-disable-next-line @typescript-eslint/no-shadow\n        const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(\n          {\n            ...moduleInfo,\n            // The global remote may be overridden\n            // Therefore, set the snapshot key to the global address of the actual request\n            entry: remoteEntry,\n          },\n          moduleSnapshot,\n        );\n        mSnapshot = moduleSnapshot;\n        gSnapshot = globalSnapshotRes;\n      } else {\n        const { remoteSnapshot: remoteSnapshotRes } =\n          await this.hooks.lifecycle.loadRemoteSnapshot.emit({\n            options: this.HostInstance.options,\n            moduleInfo,\n            remoteSnapshot: globalRemoteSnapshot,\n            from: 'global',\n          });\n        mSnapshot = remoteSnapshotRes;\n        gSnapshot = globalSnapshotRes;\n      }\n    } else {\n      if (isRemoteInfoWithEntry(moduleInfo)) {\n        // get from manifest.json and merge remote info from remote server\n        const moduleSnapshot = await this.loadManifestSnapshot(\n          moduleInfo.entry,\n          moduleInfo,\n          {},\n          {\n            initiator,\n            id: id || moduleInfo.name,\n          },\n        );\n        // eslint-disable-next-line @typescript-eslint/no-shadow\n        const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(\n          moduleInfo,\n          moduleSnapshot,\n        );\n        mSnapshot = moduleSnapshot;\n        gSnapshot = globalSnapshotRes;\n      } else {\n        error(\n          RUNTIME_007,\n          runtimeDescMap,\n          {\n            remoteName: moduleInfo.name,\n            remoteVersion: moduleInfo.version,\n            hostName: this.HostInstance.options.name,\n            globalSnapshot: JSON.stringify(globalSnapshotRes),\n          },\n          undefined,\n          optionsToMFContext(this.HostInstance.options),\n        );\n      }\n    }\n\n    await this.hooks.lifecycle.afterLoadSnapshot.emit({\n      id,\n      host: this.HostInstance,\n      options,\n      moduleInfo,\n      remoteSnapshot: mSnapshot,\n    });\n\n    return {\n      remoteSnapshot: mSnapshot,\n      globalSnapshot: gSnapshot,\n    };\n  }\n\n  getGlobalRemoteInfo(moduleInfo: Remote): {\n    hostGlobalSnapshot: ModuleInfo | undefined;\n    globalSnapshot: ReturnType<typeof getGlobalSnapshot>;\n    remoteSnapshot: GlobalModuleInfo[string] | undefined;\n  } {\n    return getGlobalRemoteInfo(moduleInfo, this.HostInstance);\n  }\n\n  private async getManifestJson(\n    manifestUrl: string,\n    moduleInfo: Remote,\n    extraOptions: Record<string, any>,\n    resourceOptions?: {\n      initiator: ResourceLoadInitiator;\n      id: string;\n    },\n  ): Promise<Manifest> {\n    const getManifest = async (): Promise<Manifest> => {\n      const remoteInfo = getRemoteInfo(moduleInfo);\n      let manifestJson: Manifest | undefined =\n        this.manifestCache.get(manifestUrl);\n      if (manifestJson) {\n        await this.hooks.lifecycle.afterLoadManifest.emit({\n          manifestUrl,\n          moduleInfo,\n          resourceOptions,\n          manifestJson,\n          cached: true,\n          origin: this.HostInstance,\n        });\n        return manifestJson;\n      }\n\n      await this.hooks.lifecycle.beforeLoadManifest.emit({\n        manifestUrl,\n        moduleInfo,\n        resourceOptions,\n        origin: this.HostInstance,\n      });\n\n      let response: Response | undefined;\n      let loadError: unknown;\n      let recovered = false;\n\n      try {\n        let res = await this.loaderHook.lifecycle.fetch.emit(\n          manifestUrl,\n          {},\n          remoteInfo,\n          resourceOptions\n            ? {\n                ...resourceOptions,\n                url: manifestUrl,\n                resourceType: 'manifest',\n              }\n            : undefined,\n        );\n        if (!res || !(res instanceof Response)) {\n          res = await fetch(manifestUrl, {});\n        }\n        response = res;\n        manifestJson = (await res.json()) as Manifest;\n      } catch (err) {\n        loadError = err;\n        manifestJson =\n          (await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit(\n            {\n              id: manifestUrl,\n              error: err,\n              from: 'runtime',\n              lifecycle: 'afterResolve',\n              remote: remoteInfo,\n              origin: this.HostInstance,\n            },\n          )) as Manifest | undefined;\n\n        if (!manifestJson) {\n          delete this.manifestLoading[manifestUrl];\n          await this.hooks.lifecycle.afterLoadManifest.emit({\n            manifestUrl,\n            moduleInfo,\n            resourceOptions,\n            response,\n            error: err,\n            origin: this.HostInstance,\n          });\n          error(\n            RUNTIME_003,\n            runtimeDescMap,\n            {\n              manifestUrl,\n              moduleName: moduleInfo.name,\n              hostName: this.HostInstance.options.name,\n            },\n            `${err}`,\n            optionsToMFContext(this.HostInstance.options),\n          );\n        }\n        recovered = true;\n      }\n\n      const missingRequiredFields = [\n        !manifestJson.metaData && 'metaData',\n        !manifestJson.exposes && 'exposes',\n        !manifestJson.shared && 'shared',\n      ].filter(Boolean);\n      const validationError =\n        missingRequiredFields.length > 0\n          ? new Error(\n              `\"${manifestUrl}\" is not a valid federation manifest for remote \"${moduleInfo.name}\". Missing required fields: ${missingRequiredFields.join(', ')}.`,\n            )\n          : undefined;\n      if (validationError) {\n        await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit(\n          {\n            id: manifestUrl,\n            error: validationError,\n            from: 'runtime',\n            lifecycle: 'afterResolve',\n            remote: remoteInfo,\n            origin: this.HostInstance,\n          },\n        );\n      }\n\n      await this.hooks.lifecycle.afterLoadManifest.emit({\n        manifestUrl,\n        moduleInfo,\n        resourceOptions,\n        manifestJson,\n        response,\n        error: validationError || loadError,\n        recovered: validationError ? undefined : recovered || undefined,\n        origin: this.HostInstance,\n      });\n\n      if (validationError) {\n        error(\n          RUNTIME_013,\n          runtimeDescMap,\n          {\n            manifestUrl,\n            moduleName: moduleInfo.name,\n            hostName: this.HostInstance.options.name,\n            missingFields: missingRequiredFields.join(','),\n          },\n          undefined,\n          optionsToMFContext(this.HostInstance.options),\n        );\n      }\n\n      this.manifestCache.set(manifestUrl, manifestJson);\n      return manifestJson;\n    };\n\n    return getManifest();\n  }\n\n  private async loadManifestSnapshot(\n    manifestUrl: string,\n    moduleInfo: Remote,\n    extraOptions: Record<string, any>,\n    resourceOptions?: {\n      initiator: ResourceLoadInitiator;\n      id: string;\n    },\n  ): Promise<ModuleInfo> {\n    const asyncLoadProcess = async () => {\n      const manifestJson = await this.getManifestJson(\n        manifestUrl,\n        moduleInfo,\n        extraOptions,\n        resourceOptions,\n      );\n      const remoteSnapshot = generateSnapshotFromManifest(manifestJson, {\n        version: manifestUrl,\n      });\n\n      const { remoteSnapshot: remoteSnapshotRes } =\n        await this.hooks.lifecycle.loadRemoteSnapshot.emit({\n          options: this.HostInstance.options,\n          moduleInfo,\n          manifestJson,\n          remoteSnapshot,\n          manifestUrl,\n          from: 'manifest',\n        });\n      return remoteSnapshotRes;\n    };\n\n    if (!this.manifestLoading[manifestUrl]) {\n      this.manifestLoading[manifestUrl] = asyncLoadProcess().then((res) => res);\n    }\n    return this.manifestLoading[manifestUrl];\n  }\n}\n", "import { PluginSystem } from '../../utils/hooks';\n\nexport class DisabledSnapshotHandler {\n  hooks = new PluginSystem({});\n}\n", "import {\n  RUNTIME_005,\n  RUNTIME_006,\n  runtimeDescMap,\n} from '@module-federation/error-codes';\nimport { Federation } from '../global';\nimport {\n  Options,\n  ShareScopeMap,\n  ShareInfos,\n  Shared,\n  RemoteEntryExports,\n  UserOptions,\n  ShareStrategy,\n  InitScope,\n  InitTokens,\n  CallFrom,\n  TreeShakingArgs,\n  LoadShareExtraOptions,\n  SharedLoadContext,\n  SharedLoadTrigger,\n} from '../type';\nimport { ModuleFederation } from '../core';\nimport {\n  PluginSystem,\n  AsyncHook,\n  AsyncWaterfallHook,\n  SyncWaterfallHook,\n  SyncHook,\n} from '../utils/hooks';\nimport {\n  formatShareConfigs,\n  getRegisteredShare,\n  getTargetSharedOptions,\n  getGlobalShareScope,\n  directShare,\n  shouldUseTreeShaking,\n  addUseIn,\n} from '../utils/share';\nimport {\n  assert,\n  error,\n  addUniqueItem,\n  optionsToMFContext,\n  warn,\n} from '../utils';\nimport { DEFAULT_SCOPE } from '../constant';\nimport type { LoadRemoteMatch } from '../remote';\nimport { createRemoteEntryInitOptions } from '../module';\n\nexport class SharedHandler {\n  host: ModuleFederation;\n  shareScopeMap: ShareScopeMap;\n  hooks = new PluginSystem({\n    beforeRegisterShare: new SyncWaterfallHook<{\n      pkgName: string;\n      shared: Shared;\n      origin: ModuleFederation;\n    }>('beforeRegisterShare'),\n    afterRegisterShare: new SyncHook<\n      [\n        {\n          pkgName: string;\n          scope: string;\n          shared: Shared;\n          previousShared?: Shared;\n          registeredShared?: Shared;\n          shareScopeMap: ShareScopeMap;\n          trigger: SharedLoadTrigger;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterRegisterShare'),\n    afterResolve: new AsyncWaterfallHook<LoadRemoteMatch>('afterResolve'),\n    beforeLoadShare: new AsyncWaterfallHook<{\n      pkgName: string;\n      shareInfo?: Shared;\n      shared: Options['shared'];\n      origin: ModuleFederation;\n      loadContext?: SharedLoadContext;\n    }>('beforeLoadShare'),\n    // not used yet\n    loadShare: new AsyncHook<[ModuleFederation, string, ShareInfos]>(),\n    afterLoadShare: new SyncHook<\n      [\n        {\n          pkgName: string;\n          shareInfo?: Partial<Shared>;\n          selectedShared?: Partial<Shared>;\n          shared: Options['shared'];\n          shareScopeMap: ShareScopeMap;\n          lifecycle: 'loadShare' | 'loadShareSync';\n          loadContext?: SharedLoadContext;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterLoadShare'),\n    errorLoadShare: new SyncHook<\n      [\n        {\n          pkgName: string;\n          shareInfo?: Partial<Shared>;\n          shared: Options['shared'];\n          shareScopeMap: ShareScopeMap;\n          lifecycle: 'loadShare' | 'loadShareSync';\n          origin: ModuleFederation;\n          error?: unknown;\n          recovered?: boolean;\n          loadContext?: SharedLoadContext;\n        },\n      ],\n      void\n    >('errorLoadShare'),\n    resolveShare: new SyncWaterfallHook<{\n      shareScopeMap: ShareScopeMap;\n      scope: string;\n      pkgName: string;\n      version: string;\n      shareInfo: Shared;\n      GlobalFederation: Federation;\n      resolver: () => { shared: Shared; useTreesShaking: boolean } | undefined;\n      loadContext?: SharedLoadContext;\n    }>('resolveShare'),\n    // maybe will change, temporarily for internal use only\n    initContainerShareScopeMap: new SyncWaterfallHook<{\n      shareScope: ShareScopeMap[string];\n      options: Options;\n      origin: ModuleFederation;\n      scopeName: string;\n      hostShareScopeMap?: ShareScopeMap;\n    }>('initContainerShareScopeMap'),\n  });\n  initTokens: InitTokens;\n  constructor(host: ModuleFederation) {\n    this.host = host;\n    this.shareScopeMap = {};\n    this.initTokens = {};\n    this._setGlobalShareScopeMap(host.options);\n  }\n\n  private emitAfterRegisterShare(\n    pkgName: string,\n    input: {\n      scope: string;\n      shared: Shared;\n      previousShared?: Shared;\n      registeredShared?: Shared;\n      trigger: SharedLoadTrigger;\n    },\n  ): void {\n    this.hooks.lifecycle.afterRegisterShare.emit({\n      pkgName,\n      ...input,\n      shareScopeMap: this.shareScopeMap,\n      origin: this.host,\n    });\n  }\n\n  private emitAfterLoadShare({\n    lifecycle,\n    pkgName,\n    shareInfo,\n    selectedShared,\n    loadContext,\n  }: {\n    lifecycle: 'loadShare' | 'loadShareSync';\n    pkgName: string;\n    shareInfo?: Partial<Shared>;\n    selectedShared?: Partial<Shared>;\n    loadContext?: SharedLoadContext;\n  }): void {\n    try {\n      this.hooks.lifecycle.afterLoadShare.emit({\n        pkgName,\n        shareInfo,\n        selectedShared,\n        shared: this.host.options.shared,\n        shareScopeMap: this.shareScopeMap,\n        lifecycle,\n        loadContext,\n        origin: this.host,\n      });\n    } catch (error) {\n      warn(error);\n    }\n  }\n\n  private emitErrorLoadShare({\n    lifecycle,\n    pkgName,\n    shareInfo,\n    error,\n    recovered,\n    loadContext,\n  }: {\n    lifecycle: 'loadShare' | 'loadShareSync';\n    pkgName: string;\n    shareInfo?: Partial<Shared>;\n    error?: unknown;\n    recovered?: boolean;\n    loadContext?: SharedLoadContext;\n  }): void {\n    try {\n      this.hooks.lifecycle.errorLoadShare.emit({\n        pkgName,\n        shareInfo,\n        shared: this.host.options.shared,\n        shareScopeMap: this.shareScopeMap,\n        lifecycle,\n        origin: this.host,\n        error,\n        recovered,\n        loadContext,\n      });\n    } catch (hookError) {\n      warn(hookError);\n    }\n  }\n\n  // register shared in shareScopeMap\n  registerShared(globalOptions: Options, userOptions: UserOptions) {\n    const { newShareInfos, allShareInfos } = formatShareConfigs(\n      globalOptions,\n      userOptions,\n    );\n\n    const sharedKeys = Object.keys(newShareInfos);\n    sharedKeys.forEach((sharedKey) => {\n      const sharedVals = newShareInfos[sharedKey];\n      sharedVals.forEach((sharedVal) => {\n        sharedVal.scope.forEach((sc) => {\n          this.hooks.lifecycle.beforeRegisterShare.emit({\n            origin: this.host,\n            pkgName: sharedKey,\n            shared: sharedVal,\n          });\n          const registeredShared = this.shareScopeMap[sc]?.[sharedKey];\n          const previousAtVersion = registeredShared?.[sharedVal.version];\n          if (!registeredShared) {\n            this.setShared({\n              pkgName: sharedKey,\n              lib: sharedVal.lib,\n              get: sharedVal.get,\n              loaded: sharedVal.loaded || Boolean(sharedVal.lib),\n              shared: sharedVal,\n              from: userOptions.name,\n            });\n          }\n          this.emitAfterRegisterShare(sharedKey, {\n            scope: sc,\n            shared: sharedVal,\n            previousShared: previousAtVersion,\n            registeredShared:\n              this.shareScopeMap[sc]?.[sharedKey]?.[sharedVal.version],\n            trigger: 'runtime',\n          });\n        });\n      });\n    });\n\n    return {\n      newShareInfos,\n      allShareInfos,\n    };\n  }\n\n  async loadShare<T>(\n    pkgName: string,\n    extraOptions?: LoadShareExtraOptions,\n  ): Promise<false | (() => T | undefined)> {\n    const { host } = this;\n    let loadContext = extraOptions?.context;\n    // This function performs the following steps:\n    // 1. Checks if the currently loaded share already exists, if not, it throws an error\n    // 2. Searches globally for a matching share, if found, it uses it directly\n    // 3. If not found, it retrieves it from the current share and stores the obtained share globally.\n\n    const shareOptions = getTargetSharedOptions({\n      pkgName,\n      extraOptions,\n      shareInfos: host.options.shared,\n    });\n    let shareOptionsRes: Shared | undefined = shareOptions;\n\n    try {\n      if (shareOptions?.scope) {\n        await Promise.all(\n          shareOptions.scope.map(async (shareScope) => {\n            await Promise.all(\n              this.initializeSharing(shareScope, {\n                strategy: shareOptions.strategy,\n                context: loadContext,\n              }),\n            );\n            return;\n          }),\n        );\n      }\n      const loadShareRes = await this.hooks.lifecycle.beforeLoadShare.emit({\n        pkgName,\n        shareInfo: shareOptions,\n        shared: host.options.shared,\n        origin: host,\n        loadContext,\n      });\n\n      shareOptionsRes = loadShareRes.shareInfo;\n      loadContext = loadShareRes.loadContext || loadContext;\n\n      // Assert that shareInfoRes exists, if not, throw an error\n      assert(\n        shareOptionsRes,\n        `Cannot find shared \"${pkgName}\" in host \"${host.options.name}\". Ensure the shared config for \"${pkgName}\" is declared in the federation plugin options and the host has been initialized before loading shares.`,\n      );\n      const resolvedShareOptions = shareOptionsRes;\n\n      const { shared: registeredShared, useTreesShaking } =\n        getRegisteredShare(\n          this.shareScopeMap,\n          pkgName,\n          shareOptionsRes,\n          this.hooks.lifecycle.resolveShare,\n          loadContext,\n        ) || {};\n\n      if (registeredShared) {\n        const targetShared = directShare(registeredShared, useTreesShaking);\n        if (targetShared.lib) {\n          addUseIn(targetShared, host.options.name);\n          this.emitAfterLoadShare({\n            lifecycle: 'loadShare',\n            pkgName,\n            shareInfo: resolvedShareOptions,\n            selectedShared: registeredShared,\n            loadContext,\n          });\n          return targetShared.lib as () => T;\n        } else if (targetShared.loading && !targetShared.loaded) {\n          const factory = await targetShared.loading;\n          targetShared.loaded = true;\n          if (!targetShared.lib) {\n            targetShared.lib = factory;\n          }\n          addUseIn(targetShared, host.options.name);\n          this.emitAfterLoadShare({\n            lifecycle: 'loadShare',\n            pkgName,\n            shareInfo: resolvedShareOptions,\n            selectedShared: registeredShared,\n            loadContext,\n          });\n          return factory;\n        } else {\n          const asyncLoadProcess = async () => {\n            const factory = await targetShared.get!();\n            addUseIn(targetShared, host.options.name);\n            targetShared.loaded = true;\n            targetShared.lib = factory;\n            return factory as () => T;\n          };\n          const loading = asyncLoadProcess();\n          this.setShared({\n            pkgName,\n            loaded: false,\n            shared: registeredShared,\n            from: host.options.name,\n            lib: null,\n            loading,\n            treeShaking: useTreesShaking\n              ? (targetShared as TreeShakingArgs)\n              : undefined,\n          });\n          const factory = await loading;\n          this.emitAfterLoadShare({\n            lifecycle: 'loadShare',\n            pkgName,\n            shareInfo: resolvedShareOptions,\n            selectedShared: registeredShared,\n            loadContext,\n          });\n          return factory;\n        }\n      } else {\n        if (extraOptions?.customShareInfo) {\n          this.emitErrorLoadShare({\n            lifecycle: 'loadShare',\n            pkgName,\n            shareInfo: resolvedShareOptions,\n            recovered: true,\n            loadContext,\n          });\n          return false;\n        }\n        const _useTreeShaking = shouldUseTreeShaking(\n          resolvedShareOptions.treeShaking,\n        );\n        const targetShared = directShare(resolvedShareOptions, _useTreeShaking);\n\n        const asyncLoadProcess = async () => {\n          const factory = await targetShared.get!();\n          targetShared.lib = factory;\n          targetShared.loaded = true;\n          addUseIn(targetShared, host.options.name);\n          const { shared: gShared, useTreesShaking: gUseTreeShaking } =\n            getRegisteredShare(\n              this.shareScopeMap,\n              pkgName,\n              resolvedShareOptions,\n              this.hooks.lifecycle.resolveShare,\n              loadContext,\n            ) || {};\n          if (gShared) {\n            const targetGShared = directShare(gShared, gUseTreeShaking);\n            targetGShared.lib = factory;\n            targetGShared.loaded = true;\n            gShared.from = resolvedShareOptions.from;\n          }\n          return factory as () => T;\n        };\n        const loading = asyncLoadProcess();\n        this.setShared({\n          pkgName,\n          loaded: false,\n          shared: resolvedShareOptions,\n          from: host.options.name,\n          lib: null,\n          loading,\n          treeShaking: _useTreeShaking\n            ? (targetShared as TreeShakingArgs)\n            : undefined,\n        });\n        const factory = await loading;\n        this.emitAfterLoadShare({\n          lifecycle: 'loadShare',\n          pkgName,\n          shareInfo: resolvedShareOptions,\n          selectedShared: resolvedShareOptions,\n          loadContext,\n        });\n        return factory;\n      }\n    } catch (shareError) {\n      this.emitErrorLoadShare({\n        lifecycle: 'loadShare',\n        pkgName,\n        shareInfo: shareOptionsRes,\n        error: shareError,\n        loadContext,\n      });\n      throw shareError;\n    }\n  }\n\n  /**\n   * This function initializes the sharing sequence (executed only once per share scope).\n   * It accepts one argument, the name of the share scope.\n   * If the share scope does not exist, it creates one.\n   */\n  // eslint-disable-next-line @typescript-eslint/member-ordering\n  initializeSharing(\n    shareScopeName = DEFAULT_SCOPE,\n    extraOptions?: {\n      initScope?: InitScope;\n      from?: CallFrom;\n      strategy?: ShareStrategy;\n      context?: SharedLoadContext;\n    },\n  ): Array<Promise<void>> {\n    const { host } = this;\n    const from = extraOptions?.from;\n    const strategy = extraOptions?.strategy;\n    const trigger: SharedLoadTrigger =\n      extraOptions?.context?.trigger || from || 'runtime';\n    let initScope = extraOptions?.initScope;\n    const promises: Promise<any>[] = [];\n    if (from !== 'build') {\n      const { initTokens } = this;\n      if (!initScope) initScope = [];\n      let initToken = initTokens[shareScopeName];\n      if (!initToken)\n        initToken = initTokens[shareScopeName] = { from: this.host.name };\n      if (initScope.indexOf(initToken) >= 0) return promises;\n      initScope.push(initToken);\n    }\n\n    const shareScope = this.shareScopeMap;\n    const hostName = host.options.name;\n    // Creates a new share scope if necessary\n    if (!shareScope[shareScopeName]) {\n      shareScope[shareScopeName] = {};\n    }\n    // Executes all initialization snippets from all accessible modules\n    const scope = shareScope[shareScopeName];\n    const register = (name: string, shared: Shared) => {\n      const { version, eager } = shared;\n      scope[name] = scope[name] || {};\n      const versions = scope[name];\n      const existingShared = versions[version];\n      const activeVersion: Shared =\n        existingShared && (directShare(existingShared) as Shared);\n      const activeVersionEager = Boolean(\n        activeVersion &&\n        (('eager' in activeVersion && activeVersion.eager) ||\n          ('shareConfig' in activeVersion && activeVersion.shareConfig?.eager)),\n      );\n      const shouldReplace = Boolean(\n        !activeVersion ||\n        (activeVersion.strategy !== 'loaded-first' &&\n          !activeVersion.loaded &&\n          (Boolean(!eager) !== !activeVersionEager\n            ? eager\n            : hostName > versions[version].from)),\n      );\n      if (shouldReplace) {\n        versions[version] = shared;\n      }\n      this.emitAfterRegisterShare(name, {\n        scope: shareScopeName,\n        shared,\n        previousShared: existingShared,\n        registeredShared: versions[version],\n        trigger,\n      });\n    };\n\n    const initRemoteModule = async (key: string): Promise<void> => {\n      const { module } = await host.remoteHandler.getRemoteModuleAndOptions({\n        id: key,\n      });\n      let remoteEntryExports: RemoteEntryExports | undefined = undefined;\n      const resourceContext = {\n        initiator: 'loadShare' as const,\n        id: key,\n        resourceType: 'remoteEntry' as const,\n        url: module.remoteInfo.entry,\n      };\n      try {\n        remoteEntryExports = await module.getEntry(undefined, resourceContext);\n      } catch (error) {\n        remoteEntryExports =\n          (await host.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({\n            id: key,\n            error,\n            from: 'runtime',\n            lifecycle: 'beforeLoadShare',\n            remote: module.remoteInfo,\n            origin: host,\n          })) as RemoteEntryExports;\n        if (!remoteEntryExports) {\n          return;\n        }\n      } finally {\n        // prevent self load loop: when host load self , the initTokens is not the same\n        if (remoteEntryExports?.init && !module.initing) {\n          module.remoteEntryExports = remoteEntryExports;\n          await module.init(\n            undefined,\n            undefined,\n            initScope,\n            undefined,\n            resourceContext,\n          );\n        }\n      }\n    };\n    Object.keys(host.options.shared).forEach((shareName) => {\n      const sharedArr = host.options.shared[shareName];\n      sharedArr.forEach((shared) => {\n        if (shared.scope.includes(shareScopeName)) {\n          register(shareName, shared);\n        }\n      });\n    });\n    // TODO: strategy==='version-first' need to be removed in the future\n    if (\n      host.options.shareStrategy === 'version-first' ||\n      strategy === 'version-first'\n    ) {\n      host.options.remotes.forEach((remote) => {\n        if (remote.shareScope === shareScopeName) {\n          promises.push(initRemoteModule(remote.name));\n        }\n      });\n    }\n\n    return promises;\n  }\n\n  // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.\n  // 1. If the loaded shared already exists globally, then it will be reused\n  // 2. If lib exists in local shared, it will be used directly\n  // 3. If the local get returns something other than Promise, then it will be used directly\n  loadShareSync<T>(\n    pkgName: string,\n    extraOptions?: LoadShareExtraOptions,\n  ): () => T | never {\n    const { host } = this;\n    const loadContext = extraOptions?.context;\n    const shareOptions = getTargetSharedOptions({\n      pkgName,\n      extraOptions,\n      shareInfos: host.options.shared,\n    });\n\n    try {\n      if (shareOptions?.scope) {\n        shareOptions.scope.forEach((shareScope) => {\n          this.initializeSharing(shareScope, {\n            strategy: shareOptions.strategy,\n            from: extraOptions?.from,\n            context: loadContext,\n          });\n        });\n      }\n      const { shared: registeredShared } =\n        getRegisteredShare(\n          this.shareScopeMap,\n          pkgName,\n          shareOptions,\n          this.hooks.lifecycle.resolveShare,\n          loadContext,\n        ) || {};\n\n      if (registeredShared) {\n        if (typeof registeredShared.lib === 'function') {\n          addUseIn(registeredShared, host.options.name);\n          if (!registeredShared.loaded) {\n            registeredShared.loaded = true;\n            if (registeredShared.from === host.options.name) {\n              shareOptions.loaded = true;\n            }\n          }\n          this.emitAfterLoadShare({\n            lifecycle: 'loadShareSync',\n            pkgName,\n            shareInfo: shareOptions,\n            selectedShared: registeredShared,\n            loadContext,\n          });\n          return registeredShared.lib as () => T;\n        }\n        if (typeof registeredShared.get === 'function') {\n          const module = registeredShared.get();\n          if (!(module instanceof Promise)) {\n            addUseIn(registeredShared, host.options.name);\n            this.setShared({\n              pkgName,\n              loaded: true,\n              from: host.options.name,\n              lib: module,\n              shared: registeredShared,\n            });\n            this.emitAfterLoadShare({\n              lifecycle: 'loadShareSync',\n              pkgName,\n              shareInfo: shareOptions,\n              selectedShared: registeredShared,\n              loadContext,\n            });\n            return module;\n          }\n        }\n      }\n\n      if (shareOptions.lib) {\n        if (!shareOptions.loaded) {\n          shareOptions.loaded = true;\n        }\n        this.emitAfterLoadShare({\n          lifecycle: 'loadShareSync',\n          pkgName,\n          shareInfo: shareOptions,\n          selectedShared: shareOptions,\n          loadContext,\n        });\n        return shareOptions.lib as () => T;\n      }\n\n      if (shareOptions.get) {\n        const module = shareOptions.get();\n\n        if (module instanceof Promise) {\n          const errorCode =\n            extraOptions?.from === 'build' ? RUNTIME_005 : RUNTIME_006;\n          error(\n            errorCode,\n            runtimeDescMap,\n            {\n              hostName: host.options.name,\n              sharedPkgName: pkgName,\n            },\n            undefined,\n            optionsToMFContext(host.options),\n          );\n        }\n\n        shareOptions.lib = module;\n\n        this.setShared({\n          pkgName,\n          loaded: true,\n          from: host.options.name,\n          lib: shareOptions.lib,\n          shared: shareOptions,\n        });\n        this.emitAfterLoadShare({\n          lifecycle: 'loadShareSync',\n          pkgName,\n          shareInfo: shareOptions,\n          selectedShared: shareOptions,\n          loadContext,\n        });\n        return shareOptions.lib as () => T;\n      }\n\n      error(\n        RUNTIME_006,\n        runtimeDescMap,\n        {\n          hostName: host.options.name,\n          sharedPkgName: pkgName,\n        },\n        undefined,\n        optionsToMFContext(host.options),\n      );\n    } catch (shareError) {\n      this.emitErrorLoadShare({\n        lifecycle: 'loadShareSync',\n        pkgName,\n        shareInfo: shareOptions,\n        error: shareError,\n        loadContext,\n      });\n      throw shareError;\n    }\n  }\n\n  initShareScopeMap(\n    scopeName: string,\n    shareScope: ShareScopeMap[string],\n    extraOptions: { hostShareScopeMap?: ShareScopeMap } = {},\n  ): void {\n    const { host } = this;\n    this.shareScopeMap[scopeName] = shareScope;\n    this.hooks.lifecycle.initContainerShareScopeMap.emit({\n      shareScope,\n      options: host.options,\n      origin: host,\n      scopeName,\n      hostShareScopeMap: extraOptions.hostShareScopeMap,\n    });\n  }\n\n  private setShared({\n    pkgName,\n    shared,\n    from,\n    lib,\n    loading,\n    loaded,\n    get,\n    treeShaking,\n  }: {\n    pkgName: string;\n    shared: Shared;\n    from: string;\n    lib: any;\n    loaded?: boolean;\n    loading?: Shared['loading'];\n    get?: Shared['get'];\n    treeShaking?: TreeShakingArgs;\n  }): void {\n    const { version, scope = 'default', ...shareInfo } = shared;\n    const scopes: string[] = Array.isArray(scope) ? scope : [scope];\n\n    const mergeAttrs = (shared: Shared) => {\n      const merge = <K extends keyof TreeShakingArgs>(\n        s: TreeShakingArgs,\n        key: K,\n        val: TreeShakingArgs[K],\n      ): void => {\n        if (val && !s[key]) {\n          s[key] = val;\n        }\n      };\n      const targetShared = (\n        treeShaking ? shared.treeShaking! : shared\n      ) as TreeShakingArgs;\n      merge(targetShared, 'loaded', loaded);\n      merge(targetShared, 'loading', loading);\n      merge(targetShared, 'get', get);\n      merge(targetShared, 'lib', lib);\n    };\n    scopes.forEach((sc) => {\n      if (!this.shareScopeMap[sc]) {\n        this.shareScopeMap[sc] = {};\n      }\n      if (!this.shareScopeMap[sc][pkgName]) {\n        this.shareScopeMap[sc][pkgName] = {};\n      }\n\n      if (!this.shareScopeMap[sc][pkgName][version]) {\n        this.shareScopeMap[sc][pkgName][version] = {\n          version,\n          scope: [sc],\n          ...shareInfo,\n          lib,\n        };\n      }\n\n      const registeredShared = this.shareScopeMap[sc][pkgName][version];\n      mergeAttrs(registeredShared);\n      if (from && registeredShared.from !== from) {\n        registeredShared.from = from;\n      }\n    });\n  }\n\n  private _setGlobalShareScopeMap(hostOptions: Options): void {\n    const globalShareScopeMap = getGlobalShareScope();\n    const identifier = hostOptions.id || hostOptions.name;\n    if (identifier && !globalShareScopeMap[identifier]) {\n      globalShareScopeMap[identifier] = this.shareScopeMap;\n    }\n  }\n}\n", "import type { LoadRemoteMatch } from '../remote';\nimport type { ShareScopeMap } from '../type';\nimport { AsyncWaterfallHook, PluginSystem } from '../utils/hooks';\n\nexport class DisabledSharedHandler {\n  shareScopeMap: ShareScopeMap = {};\n  hooks = new PluginSystem({\n    afterResolve: new AsyncWaterfallHook<LoadRemoteMatch>('afterResolve'),\n  });\n\n  registerShared() {\n    return {\n      newShareInfos: {},\n      allShareInfos: {},\n    };\n  }\n\n  loadShare(): never {\n    throw new Error(\n      'Shared dependency loading is disabled by experiments.optimization.disableShared.',\n    );\n  }\n\n  loadShareSync(): never {\n    throw new Error(\n      'Shared dependency loading is disabled by experiments.optimization.disableShared.',\n    );\n  }\n\n  initializeSharing(): [] {\n    return [];\n  }\n\n  initShareScopeMap(\n    scopeName: string,\n    shareScope: ShareScopeMap[string],\n  ): void {\n    this.shareScopeMap[scopeName] = shareScope;\n  }\n}\n", "import {\n  isBrowserEnvValue,\n  warn,\n  composeKeyWithSeparator,\n  ModuleInfo,\n  GlobalModuleInfo,\n} from '@module-federation/sdk';\nimport { RUNTIME_004, runtimeDescMap } from '@module-federation/error-codes';\nimport {\n  Global,\n  getInfoWithoutType,\n  globalLoading,\n  CurrentGlobal,\n} from '../global';\nimport {\n  Options,\n  UserOptions,\n  PreloadAssets,\n  PreloadOptions,\n  PreloadRemoteArgs,\n  PreloadRemoteResult,\n  Remote,\n  RemoteInfo,\n  RemoteEntryExports,\n  CallFrom,\n  ResourceLoadContext,\n} from '../type';\nimport { ModuleFederation } from '../core';\nimport {\n  PluginSystem,\n  AsyncHook,\n  AsyncWaterfallHook,\n  SyncHook,\n  SyncWaterfallHook,\n} from '../utils/hooks';\nimport {\n  assert,\n  error,\n  getRemoteInfo,\n  getRemoteEntryUniqueKey,\n  getFMId,\n  composeRemoteRequestId,\n  matchRemoteWithNameAndExpose,\n  optionsToMFContext,\n  logger,\n} from '../utils';\nimport { DEFAULT_REMOTE_TYPE, DEFAULT_SCOPE } from '../constant';\nimport { Module, ModuleOptions } from '../module';\nimport { formatPreloadArgs, preloadAssets } from '../utils/preload';\nimport { getGlobalShareScope } from '../utils/share';\nimport { getGlobalRemoteInfo } from '../plugins/snapshot/SnapshotHandler';\n\nexport interface LoadRemoteMatch {\n  id: string;\n  pkgNameOrAlias: string;\n  expose: string;\n  remote: Remote;\n  options: Options;\n  origin: ModuleFederation;\n  remoteInfo: RemoteInfo;\n  remoteSnapshot?: ModuleInfo;\n}\n\nexport class RemoteHandler {\n  host: ModuleFederation;\n  idToRemoteMap: Record<string, { name: string; expose: string }>;\n\n  hooks = new PluginSystem({\n    beforeRegisterRemote: new SyncWaterfallHook<{\n      remote: Remote;\n      origin: ModuleFederation;\n    }>('beforeRegisterRemote'),\n    registerRemote: new SyncWaterfallHook<{\n      remote: Remote;\n      origin: ModuleFederation;\n    }>('registerRemote'),\n    beforeRequest: new AsyncWaterfallHook<{\n      id: string;\n      options: Options;\n      origin: ModuleFederation;\n    }>('beforeRequest'),\n    afterMatchRemote: new AsyncHook<\n      [\n        {\n          id: string;\n          options: Options;\n          remote?: Remote;\n          expose?: string;\n          remoteInfo?: RemoteInfo;\n          error?: unknown;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterMatchRemote'),\n    onLoad: new AsyncHook<\n      [\n        {\n          id: string;\n          expose: string;\n          pkgNameOrAlias: string;\n          remote: Remote;\n          options: ModuleOptions;\n          origin: ModuleFederation;\n          exposeModule: any;\n          exposeModuleFactory: any;\n          moduleInstance: Module;\n        },\n      ],\n      unknown\n    >('onLoad'),\n    afterLoadRemote: new AsyncHook<\n      [\n        {\n          id: string;\n          expose?: string;\n          remote?: RemoteInfo;\n          options?: {\n            loadFactory?: boolean;\n            from?: CallFrom;\n          };\n          error?: unknown;\n          recovered?: boolean;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterLoadRemote'),\n    handlePreloadModule: new SyncHook<\n      [\n        {\n          id: string;\n          name: string;\n          remote: Remote;\n          remoteSnapshot: ModuleInfo;\n          preloadConfig: PreloadRemoteArgs;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('handlePreloadModule'),\n    errorLoadRemote: new AsyncHook<\n      [\n        {\n          id: string;\n          error: unknown;\n          options?: any;\n          from: CallFrom;\n          lifecycle:\n            | 'beforeRequest'\n            | 'beforeLoadShare'\n            | 'afterResolve'\n            | 'onLoad';\n          remote?: RemoteInfo;\n          expose?: string;\n          origin: ModuleFederation;\n        },\n      ],\n      void | unknown\n    >('errorLoadRemote'),\n    beforePreloadRemote: new AsyncHook<\n      [\n        {\n          preloadOps: Array<PreloadRemoteArgs>;\n          options: Options;\n          origin: ModuleFederation;\n        },\n      ]\n    >('beforePreloadRemote'),\n    generatePreloadAssets: new AsyncHook<\n      [\n        {\n          origin: ModuleFederation;\n          preloadOptions: PreloadOptions[number];\n          remote: Remote;\n          remoteInfo: RemoteInfo;\n          remoteSnapshot: ModuleInfo;\n          globalSnapshot: GlobalModuleInfo;\n        },\n      ],\n      Promise<PreloadAssets>\n    >('generatePreloadAssets'),\n    afterPreloadRemote: new AsyncHook<\n      [\n        {\n          preloadOps: Array<PreloadRemoteArgs>;\n          options: Options;\n          origin: ModuleFederation;\n          results: PreloadRemoteResult[];\n          error?: unknown;\n        },\n      ]\n    >('afterPreloadRemote'),\n    // TODO: Move to loaderHook\n    loadEntry: new AsyncHook<\n      [\n        {\n          origin: ModuleFederation;\n          loaderHook: ModuleFederation['loaderHook'];\n          remoteInfo: RemoteInfo;\n          remoteEntryExports?: RemoteEntryExports;\n          resourceContext?: ResourceLoadContext;\n        },\n      ],\n      Promise<RemoteEntryExports | void> | RemoteEntryExports | void\n    >(),\n  });\n\n  constructor(host: ModuleFederation) {\n    this.host = host;\n    this.idToRemoteMap = {};\n  }\n\n  formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions) {\n    const userRemotes = userOptions.remotes || [];\n\n    return userRemotes.reduce((res, remote) => {\n      this.registerRemote(remote, res, { force: false });\n      return res;\n    }, globalOptions.remotes);\n  }\n\n  setIdToRemoteMap(id: string, remoteMatchInfo: LoadRemoteMatch) {\n    const { remote, expose } = remoteMatchInfo;\n    const { name, alias } = remote;\n    this.idToRemoteMap[id] = { name: remote.name, expose };\n    if (alias && id.startsWith(name)) {\n      const idWithAlias = id.replace(name, alias);\n      this.idToRemoteMap[idWithAlias] = { name: remote.name, expose };\n      return;\n    }\n\n    if (alias && id.startsWith(alias)) {\n      const idWithName = id.replace(alias, name);\n      this.idToRemoteMap[idWithName] = { name: remote.name, expose };\n    }\n  }\n\n  // eslint-disable-next-line max-lines-per-function\n  // eslint-disable-next-line @typescript-eslint/member-ordering\n  async loadRemote<T>(\n    id: string,\n    options?: { loadFactory?: boolean; from: CallFrom },\n  ): Promise<T | null> {\n    const { host } = this;\n    const startMatchInfo = matchRemoteWithNameAndExpose(\n      host.options.remotes,\n      id,\n    );\n    let completeRequestId = id;\n    let completeExpose = startMatchInfo?.expose;\n    let completeRemote = startMatchInfo\n      ? getRemoteInfo(startMatchInfo.remote)\n      : undefined;\n    let afterLoadRemoteArgs:\n      | Parameters<\n          RemoteHandler['hooks']['lifecycle']['afterLoadRemote']['emit']\n        >[0]\n      | undefined;\n\n    try {\n      const { loadFactory = true } = options || {\n        loadFactory: true,\n      };\n      // 1. Validate the parameters of the retrieved module. There are two module request methods: pkgName + expose and alias + expose.\n      // 2. Request the snapshot information of the current host and globally store the obtained snapshot information. The retrieved module information is partially offline and partially online. The online module information will retrieve the modules used online.\n      // 3. Retrieve the detailed information of the current module from global (remoteEntry address, expose resource address)\n      // 4. After retrieving remoteEntry, call the init of the module, and then retrieve the exported content of the module through get\n      // id: pkgName(@federation/app1) + expose(button) = @federation/app1/button\n      // id: alias(app1) + expose(button) = app1/button\n      // id: alias(app1/utils) + expose(loadash/sort) = app1/utils/loadash/sort\n      const { module, moduleOptions, remoteMatchInfo } =\n        await this.getRemoteModuleAndOptions({\n          id,\n        });\n      const {\n        pkgNameOrAlias,\n        remote,\n        expose,\n        id: idRes,\n        remoteSnapshot,\n      } = remoteMatchInfo;\n      completeRequestId = idRes;\n      completeExpose = expose;\n      completeRemote = getRemoteInfo(remote);\n\n      const moduleOrFactory = (await module.get(\n        idRes,\n        expose,\n        options,\n        remoteSnapshot,\n      )) as T;\n\n      const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({\n        id: idRes,\n        pkgNameOrAlias,\n        expose,\n        exposeModule: loadFactory ? moduleOrFactory : undefined,\n        exposeModuleFactory: loadFactory ? undefined : moduleOrFactory,\n        remote,\n        options: moduleOptions,\n        moduleInstance: module,\n        origin: host,\n      });\n\n      this.setIdToRemoteMap(id, remoteMatchInfo);\n      afterLoadRemoteArgs = {\n        id: completeRequestId,\n        expose: completeExpose,\n        remote: completeRemote,\n        options,\n        origin: host,\n      };\n\n      if (typeof moduleWrapper === 'function') {\n        return moduleWrapper as T;\n      }\n\n      return moduleOrFactory;\n    } catch (error) {\n      const { from = 'runtime' } = options || { from: 'runtime' };\n\n      let failOver;\n      try {\n        failOver = await this.hooks.lifecycle.errorLoadRemote.emit({\n          id,\n          error,\n          from,\n          lifecycle: 'onLoad',\n          expose: completeExpose,\n          remote: completeRemote,\n          origin: host,\n        });\n      } catch (hookError) {\n        afterLoadRemoteArgs = {\n          id: completeRequestId,\n          expose: completeExpose,\n          remote: completeRemote,\n          options,\n          error: hookError,\n          origin: host,\n        };\n        throw hookError;\n      }\n\n      if (!failOver) {\n        afterLoadRemoteArgs = {\n          id: completeRequestId,\n          expose: completeExpose,\n          remote: completeRemote,\n          options,\n          error,\n          origin: host,\n        };\n        throw error;\n      }\n\n      afterLoadRemoteArgs = {\n        id: completeRequestId,\n        expose: completeExpose,\n        remote: completeRemote,\n        options,\n        error,\n        origin: host,\n        recovered: true,\n      };\n\n      return failOver as T;\n    } finally {\n      if (afterLoadRemoteArgs) {\n        await this.hooks.lifecycle.afterLoadRemote.emit(afterLoadRemoteArgs);\n      }\n    }\n  }\n\n  // eslint-disable-next-line @typescript-eslint/member-ordering\n  async preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void> {\n    const { host } = this;\n    const preloadResults: PreloadRemoteResult[] = [];\n\n    await this.hooks.lifecycle.beforePreloadRemote.emit({\n      preloadOps: preloadOptions,\n      options: host.options,\n      origin: host,\n    });\n\n    const preloadOps: PreloadOptions = formatPreloadArgs(\n      host.options.remotes,\n      preloadOptions,\n    );\n\n    const createPreloadAssetOps = (ops: PreloadOptions[number]) => {\n      const { preloadConfig, remote } = ops;\n      const exposes = preloadConfig.exposes || [];\n\n      if (!exposes.length) {\n        return [\n          {\n            ops,\n            id: `${remote.name}/*`,\n          },\n        ];\n      }\n\n      return exposes.map((expose) => ({\n        ops: {\n          ...ops,\n          preloadConfig: {\n            ...preloadConfig,\n            exposes: [expose],\n          },\n        },\n        id: composeRemoteRequestId(remote.name, expose),\n      }));\n    };\n\n    let preloadError: Error | undefined;\n\n    await Promise.all(\n      preloadOps.flatMap(createPreloadAssetOps).map(async (assetOps) => {\n        const { ops, id: preloadId } = assetOps;\n        const { remote, preloadConfig } = ops;\n        const remoteInfo = getRemoteInfo(remote);\n        try {\n          const { globalSnapshot, remoteSnapshot } =\n            await host.snapshotHandler.loadRemoteSnapshotInfo({\n              moduleInfo: remote,\n              id: preloadId,\n              initiator: 'preloadRemote',\n            });\n\n          const assets = await this.hooks.lifecycle.generatePreloadAssets.emit({\n            origin: host,\n            preloadOptions: ops,\n            remote,\n            remoteInfo,\n            globalSnapshot,\n            remoteSnapshot,\n          });\n          if (!assets) {\n            return;\n          }\n          const results = await preloadAssets(\n            remoteInfo,\n            host,\n            assets,\n            true,\n            {\n              initiator: 'preloadRemote',\n              id: preloadId,\n            },\n            preloadConfig.recordPreloadedAssets,\n          );\n          preloadResults.push({\n            remote,\n            remoteInfo,\n            preloadConfig,\n            id: preloadId,\n            results,\n          });\n        } catch (error) {\n          preloadResults.push({\n            remote,\n            remoteInfo,\n            preloadConfig,\n            id: preloadId,\n            results: [\n              {\n                url: remoteInfo.entry,\n                status: 'error',\n                resourceType: /\\.json(?:$|[?#])/i.test(remoteInfo.entry)\n                  ? 'manifest'\n                  : 'remoteEntry',\n                initiator: 'preloadRemote',\n                id: preloadId,\n                error,\n              },\n            ],\n          });\n        }\n      }),\n    );\n\n    const failedResults = preloadResults.flatMap((preloadResult) =>\n      preloadResult.results.filter(\n        (result) => result.status === 'error' || result.status === 'timeout',\n      ),\n    );\n    if (failedResults.length > 0) {\n      preloadError = new Error(\n        `preloadRemote failed to load ${failedResults.length} resource(s).`,\n      );\n      Object.assign(preloadError, {\n        results: preloadResults,\n        failedResults,\n      });\n    }\n\n    await this.hooks.lifecycle.afterPreloadRemote.emit({\n      preloadOps: preloadOptions,\n      options: host.options,\n      origin: host,\n      results: preloadResults,\n      error: preloadError,\n    });\n\n    if (preloadError) {\n      throw preloadError;\n    }\n  }\n\n  registerRemotes(remotes: Remote[], options?: { force?: boolean }): void {\n    const { host } = this;\n    remotes.forEach((remote) => {\n      this.registerRemote(remote, host.options.remotes, {\n        force: options?.force,\n      });\n    });\n  }\n\n  initRawContainer(\n    name: string,\n    url: string,\n    container: RemoteEntryExports,\n  ): Module {\n    const { host } = this;\n    const remoteInfo = getRemoteInfo({ name, entry: url });\n    const module = new Module({ host, remoteInfo });\n\n    module.remoteEntryExports = container;\n    host.moduleCache.set(name, module);\n\n    return module;\n  }\n\n  async getRemoteModuleAndOptions(options: { id: string }): Promise<{\n    module: Module;\n    moduleOptions: ModuleOptions;\n    remoteMatchInfo: LoadRemoteMatch;\n  }> {\n    const { host } = this;\n    const { id } = options;\n    let loadRemoteArgs;\n\n    try {\n      loadRemoteArgs = await this.hooks.lifecycle.beforeRequest.emit({\n        id,\n        options: host.options,\n        origin: host,\n      });\n    } catch (error) {\n      loadRemoteArgs = (await this.hooks.lifecycle.errorLoadRemote.emit({\n        id,\n        options: host.options,\n        origin: host,\n        from: 'runtime',\n        error,\n        lifecycle: 'beforeRequest',\n      })) as {\n        id: string;\n        options: Options;\n        origin: ModuleFederation;\n      };\n\n      if (!loadRemoteArgs) {\n        throw error;\n      }\n    }\n\n    const { id: idRes } = loadRemoteArgs;\n\n    const remoteSplitInfo = matchRemoteWithNameAndExpose(\n      host.options.remotes,\n      idRes,\n    );\n    if (!remoteSplitInfo) {\n      try {\n        error(\n          RUNTIME_004,\n          runtimeDescMap,\n          {\n            hostName: host.options.name,\n            requestId: idRes,\n          },\n          undefined,\n          optionsToMFContext(host.options),\n        );\n      } catch (matchError) {\n        await this.hooks.lifecycle.afterMatchRemote.emit({\n          id: idRes,\n          options: host.options,\n          error: matchError,\n          origin: host,\n        });\n        throw matchError;\n      }\n    }\n\n    const { remote: rawRemote } = remoteSplitInfo;\n    const remoteInfo = getRemoteInfo(rawRemote);\n    await this.hooks.lifecycle.afterMatchRemote.emit({\n      id: idRes,\n      ...remoteSplitInfo,\n      options: host.options,\n      remoteInfo,\n      origin: host,\n    });\n    const matchInfo =\n      await host.sharedHandler.hooks.lifecycle.afterResolve.emit({\n        id: idRes,\n        ...remoteSplitInfo,\n        options: host.options,\n        origin: host,\n        remoteInfo,\n      });\n\n    const { remote, expose } = matchInfo;\n    assert(\n      remote && expose,\n      `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${idRes}.`,\n    );\n    let module: Module | undefined = host.moduleCache.get(remote.name);\n\n    const moduleOptions: ModuleOptions = {\n      host: host,\n      remoteInfo,\n    };\n\n    if (!module) {\n      module = new Module(moduleOptions);\n      host.moduleCache.set(remote.name, module);\n    }\n    return {\n      module,\n      moduleOptions,\n      remoteMatchInfo: matchInfo,\n    };\n  }\n\n  registerRemote(\n    remote: Remote,\n    targetRemotes: Remote[],\n    options?: { force?: boolean },\n  ): void {\n    const { host } = this;\n    const normalizeRemote = () => {\n      if (remote.alias) {\n        // Validate if alias equals the prefix of remote.name and remote.alias, if so, throw an error\n        // As multi-level path references cannot guarantee unique names, alias being a prefix of remote.name is not supported\n        const findEqual = targetRemotes.find(\n          (item) =>\n            remote.alias &&\n            (item.name.startsWith(remote.alias) ||\n              item.alias?.startsWith(remote.alias)),\n        );\n        assert(\n          !findEqual,\n          `The alias ${remote.alias} of remote ${\n            remote.name\n          } is not allowed to be the prefix of ${\n            findEqual && findEqual.name\n          } name or alias`,\n        );\n      }\n      // Set the remote entry to a complete path\n      if ('entry' in remote) {\n        if (\n          isBrowserEnvValue &&\n          typeof window !== 'undefined' &&\n          !remote.entry.startsWith('http')\n        ) {\n          remote.entry = new URL(remote.entry, window.location.origin).href;\n        }\n      }\n      if (!remote.shareScope) {\n        remote.shareScope = DEFAULT_SCOPE;\n      }\n      if (!remote.type) {\n        remote.type = DEFAULT_REMOTE_TYPE;\n      }\n    };\n    this.hooks.lifecycle.beforeRegisterRemote.emit({ remote, origin: host });\n    const registeredRemote = targetRemotes.find(\n      (item) => item.name === remote.name,\n    );\n    if (!registeredRemote) {\n      normalizeRemote();\n      targetRemotes.push(remote);\n      this.hooks.lifecycle.registerRemote.emit({ remote, origin: host });\n    } else {\n      const messages = [\n        `The remote \"${remote.name}\" is already registered.`,\n        'Please note that overriding it may cause unexpected errors.',\n      ];\n      if (options?.force) {\n        // remove registered remote\n        this.removeRemote(registeredRemote);\n        normalizeRemote();\n        targetRemotes.push(remote);\n        this.hooks.lifecycle.registerRemote.emit({ remote, origin: host });\n        warn(messages.join(' '));\n      }\n    }\n  }\n\n  private removeRemote(remote: Remote): void {\n    try {\n      const { host } = this;\n      const { name } = remote;\n      const remoteIndex = host.options.remotes.findIndex(\n        (item) => item.name === name,\n      );\n      if (remoteIndex !== -1) {\n        host.options.remotes.splice(remoteIndex, 1);\n      }\n      const globalSnapshotKey = getInfoWithoutType(\n        CurrentGlobal.__FEDERATION__.moduleInfo,\n        getFMId(remote),\n      ).key;\n      delete CurrentGlobal.__FEDERATION__.moduleInfo[globalSnapshotKey];\n\n      if ('entry' in remote) {\n        host.snapshotHandler.manifestCache.delete(remote.entry);\n        delete Global.__FEDERATION__.__MANIFEST_LOADING__[remote.entry];\n      }\n\n      const { hostGlobalSnapshot } = getGlobalRemoteInfo(remote, host);\n      if (hostGlobalSnapshot) {\n        const remoteKey =\n          hostGlobalSnapshot &&\n          'remotesInfo' in hostGlobalSnapshot &&\n          hostGlobalSnapshot.remotesInfo &&\n          getInfoWithoutType(hostGlobalSnapshot.remotesInfo, remote.name).key;\n        if (remoteKey) {\n          delete hostGlobalSnapshot.remotesInfo[remoteKey];\n        }\n      }\n\n      const loadedModule = host.moduleCache.get(remote.name);\n      if (loadedModule) {\n        const remoteInfo = loadedModule.remoteInfo;\n        const key = remoteInfo.entryGlobalName as keyof typeof CurrentGlobal;\n\n        if (CurrentGlobal[key]) {\n          if (\n            Object.getOwnPropertyDescriptor(CurrentGlobal, key)?.configurable\n          ) {\n            delete CurrentGlobal[key];\n          } else {\n            // @ts-ignore\n            CurrentGlobal[key] = undefined;\n          }\n        }\n        const remoteEntryUniqueKey = getRemoteEntryUniqueKey(\n          loadedModule.remoteInfo,\n        );\n\n        if (globalLoading[remoteEntryUniqueKey]) {\n          delete globalLoading[remoteEntryUniqueKey];\n        }\n\n        // delete unloaded shared and instance\n        let remoteInsId = remoteInfo.buildVersion\n          ? composeKeyWithSeparator(remoteInfo.name, remoteInfo.buildVersion)\n          : remoteInfo.name;\n        const remoteInsIndex =\n          CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((ins) => {\n            if (remoteInfo.buildVersion) {\n              return ins.options.id === remoteInsId;\n            } else {\n              return ins.name === remoteInsId;\n            }\n          });\n        if (remoteInsIndex !== -1) {\n          const remoteIns =\n            CurrentGlobal.__FEDERATION__.__INSTANCES__[remoteInsIndex];\n          remoteInsId = remoteIns.options.id || remoteInsId;\n          const globalShareScopeMap = getGlobalShareScope();\n\n          let isAllSharedNotUsed = true;\n          const needDeleteKeys: Array<[string, string, string, string]> = [];\n          Object.keys(globalShareScopeMap).forEach((instId) => {\n            const shareScopeMap = globalShareScopeMap[instId];\n            shareScopeMap &&\n              Object.keys(shareScopeMap).forEach((shareScope) => {\n                const shareScopeVal = shareScopeMap[shareScope];\n                shareScopeVal &&\n                  Object.keys(shareScopeVal).forEach((shareName) => {\n                    const sharedPkgs = shareScopeVal[shareName];\n                    sharedPkgs &&\n                      Object.keys(sharedPkgs).forEach((shareVersion) => {\n                        const shared = sharedPkgs[shareVersion];\n                        if (\n                          shared &&\n                          typeof shared === 'object' &&\n                          shared.from === remoteInfo.name\n                        ) {\n                          if (shared.loaded || shared.loading) {\n                            shared.useIn = shared.useIn.filter(\n                              (usedHostName) =>\n                                usedHostName !== remoteInfo.name,\n                            );\n                            if (shared.useIn.length) {\n                              isAllSharedNotUsed = false;\n                            } else {\n                              needDeleteKeys.push([\n                                instId,\n                                shareScope,\n                                shareName,\n                                shareVersion,\n                              ]);\n                            }\n                          } else {\n                            needDeleteKeys.push([\n                              instId,\n                              shareScope,\n                              shareName,\n                              shareVersion,\n                            ]);\n                          }\n                        }\n                      });\n                  });\n              });\n          });\n\n          if (isAllSharedNotUsed) {\n            remoteIns.shareScopeMap = {};\n            delete globalShareScopeMap[remoteInsId];\n          }\n          needDeleteKeys.forEach(\n            ([insId, shareScope, shareName, shareVersion]) => {\n              delete globalShareScopeMap[insId]?.[shareScope]?.[shareName]?.[\n                shareVersion\n              ];\n            },\n          );\n          CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(remoteInsIndex, 1);\n        }\n\n        host.moduleCache.delete(remote.name);\n      }\n    } catch (err) {\n      logger.error(\n        `removeRemote failed: ${err instanceof Error ? err.message : String(err)}`,\n      );\n    }\n  }\n}\n", "import { isBrowserEnvValue } from '@module-federation/sdk';\nimport type {\n  CreateLinkHookReturnDom,\n  CreateScriptHookReturn,\n  GlobalModuleInfo,\n  ModuleInfo,\n} from '@module-federation/sdk';\nimport {\n  Options,\n  PreloadRemoteArgs,\n  RemoteEntryExports,\n  Remote,\n  Shared,\n  ShareInfos,\n  UserOptions,\n  RemoteInfo,\n  ShareScopeMap,\n  InitScope,\n  RemoteEntryInitOptions,\n  CallFrom,\n  ResourceLoadContext,\n  LoadShareExtraOptions,\n  SharedLoadContext,\n} from './type';\nimport { getBuilderId, registerPlugins, getRemoteEntry, error } from './utils';\nimport {\n  getShortErrorMsg,\n  RUNTIME_010,\n  runtimeDescMap,\n} from '@module-federation/error-codes';\nimport type { Module, RemoteModuleFactory } from './module';\nimport {\n  AsyncHook,\n  AsyncWaterfallHook,\n  PluginSystem,\n  SyncHook,\n  SyncWaterfallHook,\n} from './utils/hooks';\nimport { generatePreloadAssetsPlugin } from './plugins/generate-preload-assets';\nimport { snapshotPlugin } from './plugins/snapshot';\nimport { DEFAULT_SCOPE } from './constant';\nimport { SnapshotHandler } from './plugins/snapshot/SnapshotHandler';\nimport { DisabledSnapshotHandler } from './plugins/snapshot/disabled';\nimport { SharedHandler } from './shared';\nimport { DisabledSharedHandler } from './shared/disabled';\nimport { RemoteHandler } from './remote';\nimport { DisabledRemoteHandler } from './remote/disabled';\nimport { formatShareConfigs } from './utils/share';\n\n// Declare the global constant that will be defined by DefinePlugin\n// Default to true if not defined (e.g., when runtime-core is used outside of webpack)\n// so that snapshot functionality is included by default.\ndeclare const FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN: boolean;\ndeclare const FEDERATION_OPTIMIZE_NO_REMOTE: boolean;\ndeclare const FEDERATION_OPTIMIZE_NO_SHARED: boolean;\n\ntype BridgeHookContext = object;\ntype BridgeHookResult = {\n  context: BridgeHookContext;\n  result?: unknown;\n};\nconst USE_SNAPSHOT =\n  typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN === 'boolean'\n    ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN\n    : true; // Default to true (use snapshot) when not explicitly defined\nconst USE_REMOTE =\n  typeof FEDERATION_OPTIMIZE_NO_REMOTE === 'boolean'\n    ? !FEDERATION_OPTIMIZE_NO_REMOTE\n    : true;\nconst USE_SHARED =\n  typeof FEDERATION_OPTIMIZE_NO_SHARED === 'boolean'\n    ? !FEDERATION_OPTIMIZE_NO_SHARED\n    : true;\n\nexport class ModuleFederation {\n  options: Options;\n  hooks = new PluginSystem({\n    beforeInit: new SyncWaterfallHook<{\n      userOptions: UserOptions;\n      options: Options;\n      origin: ModuleFederation;\n      /**\n       * @deprecated shareInfo will be removed soon, please use userOptions directly!\n       */\n      shareInfo: ShareInfos;\n    }>('beforeInit'),\n    init: new SyncHook<\n      [\n        {\n          options: Options;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >(),\n    // maybe will change, temporarily for internal use only\n    beforeInitContainer: new AsyncWaterfallHook<{\n      shareScope: ShareScopeMap[string];\n      initScope: InitScope;\n      remoteEntryInitOptions: RemoteEntryInitOptions;\n      remoteInfo: RemoteInfo;\n      origin: ModuleFederation;\n    }>('beforeInitContainer'),\n    // maybe will change, temporarily for internal use only\n    initContainer: new AsyncWaterfallHook<{\n      shareScope: ShareScopeMap[string];\n      initScope: InitScope;\n      remoteEntryInitOptions: RemoteEntryInitOptions;\n      remoteInfo: RemoteInfo;\n      remoteEntryExports: RemoteEntryExports;\n      origin: ModuleFederation;\n      id?: string;\n      remoteSnapshot?: ModuleInfo;\n    }>('initContainer'),\n  });\n  version: string = __VERSION__;\n  name: string;\n  moduleCache: Map<string, Module> = new Map();\n  snapshotHandler: SnapshotHandler;\n  sharedHandler: SharedHandler;\n  remoteHandler: RemoteHandler;\n  shareScopeMap: ShareScopeMap;\n  loaderHook = new PluginSystem({\n    // FIXME: may not be suitable , not open to the public yet\n    getModuleInfo: new SyncHook<\n      [\n        {\n          target: Record<string, any>;\n          key: any;\n        },\n      ],\n      { value: any | undefined; key: string } | void\n    >(),\n    createScript: new SyncHook<\n      [\n        {\n          url: string;\n          attrs?: Record<string, any>;\n          /**\n           * The producer(remote) info bound to this resource.\n           * Only present when the loader is invoked in a remote-related context\n           * (e.g. preloadRemote / loading remoteEntry).\n           */\n          remoteInfo?: RemoteInfo;\n          resourceContext?: ResourceLoadContext;\n        },\n      ],\n      CreateScriptHookReturn\n    >(),\n    createLink: new SyncHook<\n      [\n        {\n          url: string;\n          attrs?: Record<string, any>;\n          /**\n           * The producer(remote) info bound to this resource.\n           * Only present when the loader is invoked in a remote-related context\n           * (e.g. preloadRemote / loading remoteEntry).\n           */\n          remoteInfo?: RemoteInfo;\n          resourceContext?: ResourceLoadContext;\n        },\n      ],\n      CreateLinkHookReturnDom\n    >(),\n    fetch: new AsyncHook<\n      [string, RequestInit, RemoteInfo?, ResourceLoadContext?],\n      Promise<Response> | void | false\n    >(),\n    loadEntryError: new AsyncHook<\n      [\n        {\n          getRemoteEntry: typeof getRemoteEntry;\n          origin: ModuleFederation;\n          remoteInfo: RemoteInfo;\n          remoteEntryExports?: RemoteEntryExports | undefined;\n          globalLoading: Record<\n            string,\n            Promise<void | RemoteEntryExports> | undefined\n          >;\n          uniqueKey: string;\n        },\n      ],\n      Promise<Promise<RemoteEntryExports | undefined> | undefined>\n    >(),\n    afterLoadEntry: new AsyncHook<\n      [\n        {\n          origin: ModuleFederation;\n          remoteInfo: RemoteInfo;\n          remoteEntryExports?: RemoteEntryExports | false | void;\n          resourceContext?: ResourceLoadContext;\n          cached?: boolean;\n          error?: unknown;\n          recovered?: boolean;\n        },\n      ],\n      void\n    >('afterLoadEntry'),\n    beforeInitRemote: new AsyncHook<\n      [\n        {\n          id?: string;\n          remoteInfo: RemoteInfo;\n          remoteSnapshot?: ModuleInfo;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('beforeInitRemote'),\n    afterInitRemote: new AsyncHook<\n      [\n        {\n          id?: string;\n          remoteInfo: RemoteInfo;\n          remoteSnapshot?: ModuleInfo;\n          remoteEntryExports?: RemoteEntryExports;\n          error?: unknown;\n          cached?: boolean;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterInitRemote'),\n    beforeGetExpose: new AsyncHook<\n      [\n        {\n          id: string;\n          expose: string;\n          moduleInfo: RemoteInfo;\n          remoteEntryExports: RemoteEntryExports;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('beforeGetExpose'),\n    afterGetExpose: new AsyncHook<\n      [\n        {\n          id: string;\n          expose: string;\n          moduleInfo: RemoteInfo;\n          remoteEntryExports: RemoteEntryExports;\n          moduleFactory?: RemoteModuleFactory;\n          error?: unknown;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterGetExpose'),\n    beforeExecuteFactory: new AsyncHook<\n      [\n        {\n          id: string;\n          expose: string;\n          moduleInfo: RemoteInfo;\n          loadFactory: boolean;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('beforeExecuteFactory'),\n    afterExecuteFactory: new AsyncHook<\n      [\n        {\n          id: string;\n          expose: string;\n          moduleInfo: RemoteInfo;\n          loadFactory: boolean;\n          exposeModule?: unknown;\n          error?: unknown;\n          origin: ModuleFederation;\n        },\n      ],\n      void\n    >('afterExecuteFactory'),\n    getModuleFactory: new AsyncHook<\n      [\n        {\n          remoteEntryExports: RemoteEntryExports;\n          expose: string;\n          moduleInfo: RemoteInfo;\n        },\n      ],\n      RemoteModuleFactory | Promise<RemoteModuleFactory | undefined> | undefined\n    >(),\n  });\n  bridgeHook = new PluginSystem({\n    beforeBridgeRender: new SyncHook<\n      [Record<string, any>, BridgeHookContext?],\n      void | Record<string, any>\n    >(),\n    afterBridgeRender: new SyncHook<\n      [Record<string, any>, BridgeHookResult?],\n      void | Record<string, any>\n    >(),\n    beforeBridgeDestroy: new SyncHook<\n      [Record<string, any>, BridgeHookContext?],\n      void | Record<string, any>\n    >(),\n    afterBridgeDestroy: new SyncHook<\n      [Record<string, any>, BridgeHookResult?],\n      void | Record<string, any>\n    >(),\n    afterBridgeRouteSync: new SyncHook<[BridgeHookResult], void>(),\n  });\n  moduleInfo?: GlobalModuleInfo[string];\n\n  constructor(userOptions: UserOptions) {\n    const plugins =\n      USE_REMOTE && USE_SNAPSHOT\n        ? [snapshotPlugin(), generatePreloadAssetsPlugin()]\n        : [];\n    // TODO: Validate the details of the options\n    // Initialize options with default values\n    const defaultOptions: Options = {\n      id: getBuilderId(),\n      name: userOptions.name,\n      plugins,\n      remotes: [],\n      shared: {},\n      inBrowser: isBrowserEnvValue,\n    };\n\n    this.name = userOptions.name;\n    this.options = defaultOptions;\n    this.snapshotHandler = (\n      USE_REMOTE ? new SnapshotHandler(this) : new DisabledSnapshotHandler()\n    ) as SnapshotHandler;\n    this.sharedHandler = (\n      USE_SHARED ? new SharedHandler(this) : new DisabledSharedHandler()\n    ) as SharedHandler;\n    this.remoteHandler = (\n      USE_REMOTE ? new RemoteHandler(this) : new DisabledRemoteHandler()\n    ) as RemoteHandler;\n    this.shareScopeMap = this.sharedHandler.shareScopeMap;\n    this.registerPlugins([\n      ...defaultOptions.plugins,\n      ...(userOptions.plugins || []),\n    ]);\n    this.options = this.formatOptions(defaultOptions, userOptions);\n  }\n\n  initOptions(userOptions: UserOptions): Options {\n    if (userOptions.name && userOptions.name !== this.options.name) {\n      error(getShortErrorMsg(RUNTIME_010, runtimeDescMap));\n    }\n    this.registerPlugins(userOptions.plugins);\n    const options = this.formatOptions(this.options, userOptions);\n\n    this.options = options;\n\n    return options;\n  }\n\n  async loadShare<T>(\n    pkgName: string,\n    extraOptions?: LoadShareExtraOptions,\n  ): Promise<false | (() => T | undefined)> {\n    return this.sharedHandler.loadShare(pkgName, extraOptions);\n  }\n\n  // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.\n  // 1. If the loaded shared already exists globally, then it will be reused\n  // 2. If lib exists in local shared, it will be used directly\n  // 3. If the local get returns something other than Promise, then it will be used directly\n  loadShareSync<T>(\n    pkgName: string,\n    extraOptions?: LoadShareExtraOptions,\n  ): () => T | never {\n    return this.sharedHandler.loadShareSync(pkgName, extraOptions);\n  }\n\n  initializeSharing(\n    shareScopeName = DEFAULT_SCOPE,\n    extraOptions?: {\n      initScope?: InitScope;\n      from?: CallFrom;\n      strategy?: Shared['strategy'];\n      context?: SharedLoadContext;\n    },\n  ): Array<Promise<void>> {\n    return this.sharedHandler.initializeSharing(shareScopeName, extraOptions);\n  }\n\n  initRawContainer(\n    name: string,\n    url: string,\n    container: RemoteEntryExports,\n  ): Module {\n    return this.remoteHandler.initRawContainer(name, url, container);\n  }\n\n  // eslint-disable-next-line max-lines-per-function\n  // eslint-disable-next-line @typescript-eslint/member-ordering\n  async loadRemote<T>(\n    id: string,\n    options?: { loadFactory?: boolean; from: CallFrom },\n  ): Promise<T | null> {\n    return this.remoteHandler.loadRemote(id, options);\n  }\n\n  // eslint-disable-next-line @typescript-eslint/member-ordering\n  async preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void> {\n    return this.remoteHandler.preloadRemote(preloadOptions);\n  }\n\n  initShareScopeMap(\n    scopeName: string,\n    shareScope: ShareScopeMap[string],\n    extraOptions: { hostShareScopeMap?: ShareScopeMap } = {},\n  ): void {\n    this.sharedHandler.initShareScopeMap(scopeName, shareScope, extraOptions);\n  }\n\n  formatOptions(globalOptions: Options, userOptions: UserOptions): Options {\n    const shared = USE_SHARED\n      ? formatShareConfigs(globalOptions, userOptions).allShareInfos\n      : {};\n    const { userOptions: userOptionsRes, options: globalOptionsRes } =\n      this.hooks.lifecycle.beforeInit.emit({\n        origin: this,\n        userOptions,\n        options: globalOptions,\n        shareInfo: shared,\n      });\n\n    const remotes = this.remoteHandler.formatAndRegisterRemote(\n      globalOptionsRes,\n      userOptionsRes,\n    );\n\n    const { allShareInfos } = this.sharedHandler.registerShared(\n      globalOptionsRes,\n      userOptionsRes,\n    );\n\n    const plugins = [...globalOptionsRes.plugins];\n\n    if (userOptionsRes.plugins) {\n      userOptionsRes.plugins.forEach((plugin) => {\n        if (!plugins.includes(plugin)) {\n          plugins.push(plugin);\n        }\n      });\n    }\n\n    const optionsRes: Options = {\n      ...globalOptions,\n      ...userOptions,\n      plugins,\n      remotes,\n      shared: allShareInfos,\n      id: userOptionsRes.id || globalOptions.id,\n    };\n\n    this.hooks.lifecycle.init.emit({\n      origin: this,\n      options: optionsRes,\n    });\n    return optionsRes;\n  }\n\n  registerPlugins(plugins: UserOptions['plugins']) {\n    this.options.plugins = registerPlugins(plugins, this);\n  }\n  registerRemotes(remotes: Remote[], options?: { force?: boolean }): void {\n    return this.remoteHandler.registerRemotes(remotes, options);\n  }\n\n  registerShared(shared: UserOptions['shared']) {\n    this.sharedHandler.registerShared(this.options, {\n      ...this.options,\n      shared,\n    });\n  }\n}\n", "import {\n  ModuleFederation,\n  type UserOptions,\n  CurrentGlobal,\n  getGlobalFederationConstructor,\n  setGlobalFederationInstance,\n  assert,\n  setGlobalFederationConstructor,\n} from '@module-federation/runtime-core';\nimport { runtimeDescMap, RUNTIME_009 } from '@module-federation/error-codes';\nimport { getGlobalFederationInstance } from './utils';\n\nexport {\n  loadScript,\n  loadScriptNode,\n  Module,\n  getRemoteEntry,\n  getRemoteInfo,\n  satisfy,\n  registerGlobalPlugins,\n  type ModuleFederationRuntimePlugin,\n  type RuntimePluginHooks,\n  type Federation,\n} from '@module-federation/runtime-core';\n\nexport { ModuleFederation };\n\nexport function createInstance(options: UserOptions) {\n  // Retrieve debug constructor\n  const ModuleFederationConstructor =\n    getGlobalFederationConstructor() || ModuleFederation;\n  const instance = new ModuleFederationConstructor({\n    id: `${options.name}@${options.version || Date.now()}`,\n    ...options,\n  });\n  setGlobalFederationInstance(instance);\n  return instance;\n}\n\nlet FederationInstance: ModuleFederation | null = null;\nexport function init(options: UserOptions): ModuleFederation {\n  // Retrieve the same instance with the same name\n  const instance = getGlobalFederationInstance(options.name, options.version);\n  const normalizedOptions = { ...options, id: options.id || '' };\n  if (!instance) {\n    FederationInstance = createInstance(normalizedOptions);\n    return FederationInstance;\n  } else {\n    // Merge options\n    instance.initOptions(normalizedOptions);\n    if (!FederationInstance) {\n      FederationInstance = instance;\n    }\n    return instance;\n  }\n}\n\nexport function loadRemote<T>(\n  ...args: Parameters<ModuleFederation['loadRemote']>\n): Promise<T | null> {\n  assert(FederationInstance, RUNTIME_009, runtimeDescMap);\n  const loadRemote: typeof FederationInstance.loadRemote<T> =\n    FederationInstance.loadRemote;\n  // eslint-disable-next-line prefer-spread\n  return loadRemote.apply(FederationInstance, args);\n}\n\nexport function loadShare<T>(\n  ...args: Parameters<ModuleFederation['loadShare']>\n): Promise<false | (() => T | undefined)> {\n  assert(FederationInstance, RUNTIME_009, runtimeDescMap);\n  // eslint-disable-next-line prefer-spread\n  const loadShare: typeof FederationInstance.loadShare<T> =\n    FederationInstance.loadShare;\n  return loadShare.apply(FederationInstance, args);\n}\n\nexport function loadShareSync<T>(\n  ...args: Parameters<ModuleFederation['loadShareSync']>\n): () => T | never {\n  assert(FederationInstance, RUNTIME_009, runtimeDescMap);\n  const loadShareSync: typeof FederationInstance.loadShareSync<T> =\n    FederationInstance.loadShareSync;\n  // eslint-disable-next-line prefer-spread\n  return loadShareSync.apply(FederationInstance, args);\n}\n\nexport function preloadRemote(\n  ...args: Parameters<ModuleFederation['preloadRemote']>\n): ReturnType<ModuleFederation['preloadRemote']> {\n  assert(FederationInstance, RUNTIME_009, runtimeDescMap);\n  // eslint-disable-next-line prefer-spread\n  return FederationInstance.preloadRemote.apply(FederationInstance, args);\n}\n\nexport function registerRemotes(\n  ...args: Parameters<ModuleFederation['registerRemotes']>\n): ReturnType<ModuleFederation['registerRemotes']> {\n  assert(FederationInstance, RUNTIME_009, runtimeDescMap);\n  // eslint-disable-next-line prefer-spread\n  return FederationInstance.registerRemotes.apply(FederationInstance, args);\n}\n\nexport function registerPlugins(\n  ...args: Parameters<ModuleFederation['registerPlugins']>\n): ReturnType<ModuleFederation['registerRemotes']> {\n  assert(FederationInstance, RUNTIME_009, runtimeDescMap);\n  // eslint-disable-next-line prefer-spread\n  return FederationInstance.registerPlugins.apply(FederationInstance, args);\n}\n\nexport function getInstance(): ModuleFederation | null;\nexport function getInstance(\n  finder: (instance: ModuleFederation) => boolean,\n): ModuleFederation | null;\nexport function getInstance(finder?: (instance: ModuleFederation) => boolean) {\n  if (!finder) {\n    return FederationInstance;\n  }\n\n  return CurrentGlobal.__FEDERATION__.__INSTANCES__.find(finder) || null;\n}\n\nexport function registerShared(\n  ...args: Parameters<ModuleFederation['registerShared']>\n): ReturnType<ModuleFederation['registerShared']> {\n  assert(FederationInstance, RUNTIME_009, runtimeDescMap);\n  // eslint-disable-next-line prefer-spread\n  return FederationInstance.registerShared.apply(FederationInstance, args);\n}\n\n// Inject for debug\nsetGlobalFederationConstructor(ModuleFederation);\n", "import { createInstance, satisfy, type ModuleFederation, type ModuleFederationRuntimePlugin } from '@module-federation/runtime';\nimport type {\n  ModuleFederationEntry,\n  ModuleFederationManifestV2,\n  DependencyInjector,\n  LoaderService,\n  ModuleResolver,\n  ContainerService,\n  PlatformService,\n  AssetDefinition,\n  ComponentDefinition,\n  ComponentGetter,\n} from '@/types';\n\ninterface RemoteDefinition {\n  id: string;\n  entry: string;\n  type?: string;\n  entryGlobalName?: string;\n  assetBase: string;\n}\n\nasync function loadRemote(platform: PlatformService, entry: ModuleFederationEntry): Promise<RemoteDefinition> {\n  let id = entry.id;\n\n  if (entry.url.endsWith('.json')) {\n    if (!entry.metaData) {\n      const manifest = await platform.loadJson<ModuleFederationManifestV2>(entry.url);\n      entry.exposes = manifest.exposes;\n      entry.shared = manifest.shared;\n      entry.remotes = manifest.remotes;\n      entry.metaData = manifest.metaData;\n    }\n\n    const { globalName, remoteEntry } = entry.metaData;\n    entry.id = globalName;\n    id = globalName;\n    return {\n      id,\n      entry: entry.url,\n      type: remoteEntry.type === 'module' ? 'module' : undefined,\n      entryGlobalName: globalName,\n      // avoid shared modules with the entry, as this module is also loaded lazily (see module-lazy.ts)\n      assetBase: new URL('./', entry.url).href,\n    };\n  }\n\n  const type = entry.type === 'esm' ? 'module' : entry.type;\n  const entryGlobalName = id.replace(/^@/, '').replace('/', '-').replace(/\\-/g, '_');\n\n  return {\n    id,\n    entry: entry.url,\n    type,\n    entryGlobalName,\n    assetBase: entry.url,\n  };\n}\n\nfunction registerPicardShares(\n  federation: ModuleFederation,\n  loader: LoaderService,\n  parent: string,\n  registeredShares: Set<string>,\n) {\n  type Shares = NonNullable<Parameters<ModuleFederation['registerShared']>[0]>;\n  type ShareOptions = Exclude<Shares[string], unknown[]>;\n  const shares: Record<string, Array<ShareOptions>> = {};\n\n  for (const { id, name, version } of loader.list()) {\n    if (registeredShares.has(id)) {\n      continue;\n    }\n\n    (shares[name] ||= []).push({\n      version,\n      strategy: 'loaded-first',\n      shareConfig: { requiredVersion: false },\n      get: async () => async () => loader.import(id, parent),\n    });\n    registeredShares.add(id);\n  }\n\n  if (Object.keys(shares).length > 0) {\n    federation.registerShared(shares);\n  }\n}\n\nfunction registerFederationShares(federation: ModuleFederation, loader: LoaderService) {\n  const existing = new Set(loader.list().map(({ id }) => id));\n  const resolvers: Record<string, () => ModuleResolver> = {};\n\n  for (const scope of Object.values(federation.shareScopeMap)) {\n    for (const [name, versions] of Object.entries(scope)) {\n      for (const [version, share] of Object.entries(versions)) {\n        const id = `${name}@${version}`;\n\n        if (!existing.has(id)) {\n          resolvers[id] = () => async () => {\n            const { factory } = await loadFederationShare(federation, name, version);\n            return factory && factory();\n          };\n          existing.add(id);\n        }\n      }\n    }\n  }\n\n  loader.registerResolvers(resolvers);\n}\n\nasync function loadFederationShare(federation: ModuleFederation, name: string, versionRange: string) {\n  let selectedVersion: string | undefined;\n  const factory = await federation.loadShare(name, {\n    resolver(shares) {\n      const candidates = new Map<string, (typeof federation.shareScopeMap)['default'][string][string]>();\n\n      for (const share of [...(shares || []), ...Object.values(federation.shareScopeMap.default?.[name] || {})]) {\n        if (!candidates.has(share.version)) {\n          candidates.set(share.version, share);\n        }\n      }\n\n      const available = [...candidates.values()];\n      const selected = available.find((share) => satisfy(share.version, versionRange));\n\n      if (!selected) {\n        throw new Error(`No shared version of \"${name}\" satisfies \"${versionRange}\".`);\n      }\n\n      selectedVersion = selected.version;\n      return {\n        ...selected,\n        shareConfig: { ...selected.shareConfig, requiredVersion: selected.version, singleton: false },\n      };\n    },\n  });\n\n  return { factory, version: selectedVersion };\n}\n\nfunction registerRemote(federation: ModuleFederation, remote: RemoteDefinition, registeredRemotes: Map<string, string>) {\n  const existingEntry = registeredRemotes.get(remote.id);\n\n  if (existingEntry === remote.entry) {\n    return;\n  }\n\n  const remotes = [\n    {\n      name: remote.id,\n      entry: remote.entry,\n      ...(remote.type ? { type: remote.type } : {}),\n      ...(remote.entryGlobalName ? { entryGlobalName: remote.entryGlobalName } : {}),\n    },\n  ];\n\n  if (existingEntry) {\n    federation.registerRemotes(remotes, { force: true });\n  } else {\n    federation.registerRemotes(remotes);\n  }\n\n  registeredRemotes.set(remote.id, remote.entry);\n}\n\nconst legacyExposePlugin: ModuleFederationRuntimePlugin = {\n  name: 'picard-legacy-exposes',\n  getModuleFactory({ expose, remoteEntryExports }) {\n    // attach the rejection handler synchronously; awaiting (or Promise.resolve) a non-native promise\n    // (e.g., from zone.js) attaches it only in a later microtask, which reports the rejection as unhandled\n    const factory: Promise<() => any> = remoteEntryExports.get(expose);\n    return factory.then(undefined, (error) => {\n      if (expose.startsWith('./') && error instanceof Error && error.message.includes('does not exist in container')) {\n        return remoteEntryExports.get(expose.substring(2));\n      }\n\n      throw error;\n    });\n  },\n};\n\nfunction findHostFederation(origin: ModuleFederation): ModuleFederation | undefined {\n  // e.g., the runtime of an application bundled with Module Federation (rspack, webpack, Vite)\n  const instances: Array<ModuleFederation> = (globalThis as any).__FEDERATION__?.__INSTANCES__ || [];\n  return instances.find((instance) => instance !== origin);\n}\n\nconst sharedScopePlugin: ModuleFederationRuntimePlugin = {\n  name: 'picard-shared-scope',\n  beforeInitContainer(args) {\n    const { origin, remoteEntryInitOptions } = args;\n    const host = findHostFederation(origin);\n\n    if (!host) {\n      return args;\n    }\n\n    // a container can only be initialized with a single share scope, but the remotes\n    // of the page's application may also be used by Picard.js - so share its scope\n    const [scopeName = 'default'] = ([] as Array<string>).concat(remoteEntryInitOptions.shareScopeKeys);\n    const hostScope = (host.shareScopeMap[scopeName] ||= {});\n    const ownScope = origin.shareScopeMap[scopeName];\n\n    if (ownScope !== hostScope) {\n      // keep the shares registered by Picard.js\n      for (const [name, versions] of Object.entries(ownScope || {})) {\n        hostScope[name] = { ...versions, ...hostScope[name] };\n      }\n\n      origin.initShareScopeMap(scopeName, hostScope);\n    }\n\n    return { ...args, shareScope: hostScope };\n  },\n};\n\nfunction loadExposed(federation: ModuleFederation, loader: LoaderService, remote: RemoteDefinition, name: string) {\n  return federation.loadRemote(`${remote.id}/${name}`).then((module) => {\n    registerFederationShares(federation, loader);\n    return (module as any)?.default || module;\n  });\n}\n\nasync function loadContainerV2(\n  federation: ModuleFederation,\n  platform: PlatformService,\n  loader: LoaderService,\n  registeredRemotes: Map<string, string>,\n  registeredShares: Set<string>,\n  entry: ModuleFederationEntry,\n): Promise<ComponentGetter> {\n  const assets: Array<AssetDefinition> = [];\n  const components: Array<ComponentDefinition> = [];\n  const componentRefs: Record<string, { component: undefined | Promise<any> }> = {};\n  const remote = await loadRemote(platform, entry);\n\n  registerPicardShares(federation, loader, remote.entry, registeredShares);\n  registerRemote(federation, remote, registeredRemotes);\n\n  for (const item of entry.exposes || []) {\n    const name = item.name;\n    components.push({ name });\n    componentRefs[name] = { component: undefined };\n\n    for (const path of item.assets.css.sync) {\n      assets.push({\n        type: 'css',\n        url: new URL(path, remote.assetBase).href,\n      });\n    }\n  }\n\n  return {\n    async load(name) {\n      const componentRef = componentRefs[name];\n\n      if (!componentRef) {\n        return undefined;\n      }\n\n      if (!componentRef.component) {\n        componentRef.component = loadExposed(federation, loader, remote, name);\n      }\n\n      return await componentRef.component;\n    },\n    getComponents() {\n      return components;\n    },\n    getAssets() {\n      return assets;\n    },\n  };\n}\n\nasync function loadContainerV1(\n  federation: ModuleFederation,\n  platform: PlatformService,\n  loader: LoaderService,\n  registeredRemotes: Map<string, string>,\n  registeredShares: Set<string>,\n  entry: ModuleFederationEntry,\n): Promise<ComponentGetter> {\n  const componentRefs: Record<string, { component: undefined | Promise<any> }> = {};\n  const remote = await loadRemote(platform, entry);\n\n  registerPicardShares(federation, loader, remote.entry, registeredShares);\n  registerRemote(federation, remote, registeredRemotes);\n\n  return {\n    async load(name) {\n      let componentRef = componentRefs[name];\n\n      if (!componentRef) {\n        componentRef = {\n          component: loadExposed(federation, loader, remote, name).catch((error) => {\n            // v1 containers cannot be inspected; probing for a module they do not expose is expected\n            if (!/does not exist in container/.test(error?.message)) {\n              console.error(`Failed to load federated module \"${remote.id}/${name}\".`, error);\n            }\n\n            return undefined;\n          }),\n        };\n\n        componentRefs[name] = componentRef;\n      }\n\n      return await componentRef.component;\n    },\n    getComponents() {\n      return [];\n    },\n    getAssets() {\n      return [];\n    },\n  };\n}\n\nfunction getRuntime(entry: ModuleFederationEntry) {\n  const runtime = entry.runtime;\n\n  if (runtime) {\n    return runtime;\n  } else if (!entry.id || entry.url.endsWith('.json')) {\n    return '2.0';\n  } else {\n    return '1.0';\n  }\n}\n\nfunction loadContainer(\n  federation: ModuleFederation,\n  platform: PlatformService,\n  loader: LoaderService,\n  registeredRemotes: Map<string, string>,\n  registeredShares: Set<string>,\n  entry: ModuleFederationEntry,\n): Promise<ComponentGetter> {\n  switch (getRuntime(entry)) {\n    case '2.0':\n      return loadContainerV2(federation, platform, loader, registeredRemotes, registeredShares, entry);\n    case '1.0':\n    case '1.5':\n    default:\n      return loadContainerV1(federation, platform, loader, registeredRemotes, registeredShares, entry);\n  }\n}\n\nexport interface ModuleFederationService extends ContainerService {\n  /**\n   * Resolves the given version range of a package to an exact\n   * dependency ID using Module Federation's share negotiation.\n   */\n  resolvePackage(name: string, versionRange: string, parent?: string): Promise<string | undefined>;\n}\n\nexport function createModuleFederation(injector: DependencyInjector): ModuleFederationService {\n  const loader = injector.get('loader');\n  const platform = injector.get('platform');\n  const federation = createInstance({ name: 'picard', remotes: [], plugins: [legacyExposePlugin, sharedScopePlugin] });\n  const registeredRemotes = new Map<string, string>();\n  const registeredShares = new Set<string>();\n\n  const resolvePackage = async (name: string, versionRange: string, parent?: string) => {\n    registerPicardShares(federation, loader, parent || '', registeredShares);\n    const { factory, version } = await loadFederationShare(federation, name, versionRange);\n\n    if (!factory || !version) {\n      return undefined;\n    }\n\n    const id = `${name}@${version}`;\n    loader.registerResolvers({\n      [id]: () => async () => factory(),\n    });\n    return id;\n  };\n\n  loader.setPackageResolver(resolvePackage);\n\n  return {\n    createContainer(entry: ModuleFederationEntry) {\n      return loadContainer(federation, platform, loader, registeredRemotes, registeredShares, entry);\n    },\n    resolvePackage,\n  };\n}", "import { getUrl } from '@/common/utils/url';\nimport type {\n  NativeFederationEntry,\n  NativeFederationManifest,\n  ContainerService,\n  DependencyInjector,\n  AssetDefinition,\n  ComponentDefinition,\n  LoaderService,\n  EsmService,\n} from '@/types';\n\nfunction setupDependencies(\n  loader: LoaderService,\n  esm: EsmService,\n  entry: NativeFederationEntry,\n  depMap: Record<string, string>,\n) {\n  const { dependencies, url } = entry;\n\n  if (dependencies.length > 0) {\n    loader.registerResolvers(\n      dependencies.reduce((p, c) => {\n        const depUrl = getUrl(c.outFileName, url);\n        const id = `${c.packageName}@${c.version}`;\n        depMap[c.packageName] = `${c.packageName}@${c.requiredVersion}`;\n        p[id] = () => esm.load(depUrl, depMap, url);\n        return p;\n      }, {}),\n    );\n  }\n\n  loader.registerModule(url, {});\n}\n\nfunction inspect(entry: NativeFederationEntry) {\n  const assets: Array<AssetDefinition> = [];\n  const components: Array<ComponentDefinition> = [];\n  const componentRefs: Record<string, { url: string; component: undefined | Promise<any> }> = {};\n  const { exposes, url } = entry;\n\n  for (const { key, outFileName } of exposes) {\n    const name = key.substring(2);\n\n    if (/\\.m?js$/.test(outFileName)) {\n      components.push({ name });\n      componentRefs[name] = {\n        url: getUrl(outFileName, url),\n        component: undefined,\n      };\n    } else if (/\\.css$/.test(outFileName)) {\n      assets.push({\n        url: getUrl(outFileName, url),\n        type: 'css',\n      });\n    }\n  }\n\n  return [components, componentRefs, assets] as const;\n}\n\ninterface NativeFederationLoadRemoteOptions {\n  remoteName: string;\n  exposedModule: string;\n}\n\nexport function createNativeFederation(injector: DependencyInjector): ContainerService {\n  const loader = injector.get('loader');\n  const platform = injector.get('platform');\n  const esm = injector.get('esm');\n\n  // shared dependency ranges (e.g., \"react@^18\") are resolved via Module Federation's share negotiation\n  injector.instantiate('format.module');\n\n  loader.registerResolvers({\n    '@softarc/native-federation': () => () => ({\n      async loadRemoteModule(opts: NativeFederationLoadRemoteOptions) {\n        const { exposedModule, remoteName } = opts;\n        const scope = injector.get('scope');\n        const component = await scope.getComponent({\n          remoteName,\n          remoteType: 'esm',\n          format: 'native',\n          name: exposedModule,\n        });\n        return component.exports;\n      },\n    }),\n  });\n\n  return {\n    async createContainer(entry: NativeFederationEntry) {\n      const depMap: Record<string, string> = {};\n      const { url } = entry;\n\n      if (!entry.exposes || !entry.dependencies) {\n        const manifest = await platform.loadJson<NativeFederationManifest>(url);\n        entry.exposes = manifest.exposes;\n        entry.dependencies = manifest.shared;\n      }\n\n      setupDependencies(loader, esm, entry, depMap);\n      const [components, componentRefs, assets] = inspect(entry);\n\n      return {\n        async load(key: string) {\n          const name = key.startsWith('./') ? key.substring(2) : key;\n          const componentRef = componentRefs[name];\n\n          if (!componentRef) {\n            return undefined;\n          }\n\n          if (!componentRef.component) {\n            componentRef.component = esm.load(componentRef.url, depMap, url).then((c) => c?.default || c);\n          }\n\n          return await componentRef.component;\n        },\n        getComponents() {\n          return components;\n        },\n        getAssets() {\n          return assets;\n        },\n      };\n    },\n  };\n}\n", "import { getUrl } from '@/common/utils/url';\nimport type {\n  AssetDefinition,\n  ComponentDefinition,\n  ContainerService,\n  DependencyInjector,\n  PiletManifest,\n  PiletApi,\n  PiletEntry,\n} from '@/types';\n\nexport function createPilet(injector: DependencyInjector): ContainerService {\n  const loader = injector.get('loader');\n  const plugins = injector.getAll('pilet');\n  const platform = injector.get('platform');\n  const events = injector.get('events');\n\n  return {\n    async createContainer(entry: PiletEntry) {\n      const components: Array<ComponentDefinition> = [];\n      const componentRefs: Record<string, any> = {};\n      const assets: Array<AssetDefinition> = [];\n\n      if (!entry.name) {\n        const manifest = await platform.loadJson<PiletManifest>(entry.url);\n        const { name, version, main, dependencies = {}, spec, config, integrity, custom } = manifest;\n        const url = getUrl(main, entry.url);\n        Object.assign(entry, { name, version, dependencies, spec, config, url, integrity, custom });\n      }\n\n      loader.registerUrls(entry.dependencies);\n      const app = await loader.load(entry.url);\n\n      if (app && 'setup' in app) {\n        const basePath = getUrl('.', entry.url);\n        const api: PiletApi = {\n          ...events,\n          meta: {\n            basePath,\n          },\n          registerComponent(name: string, component: any, opts: any = {}) {\n            const { type, ...rest } = opts;\n            const meta = { ...rest, api };\n            componentRefs[name] = component;\n            components.push({ name, type, meta });\n          },\n        };\n\n        if (Array.isArray(app.styles)) {\n          const styleSheets = app.styles.map((style) => ({\n            url: getUrl(style, basePath),\n            type: 'css',\n          }));\n          assets.push(...styleSheets);\n        }\n\n        plugins.forEach((plugin) => plugin.extend(api));\n        await app.setup(api);\n      }\n\n      return {\n        async load(name) {\n          return componentRefs[name];\n        },\n        getComponents() {\n          return components;\n        },\n        getAssets() {\n          return assets;\n        },\n      };\n    },\n  };\n}\n", "import { emptyLifecycle, createLazyLifecycle } from '@/common/utils/lifecycle';\nimport type { ConverterService, ComponentLifecycle } from '@/types';\n\nexport function createDefaultConverter(): ConverterService {\n  return {\n    convert(component: Partial<ComponentLifecycle> | (() => Promise<Partial<ComponentLifecycle>>) = {}) {\n      if (typeof component === 'function') {\n        return createLazyLifecycle(component);\n      }\n\n      return {\n        ...emptyLifecycle,\n        ...component,\n      };\n    },\n  };\n}\n", "import { emptyLifecycle } from '@/common/utils/lifecycle';\nimport type { ConverterService } from '@/types';\n\ninterface HtmlLocals {\n  queue: Promise<void>;\n  container: HTMLElement;\n}\n\nfunction updateContent(content: string | Promise<string>, locals: HtmlLocals) {\n  const queue: Promise<void> = locals.queue;\n  const container: HTMLElement = locals.container;\n\n  if (typeof content === 'string') {\n    container.innerHTML = content;\n  } else if (content instanceof Promise) {\n    locals.queue = queue\n      .then(() => content)\n      .then((c) => {\n        container.innerHTML = c;\n      });\n  }\n}\n\nexport function createHtmlConverter(): ConverterService {\n  return {\n    convert(html: string | ((props: any) => Promise<string>)) {\n      return {\n        ...emptyLifecycle,\n        mount(container, props, locals) {\n          locals.queue = Promise.resolve();\n          locals.container = container;\n          const content = typeof html === 'function' ? html(props) : html;\n          updateContent(content, locals);\n        },\n        unmount() {},\n        update(props, locals) {\n          if (typeof html === 'function') {\n            const content = html(props);\n            updateContent(content, locals);\n          }\n        },\n        async stringify(props) {\n          return typeof html === 'function' ? await html(props) : html;\n        },\n      };\n    },\n  };\n}\n", "import { tryJson } from '@/common/utils/json';\nimport type { DependencyInjector, SlotBehaviorService } from '@/types';\n\nexport function createSlotBehaviorForRouter(injector: DependencyInjector): SlotBehaviorService {\n  const router = injector.get('router');\n\n  return {\n    apply({ name, data }) {\n      const exData = tryJson(data, {});\n      const match = router.matchRoute(name);\n\n      if (match) {\n        return [match.name, { ...exData, ...match.data }];\n      }\n\n      return [name, exData];\n    },\n  };\n}\n", "export default {\"picard.js\":\"function re(e){let t=e.get(\\\"config\\\"),{fragmentUrl:r}=t;return{async load(n,o){let s=Object.entries(o||{}).map(([m,y])=>`${encodeURIComponent(m)}=${encodeURIComponent(y)}`).join(\\\"&\\\"),d=s?`?${s}`:\\\"\\\",p=btoa(n);return(await fetch(`${r}/${p}${d}`,{method:\\\"GET\\\"})).text()}}}var st=/^[$_\\\\p{ID_Start}]$/u,it=/^[$\\\\u200c\\\\u200d\\\\p{ID_Continue}]$/u,at={\\\"!\\\":\\\"!\\\",\\\"@\\\":\\\"@\\\",\\\";\\\":\\\";\\\",\\\",\\\":\\\",\\\",\\\"*\\\":\\\"*\\\",\\\"+\\\":\\\"+\\\",\\\"?\\\":\\\"?\\\",\\\"{\\\":\\\"{\\\",\\\"}\\\":\\\"}\\\"};function se(e){return e}function ct(e,t){return e.length===t.length}function dt(e){return(t,r)=>r.length===t.length||t.slice(r.length,r.length+e.length)===e}function ut(e){let t=[...e],r=[],n=0;for(;n<t.length;){let o=t[n],s=at[o];if(s){r.push({type:s,index:n++,value:o});continue}if(o===\\\"\\\\\\\\\\\"){r.push({type:\\\"ESCAPED\\\",index:n++,value:t[n++]});continue}if(o===\\\":\\\"){let d=\\\"\\\";if(st.test(t[++n]))for(d+=t[n];it.test(t[++n]);)d+=t[n];else if(t[n]==='\\\"'){let p=n;for(;n<t.length;){if(t[++n]==='\\\"'){n++,p=0;break}t[n]===\\\"\\\\\\\\\\\"?d+=t[++n]:d+=t[n]}if(p)throw new TypeError(`Unterminated quote at ${p}`)}if(!d)throw new TypeError(`Missing parameter name at ${n}`);r.push({type:\\\"NAME\\\",index:n,value:d});continue}if(o===\\\"(\\\"){let d=n++,p=1,l=\\\"\\\";if(t[n]===\\\"?\\\")throw new TypeError(`Pattern cannot start with \\\"?\\\" at ${n}`);for(;n<t.length;){if(t[n]===\\\"\\\\\\\\\\\"){l+=t[n++]+t[n++];continue}if(t[n]===\\\")\\\"){if(p--,p===0){n++;break}}else if(t[n]===\\\"(\\\"&&(p++,t[n+1]!==\\\"?\\\"))throw new TypeError(`Capturing groups are not allowed at ${n}`);l+=t[n++]}if(p)throw new TypeError(`Unbalanced pattern at ${d}`);if(!l)throw new TypeError(`Missing pattern at ${d}`);r.push({type:\\\"PATTERN\\\",index:n,value:l});continue}if(o===\\\")\\\")throw new TypeError(`Unmatched ) at ${n}`);r.push({type:\\\"CHAR\\\",index:n,value:t[n++]})}return r.push({type:\\\"END\\\",index:n,value:\\\"\\\"}),new j(r)}var j=class{constructor(t){this.tokens=t}tokens;index=0;peek(){return this.tokens[this.index]}tryConsume(t){let r=this.peek();if(r.type===t)return this.index++,r.value}consume(t){let r=this.tryConsume(t);if(r!==void 0)return r;let{type:n,index:o}=this.peek();throw new TypeError(`Unexpected ${n} at ${o}, expected ${t}`)}text(){let t=\\\"\\\",r;for(;r=this.tryConsume(\\\"CHAR\\\")||this.tryConsume(\\\"ESCAPED\\\");)t+=r;return t}modifier(){return this.tryConsume(\\\"?\\\")||this.tryConsume(\\\"*\\\")||this.tryConsume(\\\"+\\\")}},q=class{constructor(t,r){this.tokens=t;this.delimiter=r}tokens;delimiter};function pt(e,t={}){let{encodePath:r=se,delimiter:n=r(\\\"/\\\")}=t,o=[],s=ut(e),d=0;do{let p=s.text();p&&o.push(r(p));let l=s.tryConsume(\\\"NAME\\\"),m=s.tryConsume(\\\"PATTERN\\\");if(l||m){o.push({name:l||String(d++),pattern:m});let a=s.peek();if(a.type===\\\"*\\\")throw new TypeError(`Unexpected * at ${a.index}, you probably want \\\\`/*\\\\` or \\\\`{/:foo}*\\\\``);continue}if(s.tryConsume(\\\"*\\\")){o.push({name:String(d++),pattern:`${z(k(n))}*`,modifier:\\\"*\\\",separator:n});continue}if(s.tryConsume(\\\"{\\\")){let a=s.text(),u=s.tryConsume(\\\"NAME\\\"),f=s.tryConsume(\\\"PATTERN\\\"),h=s.text(),v=s.tryConsume(\\\";\\\")&&s.text();s.consume(\\\"}\\\");let i=s.modifier();o.push({name:u||(f?String(d++):\\\"\\\"),prefix:r(a),suffix:r(h),pattern:f,modifier:i,separator:v});continue}s.consume(\\\"END\\\");break}while(!0);return new q(o,n)}function lt(e){return e.modifier===\\\"+\\\"||e.modifier===\\\"*\\\"}function ft(e,t={}){let{decode:r=decodeURIComponent,end:n=!0}=t,o=yt(e,t),s=o.keys.map(p=>{if(r&&(p.modifier===\\\"+\\\"||p.modifier===\\\"*\\\")){let{prefix:l=\\\"\\\",suffix:m=\\\"\\\",separator:y=m+l}=p;return c=>c.split(y).map(r)}return r||se}),d=n?ct:dt(e.delimiter);return Object.assign(function(l){let m=o.exec(l);if(!m)return!1;let{0:y}=m;if(!d(l,y))return!1;let c=Object.create(null);for(let a=1;a<m.length;a++){if(m[a]===void 0)continue;let u=o.keys[a-1],f=s[a-1];c[u.name]=f(m[a])}return{path:y,params:c}},{re:o})}function mt(e,t={}){return ft(pt(e,t),t)}function k(e){return e.replace(/[.+*?^${}()[\\\\]|/\\\\\\\\]/g,\\\"\\\\\\\\$&\\\")}function gt(e){return e.sensitive?\\\"s\\\":\\\"is\\\"}function yt(e,t){let r=gt(t),n=[],o=ht(e,n),s=new RegExp(`^${o.join(\\\"\\\")}`,r);return Object.assign(s,{keys:n})}function ht(e,t){let r=k(e.delimiter),n=Array(e.tokens.length),o=\\\"\\\",s=e.tokens.length;for(;s--;){let d=e.tokens[s];if(typeof d==\\\"string\\\"){n[s]=o=k(d);continue}let{prefix:p=\\\"\\\",suffix:l=\\\"\\\",separator:m=l+p,modifier:y=\\\"\\\"}=d,c=k(p),a=k(l);if(d.name){let u=d.pattern||\\\"\\\";if(t.unshift(d),lt(d)){let f=y===\\\"*\\\"?\\\"?\\\":\\\"\\\",h=k(m);if(!h)throw new TypeError(`Missing separator for \\\"${d.name}\\\"`);u||=`${z(r,h,a||o)}+`,n[s]=`(?:${c}((?:${u})(?:${h}(?:${u}))*)${a})${f}`}else u||=`${z(r,a||o)}+`,n[s]=`(?:${c}(${u})${a})${y}`;o=c||u}else n[s]=`(?:${c}${a})${y}`,o=`${c}${a}`}return n}function z(...e){return`(?:(?!${Array.from(new Set(e)).filter(Boolean).join(\\\"|\\\")}).)`}function oe(e){return e.map(t=>mt(t))}function ie(e){let t=[],r=oe(t);return n=>{if(t.length===0){let o=e();t.push(...o),r.push(...oe(o))}for(let o=0;o<r.length;o++){let s=r[o],d=s(n);if(d)return[t[o],d.params]}}}function ae(e){let t=history[e];return function(...r){let n=t.apply(this,r),o=new Event(e.toLowerCase());return window.dispatchEvent(o),n}}function ce(e,t){history.pushState(t,\\\"\\\",e)}function vt(){window.scrollTo(0,0)}var D=\\\"page:\\\";function de(e){let t=e.get(\\\"scope\\\"),{slotName:r}=e.get(\\\"config\\\"),n=`${r}[rel=router]`;function o(l){let m=document.querySelector(n);if(m){let y=location.pathname,c=l&&l.type!==\\\"popstate\\\";m.setAttribute(\\\"name\\\",`${D}${y}`),c&&vt()}}function s(l){let m=l.target instanceof Element&&l.target.closest(\\\"a\\\");m&&m instanceof HTMLAnchorElement&&m.href&&(!m.target||m.target===\\\"_self\\\")&&m.origin===location.origin&&!m.hasAttribute(\\\"download\\\")&&l.button===0&&!l.metaKey&&!l.ctrlKey&&!l.altKey&&!l.shiftKey&&!l.defaultPrevented&&document.querySelector(n)&&(l.preventDefault(),ce(m.href,{}))}function d(){let l=t.readState();return Object.entries(l.components).filter(([m,y])=>y.length&&m.startsWith(D)).map(([m])=>m.substring(D.length))}history.pushState=ae(\\\"pushState\\\"),history.replaceState=ae(\\\"replaceState\\\"),window.addEventListener(\\\"popstate\\\",o),window.addEventListener(\\\"pushstate\\\",o),window.addEventListener(\\\"replacestate\\\",o),document.addEventListener(\\\"click\\\",s),o();let p=ie(d);return{dispose(){window.removeEventListener(\\\"popstate\\\",o),window.removeEventListener(\\\"pushstate\\\",o),window.removeEventListener(\\\"replacestate\\\",o),document.removeEventListener(\\\"click\\\",s)},findRoutes:d,navigate:ce,matchRoute(l){if(l.startsWith(D)){let m=l.substring(D.length),y=p(m);if(y){let[c,a]=y;return{name:`${D}${c}`,data:a}}}}}}function H(e,t){if(e)try{return JSON.parse(e)}catch{}return t}var R=\\\"name\\\",L=\\\"fallback-template-id\\\",G=\\\"item-template-id\\\",W=\\\"loading-template-id\\\",St=\\\"order-by\\\",J=\\\"reverse-order\\\",ue=\\\"remote-name\\\",pe=\\\"remote-type\\\",$=\\\"source\\\",le=\\\"format\\\",bt=\\\"framework\\\",fe=\\\"client\\\",me=\\\"hydrate\\\",E=\\\"data\\\",K=\\\"cid\\\";function ge(){let e=[],t=n=>e.shift()?.(n),r=Promise.resolve();return{enqueue(n){e.push(n),r=r.then(t)},reset(){e.splice(0,e.length)}}}function ye(e){let t=document.createElement(\\\"link\\\");return t.href=e.url,t.rel=\\\"stylesheet\\\",t.dataset.origin=e.origin,t}function he(e,t){if(e.length>0){let r=B();r.append(...e),document.head.insertBefore(r,t)}}function B(){return document.createDocumentFragment()}function I(e){if(!e.content?.hasChildNodes()){let t=B();return t.append(...e.childNodes),t}return e.content}function Pt(e,t,r){if(t instanceof HTMLTemplateElement){let n=B(),o=I(t);return e.childNodes.forEach(s=>{let d=s.cloneNode(!0),p=o.cloneNode(!0);p.querySelector(\\\"slot\\\")?.replaceWith(d),r.push(d),n.appendChild(p)}),n}return e.childNodes.forEach(n=>r.push(n)),e}function ve(e){let t=requestAnimationFrame(()=>{if(!e.hasChildNodes()){let r=e.getAttribute(W)||\\\"\\\",n=r&&document.getElementById(r);n instanceof HTMLTemplateElement&&e.appendChild(I(n).cloneNode(!0))}});return()=>cancelAnimationFrame(t)}function Se(e){return typeof e==\\\"string\\\"?e:JSON.stringify(e)}function be(e){let t=e.getAttribute(L)||\\\"\\\",r=t&&document.getElementById(t);r instanceof HTMLTemplateElement&&e.appendChild(I(r).cloneNode(!0))}function Pe(e){let t=e.get(\\\"config\\\"),r=e.get(\\\"renderer\\\"),n=e.get(\\\"fragments\\\"),o=e.get(\\\"events\\\"),s=e.get(\\\"sheet\\\"),{componentName:d,slotName:p}=t;class l extends HTMLElement{_empty=!1;_ready=!1;_queue=ge();_components=[];_stopLoader;get name(){return this.getAttribute(R)||\\\"\\\"}set name(c){this.setAttribute(R,c)}get data(){return H(this.getAttribute(E),{})}set data(c){this.setAttribute(E,Se(c))}async connectedCallback(){this._ready||(this._ready=!0,this.#r(),o.emit(\\\"mounted-slot\\\",{element:this}))}disconnectedCallback(){queueMicrotask(()=>{this._ready&&!this.isConnected&&(this._ready=!1,this.#t(),o.emit(\\\"unmounted-slot\\\",{element:this}))})}attributeChangedCallback(c,a,u){if(!(!this._ready||a===u))if(c===G)this.#e();else if(c===E){let f=this.data;this._components.forEach(h=>h.data=f)}else c===R?this.#e():c===L&&this._empty?this.#e():c===J&&this.#e()}#r(){this.name&&(this.hasChildNodes()?this._components=Array.from(this.querySelectorAll(d)).filter(c=>c.parentElement?.closest(p)===this):this.#o())}#t(){this._stopLoader?.(),this._stopLoader=void 0,this._queue.reset(),this.innerHTML=\\\"\\\"}#e(){this.#t(),this.#r()}#n(){let c=this.getAttribute(\\\"rel\\\"),a=c&&e.get(`slotRel.${c}`);return a?a.apply(Object.fromEntries(this.getAttributeNames().map(u=>[u,this.getAttribute(u)]))):[this.name,this.data]}async#o(){let c=this._stopLoader=ve(this);this._queue.enqueue(()=>{let a=this.getAttribute(St),u=this.getAttribute(J)!==null,[f,h]=this.#n();return n.load(f,h,{orderBy:a,reverse:u})}),this._queue.enqueue(a=>{let u=this.getAttribute(G)||\\\"\\\",f=u&&document.getElementById(u);if(this._empty=!!a,this.innerHTML=\\\"\\\",this._components=[],c(),this._stopLoader=void 0,a){let v=document.createElement(\\\"template\\\");v.innerHTML=a,this.appendChild(Pt(I(v),f,this._components))}else be(this);let h=this.getAttribute(W);h&&this._components.forEach(v=>v.setAttribute(W,h))})}static get observedAttributes(){return[R,E,G,L,J]}}class m extends HTMLElement{_lc;_locals={};_queue=ge();_ready=!1;_stopStart;_stopLoader;_startGeneration=0;handleUpdate=c=>{let a=this.getAttribute($);a&&(this.getAttribute(fe)===\\\"none\\\"||(c.removed.includes(a)&&this._lc?this.#n():c.added.includes(a)&&!this._lc&&this.#n()))};get data(){return H(this.getAttribute(E),{})}set data(c){this.setAttribute(E,Se(c))}connectedCallback(){this._ready||(this._ready=!0,o.on(\\\"updated-microfrontends\\\",this.handleUpdate),this.#r(),o.emit(\\\"mounted-component\\\",{element:this}))}disconnectedCallback(){queueMicrotask(()=>{this._ready&&!this.isConnected&&(this._ready=!1,o.off(\\\"updated-microfrontends\\\",this.handleUpdate),this.#e(),o.emit(\\\"unmounted-component\\\",{element:this}))})}attributeChangedCallback(c,a,u){!this._ready||u===a||(c===E?this.#o():c===K||c===R||c===$?this.#n():c===L&&!this._lc&&this.#n())}static get observedAttributes(){return[K,E,R,le,$,L,ue,pe]}#r(){this._stopStart?.(),this._stopStart=void 0;let c=++this._startGeneration;switch(this.getAttribute(fe)){case\\\"none\\\":return;case\\\"idle\\\":{let h=requestIdleCallback(()=>{c===this._startGeneration&&(this._stopStart=void 0,this._ready&&this.#t())});this._stopStart=()=>cancelIdleCallback(h);return}case\\\"visible\\\":let u=Array.from(this.children);u.length||(this.style.display=\\\"block\\\",u.push(this));let f=new IntersectionObserver(h=>{h.forEach(v=>{if(v.isIntersecting){if(!this._ready||c!==this._startGeneration){f.disconnect();return}u[0]===this&&(this.style.display=\\\"contents\\\"),f.disconnect(),this._stopStart&&(this._stopStart=void 0),this._ready&&this.#t()}})});u.forEach(h=>f.observe(h)),this._stopStart=()=>f.disconnect();return;default:return this.#t()}}#t(){let c=this._stopLoader=ve(this);this.#s(),this._queue.enqueue(()=>{let a=this._lc,u=this.hasAttribute(me);c(),this._stopLoader=void 0,a?(this._locals.hydrate=u,a.mount?.(this,this.data,this._locals)):u||be(this)})}#e(){let c=this._lc;this._startGeneration++,this._stopStart?.(),this._stopStart=void 0,this._stopLoader?.(),this._stopLoader=void 0,this._queue.reset(),c?.unmount?.(this,this._locals),this._lc=void 0,this._locals={},this.innerHTML=\\\"\\\",this.removeAttribute(me)}#n(){this.#e(),this.#r()}#o(){this._queue.enqueue(()=>{let c=this.getAttribute(E),a=this.data;this._lc?.update?.(a,this._locals),o.emit(\\\"changed-data\\\",{current:a,data:c})})}#s(){let c=this.getAttribute(K),a=this.getAttribute(R),f={framework:this.getAttribute(bt)||void 0};if(c)this._lc=r.render({cid:c},f);else if(a){let h=this.getAttribute($),v=this.getAttribute(ue),i=this.getAttribute(pe),g=this.getAttribute(le);this._lc=r.render({name:a,source:h,remoteName:v,remoteType:i,format:g},f)}this._queue.enqueue(()=>this._lc?.load?.().catch(()=>{this._lc=void 0}))}}if(s){let y=e.get(\\\"scope\\\"),c=document.createElement(\\\"style\\\"),{assets:a}=y.readState();c.textContent=s.content,he((a.css||[]).map(ye),document.head.appendChild(c)),o.on(\\\"updated-microfrontends\\\",async({added:u,removed:f})=>{f.forEach(v=>{document.querySelectorAll(`link[data-origin=\\\"${v}\\\"]`).forEach(g=>g.remove())});let h=await y.loadAssets(\\\"css\\\");he(u.flatMap(v=>h.filter(i=>i.origin===v).map(ye)),c)})}return customElements.define(p,l),customElements.define(d,m),{}}function Q(e){return`picard:${e}`}function xe(e,t){document.body.dispatchEvent(new CustomEvent(Q(e),{bubbles:!1,cancelable:!1,detail:t}))}function we(){let e=[],t={on(r,n){let o=({detail:s})=>s&&n(s);return document.body.addEventListener(Q(r),o),e.push([n,o]),t},once(r,n){let o=s=>{t.off(r,o),n(s)};return t.on(r,o)},off(r,n){let[o]=e.filter(s=>s[0]===n);return o&&(document.body.removeEventListener(Q(r),o[1]),e.splice(e.indexOf(o),1)),t},emit(r,n){return xe(r,n),xe(\\\"*\\\",{name:r,args:n}),t}};return t}function xt(e,t,r){let n=document.createElement(\\\"script\\\");return n.async=!0,n.src=e,t?(n.crossOrigin=r||\\\"anonymous\\\",n.integrity=t):r&&(n.crossOrigin=r),n}function wt(e,t,r){return new Promise((n,o)=>{let s=xt(e,t,r);s.onload=()=>n(),s.onerror=d=>o(d),document.body.appendChild(s)})}function Ct(e){return import(e)}async function Mt(e){return await(await fetch(e)).json()}function Ce(){return{loadJson:Mt,loadModule:Ct,loadScript:wt}}function Me(e){let t,r=async()=>{let n=e.get(\\\"scope\\\"),o=e.get(\\\"events\\\"),s=e.get(\\\"config\\\"),d=e.get(\\\"router\\\"),{initializeDebugAdapter:p}=await import(\\\"./debug-PQLR7O4K.js\\\");t=p({scope:n,events:o,config:s,router:d})};return location.hostname===\\\"localhost\\\"&&r(),{dispose(){t?.dispose()}}}function Ae(){return{async load(e,t,r){let n=await import(\\\"./shimport-HVLO7IEM.js\\\");try{return await n.load(e,t,r)}catch(o){if(Object.keys(t).length>0)throw o;return await import(e)}}}}async function _(e,t,r){let{name:n,format:o,details:s}=t,d=r[n];return d||(d=e.get(`format.${o}`).createContainer(s).then(async l=>{let m=l.getAssets(),y=l.getComponents(),c=e.get(\\\"scope\\\");for(let a of m)c.registerAsset(t,a);for(let a of y)c.registerComponent(t,a);return l},l=>(console.warn(\\\"Failed to load micro frontend %s:\\\",n,l),{getAssets(){return[]},getComponents(){return[]},load(){}})),r[n]=d),await d}function Ee(){let e={current:Promise.resolve(),async enqueue(t){let r=e.current.then(t);return e.current=r.then(()=>{}),await r},depends(t){return e.current.then(t)}};return e}var Re=e=>{let t,r=new Set,n=(m,y)=>{let c=typeof m==\\\"function\\\"?m(t):m;if(!Object.is(c,t)){let a=t;t=y??(typeof c!=\\\"object\\\"||c===null)?c:Object.assign({},t,c),r.forEach(u=>u(t,a))}},o=()=>t,p={setState:n,getState:o,getInitialState:()=>l,subscribe:m=>(r.add(m),()=>r.delete(m))},l=t=e(n,o,p);return p},Te=(e=>e?Re(e):Re);function ke(e={}){return Te(()=>({...e,microfrontends:[...e.microfrontends||[]],assets:{...e.assets||{}},components:{...e.components||{}}}))}function De(e,t){return e.id.localeCompare(t.id)}function Z(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,o.filter(s=>t.includes(s.origin)?(r.push(s),!1):!0)]))}function V(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,[...o,...t.filter(s=>r(s)===n)]]))}function X(e){return e.microfrontends.filter(t=>t.flags===0).map(t=>t.name)}function M(e,t){return t?new URL(e,t).href:typeof location<\\\"u\\\"?M(e,location.href):e}function N(e,t,r,n){return{name:e,source:r,format:t,details:n,flags:0,assets:[],components:[]}}function Le(){let e=Math.random()*46656|0,t=Math.random()*46656|0,r=(\\\"000\\\"+e.toString(36)).slice(-3),n=(\\\"000\\\"+t.toString(36)).slice(-3);return r+n}function _e(e,t,r){let n=Le(),{url:o,type:s}=r,d={id:n,url:o,origin:t.name,type:s};return e.setState(p=>({assets:{...p.assets,[s]:[...p.assets[s]||[],d]}})),t.assets.push(n),d}function O(e,t,r){let n=Le(),{name:o,meta:s,type:d}=r,p={id:n,name:o,meta:s,type:d,origin:t.name};return e.setState(l=>({components:{...l.components,[o]:[...l.components[o]||[],p]}})),t.components.push(n),p}function Y(e,t,r){return(e.getState().components[t]||[]).find(o=>o.origin===r)}function ee(e,t){return e.readState().microfrontends.find(r=>r.name===t)}function $e(e,t){if(typeof t==\\\"string\\\"){let{assets:r}=e.getState();for(let n of Object.values(r)){let o=n.find(s=>s.id===t);if(o)return o}}}function Ie(e,t){if(typeof t==\\\"string\\\"){let{components:r}=e.getState();for(let n of Object.values(r)){let o=n.find(s=>s.id===t);if(o)return o}}}function Ne(e){let{source:t,format:r}=e;if(r===\\\"module\\\"){let{remoteName:n,remoteType:o=\\\"var\\\"}=e;return N(t,r,t,{id:n,type:o,url:M(t)})}else return r===\\\"native\\\"?N(t,r,t,{url:M(t)}):r===\\\"pilet\\\"?N(t,r,t,{url:M(t)}):void 0}function Oe(e){let{state:t}=e.get(\\\"config\\\"),r=e.get(\\\"events\\\"),n={},o=ke(t),s=Ee(),d=[],p=[],l=o.subscribe((a,u)=>{if(a.microfrontends!==u.microfrontends){let f=X(a),h=X(u),v=f.filter(g=>!h.includes(g)),i=h.filter(g=>!f.includes(g));r.emit(\\\"updated-microfrontends\\\",{added:v,removed:i})}}),m=(a,u=!1)=>{let f=u?2:1;o.setState(h=>({...h,assets:Z(h.assets,a,u?[]:d),components:Z(h.components,a,u?[]:p),microfrontends:h.microfrontends.map(v=>a.includes(v.name)?{...v,flags:f}:v)}))},y=a=>{o.setState(u=>({...u,assets:V(u.assets,d,f=>f.type),components:V(u.components,p,f=>f.name),microfrontends:u.microfrontends.map(f=>f.name===a?{...f,flags:0}:f)}))},c={dispose(){l()},saveSnapshot(){return JSON.stringify(o.getState())},readState(){return o.getState()},subscribe(a){return o.subscribe(a)},registerAsset(a,u){return _e(o,a,u)},registerComponent(a,u){return O(o,a,u)},retrieveComponent(a){return Ie(o,a)},retrieveAsset(a){return $e(o,a)},loadAssets(a){return s.depends(()=>c.readState().assets[a]||[])},loadMicrofrontends(a){return s.enqueue(async()=>{let u=await a;await Promise.all(u.filter(f=>!f.flags).map(f=>_(e,f,n))),c.appendMicrofrontends(u)})},getComponent(a){return s.depends(async()=>{let{cid:u,name:f,source:h}=a;if(u){let v=c.retrieveComponent(u),i=ee(c,v.origin);if(i&&!i.flags){let S=await(await _(e,i,n)).load(v.name);return{...v,exports:S}}}else if(f&&h){let v=ee(c,h),i=v||Ne(a);if(i&&!i.flags){let S=await(await _(e,i,n)).load(f),b=i.name;return S&&!Y(o,f,b)&&O(o,i,{name:f}),v||c.appendMicrofrontend(i),{...Y(o,f,b),exports:S}}}})},loadComponents(a,u){return s.depends(async()=>{let f=[],{microfrontends:h}=o.getState(),v=u?.orderBy||\\\"none\\\",i=h.filter(g=>!g.flags);return v===\\\"origin\\\"&&i.sort((g,S)=>g.name.localeCompare(S.name)),await Promise.all(i.map(async g=>{let S=await _(e,g,n),{components:b}=o.getState(),P=b[a]?.find(w=>w.origin===g.name);if(!P)if(await S.load(a))P=O(o,g,{name:a});else return;f.push(P)})),v===\\\"cid\\\"&&f.sort(De),u?.reverse&&f.reverse(),f})},appendMicrofrontend(a){c.appendMicrofrontends([a])},appendMicrofrontends(a){a.length>0&&o.setState(u=>({...u,microfrontends:[...u.microfrontends,...a]}))},toggleMicrofrontend(a){let{microfrontends:u}=o.getState(),f=u.find(h=>h.name===a);f?.flags===0?m([a]):f?.flags===1&&y(a)},removeMicrofrontend(a){c.removeMicrofrontends([a])},removeMicrofrontends(a){a.length>0&&m(a,!0)},updateMicrofrontend(a,u){o.setState(f=>({microfrontends:f.microfrontends.map(h=>h.name===a?{...h,...u}:h)}))}};return c}var At=/^[v^~<>=]*?(\\\\d+)(?:\\\\.([x*]|\\\\d+)(?:\\\\.([x*]|\\\\d+)(?:\\\\.([x*]|\\\\d+))?(?:-([\\\\da-z\\\\-]+(?:\\\\.[\\\\da-z\\\\-]+)*))?(?:\\\\+[\\\\da-z\\\\-]+(?:\\\\.[\\\\da-z\\\\-]+)*)?)?)?$/i,Et=[\\\"*\\\",\\\"x\\\",\\\">=0\\\"];function Fe(e){return Et.includes(e)||At.test(e)}var Rt=/^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\da-z-]+(?:\\\\.[\\\\da-z-]+)*)?(?:\\\\+[\\\\da-z-]+(?:\\\\.[\\\\da-z-]+)*)?$/i;function je(e){if(/^[a-zA-Z][a-zA-Z\\\\d+.-]*:/.test(e))return;let t=e.lastIndexOf(\\\"@\\\");if(!(t<=0))return{name:e.substring(0,t),version:e.substring(t+1)}}function Ue(e){let t=je(e);if(t&&Rt.test(t.version))return t}function qe(){let e=new Map,t=new Map,r=new Map,n=Object.create(null),o,s,d;function p(...i){let g=typeof i[0]==\\\"string\\\",S=g?i[0]:d||globalThis.document?.currentScript?.src,b=g?i[1]:i[0],P=g?i[2]:i[1];if(!S)throw new Error(\\\"An anonymous module must be registered from a script with a URL.\\\");let w={id:S,...Ue(S),dependencies:b,declare:P,namespace:{},importers:[],state:\\\"registered\\\"};e.set(S,w),n[S]=!0}function l(i,g){let S;return/^[a-zA-Z][a-zA-Z\\\\d+.-]*:/.test(i)?S=i:i.startsWith(\\\".\\\")&&g&&/^[a-zA-Z][a-zA-Z\\\\d+.-]*:/.test(g)?S=new URL(i,g).href:S=i,s?.(i,g,S),S}function m(i,g){let S=g&&typeof g==\\\"object\\\"?g:{default:g};e.set(i,{id:i,...Ue(i),dependencies:[],namespace:S,importers:[],state:\\\"evaluated\\\"}),n[i]=!0}function y(i,g){d=i;try{new Function(\\\"System\\\",`${g}\\n//# sourceURL=${i}`)(v)}finally{d=void 0}}async function c(i){let g=e.get(i);if(g)return g;let S=t.get(i);if(S)return S;let b=(async()=>{if(typeof document<\\\"u\\\")await new Promise((w,C)=>{let x=document.createElement(\\\"script\\\");x.src=i,x.async=!0,x.onload=()=>w(),x.onerror=()=>C(new Error(`Failed to load module \\\"${i}\\\".`)),document.head.appendChild(x)});else{let w=await fetch(i);if(!w.ok)throw new Error(`Failed to load module \\\"${i}\\\": ${w.status} ${w.statusText}`);y(i,await w.text())}let P=e.get(i);if(!P)throw new Error(`The script \\\"${i}\\\" did not register a module.`);return P})();t.set(i,b);try{return await b}finally{t.delete(i)}}async function a(i,g){let S=l(i,g),b=e.get(S);if(b)return b;let P=je(S);if(o&&P&&Fe(P.version)){let w=`${P.name}@${P.version}`,C=r.get(w);C||(C=(async()=>{let x=await o(P.name,P.version,g);if(x)return s?.(i,g,x),e.get(x)||await c(x)})(),r.set(w,C));try{let x=await C;if(x)return x}finally{r.delete(w)}}return c(S)}function u(i){return i.evaluation||(i.evaluation=h(i)),i.evaluation}function f(i,g){let S=new Set,b=i;for(;b&&!S.has(b);){if(b===g)return!0;S.add(b),b=b.waitingFor}return!1}async function h(i){if(i.state===\\\"evaluated\\\")return i.namespace;if(i.state===\\\"failed\\\")throw i.error;i.state=\\\"linking\\\";let g=((b,P)=>{let w=typeof b==\\\"string\\\"?{[b]:P}:b,C=Object.entries(w).some(([x,U])=>!Object.prototype.hasOwnProperty.call(i.namespace,x)||!Object.is(i.namespace[x],U));if(Object.assign(i.namespace,w),C)for(let x of i.importers)x(i.namespace);return typeof b==\\\"string\\\"?P:w}),S={id:i.id,meta:{url:i.id},import:b=>v.import(b,i.id),resolve:b=>v.resolve(b,i.id)};try{i.declaration=i.declare?.(g,S)||{};let b=i.declaration.setters||[];for(let P=0;P<i.dependencies.length;P++){let w=l(i.dependencies[P],i.id),C=await a(w,i.id),x=b[P];x&&C.importers.push(x),i.waitingFor=C;let U=f(C,i)?C.namespace:await u(C);i.waitingFor=void 0,x?.(U)}return i.state=\\\"executing\\\",await i.declaration.execute?.(),i.state=\\\"evaluated\\\",i.namespace}catch(b){throw i.state=\\\"failed\\\",i.error=b,b}finally{i.waitingFor=void 0}}let v={register:p,registerRegistry:n,set:m,get(i){return e.get(i)?.namespace},has(i){return e.has(i)},entries(){return[...e].map(([i,g])=>[i,g.namespace])},list(){return[...e.values()].flatMap(i=>i.name&&i.version?[{id:i.id,name:i.name,version:i.version}]:[])},resolve:l,async import(i,g){let S=await a(i,g);return u(S)},setResolveListener(i){s=i},setPackageResolver(i){o=i}};return v}function Tt(e,t){console.error(\\\"Failed to load Picard module\\\",t,e)}function kt(e,t,r){e.register(t,[],n=>({execute(){let o=r();if(o instanceof Promise)return o.then(s=>ze(n,s.default||s));ze(n,o)}}))}function ze(e,t){typeof t==\\\"function\\\"?(e(\\\"__esModule\\\",!0),Object.keys(t).forEach(r=>e(r,t[r])),e(\\\"default\\\",t)):typeof t==\\\"number\\\"||typeof t==\\\"boolean\\\"||typeof t==\\\"symbol\\\"||typeof t==\\\"string\\\"||typeof t==\\\"bigint\\\"||Array.isArray(t)?(e(\\\"__esModule\\\",!0),e(\\\"default\\\",t)):t&&(e(t),typeof t==\\\"object\\\"&&!(\\\"default\\\"in t)&&e(\\\"default\\\",t))}function He(e,t=[]){for(let[r,n]of t)e.has(r)||kt(e,r,n)}function Ge(e,t={}){let r=Object.entries(t).map(([n,o])=>[n,()=>e.import(o)]);He(e,r)}function te(e,t={}){He(e,Object.entries(t))}async function Je(e,t){try{return await e.import(t)}catch(r){return Tt(r,t)}}var A=qe();function Ke(e){let t=e.get(\\\"events\\\"),{dependencies:r}=e.get(\\\"config\\\");return A.setResolveListener((n,o,s)=>t.emit(\\\"resolved-dependency\\\",{id:n,parentUrl:o,result:s})),te(A,r),{registerUrls(n){Ge(A,n)},registerResolvers(n){te(A,n)},registerModule(n,o){A.set(n,o)},load(n){return Je(A,n)},import(n,o){return A.import(n,o)},list(){return A.list()},setPackageResolver(n){A.setPackageResolver(n)}}}globalThis.System=A;function Dt(e,t,r){let n=e[t];return Array.isArray(n)?n.map(o=>o(r)):typeof n==\\\"function\\\"?[n(r)]:[]}function We(e){let t={},r={get(n){return r.getAll(n)[0]},getAll(n){let o=t[n];if(!o){let s=Dt(e,n,r);return t[n]=s,s}return o},instantiate(n){return r.getAll(n),r}};return r}var T={async load(){},async unload(){},mount(){},unmount(){},update(){},async bootstrap(){},stringify(){return Promise.resolve(\\\"\\\")}};function F(e){let t={...T},r=async()=>{let n=await e();Object.assign(t,n.default||n)};return{async load(...n){return await r(),await t.load(...n)},mount(...n){return t.mount(...n)},update(...n){return t.update(...n)},unmount(...n){return t.unmount(...n)},unload(...n){return t.unload(...n)},async bootstrap(...n){return await r(),await t.bootstrap(...n)},stringify(...n){return t.stringify(...n)}}}function Be(e){let t=e.get(\\\"scope\\\");function r(n,o,s){let d=e.get(`framework.${s}`);return d&&n?d.convert(n,o):n}return{render(n,o){let s=t.getComponent(n);if(s)return F(()=>s.then(d=>{if(!d){let c=n.cid||`${n.source}/${n.name}`;throw new Error(`The component \\\"${c}\\\" could not be found.`)}let{meta:p,type:l=\\\"default\\\"}=d,{framework:m=l}=o,y=r(d.exports,p,m);if(!y){let c=d.name||n.cid||`${n.source}/${n.name}`;throw new Error(`The component \\\"${c}\\\" could not be loaded.`)}return y}))}}}function Qe(e){let t=e.get(\\\"loader\\\"),r=e.getAll(\\\"pilet\\\"),n=e.get(\\\"platform\\\"),o=e.get(\\\"events\\\");return{async createContainer(s){let d=[],p={},l=[];if(!s.name){let y=await n.loadJson(s.url),{name:c,version:a,main:u,dependencies:f={},spec:h,config:v,integrity:i,custom:g}=y,S=M(u,s.url);Object.assign(s,{name:c,version:a,dependencies:f,spec:h,config:v,url:S,integrity:i,custom:g})}t.registerUrls(s.dependencies);let m=await t.load(s.url);if(m&&\\\"setup\\\"in m){let y=M(\\\".\\\",s.url),c={...o,meta:{basePath:y},registerComponent(a,u,f={}){let{type:h,...v}=f,i={...v,api:c};p[a]=u,d.push({name:a,type:h,meta:i})}};if(Array.isArray(m.styles)){let a=m.styles.map(u=>({url:M(u,y),type:\\\"css\\\"}));l.push(...a)}r.forEach(a=>a.extend(c)),await m.setup(c)}return{async load(y){return p[y]},getComponents(){return d},getAssets(){return l}}}}}function Ze(e){let t=e.get(\\\"loader\\\"),r,n=()=>(r||(r=import(\\\"./module-IUD22T4C.js\\\").then(({createModuleFederation:o})=>o(e))),r);return t.setPackageResolver(async(o,s,d)=>await(await n()).resolvePackage(o,s,d)),{async createContainer(o){return await(await n()).createContainer(o)}}}function Lt(e,t,r,n){let{dependencies:o,url:s}=r;o.length>0&&e.registerResolvers(o.reduce((d,p)=>{let l=M(p.outFileName,s),m=`${p.packageName}@${p.version}`;return n[p.packageName]=`${p.packageName}@${p.requiredVersion}`,d[m]=()=>t.load(l,n,s),d},{})),e.registerModule(s,{})}function _t(e){let t=[],r=[],n={},{exposes:o,url:s}=e;for(let{key:d,outFileName:p}of o){let l=d.substring(2);/\\\\.m?js$/.test(p)?(r.push({name:l}),n[l]={url:M(p,s),component:void 0}):/\\\\.css$/.test(p)&&t.push({url:M(p,s),type:\\\"css\\\"})}return[r,n,t]}function Ve(e){let t=e.get(\\\"loader\\\"),r=e.get(\\\"platform\\\"),n=e.get(\\\"esm\\\");return e.instantiate(\\\"format.module\\\"),t.registerResolvers({\\\"@softarc/native-federation\\\":()=>()=>({async loadRemoteModule(o){let{exposedModule:s,remoteName:d}=o;return(await e.get(\\\"scope\\\").getComponent({remoteName:d,remoteType:\\\"esm\\\",format:\\\"native\\\",name:s})).exports}})}),{async createContainer(o){let s={},{url:d}=o;if(!o.exposes||!o.dependencies){let y=await r.loadJson(d);o.exposes=y.exposes,o.dependencies=y.shared}Lt(t,n,o,s);let[p,l,m]=_t(o);return{async load(y){let c=y.startsWith(\\\"./\\\")?y.substring(2):y,a=l[c];if(a)return a.component||(a.component=n.load(a.url,s,d).then(u=>u?.default||u)),await a.component},getComponents(){return p},getAssets(){return m}}}}}function Xe(){return{convert(e={}){return typeof e==\\\"function\\\"?F(e):{...T,...e}}}}function Ye(){return{convert(e){return{...T,load(){return e.bootstrap?.()??Promise.resolve()},unload(){return e.unload?.()??Promise.resolve()},mount(t,r,n){n.container=t,e.mount({...r,domElement:t})},unmount(t){e.unmount({domElement:t}).catch(()=>{})},update(t,r){e.update?.({...t,domElement:r.container})}}}}}function $t(e){switch(typeof e){case\\\"object\\\":return JSON.stringify(e);case\\\"function\\\":return\\\"\\\";case\\\"undefined\\\":return null;default:return e.toString()}}function et(e,t){Object.entries(t).forEach(([r,n])=>{e.setAttribute(r,$t(n))})}function tt(){return{convert(e){return{...T,mount(t,r,n){let o=typeof e==\\\"string\\\"?document.createElement(e):new e;et(o,r),t.appendChild(o),n.ref=o},update(t,r){et(r.ref,t)},unmount(t,r){r.ref.remove(),t.innerHTML=\\\"\\\"}}}}}function ne(){let e=document.querySelector(\\\"script[type=pi-config]\\\");return e?JSON.parse(e.textContent||\\\"{}\\\"):{}}function nt(e){let{config:t,services:r={},...n}=e||{},o=t||ne(),s={...r,config:()=>({...o,...n}),events:we,scope:Oe,fragments:re,loader:Ke,esm:Ae,renderer:Be,platform:Ce,elements:Pe,router:de,debug:Me,\\\"format.module\\\":Ze,\\\"format.native\\\":Ve,\\\"format.pilet\\\":Qe,\\\"framework.single-spa\\\":Ye,\\\"framework.default\\\":Xe,\\\"framework.web-component\\\":tt};return We(s).instantiate(\\\"loader\\\").instantiate(\\\"elements\\\").instantiate(\\\"router\\\").instantiate(\\\"debug\\\").get(\\\"scope\\\")}function ot(e){return import(new URL(e,document.baseURI).href)}async function It(e={}){let t=await Promise.all(Object.entries(e).map(async([r,n])=>{let{default:o}=await ot(n);return[r,o]}));return Object.fromEntries(t)}function Nt(e={}){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,()=>ot(r)]))}var rt=async()=>{let e=ne(),{services:t,dependencies:r}=e.client||{};window.picard=nt({config:e,services:await It(t),dependencies:Nt(r)})};document.readyState===\\\"loading\\\"?document.addEventListener(\\\"DOMContentLoaded\\\",rt):rt();\\n\",\"debug-PQLR7O4K.js\":\"function S(d){let i=[],m=[],p=(a,u)=>{let n=a&&a.toJSON instanceof Function?a.toJSON():a;if(n!=null){{if(typeof n==\\\"function\\\")return\\\"<function>\\\";if(n instanceof Error)return\\\"<error>\\\";if(n instanceof Node)return\\\"<node>\\\";if(typeof n==\\\"object\\\"){for(let r=0;r<i.length;r++)if(i[r]===n)return{$ref:m[r]};if(i.push(n),m.push(u),Array.isArray(n)){let r=[];for(let c=0;c<n.length;c+=1)r[c]=p(n[c],`${u}[${c}]`);return r}else{let r={};for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&(r[c]=p(n[c],`${u}[${JSON.stringify(c)}]`));return r}}else{if(typeof n==\\\"symbol\\\")return\\\"<symbol>\\\";if(typeof n==\\\"bigint\\\")return\\\"<bigint>\\\"}}return n}};return p(d,\\\"$\\\")}var x=\\\"piral-inspector-visualizer\\\",z=[\\\"#001F3F\\\",\\\"#0074D9\\\",\\\"#7FDBFF\\\",\\\"#39CCCC\\\",\\\"#3D9970\\\",\\\"#2ECC40\\\",\\\"#01FF70\\\",\\\"#FFDC00\\\",\\\"#FF851B\\\",\\\"#FF4136\\\",\\\"#85144B\\\",\\\"#F012BE\\\",\\\"#B10DC9\\\"],F=new DOMRectReadOnly(0,0,0,0);function W(d){let m=[...d.childNodes].map(a=>{if(a instanceof Element)return a.getBoundingClientRect();if(a instanceof Text){let u=document.createRange();return u.selectNode(a),u.getBoundingClientRect()}else return F}).filter(a=>a.height!==0&&a.width!==0),p=m.pop()||F;return m.reduce((a,u)=>{let n=Math.min(a.left,u.left),r=Math.min(a.top,u.top),c=Math.max(a.right,u.right)-n,g=Math.max(a.bottom,u.bottom)-r;return new DOMRectReadOnly(n,r,c,g)},p)}function k(d,i,m){let p={},a=n=>{let r=n.getAttribute(\\\"origin\\\");if(r)return r;let c=n.getAttribute(\\\"cid\\\");if(c)return d.readState().microfrontends.find(y=>c in y.components)?.name||\\\"\\\";let g=n.getAttribute(\\\"source\\\");return g&&d.readState().microfrontends.find(y=>y.source===g)?.name||\\\"\\\"};class u extends HTMLElement{update=()=>{this.innerText=\\\"\\\",document.querySelectorAll(m).forEach(r=>{let c=a(r),g=this.appendChild(document.createElement(\\\"div\\\")),f=g.appendChild(document.createElement(\\\"div\\\")),v=W(r),y=p[c]||(p[c]=z[Object.keys(p).length%z.length]);g.style.position=\\\"absolute\\\",g.style.left=v.left+\\\"px\\\",g.style.top=v.top+\\\"px\\\",g.style.width=v.width+\\\"px\\\",g.style.height=v.height+\\\"px\\\",g.style.pointerEvents=\\\"none\\\",g.style.zIndex=\\\"99999999999\\\",g.style.border=`1px dashed ${y}`,f.style.color=\\\"white\\\",f.textContent=c,f.style.textOverflow=\\\"ellipsis\\\",f.style.position=\\\"absolute\\\",f.style.overflow=\\\"hidden\\\",f.style.whiteSpace=\\\"nowrap\\\",f.style.right=\\\"0\\\",f.style.left=\\\"0\\\",f.style.top=\\\"0\\\",f.style.padding=\\\"4px\\\",f.style.fontSize=\\\"8px\\\",f.style.background=y})};connectedCallback(){this.style.position=\\\"absolute\\\",this.style.top=\\\"0\\\",this.style.left=\\\"0\\\",this.style.width=\\\"0\\\",this.style.height=\\\"0\\\",window.addEventListener(\\\"resize\\\",this.update),i.on(\\\"mounted-component\\\",this.update),i.on(\\\"unmounted-component\\\",this.update),this.update()}disconnectedCallback(){window.removeEventListener(\\\"resize\\\",this.update),i.off(\\\"mounted-component\\\",this.update),i.off(\\\"unmounted-component\\\",this.update)}}return customElements.define(x,u),{toggle(){let n=document.querySelector(x);n?n.remove():document.body.appendChild(document.createElement(x))}}}var P=\\\"piral-debug-api\\\",C=\\\"v1\\\";function h(d){let i={content:S(d),source:P,version:C};window.postMessage(i,\\\"*\\\")}function H(d,i){for(;i[d];)d=i[d];return d}function N(d,i,m){return d.on(i,m),()=>{d.off(i,m)}}function X({config:d,events:i,router:m,scope:p}){let{componentName:a}=d,u=[],n={},r={},c=k(p,i,a),g=(e,t,s)=>{let o=e[t]||[];for(let l of Object.keys(s))o.some(b=>b.demanded===l)||o.push({demanded:l,resolved:s[l]});e[t]=o},f=N(i,\\\"resolved-dependency\\\",({id:e,parentUrl:t,result:s})=>{if(t){let o=H(t,r);if(e.startsWith(\\\"./\\\"))r[s]=o;else{let l=n[o]||{};l[e]=s,n[o]=l}}}),v=N(i,\\\"*\\\",e=>{u.unshift({id:u.length.toString(),name:e.name,args:S(e.args),time:Date.now()}),h({events:u,type:\\\"events\\\"})}),y=()=>p.readState().microfrontends.filter(t=>t.flags!==2).map(t=>({name:t.name,version:\\\"0.0.0\\\",type:t.format,root:t.source,url:t.details.url||t.source,disabled:t.flags===1})),j=()=>{let e={},t=y().filter(s=>s.url);return Object.keys(n).forEach(s=>{let o=n[s],l=t.find(b=>b.url===s);if(l)g(e,l.name,o);else if(!l){let b=t.find(J=>s.startsWith(J.root));b&&g(e,b.name,o)}}),e},L=e=>{p.appendMicrofrontend({name:e.name,format:\\\"pilet\\\",components:[],assets:[],details:e,source:e.name,flags:0})},M=()=>{let e=p.readState();return Object.entries(e.components).filter(([,t])=>t.length).map(([t])=>t)},B=p.subscribe((e,t)=>{h({type:\\\"container\\\",container:e}),e.microfrontends!==t.microfrontends&&h({type:\\\"pilets\\\",pilets:y()}),e.components!==t.components&&(h({type:\\\"routes\\\",routes:m.findRoutes()}),h({type:\\\"extensions\\\",extensions:M()}))}),E={extensionCatalogue:!0,viewOrigins:!0},w={viewOrigins:{value:E.viewOrigins,type:\\\"boolean\\\",label:\\\"Visualize component origins\\\",onChange(e){E.viewOrigins=e}},extensionCatalogue:{value:E.extensionCatalogue,type:\\\"boolean\\\",label:\\\"Enable extension catalogue\\\",onChange(e){E.extensionCatalogue=e}}},R=()=>Object.keys(w).reduce((e,t)=>{let s=w[t];return s&&typeof s==\\\"object\\\"&&typeof s.label==\\\"string\\\"&&typeof s.type==\\\"string\\\"&&[\\\"boolean\\\",\\\"string\\\",\\\"number\\\"].includes(typeof s.value)&&(e[t]={label:s.label,value:s.value,type:s.type}),e},{}),T=e=>{Object.keys(e).forEach(t=>{let s=w[t];switch(s.type){case\\\"boolean\\\":{let o=s.value,l=e[t];s.value=l,s.onChange(l,o);break}case\\\"number\\\":{let o=s.value,l=e[t];s.value=l,s.onChange(l,o);break}case\\\"string\\\":{let o=s.value,l=e[t];s.value=l,s.onChange(l,o);break}}}),h({settings:R(),type:\\\"settings\\\"})},D={name:d.meta?.name||document.querySelector(\\\"meta[name=app-name]\\\")?.getAttribute(\\\"content\\\")||\\\"App\\\",version:d.meta?.version||document.querySelector(\\\"meta[name=app-version]\\\")?.getAttribute(\\\"content\\\")||\\\"-\\\"},O={name:D.name,version:D.version,kind:C,mode:\\\"development\\\",capabilities:[\\\"events\\\",\\\"container\\\",\\\"routes\\\",\\\"pilets\\\",\\\"settings\\\",\\\"extensions\\\",\\\"dependencies\\\",\\\"dependency-map\\\"]},V=()=>{h({type:\\\"available\\\",...O,state:{routes:m.findRoutes(),pilets:y(),container:p.readState(),settings:R(),events:u,extensions:M(),dependencies:[]}})},$=()=>{h({type:\\\"info\\\",...O})},q=()=>{let e=j();h({type:\\\"dependency-map\\\",dependencyMap:e})},A=e=>{let{source:t,version:s,content:o}=e.data;if(t!==P&&s===C)switch(o.type){case\\\"init\\\":return V();case\\\"check-piral\\\":return $();case\\\"get-dependency-map\\\":return q();case\\\"update-settings\\\":return T(o.settings);case\\\"append-pilet\\\":return L(o.meta);case\\\"remove-pilet\\\":return p.removeMicrofrontend(o.name);case\\\"toggle-pilet\\\":return p.toggleMicrofrontend(o.name);case\\\"emit-event\\\":return i.emit(o.name,o.args);case\\\"goto-route\\\":return m.navigate(o.route,o.state);case\\\"visualize-all\\\":return c.toggle()}};window.addEventListener(\\\"message\\\",A);let I=()=>{window.removeEventListener(\\\"message\\\",A)};return{dispose(){I(),f(),v(),B()}}}export{X as initializeDebugAdapter};\\n\",\"shimport-HVLO7IEM.js\":\"var k=\\\"__shimport__\\\";function O(e,t){let n=e.length;for(;n--;)if(e[n].name===t)return e[n].as}function F(e,t,n,s,o){let a=O(s,\\\"*\\\")||O(s,\\\"default\\\");return{start:t,end:n,source:o,name:a,specifiers:s,toString(){return`/*${e.slice(t,n)}*/`}}}function J(e,t,n){let s=/^\\\\s*(?:(class)(\\\\s+extends|\\\\s*{)|(function)\\\\s*\\\\()/.exec(e.slice(n));if(s){n+=s[0].length;let o=\\\"__default_export\\\";return{start:t,end:n,name:o,as:\\\"default\\\",toString(){return s[1]?`class ${o}${s[2]}`:`function ${o}(`}}}return{start:t,end:n,toString(){return\\\"__exports.default =\\\"}}}function W(e,t,n,s,o,a){let c=A(e.slice(n+1,s-1).trim());return{start:t,end:o,source:a,toString(g){let l=a&&g.get(a);return c.map(_=>`__exports.${_.as} = ${l?`${l}.${_.name}`:_.name}; `).join(\\\"\\\")+`/*${e.slice(t,o)}*/`}}}function Z(e,t,n){let s=n;for(;e[n]&&/\\\\S/.test(e[n]);)n+=1;for(;e[n]&&!/\\\\S/.test(e[n]);)n+=1;let o=n;for(;e[n]&&!j.test(e[n])&&!f(e[n]);)n+=1;let a=n,c=e.slice(o,a);return{start:t,end:s,name:c,toString(){return\\\"\\\"}}}function Q(e,t,n,s){return{start:t,end:n,source:s,toString(o){return`Object.assign(__exports, ${o.get(s)}); /*${e.slice(t,n)}*/`}}}var T=/\\\\b(case|default|delete|do|else|in|instanceof|new|return|throw|typeof|void)\\\\s*$/,G=/(^|\\\\{|\\\\(|\\\\[\\\\.|;|,|<|>|<=|>=|==|!=|===|!==|\\\\+|-|\\\\*\\\\%|<<|>>|>>>|&|\\\\||\\\\^|!|~|&&|\\\\|\\\\||\\\\?|:|=|\\\\+=|-=|\\\\*=|%=|<<=|>>=|>>>=|&=|\\\\|=|\\\\^=|\\\\/=|\\\\/)\\\\s*$/,H=/(\\\\}|\\\\)|\\\\+\\\\+|--)\\\\s*$/,j=/[{}()[.;,<>=+\\\\-*%&|\\\\^!~?:/]/,K=/[a-zA-Z_$0-9]/,V={\\\" \\\":1,\\\"\\t\\\":1,\\\"\\\\n\\\":1,\\\"\\\\r\\\":1,\\\"\\\\f\\\":1,\\\"\\\\v\\\":1,\\\"\\\\xA0\\\":1,\\\"\\\\u2028\\\":1,\\\"\\\\u2029\\\":1};function f(e){return e in V}function E(e){return e===\\\"'\\\"||e==='\\\"'}var X=/^\\\\*\\\\s+as\\\\s+(\\\\w+)$/,Y=/(\\\\w+)\\\\s*,\\\\s*\\\\*\\\\s*as\\\\s*(\\\\w+)$/,ee=/(\\\\w+)\\\\s*,\\\\s*{(.+)}$/;function te(e){let t=X.exec(e);return t?[{name:\\\"*\\\",as:t[1]}]:(t=Y.exec(e),t?[{name:\\\"default\\\",as:t[1]},{name:\\\"*\\\",as:t[2]}]:(t=ee.exec(e),t?[{name:\\\"default\\\",as:t[1]}].concat(A(t[2].trim())):e[0]===\\\"{\\\"?A(e.slice(1,-1).trim()):e?[{name:\\\"default\\\",as:e}]:[]))}function A(e){return e?e.split(\\\",\\\").map(t=>{let[n,,s]=t.trim().split(/[^\\\\S]+/);return{name:n,as:s||n}}):[]}function ne(e,t){let n=t,s=t+=6;for(;e[t]&&f(e[t]);)t+=1;for(;e[t]&&!E(e[t]);)t+=1;let o=t,a=t+=1;for(;e[t]&&!E(e[t]);)t+=1;let c=t++;return F(e,n,t,te(e.slice(s,o).replace(/from\\\\s*$/,\\\"\\\").trim()),e.slice(a,c))}function re(e){return{start:e,end:e+6,toString(){return\\\"__import\\\"}}}var se=/^import\\\\s*\\\\.\\\\s*meta\\\\s*\\\\.\\\\s*url/;function oe(e,t,n){let s=se.exec(e.slice(t));if(s)return{start:t,end:t+s[0].length,toString(){return JSON.stringify(\\\"\\\"+n)}}}function ae(e,t){let n=t;for(t+=6;e[t]&&f(e[t]);)t+=1;let s=t;if(e[t]===\\\"{\\\"){for(;e[t]!==\\\"}\\\";)t+=1;t+=1;let o=t,a=null;for(;f(e[t]);)t+=1;if(/^from[\\\\s\\\\n'\\\"]/.test(e.slice(t,t+5))){for(t+=4;f(e[t]);)t+=1;for(;e[t]&&!E(e[t]);)t+=1;let c=t+=1;for(;e[t]&&!E(e[t]);)t+=1;a=e.slice(c,t),t+=1}return W(e,n,s,o,t,a)}if(e[t]===\\\"*\\\"){for(t+=1;f(e[t]);)t+=1;for(t+=4;e[t]&&!E(e[t]);)t+=1;let o=t+=1;for(;e[t]&&!E(e[t]);)t+=1;let a=t++;return Q(e,n,t,e.slice(o,a))}return/^default\\\\b/.test(e.slice(t,t+8))?J(e,n,s+7):Z(e,n,s)}function ie(e,t){let n,s=!0,o=!1,a=[],c=-1,g=()=>e[c];var l={},_={},I=0;let v=[],b=[],D=[],w=[];function i(){if(g()===\\\")\\\"){for(var r=l[c];f(e[r-1]);)r-=1;return!/(if|while)$/.test(e.slice(r-5,r))}return!0}let u={pattern:/(?:(\\\\()|(\\\\))|({)|(})|(\\\")|(')|(\\\\/\\\\/)|(\\\\/\\\\*)|(\\\\/)|(`)|(import)|(export)|(\\\\+\\\\+|--))/g,handlers:[r=>{c=r,_[I++]=r},r=>{c=r,l[r]=_[--I]},r=>{c=r,a.push(u)},r=>(c=r,a.pop()),r=>(a.push(u),M),r=>(a.push(u),L),r=>q,r=>B,r=>{for(var m=r;m>0&&f(e[m-1]);)m-=1;if(m>0){var p=m;if(j.test(e[p-1]))for(;p>0&&j.test(e[p-1]);)p-=1;else for(;p>0&&K.test(e[p-1]);)p-=1;var R=e.slice(p,m);s=R?T.test(R)||G.test(R)||H.test(R)&&!i():!1}else s=!0;return d},r=>U,r=>{if(r===0||f(e[r-1])||j.test(e[r-1])){let m=r+6,p;do p=e[m++];while(f(p));let R=m>r+7;if(/^['\\\"{*]$/.test(p)||R&&/^[a-zA-Z_$]$/.test(p)){let h=ne(e,r);v.push(h),$=h.end}else if(p===\\\"(\\\"){let h=re(r);b.push(h),$=h.end}else if(p===\\\".\\\"){let h=oe(e,r,t);h&&(D.push(h),$=h.end)}}},r=>{if((r===0||f(e[r-1])||j.test(e[r-1]))&&/export[\\\\s\\\\n{]/.test(e.slice(r,r+7))){let m=ae(e,r);w.push(m),$=m.end}},r=>{o=!o&&e[r-1]===\\\"+\\\"}]},d={pattern:/(?:(\\\\[)|(\\\\\\\\)|(.))/g,handlers:[r=>s?P:u,r=>(n=S,x),r=>s&&!o?S:u]},S={pattern:/(?:(\\\\[)|(\\\\\\\\)|(\\\\/))/g,handlers:[()=>P,()=>(n=S,x),()=>u]},P={pattern:/(?:(\\\\])|(\\\\\\\\))/g,handlers:[()=>S,()=>(n=P,x)]},M={pattern:/(?:(\\\\\\\\)|(\\\"))/g,handlers:[()=>(n=M,x),()=>a.pop()]},L={pattern:/(?:(\\\\\\\\)|('))/g,handlers:[()=>(n=L,x),()=>a.pop()]},x={pattern:/(.)/g,handlers:[()=>n]},U={pattern:/(?:(\\\\${)|(\\\\\\\\)|(`))/g,handlers:[()=>(a.push(U),u),()=>(n=U,x),()=>u]},q={pattern:/((?:\\\\n|$))/g,handlers:[()=>u]},B={pattern:/(\\\\*\\\\/)/g,handlers:[()=>u]},y=u,$=0;for(;$<e.length;){y.pattern.lastIndex=$;let r=y.pattern.exec(e);if(!r){if(a.length>0||y!==u)throw new Error(\\\"Unexpected end of file\\\");break}$=r.index+r[0].length;for(let m=1;m<r.length;m+=1)if(r[m]){y=y.handlers[m-1](r.index)||y;break}}return[v,b,D,w]}function N(e,t,n,s){let[o,a,c,g]=ie(e,t),l=new Map;o.forEach(i=>{l.has(i.source)||l.set(i.source,i.name||`__dep_${l.size}`)}),g.forEach(i=>{i.source&&(l.has(i.source)||l.set(i.source,i.name||`__dep_${l.size}`))});let _=Array.from(l.keys()).map(i=>`'${i}'`).join(\\\", \\\"),I=[\\\"__import\\\",\\\"__exports\\\"].concat(Array.from(l.values())).join(\\\", \\\"),v=[];o.forEach(i=>{let u=l.get(i.source);i.specifiers.sort((d,S)=>{if(d.name===\\\"default\\\")return 1;if(S.name===\\\"default\\\")return-1}).forEach(d=>{if(d.name!==\\\"*\\\"){let S=d.name===\\\"default\\\"&&d.as===u?`${d.as} = ${u}.default; `:`var ${d.as} = ${u}.${d.name}; `;v.push(S)}})});let b=`${k}.define('${t}', '${n}', [${_}], function(${I}){ ${v.join(\\\"\\\")}`,D=[...o,...a,...c,...g].sort((i,u)=>i.start-u.start),w=0;for(let i=0;i<D.length;i+=1){let u=D[i];b+=e.slice(w,u.start)+u.toString(l),w=u.end}return b+=e.slice(w),g.forEach(i=>{i.name&&(b+=`\\n__exports.${i.as||i.name} = ${i.name};`)}),b+=`\\n},${JSON.stringify(s)});\\n//# sourceURL=${t}`,b}var z={};function C(e,t,n){return z[e]||(z[e]=fetch(e).then(s=>s.text()).then(s=>le(N(s,e,t,n),e)))}function ce(e,t,n,s){let o=s[e];return o?globalThis.System.import(o,n):C(new URL(e,t).href,n,s)}var ue=1;function le(e,t){return new Promise((n,s)=>{let o=`m${ue++}`,a=new Blob([`__shimport__.${o}=${e}`],{type:\\\"application/javascript\\\"}),c=document.createElement(\\\"script\\\");c.src=URL.createObjectURL(a);let g=()=>{URL.revokeObjectURL(c.src),c.remove()};c.onload=()=>{let l=window.__shimport__;n(l[o]),delete l[o],g()},c.onerror=()=>{g(),s(new Error(`Failed to evaluate the module \\\"${t}\\\".`))},document.head.appendChild(c)})}window[k]={define:me,load:pe};async function me(e,t,n,s,o){let a=l=>ce(l,e,t,o),c=await Promise.all(n.map(a)),g={};return s(a,g,...c),g}function pe(e,t,n){return C(e,n,t)}export{me as define,pe as load};\\n\",\"module-IUD22T4C.js\":\"var We=\\\".json\\\",St=\\\"FEDERATION_DEBUG\\\",H={AT:\\\"@\\\",HYPHEN:\\\"-\\\",SLASH:\\\"/\\\"},de={[H.AT]:\\\"scope_\\\",[H.HYPHEN]:\\\"_\\\",[H.SLASH]:\\\"__\\\"},Zt={[de[H.AT]]:H.AT,[de[H.HYPHEN]]:H.HYPHEN,[de[H.SLASH]]:H.SLASH},Rt=\\\":\\\";var me=(function(e){return e[e.UNKNOWN=1]=\\\"UNKNOWN\\\",e[e.CALCULATED=2]=\\\"CALCULATED\\\",e[e.NO_USE=0]=\\\"NO_USE\\\",e})({});var P=typeof ENV_TARGET<\\\"u\\\"?ENV_TARGET===\\\"web\\\":typeof window<\\\"u\\\"&&typeof window.document<\\\"u\\\";function Be(){return P}function he(){return typeof navigator<\\\"u\\\"&&navigator?.product===\\\"ReactNative\\\"}function po(){try{if(Be()&&window.localStorage)return!!localStorage.getItem(St)}catch{return!1}return!1}function re(){return typeof process<\\\"u\\\"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<\\\"u\\\"&&FEDERATION_DEBUG?!0:po()}var Eo=\\\"[ Federation Runtime ]\\\";var pe=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}${Rt}${r}`:r:t,\\\"\\\"):\\\"\\\"};function oe(e,t){if(\\\"getPublicPath\\\"in e){let r;return e.getPublicPath.startsWith(\\\"function\\\")?r=new Function(\\\"return \\\"+e.getPublicPath)()():r=new Function(e.getPublicPath)(),`${r}${t}`}else return\\\"publicPath\\\"in e?!Be()&&!he()&&\\\"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 ye=e=>{console.warn(`${Eo}: ${e}`)};function Ee(e){try{return JSON.stringify(e,null,2)}catch{return\\\"\\\"}}var je=(e,t)=>{if(!e)return t;let o=(n=>{if(n===\\\".\\\")return\\\"\\\";if(n.startsWith(\\\"./\\\"))return n.replace(\\\"./\\\",\\\"\\\");if(n.startsWith(\\\"/\\\")){let s=n.slice(1);return s.endsWith(\\\"/\\\")?s.slice(0,-1):s}return n})(e);return o?o.endsWith(\\\"/\\\")?`${o}${t}`:`${o}/${t}`:t};function Qt(e){return e.replace(/#.*$/,\\\"\\\").replace(/\\\\?.*$/,\\\"\\\").replace(/\\\\/[^\\\\/]+$/,\\\"/\\\")}function bt(e,t={}){let{remotes:r={},overrides:o={},version:n}=t,s,i=()=>\\\"publicPath\\\"in e.metaData?(e.metaData.publicPath===\\\"auto\\\"||e.metaData.publicPath===\\\"\\\")&&n?Qt(n):e.metaData.publicPath:e.metaData.getPublicPath,a=Object.keys(o),c={};Object.keys(r).length||(c=e.remotes?.reduce((y,S)=>{let v,M=S.federationContainerName;return a.includes(M)?v=o[M]:\\\"version\\\"in S?v=S.version:v=S.entry,y[M]={matchedVersion:v},y},{})||{}),Object.keys(r).forEach(y=>c[y]={matchedVersion:a.includes(y)?o[y]:r[y]});let{remoteEntry:{path:l,name:f,type:u},types:d={path:\\\"\\\",name:\\\"\\\",zip:\\\"\\\",api:\\\"\\\"},buildInfo:{buildVersion:m},globalName:h,ssrRemoteEntry:p}=e.metaData,{exposes:g}=e,E={version:n||\\\"\\\",buildVersion:m,globalName:h,remoteEntry:je(l,f),remoteEntryType:u,remoteTypes:je(d.path,d.name),remoteTypesZip:d.zip||\\\"\\\",remoteTypesAPI:d.api||\\\"\\\",remotesInfo:c,shared:e?.shared.map(y=>({assets:y.assets,sharedName:y.name,version:y.version,usedExports:y.referenceExports||[]})),modules:g?.map(y=>({moduleName:y.name,modulePath:y.path,assets:y.assets}))};if(\\\"publicPath\\\"in e.metaData?(s={...E,publicPath:i()},typeof e.metaData.ssrPublicPath==\\\"string\\\"&&(s.ssrPublicPath=e.metaData.ssrPublicPath)):s={...E,getPublicPath:i()},p){let y=je(p.path,p.name);s.ssrRemoteEntry=y,s.ssrRemoteEntryType=p.type||\\\"commonjs-module\\\"}return s}function ge(e){return!!(\\\"remoteEntry\\\"in e&&e.remoteEntry.includes(We))}var er=\\\"[ Module Federation ]\\\",_e=console,So=[\\\"logger.ts\\\",\\\"logger.js\\\",\\\"captureStackTrace\\\",\\\"Logger.emit\\\",\\\"Logger.log\\\",\\\"Logger.info\\\",\\\"Logger.warn\\\",\\\"Logger.error\\\",\\\"Logger.debug\\\"];function Ro(){try{let e=new Error().stack;if(!e)return;let[,...t]=e.split(`\\n`),r=t.filter(o=>!So.some(n=>o.includes(n)));return r.length?`Stack trace:\\n${r.slice(0,5).join(`\\n`)}`:void 0}catch{return}}var tr=class{constructor(e,t=_e){this.prefix=e,this.delegate=t??_e}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??_e}emit(e,t){let r=this.delegate,o=re()?Ro():void 0,n=o?[...t,o]:t,s=(()=>{switch(e){case\\\"log\\\":return[\\\"log\\\",\\\"info\\\"];case\\\"info\\\":return[\\\"info\\\",\\\"log\\\"];case\\\"warn\\\":return[\\\"warn\\\",\\\"info\\\",\\\"log\\\"];case\\\"error\\\":return[\\\"error\\\",\\\"warn\\\",\\\"log\\\"];default:return[\\\"debug\\\",\\\"log\\\"]}})();for(let i of s){let a=r[i];if(typeof a==\\\"function\\\"){a.call(r,this.prefix,...n);return}}for(let i of s){let a=_e[i];if(typeof a==\\\"function\\\"){a.call(_e,this.prefix,...n);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){re()&&this.emit(\\\"debug\\\",e)}};function Ve(e){return new tr(e)}function rr(e){let t=new tr(e);return Object.defineProperty(t,\\\"__mf_infrastructure_logger__\\\",{value:!0,enumerable:!1,configurable:!1}),t}var bo=Ve(er),Io=rr(er);async function It(e,t){try{return await e()}catch(r){!t&&ye(r);return}}function qe(e,t){let r=/^(https?:)?\\\\/\\\\//i;return e.replace(r,\\\"\\\").replace(/\\\\/$/,\\\"\\\")===t.replace(r,\\\"\\\").replace(/\\\\/$/,\\\"\\\")}function Ke(e){let t=null,r=!0,o=2e4,n,s=document.getElementsByTagName(\\\"script\\\");for(let l=0;l<s.length;l++){let f=s[l],u=f.getAttribute(\\\"src\\\");if(u&&qe(u,e.url)){t=f,r=!1;break}}if(!t){let l=e.attrs;t=document.createElement(\\\"script\\\"),t.type=l?.type===\\\"module\\\"?\\\"module\\\":\\\"text/javascript\\\";let f;e.createScriptHook&&(f=e.createScriptHook(e.url,e.attrs),f instanceof HTMLScriptElement?t=f:typeof f==\\\"object\\\"&&(\\\"script\\\"in f&&f.script&&(t=f.script),\\\"timeout\\\"in f&&f.timeout&&(o=f.timeout))),t.src||(t.src=e.url),l&&!f&&Object.keys(l).forEach(u=>{t&&(u===\\\"async\\\"||u===\\\"defer\\\"?t[u]=l[u]:t.getAttribute(u)||t.setAttribute(u,l[u]))})}let i=null,a=typeof window<\\\"u\\\"?l=>{if(l.filename&&qe(l.filename,e.url)){let f=new Error(`ScriptExecutionError: Script \\\"${e.url}\\\" loaded but threw a runtime error during execution: ${l.message} (${l.filename}:${l.lineno}:${l.colno})`);f.name=\\\"ScriptExecutionError\\\",i=f}}:null;a&&window.addEventListener(\\\"error\\\",a);let c=async(l,f)=>{clearTimeout(n),a&&window.removeEventListener(\\\"error\\\",a);let u=()=>{if(f?.type===\\\"error\\\"){let d=new Error(f?.isTimeout?`ScriptNetworkError: Script \\\"${e.url}\\\" timed out.`:`ScriptNetworkError: Failed to load script \\\"${e.url}\\\" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);d.name=\\\"ScriptNetworkError\\\",e?.onErrorCallback&&e?.onErrorCallback(d)}else i?e?.onErrorCallback&&e?.onErrorCallback(i):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,It(()=>{let{needDeleteScript:d=!0}=e;d&&t?.parentNode&&t.parentNode.removeChild(t)}),l&&typeof l==\\\"function\\\")){let d=l(f);if(d instanceof Promise){let m=await d;return u(),m}return u(),d}u()};return t.onerror=c.bind(null,t.onerror),t.onload=c.bind(null,t.onload),n=setTimeout(()=>{c(null,{type:\\\"error\\\",isTimeout:!0})},o),{script:t,needAttach:r}}function wt(e){let t=null,r=!0,o=2e4,n,s=document.getElementsByTagName(\\\"link\\\");for(let a=0;a<s.length;a++){let c=s[a],l=c.getAttribute(\\\"href\\\"),f=c.getAttribute(\\\"rel\\\");if(l&&qe(l,e.url)&&f===e.attrs.rel){t=c,r=!1;break}}if(!t){t=document.createElement(\\\"link\\\"),t.setAttribute(\\\"href\\\",e.url);let a,c=!0,l=e.attrs;e.createLinkHook&&(a=e.createLinkHook(e.url,l),a instanceof HTMLLinkElement?(t=a,c=!1):typeof a==\\\"object\\\"&&(\\\"link\\\"in a&&a.link&&(t=a.link,c=!1),\\\"timeout\\\"in a&&a.timeout&&(o=a.timeout))),l&&c&&Object.keys(l).forEach(f=>{t&&!t.getAttribute(f)&&t.setAttribute(f,l[f])})}if(!r)return Promise.resolve().then(()=>{e?.cb&&e?.cb()}),{link:t,needAttach:r};let i=(a,c)=>{n&&clearTimeout(n);let l=()=>{if(c?.type===\\\"error\\\"){let f=new Error(c?.isTimeout?`LinkNetworkError: Link \\\"${e.url}\\\" timed out.`:`LinkNetworkError: Failed to load link \\\"${e.url}\\\" - the URL is unreachable or the server returned an error.`);f.name=\\\"LinkNetworkError\\\",e?.onErrorCallback&&e?.onErrorCallback(f)}else e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,It(()=>{let{needDeleteLink:f=!0}=e;f&&t?.parentNode&&t.parentNode.removeChild(t)}),a)){let f=a(c);return l(),f}l()};return t.onerror=i.bind(null,t.onerror),t.onload=i.bind(null,t.onload),n=setTimeout(()=>{i(null,{type:\\\"error\\\",isTimeout:!0})},o),{link:t,needAttach:r}}function ze(e,t){let{attrs:r={},createScriptHook:o}=t;return new Promise((n,s)=>{let{script:i,needAttach:a}=Ke({url:e,cb:n,onErrorCallback:s,attrs:{fetchpriority:\\\"high\\\",...r},createScriptHook:o,needDeleteScript:!0});a&&document.head.appendChild(i)})}var Xe=new Map;function K(e){if(!e)throw new Error(\\\"import specifier is required\\\");if(Xe.has(e))return Xe.get(e);let t=new Function(\\\"name\\\",\\\"return import(name)\\\")(e).then(r=>r).catch(r=>{throw console.error(`Error importing module ${e}:`,r),Xe.delete(e),r});return Xe.set(e,t),t}var wo=async(e,t,r)=>{let n=await((s,i)=>r.lifecycle.fetch.emit(s,i))(e,t||{});return!n||!(n instanceof Response)?fetch(e,t||{}):n},nr=typeof ENV_TARGET>\\\"u\\\"||ENV_TARGET!==\\\"web\\\"?(e,t,r,o)=>{if(o?.createScriptHook){let a=o.createScriptHook(e);a&&typeof a==\\\"object\\\"&&\\\"url\\\"in a&&(e=a.url)}let n;try{n=new URL(e)}catch(a){console.error(\\\"Error constructing URL:\\\",a),t(new Error(`Invalid URL: ${a}`));return}let s=async()=>o?.fetch?(a,c)=>wo(a,c,o):fetch,i=async(a,c)=>{try{let f=await(await a(c.href)).text(),[u,d]=await Promise.all([K(\\\"path\\\"),K(\\\"vm\\\")]),m={exports:{},module:{exports:{}}},h=c.pathname.split(\\\"/\\\").slice(0,-1).join(\\\"/\\\"),p=u.basename(c.pathname),g=new d.Script(`(function(exports, module, require, __dirname, __filename) {${f}\\n})`,{filename:p,importModuleDynamically:d.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER??K}),E;E=(await K(\\\"node:module\\\")).createRequire(c.protocol===\\\"file:\\\"||c.protocol===\\\"node:\\\"?c.href:u.join(process.cwd(),\\\"__mf_require_base__.js\\\")),g.runInThisContext()(m.exports,m.module,E,h,p);let y=m.module.exports||m.exports;if(r&&y&&r.globalName){t(void 0,y[r.globalName]||y);return}t(void 0,y)}catch(l){t(l instanceof Error?l:new Error(`Script execution error: ${l}`))}};s().then(async a=>{if(r?.type===\\\"esm\\\"||r?.type===\\\"module\\\")return ar(n.href,{fetch:a,vm:await K(\\\"vm\\\")}).then(async c=>{await c.evaluate(),t(void 0,c.namespace)}).catch(c=>{t(c instanceof Error?c:new Error(`Script execution error: ${c}`))});i(a,n)}).catch(a=>{t(a)})}:(e,t,r,o)=>{t(new Error(\\\"createScriptNode is disabled in non-Node.js environment\\\"))},Ye=typeof ENV_TARGET>\\\"u\\\"||ENV_TARGET!==\\\"web\\\"?(e,t)=>new Promise((r,o)=>{nr(e,(n,s)=>{if(n)o(n);else{let i=t?.attrs?.globalName||`__FEDERATION_${t?.attrs?.name}:custom__`;r(globalThis[i]=s)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error(\\\"loadScriptNode is disabled in non-Node.js environment\\\")},ne=new Map,sr=e=>e.startsWith(\\\"http:\\\")||e.startsWith(\\\"https:\\\"),ir=e=>!e.startsWith(\\\"./\\\")&&!e.startsWith(\\\"../\\\")&&!e.startsWith(\\\"/\\\")&&!e.includes(\\\":\\\");function To(e){let t=new URL(e),r=encodeURIComponent(t.protocol.slice(0,-1)),o=encodeURIComponent(t.host),n=t.pathname.split(\\\"/\\\").map(i=>encodeURIComponent(i)).join(\\\"/\\\"),s=encodeURIComponent(`${t.search}${t.hash}`);return`/${r}/${o}${n}${s?`/${s}`:\\\"\\\"}`}function No(e,t){let r=t.endsWith(\\\"/\\\")?t:`${t}/`;return new URL(`__module_federation_remote__${To(e)}`,r).href}async function Mo(e){return e.startsWith(\\\"node:\\\")?!0:ir(e)?(await K(\\\"node:module\\\")).builtinModules.includes(e):!1}function vo(e){let t=e&&(typeof e==\\\"object\\\"||typeof e==\\\"function\\\")?e:{default:e},r={...t};return Object.prototype.hasOwnProperty.call(r,\\\"default\\\")||(r.default=t),r}async function Ao(e,t,r){if(typeof r.SyntheticModule!=\\\"function\\\")throw new Error(\\\"vm.SyntheticModule is required to load Node.js built-in modules in ESM remote entries.\\\");let o=vo(t),n=Object.keys(o),s=new r.SyntheticModule(n,function(){for(let a of n)this.setExport(a,o[a])},{identifier:e});return ne.set(e,s),await s.link(async()=>{throw new Error(`Node.js built-in module \\\"${e}\\\" should not request child modules.`)}),await s.evaluate(),s}async function Po(e,t){let r=`node-builtin:${e}`;return ne.has(r)?ne.get(r):Ao(r,await K(e),t)}async function or(e,t,r){if(await Mo(e))return Po(e,r.vm);if(ir(e))throw new Error(`Unsupported ESM module specifier \\\"${e}\\\". Only relative or absolute http(s) remote modules and Node.js built-in modules are supported.`);let o=new URL(e,t).href;if(!sr(o))throw new Error(`Unsupported ESM module specifier \\\"${e}\\\" resolved to \\\"${o}\\\". Only http(s) remote modules and Node.js built-in modules are supported.`);return ar(o,r)}async function $o(e){if(e.status===\\\"linked\\\"&&await e.evaluate(),e.status===\\\"errored\\\")throw e.error;return e}async function ar(e,t){if(ne.has(e))return ne.get(e);let{fetch:r,vm:o}=t;if(!sr(e))throw new Error(`Unsupported ESM module URL \\\"${e}\\\". Only http(s) remote modules and Node.js built-in modules are supported.`);let n=await(await r(e)).text(),s=(await K(\\\"node:url\\\")).pathToFileURL(process.cwd()).href,i=new o.SourceTextModule(n,{identifier:e,initializeImportMeta:a=>{a.url=No(e,s)},importModuleDynamically:async a=>$o(await or(a,e,t))});return ne.set(e,i),await i.link(async a=>or(a,e,t)),i}var Oo=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split(\\\"-\\\")[0].toLowerCase()}#${e.toLowerCase()}`,Se=(e,t,r,o)=>{let n=[`${[t[e]]} #${e}`];return r&&n.push(`args: ${JSON.stringify(r)}`),n.push(Oo(e)),o&&n.push(`Original Error Message:\\n ${o}`),n.join(`\\n`)};function cr(e,t,r,o,n,s){return o(Se(e,t,r,n))}var J=\\\"[ Federation Runtime ]\\\",Je=Ve(J);function N(e,t,r,o,n){e||(r!==void 0?_(t,r,o,void 0,n):_(t))}function _(e,t,r,o,n){if(t!==void 0)return cr(e,t,r??{},i=>{throw new Error(`${J}: ${i}`)},o,n);let s=e;throw s instanceof Error?(s.message.startsWith(J)||(s.message=`${J}: ${s.message}`),s):new Error(`${J}: ${s}`)}function C(e){e instanceof Error&&(e.message.startsWith(J)||(e.message=`${J}: ${e.message}`)),Je.warn(e)}function lr(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function z(e){return\\\"version\\\"in e&&e.version?`${e.name}:${e.version}`:\\\"entry\\\"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function se(e){return typeof e.entry<\\\"u\\\"}function Ze(e){return!e.entry.includes(\\\".json\\\")}function Re(e){return e&&typeof e==\\\"object\\\"}var Lo=Object.prototype.toString;function Qe(e){return Lo.call(e)===\\\"[object Object]\\\"}function et(e){return Array.isArray(e)?e:[e]}function tt(e){let t={url:\\\"\\\",type:\\\"global\\\",globalName:\\\"\\\"};return P||he()||!(\\\"ssrRemoteEntry\\\"in e)?\\\"remoteEntry\\\"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:\\\"ssrRemoteEntry\\\"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}var fr=(e,t)=>{let r;return e.endsWith(\\\"/\\\")?r=e.slice(0,-1):r=e,t.startsWith(\\\".\\\")&&(t=t.slice(1)),r=r+t,r};var Fo=2e3,R=typeof globalThis==\\\"object\\\"?globalThis:window,x=(()=>{try{return document.defaultView}catch{return R}})(),V=x;function rt(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function ot(e,t){return Object.hasOwnProperty.call(e,t)}ot(R,\\\"__GLOBAL_LOADING_REMOTE_ENTRY__\\\")||rt(R,\\\"__GLOBAL_LOADING_REMOTE_ENTRY__\\\",{});var W=R.__GLOBAL_LOADING_REMOTE_ENTRY__;function ur(e){ot(e,\\\"__VMOK__\\\")&&!ot(e,\\\"__FEDERATION__\\\")&&rt(e,\\\"__FEDERATION__\\\",e.__VMOK__),ot(e,\\\"__FEDERATION__\\\")||(rt(e,\\\"__FEDERATION__\\\",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map,__PRELOADED_ASSETS__:new Set}),rt(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}ur(R);ur(x);function nt(e){R.__FEDERATION__.__INSTANCES__.push(e)}function st(){return R.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function it(e,t=re()){t&&(R.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,R.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__=\\\"2.9.2\\\")}function D(e,t){if(typeof t==\\\"string\\\"){if(e[t])return{value:e[t],key:t};{let r=Object.keys(e);for(let o of r){let[n,s]=o.split(\\\":\\\"),i=`${n}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}else _(`getInfoWithoutType: \\\"key\\\" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}var be=()=>x.__FEDERATION__.moduleInfo,dr=(e,t)=>{let r=D(t,z(e)).value;if(r&&!r.version&&\\\"version\\\"in e&&e.version&&(r.version=e.version),r)return r;if(\\\"version\\\"in e&&e.version){let{version:o,...n}=e,s=z(n),i=D(x.__FEDERATION__.moduleInfo,s).value;if(i?.version===o)return i}},ie=e=>dr(e,x.__FEDERATION__.moduleInfo),at=(e,t)=>{let r=z(e);return x.__FEDERATION__.moduleInfo[r]=t,x.__FEDERATION__.moduleInfo},ct=e=>(x.__FEDERATION__.moduleInfo={...x.__FEDERATION__.moduleInfo,...e},()=>{let t=Object.keys(e);for(let r of t)delete x.__FEDERATION__.moduleInfo[r]}),Ie=(e,t)=>{let r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:R[r]}};var Tt=()=>x.__FEDERATION__.__GLOBAL_PLUGIN__,Nt=e=>R.__FEDERATION__.__PRELOADED_MAP__.get(e),Mt=e=>R.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),mr=e=>R.__FEDERATION__.__PRELOADED_ASSETS__.has(e),hr=e=>{let t=R.__FEDERATION__.__PRELOADED_ASSETS__;if(t.add(e),t.size>Fo){let r=t.values().next().value;r!==void 0&&t.delete(r)}};var pr=\\\"[0-9A-Za-z-]+\\\",At=`(?:\\\\\\\\+(${pr}(?:\\\\\\\\.${pr})*))`,we=\\\"0|[1-9]\\\\\\\\d*\\\",lt=\\\"[0-9]+\\\",gr=\\\"\\\\\\\\d*[a-zA-Z-][a-zA-Z0-9-]*\\\",yr=`(?:${lt}|${gr})`,ko=`(?:-?(${yr}(?:\\\\\\\\.${yr})*))`,Er=`(?:${we}|${gr})`,_r=`(?:-(${Er}(?:\\\\\\\\.${Er})*))`,vt=`${we}|x|X|\\\\\\\\*`,ae=`[v=\\\\\\\\s]*(${vt})(?:\\\\\\\\.(${vt})(?:\\\\\\\\.(${vt})(?:${_r})?${At}?)?)?`,Sr=`^\\\\\\\\s*(${ae})\\\\\\\\s+-\\\\\\\\s+(${ae})\\\\\\\\s*$`,xo=`[v=\\\\\\\\s]*${`(${lt})\\\\\\\\.(${lt})\\\\\\\\.(${lt})`}${ko}?${At}?`,Pt=\\\"((?:<|>)?=?)\\\",Rr=`(\\\\\\\\s*)${Pt}\\\\\\\\s*(${xo}|${ae})`,br=\\\"(?:~>?)\\\",Ir=`(\\\\\\\\s*)${br}\\\\\\\\s+`,wr=\\\"(?:\\\\\\\\^)\\\",Tr=`(\\\\\\\\s*)${wr}\\\\\\\\s+`,Nr=\\\"(<|>)?=?\\\\\\\\s*\\\\\\\\*\\\",Mr=`^${wr}${ae}$`,Do=`v?${`(${we})\\\\\\\\.(${we})\\\\\\\\.(${we})`}${_r}?${At}?`,vr=`^${br}${ae}$`,Ar=`^${Pt}\\\\\\\\s*${ae}$`,Pr=`^${Pt}\\\\\\\\s*(${Do})$|^$`,$r=\\\"^\\\\\\\\s*>=\\\\\\\\s*0.0.0\\\\\\\\s*$\\\";function U(e){return new RegExp(e)}function $(e){return!e||e.toLowerCase()===\\\"x\\\"||e===\\\"*\\\"}function $t(...e){return t=>e.reduce((r,o)=>o(r),t)}function Ot(e){return e.match(U(Pr))}function Lt(e,t,r,o){let n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function Or(e){return e.replace(U(Sr),(t,r,o,n,s,i,a,c,l,f,u,d)=>($(o)?r=\\\"\\\":$(n)?r=`>=${o}.0.0`:$(s)?r=`>=${o}.${n}.0`:r=`>=${r}`,$(l)?c=\\\"\\\":$(f)?c=`<${Number(l)+1}.0.0-0`:$(u)?c=`<${l}.${Number(f)+1}.0-0`:d?c=`<=${l}.${f}.${u}-${d}`:c=`<=${c}`,`${r} ${c}`.trim()))}function Lr(e){return e.replace(U(Rr),\\\"$1$2$3\\\")}function Fr(e){return e.replace(U(Ir),\\\"$1~\\\")}function kr(e){return e.replace(U(Tr),\\\"$1^\\\")}function xr(e){return e.trim().split(/\\\\s+/).map(t=>t.replace(U(Mr),(r,o,n,s,i)=>$(o)?\\\"\\\":$(n)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:$(s)?o===\\\"0\\\"?`>=${o}.${n}.0 <${o}.${Number(n)+1}.0-0`:`>=${o}.${n}.0 <${Number(o)+1}.0.0-0`:i?o===\\\"0\\\"?n===\\\"0\\\"?`>=${o}.${n}.${s}-${i} <${o}.${n}.${Number(s)+1}-0`:`>=${o}.${n}.${s}-${i} <${o}.${Number(n)+1}.0-0`:`>=${o}.${n}.${s}-${i} <${Number(o)+1}.0.0-0`:o===\\\"0\\\"?n===\\\"0\\\"?`>=${o}.${n}.${s} <${o}.${n}.${Number(s)+1}-0`:`>=${o}.${n}.${s} <${o}.${Number(n)+1}.0-0`:`>=${o}.${n}.${s} <${Number(o)+1}.0.0-0`)).join(\\\" \\\")}function Dr(e){return e.trim().split(/\\\\s+/).map(t=>t.replace(U(vr),(r,o,n,s,i)=>$(o)?\\\"\\\":$(n)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:$(s)?`>=${o}.${n}.0 <${o}.${Number(n)+1}.0-0`:i?`>=${o}.${n}.${s}-${i} <${o}.${Number(n)+1}.0-0`:`>=${o}.${n}.${s} <${o}.${Number(n)+1}.0-0`)).join(\\\" \\\")}function Hr(e){return e.split(/\\\\s+/).map(t=>t.trim().replace(U(Ar),(r,o,n,s,i,a)=>{let c=$(n),l=c||$(s),f=l||$(i);return o===\\\"=\\\"&&f&&(o=\\\"\\\"),a=\\\"\\\",c?o===\\\">\\\"||o===\\\"<\\\"?\\\"<0.0.0-0\\\":\\\"*\\\":o&&f?(l&&(s=0),i=0,o===\\\">\\\"?(o=\\\">=\\\",l?(n=Number(n)+1,s=0,i=0):(s=Number(s)+1,i=0)):o===\\\"<=\\\"&&(o=\\\"<\\\",l?n=Number(n)+1:s=Number(s)+1),o===\\\"<\\\"&&(a=\\\"-0\\\"),`${o+n}.${s}.${i}${a}`):l?`>=${n}.0.0${a} <${Number(n)+1}.0.0-0`:f?`>=${n}.${s}.0${a} <${n}.${Number(s)+1}.0-0`:r})).join(\\\" \\\")}function Cr(e){return e.trim().replace(U(Nr),\\\"\\\")}function Ur(e){return e.trim().replace(U($r),\\\"\\\")}function ut(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Ho(e,t){let{preRelease:r}=e,{preRelease:o}=t;if(r===void 0&&o)return 1;if(r&&o===void 0)return-1;if(r===void 0&&o===void 0)return 0;for(let n=0,s=r.length;n<=s;n++){let i=r[n],a=o[n];if(i!==a)return i===void 0&&a===void 0?0:i?a?ut(i,a):-1:1}return 0}function ft(e,t){return ut(e.major,t.major)||ut(e.minor,t.minor)||ut(e.patch,t.patch)||Ho(e,t)}function Ft(e,t){return e.version===t.version}function Gr(e,t){switch(e.operator){case\\\"\\\":case\\\"=\\\":return Ft(e,t);case\\\">\\\":return ft(e,t)<0;case\\\">=\\\":return Ft(e,t)||ft(e,t)<0;case\\\"<\\\":return ft(e,t)>0;case\\\"<=\\\":return Ft(e,t)||ft(e,t)>0;case void 0:return!0;default:return!1}}function Co(e){return $t(xr,Dr,Hr,Cr)(e)}function Uo(e){return $t(Or,Lr,Fr,kr)(e.trim()).split(/\\\\s+/).join(\\\" \\\")}function B(e,t){if(!e)return!1;let r=Ot(e);if(!r)return!1;let[,o,,n,s,i,a]=r,c={operator:o,version:Lt(n,s,i,a),major:n,minor:s,patch:i,preRelease:a?.split(\\\".\\\")},l=t.split(\\\"||\\\");for(let f of l){let u=f.trim();if(!u||u===\\\"*\\\"||u===\\\"x\\\")return!0;try{let d=Uo(u);if(!d.trim())return!0;let m=d.split(\\\" \\\").map(g=>Co(g)).join(\\\" \\\");if(!m.trim())return!0;let h=m.split(/\\\\s+/).map(g=>Ur(g)).filter(Boolean);if(h.length===0)continue;let p=!0;for(let g of h){let E=Ot(g);if(!E){p=!1;break}let[,y,,S,v,M,A]=E;if(!Gr({operator:y,version:Lt(S,v,M,A),major:S,minor:v,patch:M,preRelease:A?.split(\\\".\\\")},c)){p=!1;break}}if(p)return!0}catch(d){console.error(`[semver] Error processing range part \\\"${u}\\\":`,d);continue}}return!1}var j=\\\"default\\\",dt=\\\"global\\\";function Go(e,t,r,o){let n;return\\\"get\\\"in e?n=e.get:\\\"lib\\\"in e?n=()=>Promise.resolve(e.lib):n=()=>Promise.resolve(()=>{_(`Cannot get shared \\\"${r}\\\" from \\\"${t}\\\": neither \\\"get\\\" nor \\\"lib\\\" is provided in the share config.`)}),e.shareConfig?.eager&&e.treeShaking?.mode&&_(`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:n,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??o)||\\\"version-first\\\",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??\\\"server-calc\\\",status:e.treeShaking.status??me.UNKNOWN,useIn:[]}:void 0}}function ht(e,t){let r=t.shared||{},o=t.name,n=Object.keys(r).reduce((i,a)=>{let c=et(r[a]);return i[a]=i[a]||[],c.forEach(l=>{i[a].push(Go(l,o,a,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(n).forEach(i=>{s[i]?n[i].forEach(a=>{s[i].find(c=>c.version===a.version)||s[i].push(a)}):s[i]=n[i]}),{allShareInfos:s,newShareInfos:n}}function le(e,t){if(!e)return!1;let{status:r,mode:o}=e;return r===me.NO_USE?!1:r===me.CALCULATED?!0:o===\\\"runtime-infer\\\"?t?Bo(e,t):!0:!1}function Z(e,t){let r=o=>{if(!Number.isNaN(Number(o))){let n=o.split(\\\".\\\"),s=o;for(let i=0;i<3-n.length;i++)s+=\\\".0\\\";return s}return o};return!!B(r(e),`<=${r(t)}`)}var Te=(e,t)=>{let r=t||function(o,n){return Z(o,n)};return Object.keys(e).reduce((o,n)=>!o||r(o,n)||o===\\\"0\\\"?n:o,0)},mt=e=>!!e.loaded||typeof e.lib==\\\"function\\\",Wo=e=>!!e.loading,Bo=(e,t)=>{if(!e||!t)return!1;let{usedExports:r}=e;return r?!!t.every(o=>r.includes(o)):!1};function jo(e,t,r,o){let n=e[t][r],s=\\\"\\\",i=le(o),a=function(c,l){return i?n[c].treeShaking?n[l].treeShaking?!mt(n[c].treeShaking)&&Z(c,l):!1:!0:!mt(n[c])&&Z(c,l)};if(i){if(s=Te(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:Te(e[t][r],a),useTreesShaking:i}}var ce=e=>mt(e)||Wo(e);function Vo(e,t,r,o){let n=e[t][r],s=\\\"\\\",i=le(o),a=function(c,l){if(i){if(!n[c].treeShaking)return!0;if(!n[l].treeShaking)return!1;if(ce(n[l].treeShaking))return ce(n[c].treeShaking)?!!Z(c,l):!0;if(ce(n[c].treeShaking))return!1}return ce(n[l])?ce(n[c])?!!Z(c,l):!0:ce(n[c])?!1:Z(c,l)};if(i){if(s=Te(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:Te(e[t][r],a),useTreesShaking:i}}function qo(e){return e===\\\"loaded-first\\\"?Vo:jo}function X(e,t,r,o,n){if(!e)return;let{shareConfig:s,scope:i=j,strategy:a,treeShaking:c}=r,l=Array.isArray(i)?i:[i];for(let f of l)if(s&&e[f]&&e[f][t]){let{requiredVersion:u}=s,{version:d,useTreesShaking:m}=qo(a)(e,f,t,c),h=()=>{let g=e[f][t][d];if(s.singleton){if(typeof u==\\\"string\\\"&&!B(d,u)){let E=`Version ${d} from ${d&&g.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;s.strictVersion?_(E):C(E)}return{shared:g,useTreesShaking:m}}else{if(u===!1||u===\\\"*\\\")return{shared:g,useTreesShaking:m};if(B(d,u))return{shared:g,useTreesShaking:m};let E=le(c);if(E){for(let[y,S]of Object.entries(e[f][t]))if(le(S.treeShaking,c?.usedExports)&&B(y,u))return{shared:S,useTreesShaking:E}}for(let[y,S]of Object.entries(e[f][t]))if(B(y,u))return{shared:S,useTreesShaking:!1}}},p={shareScopeMap:e,scope:f,pkgName:t,version:d,GlobalFederation:V.__FEDERATION__,shareInfo:r,resolver:h,loadContext:n};return(o.emit(p)||p).resolver()}}function Ne(){return V.__FEDERATION__.__SHARE__}function kt(e){let{pkgName:t,extraOptions:r,shareInfos:o}=e,n=c=>{if(!c)return;let l={};return c.forEach(u=>{l[u.version]=u}),l[Te(l,function(u,d){return!mt(l[u])&&Z(u,d)})]},s=r?.resolver??n,i=c=>c!==null&&typeof c==\\\"object\\\"&&!Array.isArray(c),a=(...c)=>{let l={};for(let f of c)if(f)for(let[u,d]of Object.entries(f)){let m=l[u];i(m)&&i(d)?l[u]=a(m,d):d!==void 0&&(l[u]=d)}return l};return a(s(o[t]),r?.customShareInfo)}var Q=(e,t)=>{e.useIn||(e.useIn=[]),lr(e.useIn,t)};function Me(e,t){return t&&e.treeShaking?e.treeShaking:e}function fe(e,t){return!t||t===\\\".\\\"?e:`${e}/${t.replace(/^\\\\.\\\\//,\\\"\\\")}`}function ve(e,t){for(let r of e){let o=t.startsWith(r.name),n=t.replace(r.name,\\\"\\\");if(o){if(n.startsWith(\\\"/\\\")){let a=r.name;return n=`.${n}`,{pkgNameOrAlias:a,expose:n,remote:r}}else if(n===\\\"\\\")return{pkgNameOrAlias:r.name,expose:\\\".\\\",remote:r}}let s=r.alias&&t.startsWith(r.alias),i=r.alias&&t.replace(r.alias,\\\"\\\");if(r.alias&&s){if(i&&i.startsWith(\\\"/\\\")){let a=r.alias;return i=`.${i}`,{pkgNameOrAlias:a,expose:i,remote:r}}else if(i===\\\"\\\")return{pkgNameOrAlias:r.alias,expose:\\\".\\\",remote:r}}}}function Wr(e,t){for(let r of e)if(t===r.name||r.alias&&t===r.alias)return r}var Ae=\\\"RUNTIME-001\\\",Pe=\\\"RUNTIME-002\\\",$e=\\\"RUNTIME-003\\\",Oe=\\\"RUNTIME-004\\\",Le=\\\"RUNTIME-005\\\",ue=\\\"RUNTIME-006\\\",Fe=\\\"RUNTIME-007\\\",ee=\\\"RUNTIME-008\\\",xt=\\\"RUNTIME-009\\\",ke=\\\"RUNTIME-010\\\",xe=\\\"RUNTIME-011\\\",Dt=\\\"RUNTIME-012\\\",De=\\\"RUNTIME-013\\\",He=\\\"RUNTIME-014\\\",Ce=\\\"RUNTIME-015\\\",Ht=\\\"TYPE-001\\\",Ct=\\\"BUILD-001\\\",Ut=\\\"BUILD-002\\\";var I={[Ae]:\\\"Failed to get remoteEntry exports.\\\",[Pe]:'The remote entry interface does not contain \\\"init\\\"',[$e]:\\\"Failed to get manifest.\\\",[Oe]:\\\"Failed to locate remote.\\\",[Le]:\\\"Invalid loadShareSync function call from bundler runtime\\\",[ue]:\\\"Invalid loadShareSync function call from runtime\\\",[Fe]:\\\"Failed to get remote snapshot.\\\",[ee]:\\\"Failed to load script resources.\\\",[xt]:\\\"Please call createInstance first.\\\",[ke]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use \\\"createInstance\\\" api.',[xe]:\\\"The remoteEntry URL is missing from the remote snapshot.\\\",[Dt]:'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.',[De]:\\\"The manifest is not a valid Module Federation manifest.\\\",[He]:\\\"The remote does not expose the requested module.\\\",[Ce]:\\\"Remote container initialization failed.\\\"},Br={[Ht]:\\\"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.\\\"},jr={[Ct]:\\\"Failed to find expose module.\\\",[Ut]:\\\"PublicPath is required in prod mode.\\\"},Ko={...I,...Br,...jr};var qr=\\\".then(callbacks[0]).catch(callbacks[1])\\\",Vr=new WeakMap,zo=[\\\"Failed to fetch dynamically imported module\\\",\\\"Importing a module script failed\\\",\\\"error loading dynamically imported module\\\"];function Xo(e){return e instanceof TypeError?zo.some(t=>e.message.includes(t)):!1}function Gt(e){return e===\\\"esm\\\"||e===\\\"module\\\"}async function Yo({entry:e,remoteEntryExports:t,name:r,getEntryUrl:o}){return new Promise((n,s)=>{let i=c=>{if(Xo(c)){let l=c instanceof Error?c.message:String(c);try{_(ee,I,{remoteName:r,resourceUrl:a},l)}catch(f){s(f);return}}s(c)},a=o?o(e):e;try{t?n(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<\\\"u\\\"?new Function(\\\"callbacks\\\",`import(\\\"${a}\\\")${qr}`)([n,i]):import(a).then(n).catch(i)}catch(c){_(`Failed to load ESM entry from \\\"${a}\\\". ${c instanceof Error?c.message:String(c)}`)}})}async function Jo({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):typeof __system_context__>\\\"u\\\"?System.import(e).then(r).catch(o):new Function(\\\"callbacks\\\",`System.import(\\\"${e}\\\")${qr}`)([r,o])}catch(n){_(`Failed to load SystemJS entry from \\\"${e}\\\". ${n instanceof Error?n.message:String(n)}`)}})}function Kr(e,t,r){let{remoteEntryKey:o,entryExports:n}=Ie(e,t);return n||_(Ae,I,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o}),n}async function Zo({name:e,globalName:t,entry:r,remoteInfo:o,loaderHook:n,getEntryUrl:s,resourceContext:i}){let{entryExports:a}=Ie(e,t);if(a)return a;let c=s?s(r):r;return ze(c,{attrs:{},createScriptHook:(l,f)=>{let u=n.lifecycle.createScript.emit({url:l,attrs:f,remoteInfo:o,resourceContext:i?{...i,url:l}:void 0});if(u&&(u instanceof HTMLScriptElement||\\\"script\\\"in u||\\\"timeout\\\"in u))return u}}).then(()=>Kr(e,t,r),l=>{let f=l instanceof Error?l.message:String(l);_(ee,I,{remoteName:e,resourceUrl:c},f)})}async function Qo({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o,resourceContext:n}){let{entry:s,entryGlobalName:i,name:a,type:c}=e;return Gt(c)?Yo({entry:s,remoteEntryExports:t,name:a,getEntryUrl:o}):c===\\\"system\\\"?Jo({entry:s,remoteEntryExports:t}):Zo({entry:s,globalName:i,name:a,remoteInfo:e,loaderHook:r,getEntryUrl:o,resourceContext:n})}async function en({remoteInfo:e,loaderHook:t,resourceContext:r}){let{entry:o,entryGlobalName:n,name:s,type:i}=e,{entryExports:a}=Ie(s,n);return a||Ye(o,{attrs:{name:s,globalName:n,type:i},loaderHook:{createScriptHook:(c,l={})=>{let f=t.lifecycle.createScript.emit({url:c,attrs:l,remoteInfo:e,resourceContext:r?{...r,url:c}:void 0});if(f&&\\\"url\\\"in f)return f}}}).then(()=>Kr(s,n,o)).catch(c=>{_(`Failed to load Node.js entry for remote \\\"${s}\\\" from \\\"${o}\\\". ${c instanceof Error?c.message:String(c)}`)})}function Wt(e){let{entry:t,name:r}=e;return pe(r,t)}async function te(e){let{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,resourceContext:s,_inErrorHandling:i=!1}=e,a=Wt(o);if(r)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:r,resourceContext:s,cached:!0}),r;if(!W[a]){let l=t.remoteHandler.hooks.lifecycle.loadEntry,f=t.loaderHook,u=l.emit({origin:t,loaderHook:f,remoteInfo:o,remoteEntryExports:r,resourceContext:s}).then(d=>d||((typeof ENV_TARGET<\\\"u\\\"?ENV_TARGET===\\\"web\\\":P)?Qo({remoteInfo:o,remoteEntryExports:r,loaderHook:f,getEntryUrl:n,resourceContext:s}):en({remoteInfo:o,loaderHook:f,resourceContext:s}))).then(async d=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:d,resourceContext:s}),d)).catch(async d=>{let m=d instanceof Error&&d.message.includes(\\\"ScriptExecutionError\\\");if(d instanceof Error&&d.message.includes(ee)&&!m&&!i){let h=g=>te({...g,_inErrorHandling:!0}),p=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:o,remoteEntryExports:r,globalLoading:W,uniqueKey:a});if(p)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:p,resourceContext:s,error:d,recovered:!0}),p}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,resourceContext:s,error:d}),d});W[a]=u,u.then(void 0,()=>{W[a]===u&&delete W[a]}),Vr.set(u,t)}let c=W[a];if(Vr.get(c)!==t)try{let l=await c;return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:l,resourceContext:s}),l}catch(l){throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,resourceContext:s,error:l}),l}return c}function G(e){return{...e,entry:\\\"entry\\\"in e?e.entry:\\\"\\\",type:e.type||dt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||j}}function zr(){return typeof FEDERATION_BUILD_IDENTIFIER<\\\"u\\\"?FEDERATION_BUILD_IDENTIFIER:\\\"\\\"}function tn(e){let t=new Map;return[...e||[],...Tt()].forEach(r=>{r&&(N(Qe(r),\\\"Plugin configuration is invalid.\\\"),N(r.name,\\\"A name must be provided by the plugin.\\\"),t.has(r.name)||t.set(r.name,r))}),Array.from(t.values())}function rn(e,t){return t===void 0?e:{...t,name:e.name,version:e.version}}function Xr(e,t){let r=new Map;t.options.plugins.forEach(n=>{n&&r.set(n.name,n)});let o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return tn(e).forEach(n=>{if(r.set(n.name,n),t.hooks.registerPlugins[n.name])return;let s=rn(n,n.apply?.(t));o.forEach(i=>{i.applyPlugin(s)})}),Array.from(r.values())}function on(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 F(e){let t={};for(let[r,o]of Object.entries(e.shared)){let n=o[0];n&&(t[r]={version:n.version,singleton:n.shareConfig?.singleton,requiredVersion:n.shareConfig?.requiredVersion===!1?!1:n.shareConfig?.requiredVersion,eager:n.eager,strictVersion:n.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?\\\"host\\\":\\\"unknown\\\"},mfConfig:{name:e.name,remotes:e.remotes?.map(on)??[],shared:t}}}function jt(e){return{resourceCategory:\\\"sync\\\",share:!0,depsRemote:!0,recordPreloadedAssets:!0,...e}}function Yr(e,t){return t.map(r=>{let o=Wr(e,r.nameOrAlias);return N(o,`Unable to preload ${r.nameOrAlias} as it is not included in ${!o&&Ee({remoteInfo:o,remotes:e})}`),{remote:o,preloadConfig:jt(r)}})}function Jr(e){return e?e.map(t=>t===\\\".\\\"?t:t.startsWith(\\\"./\\\")?t.replace(\\\"./\\\",\\\"\\\"):t):[]}function Vt(e){return e instanceof Error?e.message.includes(\\\"timed out\\\")||e.name.includes(\\\"Timeout\\\"):!1}function Y(e,t,r,o){return{url:t,status:r,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:o}}function Bt(e,t,r,o){return r?mr(t)?Promise.resolve(Y(e,t,\\\"cached\\\")):(hr(t),o()):o()}async function nn(e,t,r,o){let n=e.moduleCache.get(r.name),s=r.entry;if(n?.remoteEntryExports)return Y(o,s,\\\"cached\\\");try{if(!await te({origin:e,remoteInfo:r,remoteEntryExports:n?.remoteEntryExports,resourceContext:{...o,url:s}}))throw new Error(`Failed to load remoteEntry \\\"${s}\\\".`);return Y(o,s,\\\"success\\\")}catch(i){return Y(o,s,Vt(i)?\\\"timeout\\\":\\\"error\\\",i)}}function pt({host:e,remoteInfo:t,url:r,attrs:o,context:n,needDeleteLink:s}){return new Promise(i=>{let{link:a,needAttach:c}=wt({url:r,cb:()=>{i(Y(n,r,c?\\\"success\\\":\\\"cached\\\"))},onErrorCallback:l=>{i(Y(n,r,Vt(l)?\\\"timeout\\\":\\\"error\\\",l))},attrs:o,createLinkHook:(l,f)=>{let u=e.loaderHook.lifecycle.createLink.emit({url:l,attrs:f,remoteInfo:t,resourceContext:{...n,url:l}});return u instanceof HTMLLinkElement,u},needDeleteLink:s});c&&document.head.appendChild(a)})}function sn({host:e,remoteInfo:t,url:r,attrs:o,context:n}){return new Promise(s=>{let{script:i,needAttach:a}=Ke({url:r,cb:()=>{s(Y(n,r,a?\\\"success\\\":\\\"cached\\\"))},onErrorCallback:c=>{s(Y(n,r,Vt(c)?\\\"timeout\\\":\\\"error\\\",c))},attrs:o,createScriptHook:(c,l)=>{let f=e.loaderHook.lifecycle.createScript.emit({url:c,attrs:l,remoteInfo:t,resourceContext:{...n,url:c}});return f instanceof HTMLScriptElement,f},needDeleteScript:!0});a&&document.head.appendChild(i)})}function yt(e,t){return{...e,resourceType:t}}function Ue(e,t,r,o=!0,n={initiator:\\\"preloadRemote\\\",id:e.name},s=!0){let{cssAssets:i,jsAssetsWithoutEntry:a,entryAssets:c}=r,l=[];if(t.options.inBrowser){if(c.forEach(d=>{let{moduleInfo:m}=d;l.push(nn(t,e,m,yt(n,\\\"remoteEntry\\\")))}),o){let d={rel:\\\"preload\\\",as:\\\"style\\\"};i.forEach(m=>{let h=yt(n,\\\"css\\\");l.push(Bt(h,m,s,()=>pt({host:t,remoteInfo:e,url:m,attrs:d,context:h})))})}else{let d={rel:\\\"stylesheet\\\",type:\\\"text/css\\\"};i.forEach(m=>{let h=yt(n,\\\"css\\\");l.push(Bt(h,m,s,()=>pt({host:t,remoteInfo:e,url:m,attrs:d,needDeleteLink:!1,context:h})))})}let f=sn,u={fetchpriority:\\\"high\\\",type:\\\"text/javascript\\\"};o?(f=pt,u={rel:\\\"preload\\\",as:\\\"script\\\"}):Gt(e.type)&&(f=pt,u={rel:\\\"modulepreload\\\",fetchpriority:\\\"high\\\"}),a.forEach(d=>{let m=yt(n,\\\"js\\\");l.push(Bt(m,d,s,()=>f({host:t,remoteInfo:e,url:d,attrs:u,context:m})))})}return Promise.all(l)}function cn(e){if(!e||!(\\\"modules\\\"in e)||!Array.isArray(e.modules))return;let t=e.modules.map(r=>r.moduleName).filter(Boolean);return t.length?t.join(\\\",\\\"):void 0}function ln(e,t,r){let o=t,n=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];n.length||n.push(\\\"default\\\"),n.forEach(i=>{o[i]||(o[i]={})});let s={version:e.version||\\\"\\\",shareScopeKeys:Array.isArray(e.shareScope)?n:e.shareScope||\\\"default\\\"};return Object.defineProperty(s,\\\"shareScopeMap\\\",{value:o,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:o[n[0]],initScope:r??[]}}var Et=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 r=t||{initiator:\\\"loadRemote\\\",id:fe(this.remoteInfo.name,e),resourceType:\\\"remoteEntry\\\",url:this.remoteInfo.entry,expose:e},o=await te({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:r});return N(o,`remoteEntryExports is undefined \\n ${Ee(this.remoteInfo)}`),this.remoteEntryExports=o,this.remoteEntryExports}async init(e,t,r,o,n){let s=await this.getEntry(o,n);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:s,cached:!0,origin:this.host}),s;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:s,cached:!0,origin:this.host})}catch(i){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:s,error:i,cached:!0,origin:this.host}),i}return s}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:i,shareScope:a,initScope:c}=ln(this.remoteInfo,this.host.shareScopeMap,r),l=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:a,remoteEntryInitOptions:i,initScope:c,remoteInfo:this.remoteInfo,origin:this.host});typeof s?.init>\\\"u\\\"&&_(Pe,I,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,F(this.host.options));try{await s.init(l.shareScope,l.initScope,l.remoteEntryInitOptions)}catch(f){_(Ce,I,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${f}`,F(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...l,id:e,remoteSnapshot:t,remoteEntryExports:s}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:s,origin:this.host})}catch(i){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:s,error:i,origin:this.host}),i}finally{this.initing=!1,this.initPromise=void 0}return s}async get(e,t,r,o){let{loadFactory:n=!0}=r||{loadFactory:!0},s=await this.init(e,o,void 0,t);this.lib=s,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,origin:this.host});let i;try{let l=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo});i=typeof l==\\\"function\\\"?l:void 0,i||(i=await s.get(t)),i||_(He,I,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:cn(o)},void 0,F(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,moduleFactory:i,origin:this.host})}catch(l){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,error:l,origin:this.host}),l}let a=fr(this.remoteInfo.name,t),c=this.wraperFactory(i,a);if(!n)return c;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,origin:this.host});try{let l=await c();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,exposeModule:l,origin:this.host}),l}catch(l){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,error:l,origin:this.host}),l}}wraperFactory(e,t){function r(o,n){o&&typeof o==\\\"object\\\"&&Object.isExtensible(o)&&!Object.getOwnPropertyDescriptor(o,Symbol.for(\\\"mf_module_id\\\"))&&Object.defineProperty(o,Symbol.for(\\\"mf_module_id\\\"),{value:n,enumerable:!1})}return()=>{let o=e();return o instanceof Promise?o.then(n=>(r(n,t),n)):(r(o,t),o)}}};var O=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e){N(Qe(e),\\\"Plugin configuration is invalid.\\\");let t=e.name;N(t,\\\"A name must be provided by the plugin.\\\"),this.registerPlugins[t]||(this.registerPlugins[t]=e,this.lifecycleKeys.forEach(r=>{let o=e[r];o&&this.lifecycle[r].on(o)}))}removePlugin(e){N(e,\\\"A name is required.\\\");let t=this.registerPlugins[e];N(t,`The plugin \\\"${e}\\\" is not registered.`),this.lifecycleKeys.forEach(r=>{let o=t[r];o&&this.lifecycle[r].remove(o)}),delete this.registerPlugins[e]}};var w=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 r(...o){return t.remove(r),e.apply(null,o)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{let o=r(...e);o!==void 0&&(t=o)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}};var b=class extends w{emit(...e){let t,r=Array.from(this.listeners);if(r.length>0){let o=0,n=s=>s===!1?!1:o<r.length?Promise.resolve(r[o++].apply(null,e)).then(i=>i===void 0||e.length===1&&i===e[0]?n(s):n(i)):s;t=n()}return Promise.resolve(t)}};function qt(e,t){if(!Re(t))return!1;if(e!==t){for(let r in e)if(!(r in t))return!1}return!0}var q=class extends w{constructor(e){super(),this.onerror=_,this.type=e}emit(e){Re(e)||_(`The data for the \\\"${this.type}\\\" hook should be an object.`);for(let t of this.listeners)try{let r=t(e);if(r===void 0)continue;if(qt(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the \\\"${this.type}\\\" type.`);break}}catch(r){C(r),this.onerror(r)}return e}};var L=class extends w{constructor(e){super(),this.onerror=_,this.type=e}emit(e){Re(e)||_(`The response data for the \\\"${this.type}\\\" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let r=0,o=s=>(C(s),this.onerror(s),e),n=s=>{if(s!==void 0&&qt(e,s))e=s;else if(s!==void 0)return this.onerror(`A plugin returned an incorrect value for the \\\"${this.type}\\\" type.`),e;if(r<t.length)try{return Promise.resolve(t[r++](e)).then(n,o)}catch(i){return o(i)}return e};return Promise.resolve(n(e))}return Promise.resolve(e)}};var Ge=\\\"Remote loading is disabled by experiments.optimization.disableRemote.\\\";var Qr=class{constructor(){this.hooks=new O({})}formatAndRegisterRemote(){return[]}loadRemote(){throw new Error(Ge)}preloadRemote(){throw new Error(Ge)}registerRemotes(){throw new Error(Ge)}getRemoteModuleAndOptions(){throw new Error(Ge)}initRawContainer(){throw new Error(Ge)}};function Kt(e,t){let r=tt(t);r.url||_(xe,I,{remoteName:e.name});let o=oe(t,r.url);!P&&!o.startsWith(\\\"http\\\")&&(o=`https:${o}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=o,e.version=t.version,e.buildVersion=t.buildVersion}function eo(){return{name:\\\"snapshot-plugin\\\",async afterResolve(e){let{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:s,id:i}=e;if(!se(t)||!Ze(t)){let{remoteSnapshot:a,globalSnapshot:c}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:fe(t.name,o)});Kt(s,a);let l=[{nameOrAlias:r,exposes:[o],resourceCategory:\\\"sync\\\",share:!1,depsRemote:!1,recordPreloadedAssets:!0}];await n.remoteHandler.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:l,options:n.options,origin:n});let[f]=l;if(f){let u={remote:t,preloadConfig:f},d=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:u,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:c});d&&Ue(s,n,d,!1,{initiator:\\\"loadRemote\\\",id:i},f.recordPreloadedAssets).catch(()=>{})}return{...e,remoteSnapshot:a}}return e}}}function fn(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 to(e,t,r,o,n={},s){let{value:i}=D(e,z(t)),a=s||i;if(a&&!ge(a)&&(r(a,t,o),a.remotesInfo)){let c=Object.keys(a.remotesInfo);for(let l of c){if(n[l])continue;n[l]=!0;let f=fn(l),u=a.remotesInfo[l];to(e,{name:f.name,version:u.matchedVersion},r,!1,n,void 0)}}}var zt=(e,t)=>document.querySelector(`${e}[${e===\\\"link\\\"?\\\"href\\\":\\\"src\\\"}=\\\"${t}\\\"]`);function un(e,t,r,o,n){let s=[],i=[],a=[],c=new Set,l=new Set,{options:f}=e,{preloadConfig:u}=t,{depsRemote:d}=u;if(to(o,r,(h,p,g)=>{let E;if(g)E=u;else if(Array.isArray(d)){let A=d.find(T=>T.nameOrAlias===p.name||T.nameOrAlias===p.alias);if(!A)return;E=jt(A)}else if(d===!0)E=u;else return;let y=oe(h,tt(h).url);y&&a.push({name:p.name,moduleInfo:{name:p.name,entry:y,type:\\\"remoteEntryType\\\"in h?h.remoteEntryType:\\\"global\\\",entryGlobalName:\\\"globalName\\\"in h?h.globalName:p.name,shareScope:\\\"\\\",version:\\\"version\\\"in h?h.version:void 0},url:y});let S=\\\"modules\\\"in h?h.modules:[],v=Jr(E.exposes);v.length&&\\\"modules\\\"in h&&(S=h?.modules?.reduce((A,T)=>(v?.indexOf(T.moduleName)!==-1&&A.push(T),A),[]));function M(A){let T=A.map(k=>oe(h,k));return E.filter?T.filter(E.filter):T}if(S){let A=S.length;for(let T=0;T<A;T++){let k=S[T],_t=`${p.name}/${k.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:k.moduleName===\\\".\\\"?p.name:_t,name:p.name,remoteSnapshot:h,preloadConfig:E,remote:p,origin:e}),!Nt(_t)&&(E.resourceCategory===\\\"all\\\"?(s.push(...M(k.assets.css.async)),s.push(...M(k.assets.css.sync)),i.push(...M(k.assets.js.async)),i.push(...M(k.assets.js.sync))):E.resourceCategory===\\\"sync\\\"&&(s.push(...M(k.assets.css.sync)),i.push(...M(k.assets.js.sync))),Mt(_t))}}},!0,{},n),n.shared&&n.shared.length>0){let h=(p,g)=>{let{shared:E}=X(e.shareScopeMap,g.sharedName,p,e.sharedHandler.hooks.lifecycle.resolveShare)||{};E&&typeof E.lib==\\\"function\\\"&&(g.assets.js.sync.forEach(y=>{c.add(y)}),g.assets.css.sync.forEach(y=>{l.add(y)}))};n.shared.forEach(p=>{let g=f.shared?.[p.sharedName];if(!g)return;let E=p.version?g.find(y=>y.version===p.version):g;E&&et(E).forEach(y=>{h(y,p)})})}let m=i.filter(h=>!c.has(h)&&!zt(\\\"script\\\",h));return{cssAssets:s.filter(h=>!l.has(h)&&!zt(\\\"link\\\",h)),jsAssetsWithoutEntry:m,entryAssets:a.filter(h=>!zt(\\\"script\\\",h.url))}}var ro=function(){return{name:\\\"generate-preload-assets-plugin\\\",async generatePreloadAssets(e){let{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:s,remoteSnapshot:i}=e;return P?se(n)&&Ze(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||\\\"global\\\",entryGlobalName:\\\"\\\",shareScope:\\\"\\\"}}]}:(Kt(o,i),un(t,r,o,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Xt(e,t){let r=ie({name:t.name,version:t.options.version}),o=r&&\\\"remotesInfo\\\"in r&&r.remotesInfo&&D(r.remotesInfo,e.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:be(),remoteSnapshot:ie({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:be(),remoteSnapshot:ie({name:e.name,version:\\\"version\\\"in e?e.version:void 0})}}var oo=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new O({beforeLoadRemoteSnapshot:new b(\\\"beforeLoadRemoteSnapshot\\\"),loadSnapshot:new L(\\\"loadGlobalSnapshot\\\"),loadRemoteSnapshot:new L(\\\"loadRemoteSnapshot\\\"),afterLoadSnapshot:new L(\\\"afterLoadSnapshot\\\"),beforeLoadManifest:new b(\\\"beforeLoadManifest\\\"),afterLoadManifest:new b(\\\"afterLoadManifest\\\")}),this.manifestLoading=V.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:r=\\\"loadRemote\\\"}){let{options:o}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:o,moduleInfo:e,origin:this.HostInstance});let n=ie({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||\\\"\\\",remoteEntry:\\\"\\\",remotesInfo:{}},ct({[this.HostInstance.options.name]:n})),n&&\\\"remotesInfo\\\"in n&&!D(n.remotesInfo,e.name).value&&(\\\"version\\\"in e||\\\"entry\\\"in e)&&(n.remotesInfo={...n?.remotesInfo,[e.name]:{matchedVersion:\\\"version\\\"in e?e.version:e.entry}});let{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a}=this.getGlobalRemoteInfo(e),{remoteSnapshot:c,globalSnapshot:l}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a}),f,u;if(c)if(ge(c)){let d=P?c.remoteEntry:c.ssrRemoteEntry||c.remoteEntry||\\\"\\\",m=await this.loadManifestSnapshot(d,e,{},{initiator:r,id:t||e.name}),h=at({...e,entry:d},m);f=m,u=h}else{let{remoteSnapshot:d}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:c,from:\\\"global\\\"});f=d,u=l}else if(se(e)){let d=await this.loadManifestSnapshot(e.entry,e,{},{initiator:r,id:t||e.name}),m=at(e,d);f=d,u=m}else _(Fe,I,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(l)},void 0,F(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:o,moduleInfo:e,remoteSnapshot:f}),{remoteSnapshot:f,globalSnapshot:u}}getGlobalRemoteInfo(e){return Xt(e,this.HostInstance)}async getManifestJson(e,t,r,o){return(async()=>{let s=G(t),i=this.manifestCache.get(e);if(i)return await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:o,manifestJson:i,cached:!0,origin:this.HostInstance}),i;await this.hooks.lifecycle.beforeLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:o,origin:this.HostInstance});let a,c,l=!1;try{let d=await this.loaderHook.lifecycle.fetch.emit(e,{},s,o?{...o,url:e,resourceType:\\\"manifest\\\"}:void 0);(!d||!(d instanceof Response))&&(d=await fetch(e,{})),a=d,i=await d.json()}catch(d){c=d,i=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:d,from:\\\"runtime\\\",lifecycle:\\\"afterResolve\\\",remote:s,origin:this.HostInstance}),i||(delete this.manifestLoading[e],await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:o,response:a,error:d,origin:this.HostInstance}),_($e,I,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${d}`,F(this.HostInstance.options))),l=!0}let f=[!i.metaData&&\\\"metaData\\\",!i.exposes&&\\\"exposes\\\",!i.shared&&\\\"shared\\\"].filter(Boolean),u=f.length>0?new Error(`\\\"${e}\\\" is not a valid federation manifest for remote \\\"${t.name}\\\". Missing required fields: ${f.join(\\\", \\\")}.`):void 0;return u&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:u,from:\\\"runtime\\\",lifecycle:\\\"afterResolve\\\",remote:s,origin:this.HostInstance}),await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:o,manifestJson:i,response:a,error:u||c,recovered:u?void 0:l||void 0,origin:this.HostInstance}),u&&_(De,I,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:f.join(\\\",\\\")},void 0,F(this.HostInstance.options)),this.manifestCache.set(e,i),i})()}async loadManifestSnapshot(e,t,r,o){let n=async()=>{let s=await this.getManifestJson(e,t,r,o),i=bt(s,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:\\\"manifest\\\"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=n().then(s=>s)),this.manifestLoading[e]}};var no=class{constructor(){this.hooks=new O({})}};var so=class{constructor(e){this.hooks=new O({beforeRegisterShare:new q(\\\"beforeRegisterShare\\\"),afterRegisterShare:new w(\\\"afterRegisterShare\\\"),afterResolve:new L(\\\"afterResolve\\\"),beforeLoadShare:new L(\\\"beforeLoadShare\\\"),loadShare:new b,afterLoadShare:new w(\\\"afterLoadShare\\\"),errorLoadShare:new w(\\\"errorLoadShare\\\"),resolveShare:new q(\\\"resolveShare\\\"),initContainerShareScopeMap:new q(\\\"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:r,selectedShared:o,loadContext:n}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:r,selectedShared:o,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,loadContext:n,origin:this.host})}catch(s){C(s)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:r,error:o,recovered:n,loadContext:s}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:o,recovered:n,loadContext:s})}catch(i){C(i)}}registerShared(e,t){let{newShareInfos:r,allShareInfos:o}=ht(e,t);return Object.keys(r).forEach(n=>{r[n].forEach(s=>{s.scope.forEach(i=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:n,shared:s});let a=this.shareScopeMap[i]?.[n],c=a?.[s.version];a||this.setShared({pkgName:n,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name}),this.emitAfterRegisterShare(n,{scope:i,shared:s,previousShared:c,registeredShared:this.shareScopeMap[i]?.[n]?.[s.version],trigger:\\\"runtime\\\"})})})}),{newShareInfos:r,allShareInfos:o}}async loadShare(e,t){let{host:r}=this,o=t?.context,n=kt({pkgName:e,extraOptions:t,shareInfos:r.options.shared}),s=n;try{n?.scope&&await Promise.all(n.scope.map(async f=>{await Promise.all(this.initializeSharing(f,{strategy:n.strategy,context:o}))}));let i=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r,loadContext:o});s=i.shareInfo,o=i.loadContext||o,N(s,`Cannot find shared \\\"${e}\\\" in host \\\"${r.options.name}\\\". Ensure the shared config for \\\"${e}\\\" is declared in the federation plugin options and the host has been initialized before loading shares.`);let a=s,{shared:c,useTreesShaking:l}=X(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare,o)||{};if(c){let f=Me(c,l);if(f.lib)return Q(f,r.options.name),this.emitAfterLoadShare({lifecycle:\\\"loadShare\\\",pkgName:e,shareInfo:a,selectedShared:c,loadContext:o}),f.lib;if(f.loading&&!f.loaded){let u=await f.loading;return f.loaded=!0,f.lib||(f.lib=u),Q(f,r.options.name),this.emitAfterLoadShare({lifecycle:\\\"loadShare\\\",pkgName:e,shareInfo:a,selectedShared:c,loadContext:o}),u}else{let d=(async()=>{let h=await f.get();return Q(f,r.options.name),f.loaded=!0,f.lib=h,h})();this.setShared({pkgName:e,loaded:!1,shared:c,from:r.options.name,lib:null,loading:d,treeShaking:l?f:void 0});let m=await d;return this.emitAfterLoadShare({lifecycle:\\\"loadShare\\\",pkgName:e,shareInfo:a,selectedShared:c,loadContext:o}),m}}else{if(t?.customShareInfo)return this.emitErrorLoadShare({lifecycle:\\\"loadShare\\\",pkgName:e,shareInfo:a,recovered:!0,loadContext:o}),!1;let f=le(a.treeShaking),u=Me(a,f),m=(async()=>{let p=await u.get();u.lib=p,u.loaded=!0,Q(u,r.options.name);let{shared:g,useTreesShaking:E}=X(this.shareScopeMap,e,a,this.hooks.lifecycle.resolveShare,o)||{};if(g){let y=Me(g,E);y.lib=p,y.loaded=!0,g.from=a.from}return p})();this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:m,treeShaking:f?u:void 0});let h=await m;return this.emitAfterLoadShare({lifecycle:\\\"loadShare\\\",pkgName:e,shareInfo:a,selectedShared:a,loadContext:o}),h}}catch(i){throw this.emitErrorLoadShare({lifecycle:\\\"loadShare\\\",pkgName:e,shareInfo:s,error:i,loadContext:o}),i}}initializeSharing(e=j,t){let{host:r}=this,o=t?.from,n=t?.strategy,s=t?.context?.trigger||o||\\\"runtime\\\",i=t?.initScope,a=[];if(o!==\\\"build\\\"){let{initTokens:m}=this;i||(i=[]);let h=m[e];if(h||(h=m[e]={from:this.host.name}),i.indexOf(h)>=0)return a;i.push(h)}let c=this.shareScopeMap,l=r.options.name;c[e]||(c[e]={});let f=c[e],u=(m,h)=>{let{version:p,eager:g}=h;f[m]=f[m]||{};let E=f[m],y=E[p],S=y&&Me(y),v=!!(S&&(\\\"eager\\\"in S&&S.eager||\\\"shareConfig\\\"in S&&S.shareConfig?.eager));(!S||S.strategy!==\\\"loaded-first\\\"&&!S.loaded&&(!g!=!v?g:l>E[p].from))&&(E[p]=h),this.emitAfterRegisterShare(m,{scope:e,shared:h,previousShared:y,registeredShared:E[p],trigger:s})},d=async m=>{let{module:h}=await r.remoteHandler.getRemoteModuleAndOptions({id:m}),p,g={initiator:\\\"loadShare\\\",id:m,resourceType:\\\"remoteEntry\\\",url:h.remoteInfo.entry};try{p=await h.getEntry(void 0,g)}catch(E){if(p=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:m,error:E,from:\\\"runtime\\\",lifecycle:\\\"beforeLoadShare\\\",remote:h.remoteInfo,origin:r}),!p)return}finally{p?.init&&!h.initing&&(h.remoteEntryExports=p,await h.init(void 0,void 0,i,void 0,g))}};return Object.keys(r.options.shared).forEach(m=>{r.options.shared[m].forEach(h=>{h.scope.includes(e)&&u(m,h)})}),(r.options.shareStrategy===\\\"version-first\\\"||n===\\\"version-first\\\")&&r.options.remotes.forEach(m=>{m.shareScope===e&&a.push(d(m.name))}),a}loadShareSync(e,t){let{host:r}=this,o=t?.context,n=kt({pkgName:e,extraOptions:t,shareInfos:r.options.shared});try{n?.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy,from:t?.from,context:o})});let{shared:s}=X(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare,o)||{};if(s){if(typeof s.lib==\\\"function\\\")return Q(s,r.options.name),s.loaded||(s.loaded=!0,s.from===r.options.name&&(n.loaded=!0)),this.emitAfterLoadShare({lifecycle:\\\"loadShareSync\\\",pkgName:e,shareInfo:n,selectedShared:s,loadContext:o}),s.lib;if(typeof s.get==\\\"function\\\"){let i=s.get();if(!(i instanceof Promise))return Q(s,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:s}),this.emitAfterLoadShare({lifecycle:\\\"loadShareSync\\\",pkgName:e,shareInfo:n,selectedShared:s,loadContext:o}),i}}if(n.lib)return n.loaded||(n.loaded=!0),this.emitAfterLoadShare({lifecycle:\\\"loadShareSync\\\",pkgName:e,shareInfo:n,selectedShared:n,loadContext:o}),n.lib;if(n.get){let i=n.get();return i instanceof Promise&&_(t?.from===\\\"build\\\"?Le:ue,I,{hostName:r.options.name,sharedPkgName:e},void 0,F(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),this.emitAfterLoadShare({lifecycle:\\\"loadShareSync\\\",pkgName:e,shareInfo:n,selectedShared:n,loadContext:o}),n.lib}_(ue,I,{hostName:r.options.name,sharedPkgName:e},void 0,F(r.options))}catch(s){throw this.emitErrorLoadShare({lifecycle:\\\"loadShareSync\\\",pkgName:e,shareInfo:n,error:s,loadContext:o}),s}}initShareScopeMap(e,t,r={}){let{host:o}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:o.options,origin:o,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:o,loading:n,loaded:s,get:i,treeShaking:a}){let{version:c,scope:l=\\\"default\\\",...f}=t,u=Array.isArray(l)?l:[l],d=m=>{let h=(g,E,y)=>{y&&!g[E]&&(g[E]=y)},p=a?m.treeShaking:m;h(p,\\\"loaded\\\",s),h(p,\\\"loading\\\",n),h(p,\\\"get\\\",i),h(p,\\\"lib\\\",o)};u.forEach(m=>{this.shareScopeMap[m]||(this.shareScopeMap[m]={}),this.shareScopeMap[m][e]||(this.shareScopeMap[m][e]={}),this.shareScopeMap[m][e][c]||(this.shareScopeMap[m][e][c]={version:c,scope:[m],...f,lib:o});let h=this.shareScopeMap[m][e][c];d(h),r&&h.from!==r&&(h.from=r)})}_setGlobalShareScopeMap(e){let t=Ne(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}};var io=class{constructor(){this.shareScopeMap={},this.hooks=new O({afterResolve:new L(\\\"afterResolve\\\")})}registerShared(){return{newShareInfos:{},allShareInfos:{}}}loadShare(){throw new Error(\\\"Shared dependency loading is disabled by experiments.optimization.disableShared.\\\")}loadShareSync(){throw new Error(\\\"Shared dependency loading is disabled by experiments.optimization.disableShared.\\\")}initializeSharing(){return[]}initShareScopeMap(e,t){this.shareScopeMap[e]=t}};var ao=class{constructor(e){this.hooks=new O({beforeRegisterRemote:new q(\\\"beforeRegisterRemote\\\"),registerRemote:new q(\\\"registerRemote\\\"),beforeRequest:new L(\\\"beforeRequest\\\"),afterMatchRemote:new b(\\\"afterMatchRemote\\\"),onLoad:new b(\\\"onLoad\\\"),afterLoadRemote:new b(\\\"afterLoadRemote\\\"),handlePreloadModule:new w(\\\"handlePreloadModule\\\"),errorLoadRemote:new b(\\\"errorLoadRemote\\\"),beforePreloadRemote:new b(\\\"beforePreloadRemote\\\"),generatePreloadAssets:new b(\\\"generatePreloadAssets\\\"),afterPreloadRemote:new b(\\\"afterPreloadRemote\\\"),loadEntry:new b}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,o)=>(this.registerRemote(o,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){let{remote:r,expose:o}=t,{name:n,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:o},s&&e.startsWith(n)){let i=e.replace(n,s);this.idToRemoteMap[i]={name:r.name,expose:o};return}if(s&&e.startsWith(s)){let i=e.replace(s,n);this.idToRemoteMap[i]={name:r.name,expose:o}}}async loadRemote(e,t){let{host:r}=this,o=ve(r.options.remotes,e),n=e,s=o?.expose,i=o?G(o.remote):void 0,a;try{let{loadFactory:c=!0}=t||{loadFactory:!0},{module:l,moduleOptions:f,remoteMatchInfo:u}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:d,remote:m,expose:h,id:p,remoteSnapshot:g}=u;n=p,s=h,i=G(m);let E=await l.get(p,h,t,g),y=await this.hooks.lifecycle.onLoad.emit({id:p,pkgNameOrAlias:d,expose:h,exposeModule:c?E:void 0,exposeModuleFactory:c?void 0:E,remote:m,options:f,moduleInstance:l,origin:r});return this.setIdToRemoteMap(e,u),a={id:n,expose:s,remote:i,options:t,origin:r},typeof y==\\\"function\\\"?y:E}catch(c){let{from:l=\\\"runtime\\\"}=t||{from:\\\"runtime\\\"},f;try{f=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:c,from:l,lifecycle:\\\"onLoad\\\",expose:s,remote:i,origin:r})}catch(u){throw a={id:n,expose:s,remote:i,options:t,error:u,origin:r},u}if(!f)throw a={id:n,expose:s,remote:i,options:t,error:c,origin:r},c;return a={id:n,expose:s,remote:i,options:t,error:c,origin:r,recovered:!0},f}finally{a&&await this.hooks.lifecycle.afterLoadRemote.emit(a)}}async preloadRemote(e){let{host:t}=this,r=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});let o=Yr(t.options.remotes,e),n=a=>{let{preloadConfig:c,remote:l}=a,f=c.exposes||[];return f.length?f.map(u=>({ops:{...a,preloadConfig:{...c,exposes:[u]}},id:fe(l.name,u)})):[{ops:a,id:`${l.name}/*`}]},s;await Promise.all(o.flatMap(n).map(async a=>{let{ops:c,id:l}=a,{remote:f,preloadConfig:u}=c,d=G(f);try{let{globalSnapshot:m,remoteSnapshot:h}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:f,id:l,initiator:\\\"preloadRemote\\\"}),p=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:c,remote:f,remoteInfo:d,globalSnapshot:m,remoteSnapshot:h});if(!p)return;let g=await Ue(d,t,p,!0,{initiator:\\\"preloadRemote\\\",id:l},u.recordPreloadedAssets);r.push({remote:f,remoteInfo:d,preloadConfig:u,id:l,results:g})}catch(m){r.push({remote:f,remoteInfo:d,preloadConfig:u,id:l,results:[{url:d.entry,status:\\\"error\\\",resourceType:/\\\\.json(?:$|[?#])/i.test(d.entry)?\\\"manifest\\\":\\\"remoteEntry\\\",initiator:\\\"preloadRemote\\\",id:l,error:m}]})}}));let i=r.flatMap(a=>a.results.filter(c=>c.status===\\\"error\\\"||c.status===\\\"timeout\\\"));if(i.length>0&&(s=new Error(`preloadRemote failed to load ${i.length} resource(s).`),Object.assign(s,{results:r,failedResults:i})),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:t.options,origin:t,results:r,error:s}),s)throw s}registerRemotes(e,t){let{host:r}=this;e.forEach(o=>{this.registerRemote(o,r.options.remotes,{force:t?.force})})}initRawContainer(e,t,r){let{host:o}=this,n=new Et({host:o,remoteInfo:G({name:e,entry:t})});return n.remoteEntryExports=r,o.moduleCache.set(e,n),n}async getRemoteModuleAndOptions(e){let{host:t}=this,{id:r}=e,o;try{o=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(m){if(o=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:\\\"runtime\\\",error:m,lifecycle:\\\"beforeRequest\\\"}),!o)throw m}let{id:n}=o,s=ve(t.options.remotes,n);if(!s)try{_(Oe,I,{hostName:t.options.name,requestId:n},void 0,F(t.options))}catch(m){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:n,options:t.options,error:m,origin:t}),m}let{remote:i}=s,a=G(i);await this.hooks.lifecycle.afterMatchRemote.emit({id:n,...s,options:t.options,remoteInfo:a,origin:t});let c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:n,...s,options:t.options,origin:t,remoteInfo:a}),{remote:l,expose:f}=c;N(l&&f,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let u=t.moduleCache.get(l.name),d={host:t,remoteInfo:a};return u||(u=new Et(d),t.moduleCache.set(l.name,u)),{module:u,moduleOptions:d,remoteMatchInfo:c}}registerRemote(e,t,r){let{host:o}=this,n=()=>{if(e.alias){let i=t.find(a=>e.alias&&(a.name.startsWith(e.alias)||a.alias?.startsWith(e.alias)));N(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}\\\"entry\\\"in e&&P&&typeof window<\\\"u\\\"&&!e.entry.startsWith(\\\"http\\\")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=j),e.type||(e.type=dt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});let s=t.find(i=>i.name===e.name);if(!s)n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o});else{let i=[`The remote \\\"${e.name}\\\" is already registered.`,\\\"Please note that overriding it may cause unexpected errors.\\\"];r?.force&&(this.removeRemote(s),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o}),ye(i.join(\\\" \\\")))}}removeRemote(e){try{let{host:t}=this,{name:r}=e,o=t.options.remotes.findIndex(a=>a.name===r);o!==-1&&t.options.remotes.splice(o,1);let n=D(R.__FEDERATION__.moduleInfo,z(e)).key;delete R.__FEDERATION__.moduleInfo[n],\\\"entry\\\"in e&&(t.snapshotHandler.manifestCache.delete(e.entry),delete V.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);let{hostGlobalSnapshot:s}=Xt(e,t);if(s){let a=s&&\\\"remotesInfo\\\"in s&&s.remotesInfo&&D(s.remotesInfo,e.name).key;a&&delete s.remotesInfo[a]}let i=t.moduleCache.get(e.name);if(i){let a=i.remoteInfo,c=a.entryGlobalName;R[c]&&(Object.getOwnPropertyDescriptor(R,c)?.configurable?delete R[c]:R[c]=void 0);let l=Wt(i.remoteInfo);W[l]&&delete W[l];let f=a.buildVersion?pe(a.name,a.buildVersion):a.name,u=R.__FEDERATION__.__INSTANCES__.findIndex(d=>a.buildVersion?d.options.id===f:d.name===f);if(u!==-1){let d=R.__FEDERATION__.__INSTANCES__[u];f=d.options.id||f;let m=Ne(),h=!0,p=[];Object.keys(m).forEach(g=>{let E=m[g];E&&Object.keys(E).forEach(y=>{let S=E[y];S&&Object.keys(S).forEach(v=>{let M=S[v];M&&Object.keys(M).forEach(A=>{let T=M[A];T&&typeof T==\\\"object\\\"&&T.from===a.name&&(T.loaded||T.loading?(T.useIn=T.useIn.filter(k=>k!==a.name),T.useIn.length?h=!1:p.push([g,y,v,A])):p.push([g,y,v,A]))})})})}),h&&(d.shareScopeMap={},delete m[f]),p.forEach(([g,E,y,S])=>{delete m[g]?.[E]?.[y]?.[S]}),R.__FEDERATION__.__INSTANCES__.splice(u,1)}t.moduleCache.delete(e.name)}}catch(t){Je.error(`removeRemote failed: ${t instanceof Error?t.message:String(t)}`)}}};var dn=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN==\\\"boolean\\\"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0,Yt=typeof FEDERATION_OPTIMIZE_NO_REMOTE==\\\"boolean\\\"?!FEDERATION_OPTIMIZE_NO_REMOTE:!0,co=typeof FEDERATION_OPTIMIZE_NO_SHARED==\\\"boolean\\\"?!FEDERATION_OPTIMIZE_NO_SHARED:!0,gt=class{constructor(e){this.hooks=new O({beforeInit:new q(\\\"beforeInit\\\"),init:new w,beforeInitContainer:new L(\\\"beforeInitContainer\\\"),initContainer:new L(\\\"initContainer\\\")}),this.version=\\\"2.9.2\\\",this.moduleCache=new Map,this.loaderHook=new O({getModuleInfo:new w,createScript:new w,createLink:new w,fetch:new b,loadEntryError:new b,afterLoadEntry:new b(\\\"afterLoadEntry\\\"),beforeInitRemote:new b(\\\"beforeInitRemote\\\"),afterInitRemote:new b(\\\"afterInitRemote\\\"),beforeGetExpose:new b(\\\"beforeGetExpose\\\"),afterGetExpose:new b(\\\"afterGetExpose\\\"),beforeExecuteFactory:new b(\\\"beforeExecuteFactory\\\"),afterExecuteFactory:new b(\\\"afterExecuteFactory\\\"),getModuleFactory:new b}),this.bridgeHook=new O({beforeBridgeRender:new w,afterBridgeRender:new w,beforeBridgeDestroy:new w,afterBridgeDestroy:new w,afterBridgeRouteSync:new w});let t=Yt&&dn?[eo(),ro()]:[],r={id:zr(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:P};this.name=e.name,this.options=r,this.snapshotHandler=Yt?new oo(this):new no,this.sharedHandler=co?new so(this):new io,this.remoteHandler=Yt?new ao(this):new Qr,this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&_(Se(ke,I)),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=j,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){return this.remoteHandler.initRawContainer(e,t,r)}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){let r=co?ht(e,t).allShareInfos:{},{userOptions:o,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(n,o),{allShareInfos:i}=this.sharedHandler.registerShared(n,o),a=[...n.plugins];o.plugins&&o.plugins.forEach(l=>{a.includes(l)||a.push(l)});let c={...e,...t,plugins:a,remotes:s,shared:i,id:o.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:c}),c}registerPlugins(e){this.options.plugins=Xr(e,this)}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};function lo(e){let t=new(st()||gt)({id:`${e.name}@${e.version||Date.now()}`,...e});return nt(t),t}it(gt);async function fo(e,t){let r=t.id;if(t.url.endsWith(\\\".json\\\")){if(!t.metaData){let a=await e.loadJson(t.url);t.exposes=a.exposes,t.shared=a.shared,t.remotes=a.remotes,t.metaData=a.metaData}let{globalName:s,remoteEntry:i}=t.metaData;return t.id=s,r=s,{id:r,entry:t.url,type:i.type===\\\"module\\\"?\\\"module\\\":void 0,entryGlobalName:s,assetBase:new URL(\\\"./\\\",t.url).href}}let o=t.type===\\\"esm\\\"?\\\"module\\\":t.type,n=r.replace(/^@/,\\\"\\\").replace(\\\"/\\\",\\\"-\\\").replace(/\\\\-/g,\\\"_\\\");return{id:r,entry:t.url,type:o,entryGlobalName:n,assetBase:t.url}}function Jt(e,t,r,o){let n={};for(let{id:s,name:i,version:a}of t.list())o.has(s)||((n[i]||=[]).push({version:a,strategy:\\\"loaded-first\\\",shareConfig:{requiredVersion:!1},get:async()=>async()=>t.import(s,r)}),o.add(s));Object.keys(n).length>0&&e.registerShared(n)}function mn(e,t){let r=new Set(t.list().map(({id:n})=>n)),o={};for(let n of Object.values(e.shareScopeMap))for(let[s,i]of Object.entries(n))for(let[a,c]of Object.entries(i)){let l=`${s}@${a}`;r.has(l)||(o[l]=()=>async()=>{let{factory:f}=await uo(e,s,a);return f&&f()},r.add(l))}t.registerResolvers(o)}async function uo(e,t,r){let o;return{factory:await e.loadShare(t,{resolver(s){let i=new Map;for(let l of[...s||[],...Object.values(e.shareScopeMap.default?.[t]||{})])i.has(l.version)||i.set(l.version,l);let c=[...i.values()].find(l=>B(l.version,r));if(!c)throw new Error(`No shared version of \\\"${t}\\\" satisfies \\\"${r}\\\".`);return o=c.version,{...c,shareConfig:{...c.shareConfig,requiredVersion:c.version,singleton:!1}}}}),version:o}}function mo(e,t,r){let o=r.get(t.id);if(o===t.entry)return;let n=[{name:t.id,entry:t.entry,...t.type?{type:t.type}:{},...t.entryGlobalName?{entryGlobalName:t.entryGlobalName}:{}}];o?e.registerRemotes(n,{force:!0}):e.registerRemotes(n),r.set(t.id,t.entry)}var hn={name:\\\"picard-legacy-exposes\\\",getModuleFactory({expose:e,remoteEntryExports:t}){return t.get(e).then(void 0,o=>{if(e.startsWith(\\\"./\\\")&&o instanceof Error&&o.message.includes(\\\"does not exist in container\\\"))return t.get(e.substring(2));throw o})}};function pn(e){return(globalThis.__FEDERATION__?.__INSTANCES__||[]).find(r=>r!==e)}var yn={name:\\\"picard-shared-scope\\\",beforeInitContainer(e){let{origin:t,remoteEntryInitOptions:r}=e,o=pn(t);if(!o)return e;let[n=\\\"default\\\"]=[].concat(r.shareScopeKeys),s=o.shareScopeMap[n]||={},i=t.shareScopeMap[n];if(i!==s){for(let[a,c]of Object.entries(i||{}))s[a]={...c,...s[a]};t.initShareScopeMap(n,s)}return{...e,shareScope:s}}};function ho(e,t,r,o){return e.loadRemote(`${r.id}/${o}`).then(n=>(mn(e,t),n?.default||n))}async function En(e,t,r,o,n,s){let i=[],a=[],c={},l=await fo(t,s);Jt(e,r,l.entry,n),mo(e,l,o);for(let f of s.exposes||[]){let u=f.name;a.push({name:u}),c[u]={component:void 0};for(let d of f.assets.css.sync)i.push({type:\\\"css\\\",url:new URL(d,l.assetBase).href})}return{async load(f){let u=c[f];if(u)return u.component||(u.component=ho(e,r,l,f)),await u.component},getComponents(){return a},getAssets(){return i}}}async function gn(e,t,r,o,n,s){let i={},a=await fo(t,s);return Jt(e,r,a.entry,n),mo(e,a,o),{async load(c){let l=i[c];return l||(l={component:ho(e,r,a,c).catch(f=>{/does not exist in container/.test(f?.message)||console.error(`Failed to load federated module \\\"${a.id}/${c}\\\".`,f)})},i[c]=l),await l.component},getComponents(){return[]},getAssets(){return[]}}}function _n(e){let t=e.runtime;return t||(!e.id||e.url.endsWith(\\\".json\\\")?\\\"2.0\\\":\\\"1.0\\\")}function Sn(e,t,r,o,n,s){return _n(s)===\\\"2.0\\\"?En(e,t,r,o,n,s):gn(e,t,r,o,n,s)}function cf(e){let t=e.get(\\\"loader\\\"),r=e.get(\\\"platform\\\"),o=lo({name:\\\"picard\\\",remotes:[],plugins:[hn,yn]}),n=new Map,s=new Set,i=async(a,c,l)=>{Jt(o,t,l||\\\"\\\",s);let{factory:f,version:u}=await uo(o,a,c);if(!f||!u)return;let d=`${a}@${u}`;return t.registerResolvers({[d]:()=>async()=>f()}),d};return t.setPackageResolver(i),{createContainer(a){return Sn(o,r,t,n,s,a)},resolvePackage:i}}export{cf as createModuleFederation};\\n\"};", "import { createEsm } from './esm';\nimport { createListener } from './events';\nimport { createPlatform } from './platform';\nimport { createFeed } from '@/common/feed';\nimport { createPicardScope } from '@/common/state';\nimport { createLoader } from '@/common/loader';\nimport { createInjector } from '@/common/injector';\nimport { createRouter } from '@/common/server/router';\nimport { createDecorator } from '@/common/server/decorator';\nimport { createStylePart } from '@/common/server/style-part';\nimport { createScriptPart } from '@/common/server/script-part';\nimport { createSheet } from '@/common/ui/styles';\nimport { createRenderer } from '@/common/ui/renderer';\nimport { createModuleFederation } from '@/common/formats/module';\nimport { createNativeFederation } from '@/common/formats/native';\nimport { createPilet } from '@/common/formats/pilet';\nimport { createDefaultConverter } from '@/common/frameworks/default';\nimport { createHtmlConverter } from '@/common/frameworks/html';\nimport { createSlotBehaviorForRouter } from '@/common/slot-rels/router';\nimport islandsFiles from 'embedded:islands';\nimport type { DecoratorService, FeedDefinition, FeedService, PartService } from '@/types';\n\nexport interface PicardClientOptions {\n  /**\n   * The services to add when resuming in the browser. Maps the name of\n   * the service (e.g., \"framework.react\") to the URL of an ES module,\n   * which default exports the service creator.\n   */\n  services?: Record<string, string>;\n  /**\n   * The centrally shared dependencies to use when resuming in the browser.\n   * Maps the dependency (e.g., \"react@18.3.1\") to the URL of an ES module.\n   */\n  dependencies?: Record<string, string>;\n}\n\nexport interface PicardOptions {\n  /**\n   * The name of the pi-component.\n   * @default pi-component\n   */\n  componentName?: string;\n  /**\n   * The name of the pi-slot.\n   * @default pi-slot\n   */\n  slotName?: string;\n  /**\n   * The name of the pi-part.\n   * @default pi-part\n   */\n  partName?: string;\n  /**\n   * The URL of the fragment service, if any.\n   */\n  fragmentUrl?: string;\n  /**\n   * The URL of the script for interactive sessions.\n   * If not given the islands variant from unpkg will be used.\n   * Use `getIslandsFile` to serve it from this process instead.\n   */\n  scriptUrl?: string;\n  /**\n   * The micro frontend discovery service URL,\n   * data from calling it, or callback function\n   * to call it manually.\n   */\n  feed?: FeedDefinition;\n  /**\n   * The initial state of Picard.js - if resumed.\n   */\n  state?: any;\n  /**\n   * The additional services to register.\n   */\n  services?: Record<string, any>;\n  /**\n   * The centrally shared dependencies to use.\n   */\n  dependencies?: Record<string, () => Promise<any>>;\n  /**\n   * Indicates that the rendering should be interactive, i.e.,\n   * going into an islands architecture application.\n   */\n  interactive?: boolean;\n  /**\n   * The configuration for resuming in the browser. Only\n   * used if the rendering is interactive.\n   */\n  client?: PicardClientOptions;\n}\n\nconst defaultOptions = {\n  componentName: 'pi-component',\n  slotName: 'pi-slot',\n  partName: 'pi-part',\n  fragmentUrl: '',\n  scriptUrl: `https://unpkg.com/picard-js@${process.env.PICARD_VERSION}/dist/islands/picard.js`,\n  services: {},\n  dependencies: {},\n  interactive: false,\n};\n\ndeclare module '@/types/injector' {\n  interface Services {\n    decorator: DecoratorService;\n    feed: FeedService;\n    [part: `part.${string}`]: PartService;\n  }\n\n  interface Configuration {\n    feed?: FeedDefinition;\n    scriptUrl?: string;\n    client?: PicardClientOptions;\n    state?: any;\n    fragmentUrl?: string;\n    dependencies: Record<string, () => Promise<any>>;\n  }\n}\n\nexport {\n  createModuleFederation,\n  createNativeFederation,\n  createPilet,\n  createDefaultConverter,\n  createSlotBehaviorForRouter,\n  createHtmlConverter,\n};\n\n/**\n * Gets the content of a file of the islands variant, i.e., the lightweight\n * client resuming the server-rendered page. Serve the files from the\n * directory of the `scriptUrl` to resume without any external resource.\n * @param name The name of the file, e.g., \"picard.js\".\n * @returns The JavaScript content or undefined if no such file exists.\n */\nexport function getIslandsFile(name: string): string | undefined {\n  return Object.prototype.hasOwnProperty.call(islandsFiles, name) ? islandsFiles[name] : undefined;\n}\n\n/**\n * Gets the names of the files of the islands variant, e.g., to write them\n * next to statically generated pages.\n * @returns The names of the files, e.g., \"picard.js\" and its chunks.\n */\nexport function getIslandsFileNames(): Array<string> {\n  return Object.keys(islandsFiles);\n}\n\nexport function initializePicard(options?: PicardOptions): DecoratorService {\n  const {\n    feed,\n    state,\n    scriptUrl = defaultOptions.scriptUrl,\n    services = defaultOptions.services,\n    dependencies = defaultOptions.dependencies,\n    fragmentUrl = defaultOptions.fragmentUrl,\n    componentName = defaultOptions.componentName,\n    slotName = defaultOptions.slotName,\n    partName = defaultOptions.partName,\n    interactive = defaultOptions.interactive,\n    client,\n  } = options || {};\n\n  const serviceDefinitions = {\n    events: createListener,\n    scope: createPicardScope,\n    feed: createFeed,\n    esm: createEsm,\n    renderer: createRenderer,\n    router: createRouter,\n    platform: createPlatform,\n    loader: createLoader,\n    decorator: createDecorator,\n    sheet: createSheet,\n    'format.module': createModuleFederation,\n    'format.native': createNativeFederation,\n    'format.pilet': createPilet,\n    'framework.default': createDefaultConverter,\n    'framework.html': createHtmlConverter,\n    'part.style': createStylePart,\n    'slotRel.router': createSlotBehaviorForRouter,\n    ...(interactive ? { 'part.script': createScriptPart } : {}),\n    ...services,\n    config: () => ({\n      feed,\n      state,\n      componentName,\n      partName,\n      slotName,\n      fragmentUrl,\n      dependencies,\n      scriptUrl,\n      client,\n      services,\n    }),\n  };\n\n  return createInjector(serviceDefinitions).instantiate('loader').instantiate('feed').get('decorator');\n}\n"],
  "mappings": ";AAAA,YAAY,QAAQ;AAWb,SAAS,eAAwE;AACtF,QAAM,EAAE,kBAAkB,gBAAgB,IAAI;AAE9C,MAAI,OAAO,qBAAqB,cAAc,OAAO,oBAAoB,YAAY;AACnF,UAAM,IAAI,MAAM,wFAAwF;AAAA,EAC1G;AAEA,SAAO,EAAE,kBAAkB,gBAAgB;AAC7C;;;ACnBA,IAAM,SACJ;AAEF,IAAM,aAAa,CAAC,KAAK,KAAK,KAAK;AAuH5B,SAAS,SAAS,SAAiB;AACxC,SAAO,WAAW,SAAS,OAAO,KAAK,OAAO,KAAK,OAAO;AAC5D;;;ACzEA,IAAM,eAAe;AAErB,SAAS,eAAe,IAAY;AAClC,MAAI,2BAA2B,KAAK,EAAE,GAAG;AACvC,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,GAAG,YAAY,GAAG;AAEpC,MAAI,aAAa,GAAG;AAClB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,MAAM,GAAG,UAAU,GAAG,SAAS;AAAA,IAC/B,SAAS,GAAG,UAAU,YAAY,CAAC;AAAA,EACrC;AACF;AAEA,SAAS,mBAAmB,IAAY;AACtC,QAAM,YAAY,eAAe,EAAE;AAEnC,MAAI,aAAa,aAAa,KAAK,UAAU,OAAO,GAAG;AACrD,WAAO;AAAA,EACT;AAE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AW;AACrG;",
  "names": ["system", "loadScript", "error", "error", "system", "dependencies", "linkModule", "loadModule", "match", "name", "pattern", "validate", "c1", "BinTrieFlags", "CharCodes", "EntityDecoderState", "DecodingMode", "char", "CharCodes", "State", "QuoteType", "ForeignContext", "ElementType", "Script", "Text", "Comment", "CDATA", "isTag", "Text", "Comment", "isTag", "CDATA", "error", "Text", "Comment", "CDATA", "EntityLevel", "EncodingMode", "voidElements", "Script", "voidElements", "document", "error", "TreeShakingStatus", "error", "infrastructureLogger", "loadScript", "error", "init", "urlObj", "vm", "loadModule", "fetch", "errorDescMap", "logger", "LOG_CATEGORY", "logger", "assert", "error", "msg", "warn", "error", "preRelease", "preRelease", "gtlt", "comparator", "error", "isPlainObject", "error", "loadScript", "url", "params", "assert", "assert", "error", "defaultAttrs", "Module", "assert", "error", "id", "assert", "result", "error", "error", "error", "traverse", "globalSnapshotRes", "error", "error", "assert", "factory", "shared", "error", "Module", "assert", "logger", "defaultOptions", "error", "error", "loadContainer", "match", "defaultOptions", "defaultOptions"]
}
