import "../../../Operator";
import * as Cause from "../../../Cause";
import * as AR from "../../../Collections/Immutable/Array";
import * as A from "../../../Collections/Immutable/Chunk";
import * as Tp from "../../../Collections/Immutable/Tuple";
import * as T from "../../../Effect";
import * as E from "../../../Either";
import * as Ex from "../../../Exit";
import * as F from "../../../Fiber";
import type { Predicate } from "../../../Function";
import * as H from "../../../Hub";
import * as M from "../../../Managed";
import * as O from "../../../Option";
import * as PR from "../../../Promise";
import * as Q from "../../../Queue";
import * as Ref from "../../../Ref";
import * as MH from "./_internal/mergeHelpers";
import * as P from "./_internal/primitives";
import type { AsyncInputConsumer } from "./_internal/producer";
import * as C from "./core";
/**
 * Returns a new channel that is the same as this one, except the terminal value of the channel
 * is the specified constant value.
 *
 * This method produces the same result as mapping this channel to the specified constant value.
 */
export declare function as_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone, OutDone2>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, z2: OutDone2): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone2>;
/**
 * Returns a new channel that is the same as this one, except the terminal value of the channel
 * is the specified constant value.
 *
 * This method produces the same result as mapping this channel to the specified constant value.
 *
 * @ets_data_first as_
 */
export declare function as<OutDone2>(z2: OutDone2): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone2>;
/**
 * Returns a new channel that is the same as this one, except if this channel errors for any
 * typed error, then the returned channel will switch over to using the fallback channel returned
 * by the specified error handler.
 */
export declare function catchAll_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (error: OutErr) => C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem | OutElem1, OutDone | OutDone1>;
/**
 * Returns a new channel that is the same as this one, except if this channel errors for any
 * typed error, then the returned channel will switch over to using the fallback channel returned
 * by the specified error handler.
 *
 * @ets_data_first catchAll_
 */
export declare function catchAll<Env1, InErr1, InElem1, InDone1, OutErr, OutErr1, OutElem1, OutDone1>(f: (error: OutErr) => C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem1 | OutElem, OutDone1 | OutDone>;
/**
 * Returns a new channel that is the same as this one, except if this channel errors for any
 * typed error, then the returned channel will switch over to using the fallback channel returned
 * by the specified error handler.
 */
export declare function catchAllCause_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (cause: Cause.Cause<OutErr>) => C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1, OutElem | OutElem1, OutDone | OutDone1>;
/**
 * Returns a new channel that is the same as this one, except if this channel errors for any
 * typed error, then the returned channel will switch over to using the fallback channel returned
 * by the specified error handler.
 *
 * @ets_data_first catchAllCause_
 */
export declare function catchAllCause<Env1, InErr1, InElem1, InDone1, OutErr, OutErr1, OutElem1, OutDone1>(f: (cause: Cause.Cause<OutErr>) => C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1, OutElem1 | OutElem, OutDone1 | OutDone>;
/**
 * Returns a new channel, which is the same as this one, except its outputs are filtered and
 * transformed by the specified partial function.
 */
export declare function collect_<Env, InErr, InElem, InDone, OutErr, OutElem, OutElem2, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (o: OutElem) => O.Option<OutElem2>): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem2, OutDone>;
/**
 * Returns a new channel, which is the same as this one, except its outputs are filtered and
 * transformed by the specified partial function.
 *
 * @ets_data_first collect_
 */
export declare function collect<OutElem, OutElem2>(f: (o: OutElem) => O.Option<OutElem2>): <Env, InErr, InElem, InDone, OutErr, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem2, OutDone>;
/**
 * Returns a new channel, which is the concatenation of all the channels that are written out by
 * this channel. This method may only be called on channels that output other channels.
 */
export declare function concatOut<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, any>, OutDone>): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, any>;
export declare function contramap_<Env, InErr, InElem, InDone0, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (a: InDone0) => InDone): C.Channel<Env, InErr, InElem, InDone0, OutErr, OutElem, OutDone>;
/**
 * @ets_data_first contramap_
 */
export declare function contramap<InDone, InDone0>(f: (a: InDone0) => InDone): <Env, InErr, InElem, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone0, OutErr, OutElem, OutDone>;
export declare function contramapIn_<Env, InErr, InElem0, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (a: InElem0) => InElem): C.Channel<Env, InErr, InElem0, InDone, OutErr, OutElem, OutDone>;
/**
 * @ets_data_first contramapIn_
 */
export declare function contramapIn<InElem0, InElem>(f: (a: InElem0) => InElem): <Env, InErr, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem0, InDone, OutErr, OutElem, OutDone>;
export declare function contramapEffect_<Env, Env1, InErr, InElem, InDone0, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (i: InDone0) => T.Effect<Env1, InErr, InDone>): C.Channel<Env1 & Env, InErr, InElem, InDone0, OutErr, OutElem, OutDone>;
/**
 * @ets_data_first contramapEffect_
 */
export declare function contramapEffect<Env1, InErr, InDone0, InDone>(f: (i: InDone0) => T.Effect<Env1, InErr, InDone>): <Env, InElem, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env1 & Env, InErr, InElem, InDone0, OutErr, OutElem, OutDone>;
export declare function contramapInEffect_<Env, Env1, InErr, InElem0, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (a: InElem0) => T.Effect<Env1, InErr, InElem>): C.Channel<Env1 & Env, InErr, InElem0, InDone, OutErr, OutElem, OutDone>;
/**
 * @ets_data_first contramapInEffect_
 */
export declare function contramapInEffect<Env1, InErr, InElem0, InElem>(f: (a: InElem0) => T.Effect<Env1, InErr, InElem>): <Env, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env1 & Env, InErr, InElem0, InDone, OutErr, OutElem, OutDone>;
/**
 * Returns a new channel, which is the same as this one, except that all the outputs are
 * collected and bundled into a tuple together with the terminal value of this channel.
 *
 * As the channel returned from this channel collect's all of this channel's output into an in-
 * memory chunk, it is not safe to call this method on channels that output a large or unbounded
 * number of values.
 */
export declare function doneCollect<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>): C.Channel<Env, InErr, InElem, InDone, OutErr, never, Tp.Tuple<[A.Chunk<OutElem>, OutDone]>>;
/**
 * Returns a new channel, which is the same as this one, except it will be interrupted when the
 * specified effect completes. If the effect completes successfully before the underlying channel
 * is done, then the returned channel will yield the success value of the effect as its terminal
 * value. On the other hand, if the underlying channel finishes first, then the returned channel
 * will yield the success value of the underlying channel as its terminal value.
 */
export declare function interruptWhen_<Env, Env1, InErr, InElem, InDone, OutErr, OutErr1, OutElem, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, io: T.Effect<Env1, OutErr1, OutDone1>): C.Channel<Env1 & Env, InErr, InElem, InDone, OutErr | OutErr1, OutElem, OutDone | OutDone1>;
/**
 * Returns a new channel, which is the same as this one, except it will be interrupted when the
 * specified effect completes. If the effect completes successfully before the underlying channel
 * is done, then the returned channel will yield the success value of the effect as its terminal
 * value. On the other hand, if the underlying channel finishes first, then the returned channel
 * will yield the success value of the underlying channel as its terminal value.
 *
 * @ets_data_first interruptWhen_
 */
export declare function interruptWhen<Env1, OutErr1, OutDone1>(io: T.Effect<Env1, OutErr1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env1 & Env, InErr, InElem, InDone, OutErr1 | OutErr, OutElem, OutDone1 | OutDone>;
/**
 * Returns a new channel, which is the same as this one, except it will be interrupted when the
 * specified promise is completed. If the promise is completed before the underlying channel is
 * done, then the returned channel will yield the value of the promise. Otherwise, if the
 * underlying channel finishes first, then the returned channel will yield the value of the
 * underlying channel.
 */
export declare function interruptWhenP_<Env, InErr, InElem, InDone, OutErr, OutErr1, OutElem, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, promise: PR.Promise<OutErr1, OutDone1>): C.Channel<Env, InErr, InElem, InDone, OutErr | OutErr1, OutElem, OutDone | OutDone1>;
/**
 * Returns a new channel, which is the same as this one, except it will be interrupted when the
 * specified promise is completed. If the promise is completed before the underlying channel is
 * done, then the returned channel will yield the value of the promise. Otherwise, if the
 * underlying channel finishes first, then the returned channel will yield the value of the
 * underlying channel.
 *
 * @ets_data_first interruptWhenP_
 */
export declare function interruptWhenP<OutErr1, OutDone1>(promise: PR.Promise<OutErr1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr1 | OutErr, OutElem, OutDone1 | OutDone>;
/**
 * Returns a new channel that collects the output and terminal value of this channel, which it
 * then writes as output of the returned channel.
 */
export declare function emitCollect<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>): C.Channel<Env, InErr, InElem, InDone, OutErr, Tp.Tuple<[A.Chunk<OutElem>, OutDone]>, void>;
export declare function ensuring_<Env, Env1, InErr, InElem, InDone, OutErr, OutElem, OutDone, Z>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, finalizer: T.RIO<Env1, Z>): C.Channel<Env & Env1, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
/**
 * @ets_data_first ensuring_
 */
export declare function ensuring<Env1, Z>(finalizer: T.RIO<Env1, Z>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
export declare function foldChannel_<Env, Env1, Env2, InErr, InErr1, InErr2, InElem, InElem1, InElem2, InDone, InDone1, InDone2, OutErr, OutErr1, OutErr2, OutElem, OutElem1, OutElem2, OutDone, OutDone1, OutDone2>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, onErr: (oErr: OutErr) => C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>, onSucc: (oErr: OutDone) => C.Channel<Env2, InErr2, InElem2, InDone2, OutErr2, OutElem2, OutDone2>): P.Channel<Env & Env1 & Env2, InErr & InErr1 & InErr2, InElem & InElem1 & InElem2, InDone & InDone1 & InDone2, OutErr2 | OutErr1, OutElem | OutElem2 | OutElem1, OutDone2 | OutDone1>;
/**
 * @ets_data_first foldChannel_
 */
export declare function foldChannel<Env1, InErr1, InElem1, InDone1, OutErr, OutErr1, OutElem1, OutDone, OutDone1>(onErr: (oErr: OutErr) => C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>, onSucc: (oErr: OutDone) => C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutElem>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1, OutElem1 | OutElem, OutDone1>;
/**
 * Returns a new channel that will perform the operations of this one, until failure, and then
 * it will switch over to the operations of the specified fallback channel.
 */
export declare function orElse_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem | OutElem1, OutDone | OutDone1>;
/**
 * Returns a new channel that will perform the operations of this one, until failure, and then
 * it will switch over to the operations of the specified fallback channel.
 *
 * @ets_data_first orElse_
 */
export declare function orElse<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, OutDone1 | OutDone>;
/**
 * Returns a new channel, which is the same as this one, except the terminal value of the
 * returned channel is created by applying the specified function to the terminal value of this
 * channel.
 */
export declare function map_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone, OutDone2>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (out: OutDone) => OutDone2): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone2>;
/**
 * Returns a new channel, which is the same as this one, except the terminal value of the
 * returned channel is created by applying the specified function to the terminal value of this
 * channel.
 *
 * @ets_data_first map_
 */
export declare function map<OutDone, OutDone2>(f: (out: OutDone) => OutDone2): <Env, InErr, InElem, InDone, OutErr, OutElem>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone2>;
/**
 * Returns a new channel, which is the same as this one, except the failure value of the returned
 * channel is created by applying the specified function to the failure value of this channel.
 */
export declare function mapError_<Env, InErr, InElem, InDone, OutErr, OutErr2, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (err: OutErr) => OutErr2): C.Channel<Env, InErr, InElem, InDone, OutErr2, OutElem, OutDone>;
/**
 * Returns a new channel, which is the same as this one, except the failure value of the returned
 * channel is created by applying the specified function to the failure value of this channel.
 *
 * @ets_data_first mapError_
 */
export declare function mapError<OutErr, OutErr2>(f: (err: OutErr) => OutErr2): <Env, InErr, InElem, InDone, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr2, OutElem, OutDone>;
/**
 * A more powerful version of `mapError` which also surfaces the `Cause` of the channel failure
 */
export declare function mapErrorCause_<Env, InErr, InElem, InDone, OutErr, OutErr2, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (cause: Cause.Cause<OutErr>) => Cause.Cause<OutErr2>): C.Channel<Env, InErr, InElem, InDone, OutErr2, OutElem, OutDone>;
/**
 * A more powerful version of `mapError` which also surfaces the `Cause` of the channel failure
 *
 * @ets_data_first mapErrorCause_
 */
export declare function mapErrorCause<OutErr, OutErr2>(f: (cause: Cause.Cause<OutErr>) => Cause.Cause<OutErr2>): <Env, InErr, InElem, InDone, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr2, OutElem, OutDone>;
/**
 * Returns a new channel, which is the same as this one, except the terminal value of the
 * returned channel is created by applying the specified effectful function to the terminal value
 * of this channel.
 */
export declare function mapEffect_<Env, Env1, InErr, InElem, InDone, OutErr, OutErr1, OutElem, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (o: OutDone) => T.Effect<Env1, OutErr1, OutDone1>): C.Channel<Env & Env1, InErr, InElem, InDone, OutErr | OutErr1, OutElem, OutDone1>;
/**
 * Returns a new channel, which is the same as this one, except the terminal value of the
 * returned channel is created by applying the specified effectful function to the terminal value
 * of this channel.
 *
 * @ets_data_first mapEffect_
 */
export declare function mapEffect<Env1, OutErr1, OutDone, OutDone1>(f: (o: OutDone) => T.Effect<Env1, OutErr1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr, InElem, InDone, OutErr1 | OutErr, OutElem, OutDone1>;
/**
 * Returns a new channel, which is the merge of this channel and the specified channel, where
 * the behavior of the returned channel on left or right early termination is decided by the
 * specified `leftDone` and `rightDone` merge decisions.
 */
export declare function mergeWith_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutErr2, OutErr3, OutElem, OutElem1, OutDone, OutDone1, OutDone2, OutDone3>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>, leftDone: (ex: Ex.Exit<OutErr, OutDone>) => MH.MergeDecision<Env1, OutErr1, OutDone1, OutErr2, OutDone2>, rightDone: (ex: Ex.Exit<OutErr1, OutDone1>) => MH.MergeDecision<Env1, OutErr, OutDone, OutErr3, OutDone3>): C.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr2 | OutErr3, OutElem | OutElem1, OutDone2 | OutDone3>;
/**
 * Returns a new channel, which is the merge of this channel and the specified channel, where
 * the behavior of the returned channel on left or right early termination is decided by the
 * specified `leftDone` and `rightDone` merge decisions.
 *
 * @ets_data_first mergeWith_
 */
export declare function mergeWith<Env1, InErr1, InElem1, InDone1, OutErr, OutErr1, OutErr2, OutErr3, OutElem1, OutDone, OutDone1, OutDone2, OutDone3>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>, leftDone: (ex: Ex.Exit<OutErr, OutDone>) => MH.MergeDecision<Env1, OutErr1, OutDone1, OutErr2, OutDone2>, rightDone: (ex: Ex.Exit<OutErr1, OutDone1>) => MH.MergeDecision<Env1, OutErr, OutDone, OutErr3, OutDone3>): <Env, InErr, InElem, InDone, OutElem>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr2 | OutErr3, OutElem1 | OutElem, OutDone2 | OutDone3>;
/**
 * Maps the output of this channel using f
 */
export declare function mapOut_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone, OutElem2>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (o: OutElem) => OutElem2): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem2, OutDone>;
/**
 * Maps the output of this channel using f
 *
 * @ets_data_first mapOut_
 */
export declare function mapOut<OutElem, OutElem2>(f: (o: OutElem) => OutElem2): <Env, InErr, InElem, InDone, OutErr, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem2, OutDone>;
export declare function mapOutEffect_<Env, Env1, InErr, InElem, InDone, OutErr, OutErr1, OutElem, OutElem1, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (o: OutElem) => T.Effect<Env1, OutErr1, OutElem1>): C.Channel<Env & Env1, InErr, InElem, InDone, OutErr | OutErr1, OutElem1, OutDone>;
/**
 * @ets_data_first mapOutEffect_
 */
export declare function mapOutEffect<Env1, OutErr1, OutElem, OutElem1>(f: (o: OutElem) => T.Effect<Env1, OutErr1, OutElem1>): <Env, InErr, InElem, InDone, OutErr, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr, InElem, InDone, OutErr1 | OutErr, OutElem1, OutDone>;
export declare const never: C.Channel<unknown, unknown, unknown, unknown, never, never, never>;
export declare function orDie_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone, E>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, err: E): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
/**
 * @ets_data_first orDie_
 */
export declare function orDie<E>(err: E): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
export declare function orDieWith_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone, E>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (e: OutErr) => E): P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
/**
 * @ets_data_first orDieWith_
 */
export declare function orDieWith<OutErr, E>(f: (e: OutErr) => E): <Env, InErr, InElem, InDone, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
/**
 * Repeats this channel forever
 */
export declare function repeated<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
/**
 * Runs a channel until the end is received
 */
export declare function runManaged<Env, InErr, InDone, OutErr, OutDone>(self: C.Channel<Env, InErr, unknown, InDone, OutErr, never, OutDone>): M.Managed<Env, OutErr, OutDone>;
/**
 * Runs a channel until the end is received
 */
export declare function run<Env, InErr, InDone, OutErr, OutDone>(self: C.Channel<Env, InErr, unknown, InDone, OutErr, never, OutDone>): T.Effect<Env, OutErr, OutDone>;
export declare function runCollect<Env, InErr, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, unknown, InDone, OutErr, OutElem, OutDone>): T.Effect<Env, OutErr, Tp.Tuple<[A.Chunk<OutElem>, OutDone]>>;
/**
 * Runs a channel until the end is received
 */
export declare function runDrain<Env, InErr, InDone, OutElem, OutErr, OutDone>(self: C.Channel<Env, InErr, unknown, InDone, OutErr, OutElem, OutDone>): T.Effect<Env, OutErr, OutDone>;
export declare function unit_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, void>;
/**
 * Interpret a channel to a managed Pull
 */
export declare function toPull<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>): M.Managed<Env, never, T.Effect<Env, E.Either<OutErr, OutDone>, OutElem>>;
/**
 * Returns a new channel that is the sequential composition of this channel and the specified
 * channel. The returned channel terminates with a tuple of the terminal values of both channels.
 */
export declare function zip_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem | OutElem1, Tp.Tuple<[OutDone, OutDone1]>>;
/**
 * Returns a new channel that is the sequential composition of this channel and the specified
 * channel. The returned channel terminates with a tuple of the terminal values of both channels.
 *
 * @ets_data_first zip_
 */
export declare function zip<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, Tp.Tuple<[OutDone, OutDone1]>>;
/**
 * Returns a new channel that is the sequential composition of this channel and the specified
 * channel. The returned channel terminates with the terminal value of this channel.
 */
export declare function zipLeft_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem | OutElem1, OutDone>;
/**
 * Returns a new channel that is the sequential composition of this channel and the specified
 * channel. The returned channel terminates with the terminal value of this channel.
 *
 * @ets_data_first zipLeft_
 */
export declare function zipLeft<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, OutDone>;
export declare function zipPar_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem | OutElem1, Tp.Tuple<[OutDone, OutDone1]>>;
/**
 * @ets_data_first zipPar_
 */
export declare function zipPar<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, Tp.Tuple<[OutDone, OutDone1]>>;
export declare function zipParLeft_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem | OutElem1, OutDone>;
/**
 * @ets_data_first zipParLeft_
 */
export declare function zipParLeft<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, OutDone>;
export declare function zipParRight_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr | OutErr1, OutElem | OutElem1, OutDone1>;
/**
 * @ets_data_first zipParRight_
 */
export declare function zipParRight<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env1 & Env, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, OutDone1>;
/**
 * Returns a new channel that is the sequential composition of this channel and the specified
 * channel. The returned channel terminates with the terminal value of the other channel.
 */
export declare function zipRight_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): C.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, OutDone1>;
/**
 * Returns a new channel that is the sequential composition of this channel and the specified
 * channel. The returned channel terminates with the terminal value of the other channel.
 *
 * @ets_data_first zipRight_
 */
export declare function zipRight<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>(that: C.Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => P.Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1 | OutErr, OutElem1 | OutElem, OutDone1>;
export declare function bracketOut_<Env, OutErr, Acquired, Z>(acquire: T.Effect<Env, OutErr, Acquired>, release: (a: Acquired) => T.RIO<Env, Z>): C.Channel<Env, unknown, unknown, unknown, OutErr, Acquired, void>;
/**
 * @ets_data_first bracketOut_
 */
export declare function bracketOut<Env, Acquired, Z>(release: (a: Acquired) => T.RIO<Env, Z>): <OutErr>(acquire: T.Effect<Env, OutErr, Acquired>) => P.Channel<Env, unknown, unknown, unknown, OutErr, Acquired, void>;
export declare function bracket_<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone, Acquired>(acquire: T.Effect<Env, OutErr, Acquired>, use: (a: Acquired) => C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>, release: (a: Acquired) => T.RIO<Env, any>): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>;
/**
 * @ets_data_first bracket_
 */
export declare function bracket<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone, Acquired>(use: (a: Acquired) => C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>, release: (a: Acquired) => T.RIO<Env, any>): (acquire: T.Effect<Env, OutErr, Acquired>) => P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>;
export declare function bracketExit_<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone, Acquired>(acquire: T.Effect<Env, OutErr, Acquired>, use: (a: Acquired) => C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>, release: (a: Acquired, exit: Ex.Exit<OutErr, OutDone>) => T.RIO<Env, any>): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>;
/**
 * @ets_data_first bracketExit_
 */
export declare function bracketExit<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone, Acquired>(use: (a: Acquired) => C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>, release: (a: Acquired, exit: Ex.Exit<OutErr, OutDone>) => T.RIO<Env, any>): (acquire: T.Effect<Env, OutErr, Acquired>) => P.Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>;
/**
 * Creates a channel backed by a buffer. When the buffer is empty, the channel will simply
 * passthrough its input as output. However, when the buffer is non-empty, the value inside
 * the buffer will be passed along as output.
 */
export declare function buffer<InElem, InErr, InDone>(empty: InElem, isEmpty: Predicate<InElem>, ref: Ref.Ref<InElem>): C.Channel<unknown, InErr, InElem, InDone, InErr, InElem, InDone>;
export declare function bufferChunk<InElem, InErr, InDone>(ref: Ref.Ref<A.Chunk<InElem>>): C.Channel<unknown, InErr, A.Chunk<InElem>, InDone, InErr, A.Chunk<InElem>, InDone>;
export declare function concatAll<Env, InErr, InElem, InDone, OutErr, OutElem>(channels: C.Channel<Env, InErr, InElem, InDone, OutErr, C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, any>, any>): C.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, any>;
export declare function fromEither<E, A>(either: E.Either<E, A>): C.Channel<unknown, unknown, unknown, unknown, E, never, A>;
export declare function fromOption<A>(option: O.Option<A>): C.Channel<unknown, unknown, unknown, unknown, O.None, never, A>;
export declare function identity<Err, Elem, Done>(): C.Channel<unknown, Err, Elem, Done, Err, Elem, Done>;
export declare function interrupt(fiberId: F.FiberID): C.Channel<unknown, unknown, unknown, unknown, never, never, never>;
export declare function managed_<Env, Env1, InErr, InElem, InDone, OutErr, OutErr1, OutElem, OutDone, A>(m: M.Managed<Env, OutErr, A>, use: (a: A) => C.Channel<Env1, InErr, InElem, InDone, OutErr1, OutElem, OutDone>): P.Channel<Env & Env1, InErr, InElem, InDone, OutErr | OutErr1, OutElem, OutDone>;
/**
 * @ets_data_first managed_
 */
export declare function managed<Env, Env1, InErr, InElem, InDone, OutErr, OutErr1, OutElem, OutDone, A>(use: (a: A) => C.Channel<Env1, InErr, InElem, InDone, OutErr1, OutElem, OutDone>): (m: M.Managed<Env, OutErr, A>) => P.Channel<Env & Env1, InErr, InElem, InDone, OutErr | OutErr1, OutElem, OutDone>;
export declare function readOrFail<In, E>(e: E): C.Channel<unknown, unknown, In, unknown, E, never, In>;
export declare function read<In>(): C.Channel<unknown, unknown, In, unknown, O.None, never, In>;
export declare function succeed<Z>(z: Z): C.Channel<unknown, unknown, unknown, unknown, never, never, Z>;
export declare function fromHub<Err, Done, Elem>(hub: H.Hub<Ex.Exit<E.Either<Err, Done>, Elem>>): P.Channel<unknown, unknown, unknown, unknown, Err, Elem, Done>;
export declare function fromInput<Err, Elem, Done>(input: AsyncInputConsumer<Err, Elem, Done>): C.Channel<unknown, unknown, unknown, unknown, Err, Elem, Done>;
export declare function fromQueue<Err, Elem, Done>(queue: Q.Dequeue<Ex.Exit<E.Either<Err, Done>, Elem>>): C.Channel<unknown, unknown, unknown, unknown, Err, Elem, Done>;
export declare function toHub<Err, Done, Elem>(hub: H.Hub<Ex.Exit<E.Either<Err, Done>, Elem>>): P.Channel<unknown, Err, Elem, Done, never, never, any>;
export declare function toQueue<Err, Done, Elem>(queue: Q.Enqueue<Ex.Exit<E.Either<Err, Done>, Elem>>): C.Channel<unknown, Err, Elem, Done, never, never, any>;
export declare function writeAll<Out>(...outs: AR.Array<Out>): C.Channel<unknown, unknown, unknown, unknown, never, Out, void>;
export declare function writeChunk<Out>(outs: A.Chunk<Out>): P.Channel<unknown, unknown, unknown, unknown, never, Out, void>;
//# sourceMappingURL=api.d.ts.map