@kreuzberg/wasm 4.0.0-rc.6
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/README.md +982 -0
- package/dist/adapters/wasm-adapter.d.mts +121 -0
- package/dist/adapters/wasm-adapter.d.ts +121 -0
- package/dist/adapters/wasm-adapter.js +241 -0
- package/dist/adapters/wasm-adapter.js.map +1 -0
- package/dist/adapters/wasm-adapter.mjs +221 -0
- package/dist/adapters/wasm-adapter.mjs.map +1 -0
- package/dist/index.d.mts +466 -0
- package/dist/index.d.ts +466 -0
- package/dist/index.js +383 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +384 -0
- package/dist/index.mjs.map +1 -0
- package/dist/kreuzberg_wasm.d.mts +758 -0
- package/dist/kreuzberg_wasm.d.ts +758 -0
- package/dist/kreuzberg_wasm.js +1913 -0
- package/dist/kreuzberg_wasm.mjs +48 -0
- package/dist/kreuzberg_wasm_bg.wasm +0 -0
- package/dist/kreuzberg_wasm_bg.wasm.d.ts +54 -0
- package/dist/ocr/registry.d.mts +102 -0
- package/dist/ocr/registry.d.ts +102 -0
- package/dist/ocr/registry.js +90 -0
- package/dist/ocr/registry.js.map +1 -0
- package/dist/ocr/registry.mjs +70 -0
- package/dist/ocr/registry.mjs.map +1 -0
- package/dist/ocr/tesseract-wasm-backend.d.mts +257 -0
- package/dist/ocr/tesseract-wasm-backend.d.ts +257 -0
- package/dist/ocr/tesseract-wasm-backend.js +454 -0
- package/dist/ocr/tesseract-wasm-backend.js.map +1 -0
- package/dist/ocr/tesseract-wasm-backend.mjs +424 -0
- package/dist/ocr/tesseract-wasm-backend.mjs.map +1 -0
- package/dist/runtime.d.mts +256 -0
- package/dist/runtime.d.ts +256 -0
- package/dist/runtime.js +172 -0
- package/dist/runtime.js.map +1 -0
- package/dist/runtime.mjs +152 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +107 -0
- package/dist/types-GJVIvbPy.d.mts +221 -0
- package/dist/types-GJVIvbPy.d.ts +221 -0
- package/package.json +138 -0
|
@@ -0,0 +1,1913 @@
|
|
|
1
|
+
|
|
2
|
+
let imports = {};
|
|
3
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
|
+
|
|
5
|
+
const { startWorkers } = require(String.raw`./snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js`);
|
|
6
|
+
|
|
7
|
+
function addToExternrefTable0(obj) {
|
|
8
|
+
const idx = wasm.__externref_table_alloc();
|
|
9
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
10
|
+
return idx;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
14
|
+
? { register: () => {}, unregister: () => {} }
|
|
15
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
16
|
+
|
|
17
|
+
function debugString(val) {
|
|
18
|
+
// primitive types
|
|
19
|
+
const type = typeof val;
|
|
20
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
21
|
+
return `${val}`;
|
|
22
|
+
}
|
|
23
|
+
if (type == 'string') {
|
|
24
|
+
return `"${val}"`;
|
|
25
|
+
}
|
|
26
|
+
if (type == 'symbol') {
|
|
27
|
+
const description = val.description;
|
|
28
|
+
if (description == null) {
|
|
29
|
+
return 'Symbol';
|
|
30
|
+
} else {
|
|
31
|
+
return `Symbol(${description})`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (type == 'function') {
|
|
35
|
+
const name = val.name;
|
|
36
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
37
|
+
return `Function(${name})`;
|
|
38
|
+
} else {
|
|
39
|
+
return 'Function';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// objects
|
|
43
|
+
if (Array.isArray(val)) {
|
|
44
|
+
const length = val.length;
|
|
45
|
+
let debug = '[';
|
|
46
|
+
if (length > 0) {
|
|
47
|
+
debug += debugString(val[0]);
|
|
48
|
+
}
|
|
49
|
+
for(let i = 1; i < length; i++) {
|
|
50
|
+
debug += ', ' + debugString(val[i]);
|
|
51
|
+
}
|
|
52
|
+
debug += ']';
|
|
53
|
+
return debug;
|
|
54
|
+
}
|
|
55
|
+
// Test for built-in
|
|
56
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
57
|
+
let className;
|
|
58
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
59
|
+
className = builtInMatches[1];
|
|
60
|
+
} else {
|
|
61
|
+
// Failed to match the standard '[object ClassName]'
|
|
62
|
+
return toString.call(val);
|
|
63
|
+
}
|
|
64
|
+
if (className == 'Object') {
|
|
65
|
+
// we're a user defined class or Object
|
|
66
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
67
|
+
// easier than looping through ownProperties of `val`.
|
|
68
|
+
try {
|
|
69
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
70
|
+
} catch (_) {
|
|
71
|
+
return 'Object';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// errors
|
|
75
|
+
if (val instanceof Error) {
|
|
76
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
77
|
+
}
|
|
78
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
79
|
+
return className;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
83
|
+
ptr = ptr >>> 0;
|
|
84
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let cachedDataViewMemory0 = null;
|
|
88
|
+
function getDataViewMemory0() {
|
|
89
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
90
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
91
|
+
}
|
|
92
|
+
return cachedDataViewMemory0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getStringFromWasm0(ptr, len) {
|
|
96
|
+
ptr = ptr >>> 0;
|
|
97
|
+
return decodeText(ptr, len);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
let cachedUint8ArrayMemory0 = null;
|
|
101
|
+
function getUint8ArrayMemory0() {
|
|
102
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.buffer !== wasm.memory.buffer) {
|
|
103
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
104
|
+
}
|
|
105
|
+
return cachedUint8ArrayMemory0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function handleError(f, args) {
|
|
109
|
+
try {
|
|
110
|
+
return f.apply(this, args);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
const idx = addToExternrefTable0(e);
|
|
113
|
+
wasm.__wbindgen_exn_store(idx);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function isLikeNone(x) {
|
|
118
|
+
return x === undefined || x === null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
122
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
123
|
+
const real = (...args) => {
|
|
124
|
+
|
|
125
|
+
// First up with a closure we increment the internal reference
|
|
126
|
+
// count. This ensures that the Rust closure environment won't
|
|
127
|
+
// be deallocated while we're invoking it.
|
|
128
|
+
state.cnt++;
|
|
129
|
+
const a = state.a;
|
|
130
|
+
state.a = 0;
|
|
131
|
+
try {
|
|
132
|
+
return f(a, state.b, ...args);
|
|
133
|
+
} finally {
|
|
134
|
+
state.a = a;
|
|
135
|
+
real._wbg_cb_unref();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
real._wbg_cb_unref = () => {
|
|
139
|
+
if (--state.cnt === 0) {
|
|
140
|
+
state.dtor(state.a, state.b);
|
|
141
|
+
state.a = 0;
|
|
142
|
+
CLOSURE_DTORS.unregister(state);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
146
|
+
return real;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
150
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
151
|
+
for (let i = 0; i < array.length; i++) {
|
|
152
|
+
const add = addToExternrefTable0(array[i]);
|
|
153
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
154
|
+
}
|
|
155
|
+
WASM_VECTOR_LEN = array.length;
|
|
156
|
+
return ptr;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
160
|
+
if (realloc === undefined) {
|
|
161
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
162
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
163
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
164
|
+
WASM_VECTOR_LEN = buf.length;
|
|
165
|
+
return ptr;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
let len = arg.length;
|
|
169
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
170
|
+
|
|
171
|
+
const mem = getUint8ArrayMemory0();
|
|
172
|
+
|
|
173
|
+
let offset = 0;
|
|
174
|
+
|
|
175
|
+
for (; offset < len; offset++) {
|
|
176
|
+
const code = arg.charCodeAt(offset);
|
|
177
|
+
if (code > 0x7F) break;
|
|
178
|
+
mem[ptr + offset] = code;
|
|
179
|
+
}
|
|
180
|
+
if (offset !== len) {
|
|
181
|
+
if (offset !== 0) {
|
|
182
|
+
arg = arg.slice(offset);
|
|
183
|
+
}
|
|
184
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
185
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
186
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
187
|
+
|
|
188
|
+
offset += ret.written;
|
|
189
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
WASM_VECTOR_LEN = offset;
|
|
193
|
+
return ptr;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function takeFromExternrefTable0(idx) {
|
|
197
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
198
|
+
wasm.__externref_table_dealloc(idx);
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : undefined);
|
|
203
|
+
if (cachedTextDecoder) cachedTextDecoder.decode();
|
|
204
|
+
|
|
205
|
+
function decodeText(ptr, len) {
|
|
206
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().slice(ptr, ptr + len));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined);
|
|
210
|
+
|
|
211
|
+
if (cachedTextEncoder) {
|
|
212
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
213
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
214
|
+
view.set(buf);
|
|
215
|
+
return {
|
|
216
|
+
read: arg.length,
|
|
217
|
+
written: buf.length
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
let WASM_VECTOR_LEN = 0;
|
|
223
|
+
|
|
224
|
+
function wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____(arg0, arg1, arg2) {
|
|
225
|
+
wasm.wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____(arg0, arg1, arg2);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue__wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____(arg0, arg1, arg2, arg3) {
|
|
229
|
+
wasm.wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue__wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____(arg0, arg1, arg2, arg3);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const ModuleInfoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
233
|
+
? { register: () => {}, unregister: () => {} }
|
|
234
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_moduleinfo_free(ptr >>> 0, 1));
|
|
235
|
+
|
|
236
|
+
const wbg_rayon_PoolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
237
|
+
? { register: () => {}, unregister: () => {} }
|
|
238
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wbg_rayon_poolbuilder_free(ptr >>> 0, 1));
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Get information about the WASM module
|
|
242
|
+
*/
|
|
243
|
+
class ModuleInfo {
|
|
244
|
+
static __wrap(ptr) {
|
|
245
|
+
ptr = ptr >>> 0;
|
|
246
|
+
const obj = Object.create(ModuleInfo.prototype);
|
|
247
|
+
obj.__wbg_ptr = ptr;
|
|
248
|
+
ModuleInfoFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
249
|
+
return obj;
|
|
250
|
+
}
|
|
251
|
+
__destroy_into_raw() {
|
|
252
|
+
const ptr = this.__wbg_ptr;
|
|
253
|
+
this.__wbg_ptr = 0;
|
|
254
|
+
ModuleInfoFinalization.unregister(this);
|
|
255
|
+
return ptr;
|
|
256
|
+
}
|
|
257
|
+
free() {
|
|
258
|
+
const ptr = this.__destroy_into_raw();
|
|
259
|
+
wasm.__wbg_moduleinfo_free(ptr, 0);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Get the module name
|
|
263
|
+
* @returns {string}
|
|
264
|
+
*/
|
|
265
|
+
name() {
|
|
266
|
+
let deferred1_0;
|
|
267
|
+
let deferred1_1;
|
|
268
|
+
try {
|
|
269
|
+
const ret = wasm.moduleinfo_name(this.__wbg_ptr);
|
|
270
|
+
deferred1_0 = ret[0];
|
|
271
|
+
deferred1_1 = ret[1];
|
|
272
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
273
|
+
} finally {
|
|
274
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Get the module version
|
|
279
|
+
* @returns {string}
|
|
280
|
+
*/
|
|
281
|
+
version() {
|
|
282
|
+
let deferred1_0;
|
|
283
|
+
let deferred1_1;
|
|
284
|
+
try {
|
|
285
|
+
const ret = wasm.moduleinfo_version(this.__wbg_ptr);
|
|
286
|
+
deferred1_0 = ret[0];
|
|
287
|
+
deferred1_1 = ret[1];
|
|
288
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
289
|
+
} finally {
|
|
290
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (Symbol.dispose) ModuleInfo.prototype[Symbol.dispose] = ModuleInfo.prototype.free;
|
|
295
|
+
exports.ModuleInfo = ModuleInfo;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Batch extract from multiple byte arrays (asynchronous).
|
|
299
|
+
*
|
|
300
|
+
* Asynchronously processes multiple document byte arrays in parallel.
|
|
301
|
+
* Non-blocking alternative to `batchExtractBytesSync`.
|
|
302
|
+
*
|
|
303
|
+
* # JavaScript Parameters
|
|
304
|
+
*
|
|
305
|
+
* * `dataList: Uint8Array[]` - Array of document bytes
|
|
306
|
+
* * `mimeTypes: string[]` - Array of MIME types (must match dataList length)
|
|
307
|
+
* * `config?: object` - Optional extraction configuration (applied to all)
|
|
308
|
+
*
|
|
309
|
+
* # Returns
|
|
310
|
+
*
|
|
311
|
+
* `Promise<object[]>` - Promise resolving to array of ExtractionResults
|
|
312
|
+
*
|
|
313
|
+
* # Throws
|
|
314
|
+
*
|
|
315
|
+
* Rejects if dataList and mimeTypes lengths don't match.
|
|
316
|
+
*
|
|
317
|
+
* # Example
|
|
318
|
+
*
|
|
319
|
+
* ```javascript
|
|
320
|
+
* import { batchExtractBytes } from '@kreuzberg/wasm';
|
|
321
|
+
*
|
|
322
|
+
* const responses = await Promise.all([
|
|
323
|
+
* fetch('doc1.pdf'),
|
|
324
|
+
* fetch('doc2.docx')
|
|
325
|
+
* ]);
|
|
326
|
+
*
|
|
327
|
+
* const buffers = await Promise.all(
|
|
328
|
+
* responses.map(r => r.arrayBuffer().then(b => new Uint8Array(b)))
|
|
329
|
+
* );
|
|
330
|
+
*
|
|
331
|
+
* const results = await batchExtractBytes(
|
|
332
|
+
* buffers,
|
|
333
|
+
* ['application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
334
|
+
* null
|
|
335
|
+
* );
|
|
336
|
+
* ```
|
|
337
|
+
* @param {Uint8Array[]} data_list
|
|
338
|
+
* @param {string[]} mime_types
|
|
339
|
+
* @param {any | null} [config]
|
|
340
|
+
* @returns {Promise<any>}
|
|
341
|
+
*/
|
|
342
|
+
function batchExtractBytes(data_list, mime_types, config) {
|
|
343
|
+
const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
|
|
344
|
+
const len0 = WASM_VECTOR_LEN;
|
|
345
|
+
const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
|
|
346
|
+
const len1 = WASM_VECTOR_LEN;
|
|
347
|
+
const ret = wasm.batchExtractBytes(ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
348
|
+
return ret;
|
|
349
|
+
}
|
|
350
|
+
exports.batchExtractBytes = batchExtractBytes;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Batch extract from multiple byte arrays (synchronous).
|
|
354
|
+
*
|
|
355
|
+
* Processes multiple document byte arrays in parallel. All documents use the
|
|
356
|
+
* same extraction configuration.
|
|
357
|
+
*
|
|
358
|
+
* # JavaScript Parameters
|
|
359
|
+
*
|
|
360
|
+
* * `dataList: Uint8Array[]` - Array of document bytes
|
|
361
|
+
* * `mimeTypes: string[]` - Array of MIME types (must match dataList length)
|
|
362
|
+
* * `config?: object` - Optional extraction configuration (applied to all)
|
|
363
|
+
*
|
|
364
|
+
* # Returns
|
|
365
|
+
*
|
|
366
|
+
* `object[]` - Array of ExtractionResults in the same order as inputs
|
|
367
|
+
*
|
|
368
|
+
* # Throws
|
|
369
|
+
*
|
|
370
|
+
* Throws if dataList and mimeTypes lengths don't match.
|
|
371
|
+
*
|
|
372
|
+
* # Example
|
|
373
|
+
*
|
|
374
|
+
* ```javascript
|
|
375
|
+
* import { batchExtractBytesSync } from '@kreuzberg/wasm';
|
|
376
|
+
*
|
|
377
|
+
* const buffers = [buffer1, buffer2, buffer3];
|
|
378
|
+
* const mimeTypes = ['application/pdf', 'text/plain', 'image/png'];
|
|
379
|
+
* const results = batchExtractBytesSync(buffers, mimeTypes, null);
|
|
380
|
+
*
|
|
381
|
+
* results.forEach((result, i) => {
|
|
382
|
+
* console.log(`Document ${i}: ${result.content.substring(0, 50)}...`);
|
|
383
|
+
* });
|
|
384
|
+
* ```
|
|
385
|
+
* @param {Uint8Array[]} data_list
|
|
386
|
+
* @param {string[]} mime_types
|
|
387
|
+
* @param {any | null} [config]
|
|
388
|
+
* @returns {any}
|
|
389
|
+
*/
|
|
390
|
+
function batchExtractBytesSync(data_list, mime_types, config) {
|
|
391
|
+
const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
|
|
392
|
+
const len0 = WASM_VECTOR_LEN;
|
|
393
|
+
const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
|
|
394
|
+
const len1 = WASM_VECTOR_LEN;
|
|
395
|
+
const ret = wasm.batchExtractBytesSync(ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
396
|
+
if (ret[2]) {
|
|
397
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
398
|
+
}
|
|
399
|
+
return takeFromExternrefTable0(ret[0]);
|
|
400
|
+
}
|
|
401
|
+
exports.batchExtractBytesSync = batchExtractBytesSync;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Batch extract from multiple Files or Blobs (asynchronous).
|
|
405
|
+
*
|
|
406
|
+
* Processes multiple web File or Blob objects in parallel using the FileReader API.
|
|
407
|
+
* Only available in browser environments.
|
|
408
|
+
*
|
|
409
|
+
* # JavaScript Parameters
|
|
410
|
+
*
|
|
411
|
+
* * `files: (File | Blob)[]` - Array of files or blobs to extract
|
|
412
|
+
* * `config?: object` - Optional extraction configuration (applied to all)
|
|
413
|
+
*
|
|
414
|
+
* # Returns
|
|
415
|
+
*
|
|
416
|
+
* `Promise<object[]>` - Promise resolving to array of ExtractionResults
|
|
417
|
+
*
|
|
418
|
+
* # Example
|
|
419
|
+
*
|
|
420
|
+
* ```javascript
|
|
421
|
+
* import { batchExtractFiles } from '@kreuzberg/wasm';
|
|
422
|
+
*
|
|
423
|
+
* // From file input with multiple files
|
|
424
|
+
* const fileInput = document.getElementById('file-input');
|
|
425
|
+
* const files = Array.from(fileInput.files);
|
|
426
|
+
*
|
|
427
|
+
* const results = await batchExtractFiles(files, null);
|
|
428
|
+
* console.log(`Processed ${results.length} files`);
|
|
429
|
+
* ```
|
|
430
|
+
* @param {File[]} files
|
|
431
|
+
* @param {any | null} [config]
|
|
432
|
+
* @returns {Promise<any>}
|
|
433
|
+
*/
|
|
434
|
+
function batchExtractFiles(files, config) {
|
|
435
|
+
const ptr0 = passArrayJsValueToWasm0(files, wasm.__wbindgen_malloc);
|
|
436
|
+
const len0 = WASM_VECTOR_LEN;
|
|
437
|
+
const ret = wasm.batchExtractFiles(ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
438
|
+
return ret;
|
|
439
|
+
}
|
|
440
|
+
exports.batchExtractFiles = batchExtractFiles;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Batch extract from multiple files (synchronous) - NOT AVAILABLE IN WASM.
|
|
444
|
+
*
|
|
445
|
+
* File system operations are not available in WebAssembly environments.
|
|
446
|
+
* Use `batchExtractBytesSync` or `batchExtractBytes` instead.
|
|
447
|
+
*
|
|
448
|
+
* # Throws
|
|
449
|
+
*
|
|
450
|
+
* Always throws: "File operations are not available in WASM. Use batchExtractBytesSync or batchExtractBytes instead."
|
|
451
|
+
* @returns {any}
|
|
452
|
+
*/
|
|
453
|
+
function batchExtractFilesSync() {
|
|
454
|
+
const ret = wasm.batchExtractFilesSync();
|
|
455
|
+
if (ret[2]) {
|
|
456
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
457
|
+
}
|
|
458
|
+
return takeFromExternrefTable0(ret[0]);
|
|
459
|
+
}
|
|
460
|
+
exports.batchExtractFilesSync = batchExtractFilesSync;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Clear all registered OCR backends.
|
|
464
|
+
*
|
|
465
|
+
* # Returns
|
|
466
|
+
*
|
|
467
|
+
* Ok if clearing succeeds, Err if an error occurs.
|
|
468
|
+
*
|
|
469
|
+
* # Example
|
|
470
|
+
*
|
|
471
|
+
* ```javascript
|
|
472
|
+
* clearOcrBackends();
|
|
473
|
+
* ```
|
|
474
|
+
*/
|
|
475
|
+
function clear_ocr_backends() {
|
|
476
|
+
const ret = wasm.clear_ocr_backends();
|
|
477
|
+
if (ret[1]) {
|
|
478
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
exports.clear_ocr_backends = clear_ocr_backends;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Clear all registered post-processors.
|
|
485
|
+
*
|
|
486
|
+
* # Returns
|
|
487
|
+
*
|
|
488
|
+
* Ok if clearing succeeds, Err if an error occurs.
|
|
489
|
+
*
|
|
490
|
+
* # Example
|
|
491
|
+
*
|
|
492
|
+
* ```javascript
|
|
493
|
+
* clearPostProcessors();
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
function clear_post_processors() {
|
|
497
|
+
const ret = wasm.clear_post_processors();
|
|
498
|
+
if (ret[1]) {
|
|
499
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
exports.clear_post_processors = clear_post_processors;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Clear all registered validators.
|
|
506
|
+
*
|
|
507
|
+
* # Returns
|
|
508
|
+
*
|
|
509
|
+
* Ok if clearing succeeds, Err if an error occurs.
|
|
510
|
+
*
|
|
511
|
+
* # Example
|
|
512
|
+
*
|
|
513
|
+
* ```javascript
|
|
514
|
+
* clearValidators();
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
517
|
+
function clear_validators() {
|
|
518
|
+
const ret = wasm.clear_validators();
|
|
519
|
+
if (ret[1]) {
|
|
520
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
exports.clear_validators = clear_validators;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Detect MIME type from raw file bytes.
|
|
527
|
+
*
|
|
528
|
+
* Uses magic byte signatures and content analysis to detect the MIME type of
|
|
529
|
+
* a document from its binary content. Falls back to text detection if binary
|
|
530
|
+
* detection fails.
|
|
531
|
+
*
|
|
532
|
+
* # JavaScript Parameters
|
|
533
|
+
*
|
|
534
|
+
* * `data: Uint8Array` - The raw file bytes
|
|
535
|
+
*
|
|
536
|
+
* # Returns
|
|
537
|
+
*
|
|
538
|
+
* `string` - The detected MIME type (e.g., "application/pdf", "image/png")
|
|
539
|
+
*
|
|
540
|
+
* # Throws
|
|
541
|
+
*
|
|
542
|
+
* Throws an error if MIME type cannot be determined from the content.
|
|
543
|
+
*
|
|
544
|
+
* # Example
|
|
545
|
+
*
|
|
546
|
+
* ```javascript
|
|
547
|
+
* import { detectMimeFromBytes } from '@kreuzberg/wasm';
|
|
548
|
+
* import { readFileSync } from 'fs';
|
|
549
|
+
*
|
|
550
|
+
* const pdfBytes = readFileSync('document.pdf');
|
|
551
|
+
* const mimeType = detectMimeFromBytes(new Uint8Array(pdfBytes));
|
|
552
|
+
* console.log(mimeType); // "application/pdf"
|
|
553
|
+
* ```
|
|
554
|
+
* @param {Uint8Array} data
|
|
555
|
+
* @returns {string}
|
|
556
|
+
*/
|
|
557
|
+
function detectMimeFromBytes(data) {
|
|
558
|
+
let deferred2_0;
|
|
559
|
+
let deferred2_1;
|
|
560
|
+
try {
|
|
561
|
+
const ret = wasm.detectMimeFromBytes(data);
|
|
562
|
+
var ptr1 = ret[0];
|
|
563
|
+
var len1 = ret[1];
|
|
564
|
+
if (ret[3]) {
|
|
565
|
+
ptr1 = 0; len1 = 0;
|
|
566
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
567
|
+
}
|
|
568
|
+
deferred2_0 = ptr1;
|
|
569
|
+
deferred2_1 = len1;
|
|
570
|
+
return getStringFromWasm0(ptr1, len1);
|
|
571
|
+
} finally {
|
|
572
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
exports.detectMimeFromBytes = detectMimeFromBytes;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Discover configuration file in the project hierarchy.
|
|
579
|
+
*
|
|
580
|
+
* In WebAssembly environments, configuration discovery is not available because
|
|
581
|
+
* there is no file system access. This function always returns an error with a
|
|
582
|
+
* descriptive message directing users to use `loadConfigFromString()` instead.
|
|
583
|
+
*
|
|
584
|
+
* # JavaScript Parameters
|
|
585
|
+
*
|
|
586
|
+
* None
|
|
587
|
+
*
|
|
588
|
+
* # Returns
|
|
589
|
+
*
|
|
590
|
+
* Never returns successfully.
|
|
591
|
+
*
|
|
592
|
+
* # Throws
|
|
593
|
+
*
|
|
594
|
+
* Always throws an error with message:
|
|
595
|
+
* "discoverConfig is not available in WebAssembly (no file system access). Use loadConfigFromString() instead."
|
|
596
|
+
*
|
|
597
|
+
* # Example
|
|
598
|
+
*
|
|
599
|
+
* ```javascript
|
|
600
|
+
* import { discoverConfig } from '@kreuzberg/wasm';
|
|
601
|
+
*
|
|
602
|
+
* try {
|
|
603
|
+
* const config = discoverConfig();
|
|
604
|
+
* } catch (e) {
|
|
605
|
+
* console.error(e.message);
|
|
606
|
+
* // "discoverConfig is not available in WebAssembly (no file system access).
|
|
607
|
+
* // Use loadConfigFromString() instead."
|
|
608
|
+
* }
|
|
609
|
+
* ```
|
|
610
|
+
* @returns {any}
|
|
611
|
+
*/
|
|
612
|
+
function discoverConfig() {
|
|
613
|
+
const ret = wasm.discoverConfig();
|
|
614
|
+
if (ret[2]) {
|
|
615
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
616
|
+
}
|
|
617
|
+
return takeFromExternrefTable0(ret[0]);
|
|
618
|
+
}
|
|
619
|
+
exports.discoverConfig = discoverConfig;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Extract content from a byte array (asynchronous).
|
|
623
|
+
*
|
|
624
|
+
* Asynchronously extracts text, tables, images, and metadata from a document.
|
|
625
|
+
* Non-blocking alternative to `extractBytesSync` suitable for large documents
|
|
626
|
+
* or browser environments.
|
|
627
|
+
*
|
|
628
|
+
* # JavaScript Parameters
|
|
629
|
+
*
|
|
630
|
+
* * `data: Uint8Array` - The document bytes to extract
|
|
631
|
+
* * `mimeType: string` - MIME type of the data (e.g., "application/pdf")
|
|
632
|
+
* * `config?: object` - Optional extraction configuration
|
|
633
|
+
*
|
|
634
|
+
* # Returns
|
|
635
|
+
*
|
|
636
|
+
* `Promise<object>` - Promise resolving to ExtractionResult
|
|
637
|
+
*
|
|
638
|
+
* # Throws
|
|
639
|
+
*
|
|
640
|
+
* Rejects if data is malformed or MIME type is unsupported.
|
|
641
|
+
*
|
|
642
|
+
* # Example
|
|
643
|
+
*
|
|
644
|
+
* ```javascript
|
|
645
|
+
* import { extractBytes } from '@kreuzberg/wasm';
|
|
646
|
+
*
|
|
647
|
+
* // Fetch from URL
|
|
648
|
+
* const response = await fetch('document.pdf');
|
|
649
|
+
* const arrayBuffer = await response.arrayBuffer();
|
|
650
|
+
* const data = new Uint8Array(arrayBuffer);
|
|
651
|
+
*
|
|
652
|
+
* const result = await extractBytes(data, 'application/pdf', null);
|
|
653
|
+
* console.log(result.content.substring(0, 100));
|
|
654
|
+
* ```
|
|
655
|
+
* @param {Uint8Array} data
|
|
656
|
+
* @param {string} mime_type
|
|
657
|
+
* @param {any | null} [config]
|
|
658
|
+
* @returns {Promise<any>}
|
|
659
|
+
*/
|
|
660
|
+
function extractBytes(data, mime_type, config) {
|
|
661
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
662
|
+
const len0 = WASM_VECTOR_LEN;
|
|
663
|
+
const ret = wasm.extractBytes(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
664
|
+
return ret;
|
|
665
|
+
}
|
|
666
|
+
exports.extractBytes = extractBytes;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Extract content from a byte array (synchronous).
|
|
670
|
+
*
|
|
671
|
+
* Extracts text, tables, images, and metadata from a document represented as bytes.
|
|
672
|
+
* This is a synchronous, blocking operation suitable for smaller documents or when
|
|
673
|
+
* async execution is not available.
|
|
674
|
+
*
|
|
675
|
+
* # JavaScript Parameters
|
|
676
|
+
*
|
|
677
|
+
* * `data: Uint8Array` - The document bytes to extract
|
|
678
|
+
* * `mimeType: string` - MIME type of the data (e.g., "application/pdf", "image/png")
|
|
679
|
+
* * `config?: object` - Optional extraction configuration
|
|
680
|
+
*
|
|
681
|
+
* # Returns
|
|
682
|
+
*
|
|
683
|
+
* `object` - ExtractionResult with extracted content and metadata
|
|
684
|
+
*
|
|
685
|
+
* # Throws
|
|
686
|
+
*
|
|
687
|
+
* Throws an error if data is malformed or MIME type is unsupported.
|
|
688
|
+
*
|
|
689
|
+
* # Example
|
|
690
|
+
*
|
|
691
|
+
* ```javascript
|
|
692
|
+
* import { extractBytesSync } from '@kreuzberg/wasm';
|
|
693
|
+
* import { readFileSync } from 'fs';
|
|
694
|
+
*
|
|
695
|
+
* const buffer = readFileSync('document.pdf');
|
|
696
|
+
* const data = new Uint8Array(buffer);
|
|
697
|
+
* const result = extractBytesSync(data, 'application/pdf', null);
|
|
698
|
+
* console.log(result.content);
|
|
699
|
+
* ```
|
|
700
|
+
* @param {Uint8Array} data
|
|
701
|
+
* @param {string} mime_type
|
|
702
|
+
* @param {any | null} [config]
|
|
703
|
+
* @returns {any}
|
|
704
|
+
*/
|
|
705
|
+
function extractBytesSync(data, mime_type, config) {
|
|
706
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
707
|
+
const len0 = WASM_VECTOR_LEN;
|
|
708
|
+
const ret = wasm.extractBytesSync(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
709
|
+
if (ret[2]) {
|
|
710
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
711
|
+
}
|
|
712
|
+
return takeFromExternrefTable0(ret[0]);
|
|
713
|
+
}
|
|
714
|
+
exports.extractBytesSync = extractBytesSync;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Extract content from a web File or Blob (asynchronous).
|
|
718
|
+
*
|
|
719
|
+
* Extracts content from a web File (from `<input type="file">`) or Blob object
|
|
720
|
+
* using the FileReader API. Only available in browser environments.
|
|
721
|
+
*
|
|
722
|
+
* # JavaScript Parameters
|
|
723
|
+
*
|
|
724
|
+
* * `file: File | Blob` - The file or blob to extract
|
|
725
|
+
* * `mimeType?: string` - Optional MIME type hint (auto-detected if omitted)
|
|
726
|
+
* * `config?: object` - Optional extraction configuration
|
|
727
|
+
*
|
|
728
|
+
* # Returns
|
|
729
|
+
*
|
|
730
|
+
* `Promise<object>` - Promise resolving to ExtractionResult
|
|
731
|
+
*
|
|
732
|
+
* # Throws
|
|
733
|
+
*
|
|
734
|
+
* Rejects if file cannot be read or is malformed.
|
|
735
|
+
*
|
|
736
|
+
* # Example
|
|
737
|
+
*
|
|
738
|
+
* ```javascript
|
|
739
|
+
* import { extractFile } from '@kreuzberg/wasm';
|
|
740
|
+
*
|
|
741
|
+
* // From file input
|
|
742
|
+
* const fileInput = document.getElementById('file-input');
|
|
743
|
+
* const file = fileInput.files[0];
|
|
744
|
+
*
|
|
745
|
+
* const result = await extractFile(file, null, null);
|
|
746
|
+
* console.log(`Extracted ${result.content.length} characters`);
|
|
747
|
+
* ```
|
|
748
|
+
* @param {File} file
|
|
749
|
+
* @param {string | null} [mime_type]
|
|
750
|
+
* @param {any | null} [config]
|
|
751
|
+
* @returns {Promise<any>}
|
|
752
|
+
*/
|
|
753
|
+
function extractFile(file, mime_type, config) {
|
|
754
|
+
var ptr0 = isLikeNone(mime_type) ? 0 : passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
755
|
+
var len0 = WASM_VECTOR_LEN;
|
|
756
|
+
const ret = wasm.extractFile(file, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
757
|
+
return ret;
|
|
758
|
+
}
|
|
759
|
+
exports.extractFile = extractFile;
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Extract content from a file (synchronous) - NOT AVAILABLE IN WASM.
|
|
763
|
+
*
|
|
764
|
+
* File system operations are not available in WebAssembly environments.
|
|
765
|
+
* Use `extractBytesSync` or `extractBytes` instead.
|
|
766
|
+
*
|
|
767
|
+
* # Throws
|
|
768
|
+
*
|
|
769
|
+
* Always throws: "File operations are not available in WASM. Use extractBytesSync or extractBytes instead."
|
|
770
|
+
* @returns {any}
|
|
771
|
+
*/
|
|
772
|
+
function extractFileSync() {
|
|
773
|
+
const ret = wasm.extractFileSync();
|
|
774
|
+
if (ret[2]) {
|
|
775
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
776
|
+
}
|
|
777
|
+
return takeFromExternrefTable0(ret[0]);
|
|
778
|
+
}
|
|
779
|
+
exports.extractFileSync = extractFileSync;
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Get file extensions for a given MIME type.
|
|
783
|
+
*
|
|
784
|
+
* Looks up all known file extensions that correspond to the specified MIME type.
|
|
785
|
+
* Returns a JavaScript Array of extension strings (without leading dots).
|
|
786
|
+
*
|
|
787
|
+
* # JavaScript Parameters
|
|
788
|
+
*
|
|
789
|
+
* * `mimeType: string` - The MIME type to look up (e.g., "application/pdf")
|
|
790
|
+
*
|
|
791
|
+
* # Returns
|
|
792
|
+
*
|
|
793
|
+
* `string[]` - Array of file extensions for the MIME type
|
|
794
|
+
*
|
|
795
|
+
* # Throws
|
|
796
|
+
*
|
|
797
|
+
* Throws an error if the MIME type is not recognized.
|
|
798
|
+
*
|
|
799
|
+
* # Example
|
|
800
|
+
*
|
|
801
|
+
* ```javascript
|
|
802
|
+
* import { getExtensionsForMime } from '@kreuzberg/wasm';
|
|
803
|
+
*
|
|
804
|
+
* const pdfExts = getExtensionsForMime('application/pdf');
|
|
805
|
+
* console.log(pdfExts); // ["pdf"]
|
|
806
|
+
*
|
|
807
|
+
* const jpegExts = getExtensionsForMime('image/jpeg');
|
|
808
|
+
* console.log(jpegExts); // ["jpg", "jpeg"]
|
|
809
|
+
* ```
|
|
810
|
+
* @param {string} mime_type
|
|
811
|
+
* @returns {Array<any>}
|
|
812
|
+
*/
|
|
813
|
+
function getExtensionsForMime(mime_type) {
|
|
814
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
815
|
+
const len0 = WASM_VECTOR_LEN;
|
|
816
|
+
const ret = wasm.getExtensionsForMime(ptr0, len0);
|
|
817
|
+
if (ret[2]) {
|
|
818
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
819
|
+
}
|
|
820
|
+
return takeFromExternrefTable0(ret[0]);
|
|
821
|
+
}
|
|
822
|
+
exports.getExtensionsForMime = getExtensionsForMime;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Get MIME type from file extension.
|
|
826
|
+
*
|
|
827
|
+
* Looks up the MIME type associated with a given file extension.
|
|
828
|
+
* Returns None if the extension is not recognized.
|
|
829
|
+
*
|
|
830
|
+
* # JavaScript Parameters
|
|
831
|
+
*
|
|
832
|
+
* * `extension: string` - The file extension (with or without leading dot)
|
|
833
|
+
*
|
|
834
|
+
* # Returns
|
|
835
|
+
*
|
|
836
|
+
* `string | null` - The MIME type if found, null otherwise
|
|
837
|
+
*
|
|
838
|
+
* # Example
|
|
839
|
+
*
|
|
840
|
+
* ```javascript
|
|
841
|
+
* import { getMimeFromExtension } from '@kreuzberg/wasm';
|
|
842
|
+
*
|
|
843
|
+
* const pdfMime = getMimeFromExtension('pdf');
|
|
844
|
+
* console.log(pdfMime); // "application/pdf"
|
|
845
|
+
*
|
|
846
|
+
* const docMime = getMimeFromExtension('docx');
|
|
847
|
+
* console.log(docMime); // "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
848
|
+
*
|
|
849
|
+
* const unknownMime = getMimeFromExtension('unknown');
|
|
850
|
+
* console.log(unknownMime); // null
|
|
851
|
+
* ```
|
|
852
|
+
* @param {string} extension
|
|
853
|
+
* @returns {string | undefined}
|
|
854
|
+
*/
|
|
855
|
+
function getMimeFromExtension(extension) {
|
|
856
|
+
const ptr0 = passStringToWasm0(extension, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
857
|
+
const len0 = WASM_VECTOR_LEN;
|
|
858
|
+
const ret = wasm.getMimeFromExtension(ptr0, len0);
|
|
859
|
+
let v2;
|
|
860
|
+
if (ret[0] !== 0) {
|
|
861
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
862
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
863
|
+
}
|
|
864
|
+
return v2;
|
|
865
|
+
}
|
|
866
|
+
exports.getMimeFromExtension = getMimeFromExtension;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Get module information
|
|
870
|
+
* @returns {ModuleInfo}
|
|
871
|
+
*/
|
|
872
|
+
function get_module_info() {
|
|
873
|
+
const ret = wasm.get_module_info();
|
|
874
|
+
return ModuleInfo.__wrap(ret);
|
|
875
|
+
}
|
|
876
|
+
exports.get_module_info = get_module_info;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Initialize the WASM module
|
|
880
|
+
* This function should be called once at application startup
|
|
881
|
+
*/
|
|
882
|
+
function init() {
|
|
883
|
+
wasm.init();
|
|
884
|
+
}
|
|
885
|
+
exports.init = init;
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* @param {number} num_threads
|
|
889
|
+
* @returns {Promise<any>}
|
|
890
|
+
*/
|
|
891
|
+
function initThreadPool(num_threads) {
|
|
892
|
+
const ret = wasm.initThreadPool(num_threads);
|
|
893
|
+
return ret;
|
|
894
|
+
}
|
|
895
|
+
exports.initThreadPool = initThreadPool;
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Helper function to initialize the thread pool with error handling
|
|
899
|
+
* Accepts the number of threads to use for the thread pool.
|
|
900
|
+
* Returns true if initialization succeeded, false for graceful degradation.
|
|
901
|
+
*
|
|
902
|
+
* This function wraps init_thread_pool with panic handling to ensure graceful
|
|
903
|
+
* degradation if thread pool initialization fails. The application will continue
|
|
904
|
+
* to work in single-threaded mode if the thread pool cannot be initialized.
|
|
905
|
+
* @param {number} num_threads
|
|
906
|
+
* @returns {boolean}
|
|
907
|
+
*/
|
|
908
|
+
function init_thread_pool_safe(num_threads) {
|
|
909
|
+
const ret = wasm.init_thread_pool_safe(num_threads);
|
|
910
|
+
return ret !== 0;
|
|
911
|
+
}
|
|
912
|
+
exports.init_thread_pool_safe = init_thread_pool_safe;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* List all registered OCR backend names.
|
|
916
|
+
*
|
|
917
|
+
* # Returns
|
|
918
|
+
*
|
|
919
|
+
* Array of OCR backend names, or Err if an error occurs.
|
|
920
|
+
*
|
|
921
|
+
* # Example
|
|
922
|
+
*
|
|
923
|
+
* ```javascript
|
|
924
|
+
* const backends = listOcrBackends();
|
|
925
|
+
* console.log(backends); // ["tesseract", "custom-ocr", ...]
|
|
926
|
+
* ```
|
|
927
|
+
* @returns {Array<any>}
|
|
928
|
+
*/
|
|
929
|
+
function list_ocr_backends() {
|
|
930
|
+
const ret = wasm.list_ocr_backends();
|
|
931
|
+
if (ret[2]) {
|
|
932
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
933
|
+
}
|
|
934
|
+
return takeFromExternrefTable0(ret[0]);
|
|
935
|
+
}
|
|
936
|
+
exports.list_ocr_backends = list_ocr_backends;
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* List all registered post-processor names.
|
|
940
|
+
*
|
|
941
|
+
* # Returns
|
|
942
|
+
*
|
|
943
|
+
* Array of post-processor names, or Err if an error occurs.
|
|
944
|
+
*
|
|
945
|
+
* # Example
|
|
946
|
+
*
|
|
947
|
+
* ```javascript
|
|
948
|
+
* const processors = listPostProcessors();
|
|
949
|
+
* console.log(processors); // ["my-post-processor", ...]
|
|
950
|
+
* ```
|
|
951
|
+
* @returns {Array<any>}
|
|
952
|
+
*/
|
|
953
|
+
function list_post_processors() {
|
|
954
|
+
const ret = wasm.list_post_processors();
|
|
955
|
+
if (ret[2]) {
|
|
956
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
957
|
+
}
|
|
958
|
+
return takeFromExternrefTable0(ret[0]);
|
|
959
|
+
}
|
|
960
|
+
exports.list_post_processors = list_post_processors;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* List all registered validator names.
|
|
964
|
+
*
|
|
965
|
+
* # Returns
|
|
966
|
+
*
|
|
967
|
+
* Array of validator names, or Err if an error occurs.
|
|
968
|
+
*
|
|
969
|
+
* # Example
|
|
970
|
+
*
|
|
971
|
+
* ```javascript
|
|
972
|
+
* const validators = listValidators();
|
|
973
|
+
* console.log(validators); // ["min-content-length", ...]
|
|
974
|
+
* ```
|
|
975
|
+
* @returns {Array<any>}
|
|
976
|
+
*/
|
|
977
|
+
function list_validators() {
|
|
978
|
+
const ret = wasm.list_validators();
|
|
979
|
+
if (ret[2]) {
|
|
980
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
981
|
+
}
|
|
982
|
+
return takeFromExternrefTable0(ret[0]);
|
|
983
|
+
}
|
|
984
|
+
exports.list_validators = list_validators;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Load configuration from a string in the specified format.
|
|
988
|
+
*
|
|
989
|
+
* Parses configuration content from TOML, YAML, or JSON formats and returns
|
|
990
|
+
* a JavaScript object representing the ExtractionConfig. This is the primary
|
|
991
|
+
* way to load configuration in WebAssembly environments since file system
|
|
992
|
+
* access is not available.
|
|
993
|
+
*
|
|
994
|
+
* # JavaScript Parameters
|
|
995
|
+
*
|
|
996
|
+
* * `content: string` - The configuration content as a string
|
|
997
|
+
* * `format: string` - The format of the content: "toml", "yaml", or "json"
|
|
998
|
+
*
|
|
999
|
+
* # Returns
|
|
1000
|
+
*
|
|
1001
|
+
* `object` - JavaScript object representing the ExtractionConfig
|
|
1002
|
+
*
|
|
1003
|
+
* # Throws
|
|
1004
|
+
*
|
|
1005
|
+
* Throws an error if:
|
|
1006
|
+
* - The content is invalid for the specified format
|
|
1007
|
+
* - The format is not one of "toml", "yaml", or "json"
|
|
1008
|
+
* - Required configuration fields are missing or invalid
|
|
1009
|
+
*
|
|
1010
|
+
* # Example
|
|
1011
|
+
*
|
|
1012
|
+
* ```javascript
|
|
1013
|
+
* import { loadConfigFromString } from '@kreuzberg/wasm';
|
|
1014
|
+
*
|
|
1015
|
+
* // Load from TOML string
|
|
1016
|
+
* const tomlConfig = `
|
|
1017
|
+
* use_cache = true
|
|
1018
|
+
* enable_quality_processing = true
|
|
1019
|
+
* `;
|
|
1020
|
+
* const config1 = loadConfigFromString(tomlConfig, 'toml');
|
|
1021
|
+
* console.log(config1.use_cache); // true
|
|
1022
|
+
*
|
|
1023
|
+
* // Load from YAML string
|
|
1024
|
+
* const yamlConfig = `
|
|
1025
|
+
* use_cache: true
|
|
1026
|
+
* enable_quality_processing: true
|
|
1027
|
+
* `;
|
|
1028
|
+
* const config2 = loadConfigFromString(yamlConfig, 'yaml');
|
|
1029
|
+
*
|
|
1030
|
+
* // Load from JSON string
|
|
1031
|
+
* const jsonConfig = `{"use_cache": true, "enable_quality_processing": true}`;
|
|
1032
|
+
* const config3 = loadConfigFromString(jsonConfig, 'json');
|
|
1033
|
+
* ```
|
|
1034
|
+
* @param {string} content
|
|
1035
|
+
* @param {string} format
|
|
1036
|
+
* @returns {any}
|
|
1037
|
+
*/
|
|
1038
|
+
function loadConfigFromString(content, format) {
|
|
1039
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1040
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1041
|
+
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1042
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1043
|
+
const ret = wasm.loadConfigFromString(ptr0, len0, ptr1, len1);
|
|
1044
|
+
if (ret[2]) {
|
|
1045
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1046
|
+
}
|
|
1047
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1048
|
+
}
|
|
1049
|
+
exports.loadConfigFromString = loadConfigFromString;
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* Normalize a MIME type string.
|
|
1053
|
+
*
|
|
1054
|
+
* Normalizes a MIME type by converting to lowercase and removing parameters
|
|
1055
|
+
* (e.g., "application/json; charset=utf-8" becomes "application/json").
|
|
1056
|
+
* This is useful for consistent MIME type comparison.
|
|
1057
|
+
*
|
|
1058
|
+
* # JavaScript Parameters
|
|
1059
|
+
*
|
|
1060
|
+
* * `mimeType: string` - The MIME type string to normalize
|
|
1061
|
+
*
|
|
1062
|
+
* # Returns
|
|
1063
|
+
*
|
|
1064
|
+
* `string` - The normalized MIME type
|
|
1065
|
+
*
|
|
1066
|
+
* # Example
|
|
1067
|
+
*
|
|
1068
|
+
* ```javascript
|
|
1069
|
+
* import { normalizeMimeType } from '@kreuzberg/wasm';
|
|
1070
|
+
*
|
|
1071
|
+
* const normalized1 = normalizeMimeType('Application/JSON');
|
|
1072
|
+
* console.log(normalized1); // "application/json"
|
|
1073
|
+
*
|
|
1074
|
+
* const normalized2 = normalizeMimeType('text/html; charset=utf-8');
|
|
1075
|
+
* console.log(normalized2); // "text/html"
|
|
1076
|
+
*
|
|
1077
|
+
* const normalized3 = normalizeMimeType('Text/Plain; charset=ISO-8859-1');
|
|
1078
|
+
* console.log(normalized3); // "text/plain"
|
|
1079
|
+
* ```
|
|
1080
|
+
* @param {string} mime_type
|
|
1081
|
+
* @returns {string}
|
|
1082
|
+
*/
|
|
1083
|
+
function normalizeMimeType(mime_type) {
|
|
1084
|
+
let deferred2_0;
|
|
1085
|
+
let deferred2_1;
|
|
1086
|
+
try {
|
|
1087
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1088
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1089
|
+
const ret = wasm.normalizeMimeType(ptr0, len0);
|
|
1090
|
+
deferred2_0 = ret[0];
|
|
1091
|
+
deferred2_1 = ret[1];
|
|
1092
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1093
|
+
} finally {
|
|
1094
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
exports.normalizeMimeType = normalizeMimeType;
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Register a custom OCR backend.
|
|
1101
|
+
*
|
|
1102
|
+
* # Arguments
|
|
1103
|
+
*
|
|
1104
|
+
* * `backend` - JavaScript object implementing the OcrBackendProtocol interface:
|
|
1105
|
+
* - `name(): string` - Unique backend name
|
|
1106
|
+
* - `supportedLanguages(): string[]` - Array of language codes the backend supports
|
|
1107
|
+
* - `processImage(imageBase64: string, language: string): Promise<string>` - Process image and return JSON result
|
|
1108
|
+
*
|
|
1109
|
+
* # Returns
|
|
1110
|
+
*
|
|
1111
|
+
* Ok if registration succeeds, Err with description if it fails.
|
|
1112
|
+
*
|
|
1113
|
+
* # Example
|
|
1114
|
+
*
|
|
1115
|
+
* ```javascript
|
|
1116
|
+
* registerOcrBackend({
|
|
1117
|
+
* name: () => "custom-ocr",
|
|
1118
|
+
* supportedLanguages: () => ["en", "es", "fr"],
|
|
1119
|
+
* processImage: async (imageBase64, language) => {
|
|
1120
|
+
* const buffer = Buffer.from(imageBase64, "base64");
|
|
1121
|
+
* // Process image with custom OCR engine
|
|
1122
|
+
* const text = await customOcrEngine.recognize(buffer, language);
|
|
1123
|
+
* return JSON.stringify({
|
|
1124
|
+
* content: text,
|
|
1125
|
+
* mime_type: "text/plain",
|
|
1126
|
+
* metadata: {}
|
|
1127
|
+
* });
|
|
1128
|
+
* }
|
|
1129
|
+
* });
|
|
1130
|
+
* ```
|
|
1131
|
+
* @param {any} backend
|
|
1132
|
+
*/
|
|
1133
|
+
function register_ocr_backend(backend) {
|
|
1134
|
+
const ret = wasm.register_ocr_backend(backend);
|
|
1135
|
+
if (ret[1]) {
|
|
1136
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
exports.register_ocr_backend = register_ocr_backend;
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* Register a custom post-processor.
|
|
1143
|
+
*
|
|
1144
|
+
* # Arguments
|
|
1145
|
+
*
|
|
1146
|
+
* * `processor` - JavaScript object implementing the PostProcessorProtocol interface:
|
|
1147
|
+
* - `name(): string` - Unique processor name
|
|
1148
|
+
* - `process(jsonString: string): Promise<string>` - Process function that takes JSON input
|
|
1149
|
+
* - `processingStage(): "early" | "middle" | "late"` - Optional processing stage (defaults to "middle")
|
|
1150
|
+
*
|
|
1151
|
+
* # Returns
|
|
1152
|
+
*
|
|
1153
|
+
* Ok if registration succeeds, Err with description if it fails.
|
|
1154
|
+
*
|
|
1155
|
+
* # Example
|
|
1156
|
+
*
|
|
1157
|
+
* ```javascript
|
|
1158
|
+
* registerPostProcessor({
|
|
1159
|
+
* name: () => "my-post-processor",
|
|
1160
|
+
* processingStage: () => "middle",
|
|
1161
|
+
* process: async (jsonString) => {
|
|
1162
|
+
* const result = JSON.parse(jsonString);
|
|
1163
|
+
* // Process the extraction result
|
|
1164
|
+
* result.metadata.processed_by = "my-post-processor";
|
|
1165
|
+
* return JSON.stringify(result);
|
|
1166
|
+
* }
|
|
1167
|
+
* });
|
|
1168
|
+
* ```
|
|
1169
|
+
* @param {any} processor
|
|
1170
|
+
*/
|
|
1171
|
+
function register_post_processor(processor) {
|
|
1172
|
+
const ret = wasm.register_post_processor(processor);
|
|
1173
|
+
if (ret[1]) {
|
|
1174
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
exports.register_post_processor = register_post_processor;
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Register a custom validator.
|
|
1181
|
+
*
|
|
1182
|
+
* # Arguments
|
|
1183
|
+
*
|
|
1184
|
+
* * `validator` - JavaScript object implementing the ValidatorProtocol interface:
|
|
1185
|
+
* - `name(): string` - Unique validator name
|
|
1186
|
+
* - `validate(jsonString: string): Promise<string>` - Validation function returning empty string on success, error message on failure
|
|
1187
|
+
* - `priority(): number` - Optional priority (defaults to 50, higher runs first)
|
|
1188
|
+
*
|
|
1189
|
+
* # Returns
|
|
1190
|
+
*
|
|
1191
|
+
* Ok if registration succeeds, Err with description if it fails.
|
|
1192
|
+
*
|
|
1193
|
+
* # Example
|
|
1194
|
+
*
|
|
1195
|
+
* ```javascript
|
|
1196
|
+
* registerValidator({
|
|
1197
|
+
* name: () => "min-content-length",
|
|
1198
|
+
* priority: () => 100,
|
|
1199
|
+
* validate: async (jsonString) => {
|
|
1200
|
+
* const result = JSON.parse(jsonString);
|
|
1201
|
+
* if (result.content.length < 100) {
|
|
1202
|
+
* return "Content too short"; // Validation failure
|
|
1203
|
+
* }
|
|
1204
|
+
* return ""; // Success
|
|
1205
|
+
* }
|
|
1206
|
+
* });
|
|
1207
|
+
* ```
|
|
1208
|
+
* @param {any} validator
|
|
1209
|
+
*/
|
|
1210
|
+
function register_validator(validator) {
|
|
1211
|
+
const ret = wasm.register_validator(validator);
|
|
1212
|
+
if (ret[1]) {
|
|
1213
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
exports.register_validator = register_validator;
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Unregister an OCR backend by name.
|
|
1220
|
+
*
|
|
1221
|
+
* # Arguments
|
|
1222
|
+
*
|
|
1223
|
+
* * `name` - Name of the OCR backend to unregister
|
|
1224
|
+
*
|
|
1225
|
+
* # Returns
|
|
1226
|
+
*
|
|
1227
|
+
* Ok if unregistration succeeds, Err if the backend is not found or other error occurs.
|
|
1228
|
+
*
|
|
1229
|
+
* # Example
|
|
1230
|
+
*
|
|
1231
|
+
* ```javascript
|
|
1232
|
+
* unregisterOcrBackend("custom-ocr");
|
|
1233
|
+
* ```
|
|
1234
|
+
* @param {string} name
|
|
1235
|
+
*/
|
|
1236
|
+
function unregister_ocr_backend(name) {
|
|
1237
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1238
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1239
|
+
const ret = wasm.unregister_ocr_backend(ptr0, len0);
|
|
1240
|
+
if (ret[1]) {
|
|
1241
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
exports.unregister_ocr_backend = unregister_ocr_backend;
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Unregister a post-processor by name.
|
|
1248
|
+
*
|
|
1249
|
+
* # Arguments
|
|
1250
|
+
*
|
|
1251
|
+
* * `name` - Name of the post-processor to unregister
|
|
1252
|
+
*
|
|
1253
|
+
* # Returns
|
|
1254
|
+
*
|
|
1255
|
+
* Ok if unregistration succeeds, Err if the processor is not found or other error occurs.
|
|
1256
|
+
*
|
|
1257
|
+
* # Example
|
|
1258
|
+
*
|
|
1259
|
+
* ```javascript
|
|
1260
|
+
* unregisterPostProcessor("my-post-processor");
|
|
1261
|
+
* ```
|
|
1262
|
+
* @param {string} name
|
|
1263
|
+
*/
|
|
1264
|
+
function unregister_post_processor(name) {
|
|
1265
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1266
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1267
|
+
const ret = wasm.unregister_post_processor(ptr0, len0);
|
|
1268
|
+
if (ret[1]) {
|
|
1269
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
exports.unregister_post_processor = unregister_post_processor;
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Unregister a validator by name.
|
|
1276
|
+
*
|
|
1277
|
+
* # Arguments
|
|
1278
|
+
*
|
|
1279
|
+
* * `name` - Name of the validator to unregister
|
|
1280
|
+
*
|
|
1281
|
+
* # Returns
|
|
1282
|
+
*
|
|
1283
|
+
* Ok if unregistration succeeds, Err if the validator is not found or other error occurs.
|
|
1284
|
+
*
|
|
1285
|
+
* # Example
|
|
1286
|
+
*
|
|
1287
|
+
* ```javascript
|
|
1288
|
+
* unregisterValidator("min-content-length");
|
|
1289
|
+
* ```
|
|
1290
|
+
* @param {string} name
|
|
1291
|
+
*/
|
|
1292
|
+
function unregister_validator(name) {
|
|
1293
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1294
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1295
|
+
const ret = wasm.unregister_validator(ptr0, len0);
|
|
1296
|
+
if (ret[1]) {
|
|
1297
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
exports.unregister_validator = unregister_validator;
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* Version of the kreuzberg-wasm binding
|
|
1304
|
+
* @returns {string}
|
|
1305
|
+
*/
|
|
1306
|
+
function version() {
|
|
1307
|
+
let deferred1_0;
|
|
1308
|
+
let deferred1_1;
|
|
1309
|
+
try {
|
|
1310
|
+
const ret = wasm.version();
|
|
1311
|
+
deferred1_0 = ret[0];
|
|
1312
|
+
deferred1_1 = ret[1];
|
|
1313
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1314
|
+
} finally {
|
|
1315
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
exports.version = version;
|
|
1319
|
+
|
|
1320
|
+
class wbg_rayon_PoolBuilder {
|
|
1321
|
+
static __wrap(ptr) {
|
|
1322
|
+
ptr = ptr >>> 0;
|
|
1323
|
+
const obj = Object.create(wbg_rayon_PoolBuilder.prototype);
|
|
1324
|
+
obj.__wbg_ptr = ptr;
|
|
1325
|
+
wbg_rayon_PoolBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1326
|
+
return obj;
|
|
1327
|
+
}
|
|
1328
|
+
__destroy_into_raw() {
|
|
1329
|
+
const ptr = this.__wbg_ptr;
|
|
1330
|
+
this.__wbg_ptr = 0;
|
|
1331
|
+
wbg_rayon_PoolBuilderFinalization.unregister(this);
|
|
1332
|
+
return ptr;
|
|
1333
|
+
}
|
|
1334
|
+
free() {
|
|
1335
|
+
const ptr = this.__destroy_into_raw();
|
|
1336
|
+
wasm.__wbg_wbg_rayon_poolbuilder_free(ptr, 0);
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* @returns {number}
|
|
1340
|
+
*/
|
|
1341
|
+
numThreads() {
|
|
1342
|
+
const ret = wasm.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr);
|
|
1343
|
+
return ret >>> 0;
|
|
1344
|
+
}
|
|
1345
|
+
build() {
|
|
1346
|
+
wasm.wbg_rayon_poolbuilder_build(this.__wbg_ptr);
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* @returns {number}
|
|
1350
|
+
*/
|
|
1351
|
+
receiver() {
|
|
1352
|
+
const ret = wasm.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr);
|
|
1353
|
+
return ret >>> 0;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
if (Symbol.dispose) wbg_rayon_PoolBuilder.prototype[Symbol.dispose] = wbg_rayon_PoolBuilder.prototype.free;
|
|
1357
|
+
exports.wbg_rayon_PoolBuilder = wbg_rayon_PoolBuilder;
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* @param {number} receiver
|
|
1361
|
+
*/
|
|
1362
|
+
function wbg_rayon_start_worker(receiver) {
|
|
1363
|
+
wasm.wbg_rayon_start_worker(receiver);
|
|
1364
|
+
}
|
|
1365
|
+
exports.wbg_rayon_start_worker = wbg_rayon_start_worker;
|
|
1366
|
+
|
|
1367
|
+
exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
1368
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1369
|
+
return ret;
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
exports.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
|
|
1373
|
+
const ret = Number(arg0);
|
|
1374
|
+
return ret;
|
|
1375
|
+
};
|
|
1376
|
+
|
|
1377
|
+
exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
1378
|
+
const ret = String(arg1);
|
|
1379
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1380
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1381
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1382
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1385
|
+
exports.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
|
|
1386
|
+
const v = arg1;
|
|
1387
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1388
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1389
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
exports.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
|
|
1393
|
+
const v = arg0;
|
|
1394
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1395
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
1399
|
+
const ret = debugString(arg1);
|
|
1400
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1401
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1402
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1403
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
exports.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
|
|
1407
|
+
const ret = arg0 in arg1;
|
|
1408
|
+
return ret;
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
exports.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
|
|
1412
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1413
|
+
return ret;
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
1417
|
+
const ret = typeof(arg0) === 'function';
|
|
1418
|
+
return ret;
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
exports.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
1422
|
+
const val = arg0;
|
|
1423
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1424
|
+
return ret;
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
exports.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
|
|
1428
|
+
const ret = typeof(arg0) === 'string';
|
|
1429
|
+
return ret;
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
1433
|
+
const ret = arg0 === undefined;
|
|
1434
|
+
return ret;
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
exports.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
|
|
1438
|
+
const ret = arg0 === arg1;
|
|
1439
|
+
return ret;
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
exports.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
|
|
1443
|
+
const ret = arg0 == arg1;
|
|
1444
|
+
return ret;
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
exports.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
|
|
1448
|
+
const ret = wasm.memory;
|
|
1449
|
+
return ret;
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
exports.__wbg___wbindgen_module_967adef62ea6cbf8 = function() {
|
|
1453
|
+
const ret = wasmModule;
|
|
1454
|
+
return ret;
|
|
1455
|
+
};
|
|
1456
|
+
|
|
1457
|
+
exports.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
|
|
1458
|
+
const obj = arg1;
|
|
1459
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1460
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1461
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
exports.__wbg___wbindgen_rethrow_78714972834ecdf1 = function(arg0) {
|
|
1465
|
+
throw arg0;
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
1469
|
+
const obj = arg1;
|
|
1470
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1471
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1472
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1473
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1474
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1475
|
+
};
|
|
1476
|
+
|
|
1477
|
+
exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
1478
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1479
|
+
};
|
|
1480
|
+
|
|
1481
|
+
exports.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
|
|
1482
|
+
arg0._wbg_cb_unref();
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
exports.__wbg_addEventListener_6a82629b3d430a48 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1486
|
+
arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
|
|
1487
|
+
}, arguments) };
|
|
1488
|
+
|
|
1489
|
+
exports.__wbg_async_bba5a2ac54b734df = function(arg0) {
|
|
1490
|
+
const ret = arg0.async;
|
|
1491
|
+
return ret;
|
|
1492
|
+
};
|
|
1493
|
+
|
|
1494
|
+
exports.__wbg_buffer_063cd102cc769a1c = function(arg0) {
|
|
1495
|
+
const ret = arg0.buffer;
|
|
1496
|
+
return ret;
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
exports.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1500
|
+
const ret = arg0.call(arg1, arg2);
|
|
1501
|
+
return ret;
|
|
1502
|
+
}, arguments) };
|
|
1503
|
+
|
|
1504
|
+
exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
1505
|
+
const ret = arg0.call(arg1);
|
|
1506
|
+
return ret;
|
|
1507
|
+
}, arguments) };
|
|
1508
|
+
|
|
1509
|
+
exports.__wbg_call_c8baa5c5e72d274e = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1510
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
1511
|
+
return ret;
|
|
1512
|
+
}, arguments) };
|
|
1513
|
+
|
|
1514
|
+
exports.__wbg_construct_8d61a09a064d7a0e = function() { return handleError(function (arg0, arg1) {
|
|
1515
|
+
const ret = Reflect.construct(arg0, arg1);
|
|
1516
|
+
return ret;
|
|
1517
|
+
}, arguments) };
|
|
1518
|
+
|
|
1519
|
+
exports.__wbg_data_8bf4ae669a78a688 = function(arg0) {
|
|
1520
|
+
const ret = arg0.data;
|
|
1521
|
+
return ret;
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1524
|
+
exports.__wbg_done_62ea16af4ce34b24 = function(arg0) {
|
|
1525
|
+
const ret = arg0.done;
|
|
1526
|
+
return ret;
|
|
1527
|
+
};
|
|
1528
|
+
|
|
1529
|
+
exports.__wbg_entries_83c79938054e065f = function(arg0) {
|
|
1530
|
+
const ret = Object.entries(arg0);
|
|
1531
|
+
return ret;
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
exports.__wbg_from_29a8414a7a7cd19d = function(arg0) {
|
|
1535
|
+
const ret = Array.from(arg0);
|
|
1536
|
+
return ret;
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
exports.__wbg_getRandomValues_ea728b1d79dae146 = function() { return handleError(function (arg0) {
|
|
1540
|
+
globalThis.crypto.getRandomValues(arg0);
|
|
1541
|
+
}, arguments) };
|
|
1542
|
+
|
|
1543
|
+
exports.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
1544
|
+
const ret = arg0[arg1 >>> 0];
|
|
1545
|
+
return ret;
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
exports.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
|
|
1549
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1550
|
+
return ret;
|
|
1551
|
+
}, arguments) };
|
|
1552
|
+
|
|
1553
|
+
exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
|
|
1554
|
+
const ret = arg0[arg1];
|
|
1555
|
+
return ret;
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
exports.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
|
|
1559
|
+
let result;
|
|
1560
|
+
try {
|
|
1561
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1562
|
+
} catch (_) {
|
|
1563
|
+
result = false;
|
|
1564
|
+
}
|
|
1565
|
+
const ret = result;
|
|
1566
|
+
return ret;
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1569
|
+
exports.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
|
|
1570
|
+
let result;
|
|
1571
|
+
try {
|
|
1572
|
+
result = arg0 instanceof Map;
|
|
1573
|
+
} catch (_) {
|
|
1574
|
+
result = false;
|
|
1575
|
+
}
|
|
1576
|
+
const ret = result;
|
|
1577
|
+
return ret;
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
exports.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
|
|
1581
|
+
let result;
|
|
1582
|
+
try {
|
|
1583
|
+
result = arg0 instanceof Uint8Array;
|
|
1584
|
+
} catch (_) {
|
|
1585
|
+
result = false;
|
|
1586
|
+
}
|
|
1587
|
+
const ret = result;
|
|
1588
|
+
return ret;
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
exports.__wbg_instanceof_Window_b5cf7783caa68180 = function(arg0) {
|
|
1592
|
+
let result;
|
|
1593
|
+
try {
|
|
1594
|
+
result = arg0 instanceof Window;
|
|
1595
|
+
} catch (_) {
|
|
1596
|
+
result = false;
|
|
1597
|
+
}
|
|
1598
|
+
const ret = result;
|
|
1599
|
+
return ret;
|
|
1600
|
+
};
|
|
1601
|
+
|
|
1602
|
+
exports.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
|
|
1603
|
+
const ret = Array.isArray(arg0);
|
|
1604
|
+
return ret;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
exports.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
|
|
1608
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1609
|
+
return ret;
|
|
1610
|
+
};
|
|
1611
|
+
|
|
1612
|
+
exports.__wbg_iterator_27b7c8b35ab3e86b = function() {
|
|
1613
|
+
const ret = Symbol.iterator;
|
|
1614
|
+
return ret;
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
exports.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
1618
|
+
const ret = arg0.length;
|
|
1619
|
+
return ret;
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
exports.__wbg_length_d45040a40c570362 = function(arg0) {
|
|
1623
|
+
const ret = arg0.length;
|
|
1624
|
+
return ret;
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
exports.__wbg_log_1d990106d99dacb7 = function(arg0) {
|
|
1628
|
+
console.log(arg0);
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
exports.__wbg_new_111dde64cffa8ba1 = function() { return handleError(function () {
|
|
1632
|
+
const ret = new FileReader();
|
|
1633
|
+
return ret;
|
|
1634
|
+
}, arguments) };
|
|
1635
|
+
|
|
1636
|
+
exports.__wbg_new_1ba21ce319a06297 = function() {
|
|
1637
|
+
const ret = new Object();
|
|
1638
|
+
return ret;
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1641
|
+
exports.__wbg_new_25f239778d6112b9 = function() {
|
|
1642
|
+
const ret = new Array();
|
|
1643
|
+
return ret;
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
exports.__wbg_new_53cb1e86c1ef5d2a = function() { return handleError(function (arg0, arg1) {
|
|
1647
|
+
const ret = new Worker(getStringFromWasm0(arg0, arg1));
|
|
1648
|
+
return ret;
|
|
1649
|
+
}, arguments) };
|
|
1650
|
+
|
|
1651
|
+
exports.__wbg_new_6421f6084cc5bc5a = function(arg0) {
|
|
1652
|
+
const ret = new Uint8Array(arg0);
|
|
1653
|
+
return ret;
|
|
1654
|
+
};
|
|
1655
|
+
|
|
1656
|
+
exports.__wbg_new_b546ae120718850e = function() {
|
|
1657
|
+
const ret = new Map();
|
|
1658
|
+
return ret;
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1661
|
+
exports.__wbg_new_de1e660b88fc921f = function(arg0) {
|
|
1662
|
+
const ret = new Int32Array(arg0);
|
|
1663
|
+
return ret;
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1666
|
+
exports.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
|
|
1667
|
+
try {
|
|
1668
|
+
var state0 = {a: arg0, b: arg1};
|
|
1669
|
+
var cb0 = (arg0, arg1) => {
|
|
1670
|
+
const a = state0.a;
|
|
1671
|
+
state0.a = 0;
|
|
1672
|
+
try {
|
|
1673
|
+
return wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue__wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____(a, state0.b, arg0, arg1);
|
|
1674
|
+
} finally {
|
|
1675
|
+
state0.a = a;
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
const ret = new Promise(cb0);
|
|
1679
|
+
return ret;
|
|
1680
|
+
} finally {
|
|
1681
|
+
state0.a = state0.b = 0;
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
exports.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
1686
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1687
|
+
return ret;
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1690
|
+
exports.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
|
|
1691
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1692
|
+
return ret;
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
exports.__wbg_next_138a17bbf04e926c = function(arg0) {
|
|
1696
|
+
const ret = arg0.next;
|
|
1697
|
+
return ret;
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
exports.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
|
|
1701
|
+
const ret = arg0.next();
|
|
1702
|
+
return ret;
|
|
1703
|
+
}, arguments) };
|
|
1704
|
+
|
|
1705
|
+
exports.__wbg_of_6505a0eb509da02e = function(arg0) {
|
|
1706
|
+
const ret = Array.of(arg0);
|
|
1707
|
+
return ret;
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
exports.__wbg_of_7779827fa663eec8 = function(arg0, arg1, arg2) {
|
|
1711
|
+
const ret = Array.of(arg0, arg1, arg2);
|
|
1712
|
+
return ret;
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
exports.__wbg_postMessage_07504dbe15265d5c = function() { return handleError(function (arg0, arg1) {
|
|
1716
|
+
arg0.postMessage(arg1);
|
|
1717
|
+
}, arguments) };
|
|
1718
|
+
|
|
1719
|
+
exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
1720
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1723
|
+
exports.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
|
|
1724
|
+
const ret = arg0.push(arg1);
|
|
1725
|
+
return ret;
|
|
1726
|
+
};
|
|
1727
|
+
|
|
1728
|
+
exports.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
|
|
1729
|
+
const ret = arg0.queueMicrotask;
|
|
1730
|
+
return ret;
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
exports.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
|
|
1734
|
+
queueMicrotask(arg0);
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
exports.__wbg_readAsArrayBuffer_0aca937439be3197 = function() { return handleError(function (arg0, arg1) {
|
|
1738
|
+
arg0.readAsArrayBuffer(arg1);
|
|
1739
|
+
}, arguments) };
|
|
1740
|
+
|
|
1741
|
+
exports.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
|
|
1742
|
+
const ret = Promise.resolve(arg0);
|
|
1743
|
+
return ret;
|
|
1744
|
+
};
|
|
1745
|
+
|
|
1746
|
+
exports.__wbg_result_893437a1eaacc4df = function() { return handleError(function (arg0) {
|
|
1747
|
+
const ret = arg0.result;
|
|
1748
|
+
return ret;
|
|
1749
|
+
}, arguments) };
|
|
1750
|
+
|
|
1751
|
+
exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
1752
|
+
arg0[arg1] = arg2;
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
exports.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
1756
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1757
|
+
};
|
|
1758
|
+
|
|
1759
|
+
exports.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
|
|
1760
|
+
const ret = arg0.set(arg1, arg2);
|
|
1761
|
+
return ret;
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1764
|
+
exports.__wbg_set_onmessage_deb94985de696ac7 = function(arg0, arg1) {
|
|
1765
|
+
arg0.onmessage = arg1;
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
exports.__wbg_startWorkers_2ca11761e08ff5d5 = function(arg0, arg1, arg2) {
|
|
1769
|
+
const ret = startWorkers(arg0, arg1, wbg_rayon_PoolBuilder.__wrap(arg2));
|
|
1770
|
+
return ret;
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
exports.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
1774
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1775
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
exports.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
1779
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1780
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
exports.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
1784
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1785
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
exports.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
1789
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1790
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1791
|
+
};
|
|
1792
|
+
|
|
1793
|
+
exports.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
|
|
1794
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1795
|
+
return ret;
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1798
|
+
exports.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
|
|
1799
|
+
const ret = arg0.then(arg1, arg2);
|
|
1800
|
+
return ret;
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
exports.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
|
|
1804
|
+
const ret = arg0.then(arg1);
|
|
1805
|
+
return ret;
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
exports.__wbg_type_cb833fc71b5282fb = function(arg0, arg1) {
|
|
1809
|
+
const ret = arg1.type;
|
|
1810
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1811
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1812
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1813
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1814
|
+
};
|
|
1815
|
+
|
|
1816
|
+
exports.__wbg_value_4cd497eeadba94bd = function(arg0) {
|
|
1817
|
+
const ret = arg0.value;
|
|
1818
|
+
return ret;
|
|
1819
|
+
};
|
|
1820
|
+
|
|
1821
|
+
exports.__wbg_value_57b7b035e117f7ee = function(arg0) {
|
|
1822
|
+
const ret = arg0.value;
|
|
1823
|
+
return ret;
|
|
1824
|
+
};
|
|
1825
|
+
|
|
1826
|
+
exports.__wbg_waitAsync_8afec80ffd213eca = function(arg0, arg1, arg2) {
|
|
1827
|
+
const ret = Atomics.waitAsync(arg0, arg1 >>> 0, arg2);
|
|
1828
|
+
return ret;
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
exports.__wbg_waitAsync_c186cb97ffacd552 = function() {
|
|
1832
|
+
const ret = Atomics.waitAsync;
|
|
1833
|
+
return ret;
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
exports.__wbg_warn_6e567d0d926ff881 = function(arg0) {
|
|
1837
|
+
console.warn(arg0);
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1840
|
+
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
1841
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1842
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1843
|
+
return ret;
|
|
1844
|
+
};
|
|
1845
|
+
|
|
1846
|
+
exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
1847
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1848
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1849
|
+
return ret;
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
exports.__wbindgen_cast_89b0435615caf0ab = function(arg0, arg1) {
|
|
1853
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 211, function: Function { arguments: [Externref], shim_idx: 212, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1854
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_3a2dd18e2c0b33f8___closure__destroy___dyn_core_f96ffdd67f65b3d8___ops__function__FnMut__wasm_bindgen_3a2dd18e2c0b33f8___JsValue____Output_______, wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____);
|
|
1855
|
+
return ret;
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1858
|
+
exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
1859
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1860
|
+
const ret = arg0;
|
|
1861
|
+
return ret;
|
|
1862
|
+
};
|
|
1863
|
+
|
|
1864
|
+
exports.__wbindgen_cast_af6f9b0439e0a862 = function(arg0, arg1) {
|
|
1865
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 211, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 212, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1866
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_3a2dd18e2c0b33f8___closure__destroy___dyn_core_f96ffdd67f65b3d8___ops__function__FnMut__wasm_bindgen_3a2dd18e2c0b33f8___JsValue____Output_______, wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____);
|
|
1867
|
+
return ret;
|
|
1868
|
+
};
|
|
1869
|
+
|
|
1870
|
+
exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
1871
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1872
|
+
const ret = arg0;
|
|
1873
|
+
return ret;
|
|
1874
|
+
};
|
|
1875
|
+
|
|
1876
|
+
exports.__wbindgen_init_externref_table = function() {
|
|
1877
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1878
|
+
const offset = table.grow(4);
|
|
1879
|
+
table.set(0, undefined);
|
|
1880
|
+
table.set(offset + 0, undefined);
|
|
1881
|
+
table.set(offset + 1, null);
|
|
1882
|
+
table.set(offset + 2, true);
|
|
1883
|
+
table.set(offset + 3, false);
|
|
1884
|
+
};
|
|
1885
|
+
|
|
1886
|
+
exports.__wbindgen_link_203404ece0e9bab9 = function(arg0) {
|
|
1887
|
+
const val = `onmessage = function (ev) {
|
|
1888
|
+
let [ia, index, value] = ev.data;
|
|
1889
|
+
ia = new Int32Array(ia.buffer);
|
|
1890
|
+
let result = Atomics.wait(ia, index, value);
|
|
1891
|
+
postMessage(result);
|
|
1892
|
+
};
|
|
1893
|
+
`;
|
|
1894
|
+
const ret = typeof URL.createObjectURL === 'undefined' ? "data:application/javascript," + encodeURIComponent(val) : URL.createObjectURL(new Blob([val], { type: "text/javascript" }));
|
|
1895
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1896
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1897
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1898
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1899
|
+
};
|
|
1900
|
+
|
|
1901
|
+
exports.__wbindgen_object_is_undefined = function(arg0) {
|
|
1902
|
+
const ret = arg0 === undefined;
|
|
1903
|
+
return ret;
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1906
|
+
exports.memory = new WebAssembly.Memory({initial:98,maximum:32768,shared:true});
|
|
1907
|
+
|
|
1908
|
+
const wasmPath = `${__dirname}/kreuzberg_wasm_bg.wasm`;
|
|
1909
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
1910
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
1911
|
+
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
1912
|
+
|
|
1913
|
+
wasm.__wbindgen_start();
|