@trust0/ridb-core 0.12.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.
@@ -0,0 +1,3130 @@
1
+ let wasm;
2
+
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let heap_next = heap.length;
10
+
11
+ function dropObject(idx) {
12
+ if (idx < 132) return;
13
+ heap[idx] = heap_next;
14
+ heap_next = idx;
15
+ }
16
+
17
+ function takeObject(idx) {
18
+ const ret = getObject(idx);
19
+ dropObject(idx);
20
+ return ret;
21
+ }
22
+
23
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
24
+
25
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
26
+
27
+ let cachedUint8Memory0 = null;
28
+
29
+ function getUint8Memory0() {
30
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
31
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
32
+ }
33
+ return cachedUint8Memory0;
34
+ }
35
+
36
+ function getStringFromWasm0(ptr, len) {
37
+ ptr = ptr >>> 0;
38
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
39
+ }
40
+
41
+ function addHeapObject(obj) {
42
+ if (heap_next === heap.length) heap.push(heap.length + 1);
43
+ const idx = heap_next;
44
+ heap_next = heap[idx];
45
+
46
+ heap[idx] = obj;
47
+ return idx;
48
+ }
49
+
50
+ let WASM_VECTOR_LEN = 0;
51
+
52
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
53
+
54
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
55
+ ? function (arg, view) {
56
+ return cachedTextEncoder.encodeInto(arg, view);
57
+ }
58
+ : function (arg, view) {
59
+ const buf = cachedTextEncoder.encode(arg);
60
+ view.set(buf);
61
+ return {
62
+ read: arg.length,
63
+ written: buf.length
64
+ };
65
+ });
66
+
67
+ function passStringToWasm0(arg, malloc, realloc) {
68
+
69
+ if (realloc === undefined) {
70
+ const buf = cachedTextEncoder.encode(arg);
71
+ const ptr = malloc(buf.length, 1) >>> 0;
72
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
73
+ WASM_VECTOR_LEN = buf.length;
74
+ return ptr;
75
+ }
76
+
77
+ let len = arg.length;
78
+ let ptr = malloc(len, 1) >>> 0;
79
+
80
+ const mem = getUint8Memory0();
81
+
82
+ let offset = 0;
83
+
84
+ for (; offset < len; offset++) {
85
+ const code = arg.charCodeAt(offset);
86
+ if (code > 0x7F) break;
87
+ mem[ptr + offset] = code;
88
+ }
89
+
90
+ if (offset !== len) {
91
+ if (offset !== 0) {
92
+ arg = arg.slice(offset);
93
+ }
94
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
95
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
96
+ const ret = encodeString(arg, view);
97
+
98
+ offset += ret.written;
99
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
100
+ }
101
+
102
+ WASM_VECTOR_LEN = offset;
103
+ return ptr;
104
+ }
105
+
106
+ function isLikeNone(x) {
107
+ return x === undefined || x === null;
108
+ }
109
+
110
+ let cachedInt32Memory0 = null;
111
+
112
+ function getInt32Memory0() {
113
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
114
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
115
+ }
116
+ return cachedInt32Memory0;
117
+ }
118
+
119
+ let cachedFloat64Memory0 = null;
120
+
121
+ function getFloat64Memory0() {
122
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
123
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
124
+ }
125
+ return cachedFloat64Memory0;
126
+ }
127
+
128
+ let cachedBigInt64Memory0 = null;
129
+
130
+ function getBigInt64Memory0() {
131
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
132
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
133
+ }
134
+ return cachedBigInt64Memory0;
135
+ }
136
+
137
+ function debugString(val) {
138
+ // primitive types
139
+ const type = typeof val;
140
+ if (type == 'number' || type == 'boolean' || val == null) {
141
+ return `${val}`;
142
+ }
143
+ if (type == 'string') {
144
+ return `"${val}"`;
145
+ }
146
+ if (type == 'symbol') {
147
+ const description = val.description;
148
+ if (description == null) {
149
+ return 'Symbol';
150
+ } else {
151
+ return `Symbol(${description})`;
152
+ }
153
+ }
154
+ if (type == 'function') {
155
+ const name = val.name;
156
+ if (typeof name == 'string' && name.length > 0) {
157
+ return `Function(${name})`;
158
+ } else {
159
+ return 'Function';
160
+ }
161
+ }
162
+ // objects
163
+ if (Array.isArray(val)) {
164
+ const length = val.length;
165
+ let debug = '[';
166
+ if (length > 0) {
167
+ debug += debugString(val[0]);
168
+ }
169
+ for(let i = 1; i < length; i++) {
170
+ debug += ', ' + debugString(val[i]);
171
+ }
172
+ debug += ']';
173
+ return debug;
174
+ }
175
+ // Test for built-in
176
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
177
+ let className;
178
+ if (builtInMatches.length > 1) {
179
+ className = builtInMatches[1];
180
+ } else {
181
+ // Failed to match the standard '[object ClassName]'
182
+ return toString.call(val);
183
+ }
184
+ if (className == 'Object') {
185
+ // we're a user defined class or Object
186
+ // JSON.stringify avoids problems with cycles, and is generally much
187
+ // easier than looping through ownProperties of `val`.
188
+ try {
189
+ return 'Object(' + JSON.stringify(val) + ')';
190
+ } catch (_) {
191
+ return 'Object';
192
+ }
193
+ }
194
+ // errors
195
+ if (val instanceof Error) {
196
+ return `${val.name}: ${val.message}\n${val.stack}`;
197
+ }
198
+ // TODO we could test for more things here, like `Set`s and `Map`s.
199
+ return className;
200
+ }
201
+
202
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
203
+ ? { register: () => {}, unregister: () => {} }
204
+ : new FinalizationRegistry(state => {
205
+ wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
206
+ });
207
+
208
+ function makeMutClosure(arg0, arg1, dtor, f) {
209
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
210
+ const real = (...args) => {
211
+ // First up with a closure we increment the internal reference
212
+ // count. This ensures that the Rust closure environment won't
213
+ // be deallocated while we're invoking it.
214
+ state.cnt++;
215
+ const a = state.a;
216
+ state.a = 0;
217
+ try {
218
+ return f(a, state.b, ...args);
219
+ } finally {
220
+ if (--state.cnt === 0) {
221
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
222
+ CLOSURE_DTORS.unregister(state);
223
+ } else {
224
+ state.a = a;
225
+ }
226
+ }
227
+ };
228
+ real.original = state;
229
+ CLOSURE_DTORS.register(real, state, state);
230
+ return real;
231
+ }
232
+ function __wbg_adapter_56(arg0, arg1, arg2) {
233
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h231d9c59fed64ed4(arg0, arg1, addHeapObject(arg2));
234
+ }
235
+
236
+ function makeClosure(arg0, arg1, dtor, f) {
237
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
238
+ const real = (...args) => {
239
+ // First up with a closure we increment the internal reference
240
+ // count. This ensures that the Rust closure environment won't
241
+ // be deallocated while we're invoking it.
242
+ state.cnt++;
243
+ try {
244
+ return f(state.a, state.b, ...args);
245
+ } finally {
246
+ if (--state.cnt === 0) {
247
+ wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
248
+ state.a = 0;
249
+ CLOSURE_DTORS.unregister(state);
250
+ }
251
+ }
252
+ };
253
+ real.original = state;
254
+ CLOSURE_DTORS.register(real, state, state);
255
+ return real;
256
+ }
257
+ function __wbg_adapter_59(arg0, arg1, arg2, arg3, arg4) {
258
+ try {
259
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
260
+ wasm._dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h33ba438d7169a89a(retptr, arg0, arg1, addHeapObject(arg2), addHeapObject(arg3), addHeapObject(arg4));
261
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
262
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
263
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
264
+ if (r2) {
265
+ throw takeObject(r1);
266
+ }
267
+ return takeObject(r0);
268
+ } finally {
269
+ wasm.__wbindgen_add_to_stack_pointer(16);
270
+ }
271
+ }
272
+
273
+ function __wbg_adapter_62(arg0, arg1, arg2) {
274
+ const ret = wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8d2923cd4e648893(arg0, arg1, addHeapObject(arg2));
275
+ return takeObject(ret);
276
+ }
277
+
278
+ function __wbg_adapter_65(arg0, arg1, arg2) {
279
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf066437ba5ed1b74(arg0, arg1, addHeapObject(arg2));
280
+ }
281
+
282
+ function _assertClass(instance, klass) {
283
+ if (!(instance instanceof klass)) {
284
+ throw new Error(`expected instance of ${klass.name}`);
285
+ }
286
+ return instance.ptr;
287
+ }
288
+
289
+ let cachedUint32Memory0 = null;
290
+
291
+ function getUint32Memory0() {
292
+ if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
293
+ cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
294
+ }
295
+ return cachedUint32Memory0;
296
+ }
297
+
298
+ function getArrayJsValueFromWasm0(ptr, len) {
299
+ ptr = ptr >>> 0;
300
+ const mem = getUint32Memory0();
301
+ const slice = mem.subarray(ptr / 4, ptr / 4 + len);
302
+ const result = [];
303
+ for (let i = 0; i < slice.length; i++) {
304
+ result.push(takeObject(slice[i]));
305
+ }
306
+ return result;
307
+ }
308
+
309
+ let stack_pointer = 128;
310
+
311
+ function addBorrowedObject(obj) {
312
+ if (stack_pointer == 1) throw new Error('out of js stack');
313
+ heap[--stack_pointer] = obj;
314
+ return stack_pointer;
315
+ }
316
+ /**
317
+ */
318
+ export function main_js() {
319
+ wasm.main_js();
320
+ }
321
+
322
+ /**
323
+ * @returns {boolean}
324
+ */
325
+ export function is_debug_mode() {
326
+ const ret = wasm.is_debug_mode();
327
+ return ret !== 0;
328
+ }
329
+
330
+ function passArrayJsValueToWasm0(array, malloc) {
331
+ const ptr = malloc(array.length * 4, 4) >>> 0;
332
+ const mem = getUint32Memory0();
333
+ for (let i = 0; i < array.length; i++) {
334
+ mem[ptr / 4 + i] = addHeapObject(array[i]);
335
+ }
336
+ WASM_VECTOR_LEN = array.length;
337
+ return ptr;
338
+ }
339
+
340
+ function handleError(f, args) {
341
+ try {
342
+ return f.apply(this, args);
343
+ } catch (e) {
344
+ wasm.__wbindgen_exn_store(addHeapObject(e));
345
+ }
346
+ }
347
+ /**
348
+ * Handler for `console.log` invocations.
349
+ *
350
+ * If a test is currently running it takes the `args` array and stringifies
351
+ * it and appends it to the current output of the test. Otherwise it passes
352
+ * the arguments to the original `console.log` function, psased as
353
+ * `original`.
354
+ * @param {Array<any>} args
355
+ */
356
+ export function __wbgtest_console_log(args) {
357
+ try {
358
+ wasm.__wbgtest_console_log(addBorrowedObject(args));
359
+ } finally {
360
+ heap[stack_pointer++] = undefined;
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Handler for `console.debug` invocations. See above.
366
+ * @param {Array<any>} args
367
+ */
368
+ export function __wbgtest_console_debug(args) {
369
+ try {
370
+ wasm.__wbgtest_console_debug(addBorrowedObject(args));
371
+ } finally {
372
+ heap[stack_pointer++] = undefined;
373
+ }
374
+ }
375
+
376
+ /**
377
+ * Handler for `console.info` invocations. See above.
378
+ * @param {Array<any>} args
379
+ */
380
+ export function __wbgtest_console_info(args) {
381
+ try {
382
+ wasm.__wbgtest_console_info(addBorrowedObject(args));
383
+ } finally {
384
+ heap[stack_pointer++] = undefined;
385
+ }
386
+ }
387
+
388
+ /**
389
+ * Handler for `console.warn` invocations. See above.
390
+ * @param {Array<any>} args
391
+ */
392
+ export function __wbgtest_console_warn(args) {
393
+ try {
394
+ wasm.__wbgtest_console_warn(addBorrowedObject(args));
395
+ } finally {
396
+ heap[stack_pointer++] = undefined;
397
+ }
398
+ }
399
+
400
+ /**
401
+ * Handler for `console.error` invocations. See above.
402
+ * @param {Array<any>} args
403
+ */
404
+ export function __wbgtest_console_error(args) {
405
+ try {
406
+ wasm.__wbgtest_console_error(addBorrowedObject(args));
407
+ } finally {
408
+ heap[stack_pointer++] = undefined;
409
+ }
410
+ }
411
+
412
+ function __wbg_adapter_296(arg0, arg1) {
413
+ wasm.wasm_bindgen__convert__closures__invoke0_mut__hf4bced6426ca6f31(arg0, arg1);
414
+ }
415
+
416
+ function __wbg_adapter_339(arg0, arg1, arg2, arg3, arg4) {
417
+ wasm.wasm_bindgen__convert__closures__invoke3_mut__h425269a7185d1f5b(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
418
+ }
419
+
420
+ function __wbg_adapter_390(arg0, arg1, arg2, arg3) {
421
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h1b9fff078715ef14(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
422
+ }
423
+
424
+ /**
425
+ */
426
+ export const Errors = Object.freeze({ Error:0,"0":"Error",HookError:1,"1":"HookError",QueryError:2,"2":"QueryError",SerializationError:3,"3":"SerializationError",ValidationError:4,"4":"ValidationError",AuthenticationError:5,"5":"AuthenticationError", });
427
+ /**
428
+ * Represents the type of operation to be performed on the collection.
429
+ */
430
+ export const OpType = Object.freeze({
431
+ /**
432
+ * Create operation.
433
+ */
434
+ CREATE:0,"0":"CREATE",
435
+ /**
436
+ * Update operation.
437
+ */
438
+ UPDATE:1,"1":"UPDATE",
439
+ /**
440
+ * Delete operation.
441
+ */
442
+ DELETE:2,"2":"DELETE",
443
+ /**
444
+ * Query Operation.
445
+ */
446
+ QUERY:3,"3":"QUERY",
447
+ /**
448
+ * Count Operation.
449
+ */
450
+ COUNT:4,"4":"COUNT", });
451
+
452
+ const BasePluginFinalization = (typeof FinalizationRegistry === 'undefined')
453
+ ? { register: () => {}, unregister: () => {} }
454
+ : new FinalizationRegistry(ptr => wasm.__wbg_baseplugin_free(ptr >>> 0));
455
+ /**
456
+ */
457
+ export class BasePlugin {
458
+
459
+ __destroy_into_raw() {
460
+ const ptr = this.__wbg_ptr;
461
+ this.__wbg_ptr = 0;
462
+ BasePluginFinalization.unregister(this);
463
+ return ptr;
464
+ }
465
+
466
+ free() {
467
+ const ptr = this.__destroy_into_raw();
468
+ wasm.__wbg_baseplugin_free(ptr);
469
+ }
470
+ /**
471
+ * @param {string} name
472
+ */
473
+ constructor(name) {
474
+ try {
475
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
476
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
477
+ const len0 = WASM_VECTOR_LEN;
478
+ wasm.baseplugin_new(retptr, ptr0, len0);
479
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
480
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
481
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
482
+ if (r2) {
483
+ throw takeObject(r1);
484
+ }
485
+ this.__wbg_ptr = r0 >>> 0;
486
+ return this;
487
+ } finally {
488
+ wasm.__wbindgen_add_to_stack_pointer(16);
489
+ }
490
+ }
491
+ /**
492
+ * @returns {any}
493
+ */
494
+ get name() {
495
+ const ret = wasm.baseplugin_name(this.__wbg_ptr);
496
+ return takeObject(ret);
497
+ }
498
+ /**
499
+ * @returns {any}
500
+ */
501
+ get docCreateHook() {
502
+ const ret = wasm.baseplugin_get_doc_create_hook(this.__wbg_ptr);
503
+ return takeObject(ret);
504
+ }
505
+ /**
506
+ * @returns {any}
507
+ */
508
+ get docRecoverHook() {
509
+ const ret = wasm.baseplugin_get_doc_recover_hook(this.__wbg_ptr);
510
+ return takeObject(ret);
511
+ }
512
+ /**
513
+ * @param {any} hook
514
+ */
515
+ set docCreateHook(hook) {
516
+ wasm.baseplugin_set_doc_create_hook(this.__wbg_ptr, addHeapObject(hook));
517
+ }
518
+ /**
519
+ * @param {any} hook
520
+ */
521
+ set docRecoverHook(hook) {
522
+ wasm.baseplugin_set_doc_recover_hook(this.__wbg_ptr, addHeapObject(hook));
523
+ }
524
+ }
525
+
526
+ const BaseStorageFinalization = (typeof FinalizationRegistry === 'undefined')
527
+ ? { register: () => {}, unregister: () => {} }
528
+ : new FinalizationRegistry(ptr => wasm.__wbg_basestorage_free(ptr >>> 0));
529
+ /**
530
+ * Represents the base storage with a name and schema.
531
+ */
532
+ export class BaseStorage {
533
+
534
+ __destroy_into_raw() {
535
+ const ptr = this.__wbg_ptr;
536
+ this.__wbg_ptr = 0;
537
+ BaseStorageFinalization.unregister(this);
538
+ return ptr;
539
+ }
540
+
541
+ free() {
542
+ const ptr = this.__destroy_into_raw();
543
+ wasm.__wbg_basestorage_free(ptr);
544
+ }
545
+ /**
546
+ * Creates a new `BaseStorage` instance with the provided name and schema type.
547
+ *
548
+ * # Arguments
549
+ *
550
+ * * `name` - The name of the storage.
551
+ * * `schema_type` - The schema type in `JsValue` format.
552
+ *
553
+ * # Returns
554
+ *
555
+ * * `Result<BaseStorage, JsValue>` - A result containing the new `BaseStorage` instance or an error.
556
+ * @param {string} name
557
+ * @param {object} schemas_js
558
+ * @param {object | undefined} [options]
559
+ */
560
+ constructor(name, schemas_js, options) {
561
+ try {
562
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
563
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
564
+ const len0 = WASM_VECTOR_LEN;
565
+ wasm.basestorage_new(retptr, ptr0, len0, addHeapObject(schemas_js), isLikeNone(options) ? 0 : addHeapObject(options));
566
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
567
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
568
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
569
+ if (r2) {
570
+ throw takeObject(r1);
571
+ }
572
+ this.__wbg_ptr = r0 >>> 0;
573
+ return this;
574
+ } finally {
575
+ wasm.__wbindgen_add_to_stack_pointer(16);
576
+ }
577
+ }
578
+ /**
579
+ * @returns {any}
580
+ */
581
+ addIndexSchemas() {
582
+ try {
583
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
584
+ wasm.basestorage_addIndexSchemas(retptr, this.__wbg_ptr);
585
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
586
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
587
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
588
+ if (r2) {
589
+ throw takeObject(r1);
590
+ }
591
+ return takeObject(r0);
592
+ } finally {
593
+ wasm.__wbindgen_add_to_stack_pointer(16);
594
+ }
595
+ }
596
+ /**
597
+ * @param {string} name
598
+ * @returns {any}
599
+ */
600
+ getOption(name) {
601
+ try {
602
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
603
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
604
+ const len0 = WASM_VECTOR_LEN;
605
+ wasm.basestorage_getOption(retptr, this.__wbg_ptr, ptr0, len0);
606
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
607
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
608
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
609
+ if (r2) {
610
+ throw takeObject(r1);
611
+ }
612
+ return takeObject(r0);
613
+ } finally {
614
+ wasm.__wbindgen_add_to_stack_pointer(16);
615
+ }
616
+ }
617
+ /**
618
+ * @param {string} name
619
+ * @returns {Schema}
620
+ */
621
+ getSchema(name) {
622
+ try {
623
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
624
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
625
+ const len0 = WASM_VECTOR_LEN;
626
+ wasm.basestorage_getSchema(retptr, this.__wbg_ptr, ptr0, len0);
627
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
628
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
629
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
630
+ if (r2) {
631
+ throw takeObject(r1);
632
+ }
633
+ return Schema.__wrap(r0);
634
+ } finally {
635
+ wasm.__wbindgen_add_to_stack_pointer(16);
636
+ }
637
+ }
638
+ /**
639
+ * @returns {CoreStorage}
640
+ */
641
+ get core() {
642
+ try {
643
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
644
+ wasm.basestorage_core(retptr, this.__wbg_ptr);
645
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
646
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
647
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
648
+ if (r2) {
649
+ throw takeObject(r1);
650
+ }
651
+ return CoreStorage.__wrap(r0);
652
+ } finally {
653
+ wasm.__wbindgen_add_to_stack_pointer(16);
654
+ }
655
+ }
656
+ }
657
+
658
+ const CollectionFinalization = (typeof FinalizationRegistry === 'undefined')
659
+ ? { register: () => {}, unregister: () => {} }
660
+ : new FinalizationRegistry(ptr => wasm.__wbg_collection_free(ptr >>> 0));
661
+ /**
662
+ */
663
+ export class Collection {
664
+
665
+ static __wrap(ptr) {
666
+ ptr = ptr >>> 0;
667
+ const obj = Object.create(Collection.prototype);
668
+ obj.__wbg_ptr = ptr;
669
+ CollectionFinalization.register(obj, obj.__wbg_ptr, obj);
670
+ return obj;
671
+ }
672
+
673
+ __destroy_into_raw() {
674
+ const ptr = this.__wbg_ptr;
675
+ this.__wbg_ptr = 0;
676
+ CollectionFinalization.unregister(this);
677
+ return ptr;
678
+ }
679
+
680
+ free() {
681
+ const ptr = this.__destroy_into_raw();
682
+ wasm.__wbg_collection_free(ptr);
683
+ }
684
+ /**
685
+ * @returns {string}
686
+ */
687
+ get name() {
688
+ let deferred1_0;
689
+ let deferred1_1;
690
+ try {
691
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
692
+ wasm.collection_name(retptr, this.__wbg_ptr);
693
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
694
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
695
+ deferred1_0 = r0;
696
+ deferred1_1 = r1;
697
+ return getStringFromWasm0(r0, r1);
698
+ } finally {
699
+ wasm.__wbindgen_add_to_stack_pointer(16);
700
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
701
+ }
702
+ }
703
+ /**
704
+ * @returns {Schema}
705
+ */
706
+ get schema() {
707
+ try {
708
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
709
+ wasm.collection_schema(retptr, this.__wbg_ptr);
710
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
711
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
712
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
713
+ if (r2) {
714
+ throw takeObject(r1);
715
+ }
716
+ return Schema.__wrap(r0);
717
+ } finally {
718
+ wasm.__wbindgen_add_to_stack_pointer(16);
719
+ }
720
+ }
721
+ /**
722
+ * Finds and returns all documents in the collection.
723
+ *
724
+ * This function is asynchronous and returns a `JsValue` representing
725
+ * the documents found in the collection.
726
+ * @param {any} query_js
727
+ * @param {any} options_js
728
+ * @returns {Promise<any>}
729
+ */
730
+ find(query_js, options_js) {
731
+ const ret = wasm.collection_find(this.__wbg_ptr, addHeapObject(query_js), addHeapObject(options_js));
732
+ return takeObject(ret);
733
+ }
734
+ /**
735
+ * @param {any} options
736
+ * @returns {QueryOptions}
737
+ */
738
+ parse_query_options(options) {
739
+ try {
740
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
741
+ wasm.collection_parse_query_options(retptr, this.__wbg_ptr, addHeapObject(options));
742
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
743
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
744
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
745
+ if (r2) {
746
+ throw takeObject(r1);
747
+ }
748
+ return QueryOptions.__wrap(r0);
749
+ } finally {
750
+ wasm.__wbindgen_add_to_stack_pointer(16);
751
+ }
752
+ }
753
+ /**
754
+ * counts and returns all documents in the collection.
755
+ *
756
+ * This function is asynchronous and returns a `Schema` representing
757
+ * the documents found in the collection.
758
+ * @param {any} query_js
759
+ * @param {any} options_js
760
+ * @returns {Promise<any>}
761
+ */
762
+ count(query_js, options_js) {
763
+ const ret = wasm.collection_count(this.__wbg_ptr, addHeapObject(query_js), addHeapObject(options_js));
764
+ return takeObject(ret);
765
+ }
766
+ /**
767
+ * Finds and returns a single document in the collection by its ID.
768
+ *
769
+ * This function is asynchronous.
770
+ * @param {any} primary_key
771
+ * @returns {Promise<any>}
772
+ */
773
+ findById(primary_key) {
774
+ const ret = wasm.collection_findById(this.__wbg_ptr, addHeapObject(primary_key));
775
+ return takeObject(ret);
776
+ }
777
+ /**
778
+ * Updates a document in the collection with the given data.
779
+ *
780
+ * This function is asynchronous and returns a `Result` indicating success or failure.
781
+ *
782
+ * # Arguments
783
+ *
784
+ * * `document` - A `JsValue` representing the partial document to update.
785
+ * @param {any} document
786
+ * @returns {Promise<any>}
787
+ */
788
+ update(document) {
789
+ const ret = wasm.collection_update(this.__wbg_ptr, addHeapObject(document));
790
+ return takeObject(ret);
791
+ }
792
+ /**
793
+ * Creates a new document in the collection.
794
+ *
795
+ * This function is asynchronous and returns a `Result` indicating success or failure.
796
+ *
797
+ * # Arguments
798
+ *
799
+ * * `document` - A `JsValue` representing the document to create.
800
+ * @param {any} document
801
+ * @returns {Promise<any>}
802
+ */
803
+ create(document) {
804
+ const ret = wasm.collection_create(this.__wbg_ptr, addHeapObject(document));
805
+ return takeObject(ret);
806
+ }
807
+ /**
808
+ * Deletes a document from the collection by its ID.
809
+ *
810
+ * This function is asynchronous.
811
+ * @param {any} primary_key
812
+ * @returns {Promise<any>}
813
+ */
814
+ delete(primary_key) {
815
+ const ret = wasm.collection_delete(this.__wbg_ptr, addHeapObject(primary_key));
816
+ return takeObject(ret);
817
+ }
818
+ }
819
+
820
+ const CoreStorageFinalization = (typeof FinalizationRegistry === 'undefined')
821
+ ? { register: () => {}, unregister: () => {} }
822
+ : new FinalizationRegistry(ptr => wasm.__wbg_corestorage_free(ptr >>> 0));
823
+ /**
824
+ */
825
+ export class CoreStorage {
826
+
827
+ static __wrap(ptr) {
828
+ ptr = ptr >>> 0;
829
+ const obj = Object.create(CoreStorage.prototype);
830
+ obj.__wbg_ptr = ptr;
831
+ CoreStorageFinalization.register(obj, obj.__wbg_ptr, obj);
832
+ return obj;
833
+ }
834
+
835
+ __destroy_into_raw() {
836
+ const ptr = this.__wbg_ptr;
837
+ this.__wbg_ptr = 0;
838
+ CoreStorageFinalization.unregister(this);
839
+ return ptr;
840
+ }
841
+
842
+ free() {
843
+ const ptr = this.__destroy_into_raw();
844
+ wasm.__wbg_corestorage_free(ptr);
845
+ }
846
+ /**
847
+ */
848
+ constructor() {
849
+ const ret = wasm.corestorage_new();
850
+ this.__wbg_ptr = ret >>> 0;
851
+ return this;
852
+ }
853
+ /**
854
+ * @param {any} value
855
+ * @returns {string}
856
+ */
857
+ getPrimaryKeyTyped(value) {
858
+ let deferred2_0;
859
+ let deferred2_1;
860
+ try {
861
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
862
+ wasm.corestorage_getPrimaryKeyTyped(retptr, this.__wbg_ptr, addHeapObject(value));
863
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
864
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
865
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
866
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
867
+ var ptr1 = r0;
868
+ var len1 = r1;
869
+ if (r3) {
870
+ ptr1 = 0; len1 = 0;
871
+ throw takeObject(r2);
872
+ }
873
+ deferred2_0 = ptr1;
874
+ deferred2_1 = len1;
875
+ return getStringFromWasm0(ptr1, len1);
876
+ } finally {
877
+ wasm.__wbindgen_add_to_stack_pointer(16);
878
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
879
+ }
880
+ }
881
+ /**
882
+ * @param {Schema} schema
883
+ * @param {Operation} op
884
+ * @returns {(string)[]}
885
+ */
886
+ getIndexes(schema, op) {
887
+ try {
888
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
889
+ _assertClass(schema, Schema);
890
+ _assertClass(op, Operation);
891
+ wasm.corestorage_getIndexes(retptr, this.__wbg_ptr, schema.__wbg_ptr, op.__wbg_ptr);
892
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
893
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
894
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
895
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
896
+ if (r3) {
897
+ throw takeObject(r2);
898
+ }
899
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
900
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
901
+ return v1;
902
+ } finally {
903
+ wasm.__wbindgen_add_to_stack_pointer(16);
904
+ }
905
+ }
906
+ /**
907
+ * @param {any} document
908
+ * @param {Query} query
909
+ * @returns {boolean}
910
+ */
911
+ matchesQuery(document, query) {
912
+ try {
913
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
914
+ _assertClass(query, Query);
915
+ wasm.corestorage_matchesQuery(retptr, this.__wbg_ptr, addBorrowedObject(document), query.__wbg_ptr);
916
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
917
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
918
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
919
+ if (r2) {
920
+ throw takeObject(r1);
921
+ }
922
+ return r0 !== 0;
923
+ } finally {
924
+ wasm.__wbindgen_add_to_stack_pointer(16);
925
+ heap[stack_pointer++] = undefined;
926
+ }
927
+ }
928
+ }
929
+
930
+ const DatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
931
+ ? { register: () => {}, unregister: () => {} }
932
+ : new FinalizationRegistry(ptr => wasm.__wbg_database_free(ptr >>> 0));
933
+ /**
934
+ * Represents a database with collections of documents.
935
+ */
936
+ export class Database {
937
+
938
+ static __wrap(ptr) {
939
+ ptr = ptr >>> 0;
940
+ const obj = Object.create(Database.prototype);
941
+ obj.__wbg_ptr = ptr;
942
+ DatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
943
+ return obj;
944
+ }
945
+
946
+ __destroy_into_raw() {
947
+ const ptr = this.__wbg_ptr;
948
+ this.__wbg_ptr = 0;
949
+ DatabaseFinalization.unregister(this);
950
+ return ptr;
951
+ }
952
+
953
+ free() {
954
+ const ptr = this.__destroy_into_raw();
955
+ wasm.__wbg_database_free(ptr);
956
+ }
957
+ /**
958
+ * @returns {Promise<any>}
959
+ */
960
+ start() {
961
+ const ret = wasm.database_start(this.__wbg_ptr);
962
+ return takeObject(ret);
963
+ }
964
+ /**
965
+ * @returns {Promise<any>}
966
+ */
967
+ close() {
968
+ const ptr = this.__destroy_into_raw();
969
+ const ret = wasm.database_close(ptr);
970
+ return takeObject(ret);
971
+ }
972
+ /**
973
+ * @returns {boolean}
974
+ */
975
+ get started() {
976
+ const ret = wasm.database_started(this.__wbg_ptr);
977
+ return ret !== 0;
978
+ }
979
+ /**
980
+ * @param {string} password
981
+ * @returns {Promise<boolean>}
982
+ */
983
+ authenticate(password) {
984
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
985
+ const len0 = WASM_VECTOR_LEN;
986
+ const ret = wasm.database_authenticate(this.__wbg_ptr, ptr0, len0);
987
+ return takeObject(ret);
988
+ }
989
+ /**
990
+ * Retrieves the collections in the database.
991
+ *
992
+ * This function returns an `Object` containing the collections.
993
+ *
994
+ * # Returns
995
+ *
996
+ * * `Result<Object, JsValue>` - A result containing an `Object` with the collections or an error.
997
+ * @returns {object}
998
+ */
999
+ get collections() {
1000
+ try {
1001
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1002
+ wasm.database_collections(retptr, this.__wbg_ptr);
1003
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1004
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1005
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1006
+ if (r2) {
1007
+ throw takeObject(r1);
1008
+ }
1009
+ return takeObject(r0);
1010
+ } finally {
1011
+ wasm.__wbindgen_add_to_stack_pointer(16);
1012
+ }
1013
+ }
1014
+ /**
1015
+ * @param {string} db_name
1016
+ * @param {object} schemas_js
1017
+ * @param {object} migrations_js
1018
+ * @param {Array<any>} plugins
1019
+ * @param {any} module
1020
+ * @param {string | undefined} [password]
1021
+ * @param {any | undefined} [storage]
1022
+ * @returns {Promise<Database>}
1023
+ */
1024
+ static create(db_name, schemas_js, migrations_js, plugins, module, password, storage) {
1025
+ const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1026
+ const len0 = WASM_VECTOR_LEN;
1027
+ var ptr1 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1028
+ var len1 = WASM_VECTOR_LEN;
1029
+ const ret = wasm.database_create(ptr0, len0, addHeapObject(schemas_js), addHeapObject(migrations_js), addHeapObject(plugins), addHeapObject(module), ptr1, len1, isLikeNone(storage) ? 0 : addHeapObject(storage));
1030
+ return takeObject(ret);
1031
+ }
1032
+ }
1033
+
1034
+ const InMemoryFinalization = (typeof FinalizationRegistry === 'undefined')
1035
+ ? { register: () => {}, unregister: () => {} }
1036
+ : new FinalizationRegistry(ptr => wasm.__wbg_inmemory_free(ptr >>> 0));
1037
+ /**
1038
+ */
1039
+ export class InMemory {
1040
+
1041
+ static __wrap(ptr) {
1042
+ ptr = ptr >>> 0;
1043
+ const obj = Object.create(InMemory.prototype);
1044
+ obj.__wbg_ptr = ptr;
1045
+ InMemoryFinalization.register(obj, obj.__wbg_ptr, obj);
1046
+ return obj;
1047
+ }
1048
+
1049
+ __destroy_into_raw() {
1050
+ const ptr = this.__wbg_ptr;
1051
+ this.__wbg_ptr = 0;
1052
+ InMemoryFinalization.unregister(this);
1053
+ return ptr;
1054
+ }
1055
+
1056
+ free() {
1057
+ const ptr = this.__destroy_into_raw();
1058
+ wasm.__wbg_inmemory_free(ptr);
1059
+ }
1060
+ /**
1061
+ * @param {string} name
1062
+ * @param {object} schemas_js
1063
+ * @returns {Promise<InMemory>}
1064
+ */
1065
+ static create(name, schemas_js) {
1066
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1067
+ const len0 = WASM_VECTOR_LEN;
1068
+ const ret = wasm.inmemory_create(ptr0, len0, addHeapObject(schemas_js));
1069
+ return takeObject(ret);
1070
+ }
1071
+ /**
1072
+ * @param {Operation} op
1073
+ * @returns {Promise<any>}
1074
+ */
1075
+ write(op) {
1076
+ _assertClass(op, Operation);
1077
+ const ret = wasm.inmemory_write(this.__wbg_ptr, op.__wbg_ptr);
1078
+ return takeObject(ret);
1079
+ }
1080
+ /**
1081
+ * @param {string} collection_name
1082
+ * @param {any} query_js
1083
+ * @param {QueryOptions} options
1084
+ * @returns {Promise<any>}
1085
+ */
1086
+ find(collection_name, query_js, options) {
1087
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1088
+ const len0 = WASM_VECTOR_LEN;
1089
+ _assertClass(options, QueryOptions);
1090
+ const ret = wasm.inmemory_find(this.__wbg_ptr, ptr0, len0, addHeapObject(query_js), options.__wbg_ptr);
1091
+ return takeObject(ret);
1092
+ }
1093
+ /**
1094
+ * @param {string} collection_name
1095
+ * @param {any} primary_key
1096
+ * @returns {Promise<any>}
1097
+ */
1098
+ findDocumentById(collection_name, primary_key) {
1099
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1100
+ const len0 = WASM_VECTOR_LEN;
1101
+ const ret = wasm.inmemory_findDocumentById(this.__wbg_ptr, ptr0, len0, addHeapObject(primary_key));
1102
+ return takeObject(ret);
1103
+ }
1104
+ /**
1105
+ * @param {string} collection_name
1106
+ * @param {any} query_js
1107
+ * @param {QueryOptions} options
1108
+ * @returns {Promise<any>}
1109
+ */
1110
+ count(collection_name, query_js, options) {
1111
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1112
+ const len0 = WASM_VECTOR_LEN;
1113
+ _assertClass(options, QueryOptions);
1114
+ const ret = wasm.inmemory_count(this.__wbg_ptr, ptr0, len0, addHeapObject(query_js), options.__wbg_ptr);
1115
+ return takeObject(ret);
1116
+ }
1117
+ /**
1118
+ * @returns {Promise<any>}
1119
+ */
1120
+ close() {
1121
+ const ret = wasm.inmemory_close(this.__wbg_ptr);
1122
+ return takeObject(ret);
1123
+ }
1124
+ /**
1125
+ * @returns {Promise<any>}
1126
+ */
1127
+ start() {
1128
+ const ret = wasm.inmemory_start(this.__wbg_ptr);
1129
+ return takeObject(ret);
1130
+ }
1131
+ }
1132
+
1133
+ const IndexDBFinalization = (typeof FinalizationRegistry === 'undefined')
1134
+ ? { register: () => {}, unregister: () => {} }
1135
+ : new FinalizationRegistry(ptr => wasm.__wbg_indexdb_free(ptr >>> 0));
1136
+ /**
1137
+ */
1138
+ export class IndexDB {
1139
+
1140
+ static __wrap(ptr) {
1141
+ ptr = ptr >>> 0;
1142
+ const obj = Object.create(IndexDB.prototype);
1143
+ obj.__wbg_ptr = ptr;
1144
+ IndexDBFinalization.register(obj, obj.__wbg_ptr, obj);
1145
+ return obj;
1146
+ }
1147
+
1148
+ __destroy_into_raw() {
1149
+ const ptr = this.__wbg_ptr;
1150
+ this.__wbg_ptr = 0;
1151
+ IndexDBFinalization.unregister(this);
1152
+ return ptr;
1153
+ }
1154
+
1155
+ free() {
1156
+ const ptr = this.__destroy_into_raw();
1157
+ wasm.__wbg_indexdb_free(ptr);
1158
+ }
1159
+ /**
1160
+ * @returns {(string)[]}
1161
+ */
1162
+ get_stores() {
1163
+ try {
1164
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1165
+ wasm.indexdb_get_stores(retptr, this.__wbg_ptr);
1166
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1167
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1168
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1169
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1170
+ return v1;
1171
+ } finally {
1172
+ wasm.__wbindgen_add_to_stack_pointer(16);
1173
+ }
1174
+ }
1175
+ /**
1176
+ * @param {string} store_name
1177
+ * @returns {IDBObjectStore}
1178
+ */
1179
+ get_store(store_name) {
1180
+ try {
1181
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1182
+ const ptr0 = passStringToWasm0(store_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1183
+ const len0 = WASM_VECTOR_LEN;
1184
+ wasm.indexdb_get_store(retptr, this.__wbg_ptr, ptr0, len0);
1185
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1186
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1187
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1188
+ if (r2) {
1189
+ throw takeObject(r1);
1190
+ }
1191
+ return takeObject(r0);
1192
+ } finally {
1193
+ wasm.__wbindgen_add_to_stack_pointer(16);
1194
+ }
1195
+ }
1196
+ /**
1197
+ * @param {string} name
1198
+ * @param {object} schemas_js
1199
+ * @returns {Promise<IndexDB>}
1200
+ */
1201
+ static create(name, schemas_js) {
1202
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1203
+ const len0 = WASM_VECTOR_LEN;
1204
+ const ret = wasm.indexdb_create(ptr0, len0, addHeapObject(schemas_js));
1205
+ return takeObject(ret);
1206
+ }
1207
+ /**
1208
+ * @param {Operation} op
1209
+ * @returns {Promise<any>}
1210
+ */
1211
+ write(op) {
1212
+ _assertClass(op, Operation);
1213
+ const ret = wasm.indexdb_write(this.__wbg_ptr, op.__wbg_ptr);
1214
+ return takeObject(ret);
1215
+ }
1216
+ /**
1217
+ * @param {string} collection_name
1218
+ * @param {any} query
1219
+ * @param {QueryOptions} options
1220
+ * @returns {Promise<any>}
1221
+ */
1222
+ find(collection_name, query, options) {
1223
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1224
+ const len0 = WASM_VECTOR_LEN;
1225
+ _assertClass(options, QueryOptions);
1226
+ const ret = wasm.indexdb_find(this.__wbg_ptr, ptr0, len0, addHeapObject(query), options.__wbg_ptr);
1227
+ return takeObject(ret);
1228
+ }
1229
+ /**
1230
+ * @param {string} collection_name
1231
+ * @param {any} primary_key
1232
+ * @returns {Promise<any>}
1233
+ */
1234
+ findDocumentById(collection_name, primary_key) {
1235
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1236
+ const len0 = WASM_VECTOR_LEN;
1237
+ const ret = wasm.indexdb_findDocumentById(this.__wbg_ptr, ptr0, len0, addHeapObject(primary_key));
1238
+ return takeObject(ret);
1239
+ }
1240
+ /**
1241
+ * @param {string} collection_name
1242
+ * @param {any} query
1243
+ * @param {QueryOptions} options
1244
+ * @returns {Promise<any>}
1245
+ */
1246
+ count(collection_name, query, options) {
1247
+ const ptr0 = passStringToWasm0(collection_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1248
+ const len0 = WASM_VECTOR_LEN;
1249
+ _assertClass(options, QueryOptions);
1250
+ const ret = wasm.indexdb_count(this.__wbg_ptr, ptr0, len0, addHeapObject(query), options.__wbg_ptr);
1251
+ return takeObject(ret);
1252
+ }
1253
+ /**
1254
+ * @returns {Promise<any>}
1255
+ */
1256
+ close() {
1257
+ const ret = wasm.indexdb_close(this.__wbg_ptr);
1258
+ return takeObject(ret);
1259
+ }
1260
+ /**
1261
+ * @returns {Promise<any>}
1262
+ */
1263
+ start() {
1264
+ const ret = wasm.indexdb_start(this.__wbg_ptr);
1265
+ return takeObject(ret);
1266
+ }
1267
+ }
1268
+
1269
+ const OperationFinalization = (typeof FinalizationRegistry === 'undefined')
1270
+ ? { register: () => {}, unregister: () => {} }
1271
+ : new FinalizationRegistry(ptr => wasm.__wbg_operation_free(ptr >>> 0));
1272
+ /**
1273
+ * Represents an operation to be performed on a collection.
1274
+ */
1275
+ export class Operation {
1276
+
1277
+ static __wrap(ptr) {
1278
+ ptr = ptr >>> 0;
1279
+ const obj = Object.create(Operation.prototype);
1280
+ obj.__wbg_ptr = ptr;
1281
+ OperationFinalization.register(obj, obj.__wbg_ptr, obj);
1282
+ return obj;
1283
+ }
1284
+
1285
+ __destroy_into_raw() {
1286
+ const ptr = this.__wbg_ptr;
1287
+ this.__wbg_ptr = 0;
1288
+ OperationFinalization.unregister(this);
1289
+ return ptr;
1290
+ }
1291
+
1292
+ free() {
1293
+ const ptr = this.__destroy_into_raw();
1294
+ wasm.__wbg_operation_free(ptr);
1295
+ }
1296
+ /**
1297
+ * Retrieves the name of the collection.
1298
+ *
1299
+ * # Returns
1300
+ *
1301
+ * * `String` - The name of the collection.
1302
+ * @returns {string}
1303
+ */
1304
+ get collection() {
1305
+ let deferred1_0;
1306
+ let deferred1_1;
1307
+ try {
1308
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1309
+ wasm.operation_collection(retptr, this.__wbg_ptr);
1310
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1311
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1312
+ deferred1_0 = r0;
1313
+ deferred1_1 = r1;
1314
+ return getStringFromWasm0(r0, r1);
1315
+ } finally {
1316
+ wasm.__wbindgen_add_to_stack_pointer(16);
1317
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1318
+ }
1319
+ }
1320
+ /**
1321
+ * Retrieves the type of operation.
1322
+ *
1323
+ * # Returns
1324
+ *
1325
+ * * `OpType` - The type of operation.
1326
+ * @returns {OpType}
1327
+ */
1328
+ get opType() {
1329
+ const ret = wasm.operation_opType(this.__wbg_ptr);
1330
+ return ret;
1331
+ }
1332
+ /**
1333
+ * Retrieves the data involved in the operation.
1334
+ *
1335
+ * # Returns
1336
+ *
1337
+ * * `JsValue` - The data involved in the operation.
1338
+ * @returns {any}
1339
+ */
1340
+ get data() {
1341
+ const ret = wasm.operation_data(this.__wbg_ptr);
1342
+ return takeObject(ret);
1343
+ }
1344
+ /**
1345
+ * Retrieves the primary key field of the current collection.
1346
+ *
1347
+ * # Returns
1348
+ *
1349
+ * * `Option<String>` - The primary key field of the current collection.
1350
+ * @returns {any}
1351
+ */
1352
+ get primaryKeyField() {
1353
+ const ret = wasm.operation_primaryKeyField(this.__wbg_ptr);
1354
+ return takeObject(ret);
1355
+ }
1356
+ /**
1357
+ * Retrieves the primary key value of the current data.
1358
+ *
1359
+ * # Returns
1360
+ *
1361
+ * * `Option<JsValue>` - The primary key value of the current data.
1362
+ * @returns {any}
1363
+ */
1364
+ get primaryKey() {
1365
+ const ret = wasm.operation_primaryKey(this.__wbg_ptr);
1366
+ return takeObject(ret);
1367
+ }
1368
+ /**
1369
+ * @returns {string}
1370
+ */
1371
+ get primaryKeyIndex() {
1372
+ let deferred2_0;
1373
+ let deferred2_1;
1374
+ try {
1375
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1376
+ wasm.operation_primaryKeyIndex(retptr, this.__wbg_ptr);
1377
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1378
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1379
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1380
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1381
+ var ptr1 = r0;
1382
+ var len1 = r1;
1383
+ if (r3) {
1384
+ ptr1 = 0; len1 = 0;
1385
+ throw takeObject(r2);
1386
+ }
1387
+ deferred2_0 = ptr1;
1388
+ deferred2_1 = len1;
1389
+ return getStringFromWasm0(ptr1, len1);
1390
+ } finally {
1391
+ wasm.__wbindgen_add_to_stack_pointer(16);
1392
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1393
+ }
1394
+ }
1395
+ }
1396
+
1397
+ const PropertyFinalization = (typeof FinalizationRegistry === 'undefined')
1398
+ ? { register: () => {}, unregister: () => {} }
1399
+ : new FinalizationRegistry(ptr => wasm.__wbg_property_free(ptr >>> 0));
1400
+ /**
1401
+ * Represents a property within a schema, including type, items, length constraints, and other attributes.
1402
+ */
1403
+ export class Property {
1404
+
1405
+ __destroy_into_raw() {
1406
+ const ptr = this.__wbg_ptr;
1407
+ this.__wbg_ptr = 0;
1408
+ PropertyFinalization.unregister(this);
1409
+ return ptr;
1410
+ }
1411
+
1412
+ free() {
1413
+ const ptr = this.__destroy_into_raw();
1414
+ wasm.__wbg_property_free(ptr);
1415
+ }
1416
+ /**
1417
+ * Checks is the schema is valid.
1418
+ *
1419
+ * # Returns
1420
+ *
1421
+ * Throws exception if not valid
1422
+ * @returns {boolean}
1423
+ */
1424
+ is_valid() {
1425
+ try {
1426
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1427
+ wasm.property_is_valid(retptr, this.__wbg_ptr);
1428
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1429
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1430
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1431
+ if (r2) {
1432
+ throw takeObject(r1);
1433
+ }
1434
+ return r0 !== 0;
1435
+ } finally {
1436
+ wasm.__wbindgen_add_to_stack_pointer(16);
1437
+ }
1438
+ }
1439
+ /**
1440
+ * Retrieves the type of the property.
1441
+ *
1442
+ * # Returns
1443
+ *
1444
+ * * `PropertyType` - The type of the property.
1445
+ * @returns {any}
1446
+ */
1447
+ get type() {
1448
+ const ret = wasm.property_type(this.__wbg_ptr);
1449
+ return takeObject(ret);
1450
+ }
1451
+ /**
1452
+ * Retrieves the items of the property.
1453
+ *
1454
+ * # Returns
1455
+ *
1456
+ * * `Result<JsValue, JsValue>` - A result containing the items as a `JsValue` or an error.
1457
+ * @returns {any}
1458
+ */
1459
+ get items() {
1460
+ try {
1461
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1462
+ wasm.property_items(retptr, this.__wbg_ptr);
1463
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1464
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1465
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1466
+ if (r2) {
1467
+ throw takeObject(r1);
1468
+ }
1469
+ return takeObject(r0);
1470
+ } finally {
1471
+ wasm.__wbindgen_add_to_stack_pointer(16);
1472
+ }
1473
+ }
1474
+ /**
1475
+ * Retrieves the maximum number of items of the property.
1476
+ *
1477
+ * # Returns
1478
+ *
1479
+ * * `Result<JsValue, JsValue>` - A result containing the maximum number of items as a `JsValue` or an error.
1480
+ * @returns {any}
1481
+ */
1482
+ get maxItems() {
1483
+ try {
1484
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1485
+ wasm.property_maxItems(retptr, this.__wbg_ptr);
1486
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1487
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1488
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1489
+ if (r2) {
1490
+ throw takeObject(r1);
1491
+ }
1492
+ return takeObject(r0);
1493
+ } finally {
1494
+ wasm.__wbindgen_add_to_stack_pointer(16);
1495
+ }
1496
+ }
1497
+ /**
1498
+ * Retrieves the minimum number of items of the property.
1499
+ *
1500
+ * # Returns
1501
+ *
1502
+ * * `Result<JsValue, JsValue>` - A result containing the minimum number of items as a `JsValue` or an error.
1503
+ * @returns {any}
1504
+ */
1505
+ get minItems() {
1506
+ try {
1507
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1508
+ wasm.property_minItems(retptr, this.__wbg_ptr);
1509
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1510
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1511
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1512
+ if (r2) {
1513
+ throw takeObject(r1);
1514
+ }
1515
+ return takeObject(r0);
1516
+ } finally {
1517
+ wasm.__wbindgen_add_to_stack_pointer(16);
1518
+ }
1519
+ }
1520
+ /**
1521
+ * Retrieves the maximum length of the property.
1522
+ *
1523
+ * # Returns
1524
+ *
1525
+ * * `Result<JsValue, JsValue>` - A result containing the maximum length as a `JsValue` or an error.
1526
+ * @returns {any}
1527
+ */
1528
+ get maxLength() {
1529
+ try {
1530
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1531
+ wasm.property_maxLength(retptr, this.__wbg_ptr);
1532
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1533
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1534
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1535
+ if (r2) {
1536
+ throw takeObject(r1);
1537
+ }
1538
+ return takeObject(r0);
1539
+ } finally {
1540
+ wasm.__wbindgen_add_to_stack_pointer(16);
1541
+ }
1542
+ }
1543
+ /**
1544
+ * Retrieves the minimum length of the property.
1545
+ *
1546
+ * # Returns
1547
+ *
1548
+ * * `Result<JsValue, JsValue>` - A result containing the minimum length as a `JsValue` or an error.
1549
+ * @returns {any}
1550
+ */
1551
+ get minLength() {
1552
+ try {
1553
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1554
+ wasm.property_minLength(retptr, this.__wbg_ptr);
1555
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1556
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1557
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1558
+ if (r2) {
1559
+ throw takeObject(r1);
1560
+ }
1561
+ return takeObject(r0);
1562
+ } finally {
1563
+ wasm.__wbindgen_add_to_stack_pointer(16);
1564
+ }
1565
+ }
1566
+ /**
1567
+ * Retrieves the nested properties of the property.
1568
+ *
1569
+ * # Returns
1570
+ *
1571
+ * * `Result<JsValue, JsValue>` - A result containing the nested properties as a `JsValue` or an error.
1572
+ * @returns {any}
1573
+ */
1574
+ get properties() {
1575
+ try {
1576
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1577
+ wasm.property_properties(retptr, this.__wbg_ptr);
1578
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1579
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1580
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1581
+ if (r2) {
1582
+ throw takeObject(r1);
1583
+ }
1584
+ return takeObject(r0);
1585
+ } finally {
1586
+ wasm.__wbindgen_add_to_stack_pointer(16);
1587
+ }
1588
+ }
1589
+ }
1590
+
1591
+ const QueryFinalization = (typeof FinalizationRegistry === 'undefined')
1592
+ ? { register: () => {}, unregister: () => {} }
1593
+ : new FinalizationRegistry(ptr => wasm.__wbg_query_free(ptr >>> 0));
1594
+ /**
1595
+ */
1596
+ export class Query {
1597
+
1598
+ __destroy_into_raw() {
1599
+ const ptr = this.__wbg_ptr;
1600
+ this.__wbg_ptr = 0;
1601
+ QueryFinalization.unregister(this);
1602
+ return ptr;
1603
+ }
1604
+
1605
+ free() {
1606
+ const ptr = this.__destroy_into_raw();
1607
+ wasm.__wbg_query_free(ptr);
1608
+ }
1609
+ /**
1610
+ * @param {any} query
1611
+ * @param {Schema} schema
1612
+ */
1613
+ constructor(query, schema) {
1614
+ try {
1615
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1616
+ _assertClass(schema, Schema);
1617
+ var ptr0 = schema.__destroy_into_raw();
1618
+ wasm.query_new(retptr, addHeapObject(query), ptr0);
1619
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1620
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1621
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1622
+ if (r2) {
1623
+ throw takeObject(r1);
1624
+ }
1625
+ this.__wbg_ptr = r0 >>> 0;
1626
+ return this;
1627
+ } finally {
1628
+ wasm.__wbindgen_add_to_stack_pointer(16);
1629
+ }
1630
+ }
1631
+ /**
1632
+ * @returns {any}
1633
+ */
1634
+ get query() {
1635
+ try {
1636
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1637
+ wasm.query_query(retptr, this.__wbg_ptr);
1638
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1639
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1640
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1641
+ if (r2) {
1642
+ throw takeObject(r1);
1643
+ }
1644
+ return takeObject(r0);
1645
+ } finally {
1646
+ wasm.__wbindgen_add_to_stack_pointer(16);
1647
+ }
1648
+ }
1649
+ /**
1650
+ * Returns the schema properties (fields) that are used in the query.
1651
+ * The query may contain operators like $and, $or, $gt, $lt, etc.
1652
+ * @returns {(string)[]}
1653
+ */
1654
+ get_properties() {
1655
+ try {
1656
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1657
+ wasm.query_get_properties(retptr, this.__wbg_ptr);
1658
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1659
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1660
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1661
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1662
+ if (r3) {
1663
+ throw takeObject(r2);
1664
+ }
1665
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1666
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1667
+ return v1;
1668
+ } finally {
1669
+ wasm.__wbindgen_add_to_stack_pointer(16);
1670
+ }
1671
+ }
1672
+ /**
1673
+ * @returns {any}
1674
+ */
1675
+ parse() {
1676
+ try {
1677
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1678
+ wasm.query_parse(retptr, this.__wbg_ptr);
1679
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1680
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1681
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1682
+ if (r2) {
1683
+ throw takeObject(r1);
1684
+ }
1685
+ return takeObject(r0);
1686
+ } finally {
1687
+ wasm.__wbindgen_add_to_stack_pointer(16);
1688
+ }
1689
+ }
1690
+ /**
1691
+ * @param {any} query
1692
+ * @returns {any}
1693
+ */
1694
+ process_query(query) {
1695
+ try {
1696
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1697
+ wasm.query_process_query(retptr, this.__wbg_ptr, addBorrowedObject(query));
1698
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1699
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1700
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1701
+ if (r2) {
1702
+ throw takeObject(r1);
1703
+ }
1704
+ return takeObject(r0);
1705
+ } finally {
1706
+ wasm.__wbindgen_add_to_stack_pointer(16);
1707
+ heap[stack_pointer++] = undefined;
1708
+ }
1709
+ }
1710
+ /**
1711
+ * Returns the value of a property from the (normalized) query by its name.
1712
+ * This will scan the normalized query structure (including arrays, $and/$or blocks, etc.)
1713
+ * to find the first occurrence of the given property name and return its corresponding value.
1714
+ *
1715
+ * If not found, an error is returned.
1716
+ *
1717
+ * Example:
1718
+ * let val = query.get("age")?;
1719
+ * // val is a JsValue that might be a number, string, boolean, array, or object (e.g., { "$gt": 30 })
1720
+ * @param {string} property_name
1721
+ * @returns {any}
1722
+ */
1723
+ get(property_name) {
1724
+ try {
1725
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1726
+ const ptr0 = passStringToWasm0(property_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1727
+ const len0 = WASM_VECTOR_LEN;
1728
+ wasm.query_get(retptr, this.__wbg_ptr, ptr0, len0);
1729
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1730
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1731
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1732
+ if (r2) {
1733
+ throw takeObject(r1);
1734
+ }
1735
+ return takeObject(r0);
1736
+ } finally {
1737
+ wasm.__wbindgen_add_to_stack_pointer(16);
1738
+ }
1739
+ }
1740
+ }
1741
+
1742
+ const QueryOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
1743
+ ? { register: () => {}, unregister: () => {} }
1744
+ : new FinalizationRegistry(ptr => wasm.__wbg_queryoptions_free(ptr >>> 0));
1745
+ /**
1746
+ */
1747
+ export class QueryOptions {
1748
+
1749
+ static __wrap(ptr) {
1750
+ ptr = ptr >>> 0;
1751
+ const obj = Object.create(QueryOptions.prototype);
1752
+ obj.__wbg_ptr = ptr;
1753
+ QueryOptionsFinalization.register(obj, obj.__wbg_ptr, obj);
1754
+ return obj;
1755
+ }
1756
+
1757
+ __destroy_into_raw() {
1758
+ const ptr = this.__wbg_ptr;
1759
+ this.__wbg_ptr = 0;
1760
+ QueryOptionsFinalization.unregister(this);
1761
+ return ptr;
1762
+ }
1763
+
1764
+ free() {
1765
+ const ptr = this.__destroy_into_raw();
1766
+ wasm.__wbg_queryoptions_free(ptr);
1767
+ }
1768
+ /**
1769
+ * @returns {any}
1770
+ */
1771
+ get limit() {
1772
+ try {
1773
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1774
+ wasm.queryoptions_limit(retptr, this.__wbg_ptr);
1775
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1776
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1777
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1778
+ if (r2) {
1779
+ throw takeObject(r1);
1780
+ }
1781
+ return takeObject(r0);
1782
+ } finally {
1783
+ wasm.__wbindgen_add_to_stack_pointer(16);
1784
+ }
1785
+ }
1786
+ /**
1787
+ * @returns {any}
1788
+ */
1789
+ get offset() {
1790
+ try {
1791
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1792
+ wasm.queryoptions_offset(retptr, this.__wbg_ptr);
1793
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1794
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1795
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1796
+ if (r2) {
1797
+ throw takeObject(r1);
1798
+ }
1799
+ return takeObject(r0);
1800
+ } finally {
1801
+ wasm.__wbindgen_add_to_stack_pointer(16);
1802
+ }
1803
+ }
1804
+ }
1805
+
1806
+ const RIDBErrorFinalization = (typeof FinalizationRegistry === 'undefined')
1807
+ ? { register: () => {}, unregister: () => {} }
1808
+ : new FinalizationRegistry(ptr => wasm.__wbg_ridberror_free(ptr >>> 0));
1809
+ /**
1810
+ */
1811
+ export class RIDBError {
1812
+
1813
+ static __wrap(ptr) {
1814
+ ptr = ptr >>> 0;
1815
+ const obj = Object.create(RIDBError.prototype);
1816
+ obj.__wbg_ptr = ptr;
1817
+ RIDBErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1818
+ return obj;
1819
+ }
1820
+
1821
+ toJSON() {
1822
+ return {
1823
+ type: this.type,
1824
+ code: this.code,
1825
+ message: this.message,
1826
+ };
1827
+ }
1828
+
1829
+ toString() {
1830
+ return JSON.stringify(this);
1831
+ }
1832
+
1833
+ __destroy_into_raw() {
1834
+ const ptr = this.__wbg_ptr;
1835
+ this.__wbg_ptr = 0;
1836
+ RIDBErrorFinalization.unregister(this);
1837
+ return ptr;
1838
+ }
1839
+
1840
+ free() {
1841
+ const ptr = this.__destroy_into_raw();
1842
+ wasm.__wbg_ridberror_free(ptr);
1843
+ }
1844
+ /**
1845
+ * @param {string} err_type
1846
+ * @param {string} message
1847
+ * @param {number} code
1848
+ */
1849
+ constructor(err_type, message, code) {
1850
+ const ptr0 = passStringToWasm0(err_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1851
+ const len0 = WASM_VECTOR_LEN;
1852
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1853
+ const len1 = WASM_VECTOR_LEN;
1854
+ const ret = wasm.ridberror_new(ptr0, len0, ptr1, len1, code);
1855
+ this.__wbg_ptr = ret >>> 0;
1856
+ return this;
1857
+ }
1858
+ /**
1859
+ * @returns {string}
1860
+ */
1861
+ get type() {
1862
+ let deferred1_0;
1863
+ let deferred1_1;
1864
+ try {
1865
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1866
+ wasm.ridberror_type(retptr, this.__wbg_ptr);
1867
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1868
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1869
+ deferred1_0 = r0;
1870
+ deferred1_1 = r1;
1871
+ return getStringFromWasm0(r0, r1);
1872
+ } finally {
1873
+ wasm.__wbindgen_add_to_stack_pointer(16);
1874
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1875
+ }
1876
+ }
1877
+ /**
1878
+ * @returns {any}
1879
+ */
1880
+ get code() {
1881
+ const ret = wasm.ridberror_code(this.__wbg_ptr);
1882
+ return takeObject(ret);
1883
+ }
1884
+ /**
1885
+ * @returns {string}
1886
+ */
1887
+ get message() {
1888
+ let deferred1_0;
1889
+ let deferred1_1;
1890
+ try {
1891
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1892
+ wasm.ridberror_message(retptr, this.__wbg_ptr);
1893
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1894
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1895
+ deferred1_0 = r0;
1896
+ deferred1_1 = r1;
1897
+ return getStringFromWasm0(r0, r1);
1898
+ } finally {
1899
+ wasm.__wbindgen_add_to_stack_pointer(16);
1900
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1901
+ }
1902
+ }
1903
+ /**
1904
+ * @param {any} err
1905
+ * @returns {RIDBError}
1906
+ */
1907
+ static from(err) {
1908
+ const ret = wasm.ridberror_from(addHeapObject(err));
1909
+ return RIDBError.__wrap(ret);
1910
+ }
1911
+ /**
1912
+ * @param {string} err
1913
+ * @param {number} code
1914
+ * @returns {RIDBError}
1915
+ */
1916
+ static error(err, code) {
1917
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1918
+ const len0 = WASM_VECTOR_LEN;
1919
+ const ret = wasm.ridberror_error(ptr0, len0, code);
1920
+ return RIDBError.__wrap(ret);
1921
+ }
1922
+ /**
1923
+ * @param {string} err
1924
+ * @param {number} code
1925
+ * @returns {RIDBError}
1926
+ */
1927
+ static query(err, code) {
1928
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1929
+ const len0 = WASM_VECTOR_LEN;
1930
+ const ret = wasm.ridberror_query(ptr0, len0, code);
1931
+ return RIDBError.__wrap(ret);
1932
+ }
1933
+ /**
1934
+ * @param {string} err
1935
+ * @param {number} code
1936
+ * @returns {RIDBError}
1937
+ */
1938
+ static authentication(err, code) {
1939
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1940
+ const len0 = WASM_VECTOR_LEN;
1941
+ const ret = wasm.ridberror_authentication(ptr0, len0, code);
1942
+ return RIDBError.__wrap(ret);
1943
+ }
1944
+ /**
1945
+ * @param {string} err
1946
+ * @param {number} code
1947
+ * @returns {RIDBError}
1948
+ */
1949
+ static serialisation(err, code) {
1950
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1951
+ const len0 = WASM_VECTOR_LEN;
1952
+ const ret = wasm.ridberror_serialisation(ptr0, len0, code);
1953
+ return RIDBError.__wrap(ret);
1954
+ }
1955
+ /**
1956
+ * @param {string} err
1957
+ * @param {number} code
1958
+ * @returns {RIDBError}
1959
+ */
1960
+ static validation(err, code) {
1961
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1962
+ const len0 = WASM_VECTOR_LEN;
1963
+ const ret = wasm.ridberror_validation(ptr0, len0, code);
1964
+ return RIDBError.__wrap(ret);
1965
+ }
1966
+ /**
1967
+ * @param {string} err
1968
+ * @param {number} code
1969
+ * @returns {RIDBError}
1970
+ */
1971
+ static hook(err, code) {
1972
+ const ptr0 = passStringToWasm0(err, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1973
+ const len0 = WASM_VECTOR_LEN;
1974
+ const ret = wasm.ridberror_hook(ptr0, len0, code);
1975
+ return RIDBError.__wrap(ret);
1976
+ }
1977
+ }
1978
+
1979
+ const SchemaFinalization = (typeof FinalizationRegistry === 'undefined')
1980
+ ? { register: () => {}, unregister: () => {} }
1981
+ : new FinalizationRegistry(ptr => wasm.__wbg_schema_free(ptr >>> 0));
1982
+ /**
1983
+ * Represents the schema of a collection, including version, primary key, type, required fields, properties, and indexes.
1984
+ */
1985
+ export class Schema {
1986
+
1987
+ static __wrap(ptr) {
1988
+ ptr = ptr >>> 0;
1989
+ const obj = Object.create(Schema.prototype);
1990
+ obj.__wbg_ptr = ptr;
1991
+ SchemaFinalization.register(obj, obj.__wbg_ptr, obj);
1992
+ return obj;
1993
+ }
1994
+
1995
+ __destroy_into_raw() {
1996
+ const ptr = this.__wbg_ptr;
1997
+ this.__wbg_ptr = 0;
1998
+ SchemaFinalization.unregister(this);
1999
+ return ptr;
2000
+ }
2001
+
2002
+ free() {
2003
+ const ptr = this.__destroy_into_raw();
2004
+ wasm.__wbg_schema_free(ptr);
2005
+ }
2006
+ /**
2007
+ * @param {any} document
2008
+ */
2009
+ validate(document) {
2010
+ try {
2011
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2012
+ wasm.schema_validate(retptr, this.__wbg_ptr, addHeapObject(document));
2013
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2014
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2015
+ if (r1) {
2016
+ throw takeObject(r0);
2017
+ }
2018
+ } finally {
2019
+ wasm.__wbindgen_add_to_stack_pointer(16);
2020
+ }
2021
+ }
2022
+ /**
2023
+ * @returns {boolean}
2024
+ */
2025
+ is_valid() {
2026
+ try {
2027
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2028
+ wasm.schema_is_valid(retptr, this.__wbg_ptr);
2029
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2030
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2031
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2032
+ if (r2) {
2033
+ throw takeObject(r1);
2034
+ }
2035
+ return r0 !== 0;
2036
+ } finally {
2037
+ wasm.__wbindgen_add_to_stack_pointer(16);
2038
+ }
2039
+ }
2040
+ /**
2041
+ * Creates a new `Schema` instance from a given `JsValue`.
2042
+ *
2043
+ * # Arguments
2044
+ *
2045
+ * * `schema` - A `JsValue` representing the schema.
2046
+ *
2047
+ * # Returns
2048
+ *
2049
+ * * `Result<Schema, JsValue>` - A result containing the new `Schema` instance or an error.
2050
+ * @param {any} schema
2051
+ * @returns {Schema}
2052
+ */
2053
+ static create(schema) {
2054
+ try {
2055
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2056
+ wasm.schema_create(retptr, addHeapObject(schema));
2057
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2058
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2059
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2060
+ if (r2) {
2061
+ throw takeObject(r1);
2062
+ }
2063
+ return Schema.__wrap(r0);
2064
+ } finally {
2065
+ wasm.__wbindgen_add_to_stack_pointer(16);
2066
+ }
2067
+ }
2068
+ /**
2069
+ * Retrieves the version of the schema.
2070
+ *
2071
+ * # Returns
2072
+ *
2073
+ * * `i32` - The version of the schema.
2074
+ * @returns {number}
2075
+ */
2076
+ get version() {
2077
+ const ret = wasm.schema_version(this.__wbg_ptr);
2078
+ return ret;
2079
+ }
2080
+ /**
2081
+ * Retrieves the primary key of the schema.
2082
+ *
2083
+ * # Returns
2084
+ *
2085
+ * * `String` - The primary key of the schema.
2086
+ * @returns {string}
2087
+ */
2088
+ get primaryKey() {
2089
+ let deferred1_0;
2090
+ let deferred1_1;
2091
+ try {
2092
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2093
+ wasm.schema_primaryKey(retptr, this.__wbg_ptr);
2094
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2095
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2096
+ deferred1_0 = r0;
2097
+ deferred1_1 = r1;
2098
+ return getStringFromWasm0(r0, r1);
2099
+ } finally {
2100
+ wasm.__wbindgen_add_to_stack_pointer(16);
2101
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2102
+ }
2103
+ }
2104
+ /**
2105
+ * Retrieves the type of the schema.
2106
+ *
2107
+ * # Returns
2108
+ *
2109
+ * * `String` - The type of the schema.
2110
+ * @returns {string}
2111
+ */
2112
+ get type() {
2113
+ let deferred1_0;
2114
+ let deferred1_1;
2115
+ try {
2116
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2117
+ wasm.schema_type(retptr, this.__wbg_ptr);
2118
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2119
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2120
+ deferred1_0 = r0;
2121
+ deferred1_1 = r1;
2122
+ return getStringFromWasm0(r0, r1);
2123
+ } finally {
2124
+ wasm.__wbindgen_add_to_stack_pointer(16);
2125
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2126
+ }
2127
+ }
2128
+ /**
2129
+ * Retrieves the indexes of the schema, if any.
2130
+ *
2131
+ * # Returns
2132
+ *
2133
+ * * `Option<Vec<String>>` - The indexes of the schema, if any.
2134
+ * @returns {(string)[] | undefined}
2135
+ */
2136
+ get indexes() {
2137
+ try {
2138
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2139
+ wasm.schema_indexes(retptr, this.__wbg_ptr);
2140
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2141
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2142
+ let v1;
2143
+ if (r0 !== 0) {
2144
+ v1 = getArrayJsValueFromWasm0(r0, r1).slice();
2145
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2146
+ }
2147
+ return v1;
2148
+ } finally {
2149
+ wasm.__wbindgen_add_to_stack_pointer(16);
2150
+ }
2151
+ }
2152
+ /**
2153
+ * @returns {(string)[] | undefined}
2154
+ */
2155
+ get encrypted() {
2156
+ try {
2157
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2158
+ wasm.schema_encrypted(retptr, this.__wbg_ptr);
2159
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2160
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2161
+ let v1;
2162
+ if (r0 !== 0) {
2163
+ v1 = getArrayJsValueFromWasm0(r0, r1).slice();
2164
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2165
+ }
2166
+ return v1;
2167
+ } finally {
2168
+ wasm.__wbindgen_add_to_stack_pointer(16);
2169
+ }
2170
+ }
2171
+ /**
2172
+ * Retrieves the properties of the schema.
2173
+ *
2174
+ * # Returns
2175
+ *
2176
+ * * `Result<JsValue, JsValue>` - A result containing the properties as a `JsValue` or an error.
2177
+ * @returns {any}
2178
+ */
2179
+ get properties() {
2180
+ try {
2181
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2182
+ wasm.schema_properties(retptr, this.__wbg_ptr);
2183
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2184
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2185
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2186
+ if (r2) {
2187
+ throw takeObject(r1);
2188
+ }
2189
+ return takeObject(r0);
2190
+ } finally {
2191
+ wasm.__wbindgen_add_to_stack_pointer(16);
2192
+ }
2193
+ }
2194
+ }
2195
+
2196
+ const WasmBindgenTestContextFinalization = (typeof FinalizationRegistry === 'undefined')
2197
+ ? { register: () => {}, unregister: () => {} }
2198
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbindgentestcontext_free(ptr >>> 0));
2199
+ /**
2200
+ * Runtime test harness support instantiated in JS.
2201
+ *
2202
+ * The node.js entry script instantiates a `Context` here which is used to
2203
+ * drive test execution.
2204
+ */
2205
+ export class WasmBindgenTestContext {
2206
+
2207
+ __destroy_into_raw() {
2208
+ const ptr = this.__wbg_ptr;
2209
+ this.__wbg_ptr = 0;
2210
+ WasmBindgenTestContextFinalization.unregister(this);
2211
+ return ptr;
2212
+ }
2213
+
2214
+ free() {
2215
+ const ptr = this.__destroy_into_raw();
2216
+ wasm.__wbg_wasmbindgentestcontext_free(ptr);
2217
+ }
2218
+ /**
2219
+ * Creates a new context ready to run tests.
2220
+ *
2221
+ * A `Context` is the main structure through which test execution is
2222
+ * coordinated, and this will collect output and results for all executed
2223
+ * tests.
2224
+ */
2225
+ constructor() {
2226
+ const ret = wasm.wasmbindgentestcontext_new();
2227
+ this.__wbg_ptr = ret >>> 0;
2228
+ return this;
2229
+ }
2230
+ /**
2231
+ * Inform this context about runtime arguments passed to the test
2232
+ * harness.
2233
+ * @param {any[]} args
2234
+ */
2235
+ args(args) {
2236
+ const ptr0 = passArrayJsValueToWasm0(args, wasm.__wbindgen_malloc);
2237
+ const len0 = WASM_VECTOR_LEN;
2238
+ wasm.wasmbindgentestcontext_args(this.__wbg_ptr, ptr0, len0);
2239
+ }
2240
+ /**
2241
+ * Executes a list of tests, returning a promise representing their
2242
+ * eventual completion.
2243
+ *
2244
+ * This is the main entry point for executing tests. All the tests passed
2245
+ * in are the JS `Function` object that was plucked off the
2246
+ * `WebAssembly.Instance` exports list.
2247
+ *
2248
+ * The promise returned resolves to either `true` if all tests passed or
2249
+ * `false` if at least one test failed.
2250
+ * @param {any[]} tests
2251
+ * @returns {Promise<any>}
2252
+ */
2253
+ run(tests) {
2254
+ const ptr0 = passArrayJsValueToWasm0(tests, wasm.__wbindgen_malloc);
2255
+ const len0 = WASM_VECTOR_LEN;
2256
+ const ret = wasm.wasmbindgentestcontext_run(this.__wbg_ptr, ptr0, len0);
2257
+ return takeObject(ret);
2258
+ }
2259
+ }
2260
+
2261
+ async function __wbg_load(module, imports) {
2262
+ if (typeof Response === 'function' && module instanceof Response) {
2263
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2264
+ try {
2265
+ return await WebAssembly.instantiateStreaming(module, imports);
2266
+
2267
+ } catch (e) {
2268
+ if (module.headers.get('Content-Type') != 'application/wasm') {
2269
+ 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);
2270
+
2271
+ } else {
2272
+ throw e;
2273
+ }
2274
+ }
2275
+ }
2276
+
2277
+ const bytes = await module.arrayBuffer();
2278
+ return await WebAssembly.instantiate(bytes, imports);
2279
+
2280
+ } else {
2281
+ const instance = await WebAssembly.instantiate(module, imports);
2282
+
2283
+ if (instance instanceof WebAssembly.Instance) {
2284
+ return { instance, module };
2285
+
2286
+ } else {
2287
+ return instance;
2288
+ }
2289
+ }
2290
+ }
2291
+
2292
+ function __wbg_get_imports() {
2293
+ const imports = {};
2294
+ imports.wbg = {};
2295
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2296
+ takeObject(arg0);
2297
+ };
2298
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2299
+ const ret = getStringFromWasm0(arg0, arg1);
2300
+ return addHeapObject(ret);
2301
+ };
2302
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
2303
+ const ret = getObject(arg0);
2304
+ return addHeapObject(ret);
2305
+ };
2306
+ imports.wbg.__wbg_ridberror_new = function(arg0) {
2307
+ const ret = RIDBError.__wrap(arg0);
2308
+ return addHeapObject(ret);
2309
+ };
2310
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
2311
+ const obj = getObject(arg1);
2312
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2313
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2314
+ var len1 = WASM_VECTOR_LEN;
2315
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2316
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2317
+ };
2318
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
2319
+ const ret = getObject(arg0) === undefined;
2320
+ return ret;
2321
+ };
2322
+ imports.wbg.__wbindgen_number_new = function(arg0) {
2323
+ const ret = arg0;
2324
+ return addHeapObject(ret);
2325
+ };
2326
+ imports.wbg.__wbg_inmemory_new = function(arg0) {
2327
+ const ret = InMemory.__wrap(arg0);
2328
+ return addHeapObject(ret);
2329
+ };
2330
+ imports.wbg.__wbg_apply_9f557eba1534d597 = function() { return handleError(function (arg0, arg1, arg2) {
2331
+ const ret = getObject(arg1).apply(takeObject(arg2));
2332
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_malloc);
2333
+ const len1 = WASM_VECTOR_LEN;
2334
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2335
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2336
+ }, arguments) };
2337
+ imports.wbg.__wbg_start_76c138c3b73ae6f8 = function() { return handleError(function (arg0) {
2338
+ const ret = getObject(arg0).start();
2339
+ return addHeapObject(ret);
2340
+ }, arguments) };
2341
+ imports.wbg.__wbg_close_6384ed3c27ef25c1 = function() { return handleError(function (arg0) {
2342
+ const ret = getObject(arg0).close();
2343
+ return addHeapObject(ret);
2344
+ }, arguments) };
2345
+ imports.wbg.__wbindgen_is_null = function(arg0) {
2346
+ const ret = getObject(arg0) === null;
2347
+ return ret;
2348
+ };
2349
+ imports.wbg.__wbg_count_19db4c3174d573d5 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2350
+ const ret = getObject(arg0).count(getStringFromWasm0(arg1, arg2), takeObject(arg3), QueryOptions.__wrap(arg4));
2351
+ return addHeapObject(ret);
2352
+ }, arguments) };
2353
+ imports.wbg.__wbg_find_567c5c9f064fe3d2 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2354
+ const ret = getObject(arg0).find(getStringFromWasm0(arg1, arg2), takeObject(arg3), QueryOptions.__wrap(arg4));
2355
+ return addHeapObject(ret);
2356
+ }, arguments) };
2357
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
2358
+ const obj = getObject(arg1);
2359
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2360
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
2361
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
2362
+ };
2363
+ imports.wbg.__wbg_findDocumentById_2edf7350e5f12657 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
2364
+ const ret = getObject(arg0).findDocumentById(getStringFromWasm0(arg1, arg2), takeObject(arg3));
2365
+ return addHeapObject(ret);
2366
+ }, arguments) };
2367
+ imports.wbg.__wbg_write_1159c67c07f62020 = function() { return handleError(function (arg0, arg1) {
2368
+ const ret = getObject(arg0).write(Operation.__wrap(arg1));
2369
+ return addHeapObject(ret);
2370
+ }, arguments) };
2371
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
2372
+ const obj = takeObject(arg0).original;
2373
+ if (obj.cnt-- == 1) {
2374
+ obj.a = 0;
2375
+ return true;
2376
+ }
2377
+ const ret = false;
2378
+ return ret;
2379
+ };
2380
+ imports.wbg.__wbindgen_is_array = function(arg0) {
2381
+ const ret = Array.isArray(getObject(arg0));
2382
+ return ret;
2383
+ };
2384
+ imports.wbg.__wbindgen_is_object = function(arg0) {
2385
+ const val = getObject(arg0);
2386
+ const ret = typeof(val) === 'object' && val !== null;
2387
+ return ret;
2388
+ };
2389
+ imports.wbg.__wbindgen_is_string = function(arg0) {
2390
+ const ret = typeof(getObject(arg0)) === 'string';
2391
+ return ret;
2392
+ };
2393
+ imports.wbg.__wbindgen_is_falsy = function(arg0) {
2394
+ const ret = !getObject(arg0);
2395
+ return ret;
2396
+ };
2397
+ imports.wbg.__wbg_collection_new = function(arg0) {
2398
+ const ret = Collection.__wrap(arg0);
2399
+ return addHeapObject(ret);
2400
+ };
2401
+ imports.wbg.__wbg_database_new = function(arg0) {
2402
+ const ret = Database.__wrap(arg0);
2403
+ return addHeapObject(ret);
2404
+ };
2405
+ imports.wbg.__wbg_indexdb_new = function(arg0) {
2406
+ const ret = IndexDB.__wrap(arg0);
2407
+ return addHeapObject(ret);
2408
+ };
2409
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
2410
+ const v = getObject(arg0);
2411
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
2412
+ return ret;
2413
+ };
2414
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2415
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2416
+ return addHeapObject(ret);
2417
+ };
2418
+ imports.wbg.__wbindgen_is_function = function(arg0) {
2419
+ const ret = typeof(getObject(arg0)) === 'function';
2420
+ return ret;
2421
+ };
2422
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
2423
+ const ret = typeof(getObject(arg0)) === 'bigint';
2424
+ return ret;
2425
+ };
2426
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
2427
+ const ret = getObject(arg0) in getObject(arg1);
2428
+ return ret;
2429
+ };
2430
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
2431
+ const ret = arg0;
2432
+ return addHeapObject(ret);
2433
+ };
2434
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
2435
+ const ret = getObject(arg0) === getObject(arg1);
2436
+ return ret;
2437
+ };
2438
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2439
+ const ret = BigInt.asUintN(64, arg0);
2440
+ return addHeapObject(ret);
2441
+ };
2442
+ imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
2443
+ const ret = getObject(arg0).crypto;
2444
+ return addHeapObject(ret);
2445
+ };
2446
+ imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
2447
+ const ret = getObject(arg0).process;
2448
+ return addHeapObject(ret);
2449
+ };
2450
+ imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
2451
+ const ret = getObject(arg0).versions;
2452
+ return addHeapObject(ret);
2453
+ };
2454
+ imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
2455
+ const ret = getObject(arg0).node;
2456
+ return addHeapObject(ret);
2457
+ };
2458
+ imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
2459
+ const ret = module.require;
2460
+ return addHeapObject(ret);
2461
+ }, arguments) };
2462
+ imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
2463
+ const ret = getObject(arg0).msCrypto;
2464
+ return addHeapObject(ret);
2465
+ };
2466
+ imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
2467
+ getObject(arg0).randomFillSync(takeObject(arg1));
2468
+ }, arguments) };
2469
+ imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
2470
+ getObject(arg0).getRandomValues(getObject(arg1));
2471
+ }, arguments) };
2472
+ imports.wbg.__wbg_instanceof_Window_f401953a2cf86220 = function(arg0) {
2473
+ let result;
2474
+ try {
2475
+ result = getObject(arg0) instanceof Window;
2476
+ } catch (_) {
2477
+ result = false;
2478
+ }
2479
+ const ret = result;
2480
+ return ret;
2481
+ };
2482
+ imports.wbg.__wbg_localStorage_e381d34d0c40c761 = function() { return handleError(function (arg0) {
2483
+ const ret = getObject(arg0).localStorage;
2484
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2485
+ }, arguments) };
2486
+ imports.wbg.__wbg_indexedDB_7c51d9056667f4e0 = function() { return handleError(function (arg0) {
2487
+ const ret = getObject(arg0).indexedDB;
2488
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2489
+ }, arguments) };
2490
+ imports.wbg.__wbg_instanceof_WorkerGlobalScope_46b577f151fad960 = function(arg0) {
2491
+ let result;
2492
+ try {
2493
+ result = getObject(arg0) instanceof WorkerGlobalScope;
2494
+ } catch (_) {
2495
+ result = false;
2496
+ }
2497
+ const ret = result;
2498
+ return ret;
2499
+ };
2500
+ imports.wbg.__wbg_indexedDB_d312f95759a15fdc = function() { return handleError(function (arg0) {
2501
+ const ret = getObject(arg0).indexedDB;
2502
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2503
+ }, arguments) };
2504
+ imports.wbg.__wbg_log_5bb5f88f245d7762 = function(arg0) {
2505
+ console.log(getObject(arg0));
2506
+ };
2507
+ imports.wbg.__wbg_openCursor_425aba9cbe1d4d39 = function() { return handleError(function (arg0) {
2508
+ const ret = getObject(arg0).openCursor();
2509
+ return addHeapObject(ret);
2510
+ }, arguments) };
2511
+ imports.wbg.__wbg_openCursor_e3042770817a8d57 = function() { return handleError(function (arg0, arg1) {
2512
+ const ret = getObject(arg0).openCursor(getObject(arg1));
2513
+ return addHeapObject(ret);
2514
+ }, arguments) };
2515
+ imports.wbg.__wbg_createIndex_b8da1f5571f644be = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2516
+ const ret = getObject(arg0).createIndex(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getObject(arg5));
2517
+ return addHeapObject(ret);
2518
+ }, arguments) };
2519
+ imports.wbg.__wbg_delete_f60bba7d0ae59a4f = function() { return handleError(function (arg0, arg1) {
2520
+ const ret = getObject(arg0).delete(getObject(arg1));
2521
+ return addHeapObject(ret);
2522
+ }, arguments) };
2523
+ imports.wbg.__wbg_get_5361b64cac0d0826 = function() { return handleError(function (arg0, arg1) {
2524
+ const ret = getObject(arg0).get(getObject(arg1));
2525
+ return addHeapObject(ret);
2526
+ }, arguments) };
2527
+ imports.wbg.__wbg_index_383b6812c1508030 = function() { return handleError(function (arg0, arg1, arg2) {
2528
+ const ret = getObject(arg0).index(getStringFromWasm0(arg1, arg2));
2529
+ return addHeapObject(ret);
2530
+ }, arguments) };
2531
+ imports.wbg.__wbg_openCursor_30d58ae27a327629 = function() { return handleError(function (arg0) {
2532
+ const ret = getObject(arg0).openCursor();
2533
+ return addHeapObject(ret);
2534
+ }, arguments) };
2535
+ imports.wbg.__wbg_openCursor_611b1e488c393dd8 = function() { return handleError(function (arg0, arg1) {
2536
+ const ret = getObject(arg0).openCursor(getObject(arg1));
2537
+ return addHeapObject(ret);
2538
+ }, arguments) };
2539
+ imports.wbg.__wbg_put_22792e17580ca18b = function() { return handleError(function (arg0, arg1, arg2) {
2540
+ const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
2541
+ return addHeapObject(ret);
2542
+ }, arguments) };
2543
+ imports.wbg.__wbg_target_2fc177e386c8b7b0 = function(arg0) {
2544
+ const ret = getObject(arg0).target;
2545
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2546
+ };
2547
+ imports.wbg.__wbg_instanceof_IdbDatabase_db671cf2454a9542 = function(arg0) {
2548
+ let result;
2549
+ try {
2550
+ result = getObject(arg0) instanceof IDBDatabase;
2551
+ } catch (_) {
2552
+ result = false;
2553
+ }
2554
+ const ret = result;
2555
+ return ret;
2556
+ };
2557
+ imports.wbg.__wbg_objectStoreNames_588b5924274239fd = function(arg0) {
2558
+ const ret = getObject(arg0).objectStoreNames;
2559
+ return addHeapObject(ret);
2560
+ };
2561
+ imports.wbg.__wbg_close_6bfe4ca2fe67cb67 = function(arg0) {
2562
+ getObject(arg0).close();
2563
+ };
2564
+ imports.wbg.__wbg_createObjectStore_882f2f6b1b1ef040 = function() { return handleError(function (arg0, arg1, arg2) {
2565
+ const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2));
2566
+ return addHeapObject(ret);
2567
+ }, arguments) };
2568
+ imports.wbg.__wbg_transaction_c32bb10c9c692f4b = function() { return handleError(function (arg0, arg1, arg2) {
2569
+ const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2));
2570
+ return addHeapObject(ret);
2571
+ }, arguments) };
2572
+ imports.wbg.__wbg_transaction_1e282a79e9bb7387 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
2573
+ const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2), takeObject(arg3));
2574
+ return addHeapObject(ret);
2575
+ }, arguments) };
2576
+ imports.wbg.__wbg_length_9ae5daf9a690cba9 = function(arg0) {
2577
+ const ret = getObject(arg0).length;
2578
+ return ret;
2579
+ };
2580
+ imports.wbg.__wbg_contains_c65b44400b549286 = function(arg0, arg1, arg2) {
2581
+ const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
2582
+ return ret;
2583
+ };
2584
+ imports.wbg.__wbg_get_910bbb94abdcf488 = function(arg0, arg1, arg2) {
2585
+ const ret = getObject(arg1)[arg2 >>> 0];
2586
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2587
+ var len1 = WASM_VECTOR_LEN;
2588
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2589
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2590
+ };
2591
+ imports.wbg.__wbg_instanceof_IdbCursorWithValue_abeb44d13d947bc2 = function(arg0) {
2592
+ let result;
2593
+ try {
2594
+ result = getObject(arg0) instanceof IDBCursorWithValue;
2595
+ } catch (_) {
2596
+ result = false;
2597
+ }
2598
+ const ret = result;
2599
+ return ret;
2600
+ };
2601
+ imports.wbg.__wbg_value_86d3334f5075b232 = function() { return handleError(function (arg0) {
2602
+ const ret = getObject(arg0).value;
2603
+ return addHeapObject(ret);
2604
+ }, arguments) };
2605
+ imports.wbg.__wbg_getItem_164e8e5265095b87 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
2606
+ const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
2607
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2608
+ var len1 = WASM_VECTOR_LEN;
2609
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2610
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2611
+ }, arguments) };
2612
+ imports.wbg.__wbg_open_f0d7259fd7e689ce = function() { return handleError(function (arg0, arg1, arg2, arg3) {
2613
+ const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
2614
+ return addHeapObject(ret);
2615
+ }, arguments) };
2616
+ imports.wbg.__wbg_instanceof_IdbOpenDbRequest_3f4a166bc0340578 = function(arg0) {
2617
+ let result;
2618
+ try {
2619
+ result = getObject(arg0) instanceof IDBOpenDBRequest;
2620
+ } catch (_) {
2621
+ result = false;
2622
+ }
2623
+ const ret = result;
2624
+ return ret;
2625
+ };
2626
+ imports.wbg.__wbg_setonupgradeneeded_ad7645373c7d5e1b = function(arg0, arg1) {
2627
+ getObject(arg0).onupgradeneeded = getObject(arg1);
2628
+ };
2629
+ imports.wbg.__wbg_instanceof_IdbRequest_93249da04f5370b6 = function(arg0) {
2630
+ let result;
2631
+ try {
2632
+ result = getObject(arg0) instanceof IDBRequest;
2633
+ } catch (_) {
2634
+ result = false;
2635
+ }
2636
+ const ret = result;
2637
+ return ret;
2638
+ };
2639
+ imports.wbg.__wbg_result_6cedf5f78600a79c = function() { return handleError(function (arg0) {
2640
+ const ret = getObject(arg0).result;
2641
+ return addHeapObject(ret);
2642
+ }, arguments) };
2643
+ imports.wbg.__wbg_error_685b20024dc2d6ca = function() { return handleError(function (arg0) {
2644
+ const ret = getObject(arg0).error;
2645
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2646
+ }, arguments) };
2647
+ imports.wbg.__wbg_setonsuccess_632ce0a1460455c2 = function(arg0, arg1) {
2648
+ getObject(arg0).onsuccess = getObject(arg1);
2649
+ };
2650
+ imports.wbg.__wbg_setonerror_8479b33e7568a904 = function(arg0, arg1) {
2651
+ getObject(arg0).onerror = getObject(arg1);
2652
+ };
2653
+ imports.wbg.__wbg_setoncomplete_d8e4236665cbf1e2 = function(arg0, arg1) {
2654
+ getObject(arg0).oncomplete = getObject(arg1);
2655
+ };
2656
+ imports.wbg.__wbg_setonerror_da071ec94e148397 = function(arg0, arg1) {
2657
+ getObject(arg0).onerror = getObject(arg1);
2658
+ };
2659
+ imports.wbg.__wbg_objectStore_da468793bd9df17b = function() { return handleError(function (arg0, arg1, arg2) {
2660
+ const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
2661
+ return addHeapObject(ret);
2662
+ }, arguments) };
2663
+ imports.wbg.__wbg_continue_f1c3e0815924de62 = function() { return handleError(function (arg0) {
2664
+ getObject(arg0).continue();
2665
+ }, arguments) };
2666
+ imports.wbg.__wbg_only_cacf767244bdc280 = function() { return handleError(function (arg0) {
2667
+ const ret = IDBKeyRange.only(getObject(arg0));
2668
+ return addHeapObject(ret);
2669
+ }, arguments) };
2670
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2671
+ const ret = getObject(arg0) == getObject(arg1);
2672
+ return ret;
2673
+ };
2674
+ imports.wbg.__wbindgen_as_number = function(arg0) {
2675
+ const ret = +getObject(arg0);
2676
+ return ret;
2677
+ };
2678
+ imports.wbg.__wbg_String_389b54bd9d25375f = function(arg0, arg1) {
2679
+ const ret = String(getObject(arg1));
2680
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2681
+ const len1 = WASM_VECTOR_LEN;
2682
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2683
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2684
+ };
2685
+ imports.wbg.__wbg_getwithrefkey_4a92a5eca60879b9 = function(arg0, arg1) {
2686
+ const ret = getObject(arg0)[getObject(arg1)];
2687
+ return addHeapObject(ret);
2688
+ };
2689
+ imports.wbg.__wbg_set_9182712abebf82ef = function(arg0, arg1, arg2) {
2690
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2691
+ };
2692
+ imports.wbg.__wbg_log_28eee4e6432efd24 = function(arg0, arg1) {
2693
+ console.log(getStringFromWasm0(arg0, arg1));
2694
+ };
2695
+ imports.wbg.__wbg_String_55b8bdc4bc243677 = function(arg0, arg1) {
2696
+ const ret = String(getObject(arg1));
2697
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2698
+ const len1 = WASM_VECTOR_LEN;
2699
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2700
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2701
+ };
2702
+ imports.wbg.__wbg_getElementById_8458f2a6c28467dc = function(arg0, arg1, arg2) {
2703
+ const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));
2704
+ return addHeapObject(ret);
2705
+ };
2706
+ imports.wbg.__wbg_settextcontent_fc3ff485b96fcb1d = function(arg0, arg1, arg2) {
2707
+ getObject(arg0).textContent = getStringFromWasm0(arg1, arg2);
2708
+ };
2709
+ imports.wbg.__wbg_wbgtestinvoke_8c20f4132af2bded = function() { return handleError(function (arg0, arg1) {
2710
+ try {
2711
+ var state0 = {a: arg0, b: arg1};
2712
+ var cb0 = () => {
2713
+ const a = state0.a;
2714
+ state0.a = 0;
2715
+ try {
2716
+ return __wbg_adapter_296(a, state0.b, );
2717
+ } finally {
2718
+ state0.a = a;
2719
+ }
2720
+ };
2721
+ __wbg_test_invoke(cb0);
2722
+ } finally {
2723
+ state0.a = state0.b = 0;
2724
+ }
2725
+ }, arguments) };
2726
+ imports.wbg.__wbg_static_accessor_document_d4b6ae7f5578480f = function() {
2727
+ const ret = document;
2728
+ return addHeapObject(ret);
2729
+ };
2730
+ imports.wbg.__wbg_self_55106357ec10ecd4 = function(arg0) {
2731
+ const ret = getObject(arg0).self;
2732
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2733
+ };
2734
+ imports.wbg.__wbg_constructor_fd0d22d60b7dfd72 = function(arg0) {
2735
+ const ret = getObject(arg0).constructor;
2736
+ return addHeapObject(ret);
2737
+ };
2738
+ imports.wbg.__wbg_name_7f439d24ff7ba1d3 = function(arg0, arg1) {
2739
+ const ret = getObject(arg1).name;
2740
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2741
+ const len1 = WASM_VECTOR_LEN;
2742
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2743
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2744
+ };
2745
+ imports.wbg.__wbg_stack_17c77e9f5bfe6714 = function(arg0, arg1) {
2746
+ const ret = getObject(arg1).stack;
2747
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2748
+ const len1 = WASM_VECTOR_LEN;
2749
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2750
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2751
+ };
2752
+ imports.wbg.__wbg_textcontent_67e4e811cbdf00fc = function(arg0, arg1) {
2753
+ const ret = getObject(arg1).textContent;
2754
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2755
+ const len1 = WASM_VECTOR_LEN;
2756
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2757
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2758
+ };
2759
+ imports.wbg.__wbg_stack_44743fb7d71926a0 = function(arg0) {
2760
+ const ret = getObject(arg0).stack;
2761
+ return addHeapObject(ret);
2762
+ };
2763
+ imports.wbg.__wbg_wbgtestoutputwriteln_4db3bd64914ec955 = function(arg0) {
2764
+ __wbg_test_output_writeln(takeObject(arg0));
2765
+ };
2766
+ imports.wbg.__wbg_stack_436273c21658169b = function(arg0) {
2767
+ const ret = getObject(arg0).stack;
2768
+ return addHeapObject(ret);
2769
+ };
2770
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
2771
+ const ret = new Error();
2772
+ return addHeapObject(ret);
2773
+ };
2774
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
2775
+ const ret = getObject(arg1).stack;
2776
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2777
+ const len1 = WASM_VECTOR_LEN;
2778
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2779
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2780
+ };
2781
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
2782
+ let deferred0_0;
2783
+ let deferred0_1;
2784
+ try {
2785
+ deferred0_0 = arg0;
2786
+ deferred0_1 = arg1;
2787
+ console.error(getStringFromWasm0(arg0, arg1));
2788
+ } finally {
2789
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2790
+ }
2791
+ };
2792
+ imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
2793
+ queueMicrotask(getObject(arg0));
2794
+ };
2795
+ imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
2796
+ const ret = getObject(arg0).queueMicrotask;
2797
+ return addHeapObject(ret);
2798
+ };
2799
+ imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
2800
+ const ret = getObject(arg0)[arg1 >>> 0];
2801
+ return addHeapObject(ret);
2802
+ };
2803
+ imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
2804
+ const ret = getObject(arg0).length;
2805
+ return ret;
2806
+ };
2807
+ imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
2808
+ const ret = new Array();
2809
+ return addHeapObject(ret);
2810
+ };
2811
+ imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
2812
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
2813
+ return addHeapObject(ret);
2814
+ };
2815
+ imports.wbg.__wbg_new_d9bc3a0147634640 = function() {
2816
+ const ret = new Map();
2817
+ return addHeapObject(ret);
2818
+ };
2819
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
2820
+ const ret = getObject(arg0).next;
2821
+ return addHeapObject(ret);
2822
+ };
2823
+ imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
2824
+ const ret = getObject(arg0).next();
2825
+ return addHeapObject(ret);
2826
+ }, arguments) };
2827
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
2828
+ const ret = getObject(arg0).done;
2829
+ return ret;
2830
+ };
2831
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
2832
+ const ret = getObject(arg0).value;
2833
+ return addHeapObject(ret);
2834
+ };
2835
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
2836
+ const ret = Symbol.iterator;
2837
+ return addHeapObject(ret);
2838
+ };
2839
+ imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
2840
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
2841
+ return addHeapObject(ret);
2842
+ }, arguments) };
2843
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
2844
+ const ret = getObject(arg0).call(getObject(arg1));
2845
+ return addHeapObject(ret);
2846
+ }, arguments) };
2847
+ imports.wbg.__wbg_new_72fb9a18b5ae2624 = function() {
2848
+ const ret = new Object();
2849
+ return addHeapObject(ret);
2850
+ };
2851
+ imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
2852
+ const ret = self.self;
2853
+ return addHeapObject(ret);
2854
+ }, arguments) };
2855
+ imports.wbg.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
2856
+ const ret = window.window;
2857
+ return addHeapObject(ret);
2858
+ }, arguments) };
2859
+ imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
2860
+ const ret = globalThis.globalThis;
2861
+ return addHeapObject(ret);
2862
+ }, arguments) };
2863
+ imports.wbg.__wbg_global_207b558942527489 = function() { return handleError(function () {
2864
+ const ret = global.global;
2865
+ return addHeapObject(ret);
2866
+ }, arguments) };
2867
+ imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
2868
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2869
+ };
2870
+ imports.wbg.__wbg_from_89e3fc3ba5e6fb48 = function(arg0) {
2871
+ const ret = Array.from(getObject(arg0));
2872
+ return addHeapObject(ret);
2873
+ };
2874
+ imports.wbg.__wbg_forEach_2be8de7347d63332 = function(arg0, arg1, arg2) {
2875
+ try {
2876
+ var state0 = {a: arg1, b: arg2};
2877
+ var cb0 = (arg0, arg1, arg2) => {
2878
+ const a = state0.a;
2879
+ state0.a = 0;
2880
+ try {
2881
+ return __wbg_adapter_339(a, state0.b, arg0, arg1, arg2);
2882
+ } finally {
2883
+ state0.a = a;
2884
+ }
2885
+ };
2886
+ getObject(arg0).forEach(cb0);
2887
+ } finally {
2888
+ state0.a = state0.b = 0;
2889
+ }
2890
+ };
2891
+ imports.wbg.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
2892
+ const ret = Array.isArray(getObject(arg0));
2893
+ return ret;
2894
+ };
2895
+ imports.wbg.__wbg_of_4a2b313a453ec059 = function(arg0) {
2896
+ const ret = Array.of(getObject(arg0));
2897
+ return addHeapObject(ret);
2898
+ };
2899
+ imports.wbg.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
2900
+ const ret = getObject(arg0).push(getObject(arg1));
2901
+ return ret;
2902
+ };
2903
+ imports.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
2904
+ let result;
2905
+ try {
2906
+ result = getObject(arg0) instanceof ArrayBuffer;
2907
+ } catch (_) {
2908
+ result = false;
2909
+ }
2910
+ const ret = result;
2911
+ return ret;
2912
+ };
2913
+ imports.wbg.__wbg_message_5bf28016c2b49cfb = function(arg0) {
2914
+ const ret = getObject(arg0).message;
2915
+ return addHeapObject(ret);
2916
+ };
2917
+ imports.wbg.__wbg_name_e7429f0dda6079e2 = function(arg0) {
2918
+ const ret = getObject(arg0).name;
2919
+ return addHeapObject(ret);
2920
+ };
2921
+ imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
2922
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2923
+ return addHeapObject(ret);
2924
+ }, arguments) };
2925
+ imports.wbg.__wbg_call_938992c832f74314 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2926
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
2927
+ return addHeapObject(ret);
2928
+ }, arguments) };
2929
+ imports.wbg.__wbg_set_8417257aaedc936b = function(arg0, arg1, arg2) {
2930
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2931
+ return addHeapObject(ret);
2932
+ };
2933
+ imports.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2 = function(arg0) {
2934
+ const ret = Number.isSafeInteger(getObject(arg0));
2935
+ return ret;
2936
+ };
2937
+ imports.wbg.__wbg_assign_496d2d14fecafbcf = function(arg0, arg1) {
2938
+ const ret = Object.assign(getObject(arg0), getObject(arg1));
2939
+ return addHeapObject(ret);
2940
+ };
2941
+ imports.wbg.__wbg_entries_95cc2c823b285a09 = function(arg0) {
2942
+ const ret = Object.entries(getObject(arg0));
2943
+ return addHeapObject(ret);
2944
+ };
2945
+ imports.wbg.__wbg_is_010fdc0f4ab96916 = function(arg0, arg1) {
2946
+ const ret = Object.is(getObject(arg0), getObject(arg1));
2947
+ return ret;
2948
+ };
2949
+ imports.wbg.__wbg_keys_91e412b4b222659f = function(arg0) {
2950
+ const ret = Object.keys(getObject(arg0));
2951
+ return addHeapObject(ret);
2952
+ };
2953
+ imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
2954
+ try {
2955
+ var state0 = {a: arg0, b: arg1};
2956
+ var cb0 = (arg0, arg1) => {
2957
+ const a = state0.a;
2958
+ state0.a = 0;
2959
+ try {
2960
+ return __wbg_adapter_390(a, state0.b, arg0, arg1);
2961
+ } finally {
2962
+ state0.a = a;
2963
+ }
2964
+ };
2965
+ const ret = new Promise(cb0);
2966
+ return addHeapObject(ret);
2967
+ } finally {
2968
+ state0.a = state0.b = 0;
2969
+ }
2970
+ };
2971
+ imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
2972
+ const ret = Promise.resolve(getObject(arg0));
2973
+ return addHeapObject(ret);
2974
+ };
2975
+ imports.wbg.__wbg_then_0c86a60e8fcfe9f6 = function(arg0, arg1) {
2976
+ const ret = getObject(arg0).then(getObject(arg1));
2977
+ return addHeapObject(ret);
2978
+ };
2979
+ imports.wbg.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
2980
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
2981
+ return addHeapObject(ret);
2982
+ };
2983
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
2984
+ const ret = getObject(arg0).buffer;
2985
+ return addHeapObject(ret);
2986
+ };
2987
+ imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
2988
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
2989
+ return addHeapObject(ret);
2990
+ };
2991
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
2992
+ const ret = new Uint8Array(getObject(arg0));
2993
+ return addHeapObject(ret);
2994
+ };
2995
+ imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
2996
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
2997
+ };
2998
+ imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
2999
+ const ret = getObject(arg0).length;
3000
+ return ret;
3001
+ };
3002
+ imports.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
3003
+ let result;
3004
+ try {
3005
+ result = getObject(arg0) instanceof Uint8Array;
3006
+ } catch (_) {
3007
+ result = false;
3008
+ }
3009
+ const ret = result;
3010
+ return ret;
3011
+ };
3012
+ imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
3013
+ const ret = new Uint8Array(arg0 >>> 0);
3014
+ return addHeapObject(ret);
3015
+ };
3016
+ imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
3017
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
3018
+ return addHeapObject(ret);
3019
+ };
3020
+ imports.wbg.__wbg_apply_0a5aa603881e6d79 = function() { return handleError(function (arg0, arg1, arg2) {
3021
+ const ret = Reflect.apply(getObject(arg0), getObject(arg1), getObject(arg2));
3022
+ return addHeapObject(ret);
3023
+ }, arguments) };
3024
+ imports.wbg.__wbg_deleteProperty_13e721a56f19e842 = function() { return handleError(function (arg0, arg1) {
3025
+ const ret = Reflect.deleteProperty(getObject(arg0), getObject(arg1));
3026
+ return ret;
3027
+ }, arguments) };
3028
+ imports.wbg.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
3029
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
3030
+ return ret;
3031
+ }, arguments) };
3032
+ imports.wbg.__wbg_parse_66d1801634e099ac = function() { return handleError(function (arg0, arg1) {
3033
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
3034
+ return addHeapObject(ret);
3035
+ }, arguments) };
3036
+ imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
3037
+ const ret = JSON.stringify(getObject(arg0));
3038
+ return addHeapObject(ret);
3039
+ }, arguments) };
3040
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
3041
+ const v = getObject(arg1);
3042
+ const ret = typeof(v) === 'bigint' ? v : undefined;
3043
+ getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
3044
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
3045
+ };
3046
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
3047
+ const ret = debugString(getObject(arg1));
3048
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3049
+ const len1 = WASM_VECTOR_LEN;
3050
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
3051
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
3052
+ };
3053
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
3054
+ throw new Error(getStringFromWasm0(arg0, arg1));
3055
+ };
3056
+ imports.wbg.__wbindgen_memory = function() {
3057
+ const ret = wasm.memory;
3058
+ return addHeapObject(ret);
3059
+ };
3060
+ imports.wbg.__wbindgen_closure_wrapper499 = function(arg0, arg1, arg2) {
3061
+ const ret = makeMutClosure(arg0, arg1, 181, __wbg_adapter_56);
3062
+ return addHeapObject(ret);
3063
+ };
3064
+ imports.wbg.__wbindgen_closure_wrapper501 = function(arg0, arg1, arg2) {
3065
+ const ret = makeClosure(arg0, arg1, 181, __wbg_adapter_59);
3066
+ return addHeapObject(ret);
3067
+ };
3068
+ imports.wbg.__wbindgen_closure_wrapper503 = function(arg0, arg1, arg2) {
3069
+ const ret = makeMutClosure(arg0, arg1, 181, __wbg_adapter_62);
3070
+ return addHeapObject(ret);
3071
+ };
3072
+ imports.wbg.__wbindgen_closure_wrapper1625 = function(arg0, arg1, arg2) {
3073
+ const ret = makeMutClosure(arg0, arg1, 453, __wbg_adapter_65);
3074
+ return addHeapObject(ret);
3075
+ };
3076
+
3077
+ return imports;
3078
+ }
3079
+
3080
+ function __wbg_init_memory(imports, maybe_memory) {
3081
+
3082
+ }
3083
+
3084
+ function __wbg_finalize_init(instance, module) {
3085
+ wasm = instance.exports;
3086
+ __wbg_init.__wbindgen_wasm_module = module;
3087
+ cachedBigInt64Memory0 = null;
3088
+ cachedFloat64Memory0 = null;
3089
+ cachedInt32Memory0 = null;
3090
+ cachedUint32Memory0 = null;
3091
+ cachedUint8Memory0 = null;
3092
+
3093
+ wasm.__wbindgen_start();
3094
+ return wasm;
3095
+ }
3096
+
3097
+ function initSync(module) {
3098
+ if (wasm !== undefined) return wasm;
3099
+
3100
+ const imports = __wbg_get_imports();
3101
+
3102
+ __wbg_init_memory(imports);
3103
+
3104
+ if (!(module instanceof WebAssembly.Module)) {
3105
+ module = new WebAssembly.Module(module);
3106
+ }
3107
+
3108
+ const instance = new WebAssembly.Instance(module, imports);
3109
+
3110
+ return __wbg_finalize_init(instance, module);
3111
+ }
3112
+
3113
+ async function __wbg_init(input) {
3114
+ if (wasm !== undefined) return wasm;
3115
+
3116
+ const imports = __wbg_get_imports();
3117
+
3118
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
3119
+ input = fetch(input);
3120
+ }
3121
+
3122
+ __wbg_init_memory(imports);
3123
+
3124
+ const { instance, module } = await __wbg_load(await input, imports);
3125
+
3126
+ return __wbg_finalize_init(instance, module);
3127
+ }
3128
+
3129
+ export { initSync }
3130
+ export default __wbg_init;