import * as tsplus_module_1 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/supervised";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/ensuring";
import * as tsplus_module_4 from "@effect/core/io/Supervisor/operations/track";
/**
 * Acts on the children of this fiber, guaranteeing the specified callback
 * will be invoked, whether or not this effect succeeds.
 *
 * @tsplus fluent ets/Effect ensuringChildren
 */

export function ensuringChildren_(self, children, __tsplusTrace) {
  return tsplus_module_1.flatMap_(tsplus_module_4.track(__tsplusTrace), supervisor => tsplus_module_3.ensuring_(tsplus_module_2.supervised_(self, () => supervisor, __tsplusTrace), () => tsplus_module_1.flatMap_(supervisor.value, children, __tsplusTrace), __tsplusTrace), __tsplusTrace);
}
/**
 * Acts on the children of this fiber, guaranteeing the specified callback
 * will be invoked, whether or not this effect succeeds.
 *
 * @tsplus static ets/Effect/Aspects ensuringChildren
 */

export const ensuringChildren = (children, __tsplusTrace) => self => ensuringChildren_(self, children, __tsplusTrace);
//# sourceMappingURL=ensuringChildren.mjs.map