import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { getMultiDay } from "../../../components/booking/info2/service/addService/utils.js";
import { concatBookings, createBookingItemsByGroup } from "../../../components/booking/info/service2/Group/utils.js";
import { resolveIsMultiDayProduct } from "./resolveIsMultiDayProduct.js";
//#region src/plus/salesSdk/utils/expandMultiDayCacheItem.ts
/**
* 跨日商品：拉报价并展开子预约（对齐 ticketBooking `getMultiDayCacheItem`）。
*/
function expandMultiDayCacheItem(_x, _x2, _x3) {
	return _expandMultiDayCacheItem.apply(this, arguments);
}
function _expandMultiDayCacheItem() {
	_expandMultiDayCacheItem = _asyncToGenerator(function* (cacheItem, bookingState, options) {
		var _cacheItem$_extend, _cacheItem$_extend2;
		if (!resolveIsMultiDayProduct(cacheItem)) return cacheItem;
		let next = yield getMultiDay({
			start_date: (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.start_date,
			end_date: (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.end_date,
			state: bookingState,
			cacheItem
		});
		next = createBookingItemsByGroup(next);
		if (options === null || options === void 0 ? void 0 : options.concatBookings) next = concatBookings(next);
		return next;
	});
	return _expandMultiDayCacheItem.apply(this, arguments);
}
//#endregion
export { expandMultiDayCacheItem };
