{"version":3,"file":"ng-primitives-internal.mjs","sources":["../../../../packages/ng-primitives/internal/src/utilities/element-ref.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation-manager.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation.ts","../../../../packages/ng-primitives/internal/src/hover-bridge/hover-bridge.ts","../../../../packages/ng-primitives/internal/src/hover-bridge/transit-tracker.ts","../../../../packages/ng-primitives/internal/src/hover-bridge/hover-bridge-controller.ts","../../../../packages/ng-primitives/internal/src/signals/explicit-effect.ts","../../../../packages/ng-primitives/internal/src/style-injector/style-injector.ts","../../../../packages/ng-primitives/internal/src/utilities/resize.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-removal.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-sort.ts","../../../../packages/ng-primitives/internal/src/utilities/escape-key-claims.ts","../../../../packages/ng-primitives/internal/src/utilities/focus-restoration.ts","../../../../packages/ng-primitives/internal/src/utilities/labelled-by-trigger.ts","../../../../packages/ng-primitives/internal/src/utilities/mutation-observer.ts","../../../../packages/ng-primitives/internal/src/utilities/render-list.ts","../../../../packages/ng-primitives/internal/src/utilities/scrolling.ts","../../../../packages/ng-primitives/internal/src/utilities/typeahead.ts","../../../../packages/ng-primitives/internal/src/ng-primitives-internal.ts"],"sourcesContent":["import { ElementRef, inject } from '@angular/core';\n\n/**\n * A simple utility function to inject an element reference with less boilerplate.\n * @returns The element reference.\n */\nexport function injectElementRef<T extends HTMLElement>(): ElementRef<T> {\n  return inject(ElementRef);\n}\n","import { ClassProvider, inject, Injectable } from '@angular/core';\nimport type { NgpExitAnimation } from './exit-animation';\n\n@Injectable()\nexport class NgpExitAnimationManager {\n  /** Store the instances of the exit animation directive. */\n  private readonly instances: NgpExitAnimation[] = [];\n\n  /** Add an instance to the manager. */\n  add(instance: NgpExitAnimation): void {\n    this.instances.push(instance);\n  }\n\n  /** Remove an instance from the manager. */\n  remove(instance: NgpExitAnimation): void {\n    const index = this.instances.indexOf(instance);\n    if (index !== -1) {\n      this.instances.splice(index, 1);\n    }\n  }\n\n  /** Exit all instances. */\n  async exit(): Promise<void> {\n    await Promise.all(this.instances.map(instance => instance.exit()));\n  }\n}\n\nexport function provideExitAnimationManager(): ClassProvider {\n  return { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager };\n}\n\nexport function injectExitAnimationManager(): NgpExitAnimationManager {\n  return inject(NgpExitAnimationManager);\n}\n","import { Directive, OnDestroy } from '@angular/core';\nimport { injectElementRef } from '../utilities/element-ref';\nimport { injectExitAnimationManager } from './exit-animation-manager';\n\n@Directive({\n  selector: '[ngpExitAnimation]',\n  exportAs: 'ngpExitAnimation',\n})\nexport class NgpExitAnimation implements OnDestroy {\n  /** The animation manager. */\n  private readonly animationManager = injectExitAnimationManager();\n  /** Access the element reference. */\n  protected readonly elementRef = injectElementRef();\n\n  /** Exist animation reference. */\n  protected readonly ref = setupExitAnimation({ element: this.elementRef.nativeElement });\n\n  constructor() {\n    this.animationManager.add(this);\n  }\n\n  ngOnDestroy(): void {\n    this.animationManager.remove(this);\n  }\n\n  /** Mark the element as exiting. */\n  async exit(): Promise<void> {\n    await this.ref.exit();\n  }\n}\n\ninterface NgpExitAnimationOptions {\n  /** The element to animate. */\n  element: HTMLElement;\n  /** If true, skip requestAnimationFrame delay and set enter state immediately. */\n  immediate?: boolean;\n}\n\nexport interface NgpExitAnimationRef {\n  /** Mark the element as exiting and wait for the animation to finish. */\n  exit: () => Promise<void>;\n  /** Cancel an in-progress exit animation and transition back to enter state. */\n  cancel: () => void;\n  /** End an in-progress exit animation now, leaving the element on its way out. */\n  finish: () => void;\n}\n\n/**\n * Buffer (ms) added to the longest animation's own computed duration when arming\n * the fallback timeout, so the timeout only fires once the animation should have\n * finished but `finished` failed to settle. Matches the native `animate.leave`\n * class runner's `longest.duration + 50`.\n */\nconst EXIT_ANIMATION_FALLBACK_BUFFER = 50;\n\n/** Whether an animation repeats forever, and so will never resolve `finished`. */\nfunction isInfinite(animation: Animation): boolean {\n  return animation.effect?.getComputedTiming().iterations === Infinity;\n}\n\n/**\n * The defensive fallback delay for a set of exit animations: the longest\n * animation's own end time plus a small buffer. Used only as a safety net - if\n * `finished` (the authoritative signal) never settles, teardown still proceeds\n * shortly after the animation should have ended. Derived from each animation's\n * declared timing, so a healthy long animation is never cut short. Mirrors\n * native's CSS `animate.leave` fallback (`longest.duration + 50`, uncapped).\n */\nfunction exitAnimationFallbackTimeout(animations: Animation[]): number {\n  let longest = 0;\n  for (const animation of animations) {\n    const endTime = animation.effect?.getComputedTiming().endTime;\n    if (typeof endTime === 'number' && Number.isFinite(endTime)) {\n      longest = Math.max(longest, endTime);\n    }\n  }\n  return longest + EXIT_ANIMATION_FALLBACK_BUFFER;\n}\n\nexport function setupExitAnimation({\n  element,\n  immediate,\n}: NgpExitAnimationOptions): NgpExitAnimationRef {\n  let state: 'enter' | 'exit' = 'enter';\n  let exitResolve: (() => void) | null = null;\n  let exitTimeout: ReturnType<typeof setTimeout> | null = null;\n\n  // Whether this environment can actually run and observe CSS animations. On the\n  // server (or any non-DOM environment) there is nothing to animate or wait for,\n  // so enter/exit collapse to synchronous attribute toggles.\n  const canAnimate = typeof element.getAnimations === 'function';\n\n  function setState(newState: 'enter' | 'exit') {\n    state = newState;\n\n    // remove all current animation state attributes\n    element.removeAttribute('data-enter');\n    element.removeAttribute('data-exit');\n\n    // add the new animation state attribute\n    if (state === 'enter') {\n      element.setAttribute('data-enter', '');\n    } else if (state === 'exit') {\n      element.setAttribute('data-exit', '');\n    }\n  }\n\n  function clearExitTimeout() {\n    if (exitTimeout !== null) {\n      clearTimeout(exitTimeout);\n      exitTimeout = null;\n    }\n  }\n\n  let pendingEnterFrame: number | null = null;\n\n  // Set the initial state to 'enter' - immediately if instant or if there is no\n  // `requestAnimationFrame` to defer to (e.g. server-side rendering), otherwise\n  // next frame so the browser registers the \"from\" state and plays the enter\n  // transition.\n  if (immediate || typeof requestAnimationFrame !== 'function') {\n    setState('enter');\n  } else {\n    pendingEnterFrame = requestAnimationFrame(() => {\n      // `exit()` clears the handle to supersede this callback, so a cleared handle means\n      // the element left before the frame arrived and is no longer entering.\n      if (pendingEnterFrame === null) {\n        return;\n      }\n\n      pendingEnterFrame = null;\n      setState('enter');\n    });\n  }\n\n  return {\n    exit: () => {\n      return new Promise<void>(resolve => {\n        exitResolve = resolve;\n\n        // Supersede the queued enter frame. Leaving before it arrives would otherwise let\n        // the callback for an entrance that never happened land afterwards and mark an\n        // element on its way out as entering, so its exit animation never plays. The\n        // callback checks the handle, so clearing it is enough - there is nothing to gain\n        // from also cancelling a frame whose callback now returns immediately.\n        pendingEnterFrame = null;\n\n        setState('exit');\n\n        const settle = () => {\n          // Only the currently active cycle may clear the shared timeout/resolver.\n          // `cancel()` rejects the running animations' `finished` promises\n          // asynchronously (AbortError), so a superseded cycle's `settle()` can\n          // fire after a new exit() has started on the same ref (exit → cancel →\n          // exit, via the portal's cancelDetach). A stale settle() must not clear\n          // the new cycle's fallback timer or null its resolver.\n          if (exitResolve === resolve) {\n            clearExitTimeout();\n            exitResolve = null;\n          }\n          resolve();\n        };\n\n        // Nothing to wait for when the environment can't run animations.\n        if (!canAnimate) {\n          settle();\n          return;\n        }\n\n        // Only wait for animations that will actually finish. Infinite\n        // animations (e.g. a spinner or pulse on the element) never resolve\n        // their `finished` promise, so waiting on them would leave the element\n        // - and any overlay it belongs to - stuck on screen forever.\n        const animations = element.getAnimations().filter(animation => !isInfinite(animation));\n\n        // No finite exit animation - remove immediately.\n        if (animations.length === 0) {\n          settle();\n          return;\n        }\n\n        // Defensive fallback: `finished` is the authoritative signal, but if it\n        // never settles (a paused/stuck animation, or a browser quirk) teardown\n        // must still proceed. Mirrors the native `animate.leave` fallback timeout.\n        exitTimeout = setTimeout(settle, exitAnimationFallbackTimeout(animations));\n\n        // Resolve - never reject - once every finite animation settles. A\n        // rejected exit would propagate through `detach()` and leave the overlay\n        // in the DOM forever, so errors (including the AbortError raised when the\n        // element is removed mid-animation) resolve exactly like success.\n        Promise.allSettled(animations.map(anim => anim.finished)).then(settle);\n      });\n    },\n    finish: () => {\n      if (state !== 'exit') {\n        return;\n      }\n\n      clearExitTimeout();\n\n      // Jump to the animation's end state rather than cancelling: the element is\n      // leaving, and cancel() would snap it back to how it looked before the\n      // exit began for however long it takes the caller to remove it. Infinite\n      // animations are skipped - `finish()` throws on them, and `exit()` never\n      // waited on them in the first place.\n      const animations = canAnimate ? element.getAnimations() : [];\n      for (const animation of animations) {\n        if (isInfinite(animation)) {\n          continue;\n        }\n        try {\n          animation.finish();\n        } catch {\n          // `finish()` also throws on a paused-at-rate-zero animation, which\n          // nothing here creates but a consumer can. Resolving the exit matters\n          // more than the frame it ends on - throwing past the resolve below\n          // would strand the detach this exists to unstick.\n        }\n      }\n\n      if (exitResolve) {\n        exitResolve();\n        exitResolve = null;\n      }\n    },\n    cancel: () => {\n      if (state === 'exit') {\n        clearExitTimeout();\n        // Cancel any running animations\n        const animations = canAnimate ? element.getAnimations() : [];\n        for (const anim of animations) {\n          anim.cancel();\n        }\n        // Transition back to enter state\n        setState('enter');\n        // Resolve the pending exit promise so detach() completes\n        if (exitResolve) {\n          exitResolve();\n          exitResolve = null;\n        }\n      }\n    },\n  };\n}\n","/**\n * Fallback timeout (ms) after which an idle hover bridge closes the overlay.\n * Shared so tooltip, menu and submenu hover-intent behaviour stay in sync.\n */\nexport const HOVER_BRIDGE_TIMEOUT_MS = 150;\n\n/**\n * Pointer movement below this magnitude (px) on the intent axis is treated as\n * jitter, not a reversal, so a tiny backward twitch doesn't collapse the bridge.\n */\nexport const HOVER_BRIDGE_DIRECTION_TOLERANCE_PX = 2;\n\n/**\n * Idle timeout (ms) applied while the pointer is resting over one of the\n * trigger's siblings instead of the open gap. The corridor holds the sibling\n * container inert for its whole lifetime, so a pointer that has stopped there\n * is waiting on the corridor to end, and gets a much shorter benefit of the\n * doubt than the gap does. Movement still resets the timer either way - only a\n * pointer that has genuinely settled over a sibling closes early.\n */\nexport const HOVER_BRIDGE_SIBLING_TIMEOUT_MS = 80;\n\n/**\n * The band around a row a hand can cross without meaning to - a thin gap\n * between two of them, the padding they sit in. Space that close to a row is\n * treated as the row's surroundings rather than as leaving. Kept deliberately\n * small: past it the pointer is on open ground the user can see they are on\n * (the empty middle of a rail with rows at its top and bottom), and resting\n * there closes on the usual timers.\n */\nexport const HOVER_BRIDGE_ROW_GRACE_PX = 8;\n\nexport interface HoverBridgePoint {\n  x: number;\n  y: number;\n}\n\n/**\n * The dominant axis and sign pointing from the trigger toward the target. Used\n * to reject pointer movement heading away from the target while inside the corridor.\n */\nexport interface HoverBridgeDirection {\n  axis: 'x' | 'y';\n  sign: 1 | -1;\n}\n\ninterface CreateHoverBridgePolygonOptions {\n  triggerRect: DOMRect | null;\n  targetRect: DOMRect | null;\n  exitPoint: HoverBridgePoint;\n  corridorHalfSize?: number;\n}\n\n/**\n * Computes the dominant axis and sign from the trigger toward the target - i.e.\n * which way the pointer must travel to reach the panel. Returns null if either\n * rect is missing.\n */\nexport function getHoverBridgeDirection(\n  triggerRect: DOMRect | null,\n  targetRect: DOMRect | null,\n): HoverBridgeDirection | null {\n  if (!triggerRect || !targetRect) {\n    return null;\n  }\n\n  const dx = targetRect.left + targetRect.width / 2 - (triggerRect.left + triggerRect.width / 2);\n  const dy = targetRect.top + targetRect.height / 2 - (triggerRect.top + triggerRect.height / 2);\n\n  // Prefer the axis on which the rects are separated: a bottom-placed panel that\n  // is wider than its trigger still overlaps it horizontally, so travel must be\n  // vertical even when the centers are further apart horizontally. Being\n  // rect-based (rather than reading the configured placement) keeps this correct\n  // after the overlay flips.\n  const overlapsX = triggerRect.left < targetRect.right && targetRect.left < triggerRect.right;\n  const overlapsY = triggerRect.top < targetRect.bottom && targetRect.top < triggerRect.bottom;\n\n  if (overlapsX !== overlapsY) {\n    return overlapsX\n      ? { axis: 'y', sign: dy >= 0 ? 1 : -1 }\n      : { axis: 'x', sign: dx >= 0 ? 1 : -1 };\n  }\n\n  // Fully separated (diagonal travel) or fully overlapping: fall back to centers.\n  if (Math.abs(dx) >= Math.abs(dy)) {\n    return { axis: 'x', sign: dx >= 0 ? 1 : -1 };\n  }\n\n  return { axis: 'y', sign: dy >= 0 ? 1 : -1 };\n}\n\n/**\n * Builds a pointer grace polygon between the trigger exit point and the target overlay.\n * The polygon is intentionally directional so moving away from the target exits quickly.\n */\nexport function createHoverBridgePolygon({\n  triggerRect,\n  targetRect,\n  exitPoint,\n  corridorHalfSize = 8,\n}: CreateHoverBridgePolygonOptions): HoverBridgePoint[] | null {\n  if (!triggerRect || !targetRect) {\n    return null;\n  }\n\n  const direction = getHoverBridgeDirection(triggerRect, targetRect);\n  if (!direction) {\n    return null;\n  }\n\n  if (direction.axis === 'x') {\n    const targetX = direction.sign >= 0 ? targetRect.left : targetRect.right;\n    return [\n      { x: exitPoint.x, y: exitPoint.y - corridorHalfSize },\n      { x: exitPoint.x, y: exitPoint.y + corridorHalfSize },\n      { x: targetX, y: targetRect.bottom + corridorHalfSize },\n      { x: targetX, y: targetRect.top - corridorHalfSize },\n    ];\n  }\n\n  const targetY = direction.sign >= 0 ? targetRect.top : targetRect.bottom;\n  return [\n    { x: exitPoint.x - corridorHalfSize, y: exitPoint.y },\n    { x: exitPoint.x + corridorHalfSize, y: exitPoint.y },\n    { x: targetRect.right + corridorHalfSize, y: targetY },\n    { x: targetRect.left - corridorHalfSize, y: targetY },\n  ];\n}\n\n/**\n * Returns true when the point lies inside the provided polygon.\n */\nexport function isPointInHoverBridgePolygon(\n  point: HoverBridgePoint,\n  polygon: HoverBridgePoint[],\n): boolean {\n  let inside = false;\n\n  for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n    const xi = polygon[i].x;\n    const yi = polygon[i].y;\n    const xj = polygon[j].x;\n    const yj = polygon[j].y;\n\n    const intersects =\n      yi > point.y !== yj > point.y &&\n      point.x < ((xj - xi) * (point.y - yi)) / (yj - yi || Number.EPSILON) + xi;\n    if (intersects) {\n      inside = !inside;\n    }\n  }\n\n  return inside;\n}\n","import { signal, Signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\nimport { HOVER_BRIDGE_TIMEOUT_MS } from './hover-bridge';\n\nexport interface HoverTransitTracker {\n  /** @internal */\n  setTransitSource(trigger: HTMLElement): void;\n  /** @internal */\n  clearTransitSource(trigger: HTMLElement): void;\n  /** @internal */\n  isTransitBlocked(trigger: HTMLElement): boolean;\n}\n\n/**\n * Tracks which sibling currently owns a hover corridor so the others can\n * decline an enter the browser had already resolved before the corridor's\n * pointer-events suppression applied. Lives on whichever element holds the\n * siblings - a trigger group for root triggers, the panel itself for submenus.\n */\nexport function createHoverTransitTracker(): HoverTransitTracker {\n  const source = signal<HTMLElement | null>(null);\n\n  return {\n    setTransitSource: trigger => source.set(trigger),\n    clearTransitSource: trigger => {\n      // Only the trigger that claimed the transit may release it, so a newer\n      // corridor isn't cleared by an older one tearing down.\n      if (source() === trigger) {\n        source.set(null);\n      }\n    },\n    isTransitBlocked: trigger => source() !== null && source() !== trigger,\n  };\n}\n\nexport interface HoverTransitDeclineOptions {\n  /** Whether a sibling's corridor currently owns the transit. */\n  isBlocked: () => boolean;\n  /** Whether the pointer is still over this trigger when the retry fires. */\n  isPointerOverTrigger: Signal<boolean>;\n  /** Open this trigger's overlay. */\n  show: () => void;\n}\n\n/**\n * Builds the hover-decline check a trigger runs before opening. Call it from\n * the state factory; the returned function goes in the pointerenter handler and\n * reports whether the hover was declined.\n *\n * A hover that arrives while a sibling's corridor is in flight is declined and\n * retried once that corridor has had time to end - the pointer may have\n * genuinely landed here rather than passing through, and a declined enter is\n * never re-delivered on its own.\n */\nexport function createHoverTransitDecline({\n  isBlocked,\n  isPointerOverTrigger,\n  show,\n}: HoverTransitDeclineOptions): () => boolean {\n  const disposables = injectDisposables();\n  let cancelPendingRetry: (() => void) | undefined = undefined;\n\n  return () => {\n    if (!isBlocked()) {\n      return false;\n    }\n\n    // Only the newest retry is worth keeping - pointer jitter over a blocked\n    // trigger would otherwise stack one per enter for the whole blocked window.\n    cancelPendingRetry?.();\n\n    cancelPendingRetry = disposables.setTimeout(() => {\n      cancelPendingRetry = undefined;\n\n      if (isPointerOverTrigger() && !isBlocked()) {\n        show();\n      }\n    }, HOVER_BRIDGE_TIMEOUT_MS);\n\n    return true;\n  };\n}\n","import { DestroyRef, ElementRef, inject, signal, Signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\nimport {\n  createHoverBridgePolygon,\n  getHoverBridgeDirection,\n  HOVER_BRIDGE_DIRECTION_TOLERANCE_PX,\n  HOVER_BRIDGE_ROW_GRACE_PX,\n  HOVER_BRIDGE_SIBLING_TIMEOUT_MS,\n  HOVER_BRIDGE_TIMEOUT_MS,\n  HoverBridgeDirection,\n  HoverBridgePoint,\n  isPointInHoverBridgePolygon,\n} from './hover-bridge';\n\nexport interface HoverBridgeOptions {\n  /** Whether the pointer is currently over the trigger or the panel (the \"safe\" area). */\n  isPointerInAnchor: () => boolean;\n  /** Close the overlay - called when the pointer leaves the corridor or the idle timer fires. */\n  close: () => void;\n  /**\n   * Require the pointer to keep heading toward the panel. When true, reversing\n   * away along the corridor's dominant axis closes the overlay (menu/submenu).\n   * Tooltips leave this off. Defaults to false.\n   */\n  requireForwardMovement?: boolean;\n  /**\n   * Reset the idle-fallback timer on valid in-corridor movement, so it only\n   * fires after the pointer genuinely stops. When false the timer is a fixed cap\n   * from the moment the corridor is built (tooltip's original semantics).\n   * Defaults to true.\n   */\n  resetFallbackOnMove?: boolean;\n  /** Idle-fallback timeout in ms. Defaults to HOVER_BRIDGE_TIMEOUT_MS. */\n  timeoutMs?: number;\n  /**\n   * Element containing this trigger's siblings. While the bridge is active,\n   * pointer-events are suppressed on it so a sibling can't receive its own\n   * pointerenter mid-transit toward the open panel - the browser's hit-testing\n   * withholds the event entirely rather than the sibling needing to know\n   * anything about this bridge. The trigger itself is exempted. Omit for\n   * triggers with no siblings to protect.\n   */\n  siblingContainer?: () => HTMLElement | null;\n  /**\n   * Notified when sibling suppression engages or releases. Siblings must ignore\n   * their own hover while it is active as well: the browser resolves a\n   * movement's hit-test before dispatching its boundary events, so a fast\n   * sample that jumps straight onto a sibling still delivers that sibling an\n   * enter, whatever pointer-events says by the time it arrives.\n   */\n  onSuppressionChange?: (active: boolean) => void;\n}\n\nexport interface HoverBridgeTrackOptions {\n  triggerRect: DOMRect | null;\n  targetRect: DOMRect | null;\n  exitPoint: HoverBridgePoint;\n}\n\nexport interface HoverBridgeController {\n  /** The active corridor polygon, or null when no bridge is in progress. */\n  readonly polygon: Signal<HoverBridgePoint[] | null>;\n  /** Whether a corridor is currently active. */\n  isActive(): boolean;\n  /**\n   * Build a corridor from the exit point toward the panel and start tracking the\n   * pointer. Returns false (and does nothing) when a polygon can't be built, so\n   * the caller can apply its own fallback.\n   */\n  track(options: HoverBridgeTrackOptions): boolean;\n  /** Tear down the corridor and its global listener/timer. */\n  clear(): void;\n}\n\n/**\n * Refcounted per container, because suppression is not owned by one bridge:\n * every trigger in a group has its own, and they all suppress the same element.\n * A second corridor starting before the first tears down would otherwise record\n * 'none' as the value to put back and leave the container inert for good.\n */\nconst containerSuppressions = new WeakMap<HTMLElement, { count: number; previous: string }>();\n\n/**\n * Shared safe-polygon hover-intent state machine used by the menu, submenu and\n * tooltip triggers. While the pointer travels inside the corridor toward the\n * panel the overlay stays open; it closes when the pointer leaves the corridor,\n * reverses away (when requireForwardMovement is set) or idles past the timeout.\n */\nexport function createHoverBridge({\n  isPointerInAnchor,\n  close,\n  requireForwardMovement = false,\n  resetFallbackOnMove = true,\n  timeoutMs = HOVER_BRIDGE_TIMEOUT_MS,\n  siblingContainer,\n  onSuppressionChange,\n}: HoverBridgeOptions): HoverBridgeController {\n  const disposables = injectDisposables();\n  const destroyRef = inject(DestroyRef);\n  // Optional so the controller can still be created outside an element\n  // injection context; every real caller is a trigger's state factory.\n  const trigger = inject<ElementRef<HTMLElement>>(ElementRef, { optional: true });\n  const polygon = signal<HoverBridgePoint[] | null>(null);\n  let direction: HoverBridgeDirection | null = null;\n  let lastPointer: HoverBridgePoint | null = null;\n  let removePointerMoveListener: (() => void) | undefined = undefined;\n  let fallbackTimeoutId: ReturnType<typeof setTimeout> | undefined = undefined;\n  let suppressedElement: HTMLElement | null = null;\n  // Captured once per corridor: neither element moves while one is in flight,\n  // and reading them back would force layout on every pointermove.\n  let siblingBounds: DOMRect | null = null;\n  let triggerBounds: DOMRect | null = null;\n  // Measured on first use, not with the rects above: a pointer heading straight\n  // for the panel never touches the container's own space, and these are every\n  // row the container lays out - for a submenu, every item in the parent menu.\n  let siblingItemBounds: DOMRect[] | null = null;\n  let previousTriggerPointerEvents = '';\n  let removePressGuards: (() => void) | undefined = undefined;\n\n  // One reusable timer with a single destroy hook. The fallback reschedules on\n  // every in-corridor pointermove, and going through disposables.setTimeout would\n  // register a new DestroyRef cleanup per move that is never released.\n  destroyRef.onDestroy(() => clearTimeout(fallbackTimeoutId));\n\n  // The inline style mutation below is a raw DOM write, not something\n  // disposables tracks, so it needs its own explicit restore on destroy in\n  // case the injector is torn down mid-corridor without clear() running first.\n  destroyRef.onDestroy(() => restoreSiblingPointerEvents());\n\n  /**\n   * Suppress hit-testing on the sibling container for the duration of the\n   * corridor, so a sibling's own pointerenter is never delivered mid-transit -\n   * the browser withholds the event entirely rather than the sibling needing\n   * to know anything about this bridge. The trigger is exempted: the corridor\n   * is latched, so a pointer returning to an inert trigger would read as\n   * leaving the corridor and close the overlay instead of cancelling the\n   * bridge. Paired with capture-phase press guards, since a press while the\n   * container is inert would otherwise reach whatever is now hit-testable\n   * underneath.\n   */\n  function suppressSiblingPointerEvents(): void {\n    // Idempotent, like registerPointerMoveListener - a second track() without an\n    // intervening clear() would otherwise orphan the guards registered here.\n    if (suppressedElement) {\n      return;\n    }\n\n    const element = siblingContainer?.();\n    if (!element) {\n      return;\n    }\n\n    suppressedElement = element;\n\n    const existing = containerSuppressions.get(element);\n    if (existing) {\n      existing.count++;\n    } else {\n      containerSuppressions.set(element, { count: 1, previous: element.style.pointerEvents });\n    }\n\n    element.style.pointerEvents = 'none';\n\n    if (trigger) {\n      previousTriggerPointerEvents = trigger.nativeElement.style.pointerEvents;\n      trigger.nativeElement.style.pointerEvents = 'auto';\n    }\n\n    /**\n     * Only presses over the inert container are blocked - anywhere else on the\n     * page keeps its normal focus and activation behaviour. The trigger keeps\n     * its own presses too: it sits inside the container's rect but is exempt\n     * from the suppression, so a coordinate test alone would cancel the presses\n     * the exemption exists to preserve.\n     */\n    const isPressOnInertSibling = (event: PointerEvent | MouseEvent): boolean => {\n      // Inert the moment this suppression ends, so a guard that outlives its\n      // teardown can never keep swallowing presses over the container.\n      if (suppressedElement !== element) {\n        return false;\n      }\n\n      if (trigger && event.composedPath().includes(trigger.nativeElement)) {\n        return false;\n      }\n\n      const { left, right, top, bottom } = element.getBoundingClientRect();\n      return (\n        event.clientX >= left &&\n        event.clientX <= right &&\n        event.clientY >= top &&\n        event.clientY <= bottom\n      );\n    };\n\n    const removePointerDown = disposables.addEventListener(\n      document,\n      'pointerdown',\n      (event: PointerEvent) => {\n        if (isPressOnInertSibling(event)) {\n          event.preventDefault();\n          event.stopPropagation();\n        }\n      },\n      true,\n    );\n\n    // Cancelling pointerdown stops focus moving but not the click: click is not\n    // a compatibility mouse event, so it still activates whatever the inert\n    // container was covering. Stop it in capture, before it reaches a target.\n    const removeClick = disposables.addEventListener(\n      document,\n      'click',\n      (event: MouseEvent) => {\n        if (isPressOnInertSibling(event)) {\n          event.preventDefault();\n          event.stopPropagation();\n        }\n      },\n      true,\n    );\n\n    removePressGuards = () => {\n      removePointerDown();\n      removeClick();\n    };\n\n    onSuppressionChange?.(true);\n  }\n\n  /**\n   * Restore exactly the element suppression was applied to, not whatever\n   * siblingContainer() resolves to now, and put back whatever inline value it\n   * carried rather than blanking a consumer's own pointer-events.\n   */\n  function restoreSiblingPointerEvents(): void {\n    // Detached first: everything below can throw (onSuppressionChange runs\n    // consumer code), and a leaked document guard would block every press over\n    // the container for the rest of the page's life.\n    removePressGuards?.();\n    removePressGuards = undefined;\n\n    if (suppressedElement) {\n      const suppression = containerSuppressions.get(suppressedElement);\n      if (suppression && --suppression.count === 0) {\n        suppressedElement.style.pointerEvents = suppression.previous;\n        containerSuppressions.delete(suppressedElement);\n      }\n\n      suppressedElement = null;\n\n      if (trigger) {\n        trigger.nativeElement.style.pointerEvents = previousTriggerPointerEvents;\n      }\n\n      onSuppressionChange?.(false);\n    }\n  }\n\n  /**\n   * Deliver the enter the browser withheld. Hit-testing is redone on pointer\n   * movement, not when pointer-events changes back, so a pointer that came to\n   * rest on a sibling while the container was inert is never announced to it -\n   * the overlay closes and the sibling the pointer is sitting on never opens.\n   * This is the boundary event a single pixel of movement would have produced.\n   */\n  function announcePointerToRestoredContainer(\n    container: HTMLElement,\n    point: HoverBridgePoint,\n  ): void {\n    const hit = document.elementFromPoint(point.x, point.y);\n\n    // Nothing to announce when the pointer left the container behind, or when\n    // it is over the trigger, which stayed hit-testable throughout.\n    if (!hit || !container.contains(hit) || trigger?.nativeElement.contains(hit)) {\n      return;\n    }\n\n    // pointerenter does not bubble: the browser fires it on each element from\n    // the container down to the target, and so do we.\n    const chain: Element[] = [];\n    for (let element: Element | null = hit; element; element = element.parentElement) {\n      chain.unshift(element);\n      if (element === container) {\n        break;\n      }\n    }\n\n    for (const element of chain) {\n      element.dispatchEvent(\n        new PointerEvent('pointerenter', {\n          clientX: point.x,\n          clientY: point.y,\n          pointerType: 'mouse',\n        }),\n      );\n    }\n  }\n\n  function isMovingAway(point: HoverBridgePoint): boolean {\n    if (!requireForwardMovement || !direction || !lastPointer) {\n      return false;\n    }\n\n    const delta = direction.axis === 'x' ? point.x - lastPointer.x : point.y - lastPointer.y;\n    return delta * direction.sign < -HOVER_BRIDGE_DIRECTION_TOLERANCE_PX;\n  }\n\n  /**\n   * Half-open, the way the browser's own hit-testing treats a box: a point\n   * exactly on the right or bottom edge belongs to whatever is laid out next,\n   * not to this rect. Element edges land on fractional pixels, so a closed test\n   * disagrees with the browser about which row a resting pointer is on - and a\n   * hand-over to a row the browser has not put the pointer on closes the\n   * overlay with nothing to take its place.\n   */\n  function isWithin(rect: DOMRect | null, { x, y }: HoverBridgePoint, margin = 0): boolean {\n    return (\n      !!rect &&\n      x >= rect.left - margin &&\n      x < rect.right + margin &&\n      y >= rect.top - margin &&\n      y < rect.bottom + margin\n    );\n  }\n\n  /**\n   * Whether the pointer is over one of the trigger's siblings rather than the\n   * open gap. This never rejects the point - the corridor deliberately covers\n   * that ground, because a diagonal approach to the panel has to cross it. It\n   * only shortens how long a pointer that has *stopped* there is waited on.\n   */\n  function isOverSibling(point: HoverBridgePoint): boolean {\n    return isWithin(siblingBounds, point) && !isWithin(triggerBounds, point);\n  }\n\n  /**\n   * Whether the pointer is on the few pixels of layout the container puts\n   * between its rows - the gap between two triggers, the padding around\n   * them - rather than on a row itself. A hand cannot hold a mouse inside a 4px\n   * gap, so treating that strip as \"left\" closes the menu and reopens it on the\n   * next drift back; a pointer resting there is still among the rows, and the\n   * menu stays as it is until a sibling takes the hover or the pointer leaves.\n   *\n   * Deliberately bounded to the rows' immediate surroundings: the empty middle\n   * of a sidebar with rows at its top and bottom is open ground, not a gap, and\n   * a pointer parked out there closes on the usual timers.\n   */\n  function isOverContainerDeadSpace(point: HoverBridgePoint): boolean {\n    if (!isOverSibling(point)) {\n      return false;\n    }\n\n    const rows = (siblingItemBounds ??= readSiblingItemBounds());\n\n    if (rows.some(rect => isWithin(rect, point))) {\n      return false;\n    }\n\n    return [triggerBounds, ...rows].some(rect => isWithin(rect, point, HOVER_BRIDGE_ROW_GRACE_PX));\n  }\n\n  /**\n   * The rows the container lays out around this trigger. Read from the\n   * trigger's own DOM siblings rather than the container's descendants: what\n   * counts as occupied space is whatever shares the trigger's row box - a\n   * sibling trigger, a plain menu item, a wrapper around either. Called at most\n   * once per corridor, the first time the pointer is over the container.\n   *\n   * Deliberately does not consult `siblingContainer()`: the caller has already\n   * placed the pointer inside the container the corridor captured, and re-asking\n   * the live accessor would return null - and drop the rows - if tracking were\n   * switched off mid-corridor, while every other rect stayed as captured.\n   */\n  function readSiblingItemBounds(): DOMRect[] {\n    const self = trigger?.nativeElement;\n    const parent = self?.parentElement;\n\n    if (!self || !parent) {\n      return [];\n    }\n\n    return Array.from(parent.children)\n      .filter(child => child !== self)\n      .map(child => child.getBoundingClientRect());\n  }\n\n  /** (Re)start the idle timer - reset on valid movement so it only fires when idle. */\n  function scheduleFallback(delay: number = timeoutMs): void {\n    clearTimeout(fallbackTimeoutId);\n\n    fallbackTimeoutId = setTimeout(() => {\n      fallbackTimeoutId = undefined;\n\n      if (!polygon()) {\n        return;\n      }\n\n      // A pointer resting on the container's inert space hasn't gone anywhere.\n      // The corridor stays live with no timer pending: only movement can change\n      // where the pointer is, and movement reschedules this.\n      if (lastPointer && isOverContainerDeadSpace(lastPointer)) {\n        return;\n      }\n\n      // Always tear the corridor down, whether or not the overlay should close\n      // with it. Leaving it live because the pointer happens to be in the safe\n      // area would strand the container suppressed with no timer pending and\n      // nothing but a future pointermove to rescue it.\n      const shouldClose = !isPointerInAnchor();\n      // Where the pointer came to rest. Only sound on this path: the timer\n      // fires precisely because nothing has moved since.\n      const restingPoint = lastPointer;\n      const restoredContainer = suppressedElement;\n      clear();\n\n      if (shouldClose) {\n        close();\n      }\n\n      if (restingPoint && restoredContainer) {\n        announcePointerToRestoredContainer(restoredContainer, restingPoint);\n      }\n    }, delay);\n  }\n\n  function registerPointerMoveListener(): void {\n    if (removePointerMoveListener) {\n      return;\n    }\n\n    const cleanup = disposables.addEventListener(\n      document,\n      'pointermove',\n      (event: PointerEvent): void => {\n        if (isPointerInAnchor() || !polygon()) {\n          clear();\n          return;\n        }\n\n        const point: HoverBridgePoint = { x: event.clientX, y: event.clientY };\n        const away = isMovingAway(point);\n        lastPointer = point;\n\n        // The corridor's geometry doesn't apply over the container's inert\n        // space: the pointer is parked among the rows, so the corridor just\n        // keeps watching for it to leave.\n        if (isOverContainerDeadSpace(point)) {\n          return;\n        }\n\n        if (!isPointInHoverBridgePolygon(point, polygon()!) || away) {\n          clear();\n          close();\n          return;\n        }\n\n        // Valid movement toward the panel - reset the idle fallback so a slow\n        // but continuous traversal isn't cut off mid-corridor. Callers that want\n        // a fixed cap (tooltip) opt out via resetFallbackOnMove: false.\n        if (resetFallbackOnMove) {\n          scheduleFallback(\n            isOverSibling(point) ? Math.min(HOVER_BRIDGE_SIBLING_TIMEOUT_MS, timeoutMs) : timeoutMs,\n          );\n        }\n      },\n      true,\n    );\n\n    removePointerMoveListener = () => {\n      cleanup();\n      removePointerMoveListener = undefined;\n    };\n  }\n\n  function track({ triggerRect, targetRect, exitPoint }: HoverBridgeTrackOptions): boolean {\n    const points = createHoverBridgePolygon({ triggerRect, targetRect, exitPoint });\n    if (!points) {\n      return false;\n    }\n\n    polygon.set(points);\n    direction = getHoverBridgeDirection(triggerRect, targetRect);\n    lastPointer = exitPoint;\n    siblingBounds = siblingContainer?.()?.getBoundingClientRect() ?? null;\n    triggerBounds = trigger?.nativeElement.getBoundingClientRect() ?? null;\n    siblingItemBounds = null;\n    registerPointerMoveListener();\n    // Deliberately the full window, whatever the exit point sits over: the gap\n    // between two stacked triggers belongs to the container, so leaving one and\n    // pausing to aim would otherwise get the short sibling window at the very\n    // moment a pause is most likely. The first move re-evaluates.\n    scheduleFallback();\n    suppressSiblingPointerEvents();\n    return true;\n  }\n\n  function clear(): void {\n    polygon.set(null);\n    direction = null;\n    lastPointer = null;\n    siblingBounds = null;\n    triggerBounds = null;\n    siblingItemBounds = null;\n    clearTimeout(fallbackTimeoutId);\n    fallbackTimeoutId = undefined;\n    removePointerMoveListener?.();\n    restoreSiblingPointerEvents();\n  }\n\n  return {\n    polygon: polygon.asReadonly(),\n    isActive: () => polygon() !== null,\n    track,\n    clear,\n  };\n}\n","/**\n * This implementation is heavily inspired by the great work on ngextension!\n * https://github.com/ngxtension/ngxtension-platform/blob/main/libs/ngxtension/explicit-effect/src/explicit-effect.ts\n */\nimport {\n  CreateEffectOptions,\n  EffectCleanupRegisterFn,\n  EffectRef,\n  effect,\n  untracked,\n} from '@angular/core';\n\n/**\n * We want to have the Tuple in order to use the types in the function signature\n */\ntype ExplicitEffectValues<T> = {\n  [K in keyof T]: () => T[K];\n};\n\n/**\n * This explicit effect function will take the dependencies and the function to run when the dependencies change.\n * @param deps - The dependencies that the effect will run on\n * @param fn - The function to run when the dependencies change\n * @param options - The options for the effect with the addition of defer (it allows the computation to run on first change, not immediately)\n */\nexport function explicitEffect<Input extends readonly unknown[], Params = Input>(\n  deps: readonly [...ExplicitEffectValues<Input>],\n  fn: (deps: Params, onCleanup: EffectCleanupRegisterFn) => void,\n  options?: CreateEffectOptions,\n): EffectRef {\n  return effect(onCleanup => {\n    const depValues = deps.map(s => s());\n    untracked(() => fn(depValues as Params, onCleanup));\n  }, options);\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { CSP_NONCE, inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n/**\n * A utility service for injecting styles into the document.\n * Angular doesn't allow directives to specify styles, only components.\n * As we ship directives, occasionally we need to associate styles with them.\n * This service allows us to programmatically inject styles into the document.\n */\n@Injectable({\n  providedIn: 'root',\n})\nexport class StyleInjector {\n  /**\n   * Access the CSP nonce\n   */\n  private readonly cspNonce = inject(CSP_NONCE, { optional: true });\n\n  /**\n   * Access the document.\n   */\n  private readonly document = inject(DOCUMENT);\n\n  /**\n   * Detect the platform.\n   */\n  private readonly platformId = inject(PLATFORM_ID);\n\n  /**\n   * Store the map of style elements with their unique identifiers.\n   */\n  private readonly styleElements = new Map<string, HTMLStyleElement>();\n\n  constructor() {\n    if (isPlatformBrowser(this.platformId)) {\n      this.collectServerStyles();\n    }\n  }\n\n  /**\n   * Inject a style into the document.\n   * @param id The unique identifier for the style.\n   * @param style The style to inject.\n   */\n  add(id: string, style: string): void {\n    if (this.styleElements.has(id)) {\n      return;\n    }\n\n    const styleElement = this.document.createElement('style');\n    styleElement.setAttribute('data-ngp-style', id);\n    styleElement.textContent = style;\n\n    // If a CSP nonce is provided, set it on the style element\n    if (this.cspNonce) {\n      styleElement.setAttribute('nonce', this.cspNonce);\n    }\n\n    this.document.head.appendChild(styleElement);\n    this.styleElements.set(id, styleElement);\n  }\n\n  /**\n   * Remove a style from the document.\n   * @param id The unique identifier for the style.\n   */\n  remove(id: string): void {\n    const styleElement = this.styleElements.get(id);\n\n    if (styleElement) {\n      this.document.head.removeChild(styleElement);\n      this.styleElements.delete(id);\n    }\n  }\n\n  /**\n   * Collect any styles that were rendered by the server.\n   */\n  private collectServerStyles(): void {\n    const styleElements = this.document.querySelectorAll<HTMLStyleElement>('style[data-ngp-style]');\n\n    styleElements.forEach(styleElement => {\n      const id = styleElement.getAttribute('data-ngp-style');\n\n      if (id) {\n        this.styleElements.set(id, styleElement);\n      }\n    });\n  }\n}\n\nexport function injectStyleInjector(): StyleInjector {\n  return inject(StyleInjector);\n}\n","import { isPlatformServer } from '@angular/common';\nimport {\n  DestroyRef,\n  effect,\n  inject,\n  Injector,\n  PLATFORM_ID,\n  signal,\n  Signal,\n  untracked,\n} from '@angular/core';\nimport { isUndefined, safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { Observable, Subscription } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { explicitEffect } from '../signals/explicit-effect';\nimport { injectElementRef } from './element-ref';\n\ninterface NgpResizeObserverOptions {\n  /**\n   * Whether to listen for events.\n   */\n  disabled?: Signal<boolean>;\n\n  /**\n   * The injector to use when called from outside of the injector context.\n   */\n  injector?: Injector;\n}\n\n/**\n * A simple helper function to create a resize observer as an RxJS Observable.\n *\n * An HTML element is measured by its untransformed border box. An element inside an\n * `<svg>` has no CSS box, so it is measured on screen, transforms included, and is\n * remeasured when it or its outermost `<svg>` resizes - not when a transform changes.\n * @param element The element to observe for resize events.\n * @returns The resize event as an Observable.\n */\nexport function fromResizeEvent(\n  element: Element,\n  { disabled = signal(false), injector }: NgpResizeObserverOptions = {},\n): Observable<Dimensions> {\n  const platformId = injector?.get(PLATFORM_ID) ?? inject(PLATFORM_ID);\n\n  return new Observable(observable => {\n    // ResizeObserver may not be available in all environments, so check for its existence\n    if (isPlatformServer(platformId) || isUndefined(window?.ResizeObserver)) {\n      // ResizeObserver is not available (SSR or unsupported browser)\n      // Complete the observable without emitting any values\n      observable.complete();\n      return;\n    }\n\n    let observer: ResizeObserver | null = null;\n    let lastEmitted: Dimensions | null = null;\n\n    // The deferred baseline below and the observer's own initial callback both report\n    // the starting size, so a rendered element would otherwise announce it twice.\n    // Consumers that treat every emission as a change — the thread viewport skips the\n    // baseline to find real resizes — would act on that duplicate as if the element\n    // had resized.\n    function emit(dimensions: Dimensions): void {\n      if (\n        lastEmitted &&\n        lastEmitted.width === dimensions.width &&\n        lastEmitted.height === dimensions.height\n      ) {\n        return;\n      }\n\n      lastEmitted = dimensions;\n      observable.next(dimensions);\n    }\n\n    function setupOrTeardownObserver() {\n      if (disabled()) {\n        if (observer) {\n          observer.disconnect();\n          observer = null;\n          // Re-enabling should produce a fresh baseline even at an unchanged size.\n          lastEmitted = null;\n        }\n        return;\n      }\n\n      if (!observer) {\n        observer = new ResizeObserver(entries => {\n          // if there are no entries, ignore the event\n          if (!entries.length) {\n            return;\n          }\n\n          // otherwise, take the first entry and emit the dimensions. The entry can belong to\n          // the outer `<svg>`, but an element inside one is measured without it.\n          const entry = entries[0];\n          emit(getElementDimensions(element, entry));\n        });\n\n        observer.observe(element);\n\n        // Emit an initial measurement to avoid one-frame stale layout while waiting\n        // for the first ResizeObserver callback, but defer it to a microtask.\n        //\n        // Measuring here synchronously would force a layout flush in the middle of\n        // whatever is creating the element, so a framework creating N observed\n        // elements in one pass pays N interleaved reflows — the cost grows with the\n        // document, and on a dense page it blocks the main thread for seconds.\n        // Microtasks run after the current task's DOM writes but still before paint,\n        // so every element created in that pass shares a single layout flush and the\n        // measurement is no less timely.\n        //\n        // The observer's own initial callback is not a substitute. It does fire for a\n        // newly observed element, but it is delivered at rendering time — before paint,\n        // yet after every microtask — so anything reading the measurement in the\n        // current task still sees the pre-observation value. A tooltip hovered in the\n        // same task it rendered would decide it has no overflow and never open.\n        queueMicrotask(() => {\n          // `observer` is nulled on teardown, so an unsubscribed observable performs no\n          // measurement — the layout read is the cost this whole change exists to avoid.\n          if (observer) {\n            // Resizing an `<svg>` rescales what is inside it without changing its box in\n            // user units, which is all the observer watches for those elements. Resolved\n            // here rather than on subscribe, when an `@for` element is not attached yet.\n            const viewport = getOutermostSvg(element);\n            if (viewport) {\n              observer.observe(viewport);\n            }\n\n            emit(getElementDimensions(element));\n          }\n        });\n      }\n    }\n\n    setupOrTeardownObserver();\n\n    const disabledEffect = explicitEffect([disabled], () => setupOrTeardownObserver(), {\n      injector,\n    });\n\n    return () => {\n      // The effect lives on its injector, not the subscription, so without this a later\n      // `disabled` change would build a fresh observer — and schedule a fresh layout\n      // read — for a subscription nobody is listening to.\n      disabledEffect.destroy();\n      observer?.disconnect();\n      observer = null;\n    };\n  });\n}\n\n/**\n * A utility function to observe any element for resize events and return the dimensions as a signal.\n */\nexport function observeResize(elementFn: () => HTMLElement | undefined): Signal<Dimensions> {\n  const dimensions = signal<Dimensions>({ width: 0, height: 0 });\n  const injector = inject(Injector);\n  const destroyRef = inject(DestroyRef);\n\n  // store the subscription to the resize event\n  let subscription: Subscription | null = null;\n\n  effect(() => {\n    const targetElement = elementFn();\n\n    untracked(() => {\n      if (!targetElement) {\n        return;\n      }\n\n      // if we already have a subscription, unsubscribe from it\n      subscription?.unsubscribe();\n\n      // create a new subscription to the resize event\n      subscription = fromResizeEvent(targetElement, { injector })\n        .pipe(safeTakeUntilDestroyed(destroyRef))\n        .subscribe(event => dimensions.set({ width: event.width, height: event.height }));\n    });\n  });\n\n  return dimensions;\n}\n\n// Checked by namespace rather than `instanceof`, which is false for an element from\n// another window, such as an iframe.\nfunction isSvgElement(element: Element): element is SVGElement {\n  return element.namespaceURI === 'http://www.w3.org/2000/svg';\n}\n\nfunction isHtmlElement(element: Element): element is HTMLElement {\n  return element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n}\n\nfunction getOutermostSvg(element: Element): SVGSVGElement | null {\n  let svg = isSvgElement(element) ? element.ownerSVGElement : null;\n  while (svg?.ownerSVGElement) {\n    svg = svg.ownerSVGElement;\n  }\n  return svg;\n}\n\nfunction getElementDimensions(element: Element, entry?: ResizeObserverEntry): Dimensions {\n  // Only the outermost `<svg>` has a CSS box. For anything inside it, shapes and nested\n  // `<svg>` alike, the observer reports a box in user units, before the `viewBox` scales\n  // it, so both paths measure it on screen instead.\n  if (isSvgElement(element) && element.ownerSVGElement) {\n    const rect = element.getBoundingClientRect();\n    return { width: rect.width, height: rect.height };\n  }\n\n  if (!entry) {\n    // Match what the observer reports: an untransformed border-box size at full\n    // precision. `offsetWidth`/`offsetHeight` are untransformed but round to whole\n    // pixels, and `getBoundingClientRect()` is fractional but includes transforms —\n    // either would describe the same unchanged element differently from the observer,\n    // reporting the wrong number and defeating the de-duplication above.\n    return measureBorderBox(element);\n  }\n\n  const borderSizeEntry = entry.borderBoxSize;\n  // this may be different across browsers so normalize it\n  const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;\n  const width = borderSize.inlineSize;\n  const height = borderSize.blockSize;\n\n  // For inline elements, ResizeObserver may report 0,0 dimensions\n  // Use getBoundingClientRect as fallback for inline elements with zero dimensions\n  if ((width === 0 || height === 0) && getComputedStyle(element).display === 'inline') {\n    const rect = element.getBoundingClientRect();\n    return { width: rect.width, height: rect.height };\n  }\n\n  return { width, height };\n}\n\n/**\n * The element's border-box size, excluding any transform, in fractional pixels —\n * the same quantity a `ResizeObserver` entry reports.\n *\n * `width`/`height` resolve to whichever box `box-sizing` selects, so only the\n * content-box case has to add padding, borders and the scrollbar back on.\n */\nfunction measureBorderBox(element: Element): Dimensions {\n  const style = getComputedStyle(element);\n\n  // Only a px length is a measurement: a non-rendered element keeps its units, so an\n  // inline box resolves to `auto` and a hidden percentage width stays `50%`. Fall back\n  // to the rect, which is what the observer path uses for inline elements too — the\n  // observer reports 0x0 for an inline box, so measuring differently here would\n  // announce an unchanged size twice, and inline triggers are the common case.\n  // `transform` does not apply to non-replaced inline boxes, so the rect is the\n  // untransformed border box for them.\n  if (!style.width.endsWith('px') || !style.height.endsWith('px')) {\n    const rect = element.getBoundingClientRect();\n    return { width: rect.width, height: rect.height };\n  }\n\n  const width = parseFloat(style.width);\n  const height = parseFloat(style.height);\n\n  if (style.boxSizing === 'border-box') {\n    return { width, height };\n  }\n\n  const borderHorizontal = parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth);\n  const borderVertical = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);\n  const paddingHorizontal = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\n  const paddingVertical = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);\n\n  // A scrollbar comes off the content box but is part of the border box the observer\n  // reports, so it has to be added back or the same unchanged element measures a\n  // scrollbar smaller here than it does there. Only a scroll container has one, and\n  // `offsetWidth`/`clientWidth` cost layout, so the common case stays unmeasured; they\n  // are whole pixels, so a fractional border can leave a sub-pixel remainder. An `<svg>`\n  // clips its overflow by default but has no offset size and never shows a scrollbar.\n  const scrollable =\n    isHtmlElement(element) && (style.overflowX !== 'visible' || style.overflowY !== 'visible');\n  const scrollbarHorizontal = scrollable\n    ? Math.max(0, element.offsetWidth - element.clientWidth - borderHorizontal)\n    : 0;\n  const scrollbarVertical = scrollable\n    ? Math.max(0, element.offsetHeight - element.clientHeight - borderVertical)\n    : 0;\n\n  return {\n    width: width + paddingHorizontal + borderHorizontal + scrollbarHorizontal,\n    height: height + paddingVertical + borderVertical + scrollbarVertical,\n  };\n}\n\nexport interface Dimensions {\n  width: number;\n  height: number;\n}\n\n/**\n * A simple utility to get the dimensions of an element as a signal.\n */\nexport function injectDimensions(): Signal<Dimensions> {\n  const elementRef = injectElementRef<HTMLElement>();\n  const destroyRef = inject(DestroyRef);\n  const dimensions = signal<Dimensions>({ width: 0, height: 0 });\n\n  fromResizeEvent(elementRef.nativeElement)\n    .pipe(\n      safeTakeUntilDestroyed(destroyRef),\n      map(({ width, height }) => ({ width, height })),\n    )\n    .subscribe(event => dimensions.set(event));\n\n  return dimensions;\n}\n","import { isPlatformServer } from '@angular/common';\nimport { inject, PLATFORM_ID } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { fromResizeEvent } from './resize';\n\n/**\n * Whenever an element is removed from the DOM, we call the callback.\n * @param element The element to watch for removal.\n * @param callback The callback to call when the element is removed.\n */\nexport function onDomRemoval(element: HTMLElement, callback: () => void): void {\n  const platform = inject(PLATFORM_ID);\n\n  // Dont run this on the server\n  if (isPlatformServer(platform)) {\n    return;\n  }\n\n  // This is a bit of a hack, but it works. If the element dimensions become zero,\n  // it's likely that the element has been removed from the DOM.\n  fromResizeEvent(element)\n    .pipe(safeTakeUntilDestroyed())\n    .subscribe(dimensions => {\n      // we check the dimensions first to short-circuit the check as it's faster\n      if (dimensions.width === 0 && dimensions.height === 0 && !document.body.contains(element)) {\n        callback();\n      }\n    });\n}\n","/**\n * This function sorts DOM elements based on their position in the document.\n * However items can also explitly define their index in which case it will be used\n * to sort the elements first. This allows for both natural DOM order sorting as well\n * as custom order for cases like virtual scrolling where items might be rendered\n * out of order.\n */\nexport function domSort<T>(\n  items: T[],\n  getElement: (item: T) => HTMLElement,\n  getIndex?: (item: T) => number | undefined,\n): T[] {\n  return items.slice().sort((a, b) => {\n    const indexA = getIndex?.(a);\n    const indexB = getIndex?.(b);\n\n    if (indexA !== undefined && indexB !== undefined) {\n      return indexA - indexB;\n    }\n\n    if (indexA !== undefined) {\n      return -1;\n    }\n\n    if (indexB !== undefined) {\n      return 1;\n    }\n\n    const elementA = getElement(a);\n    const elementB = getElement(b);\n\n    return elementA.compareDocumentPosition(elementB) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n  });\n}\n","import { DestroyRef, inject, Injectable } from '@angular/core';\n\nexport type NgpEscapeKeyClaim = (event: KeyboardEvent) => boolean;\n\n/**\n * Escape keys that a control will handle itself, so overlays leave them alone.\n * Overlays listen in the capture phase, before the control sees the key, so they\n * ask here rather than relying on the control to stop the event.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgpEscapeKeyClaims {\n  private readonly claims = new Set<NgpEscapeKeyClaim>();\n\n  add(claim: NgpEscapeKeyClaim): () => void {\n    // wrap so each registration is released on its own, even for a shared claim\n    const entry: NgpEscapeKeyClaim = event => claim(event);\n    this.claims.add(entry);\n    return () => this.claims.delete(entry);\n  }\n\n  isClaimed(event: KeyboardEvent): boolean {\n    return [...this.claims].some(claim => claim(event));\n  }\n}\n\n/**\n * Claim the Escape keys `claim` returns true for, for the lifetime of the current injection context.\n * Call it in an injection context. A claim only applies to Escape pressed inside the topmost\n * overlay, and it also skips that overlay's `closeOnEscape` guard.\n */\nexport function claimEscapeKey(claim: NgpEscapeKeyClaim): void {\n  inject(DestroyRef).onDestroy(inject(NgpEscapeKeyClaims).add(claim));\n}\n","import { Injectable } from '@angular/core';\n\n/**\n * Focus an overlay hands back to an element when it closes, as opposed to focus the user moved\n * there. The focus event fires synchronously inside `restore`, so listeners can ask about it.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgpFocusRestoration {\n  private readonly restoring = new Set<Element>();\n\n  /** Run `focus`, which moves focus to `element`, as a focus restoration. */\n  restore(element: Element, focus: () => void): void {\n    this.restoring.add(element);\n    try {\n      focus();\n    } finally {\n      this.restoring.delete(element);\n    }\n  }\n\n  /** Whether `element` is receiving focus from an overlay that is closing. */\n  isRestoring(element: Element): boolean {\n    return this.restoring.has(element);\n  }\n}\n","import { ElementRef } from '@angular/core';\nimport { attrBinding } from 'ng-primitives/state';\n\n/**\n * Name an overlay by its trigger through `aria-labelledby`, unless the consumer gave it an\n * `aria-label` or `aria-labelledby` of its own.\n */\nexport function labelledByTrigger(\n  element: ElementRef<HTMLElement>,\n  triggerId: () => string | null | undefined,\n): void {\n  let appliedId: string | null = null;\n\n  // In the browser this runs after render, so a label bound in the template is already set.\n  attrBinding(element, 'aria-labelledby', () => {\n    const current = element.nativeElement.getAttribute('aria-labelledby');\n    const ownLabel =\n      element.nativeElement.hasAttribute('aria-label') ||\n      (current !== null && current !== appliedId);\n\n    appliedId = ownLabel ? null : triggerId() || null;\n    return ownLabel ? current : appliedId;\n  });\n}\n","import { Injector, Signal, signal } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { explicitEffect } from '../signals/explicit-effect';\n\ninterface NgpMutationObserverOptions {\n  /**\n   * Whether to listen for events.\n   */\n  disabled?: Signal<boolean>;\n  /**\n   * The injector to use when called from outside of the injector context.\n   */\n  injector?: Injector;\n  /**\n   * Whether the childList should be observed.\n   */\n  childList?: boolean;\n  /**\n   * Whether the subtree should be observed.\n   */\n  subtree?: boolean;\n  /**\n   * Whether the attributes should be observed.\n   */\n  attributes?: boolean;\n  /**\n   * Whether the characterData should be observed.\n   */\n  characterData?: boolean;\n  /**\n   * Whether the attributeFilter should be observed.\n   */\n  attributeFilter?: string[];\n}\n\n/**\n * This function sets up a mutation observer to listen for changes in the DOM.\n * It will stop listening when the `disabled` signal is true, and re-enable when it is false.\n * @param options - Options for the mutation observer\n */\nexport function fromMutationObserver(\n  element: HTMLElement,\n  {\n    childList,\n    subtree,\n    attributes,\n    characterData,\n    disabled = signal(false),\n    injector,\n  }: NgpMutationObserverOptions = {},\n): Observable<MutationRecord[]> {\n  return new Observable<MutationRecord[]>(observable => {\n    let observer: MutationObserver | null = null;\n\n    function setupOrTeardownObserver() {\n      if (typeof MutationObserver === 'undefined') {\n        return;\n      }\n\n      if (disabled()) {\n        if (observer) {\n          observer.disconnect();\n          observer = null;\n        }\n        return;\n      }\n\n      if (!observer) {\n        observer = new MutationObserver(mutations => observable.next(mutations));\n        observer.observe(element, { childList, subtree, attributes, characterData });\n      }\n    }\n\n    setupOrTeardownObserver();\n\n    // any time the disabled state changes, we need to re-evaluate the observer\n    const disabledEffect = explicitEffect([disabled], () => setupOrTeardownObserver(), {\n      injector,\n    });\n\n    return () => {\n      disabledEffect.destroy();\n      observer?.disconnect();\n      observer = null;\n    };\n  });\n}\n","import {\n  DestroyableInjector,\n  ElementRef,\n  EmbeddedViewRef,\n  Injector,\n  Provider,\n  TemplateRef,\n  ViewContainerRef,\n  inject,\n  runInInjectionContext,\n} from '@angular/core';\nimport { explicitEffect } from '../signals/explicit-effect';\n\n/**\n * Options for {@link renderList}.\n */\nexport interface NgpRenderListOptions<T> {\n  /** The view container the items are rendered into. */\n  readonly viewContainer: ViewContainerRef;\n  /** The template instantiated once per item. */\n  readonly template: TemplateRef<unknown>;\n  /**\n   * A reactive source of items. Read inside an effect, so the list re-renders\n   * whenever any signal it touches changes.\n   */\n  readonly items: () => readonly T[];\n  /**\n   * Build the template context for an item. Defaults to `{ $implicit: item }`.\n   */\n  readonly context?: (item: T, index: number) => object;\n  /**\n   * Providers made available to each rendered view's injector (e.g. per-item\n   * injection tokens).\n   */\n  readonly providers?: (item: T, index: number) => Provider[];\n  /**\n   * The per-item state function, invoked once per rendered element inside an\n   * injection context scoped to that item. The rendered element is provided as\n   * `ElementRef`, so the function can call `injectElementRef()` like any other\n   * `-state.ts` factory. Anything it registers (`dataBinding`, `listener`,\n   * effects, `inject(DestroyRef).onDestroy`, ...) is cleaned up automatically\n   * when the item is removed or the list is destroyed.\n   *\n   * If it returns a value (e.g. the state from a `createPrimitive` factory) that\n   * value becomes the template context's `$implicit`, so `let item` exposes it.\n   */\n  readonly setup?: (item: T, index: number) => unknown;\n  /** The injector to bind the render effect to. Defaults to the current one. */\n  readonly injector?: Injector;\n}\n\n/**\n * Render a reactive list of items from a template into a view container,\n * managing the embedded-view lifecycle and per-item state wiring.\n *\n * The list re-renders whenever the reactive `items` source changes. Each item\n * runs its `setup` in its own injector, so effects registered there are torn\n * down when the item is removed or the host is destroyed - callers never manage\n * view refs or cleanup by hand.\n *\n * Must be called from an injection context (e.g. a directive constructor).\n */\nexport function renderList<T>(options: NgpRenderListOptions<T>): void {\n  const injector = options.injector ?? inject(Injector);\n\n  explicitEffect(\n    [options.items],\n    ([items], onCleanup) => {\n      const views: EmbeddedViewRef<unknown>[] = [];\n      const injectors: DestroyableInjector[] = [];\n\n      // Registered before rendering so partial state is torn down even if an\n      // item's `setup` throws mid-loop.\n      onCleanup(() => {\n        injectors.forEach(itemInjector => itemInjector.destroy());\n        views.forEach(view => view.destroy());\n      });\n\n      items.forEach((item, index) => {\n        const context = options.context?.(item, index) ?? { $implicit: item };\n        const viewInjector = options.providers\n          ? Injector.create({\n              parent: options.viewContainer.injector,\n              providers: options.providers(item, index),\n            })\n          : undefined;\n        if (viewInjector) {\n          injectors.push(viewInjector);\n        }\n\n        const view = options.viewContainer.createEmbeddedView(\n          options.template,\n          context,\n          viewInjector ? { injector: viewInjector } : undefined,\n        );\n        views.push(view);\n\n        const element = view.rootNodes[0];\n        if (options.setup && element instanceof HTMLElement) {\n          // A per-item injector exposes the rendered element via\n          // `injectElementRef()` and scopes the item's effects/listeners so they\n          // are torn down when the list re-renders or the host is destroyed. It\n          // is parented on the view's `providers` injector so a `createPrimitive`\n          // item factory can register its state (`provideXState()`) there and the\n          // rendered content can inject it.\n          const itemInjector = Injector.create({\n            parent: viewInjector ?? injector,\n            providers: [{ provide: ElementRef, useValue: new ElementRef(element) }],\n          });\n          injectors.push(itemInjector);\n          const state = runInInjectionContext(itemInjector, () => options.setup!(item, index));\n          // Expose the item factory's state as the template context.\n          if (state !== undefined) {\n            (context as { $implicit: unknown }).$implicit = state;\n          }\n        }\n\n        // Detect changes after `setup` so the view renders with the state above.\n        view.detectChanges();\n      });\n    },\n    { injector },\n  );\n}\n","function getScrollableAncestor(element: HTMLElement): HTMLElement | null {\n  let parent = element.parentElement;\n  while (parent) {\n    const style = window.getComputedStyle(parent);\n    if (/(auto|scroll)/.test(style.overflowY) || /(auto|scroll)/.test(style.overflowX)) {\n      return parent;\n    }\n    parent = parent.parentElement;\n  }\n  return null;\n}\n\nexport function scrollIntoViewIfNeeded(element: HTMLElement): void {\n  const scrollableAncestor = getScrollableAncestor(element);\n  if (!scrollableAncestor) return;\n\n  const parentRect = scrollableAncestor.getBoundingClientRect();\n  const elementRect = element.getBoundingClientRect();\n\n  // rects are in visual pixels but scroll offsets are layout pixels, so undo any transform\n  // scale (e.g. a scaled entrance animation) to convert between them\n  const scaleY = scrollableAncestor.offsetHeight\n    ? parentRect.height / scrollableAncestor.offsetHeight\n    : 1;\n  const scaleX = scrollableAncestor.offsetWidth\n    ? parentRect.width / scrollableAncestor.offsetWidth\n    : 1;\n\n  if (elementRect.top < parentRect.top) {\n    scrollableAncestor.scrollTop -= (parentRect.top - elementRect.top) / scaleY;\n  } else if (elementRect.bottom > parentRect.bottom) {\n    scrollableAncestor.scrollTop += (elementRect.bottom - parentRect.bottom) / scaleY;\n  }\n\n  if (elementRect.left < parentRect.left) {\n    scrollableAncestor.scrollLeft -= (parentRect.left - elementRect.left) / scaleX;\n  } else if (elementRect.right > parentRect.right) {\n    scrollableAncestor.scrollLeft += (elementRect.right - parentRect.right) / scaleX;\n  }\n}\n","import { injectDisposables } from 'ng-primitives/utils';\n\n/** Finds the item typed characters lead to, as in the WAI-ARIA listbox and menu patterns. */\nexport interface NgpTypeahead {\n  /**\n   * Add a typed character to the search and return the index of the item it leads to, or -1.\n   * Characters typed within half a second build one prefix; repeating one character cycles\n   * through the items that start with it.\n   * @param key The printable character typed\n   * @param count The number of items\n   * @param activeIndex The index of the active item, or -1 when there is none\n   * @param label The label of the item at an index\n   * @param disabled Whether the item at an index is disabled\n   */\n  search(\n    key: string,\n    count: number,\n    activeIndex: number,\n    label: (index: number) => string,\n    disabled: (index: number) => boolean,\n  ): number;\n  /** Whether characters typed recently are still building a search. */\n  isSearching(): boolean;\n}\n\n/** Create a typeahead search. Call it in an injection context: it clears itself on a timer. */\nexport function createTypeahead(): NgpTypeahead {\n  const disposables = injectDisposables();\n  let buffer = '';\n  let clearBuffer: (() => void) | undefined;\n\n  function search(\n    key: string,\n    count: number,\n    activeIndex: number,\n    label: (index: number) => string,\n    disabled: (index: number) => boolean,\n  ): number {\n    buffer += key.toLowerCase();\n\n    // clear the buffer shortly after the last keystroke so a new search can begin\n    clearBuffer?.();\n    clearBuffer = disposables.setTimeout(() => {\n      buffer = '';\n      clearBuffer = undefined;\n    }, 500);\n\n    // when every buffered character is the same, treat it as a single-character\n    // search that starts after the current item, so repeating a character cycles\n    // through the items whose label starts with it\n    const hasActive = activeIndex >= 0;\n    const isRepeatedChar = [...buffer].every(char => char === buffer[0]);\n    const prefix = isRepeatedChar ? buffer[0] : buffer;\n    // only skip past the current item when there is one to cycle from; with no\n    // active item the search must start at index 0 so the first match is found\n    const startOffset = isRepeatedChar && hasActive ? 1 : 0;\n    const base = hasActive ? activeIndex : 0;\n\n    for (let i = 0; i < count; i++) {\n      const index = (base + startOffset + i) % count;\n\n      if (!disabled(index) && label(index).toLowerCase().trim().startsWith(prefix)) {\n        return index;\n      }\n    }\n\n    return -1;\n  }\n\n  return { search, isSearching: () => buffer !== '' };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAEA;;;AAGG;SACa,gBAAgB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC;AAC3B;;MCJa,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;;QAGmB,IAAA,CAAA,SAAS,GAAuB,EAAE;AAmBpD,IAAA;;AAhBC,IAAA,GAAG,CAAC,QAA0B,EAAA;AAC5B,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC/B;;AAGA,IAAA,MAAM,CAAC,QAA0B,EAAA;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC;AAC9C,QAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACjC;IACF;;AAGA,IAAA,MAAM,IAAI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