import * as tsplus_module_1 from "@tsplus/stdlib/data/Either/definition";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/done";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/map";
import * as tsplus_module_4 from "@effect/core/stream/Channel/MergeDecision";
import * as tsplus_module_5 from "@effect/core/stream/Sink/operations/raceWith";
/**
 * Runs both sinks in parallel on the input, returning the result or the error
 * from the one that finishes first.
 *
 * @tsplus fluent ets/Sink raceBoth
 */

export function raceBoth_(self, that, capacity = 16, __tsplusTrace) {
  return tsplus_module_5.raceWith_(self, that, selfDone => tsplus_module_4.done(tsplus_module_3.map_(tsplus_module_2.done(() => selfDone, __tsplusTrace), tsplus_module_1.left, __tsplusTrace)), thatDone => tsplus_module_4.done(tsplus_module_3.map_(tsplus_module_2.done(() => thatDone, __tsplusTrace), tsplus_module_1.right, __tsplusTrace)), capacity, __tsplusTrace);
}
/**
 * Runs both sinks in parallel on the input, returning the result or the error
 * from the one that finishes first.
 *
 * @tsplus static ets/Sink/Aspects raceBoth
 */

export const raceBoth = (that, capacity = 16, __tsplusTrace) => self => raceBoth_(self, that, capacity, __tsplusTrace);
//# sourceMappingURL=raceBoth.mjs.map