import * as tsplus_module_1 from "@effect/core/stream/Channel/operations/pipeToOrFail";
import * as tsplus_module_2 from "@effect/core/stream/Channel/operations/drain";
import * as tsplus_module_3 from "@effect/core/stream/Channel/operations/runScoped";
import { concreteSink } from "@effect/core/stream/Sink/operations/_internal/SinkInternal";
import { concreteStream } from "@effect/core/stream/Stream/operations/_internal/StreamInternal";
/**
 * @tsplus fluent ets/Stream runScoped
 */

export function runScoped_(self, sink, __tsplusTrace) {
  void 0;
  return tsplus_module_3.runScoped(tsplus_module_2.drain(tsplus_module_1.pipeToOrFail_(self.channel, () => {
    const sink0 = sink();
    void 0;
    return sink0.channel;
  })));
}
/**
 * @tsplus static ets/Stream/Aspects runScoped
 */

export const runScoped = (sink, __tsplusTrace) => self => runScoped_(self, sink, __tsplusTrace);
//# sourceMappingURL=runScoped.mjs.map