import ue from "../../../@babel/runtime/helpers/esm/extends.mjs";
import me from "../../../@babel/runtime/helpers/esm/typeof.mjs";
import g from "../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import n from "../../../@babel/runtime/helpers/esm/defineProperty.mjs";
import U from "../../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import { useContext as ve } from "../../../@rc-component/context/es/context.mjs";
import * as y from "react";
import "../../../rc-util/node_modules/react-is/index.mjs";
import xe from "../../../classnames/index.mjs";
import pe from "../context/TableContext.mjs";
import ye from "../hooks/useRenderTimes.mjs";
import ge from "./useCellRender.mjs";
import he from "./useHoverState.mjs";
var Ce = function(d) {
  var u = d.ellipsis, v = d.rowType, r = d.children, s, m = u === !0 ? {
    showTitle: !0
  } : u;
  return m && (m.showTitle || v === "header") && (typeof r == "string" || typeof r == "number" ? s = r.toString() : /* @__PURE__ */ y.isValidElement(r) && typeof r.props.children == "string" && (s = r.props.children)), s;
};
function Se(e) {
  var d, u, v, r, s, m, h, t;
  process.env.NODE_ENV !== "production" && ye(e);
  var D = e.component, O = e.children, C = e.ellipsis, q = e.scope, z = e.prefixCls, B = e.className, T = e.align, S = e.record, G = e.render, J = e.dataIndex, K = e.renderIndex, Q = e.shouldCellUpdate, _ = e.index, W = e.rowType, X = e.colSpan, Y = e.rowSpan, P = e.fixLeft, E = e.fixRight, Z = e.firstFixLeft, w = e.lastFixLeft, M = e.firstFixRight, ee = e.lastFixRight, k = e.appendNode, $ = e.additionalProps, i = $ === void 0 ? {} : $, ie = e.isSticky, o = "".concat(z, "-cell"), b = ve(pe, ["supportSticky", "allColumnsFixedLeft"]), a = b.supportSticky, le = b.allColumnsFixedLeft, te = ge(S, J, K, O, G, Q), A = U(te, 2), H = A[0], l = A[1], x = {}, F = typeof P == "number" && a, N = typeof E == "number" && a;
  F && (x.position = "sticky", x.left = P), N && (x.position = "sticky", x.right = E);
  var R = (d = (u = (v = l == null ? void 0 : l.colSpan) !== null && v !== void 0 ? v : i.colSpan) !== null && u !== void 0 ? u : X) !== null && d !== void 0 ? d : 1, p = (r = (s = (m = l == null ? void 0 : l.rowSpan) !== null && m !== void 0 ? m : i.rowSpan) !== null && s !== void 0 ? s : Y) !== null && r !== void 0 ? r : 1, oe = he(_, p), I = U(oe, 2), ne = I[0], V = I[1], re = function(L) {
    var f;
    S && V(_, _ + p - 1), i == null || (f = i.onMouseEnter) === null || f === void 0 || f.call(i, L);
  }, ae = function(L) {
    var f;
    S && V(-1, -1), i == null || (f = i.onMouseLeave) === null || f === void 0 || f.call(i, L);
  };
  if (R === 0 || p === 0)
    return null;
  var de = (h = i.title) !== null && h !== void 0 ? h : Ce({
    rowType: W,
    ellipsis: C,
    children: H
  }), se = xe(o, B, (t = {}, n(t, "".concat(o, "-fix-left"), F && a), n(t, "".concat(o, "-fix-left-first"), Z && a), n(t, "".concat(o, "-fix-left-last"), w && a), n(t, "".concat(o, "-fix-left-all"), w && le && a), n(t, "".concat(o, "-fix-right"), N && a), n(t, "".concat(o, "-fix-right-first"), M && a), n(t, "".concat(o, "-fix-right-last"), ee && a), n(t, "".concat(o, "-ellipsis"), C), n(t, "".concat(o, "-with-append"), k), n(t, "".concat(o, "-fix-sticky"), (F || N) && ie && a), n(t, "".concat(o, "-row-hover"), !l && ne), t), i.className, l == null ? void 0 : l.className), j = {};
  T && (j.textAlign = T);
  var ce = g(g(g(g({}, x), i.style), j), l == null ? void 0 : l.style), c = H;
  return me(c) === "object" && !Array.isArray(c) && !/* @__PURE__ */ y.isValidElement(c) && (c = null), C && (w || M) && (c = /* @__PURE__ */ y.createElement("span", {
    className: "".concat(o, "-content")
  }, c)), /* @__PURE__ */ y.createElement(D, ue({}, l, i, {
    className: se,
    style: ce,
    title: de,
    scope: q,
    onMouseEnter: re,
    onMouseLeave: ae,
    colSpan: R !== 1 ? R : null,
    rowSpan: p !== 1 ? p : null
  }), k, c);
}
const be = /* @__PURE__ */ y.memo(Se);
export {
  be as default
};
