New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@virtuoso.dev/message-list

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@virtuoso.dev/message-list - npm Package Compare versions

Comparing version 1.8.0-alpha.20 to 1.8.0-alpha.21

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.8.0-alpha.21](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.20...v1.8.0-alpha.21) (2024-06-18)
### Features
* control the smooth scroll ([74e6a9d](https://github.com/virtuoso-dev/message-list/commit/74e6a9d8c3c867cae5439731ead8b09dc774c53a))
# [1.8.0-alpha.20](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.19...v1.8.0-alpha.20) (2024-06-17)

@@ -2,0 +9,0 @@

@@ -308,2 +308,3 @@ /// <reference types="react" />

* @param callback - The callback that performs the data operations.
* @param scrollToBottom - Specifies the behavior when the list is scrolled to the bottom. You can pass a boolean, a `ScrollBehavior`, or a function that returns a `ScrollBehavior`.
*/

@@ -328,2 +329,6 @@ batch: (callback: () => void, scrollToBottom?: AutoscrollToBottom<Data, Context>) => void;

getScrollLocation: () => ListScrollLocation;
/**
* Cancels the current smooth scroll operation, if any.
*/
cancelSmoothScroll: () => void;
}

@@ -421,4 +426,13 @@

shortSizeAlign?: ShortSizeAlign;
/**
* The function to use for smooth scrolling. The default value is `easeOutExpo`.
* Take a look at the {@link https://easings.net/ | easings.net} for more options, the functions there can be used directly.
*/
smoothScrollBezierFunction?: (x: number) => number;
/**
* The animation frames it will take for the smooth scroll to reach its final position. The default value is 50.
*/
smoothScrollAnimationFrameCount?: number;
}
export { }

1481

dist/index.js

@@ -1,5 +0,5 @@

import { jsxs as Nt, jsx as I, Fragment as Xn } from "react/jsx-runtime";
import { jsxs as zt, jsx as I, Fragment as to } from "react/jsx-runtime";
import g from "react";
import { Cell as c, Signal as k, throttleTime as we, map as a, mapTo as H, debounceTime as ce, filter as v, scan as q, withLatestFrom as S, delayWithMicrotask as Dt, onNext as zt, useCellValue as B, useRealm as Yt, Realm as Qn, RealmContext as eo, useCellValues as to } from "@mdxeditor/gurx";
function me(e, t) {
import { Cell as c, Signal as S, throttleTime as Ee, map as a, mapTo as O, debounceTime as le, filter as v, scan as U, withLatestFrom as y, delayWithMicrotask as Mt, onNext as Yt, Action as no, useCellValue as D, useRealm as At, Realm as oo, RealmContext as so, useCellValues as io } from "@mdxeditor/gurx";
function be(e, t) {
const n = c(e, (o) => {

@@ -10,30 +10,30 @@ o.link(t(o), n);

}
const xe = { lvl: 0 };
function Kt(e, t, n, o = xe, s = xe) {
const ye = { lvl: 0 };
function Kt(e, t, n, o = ye, s = ye) {
return { k: e, l: o, lvl: n, r: s, v: t };
}
function b(e) {
return e === xe;
function m(e) {
return e === ye;
}
function ke() {
return xe;
function me() {
return ye;
}
function gt(e, t) {
if (b(e))
return xe;
if (m(e))
return ye;
const { k: n, l: o, r: s } = e;
if (t === n) {
if (b(o))
if (m(o))
return s;
if (b(s))
if (m(s))
return o;
{
const [i, l] = jt(o);
return Ue($(e, { k: i, l: Ut(o), v: l }));
return Ke(T(e, { k: i, l: Ut(o), v: l }));
}
} else
return t < n ? Ue($(e, { l: gt(o, t) })) : Ue($(e, { r: gt(s, t) }));
return t < n ? Ke(T(e, { l: gt(o, t) })) : Ke(T(e, { r: gt(s, t) }));
}
function ue(e, t, n = "k") {
if (b(e))
function re(e, t, n = "k") {
if (m(e))
return [-1 / 0, void 0];

@@ -43,12 +43,12 @@ if (e[n] === t)

if (e[n] < t) {
const o = ue(e.r, t, n);
const o = re(e.r, t, n);
return o[0] === -1 / 0 ? [e.k, e.v] : o;
}
return ue(e.l, t, n);
return re(e.l, t, n);
}
function V(e, t, n) {
return b(e) ? Kt(t, n, 1) : t === e.k ? $(e, { k: t, v: n }) : t < e.k ? Vt($(e, { l: V(e.l, t, n) })) : Vt($(e, { r: V(e.r, t, n) }));
function H(e, t, n) {
return m(e) ? Kt(t, n, 1) : t === e.k ? T(e, { k: t, v: n }) : t < e.k ? Bt(T(e, { l: H(e.l, t, n) })) : Bt(T(e, { r: H(e.r, t, n) }));
}
function dt(e, t, n) {
if (b(e))
if (m(e))
return [];

@@ -59,35 +59,35 @@ const { k: o, v: s, l: i, r: l } = e;

}
function no(e, t, n, o) {
if (b(e))
return xe;
let s = ke();
for (const { k: i, v: l } of be(e))
i > t && i <= n ? s = V(s, ...o(i, l)) : s = V(s, i, l);
function lo(e, t, n, o) {
if (m(e))
return ye;
let s = me();
for (const { k: i, v: l } of ve(e))
i > t && i <= n ? s = H(s, ...o(i, l)) : s = H(s, i, l);
return s;
}
function oo(e, t, n) {
let o = ke(), s = -1;
for (const { start: i, end: l, value: r } of so(e))
i < t ? (o = V(o, i, r), s = r) : i > t + n ? o = V(o, i - n, r) : l >= t + n && s !== r && (o = V(o, t, r));
function ro(e, t, n) {
let o = me(), s = -1;
for (const { start: i, end: l, value: r } of co(e))
i < t ? (o = H(o, i, r), s = r) : i > t + n ? o = H(o, i - n, r) : l >= t + n && s !== r && (o = H(o, t, r));
return o;
}
function be(e) {
return b(e) ? [] : [...be(e.l), { k: e.k, v: e.v }, ...be(e.r)];
function ve(e) {
return m(e) ? [] : [...ve(e.l), { k: e.k, v: e.v }, ...ve(e.r)];
}
function jt(e) {
return b(e.r) ? [e.k, e.v] : jt(e.r);
return m(e.r) ? [e.k, e.v] : jt(e.r);
}
function Ut(e) {
return b(e.r) ? e.l : Ue($(e, { r: Ut(e.r) }));
return m(e.r) ? e.l : Ke(T(e, { r: Ut(e.r) }));
}
function $(e, t) {
function T(e, t) {
return Kt(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r);
}
function ft(e) {
return b(e) || e.lvl > e.r.lvl;
return m(e) || e.lvl > e.r.lvl;
}
function Vt(e) {
function Bt(e) {
return vt(Jt(e));
}
function Ue(e) {
function Ke(e) {
const { l: t, r: n, lvl: o } = e;

@@ -98,8 +98,8 @@ if (n.lvl >= o - 1 && t.lvl >= o - 1)

if (ft(t))
return Jt($(e, { lvl: o - 1 }));
if (!b(t) && !b(t.r))
return $(t.r, {
l: $(t, { r: t.r.l }),
return Jt(T(e, { lvl: o - 1 }));
if (!m(t) && !m(t.r))
return T(t.r, {
l: T(t, { r: t.r.l }),
lvl: o,
r: $(e, {
r: T(e, {
l: t.r.r,

@@ -112,7 +112,7 @@ lvl: o - 1

if (ft(e))
return vt($(e, { lvl: o - 1 }));
if (!b(n) && !b(n.l)) {
return vt(T(e, { lvl: o - 1 }));
if (!m(n) && !m(n.l)) {
const s = n.l, i = ft(s) ? n.lvl - 1 : n.lvl;
return $(s, {
l: $(e, {
return T(s, {
l: T(e, {
lvl: o - 1,

@@ -122,3 +122,3 @@ r: s.l

lvl: s.lvl + 1,
r: vt($(n, { l: s.r, lvl: i }))
r: vt(T(n, { l: s.r, lvl: i }))
});

@@ -129,9 +129,9 @@ } else

}
function so(e) {
return Zt(be(e));
function co(e) {
return Zt(ve(e));
}
function qt(e, t, n) {
if (b(e))
if (m(e))
return [];
const o = ue(e, t)[0];
const o = re(e, t)[0];
return Zt(dt(e, o, n));

@@ -156,42 +156,42 @@ }

const { r: t, lvl: n } = e;
return !b(t) && !b(t.r) && t.lvl === n && t.r.lvl === n ? $(t, { l: $(e, { r: t.l }), lvl: n + 1 }) : e;
return !m(t) && !m(t.r) && t.lvl === n && t.r.lvl === n ? T(t, { l: T(e, { r: t.l }), lvl: n + 1 }) : e;
}
function Jt(e) {
const { l: t } = e;
return !b(t) && t.lvl === e.lvl ? $(t, { r: $(e, { l: t.r }) }) : e;
return !m(t) && t.lvl === e.lvl ? T(t, { r: T(e, { l: t.r }) }) : e;
}
function io(e) {
function uo(e) {
const { size: t, startIndex: n, endIndex: o } = e;
return (s) => s.start === n && (s.end === o || s.end === 1 / 0) && s.value === t;
}
function lo(e, t) {
let n = b(e) ? 0 : 1 / 0;
function ao(e, t) {
let n = m(e) ? 0 : 1 / 0;
for (const o of t) {
const { size: s, startIndex: i, endIndex: l } = o;
if (n = Math.min(n, i), b(e)) {
e = V(e, 0, s);
if (n = Math.min(n, i), m(e)) {
e = H(e, 0, s);
continue;
}
const r = qt(e, i - 1, l + 1);
if (r.some(io(o)))
if (r.some(uo(o)))
continue;
let u = !1, h = !1;
for (const { start: f, end: m, value: y } of r)
u ? (l >= f || s === y) && (e = gt(e, f)) : (h = y !== s, u = !0), m > l && l >= f && y !== s && (e = V(e, l + 1, y));
h && (e = V(e, i, s));
let u = !1, f = !1;
for (const { start: p, end: b, value: k } of r)
u ? (l >= p || s === k) && (e = gt(e, p)) : (f = k !== s, u = !0), b > l && l >= p && k !== s && (e = H(e, l + 1, k));
f && (e = H(e, i, s));
}
return [e, n];
}
const nt = [ke(), 0];
function ro(e, [t, n]) {
if (n.length > 0 && b(e) && t.length === 2) {
const et = [me(), 0];
function po(e, [t, n]) {
if (n.length > 0 && m(e) && t.length === 2) {
const o = t[0].size, s = t[1].size;
return [
n.reduce((i, l) => V(V(i, l, o), l + 1, s), ke()),
n.reduce((i, l) => H(H(i, l, o), l + 1, s), me()),
0
];
} else
return lo(e, t);
return ao(e, t);
}
function et(e, t, n, o = 0) {
function Xe(e, t, n, o = 0) {
let s = e.length - 1;

@@ -215,32 +215,32 @@ for (; o <= s; ) {

function Xt(e, t, n) {
return e[et(e, t, n)];
return e[Xe(e, t, n)];
}
function co(e, t, n, o) {
const s = et(e, t, o), i = et(e, n, o, s);
function fo(e, t, n, o) {
const s = Xe(e, t, o), i = Xe(e, n, o, s);
return e.slice(s, i + 1);
}
function At({ index: e }, t) {
function Ct({ index: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function uo({ offset: e }, t) {
function ho({ offset: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function ao(e) {
function go(e) {
return { index: e.index, value: e };
}
function po(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, Xt(e, o, At).offset)), t = Math.max(0, t), Gt(co(e, t, n, uo), ao);
function vo(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, Xt(e, o, Ct).offset)), t = Math.max(0, t), Gt(fo(e, t, n, ho), go);
}
const Te = [[], 0, 0, 0];
function fo(e, [t, n]) {
const xe = [[], 0, 0, 0];
function bo(e, [t, n]) {
let o = 0, s = 0, i = 0, l = 0;
if (n !== 0) {
l = et(e, n - 1, At), i = e[l].offset;
const u = ue(t, n - 1);
o = u[0], s = u[1], e.length && e[l].height === ue(t, n)[1] && (l -= 1), e = e.slice(0, l + 1);
l = Xe(e, n - 1, Ct), i = e[l].offset;
const u = re(t, n - 1);
o = u[0], s = u[1], e.length && e[l].height === re(t, n)[1] && (l -= 1), e = e.slice(0, l + 1);
} else
e = [];
for (const { start: r, value: u } of qt(t, n, 1 / 0)) {
const h = (r - o) * s + i;
e.push({ height: u, index: r, offset: h }), o = r, i = h, s = u;
const f = (r - o) * s + i;
e.push({ height: u, index: r, offset: f }), o = r, i = f, s = u;
}

@@ -252,6 +252,6 @@ return [e, s, i, o];

return [0, 0];
const { offset: n, index: o, height: s } = Xt(t, e, At);
const { offset: n, index: o, height: s } = Xt(t, e, Ct);
return [s * (e - o) + n, s];
}
function ho(e, t) {
function mo(e, t) {
return Qt(e, t)[0];

@@ -268,6 +268,6 @@ }

}
function go(e) {
function ko(e) {
return e === 1 ? 1 : 1 - Math.pow(2, -10 * e);
}
const on = "up", ht = "down", vo = "none", bo = {
const on = "up", ht = "down", So = "none", Io = {
atBottom: !1,

@@ -282,4 +282,4 @@ notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",

}
}, mo = 0, ko = 4;
function Wt(e) {
}, yo = 0, xo = 4;
function Vt(e) {
return (t, n) => {

@@ -294,9 +294,9 @@ const o = n.signalInstance();

const sn = c(!0);
k();
const ve = c(!1), yo = k((e) => {
e.link(e.pipe(sn, we(50)), yo);
}), ln = c(ko), Io = c(mo, (e) => {
S();
const de = c(!1), To = S((e) => {
e.link(e.pipe(sn, Ee(50)), To);
}), ln = c(xo), $o = c(yo, (e) => {
e.link(
e.pipe(
e.combine(T, Io),
e.combine(x, $o),
a(([t, n]) => t <= n)

@@ -306,7 +306,7 @@ ),

);
}), Ce = c(!1, (e) => {
e.link(e.pipe(T, Wt(1), H(!0)), Ce), e.link(e.pipe(T, Wt(1), H(!1), ce(100)), Ce);
}), De = c(!1, (e) => {
e.link(e.pipe(x, Vt(1), O(!0)), De), e.link(e.pipe(x, Vt(1), O(!1), le(100)), De);
}), bt = c(!1, (e) => {
e.link(e.pipe(se, H(!0)), bt), e.link(e.pipe(se, H(!1), ce(200)), bt);
}), rn = c(!1), qe = c(
e.link(e.pipe(te, O(!0)), bt), e.link(e.pipe(te, O(!1), le(200)), bt);
}), rn = c(!1), je = c(
null,

@@ -316,6 +316,6 @@ (e) => {

e.pipe(
e.combine($e, T, J, dn, ln, rt, Z),
v(([, , , , , , t]) => !b(t)),
q((t, [n, o, s, i, l]) => {
const u = o + s - n > -l, h = {
e.combine(Te, x, Z, dn, ln, it, G),
v(([, , , , , , t]) => !m(t)),
U((t, [n, o, s, i, l]) => {
const u = o + s - n > -l, f = {
viewportWidth: i,

@@ -327,26 +327,26 @@ viewportHeight: s,

if (u) {
let m, y;
return o > t.state.scrollTop ? (m = "SCROLLED_DOWN", y = t.state.scrollTop - o) : (m = n === s ? "LIST_TOO_SHORT" : "SIZE_DECREASED", y = t.state.scrollTop - o || t.scrollTopDelta), {
let b, k;
return o > t.state.scrollTop ? (b = "SCROLLED_DOWN", k = t.state.scrollTop - o) : (b = n === s ? "LIST_TOO_SHORT" : "SIZE_DECREASED", k = t.state.scrollTop - o || t.scrollTopDelta), {
atBottom: !0,
state: h,
atBottomBecause: m,
scrollTopDelta: y
state: f,
atBottomBecause: b,
scrollTopDelta: k
};
}
let f;
return s < t.state.viewportHeight ? f = "VIEWPORT_HEIGHT_DECREASING" : i < t.state.viewportWidth ? f = "VIEWPORT_WIDTH_DECREASING" : h.scrollHeight > t.state.scrollHeight ? f = "SIZE_INCREASED" : o < t.state.scrollTop ? f = "SCROLLING_UPWARDS" : f = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
let p;
return s < t.state.viewportHeight ? p = "VIEWPORT_HEIGHT_DECREASING" : i < t.state.viewportWidth ? p = "VIEWPORT_WIDTH_DECREASING" : f.scrollHeight > t.state.scrollHeight ? p = "SIZE_INCREASED" : o < t.state.scrollTop ? p = "SCROLLING_UPWARDS" : p = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
atBottom: !1,
notAtBottomBecause: f,
state: h
notAtBottomBecause: p,
state: f
};
}, bo)
}, Io)
),
qe
je
), e.link(
e.pipe(
qe,
we(10),
je,
Ee(10),
// withLatestFrom(scrollToInProgress$),
// filter(([, inProgress]) => !inProgress),
q(
U(
({ prev: t }, n) => {

@@ -366,5 +366,5 @@ const o = !!(t && n && t.atBottom && !n.atBottom && n.notAtBottomBecause === "SIZE_INCREASED");

e.pipe(
J,
S(qe),
q(
Z,
y(je),
U(
(t, [n, o]) => {

@@ -378,3 +378,3 @@ let s = 0;

(t) => {
t.delta && e.pub(se, { top: t.delta });
t.delta && e.pub(te, { top: t.delta });
}

@@ -387,4 +387,4 @@ );

e.pipe(
e.combine(T, $e, J),
q(
e.combine(x, Te, Z),
U(
(t, [n, o, s]) => {

@@ -423,4 +423,4 @@ if (en(t.scrollHeight, o))

e.pipe(
T,
q(
x,
U(
(t, n) => e.getValue(bt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? on : ht, prevScrollTop: n },

@@ -432,17 +432,17 @@ { direction: ht, prevScrollTop: 0 }

mt
), e.link(e.pipe(T, ce(100), H(vo)), mt);
}), Bt = c(0, (e) => {
e.link(e.pipe(Ce, v(nn), H(0)), Bt), e.link(
), e.link(e.pipe(x, le(100), O(So)), mt);
}), Wt = c(0, (e) => {
e.link(e.pipe(De, v(nn), O(0)), Wt), e.link(
e.pipe(
T,
we(100),
S(Ce),
x,
Ee(100),
y(De),
v(([, t]) => !!t),
q(([, t], [n]) => [t, n], [0, 0]),
U(([, t], [n]) => [t, n], [0, 0]),
a(([t, n]) => n - t)
),
Bt
Wt
);
});
function Ct(e, t) {
function Dt(e, t) {
if (typeof e == "number")

@@ -474,16 +474,16 @@ return {

}) {
const { align: h, behavior: f, offset: m, index: y } = Ct(e, s - 1);
function P() {
const X = ue(t, y)[1];
if (X === void 0)
throw new Error(`Item at index ${y} not found`);
return X;
const { align: f, behavior: p, offset: b, index: k } = Dt(e, s - 1);
function C() {
const J = re(t, k)[1];
if (J === void 0)
throw new Error(`Item at index ${k} not found`);
return J;
}
i -= r + u;
let d = ho(y, n) + l - r;
h === "end" ? d = d - i + P() : h === "center" && (d = d - i / 2 + P() / 2), m && (d += m);
let Y = 0;
return h === "start" && (Y = Math.max(0, Math.min(d - (o - i)))), d = Math.max(0, d), { top: d, behavior: f, align: h, forceBottomSpace: Y };
let d = mo(k, n) + l - r;
f === "end" ? d = d - i + C() : f === "center" && (d = d - i / 2 + C() / 2), b && (d += b);
let P = 0;
return f === "start" && (P = Math.max(0, Math.min(d - (o - i)))), d = Math.max(0, d), { top: d, behavior: p, align: f, forceBottomSpace: P };
}
const Me = c(null), So = c(!1), Ge = c(!0), kt = k((e) => {
const Me = c(null), Eo = c(!1), Ue = c(!0), kt = S((e) => {
e.link(

@@ -494,3 +494,3 @@ e.pipe(

),
Ge
Ue
), e.link(

@@ -503,11 +503,11 @@ e.pipe(

);
}), an = k((e) => {
}), an = S((e) => {
e.link(
e.pipe(
an,
S(ye, it, Pe),
y(ke, ot, Pe),
a(([t, n, o, s]) => {
let { align: i, behavior: l, offset: r, index: u } = Ct(t, n - 1);
const h = typeof t != "number" ? t.done : void 0, [f, m] = Qt(u, o);
return f < -s.listOffset ? ((typeof t == "number" || t.align === void 0) && (i = "start-no-overflow"), { index: u, align: i, behavior: l, offset: r, done: h }) : f + m > -s.listOffset + s.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (i = "end"), { index: u, align: i, behavior: l, offset: r, done: h }) : null;
let { align: i, behavior: l, offset: r, index: u } = Dt(t, n - 1);
const f = typeof t != "number" ? t.done : void 0, [p, b] = Qt(u, o);
return p < -s.listOffset ? ((typeof t == "number" || t.align === void 0) && (i = "start-no-overflow"), { index: u, align: i, behavior: l, offset: r, done: f }) : p + b > -s.listOffset + s.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (i = "end"), { index: u, align: i, behavior: l, offset: r, done: f }) : null;
}),

@@ -517,14 +517,14 @@ v((t) => t !== null)

// @ts-expect-error contra variance
U
j
);
}), U = k((e) => {
}), j = S((e) => {
const t = e.pipe(
U,
S(
j,
y(
G,
ot,
ke,
Z,
it,
ye,
J,
lt,
Be,
st,
Ve,
Fe,

@@ -534,7 +534,7 @@ Re

a(
([n, o, s, i, l, r, u, h, f]) => {
([n, o, s, i, l, r, u, f, p]) => {
try {
return un({
location: n,
totalHeight: f,
totalHeight: p,
sizeTree: o,

@@ -546,3 +546,3 @@ offsetTree: s,

stickyHeaderHeight: u,
stickyFooterHeight: h
stickyFooterHeight: f
});

@@ -556,84 +556,84 @@ } catch {

);
e.link(U, Me), e.link(t, Ee), e.link(
e.link(j, Me), e.link(t, $e), e.link(
e.pipe(
U,
j,
v((n) => typeof n != "number" && n.index === "LAST"),
H(!0)
O(!0)
),
ve
), e.link(e.pipe(t, H(!1)), Ge), e.link(e.pipe(t, H(!1)), So), e.link(
de
), e.link(e.pipe(t, O(!1)), Ue), e.link(e.pipe(t, O(!1)), Eo), e.link(
e.pipe(
Z,
ce(0),
S(Ge, Me),
G,
le(0),
y(Ue, Me),
v(([, n, o]) => !n && o !== null),
a(([, , n]) => n)
),
U
), e.sub(e.pipe(He, we(20)), () => {
j
), e.sub(e.pipe(He, Ee(20)), () => {
const n = e.getValue(Me);
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({
[Me]: null,
[Ge]: !0
[Ue]: !0
});
}), e.link(
e.pipe(
Qe,
Je,
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by
Dt(),
Mt(),
v((n) => n !== 0),
a((n) => ({ top: n }))
),
se
te
), e.link(
e.pipe(
Qe,
zt(T),
Je,
Yt(x),
a(() => 0)
),
Qe
Je
);
}), De = c(null), tt = c(null, (e) => {
}), Ae = c(null), Qe = c(null, (e) => {
e.link(
e.pipe(
tt,
Qe,
v((n) => n !== null)
),
De
Ae
);
const t = e.pipe(
e.combine(tt, Z),
S(De),
v(([[n, o], s]) => n !== null && !b(o) && s !== null),
ce(10),
e.combine(Qe, G),
y(Ae),
v(([[n, o], s]) => n !== null && !m(o) && s !== null),
le(10),
a(([[n]]) => n)
);
e.link(e.pipe(t, Dt()), U), e.link(
e.link(e.pipe(t, Mt()), j), e.link(
e.pipe(
t,
zt(e.pipe(We, v(nn))),
H(null),
Yt(e.pipe(Be, v(nn))),
O(null),
// unset the location after the scroll completes
ce(10)
le(10)
),
De
Ae
);
});
function xo(e, t) {
function Ro(e, t) {
const n = t.slice();
let o = 0;
const s = [];
be(e).forEach(({ k: l, v: r }) => {
var f, m;
ve(e).forEach(({ k: l, v: r }) => {
var p, b;
for (; n.length && n[0] < l; )
n.shift(), o++;
const u = Math.max(0, l - o), h = ((f = s.at(-1)) == null ? void 0 : f.k) ?? -1;
u === h ? (((m = s.at(-2)) == null ? void 0 : m.v) ?? -1) === r ? s.pop() : s[s.length - 1].v = r : s.push({ k: u, v: r });
const u = Math.max(0, l - o), f = ((p = s.at(-1)) == null ? void 0 : p.k) ?? -1;
u === f ? (((b = s.at(-2)) == null ? void 0 : b.v) ?? -1) === r ? s.pop() : s[s.length - 1].v = r : s.push({ k: u, v: r });
});
let i = ke();
let i = me();
return s.forEach(({ k: l, v: r }) => {
i = V(i, l, r);
i = H(i, l, r);
}), i;
}
function To(e, t) {
function wo(e, t) {
return [

@@ -651,4 +651,4 @@ {

}
const $o = [], Ye = {
items: $o,
const Lo = [], Ne = {
items: Lo,
listBottom: 0,

@@ -661,22 +661,22 @@ listTop: 0,

data: null
}, Ve = c(Ye, (e) => {
}, _e = c(Ne, (e) => {
e.link(
e.pipe(
e.combine(
Eo,
bn,
Z,
it,
ye,
Mo,
yn,
G,
ot,
ke,
Re,
W,
_,
Je,
Qe,
tt,
De,
_e,
Be,
Ae,
We,
Ve,
Fe,
F,
G,
_
W,
q,
V
),

@@ -687,3 +687,3 @@ v((t) => {

}),
q(
U(
(t, [

@@ -697,67 +697,67 @@ n,

u,
h,
f,
m,
y,
P,
p,
b,
k,
C,
d,
Y
P
]) => {
var he;
var pe;
if ((u == null ? void 0 : u.length) === 0)
return Ye;
if (b(s)) {
let D = 0;
return f !== null && (D = Ct(f, l - 1).index), { ...Ye, items: To(D, u), offsetTree: i, totalCount: l, data: u };
return Ne;
if (m(s)) {
let Y = 0;
return p !== null && (Y = Dt(p, l - 1).index), { ...Ne, items: wo(Y, u), offsetTree: i, totalCount: l, data: u };
}
let X = 0;
m !== null && n === 0 && (X = un({
let J = 0;
b !== null && n === 0 && (J = un({
totalHeight: r,
location: m,
location: b,
sizeTree: s,
offsetTree: i,
totalCount: l,
viewportHeight: e.getValue(J),
headerHeight: e.getValue(lt),
stickyHeaderHeight: P,
viewportHeight: e.getValue(Z),
headerHeight: e.getValue(st),
stickyHeaderHeight: C,
stickyFooterHeight: d
}).top ?? 0);
const Q = Math.max(
n + X + h - Y - y,
const X = Math.max(
n + J + f - P - k,
0
), pe = Q + o;
if (t.offsetTree === i && t.totalCount === l && t.data === u && Q >= t.listTop && pe <= t.listBottom)
), ue = X + o;
if (t.offsetTree === i && t.totalCount === l && t.data === u && X >= t.listTop && ue <= t.listBottom)
return t;
const fe = [], j = l - 1, N = 0, z = po(i, Q, pe, N);
let K = 0, Ne = 0, E = !1;
for (const D of z) {
const ae = [], we = l - 1, ne = 0, z = vo(i, X, ue, ne);
let R = 0, B = 0, $ = !1;
for (const Y of z) {
const {
value: { offset: ie, height: le }
} = D;
let te = D.start;
K = ie, ie < Q && (te += Math.floor((Q - ie) / le), K += (te - D.start) * le), te < N && (K += (N - te) * le, te = N);
const ze = Math.min(D.end, j);
for (let ne = te; ne <= ze && !(K >= pe); ne++) {
const Le = {
data: u == null ? void 0 : u[ne],
prevData: (u == null ? void 0 : u[ne - 1]) ?? null,
nextData: (u == null ? void 0 : u[ne + 1]) ?? null,
height: le,
index: ne,
offset: K,
value: { offset: Se, height: oe }
} = Y;
let K = Y.start;
R = Se, Se < X && (K += Math.floor((X - Se) / oe), R += (K - Y.start) * oe), K < ne && (R += (ne - K) * oe, K = ne);
const Le = Math.min(Y.end, we);
for (let se = K; se <= Le && !(R >= ue); se++) {
const ct = {
data: u == null ? void 0 : u[se],
prevData: (u == null ? void 0 : u[se - 1]) ?? null,
nextData: (u == null ? void 0 : u[se + 1]) ?? null,
height: oe,
index: se,
offset: R,
type: "flat"
};
E || (E = !0, Ne = K), fe.push(Le), K += le;
$ || ($ = !0, B = R), ae.push(ct), R += oe;
}
}
const ee = r - K, ut = ((he = fe[0]) == null ? void 0 : he.offset) || 0;
return { items: fe, listBottom: K, listTop: Ne, offsetTree: i, paddingBottom: ee, paddingTop: ut, totalCount: l, data: u };
const Q = r - R, rt = ((pe = ae[0]) == null ? void 0 : pe.offset) || 0;
return { items: ae, listBottom: R, listTop: B, offsetTree: i, paddingBottom: Q, paddingTop: rt, totalCount: l, data: u };
},
Ye
Ne
)
),
Ve
_e
);
}), yt = me([], (e) => e.pipe(
e.combine(Ve, T),
}), St = be([], (e) => e.pipe(
e.combine(_e, x),
a(([t, n]) => {

@@ -769,13 +769,13 @@ const o = t.items.slice();

})
)), _ = c(!1), Ze = k((e) => {
)), V = c(!1), qe = S((e) => {
e.link(
e.pipe(
Ve,
S(cn, G),
_e,
y(cn, q),
v(([, , t]) => !t),
q(
U(
([, t, n, o], [{ items: s, totalCount: i, listBottom: l, paddingBottom: r }, u]) => {
const h = l + r;
let f = 0;
return n === i && t.length > 0 && s.length > 0 && (f = h - o, f !== 0 && (f += u)), [f, s, i, h];
const f = l + r;
let p = 0;
return n === i && t.length > 0 && s.length > 0 && (p = f - o, p !== 0 && (p += u)), [p, s, i, f];
},

@@ -785,35 +785,35 @@ [0, [], 0, 0]

v(([t]) => t !== 0),
S(T, mt, We),
y(x, mt, Be),
v(([, t, n, o]) => !o && t !== 0 && n === on),
a(([[t]]) => t)
),
Ze
), tn() ? (e.sub(e.pipe(Ze, S(F, T)), ([t, n]) => {
e.pub(F, n - t);
}), e.sub(e.pipe(e.combine(T, F, G)), ([t, n, o]) => {
o || (n > 0 && t < n ? (e.pub(_, !0), e.pub(Ee, { top: 0, behavior: "instant" }), setTimeout(() => {
qe
), tn() ? (e.sub(e.pipe(qe, y(W, x)), ([t, n]) => {
e.pub(W, n - t);
}), e.sub(e.pipe(e.combine(x, W, q)), ([t, n, o]) => {
o || (n > 0 && t < n ? (e.pub(V, !0), e.pub($e, { top: 0, behavior: "instant" }), setTimeout(() => {
e.pubIn({
[_]: !1,
[F]: 0
[V]: !1,
[W]: 0
});
})) : n < 0 && t <= 0 && (e.pubIn({
[_]: !0,
[F]: 0
[V]: !0,
[W]: 0
}), setTimeout(() => {
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(_, !1);
e.pub($e, { top: 0, behavior: "instant" }), e.pub(V, !1);
})));
}), e.sub(
e.pipe(
e.combine(Ce, F, _, G),
e.combine(De, W, V, q),
v(([t, n, o, s]) => !t && n !== 0 && !o && !s),
we(100)
Ee(100)
),
([, t]) => {
e.pub(_, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(se, { top: -t, behavior: "instant" }), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(_, !1);
e.pub(V, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(te, { top: -t, behavior: "instant" }), e.pub(W, 0), requestAnimationFrame(() => {
e.pub(V, !1);
});
}) : requestAnimationFrame(() => {
e.pub(se, { top: -t, behavior: "instant" }), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(_, !1);
e.pub(te, { top: -t, behavior: "instant" }), e.pub(W, 0), requestAnimationFrame(() => {
e.pub(V, !1);
});

@@ -824,30 +824,30 @@ });

e.pipe(
Ze,
qe,
a((t) => ({ top: t, behavior: "auto" }))
),
se
te
);
}), ye = c(0), Oe = c(null), W = c(null, (e) => {
}), ke = c(0), Oe = c(null), _ = c(null, (e) => {
e.link(
e.pipe(
W,
_,
v((t) => t !== null),
a((t) => t.length)
),
ye
ke
);
}), de = k((e) => {
e.link(e.pipe(de, H(!0)), G);
}), ge = S((e) => {
e.link(e.pipe(ge, O(!0)), q);
const t = tn();
e.link(
e.pipe(
de,
S(Se),
ge,
y(Ie),
a(([n, o]) => o * n.length)
),
F
), e.link(e.pipe(de, H(t)), _), e.sub(
W
), e.link(e.pipe(ge, O(t)), V), e.sub(
e.pipe(
de,
S(Se),
ge,
y(Ie),
a(([n, o]) => ({

@@ -857,24 +857,24 @@ top: o * n.length,

})),
Dt()
Mt()
),
(n) => {
e.pubIn({
[se]: n
[te]: n
}), t ? setTimeout(() => {
e.pub(F, 0), e.pub(G, !1), e.pub(_, !1);
e.pub(W, 0), e.pub(q, !1), e.pub(V, !1);
}, 100) : requestAnimationFrame(() => {
e.pub(F, 0), e.pub(G, !1);
e.pub(W, 0), e.pub(q, !1);
});
}
), e.changeWith(W, de, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
), e.changeWith(_, ge, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
e.pipe(
de,
S(Z, Se),
ge,
y(G, Ie),
a(([n, o, s]) => {
const i = n.length, l = s;
return be(o).reduce(
(r, { k: u, v: h }) => ({
return ve(o).reduce(
(r, { k: u, v: f }) => ({
ranges: [...r.ranges, { startIndex: r.prevIndex, endIndex: u + i - 1, size: r.prevSize }],
prevIndex: u + i,
prevSize: h
prevSize: f
}),

@@ -889,9 +889,9 @@ {

),
st
nt
);
}), ot = k((e) => {
}), tt = S((e) => {
const t = e.pipe(
ot,
S(Pe, Tt, Oe, Z),
v(([, , , , o]) => !b(o)),
tt,
y(Pe, Tt, Oe, G),
v(([, , , , o]) => !m(o)),
a(([{ data: o, scrollToBottom: s }, i, l, r]) => {

@@ -901,14 +901,14 @@ if (s === !1 || s === void 0)

let u = "auto";
const h = i.isAtBottom;
const f = i.isAtBottom;
if (typeof s == "function") {
const f = s({ data: o, scrollLocation: i, scrollInProgress: l, context: r, atBottom: h });
if (!f)
const p = s({ data: o, scrollLocation: i, scrollInProgress: l, context: r, atBottom: f });
if (!p)
return null;
if (typeof f == "object")
return f;
if (typeof f == "number")
return { index: f, align: "end", behavior: "auto" };
u = f;
if (typeof p == "object")
return p;
if (typeof p == "number")
return { index: p, align: "end", behavior: "auto" };
u = p;
} else {
if (!h)
if (!f)
return null;

@@ -926,15 +926,15 @@ u = s;

),
ve
de
), e.link(
e.pipe(
He,
S(ve),
y(de),
v(([o, s]) => s),
a(() => !1)
),
ve
de
);
const n = e.pipe(
Rt,
S(ve),
Ht,
y(de),
v(([o, s]) => o === "up" && s)

@@ -947,41 +947,41 @@ );

),
ve
), e.link(e.pipe(n, H(!0)), kt), e.link(
de
), e.link(e.pipe(n, O(!0)), kt), e.link(
e.pipe(
t,
v((o) => o !== null),
ce(20)
le(20)
),
U
j
);
}), It = k((e) => {
e.changeWith(W, It, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(It, ot);
}), Je = k((e) => {
e.changeWith(W, Je, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ae, Je, ([t], n) => {
const s = ue(t, n.offset, "k")[0], i = n.data.length;
return [no(t, s, 1 / 0, (r, u) => [r + i, u]), s];
}), e.link(Je, ot);
}), St = k((e) => {
e.changeWith(W, St, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ae, St, ([t], { offset: n, count: o }) => [oo(t, n, o), n]);
}), Xe = k((e) => {
e.changeWith(W, Xe, (t, n) => n.data.slice()), e.link(
}), It = S((e) => {
e.changeWith(_, It, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(It, tt);
}), Ge = S((e) => {
e.changeWith(_, Ge, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ce, Ge, ([t], n) => {
const s = re(t, n.offset, "k")[0], i = n.data.length;
return [lo(t, s, 1 / 0, (r, u) => [r + i, u]), s];
}), e.link(Ge, tt);
}), yt = S((e) => {
e.changeWith(_, yt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ce, yt, ([t], { offset: n, count: o }) => [ro(t, n, o), n]);
}), Ze = S((e) => {
e.changeWith(_, Ze, (t, n) => n.data.slice()), e.link(
e.pipe(
Xe,
Ze,
a(({ initialLocation: t }) => t)
),
U
), e.changeWith(ae, Xe, (t, n) => {
const o = ue(t[0], 1 / 0, "k")[1];
j
), e.changeWith(ce, Ze, (t, n) => {
const o = re(t[0], 1 / 0, "k")[1];
if (!o)
return nt;
let s = ke();
return s = V(s, 0, o), [s, 0];
return et;
let s = me();
return s = H(s, 0, o), [s, 0];
});
}), _t = k((e) => {
e.changeWith(W, _t, (t, n) => t ? t.slice(n) : []), e.changeWith(ae, _t, ([t], n) => [be(t).reduce((s, { k: i, v: l }) => V(s, Math.max(0, i - n), l), ke()), 0]);
}), Ft = k((e) => {
e.changeWith(W, Ft, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
}), Ft = S((e) => {
e.changeWith(_, Ft, (t, n) => t ? t.slice(n) : []), e.changeWith(ce, Ft, ([t], n) => [ve(t).reduce((s, { k: i, v: l }) => H(s, Math.max(0, i - n), l), me()), 0]);
}), Pt = S((e) => {
e.changeWith(_, Pt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
e.pipe(
Ft,
S(ye, Se),
Pt,
y(ke, Ie),
a(([, t, n]) => [

@@ -995,8 +995,8 @@ {

),
st
nt
);
}), pn = k((e) => {
}), pn = S((e) => {
const t = e.pipe(
pn,
S(W),
y(_),
a(([n, o]) => {

@@ -1011,15 +1011,15 @@ if (!o)

);
e.changeWith(W, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ae, t, ([n], o) => [xo(n, o), 0]);
}), xt = k((e) => {
e.changeWith(W, xt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.changeWith(_, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ce, t, ([n], o) => [Ro(n, o), 0]);
}), xt = S((e) => {
e.changeWith(_, xt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.pipe(
xt,
we(40),
S(rn),
Ee(40),
y(rn),
v(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),
a(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t }))
),
U
j
);
}), st = k();
}), nt = S();
c([]);

@@ -1030,24 +1030,24 @@ c([]);

c(NaN);
const G = c(!1), ae = c(nt, (e) => {
const q = c(!1), ce = c(et, (e) => {
e.link(
e.pipe(
st,
nt,
v((t) => t.length > 0),
S(Z),
a(([t, n]) => ro(n, [t, []]))
y(G),
a(([t, n]) => po(n, [t, []]))
),
ae
ce
);
}), Z = c(nt[0], (e) => {
}), G = c(et[0], (e) => {
e.link(
e.pipe(
ae,
ce,
a(([t]) => t)
),
Z
G
);
}), fn = c(nt[1], (e) => {
}), fn = c(et[1], (e) => {
e.link(
e.pipe(
ae,
ce,
a(([, t]) => t)

@@ -1057,27 +1057,27 @@ ),

);
}), Se = c(Te[1]), it = c(Te[0]), Ae = c(Te, (e) => {
}), Ie = c(xe[1]), ot = c(xe[0]), Ce = c(xe, (e) => {
e.link(
e.pipe(
Z,
S(fn),
q(([t], [n, o]) => fo(t, [n, o]), Te)
G,
y(fn),
U(([t], [n, o]) => bo(t, [n, o]), xe)
),
Ae
Ce
), e.link(
e.pipe(
Ae,
Ce,
a(([, t]) => t)
),
Se
Ie
), e.link(
e.pipe(
Ae,
Ce,
a(([t]) => t)
),
it
ot
);
}), hn = c(Te[2], (e) => {
}), hn = c(xe[2], (e) => {
e.link(
e.pipe(
Ae,
Ce,
a(([, , t]) => t)

@@ -1087,6 +1087,6 @@ ),

);
}), gn = c(Te[3], (e) => {
}), gn = c(xe[3], (e) => {
e.link(
e.pipe(
Ae,
Ce,
a(([, , , t]) => t)

@@ -1099,3 +1099,3 @@ ),

e.pipe(
e.combine(ye, gn, hn, Se),
e.combine(ke, gn, hn, Ie),
a(([t, n, o, s]) => o + (t - n) * s)

@@ -1105,15 +1105,15 @@ ),

);
}), We = k(), Tt = c(!1), He = k((e) => {
e.link(e.pipe(He, H(!1)), We);
}), T = c(0), J = c(0), dn = c(0), $e = c(0), Eo = T, Qe = c(0), Be = c(0), _e = c(0), Fe = c(0), Ot = c(0), $t = c(null), lt = me(0, (e) => e.pipe(
e.combine(Be, _e),
}), Be = S(), Tt = c(!1), He = S((e) => {
e.link(e.pipe(He, O(!1)), Be);
}), x = c(0), Z = c(0), dn = c(0), Te = c(0), Mo = x, Je = c(0), Ve = c(0), We = c(0), Fe = c(0), Ot = c(0), $t = c(null), vn = no(), bn = ko, mn = c(bn), kn = 50, Sn = c(kn), st = be(0, (e) => e.pipe(
e.combine(Ve, We),
a(([t, n]) => t + n)
)), vn = me(0, (e) => e.pipe(
)), In = be(0, (e) => e.pipe(
e.combine(Fe, Ot),
a(([t, n]) => t + n)
)), wo = me(0, (e) => e.pipe(
e.combine(Be, _e, T),
)), Ao = be(0, (e) => e.pipe(
e.combine(Ve, We, x),
a(([t, n, o]) => t + Math.max(n - o, 0))
)), Ro = me(0, (e) => e.pipe(
e.combine(Fe, Ot, T, J, $e),
)), Co = be(0, (e) => e.pipe(
e.combine(Fe, Ot, x, Z, Te),
a(([t, n, o, s, i]) => {

@@ -1123,30 +1123,30 @@ const l = Math.max(n - (i - (o + s)), 0);

})
)), bn = me(0, (e) => e.pipe(
e.combine(J, wo, Ro),
)), yn = be(0, (e) => e.pipe(
e.combine(Z, Ao, Co),
a(([t, n, o]) => t - n - o)
)), rt = c(0), mn = c(0, (e) => {
)), it = c(0), xn = c(0, (e) => {
e.link(
e.pipe(
e.combine(mn, Re, J),
e.combine(xn, Re, Z),
a(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o))))
),
rt
it
);
}), Ee = k((e) => {
}), $e = S((e) => {
e.link(
e.pipe(
Ee,
$e,
a((t) => t.align === "start" ? t.top ?? 0 : 0)
),
mn
xn
), e.link(
e.pipe(
Ee,
S(T),
$e,
y(x),
v(([t, n]) => t.top !== n),
H(!0)
O(!0)
),
We
Be
);
}), Pe = me(
}), Pe = be(
{

@@ -1161,13 +1161,13 @@ listOffset: 0,

e.combine(
T,
lt,
vn,
_e,
bn,
$e,
rt,
G,
De,
_,
ve
x,
st,
In,
We,
yn,
Te,
it,
q,
Ae,
V,
de
),

@@ -1185,13 +1185,13 @@ v(([, , , , , , , t, n, o]) => !t && n === null && !o),

u,
h,
f,
m
p,
b
]) => {
const y = e.getValue(ln), P = l - n - o, d = -t + s, Y = r === 0 ? P + Math.min(0, d) - i : -r;
const k = e.getValue(ln), C = l - n - o, d = -t + s, P = r === 0 ? C + Math.min(0, d) - i : -r;
return {
scrollHeight: P,
scrollHeight: C,
listOffset: d,
visibleListHeight: i,
bottomOffset: Y,
isAtBottom: m || Y <= y
bottomOffset: P,
isAtBottom: b || P <= k
};

@@ -1201,8 +1201,8 @@ }

)
), Et = k((e) => {
), Et = S((e) => {
e.link(
e.pipe(
T,
ce(0),
S(Pe),
x,
le(0),
y(Pe),
v(([, t]) => t.scrollHeight > 0),

@@ -1213,31 +1213,31 @@ a(([, t]) => t)

);
}), se = k(), F = c(0), wt = c(0), kn = c(""), Rt = k(), yn = ({ index: e }) => /* @__PURE__ */ Nt("div", { children: [
}), te = S(), W = c(0), Rt = c(0), Tn = c(""), Ht = S(), $n = ({ index: e }) => /* @__PURE__ */ zt("div", { children: [
"Item ",
e
] }), In = ({ index: e }) => e, Lt = c(yn), Sn = c(In), xn = c(null), Tn = c(null), $n = c(null), En = c(null), wn = c(null), Rn = c("div"), Lo = {
] }), En = ({ index: e }) => e, wt = c($n), Rn = c(En), wn = c(null), Ln = c(null), Mn = c(null), An = c(null), Cn = c(null), Dn = c("div"), Do = {
position: "sticky",
top: 0,
zIndex: 1
}, Ke = {
}, ze = {
overflowAnchor: "none"
}, Mo = {
}, Oo = {
position: "sticky",
bottom: 0
}, Ln = g.forwardRef((e, t) => /* @__PURE__ */ I("div", { style: { zIndex: 1 }, ...e, ref: t })), Mn = g.forwardRef((e, t) => /* @__PURE__ */ I("div", { ...e, ref: t })), Dn = g.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ I("div", { ...t, style: { ...Lo, ...e }, ref: n })
), An = g.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ I("div", { ...t, style: { ...Mo, ...e }, ref: n })
), Cn = c(Ln), On = c(Dn), Hn = c(Mn), Vn = c(An), Mt = c("top", (e) => {
}, On = g.forwardRef((e, t) => /* @__PURE__ */ I("div", { style: { zIndex: 1 }, ...e, ref: t })), Hn = g.forwardRef((e, t) => /* @__PURE__ */ I("div", { ...e, ref: t })), _n = g.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ I("div", { ...t, style: { ...Do, ...e }, ref: n })
), Bn = g.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ I("div", { ...t, style: { ...Oo, ...e }, ref: n })
), Vn = c(On), Wn = c(_n), Fn = c(Hn), Pn = c(Bn), Lt = c("top", (e) => {
e.link(
e.pipe(
e.combine(Mt, Re, J, lt, vn),
e.combine(Lt, Re, Z, st, In),
v(([t]) => t === "bottom" || t === "bottom-smooth"),
a(([, t, n, o, s]) => Math.max(0, n - t - o - s))
),
wt
Rt
), e.link(
e.pipe(
e.combine(wt, Mt),
e.combine(Rt, Lt),
v(([, t]) => t === "bottom-smooth"),
q(
U(
(t, [n]) => [t[1], n],

@@ -1248,9 +1248,9 @@ [0, 0]

),
kn
Tn
);
});
function Do(e) {
return Ao(Oo(Ho(Co(e), 8 * e.length))).toLowerCase();
function Ho(e) {
return _o(Vo(Wo(Bo(e), 8 * e.length))).toLowerCase();
}
function Ao(e) {
function _o(e) {
for (var t, n = "0123456789ABCDEF", o = "", s = 0; s < e.length; s++)

@@ -1260,3 +1260,3 @@ t = e.charCodeAt(s), o += n.charAt(t >>> 4 & 15) + n.charAt(15 & t);

}
function Co(e) {
function Bo(e) {
for (var t = Array(e.length >> 2), n = 0; n < t.length; n++)

@@ -1268,3 +1268,3 @@ t[n] = 0;

}
function Oo(e) {
function Vo(e) {
for (var t = "", n = 0; n < 32 * e.length; n += 8)

@@ -1274,18 +1274,18 @@ t += String.fromCharCode(e[n >> 5] >>> n % 32 & 255);

}
function Ho(e, t) {
function Wo(e, t) {
e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;
for (var n = 1732584193, o = -271733879, s = -1732584194, i = 271733878, l = 0; l < e.length; l += 16) {
const r = n, u = o, h = s, f = i;
o = M(
o = M(
o = M(
o = M(
o = L(
o = L(
o = L(
o = L(
o = R(
o = R(
o = R(
o = R(
const r = n, u = o, f = s, p = i;
o = A(
o = A(
o = A(
o = A(
o = M(
o = M(
o = M(
o = M(
o = L(
o = L(
o = L(
o = L(
o = w(

@@ -1356,5 +1356,5 @@ o = w(

),
s = R(
s = L(
s,
i = R(i, n = R(n, o, s, i, e[l + 1], 5, -165796510), o, s, e[l + 6], 9, -1069501632),
i = L(i, n = L(n, o, s, i, e[l + 1], 5, -165796510), o, s, e[l + 6], 9, -1069501632),
n,

@@ -1372,5 +1372,5 @@ o,

),
s = R(
s = L(
s,
i = R(i, n = R(n, o, s, i, e[l + 5], 5, -701558691), o, s, e[l + 10], 9, 38016083),
i = L(i, n = L(n, o, s, i, e[l + 5], 5, -701558691), o, s, e[l + 10], 9, 38016083),
n,

@@ -1388,5 +1388,5 @@ o,

),
s = R(
s = L(
s,
i = R(i, n = R(n, o, s, i, e[l + 9], 5, 568446438), o, s, e[l + 14], 9, -1019803690),
i = L(i, n = L(n, o, s, i, e[l + 9], 5, 568446438), o, s, e[l + 14], 9, -1019803690),
n,

@@ -1404,5 +1404,5 @@ o,

),
s = R(
s = L(
s,
i = R(i, n = R(n, o, s, i, e[l + 13], 5, -1444681467), o, s, e[l + 2], 9, -51403784),
i = L(i, n = L(n, o, s, i, e[l + 13], 5, -1444681467), o, s, e[l + 2], 9, -51403784),
n,

@@ -1420,5 +1420,5 @@ o,

),
s = L(
s = M(
s,
i = L(i, n = L(n, o, s, i, e[l + 5], 4, -378558), o, s, e[l + 8], 11, -2022574463),
i = M(i, n = M(n, o, s, i, e[l + 5], 4, -378558), o, s, e[l + 8], 11, -2022574463),
n,

@@ -1436,5 +1436,5 @@ o,

),
s = L(
s = M(
s,
i = L(i, n = L(n, o, s, i, e[l + 1], 4, -1530992060), o, s, e[l + 4], 11, 1272893353),
i = M(i, n = M(n, o, s, i, e[l + 1], 4, -1530992060), o, s, e[l + 4], 11, 1272893353),
n,

@@ -1452,5 +1452,5 @@ o,

),
s = L(
s = M(
s,
i = L(i, n = L(n, o, s, i, e[l + 13], 4, 681279174), o, s, e[l + 0], 11, -358537222),
i = M(i, n = M(n, o, s, i, e[l + 13], 4, 681279174), o, s, e[l + 0], 11, -358537222),
n,

@@ -1468,5 +1468,5 @@ o,

),
s = L(
s = M(
s,
i = L(i, n = L(n, o, s, i, e[l + 9], 4, -640364487), o, s, e[l + 12], 11, -421815835),
i = M(i, n = M(n, o, s, i, e[l + 9], 4, -640364487), o, s, e[l + 12], 11, -421815835),
n,

@@ -1484,5 +1484,5 @@ o,

),
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[l + 0], 6, -198630844), o, s, e[l + 7], 10, 1126891415),
i = A(i, n = A(n, o, s, i, e[l + 0], 6, -198630844), o, s, e[l + 7], 10, 1126891415),
n,

@@ -1500,5 +1500,5 @@ o,

),
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[l + 12], 6, 1700485571), o, s, e[l + 3], 10, -1894986606),
i = A(i, n = A(n, o, s, i, e[l + 12], 6, 1700485571), o, s, e[l + 3], 10, -1894986606),
n,

@@ -1516,5 +1516,5 @@ o,

),
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[l + 8], 6, 1873313359), o, s, e[l + 15], 10, -30611744),
i = A(i, n = A(n, o, s, i, e[l + 8], 6, 1873313359), o, s, e[l + 15], 10, -30611744),
n,

@@ -1532,5 +1532,5 @@ o,

),
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[l + 4], 6, -145523070), o, s, e[l + 11], 10, -1120210379),
i = A(i, n = A(n, o, s, i, e[l + 4], 6, -145523070), o, s, e[l + 11], 10, -1120210379),
n,

@@ -1547,96 +1547,96 @@ o,

-343485551
), n = re(n, r), o = re(o, u), s = re(s, h), i = re(i, f);
), n = ie(n, r), o = ie(o, u), s = ie(s, f), i = ie(i, p);
}
return [n, o, s, i];
}
function ct(e, t, n, o, s, i) {
return re(Vo(re(re(t, e), re(o, i)), s), n);
function lt(e, t, n, o, s, i) {
return ie(Fo(ie(ie(t, e), ie(o, i)), s), n);
}
function w(e, t, n, o, s, i, l) {
return ct(t & n | ~t & o, e, t, s, i, l);
return lt(t & n | ~t & o, e, t, s, i, l);
}
function R(e, t, n, o, s, i, l) {
return ct(t & o | n & ~o, e, t, s, i, l);
}
function L(e, t, n, o, s, i, l) {
return ct(t ^ n ^ o, e, t, s, i, l);
return lt(t & o | n & ~o, e, t, s, i, l);
}
function M(e, t, n, o, s, i, l) {
return ct(n ^ (t | ~o), e, t, s, i, l);
return lt(t ^ n ^ o, e, t, s, i, l);
}
function re(e, t) {
function A(e, t, n, o, s, i, l) {
return lt(n ^ (t | ~o), e, t, s, i, l);
}
function ie(e, t) {
const n = (65535 & e) + (65535 & t);
return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n;
}
function Vo(e, t) {
function Fo(e, t) {
return e << t | e >>> 32 - t;
}
const Wn = Symbol("INVALID_KEY");
function Wo(e) {
const Nn = Symbol("INVALID_KEY");
function Po(e) {
const t = e.slice(0, 32), n = e.slice(32), o = atob(n);
if (t !== Do(n))
return Wn;
if (t !== Ho(n))
return Nn;
const [s, i] = o.split(";"), l = s.slice(2), r = new Date(Number(i.slice(2)));
return { orderNumber: l, expiryDate: r };
}
const Bo = {
const No = {
valid: !1,
consoleMessage: "The VirtuosoMessageList license wrapper component is missing. Enclose the VirtuosoMessageList with VirtuosoMessageListLicense and add your key at the lisenceKey property.",
watermarkMessage: "The VirtuosoMessageList license wrapper component is missing. Enclose the VirtuosoMessageList with VirtuosoMessageListLicense and add your key at the lisenceKey property."
}, _o = {
}, zo = {
valid: !1,
consoleMessage: "Your VirtuosoMessageListLicense is missing a license key. Purchase one from https://virtuoso.dev/pricing/",
watermarkMessage: "Your VirtuosoMessageListLicense is missing a license key. Purchase one from https://virtuoso.dev/pricing/"
}, Fo = {
}, Yo = {
valid: !1,
consoleMessage: "Your VirtuosoMessageListLicense component is missing a license key - this component will not work if deployed in production. Purchase a key from https://virtuoso.dev/pricing/ before you deploy to production."
}, Bn = {
}, zn = {
valid: !0
}, Po = {
}, Ko = {
valid: !1,
consoleMessage: "Your Virtuoso Message List license key is invalid. Ensure that you have copy-pasted the key from the purchase email correctly.",
watermarkMessage: "Your Virtuoso Message List license key is invalid"
}, No = {
}, jo = {
valid: !1,
consoleMessage: "Your annual license key to use Virtuoso Message List in non-production environments has expired. You can still use it in production. To keep using it in development, purchase a new key from https://virtuoso.dev/pricing/",
watermarkMessage: "Your annual license key to use Virtuoso Message List in non-production environments has expired. You can still use it in production. To keep using it in development, purchase a new key from https://virtuoso.dev/pricing/"
}, zo = {
}, Uo = {
valid: !1,
consoleMessage: "You have installed a version of `@virtuoso.dev/message-list` that is newer than the period of your license key. Either downgrade to a supported version, or purchase a new license from https://virtuoso.dev/pricing/",
watermarkMessage: "You have installed a version of `@virtuoso.dev/message-list` that is newer than the period of your license key. Either downgrade to a supported version, or purchase a new license from https://virtuoso.dev/pricing/"
}, Yo = Bn, Ko = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, jo = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function Uo({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(Ko), i = jo.some((l) => n.endsWith(l));
}, qo = zn, Go = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, Zo = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function Jo({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(Go), i = Zo.some((l) => n.endsWith(l));
if (e) {
const l = Wo(e);
if (l === Wn)
return Po;
const l = Po(e);
if (l === Nn)
return Ko;
if (l.expiryDate.getTime() < t.getTime()) {
if (s)
return No;
return jo;
if (l.expiryDate.getTime() < o)
return zo;
return Uo;
}
} else
return i ? Yo : s ? Fo : _o;
return Bn;
return i ? qo : s ? Yo : zo;
return zn;
}
const _n = g.createContext(Bo), qo = ({
const Yn = g.createContext(No), Xo = ({
licenseKey: e,
children: t
}) => {
const n = Uo({
const n = Jo({
licenseKey: e,
hostname: typeof window < "u" ? window.location.hostname : "localhost",
now: /* @__PURE__ */ new Date(),
packageTimestamp: 1718645483219
packageTimestamp: 1718689239560
});
return /* @__PURE__ */ I(_n.Provider, { value: n, children: t });
return /* @__PURE__ */ I(Yn.Provider, { value: n, children: t });
};
qo.displayName = Math.random().toString(36).slice(2, 8);
function Fn(e) {
Xo.displayName = Math.random().toString(36).slice(2, 8);
function Kn(e) {
return {
data: {
prepend: (t) => {
e.pub(de, t);
e.pub(ge, t);
},

@@ -1650,3 +1650,3 @@ append: (t, n) => {

replace: (t, n) => {
e.pub(Xe, {
e.pub(Ze, {
data: t,

@@ -1665,6 +1665,6 @@ initialLocation: n

},
findIndex: (t) => e.getValue(W).findIndex(t),
find: (t) => e.getValue(W).find(t),
findIndex: (t) => e.getValue(_).findIndex(t),
find: (t) => e.getValue(_).find(t),
insert: function(t, n, o) {
e.pub(Je, {
e.pub(Ge, {
data: t,

@@ -1676,3 +1676,3 @@ offset: n,

deleteRange: function(t, n) {
e.pub(St, {
e.pub(yt, {
offset: t,

@@ -1683,7 +1683,7 @@ count: n

batch: (t, n) => {
e.pub(G, !0), t(), e.pub(G, !1), e.pub(ot, { data: [], scrollToBottom: n });
e.pub(q, !0), t(), e.pub(q, !1), e.pub(tt, { data: [], scrollToBottom: n });
}
},
scrollToItem: (t) => {
e.pub(U, t);
e.pub(j, t);
},

@@ -1696,20 +1696,23 @@ scrollIntoView: (t) => {

return e.getValue(Pe);
},
cancelSmoothScroll() {
e.pub(vn);
}
};
}
function ts() {
return B(Pe);
function ls() {
return D(Pe);
}
function ns() {
return B(yt);
function rs() {
return D(St);
}
function os() {
const e = Yt();
return g.useMemo(() => Fn(e), [e]);
function cs() {
const e = At();
return g.useMemo(() => Kn(e), [e]);
}
let Pt = !1;
const Go = g.forwardRef(
let Nt = !1;
const Qo = g.forwardRef(
({
initialData: e = [],
computeItemKey: t = In,
computeItemKey: t = En,
context: n = null,

@@ -1720,46 +1723,50 @@ initialLocation: o = null,

onRenderedDataChange: l,
ItemContent: r = yn,
ItemContent: r = $n,
Header: u = null,
StickyHeader: h = null,
Footer: f = null,
StickyFooter: m = null,
EmptyPlaceholder: y = null,
HeaderWrapper: P = Ln,
StickyHeaderWrapper: d = Dn,
FooterWrapper: Y = Mn,
StickyFooterWrapper: X = An,
ScrollElement: Q = "div",
...pe
}, fe) => {
const j = g.useMemo(() => {
const z = new Qn();
return z.register(Ve), z.register(We), z.register(Ze), z.register(qe), z.pubIn({
[W]: e.slice(),
StickyHeader: f = null,
Footer: p = null,
StickyFooter: b = null,
EmptyPlaceholder: k = null,
HeaderWrapper: C = On,
StickyHeaderWrapper: d = _n,
FooterWrapper: P = Hn,
StickyFooterWrapper: J = Bn,
ScrollElement: X = "div",
smoothScrollBezierFunction: ue = bn,
smoothScrollAnimationFrameCount: ae = kn,
...we
}, ne) => {
const z = g.useMemo(() => {
const B = new oo();
return B.register(_e), B.register(Be), B.register(qe), B.register(je), B.pubIn({
[_]: e.slice(),
[Oe]: n,
[Sn]: t,
[tt]: o,
[Lt]: r,
[xn]: u,
[$n]: f,
[Tn]: h,
[En]: m,
[wn]: y,
[Rn]: Q,
[Vn]: X,
[On]: d,
[Hn]: Y,
[Cn]: P,
[Mt]: s
}), z.singletonSub(Et, i), z.singletonSub(yt, l), z;
[Rn]: t,
[Qe]: o,
[wt]: r,
[wn]: u,
[Mn]: p,
[Ln]: f,
[An]: b,
[Cn]: k,
[Dn]: X,
[Pn]: J,
[Wn]: d,
[Fn]: P,
[Vn]: C,
[Lt]: s,
[mn]: ue,
[Sn]: ae
}), B.singletonSub(Et, i), B.singletonSub(St, l), B;
}, []);
g.useImperativeHandle(fe, () => Fn(j), [j]), g.useEffect(() => {
j.pubIn({
g.useImperativeHandle(ne, () => Kn(z), [z]), g.useEffect(() => {
z.pubIn({
[Oe]: n,
[Lt]: r
}), j.singletonSub(Et, i), j.singletonSub(yt, l);
[wt]: r
}), z.singletonSub(Et, i), z.singletonSub(St, l);
});
const N = g.useContext(_n);
const R = g.useContext(Yn);
return g.useEffect(() => {
N.consoleMessage && (Pt || (Pt = !0, console.error(N.consoleMessage)));
}, [N]), typeof window < "u" && N.watermarkMessage ? /* @__PURE__ */ I(
R.consoleMessage && (Nt || (Nt = !0, console.error(R.consoleMessage)));
}, [R]), typeof window < "u" && R.watermarkMessage ? /* @__PURE__ */ I(
"div",

@@ -1771,10 +1778,10 @@ {

},
children: N.watermarkMessage
children: R.watermarkMessage
}
) : /* @__PURE__ */ I(eo.Provider, { value: j, children: /* @__PURE__ */ I(Zo, { ...pe }) });
) : /* @__PURE__ */ I(so.Provider, { value: z, children: /* @__PURE__ */ I(es, { ...we }) });
}
);
Go.displayName = "VirtuosoMessageList";
const Zo = ({ style: e, ...t }) => {
const n = Yt(), [
Qo.displayName = "VirtuosoMessageList";
const es = ({ style: e, ...t }) => {
const n = At(), [
o,

@@ -1786,195 +1793,179 @@ s,

u,
h,
f,
m,
y,
P
] = to(
xn,
Tn,
p,
b,
k,
C
] = io(
wn,
Ln,
Vn,
Wn,
Mn,
An,
Fn,
Pn,
wt,
Cn,
On,
$n,
En,
Hn,
Vn,
Lt,
wn,
Rn
Dn
), [d] = g.useState(() => {
if (typeof ResizeObserver > "u")
throw new Error("ResizeObserver not found. Please ensure that you have a polyfill installed.");
return new ResizeObserver((p) => {
const A = p.length, C = [];
let x = {};
for (let Ie = 0; Ie < A; Ie++) {
const oe = p[Ie], O = oe.target;
if (O === j.current) {
x = {
...x,
[_e]: oe.contentRect.height
return new ResizeObserver((h) => {
const ee = h.length, N = [];
let E = {};
for (let ut = 0; ut < ee; ut++) {
const he = h[ut], F = he.target;
if (F === we.current) {
E = {
...E,
[We]: he.contentRect.height
};
continue;
} else if (O === z.current) {
x = {
...x,
[Be]: oe.contentRect.height
} else if (F === z.current) {
E = {
...E,
[Ve]: he.contentRect.height
};
continue;
} else if (O === X.current) {
x = {
...x,
[Ot]: oe.contentRect.height
} else if (F === J.current) {
E = {
...E,
[Ot]: he.contentRect.height
};
continue;
} else if (O === pe.current) {
x = {
...x,
[Fe]: oe.contentRect.height
} else if (F === ue.current) {
E = {
...E,
[Fe]: he.contentRect.height
};
continue;
} else if (O === E.current) {
x = {
...x,
[T]: O.scrollTop,
[$e]: O.scrollHeight,
[J]: oe.contentRect.height,
[dn]: O.clientWidth
} else if (F === $.current) {
E = {
...E,
[x]: F.scrollTop,
[Te]: F.scrollHeight,
[Z]: he.contentRect.height,
[dn]: F.clientWidth
};
continue;
} else if (O === ee.current) {
E.current && (x = {
...x,
[$e]: E.current.scrollHeight
} else if (F === Q.current) {
$.current && (E = {
...E,
[Te]: $.current.scrollHeight
});
continue;
}
if (O.dataset.index === void 0)
if (F.dataset.index === void 0)
continue;
const at = parseInt(O.dataset.index), Jn = parseFloat(O.dataset.knownSize ?? ""), pt = oe.contentRect.height;
if (pt === Jn)
const at = parseInt(F.dataset.index), eo = parseFloat(F.dataset.knownSize ?? ""), pt = he.contentRect.height;
if (pt === eo)
continue;
const Ht = C[C.length - 1];
C.length === 0 || Ht.size !== pt || Ht.endIndex !== at - 1 ? C.push({ endIndex: at, size: pt, startIndex: at }) : C[C.length - 1].endIndex++;
const _t = N[N.length - 1];
N.length === 0 || _t.size !== pt || _t.endIndex !== at - 1 ? N.push({ endIndex: at, size: pt, startIndex: at }) : N[N.length - 1].endIndex++;
}
C.length > 0 && (x = {
...x,
[st]: C
}), n.pubIn(x);
N.length > 0 && (E = {
...E,
[nt]: N
}), n.pubIn(E);
});
}), [Y, X] = je(d), [Q, pe] = je(d), [fe, j] = je(d), [N, z] = je(d), K = g.useCallback(
(p) => {
d.observe(p);
}), [P, J] = Ye(d), [X, ue] = Ye(d), [ae, we] = Ye(d), [ne, z] = Ye(d), R = g.useCallback(
(h) => {
d.observe(h);
},
[d]
), Ne = g.useCallback(
(p) => {
d.unobserve(p);
), B = g.useCallback(
(h) => {
d.unobserve(h);
},
[d]
), E = g.useRef(null), ee = g.useRef(null), ut = g.useCallback(
(p) => {
p ? (ee.current = p, d.observe(p, { box: "border-box" })) : ee.current && (d.unobserve(ee.current), ee.current = null);
), $ = g.useRef(null), Q = g.useRef(null), rt = g.useCallback(
(h) => {
h ? (Q.current = h, d.observe(h, { box: "border-box" })) : Q.current && (d.unobserve(Q.current), Q.current = null);
},
[d]
), he = g.useRef(null), D = g.useRef(null), ie = g.useRef(null);
function le() {
D.current && (cancelAnimationFrame(D.current), D.current = null, ie.current = null);
}
g.useEffect(() => n.sub(Rt, (p) => {
D.current && p !== ie.current && le();
}), [n]);
const te = g.useCallback((p) => {
var Ie;
D.current && le();
const A = ((Ie = E.current) == null ? void 0 : Ie.scrollTop) ?? 0;
ie.current = A < p ? "down" : "up";
let C = 0;
function x() {
var O;
const oe = A + (p - A) * go(C);
(O = E.current) == null || O.scrollTo({ top: oe, behavior: "auto" }), C += 0.02, C < 1 ? D.current = requestAnimationFrame(x) : (D.current = null, ie.current = null);
}
x();
}, []), ze = g.useCallback(
(p) => {
var A, C, x;
if (p.top === ((A = E.current) == null ? void 0 : A.scrollTop)) {
n.pub(He, (C = E.current) == null ? void 0 : C.scrollTop);
), pe = g.useRef(null), Y = ns($), Se = g.useCallback(
(h) => {
var ee, N, E;
if (h.top === ((ee = $.current) == null ? void 0 : ee.scrollTop)) {
n.pub(He, (N = $.current) == null ? void 0 : N.scrollTop);
return;
}
p.top !== void 0 && (he.current = p.top, n.pub(Tt, !0)), p.forceBottomSpace !== void 0 && ee.current && (ee.current.style.paddingBottom = `${p.forceBottomSpace}px`), p.behavior === "smooth" ? te(p.top ?? 0) : (x = E.current) == null || x.scrollTo(p);
h.top !== void 0 && (pe.current = h.top, n.pub(Tt, !0)), h.forceBottomSpace !== void 0 && Q.current && (Q.current.style.paddingBottom = `${h.forceBottomSpace}px`), h.behavior === "smooth" ? Y(h.top ?? 0) : (E = $.current) == null || E.scrollTo(h);
},
[n, te]
), ne = g.useCallback((p) => {
var A;
(A = E.current) == null || A.scrollBy(p);
}, []), Le = g.useCallback(() => {
const p = E.current;
if (p !== null) {
if (he.current !== null) {
const A = p.scrollHeight - p.clientHeight;
en(p.scrollTop, Math.min(A, he.current)) && (he.current = null, n.pub(Tt, !1), n.pub(He, p.scrollTop));
[n, Y]
), oe = g.useCallback((h) => {
var ee;
(ee = $.current) == null || ee.scrollBy(h);
}, []), K = g.useCallback(() => {
const h = $.current;
if (h !== null) {
if (pe.current !== null) {
const ee = h.scrollHeight - h.clientHeight;
en(h.scrollTop, Math.min(ee, pe.current)) && (pe.current = null, n.pub(Tt, !1), n.pub(He, h.scrollTop));
}
n.pub(T, p.scrollTop);
n.pub(x, h.scrollTop);
}
}, [n]), Pn = g.useCallback(
(p) => {
p ? (n.pub($t, p), E.current = p, p.addEventListener("scroll", Le), p.addEventListener("wheel", (A) => {
n.pub(Rt, A.deltaY > 0 ? "down" : "up");
}), d.observe(p, { box: "border-box" })) : E.current && (E.current.removeEventListener("scroll", Le), n.pub($t, null), d.unobserve(E.current), E.current = null);
}, [n]), Le = g.useCallback(
(h) => {
n.pub(Ht, h.deltaY > 0 ? "down" : "up");
},
[d, n, Le]
), { items: Nn } = B(Ve);
g.useLayoutEffect(() => n.sub(Ee, ze), [ze, n]), g.useLayoutEffect(() => n.sub(se, ne), [ne, n]);
const zn = B(F), Yn = B(_), Kn = B(wt), jn = B(rt), Un = B(kn), ge = B(Oe), qn = B(Sn), Gn = B(ye), Zn = B(Re);
return /* @__PURE__ */ I(Xn, { children: /* @__PURE__ */ Nt(
P,
[n]
), se = g.useCallback(
(h) => {
h ? (n.pub($t, h), $.current = h, h.addEventListener("scroll", K), h.addEventListener("wheel", Le), d.observe(h, { box: "border-box" })) : $.current && ($.current.removeEventListener("scroll", K), $.current.removeEventListener("wheel", Le), n.pub($t, null), d.unobserve($.current), $.current = null);
},
[d, n, K, Le]
), { items: ct } = D(_e);
g.useLayoutEffect(() => n.sub($e, Se), [Se, n]), g.useLayoutEffect(() => n.sub(te, oe), [oe, n]);
const jn = D(W), Un = D(V), qn = D(Rt), Gn = D(it), Zn = D(Tn), fe = D(Oe), Jn = D(Rn), Xn = D(ke), Qn = D(Re);
return /* @__PURE__ */ I(to, { children: /* @__PURE__ */ zt(
C,
{
...t,
ref: Pn,
ref: se,
"data-testid": "virtuoso-scroller",
style: {
overflowY: Yn ? "hidden" : "scroll",
overflowY: Un ? "hidden" : "scroll",
boxSizing: "border-box",
...e
},
...P === "div" ? { context: ge } : {},
...C === "div" ? { context: fe } : {},
children: [
s && /* @__PURE__ */ I(l, { ref: N, style: Ke, children: /* @__PURE__ */ I(s, { context: ge }) }),
o && /* @__PURE__ */ I(i, { ref: fe, style: Ke, children: /* @__PURE__ */ I(o, { context: ge }) }),
Gn > 0 ? /* @__PURE__ */ I(
s && /* @__PURE__ */ I(l, { ref: ne, style: ze, children: /* @__PURE__ */ I(s, { context: fe }) }),
o && /* @__PURE__ */ I(i, { ref: ae, style: ze, children: /* @__PURE__ */ I(o, { context: fe }) }),
Xn > 0 ? /* @__PURE__ */ I(
"div",
{
ref: ut,
ref: rt,
"data-testid": "virtuoso-list",
style: {
boxSizing: "content-box",
height: Zn,
paddingBottom: jn,
height: Qn,
paddingBottom: Gn,
overflowAnchor: "none",
marginTop: Kn,
transition: Un,
marginTop: qn,
transition: Zn,
position: "relative",
transform: `translateY(${zn}px)`
transform: `translateY(${jn}px)`
},
children: Nn.map((p) => /* @__PURE__ */ I(
Jo,
children: ct.map((h) => /* @__PURE__ */ I(
ts,
{
mount: K,
unmount: Ne,
item: p,
ItemContent: m
mount: R,
unmount: B,
item: h,
ItemContent: b
},
qn({ index: p.index, data: p.data, context: ge })
Jn({ index: h.index, data: h.data, context: fe })
))
}
) : y ? /* @__PURE__ */ I(y, { context: ge }) : null,
r && /* @__PURE__ */ I(h, { ref: Y, style: Ke, children: /* @__PURE__ */ I(r, { context: ge }) }),
u && /* @__PURE__ */ I(f, { ref: Q, style: Ke, children: /* @__PURE__ */ I(u, { context: ge }) })
) : k ? /* @__PURE__ */ I(k, { context: fe }) : null,
r && /* @__PURE__ */ I(f, { ref: P, style: ze, children: /* @__PURE__ */ I(r, { context: fe }) }),
u && /* @__PURE__ */ I(p, { ref: X, style: ze, children: /* @__PURE__ */ I(u, { context: fe }) })
]
}
) });
}, Jo = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const s = B(Oe), i = g.useRef(null), l = g.useCallback(
}, ts = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const s = D(Oe), i = g.useRef(null), l = g.useCallback(
(r) => {

@@ -2001,3 +1992,3 @@ r ? (i.current = r, n(r)) : i.current && (o(i.current), i.current = null);

};
function je(e) {
function Ye(e) {
const t = g.useRef(null);

@@ -2011,8 +2002,32 @@ return [g.useCallback(

}
function ns(e) {
const t = At(), n = g.useRef(null), o = g.useRef(null), s = D(Sn), i = D(mn);
function l() {
n.current && (cancelAnimationFrame(n.current), n.current = null, o.current = null);
}
return g.useEffect(() => t.sub(Ht, (r) => {
r !== o.current && l();
}), [t]), g.useEffect(() => t.sub(vn, l), [t]), g.useCallback(
(r) => {
var b;
n.current && l();
const u = ((b = e.current) == null ? void 0 : b.scrollTop) ?? 0;
o.current = u < r ? "down" : "up";
let f = 0;
function p() {
var C;
const k = u + (r - u) * i(f);
(C = e.current) == null || C.scrollTo({ top: k, behavior: "auto" }), f += 1 / s, f < 1 ? n.current = requestAnimationFrame(p) : (n.current = null, o.current = null);
}
p();
},
[e, s, i]
);
}
export {
Go as VirtuosoMessageList,
qo as VirtuosoMessageListLicense,
ns as useCurrentlyRenderedData,
ts as useVirtuosoLocation,
os as useVirtuosoMethods
Qo as VirtuosoMessageList,
Xo as VirtuosoMessageListLicense,
rs as useCurrentlyRenderedData,
ls as useVirtuosoLocation,
cs as useVirtuosoMethods
};

@@ -23,3 +23,3 @@ {

},
"version": "1.8.0-alpha.20",
"version": "1.8.0-alpha.21",
"type": "module",

@@ -26,0 +26,0 @@ "module": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc