{"version":3,"file":"forty-cdk-tree.mjs","sources":["../../../projects/forty-cdk/tree/src/focus-model.ts","../../../projects/forty-cdk/tree/src/tree-context.ts","../../../projects/forty-cdk/tree/src/tree-defaults.ts","../../../projects/forty-cdk/tree/src/tree-identity.ts","../../../projects/forty-cdk/tree/src/tree-selection.ts","../../../projects/forty-cdk/tree/src/tree.ts","../../../projects/forty-cdk/tree/src/tree-drag-keys.ts","../../../projects/forty-cdk/tree/src/tree-drop-resolver.ts","../../../projects/forty-cdk/tree/src/tree-drag-rows.ts","../../../projects/forty-cdk/tree/src/tree-node-drag.ts","../../../projects/forty-cdk/tree/src/tree-item.ts","../../../projects/forty-cdk/tree/src/tree-item-label.ts","../../../projects/forty-cdk/tree/src/tree-item-toggle.ts","../../../projects/forty-cdk/tree/src/tree-group.ts","../../../projects/forty-cdk/tree/src/tree-item-checkbox.ts","../../../projects/forty-cdk/tree/src/tree-item-checkbox-indicator.ts","../../../projects/forty-cdk/tree/src/tree-filter.ts","../../../projects/forty-cdk/tree/src/tree-node-drag-handle.ts","../../../projects/forty-cdk/tree/src/move-tree-node.ts","../../../projects/forty-cdk/tree/src/forty-cdk-tree.ts"],"sourcesContent":["import { type Signal } from '@angular/core';\n\nimport {\n  firstEnabledHost,\n  isUnset,\n  type ListNavigationAction,\n  moveIndex,\n  type RovingTabindex,\n  VirtualizedNavigator,\n  type VirtualizedNavigatorDeps,\n} from 'forty-cdk/core';\nimport type { ForTreeItemHandle, ForTreeVisibleNode } from './tree-context';\n\n/**\n * The currently-focused node, resolved by the active {@link FocusModel}. Carries\n * the facts the tree's expand / collapse and parent / child moves need —\n * regardless of whether focus rides the DOM (roving) or an\n * `aria-activedescendant` pointer (virtualized).\n */\nexport interface TreeFocusEntry<T = unknown> {\n  /** Stable node value. */\n  readonly value: T;\n  /** Whether the node is an expandable parent. */\n  readonly expandable: boolean;\n  /** Effective disabled state. */\n  readonly disabled: boolean;\n}\n\n/**\n * The seam that unifies the tree's two focus engines. `ForTree` selects one\n * implementation from `virtualized` once and routes every navigation intent\n * through it, so the keyboard handler resolves intent a single time and never\n * re-tests the mode. Two implementations:\n *\n * - {@link RovingFocusModel} — DOM focus rides the `treeitem` (APG Approach A).\n * - {@link ActiveDescendantFocusModel} — focus stays on the container and an\n *   `aria-activedescendant` pointer tracks the active node (virtualized path).\n */\nexport interface FocusModel<T = unknown> {\n  /** Move focus to a specific node. */\n  focusTarget(handle: ForTreeItemHandle<T>): void;\n  /** Resolve the currently-focused node, or `null` when nothing is focused. */\n  current(): TreeFocusEntry<T> | null;\n  /** Move focus to the next / previous / first / last enabled node. */\n  navigate(action: ListNavigationAction): void;\n  /** Move focus to the first child of the current node (an open parent). */\n  enterChild(): void;\n  /** Move focus to the current node's parent. */\n  moveToParent(): void;\n  /** Move focus to a typeahead match. */\n  typeaheadTo(handle: ForTreeItemHandle<T>): void;\n}\n\n/** Wiring for {@link RovingFocusModel}. */\nexport interface RovingFocusModelDeps<T = unknown> {\n  /** The shared roving-tabindex tracker driving the single tab stop. */\n  readonly roving: RovingTabindex;\n  /** Flattened visible nodes (each with its resolved parent host). */\n  readonly visibleNodes: Signal<readonly ForTreeVisibleNode<T>[]>;\n  /** Visible node handles in flattened order. */\n  readonly visibleHandles: Signal<readonly ForTreeItemHandle<T>[]>;\n  /**\n   * Selection-follows-focus hook. Called with the destination value after a\n   * `navigate` when single-mode selection should track focus; a no-op when the\n   * tree is multi-select or the option is off.\n   */\n  readonly selectOnFocus: (value: T) => void;\n}\n\n/**\n * Focus engine for the standard (non-virtualized) tree: DOM focus rides the\n * `treeitem`, tracked through {@link RovingTabindex}. The current node is the\n * roving-active host; navigation walks the flattened visible-node list.\n *\n * Internal — not re-exported from `tree/index.ts` or `public-api.ts`.\n */\nexport class RovingFocusModel<T = unknown> implements FocusModel<T> {\n  readonly #deps: RovingFocusModelDeps<T>;\n\n  constructor(deps: RovingFocusModelDeps<T>) {\n    this.#deps = deps;\n  }\n\n  focusTarget(handle: ForTreeItemHandle<T>): void {\n    this.#deps.roving.focusActive(handle.host);\n  }\n\n  current(): TreeFocusEntry<T> | null {\n    const entry = this.#currentNode();\n    if (!entry) {\n      return null;\n    }\n    const handle = entry.handle;\n    return { value: handle.value(), expandable: handle.expandable(), disabled: handle.disabled() };\n  }\n\n  navigate(action: ListNavigationAction): void {\n    const active = this.#deps.roving.active();\n    const items = this.#deps.visibleHandles();\n    if (items.length === 0) {\n      return;\n    }\n    const currentIndex = items.findIndex((item) => item.host === active);\n    const next = moveIndex(currentIndex < 0 ? 0 : currentIndex, items.length, action, {\n      loop: false,\n      isDisabled: (i) => items[i]!.disabled(),\n    });\n    if (next === null) {\n      return;\n    }\n    const target = items[next];\n    if (!target) {\n      return;\n    }\n    this.#deps.roving.focusActive(target.host);\n    this.#deps.selectOnFocus(target.value());\n  }\n\n  enterChild(): void {\n    const entry = this.#currentNode();\n    if (!entry) {\n      return;\n    }\n    const child = entry.handle.childContainer();\n    const firstChild = child ? firstEnabledHost(child.items()) : null;\n    if (firstChild) {\n      this.#deps.roving.focusActive(firstChild);\n    }\n  }\n\n  moveToParent(): void {\n    const entry = this.#currentNode();\n    if (entry?.parentHost) {\n      this.#deps.roving.focusActive(entry.parentHost);\n    }\n  }\n\n  typeaheadTo(handle: ForTreeItemHandle<T>): void {\n    this.#deps.roving.focusActive(handle.host);\n  }\n\n  #currentNode(): ForTreeVisibleNode<T> | null {\n    const active = this.#deps.roving.active();\n    if (active === null) {\n      return null;\n    }\n    return this.#deps.visibleNodes().find((entry) => entry.handle.host === active) ?? null;\n  }\n}\n\n/** Position-snapshot entry carried by the tree's virtualized navigation engine. */\ninterface PositionEntry<T> {\n  readonly id: string;\n  readonly disabled: boolean;\n  readonly level: number;\n  readonly expandable: boolean;\n  readonly value: T;\n}\n\n/**\n * Wiring for {@link ActiveDescendantFocusModel} — the shared engine's own\n * dependencies, minus `loop` (a tree never wraps, so the model pins it to\n * `false`) and with `getResumePos` mandatory rather than optional, because the\n * tree clears its dangling activedescendant on unmount and always resumes from\n * the retained position.\n */\nexport type ActiveDescendantFocusModelDeps<T = unknown> = Omit<\n  VirtualizedNavigatorDeps<ForTreeItemHandle<T>>,\n  'loop' | 'getResumePos'\n> & {\n  /**\n   * Last active absolute position, retained when the active node unmounts so\n   * navigation resumes from it instead of restarting at the edge. Returns `null`\n   * when there is nothing to resume from.\n   */\n  readonly getResumePos: () => number | null;\n};\n\n/**\n * Focus engine for the virtualized tree: DOM focus stays on the container and\n * an `aria-activedescendant` pointer tracks the active node. Owns the shared\n * `forty-cdk/core` navigation engine directly — a tree never wraps, so it pins\n * `loop` to `false`, and its snapshot entry carries `level` / `expandable`\n * / `value` so the tree-specific enter-child / go-to-parent moves can resolve\n * levels outside the rendered window. Selection never follows focus here.\n *\n * Internal — not re-exported from `tree/index.ts` or `public-api.ts`.\n */\nexport class ActiveDescendantFocusModel<T = unknown> implements FocusModel<T> {\n  readonly #deps: ActiveDescendantFocusModelDeps<T>;\n\n  readonly #core: VirtualizedNavigator<ForTreeItemHandle<T>, PositionEntry<T>>;\n\n  constructor(deps: ActiveDescendantFocusModelDeps<T>) {\n    this.#deps = deps;\n    this.#core = new VirtualizedNavigator(\n      { ...deps, loop: () => false },\n      {\n        posOf: (n) => n.itemIndex(),\n        idOf: (n) => n.id(),\n        hostOf: (n) => n.host,\n        isDisabled: (n) => n.disabled(),\n        readEntry: (n) => {\n          const value = n.value();\n          return isUnset(value)\n            ? null\n            : {\n                id: n.id(),\n                disabled: n.disabled(),\n                level: n.level(),\n                expandable: n.expandable(),\n                value,\n              };\n        },\n      },\n    );\n  }\n\n  /** @see VirtualizedNavigator.prime */\n  prime(): void {\n    this.#core.prime();\n  }\n\n  /** @see VirtualizedNavigator.tryResolvePending */\n  tryResolvePending(): boolean {\n    return this.#core.tryResolvePending();\n  }\n\n  /** @see VirtualizedNavigator.invalidateSnapshot */\n  invalidateSnapshot(): void {\n    this.#core.invalidateSnapshot();\n  }\n\n  focusTarget(handle: ForTreeItemHandle<T>): void {\n    this.#deps.setActiveId(handle.id());\n  }\n\n  current(): TreeFocusEntry<T> | null {\n    const cur = this.#currentEntry();\n    if (!cur) {\n      return null;\n    }\n    return { value: cur.value, expandable: cur.expandable, disabled: cur.disabled };\n  }\n\n  navigate(action: ListNavigationAction): void {\n    this.#core.navigate(action);\n  }\n\n  /**\n   * Move activedescendant to the first child of the current node (the node\n   * immediately after it in pre-order flat space). No-op when there is no\n   * active node or when the active node is the last in the list.\n   */\n  enterChild(): void {\n    const cur = this.#currentEntry();\n    if (!cur) return;\n    const target = cur.pos + 1;\n    const total = this.#deps.totalCount();\n    if (total !== undefined && target < total) {\n      this.#core.seedActive(target);\n    }\n  }\n\n  /**\n   * Move activedescendant to the nearest preceding node at a shallower level\n   * (the parent). No-op when the active node has no visible parent in the\n   * snapshot — an accepted edge case when the parent has never been rendered.\n   */\n  moveToParent(): void {\n    const cur = this.#currentEntry();\n    if (!cur) return;\n    const indexed = this.#core.snapshotByPos();\n    for (let p = cur.pos - 1; p >= 0; p--) {\n      const e = indexed.get(p);\n      if (e && e.level < cur.level) {\n        this.#core.seedActive(p);\n        return;\n      }\n    }\n  }\n\n  typeaheadTo(handle: ForTreeItemHandle<T>): void {\n    this.#deps.setActiveId(handle.id());\n    handle.host.scrollIntoView?.({ block: 'nearest' });\n  }\n\n  /**\n   * Resolve the active node's position entry from live items first, then the\n   * snapshot. Returns `{ pos, value, level, expandable, disabled }` or `null`\n   * when nothing is active.\n   */\n  #currentEntry(): {\n    pos: number;\n    value: T;\n    level: number;\n    expandable: boolean;\n    disabled: boolean;\n  } | null {\n    const currentId = this.#deps.getActiveId();\n    if (currentId === null) {\n      return null;\n    }\n    const live = this.#deps.items().find((o) => o.id() === currentId);\n    if (live) {\n      const pos = live.itemIndex();\n      if (pos !== null) {\n        return {\n          pos,\n          value: live.value(),\n          level: live.level(),\n          expandable: live.expandable(),\n          disabled: live.disabled(),\n        };\n      }\n    }\n    const indexed = this.#core.snapshotByPos();\n    for (const [pos, entry] of indexed) {\n      if (entry.id === currentId) {\n        return {\n          pos,\n          value: entry.value,\n          level: entry.level,\n          expandable: entry.expandable,\n          disabled: entry.disabled,\n        };\n      }\n    }\n    return null;\n  }\n}\n","import { inject, InjectionToken, type Signal } from '@angular/core';\n\nimport {\n  type ListNavigationAction,\n  orphanContextError,\n  type RovingTabindex,\n  type WritingDirection,\n} from 'forty-cdk/core';\n\n/**\n * A visible tree node plus its resolved parent host — the flattened list the root walks.\n *\n * Generic over the node value type, which `ForTree` instantiates at its own `T`.\n */\nexport interface ForTreeVisibleNode<T = unknown> {\n  readonly handle: ForTreeItemHandle<T>;\n  readonly parentHost: HTMLElement | null;\n}\n\n/**\n * Handle a `ForTreeItem` registers with its enclosing container so the root\n * can flatten the currently-visible nodes, run typeahead, and resolve the\n * roving-tabindex entry point — all from registered handles plus the\n * `expanded` set, never from the DOM.\n */\nexport interface ForTreeItemHandle<T = unknown> {\n  /** The `role=\"treeitem\"` host element. */\n  readonly host: HTMLElement;\n  /**\n   * Stable node value. Reads the `unsetInput` sentinel while the item's\n   * `[value]` binding is still unwritten — the window the synchronous\n   * registration opens, and the reason the item can register at all without\n   * `afterNextRender`. Guard with `isUnset` before the value leaves the read\n   * site (a `descendantsOf` call) or reaches either writable model.\n   */\n  readonly value: Signal<T>;\n  /** Effective disabled state (own `disabled` OR the root's `disabled`). */\n  readonly disabled: Signal<boolean>;\n  /** Whether a `[forTreeItemToggle]` is registered, marking the item a parent. */\n  readonly expandable: Signal<boolean>;\n  /** Nested `[forTreeGroup]` container, present only while the item is expanded. */\n  readonly childContainer: Signal<ForTreeContainerContext<T> | null>;\n  /** Typeahead text override; empty when the default label text should be used. */\n  readonly textValue: Signal<string>;\n  /** The `[forTreeItemLabel]` element, used as the default typeahead text source. */\n  readonly labelEl: Signal<HTMLElement | null>;\n  /** Stable host id for the activedescendant focus model (virtualized path). */\n  readonly id: Signal<string>;\n  /** Absolute index in the flattened visible-node list; `null` outside the virtualized path. */\n  readonly itemIndex: Signal<number | null>;\n  /** Resolved tree depth (1-based). Used for flat-space parent/child navigation. */\n  readonly level: Signal<number>;\n}\n\n/**\n * Root-only coordination contract owned by `ForTree`. Items derive their\n * selection / expansion state from it; keyboard and pointer handlers route\n * navigation, selection, and expansion through it.\n *\n * Generic over the node value type. The contract itself defaults to `unknown`,\n * which is how the token is declared; `ForTree<T = string>` instantiates it at\n * its own `T`, the one type that keys `[(value)]`, `[(expanded)]` and\n * `[forTreeItem][value]`. Node identity is resolved by {@link ForTreeContext.compareWith}.\n */\nexport interface ForTreeContext<T = unknown> {\n  /** Selected node values. Single mode keeps the array at length <= 1. */\n  readonly value: Signal<readonly T[]>;\n  /** Open (expanded) parent node values. Always multi — no single mode. */\n  readonly expanded: Signal<readonly T[]>;\n  /**\n   * Equality comparator for node values, resolving every identity question the\n   * tree asks — selection and expansion membership, cascade descendants, the\n   * range anchor, and drag-drop drop resolution. Defaults to `===`.\n   */\n  readonly compareWith: Signal<(a: T, b: T) => boolean>;\n  readonly multiple: Signal<boolean>;\n  readonly disabled: Signal<boolean>;\n  readonly orientation: Signal<'horizontal' | 'vertical'>;\n  readonly dir: Signal<WritingDirection>;\n  readonly selectionFollowsFocus: Signal<boolean>;\n  /** Selection presentation: `'highlight'` (aria-selected) or `'checkbox'` (aria-checked). */\n  readonly selectionMode: Signal<'highlight' | 'checkbox'>;\n  /** Whether cascade selection is enabled (checkbox mode only). */\n  readonly cascade: Signal<boolean>;\n  readonly roving: RovingTabindex;\n  /**\n   * Length of the flattened visible-node list when virtualizing, `undefined` in\n   * the roving-tabindex path. Setting it (via `[forTree][totalCount]`) switches\n   * the tree to the activedescendant focus model.\n   */\n  readonly totalCount: Signal<number | undefined>;\n  /** Inclusive-exclusive `[start, end)` rendered window; `undefined` when not virtualizing. */\n  readonly visibleRange: Signal<readonly [number, number] | undefined>;\n  /**\n   * The active node's id under the activedescendant focus model, `null` in the\n   * roving path. The root reflects it as `aria-activedescendant`; items read it\n   * for `data-highlighted`.\n   */\n  readonly activeDescendantId: Signal<string | null>;\n  /**\n   * Called by an item on pointer activation in the virtualized path: moves\n   * `aria-activedescendant` to that item and returns DOM focus to the tree\n   * container. A no-op in the roving path.\n   */\n  notifyItemClick(itemId: string): void;\n\n  isExpanded(value: T): boolean;\n  isSelected(value: T): boolean;\n  /**\n   * Tri-state check status of a node in checkbox mode: `'true'` / `'false'`, or\n   * `'mixed'` for a cascade parent with some-but-not-all descendants checked.\n   */\n  checkState(value: T): 'true' | 'false' | 'mixed';\n  /** Open or close a node, mutating the `expanded` array immutably. */\n  setExpanded(value: T, open: boolean): void;\n  /** Single mode replaces the selection; multi mode toggles the value. */\n  select(value: T): void;\n  /**\n   * Move roving focus from `currentItem` to the next / previous / first /\n   * last enabled node in visible (flattened) order. In single mode with\n   * `selectionFollowsFocus`, the destination is also selected.\n   */\n  navigate(currentItem: HTMLElement, action: ListNavigationAction): void;\n  /**\n   * Right arrow (LTR): expand a closed parent (focus stays); on an open\n   * parent move focus to its first child; no-op on a leaf.\n   */\n  expandOrEnter(currentItem: HTMLElement): void;\n  /**\n   * Left arrow (LTR): collapse an open parent (focus stays); otherwise move\n   * focus to the parent node; no-op at a closed root-level node.\n   */\n  collapseOrLeave(currentItem: HTMLElement): void;\n  /** `*`: expand every sibling parent at the focused node's level. */\n  expandSiblings(currentItem: HTMLElement): void;\n  /**\n   * Multi mode only. Shift+Arrow: move focus to the next / previous visible\n   * node and toggle its selection.\n   */\n  extendByArrow(currentItem: HTMLElement, action: 'next' | 'prev'): void;\n  /**\n   * Multi mode only. Shift+Space: select every enabled visible node from the\n   * anchor (set on the last unmodified selection) up to and including\n   * `currentItem`.\n   */\n  selectRangeToFocused(currentItem: HTMLElement): void;\n  /**\n   * Multi mode only. Ctrl/Cmd+A: select every enabled visible node, or clear\n   * the selection when all visible nodes are already selected.\n   */\n  selectAll(): void;\n  /**\n   * Forward a keydown to the typeahead helper. When the key is printable,\n   * focuses the first matching visible node and returns `true`.\n   */\n  handleTypeahead(event: KeyboardEvent): boolean;\n  /** Whether `el` is the first enabled root node — the default roving-tabindex entry point. */\n  isFirstFocusableItem(el: HTMLElement): boolean;\n  /**\n   * Flattened currently-visible nodes in DOM order, each with its resolved parent host. Exposed for\n   * drag-drop composition (`[forTreeNodeDrag]`). Reflects expansion: collapsed subtrees are absent,\n   * and so is an item whose `[value]` binding is not written yet (see\n   * {@link ForTreeItemHandle.value}) — it folds in on the run that writes it.\n   */\n  readonly visibleNodes: Signal<readonly ForTreeVisibleNode<T>[]>;\n}\n\nexport const FOR_TREE_CONTEXT = new InjectionToken<ForTreeContext>('FOR_TREE_CONTEXT');\n\n/**\n * Container contract implemented by both `ForTree` (the root, level 1) and\n * every `ForTreeGroup` (level = parent item level + 1). Items register here\n * to get their `aria-level` / `aria-posinset` / `aria-setsize`, and the root\n * walks containers recursively to flatten the visible nodes.\n */\nexport interface ForTreeContainerContext<T = unknown> {\n  readonly level: Signal<number>;\n  readonly items: Signal<readonly ForTreeItemHandle<T>[]>;\n  registerItem(handle: ForTreeItemHandle<T>): void;\n  unregisterItem(handle: ForTreeItemHandle<T>): void;\n  indexOfHost(el: HTMLElement): number;\n}\n\nexport const FOR_TREE_CONTAINER_CONTEXT = new InjectionToken<ForTreeContainerContext>(\n  'FOR_TREE_CONTAINER_CONTEXT',\n);\n\n/**\n * Per-item contract provided by `ForTreeItem`, consumed by its label, toggle,\n * and nested group. A registered toggle marks the item expandable (D4); the\n * nested group reads `level` and registers itself as the item's child\n * container.\n */\nexport interface ForTreeItemContext<T = unknown> {\n  readonly value: Signal<T>;\n  readonly level: Signal<number>;\n  readonly expanded: Signal<boolean>;\n  readonly expandable: Signal<boolean>;\n  /** Whether this node is in the root's selection set (its `aria-checked` / `aria-selected` state). */\n  readonly selected: Signal<boolean>;\n  /** Tri-state checkbox status of this node (`'true'` / `'false'` / `'mixed'`). */\n  readonly checkState: Signal<'true' | 'false' | 'mixed'>;\n  /** Register a toggle. Presence makes the item expandable (D4). Returns an unregister fn. */\n  registerToggle(): () => void;\n  /** Set (or clear, on collapse) the nested `[forTreeGroup]` container. */\n  setChildContainer(container: ForTreeContainerContext<T> | null): void;\n  /** Set (or clear) the `[forTreeItemLabel]` element used for typeahead text. */\n  setLabel(el: HTMLElement | null): void;\n  /** Toggle expansion. No-op on leaves or when disabled. */\n  toggle(): void;\n  /** Select / activate the item. No-op when disabled. */\n  select(): void;\n  /** Move roving focus to the item. No-op when disabled. */\n  focusItem(): void;\n}\n\nexport const FOR_TREE_ITEM_CONTEXT = new InjectionToken<ForTreeItemContext>(\n  'FOR_TREE_ITEM_CONTEXT',\n);\n\n/** Injects the nearest {@link ForTreeContext}, throwing a prefixed error if absent. */\nexport function injectTreeContext<T = unknown>(piece: string): ForTreeContext<T> {\n  const ctx = inject(FOR_TREE_CONTEXT, { optional: true });\n  if (!ctx) {\n    throw orphanContextError({\n      code: 'FORCDK-TREE-001',\n      piece,\n      root: '[forTree]',\n      token: 'FOR_TREE_CONTEXT',\n    });\n  }\n  return ctx as unknown as ForTreeContext<T>;\n}\n\n/** Injects the nearest {@link ForTreeContainerContext} (the root or a group). */\nexport function injectTreeContainerContext<T = unknown>(piece: string): ForTreeContainerContext<T> {\n  const ctx = inject(FOR_TREE_CONTAINER_CONTEXT, { optional: true });\n  if (!ctx) {\n    throw orphanContextError({\n      code: 'FORCDK-TREE-002',\n      piece,\n      root: '[forTree] or [forTreeGroup]',\n      token: 'FOR_TREE_CONTAINER_CONTEXT',\n    });\n  }\n  return ctx as unknown as ForTreeContainerContext<T>;\n}\n\n/** Injects the nearest enclosing {@link ForTreeItemContext}. */\nexport function injectTreeItemContext<T = unknown>(piece: string): ForTreeItemContext<T> {\n  const ctx = inject(FOR_TREE_ITEM_CONTEXT, { optional: true });\n  if (!ctx) {\n    throw orphanContextError({\n      code: 'FORCDK-TREE-003',\n      piece,\n      root: '[forTreeItem]',\n      token: 'FOR_TREE_ITEM_CONTEXT',\n    });\n  }\n  return ctx as unknown as ForTreeItemContext<T>;\n}\n","import { type Provider } from '@angular/core';\n\nimport { createDefaults } from 'forty-cdk/core';\n\n/**\n * Defaults inherited by descendant trees in the surrounding injector scope.\n * Configure with `provideForTreeDefaults` either at the application root or in\n * any component's `providers` array; partial overrides merge with the parent\n * scope.\n */\nexport interface ForTreeDefaults {\n  /**\n   * Single-mode only: when `true`, arrow navigation also selects the focused\n   * node. APG calls this optional and recommends caution — leave `false`\n   * unless the UX truly benefits from selection following focus.\n   */\n  selectionFollowsFocus: boolean;\n  /**\n   * `[forTreeNodeDrag]` announcement when a node is picked up for drag\n   * (assertive). Override to localize.\n   */\n  dragAnnounceLift: (label: string) => string;\n  /**\n   * `[forTreeNodeDrag]` announcement on each intermediate move while a node is\n   * lifted (polite). `position` / `total` are 1-based; `parentLabel` is `null`\n   * at the root, so the consumer phrases the root-vs-parent distinction in\n   * their own language. Override to localize.\n   */\n  dragAnnounceMove: (\n    label: string,\n    parentLabel: string | null,\n    position: number,\n    total: number,\n  ) => string;\n  /**\n   * `[forTreeNodeDrag]` announcement when a node is committed to its new\n   * position (assertive). `position` / `total` are 1-based; `parentLabel` is\n   * `null` at the root. Override to localize.\n   */\n  dragAnnounceDrop: (\n    label: string,\n    parentLabel: string | null,\n    position: number,\n    total: number,\n  ) => string;\n  /**\n   * `[forTreeNodeDrag]` announcement when a lift is cancelled and the node\n   * returns to its origin (assertive). Override to localize.\n   */\n  dragAnnounceCancel: (label: string) => string;\n  /**\n   * `[forTreeNodeDrag]` announcement when a `canDrop` veto rejects the\n   * attempted drop (assertive). Override to localize.\n   */\n  dragAnnounceInvalid: (label: string) => string;\n}\n\n/**\n * Library fallback for tree defaults, read at the root injector when no\n * consumer has called `provideForTreeDefaults`. Exported for the shared\n * defaults contract spec; not re-exported from the primitive's public entry.\n *\n * The drag announcement formatters mirror the lift / move / drop / cancel\n * cadence the drag-drop and listbox coordinators use, so a consumer hears\n * consistent reorder announcements across primitives. Defining them inside the\n * tree's own defaults (rather than importing `FOR_DRAG_DROP_DEFAULTS` /\n * `FOR_LISTBOX_DEFAULTS`) keeps `[forTreeNodeDrag]` from pulling in those\n * primitives.\n */\nexport const FOR_TREE_FALLBACK_DEFAULTS: ForTreeDefaults = {\n  selectionFollowsFocus: false,\n  dragAnnounceLift: (label) =>\n    `Picked up ${label}. Use arrow keys to move, Space to drop, Escape to cancel.`,\n  dragAnnounceMove: (label, parentLabel, position, total) => {\n    const parentPart = parentLabel ? `under ${parentLabel}, ` : 'at root, ';\n    return `${label}: ${parentPart}position ${position} of ${total}.`;\n  },\n  dragAnnounceDrop: (label, parentLabel, position, total) => {\n    const parentPart = parentLabel ? `under ${parentLabel}, ` : 'at root, ';\n    return `Dropped ${label} ${parentPart}position ${position} of ${total}.`;\n  },\n  dragAnnounceCancel: (label) => `Cancelled. ${label} returned to its original position.`,\n  dragAnnounceInvalid: (label) => `Cannot drop ${label} here.`,\n};\n\nconst { token, provideDefaults } = createDefaults<ForTreeDefaults>(\n  'FOR_TREE_DEFAULTS',\n  FOR_TREE_FALLBACK_DEFAULTS,\n);\n\n/** Token holding the resolved tree defaults for the current scope. */\nexport const FOR_TREE_DEFAULTS = token;\n\n/**\n * Configures forty-cdk tree defaults for this injector scope. Partial\n * overrides inherit unspecified keys from the parent scope (or library\n * defaults at the root).\n */\nexport function provideForTreeDefaults(defaults: Partial<ForTreeDefaults> = {}): Provider[] {\n  return provideDefaults(defaults);\n}\n","/**\n * Node-identity helpers shared by `ForTree`'s root, its selection engine and the\n * drag resolver. Every identity question the tree asks routes through the\n * consumer's `compareWith`; these exist so the hashed fast path for the default\n * comparator lives in one place instead of being re-derived per call site.\n *\n * Internal — not re-exported from `tree/public-api.ts`.\n */\n\n/**\n * The default `ForTree.compareWith`: reference / primitive identity. Exported so\n * the helpers below can recognise \"no comparator bound\" by reference and hash\n * instead of scanning — a consumer passing their own `(a, b) => a === b` simply\n * takes the scanning path, which is correct either way.\n */\nexport const defaultTreeCompareWith = <T>(a: T, b: T): boolean => a === b;\n\n/**\n * Builds a membership probe over `values`. Hashes under the default comparator —\n * the shape every string-valued tree is on — and falls back to a linear scan\n * under a consumer `compareWith`, which cannot be hashed.\n *\n * Use it when the same array is probed repeatedly (a cascade's descendant walk,\n * the visible-node fold); a single lookup uses `isInArray` from `forty-cdk/core`.\n */\nexport function treeMembership<T>(\n  values: readonly T[],\n  equals: (a: T, b: T) => boolean,\n): (value: T) => boolean {\n  if (equals === defaultTreeCompareWith) {\n    const hashed = new Set(values);\n    return (value) => hashed.has(value);\n  }\n  return (value) => values.some((candidate) => equals(candidate, value));\n}\n\n/** Immutable de-duplication of `values` under `equals`, preserving first-seen order. */\nexport function dedupeTreeValues<T>(values: readonly T[], equals: (a: T, b: T) => boolean): T[] {\n  if (equals === defaultTreeCompareWith) {\n    return [...new Set(values)];\n  }\n  const result: T[] = [];\n  for (const value of values) {\n    if (!result.some((candidate) => equals(candidate, value))) {\n      result.push(value);\n    }\n  }\n  return result;\n}\n","import { type Signal } from '@angular/core';\n\nimport {\n  fortyError,\n  isInArray,\n  moveIndex,\n  type RovingTabindex,\n  toggleInArray,\n} from 'forty-cdk/core';\nimport type { ForTreeItemHandle, ForTreeVisibleNode } from './tree-context';\nimport { dedupeTreeValues, treeMembership } from './tree-identity';\n\n/**\n * Wiring for {@link TreeSelection}. Bridges the engine to `ForTree`'s signal\n * graph and the two writable models (`value`, `expanded`) plus the shared\n * range anchor and roving-tabindex tracker.\n */\nexport interface TreeSelectionDeps<T> {\n  readonly value: Signal<readonly T[]>;\n  readonly expanded: Signal<readonly T[]>;\n  readonly multiple: Signal<boolean>;\n  readonly disabled: Signal<boolean>;\n  readonly selectionMode: Signal<'highlight' | 'checkbox'>;\n  readonly cascade: Signal<boolean>;\n  readonly descendantsOf: Signal<((value: T) => readonly T[]) | undefined>;\n  /** Equality comparator for node values, resolving every membership question. */\n  readonly compareWith: Signal<(a: T, b: T) => boolean>;\n  /** Flattened visible nodes (each with its resolved parent host). */\n  readonly visibleNodes: Signal<readonly ForTreeVisibleNode<T>[]>;\n  /** Visible node handles in flattened order. */\n  readonly visibleHandles: Signal<readonly ForTreeItemHandle<T>[]>;\n  /** The shared roving-tabindex tracker, used to move focus on shift-extend. */\n  readonly roving: RovingTabindex;\n  /** Replace the selection value. */\n  readonly setValue: (next: readonly T[]) => void;\n  /** Replace the expanded set. */\n  readonly setExpanded: (next: readonly T[]) => void;\n  /** Read the current range anchor value. */\n  readonly anchorValue: () => T | null;\n  /** Write the range anchor value. */\n  readonly setAnchorValue: (value: T | null) => void;\n}\n\n/**\n * Selection + checkbox-cascade engine for `ForTree`, extracted from the root so\n * the directive keeps only its reactive wiring and ARIA. Owns single / multi /\n * checkbox selection, cascade tri-state derivation, range selection, select-all,\n * and the `*`-key sibling expansion — every write goes back through the deps'\n * model setters so `ForTree` stays the single source of truth.\n *\n * Internal — not re-exported from `tree/index.ts` or `public-api.ts`.\n */\nexport class TreeSelection<T> {\n  readonly #deps: TreeSelectionDeps<T>;\n\n  constructor(deps: TreeSelectionDeps<T>) {\n    this.#deps = deps;\n  }\n\n  checkState(value: T): 'true' | 'false' | 'mixed' {\n    const current = this.#deps.value();\n    const equals = this.#deps.compareWith();\n    if (this.#deps.selectionMode() !== 'checkbox' || !this.#deps.cascade()) {\n      return isInArray(current, value, equals) ? 'true' : 'false';\n    }\n    const descendants = this.#resolveDescendants(value);\n    if (descendants.length === 0) {\n      return isInArray(current, value, equals) ? 'true' : 'false';\n    }\n    const selected = treeMembership(current, equals);\n    let checked = 0;\n    for (const d of descendants) {\n      if (selected(d)) {\n        checked += 1;\n      }\n    }\n    if (checked === 0) {\n      return 'false';\n    }\n    return checked === descendants.length ? 'true' : 'mixed';\n  }\n\n  select(value: T): void {\n    if (this.#deps.disabled()) {\n      return;\n    }\n    const equals = this.#deps.compareWith();\n    if (this.#deps.selectionMode() === 'checkbox' && this.#deps.cascade()) {\n      const group = dedupeTreeValues([value, ...this.#resolveDescendants(value)], equals);\n      const current = this.#deps.value();\n      const isChecked = treeMembership(current, equals);\n      const inGroup = treeMembership(group, equals);\n      const allChecked = group.every(isChecked);\n      this.#deps.setValue(\n        allChecked\n          ? current.filter((v) => !inGroup(v))\n          : dedupeTreeValues([...current, ...group], equals),\n      );\n    } else if (this.#deps.multiple() || this.#deps.selectionMode() === 'checkbox') {\n      this.#deps.setValue(toggleInArray(this.#deps.value(), value, equals));\n    } else {\n      this.#deps.setValue([value]);\n    }\n    this.#deps.setAnchorValue(value);\n  }\n\n  expandSiblings(currentItem: HTMLElement): void {\n    if (this.#deps.disabled()) {\n      return;\n    }\n    const entries = this.#deps.visibleNodes();\n    const current = entries.find((e) => e.handle.host === currentItem);\n    if (!current) {\n      return;\n    }\n    const equals = this.#deps.compareWith();\n    const next = [...this.#deps.expanded()];\n    for (const entry of entries) {\n      if (\n        entry.parentHost === current.parentHost &&\n        entry.handle.expandable() &&\n        !isInArray(next, entry.handle.value(), equals)\n      ) {\n        next.push(entry.handle.value());\n      }\n    }\n    this.#deps.setExpanded(next);\n  }\n\n  extendByArrow(currentItem: HTMLElement, action: 'next' | 'prev'): void {\n    if (this.#deps.disabled() || !this.#deps.multiple()) {\n      return;\n    }\n    const items = this.#deps.visibleHandles();\n    if (items.length === 0) {\n      return;\n    }\n    const currentIndex = items.findIndex((item) => item.host === currentItem);\n    const next = moveIndex(currentIndex < 0 ? 0 : currentIndex, items.length, action, {\n      loop: false,\n      isDisabled: (i) => items[i]!.disabled(),\n    });\n    if (next === null) {\n      return;\n    }\n    const target = items[next];\n    if (!target) {\n      return;\n    }\n    // Establish the range anchor at the origin of the shift-extend run so a\n    // following Shift+Space ranges from where the user started extending, not\n    // from a stale (or absent) anchor. A pre-existing anchor (e.g. from a prior\n    // click) is left in place, matching the listbox range contract.\n    if (this.#deps.anchorValue() === null && currentIndex >= 0) {\n      this.#deps.setAnchorValue(items[currentIndex]!.value());\n    }\n    this.#deps.roving.focusActive(target.host);\n    this.#deps.setValue(\n      toggleInArray(this.#deps.value(), target.value(), this.#deps.compareWith()),\n    );\n  }\n\n  selectRangeToFocused(currentItem: HTMLElement): void {\n    if (this.#deps.disabled() || !this.#deps.multiple()) {\n      return;\n    }\n    const items = this.#deps.visibleHandles();\n    const currentIndex = items.findIndex((item) => item.host === currentItem);\n    if (currentIndex < 0) {\n      return;\n    }\n    const equals = this.#deps.compareWith();\n    const anchorValue = this.#deps.anchorValue();\n    const anchorIndex =\n      anchorValue === null ? currentIndex : items.findIndex((i) => equals(i.value(), anchorValue));\n    const start = anchorIndex < 0 ? currentIndex : anchorIndex;\n    const [lo, hi] = start <= currentIndex ? [start, currentIndex] : [currentIndex, start];\n\n    const next = [...this.#deps.value()];\n    for (let i = lo; i <= hi; i++) {\n      const item = items[i];\n      if (!item || item.disabled()) {\n        continue;\n      }\n      const value = item.value();\n      if (!isInArray(next, value, equals)) {\n        next.push(value);\n      }\n    }\n    this.#deps.setValue(next);\n  }\n\n  selectAll(): void {\n    if (this.#deps.disabled() || !this.#deps.multiple()) {\n      return;\n    }\n    const values = this.#deps\n      .visibleNodes()\n      .map((entry) => entry.handle)\n      .filter((handle) => !handle.disabled())\n      .map((handle) => handle.value());\n    if (values.length === 0) {\n      return;\n    }\n    const equals = this.#deps.compareWith();\n    const current = this.#deps.value();\n    const allSelected = values.every(treeMembership(current, equals));\n    this.#deps.setValue(allSelected ? [] : dedupeTreeValues([...current, ...values], equals));\n  }\n\n  #resolveDescendants(value: T): readonly T[] {\n    const fn = this.#deps.descendantsOf();\n    if (!fn) {\n      throw fortyError({\n        code: 'FORCDK-TREE-005',\n        message: '`cascade` is enabled but no `descendantsOf` descriptor is bound.',\n        cause:\n          'Cascading a check to a subtree needs the descendant values of a node, which only the ' +\n          'consumer can supply — the tree never sees unmounted nodes.',\n        fix: 'Bind [descendantsOf] to a function returning the descendant values of a node.',\n      });\n    }\n    return fn(value);\n  }\n}\n","import {\n  booleanAttribute,\n  computed,\n  Directive,\n  effect,\n  ElementRef,\n  inject,\n  input,\n  model,\n  numberAttribute,\n  output,\n  signal,\n  type Signal,\n} from '@angular/core';\n\nimport {\n  Collection,\n  firstEnabledHost,\n  isInArray,\n  isUnset,\n  type ListNavigationAction,\n  resolveListNavigation,\n  resolveTreeExpandCollapse,\n  runVirtualizedNavigatorBridge,\n  throwUnsupportedVirtualizedRangeSelect,\n  throwUnsupportedVirtualizedSelectionFollowsFocus,\n  type WritingDirection,\n  RovingTabindex,\n  injectTextDirection,\n  injectTypeahead,\n  hostAriaLabel,\n} from 'forty-cdk/core';\nimport { ActiveDescendantFocusModel, type FocusModel, RovingFocusModel } from './focus-model';\nimport {\n  FOR_TREE_CONTAINER_CONTEXT,\n  FOR_TREE_CONTEXT,\n  type ForTreeContainerContext,\n  type ForTreeContext,\n  type ForTreeItemHandle,\n  type ForTreeVisibleNode,\n} from './tree-context';\nimport { FOR_TREE_DEFAULTS } from './tree-defaults';\nimport { defaultTreeCompareWith, treeMembership } from './tree-identity';\nimport { TreeSelection } from './tree-selection';\n\ntype VisibleEntry<T> = ForTreeVisibleNode<T>;\n\n/**\n * Headless implementation of the\n * [WAI-ARIA Tree View pattern](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/).\n *\n * A nested tree (`role=\"tree\"` → `treeitem` → `group` → `treeitem`) with\n * `@if`-driven expansion, roving-tabindex focus management (APG Approach A —\n * DOM focus rides the `treeitem`), typeahead, RTL arrow mirroring, and full\n * `aria-level` / `aria-setsize` / `aria-posinset` wiring.\n *\n * Two orthogonal models, both keyed by the node value type `T` (default\n * `string`, inferred from `[(value)]` / `[(expanded)]`):\n * - `value` — selected node values; single mode (default) keeps 0 or 1\n *   element, multi mode accumulates.\n * - `expanded` — open parent node values; always multi (no single mode).\n *\n * Single-select consumers read the sole value through {@link ForTree.selected}\n * instead of unwrapping `value()[0]`.\n *\n * @example\n * ```html\n * <ul forTree [(value)]=\"selected\" [(expanded)]=\"expanded\" aria-label=\"Files\">\n *   <ng-container [ngTemplateOutlet]=\"node\" [ngTemplateOutletContext]=\"{ $implicit: root }\" />\n * </ul>\n * ```\n */\n@Directive({\n  selector: '[forTree]',\n  exportAs: 'forTree',\n  host: {\n    role: 'tree',\n    '[attr.aria-label]': 'resolvedAriaLabel()',\n    '[attr.aria-multiselectable]': 'multiple() ? \"true\" : null',\n    '[attr.aria-orientation]': 'orientation()',\n    '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n    '[attr.data-orientation]': 'orientation()',\n    '[attr.data-disabled]': 'disabled() ? \"\" : null',\n    '[attr.dir]': 'dir()',\n    '[attr.aria-activedescendant]': 'activeDescendantId()',\n    '[attr.tabindex]': 'hostTabindex()',\n    '(keydown)': 'onHostKeyDown($event)',\n    '(focusin)': 'onHostFocusIn()',\n  },\n  providers: [\n    { provide: FOR_TREE_CONTEXT, useExisting: ForTree },\n    { provide: FOR_TREE_CONTAINER_CONTEXT, useExisting: ForTree },\n  ],\n})\nexport class ForTree<T = string> implements ForTreeContext<T>, ForTreeContainerContext<T> {\n  readonly #defaults = inject(FOR_TREE_DEFAULTS);\n  readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n  /**\n   * Two-way bindable. Selected node values. Single mode keeps the array at\n   * length <= 1. The `model()` change emitter (`(valueChange)`) fires only on\n   * internal selection changes (node activation or `selectionFollowsFocus`\n   * navigation), never on consumer writes via `[(value)]`.\n   */\n  readonly value = model<readonly T[]>([]);\n\n  /**\n   * Two-way bindable. Open (expanded) parent node values, keyed by the same\n   * node value type as {@link ForTree.value} — the shape `ForTable.expanded`\n   * uses for its open parent rows. Always multi — any number of nodes can be\n   * open. The `model()` change emitter (`(expandedChange)`) fires only on\n   * internal expand / collapse, never on consumer writes via `[(expanded)]`.\n   */\n  readonly expanded = model<readonly T[]>([]);\n\n  /**\n   * Equality comparator for node values, resolving every identity question the\n   * tree asks — selection and expansion membership, cascade descendants, the\n   * range anchor, and drag-drop drop resolution. Defaults to `===`, which is\n   * correct for the default `string` node values; supply an id-based comparator\n   * for object values: `[compareWith]=\"(a, b) => a.id === b.id\"`.\n   */\n  readonly compareWith = input<(a: T, b: T) => boolean>(defaultTreeCompareWith);\n\n  /**\n   * When true, multiple nodes can be selected. Single mode (default) replaces.\n   *\n   * Multi-select range keyboard (Shift+Arrow, Shift+Space, Ctrl/Cmd+A) is not\n   * supported together with virtualization (`totalCount` set): range selection\n   * needs the full set of enabled nodes across the range, which is unavailable\n   * while the list is partially unmounted. Pressing one of those combinations on\n   * a virtualized multi-select tree throws in dev mode. Use\n   * `selectionMode=\"checkbox\"` for multi-select over large virtualized trees.\n   */\n  readonly multiple = input(false, { transform: booleanAttribute });\n\n  /** Disables the whole tree: nodes are not selectable and report `aria-disabled`. */\n  readonly disabled = input(false, { transform: booleanAttribute });\n\n  /** Navigation axis. `'vertical'` (default) uses ArrowUp/Down for movement. */\n  readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n\n  /**\n   * Selection presentation. `'highlight'` (default) keeps the `aria-selected`\n   * contract; `'checkbox'` switches each `treeitem` to `aria-checked` and is\n   * inherently multi-select (each node toggles independently).\n   */\n  readonly selectionMode = input<'highlight' | 'checkbox'>('highlight');\n\n  /**\n   * Enables cascade selection in `selectionMode=\"checkbox\"`: checking or\n   * unchecking a node propagates to all its descendants, and a parent derives\n   * `aria-checked=\"mixed\"` when only some descendants are checked. Ignored in\n   * `'highlight'` mode. Requires {@link ForTree.descendantsOf}. Default `false`.\n   */\n  readonly cascade = input(false, { transform: booleanAttribute });\n\n  /**\n   * Returns the selectable descendant values of a node (excluding the node\n   * itself), used to cascade selection and derive `'mixed'` across collapsed —\n   * possibly unmounted — subtrees. **Required** when {@link ForTree.cascade} is\n   * `true`; the tree throws a `[forty-cdk/tree]` error otherwise.\n   */\n  readonly descendantsOf = input<(value: T) => readonly T[]>();\n\n  /**\n   * Total number of nodes in the flattened visible-node list. When set, enables\n   * the virtualized activedescendant focus model. Leave unset (default\n   * `undefined`) for the standard roving-tabindex model.\n   */\n  readonly totalCount = input(undefined, {\n    transform: (v: unknown): number | undefined => (v == null ? undefined : numberAttribute(v)),\n  });\n\n  /**\n   * Inclusive-exclusive `[start, end)` index range of the currently rendered\n   * nodes. The virtualizer provides this; the tree uses it to decide whether a\n   * navigation target is in the visible window.\n   */\n  readonly visibleRange = input<readonly [number, number] | undefined>(undefined);\n\n  /**\n   * Optional virtualized-only seam that tells the directive the flattened node\n   * list changed **without** a `totalCount` transition — a same-length re-sort\n   * or refresh. Bind any value that changes on such a refresh (a version\n   * counter, the array reference, a sort-key string); when it changes the\n   * position snapshot rebuilds from empty so navigation never resolves against a\n   * stale off-window entry. Leave unset (default) when the node count always\n   * changes on a refresh. Equivalent to calling {@link ForTree.invalidateSnapshot}\n   * imperatively.\n   */\n  readonly dataVersion = input<unknown>();\n\n  /**\n   * Emitted when keyboard navigation reaches a node outside the rendered\n   * window. The consumer passes this index to `injectVirtualizer`'s\n   * `scrollToIndex` so the correct node mounts.\n   */\n  readonly scrollToIndex = output<number>();\n\n  /**\n   * Manual `aria-label` for the tree. Use this when no visible label element\n   * exists; otherwise prefer pointing `aria-labelledby` at one. A `null`\n   * (default) or empty value emits no attribute.\n   */\n  readonly ariaLabel = input<string | null>(null);\n\n  protected readonly resolvedAriaLabel = hostAriaLabel(() => this.ariaLabel() || null);\n\n  /**\n   * Writing direction. When unset (default `null`), the inherited ambient\n   * direction is resolved from the nearest ancestor carrying a `dir` attribute\n   * (or `<html dir>`), defaulting to `'ltr'`. An explicit `[dir]` always wins.\n   * The resolved value is reflected to the host `dir` attribute and swaps the\n   * expand / collapse arrow semantics in RTL.\n   */\n  readonly _dirInput = input<WritingDirection | null>(null, { alias: 'dir' });\n  readonly dir = injectTextDirection(this._dirInput);\n\n  /**\n   * Single-mode only: when true, arrow navigation also selects the focused\n   * node. The default is read from `provideForTreeDefaults` for the\n   * surrounding scope.\n   *\n   * Not supported together with virtualization (`totalCount` set): the\n   * virtualized `aria-activedescendant` focus model resolves off-window\n   * navigation targets asynchronously, so selection cannot follow focus there\n   * without deriving the committed value from a render side effect.\n   * Keyboard-navigating a virtualized tree with it set throws in dev mode, from\n   * the move the combination degrades.\n   */\n  readonly selectionFollowsFocus = input(this.#defaults.selectionFollowsFocus, {\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Read-only single-select convenience view of {@link value}. Returns the\n   * sole selected value when exactly one node is selected, otherwise `null`\n   * (empty selection, or multiple selections in `multiple` mode).\n   */\n  readonly selected = computed<T | null>(() => {\n    const v = this.value();\n    return v.length === 1 ? v[0]! : null;\n  });\n\n  /** Root container hosts level-1 items. */\n  readonly level = signal(1);\n  readonly roving = new RovingTabindex(() => this.#visibleHandles(), { fallback: 'first-enabled' });\n\n  readonly #typeahead = injectTypeahead();\n  readonly #items = new Collection<ForTreeItemHandle<T>>();\n  readonly #anchorValue = signal<T | null>(null);\n\n  readonly items = this.#items.items;\n\n  readonly #visibleEntries = computed<readonly VisibleEntry<T>[]>(() => {\n    const isOpen = treeMembership(this.expanded(), this.compareWith());\n    const result: VisibleEntry<T>[] = [];\n    const walk = (container: ForTreeContainerContext<T>, parentHost: HTMLElement | null): void => {\n      for (const handle of container.items()) {\n        const value = handle.value();\n        if (isUnset(value)) {\n          continue;\n        }\n        result.push({ handle, parentHost });\n        if (isOpen(value)) {\n          const child = handle.childContainer();\n          if (child) {\n            walk(child, handle.host);\n          }\n        }\n      }\n    };\n    walk(this, null);\n    return result;\n  });\n\n  /**\n   * Flattened currently-visible nodes in DOM order, each with its resolved parent host. Exposed for\n   * drag-drop composition (`[forTreeNodeDrag]`). Reflects expansion: collapsed subtrees are absent,\n   * and so is an item whose `[value]` binding is not written yet — it folds in on the run that\n   * writes it.\n   */\n  readonly visibleNodes: Signal<readonly ForTreeVisibleNode<T>[]> = this.#visibleEntries;\n\n  readonly #visibleHandles = computed(() => this.#visibleEntries().map((entry) => entry.handle));\n\n  readonly #firstEnabledRoot = computed(() => firstEnabledHost(this.#items.items()));\n\n  readonly #firstSelectedHost = computed<HTMLElement | null>(() => {\n    const selected = this.value();\n    if (selected.length === 0) {\n      return null;\n    }\n    const isSelected = treeMembership(selected, this.compareWith());\n    for (const handle of this.#visibleHandles()) {\n      if (handle.disabled()) {\n        continue;\n      }\n      if (isSelected(handle.value())) {\n        return handle.host;\n      }\n    }\n    return null;\n  });\n\n  readonly #virtualized = computed(() => this.totalCount() !== undefined);\n\n  readonly #activeId = signal<string | null>(null);\n\n  readonly #lastActivePos = signal<number | null>(null);\n\n  /**\n   * The active node's `id` when using the activedescendant focus model,\n   * `null` in the roving-tabindex path. The host reflects this as\n   * `aria-activedescendant`; items read it to compute `data-highlighted`.\n   */\n  readonly activeDescendantId = computed<string | null>(() =>\n    this.#virtualized() ? this.#activeId() : null,\n  );\n\n  /**\n   * Tabindex for the tree host. In the virtualized path the host is always the\n   * single tab stop. In the roving path the host carries no tabindex (items own\n   * their own tab stop). A disabled tree is never tabbable.\n   */\n  protected readonly hostTabindex = computed<'0' | null>(() => {\n    if (this.disabled()) return null;\n    return this.#virtualized() ? '0' : null;\n  });\n\n  readonly #selection = new TreeSelection<T>({\n    value: this.value,\n    expanded: this.expanded,\n    compareWith: this.compareWith,\n    multiple: this.multiple,\n    disabled: this.disabled,\n    selectionMode: this.selectionMode,\n    cascade: this.cascade,\n    descendantsOf: this.descendantsOf,\n    visibleNodes: this.#visibleEntries,\n    visibleHandles: this.#visibleHandles,\n    roving: this.roving,\n    setValue: (next) => this.value.set(next),\n    setExpanded: (next) => this.expanded.set(next),\n    anchorValue: () => this.#anchorValue(),\n    setAnchorValue: (value) => this.#anchorValue.set(value),\n  });\n\n  #rovingModel: RovingFocusModel<T> | null = null;\n  #activeDescendantModel: ActiveDescendantFocusModel<T> | null = null;\n\n  #requireActiveDescendantModel(): ActiveDescendantFocusModel<T> {\n    return (this.#activeDescendantModel ??= new ActiveDescendantFocusModel<T>({\n      items: this.#items.items,\n      totalCount: this.totalCount,\n      visibleRange: this.visibleRange,\n      getActiveId: () => this.#activeId(),\n      setActiveId: (id) => this.#setActiveId(id),\n      emitScrollToIndex: (idx) => this.scrollToIndex.emit(idx),\n      getResumePos: () => this.#lastActivePos(),\n      dataVersion: this.dataVersion,\n    }));\n  }\n\n  /**\n   * Force the virtualized position snapshot to rebuild from empty on the next\n   * fold, discarding stale off-window entries. Call after a same-length refresh\n   * of the flattened node list (a re-sort / reload that keeps `totalCount`\n   * unchanged) when you cannot express the change through the reactive\n   * `[dataVersion]` input. No-op when the tree is not virtualized (`totalCount`\n   * unset).\n   */\n  invalidateSnapshot(): void {\n    if (!this.#virtualized()) {\n      return;\n    }\n    this.#requireActiveDescendantModel().invalidateSnapshot();\n  }\n\n  #setActiveId(id: string | null): void {\n    if (id !== null) {\n      this.#lastActivePos.set(null);\n    }\n    this.#activeId.set(id);\n  }\n\n  #focusModel(): FocusModel<T> {\n    if (this.#virtualized()) {\n      return this.#requireActiveDescendantModel();\n    }\n    return (this.#rovingModel ??= new RovingFocusModel<T>({\n      roving: this.roving,\n      visibleNodes: this.#visibleEntries,\n      visibleHandles: this.#visibleHandles,\n      selectOnFocus: (value) => {\n        if (!this.multiple() && this.selectionFollowsFocus()) {\n          this.value.set([value]);\n          this.#anchorValue.set(value);\n        }\n      },\n    }));\n  }\n\n  constructor() {\n    // @sanctioned-pull(navigator-position-map): the rendered window is transient,\n    // so a window nothing reads during is lost to the lazy fold.\n    effect(() => {\n      runVirtualizedNavigatorBridge({\n        items: this.#items.items,\n        virtualized: this.#virtualized,\n        requireNavigator: () => this.#requireActiveDescendantModel(),\n      });\n    });\n  }\n\n  isExpanded(value: T): boolean {\n    return isInArray(this.expanded(), value, this.compareWith());\n  }\n\n  isSelected(value: T): boolean {\n    return isInArray(this.value(), value, this.compareWith());\n  }\n\n  /**\n   * Tri-state check status of a node in `selectionMode=\"checkbox\"`. Without\n   * cascade (or in `'highlight'` mode) returns `'true'` / `'false'` by direct\n   * membership. With cascade a parent returns `'true'` when all its descendants\n   * are checked, `'false'` when none are, and `'mixed'` otherwise.\n   *\n   * An item whose `[value]` binding is not written yet reports `'false'`, and\n   * your `descendantsOf` is never called for it.\n   */\n  checkState(value: T): 'true' | 'false' | 'mixed' {\n    if (isUnset(value)) {\n      return 'false';\n    }\n    return this.#selection.checkState(value);\n  }\n\n  /**\n   * Open or close a node. An item whose `[value]` binding is not written yet is\n   * ignored, so it never enters the `expanded` model.\n   */\n  setExpanded(value: T, open: boolean): void {\n    if (isUnset(value)) {\n      return;\n    }\n    const current = this.expanded();\n    const equals = this.compareWith();\n    const has = isInArray(current, value, equals);\n    if (open && !has) {\n      this.expanded.set([...current, value]);\n    } else if (!open && has) {\n      this.#relocateActiveOnCollapse(value);\n      this.expanded.set(current.filter((v) => !equals(v, value)));\n    }\n  }\n\n  /**\n   * Single mode replaces the selection; multi and checkbox modes toggle the\n   * value. An item whose `[value]` binding is not written yet is dropped.\n   */\n  select(value: T): void {\n    if (isUnset(value)) {\n      return;\n    }\n    this.#selection.select(value);\n  }\n\n  #relocateActiveOnCollapse(value: T): void {\n    const active = this.roving.active();\n    if (active === null) {\n      return;\n    }\n    const visible = this.#visibleEntries();\n    const equals = this.compareWith();\n    const collapsing = visible.find((e) => equals(e.handle.value(), value));\n    if (!collapsing) {\n      return;\n    }\n    const collapsingHost = collapsing.handle.host;\n    if (collapsingHost !== active && collapsingHost.contains(active)) {\n      this.roving.focusActive(collapsingHost);\n    }\n  }\n\n  navigate(_currentItem: HTMLElement, action: ListNavigationAction): void {\n    if (this.disabled()) {\n      return;\n    }\n    this.#assertSelectionFollowsFocusSupported();\n    this.#focusModel().navigate(action);\n  }\n\n  expandOrEnter(_currentItem: HTMLElement): void {\n    if (this.disabled()) {\n      return;\n    }\n    const model = this.#focusModel();\n    const cur = model.current();\n    if (!cur || cur.disabled || !cur.expandable) {\n      return;\n    }\n    if (!this.isExpanded(cur.value)) {\n      this.setExpanded(cur.value, true);\n      return;\n    }\n    this.#assertSelectionFollowsFocusSupported();\n    model.enterChild();\n  }\n\n  collapseOrLeave(_currentItem: HTMLElement): void {\n    if (this.disabled()) {\n      return;\n    }\n    const model = this.#focusModel();\n    const cur = model.current();\n    if (!cur) {\n      return;\n    }\n    if (cur.expandable && this.isExpanded(cur.value)) {\n      this.setExpanded(cur.value, false);\n      return;\n    }\n    this.#assertSelectionFollowsFocusSupported();\n    model.moveToParent();\n  }\n\n  expandSiblings(currentItem: HTMLElement): void {\n    this.#selection.expandSiblings(currentItem);\n  }\n\n  extendByArrow(currentItem: HTMLElement, action: 'next' | 'prev'): void {\n    this.#selection.extendByArrow(currentItem, action);\n  }\n\n  selectRangeToFocused(currentItem: HTMLElement): void {\n    this.#selection.selectRangeToFocused(currentItem);\n  }\n\n  selectAll(): void {\n    this.#selection.selectAll();\n  }\n\n  handleTypeahead(event: KeyboardEvent): boolean {\n    if (!this.#typeahead.handle(event)) {\n      return false;\n    }\n    const buffer = this.#typeahead.buffer().toLowerCase();\n    if (!buffer) {\n      return true;\n    }\n    const source = this.#virtualized()\n      ? this.#items.items()\n      : this.#visibleEntries().map((entry) => entry.handle);\n    const match = source.find((handle) => {\n      if (handle.disabled()) {\n        return false;\n      }\n      const text = (handle.textValue() || handle.labelEl()?.textContent || '').trim().toLowerCase();\n      return text.startsWith(buffer);\n    });\n    if (match) {\n      this.#assertSelectionFollowsFocusSupported();\n      this.#focusModel().typeaheadTo(match);\n    }\n    return true;\n  }\n\n  isFirstFocusableItem(el: HTMLElement): boolean {\n    const firstSelected = this.#firstSelectedHost();\n    if (firstSelected) {\n      return firstSelected === el;\n    }\n    return this.#firstEnabledRoot() === el;\n  }\n\n  protected onHostKeyDown(event: KeyboardEvent): void {\n    if (!this.#virtualized() || this.disabled()) return;\n    const host = this.#host.nativeElement;\n    if (this.multiple() && this.#isMultiSelectShortcut(event)) {\n      event.preventDefault();\n      this.#throwUnsupportedVirtualizedMultiSelect();\n      return;\n    }\n    if (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') {\n      event.preventDefault();\n      this.#activateActiveDescendant();\n      return;\n    }\n    const action = resolveListNavigation(event, {\n      orientation: this.orientation(),\n      dir: this.dir(),\n    });\n    if (action === 'next' || action === 'prev' || action === 'first' || action === 'last') {\n      event.preventDefault();\n      this.navigate(host, action);\n      return;\n    }\n    const intent = resolveTreeExpandCollapse(event, {\n      orientation: this.orientation(),\n      dir: this.dir(),\n    });\n    if (intent === 'expand') {\n      event.preventDefault();\n      this.expandOrEnter(host);\n      return;\n    }\n    if (intent === 'collapse') {\n      event.preventDefault();\n      this.collapseOrLeave(host);\n      return;\n    }\n    this.handleTypeahead(event);\n  }\n\n  protected onHostFocusIn(): void {\n    if (!this.#virtualized() || this.disabled()) return;\n    if (this.#activeId() !== null) return;\n    const items = this.#items.items();\n    if (items.length === 0) return;\n    const ordered = [...items].sort((a, b) => (a.itemIndex() ?? 0) - (b.itemIndex() ?? 0));\n    const isSelected = treeMembership(this.value(), this.compareWith());\n    const selectedFirst = ordered.find((h) => !h.disabled() && isSelected(h.value()));\n    const target = selectedFirst ?? ordered.find((h) => !h.disabled());\n    if (target) this.#setActiveId(target.id());\n  }\n\n  #activateActiveDescendant(): void {\n    const id = this.#activeId();\n    if (id === null) return;\n    const handle = this.#items.items().find((o) => o.id() === id);\n    if (!handle || handle.disabled()) return;\n    this.select(handle.value());\n  }\n\n  #isMultiSelectShortcut(event: KeyboardEvent): boolean {\n    if (event.altKey) {\n      return false;\n    }\n    if (\n      (event.ctrlKey || event.metaKey) &&\n      !event.shiftKey &&\n      (event.key === 'a' || event.key === 'A')\n    ) {\n      return true;\n    }\n    if (event.shiftKey && !event.ctrlKey && !event.metaKey) {\n      if (event.key === ' ' || event.key === 'Spacebar') {\n        return true;\n      }\n      const action = resolveListNavigation(event, {\n        orientation: this.orientation(),\n        dir: this.dir(),\n      });\n      return action === 'next' || action === 'prev';\n    }\n    return false;\n  }\n\n  /**\n   * Guards the `selectionFollowsFocus` + virtualization invariant at every\n   * keyboard move of the virtualized activedescendant: arrow / Home / End\n   * navigation, entering a child or leaving to a parent, and a typeahead match\n   * all move focus without carrying selection. It sits inside those four\n   * methods rather than in {@link onHostKeyDown} because each is shared with\n   * the non-virtualized path (where `[forTreeItem]` handles its own keys), and\n   * because expanding or collapsing in place moves no focus and so degrades\n   * nothing — the `#virtualized()` gate makes the roving path inert.\n   */\n  #assertSelectionFollowsFocusSupported(): void {\n    if (this.#virtualized() && this.selectionFollowsFocus()) {\n      throwUnsupportedVirtualizedSelectionFollowsFocus({\n        primitive: 'tree',\n        focusModel: 'roving-tabindex',\n        collection: 'tree',\n      });\n    }\n  }\n\n  /**\n   * The shortcut list is the trio `#isMultiSelectShortcut` detects, which is\n   * also the trio `[forTreeItem]` implements on the non-virtualized path — the\n   * tree spends `Ctrl+Shift+Home/End` on a plain focus move in both, so naming\n   * it here would report a restriction virtualization does not impose.\n   */\n  #throwUnsupportedVirtualizedMultiSelect(): void {\n    throwUnsupportedVirtualizedRangeSelect({\n      primitive: 'tree',\n      focusModel: 'roving-tabindex',\n      collection: 'tree',\n      shortcuts: 'Shift+Arrow, Shift+Space, Ctrl/Cmd+A',\n      alternative: 'Use `selectionMode=\"checkbox\"` for multi-select over large virtualized trees',\n    });\n  }\n\n  registerItem(handle: ForTreeItemHandle<T>): void {\n    this.#items.register(handle);\n  }\n\n  notifyItemClick(itemId: string): void {\n    if (!this.#virtualized()) return;\n    this.#setActiveId(itemId);\n    this.#host.nativeElement.focus();\n  }\n\n  unregisterItem(handle: ForTreeItemHandle<T>): void {\n    this.#items.unregister(handle);\n    this.roving.unregister(handle.host);\n    if (this.#virtualized() && this.#activeId() === handle.id()) {\n      this.#lastActivePos.set(handle.itemIndex());\n      this.#activeId.set(null);\n    }\n  }\n\n  indexOfHost(el: HTMLElement): number {\n    return this.#items.indexOfHost(el);\n  }\n}\n","import { resolveLiftedDragControl } from 'forty-cdk/core';\n\n/**\n * Tree-specific keyboard resolver for `ForTreeNodeDrag`. Framework-free and unit-testable in\n * isolation. Not part of the public API. The lift chord (`isDragLiftKey`) and the commit / cancel\n * vocabulary are shared across reorder coordinators in `_internal/drag-session/keyboard-drag-keys`.\n */\n\n/** The action a key press maps to while a node is lifted (keyboard drag in progress). */\nexport type TreeDragLiftedAction = 'cancel' | 'commit' | 'down' | 'up' | 'deepen' | 'shallow';\n\n/**\n * Resolves the action for a key press while a node is lifted, honoring writing direction for\n * the depth keys (ArrowRight deepens in LTR, ArrowLeft deepens in RTL). Cancel / commit are\n * delegated to the shared {@link resolveLiftedDragControl}. Returns `null` for keys with no\n * lifted-drag meaning.\n *\n * @param event The keydown event.\n * @param dir Resolved writing direction.\n */\nexport function resolveTreeDragLiftedAction(\n  event: KeyboardEvent,\n  dir: 'ltr' | 'rtl',\n): TreeDragLiftedAction | null {\n  const control = resolveLiftedDragControl(event);\n  if (control) {\n    return control;\n  }\n  const key = event.key;\n  if (key === 'ArrowDown') {\n    return 'down';\n  }\n  if (key === 'ArrowUp') {\n    return 'up';\n  }\n  const isRtl = dir === 'rtl';\n  if (key === (isRtl ? 'ArrowLeft' : 'ArrowRight')) {\n    return 'deepen';\n  }\n  if (key === (isRtl ? 'ArrowRight' : 'ArrowLeft')) {\n    return 'shallow';\n  }\n  return null;\n}\n","/** One visible tree row as the resolver sees it. Rects in viewport coords. */\nexport interface TreeDropRow<T = unknown> {\n  /** The node's value. */\n  readonly value: T;\n  /** 1-based depth. */\n  readonly level: number;\n  /** rect.left — used to map levels to x. */\n  readonly left: number;\n  readonly top: number;\n  readonly bottom: number;\n}\n\n/** Where a lifted node will land, for rendering an insertion indicator. */\nexport interface TreeDropIndicator<T = unknown> {\n  /** The visible row the indicator anchors to (the node value). */\n  readonly anchor: T;\n  /** Whether the line sits just before or just after the anchor row in DOM order. */\n  readonly position: 'before' | 'after';\n  /** Resolved 1-based depth of the drop. */\n  readonly level: number;\n}\n\n/** A resolved tree drop position. */\nexport interface TreeDropTarget<T = unknown> {\n  /** New parent's value, or `null` for the root level. */\n  readonly parentValue: T | null;\n  /** Insertion index among the new parent's children (post-removal space). */\n  readonly index: number;\n  /** Resolved 1-based depth of the dropped node. */\n  readonly level: number;\n  /**\n   * Number of existing children under `parentValue` at the resolved `level` (excluding the\n   * dragged node, which is absent from `rows`). The dropped node will be sibling\n   * `index + 1` of `siblingCount + 1` after the move — the numbers screen-reader\n   * announcements report.\n   */\n  readonly siblingCount: number;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n  return Math.max(min, Math.min(max, value));\n}\n\n/**\n * Resolves a tree drop from a flattened, DOM-ordered list of the currently visible rows\n * (EXCLUDING the dragged node, whose subtree is collapsed during the drag).\n *\n * @param rows Visible rows in DOM order, dragged node excluded.\n * @param gapIndex Insertion gap: the row index the dropped node would sit *before* (`rows.length`\n *   = after the last row). For pointer, derive this from the vertical midpoint rule; for keyboard,\n *   it is the running target the arrows step.\n * @param desiredLevel Caller's desired depth (pointer: nearest level to the pointer x; keyboard:\n *   the running level the Left/Right arrows adjust). Clamped to the gap's allowed band.\n * @param equals The tree's node-value comparator.\n */\nexport function resolveTreeDrop<T>(\n  rows: readonly TreeDropRow<T>[],\n  gapIndex: number,\n  desiredLevel: number,\n  equals: (a: T, b: T) => boolean,\n): TreeDropTarget<T> {\n  if (rows.length === 0) {\n    return { parentValue: null, index: 0, level: 1, siblingCount: 0 };\n  }\n\n  const gap = clamp(gapIndex, 0, rows.length);\n  const prev = gap > 0 ? (rows[gap - 1] ?? null) : null;\n  const next = gap < rows.length ? (rows[gap] ?? null) : null;\n\n  const maxLevel = prev ? prev.level + 1 : 1;\n  let minLevel = next ? next.level : 1;\n  if (minLevel > maxLevel) {\n    minLevel = maxLevel;\n  }\n\n  const level = clamp(desiredLevel, minLevel, maxLevel);\n\n  let parentValue: T | null = null;\n  if (level > 1) {\n    for (let i = gap - 1; i >= 0; i--) {\n      if (rows[i]!.level === level - 1) {\n        parentValue = rows[i]!.value;\n        break;\n      }\n    }\n  }\n\n  let index = 0;\n  let siblingCount = 0;\n  for (let i = 0; i < rows.length; i++) {\n    if (!isSiblingUnder(rows, i, level, parentValue, equals)) {\n      continue;\n    }\n    siblingCount++;\n    if (i < gap) {\n      index++;\n    }\n  }\n\n  return { parentValue, index, level, siblingCount };\n}\n\n/**\n * Whether the row at `rowIndex` is a child of `parentValue` at depth `level` — i.e. it sits\n * at `level` and its nearest preceding row at `level - 1` is `parentValue` (root rows at\n * `level === 1` have no ancestor row, so they always qualify when their depth matches).\n */\nfunction isSiblingUnder<T>(\n  rows: readonly TreeDropRow<T>[],\n  rowIndex: number,\n  level: number,\n  parentValue: T | null,\n  equals: (a: T, b: T) => boolean,\n): boolean {\n  const row = rows[rowIndex]!;\n  if (row.level !== level) {\n    return false;\n  }\n  if (level === 1) {\n    return true;\n  }\n  for (let j = rowIndex - 1; j >= 0; j--) {\n    if (rows[j]!.level === level - 1) {\n      return parentValue !== null && equals(rows[j]!.value, parentValue);\n    }\n  }\n  return parentValue === null;\n}\n\n/**\n * Maps a pointer y coordinate to the insertion gap among `rows` using the vertical-midpoint\n * rule: the gap is the index of the first row whose vertical midpoint sits below `y`\n * (`rows.length` when `y` is below every row's midpoint).\n *\n * @param rows Visible rows in DOM order, dragged node excluded.\n * @param y Pointer y in viewport coordinates.\n */\nexport function gapFromPointerY(rows: readonly TreeDropRow<unknown>[], y: number): number {\n  for (let i = 0; i < rows.length; i++) {\n    const row = rows[i]!;\n    const mid = (row.top + row.bottom) / 2;\n    if (y < mid) {\n      return i;\n    }\n  }\n  return rows.length;\n}\n\n/**\n * Resolves the insertion-indicator anchor for a gap: the line sits `before` the row at\n * `gapIndex`, or `after` the last row when the gap is past the end. Returns `null` when there\n * are no rows to anchor to.\n *\n * @param rows Visible rows in DOM order, dragged node excluded.\n * @param gapIndex Insertion gap (same as passed to {@link resolveTreeDrop}).\n * @param level Resolved 1-based depth to report on the indicator.\n */\nexport function resolveDropIndicator<T>(\n  rows: readonly TreeDropRow<T>[],\n  gapIndex: number,\n  level: number,\n): TreeDropIndicator<T> | null {\n  if (rows.length === 0) {\n    return null;\n  }\n  const gap = clamp(gapIndex, 0, rows.length);\n  if (gap >= rows.length) {\n    return { anchor: rows[rows.length - 1]!.value, position: 'after', level };\n  }\n  return { anchor: rows[gap]!.value, position: 'before', level };\n}\n\n/**\n * Maps a pointer x coordinate to the nearest candidate level within the allowed band\n * at `gapIndex`. Uses each level's representative left (minimum left observed among rows\n * at that level) and falls back to linear interpolation when a level isn't present.\n *\n * @param rows Visible rows in DOM order, dragged node excluded.\n * @param gapIndex Gap index (same as passed to `resolveTreeDrop`).\n * @param x Pointer x in viewport coordinates.\n */\nexport function levelFromPointerX(\n  rows: readonly TreeDropRow<unknown>[],\n  gapIndex: number,\n  x: number,\n): number {\n  if (rows.length === 0) {\n    return 1;\n  }\n\n  const next = gapIndex < rows.length ? (rows[gapIndex] ?? null) : null;\n  const minLevel = next ? next.level : 1;\n\n  const levelLefts = new Map<number, number>();\n  for (const row of rows) {\n    const existing = levelLefts.get(row.level);\n    if (existing === undefined || row.left < existing) {\n      levelLefts.set(row.level, row.left);\n    }\n  }\n\n  const candidateLevels = Array.from(levelLefts.keys()).sort((a, b) => a - b);\n\n  if (candidateLevels.length === 0) {\n    return minLevel;\n  }\n\n  let bestLevel = candidateLevels[0]!;\n  let bestDist = Infinity;\n  for (const lvl of candidateLevels) {\n    const lx = levelLefts.get(lvl)!;\n    const dist = Math.abs(x - lx);\n    if (dist < bestDist) {\n      bestDist = dist;\n      bestLevel = lvl;\n    }\n  }\n\n  return bestLevel;\n}\n","import type { ForTreeVisibleNode } from './tree-context';\nimport { type TreeDropRow } from './tree-drop-resolver';\n\n/**\n * Pure helpers that turn the tree's visible-node list into the flat row / label data the\n * drag resolver and announcements consume. Framework-free and unit-testable. Not public.\n */\n\n/** The origin bookkeeping captured when a node is lifted. */\nexport interface TreeLiftContext<T = unknown> {\n  /** The lifted node's value. */\n  readonly value: T;\n  /** The lifted node's parent value, or `null` at the root. */\n  readonly parentValue: T | null;\n  /** The lifted node's index among its siblings before the move. */\n  readonly previousIndex: number;\n}\n\n/**\n * Builds the flat, DOM-ordered rows the drop resolver works on, EXCLUDING the lifted node\n * (whose subtree is collapsed during the drag). Reads each row's live viewport rect.\n *\n * @param visible The tree's currently visible nodes, in DOM order.\n * @param liftedValue The value of the node being dragged, filtered out of the result.\n * @param equals The tree's node-value comparator.\n */\nexport function buildTreeDropRows<T>(\n  visible: readonly ForTreeVisibleNode<T>[],\n  liftedValue: T | null,\n  equals: (a: T, b: T) => boolean,\n): TreeDropRow<T>[] {\n  return visible\n    .filter((e) => liftedValue === null || !equals(e.handle.value(), liftedValue))\n    .map((e) => {\n      const rect = e.handle.host.getBoundingClientRect();\n      return {\n        value: e.handle.value(),\n        level: e.handle.level(),\n        left: rect.left,\n        top: rect.top,\n        bottom: rect.bottom,\n      };\n    });\n}\n\n/** The visible row's trimmed accessible label (its label element, else its text content). */\nexport function treeNodeLabel(entry: ForTreeVisibleNode<unknown>): string {\n  const labelEl = entry.handle.labelEl();\n  return (labelEl?.textContent ?? entry.handle.host.textContent ?? '').trim();\n}\n\n/**\n * Whether a pointerdown inside `itemHost` may start a drag, honoring drag handles: when the\n * item contains one or more registered handles, the press must land inside one; an item with\n * no handle is grabbable anywhere.\n *\n * @param itemHost The `[forTreeItem]` host the press landed in.\n * @param target The pointerdown event target — a `Node`, because a press can land on a non-HTML\n * node such as an `<svg>` icon inside the grab area, and containment is all this check needs.\n * @param handles All registered drag-handle elements (across the whole tree).\n */\nexport function isInsideGrabArea(\n  itemHost: HTMLElement,\n  target: Node,\n  handles: ReadonlySet<HTMLElement>,\n): boolean {\n  const itemHandles = [...handles].filter((h) => itemHost.contains(h));\n  if (itemHandles.length === 0) {\n    return true;\n  }\n  return itemHandles.some((h) => h === target || h.contains(target));\n}\n\n/** The trimmed label for `parentValue`, or `null` when it has no row (root drop). */\nexport function treeParentLabel<T>(\n  visible: readonly ForTreeVisibleNode<T>[],\n  parentValue: T | null,\n  equals: (a: T, b: T) => boolean,\n): string | null {\n  if (parentValue === null) {\n    return null;\n  }\n  const entry = visible.find((e) => equals(e.handle.value(), parentValue));\n  return entry ? treeNodeLabel(entry) : null;\n}\n\n/**\n * Captures the lifted node's origin (value, parent, sibling index) from its position in the\n * visible list, before any collapse-on-lift mutates the tree.\n *\n * @param visible The visible nodes at lift time, in DOM order.\n * @param visibleIdx The lifted node's index within `visible`.\n */\nexport function resolveTreeLiftContext<T>(\n  visible: readonly ForTreeVisibleNode<T>[],\n  visibleIdx: number,\n): TreeLiftContext<T> | null {\n  const entry = visible[visibleIdx];\n  if (!entry) {\n    return null;\n  }\n  const parentHost = entry.parentHost;\n  const parentEntry = parentHost ? visible.find((e) => e.handle.host === parentHost) : null;\n  const previousIndex = visible.filter(\n    (e) => e.parentHost === parentHost && visible.indexOf(e) < visibleIdx,\n  ).length;\n  return {\n    value: entry.handle.value(),\n    parentValue: parentEntry ? parentEntry.handle.value() : null,\n    previousIndex,\n  };\n}\n\n/**\n * Resolves the initial insertion gap after a collapse-on-lift re-renders the visible list.\n * Pointer lifts clamp the original `visibleIdx` to the row count; keyboard lifts map it to the\n * first row whose post-collapse visible index is at or past `visibleIdx` (`rows.length` if\n * none), keeping the cursor where the focused node sat.\n *\n * @param rows The post-collapse drop rows (lifted node already excluded).\n * @param visibleAfter The visible nodes after the collapse.\n * @param visibleIdx The lifted node's index before the collapse.\n * @param mode Whether the lift was started by pointer or keyboard.\n * @param equals The tree's node-value comparator.\n */\nexport function resolveLiftGap<T>(\n  rows: readonly TreeDropRow<T>[],\n  visibleAfter: readonly ForTreeVisibleNode<T>[],\n  visibleIdx: number,\n  mode: 'keyboard' | 'pointer',\n  equals: (a: T, b: T) => boolean,\n): number {\n  if (mode === 'pointer') {\n    return Math.min(visibleIdx, rows.length);\n  }\n  const gap = rows.findIndex((r) => {\n    const nextEntry = visibleAfter.find((e) => equals(e.handle.value(), r.value));\n    return nextEntry && visibleAfter.indexOf(nextEntry) >= visibleIdx;\n  });\n  return gap < 0 ? rows.length : gap;\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n  booleanAttribute,\n  DestroyRef,\n  Directive,\n  DOCUMENT,\n  ElementRef,\n  InjectionToken,\n  inject,\n  input,\n  output,\n  PLATFORM_ID,\n  signal,\n  type Signal,\n} from '@angular/core';\n\nimport {\n  LiveAnnouncer,\n  type PreviewPoint,\n  PreviewController,\n  isDragLiftKey,\n  createKeyboardDragMediator,\n  createPointerDragSession,\n  type PointerDragSession,\n} from 'forty-cdk/core';\nimport { resolveTreeDragLiftedAction } from './tree-drag-keys';\nimport {\n  gapFromPointerY,\n  levelFromPointerX,\n  resolveDropIndicator,\n  resolveTreeDrop,\n  type TreeDropRow,\n} from './tree-drop-resolver';\nimport {\n  buildTreeDropRows,\n  isInsideGrabArea,\n  resolveLiftGap,\n  resolveTreeLiftContext,\n  treeNodeLabel,\n  treeParentLabel,\n} from './tree-drag-rows';\nimport { injectTreeContext, type ForTreeVisibleNode } from './tree-context';\nimport { FOR_TREE_DEFAULTS } from './tree-defaults';\nimport type { ForTreeDragDropEvent } from './tree-drag-drop-event';\n\nconst POINTER_ARM_THRESHOLD_PX = 5;\n\n/**\n * Where the lifted node will land, for rendering an insertion indicator. `null` when idle.\n */\nexport interface ForTreeDropIndicator<T = string> {\n  /** The visible row the indicator anchors to (the node value). */\n  readonly anchor: T;\n  /** Whether the line sits just before or just after the anchor row in DOM order. */\n  readonly position: 'before' | 'after';\n  /** Resolved 1-based depth of the drop (mirror of `--for-tree-drop-level`). */\n  readonly level: number;\n}\n\n/** The coordination contract the handle uses to register with the coordinator. */\nexport interface ForTreeNodeDragContext {\n  /** Register a drag handle element for the item that contains it. */\n  registerHandle(el: HTMLElement): void;\n  /** Unregister a previously registered handle element. */\n  unregisterHandle(el: HTMLElement): void;\n  /** Resolved drop indicator while a drag is live; `null` when idle. */\n  readonly dropIndicator: Signal<ForTreeDropIndicator<unknown> | null>;\n}\n\n/** InjectionToken for the `[forTreeNodeDrag]` coordinator. */\nexport const FOR_TREE_NODE_DRAG_CONTEXT = new InjectionToken<ForTreeNodeDragContext>(\n  'FOR_TREE_NODE_DRAG_CONTEXT',\n);\n\ntype DragMode = 'idle' | 'keyboard' | 'pointer';\n\n/**\n * Root-level drag-drop coordinator for `ForTree`. Apply on the same element as `[forTree]` to\n * enable reordering and re-parenting of tree nodes by pointer and keyboard.\n *\n * Keyboard: focus a node, then press Ctrl+Space (or Cmd+Space) to lift. While lifted, ArrowUp/Down\n * move the sibling position, ArrowRight/Left change depth, Space/Enter drops, Escape cancels.\n *\n * Pointer: drag any enabled item to a new position; an optional `[forTreeNodeDragHandle]` on an\n * item constrains the grab area.\n *\n * The `(nodeDrop)` output fires once per committed move. Apply `moveTreeNode` in the handler to\n * update the consumer's data. Provide a `[canDrop]` function to veto specific moves.\n *\n * Generic over the tree's node value type `T`, which defaults to `string` like `ForTree`'s own.\n * Unlike `ForTree`, this directive has no input that carries `T` on its own, so **a tree whose\n * node values are not `string` must bind `[canDrop]` typed at the node value** — that is the one\n * channel Angular's template type checker can infer `T` from. Without it `T` stays `string` and\n * `(nodeDrop)` reports `ForTreeDragDropEvent<string>` while the runtime carries the node value:\n * a handler typed at the real node fails with `TS2345`, and retyping that handler to `string` to\n * satisfy the diagnostic is what makes `moveTreeNode` silently return its `roots` unchanged.\n * A `[canDrop]` that vetoes nothing (`() => true`) is enough to carry the inference. Annotating a\n * `viewChild` reference recovers `T` only for reading {@link ForTreeNodeDrag.dropIndicator} from\n * TypeScript; it cannot retype a template binding.\n */\n@Directive({\n  selector: '[forTreeNodeDrag]',\n  exportAs: 'forTreeNodeDrag',\n  providers: [{ provide: FOR_TREE_NODE_DRAG_CONTEXT, useExisting: ForTreeNodeDrag }],\n  host: {\n    '[attr.data-dragging]': '_dragging() ? \"\" : null',\n    '[attr.data-drop-target]': '_dropTargetValid() ? \"\" : null',\n    '[style.--for-tree-drop-level]': '_dropLevel()',\n  },\n})\nexport class ForTreeNodeDrag<T = string> implements ForTreeNodeDragContext {\n  readonly #ctx = injectTreeContext<T>('ForTreeNodeDrag');\n  readonly #hostEl = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n  readonly #document = inject(DOCUMENT);\n  readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n  readonly #announcer = inject(LiveAnnouncer);\n  readonly #destroyRef = inject(DestroyRef);\n  readonly #defaults = inject(FOR_TREE_DEFAULTS);\n\n  /** Disables all drag interactions on this tree. */\n  readonly disabled = input(false, { transform: booleanAttribute });\n\n  /**\n   * Optional veto callback. Return `false` to reject a specific drop — the node is returned to its\n   * original position and an announcement is made. When omitted, all drops are accepted.\n   */\n  readonly canDrop = input<((event: ForTreeDragDropEvent<T>) => boolean) | undefined>(undefined);\n\n  /** Emitted once per committed move. Apply `moveTreeNode` in the handler to update your data. */\n  readonly nodeDrop = output<ForTreeDragDropEvent<T>>();\n\n  protected readonly _dragging = signal(false);\n  protected readonly _dropTargetValid = signal(false);\n  protected readonly _dropLevel = signal<number | null>(null);\n\n  readonly #dropIndicator = signal<ForTreeDropIndicator<T> | null>(null);\n\n  /** Resolved drop indicator while a drag is live; `null` when idle. */\n  readonly dropIndicator: Signal<ForTreeDropIndicator<T> | null> = this.#dropIndicator.asReadonly();\n\n  readonly #handles = new Set<HTMLElement>();\n\n  #mode: DragMode = 'idle';\n  #liftedValue: T | null = null;\n  #previousParent: T | null = null;\n  #previousIndex = 0;\n  #gapIndex = 0;\n  #desiredLevel = 1;\n  #previewController: PreviewController | null = null;\n  #wasExpanded = false;\n  #liftedHost: HTMLElement | null = null;\n  #label = '';\n\n  #pointerSession: PointerDragSession | null = null;\n\n  constructor() {\n    if (!this.#isBrowser) {\n      return;\n    }\n\n    createKeyboardDragMediator({\n      host: this.#hostEl,\n      document: this.#document,\n      isBrowser: this.#isBrowser,\n      destroyRef: this.#destroyRef,\n      isLifted: () => this.#mode === 'keyboard',\n      onIdleKeydown: (event) => this.#onIdleKeydown(event),\n      onLiftedKeydown: (event) => this.#handleLiftedKeydown(event),\n      onFocusLeave: () => this.#cancelSession(true),\n    });\n\n    this.#pointerSession = createPointerDragSession({\n      host: this.#hostEl,\n      document: this.#document,\n      armThreshold: POINTER_ARM_THRESHOLD_PX,\n      canStart: (event) => this.#canStartPointer(event),\n      onLift: (event) => this.#onPointerLift(event),\n      onMove: (event) => this.#onPointerMove(event),\n      onCommit: (event) => this.#onPointerCommit(event),\n      onCancel: () => this.#cancelSession(true),\n    });\n\n    this.#destroyRef.onDestroy(() => {\n      this.#pointerSession?.destroy();\n      if (this.#mode !== 'idle') {\n        this.#cancelSession(false);\n      }\n    });\n  }\n\n  registerHandle(el: HTMLElement): void {\n    this.#handles.add(el);\n  }\n\n  unregisterHandle(el: HTMLElement): void {\n    this.#handles.delete(el);\n  }\n\n  #onIdleKeydown(event: KeyboardEvent): void {\n    if (this.#mode !== 'idle' || !isDragLiftKey(event)) {\n      return;\n    }\n    if (this.disabled() || this.#ctx.disabled()) {\n      return;\n    }\n    const target = event.target;\n    const visible = this.#ctx.visibleNodes();\n    const entry = visible.find((e) => e.handle.host === target);\n    if (!entry || entry.handle.disabled()) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    this.#lift(entry.handle.host, visible.indexOf(entry), visible, 'keyboard');\n  }\n\n  #handleLiftedKeydown(event: KeyboardEvent): void {\n    const action = resolveTreeDragLiftedAction(event, this.#ctx.dir());\n    if (action === null) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n\n    if (action === 'cancel') {\n      this.#cancelSession(true);\n      return;\n    }\n    if (action === 'commit') {\n      this.#commitSession();\n      return;\n    }\n\n    const visible = this.#ctx.visibleNodes();\n    if (action === 'down') {\n      this.#gapIndex = Math.min(\n        this.#gapIndex + 1,\n        buildTreeDropRows(visible, this.#liftedValue, this.#ctx.compareWith()).length,\n      );\n    } else if (action === 'up') {\n      this.#gapIndex = Math.max(this.#gapIndex - 1, 0);\n    } else if (action === 'deepen') {\n      this.#desiredLevel++;\n    } else {\n      this.#desiredLevel = Math.max(1, this.#desiredLevel - 1);\n    }\n    this.#resolveAndAnnounceMove(visible);\n  }\n\n  #canStartPointer(event: PointerEvent): boolean {\n    if (\n      this.disabled() ||\n      this.#ctx.disabled() ||\n      (event.pointerType === 'mouse' && event.button !== 0)\n    ) {\n      return false;\n    }\n    const target = event.target;\n    if (!(target instanceof Element)) {\n      return false;\n    }\n    const entry = this.#resolveVisibleNodeFromTarget(target);\n    if (!entry || entry.handle.disabled()) {\n      return false;\n    }\n    const itemHost = entry.handle.host;\n    if (!isInsideGrabArea(itemHost, target, this.#handles)) {\n      return false;\n    }\n    this.#liftedHost = itemHost;\n    return true;\n  }\n\n  #resolveVisibleNodeFromTarget(target: Element): ForTreeVisibleNode<T> | null {\n    const hosts = new Map<Element, ForTreeVisibleNode<T>>(\n      this.#ctx.visibleNodes().map((e) => [e.handle.host, e]),\n    );\n    let node: Element | null = target;\n    while (node && node !== this.#hostEl) {\n      const entry = hosts.get(node);\n      if (entry) {\n        return entry;\n      }\n      node = node.parentElement;\n    }\n    return null;\n  }\n\n  #onPointerLift(event: PointerEvent): boolean {\n    if (!this.#liftedHost) {\n      return false;\n    }\n    const visible = this.#ctx.visibleNodes();\n    const idx = visible.findIndex((e) => e.handle.host === this.#liftedHost);\n    if (idx < 0) {\n      this.#liftedHost = null;\n      return false;\n    }\n    this.#lift(this.#liftedHost, idx, visible, 'pointer', {\n      x: event.clientX,\n      y: event.clientY,\n    });\n    return true;\n  }\n\n  #applyPointerPosition(event: PointerEvent): TreeDropRow<T>[] {\n    const rows = buildTreeDropRows(\n      this.#ctx.visibleNodes(),\n      this.#liftedValue,\n      this.#ctx.compareWith(),\n    );\n    this.#gapIndex = gapFromPointerY(rows, event.clientY);\n    this.#desiredLevel = levelFromPointerX(rows, this.#gapIndex, event.clientX);\n    return rows;\n  }\n\n  #onPointerMove(event: PointerEvent): void {\n    if (this.#mode !== 'pointer') {\n      return;\n    }\n    const rows = this.#applyPointerPosition(event);\n    const target = resolveTreeDrop(\n      rows,\n      this.#gapIndex,\n      this.#desiredLevel,\n      this.#ctx.compareWith(),\n    );\n    this.#publishDropTarget(rows, target.level);\n\n    this.#previewController?.moveTo({ x: event.clientX, y: event.clientY });\n  }\n\n  #onPointerCommit(event: PointerEvent): void {\n    if (this.#mode !== 'pointer') {\n      return;\n    }\n    this.#applyPointerPosition(event);\n    this.#commitSession();\n  }\n\n  #lift(\n    host: HTMLElement,\n    visibleIdx: number,\n    visible: readonly ForTreeVisibleNode<T>[],\n    mode: 'keyboard' | 'pointer',\n    point?: PreviewPoint,\n  ): void {\n    const entry = visible[visibleIdx];\n    const origin = resolveTreeLiftContext(visible, visibleIdx);\n    if (!entry || !origin) {\n      return;\n    }\n\n    this.#liftedValue = origin.value;\n    this.#previousParent = origin.parentValue;\n    this.#previousIndex = origin.previousIndex;\n    this.#wasExpanded = this.#ctx.isExpanded(origin.value);\n    this.#label = treeNodeLabel(entry);\n    this.#mode = mode;\n    this.#liftedHost = host;\n\n    if (this.#wasExpanded) {\n      this.#ctx.setExpanded(origin.value, false);\n    }\n\n    if (mode === 'pointer' && point) {\n      this.#previewController = new PreviewController({\n        source: host,\n        point,\n        preview: null,\n        doc: this.#document,\n        boundary: null,\n        lockAxis: () => null,\n      });\n    }\n\n    const visibleAfter = this.#ctx.visibleNodes();\n    const equals = this.#ctx.compareWith();\n    const rows = buildTreeDropRows(visibleAfter, this.#liftedValue, equals);\n    this.#gapIndex = resolveLiftGap(rows, visibleAfter, visibleIdx, mode, equals);\n    this.#desiredLevel = entry.handle.level();\n\n    this._dragging.set(true);\n    this.#publishDropTarget(rows, this.#desiredLevel);\n\n    this.#announcer.announce(this.#defaults.dragAnnounceLift(this.#label), 'assertive');\n  }\n\n  #publishDropTarget(rows: TreeDropRow<T>[], level: number): void {\n    this._dropTargetValid.set(true);\n    this._dropLevel.set(level);\n    this.#dropIndicator.set(resolveDropIndicator(rows, this.#gapIndex, level));\n  }\n\n  #commitSession(): void {\n    if (this.#mode === 'idle' || this.#liftedValue === null) {\n      return;\n    }\n    const visible = this.#ctx.visibleNodes();\n    const equals = this.#ctx.compareWith();\n    const rows = buildTreeDropRows(visible, this.#liftedValue, equals);\n    const target = resolveTreeDrop(rows, this.#gapIndex, this.#desiredLevel, equals);\n\n    const parentLabel = treeParentLabel(visible, target.parentValue, equals);\n\n    const event: ForTreeDragDropEvent<T> = {\n      node: this.#liftedValue,\n      previousParent: this.#previousParent,\n      newParent: target.parentValue,\n      previousIndex: this.#previousIndex,\n      currentIndex: target.index,\n    };\n\n    const veto = this.canDrop();\n    if (veto !== undefined && !veto(event)) {\n      this.#restoreExpansion();\n      this.#announcer.announce(this.#defaults.dragAnnounceInvalid(this.#label), 'assertive');\n      this.#clearSession();\n      return;\n    }\n\n    this.#restoreExpansion();\n    this.nodeDrop.emit(event);\n    this.#announcer.announce(\n      this.#defaults.dragAnnounceDrop(\n        this.#label,\n        parentLabel,\n        target.index + 1,\n        target.siblingCount + 1,\n      ),\n      'assertive',\n    );\n    this.#clearSession();\n  }\n\n  #cancelSession(restore: boolean): void {\n    if (restore) {\n      this.#restoreExpansion();\n      this.#announcer.announce(this.#defaults.dragAnnounceCancel(this.#label), 'assertive');\n    }\n    this.#clearSession();\n  }\n\n  #restoreExpansion(): void {\n    if (this.#wasExpanded && this.#liftedValue !== null) {\n      this.#ctx.setExpanded(this.#liftedValue, true);\n    }\n  }\n\n  #clearSession(): void {\n    this.#mode = 'idle';\n    this.#liftedValue = null;\n    this.#previousParent = null;\n    this.#previousIndex = 0;\n    this.#gapIndex = 0;\n    this.#desiredLevel = 1;\n    this.#wasExpanded = false;\n    this.#liftedHost = null;\n    this.#label = '';\n\n    if (this.#previewController) {\n      this.#previewController.destroy();\n      this.#previewController = null;\n    }\n\n    this._dragging.set(false);\n    this._dropTargetValid.set(false);\n    this._dropLevel.set(null);\n    this.#dropIndicator.set(null);\n  }\n\n  #resolveAndAnnounceMove(visible: readonly ForTreeVisibleNode<T>[]): void {\n    const equals = this.#ctx.compareWith();\n    const rows = buildTreeDropRows(visible, this.#liftedValue, equals);\n    const target = resolveTreeDrop(rows, this.#gapIndex, this.#desiredLevel, equals);\n    this.#desiredLevel = target.level;\n    this.#publishDropTarget(rows, target.level);\n\n    const parentLabel = treeParentLabel(visible, target.parentValue, equals);\n\n    this.#announcer.announce(\n      this.#defaults.dragAnnounceMove(\n        this.#label,\n        parentLabel,\n        target.index + 1,\n        target.siblingCount + 1,\n      ),\n      'polite',\n    );\n  }\n}\n","import {\n  booleanAttribute,\n  computed,\n  Directive,\n  ElementRef,\n  inject,\n  input,\n  signal,\n} from '@angular/core';\n\nimport {\n  assertInputBound,\n  registerHandle,\n  hostId,\n  resolveListNavigation,\n  resolveTreeExpandCollapse,\n  unsetInput,\n} from 'forty-cdk/core';\nimport {\n  FOR_TREE_ITEM_CONTEXT,\n  type ForTreeContainerContext,\n  type ForTreeItemContext,\n  type ForTreeItemHandle,\n  injectTreeContainerContext,\n  injectTreeContext,\n} from './tree-context';\nimport { FOR_TREE_NODE_DRAG_CONTEXT } from './tree-node-drag';\n\n/**\n * A single node in a `ForTree`. Carries the `role=\"treeitem\"`, its ARIA state\n * (`aria-expanded` only when a `[forTreeItemToggle]` is registered, plus\n * `aria-selected` / `aria-level` / `aria-setsize` / `aria-posinset`), the\n * roving tab stop, and the full keyboard interaction.\n *\n * Apply on the structural element (typically `<li forTreeItem>`); place a\n * `[forTreeItemLabel]` inside as the pointer target and a `[forTreeGroup]`\n * (behind `@if`) for children.\n */\n@Directive({\n  selector: '[forTreeItem]',\n  exportAs: 'forTreeItem',\n  host: {\n    role: 'treeitem',\n    '[id]': 'id()',\n    '[attr.aria-expanded]': 'expandable() ? (expanded() ? \"true\" : \"false\") : null',\n    '[attr.aria-checked]': 'checkboxMode() ? checkState() : null',\n    '[attr.aria-selected]': 'checkboxMode() ? null : (selected() ? \"true\" : \"false\")',\n    '[attr.aria-level]': 'level()',\n    '[attr.aria-setsize]': 'setsize()',\n    '[attr.aria-posinset]': 'posinset()',\n    '[attr.aria-disabled]': 'effectiveDisabled() ? \"true\" : null',\n    '[attr.tabindex]': 'tabindex()',\n    '[attr.data-state]': 'expandable() ? (expanded() ? \"open\" : \"closed\") : null',\n    '[attr.data-selected]': 'selected() ? \"\" : null',\n    '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n    '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n    '[attr.data-checked]': 'checkboxMode() ? checkState() : null',\n    '[attr.data-drop-position]': '_dropPosition()',\n    '(keydown)': 'onKeyDown($event)',\n    '(focus)': 'onFocus()',\n    '(pointerdown)': 'onPointerDown($event)',\n  },\n  providers: [{ provide: FOR_TREE_ITEM_CONTEXT, useExisting: ForTreeItem }],\n})\nexport class ForTreeItem<T = string> implements ForTreeItemContext<T> {\n  readonly #tree = injectTreeContext<T>('ForTreeItem');\n  readonly #container = injectTreeContainerContext<T>('ForTreeItem');\n  readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n  readonly #drag = inject(FOR_TREE_NODE_DRAG_CONTEXT, { optional: true });\n\n  /**\n   * Stable identifier for this node, mirrored into `[(value)]` / `[(expanded)]`.\n   *\n   * Mandatory — an unbound item throws in dev mode.\n   *\n   * That seeding is what lets the item register **synchronously**, so its\n   * `aria-posinset` / `aria-setsize` resolve from the container in the creation\n   * pass — including a real server render, where `afterNextRender` never fires\n   * and a deferred registration left the pre-hydration DOM claiming\n   * `aria-posinset=\"0\"` / `aria-setsize=\"0\"`, values WAI-ARIA defines no meaning\n   * for.\n   */\n  readonly value = input(unsetInput<T>());\n\n  /** Disables this node: not selectable, skipped by keyboard navigation. */\n  readonly disabled = input(false, { transform: booleanAttribute });\n\n  /**\n   * Typeahead text source override. Falls back to the `[forTreeItemLabel]`\n   * element's text content when empty (default).\n   */\n  readonly textValue = input<string>('');\n\n  /**\n   * Virtualized path: zero-based absolute index in the flattened visible-node list.\n   * Leave unset (default `null`) outside the virtualized path.\n   */\n  readonly itemIndex = input<number | null>(null);\n\n  /**\n   * Virtualized path: tree depth of this node (1-based, matching `aria-level`).\n   * When set, overrides the container-derived level in the virtualized path.\n   * Leave unset outside the virtualized path.\n   */\n  readonly _levelInput = input<number | null>(null, { alias: 'level' });\n\n  /**\n   * Virtualized path: total number of siblings at this node's level (matching\n   * `aria-setsize`). When set, overrides the container-derived setsize in the\n   * virtualized path. Leave unset outside the virtualized path.\n   */\n  readonly _setSizeInput = input<number | null>(null, { alias: 'setSize' });\n\n  /**\n   * Virtualized path: 1-based position among siblings at this node's level\n   * (matching `aria-posinset`). When set, overrides the container-derived\n   * posinset in the virtualized path. Leave unset outside the virtualized path.\n   */\n  readonly _posInSetInput = input<number | null>(null, { alias: 'posInSet' });\n\n  readonly #toggleCount = signal(0);\n  readonly #childContainer = signal<ForTreeContainerContext<T> | null>(null);\n  readonly #labelEl = signal<HTMLElement | null>(null);\n\n  readonly id = hostId('for-tree-item');\n\n  readonly #virtualized = computed(() => this.#tree.totalCount() !== undefined);\n\n  /** True once a `[forTreeItemToggle]` registers, marking the node a parent (D4). */\n  readonly expandable = computed(() => this.#toggleCount() > 0);\n  readonly expanded = computed(() => this.#tree.isExpanded(this.value()));\n  readonly selected = computed(() => this.#tree.isSelected(this.value()));\n  /** True when the root tree is in `'checkbox'` selection mode. */\n  readonly checkboxMode = computed(() => this.#tree.selectionMode() === 'checkbox');\n  /**\n   * Tri-state checkbox status of this node — `'true'` / `'false'`, or `'mixed'`\n   * when cascade is on and only some descendants are checked. Drives the\n   * checkbox anatomy; meaningful only in `selectionMode=\"checkbox\"`.\n   */\n  readonly checkState = computed(() => this.#tree.checkState(this.value()));\n\n  /**\n   * True when this node is the current keyboard-focused / active candidate.\n   * In the roving-tabindex path tracks DOM focus; in the virtualized\n   * activedescendant path tracks `aria-activedescendant`. Reflected as\n   * `data-highlighted`.\n   */\n  readonly highlighted = computed(() => {\n    const activeId = this.#tree.activeDescendantId();\n    if (activeId !== null) return activeId === this.id();\n    return this.#tree.roving.active() === this.#host.nativeElement;\n  });\n  readonly effectiveDisabled = computed(() => this.disabled() || this.#tree.disabled());\n\n  /**\n   * Drop-indicator hook for `[forTreeNodeDrag]`: `'before'` / `'after'` when a live drag would\n   * land adjacent to this row, `null` otherwise (and always `null` without a drag coordinator).\n   * Reflected as `data-drop-position`.\n   */\n  protected readonly _dropPosition = computed<'before' | 'after' | null>(() => {\n    const indicator = this.#drag?.dropIndicator();\n    const equals = this.#tree.compareWith() as (a: unknown, b: unknown) => boolean;\n    if (!indicator || !equals(indicator.anchor, this.value())) {\n      return null;\n    }\n    return indicator.position;\n  });\n\n  readonly level = computed(() =>\n    this.#virtualized() ? (this._levelInput() ?? this.#container.level()) : this.#container.level(),\n  );\n  readonly posinset = computed(() =>\n    this.#virtualized()\n      ? (this._posInSetInput() ?? this.#container.indexOfHost(this.#host.nativeElement) + 1)\n      : this.#container.indexOfHost(this.#host.nativeElement) + 1,\n  );\n  readonly setsize = computed(() =>\n    this.#virtualized()\n      ? (this._setSizeInput() ?? this.#container.items().length)\n      : this.#container.items().length,\n  );\n\n  protected readonly tabindex = computed<-1 | 0>(() => {\n    if (this.effectiveDisabled()) {\n      return -1;\n    }\n    if (this.#virtualized()) {\n      return -1;\n    }\n    if (this.#tree.roving.hasActive()) {\n      return this.#tree.roving.tabindexFor(this.#host.nativeElement);\n    }\n    return this.#tree.isFirstFocusableItem(this.#host.nativeElement) ? 0 : -1;\n  });\n\n  constructor() {\n    assertInputBound(this.value, 'tree', '[forTreeItem]', 'value');\n    const handle: ForTreeItemHandle<T> = {\n      host: this.#host.nativeElement,\n      value: this.value,\n      disabled: this.effectiveDisabled,\n      expandable: this.expandable,\n      childContainer: this.#childContainer.asReadonly(),\n      textValue: this.textValue,\n      labelEl: this.#labelEl.asReadonly(),\n      id: this.id,\n      itemIndex: this.itemIndex,\n      level: this.level,\n    };\n    registerHandle(\n      handle,\n      (h) => this.#container.registerItem(h),\n      (h) => this.#container.unregisterItem(h),\n    );\n  }\n\n  registerToggle(): () => void {\n    this.#toggleCount.update((n) => n + 1);\n    return () => this.#toggleCount.update((n) => n - 1);\n  }\n\n  setChildContainer(container: ForTreeContainerContext<T> | null): void {\n    this.#childContainer.set(container);\n  }\n\n  setLabel(el: HTMLElement | null): void {\n    this.#labelEl.set(el);\n  }\n\n  toggle(): void {\n    if (!this.expandable() || this.effectiveDisabled()) {\n      return;\n    }\n    this.#tree.setExpanded(this.value(), !this.expanded());\n  }\n\n  select(): void {\n    if (this.effectiveDisabled()) {\n      return;\n    }\n    this.#tree.select(this.value());\n  }\n\n  focusItem(): void {\n    if (this.effectiveDisabled()) {\n      return;\n    }\n    if (this.#virtualized()) {\n      this.#tree.notifyItemClick(this.id());\n      return;\n    }\n    this.#tree.roving.focusActive(this.#host.nativeElement);\n  }\n\n  protected onFocus(): void {\n    if (this.effectiveDisabled() || this.#virtualized()) {\n      return;\n    }\n    this.#tree.roving.setActive(this.#host.nativeElement);\n  }\n\n  protected onPointerDown(event: PointerEvent): void {\n    if (!this.#virtualized()) return;\n    event.preventDefault();\n  }\n\n  protected onKeyDown(event: KeyboardEvent): void {\n    const host = this.#host.nativeElement;\n    // Tree items nest, so a keydown on a descendant bubbles through every\n    // ancestor treeitem. Only the focused item (the event target) acts.\n    if (event.target !== host || this.effectiveDisabled()) {\n      return;\n    }\n    const tree = this.#tree;\n\n    if (tree.multiple()) {\n      if (\n        (event.ctrlKey || event.metaKey) &&\n        !event.shiftKey &&\n        !event.altKey &&\n        (event.key === 'a' || event.key === 'A')\n      ) {\n        event.preventDefault();\n        tree.selectAll();\n        return;\n      }\n      if (event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey) {\n        const action = resolveListNavigation(event, {\n          orientation: tree.orientation(),\n          dir: tree.dir(),\n        });\n        if (action === 'next' || action === 'prev') {\n          event.preventDefault();\n          tree.extendByArrow(host, action);\n          return;\n        }\n        if (event.key === ' ' || event.key === 'Spacebar') {\n          event.preventDefault();\n          tree.selectRangeToFocused(host);\n          return;\n        }\n      }\n    }\n\n    if (event.key === 'Enter') {\n      event.preventDefault();\n      tree.select(this.value());\n      return;\n    }\n    if (event.key === ' ' || event.key === 'Spacebar') {\n      event.preventDefault();\n      tree.select(this.value());\n      return;\n    }\n    if (event.key === '*') {\n      event.preventDefault();\n      tree.expandSiblings(host);\n      return;\n    }\n\n    const action = resolveListNavigation(event, {\n      orientation: tree.orientation(),\n      dir: tree.dir(),\n    });\n    if (action) {\n      event.preventDefault();\n      tree.navigate(host, action);\n      return;\n    }\n\n    const intent = resolveTreeExpandCollapse(event, {\n      orientation: tree.orientation(),\n      dir: tree.dir(),\n    });\n    if (intent === 'expand') {\n      event.preventDefault();\n      tree.expandOrEnter(host);\n      return;\n    }\n    if (intent === 'collapse') {\n      event.preventDefault();\n      tree.collapseOrLeave(host);\n      return;\n    }\n\n    tree.handleTypeahead(event);\n  }\n}\n","import { DestroyRef, Directive, ElementRef, inject } from '@angular/core';\n\nimport { injectTreeItemContext } from './tree-context';\n\n/**\n * Pointer target for a `ForTreeItem` and the default typeahead text source.\n * Clicking it selects the node and moves roving focus to the `treeitem`\n * (focus stays on the item, never on the label). Place the\n * `[forTreeItemToggle]` and the node's visible text inside it.\n */\n@Directive({\n  selector: '[forTreeItemLabel]',\n  exportAs: 'forTreeItemLabel',\n  host: {\n    '(click)': 'onClick()',\n  },\n})\nexport class ForTreeItemLabel {\n  readonly #item = injectTreeItemContext('ForTreeItemLabel');\n  readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n  constructor() {\n    this.#item.setLabel(this.#host.nativeElement);\n    inject(DestroyRef).onDestroy(() => this.#item.setLabel(null));\n  }\n\n  protected onClick(): void {\n    this.#item.select();\n    this.#item.focusItem();\n  }\n}\n","import { DestroyRef, Directive, inject } from '@angular/core';\n\nimport { hostButtonType } from 'forty-cdk/core';\nimport { injectTreeItemContext } from './tree-context';\n\n/**\n * Optional expand / collapse control inside a `ForTreeItem`. Its mere presence\n * marks the item as a parent (D4): a `treeitem` emits `aria-expanded` /\n * `data-state` only when a toggle is registered, so leaves (no toggle) emit\n * neither — matching the APG \"end nodes lack `aria-expanded`\" rule.\n *\n * Decorative: the enclosing `treeitem` owns `aria-expanded`, so the toggle is\n * `aria-hidden` and not separately focusable. Clicking it toggles expansion\n * without selecting the node.\n */\n@Directive({\n  selector: '[forTreeItemToggle]',\n  exportAs: 'forTreeItemToggle',\n  host: {\n    '[attr.type]': 'buttonType()',\n    tabindex: '-1',\n    'aria-hidden': 'true',\n    '[attr.data-state]': 'item.expanded() ? \"open\" : \"closed\"',\n    '(click)': 'onClick($event)',\n  },\n})\nexport class ForTreeItemToggle {\n  protected readonly buttonType = hostButtonType();\n\n  protected readonly item = injectTreeItemContext('ForTreeItemToggle');\n\n  constructor() {\n    const unregister = this.item.registerToggle();\n    inject(DestroyRef).onDestroy(unregister);\n  }\n\n  protected onClick(event: MouseEvent): void {\n    event.stopPropagation();\n    this.item.toggle();\n  }\n}\n","import { computed, DestroyRef, Directive, inject } from '@angular/core';\n\nimport { Collection } from 'forty-cdk/core';\nimport {\n  FOR_TREE_CONTAINER_CONTEXT,\n  type ForTreeContainerContext,\n  type ForTreeItemHandle,\n  injectTreeItemContext,\n} from './tree-context';\n\n/**\n * Nested container (`role=\"group\"`) holding a parent node's child\n * `ForTreeItem`s. Rendered behind `@if` so a collapsed parent drops its group\n * entirely. Its `level` is one deeper than the enclosing item, and it\n * registers itself as that item's child container so the root can flatten the\n * visible nodes.\n *\n * @example\n * ```html\n * @if (n.children?.length && isExpanded(n.id)) {\n *   <ul forTreeGroup>\n *     @for (child of n.children; track child.id) { ... }\n *   </ul>\n * }\n * ```\n */\n@Directive({\n  selector: '[forTreeGroup]',\n  exportAs: 'forTreeGroup',\n  host: {\n    role: 'group',\n  },\n  providers: [{ provide: FOR_TREE_CONTAINER_CONTEXT, useExisting: ForTreeGroup }],\n})\nexport class ForTreeGroup implements ForTreeContainerContext {\n  readonly #parentItem = injectTreeItemContext('ForTreeGroup');\n  readonly #items = new Collection<ForTreeItemHandle>();\n\n  readonly items = this.#items.items;\n  readonly level = computed(() => this.#parentItem.level() + 1);\n\n  constructor() {\n    this.#parentItem.setChildContainer(this);\n    inject(DestroyRef).onDestroy(() => this.#parentItem.setChildContainer(null));\n  }\n\n  registerItem(handle: ForTreeItemHandle): void {\n    this.#items.register(handle);\n  }\n\n  unregisterItem(handle: ForTreeItemHandle): void {\n    this.#items.unregister(handle);\n  }\n\n  indexOfHost(el: HTMLElement): number {\n    return this.#items.indexOfHost(el);\n  }\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectTreeItemContext } from './tree-context';\n\n/**\n * Visible checkbox surface inside a `ForTreeItem`, used in the tree's\n * `selectionMode=\"checkbox\"` anatomy. Decorative for assistive tech — the\n * enclosing `treeitem` owns `aria-checked`, so this element is `aria-hidden`\n * and not separately focusable. Reflects `data-state=\"checked\" | \"unchecked\" |\n * \"indeterminate\"` for styling. Clicking it toggles the node's selection and\n * moves roving focus to the node; place a `[forTreeItemCheckboxIndicator]`\n * inside for the glyph.\n */\n@Directive({\n  selector: '[forTreeItemCheckbox]',\n  exportAs: 'forTreeItemCheckbox',\n  host: {\n    'aria-hidden': 'true',\n    '[attr.data-state]': 'dataState()',\n    '(click)': 'onClick($event)',\n  },\n})\nexport class ForTreeItemCheckbox {\n  protected readonly item = injectTreeItemContext('ForTreeItemCheckbox');\n\n  protected readonly dataState = computed(() => {\n    const state = this.item.checkState();\n    return state === 'true' ? 'checked' : state === 'mixed' ? 'indeterminate' : 'unchecked';\n  });\n\n  protected onClick(event: MouseEvent): void {\n    event.stopPropagation();\n    this.item.select();\n    this.item.focusItem();\n  }\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectTreeItemContext } from './tree-context';\n\n/**\n * Optional glyph slot inside a `[forTreeItemCheckbox]`. Shows while the node\n * is checked or indeterminate (`data-state=\"checked\"` or `\"indeterminate\"`);\n * self-hides only when fully unchecked. Hidden state is enforced with an inline\n * `display: none` (which beats any author `display` rule applied via a class)\n * in addition to the `hidden` attribute that removes it from the a11y tree.\n * Mirrors `data-state=\"checked\" | \"unchecked\" | \"indeterminate\"` from the item.\n */\n@Directive({\n  selector: '[forTreeItemCheckboxIndicator]',\n  exportAs: 'forTreeItemCheckboxIndicator',\n  host: {\n    '[attr.data-state]': 'dataState()',\n    '[attr.hidden]': 'shown() ? null : \"\"',\n    '[style.display]': 'shown() ? null : \"none\"',\n  },\n})\nexport class ForTreeItemCheckboxIndicator {\n  protected readonly item = injectTreeItemContext('ForTreeItemCheckboxIndicator');\n\n  protected readonly shown = computed(() => this.item.checkState() !== 'false');\n  protected readonly dataState = computed(() => {\n    const state = this.item.checkState();\n    return state === 'true' ? 'checked' : state === 'mixed' ? 'indeterminate' : 'unchecked';\n  });\n}\n","/**\n * Returns the de-duplicated ancestor values that must be added to a tree's\n * `expanded` set so every matched node becomes visible.\n *\n * Pure and headless: filtering stays consumer-owned — the consumer matches its\n * own data, re-renders the tree, and feeds its hierarchy through `ancestorsOf`.\n * Merge the result into `[(expanded)]`:\n *\n * ```ts\n * this.expanded.update((open) => [\n *   ...new Set([...open, ...expandToReveal(matches, this.ancestorsOf)]),\n * ]);\n * ```\n *\n * The matched nodes themselves are not returned — a node is made visible by\n * expanding its ancestors, so a root-level match contributes nothing.\n *\n * @param matches The values of the nodes that matched the current filter.\n * @param ancestorsOf Returns a node's ancestor values (the node itself excluded);\n *   order is irrelevant and a root node returns an empty list.\n * @returns The unique ancestor values to expand. Empty when `matches` is empty\n *   or every match is a root.\n */\nexport function expandToReveal<T = string>(\n  matches: Iterable<T>,\n  ancestorsOf: (value: T) => readonly T[],\n): readonly T[] {\n  const reveal = new Set<T>();\n  for (const match of matches) {\n    for (const ancestor of ancestorsOf(match)) {\n      reveal.add(ancestor);\n    }\n  }\n  return [...reveal];\n}\n","import { DestroyRef, Directive, ElementRef, inject } from '@angular/core';\n\nimport { orphanContextError } from 'forty-cdk/core';\n\nimport { FOR_TREE_NODE_DRAG_CONTEXT } from './tree-node-drag';\n\n/**\n * Optional drag handle for a tree node. When placed inside a tree item, it constrains the pointer\n * grab area — only pointer events originating from within this element start a drag for that item.\n * Has no effect on the keyboard drag path (Ctrl+Space on the focused item always works).\n *\n * @example\n * ```html\n * <li forTreeItem value=\"file\">\n *   <span forTreeNodeDragHandle aria-hidden=\"true\">⠿</span>\n *   <span forTreeItemLabel>File.txt</span>\n * </li>\n * ```\n */\n@Directive({\n  selector: '[forTreeNodeDragHandle]',\n  exportAs: 'forTreeNodeDragHandle',\n})\nexport class ForTreeNodeDragHandle {\n  constructor() {\n    const ctx = inject(FOR_TREE_NODE_DRAG_CONTEXT, { optional: true });\n    if (!ctx) {\n      throw orphanContextError({\n        code: 'FORCDK-TREE-004',\n        piece: '[forTreeNodeDragHandle]',\n        root: '[forTreeNodeDrag]',\n        token: 'FOR_TREE_NODE_DRAG_CONTEXT',\n      });\n    }\n    const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n    ctx.registerHandle(el);\n    inject(DestroyRef).onDestroy(() => ctx.unregisterHandle(el));\n  }\n}\n","import type { ForTreeDragDropEvent } from './tree-drag-drop-event';\n\n/**\n * Options for {@link moveTreeNode}. Generic over the consumer's node type `T` and the\n * tree's node value type `V` (default `string`, matching `ForTree`'s own default).\n */\nexport interface MoveTreeNodeOptions<T, V = string> {\n  /** The move descriptor as emitted by `(nodeDrop)`. Carries the tree's node values. */\n  readonly event: ForTreeDragDropEvent<V>;\n  /** Stable id of a node — must return the same value used as the tree item `[value]`. */\n  readonly trackBy: (node: T) => V;\n  /** A node's children, or `undefined` / `[]` for a leaf. */\n  readonly children: (node: T) => readonly T[] | undefined;\n  /** Returns a copy of `node` with its children replaced. MUST NOT mutate `node`. */\n  readonly withChildren: (node: T, children: readonly T[]) => T;\n}\n\nfunction collectSubtreeIds<T, V>(node: T, options: MoveTreeNodeOptions<T, V>): Set<V> {\n  const ids = new Set<V>();\n  ids.add(options.trackBy(node));\n  const kids = options.children(node) ?? [];\n  for (const child of kids) {\n    for (const id of collectSubtreeIds(child, options)) {\n      ids.add(id);\n    }\n  }\n  return ids;\n}\n\ntype DetachResult<T> = { found: T; roots: readonly T[] } | null;\n\nfunction detachNode<T, V>(\n  roots: readonly T[],\n  targetId: V,\n  options: MoveTreeNodeOptions<T, V>,\n): DetachResult<T> {\n  for (let i = 0; i < roots.length; i++) {\n    const node = roots[i]!;\n    if (options.trackBy(node) === targetId) {\n      const next = [...roots.slice(0, i), ...roots.slice(i + 1)];\n      return { found: node, roots: next };\n    }\n    const kids = options.children(node) ?? [];\n    if (kids.length > 0) {\n      const childResult = detachNode(kids, targetId, options);\n      if (childResult !== null) {\n        const updatedNode = options.withChildren(node, childResult.roots);\n        const next = [...roots.slice(0, i), updatedNode, ...roots.slice(i + 1)];\n        return { found: childResult.found, roots: next };\n      }\n    }\n  }\n  return null;\n}\n\nfunction insertNode<T, V>(\n  roots: readonly T[],\n  parentId: V | null,\n  index: number,\n  nodeToInsert: T,\n  options: MoveTreeNodeOptions<T, V>,\n): readonly T[] | null {\n  if (parentId === null) {\n    const clamped = Math.max(0, Math.min(index, roots.length));\n    return [...roots.slice(0, clamped), nodeToInsert, ...roots.slice(clamped)];\n  }\n  for (let i = 0; i < roots.length; i++) {\n    const node = roots[i]!;\n    if (options.trackBy(node) === parentId) {\n      const kids = options.children(node) ?? [];\n      const clamped = Math.max(0, Math.min(index, kids.length));\n      const newKids = [...kids.slice(0, clamped), nodeToInsert, ...kids.slice(clamped)];\n      const updated = options.withChildren(node, newKids);\n      return [...roots.slice(0, i), updated, ...roots.slice(i + 1)];\n    }\n    const kids = options.children(node) ?? [];\n    if (kids.length > 0) {\n      const result = insertNode(kids, parentId, index, nodeToInsert, options);\n      if (result !== null) {\n        const updated = options.withChildren(node, result);\n        return [...roots.slice(0, i), updated, ...roots.slice(i + 1)];\n      }\n    }\n  }\n  return null;\n}\n\n/**\n * Applies a {@link ForTreeDragDropEvent} to a nested, consumer-owned tree, returning a new roots\n * array. Pure and immutable — never mutates `roots` or any node. Detaches `event.node` from its\n * current parent and re-inserts it (with its subtree) under `event.newParent` at\n * `event.currentIndex` (or among the roots when `newParent` is `null`). Returns a shallow copy of\n * `roots` unchanged when the move is a no-op or invalid (node not found, or `newParent` is the node\n * itself or one of its descendants).\n */\nexport function moveTreeNode<T, V = string>(\n  roots: readonly T[],\n  options: MoveTreeNodeOptions<T, V>,\n): T[] {\n  const { event } = options;\n\n  const detachResult = detachNode(roots, event.node, options);\n  if (detachResult === null) {\n    return [...roots];\n  }\n\n  const { found, roots: rootsAfterDetach } = detachResult;\n\n  if (event.newParent !== null) {\n    const subtreeIds = collectSubtreeIds(found, options);\n    if (subtreeIds.has(event.newParent)) {\n      return [...roots];\n    }\n    if (event.newParent === event.node) {\n      return [...roots];\n    }\n  }\n\n  const result = insertNode(rootsAfterDetach, event.newParent, event.currentIndex, found, options);\n  if (result === null) {\n    return [...roots];\n  }\n\n  return result as T[];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAqEA;;;;;;AAMG;MACU,gBAAgB,CAAA;AAClB,IAAA,KAAK;AAEd,IAAA,WAAA,CAAY,IAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;IACnB;AAEA,IAAA,WAAW,CAAC,MAA4B,EAAA;QACtC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;IAC5C;IAEA,OAAO,GAAA;AACL,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE;QACjC,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,OAAO,IAAI;QACb;AACA,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;QAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE;IAChG;AAEA,IAAA,QAAQ,CAAC,MAA4B,EAAA;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE;AACzC,QAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB;QACF;AACA,QAAA,MAAM,YAAY,GAAG,KAAK,CAAC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