const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_usePisellReservationBookingData = require("../hooks/usePisellReservationBookingData.js");
//#region src/plus/pisellReservation/data/reservationDataUtils.ts
/**
* 是否使用内置预约/资源请求：
* - 未传 `data` / `null`；
* - 或低代码只绑了空数组作占位，且未同时受控 total / onPageChange。
*   （仅有 pagination 占位而无 onPageChange 时仍走内置，否则会永不请求列表。）
*/
function shouldUseBuiltinReservationList(dataProp, totalProp, paginationProp, onPageChangeProp) {
	if (dataProp == null) return true;
	return Array.isArray(dataProp) && dataProp.length === 0 && totalProp === void 0 && onPageChangeProp === void 0;
}
/**
* 表格筛选若未带支付态默认值，接口可能返回空；与 QuickFilter/高级筛选项合并时保留 monitor 默认。
*/
function mergeGridBookingSearchParams(params) {
	const p = params && typeof params === "object" ? require_objectSpread2._objectSpread2({}, params) : {};
	const filterRaw = p.filter;
	const filter = typeof filterRaw === "object" && filterRaw !== null && !Array.isArray(filterRaw) ? require_objectSpread2._objectSpread2({}, filterRaw) : {};
	const valuesRaw = filter.values;
	const values = typeof valuesRaw === "object" && valuesRaw !== null && !Array.isArray(valuesRaw) ? require_objectSpread2._objectSpread2({}, valuesRaw) : {};
	if (!Array.isArray(values.order_payment_status) || values.order_payment_status.length === 0) values.order_payment_status = void 0;
	return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, p), {}, { filter: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, filter), {}, { values }) });
}
/** 列表请求：仅平面图模式用营业日锚定更新 booking_time_start_between */
function mergeSearchParamsBookingWindow(prev, anchorDay) {
	const prevFilter = typeof prev.filter === "object" && prev.filter ? prev.filter : {};
	const prevValues = typeof prevFilter.values === "object" && prevFilter.values ? prevFilter.values : {};
	return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prev), {}, { filter: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prevFilter), {}, { values: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prevValues), {}, { booking_time_start_between: require_usePisellReservationBookingData.bookingTimeWindowForAnchorDay(anchorDay) }) }) });
}
/**
* 按任意 key 读取表格/平面图偏好（与 PisellRecordBoard 内 read 规则一致）。
*/
function readBodyViewFromStorageKey(key) {
	if (typeof window === "undefined" || !key) return "floorMap";
	try {
		const raw = localStorage.getItem(key);
		if (raw === "grid" || raw === "floorMap") return raw;
	} catch (_unused) {}
	return "floorMap";
}
//#endregion
exports.mergeGridBookingSearchParams = mergeGridBookingSearchParams;
exports.mergeSearchParamsBookingWindow = mergeSearchParamsBookingWindow;
exports.readBodyViewFromStorageKey = readBodyViewFromStorageKey;
exports.shouldUseBuiltinReservationList = shouldUseBuiltinReservationList;
