UNPKG

react-virtuoso

Version:

A virtual scroll React component for efficiently rendering large scrollable lists, grids, tables, and feeds

2,008 lines (2,007 loc) 91 kB
import { jsx as P, jsxs as Nt, Fragment as uo } from "react/jsx-runtime"; import H, { createElement as _t } from "react"; import ao from "react-dom"; const we = 0, zt = 1, qt = 2, kn = 4; function un(t) { return () => t; } function fo(t) { t(); } function ne(t, e) { return (n) => t(e(n)); } function an(t, e) { return () => t(e); } function mo(t, e) { return (n) => t(e, n); } function We(t) { return t !== void 0; } function po(...t) { return () => { t.map(fo); }; } function Yt() { } function ve(t, e) { return e(t), t; } function ho(t, e) { return e(t); } function X(...t) { return t; } function K(t, e) { return t(zt, e); } function G(t, e) { t(we, e); } function Ge(t) { t(qt); } function ot(t) { return t(kn); } function O(t, e) { return K(t, mo(e, we)); } function Tt(t, e) { const n = t(zt, (o) => { n(), e(o); }); return n; } function dn(t) { let e, n; return (o) => (r) => { e = r, n && clearTimeout(n), n = setTimeout(() => { o(e); }, t); }; } function Fn(t, e) { return t === e; } function Y(t = Fn) { let e; return (n) => (o) => { t(e, o) || (e = o, n(o)); }; } function A(t) { return (e) => (n) => { t(n) && e(n); }; } function E(t) { return (e) => ne(e, t); } function Rt(t) { return (e) => () => { e(t); }; } function S(t, ...e) { const n = go(...e); return (o, r) => { switch (o) { case qt: Ge(t); return; case zt: return K(t, n(r)); } }; } function bt(t, e) { return (n) => (o) => { n(e = t(e, o)); }; } function Dt(t) { return (e) => (n) => { t > 0 ? t-- : e(n); }; } function kt(t) { let e = null, n; return (o) => (r) => { e = r, !n && (n = setTimeout(() => { n = void 0, o(e); }, t)); }; } function N(...t) { const e = new Array(t.length); let n = 0, o = null; const r = Math.pow(2, t.length) - 1; return t.forEach((s, i) => { const l = Math.pow(2, i); K(s, (c) => { const a = n; n = n | l, e[i] = c, a !== r && n === r && o && (o(), o = null); }); }), (s) => (i) => { const l = () => { s([i].concat(e)); }; n === r ? l() : o = l; }; } function go(...t) { return (e) => t.reduceRight(ho, e); } function Io(t) { let e, n; const o = () => e == null ? void 0 : e(); return function(r, s) { switch (r) { case zt: return s ? n === s ? void 0 : (o(), n = s, e = K(t, s), e) : (o(), Yt); case qt: o(), n = null; return; } }; } function w(t) { let e = t; const n = $(); return (o, r) => { switch (o) { case we: e = r; break; case zt: { r(e); break; } case kn: return e; } return n(o, r); }; } function ct(t, e) { return ve(w(e), (n) => O(t, n)); } function $() { const t = []; return (e, n) => { switch (e) { case we: t.slice().forEach((o) => { o(n); }); return; case qt: t.splice(0, t.length); return; case zt: return t.push(n), () => { const o = t.indexOf(n); o > -1 && t.splice(o, 1); }; } }; } function ht(t) { return ve($(), (e) => O(t, e)); } function U(t, e = [], { singleton: n } = { singleton: !0 }) { return { constructor: t, dependencies: e, id: So(), singleton: n }; } const So = () => Symbol(); function xo(t) { const e = /* @__PURE__ */ new Map(), n = ({ constructor: o, dependencies: r, id: s, singleton: i }) => { if (i && e.has(s)) return e.get(s); const l = o(r.map((c) => n(c))); return i && e.set(s, l), l; }; return n(t); } function rt(...t) { const e = $(), n = new Array(t.length); let o = 0; const r = Math.pow(2, t.length) - 1; return t.forEach((s, i) => { const l = Math.pow(2, i); K(s, (c) => { n[i] = c, o = o | l, o === r && G(e, n); }); }), function(s, i) { switch (s) { case qt: { Ge(e); return; } case zt: return o === r && i(n), K(e, i); } }; } function V(t, e = Fn) { return S(t, Y(e)); } function Le(...t) { return function(e, n) { switch (e) { case qt: return; case zt: return po(...t.map((o) => K(o, n))); } }; } var mt = /* @__PURE__ */ ((t) => (t[t.DEBUG = 0] = "DEBUG", t[t.INFO = 1] = "INFO", t[t.WARN = 2] = "WARN", t[t.ERROR = 3] = "ERROR", t))(mt || {}); const To = { 0: "debug", 3: "error", 1: "log", 2: "warn" }, Co = () => typeof globalThis > "u" ? window : globalThis, Vt = U( () => { const t = w( 3 /* ERROR */ ); return { log: w((n, o, r = 1) => { var i; const s = (i = Co().VIRTUOSO_LOG_LEVEL) != null ? i : ot(t); r >= s && console[To[r]]( "%creact-virtuoso: %c%s %o", "color: #0253b3; font-weight: bold", "color: initial", n, o ); }), logLevel: t }; }, [], { singleton: !0 } ); function Ht(t, e, n) { return _e(t, e, n).callbackRef; } function _e(t, e, n) { const o = H.useRef(null); let r = (i) => { }; const s = H.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((i) => { const l = () => { const c = i[0].target; c.offsetParent !== null && t(c); }; n ? l() : requestAnimationFrame(l); }) : null, [t, n]); return r = (i) => { i && e ? (s == null || s.observe(i), o.current = i) : (o.current && (s == null || s.unobserve(o.current)), o.current = null); }, { callbackRef: r, ref: o }; } function On(t, e, n, o, r, s, i, l, c) { const a = H.useCallback( (m) => { const x = wo(m.children, e, l ? "offsetWidth" : "offsetHeight", r); let h = m.parentElement; for (; !h.dataset.virtuosoScroller; ) h = h.parentElement; const I = h.lastElementChild.dataset.viewportType === "window"; let C; I && (C = h.ownerDocument.defaultView); const v = i ? l ? i.scrollLeft : i.scrollTop : I ? l ? C.scrollX || C.document.documentElement.scrollLeft : C.scrollY || C.document.documentElement.scrollTop : l ? h.scrollLeft : h.scrollTop, g = i ? l ? i.scrollWidth : i.scrollHeight : I ? l ? C.document.documentElement.scrollWidth : C.document.documentElement.scrollHeight : l ? h.scrollWidth : h.scrollHeight, p = i ? l ? i.offsetWidth : i.offsetHeight : I ? l ? C.innerWidth : C.innerHeight : l ? h.offsetWidth : h.offsetHeight; o({ scrollHeight: g, scrollTop: Math.max(v, 0), viewportHeight: p }), s == null || s( l ? fn("column-gap", getComputedStyle(m).columnGap, r) : fn("row-gap", getComputedStyle(m).rowGap, r) ), x !== null && t(x); }, [t, e, r, s, i, o, l] ); return _e(a, n, c); } function wo(t, e, n, o) { const r = t.length; if (r === 0) return null; const s = []; for (let i = 0; i < r; i++) { const l = t.item(i); if (l.dataset.index === void 0) continue; const c = parseInt(l.dataset.index), a = parseFloat(l.dataset.knownSize), m = e(l, n); if (m === 0 && o("Zero-sized element, this should not happen", { child: l }, mt.ERROR), m === a) continue; const x = s[s.length - 1]; s.length === 0 || x.size !== m || x.endIndex !== c - 1 ? s.push({ endIndex: c, size: m, startIndex: c }) : s[s.length - 1].endIndex++; } return s; } function fn(t, e, n) { return e !== "normal" && !(e != null && e.endsWith("px")) && n(`${t} was not resolved to pixel value correctly`, e, mt.WARN), e === "normal" ? 0 : parseInt(e != null ? e : "0", 10); } function Ne(t, e, n) { const o = H.useRef(null), r = H.useCallback( (c) => { if (!(c != null && c.offsetParent)) return; const a = c.getBoundingClientRect(), m = a.width; let x, h; if (e) { const I = e.getBoundingClientRect(), C = a.top - I.top; h = I.height - Math.max(0, C), x = C + e.scrollTop; } else { const I = i.current.ownerDocument.defaultView; h = I.innerHeight - Math.max(0, a.top), x = a.top + I.scrollY; } o.current = { offsetTop: x, visibleHeight: h, visibleWidth: m }, t(o.current); }, // eslint-disable-next-line react-hooks/exhaustive-deps [t, e] ), { callbackRef: s, ref: i } = _e(r, !0, n), l = H.useCallback(() => { r(i.current); }, [r, i]); return H.useEffect(() => { var c; if (e) { e.addEventListener("scroll", l); const a = new ResizeObserver(() => { requestAnimationFrame(l); }); return a.observe(e), () => { e.removeEventListener("scroll", l), a.unobserve(e); }; } else { const a = (c = i.current) == null ? void 0 : c.ownerDocument.defaultView; return a == null || a.addEventListener("scroll", l), a == null || a.addEventListener("resize", l), () => { a == null || a.removeEventListener("scroll", l), a == null || a.removeEventListener("resize", l); }; } }, [l, e, i]), s; } const at = U( () => { const t = $(), e = $(), n = w(0), o = $(), r = w(0), s = $(), i = $(), l = w(0), c = w(0), a = w(0), m = w(0), x = $(), h = $(), I = w(!1), C = w(!1), v = w(!1); return O( S( t, E(({ scrollTop: g }) => g) ), e ), O( S( t, E(({ scrollHeight: g }) => g) ), i ), O(e, r), { deviation: n, fixedFooterHeight: a, fixedHeaderHeight: c, footerHeight: m, headerHeight: l, horizontalDirection: C, scrollBy: h, // input scrollContainerState: t, scrollHeight: i, scrollingInProgress: I, // signals scrollTo: x, scrollTop: e, skipAnimationFrameInResizeObserver: v, smoothScrollTargetReached: o, // state statefulScrollTop: r, viewportHeight: s }; }, [], { singleton: !0 } ), oe = { lvl: 0 }; function Ln(t, e) { const n = t.length; if (n === 0) return []; let { index: o, value: r } = e(t[0]); const s = []; for (let i = 1; i < n; i++) { const { index: l, value: c } = e(t[i]); s.push({ end: l - 1, start: o, value: r }), o = l, r = c; } return s.push({ end: 1 / 0, start: o, value: r }), s; } function j(t) { return t === oe; } function re(t, e) { if (!j(t)) return e === t.k ? t.v : e < t.k ? re(t.l, e) : re(t.r, e); } function wt(t, e, n = "k") { if (j(t)) return [-1 / 0, void 0]; if (Number(t[n]) === e) return [t.k, t.v]; if (Number(t[n]) < e) { const o = wt(t.r, e, n); return o[0] === -1 / 0 ? [t.k, t.v] : o; } return wt(t.l, e, n); } function pt(t, e, n) { return j(t) ? Pn(e, n, 1) : e === t.k ? st(t, { k: e, v: n }) : e < t.k ? mn(st(t, { l: pt(t.l, e, n) })) : mn(st(t, { r: pt(t.r, e, n) })); } function jt() { return oe; } function ye(t, e, n) { if (j(t)) return []; const o = wt(t, e)[0]; return vo(Ve(t, o, n)); } function ze(t, e) { if (j(t)) return oe; const { k: n, l: o, r } = t; if (e === n) { if (j(o)) return r; if (j(r)) return o; { const [s, i] = Vn(o); return ge(st(t, { k: s, l: zn(o), v: i })); } } else return e < n ? ge(st(t, { l: ze(o, e) })) : ge(st(t, { r: ze(r, e) })); } function Gt(t) { return j(t) ? [] : [...Gt(t.l), { k: t.k, v: t.v }, ...Gt(t.r)]; } function Ve(t, e, n) { if (j(t)) return []; const { k: o, l: r, r: s, v: i } = t; let l = []; return o > e && (l = l.concat(Ve(r, e, n))), o >= e && o <= n && l.push({ k: o, v: i }), o <= n && (l = l.concat(Ve(s, e, n))), l; } function ge(t) { const { l: e, lvl: n, r: o } = t; if (o.lvl >= n - 1 && e.lvl >= n - 1) return t; if (n > o.lvl + 1) { if (Ee(e)) return An(st(t, { lvl: n - 1 })); if (!j(e) && !j(e.r)) return st(e.r, { l: st(e, { r: e.r.l }), lvl: n, r: st(t, { l: e.r.r, lvl: n - 1 }) }); throw new Error("Unexpected empty nodes"); } else { if (Ee(t)) return Pe(st(t, { lvl: n - 1 })); if (!j(o) && !j(o.l)) { const r = o.l, s = Ee(r) ? o.lvl - 1 : o.lvl; return st(r, { l: st(t, { lvl: n - 1, r: r.l }), lvl: r.lvl + 1, r: Pe(st(o, { l: r.r, lvl: s })) }); } else throw new Error("Unexpected empty nodes"); } } function st(t, e) { return Pn( e.k !== void 0 ? e.k : t.k, e.v !== void 0 ? e.v : t.v, e.lvl !== void 0 ? e.lvl : t.lvl, e.l !== void 0 ? e.l : t.l, e.r !== void 0 ? e.r : t.r ); } function zn(t) { return j(t.r) ? t.l : ge(st(t, { r: zn(t.r) })); } function Ee(t) { return j(t) || t.lvl > t.r.lvl; } function Vn(t) { return j(t.r) ? [t.k, t.v] : Vn(t.r); } function Pn(t, e, n, o = oe, r = oe) { return { k: t, l: o, lvl: n, r, v: e }; } function mn(t) { return Pe(An(t)); } function An(t) { const { l: e } = t; return !j(e) && e.lvl === t.lvl ? st(e, { r: st(t, { l: e.r }) }) : t; } function Pe(t) { const { lvl: e, r: n } = t; return !j(n) && !j(n.r) && n.lvl === e && n.r.lvl === e ? st(n, { l: st(t, { r: n.l }), lvl: e + 1 }) : t; } function vo(t) { return Ln(t, ({ k: e, v: n }) => ({ index: e, value: n })); } function Mn(t, e) { return !!(t && t.startIndex === e.startIndex && t.endIndex === e.endIndex); } function se(t, e) { return !!(t && t[0] === e[0] && t[1] === e[1]); } const De = U( () => ({ recalcInProgress: w(!1) }), [], { singleton: !0 } ); function Wn(t, e, n) { return t[Se(t, e, n)]; } function Se(t, e, n, o = 0) { let r = t.length - 1; for (; o <= r; ) { const s = Math.floor((o + r) / 2), i = t[s], l = n(i, e); if (l === 0) return s; if (l === -1) { if (r - o < 2) return s - 1; r = s - 1; } else { if (r === o) return s; o = s + 1; } } throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`); } function yo(t, e, n, o) { const r = Se(t, e, o), s = Se(t, n, o, r); return t.slice(r, s + 1); } function vt(t, e) { return Math.round(t.getBoundingClientRect()[e]); } function Re(t) { return !j(t.groupOffsetTree); } function $e({ index: t }, e) { return e === t ? 0 : e < t ? -1 : 1; } function Ro() { return { groupIndices: [], groupOffsetTree: jt(), lastIndex: 0, lastOffset: 0, lastSize: 0, offsetTree: [], sizeTree: jt() }; } function bo(t, e) { let n = j(t) ? 0 : 1 / 0; for (const o of e) { const { endIndex: r, size: s, startIndex: i } = o; if (n = Math.min(n, i), j(t)) { t = pt(t, 0, s); continue; } const l = ye(t, i - 1, r + 1); if (l.some(Lo(o))) continue; let c = !1, a = !1; for (const { end: m, start: x, value: h } of l) c ? (r >= x || s === h) && (t = ze(t, x)) : (a = h !== s, c = !0), m > r && r >= x && h !== s && (t = pt(t, r + 1, h)); a && (t = pt(t, i, s)); } return [t, n]; } function Ho(t) { return typeof t.groupIndex < "u"; } function Eo({ offset: t }, e) { return e === t ? 0 : e < t ? -1 : 1; } function ie(t, e, n) { if (e.length === 0) return 0; const { index: o, offset: r, size: s } = Wn(e, t, $e), i = t - o, l = s * i + (i - 1) * n + r; return l > 0 ? l + n : l; } function Gn(t, e) { if (!Re(e)) return t; let n = 0; for (; e.groupIndices[n] <= t + n; ) n++; return t + n; } function _n(t, e, n) { if (Ho(t)) return e.groupIndices[t.groupIndex] + 1; { const o = t.index === "LAST" ? n : t.index; let r = Gn(o, e); return r = Math.max(0, r, Math.min(n, r)), r; } } function Bo(t, e, n, o = 0) { return o > 0 && (e = Math.max(e, Wn(t, o, $e).offset)), Ln(yo(t, e, n, Eo), Oo); } function ko(t, [e, n, o, r]) { e.length > 0 && o("received item sizes", e, mt.DEBUG); const s = t.sizeTree; let i = s, l = 0; if (n.length > 0 && j(s) && e.length === 2) { const h = e[0].size, I = e[1].size; i = n.reduce((C, v) => pt(pt(C, v, h), v + 1, I), i); } else [i, l] = bo(i, e); if (i === s) return t; const { lastIndex: c, lastOffset: a, lastSize: m, offsetTree: x } = Ae(t.offsetTree, l, i, r); return { groupIndices: n, groupOffsetTree: n.reduce((h, I) => pt(h, I, ie(I, x, r)), jt()), lastIndex: c, lastOffset: a, lastSize: m, offsetTree: x, sizeTree: i }; } function Fo(t) { return Gt(t).map(({ k: e, v: n }, o, r) => { const s = r[o + 1]; return { endIndex: s ? s.k - 1 : 1 / 0, size: n, startIndex: e }; }); } function pn(t, e) { let n = 0, o = 0; for (; n < t; ) n += e[o + 1] - e[o] - 1, o++; return o - (n === t ? 0 : 1); } function Ae(t, e, n, o) { let r = t, s = 0, i = 0, l = 0, c = 0; if (e !== 0) { c = Se(r, e - 1, $e), l = r[c].offset; const m = wt(n, e - 1); s = m[0], i = m[1], r.length && r[c].size === wt(n, e)[1] && (c -= 1), r = r.slice(0, c + 1); } else r = []; for (const { start: a, value: m } of ye(n, e, 1 / 0)) { const x = a - s, h = x * i + l + x * o; r.push({ index: a, offset: h, size: m }), s = a, l = h, i = m; } return { lastIndex: s, lastOffset: l, lastSize: i, offsetTree: r }; } function Oo(t) { return { index: t.index, value: t }; } function Lo(t) { const { endIndex: e, size: n, startIndex: o } = t; return (r) => r.start === o && (r.end === e || r.end === 1 / 0) && r.value === n; } const zo = { offsetHeight: "height", offsetWidth: "width" }, Et = U( ([{ log: t }, { recalcInProgress: e }]) => { const n = $(), o = $(), r = ct(o, 0), s = $(), i = $(), l = w(0), c = w([]), a = w(void 0), m = w(void 0), x = w((f, d) => vt(f, zo[d])), h = w(void 0), I = w(0), C = Ro(), v = ct( S(n, N(c, t, I), bt(ko, C), Y()), C ), g = ct( S( c, Y(), bt((f, d) => ({ current: d, prev: f.current }), { current: [], prev: [] }), E(({ prev: f }) => f) ), [] ); O( S( c, A((f) => f.length > 0), N(v, I), E(([f, d, y]) => { const B = f.reduce((k, L, z) => pt(k, L, ie(L, d.offsetTree, y) || z), jt()); return { ...d, groupIndices: f, groupOffsetTree: B }; }) ), v ), O( S( o, N(v), A(([f, { lastIndex: d }]) => f < d), E(([f, { lastIndex: d, lastSize: y }]) => [ { endIndex: d, size: y, startIndex: f } ]) ), n ), O(a, m); const p = ct( S( a, E((f) => f === void 0) ), !0 ); O( S( m, A((f) => f !== void 0 && j(ot(v).sizeTree)), E((f) => [{ endIndex: 0, size: f, startIndex: 0 }]) ), n ); const u = ht( S( n, N(v), bt( ({ sizes: f }, [d, y]) => ({ changed: y !== f, sizes: y }), { changed: !1, sizes: C } ), E((f) => f.changed) ) ); K( S( l, bt( (f, d) => ({ diff: f.prev - d, prev: d }), { diff: 0, prev: 0 } ), E((f) => f.diff) ), (f) => { const { groupIndices: d } = ot(v); if (f > 0) G(e, !0), G(s, f + pn(f, d)); else if (f < 0) { const y = ot(g); y.length > 0 && (f -= pn(-f, y)), G(i, f); } } ), K(S(l, N(t)), ([f, d]) => { f < 0 && d( "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value", { firstItemIndex: l }, mt.ERROR ); }); const T = ht(s); O( S( s, N(v), E(([f, d]) => { const y = d.groupIndices.length > 0, B = [], k = d.lastSize; if (y) { const L = re(d.sizeTree, 0); let z = 0, _ = 0; for (; z < f; ) { const F = d.groupIndices[_], q = d.groupIndices.length === _ + 1 ? 1 / 0 : d.groupIndices[_ + 1] - F - 1; B.push({ endIndex: F, size: L, startIndex: F }), B.push({ endIndex: F + 1 + q - 1, size: k, startIndex: F + 1 }), _++, z += q + 1; } const J = Gt(d.sizeTree); return z !== f && J.shift(), J.reduce( (F, { k: q, v: it }) => { let dt = F.ranges; return F.prevSize !== 0 && (dt = [ ...F.ranges, { endIndex: q + f - 1, size: F.prevSize, startIndex: F.prevIndex } ]), { prevIndex: q + f, prevSize: it, ranges: dt }; }, { prevIndex: f, prevSize: 0, ranges: B } ).ranges; } return Gt(d.sizeTree).reduce( (L, { k: z, v: _ }) => ({ prevIndex: z + f, prevSize: _, ranges: [...L.ranges, { endIndex: z + f - 1, size: L.prevSize, startIndex: L.prevIndex }] }), { prevIndex: 0, prevSize: k, ranges: [] } ).ranges; }) ), n ); const b = ht( S( i, N(v, I), E(([f, { offsetTree: d }, y]) => { const B = -f; return ie(B, d, y); }) ) ); return O( S( i, N(v, I), E(([f, d, y]) => { if (d.groupIndices.length > 0) { if (j(d.sizeTree)) return d; let k = jt(); const L = ot(g); let z = 0, _ = 0, J = 0; for (; z < -f; ) { J = L[_]; const F = L[_ + 1] - J - 1; _++, z += F + 1; } if (k = Gt(d.sizeTree).reduce((F, { k: q, v: it }) => pt(F, Math.max(0, q + f), it), k), z !== -f) { const F = re(d.sizeTree, J); k = pt(k, 0, F); const q = wt(d.sizeTree, -f + 1)[1]; k = pt(k, 1, q); } return { ...d, sizeTree: k, ...Ae(d.offsetTree, 0, k, y) }; } else { const k = Gt(d.sizeTree).reduce((L, { k: z, v: _ }) => pt(L, Math.max(0, z + f), _), jt()); return { ...d, sizeTree: k, ...Ae(d.offsetTree, 0, k, y) }; } }) ), v ), { beforeUnshiftWith: T, // input data: h, defaultItemSize: m, firstItemIndex: l, fixedItemSize: a, gap: I, groupIndices: c, itemSize: x, listRefresh: u, shiftWith: i, shiftWithOffset: b, sizeRanges: n, // output sizes: v, statefulTotalCount: r, totalCount: o, trackItemSizes: p, unshiftWith: s }; }, X(Vt, De), { singleton: !0 } ); function Vo(t) { return t.reduce( (e, n) => (e.groupIndices.push(e.totalCount), e.totalCount += n + 1, e), { groupIndices: [], totalCount: 0 } ); } const Nn = U( ([{ groupIndices: t, sizes: e, totalCount: n }, { headerHeight: o, scrollTop: r }]) => { const s = $(), i = $(), l = ht(S(s, E(Vo))); return O( S( l, E((c) => c.totalCount) ), n ), O( S( l, E((c) => c.groupIndices) ), t ), O( S( rt(r, e, o), A(([c, a]) => Re(a)), E(([c, a, m]) => wt(a.groupOffsetTree, Math.max(c - m, 0), "v")[0]), Y(), E((c) => [c]) ), i ), { groupCounts: s, topItemsIndexes: i }; }, X(Et, at) ), Pt = U( ([{ log: t }]) => { const e = w(!1), n = ht( S( e, A((o) => o), Y() ) ); return K(e, (o) => { o && ot(t)("props updated", {}, mt.DEBUG); }), { didMount: n, propsReady: e }; }, X(Vt), { singleton: !0 } ), Po = typeof document < "u" && "scrollBehavior" in document.documentElement.style; function Dn(t) { const e = typeof t == "number" ? { index: t } : t; return e.align || (e.align = "start"), (!e.behavior || !Po) && (e.behavior = "auto"), e.offset || (e.offset = 0), e; } const ce = U( ([ { gap: t, listRefresh: e, sizes: n, totalCount: o }, { fixedFooterHeight: r, fixedHeaderHeight: s, footerHeight: i, headerHeight: l, scrollingInProgress: c, scrollTo: a, smoothScrollTargetReached: m, viewportHeight: x }, { log: h } ]) => { const I = $(), C = $(), v = w(0); let g = null, p = null, u = null; function T() { g && (g(), g = null), u && (u(), u = null), p && (clearTimeout(p), p = null), G(c, !1); } return O( S( I, N(n, x, o, v, l, i, h), N(t, s, r), E( ([ [b, f, d, y, B, k, L, z], _, J, nt ]) => { const F = Dn(b), { align: q, behavior: it, offset: dt } = F, St = y - 1, ft = _n(F, f, St); let ut = ie(ft, f.offsetTree, _) + k; q === "end" ? (ut += J + wt(f.sizeTree, ft)[1] - d + nt, ft === St && (ut += L)) : q === "center" ? ut += (J + wt(f.sizeTree, ft)[1] - d + nt) / 2 : ut -= B, dt && (ut += dt); const At = (xt) => { T(), xt ? (z("retrying to scroll to", { location: b }, mt.DEBUG), G(I, b)) : (G(C, !0), z("list did not change, scroll successful", {}, mt.DEBUG)); }; if (T(), it === "smooth") { let xt = !1; u = K(e, (Xt) => { xt = xt || Xt; }), g = Tt(m, () => { At(xt); }); } else g = Tt(S(e, Ao(150)), At); return p = setTimeout(() => { T(); }, 1200), G(c, !0), z("scrolling from index to", { behavior: it, index: ft, top: ut }, mt.DEBUG), { behavior: it, top: ut }; } ) ), a ), { scrollTargetReached: C, scrollToIndex: I, topListHeight: v }; }, X(Et, at, Vt), { singleton: !0 } ); function Ao(t) { return (e) => { const n = setTimeout(() => { e(!1); }, t); return (o) => { o && (e(!0), clearTimeout(n)); }; }; } function Ue(t, e) { t == 0 ? e() : requestAnimationFrame(() => { Ue(t - 1, e); }); } function Ke(t, e) { const n = e - 1; return typeof t == "number" ? t : t.index === "LAST" ? n : t.index; } const ue = U( ([{ defaultItemSize: t, listRefresh: e, sizes: n }, { scrollTop: o }, { scrollTargetReached: r, scrollToIndex: s }, { didMount: i }]) => { const l = w(!0), c = w(0), a = w(!0); return O( S( i, N(c), A(([m, x]) => !!x), Rt(!1) ), l ), O( S( i, N(c), A(([m, x]) => !!x), Rt(!1) ), a ), K( S( rt(e, i), N(l, n, t, a), A(([[, m], x, { sizeTree: h }, I, C]) => m && (!j(h) || We(I)) && !x && !C), N(c) ), ([, m]) => { Tt(r, () => { G(a, !0); }), Ue(4, () => { Tt(o, () => { G(l, !0); }), G(s, m); }); } ), { initialItemFinalLocationReached: a, initialTopMostItemIndex: c, scrolledToInitialItem: l }; }, X(Et, at, ce, Pt), { singleton: !0 } ); function $n(t, e) { return Math.abs(t - e) < 1.01; } const le = "up", te = "down", Mo = "none", Wo = { atBottom: !1, notAtBottomBecause: "NOT_SHOWING_LAST_ITEM", state: { offsetBottom: 0, scrollHeight: 0, scrollTop: 0, viewportHeight: 0 } }, Go = 0, ae = U(([{ footerHeight: t, headerHeight: e, scrollBy: n, scrollContainerState: o, scrollTop: r, viewportHeight: s }]) => { const i = w(!1), l = w(!0), c = $(), a = $(), m = w(4), x = w(Go), h = ct( S( Le(S(V(r), Dt(1), Rt(!0)), S(V(r), Dt(1), Rt(!1), dn(100))), Y() ), !1 ), I = ct( S(Le(S(n, Rt(!0)), S(n, Rt(!1), dn(200))), Y()), !1 ); O( S( rt(V(r), V(x)), E(([u, T]) => u <= T), Y() ), l ), O(S(l, kt(50)), a); const C = ht( S( rt(o, V(s), V(e), V(t), V(m)), bt((u, [{ scrollHeight: T, scrollTop: b }, f, d, y, B]) => { const k = b + f - T > -B, L = { scrollHeight: T, scrollTop: b, viewportHeight: f }; if (k) { let _, J; return b > u.state.scrollTop ? (_ = "SCROLLED_DOWN", J = u.state.scrollTop - b) : (_ = "SIZE_DECREASED", J = u.state.scrollTop - b || u.scrollTopDelta), { atBottom: !0, atBottomBecause: _, scrollTopDelta: J, state: L }; } let z; return L.scrollHeight > u.state.scrollHeight ? z = "SIZE_INCREASED" : f < u.state.viewportHeight ? z = "VIEWPORT_HEIGHT_DECREASING" : b < u.state.scrollTop ? z = "SCROLLING_UPWARDS" : z = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", { atBottom: !1, notAtBottomBecause: z, state: L }; }, Wo), Y((u, T) => u && u.atBottom === T.atBottom) ) ), v = ct( S( o, bt( (u, { scrollHeight: T, scrollTop: b, viewportHeight: f }) => { if ($n(u.scrollHeight, T)) return { changed: !1, jump: 0, scrollHeight: T, scrollTop: b }; { const d = T - (b + f) < 1; return u.scrollTop !== b && d ? { changed: !0, jump: u.scrollTop - b, scrollHeight: T, scrollTop: b } : { changed: !0, jump: 0, scrollHeight: T, scrollTop: b }; } }, { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 } ), A((u) => u.changed), E((u) => u.jump) ), 0 ); O( S( C, E((u) => u.atBottom) ), i ), O(S(i, kt(50)), c); const g = w(te); O( S( o, E(({ scrollTop: u }) => u), Y(), bt( (u, T) => ot(I) ? { direction: u.direction, prevScrollTop: T } : { direction: T < u.prevScrollTop ? le : te, prevScrollTop: T }, { direction: te, prevScrollTop: 0 } ), E((u) => u.direction) ), g ), O(S(o, kt(50), Rt(Mo)), g); const p = w(0); return O( S( h, A((u) => !u), Rt(0) ), p ), O( S( r, kt(100), N(h), A(([u, T]) => !!T), bt(([u, T], [b]) => [T, b], [0, 0]), E(([u, T]) => T - u) ), p ), { atBottomState: C, atBottomStateChange: c, atBottomThreshold: m, atTopStateChange: a, atTopThreshold: x, isAtBottom: i, isAtTop: l, isScrolling: h, lastJumpDueToItemResize: v, scrollDirection: g, scrollVelocity: p }; }, X(at)), xe = "top", Te = "bottom", hn = "none"; function gn(t, e, n) { return typeof t == "number" ? n === le && e === xe || n === te && e === Te ? t : 0 : n === le ? e === xe ? t.main : t.reverse : e === Te ? t.main : t.reverse; } function In(t, e) { var n; return typeof t == "number" ? t : (n = t[e]) != null ? n : 0; } const je = U( ([{ deviation: t, fixedHeaderHeight: e, headerHeight: n, scrollTop: o, viewportHeight: r }]) => { const s = $(), i = w(0), l = w(0), c = w(0), a = ct( S( rt( V(o), V(r), V(n), V(s, se), V(c), V(i), V(e), V(t), V(l) ), E( ([ m, x, h, [I, C], v, g, p, u, T ]) => { const b = m - u, f = g + p, d = Math.max(h - b, 0); let y = hn; const B = In(T, xe), k = In(T, Te); return I -= u, I += h + p, C += h + p, C -= u, I > m + f - B && (y = le), C < m - d + x + k && (y = te), y !== hn ? [ Math.max(b - h - gn(v, xe, y) - B, 0), b - d - p + x + gn(v, Te, y) + k ] : null; } ), A((m) => m != null), Y(se) ), [0, 0] ); return { increaseViewportBy: l, // input listBoundary: s, overscan: c, topListHeight: i, // output visibleRange: a }; }, X(at), { singleton: !0 } ); function _o(t, e, n) { if (Re(e)) { const o = Gn(t, e); return [ { index: wt(e.groupOffsetTree, o)[0], offset: 0, size: 0 }, { data: n == null ? void 0 : n[0], index: o, offset: 0, size: 0 } ]; } return [{ data: n == null ? void 0 : n[0], index: t, offset: 0, size: 0 }]; } const Be = { bottom: 0, firstItemIndex: 0, items: [], offsetBottom: 0, offsetTop: 0, top: 0, topItems: [], topListHeight: 0, totalCount: 0 }; function Ie(t, e, n, o, r, s) { const { lastIndex: i, lastOffset: l, lastSize: c } = r; let a = 0, m = 0; if (t.length > 0) { a = t[0].offset; const v = t[t.length - 1]; m = v.offset + v.size; } const x = n - i, h = l + x * c + (x - 1) * o, I = a, C = h - m; return { bottom: m, firstItemIndex: s, items: Sn(t, r, s), offsetBottom: C, offsetTop: a, top: I, topItems: Sn(e, r, s), topListHeight: e.reduce((v, g) => g.size + v, 0), totalCount: n }; } function Un(t, e, n, o, r, s) { let i = 0; if (n.groupIndices.length > 0) for (const m of n.groupIndices) { if (m - i >= t) break; i++; } const l = t + i, c = Ke(e, l), a = Array.from({ length: l }).map((m, x) => ({ data: s[x + c], index: x + c, offset: 0, size: 0 })); return Ie(a, [], l, r, n, o); } function Sn(t, e, n) { if (t.length === 0) return []; if (!Re(e)) return t.map((a) => ({ ...a, index: a.index + n, originalIndex: a.index })); const o = t[0].index, r = t[t.length - 1].index, s = [], i = ye(e.groupOffsetTree, o, r); let l, c = 0; for (const a of t) { (!l || l.end < a.index) && (l = i.shift(), c = e.groupIndices.indexOf(l.start)); let m; a.index === l.start ? m = { index: c, type: "group" } : m = { groupIndex: c, index: a.index - (c + 1) + n }, s.push({ ...m, data: a.data, offset: a.offset, originalIndex: a.index, size: a.size }); } return s; } const $t = U( ([ { data: t, firstItemIndex: e, gap: n, sizes: o, totalCount: r }, s, { listBoundary: i, topListHeight: l, visibleRange: c }, { initialTopMostItemIndex: a, scrolledToInitialItem: m }, { topListHeight: x }, h, { didMount: I }, { recalcInProgress: C } ]) => { const v = w([]), g = w(0), p = $(); O(s.topItemsIndexes, v); const u = ct( S( rt( I, C, V(c, se), V(r), V(o), V(a), m, V(v), V(e), V(n), t ), A(([d, y, , B, , , , , , , k]) => { const L = k && k.length !== B; return d && !y && !L; }), E( ([ , , [d, y], B, k, L, z, _, J, nt, F ]) => { const q = k, { offsetTree: it, sizeTree: dt } = q, St = ot(g); if (B === 0) return { ...Be, totalCount: B }; if (d === 0 && y === 0) return St === 0 ? { ...Be, totalCount: B } : Un(St, L, k, J, nt, F || []); if (j(dt)) return St > 0 ? null : Ie( _o(Ke(L, B), q, F), [], B, nt, q, J ); const ft = []; if (_.length > 0) { const Mt = _[0], yt = _[_.length - 1]; let Bt = 0; for (const R of ye(dt, Mt, yt)) { const D = R.value, Q = Math.max(R.start, Mt), lt = Math.min(R.end, yt); for (let tt = Q; tt <= lt; tt++) ft.push({ data: F == null ? void 0 : F[tt], index: tt, offset: Bt, size: D }), Bt += D; } } if (!z) return Ie([], ft, B, nt, q, J); const ut = _.length > 0 ? _[_.length - 1] + 1 : 0, At = Bo(it, d, y, ut); if (At.length === 0) return null; const xt = B - 1, Xt = ve([], (Mt) => { for (const yt of At) { const Bt = yt.value; let R = Bt.offset, D = yt.start; const Q = Bt.size; if (Bt.offset < d) { D += Math.floor((d - Bt.offset + nt) / (Q + nt)); const tt = D - yt.start; R += tt * Q + tt * nt; } D < ut && (R += (ut - D) * Q, D = ut); const lt = Math.min(yt.end, xt); for (let tt = D; tt <= lt && !(R >= y); tt++) Mt.push({ data: F == null ? void 0 : F[tt], index: tt, offset: R, size: Q }), R += Q + nt; } }); return Ie(Xt, ft, B, nt, q, J); } ), //@ts-expect-error filter needs to be fixed A((d) => d !== null), Y() ), Be ); O( S( t, A(We), E((d) => d == null ? void 0 : d.length) ), r ), O( S( u, E((d) => d.topListHeight) ), x ), O(x, l), O( S( u, E((d) => [d.top, d.bottom]) ), i ), O( S( u, E((d) => d.items) ), p ); const T = ht( S( u, A(({ items: d }) => d.length > 0), N(r, t), A(([{ items: d }, y]) => d[d.length - 1].originalIndex === y - 1), E(([, d, y]) => [d - 1, y]), Y(se), E(([d]) => d) ) ), b = ht( S( u, kt(200), A(({ items: d, topItems: y }) => d.length > 0 && d[0].originalIndex === y.length), E(({ items: d }) => d[0].index), Y() ) ), f = ht( S( u, A(({ items: d }) => d.length > 0), E(({ items: d }) => { let y = 0, B = d.length - 1; for (; d[y].type === "group" && y < B; ) y++; for (; d[B].type === "group" && B > y; ) B--; return { endIndex: d[B].index, startIndex: d[y].index }; }), Y(Mn) ) ); return { endReached: T, initialItemCount: g, itemsRendered: p, listState: u, rangeChanged: f, startReached: b, topItemsIndexes: v, ...h }; }, X( Et, Nn, je, ue, ce, ae, Pt, De ), { singleton: !0 } ), Kn = U( ([{ fixedFooterHeight: t, fixedHeaderHeight: e, footerHeight: n, headerHeight: o }, { listState: r }]) => { const s = $(), i = ct( S( rt(n, t, o, e, r), E(([l, c, a, m, x]) => l + c + a + m + x.offsetBottom + x.bottom) ), 0 ); return O(V(i), s), { totalListHeight: i, totalListHeightChanged: s }; }, X(at, $t), { singleton: !0 } ), No = U( ([{ viewportHeight: t }, { totalListHeight: e }]) => { const n = w(!1), o = ct( S( rt(n, t, e), A(([r]) => r), E(([, r, s]) => Math.max(0, r - s)), kt(0), Y() ), 0 ); return { alignToBottom: n, paddingTopAddition: o }; }, X(at, Kn), { singleton: !0 } ), jn = U(() => ({ context: w(null) })), Do = ({ itemBottom: t, itemTop: e, locationParams: { align: n, behavior: o, ...r }, viewportBottom: s, viewportTop: i }) => e < i ? { ...r, align: n != null ? n : "start", behavior: o } : t > s ? { ...r, align: n != null ? n : "end", behavior: o } : null, qn = U( ([ { gap: t, sizes: e, totalCount: n }, { fixedFooterHeight: o, fixedHeaderHeight: r, headerHeight: s, scrollingInProgress: i, scrollTop: l, viewportHeight: c }, { scrollToIndex: a } ]) => { const m = $(); return O( S( m, N(e, c, n, s, r, o, l), N(t), E(([[x, h, I, C, v, g, p, u], T]) => { const { align: b, behavior: f, calculateViewLocation: d = Do, done: y, ...B } = x, k = _n(x, h, C - 1), L = ie(k, h.offsetTree, T) + v + g, z = L + wt(h.sizeTree, k)[1], _ = u + g, J = u + I - p, nt = d({ itemBottom: z, itemTop: L, locationParams: { align: b, behavior: f, ...B }, viewportBottom: J, viewportTop: _ }); return nt ? y && Tt( S( i, A((F) => !F), // skips the initial publish of false, and the cleanup call. // but if scrollingInProgress is true, we skip the initial publish. Dt(ot(i) ? 1 : 2) ), y ) : y && y(), nt; }), A((x) => x !== null) ), a ), { scrollIntoView: m }; }, X(Et, at, ce, $t, Vt), { singleton: !0 } ); function xn(t) { return t ? t === "smooth" ? "smooth" : "auto" : !1; } const $o = (t, e) => typeof t == "function" ? xn(t(e)) : e && xn(t), Uo = U( ([ { listRefresh: t, totalCount: e, fixedItemSize: n, data: o }, { atBottomState: r, isAtBottom: s }, { scrollToIndex: i }, { scrolledToInitialItem: l }, { didMount: c, propsReady: a }, { log: m }, { scrollingInProgress: x }, { context: h }, { scrollIntoView: I } ]) => { const C = w(!1), v = $(); let g = null; function p(f) { G(i, { align: "end", behavior: f, index: "LAST" }); } K( S( rt(S(V(e), Dt(1)), c), N(V(C), s, l, x), E(([[f, d], y, B, k, L]) => { let z = d && k, _ = "auto"; return z && (_ = $o(y, B || L), z = z && !!_), { followOutputBehavior: _, shouldFollow: z, totalCount: f }; }), A(({ shouldFollow: f }) => f) ), ({ followOutputBehavior: f, totalCount: d }) => { g && (g(), g = null), ot(n) ? requestAnimationFrame(() => { ot(m)("following output to ", { totalCount: d }, mt.DEBUG), p(f); }) : g = Tt(t, () => { ot(m)("following output to ", { totalCount: d }, mt.DEBUG), p(f), g = null; }); } ); function u(f) { const d = Tt(r, (y) => { f && !y.atBottom && y.notAtBottomBecause === "SIZE_INCREASED" && !g && (ot(m)("scrolling to bottom due to increased size", {}, mt.DEBUG), p("auto")); }); setTimeout(d, 100); } K( S( rt(V(C), e, a), A(([f, , d]) => f && d), bt( ({ value: f }, [, d]) => ({ refreshed: f === d, value: d }), { refreshed: !1, value: 0 } ), A(({ refreshed: f }) => f), N(C, e) ), ([, f]) => { ot(l) && u(f !== !1); } ), K(v, () => { u(ot(C) !== !1); }), K(rt(V(C), r), ([f, d]) => { f && !d.atBottom && d.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && p("auto"); }); const T = w(null), b = $(); return O( Le( S( V(o), E((f) => { var d; return (d = f == null ? void 0 : f.length) != null ? d : 0; }) ), S(V(e)) ), b ), K( S( rt(S(b, Dt(1)), c), N(V(T), l, x, h), E(([[f, d], y, B, k, L]) => d && B && (y == null ? void 0 : y({ context: L, totalCount: f, scrollingInProgress: k }))), A((f) => !!f), kt(0) ), (f) => { g && (g(), g = null), ot(n) ? requestAnimationFrame(() => { ot(m)("scrolling into view", {}), G(I, f); }) : g = Tt(t, () => { ot(m)("scrolling into view", {}), G(I, f), g = null; }); } ), { autoscrollToBottom: v, followOutput: C, scrollIntoViewOnChange: T }; }, X( Et, ae, ce, ue, Pt, Vt, at, jn, qn ) ), Ko = U( ([{ data: t, firstItemIndex: e, gap: n, sizes: o }, { initialTopMostItemIndex: r }, { initialItemCount: s, listState: i }, { didMount: l }]) => (O( S( l, N(s), A(([, c]) => c !== 0), N(r, o, e, n, t), E(([[, c], a, m, x, h, I = []]) => Un(c, a, m, x, h, I)) ), i ), {}), X(Et, ue, $t, Pt), { singleton: !0 } ), jo = U( ([{ didMount: t }, { scrollTo: e }, { listState: n }]) => { const o = w(0); return K( S( t, N(o), A(([, r]) => r !== 0), E(([, r]) => ({ top: r })) ), (r) => { Tt( S( n, Dt(1), A((s) => s.items.length > 1) ), () => { requestAnimationFrame(() => { G(e, r); }); } ); } ), { initialScrollTop: o }; }, X(Pt, at, $t), { singleton: !0 } ), Yn = U( ([{ scrollVelocity: t }]) => { const e = w(!1), n = $(), o = w(!1); return O( S( t, N(o, e, n), A(([r, s]) => !!s), E(([r, s, i, l]) => { const { enter: c, exit: a } = s; if (i) { if (a(r, l)) return !1; } else if (c(r, l)) return !0; return i; }), Y() ), e ), K( S(rt(e, t, n), N(o)), ([[r, s, i], l]) => { r && l && l.change && l.change(s, i); } ), { isSeeking: e, scrollSeekConfiguration: o, scrollSeekRangeChanged: n, scrollVelocity: t }; }, X(ae), { singleton: !0 } ), qe = U(([{ scrollContainerState: t, scrollTo: e }]) => { const n = $(), o = $(), r = $(), s = w(!1), i = w(void 0); return O( S( rt(n, o), E(([{ scrollHeight: l, scrollTop: c, viewportHeight: a }, { offsetTop: m }]) => ({ scrollHeight: l, scrollTop: Math.max(0, c - m), viewportHeight: a })) ), t ), O( S( e, N(o), E(([l, { offsetTop: c }]) => ({ ...l, top: l.top + c })) ), r ), { customScrollParent: i, // config useWindowScroll: s, // input windowScrollContainerState: n, // signals windowScrollTo: r, windowViewportRect: o }; }, X(at)), qo = U( ([ { sizeRanges: t, sizes: e }, { headerHeight: n, scrollTop: o }, { initialTopMostItemIndex: r }, { didMount: s }, { useWindowScroll: i, windowScrollContainerState: l, windowViewportRect: c } ]) => { const a = $(), m = w(void 0), x = w(null), h = w(null); return O(l, x), O(c, h), K( S( a, N(e, o, i, x, h, n) ), ([I, C, v, g, p, u, T]) => { const b = Fo(C.sizeTree); g && p !== null && u !== null && (v = p.scrollTop - u.offsetTop), v -= T, I({ ranges: b, scrollTop: v }); } ), O(S(m, A(We), E(Yo)), r), O( S( s, N(m), A(([, I]) => I !== void 0), Y(), E(([, I]) => I.ranges) ), t ), { getState: a, restoreStateFrom: m }; }, X(Et, at, ue, Pt, qe) ); function Yo(t) { return { align: "start", index: 0, offset: t.scrollTop }; } const Zo = U(([{ topItemsIndexes: t }]) => { const e = w(0); return O( S( e, A((n) => n >= 0), E((n) => Array.from({ length: n }).map((o, r) => r)) ), t ), { topItemCount: e }; }, X($t)); function Zn(t) { let e = !1, n; return () => (e || (e = !0, n = t()), n); } const Xo = Zn(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), Jo = U( ([ { deviation: t, scrollBy: e, scrollingInProgress: n, scrollTop: o }, { isAtBottom: r, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: l }, { listState: c }, { beforeUnshiftWith: a, gap: m, shiftWithOffset: x, sizes: h }, { log: I }, { recalcInProgress: C } ]) => { const v = ht( S( c, N(i), bt( ([, p, u, T], [{ bottom: b, items: f, offsetBottom: d, totalCount: y }, B]) => { const k = b + d; let L = 0; return u === y && p.length > 0 && f.length > 0 && (f[0].originalIndex === 0 && p[0].originalIndex === 0 || (L = k - T, L !== 0 && (L += B))), [L, f, y, k]; }, [0, [], 0, 0] ), A(([p]) => p !== 0), N(o, l, n, r, I, C), A(([, p, u, T, , , b]) => !b && !T && p !== 0 && u === le), E(([[p], , , , , u]) => (u("Upward scrolling compensation", { amount: p }, mt.DEBUG), p)) ) ); function g(p) { p > 0 ? (G(e, { behavior: "auto", top: -p }), G(t, 0)) : (G(t, 0), G(e, { behavior: "auto", top: -p })); } return K(S(v, N(t, s)), ([p, u, T]) => { T && Xo() ? G(t, u - p) : g(-p); }), K( S( rt(ct(s, !1), t, C), A(([p, u, T]) => !p && !T && u !== 0), E(([p, u]) => u), kt(1) ), g ), O( S( x, E((p) => ({ top: -p })) ), e ), K( S( a, N(h, m), E(([p, { groupIndices: u, lastSize: T, sizeTree: b }, f]) => { function d(y) { return y * (T + f);