"use client";
import { cn } from "./index3.js";
import { getEventDuration, getEventHour, parseEventDate } from "./index57.js";
import { EventBlock } from "./index60.js";
import { resolveOverlaps } from "./index61.js";
import * as React from "react";
import { jsx } from "react/jsx-runtime";
import { isSameDay, isWeekend } from "date-fns";
//#region src/components/molecules/data/Calendar/_shared/DayColumn.tsx
function DayColumn({ date, events, dayEvents: dayEventsProp, startHour, endHour, onEventClick, className }) {
	const dayEvents = dayEventsProp ?? events.filter((event) => isSameDay(parseEventDate(event.start), date));
	const positioned = React.useMemo(() => resolveOverlaps(dayEvents), [dayEvents]);
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "day-column",
		className: cn("relative h-full border-l border-border/50", isWeekend(date) && "bg-surface-1", className),
		children: positioned.map(({ event, column, totalColumns }) => {
			const eventStart = getEventHour(event.start);
			const duration = getEventDuration(event.start, event.end);
			if (eventStart >= endHour || eventStart + duration <= startHour) return null;
			return /* @__PURE__ */ jsx(EventBlock, {
				event,
				top: Math.max(0, (eventStart - startHour) * 96),
				height: Math.min(duration * 96, (endHour - Math.max(eventStart, startHour)) * 96),
				onClick: onEventClick,
				className: "mx-0.5",
				style: {
					width: `${100 / totalColumns}%`,
					left: `${column / totalColumns * 100}%`
				}
			}, event.id);
		})
	});
}
DayColumn.displayName = "DayColumn";
//#endregion
export { DayColumn };

//# sourceMappingURL=index63.js.map