import * as T from "../../../../Effect";
import * as Q from "../../../../Queue";
import * as C from "../core";
import * as BufferSignal from "./_internal/bufferSignal";
/**
 * Allows a faster producer to progress independently of a slower consumer by buffering
 * up to `capacity` chunks in a sliding queue.
 */

export function bufferChunksSliding_(self, capacity) {
  const queue = T.toManagedRelease_(Q.makeSliding(capacity), Q.shutdown);
  return new C.Stream(BufferSignal.bufferSignal(queue, self.channel));
}
/**
 * Allows a faster producer to progress independently of a slower consumer by buffering
 * up to `capacity` chunks in a sliding queue.
 *
 * @ets_data_first bufferChunksSliding_
 */

export function bufferChunksSliding(capacity) {
  return self => bufferChunksSliding_(self, capacity);
}
//# sourceMappingURL=bufferChunksSliding.js.map