export type Summary = { count: number; mean: number; median: number; min: number; max: number };export type StatsErrorKind = "empty" | "not_finite" | "invalid_percentile";export class StatsError extends Error { /** Set for "not_finite": position of the first non-finite value. */ readonly index?: number; constructor( public readonly kind: StatsErrorKind, detail: { index?: number } = {}, ) { super(kind); Object.assign(this, detail); }}/** Throws StatsError. */export function summarize(values: number[]): Summary { // TODO}/** Nearest-rank percentile. Throws StatsError. */export function percentile(values: number[], p: number): number { // TODO}