@paddor/lz4rip 0.2.20 → 0.2.21
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/package.json
CHANGED
package/src/pkg/lz4rip_wasm.d.ts
CHANGED
|
@@ -4,37 +4,37 @@
|
|
|
4
4
|
export class Compressor {
|
|
5
5
|
free(): void;
|
|
6
6
|
[Symbol.dispose](): void;
|
|
7
|
-
compress(input: Uint8Array): Uint8Array;
|
|
7
|
+
compress(input: Uint8Array | number[]): Uint8Array;
|
|
8
8
|
constructor();
|
|
9
|
-
static withDict(dict: Uint8Array): Compressor;
|
|
9
|
+
static withDict(dict: Uint8Array | number[]): Compressor;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export class Decompressor {
|
|
13
13
|
free(): void;
|
|
14
14
|
[Symbol.dispose](): void;
|
|
15
|
-
decompress(input: Uint8Array, uncompressed_size: number): Uint8Array;
|
|
15
|
+
decompress(input: Uint8Array | number[], uncompressed_size: number): Uint8Array;
|
|
16
16
|
constructor();
|
|
17
|
-
static withDict(dict: Uint8Array): Decompressor;
|
|
17
|
+
static withDict(dict: Uint8Array | number[]): Decompressor;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export class DictTrainer {
|
|
21
21
|
free(): void;
|
|
22
22
|
[Symbol.dispose](): void;
|
|
23
|
-
addSample(data: Uint8Array): void;
|
|
23
|
+
addSample(data: Uint8Array | number[]): void;
|
|
24
24
|
constructor(max_dict_size: number);
|
|
25
25
|
sampleCount(): number;
|
|
26
26
|
train(): Uint8Array;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export function compress(input: Uint8Array): Uint8Array;
|
|
29
|
+
export function compress(input: Uint8Array | number[]): Uint8Array;
|
|
30
30
|
|
|
31
31
|
export function compressBound(input_len: number): number;
|
|
32
32
|
|
|
33
|
-
export function compressFrame(input: Uint8Array, dictionary: Uint8Array, dict_id: number, flags: number): Uint8Array;
|
|
33
|
+
export function compressFrame(input: Uint8Array | number[], dictionary: Uint8Array | number[], dict_id: number, flags: number): Uint8Array;
|
|
34
34
|
|
|
35
|
-
export function decompress(input: Uint8Array, uncompressed_size: number): Uint8Array;
|
|
35
|
+
export function decompress(input: Uint8Array | number[], uncompressed_size: number): Uint8Array;
|
|
36
36
|
|
|
37
|
-
export function decompressFrame(input: Uint8Array, dictionary: Uint8Array, dict_id: number, has_dictionary: boolean, max_output: number, has_max_output: boolean): Uint8Array;
|
|
37
|
+
export function decompressFrame(input: Uint8Array | number[], dictionary: Uint8Array | number[], dict_id: number, has_dictionary: boolean, max_output: number, has_max_output: boolean): Uint8Array;
|
|
38
38
|
|
|
39
39
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
40
40
|
|
|
@@ -58,9 +58,12 @@ export interface InitOutput {
|
|
|
58
58
|
readonly dicttrainer_new: (a: number) => number;
|
|
59
59
|
readonly dicttrainer_sampleCount: (a: number, b: number) => void;
|
|
60
60
|
readonly dicttrainer_train: (a: number, b: number) => void;
|
|
61
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
61
62
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
62
63
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
63
64
|
readonly __wbindgen_export2: (a: number, b: number, c: number) => void;
|
|
65
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
66
|
+
readonly __wbindgen_start: () => void;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
package/src/pkg/lz4rip_wasm.js
CHANGED
|
@@ -18,12 +18,12 @@ export class Compressor {
|
|
|
18
18
|
wasm.__wbg_compressor_free(ptr, 0);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* @param {Uint8Array} input
|
|
21
|
+
* @param {Uint8Array | number[]} input
|
|
22
22
|
* @returns {Uint8Array}
|
|
23
23
|
*/
|
|
24
24
|
compress(input) {
|
|
25
25
|
try {
|
|
26
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
26
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
27
27
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
28
28
|
const len0 = WASM_VECTOR_LEN;
|
|
29
29
|
wasm.compressor_compress(retptr, this.__wbg_ptr, ptr0, len0);
|
|
@@ -43,7 +43,7 @@ export class Compressor {
|
|
|
43
43
|
return this;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* @param {Uint8Array} dict
|
|
46
|
+
* @param {Uint8Array | number[]} dict
|
|
47
47
|
* @returns {Compressor}
|
|
48
48
|
*/
|
|
49
49
|
static withDict(dict) {
|
|
@@ -73,26 +73,27 @@ export class Decompressor {
|
|
|
73
73
|
wasm.__wbg_decompressor_free(ptr, 0);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* @param {Uint8Array} input
|
|
76
|
+
* @param {Uint8Array | number[]} input
|
|
77
77
|
* @param {number} uncompressed_size
|
|
78
78
|
* @returns {Uint8Array}
|
|
79
79
|
*/
|
|
80
80
|
decompress(input, uncompressed_size) {
|
|
81
81
|
try {
|
|
82
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
82
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
83
|
+
const val2 = +uncompressed_size;
|
|
83
84
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
84
85
|
const len0 = WASM_VECTOR_LEN;
|
|
85
|
-
wasm.decompressor_decompress(retptr, this.__wbg_ptr, ptr0, len0,
|
|
86
|
+
wasm.decompressor_decompress(retptr, this.__wbg_ptr, ptr0, len0, val2);
|
|
86
87
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
87
88
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
88
89
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
89
90
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
90
91
|
if (r3) {
|
|
91
|
-
throw
|
|
92
|
+
throw takeFromExternrefTable0(r2);
|
|
92
93
|
}
|
|
93
|
-
var
|
|
94
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
94
95
|
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
95
|
-
return
|
|
96
|
+
return v3;
|
|
96
97
|
} finally {
|
|
97
98
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
98
99
|
}
|
|
@@ -104,7 +105,7 @@ export class Decompressor {
|
|
|
104
105
|
return this;
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
|
-
* @param {Uint8Array} dict
|
|
108
|
+
* @param {Uint8Array | number[]} dict
|
|
108
109
|
* @returns {Decompressor}
|
|
109
110
|
*/
|
|
110
111
|
static withDict(dict) {
|
|
@@ -128,18 +129,18 @@ export class DictTrainer {
|
|
|
128
129
|
wasm.__wbg_dicttrainer_free(ptr, 0);
|
|
129
130
|
}
|
|
130
131
|
/**
|
|
131
|
-
* @param {Uint8Array} data
|
|
132
|
+
* @param {Uint8Array | number[]} data
|
|
132
133
|
*/
|
|
133
134
|
addSample(data) {
|
|
134
135
|
try {
|
|
135
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
136
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
136
137
|
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
137
138
|
const len0 = WASM_VECTOR_LEN;
|
|
138
139
|
wasm.dicttrainer_addSample(retptr, this.__wbg_ptr, ptr0, len0);
|
|
139
140
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140
141
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
141
142
|
if (r1) {
|
|
142
|
-
throw
|
|
143
|
+
throw takeFromExternrefTable0(r0);
|
|
143
144
|
}
|
|
144
145
|
} finally {
|
|
145
146
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -159,13 +160,13 @@ export class DictTrainer {
|
|
|
159
160
|
*/
|
|
160
161
|
sampleCount() {
|
|
161
162
|
try {
|
|
162
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
163
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
163
164
|
wasm.dicttrainer_sampleCount(retptr, this.__wbg_ptr);
|
|
164
165
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
165
166
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
166
167
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
167
168
|
if (r2) {
|
|
168
|
-
throw
|
|
169
|
+
throw takeFromExternrefTable0(r1);
|
|
169
170
|
}
|
|
170
171
|
return r0 >>> 0;
|
|
171
172
|
} finally {
|
|
@@ -177,14 +178,14 @@ export class DictTrainer {
|
|
|
177
178
|
*/
|
|
178
179
|
train() {
|
|
179
180
|
try {
|
|
180
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
181
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
181
182
|
wasm.dicttrainer_train(retptr, this.__wbg_ptr);
|
|
182
183
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
183
184
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
184
185
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
185
186
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
186
187
|
if (r3) {
|
|
187
|
-
throw
|
|
188
|
+
throw takeFromExternrefTable0(r2);
|
|
188
189
|
}
|
|
189
190
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
190
191
|
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
@@ -197,12 +198,12 @@ export class DictTrainer {
|
|
|
197
198
|
if (Symbol.dispose) DictTrainer.prototype[Symbol.dispose] = DictTrainer.prototype.free;
|
|
198
199
|
|
|
199
200
|
/**
|
|
200
|
-
* @param {Uint8Array} input
|
|
201
|
+
* @param {Uint8Array | number[]} input
|
|
201
202
|
* @returns {Uint8Array}
|
|
202
203
|
*/
|
|
203
204
|
export function compress(input) {
|
|
204
205
|
try {
|
|
205
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
206
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
206
207
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
207
208
|
const len0 = WASM_VECTOR_LEN;
|
|
208
209
|
wasm.compress(retptr, ptr0, len0);
|
|
@@ -226,64 +227,74 @@ export function compressBound(input_len) {
|
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
/**
|
|
229
|
-
* @param {Uint8Array} input
|
|
230
|
-
* @param {Uint8Array} dictionary
|
|
230
|
+
* @param {Uint8Array | number[]} input
|
|
231
|
+
* @param {Uint8Array | number[]} dictionary
|
|
231
232
|
* @param {number} dict_id
|
|
232
233
|
* @param {number} flags
|
|
233
234
|
* @returns {Uint8Array}
|
|
234
235
|
*/
|
|
235
236
|
export function compressFrame(input, dictionary, dict_id, flags) {
|
|
236
237
|
try {
|
|
237
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
239
|
+
const val3 = +dict_id;
|
|
240
|
+
const val4 = +flags;
|
|
241
|
+
let ptr0, len0, ptr1, len1;
|
|
242
|
+
try {
|
|
243
|
+
ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
244
|
+
len0 = WASM_VECTOR_LEN;
|
|
245
|
+
ptr1 = passArray8ToWasm0(dictionary, wasm.__wbindgen_export);
|
|
246
|
+
len1 = WASM_VECTOR_LEN;
|
|
247
|
+
} catch (e) {
|
|
248
|
+
if (ptr1) { wasm.__wbindgen_export2(ptr1, len1 * 1, 1); }
|
|
249
|
+
if (ptr0) { wasm.__wbindgen_export2(ptr0, len0 * 1, 1); }
|
|
250
|
+
throw e;
|
|
251
|
+
}
|
|
252
|
+
wasm.compressFrame(retptr, ptr0, len0, ptr1, len1, val3, val4);
|
|
243
253
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
244
254
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
245
255
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
246
256
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
247
257
|
if (r3) {
|
|
248
|
-
throw
|
|
258
|
+
throw takeFromExternrefTable0(r2);
|
|
249
259
|
}
|
|
250
|
-
var
|
|
260
|
+
var v5 = getArrayU8FromWasm0(r0, r1).slice();
|
|
251
261
|
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
252
|
-
return
|
|
262
|
+
return v5;
|
|
253
263
|
} finally {
|
|
254
264
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
255
265
|
}
|
|
256
266
|
}
|
|
257
267
|
|
|
258
268
|
/**
|
|
259
|
-
* @param {Uint8Array} input
|
|
269
|
+
* @param {Uint8Array | number[]} input
|
|
260
270
|
* @param {number} uncompressed_size
|
|
261
271
|
* @returns {Uint8Array}
|
|
262
272
|
*/
|
|
263
273
|
export function decompress(input, uncompressed_size) {
|
|
264
274
|
try {
|
|
265
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
275
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
276
|
+
const val2 = +uncompressed_size;
|
|
266
277
|
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
267
278
|
const len0 = WASM_VECTOR_LEN;
|
|
268
|
-
wasm.decompress(retptr, ptr0, len0,
|
|
279
|
+
wasm.decompress(retptr, ptr0, len0, val2);
|
|
269
280
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
270
281
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
271
282
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
272
283
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
273
284
|
if (r3) {
|
|
274
|
-
throw
|
|
285
|
+
throw takeFromExternrefTable0(r2);
|
|
275
286
|
}
|
|
276
|
-
var
|
|
287
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
277
288
|
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
278
|
-
return
|
|
289
|
+
return v3;
|
|
279
290
|
} finally {
|
|
280
291
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
281
292
|
}
|
|
282
293
|
}
|
|
283
294
|
|
|
284
295
|
/**
|
|
285
|
-
* @param {Uint8Array} input
|
|
286
|
-
* @param {Uint8Array} dictionary
|
|
296
|
+
* @param {Uint8Array | number[]} input
|
|
297
|
+
* @param {Uint8Array | number[]} dictionary
|
|
287
298
|
* @param {number} dict_id
|
|
288
299
|
* @param {boolean} has_dictionary
|
|
289
300
|
* @param {number} max_output
|
|
@@ -292,22 +303,33 @@ export function decompress(input, uncompressed_size) {
|
|
|
292
303
|
*/
|
|
293
304
|
export function decompressFrame(input, dictionary, dict_id, has_dictionary, max_output, has_max_output) {
|
|
294
305
|
try {
|
|
295
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
296
|
-
const
|
|
297
|
-
const
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
|
|
306
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
|
|
307
|
+
const val3 = +dict_id;
|
|
308
|
+
const val4 = +has_dictionary;
|
|
309
|
+
const val5 = +max_output;
|
|
310
|
+
const val6 = +has_max_output;
|
|
311
|
+
let ptr0, len0, ptr1, len1;
|
|
312
|
+
try {
|
|
313
|
+
ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
314
|
+
len0 = WASM_VECTOR_LEN;
|
|
315
|
+
ptr1 = passArray8ToWasm0(dictionary, wasm.__wbindgen_export);
|
|
316
|
+
len1 = WASM_VECTOR_LEN;
|
|
317
|
+
} catch (e) {
|
|
318
|
+
if (ptr1) { wasm.__wbindgen_export2(ptr1, len1 * 1, 1); }
|
|
319
|
+
if (ptr0) { wasm.__wbindgen_export2(ptr0, len0 * 1, 1); }
|
|
320
|
+
throw e;
|
|
321
|
+
}
|
|
322
|
+
wasm.decompressFrame(retptr, ptr0, len0, ptr1, len1, val3, val4, val5, val6);
|
|
301
323
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
302
324
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
303
325
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
304
326
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
305
327
|
if (r3) {
|
|
306
|
-
throw
|
|
328
|
+
throw takeFromExternrefTable0(r2);
|
|
307
329
|
}
|
|
308
|
-
var
|
|
330
|
+
var v7 = getArrayU8FromWasm0(r0, r1).slice();
|
|
309
331
|
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
310
|
-
return
|
|
332
|
+
return v7;
|
|
311
333
|
} finally {
|
|
312
334
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
313
335
|
}
|
|
@@ -315,13 +337,21 @@ export function decompressFrame(input, dictionary, dict_id, has_dictionary, max_
|
|
|
315
337
|
function __wbg_get_imports() {
|
|
316
338
|
const import0 = {
|
|
317
339
|
__proto__: null,
|
|
318
|
-
|
|
340
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
319
341
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
320
|
-
return
|
|
342
|
+
return ret;
|
|
321
343
|
},
|
|
322
|
-
|
|
344
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
323
345
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
324
346
|
},
|
|
347
|
+
__wbindgen_init_externref_table: function() {
|
|
348
|
+
const table = wasm.__wbindgen_externrefs;
|
|
349
|
+
table.set(0, undefined);
|
|
350
|
+
table.set(1024, undefined);
|
|
351
|
+
table.set(1025, null);
|
|
352
|
+
table.set(1026, true);
|
|
353
|
+
table.set(1027, false);
|
|
354
|
+
},
|
|
325
355
|
};
|
|
326
356
|
return {
|
|
327
357
|
__proto__: null,
|
|
@@ -339,21 +369,6 @@ const DictTrainerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
339
369
|
? { register: () => {}, unregister: () => {} }
|
|
340
370
|
: new FinalizationRegistry(ptr => wasm.__wbg_dicttrainer_free(ptr, 1));
|
|
341
371
|
|
|
342
|
-
function addHeapObject(obj) {
|
|
343
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
344
|
-
const idx = heap_next;
|
|
345
|
-
heap_next = heap[idx];
|
|
346
|
-
|
|
347
|
-
heap[idx] = obj;
|
|
348
|
-
return idx;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function dropObject(idx) {
|
|
352
|
-
if (idx < 1028) return;
|
|
353
|
-
heap[idx] = heap_next;
|
|
354
|
-
heap_next = idx;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
372
|
function getArrayU8FromWasm0(ptr, len) {
|
|
358
373
|
ptr = ptr >>> 0;
|
|
359
374
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -368,7 +383,8 @@ function getDataViewMemory0() {
|
|
|
368
383
|
}
|
|
369
384
|
|
|
370
385
|
function getStringFromWasm0(ptr, len) {
|
|
371
|
-
|
|
386
|
+
ptr = ptr >>> 0;
|
|
387
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
372
388
|
}
|
|
373
389
|
|
|
374
390
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -379,13 +395,6 @@ function getUint8ArrayMemory0() {
|
|
|
379
395
|
return cachedUint8ArrayMemory0;
|
|
380
396
|
}
|
|
381
397
|
|
|
382
|
-
function getObject(idx) { return heap[idx]; }
|
|
383
|
-
|
|
384
|
-
let heap = new Array(1024).fill(undefined);
|
|
385
|
-
heap.push(undefined, null, true, false);
|
|
386
|
-
|
|
387
|
-
let heap_next = heap.length;
|
|
388
|
-
|
|
389
398
|
function passArray8ToWasm0(arg, malloc) {
|
|
390
399
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
391
400
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -393,24 +402,24 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
393
402
|
return ptr;
|
|
394
403
|
}
|
|
395
404
|
|
|
396
|
-
function
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
return
|
|
405
|
+
function takeFromExternrefTable0(idx) {
|
|
406
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
407
|
+
wasm.__wbindgen_export3(idx);
|
|
408
|
+
return value;
|
|
400
409
|
}
|
|
401
410
|
|
|
402
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
411
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
403
412
|
cachedTextDecoder.decode();
|
|
404
413
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
405
414
|
let numBytesDecoded = 0;
|
|
406
|
-
function decodeText(
|
|
407
|
-
numBytesDecoded +=
|
|
415
|
+
function decodeText(bytes) {
|
|
416
|
+
numBytesDecoded += bytes.length;
|
|
408
417
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
409
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
418
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
410
419
|
cachedTextDecoder.decode();
|
|
411
|
-
numBytesDecoded =
|
|
420
|
+
numBytesDecoded = bytes.length;
|
|
412
421
|
}
|
|
413
|
-
return cachedTextDecoder.decode(
|
|
422
|
+
return cachedTextDecoder.decode(bytes);
|
|
414
423
|
}
|
|
415
424
|
|
|
416
425
|
let WASM_VECTOR_LEN = 0;
|
|
@@ -422,16 +431,21 @@ function __wbg_finalize_init(instance, module) {
|
|
|
422
431
|
wasmModule = module;
|
|
423
432
|
cachedDataViewMemory0 = null;
|
|
424
433
|
cachedUint8ArrayMemory0 = null;
|
|
434
|
+
wasm.__wbindgen_start();
|
|
425
435
|
return wasm;
|
|
426
436
|
}
|
|
427
437
|
|
|
428
438
|
async function __wbg_load(module, imports) {
|
|
429
439
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
440
|
+
if (!module.ok) {
|
|
441
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
442
|
+
}
|
|
443
|
+
|
|
430
444
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
431
445
|
try {
|
|
432
446
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
433
447
|
} catch (e) {
|
|
434
|
-
const validResponse =
|
|
448
|
+
const validResponse = expectedResponseType(module.type);
|
|
435
449
|
|
|
436
450
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
437
451
|
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);
|
|
@@ -480,9 +494,17 @@ function initSync(module) {
|
|
|
480
494
|
return __wbg_finalize_init(instance, module);
|
|
481
495
|
}
|
|
482
496
|
|
|
497
|
+
let __wbg_init_promise;
|
|
483
498
|
async function __wbg_init(module_or_path) {
|
|
484
499
|
if (wasm !== undefined) return wasm;
|
|
500
|
+
if (__wbg_init_promise === undefined) {
|
|
501
|
+
__wbg_init_promise = __wbg_init_once(module_or_path);
|
|
502
|
+
__wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
|
|
503
|
+
}
|
|
504
|
+
return __wbg_init_promise;
|
|
505
|
+
}
|
|
485
506
|
|
|
507
|
+
async function __wbg_init_once(module_or_path) {
|
|
486
508
|
|
|
487
509
|
if (module_or_path !== undefined) {
|
|
488
510
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
Binary file
|
|
@@ -19,6 +19,9 @@ export const dicttrainer_addSample: (a: number, b: number, c: number, d: number)
|
|
|
19
19
|
export const dicttrainer_new: (a: number) => number;
|
|
20
20
|
export const dicttrainer_sampleCount: (a: number, b: number) => void;
|
|
21
21
|
export const dicttrainer_train: (a: number, b: number) => void;
|
|
22
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
22
23
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
23
24
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
24
25
|
export const __wbindgen_export2: (a: number, b: number, c: number) => void;
|
|
26
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
27
|
+
export const __wbindgen_start: () => void;
|