/** * astroengine scan -- long-scan ergonomics over the engine: a batched scan with * progress, and rankMoments to find the best instants by a score, synchronously * or without blocking the event loop. * * This is control flow over the validated primitives, not new ephemeris. The * score function is yours: compose it from positions, aspects, or the electional * state. scan imposes no scoring model. Because the core engine does no I/O, * these helpers (and the engine calls inside your score) run unchanged inside a * Web Worker; rankMomentsAsync additionally yields to the event loop so a * main-thread scan of hundreds of charts keeps the UI responsive. */ export interface ScanOptions { /** First instant, UT Julian Day (inclusive). */ start: number; /** Last instant, UT Julian Day (inclusive). */ end: number; /** Spacing between samples, days. Must be positive. */ step: number; /** Called with (done, total) sample counts during the scan. */ onProgress?: (done: number, total: number) => void; /** Samples between progress callbacks (default 256). */ progressEvery?: number; } /** Number of samples a scan of these options visits. */ export declare function sampleCount(start: number, end: number, step: number): number; /** Evaluate fn at each sampled instant in [start, end], returning the results in * time order. */ export declare function scan(opts: ScanOptions, fn: (jd: number) => T): T[]; export interface RankOptions extends ScanOptions { /** Keep only the top N moments (default: all). */ limit?: number; /** Drop moments scoring below this (default: keep all). */ minScore?: number; } export interface RankedMoment { jd: number; score: number; } /** Score every sampled instant and return the best, highest score first. */ export declare function rankMoments(opts: RankOptions, score: (jd: number) => number): RankedMoment[]; /** rankMoments that yields to the event loop every `chunk` samples, so a long * main-thread scan does not freeze the UI. Same result as rankMoments. */ export declare function rankMomentsAsync(opts: RankOptions, score: (jd: number) => number, chunk?: number): Promise;