@yume-chan/stream-extra 0.0.18 → 0.0.19
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.
- package/CHANGELOG.json +33 -21
- package/CHANGELOG.md +8 -2
- package/README.md +1 -1
- package/esm/buffered-transform.d.ts +11 -10
- package/esm/buffered-transform.d.ts.map +1 -1
- package/esm/buffered-transform.js +55 -55
- package/esm/buffered-transform.js.map +1 -1
- package/esm/buffered.d.ts +29 -27
- package/esm/buffered.d.ts.map +1 -1
- package/esm/buffered.js +128 -123
- package/esm/buffered.js.map +1 -1
- package/esm/chunk.d.ts +7 -4
- package/esm/chunk.d.ts.map +1 -1
- package/esm/chunk.js +48 -7
- package/esm/chunk.js.map +1 -1
- package/esm/consumable.d.ts +53 -0
- package/esm/consumable.d.ts.map +1 -0
- package/esm/consumable.js +178 -0
- package/esm/consumable.js.map +1 -0
- package/esm/decode-utf8.d.ts +4 -4
- package/esm/decode-utf8.js +11 -11
- package/esm/distribution.d.ts +24 -0
- package/esm/distribution.d.ts.map +1 -0
- package/esm/distribution.js +99 -0
- package/esm/distribution.js.map +1 -0
- package/esm/duplex.d.ts +48 -47
- package/esm/duplex.d.ts.map +1 -1
- package/esm/duplex.js +90 -92
- package/esm/duplex.js.map +1 -1
- package/esm/gather-string.d.ts +6 -6
- package/esm/gather-string.d.ts.map +1 -1
- package/esm/gather-string.js +15 -13
- package/esm/gather-string.js.map +1 -1
- package/esm/index.d.ts +16 -15
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +16 -15
- package/esm/index.js.map +1 -1
- package/esm/inspect.d.ts +4 -4
- package/esm/inspect.js +11 -11
- package/esm/pipe-from.d.ts +12 -11
- package/esm/pipe-from.d.ts.map +1 -1
- package/esm/pipe-from.js +23 -25
- package/esm/pipe-from.js.map +1 -1
- package/esm/push-readable.d.ts +19 -18
- package/esm/push-readable.d.ts.map +1 -1
- package/esm/push-readable.js +61 -61
- package/esm/push-readable.js.map +1 -1
- package/esm/split-string.d.ts +4 -4
- package/esm/split-string.d.ts.map +1 -1
- package/esm/split-string.js +24 -24
- package/esm/split-string.js.map +1 -1
- package/esm/stream.d.ts +25 -24
- package/esm/stream.d.ts.map +1 -1
- package/esm/stream.js +26 -26
- package/esm/stream.js.map +1 -1
- package/esm/struct-deserialize.d.ts +6 -6
- package/esm/struct-deserialize.d.ts.map +1 -1
- package/esm/struct-deserialize.js +8 -8
- package/esm/struct-serialize.d.ts +5 -5
- package/esm/struct-serialize.js +10 -10
- package/esm/trace.d.ts +3 -3
- package/esm/wrap-readable.d.ts +21 -20
- package/esm/wrap-readable.d.ts.map +1 -1
- package/esm/wrap-readable.js +56 -56
- package/esm/wrap-readable.js.map +1 -1
- package/esm/wrap-writable.d.ts +14 -12
- package/esm/wrap-writable.d.ts.map +1 -1
- package/esm/wrap-writable.js +62 -52
- package/esm/wrap-writable.js.map +1 -1
- package/package.json +7 -6
- package/src/buffered-transform.ts +5 -10
- package/src/buffered.ts +7 -5
- package/src/consumable.ts +281 -0
- package/src/distribution.ts +113 -0
- package/src/duplex.ts +15 -16
- package/src/gather-string.ts +5 -3
- package/src/index.ts +16 -15
- package/src/inspect.ts +1 -1
- package/src/pipe-from.ts +8 -6
- package/src/push-readable.ts +3 -7
- package/src/split-string.ts +5 -2
- package/src/stream.ts +1 -1
- package/src/struct-deserialize.ts +1 -1
- package/src/wrap-readable.ts +5 -5
- package/src/wrap-writable.ts +16 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/src/chunk.ts +0 -15
package/esm/push-readable.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
-
import { AbortController, ReadableStream
|
|
3
|
-
export class PushReadableStream extends ReadableStream {
|
|
4
|
-
/**
|
|
5
|
-
* Create a new `PushReadableStream` from a source.
|
|
6
|
-
*
|
|
7
|
-
* @param source If `source` returns a `Promise`, the stream will be closed
|
|
8
|
-
* when the `Promise` is resolved, and be errored when the `Promise` is rejected.
|
|
9
|
-
* @param strategy
|
|
10
|
-
*/
|
|
11
|
-
constructor(source, strategy) {
|
|
12
|
-
let waterMarkLow;
|
|
13
|
-
const canceled = new AbortController();
|
|
14
|
-
super({
|
|
15
|
-
start: (controller) => {
|
|
16
|
-
const result = source({
|
|
17
|
-
abortSignal: canceled.signal,
|
|
18
|
-
async enqueue(chunk) {
|
|
19
|
-
if (canceled.signal.aborted) {
|
|
20
|
-
// If the stream is already cancelled,
|
|
21
|
-
// throw immediately.
|
|
22
|
-
throw (canceled.signal.reason ??
|
|
23
|
-
new Error("Aborted"));
|
|
24
|
-
}
|
|
25
|
-
// Only when the stream is errored, `desiredSize` will be `null`.
|
|
26
|
-
// But since `null <= 0` is `true`
|
|
27
|
-
// (`null <= 0` is evaluated as `!(null > 0)` => `!false` => `true`),
|
|
28
|
-
// not handling it will cause a deadlock.
|
|
29
|
-
if ((controller.desiredSize ?? 1) <= 0) {
|
|
30
|
-
waterMarkLow = new PromiseResolver();
|
|
31
|
-
await waterMarkLow.promise;
|
|
32
|
-
}
|
|
33
|
-
// `controller.enqueue` will throw error for us
|
|
34
|
-
// if the stream is already errored.
|
|
35
|
-
controller.enqueue(chunk);
|
|
36
|
-
},
|
|
37
|
-
close() {
|
|
38
|
-
controller.close();
|
|
39
|
-
},
|
|
40
|
-
error(e) {
|
|
41
|
-
controller.error(e);
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
if (result && "then" in result) {
|
|
45
|
-
result.then(() => {
|
|
46
|
-
controller.close();
|
|
47
|
-
}, (e) => {
|
|
48
|
-
controller.error(e);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
pull: () => {
|
|
53
|
-
waterMarkLow?.resolve();
|
|
54
|
-
},
|
|
55
|
-
cancel: (reason) => {
|
|
56
|
-
canceled.abort(reason);
|
|
57
|
-
waterMarkLow?.reject(reason);
|
|
58
|
-
},
|
|
59
|
-
}, strategy);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
1
|
+
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
+
import { AbortController, ReadableStream } from "./stream.js";
|
|
3
|
+
export class PushReadableStream extends ReadableStream {
|
|
4
|
+
/**
|
|
5
|
+
* Create a new `PushReadableStream` from a source.
|
|
6
|
+
*
|
|
7
|
+
* @param source If `source` returns a `Promise`, the stream will be closed
|
|
8
|
+
* when the `Promise` is resolved, and be errored when the `Promise` is rejected.
|
|
9
|
+
* @param strategy
|
|
10
|
+
*/
|
|
11
|
+
constructor(source, strategy) {
|
|
12
|
+
let waterMarkLow;
|
|
13
|
+
const canceled = new AbortController();
|
|
14
|
+
super({
|
|
15
|
+
start: (controller) => {
|
|
16
|
+
const result = source({
|
|
17
|
+
abortSignal: canceled.signal,
|
|
18
|
+
async enqueue(chunk) {
|
|
19
|
+
if (canceled.signal.aborted) {
|
|
20
|
+
// If the stream is already cancelled,
|
|
21
|
+
// throw immediately.
|
|
22
|
+
throw (canceled.signal.reason ??
|
|
23
|
+
new Error("Aborted"));
|
|
24
|
+
}
|
|
25
|
+
// Only when the stream is errored, `desiredSize` will be `null`.
|
|
26
|
+
// But since `null <= 0` is `true`
|
|
27
|
+
// (`null <= 0` is evaluated as `!(null > 0)` => `!false` => `true`),
|
|
28
|
+
// not handling it will cause a deadlock.
|
|
29
|
+
if ((controller.desiredSize ?? 1) <= 0) {
|
|
30
|
+
waterMarkLow = new PromiseResolver();
|
|
31
|
+
await waterMarkLow.promise;
|
|
32
|
+
}
|
|
33
|
+
// `controller.enqueue` will throw error for us
|
|
34
|
+
// if the stream is already errored.
|
|
35
|
+
controller.enqueue(chunk);
|
|
36
|
+
},
|
|
37
|
+
close() {
|
|
38
|
+
controller.close();
|
|
39
|
+
},
|
|
40
|
+
error(e) {
|
|
41
|
+
controller.error(e);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
if (result && "then" in result) {
|
|
45
|
+
result.then(() => {
|
|
46
|
+
controller.close();
|
|
47
|
+
}, (e) => {
|
|
48
|
+
controller.error(e);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
pull: () => {
|
|
53
|
+
waterMarkLow?.resolve();
|
|
54
|
+
},
|
|
55
|
+
cancel: (reason) => {
|
|
56
|
+
canceled.abort(reason);
|
|
57
|
+
waterMarkLow?.reject(reason);
|
|
58
|
+
},
|
|
59
|
+
}, strategy);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
62
|
//# sourceMappingURL=push-readable.js.map
|
package/esm/push-readable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-readable.js","sourceRoot":"","sources":["../src/push-readable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"push-readable.js","sourceRoot":"","sources":["../src/push-readable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAgB9D,MAAM,OAAO,kBAAsB,SAAQ,cAAiB;IACxD;;;;;;OAMG;IACH,YACI,MAAmC,EACnC,QAA6B;QAE7B,IAAI,YAA+C,CAAC;QACpD,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QAEvC,KAAK,CACD;YACI,KAAK,EAAE,CAAC,UAAU,EAAE,EAAE;gBAClB,MAAM,MAAM,GAAG,MAAM,CAAC;oBAClB,WAAW,EAAE,QAAQ,CAAC,MAAM;oBAC5B,KAAK,CAAC,OAAO,CAAC,KAAK;wBACf,IAAI,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE;4BACzB,sCAAsC;4BACtC,qBAAqB;4BACrB,MAAM,CACF,QAAQ,CAAC,MAAM,CAAC,MAAM;gCACtB,IAAI,KAAK,CAAC,SAAS,CAAC,CACvB,CAAC;yBACL;wBAED,iEAAiE;wBACjE,kCAAkC;wBAClC,qEAAqE;wBACrE,yCAAyC;wBACzC,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;4BACpC,YAAY,GAAG,IAAI,eAAe,EAAQ,CAAC;4BAC3C,MAAM,YAAY,CAAC,OAAO,CAAC;yBAC9B;wBAED,+CAA+C;wBAC/C,oCAAoC;wBACpC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;oBAC9B,CAAC;oBACD,KAAK;wBACD,UAAU,CAAC,KAAK,EAAE,CAAC;oBACvB,CAAC;oBACD,KAAK,CAAC,CAAC;wBACH,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBACxB,CAAC;iBACJ,CAAC,CAAC;gBAEH,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE;oBAC5B,MAAM,CAAC,IAAI,CACP,GAAG,EAAE;wBACD,UAAU,CAAC,KAAK,EAAE,CAAC;oBACvB,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;wBACF,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBACxB,CAAC,CACJ,CAAC;iBACL;YACL,CAAC;YACD,IAAI,EAAE,GAAG,EAAE;gBACP,YAAY,EAAE,OAAO,EAAE,CAAC;YAC5B,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBACf,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACvB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YACjC,CAAC;SACJ,EACD,QAAQ,CACX,CAAC;IACN,CAAC;CACJ"}
|
package/esm/split-string.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TransformStream } from "./stream.js";
|
|
2
|
-
export declare class SplitStringStream extends TransformStream<string, string> {
|
|
3
|
-
constructor(separator: string);
|
|
4
|
-
}
|
|
1
|
+
import { TransformStream } from "./stream.js";
|
|
2
|
+
export declare class SplitStringStream extends TransformStream<string, string> {
|
|
3
|
+
constructor(separator: string);
|
|
4
|
+
}
|
|
5
5
|
//# sourceMappingURL=split-string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-string.d.ts","sourceRoot":"","sources":["../src/split-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"split-string.d.ts","sourceRoot":"","sources":["../src/split-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqB9C,qBAAa,iBAAkB,SAAQ,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC/C,SAAS,EAAE,MAAM;CASvC"}
|
package/esm/split-string.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { TransformStream } from "./stream.js";
|
|
2
|
-
function* split(input, separator) {
|
|
3
|
-
let start = 0;
|
|
4
|
-
while (true) {
|
|
5
|
-
const index = input.indexOf(separator, start);
|
|
6
|
-
if (index === -1) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const part = input.substring(start, index);
|
|
10
|
-
yield part;
|
|
11
|
-
start = index + 1;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export class SplitStringStream extends TransformStream {
|
|
15
|
-
constructor(separator) {
|
|
16
|
-
super({
|
|
17
|
-
transform(chunk, controller) {
|
|
18
|
-
for (const part of split(chunk, separator)) {
|
|
19
|
-
controller.enqueue(part);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import { TransformStream } from "./stream.js";
|
|
2
|
+
function* split(input, separator) {
|
|
3
|
+
let start = 0;
|
|
4
|
+
while (true) {
|
|
5
|
+
const index = input.indexOf(separator, start);
|
|
6
|
+
if (index === -1) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const part = input.substring(start, index);
|
|
10
|
+
yield part;
|
|
11
|
+
start = index + 1;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class SplitStringStream extends TransformStream {
|
|
15
|
+
constructor(separator) {
|
|
16
|
+
super({
|
|
17
|
+
transform(chunk, controller) {
|
|
18
|
+
for (const part of split(chunk, separator)) {
|
|
19
|
+
controller.enqueue(part);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
25
|
//# sourceMappingURL=split-string.js.map
|
package/esm/split-string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-string.js","sourceRoot":"","sources":["../src/split-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,QAAQ,CAAC,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"split-string.js","sourceRoot":"","sources":["../src/split-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,QAAQ,CAAC,CAAC,KAAK,CACX,KAAa,EACb,SAAiB;IAEjB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,IAAI,EAAE;QACT,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,OAAO;SACV;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC;QAEX,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;KACrB;AACL,CAAC;AAED,MAAM,OAAO,iBAAkB,SAAQ,eAA+B;IAClE,YAAmB,SAAiB;QAChC,KAAK,CAAC;YACF,SAAS,CAAC,KAAK,EAAE,UAAU;gBACvB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE;oBACxC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iBAC5B;YACL,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/esm/stream.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
1
|
+
import type { AbortSignal } from "web-streams-polyfill";
|
|
2
|
+
import { ReadableStream as ReadableStreamPolyfill, TransformStream as TransformStreamPolyfill, WritableStream as WritableStreamPolyfill } from "web-streams-polyfill";
|
|
3
|
+
export * from "web-streams-polyfill";
|
|
4
|
+
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
5
|
+
export interface AbortController {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the AbortSignal object associated with this object.
|
|
8
|
+
*/
|
|
9
|
+
readonly signal: AbortSignal;
|
|
10
|
+
/**
|
|
11
|
+
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
12
|
+
*/
|
|
13
|
+
abort(reason?: any): void;
|
|
14
|
+
}
|
|
15
|
+
interface AbortControllerConstructor {
|
|
16
|
+
prototype: AbortController;
|
|
17
|
+
new (): AbortController;
|
|
18
|
+
}
|
|
19
|
+
export declare const AbortController: AbortControllerConstructor;
|
|
20
|
+
export type ReadableStream<R = any> = ReadableStreamPolyfill<R>;
|
|
21
|
+
export declare let ReadableStream: typeof ReadableStreamPolyfill;
|
|
22
|
+
export type WritableStream<W = any> = WritableStreamPolyfill<W>;
|
|
23
|
+
export declare let WritableStream: typeof WritableStreamPolyfill;
|
|
24
|
+
export type TransformStream<I = any, O = any> = TransformStreamPolyfill<I, O>;
|
|
25
|
+
export declare let TransformStream: typeof TransformStreamPolyfill;
|
|
25
26
|
//# sourceMappingURL=stream.d.ts.map
|
package/esm/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,IAAI,sBAAsB,EACxC,eAAe,IAAI,uBAAuB,EAC1C,cAAc,IAAI,sBAAsB,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACH,cAAc,IAAI,sBAAsB,EACxC,eAAe,IAAI,uBAAuB,EAC1C,cAAc,IAAI,sBAAsB,EAC3C,MAAM,sBAAsB,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AAErC,iGAAiG;AACjG,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC7B;AAED,UAAU,0BAA0B;IAChC,SAAS,EAAE,eAAe,CAAC;IAC3B,QAAQ,eAAe,CAAC;CAC3B;AAWD,eAAO,MAAM,eAAe,4BAAyB,CAAC;AAEtD,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAChE,eAAO,IAAI,cAAc,+BAAyB,CAAC;AAEnD,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAChE,eAAO,IAAI,cAAc,+BAAyB,CAAC;AAEnD,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9E,eAAO,IAAI,eAAe,gCAA0B,CAAC"}
|
package/esm/stream.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { ReadableStream as ReadableStreamPolyfill, TransformStream as TransformStreamPolyfill, WritableStream as WritableStreamPolyfill, } from "web-streams-polyfill";
|
|
2
|
-
export * from "web-streams-polyfill";
|
|
3
|
-
const GLOBAL = globalThis;
|
|
4
|
-
export const AbortController = GLOBAL.AbortController;
|
|
5
|
-
export let ReadableStream = ReadableStreamPolyfill;
|
|
6
|
-
export let WritableStream = WritableStreamPolyfill;
|
|
7
|
-
export let TransformStream = TransformStreamPolyfill;
|
|
8
|
-
if (GLOBAL.ReadableStream && GLOBAL.WritableStream && GLOBAL.TransformStream) {
|
|
9
|
-
// Use browser native implementation
|
|
10
|
-
ReadableStream = GLOBAL.ReadableStream;
|
|
11
|
-
WritableStream = GLOBAL.WritableStream;
|
|
12
|
-
TransformStream = GLOBAL.TransformStream;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
// TODO: enable loading Node.js stream implementation when bundler supports Top Level Await
|
|
16
|
-
// try {
|
|
17
|
-
// // Use Node.js native implementation
|
|
18
|
-
// const MODULE_NAME = "node:stream/web";
|
|
19
|
-
// const StreamWeb = (await import(MODULE_NAME)) as GlobalExtension;
|
|
20
|
-
// ReadableStream = StreamWeb.ReadableStream;
|
|
21
|
-
// WritableStream = StreamWeb.WritableStream;
|
|
22
|
-
// TransformStream = StreamWeb.TransformStream;
|
|
23
|
-
// } catch {
|
|
24
|
-
// // ignore
|
|
25
|
-
// }
|
|
26
|
-
}
|
|
1
|
+
import { ReadableStream as ReadableStreamPolyfill, TransformStream as TransformStreamPolyfill, WritableStream as WritableStreamPolyfill, } from "web-streams-polyfill";
|
|
2
|
+
export * from "web-streams-polyfill";
|
|
3
|
+
const GLOBAL = globalThis;
|
|
4
|
+
export const AbortController = GLOBAL.AbortController;
|
|
5
|
+
export let ReadableStream = ReadableStreamPolyfill;
|
|
6
|
+
export let WritableStream = WritableStreamPolyfill;
|
|
7
|
+
export let TransformStream = TransformStreamPolyfill;
|
|
8
|
+
if (GLOBAL.ReadableStream && GLOBAL.WritableStream && GLOBAL.TransformStream) {
|
|
9
|
+
// Use browser native implementation
|
|
10
|
+
ReadableStream = GLOBAL.ReadableStream;
|
|
11
|
+
WritableStream = GLOBAL.WritableStream;
|
|
12
|
+
TransformStream = GLOBAL.TransformStream;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// TODO: enable loading Node.js stream implementation when bundler supports Top Level Await
|
|
16
|
+
// try {
|
|
17
|
+
// // Use Node.js native implementation
|
|
18
|
+
// const MODULE_NAME = "node:stream/web";
|
|
19
|
+
// const StreamWeb = (await import(MODULE_NAME)) as GlobalExtension;
|
|
20
|
+
// ReadableStream = StreamWeb.ReadableStream;
|
|
21
|
+
// WritableStream = StreamWeb.WritableStream;
|
|
22
|
+
// TransformStream = StreamWeb.TransformStream;
|
|
23
|
+
// } catch {
|
|
24
|
+
// // ignore
|
|
25
|
+
// }
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=stream.js.map
|
package/esm/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,EACH,cAAc,IAAI,sBAAsB,EACxC,eAAe,IAAI,uBAAuB,EAC1C,cAAc,IAAI,sBAAsB,GAC3C,MAAM,sBAAsB,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AA2BrC,MAAM,MAAM,GAAG,UAAwC,CAAC;AAExD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;AAGtD,MAAM,CAAC,IAAI,cAAc,GAAG,sBAAsB,CAAC;AAGnD,MAAM,CAAC,IAAI,cAAc,GAAG,sBAAsB,CAAC;AAGnD,MAAM,CAAC,IAAI,eAAe,GAAG,uBAAuB,CAAC;AAErD,IAAI,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,eAAe,EAAE;IAC1E,oCAAoC;IACpC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IACvC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IACvC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;CAC5C;KAAM;IACH,2FAA2F;IAC3F,QAAQ;IACR,2CAA2C;IAC3C,6CAA6C;IAC7C,wEAAwE;IACxE,iDAAiD;IACjD,iDAAiD;IACjD,mDAAmD;IACnD,YAAY;IACZ,gBAAgB;IAChB,IAAI;CACP"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type Struct from "@yume-chan/struct";
|
|
2
|
-
import {
|
|
3
|
-
import { BufferedTransformStream } from "./buffered-transform.js";
|
|
4
|
-
export declare class StructDeserializeStream<T extends Struct<any, any, any, any>> extends BufferedTransformStream<StructValueType<T>> {
|
|
5
|
-
constructor(struct: T);
|
|
6
|
-
}
|
|
1
|
+
import type Struct from "@yume-chan/struct";
|
|
2
|
+
import type { StructValueType } from "@yume-chan/struct";
|
|
3
|
+
import { BufferedTransformStream } from "./buffered-transform.js";
|
|
4
|
+
export declare class StructDeserializeStream<T extends Struct<any, any, any, any>> extends BufferedTransformStream<StructValueType<T>> {
|
|
5
|
+
constructor(struct: T);
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=struct-deserialize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct-deserialize.d.ts","sourceRoot":"","sources":["../src/struct-deserialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"struct-deserialize.d.ts","sourceRoot":"","sources":["../src/struct-deserialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,qBAAa,uBAAuB,CAChC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CACtC,SAAQ,uBAAuB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;gBAC9B,MAAM,EAAE,CAAC;CAK/B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BufferedTransformStream } from "./buffered-transform.js";
|
|
2
|
-
export class StructDeserializeStream extends BufferedTransformStream {
|
|
3
|
-
constructor(struct) {
|
|
4
|
-
super((stream) => {
|
|
5
|
-
return struct.deserialize(stream);
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
import { BufferedTransformStream } from "./buffered-transform.js";
|
|
2
|
+
export class StructDeserializeStream extends BufferedTransformStream {
|
|
3
|
+
constructor(struct) {
|
|
4
|
+
super((stream) => {
|
|
5
|
+
return struct.deserialize(stream);
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=struct-deserialize.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type Struct from "@yume-chan/struct";
|
|
2
|
-
import { TransformStream } from "./stream.js";
|
|
3
|
-
export declare class StructSerializeStream<T extends Struct<any, any, any, any>> extends TransformStream<T["TInit"], Uint8Array> {
|
|
4
|
-
constructor(struct: T);
|
|
5
|
-
}
|
|
1
|
+
import type Struct from "@yume-chan/struct";
|
|
2
|
+
import { TransformStream } from "./stream.js";
|
|
3
|
+
export declare class StructSerializeStream<T extends Struct<any, any, any, any>> extends TransformStream<T["TInit"], Uint8Array> {
|
|
4
|
+
constructor(struct: T);
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=struct-serialize.d.ts.map
|
package/esm/struct-serialize.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TransformStream } from "./stream.js";
|
|
2
|
-
export class StructSerializeStream extends TransformStream {
|
|
3
|
-
constructor(struct) {
|
|
4
|
-
super({
|
|
5
|
-
transform(chunk, controller) {
|
|
6
|
-
controller.enqueue(struct.serialize(chunk));
|
|
7
|
-
},
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
import { TransformStream } from "./stream.js";
|
|
2
|
+
export class StructSerializeStream extends TransformStream {
|
|
3
|
+
constructor(struct) {
|
|
4
|
+
super({
|
|
5
|
+
transform(chunk, controller) {
|
|
6
|
+
controller.enqueue(struct.serialize(chunk));
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
11
|
//# sourceMappingURL=struct-serialize.js.map
|
package/esm/trace.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ReadableStream,
|
|
1
|
+
import { ReadableStream, file, type ReadableWritablePair } from "./stream.js";
|
|
2
2
|
export declare const PRESSURE_WARNINGS: Map<string, number[]>;
|
|
3
3
|
export declare class PressureSensor<R> implements ReadableWritablePair<R, R> {
|
|
4
4
|
private _readable;
|
|
5
5
|
get readable(): ReadableStream<R>;
|
|
6
6
|
private _writable;
|
|
7
|
-
get writable():
|
|
7
|
+
get writable(): file<R>;
|
|
8
8
|
private _name;
|
|
9
9
|
private _ended;
|
|
10
10
|
private _cancelReason;
|
|
@@ -13,4 +13,4 @@ export declare class PressureSensor<R> implements ReadableWritablePair<R, R> {
|
|
|
13
13
|
private _writeLock;
|
|
14
14
|
constructor(name: string, size: number);
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=trace.d.ts.map
|
|
16
|
+
//# sourceMappingURL=trace.d.ts.map
|
package/esm/wrap-readable.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import type { ValueOrPromise } from "@yume-chan/struct";
|
|
2
|
+
import type { ReadableStreamDefaultController } from "./stream.js";
|
|
3
|
+
import { ReadableStream } from "./stream.js";
|
|
4
|
+
export type WrapReadableStreamStart<T> = (controller: ReadableStreamDefaultController<T>) => ValueOrPromise<ReadableStream<T>>;
|
|
5
|
+
export interface ReadableStreamWrapper<T> {
|
|
6
|
+
start: WrapReadableStreamStart<T>;
|
|
7
|
+
cancel?(reason?: unknown): ValueOrPromise<void>;
|
|
8
|
+
close?(): ValueOrPromise<void>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This class has multiple usages:
|
|
12
|
+
*
|
|
13
|
+
* 1. Get notified when the stream is cancelled or closed.
|
|
14
|
+
* 2. Synchronously create a `ReadableStream` by asynchronously return another `ReadableStream`.
|
|
15
|
+
* 3. Convert native `ReadableStream`s to polyfilled ones so they can `pipe` between.
|
|
16
|
+
*/
|
|
17
|
+
export declare class WrapReadableStream<T> extends ReadableStream<T> {
|
|
18
|
+
readable: ReadableStream<T>;
|
|
19
|
+
private reader;
|
|
20
|
+
constructor(wrapper: ReadableStream<T> | WrapReadableStreamStart<T> | ReadableStreamWrapper<T>);
|
|
21
|
+
}
|
|
21
22
|
//# sourceMappingURL=wrap-readable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-readable.d.ts","sourceRoot":"","sources":["../src/wrap-readable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"wrap-readable.d.ts","sourceRoot":"","sources":["../src/wrap-readable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EACR,+BAA+B,EAElC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CACrC,UAAU,EAAE,+BAA+B,CAAC,CAAC,CAAC,KAC7C,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvC,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACpC,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAChD,KAAK,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;CAClC;AAoBD;;;;;;GAMG;AACH,qBAAa,kBAAkB,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,CAAC,MAAM,CAAkC;gBAG5C,OAAO,EACD,cAAc,CAAC,CAAC,CAAC,GACjB,uBAAuB,CAAC,CAAC,CAAC,GAC1B,qBAAqB,CAAC,CAAC,CAAC;CAmCrC"}
|
package/esm/wrap-readable.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { ReadableStream
|
|
2
|
-
function getWrappedReadableStream(wrapper, controller) {
|
|
3
|
-
if ("start" in wrapper) {
|
|
4
|
-
return wrapper.start(controller);
|
|
5
|
-
}
|
|
6
|
-
else if (typeof wrapper === "function") {
|
|
7
|
-
return wrapper(controller);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
// Can't use `wrapper instanceof ReadableStream`
|
|
11
|
-
// Because we want to be compatible with any ReadableStream-like objects
|
|
12
|
-
return wrapper;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* This class has multiple usages:
|
|
17
|
-
*
|
|
18
|
-
* 1. Get notified when the stream is cancelled or closed.
|
|
19
|
-
* 2. Synchronously create a `ReadableStream` by asynchronously return another `ReadableStream`.
|
|
20
|
-
* 3. Convert native `ReadableStream`s to polyfilled ones so they can `pipe` between.
|
|
21
|
-
*/
|
|
22
|
-
export class WrapReadableStream extends ReadableStream {
|
|
23
|
-
readable;
|
|
24
|
-
reader;
|
|
25
|
-
constructor(wrapper) {
|
|
26
|
-
super({
|
|
27
|
-
start: async (controller) => {
|
|
28
|
-
// `start` is invoked before `ReadableStream`'s constructor finish,
|
|
29
|
-
// so using `this` synchronously causes
|
|
30
|
-
// "Must call super constructor in derived class before accessing 'this' or returning from derived constructor".
|
|
31
|
-
// Queue a microtask to avoid this.
|
|
32
|
-
await Promise.resolve();
|
|
33
|
-
this.readable = await getWrappedReadableStream(wrapper, controller);
|
|
34
|
-
this.reader = this.readable.getReader();
|
|
35
|
-
},
|
|
36
|
-
cancel: async (reason) => {
|
|
37
|
-
await this.reader.cancel(reason);
|
|
38
|
-
if ("cancel" in wrapper) {
|
|
39
|
-
await wrapper.cancel?.(reason);
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
pull: async (controller) => {
|
|
43
|
-
const result = await this.reader.read();
|
|
44
|
-
if (result.done) {
|
|
45
|
-
controller.close();
|
|
46
|
-
if ("close" in wrapper) {
|
|
47
|
-
await wrapper.close?.();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
controller.enqueue(result.value);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
import { ReadableStream } from "./stream.js";
|
|
2
|
+
function getWrappedReadableStream(wrapper, controller) {
|
|
3
|
+
if ("start" in wrapper) {
|
|
4
|
+
return wrapper.start(controller);
|
|
5
|
+
}
|
|
6
|
+
else if (typeof wrapper === "function") {
|
|
7
|
+
return wrapper(controller);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
// Can't use `wrapper instanceof ReadableStream`
|
|
11
|
+
// Because we want to be compatible with any ReadableStream-like objects
|
|
12
|
+
return wrapper;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* This class has multiple usages:
|
|
17
|
+
*
|
|
18
|
+
* 1. Get notified when the stream is cancelled or closed.
|
|
19
|
+
* 2. Synchronously create a `ReadableStream` by asynchronously return another `ReadableStream`.
|
|
20
|
+
* 3. Convert native `ReadableStream`s to polyfilled ones so they can `pipe` between.
|
|
21
|
+
*/
|
|
22
|
+
export class WrapReadableStream extends ReadableStream {
|
|
23
|
+
readable;
|
|
24
|
+
reader;
|
|
25
|
+
constructor(wrapper) {
|
|
26
|
+
super({
|
|
27
|
+
start: async (controller) => {
|
|
28
|
+
// `start` is invoked before `ReadableStream`'s constructor finish,
|
|
29
|
+
// so using `this` synchronously causes
|
|
30
|
+
// "Must call super constructor in derived class before accessing 'this' or returning from derived constructor".
|
|
31
|
+
// Queue a microtask to avoid this.
|
|
32
|
+
await Promise.resolve();
|
|
33
|
+
this.readable = await getWrappedReadableStream(wrapper, controller);
|
|
34
|
+
this.reader = this.readable.getReader();
|
|
35
|
+
},
|
|
36
|
+
cancel: async (reason) => {
|
|
37
|
+
await this.reader.cancel(reason);
|
|
38
|
+
if ("cancel" in wrapper) {
|
|
39
|
+
await wrapper.cancel?.(reason);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
pull: async (controller) => {
|
|
43
|
+
const result = await this.reader.read();
|
|
44
|
+
if (result.done) {
|
|
45
|
+
controller.close();
|
|
46
|
+
if ("close" in wrapper) {
|
|
47
|
+
await wrapper.close?.();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
controller.enqueue(result.value);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
57
|
//# sourceMappingURL=wrap-readable.js.map
|
package/esm/wrap-readable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-readable.js","sourceRoot":"","sources":["../src/wrap-readable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wrap-readable.js","sourceRoot":"","sources":["../src/wrap-readable.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAY7C,SAAS,wBAAwB,CAC7B,OAG8B,EAC9B,UAA8C;IAE9C,IAAI,OAAO,IAAI,OAAO,EAAE;QACpB,OAAO,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;KACpC;SAAM,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;QACtC,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;KAC9B;SAAM;QACH,gDAAgD;QAChD,wEAAwE;QACxE,OAAO,OAAO,CAAC;KAClB;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,kBAAsB,SAAQ,cAAiB;IACjD,QAAQ,CAAqB;IAE5B,MAAM,CAAkC;IAEhD,YACI,OAG8B;QAE9B,KAAK,CAAC;YACF,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;gBACxB,mEAAmE;gBACnE,uCAAuC;gBACvC,gHAAgH;gBAChH,mCAAmC;gBACnC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;gBAExB,IAAI,CAAC,QAAQ,GAAG,MAAM,wBAAwB,CAC1C,OAAO,EACP,UAAU,CACb,CAAC;gBACF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YAC5C,CAAC;YACD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBACrB,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACjC,IAAI,QAAQ,IAAI,OAAO,EAAE;oBACrB,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;iBAClC;YACL,CAAC;YACD,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;gBACvB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACxC,IAAI,MAAM,CAAC,IAAI,EAAE;oBACb,UAAU,CAAC,KAAK,EAAE,CAAC;oBACnB,IAAI,OAAO,IAAI,OAAO,EAAE;wBACpB,MAAM,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;qBAC3B;iBACJ;qBAAM;oBACH,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;iBACpC;YACL,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
|