import m from "../../../../@babel/runtime/helpers/esm/extends.mjs";
import * as u from "react";
import w from "./YearHeader.mjs";
import x, { YEAR_COL_COUNT as E } from "./YearBody.mjs";
import { createKeyDownHandler as R } from "../../utils/uiUtil.mjs";
import { YEAR_DECADE_COUNT as Y } from "./constant.mjs";
function N(e) {
  var l = e.prefixCls, g = e.operationRef, h = e.onViewDateChange, c = e.generateConfig, i = e.value, n = e.viewDate, C = e.sourceMode, f = e.onSelect, d = e.onPanelChange, v = "".concat(l, "-year-panel");
  g.current = {
    onKeyDown: function(t) {
      return R(t, {
        onLeftRight: function(r) {
          f(c.addYear(i || n, r), "key");
        },
        onCtrlLeftRight: function(r) {
          f(c.addYear(i || n, r * Y), "key");
        },
        onUpDown: function(r) {
          f(c.addYear(i || n, r * E), "key");
        },
        onEnter: function() {
          d(C === "date" ? "date" : "month", i || n);
        }
      });
    }
  };
  var D = function(t) {
    var a = c.addYear(n, t * 10);
    h(a), d(null, a);
  };
  return /* @__PURE__ */ u.createElement("div", {
    className: v
  }, /* @__PURE__ */ u.createElement(w, m({}, e, {
    prefixCls: l,
    onPrevDecade: function() {
      D(-1);
    },
    onNextDecade: function() {
      D(1);
    },
    onDecadeClick: function() {
      d("decade", n);
    }
  })), /* @__PURE__ */ u.createElement(x, m({}, e, {
    prefixCls: l,
    onSelect: function(t) {
      d(C === "date" ? "date" : "month", t), f(t, "mouse");
    }
  })));
}
export {
  Y as YEAR_DECADE_COUNT,
  N as default
};
