/** * UI element scoring rules, extracted from `ui-parser.ts`. * * The scoring table used to be 7 inline `if/else` branches with raw magic * numbers. Hoisting it into a declarative array makes A/B-ing the weights * trivial and the unit tests self-documenting. * * Rules run top-to-bottom; the first match wins. Returning `null` means * "no match" and the next rule is tried. */ import type { UiElement } from "./ui-parser.js"; export interface ScoringInput { /** lower-cased element.text */ text: string; /** lower-cased element.contentDesc */ contentDesc: string; /** lower-cased short resource id, underscores replaced with spaces */ id: string; /** lower-cased query string */ desc: string; /** original element for reason strings */ element: UiElement; } export interface ScoringHit { score: number; reason: string; } export interface ScoringRule { match: (i: ScoringInput) => ScoringHit | null; } /** Boost applied on top of any positive score when the element is clickable. */ export declare const CLICKABLE_BOOST = 10; export declare const DEFAULT_SCORING_RULES: ReadonlyArray; export declare function scoreElement(input: ScoringInput, rules?: ReadonlyArray): ScoringHit; //# sourceMappingURL=ui-scoring.d.ts.map