import * as tsplus_module_1 from "@effect/core/stream/Channel/operations/pipeTo";
import * as tsplus_module_2 from "@effect/core/stream/Channel/operations/write";
import * as tsplus_module_3 from "@effect/core/stream/Channel/operations/fromEffect";
import * as tsplus_module_4 from "@effect/core/stream/Channel/operations/flatMap";
import * as tsplus_module_5 from "@effect/core/stream/Channel/operations/zipRight";
import * as tsplus_module_6 from "@effect/core/stream/Channel/operations/fail";
import * as tsplus_module_7 from "@effect/core/stream/Channel/operations/succeedNow";
import * as tsplus_module_8 from "@effect/core/stream/Channel/operations/readWith";
/**
 * @tsplus fluent ets/Channel mapOutEffect
 */

export function mapOutEffect_(self, f) {
  return tsplus_module_1.pipeTo_(self, () => mapOutEffectReader(f));
}
export const mapOutEffect = f => self => mapOutEffect_(self, f);

function mapOutEffectReader(f) {
  return tsplus_module_8.readWith(outElem => tsplus_module_5.zipRight_(tsplus_module_4.flatMap_(tsplus_module_3.fromEffect(() => f(outElem)), out => tsplus_module_2.write(() => out)), () => mapOutEffectReader(f)), outErr => tsplus_module_6.fail(() => outErr), outDone => tsplus_module_7.succeedNow(outDone));
}
//# sourceMappingURL=mapOutEffect.mjs.map