import { weekListText } from "../../state.js";
import { formatDate, getCurrentStatus, getMonthIndex } from "../../../../utils.js";
import Item from "../../Item/index.js";
import { useEffect, useState } from "react";
import { Space } from "antd";
import { Iconfont } from "@pisell/materials";
import "./index.less";
//#region src/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.tsx
const WeekItem = (props) => {
	const { weekList, currentDate, setCurrentDate, isActive, productId, dateLimitData, getLimitData, cutTime } = props;
	const [monthIndex, setMonthIndex] = useState([]);
	useEffect(() => {
		if (isActive && productId) {}
	}, [
		isActive,
		productId,
		weekList
	]);
	useEffect(() => {
		setMonthIndex(getMonthIndex(weekList));
	}, [weekList]);
	return /* @__PURE__ */ React.createElement("div", { className: "week-item-wrap" }, /* @__PURE__ */ React.createElement("div", { className: "week-item-content" }, /* @__PURE__ */ React.createElement(Iconfont, {
		type: "pisell2-arrow-left",
		className: "week-item__icon"
	}), /* @__PURE__ */ React.createElement(Space, { size: 8 }, weekList === null || weekList === void 0 ? void 0 : weekList.map((item, index) => {
		const { disabled, currentStatus } = getCurrentStatus(dateLimitData, item, cutTime);
		return /* @__PURE__ */ React.createElement(Item, {
			key: index,
			date: formatDate(item, "DD"),
			week: weekListText[index],
			dateText: item,
			disabled,
			status: currentStatus,
			select: currentDate === item,
			showMonth: monthIndex.includes(index),
			onClick: (e) => {
				setCurrentDate(item);
			}
		});
	})), /* @__PURE__ */ React.createElement(Iconfont, {
		type: "pisell2-arrow-right",
		className: "week-item__icon"
	})));
};
//#endregion
export { WeekItem as default };
