import * as tsplus_module_1 from "@effect/core/io/Hub/operations/strategy";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/succeed";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/flatMap";
import { makeBounded } from "@effect/core/io/Hub/operations/_internal/makeBounded";
import { makeHub } from "@effect/core/io/Hub/operations/_internal/makeHub";
/**
 * Creates a bounded hub with the sliding strategy. The hub will add new
 * messages and drop old messages if the hub is at capacity.
 *
 * For best performance use capacities that are powers of two.
 *
 * @tsplus static ets/Hub/Ops sliding
 */

export function sliding(requestedCapacity, __tsplusTrace) {
  return tsplus_module_3.flatMap_(tsplus_module_2.succeed(() => makeBounded(requestedCapacity), __tsplusTrace), atomicHub => makeHub(atomicHub, tsplus_module_1.slidingStrategy()), __tsplusTrace);
}
//# sourceMappingURL=sliding.mjs.map