import * as tsplus_module_1 from "@effect/core/stream/Sink/operations/collectAllN";
import * as tsplus_module_2 from "@effect/core/io/Schedule/operations/spaced";
import * as tsplus_module_3 from "@effect/core/stream/Stream/operations/aggregateWithin";
/**
 * Partitions the stream with the specified chunkSize or until the specified
 * duration has passed, whichever is satisfied first.
 *
 * @tsplus fluent ets/Stream groupedWithin
 */

export function groupedWithin_(self, chunkSize, within, __tsplusTrace) {
  return tsplus_module_3.aggregateWithin_(self, () => tsplus_module_1.collectAllN(chunkSize, __tsplusTrace), () => tsplus_module_2.spaced(() => within()), __tsplusTrace);
}
/**
 * Partitions the stream with the specified chunkSize or until the specified
 * duration has passed, whichever is satisfied first.
 *
 * @tsplus static ets/Stream/Aspects groupedWithin
 */

export const groupedWithin = (chunkSize, within, __tsplusTrace) => self => groupedWithin_(self, chunkSize, within, __tsplusTrace);
//# sourceMappingURL=groupedWithin.mjs.map