{"version":3,"file":"validate-BLFByZtM.cjs","names":[],"sources":["../src/model/date.ts","../src/schema/literals.ts","../src/schema/validate.ts"],"sourcesContent":["import type { Precision } from '../schema/types';\n\n/** Thrown by {@link parseFuzzyDate} with a human-readable message. */\nexport class TimarroDateError extends Error {\n  override name = 'TimarroDateError';\n}\n\nexport interface TimeOfDay {\n  hour: number;\n  minute: number;\n  second: number;\n  /** Signed minutes east of UTC; 0 for `Z` and for naive datetimes (treated as UTC). */\n  offsetMinutes: number;\n}\n\nexport interface DateParts {\n  year: number;\n  month?: number; // 1–12\n  day?: number; // 1–31\n  time?: TimeOfDay;\n  /** Granularity derived from the string shape. */\n  precision: Precision;\n}\n\n/**\n * A fuzzy value resolved to a half-open interval `[earliest, latest)` in UTC epoch ms.\n * `datetime` values are exact points (`earliest === latest === mid`).\n */\nexport interface ResolvedInstant {\n  earliest: number;\n  latest: number;\n  mid: number;\n}\n\nconst YEAR_RE = /^(\\d{4})$/;\nconst MONTH_RE = /^(\\d{4})-(\\d{2})$/;\nconst DAY_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst DATETIME_RE = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2}))?(Z|[+-]\\d{2}:\\d{2})?$/;\n\nconst GRAMMAR_HINT = 'expected YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DDTHH:mm[:ss][Z|±HH:MM]';\n\nfunction isLeapYear(year: number): boolean {\n  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nconst DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\nexport function monthLength(year: number, month: number): number {\n  if (month === 2 && isLeapYear(year)) return 29;\n  return DAYS_IN_MONTH[month - 1] ?? 0;\n}\n\n/**\n * UTC epoch ms without `Date.UTC`'s 0–99 → 1900+ mapping (years like 0079 must work).\n */\nexport function utcTime(\n  year: number,\n  month = 1,\n  day = 1,\n  hour = 0,\n  minute = 0,\n  second = 0,\n): number {\n  const d = new Date(0);\n  d.setUTCFullYear(year, month - 1, day);\n  d.setUTCHours(hour, minute, second, 0);\n  return d.getTime();\n}\n\n/** Parse a v1 fuzzy-date string (see grammar in schema/types.ts). Throws {@link TimarroDateError}. */\nexport function parseFuzzyDate(input: string): DateParts {\n  if (input.startsWith('-') || input.startsWith('−')) {\n    throw new TimarroDateError(`BCE dates are not supported in v1 (got \"${input}\")`);\n  }\n  if (/^\\d{5,}/.test(input)) {\n    throw new TimarroDateError(`years beyond 9999 are not supported (got \"${input}\")`);\n  }\n\n  let match: RegExpExecArray | null;\n  let parts: DateParts;\n\n  if ((match = YEAR_RE.exec(input))) {\n    parts = { year: Number(match[1]), precision: 'year' };\n  } else if ((match = MONTH_RE.exec(input))) {\n    parts = { year: Number(match[1]), month: Number(match[2]), precision: 'month' };\n  } else if ((match = DAY_RE.exec(input))) {\n    parts = {\n      year: Number(match[1]),\n      month: Number(match[2]),\n      day: Number(match[3]),\n      precision: 'day',\n    };\n  } else if ((match = DATETIME_RE.exec(input))) {\n    parts = {\n      year: Number(match[1]),\n      month: Number(match[2]),\n      day: Number(match[3]),\n      time: {\n        hour: Number(match[4]),\n        minute: Number(match[5]),\n        second: match[6] !== undefined ? Number(match[6]) : 0,\n        offsetMinutes: parseOffset(match[7], input),\n      },\n      precision: 'datetime',\n    };\n  } else {\n    throw new TimarroDateError(`invalid date \"${input}\" — ${GRAMMAR_HINT}`);\n  }\n\n  if (parts.year === 0) {\n    // ISO 8601 year 0000 is 1 BCE.\n    throw new TimarroDateError(`BCE dates are not supported in v1 (got \"${input}\")`);\n  }\n  if (parts.month !== undefined && (parts.month < 1 || parts.month > 12)) {\n    throw new TimarroDateError(`month out of range in \"${input}\"`);\n  }\n  if (parts.day !== undefined) {\n    const max = monthLength(parts.year, parts.month ?? 1);\n    if (parts.day < 1 || parts.day > max) {\n      throw new TimarroDateError(`day out of range in \"${input}\" (month has ${max} days)`);\n    }\n  }\n  if (parts.time) {\n    const { hour, minute, second } = parts.time;\n    if (hour > 23) throw new TimarroDateError(`hour out of range in \"${input}\"`);\n    if (minute > 59) throw new TimarroDateError(`minute out of range in \"${input}\"`);\n    if (second > 59) throw new TimarroDateError(`second out of range in \"${input}\"`);\n  }\n  return parts;\n}\n\nfunction parseOffset(raw: string | undefined, input: string): number {\n  if (raw === undefined || raw === 'Z') return 0;\n  const sign = raw.startsWith('-') ? -1 : 1;\n  const hours = Number(raw.slice(1, 3));\n  const minutes = Number(raw.slice(4, 6));\n  if (hours > 14) throw new TimarroDateError(`UTC offset out of range in \"${input}\"`);\n  if (minutes > 59) throw new TimarroDateError(`UTC offset minutes out of range in \"${input}\"`);\n  return sign * (hours * 60 + minutes);\n}\n\n/** Resolve parsed parts to their uncertainty interval (see {@link ResolvedInstant}). */\nexport function resolveInstant(parts: DateParts): ResolvedInstant {\n  let earliest: number;\n  let latest: number;\n\n  switch (parts.precision) {\n    case 'year':\n      earliest = utcTime(parts.year);\n      latest = utcTime(parts.year + 1);\n      break;\n    case 'month': {\n      const m = parts.month ?? 1;\n      earliest = utcTime(parts.year, m);\n      latest = m === 12 ? utcTime(parts.year + 1, 1) : utcTime(parts.year, m + 1);\n      break;\n    }\n    case 'day':\n      earliest = utcTime(parts.year, parts.month ?? 1, parts.day ?? 1);\n      latest = earliest + 24 * 60 * 60 * 1000;\n      break;\n    case 'datetime': {\n      const t = parts.time ?? { hour: 0, minute: 0, second: 0, offsetMinutes: 0 };\n      const naive = utcTime(\n        parts.year,\n        parts.month ?? 1,\n        parts.day ?? 1,\n        t.hour,\n        t.minute,\n        t.second,\n      );\n      earliest = naive - t.offsetMinutes * 60 * 1000;\n      latest = earliest;\n      break;\n    }\n  }\n  return { earliest, latest, mid: (earliest + latest) / 2 };\n}\n","/**\n * Shared enumerations for the timeline JSON contract.\n *\n * Kept dependency-free so both the embed validator and the Zod schema can\n * import the same values — types are derived from the arrays, not duplicated.\n */\n\nexport const PRECISIONS = ['year', 'month', 'day', 'datetime'] as const;\nexport const SOURCE_TYPES = ['manual', 'text', 'json', 'video', 'audio'] as const;\nexport const VISIBILITIES = ['public', 'unlisted', 'private'] as const;\n\nexport type Precision = (typeof PRECISIONS)[number];\nexport type SourceType = (typeof SOURCE_TYPES)[number];\nexport type Visibility = (typeof VISIBILITIES)[number];\n","import { parseFuzzyDate, resolveInstant } from '../model/date';\nimport { PRECISIONS, SOURCE_TYPES, VISIBILITIES } from './literals';\nimport type { Precision, TimarroDate, TimarroTimelineData } from './types';\n\n/**\n * Dependency-free structural validator — used by the element at runtime so the\n * embed bundle ships without zod. The canonical Zod schema (`timarro/schema`)\n * delegates its date semantics to {@link explainDateProblem}, keeping the two\n * validators in sync by construction (plus a parity test).\n *\n * Semantics: collects ALL issues (no fail-fast); unknown extra fields are ignored;\n * on success returns the same object reference, typed.\n */\n\nexport interface ValidationIssue {\n  /** Dotted/indexed path, e.g. `events[3].date.precision`; `(root)` for the top level. */\n  path: string;\n  message: string;\n}\n\nexport type ValidationResult =\n  { ok: true; data: TimarroTimelineData } | { ok: false; issues: ValidationIssue[] };\n\n/**\n * The single source of truth for date-field semantics (grammar, precision match,\n * end-not-before-start). Returns `null` when the date object is consistent.\n */\nexport function explainDateProblem(\n  date: TimarroDate,\n): { field: 'start' | 'end' | 'precision'; message: string } | null {\n  let startParts;\n  try {\n    startParts = parseFuzzyDate(date.start);\n  } catch (error) {\n    return { field: 'start', message: messageOf(error) };\n  }\n  if (date.precision !== startParts.precision) {\n    return {\n      field: 'precision',\n      message: `precision \"${date.precision}\" does not match start \"${date.start}\" (which is ${startParts.precision}-precision)`,\n    };\n  }\n  if (date.end !== undefined) {\n    let endParts;\n    try {\n      endParts = parseFuzzyDate(date.end);\n    } catch (error) {\n      return { field: 'end', message: messageOf(error) };\n    }\n    const start = resolveInstant(startParts);\n    const end = resolveInstant(endParts);\n    if (end.latest < start.earliest) {\n      return { field: 'end', message: `end \"${date.end}\" is before start \"${date.start}\"` };\n    }\n  }\n  return null;\n}\n\nexport function validateTimelineData(input: unknown): ValidationResult {\n  const issues: ValidationIssue[] = [];\n  const push = (path: string, message: string) => issues.push({ path, message });\n\n  if (!isRecord(input)) {\n    return {\n      ok: false,\n      issues: [{ path: '(root)', message: 'expected an object with { timeline, events }' }],\n    };\n  }\n\n  const timeline = input['timeline'];\n  if (!isRecord(timeline)) {\n    push('timeline', 'expected an object');\n  } else {\n    requireNonEmptyString(timeline, 'id', 'timeline', push);\n    requireNonEmptyString(timeline, 'title', 'timeline', push);\n    optionalString(timeline, 'description', 'timeline', push);\n    optionalString(timeline, 'coverImageUrl', 'timeline', push);\n    optionalString(timeline, 'createdBy', 'timeline', push);\n    optionalEnum(timeline, 'visibility', 'timeline', VISIBILITIES, push);\n    optionalStringArray(timeline, 'sourceTypes', 'timeline', push, SOURCE_TYPES);\n  }\n\n  const events = input['events'];\n  if (!Array.isArray(events)) {\n    push('events', 'expected an array');\n  } else {\n    events.forEach((event, i) => {\n      validateEvent(event, `events[${i}]`, push);\n    });\n  }\n\n  if (issues.length > 0) return { ok: false, issues };\n  return { ok: true, data: input as unknown as TimarroTimelineData };\n}\n\nfunction validateEvent(event: unknown, base: string, push: (p: string, m: string) => void): void {\n  if (!isRecord(event)) {\n    push(base, 'expected an object');\n    return;\n  }\n  requireNonEmptyString(event, 'id', base, push);\n  requireNonEmptyString(event, 'title', base, push);\n  optionalString(event, 'description', base, push);\n  optionalString(event, 'sourceRef', base, push);\n  optionalString(event, 'color', base, push);\n  optionalString(event, 'timelineId', base, push);\n  optionalStringArray(event, 'entities', base, push);\n  optionalStringArray(event, 'mediaUrls', base, push);\n  optionalFiniteNumber(event, 'order', base, push);\n  optionalFiniteNumber(event, 'revision', base, push);\n\n  const date = event['date'];\n  if (!isRecord(date)) {\n    push(`${base}.date`, 'expected an object with { start, precision }');\n    return;\n  }\n  let structurallySound = true;\n  if (typeof date['start'] !== 'string') {\n    push(`${base}.date.start`, 'expected a string');\n    structurallySound = false;\n  }\n  if (!PRECISIONS.includes(date['precision'] as Precision)) {\n    push(`${base}.date.precision`, `expected one of: ${PRECISIONS.join(', ')}`);\n    structurallySound = false;\n  }\n  if (date['end'] !== undefined && typeof date['end'] !== 'string') {\n    push(`${base}.date.end`, 'expected a string');\n    structurallySound = false;\n  }\n  if (date['circa'] !== undefined && typeof date['circa'] !== 'boolean') {\n    push(`${base}.date.circa`, 'expected a boolean');\n  }\n  if (structurallySound) {\n    const problem = explainDateProblem(date as unknown as TimarroDate);\n    if (problem) push(`${base}.date.${problem.field}`, problem.message);\n  }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction messageOf(error: unknown): string {\n  return error instanceof Error ? error.message : String(error);\n}\n\nfunction requireNonEmptyString(\n  obj: Record<string, unknown>,\n  key: string,\n  base: string,\n  push: (p: string, m: string) => void,\n): void {\n  const value = obj[key];\n  if (typeof value !== 'string' || value.length === 0) {\n    push(`${base}.${key}`, 'expected a non-empty string');\n  }\n}\n\nfunction optionalString(\n  obj: Record<string, unknown>,\n  key: string,\n  base: string,\n  push: (p: string, m: string) => void,\n): void {\n  const value = obj[key];\n  if (value !== undefined && typeof value !== 'string') {\n    push(`${base}.${key}`, 'expected a string');\n  }\n}\n\nfunction optionalEnum(\n  obj: Record<string, unknown>,\n  key: string,\n  base: string,\n  allowed: readonly string[],\n  push: (p: string, m: string) => void,\n): void {\n  const value = obj[key];\n  if (value === undefined) return;\n  if (typeof value !== 'string' || !allowed.includes(value)) {\n    push(`${base}.${key}`, `expected one of: ${allowed.join(', ')}`);\n  }\n}\n\nfunction optionalFiniteNumber(\n  obj: Record<string, unknown>,\n  key: string,\n  base: string,\n  push: (p: string, m: string) => void,\n): void {\n  const value = obj[key];\n  if (value !== undefined && (typeof value !== 'number' || !Number.isFinite(value))) {\n    push(`${base}.${key}`, 'expected a finite number');\n  }\n}\n\nfunction optionalStringArray(\n  obj: Record<string, unknown>,\n  key: string,\n  base: string,\n  push: (p: string, m: string) => void,\n  allowed?: readonly string[],\n): void {\n  const value = obj[key];\n  if (value === undefined) return;\n  if (!Array.isArray(value)) {\n    push(`${base}.${key}`, 'expected an array of strings');\n    return;\n  }\n  value.forEach((item, i) => {\n    if (typeof item !== 'string') {\n      push(`${base}.${key}[${i}]`, 'expected a string');\n    } else if (allowed && !allowed.includes(item)) {\n      push(`${base}.${key}[${i}]`, `expected one of: ${allowed.join(', ')}`);\n    }\n  });\n}\n"],"mappings":";;AAGA,IAAa,mBAAb,cAAsC,MAAM;CAC1C,OAAgB;AAClB;AA6BA,MAAM,UAAU;AAChB,MAAM,WAAW;AACjB,MAAM,SAAS;AACf,MAAM,cAAc;AAEpB,MAAM,eAAe;AAErB,SAAS,WAAW,MAAuB;CACzC,OAAO,OAAO,MAAM,MAAM,OAAO,QAAQ,KAAK,OAAO,QAAQ;AAC/D;AAEA,MAAM,gBAAgB;CAAC;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE;AAErE,SAAgB,YAAY,MAAc,OAAuB;CAC/D,IAAI,UAAU,KAAK,WAAW,IAAI,GAAG,OAAO;CAC5C,OAAO,cAAc,QAAQ,MAAM;AACrC;;;;AAKA,SAAgB,QACd,MACA,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,GACD;CACR,MAAM,oBAAI,IAAI,KAAK,CAAC;CACpB,EAAE,eAAe,MAAM,QAAQ,GAAG,GAAG;CACrC,EAAE,YAAY,MAAM,QAAQ,QAAQ,CAAC;CACrC,OAAO,EAAE,QAAQ;AACnB;;AAGA,SAAgB,eAAe,OAA0B;CACvD,IAAI,MAAM,WAAW,GAAG,KAAK,MAAM,WAAW,GAAG,GAC/C,MAAM,IAAI,iBAAiB,2CAA2C,MAAM,GAAG;CAEjF,IAAI,UAAU,KAAK,KAAK,GACtB,MAAM,IAAI,iBAAiB,6CAA6C,MAAM,GAAG;CAGnF,IAAI;CACJ,IAAI;CAEJ,IA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