const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_utils = require("../../utils.js");
const require_context = require("../../context.js");
const require_DateNavigator = require("./components/DateNavigator.js");
const require_DayTabs = require("./components/DayTabs.js");
const require_CourtFilter = require("./components/CourtFilter.js");
const require_TimeGrid = require("./components/TimeGrid.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
//#region src/components/venueBooking/components/VenueSelection/index.tsx
/**
* venueBooking 场地选择步骤（Step 1）
* 包含日期导航、周视图、场地筛选、价格图例、时段网格等子组件
*/
function VenueSelection() {
	const { setAnchorDate, anchorDate, fetchWeekData } = require_context.useVenueBookingContext();
	const tableSectionRef = (0, react.useRef)(null);
	/** 翻周时：更新 anchorDate + 拉取新一周的资源可用性数据 */
	const navigateWeek = (0, react.useCallback)(function() {
		var _ref = require_asyncToGenerator._asyncToGenerator(function* (offset) {
			const newAnchor = anchorDate.add(offset, "day");
			setAnchorDate(newAnchor);
			const days = require_utils.getWeekDays(newAnchor);
			yield fetchWeekData(require_utils.formatDateKey(days[0]), require_utils.formatDateKey(days[days.length - 1]));
		});
		return function(_x) {
			return _ref.apply(this, arguments);
		};
	}(), [
		anchorDate,
		setAnchorDate,
		fetchWeekData
	]);
	function goPrevWeek() {
		navigateWeek(-7);
	}
	function goNextWeek() {
		navigateWeek(7);
	}
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "rounded-b-[24px] bg-white p-3 shadow-[0_10px_40px_rgba(20,20,20,0.06)] ring-1 ring-black/6 md:rounded-[28px] md:p-6" }, /* @__PURE__ */ react.default.createElement("div", { className: "flex flex-col gap-2 xl:flex-row xl:items-center xl:justify-between" }, /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("h2", { className: "text-2xl font-extrabold leading-tight text-zinc-900 md:text-[30px]" }, _pisell_utils.locales.getText("pisell2.venue.step1.title") || "选择场地"), /* @__PURE__ */ react.default.createElement("p", { className: "mt-1 text-xs leading-5 text-zinc-500 md:mt-2 md:text-sm md:leading-6" }, _pisell_utils.locales.getText("pisell2.venue.step1.subtitle") || "仅显示可用时段和价格。")), /* @__PURE__ */ react.default.createElement(require_DateNavigator.default, {
		onPrevWeek: goPrevWeek,
		onNextWeek: goNextWeek
	})), /* @__PURE__ */ react.default.createElement("div", { className: "mt-3 md:mt-5" }, /* @__PURE__ */ react.default.createElement(require_DayTabs.default, {
		onPrevWeek: goPrevWeek,
		onNextWeek: goNextWeek
	})), /* @__PURE__ */ react.default.createElement(require_CourtFilter.default, null)), /* @__PURE__ */ react.default.createElement("div", {
		ref: tableSectionRef,
		className: "w-full max-w-full isolate rounded-[28px] bg-white shadow-[0_10px_40px_rgba(20,20,20,0.06)] ring-1 ring-black/6"
	}, /* @__PURE__ */ react.default.createElement(require_TimeGrid.default, null)));
}
//#endregion
exports.default = VenueSelection;
