/** * Orchestrator — the entry point for the v1 element-selector algorithm. * * Given a click target, the orchestrator walks from the target up through its * ancestors and tries each registered strategy at each level. The first * strategy that returns a non-null candidate (and produces a selector that * resolves uniquely under the scope) wins; the trail of intermediate elements * between the anchor and the original target is then expressed as a positional * descent via `describeRelative`. * * Two-pass design: every ancestor is tried under the `explicitTrackingAttribute` * strategy first, then the entire walk repeats with `stableId`. This ordering * means an explicit anchor anywhere up the tree always beats a stable id deeper * down — the design doc describes this as the "customer intent overrides * structural inference" rule. * * The orchestrator does not own the fallback. When no strategy + walk produces * a unique selector, it returns `null` and the engine wires the * `fallback-css-path` path in instead. Keeping the fallback outside the * orchestrator keeps the strategy chain testable in isolation. * * See the design doc: * packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md */ import { ElementSelectorLogger, ResolvedSelectorConfig, Strategy } from './types'; /** * Default strategy chain in priority order. Used by the engine factory when the * caller doesn't provide an explicit list. Exported for diagnostics — tests * import this so they don't have to duplicate the list. */ export declare const DEFAULT_STRATEGIES: ReadonlyArray; export interface OrchestratorOptions { /** Strategy chain. Defaults to `DEFAULT_STRATEGIES`. Order = priority. */ strategies?: ReadonlyArray; /** Document or shadow root used for uniqueness checks. Defaults to the target's owner document. */ scope?: ParentNode; /** * Optional logger. When provided, the orchestrator emits a `debug` log if a * strategy produces a malformed selector that throws during the uniqueness * check — useful for diagnosing strategy bugs without crashing the engine. */ logger?: ElementSelectorLogger; } /** * Try to produce a CSS selector for `el` using the strategy chain. * * Returns the composed selector string on success, or `null` if every strategy * declined at every walked ancestor. Callers (the engine) treat `null` as the * signal to invoke the fallback walker. * * Selector format on success: * * - Anchor only (target itself was an anchor): `` * - Anchor + trail (anchor was an ancestor): ` > ` * * Where `` is whatever the winning strategy returned for the * anchor element (e.g. `[data-amp-track-id="login-form"]` or `div#hero`), and * `` is `describeRelative(anchor, trail)`. */ export declare function runOrchestrator(el: Element, config: ResolvedSelectorConfig, options?: OrchestratorOptions): string | null; //# sourceMappingURL=orchestrator.d.ts.map