// Resend-cooldown keying (SD-0001 ยง5.2, INV-3; bug #20). The server's cooldown is // per-address, so the client countdown must be too: it blocks sending only while it // is running AND the current input is the address it was set for. Normalization // mirrors the backend's normalize_email (lowercase + strip, INV-2). function normalize(email: string): string { return email.trim().toLowerCase(); } export function cooldownAppliesTo( input: string, cooldownEmail: string | null, secondsLeft: number, ): boolean { if (secondsLeft <= 0 || cooldownEmail === null) return false; return normalize(input) === normalize(cooldownEmail); }