@ember-lattice/virtual 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE.md +21 -0
- package/NOTICE +30 -0
- package/README.md +32 -2
- package/addon-main.cjs +4 -0
- package/declarations/core/index.d.ts +251 -0
- package/declarations/core/index.d.ts.map +1 -0
- package/declarations/core/ios-gesture.d.ts +46 -0
- package/declarations/core/ios-gesture.d.ts.map +1 -0
- package/declarations/core/lazy-measurements.d.ts +4 -0
- package/declarations/core/lazy-measurements.d.ts.map +1 -0
- package/declarations/core/scroll-classifier.d.ts +36 -0
- package/declarations/core/scroll-classifier.d.ts.map +1 -0
- package/declarations/core/utils.d.ts +19 -0
- package/declarations/core/utils.d.ts.map +1 -0
- package/declarations/ember/virtual-scroll.d.ts +24 -0
- package/declarations/ember/virtual-scroll.d.ts.map +1 -0
- package/declarations/ember/virtualizer-state.d.ts +21 -0
- package/declarations/ember/virtualizer-state.d.ts.map +1 -0
- package/declarations/index.d.ts +7 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/scaled-scroll.d.ts +63 -0
- package/declarations/scaled-scroll.d.ts.map +1 -0
- package/dist/index.js +3248 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/core/lazy-measurements.ts","../src/core/utils.ts","../src/scaled-scroll.ts","../src/core/scroll-classifier.ts","../src/core/ios-gesture.ts","../src/core/index.ts","../src/ember/virtualizer-state.ts","../src/ember/virtual-scroll.ts"],"sourcesContent":["// Ported from TanStack Virtual (MIT, Copyright (c) 2021-present Tanner Linsley), packages/virtual-core/src/lazy-measurements.ts @ 3.19.16.\n// Lazy materialization for the lanes===1 fast path. Backed by a\n// Float64Array (stride 2: start, size, …); VirtualItems are constructed on\n// first indexed read, replacing the stored key. Saves the per-item object\n// allocation at large list counts where most items are never visible.\n\nimport type { VirtualItem } from './index.ts'\n\nexport function getMeasurementKey(item: VirtualItem | VirtualItem['key']): VirtualItem['key'] {\n return typeof item === 'object' ? item.key : item\n}\n\nexport function createLazyMeasurementsView(\n cache: Array<VirtualItem | VirtualItem['key']>,\n flat: Float64Array,\n): Array<VirtualItem> {\n const count = cache.length\n return new Proxy(cache, {\n get(target, prop, receiver) {\n if (typeof prop === 'string') {\n // Cheap digit-prefix sniff before number coerce.\n const c = prop.charCodeAt(0)\n if (c >= 48 && c <= 57) {\n const i = +prop\n if (Number.isInteger(i) && i >= 0 && i < count) {\n let v = target[i]!\n if (typeof v !== 'object') {\n const s = flat[i * 2]!\n v = target[i] = {\n index: i,\n key: v,\n start: s,\n size: flat[i * 2 + 1]!,\n end: s + flat[i * 2 + 1]!,\n lane: 0,\n }\n }\n return v\n }\n }\n if (prop === 'length') return count\n }\n return Reflect.get(target, prop, receiver)\n },\n }) as Array<VirtualItem>\n}\n","// Ported from TanStack Virtual (MIT, Copyright (c) 2021-present Tanner Linsley), packages/virtual-core/src/utils.ts @ 3.19.16.\nimport { isDevelopingApp } from '@embroider/macros'\n\n// Lattice: the app build folds `isDevelopingApp()` to `false` in production, so debug code goes away.\nexport const DEV = isDevelopingApp()\n\nexport type NoInfer<A> = [A][A extends unknown ? 0 : never]\n\nexport type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>\n\nexport function memo<TDeps extends ReadonlyArray<unknown>, TResult>(\n getDeps: () => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: false | string\n debug?: () => boolean\n onChange?: (result: TResult) => void\n initialDeps?: TDeps\n skipInitialOnChange?: boolean\n },\n) {\n let deps = opts.initialDeps ?? []\n let result: TResult | undefined\n let isInitial = true\n\n function memoizedFunction(): TResult {\n // Debug-only timing.\n const debugEnabled = DEV && !!opts.key && !!opts.debug?.()\n let depTime = 0\n if (debugEnabled) depTime = Date.now()\n\n const newDeps = getDeps()\n\n const depsChanged =\n newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime = 0\n if (debugEnabled) resultTime = Date.now()\n\n result = fn(...newDeps)\n\n if (debugEnabled) {\n const depEndTime = Math.round((Date.now() - depTime) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120),\n )}deg 100% 31%);`,\n opts?.key,\n )\n }\n\n if (opts?.onChange && !(isInitial && opts.skipInitialOnChange)) {\n opts.onChange(result)\n }\n\n isInitial = false\n\n return result\n }\n\n // Attach updateDeps to the function itself\n memoizedFunction.updateDeps = (newDeps: [...TDeps]) => {\n deps = newDeps\n }\n\n return memoizedFunction\n}\n\nexport function notUndefined<T>(value: T | undefined, msg?: string): T {\n if (value === undefined) {\n throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ''}`)\n } else {\n return value\n }\n}\n\nexport const approxEqual = (a: number, b: number) => Math.abs(a - b) < 1.01\n\nexport const debounce = <TArgs extends Array<unknown>>(\n targetWindow: Window & typeof globalThis,\n fn: (...args: TArgs) => void,\n ms: number,\n) => {\n let timeoutId: number\n return Object.assign(\n function (this: unknown, ...args: TArgs) {\n targetWindow.clearTimeout(timeoutId)\n timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms)\n },\n {\n // The handle is closure-local, so a caller that has already\n // unsubscribed has no way to stop a queued call. Teardown paths use\n // this to drop the pending invocation instead of letting it land.\n cancel: () => {\n targetWindow.clearTimeout(timeoutId)\n },\n },\n )\n}\n","// Spike S3 (ADR 0003): scaled scroll above the browser element height cap.\n//\n// The virtualizer works in virtual offsets (the full list size). The scroll element works in real\n// offsets (`scrollTop`), and its sizer is never larger than the cap. Below the cap the two are\n// the same. Above it, a ratio maps one to the other.\n\n/** The largest sizer that Lattice gives a scroll element, in px. */\nexport const SAFE_MAX = 10_000_000\n\n/** The browser's default line, for a wheel event in lines (Firefox). */\nconst WHEEL_LINE = 16\n/** The browser's default arrow-key step. */\nconst ARROW_STEP = 40\n\nexport interface ScaledScrollSize {\n /** The full list size in px (the virtualizer's `getTotalSize()`). */\n totalSize: number\n /** The scroll element's client size in px. */\n viewportSize: number\n /** The largest sizer. The default is `SAFE_MAX`. */\n cap?: number\n}\n\n/** The size to give the sizer element: the total size, but not more than the cap. */\nexport const sizerSize = ({ totalSize, cap = SAFE_MAX }: ScaledScrollSize): number =>\n Math.min(totalSize, cap)\n\nconst ranges = (size: ScaledScrollSize) => ({\n virtualMax: Math.max(size.totalSize - size.viewportSize, 0),\n realMax: Math.max(sizerSize(size) - size.viewportSize, 0),\n})\n\n/** Virtual px for each real px. The ratio of the two scroll ranges, so both ends map exactly. */\nexport const scrollRatio = (size: ScaledScrollSize): number => {\n const { virtualMax, realMax } = ranges(size)\n return realMax > 0 && virtualMax > realMax ? virtualMax / realMax : 1\n}\n\nconst clamp = (value: number, max: number) => Math.min(Math.max(value, 0), max)\n\nexport const toRealOffset = (virtualOffset: number, size: ScaledScrollSize): number => {\n const { virtualMax, realMax } = ranges(size)\n const ratio = scrollRatio(size)\n if (ratio === 1) return virtualOffset\n const virtual = clamp(virtualOffset, virtualMax)\n // The end maps exactly; a division can be one ulp off.\n return virtual === virtualMax ? realMax : virtual / ratio\n}\n\nexport const toVirtualOffset = (realOffset: number, size: ScaledScrollSize): number => {\n const { virtualMax, realMax } = ranges(size)\n const ratio = scrollRatio(size)\n if (ratio === 1) return realOffset\n const real = clamp(realOffset, realMax)\n return real === realMax ? virtualMax : real * ratio\n}\n\n/**\n * The scroll state of one scaled scroll element. The virtual offset is the truth: a write that\n * this object makes reads back as the same virtual offset, so wheel and key steps do not drift.\n * Only a scroll that this object did not write (a scrollbar drag) maps the real offset back.\n */\nexport class ScaledScroll {\n size: ScaledScrollSize\n virtualOffset = 0\n /** The element's real offset, as written or as last read. */\n realOffset = 0\n private _written: number | null = null\n\n constructor(size: ScaledScrollSize) {\n this.size = size\n }\n\n get scaled(): boolean {\n return scrollRatio(this.size) !== 1\n }\n\n /** The sizer element's size. */\n get sizerSize(): number {\n return sizerSize(this.size)\n }\n\n /**\n * Add this to an item's virtual start to get its real position in the sizer. It puts the item\n * at the virtual offset at the top of the viewport.\n */\n get shift(): number {\n return this.realOffset - this.virtualOffset\n }\n\n /** The virtual offset of a real offset, with no change to this object. */\n toVirtual(realOffset: number): number {\n // Our own write comes back rounded to the browser's precision: keep the exact offset.\n return this._isOwnWrite(realOffset)\n ? this.virtualOffset\n : toVirtualOffset(realOffset, this.size)\n }\n\n /** Read the element's `scrollTop` after a scroll event. Returns the virtual offset. */\n onScroll(realOffset: number): number {\n this.realOffset = realOffset\n if (!this._isOwnWrite(realOffset)) this._written = null\n this.virtualOffset = this.toVirtual(realOffset)\n return this.virtualOffset\n }\n\n private _isOwnWrite(realOffset: number): boolean {\n return this._written !== null && Math.abs(realOffset - this._written) < 1\n }\n\n /** Move to a virtual offset. Returns the real offset to write to `scrollTop`. */\n scrollTo(virtualOffset: number): number {\n this.virtualOffset = clamp(virtualOffset, ranges(this.size).virtualMax)\n this.realOffset = toRealOffset(this.virtualOffset, this.size)\n this._written = this.realOffset\n return this.realOffset\n }\n\n /** Move by a delta in virtual px. Returns the real offset to write to `scrollTop`. */\n scrollBy(delta: number): number {\n return this.scrollTo(this.virtualOffset + delta)\n }\n}\n\n/** A wheel event's vertical delta in px. `deltaMode` 1 is lines (Firefox), 2 is pages. */\nexport const wheelDelta = (\n { deltaY, deltaMode }: Pick<WheelEvent, 'deltaY' | 'deltaMode'>,\n viewportSize: number,\n): number =>\n deltaMode === 1 ? deltaY * WHEEL_LINE : deltaMode === 2 ? deltaY * viewportSize : deltaY\n\n/** A scroll key's delta in virtual px, or null for a key that does not scroll. */\nexport const keyDelta = (key: string, viewportSize: number): number | null => {\n switch (key) {\n case 'ArrowDown':\n return ARROW_STEP\n case 'ArrowUp':\n return -ARROW_STEP\n case 'PageDown':\n return viewportSize\n case 'PageUp':\n return -viewportSize\n case 'End':\n return Infinity\n case 'Home':\n return -Infinity\n default:\n return null\n }\n}\n\n/**\n * The 1-based row at a virtual offset, for the \"row N of M\" hint during a scrollbar drag.\n * shortcut: assumes rows of one size; with measured rows, use the virtualizer's\n * `getVirtualItemForOffset` instead.\n */\nexport const rowAt = (virtualOffset: number, count: number, totalSize: number): number =>\n count === 0 ? 0 : Math.min(count, Math.floor(virtualOffset / (totalSize / count)) + 1)\n\n/**\n * Move wheel and key input in virtual space while the list is scaled. Without this, one wheel\n * step of 100 px moves the list by 100 px times the ratio. Below the cap the browser keeps\n * the input. Returns a function that removes the listeners.\n */\nexport function bindScaledInput(element: HTMLElement, scroll: ScaledScroll): () => void {\n const move = (delta: number, event: Event) => {\n if (!scroll.scaled) return\n event.preventDefault()\n element.scrollTop = scroll.scrollBy(delta)\n }\n const onWheel = (event: WheelEvent) => {\n // ctrl+wheel is zoom, and a sideways wheel is for the columns: the browser keeps both.\n if (event.ctrlKey || event.deltaY === 0) return\n move(wheelDelta(event, scroll.size.viewportSize), event)\n // `preventDefault` also stopped the sideways part of a diagonal wheel: apply it here.\n if (event.defaultPrevented && event.deltaX !== 0) element.scrollLeft += event.deltaX\n }\n const onKey = (event: KeyboardEvent) => {\n if (event.target !== element) return\n const delta = keyDelta(event.key, scroll.size.viewportSize)\n if (delta !== null) move(delta, event)\n }\n // A scroll that this layer did not write (a scrollbar drag) moves the virtual offset.\n const onScroll = () => scroll.onScroll(element.scrollTop)\n // `passive: false`, so `preventDefault` stops the browser's own scroll.\n element.addEventListener('wheel', onWheel, { passive: false })\n element.addEventListener('keydown', onKey)\n element.addEventListener('scroll', onScroll, { passive: true })\n return () => {\n element.removeEventListener('scroll', onScroll)\n element.removeEventListener('wheel', onWheel)\n element.removeEventListener('keydown', onKey)\n }\n}\n","// Ported from TanStack Virtual (MIT, Copyright (c) 2021-present Tanner Linsley), packages/virtual-core/src/scroll-classifier.ts @ 3.19.16.\nimport { approxEqual } from './utils.ts'\n\n// Why a scroll event arrived, decided from the virtualizer's state as it was\n// before the event, before the scroll handler mutates anything. The first\n// match in this order wins:\n// spurious Safari/Firefox re-emit at the position we hold, nothing\n// pending\n// readBack our last write reporting back (within 1.5px of its\n// target)\n// clampedReadBack our last non-smooth write, clamped at the element's\n// current max or at a smaller max the layout passed\n// through since the write\n// clampedEcho a compensation write the browser clamped (#1258)\n// reporting at the max seen at write time\n// restEcho our own write reported again at rest, where the last\n// scroll event reported it\n// external anything else: the user, a fling, a smooth animation\n// frame\ntype ScrollEventKind =\n 'spurious' | 'readBack' | 'clampedReadBack' | 'clampedEcho' | 'restEcho' | 'external'\n\nexport interface ScrollEventInput {\n // The reported position in layout coordinates (the element's offset plus\n // the held correction and a pending prepend anchor's delta).\n offset: number\n isScrolling: boolean\n // The element's own scroll max, read only while scrolling (null otherwise\n // or where it cannot be read).\n elementMax: number | null\n // How far the element sits behind the layout while a correction is held.\n holdOffset: number\n // The layout position the virtualizer holds.\n scrollOffset: number | null\n // Our last write to the element, until a scroll event reports it, with\n // the scroll maxima below its target the element had since (see\n // `lowMaxes` on `pendingWrite` in the virtualizer).\n pendingWrite: {\n target: number\n smooth: boolean\n lowMaxes?: Array<number>\n } | null\n // The element's max when a clamped compensation write was made (#1258),\n // or null when none is pending.\n clampedMaxAtWrite: number | null\n // Where the last scroll event reported our own write (read back, clamped\n // or echoed), until a report anywhere else.\n ownWriteAt: number | null\n}\n\nexport function classifyScrollEvent({\n offset,\n isScrolling,\n elementMax,\n holdOffset,\n scrollOffset,\n pendingWrite,\n clampedMaxAtWrite,\n ownWriteAt,\n}: ScrollEventInput): ScrollEventKind {\n // A scroll event that reports movement but lands on the offset we already\n // hold — and isn't a self-write read-back — is a spurious no-op re-emit\n // that Safari/Firefox fire after a re-render's layout (Chrome doesn't).\n // Treating it as scrolling re-arms `isScrolling`, which forces a render\n // that triggers another such event: an infinite re-render loop.\n if (isScrolling && pendingWrite === null && offset === scrollOffset) {\n return 'spurious'\n }\n if (pendingWrite !== null && Math.abs(offset - pendingWrite.target) < 1.5) {\n return 'readBack'\n }\n // A non-smooth write past the element's max reads back at the max: ours,\n // clamped because the sizer shrank between the write and the report (rows\n // above the target measured smaller in a same-task render, #1310). The\n // element is where it says. A finger that drags to the max while such a\n // write is pending (iOS ignored it) is read the same way; the command then\n // retires at the next frame, its target clamped to the same max.\n if (\n pendingWrite !== null &&\n !pendingWrite.smooth &&\n elementMax !== null &&\n pendingWrite.target > elementMax + holdOffset + 0.5 &&\n Math.abs(offset - (elementMax + holdOffset)) < 1.5\n ) {\n return 'clampedReadBack'\n }\n // The same, clamped to a smaller max than the element's current one: the\n // sizer shrank below the target after the write (rows measured smaller,\n // a count change) and the browser clamped there, then it grew back, all\n // before the report. The clamp lands on one of those maxima; a position\n // between them is not one.\n if (\n pendingWrite !== null &&\n !pendingWrite.smooth &&\n pendingWrite.lowMaxes?.some(max => Math.abs(offset - max) < 1.5)\n ) {\n return 'clampedReadBack'\n }\n if (clampedMaxAtWrite !== null && Math.abs(offset - clampedMaxAtWrite) < 1.5) {\n return 'clampedEcho'\n }\n // A write is reported again when the element comes to rest: `scrollend`\n // follows its scroll event in the same frame's scroll steps, before\n // reconcile; the fallback follows it after `isScrollingResetDelay`.\n // Nothing has moved the element in between.\n if (!isScrolling && ownWriteAt !== null && Math.abs(offset - ownWriteAt) < 1.5) {\n return 'restEcho'\n }\n return 'external'\n}\n\n// Where an in-flight scroll command is in its lifecycle, which decides how\n// its scroll events and measurements are read:\n// queued the first write waits for the momentum tail to close\n// (iOS 27, see `_startScroll`). Nothing has been written:\n// the fling's scroll events do not retire the command, a\n// drag does, and reconcile only keeps the safety valve\n// smooth a smooth animation is travelling to the target\n// smoothLanded a smooth scroll is at its target, waiting to retire\n// smoothFinishing a smooth scroll switched to instant writes for the\n// final approach; its animation can still report positions\n// instant instant writes\nexport type ScrollPhase = 'queued' | 'smooth' | 'smoothLanded' | 'smoothFinishing' | 'instant'\n\n// The smooth animation may still be reporting positions, so a scroll event\n// that isn't the read-back of our own write may not be the user.\nconst isAnimating = (phase: ScrollPhase) => phase === 'smooth' || phase === 'smoothFinishing'\n\nexport interface RetireInput {\n kind: ScrollEventKind\n // The reported position in layout coordinates, as classified.\n offset: number\n // The in-flight scroll command, or null.\n command: {\n index: number | null\n phase: ScrollPhase\n lastTargetOffset: number\n } | null\n // The command's target recomputed against the current layout. Called\n // only once every cheaper clause has passed, and at most once.\n target: () => number\n}\n\n// Whether a scroll event that is not the read-back of our own write retires\n// the in-flight index command: an external scroll moved away from its\n// target, or our own write left the element where reconcile will not move\n// it. Our own measurement updates (including clamped writes) still need to\n// reconcile.\nexport function externalRetiresCommand({ kind, offset, command, target }: RetireInput): boolean {\n let fresh: number | undefined\n const freshTarget = () => (fresh ??= target())\n return (\n kind !== 'spurious' &&\n kind !== 'readBack' &&\n // Our own write, clamped (`clampedReadBack`, #1310): the command is not\n // retired by it, and reconcile retargets below the new max.\n kind !== 'clampedReadBack' &&\n command?.index != null &&\n // Nothing has been written for a command waiting for the tail; these\n // are the fling's events.\n command.phase !== 'queued' &&\n // A non-smooth write lands at once, so any other scroll event is the\n // user's, even before reconcile saw the target reached (the target may\n // keep moving, or iOS ignored the write under a finger). A write the\n // browser clamped because the sizer hasn't grown yet reads back at the\n // max, which is also where the fresh target clamps, so the check below\n // keeps it reconciling (#1294). While a smooth scroll's animation may\n // still report, its events look like a user's, so it yields only once it\n // has landed.\n !isAnimating(command.phase) &&\n !approxEqual(offset, command.lastTargetOffset) &&\n !approxEqual(offset, freshTarget()) &&\n // Our own write reported again at rest (`restEcho`): nothing else has\n // moved the element, but reconcile writes only a target that moved. Once\n // the target has moved since the command wrote it, reconcile lands the\n // command there (with `scrollend`, a correction's echo arrives before\n // reconcile has run on the measurements behind it); while it has not,\n // nothing will bring the element back, and the command ends here.\n (kind !== 'restEcho' || freshTarget() === command.lastTargetOffset) &&\n // A compensation write's clamped echo (#1258) keeps the command. The\n // order is deliberate, not tidiness: this clause stays after `target()`\n // (and `clampedReadBack` before it) because `target()` can rebuild the\n // measurements, so it must run for exactly the events it always did.\n kind !== 'clampedEcho'\n )\n}\n\n// A scroll position reported at a time, in the element's own coordinates.\nexport interface ScrollSample {\n t: number\n offset: number\n}\n\nconst FLING_WINDOW_MS = 40\n\n// Whether the scroll sped up: a finger flicked again or dragged on during a\n// fling. iOS fires no touch events for a touch that lands on a fling\n// (#1307), so this, and a turn against the fling, is all that shows it.\n// Momentum only slows down. Scroll events arrive 7–26ms apart and some\n// carry two frames, so one event can read 2–3× faster than its neighbours;\n// the speed is taken over the last 40ms and compared with the 40ms before.\n// On an iPhone (27.0.1) the flicks read 2.4–6× faster than the window before\n// and at least 1.5px/ms more, momentum alone at most 1.7× (#1307).\nexport function flingSpedUp(samples: ReadonlyArray<ScrollSample>): boolean {\n const last = samples[samples.length - 1]\n if (last === undefined) return false\n let j = samples.length - 2\n while (j >= 0 && last.t - samples[j]!.t < FLING_WINDOW_MS) j--\n if (j < 0) return false\n const mid = samples[j]!\n let k = j - 1\n while (k >= 0 && mid.t - samples[k]!.t < FLING_WINDOW_MS) k--\n if (k < 0) return false\n const first = samples[k]!\n const recent = (last.offset - mid.offset) / (last.t - mid.t)\n const before = (mid.offset - first.offset) / (mid.t - first.t)\n return (\n recent * before >= 0 &&\n Math.abs(recent) >= 2 * Math.abs(before) &&\n Math.abs(recent) - Math.abs(before) >= 0.8\n )\n}\n\n// Whether a fling that sent its last scroll event was still going at\n// 0.05px/ms or more over its last 40ms: a finger caught it. A fling that\n// ends on its own fades to at most 0.015px/ms first; taps stopped one at\n// 0.21–1.43px/ms (iPhones on 27.0.1, #1307). The finger stays down with no\n// touch events, and iOS undoes a write made under it. A tap in the last\n// pixels of a fling reads as its end.\nexport function flingCaught(samples: ReadonlyArray<ScrollSample>): boolean {\n const last = samples[samples.length - 1]\n if (last === undefined) return false\n let j = samples.length - 2\n while (j >= 0 && last.t - samples[j]!.t < FLING_WINDOW_MS) j--\n if (j < 0) return false\n const from = samples[j]!\n return Math.abs(last.offset - from.offset) / (last.t - from.t) >= 0.05\n}\n","// Ported from TanStack Virtual (MIT, Copyright (c) 2021-present Tanner Linsley), packages/virtual-core/src/ios-gesture.ts @ 3.19.16.\n// Browser-aware iOS detection. Programmatic `scrollTo`/`scrollTop` writes\n// during a momentum-scroll cancel the momentum on iOS WebKit, so we defer\n// scroll-position adjustments triggered by mid-scroll resizes until the\n// scroll settles. SSR-safe (returns false when navigator is unavailable).\nlet _isIOSResult: boolean | undefined\nexport const isIOSWebKit = (): boolean => {\n if (_isIOSResult !== undefined) return _isIOSResult\n if (typeof navigator === 'undefined') return (_isIOSResult = false)\n if (/iP(hone|od|ad)/.test(navigator.userAgent)) return (_isIOSResult = true)\n // iPadOS 13+ reports as MacIntel; touch-points distinguishes it from desktop.\n const mtp = (navigator as Navigator & { maxTouchPoints?: number }).maxTouchPoints\n return (_isIOSResult = navigator.platform === 'MacIntel' && mtp !== undefined && mtp > 0)\n}\n\n// iOS 27 changed what a scrollTop write does to a fling: it no longer stops\n// the momentum, the fling carries on along its own path and the write shows\n// for one frame (measured on the 27.0 simulator in #1307, device check still\n// open). WebKit shipped `overflow-anchor` in the same release, so that is\n// the feature check; iOS 26 and earlier report false. Cached like the iOS\n// check; SSR-safe.\nlet _iosMomentumOverridesWritesResult: boolean | undefined\nexport const iosMomentumOverridesWrites = (): boolean => {\n if (_iosMomentumOverridesWritesResult !== undefined) {\n return _iosMomentumOverridesWritesResult\n }\n return (_iosMomentumOverridesWritesResult =\n isIOSWebKit() &&\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('overflow-anchor: auto'))\n}\n\n// Whether a touch fling survives a scrollTop write, so a command issued\n// mid-fling has to stop the fling before it writes. Only iOS 26 and earlier\n// stop the momentum on the write itself. Chrome on Android carries the fling\n// on from the written position: on a Pixel 6 (Android 16, Chrome 156) a\n// `scrollToIndex` issued 150ms into a fling wrote its target, then went on\n// ~3,200px past it, 3 runs of 3. Other non-iOS engines are not measured; on\n// one whose write does stop the fling, stopping it first costs the two\n// frames of the stop.\nexport const momentumOverridesWrites = (): boolean => !isIOSWebKit() || iosMomentumOverridesWrites()\n\n// Any WebKit: Safari, a WKWebView app, every browser on iOS. Chromium's\n// user agent names AppleWebKit too, and so do jsdom's and happy-dom's, where\n// a consumer's test must see the same writes as before. Cached like the iOS\n// check; SSR-safe.\nlet _isWebKitResult: boolean | undefined\nexport const isWebKit = (): boolean => {\n if (_isWebKitResult !== undefined) return _isWebKitResult\n if (typeof navigator === 'undefined') return (_isWebKitResult = false)\n const ua = navigator.userAgent\n return (_isWebKitResult =\n /AppleWebKit/.test(ua) && !/Chrome|Chromium|Android|jsdom|HappyDOM/.test(ua))\n}\n\n// Test hook: reset the iOS detection caches. Not exported.\nexport const _resetIOSDetectionForTests = () => {\n _isIOSResult = undefined\n _isWebKitResult = undefined\n _iosMomentumOverridesWritesResult = undefined\n}\n\n// Touch listeners on the scroll element run in the capture phase, so a row\n// that stops a touch event's propagation cannot hide the gesture from the\n// iOS deferral.\nconst touchListenerOptions = {\n capture: true,\n passive: true,\n}\n\n// The touch gesture in progress. iOS WebKit ignores a scrollTop write while\n// a finger drags the content (one resting on it does not stop the write)\n// and cancels momentum on one after it, so adjustments are deferred through\n// the whole gesture: `down` from touchstart to touchend/touchcancel, then\n// `tail` while momentum runs. iOS fires no touch events during momentum, so\n// every scroll event re-arms the tail and it closes ~150ms after the last\n// one. Null between gestures. The tail is tracked on every platform, but\n// only iOS defers anything through it; elsewhere it only tells a command\n// that a fling may be running (`momentumOverridesWrites`). The tail record\n// owns its timer: every replacement of the state goes through `end`, which\n// clears it, so a live timer always has its record.\n//\n// `moved`: the content moved under or after the finger other than by our\n// own write's read-back. While `down`, a scroll event that changed the\n// position sets it: the finger is dragging. The tail inherits it from the\n// drag, and any other scroll event re-arming the tail sets it: a fling can\n// be running. A tap's tail has it unset.\n//\n// `awaitingFling`: the tail follows a drag whose fling has not reported\n// yet. The first frame of a fling can come 150–250ms after touchend when\n// the main thread is busy (27.0 simulator, #1307); if the tail closes\n// first, `lateFling` waits until `until` for that frame to reopen it. It\n// defers nothing: other scroll events with no touch before them must not\n// defer corrections (#1250).\ntype IosTouch =\n | { phase: 'down'; moved: boolean }\n | { phase: 'tail'; moved: boolean; awaitingFling: boolean; timerId: number }\n | { phase: 'lateFling'; until: number }\n | null\n\ntype TimerWindow = Pick<Window, 'setTimeout' | 'clearTimeout'>\n\ntype IosGestureHost = {\n // The scroll element's window, which runs the tail timer; null when\n // there is no element.\n getWindow: () => TimerWindow | null\n now: () => number\n // Asked when the tail's timer fires: true keeps it open another\n // 150ms (the fling still moves between scroll events).\n tailStillMoving: () => boolean\n // The tail closed on its own: a write is possible again.\n onTailClosed: () => void\n}\n\nexport class IosGesture {\n private _touch: IosTouch = null\n\n // Lattice: an explicit field, not a parameter property (`erasableSyntaxOnly`).\n private readonly host: IosGestureHost\n\n constructor(host: IosGestureHost) {\n this.host = host\n }\n\n get touch(): IosTouch {\n return this._touch\n }\n\n // A touch gesture owns the scroll: on iOS a write now would be ignored or\n // would cancel the momentum, so adjustments wait for the tail to close.\n // `isScrolling` is not part of it: any scroll event sets it, including\n // the read-back of our own write, and a programmatic scroll has no\n // momentum to protect (#1250).\n inMotion = () => this._touch !== null && this._touch.phase !== 'lateFling'\n\n // A finger is dragging the content, so iOS ignores our writes and no\n // read-back will come. A resting finger does not: the write lands.\n dragging = () => this._touch?.phase === 'down' && this._touch.moved\n\n // The open tail, if any: after a tap, or after a drag or fling. Except on\n // iOS 26 and earlier, a fling's momentum outlasts a write (see\n // `momentumOverridesWrites`).\n tail = (): 'tap' | 'fling' | null =>\n this._touch?.phase === 'tail' ? (this._touch.moved ? 'fling' : 'tap') : null\n\n // A scroll event reached the handler. `ownReadBack`: it is our own\n // write's read-back; `moved`: it changed the layout position; `external`:\n // the user or a fling moved it (not our write nor our smooth animation).\n // Returns whether it shows a finger dragging the content.\n onScroll = ({\n isScrolling,\n ownReadBack,\n moved,\n external,\n }: {\n isScrolling: boolean\n ownReadBack: boolean\n moved: boolean\n external: boolean\n }): boolean => {\n // Momentum after touchend fires a scroll event per frame but no touch\n // events, so each one re-arms the tail to span the fling. Only an open\n // tail is extended: a scroll event with no touch before it (our own\n // write's read-back) never opens one.\n if (isScrolling && this._touch?.phase === 'tail') {\n this._openTail(this._touch.moved || !ownReadBack, false)\n } else if (this._touch?.phase === 'lateFling') {\n // A drag's fling reporting after its tail closed reopens it.\n if (this.host.now() > this._touch.until) {\n this._touch = null\n } else if (external && isScrolling && moved) {\n this._openTail(true, false)\n }\n }\n // A finger that moved the content is dragging. Our own write landing\n // under a resting finger is not, and neither is a report at rest that\n // leaves the position where it was.\n if (!ownReadBack && isScrolling && moved && this._touch?.phase === 'down') {\n this._touch.moved = true\n return true\n }\n return false\n }\n\n touchStart = () => {\n // A finger back down inside the grace window cancels its tail.\n this.end()\n this._touch = { phase: 'down', moved: false }\n }\n\n touchEnd = () => {\n const moved = this._touch?.phase === 'down' && this._touch.moved\n this.end()\n this._openTail(moved, moved)\n }\n\n // Drop the gesture, and the tail's timer with it.\n end = () => {\n const win = this.host.getWindow()\n if (this._touch?.phase === 'tail' && win != null) {\n win.clearTimeout(this._touch.timerId)\n }\n this._touch = null\n }\n\n // Follow the touch events on `target`; the returned function stops and\n // drops the gesture. Listening is unconditional: the listeners are\n // passive and cheap, and on non-touch devices they never fire. The gating\n // by `isIOSWebKit()` lives where a write is decided.\n listen = (target: EventTarget) => {\n const onTouchStart = () => this.touchStart()\n const onTouchEnd = () => this.touchEnd()\n target.addEventListener('touchstart', onTouchStart, touchListenerOptions)\n target.addEventListener('touchend', onTouchEnd, touchListenerOptions)\n // Same handler as touchend: iOS can end a touch with touchcancel (system\n // gesture, interrupted scroll) and never fire touchend.\n target.addEventListener('touchcancel', onTouchEnd, touchListenerOptions)\n return () => {\n target.removeEventListener('touchstart', onTouchStart, touchListenerOptions)\n target.removeEventListener('touchend', onTouchEnd, touchListenerOptions)\n target.removeEventListener('touchcancel', onTouchEnd, touchListenerOptions)\n this.end()\n }\n }\n\n // (Re)open the tail after the finger lifts, closing ~150ms after the last\n // touchend or momentum frame.\n private _openTail = (moved: boolean, awaitingFling: boolean) => {\n const win = this.host.getWindow()\n if (win == null) return\n this.end()\n const tail = {\n phase: 'tail' as const,\n moved,\n awaitingFling,\n // Only fires while this tail is current: `end` clears it otherwise.\n timerId: win.setTimeout(() => {\n if (this.host.tailStillMoving()) {\n this._openTail(tail.moved, tail.awaitingFling)\n return\n }\n this._touch = tail.awaitingFling\n ? { phase: 'lateFling', until: this.host.now() + 1000 }\n : null\n this.host.onTailClosed()\n }, 150),\n }\n this._touch = tail\n }\n}\n","// Ported from TanStack Virtual (MIT, Copyright (c) 2021-present Tanner Linsley), packages/virtual-core/src/index.ts @ 3.19.16.\nimport { createLazyMeasurementsView, getMeasurementKey } from './lazy-measurements.ts'\nimport { DEV, approxEqual, debounce, memo, notUndefined } from './utils.ts'\nimport { toVirtualOffset } from '../scaled-scroll.ts'\nimport type { ScaledScroll } from '../scaled-scroll.ts'\nimport {\n classifyScrollEvent,\n externalRetiresCommand,\n flingCaught,\n flingSpedUp,\n} from './scroll-classifier.ts'\nimport { IosGesture, isIOSWebKit, isWebKit, momentumOverridesWrites } from './ios-gesture.ts'\nimport type { ScrollPhase, ScrollSample } from './scroll-classifier.ts'\n\nexport { _resetIOSDetectionForTests } from './ios-gesture.ts'\nexport { approxEqual, debounce, memo, notUndefined } from './utils.ts'\nexport type { NoInfer, PartialKeys } from './utils.ts'\n\n//\n\ntype ScrollDirection = 'forward' | 'backward'\n\nexport type ScrollAlignment = 'start' | 'center' | 'end' | 'auto'\n\ntype ScrollBehavior = 'auto' | 'smooth' | 'instant'\n\ntype ScrollAnchor = 'start' | 'end'\n\ntype FollowOnAppend = boolean | ScrollBehavior\n\nexport interface ScrollToOptions {\n align?: ScrollAlignment\n behavior?: ScrollBehavior\n}\n\ntype ScrollToOffsetOptions = ScrollToOptions\n\ntype ScrollToIndexOptions = ScrollToOptions\n\ntype ScrollToEndOptions = Pick<ScrollToOptions, 'behavior'>\n\nexport interface Range {\n startIndex: number\n endIndex: number\n overscan: number\n count: number\n /**\n * Lane count of the virtualizer. When greater than 1, `overscan` counts\n * rows of `lanes` items rather than single items.\n */\n lanes?: number\n}\n\ntype Key = number | string | bigint\n\nexport interface VirtualItem {\n key: Key\n index: number\n start: number\n end: number\n size: number\n lane: number\n}\n\nexport interface Rect {\n width: number\n height: number\n}\n\n//\n\nconst getRect = (element: HTMLElement): Rect => {\n const { clientWidth, clientHeight } = element\n return { width: clientWidth, height: clientHeight }\n}\n\n// Animation frames for `useAnimationFrameWithResizeObserver`, requested from\n// the scroll element's own window rather than the global one.\nconst createFrameQueue = (targetWindow: Window) => {\n const ids = new Set<number>()\n return {\n schedule: (fn: () => void) => {\n const id = targetWindow.requestAnimationFrame(() => {\n ids.delete(id)\n fn()\n })\n ids.add(id)\n },\n cancel: () => {\n ids.forEach(id => targetWindow.cancelAnimationFrame(id))\n ids.clear()\n },\n }\n}\n\nexport const defaultKeyExtractor = (index: number) => index\n\nexport const defaultRangeExtractor = (range: Range) => {\n // With lanes, the visible range is already aligned to whole rows; overscan\n // by whole rows too, so every lane gets the same number of items rendered\n // (and measured). Overscanning single items leaves partial rows, letting one\n // lane collect more measured sizes than the others and drift (#1036).\n const overscan = range.overscan * Math.max(range.lanes ?? 1, 1)\n const start = Math.max(range.startIndex - overscan, 0)\n const end = Math.min(range.endIndex + overscan, range.count - 1)\n const len = end - start + 1\n\n const arr = new Array<number>(len)\n for (let i = 0; i < len; i++) {\n arr[i] = start + i\n }\n return arr\n}\n\nexport const observeElementRect = <T extends Element, TItemElement extends Element>(\n instance: Virtualizer<T, TItemElement>,\n cb: (rect: Rect) => void,\n) => {\n const element = instance.scrollElement\n if (!element) {\n return\n }\n const targetWindow = instance.targetWindow\n if (!targetWindow) {\n return\n }\n\n const handler = (rect: Rect) => {\n const { width, height } = rect\n cb({ width: Math.round(width), height: Math.round(height) })\n }\n\n handler(getRect(element as unknown as HTMLElement))\n\n if (!targetWindow.ResizeObserver) {\n return () => {}\n }\n\n const frames = createFrameQueue(targetWindow)\n const observer = new targetWindow.ResizeObserver(() => {\n const run = () => {\n handler(getRect(element as unknown as HTMLElement))\n }\n\n if (instance.options.useAnimationFrameWithResizeObserver) frames.schedule(run)\n else run()\n })\n\n observer.observe(element, { box: 'content-box' })\n\n return () => {\n observer.unobserve(element)\n frames.cancel()\n }\n}\n\nconst addEventListenerOptions = {\n passive: true,\n}\n\nexport const observeWindowRect = <TItemElement extends Element>(\n instance: Virtualizer<Window, TItemElement>,\n cb: (rect: Rect) => void,\n) => {\n const element = instance.scrollElement\n if (!element) {\n return\n }\n\n const handler = () => {\n cb({ width: element.innerWidth, height: element.innerHeight })\n }\n handler()\n\n element.addEventListener('resize', handler, addEventListenerOptions)\n\n return () => {\n element.removeEventListener('resize', handler)\n }\n}\n\nconst supportsScrollend = typeof window == 'undefined' ? true : 'onscrollend' in window\n\ntype ObserveOffsetCallBack = (offset: number, isScrolling: boolean) => void\n\n// Shared core: both element and window variants attach scroll/scrollend\n// listeners with the same lifecycle; they only differ in how to read the\n// current offset from the scroll target.\nconst observeOffset = <T extends Element | Window, TItemElement extends Element>(\n instance: Virtualizer<T, TItemElement>,\n cb: ObserveOffsetCallBack,\n readOffset: (target: T) => number,\n) => {\n const element = instance.scrollElement\n if (!element) {\n return\n }\n const targetWindow = instance.targetWindow\n if (!targetWindow) {\n return\n }\n\n const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend\n\n let offset = 0\n const fallback = registerScrollendEvent\n ? null\n : debounce(\n targetWindow,\n () => cb(readOffset(element), false),\n instance.options.isScrollingResetDelay,\n )\n\n const createHandler = (isScrolling: boolean) => () => {\n offset = readOffset(element)\n fallback?.()\n cb(offset, isScrolling)\n }\n const handler = createHandler(true)\n const endHandler = createHandler(false)\n\n element.addEventListener('scroll', handler, addEventListenerOptions)\n if (registerScrollendEvent) {\n element.addEventListener('scrollend', endHandler, addEventListenerOptions)\n }\n return () => {\n element.removeEventListener('scroll', handler)\n if (registerScrollendEvent) {\n element.removeEventListener('scrollend', endHandler)\n }\n // Removing the listener doesn't retract a reset already queued by the\n // last scroll, and that call would land on a virtualizer that has been\n // torn down — in React, a dispatch into an unmounted tree.\n fallback?.cancel()\n }\n}\n\nexport const observeElementOffset = <T extends Element, TItemElement extends Element>(\n instance: Virtualizer<T, TItemElement>,\n cb: ObserveOffsetCallBack,\n) =>\n observeOffset(instance, cb, el => {\n const { horizontal, isRtl } = instance.options\n return horizontal ? el.scrollLeft * ((isRtl && -1) || 1) : el.scrollTop\n })\n\nexport const observeWindowOffset = <TItemElement extends Element>(\n instance: Virtualizer<Window, TItemElement>,\n cb: ObserveOffsetCallBack,\n) => observeOffset(instance, cb, win => (instance.options.horizontal ? win.scrollX : win.scrollY))\n\nexport const measureElement = <TItemElement extends Element, T extends Element | Window>(\n element: TItemElement,\n entry: ResizeObserverEntry | undefined,\n instance: Virtualizer<T, TItemElement>,\n) => {\n // When useCachedMeasurements is enabled, return the cached size\n // (or estimateSize as fallback) instead of measuring the DOM.\n if (instance.options.useCachedMeasurements) {\n const index = instance.indexFromElement(element)\n const key = instance.options.getItemKey(index)\n return instance.itemSizeCache.get(key) ?? instance.options.estimateSize(index)\n }\n\n if (entry?.borderBoxSize) {\n const box = entry.borderBoxSize[0]\n if (box) {\n const size = Math.round(box[instance.options.horizontal ? 'inlineSize' : 'blockSize'])\n return size\n }\n }\n\n // When called without a ResizeObserverEntry (sync measurement path),\n // return the previously measured size if available. This avoids a\n // synchronous layout read (offsetWidth/offsetHeight) on re-renders.\n // The ResizeObserver is already observing the element and will deliver\n // the accurate size asynchronously if it changed.\n // Users who need synchronous DOM reads can provide a custom measureElement.\n if (!entry) {\n const index = instance.indexFromElement(element)\n const key = instance.options.getItemKey(index)\n const cachedSize = instance.itemSizeCache.get(key)\n if (cachedSize !== undefined) {\n return cachedSize\n }\n }\n\n return (element as unknown as HTMLElement)[\n instance.options.horizontal ? 'offsetWidth' : 'offsetHeight'\n ]\n}\n\nconst scrollWithAdjustments = <\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>(\n offset: number,\n { adjustments = 0, behavior }: { adjustments?: number; behavior?: ScrollBehavior },\n instance: Virtualizer<TScrollElement, TItemElement>,\n) => {\n const { scrollElement, options } = instance\n const adjustedOffset = offset + adjustments\n const isRtlElement =\n options.horizontal &&\n options.isRtl &&\n scrollElement !== null &&\n 'ownerDocument' in scrollElement\n\n scrollElement?.scrollTo?.({\n [options.horizontal ? 'left' : 'top']: isRtlElement ? -adjustedOffset : adjustedOffset,\n behavior,\n })\n}\n\nexport const windowScroll: <T extends Window, TItemElement extends Element>(\n offset: number,\n options: { adjustments?: number; behavior?: ScrollBehavior },\n instance: Virtualizer<T, TItemElement>,\n) => void = scrollWithAdjustments\n\nexport const elementScroll: <T extends Element, TItemElement extends Element>(\n offset: number,\n options: { adjustments?: number; behavior?: ScrollBehavior },\n instance: Virtualizer<T, TItemElement>,\n) => void = scrollWithAdjustments\n\ntype LaneAssignmentMode = 'estimate' | 'measured'\n\nexport interface VirtualizerOptions<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n> {\n // Required from the user\n count: number\n getScrollElement: () => TScrollElement | null\n estimateSize: (index: number) => number\n\n // Required from the framework adapter (but can be overridden)\n scrollToFn: (\n offset: number,\n options: { adjustments?: number; behavior?: ScrollBehavior },\n instance: Virtualizer<TScrollElement, TItemElement>,\n ) => void\n observeElementRect: (\n instance: Virtualizer<TScrollElement, TItemElement>,\n cb: (rect: Rect) => void,\n ) => void | (() => void)\n observeElementOffset: (\n instance: Virtualizer<TScrollElement, TItemElement>,\n cb: ObserveOffsetCallBack,\n ) => void | (() => void)\n // Optional\n debug?: boolean\n initialRect?: Rect\n onChange?: (instance: Virtualizer<TScrollElement, TItemElement>, sync: boolean) => void\n measureElement?: (\n element: TItemElement,\n entry: ResizeObserverEntry | undefined,\n instance: Virtualizer<TScrollElement, TItemElement>,\n ) => number\n overscan?: number\n horizontal?: boolean\n paddingStart?: number\n paddingEnd?: number\n scrollPaddingStart?: number\n scrollPaddingEnd?: number\n initialOffset?: number | ((instance: Virtualizer<TScrollElement, TItemElement>) => number)\n getItemKey?: (index: number) => Key\n rangeExtractor?: (range: Range) => Array<number>\n scrollMargin?: number\n gap?: number\n indexAttribute?: string\n initialMeasurementsCache?: Array<VirtualItem>\n lanes?: number\n anchorTo?: ScrollAnchor\n followOnAppend?: FollowOnAppend\n scrollEndThreshold?: number\n isScrollingResetDelay?: number\n useScrollendEvent?: boolean\n enabled?: boolean\n isRtl?: boolean\n useAnimationFrameWithResizeObserver?: boolean\n laneAssignmentMode?: LaneAssignmentMode\n useCachedMeasurements?: boolean\n // Lattice (ADR 0003): the element works in real offsets, the virtualizer in virtual offsets.\n scrollScale?: ScaledScroll\n}\n\ntype ScrollState = {\n // what we want\n index: number | null\n align: ScrollAlignment\n // scrollToEnd: track the DOM max scroll offset instead of the item's offset\n toEnd?: boolean\n\n // lifecycle\n startedAt: number\n // how the command was asked to scroll; a queued command writes with it\n behavior: ScrollBehavior\n\n // target tracking\n lastTargetOffset: number\n\n // settling\n stableFrames: number\n phase: ScrollPhase\n\n // A `queued` command's view of the fling it waits for: the scroll events\n // since it was queued, at most the last 200ms (`flingSpedUp`,\n // `flingCaught`). Read only while `queued`.\n samples?: Array<ScrollSample>\n}\n\nconst initialScrollPhase = (behavior: ScrollBehavior, atTarget: boolean): ScrollPhase =>\n behavior === 'smooth' ? (atTarget ? 'smoothLanded' : 'smooth') : 'instant'\n\n// A smooth scroll owns the position: size compensation, the prepend anchor\n// sync and far measurements hold off until it switches to instant writes.\nconst isSmoothScroll = (state: ScrollState | null): state is ScrollState =>\n state?.phase === 'smooth' || state?.phase === 'smoothLanded'\n\n// What `setOptions` decided about the scroll position for `_willUpdate` to\n// carry out once the consumer has rendered: keep the reading anchor in place\n// after a prepend (`scrollOffset` already moved by `delta`, the element has\n// not), or follow an append to the end. A prepend that qualifies for both\n// only follows.\ntype PendingScrollAnchor =\n { kind: 'anchor'; delta: number } | { kind: 'follow'; behavior: ScrollBehavior }\n\nfunction isAppendWithTrim(\n prevCount: number,\n nextCount: number,\n getPreviousKey: (index: number) => Key,\n getNextKey: (index: number) => Key,\n): boolean {\n if (nextCount === 0) return false\n\n const firstKey = getNextKey(0)\n const removedKeys = new Set<Key>()\n let removedCount = 0\n while (removedCount < prevCount) {\n const key = getPreviousKey(removedCount)\n if (key === firstKey) break\n removedKeys.add(key)\n removedCount++\n }\n\n const retainedCount = prevCount - removedCount\n if (retainedCount === 0 || retainedCount >= nextCount) return false\n\n for (let i = 0; i < retainedCount; i++) {\n if (getNextKey(i) !== getPreviousKey(removedCount + i)) return false\n }\n for (let i = retainedCount; i < nextCount; i++) {\n if (removedKeys.has(getNextKey(i))) return false\n }\n return true\n}\n\nexport class Virtualizer<TScrollElement extends Element | Window, TItemElement extends Element> {\n private unsubs: Array<void | (() => void)> = []\n options!: Required<VirtualizerOptions<TScrollElement, TItemElement>>\n scrollElement: TScrollElement | null = null\n targetWindow: (Window & typeof globalThis) | null = null\n isScrolling = false\n private scrollState: ScrollState | null = null\n measurementsCache: Array<VirtualItem> = []\n // Keys belong to the layout build, even when VirtualItems are read later.\n // The flat [start, size, ...] buffer is reused across builds.\n private _singleLaneMeasurements: {\n flat: Float64Array\n items: Array<Key | VirtualItem>\n } | null = null\n itemSizeCache = new Map<Key, number>()\n private itemSizeCacheVersion = 0\n private builtMeasurementOptions: object | null = null\n private builtItemSizeCacheVersion = -1\n private pendingResizes: Array<{ index: number; delta: number }> = []\n private laneAssignments = new Map<number, number>() // index → lane cache\n // Earliest index dirtied since last getMeasurements() rebuild, or null.\n private pendingMin: number | null = null\n private prevLanes: number | undefined = undefined\n private lanesChangedFlag = false\n private lanesSettling = false\n // Whether `initialMeasurementsCache` has seeded `itemSizeCache`. It is\n // read once: a list that empties and refills keeps the sizes measured\n // since, rather than going back to the snapshot's. `enabled: false`\n // resets it along with the sizes.\n private initialMeasurementsCacheApplied = false\n private pendingScrollAnchor: PendingScrollAnchor | null = null\n scrollRect: Rect | null = null\n /**\n * The scroll position in the list's layout, consistent with\n * `getOffsetForIndex`, `scrollToOffset` and `initialOffset`. While a\n * correction is held (`_holdOffset`), `getVirtualItems()` and\n * `getTotalSize()` describe what is rendered, shifted by the held amount;\n * this stays the layout position.\n */\n scrollOffset: number | null = null\n scrollDirection: ScrollDirection | null = null\n /**\n * @deprecated Always 0: a scroll correction is folded into `scrollOffset`\n * at once, so there is never an outstanding adjustment to add to it. Read\n * `scrollOffset` alone.\n */\n get scrollAdjustments() {\n return 0\n }\n // Scroll corrections (a prepend's anchor delta, size changes above the\n // viewport) that could not be written to the element because a write was\n // impossible at the time (see `_canWriteScroll`): the difference between\n // `scrollOffset`, which always carries the corrected layout position, and\n // where the element is. While it is non-zero the rows and the total size\n // are exposed shifted by `-_holdOffset`, so every adapter renders the\n // reader's row where it was, writes subtract it (`_scrollToOffset`) and\n // scroll events add it back (the handler in `_willUpdate`). Released by\n // `_flushHoldIfReady`: the rows re-render in layout coordinates and the\n // element moves by the same amount in one paint.\n private _holdOffset = 0\n // Set in WebKit from a wheel event until 150ms pass without one, whether\n // or not that event scrolled this element. Corrections are held meanwhile\n // (see `_canWriteScroll`).\n private _wheelTimer: number | null = null\n // The frame a hold at the top is written in (`_flushHoldAtTop`).\n private _edgeFlushFrame: number | null = null\n // Whether the element's last scroll event reported a position past either\n // edge (the rubber-band bounce). Judged at report time against the\n // element's own max, with a 1px tolerance for a fractional scrollTop: a\n // sizer that shrinks after the report (a trim) is not a bounce, and\n // `scrollOffset` is no judge either, since an eager bump past the max while\n // the sizer has not grown yet (#1258) is not one.\n //\n // Stored rather than read from the element when a write is decided. The\n // two differ once a write has landed but not been reported back, and in\n // that window the element reads in bounds while `scrollOffset` is still\n // the pre-write value. With the anchor sync now skipped in that window\n // (`_awaitingCommandReadBack`), the remaining difference is the trim: a\n // list that shrank under the position reads past the element's max until\n // the browser clamps it, which is where the anchor's write has to go\n // (`followOnAppend does not follow 'trim only'`; reading the element at\n // write time still moves 49 of 1080 snapshot seeds).\n private _reportedOverscroll = false\n // How far the scroll element extends past the end of the list: other\n // content that shares it (#1371). Read with the element's scroll range on\n // scroll reports and on attach, against the sizer the element has (the\n // last `getTotalSize()` an adapter drew), not a layout that measurements\n // moved since.\n private _trailing = 0\n private _drawnListEnd = Infinity\n // The touch gesture in progress (see `IosGesture`). Its tail closing on\n // its own makes a write possible again: the last momentum frame may have\n // come before the timer. The hold is released first, so a command that\n // waited for the tail is written over rows already back in layout\n // coordinates.\n private _iosGesture = new IosGesture({\n getWindow: () => this.targetWindow,\n now: () => this.now(),\n // The end of a fling can move less than a pixel per scroll event, so\n // events can stop for 150ms while the fling is still running (seen on\n // an iPhone, 27.0.1). A command waiting for it would then be written\n // into the fling and overridden. The element having moved since the\n // last event means it has not ended: wait again. Not while our own\n // write has yet to report: that moved it.\n tailStillMoving: () => {\n const state = this.scrollState\n if (state?.phase !== 'queued' || this.pendingWrite !== null) {\n return false\n }\n const now = this._readElementOffset()\n if (\n now === null ||\n this._lastElementOffset === null ||\n Math.abs(now - this._lastElementOffset) < 1\n ) {\n return false\n }\n this._lastElementOffset = now\n // It moved with no event: a sample, so the speed `flingCaught` reads\n // when it stops is not the one from before the silence.\n state.samples = [...(state.samples ?? []), { t: this.now(), offset: now }]\n return true\n },\n onTailClosed: () => {\n // A fling that stopped at speed was caught by a finger that is still\n // down, with no touch events: the user has taken over, as with a\n // drag, and iOS would undo the write anyway.\n const state = this.scrollState\n if (state?.phase === 'queued' && flingCaught(state.samples ?? [])) {\n this.scrollState = null\n }\n this._flushHoldIfReady(true)\n this._writeAwaitingCommand()\n // A clamped write the touch held back; a command written above has\n // cleared it.\n this._retryClampedAdjustment()\n },\n })\n // The last position the scroll handler was given, in the element's own\n // coordinates. The tail compares it with the element (`tailStillMoving`\n // above).\n private _lastElementOffset: number | null = null\n // Our last write to the element, from `_scrollToOffset` until the next\n // scroll event reports it (the only place it is cleared). Until then\n // `scrollOffset` may still hold the old position.\n //\n // - `target`: where the write puts the element (offset + the adjustment\n // passed to `scrollToFn`).\n // Safari (and Chrome/Firefox under certain DPRs) round writes to whole\n // pixels: wrote 12345.5, read back 12346. A read-back within 1.5px of\n // `target` is taken as our own and adopts the exact value, so reconcile\n // does not see a moved target and write again; a user scroll has moved\n // further by the time it reports.\n // - `smooth`: the write animates, so until it lands the element is\n // somewhere between the old offset and `target`.\n // - `lowMaxes`: for a command's instant write, each scroll max below\n // `target` the element had since the write. A command's target is\n // clamped to the max at the write, but the sizer can shrink under it\n // before the report (rows measured smaller, a count change) and grow\n // back, so the read-back is the max the browser clamped to then rather\n // than the element's current one. Read wherever the sizer can have\n // been committed (`_noteClampMax`).\n private pendingWrite: {\n target: number\n smooth: boolean\n lowMaxes?: Array<number>\n } | null = null\n // Where the last scroll event reported our own write, until a report\n // anywhere else. The browser reports the write again when the element\n // comes to rest (`restEcho`).\n private _ownWriteAt: number | null = null\n // A compensation write from `applyScrollAdjustment` whose target exceeded\n // the element's scroll max at the moment of the write. The browser clamps\n // such a write because the consumer's sizer has not grown yet: an\n // end-anchored item growing at the bottom only extends `scrollHeight` to\n // its own end, so with `paddingEnd > 0` the clamp lands exactly\n // `paddingEnd` short of the target (#1258). `_willUpdate` re-issues the\n // write once the sizer has caught up; the clamped read-back keeps it\n // pending, any other scroll event (a real gesture) cancels it.\n private _clampedAdjustment: { target: number; maxAtWrite: number } | null = null\n shouldAdjustScrollPositionOnItemSizeChange:\n | undefined\n | ((\n item: VirtualItem,\n delta: number,\n instance: Virtualizer<TScrollElement, TItemElement>,\n ) => boolean)\n elementsCache = new Map<Key, TItemElement>()\n // Set while a ResizeObserver callback measures its entries; `resizeItem`\n // records the pending notify here instead of firing it per entry.\n private _resizeBatch: { sync: boolean; notify?: boolean } | null = null\n // Set while a microtask waits to run `dropDisconnected` again.\n private _dropQueued = false\n private now = () => this.targetWindow?.performance?.now?.() ?? Date.now()\n private observer = (() => {\n let _ro: ResizeObserver | null = null\n let _frames: ReturnType<typeof createFrameQueue> | null = null\n let delivering = false\n let observeQueued = false\n const pendingObservations = new Set<Element>()\n\n const get = () => {\n if (_ro) {\n return _ro\n }\n\n const targetWindow = this.targetWindow\n if (!targetWindow || !targetWindow.ResizeObserver) {\n return null\n }\n\n const frames = (_frames = createFrameQueue(targetWindow))\n return (_ro = new targetWindow.ResizeObserver(entries => {\n const run = () => {\n // Measure every entry before notifying. A notify that adjusted\n // scroll re-renders synchronously, and that render can unmount\n // nodes whose entries are still queued here, leaving them\n // unmeasured. With lanes, a half-measured row lets one lane drift\n // away from the others (#1036).\n const batch: { sync: boolean; notify?: boolean } = { sync: false }\n this._resizeBatch = batch\n try {\n entries.forEach(measureEntry)\n } finally {\n this._resizeBatch = null\n if (batch.notify) {\n this.notify(batch.sync)\n this._noteClampMax()\n this._flushHoldIfReady(true)\n this._retryClampedAdjustment()\n // Ref-null callbacks run before the host nodes are detached.\n // Drop them after the sync renders, before the browser gathers\n // another round of ResizeObserver entries at their new depth.\n this.measureElement(null)\n }\n }\n }\n if (this.options.useAnimationFrameWithResizeObserver) {\n frames.schedule(run)\n } else {\n delivering = true\n try {\n run()\n } finally {\n delivering = false\n }\n }\n }))\n }\n\n const measureEntry = (entry: ResizeObserverEntry) => {\n const node = entry.target as TItemElement\n const index = this.indexFromElement(node)\n\n if (!node.isConnected) {\n this.observer.unobserve(node)\n // Find the cache entry pointing to this exact node and remove\n // it. We can't call getItemKey(index) here because items may\n // have been removed since this node was rendered — the index\n // could be stale and out-of-bounds in the user's data array\n // (regression test in e2e/.../stale-index.spec.ts, fix #1148).\n // The === comparison naturally handles the React-replaced-\n // a-node-for-the-same-key case: that entry now points to a\n // different node, so this loop won't match.\n for (const [cacheKey, cachedNode] of this.elementsCache) {\n if (cachedNode === node) {\n this.elementsCache.delete(cacheKey)\n break\n }\n }\n return\n }\n\n if (!this.isIndexInRange(index)) return\n\n if (this.shouldMeasureDuringScroll(index)) {\n this.resizeItem(index, this.options.measureElement(node, entry, this))\n }\n }\n\n return {\n disconnect: () => {\n get()?.disconnect()\n _frames?.cancel()\n pendingObservations.clear()\n observeQueued = false\n _ro = null\n _frames = null\n },\n observe: (target: Element) => {\n const observer = get()\n if (!observer) return\n if (!delivering) {\n observer.observe(target, { box: 'border-box' })\n return\n }\n // A sync render can also mount rows at the depth being delivered.\n // A microtask is still inside that delivery: register next frame,\n // while measureElement continues to measure the new row immediately.\n pendingObservations.add(target)\n if (!observeQueued) {\n observeQueued = true\n _frames?.schedule(() => {\n observeQueued = false\n pendingObservations.forEach(node => {\n if (node.isConnected) _ro?.observe(node, { box: 'border-box' })\n })\n pendingObservations.clear()\n })\n }\n },\n unobserve: (target: Element) => {\n pendingObservations.delete(target)\n get()?.unobserve(target)\n },\n }\n })()\n range: { startIndex: number; endIndex: number } | null = null\n\n constructor(opts: VirtualizerOptions<TScrollElement, TItemElement>) {\n this.setOptions(opts)\n }\n\n setOptions = (opts: VirtualizerOptions<TScrollElement, TItemElement>) => {\n // Skip `{...defaults, ...opts}` because explicit `undefined` values in\n // opts would override defaults with `undefined`.\n const merged = {\n debug: false,\n initialOffset: 0,\n overscan: 1,\n paddingStart: 0,\n paddingEnd: 0,\n scrollPaddingStart: 0,\n scrollPaddingEnd: 0,\n horizontal: false,\n getItemKey: defaultKeyExtractor,\n rangeExtractor: defaultRangeExtractor,\n onChange: () => {},\n measureElement,\n initialRect: { width: 0, height: 0 },\n scrollMargin: 0,\n gap: 0,\n indexAttribute: 'data-index',\n initialMeasurementsCache: [],\n lanes: 1,\n anchorTo: 'start',\n followOnAppend: false,\n scrollEndThreshold: 1,\n isScrollingResetDelay: 150,\n enabled: true,\n isRtl: false,\n useScrollendEvent: false,\n useAnimationFrameWithResizeObserver: false,\n laneAssignmentMode: 'estimate',\n useCachedMeasurements: false,\n } as unknown as Required<VirtualizerOptions<TScrollElement, TItemElement>>\n\n for (const key in opts) {\n const v: unknown = opts[key as keyof typeof opts]\n if (v !== undefined) Reflect.set(merged, key, v)\n }\n\n const prevOptions = this.options as\n Required<VirtualizerOptions<TScrollElement, TItemElement>> | undefined\n let anchor: [Key, number] | null = null\n let followOnAppend: ScrollBehavior | null = null\n let edgeKeysChanged = false\n\n if (\n prevOptions !== undefined &&\n prevOptions.enabled &&\n merged.enabled &&\n merged.anchorTo === 'end' &&\n this.scrollElement !== null\n ) {\n const prevCount = prevOptions.count\n const nextCount = merged.count\n const measurements = this.getMeasurements()\n const previousItems = this._singleLaneMeasurements?.items ?? measurements\n const getPreviousKey = (index: number) => getMeasurementKey(previousItems[index]!)\n const prevFirstKey = prevCount > 0 ? getPreviousKey(0) : null\n const prevLastKey = prevCount > 0 ? getPreviousKey(prevCount - 1) : null\n const didCountChange = nextCount !== prevCount\n const didEdgeKeysChange =\n didCountChange ||\n (prevCount > 0 &&\n nextCount > 0 &&\n (merged.getItemKey(0) !== prevFirstKey ||\n merged.getItemKey(nextCount - 1) !== prevLastKey))\n\n if (didEdgeKeysChange) {\n edgeKeysChanged = true\n const item =\n prevCount > 0\n ? (this.getVirtualItemForOffset(this.getScrollOffset()) ?? measurements[0])\n : null\n\n if (item) {\n anchor = [item.key, this.getScrollOffset() - item.start]\n }\n\n const behavior = merged.followOnAppend === true ? 'auto' : merged.followOnAppend || null\n\n if (\n behavior &&\n nextCount > 0 &&\n this.isAtEnd(prevOptions.scrollEndThreshold) &&\n (prevCount === 0 || merged.getItemKey(nextCount - 1) !== prevLastKey)\n ) {\n if (\n nextCount > prevCount ||\n isAppendWithTrim(prevCount, nextCount, getPreviousKey, merged.getItemKey)\n ) {\n followOnAppend = behavior\n }\n }\n }\n }\n\n this.options = merged\n\n // When edge keys changed (prepend, trim, reorder, etc.) the key→index\n // mapping has shifted. Force a full measurement rebuild so the anchor\n // resolution below reads positions from the new layout, not the stale\n // memoised cache. Without this, a stable `getItemKey` reference +\n // unchanged `count` would let getMeasurements() return the old layout.\n if (edgeKeysChanged) {\n this.pendingMin = 0\n this.itemSizeCacheVersion++\n }\n\n // Eagerly adjust scrollOffset so the virtualizer computes the correct\n // visible range during the current render pass — before _willUpdate\n // syncs the DOM scroll position in a layout effect. Without this,\n // the virtualizer would render the wrong items for one frame (the\n // estimate-based positions are stale) and then correct in the next\n // frame, producing a visible \"jump\" on prepend with dynamic sizes.\n // Not before a scroll command's write has been read back: `scrollOffset`\n // is still the pre-command position, so the anchor would be resolved\n // against rows that are no longer where the command put the element, and\n // the sync would write that stale offset over the command. Reconcile\n // retargets an index or end command from the new layout; an offset\n // command lands where it was written (#1307, step 5).\n let anchorDelta: number | null = null\n if (anchor && this.scrollOffset !== null && !this._awaitingCommandReadBack()) {\n const [anchorKey, anchorOffset] = anchor\n const newMeasurements = this.getMeasurements()\n const { count, getItemKey } = this.options\n let idx = 0\n while (idx < count && getItemKey(idx) !== anchorKey) {\n idx++\n }\n if (idx < count) {\n const anchorItem = newMeasurements[idx]\n if (anchorItem) {\n // Clamp to the reachable range's lower bound — anchorOffset may\n // have been derived from a transiently negative scrollOffset\n // (rubber-band), and a negative tracked offset never self-heals\n // when the element cannot scroll (#1229).\n const newOffset = Math.max(0, anchorItem.start + anchorOffset)\n // A no-op end scroll emits no event to correct a reading-anchor offset.\n if (!followOnAppend && newOffset !== this.scrollOffset) {\n anchorDelta = newOffset - this.scrollOffset\n this.scrollOffset = newOffset\n }\n }\n }\n }\n\n if (followOnAppend) {\n this.pendingScrollAnchor = { kind: 'follow', behavior: followOnAppend }\n } else if (anchorDelta !== null) {\n if (this._canWriteScroll()) {\n this.pendingScrollAnchor = { kind: 'anchor', delta: anchorDelta }\n } else {\n // The element cannot take the write (a touch owns it on iOS, it is\n // overscrolled, or wheel input runs in WebKit). Hold the delta\n // instead: this render already exposes the rows and the total\n // shifted back by it, so the reader's row stays put, and the flush\n // writes it once a write is possible.\n this._holdOffset += anchorDelta\n this._followAnchor(anchorDelta)\n }\n }\n }\n\n private notify = (sync: boolean) => {\n this.options.onChange?.(this, sync)\n }\n\n // Returns `true` when it performed a synchronous `scrollTop` write this\n // tick, `false` when the delta was zero or the write was deferred (iOS).\n // `resizeItem` uses that to decide whether the follow-up `notify` must be\n // synchronous so the grown transforms commit in the same paint (#1227).\n private applyScrollAdjustment(delta: number, behavior?: ScrollBehavior): boolean {\n if (delta === 0) return false\n\n if (DEV && this.options.debug) {\n console.info('correction', delta)\n }\n\n // The correction moves the content the viewport is on; an offset target\n // moves with it, or reconcile would wait for a position it can never see.\n this._followOffsetTarget(delta)\n\n if (!this._canWriteScroll()) {\n // Hold the correction: `scrollOffset` takes it as if written, the rows\n // are exposed shifted back by it. The notify must be synchronous like\n // a write's, so the shifted rows commit in the same paint as the\n // content change that caused the correction.\n this._holdOffset += delta\n if (this.scrollOffset !== null) this.scrollOffset += delta\n return true\n } else {\n const offset = this.getScrollOffset()\n this._clampedAdjustment = this._clampedBy(offset + delta)\n const write = this._scrollToOffset(offset, {\n adjustments: delta,\n behavior,\n })\n // Eagerly carry the intended target in `scrollOffset` so callers that\n // read it before the next scroll event — notably the next `resizeItem`\n // tick's `getVirtualDistanceFromEnd()` / `wasAtEnd` check — see the\n // post-adjustment position even when the DOM `scrollTop` write was\n // clamped because the consumer hasn't grown the sizer yet (`notify()`\n // runs after this in `resizeItem`). Same idea as the eager\n // `scrollOffset` adjustment for prepend in `setOptions` (#1176). A\n // `scrollToFn` that reports the write synchronously has already set\n // `scrollOffset` to the read-back (and cleared `pendingWrite`).\n if (this.scrollOffset !== null) {\n if (this.pendingWrite === write) this.scrollOffset += delta\n // Clamp only the lower bound: a negative offset is unreachable, and\n // on an unscrollable element (content fits the viewport) no scroll\n // event ever fires to correct it, permanently skewing\n // getDistanceFromEnd() and wedging the hold flush (#1229).\n // Upper-bound overflow stays untouched — it is transiently\n // legitimate mid-prepend while the consumer's sizer catches up.\n if (this.scrollOffset < 0) this.scrollOffset = 0\n }\n return true\n }\n }\n\n private maybeNotify = memo(\n () => {\n this.calculateRange()\n\n return [\n this.isScrolling,\n this.range ? this.range.startIndex : null,\n this.range ? this.range.endIndex : null,\n ]\n },\n isScrolling => {\n this.notify(isScrolling)\n },\n {\n key: DEV && 'maybeNotify',\n debug: () => this.options.debug,\n initialDeps: [\n this.isScrolling,\n this.range ? this.range.startIndex : null,\n this.range ? this.range.endIndex : null,\n ] as [boolean, number | null, number | null],\n },\n )\n\n private cleanup = () => {\n this.unsubs.filter(Boolean).forEach(d => d!())\n this.unsubs = []\n this.observer.disconnect()\n if (this.rafId != null && this.targetWindow) {\n this.targetWindow.cancelAnimationFrame(this.rafId)\n this.rafId = null\n }\n this.scrollState = null\n // The element is let go of: give it back its overflow now. A stop the\n // next element needs starts afresh.\n this._momentumStop?.restore()\n this._momentumStop = null\n // The debounce cancelled above is the only thing that writes `isScrolling`\n // back to false, so a cleanup inside the reset window would strand it, and\n // the direction derived from it, as true. That matters because `cleanup`\n // also runs when the scroll element changes or `enabled` goes false, where\n // the instance lives on.\n this.isScrolling = false\n this.scrollDirection = null\n // The iOS gesture/deferral state is scoped to the current scroll\n // element: the touch listeners that maintain it were just removed, and\n // an in-flight touch keeps targeting the old element (implicit touch\n // capture), so the new element never reports it. Carrying the state\n // over would replay a stale deferred delta on the new element's first\n // flush, and a cleanup that lands mid-touch or inside the post-touchend\n // grace window would strand the gesture (the listeners that end it were\n // just removed), deferring every adjustment on the new element until\n // its next touch cycle.\n this._holdOffset = 0\n if (this.targetWindow) {\n if (this._wheelTimer !== null) {\n this.targetWindow.clearTimeout(this._wheelTimer)\n }\n if (this._edgeFlushFrame !== null) {\n this.targetWindow.cancelAnimationFrame(this._edgeFlushFrame)\n }\n }\n this._wheelTimer = null\n this._edgeFlushFrame = null\n this._reportedOverscroll = false\n this._trailing = 0\n // (The gesture was ended with its listeners, in the unsubs above.)\n this._clampedAdjustment = null\n // A write to the old element will never be read back.\n this.pendingWrite = null\n this._ownWriteAt = null\n this.scrollElement = null\n this.targetWindow = null\n }\n\n _didMount = () => {\n return () => {\n this.cleanup()\n }\n }\n\n _willUpdate = () => {\n const scrollElement = this.options.enabled ? this.options.getScrollElement() : null\n\n if (this.scrollElement !== scrollElement) {\n this.cleanup()\n\n if (!scrollElement) {\n this.maybeNotify()\n return\n }\n\n this.scrollElement = scrollElement\n\n if (this.scrollElement && 'ownerDocument' in this.scrollElement) {\n this.targetWindow = this.scrollElement.ownerDocument.defaultView\n } else {\n this.targetWindow = this.scrollElement?.window ?? null\n }\n\n this.elementsCache.forEach(cached => {\n this.observer.observe(cached)\n })\n\n let observing = false\n this.unsubs.push(\n this.options.observeElementRect(this, rect => {\n this.scrollRect = rect\n this.maybeNotify()\n // A render inside a delivery can detach rows without a ref-null\n // callback (Solid never makes one). Drop them as the row observer\n // does. The first call is the initial read, not a delivery, and\n // rows that are not attached yet stay observed through it.\n if (observing) this.measureElement(null)\n }),\n )\n observing = true\n\n this.unsubs.push(\n this.options.observeElementOffset(this, (offset, isScrolling) => {\n offset = this._scrollScale()?.onScroll(offset) ?? offset\n // Past the top is never a resting position. Past the bottom is\n // judged only while scrolling: at rest the element has clamped,\n // and a stale sizer makes no bounce.\n const elementMax = isScrolling ? this._elementMaxScrollOffset() : null\n this._readTrailing(elementMax)\n const wasOverscrolled = this._reportedOverscroll\n this._reportedOverscroll = offset < 0 || (elementMax !== null && offset > elementMax + 1)\n const elementOffset = offset\n this._lastElementOffset = elementOffset\n // Everything below works in layout coordinates.\n offset = this._toLayoutOffset(offset)\n\n const kind = this._classifyScrollEvent(offset, isScrolling, elementMax)\n if (kind === 'spurious') return\n\n if (kind === 'readBack') {\n // Adopt the exact target over the browser's rounded value (see\n // `pendingWrite`).\n offset = this.pendingWrite!.target\n } else if (\n kind === 'clampedReadBack' &&\n this.scrollState?.index != null &&\n // Not `elementMax`: an adapter can report the read-back at rest.\n offset < this.getMaxScrollOffset() - 1.5\n ) {\n // Our write, clamped at a max the sizer has since grown back\n // from: reconcile writes the target again, even when the layout\n // came back to the same end.\n this.scrollState.lastTargetOffset = offset\n } else if (\n externalRetiresCommand({\n kind,\n offset,\n command: this.scrollState,\n target: () => this.getScrollStateTarget(this.scrollState!),\n })\n ) {\n this.scrollState = null\n }\n this.pendingWrite = null\n // Remember where our own write was reported. Its echo at rest\n // leaves that as it is; any other report clears it.\n if (kind === 'readBack' || kind === 'clampedReadBack' || kind === 'clampedEcho') {\n this._ownWriteAt = offset\n } else if (kind !== 'restEcho') {\n this._ownWriteAt = null\n }\n\n // A pending clamped compensation write (#1258) survives only its\n // own read-back, which the browser reports at the scroll max we\n // saw at write time. Anything else is a real gesture (or the write\n // landing after all), so drop it rather than yank the user later.\n // Not `kind !== 'clampedEcho'`: the classifier ranks `readBack` and\n // `clampedReadBack` first, and either can also sit at that max, so\n // the record must survive them too.\n if (\n this._clampedAdjustment !== null &&\n Math.abs(offset - this._clampedAdjustment.maxAtWrite) >= 1.5\n ) {\n this._clampedAdjustment = null\n }\n\n // If the offset hasn't moved, this is the echo of our own\n // adjustment write — `applyScrollAdjustment` already folded it\n // into `scrollOffset`. There's no direction to infer, so leave\n // it alone; a real gesture always moves the offset.\n const prevOffset = this.getScrollOffset()\n const prevDirection = this.scrollDirection\n this.scrollDirection = isScrolling\n ? prevOffset === offset\n ? this.scrollDirection\n : prevOffset < offset\n ? 'forward'\n : 'backward'\n : null\n this.scrollOffset = offset\n this.isScrolling = isScrolling\n\n // A finger that lands on a fling fires no touch events (#1307), so\n // while a command waits for the fling, the scroll events are all\n // that show the user taking over: the scroll turns back, or speeds\n // up (`flingSpedUp`). Momentum does neither inside the scroll\n // range; a bounce does both, so no part of one counts.\n const queued = this.scrollState\n if (queued?.phase === 'queued' && kind === 'external' && isScrolling) {\n if (wasOverscrolled || this._reportedOverscroll) {\n queued.samples = []\n } else {\n const t = this.now()\n queued.samples = [\n ...(queued.samples ?? []).filter(sample => t - sample.t <= 200),\n { t, offset: elementOffset },\n ]\n if (\n (prevDirection !== null && this.scrollDirection !== prevDirection) ||\n flingSpedUp(queued.samples)\n ) {\n this.scrollState = null\n }\n }\n }\n if (\n this._iosGesture.onScroll({\n isScrolling,\n ownReadBack: kind === 'readBack',\n moved: offset !== prevOffset,\n // Neither our write's read-back nor a frame of our smooth\n // animation: the user or a fling moved it.\n external:\n kind === 'external' &&\n this.scrollState?.phase !== 'smooth' &&\n this.scrollState?.phase !== 'smoothFinishing',\n }) &&\n // The user scrolls: a command still waiting for the tail is\n // theirs to override, like a written one would be.\n this.scrollState?.phase === 'queued'\n ) {\n this.scrollState = null\n }\n\n // A held correction is written once a write is possible.\n this._flushHoldIfReady(true)\n this._flushHoldAtTop()\n\n if (this.scrollState) {\n this.scheduleScrollReconcile()\n }\n this.maybeNotify()\n }),\n )\n\n // Touch event listeners (iOS-aware deferral).\n if ('addEventListener' in this.scrollElement) {\n const target = this.scrollElement as unknown as EventTarget\n this.unsubs.push(this._iosGesture.listen(target))\n if (isWebKit()) {\n const onWheel = () => {\n const win = this.targetWindow\n if (win === null) return\n if (this._wheelTimer !== null) win.clearTimeout(this._wheelTimer)\n this._wheelTimer = win.setTimeout(() => {\n this._wheelTimer = null\n this._flushHoldIfReady(true)\n this._retryClampedAdjustment()\n }, 150)\n // At the top the element stops moving, so no scroll event comes.\n this._flushHoldAtTop()\n }\n target.addEventListener('wheel', onWheel, addEventListenerOptions)\n this.unsubs.push(() => target.removeEventListener('wheel', onWheel))\n }\n }\n\n this._scrollToOffset(this.getScrollOffset())\n // The rect observer has notified already; reading what follows the\n // list can change the range again.\n this._readTrailing(this._elementMaxScrollOffset())\n this.maybeNotify()\n }\n\n // The consumer has committed the sizer.\n this._noteClampMax()\n\n const anchor = this.pendingScrollAnchor\n this.pendingScrollAnchor = null\n\n if (anchor && this.scrollElement && this.options.enabled) {\n if (anchor.kind === 'anchor') {\n // scrollOffset was eagerly adjusted in setOptions so the\n // virtualizer already computed the correct range during render.\n // Now sync the browser's actual scroll position to match.\n //\n // `setOptions` found the element writable; a scroll event between\n // it and this commit (a concurrent render) can have changed that.\n // Hold the delta after all and have the rows re-rendered shifted;\n // an update scheduled from a layout effect commits before paint.\n if (!this._canWriteScroll()) {\n this._holdOffset += anchor.delta\n this._followAnchor(anchor.delta)\n this.notify(false)\n } else if (\n isSmoothScroll(this.scrollState) &&\n !this._landedBeforeAnchor(this.scrollState, anchor.delta)\n ) {\n // A smooth programmatic scroll is still travelling. Writing scrollTop\n // here would cancel the browser's animation, and Chromium drops a\n // smooth request re-issued in the frame right after that cancel, so\n // the journey would be stranded. The target is index-based and\n // recomputes against the new layout in reconcileScroll, so let the\n // animation run; the next scroll event re-syncs the tracked offset.\n // A smooth scroll that has already landed (reconcile not yet\n // retired it) still gets the anchor sync.\n } else {\n this._followAnchor(anchor.delta)\n this._scrollToOffset(this.getScrollOffset())\n }\n } else {\n this.scrollToEnd({ behavior: anchor.behavior })\n }\n }\n\n // A hold whose cause has passed without a scroll event (the sizer caught\n // up with a position that read as overscrolled) is written here. An\n // update scheduled from a layout effect commits before paint, so the\n // notify need not be synchronous.\n this._flushHoldIfReady(false)\n // The consumer has committed the new total size by now, so a clamped\n // compensation write may have room (#1258).\n this._retryClampedAdjustment()\n }\n\n // Classify a scroll event (see `ScrollEventKind`) from the state as it was\n // before the event. `offset` is the reported position in layout\n // coordinates; `elementMax` is the element's own max, read only while\n // scrolling (null otherwise).\n private _classifyScrollEvent = (\n offset: number,\n isScrolling: boolean,\n elementMax: number | null,\n ) =>\n classifyScrollEvent({\n offset,\n isScrolling,\n elementMax,\n holdOffset: this._holdOffset,\n scrollOffset: this.scrollOffset,\n pendingWrite: this.pendingWrite,\n clampedMaxAtWrite: this._clampedAdjustment?.maxAtWrite ?? null,\n ownWriteAt: this._ownWriteAt,\n })\n\n // Re-issue a compensation write the browser clamped because the sizer had\n // not grown yet (#1258, #1266). Called after `notify` in `resizeItem`,\n // which covers consumers that size the container synchronously inside\n // `onChange` (direct DOM updates, flushSync renders — where no re-render\n // may follow at all), and from `_willUpdate` for consumers that size it\n // during an asynchronous render. Both the clamped read-back and the\n // absence of one leave `_clampedAdjustment` set, so timing does not matter.\n // While the element cannot take a write (`_canWriteScroll`) the record is\n // kept for the next opportunity, the latest being the tail closing.\n private _retryClampedAdjustment = () => {\n if (\n this._clampedAdjustment === null ||\n !this.scrollElement ||\n !this.options.enabled ||\n !this._canWriteScroll()\n ) {\n return\n }\n const { target, maxAtWrite } = this._clampedAdjustment\n const max = this.getMaxScrollOffset()\n if (max > maxAtWrite + 0.5) {\n // Still short (the sizer grew only partially): stay pending against\n // the new max so the next opportunity retries.\n this._clampedAdjustment = target > max + 0.5 ? { target, maxAtWrite: max } : null\n this._scrollToOffset(target)\n }\n }\n\n // Write the command that `_startScroll` left waiting for the momentum\n // tail, against the layout as it is now (rows measured during the fling\n // have moved an index target).\n private _writeAwaitingCommand = () => {\n const state = this.scrollState\n if (state === null || state.phase !== 'queued') return\n const { behavior } = state\n this.getMeasurements()\n const offset = this.getScrollStateTarget(state)\n state.lastTargetOffset = offset\n // The hold flushed just before can leave a clamp retry (#1258); it\n // would write its old target over this command.\n this._clampedAdjustment = null\n state.phase = initialScrollPhase(\n behavior,\n state.index != null && approxEqual(offset, this.getScrollOffset()),\n )\n this._scrollToOffset(offset, { behavior })\n this.scheduleScrollReconcile()\n }\n\n // The element's position as the offset observers report it, or null for a\n // scroll element that is neither an element nor a window.\n private _readElementOffset = (): number | null => {\n const offset = this._readRawElementOffset()\n if (offset === null) return null\n return this._scrollScale()?.toVirtual(offset) ?? offset\n }\n\n // Lattice (ADR 0003): the scaled scroll layer, with the sizes of this layout.\n private _scrollScale = (): ScaledScroll | undefined => {\n const scale = this.options.scrollScale\n if (scale) {\n scale.size = { ...scale.size, totalSize: this.getTotalSize(), viewportSize: this.getSize() }\n }\n return scale\n }\n\n private _readRawElementOffset = (): number | null => {\n const el = this.scrollElement as unknown as Partial<\n Element & Pick<Window, 'scrollX' | 'scrollY'>\n > | null\n if (el == null) return null\n const { horizontal, isRtl } = this.options\n if (typeof el.scrollTop === 'number') {\n return horizontal ? el.scrollLeft! * ((isRtl && -1) || 1) : el.scrollTop\n }\n if (typeof el.scrollY === 'number') {\n return horizontal ? el.scrollX! : el.scrollY\n }\n return null\n }\n\n // Whether a scrollTop write made now would reach the element and stay:\n // - not on iOS while a touch gesture owns the scroll (`IosGesture`): a\n // dragging finger ignores the write, momentum is cancelled by it on\n // iOS 26 and earlier and overrides it within a frame on 27 (#884,\n // #1307), so a correction is held through the tail on every version;\n // - not while the element is overscrolled past either edge (the\n // rubber-band bounce): WebKit discards the write and the bounce can\n // stall where it was (#1287);\n // - not in WebKit within 150ms of a wheel event: the write lands, but\n // WebKit then discards the distance of the next wheel event, and a list\n // of rows measured on the way up writes on most frames. In Playwright\n // WebKit 26.0 a wheel event per frame lost about a third of its\n // distance that way (#1398, #1400); a prepend's anchor write could be\n // undone whole. With the hold, Safari 26.5.2 itself lost nothing on\n // trackpad momentum and about 2.5% on a continuous mouse wheel, at the\n // writes at the top (#1400); without it only Playwright is measured.\n // A write that is unwanted for another reason (a travelling smooth scroll\n // owns the position) is a separate check at the call sites.\n private _canWriteScroll = () =>\n !(isIOSWebKit() && this._iosGesture.inMotion()) &&\n !this._reportedOverscroll &&\n this._wheelTimer === null\n\n // A hold shifts the rows and leaves the element where it is, so the\n // element reaches its top while the layout has `_holdOffset` further to\n // go (or, for a negative hold, the layout reaches the top first). Wheel\n // input that never pauses would park the reader there, so there the wheel\n // hold ends early and the hold is written, two frames later (a prepend's\n // anchor written at once can be undone, #1398). The next wheel event\n // starts the wheel hold again. Not before the top: while the element\n // still moves, WebKit applies the write about two frames after the rows\n // have gone back to layout coordinates, and they show `_holdOffset` away\n // for those frames (measured with a 1200px and a one-viewport margin in\n // Playwright WebKit 26.0; not seen in 27.2, #1400). The list's top is\n // `scrollMargin` down the element, where held rows would be drawn over\n // what is above the list; the element still moves there, so those frames\n // are the lesser evil. Past the top (a bounce) the write waits: the next\n // wheel or scroll event tries again.\n // The end needs none of this: the total size is exposed short by the\n // hold, so the element and the layout reach it together.\n private _holdAtTop = () => {\n if (this._holdOffset === 0) return false\n const offset = this._readElementOffset()\n // 1px for a fractional scrollTop.\n return (\n offset !== null && Math.min(offset, offset + this._holdOffset) < this.options.scrollMargin + 1\n )\n }\n private _flushHoldAtTop = () => {\n const win = this.targetWindow\n if (\n win === null ||\n this._wheelTimer === null ||\n this._edgeFlushFrame !== null ||\n !this._holdAtTop()\n ) {\n return\n }\n this._edgeFlushFrame = win.requestAnimationFrame(() => {\n this._edgeFlushFrame = win.requestAnimationFrame(() => {\n this._edgeFlushFrame = null\n // The reader can have turned back within the two frames.\n if (this._wheelTimer === null || !this._holdAtTop()) return\n win.clearTimeout(this._wheelTimer)\n this._wheelTimer = null\n this._flushHoldIfReady(true)\n this._retryClampedAdjustment()\n })\n })\n }\n\n // Write a held correction once a write is possible, from the scroll\n // handler, the touch tail timer, the wheel timer, the frame at the top\n // (`_flushHoldAtTop`), a command's start, `_willUpdate` and a resize\n // notify. The rows go back to layout coordinates and the total grows by\n // the hold in a notify issued before the write, so the sizer can take the\n // position and both commit in the paint the write lands in. `sync` is\n // false only where the caller already runs inside the consumer's commit\n // (`_willUpdate`), where an update it schedules commits before paint\n // anyway. A command's start passes true, although `_willUpdate` can reach\n // it too (a follow on append).\n private _flushHoldIfReady = (sync: boolean) => {\n if (this._holdOffset === 0) return\n if (!this.scrollElement || !this.options.enabled) return\n if (!this._canWriteScroll()) return\n // Let a travelling smooth scroll land first (see `_willUpdate`).\n if (this.scrollState?.phase === 'smooth') return\n this._holdOffset = 0\n // A held shrink can leave the layout position above the top; the\n // element clamps that to 0 without an event to say so (#1229).\n if (this.scrollOffset !== null && this.scrollOffset < 0) {\n this.scrollOffset = 0\n }\n this.notify(sync)\n // A command whose write has not been reported back yet owns the target:\n // `scrollOffset` is still the pre-command position until its read-back,\n // and a command that closes the touch tail makes a write possible with\n // no scroll event in between, so this flush can run first.\n const target = this.getCommandWrittenOffset() ?? this.getScrollOffset()\n // A consumer that sizes the container after this write gets the retry\n // (#1258).\n this._clampedAdjustment = this._clampedBy(target)\n this._scrollToOffset(target)\n }\n\n private rafId: number | null = null\n private scheduleScrollReconcile() {\n if (!this.targetWindow) {\n this.scrollState = null\n return\n }\n if (this.rafId != null) return\n this.rafId = this.targetWindow.requestAnimationFrame(() => {\n this.rafId = null\n this.reconcileScroll()\n })\n }\n private getScrollStateTarget(state: ScrollState) {\n const offsetInfo = state.toEnd\n ? ([Math.max(this.getMaxScrollOffset(), 0)] as const)\n : state.index != null\n ? this.getOffsetForIndex(state.index, state.align)\n : undefined\n return offsetInfo ? offsetInfo[0] : state.lastTargetOffset\n }\n private reconcileScroll() {\n if (!this.scrollState) return\n\n const el = this.scrollElement\n if (!el) return\n\n // Safety valve: bail out if reconciliation has been running too long\n const MAX_RECONCILE_MS = 5000\n if (this.now() - this.scrollState.startedAt > MAX_RECONCILE_MS) {\n this.scrollState = null\n return\n }\n\n // Nothing to reconcile until the tail closes and the command is written;\n // only the safety valve above applies.\n if (this.scrollState.phase === 'queued') {\n this.scheduleScrollReconcile()\n return\n }\n\n // A resize since the last render leaves measurementsCache stale until\n // something reads getMeasurements(); rebuild it (memoized) so an index\n // target reflects it even when no render ran in between.\n this.getMeasurements()\n const targetOffset = this.getScrollStateTarget(this.scrollState)\n\n // Index targets can still depend on cached sizes during the first rAF,\n // which runs before ResizeObserver delivers pending measurements. Wait\n // another frame (two when measurements are themselves deferred to rAF)\n // before retiring an index scroll. Absolute offsets don't need this wait.\n const STABLE_FRAMES =\n this.scrollState.index == null ? 1 : this.options.useAnimationFrameWithResizeObserver ? 3 : 2\n\n const targetChanged = targetOffset !== this.scrollState.lastTargetOffset\n\n if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {\n // At the target: a travelling smooth scroll has landed, and a\n // finishing one is now an instant scroll.\n if (this.scrollState.phase === 'smooth') {\n this.scrollState.phase = 'smoothLanded'\n } else if (this.scrollState.phase === 'smoothFinishing') {\n this.scrollState.phase = 'instant'\n }\n this.scrollState.stableFrames++\n if (this.scrollState.stableFrames >= STABLE_FRAMES) {\n // Final-pass exact landing. The reconcile-stable check uses a 1.01px\n // tolerance (approxEqual) so we don't fight subpixel browser rounding\n // during the converging phase. Once we're definitively settled,\n // commit the exact target so consumers calling scrollToIndex(N)\n // end up at the EXACT computed position of item N — matching\n // virtuoso's 0px landing accuracy rather than our prior 0.5-1px.\n if (this.getScrollOffset() !== targetOffset) {\n this._scrollToOffset(targetOffset, { behavior: 'auto' })\n }\n this.scrollState = null\n return\n }\n } else {\n this.scrollState.stableFrames = 0\n\n if (targetChanged) {\n // When the target moves during smooth scroll (because items came into\n // view and got measured, shifting positions), the original logic was\n // to immediately snap to 'auto' — visibly jarring on long\n // scroll-to-index calls. Now: keep smooth while we're still far\n // (more than a viewport) from the new target. Only fall back to\n // 'auto' for the final approach, so the user sees one continuous\n // motion that smoothly adjusts its endpoint as measurements arrive.\n const viewport = this.getSize() || 600\n const distance = Math.abs(targetOffset - this.getScrollOffset())\n const keepSmooth = isSmoothScroll(this.scrollState) && distance > viewport\n\n this.scrollState.lastTargetOffset = targetOffset\n if (keepSmooth) {\n // A smooth retarget travels again, so its intermediate scroll\n // events must not read as an external scroll away from the target.\n this.scrollState.phase = 'smooth'\n } else if (this.scrollState.phase === 'smooth') {\n // The final approach is instant, but the animation can still report.\n this.scrollState.phase = 'smoothFinishing'\n } else if (this.scrollState.phase === 'smoothLanded') {\n this.scrollState.phase = 'instant'\n }\n // 'smoothFinishing' stays as it is (its animation may still report)\n // until reconcile sees it at the target; 'instant' stays instant.\n\n this._scrollToOffset(targetOffset, {\n behavior: keepSmooth ? 'smooth' : 'auto',\n })\n }\n }\n\n // Always reschedule while scrollState is active to guarantee\n // the safety valve timeout runs even if no scroll events fire\n // (e.g. no-op scrollToFn, detached element)\n this.scheduleScrollReconcile()\n }\n\n private getSize = () => {\n if (!this.options.enabled) {\n this.scrollRect = null\n return 0\n }\n\n this.scrollRect = this.scrollRect ?? this.options.initialRect\n\n return this.scrollRect[this.options.horizontal ? 'width' : 'height']\n }\n\n private getScrollOffset = () => {\n if (!this.options.enabled) {\n this.scrollOffset = null\n return 0\n }\n\n this.scrollOffset =\n this.scrollOffset ??\n (typeof this.options.initialOffset === 'function'\n ? this.options.initialOffset(this)\n : this.options.initialOffset)\n\n return this.scrollOffset\n }\n\n private getMeasurementOptions = memo(\n () => [\n this.options.count,\n this.options.paddingStart,\n this.options.scrollMargin,\n this.options.getItemKey,\n this.options.enabled,\n this.options.lanes,\n this.options.laneAssignmentMode,\n this.options.gap,\n ],\n (count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode, gap) => {\n const lanesChanged = this.prevLanes !== undefined && this.prevLanes !== lanes\n\n if (lanesChanged) {\n // Set flag for getMeasurements to handle\n this.lanesChangedFlag = true\n }\n\n this.prevLanes = lanes\n this.pendingMin = null\n\n return {\n count,\n paddingStart,\n scrollMargin,\n getItemKey,\n enabled,\n lanes,\n laneAssignmentMode,\n gap,\n }\n },\n {\n key: false,\n },\n )\n\n private isIndexInRange = (index: number): boolean => index >= 0 && index < this.options.count\n\n private getMeasurements = memo(\n () => [this.getMeasurementOptions(), this.itemSizeCacheVersion],\n (measurementOptions, itemSizeCacheVersion) => {\n const {\n count,\n paddingStart,\n scrollMargin,\n getItemKey,\n enabled,\n lanes,\n laneAssignmentMode,\n gap,\n } = measurementOptions\n this.builtMeasurementOptions = measurementOptions\n this.builtItemSizeCacheVersion = itemSizeCacheVersion\n this.pendingResizes = []\n const itemSizeCache = this.itemSizeCache\n if (!enabled) {\n this.measurementsCache = []\n this._singleLaneMeasurements = null\n this.itemSizeCache.clear()\n this.laneAssignments.clear()\n this.initialMeasurementsCacheApplied = false\n return []\n }\n\n // Clean up stale lane cache entries when count decreases\n if (this.laneAssignments.size > count) {\n for (const index of this.laneAssignments.keys()) {\n if (index >= count) {\n this.laneAssignments.delete(index)\n }\n }\n }\n\n // ✅ Force complete recalculation when lanes change\n if (this.lanesChangedFlag) {\n this.lanesChangedFlag = false // Reset immediately\n this.lanesSettling = true // Start settling period\n this.measurementsCache = []\n this._singleLaneMeasurements = null\n this.itemSizeCache.clear()\n this.laneAssignments.clear() // Clear lane cache for new lane count\n // Force min = 0 on the rebuild\n this.pendingMin = null\n }\n\n // Don't restore from initialMeasurementsCache during lane changes\n // as it contains stale lane assignments from the previous lane count\n if (\n !this.initialMeasurementsCacheApplied &&\n this.measurementsCache.length === 0 &&\n !this.lanesSettling\n ) {\n this.initialMeasurementsCacheApplied = true\n this.measurementsCache = this.options.initialMeasurementsCache\n this.measurementsCache.forEach(item => {\n this.itemSizeCache.set(item.key, item.size)\n })\n }\n\n // During lanes settling, ignore pendingMin to prevent repositioning\n const min = this.lanesSettling ? 0 : (this.pendingMin ?? 0)\n this.pendingMin = null\n\n // ✅ End settling period when cache is fully built\n if (this.lanesSettling && this.measurementsCache.length === count) {\n this.lanesSettling = false\n }\n\n // ─── Fast path: single-lane lazy materialization ────────────────────\n // For lanes === 1 (the default and most common case), skip the\n // per-item VirtualItem object allocation. We write start/size pairs\n // into a Float64Array and return a Proxy that builds VirtualItem\n // objects on demand (only the indices a consumer actually reads).\n if (lanes === 1) {\n // Reuse flat backing if large enough; else grow (preserving data\n // before `min` to mirror the slice-and-rebuild contract).\n const need = count * 2\n let flat = this._singleLaneMeasurements?.flat\n if (!flat || flat.length < need) {\n const next = new Float64Array(need)\n if (flat && min > 0) next.set(flat.subarray(0, min * 2))\n flat = next\n }\n\n const items: Array<Key | VirtualItem> =\n min === 0 ? new Array(count) : this._singleLaneMeasurements!.items.slice()\n\n let runningStart: number\n if (min === 0) {\n runningStart = paddingStart + scrollMargin\n } else {\n // Continue from where we left off\n const prevIdx = min - 1\n runningStart = flat[prevIdx * 2]! + flat[prevIdx * 2 + 1]! + gap\n }\n\n for (let i = min; i < count; i++) {\n const key = getItemKey(i)\n items[i] = key\n const measuredSize = itemSizeCache.get(key)\n const size =\n typeof measuredSize === 'number' ? measuredSize : this.options.estimateSize(i)\n flat[i * 2] = runningStart\n flat[i * 2 + 1] = size\n runningStart += size + gap\n }\n\n this._singleLaneMeasurements = { flat, items }\n const view = createLazyMeasurementsView(items, flat)\n this.measurementsCache = view\n return view\n }\n\n const measurements = this.measurementsCache.slice(0, min)\n\n // ✅ Performance: Track last item index per lane for O(1) lookup\n const laneLastIndex: Array<number | undefined> = new Array(lanes).fill(undefined)\n // Running end position of each lane's last item, so the shortest lane\n // can be found with an O(lanes) argmin instead of the old backward walk\n // through `measurements` (getFurthestMeasurement). `filledLanes` tracks\n // how many lanes have at least one item, mirroring the previous\n // \"all lanes seen → shortest lane, else i % lanes\" branch.\n const laneEnds = new Float64Array(lanes)\n let filledLanes = 0\n\n // Initialize from existing measurements (before min)\n for (let m = 0; m < min; m++) {\n const item = measurements[m]\n if (item) {\n if (laneLastIndex[item.lane] === undefined) filledLanes++\n laneLastIndex[item.lane] = m\n laneEnds[item.lane] = item.end\n }\n }\n\n for (let i = min; i < count; i++) {\n const key = getItemKey(i)\n\n // Check for cached lane assignment\n const cachedLane = this.laneAssignments.get(i)\n let lane: number\n let start: number\n\n const shouldCacheLane = laneAssignmentMode === 'estimate' || itemSizeCache.has(key)\n\n if (cachedLane !== undefined && this.options.lanes > 1) {\n // Use cached lane - O(1) lookup for previous item in same lane\n lane = cachedLane\n const prevIndex = laneLastIndex[lane]\n const prevInLane = prevIndex !== undefined ? measurements[prevIndex] : undefined\n start = prevInLane ? prevInLane.end + gap : paddingStart + scrollMargin\n } else if (filledLanes === lanes) {\n // No cache, every lane seeded: place in the shortest lane.\n // Read the running per-lane ends (O(lanes) argmin) instead of the\n // old backward scan. Tie-break on the lane's last-item index to\n // preserve the previous sort-by-(end, index) placement exactly.\n let bestLane = 0\n let bestEnd = laneEnds[0]!\n let bestIdx = laneLastIndex[0]!\n for (let l = 1; l < lanes; l++) {\n const e = laneEnds[l]!\n if (e < bestEnd || (e === bestEnd && laneLastIndex[l]! < bestIdx)) {\n bestLane = l\n bestEnd = e\n bestIdx = laneLastIndex[l]!\n }\n }\n lane = bestLane\n start = bestEnd + gap\n\n if (shouldCacheLane) {\n this.laneAssignments.set(i, lane)\n }\n } else {\n // No cache and not every lane seeded yet — seed lanes in order,\n // matching the previous `i % lanes` fallback for the first row.\n lane = i % this.options.lanes\n start = paddingStart + scrollMargin\n\n if (shouldCacheLane) {\n this.laneAssignments.set(i, lane)\n }\n }\n\n const measuredSize = itemSizeCache.get(key)\n const size = typeof measuredSize === 'number' ? measuredSize : this.options.estimateSize(i)\n\n const end = start + size\n\n measurements[i] = {\n index: i,\n start,\n size,\n end,\n key,\n lane,\n }\n\n // ✅ Performance: Update lane's last item index + running end\n if (laneLastIndex[lane] === undefined) filledLanes++\n laneLastIndex[lane] = i\n laneEnds[lane] = end\n }\n\n this.measurementsCache = measurements\n\n return measurements\n },\n {\n key: DEV && 'getMeasurements',\n debug: () => this.options.debug,\n },\n )\n\n calculateRange = memo(\n () => [\n this.getMeasurements(),\n this.getSize(),\n this.getScrollOffset(),\n this.options.lanes,\n // scrollOffset is measured in the scroll element and the layout total\n // from the list start, so the list ends scrollMargin further down.\n this._getLayoutTotalSize() + this.options.scrollMargin,\n this._trailing,\n ],\n (measurements, outerSize, scrollOffset, lanes, listEnd, trailing) => {\n if (measurements.length === 0 || outerSize === 0) {\n this.range = null\n return null\n }\n // Until the element reports a clamped position (the list shrank, a\n // rubber-band bounce), the offset can sit past the last row, which\n // would leave only that row in the range. The element ends `trailing`\n // past the list where other content follows it, and an offset up to\n // there is where the element is.\n const maxScrollOffset = Math.max(listEnd + trailing - outerSize, 0)\n this.range = calculateRangeImpl(\n measurements,\n outerSize,\n Math.min(scrollOffset, maxScrollOffset),\n lanes,\n // Pass the typed array so binary search + forward-walk can read\n // start/end directly from Float64Array, skipping the Proxy traps.\n lanes === 1 && this._singleLaneMeasurements !== null\n ? this._singleLaneMeasurements.flat\n : null,\n )\n return this.range\n },\n {\n key: DEV && 'calculateRange',\n debug: () => this.options.debug,\n },\n )\n\n getVirtualIndexes = memo(\n () => {\n let startIndex: number | null = null\n let endIndex: number | null = null\n const range = this.calculateRange()\n if (range) {\n startIndex = range.startIndex\n endIndex = range.endIndex\n }\n this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex])\n return [\n this.options.rangeExtractor,\n this.options.overscan,\n this.options.count,\n startIndex,\n endIndex,\n this.options.lanes,\n ]\n },\n (rangeExtractor, overscan, count, startIndex, endIndex, lanes) => {\n return startIndex === null || endIndex === null\n ? []\n : rangeExtractor({\n startIndex,\n endIndex,\n overscan,\n count,\n lanes,\n })\n },\n {\n key: DEV && 'getVirtualIndexes',\n debug: () => this.options.debug,\n },\n )\n\n indexFromElement = (node: TItemElement) => {\n const attributeName = this.options.indexAttribute\n const indexStr = node.getAttribute(attributeName)\n\n if (!indexStr) {\n console.warn(`Missing attribute name '${attributeName}={index}' on measured element.`)\n return -1\n }\n\n return parseInt(indexStr, 10)\n }\n\n /**\n * Determines if an item at the given index should be measured during smooth scroll.\n * During smooth scroll, only items within a buffer range around the target are measured\n * to prevent items far from the target from pushing it away.\n */\n private shouldMeasureDuringScroll = (index: number): boolean => {\n // No scroll state or not smooth scroll - always allow measurements\n if (!isSmoothScroll(this.scrollState)) {\n return true\n }\n\n const scrollIndex =\n this.scrollState.index ??\n this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index\n\n if (scrollIndex !== undefined && this.range) {\n // Allow measurements within a buffer range around the scroll target\n const bufferSize = Math.max(\n this.options.overscan,\n Math.ceil((this.range.endIndex - this.range.startIndex) / 2),\n )\n const minIndex = Math.max(0, scrollIndex - bufferSize)\n const maxIndex = Math.min(this.options.count - 1, scrollIndex + bufferSize)\n return index >= minIndex && index <= maxIndex\n }\n\n return true\n }\n\n private dropDisconnected = () => {\n this.elementsCache.forEach((cached, key) => {\n if (!cached.isConnected) {\n this.observer.unobserve(cached)\n this.elementsCache.delete(key)\n }\n })\n }\n\n measureElement = (node: TItemElement | null) => {\n if (!node) {\n this.dropDisconnected()\n // A framework clears the ref before it detaches the element, so the row\n // that is unmounting is still connected here. A render in a microtask of\n // a ResizeObserver delivery (Vue does this) detaches it before the\n // browser gathers the next observations, and a detached row that is\n // still observed at that point makes the browser report a loop error.\n // Check again once the render is done.\n if (!this._dropQueued) {\n this._dropQueued = true\n queueMicrotask(() => {\n this._dropQueued = false\n this.dropDisconnected()\n })\n }\n return\n }\n\n const index = this.indexFromElement(node)\n if (!this.isIndexInRange(index)) return\n\n const key = this.options.getItemKey(index)\n const prevNode = this.elementsCache.get(key)\n\n if (prevNode !== node) {\n if (prevNode) {\n this.observer.unobserve(prevNode)\n }\n this.observer.observe(node)\n this.elementsCache.set(key, node)\n }\n\n // Sync-measure when idle (initial render) or during programmatic scrolling\n // (scrollToIndex/scrollToOffset) where reconcileScroll needs sizes in the same frame.\n // During normal user scrolling, skip sync measurement — the RO callback handles it async.\n // Skip nodes that aren't attached yet: they have no layout and would be\n // cached as 0. Vue calls function refs during patch, before the parent is\n // inserted. The node is observed above, so the RO reports its size once\n // it's connected.\n if (\n node.isConnected &&\n (!this.isScrolling || this.scrollState) &&\n this.shouldMeasureDuringScroll(index)\n ) {\n this.resizeItem(index, this.options.measureElement(node, undefined, this))\n }\n }\n\n private canShiftFromPendingResizes = (): boolean =>\n this.options.lanes === 1 &&\n this._singleLaneMeasurements !== null &&\n this.shouldAdjustScrollPositionOnItemSizeChange === undefined &&\n !this.lanesChangedFlag &&\n !this.lanesSettling &&\n this.getMeasurementOptions() === this.builtMeasurementOptions &&\n this.itemSizeCacheVersion === this.builtItemSizeCacheVersion + this.pendingResizes.length\n\n resizeItem = (index: number, size: number) => {\n if (!this.isIndexInRange(index)) return\n\n // Options can change before the next render rebuilds the measurements.\n // Use the current item position and estimate when deciding whether this\n // resize needs a scroll correction.\n if (this.getMeasurementOptions() !== this.builtMeasurementOptions) {\n this.getMeasurements()\n }\n\n // An earlier entry in this ResizeObserver batch moved `scrollOffset`.\n // Outside a batch its sync notify would have re-rendered and rebuilt the\n // caches read below; rebuild them here so the anchoring check compares\n // this item's current start, not a stale one, against the adjusted\n // offset (#1218). Without a scroll move, the caches are exactly as stale\n // as they were before batching, so skip the rebuild.\n let startShift = 0\n if (this._resizeBatch?.sync) {\n if (this.canShiftFromPendingResizes()) {\n for (const resize of this.pendingResizes) {\n if (resize.index < index) startShift += resize.delta\n }\n } else {\n this.getMeasurements()\n }\n }\n\n // Fast field reads. For lanes===1 we read raw start/size from the flat\n // typed array, avoiding a Proxy.get + VirtualItem allocation per call.\n // For lanes>1 we fall back to the cached VirtualItem array.\n let cachedSize: number\n let itemStart: number\n let key: Key\n const flat = this._singleLaneMeasurements?.flat\n if (this.options.lanes === 1 && flat != null) {\n key = this.options.getItemKey(index)\n itemStart = flat[index * 2]! + startShift\n cachedSize = flat[index * 2 + 1]!\n } else {\n const item = this.measurementsCache[index]\n if (!item) return\n key = item.key\n itemStart = item.start\n cachedSize = item.size\n }\n\n const itemSize = this.itemSizeCache.get(key) ?? cachedSize\n const delta = size - itemSize\n\n if (delta !== 0) {\n const wasAtEnd =\n this.options.anchorTo === 'end' &&\n !isSmoothScroll(this.scrollState) &&\n this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold\n const prevTotalSize = wasAtEnd ? this._getLayoutTotalSize() : 0\n // Default anchoring predicate (used unless the consumer supplies a\n // custom shouldAdjustScrollPositionOnItemSizeChange).\n const scrollOffset = this.getScrollOffset()\n const isFirstMeasure = !this.itemSizeCache.has(key)\n const defaultShouldAdjust = isFirstMeasure\n ? // First measurement: compensate any item whose top sits above the\n // fold — the estimate→actual delta must be corrected regardless of\n // scroll direction, since the whole estimated block was above it.\n itemStart < scrollOffset\n : // Re-measurement: only compensate an item that is ENTIRELY above the\n // fold. An item that merely *spans* the fold (top above, bottom\n // below — e.g. a streaming chat message growing at its bottom)\n // changes size *below* the anchor point, so shifting scrollTop by the\n // delta would drag the viewport downward on every growth (#1218).\n // Also skip during backward scroll to avoid the \"items jump while\n // scrolling up\" cascade.\n itemStart + itemSize <= scrollOffset && this.scrollDirection !== 'backward'\n const shouldAdjustScroll =\n !isSmoothScroll(this.scrollState) &&\n (this.shouldAdjustScrollPositionOnItemSizeChange !== undefined\n ? this.shouldAdjustScrollPositionOnItemSizeChange(\n // The callback expects a VirtualItem; build one lazily only\n // when the consumer actually supplied a custom predicate.\n this.measurementsCache[index] ?? {\n index,\n key,\n start: itemStart,\n size: cachedSize,\n end: itemStart + cachedSize,\n lane: 0,\n },\n delta,\n this,\n )\n : defaultShouldAdjust)\n\n if (this.pendingMin === null || index < this.pendingMin) {\n this.pendingMin = index\n }\n this.itemSizeCache.set(key, size)\n this.itemSizeCacheVersion++\n this.pendingResizes.push({ index, delta })\n\n // Before a command's read-back, an index or end target is retargeted\n // from fresh measurements by reconcileScroll next frame; an offset\n // target lands where it was written and the delta is not applied.\n let adjustedSync = false\n if (!this._awaitingCommandReadBack()) {\n if (wasAtEnd) {\n adjustedSync = this.applyScrollAdjustment(this._getLayoutTotalSize() - prevTotalSize)\n } else if (shouldAdjustScroll) {\n adjustedSync = this.applyScrollAdjustment(delta)\n }\n }\n\n // When we just moved `scrollTop` to compensate for an above-viewport\n // resize, the grown item transforms must commit in the SAME frame as\n // that write. `applyScrollAdjustment` writes `scrollTop` synchronously\n // inside this ResizeObserver callback, but an async `notify` schedules\n // the transform render for a later commit — so the browser can paint\n // one frame with the new `scrollTop` and the old positions, and the\n // viewport visibly jumps by `delta` before snapping back (#1227). A\n // synchronous notify flushes the render in this same callback, so both\n // land in one paint. When nothing moved (or the write was deferred on\n // iOS), keep the cheaper async notify.\n if (this._resizeBatch) {\n // Inside a ResizeObserver callback: notify once after every entry\n // is measured, synchronously if any of them moved `scrollTop`.\n this._resizeBatch.notify = true\n this._resizeBatch.sync ||= adjustedSync\n return\n }\n this.notify(adjustedSync)\n this._noteClampMax()\n // A consumer that grows the sizer synchronously inside `onChange`\n // (direct DOM updates) may never re-render when the range is\n // unchanged, so retry a clamped write here rather than only in\n // `_willUpdate` (#1266).\n this._flushHoldIfReady(true)\n this._retryClampedAdjustment()\n } else if (\n this.options.lanes > 1 &&\n !this.options.useCachedMeasurements &&\n !this.laneAssignments.has(index)\n ) {\n // Measured at its estimate, so no rebuild will cache its lane. A single\n // lane has none to cache, a size under useCachedMeasurements is not a\n // measurement, and a lane already cached (as always in 'estimate' mode)\n // must not change.\n const item = this.getMeasurements()[index]\n if (item) this.laneAssignments.set(index, item.lane)\n }\n }\n\n getVirtualItems = memo(\n () => [this.getVirtualIndexes(), this.getMeasurements(), this._holdOffset],\n (indexes, measurements, hold) => {\n const virtualItems: Array<VirtualItem> = []\n\n for (let k = 0, len = indexes.length; k < len; k++) {\n const i = indexes[k]!\n const measurement = measurements[i]!\n\n // A held correction is exposed as a shift of every row (see\n // `_holdOffset`); the layout itself is untouched.\n virtualItems.push(\n hold === 0\n ? measurement\n : {\n ...measurement,\n start: measurement.start - hold,\n end: measurement.end - hold,\n },\n )\n }\n\n return virtualItems\n },\n {\n key: DEV && 'getVirtualItems',\n debug: () => this.options.debug,\n },\n )\n\n getVirtualItemForOffset = (offset: number) => {\n const measurements = this.getMeasurements()\n if (measurements.length === 0) {\n return undefined\n }\n // Same fast-path as calculateRange: read start values directly from the\n // typed array during binary search to skip the Proxy.get materialization\n // per probe.\n const flat = this._singleLaneMeasurements?.flat\n const useFlat = this.options.lanes === 1 && flat != null\n const idx = findNearestBinarySearch(\n 0,\n measurements.length - 1,\n useFlat ? (i: number) => flat[i * 2]! : (i: number) => notUndefined(measurements[i]).start,\n offset,\n )\n return notUndefined(measurements[idx])\n }\n\n // Record the element's max, in layout coordinates, as one a command's\n // pending instant write may be clamped to (see `lowMaxes` on\n // `pendingWrite`). Called where the sizer can have been committed: after\n // a notify, for a consumer that sizes it in `onChange`, and in\n // `_willUpdate`. The element cannot clamp below its own 0, which is the\n // hold in layout coordinates.\n private _noteClampMax = () => {\n if (!this._awaitingCommandReadBack()) return\n const elementMax = this._elementMaxScrollOffset()\n if (elementMax === null) return\n const write = this.pendingWrite!\n const max = Math.max(elementMax, 0) + this._holdOffset\n if (max >= write.target) return\n const lowMaxes = (write.lowMaxes ??= [])\n if (lowMaxes[lowMaxes.length - 1] !== max) lowMaxes.push(max)\n }\n\n // The element's scroll range in layout coordinates: while a correction is\n // held the sizer is short by the hold, so the element's own max is too.\n private getMaxScrollOffset = () => (this._elementMaxScrollOffset() ?? 0) + this._holdOffset\n\n // An element position in layout coordinates: how far the layout position\n // is ahead of the element. The element is `_holdOffset` behind while a\n // correction is held, and a prepend's anchor delta behind from\n // `setOptions` (which moved `scrollOffset` by it) until `_willUpdate`\n // writes or holds it. Writes (`_scrollToOffset`) and the clamp record\n // (`_clampedBy`) deliberately subtract the hold alone, not this whole\n // lead: by the time they run, the anchor delta is already in\n // `scrollOffset`, and writing that layout position is what closes it.\n private _toLayoutOffset = (elementOffset: number) => {\n let offset = elementOffset + this._holdOffset\n if (this.pendingScrollAnchor?.kind === 'anchor') {\n offset += this.pendingScrollAnchor.delta\n }\n return offset\n }\n\n private _readTrailing = (elementMax: number | null) => {\n if (elementMax === null) return\n const trailing = elementMax + this.getSize() - this._drawnListEnd\n this._trailing = trailing > 0 ? trailing : 0\n }\n\n // The element's own scroll range, or null where it cannot be read (no\n // element, or a bare test double without `scrollHeight` / `document`).\n private _elementMaxScrollOffset = (): number | null => {\n const max = this._readRawElementMax()\n if (max === null) return null\n const scale = this._scrollScale()\n return scale ? toVirtualOffset(max, scale.size) : max\n }\n\n private _readRawElementMax = (): number | null => {\n const el = this.scrollElement\n if (el === null) return null\n if ('scrollHeight' in el) {\n return this.options.horizontal\n ? el.scrollWidth - el.clientWidth\n : el.scrollHeight - el.clientHeight\n }\n if ('document' in el) {\n const doc = el.document.documentElement\n return this.options.horizontal\n ? doc.scrollWidth - el.innerWidth\n : doc.scrollHeight - el.innerHeight\n }\n return null\n }\n\n // Stop a running fling, then call `done`: the momentum does not survive\n // the element losing its overflow for a frame. Hidden and restored within\n // one task, iOS never sees the change and the fling carries on (27.0.1\n // iPhone); hidden for two frames, it stops at once, there and in Chrome on\n // Android. Nothing moves on screen. A second call while one is in progress\n // waits for the same frames. The app's inline value comes back, unless the\n // app set a new one meanwhile; `done` is then not called.\n private _momentumStop: { restore: () => boolean; done: () => void } | null = null\n private _stopMomentum = (done: () => void) => {\n const el = this.scrollElement\n const win = this.targetWindow\n if (el === null || win === null) return\n const scroller = ('document' in el ? el.document.scrollingElement : el) as HTMLElement | null\n // A test double may have no style to change.\n if (!scroller?.style) return\n if (this._momentumStop) {\n this._momentumStop.done = done\n return\n }\n const { style } = scroller\n const property = this.options.horizontal ? 'overflow-x' : 'overflow-y'\n const value = style.getPropertyValue(property)\n const priority = style.getPropertyPriority(property)\n const crossSize = () => (this.options.horizontal ? scroller.clientHeight : scroller.clientWidth)\n const crossSizeBefore = crossSize()\n style.setProperty(property, 'hidden', 'important')\n // A classic scrollbar takes layout space, so hiding it would reflow the\n // content for two frames (a touchscreen laptop). Put it back before\n // anything paints and leave the command to the tail, as without a style.\n if (crossSize() !== crossSizeBefore) {\n style.setProperty(property, value, priority)\n return\n }\n const stop = {\n // False when the app replaced the hidden value: the fling may not\n // have stopped.\n restore: () => {\n if (\n style.getPropertyValue(property) !== 'hidden' ||\n style.getPropertyPriority(property) !== 'important'\n ) {\n return false\n }\n style.setProperty(property, value, priority)\n return true\n },\n done,\n }\n this._momentumStop = stop\n win.requestAnimationFrame(() =>\n win.requestAnimationFrame(() => {\n // Already restored by `cleanup`, which also drops its command.\n if (this._momentumStop !== stop) return\n this._momentumStop = null\n // The command waits for the tail, as without the stop.\n if (stop.restore()) stop.done()\n }),\n )\n }\n\n // A compensation write past the element's current max (the sizer has not\n // grown yet) is clamped by the browser; record it for the retry (#1258).\n private _clampedBy = (target: number) => {\n const elementMax = this._elementMaxScrollOffset()\n if (elementMax === null) return null\n const maxAtWrite = elementMax + this._holdOffset\n return target > maxAtWrite + 0.5 ? { target, maxAtWrite } : null\n }\n\n private getVirtualDistanceFromEnd = () => {\n // `_getLayoutTotalSize()` measures the sizer, which starts `scrollMargin`\n // into the scroll content, while `getScrollOffset()` is measured from the\n // top of that content. Lift the total into the element's space before\n // subtracting, or the viewport reads `scrollMargin` px closer to the end\n // than it is and `getDistanceFromEnd()` disagrees by that much.\n return Math.max(\n this._getLayoutTotalSize() +\n this.options.scrollMargin -\n this.getSize() -\n this.getScrollOffset(),\n 0,\n )\n }\n\n getDistanceFromEnd = () => {\n return Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0)\n }\n\n isAtEnd = (threshold = this.options.scrollEndThreshold) => {\n return this.getDistanceFromEnd() <= threshold\n }\n\n getOffsetForAlignment = (toOffset: number, align: ScrollAlignment, itemSize = 0) => {\n if (!this.scrollElement) return 0\n\n const size = this.getSize()\n const scrollOffset = this.getScrollOffset()\n\n if (align === 'auto') {\n align = toOffset >= scrollOffset + size ? 'end' : 'start'\n }\n\n if (align === 'center') {\n // When aligning to a particular item (e.g. with scrollToIndex),\n // adjust offset by the size of the item to center on the item\n toOffset += (itemSize - size) / 2\n } else if (align === 'end') {\n toOffset -= size\n }\n\n const maxOffset = this.getMaxScrollOffset()\n\n return Math.max(Math.min(maxOffset, toOffset), 0)\n }\n\n getOffsetForIndex = (index: number, align: ScrollAlignment = 'auto') => {\n index = Math.max(0, Math.min(index, this.options.count - 1))\n\n const size = this.getSize()\n const scrollOffset = this.getScrollOffset()\n\n // Not `measurementsCache`: that field is only rebuilt by getMeasurements,\n // so it lags a size change until the next render reads the items.\n const item = this.getMeasurements()[index]\n if (!item) return\n\n if (align === 'auto') {\n if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {\n align = 'end'\n } else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {\n align = 'start'\n } else {\n return [scrollOffset, align] as const\n }\n }\n\n // For the last item with 'end' alignment, use browser's actual max scroll\n // to account for borders/padding that aren't in our measurements (#1001),\n // but swap paddingEnd for scrollPaddingEnd so the last item lands where\n // any other end-aligned item would instead of overshooting past it (#1257).\n if (align === 'end' && index === this.options.count - 1) {\n const maxOffset = this.getMaxScrollOffset()\n const toOffset = maxOffset - this.options.paddingEnd + this.options.scrollPaddingEnd\n return [Math.max(Math.min(toOffset, maxOffset), 0), align] as const\n }\n\n const toOffset =\n align === 'end'\n ? item.end + this.options.scrollPaddingEnd\n : item.start - this.options.scrollPaddingStart\n\n return [this.getOffsetForAlignment(toOffset, align, item.size), align] as const\n }\n\n scrollToOffset = (\n toOffset: number,\n { align = 'start', behavior = 'auto' }: ScrollToOffsetOptions = {},\n ) => {\n this._startScroll(\n { index: null, align },\n this.getOffsetForAlignment(toOffset, align),\n behavior,\n 'absolute',\n )\n }\n\n scrollToIndex = (\n index: number,\n { align: initialAlign = 'auto', behavior = 'auto' }: ScrollToIndexOptions = {},\n ) => {\n index = Math.max(0, Math.min(index, this.options.count - 1))\n\n const offsetInfo = this.getOffsetForIndex(index, initialAlign)\n // No target (an empty list), so nothing is written.\n if (!offsetInfo) return\n const [offset, align] = offsetInfo\n\n this._startScroll({ index, align }, offset, behavior, 'absolute')\n }\n\n scrollBy = (delta: number, { behavior = 'auto' }: ScrollToOffsetOptions = {}) => {\n // Build on a position we just wrote even before its scroll event arrives.\n // Clamp: a write past either edge that leaves the element where it was\n // fires no scroll event, so nothing would clear an unreachable offset.\n const offset = this.getOffsetForAlignment(\n (this.getCommandWrittenOffset() ?? this.getScrollOffset()) + delta,\n 'start',\n )\n\n this._startScroll({ index: null, align: 'start' }, offset, behavior, 'relative')\n }\n\n scrollToEnd = ({ behavior = 'auto' }: ScrollToEndOptions = {}) => {\n if (this.options.count > 0) {\n // Target the browser's max scroll rather than the last item's end-align\n // offset, so paddingEnd is included and isAtEnd() holds afterwards.\n this._startScroll(\n { index: this.options.count - 1, align: 'end', toEnd: true },\n Math.max(this.getMaxScrollOffset(), 0),\n behavior,\n 'absolute',\n )\n return\n }\n\n this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), {\n behavior,\n })\n }\n\n // Every scroll command starts here: it becomes the in-flight command,\n // writes its first target and leaves reconcile to retarget and retire it.\n //\n // Targets are layout offsets. A correction held for the wheel is written\n // before the command (below). One held for a touch or a bounce is not\n // dropped by a command: the write lands the element `_holdOffset` short\n // of the target, under the rows exposed shifted by the same amount, and\n // the flush moves both together once a write is possible. Unless the\n // target is less than the hold (below).\n //\n // An index or end target that is already at its offset starts a smooth\n // scroll as landed; an offset target never does, so its first scroll\n // event is read as the user's (see the scroll handler in `_willUpdate`).\n private _startScroll(\n target: Pick<ScrollState, 'index' | 'align' | 'toEnd'>,\n offset: number,\n behavior: ScrollBehavior,\n kind: 'absolute' | 'relative',\n ) {\n // The command takes over from the wheel: end the wheel hold and write\n // what it held first. The command is written `_holdOffset` short of its\n // target, so under a hold larger than the target the element clamps at\n // 0, the command never sees its target and the flush after it writes\n // the old position. The command this one replaces must not keep the\n // hold back (`_flushHoldIfReady` waits for a smooth one).\n if (this._wheelTimer !== null && this.targetWindow) {\n this.targetWindow.clearTimeout(this._wheelTimer)\n this._wheelTimer = null\n this.scrollState = null\n this._flushHoldIfReady(true)\n }\n // A new explicit command supersedes layout-driven work queued before it.\n // Clear both before any iOS deferral so a later commit/retry cannot\n // overwrite the user's newer scroll intent.\n this.pendingScrollAnchor = null\n this._clampedAdjustment = null\n\n const tail = this._iosGesture.tail()\n if (kind === 'absolute' && tail !== null) {\n if (tail === 'fling' && momentumOverridesWrites()) {\n // A write now would not end the fling: on iOS 27 it shows for one\n // frame and the fling carries on along its own path (#1307, step 3);\n // in Chrome on Android the fling carries on from the written\n // position. The command would be lost or overshot. Stop the fling\n // and write two frames later. Otherwise (no style to change, a\n // classic scrollbar, a finger down, a bounce) the tail stays open and\n // the command is written when it closes, ~150ms after the last\n // fling frame. The user taking over before the write (a drag, a\n // second flick, a finger stopping the fling) cancels the command\n // (see the scroll handler and `onTailClosed`). A relative command\n // (`scrollBy`) is not postponed: its target is taken from the\n // position at the call, which the fling leaves behind either way.\n this._stopMomentum(() => {\n const state = this.scrollState\n if (\n state?.phase !== 'queued' ||\n // A finger came down: it owns the scroll until it lifts.\n this._iosGesture.tail() !== 'fling' ||\n // In a bounce WebKit can drop the write (#1287): the tail\n // decides, as without the stop. (Not `flingCaught`: our stop\n // also ends the fling at speed, so a slow frame would read as\n // a catch and the tail would drop the command.)\n this._reportedOverscroll\n ) {\n return\n }\n this._iosGesture.end()\n this._flushHoldIfReady(true)\n this._writeAwaitingCommand()\n })\n this.scrollState = {\n ...target,\n startedAt: this.now(),\n lastTargetOffset: offset,\n stableFrames: 0,\n phase: 'queued',\n behavior,\n samples: [],\n }\n this.scheduleScrollReconcile()\n return\n }\n // The command takes over the scroll, so close the tail: the landing's\n // corrections then apply before paint, even for a command issued from\n // a tap handler inside the tail (#1250). On iOS 26 and earlier the\n // write stops the momentum. With a finger down the user owns the\n // scroll: leave it.\n this._iosGesture.end()\n }\n // A target less than the hold is out of the element's reach: written\n // the hold short, the write clamps at the element's 0, and the read-back\n // looks like a scroll away from the target (#1405). Write the hold first\n // where a write is possible now (the command has closed a tap's tail),\n // as for the wheel above. Its clamp retry would write over the command.\n // The target was clamped to a max that included the hold; a consumer\n // that commits the sizer after the notify leaves the element its old\n // max, so clamp it again, as for a command issued now. Reconcile\n // retargets an index or end target once the sizer grows.\n if (offset < this._holdOffset && this._canWriteScroll()) {\n this.scrollState = null\n this._flushHoldIfReady(true)\n this._clampedAdjustment = null\n offset = Math.min(offset, Math.max(this.getMaxScrollOffset(), 0))\n }\n this.scrollState = {\n ...target,\n startedAt: this.now(),\n lastTargetOffset: offset,\n stableFrames: 0,\n behavior,\n phase: initialScrollPhase(\n behavior,\n target.index != null && approxEqual(offset, this.getScrollOffset()),\n ),\n }\n this._scrollToOffset(offset, { behavior })\n this.scheduleScrollReconcile()\n }\n\n // Drops the target of an in-flight scrollToIndex / scrollToOffset /\n // scrollBy / scrollToEnd so a user gesture can take over the viewport.\n // The scroll position is left untouched: writing it would stop iOS\n // momentum, and a real gesture already interrupts a native smooth scroll.\n cancelScroll = () => {\n if (this.rafId != null && this.targetWindow) {\n this.targetWindow.cancelAnimationFrame(this.rafId)\n this.rafId = null\n }\n this.scrollState = null\n }\n\n // The size the consumer gives the container: the layout's total, short by\n // a held correction so the rows exposed shifted by it still fill it (see\n // `_holdOffset`).\n getTotalSize = () => {\n const total = Math.max(this._getLayoutTotalSize() - this._holdOffset, 0)\n this._drawnListEnd = total + this.options.scrollMargin\n return total\n }\n\n private _getLayoutTotalSize = () => {\n const measurements = this.getMeasurements()\n\n let end: number\n // If there are no measurements, include the scroll origin and start padding\n // If there is only one lane, use the last measurement's end\n // Otherwise find the maximum end value among all measurements\n if (measurements.length === 0) {\n end = this.options.scrollMargin + this.options.paddingStart\n } else if (this.options.lanes === 1) {\n // Fast path: read last item's end directly from the flat typed array\n // when available; avoids a Proxy.get + VirtualItem materialization\n // just to call getTotalSize (which React renders trigger every commit).\n const lastIdx = measurements.length - 1\n const flat = this._singleLaneMeasurements?.flat\n if (flat != null) {\n end = flat[lastIdx * 2]! + flat[lastIdx * 2 + 1]!\n } else {\n end = measurements[lastIdx]?.end ?? 0\n }\n } else {\n const endByLane = Array<number | null>(this.options.lanes).fill(null)\n let endIndex = measurements.length - 1\n while (endIndex >= 0 && endByLane.some(val => val === null)) {\n const item = measurements[endIndex]!\n if (endByLane[item.lane] === null) {\n endByLane[item.lane] = item.end\n }\n\n endIndex--\n }\n\n end = Math.max(...endByLane.filter((val): val is number => val !== null))\n }\n\n return Math.max(end - this.options.scrollMargin + this.options.paddingEnd, 0)\n }\n\n /**\n * Returns a snapshot of currently-measured items suitable for round-\n * tripping through state storage (sessionStorage, history, etc.) and\n * passing back as `initialMeasurementsCache` on remount. Pair with the\n * current `scrollOffset` to restore exact scroll position after navigation.\n *\n * Only items the consumer has actually rendered (and thus measured) appear\n * in the snapshot; unmeasured items will fall back to `estimateSize` on\n * restore. Returns an empty array if no items have been measured.\n */\n takeSnapshot = (): Array<VirtualItem> => {\n const snapshot: Array<VirtualItem> = []\n if (this.itemSizeCache.size === 0) return snapshot\n // Iterate measurementsCache only for indices whose key is in itemSizeCache\n // (i.e., have been measured). We build VirtualItem objects with the\n // current start/size/end so they can be persisted as plain data.\n const m = this.getMeasurements()\n for (const item of m) {\n if (item && this.itemSizeCache.has(item.key)) {\n // Force materialization (lazy path) and copy plain fields.\n snapshot.push({\n index: item.index,\n key: item.key,\n start: item.start,\n size: item.size,\n end: item.end,\n lane: item.lane,\n })\n }\n }\n return snapshot\n }\n\n private _scrollToOffset = (\n offset: number,\n { adjustments, behavior }: { adjustments?: number; behavior?: ScrollBehavior } = {},\n ) => {\n const write = {\n target: offset + (adjustments ?? 0),\n smooth: behavior === 'smooth',\n }\n this.pendingWrite = write\n // The element sits `_holdOffset` behind the layout while a correction\n // is held; `target` and the read-back stay in layout coordinates.\n const scale = this._scrollScale()\n if (scale) {\n // Lattice (ADR 0003): write the real offset of the virtual target.\n const real = scale.scrollTo(offset - this._holdOffset + (adjustments ?? 0))\n this.options.scrollToFn(real, { behavior }, this)\n } else {\n this.options.scrollToFn(offset - this._holdOffset, { behavior, adjustments }, this)\n }\n return write\n }\n\n // Where the in-flight command's last instant write put the element, until\n // its scroll event arrives; the rows on screen are still the ones rendered\n // for the old `scrollOffset`. Null after a smooth write (the element is\n // somewhere on the way) and without a command, so a write the browser\n // ignored (no read-back) does not outlive its command.\n private getCommandWrittenOffset = () =>\n this.scrollState !== null && this.pendingWrite !== null && !this.pendingWrite.smooth\n ? this.pendingWrite.target\n : null\n\n // A scroll command (or reconcile) wrote a new position that neither a\n // scroll event nor an eager update has reflected in `scrollOffset` yet.\n // The rows on screen were rendered for the old position, so \"above the\n // viewport\" means nothing against either offset: a correction decided now\n // would be written over the command. Compensation writes and the prepend\n // anchor sync update `scrollOffset` eagerly, and the hold's flush writes\n // exactly `scrollOffset`, so none of them count. Under a dragging finger\n // iOS ignores the write, so no read-back will come and the hold takes the\n // correction instead.\n private _awaitingCommandReadBack = () => {\n const writtenOffset = this.getCommandWrittenOffset()\n return (\n !(isIOSWebKit() && this._iosGesture.dragging()) &&\n writtenOffset !== null &&\n !approxEqual(writtenOffset, this.getScrollOffset())\n )\n }\n\n // An offset target (scrollToOffset, scrollBy) is a layout position. A\n // correction for content above the viewport moves the viewport's layout\n // position by `delta`, and the target moves with it, so reconcile sees the\n // command reached rather than waiting for a position it can never see\n // (#1307, step 5). Index and end targets are recomputed from the layout.\n private _followOffsetTarget = (delta: number) => {\n if (this.scrollState !== null && this.scrollState.index == null) {\n this.scrollState.lastTargetOffset += delta\n }\n }\n\n // Whether a command had landed where a prepend's anchor (`delta`, already\n // in `getScrollOffset()`) found the viewport: it has written (a `queued`\n // command has not, wherever the fling is), and reconcile has seen it at\n // its target or the viewport is where it last wrote. A correction since\n // then can have moved the viewport and the target together.\n private _landedBeforeAnchor = (state: ScrollState, delta: number) =>\n state.phase !== 'queued' &&\n (state.stableFrames > 0 || approxEqual(this.getScrollOffset() - delta, state.lastTargetOffset))\n\n // A prepend's anchor moves the viewport with the rows it shows. An offset\n // target moves with it. An index command that had landed is done: the\n // reader stays on the rows it was aimed at, and its index now names\n // others. An end target is still the end.\n private _followAnchor = (delta: number) => {\n this._followOffsetTarget(delta)\n const state = this.scrollState\n if (state?.index != null && !state.toEnd && this._landedBeforeAnchor(state, delta)) {\n this.scrollState = null\n }\n }\n\n measure = () => {\n // Reset pendingMin so the next getMeasurements rebuilds from index 0.\n // Without this, a prior resizeItem() that left pendingMin > 0 would\n // cause the rebuild to preserve stale items before that index.\n this.pendingMin = null\n this.itemSizeCache.clear()\n this.laneAssignments.clear() // Clear lane cache for full re-layout\n this.itemSizeCacheVersion++\n this.notify(false)\n }\n}\n\nconst findNearestBinarySearch = (\n low: number,\n high: number,\n getCurrentValue: (i: number) => number,\n value: number,\n) => {\n while (low <= high) {\n const middle = ((low + high) / 2) | 0\n const currentValue = getCurrentValue(middle)\n\n if (currentValue < value) {\n low = middle + 1\n } else if (currentValue > value) {\n high = middle - 1\n } else {\n return middle\n }\n }\n\n if (low > 0) {\n return low - 1\n } else {\n return 0\n }\n}\n\n// Monomorphic Float64Array variant — reads start values directly at stride\n// 2 instead of through a getter closure. JITs the inner load to a typed-\n// array bounds-check + load with no indirect call.\nfunction findNearestBinarySearchFlat(flat: Float64Array, high: number, value: number) {\n let low = 0\n while (low <= high) {\n const middle = ((low + high) / 2) | 0\n const currentValue = flat[middle * 2]!\n\n if (currentValue < value) {\n low = middle + 1\n } else if (currentValue > value) {\n high = middle - 1\n } else {\n return middle\n }\n }\n return low > 0 ? low - 1 : 0\n}\n\nfunction calculateRangeImpl(\n measurements: Array<VirtualItem>,\n outerSize: number,\n scrollOffset: number,\n lanes: number,\n flat: Float64Array | null,\n) {\n const lastIndex = measurements.length - 1\n\n // handle case when item count is less than or equal to lanes\n if (measurements.length <= lanes) {\n return { startIndex: 0, endIndex: lastIndex }\n }\n\n if (lanes === 1 && flat !== null) {\n // Hot single-lane path: typed-array reads, no closures, no Proxy traps.\n const startIndex = findNearestBinarySearchFlat(flat, lastIndex, scrollOffset)\n let endIndex = startIndex\n const limit = scrollOffset + outerSize\n while (endIndex < lastIndex && flat[endIndex * 2]! + flat[endIndex * 2 + 1]! < limit) {\n endIndex++\n }\n return { startIndex, endIndex }\n }\n\n // Fallback (lanes > 1 or no flat array): closure-based reads.\n const getStart = (index: number) => measurements[index]!.start\n let startIndex = findNearestBinarySearch(0, lastIndex, getStart, scrollOffset)\n let endIndex = startIndex\n\n if (lanes === 1) {\n while (endIndex < lastIndex && measurements[endIndex]!.end < scrollOffset + outerSize) {\n endIndex++\n }\n } else if (lanes > 1) {\n // Expand forward until we include the visible items from all lanes\n // which are closer to the end of the virtualizer window\n const endPerLane = Array(lanes).fill(0)\n while (endIndex < lastIndex && endPerLane.some(pos => pos < scrollOffset + outerSize)) {\n const item = measurements[endIndex]!\n endPerLane[item.lane] = item.end\n endIndex++\n }\n\n // Expand backward until we include all lanes' visible items\n // closer to the top\n const startPerLane = Array(lanes).fill(scrollOffset + outerSize)\n while (startIndex >= 0 && startPerLane.some(pos => pos >= scrollOffset)) {\n const item = measurements[startIndex]!\n startPerLane[item.lane] = item.start\n startIndex--\n }\n\n // Align startIndex to the beginning of its lane\n startIndex = Math.max(0, startIndex - (startIndex % lanes))\n // Align endIndex to the end of its lane\n endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - (endIndex % lanes)))\n }\n\n return { startIndex, endIndex }\n}\n","import { consumeTag, createTag, dirtyTag } from '@glimmer/validator'\nimport {\n Virtualizer,\n elementScroll,\n observeElementOffset,\n observeElementRect,\n} from '../core/index.ts'\nimport type { PartialKeys, VirtualItem, VirtualizerOptions } from '../core/index.ts'\n\n/** The options of `VirtualizerState`. The scroll element comes from `attach`, not an option. */\nexport type VirtualizerStateOptions<TItemElement extends Element = Element> = PartialKeys<\n Omit<VirtualizerOptions<HTMLElement, TItemElement>, 'getScrollElement'>,\n 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'\n>\n\n/**\n * A `Virtualizer` for Glimmer. Each `onChange` of the virtualizer dirties a Glimmer tag, so a\n * template that reads `virtualItems` or `totalSize` renders again when the range changes.\n */\nexport class VirtualizerState<TItemElement extends Element = Element> {\n // One raw Glimmer tag, as the engine atoms use (ADR 0001): a read consumes it, a change dirties it.\n private _tag = createTag()\n readonly virtualizer: Virtualizer<HTMLElement, TItemElement>\n private _element: HTMLElement | null = null\n\n constructor(options: VirtualizerStateOptions<TItemElement>) {\n this.virtualizer = new Virtualizer(this._resolve(options))\n }\n\n get virtualItems(): Array<VirtualItem> {\n consumeTag(this._tag)\n return this.virtualizer.getVirtualItems()\n }\n\n get totalSize(): number {\n consumeTag(this._tag)\n return this.virtualizer.getTotalSize()\n }\n\n setOptions(options: VirtualizerStateOptions<TItemElement>): void {\n this.virtualizer.setOptions(this._resolve(options))\n this.virtualizer._willUpdate()\n dirtyTag(this._tag)\n }\n\n /** Attach the scroll element. The returned function detaches it. */\n attach(element: HTMLElement): () => void {\n this._element = element\n const cleanup = this.virtualizer._didMount()\n this.virtualizer._willUpdate()\n return () => {\n cleanup()\n this._element = null\n this.virtualizer._willUpdate()\n dirtyTag(this._tag)\n }\n }\n\n private _resolve(\n options: VirtualizerStateOptions<TItemElement>,\n ): VirtualizerOptions<HTMLElement, TItemElement> {\n return {\n observeElementRect,\n observeElementOffset,\n scrollToFn: elementScroll,\n // Glimmer renders in the microtask after a ResizeObserver callback, still in the same\n // ResizeObserver loop. A render there mounts and observes new items, and the browser\n // reports \"ResizeObserver loop completed with undelivered notifications\". So the\n // callback only schedules the sizes, and the next animation frame applies them.\n useAnimationFrameWithResizeObserver: true,\n ...options,\n getScrollElement: () => this._element,\n onChange: (instance, sync) => {\n dirtyTag(this._tag)\n options.onChange?.(instance, sync)\n },\n }\n }\n}\n","import Modifier from 'ember-modifier'\nimport { registerDestructor } from '@ember/destroyable'\nimport type Owner from '@ember/owner'\nimport type { ArgsFor } from 'ember-modifier'\n\n/** A value that a scroll element attaches to, as `VirtualizerState`. */\nexport interface ScrollElementTarget {\n attach(element: HTMLElement): () => void\n}\n\nexport interface VirtualScrollSignature {\n Element: HTMLElement\n Args: { Positional: [ScrollElementTarget] }\n}\n\n/**\n * `{{virtualScroll this.state}}` on the scroll element attaches it to a `VirtualizerState`.\n * When the modifier is destroyed, or gets a different state, it detaches the element.\n */\nexport default class VirtualScroll extends Modifier<VirtualScrollSignature> {\n private _target: ScrollElementTarget | null = null\n private _detach: (() => void) | null = null\n\n constructor(owner: Owner, args: ArgsFor<VirtualScrollSignature>) {\n super(owner, args)\n registerDestructor(this, () => this._detach?.())\n }\n\n modify(element: HTMLElement, [target]: [ScrollElementTarget]): void {\n if (target === this._target) return\n this._detach?.()\n this._target = target\n this._detach = target.attach(element)\n }\n}\n"],"names":["getMeasurementKey","item","key","createLazyMeasurementsView","cache","flat","count","length","Proxy","get","target","prop","receiver","c","charCodeAt","i","Number","isInteger","v","s","index","start","size","end","lane","Reflect","DEV","isDevelopingApp","memo","getDeps","fn","opts","deps","initialDeps","result","isInitial","memoizedFunction","debugEnabled","debug","depTime","Date","now","newDeps","depsChanged","some","dep","resultTime","depEndTime","Math","round","resultEndTime","resultFpsPercentage","pad","str","num","String","console","info","max","min","onChange","skipInitialOnChange","updateDeps","notUndefined","value","msg","undefined","Error","approxEqual","a","b","abs","debounce","targetWindow","ms","timeoutId","Object","assign","args","clearTimeout","setTimeout","apply","cancel","SAFE_MAX","WHEEL_LINE","ARROW_STEP","sizerSize","totalSize","cap","ranges","virtualMax","viewportSize","realMax","scrollRatio","clamp","toRealOffset","virtualOffset","ratio","virtual","toVirtualOffset","realOffset","real","ScaledScroll","_written","constructor","scaled","shift","toVirtual","_isOwnWrite","onScroll","scrollTo","scrollBy","delta","wheelDelta","deltaY","deltaMode","keyDelta","Infinity","rowAt","floor","bindScaledInput","element","scroll","move","event","preventDefault","scrollTop","onWheel","ctrlKey","defaultPrevented","deltaX","scrollLeft","onKey","addEventListener","passive","removeEventListener","classifyScrollEvent","offset","isScrolling","elementMax","holdOffset","scrollOffset","pendingWrite","clampedMaxAtWrite","ownWriteAt","smooth","lowMaxes","isAnimating","phase","externalRetiresCommand","kind","command","fresh","freshTarget","lastTargetOffset","FLING_WINDOW_MS","flingSpedUp","samples","last","j","t","mid","k","first","recent","before","flingCaught","from","_isIOSResult","isIOSWebKit","navigator","test","userAgent","mtp","maxTouchPoints","platform","_iosMomentumOverridesWritesResult","iosMomentumOverridesWrites","CSS","supports","momentumOverridesWrites","_isWebKitResult","isWebKit","ua","_resetIOSDetectionForTests","touchListenerOptions","capture","IosGesture","_touch","host","touch","inMotion","dragging","moved","tail","ownReadBack","external","_openTail","until","touchStart","touchEnd","win","getWindow","timerId","listen","onTouchStart","onTouchEnd","awaitingFling","tailStillMoving","onTailClosed","getRect","clientWidth","clientHeight","width","height","createFrameQueue","ids","Set","schedule","id","requestAnimationFrame","delete","add","forEach","cancelAnimationFrame","clear","defaultKeyExtractor","defaultRangeExtractor","range","overscan","lanes","startIndex","endIndex","len","arr","Array","observeElementRect","instance","cb","scrollElement","handler","rect","ResizeObserver","frames","observer","run","options","useAnimationFrameWithResizeObserver","observe","box","unobserve","addEventListenerOptions","observeWindowRect","innerWidth","innerHeight","supportsScrollend","window","observeOffset","readOffset","registerScrollendEvent","useScrollendEvent","fallback","isScrollingResetDelay","createHandler","endHandler","observeElementOffset","el","horizontal","isRtl","observeWindowOffset","scrollX","scrollY","measureElement","entry","useCachedMeasurements","indexFromElement","getItemKey","itemSizeCache","estimateSize","borderBoxSize","cachedSize","scrollWithAdjustments","adjustments","behavior","adjustedOffset","isRtlElement","windowScroll","elementScroll","initialScrollPhase","atTarget","isSmoothScroll","state","isAppendWithTrim","prevCount","nextCount","getPreviousKey","getNextKey","firstKey","removedKeys","removedCount","retainedCount","has","Virtualizer","unsubs","scrollState","measurementsCache","_singleLaneMeasurements","Map","itemSizeCacheVersion","builtMeasurementOptions","builtItemSizeCacheVersion","pendingResizes","laneAssignments","pendingMin","prevLanes","lanesChangedFlag","lanesSettling","initialMeasurementsCacheApplied","pendingScrollAnchor","scrollRect","scrollDirection","scrollAdjustments","_holdOffset","_wheelTimer","_edgeFlushFrame","_reportedOverscroll","_trailing","_drawnListEnd","_iosGesture","_readElementOffset","_lastElementOffset","_flushHoldIfReady","_writeAwaitingCommand","_retryClampedAdjustment","_ownWriteAt","_clampedAdjustment","shouldAdjustScrollPositionOnItemSizeChange","elementsCache","_resizeBatch","_dropQueued","performance","_ro","_frames","delivering","observeQueued","pendingObservations","entries","batch","sync","measureEntry","notify","_noteClampMax","node","isConnected","cacheKey","cachedNode","isIndexInRange","shouldMeasureDuringScroll","resizeItem","disconnect","setOptions","merged","initialOffset","paddingStart","paddingEnd","scrollPaddingStart","scrollPaddingEnd","rangeExtractor","initialRect","scrollMargin","gap","indexAttribute","initialMeasurementsCache","anchorTo","followOnAppend","scrollEndThreshold","enabled","laneAssignmentMode","set","prevOptions","anchor","edgeKeysChanged","measurements","getMeasurements","previousItems","items","prevFirstKey","prevLastKey","didCountChange","didEdgeKeysChange","getVirtualItemForOffset","getScrollOffset","isAtEnd","anchorDelta","_awaitingCommandReadBack","anchorKey","anchorOffset","newMeasurements","idx","anchorItem","newOffset","_canWriteScroll","_followAnchor","applyScrollAdjustment","_followOffsetTarget","_clampedBy","write","_scrollToOffset","maybeNotify","calculateRange","cleanup","filter","Boolean","d","rafId","_momentumStop","restore","_didMount","_willUpdate","getScrollElement","ownerDocument","defaultView","cached","observing","push","_scrollScale","_elementMaxScrollOffset","_readTrailing","wasOverscrolled","elementOffset","_toLayoutOffset","_classifyScrollEvent","getMaxScrollOffset","getScrollStateTarget","maxAtWrite","prevOffset","prevDirection","queued","sample","_flushHoldAtTop","scheduleScrollReconcile","_landedBeforeAnchor","scrollToEnd","_readRawElementOffset","scale","scrollScale","getTotalSize","getSize","_holdAtTop","getCommandWrittenOffset","reconcileScroll","offsetInfo","toEnd","getOffsetForIndex","align","MAX_RECONCILE_MS","startedAt","targetOffset","STABLE_FRAMES","targetChanged","stableFrames","viewport","distance","keepSmooth","getMeasurementOptions","lanesChanged","measurementOptions","keys","need","next","Float64Array","subarray","slice","runningStart","prevIdx","measuredSize","view","laneLastIndex","fill","laneEnds","filledLanes","m","cachedLane","shouldCacheLane","prevIndex","prevInLane","bestLane","bestEnd","bestIdx","l","e","_getLayoutTotalSize","outerSize","listEnd","trailing","maxScrollOffset","calculateRangeImpl","getVirtualIndexes","attributeName","indexStr","getAttribute","warn","parseInt","scrollIndex","bufferSize","ceil","minIndex","maxIndex","dropDisconnected","queueMicrotask","prevNode","canShiftFromPendingResizes","startShift","resize","itemStart","itemSize","wasAtEnd","getVirtualDistanceFromEnd","prevTotalSize","isFirstMeasure","defaultShouldAdjust","shouldAdjustScroll","adjustedSync","getVirtualItems","indexes","hold","virtualItems","measurement","useFlat","findNearestBinarySearch","_readRawElementMax","scrollWidth","scrollHeight","doc","document","documentElement","_stopMomentum","done","scroller","scrollingElement","style","property","getPropertyValue","priority","getPropertyPriority","crossSize","crossSizeBefore","setProperty","stop","getDistanceFromEnd","threshold","getOffsetForAlignment","toOffset","maxOffset","scrollToOffset","_startScroll","scrollToIndex","initialAlign","cancelScroll","total","lastIdx","endByLane","val","takeSnapshot","snapshot","scrollToFn","writtenOffset","measure","low","high","getCurrentValue","middle","currentValue","findNearestBinarySearchFlat","lastIndex","limit","getStart","endPerLane","pos","startPerLane","VirtualizerState","_tag","createTag","virtualizer","_element","_resolve","consumeTag","dirtyTag","attach","VirtualScroll","Modifier","_target","_detach","owner","registerDestructor","modify"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;;AAIO,SAASA,iBAAiBA,CAACC,IAAsC,EAAsB;EAC5F,OAAO,OAAOA,IAAI,KAAK,QAAQ,GAAGA,IAAI,CAACC,GAAG,GAAGD,IAAI;AACnD;AAEO,SAASE,0BAA0BA,CACxCC,KAA8C,EAC9CC,IAAkB,EACE;AACpB,EAAA,MAAMC,KAAK,GAAGF,KAAK,CAACG,MAAM;AAC1B,EAAA,OAAO,IAAIC,KAAK,CAACJ,KAAK,EAAE;AACtBK,IAAAA,GAAGA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAE;AAC1B,MAAA,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;AAC5B;AACA,QAAA,MAAME,CAAC,GAAGF,IAAI,CAACG,UAAU,CAAC,CAAC,CAAC;AAC5B,QAAA,IAAID,CAAC,IAAI,EAAE,IAAIA,CAAC,IAAI,EAAE,EAAE;UACtB,MAAME,CAAC,GAAG,CAACJ,IAAI;AACf,UAAA,IAAIK,MAAM,CAACC,SAAS,CAACF,CAAC,CAAC,IAAIA,CAAC,IAAI,CAAC,IAAIA,CAAC,GAAGT,KAAK,EAAE;AAC9C,YAAA,IAAIY,CAAC,GAAGR,MAAM,CAACK,CAAC,CAAE;AAClB,YAAA,IAAI,OAAOG,CAAC,KAAK,QAAQ,EAAE;AACzB,cAAA,MAAMC,CAAC,GAAGd,IAAI,CAACU,CA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