import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { floorRoomCardGuestSegments, formatFloorRoomCardBookingTimeRange, getFloorRoomCardExplicitNextBooking, getFloorRoomCardPrimaryBooking, getFloorRoomCardReservedRowBodyType, getFloorRoomCardType, reorderBookingsAllReservedChronological, resolveFloorRoomCardProgressPercent } from "./floorRoomCardUtils.js";
import { floorRoomCardBookingCheckoutDomKey } from "./floorRoomCardDom.js";
import { floorRoomCardPaymentUiFromOrderStatus } from "./floorRoomCardPaymentUi.js";
import { buildRoomCardBodyViewModel } from "./buildCardBodyViewModel.js";
import { FloorRoomCardDensityContext, isFloorRoomCardTooltipDensity, useFloorRoomCardDensity } from "./floorRoomCardDensity.js";
import { FloorRoomCardLayoutContext, useFloorRoomCardLayoutOptions } from "./floorRoomCardLayoutOptions.js";
import { floorRoomCardStatusTagLabel, formatRoomCapLine } from "./floorRoomCardHeaderFormat.js";
import { RoomCardBodyView, RoomCardNextBookingStrip } from "./views/RoomCardBodyView.js";
import { RoomCardHeaderView } from "./views/RoomCardHeaderView.js";
import { RoomCardShellView } from "./views/RoomCardShellView.js";
import { RoomCardTooltipTimeLayout, RoomCardTooltipTitleOnlyLayout, appendBookingCountSuffix } from "./views/RoomCardTooltipTimeLayout.js";
import React, { useState } from "react";
import { locales } from "@pisell/utils";
import { PisellModal } from "@pisell/materials";
import classNames from "classnames";
import "./ReservationFloorRoomCard.less";
//#region src/plus/pisellReservation/floorRoomCard/FloorRoomCardFromData.tsx
/**
* 由 {@link FloorRoomCardData} 渲染 RoomCard 内容（Shell + HeaderView + BodyView），
* 不含根节点 `pisell-res-floor-room-card`、不含每分钟 tick；平面图容器与弹窗分别外包。
*/
const _excluded = ["discUnifiedLayoutEnabled", "tooltipTimeDensityEnabled"];
const I18N_STATUS_LOCK = "pisell-reservation.room-status-locked";
const I18N_VIEW_ALL = "pisell-reservation.room-view-all";
const I18N_MODAL_BOOKINGS = "pisell-reservation.room-modal-bookings";
const I18N_NEXT = "pisell-reservation.room-next-prefix";
function i18nN(key, n) {
	return locales.getText(key).replace(/\{n\}/g, String(n));
}
/**
* 房间卡 body / 多预约列表用的「让画布 pan 让位」事件处理。
*
* 历史版本对 pointer / mouse / touch / wheel 全部做了 `stopPropagation`，初衷是触屏纵向滑动卡片
* 列表时不要被 react-zoom-pan-pinch 的画布拖拽抢走。但 react-zoom-pan-pinch 的鼠标 pan 是
* `window.addEventListener('mousedown', ...)`，React 的 `stopPropagation()` 会同步停掉原生事件
* 冒泡——结果在桌面端，鼠标按在任何卡上都启动不了画布 pan，只有空白处能拖动画布。
*
* 拆分后的策略：
* - 触屏（touchstart/move/end）继续拦——这才是会和卡内 `touch-action: pan-y` 滚动起冲突的路径，
*   也是把卡内列表滚动让给原生 scroll 而不是被画布 pan 抢走的关键；
* - 滚轮（wheel）继续拦——避免卡内滚轮滚动列表时被画布缩放劫持；
* - 鼠标 / 通用指针事件不再拦——桌面用户依然能从图元上按下并拖动画布。
*
* 触屏侧的「按下时禁止画布 pan」由 `ItemLayer.handleItemPointerDownCapture` 配合
* `data-pisell-floor-room-scroll-surface` 数据属性单独完成（仅对 `pointerType==='touch'` 生效）。
*/
const floorCardStopCanvasPanHandlers = {
	onTouchStart: (e) => e.stopPropagation(),
	onTouchMove: (e) => e.stopPropagation(),
	onTouchEnd: (e) => e.stopPropagation(),
	onWheel: (e) => e.stopPropagation()
};
function scheduleCloseViewAllBookingsModal(setOpen, e) {
	var _e$nativeEvent, _e$nativeEvent$stopIm;
	e === null || e === void 0 || e.stopPropagation();
	e === null || e === void 0 || (_e$nativeEvent = e.nativeEvent) === null || _e$nativeEvent === void 0 || (_e$nativeEvent$stopIm = _e$nativeEvent.stopImmediatePropagation) === null || _e$nativeEvent$stopIm === void 0 || _e$nativeEvent$stopIm.call(_e$nativeEvent);
	window.setTimeout(() => setOpen(false), 50);
}
const FLOOR_CARD_VIEW_ALL_MODAL_MASK_PROPS = {
	onMouseDown: (e) => e.stopPropagation(),
	onClick: (e) => e.stopPropagation()
};
/** 与 `ReservationFloorRoomCard.less` 中 `.pisell-lowcode-modal-body` padding 配套 */
const FLOOR_CARD_VIEW_ALL_MODAL_WRAP_CLASS = "pisell-res-floor-view-all-modal-wrap";
const MULTI_PREVIEW_MAX = 3;
const CIRCLE_MULTI_MORE_BTN_RESERVE_PX = 46;
function circleMultiCompactRowEst(innerDiameterPx) {
	return Math.round(Math.max(42, Math.min(64, innerDiameterPx * .15)));
}
function resolveCircleMultiPreviewCount(shellShape, bookingCount, layoutHeightPx, density) {
	if (bookingCount < 1) return 0;
	/** micro：不展开多条预览条（摘要态）；mini 与 compact 一致参与预览计数 */
	if (density === "micro") return 0;
	if (shellShape !== "circle") return Math.min(MULTI_PREVIEW_MAX, bookingCount);
	const H = layoutHeightPx != null && Number.isFinite(layoutHeightPx) && layoutHeightPx > 0 ? layoutHeightPx : null;
	if (H == null || H < 48) return bookingCount > MULTI_PREVIEW_MAX ? 1 : Math.min(MULTI_PREVIEW_MAX, bookingCount);
	const padY = Math.round(Math.max(7, Math.min(18, H * .065)));
	const inner = Math.max(0, H - padY * 2);
	const headerReserve = Math.min(115, Math.max(54, inner * .35));
	const listMax = Math.max(0, inner - headerReserve - 10);
	const moreH = CIRCLE_MULTI_MORE_BTN_RESERVE_PX;
	const rowEst = circleMultiCompactRowEst(inner);
	const topK = Math.min(MULTI_PREVIEW_MAX, bookingCount);
	if (listMax < moreH && bookingCount > topK) return 0;
	let circleChosen = 0;
	for (let k = topK; k >= 0; k--) {
		const needMore = bookingCount > k;
		if (k * rowEst + (needMore ? moreH + (k > 0 ? 6 : 0) : 0) <= listMax) {
			circleChosen = k;
			break;
		}
	}
	return circleChosen;
}
function effectiveRoomTitle(data, headerMainFieldOverride) {
	return (headerMainFieldOverride === null || headerMainFieldOverride === void 0 ? void 0 : headerMainFieldOverride.trim()) || data.main_field;
}
function CardHeader(props) {
	const { data, occupancyBookings, hideCapacity = false, headerMainFieldOverride, paymentUnpaidFill = false } = props;
	const bookingsForOcc = occupancyBookings !== void 0 ? occupancyBookings : data.bookings;
	const capLabel = hideCapacity ? null : formatRoomCapLine(data, bookingsForOcc);
	return /* @__PURE__ */ React.createElement(RoomCardHeaderView, {
		roomTitle: effectiveRoomTitle(data, headerMainFieldOverride),
		capacityLine: capLabel,
		status: data.status,
		statusLabel: floorRoomCardStatusTagLabel(data.status),
		paymentUnpaidFill,
		bookingCount: data.bookingCount,
		completeBookingCount: data.completeBookingCount
	});
}
function buildRoomViewAllModalTitle(data, bookingsForOcc, headerMainFieldOverride) {
	const capLabel = formatRoomCapLine(data, bookingsForOcc);
	const n = bookingsForOcc.length;
	const bookingsLine = i18nN(I18N_MODAL_BOOKINGS, n);
	/**
	* 标题首段桌名后追加 `(completeBookingCount/bookingCount)`，与卡片头、预约详情
	* Modal 同一套 `appendBookingCountSuffix`——确保三处计数格式与口径完全一致。
	* `bookingCount` 缺失/为 0 时 helper 自然不追加，View All 仍退回 `桌名 · …`。
	*/
	const head = appendBookingCountSuffix(effectiveRoomTitle(data, headerMainFieldOverride), data);
	return /* @__PURE__ */ React.createElement("div", { className: "rc-view-all-modal-title" }, head, " · ", bookingsLine, " · ", capLabel);
}
function CardBody(props) {
	const { cardType, booking, data, compact = false, shellShape = "rect", bodyStatusTag } = props;
	/** 正文只保留「标准大卡」；mini/micro 仅走 Tooltip 壳，不走 RoomCardBodyView */
	const model = buildRoomCardBodyViewModel({
		cardType,
		booking,
		data,
		compact,
		shellShape,
		nowMs: Date.now(),
		floorDensity: "comfortable"
	});
	return /* @__PURE__ */ React.createElement(RoomCardBodyView, {
		model,
		scrollSurfaceHandlers: floorCardStopCanvasPanHandlers,
		nextBookingPrefix: locales.getText(I18N_NEXT),
		bodyStatusTag,
		pinProgressToBottom: shellShape !== "circle"
	});
}
const CARD_CLASS = {
	not_arrived: "rc rc--reserved",
	late: "rc rc--reserved",
	payed: "rc rc--occupied",
	payment_required: "rc rc--occupied rc--occupied-pay",
	timeout: "rc rc--occupied rc--occupied-timeout"
};
function StandardCard(props) {
	const { data, cardType, hideHeader = false, hideHeaderCapacity = false, headerMainFieldOverride, shellShape = "rect", bodyStatusTag } = props;
	const density = useFloorRoomCardDensity();
	const { discUnifiedLayoutEnabled, tooltipTimeDensityEnabled } = useFloorRoomCardLayoutOptions();
	const booking = getFloorRoomCardPrimaryBooking(data);
	if (!booking) return /* @__PURE__ */ React.createElement(EmptyCard, {
		data,
		shellShape,
		hideHeaderCapacity,
		headerMainFieldOverride
	});
	const isOccupied = cardType === "payed" || cardType === "payment_required" || cardType === "timeout";
	const paymentKind = floorRoomCardPaymentUiFromOrderStatus(booking.order_payment_status);
	/** 大卡与 Tooltip 极简分支：方桌仅 micro；圆桌 mini/micro（见 isFloorRoomCardTooltipDensity） */
	const paymentUnpaidFill = isOccupied && paymentKind === "unpaid" && shellShape === "circle" && discUnifiedLayoutEnabled;
	if (tooltipTimeDensityEnabled && isFloorRoomCardTooltipDensity(density, shellShape)) {
		var _data$bookings$length, _data$bookings;
		const showRectEdgeProgress = shellShape === "rect" && isOccupied && ((_data$bookings$length = (_data$bookings = data.bookings) === null || _data$bookings === void 0 ? void 0 : _data$bookings.length) !== null && _data$bookings$length !== void 0 ? _data$bookings$length : 0) === 1;
		return /* @__PURE__ */ React.createElement(RoomCardShellView, {
			className: classNames(CARD_CLASS[cardType], "rc--tooltip-time"),
			shellShape,
			checkoutBookingKey: floorRoomCardBookingCheckoutDomKey(booking),
			tooltipTimeStandaloneMain: true
		}, /* @__PURE__ */ React.createElement(RoomCardTooltipTimeLayout, {
			data,
			booking,
			cardType,
			shellShape,
			hideInnerLinearProgress: showRectEdgeProgress,
			headerMainFieldOverride,
			scrollSurfaceHandlers: floorCardStopCanvasPanHandlers
		}));
	}
	return /* @__PURE__ */ React.createElement(RoomCardShellView, {
		className: CARD_CLASS[cardType],
		shellShape,
		checkoutBookingKey: floorRoomCardBookingCheckoutDomKey(booking),
		header: hideHeader ? void 0 : /* @__PURE__ */ React.createElement(CardHeader, {
			data,
			hideCapacity: hideHeaderCapacity,
			headerMainFieldOverride,
			paymentUnpaidFill
		})
	}, /* @__PURE__ */ React.createElement(CardBody, {
		cardType,
		booking,
		data,
		shellShape,
		bodyStatusTag
	}));
}
function EmptyCard(props) {
	const { data, hideHeader, hideHeaderCapacity, headerMainFieldOverride, shellShape = "rect" } = props;
	const density = useFloorRoomCardDensity();
	const { tooltipTimeDensityEnabled } = useFloorRoomCardLayoutOptions();
	if (tooltipTimeDensityEnabled && isFloorRoomCardTooltipDensity(density, shellShape)) return /* @__PURE__ */ React.createElement(RoomCardShellView, {
		className: "rc rc--empty rc--tooltip-time",
		shellShape,
		tooltipTimeStandaloneMain: true
	}, /* @__PURE__ */ React.createElement(RoomCardTooltipTitleOnlyLayout, {
		data,
		headerMainFieldOverride,
		scrollSurfaceHandlers: floorCardStopCanvasPanHandlers
	}));
	return /* @__PURE__ */ React.createElement(RoomCardShellView, {
		className: "rc rc--empty",
		shellShape,
		header: hideHeader ? void 0 : /* @__PURE__ */ React.createElement(CardHeader, {
			data,
			hideCapacity: hideHeaderCapacity,
			headerMainFieldOverride
		})
	});
}
function MultiOccupiedCard(props) {
	const { data, shellShape = "rect", elementLayoutHeightPx, hideHeader = false, hideHeaderCapacity, headerMainFieldOverride } = props;
	const density = useFloorRoomCardDensity();
	const [modalOpen, setModalOpen] = useState(false);
	const mainBookings = data.bookings.filter((b) => b.isNext !== true);
	const listForPreview = mainBookings.length > 0 ? mainBookings : data.bookings;
	const explicitNextOcc = getFloorRoomCardExplicitNextBooking(data);
	const n = listForPreview.length;
	const previewCount = resolveCircleMultiPreviewCount(shellShape, n, elementLayoutHeightPx, density);
	const preview = listForPreview.slice(0, previewCount);
	const hasMore = n > preview.length;
	const occPaymentKind = data.sub_status === "payed" ? "paid" : "unpaid";
	const { discUnifiedLayoutEnabled } = useFloorRoomCardLayoutOptions();
	const multiOccPaymentUnpaidFill = occPaymentKind === "unpaid" && (isFloorRoomCardTooltipDensity(density, shellShape) || shellShape === "circle" && discUnifiedLayoutEnabled);
	const occupiedModal = /* @__PURE__ */ React.createElement(PisellModal, {
		open: modalOpen,
		onCancel: (e) => scheduleCloseViewAllBookingsModal(setModalOpen, e),
		maskProps: FLOOR_CARD_VIEW_ALL_MODAL_MASK_PROPS,
		focusTriggerAfterClose: false,
		wrapClassName: FLOOR_CARD_VIEW_ALL_MODAL_WRAP_CLASS,
		title: buildRoomViewAllModalTitle(data, data.bookings, headerMainFieldOverride),
		footer: null,
		destroyOnClose: true,
		width: 560
	}, /* @__PURE__ */ React.createElement(FloorRoomCardDensityContext.Provider, { value: "comfortable" }, /* @__PURE__ */ React.createElement("div", { className: classNames("pisell-res-floor-room-card", "pisell-res-floor-room-card--modal-shell") }, /* @__PURE__ */ React.createElement("div", { className: "rc--occupied rc--multi" }, /* @__PURE__ */ React.createElement("div", _objectSpread2({ className: "rc-multi-modal-body" }, floorCardStopCanvasPanHandlers), data.bookings.map((b, bi) => {
		const perType = resolveFloorRoomCardProgressPercent(b) >= 100 ? "timeout" : data.sub_status === "payed" ? "payed" : "payment_required";
		return /* @__PURE__ */ React.createElement(CardBody, {
			key: `${floorRoomCardBookingCheckoutDomKey(b)}-${bi}`,
			cardType: perType,
			booking: b,
			data,
			compact: true,
			shellShape: "rect"
		});
	}))))));
	if (density === "micro") {
		const title = effectiveRoomTitle(data, headerMainFieldOverride);
		return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RoomCardShellView, {
			className: classNames("rc rc--occupied rc--multi", modalOpen && "rc--floor-detail-open"),
			shellShape,
			header: hideHeader ? void 0 : /* @__PURE__ */ React.createElement(CardHeader, {
				data,
				occupancyBookings: data.bookings,
				hideCapacity: hideHeaderCapacity,
				headerMainFieldOverride,
				paymentUnpaidFill: multiOccPaymentUnpaidFill
			})
		}, /* @__PURE__ */ React.createElement("div", _objectSpread2({
			className: "rc-multi-micro-summary",
			"data-pisell-floor-room-scroll-surface": ""
		}, floorCardStopCanvasPanHandlers), /* @__PURE__ */ React.createElement("span", { className: "rc-multi-micro-summary__text" }, title, " · ", "×", data.bookings.length), /* @__PURE__ */ React.createElement("button", {
			type: "button",
			className: "rc-multi-more",
			onClick: (e) => {
				e.stopPropagation();
				setModalOpen(true);
			}
		}, i18nN(I18N_VIEW_ALL, data.bookings.length)))), occupiedModal);
	}
	return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RoomCardShellView, {
		className: classNames("rc rc--occupied rc--multi", modalOpen && "rc--floor-detail-open"),
		shellShape,
		header: hideHeader ? void 0 : /* @__PURE__ */ React.createElement(CardHeader, {
			data,
			occupancyBookings: data.bookings,
			hideCapacity: hideHeaderCapacity,
			headerMainFieldOverride,
			paymentUnpaidFill: multiOccPaymentUnpaidFill
		})
	}, /* @__PURE__ */ React.createElement("div", _objectSpread2({
		className: "rc-multi-list",
		"data-pisell-floor-room-scroll-surface": ""
	}, floorCardStopCanvasPanHandlers), preview.map((b) => {
		const perType = resolveFloorRoomCardProgressPercent(b) >= 100 ? "timeout" : data.sub_status === "payed" ? "payed" : "payment_required";
		return /* @__PURE__ */ React.createElement(CardBody, {
			key: floorRoomCardBookingCheckoutDomKey(b),
			cardType: perType,
			booking: b,
			data,
			compact: true,
			shellShape
		});
	}), explicitNextOcc && density !== "micro" && !hasMore ? /* @__PURE__ */ React.createElement(RoomCardNextBookingStrip, {
		nextLabel: locales.getText(I18N_NEXT),
		guestSegments: density !== "micro" ? floorRoomCardGuestSegments(explicitNextOcc, true) : [],
		timeRange: formatFloorRoomCardBookingTimeRange(explicitNextOcc)
	}) : null, hasMore ? /* @__PURE__ */ React.createElement("button", {
		type: "button",
		className: "rc-multi-more",
		onClick: (e) => {
			e.stopPropagation();
			setModalOpen(true);
		}
	}, i18nN(I18N_VIEW_ALL, data.bookings.length)) : null)), occupiedModal);
}
function MultiReservedCard(props) {
	const { data, shellShape = "rect", elementLayoutHeightPx, hideHeader = false, hideHeaderCapacity, headerMainFieldOverride } = props;
	const density = useFloorRoomCardDensity();
	const [modalOpen, setModalOpen] = useState(false);
	const sorted = reorderBookingsAllReservedChronological([...data.bookings]);
	const mainReserved = sorted.filter((b) => b.isNext !== true);
	const listForReservedPreview = mainReserved.length > 0 ? mainReserved : sorted;
	const explicitNextRes = getFloorRoomCardExplicitNextBooking(data);
	const n = listForReservedPreview.length;
	const previewCount = resolveCircleMultiPreviewCount(shellShape, n, elementLayoutHeightPx, density);
	const preview = listForReservedPreview.slice(0, previewCount);
	const hasMore = n > preview.length;
	const nowMs = Date.now();
	const reservedModal = /* @__PURE__ */ React.createElement(PisellModal, {
		open: modalOpen,
		onCancel: (e) => scheduleCloseViewAllBookingsModal(setModalOpen, e),
		maskProps: FLOOR_CARD_VIEW_ALL_MODAL_MASK_PROPS,
		focusTriggerAfterClose: false,
		wrapClassName: FLOOR_CARD_VIEW_ALL_MODAL_WRAP_CLASS,
		title: buildRoomViewAllModalTitle(data, sorted, headerMainFieldOverride),
		footer: null,
		destroyOnClose: true,
		width: 560
	}, /* @__PURE__ */ React.createElement(FloorRoomCardDensityContext.Provider, { value: "comfortable" }, /* @__PURE__ */ React.createElement("div", { className: classNames("pisell-res-floor-room-card", "pisell-res-floor-room-card--modal-shell") }, /* @__PURE__ */ React.createElement("div", { className: "rc--reserved rc--multi" }, /* @__PURE__ */ React.createElement("div", _objectSpread2({ className: "rc-multi-modal-body" }, floorCardStopCanvasPanHandlers), sorted.map((b, bi) => /* @__PURE__ */ React.createElement(CardBody, {
		key: `${floorRoomCardBookingCheckoutDomKey(b)}-${bi}`,
		cardType: getFloorRoomCardReservedRowBodyType(b, Date.now()),
		booking: b,
		data,
		compact: true,
		shellShape: "rect"
	})))))));
	if (density === "micro") {
		const title = effectiveRoomTitle(data, headerMainFieldOverride);
		return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RoomCardShellView, {
			className: classNames("rc rc--reserved rc--multi", modalOpen && "rc--floor-detail-open"),
			shellShape,
			header: hideHeader ? void 0 : /* @__PURE__ */ React.createElement(CardHeader, {
				data,
				occupancyBookings: sorted,
				hideCapacity: hideHeaderCapacity,
				headerMainFieldOverride
			})
		}, /* @__PURE__ */ React.createElement("div", _objectSpread2({
			className: "rc-multi-micro-summary",
			"data-pisell-floor-room-scroll-surface": ""
		}, floorCardStopCanvasPanHandlers), /* @__PURE__ */ React.createElement("span", { className: "rc-multi-micro-summary__text" }, title, " · ", "×", sorted.length), /* @__PURE__ */ React.createElement("button", {
			type: "button",
			className: "rc-multi-more",
			onClick: (e) => {
				e.stopPropagation();
				setModalOpen(true);
			}
		}, i18nN(I18N_VIEW_ALL, sorted.length)))), reservedModal);
	}
	return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RoomCardShellView, {
		className: classNames("rc rc--reserved rc--multi", modalOpen && "rc--floor-detail-open"),
		shellShape,
		header: hideHeader ? void 0 : /* @__PURE__ */ React.createElement(CardHeader, {
			data,
			occupancyBookings: sorted,
			hideCapacity: hideHeaderCapacity,
			headerMainFieldOverride
		})
	}, /* @__PURE__ */ React.createElement("div", _objectSpread2({
		className: "rc-multi-list",
		"data-pisell-floor-room-scroll-surface": ""
	}, floorCardStopCanvasPanHandlers), preview.map((b) => {
		const perType = getFloorRoomCardReservedRowBodyType(b, nowMs);
		return /* @__PURE__ */ React.createElement(CardBody, {
			key: floorRoomCardBookingCheckoutDomKey(b),
			cardType: perType,
			booking: b,
			data,
			compact: true,
			shellShape
		});
	}), explicitNextRes && density !== "micro" && !hasMore ? /* @__PURE__ */ React.createElement(RoomCardNextBookingStrip, {
		nextLabel: locales.getText(I18N_NEXT),
		guestSegments: density !== "micro" ? floorRoomCardGuestSegments(explicitNextRes, true) : [],
		timeRange: formatFloorRoomCardBookingTimeRange(explicitNextRes)
	}) : null, hasMore ? /* @__PURE__ */ React.createElement("button", {
		type: "button",
		className: "rc-multi-more",
		onClick: (e) => {
			e.stopPropagation();
			setModalOpen(true);
		}
	}, i18nN(I18N_VIEW_ALL, sorted.length)) : null)), reservedModal);
}
function LockedCard(props) {
	const { data, hideHeader = false, hideHeaderCapacity, headerMainFieldOverride, shellShape = "rect" } = props;
	const capLabel = hideHeaderCapacity ? null : formatRoomCapLine(data, []);
	return /* @__PURE__ */ React.createElement(RoomCardShellView, {
		className: "rc rc--locked",
		shellShape,
		header: hideHeader ? void 0 : /* @__PURE__ */ React.createElement(RoomCardHeaderView, {
			roomTitle: effectiveRoomTitle(data, headerMainFieldOverride),
			capacityLine: capLabel,
			status: "locked",
			statusLabel: "",
			showStatusTag: false
		})
	}, /* @__PURE__ */ React.createElement("div", _objectSpread2({
		className: "rc-body rc-body--center",
		"data-pisell-floor-room-scroll-surface": ""
	}, floorCardStopCanvasPanHandlers), /* @__PURE__ */ React.createElement("div", { className: "rc-lock-icon" }, /* @__PURE__ */ React.createElement("svg", {
		width: "28",
		height: "28",
		viewBox: "0 0 24 24",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "1.5",
		strokeLinecap: "round",
		strokeLinejoin: "round"
	}, /* @__PURE__ */ React.createElement("rect", {
		x: "3",
		y: "11",
		width: "18",
		height: "11",
		rx: "2",
		ry: "2"
	}), /* @__PURE__ */ React.createElement("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" }))), /* @__PURE__ */ React.createElement("span", { className: "rc-locked-text" }, locales.getText(I18N_STATUS_LOCK))));
}
const SPECIAL_RENDERERS = {
	empty: EmptyCard,
	multi_occupied: MultiOccupiedCard,
	multi_reserved: MultiReservedCard,
	locked: LockedCard
};
function FloorRoomCardFromDataInner(props) {
	const { data, shellShape = "rect", elementLayoutHeightPx, hideHeader = false, hideHeaderCapacity = false, headerMainFieldOverride, bodyStatusTag } = props;
	const cardType = getFloorRoomCardType(data);
	const Special = SPECIAL_RENDERERS[cardType];
	if (Special) return /* @__PURE__ */ React.createElement(Special, {
		data,
		shellShape,
		elementLayoutHeightPx,
		hideHeader,
		hideHeaderCapacity,
		headerMainFieldOverride,
		bodyStatusTag
	});
	if (cardType in CARD_CLASS) return /* @__PURE__ */ React.createElement(StandardCard, {
		data,
		cardType,
		hideHeader,
		hideHeaderCapacity,
		headerMainFieldOverride,
		shellShape,
		bodyStatusTag
	});
	return /* @__PURE__ */ React.createElement(EmptyCard, {
		data,
		shellShape,
		elementLayoutHeightPx,
		hideHeader,
		hideHeaderCapacity,
		headerMainFieldOverride,
		bodyStatusTag
	});
}
/**
* 与 {@link ReservationFloorRoomCard} 同款 DOM 与分支，无外层主题根、无定时刷新。
*/
function FloorRoomCardFromData(props) {
	const { discUnifiedLayoutEnabled = true, tooltipTimeDensityEnabled = true } = props, rest = _objectWithoutProperties(props, _excluded);
	const layoutValue = {
		discUnifiedLayoutEnabled,
		tooltipTimeDensityEnabled
	};
	return /* @__PURE__ */ React.createElement(FloorRoomCardLayoutContext.Provider, { value: layoutValue }, /* @__PURE__ */ React.createElement(FloorRoomCardFromDataInner, rest));
}
//#endregion
export { FloorRoomCardFromData };
