import { useContext as B } from "../../../@rc-component/context/es/context.mjs";
import * as o from "react";
import "../../../rc-util/node_modules/react-is/index.mjs";
import W from "../context/PerfContext.mjs";
import I, { responseImmutable as P } from "../context/TableContext.mjs";
import k from "../hooks/useFlattenRecords.mjs";
import D from "../hooks/useRenderTimes.mjs";
import { getColumnsKey as T } from "../utils/valueUtil.mjs";
import _ from "./BodyRow.mjs";
import F from "./ExpandedRow.mjs";
import M from "./MeasureRow.mjs";
function f(r) {
  process.env.NODE_ENV !== "production" && D(r);
  var d = r.data, y = r.measureColumnWidth, e = B(I, ["prefixCls", "getComponent", "onColumnResize", "flattenColumns", "getRowKey", "expandedKeys", "childrenColumnName", "emptyNode"]), n = e.prefixCls, t = e.getComponent, x = e.onColumnResize, p = e.flattenColumns, m = e.getRowKey, v = e.expandedKeys, R = e.childrenColumnName, w = e.emptyNode, h = k(d, R, v, m), K = o.useRef({
    renderWithProps: !1
  }), N = t(["body", "wrapper"], "tbody"), s = t(["body", "row"], "tr"), i = t(["body", "cell"], "td"), g = t(["body", "cell"], "th"), a;
  d.length ? a = h.map(function(l, c) {
    var C = l.record, b = l.indent, z = l.index, u = m(C, c);
    return /* @__PURE__ */ o.createElement(_, {
      key: u,
      rowKey: u,
      record: C,
      index: c,
      renderIndex: z,
      rowComponent: s,
      cellComponent: i,
      scopeCellComponent: g,
      getRowKey: m,
      indent: b
    });
  }) : a = /* @__PURE__ */ o.createElement(F, {
    expanded: !0,
    className: "".concat(n, "-placeholder"),
    prefixCls: n,
    component: s,
    cellComponent: i,
    colSpan: p.length,
    isEmpty: !0
  }, w);
  var E = T(p);
  return /* @__PURE__ */ o.createElement(W.Provider, {
    value: K.current
  }, /* @__PURE__ */ o.createElement(N, {
    className: "".concat(n, "-tbody")
  }, y && /* @__PURE__ */ o.createElement(M, {
    prefixCls: n,
    columnsKey: E,
    onColumnResize: x
  }), a));
}
f.displayName = "Body";
const L = P(f);
export {
  L as default
};
