import * as tsplus_module_1 from "@tsplus/stdlib/collections/Chunk/single";
import * as tsplus_module_2 from "@effect/core/stream/Channel/operations/writeChunk";
import * as tsplus_module_3 from "@effect/core/stream/Channel/operations/concatMap";
import * as tsplus_module_4 from "@effect/core/stream/Channel/operations/mapOutEffectPar";
import * as tsplus_module_5 from "@effect/core/stream/Channel/operations/mapOut";
import { concreteStream, StreamInternal } from "@effect/core/stream/Stream/operations/_internal/StreamInternal";
/**
 * Maps over elements of the stream with the specified effectful function,
 * executing up to `n` invocations of `f` concurrently. Transformed elements
 * will be emitted in the original order.
 *
 * @note This combinator destroys the chunking structure. It's recommended to use
 * rechunk afterwards.
 *
 * @tsplus fluent ets/Stream mapEffectPar
 */

export function mapEffectPar_(self, n, f, __tsplusTrace) {
  void 0;
  return new StreamInternal(tsplus_module_5.mapOut_(tsplus_module_4.mapOutEffectPar_(tsplus_module_3.concatMap_(self.channel, tsplus_module_2.writeChunk), n, f), tsplus_module_1.single));
}
/**
 * Maps over elements of the stream with the specified effectful function,
 * executing up to `n` invocations of `f` concurrently. Transformed elements
 * will be emitted in the original order.
 *
 * @note This combinator destroys the chunking structure. It's recommended to use
 * rechunk afterwards.
 *
 * @tsplus static ets/Stream/Aspects mapEffectPar
 */

export const mapEffectPar = (n, f, __tsplusTrace) => self => mapEffectPar_(self, n, f, __tsplusTrace);
//# sourceMappingURL=mapEffectPar.mjs.map