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
0
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.2 to 1.8.3-alpha.1

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## [1.8.3-alpha.1](https://github.com/virtuoso-dev/message-list/compare/v1.8.2...v1.8.3-alpha.1) (2024-07-18)
### Bug Fixes
* data replace race condition ([04f2e5f](https://github.com/virtuoso-dev/message-list/commit/04f2e5f6bbcb8d0433c681b23eb53570b14a4557))
* update with updating sizes ([d2b3f48](https://github.com/virtuoso-dev/message-list/commit/d2b3f48fda696b41e97b62bd68931f0c6e44f127))
## [1.8.2](https://github.com/virtuoso-dev/message-list/compare/v1.8.1...v1.8.2) (2024-07-09)

@@ -2,0 +10,0 @@

1492

dist/index.js

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

import { jsxs as Jt, jsx as y, Fragment as io } from "react/jsx-runtime";
import h from "react";
import { Cell as c, Signal as x, throttleTime as ve, map as f, mapTo as W, debounceTime as ce, filter as d, scan as Q, withLatestFrom as S, delayWithMicrotask as Ot, onNext as Xt, Action as ro, useRealm as Ct, useCellValue as V, Realm as lo, RealmContext as co, useCellValues as uo } from "@mdxeditor/gurx";
function be(e, t) {
import { jsxs as Xt, jsx as y, Fragment as co } from "react/jsx-runtime";
import g from "react";
import { Cell as c, Signal as S, throttleTime as be, map as f, mapTo as F, debounceTime as ue, filter as d, scan as ee, withLatestFrom as x, delayWithMicrotask as Vt, onNext as Qt, Action as en, useRealm as Ft, useCellValue as V, Realm as uo, RealmContext as ao, useCellValues as po } from "@mdxeditor/gurx";
function me(e, t) {
const n = c(e, (o) => {

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

}
const Se = { lvl: 0 };
function Qt(e, t, n, o = Se, s = Se) {
const ye = { lvl: 0 };
function tn(e, t, n, o = ye, s = ye) {
return { k: e, l: o, lvl: n, r: s, v: t };
}
function k(e) {
return e === Se;
return e === ye;
}
function $e() {
return Se;
function we() {
return ye;
}
function kt(e, t) {
function St(e, t) {
if (k(e))
return Se;
return ye;
const { k: n, l: o, r: s } = e;

@@ -31,9 +31,9 @@ if (t === n) {

{
const [i, r] = en(o);
return Xe(E(e, { k: i, l: tn(o), v: r }));
const [i, r] = nn(o);
return tt(w(e, { k: i, l: on(o), v: r }));
}
} else
return t < n ? Xe(E(e, { l: kt(o, t) })) : Xe(E(e, { r: kt(s, t) }));
return t < n ? tt(w(e, { l: St(o, t) })) : tt(w(e, { r: St(s, t) }));
}
function ge(e, t, n = "k") {
function de(e, t, n = "k") {
if (k(e))

@@ -44,11 +44,11 @@ return [-1 / 0, void 0];

if (e[n] < t) {
const o = ge(e.r, t, n);
const o = de(e.r, t, n);
return o[0] === -1 / 0 ? [e.k, e.v] : o;
}
return ge(e.l, t, n);
return de(e.l, t, n);
}
function _(e, t, n) {
return k(e) ? Qt(t, n, 1) : t === e.k ? E(e, { k: t, v: n }) : t < e.k ? Kt(E(e, { l: _(e.l, t, n) })) : Kt(E(e, { r: _(e.r, t, n) }));
function B(e, t, n) {
return k(e) ? tn(t, n, 1) : t === e.k ? w(e, { k: t, v: n }) : t < e.k ? jt(w(e, { l: B(e.l, t, n) })) : jt(w(e, { r: B(e.r, t, n) }));
}
function It(e, t, n) {
function yt(e, t, n) {
if (k(e))

@@ -58,37 +58,37 @@ return [];

let l = [];
return o > t && (l = l.concat(It(i, t, n))), o >= t && o <= n && l.push({ k: o, v: s }), o <= n && (l = l.concat(It(r, t, n))), l;
return o > t && (l = l.concat(yt(i, t, n))), o >= t && o <= n && l.push({ k: o, v: s }), o <= n && (l = l.concat(yt(r, t, n))), l;
}
function ao(e, t, n, o) {
function fo(e, t, n, o) {
if (k(e))
return Se;
let s = $e();
for (const { k: i, v: r } of de(e))
i > t && i <= n ? s = _(s, ...o(i, r)) : s = _(s, i, r);
return ye;
let s = we();
for (const { k: i, v: r } of ve(e))
i > t && i <= n ? s = B(s, ...o(i, r)) : s = B(s, i, r);
return s;
}
function po(e, t, n) {
let o = $e(), s = -1;
for (const { start: i, end: r, value: l } of fo(e))
i < t ? (o = _(o, i, l), s = l) : i > t + n ? o = _(o, i - n, l) : r >= t + n && s !== l && (o = _(o, t, l));
function ho(e, t, n) {
let o = we(), s = -1;
for (const { start: i, end: r, value: l } of go(e))
i < t ? (o = B(o, i, l), s = l) : i > t + n ? o = B(o, i - n, l) : r >= t + n && s !== l && (o = B(o, t, l));
return o;
}
function de(e) {
return k(e) ? [] : [...de(e.l), { k: e.k, v: e.v }, ...de(e.r)];
function ve(e) {
return k(e) ? [] : [...ve(e.l), { k: e.k, v: e.v }, ...ve(e.r)];
}
function en(e) {
return k(e.r) ? [e.k, e.v] : en(e.r);
function nn(e) {
return k(e.r) ? [e.k, e.v] : nn(e.r);
}
function tn(e) {
return k(e.r) ? e.l : Xe(E(e, { r: tn(e.r) }));
function on(e) {
return k(e.r) ? e.l : tt(w(e, { r: on(e.r) }));
}
function E(e, t) {
return Qt(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r);
function w(e, t) {
return tn(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r);
}
function bt(e) {
function It(e) {
return k(e) || e.lvl > e.r.lvl;
}
function Kt(e) {
return St(rn(e));
function jt(e) {
return Tt(cn(e));
}
function Xe(e) {
function tt(e) {
const { l: t, r: n, lvl: o } = e;

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

if (o > n.lvl + 1) {
if (bt(t))
return rn(E(e, { lvl: o - 1 }));
if (It(t))
return cn(w(e, { lvl: o - 1 }));
if (!k(t) && !k(t.r))
return E(t.r, {
l: E(t, { r: t.r.l }),
return w(t.r, {
l: w(t, { r: t.r.l }),
lvl: o,
r: E(e, {
r: w(e, {
l: t.r.r,

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

} else {
if (bt(e))
return St(E(e, { lvl: o - 1 }));
if (It(e))
return Tt(w(e, { lvl: o - 1 }));
if (!k(n) && !k(n.l)) {
const s = n.l, i = bt(s) ? n.lvl - 1 : n.lvl;
return E(s, {
l: E(e, {
const s = n.l, i = It(s) ? n.lvl - 1 : n.lvl;
return w(s, {
l: w(e, {
lvl: o - 1,

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

lvl: s.lvl + 1,
r: St(E(n, { l: s.r, lvl: i }))
r: Tt(w(n, { l: s.r, lvl: i }))
});

@@ -130,12 +130,12 @@ } else

}
function fo(e) {
return sn(de(e));
function go(e) {
return ln(ve(e));
}
function nn(e, t, n) {
function sn(e, t, n) {
if (k(e))
return [];
const o = ge(e, t)[0];
return sn(It(e, o, n));
const o = de(e, t)[0];
return ln(yt(e, o, n));
}
function on(e, t) {
function rn(e, t) {
const n = e.length;

@@ -152,18 +152,18 @@ if (n === 0)

}
function sn(e) {
return on(e, ({ k: t, v: n }) => ({ index: t, value: n }));
function ln(e) {
return rn(e, ({ k: t, v: n }) => ({ index: t, value: n }));
}
function St(e) {
function Tt(e) {
const { r: t, lvl: n } = e;
return !k(t) && !k(t.r) && t.lvl === n && t.r.lvl === n ? E(t, { l: E(e, { r: t.l }), lvl: n + 1 }) : e;
return !k(t) && !k(t.r) && t.lvl === n && t.r.lvl === n ? w(t, { l: w(e, { r: t.l }), lvl: n + 1 }) : e;
}
function rn(e) {
function cn(e) {
const { l: t } = e;
return !k(t) && t.lvl === e.lvl ? E(t, { r: E(e, { l: t.r }) }) : e;
return !k(t) && t.lvl === e.lvl ? w(t, { r: w(e, { l: t.r }) }) : e;
}
function ho(e) {
function vo(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 go(e, t) {
function bo(e, t) {
let n = k(e) ? 0 : 1 / 0;

@@ -173,27 +173,27 @@ for (const o of t) {

if (n = Math.min(n, i), k(e)) {
e = _(e, 0, s);
e = B(e, 0, s);
continue;
}
const l = nn(e, i - 1, r + 1);
if (l.some(ho(o)))
const l = sn(e, i - 1, r + 1);
if (l.some(vo(o)))
continue;
let u = !1, a = !1;
for (const { start: p, end: v, value: m } of l)
u ? (r >= p || s === m) && (e = kt(e, p)) : (a = m !== s, u = !0), v > r && r >= p && m !== s && (e = _(e, r + 1, m));
a && (e = _(e, i, s));
u ? (r >= p || s === m) && (e = St(e, p)) : (a = m !== s, u = !0), v > r && r >= p && m !== s && (e = B(e, r + 1, m));
a && (e = B(e, i, s));
}
return [e, n];
}
const ct = [$e(), 0];
function vo(e, [t, n]) {
const pt = [we(), 0];
function mo(e, [t, n]) {
if (n.length > 0 && k(e) && t.length === 2) {
const o = t[0].size, s = t[1].size;
return [
n.reduce((i, r) => _(_(i, r, o), r + 1, s), $e()),
n.reduce((i, r) => B(B(i, r, o), r + 1, s), we()),
0
];
} else
return go(e, t);
return bo(e, t);
}
function it(e, t, n, o = 0) {
function ct(e, t, n, o = 0) {
let s = e.length - 1;

@@ -216,31 +216,31 @@ for (; o <= s; ) {

}
function ln(e, t, n) {
return e[it(e, t, n)];
function un(e, t, n) {
return e[ct(e, t, n)];
}
function bo(e, t, n, o) {
const s = it(e, t, o), i = it(e, n, o, s);
function ko(e, t, n, o) {
const s = ct(e, t, o), i = ct(e, n, o, s);
return e.slice(s, i + 1);
}
function Ht({ index: e }, t) {
function Bt({ index: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function mo({ offset: e }, t) {
function Io({ offset: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function ko(e) {
function xo(e) {
return { index: e.index, value: e };
}
function Io(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, ln(e, o, Ht).offset)), t = Math.max(0, t), on(bo(e, t, n, mo), ko);
function So(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, un(e, o, Bt).offset)), t = Math.max(0, t), rn(ko(e, t, n, Io), xo);
}
const xe = [[], 0, 0, 0];
function So(e, [t, n]) {
const Te = [[], 0, 0, 0];
function yo(e, [t, n]) {
let o = 0, s = 0, i = 0, r = 0;
if (n !== 0) {
r = it(e, n - 1, Ht), i = e[r].offset;
const u = ge(t, n - 1);
o = u[0], s = u[1], e.length && e[r].height === ge(t, n)[1] && (r -= 1), e = e.slice(0, r + 1);
r = ct(e, n - 1, Bt), i = e[r].offset;
const u = de(t, n - 1);
o = u[0], s = u[1], e.length && e[r].height === de(t, n)[1] && (r -= 1), e = e.slice(0, r + 1);
} else
e = [];
for (const { start: l, value: u } of nn(t, n, 1 / 0)) {
for (const { start: l, value: u } of sn(t, n, 1 / 0)) {
const a = (l - o) * s + i;

@@ -251,24 +251,24 @@ e.push({ height: u, index: l, offset: a }), o = l, i = a, s = u;

}
function cn(e, t) {
function an(e, t) {
if (t.length === 0)
return [0, 0];
const { offset: n, index: o, height: s } = ln(t, e, Ht);
const { offset: n, index: o, height: s } = un(t, e, Bt);
return [s * (e - o) + n, s];
}
function xt(e, t) {
return cn(e, t)[0];
function $t(e, t) {
return an(e, t)[0];
}
function un(e, t) {
function pn(e, t) {
return Math.abs(e - t) < 1.01;
}
function xo() {
function To() {
return typeof navigator > "u" ? !1 : /Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints && navigator.maxTouchPoints > 1 || /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent);
}
function an(e) {
function fn(e) {
return !e;
}
function yo(e) {
function $o(e) {
return e === 1 ? 1 : 1 - Math.pow(2, -10 * e);
}
const pn = "up", mt = "down", To = "none", $o = {
const hn = "up", xt = "down", Eo = "none", wo = {
atBottom: !1,

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

}
}, Eo = 0, wo = 4;
function jt(e) {
}, Lo = 0, Ro = 4;
function Ut(e) {
return (t, n) => {

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

c(!1);
const fn = c(!0);
x();
const fe = c(!1), Lo = x((e) => {
e.link(e.pipe(fn, ve(50)), Lo);
}), hn = c(wo), Ro = c(Eo, (e) => {
const gn = c(!0);
S();
const he = c(!1), Mo = S((e) => {
e.link(e.pipe(gn, be(50)), Mo);
}), dn = c(Ro), Ao = c(Lo, (e) => {
e.link(
e.pipe(
e.combine(T, Ro),
e.combine(T, Ao),
f(([t, n]) => t <= n)
),
fn
gn
);
}), Ve = c(!1, (e) => {
e.link(e.pipe(T, jt(1), W(!0)), Ve), e.link(e.pipe(T, jt(1), W(!1), ce(100)), Ve);
}), yt = c(!1, (e) => {
e.link(e.pipe(te, W(!0)), yt), e.link(e.pipe(te, W(!1), ce(200)), yt);
}), gn = c(!1), Qe = c(
}), We = c(!1, (e) => {
e.link(e.pipe(T, Ut(1), F(!0)), We), e.link(e.pipe(T, Ut(1), F(!1), ue(100)), We);
}), Et = c(!1, (e) => {
e.link(e.pipe(se, F(!0)), Et), e.link(e.pipe(se, F(!1), ue(200)), Et);
}), vn = c(!1), nt = c(
null,

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

e.pipe(
e.combine(j, T, U, xn, hn, pt, ee),
e.combine(U, T, q, Tn, dn, gt, te),
d(([, , , , , , t]) => !k(t)),
Q((t, [n, o, s, i, r]) => {
ee((t, [n, o, s, i, r]) => {
const u = o + s - n > -r, a = {

@@ -341,12 +341,12 @@ viewportWidth: i,

};
}, $o)
}, wo)
),
Qe
nt
), e.link(
e.pipe(
Qe,
ve(10),
nt,
be(10),
// withLatestFrom(scrollToInProgress$),
// filter(([, inProgress]) => !inProgress),
Q(
ee(
({ prev: t }, n) => {

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

),
gn
vn
), e.sub(
e.pipe(
U,
S(Qe),
Q(
q,
x(nt),
ee(
(t, [n, o]) => {

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

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

@@ -384,9 +384,9 @@ );

(e, t) => e ? e.atBottom === (t == null ? void 0 : t.atBottom) : !1
), dn = c(0, (e) => {
), bn = c(0, (e) => {
e.link(
e.pipe(
e.combine(T, j, U),
Q(
e.combine(T, U, q),
ee(
(t, [n, o, s]) => {
if (un(t.scrollHeight, o))
if (pn(t.scrollHeight, o))
return {

@@ -418,30 +418,30 @@ scrollTop: n,

),
dn
bn
);
}), Tt = c(mt, (e) => {
}), wt = c(xt, (e) => {
e.link(
e.pipe(
T,
Q(
(t, n) => e.getValue(yt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? pn : mt, prevScrollTop: n },
{ direction: mt, prevScrollTop: 0 }
ee(
(t, n) => e.getValue(Et) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? hn : xt, prevScrollTop: n },
{ direction: xt, prevScrollTop: 0 }
),
f((t) => t.direction)
),
Tt
), e.link(e.pipe(T, ce(100), W(To)), Tt);
}), Ut = c(0, (e) => {
e.link(e.pipe(Ve, d(an), W(0)), Ut), e.link(
wt
), e.link(e.pipe(T, ue(100), F(Eo)), wt);
}), qt = c(0, (e) => {
e.link(e.pipe(We, d(fn), F(0)), qt), e.link(
e.pipe(
T,
ve(100),
S(Ve),
be(100),
x(We),
d(([, t]) => !!t),
Q(([, t], [n]) => [t, n], [0, 0]),
ee(([, t], [n]) => [t, n], [0, 0]),
f(([t, n]) => n - t)
),
Ut
qt
);
});
function Vt(e, t) {
function Wt(e, t) {
if (typeof e == "number")

@@ -462,3 +462,3 @@ return {

}
function vn({
function mn({
location: e,

@@ -474,37 +474,37 @@ sizeTree: t,

}) {
const { align: a, behavior: p, offset: v, index: m } = Vt(e, s - 1);
function w() {
const B = ge(t, m)[1];
if (B === void 0)
const { align: a, behavior: p, offset: v, index: m } = Wt(e, s - 1);
function L() {
const P = de(t, m)[1];
if (P === void 0)
throw new Error(`Item at index ${m} not found`);
return B;
return P;
}
i -= l + u;
let I = xt(m, n) + r - l;
a === "end" ? I = I - i + w() : a === "center" && (I = I - i / 2 + w() / 2), v && (I += v);
let I = $t(m, n) + r - l;
a === "end" ? I = I - i + L() : a === "center" && (I = I - i / 2 + L() / 2), v && (I += v);
let b = 0;
return a === "start" && (b = Math.max(0, Math.min(I - (o - i)))), I = Math.max(0, I), { top: I, behavior: p, align: a, forceBottomSpace: b };
}
const Me = c(null), Mo = c(!1), et = c(!0), $t = x((e) => {
const Ce = c(null), Do = c(!1), ot = c(!0), Lt = S((e) => {
e.link(
e.pipe(
$t,
Lt,
f(() => !0)
),
et
ot
), e.link(
e.pipe(
$t,
Lt,
f(() => null)
),
Me
Ce
);
}), bn = x((e) => {
}), kn = S((e) => {
e.link(
e.pipe(
bn,
S(me, ye, je),
kn,
x(ke, $e, qe),
f(([t, n, o, s]) => {
let { align: i, behavior: r, offset: l, index: u } = Vt(t, n - 1);
const a = typeof t != "number" ? t.done : void 0, [p, v] = cn(u, o);
let { align: i, behavior: r, offset: l, index: u } = Wt(t, n - 1);
const a = typeof t != "number" ? t.done : void 0, [p, v] = an(u, o);
return p < -s.listOffset ? ((typeof t == "number" || t.align === void 0) && (i = "start-no-overflow"), { index: u, align: i, behavior: r, offset: l, done: a }) : p + v > -s.listOffset + s.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (i = "end"), { index: u, align: i, behavior: r, offset: l, done: a }) : null;

@@ -515,16 +515,16 @@ }),

// @ts-expect-error contra variance
X
Q
);
}), X = x((e) => {
}), Q = S((e) => {
const t = e.pipe(
X,
S(
ee,
ye,
me,
U,
at,
ze,
Q,
x(
te,
$e,
ke,
q,
ht,
Ke,
we
Ue,
Re
),

@@ -534,3 +534,3 @@ f(

try {
return vn({
return mn({
location: n,

@@ -553,71 +553,71 @@ totalHeight: p,

);
e.link(X, Me), e.link(t, Te), e.link(
e.link(Q, Ce), e.link(t, Ee), e.link(
e.pipe(
X,
Q,
d((n) => typeof n != "number" && n.index === "LAST"),
W(!0)
F(!0)
),
fe
), e.link(e.pipe(t, W(!1)), et), e.link(e.pipe(t, W(!1)), Mo), e.link(
he
), e.link(e.pipe(t, F(!1)), ot), e.link(e.pipe(t, F(!1)), Do), e.link(
e.pipe(
ee,
ce(0),
S(et, Me),
te,
ue(0),
x(ot, Ce),
d(([, n, o]) => !n && o !== null),
f(([, , n]) => n)
),
X
), e.sub(e.pipe(Ne, ve(20)), () => {
const n = e.getValue(Me);
Q
), e.sub(e.pipe(Ye, be(20)), () => {
const n = e.getValue(Ce);
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({
[Me]: null,
[et]: !0
[Ce]: null,
[ot]: !0
});
}), e.link(
e.pipe(
ot,
rt,
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by
Ot(),
Vt(),
d((n) => n !== 0)
),
te
se
), e.link(
e.pipe(
ot,
Xt(T),
rt,
Qt(T),
f(() => 0)
),
ot
rt
);
}), Ae = c(null), We = c(null, (e) => {
}), He = c(null), _e = c(null, (e) => {
e.link(
e.pipe(
We,
_e,
d((n) => n !== null)
),
Ae
He
);
const t = e.pipe(
e.combine(We, ee),
S(Ae),
e.combine(_e, te),
x(He),
d(([[n, o], s]) => n !== null && !k(o) && s !== null),
ce(10),
ue(10),
f(([[n]]) => n)
);
e.link(e.pipe(t, Ot()), X), e.link(
e.link(e.pipe(t, Vt()), Q), e.link(
e.pipe(
t,
Xt(e.pipe(Pe, d(an))),
W(null),
Qt(e.pipe(ze, d(fn))),
F(null),
// unset the location after the scroll completes
ce(10)
ue(10)
),
Ae
He
);
});
function Do(e, t) {
function Co(e, t) {
const n = t.slice();
let o = 0;
const s = [];
de(e).forEach(({ k: r, v: l }) => {
ve(e).forEach(({ k: r, v: l }) => {
var p, v;

@@ -629,8 +629,8 @@ for (; n.length && n[0] < r; )

});
let i = $e();
let i = we();
return s.forEach(({ k: r, v: l }) => {
i = _(i, r, l);
i = B(i, r, l);
}), i;
}
function Ao(e, t) {
function Oo(e, t) {
return [

@@ -648,4 +648,4 @@ {

}
const Oo = [], De = {
items: Oo,
const Ho = [], Oe = {
items: Ho,
listBottom: 0,

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

data: null
}, Ee = c(De, (e) => {
}, Le = c(Oe, (e) => {
e.link(
e.pipe(
e.combine(
Ho,
$n,
ee,
ye,
me,
we,
C,
ot,
We,
Ae,
Ye,
ze,
Fo,
wn,
te,
$e,
ke,
Re,
H,
rt,
_e,
He,
je,
Ke,
F,
he,
K
Ue,
_,
ge,
j
),

@@ -684,3 +684,3 @@ d((t) => {

}),
Q(
ee(
(t, [

@@ -698,15 +698,15 @@ n,

m,
w,
L,
I,
b
]) => {
var Ge;
var Je;
if ((u == null ? void 0 : u.length) === 0)
return De;
return Oe;
if (k(s)) {
let N = 0;
return p !== null && (N = Vt(p, r - 1).index), { ...De, items: Ao(N, u), offsetTree: i, totalCount: r, data: u };
let z = 0;
return p !== null && (z = Wt(p, r - 1).index), { ...Oe, items: Oo(z, u), offsetTree: i, totalCount: r, data: u };
}
let B = 0;
v !== null && n === 0 && (B = vn({
let P = 0;
v !== null && n === 0 && (P = mn({
totalHeight: l,

@@ -717,45 +717,45 @@ location: v,

totalCount: r,
viewportHeight: e.getValue(U),
headerHeight: e.getValue(at),
stickyHeaderHeight: w,
viewportHeight: e.getValue(q),
headerHeight: e.getValue(ht),
stickyHeaderHeight: L,
stickyFooterHeight: I
}).top ?? 0);
const Y = Math.min(
Math.max(n + B + a - b - m, 0),
const K = Math.min(
Math.max(n + P + a - b - m, 0),
l - o
), q = Y + o;
if (t.offsetTree === i && t.totalCount === r && t.data === u && Y >= t.listTop && q <= t.listBottom)
), G = K + o;
if (t.offsetTree === i && t.totalCount === r && t.data === u && K >= t.listTop && G <= t.listBottom)
return t;
const G = [], Z = r - 1, P = 0, L = Io(i, Y, q, P);
let R = 0, Ue = 0, qe = !1;
for (const N of L) {
const Z = [], J = r - 1, N = 0, R = So(i, K, G, N);
let M = 0, Ge = 0, Ze = !1;
for (const z of R) {
const {
value: { offset: ke, height: oe }
} = N;
let J = N.start;
R = ke, ke < Y && (J += Math.floor((Y - ke) / oe), R += (J - N.start) * oe), J < P && (R += (P - J) * oe, J = P);
const Le = Math.min(N.end, Z);
for (let se = J; se <= Le && !(R >= q); se++) {
const ht = {
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,
value: { offset: Ie, height: ie }
} = z;
let X = z.start;
M = Ie, Ie < K && (X += Math.floor((K - Ie) / ie), M += (X - z.start) * ie), X < N && (M += (N - X) * ie, X = N);
const Me = Math.min(z.end, J);
for (let re = X; re <= Me && !(M >= G); re++) {
const vt = {
data: u == null ? void 0 : u[re],
prevData: (u == null ? void 0 : u[re - 1]) ?? null,
nextData: (u == null ? void 0 : u[re + 1]) ?? null,
height: ie,
index: re,
offset: M,
type: "flat"
};
qe || (qe = !0, Ue = R), G.push(ht), R += oe;
Ze || (Ze = !0, Ge = M), Z.push(vt), M += ie;
}
}
const $ = l - R, ne = ((Ge = G[0]) == null ? void 0 : Ge.offset) || 0;
return { items: G, listBottom: R, listTop: Ue, offsetTree: i, paddingBottom: $, paddingTop: ne, totalCount: r, data: u };
const $ = l - M, ne = ((Je = Z[0]) == null ? void 0 : Je.offset) || 0;
return { items: Z, listBottom: M, listTop: Ge, offsetTree: i, paddingBottom: $, paddingTop: ne, totalCount: r, data: u };
},
De
Oe
)
),
Ee
Le
);
}), rt = be([], (e) => e.pipe(
e.combine(Ee, T),
}), ut = me([], (e) => e.pipe(
e.combine(Le, T),
f(([t, n]) => {

@@ -767,9 +767,9 @@ const o = t.items.slice();

})
)), K = c(!1), Oe = c(!1), tt = x((e) => {
)), j = c(!1), Ve = c(!1), st = S((e) => {
e.link(
e.pipe(
Ee,
S(dn, he),
Le,
x(bn, ge),
d(([, , t]) => !t),
Q(
ee(
([, t, n, o], [{ items: s, totalCount: i, listBottom: r, paddingBottom: l }, u]) => {

@@ -783,22 +783,22 @@ const a = r + l;

d(([t]) => t !== 0),
S(T, Tt, Pe),
d(([, t, n, o]) => !o && t !== 0 && n === pn),
x(T, wt, ze),
d(([, t, n, o]) => !o && t !== 0 && n === hn),
f(([[t]]) => t)
),
tt
), xo() ? (e.sub(e.pipe(tt, S(F, T)), ([t, n]) => {
e.pub(F, n - t);
st
), To() ? (e.sub(e.pipe(st, x(_, T)), ([t, n]) => {
e.pub(_, n - t);
}), e.sub(
e.pipe(e.combine(T, F, he, Oe)),
e.pipe(e.combine(T, _, ge, Ve)),
([t, n, o, s]) => {
o || s || (n > 0 && t < n ? (e.pub(K, !0), e.pub(Te, { top: 0, behavior: "instant" }), setTimeout(() => {
o || s || (n > 0 && t < n ? (e.pub(j, !0), e.pub(Ee, { top: 0, behavior: "instant" }), setTimeout(() => {
e.pubIn({
[K]: !1,
[F]: 0
[j]: !1,
[_]: 0
});
})) : n < 0 && t <= 0 && (e.pubIn({
[K]: !0,
[F]: 0
[j]: !0,
[_]: 0
}), setTimeout(() => {
e.pub(Te, { top: 0, behavior: "instant" }), e.pub(K, !1);
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(j, !1);
})));

@@ -808,54 +808,54 @@ }

e.pipe(
e.combine(Ve, F, K, he, Oe),
e.combine(We, _, j, ge, Ve),
d(
([t, n, o, s, i]) => !t && n !== 0 && !o && !s && !i
),
ve(100)
be(100)
),
([, t]) => {
e.pub(K, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(te, -t), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(K, !1);
e.pub(j, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(se, -t), e.pub(_, 0), requestAnimationFrame(() => {
e.pub(j, !1);
});
}) : requestAnimationFrame(() => {
e.pub(te, -t), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(K, !1);
e.pub(se, -t), e.pub(_, 0), requestAnimationFrame(() => {
e.pub(j, !1);
});
});
}
)) : e.link(tt, te);
}), me = c(0), _e = c(null), C = c(null, (e) => {
)) : e.link(st, se);
}), ke = c(0), Pe = c(null), H = c(null, (e) => {
e.link(
e.pipe(
C,
H,
d((t) => t !== null),
f((t) => t.length)
),
me
ke
);
}), Re = c(null), re = x((e) => {
}), De = c(null), le = S((e) => {
e.link(
e.pipe(
re,
S(Be),
le,
x(Ne),
f(([n, o]) => -(o * n.length))
),
F
), e.link(e.pipe(re, W(!0)), Oe), e.link(e.pipe(re, Ot()), Re);
_
), e.link(e.pipe(le, F(!0)), Ve), e.link(e.pipe(le, Vt()), De);
function t(n, o) {
e.pubIn({
[te]: n,
[st]: n
[se]: n,
[lt]: n
}), o ? requestAnimationFrame(() => {
e.pubIn({
[F]: 0,
[st]: 0,
[Re]: null,
[Oe]: !1
[_]: 0,
[lt]: 0,
[De]: null,
[Ve]: !1
});
}) : e.pubIn({
[F]: 0,
[st]: 0,
[Re]: null,
[Oe]: !1
[_]: 0,
[lt]: 0,
[De]: null,
[Ve]: !1
});

@@ -865,4 +865,4 @@ }

e.pipe(
ye,
S(Re),
$e,
x(De),
d(([, n]) => n !== null),

@@ -872,3 +872,3 @@ f(([n, o]) => {

throw new Error("Unexpected null items");
return xt(o.length, n);
return $t(o.length, n);
})

@@ -881,7 +881,7 @@ ),

e.pipe(
re,
Co(2),
S(ye, Re),
le,
Vo(2),
x($e, De),
d(([, , n]) => n !== null),
f(([n, o]) => xt(n.length, o))
f(([n, o]) => $t(n.length, o))
),

@@ -891,9 +891,9 @@ (n) => {

}
), e.changeWith(C, re, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
), e.changeWith(H, le, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
e.pipe(
re,
S(ee, Be),
le,
x(te, Ne),
f(([n, o, s]) => {
const i = n.length, r = s;
return de(o).reduce(
return ve(o).reduce(
(u, { k: a, v: p }) => ({

@@ -912,8 +912,8 @@ ranges: [...u.ranges, { startIndex: u.prevIndex, endIndex: a + i - 1, size: u.prevSize }],

),
Fe
Se
);
}), ut = x((e) => {
}), ft = S((e) => {
const t = e.pipe(
ut,
S(je, Wt, _e, ee),
ft,
x(qe, _t, Pe, te),
d(([, , , , o]) => !k(o)),

@@ -948,15 +948,15 @@ f(([{ data: o, scrollToBottom: s }, i, r, l]) => {

),
fe
he
), e.link(
e.pipe(
Ne,
S(fe),
Ye,
x(he),
d(([o, s]) => s),
f(() => !1)
),
fe
he
);
const n = e.pipe(
Ft,
S(fe),
Nt,
x(he),
d(([o, s]) => o === "up" && s)

@@ -969,41 +969,50 @@ );

),
fe
), e.link(e.pipe(n, W(!0)), $t), e.link(
he
), e.link(e.pipe(n, F(!0)), Lt), e.link(
e.pipe(
t,
d((o) => o !== null),
ce(20)
ue(20)
),
X
Q
);
}), lt = x((e) => {
e.changeWith(C, lt, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(lt, ut);
}), nt = x((e) => {
e.changeWith(C, nt, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ue, nt, ([t], n) => {
const s = ge(t, n.offset, "k")[0], i = n.data.length;
return [ao(t, s, 1 / 0, (l, u) => [l + i, u]), s];
}), e.link(nt, ut);
}), Et = x((e) => {
e.changeWith(C, Et, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ue, Et, ([t], { offset: n, count: o }) => [po(t, n, o), n]);
}), Ce = x((e) => {
}), at = S((e) => {
e.changeWith(H, at, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(at, ft);
}), it = S((e) => {
e.changeWith(H, it, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ae, it, ([t], n) => {
const s = de(t, n.offset, "k")[0], i = n.data.length;
return [fo(t, s, 1 / 0, (l, u) => [l + i, u]), s];
}), e.link(it, ft);
}), Rt = S((e) => {
e.changeWith(H, Rt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ae, Rt, ([t], { offset: n, count: o }) => [ho(t, n, o), n]);
}), Fe = S((e) => {
e.link(
e.pipe(
Ce,
Fe,
d(({ purgeItemSizes: t }) => !!t),
f(({ initialLocation: t }) => t)
),
We
), e.changeWith(Ee, Ce, (t, { purgeItemSizes: n }) => n ? De : t), e.sub(e.pipe(Ce, ve(0)), ({ data: t, purgeItemSizes: n, initialLocation: o }) => {
e.pubIn({
[C]: t.slice(),
...n ? { [ue]: ct } : o ? { [X]: o } : {}
_e
), e.changeWith(
Le,
e.pipe(
Fe,
d((t) => !!t.purgeItemSizes)
),
() => Oe
), e.sub(e.pipe(Fe, be(0)), ({ data: t, purgeItemSizes: n, initialLocation: o }) => {
n || requestAnimationFrame(() => {
e.pub(Mn);
}), e.pubIn({
[H]: t.slice(),
...n ? { [ae]: pt } : o ? { [Q]: o } : {}
});
});
}), qt = x((e) => {
e.changeWith(C, qt, (t, n) => t ? t.slice(n) : []), e.changeWith(ue, qt, ([t], n) => [de(t).reduce((s, { k: i, v: r }) => _(s, Math.max(0, i - n), r), $e()), 0]);
}), Gt = x((e) => {
e.changeWith(C, Gt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
}), Gt = S((e) => {
e.changeWith(H, Gt, (t, n) => t ? t.slice(n) : []), e.changeWith(ae, Gt, ([t], n) => [ve(t).reduce((s, { k: i, v: r }) => B(s, Math.max(0, i - n), r), we()), 0]);
}), Zt = S((e) => {
e.changeWith(H, Zt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
e.pipe(
Gt,
S(me, Be),
Zt,
x(ke, Ne),
f(([, t, n]) => [

@@ -1017,8 +1026,8 @@ {

),
Fe
Se
);
}), mn = x((e) => {
}), In = S((e) => {
const t = e.pipe(
mn,
S(C),
In,
x(H),
f(([n, o]) => {

@@ -1033,16 +1042,16 @@ if (!o)

);
e.changeWith(C, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ue, t, ([n], o) => [Do(n, o), 0]);
}), wt = x((e) => {
e.changeWith(C, wt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.changeWith(H, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ae, t, ([n], o) => [Co(n, o), 0]);
}), Mt = S((e) => {
e.changeWith(H, Mt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.pipe(
wt,
ve(40),
S(gn),
Mt,
be(40),
x(vn),
d(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),
f(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t }))
),
X
Q
);
});
function Co(e = 1) {
function Vo(e = 1) {
return (t, n) => {

@@ -1059,3 +1068,3 @@ const o = n.signalInstance();

}
const Fe = x();
const Se = S();
c([]);

@@ -1066,86 +1075,86 @@ c([]);

c(NaN);
const he = c(!1), ue = c(ct, (e) => {
const ge = c(!1), ae = c(pt, (e) => {
e.link(
e.pipe(
Fe,
Se,
d((t) => t.length > 0),
S(ee),
f(([t, n]) => vo(n, [t, []]))
x(te),
f(([t, n]) => mo(n, [t, []]))
),
ue
ae
);
}), ee = c(ct[0], (e) => {
}), te = c(pt[0], (e) => {
e.link(
e.pipe(
ue,
ae,
f(([t]) => t)
),
ee
te
);
}), kn = c(ct[1], (e) => {
}), xn = c(pt[1], (e) => {
e.link(
e.pipe(
ue,
ae,
f(([, t]) => t)
),
kn
xn
);
}), Be = c(xe[1]), ye = c(xe[0]), He = c(xe, (e) => {
}), Ne = c(Te[1]), $e = c(Te[0]), Be = c(Te, (e) => {
e.link(
e.pipe(
ee,
S(kn),
Q(([t], [n, o]) => So(t, [n, o]), xe)
te,
x(xn),
ee(([t], [n, o]) => yo(t, [n, o]), Te)
),
He
Be
), e.link(
e.pipe(
He,
Be,
f(([, t]) => t)
),
Be
Ne
), e.link(
e.pipe(
He,
Be,
f(([t]) => t)
),
ye
$e
);
}), In = c(xe[2], (e) => {
}), Sn = c(Te[2], (e) => {
e.link(
e.pipe(
He,
Be,
f(([, , t]) => t)
),
In
Sn
);
}), Sn = c(xe[3], (e) => {
}), yn = c(Te[3], (e) => {
e.link(
e.pipe(
He,
Be,
f(([, , , t]) => t)
),
Sn
yn
);
}), we = c(0, (e) => {
}), Re = c(0, (e) => {
e.link(
e.pipe(
e.combine(me, Sn, In, Be),
e.combine(ke, yn, Sn, Ne),
f(([t, n, o, s]) => o + (t - n) * s)
),
we
Re
);
}), Pe = x(), Wt = c(!1), Ne = x((e) => {
e.link(e.pipe(Ne, W(!1)), Pe);
}, !1), T = c(0), U = c(0), xn = c(0), j = c(0), Ho = T, ot = c(0), ze = c(0), Ye = c(0), Ke = c(0), _t = c(0), Lt = c(null), yn = ro(), Vo = yo, Wo = 50, at = be(0, (e) => e.pipe(
e.combine(ze, Ye),
}), ze = S(), _t = c(!1), Ye = S((e) => {
e.link(e.pipe(Ye, F(!1)), ze);
}, !1), T = c(0), q = c(0), Tn = c(0), U = c(0), Fo = T, rt = c(0), Ke = c(0), je = c(0), Ue = c(0), Pt = c(0), At = c(null), $n = en(), Bo = $o, Wo = 50, ht = me(0, (e) => e.pipe(
e.combine(Ke, je),
f(([t, n]) => t + n)
)), Tn = be(0, (e) => e.pipe(
e.combine(Ke, _t),
)), En = me(0, (e) => e.pipe(
e.combine(Ue, Pt),
f(([t, n]) => t + n)
)), _o = be(0, (e) => e.pipe(
e.combine(ze, Ye, T),
)), _o = me(0, (e) => e.pipe(
e.combine(Ke, je, T),
f(([t, n, o]) => t + Math.max(n - o, 0))
)), Fo = be(0, (e) => e.pipe(
e.combine(Ke, _t, T, U, j),
)), Po = me(0, (e) => e.pipe(
e.combine(Ue, Pt, T, q, U),
f(([t, n, o, s, i]) => {

@@ -1155,30 +1164,30 @@ const r = Math.max(n - (i - (o + s)), 0);

})
)), $n = be(0, (e) => e.pipe(
e.combine(U, _o, Fo),
)), wn = me(0, (e) => e.pipe(
e.combine(q, _o, Po),
f(([t, n, o]) => t - n - o)
)), pt = c(0), En = c(0, (e) => {
)), gt = c(0), Ln = c(0, (e) => {
e.link(
e.pipe(
e.combine(En, we, U),
e.combine(Ln, Re, q),
f(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o))))
),
pt
gt
);
}), Te = x((e) => {
}), Ee = S((e) => {
e.link(
e.pipe(
Te,
Ee,
f((t) => t.align === "start" ? t.top ?? 0 : 0)
),
En
Ln
), e.link(
e.pipe(
Te,
S(T),
Ee,
x(T),
d(([t, n]) => t.top !== n),
W(!0)
F(!0)
),
Pe
ze
);
}), je = be(
}), qe = me(
{

@@ -1194,12 +1203,12 @@ listOffset: 0,

T,
at,
Tn,
Ye,
$n,
ht,
En,
je,
wn,
U,
gt,
ge,
He,
j,
pt,
he,
Ae,
K,
fe
he
),

@@ -1221,5 +1230,5 @@ d(([, , , , , , , t, n, o]) => !t && n === null && !o),

]) => {
const m = e.getValue(hn), w = r - n - o, I = -t + s, b = l === 0 ? w + Math.min(0, I) - i : -l;
const m = e.getValue(dn), L = r - n - o, I = -t + s, b = l === 0 ? L + Math.min(0, I) - i : -l;
return {
scrollHeight: w,
scrollHeight: L,
listOffset: I,

@@ -1233,42 +1242,42 @@ visibleListHeight: i,

)
), Rt = x((e) => {
), Dt = S((e) => {
e.link(
e.pipe(
T,
ce(0),
S(je),
ue(0),
x(qe),
d(([, t]) => t.scrollHeight > 0),
f(([, t]) => t)
),
Rt
Dt
);
}), te = x(), F = c(0), st = c(0), Mt = c(0), wn = c(""), Ft = x(), Ln = ({ index: e }) => /* @__PURE__ */ Jt("div", { children: [
}), se = S(), _ = c(0), lt = c(0), Ct = c(0), Rn = c(""), Nt = S(), Mn = en(), An = ({ index: e }) => /* @__PURE__ */ Xt("div", { children: [
"Item ",
e
] }), Rn = ({ index: e }) => e, Dt = c(Ln), Mn = c(Rn), Dn = c(null), An = c(null), On = c(null), Cn = c(null), Hn = c(null), Vn = c("div"), Bo = {
] }), Dn = ({ index: e }) => e, Ot = c(An), Cn = c(Dn), On = c(null), Hn = c(null), Vn = c(null), Fn = c(null), Bn = c(null), Wn = c("div"), No = {
position: "sticky",
top: 0,
zIndex: 1
}, Ze = {
}, Qe = {
overflowAnchor: "none"
}, Po = {
}, zo = {
position: "sticky",
bottom: 0
}, Wn = h.forwardRef((e, t) => /* @__PURE__ */ y("div", { style: { zIndex: 1 }, ...e, ref: t })), _n = h.forwardRef((e, t) => /* @__PURE__ */ y("div", { ...e, ref: t })), Fn = h.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Bo, ...e }, ref: n })
), Bn = h.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Po, ...e }, ref: n })
), Pn = c(Wn), Nn = c(Fn), zn = c(_n), Yn = c(Bn), At = c("top", (e) => {
}, _n = g.forwardRef((e, t) => /* @__PURE__ */ y("div", { style: { zIndex: 1 }, ...e, ref: t })), Pn = g.forwardRef((e, t) => /* @__PURE__ */ y("div", { ...e, ref: t })), Nn = g.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...No, ...e }, ref: n })
), zn = g.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...zo, ...e }, ref: n })
), Yn = c(_n), Kn = c(Nn), jn = c(Pn), Un = c(zn), Ht = c("top", (e) => {
e.link(
e.pipe(
e.combine(At, we, U, at, Tn),
e.combine(Ht, Re, q, ht, En),
d(([t]) => t === "bottom" || t === "bottom-smooth"),
f(([, t, n, o, s]) => Math.max(0, n - t - o - s))
),
Mt
Ct
), e.link(
e.pipe(
e.combine(Mt, At),
e.combine(Ct, Ht),
d(([, t]) => t === "bottom-smooth"),
Q(
ee(
(t, [n]) => [t[1], n],

@@ -1279,9 +1288,9 @@ [0, 0]

),
wn
Rn
);
});
function No(e) {
return zo(Ko(jo(Yo(e), 8 * e.length))).toLowerCase();
function Yo(e) {
return Ko(Uo(qo(jo(e), 8 * e.length))).toLowerCase();
}
function zo(e) {
function Ko(e) {
for (var t, n = "0123456789ABCDEF", o = "", s = 0; s < e.length; s++)

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

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

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

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

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

}
function jo(e, t) {
function qo(e, t) {
e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;

@@ -1314,6 +1323,6 @@ for (var n = 1732584193, o = -271733879, s = -1732584194, i = 271733878, r = 0; r < e.length; r += 16) {

o = O(
o = A(
o = A(
o = A(
o = A(
o = C(
o = C(
o = C(
o = C(
o = D(

@@ -1323,10 +1332,10 @@ o = D(

o = D(
o = M(
o = M(
o = M(
o = M(
o = A(
o = A(
o = A(
o = A(
o,
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[r + 0], 7, -680876936), o, s, e[r + 1], 12, -389564586),
i = A(i, n = A(n, o, s, i, e[r + 0], 7, -680876936), o, s, e[r + 1], 12, -389564586),
n,

@@ -1344,5 +1353,5 @@ o,

),
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[r + 4], 7, -176418897), o, s, e[r + 5], 12, 1200080426),
i = A(i, n = A(n, o, s, i, e[r + 4], 7, -176418897), o, s, e[r + 5], 12, 1200080426),
n,

@@ -1360,5 +1369,5 @@ o,

),
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[r + 8], 7, 1770035416), o, s, e[r + 9], 12, -1958414417),
i = A(i, n = A(n, o, s, i, e[r + 8], 7, 1770035416), o, s, e[r + 9], 12, -1958414417),
n,

@@ -1376,5 +1385,5 @@ o,

),
s = M(
s = A(
s,
i = M(i, n = M(n, o, s, i, e[r + 12], 7, 1804603682), o, s, e[r + 13], 12, -40341101),
i = A(i, n = A(n, o, s, i, e[r + 12], 7, 1804603682), o, s, e[r + 13], 12, -40341101),
n,

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

),
s = A(
s = C(
s,
i = A(i, n = A(n, o, s, i, e[r + 5], 4, -378558), o, s, e[r + 8], 11, -2022574463),
i = C(i, n = C(n, o, s, i, e[r + 5], 4, -378558), o, s, e[r + 8], 11, -2022574463),
n,

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

),
s = A(
s = C(
s,
i = A(i, n = A(n, o, s, i, e[r + 1], 4, -1530992060), o, s, e[r + 4], 11, 1272893353),
i = C(i, n = C(n, o, s, i, e[r + 1], 4, -1530992060), o, s, e[r + 4], 11, 1272893353),
n,

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

),
s = A(
s = C(
s,
i = A(i, n = A(n, o, s, i, e[r + 13], 4, 681279174), o, s, e[r + 0], 11, -358537222),
i = C(i, n = C(n, o, s, i, e[r + 13], 4, 681279174), o, s, e[r + 0], 11, -358537222),
n,

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

),
s = A(
s = C(
s,
i = A(i, n = A(n, o, s, i, e[r + 9], 4, -640364487), o, s, e[r + 12], 11, -421815835),
i = C(i, n = C(n, o, s, i, e[r + 9], 4, -640364487), o, s, e[r + 12], 11, -421815835),
n,

@@ -1575,111 +1584,111 @@ o,

-343485551
), n = le(n, l), o = le(o, u), s = le(s, a), i = le(i, p);
), n = ce(n, l), o = ce(o, u), s = ce(s, a), i = ce(i, p);
}
return [n, o, s, i];
}
function ft(e, t, n, o, s, i) {
return le(Uo(le(le(t, e), le(o, i)), s), n);
function dt(e, t, n, o, s, i) {
return ce(Go(ce(ce(t, e), ce(o, i)), s), n);
}
function M(e, t, n, o, s, i, r) {
return ft(t & n | ~t & o, e, t, s, i, r);
function A(e, t, n, o, s, i, r) {
return dt(t & n | ~t & o, e, t, s, i, r);
}
function D(e, t, n, o, s, i, r) {
return ft(t & o | n & ~o, e, t, s, i, r);
return dt(t & o | n & ~o, e, t, s, i, r);
}
function A(e, t, n, o, s, i, r) {
return ft(t ^ n ^ o, e, t, s, i, r);
function C(e, t, n, o, s, i, r) {
return dt(t ^ n ^ o, e, t, s, i, r);
}
function O(e, t, n, o, s, i, r) {
return ft(n ^ (t | ~o), e, t, s, i, r);
return dt(n ^ (t | ~o), e, t, s, i, r);
}
function le(e, t) {
function ce(e, t) {
const n = (65535 & e) + (65535 & t);
return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n;
}
function Uo(e, t) {
function Go(e, t) {
return e << t | e >>> 32 - t;
}
const Kn = Symbol("INVALID_KEY");
function qo(e) {
const qn = Symbol("INVALID_KEY");
function Zo(e) {
const t = e.slice(0, 32), n = e.slice(32), o = atob(n);
if (t !== No(n))
return Kn;
if (t !== Yo(n))
return qn;
const [s, i] = o.split(";"), r = s.slice(2), l = new Date(Number(i.slice(2)));
return { orderNumber: r, expiryDate: l };
}
const Go = {
const Jo = {
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."
}, Zo = {
}, Xo = {
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/"
}, Jo = {
}, Qo = {
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."
}, jn = {
}, Gn = {
valid: !0
}, Xo = {
}, es = {
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"
}, Qo = {
}, ts = {
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/"
}, es = {
}, ns = {
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/"
}, ts = jn, ns = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, os = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function ss({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(ns), i = os.some((r) => n.endsWith(r));
}, os = Gn, ss = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, is = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function rs({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(ss), i = is.some((r) => n.endsWith(r));
if (e) {
const r = qo(e);
if (r === Kn)
return Xo;
const r = Zo(e);
if (r === qn)
return es;
if (r.expiryDate.getTime() < t.getTime()) {
if (s)
return Qo;
return ts;
if (r.expiryDate.getTime() < o)
return es;
return ns;
}
} else
return i ? ts : s ? Jo : Zo;
return jn;
return i ? os : s ? Qo : Xo;
return Gn;
}
const Un = h.createContext(Go), is = ({
const Zn = g.createContext(Jo), ls = ({
licenseKey: e,
children: t
}) => {
const n = ss({
const n = rs({
licenseKey: e,
hostname: typeof window < "u" ? window.location.hostname : "localhost",
now: /* @__PURE__ */ new Date(),
packageTimestamp: 1720508920212
packageTimestamp: 1721286838944
});
return /* @__PURE__ */ y(Un.Provider, { value: n, children: t });
return /* @__PURE__ */ y(Zn.Provider, { value: n, children: t });
};
is.displayName = Math.random().toString(36).slice(2, 8);
const rs = h.createContext(void 0);
function ls(e, t, n) {
const o = Ct(), s = h.useRef(null), i = h.useRef(null);
ls.displayName = Math.random().toString(36).slice(2, 8);
const cs = g.createContext(void 0);
function us(e, t, n) {
const o = Ft(), s = g.useRef(null), i = g.useRef(null);
function r() {
s.current && (cancelAnimationFrame(s.current), s.current = null, i.current = null);
}
h.useEffect(() => o.sub(Ft, (a) => {
g.useEffect(() => o.sub(Nt, (a) => {
a !== i.current && r();
}), [o]), h.useEffect(() => o.sub(yn, r), [o]);
const l = h.useCallback(
}), [o]), g.useEffect(() => o.sub($n, r), [o]);
const l = g.useCallback(
(a, p, v) => {
var B;
var P;
s.current && r();
const m = ((B = e.current) == null ? void 0 : B.scrollTop) ?? 0;
const m = ((P = e.current) == null ? void 0 : P.scrollTop) ?? 0;
i.current = m < a ? "down" : "up";
let w = 0, I = 0;
let L = 0, I = 0;
function b() {
var q, G;
const Y = m + (a - m) * p(w);
(q = e.current) == null || q.scrollTo({ top: Y, behavior: "instant" }), w += 1 / v, I += 1, I < v ? s.current = requestAnimationFrame(b) : ((G = e.current) == null || G.scrollTo({ top: a, behavior: "instant" }), s.current = null, i.current = null);
var G, Z;
const K = m + (a - m) * p(L);
(G = e.current) == null || G.scrollTo({ top: K, behavior: "instant" }), L += 1 / v, I += 1, I < v ? s.current = requestAnimationFrame(b) : ((Z = e.current) == null || Z.scrollTo({ top: a, behavior: "instant" }), s.current = null, i.current = null);
}

@@ -1690,15 +1699,15 @@ b();

);
return h.useCallback(
return g.useCallback(
(a) => {
var p, v, m, w;
var p, v, m, L;
if (a.top === ((p = e.current) == null ? void 0 : p.scrollTop)) {
o.pub(Ne, (v = e.current) == null ? void 0 : v.scrollTop);
o.pub(Ye, (v = e.current) == null ? void 0 : v.scrollTop);
return;
}
if (a.top !== void 0 && (n.current = a.top, o.pub(Wt, !0)), a.forceBottomSpace !== void 0 && t.current && (t.current.style.paddingBottom = `${a.forceBottomSpace}px`), a.behavior === "smooth")
l(a.top ?? 0, Vo, Wo);
if (a.top !== void 0 && (n.current = a.top, o.pub(_t, !0)), a.forceBottomSpace !== void 0 && t.current && (t.current.style.paddingBottom = `${a.forceBottomSpace}px`), a.behavior === "smooth")
l(a.top ?? 0, Bo, Wo);
else if (a.behavior === "auto" || a.behavior === "instant" || a.behavior === void 0)
r(), (m = e.current) == null || m.scrollTo(a);
else {
const { easing: I, animationFrameCount: b } = a.behavior(((w = e.current) == null ? void 0 : w.scrollTop) ?? 0, a.top ?? 0);
const { easing: I, animationFrameCount: b } = a.behavior(((L = e.current) == null ? void 0 : L.scrollTop) ?? 0, a.top ?? 0);
l(a.top ?? 0, I, b);

@@ -1710,10 +1719,10 @@ }

}
function qn(e) {
function Jn(e) {
return {
data: {
prepend: (t) => {
e.pub(re, t);
e.pub(le, t);
},
append: (t, n) => {
e.pub(lt, {
e.pub(at, {
data: t,

@@ -1724,3 +1733,3 @@ scrollToBottom: n

replace: (t, n) => {
e.pub(Ce, {
e.pub(Fe, {
...n,

@@ -1731,3 +1740,3 @@ data: t

map: (t, n) => {
e.pub(wt, {
e.pub(Mt, {
mapper: t,

@@ -1738,8 +1747,8 @@ autoscrollToBottomBehavior: n

findAndDelete: (t) => {
e.pub(mn, t);
e.pub(In, t);
},
findIndex: (t) => e.getValue(C).findIndex(t),
find: (t) => e.getValue(C).find(t),
findIndex: (t) => e.getValue(H).findIndex(t),
find: (t) => e.getValue(H).find(t),
insert: function(t, n, o) {
e.pub(nt, {
e.pub(it, {
data: t,

@@ -1751,3 +1760,3 @@ offset: n,

deleteRange: function(t, n) {
e.pub(Et, {
e.pub(Rt, {
offset: t,

@@ -1758,24 +1767,24 @@ count: n

batch: (t, n) => {
e.pub(he, !0), t(), e.pub(he, !1), e.pub(ut, { data: [], scrollToBottom: n });
e.pub(ge, !0), t(), e.pub(ge, !1), e.pub(ft, { data: [], scrollToBottom: n });
},
get: () => e.getValue(C).slice(),
getCurrentlyRendered: () => e.getValue(rt)
get: () => e.getValue(H).slice(),
getCurrentlyRendered: () => e.getValue(ut)
},
scrollToItem: (t) => {
e.pub(X, t);
e.pub(Q, t);
},
scrollIntoView: (t) => {
e.pub(bn, t);
e.pub(kn, t);
},
scrollerElement: () => e.getValue(Lt),
scrollerElement: () => e.getValue(At),
getScrollLocation() {
return e.getValue(je);
return e.getValue(qe);
},
cancelSmoothScroll() {
e.pub(yn);
e.pub($n);
}
};
}
const cs = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const s = V(_e), i = h.useRef(null), r = h.useCallback(
const as = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const s = V(Pe), i = g.useRef(null), r = g.useCallback(
(l) => {

@@ -1802,5 +1811,5 @@ l ? (i.current = l, n(l)) : i.current && (o(i.current), i.current = null);

};
function Je(e) {
const t = h.useRef(null);
return [h.useCallback(
function et(e) {
const t = g.useRef(null);
return [g.useCallback(
(o) => {

@@ -1812,7 +1821,7 @@ o ? (t.current = o, e == null || e.observe(o, { box: "border-box" })) : t.current && (e == null || e.unobserve(t.current), t.current = null);

}
let Zt = !1;
const us = h.forwardRef(
let Jt = !1;
const ps = g.forwardRef(
({
initialData: e = [],
computeItemKey: t = Rn,
computeItemKey: t = Dn,
context: n = null,

@@ -1823,3 +1832,3 @@ initialLocation: o = null,

onRenderedDataChange: r,
ItemContent: l = Ln,
ItemContent: l = An,
Header: u = null,

@@ -1830,47 +1839,47 @@ StickyHeader: a = null,

EmptyPlaceholder: m = null,
HeaderWrapper: w = Wn,
StickyHeaderWrapper: I = Fn,
FooterWrapper: b = _n,
StickyFooterWrapper: B = Bn,
ScrollElement: Y = "div",
...q
}, G) => {
const Z = h.useMemo(() => {
const L = new lo();
return L.register(Ee), L.register(Pe), L.register(tt), L.register(Qe), L.register(lt), L.register(re), L.register(Ce), L.pubIn({
[C]: e.slice(),
[_e]: n,
[Mn]: t,
[We]: o,
[Dt]: l,
[Dn]: u,
[On]: p,
[An]: a,
[Cn]: v,
[Hn]: m,
[Vn]: Y,
[Yn]: B,
[Nn]: I,
[zn]: b,
[Pn]: w,
[At]: s
}), L.singletonSub(Rt, i), L.singletonSub(rt, r), L;
HeaderWrapper: L = _n,
StickyHeaderWrapper: I = Nn,
FooterWrapper: b = Pn,
StickyFooterWrapper: P = zn,
ScrollElement: K = "div",
...G
}, Z) => {
const J = g.useMemo(() => {
const R = new uo();
return R.register(Le), R.register(ze), R.register(st), R.register(nt), R.register(at), R.register(le), R.register(Fe), R.pubIn({
[H]: e.slice(),
[Pe]: n,
[Cn]: t,
[_e]: o,
[Ot]: l,
[On]: u,
[Vn]: p,
[Hn]: a,
[Fn]: v,
[Bn]: m,
[Wn]: K,
[Un]: P,
[Kn]: I,
[jn]: b,
[Yn]: L,
[Ht]: s
}), R.singletonSub(Dt, i), R.singletonSub(ut, r), R;
}, []);
h.useImperativeHandle(G, () => qn(Z), [Z]), h.useEffect(() => {
Z.pubIn({
[_e]: n,
[Dt]: l
}), Z.singletonSub(Rt, i), Z.singletonSub(rt, r);
g.useImperativeHandle(Z, () => Jn(J), [J]), g.useEffect(() => {
J.pubIn({
[Pe]: n,
[Ot]: l
}), J.singletonSub(Dt, i), J.singletonSub(ut, r);
});
const P = h.useContext(Un);
return h.useEffect(() => {
P.consoleMessage && (Zt || (Zt = !0, console.error(P.consoleMessage)));
}, [P]), h.useEffect(() => {
const L = (R) => {
R.message.includes("ResizeObserver loop") && (R.preventDefault(), R.stopPropagation(), R.stopImmediatePropagation());
const N = g.useContext(Zn);
return g.useEffect(() => {
N.consoleMessage && (Jt || (Jt = !0, console.error(N.consoleMessage)));
}, [N]), g.useEffect(() => {
const R = (M) => {
M.message.includes("ResizeObserver loop") && (M.preventDefault(), M.stopPropagation(), M.stopImmediatePropagation());
};
return window.addEventListener("error", L, { capture: !0 }), () => {
window.removeEventListener("error", L);
return window.addEventListener("error", R, { capture: !0 }), () => {
window.removeEventListener("error", R);
};
}, []), typeof window < "u" && P.watermarkMessage ? /* @__PURE__ */ y(
}, []), typeof window < "u" && N.watermarkMessage ? /* @__PURE__ */ y(
"div",

@@ -1882,10 +1891,10 @@ {

},
children: P.watermarkMessage
children: N.watermarkMessage
}
) : /* @__PURE__ */ y(co.Provider, { value: Z, children: /* @__PURE__ */ y(as, { ...q }) });
) : /* @__PURE__ */ y(ao.Provider, { value: J, children: /* @__PURE__ */ y(fs, { ...G }) });
}
);
us.displayName = "VirtuosoMessageList";
const as = ({ style: e, ...t }) => {
const n = Ct(), o = h.useContext(rs), [
ps.displayName = "VirtuosoMessageList";
const fs = ({ style: e, ...t }) => {
const n = Ft(), o = g.useContext(cs), [
s,

@@ -1900,90 +1909,90 @@ i,

m,
w,
L,
I
] = uo(
Dn,
An,
Pn,
Nn,
] = po(
On,
Cn,
zn,
Hn,
Yn,
Dt,
Hn,
Vn
), [b] = h.useState(() => {
Kn,
Vn,
Fn,
jn,
Un,
Ot,
Bn,
Wn
), [b] = g.useState(() => {
if (typeof ResizeObserver > "u")
throw new Error("ResizeObserver not found. Please ensure that you have a polyfill installed.");
return new ResizeObserver((g) => {
var Bt, Pt, Nt, zt;
const Ie = g.length, ie = [];
let H = {};
for (let gt = 0; gt < Ie; gt++) {
const pe = g[gt], z = pe.target;
if (z === P.current) {
H = {
...H,
[Ye]: pe.contentRect.height,
[j]: (Bt = $.current) == null ? void 0 : Bt.scrollHeight
return new ResizeObserver((h) => {
var Xe, xe, Ae, Yt;
const oe = h.length, W = [];
let E = {};
for (let bt = 0; bt < oe; bt++) {
const fe = h[bt], Y = fe.target;
if (Y === N.current) {
E = {
...E,
[je]: fe.contentRect.height,
[U]: (Xe = $.current) == null ? void 0 : Xe.scrollHeight
};
continue;
} else if (z === R.current) {
H = {
...H,
[ze]: pe.contentRect.height,
[j]: (Pt = $.current) == null ? void 0 : Pt.scrollHeight
} else if (Y === M.current) {
E = {
...E,
[Ke]: fe.contentRect.height,
[U]: (xe = $.current) == null ? void 0 : xe.scrollHeight
};
continue;
} else if (z === Y.current) {
H = {
...H,
[_t]: pe.contentRect.height,
[j]: (Nt = $.current) == null ? void 0 : Nt.scrollHeight
} else if (Y === K.current) {
E = {
...E,
[Pt]: fe.contentRect.height,
[U]: (Ae = $.current) == null ? void 0 : Ae.scrollHeight
};
continue;
} else if (z === G.current) {
H = {
...H,
[Ke]: pe.contentRect.height,
[j]: (zt = $.current) == null ? void 0 : zt.scrollHeight
} else if (Y === Z.current) {
E = {
...E,
[Ue]: fe.contentRect.height,
[U]: (Yt = $.current) == null ? void 0 : Yt.scrollHeight
};
continue;
} else if (z === $.current) {
H = {
...H,
[T]: z.scrollTop,
[j]: z.scrollHeight,
[U]: pe.contentRect.height,
[xn]: z.clientWidth
} else if (Y === $.current) {
E = {
...E,
[T]: Y.scrollTop,
[U]: Y.scrollHeight,
[q]: fe.contentRect.height,
[Tn]: Y.clientWidth
};
continue;
} else if (z === ne.current) {
$.current && (H = {
...H,
[j]: $.current.scrollHeight
} else if (Y === ne.current) {
$.current && (E = {
...E,
[U]: $.current.scrollHeight
});
continue;
}
if (z.dataset.index === void 0)
if (Y.dataset.index === void 0)
continue;
const dt = parseInt(z.dataset.index), so = parseFloat(z.dataset.knownSize ?? ""), vt = pe.contentRect.height;
if (vt === so)
const mt = parseInt(Y.dataset.index), lo = parseFloat(Y.dataset.knownSize ?? ""), kt = fe.contentRect.height;
if (kt === lo)
continue;
const Yt = ie[ie.length - 1];
ie.length === 0 || Yt.size !== vt || Yt.endIndex !== dt - 1 ? ie.push({ endIndex: dt, size: vt, startIndex: dt }) : ie[ie.length - 1].endIndex++;
const Kt = W[W.length - 1];
W.length === 0 || Kt.size !== kt || Kt.endIndex !== mt - 1 ? W.push({ endIndex: mt, size: kt, startIndex: mt }) : W[W.length - 1].endIndex++;
}
ie.length > 0 && (H = {
...H,
[Fe]: ie
}), n.pubIn(H);
W.length > 0 && (E = {
...E,
[Se]: W
}), n.pubIn(E);
});
}), [B, Y] = Je(b), [q, G] = Je(b), [Z, P] = Je(b), [L, R] = Je(b), Ue = h.useCallback(
(g) => {
}), [P, K] = et(b), [G, Z] = et(b), [J, N] = et(b), [R, M] = et(b), Ge = g.useCallback(
(h) => {
if (o) {
const Ie = parseInt(g.dataset.index ?? "");
n.pub(Fe, [
const oe = parseInt(h.dataset.index ?? "");
n.pub(Se, [
{
startIndex: Ie,
endIndex: Ie,
startIndex: oe,
endIndex: oe,
size: o.itemHeight

@@ -1993,87 +2002,102 @@ }

}
b.observe(g);
b.observe(h);
},
[b, n, o]
), qe = h.useCallback(
(g) => {
b.unobserve(g);
), Ze = g.useCallback(
(h) => {
b.unobserve(h);
},
[b]
), $ = h.useRef(null), ne = h.useRef(null), Ge = h.useCallback(
(g) => {
g ? (ne.current = g, b.observe(g, { box: "border-box" })) : ne.current && (b.unobserve(ne.current), ne.current = null);
), $ = g.useRef(null), ne = g.useRef(null), Je = g.useCallback(
(h) => {
h ? (ne.current = h, b.observe(h, { box: "border-box" })) : ne.current && (b.unobserve(ne.current), ne.current = null);
},
[b]
), N = h.useRef(null), ke = ls($, ne, N), oe = h.useCallback((g) => {
$.current && ($.current.scrollTop += g);
}, []), J = h.useCallback(() => {
const g = $.current;
if (g !== null) {
if (N.current !== null) {
const Ie = g.scrollHeight - g.clientHeight;
un(g.scrollTop, Math.min(Ie, N.current)) && (N.current = null, n.pub(Wt, !1), n.pub(Ne, g.scrollTop));
), z = g.useRef(null), Ie = us($, ne, z), ie = g.useCallback((h) => {
$.current && ($.current.scrollTop += h);
}, []), X = g.useCallback(() => {
const h = $.current;
if (h !== null) {
if (z.current !== null) {
const oe = h.scrollHeight - h.clientHeight;
pn(h.scrollTop, Math.min(oe, z.current)) && (z.current = null, n.pub(_t, !1), n.pub(Ye, h.scrollTop));
}
n.pub(T, g.scrollTop);
n.pub(T, h.scrollTop);
}
}, [n]), Le = h.useCallback(
(g) => {
n.pub(Ft, g.deltaY > 0 ? "down" : "up");
}, [n]), Me = g.useCallback(
(h) => {
n.pub(Nt, h.deltaY > 0 ? "down" : "up");
},
[n]
), se = h.useCallback(
(g) => {
g ? (n.pub(Lt, g), $.current = g, g.addEventListener("scroll", J), g.addEventListener("wheel", Le), o && n.pubIn({
), re = g.useCallback(
(h) => {
h ? (n.pub(At, h), $.current = h, h.addEventListener("scroll", X), h.addEventListener("wheel", Me), o && n.pubIn({
[q]: o.viewportHeight,
[U]: o.viewportHeight,
[j]: o.viewportHeight,
[T]: 0
}), b.observe(g, { box: "border-box" })) : $.current && ($.current.removeEventListener("scroll", J), $.current.removeEventListener("wheel", Le), n.pub(Lt, null), b.unobserve($.current), $.current = null);
}), b.observe(h, { box: "border-box" })) : $.current && ($.current.removeEventListener("scroll", X), $.current.removeEventListener("wheel", Me), n.pub(At, null), b.unobserve($.current), $.current = null);
},
[b, n, J, Le, o]
), { items: ht } = V(Ee);
h.useLayoutEffect(() => n.sub(Te, ke), [ke, n]), h.useLayoutEffect(() => n.sub(te, oe), [oe, n]);
const Gn = V(F), Zn = V(st), Jn = V(K), Xn = V(Mt), Qn = V(pt), eo = V(wn), ae = V(_e), to = V(Mn), no = V(me), oo = V(we);
return /* @__PURE__ */ y(io, { children: /* @__PURE__ */ Jt(
[b, n, X, Me, o]
), { items: vt } = V(Le);
g.useLayoutEffect(() => n.sub(Ee, Ie), [Ie, n]), g.useLayoutEffect(() => n.sub(se, ie), [ie, n]);
const zt = g.useCallback(() => {
var oe;
const h = [];
for (const W of ((oe = ne.current) == null ? void 0 : oe.children) ?? []) {
if (W.dataset.index === void 0)
continue;
const E = parseInt(W.dataset.index), Xe = parseFloat(W.dataset.knownSize ?? ""), xe = W.getBoundingClientRect().height;
if (xe === Xe)
continue;
const Ae = h[h.length - 1];
h.length === 0 || Ae.size !== xe || Ae.endIndex !== E - 1 ? h.push({ endIndex: E, size: xe, startIndex: E }) : h[h.length - 1].endIndex++;
}
n.pub(Se, h);
}, [n]);
g.useLayoutEffect(() => n.sub(Mn, zt), [zt, n]);
const Xn = V(_), Qn = V(lt), eo = V(j), to = V(Ct), no = V(gt), oo = V(Rn), pe = V(Pe), so = V(Cn), io = V(ke), ro = V(Re);
return /* @__PURE__ */ y(co, { children: /* @__PURE__ */ Xt(
I,
{
...t,
ref: se,
ref: re,
"data-testid": "virtuoso-scroller",
style: {
overflowY: Jn ? "hidden" : "scroll",
overflowY: eo ? "hidden" : "scroll",
boxSizing: "border-box",
...e
},
...I === "div" ? { context: ae } : {},
...I === "div" ? { context: pe } : {},
children: [
i && /* @__PURE__ */ y(l, { ref: L, style: Ze, children: /* @__PURE__ */ y(i, { context: ae }) }),
s && /* @__PURE__ */ y(r, { ref: Z, style: Ze, children: /* @__PURE__ */ y(s, { context: ae }) }),
no > 0 ? /* @__PURE__ */ y(
i && /* @__PURE__ */ y(l, { ref: R, style: Qe, children: /* @__PURE__ */ y(i, { context: pe }) }),
s && /* @__PURE__ */ y(r, { ref: J, style: Qe, children: /* @__PURE__ */ y(s, { context: pe }) }),
io > 0 ? /* @__PURE__ */ y(
"div",
{
ref: Ge,
ref: Je,
"data-testid": "virtuoso-list",
style: {
boxSizing: "content-box",
height: oo,
paddingBottom: Qn,
height: ro,
paddingBottom: no,
overflowAnchor: "none",
marginTop: Xn,
transition: eo,
marginTop: to,
transition: oo,
position: "relative",
transform: `translateY(${Gn + Zn}px)`
transform: `translateY(${Xn + Qn}px)`
},
children: ht.map((g) => /* @__PURE__ */ y(
cs,
children: vt.map((h) => /* @__PURE__ */ y(
as,
{
mount: Ue,
unmount: qe,
item: g,
mount: Ge,
unmount: Ze,
item: h,
ItemContent: m
},
to({ index: g.index, data: g.data, context: ae })
so({ index: h.index, data: h.data, context: pe })
))
}
) : w ? /* @__PURE__ */ y(w, { context: ae }) : null,
u && /* @__PURE__ */ y(p, { ref: B, style: Ze, children: /* @__PURE__ */ y(u, { context: ae }) }),
a && /* @__PURE__ */ y(v, { ref: q, style: Ze, children: /* @__PURE__ */ y(a, { context: ae }) })
) : L ? /* @__PURE__ */ y(L, { context: pe }) : null,
u && /* @__PURE__ */ y(p, { ref: P, style: Qe, children: /* @__PURE__ */ y(u, { context: pe }) }),
a && /* @__PURE__ */ y(v, { ref: G, style: Qe, children: /* @__PURE__ */ y(a, { context: pe }) })
]

@@ -2083,19 +2107,19 @@ }

};
function gs() {
return V(je);
function vs() {
return V(qe);
}
function ds() {
return V(rt);
function bs() {
return V(ut);
}
function vs() {
const e = Ct();
return h.useMemo(() => qn(e), [e]);
function ms() {
const e = Ft();
return g.useMemo(() => Jn(e), [e]);
}
export {
us as VirtuosoMessageList,
is as VirtuosoMessageListLicense,
rs as VirtuosoMessageListTestingContext,
ds as useCurrentlyRenderedData,
gs as useVirtuosoLocation,
vs as useVirtuosoMethods
ps as VirtuosoMessageList,
ls as VirtuosoMessageListLicense,
cs as VirtuosoMessageListTestingContext,
bs as useCurrentlyRenderedData,
vs as useVirtuosoLocation,
ms as useVirtuosoMethods
};

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

},
"version": "1.8.2",
"version": "1.8.3-alpha.1",
"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