import "../../../Operator";
import * as CS from "../../../Cause";
import * as CL from "../../../Clock";
import * as A from "../../../Collections/Immutable/Chunk";
import * as HM from "../../../Collections/Immutable/HashMap";
import * as HS from "../../../Collections/Immutable/HashSet";
import * as Tp from "../../../Collections/Immutable/Tuple";
import * as T from "../../../Effect";
import type { Predicate, Refinement } from "../../../Function";
import type * as M from "../../../Managed";
import * as O from "../../../Option";
import * as C from "../Channel";
/**
 * Sink is a data type that represent a channel that reads elements
 * of type `In`, handles input errors of type `InErr`, emits errors
 * of type `OutErr`, emits outputs of type `L` and ends with a value
 * of type `Z`.
 */
export declare class Sink<R, InErr, In, OutErr, L, Z> {
    readonly channel: C.Channel<R, InErr, A.Chunk<In>, unknown, OutErr, A.Chunk<L>, Z>;
    constructor(channel: C.Channel<R, InErr, A.Chunk<In>, unknown, OutErr, A.Chunk<L>, Z>);
}
/**
 * Replaces this sink's result with the provided value.
 */
export declare function as_<R, InErr, In, OutErr, L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, z: Z1): Sink<R, InErr, In, OutErr, L, Z1>;
/**
 * Replaces this sink's result with the provided value.
 *
 * @ets_data_first as_
 */
export declare function as<Z1>(z: Z1): <R, InErr, In, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In, OutErr, L, Z1>;
/**
 * Repeatedly runs the sink for as long as its results satisfy
 * the predicate `p`. The sink's results will be accumulated
 * using the stepping function `f`.
 */
export declare function collectAllWhileWith_<R, InErr, In, OutErr, L extends In, Z, S>(self: Sink<R, InErr, In, OutErr, L, Z>, z: S, p: Predicate<Z>, f: (s: S, z: Z) => S): Sink<R, InErr, In, OutErr, L, S>;
/**
 * Repeatedly runs the sink for as long as its results satisfy
 * the predicate `p`. The sink's results will be accumulated
 * using the stepping function `f`.
 *
 * @ets_data_first collectAllWhileWith_
 */
export declare function collectAllWhileWith<Z, S>(z: S, p: Predicate<Z>, f: (s: S, z: Z) => S): <R, InErr, In, OutErr, L extends In>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In, OutErr, L, S>;
/**
 * Transforms this sink's input elements.
 */
export declare function contramap_<R, InErr, In, In1, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (in_: In1) => In): Sink<R, InErr, In1, OutErr, L, Z>;
/**
 * Transforms this sink's input elements.
 *
 * @ets_data_first contramap_
 */
export declare function contramap<In, In1>(f: (in_: In1) => In): <R, InErr, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In1, OutErr, L, Z>;
/**
 * Transforms this sink's input chunks.
 * `f` must preserve chunking-invariance
 */
export declare function contramapChunks_<R, InErr, In, In1, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (c: A.Chunk<In1>) => A.Chunk<In>): Sink<R, InErr, In1, OutErr, L, Z>;
/**
 * Transforms this sink's input chunks.
 * `f` must preserve chunking-invariance
 *
 * @ets_data_first contramapChunks_
 */
export declare function contramapChunks<In, In1>(f: (c: A.Chunk<In1>) => A.Chunk<In>): <R, InErr, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In1, OutErr, L, Z>;
/**
 * Effectfully transforms this sink's input chunks.
 * `f` must preserve chunking-invariance
 */
export declare function contramapChunksEffect_<R, R1, InErr, InErr1 extends InErr, In, In1, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (c: A.Chunk<In1>) => T.Effect<R1, InErr1, A.Chunk<In>>): Sink<R1 & R, InErr & InErr1, In1, OutErr, L, Z>;
/**
 * Effectfully transforms this sink's input chunks.
 * `f` must preserve chunking-invariance
 *
 * @ets_data_first contramapChunksEffect_
 */
export declare function contramapChunksEffect<R1, In, InErr, InErr1 extends InErr, In1>(f: (c: A.Chunk<In1>) => T.Effect<R1, InErr1, A.Chunk<In>>): <R, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R1 & R, InErr & InErr1, In1, OutErr, L, Z>;
/**
 * Effectfully transforms this sink's input elements.
 */
export declare function contramapEffect_<R, R1, InErr, InErr1 extends InErr, In, In1, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (in_: In1) => T.Effect<R1, InErr1, In>): Sink<R1 & R, InErr & InErr1, In1, OutErr, L, Z>;
/**
 * Effectfully transforms this sink's input elements.
 *
 * @ets_data_first contramapEffect_
 */
export declare function contramapEffect<R1, InErr, InErr1 extends InErr, In, In1>(f: (in_: In1) => T.Effect<R1, InErr1, In>): <R, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R1 & R, InErr & InErr1, In1, OutErr, L, Z>;
/**
 * Transforms both inputs and result of this sink using the provided functions.
 */
export declare function dimap_<R, InErr, In, In1, OutErr, L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (in_: In1) => In, g: (z: Z) => Z1): Sink<R, InErr, In1, OutErr, L, Z1>;
/**
 * Transforms both inputs and result of this sink using the provided functions.
 *
 * @ets_data_first dimap_
 */
export declare function dimap<In, In1, Z, Z1>(f: (in_: In1) => In, g: (z: Z) => Z1): <R, InErr, OutErr, L>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In1, OutErr, L, Z1>;
/**
 * Transforms both input chunks and result of this sink using the provided functions.
 */
export declare function dimapChunks_<R, InErr, In, In1, OutErr, L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (in_: A.Chunk<In1>) => A.Chunk<In>, g: (z: Z) => Z1): Sink<R, InErr, In1, OutErr, L, Z1>;
/**
 * Transforms both input chunks and result of this sink using the provided functions.
 *
 * @ets_data_first dimapChunks_
 */
export declare function dimapChunks<In, In1, Z, Z1>(f: (in_: A.Chunk<In1>) => A.Chunk<In>, g: (z: Z) => Z1): <R, InErr, OutErr, L>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In1, OutErr, L, Z1>;
/**
 * Effectfully transforms both input chunks and result of this sink using the provided functions.
 * `f` and `g` must preserve chunking-invariance
 */
export declare function dimapChunksEffect_<R, R1, R2, InErr, InErr1 extends InErr, In, In1, OutErr, OutErr1, L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (in_: A.Chunk<In1>) => T.Effect<R1, InErr1, A.Chunk<In>>, g: (z: Z) => T.Effect<R2, OutErr1, Z1>): Sink<R1 & R & R2, InErr & InErr1, In1, OutErr | OutErr1, L, Z1>;
/**
 * Effectfully transforms both input chunks and result of this sink using the provided functions.
 * `f` and `g` must preserve chunking-invariance
 *
 * @ets_data_first dimapChunksEffect_
 */
export declare function dimapChunksEffect<R1, R2, InErr, InErr1 extends InErr, In, In1, OutErr1, Z, Z1>(f: (in_: A.Chunk<In1>) => T.Effect<R1, InErr1, A.Chunk<In>>, g: (z: Z) => T.Effect<R2, OutErr1, Z1>): <R, OutErr, L>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R1 & R & R2, InErr & InErr1, In1, OutErr1 | OutErr, L, Z1>;
/**
 * Effectfully transforms both inputs and result of this sink using the provided functions.
 */
export declare function dimapEffect_<R, R1, R2, InErr, InErr1 extends InErr, In, In1, OutErr, OutErr1, L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (in_: In1) => T.Effect<R1, InErr1, In>, g: (z: Z) => T.Effect<R2, OutErr1, Z1>): Sink<R1 & R & R2, InErr & InErr1, In1, OutErr | OutErr1, L, Z1>;
/**
 * Effectfully transforms both inputs and result of this sink using the provided functions.
 *
 * @ets_data_first dimapEffect_
 */
export declare function dimapEffect<R1, R2, InErr, InErr1 extends InErr, In, In1, OutErr1, Z, Z1>(f: (in_: In1) => T.Effect<R1, InErr1, In>, g: (z: Z) => T.Effect<R2, OutErr1, Z1>): <R, OutErr, L>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R1 & R & R2, InErr & InErr1, In1, OutErr1 | OutErr, L, Z1>;
export declare function filterInput_<R, InErr, In, In1 extends In, In2 extends In1, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, p: Refinement<In1, In2>): Sink<R, InErr, In2, OutErr, L, Z>;
export declare function filterInput_<R, InErr, In, In1 extends In, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, p: Predicate<In1>): Sink<R, InErr, In1, OutErr, L, Z>;
/**
 * @ets_data_first filterInput_
 */
export declare function filterInput<In, In1 extends In, In2 extends In1>(p: Refinement<In1, In2>): <R, InErr, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In2, OutErr, L, Z>;
export declare function filterInput<In, In1 extends In>(p: Predicate<In1>): <R, InErr, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In1, OutErr, L, Z>;
export declare function filterInputEffect_<R, R1, InErr, InErr1 extends InErr, In, In1 extends In, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, p: (in_: In1) => T.Effect<R1, InErr1, boolean>): Sink<R1 & R, InErr & InErr1, In1, OutErr, L, Z>;
/**
 * @ets_data_first filterInputEffect_
 */
export declare function filterInputEffect<R1, InErr, InErr1 extends InErr, In, In1 extends In>(p: (in_: In1) => T.Effect<R1, InErr1, boolean>): <R, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R1 & R, InErr & InErr1, In1, OutErr, L, Z>;
/**
 * Runs this sink until it yields a result, then uses that result to create another
 * sink from the provided function which will continue to run until it yields a result.
 *
 * This function essentially runs sinks in sequence.
 */
export declare function chain_<R, R1, InErr, InErr1, In, In1 extends In, OutErr, OutErr1, L, L1 extends L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (z: Z) => Sink<R1, InErr1, In1, OutErr1, L1, Z1>): Sink<R & R1, InErr & InErr1, In & In1, OutErr | OutErr1, L1, Z1>;
/**
 * Runs this sink until it yields a result, then uses that result to create another
 * sink from the provided function which will continue to run until it yields a result.
 *
 * This function essentially runs sinks in sequence.
 *
 * @ets_data_first chain_
 */
export declare function chain<R1, InErr1, In, In1 extends In, OutErr1, L, L1 extends L, Z, Z1>(f: (z: Z) => Sink<R1, InErr1, In1, OutErr1, L1, Z1>): <R, InErr, OutErr>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1, InErr & InErr1, In & In1, OutErr1 | OutErr, L1, Z1>;
export declare function foldSink_<R, R1, R2, InErr, InErr1, InErr2, In, In1 extends In, In2 extends In, OutErr, OutErr2, OutErr3, L, L1 extends L, L2 extends L, Z, Z1, Z2>(self: Sink<R, InErr, In, OutErr, L, Z>, failure: (err: OutErr) => Sink<R1, InErr1, In1, OutErr2, L1, Z1>, success: (z: Z) => Sink<R2, InErr2, In2, OutErr3, L2, Z2>): Sink<R & R1 & R2, InErr & InErr1 & InErr2, In1 & In2, OutErr2 | OutErr3, L1 | L2, Z1 | Z2>;
/**
 *
 * @ets_data_first foldSink_
 */
export declare function foldSink<R1, R2, InErr1, InErr2, In, In1 extends In, In2 extends In, OutErr, OutErr2, OutErr3, L, L1 extends L, L2 extends L, Z, Z1, Z2>(failure: (err: OutErr) => Sink<R1, InErr1, In1, OutErr2, L1, Z1>, success: (z: Z) => Sink<R2, InErr2, In2, OutErr3, L2, Z2>): <R, InErr>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1 & R2, InErr & InErr1 & InErr2, In1 & In2, OutErr2 | OutErr3, L1 | L2, Z1 | Z2>;
/**
 * Transforms this sink's result.
 */
export declare function map_<R, InErr, In, OutErr, L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (z: Z) => Z1): Sink<R, InErr, In, OutErr, L, Z1>;
/**
 * Transforms this sink's result.
 *
 * @ets_data_first map_
 */
export declare function map<Z, Z1>(f: (z: Z) => Z1): <R, InErr, In, OutErr, L>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In, OutErr, L, Z1>;
/**
 * Transforms the errors emitted by this sink using `f`.
 */
export declare function mapError_<R, InErr, In, OutErr, OutErr1, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (err: OutErr) => OutErr1): Sink<R, InErr, In, OutErr1, L, Z>;
/**
 * Transforms the errors emitted by this sink using `f`.
 *
 * @ets_data_first mapError_
 */
export declare function mapError<OutErr, OutErr1>(f: (err: OutErr) => OutErr1): <R, InErr, In, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R, InErr, In, OutErr1, L, Z>;
/**
 * Effectfully transforms this sink's result.
 */
export declare function mapEffect_<R, R1, InErr, In, OutErr, OutErr1, L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, f: (z: Z) => T.Effect<R1, OutErr1, Z1>): Sink<R & R1, InErr, In, OutErr | OutErr1, L, Z1>;
/**
 * Effectfully transforms this sink's result.
 *
 * @ets_data_first mapEffect_
 */
export declare function mapEffect<R1, OutErr1, Z, Z1>(f: (z: Z) => T.Effect<R1, OutErr1, Z1>): <R, InErr, In, OutErr, L>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1, InErr, In, OutErr1 | OutErr, L, Z1>;
/**
 * Returns the sink that executes this one and times its execution.
 */
export declare function timed<R, InErr, In, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>): Sink<CL.HasClock & R, InErr, In, OutErr, L, Tp.Tuple<[Z, number]>>;
export declare function repeat<R, InErr, In, OutErr, L extends In, Z>(self: Sink<R, InErr, In, OutErr, L, Z>): Sink<R, InErr, In, OutErr, L, A.Chunk<Z>>;
/**
 * Summarize a sink by running an effect when the sink starts and again when it completes
 */
export declare function summarized_<R, R1, E1, InErr, In, OutErr, L, Z, B, C>(self: Sink<R, InErr, In, OutErr, L, Z>, summary: T.Effect<R1, E1, B>, f: (b1: B, b2: B) => C): Sink<R1 & R, InErr, In, E1 | OutErr, L, Tp.Tuple<[Z, C]>>;
/**
 * Summarize a sink by running an effect when the sink starts and again when it completes
 * @ets_data_first summarized_
 */
export declare function summarized<R1, E1, B, C>(summary: T.Effect<R1, E1, B>, f: (b1: B, b2: B) => C): <R, InErr, In, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R1 & R, InErr, In, E1 | OutErr, L, Tp.Tuple<[Z, C]>>;
export declare function orElse_<R, R1, InErr, InErr1, In, In1 extends In, OutErr, OutErr1, L, L1 extends L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): Sink<R & R1, InErr & InErr1, In1, OutErr | OutErr1, L, Z | Z1>;
/**
 * @ets_data_first orElse_
 */
export declare function orElse<R1, InErr1, In, In1 extends In, OutErr1, L, L1 extends L, Z1>(that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): <R, InErr, OutErr, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1, InErr & InErr1, In1, OutErr1 | OutErr, L, Z1 | Z>;
export declare function zip_<R, R1, InErr, InErr1, In, In1 extends In, OutErr, OutErr1, L, L1 extends L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): Sink<R & R1, InErr & InErr1, In & In1, OutErr | OutErr1, L1, Tp.Tuple<[Z, Z1]>>;
/**
 * @ets_data_first zip_
 */
export declare function zip<R1, InErr1, In, In1 extends In, OutErr1, L, L1 extends L, Z1>(that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): <R, InErr, OutErr, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1, InErr & InErr1, In & In1, OutErr1 | OutErr, L1, Tp.Tuple<[Z, Z1]>>;
/**
 * Like `zip`, but keeps only the result from the `that` sink.
 */
export declare function zipLeft_<R, R1, InErr, InErr1, In, In1 extends In, OutErr, OutErr1, L, L1 extends L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): Sink<R & R1, InErr & InErr1, In & In1, OutErr | OutErr1, L1, Z>;
/**
 * Like `zip`, but keeps only the result from `that sink.
 *
 * @ets_data_first zipLeft_
 */
export declare function zipLeft<R1, InErr1, In, In1 extends In, OutErr1, L, L1 extends L, Z1>(that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): <R, InErr, OutErr, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1, InErr & InErr1, In & In1, OutErr1 | OutErr, L1, Z>;
/**
 * Like `zip`, but keeps only the result from this sink.
 */
export declare function zipRight_<R, R1, InErr, InErr1, In, In1 extends In, OutErr, OutErr1, L, L1 extends L, Z, Z1>(self: Sink<R, InErr, In, OutErr, L, Z>, that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): Sink<R & R1, InErr & InErr1, In & In1, OutErr | OutErr1, L1, Z1>;
/**
 * Like `zip`, but keeps only the result from this sink.
 *
 * @ets_data_first zipRight_
 */
export declare function zipRight<R1, InErr1, In, In1 extends In, OutErr1, L, L1 extends L, Z1>(that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>): <R, InErr, OutErr, Z>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1, InErr & InErr1, In & In1, OutErr1 | OutErr, L1, Z1>;
/**
 * Feeds inputs to this sink until it yields a result, then switches over to the
 * provided sink until it yields a result, finally combining the two results with `f`.
 */
export declare function zipWith_<R, R1, InErr, InErr1, In, In1 extends In, OutErr, OutErr1, L, L1 extends L, Z, Z1, Z2>(self: Sink<R, InErr, In, OutErr, L, Z>, that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>, f: (z: Z, z1: Z1) => Z2): Sink<R & R1, InErr & InErr1, In & In1, OutErr | OutErr1, L1, Z2>;
/**
 * Feeds inputs to this sink until it yields a result, then switches over to the
 * provided sink until it yields a result, finally combining the two results with `f`.
 *
 * @ets_data_first zipWith_
 */
export declare function zipWith<R1, InErr1, In, In1 extends In, OutErr1, L, L1 extends L, Z, Z1, Z2>(that: Sink<R1, InErr1, In1, OutErr1, L1, Z1>, f: (z: Z, z1: Z1) => Z2): <R, InErr, OutErr>(self: Sink<R, InErr, In, OutErr, L, Z>) => Sink<R & R1, InErr & InErr1, In & In1, OutErr1 | OutErr, L1, Z2>;
export declare function exposeLeftover<R, InErr, In, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>): Sink<R, InErr, In, OutErr, unknown, Tp.Tuple<[Z, A.Chunk<L>]>>;
export declare function dropLeftover<R, InErr, In, OutErr, L, Z>(self: Sink<R, InErr, In, OutErr, L, Z>): Sink<R, InErr, In, OutErr, unknown, Z>;
export declare function accessSink<R, InErr, In, OutErr, L, Z>(f: (r: R) => Sink<R, InErr, In, OutErr, L, Z>): Sink<R, InErr, In, OutErr, L, Z>;
/**
 * A sink that collects all of its inputs into a chunk.
 */
export declare function collectAll<Err, A>(): Sink<unknown, Err, A, Err, never, A.Chunk<A>>;
/**
 * A sink that collects first `n` elements into a chunk. Note that the chunk
 * is preallocated and must fit in memory.
 */
export declare function collectAllN<Err, In>(n: number): Sink<unknown, Err, In, Err, In, A.Chunk<In>>;
/**
 * A sink that collects all of its inputs into a map. The keys are extracted from inputs
 * using the keying function `key`; if multiple inputs use the same key, they are merged
 * using the `f` function.
 */
export declare function collectAllToMap<Err, In, K>(key: (in_: In) => K, f: (in1: In, in2: In) => In): Sink<unknown, Err, In, Err, unknown, HM.HashMap<K, In>>;
/**
 * A sink that collects first `n` keys into a map. The keys are calculated
 * from inputs using the keying function `key`; if multiple inputs use the
 * the same key, they are merged using the `f` function.
 */
export declare function collectAllToMapN<Err, In, K>(n: number, key: (in_: In) => K, f: (in1: In, in2: In) => In): Sink<unknown, Err, In, Err, In, HM.HashMap<K, In>>;
/**
 * A sink that collects all of its inputs into a set.
 */
export declare function collectAllToSet<Err, In>(): Sink<unknown, Err, In, Err, unknown, HS.HashSet<In>>;
/**
 * A sink that collects first `n` distinct inputs into a set.
 */
export declare function collectAllToSetN<Err, In>(n: number): Sink<unknown, Err, In, Err, In, HS.HashSet<In>>;
/**
 * Accumulates incoming elements into a chunk as long as they verify predicate `p`.
 */
export declare function collectAllWhile<Err, In>(p: Predicate<In>): Sink<unknown, Err, In, Err, In, A.Chunk<In>>;
/**
 * Accumulates incoming elements into a chunk as long as they verify effectful predicate `p`.
 */
export declare function collectAllWhileEffect<Env, Err, In>(p: (in_: In) => T.Effect<Env, Err, boolean>): Sink<Env, Err, In, Err, In, A.Chunk<In>>;
/**
 * A sink that counts the number of elements fed to it.
 */
export declare function count<Err>(): Sink<unknown, Err, unknown, Err, unknown, number>;
/**
 * Creates a sink halting with the specified `Throwable`.
 */
export declare function die<E>(e: E): Sink<unknown, unknown, unknown, never, unknown, never>;
/**
 * Creates a sink halting with the specified message, wrapped in a
 * `RuntimeException`.
 */
export declare function dieMessage(message: string): Sink<unknown, unknown, unknown, never, unknown, never>;
/**
 * A sink that ignores all of its inputs.
 */
export declare function drain<Err, A>(): Sink<unknown, Err, A, Err, never, void>;
/**
 * Returns a lazily constructed sink that may require effects for its creation.
 */
export declare function suspend<R, InErr, In, OutErr, L, Z>(f: () => Sink<R, InErr, In, OutErr, L, Z>): Sink<R, InErr, In, OutErr, L, Z>;
/**
 * Returns a sink that executes a total effect and ends with its result.
 */
export declare function succeedWith<A>(effect: () => A): Sink<unknown, unknown, unknown, never, unknown, A>;
/**
 * A sink that always fails with the specified error.
 */
export declare function fail<E>(e: E): Sink<unknown, unknown, unknown, E, never, never>;
/**
 * Creates a sink halting with a specified cause.
 */
export declare function failCause<E>(e: CS.Cause<E>): Sink<unknown, unknown, unknown, E, unknown, never>;
/**
 * A sink that folds its inputs with the provided function, termination predicate and initial state.
 */
export declare function fold<Err, In, S>(z: S, contFn: Predicate<S>, f: (s: S, in_: In) => S): Sink<unknown, Err, In, Err, In, S>;
/**
 * A sink that folds its input chunks with the provided function, termination predicate and initial state.
 * `contFn` condition is checked only for the initial value and at the end of processing of each chunk.
 * `f` and `contFn` must preserve chunking-invariance.
 */
export declare function foldChunks<Err, In, S>(z: S, contFn: Predicate<S>, f: (s: S, chunk: A.Chunk<In>) => S): Sink<unknown, Err, In, Err, unknown, S>;
/**
 * A sink that effectfully folds its input chunks with the provided function, termination predicate and initial state.
 * `contFn` condition is checked only for the initial value and at the end of processing of each chunk.
 * `f` and `contFn` must preserve chunking-invariance.
 */
export declare function foldChunksEffect<Env, Err, In, S>(z: S, contFn: Predicate<S>, f: (s: S, chunk: A.Chunk<In>) => T.Effect<Env, Err, S>): Sink<Env, Err, In, Err, unknown, S>;
/**
 * A sink that folds its inputs with the provided function and initial state.
 */
export declare function foldLeft<Err, In, S>(z: S, f: (s: S, in_: In) => S): Sink<unknown, Err, In, Err, unknown, S>;
/**
 * A sink that folds its input chunks with the provided function and initial state.
 * `f` must preserve chunking-invariance.
 */
export declare function foldLeftChunks<Err, In, S>(z: S, f: (s: S, chunk: A.Chunk<In>) => S): Sink<unknown, Err, In, Err, unknown, S>;
/**
 * A sink that effectfully folds its input chunks with the provided function and initial state.
 * `f` must preserve chunking-invariance.
 */
export declare function foldLeftChunksEffect<R, Err, In, S>(z: S, f: (s: S, chunk: A.Chunk<In>) => T.Effect<R, Err, S>): Sink<R, Err, In, Err, unknown, S>;
/**
 * A sink that effectfully folds its inputs with the provided function and initial state.
 */
export declare function foldLeftEffect<R, Err, In, S>(z: S, f: (s: S, in_: In) => T.Effect<R, Err, S>): Sink<R, Err, In, Err, In, S>;
/**
 * Creates a sink that folds elements of type `In` into a structure
 * of type `S` until `max` elements have been folded.
 *
 * Like `foldWeighted`, but with a constant cost function of 1.
 */
export declare function foldUntil<Err, In, S>(z: S, max: number, f: (s: S, in_: In) => S): Sink<unknown, Err, In, Err, In, S>;
/**
 * Creates a sink that effectfully folds elements of type `In` into a structure
 * of type `S` until `max` elements have been folded.
 *
 * Like `foldWeightedM`, but with a constant cost function of 1.
 */
export declare function foldUntilEffect<Env, In, Err, S>(z: S, max: number, f: (s: S, in_: In) => T.Effect<Env, Err, S>): Sink<Env, Err, In, Err, In, S>;
/**
 * Creates a sink that folds elements of type `In` into a structure
 * of type `S`, until `max` worth of elements (determined by the `costFn`)
 * have been folded.
 *
 * @note Elements that have an individual cost larger than `max` will
 * force the sink to cross the `max` cost. See `foldWeightedDecompose`
 * for a variant that can handle these cases.
 */
export declare function foldWeighted<Err, In, S>(z: S, costFn: (s: S, in_: In) => number, max: number, f: (s: S, in_: In) => S): Sink<unknown, Err, In, Err, In, S>;
/**
 * Creates a sink that folds elements of type `In` into a structure
 * of type `S`, until `max` worth of elements (determined by the `costFn`)
 * have been folded.
 *
 * The `decompose` function will be used for decomposing elements that
 * cause an `S` aggregate to cross `max` into smaller elements.
 * Be vigilant with this function, it has to generate "simpler" values
 * or the fold may never end. A value is considered indivisible if
 * `decompose` yields the empty chunk or a single-valued chunk. In
 * these cases, there is no other choice than to yield a value that
 * will cross the threshold.
 *
 * The `foldWeightedDecomposeM` allows the decompose function
 * to return an `Effect` value, and consequently it allows the sink
 * to fail.
 */
export declare function foldWeightedDecompose<Err, In, S>(z: S, costFn: (s: S, in_: In) => number, max: number, decompose: (in_: In) => A.Chunk<In>, f: (s: S, in_: In) => S): Sink<unknown, Err, In, Err, In, S>;
/**
 * Creates a sink that effectfully folds elements of type `In` into a structure
 * of type `S`, until `max` worth of elements (determined by the `costFn`) have
 * been folded.
 *
 * The `decompose` function will be used for decomposing elements that
 * cause an `S` aggregate to cross `max` into smaller elements. Be vigilant with
 * this function, it has to generate "simpler" values or the fold may never end.
 * A value is considered indivisible if `decompose` yields the empty chunk or a
 * single-valued chunk. In these cases, there is no other choice than to yield
 * a value that will cross the threshold.
 *
 * See `foldWeightedDecompose` for an example.
 */
export declare function foldWeightedDecomposeEffect<Env, Env1, Env2, Err, Err1, Err2, In, S>(z: S, costFn: (s: S, in_: In) => T.Effect<Env, Err, number>, max: number, decompose: (in_: In) => T.Effect<Env1, Err1, A.Chunk<In>>, f: (s: S, in_: In) => T.Effect<Env2, Err2, S>): Sink<Env & Env1 & Env2, Err, In, Err | Err1 | Err2, In, S>;
/**
 * Creates a sink that effectfully folds elements of type `In` into a structure
 * of type `S`, until `max` worth of elements (determined by the `costFn`) have
 * been folded.
 *
 * @note Elements that have an individual cost larger than `max` will
 * force the sink to cross the `max` cost. See `foldWeightedDecomposeM`
 * for a variant that can handle these cases.
 */
export declare function foldWeightedEffect<Env, Err, In, S>(z: S, costFn: (s: S, in_: In) => T.Effect<Env, Err, number>, max: number, f: (s: S, in_: In) => T.Effect<Env, Err, S>): Sink<Env, Err, In, Err, In, S>;
/**
 * A sink that effectfully folds its inputs with the provided function, termination predicate and initial state.
 */
export declare function foldEffect<Env, Err, In, S>(z: S, contFn: (s: S) => boolean, f: (s: S, in_: In) => T.Effect<Env, Err, S>): Sink<Env, Err, In, Err, In, S>;
/**
 * A sink that executes the provided effectful function for every element fed to it.
 */
export declare function forEach<R, ErrIn, ErrOut, In, B>(f: (_in: In) => T.Effect<R, ErrOut, B>): Sink<R, ErrIn, In, ErrIn | ErrOut, In, void>;
/**
 * A sink that executes the provided effectful function for every chunk fed to it.
 */
export declare function forEachChunk<R, ErrIn, ErrOut, In, Z>(f: (c: A.Chunk<In>) => T.Effect<R, ErrOut, Z>): Sink<R, ErrIn, In, ErrIn | ErrOut, unknown, void>;
/**
 * A sink that executes the provided effectful function for every element fed to it
 * until `f` evaluates to `false`.
 */
export declare function forEachWhile<R, ErrIn, ErrOut, In>(f: (_in: In) => T.Effect<R, ErrOut, boolean>): Sink<R, ErrIn, In, ErrIn | ErrOut, In, void>;
/**
 * A sink that executes the provided effectful function for every chunk fed to it
 * until `f` evaluates to `false`.
 */
export declare function forEachChunkWhile<R, ErrIn, ErrOut, In>(f: (_in: A.Chunk<In>) => T.Effect<R, ErrOut, boolean>): Sink<R, ErrIn, In, ErrIn | ErrOut, unknown, void>;
/**
 * Creates a single-value sink produced from an effect
 */
export declare function fromEffect<R, E, Z>(b: T.Effect<R, E, Z>): Sink<R, unknown, unknown, E, unknown, Z>;
/**
 * Creates a sink containing the first value.
 */
export declare function head<Err, In>(): Sink<unknown, Err, In, Err, In, O.Option<In>>;
/**
 * Creates a sink containing the last value.
 */
export declare function last<Err, In>(): Sink<unknown, Err, In, Err, unknown, O.Option<In>>;
export declare function leftover<L>(c: A.Chunk<L>): Sink<unknown, unknown, unknown, never, L, void>;
export declare function mkString<Err>(): Sink<unknown, Err, unknown, Err, unknown, string>;
export declare function managed_<R, InErr, In, OutErr, A, L, Z>(resource: M.Managed<R, OutErr, A>, fn: (a: A) => Sink<R, InErr, In, OutErr, L, Z>): Sink<R, InErr, In, OutErr, L, Z>;
/**
 *
 * @ets_data_first managed_
 */
export declare function managed<R, InErr, In, OutErr, A, L, Z>(fn: (a: A) => Sink<R, InErr, In, OutErr, L, Z>): (resource: M.Managed<R, OutErr, A>) => Sink<R, InErr, In, OutErr, L, Z>;
/**
 * A sink that immediately ends with the specified value.
 */
export declare function succeed<Z>(z: Z): Sink<unknown, unknown, unknown, never, unknown, Z>;
/**
 * A sink that sums incoming numeric values.
 */
export declare function sum<Err>(): Sink<unknown, Err, number, Err, unknown, number>;
export declare function take<Err, In>(n: number): Sink<unknown, Err, In, Err, In, A.Chunk<In>>;
/**
 * A sink that folds its inputs with the provided function, termination predicate and initial state.
 */
export declare function reduce<S, In, Err>(z: S, cont: Predicate<S>, f: (s: S, _in: In) => S): Sink<unknown, Err, In, Err, In, S>;
/**
 * A sink that effectfully folds its inputs with the provided function, termination predicate and initial state.
 */
export declare function reduceEffect<S, Env, In, InErr, OutErr>(z: S, cont: Predicate<S>, f: (s: S, _in: In) => T.Effect<Env, OutErr, S>): Sink<Env, InErr, In, InErr | OutErr, In, S>;
//# sourceMappingURL=index.d.ts.map