import d from "../../../../@babel/runtime/helpers/esm/extends.mjs";
import * as u from "react";
import Y from "./QuarterHeader.mjs";
import w from "./QuarterBody.mjs";
import { createKeyDownHandler as D } from "../../utils/uiUtil.mjs";
function k(e) {
  var l = e.prefixCls, g = e.operationRef, h = e.onViewDateChange, i = e.generateConfig, c = e.value, n = e.viewDate, C = e.onPanelChange, f = e.onSelect, v = "".concat(l, "-quarter-panel");
  g.current = {
    onKeyDown: function(a) {
      return D(a, {
        onLeftRight: function(r) {
          f(i.addMonth(c || n, r * 3), "key");
        },
        onCtrlLeftRight: function(r) {
          f(i.addYear(c || n, r), "key");
        },
        onUpDown: function(r) {
          f(i.addYear(c || n, r), "key");
        }
      });
    }
  };
  var m = function(a) {
    var o = i.addYear(n, a);
    h(o), C(null, o);
  };
  return /* @__PURE__ */ u.createElement("div", {
    className: v
  }, /* @__PURE__ */ u.createElement(Y, d({}, e, {
    prefixCls: l,
    onPrevYear: function() {
      m(-1);
    },
    onNextYear: function() {
      m(1);
    },
    onYearClick: function() {
      C("year", n);
    }
  })), /* @__PURE__ */ u.createElement(w, d({}, e, {
    prefixCls: l,
    onSelect: function(a) {
      f(a, "mouse");
    }
  })));
}
export {
  k as default
};
