agdi 3.3.5 → 3.3.7

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 (36) hide show
  1. package/README.md +13 -0
  2. package/dist/APEv2Parser-EU45AV6X.js +14 -0
  3. package/dist/AiffParser-FOX7GQ42.js +189 -0
  4. package/dist/AsfParser-HD5CSGIO.js +610 -0
  5. package/dist/DsdiffParser-OJREDMBI.js +188 -0
  6. package/dist/DsfParser-2YL4ARJ7.js +110 -0
  7. package/dist/FlacParser-IVV4RYF6.js +15 -0
  8. package/dist/MP4Parser-NLX4A2YN.js +1140 -0
  9. package/dist/MatroskaParser-4OEK43GF.js +654 -0
  10. package/dist/MpegParser-PXKEUF2B.js +642 -0
  11. package/dist/MusepackParser-54QGYRLY.js +322 -0
  12. package/dist/OggParser-KRV5QCGZ.js +435 -0
  13. package/dist/WavPackParser-XPZSQFVS.js +203 -0
  14. package/dist/WaveParser-27IS2RAI.js +294 -0
  15. package/dist/chunk-2B4QMSZW.js +311 -0
  16. package/dist/chunk-3JKZUGPJ.js +70 -0
  17. package/dist/chunk-4VNS5WPM.js +42 -0
  18. package/dist/chunk-65JVFJ3X.js +729 -0
  19. package/dist/chunk-6OKLAJRQ.js +0 -0
  20. package/dist/chunk-AGSFUVRG.js +439 -0
  21. package/dist/chunk-GD35BJSH.js +177 -0
  22. package/dist/chunk-HNLU36CC.js +702 -0
  23. package/dist/{chunk-M2FF7ETI.js → chunk-J6OLLWVT.js} +1 -1
  24. package/dist/chunk-LREP5CZP.js +146 -0
  25. package/dist/chunk-M54HVABG.js +34 -0
  26. package/dist/{chunk-S45VXJEO.js → chunk-OPFFFAQC.js} +19 -1
  27. package/dist/chunk-VGOIHW7D.js +1529 -0
  28. package/dist/chunk-YIHDW7JC.js +314 -0
  29. package/dist/config-D3QBUN2Y.js +13 -0
  30. package/dist/{config-ZFU7TSU2.js → config-K2XM6D4Z.js} +3 -2
  31. package/dist/{event-bus-Q3WCETQQ.js → event-bus-MO5SFUME.js} +1 -0
  32. package/dist/index.js +3273 -1274
  33. package/dist/lib-2XISBYT3.js +144950 -0
  34. package/dist/lib-HCGLI2GJ.js +4161 -0
  35. package/dist/{telemetry-service-OHU5NKON.js → telemetry-service-76YPOPDM.js} +8 -4
  36. package/package.json +6 -3
@@ -0,0 +1,702 @@
1
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/Errors.js
2
+ var defaultMessages = "End-Of-Stream";
3
+ var EndOfStreamError = class extends Error {
4
+ constructor() {
5
+ super(defaultMessages);
6
+ this.name = "EndOfStreamError";
7
+ }
8
+ };
9
+ var AbortError = class extends Error {
10
+ constructor(message = "The operation was aborted") {
11
+ super(message);
12
+ this.name = "AbortError";
13
+ }
14
+ };
15
+
16
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/Deferred.js
17
+ var Deferred = class {
18
+ constructor() {
19
+ this.resolve = () => null;
20
+ this.reject = () => null;
21
+ this.promise = new Promise((resolve, reject) => {
22
+ this.reject = reject;
23
+ this.resolve = resolve;
24
+ });
25
+ }
26
+ };
27
+
28
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/AbstractStreamReader.js
29
+ var AbstractStreamReader = class {
30
+ constructor() {
31
+ this.endOfStream = false;
32
+ this.interrupted = false;
33
+ this.peekQueue = [];
34
+ }
35
+ async peek(uint8Array, mayBeLess = false) {
36
+ const bytesRead = await this.read(uint8Array, mayBeLess);
37
+ this.peekQueue.push(uint8Array.subarray(0, bytesRead));
38
+ return bytesRead;
39
+ }
40
+ async read(buffer, mayBeLess = false) {
41
+ if (buffer.length === 0) {
42
+ return 0;
43
+ }
44
+ let bytesRead = this.readFromPeekBuffer(buffer);
45
+ if (!this.endOfStream) {
46
+ bytesRead += await this.readRemainderFromStream(buffer.subarray(bytesRead), mayBeLess);
47
+ }
48
+ if (bytesRead === 0 && !mayBeLess) {
49
+ throw new EndOfStreamError();
50
+ }
51
+ return bytesRead;
52
+ }
53
+ /**
54
+ * Read chunk from stream
55
+ * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in
56
+ * @returns Number of bytes read
57
+ */
58
+ readFromPeekBuffer(buffer) {
59
+ let remaining = buffer.length;
60
+ let bytesRead = 0;
61
+ while (this.peekQueue.length > 0 && remaining > 0) {
62
+ const peekData = this.peekQueue.pop();
63
+ if (!peekData)
64
+ throw new Error("peekData should be defined");
65
+ const lenCopy = Math.min(peekData.length, remaining);
66
+ buffer.set(peekData.subarray(0, lenCopy), bytesRead);
67
+ bytesRead += lenCopy;
68
+ remaining -= lenCopy;
69
+ if (lenCopy < peekData.length) {
70
+ this.peekQueue.push(peekData.subarray(lenCopy));
71
+ }
72
+ }
73
+ return bytesRead;
74
+ }
75
+ async readRemainderFromStream(buffer, mayBeLess) {
76
+ let bytesRead = 0;
77
+ while (bytesRead < buffer.length && !this.endOfStream) {
78
+ if (this.interrupted) {
79
+ throw new AbortError();
80
+ }
81
+ const chunkLen = await this.readFromStream(buffer.subarray(bytesRead), mayBeLess);
82
+ if (chunkLen === 0)
83
+ break;
84
+ bytesRead += chunkLen;
85
+ }
86
+ if (!mayBeLess && bytesRead < buffer.length) {
87
+ throw new EndOfStreamError();
88
+ }
89
+ return bytesRead;
90
+ }
91
+ };
92
+
93
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/StreamReader.js
94
+ var StreamReader = class extends AbstractStreamReader {
95
+ constructor(s) {
96
+ super();
97
+ this.s = s;
98
+ this.deferred = null;
99
+ if (!s.read || !s.once) {
100
+ throw new Error("Expected an instance of stream.Readable");
101
+ }
102
+ this.s.once("end", () => {
103
+ this.endOfStream = true;
104
+ if (this.deferred) {
105
+ this.deferred.resolve(0);
106
+ }
107
+ });
108
+ this.s.once("error", (err) => this.reject(err));
109
+ this.s.once("close", () => this.abort());
110
+ }
111
+ /**
112
+ * Read chunk from stream
113
+ * @param buffer Target Uint8Array (or Buffer) to store data read from stream in
114
+ * @param mayBeLess - If true, may fill the buffer partially
115
+ * @returns Number of bytes read
116
+ */
117
+ async readFromStream(buffer, mayBeLess) {
118
+ if (buffer.length === 0)
119
+ return 0;
120
+ const readBuffer = this.s.read(buffer.length);
121
+ if (readBuffer) {
122
+ buffer.set(readBuffer);
123
+ return readBuffer.length;
124
+ }
125
+ const request = {
126
+ buffer,
127
+ mayBeLess,
128
+ deferred: new Deferred()
129
+ };
130
+ this.deferred = request.deferred;
131
+ this.s.once("readable", () => {
132
+ this.readDeferred(request);
133
+ });
134
+ return request.deferred.promise;
135
+ }
136
+ /**
137
+ * Process deferred read request
138
+ * @param request Deferred read request
139
+ */
140
+ readDeferred(request) {
141
+ const readBuffer = this.s.read(request.buffer.length);
142
+ if (readBuffer) {
143
+ request.buffer.set(readBuffer);
144
+ request.deferred.resolve(readBuffer.length);
145
+ this.deferred = null;
146
+ } else {
147
+ this.s.once("readable", () => {
148
+ this.readDeferred(request);
149
+ });
150
+ }
151
+ }
152
+ reject(err) {
153
+ this.interrupted = true;
154
+ if (this.deferred) {
155
+ this.deferred.reject(err);
156
+ this.deferred = null;
157
+ }
158
+ }
159
+ async abort() {
160
+ this.reject(new AbortError());
161
+ }
162
+ async close() {
163
+ return this.abort();
164
+ }
165
+ };
166
+
167
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/WebStreamReader.js
168
+ var WebStreamReader = class extends AbstractStreamReader {
169
+ constructor(reader) {
170
+ super();
171
+ this.reader = reader;
172
+ }
173
+ async abort() {
174
+ return this.close();
175
+ }
176
+ async close() {
177
+ this.reader.releaseLock();
178
+ }
179
+ };
180
+
181
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/WebStreamByobReader.js
182
+ var WebStreamByobReader = class extends WebStreamReader {
183
+ /**
184
+ * Read from stream
185
+ * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in
186
+ * @param mayBeLess - If true, may fill the buffer partially
187
+ * @protected Bytes read
188
+ */
189
+ async readFromStream(buffer, mayBeLess) {
190
+ if (buffer.length === 0)
191
+ return 0;
192
+ const result = await this.reader.read(new Uint8Array(buffer.length), { min: mayBeLess ? void 0 : buffer.length });
193
+ if (result.done) {
194
+ this.endOfStream = result.done;
195
+ }
196
+ if (result.value) {
197
+ buffer.set(result.value);
198
+ return result.value.length;
199
+ }
200
+ return 0;
201
+ }
202
+ };
203
+
204
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js
205
+ var WebStreamDefaultReader = class extends AbstractStreamReader {
206
+ constructor(reader) {
207
+ super();
208
+ this.reader = reader;
209
+ this.buffer = null;
210
+ }
211
+ /**
212
+ * Copy chunk to target, and store the remainder in this.buffer
213
+ */
214
+ writeChunk(target, chunk) {
215
+ const written = Math.min(chunk.length, target.length);
216
+ target.set(chunk.subarray(0, written));
217
+ if (written < chunk.length) {
218
+ this.buffer = chunk.subarray(written);
219
+ } else {
220
+ this.buffer = null;
221
+ }
222
+ return written;
223
+ }
224
+ /**
225
+ * Read from stream
226
+ * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in
227
+ * @param mayBeLess - If true, may fill the buffer partially
228
+ * @protected Bytes read
229
+ */
230
+ async readFromStream(buffer, mayBeLess) {
231
+ if (buffer.length === 0)
232
+ return 0;
233
+ let totalBytesRead = 0;
234
+ if (this.buffer) {
235
+ totalBytesRead += this.writeChunk(buffer, this.buffer);
236
+ }
237
+ while (totalBytesRead < buffer.length && !this.endOfStream) {
238
+ const result = await this.reader.read();
239
+ if (result.done) {
240
+ this.endOfStream = true;
241
+ break;
242
+ }
243
+ if (result.value) {
244
+ totalBytesRead += this.writeChunk(buffer.subarray(totalBytesRead), result.value);
245
+ }
246
+ }
247
+ if (!mayBeLess && totalBytesRead === 0 && this.endOfStream) {
248
+ throw new EndOfStreamError();
249
+ }
250
+ return totalBytesRead;
251
+ }
252
+ abort() {
253
+ this.interrupted = true;
254
+ return this.reader.cancel();
255
+ }
256
+ async close() {
257
+ await this.abort();
258
+ this.reader.releaseLock();
259
+ }
260
+ };
261
+
262
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js
263
+ function makeWebStreamReader(stream) {
264
+ try {
265
+ const reader = stream.getReader({ mode: "byob" });
266
+ if (reader instanceof ReadableStreamDefaultReader) {
267
+ return new WebStreamDefaultReader(reader);
268
+ }
269
+ return new WebStreamByobReader(reader);
270
+ } catch (error) {
271
+ if (error instanceof TypeError) {
272
+ return new WebStreamDefaultReader(stream.getReader());
273
+ }
274
+ throw error;
275
+ }
276
+ }
277
+
278
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/AbstractTokenizer.js
279
+ var AbstractTokenizer = class {
280
+ /**
281
+ * Constructor
282
+ * @param options Tokenizer options
283
+ * @protected
284
+ */
285
+ constructor(options) {
286
+ this.numBuffer = new Uint8Array(8);
287
+ this.position = 0;
288
+ this.onClose = options?.onClose;
289
+ if (options?.abortSignal) {
290
+ options.abortSignal.addEventListener("abort", () => {
291
+ this.abort();
292
+ });
293
+ }
294
+ }
295
+ /**
296
+ * Read a token from the tokenizer-stream
297
+ * @param token - The token to read
298
+ * @param position - If provided, the desired position in the tokenizer-stream
299
+ * @returns Promise with token data
300
+ */
301
+ async readToken(token, position = this.position) {
302
+ const uint8Array = new Uint8Array(token.len);
303
+ const len = await this.readBuffer(uint8Array, { position });
304
+ if (len < token.len)
305
+ throw new EndOfStreamError();
306
+ return token.get(uint8Array, 0);
307
+ }
308
+ /**
309
+ * Peek a token from the tokenizer-stream.
310
+ * @param token - Token to peek from the tokenizer-stream.
311
+ * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position.
312
+ * @returns Promise with token data
313
+ */
314
+ async peekToken(token, position = this.position) {
315
+ const uint8Array = new Uint8Array(token.len);
316
+ const len = await this.peekBuffer(uint8Array, { position });
317
+ if (len < token.len)
318
+ throw new EndOfStreamError();
319
+ return token.get(uint8Array, 0);
320
+ }
321
+ /**
322
+ * Read a numeric token from the stream
323
+ * @param token - Numeric token
324
+ * @returns Promise with number
325
+ */
326
+ async readNumber(token) {
327
+ const len = await this.readBuffer(this.numBuffer, { length: token.len });
328
+ if (len < token.len)
329
+ throw new EndOfStreamError();
330
+ return token.get(this.numBuffer, 0);
331
+ }
332
+ /**
333
+ * Read a numeric token from the stream
334
+ * @param token - Numeric token
335
+ * @returns Promise with number
336
+ */
337
+ async peekNumber(token) {
338
+ const len = await this.peekBuffer(this.numBuffer, { length: token.len });
339
+ if (len < token.len)
340
+ throw new EndOfStreamError();
341
+ return token.get(this.numBuffer, 0);
342
+ }
343
+ /**
344
+ * Ignore number of bytes, advances the pointer in under tokenizer-stream.
345
+ * @param length - Number of bytes to ignore
346
+ * @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available
347
+ */
348
+ async ignore(length) {
349
+ if (this.fileInfo.size !== void 0) {
350
+ const bytesLeft = this.fileInfo.size - this.position;
351
+ if (length > bytesLeft) {
352
+ this.position += bytesLeft;
353
+ return bytesLeft;
354
+ }
355
+ }
356
+ this.position += length;
357
+ return length;
358
+ }
359
+ async close() {
360
+ await this.abort();
361
+ await this.onClose?.();
362
+ }
363
+ normalizeOptions(uint8Array, options) {
364
+ if (!this.supportsRandomAccess() && options && options.position !== void 0 && options.position < this.position) {
365
+ throw new Error("`options.position` must be equal or greater than `tokenizer.position`");
366
+ }
367
+ return {
368
+ ...{
369
+ mayBeLess: false,
370
+ offset: 0,
371
+ length: uint8Array.length,
372
+ position: this.position
373
+ },
374
+ ...options
375
+ };
376
+ }
377
+ abort() {
378
+ return Promise.resolve();
379
+ }
380
+ };
381
+
382
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/ReadStreamTokenizer.js
383
+ var maxBufferSize = 256e3;
384
+ var ReadStreamTokenizer = class extends AbstractTokenizer {
385
+ /**
386
+ * Constructor
387
+ * @param streamReader stream-reader to read from
388
+ * @param options Tokenizer options
389
+ */
390
+ constructor(streamReader, options) {
391
+ super(options);
392
+ this.streamReader = streamReader;
393
+ this.fileInfo = options?.fileInfo ?? {};
394
+ }
395
+ /**
396
+ * Read buffer from tokenizer
397
+ * @param uint8Array - Target Uint8Array to fill with data read from the tokenizer-stream
398
+ * @param options - Read behaviour options
399
+ * @returns Promise with number of bytes read
400
+ */
401
+ async readBuffer(uint8Array, options) {
402
+ const normOptions = this.normalizeOptions(uint8Array, options);
403
+ const skipBytes = normOptions.position - this.position;
404
+ if (skipBytes > 0) {
405
+ await this.ignore(skipBytes);
406
+ return this.readBuffer(uint8Array, options);
407
+ }
408
+ if (skipBytes < 0) {
409
+ throw new Error("`options.position` must be equal or greater than `tokenizer.position`");
410
+ }
411
+ if (normOptions.length === 0) {
412
+ return 0;
413
+ }
414
+ const bytesRead = await this.streamReader.read(uint8Array.subarray(0, normOptions.length), normOptions.mayBeLess);
415
+ this.position += bytesRead;
416
+ if ((!options || !options.mayBeLess) && bytesRead < normOptions.length) {
417
+ throw new EndOfStreamError();
418
+ }
419
+ return bytesRead;
420
+ }
421
+ /**
422
+ * Peek (read ahead) buffer from tokenizer
423
+ * @param uint8Array - Uint8Array (or Buffer) to write data to
424
+ * @param options - Read behaviour options
425
+ * @returns Promise with number of bytes peeked
426
+ */
427
+ async peekBuffer(uint8Array, options) {
428
+ const normOptions = this.normalizeOptions(uint8Array, options);
429
+ let bytesRead = 0;
430
+ if (normOptions.position) {
431
+ const skipBytes = normOptions.position - this.position;
432
+ if (skipBytes > 0) {
433
+ const skipBuffer = new Uint8Array(normOptions.length + skipBytes);
434
+ bytesRead = await this.peekBuffer(skipBuffer, { mayBeLess: normOptions.mayBeLess });
435
+ uint8Array.set(skipBuffer.subarray(skipBytes));
436
+ return bytesRead - skipBytes;
437
+ }
438
+ if (skipBytes < 0) {
439
+ throw new Error("Cannot peek from a negative offset in a stream");
440
+ }
441
+ }
442
+ if (normOptions.length > 0) {
443
+ try {
444
+ bytesRead = await this.streamReader.peek(uint8Array.subarray(0, normOptions.length), normOptions.mayBeLess);
445
+ } catch (err) {
446
+ if (options?.mayBeLess && err instanceof EndOfStreamError) {
447
+ return 0;
448
+ }
449
+ throw err;
450
+ }
451
+ if (!normOptions.mayBeLess && bytesRead < normOptions.length) {
452
+ throw new EndOfStreamError();
453
+ }
454
+ }
455
+ return bytesRead;
456
+ }
457
+ async ignore(length) {
458
+ const bufSize = Math.min(maxBufferSize, length);
459
+ const buf = new Uint8Array(bufSize);
460
+ let totBytesRead = 0;
461
+ while (totBytesRead < length) {
462
+ const remaining = length - totBytesRead;
463
+ const bytesRead = await this.readBuffer(buf, { length: Math.min(bufSize, remaining) });
464
+ if (bytesRead < 0) {
465
+ return bytesRead;
466
+ }
467
+ totBytesRead += bytesRead;
468
+ }
469
+ return totBytesRead;
470
+ }
471
+ abort() {
472
+ return this.streamReader.abort();
473
+ }
474
+ async close() {
475
+ return this.streamReader.close();
476
+ }
477
+ supportsRandomAccess() {
478
+ return false;
479
+ }
480
+ };
481
+
482
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/BufferTokenizer.js
483
+ var BufferTokenizer = class extends AbstractTokenizer {
484
+ /**
485
+ * Construct BufferTokenizer
486
+ * @param uint8Array - Uint8Array to tokenize
487
+ * @param options Tokenizer options
488
+ */
489
+ constructor(uint8Array, options) {
490
+ super(options);
491
+ this.uint8Array = uint8Array;
492
+ this.fileInfo = { ...options?.fileInfo ?? {}, ...{ size: uint8Array.length } };
493
+ }
494
+ /**
495
+ * Read buffer from tokenizer
496
+ * @param uint8Array - Uint8Array to tokenize
497
+ * @param options - Read behaviour options
498
+ * @returns {Promise<number>}
499
+ */
500
+ async readBuffer(uint8Array, options) {
501
+ if (options?.position) {
502
+ this.position = options.position;
503
+ }
504
+ const bytesRead = await this.peekBuffer(uint8Array, options);
505
+ this.position += bytesRead;
506
+ return bytesRead;
507
+ }
508
+ /**
509
+ * Peek (read ahead) buffer from tokenizer
510
+ * @param uint8Array
511
+ * @param options - Read behaviour options
512
+ * @returns {Promise<number>}
513
+ */
514
+ async peekBuffer(uint8Array, options) {
515
+ const normOptions = this.normalizeOptions(uint8Array, options);
516
+ const bytes2read = Math.min(this.uint8Array.length - normOptions.position, normOptions.length);
517
+ if (!normOptions.mayBeLess && bytes2read < normOptions.length) {
518
+ throw new EndOfStreamError();
519
+ }
520
+ uint8Array.set(this.uint8Array.subarray(normOptions.position, normOptions.position + bytes2read));
521
+ return bytes2read;
522
+ }
523
+ close() {
524
+ return super.close();
525
+ }
526
+ supportsRandomAccess() {
527
+ return true;
528
+ }
529
+ setPosition(position) {
530
+ this.position = position;
531
+ }
532
+ };
533
+
534
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/BlobTokenizer.js
535
+ var BlobTokenizer = class extends AbstractTokenizer {
536
+ /**
537
+ * Construct BufferTokenizer
538
+ * @param blob - Uint8Array to tokenize
539
+ * @param options Tokenizer options
540
+ */
541
+ constructor(blob, options) {
542
+ super(options);
543
+ this.blob = blob;
544
+ this.fileInfo = { ...options?.fileInfo ?? {}, ...{ size: blob.size, mimeType: blob.type } };
545
+ }
546
+ /**
547
+ * Read buffer from tokenizer
548
+ * @param uint8Array - Uint8Array to tokenize
549
+ * @param options - Read behaviour options
550
+ * @returns {Promise<number>}
551
+ */
552
+ async readBuffer(uint8Array, options) {
553
+ if (options?.position) {
554
+ this.position = options.position;
555
+ }
556
+ const bytesRead = await this.peekBuffer(uint8Array, options);
557
+ this.position += bytesRead;
558
+ return bytesRead;
559
+ }
560
+ /**
561
+ * Peek (read ahead) buffer from tokenizer
562
+ * @param buffer
563
+ * @param options - Read behaviour options
564
+ * @returns {Promise<number>}
565
+ */
566
+ async peekBuffer(buffer, options) {
567
+ const normOptions = this.normalizeOptions(buffer, options);
568
+ const bytes2read = Math.min(this.blob.size - normOptions.position, normOptions.length);
569
+ if (!normOptions.mayBeLess && bytes2read < normOptions.length) {
570
+ throw new EndOfStreamError();
571
+ }
572
+ const arrayBuffer = await this.blob.slice(normOptions.position, normOptions.position + bytes2read).arrayBuffer();
573
+ buffer.set(new Uint8Array(arrayBuffer));
574
+ return bytes2read;
575
+ }
576
+ close() {
577
+ return super.close();
578
+ }
579
+ supportsRandomAccess() {
580
+ return true;
581
+ }
582
+ setPosition(position) {
583
+ this.position = position;
584
+ }
585
+ };
586
+
587
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/core.js
588
+ function fromStream(stream, options) {
589
+ const streamReader = new StreamReader(stream);
590
+ const _options = options ?? {};
591
+ const chainedClose = _options.onClose;
592
+ _options.onClose = async () => {
593
+ await streamReader.close();
594
+ if (chainedClose) {
595
+ return chainedClose();
596
+ }
597
+ };
598
+ return new ReadStreamTokenizer(streamReader, _options);
599
+ }
600
+ function fromWebStream(webStream, options) {
601
+ const webStreamReader = makeWebStreamReader(webStream);
602
+ const _options = options ?? {};
603
+ const chainedClose = _options.onClose;
604
+ _options.onClose = async () => {
605
+ await webStreamReader.close();
606
+ if (chainedClose) {
607
+ return chainedClose();
608
+ }
609
+ };
610
+ return new ReadStreamTokenizer(webStreamReader, _options);
611
+ }
612
+ function fromBuffer(uint8Array, options) {
613
+ return new BufferTokenizer(uint8Array, options);
614
+ }
615
+ function fromBlob(blob, options) {
616
+ return new BlobTokenizer(blob, options);
617
+ }
618
+
619
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/index.js
620
+ import { stat as fsStat } from "fs/promises";
621
+
622
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/FileTokenizer.js
623
+ import { open as fsOpen } from "fs/promises";
624
+ var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
625
+ /**
626
+ * Create tokenizer from provided file path
627
+ * @param sourceFilePath File path
628
+ */
629
+ static async fromFile(sourceFilePath) {
630
+ const fileHandle = await fsOpen(sourceFilePath, "r");
631
+ const stat = await fileHandle.stat();
632
+ return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat.size } });
633
+ }
634
+ constructor(fileHandle, options) {
635
+ super(options);
636
+ this.fileHandle = fileHandle;
637
+ this.fileInfo = options.fileInfo;
638
+ }
639
+ /**
640
+ * Read buffer from file
641
+ * @param uint8Array - Uint8Array to write result to
642
+ * @param options - Read behaviour options
643
+ * @returns Promise number of bytes read
644
+ */
645
+ async readBuffer(uint8Array, options) {
646
+ const normOptions = this.normalizeOptions(uint8Array, options);
647
+ this.position = normOptions.position;
648
+ if (normOptions.length === 0)
649
+ return 0;
650
+ const res = await this.fileHandle.read(uint8Array, 0, normOptions.length, normOptions.position);
651
+ this.position += res.bytesRead;
652
+ if (res.bytesRead < normOptions.length && (!options || !options.mayBeLess)) {
653
+ throw new EndOfStreamError();
654
+ }
655
+ return res.bytesRead;
656
+ }
657
+ /**
658
+ * Peek buffer from file
659
+ * @param uint8Array - Uint8Array (or Buffer) to write data to
660
+ * @param options - Read behaviour options
661
+ * @returns Promise number of bytes read
662
+ */
663
+ async peekBuffer(uint8Array, options) {
664
+ const normOptions = this.normalizeOptions(uint8Array, options);
665
+ const res = await this.fileHandle.read(uint8Array, 0, normOptions.length, normOptions.position);
666
+ if (!normOptions.mayBeLess && res.bytesRead < normOptions.length) {
667
+ throw new EndOfStreamError();
668
+ }
669
+ return res.bytesRead;
670
+ }
671
+ async close() {
672
+ await this.fileHandle.close();
673
+ return super.close();
674
+ }
675
+ setPosition(position) {
676
+ this.position = position;
677
+ }
678
+ supportsRandomAccess() {
679
+ return true;
680
+ }
681
+ };
682
+
683
+ // ../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/index.js
684
+ async function fromStream2(stream, options) {
685
+ const rst = fromStream(stream, options);
686
+ if (stream.path) {
687
+ const stat = await fsStat(stream.path);
688
+ rst.fileInfo.path = stream.path;
689
+ rst.fileInfo.size = stat.size;
690
+ }
691
+ return rst;
692
+ }
693
+ var fromFile = FileTokenizer.fromFile;
694
+
695
+ export {
696
+ EndOfStreamError,
697
+ fromWebStream,
698
+ fromBuffer,
699
+ fromBlob,
700
+ fromStream2 as fromStream,
701
+ fromFile
702
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadConfig,
3
3
  saveConfig
4
- } from "./chunk-S45VXJEO.js";
4
+ } from "./chunk-OPFFFAQC.js";
5
5
 
6
6
  // src/core/telemetry/config.ts
7
7
  import { randomUUID } from "crypto";