import G from "../../../@babel/runtime/helpers/esm/extends.mjs";
import t from "../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import { useContext as M } from "../../../@rc-component/context/es/context.mjs";
import * as g from "react";
import "../../../rc-util/node_modules/react-is/index.mjs";
import V from "../../../classnames/index.mjs";
import { getCellProps as q } from "../Body/BodyRow.mjs";
import z from "../Cell/index.mjs";
import { GridContext as A } from "./context.mjs";
function B(e, o, n) {
  var a = o || 1;
  return n[e + a] - (n[e] || 0);
}
function Y(e) {
  var o = e.rowInfo, n = e.column, a = e.colIndex, h = e.indent, p = e.index, I = e.renderIndex, S = e.record, y = e.style, N = e.className, s = e.inverse, m = e.getHeight, w = n.render, P = n.dataIndex, _ = n.className, k = n.width, H = M(A, ["columnsOffset"]), O = H.columnsOffset, d = q(o, n, a, h, p), R = d.key, W = d.fixedInfo, b = d.appendCellNode, i = d.additionalCellProps, E = i.style, x = i.colSpan, r = x === void 0 ? 1 : x, v = i.rowSpan, l = v === void 0 ? 1 : v, U = a - 1, c = B(U, r, O), $ = r > 1 ? k - c : 0, f = t(t(t({}, E), y), {}, {
    flex: "0 0 ".concat(c, "px"),
    width: "".concat(c, "px"),
    marginRight: $,
    pointerEvents: "auto"
  }), C = g.useMemo(function() {
    return s ? l <= 1 : r === 0 || l === 0 || l > 1;
  }, [l, r, s]);
  C ? f.visibility = "hidden" : s && (f.height = m == null ? void 0 : m(l));
  var j = C ? function() {
    return null;
  } : w, u = {};
  return (l === 0 || r === 0) && (u.rowSpan = 1, u.colSpan = 1), /* @__PURE__ */ g.createElement(z, G({
    className: V(_, N),
    ellipsis: n.ellipsis,
    align: n.align,
    scope: n.rowScope,
    component: "div",
    prefixCls: o.prefixCls,
    key: R,
    record: S,
    index: p,
    renderIndex: I,
    dataIndex: P,
    render: j,
    shouldCellUpdate: n.shouldCellUpdate
  }, W, {
    appendNode: b,
    additionalProps: t(t({}, i), {}, {
      style: f
    }, u)
  }));
}
export {
  Y as default,
  B as getColumnWidth
};
