import W from "../../../../@babel/runtime/helpers/esm/extends.mjs";
import * as n from "react";
import E from "../../hooks/useCellClassName.mjs";
import Y from "../../RangeContext.mjs";
import { getWeekStartDate as _, WEEK_DAY_COUNT as C, isSameDate as b, isSameMonth as M, formatValue as P } from "../../utils/dateUtil.mjs";
import B from "../PanelBody.mjs";
function L(l) {
  var g = l.prefixCls, e = l.generateConfig, i = l.prefixColumn, t = l.locale, d = l.rowCount, f = l.viewDate, D = l.value, c = l.cellRender, v = l.isSameCell, m = n.useContext(Y), y = m.rangedValue, h = m.hoverRangedValue, x = _(t.locale, e, f), w = "".concat(g, "-cell"), N = e.locale.getWeekFirstDay(t.locale), s = e.getNow(), u = [], k = t.shortWeekDays || (e.locale.getShortWeekDays ? e.locale.getShortWeekDays(t.locale) : []);
  i && u.push(/* @__PURE__ */ n.createElement("th", {
    key: "empty",
    "aria-label": "empty cell"
  }));
  for (var o = 0; o < C; o += 1)
    u.push(/* @__PURE__ */ n.createElement("th", {
      key: o
    }, k[(o + N) % C]));
  var V = E({
    cellPrefixCls: w,
    today: s,
    value: D,
    generateConfig: e,
    rangedValue: i ? null : y,
    hoverRangedValue: i ? null : h,
    isSameCell: v || function(r, a) {
      return b(e, r, a);
    },
    isInView: function(a) {
      return M(e, a, f);
    },
    offsetCell: function(a, S) {
      return e.addDate(a, S);
    }
  }), R = c ? function(r, a) {
    return c(r, {
      originNode: a,
      today: s,
      type: "date",
      locale: t
    });
  } : void 0;
  return /* @__PURE__ */ n.createElement(B, W({}, l, {
    rowNum: d,
    colNum: C,
    baseDate: x,
    getCellNode: R,
    getCellText: e.getDate,
    getCellClassName: V,
    getCellDate: e.addDate,
    titleCell: function(a) {
      return P(a, {
        locale: t,
        format: "YYYY-MM-DD",
        generateConfig: e
      });
    },
    headerCells: u
  }));
}
export {
  L as default
};
