import React$1 from 'react'; /** * Shared React Flow theming utilities * Ensures consistent styling across all React Flow components in the library */ type ColorMode = 'light' | 'dark' | 'system'; /** Every colour key the strip paints with, including the non-tokenised ones. */ interface OtdrTraceStripColors { text: string; subtext: string; axis: string; fibre: string; cumulative: string; eventFill: string; end: string; fault: string; /** Always `"transparent"` — the strip inherits its host's surface. */ background: string; } /** * The strip's colour palette for a given mode, as literal hex values. Exported * so hosts can paint linked surfaces — a route map, an event list — in the same * colours the strip uses for events, faults, the fibre axis and the cumulative * line. `'system'` resolves against the OS preference (and falls back to dark * when there is no `window`). */ declare const otdrTraceStripPalette: (mode: ColorMode) => OtdrTraceStripColors; /** * OTDR loss-budget strip: a standalone SVG visualisation of an optical * time-domain reflectometer trace's key events — ordered along the fibre by * distance, each annotated with its splice/insertion loss (and reflectance * when present), with the cumulative loss running along a secondary axis. * * Deliberately renders MEASURED data only: the component never estimates, * interpolates missing events, or scales distances to fit — callers pass the * parsed events (e.g. from a Telcordia SR-4731 .sor file) and, optionally, a * fault distance to highlight. No React Flow dependency; safe to render * anywhere. */ /** * Event vocabulary. The semantic kinds (`connector`, `splice`) say what the * plant IS — pass them when the caller knows. The raw kinds (`reflective`, * `non-reflective`, `saturated`) say only what the OTDR saw: a reflective * event is a connector OR a mechanical splice, a non-reflective one a fusion * splice or a bend. The legend words raw kinds honestly instead of guessing — * a trace full of mechanical splices must not be captioned "connectors". */ type OtdrTraceStripEventKind = "connector" | "splice" | "reflective" | "non-reflective" | "saturated" | "end"; interface OtdrTraceStripEvent { /** Metres from the launch end. */ distanceM: number; /** Splice/insertion loss at this event in dB. */ lossDb: number; /** Reflectance in dB (negative), when the event is reflective. */ reflectanceDb?: number | null; /** * Measured attenuation slope of the fibre section LEADING INTO this event, * in dB/km (SR-4731 semantics, as .sor parsers report it). When any event * carries one, the cumulative line slopes across each section — the way a * real trace's backscatter falls between events — and lands on the measured * total instead of just the sum of event losses. Absent slopes render the * legacy flat step-line; the strip never estimates one. */ slopeDbPerKm?: number | null; /** An OtdrTraceStripEvent kind; unrecognised strings render as a plain event. */ type?: string; comment?: string; } /** * A measured backscatter waveform (SR-4731 DataPts): uniformly sampled power * levels in dB. When provided, the strip draws the real trace — noise, dead * zones, reflection spikes, post-end noise floor — instead of the derived * cumulative-loss line. Levels are displayed power (higher = more light), * exactly as decoded from the file; nothing is smoothed or synthesised. * * A capture usually runs past the fibre: samples beyond the axis end are * clipped rather than drawn, so the waveform and the axis always agree. The * waveform itself never extends the axis — only events or `faultDistanceM` * beyond `lengthM` do that, and the waveform is then drawn out to wherever * they put the axis end (see `lengthM`). */ interface OtdrTraceStripTrace { /** Metres between consecutive samples. */ stepM: number; /** Power level per sample, in dB. */ levelsDb: number[]; /** Distance of the first sample from the launch end; defaults to 0 m. */ startM?: number; } interface OtdrTraceStripProps { events: OtdrTraceStripEvent[]; /** * Measured DataPts waveform; replaces the cumulative-loss line when set. * The waveform is clipped to the axis end and never extends it — the tail of * a capture is post-end noise, not plant. Note the axis end is not always * `lengthM`: an event or `faultDistanceM` beyond the declared length pushes * it out, and the waveform is then drawn that far. */ trace?: OtdrTraceStripTrace | null; /** * Fibre-metre span to spotlight — typically the stretch currently visible * on a linked route map. The strip draws a soft band over it and dims * events outside, so the strip reads as the overview while the map is the * working surface. * * The strip renders exactly the span it is given (clamped to the axis) and * applies no "that is basically everything" heuristic of its own: the * producer of the range knows how much of the route is on screen, so it * decides when there is nothing to spotlight and passes null. */ focusRangeM?: [number, number] | null; /** * Fibre length for the axis; defaults to the furthest event distance (or, * with no events, the end of `trace`). When supplied it is the authority on * how long the fibre is against the capture: a longer `trace` does not * stretch the axis — only an event or `faultDistanceM` beyond it can, and * the waveform is clipped to whatever axis end those produce (the strip * captions the clip when samples were dropped). */ lengthM?: number | null; /** Measured end-to-end loss; defaults to the sum of event losses. */ totalLossDb?: number | null; wavelengthNm?: number | null; /** e.g. "A → Z" — purely a caption, the strip draws launch-end left. */ directionLabel?: string; /** Distance to highlight as an actual fault/break, in metres. Reserve for * real anomalies — ordinary events (splices/connectors/end) are not faults. */ faultDistanceM?: number | null; /** Index (into the sorted events) to render as selected/emphasised — e.g. * the event a consumer is locating on a route map. */ selectedEventIndex?: number | null; /** * `'light'` (the default, kept for backwards compatibility), `'dark'`, or * `'system'` to follow the OS `prefers-color-scheme` reactively — the same * `ColorMode` the rest of the library takes. */ colorMode?: ColorMode; /** * Label density. `'auto'` (the default) drops the legend and the per-event * dB labels — the selected event always keeps its label — and scales the * remaining text up once the strip renders narrower than 640 CSS pixels. * `'compact'` forces that phone treatment at any width; `'full'` keeps the * legend and labels however narrow the strip is, for hosts that would rather * have a dense strip than a summarised one. */ density?: "auto" | "full" | "compact"; /** Pixel height of the strip (width is fluid). Default 190. */ height?: number; onEventClick?: (event: OtdrTraceStripEvent, index: number) => void; } /** * Format a fibre distance the way the strip's own axis and captions do: * metres below 1 km, then 2 decimals of km, dropping to 1 decimal past 10 km. * Exported so a host's surrounding chrome (map popups, event tables) can label * the same distances identically instead of rounding them its own way. */ declare const formatOtdrDistance: (metres: number) => string; /** * The strip's legend wording for an event `type`, e.g. `'reflective'` → * `"reflective (connector or mech. splice)"`. Exported so a host's popups and * tables word an event exactly as the legend does — never claiming more than * the file says — instead of maintaining a second vocabulary. Unrecognised * types read as a plain `"event"`. */ declare const otdrEventKindLabel: (type: string | undefined) => string; declare const OtdrTraceStrip: React$1.FC; export { type ColorMode, OtdrTraceStrip, type OtdrTraceStripColors, type OtdrTraceStripEvent, type OtdrTraceStripEventKind, type OtdrTraceStripProps, type OtdrTraceStripTrace, formatOtdrDistance, otdrEventKindLabel, otdrTraceStripPalette };