@cereusdb/minimal 0.2.0 → 0.4.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,1290 @@
1
+ import { createEnvImports, createWasiImports, setMemory } from "./env_shim.js?v=emsdk6-20261001-2";
2
+ const __env = createEnvImports();
3
+ const __wasi = createWasiImports();
4
+ /* @ts-self-types="./cereusdb.d.ts" */
5
+
6
+ /**
7
+ * Main CereusDB instance for browser use.
8
+ * Wraps a DataFusion SessionContext with spatial extensions registered.
9
+ */
10
+ export class CereusDB {
11
+ static __wrap(ptr) {
12
+ ptr = ptr >>> 0;
13
+ const obj = Object.create(CereusDB.prototype);
14
+ obj.__wbg_ptr = ptr;
15
+ CereusDBFinalization.register(obj, obj.__wbg_ptr, obj);
16
+ return obj;
17
+ }
18
+ __destroy_into_raw() {
19
+ const ptr = this.__wbg_ptr;
20
+ this.__wbg_ptr = 0;
21
+ CereusDBFinalization.unregister(this);
22
+ return ptr;
23
+ }
24
+ free() {
25
+ const ptr = this.__destroy_into_raw();
26
+ __wbg_termination_guard();
27
+ try {
28
+ wasm.__wbg_cereusdb_free(ptr, 0);
29
+ } catch(e) {
30
+ __wbg_handle_catch(e);
31
+ }
32
+
33
+ }
34
+ /**
35
+ * Create (`create = true`) or attach a persistent database. Returns the
36
+ * database (catalog) name.
37
+ * @param {string} location
38
+ * @param {string | null | undefined} name
39
+ * @param {boolean} create
40
+ * @param {boolean} if_not_exists
41
+ * @returns {Promise<string>}
42
+ */
43
+ attach_database(location, name, create, if_not_exists) {
44
+ const ptr0 = passStringToWasm0(location, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
45
+ const len0 = WASM_VECTOR_LEN;
46
+ var ptr1 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47
+ var len1 = WASM_VECTOR_LEN;
48
+ let ret;
49
+ __wbg_termination_guard();
50
+ try {
51
+ ret = wasm.cereusdb_attach_database(this.__wbg_ptr, ptr0, len0, ptr1, len1, create, if_not_exists);;
52
+ } catch(e) {
53
+ __wbg_handle_catch(e);
54
+ }
55
+ return ret;
56
+ }
57
+ /**
58
+ * Describe all databases, schemas, tables and views as a JSON string.
59
+ * @returns {Promise<string>}
60
+ */
61
+ catalog_json() {
62
+ let ret;
63
+ __wbg_termination_guard();
64
+ try {
65
+ ret = wasm.cereusdb_catalog_json(this.__wbg_ptr);;
66
+ } catch(e) {
67
+ __wbg_handle_catch(e);
68
+ }
69
+ return ret;
70
+ }
71
+ /**
72
+ * Rewrite every table of a persistent database into a single segment.
73
+ * @param {string} name
74
+ * @returns {Promise<void>}
75
+ */
76
+ compact_database(name) {
77
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
+ const len0 = WASM_VECTOR_LEN;
79
+ let ret;
80
+ __wbg_termination_guard();
81
+ try {
82
+ ret = wasm.cereusdb_compact_database(this.__wbg_ptr, ptr0, len0);;
83
+ } catch(e) {
84
+ __wbg_handle_catch(e);
85
+ }
86
+ return ret;
87
+ }
88
+ /**
89
+ * Create a new CereusDB instance.
90
+ * Initializes DataFusion context and registers all spatial functions.
91
+ * @returns {CereusDB}
92
+ */
93
+ static create() {
94
+ let ret;
95
+ __wbg_termination_guard();
96
+ try {
97
+ ret = wasm.cereusdb_create();;
98
+ } catch(e) {
99
+ __wbg_handle_catch(e);
100
+ }
101
+ if (ret[2]) {
102
+ throw takeFromExternrefTable0(ret[1]);
103
+ }
104
+ return CereusDB.__wrap(ret[0]);
105
+ }
106
+ /**
107
+ * Detach a persistent database after writing pending changes.
108
+ * @param {string} name
109
+ * @param {boolean} if_exists
110
+ * @returns {Promise<void>}
111
+ */
112
+ detach_database(name, if_exists) {
113
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
114
+ const len0 = WASM_VECTOR_LEN;
115
+ let ret;
116
+ __wbg_termination_guard();
117
+ try {
118
+ ret = wasm.cereusdb_detach_database(this.__wbg_ptr, ptr0, len0, if_exists);;
119
+ } catch(e) {
120
+ __wbg_handle_catch(e);
121
+ }
122
+ return ret;
123
+ }
124
+ /**
125
+ * Drop a database by name or location URL. Persistent databases are
126
+ * deleted from storage.
127
+ * @param {string} target
128
+ * @param {boolean} if_exists
129
+ * @returns {Promise<void>}
130
+ */
131
+ drop_database(target, if_exists) {
132
+ const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
133
+ const len0 = WASM_VECTOR_LEN;
134
+ let ret;
135
+ __wbg_termination_guard();
136
+ try {
137
+ ret = wasm.cereusdb_drop_database(this.__wbg_ptr, ptr0, len0, if_exists);;
138
+ } catch(e) {
139
+ __wbg_handle_catch(e);
140
+ }
141
+ return ret;
142
+ }
143
+ /**
144
+ * Drop a registered table. Call `flush()` to write the change when the
145
+ * table belongs to a persistent database.
146
+ * @param {string} table_name
147
+ */
148
+ drop_table(table_name) {
149
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
150
+ const len0 = WASM_VECTOR_LEN;
151
+ let ret;
152
+ __wbg_termination_guard();
153
+ try {
154
+ ret = wasm.cereusdb_drop_table(this.__wbg_ptr, ptr0, len0);;
155
+ } catch(e) {
156
+ __wbg_handle_catch(e);
157
+ }
158
+ if (ret[1]) {
159
+ throw takeFromExternrefTable0(ret[0]);
160
+ }
161
+ }
162
+ /**
163
+ * Run a query and encode the result as GeoParquet. `options` may set
164
+ * `compression` and `rowGroupSize`.
165
+ * @param {string} query
166
+ * @param {any} options
167
+ * @returns {Promise<Uint8Array>}
168
+ */
169
+ export_geoparquet(query, options) {
170
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
171
+ const len0 = WASM_VECTOR_LEN;
172
+ let ret;
173
+ __wbg_termination_guard();
174
+ try {
175
+ ret = wasm.cereusdb_export_geoparquet(this.__wbg_ptr, ptr0, len0, options);;
176
+ } catch(e) {
177
+ __wbg_handle_catch(e);
178
+ }
179
+ return ret;
180
+ }
181
+ /**
182
+ * Write all pending changes of attached persistent databases.
183
+ * @returns {Promise<void>}
184
+ */
185
+ flush() {
186
+ let ret;
187
+ __wbg_termination_guard();
188
+ try {
189
+ ret = wasm.cereusdb_flush(this.__wbg_ptr);;
190
+ } catch(e) {
191
+ __wbg_handle_catch(e);
192
+ }
193
+ return ret;
194
+ }
195
+ /**
196
+ * Insert Arrow IPC data (stream or file format) into a table, matching
197
+ * columns by name. Returns the number of inserted rows.
198
+ * @param {string} table_name
199
+ * @param {Uint8Array} data
200
+ * @returns {Promise<number>}
201
+ */
202
+ insert_arrow(table_name, data) {
203
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
204
+ const len0 = WASM_VECTOR_LEN;
205
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
206
+ const len1 = WASM_VECTOR_LEN;
207
+ let ret;
208
+ __wbg_termination_guard();
209
+ try {
210
+ ret = wasm.cereusdb_insert_arrow(this.__wbg_ptr, ptr0, len0, ptr1, len1);;
211
+ } catch(e) {
212
+ __wbg_handle_catch(e);
213
+ }
214
+ return ret;
215
+ }
216
+ /**
217
+ * Database locations stored in the backend for `scheme`, attached or not.
218
+ * @param {string} scheme
219
+ * @returns {Promise<any>}
220
+ */
221
+ list_database_locations(scheme) {
222
+ const ptr0 = passStringToWasm0(scheme, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
223
+ const len0 = WASM_VECTOR_LEN;
224
+ let ret;
225
+ __wbg_termination_guard();
226
+ try {
227
+ ret = wasm.cereusdb_list_database_locations(this.__wbg_ptr, ptr0, len0);;
228
+ } catch(e) {
229
+ __wbg_handle_catch(e);
230
+ }
231
+ return ret;
232
+ }
233
+ /**
234
+ * List all tables and views as `catalog.schema.table`.
235
+ * @returns {any}
236
+ */
237
+ qualified_tables() {
238
+ let ret;
239
+ __wbg_termination_guard();
240
+ try {
241
+ ret = wasm.cereusdb_qualified_tables(this.__wbg_ptr);;
242
+ } catch(e) {
243
+ __wbg_handle_catch(e);
244
+ }
245
+ if (ret[2]) {
246
+ throw takeFromExternrefTable0(ret[1]);
247
+ }
248
+ return takeFromExternrefTable0(ret[0]);
249
+ }
250
+ /**
251
+ * Set the function `(filename, bytes, mimeType)` that receives files
252
+ * written by `COPY ... TO`. `null` removes it.
253
+ * @param {any} handler
254
+ */
255
+ register_export_handler(handler) {
256
+ let ret;
257
+ __wbg_termination_guard();
258
+ try {
259
+ ret = wasm.cereusdb_register_export_handler(this.__wbg_ptr, handler);;
260
+ } catch(e) {
261
+ __wbg_handle_catch(e);
262
+ }
263
+ if (ret[1]) {
264
+ throw takeFromExternrefTable0(ret[0]);
265
+ }
266
+ }
267
+ /**
268
+ * Register a GeoJSON string as a named table.
269
+ * @param {string} table_name
270
+ * @param {string} geojson
271
+ */
272
+ register_geojson(table_name, geojson) {
273
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
274
+ const len0 = WASM_VECTOR_LEN;
275
+ const ptr1 = passStringToWasm0(geojson, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
+ const len1 = WASM_VECTOR_LEN;
277
+ let ret;
278
+ __wbg_termination_guard();
279
+ try {
280
+ ret = wasm.cereusdb_register_geojson(this.__wbg_ptr, ptr0, len0, ptr1, len1);;
281
+ } catch(e) {
282
+ __wbg_handle_catch(e);
283
+ }
284
+ if (ret[1]) {
285
+ throw takeFromExternrefTable0(ret[0]);
286
+ }
287
+ }
288
+ /**
289
+ * Register a GeoTIFF buffer as a single-column raster table.
290
+ * Requires the full GDAL-enabled build.
291
+ * @param {string} table_name
292
+ * @param {Uint8Array} data
293
+ */
294
+ register_geotiff_buffer(table_name, data) {
295
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
296
+ const len0 = WASM_VECTOR_LEN;
297
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
298
+ const len1 = WASM_VECTOR_LEN;
299
+ let ret;
300
+ __wbg_termination_guard();
301
+ try {
302
+ ret = wasm.cereusdb_register_geotiff_buffer(this.__wbg_ptr, ptr0, len0, ptr1, len1);;
303
+ } catch(e) {
304
+ __wbg_handle_catch(e);
305
+ }
306
+ if (ret[1]) {
307
+ throw takeFromExternrefTable0(ret[0]);
308
+ }
309
+ }
310
+ /**
311
+ * Register browser-backed object stores for ranged/listing reads.
312
+ * @param {any} config
313
+ */
314
+ register_object_stores(config) {
315
+ let ret;
316
+ __wbg_termination_guard();
317
+ try {
318
+ ret = wasm.cereusdb_register_object_stores(this.__wbg_ptr, config);;
319
+ } catch(e) {
320
+ __wbg_handle_catch(e);
321
+ }
322
+ if (ret[1]) {
323
+ throw takeFromExternrefTable0(ret[0]);
324
+ }
325
+ }
326
+ /**
327
+ * Register a Uint8Array containing Parquet data as a named table.
328
+ * Use for files obtained via the browser File API.
329
+ * @param {string} table_name
330
+ * @param {Uint8Array} data
331
+ * @returns {Promise<void>}
332
+ */
333
+ register_parquet_buffer(table_name, data) {
334
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
337
+ const len1 = WASM_VECTOR_LEN;
338
+ let ret;
339
+ __wbg_termination_guard();
340
+ try {
341
+ ret = wasm.cereusdb_register_parquet_buffer(this.__wbg_ptr, ptr0, len0, ptr1, len1);;
342
+ } catch(e) {
343
+ __wbg_handle_catch(e);
344
+ }
345
+ return ret;
346
+ }
347
+ /**
348
+ * Register a remote Parquet object or prefix as a DataFusion listing table.
349
+ * @param {string} table_name
350
+ * @param {string} table_url
351
+ * @param {any} options
352
+ * @returns {Promise<void>}
353
+ */
354
+ register_parquet_table(table_name, table_url, options) {
355
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
356
+ const len0 = WASM_VECTOR_LEN;
357
+ const ptr1 = passStringToWasm0(table_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
358
+ const len1 = WASM_VECTOR_LEN;
359
+ let ret;
360
+ __wbg_termination_guard();
361
+ try {
362
+ ret = wasm.cereusdb_register_parquet_table(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);;
363
+ } catch(e) {
364
+ __wbg_handle_catch(e);
365
+ }
366
+ return ret;
367
+ }
368
+ /**
369
+ * Register a raster buffer as a single-column raster table.
370
+ * Requires the full GDAL-enabled build.
371
+ * @param {string} table_name
372
+ * @param {string} format
373
+ * @param {Uint8Array} data
374
+ */
375
+ register_raster_buffer(table_name, format, data) {
376
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
377
+ const len0 = WASM_VECTOR_LEN;
378
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
379
+ const len1 = WASM_VECTOR_LEN;
380
+ const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
381
+ const len2 = WASM_VECTOR_LEN;
382
+ let ret;
383
+ __wbg_termination_guard();
384
+ try {
385
+ ret = wasm.cereusdb_register_raster_buffer(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);;
386
+ } catch(e) {
387
+ __wbg_handle_catch(e);
388
+ }
389
+ if (ret[1]) {
390
+ throw takeFromExternrefTable0(ret[0]);
391
+ }
392
+ }
393
+ /**
394
+ * Register a remote Parquet file URL as a named table.
395
+ * Pre-fetches the entire file via HTTP, then loads into memory.
396
+ * The server must support CORS.
397
+ * @param {string} table_name
398
+ * @param {string} url
399
+ * @returns {Promise<void>}
400
+ */
401
+ register_remote_parquet(table_name, url) {
402
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
403
+ const len0 = WASM_VECTOR_LEN;
404
+ const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
405
+ const len1 = WASM_VECTOR_LEN;
406
+ let ret;
407
+ __wbg_termination_guard();
408
+ try {
409
+ ret = wasm.cereusdb_register_remote_parquet(this.__wbg_ptr, ptr0, len0, ptr1, len1);;
410
+ } catch(e) {
411
+ __wbg_handle_catch(e);
412
+ }
413
+ return ret;
414
+ }
415
+ /**
416
+ * Register the storage backend used for database locations with the given
417
+ * URL scheme (for example `opfs`).
418
+ * @param {string} scheme
419
+ * @param {any} backend
420
+ */
421
+ register_storage_backend(scheme, backend) {
422
+ const ptr0 = passStringToWasm0(scheme, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ let ret;
425
+ __wbg_termination_guard();
426
+ try {
427
+ ret = wasm.cereusdb_register_storage_backend(this.__wbg_ptr, ptr0, len0, backend);;
428
+ } catch(e) {
429
+ __wbg_handle_catch(e);
430
+ }
431
+ if (ret[1]) {
432
+ throw takeFromExternrefTable0(ret[0]);
433
+ }
434
+ }
435
+ /**
436
+ * Execute a SQL query.
437
+ * Returns results as Arrow IPC bytes (Uint8Array).
438
+ * The caller can decode this with the apache-arrow JS library.
439
+ * @param {string} query
440
+ * @returns {Promise<Uint8Array>}
441
+ */
442
+ sql(query) {
443
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
444
+ const len0 = WASM_VECTOR_LEN;
445
+ let ret;
446
+ __wbg_termination_guard();
447
+ try {
448
+ ret = wasm.cereusdb_sql(this.__wbg_ptr, ptr0, len0);;
449
+ } catch(e) {
450
+ __wbg_handle_catch(e);
451
+ }
452
+ return ret;
453
+ }
454
+ /**
455
+ * Execute a SQL query and return results as a JSON string.
456
+ * Convenience method for simple use cases.
457
+ * @param {string} query
458
+ * @returns {Promise<string>}
459
+ */
460
+ sql_json(query) {
461
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
462
+ const len0 = WASM_VECTOR_LEN;
463
+ let ret;
464
+ __wbg_termination_guard();
465
+ try {
466
+ ret = wasm.cereusdb_sql_json(this.__wbg_ptr, ptr0, len0);;
467
+ } catch(e) {
468
+ __wbg_handle_catch(e);
469
+ }
470
+ return ret;
471
+ }
472
+ /**
473
+ * List all registered table names.
474
+ * @returns {any}
475
+ */
476
+ tables() {
477
+ let ret;
478
+ __wbg_termination_guard();
479
+ try {
480
+ ret = wasm.cereusdb_tables(this.__wbg_ptr);;
481
+ } catch(e) {
482
+ __wbg_handle_catch(e);
483
+ }
484
+ if (ret[2]) {
485
+ throw takeFromExternrefTable0(ret[1]);
486
+ }
487
+ return takeFromExternrefTable0(ret[0]);
488
+ }
489
+ /**
490
+ * Get version information.
491
+ *
492
+ * Release builds set `CEREUSDB_VERSION` to the full npm version, including
493
+ * prerelease suffixes; other builds fall back to the crate version.
494
+ * @returns {string}
495
+ */
496
+ version() {
497
+ let deferred1_0;
498
+ let deferred1_1;
499
+ try {
500
+ let ret;
501
+ __wbg_termination_guard();
502
+ try {
503
+ ret = wasm.cereusdb_version(this.__wbg_ptr);;
504
+ } catch(e) {
505
+ __wbg_handle_catch(e);
506
+ }
507
+ deferred1_0 = ret[0];
508
+ deferred1_1 = ret[1];
509
+ return getStringFromWasm0(ret[0], ret[1]);
510
+ } finally {
511
+ __wbg_termination_guard();
512
+ try {
513
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
514
+ } catch(e) {
515
+ __wbg_handle_catch(e);
516
+ }
517
+ }
518
+ }
519
+ }
520
+ if (Symbol.dispose) CereusDB.prototype[Symbol.dispose] = CereusDB.prototype.free;
521
+ const import1 = __env;
522
+ const import2 = __env;
523
+ const import3 = __env;
524
+ const import4 = __env;
525
+ const import5 = __env;
526
+ const import6 = __wasi;
527
+ const import7 = __wasi;
528
+ const import8 = __env;
529
+ const import9 = __wasi;
530
+
531
+ function __wbg_get_imports() {
532
+ const import0 = {
533
+ __proto__: null,
534
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
535
+ const ret = Error(getStringFromWasm0(arg0, arg1));
536
+ return ret;
537
+ },
538
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
539
+ const ret = Number(arg0);
540
+ return ret;
541
+ },
542
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
543
+ const ret = String(arg1);
544
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
545
+ const len1 = WASM_VECTOR_LEN;
546
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
547
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
548
+ },
549
+ __wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
550
+ const v = arg1;
551
+ const ret = typeof(v) === 'bigint' ? v : undefined;
552
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
553
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
554
+ },
555
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
556
+ const v = arg0;
557
+ const ret = typeof(v) === 'boolean' ? v : undefined;
558
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
559
+ },
560
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
561
+ const ret = debugString(arg1);
562
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
563
+ const len1 = WASM_VECTOR_LEN;
564
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
565
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
566
+ },
567
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
568
+ const ret = arg0 in arg1;
569
+ return ret;
570
+ },
571
+ __wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
572
+ const ret = typeof(arg0) === 'bigint';
573
+ return ret;
574
+ },
575
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
576
+ const ret = typeof(arg0) === 'function';
577
+ return ret;
578
+ },
579
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
580
+ const ret = arg0 === null;
581
+ return ret;
582
+ },
583
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
584
+ const val = arg0;
585
+ const ret = typeof(val) === 'object' && val !== null;
586
+ return ret;
587
+ },
588
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
589
+ const ret = arg0 === undefined;
590
+ return ret;
591
+ },
592
+ __wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
593
+ const ret = arg0 === arg1;
594
+ return ret;
595
+ },
596
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
597
+ const ret = arg0 == arg1;
598
+ return ret;
599
+ },
600
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
601
+ const obj = arg1;
602
+ const ret = typeof(obj) === 'number' ? obj : undefined;
603
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
604
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
605
+ },
606
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
607
+ const obj = arg1;
608
+ const ret = typeof(obj) === 'string' ? obj : undefined;
609
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
610
+ var len1 = WASM_VECTOR_LEN;
611
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
612
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
613
+ },
614
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
615
+ throw new WebAssembly.Exception(__wbindgen_wrapped_jstag, [new Error(getStringFromWasm0(arg0, arg1))]);
616
+ },
617
+ __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
618
+ arg0._wbg_cb_unref();
619
+ },
620
+ __wbg_apply_ac9afb97ca32f169: function(arg0, arg1, arg2) {
621
+ const ret = arg0.apply(arg1, arg2);
622
+ return ret;
623
+ },
624
+ __wbg_arrayBuffer_eb8e9ca620af2a19: function(arg0) {
625
+ const ret = arg0.arrayBuffer();
626
+ return ret;
627
+ },
628
+ __wbg_call_2d781c1f4d5c0ef8: function(arg0, arg1, arg2) {
629
+ const ret = arg0.call(arg1, arg2);
630
+ return ret;
631
+ },
632
+ __wbg_call_f858478a02f9600f: function(arg0, arg1, arg2, arg3, arg4) {
633
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
634
+ return ret;
635
+ },
636
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
637
+ let deferred0_0;
638
+ let deferred0_1;
639
+ try {
640
+ deferred0_0 = arg0;
641
+ deferred0_1 = arg1;
642
+ console.error(getStringFromWasm0(arg0, arg1));
643
+ } finally {
644
+ __wbg_termination_guard();
645
+ try {
646
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
647
+ } catch(e) {
648
+ __wbg_handle_catch(e);
649
+ }
650
+ }
651
+ },
652
+ __wbg_fetch_5550a88cf343aaa9: function(arg0, arg1) {
653
+ const ret = arg0.fetch(arg1);
654
+ return ret;
655
+ },
656
+ __wbg_fetch_f8a611684c3b5fe5: function(arg0, arg1) {
657
+ const ret = arg0.fetch(arg1);
658
+ return ret;
659
+ },
660
+ __wbg_from_4bdf88943703fd48: function(arg0) {
661
+ const ret = Array.from(arg0);
662
+ return ret;
663
+ },
664
+ __wbg_getRandomValues_3f44b700395062e5: function(arg0, arg1) {
665
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
666
+ },
667
+ __wbg_getRandomValues_a1cf2e70b003a59d: function(arg0, arg1) {
668
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
669
+ },
670
+ __wbg_getTime_1dad7b5386ddd2d9: function(arg0) {
671
+ const ret = arg0.getTime();
672
+ return ret;
673
+ },
674
+ __wbg_get_3ef1eba1850ade27: function(arg0, arg1) {
675
+ const ret = Reflect.get(arg0, arg1);
676
+ return ret;
677
+ },
678
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
679
+ const ret = arg0[arg1 >>> 0];
680
+ return ret;
681
+ },
682
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
683
+ const ret = arg0[arg1];
684
+ return ret;
685
+ },
686
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
687
+ let result;
688
+ try {
689
+ result = arg0 instanceof ArrayBuffer;
690
+ } catch (_) {
691
+ result = false;
692
+ }
693
+ const ret = result;
694
+ return ret;
695
+ },
696
+ __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
697
+ let result;
698
+ try {
699
+ result = arg0 instanceof Response;
700
+ } catch (_) {
701
+ result = false;
702
+ }
703
+ const ret = result;
704
+ return ret;
705
+ },
706
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
707
+ let result;
708
+ try {
709
+ result = arg0 instanceof Uint8Array;
710
+ } catch (_) {
711
+ result = false;
712
+ }
713
+ const ret = result;
714
+ return ret;
715
+ },
716
+ __wbg_instanceof_Window_23e677d2c6843922: function(arg0) {
717
+ let result;
718
+ try {
719
+ result = arg0 instanceof Window;
720
+ } catch (_) {
721
+ result = false;
722
+ }
723
+ const ret = result;
724
+ return ret;
725
+ },
726
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
727
+ const ret = Array.isArray(arg0);
728
+ return ret;
729
+ },
730
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
731
+ const ret = Number.isSafeInteger(arg0);
732
+ return ret;
733
+ },
734
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
735
+ const ret = arg0.length;
736
+ return ret;
737
+ },
738
+ __wbg_length_ea16607d7b61445b: function(arg0) {
739
+ const ret = arg0.length;
740
+ return ret;
741
+ },
742
+ __wbg_log_524eedafa26daa59: function(arg0) {
743
+ console.log(arg0);
744
+ },
745
+ __wbg_new_0_1dcafdf5e786e876: function() {
746
+ const ret = new Date();
747
+ return ret;
748
+ },
749
+ __wbg_new_227d7c05414eb861: function() {
750
+ const ret = new Error();
751
+ return ret;
752
+ },
753
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
754
+ const ret = new Uint8Array(arg0);
755
+ return ret;
756
+ },
757
+ __wbg_new_a70fbab9066b301f: function() {
758
+ const ret = new Array();
759
+ return ret;
760
+ },
761
+ __wbg_new_ab79df5bd7c26067: function() {
762
+ const ret = new Object();
763
+ return ret;
764
+ },
765
+ __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
766
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
767
+ return ret;
768
+ },
769
+ __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
770
+ try {
771
+ var state0 = {a: arg0, b: arg1};
772
+ var cb0 = (arg0, arg1) => {
773
+ const a = state0.a;
774
+ state0.a = 0;
775
+ try {
776
+ return wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(a, state0.b, arg0, arg1);
777
+ } finally {
778
+ state0.a = a;
779
+ }
780
+ };
781
+ const ret = new Promise(cb0);
782
+ return ret;
783
+ } finally {
784
+ state0.a = state0.b = 0;
785
+ }
786
+ },
787
+ __wbg_new_typed_bccac67128ed885a: function() {
788
+ const ret = new Array();
789
+ return ret;
790
+ },
791
+ __wbg_new_with_length_825018a1616e9e55: function(arg0) {
792
+ const ret = new Uint8Array(arg0 >>> 0);
793
+ return ret;
794
+ },
795
+ __wbg_new_with_str_and_init_b4b54d1a819bc724: function(arg0, arg1, arg2) {
796
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
797
+ return ret;
798
+ },
799
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
800
+ const ret = arg0.now();
801
+ return ret;
802
+ },
803
+ __wbg_ok_7ec8b94facac7704: function(arg0) {
804
+ const ret = arg0.ok;
805
+ return ret;
806
+ },
807
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
808
+ const ret = arg0.performance;
809
+ return ret;
810
+ },
811
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
812
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
813
+ },
814
+ __wbg_push_e87b0e732085a946: function(arg0, arg1) {
815
+ const ret = arg0.push(arg1);
816
+ return ret;
817
+ },
818
+ __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
819
+ const ret = arg0.queueMicrotask;
820
+ return ret;
821
+ },
822
+ __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
823
+ queueMicrotask(arg0);
824
+ },
825
+ __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
826
+ const ret = Promise.resolve(arg0);
827
+ return ret;
828
+ },
829
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
830
+ arg0[arg1 >>> 0] = arg2;
831
+ },
832
+ __wbg_set_8c0b3ffcf05d61c2: function(arg0, arg1, arg2) {
833
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
834
+ },
835
+ __wbg_set_method_8c015e8bcafd7be1: function(arg0, arg1, arg2) {
836
+ arg0.method = getStringFromWasm0(arg1, arg2);
837
+ },
838
+ __wbg_set_mode_5a87f2c809cf37c2: function(arg0, arg1) {
839
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
840
+ },
841
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
842
+ const ret = arg1.stack;
843
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
844
+ const len1 = WASM_VECTOR_LEN;
845
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
846
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
847
+ },
848
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
849
+ const ret = typeof global === 'undefined' ? null : global;
850
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
851
+ },
852
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
853
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
854
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
855
+ },
856
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
857
+ const ret = typeof self === 'undefined' ? null : self;
858
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
859
+ },
860
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
861
+ const ret = typeof window === 'undefined' ? null : window;
862
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
863
+ },
864
+ __wbg_status_318629ab93a22955: function(arg0) {
865
+ const ret = arg0.status;
866
+ return ret;
867
+ },
868
+ __wbg_then_098abe61755d12f6: function(arg0, arg1) {
869
+ const ret = arg0.then(arg1);
870
+ return ret;
871
+ },
872
+ __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
873
+ const ret = arg0.then(arg1, arg2);
874
+ return ret;
875
+ },
876
+ __wbg_warn_69424c2d92a2fa73: function(arg0) {
877
+ console.warn(arg0);
878
+ },
879
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
880
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 4167, function: Function { arguments: [Externref], shim_idx: 20855, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
881
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8db467765ce434ac, wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504);
882
+ return ret;
883
+ },
884
+ __wbindgen_cast_0000000000000002: function(arg0) {
885
+ // Cast intrinsic for `F64 -> Externref`.
886
+ const ret = arg0;
887
+ return ret;
888
+ },
889
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
890
+ // Cast intrinsic for `Ref(String) -> Externref`.
891
+ const ret = getStringFromWasm0(arg0, arg1);
892
+ return ret;
893
+ },
894
+ __wbindgen_cast_0000000000000004: function(arg0) {
895
+ // Cast intrinsic for `U64 -> Externref`.
896
+ const ret = BigInt.asUintN(64, arg0);
897
+ return ret;
898
+ },
899
+ __wbindgen_init_externref_table: function() {
900
+ const table = wasm.__wbindgen_externrefs;
901
+ const offset = table.grow(4);
902
+ table.set(0, undefined);
903
+ table.set(offset + 0, undefined);
904
+ table.set(offset + 1, null);
905
+ table.set(offset + 2, true);
906
+ table.set(offset + 3, false);
907
+ },
908
+ __wbindgen_jstag: WebAssembly.JSTag,
909
+ __wbindgen_wrapped_jstag: __wbindgen_wrapped_jstag,
910
+ };
911
+ return {
912
+ __proto__: null,
913
+ "./cereusdb_bg.js": import0,
914
+ "env": import1,
915
+ "env": import2,
916
+ "env": import3,
917
+ "env": import4,
918
+ "env": import5,
919
+ "wasi_snapshot_preview1": import6,
920
+ "wasi_snapshot_preview1": import7,
921
+ "env": import8,
922
+ "wasi_snapshot_preview1": import9,
923
+ };
924
+ }
925
+
926
+ const __wbindgen_wrapped_jstag = new WebAssembly.Tag({ parameters: ['externref'] });
927
+
928
+
929
+ let __wbg_terminated_addr;
930
+
931
+
932
+ function __wbg_termination_guard() {
933
+ __wbg_terminated_addr ??= wasm.__instance_terminated.value / 4;
934
+ if (getInt32ArrayMemory0()[__wbg_terminated_addr]) {
935
+ throw new Error('Module terminated');
936
+ }
937
+ }
938
+
939
+
940
+ function __wbg_handle_catch(e) {
941
+ if (e instanceof WebAssembly.Exception && e.is(__wbindgen_wrapped_jstag)) {
942
+ throw e.getArg(__wbindgen_wrapped_jstag, 0);
943
+ }
944
+ getInt32ArrayMemory0()[__wbg_terminated_addr] = 1;
945
+ throw e;
946
+ }
947
+ function wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504(arg0, arg1, arg2) {
948
+ let ret;
949
+ __wbg_termination_guard();
950
+ try {
951
+ ret = wasm.wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504(arg0, arg1, arg2);;
952
+ } catch(e) {
953
+ __wbg_handle_catch(e);
954
+ }
955
+ if (ret[1]) {
956
+ throw takeFromExternrefTable0(ret[0]);
957
+ }
958
+ }
959
+
960
+ function wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(arg0, arg1, arg2, arg3) {
961
+ __wbg_termination_guard();
962
+ try {
963
+ wasm.wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(arg0, arg1, arg2, arg3);
964
+ } catch(e) {
965
+ __wbg_handle_catch(e);
966
+ }
967
+ }
968
+
969
+
970
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
971
+ const CereusDBFinalization = (typeof FinalizationRegistry === 'undefined')
972
+ ? { register: () => {}, unregister: () => {} }
973
+ : new FinalizationRegistry(ptr => wasm.__wbg_cereusdb_free(ptr >>> 0, 1));
974
+
975
+ function addToExternrefTable0(obj) {
976
+ const idx = wasm.__externref_table_alloc();
977
+ wasm.__wbindgen_externrefs.set(idx, obj);
978
+ return idx;
979
+ }
980
+
981
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
982
+ ? { register: () => {}, unregister: () => {} }
983
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
984
+
985
+ function debugString(val) {
986
+ // primitive types
987
+ const type = typeof val;
988
+ if (type == 'number' || type == 'boolean' || val == null) {
989
+ return `${val}`;
990
+ }
991
+ if (type == 'string') {
992
+ return `"${val}"`;
993
+ }
994
+ if (type == 'symbol') {
995
+ const description = val.description;
996
+ if (description == null) {
997
+ return 'Symbol';
998
+ } else {
999
+ return `Symbol(${description})`;
1000
+ }
1001
+ }
1002
+ if (type == 'function') {
1003
+ const name = val.name;
1004
+ if (typeof name == 'string' && name.length > 0) {
1005
+ return `Function(${name})`;
1006
+ } else {
1007
+ return 'Function';
1008
+ }
1009
+ }
1010
+ // objects
1011
+ if (Array.isArray(val)) {
1012
+ const length = val.length;
1013
+ let debug = '[';
1014
+ if (length > 0) {
1015
+ debug += debugString(val[0]);
1016
+ }
1017
+ for(let i = 1; i < length; i++) {
1018
+ debug += ', ' + debugString(val[i]);
1019
+ }
1020
+ debug += ']';
1021
+ return debug;
1022
+ }
1023
+ // Test for built-in
1024
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1025
+ let className;
1026
+ if (builtInMatches && builtInMatches.length > 1) {
1027
+ className = builtInMatches[1];
1028
+ } else {
1029
+ // Failed to match the standard '[object ClassName]'
1030
+ return toString.call(val);
1031
+ }
1032
+ if (className == 'Object') {
1033
+ // we're a user defined class or Object
1034
+ // JSON.stringify avoids problems with cycles, and is generally much
1035
+ // easier than looping through ownProperties of `val`.
1036
+ try {
1037
+ return 'Object(' + JSON.stringify(val) + ')';
1038
+ } catch (_) {
1039
+ return 'Object';
1040
+ }
1041
+ }
1042
+ // errors
1043
+ if (val instanceof Error) {
1044
+ return `${val.name}: ${val.message}\n${val.stack}`;
1045
+ }
1046
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1047
+ return className;
1048
+ }
1049
+
1050
+ function getArrayU8FromWasm0(ptr, len) {
1051
+ ptr = ptr >>> 0;
1052
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1053
+ }
1054
+
1055
+ let cachedDataViewMemory0 = null;
1056
+ function getDataViewMemory0() {
1057
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1058
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1059
+ }
1060
+ return cachedDataViewMemory0;
1061
+ }
1062
+
1063
+ let cachedInt32ArrayMemory0 = null;
1064
+ function getInt32ArrayMemory0() {
1065
+ if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
1066
+ cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
1067
+ }
1068
+ return cachedInt32ArrayMemory0;
1069
+ }
1070
+
1071
+ function getStringFromWasm0(ptr, len) {
1072
+ ptr = ptr >>> 0;
1073
+ return decodeText(ptr, len);
1074
+ }
1075
+
1076
+ let cachedUint8ArrayMemory0 = null;
1077
+ function getUint8ArrayMemory0() {
1078
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1079
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1080
+ }
1081
+ return cachedUint8ArrayMemory0;
1082
+ }
1083
+
1084
+ function isLikeNone(x) {
1085
+ return x === undefined || x === null;
1086
+ }
1087
+
1088
+ function makeMutClosure(arg0, arg1, dtor, f) {
1089
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1090
+ const real = (...args) => {
1091
+
1092
+ // First up with a closure we increment the internal reference
1093
+ // count. This ensures that the Rust closure environment won't
1094
+ // be deallocated while we're invoking it.
1095
+ state.cnt++;
1096
+ const a = state.a;
1097
+ state.a = 0;
1098
+ try {
1099
+ return f(a, state.b, ...args);
1100
+ } finally {
1101
+ state.a = a;
1102
+ real._wbg_cb_unref();
1103
+ }
1104
+ };
1105
+ real._wbg_cb_unref = () => {
1106
+ if (--state.cnt === 0) {
1107
+ state.dtor(state.a, state.b);
1108
+ state.a = 0;
1109
+ CLOSURE_DTORS.unregister(state);
1110
+ }
1111
+ };
1112
+ CLOSURE_DTORS.register(real, state, state);
1113
+ return real;
1114
+ }
1115
+
1116
+ function passArray8ToWasm0(arg, malloc) {
1117
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1118
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1119
+ WASM_VECTOR_LEN = arg.length;
1120
+ return ptr;
1121
+ }
1122
+
1123
+ function passStringToWasm0(arg, malloc, realloc) {
1124
+ if (realloc === undefined) {
1125
+ const buf = cachedTextEncoder.encode(arg);
1126
+ const ptr = malloc(buf.length, 1) >>> 0;
1127
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1128
+ WASM_VECTOR_LEN = buf.length;
1129
+ return ptr;
1130
+ }
1131
+
1132
+ let len = arg.length;
1133
+ let ptr = malloc(len, 1) >>> 0;
1134
+
1135
+ const mem = getUint8ArrayMemory0();
1136
+
1137
+ let offset = 0;
1138
+
1139
+ for (; offset < len; offset++) {
1140
+ const code = arg.charCodeAt(offset);
1141
+ if (code > 0x7F) break;
1142
+ mem[ptr + offset] = code;
1143
+ }
1144
+ if (offset !== len) {
1145
+ if (offset !== 0) {
1146
+ arg = arg.slice(offset);
1147
+ }
1148
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1149
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1150
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1151
+
1152
+ offset += ret.written;
1153
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1154
+ }
1155
+
1156
+ WASM_VECTOR_LEN = offset;
1157
+ return ptr;
1158
+ }
1159
+
1160
+ function takeFromExternrefTable0(idx) {
1161
+ const value = wasm.__wbindgen_externrefs.get(idx);
1162
+ wasm.__externref_table_dealloc(idx);
1163
+ return value;
1164
+ }
1165
+
1166
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1167
+ cachedTextDecoder.decode();
1168
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1169
+ let numBytesDecoded = 0;
1170
+ function decodeText(ptr, len) {
1171
+ numBytesDecoded += len;
1172
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1173
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1174
+ cachedTextDecoder.decode();
1175
+ numBytesDecoded = len;
1176
+ }
1177
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1178
+ }
1179
+
1180
+ const cachedTextEncoder = new TextEncoder();
1181
+
1182
+ if (!('encodeInto' in cachedTextEncoder)) {
1183
+ cachedTextEncoder.encodeInto = function (arg, view) {
1184
+ const buf = cachedTextEncoder.encode(arg);
1185
+ view.set(buf);
1186
+ return {
1187
+ read: arg.length,
1188
+ written: buf.length
1189
+ };
1190
+ };
1191
+ }
1192
+
1193
+ let WASM_VECTOR_LEN = 0;
1194
+
1195
+ let wasmModule, wasm;
1196
+ function __wbg_finalize_init(instance, module) {
1197
+ wasm = instance.exports;
1198
+ wasmModule = module;
1199
+ cachedDataViewMemory0 = null;
1200
+ cachedInt32ArrayMemory0 = null;
1201
+ cachedUint8ArrayMemory0 = null;
1202
+ if (typeof wasm.__wasm_call_ctors === "function") wasm.__wasm_call_ctors();
1203
+ wasm.__wbindgen_start();
1204
+ return wasm;
1205
+ }
1206
+
1207
+ async function __wbg_load(module, imports) {
1208
+ if (typeof Response === 'function' && module instanceof Response) {
1209
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1210
+ try {
1211
+ return await WebAssembly.instantiateStreaming(module, imports);
1212
+ } catch (e) {
1213
+ const validResponse = module.ok && expectedResponseType(module.type);
1214
+
1215
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1216
+ 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);
1217
+
1218
+ } else { throw e; }
1219
+ }
1220
+ }
1221
+
1222
+ const bytes = await module.arrayBuffer();
1223
+ return await WebAssembly.instantiate(bytes, imports);
1224
+ } else {
1225
+ const instance = await WebAssembly.instantiate(module, imports);
1226
+
1227
+ if (instance instanceof WebAssembly.Instance) {
1228
+ return { instance, module };
1229
+ } else {
1230
+ return instance;
1231
+ }
1232
+ }
1233
+
1234
+ function expectedResponseType(type) {
1235
+ switch (type) {
1236
+ case 'basic': case 'cors': case 'default': return true;
1237
+ }
1238
+ return false;
1239
+ }
1240
+ }
1241
+
1242
+ function initSync(module) {
1243
+ if (wasm !== undefined) return wasm;
1244
+
1245
+
1246
+ if (module !== undefined) {
1247
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1248
+ ({module} = module)
1249
+ } else {
1250
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1251
+ }
1252
+ }
1253
+
1254
+ const imports = __wbg_get_imports();
1255
+ if (!(module instanceof WebAssembly.Module)) {
1256
+ module = new WebAssembly.Module(module);
1257
+ }
1258
+ const instance = new WebAssembly.Instance(module, imports);
1259
+ if (instance.exports && instance.exports.memory) setMemory(instance.exports.memory);
1260
+ return __wbg_finalize_init(instance, module);
1261
+ }
1262
+
1263
+ async function __wbg_init(module_or_path) {
1264
+ if (wasm !== undefined) return wasm;
1265
+
1266
+
1267
+ if (module_or_path !== undefined) {
1268
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1269
+ ({module_or_path} = module_or_path)
1270
+ } else {
1271
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1272
+ }
1273
+ }
1274
+
1275
+ if (module_or_path === undefined) {
1276
+ throw new Error('@cereusdb external entry requires CereusDB.create({ wasmUrl }) or CereusDB.create({ wasmSource })');
1277
+ }
1278
+ const imports = __wbg_get_imports();
1279
+
1280
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1281
+ module_or_path = fetch(module_or_path);
1282
+ }
1283
+
1284
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1285
+
1286
+ if (instance.exports && instance.exports.memory) setMemory(instance.exports.memory);
1287
+ return __wbg_finalize_init(instance, module);
1288
+ }
1289
+
1290
+ export { initSync, __wbg_init as default };