const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_formatTime = require("../../pisellDateTimeDisplay/utils/formatTime.js");
const require_formatDateOrRelative = require("../../pisellDateTimeDisplay/utils/formatDateOrRelative.js");
let react = require("react");
react = require_runtime.__toESM(react);
let dayjs = require("dayjs");
dayjs = require_runtime.__toESM(dayjs);
//#region src/components/pisellTimeRangeDisplay/components/TimeRangeBlock.tsx
/**
* 时间区间展示块
* - 同一天：HH:mm-HH:mm
* - 跨天：起止完整日期时间；若某端为相对日（今天/昨天/明天）则只显示「时间 相对日」，不显示星期+日期
*/
const TimeRangeBlock = ({ start, end, isSameDay, timeFormat, dateFormat, weekdayFormat, referenceDate = (0, dayjs.default)(), style, className }) => {
	const inlineStyle = {
		fontSize: style === null || style === void 0 ? void 0 : style.fontSize,
		fontWeight: style === null || style === void 0 ? void 0 : style.fontWeight,
		color: style === null || style === void 0 ? void 0 : style.color,
		lineHeight: style === null || style === void 0 ? void 0 : style.lineHeight
	};
	if (isSameDay) {
		const startStr = require_formatTime.formatTime(start, timeFormat);
		const endStr = require_formatTime.formatTime(end, timeFormat);
		return /* @__PURE__ */ react.default.createElement("span", {
			className: `pisell-time-range-display-time ${className || ""}`.trim(),
			style: inlineStyle
		}, /* @__PURE__ */ react.default.createElement("span", { className: "pisell-time-range-display-time-start" }, startStr), /* @__PURE__ */ react.default.createElement("span", { className: "pisell-time-range-display-time-end-wrap" }, /* @__PURE__ */ react.default.createElement("span", {
			className: "pisell-time-range-display-time-sep",
			"aria-hidden": true
		}, " - "), /* @__PURE__ */ react.default.createElement("span", { className: "pisell-time-range-display-time-end" }, endStr)));
	}
	const dateFormatOverride = {
		order: "DMY",
		shortMonth: true,
		showYear: start.year() !== end.year(),
		showMonth: true,
		showDay: true,
		useCommaBeforeYear: false
	};
	const startTimeStr = require_formatTime.formatTime(start, timeFormat);
	const endTimeStr = require_formatTime.formatTime(end, timeFormat);
	const startDatePart = require_formatDateOrRelative.getDatePartDisplay({
		date: start,
		dateFormat,
		weekdayFormat,
		referenceDate,
		dateFormatOverride
	});
	const endDatePart = require_formatDateOrRelative.getDatePartDisplay({
		date: end,
		dateFormat,
		weekdayFormat,
		referenceDate,
		dateFormatOverride
	});
	const startPart = `${startTimeStr} ${startDatePart}`;
	const endPart = `${endTimeStr} ${endDatePart}`;
	const timeClass = "pisell-time-range-display-time pisell-time-range-display-time-cross";
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", {
		key: "time-start",
		className: `${timeClass} ${className || ""}`.trim(),
		style: inlineStyle
	}, startPart), /* @__PURE__ */ react.default.createElement("span", {
		key: "time-end",
		className: `${timeClass} ${className || ""}`.trim(),
		style: inlineStyle
	}, " - ", endPart));
};
//#endregion
exports.default = TimeRangeBlock;
