const require_runtime = require("../../../../../../_virtual/_rolldown/runtime.js");
const require_status = require("../../status.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_materials = require("@pisell/materials");
require("./index.less");
//#region src/plus/productSelect/ProductCard/SkuCard/components/Favorite/index.tsx
const PADDING = 4;
const Favorite = ({ props }) => {
	const { skuExtraConfig, className, dataSource, onFavorite } = props;
	const { isOpen, favoritePosition, favoriteIcon, favoriteBackground, favoritePaddingY, favoritePaddingX, favoriteRadius, isFavoriteBorder, favoriteBorderWidth, favoriteBorderColor, isFavorite } = skuExtraConfig || {};
	if (!isOpen || !isFavorite) return null;
	const finalStyle = (0, react.useMemo)(() => {
		const isLeft = favoritePosition === "left_top" || favoritePosition === "left_bottom";
		const isRight = favoritePosition === "right_top" || favoritePosition === "right_bottom";
		const isTop = favoritePosition === "left_top" || favoritePosition === "right_top";
		const isBottom = favoritePosition === "left_bottom" || favoritePosition === "right_bottom";
		return {
			background: favoriteBackground,
			padding: `${favoritePaddingY}px ${favoritePaddingX}px`,
			border: isFavoriteBorder ? `${favoriteBorderWidth}px solid ${favoriteBorderColor}` : "none",
			borderRadius: `${favoriteRadius}px`,
			top: isTop ? PADDING : "auto",
			bottom: isBottom ? PADDING : "auto",
			left: isLeft ? PADDING : "auto",
			right: isRight ? PADDING : "auto"
		};
	}, [
		favoriteBackground,
		favoritePaddingX,
		favoritePaddingY,
		isFavoriteBorder,
		favoriteBorderWidth,
		favoriteBorderColor,
		favoriteRadius,
		favoritePosition
	]);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: `${require_status.PREFIX}__card-favorite  ${className}`,
		style: finalStyle,
		onClick: (e) => {
			e.stopPropagation();
			onFavorite === null || onFavorite === void 0 || onFavorite(dataSource);
		}
	}, favoriteIcon || /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
		type: "HeartFilled",
		size: 20,
		rotate: 0,
		spin: false,
		color: "#DC6803"
	}));
};
//#endregion
exports.default = Favorite;
