zstd-wasm-vn 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,168 +1,19 @@
1
- let wasm_bindgen;
2
- (function() {
3
- const __exports = {};
1
+ let wasm_bindgen = (function(exports) {
4
2
  let script_src;
5
3
  if (typeof document !== 'undefined' && document.currentScript !== null) {
6
4
  script_src = new URL(document.currentScript.src, location.href).toString();
7
5
  }
8
- let wasm = undefined;
9
6
 
10
- let cachedUint8ArrayMemory0 = null;
11
-
12
- function getUint8ArrayMemory0() {
13
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
14
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
15
- }
16
- return cachedUint8ArrayMemory0;
17
- }
18
-
19
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
20
-
21
- cachedTextDecoder.decode();
22
-
23
- function decodeText(ptr, len) {
24
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
25
- }
26
-
27
- function getStringFromWasm0(ptr, len) {
28
- ptr = ptr >>> 0;
29
- return decodeText(ptr, len);
30
- }
31
-
32
- let WASM_VECTOR_LEN = 0;
33
-
34
- function passArray8ToWasm0(arg, malloc) {
35
- const ptr = malloc(arg.length * 1, 1) >>> 0;
36
- getUint8ArrayMemory0().set(arg, ptr / 1);
37
- WASM_VECTOR_LEN = arg.length;
38
- return ptr;
39
- }
40
-
41
- function isLikeNone(x) {
42
- return x === undefined || x === null;
43
- }
44
-
45
- function takeFromExternrefTable0(idx) {
46
- const value = wasm.__wbindgen_export_0.get(idx);
47
- wasm.__externref_table_dealloc(idx);
48
- return value;
49
- }
50
-
51
- function getArrayU8FromWasm0(ptr, len) {
52
- ptr = ptr >>> 0;
53
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
54
- }
55
- /**
56
- * Compresses data using Zstandard compression
57
- *
58
- * # Arguments
59
- *
60
- * * `data` - Input data to compress
61
- * * `level` - Compression level (1-22, default 6). Higher = better compression but slower
62
- * @param {Uint8Array} data
63
- * @param {number | null} [level]
64
- * @returns {Uint8Array}
65
- */
66
- __exports.compress = function(data, level) {
67
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
68
- const len0 = WASM_VECTOR_LEN;
69
- const ret = wasm.compress(ptr0, len0, isLikeNone(level) ? 0x100000001 : (level) >> 0);
70
- if (ret[3]) {
71
- throw takeFromExternrefTable0(ret[2]);
72
- }
73
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
74
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
75
- return v2;
76
- };
77
-
78
- /**
79
- * Compresses data using Zstandard compression with a dictionary
80
- *
81
- * # Arguments
82
- *
83
- * * `data` - Input data to compress
84
- * * `dict` - The compression dictionary
85
- * * `level` - Compression level (1-22, default 6). Higher = better compression but slower
86
- * @param {Uint8Array} data
87
- * @param {Uint8Array} dict
88
- * @param {number | null} [level]
89
- * @returns {Uint8Array}
90
- */
91
- __exports.compress_with_dict = function(data, dict, level) {
92
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
93
- const len0 = WASM_VECTOR_LEN;
94
- const ptr1 = passArray8ToWasm0(dict, wasm.__wbindgen_malloc);
95
- const len1 = WASM_VECTOR_LEN;
96
- const ret = wasm.compress_with_dict(ptr0, len0, ptr1, len1, isLikeNone(level) ? 0x100000001 : (level) >> 0);
97
- if (ret[3]) {
98
- throw takeFromExternrefTable0(ret[2]);
99
- }
100
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
101
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
102
- return v3;
103
- };
104
-
105
- /**
106
- * Decompresses Zstandard compressed data
107
- *
108
- * # Arguments
109
- *
110
- * * `compressed_data` - Zstandard compressed data
111
- * @param {Uint8Array} compressed_data
112
- * @returns {Uint8Array}
113
- */
114
- __exports.decompress = function(compressed_data) {
115
- const ptr0 = passArray8ToWasm0(compressed_data, wasm.__wbindgen_malloc);
116
- const len0 = WASM_VECTOR_LEN;
117
- const ret = wasm.decompress(ptr0, len0);
118
- if (ret[3]) {
119
- throw takeFromExternrefTable0(ret[2]);
120
- }
121
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
122
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
123
- return v2;
124
- };
125
-
126
- /**
127
- * Decompresses Zstandard compressed data using a dictionary
128
- *
129
- * # Arguments
130
- *
131
- * * `data` - Zstandard compressed data
132
- * * `dict` - The decompression dictionary (must match the compression dictionary)
133
- * @param {Uint8Array} data
134
- * @param {Uint8Array} dict
135
- * @returns {Uint8Array}
136
- */
137
- __exports.decompress_with_dict = function(data, dict) {
138
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
139
- const len0 = WASM_VECTOR_LEN;
140
- const ptr1 = passArray8ToWasm0(dict, wasm.__wbindgen_malloc);
141
- const len1 = WASM_VECTOR_LEN;
142
- const ret = wasm.decompress_with_dict(ptr0, len0, ptr1, len1);
143
- if (ret[3]) {
144
- throw takeFromExternrefTable0(ret[2]);
145
- }
146
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
147
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
148
- return v3;
149
- };
150
-
151
- const ZstdFinalization = (typeof FinalizationRegistry === 'undefined')
152
- ? { register: () => {}, unregister: () => {} }
153
- : new FinalizationRegistry(ptr => wasm.__wbg_zstd_free(ptr >>> 0, 1));
154
7
  /**
155
8
  * ZSTD compression and decompression for WebAssembly
156
9
  */
157
10
  class Zstd {
158
-
159
11
  __destroy_into_raw() {
160
12
  const ptr = this.__wbg_ptr;
161
13
  this.__wbg_ptr = 0;
162
14
  ZstdFinalization.unregister(this);
163
15
  return ptr;
164
16
  }
165
-
166
17
  free() {
167
18
  const ptr = this.__destroy_into_raw();
168
19
  wasm.__wbg_zstd_free(ptr, 0);
@@ -183,6 +34,15 @@ let wasm_bindgen;
183
34
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
184
35
  return v2;
185
36
  }
37
+ /**
38
+ * Estimates the compressed size for planning purposes
39
+ * @param {number} input_size
40
+ * @returns {number}
41
+ */
42
+ static compressBound(input_size) {
43
+ const ret = wasm.zstd_compressBound(input_size);
44
+ return ret >>> 0;
45
+ }
186
46
  /**
187
47
  * @param {Uint8Array} data
188
48
  * @param {Uint8Array} dict
@@ -202,6 +62,16 @@ let wasm_bindgen;
202
62
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
203
63
  return v3;
204
64
  }
65
+ /**
66
+ * Calculates compression ratio (smaller = better compression)
67
+ * @param {number} original_size
68
+ * @param {number} compressed_size
69
+ * @returns {number}
70
+ */
71
+ static compressionRatio(original_size, compressed_size) {
72
+ const ret = wasm.zstd_compressionRatio(original_size, compressed_size);
73
+ return ret;
74
+ }
205
75
  /**
206
76
  * @param {Uint8Array} compressed_data
207
77
  * @returns {Uint8Array}
@@ -243,14 +113,6 @@ let wasm_bindgen;
243
113
  const ret = wasm.zstd_defaultCompressionLevel();
244
114
  return ret;
245
115
  }
246
- /**
247
- * Returns the minimum compression level
248
- * @returns {number}
249
- */
250
- static minCompressionLevel() {
251
- const ret = wasm.zstd_minCompressionLevel();
252
- return ret;
253
- }
254
116
  /**
255
117
  * Returns the maximum compression level
256
118
  * @returns {number}
@@ -260,22 +122,11 @@ let wasm_bindgen;
260
122
  return ret;
261
123
  }
262
124
  /**
263
- * Estimates the compressed size for planning purposes
264
- * @param {number} input_size
265
- * @returns {number}
266
- */
267
- static compressBound(input_size) {
268
- const ret = wasm.zstd_compressBound(input_size);
269
- return ret >>> 0;
270
- }
271
- /**
272
- * Calculates compression ratio (smaller = better compression)
273
- * @param {number} original_size
274
- * @param {number} compressed_size
125
+ * Returns the minimum compression level
275
126
  * @returns {number}
276
127
  */
277
- static compressionRatio(original_size, compressed_size) {
278
- const ret = wasm.zstd_compressionRatio(original_size, compressed_size);
128
+ static minCompressionLevel() {
129
+ const ret = wasm.zstd_minCompressionLevel();
279
130
  return ret;
280
131
  }
281
132
  /**
@@ -290,42 +141,23 @@ let wasm_bindgen;
290
141
  }
291
142
  }
292
143
  if (Symbol.dispose) Zstd.prototype[Symbol.dispose] = Zstd.prototype.free;
144
+ exports.Zstd = Zstd;
293
145
 
294
- __exports.Zstd = Zstd;
295
-
296
- const ZstdCompressorFinalization = (typeof FinalizationRegistry === 'undefined')
297
- ? { register: () => {}, unregister: () => {} }
298
- : new FinalizationRegistry(ptr => wasm.__wbg_zstdcompressor_free(ptr >>> 0, 1));
299
146
  /**
300
147
  * ==================================== [Streaming] ====================================
301
148
  * Streaming compression for large data
302
149
  */
303
150
  class ZstdCompressor {
304
-
305
151
  __destroy_into_raw() {
306
152
  const ptr = this.__wbg_ptr;
307
153
  this.__wbg_ptr = 0;
308
154
  ZstdCompressorFinalization.unregister(this);
309
155
  return ptr;
310
156
  }
311
-
312
157
  free() {
313
158
  const ptr = this.__destroy_into_raw();
314
159
  wasm.__wbg_zstdcompressor_free(ptr, 0);
315
160
  }
316
- /**
317
- * Creates a new streaming compressor
318
- * @param {number | null} [level]
319
- */
320
- constructor(level) {
321
- const ret = wasm.zstdcompressor_new(isLikeNone(level) ? 0x100000001 : (level) >> 0);
322
- if (ret[2]) {
323
- throw takeFromExternrefTable0(ret[1]);
324
- }
325
- this.__wbg_ptr = ret[0] >>> 0;
326
- ZstdCompressorFinalization.register(this, this.__wbg_ptr, this);
327
- return this;
328
- }
329
161
  /**
330
162
  * Compresses a chunk of data
331
163
  * @param {Uint8Array} data
@@ -351,45 +183,51 @@ let wasm_bindgen;
351
183
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
352
184
  return v1;
353
185
  }
186
+ /**
187
+ * Creates a new streaming compressor
188
+ * @param {number | null} [level]
189
+ */
190
+ constructor(level) {
191
+ const ret = wasm.zstdcompressor_new(isLikeNone(level) ? 0x100000001 : (level) >> 0);
192
+ if (ret[2]) {
193
+ throw takeFromExternrefTable0(ret[1]);
194
+ }
195
+ this.__wbg_ptr = ret[0] >>> 0;
196
+ ZstdCompressorFinalization.register(this, this.__wbg_ptr, this);
197
+ return this;
198
+ }
199
+ /**
200
+ * Flush the internal buffer to get compressed data for this chunk
201
+ * @param {number} at
202
+ * @returns {Uint8Array}
203
+ */
204
+ split_off_chunk(at) {
205
+ const ret = wasm.zstdcompressor_split_off_chunk(this.__wbg_ptr, at);
206
+ if (ret[3]) {
207
+ throw takeFromExternrefTable0(ret[2]);
208
+ }
209
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
210
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
211
+ return v1;
212
+ }
354
213
  }
355
214
  if (Symbol.dispose) ZstdCompressor.prototype[Symbol.dispose] = ZstdCompressor.prototype.free;
215
+ exports.ZstdCompressor = ZstdCompressor;
356
216
 
357
- __exports.ZstdCompressor = ZstdCompressor;
358
-
359
- const ZstdDecompressorFinalization = (typeof FinalizationRegistry === 'undefined')
360
- ? { register: () => {}, unregister: () => {} }
361
- : new FinalizationRegistry(ptr => wasm.__wbg_zstddecompressor_free(ptr >>> 0, 1));
362
217
  /**
363
218
  * Streaming decompression for large data
364
219
  */
365
220
  class ZstdDecompressor {
366
-
367
221
  __destroy_into_raw() {
368
222
  const ptr = this.__wbg_ptr;
369
223
  this.__wbg_ptr = 0;
370
224
  ZstdDecompressorFinalization.unregister(this);
371
225
  return ptr;
372
226
  }
373
-
374
227
  free() {
375
228
  const ptr = this.__destroy_into_raw();
376
229
  wasm.__wbg_zstddecompressor_free(ptr, 0);
377
230
  }
378
- /**
379
- * Creates a new streaming decompressor
380
- * @param {Uint8Array} compressed_data
381
- */
382
- constructor(compressed_data) {
383
- const ptr0 = passArray8ToWasm0(compressed_data, wasm.__wbindgen_malloc);
384
- const len0 = WASM_VECTOR_LEN;
385
- const ret = wasm.zstddecompressor_new(ptr0, len0);
386
- if (ret[2]) {
387
- throw takeFromExternrefTable0(ret[1]);
388
- }
389
- this.__wbg_ptr = ret[0] >>> 0;
390
- ZstdDecompressorFinalization.register(this, this.__wbg_ptr, this);
391
- return this;
392
- }
393
231
  /**
394
232
  * Decompresses a chunk of data
395
233
  * @param {number} max_output_size
@@ -417,90 +255,254 @@ let wasm_bindgen;
417
255
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
418
256
  return v1;
419
257
  }
258
+ /**
259
+ * Creates a new streaming decompressor
260
+ * @param {Uint8Array} compressed_data
261
+ */
262
+ constructor(compressed_data) {
263
+ const ptr0 = passArray8ToWasm0(compressed_data, wasm.__wbindgen_malloc);
264
+ const len0 = WASM_VECTOR_LEN;
265
+ const ret = wasm.zstddecompressor_new(ptr0, len0);
266
+ if (ret[2]) {
267
+ throw takeFromExternrefTable0(ret[1]);
268
+ }
269
+ this.__wbg_ptr = ret[0] >>> 0;
270
+ ZstdDecompressorFinalization.register(this, this.__wbg_ptr, this);
271
+ return this;
272
+ }
420
273
  }
421
274
  if (Symbol.dispose) ZstdDecompressor.prototype[Symbol.dispose] = ZstdDecompressor.prototype.free;
275
+ exports.ZstdDecompressor = ZstdDecompressor;
422
276
 
423
- __exports.ZstdDecompressor = ZstdDecompressor;
277
+ /**
278
+ * Compresses data using Zstandard compression
279
+ *
280
+ * # Arguments
281
+ *
282
+ * * `data` - Input data to compress
283
+ * * `level` - Compression level (1-22, default 6). Higher = better compression but slower
284
+ * @param {Uint8Array} data
285
+ * @param {number | null} [level]
286
+ * @returns {Uint8Array}
287
+ */
288
+ function compress(data, level) {
289
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
290
+ const len0 = WASM_VECTOR_LEN;
291
+ const ret = wasm.compress(ptr0, len0, isLikeNone(level) ? 0x100000001 : (level) >> 0);
292
+ if (ret[3]) {
293
+ throw takeFromExternrefTable0(ret[2]);
294
+ }
295
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
296
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
297
+ return v2;
298
+ }
299
+ exports.compress = compress;
424
300
 
425
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
301
+ /**
302
+ * Compresses data using Zstandard compression with a dictionary
303
+ *
304
+ * # Arguments
305
+ *
306
+ * * `data` - Input data to compress
307
+ * * `dict` - The compression dictionary
308
+ * * `level` - Compression level (1-22, default 6). Higher = better compression but slower
309
+ * @param {Uint8Array} data
310
+ * @param {Uint8Array} dict
311
+ * @param {number | null} [level]
312
+ * @returns {Uint8Array}
313
+ */
314
+ function compress_with_dict(data, dict, level) {
315
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
316
+ const len0 = WASM_VECTOR_LEN;
317
+ const ptr1 = passArray8ToWasm0(dict, wasm.__wbindgen_malloc);
318
+ const len1 = WASM_VECTOR_LEN;
319
+ const ret = wasm.compress_with_dict(ptr0, len0, ptr1, len1, isLikeNone(level) ? 0x100000001 : (level) >> 0);
320
+ if (ret[3]) {
321
+ throw takeFromExternrefTable0(ret[2]);
322
+ }
323
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
324
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
325
+ return v3;
326
+ }
327
+ exports.compress_with_dict = compress_with_dict;
328
+
329
+ /**
330
+ * Decompresses Zstandard compressed data
331
+ *
332
+ * # Arguments
333
+ *
334
+ * * `compressed_data` - Zstandard compressed data
335
+ * @param {Uint8Array} compressed_data
336
+ * @returns {Uint8Array}
337
+ */
338
+ function decompress(compressed_data) {
339
+ const ptr0 = passArray8ToWasm0(compressed_data, wasm.__wbindgen_malloc);
340
+ const len0 = WASM_VECTOR_LEN;
341
+ const ret = wasm.decompress(ptr0, len0);
342
+ if (ret[3]) {
343
+ throw takeFromExternrefTable0(ret[2]);
344
+ }
345
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
346
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
347
+ return v2;
348
+ }
349
+ exports.decompress = decompress;
350
+
351
+ /**
352
+ * Decompresses Zstandard compressed data using a dictionary
353
+ *
354
+ * # Arguments
355
+ *
356
+ * * `data` - Zstandard compressed data
357
+ * * `dict` - The decompression dictionary (must match the compression dictionary)
358
+ * @param {Uint8Array} data
359
+ * @param {Uint8Array} dict
360
+ * @returns {Uint8Array}
361
+ */
362
+ function decompress_with_dict(data, dict) {
363
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
364
+ const len0 = WASM_VECTOR_LEN;
365
+ const ptr1 = passArray8ToWasm0(dict, wasm.__wbindgen_malloc);
366
+ const len1 = WASM_VECTOR_LEN;
367
+ const ret = wasm.decompress_with_dict(ptr0, len0, ptr1, len1);
368
+ if (ret[3]) {
369
+ throw takeFromExternrefTable0(ret[2]);
370
+ }
371
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
372
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
373
+ return v3;
374
+ }
375
+ exports.decompress_with_dict = decompress_with_dict;
376
+
377
+ function __wbg_get_imports() {
378
+ const import0 = {
379
+ __proto__: null,
380
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
381
+ throw new Error(getStringFromWasm0(arg0, arg1));
382
+ },
383
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
384
+ // Cast intrinsic for `Ref(String) -> Externref`.
385
+ const ret = getStringFromWasm0(arg0, arg1);
386
+ return ret;
387
+ },
388
+ __wbindgen_init_externref_table: function() {
389
+ const table = wasm.__wbindgen_externrefs;
390
+ const offset = table.grow(4);
391
+ table.set(0, undefined);
392
+ table.set(offset + 0, undefined);
393
+ table.set(offset + 1, null);
394
+ table.set(offset + 2, true);
395
+ table.set(offset + 3, false);
396
+ },
397
+ };
398
+ return {
399
+ __proto__: null,
400
+ "./zstd_wasm_vn_bg.js": import0,
401
+ };
402
+ }
403
+
404
+ const ZstdFinalization = (typeof FinalizationRegistry === 'undefined')
405
+ ? { register: () => {}, unregister: () => {} }
406
+ : new FinalizationRegistry(ptr => wasm.__wbg_zstd_free(ptr >>> 0, 1));
407
+ const ZstdCompressorFinalization = (typeof FinalizationRegistry === 'undefined')
408
+ ? { register: () => {}, unregister: () => {} }
409
+ : new FinalizationRegistry(ptr => wasm.__wbg_zstdcompressor_free(ptr >>> 0, 1));
410
+ const ZstdDecompressorFinalization = (typeof FinalizationRegistry === 'undefined')
411
+ ? { register: () => {}, unregister: () => {} }
412
+ : new FinalizationRegistry(ptr => wasm.__wbg_zstddecompressor_free(ptr >>> 0, 1));
413
+
414
+ function getArrayU8FromWasm0(ptr, len) {
415
+ ptr = ptr >>> 0;
416
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
417
+ }
418
+
419
+ function getStringFromWasm0(ptr, len) {
420
+ ptr = ptr >>> 0;
421
+ return decodeText(ptr, len);
422
+ }
423
+
424
+ let cachedUint8ArrayMemory0 = null;
425
+ function getUint8ArrayMemory0() {
426
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
427
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
428
+ }
429
+ return cachedUint8ArrayMemory0;
430
+ }
431
+
432
+ function isLikeNone(x) {
433
+ return x === undefined || x === null;
434
+ }
435
+
436
+ function passArray8ToWasm0(arg, malloc) {
437
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
438
+ getUint8ArrayMemory0().set(arg, ptr / 1);
439
+ WASM_VECTOR_LEN = arg.length;
440
+ return ptr;
441
+ }
442
+
443
+ function takeFromExternrefTable0(idx) {
444
+ const value = wasm.__wbindgen_externrefs.get(idx);
445
+ wasm.__externref_table_dealloc(idx);
446
+ return value;
447
+ }
448
+
449
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
450
+ cachedTextDecoder.decode();
451
+ function decodeText(ptr, len) {
452
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
453
+ }
454
+
455
+ let WASM_VECTOR_LEN = 0;
456
+
457
+ let wasmModule, wasm;
458
+ function __wbg_finalize_init(instance, module) {
459
+ wasm = instance.exports;
460
+ wasmModule = module;
461
+ cachedUint8ArrayMemory0 = null;
462
+ wasm.__wbindgen_start();
463
+ return wasm;
464
+ }
426
465
 
427
466
  async function __wbg_load(module, imports) {
428
467
  if (typeof Response === 'function' && module instanceof Response) {
429
468
  if (typeof WebAssembly.instantiateStreaming === 'function') {
430
469
  try {
431
470
  return await WebAssembly.instantiateStreaming(module, imports);
432
-
433
471
  } catch (e) {
434
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
472
+ const validResponse = module.ok && expectedResponseType(module.type);
435
473
 
436
474
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
437
475
  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);
438
476
 
439
- } else {
440
- throw e;
441
- }
477
+ } else { throw e; }
442
478
  }
443
479
  }
444
480
 
445
481
  const bytes = await module.arrayBuffer();
446
482
  return await WebAssembly.instantiate(bytes, imports);
447
-
448
483
  } else {
449
484
  const instance = await WebAssembly.instantiate(module, imports);
450
485
 
451
486
  if (instance instanceof WebAssembly.Instance) {
452
487
  return { instance, module };
453
-
454
488
  } else {
455
489
  return instance;
456
490
  }
457
491
  }
458
- }
459
-
460
- function __wbg_get_imports() {
461
- const imports = {};
462
- imports.wbg = {};
463
- imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
464
- throw new Error(getStringFromWasm0(arg0, arg1));
465
- };
466
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
467
- // Cast intrinsic for `Ref(String) -> Externref`.
468
- const ret = getStringFromWasm0(arg0, arg1);
469
- return ret;
470
- };
471
- imports.wbg.__wbindgen_init_externref_table = function() {
472
- const table = wasm.__wbindgen_export_0;
473
- const offset = table.grow(4);
474
- table.set(0, undefined);
475
- table.set(offset + 0, undefined);
476
- table.set(offset + 1, null);
477
- table.set(offset + 2, true);
478
- table.set(offset + 3, false);
479
- ;
480
- };
481
492
 
482
- return imports;
483
- }
484
-
485
- function __wbg_init_memory(imports, memory) {
486
-
487
- }
488
-
489
- function __wbg_finalize_init(instance, module) {
490
- wasm = instance.exports;
491
- __wbg_init.__wbindgen_wasm_module = module;
492
- cachedUint8ArrayMemory0 = null;
493
-
494
-
495
- wasm.__wbindgen_start();
496
- return wasm;
493
+ function expectedResponseType(type) {
494
+ switch (type) {
495
+ case 'basic': case 'cors': case 'default': return true;
496
+ }
497
+ return false;
498
+ }
497
499
  }
498
500
 
499
501
  function initSync(module) {
500
502
  if (wasm !== undefined) return wasm;
501
503
 
502
504
 
503
- if (typeof module !== 'undefined') {
505
+ if (module !== undefined) {
504
506
  if (Object.getPrototypeOf(module) === Object.prototype) {
505
507
  ({module} = module)
506
508
  } else {
@@ -509,15 +511,10 @@ let wasm_bindgen;
509
511
  }
510
512
 
511
513
  const imports = __wbg_get_imports();
512
-
513
- __wbg_init_memory(imports);
514
-
515
514
  if (!(module instanceof WebAssembly.Module)) {
516
515
  module = new WebAssembly.Module(module);
517
516
  }
518
-
519
517
  const instance = new WebAssembly.Instance(module, imports);
520
-
521
518
  return __wbg_finalize_init(instance, module);
522
519
  }
523
520
 
@@ -525,7 +522,7 @@ let wasm_bindgen;
525
522
  if (wasm !== undefined) return wasm;
526
523
 
527
524
 
528
- if (typeof module_or_path !== 'undefined') {
525
+ if (module_or_path !== undefined) {
529
526
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
530
527
  ({module_or_path} = module_or_path)
531
528
  } else {
@@ -533,8 +530,8 @@ let wasm_bindgen;
533
530
  }
534
531
  }
535
532
 
536
- if (typeof module_or_path === 'undefined' && typeof script_src !== 'undefined') {
537
- module_or_path = script_src.replace(/\.js$/, '_bg.wasm');
533
+ if (module_or_path === undefined && script_src !== undefined) {
534
+ module_or_path = script_src.replace(/\.js$/, "_bg.wasm");
538
535
  }
539
536
  const imports = __wbg_get_imports();
540
537
 
@@ -542,13 +539,10 @@ let wasm_bindgen;
542
539
  module_or_path = fetch(module_or_path);
543
540
  }
544
541
 
545
- __wbg_init_memory(imports);
546
-
547
542
  const { instance, module } = await __wbg_load(await module_or_path, imports);
548
543
 
549
544
  return __wbg_finalize_init(instance, module);
550
545
  }
551
546
 
552
- wasm_bindgen = Object.assign(__wbg_init, { initSync }, __exports);
553
-
554
- })();
547
+ return Object.assign(__wbg_init, { initSync }, exports);
548
+ })({ __proto__: null });