@small-ltsc/sdk 0.2.4 → 0.2.11

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.
@@ -0,0 +1,1212 @@
1
+ /* @ts-self-types="./small_ltsc_core.d.ts" */
2
+
3
+ /**
4
+ * Configuration for compression.
5
+ */
6
+ export class CompressionConfig {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ CompressionConfigFinalization.unregister(this);
11
+ return ptr;
12
+ }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_compressionconfig_free(ptr, 0);
16
+ }
17
+ /**
18
+ * @returns {string}
19
+ */
20
+ get meta_token_prefix() {
21
+ let deferred1_0;
22
+ let deferred1_1;
23
+ try {
24
+ const ret = wasm.compressionconfig_meta_token_prefix(this.__wbg_ptr);
25
+ deferred1_0 = ret[0];
26
+ deferred1_1 = ret[1];
27
+ return getStringFromWasm0(ret[0], ret[1]);
28
+ } finally {
29
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
30
+ }
31
+ }
32
+ /**
33
+ * @returns {string}
34
+ */
35
+ get meta_token_suffix() {
36
+ let deferred1_0;
37
+ let deferred1_1;
38
+ try {
39
+ const ret = wasm.compressionconfig_meta_token_suffix(this.__wbg_ptr);
40
+ deferred1_0 = ret[0];
41
+ deferred1_1 = ret[1];
42
+ return getStringFromWasm0(ret[0], ret[1]);
43
+ } finally {
44
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
45
+ }
46
+ }
47
+ constructor() {
48
+ const ret = wasm.compressionconfig_new();
49
+ this.__wbg_ptr = ret >>> 0;
50
+ CompressionConfigFinalization.register(this, this.__wbg_ptr, this);
51
+ return this;
52
+ }
53
+ /**
54
+ * @returns {string}
55
+ */
56
+ get selection_mode() {
57
+ let deferred1_0;
58
+ let deferred1_1;
59
+ try {
60
+ const ret = wasm.compressionconfig_selection_mode(this.__wbg_ptr);
61
+ deferred1_0 = ret[0];
62
+ deferred1_1 = ret[1];
63
+ return getStringFromWasm0(ret[0], ret[1]);
64
+ } finally {
65
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
66
+ }
67
+ }
68
+ /**
69
+ * @param {string} prefix
70
+ */
71
+ set meta_token_prefix(prefix) {
72
+ const ptr0 = passStringToWasm0(prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
73
+ const len0 = WASM_VECTOR_LEN;
74
+ wasm.compressionconfig_set_meta_token_prefix(this.__wbg_ptr, ptr0, len0);
75
+ }
76
+ /**
77
+ * @param {string} suffix
78
+ */
79
+ set meta_token_suffix(suffix) {
80
+ const ptr0 = passStringToWasm0(suffix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
81
+ const len0 = WASM_VECTOR_LEN;
82
+ wasm.compressionconfig_set_meta_token_suffix(this.__wbg_ptr, ptr0, len0);
83
+ }
84
+ /**
85
+ * @param {string} mode
86
+ */
87
+ set selection_mode(mode) {
88
+ const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
89
+ const len0 = WASM_VECTOR_LEN;
90
+ wasm.compressionconfig_set_selection_mode(this.__wbg_ptr, ptr0, len0);
91
+ }
92
+ /**
93
+ * Beam width for beam search
94
+ * @returns {number}
95
+ */
96
+ get beam_width() {
97
+ const ret = wasm.__wbg_get_compressionconfig_beam_width(this.__wbg_ptr);
98
+ return ret >>> 0;
99
+ }
100
+ /**
101
+ * Dictionary end delimiter token ID
102
+ * @returns {number}
103
+ */
104
+ get dict_end_token() {
105
+ const ret = wasm.__wbg_get_compressionconfig_dict_end_token(this.__wbg_ptr);
106
+ return ret >>> 0;
107
+ }
108
+ /**
109
+ * Whether to include length tokens in dictionary
110
+ * @returns {boolean}
111
+ */
112
+ get dict_length_enabled() {
113
+ const ret = wasm.__wbg_get_compressionconfig_dict_length_enabled(this.__wbg_ptr);
114
+ return ret !== 0;
115
+ }
116
+ /**
117
+ * Dictionary start delimiter token ID
118
+ * @returns {number}
119
+ */
120
+ get dict_start_token() {
121
+ const ret = wasm.__wbg_get_compressionconfig_dict_start_token(this.__wbg_ptr);
122
+ return ret >>> 0;
123
+ }
124
+ /**
125
+ * Enable hierarchical compression
126
+ * @returns {boolean}
127
+ */
128
+ get hierarchical_enabled() {
129
+ const ret = wasm.__wbg_get_compressionconfig_hierarchical_enabled(this.__wbg_ptr);
130
+ return ret !== 0;
131
+ }
132
+ /**
133
+ * Maximum hierarchical compression depth
134
+ * @returns {number}
135
+ */
136
+ get hierarchical_max_depth() {
137
+ const ret = wasm.__wbg_get_compressionconfig_hierarchical_max_depth(this.__wbg_ptr);
138
+ return ret >>> 0;
139
+ }
140
+ /**
141
+ * Maximum pattern length to consider
142
+ * @returns {number}
143
+ */
144
+ get max_subsequence_length() {
145
+ const ret = wasm.__wbg_get_compressionconfig_max_subsequence_length(this.__wbg_ptr);
146
+ return ret >>> 0;
147
+ }
148
+ /**
149
+ * Size of meta-token pool
150
+ * @returns {number}
151
+ */
152
+ get meta_token_pool_size() {
153
+ const ret = wasm.__wbg_get_compressionconfig_meta_token_pool_size(this.__wbg_ptr);
154
+ return ret >>> 0;
155
+ }
156
+ /**
157
+ * Minimum pattern length to consider
158
+ * @returns {number}
159
+ */
160
+ get min_subsequence_length() {
161
+ const ret = wasm.__wbg_get_compressionconfig_min_subsequence_length(this.__wbg_ptr);
162
+ return ret >>> 0;
163
+ }
164
+ /**
165
+ * Enable round-trip verification
166
+ * @returns {boolean}
167
+ */
168
+ get verify() {
169
+ const ret = wasm.__wbg_get_compressionconfig_verify(this.__wbg_ptr);
170
+ return ret !== 0;
171
+ }
172
+ /**
173
+ * Beam width for beam search
174
+ * @param {number} arg0
175
+ */
176
+ set beam_width(arg0) {
177
+ wasm.__wbg_set_compressionconfig_beam_width(this.__wbg_ptr, arg0);
178
+ }
179
+ /**
180
+ * Dictionary end delimiter token ID
181
+ * @param {number} arg0
182
+ */
183
+ set dict_end_token(arg0) {
184
+ wasm.__wbg_set_compressionconfig_dict_end_token(this.__wbg_ptr, arg0);
185
+ }
186
+ /**
187
+ * Whether to include length tokens in dictionary
188
+ * @param {boolean} arg0
189
+ */
190
+ set dict_length_enabled(arg0) {
191
+ wasm.__wbg_set_compressionconfig_dict_length_enabled(this.__wbg_ptr, arg0);
192
+ }
193
+ /**
194
+ * Dictionary start delimiter token ID
195
+ * @param {number} arg0
196
+ */
197
+ set dict_start_token(arg0) {
198
+ wasm.__wbg_set_compressionconfig_dict_start_token(this.__wbg_ptr, arg0);
199
+ }
200
+ /**
201
+ * Enable hierarchical compression
202
+ * @param {boolean} arg0
203
+ */
204
+ set hierarchical_enabled(arg0) {
205
+ wasm.__wbg_set_compressionconfig_hierarchical_enabled(this.__wbg_ptr, arg0);
206
+ }
207
+ /**
208
+ * Maximum hierarchical compression depth
209
+ * @param {number} arg0
210
+ */
211
+ set hierarchical_max_depth(arg0) {
212
+ wasm.__wbg_set_compressionconfig_hierarchical_max_depth(this.__wbg_ptr, arg0);
213
+ }
214
+ /**
215
+ * Maximum pattern length to consider
216
+ * @param {number} arg0
217
+ */
218
+ set max_subsequence_length(arg0) {
219
+ wasm.__wbg_set_compressionconfig_max_subsequence_length(this.__wbg_ptr, arg0);
220
+ }
221
+ /**
222
+ * Size of meta-token pool
223
+ * @param {number} arg0
224
+ */
225
+ set meta_token_pool_size(arg0) {
226
+ wasm.__wbg_set_compressionconfig_meta_token_pool_size(this.__wbg_ptr, arg0);
227
+ }
228
+ /**
229
+ * Minimum pattern length to consider
230
+ * @param {number} arg0
231
+ */
232
+ set min_subsequence_length(arg0) {
233
+ wasm.__wbg_set_compressionconfig_min_subsequence_length(this.__wbg_ptr, arg0);
234
+ }
235
+ /**
236
+ * Enable round-trip verification
237
+ * @param {boolean} arg0
238
+ */
239
+ set verify(arg0) {
240
+ wasm.__wbg_set_compressionconfig_verify(this.__wbg_ptr, arg0);
241
+ }
242
+ }
243
+ if (Symbol.dispose) CompressionConfig.prototype[Symbol.dispose] = CompressionConfig.prototype.free;
244
+
245
+ /**
246
+ * Metrics from a compression operation.
247
+ */
248
+ export class CompressionMetrics {
249
+ __destroy_into_raw() {
250
+ const ptr = this.__wbg_ptr;
251
+ this.__wbg_ptr = 0;
252
+ CompressionMetricsFinalization.unregister(this);
253
+ return ptr;
254
+ }
255
+ free() {
256
+ const ptr = this.__destroy_into_raw();
257
+ wasm.__wbg_compressionmetrics_free(ptr, 0);
258
+ }
259
+ /**
260
+ * Number of candidates discovered
261
+ * @returns {number}
262
+ */
263
+ get candidates_discovered() {
264
+ const ret = wasm.__wbg_get_compressionmetrics_candidates_discovered(this.__wbg_ptr);
265
+ return ret >>> 0;
266
+ }
267
+ /**
268
+ * Number of candidates selected
269
+ * @returns {number}
270
+ */
271
+ get candidates_selected() {
272
+ const ret = wasm.__wbg_get_compressionconfig_max_subsequence_length(this.__wbg_ptr);
273
+ return ret >>> 0;
274
+ }
275
+ /**
276
+ * Time spent in pattern discovery (ms)
277
+ * @returns {number}
278
+ */
279
+ get discovery_time_ms() {
280
+ const ret = wasm.__wbg_get_compressionmetrics_discovery_time_ms(this.__wbg_ptr);
281
+ return ret;
282
+ }
283
+ /**
284
+ * Peak memory usage (bytes, approximate)
285
+ * @returns {number}
286
+ */
287
+ get peak_memory_bytes() {
288
+ const ret = wasm.__wbg_get_compressionmetrics_peak_memory_bytes(this.__wbg_ptr);
289
+ return ret >>> 0;
290
+ }
291
+ /**
292
+ * Time spent in selection (ms)
293
+ * @returns {number}
294
+ */
295
+ get selection_time_ms() {
296
+ const ret = wasm.__wbg_get_compressionmetrics_selection_time_ms(this.__wbg_ptr);
297
+ return ret;
298
+ }
299
+ /**
300
+ * Time spent in serialization (ms)
301
+ * @returns {number}
302
+ */
303
+ get serialization_time_ms() {
304
+ const ret = wasm.__wbg_get_compressionmetrics_serialization_time_ms(this.__wbg_ptr);
305
+ return ret;
306
+ }
307
+ /**
308
+ * Total compression time (ms)
309
+ * @returns {number}
310
+ */
311
+ get total_time_ms() {
312
+ const ret = wasm.__wbg_get_compressionmetrics_total_time_ms(this.__wbg_ptr);
313
+ return ret;
314
+ }
315
+ /**
316
+ * Number of candidates discovered
317
+ * @param {number} arg0
318
+ */
319
+ set candidates_discovered(arg0) {
320
+ wasm.__wbg_set_compressionmetrics_candidates_discovered(this.__wbg_ptr, arg0);
321
+ }
322
+ /**
323
+ * Number of candidates selected
324
+ * @param {number} arg0
325
+ */
326
+ set candidates_selected(arg0) {
327
+ wasm.__wbg_set_compressionconfig_max_subsequence_length(this.__wbg_ptr, arg0);
328
+ }
329
+ /**
330
+ * Time spent in pattern discovery (ms)
331
+ * @param {number} arg0
332
+ */
333
+ set discovery_time_ms(arg0) {
334
+ wasm.__wbg_set_compressionmetrics_discovery_time_ms(this.__wbg_ptr, arg0);
335
+ }
336
+ /**
337
+ * Peak memory usage (bytes, approximate)
338
+ * @param {number} arg0
339
+ */
340
+ set peak_memory_bytes(arg0) {
341
+ wasm.__wbg_set_compressionmetrics_peak_memory_bytes(this.__wbg_ptr, arg0);
342
+ }
343
+ /**
344
+ * Time spent in selection (ms)
345
+ * @param {number} arg0
346
+ */
347
+ set selection_time_ms(arg0) {
348
+ wasm.__wbg_set_compressionmetrics_selection_time_ms(this.__wbg_ptr, arg0);
349
+ }
350
+ /**
351
+ * Time spent in serialization (ms)
352
+ * @param {number} arg0
353
+ */
354
+ set serialization_time_ms(arg0) {
355
+ wasm.__wbg_set_compressionmetrics_serialization_time_ms(this.__wbg_ptr, arg0);
356
+ }
357
+ /**
358
+ * Total compression time (ms)
359
+ * @param {number} arg0
360
+ */
361
+ set total_time_ms(arg0) {
362
+ wasm.__wbg_set_compressionmetrics_total_time_ms(this.__wbg_ptr, arg0);
363
+ }
364
+ }
365
+ if (Symbol.dispose) CompressionMetrics.prototype[Symbol.dispose] = CompressionMetrics.prototype.free;
366
+
367
+ /**
368
+ * Result of compression operation.
369
+ */
370
+ export class CompressionResult {
371
+ static __wrap(ptr) {
372
+ ptr = ptr >>> 0;
373
+ const obj = Object.create(CompressionResult.prototype);
374
+ obj.__wbg_ptr = ptr;
375
+ CompressionResultFinalization.register(obj, obj.__wbg_ptr, obj);
376
+ return obj;
377
+ }
378
+ __destroy_into_raw() {
379
+ const ptr = this.__wbg_ptr;
380
+ this.__wbg_ptr = 0;
381
+ CompressionResultFinalization.unregister(this);
382
+ return ptr;
383
+ }
384
+ free() {
385
+ const ptr = this.__destroy_into_raw();
386
+ wasm.__wbg_compressionresult_free(ptr, 0);
387
+ }
388
+ /**
389
+ * Get the compression ratio (compressed/original).
390
+ * @returns {number}
391
+ */
392
+ get compression_ratio() {
393
+ const ret = wasm.compressionresult_compression_ratio(this.__wbg_ptr);
394
+ return ret;
395
+ }
396
+ /**
397
+ * Get the body tokens as a JS array.
398
+ * @returns {Uint32Array}
399
+ */
400
+ getBodyTokens() {
401
+ const ret = wasm.compressionresult_getBodyTokens(this.__wbg_ptr);
402
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
403
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
404
+ return v1;
405
+ }
406
+ /**
407
+ * Get the dictionary tokens as a JS array.
408
+ * @returns {Uint32Array}
409
+ */
410
+ getDictionaryTokens() {
411
+ const ret = wasm.compressionresult_getDictionaryTokens(this.__wbg_ptr);
412
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
413
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
414
+ return v1;
415
+ }
416
+ /**
417
+ * Get the original tokens as a JS array.
418
+ * @returns {Uint32Array}
419
+ */
420
+ getOriginalTokens() {
421
+ const ret = wasm.compressionresult_getOriginalTokens(this.__wbg_ptr);
422
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
423
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
424
+ return v1;
425
+ }
426
+ /**
427
+ * Get the serialized tokens as a JS array.
428
+ * @returns {Uint32Array}
429
+ */
430
+ getSerializedTokens() {
431
+ const ret = wasm.compressionresult_getSerializedTokens(this.__wbg_ptr);
432
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
433
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
434
+ return v1;
435
+ }
436
+ /**
437
+ * Get the static dictionary ID if used.
438
+ * @returns {string | undefined}
439
+ */
440
+ getStaticDictionaryId() {
441
+ const ret = wasm.compressionresult_getStaticDictionaryId(this.__wbg_ptr);
442
+ let v1;
443
+ if (ret[0] !== 0) {
444
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
445
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
446
+ }
447
+ return v1;
448
+ }
449
+ /**
450
+ * Get tokens saved by compression.
451
+ * @returns {bigint}
452
+ */
453
+ get tokens_saved() {
454
+ const ret = wasm.compressionresult_tokens_saved(this.__wbg_ptr);
455
+ return ret;
456
+ }
457
+ /**
458
+ * Compressed sequence length
459
+ * @returns {number}
460
+ */
461
+ get compressed_length() {
462
+ const ret = wasm.__wbg_get_compressionconfig_max_subsequence_length(this.__wbg_ptr);
463
+ return ret >>> 0;
464
+ }
465
+ /**
466
+ * Original sequence length
467
+ * @returns {number}
468
+ */
469
+ get original_length() {
470
+ const ret = wasm.__wbg_get_compressionmetrics_candidates_discovered(this.__wbg_ptr);
471
+ return ret >>> 0;
472
+ }
473
+ /**
474
+ * Compressed sequence length
475
+ * @param {number} arg0
476
+ */
477
+ set compressed_length(arg0) {
478
+ wasm.__wbg_set_compressionconfig_max_subsequence_length(this.__wbg_ptr, arg0);
479
+ }
480
+ /**
481
+ * Original sequence length
482
+ * @param {number} arg0
483
+ */
484
+ set original_length(arg0) {
485
+ wasm.__wbg_set_compressionmetrics_candidates_discovered(this.__wbg_ptr, arg0);
486
+ }
487
+ }
488
+ if (Symbol.dispose) CompressionResult.prototype[Symbol.dispose] = CompressionResult.prototype.free;
489
+
490
+ /**
491
+ * Streaming compressor for large inputs.
492
+ */
493
+ export class StreamingCompressor {
494
+ __destroy_into_raw() {
495
+ const ptr = this.__wbg_ptr;
496
+ this.__wbg_ptr = 0;
497
+ StreamingCompressorFinalization.unregister(this);
498
+ return ptr;
499
+ }
500
+ free() {
501
+ const ptr = this.__destroy_into_raw();
502
+ wasm.__wbg_streamingcompressor_free(ptr, 0);
503
+ }
504
+ /**
505
+ * Add a chunk of tokens.
506
+ * @param {Uint32Array} tokens
507
+ */
508
+ add_chunk(tokens) {
509
+ const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_malloc);
510
+ const len0 = WASM_VECTOR_LEN;
511
+ wasm.streamingcompressor_add_chunk(this.__wbg_ptr, ptr0, len0);
512
+ }
513
+ /**
514
+ * Finish streaming and produce compressed result.
515
+ * @returns {CompressionResult}
516
+ */
517
+ finish() {
518
+ const ptr = this.__destroy_into_raw();
519
+ const ret = wasm.streamingcompressor_finish(ptr);
520
+ if (ret[2]) {
521
+ throw takeFromExternrefTable0(ret[1]);
522
+ }
523
+ return CompressionResult.__wrap(ret[0]);
524
+ }
525
+ /**
526
+ * Get approximate memory usage.
527
+ * @returns {number}
528
+ */
529
+ memory_usage() {
530
+ const ret = wasm.streamingcompressor_memory_usage(this.__wbg_ptr);
531
+ return ret >>> 0;
532
+ }
533
+ /**
534
+ * Create a new streaming compressor.
535
+ * @param {any} config
536
+ */
537
+ constructor(config) {
538
+ const ret = wasm.streamingcompressor_new(config);
539
+ if (ret[2]) {
540
+ throw takeFromExternrefTable0(ret[1]);
541
+ }
542
+ this.__wbg_ptr = ret[0] >>> 0;
543
+ StreamingCompressorFinalization.register(this, this.__wbg_ptr, this);
544
+ return this;
545
+ }
546
+ }
547
+ if (Symbol.dispose) StreamingCompressor.prototype[Symbol.dispose] = StreamingCompressor.prototype.free;
548
+
549
+ /**
550
+ * WASM-specific configuration for memory and performance tuning.
551
+ */
552
+ export class WasmConfig {
553
+ __destroy_into_raw() {
554
+ const ptr = this.__wbg_ptr;
555
+ this.__wbg_ptr = 0;
556
+ WasmConfigFinalization.unregister(this);
557
+ return ptr;
558
+ }
559
+ free() {
560
+ const ptr = this.__destroy_into_raw();
561
+ wasm.__wbg_wasmconfig_free(ptr, 0);
562
+ }
563
+ /**
564
+ * Chunk size for streaming processing (default: 32768)
565
+ * @returns {number}
566
+ */
567
+ get chunk_size() {
568
+ const ret = wasm.__wbg_get_wasmconfig_chunk_size(this.__wbg_ptr);
569
+ return ret >>> 0;
570
+ }
571
+ /**
572
+ * Maximum memory usage in MB (default: 256)
573
+ * @returns {number}
574
+ */
575
+ get max_memory_mb() {
576
+ const ret = wasm.__wbg_get_wasmconfig_max_memory_mb(this.__wbg_ptr);
577
+ return ret >>> 0;
578
+ }
579
+ /**
580
+ * Enable streaming for inputs above threshold (default: 50000)
581
+ * @returns {number}
582
+ */
583
+ get streaming_threshold() {
584
+ const ret = wasm.__wbg_get_wasmconfig_streaming_threshold(this.__wbg_ptr);
585
+ return ret >>> 0;
586
+ }
587
+ /**
588
+ * Chunk size for streaming processing (default: 32768)
589
+ * @param {number} arg0
590
+ */
591
+ set chunk_size(arg0) {
592
+ wasm.__wbg_set_wasmconfig_chunk_size(this.__wbg_ptr, arg0);
593
+ }
594
+ /**
595
+ * Maximum memory usage in MB (default: 256)
596
+ * @param {number} arg0
597
+ */
598
+ set max_memory_mb(arg0) {
599
+ wasm.__wbg_set_wasmconfig_max_memory_mb(this.__wbg_ptr, arg0);
600
+ }
601
+ /**
602
+ * Enable streaming for inputs above threshold (default: 50000)
603
+ * @param {number} arg0
604
+ */
605
+ set streaming_threshold(arg0) {
606
+ wasm.__wbg_set_wasmconfig_streaming_threshold(this.__wbg_ptr, arg0);
607
+ }
608
+ constructor() {
609
+ const ret = wasm.wasmconfig_new();
610
+ this.__wbg_ptr = ret >>> 0;
611
+ WasmConfigFinalization.register(this, this.__wbg_ptr, this);
612
+ return this;
613
+ }
614
+ }
615
+ if (Symbol.dispose) WasmConfig.prototype[Symbol.dispose] = WasmConfig.prototype.free;
616
+
617
+ /**
618
+ * Compress a token sequence.
619
+ *
620
+ * # Arguments
621
+ *
622
+ * * `tokens` - The token sequence to compress (Uint32Array from JS)
623
+ * * `config` - Optional configuration (JsValue representing JsCompressionConfig)
624
+ *
625
+ * # Returns
626
+ *
627
+ * A CompressionResult containing the compressed tokens and metadata.
628
+ * @param {Uint32Array} tokens
629
+ * @param {any} config
630
+ * @returns {CompressionResult}
631
+ */
632
+ export function compress(tokens, config) {
633
+ const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_malloc);
634
+ const len0 = WASM_VECTOR_LEN;
635
+ const ret = wasm.compress(ptr0, len0, config);
636
+ if (ret[2]) {
637
+ throw takeFromExternrefTable0(ret[1]);
638
+ }
639
+ return CompressionResult.__wrap(ret[0]);
640
+ }
641
+
642
+ /**
643
+ * Decompress a compressed token sequence.
644
+ *
645
+ * # Arguments
646
+ *
647
+ * * `tokens` - The compressed token sequence
648
+ * * `config` - Optional configuration
649
+ *
650
+ * # Returns
651
+ *
652
+ * The original token sequence.
653
+ * @param {Uint32Array} tokens
654
+ * @param {any} config
655
+ * @returns {Uint32Array}
656
+ */
657
+ export function decompress(tokens, config) {
658
+ const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_malloc);
659
+ const len0 = WASM_VECTOR_LEN;
660
+ const ret = wasm.decompress(ptr0, len0, config);
661
+ if (ret[3]) {
662
+ throw takeFromExternrefTable0(ret[2]);
663
+ }
664
+ var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
665
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
666
+ return v2;
667
+ }
668
+
669
+ /**
670
+ * Discover patterns without compressing.
671
+ *
672
+ * Useful for analysis and building static dictionaries.
673
+ * @param {Uint32Array} tokens
674
+ * @param {number} min_length
675
+ * @param {number} max_length
676
+ * @returns {any}
677
+ */
678
+ export function discover_patterns(tokens, min_length, max_length) {
679
+ const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_malloc);
680
+ const len0 = WASM_VECTOR_LEN;
681
+ const ret = wasm.discover_patterns(ptr0, len0, min_length, max_length);
682
+ if (ret[2]) {
683
+ throw takeFromExternrefTable0(ret[1]);
684
+ }
685
+ return takeFromExternrefTable0(ret[0]);
686
+ }
687
+
688
+ /**
689
+ * Initialize panic hook for better error messages in WASM.
690
+ */
691
+ export function init() {
692
+ wasm.init();
693
+ }
694
+
695
+ /**
696
+ * Get version information.
697
+ * @returns {string}
698
+ */
699
+ export function version() {
700
+ let deferred1_0;
701
+ let deferred1_1;
702
+ try {
703
+ const ret = wasm.version();
704
+ deferred1_0 = ret[0];
705
+ deferred1_1 = ret[1];
706
+ return getStringFromWasm0(ret[0], ret[1]);
707
+ } finally {
708
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
709
+ }
710
+ }
711
+
712
+ function __wbg_get_imports() {
713
+ const import0 = {
714
+ __proto__: null,
715
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
716
+ const ret = Error(getStringFromWasm0(arg0, arg1));
717
+ return ret;
718
+ },
719
+ __wbg_Number_04624de7d0e8332d: function(arg0) {
720
+ const ret = Number(arg0);
721
+ return ret;
722
+ },
723
+ __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
724
+ const ret = String(arg1);
725
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
726
+ const len1 = WASM_VECTOR_LEN;
727
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
728
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
729
+ },
730
+ __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
731
+ const v = arg1;
732
+ const ret = typeof(v) === 'bigint' ? v : undefined;
733
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
734
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
735
+ },
736
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
737
+ const v = arg0;
738
+ const ret = typeof(v) === 'boolean' ? v : undefined;
739
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
740
+ },
741
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
742
+ const ret = debugString(arg1);
743
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
744
+ const len1 = WASM_VECTOR_LEN;
745
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
746
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
747
+ },
748
+ __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
749
+ const ret = arg0 in arg1;
750
+ return ret;
751
+ },
752
+ __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
753
+ const ret = typeof(arg0) === 'bigint';
754
+ return ret;
755
+ },
756
+ __wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {
757
+ const ret = arg0 === null;
758
+ return ret;
759
+ },
760
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
761
+ const val = arg0;
762
+ const ret = typeof(val) === 'object' && val !== null;
763
+ return ret;
764
+ },
765
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
766
+ const ret = typeof(arg0) === 'string';
767
+ return ret;
768
+ },
769
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
770
+ const ret = arg0 === undefined;
771
+ return ret;
772
+ },
773
+ __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
774
+ const ret = arg0 === arg1;
775
+ return ret;
776
+ },
777
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
778
+ const ret = arg0 == arg1;
779
+ return ret;
780
+ },
781
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
782
+ const obj = arg1;
783
+ const ret = typeof(obj) === 'number' ? obj : undefined;
784
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
785
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
786
+ },
787
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
788
+ const obj = arg1;
789
+ const ret = typeof(obj) === 'string' ? obj : undefined;
790
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
791
+ var len1 = WASM_VECTOR_LEN;
792
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
793
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
794
+ },
795
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
796
+ throw new Error(getStringFromWasm0(arg0, arg1));
797
+ },
798
+ __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
799
+ let deferred0_0;
800
+ let deferred0_1;
801
+ try {
802
+ deferred0_0 = arg0;
803
+ deferred0_1 = arg1;
804
+ console.error(getStringFromWasm0(arg0, arg1));
805
+ } finally {
806
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
807
+ }
808
+ },
809
+ __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
810
+ const ret = arg0[arg1];
811
+ return ret;
812
+ },
813
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
814
+ let result;
815
+ try {
816
+ result = arg0 instanceof ArrayBuffer;
817
+ } catch (_) {
818
+ result = false;
819
+ }
820
+ const ret = result;
821
+ return ret;
822
+ },
823
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
824
+ let result;
825
+ try {
826
+ result = arg0 instanceof Uint8Array;
827
+ } catch (_) {
828
+ result = false;
829
+ }
830
+ const ret = result;
831
+ return ret;
832
+ },
833
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
834
+ const ret = Number.isSafeInteger(arg0);
835
+ return ret;
836
+ },
837
+ __wbg_length_32ed9a279acd054c: function(arg0) {
838
+ const ret = arg0.length;
839
+ return ret;
840
+ },
841
+ __wbg_new_361308b2356cecd0: function() {
842
+ const ret = new Object();
843
+ return ret;
844
+ },
845
+ __wbg_new_3eb36ae241fe6f44: function() {
846
+ const ret = new Array();
847
+ return ret;
848
+ },
849
+ __wbg_new_8a6f238a6ece86ea: function() {
850
+ const ret = new Error();
851
+ return ret;
852
+ },
853
+ __wbg_new_dca287b076112a51: function() {
854
+ const ret = new Map();
855
+ return ret;
856
+ },
857
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
858
+ const ret = new Uint8Array(arg0);
859
+ return ret;
860
+ },
861
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
862
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
863
+ },
864
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
865
+ const ret = arg0.set(arg1, arg2);
866
+ return ret;
867
+ },
868
+ __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
869
+ arg0[arg1] = arg2;
870
+ },
871
+ __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
872
+ arg0[arg1 >>> 0] = arg2;
873
+ },
874
+ __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
875
+ const ret = arg1.stack;
876
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
877
+ const len1 = WASM_VECTOR_LEN;
878
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
879
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
880
+ },
881
+ __wbindgen_cast_0000000000000001: function(arg0) {
882
+ // Cast intrinsic for `F64 -> Externref`.
883
+ const ret = arg0;
884
+ return ret;
885
+ },
886
+ __wbindgen_cast_0000000000000002: function(arg0) {
887
+ // Cast intrinsic for `I64 -> Externref`.
888
+ const ret = arg0;
889
+ return ret;
890
+ },
891
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
892
+ // Cast intrinsic for `Ref(String) -> Externref`.
893
+ const ret = getStringFromWasm0(arg0, arg1);
894
+ return ret;
895
+ },
896
+ __wbindgen_cast_0000000000000004: function(arg0) {
897
+ // Cast intrinsic for `U64 -> Externref`.
898
+ const ret = BigInt.asUintN(64, arg0);
899
+ return ret;
900
+ },
901
+ __wbindgen_init_externref_table: function() {
902
+ const table = wasm.__wbindgen_externrefs;
903
+ const offset = table.grow(4);
904
+ table.set(0, undefined);
905
+ table.set(offset + 0, undefined);
906
+ table.set(offset + 1, null);
907
+ table.set(offset + 2, true);
908
+ table.set(offset + 3, false);
909
+ },
910
+ };
911
+ return {
912
+ __proto__: null,
913
+ "./small_ltsc_core_bg.js": import0,
914
+ };
915
+ }
916
+
917
+ const CompressionConfigFinalization = (typeof FinalizationRegistry === 'undefined')
918
+ ? { register: () => {}, unregister: () => {} }
919
+ : new FinalizationRegistry(ptr => wasm.__wbg_compressionconfig_free(ptr >>> 0, 1));
920
+ const CompressionMetricsFinalization = (typeof FinalizationRegistry === 'undefined')
921
+ ? { register: () => {}, unregister: () => {} }
922
+ : new FinalizationRegistry(ptr => wasm.__wbg_compressionmetrics_free(ptr >>> 0, 1));
923
+ const CompressionResultFinalization = (typeof FinalizationRegistry === 'undefined')
924
+ ? { register: () => {}, unregister: () => {} }
925
+ : new FinalizationRegistry(ptr => wasm.__wbg_compressionresult_free(ptr >>> 0, 1));
926
+ const StreamingCompressorFinalization = (typeof FinalizationRegistry === 'undefined')
927
+ ? { register: () => {}, unregister: () => {} }
928
+ : new FinalizationRegistry(ptr => wasm.__wbg_streamingcompressor_free(ptr >>> 0, 1));
929
+ const WasmConfigFinalization = (typeof FinalizationRegistry === 'undefined')
930
+ ? { register: () => {}, unregister: () => {} }
931
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmconfig_free(ptr >>> 0, 1));
932
+
933
+ function debugString(val) {
934
+ // primitive types
935
+ const type = typeof val;
936
+ if (type == 'number' || type == 'boolean' || val == null) {
937
+ return `${val}`;
938
+ }
939
+ if (type == 'string') {
940
+ return `"${val}"`;
941
+ }
942
+ if (type == 'symbol') {
943
+ const description = val.description;
944
+ if (description == null) {
945
+ return 'Symbol';
946
+ } else {
947
+ return `Symbol(${description})`;
948
+ }
949
+ }
950
+ if (type == 'function') {
951
+ const name = val.name;
952
+ if (typeof name == 'string' && name.length > 0) {
953
+ return `Function(${name})`;
954
+ } else {
955
+ return 'Function';
956
+ }
957
+ }
958
+ // objects
959
+ if (Array.isArray(val)) {
960
+ const length = val.length;
961
+ let debug = '[';
962
+ if (length > 0) {
963
+ debug += debugString(val[0]);
964
+ }
965
+ for(let i = 1; i < length; i++) {
966
+ debug += ', ' + debugString(val[i]);
967
+ }
968
+ debug += ']';
969
+ return debug;
970
+ }
971
+ // Test for built-in
972
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
973
+ let className;
974
+ if (builtInMatches && builtInMatches.length > 1) {
975
+ className = builtInMatches[1];
976
+ } else {
977
+ // Failed to match the standard '[object ClassName]'
978
+ return toString.call(val);
979
+ }
980
+ if (className == 'Object') {
981
+ // we're a user defined class or Object
982
+ // JSON.stringify avoids problems with cycles, and is generally much
983
+ // easier than looping through ownProperties of `val`.
984
+ try {
985
+ return 'Object(' + JSON.stringify(val) + ')';
986
+ } catch (_) {
987
+ return 'Object';
988
+ }
989
+ }
990
+ // errors
991
+ if (val instanceof Error) {
992
+ return `${val.name}: ${val.message}\n${val.stack}`;
993
+ }
994
+ // TODO we could test for more things here, like `Set`s and `Map`s.
995
+ return className;
996
+ }
997
+
998
+ function getArrayU32FromWasm0(ptr, len) {
999
+ ptr = ptr >>> 0;
1000
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1001
+ }
1002
+
1003
+ function getArrayU8FromWasm0(ptr, len) {
1004
+ ptr = ptr >>> 0;
1005
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1006
+ }
1007
+
1008
+ let cachedDataViewMemory0 = null;
1009
+ function getDataViewMemory0() {
1010
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1011
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1012
+ }
1013
+ return cachedDataViewMemory0;
1014
+ }
1015
+
1016
+ function getStringFromWasm0(ptr, len) {
1017
+ ptr = ptr >>> 0;
1018
+ return decodeText(ptr, len);
1019
+ }
1020
+
1021
+ let cachedUint32ArrayMemory0 = null;
1022
+ function getUint32ArrayMemory0() {
1023
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1024
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1025
+ }
1026
+ return cachedUint32ArrayMemory0;
1027
+ }
1028
+
1029
+ let cachedUint8ArrayMemory0 = null;
1030
+ function getUint8ArrayMemory0() {
1031
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1032
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1033
+ }
1034
+ return cachedUint8ArrayMemory0;
1035
+ }
1036
+
1037
+ function isLikeNone(x) {
1038
+ return x === undefined || x === null;
1039
+ }
1040
+
1041
+ function passArray32ToWasm0(arg, malloc) {
1042
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1043
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1044
+ WASM_VECTOR_LEN = arg.length;
1045
+ return ptr;
1046
+ }
1047
+
1048
+ function passStringToWasm0(arg, malloc, realloc) {
1049
+ if (realloc === undefined) {
1050
+ const buf = cachedTextEncoder.encode(arg);
1051
+ const ptr = malloc(buf.length, 1) >>> 0;
1052
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1053
+ WASM_VECTOR_LEN = buf.length;
1054
+ return ptr;
1055
+ }
1056
+
1057
+ let len = arg.length;
1058
+ let ptr = malloc(len, 1) >>> 0;
1059
+
1060
+ const mem = getUint8ArrayMemory0();
1061
+
1062
+ let offset = 0;
1063
+
1064
+ for (; offset < len; offset++) {
1065
+ const code = arg.charCodeAt(offset);
1066
+ if (code > 0x7F) break;
1067
+ mem[ptr + offset] = code;
1068
+ }
1069
+ if (offset !== len) {
1070
+ if (offset !== 0) {
1071
+ arg = arg.slice(offset);
1072
+ }
1073
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1074
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1075
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1076
+
1077
+ offset += ret.written;
1078
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1079
+ }
1080
+
1081
+ WASM_VECTOR_LEN = offset;
1082
+ return ptr;
1083
+ }
1084
+
1085
+ function takeFromExternrefTable0(idx) {
1086
+ const value = wasm.__wbindgen_externrefs.get(idx);
1087
+ wasm.__externref_table_dealloc(idx);
1088
+ return value;
1089
+ }
1090
+
1091
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1092
+ cachedTextDecoder.decode();
1093
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1094
+ let numBytesDecoded = 0;
1095
+ function decodeText(ptr, len) {
1096
+ numBytesDecoded += len;
1097
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1098
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1099
+ cachedTextDecoder.decode();
1100
+ numBytesDecoded = len;
1101
+ }
1102
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1103
+ }
1104
+
1105
+ const cachedTextEncoder = new TextEncoder();
1106
+
1107
+ if (!('encodeInto' in cachedTextEncoder)) {
1108
+ cachedTextEncoder.encodeInto = function (arg, view) {
1109
+ const buf = cachedTextEncoder.encode(arg);
1110
+ view.set(buf);
1111
+ return {
1112
+ read: arg.length,
1113
+ written: buf.length
1114
+ };
1115
+ };
1116
+ }
1117
+
1118
+ let WASM_VECTOR_LEN = 0;
1119
+
1120
+ let wasmModule, wasm;
1121
+ function __wbg_finalize_init(instance, module) {
1122
+ wasm = instance.exports;
1123
+ wasmModule = module;
1124
+ cachedDataViewMemory0 = null;
1125
+ cachedUint32ArrayMemory0 = null;
1126
+ cachedUint8ArrayMemory0 = null;
1127
+ wasm.__wbindgen_start();
1128
+ return wasm;
1129
+ }
1130
+
1131
+ async function __wbg_load(module, imports) {
1132
+ if (typeof Response === 'function' && module instanceof Response) {
1133
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1134
+ try {
1135
+ return await WebAssembly.instantiateStreaming(module, imports);
1136
+ } catch (e) {
1137
+ const validResponse = module.ok && expectedResponseType(module.type);
1138
+
1139
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1140
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1141
+
1142
+ } else { throw e; }
1143
+ }
1144
+ }
1145
+
1146
+ const bytes = await module.arrayBuffer();
1147
+ return await WebAssembly.instantiate(bytes, imports);
1148
+ } else {
1149
+ const instance = await WebAssembly.instantiate(module, imports);
1150
+
1151
+ if (instance instanceof WebAssembly.Instance) {
1152
+ return { instance, module };
1153
+ } else {
1154
+ return instance;
1155
+ }
1156
+ }
1157
+
1158
+ function expectedResponseType(type) {
1159
+ switch (type) {
1160
+ case 'basic': case 'cors': case 'default': return true;
1161
+ }
1162
+ return false;
1163
+ }
1164
+ }
1165
+
1166
+ function initSync(module) {
1167
+ if (wasm !== undefined) return wasm;
1168
+
1169
+
1170
+ if (module !== undefined) {
1171
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1172
+ ({module} = module)
1173
+ } else {
1174
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1175
+ }
1176
+ }
1177
+
1178
+ const imports = __wbg_get_imports();
1179
+ if (!(module instanceof WebAssembly.Module)) {
1180
+ module = new WebAssembly.Module(module);
1181
+ }
1182
+ const instance = new WebAssembly.Instance(module, imports);
1183
+ return __wbg_finalize_init(instance, module);
1184
+ }
1185
+
1186
+ async function __wbg_init(module_or_path) {
1187
+ if (wasm !== undefined) return wasm;
1188
+
1189
+
1190
+ if (module_or_path !== undefined) {
1191
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1192
+ ({module_or_path} = module_or_path)
1193
+ } else {
1194
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1195
+ }
1196
+ }
1197
+
1198
+ if (module_or_path === undefined) {
1199
+ module_or_path = new URL('small_ltsc_core_bg.wasm', import.meta.url);
1200
+ }
1201
+ const imports = __wbg_get_imports();
1202
+
1203
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1204
+ module_or_path = fetch(module_or_path);
1205
+ }
1206
+
1207
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1208
+
1209
+ return __wbg_finalize_init(instance, module);
1210
+ }
1211
+
1212
+ export { initSync, __wbg_init as default };