import { resetComponent, textEllipsis } from "../../style/index.js";
import { initMoveMotion } from "../../style/motion/move.js";
import { initSlideMotion, slideDownIn, slideDownOut, slideUpIn, slideUpOut } from "../../style/motion/slide.js";

//#region src/select/style/dropdown.ts
const genItemStyle = (token) => {
	const { optionHeight, optionFontSize, optionLineHeight, optionPadding } = token;
	return {
		position: "relative",
		display: "block",
		minHeight: optionHeight,
		padding: optionPadding,
		color: token.colorText,
		fontWeight: "normal",
		fontSize: optionFontSize,
		lineHeight: optionLineHeight,
		boxSizing: "border-box"
	};
};
const genSingleStyle = (token) => {
	const { antCls, componentCls } = token;
	const selectItemCls = `${componentCls}-item`;
	const slideUpEnterActive = `&${antCls}-slide-up-enter${antCls}-slide-up-enter-active`;
	const slideUpAppearActive = `&${antCls}-slide-up-appear${antCls}-slide-up-appear-active`;
	const slideUpLeaveActive = `&${antCls}-slide-up-leave${antCls}-slide-up-leave-active`;
	const dropdownPlacementCls = `${componentCls}-dropdown-placement-`;
	const selectedItemCls = `${selectItemCls}-option-selected`;
	return [
		{ [`${componentCls}-dropdown`]: {
			...resetComponent(token),
			position: "absolute",
			top: -9999,
			zIndex: token.zIndexPopup,
			boxSizing: "border-box",
			padding: token.paddingXXS,
			overflow: "hidden",
			fontSize: token.fontSize,
			fontVariant: "initial",
			backgroundColor: token.colorBgElevated,
			borderRadius: token.borderRadiusLG,
			outline: "none",
			boxShadow: token.boxShadowSecondary,
			[`
          ${slideUpEnterActive}${dropdownPlacementCls}bottomLeft,
          ${slideUpAppearActive}${dropdownPlacementCls}bottomLeft
        `]: { animationName: slideUpIn },
			[`
          ${slideUpEnterActive}${dropdownPlacementCls}topLeft,
          ${slideUpAppearActive}${dropdownPlacementCls}topLeft,
          ${slideUpEnterActive}${dropdownPlacementCls}topRight,
          ${slideUpAppearActive}${dropdownPlacementCls}topRight
        `]: { animationName: slideDownIn },
			[`${slideUpLeaveActive}${dropdownPlacementCls}bottomLeft`]: { animationName: slideUpOut },
			[`
          ${slideUpLeaveActive}${dropdownPlacementCls}topLeft,
          ${slideUpLeaveActive}${dropdownPlacementCls}topRight
        `]: { animationName: slideDownOut },
			"&-hidden": { display: "none" },
			[selectItemCls]: {
				...genItemStyle(token),
				cursor: "pointer",
				transition: `background-color ${token.motionDurationSlow} ease`,
				borderRadius: token.borderRadiusSM,
				"&-group": {
					color: token.colorTextDescription,
					fontSize: token.fontSizeSM,
					cursor: "default"
				},
				"&-option": {
					display: "flex",
					"&-content": {
						flex: "auto",
						...textEllipsis
					},
					"&-state": {
						flex: "none",
						display: "flex",
						alignItems: "center"
					},
					[`&-selected:not(${selectItemCls}-option-disabled)`]: {
						color: token.optionSelectedColor,
						fontWeight: token.optionSelectedFontWeight,
						backgroundColor: token.optionSelectedBg,
						[`${selectItemCls}-option-state`]: { color: token.colorPrimary }
					},
					[`&-active:not(${selectItemCls}-option-disabled)`]: { backgroundColor: token.optionActiveBg },
					[`&-selected${selectItemCls}-option-active:not(${selectItemCls}-option-disabled)`]: { backgroundColor: token.controlItemBgActiveHover },
					"&-disabled": {
						[`&${selectItemCls}-option-selected`]: { backgroundColor: token.colorBgContainerDisabled },
						color: token.colorTextDisabled,
						cursor: "not-allowed"
					},
					"&-grouped": { paddingInlineStart: token.calc(token.controlPaddingHorizontal).mul(2).equal() }
				},
				"&-empty": {
					...genItemStyle(token),
					color: token.colorTextDisabled
				}
			},
			[`${selectedItemCls}:has(+ ${selectedItemCls})`]: {
				borderEndStartRadius: 0,
				borderEndEndRadius: 0,
				[`& + ${selectedItemCls}`]: {
					borderStartStartRadius: 0,
					borderStartEndRadius: 0
				}
			},
			"&-rtl": { direction: "rtl" }
		} },
		initSlideMotion(token, "slide-up"),
		initSlideMotion(token, "slide-down"),
		initMoveMotion(token, "move-up"),
		initMoveMotion(token, "move-down")
	];
};
var dropdown_default = genSingleStyle;

//#endregion
export { dropdown_default as default };