import type { SatelliteRef, Satellites } from "../satellites/types.ts"; /** How a path is drawn: its colour, its width in CSS pixels, how opaque it is and its dashes (a dash and a gap, in CSS pixels, or `null` for a solid line). */ export interface PathStyle { /** Any CSS colour. */ color: string; /** CSS pixels, 0.5 to 8. */ width: number; /** 0 to 1. */ opacity: number; /** `[dash, gap]` in CSS pixels, each 1 to 64, measured along the orbit at the Earth's drawn size; `null` is a solid line. */ dash: [number, number] | null; } /** One path to draw: the satellite, by NORAD catalogue number or by `group:index` (`stations:0`), and its look, as the name of an entry of the style table or as a partial look over the `path` entry. */ export interface PathRequest { id: number | string; style?: string | Partial; } /** A path that is drawn: the request, the satellite it resolved to and the look it has. */ export interface PathInfo { id: number | string; ref: SatelliteRef; /** The name of the style, or `custom` for a look given in the request itself. */ style: string; } /** The path under a point on the picture. */ export interface PathHit extends PathInfo { /** CSS pixels from the element's left and top edges: the point on the path nearest to the pointer. */ x: number; y: number; /** How far, in CSS pixels, the pointer is from that point. */ distancePx: number; /** What pointed: a mouse, a touch or a pen. */ pointer: "mouse" | "touch" | "pen"; } /** The most extra paths drawn at once. A longer list keeps the last of it (the most recent). */ export declare const MAX_PATHS = 16; /** The path hit radius in CSS pixels when the page does not say (`path-hit`), and its range. A touch is given twice as much, and at least {@link TOUCH_HIT_MIN}. */ export declare const DEFAULT_PATH_HIT = 8; export declare const MAX_PATH_HIT = 40; export declare const TOUCH_HIT_MIN = 16; export declare const MIN_PATH_WIDTH = 0.5; export declare const MAX_PATH_WIDTH = 8; /** The look of each name before a page overrides any. They differ in width and dash, not only in colour. */ export declare const BUILT_IN_PATH_STYLES: Readonly>; /** * Take a look a page gave and make a whole one: what is missing or out of range is taken from `base` (a number is held to its range, a dash that is not two numbers of 1 to 64 is `base`'s dash, `null` is a solid line). * * @param given - The page's look, any part of it. * @param base - The look to fall back on. * @returns A look with every part set. */ export declare function completeStyle(given: Partial | null | undefined, base: PathStyle): PathStyle; /** * The table of looks in use: the built-in ones with the page's own laid over them, name by name. An override is a partial look over the built-in of that name (or over `path` for a new name); * `null` takes a page's override away. * * @param overrides - The page's entries. * @returns The whole table, a new object. */ export declare function styleTable(overrides: Readonly | null>>): Record; /** The part of a list that is drawn and how much was left out: the last {@link MAX_PATHS}, in their order. */ export declare function capPaths(list: readonly T[]): { kept: T[]; dropped: number; }; /** * Find the satellite an id names among the groups shown: a NORAD number, or `group:index` (`group/index` is read the same). `null` when nothing matches. * * @param id - The id from a path request. * @param groups - The groups, by name. * @returns The satellite, or `null`. */ export declare function resolvePathId(id: number | string, groups: ReadonlyMap): SatelliteRef | null; /** The radius a pointer finds a path within: the page's `path-hit` for a mouse or a pen, twice it (at least {@link TOUCH_HIT_MIN}) for a touch, and 0 (no test) when `path-hit` is 0. */ export declare function hitRadius(base: number, pointer: PathHit["pointer"]): number; /** Read `path-hit`: a number of CSS pixels from 0 to {@link MAX_PATH_HIT}, `off` for 0, and the default for nothing or anything else. */ export declare function readPathHit(value: string | null): number; /** The look of the path of a request: a name in the table, a partial look over `path`, or `path` itself. A name the table does not have is `path`. */ export declare function styleOf(request: PathRequest, table: Readonly>): { name: string; style: PathStyle; }; /** * How far a point is from a line segment, and the point on it nearest. All in the same units (CSS pixels on the picture). * * @param px - The point's x. * @param py - The point's y. * @param ax - The segment's start x. * @param ay - The segment's start y. * @param bx - The segment's end x. * @param by - The segment's end y. * @returns The distance and the nearest point. */ export declare function nearestOnSegment(px: number, py: number, ax: number, ay: number, bx: number, by: number): { distance: number; x: number; y: number; }; /** * The nearest of several closed loops of screen points to a point, within `radius`. A segment is left out when either end is flagged hidden (behind the Earth, behind the camera or off the picture's depth). * * @param px - The point's x. * @param py - The point's y. * @param loops - Each loop's screen points (`xy`, two numbers each) and a flag for each point (`ok`: 1 when the point can be seen, else 0). * @param radius - The most the point may be from a loop. * @returns The loop's index, the distance and the nearest point, or `null` when no loop is within the radius. */ export declare function nearestLoop(px: number, py: number, loops: readonly { xy: Float32Array | Float64Array; ok: Uint8Array; count: number; }[], radius: number): { index: number; distance: number; x: number; y: number; } | null;