/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Discovery } from "./Discovery.js"; /** * Base class for discovery flows that run parallel PASE establishments with a first-to-win race gate. * * Subclasses override {@link onDiscovered} to launch their specific PASE-time action via * {@link registerAttempt}, providing: * - a {@code factory} that creates the PASE attempt and accepts the {@code winOnPase} gate callback, * - an {@code extractWinner} to pull the result value from the settled promise. * * Attempts are staggered: the first starts immediately, each subsequent one waits an additional * {@link CROSS_DEVICE_STAGGER_DELAY}. The internal abort signal fires once the race is decided: when a candidate * wins, when discovery is interrupted before a win, or when discovery ends without a win. From then on no further * attempt starts and {@code winOnPase} refuses every attempt. */ export declare abstract class ParallelPaseDiscovery extends Discovery { #private; protected get abortSignal(): AbortSignal; protected get paseWon(): boolean; /** Label used in the aggregate error when awaiting candidate cleanup. */ protected abstract get cleanupLabel(): string; /** Error message prefix used when no winner was established. */ protected abstract get failureMessage(): string; /** * Registers a parallel PASE attempt for the given node. * * @param factory Produces the attempt promise. Receives a {@code winOnPase} callback that the implementation * passes as the {@code continueXxx} option to the underlying PASE/commissioning call. When invoked, it * performs the race-gate logic and returns true if this attempt wins, false if the race is already decided: * another attempt won, or discovery ended or was interrupted. * @param extractWinner Extracts the winner value from the settled attempt result. Called only for the * winning attempt after its promise resolves. */ protected registerAttempt(factory: (winOnPase: () => boolean) => R | PromiseLike, extractWinner: (result: R) => W | undefined): void; /** * Ending discovery before a candidate has won, also through the timeout, closes the race at once so no attempt can * win while the scan winds down. */ stop(): void; /** * Before a candidate has won, an interruption aborts every attempt so none can win afterwards. After the win the * winner's operation is not interrupted, and the discovery completes with the winner or the winner's error. */ protected onInterrupt(): boolean; protected onComplete(): Promise; } //# sourceMappingURL=ParallelPaseDiscovery.d.ts.map