import { Channel } from "@effect/core/stream/Channel/definition/base";
import { Exit } from "@effect/core/io/Exit/definition";
import { Effect } from "@effect/core/io/Effect/definition";
import { List } from "@tsplus/stdlib/collections/List/definition";
import { Lazy, identity, LazyArg } from "@tsplus/stdlib/data/Function";
import { Env } from "@tsplus/stdlib/service/Env";
import { ListBuffer } from "@tsplus/stdlib/collections/mutable/ListBuffer";
import { ImmutableQueue } from "@tsplus/stdlib/collections/ImmutableQueue/definition";
import { Cause } from "@effect/core/io/Cause/definition";
import { Tuple } from "@tsplus/stdlib/data/Tuple/definition";
import { Maybe } from "@tsplus/stdlib/data/Maybe/definition";
import { Stack } from "@tsplus/stdlib/data/Stack";
import type { ChannelStateRead } from "@effect/core/stream/Channel/ChannelState";
import { ChannelState } from "@effect/core/stream/Channel/ChannelState";
import type { Continuation } from "@effect/core/stream/Channel/definition/primitives";
export declare type ErasedExecutor<Env> = ChannelExecutor<Env, unknown, unknown, unknown, unknown, unknown, unknown>;
export declare type ErasedChannel<R> = Channel<R, unknown, unknown, unknown, unknown, unknown, unknown>;
export declare type ErasedContinuation<R> = Continuation<R, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown>;
export declare type ErasedFinalizer<R> = (_: Exit<unknown, unknown>) => Effect.RIO<R, unknown>;
export declare class ChannelExecutor<R, InErr, InElem, InDone, OutErr, OutElem, OutDone> {
    private providedEnv;
    private executeCloseLastSubstream;
    private currentChannel;
    private done;
    private doneStack;
    private emitted;
    private inProgressFinalizer;
    private input;
    private activeSubexecutor;
    private cancelled;
    private closeLastSubstream;
    constructor(initialChannel: Lazy<Channel<R, InErr, InElem, InDone, OutErr, OutElem, OutDone>>, providedEnv: Env<unknown> | undefined, executeCloseLastSubstream: (_: Effect<R, never, unknown>) => Effect.RIO<R, unknown>);
    private restorePipe;
    private unwindAllFinalizers;
    private popAllFinalizers;
    private popNextFinalizersGo;
    private popNextFinalizers;
    private storeInProgressFinalizer;
    private clearInProgressFinalizer;
    private ifNotNull;
    close(exit: Exit<unknown, unknown>, __tsplusTrace?: string): Effect.RIO<R, unknown> | undefined;
    getDone(): Exit<OutErr, OutDone>;
    getEmit(): OutElem;
    cancelWith(exit: Exit<OutErr, OutDone>): void;
    run(): ChannelState<R, unknown>;
    private doneSucceed;
    doneHalt(cause: Cause<unknown>): ChannelState<R, unknown> | undefined;
    private processCancellation;
    private runBracketOut;
    private provide;
    private runEnsuring;
    private addFinalizer;
    private runFinalizers;
    private runSubexecutor;
    private replaceSubexecutor;
    private finishSubexecutorWithCloseEffect;
    finishWithExit(exit: Exit<unknown, unknown>, __tsplusTrace?: string): Effect<R, unknown, unknown>;
    private applyUpstreamPullStrategy;
    private performPullFromUpstream;
    private pullFromUpstream;
    private drainChildExecutors;
    private handleSubexecFailure;
    private finishWithDoneValue;
    private pullFromChild;
}
export declare function readUpstream<R, E, A>(r: ChannelStateRead<R, E>, cont: LazyArg<Effect<R, E, A>>, __tsplusTrace?: string): Effect<R, E, A>;
//# sourceMappingURL=ChannelExecutor.d.ts.map