import * as t from "react";
import { flushSync as f } from "react-dom";
import { Virtualizer as i, elementScroll as m, observeElementOffset as d, observeElementRect as p } from "../../../../../../@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.js";
import { defaultKeyExtractor as g, defaultRangeExtractor as z, measureElement as O } from "../../../../../../@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.js";
const l = typeof document < "u" ? t.useLayoutEffect : t.useEffect;
function E({
  useFlushSync: r = !0,
  ...n
}) {
  const o = t.useReducer(() => ({}), {})[1], u = {
    ...n,
    onChange: (c, s) => {
      var a;
      r && s ? f(o) : o(), (a = n.onChange) == null || a.call(n, c, s);
    }
  }, [e] = t.useState(
    () => new i(u)
  );
  return e.setOptions(u), l(() => e._didMount(), []), l(() => e._willUpdate()), e;
}
function x(r) {
  return E({
    observeElementRect: p,
    observeElementOffset: d,
    scrollToFn: m,
    ...r
  });
}
export {
  i as Virtualizer,
  g as defaultKeyExtractor,
  z as defaultRangeExtractor,
  m as elementScroll,
  O as measureElement,
  d as observeElementOffset,
  p as observeElementRect,
  x as useVirtualizer
};
