{"version":3,"file":"mmstack-router-core.mjs","sources":["../../../../../packages/router/core/src/lib/visual-commit.ts","../../../../../packages/router/core/src/lib/a11y/route-a11y.ts","../../../../../packages/router/core/src/lib/util/create-route-predicate.ts","../../../../../packages/router/core/src/lib/remount/lazy-route-internals.ts","../../../../../packages/router/core/src/lib/util/find-path.ts","../../../../../packages/router/core/src/lib/url.ts","../../../../../packages/router/core/src/lib/util/leaf.store.ts","../../../../../packages/router/core/src/lib/util/snapshot-path.ts","../../../../../packages/router/core/src/lib/breadcrumb/breadcrumb.ts","../../../../../packages/router/core/src/lib/breadcrumb/breadcrumb-config.ts","../../../../../packages/router/core/src/lib/util/staged-apply.ts","../../../../../packages/router/core/src/lib/breadcrumb/breadcrumb-store.ts","../../../../../packages/router/core/src/lib/breadcrumb/breadcrumb-resolver.ts","../../../../../packages/router/core/src/lib/preloading/preload-requester.ts","../../../../../packages/router/core/src/lib/preloading/preload-strategy.ts","../../../../../packages/router/core/src/lib/link.ts","../../../../../packages/router/core/src/lib/navigation-hold.ts","../../../../../packages/router/core/src/lib/mount-switch/mount-switch.ts","../../../../../packages/router/core/src/lib/nav/nav.ts","../../../../../packages/router/core/src/lib/nav/nav-config.ts","../../../../../packages/router/core/src/lib/nav/nav-store.ts","../../../../../packages/router/core/src/lib/nav/nav-resolver.ts","../../../../../packages/router/core/src/lib/query-param.ts","../../../../../packages/router/core/src/lib/remount/remount.ts","../../../../../packages/router/core/src/lib/route-data/route-data.ts","../../../../../packages/router/core/src/lib/util/extract-params.ts","../../../../../packages/router/core/src/lib/route-data/with-route-data.ts","../../../../../packages/router/core/src/lib/scroll/transition-scroll.ts","../../../../../packages/router/core/src/lib/title/title-config.ts","../../../../../packages/router/core/src/lib/title/title-store.ts","../../../../../packages/router/core/src/lib/view-transition.ts","../../../../../packages/router/core/src/lib/transition-router-outlet.ts","../../../../../packages/router/core/src/mmstack-router-core.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n  afterNextRender,\n  inject,\n  Injectable,\n  Injector,\n  PLATFORM_ID,\n  signal,\n  type Signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n  type Event,\n  EventType,\n  NavigationCancellationCode,\n  Router,\n} from '@angular/router';\n\n/**\n * Where a navigation is between \"the router says it is done\" and \"the user can see it\".\n *\n * `navigationId` is the navigation the status belongs to — the router's own\n * `NavigationStart.id`, so it can be correlated with router events.\n */\nexport type VisualCommitState = {\n  readonly status: 'idle' | 'pending' | 'committed';\n  readonly navigationId: number | null;\n};\n\n/**\n * Tracks when the navigation is visually committed — every {@link TransitionRouterOutlet} that\n * held or swapped for it has finished, so the screen finally shows the new route.\n *\n * Angular's `NavigationEnd` fires as soon as the router has activated the components, which under\n * a held transition is *before* anything changed on screen, and with several (or nested) outlets\n * there is no single moment `NavigationEnd` could stand in for. Read this instead when work has\n * to line up with what the user sees: scroll restoration, focus moves, announcements, analytics.\n *\n * - `pending` from `NavigationStart` until every outlet that armed for this navigation has\n *   committed (or swapped in immediately). A navigation where no outlet armed commits one render\n *   after `NavigationEnd`.\n * - `committed` once the swap is on screen.\n * - `idle` after a cancelled or failed navigation that no successor navigation follows and that\n *   left no swap outstanding.\n *\n * An interrupting navigation re-enters `pending` under its own id; outlets whose hold it\n * superseded re-arm under it. A navigation that dies without a successor while an earlier\n * navigation's hold is still on its way to the screen goes back to `pending` under that earlier\n * navigation and commits when it finally swaps — the status tracks outstanding visual work, not\n * the router's bookkeeping.\n *\n * @example\n * ```ts\n * private readonly commit = injectVisualCommit();\n *\n * constructor() {\n *   effect(() => {\n *     if (this.commit().status === 'committed') this.analytics.pageView();\n *   });\n * }\n * ```\n */\nexport function injectVisualCommit(): Signal<VisualCommitState> {\n  return inject(VisualCommitCoordinator).state;\n}\n\nconst IDLE: VisualCommitState = { status: 'idle', navigationId: null };\n\n/**\n * @internal\n * The registry behind {@link injectVisualCommit}. Outlets arm when they activate and settle when\n * their swap reaches the screen; the coordinator owns the navigation-level view of that.\n */\n@Injectable({ providedIn: 'root' })\nexport class VisualCommitCoordinator {\n  private readonly injector = inject(Injector);\n  /**\n   * There is no visual commit off the browser: nothing paints, and `afterNextRender` never runs,\n   * so on the server `NavigationEnd` IS the commit and outlet arms are ignored.\n   */\n  private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n  private readonly current = signal<VisualCommitState>(IDLE);\n\n  readonly state = this.current.asReadonly();\n\n  /**\n   * Outlets that owe a terminal swap, against the navigation they armed under. An arm outlives\n   * the navigation that made it: a hold an interrupting navigation never touched is still\n   * outstanding visual work, and the coordinator falls back to it if the interruption dies.\n   */\n  private readonly arms = new Map<object, number>();\n  /** Navigations that reached `NavigationEnd` and can therefore still commit. */\n  private readonly ended = new Set<number>();\n  /** View roots that swapped in, against the navigation they swapped in for. */\n  private roots: { navigationId: number; el: HTMLElement }[] = [];\n  /** The roots of the navigation that last committed, snapshotted so later swaps can't blur it. */\n  private committedRoots: HTMLElement[] = [];\n  /** The navigation the state currently reflects. */\n  private navigationId: number | null = null;\n\n  constructor() {\n    inject(Router)\n      .events.pipe(takeUntilDestroyed())\n      .subscribe((e: Event) => this.onEvent(e));\n  }\n\n  /** An outlet is activating for the current navigation and owes a terminal swap. */\n  arm(outlet: object): void {\n    if (!this.isBrowser || this.navigationId === null) return;\n    this.arms.set(outlet, this.navigationId);\n  }\n\n  /**\n   * The outlet's swap reached the screen (committed or immediate). `root` is the first root\n   * element of the view that swapped in, if the outlet has one.\n   */\n  settle(outlet: object, root: HTMLElement | null = null): void {\n    const armedFor = this.arms.get(outlet) ?? this.navigationId;\n    if (root && armedFor !== null)\n      this.roots.push({ navigationId: armedFor, el: root });\n    this.drop(outlet);\n  }\n\n  /**\n   * The outermost view root that swapped in for the navigation that committed — the region a\n   * focus move or an announcement should be about. `null` when nothing swapped.\n   */\n  committedRoot(): HTMLElement | null {\n    let outermost: HTMLElement | null = null;\n    for (const root of this.committedRoots) {\n      const contains =\n        outermost !== null &&\n        (root.compareDocumentPosition(outermost) &\n          Node.DOCUMENT_POSITION_CONTAINED_BY) !==\n          0;\n      if (outermost === null || contains) outermost = root;\n    }\n    return outermost;\n  }\n\n  /** The outlet's arm ended without reaching the screen (superseded, or the outlet went away). */\n  release(outlet: object): void {\n    this.drop(outlet);\n  }\n\n  /**\n   * Whether a navigation that already ended still owes a swap — visual work that is on its way to\n   * the screen no matter what the navigation asking is about to do.\n   */\n  outstandingCommit(): boolean {\n    return this.newestOutstanding() !== null;\n  }\n\n  private drop(outlet: object): void {\n    const armedFor = this.arms.get(outlet);\n    if (armedFor === undefined) return;\n    this.arms.delete(outlet);\n    this.commitIfSettled(armedFor);\n  }\n\n  private onEvent(e: Event): void {\n    switch (e.type) {\n      case EventType.NavigationStart:\n        this.navigationId = e.id;\n        this.prune();\n        this.current.set({ status: 'pending', navigationId: e.id });\n        break;\n      case EventType.NavigationEnd:\n        if (e.id !== this.navigationId) return;\n        this.ended.add(e.id);\n        if (!this.isBrowser) this.commitIfSettled(e.id);\n        else if (this.outstanding(e.id) === 0) this.commitAfterRender(e.id);\n        break;\n      case EventType.NavigationCancel:\n        // A redirect or a supersession is followed by another navigation that takes over.\n        if (\n          e.id !== this.navigationId ||\n          e.code === NavigationCancellationCode.Redirect ||\n          e.code === NavigationCancellationCode.SupersededByNewNavigation\n        )\n          return;\n        this.terminated(e.id);\n        break;\n      case EventType.NavigationError:\n        if (e.id === this.navigationId) this.terminated(e.id);\n        break;\n    }\n  }\n\n  /**\n   * A navigation ended without a successor. That settles the coordinator only if nothing is\n   * outstanding: an earlier navigation's hold that this one never took over is still on its way\n   * to the screen, so the status falls back to it and commits when it finally swaps.\n   */\n  private terminated(id: number): void {\n    this.forget(id);\n    const fallback = this.newestOutstanding();\n    if (fallback === null) {\n      this.reset();\n      return;\n    }\n    this.navigationId = fallback;\n    this.prune();\n    this.current.set({ status: 'pending', navigationId: fallback });\n  }\n\n  /** The most recent navigation that ended and still owes a swap. */\n  private newestOutstanding(): number | null {\n    let newest: number | null = null;\n    for (const armedFor of this.arms.values()) {\n      if (!this.ended.has(armedFor)) continue;\n      if (newest === null || armedFor > newest) newest = armedFor;\n    }\n    return newest;\n  }\n\n  private outstanding(id: number): number {\n    let count = 0;\n    for (const armedFor of this.arms.values()) if (armedFor === id) count++;\n    return count;\n  }\n\n  /** Nothing held, so the commit is simply the next render of the activated view. */\n  private commitAfterRender(id: number): void {\n    afterNextRender(() => this.commitIfSettled(id), {\n      injector: this.injector,\n    });\n  }\n\n  private commitIfSettled(id: number): void {\n    // The status tracks one navigation at a time: an older arm that settles after a newer\n    // navigation took over is a real swap for its outlet, but it must not walk the status back.\n    if (\n      id !== this.navigationId ||\n      !this.ended.has(id) ||\n      this.outstanding(id) > 0\n    )\n      return;\n    this.committedRoots = this.roots\n      .filter((r) => r.navigationId === id)\n      .map((r) => r.el);\n    this.current.set({ status: 'committed', navigationId: id });\n  }\n\n  /** Drop everything recorded for a navigation that can no longer commit. */\n  private forget(id: number): void {\n    this.ended.delete(id);\n    this.roots = this.roots.filter((r) => r.navigationId !== id);\n    for (const [outlet, armedFor] of this.arms)\n      if (armedFor === id) this.arms.delete(outlet);\n  }\n\n  /** Keep only what the current navigation or an outstanding arm still refers to. */\n  private prune(): void {\n    const live = new Set(this.arms.values());\n    if (this.navigationId !== null) live.add(this.navigationId);\n    for (const id of this.ended) if (!live.has(id)) this.ended.delete(id);\n    this.roots = this.roots.filter((r) => live.has(r.navigationId));\n  }\n\n  private reset(): void {\n    this.arms.clear();\n    this.ended.clear();\n    this.roots = [];\n    this.navigationId = null;\n    this.current.set(IDLE);\n  }\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n  afterNextRender,\n  effect,\n  type EnvironmentProviders,\n  inject,\n  Injectable,\n  InjectionToken,\n  Injector,\n  makeEnvironmentProviders,\n  PLATFORM_ID,\n  provideEnvironmentInitializer,\n  untracked,\n} from '@angular/core';\nimport { Title } from '@angular/platform-browser';\nimport { VisualCommitCoordinator } from '../visual-commit';\n\n/** Which parts of the route-change announcement to run. Both default to `true`. */\nexport type RouteA11yOptions = {\n  /** Announce the new document title in a polite live region. */\n  announce?: boolean;\n  /** Move focus to the view that swapped in. */\n  focus?: boolean;\n};\n\nconst ROUTE_A11Y_OPTIONS = new InjectionToken<Required<RouteA11yOptions>>(\n  'mmRouteA11yOptions',\n);\n\n/**\n * Makes route changes perceivable to assistive technology, on the visual commit rather than on\n * `NavigationEnd`.\n *\n * A client-side navigation replaces the page without any of the signals a document load gives a\n * screen reader: focus stays wherever it was, and nothing is announced. On commit this\n *\n * - moves focus to the root element of the view that swapped in (given a transient\n *   `tabindex=\"-1\"`, focused with `preventScroll` so it can't fight scroll restoration), and\n * - announces the new document title in a polite live region.\n *\n * The title is read after the hold-aware title store has applied, so what is announced is what\n * the page is actually called. Fires once per committed navigation and never for a navigation\n * that was superseded before it reached the screen.\n *\n * @example\n * ```ts\n * bootstrapApplication(App, {\n *   providers: [provideRouter(routes), provideRouteA11y()],\n * });\n *\n * // Announce only — the app moves focus itself:\n * provideRouteA11y({ focus: false });\n * ```\n */\nexport function provideRouteA11y(\n  options?: RouteA11yOptions,\n): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    {\n      provide: ROUTE_A11Y_OPTIONS,\n      useValue: {\n        announce: options?.announce ?? true,\n        focus: options?.focus ?? true,\n      },\n    },\n    provideEnvironmentInitializer(() => inject(RouteA11y)),\n  ]);\n}\n\nconst LIVE_REGION_STYLE =\n  'position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0';\n\n@Injectable({ providedIn: 'root' })\nclass RouteA11y {\n  private readonly options = inject(ROUTE_A11Y_OPTIONS);\n  private readonly coordinator = inject(VisualCommitCoordinator);\n  private readonly title = inject(Title);\n  private readonly document = inject(DOCUMENT);\n  private readonly injector = inject(Injector);\n  private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n  private liveRegion: HTMLElement | null = null;\n  private announcedFor: number | null = null;\n\n  constructor() {\n    if (!this.isBrowser) return;\n\n    effect(() => {\n      const { status, navigationId } = this.coordinator.state();\n      if (\n        status !== 'committed' ||\n        navigationId === null ||\n        navigationId === this.announcedFor\n      )\n        return;\n      this.announcedFor = navigationId;\n      // One render later: the title store's own effect has applied by then, and the swapped-in\n      // view is laid out, so it can take focus.\n      untracked(() =>\n        afterNextRender(() => this.perform(), { injector: this.injector }),\n      );\n    });\n  }\n\n  private perform(): void {\n    if (this.options.focus) this.moveFocus();\n    if (this.options.announce) this.announce(this.title.getTitle());\n  }\n\n  private moveFocus(): void {\n    const root = this.coordinator.committedRoot();\n    if (!root) return;\n\n    if (root.hasAttribute('tabindex')) {\n      root.focus({ preventScroll: true });\n      return;\n    }\n\n    root.setAttribute('tabindex', '-1');\n    root.addEventListener('blur', () => root.removeAttribute('tabindex'), {\n      once: true,\n    });\n    root.focus({ preventScroll: true });\n  }\n\n  private announce(text: string): void {\n    if (!this.liveRegion) {\n      const region = this.document.createElement('div');\n      region.setAttribute('aria-live', 'polite');\n      region.setAttribute('aria-atomic', 'true');\n      region.setAttribute('role', 'status');\n      region.setAttribute('style', LIVE_REGION_STYLE);\n      this.document.body.appendChild(region);\n      this.liveRegion = region;\n    }\n    this.liveRegion.textContent = text;\n  }\n}\n","type ParsedSegment = {\n  pathPart: string;\n  matrixParams: Record<string, string>;\n};\n\nfunction parsePathSegment(segmentString: string): ParsedSegment {\n  const parts = segmentString.split(';');\n  const pathPart = parts[0];\n  const matrixParams: Record<string, string> = {};\n  for (let i = 1; i < parts.length; i++) {\n    const part = parts[i];\n    // split once — matrix values may contain '='\n    const eq = part.indexOf('=');\n    const key = eq === -1 ? part : part.slice(0, eq);\n    if (key) {\n      matrixParams[key] = eq === -1 ? 'true' : part.slice(eq + 1);\n    }\n  }\n  return { pathPart, matrixParams };\n}\n\nfunction singleSegmentMatches(\n  configSegment: ParsedSegment,\n  linkSegment: ParsedSegment,\n): boolean {\n  if (\n    !configSegment.pathPart.startsWith(':') &&\n    configSegment.pathPart !== linkSegment.pathPart\n  ) {\n    return false;\n  }\n\n  const configMatrix = configSegment.matrixParams;\n  const linkMatrix = linkSegment.matrixParams;\n  for (const key in configMatrix) {\n    if (\n      !Object.prototype.hasOwnProperty.call(linkMatrix, key) ||\n      linkMatrix[key] !== configMatrix[key]\n    ) {\n      return false;\n    }\n  }\n  return true;\n}\n\nfunction createBasePredicate(path: string): (path: string) => boolean {\n  const configSegments = path\n    .split('/')\n    .filter((part) => !!part.trim())\n    .map((segment) => parsePathSegment(segment));\n\n  return (path: string) => {\n    const linkPathOnly = path.split(/[?#]/).at(0) ?? '';\n    if (!linkPathOnly && configSegments.length > 0) return false;\n    if (!linkPathOnly && configSegments.length === 0) return true;\n\n    const parts = linkPathOnly.split('/').filter((part) => !!part.trim());\n    if (parts.length < configSegments.length) return false;\n\n    return configSegments.every((configSegment, idx) =>\n      singleSegmentMatches(configSegment, parsePathSegment(parts[idx])),\n    );\n  };\n}\n\nfunction matchSegmentsRecursive(\n  configSegments: ParsedSegment[],\n  linkSegments: ParsedSegment[],\n  configIdx: number,\n  linkIdx: number,\n  // memo prevents exponential backtracking with multiple '**' segments\n  memo: Map<number, boolean>,\n): boolean {\n  if (configIdx === configSegments.length) {\n    return true;\n  }\n\n  const memoKey = configIdx * (linkSegments.length + 1) + linkIdx;\n  const cached = memo.get(memoKey);\n  if (cached !== undefined) return cached;\n\n  let result: boolean;\n\n  if (linkIdx === linkSegments.length) {\n    result = configSegments\n      .slice(configIdx)\n      .every((s) => s.pathPart === '**');\n  } else if (configSegments[configIdx].pathPart === '**') {\n    result =\n      matchSegmentsRecursive(\n        configSegments,\n        linkSegments,\n        configIdx + 1,\n        linkIdx,\n        memo,\n      ) ||\n      matchSegmentsRecursive(\n        configSegments,\n        linkSegments,\n        configIdx,\n        linkIdx + 1,\n        memo,\n      );\n  } else {\n    result =\n      singleSegmentMatches(configSegments[configIdx], linkSegments[linkIdx]) &&\n      matchSegmentsRecursive(\n        configSegments,\n        linkSegments,\n        configIdx + 1,\n        linkIdx + 1,\n        memo,\n      );\n  }\n\n  memo.set(memoKey, result);\n  return result;\n}\n\nfunction createWildcardPredicate(path: string): (linkPath: string) => boolean {\n  const configSegments = path\n    .split('/')\n    .filter((p) => !!p.trim())\n    .map((segment) => parsePathSegment(segment));\n\n  return (linkPath: string): boolean => {\n    const linkPathOnly = linkPath.split(/[?#]/).at(0) ?? '';\n    const linkSegments = linkPathOnly\n      .split('/')\n      .filter((p) => !!p.trim())\n      .map((segment) => parsePathSegment(segment));\n\n    return matchSegmentsRecursive(\n      configSegments,\n      linkSegments,\n      0,\n      0,\n      new Map(),\n    );\n  };\n}\n\n/**\n * @internal\n * Builds a predicate deciding whether a requested link path belongs to a route\n * config path (used by {@link PreloadStrategy} to match preload requests against\n * registered lazy routes).\n *\n * Semantics (intentionally simple, mirrors what link hrefs look like):\n * - **prefix matching** — `users/:id` matches `/users/42/orders`\n * - `:param` segments match any single path part\n * - `**` matches any number of path parts (including zero)\n * - matrix params in the config path must be present with equal values in the\n *   link path (`items;sort=asc` requires `;sort=asc` on that segment)\n * - query strings / fragments on the link are ignored\n *\n * Not supported: auxiliary outlet syntax (`(name:path)`) — such links simply\n * won't match.\n */\nexport function createRoutePredicate(\n  path: string,\n): (linkPath: string) => boolean {\n  return path.includes('**')\n    ? createWildcardPredicate(path)\n    : createBasePredicate(path);\n}\n","import { type EnvironmentInjector } from '@angular/core';\nimport { type Route } from '@angular/router';\n\n/**\n * @internal\n * The single place in this package that touches the router's private `Route` slots.\n *\n * Angular caches a lazy route's resolved children, injector, factory and component onto the\n * `Route` object itself under underscore-prefixed properties. Nothing about that is public API,\n * so every read and write of those names is funnelled through this module: when Angular renames\n * or restructures them, exactly one file breaks and `lazy-route-internals.spec.ts` says so.\n */\n\n/** The private slots Angular writes a lazy route's resolved state into. */\nexport const LAZY_STATE_SLOTS = [\n  '_loadedRoutes',\n  '_loadedInjector',\n  '_loadedNgModuleFactory',\n  '_loadedComponent',\n] as const;\n\n/**\n * Slots this package must never find on a router-built `Route`. `_loader$` held the in-flight\n * load in older Angular versions; since the loader moved to a `WeakMap` inside\n * `RouterConfigLoader` there is no route-reachable handle on an in-flight load, which is why\n * invalidation orphans the whole `Route` object instead of clearing slots in place.\n */\nexport const RETIRED_LAZY_SLOTS = ['_loader$'] as const;\n\ntype LazyRoute = Route &\n  Record<(typeof LAZY_STATE_SLOTS)[number] | '_injector', unknown>;\n\n/** Where a route sits in the config, so it can be replaced without re-walking. */\nexport type RouteLocation = {\n  readonly container: Route[];\n  readonly index: number;\n  readonly route: Route;\n};\n\n/** The tracked private slots this route currently owns, in declaration order. */\nexport function ownedLazySlots(route: Route): string[] {\n  return LAZY_STATE_SLOTS.filter(\n    (slot) => (route as LazyRoute)[slot] !== undefined,\n  );\n}\n\n/** Names from {@link RETIRED_LAZY_SLOTS} that unexpectedly exist on this route. */\nexport function retiredLazySlots(route: Route): string[] {\n  return RETIRED_LAZY_SLOTS.filter((slot) =>\n    Object.hasOwn(route as object, slot),\n  );\n}\n\n/** `true` once Angular has resolved (or is holding) lazy state for this route. */\nexport function hasLazyState(route: Route): boolean {\n  return ownedLazySlots(route).length > 0;\n}\n\n/** The route's lazily-loaded children, or `undefined` if it has none loaded. */\nexport function loadedChildren(route: Route): Route[] | undefined {\n  const loaded = (route as LazyRoute)._loadedRoutes;\n  return Array.isArray(loaded) ? (loaded as Route[]) : undefined;\n}\n\n/** The injector Angular created for this route's lazy-loaded `NgModule`, if it has one. */\nexport function loadedInjector(route: Route): EnvironmentInjector | undefined {\n  return (route as LazyRoute)._loadedInjector as\n    | EnvironmentInjector\n    | undefined;\n}\n\nfunction destroyInjectorSlot(\n  route: Route,\n  slot: '_injector' | '_loadedInjector',\n): void {\n  const injector = (route as LazyRoute)[slot] as\n    | EnvironmentInjector\n    | undefined;\n  if (!injector) return;\n  (route as LazyRoute)[slot] = undefined;\n  try {\n    injector.destroy();\n  } catch {\n    // already destroyed\n  }\n}\n\n/**\n * Destroys the injectors an orphaned route owns through its lazy state: its own loaded-module\n * injector, and both the module and `providers` injectors of every route it loaded.\n *\n * Angular's `destroyUnusedInjectors` only reaches routes still in the config, so a route dropped\n * from it takes its DI with it. The route's own `_injector` is deliberately left alone — that one\n * belongs to the route's `providers` and is carried onto the replacement.\n */\nexport function destroyLazyInjectors(route: Route): void {\n  destroyInjectorSlot(route, '_loadedInjector');\n  const queue = [...(loadedChildren(route) ?? [])];\n  while (queue.length) {\n    const child = queue.shift();\n    if (!child) continue;\n    destroyInjectorSlot(child, '_injector');\n    destroyInjectorSlot(child, '_loadedInjector');\n    if (child.children) queue.push(...child.children);\n    const loaded = loadedChildren(child);\n    if (loaded) queue.push(...loaded);\n  }\n}\n\n/**\n * A copy of `route` with every lazy-state slot dropped, so the router re-runs `loadChildren` /\n * `loadComponent` for it. The route's own `providers` injector (`_injector`) is carried over —\n * it is not lazy-load state, and dropping it would strand the live injector with no owner.\n */\nexport function withoutLazyState(route: Route): Route {\n  const fresh = { ...route } as LazyRoute;\n  for (const slot of LAZY_STATE_SLOTS) delete fresh[slot];\n  return fresh;\n}\n\n/**\n * Finds the route carrying `marker: id` in `data`, walking eager `children` and lazily-loaded\n * subtrees alike. Returns its container so callers can swap it; route objects are never used as\n * keys because the config replaces them (`Router.resetConfig` shallow-copies every route).\n */\nexport function findMarkedRoute(\n  config: Route[],\n  marker: symbol,\n  id: string,\n): RouteLocation | null {\n  const queue: Route[][] = [config];\n  const seen = new Set<Route[]>();\n\n  while (queue.length) {\n    const container = queue.shift();\n    if (!container || seen.has(container)) continue;\n    seen.add(container);\n\n    for (let index = 0; index < container.length; index++) {\n      const route = container[index];\n      if (route.data?.[marker] === id) return { container, index, route };\n      if (route.children) queue.push(route.children);\n      const loaded = loadedChildren(route);\n      if (loaded) queue.push(loaded);\n    }\n  }\n\n  return null;\n}\n\n/** Swaps the route at `location` for `next`, mutating the container the router already holds. */\nexport function replaceRouteAt(location: RouteLocation, next: Route): void {\n  location.container[location.index] = next;\n}\n","// The following functions are adapted from ngx-quicklink,\n// (https://github.com/mgechev/ngx-quicklink)\n// Copyright (c) Minko Gechev and contributors, licensed under the MIT License.\n\nimport { PRIMARY_OUTLET, type Route } from '@angular/router';\nimport { loadedChildren } from '../remount/lazy-route-internals';\n\nfunction isPrimaryRoute(route: Route): boolean {\n  return route.outlet === PRIMARY_OUTLET || !route.outlet;\n}\n\nexport const findPath = (config: Route[], route: Route): string => {\n  const configQueue = config.slice();\n  const parent = new Map<Route, Route>();\n  const visited = new Set<Route>();\n\n  while (configQueue.length) {\n    const el = configQueue.shift();\n    if (!el) {\n      continue;\n    }\n\n    visited.add(el);\n\n    if (el === route) {\n      break;\n    }\n\n    (el.children || []).forEach((childRoute: Route) => {\n      if (!visited.has(childRoute)) {\n        parent.set(childRoute, el);\n        configQueue.push(childRoute);\n      }\n    });\n\n    const lazyRoutes = loadedChildren(el) ?? [];\n    lazyRoutes.forEach((lazyRoute: Route) => {\n      if (lazyRoute && !visited.has(lazyRoute)) {\n        parent.set(lazyRoute, el);\n        configQueue.push(lazyRoute);\n      }\n    });\n  }\n\n  let path = '';\n  let currentRoute: Route | undefined = route;\n\n  while (currentRoute) {\n    const currentPath = currentRoute.path || '';\n    if (isPrimaryRoute(currentRoute)) {\n      path = `/${currentPath}${path}`;\n    } else {\n      path = `/(${currentRoute.outlet}:${currentPath})${path}`;\n    }\n    currentRoute = parent.get(currentRoute);\n  }\n\n  let normalizedPath = path.replaceAll(/\\/+/g, '/');\n\n  if (normalizedPath !== '/' && normalizedPath.endsWith('/')) {\n    normalizedPath = normalizedPath.slice(0, -1);\n  }\n\n  return normalizedPath;\n};\n","import { inject, type Injector, type Signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n  type Event,\n  EventType,\n  type NavigationEnd,\n  Router,\n} from '@angular/router';\nimport { filter, map } from 'rxjs/operators';\n\nfunction isNavigationEnd(e: Event): e is NavigationEnd {\n  return 'type' in e && e.type === EventType.NavigationEnd;\n}\n\n/**\n * A signal that increments on every successful navigation — INCLUDING navigations whose\n * resulting URL string equals the previous one (initial landing on `/`, `onSameUrlNavigation:\n * 'reload'`, redirect-back-to-same-URL). Use this, not the URL string, to key recomputation\n * of anything derived from router state snapshots.\n *\n * @param router The `Router` instance to observe.\n * @param injector Required when calling outside an injection context — the underlying\n *   subscription's lifetime needs a `DestroyRef`.\n *\n * @example\n * ```ts\n * const tick = navigationEndTick(inject(Router));\n * const leafSnapshot = computed(() => {\n *   tick(); // recompute per navigation, even same-URL reloads\n *   let leaf = router.routerState.snapshot.root;\n *   while (leaf.firstChild) leaf = leaf.firstChild;\n *   return leaf;\n * });\n * ```\n */\nexport function navigationEndTick(\n  router: Router,\n  injector?: Injector,\n): Signal<number> {\n  let tick = 0;\n  return toSignal(\n    router.events.pipe(\n      filter(isNavigationEnd),\n      map(() => ++tick),\n    ),\n    { initialValue: 0, ...(injector ? { injector } : {}) },\n  );\n}\n\n/**\n * Creates a Signal that tracks the current router URL.\n *\n * The signal emits the URL string reflecting the router state *after* redirects\n * have completed for each successful navigation. It initializes with the router's\n * current URL state.\n *\n * @returns {Signal<string>} A Signal emitting the `urlAfterRedirects` upon successful navigation.\n *\n * @example\n * ```ts\n * import { Component, effect } from '@angular/core';\n * import { url } from '@mmstack/router-core'; // Adjust import path\n *\n * @Component({\n * selector: 'app-root',\n * template: `Current URL: {{ currentUrl() }}`\n * })\n * export class AppComponent {\n * currentUrl = url();\n *\n * constructor() {\n * effect(() => {\n * console.log('Navigation ended. New URL:', this.currentUrl());\n * // e.g., track page view with analytics\n * });\n * }\n * }\n * ```\n */\nexport function url(\n  router?: Router,\n  opt?: {\n    /**\n     * Injector for the underlying subscription. Required when calling outside an\n     * injection context (passing `router` alone is not enough — the subscription\n     * lifetime still needs a `DestroyRef`).\n     */\n    injector?: Injector;\n  },\n): Signal<string> {\n  if (!router) router = inject(Router);\n\n  return toSignal(\n    router.events.pipe(\n      filter(isNavigationEnd),\n      map((e) => e.urlAfterRedirects),\n    ),\n    {\n      initialValue: router.url,\n      ...(opt?.injector ? { injector: opt.injector } : {}),\n    },\n  );\n}\n","import { computed, inject, Injectable, type Signal } from '@angular/core';\nimport {\n  type ActivatedRouteSnapshot,\n  Router,\n  type RouterStateSnapshot,\n} from '@angular/router';\nimport { navigationEndTick } from '../url';\n\n/**\n * A flattened view of one route in the active router chain, used by the\n * breadcrumb and title subsystems. Each `ResolvedLeafRoute` describes one\n * \"step\" in the chain from root to current leaf.\n *\n * Exposed publicly because custom breadcrumb generators (see\n * {@link BreadcrumbConfig}'s `generation` callback) receive instances of\n * this type and need to read its fields.\n *\n * - `route` — the underlying `ActivatedRouteSnapshot`.\n * - `segment.path` — the route config segment (e.g. `:userId`).\n * - `segment.resolved` — the resolved value of that segment (e.g. `'42'`).\n * - `path` — the full route-config path from root (with raw segments like `:userId`).\n * - `link` — the full resolved URL from root (with substituted values).\n */\nexport type ResolvedLeafRoute = {\n  route: ActivatedRouteSnapshot;\n  segment: {\n    path: string;\n    resolved: string;\n  };\n  path: string;\n  link: string;\n};\n\n// Only the primary outlet chain is walked; aux-outlet routes stay inert.\nfunction leafRoutes(): Signal<ResolvedLeafRoute[]> {\n  const router = inject(Router);\n\n  const getLeafRoutes = (\n    snapshot: RouterStateSnapshot,\n  ): ResolvedLeafRoute[] => {\n    const routes: ResolvedLeafRoute[] = [];\n    let route: ActivatedRouteSnapshot | null = snapshot.root;\n\n    while (route) {\n      const allSegments = route.pathFromRoot.flatMap(\n        (snap) => snap.routeConfig?.path ?? [],\n      );\n\n      const segments = allSegments.filter(Boolean);\n\n      const path = router.serializeUrl(router.parseUrl(segments.join('/')));\n\n      const parts = route.pathFromRoot\n        .flatMap((snap) => snap.url ?? [])\n        .map((u) => u.path)\n        .filter(Boolean);\n\n      const link = router.serializeUrl(router.parseUrl(parts.join('/')));\n\n      const entry: ResolvedLeafRoute = {\n        route,\n        segment: {\n          path: segments.at(-1) ?? '',\n          resolved: parts.at(-1) ?? '',\n        },\n        path,\n        link,\n      };\n\n      // empty-path children share their parent's path; keep the deepest snapshot\n      const existingIdx = routes.findIndex((r) => r.path === path);\n      if (existingIdx >= 0) routes[existingIdx] = entry;\n      else routes.push(entry);\n\n      route =\n        route.children?.find((c) => c.outlet === 'primary') ??\n        route.firstChild;\n    }\n\n    return routes;\n  };\n\n  const tick = navigationEndTick(router);\n\n  const leafRoutes = computed(() => {\n    tick();\n    return getLeafRoutes(router.routerState.snapshot);\n  });\n\n  return leafRoutes;\n}\n\n@Injectable({\n  providedIn: 'root',\n})\nexport class RouteLeafStore {\n  readonly leaves = leafRoutes();\n}\n\nexport function injectLeafRoutes() {\n  const store = inject(RouteLeafStore);\n  return store.leaves;\n}\n","import { inject } from '@angular/core';\nimport { type ActivatedRouteSnapshot, Router } from '@angular/router';\n\nexport function injectSnapshotPathResolver() {\n  const router = inject(Router);\n\n  return (route: ActivatedRouteSnapshot) => {\n    const segments = route.pathFromRoot.flatMap(\n      (snap) => snap.routeConfig?.path ?? [],\n    );\n\n    const joinedSegments = segments.filter(Boolean).join('/');\n\n    return router.serializeUrl(router.parseUrl(joinedSegments));\n  };\n}\n","import { type Signal } from '@angular/core';\n\n/**\n * Represents a single breadcrumb item within the navigation path.\n * All dynamic properties are represented as Angular Signals to enable reactivity.\n */\nexport type Breadcrumb = {\n  /**\n   * A unique identifier for the breadcrumb item. Generally the unresolved path for example `/posts/:id`.\n   * Useful for `@for` tracking in templates.\n   */\n  id: string;\n  /**\n   * The visible text for the breadcrumb item.\n   * Updated reactively as the url/link based on\n   * either a provided definition, or the current route.\n   */\n  label: Signal<string>;\n  /**\n   * An accessible label for the breadcrumb item.\n   * Defaults to the same value as `label` if not provided.\n   */\n  ariaLabel: Signal<string>;\n  /**\n   * The URL link for the breadcrumb item.\n   * Updates as the route changes.\n   */\n  link: Signal<string>;\n};\n\n/**\n * @internal\n */\nconst INTERNAL_BREADCRUMB_SYMBOL = Symbol.for('MMSTACK_INTERNAL_BREADCRUMB');\n\n/**\n * @internal\n */\nexport type InternalBreadcrumb = Breadcrumb & {\n  [INTERNAL_BREADCRUMB_SYMBOL]: {\n    active: Signal<boolean>;\n    registered: boolean;\n  };\n};\n\n/**\n * @internal\n */\nexport function getBreadcrumbInternals(breadcrumb: InternalBreadcrumb) {\n  return (breadcrumb as InternalBreadcrumb)[INTERNAL_BREADCRUMB_SYMBOL];\n}\n\n/**\n * @internal\n */\nexport function createInternalBreadcrumb(\n  bc: Breadcrumb,\n  active: Signal<boolean>,\n  registered = true,\n): InternalBreadcrumb {\n  return {\n    ...bc,\n    [INTERNAL_BREADCRUMB_SYMBOL]: {\n      active,\n      registered,\n    },\n  };\n}\n\n/**\n * @internal\n */\nexport function isInternalBreadcrumb(\n  breadcrumb: Breadcrumb | InternalBreadcrumb,\n): breadcrumb is InternalBreadcrumb {\n  return !!(breadcrumb as InternalBreadcrumb)[INTERNAL_BREADCRUMB_SYMBOL];\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport { type ResolvedLeafRoute } from '../util';\n\n/**\n * Returns a label generator. The outer function runs in a root injection context;\n * the returned function is wrapped in a computed, so signals it reads update labels reactively.\n */\ntype GenerateBreadcrumbFn = () => (leaf: ResolvedLeafRoute) => string;\n\n/**\n * Configuration options for the breadcrumb system.\n * Use `provideBreadcrumbConfig` to supply these options to your application.\n */\nexport type BreadcrumbConfig = {\n  /**\n   * Defines how breadcrumb labels are generated.\n   * - `'manual'`: only manually registered breadcrumbs (via `createBreadcrumb`) are shown.\n   * - a {@link GenerateBreadcrumbFn}: custom label generation.\n   * - undefined: labels are auto-generated from the route's title, data, or path.\n   */\n  generation?: 'manual' | GenerateBreadcrumbFn;\n};\n\n/**\n * @internal\n */\nconst token = new InjectionToken<BreadcrumbConfig>(\n  '@mmstack/router-core:breadcrumb-config',\n);\n\n/**\n * Provides configuration for the breadcrumb system.\n *\n * @param config A partial {@link BreadcrumbConfig}. The `generation` field controls\n *   automatic label generation: `'manual'` disables it (breadcrumbs only show when\n *   {@link createBreadcrumb} explicitly registers them); a function provides a\n *   custom label generator instead of the default route-title-based one.\n * @returns A `Provider` to add to your app's providers array.\n *\n * @see BreadcrumbConfig\n *\n * @example\n * ```ts\n * // Disable automatic generation — breadcrumbs only appear when createBreadcrumb is used\n * bootstrapApplication(AppComponent, {\n *   providers: [\n *     provideRouter(routes),\n *     provideBreadcrumbConfig({ generation: 'manual' }),\n *   ],\n * });\n * ```\n *\n * @example\n * ```ts\n * // Custom label strategy — outer fn runs in injection context, inner is reactive\n * const customLabelStrategy = () => (leaf: ResolvedLeafRoute) =>\n *   leaf.route.data?.['navTitle'] ?? leaf.route.title ?? 'Unnamed';\n *\n * provideBreadcrumbConfig({ generation: customLabelStrategy });\n * ```\n */\nexport function provideBreadcrumbConfig(config: Partial<BreadcrumbConfig>) {\n  return {\n    provide: token,\n    useValue: {\n      ...config,\n    },\n  };\n}\n\n/**\n * @internal\n */\nexport function injectBreadcrumbConfig(): BreadcrumbConfig {\n  return (\n    inject(token, {\n      optional: true,\n    }) ?? {}\n  );\n}\n","import { effect, inject, untracked } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type Event, EventType, Router } from '@angular/router';\nimport { VisualCommitCoordinator } from '../visual-commit';\n\n/** When buffered registrations are applied. */\nexport type StagedFlush =\n  /** `NavigationEnd` — the router has committed the URL. */\n  | 'navigation-end'\n  /** The swap is on screen (see `injectVisualCommit`) — right for anything the user can see. */\n  | 'visual-commit';\n\n/**\n * @internal\n * Buffers registrations made during a navigation and applies them only when it commits.\n *\n * Registrations are dropped on `NavigationCancel`/`NavigationError`, and apply immediately when\n * made outside any navigation. Under `'visual-commit'` a buffer that a navigation never got to\n * flush — because a newer navigation interrupted it — carries into the interrupting navigation\n * and flushes at its commit instead. A cancellation there only drops the buffer if no swap is\n * still on its way to the screen: one that is will need it.\n *\n * Must be created in an injection context.\n */\nexport function createStagedApply<V>(\n  apply: (id: string, value: V) => void,\n  flushOn: StagedFlush = 'navigation-end',\n): (id: string, value: V) => void {\n  const router = inject(Router);\n  const holdAware = flushOn === 'visual-commit';\n  const coordinator = holdAware ? inject(VisualCommitCoordinator) : null;\n\n  let staged: [string, V][] | null = null;\n\n  const flush = () => {\n    const pending = staged ?? [];\n    staged = null;\n    for (const [id, value] of pending) apply(id, value);\n  };\n\n  router.events.pipe(takeUntilDestroyed()).subscribe((e: Event) => {\n    switch (e.type) {\n      case EventType.NavigationStart:\n        staged = holdAware ? (staged ?? []) : [];\n        break;\n      case EventType.NavigationEnd:\n        if (!holdAware) flush();\n        break;\n      case EventType.NavigationCancel:\n      case EventType.NavigationError:\n        // A swap an earlier navigation still owes will reach the screen, and needs its buffer.\n        if (!coordinator?.outstandingCommit()) staged = null;\n        break;\n    }\n  });\n\n  if (coordinator) {\n    let flushedFor: number | null = null;\n    effect(() => {\n      const { status, navigationId } = coordinator.state();\n      if (status !== 'committed' || navigationId === flushedFor) return;\n      flushedFor = navigationId;\n      untracked(flush);\n    });\n  }\n\n  return (id: string, value: V) => {\n    if (staged) staged.push([id, value]);\n    else apply(id, value);\n  };\n}\n","import { computed, inject, Injectable, type Signal } from '@angular/core';\nimport { indexArray, mutable } from '@mmstack/primitives';\nimport { injectLeafRoutes, type ResolvedLeafRoute } from '../util/leaf.store';\nimport { createStagedApply } from '../util/staged-apply';\nimport {\n  type Breadcrumb,\n  createInternalBreadcrumb,\n  getBreadcrumbInternals,\n  type InternalBreadcrumb,\n  isInternalBreadcrumb,\n} from './breadcrumb';\nimport { injectBreadcrumbConfig } from './breadcrumb-config';\n\nfunction uppercaseFirst(str: string): string {\n  const lcs = str.toLowerCase();\n  return lcs.charAt(0).toUpperCase() + lcs.slice(1);\n}\n\nfunction removeMatrixAndQueryParams(path: string): string {\n  const [cleanPath] = path.split(';');\n  return cleanPath.split('?')[0];\n}\n\nfunction parsePathSegment(pathSegment: string): string {\n  return pathSegment\n    .split('/')\n    .flatMap((part) => part.split('.'))\n    .flatMap((part) => part.split('-'))\n    .map((part) => uppercaseFirst(removeMatrixAndQueryParams(part)))\n    .join(' ');\n}\n\nfunction generateLabel(leaf: ResolvedLeafRoute): string {\n  // raw config title, not the resolved one (createTitle would leak its prefix)\n  const configTitle = leaf.route.routeConfig?.title;\n  const title =\n    (typeof configTitle === 'string' ? configTitle : undefined) ??\n    leaf.route.data?.['title'];\n\n  if (title && typeof title === 'string') return title;\n  if (leaf.segment.path.includes(':')) return leaf.segment.resolved;\n\n  return parsePathSegment(leaf.segment.path);\n}\n\nfunction autoGenerateBreadcrumb(\n  id: string,\n  leaf: Signal<ResolvedLeafRoute>,\n  autoGenerateFn: Signal<(leaf: ResolvedLeafRoute) => string>,\n): Breadcrumb {\n  const label = computed(() => autoGenerateFn()(leaf()));\n\n  return createInternalBreadcrumb(\n    {\n      id,\n      label,\n      ariaLabel: label,\n      link: computed(() => leaf().link),\n    },\n    computed(\n      () =>\n        leaf().route.data?.['skipBreadcrumb'] !== true &&\n        id !== '' &&\n        id !== '/' &&\n        leaf().segment.path !== '' &&\n        leaf().segment.path !== '/' &&\n        !leaf().segment.path.endsWith('/') &&\n        !!label(),\n    ),\n    false,\n  );\n}\n\nfunction injectGenerateLabelFn() {\n  const { generation } = injectBreadcrumbConfig();\n\n  if (typeof generation !== 'function') return computed(() => generateLabel);\n\n  const provided = generation();\n  return computed(() => provided);\n}\n\nfunction injectIsManual() {\n  return injectBreadcrumbConfig().generation === 'manual';\n}\n\nfunction exposeActiveSignal(\n  crumbSignal: Signal<Breadcrumb>,\n  manual: boolean,\n): Signal<Breadcrumb> & {\n  active: Signal<boolean>;\n} {\n  const active = manual\n    ? computed(() => {\n        const crumb = crumbSignal();\n\n        return (\n          isInternalBreadcrumb(crumb) &&\n          getBreadcrumbInternals(crumb).registered &&\n          getBreadcrumbInternals(crumb).active()\n        );\n      })\n    : computed(() => {\n        const crumb = crumbSignal();\n        if (!isInternalBreadcrumb(crumb)) return true;\n        return getBreadcrumbInternals(crumb).active();\n      });\n\n  const sig = crumbSignal as Signal<Breadcrumb> & {\n    active: Signal<boolean>;\n  };\n\n  sig.active = active;\n\n  return sig;\n}\n\n@Injectable({\n  providedIn: 'root',\n})\nexport class BreadcrumbStore {\n  private readonly map = mutable<Map<string, InternalBreadcrumb>>(new Map());\n  private readonly isManual = injectIsManual();\n  private readonly autoGenerateLabelFn = injectGenerateLabelFn();\n  private readonly leafRoutes = injectLeafRoutes();\n\n  private readonly all = indexArray(\n    this.leafRoutes,\n    (leaf) => {\n      const stableId = computed(() => leaf().path);\n\n      const cache: {\n        id: string | null;\n        auto: InternalBreadcrumb | null;\n        found: InternalBreadcrumb | null;\n        wrapped: InternalBreadcrumb | null;\n      } = { id: null, auto: null, found: null, wrapped: null };\n\n      return exposeActiveSignal(\n        computed(() => {\n          const id = stableId();\n\n          if (cache.id !== id) {\n            cache.id = id;\n            cache.auto = null;\n            cache.found = null;\n            cache.wrapped = null;\n          }\n\n          const found = this.map().get(id);\n\n          if (!found) {\n            cache.found = null;\n            cache.wrapped = null;\n            return (cache.auto ??= autoGenerateBreadcrumb(\n              id,\n              leaf,\n              this.autoGenerateLabelFn,\n            ) as InternalBreadcrumb);\n          }\n\n          if (cache.found !== found) {\n            cache.found = found;\n            cache.wrapped = {\n              ...found,\n              link: computed(() => leaf().link),\n            };\n          }\n\n          return cache.wrapped as InternalBreadcrumb;\n        }),\n        this.isManual,\n      );\n    },\n    {\n      equal: (a, b) => a.link === b.link,\n    },\n  );\n\n  private readonly crumbs = computed((): Signal<Breadcrumb>[] =>\n    this.all().filter((c) => c.active()),\n  );\n\n  readonly unwrapped = computed(() => this.crumbs().map((c) => c()));\n\n  // staged: apply only once the navigation commits\n  private readonly stagedApply = createStagedApply<InternalBreadcrumb>(\n    (id, breadcrumb) => this.map.inline((m) => m.set(id, breadcrumb)),\n  );\n\n  register(breadcrumb: InternalBreadcrumb) {\n    this.stagedApply(breadcrumb.id, breadcrumb);\n  }\n}\n\n/**\n * Injects and provides access to a reactive list of breadcrumbs.\n *\n * The breadcrumbs are ordered and reflect the current active navigation path.\n * @see Breadcrumb\n * @returns `Signal<Breadcrumb[]>`\n *\n * @example\n * ```typescript\n * @Component({\n * selector: 'app-breadcrumbs',\n * template: `\n *  <nav aria-label=\"breadcrumb\">\n *    <ol>\n *      @for (crumb of breadcrumbs(); track crumb.id) {\n *        <li>\n *          <a [routerLink]=\"crumb.link()\" [attr.aria-label]=\"crumb.ariaLabel()\">{{ crumb.label() }}</a>\n *        </li>\n *      }\n *    </ol>\n *  </nav>\n * `\n * })\n * export class MyBreadcrumbsComponent {\n *  breadcrumbs = injectBreadcrumbs();\n * }\n * ```\n */\nexport function injectBreadcrumbs() {\n  const store = inject(BreadcrumbStore);\n  return store.unwrapped;\n}\n","import { computed, inject } from '@angular/core';\nimport {\n  type ActivatedRouteSnapshot,\n  createUrlTreeFromSnapshot,\n  Router,\n  type ResolveFn,\n} from '@angular/router';\nimport { until } from '@mmstack/primitives';\nimport { injectSnapshotPathResolver } from '../util';\nimport { createInternalBreadcrumb, type Breadcrumb } from './breadcrumb';\nimport { BreadcrumbStore } from './breadcrumb-store';\n\n/**\n * Options for defining a breadcrumb.\n */\ntype CreateBreadcrumbOptions = {\n  /**\n   * The visible text for the breadcrumb.\n   * Can be a static string or a function for dynamic labels.\n   */\n  label: string | (() => string);\n  /**\n   * An accessible label for the breadcrumb item.\n   * Defaults to the value of `label` if not provided.\n   * Can be a static string or a function returning a string for dynamic ARIA labels.\n   */\n  ariaLabel?: string | (() => string);\n  /**\n   * If `true`, the route resolver will wait until the `label` signal has a value before resolving.\n   */\n  awaitValue?: boolean;\n};\n\n/**\n * Creates and registers a breadcrumb for a specific route. Designed to be used\n * as an Angular Route `ResolveFn` in the route's `resolve` map.\n *\n * Accepts a static label, a static options object, or a factory returning\n * either — use a factory when you need `inject()` to read dynamic data.\n *\n * @param factoryOrValue One of: a literal label string (shorthand for\n *   `{ label: <string> }`), a static {@link CreateBreadcrumbOptions} object,\n *   or a factory `(route) => string | CreateBreadcrumbOptions` invoked inside an\n *   injection context (so it can use `inject()`) and receiving the route's\n *   `ActivatedRouteSnapshot` — params/data are idiomatically reachable:\n *   `createBreadcrumb((route) => 'Order ' + route.params['id'])`.\n * @returns An Angular `ResolveFn<void>` to wire into a route's `resolve` map.\n *   The resolver registers the breadcrumb as a side effect; the resolved value\n *   itself is unused.\n *\n * @see CreateBreadcrumbOptions\n *\n * @example\n * ```ts\n * export const appRoutes: Routes = [\n *   {\n *     path: 'home',\n *     component: HomeComponent,\n *     resolve: {\n *       // shorthand for { label: 'Home' }\n *       breadcrumb: createBreadcrumb('Home'),\n *     },\n *   },\n *   {\n *     path: 'users/:userId',\n *     component: UserProfileComponent,\n *     resolve: {\n *       breadcrumb: createBreadcrumb(() => {\n *         const userStore = inject(UserStore);\n *         return {\n *           label: () => userStore.user().name ?? 'Loading…',\n *         };\n *       }),\n *     },\n *   },\n * ];\n * ```\n */\nexport function createBreadcrumb(\n  factoryOrValue:\n    | ((route: ActivatedRouteSnapshot) => CreateBreadcrumbOptions | string)\n    | string\n    | CreateBreadcrumbOptions,\n): ResolveFn<void> {\n  const factory =\n    typeof factoryOrValue === 'string'\n      ? (): CreateBreadcrumbOptions => ({ label: factoryOrValue })\n      : typeof factoryOrValue === 'function'\n        ? (route: ActivatedRouteSnapshot): CreateBreadcrumbOptions => {\n            const result = factoryOrValue(route);\n            return typeof result === 'string' ? { label: result } : result;\n          }\n        : () => factoryOrValue;\n\n  return async (route) => {\n    const router = inject(Router);\n    const store = inject(BreadcrumbStore);\n    const resolver = injectSnapshotPathResolver();\n\n    const fp = resolver(route);\n\n    // path only — query params/fragment must not be frozen into the link\n    const tree = createUrlTreeFromSnapshot(route, []);\n\n    const provided = factory(route);\n\n    const link = computed(() => router.serializeUrl(tree));\n\n    const { label, ariaLabel = label } = provided;\n\n    const bc: Breadcrumb = {\n      id: fp,\n      ariaLabel:\n        typeof ariaLabel === 'string'\n          ? computed(() => ariaLabel)\n          : computed(ariaLabel),\n      label:\n        typeof label === 'string' ? computed(() => label) : computed(label),\n      link,\n    };\n\n    store.register(\n      createInternalBreadcrumb(\n        bc,\n        computed(() => route.data?.['skipBreadcrumb'] !== true),\n      ),\n    );\n\n    if (provided.awaitValue) await until(bc.label, (v) => !!v);\n\n    return Promise.resolve();\n  };\n}\n","import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n/** `'code'` warms route code only; `'all'` also warms route data. */\nexport type PreloadScope = 'all' | 'code';\n\nexport type PreloadRequest = {\n  readonly path: string;\n  readonly scope: PreloadScope;\n};\n\n@Injectable({ providedIn: 'root' })\nexport class PreloadRequester {\n  private readonly preloadOnDemand$ = new Subject<PreloadRequest>();\n  readonly preloadRequested$ = this.preloadOnDemand$.asObservable();\n\n  startPreload(routePath: string, scope: PreloadScope = 'all') {\n    this.preloadOnDemand$.next({ path: routePath, scope });\n  }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type PreloadingStrategy, type Route, Router } from '@angular/router';\nimport { EMPTY, type Observable, switchMap, timer } from 'rxjs';\nimport { createRoutePredicate, findPath } from '../util';\nimport { PreloadRequester } from './preload-requester';\n\nfunction hasSlowConnection() {\n  if (\n    globalThis.window &&\n    'navigator' in globalThis.window &&\n    'connection' in globalThis.window.navigator &&\n    typeof globalThis.window.navigator.connection === 'object' &&\n    !!globalThis.window.navigator.connection\n  ) {\n    const is2g =\n      'effectiveType' in globalThis.window.navigator.connection &&\n      typeof globalThis.window.navigator.connection.effectiveType ===\n        'string' &&\n      globalThis.window.navigator.connection.effectiveType.endsWith('2g');\n    if (is2g) return true;\n    if (\n      'saveData' in globalThis.window.navigator.connection &&\n      typeof globalThis.window.navigator.connection.saveData === 'boolean' &&\n      globalThis.window.navigator.connection.saveData\n    )\n      return true;\n  }\n\n  return false;\n}\n\nfunction noPreload(route: Route) {\n  return route.data && route.data['preload'] === false;\n}\n\nfunction preloadDelay(route: Route): number {\n  const delay = route.data?.['preloadDelay'];\n  return typeof delay === 'number' && delay > 0 ? delay : 0;\n}\n\ntype RegisteredLoader = {\n  predicate: (path: string) => boolean;\n  load: () => Observable<unknown>;\n  delay: number;\n};\n\n/**\n * Demand-driven preloading strategy for Angular's router. Unlike Angular's\n * built-in `PreloadAllModules`, this strategy preloads a lazy route only\n * when something explicitly requests it via {@link PreloadRequester} (e.g.\n * the `mmLink` directive on hover or visibility, or {@link injectTriggerPreload}\n * called imperatively).\n *\n * `preload()` itself completes immediately — loaders are registered and\n * triggered on demand. This keeps `RouterPreloader`'s internal queue moving,\n * so lazy routes discovered by later navigations register correctly too.\n *\n * Skips preloading when:\n * - the route has `data.preload === false`\n * - the network is on `2g` or in `saveData` mode (cheap-data-mode users)\n * - a load for the same path is already in flight (or already loaded)\n *\n * Set `data.preloadDelay` (milliseconds) on a route to debounce hover-intent:\n * the load starts only after the delay elapses following the first request —\n * useful to avoid loading on accidental pointer flybys.\n *\n * Wire this into `provideRouter` to enable the `mmLink` preload pipeline:\n *\n * @example\n * ```ts\n * import { PreloadStrategy } from '@mmstack/router-core';\n * import { provideRouter, withPreloading } from '@angular/router';\n *\n * bootstrapApplication(AppComponent, {\n *   providers: [\n *     provideRouter(routes, withPreloading(PreloadStrategy)),\n *   ],\n * });\n *\n * // Then in templates, `mmLink` (or `injectTriggerPreload`) requests\n * // preloads that this strategy executes:\n * // <a [mmLink]=\"'/users'\">Users</a>\n * ```\n *\n * @example\n * ```ts\n * // Opt a route out of preloading / add hover-intent delay:\n * export const routes: Routes = [\n *   { path: 'admin', loadChildren: () => import('./admin'), data: { preload: false } },\n *   { path: 'reports', loadChildren: () => import('./reports'), data: { preloadDelay: 150 } },\n * ];\n * ```\n */\n@Injectable({\n  providedIn: 'root',\n})\nexport class PreloadStrategy implements PreloadingStrategy {\n  private readonly loaders = new Map<string, RegisteredLoader>();\n  private readonly loading = new Set<string>();\n  private readonly router = inject(Router);\n  private readonly req = inject(PreloadRequester);\n\n  constructor() {\n    this.req.preloadRequested$\n      .pipe(takeUntilDestroyed())\n      .subscribe(({ path }) => this.trigger(path));\n  }\n\n  preload(route: Route, load: () => Observable<any>): Observable<any> {\n    if (!noPreload(route)) {\n      const fp = findPath(this.router.config, route);\n      // EMPTY (complete immediately) is load-bearing: RouterPreloader concatMaps these.\n      if (!this.loading.has(fp)) {\n        this.loaders.set(fp, {\n          predicate: createRoutePredicate(fp),\n          load,\n          delay: preloadDelay(route),\n        });\n      }\n    }\n\n    return EMPTY;\n  }\n\n  /**\n   * Forgets what has been warmed under `pathPrefix` — the path itself and everything below it —\n   * so those routes can be preloaded again.\n   *\n   * A path is normally warmed at most once, because a loaded route stays loaded. Dropping a\n   * route's cached load (see `injectRemountHandle`) breaks that assumption: the route is\n   * factory-fresh again and has to be re-warmable, or it can only ever be loaded by an actual\n   * navigation.\n   */\n  forget(pathPrefix: string): void {\n    const under = (fp: string) =>\n      fp === pathPrefix || fp.startsWith(`${pathPrefix}/`);\n    for (const fp of [...this.loaders.keys()])\n      if (under(fp)) this.loaders.delete(fp);\n    for (const fp of [...this.loading]) if (under(fp)) this.loading.delete(fp);\n  }\n\n  private trigger(path: string): void {\n    if (this.loaders.size === 0 || hasSlowConnection()) return;\n\n    for (const [fp, loader] of this.loaders) {\n      if (this.loading.has(fp)) continue;\n      if (path !== fp && !loader.predicate(path)) continue;\n\n      this.loading.add(fp);\n\n      const load$ =\n        loader.delay > 0\n          ? timer(loader.delay).pipe(switchMap(() => loader.load()))\n          : loader.load();\n\n      load$.subscribe({\n        complete: () => this.loaders.delete(fp),\n        error: () => this.loading.delete(fp), // allow retry on next request\n      });\n    }\n  }\n}\n","import {\n  booleanAttribute,\n  computed,\n  DestroyRef,\n  Directive,\n  effect,\n  ElementRef,\n  HostListener,\n  inject,\n  InjectionToken,\n  input,\n  output,\n  type Provider,\n  untracked,\n} from '@angular/core';\nimport {\n  type ActivatedRoute,\n  type Params,\n  Router,\n  RouterLink,\n  RouterLinkWithHref,\n  UrlTree,\n} from '@angular/router';\nimport { elementVisibility } from '@mmstack/primitives';\nimport { PreloadRequester } from './preloading';\n\nfunction inputToUrlTree(\n  router: Router,\n  link: string | any[] | UrlTree | null,\n  relativeTo?: ActivatedRoute,\n  queryParams?: Params,\n  fragment?: string,\n  queryParamsHandling?: 'merge' | 'preserve' | '',\n  routerLinkUrlTree?: UrlTree | null,\n): UrlTree | null {\n  if (!link) return null;\n  if (routerLinkUrlTree) return routerLinkUrlTree;\n\n  if (link instanceof UrlTree) return link;\n\n  const arr = Array.isArray(link) ? link : [link];\n\n  return router.createUrlTree(arr, {\n    relativeTo,\n    queryParams,\n    fragment,\n    queryParamsHandling,\n  });\n}\n\nfunction treeToSerializedUrl(\n  router: Router,\n  urlTree: UrlTree | null,\n): string | null {\n  if (!urlTree) return null;\n  return router.serializeUrl(urlTree);\n}\n\n// Mirrors RouterLink's anchor detection (keep in sync); Link's click gating depends on it.\nfunction isAnchorLikeHost(el: HTMLElement): boolean {\n  const tagName = el.tagName?.toLowerCase();\n  if (tagName === 'a' || tagName === 'area') return true;\n  if (typeof customElements !== 'object') return false;\n  const ctor = customElements.get(tagName) as\n    | { observedAttributes?: readonly string[] }\n    | undefined;\n  return !!ctor?.observedAttributes?.includes?.('href');\n}\n\n/**\n * Returns an imperative function that triggers preloading for an arbitrary link, using\n * the same path resolution and {@link PreloadStrategy} pipeline as the {@link Link}\n * (`mmLink`) directive.\n *\n * Use this when the `Link` directive isn't a fit — for example, preloading a route from\n * an effect when a user opens a menu, hovers a non-link element, or reacts to a signal\n * change — and you don't want to render an `<a [mmLink]>` just to request the preload.\n *\n * Requires {@link PreloadStrategy} to be wired up via `provideRouter(routes, withPreloading(PreloadStrategy))`,\n * just like the directive.\n *\n * @returns A function accepting the same link descriptor shape as `mmLink` (`string`,\n * commands array, `UrlTree`, or `null`). Passing `null` or an unresolvable link is a no-op.\n *\n * @example\n * ```typescript\n * @Component({ ... })\n * export class CommandPaletteComponent {\n *   private readonly triggerPreload = injectTriggerPreload();\n *\n *   protected readonly highlighted = signal<string | null>(null);\n *\n *   constructor() {\n *     effect(() => {\n *       const target = this.highlighted();\n *       if (target) this.triggerPreload(target);\n *     });\n *   }\n * }\n * ```\n */\nexport function injectTriggerPreload() {\n  const req = inject(PreloadRequester);\n  const router = inject(Router);\n\n  return (\n    link: string | any[] | UrlTree | null,\n    relativeTo?: ActivatedRoute,\n    queryParams?: Params,\n    fragment?: string,\n    queryParamsHandling?: 'merge' | 'preserve' | '',\n    scope: 'all' | 'code' = 'all',\n  ) => {\n    const urlTree = inputToUrlTree(\n      router,\n      link,\n      relativeTo,\n      queryParams,\n      fragment,\n      queryParamsHandling,\n    );\n    const fullPath = treeToSerializedUrl(router, urlTree);\n    if (!fullPath) return;\n\n    req.startPreload(fullPath, scope);\n  };\n}\n\n/**\n * Configuration for the `mmLink` directive.\n *\n * @see provideMMLinkDefaultConfig\n */\nexport type MMLinkConfig = {\n  /**\n   * The default preload behavior for links.\n   * Can be 'hover', 'visible', or null (no preloading).\n   * @default 'hover'\n   */\n  preloadOn: 'hover' | 'visible' | null;\n  /**\n   * WHAT a preload warms (`preloadOn` is the WHEN): `'all'` warms the lazy code chunk AND\n   * the route's data (`createRouteData` factories, when `withRouteData()` is wired);\n   * `'code'` warms only the chunk — for links to routes whose data is expensive or\n   * shouldn't fire speculatively. Per-KEY opt-out belongs in the factory itself via\n   * `ctx.isPrefetch`.\n   * @default 'all'\n   */\n  preload: 'all' | 'code';\n  /**\n   * Whether to use mouse down events for preloading.\n   * @default false\n   */\n  useMouseDown: boolean;\n};\n\nconst configToken = new InjectionToken<MMLinkConfig>('MMSTACK_LINK_CONFIG');\n\n/**\n * Provide application-wide defaults for the `mmLink` directive. Each `[mmLink]`\n * instance can still override per-link via its own `preloadOn` / `useMouseDown`\n * inputs; this just shifts the default.\n *\n * @param config Partial override of `MMLinkConfig`. Unset keys fall back to:\n *   - `preloadOn: 'hover'` — preload triggered when the user hovers a link\n *   - `useMouseDown: false` — navigation triggered on click (not mousedown)\n * @returns A `Provider` to add to your app's providers array.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n *   providers: [\n *     provideMMLinkDefaultConfig({ preloadOn: 'visible', useMouseDown: true }),\n *   ],\n * });\n * ```\n */\nexport function provideMMLinkDefaultConfig(\n  config: Partial<MMLinkConfig>,\n): Provider {\n  const cfg: MMLinkConfig = {\n    preloadOn: 'hover',\n    preload: 'all',\n    useMouseDown: false,\n    ...config,\n  };\n\n  return {\n    provide: configToken,\n    useValue: cfg,\n  };\n}\n\nfunction injectConfig() {\n  const cfg = inject(configToken, { optional: true });\n  return {\n    preloadOn: 'hover' as const,\n    preload: 'all' as const,\n    useMouseDown: false,\n    ...cfg,\n  };\n}\n\n/**\n * Drop-in replacement for `[routerLink]` that adds preloading on hover or\n * visibility, optional mousedown-triggered navigation, and a `beforeNavigate`\n * hook. Composes with Angular's `RouterLink` via `hostDirectives`, so every\n * `RouterLink` input (`target`, `queryParams`, `fragment`, etc.) is forwarded.\n *\n * Preload behavior:\n * - `preloadOn: 'hover'` (default) — preload when the user hovers the link\n * - `preloadOn: 'visible'` — preload when the link scrolls into view\n * - `preloadOn: null` — disable preloading on this link\n *\n * Navigation timing:\n * - `useMouseDown: false` (default) — navigate on click\n * - `useMouseDown: true` — navigate on mousedown (shaves ~50ms but breaks if the user\n *   moves off the link before mouseup); the press's own click event is swallowed so\n *   the navigation runs exactly once\n *\n * `beforeNavigate` fires only for clicks that actually result in an SPA navigation —\n * modified/middle clicks and `target=\"_blank\"` links are left to the browser.\n *\n * Requires {@link PreloadStrategy} to be wired via `provideRouter(routes, withComponentInputBinding(), withPreloading(PreloadStrategy))`.\n * Set app-wide defaults with {@link provideMMLinkDefaultConfig}.\n *\n * @example\n * ```html\n * <a [mmLink]=\"['/users', userId()]\">View profile</a>\n *\n * <!-- Override per-link -->\n * <a [mmLink]=\"'/heavy-page'\" preloadOn=\"visible\" useMouseDown>Heavy page</a>\n *\n * <!-- React to the preload starting -->\n * <a [mmLink]=\"'/checkout'\" (preloading)=\"onPreload()\">Checkout</a>\n * ```\n */\n@Directive({\n  selector: '[mmLink]',\n  exportAs: 'mmLink',\n  host: {\n    '(mouseenter)': 'onHover()',\n  },\n  hostDirectives: [\n    {\n      directive: RouterLink,\n      // Full RouterLink input forwarding; parity enforced by link.parity.spec.ts.\n      inputs: [\n        'routerLink: mmLink',\n        'target',\n        'queryParams',\n        'fragment',\n        'queryParamsHandling',\n        'preserveFragment',\n        'state',\n        'info',\n        'relativeTo',\n        'skipLocationChange',\n        'replaceUrl',\n        'browserUrl',\n      ],\n    },\n  ],\n})\nexport class Link {\n  private readonly routerLink =\n    inject(RouterLink, {\n      self: true,\n      optional: true,\n    }) ?? inject(RouterLinkWithHref, { self: true, optional: true });\n\n  private readonly req = inject(PreloadRequester);\n  private readonly router = inject(Router);\n  private readonly el: HTMLElement = inject(ElementRef).nativeElement;\n  private readonly isAnchorElement = isAnchorLikeHost(this.el);\n\n  readonly target = input<string>();\n  readonly queryParams = input<Params>();\n  readonly fragment = input<string>();\n  readonly queryParamsHandling = input<'merge' | 'preserve' | ''>();\n  readonly state = input<object>();\n  readonly relativeTo = input<ActivatedRoute>();\n  readonly skipLocationChange = input(false, { transform: booleanAttribute });\n  readonly replaceUrl = input(false, { transform: booleanAttribute });\n  readonly mmLink = input<string | any[] | UrlTree | null>(null);\n  readonly preloadOn = input<'hover' | 'visible' | null>(\n    injectConfig().preloadOn,\n  );\n  readonly preload = input<'all' | 'code'>(injectConfig().preload);\n  readonly useMouseDown = input(injectConfig().useMouseDown, {\n    transform: booleanAttribute,\n  });\n  readonly beforeNavigate = input<() => void>();\n\n  readonly preloading = output<void>();\n\n  private readonly urlTree = computed(() => {\n    return inputToUrlTree(\n      this.router,\n      this.mmLink(),\n      this.relativeTo(),\n      this.queryParams(),\n      this.fragment(),\n      this.queryParamsHandling(),\n      this.routerLink?.urlTree,\n    );\n  });\n\n  private readonly fullPath = computed(() => {\n    return treeToSerializedUrl(this.router, this.urlTree());\n  });\n\n  private suppressNextClick = false;\n\n  onHover() {\n    if (untracked(this.preloadOn) !== 'hover') return;\n    this.requestPreload();\n  }\n\n  @HostListener('mousedown', ['$event'])\n  onMouseDown(event: MouseEvent) {\n    if (!untracked(this.useMouseDown)) return;\n    if (!this.isSpaNavigation(event)) return;\n\n    untracked(this.beforeNavigate)?.();\n    this.routerLink?.onClick(\n      event.button,\n      event.ctrlKey,\n      event.shiftKey,\n      event.altKey,\n      event.metaKey,\n    );\n\n    this.suppressNextClick = true;\n    document.addEventListener('click', () => (this.suppressNextClick = false), {\n      once: true,\n    });\n  }\n\n  constructor() {\n    const intersection = elementVisibility();\n\n    effect(() => {\n      if (this.preloadOn() !== 'visible') return;\n      if (intersection.visible()) this.requestPreload();\n    });\n\n    const el = this.el;\n    const onClickCapture = (event: MouseEvent) => {\n      if (this.suppressNextClick) {\n        this.suppressNextClick = false;\n        event.preventDefault();\n        event.stopImmediatePropagation();\n        return;\n      }\n\n      if (this.isSpaNavigation(event)) untracked(this.beforeNavigate)?.();\n    };\n    el.addEventListener('click', onClickCapture, { capture: true });\n    inject(DestroyRef).onDestroy(() =>\n      el.removeEventListener('click', onClickCapture, { capture: true }),\n    );\n  }\n\n  private requestPreload() {\n    const fp = untracked(this.fullPath);\n    if (!this.routerLink || !fp) return;\n    this.req.startPreload(fp, untracked(this.preload));\n    this.preloading.emit();\n  }\n\n  // Mirrors RouterLink.onClick: would this event trigger an SPA navigation?\n  private isSpaNavigation(event: MouseEvent): boolean {\n    if (!untracked(this.urlTree)) return false;\n\n    if (!this.isAnchorElement) return true;\n\n    if (\n      event.button !== 0 ||\n      event.ctrlKey ||\n      event.shiftKey ||\n      event.altKey ||\n      event.metaKey\n    )\n      return false;\n\n    const target = untracked(this.target);\n    return !(typeof target === 'string' && target !== '_self');\n  }\n}\n","import {\n  computed,\n  effect,\n  inject,\n  type Injector,\n  linkedSignal,\n  type Resource,\n  type ResourceRef,\n  type ResourceSnapshot,\n  type ResourceStatus,\n  runInInjectionContext,\n  type Signal,\n  untracked,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { EventType, NavigationCancellationCode, Router } from '@angular/router';\nimport { scan } from 'rxjs';\n\ntype Mode = 'live' | 'frozen' | 'settling';\n\ntype NavState<T> = {\n  readonly mode: Mode;\n  readonly seed: ResourceSnapshot<T>;\n  readonly nav: number;\n};\n\n/** The stabilized result: the read surface of a `Resource`, plus `reload()` delegated to the source. */\nexport type HeldResource<T> = Resource<T> & { reload(): boolean };\n\n// Synthesized rather than read off `resource.snapshot` so this file carries no dependency on the\n// Angular 22 `Resource.snapshot` member; the shape mirrors Angular's own snapshot computed.\nfunction liveSnapshot<T>(\n  resource: ResourceRef<T>,\n): Signal<ResourceSnapshot<T>> {\n  return computed(() => {\n    const status = resource.status();\n    if (status === 'error')\n      return { status, error: resource.error() as Error } as const;\n    return { status, value: resource.value() } as ResourceSnapshot<T>;\n  });\n}\n\nconst isLoadingStatus = (s: ResourceStatus): boolean =>\n  s === 'loading' || s === 'reloading';\n\n/**\n * Stabilizes a resource across navigation so its state can't flash through mid-transition:\n *\n * - **During a navigation** the whole snapshot (value/status/error/loading) is frozen at the\n *   pre-navigation state, so a refetch the navigation triggers shows no torn/loading state.\n * - **On success or skip** (`NavigationEnd`/`NavigationSkipped`) it reveals — settle-aware:\n *   the navigation's refetch usually starts just AFTER `NavigationEnd` (live params tick on it),\n *   so the last settled snapshot is held through that first load cycle and revealed when it\n *   lands. Once the cycle completes, loads pass through live again (a later `reload()`'s\n *   indicator shows normally) until the next navigation.\n * - **On a true rollback** (`NavigationError`, or a `NavigationCancel` that isn't a redirect /\n *   superseded-by-a-new-navigation) the same settle logic holds the pre-navigation snapshot\n *   until the cancelled load settles back — never revealing the would-be state of the route we\n *   didn't reach.\n * - **Redirect / superseded cancels** are left frozen: a new navigation is already taking over\n *   and will drive the next state (no spurious unfreeze between the two).\n *\n * The signal-level analogue of holding the previous view in {@link TransitionRouterOutlet}: use\n * it for a resource that *persists* across a navigation (a layout/shell resource, or a reused\n * route on a param change), where the outlet's view-hold doesn't apply.\n *\n * OBSERVATION CAVEAT (and the `eager` opt-out): the settle machine is pull-based — it\n * advances only when the held resource is READ. A consumer that goes unread through a\n * navigation (an unmounted view, a backgrounded pane) misses the load-cycle frames, so\n * the machine can't tell the cycle completed; a later manual `reload()` then gets held\n * (its indicator invisible) instead of passing through live. Pass `eager: true` to add\n * a tiny always-on watcher that keeps settledness tracked with zero readers — right for\n * shell/layout resources that are read intermittently.\n *\n * @example\n * ```ts\n * readonly user = holdThroughNavigation(\n *   queryResource<User>(() => `/api/users/${this.id()}`),\n * );\n * // user.value() never flashes to loading on param navigation, and rolls back if cancelled\n * ```\n */\nexport function holdThroughNavigation<T>(\n  resource: ResourceRef<T>,\n  options?: { injector?: Injector; eager?: boolean },\n): HeldResource<T> {\n  const run = <R>(fn: () => R): R =>\n    options?.injector ? runInInjectionContext(options.injector, fn) : fn();\n\n  return run(() => {\n    const router = inject(Router);\n    const live = liveSnapshot(resource);\n\n    const initial: NavState<T> = { mode: 'live', seed: untracked(live), nav: 0 };\n    const navState = toSignal(\n      router.events.pipe(\n        scan<unknown, NavState<T>>((state, e) => {\n          switch ((e as { type: EventType }).type) {\n            case EventType.NavigationStart:\n              return state.mode === 'frozen'\n                ? state\n                : { mode: 'frozen', seed: untracked(live), nav: state.nav + 1 };\n            case EventType.NavigationEnd:\n            case EventType.NavigationSkipped:\n            case EventType.NavigationError:\n              return { mode: 'settling', seed: state.seed, nav: state.nav };\n            case EventType.NavigationCancel: {\n              const code = (e as { code: NavigationCancellationCode }).code;\n              return code ===\n                NavigationCancellationCode.SupersededByNewNavigation ||\n                code === NavigationCancellationCode.Redirect\n                ? state // redirect/superseded: new navigation takes over, stay frozen\n                : { mode: 'settling', seed: state.seed, nav: state.nav };\n            }\n            default:\n              return state;\n          }\n        }, initial),\n      ),\n      { initialValue: initial },\n    );\n\n    // `done` = this navigation's load cycle completed; later loads then pass through live.\n    const stable = linkedSignal<\n      { ns: NavState<T>; live: ResourceSnapshot<T> },\n      { snap: ResourceSnapshot<T>; done: boolean }\n    >({\n      source: () => ({ ns: navState(), live: live() }),\n      computation: ({ ns, live: liveSnap }, prev) => {\n        const heldSnap = prev?.value.snap ?? ns.seed;\n        if (ns.mode === 'frozen') return { snap: heldSnap, done: false };\n        if (ns.mode === 'live') return { snap: liveSnap, done: false };\n\n        const sameSettle =\n          prev !== undefined &&\n          prev.source.ns.mode === 'settling' &&\n          prev.source.ns.nav === ns.nav;\n        if (sameSettle && prev.value.done) return { snap: liveSnap, done: true };\n        if (isLoadingStatus(liveSnap.status))\n          return { snap: heldSnap, done: false };\n        const completed =\n          sameSettle && isLoadingStatus(prev.source.live.status);\n        return { snap: liveSnap, done: completed };\n      },\n    });\n\n    if (options?.eager) effect(() => void stable());\n\n    return buildHeldResource(\n      computed(() => stable().snap),\n      resource,\n    );\n  });\n}\n\nfunction buildHeldResource<T>(\n  snapshot: Signal<ResourceSnapshot<T>>,\n  source: ResourceRef<T>,\n): HeldResource<T> {\n  const value = computed(() => {\n    const s = snapshot();\n    return s.status === 'error' ? (undefined as T) : s.value;\n  });\n\n  const hasValue = (() => {\n    const s = snapshot();\n    return s.status !== 'error' && s.value !== undefined;\n  }) as HeldResource<T>['hasValue'];\n\n  return {\n    value,\n    status: computed(() => snapshot().status),\n    error: computed(() => {\n      const s = snapshot();\n      return s.status === 'error' ? s.error : undefined;\n    }),\n    isLoading: computed(() => isLoadingStatus(snapshot().status)),\n    snapshot,\n    hasValue,\n    reload: () => source.reload(),\n  };\n}\n","import { inject, Injectable } from '@angular/core';\nimport {\n  NavigationCancel,\n  NavigationCancellationCode,\n  NavigationEnd,\n  NavigationError,\n  NavigationStart,\n  type Route,\n  Router,\n  type UrlTree,\n} from '@angular/router';\nimport { Subscription } from 'rxjs';\nimport {\n  findMarkedRoute,\n  replaceRouteAt,\n} from '../remount/lazy-route-internals';\n\nconst MOUNT_ID = Symbol('mmMountSwitch');\nconst MOUNT_FACTORY = Symbol('mmMountSwitchFactory');\n\n/** How a mount switch ended. */\nexport type MountSwitchResult =\n  /** The navigation onto the new mount reached `NavigationEnd`. */\n  | { outcome: 'committed' }\n  /** The navigation aborted; the previous mount is back in the config, cache intact. */\n  | { outcome: 'rolled-back'; reason: 'cancelled' | 'error' }\n  /** A newer switch took over the config before this one settled. */\n  | { outcome: 'superseded' };\n\n/** Controls the mount created by {@link mountSwitchRoute} with the same id. */\nexport interface MountController {\n  /**\n   * Swaps the mount and navigates onto it, resolving when the transaction settles. Use this\n   * from an effect, a click handler — anywhere outside the router's own recognition pass.\n   *\n   * @param opts.target Where to navigate. Defaults to re-entering the current URL.\n   */\n  switch(opts?: { target?: UrlTree }): Promise<MountSwitchResult>;\n  /**\n   * Swaps the mount synchronously and arms the rollback, returning the `UrlTree` navigation\n   * should re-enter with. For use *inside* recognition — return it from a `canMatch` guard, and\n   * the router's redirect hop lands on the new mount. The transaction then commits or rolls back\n   * on the router's own events.\n   */\n  beginSwitch(): UrlTree;\n  /**\n   * How the switch that is currently in flight ends — or, if none is, how the next one to begin\n   * does. Same result taxonomy either way, so a `beginSwitch()` caller can react to a rollback\n   * without subscribing to router events itself.\n   *\n   * @example\n   * ```ts\n   * const controller = injectMountController('preview');\n   *\n   * // In a canMatch guard: swap now, learn the outcome later.\n   * void controller.outcome().then((result) => {\n   *   if (result.outcome === 'rolled-back') this.selected.set(this.lastCommitted);\n   * });\n   * return controller.beginSwitch();\n   * ```\n   */\n  outcome(): Promise<MountSwitchResult>;\n}\n\n/**\n * Declares a route whose definition can be swapped at runtime — the mount point for a subtree\n * that is generated rather than written: a preview of a page the user is editing, a screen built\n * from a definition that just changed, an A/B variant.\n *\n * `factory` produces the route; it is called once for the initial mount and again for every\n * {@link MountController.switch}. Swapping is transactional: the new definition goes into the\n * config, navigation re-enters, and if that navigation aborts the exact previous `Route` object\n * goes back — lazy caches and all — as if nothing had been tried.\n *\n * @example\n * ```ts\n * export const routes: Routes = [\n *   mountSwitchRoute('preview', () => ({\n *     path: 'preview',\n *     children: buildRoutesFromDefinition(currentDefinition()),\n *   })),\n * ];\n *\n * // later, when the definition changes:\n * const { outcome } = await injectMountController('preview').switch();\n * ```\n */\nexport function mountSwitchRoute(id: string, factory: () => Route): Route {\n  return markMount(id, factory, factory());\n}\n\n/**\n * The {@link MountController} for the mount declared by {@link mountSwitchRoute}`(id, ...)`.\n * Shared per id — every injection sees the same controller, so the queue-of-one is global to the\n * mount rather than per caller.\n */\nexport function injectMountController(id: string): MountController {\n  return inject(MountSwitchRegistry).controller(id);\n}\n\nfunction markMount(id: string, factory: () => Route, route: Route): Route {\n  return {\n    ...route,\n    data: { ...route.data, [MOUNT_ID]: id, [MOUNT_FACTORY]: factory },\n  };\n}\n\n@Injectable({ providedIn: 'root' })\nclass MountSwitchRegistry {\n  private readonly router = inject(Router);\n  private readonly controllers = new Map<string, MountController>();\n\n  controller(id: string): MountController {\n    let controller = this.controllers.get(id);\n    if (!controller) {\n      controller = new MountSwitch(this.router, id);\n      this.controllers.set(id, controller);\n    }\n    return controller;\n  }\n}\n\ntype Transaction = {\n  /** The route to put back on rollback — always the last one that actually committed. */\n  readonly replaced: Route;\n  readonly promise: Promise<MountSwitchResult>;\n  readonly subscription: Subscription;\n  /** The navigation this transaction rides, claimed at the first `NavigationStart` it sees. */\n  navigationId: number | null;\n  resolve(result: MountSwitchResult): void;\n};\n\nclass MountSwitch implements MountController {\n  private pending: Transaction | null = null;\n  /** `outcome()` callers waiting for a transaction that has not begun yet. */\n  private readonly waiting: ((result: MountSwitchResult) => void)[] = [];\n\n  constructor(\n    private readonly router: Router,\n    private readonly id: string,\n  ) {}\n\n  switch(opts?: { target?: UrlTree }): Promise<MountSwitchResult> {\n    const promise = this.begin();\n    // The outcome rides the router's events; a navigation that throws is reported as\n    // `rolled-back` rather than as a rejection of this promise.\n    this.router\n      .navigateByUrl(opts?.target ?? this.router.parseUrl(this.router.url), {\n        onSameUrlNavigation: 'reload',\n      })\n      .catch(() => undefined);\n    return promise;\n  }\n\n  beginSwitch(): UrlTree {\n    void this.begin();\n    const nav = this.router.getCurrentNavigation();\n    return (\n      nav?.finalUrl ??\n      nav?.extractedUrl ??\n      this.router.parseUrl(this.router.url)\n    );\n  }\n\n  outcome(): Promise<MountSwitchResult> {\n    if (this.pending) return this.pending.promise;\n    return new Promise<MountSwitchResult>((resolve) =>\n      this.waiting.push(resolve),\n    );\n  }\n\n  /** Swaps the config and arms the rollback. Synchronous, so the config never interleaves. */\n  private begin(): Promise<MountSwitchResult> {\n    const location = findMarkedRoute(this.router.config, MOUNT_ID, this.id);\n    if (!location)\n      throw new Error(\n        `[mmstack/router-core] No mountSwitchRoute(\"${this.id}\") in the router config.`,\n      );\n\n    const factory = location.route.data?.[MOUNT_FACTORY] as\n      | (() => Route)\n      | undefined;\n    if (!factory)\n      throw new Error(\n        `[mmstack/router-core] The route marked mountSwitchRoute(\"${this.id}\") lost its factory — build it with mountSwitchRoute(), not by copying its data.`,\n      );\n\n    // The superseded transaction hands over its rollback point: rolling back must land on the\n    // mount that was last live, never on one that only ever existed mid-transaction.\n    const superseded = this.pending;\n    const replaced = superseded?.replaced ?? location.route;\n\n    replaceRouteAt(location, markMount(this.id, factory, factory()));\n    this.router.resetConfig(this.router.config);\n\n    if (superseded) this.settle(superseded, { outcome: 'superseded' });\n    return this.arm(replaced);\n  }\n\n  private arm(replaced: Route): Promise<MountSwitchResult> {\n    let resolve!: (result: MountSwitchResult) => void;\n    const promise = new Promise<MountSwitchResult>((r) => (resolve = r));\n\n    const subscription = new Subscription();\n    const transaction: Transaction = {\n      replaced,\n      promise,\n      subscription,\n      navigationId: null,\n      resolve,\n    };\n    this.pending = transaction;\n\n    const waiting = this.waiting.splice(0);\n    if (waiting.length)\n      void promise.then((result) => {\n        for (const resolveWaiting of waiting) resolveWaiting(result);\n      });\n\n    subscription.add(\n      this.router.events.subscribe((e) => {\n        if (this.pending !== transaction) return;\n\n        // The navigation this swap triggers is the next one to start; until it does, events\n        // belong to the navigation we interrupted and say nothing about this transaction.\n        if (e instanceof NavigationStart) {\n          transaction.navigationId ??= e.id;\n          return;\n        }\n        if (\n          !(\n            e instanceof NavigationEnd ||\n            e instanceof NavigationError ||\n            e instanceof NavigationCancel\n          ) ||\n          e.id !== transaction.navigationId\n        )\n          return;\n\n        if (e instanceof NavigationEnd)\n          this.settle(transaction, { outcome: 'committed' });\n        else if (e instanceof NavigationError)\n          this.rollback(transaction, 'error');\n        else if (e.code === NavigationCancellationCode.Redirect)\n          // Our own re-entry hop: the transaction rides the navigation that replaces it.\n          transaction.navigationId = null;\n        else this.rollback(transaction, 'cancelled');\n      }),\n    );\n\n    return promise;\n  }\n\n  private rollback(\n    transaction: Transaction,\n    reason: 'cancelled' | 'error',\n  ): void {\n    const location = findMarkedRoute(this.router.config, MOUNT_ID, this.id);\n    if (location) {\n      replaceRouteAt(location, transaction.replaced);\n      this.router.resetConfig(this.router.config);\n    }\n    this.settle(transaction, { outcome: 'rolled-back', reason });\n  }\n\n  private settle(transaction: Transaction, result: MountSwitchResult): void {\n    transaction.subscription.unsubscribe();\n    if (this.pending === transaction) this.pending = null;\n    transaction.resolve(result);\n  }\n}\n","import { computed, isSignal, type Signal } from '@angular/core';\nimport {\n  type ActivatedRouteSnapshot,\n  createUrlTreeFromSnapshot,\n  type IsActiveMatchOptions,\n  type Router,\n  UrlTree,\n} from '@angular/router';\n\n/**\n * Description of a single navigation item.\n *\n * Reactive fields accept either a static value or a zero-arg function — the function\n * form is wrapped in a `computed` so reading signals inside it produces a reactive value.\n *\n * @typeParam TMeta Arbitrary consumer-defined metadata round-tripped to {@link NavItem.meta}.\n *\n * @see createNavItems\n * @see NavItem\n */\nexport type CreateNavItem<TMeta = Record<string, unknown>> = {\n  /** Visible text. */\n  label: string | (() => string);\n  /**\n   * The navigation target. Resolved relative to the route the resolver is attached to —\n   * the same convention as Angular's `routerLink`:\n   *\n   * - `'a'` / `'a/b'` / `['a', 'b']` — relative segments, resolve to `${mount}/a` etc.\n   * - `'/foo'` / `['/foo', 'bar']` — absolute, leading-slash escape hatch.\n   * - A pre-built `UrlTree` is passed through unchanged.\n   *\n   * Omit (or return `null`) for a pure grouping header — `active` will then fall through\n   * to the children-active check.\n   */\n  link?: string | any[] | (() => string | any[] | null) | null;\n  /** Accessible label. Defaults to `label`. */\n  ariaLabel?: string | (() => string);\n  /** When true, the item is rendered but non-interactive. Cascades to descendants. */\n  disabled?: boolean | (() => boolean);\n  /** When true, the item (and its subtree) is filtered out of the consumer-facing array. */\n  hidden?: boolean | (() => boolean);\n  /** Arbitrary metadata round-tripped on the resulting `NavItem`. */\n  meta?: TMeta | (() => TMeta);\n  /**\n   * Override the match options used to compute `active`. Merged on top of the global default\n   * from `provideNavConfig`, which is in turn merged on top of `@angular/router`'s\n   * `subsetMatchOptions` defaults.\n   *\n   * Setting this also implicitly disables the default child-active OR — see\n   * {@link matchesWhenChildActive} to opt back in.\n   */\n  activeMatch?: Partial<IsActiveMatchOptions>;\n  /**\n   * Controls whether `active` ORs with descendant `active`.\n   *\n   * Default: `true` when `activeMatch` is omitted, `false` when `activeMatch` is set.\n   * Explicit values override the default.\n   */\n  matchesWhenChildActive?: boolean;\n  /** Optional stable id. Defaults to the serialized link when present. */\n  id?: string | (() => string);\n  /** Nested items. */\n  children?: CreateNavItem<TMeta>[];\n};\n\n/**\n * A navigation item exposed by `injectNavItems`. All fields are signals so consumers can\n * read reactively without caring whether the source was static or signal-derived.\n *\n * @typeParam TMeta Same as the corresponding {@link CreateNavItem}.\n */\nexport type NavItem<TMeta = Record<string, unknown>> = {\n  id: Signal<string>;\n  label: Signal<string>;\n  ariaLabel: Signal<string>;\n  /** Serialized URL, or `null` for pure grouping items with no link. */\n  link: Signal<string | null>;\n  active: Signal<boolean>;\n  disabled: Signal<boolean>;\n  meta: Signal<TMeta>;\n  /** Children that survive the hidden filter. */\n  children: Signal<NavItem<TMeta>[]>;\n};\n\n/** @internal */\nexport type InternalNavItem<TMeta = Record<string, unknown>> =\n  NavItem<TMeta> & {\n    hidden: Signal<boolean>;\n  };\n\n/** @internal */\nexport const NEVER_TRUE: Signal<boolean> = computed(() => false);\n\nfunction wrap<T>(): Signal<T | undefined>;\nfunction wrap<T>(value: T | (() => T)): Signal<T>;\nfunction wrap<T>(\n  value: T | (() => T) | undefined,\n  fallback: Signal<T>,\n): Signal<T>;\n\nfunction wrap<T>(\n  value?: T | (() => T) | undefined,\n  fallback?: Signal<T>,\n): Signal<T | undefined> {\n  if (value === undefined)\n    return fallback ? fallback : computed(() => undefined);\n  if (typeof value === 'function')\n    return isSignal(value) ? (value as Signal<T>) : computed(value as () => T);\n  return computed(() => value);\n}\n\nfunction isAbsoluteCommandArray(commands: readonly unknown[]): boolean {\n  return (\n    commands.length > 0 &&\n    typeof commands[0] === 'string' &&\n    (commands[0] as string).startsWith('/')\n  );\n}\n\nfunction resolveLinkTree(\n  input: CreateNavItem['link'],\n  router: Router,\n  relativeTo: ActivatedRouteSnapshot,\n): UrlTree | null {\n  const raw = typeof input === 'function' ? input() : input;\n  if (raw === undefined || raw === null) return null;\n  if (raw instanceof UrlTree) return raw;\n\n  if (typeof raw === 'string') {\n    if (raw.startsWith('/')) return router.parseUrl(raw);\n    const parsed = router.parseUrl('/' + raw);\n    const primary = parsed.root.children['primary'];\n    const segments = primary ? primary.segments.map((s) => s.path) : [];\n    return createUrlTreeFromSnapshot(\n      relativeTo,\n      segments,\n      parsed.queryParams,\n      parsed.fragment,\n    );\n  }\n\n  if (isAbsoluteCommandArray(raw)) return router.createUrlTree(raw);\n  return createUrlTreeFromSnapshot(relativeTo, raw);\n}\n\nfunction resolveMeta<TMeta>(input: CreateNavItem<TMeta>['meta']): TMeta {\n  if (input === undefined) return {} as TMeta;\n  return typeof input === 'function' ? (input as () => TMeta)() : input;\n}\n\n/** @internal */\nexport function createInternalNavItem<TMeta = Record<string, unknown>>(\n  input: CreateNavItem<TMeta>,\n  router: Router,\n  relativeTo: ActivatedRouteSnapshot,\n  configActiveMatch: Partial<IsActiveMatchOptions> | undefined,\n  parentDisabled: Signal<boolean>,\n  parentHidden: Signal<boolean>,\n  fallbackId: string,\n  trackNavigation: Signal<unknown>,\n): InternalNavItem<TMeta> {\n  const label = wrap(input.label);\n  const ariaLabel = input.ariaLabel ? wrap(input.ariaLabel) : label;\n\n  const linkTree = computed(() =>\n    resolveLinkTree(input.link, router, relativeTo),\n  );\n  const link: Signal<string | null> = computed(() => {\n    const tree = linkTree();\n    return tree ? router.serializeUrl(tree) : null;\n  });\n\n  const ownDisabled = wrap(input.disabled, NEVER_TRUE);\n  const ownHidden = wrap(input.hidden, NEVER_TRUE);\n\n  const disabled = computed(() => parentDisabled() || ownDisabled());\n  const hidden = computed(() => parentHidden() || ownHidden());\n\n  const metaInput = input.meta;\n  const meta: Signal<TMeta> = computed(() => resolveMeta<TMeta>(metaInput));\n\n  const id: Signal<string> =\n    input.id !== undefined\n      ? wrap(input.id)\n      : computed(() => link() ?? fallbackId);\n\n  const childItems: InternalNavItem<TMeta>[] = (input.children ?? []).map(\n    (childInput, i) =>\n      createInternalNavItem<TMeta>(\n        childInput,\n        router,\n        relativeTo,\n        configActiveMatch,\n        disabled,\n        hidden,\n        `${fallbackId}.${i}`,\n        trackNavigation,\n      ),\n  );\n\n  const children: Signal<NavItem<TMeta>[]> = computed(() =>\n    childItems.filter((c) => !c.hidden()),\n  );\n\n  const mergedActiveMatch: Partial<IsActiveMatchOptions> = {\n    ...configActiveMatch,\n    ...input.activeMatch,\n  };\n\n  const finalOptions: IsActiveMatchOptions = {\n    paths: 'subset',\n    fragment: 'ignored',\n    matrixParams: 'ignored',\n    queryParams: 'subset',\n    ...mergedActiveMatch,\n  };\n\n  const ownActive = computed(() => {\n    trackNavigation();\n    const tree = linkTree();\n    return tree ? router.isActive(tree, finalOptions) : false;\n  });\n\n  const orWithChildren =\n    input.matchesWhenChildActive ?? input.activeMatch === undefined;\n\n  const active = computed(\n    () =>\n      ownActive() ||\n      (orWithChildren &&\n        !!childItems.length &&\n        childItems.some((c) => c.active())),\n  );\n\n  return {\n    id,\n    label,\n    ariaLabel,\n    link,\n    active,\n    disabled,\n    hidden,\n    meta,\n    children,\n  };\n}\n","import { inject, InjectionToken, type Provider } from '@angular/core';\nimport { type IsActiveMatchOptions } from '@angular/router';\nimport { type CreateNavItem } from './nav';\n\n/**\n * Per-scope fallback descriptor: a static array or a factory returning one.\n */\nexport type NavDefaultsForScope<TMeta = Record<string, unknown>> =\n  | CreateNavItem<TMeta>[]\n  | (() => CreateNavItem<TMeta>[]);\n\n/**\n * Global configuration for the nav system.\n * @see provideNavConfig\n */\nexport type NavConfig<TMeta = Record<string, unknown>> = {\n  /**\n   * Default match options used when computing `NavItem.active`. Per-item `activeMatch`\n   * (and the router's built-in `subsetMatchOptions`) are still merged on top.\n   */\n  activeMatch?: Partial<IsActiveMatchOptions>;\n  /**\n   * Fallback nav items rendered when no route in the active chain has registered items\n   * for the requested scope. Relative `link`s resolve from `/`.\n   *\n   * Forms:\n   * - Array (or factory): fallback for the default (unnamed) scope.\n   * - Record: keys match the `name` passed to `createNavItems`. The unnamed scope can\n   *   also be provided via this record using the empty-string key `''`.\n   *\n   * A route that wants to render an *empty* nav explicitly should register\n   * `createNavItems([])`, which shadows these defaults via the normal deepest-wins rule.\n   */\n  defaults?:\n    | NavDefaultsForScope<TMeta>\n    | Record<string, NavDefaultsForScope<TMeta>>;\n};\n\n/** @internal */\nconst token = new InjectionToken<NavConfig>('@mmstack/router-core:nav-config');\n\n/**\n * Provides global configuration for the nav system. The factory form runs in\n * an injection context, so it can use `inject()` to build defaults from app\n * state.\n *\n * @param config Either a literal {@link NavConfig} object or a factory\n *   `() => NavConfig`. Optional — without it, the nav system uses Angular's\n *   default `activeMatch` options and renders nothing in scopes that have no\n *   registered items.\n * @returns A `Provider` to add to your app's providers array.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n *   providers: [\n *     provideRouter(routes),\n *     provideNavConfig({\n *       activeMatch: { queryParams: 'ignored' },\n *       defaults: [\n *         { label: 'Home', link: '/' },\n *         { label: 'Docs', link: '/docs' },\n *       ],\n *     }),\n *   ],\n * });\n * ```\n *\n * @example\n * ```ts\n * // Factory form — read defaults from a service\n * provideNavConfig(() => {\n *   const role = inject(AuthStore).role();\n *   return {\n *     defaults: {\n *       main: role === 'admin' ? adminNav : guestNav,\n *     },\n *   };\n * });\n * ```\n */\nexport function provideNavConfig(\n  config?: NavConfig | (() => NavConfig),\n): Provider {\n  const fn = typeof config === 'function' ? config : () => ({ ...config });\n  return {\n    provide: token,\n    useFactory: fn,\n  };\n}\n\n/** @internal */\nexport function injectNavConfig(): NavConfig {\n  return inject(token, { optional: true }) ?? {};\n}\n","import {\n  computed,\n  EnvironmentInjector,\n  inject,\n  Injectable,\n  runInInjectionContext,\n  type Signal,\n  untracked,\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport { mutable } from '@mmstack/primitives';\nimport { navigationEndTick } from '../url';\nimport { injectLeafRoutes } from '../util';\nimport {\n  createInternalNavItem,\n  type CreateNavItem,\n  type InternalNavItem,\n  type NavItem,\n  NEVER_TRUE,\n} from './nav';\nimport { injectNavConfig, type NavDefaultsForScope } from './nav-config';\n\n/** @internal */\nexport const DEFAULT_NAV_SCOPE: unique symbol = Symbol('mmstack.nav.default');\n\ntype ScopeName = string | typeof DEFAULT_NAV_SCOPE;\n\ntype AnyInternalNavItem = InternalNavItem<unknown>;\n\n@Injectable({ providedIn: 'root' })\nexport class NavStore {\n  private readonly map = mutable<\n    Map<ScopeName, Map<string, AnyInternalNavItem[]>>\n  >(new Map());\n\n  private readonly leafRoutes = injectLeafRoutes();\n  private readonly router = inject(Router);\n  private readonly config = injectNavConfig();\n  private readonly injector = inject(EnvironmentInjector);\n  /** @internal Shared navigation signal for every item's `active` computation. */\n  readonly trackNavigation = navigationEndTick(this.router);\n  private readonly defaultsCache = new Map<\n    ScopeName,\n    AnyInternalNavItem[] | null\n  >();\n\n  /** @internal */\n  register(\n    scope: ScopeName,\n    routePath: string,\n    items: AnyInternalNavItem[],\n  ): void {\n    this.map.inline((m) => {\n      let scopeMap = m.get(scope);\n      if (!scopeMap) {\n        scopeMap = new Map();\n        m.set(scope, scopeMap);\n      }\n      scopeMap.set(routePath, items);\n    });\n  }\n\n  /** @internal */\n  scope<TMeta = Record<string, unknown>>(\n    name: ScopeName,\n  ): Signal<NavItem<TMeta>[]> {\n    return computed(() => {\n      const scopeMap = this.map().get(name);\n      if (scopeMap) {\n        const leaves = this.leafRoutes();\n        for (let i = leaves.length - 1; i >= 0; i--) {\n          const items = scopeMap.get(leaves[i].path);\n          if (items) {\n            return items.filter((it) => !it.hidden()) as NavItem<TMeta>[];\n          }\n        }\n      }\n\n      const defaults = this.getDefaultItems(name);\n      if (defaults) {\n        return defaults.filter((it) => !it.hidden()) as NavItem<TMeta>[];\n      }\n      return [];\n    });\n  }\n\n  private getDefaultItems(scope: ScopeName): AnyInternalNavItem[] | null {\n    const cached = this.defaultsCache.get(scope);\n    if (cached !== undefined) return cached;\n\n    const built = this.buildDefaultItems(scope);\n    this.defaultsCache.set(scope, built);\n    return built;\n  }\n\n  private buildDefaultItems(scope: ScopeName): AnyInternalNavItem[] | null {\n    const defaults = this.config.defaults;\n    if (!defaults) return null;\n\n    let entry: NavDefaultsForScope | undefined;\n    if (Array.isArray(defaults) || typeof defaults === 'function') {\n      if (scope === DEFAULT_NAV_SCOPE) entry = defaults;\n    } else {\n      const key = scope === DEFAULT_NAV_SCOPE ? '' : scope;\n      entry = (defaults as Record<string, NavDefaultsForScope>)[key];\n    }\n    if (!entry) return null;\n    const resolved = entry;\n\n    return untracked(() =>\n      runInInjectionContext(this.injector, () => {\n        const inputs =\n          typeof resolved === 'function' ? resolved() : resolved;\n        const rootSnapshot = this.router.routerState.snapshot.root;\n        const prefix =\n          scope === DEFAULT_NAV_SCOPE\n            ? '__defaults__'\n            : `__defaults__:${scope}`;\n        return inputs.map((input: CreateNavItem, i) =>\n          createInternalNavItem(\n            input,\n            this.router,\n            rootSnapshot,\n            this.config.activeMatch,\n            NEVER_TRUE,\n            NEVER_TRUE,\n            `${prefix}#${i}`,\n            this.trackNavigation,\n          ),\n        ) as AnyInternalNavItem[];\n      }),\n    );\n  }\n}\n\n/**\n * Returns a reactive list of nav items for the requested scope.\n *\n * The returned signal reflects the nearest active ancestor route that registered items\n * for `name` via `createNavItems`. If no active route has registered items for the\n * scope, falls back to `NavConfig.defaults` (when provided via `provideNavConfig`).\n * Hidden items are filtered out.\n *\n * @typeParam TMeta The shape of `NavItem.meta` for the consuming code. Untyped at the\n * registration site — this is a consumer-side assertion.\n *\n * @example\n * ```typescript\n * @Component({\n *   template: `\n *     @for (item of items(); track item) {\n *       <a [href]=\"item.link()\" [class.active]=\"item.active()\">{{ item.label() }}</a>\n *     }\n *   `,\n * })\n * export class TopBar {\n *   protected readonly items = injectNavItems();\n * }\n * ```\n */\nexport function injectNavItems<TMeta = Record<string, unknown>>(\n  name?: string,\n): Signal<NavItem<TMeta>[]> {\n  const store = inject(NavStore);\n  return store.scope<TMeta>(name ?? DEFAULT_NAV_SCOPE);\n}\n","import { inject } from '@angular/core';\nimport { type ResolveFn, Router } from '@angular/router';\nimport { injectSnapshotPathResolver } from '../util';\nimport {\n  createInternalNavItem,\n  type CreateNavItem,\n  type InternalNavItem,\n  NEVER_TRUE,\n} from './nav';\nimport { injectNavConfig } from './nav-config';\nimport { DEFAULT_NAV_SCOPE, NavStore } from './nav-store';\n\n/**\n * Registers a set of nav items for the activating route under the given scope.\n * Mirrors {@link createBreadcrumb} / {@link createTitle} — designed to be used\n * in a route's `resolve` map.\n *\n * Scope override semantics: when multiple routes in the active chain register\n * items under the same scope, the deepest active registration wins. Navigating\n * away restores the shallower registration. To explicitly render an empty nav\n * (shadowing a default), pass `[]`.\n *\n * @typeParam TMeta Optional per-item metadata type — flows through the\n *   registered items so consumers reading via {@link injectNavItems} get\n *   typed access to `item.meta`.\n * @param itemsOrFactory Either a static array of {@link CreateNavItem} or a\n *   factory `() => CreateNavItem<TMeta>[]` invoked inside an injection\n *   context (so it can use `inject()` for dynamic items).\n * @param options Optional `{ name }` for registering multiple scopes on a\n *   single route. Omit to target the default (unnamed) scope.\n * @returns An Angular `ResolveFn<void>` to wire into a route's `resolve` map.\n *   The resolver registers items as a side effect; the resolved value itself\n *   is unused.\n *\n * @example\n * ```ts\n * // Single default-scope nav\n * {\n *   path: 'app',\n *   resolve: {\n *     _nav: createNavItems([\n *       { label: 'Dashboard', link: 'dashboard' },\n *       { label: 'Reports', link: 'reports' },\n *     ]),\n *   },\n * }\n *\n * // Multiple scopes\n * {\n *   path: 'app',\n *   resolve: {\n *     mainNav: createNavItems([...], { name: 'main' }),\n *     sideNav: createNavItems([...], { name: 'side' }),\n *   },\n * }\n *\n * // Factory using inject()\n * createNavItems(() => {\n *   const auth = inject(AuthStore);\n *   return auth.canAdmin() ? adminItems : userItems;\n * });\n * ```\n */\nexport function createNavItems<TMeta = Record<string, unknown>>(\n  itemsOrFactory:\n    | CreateNavItem<TMeta>[]\n    | (() => CreateNavItem<TMeta>[]),\n  options?: { name?: string },\n): ResolveFn<void> {\n  const factory =\n    typeof itemsOrFactory === 'function'\n      ? itemsOrFactory\n      : () => itemsOrFactory;\n\n  return async (route) => {\n    const router = inject(Router);\n    const store = inject(NavStore);\n    const resolveRoutePath = injectSnapshotPathResolver();\n    const config = injectNavConfig();\n\n    const routePath = resolveRoutePath(route);\n    const scope = options?.name ?? DEFAULT_NAV_SCOPE;\n\n    const items = factory().map((input, i) =>\n      createInternalNavItem<TMeta>(\n        input,\n        router,\n        route,\n        config.activeMatch,\n        NEVER_TRUE,\n        NEVER_TRUE,\n        `${routePath}#${i}`,\n        store.trackNavigation,\n      ),\n    );\n\n    store.register(scope, routePath, items as InternalNavItem<unknown>[]);\n\n    return Promise.resolve();\n  };\n}\n","import {\n  computed,\n  DestroyRef,\n  inject,\n  isSignal,\n  untracked,\n  type WritableSignal,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { toWritable } from '@mmstack/primitives';\n\n/**\n * Options for {@link queryParam}.\n */\nexport type QueryParamOptions<T = string> = {\n  /**\n   * Parse the raw URL value into `T`. Provide together with `serialize` for\n   * non-string params (numbers, dates, JSON, ...).\n   */\n  parse?: (value: string) => T | null;\n  /**\n   * Serialize `T` into the URL value. Return `null` to remove the param.\n   */\n  serialize?: (value: T) => string | null;\n  /**\n   * Navigate with `replaceUrl` so writes don't create history entries — the right\n   * choice for high-frequency params (search inputs, scroll state).\n   * @default false\n   */\n  replaceUrl?: boolean;\n  /**\n   * Debounce URL writes by this many milliseconds (reads stay live). Combines well\n   * with `replaceUrl` for type-ahead params.\n   */\n  debounce?: number;\n  /**\n   * Coalesce writes made in the same microtask into ONE navigation. Off by default:\n   * each `set()` navigates immediately (synchronously calling `Router.navigate`).\n   *\n   * Turn this on when several params are written together in one synchronous block\n   * (e.g. resetting a filter set) — otherwise each write rebuilds its `UrlTree` from\n   * the pre-navigation URL and only the last one survives. With `batch: true` the\n   * patches merge and flush once on a microtask; the resulting navigation keeps a\n   * history entry unless every batched writer also set `replaceUrl`.\n   * @default false\n   */\n  batch?: boolean;\n  /**\n   * The route to bind against.\n   * @default inject(ActivatedRoute)\n   */\n  route?: ActivatedRoute;\n};\n\n/** {@link QueryParamOptions} with the parser pair required — enables non-string `T`. */\nexport type TypedQueryParamOptions<T> = QueryParamOptions<T> & {\n  parse: (value: string) => T | null;\n  serialize: (value: T) => string | null;\n};\n\nfunction writeParamNow(\n  router: Router,\n  route: ActivatedRoute,\n  key: string,\n  value: string | null,\n  replaceUrl: boolean,\n): void {\n  void router.navigate([], {\n    relativeTo: route,\n    queryParams: { [key]: value },\n    queryParamsHandling: 'merge',\n    replaceUrl,\n  });\n}\n\ntype PendingFlush = {\n  patch: Record<string, string | null>;\n  replaceAll: boolean;\n  route: ActivatedRoute;\n  scheduled: boolean;\n};\n\nconst pendingByRouter = new WeakMap<Router, PendingFlush>();\n\nfunction enqueueParamWrite(\n  router: Router,\n  route: ActivatedRoute,\n  key: string,\n  value: string | null,\n  replaceUrl: boolean,\n): void {\n  let pending = pendingByRouter.get(router);\n  if (!pending) {\n    pending = { patch: {}, replaceAll: true, route, scheduled: false };\n    pendingByRouter.set(router, pending);\n  }\n\n  pending.patch[key] = value;\n  // skip history only when every writer in the batch asked to\n  pending.replaceAll &&= replaceUrl;\n\n  if (pending.scheduled) return;\n  pending.scheduled = true;\n\n  const flush = pending;\n  queueMicrotask(() => {\n    pendingByRouter.delete(router);\n    void router.navigate([], {\n      relativeTo: flush.route,\n      queryParams: flush.patch,\n      queryParamsHandling: 'merge',\n      replaceUrl: flush.replaceAll,\n    });\n  });\n}\n\n/**\n * Creates a WritableSignal that synchronizes with a specific URL query parameter,\n * enabling two-way binding between the signal's state and the URL.\n *\n * Reading the signal provides the current value of the query parameter (or null if absent).\n * Setting the signal updates the URL query parameter using `Router.navigate`, triggering\n * navigation and causing the signal to update reactively if the navigation is successful.\n *\n * @param key The key of the query parameter to synchronize with.\n * Can be a static string (e.g., `'search'`) or a function/signal returning a string\n * for dynamic keys. The signal reactively follows key changes.\n * @param routeOrOpt The `ActivatedRoute` to bind against (legacy positional form), or a\n * {@link QueryParamOptions} object — `parse`/`serialize` for typed params, `replaceUrl`,\n * `debounce`, and `route`.\n * @returns A writable signal for the param's value.\n * - Reading returns the current (parsed) value, or `null` if absent.\n * - Setting a value updates the URL (`signal.set('value')` → `?key=value`).\n * - Setting `null` REMOVES the parameter from the URL.\n * - Each `set()` navigates immediately; pass `batch: true` to coalesce same-tick\n *   writes into one navigation.\n *\n * @remarks\n * - Requires Angular's `ActivatedRoute` and `Router` in the injection context.\n * - Uses `Router.navigate` with `queryParamsHandling: 'merge'`, preserving unrelated params.\n * - During SSR it reads from the route snapshot; writes are inert on the server.\n *\n * @example\n * ```ts\n * // string param\n * readonly sort = queryParam('sort');\n * // typed param, no history spam while typing\n * readonly page = queryParam<number>('page', {\n *   parse: (v) => {\n *     const n = parseInt(v, 10);\n *     return Number.isFinite(n) ? n : null;\n *   },\n *   serialize: (n) => (n <= 1 ? null : String(n)), // page 1 keeps the URL clean\n *   replaceUrl: true,\n * });\n * // debounced search input\n * readonly q = queryParam('q', { replaceUrl: true, debounce: 300 });\n * ```\n */\nexport function queryParam(\n  key: string | (() => string),\n  routeOrOpt?: ActivatedRoute | QueryParamOptions<string>,\n): WritableSignal<string | null>;\nexport function queryParam<T>(\n  key: string | (() => string),\n  opt: TypedQueryParamOptions<T>,\n): WritableSignal<T | null>;\n\nexport function queryParam<T = string>(\n  key: string | (() => string),\n  routeOrOpt?: ActivatedRoute | QueryParamOptions<T>,\n): WritableSignal<T | null> {\n  const opt =\n    routeOrOpt instanceof ActivatedRoute\n      ? ({ route: routeOrOpt } as QueryParamOptions<T>)\n      : (routeOrOpt ?? {});\n\n  const route = opt.route ?? inject(ActivatedRoute);\n  const router = inject(Router);\n  const destroyRef = inject(DestroyRef);\n\n  const parse = opt.parse ?? ((value: string) => value as unknown as T);\n  const serialize =\n    opt.serialize ?? ((value: T) => value as unknown as string);\n  const replaceUrl = opt.replaceUrl ?? false;\n  const debounce = opt.debounce ?? 0;\n  const batch = opt.batch ?? false;\n\n  const keySignal =\n    typeof key === 'string'\n      ? computed(() => key)\n      : isSignal(key)\n        ? key\n        : computed(key);\n\n  const queryParamMap = toSignal(route.queryParamMap, {\n    initialValue: route.snapshot.queryParamMap,\n  });\n\n  const queryParam = computed<T | null>(() => {\n    const raw = queryParamMap().get(keySignal());\n    return raw === null ? null : parse(raw);\n  });\n\n  const writeToUrl = (newValue: T | null) => {\n    const serialized = newValue === null ? null : serialize(newValue);\n    const key = untracked(keySignal);\n    if (batch) enqueueParamWrite(router, route, key, serialized, replaceUrl);\n    else writeParamNow(router, route, key, serialized, replaceUrl);\n  };\n\n  let debounceTimer: ReturnType<typeof setTimeout> | undefined;\n  destroyRef.onDestroy(() => clearTimeout(debounceTimer));\n\n  const set = (newValue: T | null) => {\n    if (!debounce) return writeToUrl(newValue);\n    clearTimeout(debounceTimer);\n    debounceTimer = setTimeout(() => writeToUrl(newValue), debounce);\n  };\n\n  return toWritable(queryParam, set);\n}\n","import {\n  effect,\n  type EffectRef,\n  inject,\n  Injectable,\n  Injector,\n  signal,\n  untracked,\n  type Signal,\n} from '@angular/core';\nimport {\n  NavigationCancel,\n  NavigationEnd,\n  NavigationError,\n  NavigationSkipped,\n  type Route,\n  Router,\n} from '@angular/router';\nimport { defaultIfEmpty, filter, firstValueFrom, take } from 'rxjs';\nimport { PreloadStrategy } from '../preloading/preload-strategy';\nimport { findPath } from '../util/find-path';\nimport { VisualCommitCoordinator } from '../visual-commit';\nimport {\n  destroyLazyInjectors,\n  findMarkedRoute,\n  hasLazyState,\n  replaceRouteAt,\n  withoutLazyState,\n} from './lazy-route-internals';\n\nconst REMOUNT_MARKER = Symbol('mmRemountable');\n\n/** What an {@link RemountHandle.invalidate} call ended up doing. */\nexport type RemountResult =\n  /** The cached subtree was dropped and (unless `navigation: 'none'`) the URL was re-entered. */\n  | { outcome: 'remounted' }\n  /** The marked route had nothing cached, so there was nothing to drop. */\n  | { outcome: 'no-op' }\n  /** A navigation was in flight and `inFlight: 'reject'` was asked for. */\n  | { outcome: 'rejected' };\n\n/** Options for {@link RemountHandle.invalidate}. */\nexport type RemountOptions = {\n  /**\n   * `'reload-current'` (default) re-enters the current URL after dropping the cache, so the\n   * subtree loads again immediately. `'none'` only drops the cache — the next navigation into\n   * the subtree picks up the fresh load.\n   */\n  navigation?: 'none' | 'reload-current';\n  /**\n   * What to do when *any* navigation is already in flight. Deliberately conservative: relevance\n   * to the marked subtree is not computed, because a navigation mid-recognition can still turn\n   * out to touch it.\n   *\n   * - `'wait'` (default) — run once the in-flight navigation settles. Invalidations that queue\n   *   up meanwhile coalesce into a single run.\n   * - `'cancel-and-retry'` — abort the in-flight navigation, then run.\n   * - `'reject'` — do nothing and resolve `{ outcome: 'rejected' }`.\n   */\n  inFlight?: 'wait' | 'cancel-and-retry' | 'reject';\n};\n\n/** Controls one `remountable` subtree. Shared per id — every injection sees the same handle. */\nexport interface RemountHandle {\n  /** Bumps on every successful invalidation; loads/preloads verify ownership against it. */\n  readonly generation: Signal<number>;\n  invalidate(options?: RemountOptions): Promise<RemountResult>;\n}\n\n/**\n * Marks a lazy route as remountable, so {@link injectRemountHandle} can find and invalidate it.\n * Spread the result into the route's `data`.\n *\n * The id is the lookup key, not the `Route` object: `Router.resetConfig` shallow-copies every\n * route it standardizes, so route identity goes stale while the marker survives.\n *\n * @example\n * ```ts\n * {\n *   path: 'reports',\n *   loadChildren: () => import('./reports/routes'),\n *   data: { ...remountable('reports') },\n * }\n * ```\n */\nexport function remountable(id: string): Route['data'] {\n  return { [REMOUNT_MARKER]: id };\n}\n\n/**\n * Handle for the subtree marked with {@link remountable}`(id)`. Call `invalidate()` to throw the\n * loaded subtree away and load it again — for a lazy feature whose route config is generated\n * from data that just changed, or any case where \"re-run `loadChildren`\" is the intent.\n *\n * Invalidation drops the router's cached children, injector, factory and component for the route\n * and orphans the `Route` object it cached them on, so a load or preload that was already in\n * flight lands on the discarded object and can never repopulate the live config. The orphaned\n * subtree's injectors are destroyed once the replacement has loaded and its swap is on screen, so\n * the services the old mount created are torn down instead of being left running.\n *\n * @example\n * ```ts\n * readonly reports = injectRemountHandle('reports');\n *\n * async onDefinitionChanged() {\n *   const { outcome } = await this.reports.invalidate();\n *   if (outcome === 'remounted') this.toast('Reports reloaded');\n * }\n * ```\n */\nexport function injectRemountHandle(id: string): RemountHandle {\n  return inject(RemountRegistry).handle(id);\n}\n\n@Injectable({ providedIn: 'root' })\nclass RemountRegistry {\n  private readonly router = inject(Router);\n  private readonly injector = inject(Injector);\n  private readonly visualCommit = inject(VisualCommitCoordinator);\n  private readonly handles = new Map<string, RemountHandle>();\n\n  handle(id: string): RemountHandle {\n    let handle = this.handles.get(id);\n    if (!handle) {\n      handle = new Remounter(this.router, this.injector, this.visualCommit, id);\n      this.handles.set(id, handle);\n    }\n    return handle;\n  }\n}\n\ntype Queued = {\n  readonly promise: Promise<RemountResult>;\n  resolve(result: RemountResult): void;\n  navigate: boolean;\n};\n\nclass Remounter implements RemountHandle {\n  private readonly gen = signal(0);\n  readonly generation = this.gen.asReadonly();\n\n  private queued: Queued | null = null;\n  /** Routes dropped from the config that still own the DI of a subtree that may be on screen. */\n  private readonly orphans: Route[] = [];\n  private disposalWatcher: EffectRef | null = null;\n\n  constructor(\n    private readonly router: Router,\n    private readonly injector: Injector,\n    private readonly visualCommit: VisualCommitCoordinator,\n    private readonly id: string,\n  ) {}\n\n  invalidate(options?: RemountOptions): Promise<RemountResult> {\n    const navigate = (options?.navigation ?? 'reload-current') !== 'none';\n    const inFlight = options?.inFlight ?? 'wait';\n    const current = this.router.getCurrentNavigation();\n\n    if (!current) return this.run(navigate);\n\n    switch (inFlight) {\n      case 'reject':\n        return Promise.resolve({ outcome: 'rejected' });\n      case 'cancel-and-retry': {\n        // Subscribe first: aborting emits the cancel synchronously.\n        const settled = this.afterSettled();\n        current.abort();\n        return settled.then(() => this.run(navigate));\n      }\n      case 'wait':\n        return this.enqueue(navigate);\n    }\n  }\n\n  /** One queued run per handle: later waiters join it and the strongest intent wins. */\n  private enqueue(navigate: boolean): Promise<RemountResult> {\n    if (this.queued) {\n      this.queued.navigate ||= navigate;\n      return this.queued.promise;\n    }\n\n    let resolve!: (result: RemountResult) => void;\n    const promise = new Promise<RemountResult>((r) => (resolve = r));\n    const queued: Queued = { promise, resolve, navigate };\n    this.queued = queued;\n\n    void this.afterSettled().then(async () => {\n      this.queued = null;\n      queued.resolve(await this.run(queued.navigate));\n    });\n\n    return promise;\n  }\n\n  private async run(navigate: boolean): Promise<RemountResult> {\n    const location = findMarkedRoute(\n      this.router.config,\n      REMOUNT_MARKER,\n      this.id,\n    );\n    if (!location)\n      throw new Error(\n        `[mmstack/router-core] No route marked remountable(\"${this.id}\") in the router config. Spread remountable('${this.id}') into the route's data.`,\n      );\n\n    const cached = hasLazyState(location.route);\n    const path = findPath(this.router.config, location.route);\n    replaceRouteAt(location, withoutLazyState(location.route));\n    // The subtree is factory-fresh again, so demand-driven warming has to be allowed to re-warm it.\n    this.injector.get(PreloadStrategy).forget(path);\n    if (!cached) return { outcome: 'no-op' };\n\n    this.orphans.push(location.route);\n    this.watchForSuccessor();\n\n    this.gen.update((g) => g + 1);\n    if (navigate)\n      await this.router.navigateByUrl(this.router.url, {\n        onSameUrlNavigation: 'reload',\n      });\n\n    return { outcome: 'remounted' };\n  }\n\n  /**\n   * An orphaned route still owns its subtree's injectors, and the view built from them can still\n   * be on screen — under `navigation: 'none'` it is, by design. They are destroyed once a\n   * successor load has published *and* that navigation is visually committed: at that point the\n   * old view is gone by construction, whether it was swapped out or destroyed outright.\n   */\n  private watchForSuccessor(): void {\n    if (this.disposalWatcher) return;\n    this.disposalWatcher = effect(\n      () => {\n        if (this.visualCommit.state().status !== 'committed') return;\n        untracked(() => this.disposeOrphans());\n      },\n      { injector: this.injector },\n    );\n  }\n\n  private disposeOrphans(): void {\n    const location = findMarkedRoute(\n      this.router.config,\n      REMOUNT_MARKER,\n      this.id,\n    );\n    if (!location || !hasLazyState(location.route)) return;\n\n    for (const orphan of this.orphans) destroyLazyInjectors(orphan);\n    this.orphans.length = 0;\n    this.disposalWatcher?.destroy();\n    this.disposalWatcher = null;\n  }\n\n  private afterSettled(): Promise<unknown> {\n    return firstValueFrom(\n      this.router.events.pipe(\n        filter(\n          (e) =>\n            e instanceof NavigationEnd ||\n            e instanceof NavigationCancel ||\n            e instanceof NavigationError ||\n            e instanceof NavigationSkipped,\n        ),\n        take(1),\n        defaultIfEmpty(null),\n      ),\n    );\n  }\n}\n","import {\n  computed,\n  effect,\n  type EnvironmentProviders,\n  inject,\n  InjectionToken,\n  Injector,\n  isDevMode,\n  makeEnvironmentProviders,\n  type Signal,\n  untracked,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n  type ActivatedRouteSnapshot,\n  NavigationEnd,\n  type ParamMap,\n  type ResolveFn,\n  type Route,\n  Router,\n} from '@angular/router';\nimport { provideTransitionScope } from '@mmstack/primitives';\nimport { filter } from 'rxjs';\n\n/**\n * Context handed to a {@link RouteDataFactory}. Both `params` and `queryParams` are live\n * signals that update on every navigation, derived from router state — so a factory defined\n * once keeps producing correct data across param/query changes.\n */\nexport type RouteDataContext = {\n  readonly params: Signal<Record<string, string>>;\n  readonly queryParams: Signal<Record<string, string>>;\n  /**\n   * Single-param accessor: `param('id')` ≡ a memoized `computed(() => params()['id'] ?? '')`,\n   * with a dev-mode error the first time the param is absent from the matched route.\n   */\n  param(name: string): Signal<string>;\n  /** `true` only on the prefetch path (no real activation). */\n  readonly isPrefetch: boolean;\n  /** The injector the factory runs in (route env injector on activation). */\n  readonly injector: Injector;\n};\n\n/** @internal Builds {@link RouteDataContext.param} over a params signal. Memoized per name; warns once per name. */\nexport function paramAccessor(\n  params: Signal<Record<string, string>>,\n): (name: string) => Signal<string> {\n  const cache = new Map<string, Signal<string>>();\n  return (name) => {\n    let sig = cache.get(name);\n    if (!sig) {\n      let warned = false;\n      sig = computed(() => {\n        const value = params()[name];\n        if (value === undefined) {\n          if (isDevMode() && !warned) {\n            warned = true;\n            console.error(\n              `[mmstack/router-core] ctx.param('${name}'): no such param on the matched route — check the route's path definition for a typo.`,\n            );\n          }\n          return '';\n        }\n        return value;\n      });\n      cache.set(name, sig);\n    }\n    return sig;\n  };\n}\n\n/** Builds the route's data from the context. */\nexport type RouteDataFactory<T> = (ctx: RouteDataContext) => T;\n\n/** @internal A `status()` we can watch. */\nexport type StatusBearing = { status: () => string };\n\n/** @internal */\nexport function isStatusBearing(value: unknown): value is StatusBearing {\n  return !!value && typeof (value as StatusBearing).status === 'function';\n}\n\n/** @internal The value itself, or the first-level status-bearing members of a composite. */\nexport function statusBearers(value: unknown): StatusBearing[] {\n  if (isStatusBearing(value)) return [value];\n  if (value && typeof value === 'object')\n    return Object.values(value).filter(isStatusBearing);\n  return [];\n}\n\nexport type CreateRouteDataOptions = {\n  /**\n   * Fires when any status-bearing resource the factory returned transitions into\n   * `status() === 'error'` (first load, reloads, param re-fetches). Live path only:\n   * prefetch errors are speculative and never fire this. Use it to redirect, toast, or log.\n   *\n   * ```ts\n   * createRouteData(USER, factory, {\n   *   onError: (err, ctx) => ctx.injector.get(Router).navigateByUrl('/not-found'),\n   * });\n   * ```\n   * Without it the outlet swaps on settle-by-error and the component renders the slot's `error()`.\n   */\n  onError?: (error: unknown, ctx: RouteDataContext) => void;\n};\n\n/** A typed handle linking a route's `providers` ({@link provideRouteData}), its `resolve` slot\n * ({@link createRouteData}) and its readers ({@link injectRouteData}). */\nexport type RouteDataKey<T> = {\n  readonly description: string;\n  /** @internal */\n  readonly token: InjectionToken<RouteDataSlot<T>>;\n};\n\nexport function routeDataKey<T>(description: string): RouteDataKey<T> {\n  return {\n    description,\n    token: new InjectionToken<RouteDataSlot<T>>(`mmRouteData:${description}`),\n  };\n}\n\n/** @internal Per-route memoization slot, so a re-running resolver never recreates the value. */\nexport class RouteDataSlot<T> {\n  private ready = false;\n  private value!: T;\n\n  ensure(make: () => T): T {\n    if (!this.ready) {\n      this.value = make();\n      this.ready = true;\n    }\n    return this.value;\n  }\n\n  get isReady(): boolean {\n    return this.ready;\n  }\n\n  read(): T {\n    return this.value;\n  }\n}\n\n/**\n * Route `providers` helper: provides the per-route transition scope (so the resource the\n * resolver creates registers somewhere the {@link TransitionRouterOutlet} can coordinate)\n * and the memoization slot for `key`. Pair with {@link createRouteData} in the route's\n * `resolve` map and {@link injectRouteData} in the component.\n */\nexport function provideRouteData<T>(\n  key: RouteDataKey<T>,\n): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    provideTransitionScope(),\n    { provide: key.token, useFactory: () => new RouteDataSlot<T>() },\n  ]);\n}\n\n/**\n * Creates an Angular `ResolveFn` that fires the route's data at the resolve phase — before\n * the component constructs, in the route's injector, with the matched params in hand — and\n * is non-blocking (returns the value synchronously; the resource loads async while the\n * outlet holds the previous view). Memoized per route via the slot, so it runs the factory\n * once even if the resolver re-runs.\n *\n * @example\n * ```ts\n * const USER = routeDataKey<ResourceRef<User>>('user');\n * {\n *   path: 'users/:id',\n *   providers: [provideRouteData(USER)],\n *   resolve: {\n *     user: createRouteData(USER, (ctx) =>\n *       queryResource(() => `/api/users/${ctx.params()['id']}`, {\n *         defaultValue: null,\n *         register: 'suspend',\n *       }),\n *     ),\n *   },\n *   component: UserComponent,\n * }\n * // in UserComponent: readonly user = injectRouteData(USER);\n * ```\n */\nexport function createRouteData<T>(\n  key: RouteDataKey<T>,\n  factory: RouteDataFactory<T>,\n  options?: CreateRouteDataOptions,\n): ResolveFn<T> {\n  const resolver: ResolveFn<T> = (snapshot) => {\n    const slot = inject(key.token, { optional: true });\n    if (!slot)\n      throw new Error(\n        `[mmstack/router-core] createRouteData(\"${key.description}\") needs provideRouteData(${key.description}) in the same route's providers.`,\n      );\n\n    return slot.ensure(() => {\n      const injector = inject(Injector);\n      const router = inject(Router);\n      const params = liveParams(router, snapshot);\n      const ctx: RouteDataContext = {\n        params,\n        param: paramAccessor(params),\n        queryParams: liveQueryParams(router, snapshot),\n        isPrefetch: false,\n        injector,\n      };\n      const value = factory(ctx);\n      const onError = options?.onError;\n      if (onError) watchForErrors(value, onError, ctx);\n      return value;\n    });\n  };\n\n  (resolver as RouteDataTagged)[ROUTE_DATA_TAG] = {\n    description: key.description,\n    factory: factory as RouteDataFactory<unknown>,\n  };\n\n  return resolver;\n}\n\n/** @internal Fire `onError` on every transition into `'error'` of a returned status-bearer. */\nfunction watchForErrors(\n  value: unknown,\n  onError: (error: unknown, ctx: RouteDataContext) => void,\n  ctx: RouteDataContext,\n): void {\n  const bearers = statusBearers(value);\n  if (!bearers.length) return;\n  const prev = bearers.map(() => '');\n  effect(() => {\n    bearers.forEach((bearer, i) => {\n      const status = bearer.status();\n      const was = prev[i];\n      prev[i] = status;\n      if (status !== 'error' || was === 'error') return;\n      const error =\n        (bearer as { error?: () => unknown }).error?.() ?? undefined;\n      untracked(() => onError(error, ctx));\n    });\n  });\n}\n\n/** @internal */\nexport const ROUTE_DATA_TAG = Symbol('mmRouteData');\n\n/** @internal */\nexport type RouteDataTag = {\n  readonly description: string;\n  readonly factory: RouteDataFactory<unknown>;\n};\n\ntype RouteDataTagged = { [ROUTE_DATA_TAG]?: RouteDataTag };\n\n/** @internal Read the `{ factory }` tag off a resolver created by {@link createRouteData}. */\nexport function readRouteDataTag(fn: unknown): RouteDataTag | null {\n  return typeof fn === 'function'\n    ? ((fn as RouteDataTagged)[ROUTE_DATA_TAG] ?? null)\n    : null;\n}\n\n/**\n * Tag ANY resolver as prefetchable: `withRouteData()`'s hover/visible pipeline runs\n * `prefetch(ctx)` speculatively — same ephemeral root-parented injector as route-data\n * factories, `ctx.isPrefetch: true`, params extracted from the link URL — while navigation\n * runs the wrapped resolver unchanged. For resolvers whose speculative work is idempotent\n * and cache-shaped: warming translations, priming a dataset, anything a hover may safely\n * start. (`createRouteData` resolvers are already tagged — don't double-tag those.)\n *\n * ```ts\n * resolve: {\n *   i18n: withPrefetch(quoteNs.resolveNamespaceTranslation, {\n *     description: 'quote-i18n',\n *     prefetch: (ctx) => quoteNs.warmNamespaceTranslation(ctx.params()['locale']),\n *   }),\n * }\n * ```\n *\n * Prefetch runs are deduped per link URL + `description`; a returned status-bearing\n * resource is awaited for teardown like any route-data factory, a plain promise just runs.\n */\nexport function withPrefetch<T>(\n  resolver: ResolveFn<T>,\n  options: {\n    description: string;\n    prefetch: (ctx: RouteDataContext) => unknown;\n  },\n): ResolveFn<T> {\n  const tagged: ResolveFn<T> = (route, state) => resolver(route, state);\n  (tagged as RouteDataTagged)[ROUTE_DATA_TAG] = {\n    description: options.description,\n    factory: options.prefetch as RouteDataFactory<unknown>,\n  };\n  return tagged;\n}\n\n/** Read the route data produced by {@link createRouteData} for `key`. */\nexport function injectRouteData<T>(key: RouteDataKey<T>): T {\n  const slot = inject(key.token, { optional: true });\n  if (!slot)\n    throw new Error(\n      `[mmstack/router-core] No route data \"${key.description}\" in scope. Add provideRouteData(${key.description}) to the route's providers and createRouteData(...) to its resolve map.`,\n    );\n  if (!slot.isReady)\n    throw new Error(\n      `[mmstack/router-core] Route data \"${key.description}\" was not resolved. Wire createRouteData(${key.description}, ...) into the route's resolve map.`,\n    );\n  return slot.read();\n}\n\nfunction liveParams(\n  router: Router,\n  snapshot: ActivatedRouteSnapshot,\n): Signal<Record<string, string>> {\n  const tick = navigationTick(router);\n  return computed(\n    () => {\n      tick();\n      const node =\n        findByConfig(router.routerState.snapshot.root, snapshot.routeConfig) ??\n        snapshot;\n      return toRecord(node.paramMap);\n    },\n    { equal: recordsEqual },\n  );\n}\n\nfunction liveQueryParams(\n  router: Router,\n  snapshot: ActivatedRouteSnapshot,\n): Signal<Record<string, string>> {\n  const tick = navigationTick(router);\n  return computed(\n    () => {\n      tick();\n      return toRecord(\n        router.routerState.snapshot.root.queryParamMap ??\n          snapshot.queryParamMap,\n      );\n    },\n    { equal: recordsEqual },\n  );\n}\n\nfunction navigationTick(router: Router): Signal<unknown> {\n  return toSignal(\n    router.events.pipe(filter((e) => e instanceof NavigationEnd)),\n    { initialValue: null },\n  );\n}\n\nfunction findByConfig(\n  root: ActivatedRouteSnapshot,\n  config: Route | null,\n): ActivatedRouteSnapshot | null {\n  if (!config) return null;\n  const stack: ActivatedRouteSnapshot[] = [root];\n  while (stack.length) {\n    const node = stack.shift();\n    if (!node) continue;\n    if (node.routeConfig === config) return node;\n    stack.push(...node.children);\n  }\n  return null;\n}\n\nfunction recordsEqual(\n  a: Record<string, string>,\n  b: Record<string, string>,\n): boolean {\n  const ak = Object.keys(a);\n  if (ak.length !== Object.keys(b).length) return false;\n  return ak.every((k) => a[k] === b[k]);\n}\n\nfunction toRecord(pm: ParamMap): Record<string, string> {\n  const rec: Record<string, string> = {};\n  for (const key of pm.keys) {\n    const value = pm.get(key);\n    if (value != null) rec[key] = value;\n  }\n  return rec;\n}\n","/**\n * Given a route config path pattern (e.g. `/users/:id`) and a concrete serialized link\n * (e.g. `/users/42/orders?tab=open`), extract the `:param` values by segment position and\n * parse the query string. Returns `null` if the link doesn't match the pattern.\n *\n * Prefix-matches like the preload predicate: extra link segments beyond the pattern are\n * allowed (a child route's link still matches its parent's pattern). Matrix params are\n * stripped from segments. Used by the prefetch path, where there is no `ActivatedRoute` —\n * params must come from the hovered URL.\n */\nexport function extractRouteParams(\n  configPath: string,\n  linkPath: string,\n): { params: Record<string, string>; query: Record<string, string> } | null {\n  const [rawPath, rawQuery] = linkPath.split('#')[0].split('?');\n\n  const configSegs = configPath.split('/').filter((s) => s.trim());\n  const linkSegs = rawPath.split('/').filter((s) => s.trim());\n  if (linkSegs.length < configSegs.length) return null;\n\n  const params: Record<string, string> = {};\n  for (let i = 0; i < configSegs.length; i++) {\n    const configSeg = configSegs[i].split(';')[0];\n    const linkSeg = linkSegs[i].split(';')[0];\n    if (configSeg.startsWith(':')) {\n      params[configSeg.slice(1)] = safeDecode(linkSeg);\n    } else if (configSeg !== '**' && configSeg !== linkSeg) {\n      return null;\n    } else if (configSeg === '**') {\n      break;\n    }\n  }\n\n  const query: Record<string, string> = {};\n  if (rawQuery) {\n    for (const [key, value] of new URLSearchParams(rawQuery)) query[key] = value;\n  }\n\n  return { params, query };\n}\n\nfunction safeDecode(value: string): string {\n  try {\n    return decodeURIComponent(value);\n  } catch {\n    return value;\n  }\n}\n","import { isPlatformServer } from '@angular/common';\nimport {\n  createEnvironmentInjector,\n  DestroyRef,\n  effect,\n  EnvironmentInjector,\n  type EnvironmentProviders,\n  inject,\n  Injectable,\n  InjectionToken,\n  isDevMode,\n  makeEnvironmentProviders,\n  PLATFORM_ID,\n  provideEnvironmentInitializer,\n  runInInjectionContext,\n  signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type Route, Router } from '@angular/router';\nimport { provideTransitionScope } from '@mmstack/primitives';\nimport { PreloadRequester } from '../preloading/preload-requester';\nimport { extractRouteParams } from '../util/extract-params';\nimport { findPath } from '../util/find-path';\nimport {\n  paramAccessor,\n  readRouteDataTag,\n  statusBearers,\n  type RouteDataContext,\n  type RouteDataTag,\n} from './route-data';\n\nconst DEFAULT_PREFETCH_TIMEOUT = 30_000;\n\nconst PREFETCH_TIMEOUT = new InjectionToken<number>(\n  '@mmstack/router-core:route-data-prefetch-timeout',\n);\n\nfunction isSettled(status: string): boolean {\n  return status === 'resolved' || status === 'error' || status === 'local';\n}\n\n/**\n * Warms route data on preload-intent (the same `mmLink` hover/visible signal that loads the\n * code chunk): finds routes carrying a {@link createRouteData} tag, extracts params from the\n * URL, and runs the factory in a throwaway root-parented injector so the resource fetches\n * into the shared cache. Lazy routes are two-phase (first hover loads the chunk, next warms\n * data); eager routes warm on the first hover. Opt-in via {@link withRouteData}.\n */\n@Injectable({ providedIn: 'root' })\nexport class RouteDataPrefetcher {\n  private readonly router = inject(Router);\n  private readonly req = inject(PreloadRequester);\n  private readonly rootInjector = inject(EnvironmentInjector);\n  private readonly destroyRef = inject(DestroyRef);\n  private readonly onServer = isPlatformServer(inject(PLATFORM_ID));\n  private readonly prefetchTimeout =\n    inject(PREFETCH_TIMEOUT, { optional: true }) ?? DEFAULT_PREFETCH_TIMEOUT;\n  private connected = false;\n  private readonly warmed = new Set<string>();\n\n  connect(): void {\n    if (this.connected || this.onServer) return;\n    this.connected = true;\n    this.req.preloadRequested$\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(({ path, scope }) => {\n        if (scope === 'all') this.warm(path);\n      });\n  }\n\n  private warm(linkPath: string): void {\n    for (const { configPath, tag } of this.collectTagged()) {\n      const extracted = extractRouteParams(configPath, linkPath);\n      if (!extracted) continue;\n\n      const dedupeKey = `${linkPath}::${tag.description}`;\n      if (this.warmed.has(dedupeKey)) continue;\n      this.warmed.add(dedupeKey);\n\n      this.run(tag, extracted, dedupeKey);\n    }\n  }\n\n  private run(\n    tag: RouteDataTag,\n    extracted: {\n      params: Record<string, string>;\n      query: Record<string, string>;\n    },\n    dedupeKey: string,\n  ): void {\n    const ephemeral = createEnvironmentInjector(\n      [provideTransitionScope()],\n      this.rootInjector,\n    );\n\n    try {\n      runInInjectionContext(ephemeral, () => {\n        const params = signal(extracted.params);\n        const ctx: RouteDataContext = {\n          params,\n          param: paramAccessor(params),\n          queryParams: signal(extracted.query),\n          isPrefetch: true,\n          injector: ephemeral,\n        };\n        const watched = statusBearers(tag.factory(ctx));\n\n        if (!watched.length) {\n          queueMicrotask(() => ephemeral.destroy());\n          return;\n        }\n\n        let settled = false;\n        // failed warm forgets its dedupe entry so the next hover retries\n        const finish = (failed: boolean) => {\n          settled = true;\n          clearTimeout(timer);\n          if (failed) this.warmed.delete(dedupeKey);\n          queueMicrotask(() => ephemeral.destroy());\n        };\n        // leak guard: tear down if a request never settles\n        const timer = setTimeout(() => {\n          if (settled) return;\n          this.warmed.delete(dedupeKey);\n          ephemeral.destroy();\n        }, this.prefetchTimeout);\n        const ref = effect(() => {\n          const statuses = watched.map((w) => w.status());\n          if (!statuses.every(isSettled)) return;\n          finish(statuses.includes('error'));\n          ref.destroy();\n        });\n      });\n    } catch (e) {\n      // a throwing factory must not kill the preload subscription\n      this.warmed.delete(dedupeKey);\n      ephemeral.destroy();\n      if (isDevMode())\n        console.warn(\n          `[mmstack/router-core] route-data prefetch factory for \"${tag.description}\" threw:`,\n          e,\n        );\n    }\n  }\n\n  private collectTagged(): { configPath: string; tag: RouteDataTag }[] {\n    const out: { configPath: string; tag: RouteDataTag }[] = [];\n    const visit = (routes: Route[]): void => {\n      for (const route of routes) {\n        if (route.resolve) {\n          for (const slot of Object.values(route.resolve)) {\n            const tag = readRouteDataTag(slot);\n            if (tag)\n              out.push({\n                configPath: findPath(this.router.config, route),\n                tag,\n              });\n          }\n        }\n        if (route.children) visit(route.children);\n        const loaded = (route as Route & { _loadedRoutes?: Route[] })\n          ._loadedRoutes;\n        if (Array.isArray(loaded)) visit(loaded);\n      }\n    };\n    visit(this.router.config);\n    return out;\n  }\n}\n\n/** Options for {@link withRouteData}. */\nexport type RouteDataOptions = {\n  /**\n   * How long (ms) a warmed prefetch may stay in flight before its throwaway injector is torn\n   * down as a leak guard. Raise it for routes whose data legitimately takes a long time to\n   * load. Defaults to 30000.\n   */\n  timeout?: number;\n};\n\n/**\n * Router feature: wire route-data prefetch into the `mmLink` preload pipeline so hovering a\n * link warms its route's data (not just the lazy code chunk). Add alongside `provideRouter`.\n *\n * @example\n * ```ts\n * provideRouter(routes, withPreloading(PreloadStrategy)),\n * withRouteData(),\n * ```\n */\nexport function withRouteData(\n  options?: RouteDataOptions,\n): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    provideEnvironmentInitializer(() => inject(RouteDataPrefetcher).connect()),\n    ...(options?.timeout != null\n      ? [{ provide: PREFETCH_TIMEOUT, useValue: options.timeout }]\n      : []),\n  ]);\n}\n","import { isPlatformBrowser, ViewportScroller } from '@angular/common';\nimport {\n  effect,\n  type EnvironmentProviders,\n  inject,\n  Injectable,\n  makeEnvironmentProviders,\n  PLATFORM_ID,\n  provideEnvironmentInitializer,\n  untracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type Event, EventType, Router } from '@angular/router';\nimport { VisualCommitCoordinator } from '../visual-commit';\n\n/**\n * Scroll restoration that fires on the visual commit instead of `NavigationEnd`.\n *\n * Angular's own restoration scrolls as soon as the router activates the route, which under a\n * {@link TransitionRouterOutlet} hold is while the *previous* view is still on screen — so the\n * old page jumps, and the new one arrives already scrolled to the wrong place. This restores\n * after the swap, when the content the position refers to actually exists.\n *\n * Per navigation: going back or forward restores the position that page was left at, and a\n * forward navigation goes to the top, or to the element named by the URL fragment. A navigation\n * that never commits (superseded by another one) never scrolls.\n *\n * Replaces `withInMemoryScrolling({ scrollPositionRestoration: 'enabled' })` — enable one or the\n * other, not both, or the two will fight over the same scroll.\n *\n * @example\n * ```ts\n * bootstrapApplication(App, {\n *   providers: [provideRouter(routes), provideTransitionScrollRestoration()],\n * });\n * ```\n */\nexport function provideTransitionScrollRestoration(): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    provideEnvironmentInitializer(() => inject(TransitionScrollRestoration)),\n  ]);\n}\n\ntype ScrollIntent = {\n  /** Where to go back to, for a popstate navigation whose position we stored. */\n  readonly restore: [number, number] | null;\n};\n\n@Injectable({ providedIn: 'root' })\nclass TransitionScrollRestoration {\n  private readonly router = inject(Router);\n  private readonly scroller = inject(ViewportScroller);\n  private readonly commit = inject(VisualCommitCoordinator).state;\n  private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n  /** Scroll position each navigation left the page at, keyed by its navigation id. */\n  private readonly positions = new Map<number, [number, number]>();\n  private readonly intents = new Map<number, ScrollIntent>();\n  private currentId = 0;\n  private scrolledFor: number | null = null;\n\n  constructor() {\n    if (!this.isBrowser) return;\n\n    // The browser must not also restore, or it does so against the pre-swap DOM.\n    this.scroller.setHistoryScrollRestoration('manual');\n\n    this.router.events\n      .pipe(takeUntilDestroyed())\n      .subscribe((e: Event) => this.onEvent(e));\n\n    effect(() => {\n      const { status, navigationId } = this.commit();\n      if (\n        status !== 'committed' ||\n        navigationId === null ||\n        navigationId === this.scrolledFor\n      )\n        return;\n      this.scrolledFor = navigationId;\n      untracked(() => this.applyScroll(navigationId));\n    });\n  }\n\n  private onEvent(e: Event): void {\n    if (e.type !== EventType.NavigationStart) return;\n\n    this.positions.set(this.currentId, this.scroller.getScrollPosition());\n    this.currentId = e.id;\n\n    const restoredId = e.restoredState?.navigationId;\n    this.intents.set(e.id, {\n      restore:\n        e.navigationTrigger === 'popstate' && restoredId !== undefined\n          ? (this.positions.get(restoredId) ?? null)\n          : null,\n    });\n  }\n\n  private applyScroll(navigationId: number): void {\n    const intent = this.intents.get(navigationId);\n    this.intents.clear();\n\n    if (intent?.restore) {\n      this.scroller.scrollToPosition(intent.restore);\n      return;\n    }\n\n    const anchor = this.router.parseUrl(this.router.url).fragment;\n    if (anchor) this.scroller.scrollToAnchor(anchor);\n    else this.scroller.scrollToPosition([0, 0]);\n  }\n}\n","import { inject, InjectionToken, type Provider } from '@angular/core';\n\n/**\n * Title configuration interface.\n * Defines how createTitle should behave\n * @see {createTitle}\n */\nexport type TitleConfig = {\n  /**\n   * The base title to fallback to, by default Title.getTitle() is called on instantiation and that is used as a fallback,\n   * which in most cases should resolve to what is in index.html, unless you specifically call Title.setTitle() before any routes,\n   * are initialized.\n   */\n  initialTitle?: string;\n  /**\n   * Transforms every resolved title before it's applied. A string is treated as\n   * a literal prefix (`'My App – '` → `'My App – Dashboard'`); a function\n   * receives the resolved title and returns the final document title\n   * (e.g. `` (title) => `${title} • My App` `` for a suffix).\n   * @default '' (titles pass through unchanged)\n   */\n  prefix?: string | ((title: string) => string);\n  /**\n   * When `true` (default), navigating to a route without a registered title keeps\n   * the previous title. When `false`, the title falls back to `initialTitle`\n   * (or the `<title>` from `index.html`) instead.\n   * @default true\n   */\n  keepLastKnownTitle?: boolean;\n};\n\n/**\n * @internal\n */\nexport type InternalTitleConfig = {\n  initialTitle: string;\n  parser: (title: string) => string;\n  keepLastKnown: boolean;\n};\n\nconst token = new InjectionToken<InternalTitleConfig>(\n  '@mmstack/router-core:title-config',\n);\n\n/**\n * Provide application-wide configuration for the title subsystem. The config\n * is only consumed when at least one route uses a {@link createTitle} resolver;\n * routes without `createTitle` are unaffected.\n *\n * @param config Optional {@link TitleConfig}. All fields are optional — pass\n *   `prefix` to namespace titles (e.g. `\"My App – \"`), `initialTitle` to\n *   override the fallback (defaults to the `<title>` from `index.html`), and\n *   `keepLastKnownTitle: false` to clear the title on navigations to routes\n *   without a title (the default keeps the previous one).\n * @returns A `Provider` to add to your app's providers array.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n *   providers: [\n *     provideRouter(routes),\n *     provideTitleConfig({\n *       prefix: (title) => `${title} • My App`,\n *       keepLastKnownTitle: true,\n *     }),\n *   ],\n * });\n * ```\n */\nexport function provideTitleConfig(config?: TitleConfig): Provider {\n  const prefix = config?.prefix ?? '';\n\n  const prefixFn =\n    typeof prefix === 'function'\n      ? prefix\n      : (title: string) => `${prefix}${title}`;\n\n  return {\n    provide: token,\n    useValue: {\n      initialTitle: config?.initialTitle ?? '',\n      parser: prefixFn,\n      keepLastKnown: config?.keepLastKnownTitle ?? true,\n    } satisfies InternalTitleConfig,\n  };\n}\n\nfunction identity(str: string) {\n  return str;\n}\n\nexport function injectTitleConfig(): InternalTitleConfig {\n  return (\n    inject(token, {\n      optional: true,\n    }) ?? {\n      initialTitle: '',\n      parser: identity,\n      keepLastKnown: true,\n    }\n  );\n}\n","import {\n  computed,\n  effect,\n  inject,\n  Injectable,\n  linkedSignal,\n  untracked,\n  type Signal,\n} from '@angular/core';\nimport { Title } from '@angular/platform-browser';\nimport {\n  type ActivatedRouteSnapshot,\n  type ResolveFn,\n} from '@angular/router';\nimport { mutable, until } from '@mmstack/primitives';\nimport { injectLeafRoutes, injectSnapshotPathResolver } from '../util';\nimport { createStagedApply } from '../util/staged-apply';\nimport { injectTitleConfig } from './title-config';\n\n@Injectable({\n  providedIn: 'root',\n})\nexport class TitleStore {\n  private readonly map = mutable<Map<string, Signal<string>>>(new Map());\n  // Stage registrations so a cancelled navigation can't flip the title early, and so a held\n  // transition doesn't retitle the page while the previous view is still the one on screen.\n  private readonly stagedApply = createStagedApply<Signal<string>>(\n    (id, titleFn) => this.map.inline((m) => m.set(id, titleFn)),\n    'visual-commit',\n  );\n\n  constructor() {\n    const { keepLastKnown, initialTitle } = injectTitleConfig();\n    const leafRoutes = injectLeafRoutes();\n    const title = inject(Title);\n    const fallbackTitle = initialTitle || untracked(() => title.getTitle());\n\n    const reverseLeaves = computed(() => leafRoutes().toReversed());\n\n    const currentResolvedTitles = computed(() => {\n      const map = this.map();\n      return reverseLeaves()\n        .map((leaf) => map.get(leaf.path)?.() ?? leaf.route.title ?? null)\n        .filter((v) => v !== null);\n    });\n\n    const currentTitle = computed(() => currentResolvedTitles().at(0) ?? '');\n\n    const heldTitle = keepLastKnown\n      ? linkedSignal<string, string>({\n          source: () => currentTitle(),\n          computation: (value, prev) => {\n            if (!value) return prev?.value ?? '';\n            return value;\n          },\n        })\n      : currentTitle;\n\n    effect(() => {\n      title.setTitle(heldTitle() || fallbackTitle);\n    });\n  }\n\n  register(id: string, titleFn: Signal<string>) {\n    this.stagedApply(id, titleFn);\n  }\n}\n\n/**\n * Creates an Angular router `ResolveFn<string>` that registers a title for the\n * route it's attached to. Titles can be static strings, factory functions\n * (called in an injection context, so they can use `inject()`), or signal\n * factories (for reactive titles that change when underlying data does).\n *\n * The resolved title flows through any `prefix` configured via\n * {@link provideTitleConfig}, and is wired into Angular's `Title` service\n * via an effect. Nested routes pick the most-specific leaf's title; if a\n * deeper route has no title and `keepLastKnownTitle` is `true` (default),\n * the previous title is preserved.\n *\n * @param factoryOrValue Either a literal string title, a factory returning a\n *   string, or a factory returning a `Signal<string>` for reactive titles.\n *   Factory callbacks run inside an injection context (so they can use\n *   `inject()`) and receive the route's `ActivatedRouteSnapshot`, making\n *   params/data idiomatically reachable: `createTitle((route) => route.params['id'])`.\n * @param awaitValue When `true`, the resolver waits until the title signal\n *   emits a truthy value before resolving — useful for SSR/SEO where the\n *   resolved title should not be empty. Defaults to `false`.\n * @returns An Angular `ResolveFn<string>` to wire into a route's `title` field\n *   (or any other `resolve` slot — the return value isn't usually consumed).\n *\n * @example\n * ```ts\n * // Static title\n * { path: 'about', component: AboutComponent, title: createTitle('About us') }\n *\n * // Factory receiving the route snapshot\n * {\n *   path: 'users/:id',\n *   component: UserComponent,\n *   title: createTitle((route) => `User ${route.params['id']}`),\n * }\n *\n * // Reactive title from a signal store\n * {\n *   path: 'dashboard',\n *   component: DashboardComponent,\n *   title: createTitle(() => {\n *     const user = inject(UserStore).current;\n *     return computed(() => `Dashboard – ${user()?.name ?? 'Guest'}`);\n *   }),\n * }\n * ```\n */\nexport function createTitle(\n  factoryOrValue:\n    | ((route: ActivatedRouteSnapshot) => string | (() => string))\n    | string,\n  awaitValue = false,\n): ResolveFn<string> {\n  const factory =\n    typeof factoryOrValue === 'string' ? () => factoryOrValue : factoryOrValue;\n\n  return async (route): Promise<string> => {\n    const store = inject(TitleStore);\n    const resolver = injectSnapshotPathResolver();\n    const fp = resolver(route);\n\n    const { parser } = injectTitleConfig();\n\n    const resolved = factory(route);\n\n    const titleSignal =\n      typeof resolved === 'string'\n        ? computed(() => resolved)\n        : computed(resolved);\n\n    const parsedTitleSignal = computed(() => parser(titleSignal()));\n\n    store.register(fp, parsedTitleSignal);\n\n    if (awaitValue) await until(parsedTitleSignal, (v) => !!v);\n\n    return Promise.resolve(untracked(parsedTitleSignal));\n  };\n}\n","import { inject, Injectable } from '@angular/core';\nimport type {\n  ViewTransitionInfo,\n  ViewTransitionsFeatureOptions,\n} from '@angular/router';\n\n/** Structural view of the DOM `ViewTransition`. */\ntype ViewTransitionLike = {\n  skipTransition: () => void;\n  finished: Promise<unknown>;\n};\n\n/**\n * @internal\n * Root coordinator shared between {@link mmRouterViewTransitions} and\n * {@link TransitionRouterOutlet}. Tells the outlet router view transitions are enabled and\n * hands it the active transition so it can skip Angular's inert activation-time transition\n * for held navigations.\n */\n@Injectable({ providedIn: 'root' })\nexport class RouterViewTransitions {\n  enabled = false;\n  active: ViewTransitionLike | null = null;\n}\n\n/**\n * Wires {@link TransitionRouterOutlet} into Angular's router View Transitions so the two\n * cooperate instead of competing. Pass the result to Angular's `withViewTransitions`:\n *\n * ```ts\n * provideRouter(routes, withViewTransitions(mmRouterViewTransitions()));\n * ```\n *\n * With this in place:\n * - Routes the outlet does **not** hold (first navigation, `data.immediateTransition`,\n *   routes that load nothing) transition the normal Angular way — the swap is synchronous\n *   with activation, so Angular animates them correctly.\n * - Routes the outlet **holds** (waiting on data) have Angular's activation-time\n *   transition skipped (it would be inert — the incoming view activates hidden) and the\n *   outlet fires the real transition at the swap instead. Same `::view-transition-*` CSS\n *   applies to both.\n * - The outlet's `viewTransition` input defaults to \"on\" — you don't need to set the\n *   attribute. Set `[viewTransition]=\"false\"` on a specific outlet to opt it back out.\n *\n * Your own `onViewTransitionCreated` / `skipInitialTransition` options are preserved.\n *\n * @param options Standard {@link ViewTransitionsFeatureOptions}; `onViewTransitionCreated`\n *   is chained after the coordination hook.\n */\nexport function mmRouterViewTransitions(\n  options?: ViewTransitionsFeatureOptions,\n): ViewTransitionsFeatureOptions {\n  return {\n    ...options,\n    onViewTransitionCreated: (info: ViewTransitionInfo) => {\n      const coordinator = inject(RouterViewTransitions);\n      coordinator.enabled = true;\n\n      const transition = info.transition as unknown as ViewTransitionLike;\n      coordinator.active = transition;\n      const clear = () => {\n        if (coordinator.active === transition) coordinator.active = null;\n      };\n      transition.finished.then(clear, clear);\n\n      options?.onViewTransitionCreated?.(info);\n    },\n  };\n}\n","import {\n  afterNextRender,\n  booleanAttribute,\n  type ComponentRef,\n  computed,\n  DestroyRef,\n  Directive,\n  effect,\n  type EmbeddedViewRef,\n  EnvironmentInjector,\n  inject,\n  Injector,\n  input,\n  output,\n  type OutputEmitterRef,\n  untracked,\n  ViewContainerRef,\n} from '@angular/core';\nimport { type ActivatedRoute, RouterOutlet } from '@angular/router';\nimport {\n  type ForwardingTransitionScope,\n  getTransitionScope,\n  injectTransitionScope,\n  provideForwardingTransitionScope,\n  type ResourceLike,\n} from '@mmstack/primitives';\nimport { RouterViewTransitions } from './view-transition';\nimport { VisualCommitCoordinator } from './visual-commit';\n\n/**\n * How one outlet's swap ended.\n *\n * - `committed` — a held view was swapped out and the incoming view became visible.\n * - `immediate` — the outlet activated without holding (nothing to hold, `immediateTransition`,\n *   or a `RouteReuseStrategy` re-attach) and the view has rendered.\n * - `superseded` — an armed hold was re-targeted or dropped before it could commit; the outlet\n *   re-arms under the navigation that interrupted it.\n * - `outlet-destroyed` — the outlet was destroyed while still holding a view.\n */\nexport type SwapCommitEvent = {\n  outcome: 'committed' | 'immediate' | 'superseded' | 'outlet-destroyed';\n};\n\n/**\n * A `RouterOutlet` that turns navigation into a transition: the current route's view\n * stays mounted and visible while the incoming route mounts hidden and its resources\n * settle, then swaps in one frame — instead of flashing to a loading state. Drop-in for\n * `<router-outlet>`.\n *\n * The base `RouterOutlet` bookkeeping stays fully intact — `isActivated` /\n * `activatedRoute` reflect the live route, so `CanDeactivate` guards, `withComponentInputBinding()`\n * and custom `RouteReuseStrategy` all work normally. The outgoing view is held on screen\n * until the swap commits; `deactivateEvents` fires when it is finally destroyed.\n *\n * An interrupting navigation mid-hold re-targets the hold: the stable view stays visible\n * until the interrupting route settles.\n *\n * Set `data: { immediateTransition: true }` on a route to skip holding for it.\n *\n * Provides a forwarding transition scope: per navigation it re-points at the incoming\n * route's own scope when the route opts in (via `provideRouteData`/`provideTransitionScope()`),\n * giving per-view isolation. Routes that don't opt in share the outlet's own scope, where the\n * swap ignores the snapshotted outgoing refs.\n *\n * ## What a staged view may do\n *\n * While it is staged, the incoming view is constructed, rendered and running — it is simply\n * hidden (`display: none` plus `inert`). Anything it does to its own subtree is invisible until\n * the swap, which is the point. Anything it does to the page *outside* its subtree is not, and\n * lands while the user is still looking at the previous route:\n *\n * - opening overlays, dialogs, portals, toasts or anything else appended to the body\n * - setting body/`:root` classes, CSS variables or scroll position\n * - writing `document.title` directly\n *\n * Titles are the one case handled for you: register them through the title store\n * ({@link createTitle}), which buffers registrations and applies them on the visual commit.\n * For the rest, defer the effect until the view is actually visible — read\n * {@link injectVisualCommit}, or move the work into the swapped-in view's own subtree.\n */\n@Directive({\n  // eslint-disable-next-line @angular-eslint/directive-selector\n  selector: 'mm-transition-outlet',\n  providers: [provideForwardingTransitionScope()],\n})\nexport class TransitionRouterOutlet extends RouterOutlet {\n  private readonly forwarder =\n    injectTransitionScope() as ForwardingTransitionScope;\n  private readonly transitionScope = this.forwarder;\n  private readonly container = inject(ViewContainerRef);\n  private readonly outletInjector = inject(Injector);\n  /** Scope inherited from the outlet's env injector — distinguishes \"route opted in\". */\n  private readonly inheritedScope = getTransitionScope(\n    inject(EnvironmentInjector),\n  );\n\n  private readonly routerViewTransitions = inject(RouterViewTransitions);\n  private readonly visualCommit = inject(VisualCommitCoordinator);\n\n  /**\n   * Fires once per swap this outlet performs, saying how it ended. `committed` and `immediate`\n   * fire after the view is actually on screen, which under a hold is well after `NavigationEnd`.\n   *\n   * For the navigation-wide answer across several (or nested) outlets, read\n   * {@link injectVisualCommit} instead.\n   */\n  readonly swapCommit: OutputEmitterRef<SwapCommitEvent> =\n    output<SwapCommitEvent>();\n\n  /**\n   * Wrap the swap in the View Transitions API (`document.startViewTransition`) for an\n   * animated cross-fade. Feature-detected; unsupported browsers fall back to an instant swap.\n   *\n   * Tri-state: **unset** → follow the app's router-view-transitions setting (on when\n   * `withViewTransitions(mmRouterViewTransitions())` is wired, off otherwise);\n   * **`true`** → always animate; **`false`** → never animate.\n   */\n  readonly viewTransition = input(undefined, {\n    transform: (v: boolean | string | undefined) =>\n      v === undefined ? undefined : booleanAttribute(v),\n  });\n\n  /** Captured outgoing view, kept visible until the incoming view settles. */\n  private held: ComponentRef<unknown> | null = null;\n  private releaseHeldGuard: (() => void) | null = null;\n  private hiddenIncoming: HTMLElement[] | null = null;\n  private currentEnv: EnvironmentInjector | null = null;\n  private sawPending = false;\n  private armed = false;\n\n  /** Outgoing view's resources, snapshotted so the swap ignores them. */\n  private outgoingRefs = new Set<ResourceLike>();\n\n  /** In-flight state of the incoming view only. */\n  private readonly incomingPending = computed(() => {\n    for (const ref of this.transitionScope.resources()) {\n      if (this.outgoingRefs.has(ref)) continue;\n      const s = ref.status();\n      if (s === 'loading' || s === 'reloading') return true;\n    }\n    return false;\n  });\n\n  constructor() {\n    super();\n    effect(() => {\n      const pending = this.incomingPending();\n      untracked(() => {\n        if (!this.armed) return;\n        if (pending) this.sawPending = true;\n        if (this.sawPending && !pending) this.commitSwap();\n      });\n    });\n  }\n\n  override activateWith(route: ActivatedRoute, env: EnvironmentInjector): void {\n    const hadHeld = !!this.held;\n    this.currentEnv = env;\n\n    // Must run before super.activateWith so incoming resources register into the right scope.\n    const routeScope = getTransitionScope(env);\n    const usingRouteScope =\n      routeScope !== null && routeScope !== this.inheritedScope;\n    this.forwarder.setTarget(usingRouteScope ? routeScope : null);\n\n    this.outgoingRefs = usingRouteScope\n      ? new Set()\n      : new Set(untracked(this.transitionScope.resources));\n\n    super.activateWith(route, env);\n\n    if (!hadHeld || route.snapshot.data?.['immediateTransition'] === true) {\n      this.dropHeld();\n      this.resetArm();\n      this.armImmediate();\n      return;\n    }\n\n    this.routerViewTransitions.active?.skipTransition?.();\n    this.hiddenIncoming = this.incomingRootNodes();\n    this.setHidden(this.hiddenIncoming, true);\n    this.arm();\n  }\n\n  override deactivate(): void {\n    if (!this.isActivated) {\n      super.deactivate();\n      return;\n    }\n\n    if (this.held) {\n      this.hiddenIncoming = null;\n      this.resetArm();\n      super.deactivate();\n      this.scheduleOrphanCheck(this.held);\n      return;\n    }\n\n    const env = this.currentEnv;\n    const ref = super.detach();\n    this.container.insert(ref.hostView);\n    this.held = ref;\n    this.guardHeldInjector(env, ref);\n    this.scheduleOrphanCheck(ref);\n  }\n\n  /** Drop the hold if no activation follows the deactivation in the same pass. */\n  private scheduleOrphanCheck(ref: ComponentRef<unknown>): void {\n    queueMicrotask(() => {\n      if (this.held === ref && !this.armed) {\n        this.dropHeld();\n      }\n    });\n  }\n\n  override attach(ref: ComponentRef<unknown>, route: ActivatedRoute): void {\n    // RouteReuseStrategy re-attachment: stored views reappear without a transition.\n    this.dropHeld();\n    this.resetArm();\n    super.attach(ref, route);\n    this.armImmediate();\n  }\n\n  override ngOnDestroy(): void {\n    this.swapEpoch++;\n    const wasHolding = !!this.held;\n    this.armed = false;\n    this.dropHeld();\n    this.visualCommit.release(this);\n    if (wasHolding) this.swapCommit.emit({ outcome: 'outlet-destroyed' });\n    super.ngOnDestroy();\n  }\n\n  private arm(): void {\n    this.armed = true;\n    this.visualCommit.arm(this);\n    this.sawPending = untracked(this.incomingPending);\n    // Fallback for an incoming route that loads nothing.\n    afterNextRender(\n      () => {\n        if (\n          this.armed &&\n          !this.sawPending &&\n          !untracked(this.incomingPending)\n        ) {\n          this.commitSwap();\n        }\n      },\n      { injector: this.outletInjector },\n    );\n  }\n\n  private resetArm(): void {\n    if (this.armed) this.report('superseded');\n    this.armed = false;\n    this.sawPending = false;\n    this.swapEpoch++;\n    this.outgoingRefs.clear();\n  }\n\n  /** An activation that never holds still owes the navigation one render before it is visible. */\n  private armImmediate(): void {\n    this.visualCommit.arm(this);\n    afterNextRender(() => this.report('immediate'), {\n      injector: this.outletInjector,\n    });\n  }\n\n  private report(outcome: SwapCommitEvent['outcome']): void {\n    if (outcome === 'committed' || outcome === 'immediate')\n      this.visualCommit.settle(this, this.incomingRootNodes()[0] ?? null);\n    else this.visualCommit.release(this);\n    this.swapCommit.emit({ outcome });\n  }\n\n  /** Bumped on re-target/reset so a deferred `startViewTransition` from a superseded swap can't fire. */\n  private swapEpoch = 0;\n\n  private commitSwap(): void {\n    if (!this.held) return;\n\n    const useViewTransition =\n      this.viewTransition() ?? this.routerViewTransitions.enabled;\n\n    if (\n      useViewTransition &&\n      typeof document !== 'undefined' &&\n      document.startViewTransition\n    ) {\n      const epoch = this.swapEpoch;\n      document.startViewTransition(() => this.finishSwap(epoch));\n    } else {\n      this.finishSwap(this.swapEpoch);\n    }\n  }\n\n  private finishSwap(epoch: number): void {\n    if (epoch !== this.swapEpoch) return; // superseded while deferred, and already reported\n    this.dropHeld();\n    if (this.hiddenIncoming) {\n      this.setHidden(this.hiddenIncoming, false);\n      this.hiddenIncoming = null;\n    }\n    this.armed = false; // this arm committed — the reset below must not read it as superseded\n    this.resetArm();\n    this.report('committed');\n  }\n\n  /** Commit immediately if the held view's env injector is destroyed under it. */\n  private guardHeldInjector(\n    env: EnvironmentInjector | null,\n    ref: ComponentRef<unknown>,\n  ): void {\n    if (!env) return;\n    try {\n      const destroyRef = env.get(DestroyRef, null);\n      if (!destroyRef) return;\n      this.releaseHeldGuard = destroyRef.onDestroy(() => {\n        this.releaseHeldGuard = null;\n        if (this.held === ref) this.commitSwap();\n      });\n    } catch {\n      // injector already destroyed\n    }\n  }\n\n  private dropHeld(): void {\n    this.releaseHeldGuard?.();\n    this.releaseHeldGuard = null;\n    if (!this.held) return;\n    const instance = this.held.instance;\n    this.held.destroy();\n    this.held = null;\n    this.deactivateEvents.emit(instance);\n  }\n\n  private incomingRootNodes(): HTMLElement[] {\n    const view = this.container.get(this.container.length - 1);\n    if (!view) return [];\n    return ((view as EmbeddedViewRef<unknown>).rootNodes as Node[]).filter(\n      (n): n is HTMLElement =>\n        (typeof HTMLElement !== 'undefined' && n instanceof HTMLElement) ||\n        (typeof SVGElement !== 'undefined' && n instanceof SVGElement),\n    );\n  }\n\n  /**\n   * `display: none` already removes the staged view from layout and the a11y tree; `inert` is the\n   * belt to that pair of braces, covering anything that reaches the subtree by other means\n   * (programmatic focus, `find-in-page`, a descendant that overrides the display).\n   */\n  private setHidden(nodes: HTMLElement[], hidden: boolean): void {\n    for (const el of nodes) {\n      el.style.display = hidden ? 'none' : '';\n      if (hidden) el.setAttribute('inert', '');\n      else el.removeAttribute('inert');\n    }\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["parsePathSegment","token","filter"],"mappings":";;;;;;;;;;;AA6BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;SACa,kBAAkB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,uBAAuB,CAAC,CAAC,KAAK;AAC9C;AAEA,MAAM,IAAI,GAAsB,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE;AAEtE;;;;AAIG;MAEU,uBAAuB,CAAA;AACjB,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC5C;;;AAGG;IACc,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClD,OAAO,GAAG,MAAM,CAAoB,IAAI;gFAAC;AAEjD,IAAA,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;AAE1C;;;;AAIG;AACc,IAAA,IAAI,GAAG,IAAI,GAAG,EAAkB;;AAEhC,IAAA,KAA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