import * as tsplus_module_1 from "@effect/core/io/Fiber/operations/id";
import * as tsplus_module_2 from "@tsplus/stdlib/structure/Equals";
import * as tsplus_module_3 from "@tsplus/stdlib/collections/Chunk/filter";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/descriptor";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/map";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_7 from "@effect/core/io/Effect/operations/supervised";
import * as tsplus_module_8 from "@effect/core/io/Supervisor/operations/track";
/**
 * Locally installs a supervisor and an effect that succeeds with all the
 * children that have been forked in the returned effect.
 *
 * @tsplus static ets/Effect/Ops withChildren
 */

export function withChildren(get, __tsplusTrace) {
  return tsplus_module_6.flatMap_(tsplus_module_8.track(__tsplusTrace), supervisor => tsplus_module_7.supervised_(get(tsplus_module_6.flatMap_(supervisor.value, children => tsplus_module_5.map_(tsplus_module_4.descriptor, descriptor => // Filter out the fiber id of whoever is calling `withChildren`
  tsplus_module_3.filter_(children, fiber => !tsplus_module_2.equals(tsplus_module_1.id(fiber), descriptor.id)), __tsplusTrace), __tsplusTrace)), () => supervisor, __tsplusTrace), __tsplusTrace);
}
//# sourceMappingURL=withChildren.mjs.map