import { deriveMessageContentHash } from "./derive-keys.js";
export function findDeltaCursor(parsedLines, lastIngestedMessageHash) {
    if (!lastIngestedMessageHash || !lastIngestedMessageHash.trim()) {
        throw new Error("findDeltaCursor: lastIngestedMessageHash must be non-empty");
    }
    for (let i = 0; i < parsedLines.length; i++) {
        const line = parsedLines[i];
        const hash = deriveMessageContentHash({
            dateSent: line.dateSent,
            body: line.body,
        });
        if (hash === lastIngestedMessageHash) {
            if (i === parsedLines.length - 1)
                return { kind: "empty" };
            return { kind: "found", deltaStart: i + 1 };
        }
    }
    return { kind: "missing" };
}
//# sourceMappingURL=delta-cursor.js.map