import * as tsplus_module_1 from "@tsplus/stdlib/collections/Chunk/single";
import * as tsplus_module_2 from "@effect/core/stream/Sink/operations/foldWeightedDecompose";
/**
 * 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.
 *
 * @tsplus static ets/Sink/Ops foldWeighted
 */

export function foldWeighted(z, costFn, max, f, __tsplusTrace) {
  return tsplus_module_2.foldWeightedDecompose(z, costFn, max, tsplus_module_1.single, f, __tsplusTrace);
}
//# sourceMappingURL=foldWeighted.mjs.map