const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_model = require("../../model.js");
const require_serve = require("./serve.js");
const require_utils = require("./utils.js");
let dayjs = require("dayjs");
dayjs = require_runtime.__toESM(dayjs);
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let ahooks = require("ahooks");
require("./index.less");
//#region src/components/schedules/components/CurrentDay/index.tsx
const CurrentDay = (props) => {
	var _state$currentSelectD;
	const { onClose, currentDay } = props;
	const { state, dispatch } = (0, react.useContext)(require_model.Context);
	const _getOpenHoursByDate = (0, ahooks.useRequest)(require_serve.getOpenHoursByDate, {
		manual: true,
		onSuccess: ({ data }) => {
			dispatch({
				type: "setState",
				payload: { currentSelectDayDetail: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, state.currentSelectDayDetail), {}, {
					times: data,
					timeStr: require_utils.getTimeRange(data)
				}) }
			});
		}
	});
	(0, react.useEffect)(() => {
		if (currentDay) _getOpenHoursByDate.run({ date: (0, dayjs.default)(currentDay).format("YYYY-MM-DD") });
	}, [currentDay]);
	return currentDay ? /* @__PURE__ */ react.default.createElement(antd.Alert, {
		onClose,
		closable: true,
		className: "current-day-alert",
		message: (0, dayjs.default)(currentDay).format("ddd MMMM YYYY"),
		description: ((_state$currentSelectD = state.currentSelectDayDetail) === null || _state$currentSelectD === void 0 ? void 0 : _state$currentSelectD.timeStr) || " "
	}) : null;
};
//#endregion
exports.default = CurrentDay;
