/** * Waterfall-layout math: trace time envelope, per-span bar geometry, a * human-friendly time axis, overlapping-span row packing, and ∑-cost * aggregation. Every function is pure and total — it NEVER throws and NEVER * does I/O — so skew / missing-timestamp / overlap / degenerate-bounds * negative cases are provable without rendering. */ import type { TraceSpan } from "./types.js"; /** * Trace time bounds — min start / max end across ALL spans (ns, bigint-safe): * the honest envelope for the waterfall denominator (not root-only, which * would let a child overflow). Unparseable timestamps are skipped; a trace * with no timestamps returns 0/0. */ export declare function computeTraceBounds(root: TraceSpan): { startNs: bigint; endNs: bigint; }; export interface BarLayout { leftPct: number; widthPct: number; unbounded: boolean; } /** * Map a span's [start, end] against the trace bounds → clamped {leftPct, * widthPct} in [0,100] with `leftPct + widthPct ≤ 100`. Missing end and * clock-skew (end < start) are flagged `unbounded` with zero width — never a * throw. Percentages carry 2 decimals via integer bigint math. */ export declare function computeBarLayout(spanStart: bigint | string | undefined, spanEnd: bigint | string | null | undefined, traceStartNs: bigint, traceEndNs: bigint): BarLayout; /** One tick on the waterfall time axis. */ export interface AxisTick { offsetNs: bigint; label: string; leftPct: number; } /** * Human-friendly time axis: pick a step from the 1/2/5×10ⁿ ladder so ticks * sit ≥70px apart, then emit ticks at 0, step, 2·step, … across the span. * Total: a degenerate window or non-positive width yields an empty axis. */ export declare function niceAxisTicks(startNs: bigint, endNs: bigint, pxWidth: number): AxisTick[]; /** * Greedy single-pass row packing for overlapping spans: sort by start, then * assign each span the lowest row whose last-placed span ended at/before this * span's start. Returns `Map`. Total: `[]` → empty map. */ export declare function packRows(spans: Array<{ id: string; startNs: bigint; endNs: bigint; }>): Map;