{"version":3,"file":"igniteui-angular-virtual-scroll.mjs","names":[],"sources":["../../../projects/igniteui-angular/virtual-scroll/src/virtual-scroll/scroll-engine.ts","../../../projects/igniteui-angular/virtual-scroll/src/virtual-scroll/types.ts","../../../projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll-item.directive.ts","../../../projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll-recycle.directive.ts","../../../projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll.component.ts","../../../projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll.component.html"],"sourcesContent":["import { computed, signal } from \"@angular/core\";\nimport { clamp } from \"igniteui-angular/core\";\nimport type { ScrollAlignment, VisibleRange } from \"./types\";\n\n/** The maximum scroll coordinate is a per-document constant, so probe once. */\nconst _maxBrowserSizeCache = new WeakMap<Document, number>();\n\n/** Measures the largest scroll coordinate the browser can represent. */\nfunction probeMaxBrowserSize(doc: Document): number {\n  const cached = _maxBrowserSizeCache.get(doc);\n  if (cached !== undefined) {\n    return cached;\n  }\n\n  const container = doc.body ?? doc.documentElement;\n  if (!container) {\n    return Number.POSITIVE_INFINITY;\n  }\n\n  const probe = doc.createElement(\"div\");\n  probe.style.position = \"absolute\";\n  probe.style.top = `${Number.MAX_SAFE_INTEGER}px`;\n  probe.style.width = \"0\";\n  probe.style.height = \"0\";\n  probe.style.visibility = \"hidden\";\n  container.appendChild(probe);\n\n  // The rect is viewport relative, so add back how far the document is scrolled.\n  const scrollOffset = doc.documentElement?.scrollTop ?? 0;\n  const size = Math.abs(probe.getBoundingClientRect().top) + scrollOffset;\n  container.removeChild(probe);\n\n  _maxBrowserSizeCache.set(doc, size);\n  return size;\n}\n\n/** The item holds the estimate. */\nconst UNMEASURED = 0;\n/** The item was measured under an older estimate. */\nconst MEASURED = 1;\n/** The item was measured under the current estimate. */\nconst SAMPLED = 2;\n\n/**\n * Binary Indexed Tree (Fenwick tree) over item sizes. Each hot-path operation\n * is O(log N): point update (item measured), prefix sum (scroll offset), and\n * index at offset (scroll to item, through binary lifting).\n *\n * The tree holds only the measured sizes and the number of measured items.\n * Each unmeasured item counts as `estimate`, so an estimate change is O(1).\n */\nclass SizeTree {\n  public readonly length: number;\n\n  /** The size of each unmeasured item. */\n  public estimate: number;\n\n  /** A 1-indexed BIT of the measured sizes. */\n  private readonly _sums: Float64Array;\n\n  /** A 1-indexed BIT of the number of measured items. */\n  private readonly _counts: Int32Array;\n\n  /** Raw measured sizes, 0-indexed. Kept for O(1) delta calculation. */\n  private readonly _sizes: Float64Array;\n\n  /** `UNMEASURED`, `MEASURED` or `SAMPLED` for each item. */\n  private readonly _states: Uint8Array;\n\n  private _measuredCount = 0;\n  private _measuredTotal = 0;\n\n  /** Count and size sum of the `SAMPLED` items. */\n  private _sampleCount = 0;\n  private _sampleTotal = 0;\n\n  /**\n   * The highest power of two <= `length`, for the binary lifting in\n   * `findIndexAtOffset`. Precomputed because that runs on each scroll event.\n   */\n  private readonly _topBit: number;\n\n  /** Builds the tree in one O(N) pass. Without `states`, no item is measured. */\n  constructor(\n    length: number,\n    estimate: number,\n    sizes = new Float64Array(length),\n    states = new Uint8Array(length),\n  ) {\n    this.length = length;\n    this.estimate = estimate;\n    this._sizes = sizes;\n    this._states = states;\n    this._sums = new Float64Array(length + 1);\n    this._counts = new Int32Array(length + 1);\n    this._topBit = length > 0 ? 1 << (31 - Math.clz32(length)) : 0;\n\n    for (let i = 1; i <= length; i++) {\n      const state = states[i - 1];\n\n      if (state !== UNMEASURED) {\n        const size = sizes[i - 1];\n        this._sums[i] += size;\n        this._counts[i]++;\n        this._measuredCount++;\n        this._measuredTotal += size;\n\n        if (state === SAMPLED) {\n          this._sampleCount++;\n          this._sampleTotal += size;\n        }\n      }\n\n      const parent = i + (i & -i);\n      if (parent <= length) {\n        this._sums[parent] += this._sums[i];\n        this._counts[parent] += this._counts[i];\n      }\n    }\n  }\n\n  /** Total size of all items. O(1). */\n  public get totalSize(): number {\n    return this.totalSizeAt(this.estimate);\n  }\n\n  /** Total size of all items if unmeasured ones took `estimate`. O(1). */\n  public totalSizeAt(estimate: number): number {\n    return this._measuredTotal + (this.length - this._measuredCount) * estimate;\n  }\n\n  /** The number of measured items. O(1). */\n  public get measuredCount(): number {\n    return this._measuredCount;\n  }\n\n  /** The average size of the `SAMPLED` items, or `0` if there are none. */\n  public get sampleAverage(): number {\n    return this._sampleCount > 0 ? this._sampleTotal / this._sampleCount : 0;\n  }\n\n  /** Whether each item before `index` is measured. O(log N). */\n  public isMeasuredBefore(index: number): boolean {\n    let count = 0;\n    for (let j = index; j > 0; j -= j & -j) {\n      count += this._counts[j];\n    }\n    return count === index;\n  }\n\n  /**\n   * Prefix sum of items [0, i): the virtual scroll offset at the leading\n   * edge of item i. O(log N).\n   */\n  public prefixSum(i: number): number {\n    let sum = 0;\n    let count = 0;\n    for (let j = i; j > 0; j -= j & -j) {\n      sum += this._sums[j];\n      count += this._counts[j];\n    }\n    return sum + (i - count) * this.estimate;\n  }\n\n  /**\n   * Sets the size of the item at a 0-based index and marks it `SAMPLED`.\n   * Returns true when the size changed. O(log N).\n   */\n  public update(index: number, size: number): boolean {\n    if (index < 0 || index >= this.length) {\n      return false;\n    }\n\n    const state = this._states[index];\n    const isNew = state === UNMEASURED;\n    const old = isNew ? 0 : this._sizes[index];\n    const delta = size - old;\n\n    this._states[index] = SAMPLED;\n    this._sizes[index] = size;\n    this._measuredTotal += delta;\n    this._sampleTotal += state === SAMPLED ? delta : size;\n\n    if (state !== SAMPLED) {\n      this._sampleCount++;\n    }\n    if (isNew) {\n      this._measuredCount++;\n    }\n\n    if (isNew || delta !== 0) {\n      for (let i = index + 1; i <= this.length; i += i & -i) {\n        this._sums[i] += delta;\n        if (isNew) {\n          this._counts[i]++;\n        }\n      }\n    }\n\n    return size !== (isNew ? this.estimate : old);\n  }\n\n  /**\n   * Returns a new tree of `newLength` items. Measured sizes are kept up to\n   * `min(this.length, newLength, retainCount)`, and the other items are\n   * unmeasured. Pass a `retainCount` below the item count when the data\n   * behind those indices changed identity. O(N).\n   */\n  public cloneResized(newLength: number, retainCount = newLength): SizeTree {\n    const retained = Math.max(0, Math.min(this.length, newLength, retainCount));\n    const sizes = new Float64Array(newLength);\n    const states = new Uint8Array(newLength);\n\n    sizes.set(this._sizes.subarray(0, retained));\n    states.set(this._states.subarray(0, retained));\n    return new SizeTree(newLength, this.estimate, sizes, states);\n  }\n\n  /**\n   * Starts a new sample: `sampleAverage` then counts only the items measured\n   * after this call. O(N).\n   */\n  public startSample(): void {\n    for (let i = 0; i < this.length; i++) {\n      if (this._states[i] === SAMPLED) {\n        this._states[i] = MEASURED;\n      }\n    }\n    this._sampleCount = 0;\n    this._sampleTotal = 0;\n  }\n\n  /**\n   * Returns the 0-based index of the item containing the scroll `offset`:\n   * the largest i where `prefixSum(i) <= offset < prefixSum(i + 1)`. O(log N).\n   */\n  public findIndexAtOffset(offset: number): number {\n    if (offset <= 0 || this.length === 0) {\n      return 0;\n    }\n\n    let index = 0;\n    let remaining = offset;\n\n    for (let bit = this._topBit; bit > 0; bit >>= 1) {\n      const next = index + bit;\n      if (next > this.length) {\n        continue;\n      }\n\n      // Node `next` covers the `bit` items after `index`.\n      const size = this._sums[next] + (bit - this._counts[next]) * this.estimate;\n      if (size <= remaining) {\n        index = next;\n        remaining -= size;\n      }\n    }\n    return Math.min(this.length - 1, index);\n  }\n}\n\n/**\n * Pure scroll-math engine for one axis of virtual scrolling. A Fenwick tree\n * holds all size state, exposed through signals so downstream `computed()`\n * values (visible range, spacer size, translate offset) react to any change\n * of item sizes or item count.\n *\n * ### Virtual and DOM coordinates\n *\n * Browsers limit how far an element can scroll. When the total item size is\n * larger than that limit, the engine maps the *virtual* scroll range\n * (`0…totalSize - viewport`) onto the *DOM* scroll range the browser can\n * represent (`0…domSize - viewport`), see `_scrollRanges`. Incoming scroll\n * positions are converted to virtual offsets, outgoing offsets to DOM ones.\n * Items render at their real pixel size, so item sizes are always virtual.\n */\nexport class VirtualScrollEngine {\n  private _maxBrowserSize = Number.POSITIVE_INFINITY;\n\n  private _tree: SizeTree | null = null;\n\n  /** The estimate last given to `resize` or `updateEstimatedSize`. */\n  private _configuredEstimate = Number.NaN;\n\n  /** Whether `adaptEstimate` has applied a measured average. */\n  private _hasAdaptedEstimate = false;\n\n  /** Bumped on every structural change: resize, measurement or estimate. */\n  private readonly _version = signal(0);\n\n  /**\n   * Read this from a `computed()` to make it recompute on any size change.\n   * `totalSize` and `domSize` already do.\n   */\n  public readonly version = this._version.asReadonly();\n\n  /** Total virtual size of all items in px. */\n  public readonly totalSize = computed<number>(() => {\n    this._version();\n    return this._tree?.totalSize ?? 0;\n  });\n\n  /**\n   * Total size in DOM space, clamped to the maximum browser size.\n   *\n   * Depends on `_version` directly rather than on `totalSize()`. The maximum\n   * can change while the total does not (it is probed after the first\n   * render), and an unchanged `totalSize` would not propagate.\n   */\n  public readonly domSize = computed<number>(() => {\n    this._version();\n    return Math.min(this._tree?.totalSize ?? 0, this._maxBrowserSize);\n  });\n\n  /**\n   * Probes the document's maximum scroll coordinate and rescales. Notifies,\n   * because the probe can only run after the first render, by which point\n   * `domSize` has already been read at the uncompressed total.\n   */\n  public initMaxBrowserSize(doc: Document): void {\n    this._maxBrowserSize = probeMaxBrowserSize(doc);\n    this._invalidate();\n  }\n\n  /**\n   * Resizes the internal sizes array to `length`. Measured sizes below\n   * `retainCount` are kept, and the other items are unmeasured. Callers that\n   * only append can keep the default `retainCount`. Callers whose data\n   * changed identity at some index must pass that index, so the stale\n   * measurements after it are discarded.\n   *\n   * Unmeasured items take `estimatedSize`, or keep the adapted average while\n   * `estimatedSize` is unchanged.\n   */\n  public resize(\n    length: number,\n    estimatedSize: number,\n    retainCount = length,\n  ): void {\n    if (this._tree?.length === length && retainCount >= length) {\n      return;\n    }\n\n    this._tree =\n      this._tree?.cloneResized(length, retainCount) ??\n      new SizeTree(length, estimatedSize);\n\n    if (this._configureEstimate(estimatedSize)) {\n      this._tree.estimate = estimatedSize;\n    }\n    this._invalidate();\n  }\n\n  /** Records the measured DOM size for a single item. */\n  public measureItem(index: number, size: number): void {\n    if (this._tree?.update(index, size)) {\n      this._invalidate();\n    }\n  }\n\n  /**\n   * Applies a new estimate to every item not yet measured in the DOM. Use\n   * this when `estimatedItemSize` changes but the item count does not,\n   * because `resize` is then a no-op.\n   */\n  public updateEstimatedSize(estimatedSize: number): void {\n    if (this._configureEstimate(estimatedSize)) {\n      this._applyEstimate(estimatedSize);\n    }\n  }\n\n  /**\n   * Sets the unmeasured estimate to the average size measured since the\n   * estimate was configured; older sizes may predate a density change. After\n   * the first call, applies only while every item before `windowStart` is\n   * measured and the list stays uncompressed, so rendered items cannot shift.\n   */\n  public adaptEstimate(windowStart: number): void {\n    const tree = this._tree;\n    if (!tree?.sampleAverage) {\n      return;\n    }\n\n    // Compressed before or after, the total sets the scroll ratio: a new average moves every item.\n    const largerTotal = tree.totalSizeAt(Math.max(tree.estimate, tree.sampleAverage));\n    if (\n      this._hasAdaptedEstimate &&\n      (largerTotal > this._maxBrowserSize || !tree.isMeasuredBefore(windowStart))\n    ) {\n      return;\n    }\n\n    this._hasAdaptedEstimate = true;\n    this._applyEstimate(tree.sampleAverage);\n  }\n\n  /** Drops the measured sizes and the adapted estimate, keeping the item count. */\n  public clearSizes(): void {\n    const tree = this._tree;\n    if (!tree || (tree.measuredCount === 0 && !this._hasAdaptedEstimate)) {\n      return;\n    }\n\n    this._tree = new SizeTree(tree.length, this._configuredEstimate);\n    this._hasAdaptedEstimate = false;\n    this._invalidate();\n  }\n\n  /**\n   * Returns the DOM scroll offset in px that puts the item at `index` at the\n   * leading edge of a `viewportSize` px viewport.\n   */\n  public getScrollOffsetForIndex(index: number, viewportSize: number): number {\n    if (!this._tree || index <= 0) {\n      return 0;\n    }\n    return this._toDom(\n      this._tree.prefixSum(Math.min(index, this._tree.length)),\n      viewportSize,\n    );\n  }\n\n  /**\n   * Returns the DOM scroll offset that positions the item at `index` in a\n   * `viewportSize` px viewport, aligned by `align` and clamped to the\n   * reachable scroll range.\n   *\n   * The slack is computed in virtual space against the item's real size and\n   * converted to DOM space once, at the end. Under compression one DOM pixel\n   * is several virtual pixels, so mixed coordinates would scale the slack.\n   */\n  public getAlignedScrollOffset(\n    index: number,\n    viewportSize: number,\n    align: ScrollAlignment,\n  ): number {\n    const bounds = this._itemBounds(index);\n    if (!bounds) {\n      return 0;\n    }\n\n    const [start, end] = bounds;\n    const slack = viewportSize - Math.max(0, end - start);\n    let offset = start;\n\n    if (align === \"center\") {\n      offset -= slack / 2;\n    } else if (align === \"end\") {\n      offset -= slack;\n    }\n\n    return clamp(\n      this._toDom(offset, viewportSize),\n      0,\n      this._maxDomOffset(viewportSize),\n    );\n  }\n\n  /**\n   * Returns the DOM scroll offset that brings the item at `index` into view\n   * as `position` asks. `nearest` follows native `scrollIntoView`: an item in\n   * view, or one that covers the viewport, keeps `scrollPosition`, and any\n   * other item scrolls the smallest distance to an edge alignment.\n   *\n   * Example: 50px items in a 300px viewport at offset 0. Item 10 spans\n   * 500-550, so `nearest` returns 250 (end aligned) and `start` returns 500.\n   */\n  public resolveScrollOffset(\n    index: number,\n    scrollPosition: number,\n    viewportSize: number,\n    position: ScrollLogicalPosition,\n  ): number {\n    if (position === \"nearest\") {\n      const start = this.getAlignedScrollOffset(index, viewportSize, \"start\");\n      const end = this.getAlignedScrollOffset(index, viewportSize, \"end\");\n      return clamp(scrollPosition, Math.min(start, end), Math.max(start, end));\n    }\n\n    return this.getAlignedScrollOffset(\n      index,\n      viewportSize,\n      position === \"center\" || position === \"end\" ? position : \"start\",\n    );\n  }\n\n  /** Returns the visible and over-scanned item range for the given scroll state. */\n  public getVisibleRange(\n    scrollPosition: number,\n    viewportSize: number,\n    overScan: number,\n  ): VisibleRange {\n    if (!this._tree || this._tree.length === 0 || viewportSize <= 0) {\n      return { startIndex: 0, endIndex: -1 };\n    }\n\n    // The viewport is not compressed. Items render at their real pixel size,\n    // so a `viewportSize` px viewport always shows that many virtual pixels of\n    // items, at any compression of the scroll range.\n    const startOffset = this._toVirtual(scrollPosition, viewportSize);\n    const first = this._tree.findIndexAtOffset(startOffset);\n    const last = this._tree.findIndexAtOffset(startOffset + viewportSize);\n\n    return {\n      startIndex: Math.max(0, first - overScan),\n      endIndex: Math.min(this._tree.length - 1, last + overScan),\n    };\n  }\n\n  /**\n   * Sum of the real sizes of the items in [startIndex, endIndex]. The render\n   * pass uses it to clamp the content translate offset, so rendered items do\n   * not overflow past `domSize` under coordinate compression.\n   */\n  public getPhysicalRangeSize(startIndex: number, endIndex: number): number {\n    if (!this._tree) {\n      return 0;\n    }\n\n    const start = Math.max(0, startIndex);\n    const end = Math.min(Math.max(endIndex + 1, start), this._tree.length);\n    return this._tree.prefixSum(end) - this._tree.prefixSum(start);\n  }\n\n  /**\n   * The virtual [start, end] offsets of the item at `index`, clamped into the\n   * item range. Null while there are no items.\n   */\n  private _itemBounds(index: number): [number, number] | null {\n    if (!this._tree || this._tree.length === 0) {\n      return null;\n    }\n\n    const clamped = clamp(index, 0, this._tree.length - 1);\n    return [this._tree.prefixSum(clamped), this._tree.prefixSum(clamped + 1)];\n  }\n\n  /**\n   * Records a changed configured estimate and starts a new sample. Returns\n   * false for an unchanged one, which keeps the adapted average.\n   */\n  private _configureEstimate(estimatedSize: number): boolean {\n    if (estimatedSize === this._configuredEstimate) {\n      return false;\n    }\n\n    this._configuredEstimate = estimatedSize;\n    this._tree?.startSample();\n    return true;\n  }\n\n  private _applyEstimate(estimatedSize: number): void {\n    if (!this._tree || this._tree.estimate === estimatedSize) {\n      return;\n    }\n\n    this._tree.estimate = estimatedSize;\n    this._invalidate();\n  }\n\n  private _invalidate(): void {\n    this._version.update((v) => v + 1);\n  }\n\n  /**\n   * A virtual offset as the DOM scroll position that shows it, for a\n   * `viewportSize` px viewport.\n   */\n  private _toDom(virtualOffset: number, viewportSize: number): number {\n    const [virtualRange, domRange] = this._scrollRanges(viewportSize);\n    return (virtualOffset * domRange) / virtualRange;\n  }\n\n  /**\n   * A DOM scroll position as the virtual offset it shows, for a\n   * `viewportSize` px viewport.\n   */\n  private _toVirtual(domOffset: number, viewportSize: number): number {\n    const [virtualRange, domRange] = this._scrollRanges(viewportSize);\n\n    // A shrunken track's scroll event lags a frame, so clamp the stale offset now.\n    // E.g. 10 x 50px items, 300px viewport, stale 1000px: items 4-9, not 9 alone.\n    const reachable = clamp(domOffset, 0, this._maxDomOffset(viewportSize));\n    return (reachable * virtualRange) / domRange;\n  }\n\n  /** The largest DOM scroll offset for a `viewportSize` px viewport. */\n  private _maxDomOffset(viewportSize: number): number {\n    return Math.max(0, this.domSize() - viewportSize);\n  }\n\n  /**\n   * The virtual and DOM scroll ranges to map between; the identity while the\n   * content fits the browser's limit. One viewport of items renders at real\n   * size at any scroll position, so both ranges exclude it: mapping the totals\n   * instead would leave the last `viewport * (ratio - 1)` virtual pixels past\n   * the largest DOM offset. Callers multiply before dividing, so exact\n   * positions come back exact.\n   */\n  private _scrollRanges(viewportSize: number): [number, number] {\n    const totalSize = this._tree?.totalSize ?? 0;\n    const domRange = this._maxBrowserSize - viewportSize;\n\n    if (totalSize <= this._maxBrowserSize || domRange <= 0) {\n      return [1, 1];\n    }\n    return [totalSize - viewportSize, domRange];\n  }\n}\n","/** Template context for a single item of the virtual scroll. */\nexport class IgxVsItemContext<T> {\n  constructor(\n    /** The current item in the virtual scroll. */\n    public $implicit: T,\n    /** The index of the current item. */\n    public index: number,\n    /** The total number of items in the virtual scroll. */\n    public count: number,\n  ) {}\n\n  /** Whether the current item is the first in the list. */\n  public get first(): boolean {\n    return this.index === 0;\n  }\n\n  /** Whether the current item is the last in the list. */\n  public get last(): boolean {\n    return this.index === this.count - 1;\n  }\n\n  /** Whether the current item is at an even index. */\n  public get even(): boolean {\n    return this.index % 2 === 0;\n  }\n\n  /** Whether the current item is at an odd index. */\n  public get odd(): boolean {\n    return !this.even;\n  }\n}\n\n/** Returns an item's key from the item and its index in the whole collection. */\nexport type VirtualScrollKeyFunction<T> = (item: T, index: number) => unknown;\n\n/**\n * How `scrollToIndex` positions the requested item in the viewport.\n * The subset of `ScrollLogicalPosition` that the engine supports.\n */\nexport type ScrollAlignment = \"start\" | \"center\" | \"end\";\n\n/** The currently rendered (visible plus over-scanned) range of items. */\nexport interface VisibleRange {\n  /** Index of the first rendered item, inclusive. */\n  startIndex: number;\n  /** Index of the last rendered item, inclusive. */\n  endIndex: number;\n}\n\n/** Snapshot of the currently rendered virtual window. */\nexport interface VirtualScrollState extends VisibleRange {\n  /** The size of the viewport in pixels. */\n  viewportSize: number;\n  /** The total size of the virtual scroll content in pixels. */\n  totalSize: number;\n}\n\n/**\n * A loaded page of a larger collection, for data that arrives a page at a time.\n *\n * The list is sized by `totalCount` while only `items` are in memory. Indices are indices\n * in the whole collection: the item at `index` is `items[index - startIndex]`, and indices\n * the page does not cover render nothing.\n *\n * Measured sizes are kept per index across pages while `totalCount` holds: the indices still\n * mean the same records. A page with another `totalCount` is a different collection, and\n * every size is measured again. A page that keeps the count but puts different records at\n * the same indices keeps the sizes measured for the previous ones until those rows render.\n */\nexport interface VirtualDataWindow<T> {\n  /** The loaded items. */\n  readonly items: readonly T[];\n  /** The index `items[0]` has in the whole collection. */\n  readonly startIndex: number;\n  /** How many items the whole collection has. */\n  readonly totalCount: number;\n}\n\n/**\n * Request for more data, emitted when the rendered window nears the end of\n * the loaded items. Listen to it to implement infinite / remote scrolling.\n */\nexport interface VirtualScrollDataRequest {\n  /** The first index that does not yet have data. */\n  startIndex: number;\n  /** Number of items being requested. */\n  count: number;\n}\n","import { Directive, inject, TemplateRef } from \"@angular/core\";\nimport { IgxVsItemContext } from \"./types\";\n\n/**\n * Directive to mark an `ng-template` as the item template for the virtual scroll component.\n * The template provided by this directive will be used to render each item in the virtual scroll.\n * The context for the template will include the item data and its index.\n *\n * @example\n * ```html\n * <igx-virtual-scroll [data]=\"items\">\n *   <ng-template igxVirtualItem let-item let-i=\"index\">\n *     <div>{{ i }}: {{ item }}</div>\n *   </ng-template>\n * </igx-virtual-scroll>\n * ```\n */\n@Directive({ selector: \"ng-template[igxVirtualItem]\" })\nexport class IgxVirtualItemDirective<T = unknown> {\n  public readonly template =\n    inject<TemplateRef<IgxVsItemContext<T>>>(TemplateRef);\n}\n","import {\n  Directive,\n  EmbeddedViewRef,\n  inject,\n  input,\n  OnChanges,\n  TemplateRef,\n  ViewContainerRef,\n} from \"@angular/core\";\n\n/** The context of a recycled view. A reused view gets a new `$implicit`. */\nexport interface IgxVsRecycleContext<T> {\n  $implicit: T;\n}\n\ntype RecycledView<T> = EmbeddedViewRef<IgxVsRecycleContext<T>>;\n\n/**\n * Weights for choosing the views that stay in place. A recycled view needs a\n * new layout anyway, so kept views move only when fewer than half the recycled\n * ones.\n */\nconst KEPT_WEIGHT = 2;\nconst RECYCLED_WEIGHT = 1;\n\n/**\n * Marks the entries of the increasing subsequence of `values` with the largest\n * total weight. The values are distinct integers in `[0, size)`, or negative\n * for the entries to skip. O(n log size).\n */\nfunction heaviestIncreasingSubsequence(\n  values: Int32Array,\n  weights: Int32Array,\n  size: number,\n): Uint8Array {\n  // Fenwick tree over values: each node holds the heaviest weight ending in\n  // its range, and that entry.\n  const heaviest = new Int32Array(size + 1);\n  const endsAt = new Int32Array(size + 1);\n  const previous = new Int32Array(values.length);\n  const marked = new Uint8Array(values.length);\n  let best = 0;\n  let last = -1;\n\n  for (let i = 0; i < values.length; i++) {\n    if (values[i] < 0) {\n      continue;\n    }\n\n    let total = 0;\n    let before = -1;\n    for (let node = values[i]; node > 0; node -= node & -node) {\n      if (heaviest[node] > total) {\n        total = heaviest[node];\n        before = endsAt[node];\n      }\n    }\n\n    total += weights[i];\n    previous[i] = before;\n    for (let node = values[i] + 1; node <= size; node += node & -node) {\n      if (total > heaviest[node]) {\n        heaviest[node] = total;\n        endsAt[node] = i;\n      }\n    }\n\n    if (total > best) {\n      best = total;\n      last = i;\n    }\n  }\n\n  for (let i = last; i >= 0; i = previous[i]) {\n    marked[i] = 1;\n  }\n  return marked;\n}\n\n/**\n * @hidden @internal\n *\n * Like `@for`, but hands the view of a leaving key to an entering key instead\n * of destroying and recreating it, which avoids DOM churn on each scroll step.\n * Reused views keep DOM state the template does not bind.\n *\n * ```\n * keys   0 1 2 3            2 3 4 5      a scroll by two items\n * views  A B C D    ->      C D A B      C, D kept; A, B recycled\n * ```\n *\n * Untaken views are destroyed, not pooled: content queries still report\n * components in detached views.\n */\n@Directive({ selector: \"[igxVsRecycle][igxVsRecycleOf]\" })\nexport class IgxVsRecycleDirective<T> implements OnChanges {\n  private readonly _container = inject(ViewContainerRef);\n  private readonly _template =\n    inject<TemplateRef<IgxVsRecycleContext<T>>>(TemplateRef);\n\n  /** The items to render, in order. */\n  public readonly igxVsRecycleOf = input.required<readonly T[]>();\n\n  /** Returns the key of an item. */\n  public readonly igxVsRecycleKey = input.required<(item: T) => unknown>();\n\n  /** The rendered views and their keys, in DOM order. */\n  private _views: RecycledView<T>[] = [];\n  private _keys: unknown[] = [];\n\n  public static ngTemplateContextGuard<T>(\n    _directive: IgxVsRecycleDirective<T>,\n    _context: unknown,\n  ): _context is IgxVsRecycleContext<T> {\n    return true;\n  }\n\n  public ngOnChanges(): void {\n    const items = this.igxVsRecycleOf();\n    const keys = items.map(this.igxVsRecycleKey());\n\n    this._views = this._reconcile(items, keys);\n    this._keys = keys;\n  }\n\n  /**\n   * Gives each key a view, orders the views by key, and sets their items.\n   *\n   * 1. A staying key keeps its view.\n   * 2. Other keys take the leftover views in DOM order, so a full replacement\n   *    moves no DOM. Views are created when those run out; untaken ones are\n   *    destroyed.\n   * 3. The heaviest subsequence of reused views that keeps its order stays put\n   *    (see `KEPT_WEIGHT`). The focused view outweighs all others, so it keeps\n   *    focus. Each other view moves in front of its successor.\n   */\n  private _reconcile(\n    items: readonly T[],\n    keys: readonly unknown[],\n  ): RecycledView<T>[] {\n    const oldViews = this._views;\n\n    // Hydration hands out the server-rendered DOM in creation order.\n    if (oldViews.length === 0) {\n      return items.map((item) =>\n        this._container.createEmbeddedView(this._template, { $implicit: item }),\n      );\n    }\n\n    const count = keys.length;\n    const focused = this._focusedPosition();\n\n    // The old DOM position (-1 for a new view) and the weight of the view at\n    // each new position.\n    const from = new Int32Array(count).fill(-1);\n    const weights = new Int32Array(count);\n    const claimed = new Uint8Array(oldViews.length);\n\n    // The first old position of each key, so duplicate keys keep one view.\n    const oldPositions = new Map<unknown, number>();\n    for (let i = this._keys.length - 1; i >= 0; i--) {\n      oldPositions.set(this._keys[i], i);\n    }\n\n    for (let i = 0; i < count; i++) {\n      const position = oldPositions.get(keys[i]);\n      if (position === undefined || claimed[position]) {\n        continue;\n      }\n\n      claimed[position] = 1;\n      from[i] = position;\n      weights[i] = position === focused ? KEPT_WEIGHT * count : KEPT_WEIGHT;\n    }\n\n    let spare = 0;\n    for (let i = 0; i < count && spare < oldViews.length; i++) {\n      if (from[i] >= 0) {\n        continue;\n      }\n\n      while (spare < oldViews.length && claimed[spare]) {\n        spare++;\n      }\n      if (spare < oldViews.length) {\n        claimed[spare] = 1;\n        from[i] = spare;\n        weights[i] = RECYCLED_WEIGHT;\n      }\n    }\n\n    oldViews.forEach((view, position) => {\n      if (!claimed[position]) {\n        view.destroy();\n      }\n    });\n\n    const stable = heaviestIncreasingSubsequence(from, weights, oldViews.length);\n    const views: RecycledView<T>[] = new Array(count);\n    let next: RecycledView<T> | undefined;\n\n    // Walk backwards, so the successor of each view is already in place.\n    for (let i = count - 1; i >= 0; i--) {\n      let view = from[i] < 0 ? undefined : oldViews[from[i]];\n\n      if (view) {\n        if (!stable[i]) {\n          this._moveBefore(view, next);\n        }\n        view.context.$implicit = items[i];\n      } else {\n        view = this._container.createEmbeddedView(\n          this._template,\n          { $implicit: items[i] },\n          next ? this._container.indexOf(next) : undefined,\n        );\n      }\n\n      views[i] = view;\n      next = view;\n    }\n    return views;\n  }\n\n  /** Moves `view` in front of `next`, or to the end without one. */\n  private _moveBefore(view: RecycledView<T>, next?: RecycledView<T>): void {\n    const current = this._container.indexOf(view);\n    const target = next\n      ? this._container.indexOf(next)\n      : this._container.length;\n\n    if (current === target - 1) {\n      return;\n    }\n\n    // `move` removes the view before it inserts it, which shifts the later\n    // indices down by one.\n    this._container.move(view, current < target ? target - 1 : target);\n  }\n\n  /** The position in `_views` of the view that holds the focus, or -1. */\n  private _focusedPosition(): number {\n    const parent = (this._container.element.nativeElement as Node).parentNode;\n    // Angular's server DOM has no getRootNode, and nothing has focus there.\n    if (typeof parent?.getRootNode !== \"function\") {\n      return -1;\n    }\n\n    // The root, not the document: the list can render in a shadow root.\n    const root = parent.getRootNode() as Partial<DocumentOrShadowRoot>;\n    let node: Node | null = root.activeElement ?? null;\n\n    while (node && node.parentNode !== parent) {\n      node = node.parentNode;\n    }\n    if (!node) {\n      return -1;\n    }\n\n    return this._views.findIndex((view) => view.rootNodes.includes(node));\n  }\n}\n","import { isPlatformBrowser, NgTemplateOutlet } from \"@angular/common\";\nimport {\n  afterNextRender,\n  afterRenderEffect,\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  contentChild,\n  DOCUMENT,\n  effect,\n  ElementRef,\n  inject,\n  input,\n  NgZone,\n  OnDestroy,\n  output,\n  PLATFORM_ID,\n  signal,\n  TemplateRef,\n  untracked,\n  viewChild,\n  ViewEncapsulation,\n} from \"@angular/core\";\nimport { clamp, isLeftToRight } from \"igniteui-angular/core\";\nimport { VirtualScrollEngine } from \"./scroll-engine\";\nimport {\n  IgxVsItemContext,\n  VirtualDataWindow,\n  VirtualScrollDataRequest,\n  VirtualScrollKeyFunction,\n  VirtualScrollState,\n  VisibleRange,\n} from \"./types\";\nimport { IgxVirtualItemDirective } from \"./virtual-scroll-item.directive\";\nimport { IgxVsRecycleDirective } from \"./virtual-scroll-recycle.directive\";\n\n/** Defaults for the inputs, also used as the fallback for invalid values. */\nconst DEFAULT_OVER_SCAN = 2;\nconst DEFAULT_ESTIMATED_ITEM_SIZE = 50;\n\n/** How close to the end of `data` the window must get to emit `dataRequest`. */\nconst DATA_REQUEST_THRESHOLD = 5;\nconst DATA_REQUEST_MIN_COUNT = 20;\nconst DATA_REQUEST_OVER_SCAN_FACTOR = 4;\n\n/** Give-up bounds for the two loops that wait for the layout to stabilize. */\nconst MAX_LAYOUT_SETTLE_PASSES = 20;\nconst MAX_SCROLL_CORRECTION_PASSES = 5;\n\nconst SCROLL_END_TIMEOUT_MS = 2000;\nconst SCROLL_OFFSET_EPSILON_PX = 1;\n\n/** How long the scroll position must stay unchanged to count as settled. */\nconst SCROLL_IDLE_MS = 100;\n\n/**\n * Upper limit on one `requestAnimationFrame` wait. A hidden tab or a detached\n * element gets no frames, and `layoutComplete` must still resolve there.\n */\nconst LAYOUT_FRAME_TIMEOUT_MS = 100;\n\nconst EMPTY_RANGE: VisibleRange = Object.freeze({ startIndex: 0, endIndex: -1 });\n\n/** `data` and `dataWindow` seen as one thing: what is loaded, and where it sits. */\ninterface LoadedItems<T> extends VirtualDataWindow<T> {\n  /** Whether this came from `dataWindow`, which is a page of something larger. */\n  readonly windowed: boolean;\n}\n\n/** A consumer-supplied index, count or size, reduced to a whole non-negative number. */\nfunction toCount(value: number): number {\n  const count = Math.trunc(value);\n  return Number.isFinite(count) ? Math.max(0, count) : 0;\n}\n\nfunction loadedEqual<T>(a: LoadedItems<T>, b: LoadedItems<T>): boolean {\n  return (\n    a.items === b.items &&\n    a.startIndex === b.startIndex &&\n    a.totalCount === b.totalCount &&\n    a.windowed === b.windowed\n  );\n}\n\nfunction rangesEqual(a: VisibleRange, b: VisibleRange): boolean {\n  return a.startIndex === b.startIndex && a.endIndex === b.endIndex;\n}\n\nfunction statesEqual(\n  a: VirtualScrollState | null,\n  b: VirtualScrollState,\n): boolean {\n  return (\n    a !== null &&\n    rangesEqual(a, b) &&\n    a.viewportSize === b.viewportSize &&\n    a.totalSize === b.totalSize\n  );\n}\n\n/** The data index an item wrapper carries, or -1 when it has none. */\nfunction itemIndex(element: Element): number {\n  const index = Number.parseInt(\n    (element as HTMLElement).dataset[\"index\"] ?? \"\",\n    10,\n  );\n  return Number.isInteger(index) && index >= 0 ? index : -1;\n}\n\nfunction onAbort(abort: AbortSignal, cancel: () => void): void {\n  abort.addEventListener(\"abort\", cancel, { once: true });\n}\n\n/**\n * A virtual scroll component for large lists. Only the items visible in the\n * viewport (plus a configurable over-scan) are rendered.\n *\n * @igxKeywords virtual, scroll, virtualization, list\n * @igxGroup Grids & Lists\n *\n * @example\n * ```html\n * <igx-virtual-scroll [data]=\"items\" style=\"height: 400px\">\n *   <ng-template igxVirtualItem let-item let-i=\"index\">\n *     <div>{{ i }}: {{ item }}</div>\n *   </ng-template>\n * </igx-virtual-scroll>\n * ```\n */\n@Component({\n  selector: \"igx-virtual-scroll\",\n  templateUrl: \"./virtual-scroll.component.html\",\n  styleUrls: [\"./virtual-scroll.component.scss\"],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n  imports: [NgTemplateOutlet, IgxVsRecycleDirective],\n  host: {\n    class: \"igx-virtual-scroll\",\n    role: \"list\",\n    \"[attr.data-orientation]\": \"orientation()\",\n  },\n})\nexport class IgxVirtualScrollComponent<T> implements OnDestroy {\n  //#region Dependency injection\n\n  private readonly _hostRef = inject<ElementRef<HTMLElement>>(ElementRef);\n  private readonly _zone = inject(NgZone);\n  private readonly _document = inject(DOCUMENT);\n  private readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n  //#endregion\n\n  //#region Internal state\n\n  private readonly _engine = new VirtualScrollEngine();\n\n  private _viewportResizeObserver: ResizeObserver | null = null;\n  private _itemResizeObserver: ResizeObserver | null = null;\n  private _onScroll: (() => void) | null = null;\n\n  /** Elements currently registered with the item resize observer. */\n  private readonly _observedItems = new Set<Element>();\n\n  /** The data index each observed wrapper element last hosted. */\n  private readonly _observedItemIndexes = new WeakMap<Element, number>();\n\n  /**\n   * The live scroll offset on the active axis. A plain field, not a signal:\n   * `_visibleRange` reads it but is invalidated by `_scrollTick`, so a scroll\n   * that does not move the rendered window schedules no work.\n   */\n  private _scrollPosition = 0;\n\n  /** Bumped only when a scroll actually moves the rendered window. */\n  private readonly _scrollTick = signal(0);\n\n  /** The measured viewport, or `null` while the host has never been laid out. */\n  private readonly _viewportSize = signal<number | null>(null);\n\n  /**\n   * Whether the host is laid out left-to-right, as of the last read of the\n   * horizontal axis. `_contentTransform` depends on it, so a `dir` change\n   * flips the wrapper even while the rendered window stays put.\n   */\n  private readonly _ltr = signal(true);\n\n  /** What was loaded as of the previous change, for `_retainCount`. */\n  private _previousItems: LoadedItems<T> | undefined;\n\n  private _lastEmittedState: VirtualScrollState | null = null;\n  /** Whether the host has been laid out, so a later detach is a removal rather than the pre-render state. */\n  private _wasLaidOut = false;\n  /** Set when a report was skipped while detached, so re-attaching reports the window once. */\n  private _skippedWhileDetached = false;\n  private readonly _attachTick = signal(0);\n  private _hasPendingDataRequest = false;\n\n  /**\n   * The `startIndex` of the last emitted `dataRequest`, which is also the\n   * item count at that emit. See `_checkDataRequest`.\n   */\n  private _lastDataRequestIndex = -1;\n\n  private _layoutCompletePromise: Promise<void> | null = null;\n  private _scrollRequestId = 0;\n\n  //#endregion\n\n  //#region View and content children\n\n  private readonly _itemDirective = contentChild(IgxVirtualItemDirective);\n\n  private readonly _contentDivRef =\n    viewChild<ElementRef<HTMLElement>>(\"contentDiv\");\n\n  //#endregion\n\n  //#region Public inputs\n\n  /**\n   * The array of items to virtualize.\n   *\n   * Compared by reference: mutating the array in place (`data.push(...)`)\n   * causes no update. Assign a new array instead. The `dataRequest` flow\n   * also expects a new array.\n   */\n  public readonly data = input<T[]>([]);\n\n  /**\n   * Scroll orientation of the virtual scroll.\n   * Can be either \"vertical\" or \"horizontal\".\n   * Default is \"vertical\".\n   */\n  public readonly orientation = input<\"vertical\" | \"horizontal\">(\"vertical\");\n\n  /**\n   * Number of extra items to render beyond the visible area of the viewport.\n   * Higher values reduce blank flashes during fast scrolling but may impact performance.\n   * Default is 2.\n   */\n  public readonly overScan = input<number>(DEFAULT_OVER_SCAN);\n\n  /**\n   * Estimated item size in pixels used before an item is measured in the DOM.\n   * The engine replaces this with the actual measured size after the first render of each item.\n   * Unmeasured items then take the average measured size.\n   * Default is 50 pixels.\n   * Setting this to a value close to the actual average item size can improve initial rendering performance.\n   */\n  public readonly estimatedItemSize = input<number>(DEFAULT_ESTIMATED_ITEM_SIZE);\n\n  /**\n   * A loaded page of a larger collection, for data that arrives a page at a time.\n   *\n   * Takes the place of `data` while it is set. The list is as long as `totalCount`, so the\n   * scrollbar spans the whole collection while only the page is in memory. Indices the page\n   * does not cover render nothing; use `stateChange` to see which range is wanted and supply\n   * the page that covers it.\n   *\n   * Measured sizes are kept per index across pages while `totalCount` holds: the indices still\n   * mean the same records. A page with another `totalCount` is a different collection, and\n   * every size is measured again. A page that keeps the count but puts different records at\n   * the same indices keeps the sizes measured for the previous ones until those rows render.\n   *\n   * @example\n   * ```html\n   * <igx-virtual-scroll [dataWindow]=\"page\" (stateChange)=\"load($event)\" style=\"height: 400px\">\n   *   <ng-template igxVirtualItem let-item>{{ item?.name }}</ng-template>\n   * </igx-virtual-scroll>\n   * ```\n   */\n  public readonly dataWindow = input<VirtualDataWindow<T> | null>(null);\n\n  /**\n   * @hidden @internal\n   *\n   * Viewport size in pixels to render the first window against, for a list that is hidden\n   * until the change detection pass that reveals it and so has no size to measure in it.\n   *\n   * A hint for that first render: once the host has been laid out its own size takes over,\n   * zero included. Changing `orientation` begins an axis with no measurement of its own, so\n   * the hint applies again there. Negative, `NaN` and infinite values count as no hint.\n   *\n   * A workaround for the drop-down family, which reads and focuses items in the pass that\n   * opens the list. To be removed once those components render their list on reveal.\n   */\n  public readonly initialViewportSize = input<number>(0);\n\n  /**\n   * Item template provided programmatically. Takes precedence over a content\n   * `ng-template[igxVirtualItem]` when both are provided.\n   *\n   * Items are measured by their border box, so margins accumulate as drift\n   * down the list. Use padding on the item, or a gap on a wrapper, instead.\n   *\n   * Only the current window is in the DOM, so assistive technology cannot\n   * infer an item's position from the markup. Templates that render a role\n   * with set semantics (`listitem`, `option`, `row`, ...) should map the\n   * context's `index` and `count` onto `aria-posinset` and `aria-setsize`.\n   *\n   * Item elements are recycled: bind all item state and write user changes\n   * back to the item, or unbound DOM state (e.g. a toggled checkbox) shows on\n   * another item. See `keyFunction`.\n   */\n  public readonly itemTemplate = input<TemplateRef<IgxVsItemContext<T>> | null>(\n    null,\n  );\n\n  /**\n   * Returns a unique key from an item and its index in the whole collection. An item keeps its\n   * element while its key stays rendered. Defaults to the index; set it when items move within\n   * `data` (sort, insert, remove).\n   *\n   * @example\n   * ```html\n   * <igx-virtual-scroll [data]=\"people\" [keyFunction]=\"byId\">...</igx-virtual-scroll>\n   * ```\n   * ```ts\n   * byId = (person: Person) => person.id;\n   * ```\n   */\n  public readonly keyFunction = input<VirtualScrollKeyFunction<T> | null>(null);\n\n  //#endregion\n\n  //#region Public outputs\n\n  /** Emitted when the rendered virtual window changes. */\n  public readonly stateChange = output<VirtualScrollState>();\n\n  /**\n   * Emitted when the rendered window comes within a few items of the end of\n   * `data`. Also emitted on the first render, when the loaded items do not\n   * fill the viewport. Listen to this event to append more items\n   * (infinite / remote scrolling).\n   */\n  public readonly dataRequest = output<VirtualScrollDataRequest>();\n\n  //#endregion\n\n  //#region Derived state\n\n  protected readonly _isVertical = computed(\n    () => this.orientation() === \"vertical\",\n  );\n\n  protected readonly _resolvedTemplate = computed(\n    () => this.itemTemplate() ?? this._itemDirective()?.template ?? null,\n  );\n\n  /**\n   * What the component has to work with, from whichever data input is in use. A page is\n   * trusted to be no longer than the collection it says it belongs to.\n   */\n  private readonly _loaded = computed<LoadedItems<T>>(() => {\n    const window = this.dataWindow();\n\n    if (!window) {\n      const items = this.data() ?? [];\n      return { items, startIndex: 0, totalCount: items.length, windowed: false };\n    }\n\n    const items = window.items ?? [];\n    const startIndex = toCount(window.startIndex);\n    return {\n      items,\n      startIndex,\n      totalCount: Math.max(toCount(window.totalCount), startIndex + items.length),\n      windowed: true,\n    };\n  }, { equal: loadedEqual });\n\n  /** The measured size once the host has been laid out, the hint until then. */\n  private readonly _effectiveViewportSize = computed(\n    () => this._viewportSize() ?? toCount(this.initialViewportSize()),\n  );\n\n  /** The configured `overScan`, normalized to a non-negative integer. */\n  private readonly _normalizedOverScan = computed(() => {\n    const value = Number(this.overScan());\n    return Number.isFinite(value)\n      ? Math.max(0, Math.floor(value))\n      : DEFAULT_OVER_SCAN;\n  });\n\n  /** The configured `estimatedItemSize`, normalized to a positive number. */\n  private readonly _normalizedItemSize = computed(() => {\n    const value = Number(this.estimatedItemSize());\n    return Number.isFinite(value) && value > 0\n      ? value\n      : DEFAULT_ESTIMATED_ITEM_SIZE;\n  });\n\n  /**\n   * The window to render for the current scroll position and viewport. Empty\n   * until an item template is resolved, because nothing renders without one.\n   *\n   * The scroll position is read from the plain `_scrollPosition` field so\n   * that a recompute triggered by a measurement uses the live offset, while\n   * `_scrollTick` limits recomputes to scrolls that actually move the window.\n   */\n  private readonly _visibleRange = computed<VisibleRange>(\n    () => {\n      // Depend on the engine so the range recomputes whenever item sizes or\n      // the item count change.\n      this._engine.version();\n      this._scrollTick();\n\n      return this._resolvedTemplate()\n        ? this._engine.getVisibleRange(\n            this._scrollPosition,\n            this._effectiveViewportSize(),\n            this._normalizedOverScan(),\n          )\n        : EMPTY_RANGE;\n    },\n    { equal: rangesEqual },\n  );\n\n  /** The track size, in DOM space. */\n  protected readonly _spaceSize = this._engine.domSize;\n\n  /** The part of the rendered range a page actually covers. */\n  private readonly _loadedRange = computed<VisibleRange>(\n    () => {\n      const { startIndex, endIndex } = this._visibleRange();\n      const { items, startIndex: from } = this._loaded();\n\n      return {\n        startIndex: Math.max(startIndex, from),\n        endIndex: Math.min(endIndex, from + items.length - 1),\n      };\n    },\n    { equal: rangesEqual },\n  );\n\n  /** The key of each rendered item: from `keyFunction`, or its index. */\n  protected readonly _itemKey = computed<(context: IgxVsItemContext<T>) => unknown>(\n    () => {\n      const keyOf = this.keyFunction();\n      return keyOf\n        ? (context) => keyOf(context.$implicit, context.index)\n        : (context) => context.index;\n    },\n  );\n\n  /** The item contexts for the currently rendered window, in render order. */\n  protected readonly _renderedItems = computed<IgxVsItemContext<T>[]>(() => {\n    const { startIndex, endIndex } = this._loadedRange();\n    const { items, startIndex: from, totalCount } = this._loaded();\n\n    const rendered: IgxVsItemContext<T>[] = [];\n    for (let i = startIndex; i <= endIndex; i++) {\n      rendered.push(new IgxVsItemContext<T>(items[i - from], i, totalCount));\n    }\n    return rendered;\n  });\n\n  /**\n   * The `translateY` / `translateX` for the content wrapper. It is absolutely\n   * positioned at the origin of a `domSize` px track, so translating it to\n   * the first rendered item's offset puts that item at its virtual position.\n   */\n  protected readonly _contentTransform = computed(() => {\n    // The offsets below are plain reads of the engine's size state, so depend\n    // on its version explicitly.\n    this._engine.version();\n    const range = this._loadedRange();\n\n    // Under coordinate compression item positions are scaled down but item\n    // sizes are not. Without this cap the rendered range would overflow past\n    // domSize at the end of the list, pushing the last items beyond the\n    // maximum browser scroll coordinate.\n    const position = clamp(\n      this._engine.getScrollOffsetForIndex(\n        range.startIndex,\n        this._effectiveViewportSize(),\n      ),\n      0,\n      this._engine.domSize() -\n        this._engine.getPhysicalRangeSize(range.startIndex, range.endIndex),\n    );\n\n    if (this._isVertical()) {\n      return `translateY(${position}px)`;\n    }\n\n    // In RTL the wrapper is anchored to the right edge of the track, so it\n    // translates towards the negative (leading) direction.\n    return `translateX(${this._ltr() ? position : -position}px)`;\n  });\n\n  //#endregion\n\n  constructor() {\n    // Sync the engine's item count with `data`, discarding the measurements\n    // of items whose identity changed.\n    effect(() => {\n      const loaded = this._loaded();\n      untracked(() => {\n        const previous = this._previousItems;\n        const retained = this._retainCount(previous, loaded);\n        // Data that grew past the last request answered it, so a later reset may ask again.\n        if (loaded.items.length > this._lastDataRequestIndex) {\n          this._lastDataRequestIndex = -1;\n        }\n        this._previousItems = loaded;\n        this._engine.resize(\n          loaded.totalCount,\n          this._normalizedItemSize(),\n          retained,\n        );\n        this._remeasureFrom(retained);\n        // New data (or a reset) clears any in-flight data request so the next\n        // approach to the end of the list can emit again.\n        this._hasPendingDataRequest = false;\n      });\n    });\n\n    // Re-apply the estimate when it changes but the item count does not,\n    // because `resize` is then a no-op.\n    effect(() => {\n      const size = this._normalizedItemSize();\n      untracked(() => this._engine.updateEstimatedSize(size));\n    });\n\n    // The sizes and scroll offset of the previous axis do not carry over.\n    effect(() => {\n      this.orientation();\n      untracked(() => {\n        if (!this._isBrowser) {\n          return;\n        }\n\n        this._viewportSize.set(null);\n        this._engine.clearSizes();\n        this._remeasureFrom(0);\n        this._measureViewport();\n        this._scrollPosition = this._currentAxisScroll();\n        this._scrollTick.update((v) => v + 1);\n      });\n    });\n\n    afterNextRender(() => {\n      this._engine.initMaxBrowserSize(this._document);\n      this._measureViewport();\n      this._setupScrollListener();\n      this._setupViewportResizeObserver();\n    });\n\n    // Runs after the DOM reflects the current window, and re-runs whenever\n    // the window or the engine's sizes change.\n    afterRenderEffect({\n      read: () => {\n        // What is wanted and what is rendered change independently: the viewport can move\n        // into indices no page covers, and a page can arrive without the viewport moving.\n        this._visibleRange();\n        this._renderedItems();\n        this._engine.version();\n        this._attachTick();\n        untracked(() => {\n          this._scheduleItemMeasurement();\n          this._checkDataRequest();\n          this._emitStateChange();\n        });\n      },\n    });\n  }\n\n  public ngOnDestroy(): void {\n    this._teardown();\n  }\n\n  //#region Public API\n\n  /**\n   * Resolves when the virtual scroll has settled: the current render pass is\n   * complete, the item-size measurements it triggers are complete, and so\n   * are the renders those measurements schedule.\n   */\n  public get layoutComplete(): Promise<void> {\n    if (!this._layoutCompletePromise) {\n      this._layoutCompletePromise = this._resolveLayoutComplete();\n    }\n    return this._layoutCompletePromise;\n  }\n\n  /**\n   * Scrolls to the specified item index.\n   *\n   * Items outside the rendered window have only an estimated size, so the\n   * first jump can miss the target. The items at the landing point are then\n   * measured and the scroll position is corrected, until the offset is\n   * stable. The returned promise resolves on that final offset; callers that\n   * need only the first, approximate scroll can ignore it, because the first\n   * jump is applied before the call returns.\n   *\n   * @param index The index of the item to scroll to.\n   * @param options `block` / `inline` select the alignment (`start`,\n   * `center`, `end` or `nearest`, which scrolls the smallest distance that\n   * brings the item into view); `behavior` selects `auto` or `smooth`.\n   */\n  public async scrollToIndex(\n    index: number,\n    options?: ScrollIntoViewOptions,\n  ): Promise<void> {\n    const clampedIndex = clamp(\n      index,\n      0,\n      Math.max(0, this._loaded().totalCount - 1),\n    );\n\n    // A newer call supersedes a correction loop that still runs for a\n    // previous call, for example under rapid, repeated calls.\n    const requestId = ++this._scrollRequestId;\n\n    let offset = this._getAlignedScrollOffset(clampedIndex, options);\n    await this._scrollAndWaitForEnd(offset, options?.behavior ?? \"auto\");\n\n    for (let i = 0; i < MAX_SCROLL_CORRECTION_PASSES; i++) {\n      await this.layoutComplete;\n\n      if (requestId !== this._scrollRequestId) {\n        return;\n      }\n\n      const corrected = this._getAlignedScrollOffset(clampedIndex, options);\n      if (Math.abs(corrected - offset) < SCROLL_OFFSET_EPSILON_PX) {\n        break;\n      }\n\n      offset = corrected;\n      await this._scrollAndWaitForEnd(offset, \"auto\");\n\n      if (requestId !== this._scrollRequestId) {\n        return;\n      }\n    }\n  }\n\n  //#endregion\n\n  //#region Scrolling\n\n  /**\n   * Re-reads the host's direction, which `dir` can change at runtime. `:dir()`\n   * is a selector match, so this costs no layout.\n   */\n  private _syncDirection(): boolean {\n    const ltr = isLeftToRight(this._hostRef.nativeElement);\n    this._ltr.set(ltr);\n    return ltr;\n  }\n\n  /** The current real scroll position on the active axis, normalized for RTL. */\n  private _currentAxisScroll(): number {\n    const host = this._hostRef.nativeElement;\n\n    if (this._isVertical()) {\n      return host.scrollTop;\n    }\n\n    // Standards-compliant browsers expose a negative scrollLeft in RTL.\n    return this._syncDirection() ? host.scrollLeft : -host.scrollLeft;\n  }\n\n  /** Applies a scroll offset to the active axis, accounting for RTL. */\n  private _applyScroll(offset: number, behavior: ScrollBehavior): void {\n    const host = this._hostRef.nativeElement;\n\n    if (this._isVertical()) {\n      host.scrollTo({ top: offset, behavior });\n      return;\n    }\n\n    host.scrollTo({ left: this._syncDirection() ? offset : -offset, behavior });\n  }\n\n  /**\n   * The scroll offset that aligns `index` in the viewport according to\n   * `options`, from the engine's current size data. As more items are\n   * measured, the same input can give a different, more accurate result.\n   */\n  private _getAlignedScrollOffset(\n    index: number,\n    options?: ScrollIntoViewOptions,\n  ): number {\n    const position = this._isVertical()\n      ? (options?.block ?? \"start\")\n      : (options?.inline ?? options?.block ?? \"start\");\n\n    return this._engine.resolveScrollOffset(\n      index,\n      this._currentAxisScroll(),\n      this._effectiveViewportSize(),\n      position,\n    );\n  }\n\n  /**\n   * Applies a scroll offset to the active axis and waits for the scroll,\n   * instant or smooth, to settle.\n   *\n   * `scrollend` does not fire when the requested offset does not move the\n   * scroll position, so that case resolves immediately. The deadline covers\n   * an event that never arrives, for example when the element is detached\n   * mid-scroll.\n   */\n  private _scrollAndWaitForEnd(\n    offset: number,\n    behavior: ScrollBehavior,\n  ): Promise<void> {\n    if (!this._isBrowser) {\n      return Promise.resolve();\n    }\n\n    if (Math.abs(this._currentAxisScroll() - offset) < SCROLL_OFFSET_EPSILON_PX) {\n      // Already there, but the window may lag: a re-attached host got there without a scroll\n      // event, and the event for a scroll that was just applied may still be pending.\n      this._syncScrollPosition();\n      return Promise.resolve();\n    }\n\n    return this._withDeadline(SCROLL_END_TIMEOUT_MS, (abort) => {\n      // `scrollend` reports exactly when a scroll has settled. Safari before\n      // 18.2 does not have it, and the scroll-idle timer stands in there.\n      const settled =\n        \"onscrollend\" in this._hostRef.nativeElement\n          ? this._waitForScrollEnd(abort)\n          : this._waitForScrollIdle(abort);\n\n      // Applied only after the listener is attached, so an instant scroll\n      // cannot settle before something watches for it.\n      this._applyScroll(offset, behavior);\n      return settled;\n    });\n  }\n\n  private _waitForScrollEnd(abort: AbortSignal): Promise<void> {\n    return this._promiseOutsideZone((resolve) => {\n      this._hostRef.nativeElement.addEventListener(\"scrollend\", resolve, {\n        once: true,\n        signal: abort,\n      });\n    });\n  }\n\n  /**\n   * Resolves when no `scroll` event arrives for `SCROLL_IDLE_MS`: the closest\n   * replacement for `scrollend`. The first timer starts immediately, so a\n   * scroll that does not move still settles.\n   */\n  private _waitForScrollIdle(abort: AbortSignal): Promise<void> {\n    return this._promiseOutsideZone((resolve) => {\n      let id = setTimeout(resolve, SCROLL_IDLE_MS);\n\n      this._hostRef.nativeElement.addEventListener(\n        \"scroll\",\n        () => {\n          clearTimeout(id);\n          id = setTimeout(resolve, SCROLL_IDLE_MS);\n        },\n        { passive: true, signal: abort },\n      );\n\n      onAbort(abort, () => clearTimeout(id));\n    });\n  }\n\n  //#endregion\n\n  //#region Async helpers\n\n  /** A promise whose subscription work stays out of the Angular zone. */\n  private _promiseOutsideZone(\n    subscribe: (resolve: () => void) => void,\n  ): Promise<void> {\n    return this._zone.runOutsideAngular(\n      () => new Promise<void>((resolve) => subscribe(() => resolve())),\n    );\n  }\n\n  /**\n   * Resolves with `task` or with a deadline of `ms`, whichever comes first.\n   * The signal then tears down the other, so no live timer or dangling\n   * listener remains.\n   */\n  private _withDeadline(\n    ms: number,\n    task: (abort: AbortSignal) => Promise<void>,\n  ): Promise<void> {\n    const controller = new AbortController();\n\n    return Promise.race([\n      task(controller.signal),\n      this._promiseOutsideZone((resolve) => {\n        const id = setTimeout(resolve, ms);\n        onAbort(controller.signal, () => clearTimeout(id));\n      }),\n    ]).finally(() => controller.abort());\n  }\n\n  /**\n   * Resolves on the next animation frame, or after `LAYOUT_FRAME_TIMEOUT_MS`\n   * when no frame arrives. A hidden tab or a detached element gets no frames\n   * and has no layout to wait for, so resolving early there is safe.\n   */\n  private _nextFrame(): Promise<void> {\n    if (!this._isBrowser) {\n      return Promise.resolve();\n    }\n\n    return this._withDeadline(LAYOUT_FRAME_TIMEOUT_MS, (abort) =>\n      this._promiseOutsideZone((resolve) => {\n        const id = requestAnimationFrame(resolve);\n        onAbort(abort, () => cancelAnimationFrame(id));\n      }),\n    );\n  }\n\n  /**\n   * Waits out the frames in which the item measurements land. Each\n   * measurement that changes a size bumps the engine's version and schedules\n   * another render, so the layout has settled once the version holds still\n   * across two consecutive frames.\n   */\n  private async _resolveLayoutComplete(): Promise<void> {\n    try {\n      let lastVersion = -1;\n\n      for (let i = 0; i < MAX_LAYOUT_SETTLE_PASSES; i++) {\n        await this._nextFrame();\n\n        const version = untracked(this._engine.version);\n        if (version === lastVersion) {\n          break;\n        }\n        lastVersion = version;\n      }\n    } finally {\n      // Cleared here, not after the loop, so a run that throws cannot leave\n      // the getter with a permanently rejected promise.\n      this._layoutCompletePromise = null;\n    }\n  }\n\n  //#endregion\n\n  //#region Measurement\n\n  /** Whether the host has a box, as opposed to being hidden or detached. */\n  private _isLaidOut(): boolean {\n    const host = this._hostRef.nativeElement;\n    return host.isConnected && host.getClientRects().length > 0;\n  }\n\n  private _measureViewport(): void {\n    const host = this._hostRef.nativeElement;\n\n    // A host with no box is hidden or detached, not sized: its last measurement is kept so\n    // it renders in the pass that reveals it. A laid-out zero is a size like any other.\n    if (!this._isLaidOut()) {\n      return;\n    }\n    this._wasLaidOut = true;\n\n    const size = this._isVertical() ? host.clientHeight : host.clientWidth;\n    if (size !== untracked(this._viewportSize)) {\n      this._viewportSize.set(size);\n    }\n  }\n\n  private _setupViewportResizeObserver(): void {\n    this._viewportResizeObserver?.disconnect();\n\n    this._zone.runOutsideAngular(() => {\n      this._viewportResizeObserver = new ResizeObserver(() => {\n        this._measureViewport();\n        // Detaching the host resets its scroll position without a scroll event. Following it\n        // while detached renders the window the host comes back with, so it does not show blank.\n        this._syncScrollPosition();\n        if (this._skippedWhileDetached && this._isLaidOut()) {\n          this._skippedWhileDetached = false;\n          this._attachTick.update((v) => v + 1);\n        }\n      });\n      this._viewportResizeObserver.observe(this._hostRef.nativeElement);\n    });\n  }\n\n  private _setupScrollListener(): void {\n    const host = this._hostRef.nativeElement;\n\n    if (this._onScroll) {\n      host.removeEventListener(\"scroll\", this._onScroll);\n    }\n\n    this._zone.runOutsideAngular(() => {\n      this._onScroll = () => this._handleScroll();\n      host.addEventListener(\"scroll\", this._onScroll, { passive: true });\n    });\n  }\n\n  /**\n   * Records the new scroll offset and invalidates the rendered window only\n   * when it actually moves. Without the guard, a scroll inside a single item\n   * would schedule a change detection pass for an identical result.\n   */\n  private _handleScroll(): void {\n    this._scrollPosition = this._currentAxisScroll();\n\n    const next = this._engine.getVisibleRange(\n      this._scrollPosition,\n      untracked(this._effectiveViewportSize),\n      untracked(this._normalizedOverScan),\n    );\n\n    if (!rangesEqual(next, untracked(this._visibleRange))) {\n      this._scrollTick.update((v) => v + 1);\n    }\n  }\n\n  /**\n   * Re-reads the scroll offset outside a scroll event. Detaching the host resets the offset\n   * without one, and the event for a scroll that was just applied may not have arrived yet.\n   */\n  private _syncScrollPosition(): void {\n    // A hidden host reads 0 but gets its offset back when it is shown again. A detached one\n    // reads the 0 it is re-attached with, so it is not skipped.\n    if (this._hostRef.nativeElement.isConnected && !this._isLaidOut()) {\n      return;\n    }\n\n    this._handleScroll();\n  }\n\n  private _handleItemResize(entries: ResizeObserverEntry[]): void {\n    for (const entry of entries) {\n      const index = itemIndex(entry.target);\n      if (index < 0) {\n        continue;\n      }\n\n      const measured = this._isVertical()\n        ? (entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height)\n        : (entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width);\n\n      if (measured > 0) {\n        this._engine.measureItem(index, measured);\n      }\n    }\n\n    // Unmeasured items follow the measured average.\n    this._engine.adaptEstimate(untracked(this._loadedRange).startIndex);\n  }\n\n  /**\n   * Synchronizes the item observer with the rendered window, applying only\n   * the difference. A newly observed element gets one initial measurement.\n   *\n   * An element whose `data-index` changed is re-registered, because\n   * `observe` on an already observed element is a no-op. The wrapper elements\n   * are recycled, so after a scroll the same element can host a different\n   * item at an identical size. The observer stays quiet about that and the\n   * new index would keep its estimated size.\n   */\n  private _scheduleItemMeasurement(): void {\n    const content = this._contentDivRef()?.nativeElement;\n    if (!content) {\n      return;\n    }\n\n    const observer = this._getItemResizeObserver();\n\n    for (const element of [...this._observedItems]) {\n      if (element.parentNode !== content) {\n        observer.unobserve(element);\n        this._observedItems.delete(element);\n      }\n    }\n\n    for (const element of Array.from(content.children)) {\n      const index = itemIndex(element);\n\n      if (this._observedItems.has(element)) {\n        if (this._observedItemIndexes.get(element) === index) {\n          continue;\n        }\n        observer.unobserve(element);\n      }\n\n      observer.observe(element);\n      this._observedItems.add(element);\n      this._observedItemIndexes.set(element, index);\n    }\n  }\n\n  /**\n   * Forgets the wrappers from `index` on, so the next pass registers them\n   * again: the engine dropped their sizes, and a wrapper whose size did not\n   * change reports nothing on its own.\n   */\n  private _remeasureFrom(index: number): void {\n    for (const element of this._observedItems) {\n      if ((this._observedItemIndexes.get(element) ?? -1) >= index) {\n        this._observedItemIndexes.delete(element);\n      }\n    }\n  }\n\n  private _getItemResizeObserver(): ResizeObserver {\n    if (!this._itemResizeObserver) {\n      this._itemResizeObserver = this._zone.runOutsideAngular(\n        () => new ResizeObserver((entries) => this._handleItemResize(entries)),\n      );\n    }\n    return this._itemResizeObserver;\n  }\n\n  //#endregion\n\n  //#region Events\n\n  /**\n   * The number of leading items that kept their identity across a `data`\n   * change: the index of the first item whose measured size no longer\n   * matches its rendered content. An append (the `dataRequest` flow) retains\n   * all items. A filter or a replacement retains only the unchanged prefix.\n   */\n  private _firstChangedIndex(\n    previous: readonly T[],\n    current: readonly T[],\n  ): number {\n    const shared = Math.min(previous.length, current.length);\n    for (let i = 0; i < shared; i++) {\n      if (previous[i] !== current[i]) {\n        return i;\n      }\n    }\n    return shared;\n  }\n\n  /**\n   * How many leading items keep their measured size across a change. A page of the same\n   * collection keeps all of them - its indices still mean the same records. A page with\n   * another `totalCount` comes from a filtered or otherwise different collection, and\n   * switching inputs starts over, so neither keeps any.\n   */\n  private _retainCount(\n    previous: LoadedItems<T> | undefined,\n    current: LoadedItems<T>,\n  ): number {\n    if (previous?.windowed !== current.windowed) {\n      return 0;\n    }\n\n    if (!current.windowed) {\n      return this._firstChangedIndex(previous.items, current.items);\n    }\n\n    return previous.totalCount === current.totalCount ? current.totalCount : 0;\n  }\n\n  /**\n   * Emits `stateChange`. Skipped when the window is empty or equal to the\n   * last reported one, because measurement passes re-render without a window\n   * change.\n   */\n  private _emitStateChange(): void {\n    // A host detached after layout follows its reset offset for rendering only; that window is not reported.\n    if (this._wasLaidOut && !this._hostRef.nativeElement.isConnected) {\n      this._skippedWhileDetached = true;\n      return;\n    }\n\n    const { startIndex, endIndex } = untracked(this._visibleRange);\n    if (endIndex < startIndex) {\n      return;\n    }\n\n    const state: VirtualScrollState = {\n      startIndex,\n      endIndex,\n      viewportSize: untracked(this._effectiveViewportSize),\n      totalSize: untracked(this._engine.totalSize),\n    };\n\n    if (statesEqual(this._lastEmittedState, state)) {\n      return;\n    }\n\n    this._lastEmittedState = { ...state };\n    this.stateChange.emit(state);\n  }\n\n  private _checkDataRequest(): void {\n    const loaded = untracked(this._loaded);\n\n    // `dataRequest` asks for items to append, which a sized collection does not need. The\n    // count `data` had reached before says nothing once a window is bound, so forget it here.\n    if (loaded.windowed) {\n      this._lastDataRequestIndex = -1;\n      return;\n    }\n\n    if (this._hasPendingDataRequest) {\n      return;\n    }\n\n    const { endIndex } = untracked(this._visibleRange);\n    const total = loaded.items.length;\n\n    if (total === 0 || endIndex < total - DATA_REQUEST_THRESHOLD) {\n      return;\n    }\n\n    // Each `data` change clears `_hasPendingDataRequest`, including one that\n    // appends nothing. Without this second guard, a consumer whose source is\n    // exhausted, and that reassigns `data` in response to a request, would\n    // receive the same request on each reassignment.\n    if (this._lastDataRequestIndex === total) {\n      return;\n    }\n\n    this._hasPendingDataRequest = true;\n    this._lastDataRequestIndex = total;\n\n    this.dataRequest.emit({\n      startIndex: total,\n      count: Math.max(\n        untracked(this._normalizedOverScan) * DATA_REQUEST_OVER_SCAN_FACTOR,\n        DATA_REQUEST_MIN_COUNT,\n      ),\n    });\n  }\n\n  //#endregion\n\n  private _teardown(): void {\n    const host = this._hostRef.nativeElement;\n\n    if (this._onScroll) {\n      host.removeEventListener(\"scroll\", this._onScroll);\n      this._onScroll = null;\n    }\n\n    this._viewportResizeObserver?.disconnect();\n    this._viewportResizeObserver = null;\n\n    this._itemResizeObserver?.disconnect();\n    this._itemResizeObserver = null;\n    this._observedItems.clear();\n  }\n}\n","<div\n  class=\"igx-virtual-scroll__track\"\n  role=\"presentation\"\n  [style.height.px]=\"_isVertical() ? _spaceSize() : null\"\n  [style.width.px]=\"!_isVertical() ? _spaceSize() : null\"\n>\n  <div\n    class=\"igx-virtual-scroll__content\"\n    #contentDiv\n    role=\"presentation\"\n    [style.transform]=\"_contentTransform()\"\n  >\n    @if (_resolvedTemplate(); as template) {\n      <div\n        *igxVsRecycle=\"let context of _renderedItems(); key: _itemKey()\"\n        class=\"igx-virtual-item\"\n        role=\"presentation\"\n        [attr.data-index]=\"context.index\"\n      >\n        <ng-container\n          [ngTemplateOutlet]=\"template\"\n          [ngTemplateOutletContext]=\"context\"\n        />\n      </div>\n    }\n  </div>\n</div>\n"],"mappings":";;;;AAKA,MAAM,uCAAuB,IAAI,QAAO;AAGxC,SAAS,oBAAoB,KAAa;CACxC,MAAM,SAAS,qBAAqB,IAAI,GAAG;CAC3C,IAAI,WAAW,QACb,OAAO;CAGT,MAAM,YAAY,IAAI,QAAQ,IAAI;CAClC,IAAI,CAAC,WACH,OAAO,OAAO;CAGhB,MAAM,QAAQ,IAAI,cAAc,KAAK;CACrC,MAAM,MAAM,WAAW;CACvB,MAAM,MAAM,MAAM,GAAG,OAAO,iBAAgB;CAC5C,MAAM,MAAM,QAAQ;CACpB,MAAM,MAAM,SAAS;CACrB,MAAM,MAAM,aAAa;CACzB,UAAU,YAAY,KAAK;CAG3B,MAAM,eAAe,IAAI,iBAAiB,aAAa;CACvD,MAAM,OAAO,KAAK,IAAI,MAAM,sBAAqB,CAAE,CAAC,GAAG,IAAI;CAC3D,UAAU,YAAY,KAAK;CAE3B,qBAAqB,IAAI,KAAK,IAAI;CAClC,OAAO;AACT;AAG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