import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_2 from "@effect/core/stream/Channel/UpstreamPullStrategy";
import * as tsplus_module_3 from "@effect/core/stream/Channel/ChildExecutorDecision";
import { ConcatAll } from "@effect/core/stream/Channel/definition/primitives";
/**
 * Returns a new channel whose outputs are fed to the specified factory
 * function, which creates new channels in response. These new channels are
 * sequentially concatenated together, and all their outputs appear as outputs
 * of the newly returned channel. The provided merging function is used to
 * merge the terminal values of all channels into the single terminal value of
 * the returned channel.
 *
 * @tsplus fluent ets/Channel concatMapWith
 */

export function concatMapWith_(self, f, g, h) {
  return new ConcatAll(g, h, () => tsplus_module_2.pullAfterNext(tsplus_module_1.none), () => tsplus_module_3._continue, () => self, f);
}
/**
 * Returns a new channel whose outputs are fed to the specified factory
 * function, which creates new channels in response. These new channels are
 * sequentially concatenated together, and all their outputs appear as outputs
 * of the newly returned channel. The provided merging function is used to
 * merge the terminal values of all channels into the single terminal value of
 * the returned channel.
 *
 * @tsplus static ets/Channel/Aspects concatMapWith
 */

export const concatMapWith = (f, g, h) => self => concatMapWith_(self, f, g, h);
//# sourceMappingURL=concatMapWith.mjs.map