//#region src/plus/pisellReservation/hooks/phoneGridInfiniteDataUtils.ts
function resolvePhoneGridRowKey(record, rowKey) {
	if (typeof rowKey === "function") return rowKey(record);
	const value = record[rowKey];
	return value == null ? void 0 : value;
}
function mergePhoneGridRowsByRowKey(prev, nextPage, rowKey) {
	if (nextPage.length === 0) return prev;
	const seen = /* @__PURE__ */ new Set();
	const merged = [];
	const append = (row) => {
		if (row == null || typeof row !== "object") return;
		const key = resolvePhoneGridRowKey(row, rowKey);
		if (key != null) {
			if (seen.has(key)) return;
			seen.add(key);
		}
		merged.push(row);
	};
	prev.forEach(append);
	nextPage.forEach(append);
	return merged;
}
//#endregion
export { mergePhoneGridRowsByRowKey };
