import { jsx as U, jsxs as Ze } from "react/jsx-runtime";
import B, { createElement as dt } from "react";
import en from "react-dom";
const It = 0, Ee = 1, Ue = 2, To = 4;
function Qt(e) {
  return () => e;
}
function tn(e) {
  e();
}
function xo(e, t) {
  return (o) => e(t(o));
}
function eo(e, t) {
  return () => e(t);
}
function on(e, t) {
  return (o) => e(t, o);
}
function Wt(e) {
  return e !== void 0;
}
function nn(...e) {
  return () => {
    e.map(tn);
  };
}
function je() {
}
function Tt(e, t) {
  return t(e), e;
}
function rn(e, t) {
  return t(e);
}
function X(...e) {
  return e;
}
function q(e, t) {
  return e(Ee, t);
}
function V(e, t) {
  e(It, t);
}
function Pt(e) {
  e(Ue);
}
function ee(e) {
  return e(To);
}
function k(e, t) {
  return q(e, on(t, It));
}
function Te(e, t) {
  const o = e(Ee, (n) => {
    o(), t(n);
  });
  return o;
}
function to(e) {
  let t, o;
  return (n) => (r) => {
    t = r, o && clearTimeout(o), o = setTimeout(() => {
      n(t);
    }, e);
  };
}
function So(e, t) {
  return e === t;
}
function $(e = So) {
  let t;
  return (o) => (n) => {
    e(t, n) || (t = n, o(n));
  };
}
function W(e) {
  return (t) => (o) => {
    e(o) && t(o);
  };
}
function b(e) {
  return (t) => xo(t, e);
}
function we(e) {
  return (t) => () => {
    t(e);
  };
}
function p(e, ...t) {
  const o = ln(...t);
  return (n, r) => {
    switch (n) {
      case Ue:
        Pt(e);
        return;
      case Ee:
        return q(e, o(r));
    }
  };
}
function Ce(e, t) {
  return (o) => (n) => {
    o(t = e(t, n));
  };
}
function Ae(e) {
  return (t) => (o) => {
    e > 0 ? e-- : t(o);
  };
}
function be(e) {
  let t = null, o;
  return (n) => (r) => {
    t = r, !o && (o = setTimeout(() => {
      o = void 0, n(t);
    }, e));
  };
}
function D(...e) {
  const t = new Array(e.length);
  let o = 0, n = null;
  const r = Math.pow(2, e.length) - 1;
  return e.forEach((i, l) => {
    const s = Math.pow(2, l);
    q(i, (c) => {
      const a = o;
      o = o | s, t[l] = c, a !== r && o === r && n && (n(), n = null);
    });
  }), (i) => (l) => {
    const s = () => {
      i([l].concat(t));
    };
    o === r ? s() : n = s;
  };
}
function ln(...e) {
  return (t) => e.reduceRight(rn, t);
}
function sn(e) {
  let t, o;
  const n = () => t?.();
  return function(r, i) {
    switch (r) {
      case Ee:
        return i ? o === i ? void 0 : (n(), o = i, t = q(e, i), t) : (n(), je);
      case Ue:
        n(), o = null;
        return;
    }
  };
}
function x(e) {
  let t = e;
  const o = G();
  return (n, r) => {
    switch (n) {
      case It:
        t = r;
        break;
      case Ee: {
        r(t);
        break;
      }
      case To:
        return t;
    }
    return o(n, r);
  };
}
function le(e, t) {
  return Tt(x(t), (o) => k(e, o));
}
function G() {
  const e = [];
  return (t, o) => {
    switch (t) {
      case It:
        e.slice().forEach((n) => {
          n(o);
        });
        return;
      case Ue:
        e.splice(0, e.length);
        return;
      case Ee:
        return e.push(o), () => {
          const n = e.indexOf(o);
          n > -1 && e.splice(n, 1);
        };
    }
  };
}
function fe(e) {
  return Tt(G(), (t) => k(e, t));
}
function _(e, t = [], { singleton: o } = { singleton: !0 }) {
  return {
    constructor: e,
    dependencies: t,
    id: cn(),
    singleton: o
  };
}
const cn = () => Symbol();
function an(e) {
  const t = /* @__PURE__ */ new Map(), o = ({ constructor: n, dependencies: r, id: i, singleton: l }) => {
    if (l && t.has(i))
      return t.get(i);
    const s = n(r.map((c) => o(c)));
    return l && t.set(i, s), s;
  };
  return o(e);
}
function te(...e) {
  const t = G(), o = new Array(e.length);
  let n = 0;
  const r = Math.pow(2, e.length) - 1;
  return e.forEach((i, l) => {
    const s = Math.pow(2, l);
    q(i, (c) => {
      o[l] = c, n = n | s, n === r && V(t, o);
    });
  }), function(i, l) {
    switch (i) {
      case Ue: {
        Pt(t);
        return;
      }
      case Ee:
        return n === r && l(o), q(t, l);
    }
  };
}
function O(e, t = So) {
  return p(e, $(t));
}
function Bt(...e) {
  return function(t, o) {
    switch (t) {
      case Ue:
        return;
      case Ee:
        return nn(...e.map((n) => q(n, o)));
    }
  };
}
var ue = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e))(ue || {});
const un = {
  0: "debug",
  3: "error",
  1: "log",
  2: "warn"
}, dn = () => typeof globalThis > "u" ? window : globalThis, ke = _(
  () => {
    const e = x(
      3
      /* ERROR */
    );
    return {
      log: x((t, o, n = 1) => {
        var r;
        const i = (r = dn().VIRTUOSO_LOG_LEVEL) != null ? r : ee(e);
        n >= i && console[un[n]](
          "%creact-virtuoso: %c%s %o",
          "color: #0253b3; font-weight: bold",
          "color: initial",
          t,
          o
        );
      }),
      logLevel: e
    };
  },
  [],
  { singleton: !0 }
);
function Ve(e, t, o) {
  return At(e, t, o).callbackRef;
}
function At(e, t, o) {
  const n = B.useRef(null);
  let r = (l) => {
  };
  const i = B.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((l) => {
    const s = () => {
      const c = l[0].target;
      c.offsetParent !== null && e(c);
    };
    o ? s() : requestAnimationFrame(s);
  }) : null, [e, o]);
  return r = (l) => {
    l && t ? (i?.observe(l), n.current = l) : (n.current && i?.unobserve(n.current), n.current = null);
  }, { callbackRef: r, ref: n };
}
function fn(e, t, o, n, r, i, l, s, c) {
  const a = B.useCallback(
    (m) => {
      const T = hn(m.children, t, s ? "offsetWidth" : "offsetHeight", r);
      let g = m.parentElement;
      for (; !g.dataset.virtuosoScroller; )
        g = g.parentElement;
      const I = g.lastElementChild.dataset.viewportType === "window";
      let H;
      I && (H = g.ownerDocument.defaultView);
      const y = l ? s ? l.scrollLeft : l.scrollTop : I ? s ? H.scrollX || H.document.documentElement.scrollLeft : H.scrollY || H.document.documentElement.scrollTop : s ? g.scrollLeft : g.scrollTop, v = l ? s ? l.scrollWidth : l.scrollHeight : I ? s ? H.document.documentElement.scrollWidth : H.document.documentElement.scrollHeight : s ? g.scrollWidth : g.scrollHeight, h = l ? s ? l.offsetWidth : l.offsetHeight : I ? s ? H.innerWidth : H.innerHeight : s ? g.offsetWidth : g.offsetHeight;
      n({
        scrollHeight: v,
        scrollTop: Math.max(y, 0),
        viewportHeight: h
      }), i?.(
        s ? oo("column-gap", getComputedStyle(m).columnGap, r) : oo("row-gap", getComputedStyle(m).rowGap, r)
      ), T !== null && e(T);
    },
    [e, t, r, i, l, n, s]
  );
  return At(a, o, c);
}
function hn(e, t, o, n) {
  const r = e.length;
  if (r === 0)
    return null;
  const i = [];
  for (let l = 0; l < r; l++) {
    const s = e.item(l);
    if (s.dataset.index === void 0)
      continue;
    const c = parseInt(s.dataset.index), a = parseFloat(s.dataset.knownSize), m = t(s, o);
    if (m === 0 && n("Zero-sized element, this should not happen", { child: s }, ue.ERROR), m === a)
      continue;
    const T = i[i.length - 1];
    i.length === 0 || T.size !== m || T.endIndex !== c - 1 ? i.push({ endIndex: c, size: m, startIndex: c }) : i[i.length - 1].endIndex++;
  }
  return i;
}
function oo(e, t, o) {
  return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, ue.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
}
function wo(e, t, o) {
  const n = B.useRef(null), r = B.useCallback(
    (c) => {
      if (!(c != null && c.offsetParent))
        return;
      const a = c.getBoundingClientRect(), m = a.width;
      let T, g;
      if (t) {
        const I = t.getBoundingClientRect(), H = a.top - I.top;
        g = I.height - Math.max(0, H), T = H + t.scrollTop;
      } else {
        const I = l.current.ownerDocument.defaultView;
        g = I.innerHeight - Math.max(0, a.top), T = a.top + I.scrollY;
      }
      n.current = {
        offsetTop: T,
        visibleHeight: g,
        visibleWidth: m
      }, e(n.current);
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [e, t]
  ), { callbackRef: i, ref: l } = At(r, !0, o), s = B.useCallback(() => {
    r(l.current);
  }, [r, l]);
  return B.useEffect(() => {
    var c;
    if (t) {
      t.addEventListener("scroll", s);
      const a = new ResizeObserver(() => {
        requestAnimationFrame(s);
      });
      return a.observe(t), () => {
        t.removeEventListener("scroll", s), a.unobserve(t);
      };
    } else {
      const a = (c = l.current) == null ? void 0 : c.ownerDocument.defaultView;
      return a?.addEventListener("scroll", s), a?.addEventListener("resize", s), () => {
        a?.removeEventListener("scroll", s), a?.removeEventListener("resize", s);
      };
    }
  }, [s, t, l]), i;
}
const ce = _(
  () => {
    const e = G(), t = G(), o = x(0), n = G(), r = x(0), i = G(), l = G(), s = x(0), c = x(0), a = x(0), m = x(0), T = G(), g = G(), I = x(!1), H = x(!1), y = x(!1);
    return k(
      p(
        e,
        b(({ scrollTop: v }) => v)
      ),
      t
    ), k(
      p(
        e,
        b(({ scrollHeight: v }) => v)
      ),
      l
    ), k(t, r), {
      deviation: o,
      fixedFooterHeight: a,
      fixedHeaderHeight: c,
      footerHeight: m,
      headerHeight: s,
      horizontalDirection: H,
      scrollBy: g,
      // input
      scrollContainerState: e,
      scrollHeight: l,
      scrollingInProgress: I,
      // signals
      scrollTo: T,
      scrollTop: t,
      skipAnimationFrameInResizeObserver: y,
      smoothScrollTargetReached: n,
      // state
      statefulScrollTop: r,
      viewportHeight: i
    };
  },
  [],
  { singleton: !0 }
), Je = { lvl: 0 };
function Co(e, t) {
  const o = e.length;
  if (o === 0)
    return [];
  let { index: n, value: r } = t(e[0]);
  const i = [];
  for (let l = 1; l < o; l++) {
    const { index: s, value: c } = t(e[l]);
    i.push({ end: s - 1, start: n, value: r }), n = s, r = c;
  }
  return i.push({ end: 1 / 0, start: n, value: r }), i;
}
function K(e) {
  return e === Je;
}
function Qe(e, t) {
  if (!K(e))
    return t === e.k ? e.v : t < e.k ? Qe(e.l, t) : Qe(e.r, t);
}
function xe(e, t, o = "k") {
  if (K(e))
    return [-1 / 0, void 0];
  if (Number(e[o]) === t)
    return [e.k, e.v];
  if (Number(e[o]) < t) {
    const n = xe(e.r, t, o);
    return n[0] === -1 / 0 ? [e.k, e.v] : n;
  }
  return xe(e.l, t, o);
}
function de(e, t, o) {
  return K(e) ? bo(t, o, 1) : t === e.k ? oe(e, { k: t, v: o }) : t < e.k ? no(oe(e, { l: de(e.l, t, o) })) : no(oe(e, { r: de(e.r, t, o) }));
}
function _e() {
  return Je;
}
function xt(e, t, o) {
  if (K(e))
    return [];
  const n = xe(e, t)[0];
  return mn(kt(e, n, o));
}
function Et(e, t) {
  if (K(e)) return Je;
  const { k: o, l: n, r } = e;
  if (t === o) {
    if (K(n))
      return r;
    if (K(r))
      return n;
    {
      const [i, l] = yo(n);
      return ft(oe(e, { k: i, l: Ho(n), v: l }));
    }
  } else return t < o ? ft(oe(e, { l: Et(n, t) })) : ft(oe(e, { r: Et(r, t) }));
}
function Pe(e) {
  return K(e) ? [] : [...Pe(e.l), { k: e.k, v: e.v }, ...Pe(e.r)];
}
function kt(e, t, o) {
  if (K(e))
    return [];
  const { k: n, l: r, r: i, v: l } = e;
  let s = [];
  return n > t && (s = s.concat(kt(r, t, o))), n >= t && n <= o && s.push({ k: n, v: l }), n <= o && (s = s.concat(kt(i, t, o))), s;
}
function ft(e) {
  const { l: t, lvl: o, r: n } = e;
  if (n.lvl >= o - 1 && t.lvl >= o - 1)
    return e;
  if (o > n.lvl + 1) {
    if (Ht(t))
      return zo(oe(e, { lvl: o - 1 }));
    if (!K(t) && !K(t.r))
      return oe(t.r, {
        l: oe(t, { r: t.r.l }),
        lvl: o,
        r: oe(e, {
          l: t.r.r,
          lvl: o - 1
        })
      });
    throw new Error("Unexpected empty nodes");
  } else {
    if (Ht(e))
      return Lt(oe(e, { lvl: o - 1 }));
    if (!K(n) && !K(n.l)) {
      const r = n.l, i = Ht(r) ? n.lvl - 1 : n.lvl;
      return oe(r, {
        l: oe(e, {
          lvl: o - 1,
          r: r.l
        }),
        lvl: r.lvl + 1,
        r: Lt(oe(n, { l: r.r, lvl: i }))
      });
    } else
      throw new Error("Unexpected empty nodes");
  }
}
function oe(e, t) {
  return bo(
    t.k !== void 0 ? t.k : e.k,
    t.v !== void 0 ? t.v : e.v,
    t.lvl !== void 0 ? t.lvl : e.lvl,
    t.l !== void 0 ? t.l : e.l,
    t.r !== void 0 ? t.r : e.r
  );
}
function Ho(e) {
  return K(e.r) ? e.l : ft(oe(e, { r: Ho(e.r) }));
}
function Ht(e) {
  return K(e) || e.lvl > e.r.lvl;
}
function yo(e) {
  return K(e.r) ? [e.k, e.v] : yo(e.r);
}
function bo(e, t, o, n = Je, r = Je) {
  return { k: e, l: n, lvl: o, r, v: t };
}
function no(e) {
  return Lt(zo(e));
}
function zo(e) {
  const { l: t } = e;
  return !K(t) && t.lvl === e.lvl ? oe(t, { r: oe(e, { l: t.r }) }) : e;
}
function Lt(e) {
  const { lvl: t, r: o } = e;
  return !K(o) && !K(o.r) && o.lvl === t && o.r.lvl === t ? oe(o, { l: oe(e, { r: o.l }), lvl: t + 1 }) : e;
}
function mn(e) {
  return Co(e, ({ k: t, v: o }) => ({ index: t, value: o }));
}
function Ro(e, t) {
  return !!(e && e.startIndex === t.startIndex && e.endIndex === t.endIndex);
}
function et(e, t) {
  return !!(e && e[0] === t[0] && e[1] === t[1]);
}
const Vt = _(
  () => ({ recalcInProgress: x(!1) }),
  [],
  { singleton: !0 }
);
function Bo(e, t, o) {
  return e[mt(e, t, o)];
}
function mt(e, t, o, n = 0) {
  let r = e.length - 1;
  for (; n <= r; ) {
    const i = Math.floor((n + r) / 2), l = e[i], s = o(l, t);
    if (s === 0)
      return i;
    if (s === -1) {
      if (r - n < 2)
        return i - 1;
      r = i - 1;
    } else {
      if (r === n)
        return i;
      n = i + 1;
    }
  }
  throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`);
}
function gn(e, t, o, n) {
  const r = mt(e, t, n), i = mt(e, o, n, r);
  return e.slice(r, i + 1);
}
function Be(e, t) {
  return Math.round(e.getBoundingClientRect()[t]);
}
function St(e) {
  return !K(e.groupOffsetTree);
}
function Dt({ index: e }, t) {
  return t === e ? 0 : t < e ? -1 : 1;
}
function pn() {
  return {
    groupIndices: [],
    groupOffsetTree: _e(),
    lastIndex: 0,
    lastOffset: 0,
    lastSize: 0,
    offsetTree: [],
    sizeTree: _e()
  };
}
function vn(e, t) {
  let o = K(e) ? 0 : 1 / 0;
  for (const n of t) {
    const { endIndex: r, size: i, startIndex: l } = n;
    if (o = Math.min(o, l), K(e)) {
      e = de(e, 0, i);
      continue;
    }
    const s = xt(e, l - 1, r + 1);
    if (s.some(Hn(n)))
      continue;
    let c = !1, a = !1;
    for (const { end: m, start: T, value: g } of s)
      c ? (r >= T || i === g) && (e = Et(e, T)) : (a = g !== i, c = !0), m > r && r >= T && g !== i && (e = de(e, r + 1, g));
    a && (e = de(e, l, i));
  }
  return [e, o];
}
function In(e) {
  return typeof e.groupIndex < "u";
}
function Tn({ offset: e }, t) {
  return t === e ? 0 : t < e ? -1 : 1;
}
function tt(e, t, o) {
  if (t.length === 0)
    return 0;
  const { index: n, offset: r, size: i } = Bo(t, e, Dt), l = e - n, s = i * l + (l - 1) * o + r;
  return s > 0 ? s + o : s;
}
function Eo(e, t) {
  if (!St(t))
    return e;
  let o = 0;
  for (; t.groupIndices[o] <= e + o; )
    o++;
  return e + o;
}
function ko(e, t, o) {
  if (In(e))
    return t.groupIndices[e.groupIndex] + 1;
  {
    const n = e.index === "LAST" ? o : e.index;
    let r = Eo(n, t);
    return r = Math.max(0, r, Math.min(o, r)), r;
  }
}
function xn(e, t, o, n = 0) {
  return n > 0 && (t = Math.max(t, Bo(e, n, Dt).offset)), Co(gn(e, t, o, Tn), Cn);
}
function Sn(e, [t, o, n, r]) {
  t.length > 0 && n("received item sizes", t, ue.DEBUG);
  const i = e.sizeTree;
  let l = i, s = 0;
  if (o.length > 0 && K(i) && t.length === 2) {
    const g = t[0].size, I = t[1].size;
    l = o.reduce((H, y) => de(de(H, y, g), y + 1, I), l);
  } else
    [l, s] = vn(l, t);
  if (l === i)
    return e;
  const { lastIndex: c, lastOffset: a, lastSize: m, offsetTree: T } = Mt(e.offsetTree, s, l, r);
  return {
    groupIndices: o,
    groupOffsetTree: o.reduce((g, I) => de(g, I, tt(I, T, r)), _e()),
    lastIndex: c,
    lastOffset: a,
    lastSize: m,
    offsetTree: T,
    sizeTree: l
  };
}
function wn(e) {
  return Pe(e).map(({ k: t, v: o }, n, r) => {
    const i = r[n + 1];
    return { endIndex: i ? i.k - 1 : 1 / 0, size: o, startIndex: t };
  });
}
function ro(e, t) {
  let o = 0, n = 0;
  for (; o < e; )
    o += t[n + 1] - t[n] - 1, n++;
  return n - (o === e ? 0 : 1);
}
function Mt(e, t, o, n) {
  let r = e, i = 0, l = 0, s = 0, c = 0;
  if (t !== 0) {
    c = mt(r, t - 1, Dt), s = r[c].offset;
    const a = xe(o, t - 1);
    i = a[0], l = a[1], r.length && r[c].size === xe(o, t)[1] && (c -= 1), r = r.slice(0, c + 1);
  } else
    r = [];
  for (const { start: a, value: m } of xt(o, t, 1 / 0)) {
    const T = a - i, g = T * l + s + T * n;
    r.push({
      index: a,
      offset: g,
      size: m
    }), i = a, s = g, l = m;
  }
  return {
    lastIndex: i,
    lastOffset: s,
    lastSize: l,
    offsetTree: r
  };
}
function Cn(e) {
  return { index: e.index, value: e };
}
function Hn(e) {
  const { endIndex: t, size: o, startIndex: n } = e;
  return (r) => r.start === n && (r.end === t || r.end === 1 / 0) && r.value === o;
}
const yn = {
  offsetHeight: "height",
  offsetWidth: "width"
}, He = _(
  ([{ log: e }, { recalcInProgress: t }]) => {
    const o = G(), n = G(), r = le(n, 0), i = G(), l = G(), s = x(0), c = x([]), a = x(void 0), m = x(void 0), T = x((f, u) => Be(f, yn[u])), g = x(void 0), I = x(0), H = pn(), y = le(
      p(o, D(c, e, I), Ce(Sn, H), $()),
      H
    ), v = le(
      p(
        c,
        $(),
        Ce((f, u) => ({ current: u, prev: f.current }), {
          current: [],
          prev: []
        }),
        b(({ prev: f }) => f)
      ),
      []
    );
    k(
      p(
        c,
        W((f) => f.length > 0),
        D(y, I),
        b(([f, u, S]) => {
          const z = f.reduce((L, M, P) => de(L, M, tt(M, u.offsetTree, S) || P), _e());
          return {
            ...u,
            groupIndices: f,
            groupOffsetTree: z
          };
        })
      ),
      y
    ), k(
      p(
        n,
        D(y),
        W(([f, { lastIndex: u }]) => f < u),
        b(([f, { lastIndex: u, lastSize: S }]) => [
          {
            endIndex: u,
            size: S,
            startIndex: f
          }
        ])
      ),
      o
    ), k(a, m);
    const h = le(
      p(
        a,
        b((f) => f === void 0)
      ),
      !0
    );
    k(
      p(
        m,
        W((f) => f !== void 0 && K(ee(y).sizeTree)),
        b((f) => [{ endIndex: 0, size: f, startIndex: 0 }])
      ),
      o
    );
    const d = fe(
      p(
        o,
        D(y),
        Ce(
          ({ sizes: f }, [u, S]) => ({
            changed: S !== f,
            sizes: S
          }),
          { changed: !1, sizes: H }
        ),
        b((f) => f.changed)
      )
    );
    q(
      p(
        s,
        Ce(
          (f, u) => ({ diff: f.prev - u, prev: u }),
          { diff: 0, prev: 0 }
        ),
        b((f) => f.diff)
      ),
      (f) => {
        const { groupIndices: u } = ee(y);
        if (f > 0)
          V(t, !0), V(i, f + ro(f, u));
        else if (f < 0) {
          const S = ee(v);
          S.length > 0 && (f -= ro(-f, S)), V(l, f);
        }
      }
    ), q(p(s, D(e)), ([f, u]) => {
      f < 0 && u(
        "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
        { firstItemIndex: s },
        ue.ERROR
      );
    });
    const C = fe(i);
    k(
      p(
        i,
        D(y),
        b(([f, u]) => {
          const S = u.groupIndices.length > 0, z = [], L = u.lastSize;
          if (S) {
            const M = Qe(u.sizeTree, 0);
            let P = 0, N = 0;
            for (; P < f; ) {
              const E = u.groupIndices[N], j = u.groupIndices.length === N + 1 ? 1 / 0 : u.groupIndices[N + 1] - E - 1;
              z.push({
                endIndex: E,
                size: M,
                startIndex: E
              }), z.push({
                endIndex: E + 1 + j - 1,
                size: L,
                startIndex: E + 1
              }), N++, P += j + 1;
            }
            const Y = Pe(u.sizeTree);
            return P !== f && Y.shift(), Y.reduce(
              (E, { k: j, v: ne }) => {
                let he = E.ranges;
                return E.prevSize !== 0 && (he = [
                  ...E.ranges,
                  {
                    endIndex: j + f - 1,
                    size: E.prevSize,
                    startIndex: E.prevIndex
                  }
                ]), {
                  prevIndex: j + f,
                  prevSize: ne,
                  ranges: he
                };
              },
              {
                prevIndex: f,
                prevSize: 0,
                ranges: z
              }
            ).ranges;
          }
          return Pe(u.sizeTree).reduce(
            (M, { k: P, v: N }) => ({
              prevIndex: P + f,
              prevSize: N,
              ranges: [...M.ranges, { endIndex: P + f - 1, size: M.prevSize, startIndex: M.prevIndex }]
            }),
            {
              prevIndex: 0,
              prevSize: L,
              ranges: []
            }
          ).ranges;
        })
      ),
      o
    );
    const R = fe(
      p(
        l,
        D(y, I),
        b(([f, { offsetTree: u }, S]) => {
          const z = -f;
          return tt(z, u, S);
        })
      )
    );
    return k(
      p(
        l,
        D(y, I),
        b(([f, u, S]) => {
          if (u.groupIndices.length > 0) {
            if (K(u.sizeTree))
              return u;
            let z = _e();
            const L = ee(v);
            let M = 0, P = 0, N = 0;
            for (; M < -f; ) {
              N = L[P];
              const Y = L[P + 1] - N - 1;
              P++, M += Y + 1;
            }
            if (z = Pe(u.sizeTree).reduce((Y, { k: E, v: j }) => de(Y, Math.max(0, E + f), j), z), M !== -f) {
              const Y = Qe(u.sizeTree, N);
              z = de(z, 0, Y);
              const E = xe(u.sizeTree, -f + 1)[1];
              z = de(z, 1, E);
            }
            return {
              ...u,
              sizeTree: z,
              ...Mt(u.offsetTree, 0, z, S)
            };
          } else {
            const z = Pe(u.sizeTree).reduce((L, { k: M, v: P }) => de(L, Math.max(0, M + f), P), _e());
            return {
              ...u,
              sizeTree: z,
              ...Mt(u.offsetTree, 0, z, S)
            };
          }
        })
      ),
      y
    ), {
      beforeUnshiftWith: C,
      // input
      data: g,
      defaultItemSize: m,
      firstItemIndex: s,
      fixedItemSize: a,
      gap: I,
      groupIndices: c,
      itemSize: T,
      listRefresh: d,
      shiftWith: l,
      shiftWithOffset: R,
      sizeRanges: o,
      // output
      sizes: y,
      statefulTotalCount: r,
      totalCount: n,
      trackItemSizes: h,
      unshiftWith: i
    };
  },
  X(ke, Vt),
  { singleton: !0 }
);
function bn(e) {
  return e.reduce(
    (t, o) => (t.groupIndices.push(t.totalCount), t.totalCount += o + 1, t),
    {
      groupIndices: [],
      totalCount: 0
    }
  );
}
const Lo = _(
  ([{ groupIndices: e, sizes: t, totalCount: o }, { headerHeight: n, scrollTop: r }]) => {
    const i = G(), l = G(), s = fe(p(i, b(bn)));
    return k(
      p(
        s,
        b((c) => c.totalCount)
      ),
      o
    ), k(
      p(
        s,
        b((c) => c.groupIndices)
      ),
      e
    ), k(
      p(
        te(r, t, n),
        W(([c, a]) => St(a)),
        b(([c, a, m]) => xe(a.groupOffsetTree, Math.max(c - m, 0), "v")[0]),
        $(),
        b((c) => [c])
      ),
      l
    ), { groupCounts: i, topItemsIndexes: l };
  },
  X(He, ce)
), Le = _(
  ([{ log: e }]) => {
    const t = x(!1), o = fe(
      p(
        t,
        W((n) => n),
        $()
      )
    );
    return q(t, (n) => {
      n && ee(e)("props updated", {}, ue.DEBUG);
    }), { didMount: o, propsReady: t };
  },
  X(ke),
  { singleton: !0 }
), zn = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
function Mo(e) {
  const t = typeof e == "number" ? { index: e } : e;
  return t.align || (t.align = "start"), (!t.behavior || !zn) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
}
const nt = _(
  ([
    { gap: e, listRefresh: t, sizes: o, totalCount: n },
    {
      fixedFooterHeight: r,
      fixedHeaderHeight: i,
      footerHeight: l,
      headerHeight: s,
      scrollingInProgress: c,
      scrollTo: a,
      smoothScrollTargetReached: m,
      viewportHeight: T
    },
    { log: g }
  ]) => {
    const I = G(), H = G(), y = x(0);
    let v = null, h = null, d = null;
    function C() {
      v && (v(), v = null), d && (d(), d = null), h && (clearTimeout(h), h = null), V(c, !1);
    }
    return k(
      p(
        I,
        D(o, T, n, y, s, l, g),
        D(e, i, r),
        b(
          ([
            [R, f, u, S, z, L, M, P],
            N,
            Y,
            E
          ]) => {
            const j = Mo(R), { align: ne, behavior: he, offset: pe } = j, ve = S - 1, ae = ko(j, f, ve);
            let se = tt(ae, f.offsetTree, N) + L;
            ne === "end" ? (se += Y + xe(f.sizeTree, ae)[1] - u + E, ae === ve && (se += M)) : ne === "center" ? se += (Y + xe(f.sizeTree, ae)[1] - u + E) / 2 : se -= z, pe && (se += pe);
            const Me = (Ie) => {
              C(), Ie ? (P("retrying to scroll to", { location: R }, ue.DEBUG), V(I, R)) : (V(H, !0), P("list did not change, scroll successful", {}, ue.DEBUG));
            };
            if (C(), he === "smooth") {
              let Ie = !1;
              d = q(t, (qe) => {
                Ie = Ie || qe;
              }), v = Te(m, () => {
                Me(Ie);
              });
            } else
              v = Te(p(t, Rn(150)), Me);
            return h = setTimeout(() => {
              C();
            }, 1200), V(c, !0), P("scrolling from index to", { behavior: he, index: ae, top: se }, ue.DEBUG), { behavior: he, top: se };
          }
        )
      ),
      a
    ), {
      scrollTargetReached: H,
      scrollToIndex: I,
      topListHeight: y
    };
  },
  X(He, ce, ke),
  { singleton: !0 }
);
function Rn(e) {
  return (t) => {
    const o = setTimeout(() => {
      t(!1);
    }, e);
    return (n) => {
      n && (t(!0), clearTimeout(o));
    };
  };
}
function Ft(e, t) {
  e == 0 ? t() : requestAnimationFrame(() => {
    Ft(e - 1, t);
  });
}
function Gt(e, t) {
  const o = t - 1;
  return typeof e == "number" ? e : e.index === "LAST" ? o : e.index;
}
const rt = _(
  ([{ defaultItemSize: e, listRefresh: t, sizes: o }, { scrollTop: n }, { scrollTargetReached: r, scrollToIndex: i }, { didMount: l }]) => {
    const s = x(!0), c = x(0), a = x(!0);
    return k(
      p(
        l,
        D(c),
        W(([m, T]) => !!T),
        we(!1)
      ),
      s
    ), k(
      p(
        l,
        D(c),
        W(([m, T]) => !!T),
        we(!1)
      ),
      a
    ), q(
      p(
        te(t, l),
        D(s, o, e, a),
        W(([[, m], T, { sizeTree: g }, I, H]) => m && (!K(g) || Wt(I)) && !T && !H),
        D(c)
      ),
      ([, m]) => {
        Te(r, () => {
          V(a, !0);
        }), Ft(4, () => {
          Te(n, () => {
            V(s, !0);
          }), V(i, m);
        });
      }
    ), {
      initialItemFinalLocationReached: a,
      initialTopMostItemIndex: c,
      scrolledToInitialItem: s
    };
  },
  X(He, ce, nt, Le),
  { singleton: !0 }
);
function Oo(e, t) {
  return Math.abs(e - t) < 1.01;
}
const ot = "up", $e = "down", Bn = "none", En = {
  atBottom: !1,
  notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
  state: {
    offsetBottom: 0,
    scrollHeight: 0,
    scrollTop: 0,
    viewportHeight: 0
  }
}, kn = 0, it = _(([{ footerHeight: e, headerHeight: t, scrollBy: o, scrollContainerState: n, scrollTop: r, viewportHeight: i }]) => {
  const l = x(!1), s = x(!0), c = G(), a = G(), m = x(4), T = x(kn), g = le(
    p(
      Bt(p(O(r), Ae(1), we(!0)), p(O(r), Ae(1), we(!1), to(100))),
      $()
    ),
    !1
  ), I = le(
    p(Bt(p(o, we(!0)), p(o, we(!1), to(200))), $()),
    !1
  );
  k(
    p(
      te(O(r), O(T)),
      b(([d, C]) => d <= C),
      $()
    ),
    s
  ), k(p(s, be(50)), a);
  const H = fe(
    p(
      te(n, O(i), O(t), O(e), O(m)),
      Ce((d, [{ scrollHeight: C, scrollTop: R }, f, u, S, z]) => {
        const L = R + f - C > -z, M = {
          scrollHeight: C,
          scrollTop: R,
          viewportHeight: f
        };
        if (L) {
          let N, Y;
          return R > d.state.scrollTop ? (N = "SCROLLED_DOWN", Y = d.state.scrollTop - R) : (N = "SIZE_DECREASED", Y = d.state.scrollTop - R || d.scrollTopDelta), {
            atBottom: !0,
            atBottomBecause: N,
            scrollTopDelta: Y,
            state: M
          };
        }
        let P;
        return M.scrollHeight > d.state.scrollHeight ? P = "SIZE_INCREASED" : f < d.state.viewportHeight ? P = "VIEWPORT_HEIGHT_DECREASING" : R < d.state.scrollTop ? P = "SCROLLING_UPWARDS" : P = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
          atBottom: !1,
          notAtBottomBecause: P,
          state: M
        };
      }, En),
      $((d, C) => d && d.atBottom === C.atBottom)
    )
  ), y = le(
    p(
      n,
      Ce(
        (d, { scrollHeight: C, scrollTop: R, viewportHeight: f }) => {
          if (Oo(d.scrollHeight, C))
            return {
              changed: !1,
              jump: 0,
              scrollHeight: C,
              scrollTop: R
            };
          {
            const u = C - (R + f) < 1;
            return d.scrollTop !== R && u ? {
              changed: !0,
              jump: d.scrollTop - R,
              scrollHeight: C,
              scrollTop: R
            } : {
              changed: !0,
              jump: 0,
              scrollHeight: C,
              scrollTop: R
            };
          }
        },
        { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
      ),
      W((d) => d.changed),
      b((d) => d.jump)
    ),
    0
  );
  k(
    p(
      H,
      b((d) => d.atBottom)
    ),
    l
  ), k(p(l, be(50)), c);
  const v = x($e);
  k(
    p(
      n,
      b(({ scrollTop: d }) => d),
      $(),
      Ce(
        (d, C) => ee(I) ? { direction: d.direction, prevScrollTop: C } : { direction: C < d.prevScrollTop ? ot : $e, prevScrollTop: C },
        { direction: $e, prevScrollTop: 0 }
      ),
      b((d) => d.direction)
    ),
    v
  ), k(p(n, be(50), we(Bn)), v);
  const h = x(0);
  return k(
    p(
      g,
      W((d) => !d),
      we(0)
    ),
    h
  ), k(
    p(
      r,
      be(100),
      D(g),
      W(([d, C]) => !!C),
      Ce(([d, C], [R]) => [C, R], [0, 0]),
      b(([d, C]) => C - d)
    ),
    h
  ), {
    atBottomState: H,
    atBottomStateChange: c,
    atBottomThreshold: m,
    atTopStateChange: a,
    atTopThreshold: T,
    isAtBottom: l,
    isAtTop: s,
    isScrolling: g,
    lastJumpDueToItemResize: y,
    scrollDirection: v,
    scrollVelocity: h
  };
}, X(ce)), gt = "top", pt = "bottom", io = "none";
function lo(e, t, o) {
  return typeof e == "number" ? o === ot && t === gt || o === $e && t === pt ? e : 0 : o === ot ? t === gt ? e.main : e.reverse : t === pt ? e.main : e.reverse;
}
function so(e, t) {
  var o;
  return typeof e == "number" ? e : (o = e[t]) != null ? o : 0;
}
const Nt = _(
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: o, scrollTop: n, viewportHeight: r }]) => {
    const i = G(), l = x(0), s = x(0), c = x(0), a = le(
      p(
        te(
          O(n),
          O(r),
          O(o),
          O(i, et),
          O(c),
          O(l),
          O(t),
          O(e),
          O(s)
        ),
        b(
          ([
            m,
            T,
            g,
            [I, H],
            y,
            v,
            h,
            d,
            C
          ]) => {
            const R = m - d, f = v + h, u = Math.max(g - R, 0);
            let S = io;
            const z = so(C, gt), L = so(C, pt);
            return I -= d, I += g + h, H += g + h, H -= d, I > m + f - z && (S = ot), H < m - u + T + L && (S = $e), S !== io ? [
              Math.max(R - g - lo(y, gt, S) - z, 0),
              R - u - h + T + lo(y, pt, S) + L
            ] : null;
          }
        ),
        W((m) => m != null),
        $(et)
      ),
      [0, 0]
    );
    return {
      increaseViewportBy: s,
      // input
      listBoundary: i,
      overscan: c,
      topListHeight: l,
      // output
      visibleRange: a
    };
  },
  X(ce),
  { singleton: !0 }
);
function Ln(e, t, o) {
  if (St(t)) {
    const n = Eo(e, t);
    return [
      { index: xe(t.groupOffsetTree, n)[0], offset: 0, size: 0 },
      { data: o?.[0], index: n, offset: 0, size: 0 }
    ];
  }
  return [{ data: o?.[0], index: e, offset: 0, size: 0 }];
}
const yt = {
  bottom: 0,
  firstItemIndex: 0,
  items: [],
  offsetBottom: 0,
  offsetTop: 0,
  top: 0,
  topItems: [],
  topListHeight: 0,
  totalCount: 0
};
function ht(e, t, o, n, r, i) {
  const { lastIndex: l, lastOffset: s, lastSize: c } = r;
  let a = 0, m = 0;
  if (e.length > 0) {
    a = e[0].offset;
    const y = e[e.length - 1];
    m = y.offset + y.size;
  }
  const T = o - l, g = s + T * c + (T - 1) * n, I = a, H = g - m;
  return {
    bottom: m,
    firstItemIndex: i,
    items: co(e, r, i),
    offsetBottom: H,
    offsetTop: a,
    top: I,
    topItems: co(t, r, i),
    topListHeight: t.reduce((y, v) => v.size + y, 0),
    totalCount: o
  };
}
function Wo(e, t, o, n, r, i) {
  let l = 0;
  if (o.groupIndices.length > 0)
    for (const m of o.groupIndices) {
      if (m - l >= e)
        break;
      l++;
    }
  const s = e + l, c = Gt(t, s), a = Array.from({ length: s }).map((m, T) => ({
    data: i[T + c],
    index: T + c,
    offset: 0,
    size: 0
  }));
  return ht(a, [], s, r, o, n);
}
function co(e, t, o) {
  if (e.length === 0)
    return [];
  if (!St(t))
    return e.map((a) => ({ ...a, index: a.index + o, originalIndex: a.index }));
  const n = e[0].index, r = e[e.length - 1].index, i = [], l = xt(t.groupOffsetTree, n, r);
  let s, c = 0;
  for (const a of e) {
    (!s || s.end < a.index) && (s = l.shift(), c = t.groupIndices.indexOf(s.start));
    let m;
    a.index === s.start ? m = {
      index: c,
      type: "group"
    } : m = {
      groupIndex: c,
      index: a.index - (c + 1) + o
    }, i.push({
      ...m,
      data: a.data,
      offset: a.offset,
      originalIndex: a.index,
      size: a.size
    });
  }
  return i;
}
const De = _(
  ([
    { data: e, firstItemIndex: t, gap: o, sizes: n, totalCount: r },
    i,
    { listBoundary: l, topListHeight: s, visibleRange: c },
    { initialTopMostItemIndex: a, scrolledToInitialItem: m },
    { topListHeight: T },
    g,
    { didMount: I },
    { recalcInProgress: H }
  ]) => {
    const y = x([]), v = x(0), h = G();
    k(i.topItemsIndexes, y);
    const d = le(
      p(
        te(
          I,
          H,
          O(c, et),
          O(r),
          O(n),
          O(a),
          m,
          O(y),
          O(t),
          O(o),
          e
        ),
        W(([u, S, , z, , , , , , , L]) => {
          const M = L && L.length !== z;
          return u && !S && !M;
        }),
        b(
          ([
            ,
            ,
            [u, S],
            z,
            L,
            M,
            P,
            N,
            Y,
            E,
            j
          ]) => {
            const ne = L, { offsetTree: he, sizeTree: pe } = ne, ve = ee(v);
            if (z === 0)
              return { ...yt, totalCount: z };
            if (u === 0 && S === 0)
              return ve === 0 ? { ...yt, totalCount: z } : Wo(ve, M, L, Y, E, j || []);
            if (K(pe))
              return ve > 0 ? null : ht(
                Ln(Gt(M, z), ne, j),
                [],
                z,
                E,
                ne,
                Y
              );
            const ae = [];
            if (N.length > 0) {
              const Fe = N[0], Se = N[N.length - 1];
              let ye = 0;
              for (const w of xt(pe, Fe, Se)) {
                const F = w.value, Z = Math.max(w.start, Fe), re = Math.min(w.end, Se);
                for (let Q = Z; Q <= re; Q++)
                  ae.push({ data: j?.[Q], index: Q, offset: ye, size: F }), ye += F;
              }
            }
            if (!P)
              return ht([], ae, z, E, ne, Y);
            const se = N.length > 0 ? N[N.length - 1] + 1 : 0, Me = xn(he, u, S, se);
            if (Me.length === 0)
              return null;
            const Ie = z - 1, qe = Tt([], (Fe) => {
              for (const Se of Me) {
                const ye = Se.value;
                let w = ye.offset, F = Se.start;
                const Z = ye.size;
                if (ye.offset < u) {
                  F += Math.floor((u - ye.offset + E) / (Z + E));
                  const Q = F - Se.start;
                  w += Q * Z + Q * E;
                }
                F < se && (w += (se - F) * Z, F = se);
                const re = Math.min(Se.end, Ie);
                for (let Q = F; Q <= re && !(w >= S); Q++)
                  Fe.push({ data: j?.[Q], index: Q, offset: w, size: Z }), w += Z + E;
              }
            });
            return ht(qe, ae, z, E, ne, Y);
          }
        ),
        //@ts-expect-error filter needs to be fixed
        W((u) => u !== null),
        $()
      ),
      yt
    );
    k(
      p(
        e,
        W(Wt),
        b((u) => u?.length)
      ),
      r
    ), k(
      p(
        d,
        b((u) => u.topListHeight)
      ),
      T
    ), k(T, s), k(
      p(
        d,
        b((u) => [u.top, u.bottom])
      ),
      l
    ), k(
      p(
        d,
        b((u) => u.items)
      ),
      h
    );
    const C = fe(
      p(
        d,
        W(({ items: u }) => u.length > 0),
        D(r, e),
        W(([{ items: u }, S]) => u[u.length - 1].originalIndex === S - 1),
        b(([, u, S]) => [u - 1, S]),
        $(et),
        b(([u]) => u)
      )
    ), R = fe(
      p(
        d,
        be(200),
        W(({ items: u, topItems: S }) => u.length > 0 && u[0].originalIndex === S.length),
        b(({ items: u }) => u[0].index),
        $()
      )
    ), f = fe(
      p(
        d,
        W(({ items: u }) => u.length > 0),
        b(({ items: u }) => {
          let S = 0, z = u.length - 1;
          for (; u[S].type === "group" && S < z; )
            S++;
          for (; u[z].type === "group" && z > S; )
            z--;
          return {
            endIndex: u[z].index,
            startIndex: u[S].index
          };
        }),
        $(Ro)
      )
    );
    return { endReached: C, initialItemCount: v, itemsRendered: h, listState: d, rangeChanged: f, startReached: R, topItemsIndexes: y, ...g };
  },
  X(
    He,
    Lo,
    Nt,
    rt,
    nt,
    it,
    Le,
    Vt
  ),
  { singleton: !0 }
), Po = _(
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: o, headerHeight: n }, { listState: r }]) => {
    const i = G(), l = le(
      p(
        te(o, e, n, t, r),
        b(([s, c, a, m, T]) => s + c + a + m + T.offsetBottom + T.bottom)
      ),
      0
    );
    return k(O(l), i), { totalListHeight: l, totalListHeightChanged: i };
  },
  X(ce, De),
  { singleton: !0 }
), Mn = _(
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
    const o = x(!1), n = le(
      p(
        te(o, e, t),
        W(([r]) => r),
        b(([, r, i]) => Math.max(0, r - i)),
        be(0),
        $()
      ),
      0
    );
    return { alignToBottom: o, paddingTopAddition: n };
  },
  X(ce, Po),
  { singleton: !0 }
), Ao = _(() => ({
  context: x(null)
})), On = ({
  itemBottom: e,
  itemTop: t,
  locationParams: { align: o, behavior: n, ...r },
  viewportBottom: i,
  viewportTop: l
}) => t < l ? { ...r, align: o ?? "start", behavior: n } : e > i ? { ...r, align: o ?? "end", behavior: n } : null, Vo = _(
  ([
    { gap: e, sizes: t, totalCount: o },
    { fixedFooterHeight: n, fixedHeaderHeight: r, headerHeight: i, scrollingInProgress: l, scrollTop: s, viewportHeight: c },
    { scrollToIndex: a }
  ]) => {
    const m = G();
    return k(
      p(
        m,
        D(t, c, o, i, r, n, s),
        D(e),
        b(([[T, g, I, H, y, v, h, d], C]) => {
          const { align: R, behavior: f, calculateViewLocation: u = On, done: S, ...z } = T, L = ko(T, g, H - 1), M = tt(L, g.offsetTree, C) + y + v, P = M + xe(g.sizeTree, L)[1], N = d + v, Y = d + I - h, E = u({
            itemBottom: P,
            itemTop: M,
            locationParams: { align: R, behavior: f, ...z },
            viewportBottom: Y,
            viewportTop: N
          });
          return E ? S && Te(
            p(
              l,
              W((j) => !j),
              // skips the initial publish of false, and the cleanup call.
              // but if scrollingInProgress is true, we skip the initial publish.
              Ae(ee(l) ? 1 : 2)
            ),
            S
          ) : S && S(), E;
        }),
        W((T) => T !== null)
      ),
      a
    ), {
      scrollIntoView: m
    };
  },
  X(He, ce, nt, De, ke),
  { singleton: !0 }
);
function ao(e) {
  return e ? e === "smooth" ? "smooth" : "auto" : !1;
}
const Wn = (e, t) => typeof e == "function" ? ao(e(t)) : t && ao(e), Pn = _(
  ([
    { listRefresh: e, totalCount: t, fixedItemSize: o, data: n },
    { atBottomState: r, isAtBottom: i },
    { scrollToIndex: l },
    { scrolledToInitialItem: s },
    { didMount: c, propsReady: a },
    { log: m },
    { scrollingInProgress: T },
    { context: g },
    { scrollIntoView: I }
  ]) => {
    const H = x(!1), y = G();
    let v = null;
    function h(f) {
      V(l, {
        align: "end",
        behavior: f,
        index: "LAST"
      });
    }
    q(
      p(
        te(p(O(t), Ae(1)), c),
        D(O(H), i, s, T),
        b(([[f, u], S, z, L, M]) => {
          let P = u && L, N = "auto";
          return P && (N = Wn(S, z || M), P = P && !!N), { followOutputBehavior: N, shouldFollow: P, totalCount: f };
        }),
        W(({ shouldFollow: f }) => f)
      ),
      ({ followOutputBehavior: f, totalCount: u }) => {
        v && (v(), v = null), ee(o) ? requestAnimationFrame(() => {
          ee(m)("following output to ", { totalCount: u }, ue.DEBUG), h(f);
        }) : v = Te(e, () => {
          ee(m)("following output to ", { totalCount: u }, ue.DEBUG), h(f), v = null;
        });
      }
    );
    function d(f) {
      const u = Te(r, (S) => {
        f && !S.atBottom && S.notAtBottomBecause === "SIZE_INCREASED" && !v && (ee(m)("scrolling to bottom due to increased size", {}, ue.DEBUG), h("auto"));
      });
      setTimeout(u, 100);
    }
    q(
      p(
        te(O(H), t, a),
        W(([f, , u]) => f && u),
        Ce(
          ({ value: f }, [, u]) => ({ refreshed: f === u, value: u }),
          { refreshed: !1, value: 0 }
        ),
        W(({ refreshed: f }) => f),
        D(H, t)
      ),
      ([, f]) => {
        ee(s) && d(f !== !1);
      }
    ), q(y, () => {
      d(ee(H) !== !1);
    }), q(te(O(H), r), ([f, u]) => {
      f && !u.atBottom && u.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && h("auto");
    });
    const C = x(null), R = G();
    return k(
      Bt(
        p(
          O(n),
          b((f) => {
            var u;
            return (u = f?.length) != null ? u : 0;
          })
        ),
        p(O(t))
      ),
      R
    ), q(
      p(
        te(p(R, Ae(1)), c),
        D(O(C), s, T, g),
        b(([[f, u], S, z, L, M]) => u && z && S?.({ context: M, totalCount: f, scrollingInProgress: L })),
        W((f) => !!f),
        be(0)
      ),
      (f) => {
        v && (v(), v = null), ee(o) ? requestAnimationFrame(() => {
          ee(m)("scrolling into view", {}), V(I, f);
        }) : v = Te(e, () => {
          ee(m)("scrolling into view", {}), V(I, f), v = null;
        });
      }
    ), { autoscrollToBottom: y, followOutput: H, scrollIntoViewOnChange: C };
  },
  X(
    He,
    it,
    nt,
    rt,
    Le,
    ke,
    ce,
    Ao,
    Vo
  )
), An = _(
  ([{ data: e, firstItemIndex: t, gap: o, sizes: n }, { initialTopMostItemIndex: r }, { initialItemCount: i, listState: l }, { didMount: s }]) => (k(
    p(
      s,
      D(i),
      W(([, c]) => c !== 0),
      D(r, n, t, o, e),
      b(([[, c], a, m, T, g, I = []]) => Wo(c, a, m, T, g, I))
    ),
    l
  ), {}),
  X(He, rt, De, Le),
  { singleton: !0 }
), Vn = _(
  ([{ didMount: e }, { scrollTo: t }, { listState: o }]) => {
    const n = x(0);
    return q(
      p(
        e,
        D(n),
        W(([, r]) => r !== 0),
        b(([, r]) => ({ top: r }))
      ),
      (r) => {
        Te(
          p(
            o,
            Ae(1),
            W((i) => i.items.length > 1)
          ),
          () => {
            requestAnimationFrame(() => {
              V(t, r);
            });
          }
        );
      }
    ), {
      initialScrollTop: n
    };
  },
  X(Le, ce, De),
  { singleton: !0 }
), Do = _(
  ([{ scrollVelocity: e }]) => {
    const t = x(!1), o = G(), n = x(!1);
    return k(
      p(
        e,
        D(n, t, o),
        W(([r, i]) => !!i),
        b(([r, i, l, s]) => {
          const { enter: c, exit: a } = i;
          if (l) {
            if (a(r, s))
              return !1;
          } else if (c(r, s))
            return !0;
          return l;
        }),
        $()
      ),
      t
    ), q(
      p(te(t, e, o), D(n)),
      ([[r, i, l], s]) => {
        r && s && s.change && s.change(i, l);
      }
    ), { isSeeking: t, scrollSeekConfiguration: n, scrollSeekRangeChanged: o, scrollVelocity: e };
  },
  X(it),
  { singleton: !0 }
), _t = _(([{ scrollContainerState: e, scrollTo: t }]) => {
  const o = G(), n = G(), r = G(), i = x(!1), l = x(void 0);
  return k(
    p(
      te(o, n),
      b(([{ scrollHeight: s, scrollTop: c, viewportHeight: a }, { offsetTop: m }]) => ({
        scrollHeight: s,
        scrollTop: Math.max(0, c - m),
        viewportHeight: a
      }))
    ),
    e
  ), k(
    p(
      t,
      D(n),
      b(([s, { offsetTop: c }]) => ({
        ...s,
        top: s.top + c
      }))
    ),
    r
  ), {
    customScrollParent: l,
    // config
    useWindowScroll: i,
    // input
    windowScrollContainerState: o,
    // signals
    windowScrollTo: r,
    windowViewportRect: n
  };
}, X(ce)), Dn = _(
  ([
    { sizeRanges: e, sizes: t },
    { headerHeight: o, scrollTop: n },
    { initialTopMostItemIndex: r },
    { didMount: i },
    { useWindowScroll: l, windowScrollContainerState: s, windowViewportRect: c }
  ]) => {
    const a = G(), m = x(void 0), T = x(null), g = x(null);
    return k(s, T), k(c, g), q(
      p(
        a,
        D(t, n, l, T, g, o)
      ),
      ([I, H, y, v, h, d, C]) => {
        const R = wn(H.sizeTree);
        v && h !== null && d !== null && (y = h.scrollTop - d.offsetTop), y -= C, I({ ranges: R, scrollTop: y });
      }
    ), k(p(m, W(Wt), b(Fn)), r), k(
      p(
        i,
        D(m),
        W(([, I]) => I !== void 0),
        $(),
        b(([, I]) => I.ranges)
      ),
      e
    ), {
      getState: a,
      restoreStateFrom: m
    };
  },
  X(He, ce, rt, Le, _t)
);
function Fn(e) {
  return { align: "start", index: 0, offset: e.scrollTop };
}
const Gn = _(([{ topItemsIndexes: e }]) => {
  const t = x(0);
  return k(
    p(
      t,
      W((o) => o >= 0),
      b((o) => Array.from({ length: o }).map((n, r) => r))
    ),
    e
  ), { topItemCount: t };
}, X(De));
function Fo(e) {
  let t = !1, o;
  return () => (t || (t = !0, o = e()), o);
}
const Nn = Fo(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), _n = _(
  ([
    { deviation: e, scrollBy: t, scrollingInProgress: o, scrollTop: n },
    { isAtBottom: r, isScrolling: i, lastJumpDueToItemResize: l, scrollDirection: s },
    { listState: c },
    { beforeUnshiftWith: a, gap: m, shiftWithOffset: T, sizes: g },
    { log: I },
    { recalcInProgress: H }
  ]) => {
    const y = fe(
      p(
        c,
        D(l),
        Ce(
          ([, h, d, C], [{ bottom: R, items: f, offsetBottom: u, totalCount: S }, z]) => {
            const L = R + u;
            let M = 0;
            return d === S && h.length > 0 && f.length > 0 && (f[0].originalIndex === 0 && h[0].originalIndex === 0 || (M = L - C, M !== 0 && (M += z))), [M, f, S, L];
          },
          [0, [], 0, 0]
        ),
        W(([h]) => h !== 0),
        D(n, s, o, r, I, H),
        W(([, h, d, C, , , R]) => !R && !C && h !== 0 && d === ot),
        b(([[h], , , , , d]) => (d("Upward scrolling compensation", { amount: h }, ue.DEBUG), h))
      )
    );
    function v(h) {
      h > 0 ? (V(t, { behavior: "auto", top: -h }), V(e, 0)) : (V(e, 0), V(t, { behavior: "auto", top: -h }));
    }
    return q(p(y, D(e, i)), ([h, d, C]) => {
      C && Nn() ? V(e, d - h) : v(-h);
    }), q(
      p(
        te(le(i, !1), e, H),
        W(([h, d, C]) => !h && !C && d !== 0),
        b(([h, d]) => d),
        be(1)
      ),
      v
    ), k(
      p(
        T,
        b((h) => ({ top: -h }))
      ),
      t
    ), q(
      p(
        a,
        D(g, m),
        b(([h, { groupIndices: d, lastSize: C, sizeTree: R }, f]) => {
          function u(S) {
            return S * (C + f);
          }
          if (d.length === 0)
            return u(h);
          {
            let S = 0;
            const z = Qe(R, 0);
            let L = 0, M = 0;
            for (; L < h; ) {
              L++, S += z;
              let P = d.length === M + 1 ? 1 / 0 : d[M + 1] - d[M] - 1;
              L + P > h && (S -= z, P = h - L + 1), L += P, S += u(P), M++;
            }
            return S;
          }
        })
      ),
      (h) => {
        V(e, h), requestAnimationFrame(() => {
          V(t, { top: h }), requestAnimationFrame(() => {
            V(e, 0), V(H, !1);
          });
        });
      }
    ), { deviation: e };
  },
  X(ce, it, De, He, ke, Vt)
), Un = _(
  ([
    e,
    t,
    o,
    n,
    r,
    i,
    l,
    s,
    c,
    a,
    m
  ]) => ({
    ...e,
    ...t,
    ...o,
    ...n,
    ...r,
    ...i,
    ...l,
    ...s,
    ...c,
    ...a,
    ...m
  }),
  X(
    Nt,
    An,
    Le,
    Do,
    Po,
    Vn,
    Mn,
    _t,
    Vo,
    ke,
    Ao
  )
), Go = _(
  ([
    {
      data: e,
      defaultItemSize: t,
      firstItemIndex: o,
      fixedItemSize: n,
      gap: r,
      groupIndices: i,
      itemSize: l,
      sizeRanges: s,
      sizes: c,
      statefulTotalCount: a,
      totalCount: m,
      trackItemSizes: T
    },
    { initialItemFinalLocationReached: g, initialTopMostItemIndex: I, scrolledToInitialItem: H },
    y,
    v,
    h,
    { listState: d, topItemsIndexes: C, ...R },
    { scrollToIndex: f },
    u,
    { topItemCount: S },
    { groupCounts: z },
    L
  ]) => (k(R.rangeChanged, L.scrollSeekRangeChanged), k(
    p(
      L.windowViewportRect,
      b((M) => M.visibleHeight)
    ),
    y.viewportHeight
  ), {
    data: e,
    defaultItemHeight: t,
    firstItemIndex: o,
    fixedItemHeight: n,
    gap: r,
    groupCounts: z,
    initialItemFinalLocationReached: g,
    initialTopMostItemIndex: I,
    scrolledToInitialItem: H,
    sizeRanges: s,
    topItemCount: S,
    topItemsIndexes: C,
    // input
    totalCount: m,
    ...h,
    groupIndices: i,
    itemSize: l,
    listState: d,
    scrollToIndex: f,
    // output
    statefulTotalCount: a,
    trackItemSizes: T,
    // exported from stateFlagsSystem
    ...R,
    // the bag of IO from featureGroup1System
    ...L,
    ...y,
    sizes: c,
    ...v
  }),
  X(
    He,
    rt,
    ce,
    Dn,
    Pn,
    De,
    nt,
    _n,
    Gn,
    Lo,
    Un
  )
);
function jn(e, t) {
  const o = {}, n = {};
  let r = 0;
  const i = e.length;
  for (; r < i; )
    n[e[r]] = 1, r += 1;
  for (const l in t)
    Object.hasOwn(n, l) || (o[l] = t[l]);
  return o;
}
const at = typeof document < "u" ? B.useLayoutEffect : B.useEffect;
function No(e, t, o) {
  const n = Object.keys(t.required || {}), r = Object.keys(t.optional || {}), i = Object.keys(t.methods || {}), l = Object.keys(t.events || {}), s = B.createContext({});
  function c(v, h) {
    v.propsReady && V(v.propsReady, !1);
    for (const d of n) {
      const C = v[t.required[d]];
      V(C, h[d]);
    }
    for (const d of r)
      if (d in h) {
        const C = v[t.optional[d]];
        V(C, h[d]);
      }
    v.propsReady && V(v.propsReady, !0);
  }
  function a(v) {
    return i.reduce((h, d) => (h[d] = (C) => {
      const R = v[t.methods[d]];
      V(R, C);
    }, h), {});
  }
  function m(v) {
    return l.reduce((h, d) => (h[d] = sn(v[t.events[d]]), h), {});
  }
  const T = B.forwardRef((v, h) => {
    const { children: d, ...C } = v, [R] = B.useState(() => Tt(an(e), (S) => {
      c(S, C);
    })), [f] = B.useState(eo(m, R));
    at(() => {
      for (const S of l)
        S in C && q(f[S], C[S]);
      return () => {
        Object.values(f).map(Pt);
      };
    }, [C, f, R]), at(() => {
      c(R, C);
    }), B.useImperativeHandle(h, Qt(a(R)));
    const u = o;
    return /* @__PURE__ */ U(s.Provider, { value: R, children: o ? /* @__PURE__ */ U(u, { ...jn([...n, ...r, ...l], C), children: d }) : d });
  }), g = (v) => {
    const h = B.useContext(s);
    return B.useCallback(
      (d) => {
        V(h[v], d);
      },
      [h, v]
    );
  }, I = (v) => {
    const h = B.useContext(s)[v], d = B.useCallback(
      (C) => q(h, C),
      [h]
    );
    return B.useSyncExternalStore(
      d,
      () => ee(h),
      () => ee(h)
    );
  }, H = (v) => {
    const h = B.useContext(s)[v], [d, C] = B.useState(eo(ee, h));
    return at(
      () => q(h, (R) => {
        R !== d && C(Qt(R));
      }),
      [h, d]
    ), d;
  }, y = B.version.startsWith("18") ? I : H;
  return {
    Component: T,
    useEmitter: (v, h) => {
      const d = B.useContext(s)[v];
      at(() => q(d, h), [h, d]);
    },
    useEmitterValue: y,
    usePublisher: g
  };
}
const _o = B.createContext(void 0), Uo = B.createContext(void 0), jo = typeof document < "u" ? B.useLayoutEffect : B.useEffect;
function bt(e) {
  return "self" in e;
}
function qn(e) {
  return "body" in e;
}
function qo(e, t, o, n = je, r, i) {
  const l = B.useRef(null), s = B.useRef(null), c = B.useRef(null), a = B.useCallback(
    (g) => {
      let I, H, y;
      const v = g.target;
      if (qn(v) || bt(v)) {
        const d = bt(v) ? v : v.defaultView;
        y = i ? d.scrollX : d.scrollY, I = i ? d.document.documentElement.scrollWidth : d.document.documentElement.scrollHeight, H = i ? d.innerWidth : d.innerHeight;
      } else
        y = i ? v.scrollLeft : v.scrollTop, I = i ? v.scrollWidth : v.scrollHeight, H = i ? v.offsetWidth : v.offsetHeight;
      const h = () => {
        e({
          scrollHeight: I,
          scrollTop: Math.max(y, 0),
          viewportHeight: H
        });
      };
      g.suppressFlushSync ? h() : en.flushSync(h), s.current !== null && (y === s.current || y <= 0 || y === I - H) && (s.current = null, t(!0), c.current && (clearTimeout(c.current), c.current = null));
    },
    [e, t, i]
  );
  B.useEffect(() => {
    const g = r || l.current;
    return n(r || l.current), a({ suppressFlushSync: !0, target: g }), g.addEventListener("scroll", a, { passive: !0 }), () => {
      n(null), g.removeEventListener("scroll", a);
    };
  }, [l, a, o, n, r]);
  function m(g) {
    const I = l.current;
    if (!I || (i ? "offsetWidth" in I && I.offsetWidth === 0 : "offsetHeight" in I && I.offsetHeight === 0))
      return;
    const H = g.behavior === "smooth";
    let y, v, h;
    bt(I) ? (v = Math.max(
      Be(I.document.documentElement, i ? "width" : "height"),
      i ? I.document.documentElement.scrollWidth : I.document.documentElement.scrollHeight
    ), y = i ? I.innerWidth : I.innerHeight, h = i ? window.scrollX : window.scrollY) : (v = I[i ? "scrollWidth" : "scrollHeight"], y = Be(I, i ? "width" : "height"), h = I[i ? "scrollLeft" : "scrollTop"]);
    const d = v - y;
    if (g.top = Math.ceil(Math.max(Math.min(d, g.top), 0)), Oo(y, v) || g.top === h) {
      e({ scrollHeight: v, scrollTop: h, viewportHeight: y }), H && t(!0);
      return;
    }
    H ? (s.current = g.top, c.current && clearTimeout(c.current), c.current = setTimeout(() => {
      c.current = null, s.current = null, t(!0);
    }, 1e3)) : s.current = null, i && (g = { behavior: g.behavior, left: g.top }), I.scrollTo(g);
  }
  function T(g) {
    i && (g = { behavior: g.behavior, left: g.top }), l.current.scrollBy(g);
  }
  return { scrollByCallback: T, scrollerRef: l, scrollToCallback: m };
}
const zt = "-webkit-sticky", uo = "sticky", Ut = Fo(() => {
  if (typeof document > "u")
    return uo;
  const e = document.createElement("div");
  return e.style.position = zt, e.style.position === zt ? zt : uo;
});
function jt(e) {
  return e;
}
const Kn = /* @__PURE__ */ _(() => {
  const e = x((s) => `Item ${s}`), t = x((s) => `Group ${s}`), o = x({}), n = x(jt), r = x("div"), i = x(je), l = (s, c = null) => le(
    p(
      o,
      b((a) => a[s]),
      $()
    ),
    c
  );
  return {
    components: o,
    computeItemKey: n,
    EmptyPlaceholder: l("EmptyPlaceholder"),
    FooterComponent: l("Footer"),
    GroupComponent: l("Group", "div"),
    groupContent: t,
    HeaderComponent: l("Header"),
    HeaderFooterTag: r,
    ItemComponent: l("Item", "div"),
    itemContent: e,
    ListComponent: l("List", "div"),
    ScrollerComponent: l("Scroller", "div"),
    scrollerRef: i,
    ScrollSeekPlaceholder: l("ScrollSeekPlaceholder"),
    TopItemListComponent: l("TopItemList")
  };
}), Yn = /* @__PURE__ */ _(
  ([e, t]) => ({ ...e, ...t }),
  X(Go, Kn)
), $n = ({ height: e }) => /* @__PURE__ */ U("div", { style: { height: e } }), Xn = { overflowAnchor: "none", position: Ut(), zIndex: 1 }, Ko = { overflowAnchor: "none" }, Zn = { ...Ko, display: "inline-block", height: "100%" }, fo = /* @__PURE__ */ B.memo(function({ showTopList: e = !1 }) {
  const t = A("listState"), o = me("sizeRanges"), n = A("useWindowScroll"), r = A("customScrollParent"), i = me("windowScrollContainerState"), l = me("scrollContainerState"), s = r || n ? i : l, c = A("itemContent"), a = A("context"), m = A("groupContent"), T = A("trackItemSizes"), g = A("itemSize"), I = A("log"), H = me("gap"), y = A("horizontalDirection"), { callbackRef: v } = fn(
    o,
    g,
    T,
    e ? je : s,
    I,
    H,
    r,
    y,
    A("skipAnimationFrameInResizeObserver")
  ), [h, d] = B.useState(0);
  qt("deviation", (E) => {
    h !== E && d(E);
  });
  const C = A("EmptyPlaceholder"), R = A("ScrollSeekPlaceholder") || $n, f = A("ListComponent"), u = A("ItemComponent"), S = A("GroupComponent"), z = A("computeItemKey"), L = A("isSeeking"), M = A("groupIndices").length > 0, P = A("alignToBottom"), N = A("initialItemFinalLocationReached"), Y = e ? {} : {
    boxSizing: "border-box",
    ...y ? {
      display: "inline-block",
      height: "100%",
      marginLeft: h !== 0 ? h : P ? "auto" : 0,
      paddingLeft: t.offsetTop,
      paddingRight: t.offsetBottom,
      whiteSpace: "nowrap"
    } : {
      marginTop: h !== 0 ? h : P ? "auto" : 0,
      paddingBottom: t.offsetBottom,
      paddingTop: t.offsetTop
    },
    ...N ? {} : { visibility: "hidden" }
  };
  return !e && t.totalCount === 0 && C ? /* @__PURE__ */ U(C, { ...ie(C, a) }) : /* @__PURE__ */ U(
    f,
    {
      ...ie(f, a),
      "data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list",
      ref: v,
      style: Y,
      children: (e ? t.topItems : t.items).map((E) => {
        const j = E.originalIndex, ne = z(j + t.firstItemIndex, E.data, a);
        return L ? /* @__PURE__ */ dt(
          R,
          {
            ...ie(R, a),
            height: E.size,
            index: E.index,
            key: ne,
            type: E.type || "item",
            ...E.type === "group" ? {} : { groupIndex: E.groupIndex }
          }
        ) : E.type === "group" ? /* @__PURE__ */ dt(
          S,
          {
            ...ie(S, a),
            "data-index": j,
            "data-item-index": E.index,
            "data-known-size": E.size,
            key: ne,
            style: Xn
          },
          m(E.index, a)
        ) : /* @__PURE__ */ dt(
          u,
          {
            ...ie(u, a),
            ...tr(u, E.data),
            "data-index": j,
            "data-item-group-index": E.groupIndex,
            "data-item-index": E.index,
            "data-known-size": E.size,
            key: ne,
            style: y ? Zn : Ko
          },
          M ? c(E.index, E.groupIndex, E.data, a) : c(E.index, E.data, a)
        );
      })
    }
  );
}), Jn = {
  height: "100%",
  outline: "none",
  overflowY: "auto",
  position: "relative",
  WebkitOverflowScrolling: "touch"
}, Qn = {
  outline: "none",
  overflowX: "auto",
  position: "relative"
}, wt = (e) => ({
  height: "100%",
  position: "absolute",
  top: 0,
  width: "100%",
  ...e ? { display: "flex", flexDirection: "column" } : {}
}), er = {
  position: Ut(),
  top: 0,
  width: "100%",
  zIndex: 1
};
function ie(e, t) {
  if (typeof e != "string")
    return { context: t };
}
function tr(e, t) {
  return { item: typeof e == "string" ? void 0 : t };
}
const or = /* @__PURE__ */ B.memo(function() {
  const e = A("HeaderComponent"), t = me("headerHeight"), o = A("HeaderFooterTag"), n = Ve(
    B.useMemo(
      () => (i) => {
        t(Be(i, "height"));
      },
      [t]
    ),
    !0,
    A("skipAnimationFrameInResizeObserver")
  ), r = A("context");
  return e ? /* @__PURE__ */ U(o, { ref: n, children: /* @__PURE__ */ U(e, { ...ie(e, r) }) }) : null;
}), nr = /* @__PURE__ */ B.memo(function() {
  const e = A("FooterComponent"), t = me("footerHeight"), o = A("HeaderFooterTag"), n = Ve(
    B.useMemo(
      () => (i) => {
        t(Be(i, "height"));
      },
      [t]
    ),
    !0,
    A("skipAnimationFrameInResizeObserver")
  ), r = A("context");
  return e ? /* @__PURE__ */ U(o, { ref: n, children: /* @__PURE__ */ U(e, { ...ie(e, r) }) }) : null;
});
function Yo({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
  return B.memo(function({ children: n, style: r, ...i }) {
    const l = o("scrollContainerState"), s = t("ScrollerComponent"), c = o("smoothScrollTargetReached"), a = t("scrollerRef"), m = t("context"), T = t("horizontalDirection") || !1, { scrollByCallback: g, scrollerRef: I, scrollToCallback: H } = qo(
      l,
      c,
      s,
      a,
      void 0,
      T
    );
    return e("scrollTo", H), e("scrollBy", g), /* @__PURE__ */ U(
      s,
      {
        "data-testid": "virtuoso-scroller",
        "data-virtuoso-scroller": !0,
        ref: I,
        style: { ...T ? Qn : Jn, ...r },
        tabIndex: 0,
        ...i,
        ...ie(s, m),
        children: n
      }
    );
  });
}
function $o({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
  return B.memo(function({ children: n, style: r, ...i }) {
    const l = o("windowScrollContainerState"), s = t("ScrollerComponent"), c = o("smoothScrollTargetReached"), a = t("totalListHeight"), m = t("deviation"), T = t("customScrollParent"), g = t("context"), I = B.useRef(null), H = t("scrollerRef"), { scrollByCallback: y, scrollerRef: v, scrollToCallback: h } = qo(
      l,
      c,
      s,
      H,
      T
    );
    return jo(() => {
      var d;
      return v.current = T || ((d = I.current) == null ? void 0 : d.ownerDocument.defaultView), () => {
        v.current = null;
      };
    }, [v, T]), e("windowScrollTo", h), e("scrollBy", y), /* @__PURE__ */ U(
      s,
      {
        ref: I,
        "data-virtuoso-scroller": !0,
        style: { position: "relative", ...r, ...a !== 0 ? { height: a + m } : {} },
        ...i,
        ...ie(s, g),
        children: n
      }
    );
  });
}
const rr = ({ children: e }) => {
  const t = B.useContext(_o), o = me("viewportHeight"), n = me("fixedItemHeight"), r = A("alignToBottom"), i = A("horizontalDirection"), l = B.useMemo(
    () => xo(o, (c) => Be(c, i ? "width" : "height")),
    [o, i]
  ), s = Ve(l, !0, A("skipAnimationFrameInResizeObserver"));
  return B.useEffect(() => {
    t && (o(t.viewportHeight), n(t.itemHeight));
  }, [t, o, n]), /* @__PURE__ */ U("div", { "data-viewport-type": "element", ref: s, style: wt(r), children: e });
}, ir = ({ children: e }) => {
  const t = B.useContext(_o), o = me("windowViewportRect"), n = me("fixedItemHeight"), r = A("customScrollParent"), i = wo(
    o,
    r,
    A("skipAnimationFrameInResizeObserver")
  ), l = A("alignToBottom");
  return B.useEffect(() => {
    t && (n(t.itemHeight), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
  }, [t, o, n]), /* @__PURE__ */ U("div", { "data-viewport-type": "window", ref: i, style: wt(l), children: e });
}, lr = ({ children: e }) => {
  const t = A("TopItemListComponent") || "div", o = A("headerHeight"), n = { ...er, marginTop: `${o}px` }, r = A("context");
  return /* @__PURE__ */ U(t, { style: n, ...ie(t, r), children: e });
}, sr = /* @__PURE__ */ B.memo(function(e) {
  const t = A("useWindowScroll"), o = A("topItemsIndexes").length > 0, n = A("customScrollParent"), r = A("context"), i = n || t ? ur : ar, l = n || t ? ir : rr;
  return /* @__PURE__ */ Ze(i, { ...e, ...ie(i, r), children: [
    o && /* @__PURE__ */ U(lr, { children: /* @__PURE__ */ U(fo, { showTopList: !0 }) }),
    /* @__PURE__ */ Ze(l, { children: [
      /* @__PURE__ */ U(or, {}),
      /* @__PURE__ */ U(fo, {}),
      /* @__PURE__ */ U(nr, {})
    ] })
  ] });
}), {
  Component: cr,
  useEmitter: qt,
  useEmitterValue: A,
  usePublisher: me
} = /* @__PURE__ */ No(
  Yn,
  {
    required: {},
    optional: {
      restoreStateFrom: "restoreStateFrom",
      context: "context",
      followOutput: "followOutput",
      scrollIntoViewOnChange: "scrollIntoViewOnChange",
      itemContent: "itemContent",
      groupContent: "groupContent",
      overscan: "overscan",
      increaseViewportBy: "increaseViewportBy",
      totalCount: "totalCount",
      groupCounts: "groupCounts",
      topItemCount: "topItemCount",
      firstItemIndex: "firstItemIndex",
      initialTopMostItemIndex: "initialTopMostItemIndex",
      components: "components",
      atBottomThreshold: "atBottomThreshold",
      atTopThreshold: "atTopThreshold",
      computeItemKey: "computeItemKey",
      defaultItemHeight: "defaultItemHeight",
      fixedItemHeight: "fixedItemHeight",
      itemSize: "itemSize",
      scrollSeekConfiguration: "scrollSeekConfiguration",
      headerFooterTag: "HeaderFooterTag",
      data: "data",
      initialItemCount: "initialItemCount",
      initialScrollTop: "initialScrollTop",
      alignToBottom: "alignToBottom",
      useWindowScroll: "useWindowScroll",
      customScrollParent: "customScrollParent",
      scrollerRef: "scrollerRef",
      logLevel: "logLevel",
      horizontalDirection: "horizontalDirection",
      skipAnimationFrameInResizeObserver: "skipAnimationFrameInResizeObserver"
    },
    methods: {
      scrollToIndex: "scrollToIndex",
      scrollIntoView: "scrollIntoView",
      scrollTo: "scrollTo",
      scrollBy: "scrollBy",
      autoscrollToBottom: "autoscrollToBottom",
      getState: "getState"
    },
    events: {
      isScrolling: "isScrolling",
      endReached: "endReached",
      startReached: "startReached",
      rangeChanged: "rangeChanged",
      atBottomStateChange: "atBottomStateChange",
      atTopStateChange: "atTopStateChange",
      totalListHeightChanged: "totalListHeightChanged",
      itemsRendered: "itemsRendered",
      groupIndices: "groupIndices"
    }
  },
  sr
), ar = /* @__PURE__ */ Yo({ useEmitter: qt, useEmitterValue: A, usePublisher: me }), ur = /* @__PURE__ */ $o({ useEmitter: qt, useEmitterValue: A, usePublisher: me }), Br = cr, dr = /* @__PURE__ */ _(() => {
  const e = x((a) => /* @__PURE__ */ Ze("td", { children: [
    "Item $",
    a
  ] })), t = x(null), o = x((a) => /* @__PURE__ */ Ze("td", { colSpan: 1e3, children: [
    "Group ",
    a
  ] })), n = x(null), r = x(null), i = x({}), l = x(jt), s = x(je), c = (a, m = null) => le(
    p(
      i,
      b((T) => T[a]),
      $()
    ),
    m
  );
  return {
    components: i,
    computeItemKey: l,
    context: t,
    EmptyPlaceholder: c("EmptyPlaceholder"),
    FillerRow: c("FillerRow"),
    fixedFooterContent: r,
    fixedHeaderContent: n,
    itemContent: e,
    groupContent: o,
    ScrollerComponent: c("Scroller", "div"),
    scrollerRef: s,
    ScrollSeekPlaceholder: c("ScrollSeekPlaceholder"),
    TableBodyComponent: c("TableBody", "tbody"),
    TableComponent: c("Table", "table"),
    TableFooterComponent: c("TableFoot", "tfoot"),
    TableHeadComponent: c("TableHead", "thead"),
    TableRowComponent: c("TableRow", "tr"),
    GroupComponent: c("Group", "tr")
  };
});
X(Go, dr);
Ut();
const ho = {
  bottom: 0,
  itemHeight: 0,
  items: [],
  itemWidth: 0,
  offsetBottom: 0,
  offsetTop: 0,
  top: 0
}, fr = {
  bottom: 0,
  itemHeight: 0,
  items: [{ index: 0 }],
  itemWidth: 0,
  offsetBottom: 0,
  offsetTop: 0,
  top: 0
}, { ceil: mo, floor: vt, max: Xe, min: Rt, round: go } = Math;
function po(e, t, o) {
  return Array.from({ length: t - e + 1 }).map((n, r) => ({ data: o === null ? null : o[r + e], index: r + e }));
}
function hr(e) {
  return {
    ...fr,
    items: e
  };
}
function ut(e, t) {
  return e && e.width === t.width && e.height === t.height;
}
function mr(e, t) {
  return e && e.column === t.column && e.row === t.row;
}
const gr = /* @__PURE__ */ _(
  ([
    { increaseViewportBy: e, listBoundary: t, overscan: o, visibleRange: n },
    { footerHeight: r, headerHeight: i, scrollBy: l, scrollContainerState: s, scrollTo: c, scrollTop: a, smoothScrollTargetReached: m, viewportHeight: T },
    g,
    I,
    { didMount: H, propsReady: y },
    { customScrollParent: v, useWindowScroll: h, windowScrollContainerState: d, windowScrollTo: C, windowViewportRect: R },
    f
  ]) => {
    const u = x(0), S = x(0), z = x(ho), L = x({ height: 0, width: 0 }), M = x({ height: 0, width: 0 }), P = G(), N = G(), Y = x(0), E = x(null), j = x({ column: 0, row: 0 }), ne = G(), he = G(), pe = x(!1), ve = x(0), ae = x(!0), se = x(!1), Me = x(!1);
    q(
      p(
        H,
        D(ve),
        W(([w, F]) => !!F)
      ),
      () => {
        V(ae, !1);
      }
    ), q(
      p(
        te(H, ae, M, L, ve, se),
        W(([w, F, Z, re, , Q]) => w && !F && Z.height !== 0 && re.height !== 0 && !Q)
      ),
      ([, , , , w]) => {
        V(se, !0), Ft(1, () => {
          V(P, w);
        }), Te(p(a), () => {
          V(t, [0, 0]), V(ae, !0);
        });
      }
    ), k(
      p(
        he,
        W((w) => w != null && w.scrollTop > 0),
        we(0)
      ),
      S
    ), q(
      p(
        H,
        D(he),
        W(([, w]) => w != null)
      ),
      ([, w]) => {
        w && (V(L, w.viewport), V(M, w.item), V(j, w.gap), w.scrollTop > 0 && (V(pe, !0), Te(p(a, Ae(1)), (F) => {
          V(pe, !1);
        }), V(c, { top: w.scrollTop })));
      }
    ), k(
      p(
        L,
        b(({ height: w }) => w)
      ),
      T
    ), k(
      p(
        te(
          O(L, ut),
          O(M, ut),
          O(j, (w, F) => w && w.column === F.column && w.row === F.row),
          O(a)
        ),
        b(([w, F, Z, re]) => ({
          gap: Z,
          item: F,
          scrollTop: re,
          viewport: w
        }))
      ),
      ne
    ), k(
      p(
        te(
          O(u),
          n,
          O(j, mr),
          O(M, ut),
          O(L, ut),
          O(E),
          O(S),
          O(pe),
          O(ae),
          O(ve)
        ),
        W(([, , , , , , , w]) => !w),
        b(
          ([
            w,
            [F, Z],
            re,
            Q,
            Oe,
            Ke,
            Ge,
            ,
            lt,
            ze
          ]) => {
            const { column: Re, row: Ye } = re, { height: st, width: Ct } = Q, { width: Kt } = Oe;
            if (Ge === 0 && (w === 0 || Kt === 0))
              return ho;
            if (Ct === 0) {
              const Jt = Gt(ze, w), Qo = Jt + Math.max(Ge - 1, 0);
              return hr(po(Jt, Qo, Ke));
            }
            const ct = Xo(Kt, Ct, Re);
            let Ne, We;
            lt ? F === 0 && Z === 0 && Ge > 0 ? (Ne = 0, We = Ge - 1) : (Ne = ct * vt((F + Ye) / (st + Ye)), We = ct * mo((Z + Ye) / (st + Ye)) - 1, We = Rt(w - 1, Xe(We, ct - 1)), Ne = Rt(We, Xe(0, Ne))) : (Ne = 0, We = -1);
            const Yt = po(Ne, We, Ke), { bottom: $t, top: Xt } = vo(Oe, re, Q, Yt), Zt = mo(w / ct), Jo = Zt * st + (Zt - 1) * Ye - $t;
            return { bottom: $t, itemHeight: st, items: Yt, itemWidth: Ct, offsetBottom: Jo, offsetTop: Xt, top: Xt };
          }
        )
      ),
      z
    ), k(
      p(
        E,
        W((w) => w !== null),
        b((w) => w.length)
      ),
      u
    ), k(
      p(
        te(L, M, z, j),
        W(([w, F, { items: Z }]) => Z.length > 0 && F.height !== 0 && w.height !== 0),
        b(([w, F, { items: Z }, re]) => {
          const { bottom: Q, top: Oe } = vo(w, re, F, Z);
          return [Oe, Q];
        }),
        $(et)
      ),
      t
    );
    const Ie = x(!1);
    k(
      p(
        a,
        D(Ie),
        b(([w, F]) => F || w !== 0)
      ),
      Ie
    );
    const qe = fe(
      p(
        te(z, u),
        W(([{ items: w }]) => w.length > 0),
        D(Ie),
        W(([[w, F], Z]) => {
          const re = w.items[w.items.length - 1].index === F - 1;
          return (Z || w.bottom > 0 && w.itemHeight > 0 && w.offsetBottom === 0 && w.items.length === F) && re;
        }),
        b(([[, w]]) => w - 1),
        $()
      )
    ), Fe = fe(
      p(
        O(z),
        W(({ items: w }) => w.length > 0 && w[0].index === 0),
        we(0),
        $()
      )
    ), Se = fe(
      p(
        O(z),
        D(pe),
        W(([{ items: w }, F]) => w.length > 0 && !F),
        b(([{ items: w }]) => ({
          endIndex: w[w.length - 1].index,
          startIndex: w[0].index
        })),
        $(Ro),
        be(0)
      )
    );
    k(Se, I.scrollSeekRangeChanged), k(
      p(
        P,
        D(L, M, u, j),
        b(([w, F, Z, re, Q]) => {
          const Oe = Mo(w), { align: Ke, behavior: Ge, offset: lt } = Oe;
          let ze = Oe.index;
          ze === "LAST" && (ze = re - 1), ze = Xe(0, ze, Rt(re - 1, ze));
          let Re = Ot(F, Q, Z, ze);
          return Ke === "end" ? Re = go(Re - F.height + Z.height) : Ke === "center" && (Re = go(Re - F.height / 2 + Z.height / 2)), lt && (Re += lt), { behavior: Ge, top: Re };
        })
      ),
      c
    );
    const ye = le(
      p(
        z,
        b((w) => w.offsetBottom + w.bottom)
      ),
      0
    );
    return k(
      p(
        R,
        b((w) => ({ height: w.visibleHeight, width: w.visibleWidth }))
      ),
      L
    ), {
      customScrollParent: v,
      // input
      data: E,
      deviation: Y,
      footerHeight: r,
      gap: j,
      headerHeight: i,
      increaseViewportBy: e,
      initialItemCount: S,
      itemDimensions: M,
      overscan: o,
      restoreStateFrom: he,
      scrollBy: l,
      scrollContainerState: s,
      scrollHeight: N,
      scrollTo: c,
      scrollToIndex: P,
      scrollTop: a,
      smoothScrollTargetReached: m,
      totalCount: u,
      useWindowScroll: h,
      viewportDimensions: L,
      windowScrollContainerState: d,
      windowScrollTo: C,
      windowViewportRect: R,
      ...I,
      // output
      gridState: z,
      horizontalDirection: Me,
      initialTopMostItemIndex: ve,
      totalListHeight: ye,
      ...g,
      endReached: qe,
      propsReady: y,
      rangeChanged: Se,
      startReached: Fe,
      stateChanged: ne,
      stateRestoreInProgress: pe,
      ...f
    };
  },
  X(Nt, ce, it, Do, Le, _t, ke)
);
function Xo(e, t, o) {
  return Xe(1, vt((e + o) / (vt(t) + o)));
}
function vo(e, t, o, n) {
  const { height: r } = o;
  if (r === void 0 || n.length === 0)
    return { bottom: 0, top: 0 };
  const i = Ot(e, t, o, n[0].index);
  return { bottom: Ot(e, t, o, n[n.length - 1].index) + r, top: i };
}
function Ot(e, t, o, n) {
  const r = Xo(e.width, o.width, t.column), i = vt(n / r), l = i * o.height + Xe(0, i - 1) * t.row;
  return l > 0 ? l + t.row : l;
}
const pr = /* @__PURE__ */ _(() => {
  const e = x((T) => `Item ${T}`), t = x({}), o = x(null), n = x("virtuoso-grid-item"), r = x("virtuoso-grid-list"), i = x(jt), l = x("div"), s = x(je), c = (T, g = null) => le(
    p(
      t,
      b((I) => I[T]),
      $()
    ),
    g
  ), a = x(!1), m = x(!1);
  return k(O(m), a), {
    components: t,
    computeItemKey: i,
    context: o,
    FooterComponent: c("Footer"),
    HeaderComponent: c("Header"),
    headerFooterTag: l,
    itemClassName: n,
    ItemComponent: c("Item", "div"),
    itemContent: e,
    listClassName: r,
    ListComponent: c("List", "div"),
    readyStateChanged: a,
    reportReadyState: m,
    ScrollerComponent: c("Scroller", "div"),
    scrollerRef: s,
    ScrollSeekPlaceholder: c("ScrollSeekPlaceholder", "div")
  };
}), vr = /* @__PURE__ */ _(
  ([e, t]) => ({ ...e, ...t }),
  X(gr, pr)
), Ir = /* @__PURE__ */ B.memo(function() {
  const e = J("gridState"), t = J("listClassName"), o = J("itemClassName"), n = J("itemContent"), r = J("computeItemKey"), i = J("isSeeking"), l = ge("scrollHeight"), s = J("ItemComponent"), c = J("ListComponent"), a = J("ScrollSeekPlaceholder"), m = J("context"), T = ge("itemDimensions"), g = ge("gap"), I = J("log"), H = J("stateRestoreInProgress"), y = ge("reportReadyState"), v = Ve(
    B.useMemo(
      () => (h) => {
        const d = h.parentElement.parentElement.scrollHeight;
        l(d);
        const C = h.firstChild;
        if (C) {
          const { height: R, width: f } = C.getBoundingClientRect();
          T({ height: R, width: f });
        }
        g({
          column: Io("column-gap", getComputedStyle(h).columnGap, I),
          row: Io("row-gap", getComputedStyle(h).rowGap, I)
        });
      },
      [l, T, g, I]
    ),
    !0,
    !1
  );
  return jo(() => {
    e.itemHeight > 0 && e.itemWidth > 0 && y(!0);
  }, [e]), H ? null : /* @__PURE__ */ U(
    c,
    {
      className: t,
      ref: v,
      ...ie(c, m),
      "data-testid": "virtuoso-item-list",
      style: { paddingBottom: e.offsetBottom, paddingTop: e.offsetTop },
      children: e.items.map((h) => {
        const d = r(h.index, h.data, m);
        return i ? /* @__PURE__ */ U(
          a,
          {
            ...ie(a, m),
            height: e.itemHeight,
            index: h.index,
            width: e.itemWidth
          },
          d
        ) : /* @__PURE__ */ dt(
          s,
          {
            ...ie(s, m),
            className: o,
            "data-index": h.index,
            key: d
          },
          n(h.index, h.data, m)
        );
      })
    }
  );
}), Tr = B.memo(function() {
  const e = J("HeaderComponent"), t = ge("headerHeight"), o = J("headerFooterTag"), n = Ve(
    B.useMemo(
      () => (i) => {
        t(Be(i, "height"));
      },
      [t]
    ),
    !0,
    !1
  ), r = J("context");
  return e ? /* @__PURE__ */ U(o, { ref: n, children: /* @__PURE__ */ U(e, { ...ie(e, r) }) }) : null;
}), xr = B.memo(function() {
  const e = J("FooterComponent"), t = ge("footerHeight"), o = J("headerFooterTag"), n = Ve(
    B.useMemo(
      () => (i) => {
        t(Be(i, "height"));
      },
      [t]
    ),
    !0,
    !1
  ), r = J("context");
  return e ? /* @__PURE__ */ U(o, { ref: n, children: /* @__PURE__ */ U(e, { ...ie(e, r) }) }) : null;
}), Sr = ({ children: e }) => {
  const t = B.useContext(Uo), o = ge("itemDimensions"), n = ge("viewportDimensions"), r = Ve(
    B.useMemo(
      () => (i) => {
        n(i.getBoundingClientRect());
      },
      [n]
    ),
    !0,
    !1
  );
  return B.useEffect(() => {
    t && (n({ height: t.viewportHeight, width: t.viewportWidth }), o({ height: t.itemHeight, width: t.itemWidth }));
  }, [t, n, o]), /* @__PURE__ */ U("div", { ref: r, style: wt(!1), children: e });
}, wr = ({ children: e }) => {
  const t = B.useContext(Uo), o = ge("windowViewportRect"), n = ge("itemDimensions"), r = J("customScrollParent"), i = wo(o, r, !1);
  return B.useEffect(() => {
    t && (n({ height: t.itemHeight, width: t.itemWidth }), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
  }, [t, o, n]), /* @__PURE__ */ U("div", { ref: i, style: wt(!1), children: e });
}, Cr = /* @__PURE__ */ B.memo(function({ ...e }) {
  const t = J("useWindowScroll"), o = J("customScrollParent"), n = o || t ? yr : Hr, r = o || t ? wr : Sr, i = J("context");
  return /* @__PURE__ */ U(n, { ...e, ...ie(n, i), children: /* @__PURE__ */ Ze(r, { children: [
    /* @__PURE__ */ U(Tr, {}),
    /* @__PURE__ */ U(Ir, {}),
    /* @__PURE__ */ U(xr, {})
  ] }) });
}), {
  useEmitter: Zo,
  useEmitterValue: J,
  usePublisher: ge
} = /* @__PURE__ */ No(
  vr,
  {
    optional: {
      context: "context",
      totalCount: "totalCount",
      overscan: "overscan",
      itemContent: "itemContent",
      components: "components",
      computeItemKey: "computeItemKey",
      data: "data",
      initialItemCount: "initialItemCount",
      scrollSeekConfiguration: "scrollSeekConfiguration",
      headerFooterTag: "headerFooterTag",
      listClassName: "listClassName",
      itemClassName: "itemClassName",
      useWindowScroll: "useWindowScroll",
      customScrollParent: "customScrollParent",
      scrollerRef: "scrollerRef",
      logLevel: "logLevel",
      restoreStateFrom: "restoreStateFrom",
      initialTopMostItemIndex: "initialTopMostItemIndex",
      increaseViewportBy: "increaseViewportBy"
    },
    methods: {
      scrollTo: "scrollTo",
      scrollBy: "scrollBy",
      scrollToIndex: "scrollToIndex"
    },
    events: {
      isScrolling: "isScrolling",
      endReached: "endReached",
      startReached: "startReached",
      rangeChanged: "rangeChanged",
      atBottomStateChange: "atBottomStateChange",
      atTopStateChange: "atTopStateChange",
      stateChanged: "stateChanged",
      readyStateChanged: "readyStateChanged"
    }
  },
  Cr
), Hr = /* @__PURE__ */ Yo({ useEmitter: Zo, useEmitterValue: J, usePublisher: ge }), yr = /* @__PURE__ */ $o({ useEmitter: Zo, useEmitterValue: J, usePublisher: ge });
function Io(e, t, o) {
  return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, ue.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
}
export {
  ue as LogLevel,
  Br as Virtuoso,
  Uo as VirtuosoGridMockContext,
  _o as VirtuosoMockContext
};
//# sourceMappingURL=index.js.map
