const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_utils = require("./utils.js");
let react = require("react");
react = require_runtime.__toESM(react);
let ahooks = require("ahooks");
//#region src/components/pisellCountdown/index.tsx
const _excluded = [
	"leftTime",
	"targetDate",
	"interval",
	"onChange",
	"onFinish",
	"format"
];
const PisellCountdown = (props) => {
	const { leftTime, targetDate, interval, onChange, onFinish, format = "HH:mm:ss" } = props, others = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const [countdown] = (0, ahooks.useCountDown)(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, leftTime ? { leftTime } : {}), {}, {
		targetDate,
		interval,
		onEnd: () => {
			onFinish === null || onFinish === void 0 || onFinish();
		}
	}));
	(0, ahooks.useUpdateEffect)(() => {
		onChange === null || onChange === void 0 || onChange(countdown);
	}, [countdown]);
	return /* @__PURE__ */ react.default.createElement("span", others, require_utils.formatTimeStr(countdown, format || "HH:mm:ss"));
};
//#endregion
exports.default = PisellCountdown;
