import type { TypedExecutionContext } from '../../types/core';
export interface LoopConfig {
    type: 'for' | 'times' | 'while' | 'until' | 'until-event' | 'forever';
    maxIterations?: number;
    shouldContinue: (ctx: LoopIterationContext) => boolean | Promise<boolean>;
    beforeIteration?: (ctx: LoopIterationContext, context: TypedExecutionContext) => void | Promise<void>;
    eventSetup?: {
        eventName: string;
        target: EventTarget;
        onEvent: () => void;
    };
}
export interface LoopIterationContext {
    index: number;
    item?: unknown;
    collection?: unknown[];
    count?: number;
    conditionExpr?: unknown;
    indexVariable?: string;
    itemVariable?: string;
    eventFired?: boolean;
}
export interface LoopResult {
    iterations: number;
    lastResult: unknown;
    interrupted: boolean;
}
export declare function executeLoop(config: LoopConfig, commands: unknown, context: TypedExecutionContext, iterCtx: LoopIterationContext, executeCommands: (cmds: unknown, ctx: TypedExecutionContext) => Promise<unknown>): Promise<LoopResult>;
export declare function createForLoopConfig(collection: unknown[], itemVariable: string, indexVariable?: string): {
    config: LoopConfig;
    iterCtx: LoopIterationContext;
};
export declare function createTimesLoopConfig(count: number, indexVariable?: string): {
    config: LoopConfig;
    iterCtx: LoopIterationContext;
};
export declare function createWhileLoopConfig(conditionExpr: unknown, evaluateCondition: (expr: unknown, ctx: TypedExecutionContext) => boolean, context: TypedExecutionContext, indexVariable?: string): {
    config: LoopConfig;
    iterCtx: LoopIterationContext;
};
export declare function createUntilLoopConfig(conditionExpr: unknown, evaluateCondition: (expr: unknown, ctx: TypedExecutionContext) => boolean, context: TypedExecutionContext, indexVariable?: string): {
    config: LoopConfig;
    iterCtx: LoopIterationContext;
};
export declare function createUntilEventLoopConfig(eventName: string, eventTarget: EventTarget, indexVariable?: string): {
    config: LoopConfig;
    iterCtx: LoopIterationContext;
};
export declare function createForeverLoopConfig(indexVariable?: string, maxIterations?: number): {
    config: LoopConfig;
    iterCtx: LoopIterationContext;
};
//# sourceMappingURL=loop-executor.d.ts.map