@virtuoso.dev/message-list
Advanced tools
Comparing version 1.8.0-alpha.19 to 1.8.0-alpha.20
@@ -0,1 +1,9 @@ | ||
# [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) | ||
### Bug Fixes | ||
* lint ([ecb15e6](https://github.com/virtuoso-dev/message-list/commit/ecb15e66089e0cbcb01e6c79dfcccd9759360946)) | ||
* use mousewheel for cancellation ([3f6fb62](https://github.com/virtuoso-dev/message-list/commit/3f6fb629155053cad649332acfd45bfac7342806)) | ||
# [1.8.0-alpha.19](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.18...v1.8.0-alpha.19) (2024-06-17) | ||
@@ -2,0 +10,0 @@ |
1254
dist/index.js
@@ -1,5 +0,5 @@ | ||
import { jsxs as Pt, jsx as y, Fragment as Gn } from "react/jsx-runtime"; | ||
import { jsxs as Nt, jsx as I, Fragment as Xn } from "react/jsx-runtime"; | ||
import g from "react"; | ||
import { Cell as c, Signal as S, throttleTime as Re, map as a, mapTo as C, debounceTime as re, filter as v, scan as q, withLatestFrom as I, delayWithMicrotask as Mt, onNext as Nt, useCellValue as B, useRealm as zt, Realm as Zn, RealmContext as Jn, useCellValues as Xn } from "@mdxeditor/gurx"; | ||
function be(e, t) { | ||
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) { | ||
const n = c(e, (o) => { | ||
@@ -11,3 +11,3 @@ o.link(t(o), n); | ||
const xe = { lvl: 0 }; | ||
function Yt(e, t, n, o = xe, s = xe) { | ||
function Kt(e, t, n, o = xe, s = xe) { | ||
return { k: e, l: o, lvl: n, r: s, v: t }; | ||
@@ -18,6 +18,6 @@ } | ||
} | ||
function me() { | ||
function ke() { | ||
return xe; | ||
} | ||
function vt(e, t) { | ||
function gt(e, t) { | ||
if (b(e)) | ||
@@ -32,9 +32,9 @@ return xe; | ||
{ | ||
const [i, l] = Kt(o); | ||
return je($(e, { k: i, l: jt(o), v: l })); | ||
const [i, l] = jt(o); | ||
return Ue($(e, { k: i, l: Ut(o), v: l })); | ||
} | ||
} else | ||
return t < n ? je($(e, { l: vt(o, t) })) : je($(e, { r: vt(s, t) })); | ||
return t < n ? Ue($(e, { l: gt(o, t) })) : Ue($(e, { r: gt(s, t) })); | ||
} | ||
function ce(e, t, n = "k") { | ||
function ue(e, t, n = "k") { | ||
if (b(e)) | ||
@@ -45,11 +45,11 @@ return [-1 / 0, void 0]; | ||
if (e[n] < t) { | ||
const o = ce(e.r, t, n); | ||
const o = ue(e.r, t, n); | ||
return o[0] === -1 / 0 ? [e.k, e.v] : o; | ||
} | ||
return ce(e.l, t, n); | ||
return ue(e.l, t, n); | ||
} | ||
function O(e, t, n) { | ||
return b(e) ? Yt(t, n, 1) : t === e.k ? $(e, { k: t, v: n }) : t < e.k ? Ht($(e, { l: O(e.l, t, n) })) : Ht($(e, { r: O(e.r, 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 bt(e, t, n) { | ||
function dt(e, t, n) { | ||
if (b(e)) | ||
@@ -59,37 +59,37 @@ return []; | ||
let r = []; | ||
return o > t && (r = r.concat(bt(i, t, n))), o >= t && o <= n && r.push({ k: o, v: s }), o <= n && (r = r.concat(bt(l, t, n))), r; | ||
return o > t && (r = r.concat(dt(i, t, n))), o >= t && o <= n && r.push({ k: o, v: s }), o <= n && (r = r.concat(dt(l, t, n))), r; | ||
} | ||
function Qn(e, t, n, o) { | ||
function no(e, t, n, o) { | ||
if (b(e)) | ||
return xe; | ||
let s = me(); | ||
for (const { k: i, v: l } of ve(e)) | ||
i > t && i <= n ? s = O(s, ...o(i, l)) : s = O(s, i, l); | ||
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); | ||
return s; | ||
} | ||
function eo(e, t, n) { | ||
let o = me(), s = -1; | ||
for (const { start: i, end: l, value: r } of to(e)) | ||
i < t ? (o = O(o, i, r), s = r) : i > t + n ? o = O(o, i - n, r) : l >= t + n && s !== r && (o = O(o, t, r)); | ||
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)); | ||
return o; | ||
} | ||
function ve(e) { | ||
return b(e) ? [] : [...ve(e.l), { k: e.k, v: e.v }, ...ve(e.r)]; | ||
function be(e) { | ||
return b(e) ? [] : [...be(e.l), { k: e.k, v: e.v }, ...be(e.r)]; | ||
} | ||
function Kt(e) { | ||
return b(e.r) ? [e.k, e.v] : Kt(e.r); | ||
} | ||
function jt(e) { | ||
return b(e.r) ? e.l : je($(e, { r: jt(e.r) })); | ||
return b(e.r) ? [e.k, e.v] : jt(e.r); | ||
} | ||
function Ut(e) { | ||
return b(e.r) ? e.l : Ue($(e, { r: Ut(e.r) })); | ||
} | ||
function $(e, t) { | ||
return Yt(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r); | ||
return Kt(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r); | ||
} | ||
function gt(e) { | ||
function ft(e) { | ||
return b(e) || e.lvl > e.r.lvl; | ||
} | ||
function Ht(e) { | ||
return mt(Zt(e)); | ||
function Vt(e) { | ||
return vt(Jt(e)); | ||
} | ||
function je(e) { | ||
function Ue(e) { | ||
const { l: t, r: n, lvl: o } = e; | ||
@@ -99,4 +99,4 @@ if (n.lvl >= o - 1 && t.lvl >= o - 1) | ||
if (o > n.lvl + 1) { | ||
if (gt(t)) | ||
return Zt($(e, { lvl: o - 1 })); | ||
if (ft(t)) | ||
return Jt($(e, { lvl: o - 1 })); | ||
if (!b(t) && !b(t.r)) | ||
@@ -113,6 +113,6 @@ return $(t.r, { | ||
} else { | ||
if (gt(e)) | ||
return mt($(e, { lvl: o - 1 })); | ||
if (ft(e)) | ||
return vt($(e, { lvl: o - 1 })); | ||
if (!b(n) && !b(n.l)) { | ||
const s = n.l, i = gt(s) ? n.lvl - 1 : n.lvl; | ||
const s = n.l, i = ft(s) ? n.lvl - 1 : n.lvl; | ||
return $(s, { | ||
@@ -124,3 +124,3 @@ l: $(e, { | ||
lvl: s.lvl + 1, | ||
r: mt($(n, { l: s.r, lvl: i })) | ||
r: vt($(n, { l: s.r, lvl: i })) | ||
}); | ||
@@ -131,12 +131,12 @@ } else | ||
} | ||
function to(e) { | ||
return Gt(ve(e)); | ||
function so(e) { | ||
return Zt(be(e)); | ||
} | ||
function Ut(e, t, n) { | ||
function qt(e, t, n) { | ||
if (b(e)) | ||
return []; | ||
const o = ce(e, t)[0]; | ||
return Gt(bt(e, o, n)); | ||
const o = ue(e, t)[0]; | ||
return Zt(dt(e, o, n)); | ||
} | ||
function qt(e, t) { | ||
function Gt(e, t) { | ||
const n = e.length; | ||
@@ -153,18 +153,18 @@ if (n === 0) | ||
} | ||
function Gt(e) { | ||
return qt(e, ({ k: t, v: n }) => ({ index: t, value: n })); | ||
function Zt(e) { | ||
return Gt(e, ({ k: t, v: n }) => ({ index: t, value: n })); | ||
} | ||
function mt(e) { | ||
function vt(e) { | ||
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; | ||
} | ||
function Zt(e) { | ||
function Jt(e) { | ||
const { l: t } = e; | ||
return !b(t) && t.lvl === e.lvl ? $(t, { r: $(e, { l: t.r }) }) : e; | ||
} | ||
function no(e) { | ||
function io(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 oo(e, t) { | ||
function lo(e, t) { | ||
let n = b(e) ? 0 : 1 / 0; | ||
@@ -174,27 +174,27 @@ for (const o of t) { | ||
if (n = Math.min(n, i), b(e)) { | ||
e = O(e, 0, s); | ||
e = V(e, 0, s); | ||
continue; | ||
} | ||
const r = Ut(e, i - 1, l + 1); | ||
if (r.some(no(o))) | ||
const r = qt(e, i - 1, l + 1); | ||
if (r.some(io(o))) | ||
continue; | ||
let u = !1, h = !1; | ||
for (const { start: p, end: m, value: k } of r) | ||
u ? (l >= p || s === k) && (e = vt(e, p)) : (h = k !== s, u = !0), m > l && l >= p && k !== s && (e = O(e, l + 1, k)); | ||
h && (e = O(e, i, s)); | ||
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)); | ||
} | ||
return [e, n]; | ||
} | ||
const ot = [me(), 0]; | ||
function so(e, [t, n]) { | ||
const nt = [ke(), 0]; | ||
function ro(e, [t, n]) { | ||
if (n.length > 0 && b(e) && t.length === 2) { | ||
const o = t[0].size, s = t[1].size; | ||
return [ | ||
n.reduce((i, l) => O(O(i, l, o), l + 1, s), me()), | ||
n.reduce((i, l) => V(V(i, l, o), l + 1, s), ke()), | ||
0 | ||
]; | ||
} else | ||
return oo(e, t); | ||
return lo(e, t); | ||
} | ||
function Qe(e, t, n, o = 0) { | ||
function et(e, t, n, o = 0) { | ||
let s = e.length - 1; | ||
@@ -217,7 +217,7 @@ for (; o <= s; ) { | ||
} | ||
function Jt(e, t, n) { | ||
return e[Qe(e, t, n)]; | ||
function Xt(e, t, n) { | ||
return e[et(e, t, n)]; | ||
} | ||
function io(e, t, n, o) { | ||
const s = Qe(e, t, o), i = Qe(e, n, o, s); | ||
function co(e, t, n, o) { | ||
const s = et(e, t, o), i = et(e, n, o, s); | ||
return e.slice(s, i + 1); | ||
@@ -228,21 +228,21 @@ } | ||
} | ||
function lo({ offset: e }, t) { | ||
function uo({ offset: e }, t) { | ||
return t === e ? 0 : t < e ? -1 : 1; | ||
} | ||
function ro(e) { | ||
function ao(e) { | ||
return { index: e.index, value: e }; | ||
} | ||
function co(e, t, n, o = 0) { | ||
return o > 0 && (t = Math.max(t, Jt(e, o, At).offset)), t = Math.max(0, t), qt(io(e, t, n, lo), ro); | ||
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); | ||
} | ||
const Te = [[], 0, 0, 0]; | ||
function uo(e, [t, n]) { | ||
function fo(e, [t, n]) { | ||
let o = 0, s = 0, i = 0, l = 0; | ||
if (n !== 0) { | ||
l = Qe(e, n - 1, At), i = e[l].offset; | ||
const u = ce(t, n - 1); | ||
o = u[0], s = u[1], e.length && e[l].height === ce(t, n)[1] && (l -= 1), e = e.slice(0, l + 1); | ||
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); | ||
} else | ||
e = []; | ||
for (const { start: r, value: u } of Ut(t, n, 1 / 0)) { | ||
for (const { start: r, value: u } of qt(t, n, 1 / 0)) { | ||
const h = (r - o) * s + i; | ||
@@ -253,24 +253,24 @@ e.push({ height: u, index: r, offset: h }), o = r, i = h, s = u; | ||
} | ||
function Xt(e, t) { | ||
function Qt(e, t) { | ||
if (t.length === 0) | ||
return [0, 0]; | ||
const { offset: n, index: o, height: s } = Jt(t, e, At); | ||
const { offset: n, index: o, height: s } = Xt(t, e, At); | ||
return [s * (e - o) + n, s]; | ||
} | ||
function ao(e, t) { | ||
return Xt(e, t)[0]; | ||
function ho(e, t) { | ||
return Qt(e, t)[0]; | ||
} | ||
function Qt(e, t) { | ||
function en(e, t) { | ||
return Math.abs(e - t) < 1.01; | ||
} | ||
function en() { | ||
function tn() { | ||
return typeof navigator > "u" ? !1 : /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent); | ||
} | ||
function tn(e) { | ||
function nn(e) { | ||
return !e; | ||
} | ||
function po(e) { | ||
function go(e) { | ||
return e === 1 ? 1 : 1 - Math.pow(2, -10 * e); | ||
} | ||
const nn = "up", dt = "down", fo = "none", ho = { | ||
const on = "up", ht = "down", vo = "none", bo = { | ||
atBottom: !1, | ||
@@ -285,4 +285,4 @@ notAtBottomBecause: "NOT_SHOWING_LAST_ITEM", | ||
} | ||
}, go = 0, vo = 4; | ||
function Vt(e) { | ||
}, mo = 0, ko = 4; | ||
function Wt(e) { | ||
return (t, n) => { | ||
@@ -296,19 +296,19 @@ const o = n.signalInstance(); | ||
c(!1); | ||
const on = c(!0); | ||
S(); | ||
const de = c(!1), bo = S((e) => { | ||
e.link(e.pipe(on, Re(50)), bo); | ||
}), sn = c(vo), mo = c(go, (e) => { | ||
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) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(T, mo), | ||
e.combine(T, Io), | ||
a(([t, n]) => t <= n) | ||
), | ||
on | ||
sn | ||
); | ||
}), Ce = c(!1, (e) => { | ||
e.link(e.pipe(T, Vt(1), C(!0)), Ce), e.link(e.pipe(T, Vt(1), C(!1), re(100)), Ce); | ||
}), kt = c(!1, (e) => { | ||
e.link(e.pipe(oe, C(!0)), kt), e.link(e.pipe(oe, C(!1), re(200)), kt); | ||
}), ln = c(!1), Ue = c( | ||
e.link(e.pipe(T, Wt(1), H(!0)), Ce), e.link(e.pipe(T, Wt(1), H(!1), ce(100)), Ce); | ||
}), 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( | ||
null, | ||
@@ -318,3 +318,3 @@ (e) => { | ||
e.pipe( | ||
e.combine($e, T, J, gn, sn, ct, Z), | ||
e.combine($e, T, J, dn, ln, rt, Z), | ||
v(([, , , , , , t]) => !b(t)), | ||
@@ -329,23 +329,23 @@ q((t, [n, o, s, i, l]) => { | ||
if (u) { | ||
let m, k; | ||
return o > t.state.scrollTop ? (m = "SCROLLED_DOWN", k = t.state.scrollTop - o) : (m = n === s ? "LIST_TOO_SHORT" : "SIZE_DECREASED", k = t.state.scrollTop - o || t.scrollTopDelta), { | ||
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), { | ||
atBottom: !0, | ||
state: h, | ||
atBottomBecause: m, | ||
scrollTopDelta: k | ||
scrollTopDelta: y | ||
}; | ||
} | ||
let p; | ||
return s < t.state.viewportHeight ? p = "VIEWPORT_HEIGHT_DECREASING" : i < t.state.viewportWidth ? p = "VIEWPORT_WIDTH_DECREASING" : h.scrollHeight > t.state.scrollHeight ? p = "SIZE_INCREASED" : o < t.state.scrollTop ? p = "SCROLLING_UPWARDS" : p = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", { | ||
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", { | ||
atBottom: !1, | ||
notAtBottomBecause: p, | ||
notAtBottomBecause: f, | ||
state: h | ||
}; | ||
}, ho) | ||
}, bo) | ||
), | ||
Ue | ||
qe | ||
), e.link( | ||
e.pipe( | ||
Ue, | ||
Re(10), | ||
qe, | ||
we(10), | ||
// withLatestFrom(scrollToInProgress$), | ||
@@ -365,7 +365,7 @@ // filter(([, inProgress]) => !inProgress), | ||
), | ||
ln | ||
rn | ||
), e.sub( | ||
e.pipe( | ||
J, | ||
I(Ue), | ||
S(qe), | ||
q( | ||
@@ -380,3 +380,3 @@ (t, [n, o]) => { | ||
(t) => { | ||
t.delta && e.pub(oe, { top: t.delta }); | ||
t.delta && e.pub(se, { top: t.delta }); | ||
} | ||
@@ -386,3 +386,3 @@ ); | ||
(e, t) => e ? e.atBottom === (t == null ? void 0 : t.atBottom) : !1 | ||
), rn = c(0, (e) => { | ||
), cn = c(0, (e) => { | ||
e.link( | ||
@@ -393,3 +393,3 @@ e.pipe( | ||
(t, [n, o, s]) => { | ||
if (Qt(t.scrollHeight, o)) | ||
if (en(t.scrollHeight, o)) | ||
return { | ||
@@ -421,5 +421,5 @@ scrollTop: n, | ||
), | ||
rn | ||
cn | ||
); | ||
}), et = c(dt, (e) => { | ||
}), mt = c(ht, (e) => { | ||
e.link( | ||
@@ -429,15 +429,15 @@ e.pipe( | ||
q( | ||
(t, n) => e.getValue(kt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? nn : dt, prevScrollTop: n }, | ||
{ direction: dt, prevScrollTop: 0 } | ||
(t, n) => e.getValue(bt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? on : ht, prevScrollTop: n }, | ||
{ direction: ht, prevScrollTop: 0 } | ||
), | ||
a((t) => t.direction) | ||
), | ||
et | ||
), e.link(e.pipe(T, re(100), C(fo)), et); | ||
mt | ||
), e.link(e.pipe(T, ce(100), H(vo)), mt); | ||
}), Bt = c(0, (e) => { | ||
e.link(e.pipe(Ce, v(tn), C(0)), Bt), e.link( | ||
e.link(e.pipe(Ce, v(nn), H(0)), Bt), e.link( | ||
e.pipe( | ||
T, | ||
Re(100), | ||
I(Ce), | ||
we(100), | ||
S(Ce), | ||
v(([, t]) => !!t), | ||
@@ -450,3 +450,3 @@ q(([, t], [n]) => [t, n], [0, 0]), | ||
}); | ||
function Dt(e, t) { | ||
function Ct(e, t) { | ||
if (typeof e == "number") | ||
@@ -467,3 +467,3 @@ return { | ||
} | ||
function cn({ | ||
function un({ | ||
location: e, | ||
@@ -479,25 +479,25 @@ sizeTree: t, | ||
}) { | ||
const { align: h, behavior: p, offset: m, index: k } = Dt(e, s - 1); | ||
function F() { | ||
const X = ce(t, k)[1]; | ||
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 ${k} not found`); | ||
throw new Error(`Item at index ${y} not found`); | ||
return X; | ||
} | ||
i -= r + u; | ||
let d = ao(k, n) + l - r; | ||
h === "end" ? d = d - i + F() : h === "center" && (d = d - i / 2 + F() / 2), m && (d += m); | ||
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: p, align: h, forceBottomSpace: Y }; | ||
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 }; | ||
} | ||
const Me = c(null), ko = c(!1), qe = c(!0), tt = S((e) => { | ||
const Me = c(null), So = c(!1), Ge = c(!0), kt = k((e) => { | ||
e.link( | ||
e.pipe( | ||
tt, | ||
kt, | ||
a(() => !0) | ||
), | ||
qe | ||
Ge | ||
), e.link( | ||
e.pipe( | ||
tt, | ||
kt, | ||
a(() => null) | ||
@@ -507,11 +507,11 @@ ), | ||
); | ||
}), un = S((e) => { | ||
}), an = k((e) => { | ||
e.link( | ||
e.pipe( | ||
un, | ||
I(ke, lt, Pe), | ||
an, | ||
S(ye, it, Pe), | ||
a(([t, n, o, s]) => { | ||
let { align: i, behavior: l, offset: r, index: u } = Dt(t, n - 1); | ||
const h = typeof t != "number" ? t.done : void 0, [p, m] = Xt(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: h }) : p + 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 } = 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; | ||
}), | ||
@@ -523,21 +523,21 @@ v((t) => t !== null) | ||
); | ||
}), U = S((e) => { | ||
}), U = k((e) => { | ||
const t = e.pipe( | ||
U, | ||
I( | ||
S( | ||
Z, | ||
it, | ||
ye, | ||
J, | ||
lt, | ||
ke, | ||
J, | ||
rt, | ||
We, | ||
Be, | ||
Fe, | ||
we | ||
Re | ||
), | ||
a( | ||
([n, o, s, i, l, r, u, h, p]) => { | ||
([n, o, s, i, l, r, u, h, f]) => { | ||
try { | ||
return cn({ | ||
return un({ | ||
location: n, | ||
totalHeight: p, | ||
totalHeight: f, | ||
sizeTree: o, | ||
@@ -562,10 +562,10 @@ offsetTree: s, | ||
v((n) => typeof n != "number" && n.index === "LAST"), | ||
C(!0) | ||
H(!0) | ||
), | ||
de | ||
), e.link(e.pipe(t, C(!1)), qe), e.link(e.pipe(t, C(!1)), ko), e.link( | ||
ve | ||
), e.link(e.pipe(t, H(!1)), Ge), e.link(e.pipe(t, H(!1)), So), e.link( | ||
e.pipe( | ||
Z, | ||
re(0), | ||
I(qe, Me), | ||
ce(0), | ||
S(Ge, Me), | ||
v(([, n, o]) => !n && o !== null), | ||
@@ -575,68 +575,68 @@ a(([, , n]) => n) | ||
U | ||
), e.sub(e.pipe(He, Re(20)), () => { | ||
), e.sub(e.pipe(He, we(20)), () => { | ||
const n = e.getValue(Me); | ||
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({ | ||
[Me]: null, | ||
[qe]: !0 | ||
[Ge]: !0 | ||
}); | ||
}), e.link( | ||
e.pipe( | ||
Xe, | ||
Qe, | ||
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by | ||
Mt(), | ||
Dt(), | ||
v((n) => n !== 0), | ||
a((n) => ({ top: n })) | ||
), | ||
oe | ||
se | ||
), e.link( | ||
e.pipe( | ||
Xe, | ||
Nt(T), | ||
Qe, | ||
zt(T), | ||
a(() => 0) | ||
), | ||
Xe | ||
Qe | ||
); | ||
}), Ae = c(null), nt = c(null, (e) => { | ||
}), De = c(null), tt = c(null, (e) => { | ||
e.link( | ||
e.pipe( | ||
nt, | ||
tt, | ||
v((n) => n !== null) | ||
), | ||
Ae | ||
De | ||
); | ||
const t = e.pipe( | ||
e.combine(nt, Z), | ||
I(Ae), | ||
e.combine(tt, Z), | ||
S(De), | ||
v(([[n, o], s]) => n !== null && !b(o) && s !== null), | ||
re(10), | ||
ce(10), | ||
a(([[n]]) => n) | ||
); | ||
e.link(e.pipe(t, Mt()), U), e.link( | ||
e.link(e.pipe(t, Dt()), U), e.link( | ||
e.pipe( | ||
t, | ||
Nt(e.pipe(Be, v(tn))), | ||
C(null), | ||
zt(e.pipe(We, v(nn))), | ||
H(null), | ||
// unset the location after the scroll completes | ||
re(10) | ||
ce(10) | ||
), | ||
Ae | ||
De | ||
); | ||
}); | ||
function yo(e, t) { | ||
function xo(e, t) { | ||
const n = t.slice(); | ||
let o = 0; | ||
const s = []; | ||
ve(e).forEach(({ k: l, v: r }) => { | ||
var p, m; | ||
be(e).forEach(({ k: l, v: r }) => { | ||
var f, m; | ||
for (; n.length && n[0] < l; ) | ||
n.shift(), o++; | ||
const u = Math.max(0, l - o), h = ((p = s.at(-1)) == null ? void 0 : p.k) ?? -1; | ||
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 }); | ||
}); | ||
let i = me(); | ||
let i = ke(); | ||
return s.forEach(({ k: l, v: r }) => { | ||
i = O(i, l, r); | ||
i = V(i, l, r); | ||
}), i; | ||
} | ||
function Io(e, t) { | ||
function To(e, t) { | ||
return [ | ||
@@ -654,4 +654,4 @@ { | ||
} | ||
const So = [], ze = { | ||
items: So, | ||
const $o = [], Ye = { | ||
items: $o, | ||
listBottom: 0, | ||
@@ -664,22 +664,22 @@ listTop: 0, | ||
data: null | ||
}, Ve = c(ze, (e) => { | ||
}, Ve = c(Ye, (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine( | ||
xo, | ||
vn, | ||
Eo, | ||
bn, | ||
Z, | ||
lt, | ||
ke, | ||
we, | ||
H, | ||
Xe, | ||
nt, | ||
Ae, | ||
it, | ||
ye, | ||
Re, | ||
W, | ||
Qe, | ||
tt, | ||
De, | ||
_e, | ||
We, | ||
Be, | ||
Fe, | ||
_, | ||
F, | ||
G, | ||
W | ||
_ | ||
), | ||
@@ -700,18 +700,18 @@ v((t) => { | ||
h, | ||
p, | ||
f, | ||
m, | ||
k, | ||
F, | ||
y, | ||
P, | ||
d, | ||
Y | ||
]) => { | ||
var fe; | ||
var he; | ||
if ((u == null ? void 0 : u.length) === 0) | ||
return ze; | ||
return Ye; | ||
if (b(s)) { | ||
let V = 0; | ||
return p !== null && (V = Dt(p, l - 1).index), { ...ze, items: Io(V, u), offsetTree: i, totalCount: l, data: u }; | ||
let D = 0; | ||
return f !== null && (D = Ct(f, l - 1).index), { ...Ye, items: To(D, u), offsetTree: i, totalCount: l, data: u }; | ||
} | ||
let X = 0; | ||
m !== null && n === 0 && (X = cn({ | ||
m !== null && n === 0 && (X = un({ | ||
totalHeight: r, | ||
@@ -723,38 +723,38 @@ location: m, | ||
viewportHeight: e.getValue(J), | ||
headerHeight: e.getValue(rt), | ||
stickyHeaderHeight: F, | ||
headerHeight: e.getValue(lt), | ||
stickyHeaderHeight: P, | ||
stickyFooterHeight: d | ||
}).top ?? 0); | ||
const Q = Math.max( | ||
n + X + h - Y - k, | ||
n + X + h - Y - y, | ||
0 | ||
), ae = Q + o; | ||
if (t.offsetTree === i && t.totalCount === l && t.data === u && Q >= t.listTop && ae <= t.listBottom) | ||
), pe = Q + o; | ||
if (t.offsetTree === i && t.totalCount === l && t.data === u && Q >= t.listTop && pe <= t.listBottom) | ||
return t; | ||
const pe = [], j = l - 1, P = 0, N = co(i, Q, ae, P); | ||
const fe = [], j = l - 1, N = 0, z = po(i, Q, pe, N); | ||
let K = 0, Ne = 0, E = !1; | ||
for (const V of N) { | ||
for (const D of z) { | ||
const { | ||
value: { offset: ye, height: se } | ||
} = V; | ||
let te = V.start; | ||
K = ye, ye < Q && (te += Math.floor((Q - ye) / se), K += (te - V.start) * se), te < P && (K += (P - te) * se, te = P); | ||
const Le = Math.min(V.end, j); | ||
for (let ie = te; ie <= Le && !(K >= ae); ie++) { | ||
const pt = { | ||
data: u == null ? void 0 : u[ie], | ||
prevData: (u == null ? void 0 : u[ie - 1]) ?? null, | ||
nextData: (u == null ? void 0 : u[ie + 1]) ?? null, | ||
height: se, | ||
index: ie, | ||
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, | ||
type: "flat" | ||
}; | ||
E || (E = !0, Ne = K), pe.push(pt), K += se; | ||
E || (E = !0, Ne = K), fe.push(Le), K += le; | ||
} | ||
} | ||
const ee = r - K, at = ((fe = pe[0]) == null ? void 0 : fe.offset) || 0; | ||
return { items: pe, listBottom: K, listTop: Ne, offsetTree: i, paddingBottom: ee, paddingTop: at, totalCount: l, data: u }; | ||
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 }; | ||
}, | ||
ze | ||
Ye | ||
) | ||
@@ -764,3 +764,3 @@ ), | ||
); | ||
}), yt = be([], (e) => e.pipe( | ||
}), yt = me([], (e) => e.pipe( | ||
e.combine(Ve, T), | ||
@@ -773,7 +773,7 @@ a(([t, n]) => { | ||
}) | ||
)), W = c(!1), Ge = S((e) => { | ||
)), _ = c(!1), Ze = k((e) => { | ||
e.link( | ||
e.pipe( | ||
Ve, | ||
I(rn, G), | ||
S(cn, G), | ||
v(([, , t]) => !t), | ||
@@ -783,4 +783,4 @@ q( | ||
const h = l + r; | ||
let p = 0; | ||
return n === i && t.length > 0 && s.length > 0 && (p = h - o, p !== 0 && (p += u)), [p, s, i, h]; | ||
let f = 0; | ||
return n === i && t.length > 0 && s.length > 0 && (f = h - o, f !== 0 && (f += u)), [f, s, i, h]; | ||
}, | ||
@@ -790,35 +790,35 @@ [0, [], 0, 0] | ||
v(([t]) => t !== 0), | ||
I(T, et, Be), | ||
v(([, t, n, o]) => !o && t !== 0 && n === nn), | ||
S(T, mt, We), | ||
v(([, t, n, o]) => !o && t !== 0 && n === on), | ||
a(([[t]]) => t) | ||
), | ||
Ge | ||
), en() ? (e.sub(e.pipe(Ge, I(_, T)), ([t, n]) => { | ||
e.pub(_, n - t); | ||
}), e.sub(e.pipe(e.combine(T, _, G)), ([t, n, o]) => { | ||
o || (n > 0 && t < n ? (e.pub(W, !0), e.pub(Ee, { top: 0, behavior: "instant" }), setTimeout(() => { | ||
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(() => { | ||
e.pubIn({ | ||
[W]: !1, | ||
[_]: 0 | ||
[_]: !1, | ||
[F]: 0 | ||
}); | ||
})) : n < 0 && t <= 0 && (e.pubIn({ | ||
[W]: !0, | ||
[_]: 0 | ||
[_]: !0, | ||
[F]: 0 | ||
}), setTimeout(() => { | ||
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(W, !1); | ||
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(_, !1); | ||
}))); | ||
}), e.sub( | ||
e.pipe( | ||
e.combine(Ce, _, W, G), | ||
e.combine(Ce, F, _, G), | ||
v(([t, n, o, s]) => !t && n !== 0 && !o && !s), | ||
Re(100) | ||
we(100) | ||
), | ||
([, t]) => { | ||
e.pub(W, !0), t < 0 ? requestAnimationFrame(() => { | ||
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(_, 0), requestAnimationFrame(() => { | ||
e.pub(W, !1); | ||
e.pub(_, !0), t < 0 ? requestAnimationFrame(() => { | ||
e.pub(se, { top: -t, behavior: "instant" }), e.pub(F, 0), requestAnimationFrame(() => { | ||
e.pub(_, !1); | ||
}); | ||
}) : requestAnimationFrame(() => { | ||
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(_, 0), requestAnimationFrame(() => { | ||
e.pub(W, !1); | ||
e.pub(se, { top: -t, behavior: "instant" }), e.pub(F, 0), requestAnimationFrame(() => { | ||
e.pub(_, !1); | ||
}); | ||
@@ -829,30 +829,30 @@ }); | ||
e.pipe( | ||
Ge, | ||
Ze, | ||
a((t) => ({ top: t, behavior: "auto" })) | ||
), | ||
oe | ||
se | ||
); | ||
}), ke = c(0), Oe = c(null), H = c(null, (e) => { | ||
}), ye = c(0), Oe = c(null), W = c(null, (e) => { | ||
e.link( | ||
e.pipe( | ||
H, | ||
W, | ||
v((t) => t !== null), | ||
a((t) => t.length) | ||
), | ||
ke | ||
ye | ||
); | ||
}), ge = S((e) => { | ||
e.link(e.pipe(ge, C(!0)), G); | ||
const t = en(); | ||
}), de = k((e) => { | ||
e.link(e.pipe(de, H(!0)), G); | ||
const t = tn(); | ||
e.link( | ||
e.pipe( | ||
ge, | ||
I(Se), | ||
de, | ||
S(Se), | ||
a(([n, o]) => o * n.length) | ||
), | ||
_ | ||
), e.link(e.pipe(ge, C(t)), W), e.sub( | ||
F | ||
), e.link(e.pipe(de, H(t)), _), e.sub( | ||
e.pipe( | ||
ge, | ||
I(Se), | ||
de, | ||
S(Se), | ||
a(([n, o]) => ({ | ||
@@ -862,20 +862,20 @@ top: o * n.length, | ||
})), | ||
Mt() | ||
Dt() | ||
), | ||
(n) => { | ||
e.pubIn({ | ||
[oe]: n | ||
[se]: n | ||
}), t ? setTimeout(() => { | ||
e.pub(_, 0), e.pub(G, !1), e.pub(W, !1); | ||
e.pub(F, 0), e.pub(G, !1), e.pub(_, !1); | ||
}, 100) : requestAnimationFrame(() => { | ||
e.pub(_, 0), e.pub(G, !1); | ||
e.pub(F, 0), e.pub(G, !1); | ||
}); | ||
} | ||
), e.changeWith(H, ge, (n, o) => n ? [...o, ...n] : o.slice()), e.link( | ||
), e.changeWith(W, de, (n, o) => n ? [...o, ...n] : o.slice()), e.link( | ||
e.pipe( | ||
ge, | ||
I(Z, Se), | ||
de, | ||
S(Z, Se), | ||
a(([n, o, s]) => { | ||
const i = n.length, l = s; | ||
return ve(o).reduce( | ||
return be(o).reduce( | ||
(r, { k: u, v: h }) => ({ | ||
@@ -894,8 +894,8 @@ ranges: [...r.ranges, { startIndex: r.prevIndex, endIndex: u + i - 1, size: r.prevSize }], | ||
), | ||
it | ||
st | ||
); | ||
}), st = S((e) => { | ||
}), ot = k((e) => { | ||
const t = e.pipe( | ||
st, | ||
I(Pe, Tt, Oe, Z), | ||
ot, | ||
S(Pe, Tt, Oe, Z), | ||
v(([, , , , o]) => !b(o)), | ||
@@ -908,10 +908,10 @@ a(([{ data: o, scrollToBottom: s }, i, l, r]) => { | ||
if (typeof s == "function") { | ||
const p = s({ data: o, scrollLocation: i, scrollInProgress: l, context: r, atBottom: h }); | ||
if (!p) | ||
const f = s({ data: o, scrollLocation: i, scrollInProgress: l, context: r, atBottom: h }); | ||
if (!f) | ||
return null; | ||
if (typeof p == "object") | ||
return p; | ||
if (typeof p == "number") | ||
return { index: p, align: "end", behavior: "auto" }; | ||
u = p; | ||
if (typeof f == "object") | ||
return f; | ||
if (typeof f == "number") | ||
return { index: f, align: "end", behavior: "auto" }; | ||
u = f; | ||
} else { | ||
@@ -931,15 +931,15 @@ if (!h) | ||
), | ||
de | ||
ve | ||
), e.link( | ||
e.pipe( | ||
He, | ||
I(de), | ||
S(ve), | ||
v(([o, s]) => s), | ||
a(() => !1) | ||
), | ||
de | ||
ve | ||
); | ||
const n = e.pipe( | ||
et, | ||
I(de), | ||
Rt, | ||
S(ve), | ||
v(([o, s]) => o === "up" && s) | ||
@@ -952,41 +952,41 @@ ); | ||
), | ||
de | ||
), e.link(e.pipe(n, C(!0)), tt), e.link( | ||
ve | ||
), e.link(e.pipe(n, H(!0)), kt), e.link( | ||
e.pipe( | ||
t, | ||
v((o) => o !== null), | ||
re(20) | ||
ce(20) | ||
), | ||
U | ||
); | ||
}), It = S((e) => { | ||
e.changeWith(H, It, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(It, st); | ||
}), Ze = S((e) => { | ||
e.changeWith(H, Ze, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ue, Ze, ([t], n) => { | ||
const s = ce(t, n.offset, "k")[0], i = n.data.length; | ||
return [Qn(t, s, 1 / 0, (r, u) => [r + i, u]), s]; | ||
}), e.link(Ze, st); | ||
}), St = S((e) => { | ||
e.changeWith(H, St, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ue, St, ([t], { offset: n, count: o }) => [eo(t, n, o), n]); | ||
}), Je = S((e) => { | ||
e.changeWith(H, Je, (t, n) => n.data.slice()), e.link( | ||
}), 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( | ||
e.pipe( | ||
Je, | ||
Xe, | ||
a(({ initialLocation: t }) => t) | ||
), | ||
U | ||
), e.changeWith(ue, Je, (t, n) => { | ||
const o = ce(t[0], 1 / 0, "k")[1]; | ||
), e.changeWith(ae, Xe, (t, n) => { | ||
const o = ue(t[0], 1 / 0, "k")[1]; | ||
if (!o) | ||
return ot; | ||
let s = me(); | ||
return s = O(s, 0, o), [s, 0]; | ||
return nt; | ||
let s = ke(); | ||
return s = V(s, 0, o), [s, 0]; | ||
}); | ||
}), Wt = S((e) => { | ||
e.changeWith(H, Wt, (t, n) => t ? t.slice(n) : []), e.changeWith(ue, Wt, ([t], n) => [ve(t).reduce((s, { k: i, v: l }) => O(s, Math.max(0, i - n), l), me()), 0]); | ||
}), _t = S((e) => { | ||
e.changeWith(H, _t, (t, n) => t ? t.slice(0, t.length - n) : []), e.link( | ||
}), _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( | ||
e.pipe( | ||
_t, | ||
I(ke, Se), | ||
Ft, | ||
S(ye, Se), | ||
a(([, t, n]) => [ | ||
@@ -1000,8 +1000,8 @@ { | ||
), | ||
it | ||
st | ||
); | ||
}), an = S((e) => { | ||
}), pn = k((e) => { | ||
const t = e.pipe( | ||
an, | ||
I(H), | ||
pn, | ||
S(W), | ||
a(([n, o]) => { | ||
@@ -1016,9 +1016,9 @@ if (!o) | ||
); | ||
e.changeWith(H, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ue, t, ([n], o) => [yo(n, o), 0]); | ||
}), xt = S((e) => { | ||
e.changeWith(H, xt, (t, { mapper: n }) => t ? t.map(n) : []), e.link( | ||
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.pipe( | ||
xt, | ||
Re(40), | ||
I(ln), | ||
we(40), | ||
S(rn), | ||
v(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t), | ||
@@ -1029,3 +1029,3 @@ a(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t })) | ||
); | ||
}), it = S(); | ||
}), st = k(); | ||
c([]); | ||
@@ -1036,16 +1036,16 @@ c([]); | ||
c(NaN); | ||
const G = c(!1), ue = c(ot, (e) => { | ||
const G = c(!1), ae = c(nt, (e) => { | ||
e.link( | ||
e.pipe( | ||
it, | ||
st, | ||
v((t) => t.length > 0), | ||
I(Z), | ||
a(([t, n]) => so(n, [t, []])) | ||
S(Z), | ||
a(([t, n]) => ro(n, [t, []])) | ||
), | ||
ue | ||
ae | ||
); | ||
}), Z = c(ot[0], (e) => { | ||
}), Z = c(nt[0], (e) => { | ||
e.link( | ||
e.pipe( | ||
ue, | ||
ae, | ||
a(([t]) => t) | ||
@@ -1055,21 +1055,21 @@ ), | ||
); | ||
}), pn = c(ot[1], (e) => { | ||
}), fn = c(nt[1], (e) => { | ||
e.link( | ||
e.pipe( | ||
ue, | ||
ae, | ||
a(([, t]) => t) | ||
), | ||
pn | ||
fn | ||
); | ||
}), Se = c(Te[1]), lt = c(Te[0]), De = c(Te, (e) => { | ||
}), Se = c(Te[1]), it = c(Te[0]), Ae = c(Te, (e) => { | ||
e.link( | ||
e.pipe( | ||
Z, | ||
I(pn), | ||
q(([t], [n, o]) => uo(t, [n, o]), Te) | ||
S(fn), | ||
q(([t], [n, o]) => fo(t, [n, o]), Te) | ||
), | ||
De | ||
Ae | ||
), e.link( | ||
e.pipe( | ||
De, | ||
Ae, | ||
a(([, t]) => t) | ||
@@ -1080,44 +1080,44 @@ ), | ||
e.pipe( | ||
De, | ||
Ae, | ||
a(([t]) => t) | ||
), | ||
lt | ||
it | ||
); | ||
}), fn = c(Te[2], (e) => { | ||
}), hn = c(Te[2], (e) => { | ||
e.link( | ||
e.pipe( | ||
De, | ||
Ae, | ||
a(([, , t]) => t) | ||
), | ||
fn | ||
hn | ||
); | ||
}), hn = c(Te[3], (e) => { | ||
}), gn = c(Te[3], (e) => { | ||
e.link( | ||
e.pipe( | ||
De, | ||
Ae, | ||
a(([, , , t]) => t) | ||
), | ||
hn | ||
gn | ||
); | ||
}), we = c(0, (e) => { | ||
}), Re = c(0, (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(ke, hn, fn, Se), | ||
e.combine(ye, gn, hn, Se), | ||
a(([t, n, o, s]) => o + (t - n) * s) | ||
), | ||
we | ||
Re | ||
); | ||
}), Be = S(), Tt = c(!1), He = S((e) => { | ||
e.link(e.pipe(He, C(!1)), Be); | ||
}), T = c(0), J = c(0), gn = c(0), $e = c(0), xo = T, Xe = c(0), We = c(0), _e = c(0), Fe = c(0), Ct = c(0), $t = c(null), rt = be(0, (e) => e.pipe( | ||
e.combine(We, _e), | ||
}), 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), | ||
a(([t, n]) => t + n) | ||
)), dn = be(0, (e) => e.pipe( | ||
e.combine(Fe, Ct), | ||
)), vn = me(0, (e) => e.pipe( | ||
e.combine(Fe, Ot), | ||
a(([t, n]) => t + n) | ||
)), To = be(0, (e) => e.pipe( | ||
e.combine(We, _e, T), | ||
)), wo = me(0, (e) => e.pipe( | ||
e.combine(Be, _e, T), | ||
a(([t, n, o]) => t + Math.max(n - o, 0)) | ||
)), $o = be(0, (e) => e.pipe( | ||
e.combine(Fe, Ct, T, J, $e), | ||
)), Ro = me(0, (e) => e.pipe( | ||
e.combine(Fe, Ot, T, J, $e), | ||
a(([t, n, o, s, i]) => { | ||
@@ -1127,14 +1127,14 @@ const l = Math.max(n - (i - (o + s)), 0); | ||
}) | ||
)), vn = be(0, (e) => e.pipe( | ||
e.combine(J, To, $o), | ||
)), bn = me(0, (e) => e.pipe( | ||
e.combine(J, wo, Ro), | ||
a(([t, n, o]) => t - n - o) | ||
)), ct = c(0), bn = c(0, (e) => { | ||
)), rt = c(0), mn = c(0, (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(bn, we, J), | ||
e.combine(mn, Re, J), | ||
a(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o)))) | ||
), | ||
ct | ||
rt | ||
); | ||
}), Ee = S((e) => { | ||
}), Ee = k((e) => { | ||
e.link( | ||
@@ -1145,13 +1145,13 @@ e.pipe( | ||
), | ||
bn | ||
mn | ||
), e.link( | ||
e.pipe( | ||
Ee, | ||
I(T), | ||
S(T), | ||
v(([t, n]) => t.top !== n), | ||
C(!0) | ||
H(!0) | ||
), | ||
Be | ||
We | ||
); | ||
}), Pe = be( | ||
}), Pe = me( | ||
{ | ||
@@ -1167,12 +1167,12 @@ listOffset: 0, | ||
T, | ||
rt, | ||
dn, | ||
lt, | ||
vn, | ||
_e, | ||
vn, | ||
bn, | ||
$e, | ||
ct, | ||
rt, | ||
G, | ||
Ae, | ||
W, | ||
de | ||
De, | ||
_, | ||
ve | ||
), | ||
@@ -1191,12 +1191,12 @@ v(([, , , , , , , t, n, o]) => !t && n === null && !o), | ||
h, | ||
p, | ||
f, | ||
m | ||
]) => { | ||
const k = e.getValue(sn), F = l - n - o, d = -t + s, Y = r === 0 ? F + Math.min(0, d) - i : -r; | ||
const y = e.getValue(ln), P = l - n - o, d = -t + s, Y = r === 0 ? P + Math.min(0, d) - i : -r; | ||
return { | ||
scrollHeight: F, | ||
scrollHeight: P, | ||
listOffset: d, | ||
visibleListHeight: i, | ||
bottomOffset: Y, | ||
isAtBottom: m || Y <= k | ||
isAtBottom: m || Y <= y | ||
}; | ||
@@ -1206,8 +1206,8 @@ } | ||
) | ||
), Et = S((e) => { | ||
), Et = k((e) => { | ||
e.link( | ||
e.pipe( | ||
T, | ||
re(0), | ||
I(Pe), | ||
ce(0), | ||
S(Pe), | ||
v(([, t]) => t.scrollHeight > 0), | ||
@@ -1218,29 +1218,29 @@ a(([, t]) => t) | ||
); | ||
}), oe = S(), _ = c(0), Rt = c(0), mn = c(""), kn = ({ index: e }) => /* @__PURE__ */ Pt("div", { children: [ | ||
}), se = k(), F = c(0), wt = c(0), kn = c(""), Rt = k(), yn = ({ index: e }) => /* @__PURE__ */ Nt("div", { children: [ | ||
"Item ", | ||
e | ||
] }), yn = ({ index: e }) => e, wt = c(kn), In = c(yn), Sn = c(null), xn = c(null), Tn = c(null), $n = c(null), En = c(null), Rn = c("div"), Eo = { | ||
] }), 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 = { | ||
position: "sticky", | ||
top: 0, | ||
zIndex: 1 | ||
}, Ye = { | ||
}, Ke = { | ||
overflowAnchor: "none" | ||
}, Ro = { | ||
}, Mo = { | ||
position: "sticky", | ||
bottom: 0 | ||
}, wn = g.forwardRef((e, t) => /* @__PURE__ */ y("div", { style: { zIndex: 1 }, ...e, ref: t })), Ln = g.forwardRef((e, t) => /* @__PURE__ */ y("div", { ...e, ref: t })), Mn = g.forwardRef( | ||
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Eo, ...e }, ref: n }) | ||
}, 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__ */ y("div", { ...t, style: { ...Ro, ...e }, ref: n }) | ||
), Dn = c(wn), Cn = c(Mn), On = c(Ln), Hn = c(An), Lt = c("top", (e) => { | ||
({ 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) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(Lt, we, J, rt, dn), | ||
e.combine(Mt, Re, J, lt, vn), | ||
v(([t]) => t === "bottom" || t === "bottom-smooth"), | ||
a(([, t, n, o, s]) => Math.max(0, n - t - o - s)) | ||
), | ||
Rt | ||
wt | ||
), e.link( | ||
e.pipe( | ||
e.combine(Rt, Lt), | ||
e.combine(wt, Mt), | ||
v(([, t]) => t === "bottom-smooth"), | ||
@@ -1253,9 +1253,9 @@ q( | ||
), | ||
mn | ||
kn | ||
); | ||
}); | ||
function wo(e) { | ||
return Lo(Ao(Do(Mo(e), 8 * e.length))).toLowerCase(); | ||
function Do(e) { | ||
return Ao(Oo(Ho(Co(e), 8 * e.length))).toLowerCase(); | ||
} | ||
function Lo(e) { | ||
function Ao(e) { | ||
for (var t, n = "0123456789ABCDEF", o = "", s = 0; s < e.length; s++) | ||
@@ -1265,3 +1265,3 @@ t = e.charCodeAt(s), o += n.charAt(t >>> 4 & 15) + n.charAt(15 & t); | ||
} | ||
function Mo(e) { | ||
function Co(e) { | ||
for (var t = Array(e.length >> 2), n = 0; n < t.length; n++) | ||
@@ -1273,3 +1273,3 @@ t[n] = 0; | ||
} | ||
function Ao(e) { | ||
function Oo(e) { | ||
for (var t = "", n = 0; n < 32 * e.length; n += 8) | ||
@@ -1279,6 +1279,6 @@ t += String.fromCharCode(e[n >> 5] >>> n % 32 & 255); | ||
} | ||
function Do(e, t) { | ||
function Ho(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, p = i; | ||
const r = n, u = o, h = s, f = i; | ||
o = M( | ||
@@ -1292,14 +1292,14 @@ o = M( | ||
o = L( | ||
o = w( | ||
o = w( | ||
o = w( | ||
o = w( | ||
o = R( | ||
o = R( | ||
o = R( | ||
o = R( | ||
o = R( | ||
o = R( | ||
o = R( | ||
o = R( | ||
o = w( | ||
o = w( | ||
o = w( | ||
o = w( | ||
o, | ||
s = R( | ||
s = w( | ||
s, | ||
i = R(i, n = R(n, o, s, i, e[l + 0], 7, -680876936), o, s, e[l + 1], 12, -389564586), | ||
i = w(i, n = w(n, o, s, i, e[l + 0], 7, -680876936), o, s, e[l + 1], 12, -389564586), | ||
n, | ||
@@ -1317,5 +1317,5 @@ o, | ||
), | ||
s = R( | ||
s = w( | ||
s, | ||
i = R(i, n = R(n, o, s, i, e[l + 4], 7, -176418897), o, s, e[l + 5], 12, 1200080426), | ||
i = w(i, n = w(n, o, s, i, e[l + 4], 7, -176418897), o, s, e[l + 5], 12, 1200080426), | ||
n, | ||
@@ -1333,5 +1333,5 @@ o, | ||
), | ||
s = R( | ||
s = w( | ||
s, | ||
i = R(i, n = R(n, o, s, i, e[l + 8], 7, 1770035416), o, s, e[l + 9], 12, -1958414417), | ||
i = w(i, n = w(n, o, s, i, e[l + 8], 7, 1770035416), o, s, e[l + 9], 12, -1958414417), | ||
n, | ||
@@ -1349,5 +1349,5 @@ o, | ||
), | ||
s = R( | ||
s = w( | ||
s, | ||
i = R(i, n = R(n, o, s, i, e[l + 12], 7, 1804603682), o, s, e[l + 13], 12, -40341101), | ||
i = w(i, n = w(n, o, s, i, e[l + 12], 7, 1804603682), o, s, e[l + 13], 12, -40341101), | ||
n, | ||
@@ -1365,5 +1365,5 @@ o, | ||
), | ||
s = w( | ||
s = R( | ||
s, | ||
i = w(i, n = w(n, o, s, i, e[l + 1], 5, -165796510), o, s, e[l + 6], 9, -1069501632), | ||
i = R(i, n = R(n, o, s, i, e[l + 1], 5, -165796510), o, s, e[l + 6], 9, -1069501632), | ||
n, | ||
@@ -1381,5 +1381,5 @@ o, | ||
), | ||
s = w( | ||
s = R( | ||
s, | ||
i = w(i, n = w(n, o, s, i, e[l + 5], 5, -701558691), o, s, e[l + 10], 9, 38016083), | ||
i = R(i, n = R(n, o, s, i, e[l + 5], 5, -701558691), o, s, e[l + 10], 9, 38016083), | ||
n, | ||
@@ -1397,5 +1397,5 @@ o, | ||
), | ||
s = w( | ||
s = R( | ||
s, | ||
i = w(i, n = w(n, o, s, i, e[l + 9], 5, 568446438), o, s, e[l + 14], 9, -1019803690), | ||
i = R(i, n = R(n, o, s, i, e[l + 9], 5, 568446438), o, s, e[l + 14], 9, -1019803690), | ||
n, | ||
@@ -1413,5 +1413,5 @@ o, | ||
), | ||
s = w( | ||
s = R( | ||
s, | ||
i = w(i, n = w(n, o, s, i, e[l + 13], 5, -1444681467), o, s, e[l + 2], 9, -51403784), | ||
i = R(i, n = R(n, o, s, i, e[l + 13], 5, -1444681467), o, s, e[l + 2], 9, -51403784), | ||
n, | ||
@@ -1548,45 +1548,45 @@ o, | ||
-343485551 | ||
), n = le(n, r), o = le(o, u), s = le(s, h), i = le(i, p); | ||
), n = re(n, r), o = re(o, u), s = re(s, h), i = re(i, f); | ||
} | ||
return [n, o, s, i]; | ||
} | ||
function ut(e, t, n, o, s, i) { | ||
return le(Co(le(le(t, e), le(o, i)), s), n); | ||
function ct(e, t, n, o, s, i) { | ||
return re(Vo(re(re(t, e), re(o, i)), s), n); | ||
} | ||
function w(e, t, n, o, s, i, l) { | ||
return ct(t & n | ~t & o, e, t, s, i, l); | ||
} | ||
function R(e, t, n, o, s, i, l) { | ||
return ut(t & n | ~t & o, e, t, s, i, l); | ||
return ct(t & o | n & ~o, e, t, s, i, l); | ||
} | ||
function w(e, t, n, o, s, i, l) { | ||
return ut(t & o | n & ~o, e, t, s, i, l); | ||
} | ||
function L(e, t, n, o, s, i, l) { | ||
return ut(t ^ n ^ o, e, t, s, i, l); | ||
return ct(t ^ n ^ o, e, t, s, i, l); | ||
} | ||
function M(e, t, n, o, s, i, l) { | ||
return ut(n ^ (t | ~o), e, t, s, i, l); | ||
return ct(n ^ (t | ~o), e, t, s, i, l); | ||
} | ||
function le(e, t) { | ||
function re(e, t) { | ||
const n = (65535 & e) + (65535 & t); | ||
return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n; | ||
} | ||
function Co(e, t) { | ||
function Vo(e, t) { | ||
return e << t | e >>> 32 - t; | ||
} | ||
const Vn = Symbol("INVALID_KEY"); | ||
function Oo(e) { | ||
const Wn = Symbol("INVALID_KEY"); | ||
function Wo(e) { | ||
const t = e.slice(0, 32), n = e.slice(32), o = atob(n); | ||
if (t !== wo(n)) | ||
return Vn; | ||
if (t !== Do(n)) | ||
return Wn; | ||
const [s, i] = o.split(";"), l = s.slice(2), r = new Date(Number(i.slice(2))); | ||
return { orderNumber: l, expiryDate: r }; | ||
} | ||
const Ho = { | ||
const Bo = { | ||
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." | ||
}, Vo = { | ||
}, _o = { | ||
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/" | ||
}, Bo = { | ||
}, Fo = { | ||
valid: !1, | ||
@@ -1596,49 +1596,49 @@ 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." | ||
valid: !0 | ||
}, Wo = { | ||
}, Po = { | ||
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" | ||
}, _o = { | ||
}, No = { | ||
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/" | ||
}, Fo = { | ||
}, zo = { | ||
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/" | ||
}, Po = Bn, No = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, zo = ["virtuoso.dev", "csb.app", "codesandbox.io"]; | ||
function Yo({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) { | ||
const s = n.match(No), i = zo.some((l) => n.endsWith(l)); | ||
}, 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)); | ||
if (e) { | ||
const l = Oo(e); | ||
if (l === Vn) | ||
return Wo; | ||
const l = Wo(e); | ||
if (l === Wn) | ||
return Po; | ||
if (l.expiryDate.getTime() < t.getTime()) { | ||
if (s) | ||
return _o; | ||
return No; | ||
if (l.expiryDate.getTime() < o) | ||
return Fo; | ||
return zo; | ||
} | ||
} else | ||
return i ? Po : s ? Bo : Vo; | ||
return i ? Yo : s ? Fo : _o; | ||
return Bn; | ||
} | ||
const Wn = g.createContext(Ho), Ko = ({ | ||
const _n = g.createContext(Bo), qo = ({ | ||
licenseKey: e, | ||
children: t | ||
}) => { | ||
const n = Yo({ | ||
const n = Uo({ | ||
licenseKey: e, | ||
hostname: typeof window < "u" ? window.location.hostname : "localhost", | ||
now: /* @__PURE__ */ new Date(), | ||
packageTimestamp: 1718641551061 | ||
packageTimestamp: 1718645483219 | ||
}); | ||
return /* @__PURE__ */ y(Wn.Provider, { value: n, children: t }); | ||
return /* @__PURE__ */ I(_n.Provider, { value: n, children: t }); | ||
}; | ||
Ko.displayName = Math.random().toString(36).slice(2, 8); | ||
function _n(e) { | ||
qo.displayName = Math.random().toString(36).slice(2, 8); | ||
function Fn(e) { | ||
return { | ||
data: { | ||
prepend: (t) => { | ||
e.pub(ge, t); | ||
e.pub(de, t); | ||
}, | ||
@@ -1652,3 +1652,3 @@ append: (t, n) => { | ||
replace: (t, n) => { | ||
e.pub(Je, { | ||
e.pub(Xe, { | ||
data: t, | ||
@@ -1665,8 +1665,8 @@ initialLocation: n | ||
findAndDelete: (t) => { | ||
e.pub(an, t); | ||
e.pub(pn, t); | ||
}, | ||
findIndex: (t) => e.getValue(H).findIndex(t), | ||
find: (t) => e.getValue(H).find(t), | ||
findIndex: (t) => e.getValue(W).findIndex(t), | ||
find: (t) => e.getValue(W).find(t), | ||
insert: function(t, n, o) { | ||
e.pub(Ze, { | ||
e.pub(Je, { | ||
data: t, | ||
@@ -1684,3 +1684,3 @@ offset: n, | ||
batch: (t, n) => { | ||
e.pub(G, !0), t(), e.pub(G, !1), e.pub(st, { data: [], scrollToBottom: n }); | ||
e.pub(G, !0), t(), e.pub(G, !1), e.pub(ot, { data: [], scrollToBottom: n }); | ||
} | ||
@@ -1692,3 +1692,3 @@ }, | ||
scrollIntoView: (t) => { | ||
e.pub(un, t); | ||
e.pub(an, t); | ||
}, | ||
@@ -1701,17 +1701,17 @@ scrollerElement: () => e.getValue($t), | ||
} | ||
function Xo() { | ||
function ts() { | ||
return B(Pe); | ||
} | ||
function Qo() { | ||
function ns() { | ||
return B(yt); | ||
} | ||
function es() { | ||
const e = zt(); | ||
return g.useMemo(() => _n(e), [e]); | ||
function os() { | ||
const e = Yt(); | ||
return g.useMemo(() => Fn(e), [e]); | ||
} | ||
let Ft = !1; | ||
const jo = g.forwardRef( | ||
let Pt = !1; | ||
const Go = g.forwardRef( | ||
({ | ||
initialData: e = [], | ||
computeItemKey: t = yn, | ||
computeItemKey: t = In, | ||
context: n = null, | ||
@@ -1722,46 +1722,46 @@ initialLocation: o = null, | ||
onRenderedDataChange: l, | ||
ItemContent: r = kn, | ||
ItemContent: r = yn, | ||
Header: u = null, | ||
StickyHeader: h = null, | ||
Footer: p = null, | ||
Footer: f = null, | ||
StickyFooter: m = null, | ||
EmptyPlaceholder: k = null, | ||
HeaderWrapper: F = wn, | ||
StickyHeaderWrapper: d = Mn, | ||
FooterWrapper: Y = Ln, | ||
EmptyPlaceholder: y = null, | ||
HeaderWrapper: P = Ln, | ||
StickyHeaderWrapper: d = Dn, | ||
FooterWrapper: Y = Mn, | ||
StickyFooterWrapper: X = An, | ||
ScrollElement: Q = "div", | ||
...ae | ||
}, pe) => { | ||
...pe | ||
}, fe) => { | ||
const j = g.useMemo(() => { | ||
const N = new Zn(); | ||
return N.register(Ve), N.register(Be), N.register(Ge), N.register(Ue), N.pubIn({ | ||
[H]: e.slice(), | ||
const z = new Qn(); | ||
return z.register(Ve), z.register(We), z.register(Ze), z.register(qe), z.pubIn({ | ||
[W]: e.slice(), | ||
[Oe]: n, | ||
[In]: t, | ||
[nt]: o, | ||
[wt]: r, | ||
[Sn]: u, | ||
[Tn]: p, | ||
[xn]: h, | ||
[$n]: m, | ||
[En]: k, | ||
[Sn]: t, | ||
[tt]: o, | ||
[Lt]: r, | ||
[xn]: u, | ||
[$n]: f, | ||
[Tn]: h, | ||
[En]: m, | ||
[wn]: y, | ||
[Rn]: Q, | ||
[Hn]: X, | ||
[Cn]: d, | ||
[On]: Y, | ||
[Dn]: F, | ||
[Lt]: s | ||
}), N.singletonSub(Et, i), N.singletonSub(yt, l), N; | ||
[Vn]: X, | ||
[On]: d, | ||
[Hn]: Y, | ||
[Cn]: P, | ||
[Mt]: s | ||
}), z.singletonSub(Et, i), z.singletonSub(yt, l), z; | ||
}, []); | ||
g.useImperativeHandle(pe, () => _n(j), [j]), g.useEffect(() => { | ||
g.useImperativeHandle(fe, () => Fn(j), [j]), g.useEffect(() => { | ||
j.pubIn({ | ||
[Oe]: n, | ||
[wt]: r | ||
[Lt]: r | ||
}), j.singletonSub(Et, i), j.singletonSub(yt, l); | ||
}); | ||
const P = g.useContext(Wn); | ||
const N = g.useContext(_n); | ||
return g.useEffect(() => { | ||
P.consoleMessage && (Ft || (Ft = !0, console.error(P.consoleMessage))); | ||
}, [P]), typeof window < "u" && P.watermarkMessage ? /* @__PURE__ */ y( | ||
N.consoleMessage && (Pt || (Pt = !0, console.error(N.consoleMessage))); | ||
}, [N]), typeof window < "u" && N.watermarkMessage ? /* @__PURE__ */ I( | ||
"div", | ||
@@ -1773,10 +1773,10 @@ { | ||
}, | ||
children: P.watermarkMessage | ||
children: N.watermarkMessage | ||
} | ||
) : /* @__PURE__ */ y(Jn.Provider, { value: j, children: /* @__PURE__ */ y(Uo, { ...ae }) }); | ||
) : /* @__PURE__ */ I(eo.Provider, { value: j, children: /* @__PURE__ */ I(Zo, { ...pe }) }); | ||
} | ||
); | ||
jo.displayName = "VirtuosoMessageList"; | ||
const Uo = ({ style: e, ...t }) => { | ||
const n = zt(), [ | ||
Go.displayName = "VirtuosoMessageList"; | ||
const Zo = ({ style: e, ...t }) => { | ||
const n = Yt(), [ | ||
o, | ||
@@ -1789,17 +1789,17 @@ s, | ||
h, | ||
p, | ||
f, | ||
m, | ||
k, | ||
F | ||
] = Xn( | ||
Sn, | ||
y, | ||
P | ||
] = to( | ||
xn, | ||
Dn, | ||
Tn, | ||
Cn, | ||
Tn, | ||
On, | ||
$n, | ||
On, | ||
En, | ||
Hn, | ||
wt, | ||
En, | ||
Vn, | ||
Lt, | ||
wn, | ||
Rn | ||
@@ -1809,41 +1809,41 @@ ), [d] = g.useState(() => { | ||
throw new Error("ResizeObserver not found. Please ensure that you have a polyfill installed."); | ||
return new ResizeObserver((f) => { | ||
const z = f.length, A = []; | ||
return new ResizeObserver((p) => { | ||
const A = p.length, C = []; | ||
let x = {}; | ||
for (let Ie = 0; Ie < z; Ie++) { | ||
const ne = f[Ie], D = ne.target; | ||
if (D === j.current) { | ||
for (let Ie = 0; Ie < A; Ie++) { | ||
const oe = p[Ie], O = oe.target; | ||
if (O === j.current) { | ||
x = { | ||
...x, | ||
[_e]: ne.contentRect.height | ||
[_e]: oe.contentRect.height | ||
}; | ||
continue; | ||
} else if (D === N.current) { | ||
} else if (O === z.current) { | ||
x = { | ||
...x, | ||
[We]: ne.contentRect.height | ||
[Be]: oe.contentRect.height | ||
}; | ||
continue; | ||
} else if (D === X.current) { | ||
} else if (O === X.current) { | ||
x = { | ||
...x, | ||
[Ct]: ne.contentRect.height | ||
[Ot]: oe.contentRect.height | ||
}; | ||
continue; | ||
} else if (D === ae.current) { | ||
} else if (O === pe.current) { | ||
x = { | ||
...x, | ||
[Fe]: ne.contentRect.height | ||
[Fe]: oe.contentRect.height | ||
}; | ||
continue; | ||
} else if (D === E.current) { | ||
} else if (O === E.current) { | ||
x = { | ||
...x, | ||
[T]: D.scrollTop, | ||
[$e]: D.scrollHeight, | ||
[J]: ne.contentRect.height, | ||
[gn]: D.clientWidth | ||
[T]: O.scrollTop, | ||
[$e]: O.scrollHeight, | ||
[J]: oe.contentRect.height, | ||
[dn]: O.clientWidth | ||
}; | ||
continue; | ||
} else if (D === ee.current) { | ||
} else if (O === ee.current) { | ||
E.current && (x = { | ||
@@ -1855,123 +1855,129 @@ ...x, | ||
} | ||
if (D.dataset.index === void 0) | ||
if (O.dataset.index === void 0) | ||
continue; | ||
const ft = parseInt(D.dataset.index), qn = parseFloat(D.dataset.knownSize ?? ""), ht = ne.contentRect.height; | ||
if (ht === qn) | ||
const at = parseInt(O.dataset.index), Jn = parseFloat(O.dataset.knownSize ?? ""), pt = oe.contentRect.height; | ||
if (pt === Jn) | ||
continue; | ||
const Ot = A[A.length - 1]; | ||
A.length === 0 || Ot.size !== ht || Ot.endIndex !== ft - 1 ? A.push({ endIndex: ft, size: ht, startIndex: ft }) : A[A.length - 1].endIndex++; | ||
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++; | ||
} | ||
A.length > 0 && (x = { | ||
C.length > 0 && (x = { | ||
...x, | ||
[it]: A | ||
[st]: C | ||
}), n.pubIn(x); | ||
}); | ||
}), [Y, X] = Ke(d), [Q, ae] = Ke(d), [pe, j] = Ke(d), [P, N] = Ke(d), K = g.useCallback( | ||
(f) => { | ||
d.observe(f); | ||
}), [Y, X] = je(d), [Q, pe] = je(d), [fe, j] = je(d), [N, z] = je(d), K = g.useCallback( | ||
(p) => { | ||
d.observe(p); | ||
}, | ||
[d] | ||
), Ne = g.useCallback( | ||
(f) => { | ||
d.unobserve(f); | ||
(p) => { | ||
d.unobserve(p); | ||
}, | ||
[d] | ||
), E = g.useRef(null), ee = g.useRef(null), at = g.useCallback( | ||
(f) => { | ||
f ? (ee.current = f, d.observe(f, { box: "border-box" })) : ee.current && (d.unobserve(ee.current), ee.current = null); | ||
), 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); | ||
}, | ||
[d] | ||
), fe = g.useRef(null), V = g.useRef(null); | ||
g.useEffect(() => n.sub(tt, () => { | ||
V.current && cancelAnimationFrame(V.current); | ||
), 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 ye = g.useCallback((f) => { | ||
const te = g.useCallback((p) => { | ||
var Ie; | ||
V.current && cancelAnimationFrame(V.current); | ||
const z = ((Ie = E.current) == null ? void 0 : Ie.scrollTop) ?? 0; | ||
let A = 0; | ||
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 D; | ||
const ne = z + (f - z) * po(A); | ||
(D = E.current) == null || D.scrollTo({ top: ne, behavior: "auto" }), A += 0.02, A < 1 ? V.current = requestAnimationFrame(x) : V.current = null; | ||
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(); | ||
}, []), se = g.useCallback( | ||
(f) => { | ||
var z, A, x; | ||
if (f.top === ((z = E.current) == null ? void 0 : z.scrollTop)) { | ||
n.pub(He, (A = E.current) == null ? void 0 : A.scrollTop); | ||
}, []), 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); | ||
return; | ||
} | ||
f.top !== void 0 && (fe.current = f.top, n.pub(Tt, !0)), f.forceBottomSpace !== void 0 && ee.current && (ee.current.style.paddingBottom = `${f.forceBottomSpace}px`), f.behavior === "smooth" ? ye(f.top ?? 0) : (x = E.current) == null || x.scrollTo(f); | ||
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); | ||
}, | ||
[n, ye] | ||
), te = g.useCallback((f) => { | ||
var z; | ||
(z = E.current) == null || z.scrollBy(f); | ||
[n, te] | ||
), ne = g.useCallback((p) => { | ||
var A; | ||
(A = E.current) == null || A.scrollBy(p); | ||
}, []), Le = g.useCallback(() => { | ||
const f = E.current; | ||
if (f !== null) { | ||
if (fe.current !== null) { | ||
const z = f.scrollHeight - f.clientHeight; | ||
Qt(f.scrollTop, Math.min(z, fe.current)) && (fe.current = null, n.pub(Tt, !1), n.pub(He, f.scrollTop)); | ||
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.pub(T, f.scrollTop); | ||
n.pub(T, p.scrollTop); | ||
} | ||
}, [n]), ie = g.useCallback( | ||
(f) => { | ||
f ? (n.pub($t, f), E.current = f, f.addEventListener("scroll", Le), d.observe(f, { box: "border-box" })) : E.current && (E.current.removeEventListener("scroll", Le), n.pub($t, null), d.unobserve(E.current), E.current = null); | ||
}, [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); | ||
}, | ||
[d, n, Le] | ||
), { items: pt } = B(Ve); | ||
g.useLayoutEffect(() => n.sub(Ee, se), [se, n]), g.useLayoutEffect(() => n.sub(oe, te), [te, n]); | ||
const Fn = B(_), Pn = B(W), Nn = B(Rt), zn = B(ct), Yn = B(mn), he = B(Oe), Kn = B(In), jn = B(ke), Un = B(we); | ||
return /* @__PURE__ */ y(Gn, { children: /* @__PURE__ */ Pt( | ||
F, | ||
), { 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, | ||
{ | ||
...t, | ||
ref: ie, | ||
ref: Pn, | ||
"data-testid": "virtuoso-scroller", | ||
style: { | ||
overflowY: Pn ? "hidden" : "scroll", | ||
overflowY: Yn ? "hidden" : "scroll", | ||
boxSizing: "border-box", | ||
...e | ||
}, | ||
...F === "div" ? { context: he } : {}, | ||
...P === "div" ? { context: ge } : {}, | ||
children: [ | ||
s && /* @__PURE__ */ y(l, { ref: P, style: Ye, children: /* @__PURE__ */ y(s, { context: he }) }), | ||
o && /* @__PURE__ */ y(i, { ref: pe, style: Ye, children: /* @__PURE__ */ y(o, { context: he }) }), | ||
jn > 0 ? /* @__PURE__ */ y( | ||
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( | ||
"div", | ||
{ | ||
ref: at, | ||
ref: ut, | ||
"data-testid": "virtuoso-list", | ||
style: { | ||
boxSizing: "content-box", | ||
height: Un, | ||
paddingBottom: zn, | ||
height: Zn, | ||
paddingBottom: jn, | ||
overflowAnchor: "none", | ||
marginTop: Nn, | ||
transition: Yn, | ||
marginTop: Kn, | ||
transition: Un, | ||
position: "relative", | ||
transform: `translateY(${Fn}px)` | ||
transform: `translateY(${zn}px)` | ||
}, | ||
children: pt.map((f) => /* @__PURE__ */ y( | ||
qo, | ||
children: Nn.map((p) => /* @__PURE__ */ I( | ||
Jo, | ||
{ | ||
mount: K, | ||
unmount: Ne, | ||
item: f, | ||
item: p, | ||
ItemContent: m | ||
}, | ||
Kn({ index: f.index, data: f.data, context: he }) | ||
qn({ index: p.index, data: p.data, context: ge }) | ||
)) | ||
} | ||
) : k ? /* @__PURE__ */ y(k, { context: he }) : null, | ||
r && /* @__PURE__ */ y(h, { ref: Y, style: Ye, children: /* @__PURE__ */ y(r, { context: he }) }), | ||
u && /* @__PURE__ */ y(p, { ref: Q, style: Ye, children: /* @__PURE__ */ y(u, { context: he }) }) | ||
) : 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 }) }) | ||
] | ||
} | ||
) }); | ||
}, qo = ({ item: e, ItemContent: t, mount: n, unmount: o }) => { | ||
}, Jo = ({ item: e, ItemContent: t, mount: n, unmount: o }) => { | ||
const s = B(Oe), i = g.useRef(null), l = g.useCallback( | ||
@@ -1983,3 +1989,3 @@ (r) => { | ||
); | ||
return /* @__PURE__ */ y( | ||
return /* @__PURE__ */ I( | ||
"div", | ||
@@ -1996,7 +2002,7 @@ { | ||
}, | ||
children: /* @__PURE__ */ y(t, { index: e.index, prevData: e.prevData, nextData: e.nextData, data: e.data, context: s }) | ||
children: /* @__PURE__ */ I(t, { index: e.index, prevData: e.prevData, nextData: e.nextData, data: e.data, context: s }) | ||
} | ||
); | ||
}; | ||
function Ke(e) { | ||
function je(e) { | ||
const t = g.useRef(null); | ||
@@ -2011,7 +2017,7 @@ return [g.useCallback( | ||
export { | ||
jo as VirtuosoMessageList, | ||
Ko as VirtuosoMessageListLicense, | ||
Qo as useCurrentlyRenderedData, | ||
Xo as useVirtuosoLocation, | ||
es as useVirtuosoMethods | ||
Go as VirtuosoMessageList, | ||
qo as VirtuosoMessageListLicense, | ||
ns as useCurrentlyRenderedData, | ||
ts as useVirtuosoLocation, | ||
os as useVirtuosoMethods | ||
}; |
@@ -23,3 +23,3 @@ { | ||
}, | ||
"version": "1.8.0-alpha.19", | ||
"version": "1.8.0-alpha.20", | ||
"type": "module", | ||
@@ -26,0 +26,0 @@ "module": "dist/index.js", |
85024
2329