/** Parse a raw value to a positive-integer id, or null if it isn't one. A bare "" gives * Number("")===0 (finite but not positive), "1.5" is fractional, "-1"/"abc" invalid — all rejected. * The single guard behind the ?pl / ?v=playlist id params AND the stored playlist selection, so a bad * value (a malformed link, a legacy/corrupted storage entry) never selects a non-existent playlist. */ export function parsePositiveIntId(raw: string | null | undefined): number | null { if (raw == null || raw === "") return null; const n = Number(raw); return Number.isInteger(n) && n > 0 ? n : null; }