reactor-core-ts 2.1.5 → 3.2.1

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 (269) hide show
  1. package/README.md +927 -651
  2. package/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/defineProperty.js +12 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/toPrimitive.js +14 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/toPropertyKey.js +9 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/typeof.js +11 -0
  6. package/dist/context/context-view.d.ts +31 -0
  7. package/dist/context/context-view.d.ts.map +1 -0
  8. package/dist/context/context-view.js +58 -0
  9. package/dist/context/context-view.js.map +1 -0
  10. package/dist/context/context.d.ts +46 -0
  11. package/dist/context/context.d.ts.map +1 -0
  12. package/dist/context/context.js +125 -0
  13. package/dist/context/context.js.map +1 -0
  14. package/dist/context/types.d.ts +7 -0
  15. package/dist/context/types.d.ts.map +1 -0
  16. package/dist/core/boolean-disposable.d.ts +19 -0
  17. package/dist/core/boolean-disposable.d.ts.map +1 -0
  18. package/dist/core/boolean-disposable.js +37 -0
  19. package/dist/core/boolean-disposable.js.map +1 -0
  20. package/dist/core/composite-disposable.d.ts +21 -0
  21. package/dist/core/composite-disposable.d.ts.map +1 -0
  22. package/dist/core/composite-disposable.js +64 -0
  23. package/dist/core/composite-disposable.js.map +1 -0
  24. package/dist/core/demand.d.ts +9 -0
  25. package/dist/core/demand.d.ts.map +1 -0
  26. package/dist/core/demand.js +21 -0
  27. package/dist/core/demand.js.map +1 -0
  28. package/dist/core/disposables.d.ts +12 -0
  29. package/dist/core/disposables.d.ts.map +1 -0
  30. package/dist/core/disposables.js +37 -0
  31. package/dist/core/disposables.js.map +1 -0
  32. package/dist/core/teardown.d.ts +4 -0
  33. package/dist/core/teardown.d.ts.map +1 -0
  34. package/dist/core/types.d.ts +14 -0
  35. package/dist/core/types.d.ts.map +1 -0
  36. package/dist/errors/classes.d.ts +37 -0
  37. package/dist/errors/classes.d.ts.map +1 -0
  38. package/dist/errors/classes.js +53 -0
  39. package/dist/errors/classes.js.map +1 -0
  40. package/dist/errors/exceptions.d.ts +15 -0
  41. package/dist/errors/exceptions.d.ts.map +1 -0
  42. package/dist/errors/helpers.d.ts +9 -0
  43. package/dist/errors/helpers.d.ts.map +1 -0
  44. package/dist/errors/helpers.js +18 -0
  45. package/dist/errors/helpers.js.map +1 -0
  46. package/dist/index.d.ts +17 -2534
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +8 -2
  49. package/dist/internal/abort.d.ts +5 -0
  50. package/dist/internal/abort.d.ts.map +1 -0
  51. package/dist/internal/abort.js +36 -0
  52. package/dist/internal/abort.js.map +1 -0
  53. package/dist/internal/async-queue.d.ts +48 -0
  54. package/dist/internal/async-queue.d.ts.map +1 -0
  55. package/dist/internal/async-queue.js +187 -0
  56. package/dist/internal/async-queue.js.map +1 -0
  57. package/dist/internal/iterable-terminal.d.ts +12 -0
  58. package/dist/internal/iterable-terminal.d.ts.map +1 -0
  59. package/dist/internal/iterable-terminal.js +49 -0
  60. package/dist/internal/iterable-terminal.js.map +1 -0
  61. package/dist/internal/iterable-transform.d.ts +24 -0
  62. package/dist/internal/iterable-transform.d.ts.map +1 -0
  63. package/dist/internal/iterable-transform.js +159 -0
  64. package/dist/internal/iterable-transform.js.map +1 -0
  65. package/dist/internal/iterable.d.ts +23 -0
  66. package/dist/internal/iterable.d.ts.map +1 -0
  67. package/dist/internal/iterable.js +81 -0
  68. package/dist/internal/iterable.js.map +1 -0
  69. package/dist/internal/microtask.d.ts +7 -0
  70. package/dist/internal/microtask.d.ts.map +1 -0
  71. package/dist/internal/microtask.js +19 -0
  72. package/dist/internal/microtask.js.map +1 -0
  73. package/dist/publisher/browser-sources.d.ts +15 -0
  74. package/dist/publisher/browser-sources.d.ts.map +1 -0
  75. package/dist/publisher/browser-sources.js +92 -0
  76. package/dist/publisher/browser-sources.js.map +1 -0
  77. package/dist/publisher/flux-entrypoint.d.ts +7 -0
  78. package/dist/publisher/flux-entrypoint.d.ts.map +1 -0
  79. package/dist/publisher/flux-entrypoint.js +11 -0
  80. package/dist/publisher/flux-entrypoint.js.map +1 -0
  81. package/dist/publisher/flux.d.ts +121 -0
  82. package/dist/publisher/flux.d.ts.map +1 -0
  83. package/dist/publisher/flux.js +697 -0
  84. package/dist/publisher/flux.js.map +1 -0
  85. package/dist/publisher/helpers.d.ts +19 -0
  86. package/dist/publisher/helpers.d.ts.map +1 -0
  87. package/dist/publisher/helpers.js +84 -0
  88. package/dist/publisher/helpers.js.map +1 -0
  89. package/dist/publisher/mono-entrypoint.d.ts +7 -0
  90. package/dist/publisher/mono-entrypoint.d.ts.map +1 -0
  91. package/dist/publisher/mono-entrypoint.js +11 -0
  92. package/dist/publisher/mono-entrypoint.js.map +1 -0
  93. package/dist/publisher/mono.d.ts +72 -0
  94. package/dist/publisher/mono.d.ts.map +1 -0
  95. package/dist/publisher/mono.js +373 -0
  96. package/dist/publisher/mono.js.map +1 -0
  97. package/dist/publisher/operators/aggregate.d.ts +35 -0
  98. package/dist/publisher/operators/aggregate.d.ts.map +1 -0
  99. package/dist/publisher/operators/aggregate.js +217 -0
  100. package/dist/publisher/operators/aggregate.js.map +1 -0
  101. package/dist/publisher/operators/compat/flux.d.ts +56 -0
  102. package/dist/publisher/operators/compat/flux.d.ts.map +1 -0
  103. package/dist/publisher/operators/compat/flux.js +156 -0
  104. package/dist/publisher/operators/compat/flux.js.map +1 -0
  105. package/dist/publisher/operators/compat/mono.d.ts +82 -0
  106. package/dist/publisher/operators/compat/mono.d.ts.map +1 -0
  107. package/dist/publisher/operators/compat/mono.js +125 -0
  108. package/dist/publisher/operators/compat/mono.js.map +1 -0
  109. package/dist/publisher/operators/coordination.d.ts +82 -0
  110. package/dist/publisher/operators/coordination.d.ts.map +1 -0
  111. package/dist/publisher/operators/coordination.js +345 -0
  112. package/dist/publisher/operators/coordination.js.map +1 -0
  113. package/dist/publisher/operators/error.d.ts +17 -0
  114. package/dist/publisher/operators/error.d.ts.map +1 -0
  115. package/dist/publisher/operators/error.js +48 -0
  116. package/dist/publisher/operators/error.js.map +1 -0
  117. package/dist/publisher/operators/flatten.d.ts +19 -0
  118. package/dist/publisher/operators/flatten.d.ts.map +1 -0
  119. package/dist/publisher/operators/flatten.js +127 -0
  120. package/dist/publisher/operators/flatten.js.map +1 -0
  121. package/dist/publisher/operators/lifecycle.d.ts +103 -0
  122. package/dist/publisher/operators/lifecycle.d.ts.map +1 -0
  123. package/dist/publisher/operators/lifecycle.js +237 -0
  124. package/dist/publisher/operators/lifecycle.js.map +1 -0
  125. package/dist/publisher/operators/mono-parity.d.ts +109 -0
  126. package/dist/publisher/operators/mono-parity.d.ts.map +1 -0
  127. package/dist/publisher/operators/mono-parity.js +144 -0
  128. package/dist/publisher/operators/mono-parity.js.map +1 -0
  129. package/dist/publisher/operators/mono.d.ts +30 -0
  130. package/dist/publisher/operators/mono.d.ts.map +1 -0
  131. package/dist/publisher/operators/mono.js +37 -0
  132. package/dist/publisher/operators/mono.js.map +1 -0
  133. package/dist/publisher/operators/register.d.ts +20 -0
  134. package/dist/publisher/operators/register.d.ts.map +1 -0
  135. package/dist/publisher/operators/register.js +23 -0
  136. package/dist/publisher/operators/register.js.map +1 -0
  137. package/dist/publisher/operators/selection.d.ts +25 -0
  138. package/dist/publisher/operators/selection.d.ts.map +1 -0
  139. package/dist/publisher/operators/selection.js +108 -0
  140. package/dist/publisher/operators/selection.js.map +1 -0
  141. package/dist/publisher/operators/side-effect.d.ts +15 -0
  142. package/dist/publisher/operators/side-effect.d.ts.map +1 -0
  143. package/dist/publisher/operators/side-effect.js +56 -0
  144. package/dist/publisher/operators/side-effect.js.map +1 -0
  145. package/dist/publisher/operators/terminal.d.ts +16 -0
  146. package/dist/publisher/operators/terminal.d.ts.map +1 -0
  147. package/dist/publisher/operators/terminal.js +47 -0
  148. package/dist/publisher/operators/terminal.js.map +1 -0
  149. package/dist/publisher/operators/time.d.ts +20 -0
  150. package/dist/publisher/operators/time.d.ts.map +1 -0
  151. package/dist/publisher/operators/time.js +92 -0
  152. package/dist/publisher/operators/time.js.map +1 -0
  153. package/dist/publisher/operators/transform.d.ts +31 -0
  154. package/dist/publisher/operators/transform.d.ts.map +1 -0
  155. package/dist/publisher/operators/transform.js +74 -0
  156. package/dist/publisher/operators/transform.js.map +1 -0
  157. package/dist/publisher/operators/windowing.d.ts +28 -0
  158. package/dist/publisher/operators/windowing.d.ts.map +1 -0
  159. package/dist/publisher/operators/windowing.js +148 -0
  160. package/dist/publisher/operators/windowing.js.map +1 -0
  161. package/dist/publisher/publisher.d.ts +11 -0
  162. package/dist/publisher/publisher.d.ts.map +1 -0
  163. package/dist/publisher/types.d.ts +51 -0
  164. package/dist/publisher/types.d.ts.map +1 -0
  165. package/dist/schedulers/animation-frame-scheduler.d.ts +11 -0
  166. package/dist/schedulers/animation-frame-scheduler.d.ts.map +1 -0
  167. package/dist/schedulers/animation-frame-scheduler.js +30 -0
  168. package/dist/schedulers/animation-frame-scheduler.js.map +1 -0
  169. package/dist/schedulers/base-scheduler.d.ts +28 -0
  170. package/dist/schedulers/base-scheduler.d.ts.map +1 -0
  171. package/dist/schedulers/base-scheduler.js +77 -0
  172. package/dist/schedulers/base-scheduler.js.map +1 -0
  173. package/dist/schedulers/basic-worker.d.ts +22 -0
  174. package/dist/schedulers/basic-worker.d.ts.map +1 -0
  175. package/dist/schedulers/basic-worker.js +71 -0
  176. package/dist/schedulers/basic-worker.js.map +1 -0
  177. package/dist/schedulers/delay-scheduler.d.ts +12 -0
  178. package/dist/schedulers/delay-scheduler.d.ts.map +1 -0
  179. package/dist/schedulers/delay-scheduler.js +17 -0
  180. package/dist/schedulers/delay-scheduler.js.map +1 -0
  181. package/dist/schedulers/disposed.d.ts +4 -0
  182. package/dist/schedulers/disposed.d.ts.map +1 -0
  183. package/dist/schedulers/disposed.js +14 -0
  184. package/dist/schedulers/disposed.js.map +1 -0
  185. package/dist/schedulers/duration.d.ts +8 -0
  186. package/dist/schedulers/duration.d.ts.map +1 -0
  187. package/dist/schedulers/duration.js +11 -0
  188. package/dist/schedulers/duration.js.map +1 -0
  189. package/dist/schedulers/executor-scheduler.d.ts +13 -0
  190. package/dist/schedulers/executor-scheduler.d.ts.map +1 -0
  191. package/dist/schedulers/executor-scheduler.js +43 -0
  192. package/dist/schedulers/executor-scheduler.js.map +1 -0
  193. package/dist/schedulers/immediate-scheduler.d.ts +15 -0
  194. package/dist/schedulers/immediate-scheduler.d.ts.map +1 -0
  195. package/dist/schedulers/immediate-scheduler.js +24 -0
  196. package/dist/schedulers/immediate-scheduler.js.map +1 -0
  197. package/dist/schedulers/index.d.ts +7 -0
  198. package/dist/schedulers/index.d.ts.map +1 -0
  199. package/dist/schedulers/index.js +2 -0
  200. package/dist/schedulers/interval-scheduler.d.ts +12 -0
  201. package/dist/schedulers/interval-scheduler.d.ts.map +1 -0
  202. package/dist/schedulers/interval-scheduler.js +17 -0
  203. package/dist/schedulers/interval-scheduler.js.map +1 -0
  204. package/dist/schedulers/macro-scheduler.d.ts +19 -0
  205. package/dist/schedulers/macro-scheduler.d.ts.map +1 -0
  206. package/dist/schedulers/macro-scheduler.js +30 -0
  207. package/dist/schedulers/macro-scheduler.js.map +1 -0
  208. package/dist/schedulers/microtask-scheduler.d.ts +11 -0
  209. package/dist/schedulers/microtask-scheduler.d.ts.map +1 -0
  210. package/dist/schedulers/microtask-scheduler.js +34 -0
  211. package/dist/schedulers/microtask-scheduler.js.map +1 -0
  212. package/dist/schedulers/schedulers.d.ts +39 -0
  213. package/dist/schedulers/schedulers.d.ts.map +1 -0
  214. package/dist/schedulers/schedulers.js +83 -0
  215. package/dist/schedulers/schedulers.js.map +1 -0
  216. package/dist/schedulers/timeout-scheduler.d.ts +11 -0
  217. package/dist/schedulers/timeout-scheduler.d.ts.map +1 -0
  218. package/dist/schedulers/types.d.ts +35 -0
  219. package/dist/schedulers/types.d.ts.map +1 -0
  220. package/dist/signal/signal-type.d.ts +26 -0
  221. package/dist/signal/signal-type.d.ts.map +1 -0
  222. package/dist/signal/signal-type.js +31 -0
  223. package/dist/signal/signal-type.js.map +1 -0
  224. package/dist/signal/signal.d.ts +33 -0
  225. package/dist/signal/signal.d.ts.map +1 -0
  226. package/dist/signal/signal.js +70 -0
  227. package/dist/signal/signal.js.map +1 -0
  228. package/dist/sinks/index.d.ts +7 -0
  229. package/dist/sinks/index.d.ts.map +1 -0
  230. package/dist/sinks/index.js +2 -0
  231. package/dist/sinks/many.d.ts +66 -0
  232. package/dist/sinks/many.d.ts.map +1 -0
  233. package/dist/sinks/many.js +193 -0
  234. package/dist/sinks/many.js.map +1 -0
  235. package/dist/sinks/one.d.ts +41 -0
  236. package/dist/sinks/one.d.ts.map +1 -0
  237. package/dist/sinks/one.js +144 -0
  238. package/dist/sinks/one.js.map +1 -0
  239. package/dist/sinks/specs.d.ts +25 -0
  240. package/dist/sinks/specs.d.ts.map +1 -0
  241. package/dist/sinks/specs.js +126 -0
  242. package/dist/sinks/specs.js.map +1 -0
  243. package/dist/sinks/subscribers.d.ts +16 -0
  244. package/dist/sinks/subscribers.d.ts.map +1 -0
  245. package/dist/sinks/subscribers.js +32 -0
  246. package/dist/sinks/subscribers.js.map +1 -0
  247. package/dist/sinks/types.d.ts +137 -0
  248. package/dist/sinks/types.d.ts.map +1 -0
  249. package/dist/sinks/types.js +58 -0
  250. package/dist/sinks/types.js.map +1 -0
  251. package/dist/subscription/core-subscriber.d.ts +12 -0
  252. package/dist/subscription/core-subscriber.d.ts.map +1 -0
  253. package/dist/subscription/iterable-subscription.d.ts +64 -0
  254. package/dist/subscription/iterable-subscription.d.ts.map +1 -0
  255. package/dist/subscription/iterable-subscription.js +281 -0
  256. package/dist/subscription/iterable-subscription.js.map +1 -0
  257. package/dist/subscription/reactive-streams.d.ts +8 -0
  258. package/dist/subscription/reactive-streams.d.ts.map +1 -0
  259. package/dist/subscription/reactive-streams.js +0 -0
  260. package/dist/subscription/subscriber.d.ts +17 -0
  261. package/dist/subscription/subscriber.d.ts.map +1 -0
  262. package/dist/subscription/subscription.d.ts +12 -0
  263. package/dist/subscription/subscription.d.ts.map +1 -0
  264. package/package.json +99 -33
  265. package/LICENSE.md +0 -56
  266. package/dist/index.d.mts +0 -2535
  267. package/dist/index.js.map +0 -1
  268. package/dist/index.mjs +0 -2
  269. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,217 @@
1
+ import { isAsyncIterable } from "../../internal/iterable.js";
2
+ import { NoSuchElementError } from "../../errors/classes.js";
3
+ import { AsyncQueue } from "../../internal/async-queue.js";
4
+ import { collectIterable, countIterable } from "../../internal/iterable-terminal.js";
5
+ import { Flux } from "../flux.js";
6
+ import { Mono } from "../mono.js";
7
+ //#region src/publisher/operators/aggregate.ts
8
+ /**
9
+ * @packageDocumentation
10
+ * Flux, Mono and operator implementation modules.
11
+ */
12
+ /** Sentinel used when a terminal operation completes without emitting. */
13
+ var NO_VALUE = Symbol("no-value");
14
+ Flux.prototype.buffer = function buffer(size) {
15
+ if (!Number.isInteger(size) || size <= 0) throw new RangeError("buffer size must be a strictly positive integer");
16
+ const source = this;
17
+ return new Flux(async function* (signal, context) {
18
+ let bucket = [];
19
+ for await (const value of source.iterate(signal, context)) {
20
+ bucket.push(value);
21
+ if (bucket.length === size) {
22
+ yield bucket;
23
+ bucket = [];
24
+ }
25
+ }
26
+ if (bucket.length > 0) yield bucket;
27
+ });
28
+ };
29
+ Flux.prototype.window = function window(size) {
30
+ const buffers = this.buffer(size);
31
+ return new Flux((signal, context) => {
32
+ const queue = new AsyncQueue(signal);
33
+ (async () => {
34
+ try {
35
+ for await (const values of buffers.iterate(signal, context)) queue.push(Flux.fromIterable(values));
36
+ queue.complete();
37
+ } catch (error) {
38
+ queue.error(error);
39
+ }
40
+ })();
41
+ return queue;
42
+ });
43
+ };
44
+ Flux.prototype.scan = function scan(seedOrAccumulator, accumulator) {
45
+ const source = this;
46
+ return new Flux(async function* (signal, context) {
47
+ if (accumulator) {
48
+ let current = seedOrAccumulator;
49
+ yield current;
50
+ for await (const value of source.iterate(signal, context)) {
51
+ current = accumulator(current, value);
52
+ yield current;
53
+ }
54
+ } else {
55
+ let initialized = false;
56
+ let current;
57
+ const acc = seedOrAccumulator;
58
+ for await (const value of source.iterate(signal, context)) if (!initialized) {
59
+ current = value;
60
+ initialized = true;
61
+ yield current;
62
+ } else {
63
+ current = acc(current, value);
64
+ yield current;
65
+ }
66
+ }
67
+ });
68
+ };
69
+ Flux.prototype.reduce = function reduce(seedOrAccumulator, accumulator) {
70
+ return terminalMono(this, (values) => accumulator ? reduceSeed(values, seedOrAccumulator, accumulator) : reduceNoSeed(values, seedOrAccumulator));
71
+ };
72
+ Flux.prototype.collectList = function collectList() {
73
+ return terminalMono(this, collectIterable);
74
+ };
75
+ Flux.prototype.count = function count() {
76
+ return terminalMono(this, countIterable);
77
+ };
78
+ Flux.prototype.any = function any(predicate) {
79
+ return terminalMono(this, (values) => anyValue(values, predicate));
80
+ };
81
+ Flux.prototype.all = function all(predicate) {
82
+ return terminalMono(this, (values) => allValue(values, predicate));
83
+ };
84
+ Flux.prototype.hasElement = function hasElement(value) {
85
+ return this.any((next) => Object.is(next, value));
86
+ };
87
+ Flux.prototype.next = function next() {
88
+ return terminalMono(this, firstValue);
89
+ };
90
+ Flux.prototype.single = function single(defaultValue) {
91
+ const hasDefault = arguments.length > 0;
92
+ return terminalMono(this, (values) => singleValue(values, false, hasDefault, defaultValue));
93
+ };
94
+ Flux.prototype.singleOrEmpty = function singleOrEmpty() {
95
+ return terminalMono(this, (values) => singleValue(values, true));
96
+ };
97
+ /** Creates a Mono from a terminal iterable computation while preserving sync sources. */
98
+ function terminalMono(source, evaluate) {
99
+ return new Mono((signal, context) => {
100
+ const values = source.iterate(signal, context);
101
+ return isAsyncIterable(values) ? emitAsync(() => evaluate(values)) : emitSync(() => evaluate(values));
102
+ });
103
+ }
104
+ /** Emits a terminal sync value unless it represents an empty Mono. */
105
+ function emitSync(producer) {
106
+ return (function* () {
107
+ const value = producer();
108
+ if (value !== NO_VALUE) yield value;
109
+ })();
110
+ }
111
+ /** Emits a terminal async value unless it represents an empty Mono. */
112
+ function emitAsync(producer) {
113
+ return (async function* () {
114
+ const value = await producer();
115
+ if (value !== NO_VALUE) yield value;
116
+ })();
117
+ }
118
+ /** Reduces values with an explicit seed. */
119
+ function reduceSeed(values, seed, accumulator) {
120
+ if (isAsyncIterable(values)) return (async () => {
121
+ let current = seed;
122
+ for await (const value of values) current = accumulator(current, value);
123
+ return current;
124
+ })();
125
+ let current = seed;
126
+ for (const value of values) current = accumulator(current, value);
127
+ return current;
128
+ }
129
+ /** Reduces values using the first value as the seed. */
130
+ function reduceNoSeed(values, accumulator) {
131
+ if (isAsyncIterable(values)) return (async () => {
132
+ let initialized = false;
133
+ let current;
134
+ for await (const value of values) {
135
+ current = initialized ? accumulator(current, value) : value;
136
+ initialized = true;
137
+ }
138
+ return initialized ? current : NO_VALUE;
139
+ })();
140
+ let initialized = false;
141
+ let current;
142
+ for (const value of values) {
143
+ current = initialized ? accumulator(current, value) : value;
144
+ initialized = true;
145
+ }
146
+ return initialized ? current : NO_VALUE;
147
+ }
148
+ /** Returns true when any value matches the predicate. */
149
+ function anyValue(values, predicate) {
150
+ if (isAsyncIterable(values)) return (async () => {
151
+ for await (const value of values) if (predicate(value)) return true;
152
+ return false;
153
+ })();
154
+ for (const value of values) if (predicate(value)) return true;
155
+ return false;
156
+ }
157
+ /** Returns true when every value matches the predicate. */
158
+ function allValue(values, predicate) {
159
+ if (isAsyncIterable(values)) return (async () => {
160
+ for await (const value of values) if (!predicate(value)) return false;
161
+ return true;
162
+ })();
163
+ for (const value of values) if (!predicate(value)) return false;
164
+ return true;
165
+ }
166
+ /** Returns the first value and closes the source iterator early. */
167
+ function firstValue(values) {
168
+ if (isAsyncIterable(values)) return (async () => {
169
+ const iterator = values[Symbol.asyncIterator]();
170
+ try {
171
+ const next = await iterator.next();
172
+ return next.done ? NO_VALUE : next.value;
173
+ } finally {
174
+ await iterator.return?.();
175
+ }
176
+ })();
177
+ const iterator = values[Symbol.iterator]();
178
+ try {
179
+ const next = iterator.next();
180
+ return next.done ? NO_VALUE : next.value;
181
+ } finally {
182
+ iterator.return?.();
183
+ }
184
+ }
185
+ /** Returns the only value, a default value or the empty sentinel. */
186
+ function singleValue(values, emptyIsAllowed, hasDefault = false, defaultValue) {
187
+ if (isAsyncIterable(values)) return (async () => singleResult(await collectSingle(values), emptyIsAllowed, hasDefault, defaultValue))();
188
+ let seen = false;
189
+ let result;
190
+ for (const value of values) {
191
+ if (seen) throw new Error("Source emitted more than one item");
192
+ seen = true;
193
+ result = value;
194
+ }
195
+ return singleResult(seen ? result : NO_VALUE, emptyIsAllowed, hasDefault, defaultValue);
196
+ }
197
+ /** Collects exactly one async value or returns the empty sentinel. */
198
+ async function collectSingle(values) {
199
+ let seen = false;
200
+ let result;
201
+ for await (const value of values) {
202
+ if (seen) throw new Error("Source emitted more than one item");
203
+ seen = true;
204
+ result = value;
205
+ }
206
+ return seen ? result : NO_VALUE;
207
+ }
208
+ /** Resolves single-value empty/default behavior. */
209
+ function singleResult(value, emptyIsAllowed, hasDefault, defaultValue) {
210
+ if (value !== NO_VALUE) return value;
211
+ if (hasDefault) return defaultValue;
212
+ if (emptyIsAllowed) return NO_VALUE;
213
+ throw new NoSuchElementError();
214
+ }
215
+ //#endregion
216
+
217
+ //# sourceMappingURL=aggregate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate.js","names":[],"sources":["../../../src/publisher/operators/aggregate.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Flux, Mono and operator implementation modules.\n */\nimport {NoSuchElementError} from \"@/errors/classes.js\";\nimport {AsyncQueue} from \"@/internal/async-queue.js\";\nimport {type AnyIterable, isAsyncIterable} from \"@/internal/iterable.js\";\nimport {collectIterable, countIterable} from \"@/internal/iterable-terminal.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {Mono} from \"@/publisher/mono.js\";\n\n/** Sentinel used when a terminal operation completes without emitting. */\nconst NO_VALUE = Symbol(\"no-value\");\n\n/** Terminal operation result that may represent an empty Mono. */\ntype MaybeValue<T> = T | typeof NO_VALUE;\n\ndeclare module \"@/publisher/flux.js\" {\n /** Aggregate and terminal count-style operators added to Flux. */\n interface Flux<T> {\n /** Groups source values into arrays of `size`, with a final partial buffer when needed. */\n buffer(size: number): Flux<T[]>;\n\n /** Splits source values into finite Flux windows containing up to `size` values each. */\n window(size: number): Flux<Flux<T>>;\n\n /** Emits the seed and each accumulated value produced from the source. */\n scan<R>(seed: R, accumulator: (accumulated: R, value: T) => R): Flux<R>;\n\n /** Emits running accumulated values, using the first source value as the initial state. */\n scan(accumulator: (accumulated: T, value: T) => T): Flux<T>;\n\n /** Reduces source values into one value, using the first value as the initial state. */\n reduce(accumulator: (left: T, right: T) => T): Mono<T>;\n\n /** Reduces source values into one value starting from the provided seed. */\n reduce<R>(seed: R, accumulator: (left: R, right: T) => R): Mono<R>;\n\n /** Collects all source values into an array emitted after completion. */\n collectList(): Mono<T[]>;\n\n /** Counts source values and emits the final count after completion. */\n count(): Mono<number>;\n\n /** Emits true when at least one source value matches the predicate. */\n any(predicate: (value: T) => boolean): Mono<boolean>;\n\n /** Emits true only when every source value matches the predicate. */\n all(predicate: (value: T) => boolean): Mono<boolean>;\n\n /** Emits true when a source value matches `value` by `Object.is`. */\n hasElement(value: T): Mono<boolean>;\n\n /** Emits the first source value, or completes empty when the source has none. */\n next(): Mono<T>;\n\n /** Emits the only source value, an optional default for empty sources, or fails on multiple values. */\n single(defaultValue?: T): Mono<T>;\n\n /** Emits the only source value, completes empty for empty sources, or fails on multiple values. */\n singleOrEmpty(): Mono<T>;\n }\n}\n\nFlux.prototype.buffer = function buffer<T>(this: Flux<T>, size: number): Flux<T[]> {\n if (!Number.isInteger(size) || size <= 0) {\n throw new RangeError(\"buffer size must be a strictly positive integer\");\n }\n const source = this;\n return new Flux(async function* (signal, context) {\n let bucket: T[] = [];\n for await (const value of source.iterate(signal, context)) {\n bucket.push(value);\n if (bucket.length === size) {\n yield bucket;\n bucket = [];\n }\n }\n if (bucket.length > 0) {\n yield bucket;\n }\n });\n};\n\nFlux.prototype.window = function window<T>(this: Flux<T>, size: number): Flux<Flux<T>> {\n const buffers = this.buffer(size);\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<Flux<T>>(signal);\n void (async () => {\n try {\n for await (const values of buffers.iterate(signal, context)) {\n queue.push(Flux.fromIterable(values));\n }\n queue.complete();\n } catch (error) {\n queue.error(error);\n }\n })();\n return queue;\n });\n};\n\nFlux.prototype.scan = function scan<T, R>(\n this: Flux<T>,\n seedOrAccumulator: R | ((accumulated: T, value: T) => T),\n accumulator?: (accumulated: R, value: T) => R\n): Flux<R | T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n if (accumulator) {\n let current = seedOrAccumulator as R;\n yield current;\n for await (const value of source.iterate(signal, context)) {\n current = accumulator(current, value);\n yield current;\n }\n } else {\n let initialized = false;\n let current: T | undefined;\n const acc = seedOrAccumulator as (accumulated: T, value: T) => T;\n for await (const value of source.iterate(signal, context)) {\n if (!initialized) {\n current = value;\n initialized = true;\n yield current;\n } else {\n current = acc(current as T, value);\n yield current;\n }\n }\n }\n });\n};\n\nFlux.prototype.reduce = function reduce<T, R>(\n this: Flux<T>,\n seedOrAccumulator: R | ((left: T, right: T) => T),\n accumulator?: (left: R, right: T) => R\n): Mono<R | T> {\n return terminalMono(this, values => accumulator\n ? reduceSeed(values, seedOrAccumulator as R, accumulator)\n : reduceNoSeed(values, seedOrAccumulator as (left: T, right: T) => T));\n};\n\nFlux.prototype.collectList = function collectList<T>(this: Flux<T>): Mono<T[]> {\n return terminalMono(this, collectIterable);\n};\n\nFlux.prototype.count = function count<T>(this: Flux<T>): Mono<number> {\n return terminalMono(this, countIterable);\n};\n\nFlux.prototype.any = function any<T>(this: Flux<T>, predicate: (value: T) => boolean): Mono<boolean> {\n return terminalMono(this, values => anyValue(values, predicate));\n};\n\nFlux.prototype.all = function all<T>(this: Flux<T>, predicate: (value: T) => boolean): Mono<boolean> {\n return terminalMono(this, values => allValue(values, predicate));\n};\n\nFlux.prototype.hasElement = function hasElement<T>(this: Flux<T>, value: T): Mono<boolean> {\n return this.any(next => Object.is(next, value));\n};\n\nFlux.prototype.next = function next<T>(this: Flux<T>): Mono<T> {\n return terminalMono(this, firstValue);\n};\n\nFlux.prototype.single = function single<T>(this: Flux<T>, defaultValue?: T): Mono<T> {\n const hasDefault = arguments.length > 0;\n return terminalMono(this, values => singleValue(values, false, hasDefault, defaultValue));\n};\n\nFlux.prototype.singleOrEmpty = function singleOrEmpty<T>(this: Flux<T>): Mono<T> {\n return terminalMono(this, values => singleValue<T>(values, true));\n};\n\n/** Creates a Mono from a terminal iterable computation while preserving sync sources. */\nfunction terminalMono<T, R>(\n source: Flux<T>,\n evaluate: (values: AnyIterable<T>) => MaybeValue<R> | Promise<MaybeValue<R>>\n): Mono<R> {\n return new Mono((signal, context) => {\n const values = source.iterate(signal, context);\n return isAsyncIterable<T>(values) ? emitAsync(() => evaluate(values)) : emitSync(() => evaluate(values) as MaybeValue<R>);\n });\n}\n\n/** Emits a terminal sync value unless it represents an empty Mono. */\nfunction emitSync<T>(producer: () => MaybeValue<T>): Iterable<T> {\n return (function* () {\n const value = producer();\n if (value !== NO_VALUE) {\n yield value as T;\n }\n })();\n}\n\n/** Emits a terminal async value unless it represents an empty Mono. */\nfunction emitAsync<T>(producer: () => MaybeValue<T> | Promise<MaybeValue<T>>): AsyncIterable<T> {\n return (async function* () {\n const value = await producer();\n if (value !== NO_VALUE) {\n yield value as T;\n }\n })();\n}\n\n/** Reduces values with an explicit seed. */\nfunction reduceSeed<T, R>(\n values: AnyIterable<T>,\n seed: R,\n accumulator: (left: R, right: T) => R\n): R | Promise<R> {\n if (isAsyncIterable<T>(values)) {\n return (async () => {\n let current = seed;\n for await (const value of values) {\n current = accumulator(current, value);\n }\n return current;\n })();\n }\n let current = seed;\n for (const value of values) {\n current = accumulator(current, value);\n }\n return current;\n}\n\n/** Reduces values using the first value as the seed. */\nfunction reduceNoSeed<T>(\n values: AnyIterable<T>,\n accumulator: (left: T, right: T) => T\n): MaybeValue<T> | Promise<MaybeValue<T>> {\n if (isAsyncIterable<T>(values)) {\n return (async () => {\n let initialized = false;\n let current: T | undefined;\n for await (const value of values) {\n current = initialized ? accumulator(current as T, value) : value;\n initialized = true;\n }\n return initialized ? current as T : NO_VALUE;\n })();\n }\n let initialized = false;\n let current: T | undefined;\n for (const value of values) {\n current = initialized ? accumulator(current as T, value) : value;\n initialized = true;\n }\n return initialized ? current as T : NO_VALUE;\n}\n\n/** Returns true when any value matches the predicate. */\nfunction anyValue<T>(values: AnyIterable<T>, predicate: (value: T) => boolean): boolean | Promise<boolean> {\n if (isAsyncIterable<T>(values)) {\n return (async () => {\n for await (const value of values) {\n if (predicate(value)) {\n return true;\n }\n }\n return false;\n })();\n }\n for (const value of values) {\n if (predicate(value)) {\n return true;\n }\n }\n return false;\n}\n\n/** Returns true when every value matches the predicate. */\nfunction allValue<T>(values: AnyIterable<T>, predicate: (value: T) => boolean): boolean | Promise<boolean> {\n if (isAsyncIterable<T>(values)) {\n return (async () => {\n for await (const value of values) {\n if (!predicate(value)) {\n return false;\n }\n }\n return true;\n })();\n }\n for (const value of values) {\n if (!predicate(value)) {\n return false;\n }\n }\n return true;\n}\n\n/** Returns the first value and closes the source iterator early. */\nfunction firstValue<T>(values: AnyIterable<T>): MaybeValue<T> | Promise<MaybeValue<T>> {\n if (isAsyncIterable<T>(values)) {\n return (async () => {\n const iterator = values[Symbol.asyncIterator]();\n try {\n const next = await iterator.next();\n return next.done ? NO_VALUE : next.value;\n } finally {\n await iterator.return?.();\n }\n })();\n }\n const iterator = values[Symbol.iterator]();\n try {\n const next = iterator.next();\n return next.done ? NO_VALUE : next.value;\n } finally {\n iterator.return?.();\n }\n}\n\n/** Returns the only value, a default value or the empty sentinel. */\nfunction singleValue<T>(\n values: AnyIterable<T>,\n emptyIsAllowed: boolean,\n hasDefault = false,\n defaultValue?: T\n): MaybeValue<T> | Promise<MaybeValue<T>> {\n if (isAsyncIterable<T>(values)) {\n return (async () => singleResult(await collectSingle(values), emptyIsAllowed, hasDefault, defaultValue))();\n }\n let seen = false;\n let result: T | undefined;\n for (const value of values) {\n if (seen) {\n throw new Error(\"Source emitted more than one item\");\n }\n seen = true;\n result = value;\n }\n return singleResult(seen ? result as T : NO_VALUE, emptyIsAllowed, hasDefault, defaultValue);\n}\n\n/** Collects exactly one async value or returns the empty sentinel. */\nasync function collectSingle<T>(values: AsyncIterable<T>): Promise<MaybeValue<T>> {\n let seen = false;\n let result: T | undefined;\n for await (const value of values) {\n if (seen) {\n throw new Error(\"Source emitted more than one item\");\n }\n seen = true;\n result = value;\n }\n return seen ? result as T : NO_VALUE;\n}\n\n/** Resolves single-value empty/default behavior. */\nfunction singleResult<T>(\n value: MaybeValue<T>,\n emptyIsAllowed: boolean,\n hasDefault: boolean,\n defaultValue: T | undefined\n): MaybeValue<T> {\n if (value !== NO_VALUE) {\n return value;\n }\n if (hasDefault) {\n return defaultValue as T;\n }\n if (emptyIsAllowed) {\n return NO_VALUE;\n }\n throw new NoSuchElementError();\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAM,WAAW,OAAO,UAAU;AAoDlC,KAAK,UAAU,SAAS,SAAS,OAAyB,MAAyB;CAC/E,IAAI,CAAC,OAAO,UAAU,IAAI,KAAK,QAAQ,GACnC,MAAM,IAAI,WAAW,iDAAiD;CAE1E,MAAM,SAAS;CACf,OAAO,IAAI,KAAK,iBAAiB,QAAQ,SAAS;EAC9C,IAAI,SAAc,CAAC;EACnB,WAAW,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO,GAAG;GACvD,OAAO,KAAK,KAAK;GACjB,IAAI,OAAO,WAAW,MAAM;IACxB,MAAM;IACN,SAAS,CAAC;GACd;EACJ;EACA,IAAI,OAAO,SAAS,GAChB,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AAK;EACvC,UAAU;GACN,MAAM,SAAS,SAAS;EAC5B;CACJ,EAAA,CAAG;CAEP,MAAM,WAAW,OAAO,OAAO,SAAS,CAAC;CACzC,IAAI;EACA,MAAM,OAAO,SAAS,KAAK;EAC3B,OAAO,KAAK,OAAO,WAAW,KAAK;CACvC,UAAU;EACN,SAAS,SAAS;CACtB;AACJ;;AAGA,SAAS,YACL,QACA,gBACA,aAAa,OACb,cACsC;CACtC,IAAI,gBAAmB,MAAM,GACzB,QAAQ,YAAY,aAAa,MAAM,cAAc,MAAM,GAAG,gBAAgB,YAAY,YAAY,EAAA,CAAG;CAE7G,IAAI,OAAO;CACX,IAAI;CACJ,KAAK,MAAM,SAAS,QAAQ;EACxB,IAAI,MACA,MAAM,IAAI,MAAM,mCAAmC;EAEvD,OAAO;EACP,SAAS;CACb;CACA,OAAO,aAAa,OAAO,SAAc,UAAU,gBAAgB,YAAY,YAAY;AAC/F;;AAGA,eAAe,cAAiB,QAAkD;CAC9E,IAAI,OAAO;CACX,IAAI;CACJ,WAAW,MAAM,SAAS,QAAQ;EAC9B,IAAI,MACA,MAAM,IAAI,MAAM,mCAAmC;EAEvD,OAAO;EACP,SAAS;CACb;CACA,OAAO,OAAO,SAAc;AAChC;;AAGA,SAAS,aACL,OACA,gBACA,YACA,cACa;CACb,IAAI,UAAU,UACV,OAAO;CAEX,IAAI,YACA,OAAO;CAEX,IAAI,gBACA,OAAO;CAEX,MAAM,IAAI,mBAAmB;AACjC"}
@@ -0,0 +1,56 @@
1
+ import { Mono } from "../../mono.js";
2
+ import type { PublisherInput } from "../../types.js";
3
+ import type { Subscriber } from "../../../subscription/subscriber.js";
4
+ /** Constructor-like runtime value used by `ofType`. */
5
+ type ClassLike<R> = abstract new (...args: never[]) => R;
6
+ declare module "../../flux.js" {
7
+ /** Reactor compatibility operators added to Flux. */
8
+ interface Flux<T> {
9
+ /** Passes this Flux to a transformer and returns the transformer's result. */
10
+ as<R>(transformer: (source: Flux<T>) => R): R;
11
+ /** Resolves with the first value, or undefined when the source completes empty. */
12
+ blockFirst(): Promise<T | undefined>;
13
+ /** Resolves with the last value, or undefined when the source completes empty. */
14
+ blockLast(): Promise<T | undefined>;
15
+ /** Creates a container per subscription and accumulates every source value into it. */
16
+ collect<R>(supplier: () => R, accumulator: (container: R, value: T) => void): Mono<R>;
17
+ /** Collects source values into a Map using extracted keys and optional mapped values. */
18
+ collectMap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V>>;
19
+ /** Collects source values into a Map whose keys point to arrays of matching values. */
20
+ collectMultimap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V[]>>;
21
+ /** Collects all source values into an array and sorts it before emitting. */
22
+ collectSortedList(comparator?: (left: T, right: T) => number): Mono<T[]>;
23
+ /** Appends literal values after this Flux completes. */
24
+ concatWithValues(...values: readonly T[]): Flux<T>;
25
+ /** Emits the value at a zero-based index, a default, or an error when missing. */
26
+ elementAt(index: number, defaultValue?: T): Mono<T>;
27
+ /** Emits true when the source emits at least one value. */
28
+ hasElements(): Mono<boolean>;
29
+ /** Wraps this source in a new Flux to hide its concrete identity. */
30
+ hide(): Flux<T>;
31
+ /** Drops all values and completes when the source completes successfully. */
32
+ ignoreElements(): Mono<void>;
33
+ /** Emits the final source value, an optional default, or an error when empty. */
34
+ last(defaultValue?: T): Mono<T>;
35
+ /** Maps each value and drops null or undefined mapping results. */
36
+ mapNotNull<R>(mapper: (value: T) => R | null | undefined): Flux<R>;
37
+ /** Keeps only values that are instances of the provided runtime class. */
38
+ ofType<R>(type: ClassLike<R>): Flux<R>;
39
+ /** Creates an initial state per subscription and reduces source values into it. */
40
+ reduceWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Mono<R>;
41
+ /** Creates an initial state per subscription and emits each running accumulation. */
42
+ scanWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Flux<R>;
43
+ /** Drops the final `n` values from the source. */
44
+ skipLast(n: number): Flux<T>;
45
+ /** Collects all source values, sorts them, and replays the sorted values. */
46
+ sort(comparator?: (left: T, right: T) => number): Flux<T>;
47
+ /** Subscribes the provided subscriber and returns the same subscriber instance. */
48
+ subscribeWith<S extends Subscriber<T>>(subscriber: S): S;
49
+ /** Emits only the final `n` values after the source completes. */
50
+ takeLast(n: number): Flux<T>;
51
+ /** Waits for this source and then waits for `other`, ignoring all values. */
52
+ thenEmpty(other: PublisherInput<unknown>): Mono<void>;
53
+ }
54
+ }
55
+ export {};
56
+ //# sourceMappingURL=flux.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flux.d.ts","sourceRoot":"","sources":["../../../../src/publisher/operators/compat/flux.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AACzC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAE7D,uDAAuD;AACvD,KAAK,SAAS,CAAC,CAAC,IAAI,QAAQ,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEzD,OAAO,QAAQ,qBAAqB,CAAC;IACjC,qDAAqD;IACrD,UAAU,IAAI,CAAC,CAAC;QACZ,8EAA8E;QAC9E,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9C,mFAAmF;QACnF,UAAU,IAAI,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;QAErC,kFAAkF;QAClF,SAAS,IAAI,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;QAEpC,uFAAuF;QACvF,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK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.js";
2
+ import { NoSuchElementError } from "../../../errors/classes.js";
3
+ import { identity } from "../../helpers.js";
4
+ import { Flux } from "../../flux.js";
5
+ import { Mono } from "../../mono.js";
6
+ //#region src/publisher/operators/compat/flux.ts
7
+ /**
8
+ * @packageDocumentation
9
+ * Flux, Mono and operator implementation modules.
10
+ */
11
+ Flux.prototype.as = function as(transformer) {
12
+ return transformer(this);
13
+ };
14
+ Flux.prototype.blockFirst = function blockFirst() {
15
+ return this.next().block();
16
+ };
17
+ Flux.prototype.blockLast = function blockLast() {
18
+ return this.toPromise();
19
+ };
20
+ Flux.prototype.collect = function collect(supplier, accumulator) {
21
+ const source = this;
22
+ return new Mono((signal, context) => {
23
+ const values = source.iterate(signal, context);
24
+ if (isAsyncIterable(values)) return (async function* () {
25
+ const container = supplier();
26
+ for await (const value of values) accumulator(container, value);
27
+ yield container;
28
+ })();
29
+ return (function* () {
30
+ const container = supplier();
31
+ for (const value of values) accumulator(container, value);
32
+ yield container;
33
+ })();
34
+ });
35
+ };
36
+ Flux.prototype.collectMap = function collectMap(keyExtractor, valueExtractor = identity) {
37
+ return this.collect(() => /* @__PURE__ */ new Map(), (map, value) => map.set(keyExtractor(value), valueExtractor(value)));
38
+ };
39
+ Flux.prototype.collectMultimap = function collectMultimap(keyExtractor, valueExtractor = identity) {
40
+ return this.collect(() => /* @__PURE__ */ new Map(), (map, value) => {
41
+ const key = keyExtractor(value);
42
+ const bucket = map.get(key);
43
+ if (bucket) bucket.push(valueExtractor(value));
44
+ else map.set(key, [valueExtractor(value)]);
45
+ });
46
+ };
47
+ Flux.prototype.collectSortedList = function collectSortedList(comparator) {
48
+ return this.collectList().map((values) => values.sort(comparator));
49
+ };
50
+ Flux.prototype.concatWithValues = function concatWithValues(...values) {
51
+ return this.concatWith(Flux.just(...values));
52
+ };
53
+ Flux.prototype.elementAt = function elementAt(index, defaultValue) {
54
+ if (!Number.isInteger(index) || index < 0) throw new RangeError("index must be a non-negative integer");
55
+ const hasDefault = arguments.length > 1;
56
+ return this.skip(index).next().switchIfEmpty(hasDefault ? Mono.just(defaultValue) : Mono.error(new NoSuchElementError()));
57
+ };
58
+ Flux.prototype.hasElements = function hasElements() {
59
+ return this.any(() => true);
60
+ };
61
+ Flux.prototype.hide = function hide() {
62
+ const source = this;
63
+ return new Flux((signal, context) => source.iterate(signal, context));
64
+ };
65
+ Flux.prototype.ignoreElements = function ignoreElements() {
66
+ return this.then();
67
+ };
68
+ Flux.prototype.last = function last(defaultValue) {
69
+ const source = this;
70
+ const hasDefault = arguments.length > 0;
71
+ return new Mono(async function* (signal, context) {
72
+ let seen = false;
73
+ let lastValue;
74
+ for await (const value of source.iterate(signal, context)) {
75
+ seen = true;
76
+ lastValue = value;
77
+ }
78
+ if (seen) yield lastValue;
79
+ else if (hasDefault) yield defaultValue;
80
+ else throw new NoSuchElementError();
81
+ });
82
+ };
83
+ Flux.prototype.mapNotNull = function mapNotNull(mapper) {
84
+ return this.handle((value, sink) => {
85
+ const mapped = mapper(value);
86
+ if (mapped !== null && mapped !== void 0) sink.next(mapped);
87
+ });
88
+ };
89
+ Flux.prototype.ofType = function ofType(type) {
90
+ return this.filter((value) => value instanceof type).cast();
91
+ };
92
+ Flux.prototype.reduceWith = function reduceWith(supplier, accumulator) {
93
+ const source = this;
94
+ return new Mono(async function* (signal, context) {
95
+ for await (const value of source.reduce(supplier(), accumulator).iterate(signal, context)) yield value;
96
+ });
97
+ };
98
+ Flux.prototype.scanWith = function scanWith(supplier, accumulator) {
99
+ const source = this;
100
+ return new Flux(async function* (signal, context) {
101
+ for await (const value of source.scan(supplier(), accumulator).iterate(signal, context)) yield value;
102
+ });
103
+ };
104
+ Flux.prototype.skipLast = function skipLast(n) {
105
+ if (!Number.isInteger(n) || n < 0) throw new RangeError("skipLast expects a non-negative integer");
106
+ if (n === 0) return this;
107
+ const source = this;
108
+ return new Flux(async function* (signal, context) {
109
+ const queue = [];
110
+ let head = 0;
111
+ for await (const value of source.iterate(signal, context)) {
112
+ queue.push(value);
113
+ if (queue.length - head > n) {
114
+ const next = queue[head];
115
+ head += 1;
116
+ if (head > 1024 && head * 2 > queue.length) {
117
+ queue.copyWithin(0, head);
118
+ queue.length -= head;
119
+ head = 0;
120
+ }
121
+ yield next;
122
+ }
123
+ }
124
+ });
125
+ };
126
+ Flux.prototype.sort = function sort(comparator) {
127
+ return new Flux((signal, context) => this.collectSortedList(comparator).flatMapMany(Flux.fromIterable).iterate(signal, context));
128
+ };
129
+ Flux.prototype.subscribeWith = function subscribeWith(subscriber) {
130
+ this.subscribe(subscriber);
131
+ return subscriber;
132
+ };
133
+ Flux.prototype.takeLast = function takeLast(n) {
134
+ if (!Number.isInteger(n) || n < 0) throw new RangeError("takeLast expects a non-negative integer");
135
+ if (n === 0) return Flux.empty();
136
+ const source = this;
137
+ return new Flux(async function* (signal, context) {
138
+ const values = [];
139
+ let head = 0;
140
+ for await (const value of source.iterate(signal, context)) if (values.length < n) values.push(value);
141
+ else {
142
+ values[head] = value;
143
+ head = (head + 1) % n;
144
+ }
145
+ for (let index = 0; index < values.length; index += 1) {
146
+ if (signal.aborted) return;
147
+ yield values[(head + index) % values.length];
148
+ }
149
+ });
150
+ };
151
+ Flux.prototype.thenEmpty = function thenEmpty(other) {
152
+ return this.thenMany(other).then();
153
+ };
154
+ //#endregion
155
+
156
+ //# sourceMappingURL=flux.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flux.js","names":[],"sources":["../../../../src/publisher/operators/compat/flux.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Flux, Mono and operator implementation modules.\n */\nimport {NoSuchElementError} from \"@/errors/classes.js\";\nimport {isAsyncIterable} from \"@/internal/iterable.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {identity} from \"@/publisher/helpers.js\";\nimport {Mono} from \"@/publisher/mono.js\";\nimport type {PublisherInput} from \"@/publisher/types.js\";\nimport type {Subscriber} from \"@/subscription/subscriber.js\";\n\n/** Constructor-like runtime value used by `ofType`. */\ntype ClassLike<R> = abstract new (...args: never[]) => R;\n\ndeclare module \"@/publisher/flux.js\" {\n /** Reactor compatibility operators added to Flux. */\n interface Flux<T> {\n /** Passes this Flux to a transformer and returns the transformer's result. */\n as<R>(transformer: (source: Flux<T>) => R): R;\n\n /** Resolves with the first value, or undefined when the source completes empty. */\n blockFirst(): Promise<T | undefined>;\n\n /** Resolves with the last value, or undefined when the source completes empty. */\n blockLast(): Promise<T | undefined>;\n\n /** Creates a container per subscription and accumulates every source value into it. */\n collect<R>(supplier: () => R, accumulator: (container: R, value: T) => void): Mono<R>;\n\n /** Collects source values into a Map using extracted keys and optional mapped values. */\n collectMap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V>>;\n\n /** Collects source values into a Map whose keys point to arrays of matching values. */\n collectMultimap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V[]>>;\n\n /** Collects all source values into an array and sorts it before emitting. */\n collectSortedList(comparator?: (left: T, right: T) => number): Mono<T[]>;\n\n /** Appends literal values after this Flux completes. */\n concatWithValues(...values: readonly T[]): Flux<T>;\n\n /** Emits the value at a zero-based index, a default, or an error when missing. */\n elementAt(index: number, defaultValue?: T): Mono<T>;\n\n /** Emits true when the source emits at least one value. */\n hasElements(): Mono<boolean>;\n\n /** Wraps this source in a new Flux to hide its concrete identity. */\n hide(): Flux<T>;\n\n /** Drops all values and completes when the source completes successfully. */\n ignoreElements(): Mono<void>;\n\n /** Emits the final source value, an optional default, or an error when empty. */\n last(defaultValue?: T): Mono<T>;\n\n /** Maps each value and drops null or undefined mapping results. */\n mapNotNull<R>(mapper: (value: T) => R | null | undefined): Flux<R>;\n\n /** Keeps only values that are instances of the provided runtime class. */\n ofType<R>(type: ClassLike<R>): Flux<R>;\n\n /** Creates an initial state per subscription and reduces source values into it. */\n reduceWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Mono<R>;\n\n /** Creates an initial state per subscription and emits each running accumulation. */\n scanWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Flux<R>;\n\n /** Drops the final `n` values from the source. */\n skipLast(n: number): Flux<T>;\n\n /** Collects all source values, sorts them, and replays the sorted values. */\n sort(comparator?: (left: T, right: T) => number): Flux<T>;\n\n /** Subscribes the provided subscriber and returns the same subscriber instance. */\n subscribeWith<S extends Subscriber<T>>(subscriber: S): S;\n\n /** Emits only the final `n` values after the source completes. */\n takeLast(n: number): Flux<T>;\n\n /** Waits for this source and then waits for `other`, ignoring all values. */\n thenEmpty(other: PublisherInput<unknown>): Mono<void>;\n }\n}\n\n\nFlux.prototype.as = function as<T, R>(this: Flux<T>, transformer: (source: Flux<T>) => R): R {\n return transformer(this);\n};\n\nFlux.prototype.blockFirst = function blockFirst<T>(this: Flux<T>): Promise<T | undefined> {\n return this.next().block();\n};\n\nFlux.prototype.blockLast = function blockLast<T>(this: Flux<T>): Promise<T | undefined> {\n return this.toPromise();\n};\n\nFlux.prototype.collect = function collect<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (container: R, value: T) => void\n): Mono<R> {\n const source = this;\n return new Mono((signal, context) => {\n const values = source.iterate(signal, context);\n if (isAsyncIterable<T>(values)) {\n return (async function* () {\n const container = supplier();\n for await (const value of values) {\n accumulator(container, value);\n }\n yield container;\n })();\n }\n return (function* () {\n const container = supplier();\n for (const value of values) {\n accumulator(container, value);\n }\n yield container;\n })();\n });\n};\n\nFlux.prototype.collectMap = function collectMap<T, K, V = T>(\n this: Flux<T>,\n keyExtractor: (value: T) => K,\n valueExtractor: (value: T) => V = identity as (value: T) => V\n): Mono<Map<K, V>> {\n return this.collect(\n () => new Map<K, V>(),\n (map, value) => map.set(keyExtractor(value), valueExtractor(value))\n );\n};\n\nFlux.prototype.collectMultimap = function collectMultimap<T, K, V = T>(\n this: Flux<T>,\n keyExtractor: (value: T) => K,\n valueExtractor: (value: T) => V = identity as (value: T) => V\n): Mono<Map<K, V[]>> {\n return this.collect(\n () => new Map<K, V[]>(),\n (map, value) => {\n const key = keyExtractor(value);\n const bucket = map.get(key);\n if (bucket) {\n bucket.push(valueExtractor(value));\n } else {\n map.set(key, [valueExtractor(value)]);\n }\n }\n );\n};\n\nFlux.prototype.collectSortedList = function collectSortedList<T>(\n this: Flux<T>,\n comparator?: (left: T, right: T) => number\n): Mono<T[]> {\n return this.collectList().map(values => values.sort(comparator));\n};\n\nFlux.prototype.concatWithValues = function concatWithValues<T>(this: Flux<T>, ...values: readonly T[]): Flux<T> {\n return this.concatWith(Flux.just(...values));\n};\n\nFlux.prototype.elementAt = function elementAt<T>(this: Flux<T>, index: number, defaultValue?: T): Mono<T> {\n if (!Number.isInteger(index) || index < 0) {\n throw new RangeError(\"index must be a non-negative integer\");\n }\n const hasDefault = arguments.length > 1;\n return this.skip(index).next().switchIfEmpty(hasDefault ? Mono.just(defaultValue as T) : Mono.error(new NoSuchElementError()));\n};\n\nFlux.prototype.hasElements = function hasElements<T>(this: Flux<T>): Mono<boolean> {\n return this.any(() => true);\n};\n\nFlux.prototype.hide = function hide<T>(this: Flux<T>): Flux<T> {\n const source = this;\n return new Flux((signal, context) => source.iterate(signal, context));\n};\n\nFlux.prototype.ignoreElements = function ignoreElements<T>(this: Flux<T>): Mono<void> {\n return this.then();\n};\n\nFlux.prototype.last = function last<T>(this: Flux<T>, defaultValue?: T): Mono<T> {\n const source = this;\n const hasDefault = arguments.length > 0;\n return new Mono(async function* (signal, context) {\n let seen = false;\n let lastValue: T | undefined;\n for await (const value of source.iterate(signal, context)) {\n seen = true;\n lastValue = value;\n }\n if (seen) {\n yield lastValue as T;\n } else if (hasDefault) {\n yield defaultValue as T;\n } else {\n throw new NoSuchElementError();\n }\n });\n};\n\nFlux.prototype.mapNotNull = function mapNotNull<T, R>(\n this: Flux<T>,\n mapper: (value: T) => R | null | undefined\n): Flux<R> {\n return this.handle((value, sink) => {\n const mapped = mapper(value);\n if (mapped !== null && mapped !== undefined) {\n sink.next(mapped);\n }\n });\n};\n\nFlux.prototype.ofType = function ofType<T, R>(this: Flux<T>, type: ClassLike<R>): Flux<R> {\n return this.filter(value => value instanceof type).cast<R>();\n};\n\nFlux.prototype.reduceWith = function reduceWith<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (accumulated: R, value: T) => R\n): Mono<R> {\n const source = this;\n return new Mono(async function* (signal, context) {\n for await (const value of source.reduce(supplier(), accumulator).iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.scanWith = function scanWith<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (accumulated: R, value: T) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.scan(supplier(), accumulator).iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.skipLast = function skipLast<T>(this: Flux<T>, n: number): Flux<T> {\n if (!Number.isInteger(n) || n < 0) {\n throw new RangeError(\"skipLast expects a non-negative integer\");\n }\n if (n === 0) {\n return this;\n }\n const source = this;\n return new Flux(async function* (signal, context) {\n const queue: T[] = [];\n let head = 0;\n for await (const value of source.iterate(signal, context)) {\n queue.push(value);\n if (queue.length - head > n) {\n const next = queue[head] as T;\n head += 1;\n if (head > 1024 && head * 2 > queue.length) {\n queue.copyWithin(0, head);\n queue.length -= head;\n head = 0;\n }\n yield next;\n }\n }\n });\n};\n\nFlux.prototype.sort = function sort<T>(this: Flux<T>, comparator?: (left: T, right: T) => number): Flux<T> {\n return new Flux((signal, context) => this.collectSortedList(comparator).flatMapMany(Flux.fromIterable).iterate(signal, context));\n};\n\nFlux.prototype.subscribeWith = function subscribeWith<T, S extends Subscriber<T>>(this: Flux<T>, subscriber: S): S {\n this.subscribe(subscriber);\n return subscriber;\n};\n\nFlux.prototype.takeLast = function takeLast<T>(this: Flux<T>, n: number): Flux<T> {\n if (!Number.isInteger(n) || n < 0) {\n throw new RangeError(\"takeLast expects a non-negative integer\");\n }\n if (n === 0) {\n return Flux.empty<T>();\n }\n const source = this;\n return new Flux(async function* (signal, context) {\n const values: T[] = [];\n let head = 0;\n for await (const value of source.iterate(signal, context)) {\n if (values.length < n) {\n values.push(value);\n } else {\n values[head] = value;\n head = (head + 1) % n;\n }\n }\n for (let index = 0; index < values.length; index += 1) {\n if (signal.aborted) {\n return;\n }\n yield values[(head + index) % values.length] as T;\n }\n });\n};\n\nFlux.prototype.thenEmpty = function thenEmpty<T>(this: Flux<T>, other: PublisherInput<unknown>): Mono<void> {\n return this.thenMany(other).then();\n};\n"],"mappings":";;;;;;;;;;AAuFA,KAAK,UAAU,KAAK,SAAS,GAAwB,aAAwC;CACzF,OAAO,YAAY,IAAI;AAC3B;AAEA,KAAK,UAAU,aAAa,SAAS,aAAqD;CACtF,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM;AAC7B;AAEA,KAAK,UAAU,YAAY,SAAS,YAAoD;CACpF,OAAO,KAAK,UAAU;AAC1B;AAEA,KAAK,UAAU,UAAU,SAAS,QAE9B,UACA,aACO;CACP,MAAM,SAAS;CACf,OAAO,IAAI,MAAM,QAAQ,YAAY;EACjC,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO;EAC7C,IAAI,gBAAmB,MAAM,GACzB,QAAQ,mBAAmB;GACvB,MAAM,YAAY,SAAS;GAC3B,WAAW,MAAM,SAAS,QACtB,YAAY,WAAW,KAAK;GAEhC,MAAM;EACV,EAAA,CAAG;EAEP,QAAQ,aAAa;GACjB,MAAM,YAAY,SAAS;GAC3B,KAAK,MAAM,SAAS,QAChB,YAAY,WAAW,KAAK;GAEhC,MAAM;EACV,EAAA,CAAG;CACP,CAAC;AACL;AAEA,KAAK,UAAU,aAAa,SAAS,WAEjC,cACA,iBAAkC,UACnB;CACf,OAAO,KAAK,8BACF,IAAI,IAAU,IACnB,KAAK,UAAU,IAAI,IAAI,aAAa,KAAK,GAAG,eAAe,KAAK,CAAC,CACtE;AACJ;AAEA,KAAK,UAAU,kBAAkB,SAAS,gBAEtC,cACA,iBAAkC,UACjB;CACjB,OAAO,KAAK,8BACF,IAAI,IA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ementation modules.
4
+ */
5
+ import { Flux } from "../../flux.js";
6
+ import type { PublisherInput, SynchronousSink } from "../../types.js";
7
+ import type { DurationInput, Scheduler } from "../../../schedulers/types.js";
8
+ import { Signal } from "../../../signal/signal.js";
9
+ import type { Subscriber } from "../../../subscription/subscriber.js";
10
+ import type { ContextView } from "../../../context/context-view.js";
11
+ declare module "../../mono.js" {
12
+ /** Reactor compatibility operators added to Mono. */
13
+ interface Mono<T> {
14
+ /** Waits for this Mono and another publisher, ignoring values from both. */
15
+ and(other: PublisherInput<unknown>): Mono<void>;
16
+ /** Passes this Mono to a transformer and returns the transformer's result. */
17
+ as<R>(transformer: (source: Mono<T>) => R): R;
18
+ /** Treats this Mono as a Mono of another TypeScript type. */
19
+ cast<R>(): Mono<R>;
20
+ /** Emits this Mono value and then values from another publisher. */
21
+ concatWith(other: PublisherInput<T>): Flux<T>;
22
+ /** Invokes a callback once after completion, error, or cancellation. */
23
+ doFinally(callback: (signal: "complete" | "error" | "cancel") => void): Mono<T>;
24
+ /** Invokes a callback when this Mono fails. */
25
+ doOnError(callback: (error: unknown) => void): Mono<T>;
26
+ /** Invokes a callback when this Mono emits a value. */
27
+ doOnNext(callback: (value: T) => void): Mono<T>;
28
+ /** Invokes a callback when this Mono completes successfully, with undefined when empty. */
29
+ doOnSuccess(callback: (value: T | undefined) => void): Mono<T>;
30
+ /** Invokes a callback before successful or failed termination is propagated. */
31
+ doOnTerminate(callback: () => void): Mono<T>;
32
+ /** Emits the elapsed scheduler time together with the Mono value. */
33
+ elapsed(scheduler?: Scheduler): Mono<readonly [number, T]>;
34
+ /** Views this Mono as a Flux that emits zero or one value. */
35
+ flux(): Flux<T>;
36
+ /** Handles the value with a synchronous sink that may emit, complete, or fail. */
37
+ handle<R>(handler: (value: T, sink: SynchronousSink<R>) => void): Mono<R>;
38
+ /** Emits true when this Mono emits a value. */
39
+ hasElement(): Mono<boolean>;
40
+ /** Drops the value and completes when this Mono completes successfully. */
41
+ ignoreElement(): Mono<void>;
42
+ /** Converts the Mono value or terminal signal into a `Signal` value. */
43
+ materialize(): Mono<Signal<T>>;
44
+ /** Merges this Mono with another publisher and returns the combined Flux. */
45
+ mergeWith(other: PublisherInput<T>): Flux<T>;
46
+ /** Replaces an error with the result of the provided mapper. */
47
+ onErrorMap(mapper: (error: unknown) => unknown): Mono<T>;
48
+ /** Switches to a fallback publisher when this Mono fails. */
49
+ onErrorResume<R = T>(fallback: (error: unknown) => PublisherInput<R>): Mono<T | R>;
50
+ /** Emits the fallback value when this Mono fails. */
51
+ onErrorReturn(fallbackValue: T): Mono<T>;
52
+ /** Reschedules value delivery on the provided scheduler. */
53
+ publishOn(scheduler: Scheduler): Mono<T>;
54
+ /** Re-subscribes after successful completion and emits repeated values as a Flux. */
55
+ repeat(repeatCount?: number): Flux<T>;
56
+ /** Re-subscribes when this Mono fails, up to the configured retry count. */
57
+ retry(maxRetries?: number): Mono<T>;
58
+ /** Returns this Mono while preserving single-value semantics. */
59
+ single(): Mono<T>;
60
+ /** Schedules subscription work on the provided scheduler. */
61
+ subscribeOn(scheduler: Scheduler): Mono<T>;
62
+ /** Subscribes the provided subscriber and returns the same subscriber instance. */
63
+ subscribeWith<S extends Subscriber<T>>(subscriber: S): S;
64
+ /** Returns this Mono, matching Reactor's zero-or-one `take` semantics. */
65
+ take(): Mono<T>;
66
+ /** Waits for this Mono and then waits for `other`, ignoring all values. */
67
+ thenEmpty(other: PublisherInput<unknown>): Mono<void>;
68
+ /** Waits for this Mono to complete and then emits values from `other`. */
69
+ thenMany<R>(other: PublisherInput<R>): Flux<R>;
70
+ /** Fails or switches to a fallback when this Mono does not signal in time. */
71
+ timeout(timeout: DurationInput, fallback?: PublisherInput<T>, scheduler?: Scheduler): Mono<T>;
72
+ /** Emits the scheduler timestamp together with the Mono value. */
73
+ timestamp(scheduler?: Scheduler): Mono<readonly [number, T]>;
74
+ /** Applies a transformer to this Mono immediately and adapts its result back to Mono. */
75
+ transform<R>(transformer: (source: Mono<T>) => PublisherInput<R>): Mono<R>;
76
+ /** Applies a transformer separately for each subscription. */
77
+ transformDeferred<R>(transformer: (source: Mono<T>) => PublisherInput<R>): Mono<R>;
78
+ /** Applies a transformer per subscription with access to the subscriber context. */
79
+ transformDeferredContextual<R>(transformer: (source: Mono<T>, context: ContextView) => PublisherInput<R>): Mono<R>;
80
+ }
81
+ }
82
+ //# sourceMappingURL=mono.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mono.d.ts","sourceRoot":"","sources":["../../../../src/publisher/operators/compat/mono.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAEzC,OAAO,KAAK,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAE1E,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAE3D,OAAO,QAAQ,qBAAqB,CAAC;IACjC,qDAAqD;IACrD,UAAU,IAAI,CAAC,CAAC;QACZ,4EAA4E;QAC5E,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAEhD,8EAA8E;QAC9E,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9C,6DAA6D;QAC7D,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;QAEnB,oEAAoE;QACpE,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAE9C,wEAAwE;QAC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