import E from "../../../@babel/runtime/helpers/esm/extends.mjs";
import m from "../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import y from "../../../classnames/index.mjs";
import * as r from "react";
import "../../../rc-util/es/hooks/useLayoutEffect.mjs";
import "../../../rc-util/node_modules/react-is/index.mjs";
import { warningOnce as u } from "../../../rc-util/es/warning.mjs";
import { INTERNAL_HOOKS as x } from "../constant.mjs";
import { makeImmutable as _ } from "../context/TableContext.mjs";
import I, { DEFAULT_PREFIX as T } from "../Table.mjs";
import V from "./BodyGrid.mjs";
import { StaticContext as O } from "./context.mjs";
var R = function(a, t) {
  var o = t.ref, l = t.onScroll;
  return /* @__PURE__ */ r.createElement(V, {
    ref: o,
    data: a,
    onScroll: l
  });
};
function S(e, a) {
  var t = e.columns, o = e.scroll, l = e.sticky, c = e.prefixCls, d = c === void 0 ? T : c, p = e.className, s = e.listItemHeight, v = e.components, f = o || {}, i = f.x, n = f.y;
  typeof i != "number" && (process.env.NODE_ENV !== "production" && u(!i, "`scroll.x` in virtual table must be number."), i = 1), typeof n != "number" && (n = 500, process.env.NODE_ENV !== "production" && u(!1, "`scroll.y` in virtual table must be number."));
  var N = r.useMemo(function() {
    return {
      sticky: l,
      scrollY: n,
      listItemHeight: s
    };
  }, [l, n, s]);
  return /* @__PURE__ */ r.createElement(O.Provider, {
    value: N
  }, /* @__PURE__ */ r.createElement(I, E({}, e, {
    className: y(p, "".concat(d, "-virtual")),
    scroll: m(m({}, o), {}, {
      x: i
    }),
    components: m(m({}, v), {}, {
      body: R
    }),
    columns: t,
    internalHooks: x,
    tailor: !0,
    ref: a
  })));
}
var b = /* @__PURE__ */ r.forwardRef(S);
process.env.NODE_ENV !== "production" && (b.displayName = "VirtualTable");
function g(e) {
  return _(b, e);
}
g();
export {
  g as genVirtualTable
};
