import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { formatProducts } from "../../../components/booking/info/service2/utils.js";
import useSelectPet from "../../../components/booking/info/service2/hooks/useSelectPet.js";
import React, { useMemo } from "react";
import { ProductCard } from "@pisell/materials";
//#region src/plus/salesSdk/bookingEditService/SalesSdkBookingList.tsx
/**
* 跨日预约「预约列表」Tab：不依赖 booking miniRedux Context，由 props 注入 state。
*/
const SalesSdkBookingList = ({ items, bookingState }) => {
	const { holderLists } = useSelectPet(bookingState);
	const productParams = useMemo(() => {
		var _bookingState$isTermi;
		return {
			hideAddBtn: (_bookingState$isTermi = bookingState.isTerminalDayBookingPage) !== null && _bookingState$isTermi !== void 0 ? _bookingState$isTermi : false,
			isShowNote: false,
			isShowPackageNote: false,
			holders: holderLists,
			isEdit: false,
			disabledEdit: true
		};
	}, [bookingState.isTerminalDayBookingPage, holderLists]);
	const formatted = useMemo(() => formatProducts(items, bookingState, false), [items, bookingState]);
	if (!formatted.length) return null;
	return /* @__PURE__ */ React.createElement("div", { style: {
		display: "flex",
		flexWrap: "wrap",
		gap: 16
	} }, formatted.map((item) => {
		var _item$_id;
		return /* @__PURE__ */ React.createElement("div", {
			key: (_item$_id = item._id) !== null && _item$_id !== void 0 ? _item$_id : item.id,
			style: { width: "100%" }
		}, /* @__PURE__ */ React.createElement(ProductCard, _objectSpread2({ dataSource: item }, productParams)));
	}));
};
//#endregion
export { SalesSdkBookingList };
