export function mergeNotificationLists(primary, secondary) {
    const seen = new Set();
    const merged = [];
    for (const notification of [...primary, ...secondary]) {
        if (seen.has(notification.id))
            continue;
        seen.add(notification.id);
        merged.push(notification);
    }
    return merged;
}
export function buildNotificationQuery(options) {
    return {
        skip: options.skip,
        take: options.take,
        unreadOnly: options.showAll ? undefined : true,
    };
}
export function getNextOffsetAfterRealtime(currentOffset) {
    return currentOffset + 1;
}
export function getNextOffsetAfterMarkRead(currentOffset, showAll) {
    if (showAll)
        return currentOffset;
    return Math.max(0, currentOffset - 1);
}
export function applyMarkReadToNotifications(notifications, id, showAll) {
    if (!showAll) {
        return notifications.filter((notification) => notification.id !== id);
    }
    return notifications.map((notification) => notification.id === id ? { ...notification, isRead: true } : notification);
}
export function applyMarkAllReadToNotifications(notifications, showAll) {
    if (!showAll)
        return [];
    return notifications.map((notification) => ({
        ...notification,
        isRead: true,
    }));
}
//# sourceMappingURL=notificationListState.js.map