@loradb/lora-wasm 0.8.5 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,866 +0,0 @@
1
- let wasm;
2
-
3
- let WASM_VECTOR_LEN = 0;
4
-
5
- let cachedUint8ArrayMemory0 = null;
6
-
7
- function getUint8ArrayMemory0() {
8
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
10
- }
11
- return cachedUint8ArrayMemory0;
12
- }
13
-
14
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
15
-
16
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
17
- ? function (arg, view) {
18
- return cachedTextEncoder.encodeInto(arg, view);
19
- }
20
- : function (arg, view) {
21
- const buf = cachedTextEncoder.encode(arg);
22
- view.set(buf);
23
- return {
24
- read: arg.length,
25
- written: buf.length
26
- };
27
- });
28
-
29
- function passStringToWasm0(arg, malloc, realloc) {
30
-
31
- if (realloc === undefined) {
32
- const buf = cachedTextEncoder.encode(arg);
33
- const ptr = malloc(buf.length, 1) >>> 0;
34
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
35
- WASM_VECTOR_LEN = buf.length;
36
- return ptr;
37
- }
38
-
39
- let len = arg.length;
40
- let ptr = malloc(len, 1) >>> 0;
41
-
42
- const mem = getUint8ArrayMemory0();
43
-
44
- let offset = 0;
45
-
46
- for (; offset < len; offset++) {
47
- const code = arg.charCodeAt(offset);
48
- if (code > 0x7F) break;
49
- mem[ptr + offset] = code;
50
- }
51
-
52
- if (offset !== len) {
53
- if (offset !== 0) {
54
- arg = arg.slice(offset);
55
- }
56
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
58
- const ret = encodeString(arg, view);
59
-
60
- offset += ret.written;
61
- ptr = realloc(ptr, len, offset, 1) >>> 0;
62
- }
63
-
64
- WASM_VECTOR_LEN = offset;
65
- return ptr;
66
- }
67
-
68
- let cachedDataViewMemory0 = null;
69
-
70
- function getDataViewMemory0() {
71
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
72
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
73
- }
74
- return cachedDataViewMemory0;
75
- }
76
-
77
- function addToExternrefTable0(obj) {
78
- const idx = wasm.__externref_table_alloc();
79
- wasm.__wbindgen_export_4.set(idx, obj);
80
- return idx;
81
- }
82
-
83
- function handleError(f, args) {
84
- try {
85
- return f.apply(this, args);
86
- } catch (e) {
87
- const idx = addToExternrefTable0(e);
88
- wasm.__wbindgen_exn_store(idx);
89
- }
90
- }
91
-
92
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
93
-
94
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
95
-
96
- function getStringFromWasm0(ptr, len) {
97
- ptr = ptr >>> 0;
98
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
99
- }
100
-
101
- function isLikeNone(x) {
102
- return x === undefined || x === null;
103
- }
104
-
105
- function debugString(val) {
106
- // primitive types
107
- const type = typeof val;
108
- if (type == 'number' || type == 'boolean' || val == null) {
109
- return `${val}`;
110
- }
111
- if (type == 'string') {
112
- return `"${val}"`;
113
- }
114
- if (type == 'symbol') {
115
- const description = val.description;
116
- if (description == null) {
117
- return 'Symbol';
118
- } else {
119
- return `Symbol(${description})`;
120
- }
121
- }
122
- if (type == 'function') {
123
- const name = val.name;
124
- if (typeof name == 'string' && name.length > 0) {
125
- return `Function(${name})`;
126
- } else {
127
- return 'Function';
128
- }
129
- }
130
- // objects
131
- if (Array.isArray(val)) {
132
- const length = val.length;
133
- let debug = '[';
134
- if (length > 0) {
135
- debug += debugString(val[0]);
136
- }
137
- for(let i = 1; i < length; i++) {
138
- debug += ', ' + debugString(val[i]);
139
- }
140
- debug += ']';
141
- return debug;
142
- }
143
- // Test for built-in
144
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
145
- let className;
146
- if (builtInMatches && builtInMatches.length > 1) {
147
- className = builtInMatches[1];
148
- } else {
149
- // Failed to match the standard '[object ClassName]'
150
- return toString.call(val);
151
- }
152
- if (className == 'Object') {
153
- // we're a user defined class or Object
154
- // JSON.stringify avoids problems with cycles, and is generally much
155
- // easier than looping through ownProperties of `val`.
156
- try {
157
- return 'Object(' + JSON.stringify(val) + ')';
158
- } catch (_) {
159
- return 'Object';
160
- }
161
- }
162
- // errors
163
- if (val instanceof Error) {
164
- return `${val.name}: ${val.message}\n${val.stack}`;
165
- }
166
- // TODO we could test for more things here, like `Set`s and `Map`s.
167
- return className;
168
- }
169
-
170
- function takeFromExternrefTable0(idx) {
171
- const value = wasm.__wbindgen_export_4.get(idx);
172
- wasm.__externref_table_dealloc(idx);
173
- return value;
174
- }
175
-
176
- function passArray8ToWasm0(arg, malloc) {
177
- const ptr = malloc(arg.length * 1, 1) >>> 0;
178
- getUint8ArrayMemory0().set(arg, ptr / 1);
179
- WASM_VECTOR_LEN = arg.length;
180
- return ptr;
181
- }
182
-
183
- function getArrayU8FromWasm0(ptr, len) {
184
- ptr = ptr >>> 0;
185
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
186
- }
187
- /**
188
- * Call once at module start to install a panic hook that routes Rust
189
- * panics to `console.error`. No-op if compiled without the default feature.
190
- */
191
- export function init() {
192
- wasm.init();
193
- }
194
-
195
- const WasmDatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
196
- ? { register: () => {}, unregister: () => {} }
197
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmdatabase_free(ptr >>> 0, 1));
198
- /**
199
- * In-memory Lora graph database handle.
200
- */
201
- export class WasmDatabase {
202
-
203
- __destroy_into_raw() {
204
- const ptr = this.__wbg_ptr;
205
- this.__wbg_ptr = 0;
206
- WasmDatabaseFinalization.unregister(this);
207
- return ptr;
208
- }
209
-
210
- free() {
211
- const ptr = this.__destroy_into_raw();
212
- wasm.__wbg_wasmdatabase_free(ptr, 0);
213
- }
214
- /**
215
- * @returns {number}
216
- */
217
- nodeCount() {
218
- const ret = wasm.wasmdatabase_nodeCount(this.__wbg_ptr);
219
- return ret >>> 0;
220
- }
221
- /**
222
- * Open a true native row stream. Rows are pulled from the Rust executor
223
- * one `next()` call at a time.
224
- * @param {string} query
225
- * @param {any} params
226
- * @returns {WasmQueryStream}
227
- */
228
- openStream(query, params) {
229
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
230
- const len0 = WASM_VECTOR_LEN;
231
- const ret = wasm.wasmdatabase_openStream(this.__wbg_ptr, ptr0, len0, params);
232
- if (ret[2]) {
233
- throw takeFromExternrefTable0(ret[1]);
234
- }
235
- return WasmQueryStream.__wrap(ret[0]);
236
- }
237
- /**
238
- * Execute an array of `{ query, params? }` statements inside one native
239
- * transaction. Returns an array of query results in statement order.
240
- * @param {any} statements
241
- * @param {string | null} [mode]
242
- * @returns {any}
243
- */
244
- transaction(statements, mode) {
245
- var ptr0 = isLikeNone(mode) ? 0 : passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
- var len0 = WASM_VECTOR_LEN;
247
- const ret = wasm.wasmdatabase_transaction(this.__wbg_ptr, statements, ptr0, len0);
248
- if (ret[2]) {
249
- throw takeFromExternrefTable0(ret[1]);
250
- }
251
- return takeFromExternrefTable0(ret[0]);
252
- }
253
- /**
254
- * Replace the graph state with a database snapshot decoded from `bytes`.
255
- * Legacy store snapshot bytes are accepted for compatibility.
256
- *
257
- * Returns a plain object matching the shape of `SnapshotMeta`:
258
- * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
259
- * @param {Uint8Array} bytes
260
- * @param {any} options
261
- * @returns {any}
262
- */
263
- loadSnapshot(bytes, options) {
264
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
265
- const len0 = WASM_VECTOR_LEN;
266
- const ret = wasm.wasmdatabase_loadSnapshot(this.__wbg_ptr, ptr0, len0, options);
267
- if (ret[2]) {
268
- throw takeFromExternrefTable0(ret[1]);
269
- }
270
- return takeFromExternrefTable0(ret[0]);
271
- }
272
- /**
273
- * Serialize the graph into database snapshot bytes. The caller is
274
- * responsible for writing them to IndexedDB, localStorage, a server, or
275
- * another host-provided store — WASM has no direct filesystem access.
276
- * The returned bytes can later be passed to `loadSnapshot` on any
277
- * `WasmDatabase` instance.
278
- *
279
- * Returns the serialized bytes as a `Uint8Array`.
280
- * @param {any} options
281
- * @returns {Uint8Array}
282
- */
283
- saveSnapshot(options) {
284
- const ret = wasm.wasmdatabase_saveSnapshot(this.__wbg_ptr, options);
285
- if (ret[3]) {
286
- throw takeFromExternrefTable0(ret[2]);
287
- }
288
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
289
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
290
- return v1;
291
- }
292
- /**
293
- * Execute a Lora query and return the result as a binary buffer.
294
- *
295
- * Wire format is the shared `lora_binding_buffer` layout. The TS
296
- * wrapper decodes it once into the same `{ columns, rows }` shape
297
- * `execute()` returns, but in a tight V8 loop instead of going
298
- * through `serde_wasm_bindgen` value-by-value. Materially faster
299
- * on bulk reads.
300
- * @param {string} query
301
- * @param {any} params
302
- * @returns {Uint8Array}
303
- */
304
- executeBuffer(query, params) {
305
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
306
- const len0 = WASM_VECTOR_LEN;
307
- const ret = wasm.wasmdatabase_executeBuffer(this.__wbg_ptr, ptr0, len0, params);
308
- if (ret[3]) {
309
- throw takeFromExternrefTable0(ret[2]);
310
- }
311
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
312
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
313
- return v2;
314
- }
315
- /**
316
- * @returns {number}
317
- */
318
- relationshipCount() {
319
- const ret = wasm.wasmdatabase_relationshipCount(this.__wbg_ptr);
320
- return ret >>> 0;
321
- }
322
- constructor() {
323
- const ret = wasm.wasmdatabase_new();
324
- this.__wbg_ptr = ret >>> 0;
325
- WasmDatabaseFinalization.register(this, this.__wbg_ptr, this);
326
- return this;
327
- }
328
- clear() {
329
- wasm.wasmdatabase_clear(this.__wbg_ptr);
330
- }
331
- /**
332
- * Execute a Lora query. `params` may be `undefined`, `null`, or a
333
- * plain object keyed by parameter name.
334
- *
335
- * Returns `{ columns: string[], rows: Array<Record<string, LoraValue>> }`
336
- * as a plain JS object (structured-clonable).
337
- * @param {string} query
338
- * @param {any} params
339
- * @returns {any}
340
- */
341
- execute(query, params) {
342
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
343
- const len0 = WASM_VECTOR_LEN;
344
- const ret = wasm.wasmdatabase_execute(this.__wbg_ptr, ptr0, len0, params);
345
- if (ret[2]) {
346
- throw takeFromExternrefTable0(ret[1]);
347
- }
348
- return takeFromExternrefTable0(ret[0]);
349
- }
350
- /**
351
- * Compile a query and return its plan without executing it.
352
- *
353
- * Mutating queries (CREATE / MERGE / SET / DELETE / REMOVE) leave
354
- * the graph untouched — this method never runs the executor.
355
- * @param {string} query
356
- * @param {any} params
357
- * @returns {any}
358
- */
359
- explain(query, params) {
360
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
361
- const len0 = WASM_VECTOR_LEN;
362
- const ret = wasm.wasmdatabase_explain(this.__wbg_ptr, ptr0, len0, params);
363
- if (ret[2]) {
364
- throw takeFromExternrefTable0(ret[1]);
365
- }
366
- return takeFromExternrefTable0(ret[0]);
367
- }
368
- /**
369
- * Execute a query and return the plan plus runtime metrics.
370
- *
371
- * **PROFILE executes the query for real.** Mutating queries are
372
- * persisted exactly as in `execute()`. Use `explain()` to inspect
373
- * a mutating plan without running it.
374
- * @param {string} query
375
- * @param {any} params
376
- * @returns {any}
377
- */
378
- profile(query, params) {
379
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
380
- const len0 = WASM_VECTOR_LEN;
381
- const ret = wasm.wasmdatabase_profile(this.__wbg_ptr, ptr0, len0, params);
382
- if (ret[2]) {
383
- throw takeFromExternrefTable0(ret[1]);
384
- }
385
- return takeFromExternrefTable0(ret[0]);
386
- }
387
- }
388
-
389
- const WasmQueryStreamFinalization = (typeof FinalizationRegistry === 'undefined')
390
- ? { register: () => {}, unregister: () => {} }
391
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmquerystream_free(ptr >>> 0, 1));
392
-
393
- export class WasmQueryStream {
394
-
395
- static __wrap(ptr) {
396
- ptr = ptr >>> 0;
397
- const obj = Object.create(WasmQueryStream.prototype);
398
- obj.__wbg_ptr = ptr;
399
- WasmQueryStreamFinalization.register(obj, obj.__wbg_ptr, obj);
400
- return obj;
401
- }
402
-
403
- __destroy_into_raw() {
404
- const ptr = this.__wbg_ptr;
405
- this.__wbg_ptr = 0;
406
- WasmQueryStreamFinalization.unregister(this);
407
- return ptr;
408
- }
409
-
410
- free() {
411
- const ptr = this.__destroy_into_raw();
412
- wasm.__wbg_wasmquerystream_free(ptr, 0);
413
- }
414
- /**
415
- * @returns {any}
416
- */
417
- next() {
418
- const ret = wasm.wasmquerystream_next(this.__wbg_ptr);
419
- if (ret[2]) {
420
- throw takeFromExternrefTable0(ret[1]);
421
- }
422
- return takeFromExternrefTable0(ret[0]);
423
- }
424
- close() {
425
- wasm.wasmquerystream_close(this.__wbg_ptr);
426
- }
427
- /**
428
- * @returns {any}
429
- */
430
- columns() {
431
- const ret = wasm.wasmquerystream_columns(this.__wbg_ptr);
432
- if (ret[2]) {
433
- throw takeFromExternrefTable0(ret[1]);
434
- }
435
- return takeFromExternrefTable0(ret[0]);
436
- }
437
- }
438
-
439
- async function __wbg_load(module, imports) {
440
- if (typeof Response === 'function' && module instanceof Response) {
441
- if (typeof WebAssembly.instantiateStreaming === 'function') {
442
- try {
443
- return await WebAssembly.instantiateStreaming(module, imports);
444
-
445
- } catch (e) {
446
- if (module.headers.get('Content-Type') != 'application/wasm') {
447
- 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);
448
-
449
- } else {
450
- throw e;
451
- }
452
- }
453
- }
454
-
455
- const bytes = await module.arrayBuffer();
456
- return await WebAssembly.instantiate(bytes, imports);
457
-
458
- } else {
459
- const instance = await WebAssembly.instantiate(module, imports);
460
-
461
- if (instance instanceof WebAssembly.Instance) {
462
- return { instance, module };
463
-
464
- } else {
465
- return instance;
466
- }
467
- }
468
- }
469
-
470
- function __wbg_get_imports() {
471
- const imports = {};
472
- imports.wbg = {};
473
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
474
- const ret = String(arg1);
475
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
- const len1 = WASM_VECTOR_LEN;
477
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
478
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
479
- };
480
- imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
481
- const ret = arg0.buffer;
482
- return ret;
483
- };
484
- imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
485
- const ret = arg0.call(arg1);
486
- return ret;
487
- }, arguments) };
488
- imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
489
- const ret = arg0.call(arg1, arg2);
490
- return ret;
491
- }, arguments) };
492
- imports.wbg.__wbg_crypto_86f2631e91b51511 = function(arg0) {
493
- const ret = arg0.crypto;
494
- return ret;
495
- };
496
- imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
497
- const ret = arg0.done;
498
- return ret;
499
- };
500
- imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
501
- const ret = Object.entries(arg0);
502
- return ret;
503
- };
504
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
505
- let deferred0_0;
506
- let deferred0_1;
507
- try {
508
- deferred0_0 = arg0;
509
- deferred0_1 = arg1;
510
- console.error(getStringFromWasm0(arg0, arg1));
511
- } finally {
512
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
513
- }
514
- };
515
- imports.wbg.__wbg_getRandomValues_b3f15fcbfabb0f8b = function() { return handleError(function (arg0, arg1) {
516
- arg0.getRandomValues(arg1);
517
- }, arguments) };
518
- imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
519
- const ret = Reflect.get(arg0, arg1);
520
- return ret;
521
- }, arguments) };
522
- imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
523
- const ret = arg0[arg1 >>> 0];
524
- return ret;
525
- };
526
- imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
527
- let result;
528
- try {
529
- result = arg0 instanceof ArrayBuffer;
530
- } catch (_) {
531
- result = false;
532
- }
533
- const ret = result;
534
- return ret;
535
- };
536
- imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
537
- let result;
538
- try {
539
- result = arg0 instanceof Map;
540
- } catch (_) {
541
- result = false;
542
- }
543
- const ret = result;
544
- return ret;
545
- };
546
- imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
547
- let result;
548
- try {
549
- result = arg0 instanceof Uint8Array;
550
- } catch (_) {
551
- result = false;
552
- }
553
- const ret = result;
554
- return ret;
555
- };
556
- imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
557
- const ret = Array.isArray(arg0);
558
- return ret;
559
- };
560
- imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
561
- const ret = Number.isSafeInteger(arg0);
562
- return ret;
563
- };
564
- imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
565
- const ret = Symbol.iterator;
566
- return ret;
567
- };
568
- imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
569
- const ret = arg0.length;
570
- return ret;
571
- };
572
- imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
573
- const ret = arg0.length;
574
- return ret;
575
- };
576
- imports.wbg.__wbg_msCrypto_d562bbe83e0d4b91 = function(arg0) {
577
- const ret = arg0.msCrypto;
578
- return ret;
579
- };
580
- imports.wbg.__wbg_new_405e22f390576ce2 = function() {
581
- const ret = new Object();
582
- return ret;
583
- };
584
- imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
585
- const ret = new Map();
586
- return ret;
587
- };
588
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
589
- const ret = new Array();
590
- return ret;
591
- };
592
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
593
- const ret = new Error();
594
- return ret;
595
- };
596
- imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
597
- const ret = new Uint8Array(arg0);
598
- return ret;
599
- };
600
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
601
- const ret = new Function(getStringFromWasm0(arg0, arg1));
602
- return ret;
603
- };
604
- imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
605
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
606
- return ret;
607
- };
608
- imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
609
- const ret = new Uint8Array(arg0 >>> 0);
610
- return ret;
611
- };
612
- imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
613
- const ret = arg0.next;
614
- return ret;
615
- };
616
- imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
617
- const ret = arg0.next();
618
- return ret;
619
- }, arguments) };
620
- imports.wbg.__wbg_node_e1f24f89a7336c2e = function(arg0) {
621
- const ret = arg0.node;
622
- return ret;
623
- };
624
- imports.wbg.__wbg_now_807e54c39636c349 = function() {
625
- const ret = Date.now();
626
- return ret;
627
- };
628
- imports.wbg.__wbg_process_3975fd6c72f520aa = function(arg0) {
629
- const ret = arg0.process;
630
- return ret;
631
- };
632
- imports.wbg.__wbg_randomFillSync_f8c153b79f285817 = function() { return handleError(function (arg0, arg1) {
633
- arg0.randomFillSync(arg1);
634
- }, arguments) };
635
- imports.wbg.__wbg_require_b74f47fc2d022fd6 = function() { return handleError(function () {
636
- const ret = module.require;
637
- return ret;
638
- }, arguments) };
639
- imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
640
- arg0[arg1 >>> 0] = arg2;
641
- };
642
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
643
- arg0[arg1] = arg2;
644
- };
645
- imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
646
- arg0.set(arg1, arg2 >>> 0);
647
- };
648
- imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
649
- const ret = arg0.set(arg1, arg2);
650
- return ret;
651
- };
652
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
653
- const ret = arg1.stack;
654
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
655
- const len1 = WASM_VECTOR_LEN;
656
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
657
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
658
- };
659
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
660
- const ret = typeof global === 'undefined' ? null : global;
661
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
662
- };
663
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
664
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
665
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
666
- };
667
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
668
- const ret = typeof self === 'undefined' ? null : self;
669
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
670
- };
671
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
672
- const ret = typeof window === 'undefined' ? null : window;
673
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
674
- };
675
- imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
676
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
677
- return ret;
678
- };
679
- imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
680
- const ret = arg0.value;
681
- return ret;
682
- };
683
- imports.wbg.__wbg_versions_4e31226f5e8dc909 = function(arg0) {
684
- const ret = arg0.versions;
685
- return ret;
686
- };
687
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
688
- const ret = arg0;
689
- return ret;
690
- };
691
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
692
- const ret = BigInt.asUintN(64, arg0);
693
- return ret;
694
- };
695
- imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
696
- const v = arg1;
697
- const ret = typeof(v) === 'bigint' ? v : undefined;
698
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
699
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
700
- };
701
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
702
- const v = arg0;
703
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
704
- return ret;
705
- };
706
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
707
- const ret = debugString(arg1);
708
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
709
- const len1 = WASM_VECTOR_LEN;
710
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
711
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
712
- };
713
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
714
- const ret = new Error(getStringFromWasm0(arg0, arg1));
715
- return ret;
716
- };
717
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
718
- const ret = arg0 in arg1;
719
- return ret;
720
- };
721
- imports.wbg.__wbindgen_init_externref_table = function() {
722
- const table = wasm.__wbindgen_export_4;
723
- const offset = table.grow(4);
724
- table.set(0, undefined);
725
- table.set(offset + 0, undefined);
726
- table.set(offset + 1, null);
727
- table.set(offset + 2, true);
728
- table.set(offset + 3, false);
729
- ;
730
- };
731
- imports.wbg.__wbindgen_is_bigint = function(arg0) {
732
- const ret = typeof(arg0) === 'bigint';
733
- return ret;
734
- };
735
- imports.wbg.__wbindgen_is_function = function(arg0) {
736
- const ret = typeof(arg0) === 'function';
737
- return ret;
738
- };
739
- imports.wbg.__wbindgen_is_null = function(arg0) {
740
- const ret = arg0 === null;
741
- return ret;
742
- };
743
- imports.wbg.__wbindgen_is_object = function(arg0) {
744
- const val = arg0;
745
- const ret = typeof(val) === 'object' && val !== null;
746
- return ret;
747
- };
748
- imports.wbg.__wbindgen_is_string = function(arg0) {
749
- const ret = typeof(arg0) === 'string';
750
- return ret;
751
- };
752
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
753
- const ret = arg0 === undefined;
754
- return ret;
755
- };
756
- imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
757
- const ret = arg0 === arg1;
758
- return ret;
759
- };
760
- imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
761
- const ret = arg0 == arg1;
762
- return ret;
763
- };
764
- imports.wbg.__wbindgen_memory = function() {
765
- const ret = wasm.memory;
766
- return ret;
767
- };
768
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
769
- const obj = arg1;
770
- const ret = typeof(obj) === 'number' ? obj : undefined;
771
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
772
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
773
- };
774
- imports.wbg.__wbindgen_number_new = function(arg0) {
775
- const ret = arg0;
776
- return ret;
777
- };
778
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
779
- const obj = arg1;
780
- const ret = typeof(obj) === 'string' ? obj : undefined;
781
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
782
- var len1 = WASM_VECTOR_LEN;
783
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
784
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
785
- };
786
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
787
- const ret = getStringFromWasm0(arg0, arg1);
788
- return ret;
789
- };
790
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
791
- throw new Error(getStringFromWasm0(arg0, arg1));
792
- };
793
-
794
- return imports;
795
- }
796
-
797
- function __wbg_init_memory(imports, memory) {
798
-
799
- }
800
-
801
- function __wbg_finalize_init(instance, module) {
802
- wasm = instance.exports;
803
- __wbg_init.__wbindgen_wasm_module = module;
804
- cachedDataViewMemory0 = null;
805
- cachedUint8ArrayMemory0 = null;
806
-
807
-
808
- wasm.__wbindgen_start();
809
- return wasm;
810
- }
811
-
812
- function initSync(module) {
813
- if (wasm !== undefined) return wasm;
814
-
815
-
816
- if (typeof module !== 'undefined') {
817
- if (Object.getPrototypeOf(module) === Object.prototype) {
818
- ({module} = module)
819
- } else {
820
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
821
- }
822
- }
823
-
824
- const imports = __wbg_get_imports();
825
-
826
- __wbg_init_memory(imports);
827
-
828
- if (!(module instanceof WebAssembly.Module)) {
829
- module = new WebAssembly.Module(module);
830
- }
831
-
832
- const instance = new WebAssembly.Instance(module, imports);
833
-
834
- return __wbg_finalize_init(instance, module);
835
- }
836
-
837
- async function __wbg_init(module_or_path) {
838
- if (wasm !== undefined) return wasm;
839
-
840
-
841
- if (typeof module_or_path !== 'undefined') {
842
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
843
- ({module_or_path} = module_or_path)
844
- } else {
845
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
846
- }
847
- }
848
-
849
- if (typeof module_or_path === 'undefined') {
850
- module_or_path = new URL('lora_wasm_bg.wasm', import.meta.url);
851
- }
852
- const imports = __wbg_get_imports();
853
-
854
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
855
- module_or_path = fetch(module_or_path);
856
- }
857
-
858
- __wbg_init_memory(imports);
859
-
860
- const { instance, module } = await __wbg_load(await module_or_path, imports);
861
-
862
- return __wbg_finalize_init(instance, module);
863
- }
864
-
865
- export { initSync };
866
- export default __wbg_init;