@lmvz-ds/components 0.12.5-alpha.1 → 0.12.5-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/manifest.json +1 -1
  2. package/package.json +4 -4
  3. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  4. package/dist/cjs/assets-Cswkqk_c.js +0 -18971
  5. package/dist/cjs/assets-Cswkqk_c.js.map +0 -1
  6. package/dist/cjs/axe-C2rxi-K2.js +0 -32837
  7. package/dist/cjs/axe-C2rxi-K2.js.map +0 -1
  8. package/dist/cjs/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-BTL_B6qg.js +0 -3665
  9. package/dist/cjs/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-BTL_B6qg.js.map +0 -1
  10. package/dist/cjs/header-integration_6.cjs.entry.js +0 -18
  11. package/dist/cjs/header-integration_6.cjs.entry.js.map +0 -1
  12. package/dist/cjs/icons-jn_Uak9B.js +0 -1063
  13. package/dist/cjs/icons-jn_Uak9B.js.map +0 -1
  14. package/dist/cjs/index-DpBPf1cE.js +0 -2112
  15. package/dist/cjs/index-DpBPf1cE.js.map +0 -1
  16. package/dist/cjs/index.cjs.js.map +0 -1
  17. package/dist/cjs/lmvz-action.cjs.entry.js.map +0 -1
  18. package/dist/cjs/lmvz-card.cjs.entry.js.map +0 -1
  19. package/dist/cjs/lmvz-chip.cjs.entry.js.map +0 -1
  20. package/dist/cjs/lmvz-components.cjs.js.map +0 -1
  21. package/dist/cjs/loader.cjs.js.map +0 -1
  22. package/dist/collection/api/ds.constants.js.map +0 -1
  23. package/dist/collection/api/index.js.map +0 -1
  24. package/dist/collection/components/lmvz-action/lmvz-action.js.map +0 -1
  25. package/dist/collection/components/lmvz-button/lmvz-button.js.map +0 -1
  26. package/dist/collection/components/lmvz-card/lmvz-card.js.map +0 -1
  27. package/dist/collection/components/lmvz-chip/lmvz-chip.js.map +0 -1
  28. package/dist/collection/components/lmvz-header/lmvz-header.js.map +0 -1
  29. package/dist/collection/components/lmvz-icon/icons.js.map +0 -1
  30. package/dist/collection/components/lmvz-icon/lmvz-icon.js.map +0 -1
  31. package/dist/collection/components/lmvz-icon/public.js.map +0 -1
  32. package/dist/collection/components/lmvz-icon/test/icons.unit.js.map +0 -1
  33. package/dist/collection/components/lmvz-input/lmvz-input.js.map +0 -1
  34. package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js.map +0 -1
  35. package/dist/collection/index.js.map +0 -1
  36. package/dist/collection/integration/header-integration.js.map +0 -1
  37. package/dist/collection/utils/assets.js.map +0 -1
  38. package/dist/collection/utils/component.js.map +0 -1
  39. package/dist/collection/utils/effect.js.map +0 -1
  40. package/dist/collection/utils/element-activation-controller.js.map +0 -1
  41. package/dist/collection/utils/environment.js.map +0 -1
  42. package/dist/collection/utils/http.js.map +0 -1
  43. package/dist/collection/utils/http.test.js.map +0 -1
  44. package/dist/collection/utils/list-keyboard-controller.js.map +0 -1
  45. package/dist/collection/utils/public.js.map +0 -1
  46. package/dist/collection/utils/reactive-controller-host.js.map +0 -1
  47. package/dist/collection/utils/typing.js.map +0 -1
  48. package/dist/collection/utils/validation/aria-validation-controller.js.map +0 -1
  49. package/dist/collection/utils/validation/svg.js.map +0 -1
  50. package/dist/components/header-integration.d.ts +0 -11
  51. package/dist/components/header-integration.js +0 -2
  52. package/dist/components/header-integration.js.map +0 -1
  53. package/dist/components/index.js.map +0 -1
  54. package/dist/components/lmvz-action.js.map +0 -1
  55. package/dist/components/lmvz-button.js.map +0 -1
  56. package/dist/components/lmvz-card.js.map +0 -1
  57. package/dist/components/lmvz-chip.js.map +0 -1
  58. package/dist/components/lmvz-header.js.map +0 -1
  59. package/dist/components/lmvz-icon.js.map +0 -1
  60. package/dist/components/lmvz-input.js.map +0 -1
  61. package/dist/components/lmvz-menuitem.js.map +0 -1
  62. package/dist/components/p-B3JVFwO1.js.map +0 -1
  63. package/dist/components/p-B85MJLTf.js.map +0 -1
  64. package/dist/components/p-CN0JX9-m.js.map +0 -1
  65. package/dist/components/p-Cd4nH2vx.js +0 -2
  66. package/dist/components/p-Cd4nH2vx.js.map +0 -1
  67. package/dist/components/p-CdofjRtQ.js.map +0 -1
  68. package/dist/components/p-CkTUjPwD.js +0 -2
  69. package/dist/components/p-CkTUjPwD.js.map +0 -1
  70. package/dist/components/p-CpI4KFOu.js +0 -2
  71. package/dist/components/p-CpI4KFOu.js.map +0 -1
  72. package/dist/components/p-D1HbKFuh.js.map +0 -1
  73. package/dist/components/p-D7xthqTT.js +0 -2
  74. package/dist/components/p-D7xthqTT.js.map +0 -1
  75. package/dist/components/p-DBeynNeU.js +0 -2
  76. package/dist/components/p-DBeynNeU.js.map +0 -1
  77. package/dist/components/p-DMLRPGid.js.map +0 -1
  78. package/dist/components/p-UiqQVZhU.js +0 -2
  79. package/dist/components/p-UiqQVZhU.js.map +0 -1
  80. package/dist/components/p-Xq267cFM.js +0 -2
  81. package/dist/components/p-Xq267cFM.js.map +0 -1
  82. package/dist/components/p-glDDybgu.js +0 -2
  83. package/dist/components/p-glDDybgu.js.map +0 -1
  84. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  85. package/dist/esm/assets-K2FHD9qn.js +0 -18770
  86. package/dist/esm/assets-K2FHD9qn.js.map +0 -1
  87. package/dist/esm/axe-CZ0Rtkog.js +0 -32835
  88. package/dist/esm/axe-CZ0Rtkog.js.map +0 -1
  89. package/dist/esm/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-CW3FGLZC.js +0 -3657
  90. package/dist/esm/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-CW3FGLZC.js.map +0 -1
  91. package/dist/esm/header-integration_6.entry.js +0 -7
  92. package/dist/esm/header-integration_6.entry.js.map +0 -1
  93. package/dist/esm/icons-BITzEzmq.js +0 -1032
  94. package/dist/esm/icons-BITzEzmq.js.map +0 -1
  95. package/dist/esm/index-D2eyw7iv.js +0 -2101
  96. package/dist/esm/index-D2eyw7iv.js.map +0 -1
  97. package/dist/esm/index.js.map +0 -1
  98. package/dist/esm/lmvz-action.entry.js.map +0 -1
  99. package/dist/esm/lmvz-card.entry.js.map +0 -1
  100. package/dist/esm/lmvz-chip.entry.js.map +0 -1
  101. package/dist/esm/lmvz-components.js.map +0 -1
  102. package/dist/esm/loader.js.map +0 -1
  103. package/dist/lmvz-components/index.esm.js.map +0 -1
  104. package/dist/lmvz-components/lmvz-components.esm.js.map +0 -1
  105. package/dist/lmvz-components/p-366a01f8.entry.js +0 -2
  106. package/dist/lmvz-components/p-366a01f8.entry.js.map +0 -1
  107. package/dist/lmvz-components/p-84ee7919.entry.js +0 -2
  108. package/dist/lmvz-components/p-84ee7919.entry.js.map +0 -1
  109. package/dist/lmvz-components/p-BLwPC3DQ.js +0 -2
  110. package/dist/lmvz-components/p-BLwPC3DQ.js.map +0 -1
  111. package/dist/lmvz-components/p-D2eyw7iv.js +0 -3
  112. package/dist/lmvz-components/p-D2eyw7iv.js.map +0 -1
  113. package/dist/lmvz-components/p-DANVVVBd.js +0 -7
  114. package/dist/lmvz-components/p-DANVVVBd.js.map +0 -1
  115. package/dist/lmvz-components/p-DQuL1Twl.js.map +0 -1
  116. package/dist/lmvz-components/p-DlDurXvX.js +0 -2
  117. package/dist/lmvz-components/p-DlDurXvX.js.map +0 -1
  118. package/dist/lmvz-components/p-Hc4uxoTU.js +0 -13
  119. package/dist/lmvz-components/p-Hc4uxoTU.js.map +0 -1
  120. package/dist/lmvz-components/p-a4200b26.entry.js +0 -2
  121. package/dist/lmvz-components/p-a4200b26.entry.js.map +0 -1
  122. package/dist/lmvz-components/p-d3243bae.entry.js +0 -2
  123. package/dist/lmvz-components/p-d3243bae.entry.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-CW3FGLZC.js","sources":["../../node_modules/effect/dist/esm/Ref.js","../../node_modules/effect/dist/esm/Cause.js","../../node_modules/effect/dist/esm/Fiber.js","../../node_modules/effect/dist/esm/internal/queue.js","../../node_modules/effect/dist/esm/Queue.js","../../node_modules/effect/dist/esm/internal/opCodes/channelChildExecutorDecision.js","../../node_modules/effect/dist/esm/internal/channel/childExecutorDecision.js","../../node_modules/effect/dist/esm/internal/opCodes/continuation.js","../../node_modules/effect/dist/esm/internal/channel/continuation.js","../../node_modules/effect/dist/esm/internal/opCodes/channelUpstreamPullStrategy.js","../../node_modules/effect/dist/esm/internal/channel/upstreamPullStrategy.js","../../node_modules/effect/dist/esm/internal/opCodes/channel.js","../../node_modules/effect/dist/esm/internal/core-stream.js","../../node_modules/effect/dist/esm/internal/opCodes/channelState.js","../../node_modules/effect/dist/esm/internal/channel/channelState.js","../../node_modules/effect/dist/esm/internal/channel/subexecutor.js","../../node_modules/effect/dist/esm/internal/opCodes/channelUpstreamPullRequest.js","../../node_modules/effect/dist/esm/internal/channel/upstreamPullRequest.js","../../node_modules/effect/dist/esm/internal/channel/channelExecutor.js","../../node_modules/effect/dist/esm/internal/opCodes/channelMergeDecision.js","../../node_modules/effect/dist/esm/internal/channel/mergeDecision.js","../../node_modules/effect/dist/esm/internal/opCodes/channelMergeState.js","../../node_modules/effect/dist/esm/internal/channel/mergeState.js","../../node_modules/effect/dist/esm/internal/opCodes/channelMergeStrategy.js","../../node_modules/effect/dist/esm/internal/channel/mergeStrategy.js","../../node_modules/effect/dist/esm/internal/channel/singleProducerAsyncInput.js","../../node_modules/effect/dist/esm/internal/channel.js","../../node_modules/effect/dist/esm/internal/sink.js","../../node_modules/effect/dist/esm/internal/take.js","../../node_modules/effect/dist/esm/internal/stream/pull.js","../../node_modules/effect/dist/esm/internal/stream.js","../../node_modules/effect/dist/esm/internal/groupBy.js","../../node_modules/effect/dist/esm/Stream.js","src/integration/header-integration.tsx","../../node_modules/classnames/index.js","src/utils/component.ts","src/utils/element-activation-controller.ts","src/utils/reactive-controller-host.ts","src/utils/validation/aria-validation-controller.ts","src/components/lmvz-button/lmvz-button.css?tag=lmvz-button&encapsulation=shadow","src/components/lmvz-button/lmvz-button.tsx","src/utils/list-keyboard-controller.ts","src/components/lmvz-header/lmvz-header.css?tag=lmvz-header&encapsulation=shadow","src/components/lmvz-header/lmvz-header.tsx","src/components/lmvz-icon/lmvz-icon.css?tag=lmvz-icon&encapsulation=scoped","src/components/lmvz-icon/lmvz-icon.tsx","src/components/lmvz-input/lmvz-input.css?tag=lmvz-input&encapsulation=scoped","src/components/lmvz-input/lmvz-input.tsx","src/components/lmvz-menuitem/lmvz-menuitem.css?tag=lmvz-menuitem&encapsulation=scoped","src/components/lmvz-menuitem/lmvz-menuitem.tsx"],"sourcesContent":["import * as internal from \"./internal/ref.js\";\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const RefTypeId = internal.RefTypeId;\n/**\n * @since 2.0.0\n * @category constructors\n */\nexport const make = internal.make;\n/**\n * @since 2.0.0\n * @category getters\n */\nexport const get = internal.get;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const getAndSet = internal.getAndSet;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const getAndUpdate = internal.getAndUpdate;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const getAndUpdateSome = internal.getAndUpdateSome;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const modify = internal.modify;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const modifySome = internal.modifySome;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const set = internal.set;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const setAndGet = internal.setAndGet;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const update = internal.update;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const updateAndGet = internal.updateAndGet;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const updateSome = internal.updateSome;\n/**\n * @since 2.0.0\n * @category utils\n */\nexport const updateSomeAndGet = internal.updateSomeAndGet;\n/**\n * @since 2.0.0\n * @category unsafe\n */\nexport const unsafeMake = internal.unsafeMake;\n//# sourceMappingURL=Ref.js.map","import * as internal from \"./internal/cause.js\";\nimport * as core from \"./internal/core.js\";\n/**\n * A unique symbol identifying the `Cause` type.\n *\n * **Details**\n *\n * This provides a symbol that helps identify instances of the `Cause` data\n * type. This can be used for advanced operations such as refining types or\n * building internal utilities that check whether an unknown value is a `Cause`.\n *\n * @see {@link isCause} Check if a value is a `Cause`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const CauseTypeId = internal.CauseTypeId;\n/**\n * A unique symbol identifying the `RuntimeException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies a `RuntimeException`. This is\n * typically used internally by the library to recognize checked exceptions that\n * occur during runtime.\n *\n * @see {@link RuntimeException} Create or work with a `RuntimeException`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const RuntimeExceptionTypeId = core.RuntimeExceptionTypeId;\n/**\n * A unique symbol identifying the `InterruptedException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies an `InterruptedException`. This is\n * typically used internally to recognize when a fiber has been interrupted,\n * helping the framework handle interruption logic correctly.\n *\n * @see {@link InterruptedException} Create or work with an `InterruptedException`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const InterruptedExceptionTypeId = core.InterruptedExceptionTypeId;\n/**\n * A unique symbol identifying the `IllegalArgumentException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies an `IllegalArgumentException`. This is\n * often used in scenarios where invalid arguments are supplied to methods that\n * expect specific input.\n *\n * @see {@link IllegalArgumentException} Create or work with an `IllegalArgumentException`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const IllegalArgumentExceptionTypeId = core.IllegalArgumentExceptionTypeId;\n/**\n * A unique symbol identifying the `NoSuchElementException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies a `NoSuchElementException`. It helps\n * differentiate cases where a required element is missing within a data\n * structure.\n *\n * @see {@link NoSuchElementException} Create or work with a `NoSuchElementException`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const NoSuchElementExceptionTypeId = core.NoSuchElementExceptionTypeId;\n/**\n * A unique symbol identifying the `InvalidPubSubCapacityException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies an `InvalidPubSubCapacityException`.\n * It indicates an error related to an invalid capacity passed to a `PubSub`\n * structure.\n *\n * @see {@link InvalidPubSubCapacityException} Create or work with an `InvalidPubSubCapacityException`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const InvalidPubSubCapacityExceptionTypeId = core.InvalidPubSubCapacityExceptionTypeId;\n/**\n * A unique symbol identifying the `ExceededCapacityException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies an `ExceededCapacityException`. It\n * denotes situations where a resource has exceeded its configured capacity\n * limit.\n *\n * @see {@link ExceededCapacityException} Create or work with an `ExceededCapacityException`\n *\n * @since 3.5.0\n * @category Symbols\n */\nexport const ExceededCapacityExceptionTypeId = core.ExceededCapacityExceptionTypeId;\n/**\n * A unique symbol identifying the `TimeoutException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies a `TimeoutException`. It helps the\n * framework recognize errors related to operations that fail to complete within\n * a given timeframe.\n *\n * @see {@link TimeoutException} Create or work with a `TimeoutException`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const TimeoutExceptionTypeId = core.TimeoutExceptionTypeId;\n/**\n * A unique symbol identifying the `UnknownException` type.\n *\n * **Details**\n *\n * This provides a symbol that identifies an `UnknownException`. It is typically\n * used for generic or unexpected errors that do not fit other specific\n * exception categories.\n *\n * @see {@link UnknownException} Create or work with an `UnknownException`\n *\n * @since 2.0.0\n * @category Symbols\n */\nexport const UnknownExceptionTypeId = core.UnknownExceptionTypeId;\n/**\n * Creates an error that occurs at runtime, extendable for other exception\n * types.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const YieldableError = core.YieldableError;\n/**\n * Creates an `Empty` cause.\n *\n * **Details**\n *\n * This function returns a cause that signifies \"no error.\" It's commonly used\n * to represent an absence of failure conditions.\n *\n * @see {@link isEmpty} Check if a `Cause` is empty\n *\n * @since 2.0.0\n * @category Constructors\n */\nexport const empty = internal.empty;\n/**\n * Creates a `Fail` cause from an expected error.\n *\n * **Details**\n *\n * This function constructs a `Cause` carrying an error of type `E`. It's used\n * when you want to represent a known or anticipated failure in your effectful\n * computations.\n *\n * @see {@link isFailure} Check if a `Cause` contains a failure\n *\n * @since 2.0.0\n * @category Constructors\n */\nexport const fail = internal.fail;\n/**\n * Creates a `Die` cause from an unexpected error.\n *\n * **Details**\n *\n * This function wraps an unhandled or unknown defect (like a runtime crash)\n * into a `Cause`. It's useful for capturing unforeseen issues in a structured\n * way.\n *\n * @see {@link isDie} Check if a `Cause` contains a defect\n *\n * @since 2.0.0\n * @category Constructors\n */\nexport const die = internal.die;\n/**\n * Creates an `Interrupt` cause from a `FiberId`.\n *\n * **Details**\n *\n * This function represents a fiber that has been interrupted. It stores the\n * identifier of the interrupted fiber, enabling precise tracking of concurrent\n * cancellations.\n *\n * @see {@link isInterrupted} Check if a `Cause` contains an interruption\n *\n * @since 2.0.0\n * @category Constructors\n */\nexport const interrupt = internal.interrupt;\n/**\n * Combines two `Cause`s in parallel.\n *\n * **Details**\n *\n * This function merges two errors that occurred simultaneously. Instead of\n * discarding one error, both are retained, allowing for richer error reporting\n * and debugging.\n *\n * @see {@link isParallelType} Check if a `Cause` is a `Parallel`\n *\n * @since 2.0.0\n * @category Constructors\n */\nexport const parallel = internal.parallel;\n/**\n * Combines two `Cause`s sequentially.\n *\n * **Details**\n *\n * This function merges two errors that occurred in sequence, such as a main\n * error followed by a finalization error. It preserves both errors for complete\n * failure information.\n *\n * @see {@link isSequentialType} Check if a `Cause` is a `Sequential`\n *\n * @since 2.0.0\n * @category Constructors\n */\nexport const sequential = internal.sequential;\n/**\n * Checks if a value is a `Cause`.\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isCause = internal.isCause;\n/**\n * Checks if a `Cause` is an `Empty` type.\n *\n * @see {@link empty} Create a new `Empty` cause\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isEmptyType = internal.isEmptyType;\n/**\n * Checks if a `Cause` is a `Fail` type.\n *\n * @see {@link fail} Create a new `Fail` cause\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isFailType = internal.isFailType;\n/**\n * Checks if a `Cause` is a `Die` type.\n *\n * @see {@link die} Create a new `Die` cause\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isDieType = internal.isDieType;\n/**\n * Checks if a `Cause` is an `Interrupt` type.\n *\n * @see {@link interrupt} Create an `Interrupt` cause\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isInterruptType = internal.isInterruptType;\n/**\n * Checks if a `Cause` is a `Sequential` type.\n *\n * @see {@link sequential} Combine two `Cause`s sequentially\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isSequentialType = internal.isSequentialType;\n/**\n * Checks if a `Cause` is a `Parallel` type.\n *\n * @see {@link parallel} Combine two `Cause`s in parallel\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isParallelType = internal.isParallelType;\n/**\n * Calculates the size of a `Cause`.\n *\n * **Details**\n *\n * This function returns the total number of `Cause` nodes in the semiring\n * structure, reflecting how many individual error elements are recorded.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const size = internal.size;\n/**\n * Checks if a `Cause` is entirely empty.\n *\n * **Details**\n *\n * This function returns `true` if the `Cause` contains no errors, defects, or\n * interruptions. It's helpful for verifying if a computation truly had no\n * failures.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const isEmpty = internal.isEmpty;\n/**\n * Checks if a `Cause` contains a failure.\n *\n * **Details**\n *\n * This function returns `true` if the `Cause` includes any `Fail` error. It's\n * commonly used to confirm whether a workflow encountered an anticipated error\n * versus just defects or interruptions.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const isFailure = internal.isFailure;\n/**\n * Checks if a `Cause` contains a defect.\n *\n * **Details**\n *\n * This function returns `true` if the `Cause` includes any unexpected or\n * unhandled errors (`Die`). It's useful for differentiating known failures from\n * unexpected ones.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const isDie = internal.isDie;\n/**\n * Checks if a `Cause` contains an interruption.\n *\n * **Details**\n *\n * This function returns `true` if the `Cause` includes any fiber interruptions.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const isInterrupted = internal.isInterrupted;\n/**\n * Checks if a `Cause` contains only interruptions.\n *\n * **Details**\n *\n * This function returns `true` if the `Cause` has been interrupted but does not\n * contain any other failures, such as `Fail` or `Die`. It's helpful for\n * verifying purely \"cancellation\" scenarios.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const isInterruptedOnly = internal.isInterruptedOnly;\n/**\n * Extracts all recoverable errors of type `E` from a `Cause`.\n *\n * **Details**\n *\n * This function returns a chunk of errors, providing a list of all `Fail`\n * values found in the cause. It's useful for collecting all known failures for\n * logging or combined error handling.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const failures = internal.failures;\n/**\n * Extracts all unrecoverable defects from a `Cause`.\n *\n * **Details**\n *\n * This function returns a chunk of values representing unexpected errors\n * (`Die`). It's handy for capturing or logging unanticipated failures that\n * might need special handling, such as bug reports.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const defects = internal.defects;\n/**\n * Collects all `FiberId`s responsible for interrupting a fiber.\n *\n * **Details**\n *\n * This function returns a set of IDs indicating which fibers caused\n * interruptions within this `Cause`. It's useful for debugging concurrency\n * issues or tracing cancellations.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const interruptors = internal.interruptors;\n/**\n * Retrieves the first `Fail` error in a `Cause`, if present.\n *\n * **Details**\n *\n * This function returns an `Option` containing the first recoverable error\n * (`E`) from the cause. It's often used to quickly check if there's a primary\n * error to handle or display.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const failureOption = internal.failureOption;\n/**\n * Splits a `Cause` into either its first `Fail` error or the rest of the cause\n * (which might only contain `Die` or `Interrupt`).\n *\n * **Details**\n *\n * This function either returns the checked error (`E`) or the remaining\n * `Cause<never>` with defects/interruptions. It helps you decide if there's a\n * recoverable path or if only unhandled issues remain.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const failureOrCause = internal.failureOrCause;\n/**\n * Strips out failures with an error of `None` from a `Cause<Option<E>>`.\n *\n * **Details**\n *\n * This function turns a `Cause<Option<E>>` into an `Option<Cause<E>>`. If the\n * cause only contains failures of `None`, it becomes `None`; otherwise, it\n * returns a `Cause` of the remaining errors. It's helpful when working with\n * optional errors and filtering out certain error paths.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const flipCauseOption = internal.flipCauseOption;\n/**\n * Retrieves the first `Die` defect in a `Cause`, if present.\n *\n * **Details**\n *\n * This function returns an `Option` containing the first unexpected failure\n * (`Die`) discovered. It's helpful for diagnosing the primary defect in a chain\n * of errors.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const dieOption = internal.dieOption;\n/**\n * Retrieves the first `Interrupt` in a `Cause`, if present.\n *\n * **Details**\n *\n * This function returns an `Option` with the first fiber interruption\n * discovered. This is particularly useful for concurrency analysis or debugging\n * cancellations.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const interruptOption = internal.interruptOption;\n/**\n * Removes all `Fail` and `Interrupt` nodes, keeping only defects (`Die`) in a\n * `Cause`.\n *\n * **Details**\n *\n * This function strips a cause of recoverable errors and interruptions, leaving\n * only unexpected failures. If no defects remain, it returns `None`. It's\n * valuable for focusing only on unanticipated problems when both known errors\n * and defects could occur.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const keepDefects = internal.keepDefects;\n// TODO(4.0): remove? what's the point of this API?\n/**\n * Linearizes a `Cause` into a set of parallel causes, each containing a\n * sequential chain of failures.\n *\n * **Details**\n *\n * This function reorganizes the cause structure so that you can analyze each\n * parallel branch separately, even if they have multiple sequential errors.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const linearize = internal.linearize;\n/**\n * Removes `Fail` and `Interrupt` nodes from a `Cause`, keeping only defects\n * (`Die`).\n *\n * **Details**\n *\n * This function is similar to `keepDefects` but returns a `Cause<never>`\n * directly, which can still store `Die` or finalizer-related defects. It's\n * helpful for analyzing only the irrecoverable portion of the error.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const stripFailures = internal.stripFailures;\n/**\n * Removes matching defects from a `Cause` using a partial function, returning\n * the remainder.\n *\n * **Details**\n *\n * This function applies a user-defined extraction function to each defect\n * (`Die`). If the function matches the defect, that defect is removed. If all\n * defects match, the result is `None`. Otherwise, you get a `Cause` with the\n * unmatched defects.\n *\n * @since 2.0.0\n * @category Getters\n */\nexport const stripSomeDefects = internal.stripSomeDefects;\n/**\n * Replaces any errors in a `Cause` with a provided constant error.\n *\n * **Details**\n *\n * This function transforms all `Fail` errors into the specified error value,\n * preserving the structure of the `Cause`. It's useful when you no longer need\n * the original error details but still want to keep the cause shape.\n *\n * @see {@link map} Apply a custom transformation to `Fail` errors\n *\n * @since 2.0.0\n * @category Mapping\n */\nexport const as = internal.as;\n/**\n * Transforms the errors in a `Cause` using a user-provided function.\n *\n * **Details**\n *\n * This function applies `f` to each `Fail` error while leaving defects (`Die`)\n * and interruptions untouched. It's useful for changing or simplifying error\n * types in your effectful workflows.\n *\n * @see {@link as} Replace errors with a single constant\n *\n * @since 2.0.0\n * @category Mapping\n */\nexport const map = internal.map;\n/**\n * Transforms errors in a `Cause` into new causes.\n *\n * **Details**\n *\n * This function applies a function `f` to each `Fail` error, converting it into\n * a new `Cause`. This is especially powerful for merging or restructuring error\n * types while preserving or combining cause information.\n *\n * @see {@link map} Apply a simpler transformation to errors\n *\n * @since 2.0.0\n * @category Sequencing\n */\nexport const flatMap = internal.flatMap;\n/**\n * Sequences two `Cause`s. The second `Cause` can be dependent on the result of\n * the first `Cause`.\n *\n * @since 2.0.0\n * @category Sequencing\n */\nexport const andThen = internal.andThen;\n/**\n * Flattens a nested `Cause` structure.\n *\n * **Details**\n *\n * This function takes a `Cause<Cause<E>>` and merges the layers into a single\n * `Cause<E>`. It's useful for eliminating additional nesting created by\n * repeated transformations or compositions.\n *\n * @see {@link flatMap} Compose nested causes\n *\n * @since 2.0.0\n * @category Sequencing\n */\nexport const flatten = internal.flatten;\n/**\n * Checks if the current `Cause` contains or is equal to another `Cause`.\n *\n * **Details**\n *\n * This function returns `true` if `that` cause is part of or the same as\n * the current `Cause`. It's useful when you need to check for specific\n * error patterns or deduplicate repeated failures.\n *\n * @since 2.0.0\n * @category Elements\n */\nexport const contains = internal.contains;\n/**\n * Extracts the most \"important\" defect from a `Cause`.\n *\n * **Details**\n *\n * This function reduces a `Cause` to a single, prioritized defect. It evaluates\n * the `Cause` in the following order of priority:\n *\n * 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it returns\n * the raw error value.\n * 2. If there is no failure, it looks for the first defect (e.g., from\n * `Effect.die`).\n * 3. If neither of the above is present, and the `Cause` stems from an\n * interruption, it creates and returns an `InterruptedException`.\n *\n * This function ensures you can always extract a meaningful representation of\n * the primary issue from a potentially complex `Cause` structure.\n *\n * **When to Use**\n *\n * Use this function when you need to extract the most relevant error or defect\n * from a `Cause`, especially in scenarios where multiple errors or defects may\n * be present. It's particularly useful for simplifying error reporting or\n * logging.\n *\n * @see {@link squashWith} Allows transforming failures into defects when squashing.\n *\n * @since 2.0.0\n * @category Destructors\n */\nexport const squash = core.causeSquash;\n/**\n * Extracts the most \"important\" defect from a `Cause`, transforming failures\n * into defects using a provided function.\n *\n * **Details**\n *\n * This function reduces a `Cause` to a single, prioritized defect, while\n * allowing you to transform recoverable failures into defects through a custom\n * function. It processes the `Cause` in the following order:\n *\n * 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it applies\n * the provided function `f` to the error to transform it into a defect.\n * 2. If there is no failure, it looks for the first defect (e.g., from\n * `Effect.die`) and returns it.\n * 3. If neither is present and the `Cause` stems from an interruption, it\n * returns an `InterruptedException`.\n *\n * This function is particularly useful when you need custom handling or\n * transformation of errors while processing a `Cause`.\n *\n * @see {@link squash} Extracts the most \"important\" defect without transforming failures.\n *\n * @since 2.0.0\n * @category Destructors\n */\nexport const squashWith = core.causeSquashWith;\n/**\n * Searches a `Cause` using a partial function to extract information.\n *\n * **Details**\n *\n * This function allows you to search through a `Cause` using a custom partial\n * function. The partial function is applied to the `Cause`, and if it matches,\n * the result is returned wrapped in a `Some`. If no match is found, the result\n * is `None`.\n *\n * This is particularly useful when you are only interested in specific types of\n * errors, defects, or interruption causes within a potentially complex `Cause`\n * structure. By leveraging a partial function, you can focus on extracting only\n * the relevant information you care about.\n *\n * The partial function should return an `Option` indicating whether it matched\n * and the value it extracted.\n *\n * @since 2.0.0\n * @category Elements\n */\nexport const find = internal.find;\n/**\n * Preserves parts of a `Cause` that match a given predicate.\n *\n * **Details**\n *\n * This function allows you to retain only the parts of a `Cause` structure that\n * match a specified predicate or refinement. Any parts of the `Cause` that do\n * not match the provided condition are excluded from the result.\n *\n * You can use this function in two ways:\n * - With a `Predicate`: A function that evaluates whether a `Cause` should be\n * retained based on its value.\n * - With a `Refinement`: A more specific predicate that can refine the type of\n * the `Cause`.\n *\n * This is useful when you need to extract specific types of errors, defects, or\n * interruptions from a `Cause` while discarding unrelated parts.\n *\n * @since 2.0.0\n * @category Filtering\n */\nexport const filter = internal.filter;\n/**\n * Transforms a `Cause` into a single value using custom handlers for each\n * possible case.\n *\n * **Details**\n *\n * This function processes a `Cause` by applying a set of custom handlers to\n * each possible type of cause: `Empty`, `Fail`, `Die`, `Interrupt`,\n * `Sequential`, and `Parallel`. The result of this function is a single value\n * of type `Z`. This function allows you to define exactly how to handle each\n * part of a `Cause`, whether it's a failure, defect, interruption, or a\n * combination of these.\n *\n * The options parameter provides handlers for:\n * - `onEmpty`: Handles the case where the cause is `Empty`, meaning no errors\n * occurred.\n * - `onFail`: Processes a failure with an error of type `E`.\n * - `onDie`: Processes a defect (unexpected error).\n * - `onInterrupt`: Handles a fiber interruption, providing the `FiberId` of the\n * interruption.\n * - `onSequential`: Combines two sequential causes into a single value of type\n * `Z`.\n * - `onParallel`: Combines two parallel causes into a single value of type `Z`.\n *\n * @since 2.0.0\n * @category Matching\n */\nexport const match = internal.match;\n/**\n * Combines all parts of a `Cause` into a single value by starting with an\n * initial value.\n *\n * **Details**\n *\n * This function processes a `Cause` by starting with an initial value (`zero`)\n * and applying a custom function (`pf`) to combine all elements of the `Cause`\n * into a single result of type `Z`. The custom function determines how each\n * part of the `Cause` contributes to the final result. The function can return\n * an `Option` to either continue combining values or skip specific parts of the\n * `Cause`.\n *\n * This function is useful for tasks such as:\n * - Aggregating error messages from a `Cause` into a single string.\n * - Summarizing the structure of a `Cause` into a simplified result.\n * - Filtering or processing only specific parts of a `Cause`.\n *\n * The reduction proceeds in a top-down manner, visiting all nodes in the\n * `Cause` structure. This gives you complete control over how each part of the\n * `Cause` contributes to the final result.\n *\n * @since 2.0.0\n * @category Reducing\n */\nexport const reduce = internal.reduce;\n/**\n * Combines all parts of a `Cause` into a single value using a custom reducer\n * and a context.\n *\n * **Details**\n *\n * This function allows you to reduce a `Cause` into a single value of type `Z`\n * using a custom `CauseReducer`. A `CauseReducer` provides methods to handle\n * specific parts of the `Cause`, such as failures, defects, or interruptions.\n * Additionally, this function provides access to a `context` value, which can\n * be used to carry information or maintain state during the reduction process.\n *\n * This is particularly useful when the reduction process needs additional\n * context or configuration, such as:\n * - Aggregating error details with dynamic formatting.\n * - Collecting logs or statistics about the `Cause`.\n * - Performing stateful transformations based on the `context`.\n *\n * @see {@link reduce} To reduce a `Cause` without additional context.\n *\n * @since 2.0.0\n * @category Reducing\n */\nexport const reduceWithContext = internal.reduceWithContext;\n/**\n * Creates an error that indicates a `Fiber` was interrupted.\n *\n * **Details**\n *\n * This function constructs an `InterruptedException` recognized by the Effect\n * runtime. It is usually thrown or returned when a fiber's execution is\n * interrupted by external events or by another fiber. This is particularly\n * helpful in concurrent programs where fibers may halt each other before\n * completion.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const InterruptedException = core.InterruptedException;\n/**\n * Checks if a given unknown value is an `InterruptedException`.\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isInterruptedException = core.isInterruptedException;\n/**\n * Creates an error indicating an invalid method argument.\n *\n * **Details**\n *\n * This function constructs an `IllegalArgumentException`. It is typically\n * thrown or returned when an operation receives improper inputs, such as\n * out-of-range values or invalid object states.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const IllegalArgumentException = core.IllegalArgumentException;\n/**\n * Checks if a given unknown value is an `IllegalArgumentException`.\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isIllegalArgumentException = core.isIllegalArgumentException;\n/**\n * Creates an error indicating a missing element.\n *\n * **Details**\n *\n * This function constructs a `NoSuchElementException`. It helps you clearly\n * communicate that a required element is unavailable.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const NoSuchElementException = core.NoSuchElementException;\n/**\n * Checks if a given unknown value is a `NoSuchElementException`.\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isNoSuchElementException = core.isNoSuchElementException;\n/**\n * Creates an error for general runtime errors.\n *\n * **Details**\n *\n * This function constructs a `RuntimeException`, for errors that occur at\n * runtime but are not specifically typed or categorized as interruptions,\n * missing elements, or invalid arguments. It helps unify a wide range of\n * unexpected conditions under a single, recognizable error type.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const RuntimeException = core.RuntimeException;\n/**\n * Checks if a given unknown value is a `RuntimeException`.\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isRuntimeException = core.isRuntimeException;\n/**\n * Creates an error for operations that exceed their expected time.\n *\n * **Details**\n *\n * This function constructs a `TimeoutException`. It is typically used to signal\n * that an operation or fiber did not complete within a designated time limit,\n * allowing you to handle slow or hanging processes.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const TimeoutException = core.TimeoutException;\n/**\n * Checks if a given unknown value is a `TimeoutException`.\n *\n * @since 3.15.0\n * @category Guards\n */\nexport const isTimeoutException = core.isTimeoutException;\n/**\n * Creates an instance of `UnknownException`, an error object used to handle\n * unknown errors such as those from rejected promises.\n *\n * **Details**\n *\n * This function constructs an `UnknownException` with flexible behavior for\n * managing the error message and cause.\n *\n * The required `error` argument is passed as the `cause` to the global `Error`\n * constructor, ensuring that the original cause is preserved in the error chain\n * for debugging purposes. This ensures that the origin stack trace is\n * preserved.\n *\n * The `error` argument is always stored in the `error` property of the\n * `UnknownException` instance for reference, regardless of its type.\n *\n * Additionally, if you provide a `message` argument, it is used as the error\n * message. If no `message` is provided, the error message defaults to `\"An\n * unknown error occurred\"`.\n *\n * **When to Use**\n *\n * Use this function when you need to handle unexpected or unknown errors in\n * your application, particularly when the source of the error might not provide\n * a clear message. This is useful for wrapping generic errors thrown from\n * promises or external APIs.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const UnknownException = core.UnknownException;\n/**\n * Checks if a given unknown value is an `UnknownException`.\n *\n * @since 2.0.0\n * @category Guards\n */\nexport const isUnknownException = core.isUnknownException;\n/**\n * Creates an error indicating resource capacity has been exceeded.\n *\n * **Details**\n *\n * This function constructs an `ExceededCapacityException`, signifying that an\n * operation or resource usage surpassed established limits. This can be\n * essential for concurrency or resource management situations, ensuring your\n * application doesn't go beyond acceptable thresholds.\n *\n * @since 3.5.0\n * @category Errors\n */\nexport const ExceededCapacityException = core.ExceededCapacityException;\n/**\n * Checks if a given unknown value is an `ExceededCapacityException`.\n *\n * @since 3.5.0\n * @category Guards\n */\nexport const isExceededCapacityException = core.isExceededCapacityException;\n/**\n * Converts a `Cause` into a human-readable string.\n *\n * **Details**\n *\n * This function pretty-prints the entire `Cause`, including any failures,\n * defects, and interruptions. It can be especially helpful for logging,\n * debugging, or displaying structured errors to users.\n *\n * You can optionally pass `options` to configure how the error cause is\n * rendered. By default, it includes essential details of all errors in the\n * `Cause`.\n *\n * @see {@link prettyErrors} Get a list of `PrettyError` objects instead of a single string.\n *\n * @since 2.0.0\n * @category Formatting\n */\nexport const pretty = internal.pretty;\n/**\n * Returns a list of prettified errors (`PrettyError`) from a `Cause`.\n *\n * **Details**\n *\n * This function inspects the entire `Cause` and produces an array of\n * `PrettyError` objects. Each object may include additional metadata, such as a\n * `Span`, to provide deeper insights into where and how the error occurred.\n *\n * @since 3.2.0\n * @category Formatting\n */\nexport const prettyErrors = internal.prettyErrors;\n/**\n * Retrieves the original, unproxied error instance from an error object.\n *\n * **Details**\n *\n * This function returns the underlying error object without any\n * library-specific wrapping or proxying that might occur during error handling.\n * This can be essential if you need direct access to the error's native\n * properties, such as stack traces or custom data fields, for detailed\n * debugging or integration with external systems.\n *\n * @since 2.0.0\n * @category Errors\n */\nexport const originalError = core.originalInstance;\n//# sourceMappingURL=Cause.js.map","import * as core from \"./internal/core.js\";\nimport * as circular from \"./internal/effect/circular.js\";\nimport * as internal from \"./internal/fiber.js\";\nimport * as fiberRuntime from \"./internal/fiberRuntime.js\";\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const FiberTypeId = internal.FiberTypeId;\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const RuntimeFiberTypeId = internal.RuntimeFiberTypeId;\n/**\n * @since 2.0.0\n * @category instances\n */\nexport const Order = internal.Order;\n/**\n * Returns `true` if the specified value is a `Fiber`, `false` otherwise.\n *\n * @since 2.0.0\n * @category refinements\n */\nexport const isFiber = internal.isFiber;\n/**\n * Returns `true` if the specified `Fiber` is a `RuntimeFiber`, `false`\n * otherwise.\n *\n * @since 2.0.0\n * @category refinements\n */\nexport const isRuntimeFiber = internal.isRuntimeFiber;\n/**\n * The identity of the fiber.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const id = internal.id;\nconst _await = internal._await;\nexport {\n/**\n * Awaits the fiber, which suspends the awaiting fiber until the result of the\n * fiber has been determined.\n *\n * @since 2.0.0\n * @category getters\n */\n_await as await };\n/**\n * Awaits on all fibers to be completed, successfully or not.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const awaitAll = fiberRuntime.fiberAwaitAll;\n/**\n * Retrieves the immediate children of the fiber.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const children = internal.children;\n/**\n * Collects all fibers into a single fiber producing an in-order list of the\n * results.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const all = fiberRuntime.fiberAll;\n/**\n * A fiber that is done with the specified `Exit` value.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const done = internal.done;\n/**\n * @since 2.0.0\n * @category destructors\n */\nexport const dump = internal.dump;\n/**\n * @since 2.0.0\n * @category destructors\n */\nexport const dumpAll = internal.dumpAll;\n/**\n * A fiber that has already failed with the specified value.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fail = internal.fail;\n/**\n * Creates a `Fiber` that has already failed with the specified cause.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const failCause = internal.failCause;\n/**\n * Lifts an `Effect` into a `Fiber`.\n *\n * @since 2.0.0\n * @category conversions\n */\nexport const fromEffect = internal.fromEffect;\n/**\n * Gets the current fiber if one is running.\n *\n * @since 2.0.0\n * @category utilities\n */\nexport const getCurrentFiber = internal.getCurrentFiber;\n/**\n * Inherits values from all `FiberRef` instances into current fiber. This\n * will resume immediately.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const inheritAll = internal.inheritAll;\n/**\n * Interrupts the fiber from whichever fiber is calling this method. If the\n * fiber has already exited, the returned effect will resume immediately.\n * Otherwise, the effect will resume when the fiber exits.\n *\n * @since 2.0.0\n * @category interruption\n */\nexport const interrupt = core.interruptFiber;\n/**\n * Constructrs a `Fiber` that is already interrupted.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const interrupted = internal.interrupted;\n/**\n * Interrupts the fiber as if interrupted from the specified fiber. If the\n * fiber has already exited, the returned effect will resume immediately.\n * Otherwise, the effect will resume when the fiber exits.\n *\n * @since 2.0.0\n * @category interruption\n */\nexport const interruptAs = core.interruptAsFiber;\n/**\n * Interrupts the fiber as if interrupted from the specified fiber. If the\n * fiber has already exited, the returned effect will resume immediately.\n * Otherwise, the effect will resume when the fiber exits.\n *\n * @since 2.0.0\n * @category interruption\n */\nexport const interruptAsFork = internal.interruptAsFork;\n/**\n * Interrupts all fibers, awaiting their interruption.\n *\n * @since 2.0.0\n * @category interruption\n */\nexport const interruptAll = internal.interruptAll;\n/**\n * Interrupts all fibers as by the specified fiber, awaiting their\n * interruption.\n *\n * @since 2.0.0\n * @category interruption\n */\nexport const interruptAllAs = internal.interruptAllAs;\n/**\n * Interrupts the fiber from whichever fiber is calling this method. The\n * interruption will happen in a separate daemon fiber, and the returned\n * effect will always resume immediately without waiting.\n *\n * @since 2.0.0\n * @category interruption\n */\nexport const interruptFork = fiberRuntime.fiberInterruptFork;\n/**\n * Joins the fiber, which suspends the joining fiber until the result of the\n * fiber has been determined. Attempting to join a fiber that has erred will\n * result in a catchable error. Joining an interrupted fiber will result in an\n * \"inner interruption\" of this fiber, unlike interruption triggered by\n * another fiber, \"inner interruption\" can be caught and recovered.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const join = internal.join;\n/**\n * Joins all fibers, awaiting their _successful_ completion. Attempting to\n * join a fiber that has erred will result in a catchable error, _if_ that\n * error does not result from interruption.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const joinAll = fiberRuntime.fiberJoinAll;\n/**\n * Maps over the value the Fiber computes.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const map = internal.map;\n/**\n * Effectually maps over the value the fiber computes.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapEffect = internal.mapEffect;\n/**\n * Passes the success of this fiber to the specified callback, and continues\n * with the fiber that it returns.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapFiber = internal.mapFiber;\n/**\n * Folds over the `Fiber` or `RuntimeFiber`.\n *\n * @since 2.0.0\n * @category folding\n */\nexport const match = internal.match;\n/**\n * A fiber that never fails or succeeds.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const never = internal.never;\n/**\n * Returns a fiber that prefers `this` fiber, but falls back to the `that` one\n * when `this` one fails. Interrupting the returned fiber will interrupt both\n * fibers, sequentially, from left to right.\n *\n * @since 2.0.0\n * @category alternatives\n */\nexport const orElse = internal.orElse;\n/**\n * Returns a fiber that prefers `this` fiber, but falls back to the `that` one\n * when `this` one fails. Interrupting the returned fiber will interrupt both\n * fibers, sequentially, from left to right.\n *\n * @since 2.0.0\n * @category alternatives\n */\nexport const orElseEither = internal.orElseEither;\n/**\n * Tentatively observes the fiber, but returns immediately if it is not\n * already done.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const poll = internal.poll;\n/**\n * Pretty-prints a `RuntimeFiber`.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const pretty = internal.pretty;\n/**\n * Returns a chunk containing all root fibers.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const roots = internal.roots;\n/**\n * Returns a chunk containing all root fibers.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unsafeRoots = internal.unsafeRoots;\n/**\n * Converts this fiber into a scoped effect. The fiber is interrupted when the\n * scope is closed.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const scoped = fiberRuntime.fiberScoped;\n/**\n * Returns the `FiberStatus` of a `RuntimeFiber`.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const status = internal.status;\n/**\n * Returns a fiber that has already succeeded with the specified value.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const succeed = internal.succeed;\nconst void_ = internal.void;\nexport {\n/**\n * A fiber that has already succeeded with unit.\n *\n * @since 2.0.0\n * @category constructors\n */\nvoid_ as void };\n/**\n * Zips this fiber and the specified fiber together, producing a tuple of\n * their output.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zip = circular.zipFiber;\n/**\n * Same as `zip` but discards the output of that `Fiber`.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipLeft = circular.zipLeftFiber;\n/**\n * Same as `zip` but discards the output of this `Fiber`.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipRight = circular.zipRightFiber;\n/**\n * Zips this fiber with the specified fiber, combining their results using the\n * specified combiner function. Both joins and interruptions are performed in\n * sequential order from left to right.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipWith = circular.zipWithFiber;\n//# sourceMappingURL=Fiber.js.map","import * as Arr from \"../Array.js\";\nimport * as Chunk from \"../Chunk.js\";\nimport * as Effectable from \"../Effectable.js\";\nimport { dual, pipe } from \"../Function.js\";\nimport * as MutableQueue from \"../MutableQueue.js\";\nimport * as MutableRef from \"../MutableRef.js\";\nimport * as Option from \"../Option.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as core from \"./core.js\";\nimport * as fiberRuntime from \"./fiberRuntime.js\";\n/** @internal */\nconst EnqueueSymbolKey = \"effect/QueueEnqueue\";\n/** @internal */\nexport const EnqueueTypeId = /*#__PURE__*/Symbol.for(EnqueueSymbolKey);\n/** @internal */\nconst DequeueSymbolKey = \"effect/QueueDequeue\";\n/** @internal */\nexport const DequeueTypeId = /*#__PURE__*/Symbol.for(DequeueSymbolKey);\n/** @internal */\nconst QueueStrategySymbolKey = \"effect/QueueStrategy\";\n/** @internal */\nexport const QueueStrategyTypeId = /*#__PURE__*/Symbol.for(QueueStrategySymbolKey);\n/** @internal */\nconst BackingQueueSymbolKey = \"effect/BackingQueue\";\n/** @internal */\nexport const BackingQueueTypeId = /*#__PURE__*/Symbol.for(BackingQueueSymbolKey);\nconst queueStrategyVariance = {\n /* c8 ignore next */\n _A: _ => _\n};\nconst backingQueueVariance = {\n /* c8 ignore next */\n _A: _ => _\n};\n/** @internal */\nexport const enqueueVariance = {\n /* c8 ignore next */\n _In: _ => _\n};\n/** @internal */\nexport const dequeueVariance = {\n /* c8 ignore next */\n _Out: _ => _\n};\n/** @internal */\nclass QueueImpl extends Effectable.Class {\n queue;\n takers;\n shutdownHook;\n shutdownFlag;\n strategy;\n [EnqueueTypeId] = enqueueVariance;\n [DequeueTypeId] = dequeueVariance;\n constructor(/** @internal */\n queue, /** @internal */\n takers, /** @internal */\n shutdownHook, /** @internal */\n shutdownFlag, /** @internal */\n strategy) {\n super();\n this.queue = queue;\n this.takers = takers;\n this.shutdownHook = shutdownHook;\n this.shutdownFlag = shutdownFlag;\n this.strategy = strategy;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n commit() {\n return this.take;\n }\n capacity() {\n return this.queue.capacity();\n }\n get size() {\n return core.suspend(() => core.catchAll(this.unsafeSize(), () => core.interrupt));\n }\n unsafeSize() {\n if (MutableRef.get(this.shutdownFlag)) {\n return Option.none();\n }\n return Option.some(this.queue.length() - MutableQueue.length(this.takers) + this.strategy.surplusSize());\n }\n get isEmpty() {\n return core.map(this.size, size => size <= 0);\n }\n get isFull() {\n return core.map(this.size, size => size >= this.capacity());\n }\n get shutdown() {\n return core.uninterruptible(core.withFiberRuntime(state => {\n pipe(this.shutdownFlag, MutableRef.set(true));\n return pipe(fiberRuntime.forEachConcurrentDiscard(unsafePollAll(this.takers), d => core.deferredInterruptWith(d, state.id()), false, false), core.zipRight(this.strategy.shutdown), core.whenEffect(core.deferredSucceed(this.shutdownHook, void 0)), core.asVoid);\n }));\n }\n get isShutdown() {\n return core.sync(() => MutableRef.get(this.shutdownFlag));\n }\n get awaitShutdown() {\n return core.deferredAwait(this.shutdownHook);\n }\n isActive() {\n return !MutableRef.get(this.shutdownFlag);\n }\n unsafeOffer(value) {\n if (MutableRef.get(this.shutdownFlag)) {\n return false;\n }\n let noRemaining;\n if (this.queue.length() === 0) {\n const taker = pipe(this.takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue));\n if (taker !== MutableQueue.EmptyMutableQueue) {\n unsafeCompleteDeferred(taker, value);\n noRemaining = true;\n } else {\n noRemaining = false;\n }\n } else {\n noRemaining = false;\n }\n if (noRemaining) {\n return true;\n }\n // Not enough takers, offer to the queue\n const succeeded = this.queue.offer(value);\n unsafeCompleteTakers(this.strategy, this.queue, this.takers);\n return succeeded;\n }\n offer(value) {\n return core.suspend(() => {\n if (MutableRef.get(this.shutdownFlag)) {\n return core.interrupt;\n }\n let noRemaining;\n if (this.queue.length() === 0) {\n const taker = pipe(this.takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue));\n if (taker !== MutableQueue.EmptyMutableQueue) {\n unsafeCompleteDeferred(taker, value);\n noRemaining = true;\n } else {\n noRemaining = false;\n }\n } else {\n noRemaining = false;\n }\n if (noRemaining) {\n return core.succeed(true);\n }\n // Not enough takers, offer to the queue\n const succeeded = this.queue.offer(value);\n unsafeCompleteTakers(this.strategy, this.queue, this.takers);\n return succeeded ? core.succeed(true) : this.strategy.handleSurplus([value], this.queue, this.takers, this.shutdownFlag);\n });\n }\n offerAll(iterable) {\n return core.suspend(() => {\n if (MutableRef.get(this.shutdownFlag)) {\n return core.interrupt;\n }\n const values = Arr.fromIterable(iterable);\n const pTakers = this.queue.length() === 0 ? Arr.fromIterable(unsafePollN(this.takers, values.length)) : Arr.empty;\n const [forTakers, remaining] = pipe(values, Arr.splitAt(pTakers.length));\n for (let i = 0; i < pTakers.length; i++) {\n const taker = pTakers[i];\n const item = forTakers[i];\n unsafeCompleteDeferred(taker, item);\n }\n if (remaining.length === 0) {\n return core.succeed(true);\n }\n // Not enough takers, offer to the queue\n const surplus = this.queue.offerAll(remaining);\n unsafeCompleteTakers(this.strategy, this.queue, this.takers);\n return Chunk.isEmpty(surplus) ? core.succeed(true) : this.strategy.handleSurplus(surplus, this.queue, this.takers, this.shutdownFlag);\n });\n }\n get take() {\n return core.withFiberRuntime(state => {\n if (MutableRef.get(this.shutdownFlag)) {\n return core.interrupt;\n }\n const item = this.queue.poll(MutableQueue.EmptyMutableQueue);\n if (item !== MutableQueue.EmptyMutableQueue) {\n this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);\n return core.succeed(item);\n } else {\n // Add the deferred to takers, then:\n // - Try to take again in case a value was added since\n // - Wait for the deferred to be completed\n // - Clean up resources in case of interruption\n const deferred = core.deferredUnsafeMake(state.id());\n return pipe(core.suspend(() => {\n pipe(this.takers, MutableQueue.offer(deferred));\n unsafeCompleteTakers(this.strategy, this.queue, this.takers);\n return MutableRef.get(this.shutdownFlag) ? core.interrupt : core.deferredAwait(deferred);\n }), core.onInterrupt(() => {\n return core.sync(() => unsafeRemove(this.takers, deferred));\n }));\n }\n });\n }\n get takeAll() {\n return core.suspend(() => {\n return MutableRef.get(this.shutdownFlag) ? core.interrupt : core.sync(() => {\n const values = this.queue.pollUpTo(Number.POSITIVE_INFINITY);\n this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);\n return Chunk.fromIterable(values);\n });\n });\n }\n takeUpTo(max) {\n return core.suspend(() => MutableRef.get(this.shutdownFlag) ? core.interrupt : core.sync(() => {\n const values = this.queue.pollUpTo(max);\n this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);\n return Chunk.fromIterable(values);\n }));\n }\n takeBetween(min, max) {\n return core.suspend(() => takeRemainderLoop(this, min, max, Chunk.empty()));\n }\n}\n/** @internal */\nconst takeRemainderLoop = (self, min, max, acc) => {\n if (max < min) {\n return core.succeed(acc);\n }\n return pipe(takeUpTo(self, max), core.flatMap(bs => {\n const remaining = min - bs.length;\n if (remaining === 1) {\n return pipe(take(self), core.map(b => pipe(acc, Chunk.appendAll(bs), Chunk.append(b))));\n }\n if (remaining > 1) {\n return pipe(take(self), core.flatMap(b => takeRemainderLoop(self, remaining - 1, max - bs.length - 1, pipe(acc, Chunk.appendAll(bs), Chunk.append(b)))));\n }\n return core.succeed(pipe(acc, Chunk.appendAll(bs)));\n }));\n};\n/** @internal */\nexport const isQueue = u => isEnqueue(u) && isDequeue(u);\n/** @internal */\nexport const isEnqueue = u => hasProperty(u, EnqueueTypeId);\n/** @internal */\nexport const isDequeue = u => hasProperty(u, DequeueTypeId);\n/** @internal */\nexport const bounded = requestedCapacity => pipe(core.sync(() => MutableQueue.bounded(requestedCapacity)), core.flatMap(queue => make(backingQueueFromMutableQueue(queue), backPressureStrategy())));\n/** @internal */\nexport const dropping = requestedCapacity => pipe(core.sync(() => MutableQueue.bounded(requestedCapacity)), core.flatMap(queue => make(backingQueueFromMutableQueue(queue), droppingStrategy())));\n/** @internal */\nexport const sliding = requestedCapacity => pipe(core.sync(() => MutableQueue.bounded(requestedCapacity)), core.flatMap(queue => make(backingQueueFromMutableQueue(queue), slidingStrategy())));\n/** @internal */\nexport const unbounded = () => pipe(core.sync(() => MutableQueue.unbounded()), core.flatMap(queue => make(backingQueueFromMutableQueue(queue), droppingStrategy())));\n/** @internal */\nconst unsafeMake = (queue, takers, shutdownHook, shutdownFlag, strategy) => {\n return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);\n};\n/** @internal */\nexport const make = (queue, strategy) => pipe(core.deferredMake(), core.map(deferred => unsafeMake(queue, MutableQueue.unbounded(), deferred, MutableRef.make(false), strategy)));\n/** @internal */\nexport class BackingQueueFromMutableQueue {\n mutable;\n [BackingQueueTypeId] = backingQueueVariance;\n constructor(mutable) {\n this.mutable = mutable;\n }\n poll(def) {\n return MutableQueue.poll(this.mutable, def);\n }\n pollUpTo(limit) {\n return MutableQueue.pollUpTo(this.mutable, limit);\n }\n offerAll(elements) {\n return MutableQueue.offerAll(this.mutable, elements);\n }\n offer(element) {\n return MutableQueue.offer(this.mutable, element);\n }\n capacity() {\n return MutableQueue.capacity(this.mutable);\n }\n length() {\n return MutableQueue.length(this.mutable);\n }\n}\n/** @internal */\nexport const backingQueueFromMutableQueue = mutable => new BackingQueueFromMutableQueue(mutable);\n/** @internal */\nexport const capacity = self => self.capacity();\n/** @internal */\nexport const size = self => self.size;\n/** @internal */\nexport const isFull = self => self.isFull;\n/** @internal */\nexport const isEmpty = self => self.isEmpty;\n/** @internal */\nexport const isShutdown = self => self.isShutdown;\n/** @internal */\nexport const awaitShutdown = self => self.awaitShutdown;\n/** @internal */\nexport const shutdown = self => self.shutdown;\n/** @internal */\nexport const offer = /*#__PURE__*/dual(2, (self, value) => self.offer(value));\n/** @internal */\nexport const unsafeOffer = /*#__PURE__*/dual(2, (self, value) => self.unsafeOffer(value));\n/** @internal */\nexport const offerAll = /*#__PURE__*/dual(2, (self, iterable) => self.offerAll(iterable));\n/** @internal */\nexport const poll = self => core.map(self.takeUpTo(1), Chunk.head);\n/** @internal */\nexport const take = self => self.take;\n/** @internal */\nexport const takeAll = self => self.takeAll;\n/** @internal */\nexport const takeUpTo = /*#__PURE__*/dual(2, (self, max) => self.takeUpTo(max));\n/** @internal */\nexport const takeBetween = /*#__PURE__*/dual(3, (self, min, max) => self.takeBetween(min, max));\n/** @internal */\nexport const takeN = /*#__PURE__*/dual(2, (self, n) => self.takeBetween(n, n));\n// -----------------------------------------------------------------------------\n// Strategy\n// -----------------------------------------------------------------------------\n/** @internal */\nexport const backPressureStrategy = () => new BackPressureStrategy();\n/** @internal */\nexport const droppingStrategy = () => new DroppingStrategy();\n/** @internal */\nexport const slidingStrategy = () => new SlidingStrategy();\n/** @internal */\nclass BackPressureStrategy {\n [QueueStrategyTypeId] = queueStrategyVariance;\n putters = /*#__PURE__*/MutableQueue.unbounded();\n surplusSize() {\n return MutableQueue.length(this.putters);\n }\n onCompleteTakersWithEmptyQueue(takers) {\n while (!MutableQueue.isEmpty(this.putters) && !MutableQueue.isEmpty(takers)) {\n const taker = MutableQueue.poll(takers, void 0);\n const putter = MutableQueue.poll(this.putters, void 0);\n if (putter[2]) {\n unsafeCompleteDeferred(putter[1], true);\n }\n unsafeCompleteDeferred(taker, putter[0]);\n }\n }\n get shutdown() {\n return pipe(core.fiberId, core.flatMap(fiberId => pipe(core.sync(() => unsafePollAll(this.putters)), core.flatMap(putters => fiberRuntime.forEachConcurrentDiscard(putters, ([_, deferred, isLastItem]) => isLastItem ? pipe(core.deferredInterruptWith(deferred, fiberId), core.asVoid) : core.void, false, false)))));\n }\n handleSurplus(iterable, queue, takers, isShutdown) {\n return core.withFiberRuntime(state => {\n const deferred = core.deferredUnsafeMake(state.id());\n return pipe(core.suspend(() => {\n this.unsafeOffer(iterable, deferred);\n this.unsafeOnQueueEmptySpace(queue, takers);\n unsafeCompleteTakers(this, queue, takers);\n return MutableRef.get(isShutdown) ? core.interrupt : core.deferredAwait(deferred);\n }), core.onInterrupt(() => core.sync(() => this.unsafeRemove(deferred))));\n });\n }\n unsafeOnQueueEmptySpace(queue, takers) {\n let keepPolling = true;\n while (keepPolling && (queue.capacity() === Number.POSITIVE_INFINITY || queue.length() < queue.capacity())) {\n const putter = pipe(this.putters, MutableQueue.poll(MutableQueue.EmptyMutableQueue));\n if (putter === MutableQueue.EmptyMutableQueue) {\n keepPolling = false;\n } else {\n const offered = queue.offer(putter[0]);\n if (offered && putter[2]) {\n unsafeCompleteDeferred(putter[1], true);\n } else if (!offered) {\n unsafeOfferAll(this.putters, pipe(unsafePollAll(this.putters), Chunk.prepend(putter)));\n }\n unsafeCompleteTakers(this, queue, takers);\n }\n }\n }\n unsafeOffer(iterable, deferred) {\n const stuff = Arr.fromIterable(iterable);\n for (let i = 0; i < stuff.length; i++) {\n const value = stuff[i];\n if (i === stuff.length - 1) {\n pipe(this.putters, MutableQueue.offer([value, deferred, true]));\n } else {\n pipe(this.putters, MutableQueue.offer([value, deferred, false]));\n }\n }\n }\n unsafeRemove(deferred) {\n unsafeOfferAll(this.putters, pipe(unsafePollAll(this.putters), Chunk.filter(([, _]) => _ !== deferred)));\n }\n}\n/** @internal */\nclass DroppingStrategy {\n [QueueStrategyTypeId] = queueStrategyVariance;\n surplusSize() {\n return 0;\n }\n get shutdown() {\n return core.void;\n }\n onCompleteTakersWithEmptyQueue() {}\n handleSurplus(_iterable, _queue, _takers, _isShutdown) {\n return core.succeed(false);\n }\n unsafeOnQueueEmptySpace(_queue, _takers) {\n //\n }\n}\n/** @internal */\nclass SlidingStrategy {\n [QueueStrategyTypeId] = queueStrategyVariance;\n surplusSize() {\n return 0;\n }\n get shutdown() {\n return core.void;\n }\n onCompleteTakersWithEmptyQueue() {}\n handleSurplus(iterable, queue, takers, _isShutdown) {\n return core.sync(() => {\n this.unsafeOffer(queue, iterable);\n unsafeCompleteTakers(this, queue, takers);\n return true;\n });\n }\n unsafeOnQueueEmptySpace(_queue, _takers) {\n //\n }\n unsafeOffer(queue, iterable) {\n const iterator = iterable[Symbol.iterator]();\n let next;\n let offering = true;\n while (!(next = iterator.next()).done && offering) {\n if (queue.capacity() === 0) {\n return;\n }\n // Poll 1 and retry\n queue.poll(MutableQueue.EmptyMutableQueue);\n offering = queue.offer(next.value);\n }\n }\n}\n/** @internal */\nconst unsafeCompleteDeferred = (deferred, a) => {\n return core.deferredUnsafeDone(deferred, core.succeed(a));\n};\n/** @internal */\nconst unsafeOfferAll = (queue, as) => {\n return pipe(queue, MutableQueue.offerAll(as));\n};\n/** @internal */\nconst unsafePollAll = queue => {\n return pipe(queue, MutableQueue.pollUpTo(Number.POSITIVE_INFINITY));\n};\n/** @internal */\nconst unsafePollN = (queue, max) => {\n return pipe(queue, MutableQueue.pollUpTo(max));\n};\n/** @internal */\nexport const unsafeRemove = (queue, a) => {\n unsafeOfferAll(queue, pipe(unsafePollAll(queue), Chunk.filter(b => a !== b)));\n};\n/** @internal */\nexport const unsafeCompleteTakers = (strategy, queue, takers) => {\n // Check both a taker and an item are in the queue, starting with the taker\n let keepPolling = true;\n while (keepPolling && queue.length() !== 0) {\n const taker = pipe(takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue));\n if (taker !== MutableQueue.EmptyMutableQueue) {\n const element = queue.poll(MutableQueue.EmptyMutableQueue);\n if (element !== MutableQueue.EmptyMutableQueue) {\n unsafeCompleteDeferred(taker, element);\n strategy.unsafeOnQueueEmptySpace(queue, takers);\n } else {\n unsafeOfferAll(takers, pipe(unsafePollAll(takers), Chunk.prepend(taker)));\n }\n keepPolling = true;\n } else {\n keepPolling = false;\n }\n }\n if (keepPolling && queue.length() === 0 && !MutableQueue.isEmpty(takers)) {\n strategy.onCompleteTakersWithEmptyQueue(takers);\n }\n};\n//# sourceMappingURL=queue.js.map","import * as internal from \"./internal/queue.js\";\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const EnqueueTypeId = internal.EnqueueTypeId;\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const DequeueTypeId = internal.DequeueTypeId;\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const QueueStrategyTypeId = internal.QueueStrategyTypeId;\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const BackingQueueTypeId = internal.BackingQueueTypeId;\n/**\n * Returns `true` if the specified value is a `Queue`, `false` otherwise.\n *\n * @since 2.0.0\n * @category refinements\n */\nexport const isQueue = internal.isQueue;\n/**\n * Returns `true` if the specified value is a `Dequeue`, `false` otherwise.\n *\n * @since 2.0.0\n * @category refinements\n */\nexport const isDequeue = internal.isDequeue;\n/**\n * Returns `true` if the specified value is a `Enqueue`, `false` otherwise.\n *\n * @since 2.0.0\n * @category refinements\n */\nexport const isEnqueue = internal.isEnqueue;\n/**\n * @since 2.0.0\n * @category strategies\n */\nexport const backPressureStrategy = internal.backPressureStrategy;\n/**\n * @since 2.0.0\n * @category strategies\n */\nexport const droppingStrategy = internal.droppingStrategy;\n/**\n * @since 2.0.0\n * @category strategies\n */\nexport const slidingStrategy = internal.slidingStrategy;\n/**\n * @since 2.0.0\n * @category constructors\n */\nexport const make = internal.make;\n/**\n * Makes a new bounded `Queue`. When the capacity of the queue is reached, any\n * additional calls to `offer` will be suspended until there is more room in\n * the queue.\n *\n * **Note**: When possible use only power of 2 capacities; this will provide\n * better performance by utilising an optimised version of the underlying\n * `RingBuffer`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const bounded = internal.bounded;\n/**\n * Makes a new bounded `Queue` with the dropping strategy.\n *\n * When the capacity of the queue is reached, new elements will be dropped and the\n * old elements will remain.\n *\n * **Note**: When possible use only power of 2 capacities; this will provide\n * better performance by utilising an optimised version of the underlying\n * `RingBuffer`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const dropping = internal.dropping;\n/**\n * Makes a new bounded `Queue` with the sliding strategy.\n *\n * When the capacity of the queue is reached, new elements will be added and the\n * old elements will be dropped.\n *\n * **Note**: When possible use only power of 2 capacities; this will provide\n * better performance by utilising an optimised version of the underlying\n * `RingBuffer`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const sliding = internal.sliding;\n/**\n * Creates a new unbounded `Queue`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unbounded = internal.unbounded;\n/**\n * Returns the number of elements the queue can hold.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const capacity = internal.capacity;\n/**\n * Retrieves the size of the queue, which is equal to the number of elements\n * in the queue. This may be negative if fibers are suspended waiting for\n * elements to be added to the queue.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const size = internal.size;\n/**\n * Returns `true` if the `Queue` contains zero elements, `false` otherwise.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const isEmpty = internal.isEmpty;\n/**\n * Returns `true` if the `Queue` contains at least one element, `false`\n * otherwise.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const isFull = internal.isFull;\n/**\n * Returns `true` if `shutdown` has been called, otherwise returns `false`.\n *\n * @since 2.0.0\n * @category getters\n */\nexport const isShutdown = internal.isShutdown;\n/**\n * Waits until the queue is shutdown. The `Effect` returned by this method will\n * not resume until the queue has been shutdown. If the queue is already\n * shutdown, the `Effect` will resume right away.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const awaitShutdown = internal.awaitShutdown;\n/**\n * Interrupts any fibers that are suspended on `offer` or `take`. Future calls\n * to `offer*` and `take*` will be interrupted immediately.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const shutdown = internal.shutdown;\n/**\n * Places one value in the queue.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const offer = internal.offer;\n/**\n * Places one value in the queue.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const unsafeOffer = internal.unsafeOffer;\n/**\n * For Bounded Queue: uses the `BackPressure` Strategy, places the values in\n * the queue and always returns true. If the queue has reached capacity, then\n * the fiber performing the `offerAll` will be suspended until there is room\n * in the queue.\n *\n * For Unbounded Queue: Places all values in the queue and returns true.\n *\n * For Sliding Queue: uses `Sliding` Strategy If there is room in the queue,\n * it places the values otherwise it removes the old elements and enqueues the\n * new ones. Always returns true.\n *\n * For Dropping Queue: uses `Dropping` Strategy, It places the values in the\n * queue but if there is no room it will not enqueue them and return false.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const offerAll = internal.offerAll;\n/**\n * Returns the first value in the `Queue` as a `Some<A>`, or `None` if the queue\n * is empty.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const poll = internal.poll;\n/**\n * Takes the oldest value in the queue. If the queue is empty, this will return\n * a computation that resumes when an item has been added to the queue.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const take = internal.take;\n/**\n * Takes all the values in the queue and returns the values. If the queue is\n * empty returns an empty collection.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeAll = internal.takeAll;\n/**\n * Takes up to max number of values from the queue.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeUpTo = internal.takeUpTo;\n/**\n * Takes a number of elements from the queue between the specified minimum and\n * maximum. If there are fewer than the minimum number of elements available,\n * suspends until at least the minimum number of elements have been collected.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeBetween = internal.takeBetween;\n/**\n * Takes the specified number of elements from the queue. If there are fewer\n * than the specified number of elements available, it suspends until they\n * become available.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeN = internal.takeN;\n//# sourceMappingURL=Queue.js.map","/** @internal */\nexport const OP_CONTINUE = \"Continue\";\n/** @internal */\nexport const OP_CLOSE = \"Close\";\n/** @internal */\nexport const OP_YIELD = \"Yield\";\n//# sourceMappingURL=channelChildExecutorDecision.js.map","import { dual } from \"../../Function.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as OpCodes from \"../opCodes/channelChildExecutorDecision.js\";\n/** @internal */\nconst ChildExecutorDecisionSymbolKey = \"effect/ChannelChildExecutorDecision\";\n/** @internal */\nexport const ChildExecutorDecisionTypeId = /*#__PURE__*/Symbol.for(ChildExecutorDecisionSymbolKey);\n/** @internal */\nconst proto = {\n [ChildExecutorDecisionTypeId]: ChildExecutorDecisionTypeId\n};\n/** @internal */\nexport const Continue = _ => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_CONTINUE;\n return op;\n};\n/** @internal */\nexport const Close = value => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_CLOSE;\n op.value = value;\n return op;\n};\n/** @internal */\nexport const Yield = _ => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_YIELD;\n return op;\n};\n/** @internal */\nexport const isChildExecutorDecision = u => hasProperty(u, ChildExecutorDecisionTypeId);\n/** @internal */\nexport const isContinue = self => self._tag === OpCodes.OP_CONTINUE;\n/** @internal */\nexport const isClose = self => self._tag === OpCodes.OP_CLOSE;\n/** @internal */\nexport const isYield = self => self._tag === OpCodes.OP_YIELD;\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onClose,\n onContinue,\n onYield\n}) => {\n switch (self._tag) {\n case OpCodes.OP_CONTINUE:\n {\n return onContinue();\n }\n case OpCodes.OP_CLOSE:\n {\n return onClose(self.value);\n }\n case OpCodes.OP_YIELD:\n {\n return onYield();\n }\n }\n});\n//# sourceMappingURL=childExecutorDecision.js.map","/** @internal */\nexport const OP_CONTINUATION_K = \"ContinuationK\";\n/** @internal */\nexport const OP_CONTINUATION_FINALIZER = \"ContinuationFinalizer\";\n//# sourceMappingURL=continuation.js.map","import * as Exit from \"../../Exit.js\";\nimport * as OpCodes from \"../opCodes/continuation.js\";\n/** @internal */\nexport const ContinuationTypeId = /*#__PURE__*/Symbol.for(\"effect/ChannelContinuation\");\nconst continuationVariance = {\n /* c8 ignore next */\n _Env: _ => _,\n /* c8 ignore next */\n _InErr: _ => _,\n /* c8 ignore next */\n _InElem: _ => _,\n /* c8 ignore next */\n _InDone: _ => _,\n /* c8 ignore next */\n _OutErr: _ => _,\n /* c8 ignore next */\n _OutDone: _ => _,\n /* c8 ignore next */\n _OutErr2: _ => _,\n /* c8 ignore next */\n _OutElem: _ => _,\n /* c8 ignore next */\n _OutDone2: _ => _\n};\n/** @internal */\nexport class ContinuationKImpl {\n onSuccess;\n onHalt;\n _tag = OpCodes.OP_CONTINUATION_K;\n [ContinuationTypeId] = continuationVariance;\n constructor(onSuccess, onHalt) {\n this.onSuccess = onSuccess;\n this.onHalt = onHalt;\n }\n onExit(exit) {\n return Exit.isFailure(exit) ? this.onHalt(exit.cause) : this.onSuccess(exit.value);\n }\n}\n/** @internal */\nexport class ContinuationFinalizerImpl {\n finalizer;\n _tag = OpCodes.OP_CONTINUATION_FINALIZER;\n [ContinuationTypeId] = continuationVariance;\n constructor(finalizer) {\n this.finalizer = finalizer;\n }\n}\n//# sourceMappingURL=continuation.js.map","/** @internal */\nexport const OP_PULL_AFTER_NEXT = \"PullAfterNext\";\n/** @internal */\nexport const OP_PULL_AFTER_ALL_ENQUEUED = \"PullAfterAllEnqueued\";\n//# sourceMappingURL=channelUpstreamPullStrategy.js.map","import { dual } from \"../../Function.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as OpCodes from \"../opCodes/channelUpstreamPullStrategy.js\";\n/** @internal */\nconst UpstreamPullStrategySymbolKey = \"effect/ChannelUpstreamPullStrategy\";\n/** @internal */\nexport const UpstreamPullStrategyTypeId = /*#__PURE__*/Symbol.for(UpstreamPullStrategySymbolKey);\nconst upstreamPullStrategyVariance = {\n /* c8 ignore next */\n _A: _ => _\n};\n/** @internal */\nconst proto = {\n [UpstreamPullStrategyTypeId]: upstreamPullStrategyVariance\n};\n/** @internal */\nexport const PullAfterNext = emitSeparator => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_PULL_AFTER_NEXT;\n op.emitSeparator = emitSeparator;\n return op;\n};\n/** @internal */\nexport const PullAfterAllEnqueued = emitSeparator => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_PULL_AFTER_ALL_ENQUEUED;\n op.emitSeparator = emitSeparator;\n return op;\n};\n/** @internal */\nexport const isUpstreamPullStrategy = u => hasProperty(u, UpstreamPullStrategyTypeId);\n/** @internal */\nexport const isPullAfterNext = self => self._tag === OpCodes.OP_PULL_AFTER_NEXT;\n/** @internal */\nexport const isPullAfterAllEnqueued = self => self._tag === OpCodes.OP_PULL_AFTER_ALL_ENQUEUED;\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onAllEnqueued,\n onNext\n}) => {\n switch (self._tag) {\n case OpCodes.OP_PULL_AFTER_NEXT:\n {\n return onNext(self.emitSeparator);\n }\n case OpCodes.OP_PULL_AFTER_ALL_ENQUEUED:\n {\n return onAllEnqueued(self.emitSeparator);\n }\n }\n});\n//# sourceMappingURL=upstreamPullStrategy.js.map","/** @internal */\nexport const OP_BRACKET_OUT = \"BracketOut\";\n/** @internal */\nexport const OP_BRIDGE = \"Bridge\";\n/** @internal */\nexport const OP_CONCAT_ALL = \"ConcatAll\";\n/** @internal */\nexport const OP_EMIT = \"Emit\";\n/** @internal */\nexport const OP_ENSURING = \"Ensuring\";\n/** @internal */\nexport const OP_FAIL = \"Fail\";\n/** @internal */\nexport const OP_FOLD = \"Fold\";\n/** @internal */\nexport const OP_FROM_EFFECT = \"FromEffect\";\n/** @internal */\nexport const OP_PIPE_TO = \"PipeTo\";\n/** @internal */\nexport const OP_PROVIDE = \"Provide\";\n/** @internal */\nexport const OP_READ = \"Read\";\n/** @internal */\nexport const OP_SUCCEED = \"Succeed\";\n/** @internal */\nexport const OP_SUCCEED_NOW = \"SucceedNow\";\n/** @internal */\nexport const OP_SUSPEND = \"Suspend\";\n//# sourceMappingURL=channel.js.map","import * as Cause from \"../Cause.js\";\nimport * as Chunk from \"../Chunk.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Either from \"../Either.js\";\nimport { constVoid, dual, identity } from \"../Function.js\";\nimport * as Option from \"../Option.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as childExecutorDecision from \"./channel/childExecutorDecision.js\";\nimport { ContinuationKImpl } from \"./channel/continuation.js\";\nimport * as upstreamPullStrategy from \"./channel/upstreamPullStrategy.js\";\nimport * as OpCodes from \"./opCodes/channel.js\";\n/** @internal */\nconst ChannelSymbolKey = \"effect/Channel\";\n/** @internal */\nexport const ChannelTypeId = /*#__PURE__*/Symbol.for(ChannelSymbolKey);\nconst channelVariance = {\n /* c8 ignore next */\n _Env: _ => _,\n /* c8 ignore next */\n _InErr: _ => _,\n /* c8 ignore next */\n _InElem: _ => _,\n /* c8 ignore next */\n _InDone: _ => _,\n /* c8 ignore next */\n _OutErr: _ => _,\n /* c8 ignore next */\n _OutElem: _ => _,\n /* c8 ignore next */\n _OutDone: _ => _\n};\n/** @internal */\nconst proto = {\n [ChannelTypeId]: channelVariance,\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/** @internal */\nexport const isChannel = u => hasProperty(u, ChannelTypeId) || Effect.isEffect(u);\n/** @internal */\nexport const acquireReleaseOut = /*#__PURE__*/dual(2, (self, release) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_BRACKET_OUT;\n op.acquire = () => self;\n op.finalizer = release;\n return op;\n});\n/** @internal */\nexport const catchAllCause = /*#__PURE__*/dual(2, (self, f) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_FOLD;\n op.channel = self;\n op.k = new ContinuationKImpl(succeed, f);\n return op;\n});\n/** @internal */\nexport const collectElements = self => {\n return suspend(() => {\n const builder = [];\n return flatMap(pipeTo(self, collectElementsReader(builder)), value => sync(() => [Chunk.fromIterable(builder), value]));\n });\n};\n/** @internal */\nconst collectElementsReader = builder => readWith({\n onInput: outElem => flatMap(sync(() => {\n builder.push(outElem);\n }), () => collectElementsReader(builder)),\n onFailure: fail,\n onDone: succeedNow\n});\n/** @internal */\nexport const concatAll = channels => concatAllWith(channels, constVoid, constVoid);\n/** @internal */\nexport const concatAllWith = (channels, f, g) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_CONCAT_ALL;\n op.combineInners = f;\n op.combineAll = g;\n op.onPull = () => upstreamPullStrategy.PullAfterNext(Option.none());\n op.onEmit = () => childExecutorDecision.Continue;\n op.value = () => channels;\n op.k = identity;\n return op;\n};\n/** @internal */\nexport const concatMapWith = /*#__PURE__*/dual(4, (self, f, g, h) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_CONCAT_ALL;\n op.combineInners = g;\n op.combineAll = h;\n op.onPull = () => upstreamPullStrategy.PullAfterNext(Option.none());\n op.onEmit = () => childExecutorDecision.Continue;\n op.value = () => self;\n op.k = f;\n return op;\n});\n/** @internal */\nexport const concatMapWithCustom = /*#__PURE__*/dual(6, (self, f, g, h, onPull, onEmit) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_CONCAT_ALL;\n op.combineInners = g;\n op.combineAll = h;\n op.onPull = onPull;\n op.onEmit = onEmit;\n op.value = () => self;\n op.k = f;\n return op;\n});\n/** @internal */\nexport const embedInput = /*#__PURE__*/dual(2, (self, input) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_BRIDGE;\n op.input = input;\n op.channel = self;\n return op;\n});\n/** @internal */\nexport const ensuringWith = /*#__PURE__*/dual(2, (self, finalizer) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_ENSURING;\n op.channel = self;\n op.finalizer = finalizer;\n return op;\n});\n/** @internal */\nexport const fail = error => failCause(Cause.fail(error));\n/** @internal */\nexport const failSync = evaluate => failCauseSync(() => Cause.fail(evaluate()));\n/** @internal */\nexport const failCause = cause => failCauseSync(() => cause);\n/** @internal */\nexport const failCauseSync = evaluate => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_FAIL;\n op.error = evaluate;\n return op;\n};\n/** @internal */\nexport const flatMap = /*#__PURE__*/dual(2, (self, f) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_FOLD;\n op.channel = self;\n op.k = new ContinuationKImpl(f, failCause);\n return op;\n});\n/** @internal */\nexport const foldCauseChannel = /*#__PURE__*/dual(2, (self, options) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_FOLD;\n op.channel = self;\n op.k = new ContinuationKImpl(options.onSuccess, options.onFailure);\n return op;\n});\n/** @internal */\nexport const fromEffect = effect => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_FROM_EFFECT;\n op.effect = () => effect;\n return op;\n};\n/** @internal */\nexport const pipeTo = /*#__PURE__*/dual(2, (self, that) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_PIPE_TO;\n op.left = () => self;\n op.right = () => that;\n return op;\n});\n/** @internal */\nexport const provideContext = /*#__PURE__*/dual(2, (self, env) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_PROVIDE;\n op.context = () => env;\n op.inner = self;\n return op;\n});\n/** @internal */\nexport const readOrFail = error => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_READ;\n op.more = succeed;\n op.done = new ContinuationKImpl(() => fail(error), () => fail(error));\n return op;\n};\n/** @internal */\nexport const readWith = options => readWithCause({\n onInput: options.onInput,\n onFailure: cause => Either.match(Cause.failureOrCause(cause), {\n onLeft: options.onFailure,\n onRight: failCause\n }),\n onDone: options.onDone\n});\n/** @internal */\nexport const readWithCause = options => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_READ;\n op.more = options.onInput;\n op.done = new ContinuationKImpl(options.onDone, options.onFailure);\n return op;\n};\n/** @internal */\nexport const succeed = value => sync(() => value);\n/** @internal */\nexport const succeedNow = result => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_SUCCEED_NOW;\n op.terminal = result;\n return op;\n};\n/** @internal */\nexport const suspend = evaluate => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_SUSPEND;\n op.channel = evaluate;\n return op;\n};\nexport const sync = evaluate => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_SUCCEED;\n op.evaluate = evaluate;\n return op;\n};\nconst void_ = /*#__PURE__*/succeedNow(void 0);\nexport { /** @internal */\nvoid_ as void };\n/** @internal */\nexport const write = out => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_EMIT;\n op.out = out;\n return op;\n};\n//# sourceMappingURL=core-stream.js.map","/** @internal */\nexport const OP_DONE = \"Done\";\n/** @internal */\nexport const OP_EMIT = \"Emit\";\n/** @internal */\nexport const OP_FROM_EFFECT = \"FromEffect\";\n/** @internal */\nexport const OP_READ = \"Read\";\n//# sourceMappingURL=channelState.js.map","import * as Effect from \"../../Effect.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as OpCodes from \"../opCodes/channelState.js\";\n/** @internal */\nexport const ChannelStateTypeId = /*#__PURE__*/Symbol.for(\"effect/ChannelState\");\nconst channelStateVariance = {\n /* c8 ignore next */\n _E: _ => _,\n /* c8 ignore next */\n _R: _ => _\n};\n/** @internal */\nconst proto = {\n [ChannelStateTypeId]: channelStateVariance\n};\n/** @internal */\nexport const Done = () => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_DONE;\n return op;\n};\n/** @internal */\nexport const Emit = () => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_EMIT;\n return op;\n};\n/** @internal */\nexport const fromEffect = effect => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_FROM_EFFECT;\n op.effect = effect;\n return op;\n};\n/** @internal */\nexport const Read = (upstream, onEffect, onEmit, onDone) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_READ;\n op.upstream = upstream;\n op.onEffect = onEffect;\n op.onEmit = onEmit;\n op.onDone = onDone;\n return op;\n};\n/** @internal */\nexport const isChannelState = u => hasProperty(u, ChannelStateTypeId);\n/** @internal */\nexport const isDone = self => self._tag === OpCodes.OP_DONE;\n/** @internal */\nexport const isEmit = self => self._tag === OpCodes.OP_EMIT;\n/** @internal */\nexport const isFromEffect = self => self._tag === OpCodes.OP_FROM_EFFECT;\n/** @internal */\nexport const isRead = self => self._tag === OpCodes.OP_READ;\n/** @internal */\nexport const effect = self => isFromEffect(self) ? self.effect : Effect.void;\n/** @internal */\nexport const effectOrUndefinedIgnored = self => isFromEffect(self) ? Effect.ignore(self.effect) : undefined;\n//# sourceMappingURL=channelState.js.map","import * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport { pipe } from \"../../Function.js\";\n/** @internal */\nexport const OP_PULL_FROM_CHILD = \"PullFromChild\";\n/** @internal */\nexport const OP_PULL_FROM_UPSTREAM = \"PullFromUpstream\";\n/** @internal */\nexport const OP_DRAIN_CHILD_EXECUTORS = \"DrainChildExecutors\";\n/** @internal */\nexport const OP_EMIT = \"Emit\";\n/**\n * Execute the `childExecutor` and on each emitted value, decide what to do by\n * `onEmit`.\n *\n * @internal\n */\nexport class PullFromChild {\n childExecutor;\n parentSubexecutor;\n onEmit;\n _tag = OP_PULL_FROM_CHILD;\n constructor(childExecutor, parentSubexecutor, onEmit) {\n this.childExecutor = childExecutor;\n this.parentSubexecutor = parentSubexecutor;\n this.onEmit = onEmit;\n }\n close(exit) {\n const fin1 = this.childExecutor.close(exit);\n const fin2 = this.parentSubexecutor.close(exit);\n if (fin1 !== undefined && fin2 !== undefined) {\n return Effect.zipWith(Effect.exit(fin1), Effect.exit(fin2), (exit1, exit2) => pipe(exit1, Exit.zipRight(exit2)));\n } else if (fin1 !== undefined) {\n return fin1;\n } else if (fin2 !== undefined) {\n return fin2;\n } else {\n return undefined;\n }\n }\n enqueuePullFromChild(_child) {\n return this;\n }\n}\n/**\n * Execute `upstreamExecutor` and for each emitted element, spawn a child\n * channel and continue with processing it by `PullFromChild`.\n *\n * @internal\n */\nexport class PullFromUpstream {\n upstreamExecutor;\n createChild;\n lastDone;\n activeChildExecutors;\n combineChildResults;\n combineWithChildResult;\n onPull;\n onEmit;\n _tag = OP_PULL_FROM_UPSTREAM;\n constructor(upstreamExecutor, createChild, lastDone, activeChildExecutors, combineChildResults, combineWithChildResult, onPull, onEmit) {\n this.upstreamExecutor = upstreamExecutor;\n this.createChild = createChild;\n this.lastDone = lastDone;\n this.activeChildExecutors = activeChildExecutors;\n this.combineChildResults = combineChildResults;\n this.combineWithChildResult = combineWithChildResult;\n this.onPull = onPull;\n this.onEmit = onEmit;\n }\n close(exit) {\n const fin1 = this.upstreamExecutor.close(exit);\n const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];\n const result = fins.reduce((acc, next) => {\n if (acc !== undefined && next !== undefined) {\n return Effect.zipWith(acc, Effect.exit(next), (exit1, exit2) => Exit.zipRight(exit1, exit2));\n } else if (acc !== undefined) {\n return acc;\n } else if (next !== undefined) {\n return Effect.exit(next);\n } else {\n return undefined;\n }\n }, undefined);\n return result === undefined ? result : result;\n }\n enqueuePullFromChild(child) {\n return new PullFromUpstream(this.upstreamExecutor, this.createChild, this.lastDone, [...this.activeChildExecutors, child], this.combineChildResults, this.combineWithChildResult, this.onPull, this.onEmit);\n }\n}\n/**\n * Transformed from `PullFromUpstream` when upstream has finished but there\n * are still active child executors.\n *\n * @internal\n */\nexport class DrainChildExecutors {\n upstreamExecutor;\n lastDone;\n activeChildExecutors;\n upstreamDone;\n combineChildResults;\n combineWithChildResult;\n onPull;\n _tag = OP_DRAIN_CHILD_EXECUTORS;\n constructor(upstreamExecutor, lastDone, activeChildExecutors, upstreamDone, combineChildResults, combineWithChildResult, onPull) {\n this.upstreamExecutor = upstreamExecutor;\n this.lastDone = lastDone;\n this.activeChildExecutors = activeChildExecutors;\n this.upstreamDone = upstreamDone;\n this.combineChildResults = combineChildResults;\n this.combineWithChildResult = combineWithChildResult;\n this.onPull = onPull;\n }\n close(exit) {\n const fin1 = this.upstreamExecutor.close(exit);\n const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];\n const result = fins.reduce((acc, next) => {\n if (acc !== undefined && next !== undefined) {\n return Effect.zipWith(acc, Effect.exit(next), (exit1, exit2) => Exit.zipRight(exit1, exit2));\n } else if (acc !== undefined) {\n return acc;\n } else if (next !== undefined) {\n return Effect.exit(next);\n } else {\n return undefined;\n }\n }, undefined);\n return result === undefined ? result : result;\n }\n enqueuePullFromChild(child) {\n return new DrainChildExecutors(this.upstreamExecutor, this.lastDone, [...this.activeChildExecutors, child], this.upstreamDone, this.combineChildResults, this.combineWithChildResult, this.onPull);\n }\n}\n/** @internal */\nexport class Emit {\n value;\n next;\n _tag = OP_EMIT;\n constructor(value, next) {\n this.value = value;\n this.next = next;\n }\n close(exit) {\n const result = this.next.close(exit);\n return result === undefined ? result : result;\n }\n enqueuePullFromChild(_child) {\n return this;\n }\n}\n//# sourceMappingURL=subexecutor.js.map","/** @internal */\nexport const OP_PULLED = \"Pulled\";\n/** @internal */\nexport const OP_NO_UPSTREAM = \"NoUpstream\";\n//# sourceMappingURL=channelUpstreamPullRequest.js.map","import { dual } from \"../../Function.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as OpCodes from \"../opCodes/channelUpstreamPullRequest.js\";\n/** @internal */\nconst UpstreamPullRequestSymbolKey = \"effect/ChannelUpstreamPullRequest\";\n/** @internal */\nexport const UpstreamPullRequestTypeId = /*#__PURE__*/Symbol.for(UpstreamPullRequestSymbolKey);\nconst upstreamPullRequestVariance = {\n /* c8 ignore next */\n _A: _ => _\n};\n/** @internal */\nconst proto = {\n [UpstreamPullRequestTypeId]: upstreamPullRequestVariance\n};\n/** @internal */\nexport const Pulled = value => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_PULLED;\n op.value = value;\n return op;\n};\n/** @internal */\nexport const NoUpstream = activeDownstreamCount => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_NO_UPSTREAM;\n op.activeDownstreamCount = activeDownstreamCount;\n return op;\n};\n/** @internal */\nexport const isUpstreamPullRequest = u => hasProperty(u, UpstreamPullRequestTypeId);\n/** @internal */\nexport const isPulled = self => self._tag === OpCodes.OP_PULLED;\n/** @internal */\nexport const isNoUpstream = self => self._tag === OpCodes.OP_NO_UPSTREAM;\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onNoUpstream,\n onPulled\n}) => {\n switch (self._tag) {\n case OpCodes.OP_PULLED:\n {\n return onPulled(self.value);\n }\n case OpCodes.OP_NO_UPSTREAM:\n {\n return onNoUpstream(self.activeDownstreamCount);\n }\n }\n});\n//# sourceMappingURL=upstreamPullRequest.js.map","import * as Cause from \"../../Cause.js\";\nimport * as Deferred from \"../../Deferred.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ExecutionStrategy from \"../../ExecutionStrategy.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as Fiber from \"../../Fiber.js\";\nimport * as FiberId from \"../../FiberId.js\";\nimport { dual, identity, pipe } from \"../../Function.js\";\nimport * as HashSet from \"../../HashSet.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Scope from \"../../Scope.js\";\nimport * as core from \"../core-stream.js\";\nimport * as ChannelOpCodes from \"../opCodes/channel.js\";\nimport * as ChildExecutorDecisionOpCodes from \"../opCodes/channelChildExecutorDecision.js\";\nimport * as ChannelStateOpCodes from \"../opCodes/channelState.js\";\nimport * as UpstreamPullStrategyOpCodes from \"../opCodes/channelUpstreamPullStrategy.js\";\nimport * as ContinuationOpCodes from \"../opCodes/continuation.js\";\nimport * as ChannelState from \"./channelState.js\";\nimport * as Continuation from \"./continuation.js\";\nimport * as Subexecutor from \"./subexecutor.js\";\nimport * as upstreamPullRequest from \"./upstreamPullRequest.js\";\n/** @internal */\nexport class ChannelExecutor {\n _activeSubexecutor = undefined;\n _cancelled = undefined;\n _closeLastSubstream = undefined;\n _currentChannel;\n _done = undefined;\n _doneStack = [];\n _emitted = undefined;\n _executeCloseLastSubstream;\n _input = undefined;\n _inProgressFinalizer = undefined;\n _providedEnv;\n constructor(initialChannel, providedEnv, executeCloseLastSubstream) {\n this._currentChannel = initialChannel;\n this._executeCloseLastSubstream = executeCloseLastSubstream;\n this._providedEnv = providedEnv;\n }\n run() {\n let result = undefined;\n while (result === undefined) {\n if (this._cancelled !== undefined) {\n result = this.processCancellation();\n } else if (this._activeSubexecutor !== undefined) {\n result = this.runSubexecutor();\n } else {\n try {\n if (this._currentChannel === undefined) {\n result = ChannelState.Done();\n } else {\n if (Effect.isEffect(this._currentChannel)) {\n this._currentChannel = core.fromEffect(this._currentChannel);\n }\n switch (this._currentChannel._tag) {\n case ChannelOpCodes.OP_BRACKET_OUT:\n {\n result = this.runBracketOut(this._currentChannel);\n break;\n }\n case ChannelOpCodes.OP_BRIDGE:\n {\n const bridgeInput = this._currentChannel.input;\n // PipeTo(left, Bridge(queue, channel))\n // In a fiber: repeatedly run left and push its outputs to the queue\n // Add a finalizer to interrupt the fiber and close the executor\n this._currentChannel = this._currentChannel.channel;\n if (this._input !== undefined) {\n const inputExecutor = this._input;\n this._input = undefined;\n const drainer = () => Effect.flatMap(bridgeInput.awaitRead(), () => Effect.suspend(() => {\n const state = inputExecutor.run();\n switch (state._tag) {\n case ChannelStateOpCodes.OP_DONE:\n {\n return Exit.match(inputExecutor.getDone(), {\n onFailure: cause => bridgeInput.error(cause),\n onSuccess: value => bridgeInput.done(value)\n });\n }\n case ChannelStateOpCodes.OP_EMIT:\n {\n return Effect.flatMap(bridgeInput.emit(inputExecutor.getEmit()), () => drainer());\n }\n case ChannelStateOpCodes.OP_FROM_EFFECT:\n {\n return Effect.matchCauseEffect(state.effect, {\n onFailure: cause => bridgeInput.error(cause),\n onSuccess: () => drainer()\n });\n }\n case ChannelStateOpCodes.OP_READ:\n {\n return readUpstream(state, () => drainer(), cause => bridgeInput.error(cause));\n }\n }\n }));\n result = ChannelState.fromEffect(Effect.flatMap(Effect.forkDaemon(Effect.interruptible(drainer())), fiber => Effect.sync(() => this.addFinalizer(exit => Effect.flatMap(Fiber.interrupt(fiber), () => Effect.suspend(() => {\n const effect = this.restorePipe(exit, inputExecutor);\n return effect !== undefined ? effect : Effect.void;\n }))))));\n }\n break;\n }\n case ChannelOpCodes.OP_CONCAT_ALL:\n {\n const executor = new ChannelExecutor(this._currentChannel.value(), this._providedEnv, effect => Effect.sync(() => {\n const prevLastClose = this._closeLastSubstream === undefined ? Effect.void : this._closeLastSubstream;\n this._closeLastSubstream = pipe(prevLastClose, Effect.zipRight(effect));\n }));\n executor._input = this._input;\n const channel = this._currentChannel;\n this._activeSubexecutor = new Subexecutor.PullFromUpstream(executor, value => channel.k(value), undefined, [], (x, y) => channel.combineInners(x, y), (x, y) => channel.combineAll(x, y), request => channel.onPull(request), value => channel.onEmit(value));\n this._closeLastSubstream = undefined;\n this._currentChannel = undefined;\n break;\n }\n case ChannelOpCodes.OP_EMIT:\n {\n this._emitted = this._currentChannel.out;\n this._currentChannel = this._activeSubexecutor !== undefined ? undefined : core.void;\n result = ChannelState.Emit();\n break;\n }\n case ChannelOpCodes.OP_ENSURING:\n {\n this.runEnsuring(this._currentChannel);\n break;\n }\n case ChannelOpCodes.OP_FAIL:\n {\n result = this.doneHalt(this._currentChannel.error());\n break;\n }\n case ChannelOpCodes.OP_FOLD:\n {\n this._doneStack.push(this._currentChannel.k);\n this._currentChannel = this._currentChannel.channel;\n break;\n }\n case ChannelOpCodes.OP_FROM_EFFECT:\n {\n const effect = this._providedEnv === undefined ? this._currentChannel.effect() : pipe(this._currentChannel.effect(), Effect.provide(this._providedEnv));\n result = ChannelState.fromEffect(Effect.matchCauseEffect(effect, {\n onFailure: cause => {\n const state = this.doneHalt(cause);\n return state !== undefined && ChannelState.isFromEffect(state) ? state.effect : Effect.void;\n },\n onSuccess: value => {\n const state = this.doneSucceed(value);\n return state !== undefined && ChannelState.isFromEffect(state) ? state.effect : Effect.void;\n }\n }));\n break;\n }\n case ChannelOpCodes.OP_PIPE_TO:\n {\n const previousInput = this._input;\n const leftExec = new ChannelExecutor(this._currentChannel.left(), this._providedEnv, effect => this._executeCloseLastSubstream(effect));\n leftExec._input = previousInput;\n this._input = leftExec;\n this.addFinalizer(exit => {\n const effect = this.restorePipe(exit, previousInput);\n return effect !== undefined ? effect : Effect.void;\n });\n this._currentChannel = this._currentChannel.right();\n break;\n }\n case ChannelOpCodes.OP_PROVIDE:\n {\n const previousEnv = this._providedEnv;\n this._providedEnv = this._currentChannel.context();\n this._currentChannel = this._currentChannel.inner;\n this.addFinalizer(() => Effect.sync(() => {\n this._providedEnv = previousEnv;\n }));\n break;\n }\n case ChannelOpCodes.OP_READ:\n {\n const read = this._currentChannel;\n result = ChannelState.Read(this._input, identity, emitted => {\n try {\n this._currentChannel = read.more(emitted);\n } catch (error) {\n this._currentChannel = read.done.onExit(Exit.die(error));\n }\n return undefined;\n }, exit => {\n const onExit = exit => {\n return read.done.onExit(exit);\n };\n this._currentChannel = onExit(exit);\n return undefined;\n });\n break;\n }\n case ChannelOpCodes.OP_SUCCEED:\n {\n result = this.doneSucceed(this._currentChannel.evaluate());\n break;\n }\n case ChannelOpCodes.OP_SUCCEED_NOW:\n {\n result = this.doneSucceed(this._currentChannel.terminal);\n break;\n }\n case ChannelOpCodes.OP_SUSPEND:\n {\n this._currentChannel = this._currentChannel.channel();\n break;\n }\n }\n }\n } catch (error) {\n this._currentChannel = core.failCause(Cause.die(error));\n }\n }\n }\n return result;\n }\n getDone() {\n return this._done;\n }\n getEmit() {\n return this._emitted;\n }\n cancelWith(exit) {\n this._cancelled = exit;\n }\n clearInProgressFinalizer() {\n this._inProgressFinalizer = undefined;\n }\n storeInProgressFinalizer(finalizer) {\n this._inProgressFinalizer = finalizer;\n }\n popAllFinalizers(exit) {\n const finalizers = [];\n let next = this._doneStack.pop();\n while (next) {\n if (next._tag === \"ContinuationFinalizer\") {\n finalizers.push(next.finalizer);\n }\n next = this._doneStack.pop();\n }\n const effect = finalizers.length === 0 ? Effect.void : runFinalizers(finalizers, exit);\n this.storeInProgressFinalizer(effect);\n return effect;\n }\n popNextFinalizers() {\n const builder = [];\n while (this._doneStack.length !== 0) {\n const cont = this._doneStack[this._doneStack.length - 1];\n if (cont._tag === ContinuationOpCodes.OP_CONTINUATION_K) {\n return builder;\n }\n builder.push(cont);\n this._doneStack.pop();\n }\n return builder;\n }\n restorePipe(exit, prev) {\n const currInput = this._input;\n this._input = prev;\n if (currInput !== undefined) {\n const effect = currInput.close(exit);\n return effect;\n }\n return Effect.void;\n }\n close(exit) {\n let runInProgressFinalizers = undefined;\n const finalizer = this._inProgressFinalizer;\n if (finalizer !== undefined) {\n runInProgressFinalizers = pipe(finalizer, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())));\n }\n let closeSelf = undefined;\n const selfFinalizers = this.popAllFinalizers(exit);\n if (selfFinalizers !== undefined) {\n closeSelf = pipe(selfFinalizers, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())));\n }\n const closeSubexecutors = this._activeSubexecutor === undefined ? undefined : this._activeSubexecutor.close(exit);\n if (closeSubexecutors === undefined && runInProgressFinalizers === undefined && closeSelf === undefined) {\n return undefined;\n }\n return pipe(Effect.exit(ifNotNull(closeSubexecutors)), Effect.zip(Effect.exit(ifNotNull(runInProgressFinalizers))), Effect.zip(Effect.exit(ifNotNull(closeSelf))), Effect.map(([[exit1, exit2], exit3]) => pipe(exit1, Exit.zipRight(exit2), Exit.zipRight(exit3))), Effect.uninterruptible,\n // TODO: remove\n Effect.flatMap(exit => Effect.suspend(() => exit)));\n }\n doneSucceed(value) {\n if (this._doneStack.length === 0) {\n this._done = Exit.succeed(value);\n this._currentChannel = undefined;\n return ChannelState.Done();\n }\n const head = this._doneStack[this._doneStack.length - 1];\n if (head._tag === ContinuationOpCodes.OP_CONTINUATION_K) {\n this._doneStack.pop();\n this._currentChannel = head.onSuccess(value);\n return undefined;\n }\n const finalizers = this.popNextFinalizers();\n if (this._doneStack.length === 0) {\n this._doneStack = finalizers.reverse();\n this._done = Exit.succeed(value);\n this._currentChannel = undefined;\n return ChannelState.Done();\n }\n const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), Exit.succeed(value));\n this.storeInProgressFinalizer(finalizerEffect);\n const effect = pipe(finalizerEffect, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())), Effect.uninterruptible, Effect.flatMap(() => Effect.sync(() => this.doneSucceed(value))));\n return ChannelState.fromEffect(effect);\n }\n doneHalt(cause) {\n if (this._doneStack.length === 0) {\n this._done = Exit.failCause(cause);\n this._currentChannel = undefined;\n return ChannelState.Done();\n }\n const head = this._doneStack[this._doneStack.length - 1];\n if (head._tag === ContinuationOpCodes.OP_CONTINUATION_K) {\n this._doneStack.pop();\n try {\n this._currentChannel = head.onHalt(cause);\n } catch (error) {\n this._currentChannel = core.failCause(Cause.die(error));\n }\n return undefined;\n }\n const finalizers = this.popNextFinalizers();\n if (this._doneStack.length === 0) {\n this._doneStack = finalizers.reverse();\n this._done = Exit.failCause(cause);\n this._currentChannel = undefined;\n return ChannelState.Done();\n }\n const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), Exit.failCause(cause));\n this.storeInProgressFinalizer(finalizerEffect);\n const effect = pipe(finalizerEffect, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())), Effect.uninterruptible, Effect.flatMap(() => Effect.sync(() => this.doneHalt(cause))));\n return ChannelState.fromEffect(effect);\n }\n processCancellation() {\n this._currentChannel = undefined;\n this._done = this._cancelled;\n this._cancelled = undefined;\n return ChannelState.Done();\n }\n runBracketOut(bracketOut) {\n const effect = Effect.uninterruptible(Effect.matchCauseEffect(this.provide(bracketOut.acquire()), {\n onFailure: cause => Effect.sync(() => {\n this._currentChannel = core.failCause(cause);\n }),\n onSuccess: out => Effect.sync(() => {\n this.addFinalizer(exit => this.provide(bracketOut.finalizer(out, exit)));\n this._currentChannel = core.write(out);\n })\n }));\n return ChannelState.fromEffect(effect);\n }\n provide(effect) {\n if (this._providedEnv === undefined) {\n return effect;\n }\n return pipe(effect, Effect.provide(this._providedEnv));\n }\n runEnsuring(ensuring) {\n this.addFinalizer(ensuring.finalizer);\n this._currentChannel = ensuring.channel;\n }\n addFinalizer(f) {\n this._doneStack.push(new Continuation.ContinuationFinalizerImpl(f));\n }\n runSubexecutor() {\n const subexecutor = this._activeSubexecutor;\n switch (subexecutor._tag) {\n case Subexecutor.OP_PULL_FROM_CHILD:\n {\n return this.pullFromChild(subexecutor.childExecutor, subexecutor.parentSubexecutor, subexecutor.onEmit, subexecutor);\n }\n case Subexecutor.OP_PULL_FROM_UPSTREAM:\n {\n return this.pullFromUpstream(subexecutor);\n }\n case Subexecutor.OP_DRAIN_CHILD_EXECUTORS:\n {\n return this.drainChildExecutors(subexecutor);\n }\n case Subexecutor.OP_EMIT:\n {\n this._emitted = subexecutor.value;\n this._activeSubexecutor = subexecutor.next;\n return ChannelState.Emit();\n }\n }\n }\n replaceSubexecutor(nextSubExec) {\n this._currentChannel = undefined;\n this._activeSubexecutor = nextSubExec;\n }\n finishWithExit(exit) {\n const state = Exit.match(exit, {\n onFailure: cause => this.doneHalt(cause),\n onSuccess: value => this.doneSucceed(value)\n });\n this._activeSubexecutor = undefined;\n return state === undefined ? Effect.void : ChannelState.effect(state);\n }\n finishSubexecutorWithCloseEffect(subexecutorDone, ...closeFuncs) {\n this.addFinalizer(() => pipe(closeFuncs, Effect.forEach(closeFunc => pipe(Effect.sync(() => closeFunc(subexecutorDone)), Effect.flatMap(closeEffect => closeEffect !== undefined ? closeEffect : Effect.void)), {\n discard: true\n })));\n const state = pipe(subexecutorDone, Exit.match({\n onFailure: cause => this.doneHalt(cause),\n onSuccess: value => this.doneSucceed(value)\n }));\n this._activeSubexecutor = undefined;\n return state;\n }\n applyUpstreamPullStrategy(upstreamFinished, queue, strategy) {\n switch (strategy._tag) {\n case UpstreamPullStrategyOpCodes.OP_PULL_AFTER_NEXT:\n {\n const shouldPrepend = !upstreamFinished || queue.some(subexecutor => subexecutor !== undefined);\n return [strategy.emitSeparator, shouldPrepend ? [undefined, ...queue] : queue];\n }\n case UpstreamPullStrategyOpCodes.OP_PULL_AFTER_ALL_ENQUEUED:\n {\n const shouldEnqueue = !upstreamFinished || queue.some(subexecutor => subexecutor !== undefined);\n return [strategy.emitSeparator, shouldEnqueue ? [...queue, undefined] : queue];\n }\n }\n }\n pullFromChild(childExecutor, parentSubexecutor, onEmitted, subexecutor) {\n return ChannelState.Read(childExecutor, identity, emitted => {\n const childExecutorDecision = onEmitted(emitted);\n switch (childExecutorDecision._tag) {\n case ChildExecutorDecisionOpCodes.OP_CONTINUE:\n {\n break;\n }\n case ChildExecutorDecisionOpCodes.OP_CLOSE:\n {\n this.finishWithDoneValue(childExecutor, parentSubexecutor, childExecutorDecision.value);\n break;\n }\n case ChildExecutorDecisionOpCodes.OP_YIELD:\n {\n const modifiedParent = parentSubexecutor.enqueuePullFromChild(subexecutor);\n this.replaceSubexecutor(modifiedParent);\n break;\n }\n }\n this._activeSubexecutor = new Subexecutor.Emit(emitted, this._activeSubexecutor);\n return undefined;\n }, Exit.match({\n onFailure: cause => {\n const state = this.handleSubexecutorFailure(childExecutor, parentSubexecutor, cause);\n return state === undefined ? undefined : ChannelState.effectOrUndefinedIgnored(state);\n },\n onSuccess: doneValue => {\n this.finishWithDoneValue(childExecutor, parentSubexecutor, doneValue);\n return undefined;\n }\n }));\n }\n finishWithDoneValue(childExecutor, parentSubexecutor, doneValue) {\n const subexecutor = parentSubexecutor;\n switch (subexecutor._tag) {\n case Subexecutor.OP_PULL_FROM_UPSTREAM:\n {\n const modifiedParent = new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit);\n this._closeLastSubstream = childExecutor.close(Exit.succeed(doneValue));\n this.replaceSubexecutor(modifiedParent);\n break;\n }\n case Subexecutor.OP_DRAIN_CHILD_EXECUTORS:\n {\n const modifiedParent = new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);\n this._closeLastSubstream = childExecutor.close(Exit.succeed(doneValue));\n this.replaceSubexecutor(modifiedParent);\n break;\n }\n default:\n {\n break;\n }\n }\n }\n handleSubexecutorFailure(childExecutor, parentSubexecutor, cause) {\n return this.finishSubexecutorWithCloseEffect(Exit.failCause(cause), exit => parentSubexecutor.close(exit), exit => childExecutor.close(exit));\n }\n pullFromUpstream(subexecutor) {\n if (subexecutor.activeChildExecutors.length === 0) {\n return this.performPullFromUpstream(subexecutor);\n }\n const activeChild = subexecutor.activeChildExecutors[0];\n const parentSubexecutor = new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, subexecutor.activeChildExecutors.slice(1), subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit);\n if (activeChild === undefined) {\n return this.performPullFromUpstream(parentSubexecutor);\n }\n this.replaceSubexecutor(new Subexecutor.PullFromChild(activeChild.childExecutor, parentSubexecutor, activeChild.onEmit));\n return undefined;\n }\n performPullFromUpstream(subexecutor) {\n return ChannelState.Read(subexecutor.upstreamExecutor, effect => {\n const closeLastSubstream = this._closeLastSubstream === undefined ? Effect.void : this._closeLastSubstream;\n this._closeLastSubstream = undefined;\n return pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.zipRight(effect));\n }, emitted => {\n if (this._closeLastSubstream !== undefined) {\n const closeLastSubstream = this._closeLastSubstream;\n this._closeLastSubstream = undefined;\n return pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.map(() => {\n const childExecutor = new ChannelExecutor(subexecutor.createChild(emitted), this._providedEnv, this._executeCloseLastSubstream);\n childExecutor._input = this._input;\n const [emitSeparator, updatedChildExecutors] = this.applyUpstreamPullStrategy(false, subexecutor.activeChildExecutors, subexecutor.onPull(upstreamPullRequest.Pulled(emitted)));\n this._activeSubexecutor = new Subexecutor.PullFromChild(childExecutor, new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, updatedChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit), subexecutor.onEmit);\n if (Option.isSome(emitSeparator)) {\n this._activeSubexecutor = new Subexecutor.Emit(emitSeparator.value, this._activeSubexecutor);\n }\n return undefined;\n }));\n }\n const childExecutor = new ChannelExecutor(subexecutor.createChild(emitted), this._providedEnv, this._executeCloseLastSubstream);\n childExecutor._input = this._input;\n const [emitSeparator, updatedChildExecutors] = this.applyUpstreamPullStrategy(false, subexecutor.activeChildExecutors, subexecutor.onPull(upstreamPullRequest.Pulled(emitted)));\n this._activeSubexecutor = new Subexecutor.PullFromChild(childExecutor, new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, updatedChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit), subexecutor.onEmit);\n if (Option.isSome(emitSeparator)) {\n this._activeSubexecutor = new Subexecutor.Emit(emitSeparator.value, this._activeSubexecutor);\n }\n return undefined;\n }, exit => {\n if (subexecutor.activeChildExecutors.some(subexecutor => subexecutor !== undefined)) {\n const drain = new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone, [undefined, ...subexecutor.activeChildExecutors], subexecutor.upstreamExecutor.getDone(), subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);\n if (this._closeLastSubstream !== undefined) {\n const closeLastSubstream = this._closeLastSubstream;\n this._closeLastSubstream = undefined;\n return pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.map(() => this.replaceSubexecutor(drain)));\n }\n this.replaceSubexecutor(drain);\n return undefined;\n }\n const closeLastSubstream = this._closeLastSubstream;\n const state = this.finishSubexecutorWithCloseEffect(pipe(exit, Exit.map(a => subexecutor.combineWithChildResult(subexecutor.lastDone, a))), () => closeLastSubstream, exit => subexecutor.upstreamExecutor.close(exit));\n return state === undefined ? undefined :\n // NOTE: assuming finalizers cannot fail\n ChannelState.effectOrUndefinedIgnored(state);\n });\n }\n drainChildExecutors(subexecutor) {\n if (subexecutor.activeChildExecutors.length === 0) {\n const lastClose = this._closeLastSubstream;\n if (lastClose !== undefined) {\n this.addFinalizer(() => Effect.succeed(lastClose));\n }\n return this.finishSubexecutorWithCloseEffect(subexecutor.upstreamDone, () => lastClose, exit => subexecutor.upstreamExecutor.close(exit));\n }\n const activeChild = subexecutor.activeChildExecutors[0];\n const rest = subexecutor.activeChildExecutors.slice(1);\n if (activeChild === undefined) {\n const [emitSeparator, remainingExecutors] = this.applyUpstreamPullStrategy(true, rest, subexecutor.onPull(upstreamPullRequest.NoUpstream(rest.reduce((n, curr) => curr !== undefined ? n + 1 : n, 0))));\n this.replaceSubexecutor(new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone, remainingExecutors, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull));\n if (Option.isSome(emitSeparator)) {\n this._emitted = emitSeparator.value;\n return ChannelState.Emit();\n }\n return undefined;\n }\n const parentSubexecutor = new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone, rest, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);\n this.replaceSubexecutor(new Subexecutor.PullFromChild(activeChild.childExecutor, parentSubexecutor, activeChild.onEmit));\n return undefined;\n }\n}\nconst ifNotNull = effect => effect !== undefined ? effect : Effect.void;\nconst runFinalizers = (finalizers, exit) => {\n return pipe(Effect.forEach(finalizers, fin => Effect.exit(fin(exit))), Effect.map(exits => pipe(Exit.all(exits), Option.getOrElse(() => Exit.void))), Effect.flatMap(exit => Effect.suspend(() => exit)));\n};\n/**\n * @internal\n */\nexport const readUpstream = (r, onSuccess, onFailure) => {\n const readStack = [r];\n const read = () => {\n const current = readStack.pop();\n if (current === undefined || current.upstream === undefined) {\n return Effect.dieMessage(\"Unexpected end of input for channel execution\");\n }\n const state = current.upstream.run();\n switch (state._tag) {\n case ChannelStateOpCodes.OP_EMIT:\n {\n const emitEffect = current.onEmit(current.upstream.getEmit());\n if (readStack.length === 0) {\n if (emitEffect === undefined) {\n return Effect.suspend(onSuccess);\n }\n return pipe(emitEffect, Effect.matchCauseEffect({\n onFailure,\n onSuccess\n }));\n }\n if (emitEffect === undefined) {\n return Effect.suspend(() => read());\n }\n return pipe(emitEffect, Effect.matchCauseEffect({\n onFailure,\n onSuccess: () => read()\n }));\n }\n case ChannelStateOpCodes.OP_DONE:\n {\n const doneEffect = current.onDone(current.upstream.getDone());\n if (readStack.length === 0) {\n if (doneEffect === undefined) {\n return Effect.suspend(onSuccess);\n }\n return pipe(doneEffect, Effect.matchCauseEffect({\n onFailure,\n onSuccess\n }));\n }\n if (doneEffect === undefined) {\n return Effect.suspend(() => read());\n }\n return pipe(doneEffect, Effect.matchCauseEffect({\n onFailure,\n onSuccess: () => read()\n }));\n }\n case ChannelStateOpCodes.OP_FROM_EFFECT:\n {\n readStack.push(current);\n return pipe(current.onEffect(state.effect), Effect.catchAllCause(cause => Effect.suspend(() => {\n const doneEffect = current.onDone(Exit.failCause(cause));\n return doneEffect === undefined ? Effect.void : doneEffect;\n })), Effect.matchCauseEffect({\n onFailure,\n onSuccess: () => read()\n }));\n }\n case ChannelStateOpCodes.OP_READ:\n {\n readStack.push(current);\n readStack.push(state);\n return Effect.suspend(() => read());\n }\n }\n };\n return read();\n};\n/** @internal */\nexport const runIn = /*#__PURE__*/dual(2, (self, scope) => {\n const run = (channelDeferred, scopeDeferred, scope) => Effect.acquireUseRelease(Effect.sync(() => new ChannelExecutor(self, void 0, identity)), exec => Effect.suspend(() => runScopedInterpret(exec.run(), exec).pipe(Effect.intoDeferred(channelDeferred), Effect.zipRight(Deferred.await(channelDeferred)), Effect.zipLeft(Deferred.await(scopeDeferred)))), (exec, exit) => {\n const finalize = exec.close(exit);\n if (finalize === undefined) {\n return Effect.void;\n }\n return Effect.tapErrorCause(finalize, cause => Scope.addFinalizer(scope, Effect.failCause(cause)));\n });\n return Effect.uninterruptibleMask(restore => Effect.all([Scope.fork(scope, ExecutionStrategy.sequential), Deferred.make(), Deferred.make()]).pipe(Effect.flatMap(([child, channelDeferred, scopeDeferred]) => restore(run(channelDeferred, scopeDeferred, child)).pipe(Effect.forkIn(scope), Effect.flatMap(fiber => scope.addFinalizer(exit => {\n const interruptors = Exit.isFailure(exit) ? Cause.interruptors(exit.cause) : undefined;\n return Deferred.isDone(channelDeferred).pipe(Effect.flatMap(isDone => isDone ? Deferred.succeed(scopeDeferred, void 0).pipe(Effect.zipRight(Fiber.await(fiber)), Effect.zipRight(Fiber.inheritAll(fiber))) : Deferred.succeed(scopeDeferred, void 0).pipe(Effect.zipRight(interruptors && HashSet.size(interruptors) > 0 ? Fiber.interruptAs(fiber, FiberId.combineAll(interruptors)) : Fiber.interrupt(fiber)), Effect.zipRight(Fiber.inheritAll(fiber)))));\n }).pipe(Effect.zipRight(restore(Deferred.await(channelDeferred)))))))));\n});\n/** @internal */\nconst runScopedInterpret = (channelState, exec) => {\n const op = channelState;\n switch (op._tag) {\n case ChannelStateOpCodes.OP_FROM_EFFECT:\n {\n return pipe(op.effect, Effect.flatMap(() => runScopedInterpret(exec.run(), exec)));\n }\n case ChannelStateOpCodes.OP_EMIT:\n {\n // Can't really happen because Out <:< Nothing. So just skip ahead.\n return runScopedInterpret(exec.run(), exec);\n }\n case ChannelStateOpCodes.OP_DONE:\n {\n return Effect.suspend(() => exec.getDone());\n }\n case ChannelStateOpCodes.OP_READ:\n {\n return readUpstream(op, () => runScopedInterpret(exec.run(), exec), Effect.failCause);\n }\n }\n};\n//# sourceMappingURL=channelExecutor.js.map","/** @internal */\nexport const OP_DONE = \"Done\";\n/** @internal */\nexport const OP_AWAIT = \"Await\";\n//# sourceMappingURL=channelMergeDecision.js.map","import { dual } from \"../../Function.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as OpCodes from \"../opCodes/channelMergeDecision.js\";\n/** @internal */\nconst MergeDecisionSymbolKey = \"effect/ChannelMergeDecision\";\n/** @internal */\nexport const MergeDecisionTypeId = /*#__PURE__*/Symbol.for(MergeDecisionSymbolKey);\n/** @internal */\nconst proto = {\n [MergeDecisionTypeId]: {\n _R: _ => _,\n _E0: _ => _,\n _Z0: _ => _,\n _E: _ => _,\n _Z: _ => _\n }\n};\n/** @internal */\nexport const Done = effect => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_DONE;\n op.effect = effect;\n return op;\n};\n/** @internal */\nexport const Await = f => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_AWAIT;\n op.f = f;\n return op;\n};\n/** @internal */\nexport const AwaitConst = effect => Await(() => effect);\n/** @internal */\nexport const isMergeDecision = u => hasProperty(u, MergeDecisionTypeId);\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onAwait,\n onDone\n}) => {\n const op = self;\n switch (op._tag) {\n case OpCodes.OP_DONE:\n return onDone(op.effect);\n case OpCodes.OP_AWAIT:\n return onAwait(op.f);\n }\n});\n//# sourceMappingURL=mergeDecision.js.map","/** @internal */\nexport const OP_BOTH_RUNNING = \"BothRunning\";\n/** @internal */\nexport const OP_LEFT_DONE = \"LeftDone\";\n/** @internal */\nexport const OP_RIGHT_DONE = \"RightDone\";\n//# sourceMappingURL=channelMergeState.js.map","import { dual } from \"../../Function.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as OpCodes from \"../opCodes/channelMergeState.js\";\n/** @internal */\nconst MergeStateSymbolKey = \"effect/ChannelMergeState\";\n/** @internal */\nexport const MergeStateTypeId = /*#__PURE__*/Symbol.for(MergeStateSymbolKey);\n/** @internal */\nconst proto = {\n [MergeStateTypeId]: MergeStateTypeId\n};\n/** @internal */\nexport const BothRunning = (left, right) => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_BOTH_RUNNING;\n op.left = left;\n op.right = right;\n return op;\n};\n/** @internal */\nexport const LeftDone = f => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_LEFT_DONE;\n op.f = f;\n return op;\n};\n/** @internal */\nexport const RightDone = f => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_RIGHT_DONE;\n op.f = f;\n return op;\n};\n/** @internal */\nexport const isMergeState = u => hasProperty(u, MergeStateTypeId);\n/** @internal */\nexport const isBothRunning = self => {\n return self._tag === OpCodes.OP_BOTH_RUNNING;\n};\n/** @internal */\nexport const isLeftDone = self => {\n return self._tag === OpCodes.OP_LEFT_DONE;\n};\n/** @internal */\nexport const isRightDone = self => {\n return self._tag === OpCodes.OP_RIGHT_DONE;\n};\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onBothRunning,\n onLeftDone,\n onRightDone\n}) => {\n switch (self._tag) {\n case OpCodes.OP_BOTH_RUNNING:\n {\n return onBothRunning(self.left, self.right);\n }\n case OpCodes.OP_LEFT_DONE:\n {\n return onLeftDone(self.f);\n }\n case OpCodes.OP_RIGHT_DONE:\n {\n return onRightDone(self.f);\n }\n }\n});\n//# sourceMappingURL=mergeState.js.map","/** @internal */\nexport const OP_BACK_PRESSURE = \"BackPressure\";\n/** @internal */\nexport const OP_BUFFER_SLIDING = \"BufferSliding\";\n//# sourceMappingURL=channelMergeStrategy.js.map","import { dual } from \"../../Function.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as OpCodes from \"../opCodes/channelMergeStrategy.js\";\n/** @internal */\nconst MergeStrategySymbolKey = \"effect/ChannelMergeStrategy\";\n/** @internal */\nexport const MergeStrategyTypeId = /*#__PURE__*/Symbol.for(MergeStrategySymbolKey);\n/** @internal */\nconst proto = {\n [MergeStrategyTypeId]: MergeStrategyTypeId\n};\n/** @internal */\nexport const BackPressure = _ => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_BACK_PRESSURE;\n return op;\n};\n/** @internal */\nexport const BufferSliding = _ => {\n const op = Object.create(proto);\n op._tag = OpCodes.OP_BUFFER_SLIDING;\n return op;\n};\n/** @internal */\nexport const isMergeStrategy = u => hasProperty(u, MergeStrategyTypeId);\n/** @internal */\nexport const isBackPressure = self => self._tag === OpCodes.OP_BACK_PRESSURE;\n/** @internal */\nexport const isBufferSliding = self => self._tag === OpCodes.OP_BUFFER_SLIDING;\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onBackPressure,\n onBufferSliding\n}) => {\n switch (self._tag) {\n case OpCodes.OP_BACK_PRESSURE:\n {\n return onBackPressure();\n }\n case OpCodes.OP_BUFFER_SLIDING:\n {\n return onBufferSliding();\n }\n }\n});\n//# sourceMappingURL=mergeStrategy.js.map","import * as Cause from \"../../Cause.js\";\nimport * as Deferred from \"../../Deferred.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Either from \"../../Either.js\";\nimport * as Exit from \"../../Exit.js\";\nimport { pipe } from \"../../Function.js\";\nimport * as Ref from \"../../Ref.js\";\n/** @internal */\nconst OP_STATE_EMPTY = \"Empty\";\n/** @internal */\nconst OP_STATE_EMIT = \"Emit\";\n/** @internal */\nconst OP_STATE_ERROR = \"Error\";\n/** @internal */\nconst OP_STATE_DONE = \"Done\";\n/** @internal */\nconst stateEmpty = notifyProducer => ({\n _tag: OP_STATE_EMPTY,\n notifyProducer\n});\n/** @internal */\nconst stateEmit = notifyConsumers => ({\n _tag: OP_STATE_EMIT,\n notifyConsumers\n});\n/** @internal */\nconst stateError = cause => ({\n _tag: OP_STATE_ERROR,\n cause\n});\n/** @internal */\nconst stateDone = done => ({\n _tag: OP_STATE_DONE,\n done\n});\n/** @internal */\nclass SingleProducerAsyncInputImpl {\n ref;\n constructor(ref) {\n this.ref = ref;\n }\n awaitRead() {\n return Effect.flatten(Ref.modify(this.ref, state => state._tag === OP_STATE_EMPTY ? [Deferred.await(state.notifyProducer), state] : [Effect.void, state]));\n }\n get close() {\n return Effect.fiberIdWith(fiberId => this.error(Cause.interrupt(fiberId)));\n }\n done(value) {\n return Effect.flatten(Ref.modify(this.ref, state => {\n switch (state._tag) {\n case OP_STATE_EMPTY:\n {\n return [Deferred.await(state.notifyProducer), state];\n }\n case OP_STATE_EMIT:\n {\n return [Effect.forEach(state.notifyConsumers, deferred => Deferred.succeed(deferred, Either.left(value)), {\n discard: true\n }), stateDone(value)];\n }\n case OP_STATE_ERROR:\n {\n return [Effect.interrupt, state];\n }\n case OP_STATE_DONE:\n {\n return [Effect.interrupt, state];\n }\n }\n }));\n }\n emit(element) {\n return Effect.flatMap(Deferred.make(), deferred => Effect.flatten(Ref.modify(this.ref, state => {\n switch (state._tag) {\n case OP_STATE_EMPTY:\n {\n return [Deferred.await(state.notifyProducer), state];\n }\n case OP_STATE_EMIT:\n {\n const notifyConsumer = state.notifyConsumers[0];\n const notifyConsumers = state.notifyConsumers.slice(1);\n if (notifyConsumer !== undefined) {\n return [Deferred.succeed(notifyConsumer, Either.right(element)), notifyConsumers.length === 0 ? stateEmpty(deferred) : stateEmit(notifyConsumers)];\n }\n throw new Error(\"Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues\");\n }\n case OP_STATE_ERROR:\n {\n return [Effect.interrupt, state];\n }\n case OP_STATE_DONE:\n {\n return [Effect.interrupt, state];\n }\n }\n })));\n }\n error(cause) {\n return Effect.flatten(Ref.modify(this.ref, state => {\n switch (state._tag) {\n case OP_STATE_EMPTY:\n {\n return [Deferred.await(state.notifyProducer), state];\n }\n case OP_STATE_EMIT:\n {\n return [Effect.forEach(state.notifyConsumers, deferred => Deferred.failCause(deferred, cause), {\n discard: true\n }), stateError(cause)];\n }\n case OP_STATE_ERROR:\n {\n return [Effect.interrupt, state];\n }\n case OP_STATE_DONE:\n {\n return [Effect.interrupt, state];\n }\n }\n }));\n }\n get take() {\n return this.takeWith(cause => Exit.failCause(Cause.map(cause, Either.left)), elem => Exit.succeed(elem), done => Exit.fail(Either.right(done)));\n }\n takeWith(onError, onElement, onDone) {\n return Effect.flatMap(Deferred.make(), deferred => Effect.flatten(Ref.modify(this.ref, state => {\n switch (state._tag) {\n case OP_STATE_EMPTY:\n {\n return [Effect.zipRight(Deferred.succeed(state.notifyProducer, void 0), Effect.matchCause(Deferred.await(deferred), {\n onFailure: onError,\n onSuccess: Either.match({\n onLeft: onDone,\n onRight: onElement\n })\n })), stateEmit([deferred])];\n }\n case OP_STATE_EMIT:\n {\n return [Effect.matchCause(Deferred.await(deferred), {\n onFailure: onError,\n onSuccess: Either.match({\n onLeft: onDone,\n onRight: onElement\n })\n }), stateEmit([...state.notifyConsumers, deferred])];\n }\n case OP_STATE_ERROR:\n {\n return [Effect.succeed(onError(state.cause)), state];\n }\n case OP_STATE_DONE:\n {\n return [Effect.succeed(onDone(state.done)), state];\n }\n }\n })));\n }\n}\n/** @internal */\nexport const make = () => pipe(Deferred.make(), Effect.flatMap(deferred => Ref.make(stateEmpty(deferred))), Effect.map(ref => new SingleProducerAsyncInputImpl(ref)));\n//# sourceMappingURL=singleProducerAsyncInput.js.map","import * as Cause from \"../Cause.js\";\nimport * as Chunk from \"../Chunk.js\";\nimport * as Context from \"../Context.js\";\nimport * as Deferred from \"../Deferred.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Either from \"../Either.js\";\nimport * as Equal from \"../Equal.js\";\nimport * as Exit from \"../Exit.js\";\nimport * as Fiber from \"../Fiber.js\";\nimport * as FiberRef from \"../FiberRef.js\";\nimport { constVoid, dual, identity, pipe } from \"../Function.js\";\nimport * as Layer from \"../Layer.js\";\nimport * as Option from \"../Option.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as PubSub from \"../PubSub.js\";\nimport * as Queue from \"../Queue.js\";\nimport * as Ref from \"../Ref.js\";\nimport * as Scope from \"../Scope.js\";\nimport * as executor from \"./channel/channelExecutor.js\";\nimport * as mergeDecision from \"./channel/mergeDecision.js\";\nimport * as mergeState from \"./channel/mergeState.js\";\nimport * as mergeStrategy_ from \"./channel/mergeStrategy.js\";\nimport * as singleProducerAsyncInput from \"./channel/singleProducerAsyncInput.js\";\nimport * as coreEffect from \"./core-effect.js\";\nimport * as core from \"./core-stream.js\";\nimport * as MergeDecisionOpCodes from \"./opCodes/channelMergeDecision.js\";\nimport * as MergeStateOpCodes from \"./opCodes/channelMergeState.js\";\nimport * as ChannelStateOpCodes from \"./opCodes/channelState.js\";\nimport * as tracer from \"./tracer.js\";\n/** @internal */\nexport const acquireUseRelease = (acquire, use, release) => core.flatMap(core.fromEffect(Ref.make(() => Effect.void)), ref => pipe(core.fromEffect(Effect.uninterruptible(Effect.tap(acquire, a => Ref.set(ref, exit => release(a, exit))))), core.flatMap(use), core.ensuringWith(exit => Effect.flatMap(Ref.get(ref), f => f(exit)))));\n/** @internal */\nexport const as = /*#__PURE__*/dual(2, (self, value) => map(self, () => value));\n/** @internal */\nexport const asVoid = self => map(self, constVoid);\n/** @internal */\nexport const buffer = options => core.suspend(() => {\n const doBuffer = (empty, isEmpty, ref) => unwrap(Ref.modify(ref, inElem => isEmpty(inElem) ? [core.readWith({\n onInput: input => core.flatMap(core.write(input), () => doBuffer(empty, isEmpty, ref)),\n onFailure: error => core.fail(error),\n onDone: done => core.succeedNow(done)\n }), inElem] : [core.flatMap(core.write(inElem), () => doBuffer(empty, isEmpty, ref)), empty]));\n return doBuffer(options.empty, options.isEmpty, options.ref);\n});\n/** @internal */\nexport const bufferChunk = ref => buffer({\n empty: Chunk.empty(),\n isEmpty: Chunk.isEmpty,\n ref\n});\n/** @internal */\nexport const catchAll = /*#__PURE__*/dual(2, (self, f) => core.catchAllCause(self, cause => Either.match(Cause.failureOrCause(cause), {\n onLeft: f,\n onRight: core.failCause\n})));\n/** @internal */\nexport const concatMap = /*#__PURE__*/dual(2, (self, f) => core.concatMapWith(self, f, () => void 0, () => void 0));\n/** @internal */\nexport const collect = /*#__PURE__*/dual(2, (self, pf) => {\n const collector = core.readWith({\n onInput: out => Option.match(pf(out), {\n onNone: () => collector,\n onSome: out2 => core.flatMap(core.write(out2), () => collector)\n }),\n onFailure: core.fail,\n onDone: core.succeedNow\n });\n return core.pipeTo(self, collector);\n});\n/** @internal */\nexport const concatOut = self => core.concatAll(self);\n/** @internal */\nexport const mapInput = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWith({\n onInput: inElem => core.flatMap(core.write(inElem), () => reader),\n onFailure: core.fail,\n onDone: done => core.succeedNow(f(done))\n });\n return core.pipeTo(reader, self);\n});\n/** @internal */\nexport const mapInputEffect = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWith({\n onInput: inElem => core.flatMap(core.write(inElem), () => reader),\n onFailure: core.fail,\n onDone: done => core.fromEffect(f(done))\n });\n return core.pipeTo(reader, self);\n});\n/** @internal */\nexport const mapInputError = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWith({\n onInput: inElem => core.flatMap(core.write(inElem), () => reader),\n onFailure: error => core.fail(f(error)),\n onDone: core.succeedNow\n });\n return core.pipeTo(reader, self);\n});\n/** @internal */\nexport const mapInputErrorEffect = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWith({\n onInput: inElem => core.flatMap(core.write(inElem), () => reader),\n onFailure: error => core.fromEffect(f(error)),\n onDone: core.succeedNow\n });\n return core.pipeTo(reader, self);\n});\n/** @internal */\nexport const mapInputIn = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWith({\n onInput: inElem => core.flatMap(core.write(f(inElem)), () => reader),\n onFailure: core.fail,\n onDone: core.succeedNow\n });\n return core.pipeTo(reader, self);\n});\n/** @internal */\nexport const mapInputInEffect = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWith({\n onInput: inElem => core.flatMap(core.flatMap(core.fromEffect(f(inElem)), core.write), () => reader),\n onFailure: core.fail,\n onDone: core.succeedNow\n });\n return core.pipeTo(reader, self);\n});\n/** @internal */\nexport const doneCollect = self => core.suspend(() => {\n const builder = [];\n return pipe(core.pipeTo(self, doneCollectReader(builder)), core.flatMap(outDone => core.succeed([Chunk.unsafeFromArray(builder), outDone])));\n});\n/** @internal */\nconst doneCollectReader = builder => {\n return core.readWith({\n onInput: outElem => core.flatMap(core.sync(() => {\n builder.push(outElem);\n }), () => doneCollectReader(builder)),\n onFailure: core.fail,\n onDone: core.succeed\n });\n};\n/** @internal */\nexport const drain = self => {\n const drainer = core.readWithCause({\n onInput: () => drainer,\n onFailure: core.failCause,\n onDone: core.succeed\n });\n return core.pipeTo(self, drainer);\n};\n/** @internal */\nexport const emitCollect = self => core.flatMap(doneCollect(self), core.write);\n/** @internal */\nexport const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => core.ensuringWith(self, () => finalizer));\n/** @internal */\nexport const context = () => core.fromEffect(Effect.context());\n/** @internal */\nexport const contextWith = f => map(context(), f);\n/** @internal */\nexport const contextWithChannel = f => core.flatMap(context(), f);\n/** @internal */\nexport const contextWithEffect = f => mapEffect(context(), f);\n/** @internal */\nexport const flatten = self => core.flatMap(self, identity);\n/** @internal */\nexport const foldChannel = /*#__PURE__*/dual(2, (self, options) => core.foldCauseChannel(self, {\n onFailure: cause => {\n const either = Cause.failureOrCause(cause);\n switch (either._tag) {\n case \"Left\":\n {\n return options.onFailure(either.left);\n }\n case \"Right\":\n {\n return core.failCause(either.right);\n }\n }\n },\n onSuccess: options.onSuccess\n}));\n/** @internal */\nexport const fromEither = either => core.suspend(() => Either.match(either, {\n onLeft: core.fail,\n onRight: core.succeed\n}));\n/** @internal */\nexport const fromInput = input => unwrap(input.takeWith(core.failCause, elem => core.flatMap(core.write(elem), () => fromInput(input)), core.succeed));\n/** @internal */\nexport const fromPubSub = pubsub => unwrapScoped(Effect.map(PubSub.subscribe(pubsub), fromQueue));\n/** @internal */\nexport const fromPubSubScoped = pubsub => Effect.map(PubSub.subscribe(pubsub), fromQueue);\n/** @internal */\nexport const fromOption = option => core.suspend(() => Option.match(option, {\n onNone: () => core.fail(Option.none()),\n onSome: core.succeed\n}));\n/** @internal */\nexport const fromQueue = queue => core.suspend(() => fromQueueInternal(queue));\n/** @internal */\nconst fromQueueInternal = queue => pipe(core.fromEffect(Queue.take(queue)), core.flatMap(Either.match({\n onLeft: Exit.match({\n onFailure: core.failCause,\n onSuccess: core.succeedNow\n }),\n onRight: elem => core.flatMap(core.write(elem), () => fromQueueInternal(queue))\n})));\n/** @internal */\nexport const identityChannel = () => core.readWith({\n onInput: input => core.flatMap(core.write(input), () => identityChannel()),\n onFailure: core.fail,\n onDone: core.succeedNow\n});\n/** @internal */\nexport const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => mergeWith(self, {\n other: core.fromEffect(effect),\n onSelfDone: selfDone => mergeDecision.Done(Effect.suspend(() => selfDone)),\n onOtherDone: effectDone => mergeDecision.Done(Effect.suspend(() => effectDone))\n}));\n/** @internal */\nexport const interruptWhenDeferred = /*#__PURE__*/dual(2, (self, deferred) => interruptWhen(self, Deferred.await(deferred)));\n/** @internal */\nexport const map = /*#__PURE__*/dual(2, (self, f) => core.flatMap(self, a => core.sync(() => f(a))));\n/** @internal */\nexport const mapEffect = /*#__PURE__*/dual(2, (self, f) => core.flatMap(self, z => core.fromEffect(f(z))));\n/** @internal */\nexport const mapError = /*#__PURE__*/dual(2, (self, f) => mapErrorCause(self, Cause.map(f)));\n/** @internal */\nexport const mapErrorCause = /*#__PURE__*/dual(2, (self, f) => core.catchAllCause(self, cause => core.failCause(f(cause))));\n/** @internal */\nexport const mapOut = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWith({\n onInput: outElem => core.flatMap(core.write(f(outElem)), () => reader),\n onFailure: core.fail,\n onDone: core.succeedNow\n });\n return core.pipeTo(self, reader);\n});\n/** @internal */\nexport const mapOutEffect = /*#__PURE__*/dual(2, (self, f) => {\n const reader = core.readWithCause({\n onInput: outElem => pipe(core.fromEffect(f(outElem)), core.flatMap(core.write), core.flatMap(() => reader)),\n onFailure: core.failCause,\n onDone: core.succeedNow\n });\n return core.pipeTo(self, reader);\n});\n/** @internal */\nexport const mapOutEffectPar = /*#__PURE__*/dual(3, (self, f, n) => unwrapScopedWith(scope => Effect.gen(function* () {\n const input = yield* singleProducerAsyncInput.make();\n const queueReader = fromInput(input);\n const queue = yield* Queue.bounded(n);\n yield* Scope.addFinalizer(scope, Queue.shutdown(queue));\n const errorSignal = yield* Deferred.make();\n const withPermits = n === Number.POSITIVE_INFINITY ? _ => identity : (yield* Effect.makeSemaphore(n)).withPermits;\n const pull = yield* queueReader.pipe(core.pipeTo(self), toPullIn(scope));\n yield* pull.pipe(Effect.matchCauseEffect({\n onFailure: cause => Queue.offer(queue, Effect.failCause(cause)),\n onSuccess: Either.match({\n onLeft: outDone => Effect.zipRight(Effect.interruptible(withPermits(n)(Effect.void)), Effect.asVoid(Queue.offer(queue, Effect.succeed(Either.left(outDone))))),\n onRight: outElem => Effect.gen(function* () {\n const deferred = yield* Deferred.make();\n const latch = yield* Deferred.make();\n yield* Queue.offer(queue, Effect.map(Deferred.await(deferred), Either.right));\n yield* Deferred.succeed(latch, void 0).pipe(Effect.zipRight(Effect.uninterruptibleMask(restore => Effect.exit(restore(Deferred.await(errorSignal))).pipe(Effect.raceFirst(Effect.exit(restore(f(outElem)))), Effect.flatMap(identity))).pipe(Effect.tapErrorCause(cause => Deferred.failCause(errorSignal, cause)), Effect.intoDeferred(deferred))), withPermits(1), Effect.forkIn(scope));\n yield* Deferred.await(latch);\n })\n })\n }), Effect.forever, Effect.interruptible, Effect.forkIn(scope));\n const consumer = unwrap(Effect.matchCause(Effect.flatten(Queue.take(queue)), {\n onFailure: core.failCause,\n onSuccess: Either.match({\n onLeft: core.succeedNow,\n onRight: outElem => core.flatMap(core.write(outElem), () => consumer)\n })\n }));\n return core.embedInput(consumer, input);\n})));\n/** @internal */\nexport const mergeAll = options => {\n return channels => mergeAllWith(options)(channels, constVoid);\n};\n/** @internal */\nexport const mergeAllUnbounded = channels => mergeAllWith({\n concurrency: \"unbounded\"\n})(channels, constVoid);\n/** @internal */\nexport const mergeAllUnboundedWith = (channels, f) => mergeAllWith({\n concurrency: \"unbounded\"\n})(channels, f);\n/** @internal */\nexport const mergeAllWith = ({\n bufferSize = 16,\n concurrency,\n mergeStrategy = mergeStrategy_.BackPressure()\n}) => (channels, f) => unwrapScopedWith(scope => Effect.gen(function* () {\n const concurrencyN = concurrency === \"unbounded\" ? Number.MAX_SAFE_INTEGER : concurrency;\n const input = yield* singleProducerAsyncInput.make();\n const queueReader = fromInput(input);\n const queue = yield* Queue.bounded(bufferSize);\n yield* Scope.addFinalizer(scope, Queue.shutdown(queue));\n const cancelers = yield* Queue.unbounded();\n yield* Scope.addFinalizer(scope, Queue.shutdown(cancelers));\n const lastDone = yield* Ref.make(Option.none());\n const errorSignal = yield* Deferred.make();\n const withPermits = (yield* Effect.makeSemaphore(concurrencyN)).withPermits;\n const pull = yield* toPullIn(core.pipeTo(queueReader, channels), scope);\n function evaluatePull(pull) {\n return pull.pipe(Effect.flatMap(Either.match({\n onLeft: done => Effect.succeed(Option.some(done)),\n onRight: outElem => Effect.as(Queue.offer(queue, Effect.succeed(Either.right(outElem))), Option.none())\n })), Effect.repeat({\n until: _ => Option.isSome(_)\n }), Effect.flatMap(outDone => Ref.update(lastDone, Option.match({\n onNone: () => Option.some(outDone.value),\n onSome: lastDone => Option.some(f(lastDone, outDone.value))\n }))), Effect.catchAllCause(cause => Cause.isInterrupted(cause) ? Effect.failCause(cause) : Queue.offer(queue, Effect.failCause(cause)).pipe(Effect.zipRight(Deferred.succeed(errorSignal, void 0)), Effect.asVoid)));\n }\n yield* pull.pipe(Effect.matchCauseEffect({\n onFailure: cause => Queue.offer(queue, Effect.failCause(cause)).pipe(Effect.zipRight(Effect.succeed(false))),\n onSuccess: Either.match({\n onLeft: outDone => Effect.raceWith(Effect.interruptible(Deferred.await(errorSignal)), Effect.interruptible(withPermits(concurrencyN)(Effect.void)), {\n onSelfDone: (_, permitAcquisition) => Effect.as(Fiber.interrupt(permitAcquisition), false),\n onOtherDone: (_, failureAwait) => Effect.zipRight(Fiber.interrupt(failureAwait), Ref.get(lastDone).pipe(Effect.flatMap(Option.match({\n onNone: () => Queue.offer(queue, Effect.succeed(Either.left(outDone))),\n onSome: lastDone => Queue.offer(queue, Effect.succeed(Either.left(f(lastDone, outDone))))\n })), Effect.as(false)))\n }),\n onRight: channel => mergeStrategy_.match(mergeStrategy, {\n onBackPressure: () => Effect.gen(function* () {\n const latch = yield* Deferred.make();\n const raceEffects = Effect.scopedWith(scope => toPullIn(core.pipeTo(queueReader, channel), scope).pipe(Effect.flatMap(pull => Effect.race(Effect.exit(evaluatePull(pull)), Effect.exit(Effect.interruptible(Deferred.await(errorSignal))))), Effect.flatMap(identity)));\n yield* Deferred.succeed(latch, void 0).pipe(Effect.zipRight(raceEffects), withPermits(1), Effect.forkIn(scope));\n yield* Deferred.await(latch);\n const errored = yield* Deferred.isDone(errorSignal);\n return !errored;\n }),\n onBufferSliding: () => Effect.gen(function* () {\n const canceler = yield* Deferred.make();\n const latch = yield* Deferred.make();\n const size = yield* Queue.size(cancelers);\n yield* Queue.take(cancelers).pipe(Effect.flatMap(canceler => Deferred.succeed(canceler, void 0)), Effect.when(() => size >= concurrencyN));\n yield* Queue.offer(cancelers, canceler);\n const raceEffects = Effect.scopedWith(scope => toPullIn(core.pipeTo(queueReader, channel), scope).pipe(Effect.flatMap(pull => Effect.exit(evaluatePull(pull)).pipe(Effect.race(Effect.exit(Effect.interruptible(Deferred.await(errorSignal)))), Effect.race(Effect.exit(Effect.interruptible(Deferred.await(canceler)))))), Effect.flatMap(identity)));\n yield* Deferred.succeed(latch, void 0).pipe(Effect.zipRight(raceEffects), withPermits(1), Effect.forkIn(scope));\n yield* Deferred.await(latch);\n const errored = yield* Deferred.isDone(errorSignal);\n return !errored;\n })\n })\n })\n }), Effect.repeat({\n while: _ => _\n }), Effect.forkIn(scope));\n const consumer = pipe(Queue.take(queue), Effect.flatten, Effect.matchCause({\n onFailure: core.failCause,\n onSuccess: Either.match({\n onLeft: core.succeedNow,\n onRight: outElem => core.flatMap(core.write(outElem), () => consumer)\n })\n }), unwrap);\n return core.embedInput(consumer, input);\n}));\n/** @internal */\nexport const mergeMap = /*#__PURE__*/dual(3, (self, f, options) => mergeAll(options)(mapOut(self, f)));\n/** @internal */\nexport const mergeOut = /*#__PURE__*/dual(2, (self, n) => mergeAll({\n concurrency: n\n})(mapOut(self, identity)));\n/** @internal */\nexport const mergeOutWith = /*#__PURE__*/dual(3, (self, n, f) => mergeAllWith({\n concurrency: n\n})(mapOut(self, identity), f));\n/** @internal */\nexport const mergeWith = /*#__PURE__*/dual(2, (self, options) => {\n function merge(scope) {\n return Effect.gen(function* () {\n const input = yield* singleProducerAsyncInput.make();\n const queueReader = fromInput(input);\n const pullL = yield* toPullIn(core.pipeTo(queueReader, self), scope);\n const pullR = yield* toPullIn(core.pipeTo(queueReader, options.other), scope);\n function handleSide(exit, fiber, pull) {\n return (done, both, single) => {\n function onDecision(decision) {\n const op = decision;\n if (op._tag === MergeDecisionOpCodes.OP_DONE) {\n return Effect.succeed(core.fromEffect(Effect.zipRight(Fiber.interrupt(fiber), op.effect)));\n }\n return Effect.map(Fiber.await(fiber), Exit.match({\n onFailure: cause => core.fromEffect(op.f(Exit.failCause(cause))),\n onSuccess: Either.match({\n onLeft: done => core.fromEffect(op.f(Exit.succeed(done))),\n onRight: elem => zipRight(core.write(elem), go(single(op.f)))\n })\n }));\n }\n return Exit.match(exit, {\n onFailure: cause => onDecision(done(Exit.failCause(cause))),\n onSuccess: Either.match({\n onLeft: z => onDecision(done(Exit.succeed(z))),\n onRight: elem => Effect.succeed(core.flatMap(core.write(elem), () => core.flatMap(core.fromEffect(Effect.forkIn(Effect.interruptible(pull), scope)), leftFiber => go(both(leftFiber, fiber)))))\n })\n });\n };\n }\n function go(state) {\n switch (state._tag) {\n case MergeStateOpCodes.OP_BOTH_RUNNING:\n {\n const leftJoin = Effect.interruptible(Fiber.join(state.left));\n const rightJoin = Effect.interruptible(Fiber.join(state.right));\n return unwrap(Effect.raceWith(leftJoin, rightJoin, {\n onSelfDone: (leftExit, rf) => Effect.zipRight(Fiber.interrupt(rf), handleSide(leftExit, state.right, pullL)(options.onSelfDone, mergeState.BothRunning, f => mergeState.LeftDone(f))),\n onOtherDone: (rightExit, lf) => Effect.zipRight(Fiber.interrupt(lf), handleSide(rightExit, state.left, pullR)(options.onOtherDone, (left, right) => mergeState.BothRunning(right, left), f => mergeState.RightDone(f)))\n }));\n }\n case MergeStateOpCodes.OP_LEFT_DONE:\n {\n return unwrap(Effect.map(Effect.exit(pullR), Exit.match({\n onFailure: cause => core.fromEffect(state.f(Exit.failCause(cause))),\n onSuccess: Either.match({\n onLeft: done => core.fromEffect(state.f(Exit.succeed(done))),\n onRight: elem => core.flatMap(core.write(elem), () => go(mergeState.LeftDone(state.f)))\n })\n })));\n }\n case MergeStateOpCodes.OP_RIGHT_DONE:\n {\n return unwrap(Effect.map(Effect.exit(pullL), Exit.match({\n onFailure: cause => core.fromEffect(state.f(Exit.failCause(cause))),\n onSuccess: Either.match({\n onLeft: done => core.fromEffect(state.f(Exit.succeed(done))),\n onRight: elem => core.flatMap(core.write(elem), () => go(mergeState.RightDone(state.f)))\n })\n })));\n }\n }\n }\n return core.fromEffect(Effect.withFiberRuntime(parent => {\n const inherit = Effect.withFiberRuntime(state => {\n ;\n state.transferChildren(parent.scope());\n return Effect.void;\n });\n const leftFiber = Effect.interruptible(pullL).pipe(Effect.ensuring(inherit), Effect.forkIn(scope));\n const rightFiber = Effect.interruptible(pullR).pipe(Effect.ensuring(inherit), Effect.forkIn(scope));\n return Effect.zipWith(leftFiber, rightFiber, (left, right) => mergeState.BothRunning(left, right));\n })).pipe(core.flatMap(go), core.embedInput(input));\n });\n }\n return unwrapScopedWith(merge);\n});\n/** @internal */\nexport const never = /*#__PURE__*/core.fromEffect(Effect.never);\n/** @internal */\nexport const orDie = /*#__PURE__*/dual(2, (self, error) => orDieWith(self, error));\n/** @internal */\nexport const orDieWith = /*#__PURE__*/dual(2, (self, f) => catchAll(self, e => core.failCauseSync(() => Cause.die(f(e)))));\n/** @internal */\nexport const orElse = /*#__PURE__*/dual(2, (self, that) => catchAll(self, that));\n/** @internal */\nexport const pipeToOrFail = /*#__PURE__*/dual(2, (self, that) => core.suspend(() => {\n let channelException = undefined;\n const reader = core.readWith({\n onInput: outElem => core.flatMap(core.write(outElem), () => reader),\n onFailure: outErr => {\n channelException = ChannelException(outErr);\n return core.failCause(Cause.die(channelException));\n },\n onDone: core.succeedNow\n });\n const writer = core.readWithCause({\n onInput: outElem => pipe(core.write(outElem), core.flatMap(() => writer)),\n onFailure: cause => Cause.isDieType(cause) && isChannelException(cause.defect) && Equal.equals(cause.defect, channelException) ? core.fail(cause.defect.error) : core.failCause(cause),\n onDone: core.succeedNow\n });\n return core.pipeTo(core.pipeTo(core.pipeTo(self, reader), that), writer);\n}));\n/** @internal */\nexport const provideService = /*#__PURE__*/dual(3, (self, tag, service) => {\n return core.flatMap(context(), context => core.provideContext(self, Context.add(context, tag, service)));\n});\n/** @internal */\nexport const provideLayer = /*#__PURE__*/dual(2, (self, layer) => unwrapScopedWith(scope => Effect.map(Layer.buildWithScope(layer, scope), context => core.provideContext(self, context))));\n/** @internal */\nexport const mapInputContext = /*#__PURE__*/dual(2, (self, f) => contextWithChannel(context => core.provideContext(self, f(context))));\n/** @internal */\nexport const provideSomeLayer = /*#__PURE__*/dual(2, (self, layer) =>\n// @ts-expect-error\nprovideLayer(self, Layer.merge(Layer.context(), layer)));\n/** @internal */\nexport const read = () => core.readOrFail(Option.none());\n/** @internal */\nexport const repeated = self => core.flatMap(self, () => repeated(self));\n/** @internal */\nexport const run = self => Effect.scopedWith(scope => executor.runIn(self, scope));\n/** @internal */\nexport const runCollect = self => run(core.collectElements(self));\n/** @internal */\nexport const runDrain = self => run(drain(self));\n/** @internal */\nexport const runScoped = self => Effect.scopeWith(scope => executor.runIn(self, scope));\n/** @internal */\nexport const scoped = effect => unwrap(Effect.uninterruptibleMask(restore => Effect.map(Scope.make(), scope => core.acquireReleaseOut(Effect.tapErrorCause(restore(Scope.extend(effect, scope)), cause => Scope.close(scope, Exit.failCause(cause))), (_, exit) => Scope.close(scope, exit)))));\n/** @internal */\nexport const scopedWith = f => unwrapScoped(Effect.map(Effect.scope, scope => core.flatMap(core.fromEffect(f(scope)), core.write)));\n/** @internal */\nexport const service = tag => core.fromEffect(tag);\n/** @internal */\nexport const serviceWith = tag => f => map(service(tag), f);\n/** @internal */\nexport const serviceWithChannel = tag => f => core.flatMap(service(tag), f);\n/** @internal */\nexport const serviceWithEffect = tag => f => mapEffect(service(tag), f);\n/** @internal */\nexport const splitLines = () => core.suspend(() => {\n let stringBuilder = \"\";\n let midCRLF = false;\n const splitLinesChunk = chunk => {\n const chunkBuilder = [];\n Chunk.map(chunk, str => {\n if (str.length !== 0) {\n let from = 0;\n let indexOfCR = str.indexOf(\"\\r\");\n let indexOfLF = str.indexOf(\"\\n\");\n if (midCRLF) {\n if (indexOfLF === 0) {\n chunkBuilder.push(stringBuilder);\n stringBuilder = \"\";\n from = 1;\n indexOfLF = str.indexOf(\"\\n\", from);\n } else {\n stringBuilder = stringBuilder + \"\\r\";\n }\n midCRLF = false;\n }\n while (indexOfCR !== -1 || indexOfLF !== -1) {\n if (indexOfCR === -1 || indexOfLF !== -1 && indexOfLF < indexOfCR) {\n if (stringBuilder.length === 0) {\n chunkBuilder.push(str.substring(from, indexOfLF));\n } else {\n chunkBuilder.push(stringBuilder + str.substring(from, indexOfLF));\n stringBuilder = \"\";\n }\n from = indexOfLF + 1;\n indexOfLF = str.indexOf(\"\\n\", from);\n } else {\n if (str.length === indexOfCR + 1) {\n midCRLF = true;\n indexOfCR = -1;\n } else {\n if (indexOfLF === indexOfCR + 1) {\n if (stringBuilder.length === 0) {\n chunkBuilder.push(str.substring(from, indexOfCR));\n } else {\n stringBuilder = stringBuilder + str.substring(from, indexOfCR);\n chunkBuilder.push(stringBuilder);\n stringBuilder = \"\";\n }\n from = indexOfCR + 2;\n indexOfCR = str.indexOf(\"\\r\", from);\n indexOfLF = str.indexOf(\"\\n\", from);\n } else {\n indexOfCR = str.indexOf(\"\\r\", indexOfCR + 1);\n }\n }\n }\n }\n if (midCRLF) {\n stringBuilder = stringBuilder + str.substring(from, str.length - 1);\n } else {\n stringBuilder = stringBuilder + str.substring(from, str.length);\n }\n }\n });\n return Chunk.unsafeFromArray(chunkBuilder);\n };\n const loop = core.readWithCause({\n onInput: input => {\n const out = splitLinesChunk(input);\n return Chunk.isEmpty(out) ? loop : core.flatMap(core.write(out), () => loop);\n },\n onFailure: cause => stringBuilder.length === 0 ? core.failCause(cause) : core.flatMap(core.write(Chunk.of(stringBuilder)), () => core.failCause(cause)),\n onDone: done => stringBuilder.length === 0 ? core.succeed(done) : core.flatMap(core.write(Chunk.of(stringBuilder)), () => core.succeed(done))\n });\n return loop;\n});\n/** @internal */\nexport const toPubSub = pubsub => toQueue(pubsub);\n/** @internal */\nexport const toPull = self => Effect.flatMap(Effect.scope, scope => toPullIn(self, scope));\n/** @internal */\nexport const toPullIn = /*#__PURE__*/dual(2, (self, scope) => Effect.zip(Effect.sync(() => new executor.ChannelExecutor(self, void 0, identity)), Effect.runtime()).pipe(Effect.tap(([executor, runtime]) => Scope.addFinalizerExit(scope, exit => {\n const finalizer = executor.close(exit);\n return finalizer !== undefined ? Effect.provide(finalizer, runtime) : Effect.void;\n})), Effect.uninterruptible, Effect.map(([executor]) => Effect.suspend(() => interpretToPull(executor.run(), executor)))));\n/** @internal */\nconst interpretToPull = (channelState, exec) => {\n const state = channelState;\n switch (state._tag) {\n case ChannelStateOpCodes.OP_DONE:\n {\n return Exit.match(exec.getDone(), {\n onFailure: Effect.failCause,\n onSuccess: done => Effect.succeed(Either.left(done))\n });\n }\n case ChannelStateOpCodes.OP_EMIT:\n {\n return Effect.succeed(Either.right(exec.getEmit()));\n }\n case ChannelStateOpCodes.OP_FROM_EFFECT:\n {\n return pipe(state.effect, Effect.flatMap(() => interpretToPull(exec.run(), exec)));\n }\n case ChannelStateOpCodes.OP_READ:\n {\n return executor.readUpstream(state, () => interpretToPull(exec.run(), exec), cause => Effect.failCause(cause));\n }\n }\n};\n/** @internal */\nexport const toQueue = queue => core.suspend(() => toQueueInternal(queue));\n/** @internal */\nconst toQueueInternal = queue => {\n return core.readWithCause({\n onInput: elem => core.flatMap(core.fromEffect(Queue.offer(queue, Either.right(elem))), () => toQueueInternal(queue)),\n onFailure: cause => core.fromEffect(Queue.offer(queue, Either.left(Exit.failCause(cause)))),\n onDone: done => core.fromEffect(Queue.offer(queue, Either.left(Exit.succeed(done))))\n });\n};\n/** @internal */\nexport const unwrap = channel => flatten(core.fromEffect(channel));\n/** @internal */\nexport const unwrapScoped = self => core.concatAllWith(scoped(self), (d, _) => d, (d, _) => d);\n/** @internal */\nexport const unwrapScopedWith = f => core.concatAllWith(scopedWith(f), (d, _) => d, (d, _) => d);\n/** @internal */\nexport const updateService = /*#__PURE__*/dual(3, (self, tag, f) => mapInputContext(self, context => Context.merge(context, Context.make(tag, f(Context.unsafeGet(context, tag))))));\n/** @internal */\nexport const withSpan = function () {\n const dataFirst = typeof arguments[0] !== \"string\";\n const name = dataFirst ? arguments[1] : arguments[0];\n const options = tracer.addSpanStackTrace(dataFirst ? arguments[2] : arguments[1]);\n const acquire = Effect.all([Effect.makeSpan(name, options), Effect.context(), Effect.clock, FiberRef.get(FiberRef.currentTracerTimingEnabled)]);\n if (dataFirst) {\n const self = arguments[0];\n return acquireUseRelease(acquire, ([span, context]) => core.provideContext(self, Context.add(context, tracer.spanTag, span)), ([span,, clock, timingEnabled], exit) => coreEffect.endSpan(span, exit, clock, timingEnabled));\n }\n return self => acquireUseRelease(acquire, ([span, context]) => core.provideContext(self, Context.add(context, tracer.spanTag, span)), ([span,, clock, timingEnabled], exit) => coreEffect.endSpan(span, exit, clock, timingEnabled));\n};\n/** @internal */\nexport const writeAll = (...outs) => writeChunk(Chunk.fromIterable(outs));\n/** @internal */\nexport const writeChunk = outs => writeChunkWriter(0, outs.length, outs);\n/** @internal */\nconst writeChunkWriter = (idx, len, chunk) => {\n return idx === len ? core.void : pipe(core.write(pipe(chunk, Chunk.unsafeGet(idx))), core.flatMap(() => writeChunkWriter(idx + 1, len, chunk)));\n};\n/** @internal */\nexport const zip = /*#__PURE__*/dual(args => core.isChannel(args[1]), (self, that, options) => options?.concurrent ? mergeWith(self, {\n other: that,\n onSelfDone: exit1 => mergeDecision.Await(exit2 => Effect.suspend(() => Exit.zip(exit1, exit2))),\n onOtherDone: exit2 => mergeDecision.Await(exit1 => Effect.suspend(() => Exit.zip(exit1, exit2)))\n}) : core.flatMap(self, a => map(that, b => [a, b])));\n/** @internal */\nexport const zipLeft = /*#__PURE__*/dual(args => core.isChannel(args[1]), (self, that, options) => options?.concurrent ? map(zip(self, that, {\n concurrent: true\n}), tuple => tuple[0]) : core.flatMap(self, z => as(that, z)));\n/** @internal */\nexport const zipRight = /*#__PURE__*/dual(args => core.isChannel(args[1]), (self, that, options) => options?.concurrent ? map(zip(self, that, {\n concurrent: true\n}), tuple => tuple[1]) : core.flatMap(self, () => that));\n/** @internal */\nexport const ChannelExceptionTypeId = /*#__PURE__*/Symbol.for(\"effect/Channel/ChannelException\");\n/** @internal */\nexport const ChannelException = error => ({\n _tag: \"ChannelException\",\n [ChannelExceptionTypeId]: ChannelExceptionTypeId,\n error\n});\n/** @internal */\nexport const isChannelException = u => hasProperty(u, ChannelExceptionTypeId);\n//# sourceMappingURL=channel.js.map","import * as Arr from \"../Array.js\";\nimport * as Cause from \"../Cause.js\";\nimport * as Chunk from \"../Chunk.js\";\nimport * as Clock from \"../Clock.js\";\nimport * as Duration from \"../Duration.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Either from \"../Either.js\";\nimport * as Exit from \"../Exit.js\";\nimport { constTrue, dual, identity, pipe } from \"../Function.js\";\nimport * as HashMap from \"../HashMap.js\";\nimport * as HashSet from \"../HashSet.js\";\nimport * as Option from \"../Option.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as PubSub from \"../PubSub.js\";\nimport * as Queue from \"../Queue.js\";\nimport * as Ref from \"../Ref.js\";\nimport * as Scope from \"../Scope.js\";\nimport * as channel from \"./channel.js\";\nimport * as mergeDecision from \"./channel/mergeDecision.js\";\nimport * as core from \"./core-stream.js\";\n/** @internal */\nexport const SinkTypeId = /*#__PURE__*/Symbol.for(\"effect/Sink\");\nconst sinkVariance = {\n /* c8 ignore next */\n _A: _ => _,\n /* c8 ignore next */\n _In: _ => _,\n /* c8 ignore next */\n _L: _ => _,\n /* c8 ignore next */\n _E: _ => _,\n /* c8 ignore next */\n _R: _ => _\n};\n/** @internal */\nexport class SinkImpl {\n channel;\n [SinkTypeId] = sinkVariance;\n constructor(channel) {\n this.channel = channel;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\n/** @internal */\nexport const isSink = u => hasProperty(u, SinkTypeId);\n/** @internal */\nexport const suspend = evaluate => new SinkImpl(core.suspend(() => toChannel(evaluate())));\n/** @internal */\nexport const as = /*#__PURE__*/dual(2, (self, a) => pipe(self, map(() => a)));\n/** @internal */\nexport const collectAll = () => new SinkImpl(collectAllLoop(Chunk.empty()));\n/** @internal */\nconst collectAllLoop = acc => core.readWithCause({\n onInput: chunk => collectAllLoop(pipe(acc, Chunk.appendAll(chunk))),\n onFailure: core.failCause,\n onDone: () => core.succeed(acc)\n});\n/** @internal */\nexport const collectAllN = n => suspend(() => fromChannel(collectAllNLoop(n, Chunk.empty())));\n/** @internal */\nconst collectAllNLoop = (n, acc) => core.readWithCause({\n onInput: chunk => {\n const [collected, leftovers] = Chunk.splitAt(chunk, n);\n if (collected.length < n) {\n return collectAllNLoop(n - collected.length, Chunk.appendAll(acc, collected));\n }\n if (Chunk.isEmpty(leftovers)) {\n return core.succeed(Chunk.appendAll(acc, collected));\n }\n return core.flatMap(core.write(leftovers), () => core.succeed(Chunk.appendAll(acc, collected)));\n },\n onFailure: core.failCause,\n onDone: () => core.succeed(acc)\n});\n/** @internal */\nexport const collectAllFrom = self => collectAllWhileWith(self, {\n initial: Chunk.empty(),\n while: constTrue,\n body: (chunk, a) => pipe(chunk, Chunk.append(a))\n});\n/** @internal */\nexport const collectAllToMap = (key, merge) => {\n return foldLeftChunks(HashMap.empty(), (map, chunk) => pipe(chunk, Chunk.reduce(map, (map, input) => {\n const k = key(input);\n const v = pipe(map, HashMap.has(k)) ? merge(pipe(map, HashMap.unsafeGet(k)), input) : input;\n return pipe(map, HashMap.set(k, v));\n })));\n};\n/** @internal */\nexport const collectAllToMapN = (n, key, merge) => {\n return foldWeighted({\n initial: HashMap.empty(),\n maxCost: n,\n cost: (acc, input) => pipe(acc, HashMap.has(key(input))) ? 0 : 1,\n body: (acc, input) => {\n const k = key(input);\n const v = pipe(acc, HashMap.has(k)) ? merge(pipe(acc, HashMap.unsafeGet(k)), input) : input;\n return pipe(acc, HashMap.set(k, v));\n }\n });\n};\n/** @internal */\nexport const collectAllToSet = () => foldLeftChunks(HashSet.empty(), (acc, chunk) => pipe(chunk, Chunk.reduce(acc, (acc, input) => pipe(acc, HashSet.add(input)))));\n/** @internal */\nexport const collectAllToSetN = n => foldWeighted({\n initial: HashSet.empty(),\n maxCost: n,\n cost: (acc, input) => HashSet.has(acc, input) ? 0 : 1,\n body: (acc, input) => HashSet.add(acc, input)\n});\n/** @internal */\nexport const collectAllUntil = p => {\n return pipe(fold([Chunk.empty(), true], tuple => tuple[1], ([chunk, _], input) => [pipe(chunk, Chunk.append(input)), !p(input)]), map(tuple => tuple[0]));\n};\n/** @internal */\nexport const collectAllUntilEffect = p => {\n return pipe(foldEffect([Chunk.empty(), true], tuple => tuple[1], ([chunk, _], input) => pipe(p(input), Effect.map(bool => [pipe(chunk, Chunk.append(input)), !bool]))), map(tuple => tuple[0]));\n};\n/** @internal */\nexport const collectAllWhile = predicate => fromChannel(collectAllWhileReader(predicate, Chunk.empty()));\n/** @internal */\nconst collectAllWhileReader = (predicate, done) => core.readWith({\n onInput: input => {\n const [collected, leftovers] = pipe(Chunk.toReadonlyArray(input), Arr.span(predicate));\n if (leftovers.length === 0) {\n return collectAllWhileReader(predicate, pipe(done, Chunk.appendAll(Chunk.unsafeFromArray(collected))));\n }\n return pipe(core.write(Chunk.unsafeFromArray(leftovers)), channel.zipRight(core.succeed(pipe(done, Chunk.appendAll(Chunk.unsafeFromArray(collected))))));\n },\n onFailure: core.fail,\n onDone: () => core.succeed(done)\n});\n/** @internal */\nexport const collectAllWhileEffect = predicate => fromChannel(collectAllWhileEffectReader(predicate, Chunk.empty()));\n/** @internal */\nconst collectAllWhileEffectReader = (predicate, done) => core.readWith({\n onInput: input => pipe(core.fromEffect(pipe(input, Effect.takeWhile(predicate), Effect.map(Chunk.unsafeFromArray))), core.flatMap(collected => {\n const leftovers = pipe(input, Chunk.drop(collected.length));\n if (Chunk.isEmpty(leftovers)) {\n return collectAllWhileEffectReader(predicate, pipe(done, Chunk.appendAll(collected)));\n }\n return pipe(core.write(leftovers), channel.zipRight(core.succeed(pipe(done, Chunk.appendAll(collected)))));\n })),\n onFailure: core.fail,\n onDone: () => core.succeed(done)\n});\n/** @internal */\nexport const collectAllWhileWith = /*#__PURE__*/dual(2, (self, options) => {\n const refs = pipe(Ref.make(Chunk.empty()), Effect.zip(Ref.make(false)));\n const newChannel = pipe(core.fromEffect(refs), core.flatMap(([leftoversRef, upstreamDoneRef]) => {\n const upstreamMarker = core.readWith({\n onInput: input => pipe(core.write(input), core.flatMap(() => upstreamMarker)),\n onFailure: core.fail,\n onDone: done => pipe(core.fromEffect(Ref.set(upstreamDoneRef, true)), channel.as(done))\n });\n return pipe(upstreamMarker, core.pipeTo(channel.bufferChunk(leftoversRef)), core.pipeTo(collectAllWhileWithLoop(self, leftoversRef, upstreamDoneRef, options.initial, options.while, options.body)));\n }));\n return new SinkImpl(newChannel);\n});\nconst collectAllWhileWithLoop = (self, leftoversRef, upstreamDoneRef, currentResult, p, f) => {\n return pipe(toChannel(self), channel.doneCollect, channel.foldChannel({\n onFailure: core.fail,\n onSuccess: ([leftovers, doneValue]) => p(doneValue) ? pipe(core.fromEffect(Ref.set(leftoversRef, Chunk.flatten(leftovers))), core.flatMap(() => pipe(core.fromEffect(Ref.get(upstreamDoneRef)), core.flatMap(upstreamDone => {\n const accumulatedResult = f(currentResult, doneValue);\n return upstreamDone ? pipe(core.write(Chunk.flatten(leftovers)), channel.as(accumulatedResult)) : collectAllWhileWithLoop(self, leftoversRef, upstreamDoneRef, accumulatedResult, p, f);\n })))) : pipe(core.write(Chunk.flatten(leftovers)), channel.as(currentResult))\n }));\n};\n/** @internal */\nexport const collectLeftover = self => new SinkImpl(pipe(core.collectElements(toChannel(self)), channel.map(([chunks, z]) => [z, Chunk.flatten(chunks)])));\n/** @internal */\nexport const mapInput = /*#__PURE__*/dual(2, (self, f) => pipe(self, mapInputChunks(Chunk.map(f))));\n/** @internal */\nexport const mapInputEffect = /*#__PURE__*/dual(2, (self, f) => mapInputChunksEffect(self, chunk => Effect.map(Effect.forEach(chunk, v => f(v)), Chunk.unsafeFromArray)));\n/** @internal */\nexport const mapInputChunks = /*#__PURE__*/dual(2, (self, f) => {\n const loop = core.readWith({\n onInput: chunk => pipe(core.write(f(chunk)), core.flatMap(() => loop)),\n onFailure: core.fail,\n onDone: core.succeed\n });\n return new SinkImpl(pipe(loop, core.pipeTo(toChannel(self))));\n});\n/** @internal */\nexport const mapInputChunksEffect = /*#__PURE__*/dual(2, (self, f) => {\n const loop = core.readWith({\n onInput: chunk => pipe(core.fromEffect(f(chunk)), core.flatMap(core.write), core.flatMap(() => loop)),\n onFailure: core.fail,\n onDone: core.succeed\n });\n return new SinkImpl(pipe(loop, channel.pipeToOrFail(toChannel(self))));\n});\n/** @internal */\nexport const die = defect => failCause(Cause.die(defect));\n/** @internal */\nexport const dieMessage = message => failCause(Cause.die(new Cause.RuntimeException(message)));\n/** @internal */\nexport const dieSync = evaluate => failCauseSync(() => Cause.die(evaluate()));\n/** @internal */\nexport const dimap = /*#__PURE__*/dual(2, (self, options) => map(mapInput(self, options.onInput), options.onDone));\n/** @internal */\nexport const dimapEffect = /*#__PURE__*/dual(2, (self, options) => mapEffect(mapInputEffect(self, options.onInput), options.onDone));\n/** @internal */\nexport const dimapChunks = /*#__PURE__*/dual(2, (self, options) => map(mapInputChunks(self, options.onInput), options.onDone));\n/** @internal */\nexport const dimapChunksEffect = /*#__PURE__*/dual(2, (self, options) => mapEffect(mapInputChunksEffect(self, options.onInput), options.onDone));\n/** @internal */\nexport const drain = /*#__PURE__*/new SinkImpl(/*#__PURE__*/channel.drain(/*#__PURE__*/channel.identityChannel()));\n/** @internal */\nexport const drop = n => suspend(() => new SinkImpl(dropLoop(n)));\n/** @internal */\nconst dropLoop = n => core.readWith({\n onInput: input => {\n const dropped = pipe(input, Chunk.drop(n));\n const leftover = Math.max(n - input.length, 0);\n const more = Chunk.isEmpty(input) || leftover > 0;\n if (more) {\n return dropLoop(leftover);\n }\n return pipe(core.write(dropped), channel.zipRight(channel.identityChannel()));\n },\n onFailure: core.fail,\n onDone: () => core.void\n});\n/** @internal */\nexport const dropUntil = predicate => new SinkImpl(pipe(toChannel(dropWhile(input => !predicate(input))), channel.pipeToOrFail(toChannel(drop(1)))));\n/** @internal */\nexport const dropUntilEffect = predicate => suspend(() => new SinkImpl(dropUntilEffectReader(predicate)));\n/** @internal */\nconst dropUntilEffectReader = predicate => core.readWith({\n onInput: input => pipe(input, Effect.dropUntil(predicate), Effect.map(leftover => {\n const more = leftover.length === 0;\n return more ? dropUntilEffectReader(predicate) : pipe(core.write(Chunk.unsafeFromArray(leftover)), channel.zipRight(channel.identityChannel()));\n }), channel.unwrap),\n onFailure: core.fail,\n onDone: () => core.void\n});\n/** @internal */\nexport const dropWhile = predicate => new SinkImpl(dropWhileReader(predicate));\n/** @internal */\nconst dropWhileReader = predicate => core.readWith({\n onInput: input => {\n const out = pipe(input, Chunk.dropWhile(predicate));\n if (Chunk.isEmpty(out)) {\n return dropWhileReader(predicate);\n }\n return pipe(core.write(out), channel.zipRight(channel.identityChannel()));\n },\n onFailure: core.fail,\n onDone: core.succeedNow\n});\n/** @internal */\nexport const dropWhileEffect = predicate => suspend(() => new SinkImpl(dropWhileEffectReader(predicate)));\n/** @internal */\nconst dropWhileEffectReader = predicate => core.readWith({\n onInput: input => pipe(input, Effect.dropWhile(predicate), Effect.map(leftover => {\n const more = leftover.length === 0;\n return more ? dropWhileEffectReader(predicate) : pipe(core.write(Chunk.unsafeFromArray(leftover)), channel.zipRight(channel.identityChannel()));\n }), channel.unwrap),\n onFailure: core.fail,\n onDone: () => core.void\n});\n/** @internal */\nexport const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => new SinkImpl(pipe(self, toChannel, channel.ensuring(finalizer))));\n/** @internal */\nexport const ensuringWith = /*#__PURE__*/dual(2, (self, finalizer) => new SinkImpl(pipe(self, toChannel, core.ensuringWith(finalizer))));\n/** @internal */\nexport const context = () => fromEffect(Effect.context());\n/** @internal */\nexport const contextWith = f => pipe(context(), map(f));\n/** @internal */\nexport const contextWithEffect = f => pipe(context(), mapEffect(f));\n/** @internal */\nexport const contextWithSink = f => new SinkImpl(channel.unwrap(Effect.contextWith(context => toChannel(f(context)))));\n/** @internal */\nexport const every = predicate => fold(true, identity, (acc, input) => acc && predicate(input));\n/** @internal */\nexport const fail = e => new SinkImpl(core.fail(e));\n/** @internal */\nexport const failSync = evaluate => new SinkImpl(core.failSync(evaluate));\n/** @internal */\nexport const failCause = cause => new SinkImpl(core.failCause(cause));\n/** @internal */\nexport const failCauseSync = evaluate => new SinkImpl(core.failCauseSync(evaluate));\n/** @internal */\nexport const filterInput = f => {\n return self => pipe(self, mapInputChunks(Chunk.filter(f)));\n};\n/** @internal */\nexport const filterInputEffect = /*#__PURE__*/dual(2, (self, f) => mapInputChunksEffect(self, chunk => Effect.map(Effect.filter(chunk, f), Chunk.unsafeFromArray)));\n/** @internal */\nexport const findEffect = /*#__PURE__*/dual(2, (self, f) => {\n const newChannel = pipe(core.fromEffect(pipe(Ref.make(Chunk.empty()), Effect.zip(Ref.make(false)))), core.flatMap(([leftoversRef, upstreamDoneRef]) => {\n const upstreamMarker = core.readWith({\n onInput: input => pipe(core.write(input), core.flatMap(() => upstreamMarker)),\n onFailure: core.fail,\n onDone: done => pipe(core.fromEffect(Ref.set(upstreamDoneRef, true)), channel.as(done))\n });\n const loop = channel.foldChannel(core.collectElements(toChannel(self)), {\n onFailure: core.fail,\n onSuccess: ([leftovers, doneValue]) => pipe(core.fromEffect(f(doneValue)), core.flatMap(satisfied => pipe(core.fromEffect(Ref.set(leftoversRef, Chunk.flatten(leftovers))), channel.zipRight(pipe(core.fromEffect(Ref.get(upstreamDoneRef)), core.flatMap(upstreamDone => {\n if (satisfied) {\n return pipe(core.write(Chunk.flatten(leftovers)), channel.as(Option.some(doneValue)));\n }\n if (upstreamDone) {\n return pipe(core.write(Chunk.flatten(leftovers)), channel.as(Option.none()));\n }\n return loop;\n }))))))\n });\n return pipe(upstreamMarker, core.pipeTo(channel.bufferChunk(leftoversRef)), core.pipeTo(loop));\n }));\n return new SinkImpl(newChannel);\n});\n/** @internal */\nexport const fold = (s, contFn, f) => suspend(() => new SinkImpl(foldReader(s, contFn, f)));\n/** @internal */\nconst foldReader = (s, contFn, f) => {\n if (!contFn(s)) {\n return core.succeedNow(s);\n }\n return core.readWith({\n onInput: input => {\n const [nextS, leftovers] = foldChunkSplit(s, input, contFn, f, 0, input.length);\n if (Chunk.isNonEmpty(leftovers)) {\n return pipe(core.write(leftovers), channel.as(nextS));\n }\n return foldReader(nextS, contFn, f);\n },\n onFailure: core.fail,\n onDone: () => core.succeedNow(s)\n });\n};\n/** @internal */\nconst foldChunkSplit = (s, chunk, contFn, f, index, length) => {\n if (index === length) {\n return [s, Chunk.empty()];\n }\n const s1 = f(s, pipe(chunk, Chunk.unsafeGet(index)));\n if (contFn(s1)) {\n return foldChunkSplit(s1, chunk, contFn, f, index + 1, length);\n }\n return [s1, pipe(chunk, Chunk.drop(index + 1))];\n};\n/** @internal */\nexport const foldSink = /*#__PURE__*/dual(2, (self, options) => {\n const newChannel = pipe(toChannel(self), core.collectElements, channel.foldChannel({\n onFailure: error => toChannel(options.onFailure(error)),\n onSuccess: ([leftovers, z]) => core.suspend(() => {\n const leftoversRef = {\n ref: pipe(leftovers, Chunk.filter(Chunk.isNonEmpty))\n };\n const refReader = pipe(core.sync(() => {\n const ref = leftoversRef.ref;\n leftoversRef.ref = Chunk.empty();\n return ref;\n }),\n // This cast is safe because of the L1 >: L <: In1 bound. It follows that\n // L <: In1 and therefore Chunk[L] can be safely cast to Chunk[In1].\n core.flatMap(chunk => channel.writeChunk(chunk)));\n const passthrough = channel.identityChannel();\n const continuationSink = pipe(refReader, channel.zipRight(passthrough), core.pipeTo(toChannel(options.onSuccess(z))));\n return core.flatMap(core.collectElements(continuationSink), ([newLeftovers, z1]) => pipe(core.succeed(leftoversRef.ref), core.flatMap(channel.writeChunk), channel.zipRight(channel.writeChunk(newLeftovers)), channel.as(z1)));\n })\n }));\n return new SinkImpl(newChannel);\n});\n/** @internal */\nexport const foldChunks = (s, contFn, f) => suspend(() => new SinkImpl(foldChunksReader(s, contFn, f)));\n/** @internal */\nconst foldChunksReader = (s, contFn, f) => {\n if (!contFn(s)) {\n return core.succeedNow(s);\n }\n return core.readWith({\n onInput: input => foldChunksReader(f(s, input), contFn, f),\n onFailure: core.fail,\n onDone: () => core.succeedNow(s)\n });\n};\n/** @internal */\nexport const foldChunksEffect = (s, contFn, f) => suspend(() => new SinkImpl(foldChunksEffectReader(s, contFn, f)));\n/** @internal */\nconst foldChunksEffectReader = (s, contFn, f) => {\n if (!contFn(s)) {\n return core.succeedNow(s);\n }\n return core.readWith({\n onInput: input => pipe(core.fromEffect(f(s, input)), core.flatMap(s => foldChunksEffectReader(s, contFn, f))),\n onFailure: core.fail,\n onDone: () => core.succeedNow(s)\n });\n};\n/** @internal */\nexport const foldEffect = (s, contFn, f) => suspend(() => new SinkImpl(foldEffectReader(s, contFn, f)));\n/** @internal */\nconst foldEffectReader = (s, contFn, f) => {\n if (!contFn(s)) {\n return core.succeedNow(s);\n }\n return core.readWith({\n onInput: input => pipe(core.fromEffect(foldChunkSplitEffect(s, input, contFn, f)), core.flatMap(([nextS, leftovers]) => pipe(leftovers, Option.match({\n onNone: () => foldEffectReader(nextS, contFn, f),\n onSome: leftover => pipe(core.write(leftover), channel.as(nextS))\n })))),\n onFailure: core.fail,\n onDone: () => core.succeedNow(s)\n });\n};\n/** @internal */\nconst foldChunkSplitEffect = (s, chunk, contFn, f) => foldChunkSplitEffectInternal(s, chunk, 0, chunk.length, contFn, f);\n/** @internal */\nconst foldChunkSplitEffectInternal = (s, chunk, index, length, contFn, f) => {\n if (index === length) {\n return Effect.succeed([s, Option.none()]);\n }\n return pipe(f(s, pipe(chunk, Chunk.unsafeGet(index))), Effect.flatMap(s1 => contFn(s1) ? foldChunkSplitEffectInternal(s1, chunk, index + 1, length, contFn, f) : Effect.succeed([s1, Option.some(pipe(chunk, Chunk.drop(index + 1)))])));\n};\n/** @internal */\nexport const foldLeft = (s, f) => ignoreLeftover(fold(s, constTrue, f));\n/** @internal */\nexport const foldLeftChunks = (s, f) => foldChunks(s, constTrue, f);\n/** @internal */\nexport const foldLeftChunksEffect = (s, f) => ignoreLeftover(foldChunksEffect(s, constTrue, f));\n/** @internal */\nexport const foldLeftEffect = (s, f) => foldEffect(s, constTrue, f);\n/** @internal */\nexport const foldUntil = (s, max, f) => pipe(fold([s, 0], tuple => tuple[1] < max, ([output, count], input) => [f(output, input), count + 1]), map(tuple => tuple[0]));\n/** @internal */\nexport const foldUntilEffect = (s, max, f) => pipe(foldEffect([s, 0], tuple => tuple[1] < max, ([output, count], input) => pipe(f(output, input), Effect.map(s => [s, count + 1]))), map(tuple => tuple[0]));\n/** @internal */\nexport const foldWeighted = options => foldWeightedDecompose({\n ...options,\n decompose: Chunk.of\n});\n/** @internal */\nexport const foldWeightedDecompose = options => suspend(() => new SinkImpl(foldWeightedDecomposeLoop(options.initial, 0, false, options.maxCost, options.cost, options.decompose, options.body)));\n/** @internal */\nconst foldWeightedDecomposeLoop = (s, cost, dirty, max, costFn, decompose, f) => core.readWith({\n onInput: input => {\n const [nextS, nextCost, nextDirty, leftovers] = foldWeightedDecomposeFold(input, s, cost, dirty, max, costFn, decompose, f);\n if (Chunk.isNonEmpty(leftovers)) {\n return pipe(core.write(leftovers), channel.zipRight(core.succeedNow(nextS)));\n }\n if (cost > max) {\n return core.succeedNow(nextS);\n }\n return foldWeightedDecomposeLoop(nextS, nextCost, nextDirty, max, costFn, decompose, f);\n },\n onFailure: core.fail,\n onDone: () => core.succeedNow(s)\n});\n/** @internal */\nconst foldWeightedDecomposeFold = (input, s, cost, dirty, max, costFn, decompose, f) => {\n for (let index = 0; index < input.length; index++) {\n const elem = Chunk.unsafeGet(input, index);\n const prevCost = cost;\n cost = cost + costFn(s, elem);\n if (cost <= max) {\n s = f(s, elem);\n dirty = true;\n continue;\n }\n const decomposed = decompose(elem);\n if (decomposed.length <= 1 && !dirty) {\n // If `elem` cannot be decomposed, we need to cross the `max` threshold. To\n // minimize \"injury\", we only allow this when we haven't added anything else\n // to the aggregate (dirty = false).\n return [f(s, elem), cost, true, Chunk.drop(input, index + 1)];\n }\n if (decomposed.length <= 1 && dirty) {\n // If the state is dirty and `elem` cannot be decomposed, we stop folding\n // and include `elem` in the leftovers.\n return [s, prevCost, dirty, Chunk.drop(input, index)];\n }\n // `elem` got decomposed, so we will recurse with the decomposed elements pushed\n // into the chunk we're processing and see if we can aggregate further.\n input = Chunk.appendAll(decomposed, Chunk.drop(input, index + 1));\n cost = prevCost;\n index = -1;\n }\n return [s, cost, dirty, Chunk.empty()];\n};\n/** @internal */\nexport const foldWeightedDecomposeEffect = options => suspend(() => new SinkImpl(foldWeightedDecomposeEffectLoop(options.initial, options.maxCost, options.cost, options.decompose, options.body, 0, false)));\n/** @internal */\nexport const foldWeightedEffect = options => foldWeightedDecomposeEffect({\n ...options,\n decompose: input => Effect.succeed(Chunk.of(input))\n});\nconst foldWeightedDecomposeEffectLoop = (s, max, costFn, decompose, f, cost, dirty) => core.readWith({\n onInput: input => pipe(core.fromEffect(foldWeightedDecomposeEffectFold(s, max, costFn, decompose, f, input, dirty, cost, 0)), core.flatMap(([nextS, nextCost, nextDirty, leftovers]) => {\n if (Chunk.isNonEmpty(leftovers)) {\n return pipe(core.write(leftovers), channel.zipRight(core.succeedNow(nextS)));\n }\n if (cost > max) {\n return core.succeedNow(nextS);\n }\n return foldWeightedDecomposeEffectLoop(nextS, max, costFn, decompose, f, nextCost, nextDirty);\n })),\n onFailure: core.fail,\n onDone: () => core.succeedNow(s)\n});\n/** @internal */\nconst foldWeightedDecomposeEffectFold = (s, max, costFn, decompose, f, input, dirty, cost, index) => {\n if (index === input.length) {\n return Effect.succeed([s, cost, dirty, Chunk.empty()]);\n }\n const elem = pipe(input, Chunk.unsafeGet(index));\n return pipe(costFn(s, elem), Effect.map(newCost => cost + newCost), Effect.flatMap(total => {\n if (total <= max) {\n return pipe(f(s, elem), Effect.flatMap(s => foldWeightedDecomposeEffectFold(s, max, costFn, decompose, f, input, true, total, index + 1)));\n }\n return pipe(decompose(elem), Effect.flatMap(decomposed => {\n if (decomposed.length <= 1 && !dirty) {\n // If `elem` cannot be decomposed, we need to cross the `max` threshold. To\n // minimize \"injury\", we only allow this when we haven't added anything else\n // to the aggregate (dirty = false).\n return pipe(f(s, elem), Effect.map(s => [s, total, true, pipe(input, Chunk.drop(index + 1))]));\n }\n if (decomposed.length <= 1 && dirty) {\n // If the state is dirty and `elem` cannot be decomposed, we stop folding\n // and include `elem` in th leftovers.\n return Effect.succeed([s, cost, dirty, pipe(input, Chunk.drop(index))]);\n }\n // `elem` got decomposed, so we will recurse with the decomposed elements pushed\n // into the chunk we're processing and see if we can aggregate further.\n const next = pipe(decomposed, Chunk.appendAll(pipe(input, Chunk.drop(index + 1))));\n return foldWeightedDecomposeEffectFold(s, max, costFn, decompose, f, next, dirty, cost, 0);\n }));\n }));\n};\n/** @internal */\nexport const flatMap = /*#__PURE__*/dual(2, (self, f) => foldSink(self, {\n onFailure: fail,\n onSuccess: f\n}));\n/** @internal */\nexport const forEach = f => {\n const process = core.readWithCause({\n onInput: input => pipe(core.fromEffect(Effect.forEach(input, v => f(v), {\n discard: true\n })), core.flatMap(() => process)),\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return new SinkImpl(process);\n};\n/** @internal */\nexport const forEachChunk = f => {\n const process = core.readWithCause({\n onInput: input => pipe(core.fromEffect(f(input)), core.flatMap(() => process)),\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return new SinkImpl(process);\n};\n/** @internal */\nexport const forEachWhile = f => {\n const process = core.readWithCause({\n onInput: input => forEachWhileReader(f, input, 0, input.length, process),\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return new SinkImpl(process);\n};\n/** @internal */\nconst forEachWhileReader = (f, input, index, length, cont) => {\n if (index === length) {\n return cont;\n }\n return pipe(core.fromEffect(f(pipe(input, Chunk.unsafeGet(index)))), core.flatMap(bool => bool ? forEachWhileReader(f, input, index + 1, length, cont) : core.write(pipe(input, Chunk.drop(index)))), channel.catchAll(error => pipe(core.write(pipe(input, Chunk.drop(index))), channel.zipRight(core.fail(error)))));\n};\n/** @internal */\nexport const forEachChunkWhile = f => {\n const reader = core.readWith({\n onInput: input => pipe(core.fromEffect(f(input)), core.flatMap(cont => cont ? reader : core.void)),\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new SinkImpl(reader);\n};\n/** @internal */\nexport const fromChannel = channel => new SinkImpl(channel);\n/** @internal */\nexport const fromEffect = effect => new SinkImpl(core.fromEffect(effect));\n/** @internal */\nexport const fromPubSub = (pubsub, options) => fromQueue(pubsub, options);\n/** @internal */\nexport const fromPush = push => new SinkImpl(channel.unwrapScoped(pipe(push, Effect.map(fromPushPull))));\nconst fromPushPull = push => core.readWith({\n onInput: input => channel.foldChannel(core.fromEffect(push(Option.some(input))), {\n onFailure: ([either, leftovers]) => Either.match(either, {\n onLeft: error => pipe(core.write(leftovers), channel.zipRight(core.fail(error))),\n onRight: z => pipe(core.write(leftovers), channel.zipRight(core.succeedNow(z)))\n }),\n onSuccess: () => fromPushPull(push)\n }),\n onFailure: core.fail,\n onDone: () => channel.foldChannel(core.fromEffect(push(Option.none())), {\n onFailure: ([either, leftovers]) => Either.match(either, {\n onLeft: error => pipe(core.write(leftovers), channel.zipRight(core.fail(error))),\n onRight: z => pipe(core.write(leftovers), channel.zipRight(core.succeedNow(z)))\n }),\n onSuccess: () => core.fromEffect(Effect.dieMessage(\"BUG: Sink.fromPush - please report an issue at https://github.com/Effect-TS/effect/issues\"))\n })\n});\n/** @internal */\nexport const fromQueue = (queue, options) => options?.shutdown ? unwrapScoped(Effect.map(Effect.acquireRelease(Effect.succeed(queue), Queue.shutdown), fromQueue)) : forEachChunk(input => Queue.offerAll(queue, input));\n/** @internal */\nexport const head = () => fold(Option.none(), Option.isNone, (option, input) => Option.match(option, {\n onNone: () => Option.some(input),\n onSome: () => option\n}));\n/** @internal */\nexport const ignoreLeftover = self => new SinkImpl(channel.drain(toChannel(self)));\n/** @internal */\nexport const last = () => foldLeftChunks(Option.none(), (s, input) => Option.orElse(Chunk.last(input), () => s));\n/** @internal */\nexport const leftover = chunk => new SinkImpl(core.suspend(() => core.write(chunk)));\n/** @internal */\nexport const map = /*#__PURE__*/dual(2, (self, f) => {\n return new SinkImpl(pipe(toChannel(self), channel.map(f)));\n});\n/** @internal */\nexport const mapEffect = /*#__PURE__*/dual(2, (self, f) => new SinkImpl(pipe(toChannel(self), channel.mapEffect(f))));\n/** @internal */\nexport const mapError = /*#__PURE__*/dual(2, (self, f) => new SinkImpl(pipe(toChannel(self), channel.mapError(f))));\n/** @internal */\nexport const mapLeftover = /*#__PURE__*/dual(2, (self, f) => new SinkImpl(pipe(toChannel(self), channel.mapOut(Chunk.map(f)))));\n/** @internal */\nexport const never = /*#__PURE__*/fromEffect(Effect.never);\n/** @internal */\nexport const orElse = /*#__PURE__*/dual(2, (self, that) => new SinkImpl(pipe(toChannel(self), channel.orElse(() => toChannel(that())))));\n/** @internal */\nexport const provideContext = /*#__PURE__*/dual(2, (self, context) => new SinkImpl(pipe(toChannel(self), core.provideContext(context))));\n/** @internal */\nexport const race = /*#__PURE__*/dual(2, (self, that) => pipe(self, raceBoth(that), map(Either.merge)));\n/** @internal */\nexport const raceBoth = /*#__PURE__*/dual(args => isSink(args[1]), (self, that, options) => raceWith(self, {\n other: that,\n onSelfDone: selfDone => mergeDecision.Done(Effect.map(selfDone, Either.left)),\n onOtherDone: thatDone => mergeDecision.Done(Effect.map(thatDone, Either.right)),\n capacity: options?.capacity ?? 16\n}));\n/** @internal */\nexport const raceWith = /*#__PURE__*/dual(2, (self, options) => {\n function race(scope) {\n return Effect.gen(function* () {\n const pubsub = yield* PubSub.bounded(options?.capacity ?? 16);\n const subscription1 = yield* Scope.extend(PubSub.subscribe(pubsub), scope);\n const subscription2 = yield* Scope.extend(PubSub.subscribe(pubsub), scope);\n const reader = channel.toPubSub(pubsub);\n const writer = channel.fromQueue(subscription1).pipe(core.pipeTo(toChannel(self)), channel.zipLeft(core.fromEffect(Queue.shutdown(subscription1))), channel.mergeWith({\n other: channel.fromQueue(subscription2).pipe(core.pipeTo(toChannel(options.other)), channel.zipLeft(core.fromEffect(Queue.shutdown(subscription2)))),\n onSelfDone: options.onSelfDone,\n onOtherDone: options.onOtherDone\n }));\n const racedChannel = channel.mergeWith(reader, {\n other: writer,\n onSelfDone: () => mergeDecision.Await(identity),\n onOtherDone: exit => mergeDecision.Done(exit)\n });\n return new SinkImpl(racedChannel);\n });\n }\n return unwrapScopedWith(race);\n});\n/** @internal */\nexport const refineOrDie = /*#__PURE__*/dual(2, (self, pf) => pipe(self, refineOrDieWith(pf, identity)));\n/** @internal */\nexport const refineOrDieWith = /*#__PURE__*/dual(3, (self, pf, f) => {\n const newChannel = pipe(self, toChannel, channel.catchAll(error => Option.match(pf(error), {\n onNone: () => core.failCauseSync(() => Cause.die(f(error))),\n onSome: core.fail\n })));\n return new SinkImpl(newChannel);\n});\n/** @internal */\nexport const service = tag => serviceWith(tag, identity);\n/** @internal */\nexport const serviceWith = (tag, f) => fromEffect(Effect.map(tag, f));\n/** @internal */\nexport const serviceWithEffect = (tag, f) => fromEffect(Effect.flatMap(tag, f));\n/** @internal */\nexport const serviceWithSink = (tag, f) => new SinkImpl(pipe(Effect.map(tag, service => toChannel(f(service))), channel.unwrap));\n/** @internal */\nexport const some = predicate => fold(false, bool => !bool, (acc, input) => acc || predicate(input));\n/** @internal */\nexport const splitWhere = /*#__PURE__*/dual(2, (self, f) => {\n const newChannel = pipe(core.fromEffect(Ref.make(Chunk.empty())), core.flatMap(ref => pipe(splitWhereSplitter(false, ref, f), channel.pipeToOrFail(toChannel(self)), core.collectElements, core.flatMap(([leftovers, z]) => pipe(core.fromEffect(Ref.get(ref)), core.flatMap(leftover => pipe(core.write(pipe(leftover, Chunk.appendAll(Chunk.flatten(leftovers)))), channel.zipRight(core.succeed(z)))))))));\n return new SinkImpl(newChannel);\n});\n/** @internal */\nconst splitWhereSplitter = (written, leftovers, f) => core.readWithCause({\n onInput: input => {\n if (Chunk.isEmpty(input)) {\n return splitWhereSplitter(written, leftovers, f);\n }\n if (written) {\n const index = indexWhere(input, f);\n if (index === -1) {\n return channel.zipRight(core.write(input), splitWhereSplitter(true, leftovers, f));\n }\n const [left, right] = Chunk.splitAt(input, index);\n return channel.zipRight(core.write(left), core.fromEffect(Ref.set(leftovers, right)));\n }\n const index = indexWhere(input, f, 1);\n if (index === -1) {\n return channel.zipRight(core.write(input), splitWhereSplitter(true, leftovers, f));\n }\n const [left, right] = pipe(input, Chunk.splitAt(Math.max(index, 1)));\n return channel.zipRight(core.write(left), core.fromEffect(Ref.set(leftovers, right)));\n },\n onFailure: core.failCause,\n onDone: core.succeed\n});\n/** @internal */\nconst indexWhere = (self, predicate, from = 0) => {\n const iterator = self[Symbol.iterator]();\n let index = 0;\n let result = -1;\n let next;\n while (result < 0 && (next = iterator.next()) && !next.done) {\n const a = next.value;\n if (index >= from && predicate(a)) {\n result = index;\n }\n index = index + 1;\n }\n return result;\n};\n/** @internal */\nexport const succeed = a => new SinkImpl(core.succeed(a));\n/** @internal */\nexport const sum = /*#__PURE__*/foldLeftChunks(0, (acc, chunk) => acc + Chunk.reduce(chunk, 0, (s, a) => s + a));\n/** @internal */\nexport const summarized = /*#__PURE__*/dual(3, (self, summary, f) => {\n const newChannel = pipe(core.fromEffect(summary), core.flatMap(start => pipe(self, toChannel, core.flatMap(done => pipe(core.fromEffect(summary), channel.map(end => [done, f(start, end)]))))));\n return new SinkImpl(newChannel);\n});\n/** @internal */\nexport const sync = evaluate => new SinkImpl(core.sync(evaluate));\n/** @internal */\nexport const take = n => pipe(foldChunks(Chunk.empty(), chunk => chunk.length < n, (acc, chunk) => pipe(acc, Chunk.appendAll(chunk))), flatMap(acc => {\n const [taken, leftover] = pipe(acc, Chunk.splitAt(n));\n return new SinkImpl(pipe(core.write(leftover), channel.zipRight(core.succeedNow(taken))));\n}));\n/** @internal */\nexport const toChannel = self => Effect.isEffect(self) ? toChannel(fromEffect(self)) : self.channel;\n/** @internal */\nexport const unwrap = effect => new SinkImpl(channel.unwrap(pipe(effect, Effect.map(sink => toChannel(sink)))));\n/** @internal */\nexport const unwrapScoped = effect => new SinkImpl(channel.unwrapScoped(effect.pipe(Effect.map(sink => toChannel(sink)))));\n/** @internal */\nexport const unwrapScopedWith = f => new SinkImpl(channel.unwrapScopedWith(scope => f(scope).pipe(Effect.map(sink => toChannel(sink)))));\n/** @internal */\nexport const withDuration = self => pipe(self, summarized(Clock.currentTimeMillis, (start, end) => Duration.millis(end - start)));\n/** @internal */\nexport const zip = /*#__PURE__*/dual(args => isSink(args[1]), (self, that, options) => zipWith(self, that, (z, z2) => [z, z2], options));\n/** @internal */\nexport const zipLeft = /*#__PURE__*/dual(args => isSink(args[1]), (self, that, options) => zipWith(self, that, (z, _) => z, options));\n/** @internal */\nexport const zipRight = /*#__PURE__*/dual(args => isSink(args[1]), (self, that, options) => zipWith(self, that, (_, z2) => z2, options));\n/** @internal */\nexport const zipWith = /*#__PURE__*/dual(args => isSink(args[1]), (self, that, f, options) => options?.concurrent ? raceWith(self, {\n other: that,\n onSelfDone: Exit.match({\n onFailure: cause => mergeDecision.Done(Effect.failCause(cause)),\n onSuccess: leftZ => mergeDecision.Await(Exit.match({\n onFailure: Effect.failCause,\n onSuccess: rightZ => Effect.succeed(f(leftZ, rightZ))\n }))\n }),\n onOtherDone: Exit.match({\n onFailure: cause => mergeDecision.Done(Effect.failCause(cause)),\n onSuccess: rightZ => mergeDecision.Await(Exit.match({\n onFailure: Effect.failCause,\n onSuccess: leftZ => Effect.succeed(f(leftZ, rightZ))\n }))\n })\n}) : flatMap(self, z => map(that, z2 => f(z, z2))));\n// Circular with Channel\n/** @internal */\nexport const channelToSink = self => new SinkImpl(self);\n// Constants\n/** @internal */\nexport const count = /*#__PURE__*/foldLeftChunks(0, (acc, chunk) => acc + chunk.length);\n/** @internal */\nexport const mkString = /*#__PURE__*/suspend(() => {\n const strings = [];\n return pipe(foldLeftChunks(void 0, (_, elems) => Chunk.map(elems, elem => {\n strings.push(String(elem));\n })), map(() => strings.join(\"\")));\n});\n/** @internal */\nexport const timed = /*#__PURE__*/pipe(/*#__PURE__*/withDuration(drain), /*#__PURE__*/map(tuple => tuple[1]));\n//# sourceMappingURL=sink.js.map","import * as Cause from \"../Cause.js\";\nimport * as Chunk from \"../Chunk.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Exit from \"../Exit.js\";\nimport { constFalse, constTrue, dual, pipe } from \"../Function.js\";\nimport * as Option from \"../Option.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\n/** @internal */\nconst TakeSymbolKey = \"effect/Take\";\n/** @internal */\nexport const TakeTypeId = /*#__PURE__*/Symbol.for(TakeSymbolKey);\nconst takeVariance = {\n /* c8 ignore next */\n _A: _ => _,\n /* c8 ignore next */\n _E: _ => _\n};\n/** @internal */\nexport class TakeImpl {\n exit;\n [TakeTypeId] = takeVariance;\n constructor(exit) {\n this.exit = exit;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\n/** @internal */\nexport const chunk = chunk => new TakeImpl(Exit.succeed(chunk));\n/** @internal */\nexport const die = defect => new TakeImpl(Exit.die(defect));\n/** @internal */\nexport const dieMessage = message => new TakeImpl(Exit.die(new Cause.RuntimeException(message)));\n/** @internal */\nexport const done = self => Effect.suspend(() => self.exit);\n/** @internal */\nexport const end = /*#__PURE__*/new TakeImpl(/*#__PURE__*/Exit.fail(/*#__PURE__*/Option.none()));\n/** @internal */\nexport const fail = error => new TakeImpl(Exit.fail(Option.some(error)));\n/** @internal */\nexport const failCause = cause => new TakeImpl(Exit.failCause(pipe(cause, Cause.map(Option.some))));\n/** @internal */\nexport const fromEffect = effect => Effect.matchCause(effect, {\n onFailure: failCause,\n onSuccess: of\n});\n/** @internal */\nexport const fromExit = exit => new TakeImpl(pipe(exit, Exit.mapBoth({\n onFailure: Option.some,\n onSuccess: Chunk.of\n})));\n/** @internal */\nexport const fromPull = pull => Effect.matchCause(pull, {\n onFailure: cause => Option.match(Cause.flipCauseOption(cause), {\n onNone: () => end,\n onSome: failCause\n }),\n onSuccess: chunk\n});\n/** @internal */\nexport const isDone = self => Exit.match(self.exit, {\n onFailure: cause => Option.isNone(Cause.flipCauseOption(cause)),\n onSuccess: constFalse\n});\n/** @internal */\nexport const isFailure = self => Exit.match(self.exit, {\n onFailure: cause => Option.isSome(Cause.flipCauseOption(cause)),\n onSuccess: constFalse\n});\n/** @internal */\nexport const isSuccess = self => Exit.match(self.exit, {\n onFailure: constFalse,\n onSuccess: constTrue\n});\n/** @internal */\nexport const make = exit => new TakeImpl(exit);\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, {\n onEnd,\n onFailure,\n onSuccess\n}) => Exit.match(self.exit, {\n onFailure: cause => Option.match(Cause.flipCauseOption(cause), {\n onNone: onEnd,\n onSome: onFailure\n }),\n onSuccess\n}));\n/** @internal */\nexport const matchEffect = /*#__PURE__*/dual(2, (self, {\n onEnd,\n onFailure,\n onSuccess\n}) => Exit.matchEffect(self.exit, {\n onFailure: cause => Option.match(Cause.flipCauseOption(cause), {\n onNone: () => onEnd,\n onSome: onFailure\n }),\n onSuccess\n}));\n/** @internal */\nexport const map = /*#__PURE__*/dual(2, (self, f) => new TakeImpl(pipe(self.exit, Exit.map(Chunk.map(f)))));\n/** @internal */\nexport const of = value => new TakeImpl(Exit.succeed(Chunk.of(value)));\n/** @internal */\nexport const tap = /*#__PURE__*/dual(2, (self, f) => pipe(self.exit, Exit.forEachEffect(f), Effect.asVoid));\n//# sourceMappingURL=take.js.map","import * as Chunk from \"../../Chunk.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Queue from \"../../Queue.js\";\nimport * as take from \"../take.js\";\n/** @internal */\nexport const emit = value => Effect.succeed(Chunk.of(value));\n/** @internal */\nexport const emitChunk = chunk => Effect.succeed(chunk);\n/** @internal */\nexport const empty = () => Effect.succeed(Chunk.empty());\n/** @internal */\nexport const end = () => Effect.fail(Option.none());\n/** @internal */\nexport const fail = error => Effect.fail(Option.some(error));\n/** @internal */\nexport const failCause = cause => Effect.mapError(Effect.failCause(cause), Option.some);\n/** @internal */\nexport const fromDequeue = dequeue => Effect.flatMap(Queue.take(dequeue), take.done);\n//# sourceMappingURL=pull.js.map","import * as Cause from \"../Cause.js\";\nimport * as Chunk from \"../Chunk.js\";\nimport * as Clock from \"../Clock.js\";\nimport * as Context from \"../Context.js\";\nimport * as Deferred from \"../Deferred.js\";\nimport * as Duration from \"../Duration.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Either from \"../Either.js\";\nimport * as Equal from \"../Equal.js\";\nimport * as Exit from \"../Exit.js\";\nimport * as Fiber from \"../Fiber.js\";\nimport * as FiberRef from \"../FiberRef.js\";\nimport { constTrue, dual, identity, pipe } from \"../Function.js\";\nimport * as internalExecutionPlan from \"../internal/executionPlan.js\";\nimport * as Layer from \"../Layer.js\";\nimport * as MergeDecision from \"../MergeDecision.js\";\nimport * as Option from \"../Option.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as PubSub from \"../PubSub.js\";\nimport * as Queue from \"../Queue.js\";\nimport * as RcRef from \"../RcRef.js\";\nimport * as Ref from \"../Ref.js\";\nimport * as Runtime from \"../Runtime.js\";\nimport * as Schedule from \"../Schedule.js\";\nimport * as HaltStrategy from \"../StreamHaltStrategy.js\";\nimport * as TPubSub from \"../TPubSub.js\";\nimport * as TQueue from \"../TQueue.js\";\nimport * as Tuple from \"../Tuple.js\";\nimport * as channel from \"./channel.js\";\nimport * as channelExecutor from \"./channel/channelExecutor.js\";\nimport * as MergeStrategy from \"./channel/mergeStrategy.js\";\nimport * as core from \"./core-stream.js\";\nimport * as doNotation from \"./doNotation.js\";\nimport { RingBuffer } from \"./ringBuffer.js\";\nimport * as InternalSchedule from \"./schedule.js\";\nimport * as sink_ from \"./sink.js\";\nimport * as DebounceState from \"./stream/debounceState.js\";\nimport * as emit from \"./stream/emit.js\";\nimport * as haltStrategy from \"./stream/haltStrategy.js\";\nimport * as Handoff from \"./stream/handoff.js\";\nimport * as HandoffSignal from \"./stream/handoffSignal.js\";\nimport * as pull from \"./stream/pull.js\";\nimport * as SinkEndReason from \"./stream/sinkEndReason.js\";\nimport * as ZipAllState from \"./stream/zipAllState.js\";\nimport * as ZipChunksState from \"./stream/zipChunksState.js\";\nimport * as InternalTake from \"./take.js\";\nimport * as InternalTracer from \"./tracer.js\";\n/** @internal */\nconst StreamSymbolKey = \"effect/Stream\";\n/** @internal */\nexport const StreamTypeId = /*#__PURE__*/Symbol.for(StreamSymbolKey);\n/** @internal */\nconst streamVariance = {\n _R: _ => _,\n _E: _ => _,\n _A: _ => _\n};\n/** @internal */\nexport class StreamImpl {\n channel;\n [StreamTypeId] = streamVariance;\n constructor(channel) {\n this.channel = channel;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\n/** @internal */\nexport const isStream = u => hasProperty(u, StreamTypeId) || Effect.isEffect(u);\n/** @internal */\nexport const DefaultChunkSize = 4096;\n/** @internal */\nexport const accumulate = self => chunks(accumulateChunks(self));\n/** @internal */\nexport const accumulateChunks = self => {\n const accumulator = s => core.readWith({\n onInput: input => {\n const next = Chunk.appendAll(s, input);\n return core.flatMap(core.write(next), () => accumulator(next));\n },\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(core.pipeTo(toChannel(self), accumulator(Chunk.empty())));\n};\n/** @internal */\nexport const acquireRelease = (acquire, release) => scoped(Effect.acquireRelease(acquire, release));\n/** @internal */\nexport const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(self, sink, Schedule.forever));\n/** @internal */\nexport const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => filterMap(aggregateWithinEither(self, sink, schedule), _ => Either.match(_, {\n onLeft: Option.none,\n onRight: Option.some\n})));\n/** @internal */\nexport const aggregateWithinEither = /*#__PURE__*/dual(3, (self, sink, schedule) => {\n const layer = Effect.all([Handoff.make(), Ref.make(SinkEndReason.ScheduleEnd), Ref.make(Chunk.empty()), Schedule.driver(schedule), Ref.make(false), Ref.make(false)]);\n return fromEffect(layer).pipe(flatMap(([handoff, sinkEndReason, sinkLeftovers, scheduleDriver, consumed, endAfterEmit]) => {\n const handoffProducer = core.readWithCause({\n onInput: input => core.flatMap(core.fromEffect(pipe(handoff, Handoff.offer(HandoffSignal.emit(input)), Effect.when(() => Chunk.isNonEmpty(input)))), () => handoffProducer),\n onFailure: cause => core.fromEffect(Handoff.offer(handoff, HandoffSignal.halt(cause))),\n onDone: () => core.fromEffect(Handoff.offer(handoff, HandoffSignal.end(SinkEndReason.UpstreamEnd)))\n });\n const handoffConsumer = pipe(Ref.getAndSet(sinkLeftovers, Chunk.empty()), Effect.flatMap(leftovers => {\n if (Chunk.isNonEmpty(leftovers)) {\n return pipe(Ref.set(consumed, true), Effect.zipRight(Effect.succeed(pipe(core.write(leftovers), core.flatMap(() => handoffConsumer)))));\n }\n return pipe(Handoff.take(handoff), Effect.map(signal => {\n switch (signal._tag) {\n case HandoffSignal.OP_EMIT:\n {\n return pipe(core.fromEffect(Ref.set(consumed, true)), channel.zipRight(core.write(signal.elements)), channel.zipRight(core.fromEffect(Ref.get(endAfterEmit))), core.flatMap(bool => bool ? core.void : handoffConsumer));\n }\n case HandoffSignal.OP_HALT:\n {\n return core.failCause(signal.cause);\n }\n case HandoffSignal.OP_END:\n {\n if (signal.reason._tag === SinkEndReason.OP_SCHEDULE_END) {\n return pipe(Ref.get(consumed), Effect.map(bool => bool ? core.fromEffect(pipe(Ref.set(sinkEndReason, SinkEndReason.ScheduleEnd), Effect.zipRight(Ref.set(endAfterEmit, true)))) : pipe(core.fromEffect(pipe(Ref.set(sinkEndReason, SinkEndReason.ScheduleEnd), Effect.zipRight(Ref.set(endAfterEmit, true)))), core.flatMap(() => handoffConsumer))), channel.unwrap);\n }\n return pipe(Ref.set(sinkEndReason, signal.reason), Effect.zipRight(Ref.set(endAfterEmit, true)), core.fromEffect);\n }\n }\n }));\n }), channel.unwrap);\n const timeout = lastB => scheduleDriver.next(lastB);\n const scheduledAggregator = (sinkFiber, scheduleFiber, scope) => {\n const forkSink = pipe(Ref.set(consumed, false), Effect.zipRight(Ref.set(endAfterEmit, false)), Effect.zipRight(pipe(handoffConsumer, channel.pipeToOrFail(sink_.toChannel(sink)), core.collectElements, channel.run, Effect.forkIn(scope))));\n const handleSide = (leftovers, b, c) => pipe(Ref.set(sinkLeftovers, Chunk.flatten(leftovers)), Effect.zipRight(Effect.map(Ref.get(sinkEndReason), reason => {\n switch (reason._tag) {\n case SinkEndReason.OP_SCHEDULE_END:\n {\n return pipe(Effect.all([Ref.get(consumed), forkSink, pipe(timeout(Option.some(b)), Effect.forkIn(scope))]), Effect.map(([wasConsumed, sinkFiber, scheduleFiber]) => {\n const toWrite = pipe(c, Option.match({\n onNone: () => Chunk.of(Either.right(b)),\n onSome: c => Chunk.make(Either.right(b), Either.left(c))\n }));\n if (wasConsumed) {\n return pipe(core.write(toWrite), core.flatMap(() => scheduledAggregator(sinkFiber, scheduleFiber, scope)));\n }\n return scheduledAggregator(sinkFiber, scheduleFiber, scope);\n }), channel.unwrap);\n }\n case SinkEndReason.OP_UPSTREAM_END:\n {\n return pipe(Ref.get(consumed), Effect.map(wasConsumed => wasConsumed ? core.write(Chunk.of(Either.right(b))) : core.void), channel.unwrap);\n }\n }\n })), channel.unwrap);\n return channel.unwrap(Effect.raceWith(Fiber.join(sinkFiber), Fiber.join(scheduleFiber), {\n onSelfDone: (sinkExit, _) => pipe(Fiber.interrupt(scheduleFiber), Effect.zipRight(pipe(Effect.suspend(() => sinkExit), Effect.map(([leftovers, b]) => handleSide(leftovers, b, Option.none()))))),\n onOtherDone: (scheduleExit, _) => Effect.matchCauseEffect(Effect.suspend(() => scheduleExit), {\n onFailure: cause => Either.match(Cause.failureOrCause(cause), {\n onLeft: () => pipe(handoff, Handoff.offer(HandoffSignal.end(SinkEndReason.ScheduleEnd)), Effect.forkDaemon, Effect.zipRight(pipe(Fiber.join(sinkFiber), Effect.map(([leftovers, b]) => handleSide(leftovers, b, Option.none()))))),\n onRight: cause => pipe(handoff, Handoff.offer(HandoffSignal.halt(cause)), Effect.forkDaemon, Effect.zipRight(pipe(Fiber.join(sinkFiber), Effect.map(([leftovers, b]) => handleSide(leftovers, b, Option.none())))))\n }),\n onSuccess: c => pipe(handoff, Handoff.offer(HandoffSignal.end(SinkEndReason.ScheduleEnd)), Effect.forkDaemon, Effect.zipRight(pipe(Fiber.join(sinkFiber), Effect.map(([leftovers, b]) => handleSide(leftovers, b, Option.some(c))))))\n })\n }));\n };\n return unwrapScopedWith(scope => core.pipeTo(toChannel(self), handoffProducer).pipe(channel.run, Effect.forkIn(scope), Effect.zipRight(channel.pipeToOrFail(handoffConsumer, sink_.toChannel(sink)).pipe(core.collectElements, channel.run, Effect.forkIn(scope), Effect.flatMap(sinkFiber => timeout(Option.none()).pipe(Effect.forkIn(scope), Effect.map(scheduleFiber => new StreamImpl(scheduledAggregator(sinkFiber, scheduleFiber, scope)))))))));\n }));\n});\n/** @internal */\nexport const as = /*#__PURE__*/dual(2, (self, value) => map(self, () => value));\nconst queueFromBufferOptions = bufferSize => {\n if (bufferSize === \"unbounded\") {\n return Queue.unbounded();\n } else if (typeof bufferSize === \"number\" || bufferSize === undefined) {\n return Queue.bounded(bufferSize ?? 16);\n }\n switch (bufferSize.strategy) {\n case \"dropping\":\n return Queue.dropping(bufferSize.bufferSize ?? 16);\n case \"sliding\":\n return Queue.sliding(bufferSize.bufferSize ?? 16);\n default:\n return Queue.bounded(bufferSize.bufferSize ?? 16);\n }\n};\n/** @internal */\nexport const _async = (register, bufferSize) => Effect.acquireRelease(queueFromBufferOptions(bufferSize), queue => Queue.shutdown(queue)).pipe(Effect.flatMap(output => Effect.runtime().pipe(Effect.flatMap(runtime => Effect.sync(() => {\n const runPromiseExit = Runtime.runPromiseExit(runtime);\n const canceler = register(emit.make(resume => InternalTake.fromPull(resume).pipe(Effect.flatMap(take => Queue.offer(output, take)), Effect.asVoid, runPromiseExit).then(exit => {\n if (Exit.isFailure(exit)) {\n if (!Cause.isInterrupted(exit.cause)) {\n throw Cause.squash(exit.cause);\n }\n }\n })));\n return canceler;\n})), Effect.map(value => {\n const loop = Queue.take(output).pipe(Effect.flatMap(take => InternalTake.done(take)), Effect.match({\n onFailure: maybeError => core.fromEffect(Queue.shutdown(output)).pipe(channel.zipRight(Option.match(maybeError, {\n onNone: () => core.void,\n onSome: error => core.fail(error)\n }))),\n onSuccess: chunk => core.write(chunk).pipe(core.flatMap(() => loop))\n }), channel.unwrap);\n return fromChannel(loop).pipe(ensuring(value ?? Effect.void));\n}))), unwrapScoped);\n/** @internal */\nexport const asyncEffect = (register, bufferSize) => pipe(Effect.acquireRelease(queueFromBufferOptions(bufferSize), queue => Queue.shutdown(queue)), Effect.flatMap(output => pipe(Effect.runtime(), Effect.flatMap(runtime => pipe(register(emit.make(k => pipe(InternalTake.fromPull(k), Effect.flatMap(take => Queue.offer(output, take)), Effect.asVoid, Runtime.runPromiseExit(runtime)).then(exit => {\n if (Exit.isFailure(exit)) {\n if (!Cause.isInterrupted(exit.cause)) {\n throw Cause.squash(exit.cause);\n }\n }\n}))), Effect.map(() => {\n const loop = pipe(Queue.take(output), Effect.flatMap(InternalTake.done), Effect.match({\n onFailure: maybeError => pipe(core.fromEffect(Queue.shutdown(output)), channel.zipRight(Option.match(maybeError, {\n onNone: () => core.void,\n onSome: core.fail\n }))),\n onSuccess: chunk => pipe(core.write(chunk), core.flatMap(() => loop))\n }), channel.unwrap);\n return loop;\n}))))), channel.unwrapScoped, fromChannel);\nconst queueFromBufferOptionsPush = options => {\n if (options?.bufferSize === \"unbounded\" || options?.bufferSize === undefined && options?.strategy === undefined) {\n return Queue.unbounded();\n }\n switch (options?.strategy) {\n case \"sliding\":\n return Queue.sliding(options.bufferSize ?? 16);\n default:\n return Queue.dropping(options?.bufferSize ?? 16);\n }\n};\n/** @internal */\nexport const asyncPush = (register, options) => Effect.acquireRelease(queueFromBufferOptionsPush(options), Queue.shutdown).pipe(Effect.tap(queue => FiberRef.getWith(FiberRef.currentScheduler, scheduler => register(emit.makePush(queue, scheduler)))), Effect.map(queue => {\n const loop = core.flatMap(Queue.take(queue), item => Exit.isExit(item) ? Exit.isSuccess(item) ? core.void : core.failCause(item.cause) : channel.zipRight(core.write(Chunk.unsafeFromArray(item)), loop));\n return loop;\n}), channel.unwrapScoped, fromChannel);\n/** @internal */\nexport const asyncScoped = (register, bufferSize) => pipe(Effect.acquireRelease(queueFromBufferOptions(bufferSize), queue => Queue.shutdown(queue)), Effect.flatMap(output => pipe(Effect.runtime(), Effect.flatMap(runtime => pipe(register(emit.make(k => pipe(InternalTake.fromPull(k), Effect.flatMap(take => Queue.offer(output, take)), Effect.asVoid, Runtime.runPromiseExit(runtime)).then(exit => {\n if (Exit.isFailure(exit)) {\n if (!Cause.isInterrupted(exit.cause)) {\n throw Cause.squash(exit.cause);\n }\n }\n}))), Effect.zipRight(Ref.make(false)), Effect.flatMap(ref => pipe(Ref.get(ref), Effect.map(isDone => isDone ? pull.end() : pipe(Queue.take(output), Effect.flatMap(InternalTake.done), Effect.onError(() => pipe(Ref.set(ref, true), Effect.zipRight(Queue.shutdown(output)))))))))))), scoped, flatMap(repeatEffectChunkOption));\n/** @internal */\nexport const branchAfter = /*#__PURE__*/dual(3, (self, n, f) => suspend(() => {\n const buffering = acc => core.readWith({\n onInput: input => {\n const nextSize = acc.length + input.length;\n if (nextSize >= n) {\n const [b1, b2] = pipe(input, Chunk.splitAt(n - acc.length));\n return running(pipe(acc, Chunk.appendAll(b1)), b2);\n }\n return buffering(pipe(acc, Chunk.appendAll(input)));\n },\n onFailure: core.fail,\n onDone: () => running(acc, Chunk.empty())\n });\n const running = (prefix, leftover) => core.pipeTo(channel.zipRight(core.write(leftover), channel.identityChannel()), toChannel(f(prefix)));\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(buffering(Chunk.empty()))));\n}));\n/** @internal */\nexport const broadcast = /*#__PURE__*/dual(3, (self, n, maximumLag) => pipe(self, broadcastedQueues(n, maximumLag), Effect.map(tuple => tuple.map(queue => flattenTake(fromQueue(queue, {\n shutdown: true\n}))))));\n/** @internal */\nexport const broadcastDynamic = /*#__PURE__*/dual(2, (self, maximumLag) => Effect.map(toPubSub(self, maximumLag), pubsub => flattenTake(fromPubSub(pubsub))));\nexport const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.make({\n acquire: broadcastDynamic(self, options),\n idleTimeToLive: options.idleTimeToLive\n}), rcRef => unwrapScoped(RcRef.get(rcRef))));\n/** @internal */\nexport const broadcastedQueues = /*#__PURE__*/dual(3, (self, n, maximumLag) => Effect.flatMap(pubsubFromOptions(maximumLag), pubsub => pipe(Effect.all(Array.from({\n length: n\n}, () => PubSub.subscribe(pubsub))), Effect.tap(() => Effect.forkScoped(runIntoPubSubScoped(self, pubsub))))));\n/** @internal */\nexport const broadcastedQueuesDynamic = /*#__PURE__*/dual(2, (self, maximumLag) => Effect.map(toPubSub(self, maximumLag), PubSub.subscribe));\n/** @internal */\nexport const buffer = /*#__PURE__*/dual(2, (self, options) => {\n if (options.capacity === \"unbounded\") {\n return bufferUnbounded(self);\n } else if (options.strategy === \"dropping\") {\n return bufferDropping(self, options.capacity);\n } else if (options.strategy === \"sliding\") {\n return bufferSliding(self, options.capacity);\n }\n const queue = toQueueOfElements(self, options);\n return new StreamImpl(channel.unwrapScoped(Effect.map(queue, queue => {\n const process = pipe(core.fromEffect(Queue.take(queue)), core.flatMap(Exit.match({\n onFailure: cause => pipe(Cause.flipCauseOption(cause), Option.match({\n onNone: () => core.void,\n onSome: core.failCause\n })),\n onSuccess: value => core.flatMap(core.write(Chunk.of(value)), () => process)\n })));\n return process;\n })));\n});\n/** @internal */\nexport const bufferChunks = /*#__PURE__*/dual(2, (self, options) => {\n if (options.strategy === \"dropping\") {\n return bufferChunksDropping(self, options.capacity);\n } else if (options.strategy === \"sliding\") {\n return bufferChunksSliding(self, options.capacity);\n }\n const queue = toQueue(self, options);\n return new StreamImpl(channel.unwrapScoped(Effect.map(queue, queue => {\n const process = pipe(core.fromEffect(Queue.take(queue)), core.flatMap(InternalTake.match({\n onEnd: () => core.void,\n onFailure: core.failCause,\n onSuccess: value => pipe(core.write(value), core.flatMap(() => process))\n })));\n return process;\n })));\n});\nconst bufferChunksDropping = /*#__PURE__*/dual(2, (self, capacity) => {\n const queue = Effect.acquireRelease(Queue.dropping(capacity), queue => Queue.shutdown(queue));\n return new StreamImpl(bufferSignal(queue, toChannel(self)));\n});\nconst bufferChunksSliding = /*#__PURE__*/dual(2, (self, capacity) => {\n const queue = Effect.acquireRelease(Queue.sliding(capacity), queue => Queue.shutdown(queue));\n return new StreamImpl(bufferSignal(queue, toChannel(self)));\n});\nconst bufferDropping = /*#__PURE__*/dual(2, (self, capacity) => {\n const queue = Effect.acquireRelease(Queue.dropping(capacity), queue => Queue.shutdown(queue));\n return new StreamImpl(bufferSignal(queue, toChannel(rechunk(1)(self))));\n});\nconst bufferSliding = /*#__PURE__*/dual(2, (self, capacity) => {\n const queue = Effect.acquireRelease(Queue.sliding(capacity), queue => Queue.shutdown(queue));\n return new StreamImpl(bufferSignal(queue, toChannel(pipe(self, rechunk(1)))));\n});\nconst bufferUnbounded = self => {\n const queue = toQueue(self, {\n strategy: \"unbounded\"\n });\n return new StreamImpl(channel.unwrapScoped(Effect.map(queue, queue => {\n const process = pipe(core.fromEffect(Queue.take(queue)), core.flatMap(InternalTake.match({\n onEnd: () => core.void,\n onFailure: core.failCause,\n onSuccess: value => core.flatMap(core.write(value), () => process)\n })));\n return process;\n })));\n};\nconst bufferSignal = (scoped, bufferChannel) => {\n const producer = (queue, ref) => {\n const terminate = take => pipe(Ref.get(ref), Effect.tap(Deferred.await), Effect.zipRight(Deferred.make()), Effect.flatMap(deferred => pipe(Queue.offer(queue, [take, deferred]), Effect.zipRight(Ref.set(ref, deferred)), Effect.zipRight(Deferred.await(deferred)))), Effect.asVoid, core.fromEffect);\n return core.readWithCause({\n onInput: input => pipe(Deferred.make(), Effect.flatMap(deferred => pipe(Queue.offer(queue, [InternalTake.chunk(input), deferred]), Effect.flatMap(added => pipe(Ref.set(ref, deferred), Effect.when(() => added))))), Effect.asVoid, core.fromEffect, core.flatMap(() => producer(queue, ref))),\n onFailure: error => terminate(InternalTake.failCause(error)),\n onDone: () => terminate(InternalTake.end)\n });\n };\n const consumer = queue => {\n const process = pipe(core.fromEffect(Queue.take(queue)), core.flatMap(([take, deferred]) => channel.zipRight(core.fromEffect(Deferred.succeed(deferred, void 0)), InternalTake.match(take, {\n onEnd: () => core.void,\n onFailure: core.failCause,\n onSuccess: value => pipe(core.write(value), core.flatMap(() => process))\n }))));\n return process;\n };\n return channel.unwrapScoped(pipe(scoped, Effect.flatMap(queue => pipe(Deferred.make(), Effect.tap(start => Deferred.succeed(start, void 0)), Effect.flatMap(start => pipe(Ref.make(start), Effect.flatMap(ref => pipe(bufferChannel, core.pipeTo(producer(queue, ref)), channel.runScoped, Effect.forkScoped)), Effect.as(consumer(queue))))))));\n};\n/** @internal */\nexport const catchAll = /*#__PURE__*/dual(2, (self, f) => catchAllCause(self, cause => Either.match(Cause.failureOrCause(cause), {\n onLeft: f,\n onRight: failCause\n})));\n/** @internal */\nexport const catchAllCause = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), core.catchAllCause(cause => toChannel(f(cause))))));\n/** @internal */\nexport const catchSome = /*#__PURE__*/dual(2, (self, pf) => pipe(self, catchAll(error => pipe(pf(error), Option.getOrElse(() => fail(error))))));\n/** @internal */\nexport const catchSomeCause = /*#__PURE__*/dual(2, (self, pf) => pipe(self, catchAllCause(cause => pipe(pf(cause), Option.getOrElse(() => failCause(cause))))));\n/* @internal */\nexport const catchTag = /*#__PURE__*/dual(3, (self, k, f) => catchAll(self, e => {\n if (\"_tag\" in e && e[\"_tag\"] === k) {\n return f(e);\n }\n return fail(e);\n}));\n/** @internal */\nexport const catchTags = /*#__PURE__*/dual(2, (self, cases) => catchAll(self, e => {\n const keys = Object.keys(cases);\n if (\"_tag\" in e && keys.includes(e[\"_tag\"])) {\n return cases[e[\"_tag\"]](e);\n }\n return fail(e);\n}));\n/** @internal */\nexport const changes = self => pipe(self, changesWith((x, y) => Equal.equals(y)(x)));\n/** @internal */\nexport const changesWith = /*#__PURE__*/dual(2, (self, f) => {\n const writer = last => core.readWithCause({\n onInput: input => {\n const [newLast, newChunk] = Chunk.reduce(input, [last, Chunk.empty()], ([option, outputs], output) => {\n if (Option.isSome(option) && f(option.value, output)) {\n return [Option.some(output), outputs];\n }\n return [Option.some(output), pipe(outputs, Chunk.append(output))];\n });\n return core.flatMap(core.write(newChunk), () => writer(newLast));\n },\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(writer(Option.none()))));\n});\n/** @internal */\nexport const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => {\n const writer = last => core.readWithCause({\n onInput: input => pipe(input, Effect.reduce([last, Chunk.empty()], ([option, outputs], output) => {\n if (Option.isSome(option)) {\n return pipe(f(option.value, output), Effect.map(bool => bool ? [Option.some(output), outputs] : [Option.some(output), pipe(outputs, Chunk.append(output))]));\n }\n return Effect.succeed([Option.some(output), pipe(outputs, Chunk.append(output))]);\n }), core.fromEffect, core.flatMap(([newLast, newChunk]) => pipe(core.write(newChunk), core.flatMap(() => writer(newLast))))),\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(writer(Option.none()))));\n});\n/** @internal */\nexport const chunks = self => pipe(self, mapChunks(Chunk.of));\n/** @internal */\nexport const chunksWith = /*#__PURE__*/dual(2, (self, f) => flattenChunks(f(chunks(self))));\nconst unsome = effect => Effect.catchAll(Effect.asSome(effect), o => o._tag === \"None\" ? Effect.succeedNone : Effect.fail(o.value));\n/** @internal */\nexport const combine = /*#__PURE__*/dual(4, (self, that, s, f) => {\n function producer(handoff, latch) {\n return core.fromEffect(Handoff.take(latch)).pipe(channel.zipRight(core.readWithCause({\n onInput: input => core.flatMap(core.fromEffect(Handoff.offer(handoff, Exit.succeed(input))), () => producer(handoff, latch)),\n onFailure: cause => core.fromEffect(Handoff.offer(handoff, Exit.failCause(pipe(cause, Cause.map(Option.some))))),\n onDone: () => core.flatMap(core.fromEffect(Handoff.offer(handoff, Exit.fail(Option.none()))), () => producer(handoff, latch))\n })));\n }\n return new StreamImpl(channel.unwrapScopedWith(scope => Effect.all([Handoff.make(), Handoff.make(), Handoff.make(), Handoff.make()]).pipe(Effect.tap(([left, _, latchL]) => toChannel(self).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(left, latchL)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.tap(([, right, _, rightL]) => toChannel(that).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(right, rightL)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.map(([left, right, latchL, latchR]) => {\n const pullLeft = Handoff.offer(latchL, void 0).pipe(Effect.zipRight(Handoff.take(left).pipe(Effect.flatMap(identity))));\n const pullRight = Handoff.offer(latchR, void 0).pipe(Effect.zipRight(Handoff.take(right).pipe(Effect.flatMap(identity))));\n return toChannel(unfoldEffect(s, s => Effect.flatMap(f(s, pullLeft, pullRight), unsome)));\n }))));\n});\n/** @internal */\nexport const combineChunks = /*#__PURE__*/dual(4, (self, that, s, f) => {\n const producer = (handoff, latch) => channel.zipRight(core.fromEffect(Handoff.take(latch)), core.readWithCause({\n onInput: input => core.flatMap(core.fromEffect(pipe(handoff, Handoff.offer(InternalTake.chunk(input)))), () => producer(handoff, latch)),\n onFailure: cause => core.fromEffect(Handoff.offer(handoff, InternalTake.failCause(cause))),\n onDone: () => core.fromEffect(Handoff.offer(handoff, InternalTake.end))\n }));\n return new StreamImpl(channel.unwrapScopedWith(scope => Effect.all([Handoff.make(), Handoff.make(), Handoff.make(), Handoff.make()]).pipe(Effect.tap(([left, _, latchL]) => core.pipeTo(toChannel(self), producer(left, latchL)).pipe(channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.tap(([_, right, __, latchR]) => core.pipeTo(toChannel(that), producer(right, latchR)).pipe(channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.map(([left, right, latchL, latchR]) => {\n const pullLeft = Handoff.offer(latchL, void 0).pipe(Effect.zipRight(Handoff.take(left).pipe(Effect.flatMap(InternalTake.done))));\n const pullRight = Handoff.offer(latchR, void 0).pipe(Effect.zipRight(Handoff.take(right).pipe(Effect.flatMap(InternalTake.done))));\n return toChannel(unfoldChunkEffect(s, s => Effect.flatMap(f(s, pullLeft, pullRight), unsome)));\n }))));\n});\n/** @internal */\nexport const concat = /*#__PURE__*/dual(2, (self, that) => new StreamImpl(pipe(toChannel(self), channel.zipRight(toChannel(that)))));\n/** @internal */\nexport const concatAll = streams => suspend(() => pipe(streams, Chunk.reduce(empty, (x, y) => concat(y)(x))));\n/** @internal */\nexport const cross = /*#__PURE__*/dual(2, (left, right) => pipe(left, crossWith(right, (a, a2) => [a, a2])));\n/** @internal */\nexport const crossLeft = /*#__PURE__*/dual(2, (left, right) => pipe(left, crossWith(right, (a, _) => a)));\n/** @internal */\nexport const crossRight = /*#__PURE__*/dual(2, (left, right) => flatMap(left, () => right));\n/** @internal */\nexport const crossWith = /*#__PURE__*/dual(3, (left, right, f) => pipe(left, flatMap(a => pipe(right, map(b => f(a, b))))));\n/** @internal */\nexport const debounce = /*#__PURE__*/dual(2, (self, duration) => unwrapScopedWith(scope => Effect.gen(function* () {\n const handoff = yield* Handoff.make();\n function enqueue(last) {\n return Clock.sleep(duration).pipe(Effect.as(last), Effect.forkIn(scope), Effect.map(fiber => consumer(DebounceState.previous(fiber))));\n }\n const producer = core.readWithCause({\n onInput: input => Option.match(Chunk.last(input), {\n onNone: () => producer,\n onSome: elem => core.fromEffect(Handoff.offer(handoff, HandoffSignal.emit(Chunk.of(elem)))).pipe(core.flatMap(() => producer))\n }),\n onFailure: cause => core.fromEffect(Handoff.offer(handoff, HandoffSignal.halt(cause))),\n onDone: () => core.fromEffect(Handoff.offer(handoff, HandoffSignal.end(SinkEndReason.UpstreamEnd)))\n });\n function consumer(state) {\n switch (state._tag) {\n case DebounceState.OP_NOT_STARTED:\n {\n return channel.unwrap(Handoff.take(handoff).pipe(Effect.map(signal => {\n switch (signal._tag) {\n case HandoffSignal.OP_EMIT:\n {\n return channel.unwrap(enqueue(signal.elements));\n }\n case HandoffSignal.OP_HALT:\n {\n return core.failCause(signal.cause);\n }\n case HandoffSignal.OP_END:\n {\n return core.void;\n }\n }\n })));\n }\n case DebounceState.OP_PREVIOUS:\n {\n return channel.unwrap(Handoff.take(handoff).pipe(Effect.forkIn(scope), Effect.flatMap(handoffFiber => Effect.raceWith(Fiber.join(state.fiber), Fiber.join(handoffFiber), {\n onSelfDone: (leftExit, current) => Exit.match(leftExit, {\n onFailure: cause => Fiber.interrupt(current).pipe(Effect.as(core.failCause(cause))),\n onSuccess: chunk => Fiber.interrupt(current).pipe(Effect.zipRight(Effect.succeed(core.write(chunk).pipe(core.flatMap(() => consumer(DebounceState.current(handoffFiber)))))))\n }),\n onOtherDone: (rightExit, previous) => Exit.match(rightExit, {\n onFailure: cause => Fiber.interrupt(previous).pipe(Effect.as(core.failCause(cause))),\n onSuccess: signal => {\n switch (signal._tag) {\n case HandoffSignal.OP_EMIT:\n {\n return Fiber.interrupt(previous).pipe(Effect.zipRight(enqueue(signal.elements)));\n }\n case HandoffSignal.OP_HALT:\n {\n return Fiber.interrupt(previous).pipe(Effect.as(core.failCause(signal.cause)));\n }\n case HandoffSignal.OP_END:\n {\n return Fiber.join(previous).pipe(Effect.map(chunk => core.write(chunk).pipe(channel.zipRight(core.void))));\n }\n }\n }\n })\n }))));\n }\n case DebounceState.OP_CURRENT:\n {\n return channel.unwrap(Fiber.join(state.fiber).pipe(Effect.map(signal => {\n switch (signal._tag) {\n case HandoffSignal.OP_EMIT:\n {\n return channel.unwrap(enqueue(signal.elements));\n }\n case HandoffSignal.OP_HALT:\n {\n return core.failCause(signal.cause);\n }\n case HandoffSignal.OP_END:\n {\n return core.void;\n }\n }\n })));\n }\n }\n }\n return scopedWith(scope => core.pipeTo(toChannel(self), producer).pipe(channelExecutor.runIn(scope), Effect.forkIn(scope))).pipe(crossRight(new StreamImpl(consumer(DebounceState.notStarted))));\n})));\n/** @internal */\nexport const die = defect => fromEffect(Effect.die(defect));\n/** @internal */\nexport const dieSync = evaluate => fromEffect(Effect.dieSync(evaluate));\n/** @internal */\nexport const dieMessage = message => fromEffect(Effect.dieMessage(message));\n/** @internal */\nexport const distributedWith = /*#__PURE__*/dual(2, (self, options) => pipe(Deferred.make(), Effect.flatMap(deferred => pipe(self, distributedWithDynamic({\n maximumLag: options.maximumLag,\n decide: a => Effect.flatMap(Deferred.await(deferred), f => f(a))\n}), Effect.flatMap(next => pipe(Effect.all(Chunk.map(Chunk.range(0, options.size - 1), id => Effect.map(next, ([key, queue]) => [[key, id], queue]))), Effect.map(Chunk.unsafeFromArray), Effect.flatMap(entries => {\n const [mappings, queues] = Chunk.reduceRight(entries, [new Map(), Chunk.empty()], ([mappings, queues], [mapping, queue]) => [mappings.set(mapping[0], mapping[1]), pipe(queues, Chunk.prepend(queue))]);\n return pipe(Deferred.succeed(deferred, a => Effect.map(options.decide(a), f => key => f(mappings.get(key)))), Effect.as(Array.from(queues)));\n})))))));\n/** @internal */\nconst distributedWithDynamicId = {\n ref: 0\n};\nconst newDistributedWithDynamicId = () => {\n const current = distributedWithDynamicId.ref;\n distributedWithDynamicId.ref = current + 1;\n return current;\n};\n/** @internal */\nexport const distributedWithDynamic = /*#__PURE__*/dual(2, (self, options) => distributedWithDynamicCallback(self, options.maximumLag, options.decide, () => Effect.void));\n/** @internal */\nexport const distributedWithDynamicCallback = /*#__PURE__*/dual(4, (self, maximumLag, decide, done) => pipe(Effect.acquireRelease(Ref.make(new Map()), (ref, _) => pipe(Ref.get(ref), Effect.flatMap(queues => pipe(queues.values(), Effect.forEach(Queue.shutdown))))), Effect.flatMap(queuesRef => Effect.gen(function* () {\n const offer = a => pipe(decide(a), Effect.flatMap(shouldProcess => pipe(Ref.get(queuesRef), Effect.flatMap(queues => pipe(queues.entries(), Effect.reduce(Chunk.empty(), (acc, [id, queue]) => {\n if (shouldProcess(id)) {\n return pipe(Queue.offer(queue, Exit.succeed(a)), Effect.matchCauseEffect({\n onFailure: cause =>\n // Ignore all downstream queues that were shut\n // down and remove them later\n Cause.isInterrupted(cause) ? Effect.succeed(pipe(acc, Chunk.prepend(id))) : Effect.failCause(cause),\n onSuccess: () => Effect.succeed(acc)\n }));\n }\n return Effect.succeed(acc);\n }), Effect.flatMap(ids => {\n if (Chunk.isNonEmpty(ids)) {\n return Ref.update(queuesRef, map => {\n for (const id of ids) {\n map.delete(id);\n }\n return map;\n });\n }\n return Effect.void;\n }))))), Effect.asVoid);\n const queuesLock = yield* Effect.makeSemaphore(1);\n const newQueue = yield* Ref.make(pipe(Queue.bounded(maximumLag), Effect.flatMap(queue => {\n const id = newDistributedWithDynamicId();\n return pipe(Ref.update(queuesRef, map => map.set(id, queue)), Effect.as([id, queue]));\n })));\n const finalize = endTake =>\n // Make sure that no queues are currently being added\n queuesLock.withPermits(1)(pipe(Ref.set(newQueue, pipe(\n // All newly created queues should end immediately\n Queue.bounded(1), Effect.tap(queue => Queue.offer(queue, endTake)), Effect.flatMap(queue => {\n const id = newDistributedWithDynamicId();\n return pipe(Ref.update(queuesRef, map => map.set(id, queue)), Effect.as(Tuple.make(id, queue)));\n }))), Effect.zipRight(pipe(Ref.get(queuesRef), Effect.flatMap(map => pipe(Chunk.fromIterable(map.values()), Effect.forEach(queue => pipe(Queue.offer(queue, endTake), Effect.catchSomeCause(cause => Cause.isInterrupted(cause) ? Option.some(Effect.void) : Option.none()))))))), Effect.zipRight(done(endTake)), Effect.asVoid));\n yield* pipe(self, runForEachScoped(offer), Effect.matchCauseEffect({\n onFailure: cause => finalize(Exit.failCause(pipe(cause, Cause.map(Option.some)))),\n onSuccess: () => finalize(Exit.fail(Option.none()))\n }), Effect.forkScoped);\n return queuesLock.withPermits(1)(Effect.flatten(Ref.get(newQueue)));\n}))));\n/** @internal */\nexport const drain = self => new StreamImpl(channel.drain(toChannel(self)));\n/** @internal */\nexport const drainFork = /*#__PURE__*/dual(2, (self, that) => fromEffect(Deferred.make()).pipe(flatMap(backgroundDied => scopedWith(scope => toChannel(that).pipe(channel.drain, channelExecutor.runIn(scope), Effect.catchAllCause(cause => Deferred.failCause(backgroundDied, cause)), Effect.forkIn(scope))).pipe(crossRight(interruptWhenDeferred(self, backgroundDied))))));\n/** @internal */\nexport const drop = /*#__PURE__*/dual(2, (self, n) => {\n const loop = r => core.readWith({\n onInput: input => {\n const dropped = pipe(input, Chunk.drop(r));\n const leftover = Math.max(0, r - input.length);\n const more = Chunk.isEmpty(input) || leftover > 0;\n if (more) {\n return loop(leftover);\n }\n return pipe(core.write(dropped), channel.zipRight(channel.identityChannel()));\n },\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(loop(n))));\n});\n/** @internal */\nexport const dropRight = /*#__PURE__*/dual(2, (self, n) => {\n if (n <= 0) {\n return identityStream();\n }\n return suspend(() => {\n const queue = new RingBuffer(n);\n const reader = core.readWith({\n onInput: input => {\n const outputs = pipe(input, Chunk.filterMap(elem => {\n const head = queue.head();\n queue.put(elem);\n return head;\n }));\n return pipe(core.write(outputs), core.flatMap(() => reader));\n },\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(reader)));\n });\n});\n/** @internal */\nexport const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhile(self, a => !predicate(a)), 1));\n/** @internal */\nexport const dropUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = core.readWith({\n onInput: input => pipe(Effect.dropUntil(input, predicate), Effect.map(Chunk.unsafeFromArray), Effect.map(leftover => {\n const more = Chunk.isEmpty(leftover);\n if (more) {\n return core.suspend(() => loop);\n }\n return pipe(core.write(leftover), channel.zipRight(channel.identityChannel()));\n }), channel.unwrap),\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(loop)));\n});\n/** @internal */\nexport const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = core.readWith({\n onInput: input => {\n const output = Chunk.dropWhile(input, predicate);\n if (Chunk.isEmpty(output)) {\n return core.suspend(() => loop);\n }\n return channel.zipRight(core.write(output), channel.identityChannel());\n },\n onFailure: core.fail,\n onDone: core.succeedNow\n });\n return new StreamImpl(channel.pipeToOrFail(toChannel(self), loop));\n});\n/** @internal */\nexport const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = core.readWith({\n onInput: input => pipe(Effect.dropWhile(input, predicate), Effect.map(Chunk.unsafeFromArray), Effect.map(leftover => {\n const more = Chunk.isEmpty(leftover);\n if (more) {\n return core.suspend(() => loop);\n }\n return channel.zipRight(core.write(leftover), channel.identityChannel());\n }), channel.unwrap),\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(channel.pipeToOrFail(toChannel(self), loop));\n});\n/** @internal */\nexport const either = self => pipe(self, map(Either.right), catchAll(error => make(Either.left(error))));\n/** @internal */\nexport const empty = /*#__PURE__*/new StreamImpl(core.void);\n/** @internal */\nexport const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => new StreamImpl(pipe(toChannel(self), channel.ensuring(finalizer))));\n/** @internal */\nexport const ensuringWith = /*#__PURE__*/dual(2, (self, finalizer) => new StreamImpl(core.ensuringWith(toChannel(self), finalizer)));\n/** @internal */\nexport const context = () => fromEffect(Effect.context());\n/** @internal */\nexport const contextWith = f => pipe(context(), map(f));\n/** @internal */\nexport const contextWithEffect = f => pipe(context(), mapEffectSequential(f));\n/** @internal */\nexport const contextWithStream = f => pipe(context(), flatMap(f));\n/** @internal */\nexport const execute = effect => drain(fromEffect(effect));\n/** @internal */\nexport const fail = error => fromEffectOption(Effect.fail(Option.some(error)));\n/** @internal */\nexport const failSync = evaluate => fromEffectOption(Effect.failSync(() => Option.some(evaluate())));\n/** @internal */\nexport const failCause = cause => fromEffect(Effect.failCause(cause));\n/** @internal */\nexport const failCauseSync = evaluate => fromEffect(Effect.failCauseSync(evaluate));\n/** @internal */\nexport const filter = /*#__PURE__*/dual(2, (self, predicate) => mapChunks(self, Chunk.filter(predicate)));\n/** @internal */\nexport const filterEffect = /*#__PURE__*/dual(2, (self, f) => {\n const loop = iterator => {\n const next = iterator.next();\n if (next.done) {\n return core.readWithCause({\n onInput: input => loop(input[Symbol.iterator]()),\n onFailure: core.failCause,\n onDone: core.succeed\n });\n } else {\n return pipe(f(next.value), Effect.map(bool => bool ? pipe(core.write(Chunk.of(next.value)), core.flatMap(() => loop(iterator))) : loop(iterator)), channel.unwrap);\n }\n };\n return new StreamImpl(core.suspend(() => pipe(toChannel(self), core.pipeTo(loop(Chunk.empty()[Symbol.iterator]())))));\n});\n/** @internal */\nexport const filterMap = /*#__PURE__*/dual(2, (self, pf) => mapChunks(self, Chunk.filterMap(pf)));\n/** @internal */\nexport const filterMapEffect = /*#__PURE__*/dual(2, (self, pf) => suspend(() => {\n const loop = iterator => {\n const next = iterator.next();\n if (next.done) {\n return core.readWithCause({\n onInput: input => loop(input[Symbol.iterator]()),\n onFailure: core.failCause,\n onDone: core.succeed\n });\n } else {\n return pipe(pf(next.value), Option.match({\n onNone: () => Effect.sync(() => loop(iterator)),\n onSome: Effect.map(a2 => core.flatMap(core.write(Chunk.of(a2)), () => loop(iterator)))\n }), channel.unwrap);\n }\n };\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(loop(Chunk.empty()[Symbol.iterator]()))));\n}));\n/** @internal */\nexport const filterMapWhile = /*#__PURE__*/dual(2, (self, pf) => {\n const loop = core.readWith({\n onInput: input => {\n const mapped = Chunk.filterMapWhile(input, pf);\n if (mapped.length === input.length) {\n return pipe(core.write(mapped), core.flatMap(() => loop));\n }\n return core.write(mapped);\n },\n onFailure: core.fail,\n onDone: core.succeed\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(loop)));\n});\n/** @internal */\nexport const filterMapWhileEffect = /*#__PURE__*/dual(2, (self, pf) => suspend(() => {\n const loop = iterator => {\n const next = iterator.next();\n if (next.done) {\n return core.readWithCause({\n onInput: input => loop(input[Symbol.iterator]()),\n onFailure: core.failCause,\n onDone: core.succeed\n });\n } else {\n return channel.unwrap(Option.match(pf(next.value), {\n onNone: () => Effect.succeed(core.void),\n onSome: Effect.map(a2 => core.flatMap(core.write(Chunk.of(a2)), () => loop(iterator)))\n }));\n }\n };\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(loop(Chunk.empty()[Symbol.iterator]()))));\n}));\n/** @internal */\nexport const finalizer = finalizer => acquireRelease(Effect.void, () => finalizer);\n/** @internal */\nexport const find = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = core.readWith({\n onInput: input => Option.match(Chunk.findFirst(input, predicate), {\n onNone: () => loop,\n onSome: n => core.write(Chunk.of(n))\n }),\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(loop)));\n});\n/** @internal */\nexport const findEffect = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = core.readWith({\n onInput: input => pipe(Effect.findFirst(input, predicate), Effect.map(Option.match({\n onNone: () => loop,\n onSome: n => core.write(Chunk.of(n))\n })), channel.unwrap),\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(loop)));\n});\n/** @internal */\nexport const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => {\n const bufferSize = options?.bufferSize ?? 16;\n if (options?.switch) {\n return matchConcurrency(options?.concurrency, () => flatMapParSwitchBuffer(self, 1, bufferSize, f), n => flatMapParSwitchBuffer(self, n, bufferSize, f));\n }\n return matchConcurrency(options?.concurrency, () => new StreamImpl(channel.concatMap(toChannel(self), as => pipe(as, Chunk.map(a => toChannel(f(a))), Chunk.reduce(core.void, (left, right) => pipe(left, channel.zipRight(right)))))), _ => new StreamImpl(pipe(toChannel(self), channel.concatMap(channel.writeChunk), channel.mergeMap(out => toChannel(f(out)), options))));\n});\n/** @internal */\nexport const matchConcurrency = (concurrency, sequential, bounded) => {\n switch (concurrency) {\n case undefined:\n return sequential();\n case \"unbounded\":\n return bounded(Number.MAX_SAFE_INTEGER);\n default:\n return concurrency > 1 ? bounded(concurrency) : sequential();\n }\n};\nconst flatMapParSwitchBuffer = /*#__PURE__*/dual(4, (self, n, bufferSize, f) => new StreamImpl(pipe(toChannel(self), channel.concatMap(channel.writeChunk), channel.mergeMap(out => toChannel(f(out)), {\n concurrency: n,\n mergeStrategy: MergeStrategy.BufferSliding(),\n bufferSize\n}))));\n/** @internal */\nexport const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => flatMap(self, identity, options));\n/** @internal */\nexport const flattenChunks = self => {\n const flatten = core.readWithCause({\n onInput: chunks => core.flatMap(channel.writeChunk(chunks), () => flatten),\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(flatten)));\n};\n/** @internal */\nexport const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => options?.unordered ? flatMap(self, a => fromEffect(a), {\n concurrency: options.concurrency\n}) : matchConcurrency(options?.concurrency, () => mapEffectSequential(self, identity), n => new StreamImpl(pipe(toChannel(self), channel.concatMap(channel.writeChunk), channel.mapOutEffectPar(identity, n), channel.mapOut(Chunk.of)))));\n/** @internal */\nexport const flattenExitOption = self => {\n const processChunk = (chunk, cont) => {\n const [toEmit, rest] = pipe(chunk, Chunk.splitWhere(exit => !Exit.isSuccess(exit)));\n const next = pipe(Chunk.head(rest), Option.match({\n onNone: () => cont,\n onSome: Exit.match({\n onFailure: cause => Option.match(Cause.flipCauseOption(cause), {\n onNone: () => core.void,\n onSome: core.failCause\n }),\n onSuccess: () => core.void\n })\n }));\n return pipe(core.write(pipe(toEmit, Chunk.filterMap(exit => Exit.isSuccess(exit) ? Option.some(exit.value) : Option.none()))), core.flatMap(() => next));\n };\n const process = core.readWithCause({\n onInput: chunk => processChunk(chunk, process),\n onFailure: cause => core.failCause(cause),\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(process)));\n};\n/** @internal */\nexport const flattenIterables = self => pipe(self, map(Chunk.fromIterable), flattenChunks);\n/** @internal */\nexport const flattenTake = self => flattenChunks(flattenExitOption(pipe(self, map(take => take.exit))));\n/** @internal */\nexport const forever = self => new StreamImpl(channel.repeated(toChannel(self)));\n/** @internal */\nexport const fromAsyncIterable = (iterable, onError) => pipe(Effect.acquireRelease(Effect.sync(() => iterable[Symbol.asyncIterator]()), iterator => iterator.return ? Effect.promise(async () => iterator.return()) : Effect.void), Effect.map(iterator => repeatEffectOption(pipe(Effect.tryPromise({\n try: async () => iterator.next(),\n catch: reason => Option.some(onError(reason))\n}), Effect.flatMap(result => result.done ? Effect.fail(Option.none()) : Effect.succeed(result.value))))), unwrapScoped);\n/** @internal */\nexport const fromChannel = channel => new StreamImpl(channel);\n/** @internal */\nexport const toChannel = stream => {\n if (\"channel\" in stream) {\n return stream.channel;\n } else if (Effect.isEffect(stream)) {\n return toChannel(fromEffect(stream));\n } else {\n throw new TypeError(`Expected a Stream.`);\n }\n};\n/** @internal */\nexport const fromChunk = chunk => new StreamImpl(Chunk.isEmpty(chunk) ? core.void : core.write(chunk));\n/** @internal */\nexport const fromChunkPubSub = (pubsub, options) => {\n if (options?.scoped) {\n const effect = Effect.map(PubSub.subscribe(pubsub), fromChunkQueue);\n return options.shutdown ? Effect.map(effect, ensuring(PubSub.shutdown(pubsub))) : effect;\n }\n const stream = flatMap(scoped(PubSub.subscribe(pubsub)), fromChunkQueue);\n return options?.shutdown ? ensuring(stream, PubSub.shutdown(pubsub)) : stream;\n};\n/** @internal */\nexport const fromChunkQueue = (queue, options) => pipe(Queue.take(queue), Effect.catchAllCause(cause => pipe(Queue.isShutdown(queue), Effect.flatMap(isShutdown => isShutdown && Cause.isInterrupted(cause) ? pull.end() : pull.failCause(cause)))), repeatEffectChunkOption, options?.shutdown ? ensuring(Queue.shutdown(queue)) : identity);\n/** @internal */\nexport const fromChunks = (...chunks) => pipe(fromIterable(chunks), flatMap(fromChunk));\n/** @internal */\nexport const fromEffect = effect => pipe(effect, Effect.mapError(Option.some), fromEffectOption);\n/** @internal */\nexport const fromEffectOption = effect => new StreamImpl(channel.unwrap(Effect.match(effect, {\n onFailure: Option.match({\n onNone: () => core.void,\n onSome: core.fail\n }),\n onSuccess: a => core.write(Chunk.of(a))\n})));\n/** @internal */\nexport const fromPubSub = (pubsub, options) => {\n const maxChunkSize = options?.maxChunkSize ?? DefaultChunkSize;\n if (options?.scoped) {\n const effect = Effect.map(PubSub.subscribe(pubsub), queue => fromQueue(queue, {\n maxChunkSize,\n shutdown: true\n }));\n return options.shutdown ? Effect.map(effect, ensuring(PubSub.shutdown(pubsub))) : effect;\n }\n const stream = flatMap(scoped(PubSub.subscribe(pubsub)), queue => fromQueue(queue, {\n maxChunkSize\n }));\n return options?.shutdown ? ensuring(stream, PubSub.shutdown(pubsub)) : stream;\n};\n/** @internal */\nexport const fromTPubSub = pubsub => {\n return unwrapScoped(Effect.map(TPubSub.subscribeScoped(pubsub), queue => fromTQueue(queue)));\n};\n/** @internal */\nexport const fromIterable = iterable => suspend(() => Chunk.isChunk(iterable) ? fromChunk(iterable) : fromIteratorSucceed(iterable[Symbol.iterator]()));\n/** @internal */\nexport const fromIterableEffect = effect => pipe(effect, Effect.map(fromIterable), unwrap);\n/** @internal */\nexport const fromIteratorSucceed = (iterator, maxChunkSize = DefaultChunkSize) => {\n return pipe(Effect.sync(() => {\n let builder = [];\n const loop = iterator => pipe(Effect.sync(() => {\n let next = iterator.next();\n if (maxChunkSize === 1) {\n if (next.done) {\n return core.void;\n }\n return pipe(core.write(Chunk.of(next.value)), core.flatMap(() => loop(iterator)));\n }\n builder = [];\n let count = 0;\n while (next.done === false) {\n builder.push(next.value);\n count = count + 1;\n if (count >= maxChunkSize) {\n break;\n }\n next = iterator.next();\n }\n if (count > 0) {\n return pipe(core.write(Chunk.unsafeFromArray(builder)), core.flatMap(() => loop(iterator)));\n }\n return core.void;\n }), channel.unwrap);\n return new StreamImpl(loop(iterator));\n }), unwrap);\n};\n/** @internal */\nexport const fromPull = effect => pipe(effect, Effect.map(repeatEffectChunkOption), unwrapScoped);\n/** @internal */\nexport const fromQueue = (queue, options) => pipe(Queue.takeBetween(queue, 1, options?.maxChunkSize ?? DefaultChunkSize), Effect.catchAllCause(cause => pipe(Queue.isShutdown(queue), Effect.flatMap(isShutdown => isShutdown && Cause.isInterrupted(cause) ? pull.end() : pull.failCause(cause)))), repeatEffectChunkOption, options?.shutdown ? ensuring(Queue.shutdown(queue)) : identity);\n/** @internal */\nexport const fromTQueue = queue => pipe(TQueue.take(queue), Effect.map(Chunk.of), Effect.catchAllCause(cause => pipe(TQueue.isShutdown(queue), Effect.flatMap(isShutdown => isShutdown && Cause.isInterrupted(cause) ? pull.end() : pull.failCause(cause)))), repeatEffectChunkOption);\n/** @internal */\nexport const fromSchedule = schedule => pipe(Schedule.driver(schedule), Effect.map(driver => repeatEffectOption(driver.next(void 0))), unwrap);\n/** @internal */\nexport const fromReadableStream = (...args) => {\n const evaluate = args.length === 1 ? args[0].evaluate : args[0];\n const onError = args.length === 1 ? args[0].onError : args[1];\n const releaseLockOnEnd = args.length === 1 ? args[0].releaseLockOnEnd === true : false;\n return unwrapScoped(Effect.map(Effect.acquireRelease(Effect.sync(() => evaluate().getReader()), reader => releaseLockOnEnd ? Effect.sync(() => reader.releaseLock()) : Effect.promise(() => reader.cancel())), reader => repeatEffectOption(Effect.flatMap(Effect.tryPromise({\n try: () => reader.read(),\n catch: reason => Option.some(onError(reason))\n }), ({\n done,\n value\n }) => done ? Effect.fail(Option.none()) : Effect.succeed(value)))));\n};\n/** @internal */\nexport const fromReadableStreamByob = (...args) => {\n const evaluate = args.length === 1 ? args[0].evaluate : args[0];\n const onError = args.length === 1 ? args[0].onError : args[1];\n const allocSize = (args.length === 1 ? args[0].bufferSize : args[2]) ?? 4096;\n const releaseLockOnEnd = args.length === 1 ? args[0].releaseLockOnEnd === true : false;\n return unwrapScoped(Effect.map(Effect.acquireRelease(Effect.sync(() => evaluate().getReader({\n mode: \"byob\"\n })), reader => releaseLockOnEnd ? Effect.sync(() => reader.releaseLock()) : Effect.promise(() => reader.cancel())), reader => catchAll(forever(readChunkStreamByobReader(reader, onError, allocSize)), error => error === EOF ? empty : fail(error))));\n};\nconst EOF = /*#__PURE__*/Symbol.for(\"effect/Stream/EOF\");\nconst readChunkStreamByobReader = (reader, onError, size) => {\n const buffer = new ArrayBuffer(size);\n return paginateEffect(0, offset => Effect.flatMap(Effect.tryPromise({\n try: () => reader.read(new Uint8Array(buffer, offset, buffer.byteLength - offset)),\n catch: reason => onError(reason)\n }), ({\n done,\n value\n }) => {\n if (done) {\n return Effect.fail(EOF);\n }\n const newOffset = offset + value.byteLength;\n return Effect.succeed([value, newOffset >= buffer.byteLength ? Option.none() : Option.some(newOffset)]);\n }));\n};\n/** @internal */\nexport const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => {\n const groupAdjacentByChunk = (state, chunk) => {\n if (Chunk.isEmpty(chunk)) {\n return [state, Chunk.empty()];\n }\n const builder = [];\n let from = 0;\n let until = 0;\n let key = undefined;\n let previousChunk = Chunk.empty();\n switch (state._tag) {\n case \"Some\":\n {\n const tuple = state.value;\n key = tuple[0];\n let loop = true;\n while (loop && until < chunk.length) {\n const input = Chunk.unsafeGet(chunk, until);\n const updatedKey = f(input);\n if (!Equal.equals(key, updatedKey)) {\n const previousChunk = tuple[1];\n const additionalChunk = Chunk.unsafeFromArray(Array.from(chunk).slice(from, until));\n const group = Chunk.appendAll(previousChunk, additionalChunk);\n builder.push([key, group]);\n key = updatedKey;\n from = until;\n loop = false;\n }\n until = until + 1;\n }\n if (loop) {\n previousChunk = tuple[1];\n }\n break;\n }\n case \"None\":\n {\n key = f(Chunk.unsafeGet(chunk, until));\n until = until + 1;\n break;\n }\n }\n while (until < chunk.length) {\n const input = Chunk.unsafeGet(chunk, until);\n const updatedKey = f(input);\n if (!Equal.equals(key, updatedKey)) {\n builder.push([key, Chunk.unsafeFromArray(Array.from(chunk).slice(from, until))]);\n key = updatedKey;\n from = until;\n }\n until = until + 1;\n }\n const nonEmptyChunk = Chunk.appendAll(previousChunk, Chunk.unsafeFromArray(Array.from(chunk).slice(from, until)));\n const output = Chunk.unsafeFromArray(builder);\n return [Option.some([key, nonEmptyChunk]), output];\n };\n const groupAdjacent = state => core.readWithCause({\n onInput: input => {\n const [updatedState, output] = groupAdjacentByChunk(state, input);\n return Chunk.isEmpty(output) ? groupAdjacent(updatedState) : core.flatMap(core.write(output), () => groupAdjacent(updatedState));\n },\n onFailure: cause => Option.match(state, {\n onNone: () => core.failCause(cause),\n onSome: output => core.flatMap(core.write(Chunk.of(output)), () => core.failCause(cause))\n }),\n onDone: done => Option.match(state, {\n onNone: () => core.succeedNow(done),\n onSome: output => core.flatMap(core.write(Chunk.of(output)), () => core.succeedNow(done))\n })\n });\n return new StreamImpl(channel.pipeToOrFail(toChannel(self), groupAdjacent(Option.none())));\n});\n/** @internal */\nexport const grouped = /*#__PURE__*/dual(2, (self, chunkSize) => pipe(self, rechunk(chunkSize), chunks));\n/** @internal */\nexport const groupedWithin = /*#__PURE__*/dual(3, (self, chunkSize, duration) => aggregateWithin(self, sink_.collectAllN(chunkSize), Schedule.spaced(duration)));\n/** @internal */\nexport const haltWhen = /*#__PURE__*/dual(2, (self, effect) => {\n const writer = fiber => pipe(Fiber.poll(fiber), Effect.map(Option.match({\n onNone: () => core.readWith({\n onInput: input => core.flatMap(core.write(input), () => writer(fiber)),\n onFailure: core.fail,\n onDone: () => core.void\n }),\n onSome: Exit.match({\n onFailure: core.failCause,\n onSuccess: () => core.void\n })\n })), channel.unwrap);\n return new StreamImpl(channel.unwrapScopedWith(scope => effect.pipe(Effect.forkIn(scope), Effect.map(fiber => toChannel(self).pipe(core.pipeTo(writer(fiber)))))));\n});\n/** @internal */\nexport const haltAfter = /*#__PURE__*/dual(2, (self, duration) => pipe(self, haltWhen(Clock.sleep(duration))));\n/** @internal */\nexport const haltWhenDeferred = /*#__PURE__*/dual(2, (self, deferred) => {\n const writer = pipe(Deferred.poll(deferred), Effect.map(Option.match({\n onNone: () => core.readWith({\n onInput: input => pipe(core.write(input), core.flatMap(() => writer)),\n onFailure: core.fail,\n onDone: () => core.void\n }),\n onSome: effect => channel.unwrap(Effect.match(effect, {\n onFailure: core.fail,\n onSuccess: () => core.void\n }))\n })), channel.unwrap);\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(writer)));\n});\n/** @internal */\nexport const identityStream = () => new StreamImpl(channel.identityChannel());\n/** @internal */\nexport const interleave = /*#__PURE__*/dual(2, (self, that) => pipe(self, interleaveWith(that, forever(make(true, false)))));\n/** @internal */\nexport const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => {\n const producer = handoff => core.readWithCause({\n onInput: value => core.flatMap(core.fromEffect(Handoff.offer(handoff, InternalTake.of(value))), () => producer(handoff)),\n onFailure: cause => core.fromEffect(Handoff.offer(handoff, InternalTake.failCause(cause))),\n onDone: () => core.fromEffect(Handoff.offer(handoff, InternalTake.end))\n });\n return new StreamImpl(channel.unwrapScopedWith(scope => pipe(Handoff.make(), Effect.zip(Handoff.make()), Effect.tap(([left]) => toChannel(self).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(left)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.tap(([_, right]) => toChannel(that).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(right)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.map(([left, right]) => {\n const process = (leftDone, rightDone) => core.readWithCause({\n onInput: bool => {\n if (bool && !leftDone) {\n return pipe(core.fromEffect(Handoff.take(left)), core.flatMap(InternalTake.match({\n onEnd: () => rightDone ? core.void : process(true, rightDone),\n onFailure: core.failCause,\n onSuccess: chunk => pipe(core.write(chunk), core.flatMap(() => process(leftDone, rightDone)))\n })));\n }\n if (!bool && !rightDone) {\n return pipe(core.fromEffect(Handoff.take(right)), core.flatMap(InternalTake.match({\n onEnd: () => leftDone ? core.void : process(leftDone, true),\n onFailure: core.failCause,\n onSuccess: chunk => pipe(core.write(chunk), core.flatMap(() => process(leftDone, rightDone)))\n })));\n }\n return process(leftDone, rightDone);\n },\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return pipe(toChannel(decider), channel.concatMap(channel.writeChunk), core.pipeTo(process(false, false)));\n }))));\n});\n/** @internal */\nexport const intersperse = /*#__PURE__*/dual(2, (self, element) => new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(core.suspend(() => {\n const writer = isFirst => core.readWithCause({\n onInput: chunk => {\n const builder = [];\n let flagResult = isFirst;\n for (const output of chunk) {\n if (flagResult) {\n flagResult = false;\n builder.push(output);\n } else {\n builder.push(element);\n builder.push(output);\n }\n }\n return pipe(core.write(Chunk.unsafeFromArray(builder)), core.flatMap(() => writer(flagResult)));\n },\n onFailure: core.failCause,\n onDone: () => core.void\n });\n return writer(true);\n})))));\n/** @internal */\nexport const intersperseAffixes = /*#__PURE__*/dual(2, (self, {\n end,\n middle,\n start\n}) => pipe(make(start), concat(pipe(self, intersperse(middle))), concat(make(end))));\n/** @internal */\nexport const interruptAfter = /*#__PURE__*/dual(2, (self, duration) => pipe(self, interruptWhen(Clock.sleep(duration))));\n/** @internal */\nexport const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => new StreamImpl(pipe(toChannel(self), channel.interruptWhen(effect))));\n/** @internal */\nexport const interruptWhenDeferred = /*#__PURE__*/dual(2, (self, deferred) => new StreamImpl(pipe(toChannel(self), channel.interruptWhenDeferred(deferred))));\n/** @internal */\nexport const iterate = (value, next) => unfold(value, a => Option.some([a, next(a)]));\n/** @internal */\nexport const make = (...as) => fromIterable(as);\n/** @internal */\nexport const map = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), channel.mapOut(Chunk.map(f)))));\n/** @internal */\nexport const mapAccum = /*#__PURE__*/dual(3, (self, s, f) => {\n const accumulator = s => core.readWith({\n onInput: input => {\n const [nextS, chunk] = Chunk.mapAccum(input, s, f);\n return core.flatMap(core.write(chunk), () => accumulator(nextS));\n },\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(accumulator(s))));\n});\n/** @internal */\nexport const mapAccumEffect = /*#__PURE__*/dual(3, (self, s, f) => suspend(() => {\n const accumulator = s => core.readWith({\n onInput: input => pipe(Effect.suspend(() => {\n const outputs = [];\n const emit = output => Effect.sync(() => {\n outputs.push(output);\n });\n return pipe(input, Effect.reduce(s, (s, a) => pipe(f(s, a), Effect.flatMap(([s, a]) => pipe(emit(a), Effect.as(s))))), Effect.match({\n onFailure: error => {\n if (outputs.length !== 0) {\n return channel.zipRight(core.write(Chunk.unsafeFromArray(outputs)), core.fail(error));\n }\n return core.fail(error);\n },\n onSuccess: s => core.flatMap(core.write(Chunk.unsafeFromArray(outputs)), () => accumulator(s))\n }));\n }), channel.unwrap),\n onFailure: core.fail,\n onDone: () => core.void\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(accumulator(s))));\n}));\n/** @internal */\nexport const mapBoth = /*#__PURE__*/dual(2, (self, options) => pipe(self, mapError(options.onFailure), map(options.onSuccess)));\n/** @internal */\nexport const mapChunks = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), channel.mapOut(f))));\n/** @internal */\nexport const mapChunksEffect = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), channel.mapOutEffect(f))));\n/** @internal */\nexport const mapConcat = /*#__PURE__*/dual(2, (self, f) => pipe(self, mapConcatChunk(a => Chunk.fromIterable(f(a)))));\n/** @internal */\nexport const mapConcatChunk = /*#__PURE__*/dual(2, (self, f) => pipe(self, mapChunks(Chunk.flatMap(f))));\n/** @internal */\nexport const mapConcatChunkEffect = /*#__PURE__*/dual(2, (self, f) => pipe(self, mapEffectSequential(f), mapConcatChunk(identity)));\n/** @internal */\nexport const mapConcatEffect = /*#__PURE__*/dual(2, (self, f) => pipe(self, mapEffectSequential(a => pipe(f(a), Effect.map(Chunk.fromIterable))), mapConcatChunk(identity)));\n/** @internal */\nexport const mapEffectSequential = /*#__PURE__*/dual(2, (self, f) => {\n const loop = iterator => {\n const next = iterator.next();\n if (next.done) {\n return core.readWithCause({\n onInput: elem => loop(elem[Symbol.iterator]()),\n onFailure: core.failCause,\n onDone: core.succeed\n });\n } else {\n const value = next.value;\n return channel.unwrap(Effect.map(f(value), a2 => core.flatMap(core.write(Chunk.of(a2)), () => loop(iterator))));\n }\n };\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(core.suspend(() => loop(Chunk.empty()[Symbol.iterator]())))));\n});\n/** @internal */\nexport const mapEffectPar = /*#__PURE__*/dual(3, (self, n, f) => new StreamImpl(pipe(toChannel(self), channel.concatMap(channel.writeChunk), channel.mapOutEffectPar(f, n), channel.mapOut(Chunk.of))));\n/** @internal */\nexport const mapError = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), channel.mapError(f))));\n/** @internal */\nexport const mapErrorCause = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), channel.mapErrorCause(f))));\n/** @internal */\nexport const merge = /*#__PURE__*/dual(args => isStream(args[1]), (self, that, options) => mergeWith(self, that, {\n onSelf: identity,\n onOther: identity,\n haltStrategy: options?.haltStrategy\n}));\n/** @internal */\nexport const mergeAll = /*#__PURE__*/dual(args => Symbol.iterator in args[0], (streams, options) => flatten(fromIterable(streams), options));\n/** @internal */\nexport const mergeWithTag = /*#__PURE__*/dual(2, (streams, options) => {\n const keys = Object.keys(streams);\n const values = keys.map(key => streams[key].pipe(map(value => ({\n _tag: key,\n value\n }))));\n return mergeAll(values, options);\n});\n/** @internal */\nexport const mergeEither = /*#__PURE__*/dual(2, (self, that) => mergeWith(self, that, {\n onSelf: Either.left,\n onOther: Either.right\n}));\n/** @internal */\nexport const mergeLeft = /*#__PURE__*/dual(2, (left, right) => pipe(left, merge(drain(right))));\n/** @internal */\nexport const mergeRight = /*#__PURE__*/dual(2, (left, right) => pipe(drain(left), merge(right)));\n/** @internal */\nexport const mergeWith = /*#__PURE__*/dual(3, (self, other, options) => {\n const strategy = options.haltStrategy ? haltStrategy.fromInput(options.haltStrategy) : HaltStrategy.Both;\n const handler = terminate => exit => terminate || !Exit.isSuccess(exit) ?\n // TODO: remove\n MergeDecision.Done(Effect.suspend(() => exit)) : MergeDecision.Await(exit => Effect.suspend(() => exit));\n return new StreamImpl(channel.mergeWith(toChannel(map(self, options.onSelf)), {\n other: toChannel(map(other, options.onOther)),\n onSelfDone: handler(strategy._tag === \"Either\" || strategy._tag === \"Left\"),\n onOtherDone: handler(strategy._tag === \"Either\" || strategy._tag === \"Right\")\n }));\n});\n/** @internal */\nexport const mkString = self => run(self, sink_.mkString);\n/** @internal */\nexport const never = /*#__PURE__*/fromEffect(Effect.never);\n/** @internal */\nexport const onEnd = /*#__PURE__*/dual(2, (self, effect) => concat(self, drain(fromEffect(effect))));\n/** @internal */\nexport const onError = /*#__PURE__*/dual(2, (self, cleanup) => pipe(self, catchAllCause(cause => fromEffect(pipe(cleanup(cause), Effect.zipRight(Effect.failCause(cause)))))));\n/** @internal */\nexport const onDone = /*#__PURE__*/dual(2, (self, cleanup) => new StreamImpl(pipe(toChannel(self), core.ensuringWith(exit => Exit.isSuccess(exit) ? cleanup() : Effect.void))));\n/** @internal */\nexport const onStart = /*#__PURE__*/dual(2, (self, effect) => unwrap(Effect.as(effect, self)));\n/** @internal */\nexport const orDie = self => pipe(self, orDieWith(identity));\n/** @internal */\nexport const orDieWith = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), channel.orDieWith(f))));\n/** @internal */\nexport const orElse = /*#__PURE__*/dual(2, (self, that) => new StreamImpl(pipe(toChannel(self), channel.orElse(() => toChannel(that())))));\n/** @internal */\nexport const orElseEither = /*#__PURE__*/dual(2, (self, that) => pipe(self, map(Either.left), orElse(() => pipe(that(), map(Either.right)))));\n/** @internal */\nexport const orElseFail = /*#__PURE__*/dual(2, (self, error) => pipe(self, orElse(() => failSync(error))));\n/** @internal */\nexport const orElseIfEmpty = /*#__PURE__*/dual(2, (self, element) => pipe(self, orElseIfEmptyChunk(() => Chunk.of(element()))));\n/** @internal */\nexport const orElseIfEmptyChunk = /*#__PURE__*/dual(2, (self, chunk) => pipe(self, orElseIfEmptyStream(() => new StreamImpl(core.write(chunk())))));\n/** @internal */\nexport const orElseIfEmptyStream = /*#__PURE__*/dual(2, (self, stream) => {\n const writer = core.readWith({\n onInput: input => {\n if (Chunk.isEmpty(input)) {\n return core.suspend(() => writer);\n }\n return pipe(core.write(input), channel.zipRight(channel.identityChannel()));\n },\n onFailure: core.fail,\n onDone: () => core.suspend(() => toChannel(stream()))\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(writer)));\n});\n/** @internal */\nexport const orElseSucceed = /*#__PURE__*/dual(2, (self, value) => pipe(self, orElse(() => sync(value))));\n/** @internal */\nexport const paginate = (s, f) => paginateChunk(s, s => {\n const page = f(s);\n return [Chunk.of(page[0]), page[1]];\n});\n/** @internal */\nexport const paginateChunk = (s, f) => {\n const loop = s => {\n const page = f(s);\n return Option.match(page[1], {\n onNone: () => channel.zipRight(core.write(page[0]), core.void),\n onSome: s => core.flatMap(core.write(page[0]), () => loop(s))\n });\n };\n return new StreamImpl(core.suspend(() => loop(s)));\n};\n/** @internal */\nexport const paginateChunkEffect = (s, f) => {\n const loop = s => channel.unwrap(Effect.map(f(s), ([chunk, option]) => Option.match(option, {\n onNone: () => channel.zipRight(core.write(chunk), core.void),\n onSome: s => core.flatMap(core.write(chunk), () => loop(s))\n })));\n return new StreamImpl(core.suspend(() => loop(s)));\n};\n/** @internal */\nexport const paginateEffect = (s, f) => paginateChunkEffect(s, s => pipe(f(s), Effect.map(([a, s]) => [Chunk.of(a), s])));\n/** @internal */\nexport const peel = /*#__PURE__*/dual(2, (self, sink) => {\n const OP_EMIT = \"Emit\";\n const OP_HALT = \"Halt\";\n const OP_END = \"End\";\n return pipe(Deferred.make(), Effect.flatMap(deferred => pipe(Handoff.make(), Effect.map(handoff => {\n const consumer = sink_.foldSink(sink_.collectLeftover(sink), {\n onFailure: error => sink_.zipRight(sink_.fromEffect(Deferred.fail(deferred, error)), sink_.fail(error)),\n onSuccess: ([z, leftovers]) => {\n const loop = core.readWithCause({\n onInput: elements => core.flatMap(core.fromEffect(Handoff.offer(handoff, {\n _tag: OP_EMIT,\n elements\n })), () => loop),\n onFailure: cause => channel.zipRight(core.fromEffect(Handoff.offer(handoff, {\n _tag: OP_HALT,\n cause\n })), core.failCause(cause)),\n onDone: _ => channel.zipRight(core.fromEffect(Handoff.offer(handoff, {\n _tag: OP_END\n })), core.void)\n });\n return sink_.fromChannel(pipe(core.fromEffect(Deferred.succeed(deferred, z)), channel.zipRight(core.fromEffect(pipe(handoff, Handoff.offer({\n _tag: OP_EMIT,\n elements: leftovers\n })))), channel.zipRight(loop)));\n }\n });\n const producer = pipe(Handoff.take(handoff), Effect.map(signal => {\n switch (signal._tag) {\n case OP_EMIT:\n {\n return pipe(core.write(signal.elements), core.flatMap(() => producer));\n }\n case OP_HALT:\n {\n return core.failCause(signal.cause);\n }\n case OP_END:\n {\n return core.void;\n }\n }\n }), channel.unwrap);\n return pipe(self, tapErrorCause(cause => Deferred.failCause(deferred, cause)), run(consumer), Effect.forkScoped, Effect.zipRight(Deferred.await(deferred)), Effect.map(z => [z, new StreamImpl(producer)]));\n }))), Effect.flatten);\n});\n/** @internal */\nexport const partition = /*#__PURE__*/dual(args => typeof args[1] === \"function\", (self, predicate, options) => partitionEither(self, a => Effect.succeed(predicate(a) ? Either.right(a) : Either.left(a)), options));\n/** @internal */\nexport const partitionEither = /*#__PURE__*/dual(args => typeof args[1] === \"function\", (self, predicate, options) => pipe(mapEffectSequential(self, predicate), distributedWith({\n size: 2,\n maximumLag: options?.bufferSize ?? 16,\n decide: Either.match({\n onLeft: () => Effect.succeed(n => n === 0),\n onRight: () => Effect.succeed(n => n === 1)\n })\n}), Effect.flatMap(([queue1, queue2]) => Effect.succeed([filterMap(flattenExitOption(fromQueue(queue1, {\n shutdown: true\n})), _ => Either.match(_, {\n onLeft: Option.some,\n onRight: Option.none\n})), filterMap(flattenExitOption(fromQueue(queue2, {\n shutdown: true\n})), _ => Either.match(_, {\n onLeft: Option.none,\n onRight: Option.some\n}))]))));\n/** @internal */\nexport const pipeThrough = /*#__PURE__*/dual(2, (self, sink) => new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(sink_.toChannel(sink)))));\n/** @internal */\nexport const pipeThroughChannel = /*#__PURE__*/dual(2, (self, channel) => new StreamImpl(core.pipeTo(toChannel(self), channel)));\n/** @internal */\nexport const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, chan) => new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(chan))));\n/** @internal */\nexport const prepend = /*#__PURE__*/dual(2, (self, values) => new StreamImpl(channel.zipRight(core.write(values), toChannel(self))));\n/** @internal */\nexport const provideContext = /*#__PURE__*/dual(2, (self, context) => new StreamImpl(pipe(toChannel(self), core.provideContext(context))));\n/** @internal */\nexport const provideSomeContext = /*#__PURE__*/dual(2, (self, context) => mapInputContext(self, Context.merge(context)));\n/** @internal */\nexport const provideLayer = /*#__PURE__*/dual(2, (self, layer) => new StreamImpl(channel.unwrapScopedWith(scope => Layer.buildWithScope(layer, scope).pipe(Effect.map(env => pipe(toChannel(self), core.provideContext(env)))))));\n/** @internal */\nexport const provideService = /*#__PURE__*/dual(3, (self, tag, resource) => provideServiceEffect(self, tag, Effect.succeed(resource)));\n/** @internal */\nexport const provideServiceEffect = /*#__PURE__*/dual(3, (self, tag, effect) => provideServiceStream(self, tag, fromEffect(effect)));\n/** @internal */\nexport const provideServiceStream = /*#__PURE__*/dual(3, (self, tag, stream) => contextWithStream(env => flatMap(stream, service => pipe(self, provideContext(Context.add(env, tag, service))))));\n/** @internal */\nexport const mapInputContext = /*#__PURE__*/dual(2, (self, f) => contextWithStream(env => pipe(self, provideContext(f(env)))));\n/** @internal */\nexport const provideSomeLayer = /*#__PURE__*/dual(2, (self, layer) =>\n// @ts-expect-error\n// @effect-diagnostics-next-line missingEffectContext:off\npipe(self, provideLayer(pipe(Layer.context(), Layer.merge(layer)))));\n/** @internal */\nexport const range = (min, max, chunkSize = DefaultChunkSize) => suspend(() => {\n if (min > max) {\n return empty;\n }\n const go = (min, max, chunkSize) => {\n const remaining = max - min + 1;\n if (remaining > chunkSize) {\n return pipe(core.write(Chunk.range(min, min + chunkSize - 1)), core.flatMap(() => go(min + chunkSize, max, chunkSize)));\n }\n return core.write(Chunk.range(min, min + remaining - 1));\n };\n return new StreamImpl(go(min, max, chunkSize));\n});\n/** @internal */\nexport const race = /*#__PURE__*/dual(2, (left, right) => raceAll(left, right));\n/** @internal */\nexport const raceAll = (...streams) => Deferred.make().pipe(Effect.map(halt => {\n let winner = null;\n return mergeAll(streams.map((stream, index) => stream.pipe(takeWhile(() => {\n if (winner === null) {\n winner = index;\n Deferred.unsafeDone(halt, Exit.void);\n return true;\n }\n return winner === index;\n }), interruptWhen(Deferred.await(halt).pipe(Effect.flatMap(() => winner === index ? Effect.never : Effect.void))))), {\n concurrency: streams.length\n });\n}), unwrap);\n/** @internal */\nexport const rechunk = /*#__PURE__*/dual(2, (self, n) => suspend(() => {\n const target = Math.max(n, 1);\n const process = rechunkProcess(new StreamRechunker(target), target);\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(process)));\n}));\n/** @internal */\nconst rechunkProcess = (rechunker, target) => core.readWithCause({\n onInput: chunk => {\n if (chunk.length === target && rechunker.isEmpty()) {\n return core.flatMap(core.write(chunk), () => rechunkProcess(rechunker, target));\n }\n if (chunk.length > 0) {\n const chunks = [];\n let result = undefined;\n let index = 0;\n while (index < chunk.length) {\n while (index < chunk.length && result === undefined) {\n result = rechunker.write(pipe(chunk, Chunk.unsafeGet(index)));\n index = index + 1;\n }\n if (result !== undefined) {\n chunks.push(result);\n result = undefined;\n }\n }\n return core.flatMap(channel.writeAll(...chunks), () => rechunkProcess(rechunker, target));\n }\n return core.suspend(() => rechunkProcess(rechunker, target));\n },\n onFailure: cause => channel.zipRight(rechunker.emitIfNotEmpty(), core.failCause(cause)),\n onDone: () => rechunker.emitIfNotEmpty()\n});\nclass StreamRechunker {\n n;\n builder = [];\n pos = 0;\n constructor(n) {\n this.n = n;\n }\n isEmpty() {\n return this.pos === 0;\n }\n write(elem) {\n this.builder.push(elem);\n this.pos += 1;\n if (this.pos === this.n) {\n const result = Chunk.unsafeFromArray(this.builder);\n this.builder = [];\n this.pos = 0;\n return result;\n }\n return undefined;\n }\n emitIfNotEmpty() {\n if (this.pos !== 0) {\n return core.write(Chunk.unsafeFromArray(this.builder));\n }\n return core.void;\n }\n}\n/** @internal */\nexport const refineOrDie = /*#__PURE__*/dual(2, (self, pf) => pipe(self, refineOrDieWith(pf, identity)));\n/** @internal */\nexport const refineOrDieWith = /*#__PURE__*/dual(3, (self, pf, f) => new StreamImpl(channel.catchAll(toChannel(self), error => Option.match(pf(error), {\n onNone: () => core.failCause(Cause.die(f(error))),\n onSome: core.fail\n}))));\n/** @internal */\nexport const repeat = /*#__PURE__*/dual(2, (self, schedule) => filterMap(repeatEither(self, schedule), _ => Either.match(_, {\n onLeft: Option.none,\n onRight: Option.some\n})));\n/** @internal */\nexport const repeatEffect = effect => repeatEffectOption(pipe(effect, Effect.mapError(Option.some)));\n/** @internal */\nexport const repeatEffectChunk = effect => repeatEffectChunkOption(pipe(effect, Effect.mapError(Option.some)));\n/** @internal */\nexport const repeatEffectChunkOption = effect => unfoldChunkEffect(effect, effect => pipe(Effect.map(effect, chunk => Option.some([chunk, effect])), Effect.catchAll(Option.match({\n onNone: () => Effect.succeed(Option.none()),\n onSome: Effect.fail\n}))));\n/** @internal */\nexport const repeatEffectOption = effect => repeatEffectChunkOption(pipe(effect, Effect.map(Chunk.of)));\n/** @internal */\nexport const repeatEither = /*#__PURE__*/dual(2, (self, schedule) => repeatWith(self, schedule, {\n onElement: a => Either.right(a),\n onSchedule: Either.left\n}));\n/** @internal */\nexport const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => filterMap(repeatElementsWith(self, schedule, {\n onElement: a => Option.some(a),\n onSchedule: Option.none\n}), identity));\n/** @internal */\nexport const repeatElementsWith = /*#__PURE__*/dual(3, (self, schedule, options) => {\n const driver = pipe(Schedule.driver(schedule), Effect.map(driver => {\n const feed = input => Option.match(Chunk.head(input), {\n onNone: () => loop,\n onSome: a => channel.zipRight(core.write(Chunk.of(options.onElement(a))), step(pipe(input, Chunk.drop(1)), a))\n });\n const step = (input, a) => {\n const advance = pipe(driver.next(a), Effect.as(pipe(core.write(Chunk.of(options.onElement(a))), core.flatMap(() => step(input, a)))));\n const reset = pipe(driver.last, Effect.orDie, Effect.flatMap(b => pipe(driver.reset, Effect.map(() => pipe(core.write(Chunk.of(options.onSchedule(b))), channel.zipRight(feed(input)))))));\n return pipe(advance, Effect.orElse(() => reset), channel.unwrap);\n };\n const loop = core.readWith({\n onInput: feed,\n onFailure: core.fail,\n onDone: () => core.void\n });\n return loop;\n }), channel.unwrap);\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(driver)));\n});\n/** @internal */\nexport const repeatValue = value => new StreamImpl(channel.repeated(core.write(Chunk.of(value))));\n/** @internal */\nexport const repeatWith = /*#__PURE__*/dual(3, (self, schedule, options) => {\n return pipe(Schedule.driver(schedule), Effect.map(driver => {\n const provideLastIterationInfo = provideServiceEffect(Schedule.CurrentIterationMetadata, Ref.get(driver.iterationMeta));\n const process = pipe(self, provideLastIterationInfo, map(options.onElement), toChannel);\n const loop = channel.unwrap(Effect.match(driver.next(void 0), {\n onFailure: () => core.void,\n onSuccess: output => core.flatMap(process, () => channel.zipRight(core.write(Chunk.of(options.onSchedule(output))), loop))\n }));\n return new StreamImpl(channel.zipRight(process, loop));\n }), unwrap);\n});\nconst repeatWithSchedule = (value, schedule) => repeatEffectWithSchedule(Effect.succeed(value), schedule);\n/** @internal */\nexport const repeatEffectWithSchedule = (effect, schedule) => flatMap(fromEffect(Effect.zip(effect, Schedule.driver(schedule))), ([a, driver]) => {\n const provideLastIterationInfo = Effect.provideServiceEffect(Schedule.CurrentIterationMetadata, Ref.get(driver.iterationMeta));\n return concat(succeed(a), unfoldEffect(a, s => Effect.matchEffect(driver.next(s), {\n onFailure: Effect.succeed,\n onSuccess: () => Effect.map(provideLastIterationInfo(effect), nextA => Option.some([nextA, nextA]))\n })));\n});\n/** @internal */\nexport const retry = /*#__PURE__*/dual(2, (self, policy) => Schedule.driver(policy).pipe(Effect.map(driver => {\n const provideLastIterationInfo = provideServiceEffect(Schedule.CurrentIterationMetadata, Ref.get(driver.iterationMeta));\n const loop = toChannel(provideLastIterationInfo(self)).pipe(channel.mapOutEffect(out => Effect.as(driver.reset, out)), channel.catchAll(error => driver.next(error).pipe(Effect.match({\n onFailure: () => core.fail(error),\n onSuccess: () => loop\n }), channel.unwrap)));\n return loop;\n}), channel.unwrap, fromChannel));\n/** @internal */\nexport const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (self, policy, options) => suspend(() => {\n const preventFallbackOnPartialStream = options?.preventFallbackOnPartialStream ?? false;\n let i = 0;\n let lastError = Option.none();\n const loop = suspend(() => {\n const step = policy.steps[i++];\n if (!step) {\n return fail(Option.getOrThrow(lastError));\n }\n let nextStream = Context.isContext(step.provide) ? provideSomeContext(self, step.provide) : provideSomeLayer(self, step.provide);\n let receivedElements = false;\n if (Option.isSome(lastError)) {\n const error = lastError.value;\n let attempted = false;\n const wrapped = nextStream;\n // ensure the schedule is applied at least once\n nextStream = suspend(() => {\n if (attempted) return wrapped;\n attempted = true;\n return fail(error);\n });\n nextStream = scheduleDefectRefail(retry(nextStream, internalExecutionPlan.scheduleFromStep(step, false)));\n } else {\n const schedule = internalExecutionPlan.scheduleFromStep(step, true);\n nextStream = schedule ? scheduleDefectRefail(retry(nextStream, schedule)) : nextStream;\n }\n return catchAll(preventFallbackOnPartialStream ? mapChunks(nextStream, chunk => {\n receivedElements = true;\n return chunk;\n }) : nextStream, error => {\n if (preventFallbackOnPartialStream && receivedElements) {\n return fail(error);\n }\n lastError = Option.some(error);\n return loop;\n });\n });\n return loop;\n}));\nconst scheduleDefectRefail = self => catchAllCause(self, cause => failCause(InternalSchedule.scheduleDefectRefailCause(cause)));\n/** @internal */\nexport const run = /*#__PURE__*/dual(2, (self, sink) => toChannel(self).pipe(channel.pipeToOrFail(sink_.toChannel(sink)), channel.runDrain));\n/** @internal */\nexport const runCollect = self => run(self, sink_.collectAll());\n/** @internal */\nexport const runCount = self => run(self, sink_.count);\n/** @internal */\nexport const runDrain = self => run(self, sink_.drain);\n/** @internal */\nexport const runFold = /*#__PURE__*/dual(3, (self, s, f) => runFoldWhile(self, s, constTrue, f));\n/** @internal */\nexport const runFoldEffect = /*#__PURE__*/dual(3, (self, s, f) => runFoldWhileEffect(self, s, constTrue, f));\n/** @internal */\nexport const runFoldScoped = /*#__PURE__*/dual(3, (self, s, f) => pipe(self, runFoldWhileScoped(s, constTrue, f)));\n/** @internal */\nexport const runFoldScopedEffect = /*#__PURE__*/dual(3, (self, s, f) => pipe(self, runFoldWhileScopedEffect(s, constTrue, f)));\n/** @internal */\nexport const runFoldWhile = /*#__PURE__*/dual(4, (self, s, cont, f) => run(self, sink_.fold(s, cont, f)));\n/** @internal */\nexport const runFoldWhileEffect = /*#__PURE__*/dual(4, (self, s, cont, f) => run(self, sink_.foldEffect(s, cont, f)));\n/** @internal */\nexport const runFoldWhileScoped = /*#__PURE__*/dual(4, (self, s, cont, f) => pipe(self, runScoped(sink_.fold(s, cont, f))));\n/** @internal */\nexport const runFoldWhileScopedEffect = /*#__PURE__*/dual(4, (self, s, cont, f) => pipe(self, runScoped(sink_.foldEffect(s, cont, f))));\n/** @internal */\nexport const runForEach = /*#__PURE__*/dual(2, (self, f) => run(self, sink_.forEach(f)));\n/** @internal */\nexport const runForEachChunk = /*#__PURE__*/dual(2, (self, f) => run(self, sink_.forEachChunk(f)));\n/** @internal */\nexport const runForEachChunkScoped = /*#__PURE__*/dual(2, (self, f) => pipe(self, runScoped(sink_.forEachChunk(f))));\n/** @internal */\nexport const runForEachScoped = /*#__PURE__*/dual(2, (self, f) => pipe(self, runScoped(sink_.forEach(f))));\n/** @internal */\nexport const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => run(self, sink_.forEachWhile(f)));\n/** @internal */\nexport const runForEachWhileScoped = /*#__PURE__*/dual(2, (self, f) => pipe(self, runScoped(sink_.forEachWhile(f))));\n/** @internal */\nexport const runHead = self => run(self, sink_.head());\n/** @internal */\nexport const runIntoPubSub = /*#__PURE__*/dual(2, (self, pubsub) => pipe(self, runIntoQueue(pubsub)));\n/** @internal */\nexport const runIntoPubSubScoped = /*#__PURE__*/dual(2, (self, pubsub) => pipe(self, runIntoQueueScoped(pubsub)));\n/** @internal */\nexport const runIntoQueue = /*#__PURE__*/dual(2, (self, queue) => pipe(self, runIntoQueueScoped(queue), Effect.scoped));\n/** @internal */\nexport const runIntoQueueElementsScoped = /*#__PURE__*/dual(2, (self, queue) => {\n const writer = core.readWithCause({\n onInput: input => core.flatMap(core.fromEffect(Queue.offerAll(queue, Chunk.map(input, Exit.succeed))), () => writer),\n onFailure: cause => core.fromEffect(Queue.offer(queue, Exit.failCause(Cause.map(cause, Option.some)))),\n onDone: () => core.fromEffect(Queue.offer(queue, Exit.fail(Option.none())))\n });\n return pipe(core.pipeTo(toChannel(self), writer), channel.drain, channel.runScoped, Effect.asVoid);\n});\n/** @internal */\nexport const runIntoQueueScoped = /*#__PURE__*/dual(2, (self, queue) => {\n const writer = core.readWithCause({\n onInput: input => core.flatMap(core.write(InternalTake.chunk(input)), () => writer),\n onFailure: cause => core.write(InternalTake.failCause(cause)),\n onDone: () => core.write(InternalTake.end)\n });\n return pipe(core.pipeTo(toChannel(self), writer), channel.mapOutEffect(take => Queue.offer(queue, take)), channel.drain, channel.runScoped, Effect.asVoid);\n});\n/** @internal */\nexport const runLast = self => run(self, sink_.last());\n/** @internal */\nexport const runScoped = /*#__PURE__*/dual(2, (self, sink) => pipe(toChannel(self), channel.pipeToOrFail(sink_.toChannel(sink)), channel.drain, channel.runScoped));\n/** @internal */\nexport const runSum = self => run(self, sink_.sum);\n/** @internal */\nexport const scan = /*#__PURE__*/dual(3, (self, s, f) => pipe(self, scanEffect(s, (s, a) => Effect.succeed(f(s, a)))));\n/** @internal */\nexport const scanReduce = /*#__PURE__*/dual(2, (self, f) => pipe(self, scanReduceEffect((a2, a) => Effect.succeed(f(a2, a)))));\n/** @internal */\nexport const scanReduceEffect = /*#__PURE__*/dual(2, (self, f) => pipe(self, mapAccumEffect(Option.none(), (option, a) => {\n switch (option._tag) {\n case \"None\":\n {\n return Effect.succeed([Option.some(a), a]);\n }\n case \"Some\":\n {\n return pipe(f(option.value, a), Effect.map(b => [Option.some(b), b]));\n }\n }\n})));\n/** @internal */\nexport const schedule = /*#__PURE__*/dual(2, (self, schedule) => filterMap(scheduleWith(self, schedule, {\n onElement: Option.some,\n onSchedule: Option.none\n}), identity));\n/** @internal */\nexport const scheduleWith = /*#__PURE__*/dual(3, (self, schedule, options) => {\n const loop = (driver, iterator) => {\n const next = iterator.next();\n if (next.done) {\n return core.readWithCause({\n onInput: chunk => loop(driver, chunk[Symbol.iterator]()),\n onFailure: core.failCause,\n onDone: core.succeedNow\n });\n }\n return channel.unwrap(Effect.matchEffect(driver.next(next.value), {\n onFailure: () => pipe(driver.last, Effect.orDie, Effect.map(b => pipe(core.write(Chunk.make(options.onElement(next.value), options.onSchedule(b))), core.flatMap(() => loop(driver, iterator)))), Effect.zipLeft(driver.reset)),\n onSuccess: () => Effect.succeed(pipe(core.write(Chunk.of(options.onElement(next.value))), core.flatMap(() => loop(driver, iterator))))\n }));\n };\n return new StreamImpl(pipe(core.fromEffect(Schedule.driver(schedule)), core.flatMap(driver => pipe(toChannel(self), core.pipeTo(loop(driver, Chunk.empty()[Symbol.iterator]()))))));\n});\n/** @internal */\nexport const scanEffect = /*#__PURE__*/dual(3, (self, s, f) => new StreamImpl(pipe(core.write(Chunk.of(s)), core.flatMap(() => toChannel(pipe(self, mapAccumEffect(s, (s, a) => pipe(f(s, a), Effect.map(s => [s, s])))))))));\n/** @internal */\nexport const scoped = effect => new StreamImpl(channel.ensuring(channel.scoped(pipe(effect, Effect.map(Chunk.of))), Effect.void));\n/** @internal */\nexport const scopedWith = f => new StreamImpl(channel.scopedWith(scope => f(scope).pipe(Effect.map(Chunk.of))));\n/** @internal */\nexport const some = self => pipe(self, mapError(Option.some), someOrFail(() => Option.none()));\n/** @internal */\nexport const someOrElse = /*#__PURE__*/dual(2, (self, fallback) => pipe(self, map(Option.getOrElse(fallback))));\n/** @internal */\nexport const someOrFail = /*#__PURE__*/dual(2, (self, error) => mapEffectSequential(self, Option.match({\n onNone: () => Effect.failSync(error),\n onSome: Effect.succeed\n})));\n/** @internal */\nexport const sliding = /*#__PURE__*/dual(2, (self, chunkSize) => slidingSize(self, chunkSize, 1));\n/** @internal */\nexport const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => {\n if (chunkSize <= 0 || stepSize <= 0) {\n return die(new Cause.IllegalArgumentException(\"Invalid bounds - `chunkSize` and `stepSize` must be greater than zero\"));\n }\n return new StreamImpl(core.suspend(() => {\n const queue = new RingBuffer(chunkSize);\n const emitOnStreamEnd = (queueSize, channelEnd) => {\n if (queueSize < chunkSize) {\n const items = queue.toChunk();\n const result = Chunk.isEmpty(items) ? Chunk.empty() : Chunk.of(items);\n return pipe(core.write(result), core.flatMap(() => channelEnd));\n }\n const lastEmitIndex = queueSize - (queueSize - chunkSize) % stepSize;\n if (lastEmitIndex === queueSize) {\n return channelEnd;\n }\n const leftovers = queueSize - (lastEmitIndex - chunkSize + stepSize);\n const lastItems = pipe(queue.toChunk(), Chunk.takeRight(leftovers));\n const result = Chunk.isEmpty(lastItems) ? Chunk.empty() : Chunk.of(lastItems);\n return pipe(core.write(result), core.flatMap(() => channelEnd));\n };\n const reader = queueSize => core.readWithCause({\n onInput: input => core.flatMap(core.write(Chunk.filterMap(input, (element, index) => {\n queue.put(element);\n const currentIndex = queueSize + index + 1;\n if (currentIndex < chunkSize || (currentIndex - chunkSize) % stepSize > 0) {\n return Option.none();\n }\n return Option.some(queue.toChunk());\n })), () => reader(queueSize + input.length)),\n onFailure: cause => emitOnStreamEnd(queueSize, core.failCause(cause)),\n onDone: () => emitOnStreamEnd(queueSize, core.void)\n });\n return pipe(toChannel(self), core.pipeTo(reader(0)));\n }));\n});\n/** @internal */\nexport const split = /*#__PURE__*/dual(2, (self, predicate) => {\n const split = (leftovers, input) => {\n const [chunk, remaining] = pipe(leftovers, Chunk.appendAll(input), Chunk.splitWhere(predicate));\n if (Chunk.isEmpty(chunk) || Chunk.isEmpty(remaining)) {\n return loop(pipe(chunk, Chunk.appendAll(pipe(remaining, Chunk.drop(1)))));\n }\n return pipe(core.write(Chunk.of(chunk)), core.flatMap(() => split(Chunk.empty(), pipe(remaining, Chunk.drop(1)))));\n };\n const loop = leftovers => core.readWith({\n onInput: input => split(leftovers, input),\n onFailure: core.fail,\n onDone: () => {\n if (Chunk.isEmpty(leftovers)) {\n return core.void;\n }\n if (Option.isNone(pipe(leftovers, Chunk.findFirst(predicate)))) {\n return channel.zipRight(core.write(Chunk.of(leftovers)), core.void);\n }\n return channel.zipRight(split(Chunk.empty(), leftovers), core.void);\n }\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(loop(Chunk.empty()))));\n});\n/** @internal */\nexport const splitOnChunk = /*#__PURE__*/dual(2, (self, delimiter) => {\n const next = (leftover, delimiterIndex) => core.readWithCause({\n onInput: inputChunk => {\n let buffer;\n const [carry, delimiterCursor] = pipe(inputChunk, Chunk.reduce([pipe(leftover, Option.getOrElse(() => Chunk.empty())), delimiterIndex], ([carry, delimiterCursor], a) => {\n const concatenated = pipe(carry, Chunk.append(a));\n if (delimiterCursor < delimiter.length && Equal.equals(a, pipe(delimiter, Chunk.unsafeGet(delimiterCursor)))) {\n if (delimiterCursor + 1 === delimiter.length) {\n if (buffer === undefined) {\n buffer = [];\n }\n buffer.push(pipe(concatenated, Chunk.take(concatenated.length - delimiter.length)));\n return [Chunk.empty(), 0];\n }\n return [concatenated, delimiterCursor + 1];\n }\n return [concatenated, Equal.equals(a, pipe(delimiter, Chunk.unsafeGet(0))) ? 1 : 0];\n }));\n const output = buffer === undefined ? Chunk.empty() : Chunk.unsafeFromArray(buffer);\n return core.flatMap(core.write(output), () => next(Chunk.isNonEmpty(carry) ? Option.some(carry) : Option.none(), delimiterCursor));\n },\n onFailure: cause => Option.match(leftover, {\n onNone: () => core.failCause(cause),\n onSome: chunk => channel.zipRight(core.write(Chunk.of(chunk)), core.failCause(cause))\n }),\n onDone: done => Option.match(leftover, {\n onNone: () => core.succeed(done),\n onSome: chunk => channel.zipRight(core.write(Chunk.of(chunk)), core.succeed(done))\n })\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(next(Option.none(), 0))));\n});\n/** @internal */\nexport const splitLines = self => pipeThroughChannel(self, channel.splitLines());\n/** @internal */\nexport const succeed = value => fromChunk(Chunk.of(value));\n/** @internal */\nexport const sync = evaluate => suspend(() => fromChunk(Chunk.of(evaluate())));\n/** @internal */\nexport const suspend = stream => new StreamImpl(core.suspend(() => toChannel(stream())));\n/** @internal */\nexport const take = /*#__PURE__*/dual(2, (self, n) => {\n if (!Number.isInteger(n)) {\n return die(new Cause.IllegalArgumentException(`${n} must be an integer`));\n }\n const loop = n => core.readWith({\n onInput: input => {\n const taken = pipe(input, Chunk.take(Math.min(n, Number.POSITIVE_INFINITY)));\n const leftover = Math.max(0, n - taken.length);\n const more = leftover > 0;\n if (more) {\n return pipe(core.write(taken), core.flatMap(() => loop(leftover)));\n }\n return core.write(taken);\n },\n onFailure: core.fail,\n onDone: core.succeed\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(0 < n ? loop(n) : core.void)));\n});\n/** @internal */\nexport const takeRight = /*#__PURE__*/dual(2, (self, n) => {\n if (n <= 0) {\n return empty;\n }\n return new StreamImpl(pipe(Effect.succeed(new RingBuffer(n)), Effect.map(queue => {\n const reader = core.readWith({\n onInput: input => {\n for (const element of input) {\n queue.put(element);\n }\n return reader;\n },\n onFailure: core.fail,\n onDone: () => pipe(core.write(queue.toChunk()), channel.zipRight(core.void))\n });\n return pipe(toChannel(self), core.pipeTo(reader));\n }), channel.unwrap));\n});\n/** @internal */\nexport const takeUntil = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = core.readWith({\n onInput: input => {\n const taken = pipe(input, Chunk.takeWhile(a => !predicate(a)));\n const last = pipe(input, Chunk.drop(taken.length), Chunk.take(1));\n if (Chunk.isEmpty(last)) {\n return pipe(core.write(taken), core.flatMap(() => loop));\n }\n return core.write(pipe(taken, Chunk.appendAll(last)));\n },\n onFailure: core.fail,\n onDone: core.succeed\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(loop)));\n});\n/** @internal */\nexport const takeUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = iterator => {\n const next = iterator.next();\n if (next.done) {\n return core.readWithCause({\n onInput: elem => loop(elem[Symbol.iterator]()),\n onFailure: core.failCause,\n onDone: core.succeed\n });\n }\n return pipe(predicate(next.value), Effect.map(bool => bool ? core.write(Chunk.of(next.value)) : pipe(core.write(Chunk.of(next.value)), core.flatMap(() => loop(iterator)))), channel.unwrap);\n };\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(loop(Chunk.empty()[Symbol.iterator]()))));\n});\n/** @internal */\nexport const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => {\n const loop = core.readWith({\n onInput: input => {\n const taken = pipe(input, Chunk.takeWhile(predicate));\n const more = taken.length === input.length;\n if (more) {\n return pipe(core.write(taken), core.flatMap(() => loop));\n }\n return core.write(taken);\n },\n onFailure: core.fail,\n onDone: core.succeed\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(loop)));\n});\n/** @internal */\nexport const tap = /*#__PURE__*/dual(2, (self, f) => mapEffectSequential(self, a => Effect.as(f(a), a)));\n/** @internal */\nexport const tapBoth = /*#__PURE__*/dual(2, (self, options) => pipe(self, tapError(options.onFailure), tap(options.onSuccess)));\n/** @internal */\nexport const tapError = /*#__PURE__*/dual(2, (self, f) => catchAll(self, error => fromEffect(Effect.zipRight(f(error), Effect.fail(error)))));\n/** @internal */\nexport const tapErrorCause = /*#__PURE__*/dual(2, (self, f) => {\n const loop = core.readWithCause({\n onInput: chunk => core.flatMap(core.write(chunk), () => loop),\n onFailure: cause => core.fromEffect(Effect.zipRight(f(cause), Effect.failCause(cause))),\n onDone: core.succeedNow\n });\n return new StreamImpl(pipe(toChannel(self), core.pipeTo(loop)));\n});\n/** @internal */\nexport const tapSink = /*#__PURE__*/dual(2, (self, sink) => pipe(fromEffect(Effect.all([Queue.bounded(1), Deferred.make()])), flatMap(([queue, deferred]) => {\n const right = flattenTake(fromQueue(queue, {\n maxChunkSize: 1\n }));\n const loop = core.readWithCause({\n onInput: chunk => pipe(core.fromEffect(Queue.offer(queue, InternalTake.chunk(chunk))), core.foldCauseChannel({\n onFailure: () => core.flatMap(core.write(chunk), () => channel.identityChannel()),\n onSuccess: () => core.flatMap(core.write(chunk), () => loop)\n })),\n onFailure: cause => pipe(core.fromEffect(Queue.offer(queue, InternalTake.failCause(cause))), core.foldCauseChannel({\n onFailure: () => core.failCause(cause),\n onSuccess: () => core.failCause(cause)\n })),\n onDone: () => pipe(core.fromEffect(Queue.offer(queue, InternalTake.end)), core.foldCauseChannel({\n onFailure: () => core.void,\n onSuccess: () => core.void\n }))\n });\n return pipe(new StreamImpl(pipe(core.pipeTo(toChannel(self), loop), channel.ensuring(Effect.zipRight(Effect.forkDaemon(Queue.offer(queue, InternalTake.end)), Deferred.await(deferred))))), merge(execute(pipe(run(right, sink), Effect.ensuring(Effect.zipRight(Queue.shutdown(queue), Deferred.succeed(deferred, void 0)))))));\n})));\n/** @internal */\nexport const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(self, {\n ...options,\n cost: chunk => Effect.succeed(options.cost(chunk))\n}));\n/** @internal */\nexport const throttleEffect = /*#__PURE__*/dual(2, (self, options) => {\n if (options.strategy === \"enforce\") {\n return throttleEnforceEffect(self, options.cost, options.units, options.duration, options.burst ?? 0);\n }\n return throttleShapeEffect(self, options.cost, options.units, options.duration, options.burst ?? 0);\n});\nconst throttleEnforceEffect = (self, cost, units, duration, burst) => {\n const loop = (tokens, timestampMillis) => core.readWithCause({\n onInput: input => pipe(cost(input), Effect.zip(Clock.currentTimeMillis), Effect.map(([weight, currentTimeMillis]) => {\n const elapsed = currentTimeMillis - timestampMillis;\n const cycles = elapsed / Duration.toMillis(duration);\n const sum = tokens + cycles * units;\n const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst;\n const available = sum < 0 ? max : Math.min(sum, max);\n if (weight <= available) {\n return pipe(core.write(input), core.flatMap(() => loop(available - weight, currentTimeMillis)));\n }\n return loop(tokens, timestampMillis);\n }), channel.unwrap),\n onFailure: core.failCause,\n onDone: () => core.void\n });\n const throttled = pipe(Clock.currentTimeMillis, Effect.map(currentTimeMillis => loop(units, currentTimeMillis)), channel.unwrap);\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(throttled)));\n};\nconst throttleShapeEffect = (self, costFn, units, duration, burst) => {\n const loop = (tokens, timestampMillis) => core.readWithCause({\n onInput: input => pipe(costFn(input), Effect.zip(Clock.currentTimeMillis), Effect.map(([weight, currentTimeMillis]) => {\n const elapsed = currentTimeMillis - timestampMillis;\n const cycles = elapsed / Duration.toMillis(duration);\n const sum = tokens + cycles * units;\n const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst;\n const available = sum < 0 ? max : Math.min(sum, max);\n const remaining = available - weight;\n const waitCycles = remaining >= 0 ? 0 : -remaining / units;\n const delay = Duration.millis(Math.max(0, waitCycles * Duration.toMillis(duration)));\n if (Duration.greaterThan(delay, Duration.zero)) {\n return pipe(core.fromEffect(Clock.sleep(delay)), channel.zipRight(core.write(input)), core.flatMap(() => loop(remaining, currentTimeMillis)));\n }\n return core.flatMap(core.write(input), () => loop(remaining, currentTimeMillis));\n }), channel.unwrap),\n onFailure: core.failCause,\n onDone: () => core.void\n });\n const throttled = pipe(Clock.currentTimeMillis, Effect.map(currentTimeMillis => loop(units, currentTimeMillis)), channel.unwrap);\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(throttled)));\n};\n/** @internal */\nexport const tick = interval => repeatWithSchedule(void 0, Schedule.spaced(interval));\n/** @internal */\nexport const timeout = /*#__PURE__*/dual(2, (self, duration) => pipe(toPull(self), Effect.map(Effect.timeoutFail({\n onTimeout: () => Option.none(),\n duration\n})), fromPull));\n/** @internal */\nexport const timeoutFail = /*#__PURE__*/dual(3, (self, error, duration) => pipe(self, timeoutTo(duration, failSync(error))));\n/** @internal */\nexport const timeoutFailCause = /*#__PURE__*/dual(3, (self, cause, duration) => pipe(toPull(self), Effect.map(Effect.timeoutFailCause({\n onTimeout: () => Cause.map(cause(), Option.some),\n duration\n})), fromPull));\n/** @internal */\nexport const timeoutTo = /*#__PURE__*/dual(3, (self, duration, that) => {\n const StreamTimeout = new Cause.RuntimeException(\"Stream Timeout\");\n return pipe(self, timeoutFailCause(() => Cause.die(StreamTimeout), duration), catchSomeCause(cause => Cause.isDieType(cause) && Cause.isRuntimeException(cause.defect) && cause.defect.message !== undefined && cause.defect.message === \"Stream Timeout\" ? Option.some(that) : Option.none()));\n});\nconst pubsubFromOptions = options => {\n if (typeof options === \"number\") {\n return PubSub.bounded(options);\n } else if (options.capacity === \"unbounded\") {\n return PubSub.unbounded({\n replay: options.replay\n });\n }\n switch (options.strategy) {\n case \"dropping\":\n return PubSub.dropping(options);\n case \"sliding\":\n return PubSub.sliding(options);\n default:\n return PubSub.bounded(options);\n }\n};\n/** @internal */\nexport const toPubSub = /*#__PURE__*/dual(2, (self, capacity) => pipe(Effect.acquireRelease(pubsubFromOptions(capacity), pubsub => PubSub.shutdown(pubsub)), Effect.tap(pubsub => pipe(self, runIntoPubSubScoped(pubsub), Effect.forkScoped))));\n/** @internal */\nexport const toPull = self => Effect.map(channel.toPull(toChannel(self)), pull => pipe(pull, Effect.mapError(Option.some), Effect.flatMap(Either.match({\n onLeft: () => Effect.fail(Option.none()),\n onRight: Effect.succeed\n}))));\n/** @internal */\nexport const toQueue = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => Effect.tap(Effect.acquireRelease(options?.strategy === \"unbounded\" ? Queue.unbounded() : options?.strategy === \"dropping\" ? Queue.dropping(options.capacity ?? 2) : options?.strategy === \"sliding\" ? Queue.sliding(options.capacity ?? 2) : Queue.bounded(options?.capacity ?? 2), queue => Queue.shutdown(queue)), queue => Effect.forkScoped(runIntoQueueScoped(self, queue))));\n/** @internal */\nexport const toQueueOfElements = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => Effect.tap(Effect.acquireRelease(Queue.bounded(options?.capacity ?? 2), queue => Queue.shutdown(queue)), queue => Effect.forkScoped(runIntoQueueElementsScoped(self, queue))));\n/** @internal */\nexport const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => toReadableStreamRuntime(self, Runtime.defaultRuntime, options));\n/** @internal */\nexport const toReadableStreamEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => Effect.map(Effect.runtime(), runtime => toReadableStreamRuntime(self, runtime, options)));\n/** @internal */\nexport const toReadableStreamRuntime = /*#__PURE__*/dual(args => isStream(args[0]), (self, runtime, options) => {\n const runFork = Runtime.runFork(runtime);\n let currentResolve = undefined;\n let fiber = undefined;\n const latch = Effect.unsafeMakeLatch(false);\n return new ReadableStream({\n start(controller) {\n fiber = runFork(runForEachChunk(self, chunk => {\n if (chunk.length === 0) return Effect.void;\n return latch.whenOpen(Effect.sync(() => {\n latch.unsafeClose();\n for (const item of chunk) {\n controller.enqueue(item);\n }\n currentResolve();\n currentResolve = undefined;\n }));\n }));\n fiber.addObserver(exit => {\n try {\n if (exit._tag === \"Failure\") {\n controller.error(Cause.squash(exit.cause));\n } else {\n controller.close();\n }\n } catch {\n // ignore\n }\n });\n },\n pull() {\n return new Promise(resolve => {\n currentResolve = resolve;\n Effect.runSync(latch.open);\n });\n },\n cancel() {\n if (!fiber) return;\n return Effect.runPromise(Effect.asVoid(Fiber.interrupt(fiber)));\n }\n }, options?.strategy);\n});\n/** @internal */\nexport const transduce = /*#__PURE__*/dual(2, (self, sink) => {\n const newChannel = core.suspend(() => {\n const leftovers = {\n ref: Chunk.empty()\n };\n const upstreamDone = {\n ref: false\n };\n const buffer = core.suspend(() => {\n const leftover = leftovers.ref;\n if (Chunk.isEmpty(leftover)) {\n return core.readWith({\n onInput: input => pipe(core.write(input), core.flatMap(() => buffer)),\n onFailure: core.fail,\n onDone: core.succeedNow\n });\n }\n leftovers.ref = Chunk.empty();\n return pipe(channel.writeChunk(leftover), core.flatMap(() => buffer));\n });\n const concatAndGet = chunk => {\n const leftover = leftovers.ref;\n const concatenated = Chunk.appendAll(leftover, Chunk.filter(chunk, chunk => chunk.length !== 0));\n leftovers.ref = concatenated;\n return concatenated;\n };\n const upstreamMarker = core.readWith({\n onInput: input => core.flatMap(core.write(input), () => upstreamMarker),\n onFailure: core.fail,\n onDone: done => channel.zipRight(core.sync(() => {\n upstreamDone.ref = true;\n }), core.succeedNow(done))\n });\n const transducer = pipe(sink, sink_.toChannel, core.collectElements, core.flatMap(([leftover, z]) => pipe(core.succeed([upstreamDone.ref, concatAndGet(leftover)]), core.flatMap(([done, newLeftovers]) => {\n const nextChannel = done && Chunk.isEmpty(newLeftovers) ? core.void : transducer;\n return pipe(core.write(Chunk.of(z)), core.flatMap(() => nextChannel));\n }))));\n return pipe(toChannel(self), core.pipeTo(upstreamMarker), core.pipeTo(buffer), channel.pipeToOrFail(transducer));\n });\n return new StreamImpl(newChannel);\n});\n/** @internal */\nexport const toAsyncIterableRuntime = /*#__PURE__*/dual(args => isStream(args[0]), (self, runtime) => {\n const runFork = Runtime.runFork(runtime);\n return {\n [Symbol.asyncIterator]() {\n let currentResolve = undefined;\n let currentReject = undefined;\n let fiber = undefined;\n const latch = Effect.unsafeMakeLatch(false);\n let returned = false;\n return {\n next() {\n if (!fiber) {\n fiber = runFork(runForEach(self, value => latch.whenOpen(Effect.sync(() => {\n latch.unsafeClose();\n currentResolve({\n done: false,\n value\n });\n currentResolve = currentReject = undefined;\n }))));\n fiber.addObserver(exit => {\n if (returned) return;\n fiber = Effect.runFork(latch.whenOpen(Effect.sync(() => {\n if (exit._tag === \"Failure\") {\n currentReject(Cause.squash(exit.cause));\n } else {\n currentResolve({\n done: true,\n value: void 0\n });\n }\n currentResolve = currentReject = undefined;\n })));\n });\n }\n return new Promise((resolve, reject) => {\n currentResolve = resolve;\n currentReject = reject;\n latch.unsafeOpen();\n });\n },\n return() {\n returned = true;\n if (!fiber) return Promise.resolve({\n done: true,\n value: void 0\n });\n return Effect.runPromise(Effect.as(Fiber.interrupt(fiber), {\n done: true,\n value: void 0\n }));\n }\n };\n }\n };\n});\n/** @internal */\nexport const toAsyncIterable = self => toAsyncIterableRuntime(self, Runtime.defaultRuntime);\n/** @internal */\nexport const toAsyncIterableEffect = self => Effect.map(Effect.runtime(), runtime => toAsyncIterableRuntime(self, runtime));\n/** @internal */\nexport const unfold = (s, f) => unfoldChunk(s, s => pipe(f(s), Option.map(([a, s]) => [Chunk.of(a), s])));\n/** @internal */\nexport const unfoldChunk = (s, f) => {\n const loop = s => Option.match(f(s), {\n onNone: () => core.void,\n onSome: ([chunk, s]) => core.flatMap(core.write(chunk), () => loop(s))\n });\n return new StreamImpl(core.suspend(() => loop(s)));\n};\n/** @internal */\nexport const unfoldChunkEffect = (s, f) => suspend(() => {\n const loop = s => channel.unwrap(Effect.map(f(s), Option.match({\n onNone: () => core.void,\n onSome: ([chunk, s]) => core.flatMap(core.write(chunk), () => loop(s))\n })));\n return new StreamImpl(loop(s));\n});\n/** @internal */\nexport const unfoldEffect = (s, f) => unfoldChunkEffect(s, s => pipe(f(s), Effect.map(Option.map(([a, s]) => [Chunk.of(a), s]))));\nconst void_ = /*#__PURE__*/succeed(void 0);\nexport { /** @internal */\nvoid_ as void };\n/** @internal */\nexport const unwrap = effect => flatten(fromEffect(effect));\n/** @internal */\nexport const unwrapScoped = effect => flatten(scoped(effect));\n/** @internal */\nexport const unwrapScopedWith = f => flatten(scopedWith(scope => f(scope)));\n/** @internal */\nexport const updateService = /*#__PURE__*/dual(3, (self, tag, f) => pipe(self, mapInputContext(context => pipe(context, Context.add(tag, f(pipe(context, Context.unsafeGet(tag))))))));\n/** @internal */\nexport const when = /*#__PURE__*/dual(2, (self, test) => pipe(self, whenEffect(Effect.sync(test))));\n/** @internal */\nexport const whenCase = (evaluate, pf) => whenCaseEffect(pf)(Effect.sync(evaluate));\n/** @internal */\nexport const whenCaseEffect = /*#__PURE__*/dual(2, (self, pf) => pipe(fromEffect(self), flatMap(a => pipe(pf(a), Option.getOrElse(() => empty)))));\n/** @internal */\nexport const whenEffect = /*#__PURE__*/dual(2, (self, effect) => pipe(fromEffect(effect), flatMap(bool => bool ? self : empty)));\n/** @internal */\nexport const withSpan = function () {\n const dataFirst = typeof arguments[0] !== \"string\";\n const name = dataFirst ? arguments[1] : arguments[0];\n const options = InternalTracer.addSpanStackTrace(dataFirst ? arguments[2] : arguments[1]);\n if (dataFirst) {\n const self = arguments[0];\n return new StreamImpl(channel.withSpan(toChannel(self), name, options));\n }\n return self => new StreamImpl(channel.withSpan(toChannel(self), name, options));\n};\n/** @internal */\nexport const zip = /*#__PURE__*/dual(2, (self, that) => pipe(self, zipWith(that, (a, a2) => [a, a2])));\n/** @internal */\nexport const zipFlatten = /*#__PURE__*/dual(2, (self, that) => pipe(self, zipWith(that, (a, a2) => [...a, a2])));\n/** @internal */\nexport const zipAll = /*#__PURE__*/dual(2, (self, options) => zipAllWith(self, {\n other: options.other,\n onSelf: a => [a, options.defaultOther],\n onOther: a2 => [options.defaultSelf, a2],\n onBoth: (a, a2) => [a, a2]\n}));\n/** @internal */\nexport const zipAllLeft = /*#__PURE__*/dual(3, (self, other, defaultSelf) => zipAllWith(self, {\n other,\n onSelf: identity,\n onOther: () => defaultSelf,\n onBoth: a => a\n}));\n/** @internal */\nexport const zipAllRight = /*#__PURE__*/dual(3, (self, other, defaultRight) => zipAllWith(self, {\n other,\n onSelf: () => defaultRight,\n onOther: identity,\n onBoth: (_, a2) => a2\n}));\n/** @internal */\nexport const zipAllSortedByKey = /*#__PURE__*/dual(2, (self, options) => zipAllSortedByKeyWith(self, {\n other: options.other,\n onSelf: a => [a, options.defaultOther],\n onOther: a2 => [options.defaultSelf, a2],\n onBoth: (a, a2) => [a, a2],\n order: options.order\n}));\n/** @internal */\nexport const zipAllSortedByKeyLeft = /*#__PURE__*/dual(2, (self, options) => zipAllSortedByKeyWith(self, {\n other: options.other,\n onSelf: identity,\n onOther: () => options.defaultSelf,\n onBoth: a => a,\n order: options.order\n}));\n/** @internal */\nexport const zipAllSortedByKeyRight = /*#__PURE__*/dual(2, (self, options) => zipAllSortedByKeyWith(self, {\n other: options.other,\n onSelf: () => options.defaultOther,\n onOther: identity,\n onBoth: (_, a2) => a2,\n order: options.order\n}));\n/** @internal */\nexport const zipAllSortedByKeyWith = /*#__PURE__*/dual(2, (self, options) => {\n const pull = (state, pullLeft, pullRight) => {\n switch (state._tag) {\n case ZipAllState.OP_DRAIN_LEFT:\n {\n return pipe(pullLeft, Effect.match({\n onFailure: Exit.fail,\n onSuccess: leftChunk => Exit.succeed([Chunk.map(leftChunk, ([k, a]) => [k, options.onSelf(a)]), ZipAllState.DrainLeft])\n }));\n }\n case ZipAllState.OP_DRAIN_RIGHT:\n {\n return pipe(pullRight, Effect.match({\n onFailure: Exit.fail,\n onSuccess: rightChunk => Exit.succeed([Chunk.map(rightChunk, ([k, a2]) => [k, options.onOther(a2)]), ZipAllState.DrainRight])\n }));\n }\n case ZipAllState.OP_PULL_BOTH:\n {\n return pipe(unsome(pullLeft), Effect.zip(unsome(pullRight), {\n concurrent: true\n }), Effect.matchEffect({\n onFailure: error => Effect.succeed(Exit.fail(Option.some(error))),\n onSuccess: ([leftOption, rightOption]) => {\n if (Option.isSome(leftOption) && Option.isSome(rightOption)) {\n if (Chunk.isEmpty(leftOption.value) && Chunk.isEmpty(rightOption.value)) {\n return pull(ZipAllState.PullBoth, pullLeft, pullRight);\n }\n if (Chunk.isEmpty(leftOption.value)) {\n return pull(ZipAllState.PullLeft(rightOption.value), pullLeft, pullRight);\n }\n if (Chunk.isEmpty(rightOption.value)) {\n return pull(ZipAllState.PullRight(leftOption.value), pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed(merge(leftOption.value, rightOption.value)));\n }\n if (Option.isSome(leftOption) && Option.isNone(rightOption)) {\n if (Chunk.isEmpty(leftOption.value)) {\n return pull(ZipAllState.DrainLeft, pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed([pipe(leftOption.value, Chunk.map(([k, a]) => [k, options.onSelf(a)])), ZipAllState.DrainLeft]));\n }\n if (Option.isNone(leftOption) && Option.isSome(rightOption)) {\n if (Chunk.isEmpty(rightOption.value)) {\n return pull(ZipAllState.DrainRight, pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed([pipe(rightOption.value, Chunk.map(([k, a2]) => [k, options.onOther(a2)])), ZipAllState.DrainRight]));\n }\n return Effect.succeed(Exit.fail(Option.none()));\n }\n }));\n }\n case ZipAllState.OP_PULL_LEFT:\n {\n return Effect.matchEffect(pullLeft, {\n onFailure: Option.match({\n onNone: () => Effect.succeed(Exit.succeed([pipe(state.rightChunk, Chunk.map(([k, a2]) => [k, options.onOther(a2)])), ZipAllState.DrainRight])),\n onSome: error => Effect.succeed(Exit.fail(Option.some(error)))\n }),\n onSuccess: leftChunk => Chunk.isEmpty(leftChunk) ? pull(ZipAllState.PullLeft(state.rightChunk), pullLeft, pullRight) : Effect.succeed(Exit.succeed(merge(leftChunk, state.rightChunk)))\n });\n }\n case ZipAllState.OP_PULL_RIGHT:\n {\n return Effect.matchEffect(pullRight, {\n onFailure: Option.match({\n onNone: () => Effect.succeed(Exit.succeed([Chunk.map(state.leftChunk, ([k, a]) => [k, options.onSelf(a)]), ZipAllState.DrainLeft])),\n onSome: error => Effect.succeed(Exit.fail(Option.some(error)))\n }),\n onSuccess: rightChunk => Chunk.isEmpty(rightChunk) ? pull(ZipAllState.PullRight(state.leftChunk), pullLeft, pullRight) : Effect.succeed(Exit.succeed(merge(state.leftChunk, rightChunk)))\n });\n }\n }\n };\n const merge = (leftChunk, rightChunk) => {\n const hasNext = (chunk, index) => index < chunk.length - 1;\n const builder = [];\n let state = undefined;\n let leftIndex = 0;\n let rightIndex = 0;\n let leftTuple = pipe(leftChunk, Chunk.unsafeGet(leftIndex));\n let rightTuple = pipe(rightChunk, Chunk.unsafeGet(rightIndex));\n let k1 = leftTuple[0];\n let a = leftTuple[1];\n let k2 = rightTuple[0];\n let a2 = rightTuple[1];\n let loop = true;\n while (loop) {\n const compare = options.order(k1, k2);\n if (compare === 0) {\n builder.push([k1, options.onBoth(a, a2)]);\n if (hasNext(leftChunk, leftIndex) && hasNext(rightChunk, rightIndex)) {\n leftIndex = leftIndex + 1;\n rightIndex = rightIndex + 1;\n leftTuple = pipe(leftChunk, Chunk.unsafeGet(leftIndex));\n rightTuple = pipe(rightChunk, Chunk.unsafeGet(rightIndex));\n k1 = leftTuple[0];\n a = leftTuple[1];\n k2 = rightTuple[0];\n a2 = rightTuple[1];\n } else if (hasNext(leftChunk, leftIndex)) {\n state = ZipAllState.PullRight(pipe(leftChunk, Chunk.drop(leftIndex + 1)));\n loop = false;\n } else if (hasNext(rightChunk, rightIndex)) {\n state = ZipAllState.PullLeft(pipe(rightChunk, Chunk.drop(rightIndex + 1)));\n loop = false;\n } else {\n state = ZipAllState.PullBoth;\n loop = false;\n }\n } else if (compare < 0) {\n builder.push([k1, options.onSelf(a)]);\n if (hasNext(leftChunk, leftIndex)) {\n leftIndex = leftIndex + 1;\n leftTuple = pipe(leftChunk, Chunk.unsafeGet(leftIndex));\n k1 = leftTuple[0];\n a = leftTuple[1];\n } else {\n const rightBuilder = [];\n rightBuilder.push(rightTuple);\n while (hasNext(rightChunk, rightIndex)) {\n rightIndex = rightIndex + 1;\n rightTuple = pipe(rightChunk, Chunk.unsafeGet(rightIndex));\n rightBuilder.push(rightTuple);\n }\n state = ZipAllState.PullLeft(Chunk.unsafeFromArray(rightBuilder));\n loop = false;\n }\n } else {\n builder.push([k2, options.onOther(a2)]);\n if (hasNext(rightChunk, rightIndex)) {\n rightIndex = rightIndex + 1;\n rightTuple = pipe(rightChunk, Chunk.unsafeGet(rightIndex));\n k2 = rightTuple[0];\n a2 = rightTuple[1];\n } else {\n const leftBuilder = [];\n leftBuilder.push(leftTuple);\n while (hasNext(leftChunk, leftIndex)) {\n leftIndex = leftIndex + 1;\n leftTuple = pipe(leftChunk, Chunk.unsafeGet(leftIndex));\n leftBuilder.push(leftTuple);\n }\n state = ZipAllState.PullRight(Chunk.unsafeFromArray(leftBuilder));\n loop = false;\n }\n }\n }\n return [Chunk.unsafeFromArray(builder), state];\n };\n return combineChunks(self, options.other, ZipAllState.PullBoth, pull);\n});\n/** @internal */\nexport const zipAllWith = /*#__PURE__*/dual(2, (self, options) => {\n const pull = (state, pullLeft, pullRight) => {\n switch (state._tag) {\n case ZipAllState.OP_DRAIN_LEFT:\n {\n return Effect.matchEffect(pullLeft, {\n onFailure: error => Effect.succeed(Exit.fail(error)),\n onSuccess: leftChunk => Effect.succeed(Exit.succeed([Chunk.map(leftChunk, options.onSelf), ZipAllState.DrainLeft]))\n });\n }\n case ZipAllState.OP_DRAIN_RIGHT:\n {\n return Effect.matchEffect(pullRight, {\n onFailure: error => Effect.succeed(Exit.fail(error)),\n onSuccess: rightChunk => Effect.succeed(Exit.succeed([Chunk.map(rightChunk, options.onOther), ZipAllState.DrainRight]))\n });\n }\n case ZipAllState.OP_PULL_BOTH:\n {\n return pipe(unsome(pullLeft), Effect.zip(unsome(pullRight), {\n concurrent: true\n }), Effect.matchEffect({\n onFailure: error => Effect.succeed(Exit.fail(Option.some(error))),\n onSuccess: ([leftOption, rightOption]) => {\n if (Option.isSome(leftOption) && Option.isSome(rightOption)) {\n if (Chunk.isEmpty(leftOption.value) && Chunk.isEmpty(rightOption.value)) {\n return pull(ZipAllState.PullBoth, pullLeft, pullRight);\n }\n if (Chunk.isEmpty(leftOption.value)) {\n return pull(ZipAllState.PullLeft(rightOption.value), pullLeft, pullRight);\n }\n if (Chunk.isEmpty(rightOption.value)) {\n return pull(ZipAllState.PullRight(leftOption.value), pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed(zip(leftOption.value, rightOption.value, options.onBoth)));\n }\n if (Option.isSome(leftOption) && Option.isNone(rightOption)) {\n return Effect.succeed(Exit.succeed([Chunk.map(leftOption.value, options.onSelf), ZipAllState.DrainLeft]));\n }\n if (Option.isNone(leftOption) && Option.isSome(rightOption)) {\n return Effect.succeed(Exit.succeed([Chunk.map(rightOption.value, options.onOther), ZipAllState.DrainRight]));\n }\n return Effect.succeed(Exit.fail(Option.none()));\n }\n }));\n }\n case ZipAllState.OP_PULL_LEFT:\n {\n return Effect.matchEffect(pullLeft, {\n onFailure: Option.match({\n onNone: () => Effect.succeed(Exit.succeed([Chunk.map(state.rightChunk, options.onOther), ZipAllState.DrainRight])),\n onSome: error => Effect.succeed(Exit.fail(Option.some(error)))\n }),\n onSuccess: leftChunk => {\n if (Chunk.isEmpty(leftChunk)) {\n return pull(ZipAllState.PullLeft(state.rightChunk), pullLeft, pullRight);\n }\n if (Chunk.isEmpty(state.rightChunk)) {\n return pull(ZipAllState.PullRight(leftChunk), pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed(zip(leftChunk, state.rightChunk, options.onBoth)));\n }\n });\n }\n case ZipAllState.OP_PULL_RIGHT:\n {\n return Effect.matchEffect(pullRight, {\n onFailure: Option.match({\n onNone: () => Effect.succeed(Exit.succeed([Chunk.map(state.leftChunk, options.onSelf), ZipAllState.DrainLeft])),\n onSome: error => Effect.succeed(Exit.fail(Option.some(error)))\n }),\n onSuccess: rightChunk => {\n if (Chunk.isEmpty(rightChunk)) {\n return pull(ZipAllState.PullRight(state.leftChunk), pullLeft, pullRight);\n }\n if (Chunk.isEmpty(state.leftChunk)) {\n return pull(ZipAllState.PullLeft(rightChunk), pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed(zip(state.leftChunk, rightChunk, options.onBoth)));\n }\n });\n }\n }\n };\n const zip = (leftChunk, rightChunk, f) => {\n const [output, either] = zipChunks(leftChunk, rightChunk, f);\n switch (either._tag) {\n case \"Left\":\n {\n if (Chunk.isEmpty(either.left)) {\n return [output, ZipAllState.PullBoth];\n }\n return [output, ZipAllState.PullRight(either.left)];\n }\n case \"Right\":\n {\n if (Chunk.isEmpty(either.right)) {\n return [output, ZipAllState.PullBoth];\n }\n return [output, ZipAllState.PullLeft(either.right)];\n }\n }\n };\n return combineChunks(self, options.other, ZipAllState.PullBoth, pull);\n});\n/** @internal */\nexport const zipLatest = /*#__PURE__*/dual(2, (left, right) => pipe(left, zipLatestWith(right, (a, a2) => [a, a2])));\nexport const zipLatestAll = (...streams) => {\n if (streams.length === 0) {\n return empty;\n } else if (streams.length === 1) {\n return map(streams[0], x => [x]);\n }\n const [head, ...tail] = streams;\n return zipLatestWith(head, zipLatestAll(...tail), (first, second) => [first, ...second]);\n};\n/** @internal */\nexport const zipLatestWith = /*#__PURE__*/dual(3, (left, right, f) => {\n const pullNonEmpty = pull => pipe(pull, Effect.flatMap(chunk => Chunk.isEmpty(chunk) ? pullNonEmpty(pull) : Effect.succeed(chunk)));\n return pipe(toPull(left), Effect.map(pullNonEmpty), Effect.zip(pipe(toPull(right), Effect.map(pullNonEmpty))), Effect.flatMap(([left, right]) => pipe(fromEffectOption(Effect.raceWith(left, right, {\n onSelfDone: (leftDone, rightFiber) => pipe(Effect.suspend(() => leftDone), Effect.zipWith(Fiber.join(rightFiber), (l, r) => [l, r, true])),\n onOtherDone: (rightDone, leftFiber) => pipe(Effect.suspend(() => rightDone), Effect.zipWith(Fiber.join(leftFiber), (l, r) => [r, l, false]))\n })), flatMap(([l, r, leftFirst]) => pipe(fromEffect(Ref.make([Chunk.unsafeLast(l), Chunk.unsafeLast(r)])), flatMap(latest => pipe(fromChunk(leftFirst ? pipe(r, Chunk.map(a2 => f(Chunk.unsafeLast(l), a2))) : pipe(l, Chunk.map(a => f(a, Chunk.unsafeLast(r))))), concat(pipe(repeatEffectOption(left), mergeEither(repeatEffectOption(right)), mapEffectSequential(Either.match({\n onLeft: leftChunk => Ref.modify(latest, ([_, rightLatest]) => [pipe(leftChunk, Chunk.map(a => f(a, rightLatest))), [Chunk.unsafeLast(leftChunk), rightLatest]]),\n onRight: rightChunk => Ref.modify(latest, ([leftLatest, _]) => [pipe(rightChunk, Chunk.map(a2 => f(leftLatest, a2))), [leftLatest, Chunk.unsafeLast(rightChunk)]])\n })), flatMap(fromChunk))))))), toPull)), fromPull);\n});\n/** @internal */\nexport const zipLeft = /*#__PURE__*/dual(2, (left, right) => pipe(left, zipWithChunks(right, (left, right) => {\n if (left.length > right.length) {\n return [pipe(left, Chunk.take(right.length)), Either.left(pipe(left, Chunk.take(right.length)))];\n }\n return [left, Either.right(pipe(right, Chunk.drop(left.length)))];\n})));\n/** @internal */\nexport const zipRight = /*#__PURE__*/dual(2, (left, right) => pipe(left, zipWithChunks(right, (left, right) => {\n if (left.length > right.length) {\n return [right, Either.left(pipe(left, Chunk.take(right.length)))];\n }\n return [pipe(right, Chunk.take(left.length)), Either.right(pipe(right, Chunk.drop(left.length)))];\n})));\n/** @internal */\nexport const zipWith = /*#__PURE__*/dual(3, (left, right, f) => pipe(left, zipWithChunks(right, (leftChunk, rightChunk) => zipChunks(leftChunk, rightChunk, f))));\n/** @internal */\nexport const zipWithChunks = /*#__PURE__*/dual(3, (self, that, f) => {\n const pull = (state, pullLeft, pullRight) => {\n switch (state._tag) {\n case ZipChunksState.OP_PULL_BOTH:\n {\n return pipe(unsome(pullLeft), Effect.zip(unsome(pullRight), {\n concurrent: true\n }), Effect.matchEffect({\n onFailure: error => Effect.succeed(Exit.fail(Option.some(error))),\n onSuccess: ([leftOption, rightOption]) => {\n if (Option.isSome(leftOption) && Option.isSome(rightOption)) {\n if (Chunk.isEmpty(leftOption.value) && Chunk.isEmpty(rightOption.value)) {\n return pull(ZipChunksState.PullBoth, pullLeft, pullRight);\n }\n if (Chunk.isEmpty(leftOption.value)) {\n return pull(ZipChunksState.PullLeft(rightOption.value), pullLeft, pullRight);\n }\n if (Chunk.isEmpty(rightOption.value)) {\n return pull(ZipChunksState.PullRight(leftOption.value), pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed(zip(leftOption.value, rightOption.value)));\n }\n return Effect.succeed(Exit.fail(Option.none()));\n }\n }));\n }\n case ZipChunksState.OP_PULL_LEFT:\n {\n return Effect.matchEffect(pullLeft, {\n onFailure: error => Effect.succeed(Exit.fail(error)),\n onSuccess: leftChunk => {\n if (Chunk.isEmpty(leftChunk)) {\n return pull(ZipChunksState.PullLeft(state.rightChunk), pullLeft, pullRight);\n }\n if (Chunk.isEmpty(state.rightChunk)) {\n return pull(ZipChunksState.PullRight(leftChunk), pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed(zip(leftChunk, state.rightChunk)));\n }\n });\n }\n case ZipChunksState.OP_PULL_RIGHT:\n {\n return Effect.matchEffect(pullRight, {\n onFailure: error => Effect.succeed(Exit.fail(error)),\n onSuccess: rightChunk => {\n if (Chunk.isEmpty(rightChunk)) {\n return pull(ZipChunksState.PullRight(state.leftChunk), pullLeft, pullRight);\n }\n if (Chunk.isEmpty(state.leftChunk)) {\n return pull(ZipChunksState.PullLeft(rightChunk), pullLeft, pullRight);\n }\n return Effect.succeed(Exit.succeed(zip(state.leftChunk, rightChunk)));\n }\n });\n }\n }\n };\n const zip = (leftChunk, rightChunk) => {\n const [output, either] = f(leftChunk, rightChunk);\n switch (either._tag) {\n case \"Left\":\n {\n if (Chunk.isEmpty(either.left)) {\n return [output, ZipChunksState.PullBoth];\n }\n return [output, ZipChunksState.PullRight(either.left)];\n }\n case \"Right\":\n {\n if (Chunk.isEmpty(either.right)) {\n return [output, ZipChunksState.PullBoth];\n }\n return [output, ZipChunksState.PullLeft(either.right)];\n }\n }\n };\n return pipe(self, combineChunks(that, ZipChunksState.PullBoth, pull));\n});\n/** @internal */\nexport const zipWithIndex = self => pipe(self, mapAccum(0, (index, a) => [index + 1, [a, index]]));\n/** @internal */\nexport const zipWithNext = self => {\n const process = last => core.readWithCause({\n onInput: input => {\n const [newLast, chunk] = Chunk.mapAccum(input, last, (prev, curr) => [Option.some(curr), pipe(prev, Option.map(a => [a, curr]))]);\n const output = Chunk.filterMap(chunk, option => Option.isSome(option) ? Option.some([option.value[0], Option.some(option.value[1])]) : Option.none());\n return core.flatMap(core.write(output), () => process(newLast));\n },\n onFailure: core.failCause,\n onDone: () => Option.match(last, {\n onNone: () => core.void,\n onSome: value => channel.zipRight(core.write(Chunk.of([value, Option.none()])), core.void)\n })\n });\n return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(process(Option.none()))));\n};\n/** @internal */\nexport const zipWithPrevious = self => pipe(self, mapAccum(Option.none(), (prev, curr) => [Option.some(curr), [prev, curr]]));\n/** @internal */\nexport const zipWithPreviousAndNext = self => pipe(zipWithNext(zipWithPrevious(self)), map(([[prev, curr], next]) => [prev, curr, pipe(next, Option.map(tuple => tuple[1]))]));\n/** @internal */\nconst zipChunks = (left, right, f) => {\n if (left.length > right.length) {\n return [pipe(left, Chunk.take(right.length), Chunk.zipWith(right, f)), Either.left(pipe(left, Chunk.drop(right.length)))];\n }\n return [pipe(left, Chunk.zipWith(pipe(right, Chunk.take(left.length)), f)), Either.right(pipe(right, Chunk.drop(left.length)))];\n};\n// Do notation\n/** @internal */\nexport const Do = /*#__PURE__*/succeed({});\n/** @internal */\nexport const bind = /*#__PURE__*/dual(args => typeof args[0] !== \"string\", (self, tag, f, options) => flatMap(self, k => map(f(k), a => ({\n ...k,\n [tag]: a\n})), options));\n/* @internal */\nexport const bindTo = /*#__PURE__*/doNotation.bindTo(map);\n/* @internal */\nexport const let_ = /*#__PURE__*/doNotation.let_(map);\n// Circular with Channel\n/** @internal */\nexport const channelToStream = self => {\n return new StreamImpl(self);\n};\n// =============================================================================\n// encoding\n// =============================================================================\n/** @internal */\nexport const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, encoding = \"utf-8\") => suspend(() => {\n const decoder = new TextDecoder(encoding);\n return map(self, s => decoder.decode(s));\n}));\n/** @internal */\nexport const encodeText = self => suspend(() => {\n const encoder = new TextEncoder();\n return map(self, s => encoder.encode(s));\n});\n/** @internal */\nexport const fromEventListener = (target, type, options) => asyncPush(emit => Effect.acquireRelease(Effect.sync(() => target.addEventListener(type, emit.single, options)), () => Effect.sync(() => target.removeEventListener(type, emit.single, options))), {\n bufferSize: typeof options === \"object\" ? options.bufferSize : undefined\n});\n//# sourceMappingURL=stream.js.map","import * as Cause from \"../Cause.js\";\nimport * as Chunk from \"../Chunk.js\";\nimport * as Deferred from \"../Deferred.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Effectable from \"../Effectable.js\";\nimport * as Exit from \"../Exit.js\";\nimport { dual, pipe } from \"../Function.js\";\nimport * as Option from \"../Option.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as Queue from \"../Queue.js\";\nimport * as Ref from \"../Ref.js\";\nimport * as Scope from \"../Scope.js\";\nimport * as channel from \"./channel.js\";\nimport * as channelExecutor from \"./channel/channelExecutor.js\";\nimport * as core from \"./core-stream.js\";\nimport * as stream from \"./stream.js\";\nimport * as take from \"./take.js\";\n/** @internal */\nconst GroupBySymbolKey = \"effect/GroupBy\";\n/** @internal */\nexport const GroupByTypeId = /*#__PURE__*/Symbol.for(GroupBySymbolKey);\nconst groupByVariance = {\n /* c8 ignore next */\n _R: _ => _,\n /* c8 ignore next */\n _E: _ => _,\n /* c8 ignore next */\n _K: _ => _,\n /* c8 ignore next */\n _V: _ => _\n};\n/** @internal */\nexport const isGroupBy = u => hasProperty(u, GroupByTypeId);\n/** @internal */\nexport const evaluate = /*#__PURE__*/dual(args => isGroupBy(args[0]), (self, f, options) => stream.flatMap(self.grouped, ([key, queue]) => f(key, stream.flattenTake(stream.fromQueue(queue, {\n shutdown: true\n}))), {\n concurrency: \"unbounded\",\n bufferSize: options?.bufferSize ?? 16\n}));\n/** @internal */\nexport const filter = /*#__PURE__*/dual(2, (self, predicate) => make(pipe(self.grouped, stream.filterEffect(tuple => {\n if (predicate(tuple[0])) {\n return pipe(Effect.succeed(tuple), Effect.as(true));\n }\n return pipe(Queue.shutdown(tuple[1]), Effect.as(false));\n}))));\n/** @internal */\nexport const first = /*#__PURE__*/dual(2, (self, n) => make(pipe(stream.zipWithIndex(self.grouped), stream.filterEffect(tuple => {\n const index = tuple[1];\n const queue = tuple[0][1];\n if (index < n) {\n return pipe(Effect.succeed(tuple), Effect.as(true));\n }\n return pipe(Queue.shutdown(queue), Effect.as(false));\n}), stream.map(tuple => tuple[0]))));\n/** @internal */\nexport const make = grouped => ({\n [GroupByTypeId]: groupByVariance,\n pipe() {\n return pipeArguments(this, arguments);\n },\n grouped\n});\n// Circular with Stream\n/** @internal */\nexport const groupBy = /*#__PURE__*/dual(args => stream.isStream(args[0]), (self, f, options) => make(stream.unwrapScoped(Effect.gen(function* () {\n const decider = yield* Deferred.make();\n const output = yield* Effect.acquireRelease(Queue.bounded(options?.bufferSize ?? 16), queue => Queue.shutdown(queue));\n const ref = yield* Ref.make(new Map());\n const add = yield* pipe(stream.mapEffectSequential(self, f), stream.distributedWithDynamicCallback(options?.bufferSize ?? 16, ([key, value]) => Effect.flatMap(Deferred.await(decider), f => f(key, value)), exit => Queue.offer(output, exit)));\n yield* Deferred.succeed(decider, (key, _) => pipe(Ref.get(ref), Effect.map(map => Option.fromNullable(map.get(key))), Effect.flatMap(Option.match({\n onNone: () => Effect.flatMap(add, ([index, queue]) => Effect.zipRight(Ref.update(ref, map => map.set(key, index)), pipe(Queue.offer(output, Exit.succeed([key, mapDequeue(queue, exit => new take.TakeImpl(pipe(exit, Exit.map(tuple => Chunk.of(tuple[1])))))])), Effect.as(n => n === index)))),\n onSome: index => Effect.succeed(n => n === index)\n }))));\n return stream.flattenExitOption(stream.fromQueue(output, {\n shutdown: true\n }));\n}))));\n/** @internal */\nexport const mapEffectOptions = /*#__PURE__*/dual(args => typeof args[0] !== \"function\", (self, f, options) => {\n if (options?.key) {\n return evaluate(groupByKey(self, options.key, {\n bufferSize: options.bufferSize\n }), (_, s) => stream.mapEffectSequential(s, f));\n }\n return stream.matchConcurrency(options?.concurrency, () => stream.mapEffectSequential(self, f), n => options?.unordered ? stream.flatMap(self, a => stream.fromEffect(f(a)), {\n concurrency: n\n }) : stream.mapEffectPar(self, n, f));\n});\n/** @internal */\nexport const bindEffect = /*#__PURE__*/dual(args => typeof args[0] !== \"string\", (self, tag, f, options) => mapEffectOptions(self, k => Effect.map(f(k), a => ({\n ...k,\n [tag]: a\n})), options));\nconst mapDequeue = (dequeue, f) => new MapDequeue(dequeue, f);\nclass MapDequeue extends Effectable.Class {\n dequeue;\n f;\n [Queue.DequeueTypeId] = {\n _Out: _ => _\n };\n constructor(dequeue, f) {\n super();\n this.dequeue = dequeue;\n this.f = f;\n }\n capacity() {\n return Queue.capacity(this.dequeue);\n }\n get size() {\n return Queue.size(this.dequeue);\n }\n unsafeSize() {\n return this.dequeue.unsafeSize();\n }\n get awaitShutdown() {\n return Queue.awaitShutdown(this.dequeue);\n }\n isActive() {\n return this.dequeue.isActive();\n }\n get isShutdown() {\n return Queue.isShutdown(this.dequeue);\n }\n get shutdown() {\n return Queue.shutdown(this.dequeue);\n }\n get isFull() {\n return Queue.isFull(this.dequeue);\n }\n get isEmpty() {\n return Queue.isEmpty(this.dequeue);\n }\n get take() {\n return pipe(Queue.take(this.dequeue), Effect.map(a => this.f(a)));\n }\n get takeAll() {\n return pipe(Queue.takeAll(this.dequeue), Effect.map(Chunk.map(a => this.f(a))));\n }\n takeUpTo(max) {\n return pipe(Queue.takeUpTo(this.dequeue, max), Effect.map(Chunk.map(a => this.f(a))));\n }\n takeBetween(min, max) {\n return pipe(Queue.takeBetween(this.dequeue, min, max), Effect.map(Chunk.map(a => this.f(a))));\n }\n takeN(n) {\n return pipe(Queue.takeN(this.dequeue, n), Effect.map(Chunk.map(a => this.f(a))));\n }\n poll() {\n return pipe(Queue.poll(this.dequeue), Effect.map(Option.map(a => this.f(a))));\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n commit() {\n return this.take;\n }\n}\n/** @internal */\nexport const groupByKey = /*#__PURE__*/dual(args => typeof args[0] !== \"function\", (self, f, options) => {\n const loop = (map, outerQueue) => core.readWithCause({\n onInput: input => core.flatMap(core.fromEffect(Effect.forEach(groupByIterable(input, f), ([key, values]) => {\n const innerQueue = map.get(key);\n if (innerQueue === undefined) {\n return pipe(Queue.bounded(options?.bufferSize ?? 16), Effect.flatMap(innerQueue => pipe(Effect.sync(() => {\n map.set(key, innerQueue);\n }), Effect.zipRight(Queue.offer(outerQueue, take.of([key, innerQueue]))), Effect.zipRight(pipe(Queue.offer(innerQueue, take.chunk(values)), Effect.catchSomeCause(cause => Cause.isInterruptedOnly(cause) ? Option.some(Effect.void) : Option.none()))))));\n }\n return Effect.catchSomeCause(Queue.offer(innerQueue, take.chunk(values)), cause => Cause.isInterruptedOnly(cause) ? Option.some(Effect.void) : Option.none());\n }, {\n discard: true\n })), () => loop(map, outerQueue)),\n onFailure: cause => core.fromEffect(Queue.offer(outerQueue, take.failCause(cause))),\n onDone: () => core.fromEffect(pipe(Effect.forEach(map.entries(), ([_, innerQueue]) => pipe(Queue.offer(innerQueue, take.end), Effect.catchSomeCause(cause => Cause.isInterruptedOnly(cause) ? Option.some(Effect.void) : Option.none())), {\n discard: true\n }), Effect.zipRight(Queue.offer(outerQueue, take.end))))\n });\n return make(stream.unwrapScopedWith(scope => Effect.gen(function* () {\n const map = new Map();\n const queue = yield* Queue.unbounded();\n yield* Scope.addFinalizer(scope, Queue.shutdown(queue));\n return yield* stream.toChannel(self).pipe(core.pipeTo(loop(map, queue)), channel.drain, channelExecutor.runIn(scope), Effect.forkIn(scope), Effect.as(stream.flattenTake(stream.fromQueue(queue, {\n shutdown: true\n }))));\n })));\n});\n/**\n * A variant of `groupBy` that retains the insertion order of keys.\n *\n * @internal\n */\nconst groupByIterable = /*#__PURE__*/dual(2, (iterable, f) => {\n const builder = [];\n const iterator = iterable[Symbol.iterator]();\n const map = new Map();\n let next;\n while ((next = iterator.next()) && !next.done) {\n const value = next.value;\n const key = f(value);\n if (map.has(key)) {\n const innerBuilder = map.get(key);\n innerBuilder.push(value);\n } else {\n const innerBuilder = [value];\n builder.push([key, innerBuilder]);\n map.set(key, innerBuilder);\n }\n }\n return Chunk.unsafeFromArray(builder.map(tuple => [tuple[0], Chunk.unsafeFromArray(tuple[1])]));\n});\n//# sourceMappingURL=groupBy.js.map","import * as groupBy_ from \"./internal/groupBy.js\";\nimport * as internal from \"./internal/stream.js\";\n/**\n * @since 2.0.0\n * @category symbols\n */\nexport const StreamTypeId = internal.StreamTypeId;\n/**\n * The default chunk size used by the various combinators and constructors of\n * `Stream`.\n *\n * @since 2.0.0\n * @category constants\n */\nexport const DefaultChunkSize = internal.DefaultChunkSize;\n/**\n * Collects each underlying Chunk of the stream into a new chunk, and emits it\n * on each pull.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const accumulate = internal.accumulate;\n/**\n * Re-chunks the elements of the stream by accumulating each underlying chunk.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const accumulateChunks = internal.accumulateChunks;\n/**\n * Creates a stream from a single value that will get cleaned up after the\n * stream is consumed.\n *\n * @example\n * ```ts\n * import { Console, Effect, Stream } from \"effect\"\n *\n * // Simulating File operations\n * const open = (filename: string) =>\n * Effect.gen(function*() {\n * yield* Console.log(`Opening ${filename}`)\n * return {\n * getLines: Effect.succeed([\"Line 1\", \"Line 2\", \"Line 3\"]),\n * close: Console.log(`Closing ${filename}`)\n * }\n * })\n *\n * const stream = Stream.acquireRelease(\n * open(\"file.txt\"),\n * (file) => file.close\n * ).pipe(Stream.flatMap((file) => file.getLines))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // Opening file.txt\n * // Closing file.txt\n * // { _id: 'Chunk', values: [ [ 'Line 1', 'Line 2', 'Line 3' ] ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const acquireRelease = internal.acquireRelease;\n/**\n * Aggregates elements of this stream using the provided sink for as long as\n * the downstream operators on the stream are busy.\n *\n * This operator divides the stream into two asynchronous \"islands\". Operators\n * upstream of this operator run on one fiber, while downstream operators run\n * on another. Whenever the downstream fiber is busy processing elements, the\n * upstream fiber will feed elements into the sink until it signals\n * completion.\n *\n * Any sink can be used here, but see `Sink.foldWeightedEffect` and\n * `Sink.foldUntilEffect` for sinks that cover the common usecases.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const aggregate = internal.aggregate;\n/**\n * Like {@link aggregateWithinEither}, but only returns the `Right` results.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const aggregateWithin = internal.aggregateWithin;\n/**\n * Aggregates elements using the provided sink until it completes, or until\n * the delay signalled by the schedule has passed.\n *\n * This operator divides the stream into two asynchronous islands. Operators\n * upstream of this operator run on one fiber, while downstream operators run\n * on another. Elements will be aggregated by the sink until the downstream\n * fiber pulls the aggregated value, or until the schedule's delay has passed.\n *\n * Aggregated elements will be fed into the schedule to determine the delays\n * between pulls.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const aggregateWithinEither = internal.aggregateWithinEither;\n/**\n * Maps the success values of this stream to the specified constant value.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.range(1, 5).pipe(Stream.as(null))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ null, null, null, null, null ] }\n * ```\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const as = internal.as;\nconst _async = internal._async;\nexport {\n/**\n * Creates a stream from an asynchronous callback that can be called multiple\n * times. The optionality of the error type `E` in `Emit` can be used to\n * signal the end of the stream by setting it to `None`.\n *\n * The registration function can optionally return an `Effect`, which will be\n * executed if the `Fiber` executing this Effect is interrupted.\n *\n * @example\n * ```ts\n * import type { StreamEmit } from \"effect\"\n * import { Chunk, Effect, Option, Stream } from \"effect\"\n *\n * const events = [1, 2, 3, 4]\n *\n * const stream = Stream.async(\n * (emit: StreamEmit.Emit<never, never, number, void>) => {\n * events.forEach((n) => {\n * setTimeout(() => {\n * if (n === 3) {\n * emit(Effect.fail(Option.none())) // Terminate the stream\n * } else {\n * emit(Effect.succeed(Chunk.of(n))) // Add the current item to the stream\n * }\n * }, 100 * n)\n * })\n * }\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2 ] }\n *\n * ```\n * @since 2.0.0\n * @category constructors\n */\n_async as async };\n/**\n * Creates a stream from an asynchronous callback that can be called multiple\n * times The registration of the callback itself returns an effect. The\n * optionality of the error type `E` can be used to signal the end of the\n * stream, by setting it to `None`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const asyncEffect = internal.asyncEffect;\n/**\n * Creates a stream from an external push-based resource.\n *\n * You can use the `emit` helper to emit values to the stream. The `emit` helper\n * returns a boolean indicating whether the value was emitted or not.\n *\n * You can also use the `emit` helper to signal the end of the stream by\n * using apis such as `emit.end` or `emit.fail`.\n *\n * By default it uses an \"unbounded\" buffer size.\n * You can customize the buffer size and strategy by passing an object as the\n * second argument with the `bufferSize` and `strategy` fields.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * Stream.asyncPush<string>((emit) =>\n * Effect.acquireRelease(\n * Effect.gen(function*() {\n * yield* Effect.log(\"subscribing\")\n * return setInterval(() => emit.single(\"tick\"), 1000)\n * }),\n * (handle) =>\n * Effect.gen(function*() {\n * yield* Effect.log(\"unsubscribing\")\n * clearInterval(handle)\n * })\n * ), { bufferSize: 16, strategy: \"dropping\" })\n * ```\n *\n * @since 3.6.0\n * @category constructors\n */\nexport const asyncPush = internal.asyncPush;\n/**\n * Creates a stream from an asynchronous callback that can be called multiple\n * times. The registration of the callback itself returns an a scoped\n * resource. The optionality of the error type `E` can be used to signal the\n * end of the stream, by setting it to `None`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const asyncScoped = internal.asyncScoped;\n/**\n * Returns a `Stream` that first collects `n` elements from the input `Stream`,\n * and then creates a new `Stream` using the specified function, and sends all\n * the following elements through that.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const branchAfter = internal.branchAfter;\n/**\n * Fan out the stream, producing a list of streams that have the same elements\n * as this stream. The driver stream will only ever advance the `maximumLag`\n * chunks before the slowest downstream stream.\n *\n * @example\n * ```ts\n * import { Console, Effect, Fiber, Schedule, Stream } from \"effect\"\n *\n * const numbers = Effect.scoped(\n * Stream.range(1, 20).pipe(\n * Stream.tap((n) => Console.log(`Emit ${n} element before broadcasting`)),\n * Stream.broadcast(2, 5),\n * Stream.flatMap(([first, second]) =>\n * Effect.gen(function*() {\n * const fiber1 = yield* Stream.runFold(first, 0, (acc, e) => Math.max(acc, e)).pipe(\n * Effect.andThen((max) => Console.log(`Maximum: ${max}`)),\n * Effect.fork\n * )\n * const fiber2 = yield* second.pipe(\n * Stream.schedule(Schedule.spaced(\"1 second\")),\n * Stream.runForEach((n) => Console.log(`Logging to the Console: ${n}`)),\n * Effect.fork\n * )\n * yield* Fiber.join(fiber1).pipe(\n * Effect.zip(Fiber.join(fiber2), { concurrent: true })\n * )\n * })\n * ),\n * Stream.runCollect\n * )\n * )\n *\n * Effect.runPromise(numbers).then(console.log)\n * // Emit 1 element before broadcasting\n * // Emit 2 element before broadcasting\n * // Emit 3 element before broadcasting\n * // Emit 4 element before broadcasting\n * // Emit 5 element before broadcasting\n * // Emit 6 element before broadcasting\n * // Emit 7 element before broadcasting\n * // Emit 8 element before broadcasting\n * // Emit 9 element before broadcasting\n * // Emit 10 element before broadcasting\n * // Emit 11 element before broadcasting\n * // Logging to the Console: 1\n * // Logging to the Console: 2\n * // Logging to the Console: 3\n * // Logging to the Console: 4\n * // Logging to the Console: 5\n * // Emit 12 element before broadcasting\n * // Emit 13 element before broadcasting\n * // Emit 14 element before broadcasting\n * // Emit 15 element before broadcasting\n * // Emit 16 element before broadcasting\n * // Logging to the Console: 6\n * // Logging to the Console: 7\n * // Logging to the Console: 8\n * // Logging to the Console: 9\n * // Logging to the Console: 10\n * // Emit 17 element before broadcasting\n * // Emit 18 element before broadcasting\n * // Emit 19 element before broadcasting\n * // Emit 20 element before broadcasting\n * // Logging to the Console: 11\n * // Logging to the Console: 12\n * // Logging to the Console: 13\n * // Logging to the Console: 14\n * // Logging to the Console: 15\n * // Maximum: 20\n * // Logging to the Console: 16\n * // Logging to the Console: 17\n * // Logging to the Console: 18\n * // Logging to the Console: 19\n * // Logging to the Console: 20\n * // { _id: 'Chunk', values: [ undefined ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const broadcast = internal.broadcast;\n/**\n * Returns a new Stream that multicasts the original Stream, subscribing to it as soon as the first consumer subscribes.\n * As long as there is at least one consumer, the upstream will continue running and emitting data.\n * When all consumers have exited, the upstream will be finalized.\n *\n * @since 3.8.0\n * @category utils\n */\nexport const share = internal.share;\n/**\n * Fan out the stream, producing a dynamic number of streams that have the\n * same elements as this stream. The driver stream will only ever advance the\n * `maximumLag` chunks before the slowest downstream stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const broadcastDynamic = internal.broadcastDynamic;\n/**\n * Converts the stream to a scoped list of queues. Every value will be\n * replicated to every queue with the slowest queue being allowed to buffer\n * `maximumLag` chunks before the driver is back pressured.\n *\n * Queues can unsubscribe from upstream by shutting down.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const broadcastedQueues = internal.broadcastedQueues;\n/**\n * Converts the stream to a scoped dynamic amount of queues. Every chunk will\n * be replicated to every queue with the slowest queue being allowed to buffer\n * `maximumLag` chunks before the driver is back pressured.\n *\n * Queues can unsubscribe from upstream by shutting down.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const broadcastedQueuesDynamic = internal.broadcastedQueuesDynamic;\n/**\n * Allows a faster producer to progress independently of a slower consumer by\n * buffering up to `capacity` elements in a queue.\n *\n * Note: This combinator destroys the chunking structure. It's recommended to\n * use rechunk afterwards. Additionally, prefer capacities that are powers\n * of 2 for better performance.\n *\n * @example\n * ```ts\n * import { Console, Effect, Schedule, Stream } from \"effect\"\n *\n * const stream = Stream.range(1, 10).pipe(\n * Stream.tap((n) => Console.log(`before buffering: ${n}`)),\n * Stream.buffer({ capacity: 4 }),\n * Stream.tap((n) => Console.log(`after buffering: ${n}`)),\n * Stream.schedule(Schedule.spaced(\"5 seconds\"))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // before buffering: 1\n * // before buffering: 2\n * // before buffering: 3\n * // before buffering: 4\n * // before buffering: 5\n * // before buffering: 6\n * // after buffering: 1\n * // after buffering: 2\n * // before buffering: 7\n * // after buffering: 3\n * // before buffering: 8\n * // after buffering: 4\n * // before buffering: 9\n * // after buffering: 5\n * // before buffering: 10\n * // ...\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const buffer = internal.buffer;\n/**\n * Allows a faster producer to progress independently of a slower consumer by\n * buffering up to `capacity` chunks in a queue.\n *\n * @note Prefer capacities that are powers of 2 for better performance.\n * @since 2.0.0\n * @category utils\n */\nexport const bufferChunks = internal.bufferChunks;\n/**\n * Switches over to the stream produced by the provided function in case this\n * one fails with a typed error.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const catchAll = internal.catchAll;\n/**\n * Switches over to the stream produced by the provided function in case this\n * one fails. Allows recovery from all causes of failure, including\n * interruption if the stream is uninterruptible.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const catchAllCause = internal.catchAllCause;\n/**\n * Switches over to the stream produced by the provided function in case this\n * one fails with some typed error.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const catchSome = internal.catchSome;\n/**\n * Switches over to the stream produced by the provided function in case this\n * one fails with an error matching the given `_tag`.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const catchTag = internal.catchTag;\n/**\n * Switches over to the stream produced by one of the provided functions, in\n * case this one fails with an error matching one of the given `_tag`'s.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const catchTags = internal.catchTags;\n/**\n * Switches over to the stream produced by the provided function in case this\n * one fails with some errors. Allows recovery from all causes of failure,\n * including interruption if the stream is uninterruptible.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const catchSomeCause = internal.catchSomeCause;\n/**\n * Returns a new stream that only emits elements that are not equal to the\n * previous element emitted, using natural equality to determine whether two\n * elements are equal.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 1, 1, 2, 2, 3, 4).pipe(Stream.changes)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3, 4 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const changes = internal.changes;\n/**\n * Returns a new stream that only emits elements that are not equal to the\n * previous element emitted, using the specified function to determine whether\n * two elements are equal.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const changesWith = internal.changesWith;\n/**\n * Returns a new stream that only emits elements that are not equal to the\n * previous element emitted, using the specified effectual function to\n * determine whether two elements are equal.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const changesWithEffect = internal.changesWithEffect;\n/**\n * Exposes the underlying chunks of the stream as a stream of chunks of\n * elements.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const chunks = internal.chunks;\n/**\n * Performs the specified stream transformation with the chunk structure of\n * the stream exposed.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const chunksWith = internal.chunksWith;\n/**\n * Combines the elements from this stream and the specified stream by\n * repeatedly applying the function `f` to extract an element using both sides\n * and conceptually \"offer\" it to the destination stream. `f` can maintain\n * some internal state to control the combining process, with the initial\n * state being specified by `s`.\n *\n * Where possible, prefer `Stream.combineChunks` for a more efficient\n * implementation.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const combine = internal.combine;\n/**\n * Combines the chunks from this stream and the specified stream by repeatedly\n * applying the function `f` to extract a chunk using both sides and\n * conceptually \"offer\" it to the destination stream. `f` can maintain some\n * internal state to control the combining process, with the initial state\n * being specified by `s`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const combineChunks = internal.combineChunks;\n/**\n * Concatenates the specified stream with this stream, resulting in a stream\n * that emits the elements from this stream and then the elements from the\n * specified stream.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const s1 = Stream.make(1, 2, 3)\n * const s2 = Stream.make(4, 5)\n *\n * const stream = Stream.concat(s1, s2)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const concat = internal.concat;\n/**\n * Concatenates all of the streams in the chunk to one stream.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Stream } from \"effect\"\n *\n * const s1 = Stream.make(1, 2, 3)\n * const s2 = Stream.make(4, 5)\n * const s3 = Stream.make(6, 7, 8)\n *\n * const stream = Stream.concatAll(Chunk.make(s1, s2, s3))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // 1, 2, 3, 4,\n * // 5, 6, 7, 8\n * // ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const concatAll = internal.concatAll;\n/**\n * Composes this stream with the specified stream to create a cartesian\n * product of elements. The `right` stream would be run multiple times, for\n * every element in the `left` stream.\n *\n * See also `Stream.zip` for the more common point-wise variant.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const s1 = Stream.make(1, 2, 3)\n * const s2 = Stream.make(\"a\", \"b\")\n *\n * const product = Stream.cross(s1, s2)\n *\n * Effect.runPromise(Stream.runCollect(product)).then(console.log)\n * // {\n * // _id: \"Chunk\",\n * // values: [\n * // [ 1, \"a\" ], [ 1, \"b\" ], [ 2, \"a\" ], [ 2, \"b\" ], [ 3, \"a\" ], [ 3, \"b\" ]\n * // ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const cross = internal.cross;\n/**\n * Composes this stream with the specified stream to create a cartesian\n * product of elements, but keeps only elements from `left` stream. The `right`\n * stream would be run multiple times, for every element in the `left` stream.\n *\n * See also `Stream.zipLeft` for the more common point-wise variant.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const crossLeft = internal.crossLeft;\n/**\n * Composes this stream with the specified stream to create a cartesian\n * product of elements, but keeps only elements from the `right` stream. The\n * `left` stream would be run multiple times, for every element in the `right`\n * stream.\n *\n * See also `Stream.zipRight` for the more common point-wise variant.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const crossRight = internal.crossRight;\n/**\n * Composes this stream with the specified stream to create a cartesian\n * product of elements with a specified function. The `right` stream would be\n * run multiple times, for every element in the `left` stream.\n *\n * See also `Stream.zipWith` for the more common point-wise variant.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const crossWith = internal.crossWith;\n/**\n * Delays the emission of values by holding new values for a set duration. If\n * no new values arrive during that time the value is emitted, however if a\n * new value is received during the holding period the previous value is\n * discarded and the process is repeated with the new value.\n *\n * This operator is useful if you have a stream of \"bursty\" events which\n * eventually settle down and you only need the final event of the burst. For\n * example, a search engine may only want to initiate a search after a user\n * has paused typing so as to not prematurely recommend results.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * let last = Date.now()\n * const log = (message: string) =>\n * Effect.sync(() => {\n * const end = Date.now()\n * console.log(`${message} after ${end - last}ms`)\n * last = end\n * })\n *\n * const stream = Stream.make(1, 2, 3).pipe(\n * Stream.concat(\n * Stream.fromEffect(Effect.sleep(\"200 millis\").pipe(Effect.as(4))) // Emit 4 after 200 ms\n * ),\n * Stream.concat(Stream.make(5, 6)), // Continue with more rapid values\n * Stream.concat(\n * Stream.fromEffect(Effect.sleep(\"150 millis\").pipe(Effect.as(7))) // Emit 7 after 150 ms\n * ),\n * Stream.concat(Stream.make(8)),\n * Stream.tap((n) => log(`Received ${n}`)),\n * Stream.debounce(\"100 millis\"), // Only emit values after a pause of at least 100 milliseconds,\n * Stream.tap((n) => log(`> Emitted ${n}`))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // Received 1 after 5ms\n * // Received 2 after 2ms\n * // Received 3 after 0ms\n * // > Emitted 3 after 104ms\n * // Received 4 after 99ms\n * // Received 5 after 1ms\n * // Received 6 after 0ms\n * // > Emitted 6 after 101ms\n * // Received 7 after 50ms\n * // Received 8 after 1ms\n * // > Emitted 8 after 101ms\n * // { _id: 'Chunk', values: [ 3, 6, 8 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const debounce = internal.debounce;\n/**\n * The stream that dies with the specified defect.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const die = internal.die;\n/**\n * The stream that dies with the specified lazily evaluated defect.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const dieSync = internal.dieSync;\n/**\n * The stream that dies with an exception described by `message`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const dieMessage = internal.dieMessage;\n/**\n * More powerful version of `Stream.broadcast`. Allows to provide a function\n * that determines what queues should receive which elements. The decide\n * function will receive the indices of the queues in the resulting list.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const distributedWith = internal.distributedWith;\n/**\n * More powerful version of `Stream.distributedWith`. This returns a function\n * that will produce new queues and corresponding indices. You can also\n * provide a function that will be executed after the final events are\n * enqueued in all queues. Shutdown of the queues is handled by the driver.\n * Downstream users can also shutdown queues manually. In this case the driver\n * will continue but no longer backpressure on them.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const distributedWithDynamic = internal.distributedWithDynamic;\n/**\n * Converts this stream to a stream that executes its effects but emits no\n * elements. Useful for sequencing effects using streams:\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * // We create a stream and immediately drain it.\n * const stream = Stream.range(1, 6).pipe(Stream.drain)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const drain = internal.drain;\n/**\n * Drains the provided stream in the background for as long as this stream is\n * running. If this stream ends before `other`, `other` will be interrupted.\n * If `other` fails, this stream will fail with that error.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const drainFork = internal.drainFork;\n/**\n * Drops the specified number of elements from this stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const drop = internal.drop;\n/**\n * Drops the last specified number of elements from this stream.\n *\n * @note This combinator keeps `n` elements in memory. Be careful with big\n * numbers.\n * @since 2.0.0\n * @category utils\n */\nexport const dropRight = internal.dropRight;\n/**\n * Drops all elements of the stream until the specified predicate evaluates to\n * `true`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const dropUntil = internal.dropUntil;\n/**\n * Drops all elements of the stream until the specified effectful predicate\n * evaluates to `true`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const dropUntilEffect = internal.dropUntilEffect;\n/**\n * Drops all elements of the stream for as long as the specified predicate\n * evaluates to `true`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const dropWhile = internal.dropWhile;\n/**\n * Drops all elements of the stream for as long as the specified predicate\n * produces an effect that evalutates to `true`\n *\n * @since 2.0.0\n * @category utils\n */\nexport const dropWhileEffect = internal.dropWhileEffect;\n/**\n * Returns a stream whose failures and successes have been lifted into an\n * `Either`. The resulting stream cannot fail, because the failures have been\n * exposed as part of the `Either` success case.\n *\n * @note The stream will end as soon as the first error occurs.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const either = internal.either;\n/**\n * The empty stream.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.empty\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const empty = internal.empty;\n/**\n * Executes the provided finalizer after this stream's finalizers run.\n *\n * @example\n * ```ts\n * import { Console, Effect, Stream } from \"effect\"\n *\n * const program = Stream.fromEffect(Console.log(\"Application Logic.\")).pipe(\n * Stream.concat(Stream.finalizer(Console.log(\"Finalizing the stream\"))),\n * Stream.ensuring(\n * Console.log(\"Doing some other works after stream's finalization\")\n * )\n * )\n *\n * Effect.runPromise(Stream.runCollect(program)).then(console.log)\n * // Application Logic.\n * // Finalizing the stream\n * // Doing some other works after stream's finalization\n * // { _id: 'Chunk', values: [ undefined, undefined ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const ensuring = internal.ensuring;\n/**\n * Executes the provided finalizer after this stream's finalizers run.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const ensuringWith = internal.ensuringWith;\n/**\n * Accesses the whole context of the stream.\n *\n * @since 2.0.0\n * @category context\n */\nexport const context = internal.context;\n/**\n * Accesses the context of the stream.\n *\n * @since 2.0.0\n * @category context\n */\nexport const contextWith = internal.contextWith;\n/**\n * Accesses the context of the stream in the context of an effect.\n *\n * @since 2.0.0\n * @category context\n */\nexport const contextWithEffect = internal.contextWithEffect;\n/**\n * Accesses the context of the stream in the context of a stream.\n *\n * @since 2.0.0\n * @category context\n */\nexport const contextWithStream = internal.contextWithStream;\n/**\n * Creates a stream that executes the specified effect but emits no elements.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const execute = internal.execute;\n/**\n * Terminates with the specified error.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.fail(\"Uh oh!\")\n *\n * Effect.runPromiseExit(Stream.runCollect(stream)).then(console.log)\n * // {\n * // _id: 'Exit',\n * // _tag: 'Failure',\n * // cause: { _id: 'Cause', _tag: 'Fail', failure: 'Uh oh!' }\n * // }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fail = internal.fail;\n/**\n * Terminates with the specified lazily evaluated error.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const failSync = internal.failSync;\n/**\n * The stream that always fails with the specified `Cause`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const failCause = internal.failCause;\n/**\n * The stream that always fails with the specified lazily evaluated `Cause`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const failCauseSync = internal.failCauseSync;\n/**\n * Filters the elements emitted by this stream using the provided function.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.range(1, 11).pipe(Stream.filter((n) => n % 2 === 0))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }\n * ```\n *\n * @since 2.0.0\n * @category filtering\n */\nexport const filter = internal.filter;\n/**\n * Effectfully filters the elements emitted by this stream.\n *\n * @since 2.0.0\n * @category filtering\n */\nexport const filterEffect = internal.filterEffect;\n/**\n * Performs a filter and map in a single step.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const filterMap = internal.filterMap;\n/**\n * Performs an effectful filter and map in a single step.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const filterMapEffect = internal.filterMapEffect;\n/**\n * Transforms all elements of the stream for as long as the specified partial\n * function is defined.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const filterMapWhile = internal.filterMapWhile;\n/**\n * Effectfully transforms all elements of the stream for as long as the\n * specified partial function is defined.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const filterMapWhileEffect = internal.filterMapWhileEffect;\n/**\n * Creates a one-element stream that never fails and executes the finalizer\n * when it ends.\n *\n * @example\n * ```ts\n * import { Console, Effect, Stream } from \"effect\"\n *\n * const application = Stream.fromEffect(Console.log(\"Application Logic.\"))\n *\n * const deleteDir = (dir: string) => Console.log(`Deleting dir: ${dir}`)\n *\n * const program = application.pipe(\n * Stream.concat(\n * Stream.finalizer(\n * deleteDir(\"tmp\").pipe(\n * Effect.andThen(Console.log(\"Temporary directory was deleted.\"))\n * )\n * )\n * )\n * )\n *\n * Effect.runPromise(Stream.runCollect(program)).then(console.log)\n * // Application Logic.\n * // Deleting dir: tmp\n * // Temporary directory was deleted.\n * // { _id: 'Chunk', values: [ undefined, undefined ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const finalizer = internal.finalizer;\n/**\n * Finds the first element emitted by this stream that satisfies the provided\n * predicate.\n *\n * @since 2.0.0\n * @category elements\n */\nexport const find = internal.find;\n/**\n * Finds the first element emitted by this stream that satisfies the provided\n * effectful predicate.\n *\n * @since 2.0.0\n * @category elements\n */\nexport const findEffect = internal.findEffect;\n/**\n * Returns a stream made of the concatenation in strict order of all the\n * streams produced by passing each element of this stream to `f0`\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const flatMap = internal.flatMap;\n/**\n * Flattens this stream-of-streams into a stream made of the concatenation in\n * strict order of all the streams.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const flatten = internal.flatten;\n/**\n * Submerges the chunks carried by this stream into the stream's structure,\n * while still preserving them.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const flattenChunks = internal.flattenChunks;\n/**\n * Flattens `Effect` values into the stream's structure, preserving all\n * information about the effect.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const flattenEffect = internal.flattenEffect;\n/**\n * Unwraps `Exit` values that also signify end-of-stream by failing with `None`.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const flattenExitOption = internal.flattenExitOption;\n/**\n * Submerges the iterables carried by this stream into the stream's structure,\n * while still preserving them.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const flattenIterables = internal.flattenIterables;\n/**\n * Unwraps `Exit` values and flatten chunks that also signify end-of-stream\n * by failing with `None`.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const flattenTake = internal.flattenTake;\n/**\n * Repeats this stream forever.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const forever = internal.forever;\n/**\n * Creates a stream from an `AsyncIterable`.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const myAsyncIterable = async function*() {\n * yield 1\n * yield 2\n * }\n *\n * const stream = Stream.fromAsyncIterable(\n * myAsyncIterable(),\n * (e) => new Error(String(e)) // Error Handling\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromAsyncIterable = internal.fromAsyncIterable;\n/**\n * Creates a stream from a `Channel`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromChannel = internal.fromChannel;\n/**\n * Creates a channel from a `Stream`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const toChannel = internal.toChannel;\n/**\n * Creates a stream from a `Chunk` of values.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Stream } from \"effect\"\n *\n * // Creating a stream with values from a single Chunk\n * const stream = Stream.fromChunk(Chunk.make(1, 2, 3))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromChunk = internal.fromChunk;\n/**\n * Creates a stream from a subscription to a `PubSub`.\n *\n * **Options**\n *\n * - `shutdown`: If `true`, the `PubSub` will be shutdown after the stream is evaluated (defaults to `false`)\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromChunkPubSub = internal.fromChunkPubSub;\n/**\n * Creates a stream from a `Queue` of values.\n *\n * **Options**\n *\n * - `shutdown`: If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`)\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromChunkQueue = internal.fromChunkQueue;\n/**\n * Creates a stream from an arbitrary number of chunks.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Stream } from \"effect\"\n *\n * // Creating a stream with values from multiple Chunks\n * const stream = Stream.fromChunks(Chunk.make(1, 2, 3), Chunk.make(4, 5, 6))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5, 6 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromChunks = internal.fromChunks;\n/**\n * Either emits the success value of this effect or terminates the stream\n * with the failure value of this effect.\n *\n * @example\n * ```ts\n * import { Effect, Random, Stream } from \"effect\"\n *\n * const stream = Stream.fromEffect(Random.nextInt)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // Example Output: { _id: 'Chunk', values: [ 922694024 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromEffect = internal.fromEffect;\n/**\n * Creates a stream from an effect producing a value of type `A` or an empty\n * `Stream`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromEffectOption = internal.fromEffectOption;\n/**\n * Creates a stream from a subscription to a `PubSub`.\n *\n * **Options**\n *\n * - `shutdown`: If `true`, the `PubSub` will be shutdown after the stream is evaluated (defaults to `false`)\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromPubSub = internal.fromPubSub;\n/**\n * Creates a stream from a subscription to a `TPubSub`.\n *\n * @since 3.10.0\n * @category constructors\n */\nexport const fromTPubSub = internal.fromTPubSub;\n/**\n * Creates a new `Stream` from an iterable collection of values.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const numbers = [1, 2, 3]\n *\n * const stream = Stream.fromIterable(numbers)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromIterable = internal.fromIterable;\n/**\n * Creates a stream from an effect producing a value of type `Iterable<A>`.\n *\n * @example\n * ```ts\n * import { Context, Effect, Stream } from \"effect\"\n *\n * class Database extends Context.Tag(\"Database\")<\n * Database,\n * { readonly getUsers: Effect.Effect<Array<string>> }\n * >() {}\n *\n * const getUsers = Database.pipe(Effect.andThen((_) => _.getUsers))\n *\n * const stream = Stream.fromIterableEffect(getUsers)\n *\n * Effect.runPromise(\n * Stream.runCollect(stream.pipe(Stream.provideService(Database, { getUsers: Effect.succeed([\"user1\", \"user2\"]) })))\n * ).then(console.log)\n * // { _id: 'Chunk', values: [ 'user1', 'user2' ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromIterableEffect = internal.fromIterableEffect;\n/**\n * Creates a stream from an iterator\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromIteratorSucceed = internal.fromIteratorSucceed;\n/**\n * Creates a stream from an effect that pulls elements from another stream.\n *\n * See `Stream.toPull` for reference.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromPull = internal.fromPull;\n/**\n * Creates a stream from a queue of values\n *\n * **Options**\n *\n * - `maxChunkSize`: The maximum number of queued elements to put in one chunk in the stream\n * - `shutdown`: If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`)\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromQueue = internal.fromQueue;\n/**\n * Creates a stream from a TQueue of values\n *\n * @since 3.10.0\n * @category constructors\n */\nexport const fromTQueue = internal.fromTQueue;\n/**\n * Creates a stream from a `ReadableStream`.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromReadableStream = internal.fromReadableStream;\n/**\n * Creates a stream from a `ReadableStreamBYOBReader`.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromReadableStreamByob = internal.fromReadableStreamByob;\n/**\n * Creates a stream from a `Schedule` that does not require any further\n * input. The stream will emit an element for each value output from the\n * schedule, continuing for as long as the schedule continues.\n *\n * @example\n * ```ts\n * import { Effect, Schedule, Stream } from \"effect\"\n *\n * // Emits values every 1 second for a total of 5 emissions\n * const schedule = Schedule.spaced(\"1 second\").pipe(\n * Schedule.compose(Schedule.recurs(5))\n * )\n *\n * const stream = Stream.fromSchedule(schedule)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const fromSchedule = internal.fromSchedule;\n/**\n * Creates a pipeline that groups on adjacent keys, calculated by the\n * specified function.\n *\n * @since 2.0.0\n * @category grouping\n */\nexport const groupAdjacentBy = internal.groupAdjacentBy;\n/**\n * More powerful version of `Stream.groupByKey`.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, GroupBy, Stream } from \"effect\"\n *\n * const groupByKeyResult = Stream.fromIterable([\n * \"Mary\",\n * \"James\",\n * \"Robert\",\n * \"Patricia\",\n * \"John\",\n * \"Jennifer\",\n * \"Rebecca\",\n * \"Peter\"\n * ]).pipe(\n * Stream.groupBy((name) => Effect.succeed([name.substring(0, 1), name]))\n * )\n *\n * const stream = GroupBy.evaluate(groupByKeyResult, (key, stream) =>\n * Stream.fromEffect(\n * Stream.runCollect(stream).pipe(\n * Effect.andThen((chunk) => [key, Chunk.size(chunk)] as const)\n * )\n * ))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // {\n * // _id: 'Chunk',\n * // values: [ [ 'M', 1 ], [ 'J', 3 ], [ 'R', 2 ], [ 'P', 2 ] ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category grouping\n */\nexport const groupBy = groupBy_.groupBy;\n/**\n * Partition a stream using a function and process each stream individually.\n * This returns a data structure that can be used to further filter down which\n * groups shall be processed.\n *\n * After calling apply on the GroupBy object, the remaining groups will be\n * processed in parallel and the resulting streams merged in a\n * nondeterministic fashion.\n *\n * Up to `buffer` elements may be buffered in any group stream before the\n * producer is backpressured. Take care to consume from all streams in order\n * to prevent deadlocks.\n *\n * For example, to collect the first 2 words for every starting letter from a\n * stream of words:\n *\n * ```ts\n * import { pipe, GroupBy, Stream } from \"effect\"\n *\n * pipe(\n * Stream.fromIterable([\"hello\", \"world\", \"hi\", \"holla\"]),\n * Stream.groupByKey((word) => word[0]),\n * GroupBy.evaluate((key, stream) =>\n * pipe(\n * stream,\n * Stream.take(2),\n * Stream.map((words) => [key, words] as const)\n * )\n * )\n * )\n * ```\n *\n * @since 2.0.0\n * @category grouping\n */\nexport const groupByKey = groupBy_.groupByKey;\n/**\n * Partitions the stream with specified `chunkSize`.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.range(0, 8).pipe(Stream.grouped(3))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then((chunks) => console.log(\"%o\", chunks))\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // { _id: 'Chunk', values: [ 0, 1, 2, [length]: 3 ] },\n * // { _id: 'Chunk', values: [ 3, 4, 5, [length]: 3 ] },\n * // { _id: 'Chunk', values: [ 6, 7, 8, [length]: 3 ] },\n * // [length]: 3\n * // ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category grouping\n */\nexport const grouped = internal.grouped;\n/**\n * Partitions the stream with the specified `chunkSize` or until the specified\n * `duration` has passed, whichever is satisfied first.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Schedule, Stream } from \"effect\"\n *\n * const stream = Stream.range(0, 9).pipe(\n * Stream.repeat(Schedule.spaced(\"1 second\")),\n * Stream.groupedWithin(18, \"1.5 seconds\"),\n * Stream.take(3)\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then((chunks) => console.log(Chunk.toArray(chunks)))\n * // [\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // 0, 1, 2, 3, 4, 5, 6,\n * // 7, 8, 9, 0, 1, 2, 3,\n * // 4, 5, 6, 7\n * // ]\n * // },\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // 8, 9, 0, 1, 2,\n * // 3, 4, 5, 6, 7,\n * // 8, 9\n * // ]\n * // },\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // 0, 1, 2, 3, 4, 5, 6,\n * // 7, 8, 9, 0, 1, 2, 3,\n * // 4, 5, 6, 7\n * // ]\n * // }\n * // ]\n * ```\n *\n * @since 2.0.0\n * @category grouping\n */\nexport const groupedWithin = internal.groupedWithin;\n/**\n * Specialized version of haltWhen which halts the evaluation of this stream\n * after the given duration.\n *\n * An element in the process of being pulled will not be interrupted when the\n * given duration completes. See `interruptAfter` for this behavior.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const haltAfter = internal.haltAfter;\n/**\n * Halts the evaluation of this stream when the provided effect completes. The\n * given effect will be forked as part of the returned stream, and its success\n * will be discarded.\n *\n * An element in the process of being pulled will not be interrupted when the\n * effect completes. See `interruptWhen` for this behavior.\n *\n * If the effect completes with a failure, the stream will emit that failure.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const haltWhen = internal.haltWhen;\n/**\n * Halts the evaluation of this stream when the provided promise resolves.\n *\n * If the promise completes with a failure, the stream will emit that failure.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const haltWhenDeferred = internal.haltWhenDeferred;\n/**\n * The identity pipeline, which does not modify streams in any way.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const identity = internal.identityStream;\n/**\n * Interleaves this stream and the specified stream deterministically by\n * alternating pulling values from this stream and the specified stream. When\n * one stream is exhausted all remaining values in the other stream will be\n * pulled.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const s1 = Stream.make(1, 2, 3)\n * const s2 = Stream.make(4, 5, 6)\n *\n * const stream = Stream.interleave(s1, s2)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 4, 2, 5, 3, 6 ] }\n * ```\n * @since 2.0.0\n * @category utils\n */\nexport const interleave = internal.interleave;\n/**\n * Combines this stream and the specified stream deterministically using the\n * stream of boolean values `pull` to control which stream to pull from next.\n * A value of `true` indicates to pull from this stream and a value of `false`\n * indicates to pull from the specified stream. Only consumes as many elements\n * as requested by the `pull` stream. If either this stream or the specified\n * stream are exhausted further requests for values from that stream will be\n * ignored.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const s1 = Stream.make(1, 3, 5, 7, 9)\n * const s2 = Stream.make(2, 4, 6, 8, 10)\n *\n * const booleanStream = Stream.make(true, false, false).pipe(Stream.forever)\n *\n * const stream = Stream.interleaveWith(s1, s2, booleanStream)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // 1, 2, 4, 3, 6,\n * // 8, 5, 10, 7, 9\n * // ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const interleaveWith = internal.interleaveWith;\n/**\n * Intersperse stream with provided `element`.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 2, 3, 4, 5).pipe(Stream.intersperse(0))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // 1, 0, 2, 0, 3,\n * // 0, 4, 0, 5\n * // ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const intersperse = internal.intersperse;\n/**\n * Intersperse the specified element, also adding a prefix and a suffix.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 2, 3, 4, 5).pipe(\n * Stream.intersperseAffixes({\n * start: \"[\",\n * middle: \"-\",\n * end: \"]\"\n * })\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // {\n * // _id: 'Chunk',\n * // values: [\n * // '[', 1, '-', 2, '-',\n * // 3, '-', 4, '-', 5,\n * // ']'\n * // ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const intersperseAffixes = internal.intersperseAffixes;\n/**\n * Specialized version of `Stream.interruptWhen` which interrupts the\n * evaluation of this stream after the given `Duration`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const interruptAfter = internal.interruptAfter;\n/**\n * Interrupts the evaluation of this stream when the provided effect\n * completes. The given effect will be forked as part of this stream, and its\n * success will be discarded. This combinator will also interrupt any\n * in-progress element being pulled from upstream.\n *\n * If the effect completes with a failure before the stream completes, the\n * returned stream will emit that failure.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const interruptWhen = internal.interruptWhen;\n/**\n * Interrupts the evaluation of this stream when the provided promise\n * resolves. This combinator will also interrupt any in-progress element being\n * pulled from upstream.\n *\n * If the promise completes with a failure, the stream will emit that failure.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const interruptWhenDeferred = internal.interruptWhenDeferred;\n/**\n * The infinite stream of iterative function application: a, f(a), f(f(a)),\n * f(f(f(a))), ...\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * // An infinite Stream of numbers starting from 1 and incrementing\n * const stream = Stream.iterate(1, (n) => n + 1)\n *\n * Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(10)))).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const iterate = internal.iterate;\n/**\n * Creates a stream from an sequence of values.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 2, 3)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const make = internal.make;\n/**\n * Transforms the elements of this stream using the supplied function.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 2, 3).pipe(Stream.map((n) => n + 1))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 2, 3, 4 ] }\n * ```\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const map = internal.map;\n/**\n * Statefully maps over the elements of this stream to produce new elements.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const runningTotal = (stream: Stream.Stream<number>): Stream.Stream<number> =>\n * stream.pipe(Stream.mapAccum(0, (s, a) => [s + a, s + a]))\n *\n * // input: 0, 1, 2, 3, 4, 5, 6\n * Effect.runPromise(Stream.runCollect(runningTotal(Stream.range(0, 6)))).then(\n * console.log\n * )\n * // { _id: \"Chunk\", values: [ 0, 1, 3, 6, 10, 15, 21 ] }\n * ```\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapAccum = internal.mapAccum;\n/**\n * Statefully and effectfully maps over the elements of this stream to produce\n * new elements.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapAccumEffect = internal.mapAccumEffect;\n/**\n * Returns a stream whose failure and success channels have been mapped by the\n * specified `onFailure` and `onSuccess` functions.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const mapBoth = internal.mapBoth;\n/**\n * Transforms the chunks emitted by this stream.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapChunks = internal.mapChunks;\n/**\n * Effectfully transforms the chunks emitted by this stream.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapChunksEffect = internal.mapChunksEffect;\n/**\n * Maps each element to an iterable, and flattens the iterables into the\n * output of this stream.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const numbers = Stream.make(\"1-2-3\", \"4-5\", \"6\").pipe(\n * Stream.mapConcat((s) => s.split(\"-\")),\n * Stream.map((s) => parseInt(s))\n * )\n *\n * Effect.runPromise(Stream.runCollect(numbers)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5, 6 ] }\n * ```\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapConcat = internal.mapConcat;\n/**\n * Maps each element to a chunk, and flattens the chunks into the output of\n * this stream.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapConcatChunk = internal.mapConcatChunk;\n/**\n * Effectfully maps each element to a chunk, and flattens the chunks into the\n * output of this stream.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapConcatChunkEffect = internal.mapConcatChunkEffect;\n/**\n * Effectfully maps each element to an iterable, and flattens the iterables\n * into the output of this stream.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapConcatEffect = internal.mapConcatEffect;\n/**\n * Maps over elements of the stream with the specified effectful function.\n *\n * @example\n * ```ts\n * import { Effect, Random, Stream } from \"effect\"\n *\n * const stream = Stream.make(10, 20, 30).pipe(\n * Stream.mapEffect((n) => Random.nextIntBetween(0, n))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // Example Output: { _id: 'Chunk', values: [ 7, 19, 8 ] }\n * ```\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapEffect = groupBy_.mapEffectOptions;\n/**\n * Transforms the errors emitted by this stream using `f`.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapError = internal.mapError;\n/**\n * Transforms the full causes of failures emitted by this stream.\n *\n * @since 2.0.0\n * @category mapping\n */\nexport const mapErrorCause = internal.mapErrorCause;\n/**\n * Merges this stream and the specified stream together.\n *\n * New produced stream will terminate when both specified stream terminate if\n * no termination strategy is specified.\n *\n * @example\n * ```ts\n * import { Effect, Schedule, Stream } from \"effect\"\n *\n * const s1 = Stream.make(1, 2, 3).pipe(\n * Stream.schedule(Schedule.spaced(\"100 millis\"))\n * )\n * const s2 = Stream.make(4, 5, 6).pipe(\n * Stream.schedule(Schedule.spaced(\"200 millis\"))\n * )\n *\n * const stream = Stream.merge(s1, s2)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 4, 2, 3, 5, 6 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const merge = internal.merge;\n/**\n * Merges a variable list of streams in a non-deterministic fashion. Up to `n`\n * streams may be consumed in parallel and up to `outputBuffer` chunks may be\n * buffered by this operator.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const mergeAll = internal.mergeAll;\n/**\n * Merges a struct of streams into a single stream of tagged values.\n * @category combinators\n * @since 3.8.5\n *\n * @example\n * ```ts\n * import { Stream } from \"effect\"\n * // Stream.Stream<{ _tag: \"a\"; value: number; } | { _tag: \"b\"; value: string; }>\n * const res = Stream.mergeWithTag({\n * a: Stream.make(0),\n * b: Stream.make(\"\")\n * }, { concurrency: \"unbounded\" })\n * ```\n */\nexport const mergeWithTag = internal.mergeWithTag;\n/**\n * Merges this stream and the specified stream together to a common element\n * type with the specified mapping functions.\n *\n * New produced stream will terminate when both specified stream terminate if\n * no termination strategy is specified.\n *\n * @example\n * ```ts\n * import { Effect, Schedule, Stream } from \"effect\"\n *\n * const s1 = Stream.make(\"1\", \"2\", \"3\").pipe(\n * Stream.schedule(Schedule.spaced(\"100 millis\"))\n * )\n * const s2 = Stream.make(4.1, 5.3, 6.2).pipe(\n * Stream.schedule(Schedule.spaced(\"200 millis\"))\n * )\n *\n * const stream = Stream.mergeWith(s1, s2, {\n * onSelf: (s) => parseInt(s),\n * onOther: (n) => Math.floor(n)\n * })\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 4, 2, 3, 5, 6 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const mergeWith = internal.mergeWith;\n/**\n * Merges this stream and the specified stream together to produce a stream of\n * eithers.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const mergeEither = internal.mergeEither;\n/**\n * Merges this stream and the specified stream together, discarding the values\n * from the right stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const mergeLeft = internal.mergeLeft;\n/**\n * Merges this stream and the specified stream together, discarding the values\n * from the left stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const mergeRight = internal.mergeRight;\n/**\n * Returns a combined string resulting from concatenating each of the values\n * from the stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const mkString = internal.mkString;\n/**\n * The stream that never produces any value or fails with any error.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const never = internal.never;\n/**\n * Adds an effect to be executed at the end of the stream.\n *\n * @example\n * ```ts\n * import { Console, Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 2, 3).pipe(\n * Stream.map((n) => n * 2),\n * Stream.tap((n) => Console.log(`after mapping: ${n}`)),\n * Stream.onEnd(Console.log(\"Stream ended\"))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // after mapping: 2\n * // after mapping: 4\n * // after mapping: 6\n * // Stream ended\n * // { _id: 'Chunk', values: [ 2, 4, 6 ] }\n * ```\n *\n * @since 3.6.0\n * @category sequencing\n */\nexport const onEnd = internal.onEnd;\n/**\n * Runs the specified effect if this stream fails, providing the error to the\n * effect if it exists.\n *\n * Note: Unlike `Effect.onError` there is no guarantee that the provided\n * effect will not be interrupted.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const onError = internal.onError;\n/**\n * Runs the specified effect if this stream ends.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const onDone = internal.onDone;\n/**\n * Adds an effect to be executed at the start of the stream.\n *\n * @example\n * ```ts\n * import { Console, Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 2, 3).pipe(\n * Stream.onStart(Console.log(\"Stream started\")),\n * Stream.map((n) => n * 2),\n * Stream.tap((n) => Console.log(`after mapping: ${n}`))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // Stream started\n * // after mapping: 2\n * // after mapping: 4\n * // after mapping: 6\n * // { _id: 'Chunk', values: [ 2, 4, 6 ] }\n * ```\n *\n * @since 3.6.0\n * @category sequencing\n */\nexport const onStart = internal.onStart;\n/**\n * Translates any failure into a stream termination, making the stream\n * infallible and all failures unchecked.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orDie = internal.orDie;\n/**\n * Keeps none of the errors, and terminates the stream with them, using the\n * specified function to convert the `E` into a defect.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orDieWith = internal.orDieWith;\n/**\n * Switches to the provided stream in case this one fails with a typed error.\n *\n * See also `Stream.catchAll`.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orElse = internal.orElse;\n/**\n * Switches to the provided stream in case this one fails with a typed error.\n *\n * See also `Stream.catchAll`.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orElseEither = internal.orElseEither;\n/**\n * Fails with given error in case this one fails with a typed error.\n *\n * See also `Stream.catchAll`.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orElseFail = internal.orElseFail;\n/**\n * Produces the specified element if this stream is empty.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orElseIfEmpty = internal.orElseIfEmpty;\n/**\n * Produces the specified chunk if this stream is empty.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orElseIfEmptyChunk = internal.orElseIfEmptyChunk;\n/**\n * Switches to the provided stream in case this one is empty.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orElseIfEmptyStream = internal.orElseIfEmptyStream;\n/**\n * Succeeds with the specified value if this one fails with a typed error.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const orElseSucceed = internal.orElseSucceed;\n/**\n * Like `Stream.unfold`, but allows the emission of values to end one step further\n * than the unfolding of the state. This is useful for embedding paginated\n * APIs, hence the name.\n *\n * @example\n * ```ts\n * import { Effect, Option, Stream } from \"effect\"\n *\n * const stream = Stream.paginate(0, (n) => [\n * n,\n * n < 3 ? Option.some(n + 1) : Option.none()\n * ])\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 0, 1, 2, 3 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const paginate = internal.paginate;\n/**\n * Like `Stream.unfoldChunk`, but allows the emission of values to end one step\n * further than the unfolding of the state. This is useful for embedding\n * paginated APIs, hence the name.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const paginateChunk = internal.paginateChunk;\n/**\n * Like `Stream.unfoldChunkEffect`, but allows the emission of values to end one step\n * further than the unfolding of the state. This is useful for embedding\n * paginated APIs, hence the name.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const paginateChunkEffect = internal.paginateChunkEffect;\n/**\n * Like `Stream.unfoldEffect` but allows the emission of values to end one step\n * further than the unfolding of the state. This is useful for embedding\n * paginated APIs, hence the name.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const paginateEffect = internal.paginateEffect;\n/**\n * Splits a stream into two substreams based on a predicate.\n *\n * **Details**\n *\n * The `Stream.partition` function splits a stream into two parts: one for\n * elements that satisfy the predicate (evaluated to `true`) and another for\n * those that do not (evaluated to `false`).\n *\n * The faster stream may advance up to `bufferSize` elements ahead of the slower\n * one.\n *\n * **Example** (Partitioning a Stream into Even and Odd Numbers)\n *\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const partition = Stream.range(1, 9).pipe(\n * Stream.partition((n) => n % 2 === 0, { bufferSize: 5 })\n * )\n *\n * const program = Effect.scoped(\n * Effect.gen(function*() {\n * const [odds, evens] = yield* partition\n * console.log(yield* Stream.runCollect(odds))\n * console.log(yield* Stream.runCollect(evens))\n * })\n * )\n *\n * Effect.runPromise(program)\n * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }\n * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }\n * ```\n *\n * @see {@link partitionEither} for partitioning a stream based on effectful\n * conditions.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const partition = internal.partition;\n/**\n * Splits a stream into two substreams based on an effectful condition.\n *\n * **Details**\n *\n * The `Stream.partitionEither` function is used to divide a stream into two\n * parts: one for elements that satisfy a condition producing `Either.left`\n * values, and another for those that produce `Either.right` values. This\n * function applies an effectful predicate to each element in the stream to\n * determine which substream it belongs to.\n *\n * The faster stream may advance up to `bufferSize` elements ahead of the slower\n * one.\n *\n * **Example** (Partitioning a Stream with an Effectful Predicate)\n *\n * ```ts\n * import { Effect, Either, Stream } from \"effect\"\n *\n * const partition = Stream.range(1, 9).pipe(\n * Stream.partitionEither(\n * (n) => Effect.succeed(n % 2 === 0 ? Either.right(n) : Either.left(n)),\n * { bufferSize: 5 }\n * )\n * )\n *\n * const program = Effect.scoped(\n * Effect.gen(function*() {\n * const [evens, odds] = yield* partition\n * console.log(yield* Stream.runCollect(evens))\n * console.log(yield* Stream.runCollect(odds))\n * })\n * )\n *\n * Effect.runPromise(program)\n * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }\n * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }\n * ```\n *\n * @see {@link partition} for partitioning a stream based on simple conditions.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const partitionEither = internal.partitionEither;\n/**\n * Peels off enough material from the stream to construct a `Z` using the\n * provided `Sink` and then returns both the `Z` and the rest of the\n * `Stream` in a scope. Like all scoped values, the provided stream is\n * valid only within the scope.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const peel = internal.peel;\n/**\n * Pipes all of the values from this stream through the provided sink.\n *\n * See also `Stream.transduce`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const pipeThrough = internal.pipeThrough;\n/**\n * Pipes all the values from this stream through the provided channel.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const pipeThroughChannel = internal.pipeThroughChannel;\n/**\n * Pipes all values from this stream through the provided channel, passing\n * through any error emitted by this stream unchanged.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const pipeThroughChannelOrFail = internal.pipeThroughChannelOrFail;\n/**\n * Emits the provided chunk before emitting any other value.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const prepend = internal.prepend;\n/**\n * Provides the stream with its required context, which eliminates its\n * dependency on `R`.\n *\n * @since 2.0.0\n * @category context\n */\nexport const provideContext = internal.provideContext;\n/**\n * Provides the stream with some of its required context, which eliminates its\n * dependency on `R`.\n *\n * @since 3.16.9\n * @category context\n */\nexport const provideSomeContext = internal.provideSomeContext;\n/**\n * Provides a `Layer` to the stream, which translates it to another level.\n *\n * @since 2.0.0\n * @category context\n */\nexport const provideLayer = internal.provideLayer;\n/**\n * Provides the stream with the single service it requires. If the stream\n * requires more than one service use `Stream.provideContext` instead.\n *\n * @since 2.0.0\n * @category context\n */\nexport const provideService = internal.provideService;\n/**\n * Provides the stream with the single service it requires. If the stream\n * requires more than one service use `Stream.provideContext` instead.\n *\n * @since 2.0.0\n * @category context\n */\nexport const provideServiceEffect = internal.provideServiceEffect;\n/**\n * Provides the stream with the single service it requires. If the stream\n * requires more than one service use `Stream.provideContext` instead.\n *\n * @since 2.0.0\n * @category context\n */\nexport const provideServiceStream = internal.provideServiceStream;\n/**\n * Transforms the context being provided to the stream with the specified\n * function.\n *\n * @since 2.0.0\n * @category context\n */\nexport const mapInputContext = internal.mapInputContext;\n/**\n * Splits the context into two parts, providing one part using the\n * specified layer and leaving the remainder `R0`.\n *\n * @since 2.0.0\n * @category context\n */\nexport const provideSomeLayer = internal.provideSomeLayer;\n/**\n * Returns a stream that mirrors the first upstream to emit an item.\n * As soon as one of the upstream emits a first value, the other is interrupted.\n * The resulting stream will forward all items from the \"winning\" source stream.\n * Any upstream failures will cause the returned stream to fail.\n *\n * @example\n * ```ts\n * import { Stream, Schedule, Console, Effect } from \"effect\"\n *\n * const stream = Stream.fromSchedule(Schedule.spaced('2 millis')).pipe(\n * Stream.race(Stream.fromSchedule(Schedule.spaced('1 millis'))),\n * Stream.take(6),\n * Stream.tap(Console.log)\n * )\n *\n * Effect.runPromise(Stream.runDrain(stream))\n * // Output each millisecond from the first stream, the rest streams are interrupted\n * // 0\n * // 1\n * // 2\n * // 3\n * // 4\n * // 5\n * ```\n * @since 3.7.0\n * @category racing\n */\nexport const race = internal.race;\n/**\n * Returns a stream that mirrors the first upstream to emit an item.\n * As soon as one of the upstream emits a first value, all the others are interrupted.\n * The resulting stream will forward all items from the \"winning\" source stream.\n * Any upstream failures will cause the returned stream to fail.\n *\n * @example\n * ```ts\n * import { Stream, Schedule, Console, Effect } from \"effect\"\n *\n * const stream = Stream.raceAll(\n * Stream.fromSchedule(Schedule.spaced('1 millis')),\n * Stream.fromSchedule(Schedule.spaced('2 millis')),\n * Stream.fromSchedule(Schedule.spaced('4 millis')),\n * ).pipe(Stream.take(6), Stream.tap(Console.log))\n *\n * Effect.runPromise(Stream.runDrain(stream))\n * // Output each millisecond from the first stream, the rest streams are interrupted\n * // 0\n * // 1\n * // 2\n * // 3\n * // 4\n * // 5\n * ```\n * @since 3.5.0\n * @category racing\n */\nexport const raceAll = internal.raceAll;\n/**\n * Constructs a stream from a range of integers, including both endpoints.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * // A Stream with a range of numbers from 1 to 5\n * const stream = Stream.range(1, 5)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const range = internal.range;\n/**\n * Re-chunks the elements of the stream into chunks of `n` elements each. The\n * last chunk might contain less than `n` elements.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const rechunk = internal.rechunk;\n/**\n * Keeps some of the errors, and terminates the fiber with the rest\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const refineOrDie = internal.refineOrDie;\n/**\n * Keeps some of the errors, and terminates the fiber with the rest, using the\n * specified function to convert the `E` into a defect.\n *\n * @since 2.0.0\n * @category error handling\n */\nexport const refineOrDieWith = internal.refineOrDieWith;\n/**\n * Repeats the entire stream using the specified schedule. The stream will\n * execute normally, and then repeat again according to the provided schedule.\n *\n * @example\n * ```ts\n * import { Effect, Schedule, Stream } from \"effect\"\n *\n * const stream = Stream.repeat(Stream.succeed(1), Schedule.forever)\n *\n * Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 1, 1, 1, 1 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const repeat = internal.repeat;\n/**\n * Creates a stream from an effect producing a value of type `A` which repeats\n * forever.\n *\n * @example\n * ```ts\n * import { Effect, Random, Stream } from \"effect\"\n *\n * const stream = Stream.repeatEffect(Random.nextInt)\n *\n * Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)\n * // Example Output: { _id: 'Chunk', values: [ 3891571149, 4239494205, 2352981603, 2339111046, 1488052210 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const repeatEffect = internal.repeatEffect;\n/**\n * Creates a stream from an effect producing chunks of `A` values which\n * repeats forever.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const repeatEffectChunk = internal.repeatEffectChunk;\n/**\n * Creates a stream from an effect producing chunks of `A` values until it\n * fails with `None`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const repeatEffectChunkOption = internal.repeatEffectChunkOption;\n/**\n * Creates a stream from an effect producing values of type `A` until it fails\n * with `None`.\n *\n * @example\n * ```ts\n * // In this example, we're draining an Iterator to create a stream from it\n * import { Stream, Effect, Option } from \"effect\"\n *\n * const drainIterator = <A>(it: Iterator<A>): Stream.Stream<A> =>\n * Stream.repeatEffectOption(\n * Effect.sync(() => it.next()).pipe(\n * Effect.andThen((res) => {\n * if (res.done) {\n * return Effect.fail(Option.none())\n * }\n * return Effect.succeed(res.value)\n * })\n * )\n * )\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const repeatEffectOption = internal.repeatEffectOption;\n/**\n * Creates a stream from an effect producing a value of type `A`, which is\n * repeated using the specified schedule.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const repeatEffectWithSchedule = internal.repeatEffectWithSchedule;\n/**\n * Repeats the entire stream using the specified schedule. The stream will\n * execute normally, and then repeat again according to the provided schedule.\n * The schedule output will be emitted at the end of each repetition.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const repeatEither = internal.repeatEither;\n/**\n * Repeats each element of the stream using the provided schedule. Repetitions\n * are done in addition to the first execution, which means using\n * `Schedule.recurs(1)` actually results in the original effect, plus an\n * additional recurrence, for a total of two repetitions of each value in the\n * stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const repeatElements = internal.repeatElements;\n/**\n * Repeats each element of the stream using the provided schedule. When the\n * schedule is finished, then the output of the schedule will be emitted into\n * the stream. Repetitions are done in addition to the first execution, which\n * means using `Schedule.recurs(1)` actually results in the original effect,\n * plus an additional recurrence, for a total of two repetitions of each value\n * in the stream.\n *\n * This function accepts two conversion functions, which allow the output of\n * this stream and the output of the provided schedule to be unified into a\n * single type. For example, `Either` or similar data type.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const repeatElementsWith = internal.repeatElementsWith;\n/**\n * Repeats the provided value infinitely.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.repeatValue(0)\n *\n * Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)\n * // { _id: 'Chunk', values: [ 0, 0, 0, 0, 0 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const repeatValue = internal.repeatValue;\n/**\n * Repeats the entire stream using the specified schedule. The stream will\n * execute normally, and then repeat again according to the provided schedule.\n * The schedule output will be emitted at the end of each repetition and can\n * be unified with the stream elements using the provided functions.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const repeatWith = internal.repeatWith;\n/**\n * When the stream fails, retry it according to the given schedule\n *\n * This retries the entire stream, so will re-execute all of the stream's\n * acquire operations.\n *\n * The schedule is reset as soon as the first element passes through the\n * stream again.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const retry = internal.retry;\n/**\n * Apply an `ExecutionPlan` to the stream, which allows you to fallback to\n * different resources in case of failure.\n *\n * If you have a stream that could fail with partial results, you can use\n * the `preventFallbackOnPartialStream` option to prevent contamination of\n * the final stream with partial results.\n *\n * @since 3.16.0\n * @category Error handling\n * @experimental\n */\nexport const withExecutionPlan = internal.withExecutionPlan;\n/**\n * Runs the sink on the stream to produce either the sink's result or an error.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const run = internal.run;\n/**\n * Runs the stream and collects all of its elements to a chunk.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runCollect = internal.runCollect;\n/**\n * Runs the stream and emits the number of elements processed\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runCount = internal.runCount;\n/**\n * Runs the stream only for its effects. The emitted elements are discarded.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runDrain = internal.runDrain;\n/**\n * Executes a pure fold over the stream of values - reduces all elements in\n * the stream to a value of type `S`.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFold = internal.runFold;\n/**\n * Executes an effectful fold over the stream of values.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFoldEffect = internal.runFoldEffect;\n/**\n * Executes a pure fold over the stream of values. Returns a scoped value that\n * represents the scope of the stream.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFoldScoped = internal.runFoldScoped;\n/**\n * Executes an effectful fold over the stream of values. Returns a scoped\n * value that represents the scope of the stream.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFoldScopedEffect = internal.runFoldScopedEffect;\n/**\n * Reduces the elements in the stream to a value of type `S`. Stops the fold\n * early when the condition is not fulfilled. Example:\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFoldWhile = internal.runFoldWhile;\n/**\n * Executes an effectful fold over the stream of values. Stops the fold early\n * when the condition is not fulfilled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFoldWhileEffect = internal.runFoldWhileEffect;\n/**\n * Executes a pure fold over the stream of values. Returns a scoped value that\n * represents the scope of the stream. Stops the fold early when the condition\n * is not fulfilled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFoldWhileScoped = internal.runFoldWhileScoped;\n/**\n * Executes an effectful fold over the stream of values. Returns a scoped\n * value that represents the scope of the stream. Stops the fold early when\n * the condition is not fulfilled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runFoldWhileScopedEffect = internal.runFoldWhileScopedEffect;\n/**\n * Consumes all elements of the stream, passing them to the specified\n * callback.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runForEach = internal.runForEach;\n/**\n * Consumes all elements of the stream, passing them to the specified\n * callback.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runForEachChunk = internal.runForEachChunk;\n/**\n * Like `Stream.runForEachChunk`, but returns a scoped effect so the\n * finalization order can be controlled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runForEachChunkScoped = internal.runForEachChunkScoped;\n/**\n * Like `Stream.forEach`, but returns a scoped effect so the finalization\n * order can be controlled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runForEachScoped = internal.runForEachScoped;\n/**\n * Consumes elements of the stream, passing them to the specified callback,\n * and terminating consumption when the callback returns `false`.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runForEachWhile = internal.runForEachWhile;\n/**\n * Like `Stream.runForEachWhile`, but returns a scoped effect so the\n * finalization order can be controlled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runForEachWhileScoped = internal.runForEachWhileScoped;\n/**\n * Runs the stream to completion and yields the first value emitted by it,\n * discarding the rest of the elements.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runHead = internal.runHead;\n/**\n * Publishes elements of this stream to a `PubSub`. Stream failure and ending will\n * also be signalled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runIntoPubSub = internal.runIntoPubSub;\n/**\n * Like `Stream.runIntoPubSub`, but provides the result as a scoped effect to\n * allow for scope composition.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runIntoPubSubScoped = internal.runIntoPubSubScoped;\n/**\n * Enqueues elements of this stream into a queue. Stream failure and ending\n * will also be signalled.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runIntoQueue = internal.runIntoQueue;\n/**\n * Like `Stream.runIntoQueue`, but provides the result as a scoped [[ZIO]]\n * to allow for scope composition.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runIntoQueueElementsScoped = internal.runIntoQueueElementsScoped;\n/**\n * Like `Stream.runIntoQueue`, but provides the result as a scoped effect\n * to allow for scope composition.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runIntoQueueScoped = internal.runIntoQueueScoped;\n/**\n * Runs the stream to completion and yields the last value emitted by it,\n * discarding the rest of the elements.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runLast = internal.runLast;\n/**\n * @since 2.0.0\n * @category destructors\n */\nexport const runScoped = internal.runScoped;\n/**\n * Runs the stream to a sink which sums elements, provided they are Numeric.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const runSum = internal.runSum;\n/**\n * Statefully maps over the elements of this stream to produce all\n * intermediate results of type `S` given an initial S.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.range(1, 6).pipe(Stream.scan(0, (a, b) => a + b))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 0, 1, 3, 6, 10, 15, 21 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const scan = internal.scan;\n/**\n * Statefully and effectfully maps over the elements of this stream to produce\n * all intermediate results of type `S` given an initial S.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const scanEffect = internal.scanEffect;\n/**\n * Statefully maps over the elements of this stream to produce all\n * intermediate results.\n *\n * See also `Stream.scan`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const scanReduce = internal.scanReduce;\n/**\n * Statefully and effectfully maps over the elements of this stream to produce\n * all intermediate results.\n *\n * See also `Stream.scanEffect`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const scanReduceEffect = internal.scanReduceEffect;\n/**\n * Schedules the output of the stream using the provided `schedule`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const schedule = internal.schedule;\n/**\n * Schedules the output of the stream using the provided `schedule` and emits\n * its output at the end (if `schedule` is finite). Uses the provided function\n * to align the stream and schedule outputs on the same type.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const scheduleWith = internal.scheduleWith;\n/**\n * Creates a single-valued stream from a scoped resource.\n *\n * @example\n * ```ts\n * import { Console, Effect, Stream } from \"effect\"\n *\n * // Creating a single-valued stream from a scoped resource\n * const stream = Stream.scoped(\n * Effect.acquireRelease(\n * Console.log(\"acquire\"),\n * () => Console.log(\"release\")\n * )\n * ).pipe(\n * Stream.flatMap(() => Console.log(\"use\"))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // acquire\n * // use\n * // release\n * // { _id: 'Chunk', values: [ undefined ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const scoped = internal.scoped;\n/**\n * Use a function that receives a scope and returns an effect to emit an output\n * element. The output element will be the result of the returned effect, if\n * successful.\n *\n * @since 3.11.0\n * @category constructors\n */\nexport const scopedWith = internal.scopedWith;\n/**\n * Emits a sliding window of `n` elements.\n *\n * ```ts\n * import { pipe, Stream } from \"effect\"\n *\n * pipe(\n * Stream.make(1, 2, 3, 4),\n * Stream.sliding(2),\n * Stream.runCollect\n * )\n * // => Chunk(Chunk(1, 2), Chunk(2, 3), Chunk(3, 4))\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const sliding = internal.sliding;\n/**\n * Like `sliding`, but with a configurable `stepSize` parameter.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const slidingSize = internal.slidingSize;\n/**\n * Converts an option on values into an option on errors.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const some = internal.some;\n/**\n * Extracts the optional value, or returns the given 'default'.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const someOrElse = internal.someOrElse;\n/**\n * Extracts the optional value, or fails with the given error 'e'.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const someOrFail = internal.someOrFail;\n/**\n * Splits elements based on a predicate or refinement.\n *\n * ```ts\n * import { pipe, Stream } from \"effect\"\n *\n * pipe(\n * Stream.range(1, 10),\n * Stream.split((n) => n % 4 === 0),\n * Stream.runCollect\n * )\n * // => Chunk(Chunk(1, 2, 3), Chunk(5, 6, 7), Chunk(9))\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const split = internal.split;\n/**\n * Splits elements on a delimiter and transforms the splits into desired output.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const splitOnChunk = internal.splitOnChunk;\n/**\n * Splits strings on newlines. Handles both Windows newlines (`\\r\\n`) and UNIX\n * newlines (`\\n`).\n *\n * @since 2.0.0\n * @category combinators\n */\nexport const splitLines = internal.splitLines;\n/**\n * Creates a single-valued pure stream.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * // A Stream with a single number\n * const stream = Stream.succeed(3)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 3 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const succeed = internal.succeed;\n/**\n * Creates a single-valued pure stream.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const sync = internal.sync;\n/**\n * Returns a lazily constructed stream.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const suspend = internal.suspend;\n/**\n * Takes the specified number of elements from this stream.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.take(Stream.iterate(0, (n) => n + 1), 5)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const take = internal.take;\n/**\n * Takes the last specified number of elements from this stream.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.takeRight(Stream.make(1, 2, 3, 4, 5, 6), 3)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 4, 5, 6 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeRight = internal.takeRight;\n/**\n * Takes all elements of the stream until the specified predicate evaluates to\n * `true`.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.takeUntil(Stream.iterate(0, (n) => n + 1), (n) => n === 4)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeUntil = internal.takeUntil;\n/**\n * Takes all elements of the stream until the specified effectual predicate\n * evaluates to `true`.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeUntilEffect = internal.takeUntilEffect;\n/**\n * Takes all elements of the stream for as long as the specified predicate\n * evaluates to `true`.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.takeWhile(Stream.iterate(0, (n) => n + 1), (n) => n < 5)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const takeWhile = internal.takeWhile;\n/**\n * Adds an effect to consumption of every element of the stream.\n *\n * @example\n * ```ts\n * import { Console, Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(1, 2, 3).pipe(\n * Stream.tap((n) => Console.log(`before mapping: ${n}`)),\n * Stream.map((n) => n * 2),\n * Stream.tap((n) => Console.log(`after mapping: ${n}`))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // before mapping: 1\n * // after mapping: 2\n * // before mapping: 2\n * // after mapping: 4\n * // before mapping: 3\n * // after mapping: 6\n * // { _id: 'Chunk', values: [ 2, 4, 6 ] }\n * ```\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const tap = internal.tap;\n/**\n * Returns a stream that effectfully \"peeks\" at the failure or success of\n * the stream.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const tapBoth = internal.tapBoth;\n/**\n * Returns a stream that effectfully \"peeks\" at the failure of the stream.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const tapError = internal.tapError;\n/**\n * Returns a stream that effectfully \"peeks\" at the cause of failure of the\n * stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const tapErrorCause = internal.tapErrorCause;\n/**\n * Sends all elements emitted by this stream to the specified sink in addition\n * to emitting them.\n *\n * @since 2.0.0\n * @category sequencing\n */\nexport const tapSink = internal.tapSink;\n/**\n * Delays the chunks of this stream according to the given bandwidth\n * parameters using the token bucket algorithm. Allows for burst in the\n * processing of elements by allowing the token bucket to accumulate tokens up\n * to a `units + burst` threshold. The weight of each chunk is determined by\n * the `cost` function.\n *\n * If using the \"enforce\" strategy, chunks that do not meet the bandwidth\n * constraints are dropped. If using the \"shape\" strategy, chunks are delayed\n * until they can be emitted without exceeding the bandwidth constraints.\n *\n * Defaults to the \"shape\" strategy.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Schedule, Stream } from \"effect\"\n *\n * let last = Date.now()\n * const log = (message: string) =>\n * Effect.sync(() => {\n * const end = Date.now()\n * console.log(`${message} after ${end - last}ms`)\n * last = end\n * })\n *\n * const stream = Stream.fromSchedule(Schedule.spaced(\"50 millis\")).pipe(\n * Stream.take(6),\n * Stream.tap((n) => log(`Received ${n}`)),\n * Stream.throttle({\n * cost: Chunk.size,\n * duration: \"100 millis\",\n * units: 1\n * }),\n * Stream.tap((n) => log(`> Emitted ${n}`))\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // Received 0 after 56ms\n * // > Emitted 0 after 0ms\n * // Received 1 after 52ms\n * // > Emitted 1 after 48ms\n * // Received 2 after 52ms\n * // > Emitted 2 after 49ms\n * // Received 3 after 52ms\n * // > Emitted 3 after 48ms\n * // Received 4 after 52ms\n * // > Emitted 4 after 47ms\n * // Received 5 after 52ms\n * // > Emitted 5 after 49ms\n * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4, 5 ] }\n * ```\n *\n * @since 2.0.0\n * @category utils\n */\nexport const throttle = internal.throttle;\n/**\n * Delays the chunks of this stream according to the given bandwidth\n * parameters using the token bucket algorithm. Allows for burst in the\n * processing of elements by allowing the token bucket to accumulate tokens up\n * to a `units + burst` threshold. The weight of each chunk is determined by\n * the effectful `costFn` function.\n *\n * If using the \"enforce\" strategy, chunks that do not meet the bandwidth\n * constraints are dropped. If using the \"shape\" strategy, chunks are delayed\n * until they can be emitted without exceeding the bandwidth constraints.\n *\n * Defaults to the \"shape\" strategy.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const throttleEffect = internal.throttleEffect;\n/**\n * A stream that emits void values spaced by the specified duration.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * let last = Date.now()\n * const log = (message: string) =>\n * Effect.sync(() => {\n * const end = Date.now()\n * console.log(`${message} after ${end - last}ms`)\n * last = end\n * })\n *\n * const stream = Stream.tick(\"1 seconds\").pipe(Stream.tap(() => log(\"tick\")))\n *\n * Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)\n * // tick after 4ms\n * // tick after 1003ms\n * // tick after 1001ms\n * // tick after 1002ms\n * // tick after 1002ms\n * // { _id: 'Chunk', values: [ undefined, undefined, undefined, undefined, undefined ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const tick = internal.tick;\n/**\n * Ends the stream if it does not produce a value after the specified duration.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const timeout = internal.timeout;\n/**\n * Fails the stream with given error if it does not produce a value after d\n * duration.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const timeoutFail = internal.timeoutFail;\n/**\n * Fails the stream with given cause if it does not produce a value after d\n * duration.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const timeoutFailCause = internal.timeoutFailCause;\n/**\n * Switches the stream if it does not produce a value after the specified\n * duration.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const timeoutTo = internal.timeoutTo;\n/**\n * Converts the stream to a scoped `PubSub` of chunks. After the scope is closed,\n * the `PubSub` will never again produce values and should be discarded.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const toPubSub = internal.toPubSub;\n/**\n * Returns in a scope a ZIO effect that can be used to repeatedly pull chunks\n * from the stream. The pull effect fails with None when the stream is\n * finished, or with Some error if it fails, otherwise it returns a chunk of\n * the stream's output.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * // Simulate a chunked stream\n * const stream = Stream.fromIterable([1, 2, 3, 4, 5]).pipe(Stream.rechunk(2))\n *\n * const program = Effect.gen(function*() {\n * // Create an effect to get data chunks from the stream\n * const getChunk = yield* Stream.toPull(stream)\n *\n * // Continuously fetch and process chunks\n * while (true) {\n * const chunk = yield* getChunk\n * console.log(chunk)\n * }\n * })\n *\n * Effect.runPromise(Effect.scoped(program)).then(console.log, console.error)\n * // { _id: 'Chunk', values: [ 1, 2 ] }\n * // { _id: 'Chunk', values: [ 3, 4 ] }\n * // { _id: 'Chunk', values: [ 5 ] }\n * // (FiberFailure) Error: {\n * // \"_id\": \"Option\",\n * // \"_tag\": \"None\"\n * // }\n * ```\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const toPull = internal.toPull;\n/**\n * Converts the stream to a scoped queue of chunks. After the scope is closed,\n * the queue will never again produce values and should be discarded.\n *\n * Defaults to the \"suspend\" back pressure strategy with a capacity of 2.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const toQueue = internal.toQueue;\n/**\n * Converts the stream to a scoped queue of elements. After the scope is\n * closed, the queue will never again produce values and should be discarded.\n *\n * Defaults to a capacity of 2.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const toQueueOfElements = internal.toQueueOfElements;\n/**\n * Converts the stream to a `ReadableStream`.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const toReadableStream = internal.toReadableStream;\n/**\n * Converts the stream to a `Effect<ReadableStream>`.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const toReadableStreamEffect = internal.toReadableStreamEffect;\n/**\n * Converts the stream to a `ReadableStream` using the provided runtime.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.\n *\n * @since 2.0.0\n * @category destructors\n */\nexport const toReadableStreamRuntime = internal.toReadableStreamRuntime;\n/**\n * Converts the stream to a `AsyncIterable` using the provided runtime.\n *\n * @since 3.15.0\n * @category destructors\n */\nexport const toAsyncIterableRuntime = internal.toAsyncIterableRuntime;\n/**\n * Converts the stream to a `AsyncIterable` capturing the required dependencies.\n *\n * @since 3.15.0\n * @category destructors\n */\nexport const toAsyncIterableEffect = internal.toAsyncIterableEffect;\n/**\n * Converts the stream to a `AsyncIterable`.\n *\n * @since 3.15.0\n * @category destructors\n */\nexport const toAsyncIterable = internal.toAsyncIterable;\n/**\n * Applies the transducer to the stream and emits its outputs.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const transduce = internal.transduce;\n/**\n * Creates a stream by peeling off the \"layers\" of a value of type `S`.\n *\n * @example\n * ```ts\n * import { Effect, Option, Stream } from \"effect\"\n *\n * const stream = Stream.unfold(1, (n) => Option.some([n, n + 1]))\n *\n * Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)\n * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unfold = internal.unfold;\n/**\n * Creates a stream by peeling off the \"layers\" of a value of type `S`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unfoldChunk = internal.unfoldChunk;\n/**\n * Creates a stream by effectfully peeling off the \"layers\" of a value of type\n * `S`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unfoldChunkEffect = internal.unfoldChunkEffect;\n/**\n * Creates a stream by effectfully peeling off the \"layers\" of a value of type\n * `S`.\n *\n * @example\n * ```ts\n * import { Effect, Option, Random, Stream } from \"effect\"\n *\n * const stream = Stream.unfoldEffect(1, (n) =>\n * Random.nextBoolean.pipe(\n * Effect.map((b) => (b ? Option.some([n, -n]) : Option.some([n, n])))\n * ))\n *\n * Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)\n * // { _id: 'Chunk', values: [ 1, -1, -1, -1, -1 ] }\n * ```\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unfoldEffect = internal.unfoldEffect;\nconst void_ = internal.void;\nexport {\n/**\n * A stream that contains a single `void` value.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.void\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ undefined ] }\n *\n * ```\n * @since 2.0.0\n * @category constructors\n */\nvoid_ as void };\n/**\n * Creates a stream produced from an `Effect`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unwrap = internal.unwrap;\n/**\n * Creates a stream produced from a scoped `Effect`.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const unwrapScoped = internal.unwrapScoped;\n/**\n * Creates a stream produced from a function which receives a `Scope` and\n * returns an `Effect`. The resulting stream will emit a single element, which\n * will be the result of the returned effect, if successful.\n *\n * @since 3.11.0\n * @category constructors\n */\nexport const unwrapScopedWith = internal.unwrapScopedWith;\n/**\n * Updates the specified service within the context of the `Stream`.\n *\n * @since 2.0.0\n * @category context\n */\nexport const updateService = internal.updateService;\n/**\n * Returns the specified stream if the given condition is satisfied, otherwise\n * returns an empty stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const when = internal.when;\n/**\n * Returns the resulting stream when the given `PartialFunction` is defined\n * for the given value, otherwise returns an empty stream.\n *\n * @since 2.0.0\n * @category constructors\n */\nexport const whenCase = internal.whenCase;\n/**\n * Returns the stream when the given partial function is defined for the given\n * effectful value, otherwise returns an empty stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const whenCaseEffect = internal.whenCaseEffect;\n/**\n * Returns the stream if the given effectful condition is satisfied, otherwise\n * returns an empty stream.\n *\n * @since 2.0.0\n * @category utils\n */\nexport const whenEffect = internal.whenEffect;\n/**\n * Wraps the stream with a new span for tracing.\n *\n * @since 2.0.0\n * @category tracing\n */\nexport const withSpan = internal.withSpan;\n/**\n * Zips this stream with another point-wise and emits tuples of elements from\n * both streams.\n *\n * The new stream will end when one of the sides ends.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * // We create two streams and zip them together.\n * const stream = Stream.zip(\n * Stream.make(1, 2, 3, 4, 5, 6),\n * Stream.make(\"a\", \"b\", \"c\")\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ [ 1, 'a' ], [ 2, 'b' ], [ 3, 'c' ] ] }\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zip = internal.zip;\n/**\n * Zips this stream with another point-wise and emits tuples of elements from\n * both streams.\n *\n * The new stream will end when one of the sides ends.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipFlatten = internal.zipFlatten;\n/**\n * Zips this stream with another point-wise, creating a new stream of pairs of\n * elements from both sides.\n *\n * The defaults `defaultLeft` and `defaultRight` will be used if the streams\n * have different lengths and one of the streams has ended before the other.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.zipAll(Stream.make(1, 2, 3, 4, 5, 6), {\n * other: Stream.make(\"a\", \"b\", \"c\"),\n * defaultSelf: 0,\n * defaultOther: \"x\"\n * })\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: \"Chunk\", values: [ [ 1, \"a\" ], [ 2, \"b\" ], [ 3, \"c\" ], [ 4, \"x\" ], [ 5, \"x\" ], [ 6, \"x\" ] ] }\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAll = internal.zipAll;\n/**\n * Zips this stream with another point-wise, and keeps only elements from this\n * stream.\n *\n * The provided default value will be used if the other stream ends before\n * this one.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAllLeft = internal.zipAllLeft;\n/**\n * Zips this stream with another point-wise, and keeps only elements from the\n * other stream.\n *\n * The provided default value will be used if this stream ends before the\n * other one.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAllRight = internal.zipAllRight;\n/**\n * Zips this stream that is sorted by distinct keys and the specified stream\n * that is sorted by distinct keys to produce a new stream that is sorted by\n * distinct keys. Combines values associated with each key into a tuple,\n * using the specified values `defaultLeft` and `defaultRight` to fill in\n * missing values.\n *\n * This allows zipping potentially unbounded streams of data by key in\n * constant space but the caller is responsible for ensuring that the\n * streams are sorted by distinct keys.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAllSortedByKey = internal.zipAllSortedByKey;\n/**\n * Zips this stream that is sorted by distinct keys and the specified stream\n * that is sorted by distinct keys to produce a new stream that is sorted by\n * distinct keys. Keeps only values from this stream, using the specified\n * value `default` to fill in missing values.\n *\n * This allows zipping potentially unbounded streams of data by key in\n * constant space but the caller is responsible for ensuring that the\n * streams are sorted by distinct keys.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAllSortedByKeyLeft = internal.zipAllSortedByKeyLeft;\n/**\n * Zips this stream that is sorted by distinct keys and the specified stream\n * that is sorted by distinct keys to produce a new stream that is sorted by\n * distinct keys. Keeps only values from that stream, using the specified\n * value `default` to fill in missing values.\n *\n * This allows zipping potentially unbounded streams of data by key in\n * constant space but the caller is responsible for ensuring that the\n * streams are sorted by distinct keys.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAllSortedByKeyRight = internal.zipAllSortedByKeyRight;\n/**\n * Zips this stream that is sorted by distinct keys and the specified stream\n * that is sorted by distinct keys to produce a new stream that is sorted by\n * distinct keys. Uses the functions `left`, `right`, and `both` to handle\n * the cases where a key and value exist in this stream, that stream, or\n * both streams.\n *\n * This allows zipping potentially unbounded streams of data by key in\n * constant space but the caller is responsible for ensuring that the\n * streams are sorted by distinct keys.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAllSortedByKeyWith = internal.zipAllSortedByKeyWith;\n/**\n * Zips this stream with another point-wise. The provided functions will be\n * used to create elements for the composed stream.\n *\n * The functions `left` and `right` will be used if the streams have different\n * lengths and one of the streams has ended before the other.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.zipAllWith(Stream.make(1, 2, 3, 4, 5, 6), {\n * other: Stream.make(\"a\", \"b\", \"c\"),\n * onSelf: (n) => [n, \"x\"],\n * onOther: (s) => [0, s],\n * onBoth: (n, s) => [n - s.length, s]\n * })\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: \"Chunk\", values: [ [ 0, \"a\" ], [ 1, \"b\" ], [ 2, \"c\" ], [ 4, \"x\" ], [ 5, \"x\" ], [ 6, \"x\" ] ] }\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipAllWith = internal.zipAllWith;\n/**\n * Zips the two streams so that when a value is emitted by either of the two\n * streams, it is combined with the latest value from the other stream to\n * produce a result.\n *\n * Note: tracking the latest value is done on a per-chunk basis. That means\n * that emitted elements that are not the last value in chunks will never be\n * used for zipping.\n *\n * @example\n * ```ts\n * import { Effect, Schedule, Stream } from \"effect\"\n *\n * const s1 = Stream.make(1, 2, 3).pipe(\n * Stream.schedule(Schedule.spaced(\"1 second\"))\n * )\n *\n * const s2 = Stream.make(\"a\", \"b\", \"c\", \"d\").pipe(\n * Stream.schedule(Schedule.spaced(\"500 millis\"))\n * )\n *\n * const stream = Stream.zipLatest(s1, s2)\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: \"Chunk\", values: [ [ 1, \"a\" ], [ 1, \"b\" ], [ 2, \"b\" ], [ 2, \"c\" ], [ 2, \"d\" ], [ 3, \"d\" ] ] }\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipLatest = internal.zipLatest;\n/**\n * Zips multiple streams so that when a value is emitted by any of the streams,\n * it is combined with the latest values from the other streams to produce a result.\n *\n * Note: tracking the latest value is done on a per-chunk basis. That means\n * that emitted elements that are not the last value in chunks will never be\n * used for zipping.\n *\n * @example\n * ```ts\n * import { Stream, Schedule, Console, Effect } from \"effect\"\n *\n * const stream = Stream.zipLatestAll(\n * Stream.fromSchedule(Schedule.spaced('1 millis')),\n * Stream.fromSchedule(Schedule.spaced('2 millis')),\n * Stream.fromSchedule(Schedule.spaced('4 millis')),\n * ).pipe(Stream.take(6), Stream.tap(Console.log))\n *\n * Effect.runPromise(Stream.runDrain(stream))\n * // Output:\n * // [ 0, 0, 0 ]\n * // [ 1, 0, 0 ]\n * // [ 1, 1, 0 ]\n * // [ 2, 1, 0 ]\n * // [ 3, 1, 0 ]\n * // [ 3, 1, 1 ]\n * // .....\n * ```\n *\n * @since 3.3.0\n * @category zipping\n */\nexport const zipLatestAll = internal.zipLatestAll;\n/**\n * Zips the two streams so that when a value is emitted by either of the two\n * streams, it is combined with the latest value from the other stream to\n * produce a result.\n *\n * Note: tracking the latest value is done on a per-chunk basis. That means\n * that emitted elements that are not the last value in chunks will never be\n * used for zipping.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipLatestWith = internal.zipLatestWith;\n/**\n * Zips this stream with another point-wise, but keeps only the outputs of\n * `left` stream.\n *\n * The new stream will end when one of the sides ends.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipLeft = internal.zipLeft;\n/**\n * Zips this stream with another point-wise, but keeps only the outputs of the\n * `right` stream.\n *\n * The new stream will end when one of the sides ends.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipRight = internal.zipRight;\n/**\n * Zips this stream with another point-wise and applies the function to the\n * paired elements.\n *\n * The new stream will end when one of the sides ends.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * // We create two streams and zip them with custom logic.\n * const stream = Stream.zipWith(\n * Stream.make(1, 2, 3, 4, 5, 6),\n * Stream.make(\"a\", \"b\", \"c\"),\n * (n, s) => [n - s.length, s]\n * )\n *\n * Effect.runPromise(Stream.runCollect(stream)).then(console.log)\n * // { _id: 'Chunk', values: [ [ 0, 'a' ], [ 1, 'b' ], [ 2, 'c' ] ] }\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipWith = internal.zipWith;\n/**\n * Zips this stream with another point-wise and applies the function to the\n * paired elements.\n *\n * The new stream will end when one of the sides ends.\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipWithChunks = internal.zipWithChunks;\n/**\n * Zips each element with the next element if present.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Stream } from \"effect\"\n *\n * const stream = Stream.zipWithNext(Stream.make(1, 2, 3, 4))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then((chunk) => console.log(Chunk.toArray(chunk)))\n * // [\n * // [ 1, { _id: 'Option', _tag: 'Some', value: 2 } ],\n * // [ 2, { _id: 'Option', _tag: 'Some', value: 3 } ],\n * // [ 3, { _id: 'Option', _tag: 'Some', value: 4 } ],\n * // [ 4, { _id: 'Option', _tag: 'None' } ]\n * // ]\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipWithNext = internal.zipWithNext;\n/**\n * Zips each element with the previous element. Initially accompanied by\n * `None`.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Stream } from \"effect\"\n *\n * const stream = Stream.zipWithPrevious(Stream.make(1, 2, 3, 4))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then((chunk) => console.log(Chunk.toArray(chunk)))\n * // [\n * // [ { _id: 'Option', _tag: 'None' }, 1 ],\n * // [ { _id: 'Option', _tag: 'Some', value: 1 }, 2 ],\n * // [ { _id: 'Option', _tag: 'Some', value: 2 }, 3 ],\n * // [ { _id: 'Option', _tag: 'Some', value: 3 }, 4 ]\n * // ]\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipWithPrevious = internal.zipWithPrevious;\n/**\n * Zips each element with both the previous and next element.\n *\n * @example\n * ```ts\n * import { Chunk, Effect, Stream } from \"effect\"\n *\n * const stream = Stream.zipWithPreviousAndNext(Stream.make(1, 2, 3, 4))\n *\n * Effect.runPromise(Stream.runCollect(stream)).then((chunk) => console.log(Chunk.toArray(chunk)))\n * // [\n * // [\n * // { _id: 'Option', _tag: 'None' },\n * // 1,\n * // { _id: 'Option', _tag: 'Some', value: 2 }\n * // ],\n * // [\n * // { _id: 'Option', _tag: 'Some', value: 1 },\n * // 2,\n * // { _id: 'Option', _tag: 'Some', value: 3 }\n * // ],\n * // [\n * // { _id: 'Option', _tag: 'Some', value: 2 },\n * // 3,\n * // { _id: 'Option', _tag: 'Some', value: 4 }\n * // ],\n * // [\n * // { _id: 'Option', _tag: 'Some', value: 3 },\n * // 4,\n * // { _id: 'Option', _tag: 'None' }\n * // ]\n * // ]\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipWithPreviousAndNext = internal.zipWithPreviousAndNext;\n/**\n * Zips this stream together with the index of elements.\n *\n * @example\n * ```ts\n * import { Effect, Stream } from \"effect\"\n *\n * const stream = Stream.make(\"Mary\", \"James\", \"Robert\", \"Patricia\")\n *\n * const indexedStream = Stream.zipWithIndex(stream)\n *\n * Effect.runPromise(Stream.runCollect(indexedStream)).then(console.log)\n * // {\n * // _id: 'Chunk',\n * // values: [ [ 'Mary', 0 ], [ 'James', 1 ], [ 'Robert', 2 ], [ 'Patricia', 3 ] ]\n * // }\n * ```\n *\n * @since 2.0.0\n * @category zipping\n */\nexport const zipWithIndex = internal.zipWithIndex;\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * The \"do simulation\" in Effect allows you to write code in a more declarative style, similar to the \"do notation\" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.\n *\n * Here's how the do simulation works:\n *\n * 1. Start the do simulation using the `Do` value\n * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values\n * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope\n * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values\n *\n * @example\n * ```ts\n * import * as assert from \"node:assert\"\n * import { Chunk, Effect, pipe, Stream } from \"effect\"\n *\n * const result = pipe(\n * Stream.Do,\n * Stream.bind(\"x\", () => Stream.succeed(2)),\n * Stream.bind(\"y\", () => Stream.succeed(3)),\n * Stream.let(\"sum\", ({ x, y }) => x + y)\n * )\n * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))\n * ```\n *\n * @see {@link bindTo}\n * @see {@link bind}\n * @see {@link bindEffect}\n * @see {@link let_ let}\n *\n * @category do notation\n * @since 2.0.0\n */\nexport const Do = internal.Do;\n/**\n * The \"do simulation\" in Effect allows you to write code in a more declarative style, similar to the \"do notation\" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.\n *\n * Here's how the do simulation works:\n *\n * 1. Start the do simulation using the `Do` value\n * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values\n * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope\n * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values\n *\n * @example\n * ```ts\n * import * as assert from \"node:assert\"\n * import { Chunk, Effect, pipe, Stream } from \"effect\"\n *\n * const result = pipe(\n * Stream.Do,\n * Stream.bind(\"x\", () => Stream.succeed(2)),\n * Stream.bind(\"y\", () => Stream.succeed(3)),\n * Stream.let(\"sum\", ({ x, y }) => x + y)\n * )\n * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))\n * ```\n *\n * @see {@link Do}\n * @see {@link bindTo}\n * @see {@link bindEffect}\n * @see {@link let_ let}\n *\n * @category do notation\n * @since 2.0.0\n */\nexport const bind = internal.bind;\n/**\n * Binds an effectful value in a `do` scope\n *\n * @see {@link Do}\n * @see {@link bindTo}\n * @see {@link bind}\n * @see {@link let_ let}\n *\n * @since 2.0.0\n * @category do notation\n */\nexport const bindEffect = groupBy_.bindEffect;\n/**\n * The \"do simulation\" in Effect allows you to write code in a more declarative style, similar to the \"do notation\" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.\n *\n * Here's how the do simulation works:\n *\n * 1. Start the do simulation using the `Do` value\n * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values\n * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope\n * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values\n *\n * @example\n * ```ts\n * import * as assert from \"node:assert\"\n * import { Chunk, Effect, pipe, Stream } from \"effect\"\n *\n * const result = pipe(\n * Stream.Do,\n * Stream.bind(\"x\", () => Stream.succeed(2)),\n * Stream.bind(\"y\", () => Stream.succeed(3)),\n * Stream.let(\"sum\", ({ x, y }) => x + y)\n * )\n * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))\n * ```\n *\n * @see {@link Do}\n * @see {@link bind}\n * @see {@link bindEffect}\n * @see {@link let_ let}\n *\n * @category do notation\n * @since 2.0.0\n */\nexport const bindTo = internal.bindTo;\nconst let_ = internal.let_;\nexport {\n/**\n * The \"do simulation\" in Effect allows you to write code in a more declarative style, similar to the \"do notation\" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.\n *\n * Here's how the do simulation works:\n *\n * 1. Start the do simulation using the `Do` value\n * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values\n * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope\n * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values\n *\n * @example\n * ```ts\n * import * as assert from \"node:assert\"\n * import { Chunk, Effect, pipe, Stream } from \"effect\"\n *\n * const result = pipe(\n * Stream.Do,\n * Stream.bind(\"x\", () => Stream.succeed(2)),\n * Stream.bind(\"y\", () => Stream.succeed(3)),\n * Stream.let(\"sum\", ({ x, y }) => x + y)\n * )\n * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))\n * ```\n *\n * @see {@link Do}\n * @see {@link bindTo}\n * @see {@link bind}\n * @see {@link bindEffect}\n *\n * @category do notation\n * @since 2.0.0\n */\nlet_ as let };\n// -------------------------------------------------------------------------------------\n// encoding\n// -------------------------------------------------------------------------------------\n/**\n * Decode Uint8Array chunks into a stream of strings using the specified encoding.\n *\n * @since 2.0.0\n * @category encoding\n */\nexport const decodeText = internal.decodeText;\n/**\n * Encode a stream of strings into a stream of Uint8Array chunks using the specified encoding.\n *\n * @since 2.0.0\n * @category encoding\n */\nexport const encodeText = internal.encodeText;\n/**\n * Creates a `Stream` using addEventListener.\n * @since 3.1.0\n */\nexport const fromEventListener = internal.fromEventListener;\n//# sourceMappingURL=Stream.js.map","import { Component, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'header-integration',\n styles: `\n :host {\n display: block;\n min-height: 100vh;\n background: var(--lmvz-color-spec-bg-outer-view);\n }\n\n .active button {\n background-color: var(--lmvz-semantic-color-status-selected);\n }\n `,\n shadow: true,\n})\nexport class HeaderIntegration {\n @Prop({ mutable: true }) activeNav: string;\n\n private activate(event: CustomEvent<void>) {\n const target = event.currentTarget as HTMLLmvzButtonElement;\n const navItem = target.closest('[slot=\"nav-primary\"]') as HTMLElement | null;\n if (!navItem) return;\n\n const navId = navItem.id;\n if (!navId) {\n console.warn('Nav item does not have an id:', navItem);\n return;\n }\n\n console.log('Activating nav item:', navId);\n this.activeNav = navId;\n }\n\n render() {\n return (\n <Host>\n <lmvz-header lmvzActiveNav={this.activeNav}>\n {/* <lmvz-icon icon=\"Logo\" slot=\"brand\" aria-hidden></lmvz-icon> */}\n <lmvz-menuitem slot=\"nav-primary\" id=\"lehrmittel\" onLmvzActivation={this.activate.bind(this)}>\n Lehrmittel\n </lmvz-menuitem>\n <lmvz-menuitem slot=\"nav-primary\" id=\"verwaltung\" onLmvzActivation={this.activate.bind(this)}>\n Verwaltung\n </lmvz-menuitem>\n <lmvz-menuitem slot=\"connect-nav-lehrmittel\">\n <lmvz-icon icon=\"book\"></lmvz-icon>Deutsch 7\n </lmvz-menuitem>\n <lmvz-menuitem slot=\"connect-nav-lehrmittel\">\n <lmvz-icon icon=\"book\"></lmvz-icon>Mathe 2\n </lmvz-menuitem>\n <lmvz-menuitem slot=\"connect-nav-verwaltung\">\n <lmvz-icon icon=\"cog\"></lmvz-icon>iwas mit Verwaltung\n </lmvz-menuitem>\n <lmvz-menuitem slot=\"connect-nav-verwaltung\" aria-label=\"Einstellungen\">\n <lmvz-icon icon=\"cog\"></lmvz-icon>\n </lmvz-menuitem>\n\n <lmvz-button slot=\"actions\" aria-label=\"Benutzerkonto\">\n <lmvz-icon icon=\"user\"></lmvz-icon>\n </lmvz-button>\n </lmvz-header>\n\n <lmvz-input label=\"test\"></lmvz-input>\n </Host>\n );\n }\n}\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","/**\n * Adapted from ionic-team/ionic-framework/core/src/utils/helpers.ts\n * v8.7.17\n *\n * Major changes are marked with `// ! LMVZ-DS` comments\n *\n * MIT License\n *\n * Copyright (c) 2015-present Drifty Co.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n// ! LMVZ-DS:\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { EventEmitter } from '@stencil/core';\n\ndeclare const __zone_symbol__requestAnimationFrame: typeof window.requestAnimationFrame;\ndeclare const requestAnimationFrame: typeof window.requestAnimationFrame;\n\nexport const transitionEndAsync = (el: HTMLElement | null, expectedDuration = 0) => {\n return new Promise(resolve => {\n transitionEnd(el, expectedDuration, resolve);\n });\n};\n\n/**\n * Allows developer to wait for a transition\n * to finish and fallback to a timer if the\n * transition is cancelled or otherwise\n * never finishes. Also see transitionEndAsync\n * which is an await-able version of this.\n */\nconst transitionEnd = (el: HTMLElement | null, expectedDuration = 0, callback: (ev?: TransitionEvent) => void) => {\n let unRegTrans: (() => void) | undefined;\n let animationTimeout: number | undefined;\n const opts: AddEventListenerOptions = { passive: true };\n const ANIMATION_FALLBACK_TIMEOUT = 500;\n\n const unregister = () => {\n if (unRegTrans) {\n unRegTrans();\n }\n };\n\n const onTransitionEnd = (ev?: Event) => {\n if (ev === undefined || el === ev.target) {\n unregister();\n callback(ev as TransitionEvent);\n }\n };\n\n if (el) {\n el.addEventListener('webkitTransitionEnd', onTransitionEnd, opts);\n el.addEventListener('transitionend', onTransitionEnd, opts);\n animationTimeout = setTimeout(onTransitionEnd, expectedDuration + ANIMATION_FALLBACK_TIMEOUT) as unknown as number;\n\n unRegTrans = () => {\n if (animationTimeout !== undefined) {\n clearTimeout(animationTimeout);\n animationTimeout = undefined;\n }\n el.removeEventListener('webkitTransitionEnd', onTransitionEnd, opts);\n el.removeEventListener('transitionend', onTransitionEnd, opts);\n };\n }\n\n return unregister;\n};\n\n/**\n * Waits for a component to be ready for\n * both custom element and non-custom element builds.\n * If non-custom element build, el.componentOnReady\n * will be used.\n * For custom element builds, we wait a frame\n * so that the inner contents of the component\n * have a chance to render.\n *\n * Use this utility rather than calling\n * el.componentOnReady yourself.\n */\nexport const componentOnReady = (el: any, callback: any) => {\n if (el.componentOnReady) {\n el.componentOnReady().then((resolvedEl: any) => callback(resolvedEl));\n } else {\n raf(() => callback(el));\n }\n};\n\n/**\n * This functions checks if a Stencil component is using\n * the lazy loaded build of Stencil. Returns `true` if\n * the component is lazy loaded. Returns `false` otherwise.\n */\nexport const hasLazyBuild = (stencilEl: HTMLElement) => {\n return (stencilEl as any).componentOnReady !== undefined;\n};\n\nexport type Attributes = { [key: string]: any };\n\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `ion-input` should inherit\n * the `title` attribute that developers set directly on `ion-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\nexport const inheritAttributes = (el: HTMLElement, attributes: string[] = []) => {\n const attributeObject: Attributes = {};\n\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n\n return attributeObject;\n};\n\n/**\n * List of available ARIA attributes + `role`.\n * Removed deprecated attributes.\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes\n */\nconst ariaAttributes = [\n 'role',\n 'aria-activedescendant',\n 'aria-atomic',\n 'aria-autocomplete',\n 'aria-braillelabel',\n 'aria-brailleroledescription',\n 'aria-busy',\n 'aria-checked',\n 'aria-colcount',\n 'aria-colindex',\n 'aria-colindextext',\n 'aria-colspan',\n 'aria-controls',\n 'aria-current',\n 'aria-describedby',\n 'aria-description',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-flowto',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-level',\n 'aria-live',\n 'aria-multiline',\n 'aria-multiselectable',\n 'aria-orientation',\n 'aria-owns',\n 'aria-placeholder',\n 'aria-posinset',\n 'aria-pressed',\n 'aria-readonly',\n 'aria-relevant',\n 'aria-required',\n 'aria-roledescription',\n 'aria-rowcount',\n 'aria-rowindex',\n 'aria-rowindextext',\n 'aria-rowspan',\n 'aria-selected',\n 'aria-setsize',\n 'aria-sort',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n];\n\n/**\n * Returns an array of aria attributes that should be copied from\n * the shadow host element to a target within the light DOM.\n * @param el The element that the attributes should be copied from.\n * @param ignoreList The list of aria-attributes to ignore reflecting and removing from the host.\n * Use this in instances where we manually specify aria attributes on the `<Host>` element.\n */\nexport const inheritAriaAttributes = (el: HTMLElement, ignoreList?: string[]) => {\n let attributesToInherit = ariaAttributes;\n if (ignoreList && ignoreList.length > 0) {\n attributesToInherit = attributesToInherit.filter(attr => !ignoreList.includes(attr));\n }\n return inheritAttributes(el, attributesToInherit);\n};\n\nexport const addEventListener = (el: any, eventName: string, callback: any, opts?: any) => {\n return el.addEventListener(eventName, callback, opts);\n};\n\nexport const removeEventListener = (el: any, eventName: string, callback: any, opts?: any) => {\n return el.removeEventListener(eventName, callback, opts);\n};\n\n/**\n * Gets the root context of a shadow dom element\n * On newer browsers this will be the shadowRoot,\n * but for older browser this may just be the\n * element itself.\n *\n * Useful for whenever you need to explicitly\n * do \"myElement.shadowRoot!.querySelector(...)\".\n */\nexport const getElementRoot = (el: HTMLElement, fallback: HTMLElement = el) => {\n return el.shadowRoot || fallback;\n};\n\n/**\n * Patched version of requestAnimationFrame that avoids ngzone\n * Use only when you know ngzone should not run\n */\nexport const raf = (h: FrameRequestCallback) => {\n if (typeof __zone_symbol__requestAnimationFrame === 'function') {\n return __zone_symbol__requestAnimationFrame(h);\n }\n if (typeof requestAnimationFrame === 'function') {\n return requestAnimationFrame(h);\n }\n return setTimeout(h);\n};\n\nexport const hasShadowDom = (el: HTMLElement) => {\n return !!el.shadowRoot && !!(el as any).attachShadow;\n};\n\nexport const focusVisibleElement = (el: HTMLElement) => {\n el.focus();\n\n // ! LMVZ-DS: removed ion-focusable handling\n};\n\n/**\n * This method is used to add a hidden input to a host element that contains\n * a Shadow DOM. It does not add the input inside of the Shadow root which\n * allows it to be picked up inside of forms. It should contain the same\n * values as the host element.\n *\n * @param always Add a hidden input even if the container does not use Shadow\n * @param container The element where the input will be added\n * @param name The name of the input\n * @param value The value of the input\n * @param disabled If true, the input is disabled\n */\nexport const renderHiddenInput = (always: boolean, container: HTMLElement, name: string, value: string | undefined | null, disabled: boolean) => {\n if (always || hasShadowDom(container)) {\n let input = container.querySelector('input.aux-input') as HTMLInputElement | null;\n if (!input) {\n input = container.ownerDocument!.createElement('input');\n input.type = 'hidden';\n input.classList.add('aux-input');\n container.appendChild(input);\n }\n input.disabled = disabled;\n input.name = name;\n input.value = value || '';\n }\n};\n\nexport const clamp = (min: number, n: number, max: number) => {\n return Math.max(min, Math.min(n, max));\n};\n\nexport const assert = (actual: any, reason: string) => {\n if (!actual) {\n const message = 'ASSERT: ' + reason;\n console.error(message);\n debugger; // eslint-disable-line\n throw new Error(message);\n }\n};\n\nexport const now = (ev: UIEvent) => {\n return ev.timeStamp || Date.now();\n};\n\nexport const pointerCoord = (ev: any): { x: number; y: number } => {\n // get X coordinates for either a mouse click\n // or a touch depending on the given event\n if (ev) {\n const changedTouches = ev.changedTouches;\n if (changedTouches && changedTouches.length > 0) {\n const touch = changedTouches[0];\n return { x: touch.clientX, y: touch.clientY };\n }\n if (ev.pageX !== undefined) {\n return { x: ev.pageX, y: ev.pageY };\n }\n }\n return { x: 0, y: 0 };\n};\n\n// ! removed isEndSide (for RTL handling) via menu-interface\n\nexport const deferEvent = (event: EventEmitter): EventEmitter => {\n return debounceEvent(event, 0);\n};\n\nexport const debounceEvent = (event: EventEmitter, wait: number): EventEmitter => {\n const original = (event as any)._original || event;\n return {\n _original: event,\n emit: debounce(original.emit.bind(original), wait),\n } as EventEmitter;\n};\n\nexport const debounce = (func: (...args: any[]) => void, wait = 0) => {\n let timer: any;\n return (...args: any[]): any => {\n clearTimeout(timer);\n timer = setTimeout(func, wait, ...args);\n };\n};\n\n/**\n * Check whether the two string maps are shallow equal.\n *\n * undefined is treated as an empty map.\n *\n * @returns whether the keys are the same and the values are shallow equal.\n */\nexport const shallowEqualStringMap = (map1: { [k: string]: any } | undefined, map2: { [k: string]: any } | undefined): boolean => {\n map1 ??= {};\n map2 ??= {};\n\n if (map1 === map2) {\n return true;\n }\n\n const keys1 = Object.keys(map1);\n\n if (keys1.length !== Object.keys(map2).length) {\n return false;\n }\n\n for (const k1 of keys1) {\n if (!(k1 in map2)) {\n return false;\n }\n if (map1[k1] !== map2[k1]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Checks input for usable number. Not NaN and not Infinite.\n */\nexport const isSafeNumber = (input: unknown): input is number => {\n return typeof input === 'number' && !isNaN(input) && isFinite(input);\n};\n\n// CUSTOM LMVZ-DS utilities for components\n\nexport function getDeepActiveElement(root = document) {\n let activeElement = root.activeElement;\n\n // No focus at all\n if (!activeElement) {\n return null;\n }\n\n // Walk through shadow DOMs\n while (activeElement && activeElement.shadowRoot) {\n const next = activeElement.shadowRoot.activeElement;\n if (!next) {\n // Focus is effectively on the host element itself\n break;\n }\n activeElement = next;\n }\n\n return activeElement;\n}\n\nexport function canReceiveFocus(el: Element): boolean {\n return (\n el instanceof HTMLElement && el.tabIndex >= 0 && !el.hasAttribute('disabled') && el.getAttribute('aria-hidden') !== 'true' && el.checkVisibility() && el.offsetParent !== null\n );\n}\n\nexport type FormRef = string | HTMLFormElement | undefined;\n\n/**\n * Finds the form element based on the provided `form` selector or element reference.\n */\nexport function findFormByRef(form: FormRef, el: HTMLElement): HTMLFormElement | null {\n if (form instanceof HTMLFormElement) {\n return form;\n }\n if (typeof form === 'string') {\n // Check if the string provided is a form id.\n const el: HTMLElement | null = document.getElementById(form);\n if (el) {\n if (el instanceof HTMLFormElement) {\n return el;\n } else {\n /**\n * The developer referenced the form using an id string,\n * but the element with that id is not a form element.\n */\n console.warn(`No Form found with selector: \"#${form}\". Verify that the element with id exists and is actually a <form> element.`, el);\n return null;\n }\n } else {\n /**\n * The developer referenced the form using an id string,\n * but the element with that id could not be found in the DOM.\n */\n console.warn(`No Form found with selector: \"#${form}\". Verify that the id is correct and the form is rendered in the DOM.`, el);\n return null;\n }\n }\n if (form !== undefined) {\n /**\n * The developer specified an HTMLElement for the form attribute,\n * but the element is not a HTMLFormElement.\n * This will also catch if the developer passes null as the form attribute.\n */\n console.warn(`The provided \"form\" element is invalid. Verify that the form is a HTMLFormElement and rendered in the DOM.`, el);\n return null;\n }\n /**\n * If the form element is not set, the button may be inside\n * of a form element. Query the closest form element to the button.\n */\n return el.closest('form');\n}\n","import type { EventEmitter } from '@stencil/core';\nimport type { ReactiveController } from './reactive-controller-host';\n\nexport type ElementActivationHost = {\n el: HTMLElement;\n lmvzActivation: EventEmitter<void>;\n};\n\ntype Config = {\n localHandler?: (event: Event) => unknown;\n keys?: string[];\n};\n\nexport class ElementActivationController implements ReactiveController {\n constructor(\n private host: ElementActivationHost,\n private config?: Config,\n ) {}\n\n hostDidLoad() {\n if (!this.host.el.hasAttribute('tabindex')) {\n console.warn('Interactive element does not have a tabindex attribute!', this.host.el);\n }\n this.host.el.addEventListener('keydown', this.handleKeyDown.bind(this));\n this.host.el.addEventListener('click', this.handleActivation.bind(this));\n }\n\n private handleKeyDown = (event: KeyboardEvent) => {\n // Activate on Enter or Space key press\n if ((this.config?.keys ?? ['Enter', ' ']).includes(event.key)) {\n // Prevent default scrolling behavior for Space key\n event.preventDefault();\n this.handleActivation(event);\n }\n };\n\n private handleActivation = (event: Event) => {\n this.host.lmvzActivation.emit();\n if (this.config?.localHandler) {\n this.config.localHandler(event);\n }\n };\n}\n","import { ComponentInterface } from '@stencil/core';\n\nexport interface ReactiveController {\n hostConnected?(): void;\n hostDisconnected?(): void;\n hostWillLoad?(): Promise<void> | void;\n hostDidLoad?(): void;\n hostWillRender?(): Promise<void> | void;\n hostDidRender?(): void;\n hostWillUpdate?(): Promise<void> | void;\n hostDidUpdate?(): void;\n readonly disabled?: boolean;\n}\n\nexport class ReactiveControllerHost implements ComponentInterface {\n private controllers = new Set<ReactiveController>();\n\n protected addController(controller: ReactiveController) {\n this.controllers.add(controller);\n }\n\n protected removeController(controller: ReactiveController) {\n this.controllers.delete(controller);\n }\n\n private get activeControllers() {\n return Array.from(this.controllers).filter(controller => !controller.disabled);\n }\n\n connectedCallback() {\n if (!this.controllers.size) {\n // sanity check - likely indicates a setup error\n console.warn('ReactiveControllerHost connected with no controllers registered.', this);\n }\n this.activeControllers.forEach(controller => controller.hostConnected?.());\n }\n\n disconnectedCallback() {\n this.activeControllers.forEach(controller => controller.hostDisconnected?.());\n }\n\n componentWillLoad() {\n this.activeControllers.forEach(controller => controller.hostWillLoad?.());\n }\n\n componentDidLoad() {\n this.activeControllers.forEach(controller => controller.hostDidLoad?.());\n }\n\n componentWillRender() {\n this.activeControllers.forEach(controller => controller.hostWillRender?.());\n }\n\n componentDidRender() {\n this.activeControllers.forEach(controller => controller.hostDidRender?.());\n }\n\n componentWillUpdate() {\n this.activeControllers.forEach(controller => controller.hostWillUpdate?.());\n }\n\n componentDidUpdate() {\n this.activeControllers.forEach(controller => controller.hostDidUpdate?.());\n }\n}\n","import { Build } from '@stencil/core';\nimport type { AxeResults, ElementContext, UnlabelledFrameSelector } from 'axe-core';\nimport { Effect, Fiber, Queue, Stream } from 'effect';\nimport type { ReactiveController } from '../reactive-controller-host';\n\ntype AxeRunRequest = {\n context: ElementContext;\n onComplete: (error: Error | null, results?: AxeResults) => void;\n};\n\nexport type AriaValidationHost<T extends HTMLElement = HTMLElement> = {\n el: T;\n};\ntype Config = {\n reValidateOnPropChanges?: boolean;\n verboseLogging?: boolean;\n};\n\n/**\n * A controller that performs ARIA validation on the host component and its children once the component is visible.\n *\n * The host class must provide a member `el`, using stencil's @Element() decorator.\n * The controller will run axe-core validation on this element and log any ARIA violations to the console,\n * at the appropriate lifecycle points.\n *\n * This is a basic implementation that allows for further enhancements, such as:\n * - different timings: on load, on demand, on attribute change, etc.\n * - context-based, stateful optimization (such as only validating children that are relevant for the host's ARIA role)\n */\nexport class AriaValidationController implements ReactiveController {\n private static get globalValidationEnabled() {\n return Build.isDev; // TODO: implement runtime switch for enabling/disabling ARIA validation\n }\n private static axe = this.globalValidationEnabled ? import('axe-core') : null;\n private static axeQueue: Queue.Queue<AxeRunRequest> | null = null;\n private static axeStreamFiber: Fiber.RuntimeFiber<void, never> | null = null;\n\n private visibilityObserver?: IntersectionObserver;\n private elementQueued = false;\n private elementValidated = false;\n private knownValidationErrors: UnlabelledFrameSelector[] = [];\n\n get disabled() {\n return !AriaValidationController.globalValidationEnabled;\n }\n\n constructor(\n private readonly host: AriaValidationHost,\n private readonly config?: Config,\n ) {\n // Initialize the stream on first use\n AriaValidationController.initializeAxeStream();\n }\n\n /**\n * Initializes the shared axe validation stream that processes runs sequentially.\n * This is called once on first use and creates a background fiber that processes\n * validation requests from the queue.\n */\n private static initializeAxeStream() {\n if (!this.globalValidationEnabled) return;\n if (this.axeStreamFiber) return;\n\n const program = Effect.gen(function* () {\n // Create a bounded queue for axe run requests\n const queue = (AriaValidationController.axeQueue = yield* Queue.bounded<AxeRunRequest>(100));\n\n // Load axe library once\n const axeLib = yield* Effect.promise(() => AriaValidationController.axe);\n if (!axeLib) {\n console.error('Axe library not available, ARIA validation will not run.');\n return;\n }\n\n // Create a stream from the queue that processes requests sequentially\n const stream = Stream.fromQueue(queue).pipe(\n Stream.mapEffect(({ context, onComplete }) =>\n Effect.async<void, never>(resume => {\n // Run axe validation and resume when complete\n axeLib.run(context, {}, (error, results) => {\n onComplete(error, results);\n resume(Effect.void);\n });\n }),\n ),\n );\n\n // Run the stream indefinitely, processing each request sequentially\n yield* Stream.runDrain(stream);\n });\n\n // Start the stream in the background\n this.axeStreamFiber = Effect.runFork(program);\n }\n\n hostDidLoad() {\n if (this.elementQueued || this.elementValidated) return;\n\n if (!this.host.el.checkVisibility()) {\n this.observeVisibilityOnce();\n return;\n }\n\n this.enqueueValidation();\n }\n\n hostDidUpdate() {\n this.checkLazyValidation();\n }\n\n hostDisconnected() {\n this.discardVisibilityObserver();\n }\n\n private observeVisibilityOnce() {\n this.visibilityObserver = new IntersectionObserver(\n entries => {\n for (const entry of entries) {\n if (entry.target !== this.host.el) continue;\n if (!entry.isIntersecting) continue;\n\n this.checkLazyValidation();\n\n // stop observing once the element is visible and validation is triggered\n this.discardVisibilityObserver();\n }\n },\n {\n root: this.host.el.parentElement,\n rootMargin: '0px',\n threshold: 0.01, // 1% visible is enough to count as visible\n },\n );\n this.visibilityObserver.observe(this.host.el);\n }\n\n private checkLazyValidation() {\n if (!this.config?.reValidateOnPropChanges && (this.elementQueued || this.elementValidated)) return;\n this.enqueueValidation();\n }\n\n private enqueueValidation() {\n if (!AriaValidationController.globalValidationEnabled) return;\n\n this.elementQueued = true;\n\n // Enqueue the axe run request - will be processed sequentially\n Effect.runPromise(\n // since the queue lives in the static context,\n // we need to wrap the enqueueing in an effect to access it\n // and also pass around the current element and a callback\n AriaValidationController.axeQueue?.offer({\n context: { include: this.host.el, exclude: this.knownValidationErrors },\n onComplete: (error, results) => {\n this.elementValidated = true;\n if (error) {\n console.error('Error running ARIA validation:', error);\n return;\n }\n if (!results?.violations.length) {\n if (this.config?.verboseLogging) {\n console.log(`No ARIA validation violations found for ${this.host.el?.tagName || 'element'}.`);\n }\n return;\n }\n\n const label = `ARIA validation violations found for ${this.host.el?.tagName || 'element'}`;\n if (this.config?.verboseLogging) {\n console.group(label);\n } else {\n console.groupCollapsed(label);\n }\n const targets = results.violations.flatMap(violation => {\n console.dir(violation, { showHidden: true, compact: false });\n return violation.nodes.map(node => node.target);\n });\n console.log('element:', this.host.el);\n console.groupEnd();\n\n this.knownValidationErrors.push(...targets);\n },\n }),\n );\n }\n\n private discardVisibilityObserver() {\n if (!this.visibilityObserver) return;\n this.visibilityObserver.disconnect();\n this.visibilityObserver = undefined;\n }\n}\n","@import url('../../styles/internal/define-layers.css');\n\n@import url('../../styles/fragments/_routerFont.css') layer(lmvz-ds.theme);\n@import url('../../styles/fragments/_reset.css') layer(lmvz-ds.reset);\n\n:host {\n /* * the (invalid nested) import will be handled by postcss */\n /* stylelint-disable-next-line no-invalid-position-at-import-rule */\n @import url('../../styles/fragments/_buttons.css');\n\n display: contents;\n}\n\n::slotted(*) {\n --lmvz-component-color: var(--lmvz-button-color);\n}\n","import { Component, Element, Event, Host, Prop, h, type EventEmitter } from '@stencil/core';\nimport classNames from 'classnames';\nimport { Button } from '../../api';\nimport { findFormByRef, inheritAriaAttributes, type Attributes, type FormRef } from '../../utils/component';\nimport { ElementActivationController, type ElementActivationHost } from '../../utils/element-activation-controller';\nimport { ReactiveControllerHost } from '../../utils/reactive-controller-host';\nimport { AriaValidationController, type AriaValidationHost } from '../../utils/validation/aria-validation-controller';\n\n/**\n * @slot default - Slot for the content of the button\n */\n@Component({\n tag: 'lmvz-button',\n styleUrl: './lmvz-button.css',\n shadow: { delegatesFocus: true },\n})\nexport class LmvzButton extends ReactiveControllerHost implements AriaValidationHost, ElementActivationHost {\n @Element() el: HTMLLmvzButtonElement;\n\n private inheritedAttributes: Attributes = {};\n private formEl: HTMLFormElement | null = null;\n private formButtonEl: HTMLButtonElement | null = null;\n\n @Event() lmvzActivation: EventEmitter<void>;\n\n @Prop({ reflect: true, attribute: 'tabindex' }) get ti() {\n return 0;\n }\n\n /**\n * Scale of the button\n * @default 'default'\n */\n @Prop({ reflect: true }) scale: Button.Scale = 'default';\n\n /**\n * Variant of the button\n * @default 'secondary', since the primary button should be marked as such in context\n */\n @Prop({ reflect: true }) variant: Button.Variant = 'secondary';\n\n /**\n * Whether the button is disabled\n * @default false\n */\n @Prop({ reflect: true }) disabled = false;\n\n @Prop() type: 'submit' | 'button' = 'button';\n\n /**\n * The HTML form element or form element id. Used to submit a form when the button is not a child of the form.\n */\n @Prop() form?: FormRef;\n\n constructor() {\n super();\n this.addController(new AriaValidationController(this));\n this.addController(\n new ElementActivationController(this, {\n localHandler: this.handleClick.bind(this),\n keys: ['Enter'],\n }),\n );\n }\n\n connectedCallback(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.el);\n }\n\n /**\n * This renders a hidden native button element inside the associated form.\n * This allows users to submit a form by pressing \"Enter\" when a text\n * field inside of the form is focused, even though our native button is in the Shadow DOM.\n */\n private renderHiddenButton() {\n const formEl = (this.formEl = findFormByRef(this.form, this.el));\n if (!formEl) return;\n\n const { formButtonEl } = this;\n\n // append only once\n if (formButtonEl !== null && formEl.contains(formButtonEl)) return;\n\n const newFormButtonEl = (this.formButtonEl = document.createElement('button'));\n newFormButtonEl.type = 'submit';\n newFormButtonEl.style.display = 'none';\n newFormButtonEl.disabled = this.disabled;\n\n formEl.appendChild(newFormButtonEl);\n }\n\n private submitForm(ev: Event) {\n if (this.formEl && this.formButtonEl) {\n ev.preventDefault();\n this.formButtonEl.click();\n }\n }\n\n private handleClick = (ev: Event) => {\n if (this.type === 'submit') {\n this.submitForm(ev);\n }\n };\n\n render() {\n this.renderHiddenButton();\n\n return (\n <Host aria-disabled={this.disabled ? 'true' : null}>\n <button disabled={this.disabled} class={classNames(this.variant, { [this.scale ?? '']: !!this.scale, disabled: this.disabled })} {...this.inheritedAttributes}>\n <slot></slot>\n </button>\n </Host>\n );\n }\n}\n","import { canReceiveFocus, getDeepActiveElement } from './component';\nimport type { ReactiveController } from './reactive-controller-host';\n\nexport type ListKeyboardNavigationHost = {\n el: HTMLElement;\n};\n\n// type Config = {};\n\nexport class ListKeyboardNavigationController implements ReactiveController {\n private elements: Element[] = [];\n\n constructor(\n private readonly host: ListKeyboardNavigationHost,\n // private readonly config?: Config,\n ) {}\n\n hostDidRender() {\n this.host.el.addEventListener('keydown', this.handleKeydown);\n }\n\n updateElements(elements: Element[]) {\n this.elements = elements;\n }\n\n private handleKeydown = (event: KeyboardEvent) => {\n const { key } = event;\n if (!['ArrowDown', 'ArrowRight', 'ArrowUp', 'ArrowLeft'].includes(key)) return;\n\n const activeElement = getDeepActiveElement(document);\n const nextElement = this.getNextFocusableElement(activeElement, ['ArrowDown', 'ArrowRight'].includes(key) ? 'down' : 'up');\n if (nextElement) {\n event.preventDefault();\n (nextElement as HTMLElement).focus?.();\n }\n };\n\n private getNextFocusableElement(current: Element, direction: 'down' | 'up'): Element | null {\n const { elements } = this;\n const currentIndex = elements.indexOf(current);\n if (currentIndex === -1) return null;\n\n let nextIndex: number | null = null;\n if (direction === 'down') {\n nextIndex = (currentIndex + 1) % elements.length;\n } else if (direction === 'up') {\n nextIndex = (currentIndex - 1 + elements.length) % elements.length;\n }\n\n if (nextIndex == null) return null;\n\n const candidate = elements[nextIndex];\n if (!canReceiveFocus(candidate)) return this.getNextFocusableElement(candidate, direction);\n\n return candidate;\n }\n}\n","/* @import url('../../styles/internal/define-layers.css'); */\n\n:host {\n display: flex;\n /* TODO: why does it overflow on smaller screens? */\n width: 100vw;\n flex-direction: row;\n align-items: center;\n box-sizing: border-box;\n\n background-color: var(--lmvz-semantic-color-surface-primary);\n\n --lmvz-header-x-spacing-level-1: var(--lmvz-dimension-8-28);\n --lmvz-header-x-spacing-level-2: var(--lmvz-component-buttongroup-wrapper-gap-x);\n\n padding: var(--lmvz-dimension-8-16) var(--lmvz-header-x-spacing-level-1);\n gap: var(--lmvz-header-x-spacing-level-1);\n\n .brand {\n /* min-width: var(--lmvz-dimension-48-96); */\n display: inline-flex;\n justify-content: center;\n align-items: center;\n }\n\n #fallback-logo-lmvz {\n height: 34px;\n width: auto;\n }\n\n nav {\n flex-grow: 1;\n }\n\n .primary-menubar {\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n .secondary-menubar {\n display: flex;\n flex-direction: row;\n align-items: center;\n /* gap: var(--lmvz-component-buttongroup-wrapper-gap-x); */\n margin-left: var(--lmvz-header-x-spacing-level-2);\n padding-left: var(--lmvz-header-x-spacing-level-2);\n border-left: 1px solid var(--lmvz-semantic-color-border-default);\n }\n}\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { ListKeyboardNavigationController, type ListKeyboardNavigationHost } from '../../utils/list-keyboard-controller';\nimport { ReactiveControllerHost } from '../../utils/reactive-controller-host';\nimport { AriaValidationController, type AriaValidationHost } from '../../utils/validation/aria-validation-controller';\n\n/**\n * An accessible, application-style navigation header component, that renders two connected levels of navigation.\n *\n * @slot brand - The branding area, typically containing a logo and/or site title.\n *\n * @slot nav-primary - The first level of the navigation.\n * This is required and must only contain <lmvz-menuitem> elements.\n * Each menuitem should have an id, which will be used to link it to the corresponding secondary nav items.\n *\n * @slot connect-nav-`lmvzActiveNav` - The second level of the navigation. This is optional and must also contain <lmvz-menuitem> elements.\n * Only if the secondary nav items' `slot=\"${name}\"` matches \"connect-nav-`lmvzActiveNav`\"\n * (including lmvzActiveNav from the component's props),\n * then these secondary items will be displayed in the second level navigation.\n *\n * @slot actions - An optional slot for actions, such as user profile, settings, logout, etc. This content is aligned to the right side of the header.\n */\n@Component({\n tag: 'lmvz-header',\n styleUrl: './lmvz-header.css',\n shadow: true,\n})\nexport class LmvzHeader extends ReactiveControllerHost implements AriaValidationHost, ListKeyboardNavigationHost {\n @Element() readonly el!: HTMLElement;\n\n private primarySlot!: HTMLSlotElement;\n private secondarySlot!: HTMLSlotElement;\n private secondaryNav!: HTMLElement;\n\n private keyboardNavigationController = new ListKeyboardNavigationController(this);\n\n private get primaryMenuitems() {\n return this.primarySlot.assignedElements({ flatten: false });\n }\n\n private get secondaryMenuitems() {\n return this.secondarySlot.assignedElements({ flatten: true });\n }\n\n @Prop({ reflect: true }) get role() {\n return 'banner';\n }\n\n @Prop() lmvzActiveNav?: string;\n\n get secondarySlotName() {\n return `connect-nav-${this.lmvzActiveNav}`;\n }\n\n constructor() {\n super();\n this.addController(new AriaValidationController(this, { reValidateOnPropChanges: true }));\n this.addController(this.keyboardNavigationController);\n }\n\n @Watch('lmvzActiveNav')\n handleActiveNavChange() {\n this.updateElementsActive();\n }\n\n componentDidLoad() {\n this.primarySlot.addEventListener('slotchange', this.handlePrimaryNavChange.bind(this));\n this.handlePrimaryNavChange(); // initial check for already assigned elements\n this.secondarySlot.addEventListener('slotchange', this.handleSecondaryNavChange.bind(this));\n }\n\n private handlePrimaryNavChange() {\n const items = this.primaryMenuitems;\n if (!items.length) {\n console.warn('Primary slot has no assigned elements. Please add navigation items to the primary slot.');\n return;\n }\n\n items.forEach(el => {\n el.setAttribute('aria-haspopup', 'true');\n el.setAttribute('aria-controls', `nav-secondary`);\n });\n this.updateElementsActive();\n }\n\n private handleSecondaryNavChange() {\n const items = this.secondaryMenuitems;\n if (!items.length) {\n // It's valid to have no secondary items for a given primary item, so we just return early without warning\n return;\n }\n this.keyboardNavigationController.updateElements([...this.primaryMenuitems, ...this.secondaryMenuitems]);\n }\n\n private updateElementsActive() {\n const items = this.primaryMenuitems;\n let label: string;\n items.forEach(el => {\n const isActive = el.id === this.lmvzActiveNav;\n if (isActive) label = el.textContent || el.id;\n el.setAttribute('aria-expanded', isActive ? 'true' : 'false');\n });\n\n this.secondaryNav.setAttribute('aria-label', `Untermenü für ${label}`);\n }\n\n private delegateFocus() {\n // If the header itself receives focus, delegate it to the first focusable element in the primary nav\n const firstFocusable = this.primaryMenuitems[0] as HTMLElement | undefined;\n if (firstFocusable) {\n firstFocusable.focus();\n }\n }\n\n render() {\n return (\n <Host onFocus={this.delegateFocus.bind(this)}>\n <div class=\"brand\">\n <slot name=\"brand\">\n <lmvz-icon id=\"fallback-logo-lmvz\" icon=\"Logo\" size=\"inherit\" aria-label=\"Lehrmittelverlag Zürich\"></lmvz-icon>\n </slot>\n {/* brand image, title, etc. */}\n </div>\n\n <nav aria-label=\"Hauptnavigation\">\n <div role=\"menubar\" class=\"primary-menubar\">\n <slot name=\"nav-primary\" ref={el => (this.primarySlot = el)}></slot>\n\n <separator></separator>\n\n <div role=\"menu\" id=\"nav-secondary\" class=\"secondary-menubar\" hidden={!this.lmvzActiveNav} ref={el => (this.secondaryNav = el)}>\n <slot name={this.secondarySlotName} ref={el => (this.secondarySlot = el)}></slot>\n </div>\n </div>\n </nav>\n\n <div class=\"actions\">\n <slot name=\"actions\"></slot>\n {/* user avatar, name, settings, etc. */}\n </div>\n </Host>\n );\n }\n}\n",":host {\n /**\n * @prop --lmvz-icon-color: The icon's color. This is inferred from the context (e.g. button) but can be overridden if needed, or when the icon is used standalone.\n */\n --lmvz-icon-color: var(--lmvz-component-color, var(--lmvz-semantic-color-on-surface-input-primary));\n\n display: inline-block;\n\n /* prevent additional whitespace */\n line-height: 0;\n\n svg {\n display: block;\n }\n\n svg > path {\n stroke: var(--lmvz-icon-color);\n fill: none;\n }\n}\n\n:host([size='xs']) {\n svg {\n width: var(--lmvz-component-icon-size-xs);\n height: var(--lmvz-component-icon-size-xs);\n }\n}\n:host([size='sm']) {\n svg {\n width: var(--lmvz-component-icon-size-sm);\n height: var(--lmvz-component-icon-size-sm);\n }\n}\n:host([size='md']) {\n svg {\n width: var(--lmvz-component-icon-size-md);\n height: var(--lmvz-component-icon-size-md);\n }\n}\n:host([size='lg']) {\n svg {\n width: var(--lmvz-component-icon-size-lg);\n height: var(--lmvz-component-icon-size-lg);\n }\n}\n:host([size='inherit']) {\n svg {\n width: inherit;\n height: inherit;\n }\n}\n\n:host([weight='light']) {\n svg > path {\n stroke-width: 1;\n }\n}\n:host([weight='medium']) {\n svg > path {\n /* TODO: use semantic token */\n stroke-width: 1.5;\n }\n}\n:host([weight='bold']) {\n svg > path {\n /* TODO: use semantic token */\n stroke-width: 2;\n }\n}\n:host([weight='filled']) {\n svg > path {\n stroke-width: 2;\n fill: var(--lmvz-icon-color);\n }\n}\n","import { Build, Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { Effect } from 'effect';\nimport { Icon } from '../../api';\nimport { ReactiveControllerHost } from '../../utils/reactive-controller-host';\nimport { AriaValidationController, type AriaValidationHost } from '../../utils/validation/aria-validation-controller';\nimport { emptyDefaultSvg, fetchIconSvg, IconData } from './icons';\n\n/**\n * `lmvz-icon` is a web component that lazy-loads and displays an SVG icon from our predefined icon set.\n * It uses an IntersectionObserver to defer loading the icon until it becomes visible in the viewport. Once loaded, icon data is cached across instances.\n */\n@Component({\n tag: 'lmvz-icon',\n styleUrl: 'lmvz-icon.css',\n scoped: true,\n assetsDirs: ['../../assets/icons'],\n})\nexport class LmvzIcon extends ReactiveControllerHost implements AriaValidationHost {\n private intersectionObserver: IntersectionObserver;\n\n @Element() el!: HTMLElement;\n\n /**\n * The name of the icon to display (required).\n */\n @Prop({ reflect: true }) icon!: Icon.IconName;\n\n /**\n * The weight/style of the icon (optional, default is 'medium').\n */\n @Prop({ reflect: true }) weight?: Icon.IconWeight = 'medium';\n\n /**\n * The size of the icon (optional, default is 'md').\n */\n @Prop({ reflect: true }) size?: Icon.Size = 'md';\n\n @State() private iconData: IconData;\n @State() private visible = false;\n\n @Prop({ reflect: true }) ariaLabel?: string;\n\n private get ariaHidden() {\n return !this.ariaLabel;\n }\n\n constructor() {\n super();\n this.addController(new AriaValidationController(this));\n }\n\n connectedCallback() {\n this.waitUntilVisible(() => {\n this.visible = true;\n this.loadIconPathData();\n });\n }\n\n disconnectedCallback() {\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n this.intersectionObserver = null;\n }\n }\n\n @Watch('icon')\n private async loadIconPathData() {\n const { icon, visible } = this;\n\n if (!Build.isBrowser || !icon || !visible) {\n return;\n }\n this.iconData = await Effect.runPromise(\n fetchIconSvg(this.icon).pipe(\n Effect.tapError(error => Effect.logError(`Error loading icon \"${icon}\":`, error.message, error.cause, error.stack)),\n Effect.catchAll(() => Effect.succeed(emptyDefaultSvg())),\n ),\n );\n }\n\n render() {\n return <Host role=\"img\" aria-hidden={`${this.ariaHidden}`} innerHTML={this.iconData}></Host>;\n }\n\n private waitUntilVisible(callback: () => unknown, rootMargin = 50) {\n if (!Build.isBrowser || typeof window === 'undefined' || !window.IntersectionObserver) {\n callback();\n return;\n }\n\n this.intersectionObserver = new IntersectionObserver(\n entries => {\n entries.some(entry => {\n if (entry.isIntersecting) {\n this.intersectionObserver.disconnect();\n this.intersectionObserver = null;\n callback();\n return true;\n }\n return false;\n });\n },\n { rootMargin: `${rootMargin}px` },\n );\n\n this.intersectionObserver.observe(this.el);\n }\n}\n","@import url('../../styles/internal/define-layers.css');\n@import url('../../styles/fragments/_routerFont.css') layer(lmvz-ds.theme);\n\n:host {\n display: block;\n font-family: var(--lmvz-global-font-family-default);\n /* Component Variables Mapping */\n --input-radius: var(--lmvz-component-input-radius-default);\n --input-bg: var(--lmvz-semantic-color-surface-input-primary);\n --input-border-color: var(--lmvz-semantic-color-border-default);\n --input-border-color-hover: var(--lmvz-semantic-color-border-hover);\n --input-border-color-focus: var(--lmvz-semantic-color-status-on-selected);\n --input-border-width: var(--lmvz-semantic-border-width-default);\n --input-height: 48px; /* From Figma input-size=48 */\n --input-padding-x: 16px;\n\n --label-color: var(--lmvz-semantic-color-on-surface-input-secondary);\n --input-text-color: var(--lmvz-semantic-color-on-surface-input-primary);\n --helper-text-color: var(--lmvz-semantic-color-on-surface-input-secondary);\n --error-text-color: var(--lmvz-semantic-color-status-on-danger);\n\n --label-floating-scale: 0.85; /* 14px -> 12px approx */\n --label-minimized-top: -6px;\n --label-minimized-bg: var(--input-bg);\n --label-minimized-padding-x: 4px;\n\n /* Disabled state uses opacity token */\n --input-disabled-opacity: var(--lmvz-component-input-disabled-opacity);\n}\n\n.input-container {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n}\n\n.input-wrapper {\n background-color: var(--input-bg);\n border: var(--input-border-width) solid var(--input-border-color);\n border-radius: var(--input-radius);\n display: flex;\n align-items: center;\n height: var(--input-height);\n padding: 0 var(--input-padding-x);\n position: relative;\n transition: border-color 0.2s ease;\n gap: 8px; /* input-gap-x */\n}\n\n:host([disabled]) .input-wrapper {\n opacity: var(--input-disabled-opacity);\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.input-container:focus-within .input-wrapper {\n border-color: var(--input-border-color-focus);\n outline: 2px solid var(--input-border-color-focus);\n outline-offset: 2px;\n}\n\n/* Enhanced focus indicator for keyboard users */\n.input-container:has(input:focus-visible) .input-wrapper {\n box-shadow: 0 0 0 3px rgb(0 86 214 / 20%);\n}\n\n/* Error State */\n:host([error]) .input-wrapper {\n border-color: var(--error-text-color);\n}\n\n:host([error]):focus-within .input-wrapper {\n border-color: var(--error-text-color);\n outline-color: var(--error-text-color);\n}\n\n/* Hover State - Use CSS pseudo-selector instead of class */\n:host(:not([disabled])) .input-wrapper:hover {\n border-color: var(--input-border-color-hover);\n}\n\n.label-input-group {\n position: relative;\n flex-grow: 1;\n display: flex;\n align-items: center;\n height: 100%;\n}\n\nlabel {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n color: var(--label-color);\n font-size: 14px; /* body-md size from Figma */\n font-family: Router, sans-serif;\n font-weight: 400;\n pointer-events: none;\n transition: all 0.2s ease-out;\n background-color: transparent;\n padding: 0;\n margin: 0;\n line-height: normal;\n white-space: nowrap;\n}\n\nlabel.floating {\n top: 0; /* Align to top border area */\n transform: translateY(-50%) scale(0.85); /* Scale down */\n transform-origin: left top;\n background-color: var(--label-minimized-bg);\n padding: 0 var(--label-minimized-padding-x);\n left: -2px; /* Adjust for padding/border visual alignment */\n color: var(--input-text-color); /* Darker when floating */\n font-weight: 500; /* Medium weight when minimized */\n}\n\n.required-indicator {\n color: var(--error-text-color);\n margin-left: 2px;\n}\n\ninput {\n border: none;\n background: transparent;\n width: 100%;\n height: 100%;\n color: var(--input-text-color);\n font-family: inherit;\n font-size: 14px;\n outline: none;\n padding: 0;\n margin: 0;\n font-weight: 400; /* Regular weight */\n}\n\ninput::placeholder {\n color: var(--label-color);\n}\n\n.helper-text {\n padding-top: 8px; /* space-gap-component-input-helper-text */\n padding-left: 12px; /* input-md-padding-x for helper text indent */\n font-size: 12px;\n color: var(--helper-text-color);\n font-family: Router, sans-serif;\n font-weight: 500; /* Medium weight */\n}\n\n.error-message {\n padding-top: 8px;\n padding-left: 12px;\n font-size: 12px;\n color: var(--error-text-color);\n font-family: Router, sans-serif;\n font-weight: 500;\n}\n\n::slotted(lmvz-button) {\n /* Minimize padding for (icon) buttons due to height constraints */\n --lmvz-button-padding: 4px;\n}\n","import { AttachInternals, Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport classNames from 'classnames';\nimport { Input } from '../../api';\nimport { componentOnReady } from '../../utils/component';\nimport { ReactiveControllerHost } from '../../utils/reactive-controller-host';\nimport { AriaValidationController, type AriaValidationHost } from '../../utils/validation/aria-validation-controller';\n\nlet inputIdCounter = 0;\n\n/**\n * Input component with floating label, (form) validation, and slotted content support.\n *\n * @example\n * ```html\n * <lmvz-input\n * label=\"Email\"\n * type=\"email\"\n * required\n * autocomplete=\"email\"\n * helper-text=\"We'll never share your email\"\n * ></lmvz-input>\n * ```\n *\n * @example\n * ```typescript\n * const input = document.querySelector('lmvz-input');\n * input.addEventListener('input', (e) => console.log(e.target.value));\n * await input.focus();\n * ```\n *\n * @slot before-input - Content to the left of the input. If interactive (e.g., clear button), use an lmvz-button element.\n * Example: <lmvz-button slot=\"before-input\" aria-label=\"Clear input\" tabindex=\"0\"><lmvz-icon icon=\"close-sm\"></lmvz-icon></lmvz-button>\n * @slot after-input - Content to the right of the input. If interactive (e.g., password toggle), use an lmvz-button element.\n * Example: <lmvz-button slot=\"after-input\" aria-label=\"Toggle password visibility\" tabindex=\"0\"><lmvz-icon icon=\"eye\"></lmvz-icon></lmvz-button>\n */\n@Component({\n tag: 'lmvz-input',\n styleUrl: './lmvz-input.css',\n scoped: true,\n formAssociated: true,\n})\nexport class LmvzInput extends ReactiveControllerHost implements AriaValidationHost {\n @Element() el!: HTMLElement;\n @Event() lmvzInput: EventEmitter<string>;\n\n @AttachInternals() internals: ElementInternals;\n\n private nativeInputElement?: HTMLInputElement;\n private inputId = `lmvz-input-${inputIdCounter++}`;\n private initialValue = '';\n\n /**\n * Internal state tracking native validation\n */\n @State() private nativeError = false;\n\n /**\n * Track if error was manually set via prop\n */\n private errorFromProp = false;\n\n private get helperId(): string | undefined {\n return this.helperText ? `${this.inputId}-helper` : undefined;\n }\n\n private get showErrorMessage() {\n return this.error && Boolean(this.errorMessage);\n }\n\n private get errorId(): string {\n return `${this.inputId}-error`;\n }\n\n /**\n * reactively updated via depedency of `error`\n */\n private get describedBy(): string | undefined {\n const ids: string[] = [];\n if (this.helperId) ids.push(this.helperId);\n if (this.showErrorMessage) ids.push(this.errorId);\n return ids.length > 0 ? ids.join(' ') : undefined;\n }\n\n /**\n * * PUBLIC API\n */\n\n /**\n * Value of the input\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Label text for the input\n */\n @Prop() label!: string;\n\n /**\n * Helper text displayed below the input\n */\n @Prop() helperText?: string;\n\n /**\n * Placeholder text\n */\n @Prop() placeholder?: string;\n\n /**\n * Whether the input is disabled\n * @default false\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * Whether the input is readonly\n * @default false\n */\n @Prop({ reflect: true }) readonly = false;\n\n /**\n * Whether the input is required\n * @default false\n */\n @Prop({ reflect: true }) required = false;\n\n /**\n * Name attribute for the input\n */\n @Prop() name?: string;\n\n /**\n * Type of the input\n * @default 'text'\n */\n @Prop() type: Input.Type = 'text';\n\n /**\n * Error message to display when error is true\n */\n @Prop() errorMessage?: string;\n\n /**\n * Autocomplete attribute for form autofill\n */\n @Prop() autocomplete?: Input.Autocomplete;\n\n /**\n * Input mode for mobile keyboards\n */\n @Prop() inputmode?: Input.Inputmode;\n\n /**\n * Autocorrect attribute for mobile keyboards\n * @default undefined\n */\n @Prop() autocorrect?: 'on' | 'off';\n\n /**\n * Autocapitalize attribute for mobile keyboards\n * @default undefined\n */\n @Prop() autocapitalize?: Input.Autocapitalize;\n\n /**\n * Spellcheck attribute\n * @default undefined\n */\n @Prop() spellcheck?: boolean;\n\n /**\n * Whether the input should autofocus\n * @default false\n */\n @Prop() autofocus = false;\n\n /**\n * Minimum length for text inputs\n */\n @Prop() minlength?: number;\n\n /**\n * Maximum length for text inputs\n */\n @Prop() maxlength?: number;\n\n /**\n * Validation pattern (regex)\n */\n @Prop() pattern?: string;\n\n /**\n * Minimum value for number/date inputs\n */\n @Prop() min?: number | string;\n\n /**\n * Maximum value for number/date inputs\n */\n @Prop() max?: number | string;\n\n /**\n * Step interval for number inputs\n */\n @Prop() step?: number | string;\n\n /**\n * Form id to associate with\n */\n @Prop() form?: string;\n\n /**\n * Whether the input is in an error state\n * When not set manually, this will automatically reflect native HTML5 validation state\n * @default false\n */\n @Prop({ reflect: true })\n get error(): boolean {\n return this.errorFromProp || this.nativeError;\n }\n set error(value: boolean) {\n this.errorFromProp = value;\n }\n\n @Method()\n async setValue(newValue: string | undefined) {\n const input = this.nativeInputElement;\n this.value = input.value = newValue ?? '';\n this.internals.setFormValue?.(newValue); // undefined in stencil test environment\n this.lmvzInput.emit(newValue);\n }\n\n /**\n * Sets focus on the input\n */\n @Method()\n async focusInput() {\n this.nativeInputElement?.focus();\n }\n\n /**\n * Removes focus from the input\n */\n @Method()\n async blurInput() {\n this.nativeInputElement?.blur();\n }\n\n /**\n * Selects the text in the input\n */\n @Method()\n async select() {\n this.nativeInputElement?.select();\n }\n\n /**\n * Returns whether the input satisfies its validation constraints\n */\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.nativeInputElement?.checkValidity?.() ?? false;\n }\n\n /**\n * Reports validation errors to the user\n */\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.nativeInputElement?.reportValidity?.() ?? false;\n }\n\n /**\n * Returns the native HTMLInputElement.\n *\n * Promise resolves when the element is ready and the input is available. If the input is not yet rendered, it waits for the component to be ready.\n */\n @Method()\n async getInputElement(): Promise<HTMLInputElement> {\n if (!this.nativeInputElement) {\n await new Promise(resolve => componentOnReady(this.el, resolve));\n }\n return Promise.resolve(this.nativeInputElement);\n }\n\n /**\n * * Lifecycle & Reactivity\n */\n\n constructor() {\n super();\n this.addController(\n new AriaValidationController(this, {\n reValidateOnPropChanges: true,\n }),\n );\n }\n\n componentWillLoad() {\n this.initialValue = this.value;\n }\n\n formAssociatedCallback(form: HTMLFormElement | undefined) {\n if (!form) return;\n this.internals.setFormValue?.(this.value); // undefined in stencil test environment\n }\n\n formResetCallback() {\n this.internals.setValidity({});\n this.setValue(this.initialValue);\n }\n\n formStateRestoreCallback(state: string) {\n this.setValue(state);\n }\n\n @Watch('value')\n protected handleValueChange(newValue: string | undefined) {\n if (!this.nativeInputElement) return;\n\n const isInternalChange = this.nativeInputElement.value === newValue;\n if (isInternalChange) return;\n\n this.setValue(newValue);\n }\n\n @Watch('disabled')\n protected handleDisabledChange(disabled: boolean) {\n if (disabled && this.nativeInputElement) {\n this.nativeInputElement.blur();\n }\n }\n\n /**\n * Fires whenever the input changes\n */\n private handleInput = (event: InputEvent) => {\n const input = event.target as HTMLInputElement;\n\n this.setValue(input.value);\n };\n\n /**\n * Fires when value changes and input loses focus.\n */\n private handleChange = (event: InputEvent) => {\n const input = (event.target as HTMLInputElement) ?? this.nativeInputElement;\n this.updateNativeError(input);\n };\n\n private handleFocus = () => {};\n\n /**\n * Fires when the input loses focus\n */\n private handleBlur = (event: FocusEvent) => {\n const input = event.target as HTMLInputElement;\n input.reportValidity?.();\n };\n\n /**\n * Updates the nativeError state based on the validity of the input.\n * validity may not exist in test environments\n */\n private updateNativeError(fromEvent?: HTMLInputElement) {\n const input = fromEvent ?? this.nativeInputElement;\n if (!input) return;\n this.nativeError = !(input.checkValidity?.() ?? true);\n }\n\n render() {\n const hasValue = Boolean(this.value);\n const shouldFloatLabel = hasValue || Boolean(this.placeholder);\n\n return (\n <div\n class={classNames('input-container', {\n 'interaction-filled': hasValue,\n })}\n >\n <div class=\"input-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div class=\"label-input-group\">\n <label htmlFor={this.inputId} class={classNames({ floating: shouldFloatLabel })}>\n {this.label}\n {this.required && (\n <span class=\"required-indicator\" aria-hidden=\"true\">\n {' '}\n *\n </span>\n )}\n </label>\n <input\n id={this.inputId}\n ref={el => (this.nativeInputElement = el)}\n type={this.type}\n min={this.min}\n max={this.max}\n step={this.step}\n value={this.value}\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n form={this.form}\n autocomplete={this.autocomplete}\n inputmode={this.inputmode}\n autocorrect={this.autocorrect}\n autocapitalize={this.autocapitalize}\n spellcheck={this.spellcheck}\n autofocus={this.autofocus}\n minlength={this.minlength}\n maxlength={this.maxlength}\n pattern={this.pattern}\n aria-invalid={this.error ? 'true' : 'false'}\n aria-required={this.required ? 'true' : 'false'}\n aria-describedby={this.describedBy}\n aria-errormessage={this.errorId}\n onInput={this.handleInput}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n {this.helperText && (\n <div id={this.helperId} class=\"helper-text\">\n {this.helperText}\n </div>\n )}\n\n {this.showErrorMessage && (\n <div id={this.errorId} class=\"error-message\" role=\"alert\">\n {this.errorMessage}\n </div>\n )}\n </div>\n );\n }\n}\n","@import url('../../styles/internal/define-layers.css');\n@import url('../../styles/fragments/_routerFont.css') layer(lmvz-ds.theme);\n\n:host {\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n gap: var(--lmvz-component-input-md-gap-x);\n border-radius: var(--lmvz-semantic-border-radius-lg);\n font: var(--lmvz-typography-body-md);\n padding: var(--lmvz-component-input-md-padding-y) var(--lmvz-component-input-md-padding-x);\n cursor: pointer;\n\n --lmvz-menuitem-color: var(--lmvz-semantic-color-int-on-tertiary);\n --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary);\n\n background: var(--lmvz-menuitem-background);\n color: var(--lmvz-menuitem-color);\n}\n\n:host(:hover) {\n --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-hover);\n}\n\n:host(:active) {\n --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-active);\n}\n:host(:focus-visible) {\n /* work around siblings overlapping outline */\n z-index: 1;\n}\n\n:host([aria-expanded='true']) {\n --lmvz-menuitem-background: var(--lmvz-semantic-color-status-selected);\n --lmvz-menuitem-color: var(--lmvz-semantic-color-status-on-selected);\n}\n","import { Component, Element, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { ElementActivationController, type ElementActivationHost } from '../../utils/element-activation-controller';\nimport { ReactiveControllerHost } from '../../utils/reactive-controller-host';\nimport { AriaValidationController, type AriaValidationHost } from '../../utils/validation/aria-validation-controller';\n\n/**\n * A menu item component to be used within the `lmvz-header` component's navigation slots.\n */\n@Component({\n tag: 'lmvz-menuitem',\n styleUrl: './lmvz-menuitem.css',\n scoped: true,\n})\nexport class LmvzMenuItem extends ReactiveControllerHost implements AriaValidationHost, ElementActivationHost {\n @Element() el!: HTMLElement;\n\n @Prop({ reflect: true }) get role() {\n return 'menuitem';\n }\n @Prop({ reflect: true, attribute: 'tabindex' }) get ti() {\n return 0;\n }\n\n @Event() lmvzActivation: EventEmitter<void>;\n\n constructor() {\n super();\n this.addController(new AriaValidationController(this));\n this.addController(new ElementActivationController(this));\n }\n\n render() {\n return (\n <Host>\n <slot>{/* The content of the menu item will be provided by the user */}</slot>\n </Host>\n );\n }\n}\n"],"names":["make","internal.make","internal.get","internal.modify","internal.update","fail","internal.fail","internal.die","interrupt","internal.interrupt","internal.isDieType","internal.isInterrupted","internal.isInterruptedOnly","internal.interruptors","internal.failureOrCause","internal.flipCauseOption","map","internal.map","internal._await","internal.inheritAll","core.interruptFiber","core.interruptAsFiber","internal.join","Effectable.Class","core.suspend","core.catchAll","core.interrupt","MutableRef.get","Option.none","Option.some","MutableQueue.length","core.map","core.uninterruptible","core.withFiberRuntime","MutableRef.set","fiberRuntime.forEachConcurrentDiscard","core.deferredInterruptWith","core.zipRight","core.whenEffect","core.deferredSucceed","core.asVoid","core.sync","core.deferredAwait","MutableQueue.poll","MutableQueue.EmptyMutableQueue","core.succeed","Arr.fromIterable","Arr.empty","Arr.splitAt","Chunk.isEmpty","core.deferredUnsafeMake","MutableQueue.offer","core.onInterrupt","Chunk.fromIterable","Chunk.empty","core.flatMap","take","Chunk.appendAll","Chunk.append","bounded","MutableQueue.bounded","unbounded","MutableQueue.unbounded","core.deferredMake","MutableRef.make","MutableQueue.pollUpTo","MutableQueue.offerAll","MutableQueue.capacity","size","isShutdown","shutdown","offer","takeBetween","MutableQueue.isEmpty","core.fiberId","core.void","Chunk.prepend","Chunk.filter","core.deferredUnsafeDone","internal.bounded","internal.unbounded","internal.size","internal.isShutdown","internal.shutdown","internal.offer","internal.take","internal.takeBetween","proto","OpCodes.OP_CONTINUE","OpCodes.OP_CONTINUATION_K","Exit.isFailure","OpCodes.OP_CONTINUATION_FINALIZER","OpCodes.OP_PULL_AFTER_NEXT","OP_EMIT","OP_FROM_EFFECT","OP_READ","Effect.isEffect","OpCodes.OP_BRACKET_OUT","OpCodes.OP_CONCAT_ALL","upstreamPullStrategy.PullAfterNext","childExecutorDecision.Continue","OpCodes.OP_BRIDGE","OpCodes.OP_ENSURING","failCause","Cause.fail","OpCodes.OP_FAIL","flatMap","OpCodes.OP_FOLD","fromEffect","OpCodes.OP_FROM_EFFECT","OpCodes.OP_PIPE_TO","Either.match","Cause.failureOrCause","OpCodes.OP_READ","OpCodes.OP_SUCCEED_NOW","suspend","OpCodes.OP_SUSPEND","OpCodes.OP_SUCCEED","OpCodes.OP_EMIT","OP_DONE","OpCodes.OP_DONE","Emit","Effect.void","Effect.ignore","exit","Effect.zipWith","Effect.exit","Exit.zipRight","OpCodes.OP_PULLED","OpCodes.OP_NO_UPSTREAM","ChannelState.Done","core.fromEffect","ChannelOpCodes.OP_BRACKET_OUT","ChannelOpCodes.OP_BRIDGE","Effect.flatMap","Effect.suspend","ChannelStateOpCodes.OP_DONE","Exit.match","ChannelStateOpCodes.OP_EMIT","ChannelStateOpCodes.OP_FROM_EFFECT","Effect.matchCauseEffect","ChannelStateOpCodes.OP_READ","ChannelState.fromEffect","Effect.forkDaemon","Effect.interruptible","Effect.sync","Fiber.interrupt","ChannelOpCodes.OP_CONCAT_ALL","Effect.zipRight","Subexecutor.PullFromUpstream","ChannelOpCodes.OP_EMIT","ChannelState.Emit","ChannelOpCodes.OP_ENSURING","ChannelOpCodes.OP_FAIL","ChannelOpCodes.OP_FOLD","ChannelOpCodes.OP_FROM_EFFECT","Effect.provide","ChannelState.isFromEffect","ChannelOpCodes.OP_PIPE_TO","ChannelOpCodes.OP_PROVIDE","ChannelOpCodes.OP_READ","ChannelState.Read","Exit.die","ChannelOpCodes.OP_SUCCEED","ChannelOpCodes.OP_SUCCEED_NOW","ChannelOpCodes.OP_SUSPEND","core.failCause","Cause.die","ContinuationOpCodes.OP_CONTINUATION_K","Effect.ensuring","Effect.zip","Effect.map","Effect.uninterruptible","Exit.succeed","Exit.failCause","core.write","Continuation.ContinuationFinalizerImpl","Subexecutor.OP_PULL_FROM_CHILD","Subexecutor.OP_PULL_FROM_UPSTREAM","Subexecutor.OP_DRAIN_CHILD_EXECUTORS","Subexecutor.OP_EMIT","ChannelState.effect","Effect.forEach","UpstreamPullStrategyOpCodes.OP_PULL_AFTER_NEXT","UpstreamPullStrategyOpCodes.OP_PULL_AFTER_ALL_ENQUEUED","ChildExecutorDecisionOpCodes.OP_CONTINUE","ChildExecutorDecisionOpCodes.OP_CLOSE","ChildExecutorDecisionOpCodes.OP_YIELD","Subexecutor.Emit","ChannelState.effectOrUndefinedIgnored","Subexecutor.DrainChildExecutors","Subexecutor.PullFromChild","upstreamPullRequest.Pulled","Option.isSome","Exit.map","Effect.succeed","upstreamPullRequest.NoUpstream","Exit.all","Option.getOrElse","Exit.void","Effect.dieMessage","Effect.catchAllCause","Effect.acquireUseRelease","Effect.intoDeferred","Deferred.await","Effect.zipLeft","Effect.tapErrorCause","Scope.addFinalizer","Effect.failCause","Effect.uninterruptibleMask","Effect.all","Scope.fork","ExecutionStrategy.sequential","Deferred.make","Effect.forkIn","interruptors","Cause.interruptors","Deferred.isDone","Deferred.succeed","Fiber.await","Fiber.inheritAll","HashSet.size","Fiber.interruptAs","FiberId.combineAll","OpCodes.OP_AWAIT","OpCodes.OP_BOTH_RUNNING","OpCodes.OP_LEFT_DONE","OpCodes.OP_RIGHT_DONE","OpCodes.OP_BACK_PRESSURE","OpCodes.OP_BUFFER_SLIDING","Effect.flatten","Ref.modify","Effect.fiberIdWith","Cause.interrupt","Either.left","Effect.interrupt","Either.right","Deferred.failCause","Cause.map","Exit.fail","Effect.matchCause","Ref.make","core.concatMapWith","drain","core.readWithCause","core.pipeTo","ensuring","core.ensuringWith","flatten","core.readWith","core.fail","core.succeedNow","unwrapScopedWith","Effect.gen","singleProducerAsyncInput.make","Queue.bounded","Queue.shutdown","Effect.makeSemaphore","Queue.offer","Effect.asVoid","Effect.raceFirst","Effect.forever","Queue.take","core.embedInput","mergeStrategy_.BackPressure","Queue.unbounded","Effect.as","Effect.repeat","Ref.update","Option.match","Cause.isInterrupted","Effect.raceWith","Ref.get","mergeStrategy_.match","Effect.scopedWith","Effect.race","Queue.size","Effect.when","MergeDecisionOpCodes.OP_DONE","MergeStateOpCodes.OP_BOTH_RUNNING","Fiber.join","mergeState.BothRunning","mergeState.LeftDone","mergeState.RightDone","MergeStateOpCodes.OP_LEFT_DONE","MergeStateOpCodes.OP_RIGHT_DONE","Effect.withFiberRuntime","Cause.isDieType","Equal.equals","run","executor.runIn","runDrain","Scope.make","core.acquireReleaseOut","Scope.extend","Scope.close","scopedWith","Effect.scope","executor.ChannelExecutor","Effect.runtime","Effect.tap","Scope.addFinalizerExit","executor.readUpstream","core.concatAllWith","Chunk.unsafeGet","core.isChannel","mergeDecision.Await","Exit.zip","channel.drain","channel.identityChannel","toChannel","end","Chunk.of","Effect.fail","Effect.mapError","channel.ensuring","channel.concatMap","Chunk.map","Chunk.reduce","channel.zipRight","channel.writeChunk","channel.mergeMap","MergeStrategy.BufferSliding","Chunk.splitWhere","Exit.isSuccess","Chunk.head","Cause.flipCauseOption","Chunk.filterMap","channel.unwrap","Effect.match","fromQueue","Queue.takeBetween","Queue.isShutdown","pull.end","pull.failCause","channel.mapOut","channel.mapOutEffectPar","Effect.catchAll","channel.pipeToOrFail","sink_.toChannel","channel.runDrain","sink_.drain","channel.scopedWith","stream.flatMap","stream.flattenTake","stream.fromQueue","stream.mapEffectSequential","stream.matchConcurrency","stream.fromEffect","stream.mapEffectPar","take.of","take.chunk","Effect.catchSomeCause","Cause.isInterruptedOnly","take.failCause","take.end","stream.unwrapScopedWith","stream.toChannel","channelExecutor.runIn","Chunk.unsafeFromArray","internal.fromQueue","groupBy_.mapEffectOptions","internal.runDrain","Effect.promise","Stream.fromQueue","Stream.mapEffect","Effect.async","Stream.runDrain","Effect.runFork","Effect.runPromise","Effect.tapError","Effect.logError"],"mappings":";;;;;;;;AAMA;AACA;AACA;AACA;AACO,MAAMA,MAAI,GAAGC,MAAa;AACjC;AACA;AACA;AACA;AACO,MAAM,GAAG,GAAGC,KAAY;AAgB/B;AACA;AACA;AACA;AACO,MAAM,MAAM,GAAGC,QAAe;AAgBrC;AACA;AACA;AACA;AACO,MAAM,MAAM,GAAGC,QAAe;;ACwGrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,MAAI,GAAGC,MAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,GAAG,GAAGC,KAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAS,GAAGC,WAAkB;AAwD3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,SAAS,GAAGC,WAAkB;AA+E3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAa,GAAGC,eAAsB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,iBAAiB,GAAGC,mBAA0B;AA2B3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,YAAY,GAAGC,cAAqB;AAcjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,cAAc,GAAGC,gBAAuB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,eAAe,GAAGC,iBAAwB;AAoGvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,KAAG,GAAGC,KAAY;;AC1gB/B,MAAM,MAAM,GAAGC,QAAe;AA6E9B;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,UAAU,GAAGC,YAAmB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,SAAS,GAAGC,cAAmB;AAQ5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAW,GAAGC,gBAAqB;AAkChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,IAAI,GAAGC,MAAa;;ACvLjC;AACA,MAAM,gBAAgB,GAAG,qBAAqB;AAC9C;AACO,MAAM,aAAa,gBAAgB,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;AACtE;AACA,MAAM,gBAAgB,GAAG,qBAAqB;AAC9C;AACO,MAAM,aAAa,gB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