spliterator 6.2.0 → 6.3.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.
- package/out/lib/core/AsyncSpliterator.d.ts +1 -1
- package/out/lib/core/AsyncSpliterator.d.ts.map +1 -1
- package/out/lib/core/AsyncSpliterator.js +2 -2
- package/out/lib/core/AsyncSpliterator.js.map +1 -1
- package/out/lib/core/SlidingWindow.d.ts +1 -1
- package/out/lib/core/SlidingWindow.d.ts.map +1 -1
- package/out/lib/core/SlidingWindow.js.map +1 -1
- package/out/lib/core/Spliterator.d.ts +1 -1
- package/out/lib/core/Spliterator.d.ts.map +1 -1
- package/out/lib/core/Spliterator.js +1 -1
- package/out/lib/core/Spliterator.js.map +1 -1
- package/out/lib/formats/CSVSpliterator.d.ts +2 -2
- package/out/lib/formats/CSVSpliterator.d.ts.map +1 -1
- package/out/lib/formats/CSVSpliterator.js +92 -1
- package/out/lib/formats/CSVSpliterator.js.map +1 -1
- package/out/lib/formats/XLSXSpliterator.d.ts +1 -1
- package/out/lib/formats/XLSXSpliterator.d.ts.map +1 -1
- package/package.json +2 -3
- package/out/lib/AsyncSequence.d.ts +0 -180
- package/out/lib/AsyncSequence.d.ts.map +0 -1
- package/out/lib/AsyncSequence.js +0 -432
- package/out/lib/AsyncSequence.js.map +0 -1
- package/out/lib/AsyncSpliterator.d.ts +0 -227
- package/out/lib/AsyncSpliterator.d.ts.map +0 -1
- package/out/lib/AsyncSpliterator.js +0 -510
- package/out/lib/AsyncSpliterator.js.map +0 -1
- package/out/lib/BufferController.d.ts +0 -77
- package/out/lib/BufferController.d.ts.map +0 -1
- package/out/lib/BufferController.js +0 -118
- package/out/lib/BufferController.js.map +0 -1
- package/out/lib/CSVSpliterator.d.ts +0 -131
- package/out/lib/CSVSpliterator.d.ts.map +0 -1
- package/out/lib/CSVSpliterator.js +0 -172
- package/out/lib/CSVSpliterator.js.map +0 -1
- package/out/lib/CharacterSequence.d.ts +0 -72
- package/out/lib/CharacterSequence.d.ts.map +0 -1
- package/out/lib/CharacterSequence.js +0 -347
- package/out/lib/CharacterSequence.js.map +0 -1
- package/out/lib/CompositeDataView.d.ts +0 -111
- package/out/lib/CompositeDataView.d.ts.map +0 -1
- package/out/lib/CompositeDataView.js +0 -241
- package/out/lib/CompositeDataView.js.map +0 -1
- package/out/lib/IndexQueue.d.ts +0 -48
- package/out/lib/IndexQueue.d.ts.map +0 -1
- package/out/lib/IndexQueue.js +0 -111
- package/out/lib/IndexQueue.js.map +0 -1
- package/out/lib/JSONSpliterator.d.ts +0 -44
- package/out/lib/JSONSpliterator.d.ts.map +0 -1
- package/out/lib/JSONSpliterator.js +0 -77
- package/out/lib/JSONSpliterator.js.map +0 -1
- package/out/lib/PSVSpliterator.d.ts +0 -21
- package/out/lib/PSVSpliterator.d.ts.map +0 -1
- package/out/lib/PSVSpliterator.js +0 -22
- package/out/lib/PSVSpliterator.js.map +0 -1
- package/out/lib/SlidingWindow.d.ts +0 -47
- package/out/lib/SlidingWindow.d.ts.map +0 -1
- package/out/lib/SlidingWindow.js +0 -63
- package/out/lib/SlidingWindow.js.map +0 -1
- package/out/lib/Spliterator.d.ts +0 -96
- package/out/lib/Spliterator.d.ts.map +0 -1
- package/out/lib/Spliterator.js +0 -330
- package/out/lib/Spliterator.js.map +0 -1
- package/out/lib/TSVSpliterator.d.ts +0 -21
- package/out/lib/TSVSpliterator.d.ts.map +0 -1
- package/out/lib/TSVSpliterator.js +0 -22
- package/out/lib/TSVSpliterator.js.map +0 -1
- package/out/lib/TextSpliterator.d.ts +0 -53
- package/out/lib/TextSpliterator.d.ts.map +0 -1
- package/out/lib/TextSpliterator.js +0 -67
- package/out/lib/TextSpliterator.js.map +0 -1
- package/out/lib/XLSXSpliterator.d.ts +0 -143
- package/out/lib/XLSXSpliterator.d.ts.map +0 -1
- package/out/lib/XLSXSpliterator.js +0 -161
- package/out/lib/XLSXSpliterator.js.map +0 -1
- package/out/lib/adaptive-source.d.ts +0 -39
- package/out/lib/adaptive-source.d.ts.map +0 -1
- package/out/lib/adaptive-source.js +0 -95
- package/out/lib/adaptive-source.js.map +0 -1
- package/out/lib/casing.d.ts +0 -27
- package/out/lib/casing.d.ts.map +0 -1
- package/out/lib/casing.js +0 -68
- package/out/lib/casing.js.map +0 -1
- package/out/lib/chunks.d.ts +0 -20
- package/out/lib/chunks.d.ts.map +0 -1
- package/out/lib/chunks.js +0 -36
- package/out/lib/chunks.js.map +0 -1
- package/out/lib/merge-async-iterators.d.ts +0 -12
- package/out/lib/merge-async-iterators.d.ts.map +0 -1
- package/out/lib/merge-async-iterators.js +0 -39
- package/out/lib/merge-async-iterators.js.map +0 -1
- package/out/lib/parallel-map-runtime.d.ts +0 -22
- package/out/lib/parallel-map-runtime.d.ts.map +0 -1
- package/out/lib/parallel-map-runtime.js +0 -60
- package/out/lib/parallel-map-runtime.js.map +0 -1
- package/out/lib/parallel-map-worker-entry.d.ts +0 -11
- package/out/lib/parallel-map-worker-entry.d.ts.map +0 -1
- package/out/lib/parallel-map-worker-entry.js +0 -41
- package/out/lib/parallel-map-worker-entry.js.map +0 -1
- package/out/lib/parallel-map-workers.d.ts +0 -57
- package/out/lib/parallel-map-workers.d.ts.map +0 -1
- package/out/lib/parallel-map-workers.js +0 -82
- package/out/lib/parallel-map-workers.js.map +0 -1
- package/out/lib/parallel-map.d.ts +0 -28
- package/out/lib/parallel-map.d.ts.map +0 -1
- package/out/lib/parallel-map.js +0 -30
- package/out/lib/parallel-map.js.map +0 -1
- package/out/lib/pivot.d.ts +0 -30
- package/out/lib/pivot.d.ts.map +0 -1
- package/out/lib/pivot.js +0 -47
- package/out/lib/pivot.js.map +0 -1
- package/out/lib/row-emitters.d.ts +0 -35
- package/out/lib/row-emitters.d.ts.map +0 -1
- package/out/lib/row-emitters.js +0 -50
- package/out/lib/row-emitters.js.map +0 -1
- package/out/lib/segment-runtime.d.ts +0 -27
- package/out/lib/segment-runtime.d.ts.map +0 -1
- package/out/lib/segment-runtime.js +0 -41
- package/out/lib/segment-runtime.js.map +0 -1
- package/out/lib/segment-worker-entry.d.ts +0 -10
- package/out/lib/segment-worker-entry.d.ts.map +0 -1
- package/out/lib/segment-worker-entry.js +0 -59
- package/out/lib/segment-worker-entry.js.map +0 -1
- package/out/lib/segment-workers.d.ts +0 -56
- package/out/lib/segment-workers.d.ts.map +0 -1
- package/out/lib/segment-workers.js +0 -110
- package/out/lib/segment-workers.js.map +0 -1
- package/out/lib/segments.d.ts +0 -31
- package/out/lib/segments.d.ts.map +0 -1
- package/out/lib/segments.js +0 -52
- package/out/lib/segments.js.map +0 -1
- package/out/lib/shared.d.ts +0 -155
- package/out/lib/shared.d.ts.map +0 -1
- package/out/lib/shared.js +0 -41
- package/out/lib/shared.js.map +0 -1
- package/out/lib/take.d.ts +0 -42
- package/out/lib/take.d.ts.map +0 -1
- package/out/lib/take.js +0 -101
- package/out/lib/take.js.map +0 -1
- package/out/lib/utils.d.ts +0 -37
- package/out/lib/utils.d.ts.map +0 -1
- package/out/lib/utils.js +0 -39
- package/out/lib/utils.js.map +0 -1
- package/out/lib/wasm_base64.d.ts +0 -19
- package/out/lib/wasm_base64.d.ts.map +0 -1
- package/out/lib/wasm_base64.js +0 -19
- package/out/lib/wasm_base64.js.map +0 -1
- package/out/lib/wasm_module.d.ts +0 -57
- package/out/lib/wasm_module.d.ts.map +0 -1
- package/out/lib/wasm_module.js +0 -34
- package/out/lib/wasm_module.js.map +0 -1
- package/out/lib/writer.d.ts +0 -45
- package/out/lib/writer.d.ts.map +0 -1
- package/out/lib/writer.js +0 -57
- package/out/lib/writer.js.map +0 -1
- package/out/lib/zip.d.ts +0 -33
- package/out/lib/zip.d.ts.map +0 -1
- package/out/lib/zip.js +0 -59
- package/out/lib/zip.js.map +0 -1
- package/out/node/cli/parse-args.d.ts +0 -120
- package/out/node/cli/parse-args.d.ts.map +0 -1
- package/out/node/cli/parse-args.js +0 -118
- package/out/node/cli/parse-args.js.map +0 -1
package/out/lib/SlidingWindow.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license MIT
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
import { CharacterSequence } from "./CharacterSequence.js";
|
|
7
|
-
/**
|
|
8
|
-
* A sliding window that iterates over an in-memory buffer, yielding byte ranges.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link AsyncSlidingWindow} for an asynchronous version.
|
|
11
|
-
*/
|
|
12
|
-
export class SlidingWindow {
|
|
13
|
-
buffer;
|
|
14
|
-
#delimiter;
|
|
15
|
-
#byteLength;
|
|
16
|
-
#done = false;
|
|
17
|
-
/**
|
|
18
|
-
* The current byte index of the sliding window.
|
|
19
|
-
*/
|
|
20
|
-
cursor;
|
|
21
|
-
/**
|
|
22
|
-
* Given a byte array containing delimited data, yield a sliding window of indexes.
|
|
23
|
-
*
|
|
24
|
-
* This a low-level utility function that can be used to implement more complex parsing logic.
|
|
25
|
-
*/
|
|
26
|
-
constructor(
|
|
27
|
-
/**
|
|
28
|
-
* The buffer containing delimited data.
|
|
29
|
-
*/
|
|
30
|
-
buffer, init = {}) {
|
|
31
|
-
this.buffer = buffer;
|
|
32
|
-
this.#delimiter = new CharacterSequence(init.delimiter);
|
|
33
|
-
this.cursor = init.position ?? 0;
|
|
34
|
-
this.#byteLength = Math.min(init.byteLength ?? buffer.byteLength, buffer.byteLength);
|
|
35
|
-
}
|
|
36
|
-
next() {
|
|
37
|
-
if (this.cursor < this.#byteLength) {
|
|
38
|
-
// Delegate scanning to CharacterSequence.search, which uses native indexOf for
|
|
39
|
-
// single-byte delimiters and the SIMD/BMH paths otherwise — far faster than a
|
|
40
|
-
// per-byte `.every` callback across the buffer.
|
|
41
|
-
const delimiterIndex = this.#delimiter.search(this.buffer, this.cursor, this.#byteLength);
|
|
42
|
-
if (delimiterIndex !== -1) {
|
|
43
|
-
const range = [this.cursor, delimiterIndex];
|
|
44
|
-
this.cursor = delimiterIndex + this.#delimiter.length;
|
|
45
|
-
return { value: range, done: false };
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (this.cursor <= this.#byteLength && !this.#done) {
|
|
49
|
-
const range = [this.cursor, this.#byteLength];
|
|
50
|
-
this.cursor = this.#byteLength;
|
|
51
|
-
this.#done = true;
|
|
52
|
-
return { value: range, done: false };
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
value: undefined,
|
|
56
|
-
done: true,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
[Symbol.iterator]() {
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=SlidingWindow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SlidingWindow.js","sourceRoot":"","sources":["../../lib/SlidingWindow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAA+B,MAAM,wBAAwB,CAAA;AAoBvF;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACzB,MAAM,CAAG;IACT,UAAU,CAAmB;IAC7B,WAAW,CAAQ;IACnB,KAAK,GAAG,KAAK,CAAA;IAEb;;OAEG;IACH,MAAM,CAAQ;IAEd;;;;OAIG;IACH;IACC;;OAEG;IACH,MAAS,EACT,IAAI,GAAsB,EAAE;QAE5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IACrF,CAAC;IAEM,IAAI;QACV,IAAI,IAAI,CAAC,MAAM,GA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syncSpliteratorInit, type SpliteratorInit } from "./AsyncSpliterator.js";
|
|
7
|
-
import { type CharacterSequenceInput } from "./CharacterSequence.js";
|
|
8
|
-
import { type AsyncChunkIterator, type AsyncDataResource } from "./shared.js";
|
|
9
|
-
export { AsyncSpliterator };
|
|
10
|
-
export type { AsyncSpliteratorInit, SpliteratorInit };
|
|
11
|
-
/**
|
|
12
|
-
* A byte stream delimiting iterator.
|
|
13
|
-
*/
|
|
14
|
-
export declare class Spliterator<R extends Uint8Array | DataView | ArrayBuffer = Uint8Array> implements IterableIterator<R>, Disposable {
|
|
15
|
-
#private;
|
|
16
|
-
/**
|
|
17
|
-
* Create a spliterator from an asynchronous resource such as a file.
|
|
18
|
-
*
|
|
19
|
-
* This is an alias for `AsyncSpliterator.from`.
|
|
20
|
-
*
|
|
21
|
-
* @param source - The data resource to read from.
|
|
22
|
-
* @param init - The initialization options for the generator.
|
|
23
|
-
* @see {@linkcode AsyncSpliterator} for usage.
|
|
24
|
-
*/
|
|
25
|
-
static fromAsync: typeof AsyncSpliterator.from;
|
|
26
|
-
/**
|
|
27
|
-
* Create a spliterator from an iterable resource such as a **buffer, array, or string**.
|
|
28
|
-
*
|
|
29
|
-
* @param source - The data resource to read from.
|
|
30
|
-
* @param init - The initialization options for the generator.
|
|
31
|
-
*/
|
|
32
|
-
static fromSync<T extends CharacterSequenceInput>(source: T, init?: SpliteratorInit): Spliterator;
|
|
33
|
-
/**
|
|
34
|
-
* Create a spliterator from an iterable resource such as a **buffer or array**.
|
|
35
|
-
*
|
|
36
|
-
* @param source - The data resource to read from.
|
|
37
|
-
* @param init - The initialization options for the generator.
|
|
38
|
-
* @see {@linkcode Spliterator.fromSync} to ensure synchronous operation for string inputs.
|
|
39
|
-
*/
|
|
40
|
-
static from(source: DataView | ArrayBuffer | Buffer | Iterable<number>, init?: SpliteratorInit): Spliterator;
|
|
41
|
-
/**
|
|
42
|
-
* Create a new delimited generator from an **asynchronous byte stream**.
|
|
43
|
-
*
|
|
44
|
-
* @param source - The data resource to read from.
|
|
45
|
-
* @param init - The initialization options for the generator.
|
|
46
|
-
*
|
|
47
|
-
* @returns A new generator instance, yielding byte ranges.
|
|
48
|
-
*/
|
|
49
|
-
static from(source: AsyncChunkIterator, init?: AsyncSpliteratorInit): AsyncSpliterator;
|
|
50
|
-
/**
|
|
51
|
-
* Create a new delimited generator from a resource such as a **file handle or URL**.
|
|
52
|
-
*
|
|
53
|
-
* @param source - The data resource to read from.
|
|
54
|
-
* @param init - The initialization options for the generator.
|
|
55
|
-
*
|
|
56
|
-
* @returns A new generator instance, yielding byte ranges.
|
|
57
|
-
* @see {@linkcode Spliterator.fromSync} to ensure synchronous operation for string inputs.
|
|
58
|
-
*/
|
|
59
|
-
static from(source: AsyncDataResource, init?: AsyncSpliteratorInit): Promise<AsyncSpliterator>;
|
|
60
|
-
/**
|
|
61
|
-
* Create a new delimited generator from a resource such as a **file handle, URL, or byte stream**.
|
|
62
|
-
*
|
|
63
|
-
* @param source - The data resource to read from.
|
|
64
|
-
* @param init - The initialization options for the generator.
|
|
65
|
-
*
|
|
66
|
-
* @returns A new generator instance, yielding byte ranges.
|
|
67
|
-
* @see {@linkcode Spliterator.fromSync} to ensure synchronous operation for string inputs.
|
|
68
|
-
*/
|
|
69
|
-
static from(source: CharacterSequenceInput | AsyncDataResource | AsyncChunkIterator, init?: SpliteratorInit & AsyncSpliteratorInit): Spliterator | AsyncSpliterator | Promise<AsyncSpliterator>;
|
|
70
|
-
/**
|
|
71
|
-
* Create a new delimited generator from a data resource.
|
|
72
|
-
*/
|
|
73
|
-
static toTransformStream(init: SpliteratorInit): TransformStream<Uint8Array, Uint8Array[]>;
|
|
74
|
-
/**
|
|
75
|
-
* Dispose of the spliterator, closing the file handle if necessary.
|
|
76
|
-
*/
|
|
77
|
-
[Symbol.dispose](): void;
|
|
78
|
-
constructor(source: Uint8Array, init?: SpliteratorInit);
|
|
79
|
-
/**
|
|
80
|
-
* Read the next byte range from the source.
|
|
81
|
-
*/
|
|
82
|
-
next(): IteratorResult<R>;
|
|
83
|
-
/**
|
|
84
|
-
* Collect all the byte ranges from the file.
|
|
85
|
-
*
|
|
86
|
-
* @returns An array of encoded byte ranges.
|
|
87
|
-
* @see {@linkcode toDecodedArray} to automatically decode the byte ranges.
|
|
88
|
-
*/
|
|
89
|
-
toArray(): R[];
|
|
90
|
-
/**
|
|
91
|
-
* Collect all the byte ranges from the file as a string.
|
|
92
|
-
*/
|
|
93
|
-
toDecodedArray(decoder?: import("node:util").TextDecoder): string[];
|
|
94
|
-
[Symbol.iterator](): IterableIterator<R>;
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=Spliterator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Spliterator.d.ts","sourceRoot":"","sources":["../../lib/Spliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACzG,OAAO,EAIN,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAoB,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAkB,MAAM,aAAa,CAAA;AAE/G,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAE3B,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAA;AAErD;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAClF,YAAW,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU;;IAI1C;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,+BAAwB;IAExC;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,sBAAsB,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,GAAE,eAAoB,GAAG,WAAW,CAEpG;IAED;;;;;;OAMG;IACH,MAAM,CAAC,I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|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
// oxlint-disable-next-line unicorn/prefer-export-from
|
|
7
|
-
import { AsyncSpliterator } from "./AsyncSpliterator.js";
|
|
8
|
-
import { CharacterSequence, Delimiters, normalizeCharacterInput, } from "./CharacterSequence.js";
|
|
9
|
-
import { IndexQueue } from "./IndexQueue.js";
|
|
10
|
-
import { isFileHandleLike } from "./shared.js";
|
|
11
|
-
export { AsyncSpliterator };
|
|
12
|
-
/**
|
|
13
|
-
* A byte stream delimiting iterator.
|
|
14
|
-
*/
|
|
15
|
-
export class Spliterator {
|
|
16
|
-
//#region Lifecycle
|
|
17
|
-
/**
|
|
18
|
-
* Create a spliterator from an asynchronous resource such as a file.
|
|
19
|
-
*
|
|
20
|
-
* This is an alias for `AsyncSpliterator.from`.
|
|
21
|
-
*
|
|
22
|
-
* @param source - The data resource to read from.
|
|
23
|
-
* @param init - The initialization options for the generator.
|
|
24
|
-
* @see {@linkcode AsyncSpliterator} for usage.
|
|
25
|
-
*/
|
|
26
|
-
static fromAsync = AsyncSpliterator.from;
|
|
27
|
-
/**
|
|
28
|
-
* Create a spliterator from an iterable resource such as a **buffer, array, or string**.
|
|
29
|
-
*
|
|
30
|
-
* @param source - The data resource to read from.
|
|
31
|
-
* @param init - The initialization options for the generator.
|
|
32
|
-
*/
|
|
33
|
-
static fromSync(source, init = {}) {
|
|
34
|
-
return new Spliterator(normalizeCharacterInput(source), init);
|
|
35
|
-
}
|
|
36
|
-
static from(source, init = {}) {
|
|
37
|
-
if (typeof source === "object" && Symbol.asyncIterator in source) {
|
|
38
|
-
return new AsyncSpliterator(source, init);
|
|
39
|
-
}
|
|
40
|
-
if (typeof source === "string" || source instanceof URL || isFileHandleLike(source)) {
|
|
41
|
-
return import("spliterator/node/fs").then(async ({ createChunkIterator }) => {
|
|
42
|
-
let chunkIterator;
|
|
43
|
-
try {
|
|
44
|
-
chunkIterator = await createChunkIterator(source, {
|
|
45
|
-
highWaterMark: init.highWaterMark,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
if (typeof source === "string" || source instanceof URL) {
|
|
50
|
-
const wrapped = new Error("`Spliterator.from` was called with an invalid async data resource. Did you mean to use `Spliterator.fromSync`?");
|
|
51
|
-
wrapped.cause = error;
|
|
52
|
-
throw wrapped;
|
|
53
|
-
}
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
return new AsyncSpliterator(chunkIterator, init);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return new Spliterator(normalizeCharacterInput(source), init);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Create a new delimited generator from a data resource.
|
|
63
|
-
*/
|
|
64
|
-
static toTransformStream(init) {
|
|
65
|
-
return new TransformStream({
|
|
66
|
-
transform(chunk, controller) {
|
|
67
|
-
const spliterator = new Spliterator(chunk, init);
|
|
68
|
-
controller.enqueue(spliterator.toArray());
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Dispose of the spliterator, closing the file handle if necessary.
|
|
74
|
-
*/
|
|
75
|
-
[Symbol.dispose]() {
|
|
76
|
-
this.#indices.clear();
|
|
77
|
-
}
|
|
78
|
-
constructor(source, init = {}) {
|
|
79
|
-
this.#source = source;
|
|
80
|
-
this.#needle = new CharacterSequence(init.delimiter);
|
|
81
|
-
this.#readPosition = init.position ?? 0;
|
|
82
|
-
this.#highWaterMark = Math.max(this.#needle.length * 4, 4096);
|
|
83
|
-
this.#yieldDropCount = Math.max(0, init.drop ?? 0);
|
|
84
|
-
this.#yieldStopCount = Math.max(init.take ?? Infinity, 0) + this.#yieldDropCount;
|
|
85
|
-
this.#yieldByteEstimate = this.#source.byteLength - this.#readPosition;
|
|
86
|
-
this.#skipEmpty = init.skipEmpty ?? true;
|
|
87
|
-
this.#enableQuoteHandling = init.enableQuoteHandling ?? false;
|
|
88
|
-
this.#crlf = init.crlf ?? false;
|
|
89
|
-
this.#debug = init.debug ?? false;
|
|
90
|
-
this.#log = this.#debug ? console.debug.bind(console) : () => void 0;
|
|
91
|
-
}
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region Private Properties
|
|
94
|
-
/**
|
|
95
|
-
* The byte source to read from.
|
|
96
|
-
*/
|
|
97
|
-
#source;
|
|
98
|
-
/**
|
|
99
|
-
* A queue of index tuples marking the start and end of delimiter positions.
|
|
100
|
-
*
|
|
101
|
-
* Note that indices are relative to the buffer, not the file.
|
|
102
|
-
*
|
|
103
|
-
* This means that the start index is always 0, and the end index is the byte length of the buffer.
|
|
104
|
-
*/
|
|
105
|
-
#indices = new IndexQueue();
|
|
106
|
-
/**
|
|
107
|
-
* The byte sequence to search for, i.e. an encoded delimiter.
|
|
108
|
-
*/
|
|
109
|
-
#needle;
|
|
110
|
-
/**
|
|
111
|
-
* The byte sequence for a double quote.
|
|
112
|
-
*/
|
|
113
|
-
#doubleQuoteSequence = new CharacterSequence('"');
|
|
114
|
-
#enableQuoteHandling;
|
|
115
|
-
/**
|
|
116
|
-
* Whether to trim a carriage return immediately preceding each delimiter match.
|
|
117
|
-
*/
|
|
118
|
-
#crlf;
|
|
119
|
-
/**
|
|
120
|
-
* How many yields to skip.
|
|
121
|
-
*/
|
|
122
|
-
#yieldDropCount;
|
|
123
|
-
/**
|
|
124
|
-
* How many yields to allow before stopping.
|
|
125
|
-
*/
|
|
126
|
-
#yieldStopCount;
|
|
127
|
-
/**
|
|
128
|
-
* The total number of bytes we expect to yield.
|
|
129
|
-
*
|
|
130
|
-
* We use this to ensure that we don't miss any data as we read through the buffer.
|
|
131
|
-
*/
|
|
132
|
-
#yieldByteEstimate;
|
|
133
|
-
/**
|
|
134
|
-
* Whether to skip empty yields.
|
|
135
|
-
*/
|
|
136
|
-
#skipEmpty;
|
|
137
|
-
/**
|
|
138
|
-
* The high water mark for the buffer.
|
|
139
|
-
*
|
|
140
|
-
* This defines the total size of indices to keep in memory.
|
|
141
|
-
*/
|
|
142
|
-
#highWaterMark;
|
|
143
|
-
/**
|
|
144
|
-
* The total number of bytes we've yielded.
|
|
145
|
-
*/
|
|
146
|
-
#yieldedByteLength = 0;
|
|
147
|
-
/**
|
|
148
|
-
* The total number of yields.
|
|
149
|
-
*/
|
|
150
|
-
#yieldCount = 0;
|
|
151
|
-
/**
|
|
152
|
-
* The current byte index to perform read operations from.
|
|
153
|
-
*/
|
|
154
|
-
#readPosition;
|
|
155
|
-
/**
|
|
156
|
-
* The previous byte range seen while draining the buffer.
|
|
157
|
-
*/
|
|
158
|
-
#previousByteRange;
|
|
159
|
-
/**
|
|
160
|
-
* Whether to output debug information.
|
|
161
|
-
*/
|
|
162
|
-
#debug;
|
|
163
|
-
/**
|
|
164
|
-
* Whether the iterator is done.
|
|
165
|
-
*/
|
|
166
|
-
#done = false;
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region Private Methods
|
|
169
|
-
#log;
|
|
170
|
-
#finalize() {
|
|
171
|
-
if (this.#debug) {
|
|
172
|
-
/**
|
|
173
|
-
* The total number of bytes we expect to be omitted from the buffer. This is derived from the number of of yields
|
|
174
|
-
* and the length of the delimiter.
|
|
175
|
-
*/
|
|
176
|
-
const expectedYieldedDelimitedBytes = (this.#yieldCount - 1) * this.#needle.length;
|
|
177
|
-
const omittedBytes = this.#yieldByteEstimate - (this.#yieldedByteLength + expectedYieldedDelimitedBytes);
|
|
178
|
-
this.#log({
|
|
179
|
-
totalByteSize: this.#source.byteLength,
|
|
180
|
-
readPosition: this.#readPosition,
|
|
181
|
-
yieldByteEstimate: this.#yieldByteEstimate,
|
|
182
|
-
yieldedByteLength: this.#yieldedByteLength,
|
|
183
|
-
yieldCount: this.#yieldCount,
|
|
184
|
-
expectedYieldedDelimitedBytes,
|
|
185
|
-
omittedBytes,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
done: true,
|
|
190
|
-
value: undefined,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
#drain() {
|
|
194
|
-
const sourceByteLength = this.#source.byteLength;
|
|
195
|
-
this.#log("Reached end of file. Preparing to finalize.");
|
|
196
|
-
// There's a few special cases we could get this far and not have drained the buffer.
|
|
197
|
-
const lastByteRange = this.#previousByteRange;
|
|
198
|
-
if (this.#readPosition < sourceByteLength) {
|
|
199
|
-
this.#indices.enqueue([this.#readPosition, sourceByteLength]);
|
|
200
|
-
}
|
|
201
|
-
else if (this.#yieldCount === 0 && lastByteRange === undefined) {
|
|
202
|
-
// Nothing was ever found or yielded (e.g. an empty source) — emit the whole buffer as
|
|
203
|
-
// a single field. A run of all-empty fields that `skipEmpty` dropped has a defined
|
|
204
|
-
// `lastByteRange`, so it falls through to the trailing-delimiter case instead of
|
|
205
|
-
// resurfacing the entire delimiter run as one (non-empty) row.
|
|
206
|
-
this.#indices.enqueue([0, sourceByteLength]);
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
// Emit an empty field for a trailing delimiter (match String.split). `#fill` always
|
|
210
|
-
// leaves the tail after the last consumed delimiter to this method, in both the plain
|
|
211
|
-
// and quote-aware paths — a source ending exactly on a delimiter has an empty tail.
|
|
212
|
-
const trailingDelimPos = sourceByteLength - this.#needle.length;
|
|
213
|
-
if (trailingDelimPos >= 0 && this.#needle.search(this.#source, trailingDelimPos) !== -1) {
|
|
214
|
-
this.#indices.enqueue([sourceByteLength, sourceByteLength]);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
this.#done = true;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Trim a carriage return immediately preceding a delimiter match, when {@linkcode SpliteratorInit.crlf} is set.
|
|
221
|
-
* Affects only the emitted range's end — `#readPosition` advancement always uses the raw match offset.
|
|
222
|
-
*/
|
|
223
|
-
#trimEnd(start, end) {
|
|
224
|
-
if (this.#crlf && end > start && this.#source[end - 1] === Delimiters.CarriageReturn) {
|
|
225
|
-
return end - 1;
|
|
226
|
-
}
|
|
227
|
-
return end;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Fill the buffer with data and search for delimiters.
|
|
231
|
-
*/
|
|
232
|
-
#fill() {
|
|
233
|
-
const sourceByteLength = this.#source.byteLength;
|
|
234
|
-
if (!this.#enableQuoteHandling) {
|
|
235
|
-
while (this.#readPosition < sourceByteLength && this.#indices.byteLength < this.#highWaterMark) {
|
|
236
|
-
const delimiterIndex = this.#needle.search(this.#source, this.#readPosition);
|
|
237
|
-
if (delimiterIndex === -1)
|
|
238
|
-
return;
|
|
239
|
-
this.#indices.enqueue([this.#readPosition, this.#trimEnd(this.#readPosition, delimiterIndex)]);
|
|
240
|
-
this.#readPosition = delimiterIndex + this.#needle.length;
|
|
241
|
-
}
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
// Quote-aware path: a delimiter inside a double-quoted region does not split, and the
|
|
245
|
-
// emitted slices keep their quotes verbatim — stripping and `""` unescaping belong to the
|
|
246
|
-
// consumer (CSVSpliterator does both). The tail after the last consumed delimiter is left
|
|
247
|
-
// to `#drain`, same as the plain path.
|
|
248
|
-
while (this.#readPosition < sourceByteLength && this.#indices.byteLength < this.#highWaterMark) {
|
|
249
|
-
const matches = this.#needle.searchMatches(this.#source, this.#doubleQuoteSequence, this.#readPosition, sourceByteLength);
|
|
250
|
-
if (!matches.length)
|
|
251
|
-
return;
|
|
252
|
-
let sliceStart = this.#readPosition;
|
|
253
|
-
let insideQuotes = false;
|
|
254
|
-
for (const match of matches) {
|
|
255
|
-
if (match.patternId === 1) {
|
|
256
|
-
insideQuotes = !insideQuotes;
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
// A delimiter inside quotes is part of the slice, so skip it.
|
|
260
|
-
if (insideQuotes)
|
|
261
|
-
continue;
|
|
262
|
-
this.#indices.enqueue([sliceStart, this.#trimEnd(sliceStart, match.offset)]);
|
|
263
|
-
sliceStart = match.offset + this.#needle.length;
|
|
264
|
-
}
|
|
265
|
-
// No delimiter was consumed (e.g. an unclosed quote swallows the rest of the source) —
|
|
266
|
-
// leave the tail to `#drain` rather than rescanning the same matches forever.
|
|
267
|
-
if (sliceStart === this.#readPosition)
|
|
268
|
-
return;
|
|
269
|
-
this.#readPosition = sliceStart;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region Iterator Methods
|
|
274
|
-
/**
|
|
275
|
-
* Read the next byte range from the source.
|
|
276
|
-
*/
|
|
277
|
-
next() {
|
|
278
|
-
// Loop rather than recurse: a long run of skipped (empty or dropped) ranges would
|
|
279
|
-
// otherwise grow the call stack one frame per skip and overflow.
|
|
280
|
-
while (true) {
|
|
281
|
-
if (this.#done || this.#yieldCount >= this.#yieldStopCount)
|
|
282
|
-
return this.#finalize();
|
|
283
|
-
if (!this.#indices.size) {
|
|
284
|
-
this.#fill();
|
|
285
|
-
}
|
|
286
|
-
if (!this.#indices.size) {
|
|
287
|
-
this.#drain();
|
|
288
|
-
}
|
|
289
|
-
const currentByteRange = this.#indices.dequeue();
|
|
290
|
-
this.#previousByteRange = currentByteRange;
|
|
291
|
-
if (!currentByteRange) {
|
|
292
|
-
this.#done = true;
|
|
293
|
-
return this.#finalize();
|
|
294
|
-
}
|
|
295
|
-
const [start, end] = currentByteRange;
|
|
296
|
-
const slice = this.#source.subarray(start, end);
|
|
297
|
-
if (!slice.length && this.#skipEmpty) {
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
this.#yieldCount++;
|
|
301
|
-
if (this.#yieldCount <= this.#yieldDropCount) {
|
|
302
|
-
continue;
|
|
303
|
-
}
|
|
304
|
-
this.#yieldedByteLength += end - start;
|
|
305
|
-
return {
|
|
306
|
-
value: slice,
|
|
307
|
-
done: false,
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Collect all the byte ranges from the file.
|
|
313
|
-
*
|
|
314
|
-
* @returns An array of encoded byte ranges.
|
|
315
|
-
* @see {@linkcode toDecodedArray} to automatically decode the byte ranges.
|
|
316
|
-
*/
|
|
317
|
-
toArray() {
|
|
318
|
-
return Array.from(this);
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Collect all the byte ranges from the file as a string.
|
|
322
|
-
*/
|
|
323
|
-
toDecodedArray(decoder = new TextDecoder()) {
|
|
324
|
-
return Array.from(this, (bytes) => decoder.decode(bytes));
|
|
325
|
-
}
|
|
326
|
-
[Symbol.iterator]() {
|
|
327
|
-
return this;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
//# sourceMappingURL=Spliterator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Spliterator.js","sourceRoot":"","sources":["../../lib/Spliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sDAAsD;AACtD,OAAO,EAAE,gBAAgB,EAAmD,MAAM,uBAAuB,CAAA;AACzG,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,uBAAuB,GAEvB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAmE,MAAM,aAAa,CAAA;AAE/G,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAI3B;;GAEG;AACH,MAAM,OAAO,WAAW;IAGvB,mBAAmB;IAEnB;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAA;IAExC;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAmC,MAAS,EAAE,IAAI,GAAoB,EAAE;QACtF,OAAO,IAAI,WAAW,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAA;IAC9D,CAAC;IA0CD,MAAM,CAAC,IAAI,CACV,MAAuE,EACvE,IAAI,GAA2C,EAAE;QAEjD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,IAAI,MAAM,EAAE,CAAC;YAClE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
* @license MIT
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
import { CSVSpliterator } from "./CSVSpliterator.js";
|
|
7
|
-
/**
|
|
8
|
-
* A static class spliterator for tab-separated values.
|
|
9
|
-
*
|
|
10
|
-
* @see {@linkcode TSVSpliterator.from} for synchronous usage.
|
|
11
|
-
* @see {@linkcode TSVSpliterator.fromAsync} for asynchronous usage.
|
|
12
|
-
*/
|
|
13
|
-
export declare abstract class TSVSpliterator extends CSVSpliterator {
|
|
14
|
-
/**
|
|
15
|
-
* The column delimiter used by the spliterator.
|
|
16
|
-
*
|
|
17
|
-
* @default Delimiters.Tab
|
|
18
|
-
*/
|
|
19
|
-
static ColumnDelimiter: number;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=TSVSpliterator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TSVSpliterator.d.ts","sourceRoot":"","sources":["../../lib/TSVSpliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;GAKG;AACH,8BAAsB,cAAe,SAAQ,cAAc;IAC1D;;;;OAIG;IACH,OAAuB,eAAe,EAAE,MAAM,CAAiB;CAC/D"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license MIT
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
import { Delimiters } from "./CharacterSequence.js";
|
|
7
|
-
import { CSVSpliterator } from "./CSVSpliterator.js";
|
|
8
|
-
/**
|
|
9
|
-
* A static class spliterator for tab-separated values.
|
|
10
|
-
*
|
|
11
|
-
* @see {@linkcode TSVSpliterator.from} for synchronous usage.
|
|
12
|
-
* @see {@linkcode TSVSpliterator.fromAsync} for asynchronous usage.
|
|
13
|
-
*/
|
|
14
|
-
export class TSVSpliterator extends CSVSpliterator {
|
|
15
|
-
/**
|
|
16
|
-
* The column delimiter used by the spliterator.
|
|
17
|
-
*
|
|
18
|
-
* @default Delimiters.Tab
|
|
19
|
-
*/
|
|
20
|
-
static ColumnDelimiter = Delimiters.Tab;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=TSVSpliterator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TSVSpliterator.js","sourceRoot":"","sources":["../../lib/TSVSpliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,OAAgB,cAAe,SAAQ,cAAc;IAC1D;;;;OAIG;IACI,MAAM,CAAU,eAAe,GAAW,UAAU,CAAC,GAAG,CAAA;CAC/D"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license MIT
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
import { type AdaptiveSourceInit } from "./adaptive-source.js";
|
|
7
|
-
import { AsyncSequence } from "./AsyncSequence.js";
|
|
8
|
-
import type { CharacterSequenceInput } from "./CharacterSequence.js";
|
|
9
|
-
import type { AsyncDataResource } from "./shared.js";
|
|
10
|
-
import { type SpliteratorInit } from "./Spliterator.js";
|
|
11
|
-
export interface TextSpliteratorInit {
|
|
12
|
-
/**
|
|
13
|
-
* The encoding to use when decoding the data.
|
|
14
|
-
*
|
|
15
|
-
* @default "utf-8"
|
|
16
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder
|
|
17
|
-
*/
|
|
18
|
-
encoding?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Whether to throw an error when encountering invalid data, or to swap it with a replacement character.
|
|
21
|
-
*/
|
|
22
|
-
fatal?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Whether to ignore BOM characters.
|
|
25
|
-
*/
|
|
26
|
-
ignoreBOM?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare abstract class TextSpliterator {
|
|
29
|
-
constructor();
|
|
30
|
-
/**
|
|
31
|
-
* Synchronously yield delimited text from a byte array or string.
|
|
32
|
-
*
|
|
33
|
-
* @param source The source content to split.
|
|
34
|
-
* @param options The options to use when splitting the content.
|
|
35
|
-
*
|
|
36
|
-
* @yields Each slice of the source content.
|
|
37
|
-
* @see {@linkcode TextSpliterator.fromAsync} for asynchronous iteration with decoding.
|
|
38
|
-
* @see {@linkcode Spliterator.fromSync} for synchronous iteration without decoding.
|
|
39
|
-
*/
|
|
40
|
-
static from(source: CharacterSequenceInput, { encoding, fatal, ignoreBOM, ...options }?: TextSpliteratorInit & SpliteratorInit): Generator<string>;
|
|
41
|
-
/**
|
|
42
|
-
* Asynchronously yield delimited text from a byte array or string.
|
|
43
|
-
*
|
|
44
|
-
* @param source The async data resource to split.
|
|
45
|
-
* @param options The options to use when splitting the content.
|
|
46
|
-
*
|
|
47
|
-
* @yields Each slice of the source content.
|
|
48
|
-
* @see {@linkcode TextSpliterator.from} for synchronous iteration with decoding.
|
|
49
|
-
* @see {@linkcode Spliterator.fromAsync} for asynchronous iteration without decoding.
|
|
50
|
-
*/
|
|
51
|
-
static fromAsync(source: AsyncDataResource, { encoding, fatal, ignoreBOM, ...options }?: TextSpliteratorInit & AdaptiveSourceInit): AsyncSequence<string>;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=TextSpliterator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextSpliterator.d.ts","sourceRoot":"","sources":["../../lib/TextSpliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,sBAAsB,CAAA;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAA0C,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAE/F,MAAM,WAAW,mBAAmB;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,8BAAsB,eAAe;IACpC,cAEC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAE,IAAI,CACX,MAAM,EAAE,sBAAsB,EAC9B,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,GAAE,mBAAmB,GAAG,eAAoB,GACpF,SAAS,CAAC,MAAM,CAAC,CAsBnB;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CACf,MAAM,EAAE,iBAAiB,EACzB,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,GAAE,mBAAmB,GAAG,kBAAuB,GACvF,aAAa,CAAC,MAAM,CAAC,CAevB;CACD"}
|