import "../../../../@ant-design/cssinjs/es/extractStyle.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "react";
import "../../../../@ant-design/cssinjs/es/StyleContext.mjs";
import { unit as a } from "../../../../@ant-design/cssinjs/es/util/index.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useHMR.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../../@ant-design/cssinjs/es/theme/ThemeCache.mjs";
import "../../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import { initPickerPanelToken as n, genPanelStyle as o, initPanelComponentToken as c } from "../../date-picker/style/index.mjs";
import { resetComponent as g } from "../../style/index.mjs";
import { genStyleHooks as m } from "../../theme/util/genComponentStyleHook.mjs";
import { merge as p } from "../../theme/util/statistic.mjs";
const h = (i) => {
  const {
    calendarCls: e,
    componentCls: t,
    fullBg: r,
    fullPanelBg: d,
    itemActiveBg: l
  } = i;
  return {
    [e]: Object.assign(Object.assign(Object.assign({}, o(i)), g(i)), {
      background: r,
      "&-rtl": {
        direction: "rtl"
      },
      [`${e}-header`]: {
        display: "flex",
        justifyContent: "flex-end",
        padding: `${a(i.paddingSM)} 0`,
        [`${e}-year-select`]: {
          minWidth: i.yearControlWidth
        },
        [`${e}-month-select`]: {
          minWidth: i.monthControlWidth,
          marginInlineStart: i.marginXS
        },
        [`${e}-mode-switch`]: {
          marginInlineStart: i.marginXS
        }
      }
    }),
    [`${e} ${t}-panel`]: {
      background: d,
      border: 0,
      borderTop: `${a(i.lineWidth)} ${i.lineType} ${i.colorSplit}`,
      borderRadius: 0,
      [`${t}-month-panel, ${t}-date-panel`]: {
        width: "auto"
      },
      [`${t}-body`]: {
        padding: `${a(i.paddingXS)} 0`
      },
      [`${t}-content`]: {
        width: "100%"
      }
    },
    [`${e}-mini`]: {
      borderRadius: i.borderRadiusLG,
      [`${e}-header`]: {
        paddingInlineEnd: i.paddingXS,
        paddingInlineStart: i.paddingXS
      },
      [`${t}-panel`]: {
        borderRadius: `0 0 ${a(i.borderRadiusLG)} ${a(i.borderRadiusLG)}`
      },
      [`${t}-content`]: {
        height: i.miniContentHeight,
        th: {
          height: "auto",
          padding: 0,
          lineHeight: `${a(i.weekHeight)}`
        }
      },
      [`${t}-cell::before`]: {
        pointerEvents: "none"
      }
    },
    [`${e}${e}-full`]: {
      [`${t}-panel`]: {
        display: "block",
        width: "100%",
        textAlign: "end",
        background: r,
        border: 0,
        [`${t}-body`]: {
          "th, td": {
            padding: 0
          },
          th: {
            height: "auto",
            paddingInlineEnd: i.paddingSM,
            paddingBottom: i.paddingXXS,
            lineHeight: `${a(i.weekHeight)}`
          }
        }
      },
      [`${t}-cell`]: {
        "&::before": {
          display: "none"
        },
        "&:hover": {
          [`${e}-date`]: {
            background: i.controlItemBgHover
          }
        },
        [`${e}-date-today::before`]: {
          display: "none"
        },
        // >>> Selected
        [`&-in-view${t}-cell-selected`]: {
          [`${e}-date, ${e}-date-today`]: {
            background: l
          }
        },
        "&-selected, &-selected:hover": {
          [`${e}-date, ${e}-date-today`]: {
            [`${e}-date-value`]: {
              color: i.colorPrimary
            }
          }
        }
      },
      [`${e}-date`]: {
        display: "block",
        width: "auto",
        height: "auto",
        margin: `0 ${a(i.calc(i.marginXS).div(2).equal())}`,
        padding: `${a(i.calc(i.paddingXS).div(2).equal())} ${a(i.paddingXS)} 0`,
        border: 0,
        borderTop: `${a(i.lineWidthBold)} ${i.lineType} ${i.colorSplit}`,
        borderRadius: 0,
        transition: `background ${i.motionDurationSlow}`,
        "&-value": {
          lineHeight: `${a(i.dateValueHeight)}`,
          transition: `color ${i.motionDurationSlow}`
        },
        "&-content": {
          position: "static",
          width: "auto",
          height: i.dateContentHeight,
          overflowY: "auto",
          color: i.colorText,
          lineHeight: i.lineHeight,
          textAlign: "start"
        },
        "&-today": {
          borderColor: i.colorPrimary,
          [`${e}-date-value`]: {
            color: i.colorText
          }
        }
      }
    },
    [`@media only screen and (max-width: ${a(i.screenXS)}) `]: {
      [`${e}`]: {
        [`${e}-header`]: {
          display: "block",
          [`${e}-year-select`]: {
            width: "50%"
          },
          [`${e}-month-select`]: {
            width: `calc(50% - ${a(i.paddingXS)})`
          },
          [`${e}-mode-switch`]: {
            width: "100%",
            marginTop: i.marginXS,
            marginInlineStart: 0,
            "> label": {
              width: "50%",
              textAlign: "center"
            }
          }
        }
      }
    }
  };
}, $ = (i) => Object.assign({
  fullBg: i.colorBgContainer,
  fullPanelBg: i.colorBgContainer,
  itemActiveBg: i.controlItemBgActive,
  yearControlWidth: 80,
  monthControlWidth: 70,
  miniContentHeight: 256
}, c(i)), P = m("Calendar", (i) => {
  const e = `${i.componentCls}-calendar`, t = p(i, n(i), {
    calendarCls: e,
    pickerCellInnerCls: `${i.componentCls}-cell-inner`,
    dateValueHeight: i.controlHeightSM,
    weekHeight: i.calc(i.controlHeightSM).mul(0.75).equal(),
    dateContentHeight: i.calc(i.calc(i.fontHeightSM).add(i.marginXS)).mul(3).add(i.calc(i.lineWidth).mul(2)).equal()
  });
  return [h(t)];
}, $);
export {
  P as default,
  h as genCalendarStyles,
  $ as prepareComponentToken
};
