import * as tsplus_module_1 from "@effect/core/stream/Stream/operations/fromChunkQueue";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/map";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/succeed";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/flatMap";
/**
 * Creates a stream from a subscription to a hub in the context of a scoped
 * effect. The scoped effect describes subscribing to receive messages from
 * the hub while the stream describes taking messages from the hub.
 *
 * @tsplus static ets/Stream/Ops fromChunkHubScoped
 */

export function fromChunkHubScoped(hub, __tsplusTrace) {
  return tsplus_module_4.flatMap_(tsplus_module_3.succeed(hub, __tsplusTrace), hub => tsplus_module_2.map_(hub.subscribe, queue => tsplus_module_1.fromChunkQueue(() => queue, __tsplusTrace), __tsplusTrace), __tsplusTrace);
}
//# sourceMappingURL=fromChunkHubScoped.mjs.map