/// <reference types="node" />
import { EventEmitter } from 'events';
import { Configuration } from '../../config.js';
import { Logger } from '../../logger.js';
import { Engine } from '../engine.js';
import { ExtensionVersion } from '../extension.js';
import { BrowserService, FlowService, GlobalsService, ReporterService } from '../services/index';
import { Action } from './action.js';
import { IdDatabase } from './commons.js';
import { Context, ContextList } from './context.js';
import { DefinitionAction } from './definition.js';
import { Entity } from './entity.js';
import { Inspection, InspectionNode, InspectionReport } from './inspection.js';
import { ScriptSearchOptions, ScriptSearchQuery, ScriptSearchResult } from './search.js';
export declare class Script extends Entity<null> implements IdDatabase {
    $engine: Engine;
    $events: EventEmitter;
    id: string;
    contexts: ContextList;
    blockedUrlPatterns: string[];
    dependencies: ExtensionVersion[];
    $playback: ScriptPlaybackState;
    $ids: Map<string, any>;
    $inputs: ScriptInput[];
    $outputs: ScriptOutput[];
    $consumedInputKeys: Set<string>;
    static load($engine: Engine, spec?: any): Promise<Script>;
    constructor($engine: Engine, spec?: any);
    toJSON(): any;
    get $entityType(): string;
    get $key(): string;
    get $browser(): BrowserService;
    get $page(): import("../../index.js").Page;
    get $logger(): Logger;
    get $flow(): FlowService;
    get $config(): Configuration;
    get $globals(): GlobalsService;
    get $reporter(): ReporterService;
    reset(): void;
    registerId(id: string, object: any): void;
    unregisterId(id: string): void;
    hashInputOutputKey(key: string): string;
    requestInput(key: string): Promise<any>;
    peekInput(key: string): Promise<any | null>;
    resetInput(key: string): Promise<void>;
    sendOutput(key: string, data: any): Promise<void>;
    wasOutputEmitted(key: string): boolean;
    waitForOutputs(...keys: string[]): Promise<any[]>;
    getGlobalKeys(): string[];
    getGlobal(key: string, optional?: boolean): any;
    setGlobal(key: string, value: any): void;
    appendGlobal(key: string, values: any[]): void;
    removeGlobal(key: string): void;
    get(path: string): any;
    applyContextConstraints(): void;
    getMainContext(): Context;
    getCheckpointContext(): Context | null;
    getContextById(id: string): Context | null;
    getFirstAction(): Action | null;
    getActionById(id: string): Action | null;
    getDefinitionById(id: string): DefinitionAction | null;
    requireDefinition(id: string): DefinitionAction;
    allActions(): Generator<Action, void, undefined>;
    setPlayhead(action: Action | null): void;
    setStatus(status: ScriptPlaybackStatus): void;
    isRunning(): boolean;
    isPaused(): boolean;
    pause(): void;
    tick(): Promise<void>;
    protected beforeRun(): Promise<void>;
    run(mode?: ScriptPlaybackMode, action?: Action | null): Promise<void>;
    step(): Promise<void>;
    runAll(): Promise<void>;
    inspect(): IterableIterator<InspectionReport>;
    protected collectReports<T extends InspectionNode>(inspection: Inspection<T>, node: T): IterableIterator<InspectionReport>;
    protected _performCurrentTask(): Promise<void>;
    protected _enterNextContext(): Promise<void>;
    protected _shouldContinue(): boolean;
    protected matchNextContext(): Promise<Context>;
    protected _matchNextContext(): Promise<Context>;
    matchContexts(filterByLimit?: boolean): Promise<Context[]>;
    protected matchContextInBatches(candidates: Context[]): Promise<boolean[]>;
    protected resolveContextMatchTimeoutError(): Promise<Error>;
    search(queries: ScriptSearchQuery[], options?: ScriptSearchOptions): IterableIterator<ScriptSearchResult>;
    collectInputKeys(): Generator<any, void, unknown>;
    collectOutputKeys(): Generator<string, void, undefined>;
    collectUsedDependencies(): Generator<ExtensionVersion, void, unknown>;
    private collectAllUsedDependencies;
    protected executeOnScriptRunHandlers(): Promise<void>;
    protected executeOnContextEnterHandlers(context: Context): Promise<void>;
}
export interface ScriptInput {
    key: string;
    data: any;
}
export interface ScriptOutput {
    key: string;
    data: any;
}
export type ScriptPlaybackStatus = 'idle' | 'running' | 'matching' | 'error' | 'success';
export type ScriptPlaybackMode = 'action' | 'context' | 'script';
export interface ScriptPlaybackState {
    paused: boolean;
    running: boolean;
    mode: ScriptPlaybackMode;
    status: ScriptPlaybackStatus;
    error: Error | null;
    playhead: Action | null;
    lastContext: Context | null;
}
//# sourceMappingURL=script.d.ts.map