"use strict";
require("react");
const index$3 = require("../../../icon/react-icon/IconLeft/index.js");
const index$2 = require("../../../icon/react-icon/IconRight/index.js");
const index$1 = require("../../../icon/react-icon/IconDoubleLeft/index.js");
const index = require("../../../icon/react-icon/IconDoubleRight/index.js");
const classNames = require("../../_util/classNames.js");
const emotionReactJsxRuntime_browser_esm = require("../../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
function Header(props) {
  var prefixCls = props.prefixCls, title = props.title, onPrev = props.onPrev, onNext = props.onNext, onSuperPrev = props.onSuperPrev, onSuperNext = props.onSuperNext, mode = props.mode, value = props.value, onChangePanel = props.onChangePanel, _a = props.icons, icons = _a === void 0 ? {} : _a, rtl = props.rtl;
  var showPrev = typeof onPrev === "function";
  var showSuperPrev = typeof onSuperPrev === "function";
  var showNext = typeof onNext === "function";
  var showSuperNext = typeof onSuperNext === "function";
  var getIconClassName = function(isShow) {
    var _a2;
    return classNames(prefixCls + "-header-icon", (_a2 = {}, _a2[prefixCls + "-header-icon-hidden"] = !isShow, _a2));
  };
  function renderHeaderLabel() {
    if (title) {
      return title;
    }
    if (mode === "date" || mode === "week") {
      return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs(emotionReactJsxRuntime_browser_esm.Fragment, {
        children: [/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
          className: prefixCls + "-header-label",
          onClick: function() {
            return onChangePanel("year");
          },
          children: value.format("YYYY")
        }), "-", /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
          className: prefixCls + "-header-label",
          onClick: function() {
            return onChangePanel("month");
          },
          children: value.format("MM")
        })]
      });
    }
    if (mode === "month" || mode === "quarter") {
      return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
        className: prefixCls + "-header-label",
        onClick: function() {
          return onChangePanel("year");
        },
        children: value.format("YYYY")
      });
    }
  }
  var prevDoubleNull = icons.prevDouble === null;
  var prevNull = icons.prev === null;
  var nextNull = icons.next === null;
  var nextDoubleNull = icons.nextDouble === null;
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
    className: prefixCls + "-header",
    children: [!prevDoubleNull && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      className: getIconClassName(showSuperPrev),
      onClick: onSuperPrev,
      children: showSuperPrev && (prevDoubleNull ? null : icons.prevDouble || (rtl ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index, {}) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$1, {})))
    }), !prevNull && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      className: getIconClassName(showPrev),
      onClick: onPrev,
      children: showPrev && (prevNull ? null : icons.prev || (rtl ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$2, {}) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$3, {})))
    }), /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      className: prefixCls + "-header-value",
      children: renderHeaderLabel()
    }), !nextNull && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      className: getIconClassName(showNext),
      onClick: onNext,
      children: showNext && (nextNull ? null : icons.next || (rtl ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$3, {}) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$2, {})))
    }), !nextDoubleNull && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      className: getIconClassName(showSuperNext),
      onClick: onSuperNext,
      children: showSuperNext && (nextDoubleNull ? null : icons.nextDouble || (rtl ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$1, {}) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index, {})))
    })]
  });
}
module.exports = Header;
//# sourceMappingURL=header.js.map
