import * as tsplus_module_1 from "@effect/core/io/Fiber/operations/id";
import * as tsplus_module_2 from "@effect/core/io/Exit/operations/forEach";
import * as tsplus_module_3 from "@effect/core/io/Fiber/operations/await";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_5 from "@effect/core/io/Fiber/operations/children";
import * as tsplus_module_6 from "@effect/core/io/Fiber/operations/inheritRefs";
import * as tsplus_module_7 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_8 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_9 from "@effect/core/io/Effect/operations/map";
import * as tsplus_module_10 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_11 from "@effect/core/io/Fiber/operations/poll";
import * as tsplus_module_12 from "@effect/core/io/Fiber/operations/interruptAs";
import { makeSynthetic } from "@effect/core/io/Fiber/definition";
/**
 * Effectually maps over the value the fiber computes.
 *
 * @tsplus fluent ets/Fiber mapEffect
 * @tsplus fluent ets/RuntimeFiber mapEffect
 */

export function mapEffect_(self, f, __tsplusTrace) {
  return makeSynthetic({
    id: tsplus_module_1.id(self),
    await: tsplus_module_4.flatMap_(tsplus_module_3._await(self, __tsplusTrace), _ => tsplus_module_2.forEach_(_, f, __tsplusTrace), __tsplusTrace),
    children: tsplus_module_5.children(self, __tsplusTrace),
    inheritRefs: tsplus_module_6.inheritRefs(self, __tsplusTrace),
    poll: tsplus_module_4.flatMap_(tsplus_module_11.poll(self, __tsplusTrace), _ => tsplus_module_10.fold_(_, () => tsplus_module_8.succeedNow(tsplus_module_7.none, __tsplusTrace), exit => tsplus_module_9.map_(tsplus_module_2.forEach_(exit, f, __tsplusTrace), tsplus_module_7.some, __tsplusTrace)), __tsplusTrace),
    interruptAs: id => tsplus_module_4.flatMap_(tsplus_module_12.interruptAsNow_(self, id, __tsplusTrace), exit => tsplus_module_2.forEach_(exit, f, __tsplusTrace), __tsplusTrace)
  });
}
/**
 * Effectually maps over the value the fiber computes.
 *
 * @tsplus static ets/Fiber/Aspects mapEffect
 */

export const mapEffect = (f, __tsplusTrace) => self => mapEffect_(self, f, __tsplusTrace);
//# sourceMappingURL=mapEffect.mjs.map