import Link from 'next/link';
import { Evidence } from '@/components/evidence';
import { Chip, OpennessBadge, StatusBadge, TierBadge } from '@/components/ui/badges';
import { DataTable, EmptyRow, Td, Th } from '@/components/ui/data-table';
import { EntityLink } from '@/components/ui/entity';
import { Note } from '@/components/ui/section';
import { fmtDate, fmtInt, fmtParams, fmtScore, fmtTokens, fmtUsdPerM, num } from '@/lib/format';
import { routes } from '@/lib/site';
import type { EntitySummary, Price, TimeMachineLeader, TimeMachineModelRow } from '@/lib/types';
/* Time-machine tables (server). Every as-of value is an evidence trigger (claim validity in the drawer); the "today"
column comes from the same payload (`model.attributes` is the current record), so nothing extra is fetched. */
function AsOf({ e, property, value, display }: { e: EntitySummary; property: string; value: unknown; display: string }) {
if (value === null || value === undefined || value === '') return —;
return (
{display}
);
}
function Today({ asof, now, format }: { asof: unknown; now: unknown; format: (v: unknown) => string }) {
const a = asof === null || asof === undefined || asof === '' ? null : format(asof);
const b = now === null || now === undefined || now === '' ? null : format(now);
if (b === null) return —;
if (a === b) return same;
return {b};
}
export function ModelsAsOf({ rows, total, date, limit }: { rows: TimeMachineModelRow[]; total: number | null; date: string; limit: number }) {
return (
<>
Model
Organization
Params
Context (as of)
Context (today)
Openness
Status (as of)
Status (today)
Released
Basis
History
{rows.length === 0 && No canonical model existed at this date according to release dates and dated claims.}
{rows.map(({ model: m, attributes_as_of: a, observed_then, reconstructed }) => (
))}
{total !== null && total > rows.length && Showing {fmtInt(rows.length)} of {fmtInt(total)} models that existed on this date (API cap {fmtInt(limit)}). Open a model's History tab for its full as-of record.}
“Today” columns compare the as-of value with the current record; “same” means no recorded change. Click any as-of value for the claim behind it (source, tier, valid from → to).
>
);
}
export function PricesAsOf({ rows, total, date }: { rows: Price[]; total: number | null; date: string }) {
return (
<>
Model
Provider
Input / 1M
Output / 1M
Context
Valid from
Valid to
Source
{rows.length === 0 && No price row's validity interval covers this date (price history starts when AI Atlas first observed the provider).}
{rows.map((p) => (
))}
{total !== null && total > rows.length && Showing {fmtInt(rows.length)} of {fmtInt(total)} offers valid on this date.}
>
);
}
export function LeadersAsOf({ rows, date }: { rows: TimeMachineLeader[]; date: string }) {
return (
<>
Benchmark
Leader
Organization
Score
Metric · group
Trust
Models ranked
{rows.length === 0 && No benchmark result had been observed by this date — leaders are known only once a result is observed (evaluation dates are not used).}
{rows.map((r) => (
))}
One row per benchmark: the best current row of the primary comparability group among results observed by the date. See the benchmark's Frontier tab for the full leader history.
>
);
}
export function HardwareAsOf({ rows, date }: { rows: { hardware: EntitySummary; reconstructed?: boolean }[]; date: string }) {
return (
Hardware
Manufacturer
Kind
Memory
Bandwidth
Released
Basis
{rows.length === 0 && No hardware with a release date on or before this date.}
{rows.map(({ hardware: h, reconstructed }) => {
const a = h.attributes ?? {};
const mem = Array.isArray(a.memory_gb) ? (a.memory_gb as unknown[]).map((x) => fmtInt(x)).join(' / ') : num(a.memory_gb) === null ? '—' : fmtInt(a.memory_gb);
return (