import { PREFIX } from "../../status.js";
import React, { useMemo } from "react";
import { Statistic } from "antd";
import { locales } from "@pisell/utils";
import "./index.less";
//#region src/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.tsx
const { Countdown: AntdCountdown } = Statistic;
const Countdown = ({ props }) => {
	const { dataSource, skuTextConfig } = props;
	const { isOpen, fontSize, fontWeight, color, customText } = (skuTextConfig === null || skuTextConfig === void 0 ? void 0 : skuTextConfig.skuCountdownConfig) || {};
	if (!isOpen) return null;
	if (customText) return customText;
	const finalStyle = useMemo(() => {
		return {
			fontSize,
			fontWeight,
			color
		};
	}, [
		fontSize,
		fontWeight,
		color
	]);
	return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.countdown) ? /* @__PURE__ */ React.createElement("div", {
		className: `${PREFIX}__card-countdown`,
		style: finalStyle
	}, /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.sku-card.time.remaining"), ": "), /* @__PURE__ */ React.createElement(AntdCountdown, {
		value: dataSource === null || dataSource === void 0 ? void 0 : dataSource.countdown,
		format: "HH:mm:ss",
		valueStyle: finalStyle
	})) : null;
};
//#endregion
export { Countdown as default };
