import { j as E } from "./jsx-runtime-OVHDjVDe.js";
import { B as P } from "./Button-BFoGC4WW.js";
import { H as L, C as x } from "./css-D6ZBcSwh.js";
import { u as $, f as A, b as H, a as U } from "./Animated-M9ynNzcI.js";
import * as z from "react";
import { createContext as N, memo as V, useRef as O, useCallback as M, useMemo as C, useSyncExternalStore as q } from "react";
import { p as K, a as G } from "./Box-D5Qv__kr.js";
import { flushSync as X } from "react-dom";
import "./Text-BzTkWLeU.js";
import { c as Y } from "./Editable-CxgdRDPb.js";
import "./types-BNX_Jj6k.js";
import "./Provider--RxgAoVG.js";
function I(n, l, e) {
  let s = e.initialDeps ?? [], t;
  function i() {
    var o, r, c, h;
    let a;
    e.key && ((o = e.debug) != null && o.call(e)) && (a = Date.now());
    const m = n();
    if (!(m.length !== s.length || m.some((u, d) => s[d] !== u)))
      return t;
    s = m;
    let f;
    if (e.key && ((r = e.debug) != null && r.call(e)) && (f = Date.now()), t = l(...m), e.key && ((c = e.debug) != null && c.call(e))) {
      const u = Math.round((Date.now() - a) * 100) / 100, d = Math.round((Date.now() - f) * 100) / 100, b = d / 16, p = (v, S) => {
        for (v = String(v); v.length < S; )
          v = " " + v;
        return v;
      };
      console.info(
        `%c⏱ ${p(d, 5)} /${p(u, 5)} ms`,
        `
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(
          0,
          Math.min(120 - 120 * b, 120)
        )}deg 100% 31%);`,
        e?.key
      );
    }
    return (h = e?.onChange) == null || h.call(e, t), t;
  }
  return i.updateDeps = (o) => {
    s = o;
  }, i;
}
function y(n, l) {
  if (n === void 0)
    throw new Error("Unexpected undefined");
  return n;
}
const J = (n, l) => Math.abs(n - l) < 1, Q = (n, l, e) => {
  let s;
  return function(...t) {
    n.clearTimeout(s), s = n.setTimeout(() => l.apply(this, t), e);
  };
}, Z = (n) => n, ee = (n) => {
  const l = Math.max(n.startIndex - n.overscan, 0), e = Math.min(n.endIndex + n.overscan, n.count - 1), s = [];
  for (let t = l; t <= e; t++)
    s.push(t);
  return s;
}, te = (n, l) => {
  const e = n.scrollElement;
  if (!e)
    return;
  const s = n.targetWindow;
  if (!s)
    return;
  const t = (o) => {
    const { width: r, height: c } = o;
    l({ width: Math.round(r), height: Math.round(c) });
  };
  if (t(e.getBoundingClientRect()), !s.ResizeObserver)
    return () => {
    };
  const i = new s.ResizeObserver((o) => {
    const r = () => {
      const c = o[0];
      if (c?.borderBoxSize) {
        const h = c.borderBoxSize[0];
        if (h) {
          t({ width: h.inlineSize, height: h.blockSize });
          return;
        }
      }
      t(e.getBoundingClientRect());
    };
    n.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
  });
  return i.observe(e, { box: "border-box" }), () => {
    i.unobserve(e);
  };
}, D = {
  passive: !0
}, _ = typeof window > "u" ? !0 : "onscrollend" in window, se = (n, l) => {
  const e = n.scrollElement;
  if (!e)
    return;
  const s = n.targetWindow;
  if (!s)
    return;
  let t = 0;
  const i = n.options.useScrollendEvent && _ ? () => {
  } : Q(
    s,
    () => {
      l(t, !1);
    },
    n.options.isScrollingResetDelay
  ), o = (a) => () => {
    const { horizontal: m, isRtl: g } = n.options;
    t = m ? e.scrollLeft * (g && -1 || 1) : e.scrollTop, i(), l(t, a);
  }, r = o(!0), c = o(!1);
  c(), e.addEventListener("scroll", r, D);
  const h = n.options.useScrollendEvent && _;
  return h && e.addEventListener("scrollend", c, D), () => {
    e.removeEventListener("scroll", r), h && e.removeEventListener("scrollend", c);
  };
}, ne = (n, l, e) => {
  if (l?.borderBoxSize) {
    const s = l.borderBoxSize[0];
    if (s)
      return Math.round(
        s[e.options.horizontal ? "inlineSize" : "blockSize"]
      );
  }
  return Math.round(
    n.getBoundingClientRect()[e.options.horizontal ? "width" : "height"]
  );
}, ie = (n, {
  adjustments: l = 0,
  behavior: e
}, s) => {
  var t, i;
  const o = n + l;
  (i = (t = s.scrollElement) == null ? void 0 : t.scrollTo) == null || i.call(t, {
    [s.options.horizontal ? "left" : "top"]: o,
    behavior: e
  });
};
class oe {
  constructor(l) {
    this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
      let e = null;
      const s = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((t) => {
        t.forEach((i) => {
          const o = () => {
            this._measureElement(i.target, i);
          };
          this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(o) : o();
        });
      }));
      return {
        disconnect: () => {
          var t;
          (t = s()) == null || t.disconnect(), e = null;
        },
        observe: (t) => {
          var i;
          return (i = s()) == null ? void 0 : i.observe(t, { box: "border-box" });
        },
        unobserve: (t) => {
          var i;
          return (i = s()) == null ? void 0 : i.unobserve(t);
        }
      };
    })(), this.range = null, this.setOptions = (e) => {
      Object.entries(e).forEach(([s, t]) => {
        typeof t > "u" && delete e[s];
      }), this.options = {
        debug: !1,
        initialOffset: 0,
        overscan: 1,
        paddingStart: 0,
        paddingEnd: 0,
        scrollPaddingStart: 0,
        scrollPaddingEnd: 0,
        horizontal: !1,
        getItemKey: Z,
        rangeExtractor: ee,
        onChange: () => {
        },
        measureElement: ne,
        initialRect: { width: 0, height: 0 },
        scrollMargin: 0,
        gap: 0,
        indexAttribute: "data-index",
        initialMeasurementsCache: [],
        lanes: 1,
        isScrollingResetDelay: 150,
        enabled: !0,
        isRtl: !1,
        useScrollendEvent: !1,
        useAnimationFrameWithResizeObserver: !1,
        ...e
      };
    }, this.notify = (e) => {
      var s, t;
      (t = (s = this.options).onChange) == null || t.call(s, this, e);
    }, this.maybeNotify = I(
      () => (this.calculateRange(), [
        this.isScrolling,
        this.range ? this.range.startIndex : null,
        this.range ? this.range.endIndex : null
      ]),
      (e) => {
        this.notify(e);
      },
      {
        key: process.env.NODE_ENV !== "production" && "maybeNotify",
        debug: () => this.options.debug,
        initialDeps: [
          this.isScrolling,
          this.range ? this.range.startIndex : null,
          this.range ? this.range.endIndex : null
        ]
      }
    ), this.cleanup = () => {
      this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
    }, this._didMount = () => () => {
      this.cleanup();
    }, this._willUpdate = () => {
      var e;
      const s = this.options.enabled ? this.options.getScrollElement() : null;
      if (this.scrollElement !== s) {
        if (this.cleanup(), !s) {
          this.maybeNotify();
          return;
        }
        this.scrollElement = s, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((e = this.scrollElement) == null ? void 0 : e.window) ?? null, this.elementsCache.forEach((t) => {
          this.observer.observe(t);
        }), this._scrollToOffset(this.getScrollOffset(), {
          adjustments: void 0,
          behavior: void 0
        }), this.unsubs.push(
          this.options.observeElementRect(this, (t) => {
            this.scrollRect = t, this.maybeNotify();
          })
        ), this.unsubs.push(
          this.options.observeElementOffset(this, (t, i) => {
            this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < t ? "forward" : "backward" : null, this.scrollOffset = t, this.isScrolling = i, this.maybeNotify();
          })
        );
      }
    }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, s) => {
      const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
      for (let o = s - 1; o >= 0; o--) {
        const r = e[o];
        if (t.has(r.lane))
          continue;
        const c = i.get(
          r.lane
        );
        if (c == null || r.end > c.end ? i.set(r.lane, r) : r.end < c.end && t.set(r.lane, !0), t.size === this.options.lanes)
          break;
      }
      return i.size === this.options.lanes ? Array.from(i.values()).sort((o, r) => o.end === r.end ? o.index - r.index : o.end - r.end)[0] : void 0;
    }, this.getMeasurementOptions = I(
      () => [
        this.options.count,
        this.options.paddingStart,
        this.options.scrollMargin,
        this.options.getItemKey,
        this.options.enabled
      ],
      (e, s, t, i, o) => (this.pendingMeasuredCacheIndexes = [], {
        count: e,
        paddingStart: s,
        scrollMargin: t,
        getItemKey: i,
        enabled: o
      }),
      {
        key: !1
      }
    ), this.getMeasurements = I(
      () => [this.getMeasurementOptions(), this.itemSizeCache],
      ({ count: e, paddingStart: s, scrollMargin: t, getItemKey: i, enabled: o }, r) => {
        if (!o)
          return this.measurementsCache = [], this.itemSizeCache.clear(), [];
        this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((a) => {
          this.itemSizeCache.set(a.key, a.size);
        }));
        const c = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
        this.pendingMeasuredCacheIndexes = [];
        const h = this.measurementsCache.slice(0, c);
        for (let a = c; a < e; a++) {
          const m = i(a), g = this.options.lanes === 1 ? h[a - 1] : this.getFurthestMeasurement(h, a), f = g ? g.end + this.options.gap : s + t, u = r.get(m), d = typeof u == "number" ? u : this.options.estimateSize(a), b = f + d, p = g ? g.lane : a % this.options.lanes;
          h[a] = {
            index: a,
            start: f,
            size: d,
            end: b,
            key: m,
            lane: p
          };
        }
        return this.measurementsCache = h, h;
      },
      {
        key: process.env.NODE_ENV !== "production" && "getMeasurements",
        debug: () => this.options.debug
      }
    ), this.calculateRange = I(
      () => [
        this.getMeasurements(),
        this.getSize(),
        this.getScrollOffset(),
        this.options.lanes
      ],
      (e, s, t, i) => this.range = e.length > 0 && s > 0 ? re({
        measurements: e,
        outerSize: s,
        scrollOffset: t,
        lanes: i
      }) : null,
      {
        key: process.env.NODE_ENV !== "production" && "calculateRange",
        debug: () => this.options.debug
      }
    ), this.getVirtualIndexes = I(
      () => {
        let e = null, s = null;
        const t = this.calculateRange();
        return t && (e = t.startIndex, s = t.endIndex), this.maybeNotify.updateDeps([this.isScrolling, e, s]), [
          this.options.rangeExtractor,
          this.options.overscan,
          this.options.count,
          e,
          s
        ];
      },
      (e, s, t, i, o) => i === null || o === null ? [] : e({
        startIndex: i,
        endIndex: o,
        overscan: s,
        count: t
      }),
      {
        key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
        debug: () => this.options.debug
      }
    ), this.indexFromElement = (e) => {
      const s = this.options.indexAttribute, t = e.getAttribute(s);
      return t ? parseInt(t, 10) : (console.warn(
        `Missing attribute name '${s}={index}' on measured element.`
      ), -1);
    }, this._measureElement = (e, s) => {
      const t = this.indexFromElement(e), i = this.measurementsCache[t];
      if (!i)
        return;
      const o = i.key, r = this.elementsCache.get(o);
      r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(o, e)), e.isConnected && this.resizeItem(t, this.options.measureElement(e, s, this));
    }, this.resizeItem = (e, s) => {
      const t = this.measurementsCache[e];
      if (!t)
        return;
      const i = this.itemSizeCache.get(t.key) ?? t.size, o = s - i;
      o !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(t, o, this) : t.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", o), this._scrollToOffset(this.getScrollOffset(), {
        adjustments: this.scrollAdjustments += o,
        behavior: void 0
      })), this.pendingMeasuredCacheIndexes.push(t.index), this.itemSizeCache = new Map(this.itemSizeCache.set(t.key, s)), this.notify(!1));
    }, this.measureElement = (e) => {
      if (!e) {
        this.elementsCache.forEach((s, t) => {
          s.isConnected || (this.observer.unobserve(s), this.elementsCache.delete(t));
        });
        return;
      }
      this._measureElement(e, void 0);
    }, this.getVirtualItems = I(
      () => [this.getVirtualIndexes(), this.getMeasurements()],
      (e, s) => {
        const t = [];
        for (let i = 0, o = e.length; i < o; i++) {
          const r = e[i], c = s[r];
          t.push(c);
        }
        return t;
      },
      {
        key: process.env.NODE_ENV !== "production" && "getVirtualItems",
        debug: () => this.options.debug
      }
    ), this.getVirtualItemForOffset = (e) => {
      const s = this.getMeasurements();
      if (s.length !== 0)
        return y(
          s[j(
            0,
            s.length - 1,
            (t) => y(s[t]).start,
            e
          )]
        );
    }, this.getOffsetForAlignment = (e, s, t = 0) => {
      const i = this.getSize(), o = this.getScrollOffset();
      s === "auto" && (s = e >= o + i ? "end" : "start"), s === "center" ? e += (t - i) / 2 : s === "end" && (e -= i);
      const r = this.options.horizontal ? "scrollWidth" : "scrollHeight", h = (this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[r] : this.scrollElement[r] : 0) - i;
      return Math.max(Math.min(h, e), 0);
    }, this.getOffsetForIndex = (e, s = "auto") => {
      e = Math.max(0, Math.min(e, this.options.count - 1));
      const t = this.measurementsCache[e];
      if (!t)
        return;
      const i = this.getSize(), o = this.getScrollOffset();
      if (s === "auto")
        if (t.end >= o + i - this.options.scrollPaddingEnd)
          s = "end";
        else if (t.start <= o + this.options.scrollPaddingStart)
          s = "start";
        else
          return [o, s];
      const r = s === "end" ? t.end + this.options.scrollPaddingEnd : t.start - this.options.scrollPaddingStart;
      return [
        this.getOffsetForAlignment(r, s, t.size),
        s
      ];
    }, this.isDynamicMode = () => this.elementsCache.size > 0, this.cancelScrollToIndex = () => {
      this.scrollToIndexTimeoutId !== null && this.targetWindow && (this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId), this.scrollToIndexTimeoutId = null);
    }, this.scrollToOffset = (e, { align: s = "start", behavior: t } = {}) => {
      this.cancelScrollToIndex(), t === "smooth" && this.isDynamicMode() && console.warn(
        "The `smooth` scroll behavior is not fully supported with dynamic size."
      ), this._scrollToOffset(this.getOffsetForAlignment(e, s), {
        adjustments: void 0,
        behavior: t
      });
    }, this.scrollToIndex = (e, { align: s = "auto", behavior: t } = {}) => {
      e = Math.max(0, Math.min(e, this.options.count - 1)), this.cancelScrollToIndex(), t === "smooth" && this.isDynamicMode() && console.warn(
        "The `smooth` scroll behavior is not fully supported with dynamic size."
      );
      const i = this.getOffsetForIndex(e, s);
      if (!i) return;
      const [o, r] = i;
      this._scrollToOffset(o, { adjustments: void 0, behavior: t }), t !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
        if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
          this.options.getItemKey(e)
        )) {
          const [h] = y(
            this.getOffsetForIndex(e, r)
          );
          J(h, this.getScrollOffset()) || this.scrollToIndex(e, { align: r, behavior: t });
        } else
          this.scrollToIndex(e, { align: r, behavior: t });
      }));
    }, this.scrollBy = (e, { behavior: s } = {}) => {
      this.cancelScrollToIndex(), s === "smooth" && this.isDynamicMode() && console.warn(
        "The `smooth` scroll behavior is not fully supported with dynamic size."
      ), this._scrollToOffset(this.getScrollOffset() + e, {
        adjustments: void 0,
        behavior: s
      });
    }, this.getTotalSize = () => {
      var e;
      const s = this.getMeasurements();
      let t;
      if (s.length === 0)
        t = this.options.paddingStart;
      else if (this.options.lanes === 1)
        t = ((e = s[s.length - 1]) == null ? void 0 : e.end) ?? 0;
      else {
        const i = Array(this.options.lanes).fill(null);
        let o = s.length - 1;
        for (; o >= 0 && i.some((r) => r === null); ) {
          const r = s[o];
          i[r.lane] === null && (i[r.lane] = r.end), o--;
        }
        t = Math.max(...i.filter((r) => r !== null));
      }
      return Math.max(
        t - this.options.scrollMargin + this.options.paddingEnd,
        0
      );
    }, this._scrollToOffset = (e, {
      adjustments: s,
      behavior: t
    }) => {
      this.options.scrollToFn(e, { behavior: t, adjustments: s }, this);
    }, this.measure = () => {
      this.itemSizeCache = /* @__PURE__ */ new Map(), this.notify(!1);
    }, this.setOptions(l);
  }
}
const j = (n, l, e, s) => {
  for (; n <= l; ) {
    const t = (n + l) / 2 | 0, i = e(t);
    if (i < s)
      n = t + 1;
    else if (i > s)
      l = t - 1;
    else
      return t;
  }
  return n > 0 ? n - 1 : 0;
};
function re({
  measurements: n,
  outerSize: l,
  scrollOffset: e,
  lanes: s
}) {
  const t = n.length - 1, i = (c) => n[c].start;
  if (n.length <= s)
    return {
      startIndex: 0,
      endIndex: t
    };
  let o = j(
    0,
    t,
    i,
    e
  ), r = o;
  if (s === 1)
    for (; r < t && n[r].end < e + l; )
      r++;
  else if (s > 1) {
    const c = Array(s).fill(0);
    for (; r < t && c.some((a) => a < e + l); ) {
      const a = n[r];
      c[a.lane] = a.end, r++;
    }
    const h = Array(s).fill(e + l);
    for (; o >= 0 && h.some((a) => a >= e); ) {
      const a = n[o];
      h[a.lane] = a.start, o--;
    }
    o = Math.max(0, o - o % s), r = Math.min(t, r + (s - 1 - r % s));
  }
  return { startIndex: o, endIndex: r };
}
const F = typeof document < "u" ? z.useLayoutEffect : z.useEffect;
function le(n) {
  const l = z.useReducer(() => ({}), {})[1], e = {
    ...n,
    onChange: (t, i) => {
      var o;
      i ? X(l) : l(), (o = n.onChange) == null || o.call(n, t, i);
    }
  }, [s] = z.useState(
    () => new oe(e)
  );
  return s.setOptions(e), F(() => s._didMount(), []), F(() => s._willUpdate()), s;
}
function ae(n) {
  return le({
    observeElementRect: te,
    observeElementOffset: se,
    scrollToFn: ie,
    ...n
  });
}
const ye = (n, l) => ((e) => Array.isArray(e) ? l(e) : n(e)), w = N(null), T = N(null), ce = () => A(w), R = () => A(T), Oe = () => {
  const { scrollToIndex: n } = R();
  return C(() => ({ scrollToIndex: n }), [n]);
}, we = (n) => {
  const { getItem: l, subscribe: e } = R();
  return q(
    M(
      (s) => e == null ? () => {
      } : e(s, n),
      [n, e]
    ),
    M(() => l?.(n), [l, n])
  );
}, he = () => {
  const { data: n, getItems: l, getTotalSize: e, itemHeight: s } = ce(), { ref: t, getItem: i, scrollToIndex: o, subscribe: r } = R();
  return C(
    () => ({
      data: n,
      getItems: l,
      getTotalSize: e,
      ref: t,
      getItem: i,
      scrollToIndex: o,
      subscribe: r,
      itemHeight: s
    }),
    [n, l, e, t, i, o, r, s]
  );
}, k = (n, l, e) => {
  const s = Y(e), { visible: t } = $(), i = O(!1);
  return M(
    (o) => {
      n.current = o, !(n.current == null || i.current) && (i.current = !0, s.current?.());
    },
    [s, t, l]
  );
}, ue = ({
  data: n,
  getItem: l,
  subscribe: e,
  children: s,
  onFetchMore: t,
  overscan: i = 10,
  itemHeight: o = 36
}) => {
  const r = O(null), c = n.length > 0, h = k(r, c, t), a = ae({
    count: n.length,
    getScrollElement: () => r.current,
    estimateSize: () => o,
    overscan: i,
    onChange: M(
      (u) => {
        const d = u.getVirtualItems();
        d.length > 0 && d[d.length - 1].index === n.length - 1 && t?.();
      },
      [n.length, t]
    )
  }), m = a.getVirtualItems(), g = C(
    () => ({
      ref: h,
      getItem: l,
      data: n,
      subscribe: e,
      getTotalSize: () => a.getTotalSize(),
      getItems: () => m.map(({ index: u, start: d }) => ({
        key: n[u],
        index: u,
        translate: d
      })),
      itemHeight: o
    }),
    [h, a, n, l, o, m]
  ), f = C(
    () => ({
      ref: h,
      getItem: l,
      scrollToIndex: (u) => a.scrollToIndex(u),
      subscribe: e
    }),
    [h, a, l, e]
  );
  return /* @__PURE__ */ E.jsx(w.Provider, { value: g, children: /* @__PURE__ */ E.jsx(T.Provider, { value: f, children: s }) });
}, de = ({
  data: n,
  getItem: l,
  subscribe: e,
  children: s,
  onFetchMore: t,
  itemHeight: i
}) => {
  const o = O(null), r = n.length > 0, c = M((f, u) => {
    const d = o.current?.children[0];
    if (!d) return;
    const b = u === "top" ? 1 : -1;
    let p;
    const v = f + b;
    L.contains({ lower: 0, upper: d.children.length }, v) ? p = f + b : p = f;
    const S = d.children[p];
    S?.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "smooth" });
  }, []), h = k(o, r, t), a = n.map((f, u) => ({ key: f, index: u })), m = C(
    () => ({
      ref: h,
      getItem: l,
      data: n,
      subscribe: e,
      getTotalSize: () => {
      },
      getItems: () => a,
      itemHeight: i
    }),
    [h, n, l, e, i]
  ), g = C(
    () => ({
      ref: h,
      getItem: l,
      scrollToIndex: c,
      subscribe: e
    }),
    [h, l, e, c]
  );
  return /* @__PURE__ */ E.jsx(w.Provider, { value: m, children: /* @__PURE__ */ E.jsx(T.Provider, { value: g, children: s }) });
}, me = ({
  virtual: n = !1,
  ...l
}) => n ? /* @__PURE__ */ E.jsx(ue, { ...l }) : /* @__PURE__ */ E.jsx(de, { ...l }), Te = V(me), Re = ({
  itemKey: n,
  className: l,
  index: e,
  el: s,
  draggingOver: t = !1,
  rightAligned: i = !1,
  highlightHovered: o = !1,
  selected: r = !1,
  translate: c,
  onSelect: h,
  onClick: a,
  hovered: m,
  style: g,
  ...f
}) => /* @__PURE__ */ E.jsx(
  P,
  {
    el: s,
    defaultEl: "div",
    id: n.toString(),
    variant: "text",
    onClick: (u) => {
      h?.(n), a?.(u);
    },
    className: x(
      l,
      H,
      r && U,
      m && x.M("hovered"),
      i && x.M("right-aligned"),
      o && x.M("highlight-hover"),
      t && x.M("dragging-over"),
      x.BE("list", "item"),
      x.selected(r)
    ),
    style: {
      position: c != null ? "absolute" : "relative",
      transform: `translateY(${c}px)`,
      ...g
    },
    square: !1,
    ...f
  }
), fe = ({
  className: n,
  children: l,
  emptyContent: e,
  displayItems: s = 10,
  style: t,
  direction: i,
  x: o,
  y: r,
  ...c
}) => {
  const { ref: h, getItems: a, getTotalSize: m, data: g, itemHeight: f } = he(), u = a();
  let d = e;
  const b = g.length > 0;
  b && (d = /* @__PURE__ */ E.jsx(
    "div",
    {
      className: x.BE("list", "virtualizer"),
      style: { minHeight: m() },
      children: u.map(
        ({ key: S, index: B, translate: W }) => l({ key: S, index: B, itemKey: S, translate: W })
      )
    }
  ));
  let p;
  f != null && isFinite(s) && b && (p = Math.min(s, u.length) * f + 1);
  const v = K(i, o, r);
  return /* @__PURE__ */ E.jsx(
    G,
    {
      gap: 0,
      ref: h,
      className: x(
        n,
        x.BE("list", "items"),
        !b && x.BEM("list", "items", "empty")
      ),
      style: { height: p, ...t },
      full: v,
      direction: v,
      ...c,
      children: d
    }
  );
}, De = V(fe);
export {
  me as C,
  Te as F,
  Re as I,
  De as a,
  we as b,
  ye as c,
  Oe as d,
  R as e,
  he as u
};
