ducjs 3.5.1 → 4.0.1

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.
@@ -182,6 +182,40 @@ function debugString(val) {
182
182
  return className;
183
183
  }
184
184
 
185
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
186
+ ? { register: () => {}, unregister: () => {} }
187
+ : new FinalizationRegistry(
188
+ state => {
189
+ wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
190
+ }
191
+ );
192
+
193
+ function makeMutClosure(arg0, arg1, dtor, f) {
194
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
195
+ const real = (...args) => {
196
+
197
+ // First up with a closure we increment the internal reference
198
+ // count. This ensures that the Rust closure environment won't
199
+ // be deallocated while we're invoking it.
200
+ state.cnt++;
201
+ const a = state.a;
202
+ state.a = 0;
203
+ try {
204
+ return f(a, state.b, ...args);
205
+ } finally {
206
+ if (--state.cnt === 0) {
207
+ wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
208
+ CLOSURE_DTORS.unregister(state);
209
+ } else {
210
+ state.a = a;
211
+ }
212
+ }
213
+ };
214
+ real.original = state;
215
+ CLOSURE_DTORS.register(real, state, state);
216
+ return real;
217
+ }
218
+
185
219
  function passArray8ToWasm0(arg, malloc) {
186
220
  const ptr = malloc(arg.length * 1, 1) >>> 0;
187
221
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -210,66 +244,30 @@ export function parseDuc(buf) {
210
244
  }
211
245
 
212
246
  /**
213
- * Restore a specific checkpoint by its ID from a `.duc` file buffer.
214
- *
215
- * Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
216
- * @param {Uint8Array} duc_buf
217
- * @param {string} checkpoint_id
218
- * @returns {any}
219
- */
220
- export function restoreCheckpoint(duc_buf, checkpoint_id) {
221
- const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
222
- const len0 = WASM_VECTOR_LEN;
223
- const ptr1 = passStringToWasm0(checkpoint_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
224
- const len1 = WASM_VECTOR_LEN;
225
- const ret = wasm.restoreCheckpoint(ptr0, len0, ptr1, len1);
226
- if (ret[2]) {
227
- throw takeFromExternrefTable0(ret[1]);
228
- }
229
- return takeFromExternrefTable0(ret[0]);
230
- }
231
-
232
- /**
233
- * Compute a checkpoint-relative binary diff changeset using bsdiff.
234
- *
235
- * `base_state` is the checkpoint's full data blob.
236
- * `current_state` is the full document state at the new version.
237
- *
238
- * Returns an encoded changeset (`Uint8Array`) ready for storage in a
239
- * `Delta.payload`. bsdiff finds matching blocks even when they shift
240
- * offsets, which is critical for SQLite databases.
241
- * @param {Uint8Array} base_state
242
- * @param {Uint8Array} current_state
247
+ * Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
248
+ * @param {any} data
243
249
  * @returns {Uint8Array}
244
250
  */
245
- export function createDeltaChangeset(base_state, current_state) {
246
- const ptr0 = passArray8ToWasm0(base_state, wasm.__wbindgen_malloc);
247
- const len0 = WASM_VECTOR_LEN;
248
- const ptr1 = passArray8ToWasm0(current_state, wasm.__wbindgen_malloc);
249
- const len1 = WASM_VECTOR_LEN;
250
- const ret = wasm.createDeltaChangeset(ptr0, len0, ptr1, len1);
251
+ export function serializeDuc(data) {
252
+ const ret = wasm.serializeDuc(data);
251
253
  if (ret[3]) {
252
254
  throw takeFromExternrefTable0(ret[2]);
253
255
  }
254
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
256
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
255
257
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
256
- return v3;
258
+ return v1;
257
259
  }
258
260
 
259
261
  /**
260
- * Fetch a single external file from a `.duc` buffer by file ID.
261
- *
262
- * Returns the file entry as a JS object, or `undefined` if not found.
263
- * @param {Uint8Array} buf
264
- * @param {string} file_id
262
+ * Restore the document state at `version_number` from a `.duc` file buffer.
263
+ * @param {Uint8Array} duc_buf
264
+ * @param {number} version_number
265
265
  * @returns {any}
266
266
  */
267
- export function getExternalFile(buf, file_id) {
268
- const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
267
+ export function restoreVersion(duc_buf, version_number) {
268
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
269
269
  const len0 = WASM_VECTOR_LEN;
270
- const ptr1 = passStringToWasm0(file_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
271
- const len1 = WASM_VECTOR_LEN;
272
- const ret = wasm.getExternalFile(ptr0, len0, ptr1, len1);
270
+ const ret = wasm.restoreVersion(ptr0, len0, version_number);
273
271
  if (ret[2]) {
274
272
  throw takeFromExternrefTable0(ret[1]);
275
273
  }
@@ -277,40 +275,32 @@ export function getExternalFile(buf, file_id) {
277
275
  }
278
276
 
279
277
  /**
280
- * Apply a changeset to reconstruct document state.
281
- *
282
- * `base_state` must be the exact checkpoint data used when the changeset
283
- * was created. Returns the full document state as `Uint8Array`.
284
- *
285
- * Handles all changeset formats transparently:
286
- * - v3 (bsdiff), v2 (XOR diff), v1 (gzip full snapshot)
287
- * @param {Uint8Array} base_state
288
- * @param {Uint8Array} changeset
289
- * @returns {Uint8Array}
278
+ * Restore a specific checkpoint by its ID from a `.duc` file buffer.
279
+ * @param {Uint8Array} duc_buf
280
+ * @param {string} checkpoint_id
281
+ * @returns {any}
290
282
  */
291
- export function applyDeltaChangeset(base_state, changeset) {
292
- const ptr0 = passArray8ToWasm0(base_state, wasm.__wbindgen_malloc);
283
+ export function restoreCheckpoint(duc_buf, checkpoint_id) {
284
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
293
285
  const len0 = WASM_VECTOR_LEN;
294
- const ptr1 = passArray8ToWasm0(changeset, wasm.__wbindgen_malloc);
286
+ const ptr1 = passStringToWasm0(checkpoint_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
295
287
  const len1 = WASM_VECTOR_LEN;
296
- const ret = wasm.applyDeltaChangeset(ptr0, len0, ptr1, len1);
297
- if (ret[3]) {
298
- throw takeFromExternrefTable0(ret[2]);
288
+ const ret = wasm.restoreCheckpoint(ptr0, len0, ptr1, len1);
289
+ if (ret[2]) {
290
+ throw takeFromExternrefTable0(ret[1]);
299
291
  }
300
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
301
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
302
- return v3;
292
+ return takeFromExternrefTable0(ret[0]);
303
293
  }
304
294
 
305
295
  /**
306
- * List metadata for all external files (without loading the heavy data blobs).
307
- * @param {Uint8Array} buf
296
+ * List all versions (checkpoints + deltas) from a `.duc` file buffer.
297
+ * @param {Uint8Array} duc_buf
308
298
  * @returns {any}
309
299
  */
310
- export function listExternalFiles(buf) {
311
- const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
300
+ export function listVersions(duc_buf) {
301
+ const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
312
302
  const len0 = WASM_VECTOR_LEN;
313
- const ret = wasm.listExternalFiles(ptr0, len0);
303
+ const ret = wasm.listVersions(ptr0, len0);
314
304
  if (ret[2]) {
315
305
  throw takeFromExternrefTable0(ret[1]);
316
306
  }
@@ -319,9 +309,6 @@ export function listExternalFiles(buf) {
319
309
 
320
310
  /**
321
311
  * Read the full VersionGraph from a `.duc` file buffer.
322
- *
323
- * Returns a JS object matching the `VersionGraph` TypeScript interface,
324
- * or `undefined` if no version graph exists.
325
312
  * @param {Uint8Array} duc_buf
326
313
  * @returns {any}
327
314
  */
@@ -336,16 +323,15 @@ export function readVersionGraph(duc_buf) {
336
323
  }
337
324
 
338
325
  /**
339
- * List all versions (checkpoints + deltas) from a `.duc` file buffer.
340
- *
341
- * Returns a JS array of `VersionEntry` objects (no heavy data blobs).
326
+ * Revert the document to a specific version, removing all newer versions.
342
327
  * @param {Uint8Array} duc_buf
328
+ * @param {number} target_version
343
329
  * @returns {any}
344
330
  */
345
- export function listVersions(duc_buf) {
331
+ export function revertToVersion(duc_buf, target_version) {
346
332
  const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
347
333
  const len0 = WASM_VECTOR_LEN;
348
- const ret = wasm.listVersions(ptr0, len0);
334
+ const ret = wasm.revertToVersion(ptr0, len0, target_version);
349
335
  if (ret[2]) {
350
336
  throw takeFromExternrefTable0(ret[1]);
351
337
  }
@@ -353,88 +339,543 @@ export function listVersions(duc_buf) {
353
339
  }
354
340
 
355
341
  /**
356
- * Parse a `.duc` file lazily — returns everything EXCEPT external file data blobs.
342
+ * Returns the current version-control schema version defined in Rust.
357
343
  *
358
- * Use `getExternalFile()` or `listExternalFiles()` for on-demand access.
359
- * @param {Uint8Array} buf
360
- * @returns {any}
344
+ * TypeScript should use this as the source of truth instead of hardcoding
345
+ * its own constant. When this value is bumped in Rust, the version control
346
+ * system will automatically handle migration bookkeeping (closing old chains,
347
+ * recording migrations) the next time a checkpoint or delta is created.
348
+ * @returns {number}
361
349
  */
362
- export function parseDucLazy(buf) {
363
- const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
364
- const len0 = WASM_VECTOR_LEN;
365
- const ret = wasm.parseDucLazy(ptr0, len0);
366
- if (ret[2]) {
367
- throw takeFromExternrefTable0(ret[1]);
368
- }
369
- return takeFromExternrefTable0(ret[0]);
350
+ export function getCurrentSchemaVersion() {
351
+ return 4000000;
370
352
  }
371
353
 
372
354
  /**
373
- * Restore the document state at `version_number` from a `.duc` file buffer.
355
+ * Compute a checkpoint-relative binary diff changeset using bsdiff.
374
356
  *
375
- * The `.duc` file is a SQLite database — this function opens it and queries
376
- * the `checkpoints` / `deltas` tables directly for version restoration.
357
+ * `base_state` is the checkpoint's full data blob.
358
+ * `current_state` is the full document state at the new version.
377
359
  *
378
- * Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
379
- * @param {Uint8Array} duc_buf
380
- * @param {number} version_number
381
- * @returns {any}
360
+ * Returns an encoded changeset (`Uint8Array`) ready for storage in a
361
+ * `Delta.payload`. bsdiff finds matching blocks even when they shift
362
+ * offsets, which is critical for SQLite databases.
363
+ * @param {Uint8Array} base_state
364
+ * @param {Uint8Array} current_state
365
+ * @returns {Uint8Array}
382
366
  */
383
- export function restoreVersion(duc_buf, version_number) {
384
- const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
367
+ export function createDeltaChangeset(base_state, current_state) {
368
+ const ptr0 = passArray8ToWasm0(base_state, wasm.__wbindgen_malloc);
385
369
  const len0 = WASM_VECTOR_LEN;
386
- const ret = wasm.restoreVersion(ptr0, len0, version_number);
387
- if (ret[2]) {
388
- throw takeFromExternrefTable0(ret[1]);
370
+ const ptr1 = passArray8ToWasm0(current_state, wasm.__wbindgen_malloc);
371
+ const len1 = WASM_VECTOR_LEN;
372
+ const ret = wasm.createDeltaChangeset(ptr0, len0, ptr1, len1);
373
+ if (ret[3]) {
374
+ throw takeFromExternrefTable0(ret[2]);
389
375
  }
390
- return takeFromExternrefTable0(ret[0]);
376
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
377
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
378
+ return v3;
391
379
  }
392
380
 
393
381
  /**
394
- * Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
395
- * @param {any} data
382
+ * Apply a changeset to reconstruct document state.
383
+ *
384
+ * `base_state` must be the exact checkpoint data used when the changeset
385
+ * was created. Returns the full document state as `Uint8Array`.
386
+ *
387
+ * Handles all changeset formats transparently:
388
+ * - v3 (bsdiff), v2 (XOR diff), v1 (gzip full snapshot)
389
+ * @param {Uint8Array} base_state
390
+ * @param {Uint8Array} changeset
396
391
  * @returns {Uint8Array}
397
392
  */
398
- export function serializeDuc(data) {
399
- const ret = wasm.serializeDuc(data);
393
+ export function applyDeltaChangeset(base_state, changeset) {
394
+ const ptr0 = passArray8ToWasm0(base_state, wasm.__wbindgen_malloc);
395
+ const len0 = WASM_VECTOR_LEN;
396
+ const ptr1 = passArray8ToWasm0(changeset, wasm.__wbindgen_malloc);
397
+ const len1 = WASM_VECTOR_LEN;
398
+ const ret = wasm.applyDeltaChangeset(ptr0, len0, ptr1, len1);
400
399
  if (ret[3]) {
401
400
  throw takeFromExternrefTable0(ret[2]);
402
401
  }
403
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
402
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
404
403
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
405
- return v1;
404
+ return v3;
406
405
  }
407
406
 
408
- /**
409
- * Returns the current version-control schema version defined in Rust.
410
- *
411
- * TypeScript should use this as the source of truth instead of hardcoding
412
- * its own constant. When this value is bumped in Rust, the version control
413
- * system will automatically handle migration bookkeeping (closing old chains,
414
- * recording migrations) the next time a checkpoint or delta is created.
415
- * @returns {number}
416
- */
417
- export function getCurrentSchemaVersion() {
418
- return 3000007;
407
+ function __wbg_adapter_12(arg0, arg1, arg2) {
408
+ wasm.closure101_externref_shim(arg0, arg1, arg2);
419
409
  }
420
410
 
411
+ function __wbg_adapter_126(arg0, arg1, arg2, arg3) {
412
+ wasm.closure82_externref_shim(arg0, arg1, arg2, arg3);
413
+ }
414
+
415
+ const DucOpfsDocumentFinalization = (typeof FinalizationRegistry === 'undefined')
416
+ ? { register: () => {}, unregister: () => {} }
417
+ : new FinalizationRegistry(ptr => wasm.__wbg_ducopfsdocument_free(ptr >>> 0, 1));
418
+
419
+ export class DucOpfsDocument {
420
+
421
+ static __wrap(ptr) {
422
+ ptr = ptr >>> 0;
423
+ const obj = Object.create(DucOpfsDocument.prototype);
424
+ obj.__wbg_ptr = ptr;
425
+ DucOpfsDocumentFinalization.register(obj, obj.__wbg_ptr, obj);
426
+ return obj;
427
+ }
428
+
429
+ __destroy_into_raw() {
430
+ const ptr = this.__wbg_ptr;
431
+ this.__wbg_ptr = 0;
432
+ DucOpfsDocumentFinalization.unregister(this);
433
+ return ptr;
434
+ }
435
+
436
+ free() {
437
+ const ptr = this.__destroy_into_raw();
438
+ wasm.__wbg_ducopfsdocument_free(ptr, 0);
439
+ }
440
+ /**
441
+ * @param {string} name
442
+ * @param {string} namespace
443
+ * @returns {Promise<DucOpfsDocument>}
444
+ */
445
+ static openInPool(name, namespace) {
446
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
447
+ const len0 = WASM_VECTOR_LEN;
448
+ const ptr1 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
449
+ const len1 = WASM_VECTOR_LEN;
450
+ const ret = wasm.ducopfsdocument_openInPool(ptr0, len0, ptr1, len1);
451
+ return ret;
452
+ }
453
+ /**
454
+ * Read a chunk from the SQLite database backing this OPFS document.
455
+ *
456
+ * Call [`checkpointWal`] first so the main database file contains all
457
+ * committed data. JavaScript can gzip successive chunks without loading
458
+ * the whole database into WASM memory.
459
+ * @param {number} offset_bytes
460
+ * @param {number} length
461
+ * @returns {Promise<Uint8Array>}
462
+ */
463
+ exportDbChunk(offset_bytes, length) {
464
+ const ret = wasm.ducopfsdocument_exportDbChunk(this.__wbg_ptr, offset_bytes, length);
465
+ return ret;
466
+ }
467
+ /**
468
+ * @returns {Promise<any>}
469
+ */
470
+ static listOpfsDatabases() {
471
+ const ret = wasm.ducopfsdocument_listOpfsDatabases();
472
+ return ret;
473
+ }
474
+ /**
475
+ * @param {string} name
476
+ * @returns {Promise<boolean>}
477
+ */
478
+ static deleteOpfsDatabase(name) {
479
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
480
+ const len0 = WASM_VECTOR_LEN;
481
+ const ret = wasm.ducopfsdocument_deleteOpfsDatabase(ptr0, len0);
482
+ return ret;
483
+ }
484
+ /**
485
+ * @param {string} namespace
486
+ * @returns {Promise<any>}
487
+ */
488
+ static listOpfsDatabasesInPool(namespace) {
489
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
490
+ const len0 = WASM_VECTOR_LEN;
491
+ const ret = wasm.ducopfsdocument_listOpfsDatabasesInPool(ptr0, len0);
492
+ return ret;
493
+ }
494
+ /**
495
+ * @param {string} name
496
+ * @param {string} namespace
497
+ * @returns {Promise<boolean>}
498
+ */
499
+ static deleteOpfsDatabaseInPool(name, namespace) {
500
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
501
+ const len0 = WASM_VECTOR_LEN;
502
+ const ptr1 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
503
+ const len1 = WASM_VECTOR_LEN;
504
+ const ret = wasm.ducopfsdocument_deleteOpfsDatabaseInPool(ptr0, len0, ptr1, len1);
505
+ return ret;
506
+ }
507
+ /**
508
+ * Open or create a persistent OPFS-backed DUC SQLite document.
509
+ *
510
+ * This must run from a Dedicated Worker because the OPFS SAH-pool VFS uses
511
+ * FileSystemSyncAccessHandle.
512
+ * @param {string} name
513
+ * @returns {Promise<DucOpfsDocument>}
514
+ */
515
+ static open(name) {
516
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
517
+ const len0 = WASM_VECTOR_LEN;
518
+ const ret = wasm.ducopfsdocument_open(ptr0, len0);
519
+ return ret;
520
+ }
521
+ /**
522
+ * Return the filename used to open this document.
523
+ * @returns {string}
524
+ */
525
+ getFilename() {
526
+ let deferred1_0;
527
+ let deferred1_1;
528
+ try {
529
+ const ret = wasm.ducopfsdocument_getFilename(this.__wbg_ptr);
530
+ deferred1_0 = ret[0];
531
+ deferred1_1 = ret[1];
532
+ return getStringFromWasm0(ret[0], ret[1]);
533
+ } finally {
534
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
535
+ }
536
+ }
537
+ /**
538
+ * Execute an arbitrary SQL batch (e.g. `VACUUM INTO 'export.sqlite'`).
539
+ * @param {string} sql
540
+ */
541
+ executeBatch(sql) {
542
+ const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
543
+ const len0 = WASM_VECTOR_LEN;
544
+ const ret = wasm.ducopfsdocument_executeBatch(this.__wbg_ptr, ptr0, len0);
545
+ if (ret[1]) {
546
+ throw takeFromExternrefTable0(ret[0]);
547
+ }
548
+ }
549
+ /**
550
+ * @returns {any}
551
+ */
552
+ listVersions() {
553
+ const ret = wasm.ducopfsdocument_listVersions(this.__wbg_ptr);
554
+ if (ret[2]) {
555
+ throw takeFromExternrefTable0(ret[1]);
556
+ }
557
+ return takeFromExternrefTable0(ret[0]);
558
+ }
559
+ /**
560
+ * Flush the WAL journal into the main database file.
561
+ *
562
+ * After calling this, the OPFS file backing this document contains
563
+ * all committed data. JavaScript can then read the file directly
564
+ * from OPFS in chunks and gzip-compress it.
565
+ */
566
+ checkpointWal() {
567
+ const ret = wasm.ducopfsdocument_checkpointWal(this.__wbg_ptr);
568
+ if (ret[1]) {
569
+ throw takeFromExternrefTable0(ret[0]);
570
+ }
571
+ }
572
+ /**
573
+ * Return the estimated database file size in bytes
574
+ * (`page_count × page_size`). Call [`checkpoint_wal`] first for
575
+ * an accurate value.
576
+ * @returns {number}
577
+ */
578
+ getDbSizeBytes() {
579
+ const ret = wasm.ducopfsdocument_getDbSizeBytes(this.__wbg_ptr);
580
+ if (ret[2]) {
581
+ throw takeFromExternrefTable0(ret[1]);
582
+ }
583
+ return ret[0];
584
+ }
585
+ /**
586
+ * @returns {any}
587
+ */
588
+ readVersionGraph() {
589
+ const ret = wasm.ducopfsdocument_readVersionGraph(this.__wbg_ptr);
590
+ if (ret[2]) {
591
+ throw takeFromExternrefTable0(ret[1]);
592
+ }
593
+ return takeFromExternrefTable0(ret[0]);
594
+ }
595
+ /**
596
+ * @returns {any}
597
+ */
598
+ listExternalFiles() {
599
+ const ret = wasm.ducopfsdocument_listExternalFiles(this.__wbg_ptr);
600
+ if (ret[2]) {
601
+ throw takeFromExternrefTable0(ret[1]);
602
+ }
603
+ return takeFromExternrefTable0(ret[0]);
604
+ }
605
+ /**
606
+ * @returns {any}
607
+ */
608
+ readDocumentState() {
609
+ const ret = wasm.ducopfsdocument_readDocumentState(this.__wbg_ptr);
610
+ if (ret[2]) {
611
+ throw takeFromExternrefTable0(ret[1]);
612
+ }
613
+ return takeFromExternrefTable0(ret[0]);
614
+ }
615
+ /**
616
+ * @param {any} data
617
+ */
618
+ writeDocumentState(data) {
619
+ const ret = wasm.ducopfsdocument_writeDocumentState(this.__wbg_ptr, data);
620
+ if (ret[1]) {
621
+ throw takeFromExternrefTable0(ret[0]);
622
+ }
623
+ }
624
+ /**
625
+ * @param {string} checkpoint_id
626
+ * @param {number} chunk_index
627
+ * @returns {any}
628
+ */
629
+ readCheckpointDataChunk(checkpoint_id, chunk_index) {
630
+ const ptr0 = passStringToWasm0(checkpoint_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
631
+ const len0 = WASM_VECTOR_LEN;
632
+ const ret = wasm.ducopfsdocument_readCheckpointDataChunk(this.__wbg_ptr, ptr0, len0, chunk_index);
633
+ if (ret[2]) {
634
+ throw takeFromExternrefTable0(ret[1]);
635
+ }
636
+ return takeFromExternrefTable0(ret[0]);
637
+ }
638
+ /**
639
+ * @param {string} delta_id
640
+ * @param {number} chunk_index
641
+ * @returns {any}
642
+ */
643
+ readDeltaChangesetChunk(delta_id, chunk_index) {
644
+ const ptr0 = passStringToWasm0(delta_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
645
+ const len0 = WASM_VECTOR_LEN;
646
+ const ret = wasm.ducopfsdocument_readDeltaChangesetChunk(this.__wbg_ptr, ptr0, len0, chunk_index);
647
+ if (ret[2]) {
648
+ throw takeFromExternrefTable0(ret[1]);
649
+ }
650
+ return takeFromExternrefTable0(ret[0]);
651
+ }
652
+ /**
653
+ * @param {string} checkpoint_id
654
+ * @param {number} chunk_index
655
+ * @param {number} offset_bytes
656
+ * @param {Uint8Array} data
657
+ */
658
+ writeCheckpointDataChunk(checkpoint_id, chunk_index, offset_bytes, data) {
659
+ const ptr0 = passStringToWasm0(checkpoint_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
660
+ const len0 = WASM_VECTOR_LEN;
661
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
662
+ const len1 = WASM_VECTOR_LEN;
663
+ const ret = wasm.ducopfsdocument_writeCheckpointDataChunk(this.__wbg_ptr, ptr0, len0, chunk_index, offset_bytes, ptr1, len1);
664
+ if (ret[1]) {
665
+ throw takeFromExternrefTable0(ret[0]);
666
+ }
667
+ }
668
+ /**
669
+ * @param {string} delta_id
670
+ * @param {number} chunk_index
671
+ * @param {number} offset_bytes
672
+ * @param {Uint8Array} data
673
+ */
674
+ writeDeltaChangesetChunk(delta_id, chunk_index, offset_bytes, data) {
675
+ const ptr0 = passStringToWasm0(delta_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
676
+ const len0 = WASM_VECTOR_LEN;
677
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
678
+ const len1 = WASM_VECTOR_LEN;
679
+ const ret = wasm.ducopfsdocument_writeDeltaChangesetChunk(this.__wbg_ptr, ptr0, len0, chunk_index, offset_bytes, ptr1, len1);
680
+ if (ret[1]) {
681
+ throw takeFromExternrefTable0(ret[0]);
682
+ }
683
+ }
684
+ /**
685
+ * @param {string} checkpoint_id
686
+ */
687
+ clearCheckpointDataChunks(checkpoint_id) {
688
+ const ptr0 = passStringToWasm0(checkpoint_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
689
+ const len0 = WASM_VECTOR_LEN;
690
+ const ret = wasm.ducopfsdocument_clearCheckpointDataChunks(this.__wbg_ptr, ptr0, len0);
691
+ if (ret[1]) {
692
+ throw takeFromExternrefTable0(ret[0]);
693
+ }
694
+ }
695
+ /**
696
+ * @param {string} delta_id
697
+ */
698
+ clearDeltaChangesetChunks(delta_id) {
699
+ const ptr0 = passStringToWasm0(delta_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
700
+ const len0 = WASM_VECTOR_LEN;
701
+ const ret = wasm.ducopfsdocument_clearDeltaChangesetChunks(this.__wbg_ptr, ptr0, len0);
702
+ if (ret[1]) {
703
+ throw takeFromExternrefTable0(ret[0]);
704
+ }
705
+ }
706
+ /**
707
+ * @param {string} revision_id
708
+ * @param {number} chunk_index
709
+ * @returns {any}
710
+ */
711
+ readExternalFileRevisionChunk(revision_id, chunk_index) {
712
+ const ptr0 = passStringToWasm0(revision_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
713
+ const len0 = WASM_VECTOR_LEN;
714
+ const ret = wasm.ducopfsdocument_readExternalFileRevisionChunk(this.__wbg_ptr, ptr0, len0, chunk_index);
715
+ if (ret[2]) {
716
+ throw takeFromExternrefTable0(ret[1]);
717
+ }
718
+ return takeFromExternrefTable0(ret[0]);
719
+ }
720
+ /**
721
+ * Read a bounded byte range, including from legacy one-row BLOB revisions.
722
+ * @param {string} revision_id
723
+ * @param {number} offset_bytes
724
+ * @param {number} length_bytes
725
+ * @returns {any}
726
+ */
727
+ readExternalFileRevisionRange(revision_id, offset_bytes, length_bytes) {
728
+ const ptr0 = passStringToWasm0(revision_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
729
+ const len0 = WASM_VECTOR_LEN;
730
+ const ret = wasm.ducopfsdocument_readExternalFileRevisionRange(this.__wbg_ptr, ptr0, len0, offset_bytes, length_bytes);
731
+ if (ret[2]) {
732
+ throw takeFromExternrefTable0(ret[1]);
733
+ }
734
+ return takeFromExternrefTable0(ret[0]);
735
+ }
736
+ /**
737
+ * Read a bounded batch of external-file chunks with one SQL query and one
738
+ * JS/WASM call. Batches are capped at 4 chunks to bound peak memory.
739
+ * @param {string} revision_id
740
+ * @param {number} start_chunk_index
741
+ * @param {number} max_chunks
742
+ * @returns {Array<any>}
743
+ */
744
+ readExternalFileRevisionChunks(revision_id, start_chunk_index, max_chunks) {
745
+ const ptr0 = passStringToWasm0(revision_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
746
+ const len0 = WASM_VECTOR_LEN;
747
+ const ret = wasm.ducopfsdocument_readExternalFileRevisionChunks(this.__wbg_ptr, ptr0, len0, start_chunk_index, max_chunks);
748
+ if (ret[2]) {
749
+ throw takeFromExternrefTable0(ret[1]);
750
+ }
751
+ return takeFromExternrefTable0(ret[0]);
752
+ }
753
+ /**
754
+ * @param {string} revision_id
755
+ * @param {number} chunk_index
756
+ * @param {number} offset_bytes
757
+ * @param {Uint8Array} data
758
+ */
759
+ writeExternalFileRevisionChunk(revision_id, chunk_index, offset_bytes, data) {
760
+ const ptr0 = passStringToWasm0(revision_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
761
+ const len0 = WASM_VECTOR_LEN;
762
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
763
+ const len1 = WASM_VECTOR_LEN;
764
+ const ret = wasm.ducopfsdocument_writeExternalFileRevisionChunk(this.__wbg_ptr, ptr0, len0, chunk_index, offset_bytes, ptr1, len1);
765
+ if (ret[1]) {
766
+ throw takeFromExternrefTable0(ret[0]);
767
+ }
768
+ }
769
+ /**
770
+ * @param {string} revision_id
771
+ */
772
+ clearExternalFileRevisionChunks(revision_id) {
773
+ const ptr0 = passStringToWasm0(revision_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
774
+ const len0 = WASM_VECTOR_LEN;
775
+ const ret = wasm.ducopfsdocument_clearExternalFileRevisionChunks(this.__wbg_ptr, ptr0, len0);
776
+ if (ret[1]) {
777
+ throw takeFromExternrefTable0(ret[0]);
778
+ }
779
+ }
780
+ }
781
+ if (Symbol.dispose) DucOpfsDocument.prototype[Symbol.dispose] = DucOpfsDocument.prototype.free;
782
+
783
+ const DucOpfsImporterFinalization = (typeof FinalizationRegistry === 'undefined')
784
+ ? { register: () => {}, unregister: () => {} }
785
+ : new FinalizationRegistry(ptr => wasm.__wbg_ducopfsimporter_free(ptr >>> 0, 1));
421
786
  /**
422
- * Revert the document to a specific version, removing all newer versions.
423
- *
424
- * Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
425
- * @param {Uint8Array} duc_buf
426
- * @param {number} target_version
427
- * @returns {any}
787
+ * Incrementally replaces one OPFS database without retaining the imported
788
+ * SQLite payload in WASM memory.
428
789
  */
429
- export function revertToVersion(duc_buf, target_version) {
430
- const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
431
- const len0 = WASM_VECTOR_LEN;
432
- const ret = wasm.revertToVersion(ptr0, len0, target_version);
433
- if (ret[2]) {
434
- throw takeFromExternrefTable0(ret[1]);
790
+ export class DucOpfsImporter {
791
+
792
+ static __wrap(ptr) {
793
+ ptr = ptr >>> 0;
794
+ const obj = Object.create(DucOpfsImporter.prototype);
795
+ obj.__wbg_ptr = ptr;
796
+ DucOpfsImporterFinalization.register(obj, obj.__wbg_ptr, obj);
797
+ return obj;
798
+ }
799
+
800
+ __destroy_into_raw() {
801
+ const ptr = this.__wbg_ptr;
802
+ this.__wbg_ptr = 0;
803
+ DucOpfsImporterFinalization.unregister(this);
804
+ return ptr;
805
+ }
806
+
807
+ free() {
808
+ const ptr = this.__destroy_into_raw();
809
+ wasm.__wbg_ducopfsimporter_free(ptr, 0);
810
+ }
811
+ /**
812
+ * @param {string} name
813
+ * @param {string} namespace
814
+ * @returns {Promise<DucOpfsImporter>}
815
+ */
816
+ static beginInPool(name, namespace) {
817
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
818
+ const len0 = WASM_VECTOR_LEN;
819
+ const ptr1 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
820
+ const len1 = WASM_VECTOR_LEN;
821
+ const ret = wasm.ducopfsimporter_beginInPool(ptr0, len0, ptr1, len1);
822
+ return ret;
823
+ }
824
+ /**
825
+ * Begin replacing `name`. Any prior database with the same closed name is
826
+ * released back to the SAH pool before the new import claims a slot.
827
+ * @param {string} name
828
+ * @returns {Promise<DucOpfsImporter>}
829
+ */
830
+ static begin(name) {
831
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
832
+ const len0 = WASM_VECTOR_LEN;
833
+ const ret = wasm.ducopfsimporter_begin(ptr0, len0);
834
+ return ret;
835
+ }
836
+ /**
837
+ * Write the next decompressed SQLite chunk.
838
+ * @param {Uint8Array} data
839
+ */
840
+ writeChunk(data) {
841
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
842
+ const len0 = WASM_VECTOR_LEN;
843
+ const ret = wasm.ducopfsimporter_writeChunk(this.__wbg_ptr, ptr0, len0);
844
+ if (ret[1]) {
845
+ throw takeFromExternrefTable0(ret[0]);
846
+ }
847
+ }
848
+ /**
849
+ * @returns {number}
850
+ */
851
+ getBytesWritten() {
852
+ const ret = wasm.ducopfsimporter_getBytesWritten(this.__wbg_ptr);
853
+ return ret;
854
+ }
855
+ /**
856
+ * Delete a partial import. Safe to call after a failed stream read.
857
+ * @returns {boolean}
858
+ */
859
+ abort() {
860
+ const ret = wasm.ducopfsimporter_abort(this.__wbg_ptr);
861
+ if (ret[2]) {
862
+ throw takeFromExternrefTable0(ret[1]);
863
+ }
864
+ return ret[0] !== 0;
865
+ }
866
+ /**
867
+ * Flush the imported database and make it ready for SQLite to open.
868
+ * @returns {number}
869
+ */
870
+ finish() {
871
+ const ret = wasm.ducopfsimporter_finish(this.__wbg_ptr);
872
+ if (ret[2]) {
873
+ throw takeFromExternrefTable0(ret[1]);
874
+ }
875
+ return ret[0];
435
876
  }
436
- return takeFromExternrefTable0(ret[0]);
437
877
  }
878
+ if (Symbol.dispose) DucOpfsImporter.prototype[Symbol.dispose] = DucOpfsImporter.prototype.free;
438
879
 
439
880
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
440
881
 
@@ -489,18 +930,57 @@ function __wbg_get_imports() {
489
930
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
490
931
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
491
932
  };
933
+ imports.wbg.__wbg_buffer_8d40b1d762fb3c66 = function(arg0) {
934
+ const ret = arg0.buffer;
935
+ return ret;
936
+ };
937
+ imports.wbg.__wbg_byteLength_331a6b5545834024 = function(arg0) {
938
+ const ret = arg0.byteLength;
939
+ return ret;
940
+ };
941
+ imports.wbg.__wbg_byteOffset_49a5b5608000358b = function(arg0) {
942
+ const ret = arg0.byteOffset;
943
+ return ret;
944
+ };
492
945
  imports.wbg.__wbg_call_13410aac570ffff7 = function() { return handleError(function (arg0, arg1) {
493
946
  const ret = arg0.call(arg1);
494
947
  return ret;
495
948
  }, arguments) };
949
+ imports.wbg.__wbg_call_a5400b25a865cfd8 = function() { return handleError(function (arg0, arg1, arg2) {
950
+ const ret = arg0.call(arg1, arg2);
951
+ return ret;
952
+ }, arguments) };
953
+ imports.wbg.__wbg_createSyncAccessHandle_d06aab2e41a339b2 = function(arg0) {
954
+ const ret = arg0.createSyncAccessHandle();
955
+ return ret;
956
+ };
496
957
  imports.wbg.__wbg_done_75ed0ee6dd243d9d = function(arg0) {
497
958
  const ret = arg0.done;
498
959
  return ret;
499
960
  };
961
+ imports.wbg.__wbg_ducopfsdocument_new = function(arg0) {
962
+ const ret = DucOpfsDocument.__wrap(arg0);
963
+ return ret;
964
+ };
965
+ imports.wbg.__wbg_ducopfsimporter_new = function(arg0) {
966
+ const ret = DucOpfsImporter.__wrap(arg0);
967
+ return ret;
968
+ };
969
+ imports.wbg.__wbg_entries_1a3c3b9544532397 = function(arg0) {
970
+ const ret = arg0.entries();
971
+ return ret;
972
+ };
500
973
  imports.wbg.__wbg_entries_2be2f15bd5554996 = function(arg0) {
501
974
  const ret = Object.entries(arg0);
502
975
  return ret;
503
976
  };
977
+ imports.wbg.__wbg_fill_c8751cf67b766c70 = function(arg0, arg1, arg2, arg3) {
978
+ const ret = arg0.fill(arg1, arg2 >>> 0, arg3 >>> 0);
979
+ return ret;
980
+ };
981
+ imports.wbg.__wbg_flush_d2487a24f3bc3cf4 = function() { return handleError(function (arg0) {
982
+ arg0.flush();
983
+ }, arguments) };
504
984
  imports.wbg.__wbg_from_88bc52ce20ba6318 = function(arg0) {
505
985
  const ret = Array.from(arg0);
506
986
  return ret;
@@ -513,6 +993,18 @@ function __wbg_get_imports() {
513
993
  const ret = arg0.getDay();
514
994
  return ret;
515
995
  };
996
+ imports.wbg.__wbg_getDirectoryHandle_0fb26677897f1e21 = function(arg0, arg1, arg2, arg3) {
997
+ const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
998
+ return ret;
999
+ };
1000
+ imports.wbg.__wbg_getDirectory_8564f4b4ae7ee35c = function(arg0) {
1001
+ const ret = arg0.getDirectory();
1002
+ return ret;
1003
+ };
1004
+ imports.wbg.__wbg_getFileHandle_9f23d09c2497fa5f = function(arg0, arg1, arg2, arg3) {
1005
+ const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
1006
+ return ret;
1007
+ };
516
1008
  imports.wbg.__wbg_getFullYear_e351a9fa7d2fab83 = function(arg0) {
517
1009
  const ret = arg0.getFullYear();
518
1010
  return ret;
@@ -536,6 +1028,10 @@ function __wbg_get_imports() {
536
1028
  const ret = arg0.getSeconds();
537
1029
  return ret;
538
1030
  };
1031
+ imports.wbg.__wbg_getSize_56a06761973a6cd7 = function() { return handleError(function (arg0) {
1032
+ const ret = arg0.getSize();
1033
+ return ret;
1034
+ }, arguments) };
539
1035
  imports.wbg.__wbg_getTime_6bb3f64e0f18f817 = function(arg0) {
540
1036
  const ret = arg0.getTime();
541
1037
  return ret;
@@ -544,6 +1040,10 @@ function __wbg_get_imports() {
544
1040
  const ret = arg0.getTimezoneOffset();
545
1041
  return ret;
546
1042
  };
1043
+ imports.wbg.__wbg_getUint32_2dc0ed17b0324774 = function(arg0, arg1) {
1044
+ const ret = arg0.getUint32(arg1 >>> 0);
1045
+ return ret;
1046
+ };
547
1047
  imports.wbg.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
548
1048
  const ret = arg0[arg1 >>> 0];
549
1049
  return ret;
@@ -552,6 +1052,10 @@ function __wbg_get_imports() {
552
1052
  const ret = Reflect.get(arg0, arg1);
553
1053
  return ret;
554
1054
  }, arguments) };
1055
+ imports.wbg.__wbg_getindex_61bb13d19869849b = function(arg0, arg1) {
1056
+ const ret = arg0[arg1 >>> 0];
1057
+ return ret;
1058
+ };
555
1059
  imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
556
1060
  const ret = arg0[arg1];
557
1061
  return ret;
@@ -586,6 +1090,16 @@ function __wbg_get_imports() {
586
1090
  const ret = result;
587
1091
  return ret;
588
1092
  };
1093
+ imports.wbg.__wbg_instanceof_WorkerGlobalScope_85d487cc157fd065 = function(arg0) {
1094
+ let result;
1095
+ try {
1096
+ result = arg0 instanceof WorkerGlobalScope;
1097
+ } catch (_) {
1098
+ result = false;
1099
+ }
1100
+ const ret = result;
1101
+ return ret;
1102
+ };
589
1103
  imports.wbg.__wbg_isArray_030cce220591fb41 = function(arg0) {
590
1104
  const ret = Array.isArray(arg0);
591
1105
  return ret;
@@ -606,6 +1120,10 @@ function __wbg_get_imports() {
606
1120
  const ret = arg0.length;
607
1121
  return ret;
608
1122
  };
1123
+ imports.wbg.__wbg_navigator_bfaf1b0b0eb48da2 = function(arg0) {
1124
+ const ret = arg0.navigator;
1125
+ return ret;
1126
+ };
609
1127
  imports.wbg.__wbg_new0_b0a0a38c201e6df5 = function() {
610
1128
  const ret = new Date();
611
1129
  return ret;
@@ -618,6 +1136,24 @@ function __wbg_get_imports() {
618
1136
  const ret = new Array();
619
1137
  return ret;
620
1138
  };
1139
+ imports.wbg.__wbg_new_2e3c58a15f39f5f9 = function(arg0, arg1) {
1140
+ try {
1141
+ var state0 = {a: arg0, b: arg1};
1142
+ var cb0 = (arg0, arg1) => {
1143
+ const a = state0.a;
1144
+ state0.a = 0;
1145
+ try {
1146
+ return __wbg_adapter_126(a, state0.b, arg0, arg1);
1147
+ } finally {
1148
+ state0.a = a;
1149
+ }
1150
+ };
1151
+ const ret = new Promise(cb0);
1152
+ return ret;
1153
+ } finally {
1154
+ state0.a = state0.b = 0;
1155
+ }
1156
+ };
621
1157
  imports.wbg.__wbg_new_2ff1f68f3676ea53 = function() {
622
1158
  const ret = new Map();
623
1159
  return ret;
@@ -630,14 +1166,34 @@ function __wbg_get_imports() {
630
1166
  const ret = new Uint8Array(arg0);
631
1167
  return ret;
632
1168
  };
1169
+ imports.wbg.__wbg_new_f60d6f09990bdb99 = function(arg0, arg1, arg2) {
1170
+ const ret = new DataView(arg0, arg1 >>> 0, arg2 >>> 0);
1171
+ return ret;
1172
+ };
633
1173
  imports.wbg.__wbg_newfromslice_074c56947bd43469 = function(arg0, arg1) {
634
1174
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
635
1175
  return ret;
636
1176
  };
1177
+ imports.wbg.__wbg_newnoargs_254190557c45b4ec = function(arg0, arg1) {
1178
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1179
+ return ret;
1180
+ };
1181
+ imports.wbg.__wbg_newwithlength_a167dcc7aaa3ba77 = function(arg0) {
1182
+ const ret = new Uint8Array(arg0 >>> 0);
1183
+ return ret;
1184
+ };
1185
+ imports.wbg.__wbg_newwithlength_c2868113efe93526 = function(arg0) {
1186
+ const ret = new Array(arg0 >>> 0);
1187
+ return ret;
1188
+ };
637
1189
  imports.wbg.__wbg_newwithyearmonthday_9d5466a369f2521d = function(arg0, arg1, arg2) {
638
1190
  const ret = new Date(arg0 >>> 0, arg1, arg2);
639
1191
  return ret;
640
1192
  };
1193
+ imports.wbg.__wbg_next_1142e1658f75ec63 = function() { return handleError(function (arg0) {
1194
+ const ret = arg0.next();
1195
+ return ret;
1196
+ }, arguments) };
641
1197
  imports.wbg.__wbg_next_5b3530e612fde77d = function(arg0) {
642
1198
  const ret = arg0.next;
643
1199
  return ret;
@@ -649,10 +1205,35 @@ function __wbg_get_imports() {
649
1205
  imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
650
1206
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
651
1207
  };
1208
+ imports.wbg.__wbg_queueMicrotask_25d0739ac89e8c88 = function(arg0) {
1209
+ queueMicrotask(arg0);
1210
+ };
1211
+ imports.wbg.__wbg_queueMicrotask_4488407636f5bf24 = function(arg0) {
1212
+ const ret = arg0.queueMicrotask;
1213
+ return ret;
1214
+ };
652
1215
  imports.wbg.__wbg_random_7ed63a0b38ee3b75 = function() {
653
1216
  const ret = Math.random();
654
1217
  return ret;
655
1218
  };
1219
+ imports.wbg.__wbg_read_a43bb46027f02ee9 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1220
+ const ret = arg0.read(getArrayU8FromWasm0(arg1, arg2), arg3);
1221
+ return ret;
1222
+ }, arguments) };
1223
+ imports.wbg.__wbg_read_e271e94623077591 = function() { return handleError(function (arg0, arg1, arg2) {
1224
+ const ret = arg0.read(arg1, arg2);
1225
+ return ret;
1226
+ }, arguments) };
1227
+ imports.wbg.__wbg_resolve_4055c623acdd6a1b = function(arg0) {
1228
+ const ret = Promise.resolve(arg0);
1229
+ return ret;
1230
+ };
1231
+ imports.wbg.__wbg_setUint32_8a9564ae127df4c5 = function(arg0, arg1, arg2) {
1232
+ arg0.setUint32(arg1 >>> 0, arg2 >>> 0);
1233
+ };
1234
+ imports.wbg.__wbg_set_1353b2a5e96bc48c = function(arg0, arg1, arg2) {
1235
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
1236
+ };
656
1237
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
657
1238
  arg0[arg1] = arg2;
658
1239
  };
@@ -667,6 +1248,53 @@ function __wbg_get_imports() {
667
1248
  const ret = arg0.set(arg1, arg2);
668
1249
  return ret;
669
1250
  };
1251
+ imports.wbg.__wbg_setat_f8fc70f546036b10 = function(arg0, arg1) {
1252
+ arg0.at = arg1;
1253
+ };
1254
+ imports.wbg.__wbg_setcreate_1eb73f4ea713c1ad = function(arg0, arg1) {
1255
+ arg0.create = arg1 !== 0;
1256
+ };
1257
+ imports.wbg.__wbg_setcreate_2d32aa4bbcd1d7af = function(arg0, arg1) {
1258
+ arg0.create = arg1 !== 0;
1259
+ };
1260
+ imports.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12 = function() {
1261
+ const ret = typeof global === 'undefined' ? null : global;
1262
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1263
+ };
1264
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184 = function() {
1265
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1266
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1267
+ };
1268
+ imports.wbg.__wbg_static_accessor_SELF_995b214ae681ff99 = function() {
1269
+ const ret = typeof self === 'undefined' ? null : self;
1270
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1271
+ };
1272
+ imports.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea = function() {
1273
+ const ret = typeof window === 'undefined' ? null : window;
1274
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1275
+ };
1276
+ imports.wbg.__wbg_storage_32b4ac688c114c3d = function(arg0) {
1277
+ const ret = arg0.storage;
1278
+ return ret;
1279
+ };
1280
+ imports.wbg.__wbg_subarray_70fd07feefe14294 = function(arg0, arg1, arg2) {
1281
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1282
+ return ret;
1283
+ };
1284
+ imports.wbg.__wbg_then_b33a773d723afa3e = function(arg0, arg1, arg2) {
1285
+ const ret = arg0.then(arg1, arg2);
1286
+ return ret;
1287
+ };
1288
+ imports.wbg.__wbg_then_e22500defe16819f = function(arg0, arg1) {
1289
+ const ret = arg0.then(arg1);
1290
+ return ret;
1291
+ };
1292
+ imports.wbg.__wbg_truncate_0fe935591188a14c = function() { return handleError(function (arg0, arg1) {
1293
+ arg0.truncate(arg1 >>> 0);
1294
+ }, arguments) };
1295
+ imports.wbg.__wbg_truncate_7cddd971e3cf0a8c = function() { return handleError(function (arg0, arg1) {
1296
+ arg0.truncate(arg1);
1297
+ }, arguments) };
670
1298
  imports.wbg.__wbg_value_dd9372230531eade = function(arg0) {
671
1299
  const ret = arg0.value;
672
1300
  return ret;
@@ -682,6 +1310,15 @@ function __wbg_get_imports() {
682
1310
  const ret = typeof(v) === 'boolean' ? v : undefined;
683
1311
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
684
1312
  };
1313
+ imports.wbg.__wbg_wbindgencbdrop_eb10308566512b88 = function(arg0) {
1314
+ const obj = arg0.original;
1315
+ if (obj.cnt-- == 1) {
1316
+ obj.a = 0;
1317
+ return true;
1318
+ }
1319
+ const ret = false;
1320
+ return ret;
1321
+ };
685
1322
  imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
686
1323
  const ret = debugString(arg1);
687
1324
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -739,6 +1376,14 @@ function __wbg_get_imports() {
739
1376
  imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
740
1377
  throw new Error(getStringFromWasm0(arg0, arg1));
741
1378
  };
1379
+ imports.wbg.__wbg_write_9ac6a5f58a8c835c = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1380
+ const ret = arg0.write(getArrayU8FromWasm0(arg1, arg2), arg3);
1381
+ return ret;
1382
+ }, arguments) };
1383
+ imports.wbg.__wbg_write_c0e234eeb0039d0d = function() { return handleError(function (arg0, arg1, arg2) {
1384
+ const ret = arg0.write(arg1, arg2);
1385
+ return ret;
1386
+ }, arguments) };
742
1387
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
743
1388
  // Cast intrinsic for `Ref(String) -> Externref`.
744
1389
  const ret = getStringFromWasm0(arg0, arg1);
@@ -749,11 +1394,23 @@ function __wbg_get_imports() {
749
1394
  const ret = BigInt.asUintN(64, arg0);
750
1395
  return ret;
751
1396
  };
1397
+ imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
1398
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1399
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
1400
+ // Cast intrinsic for `Vector(U8) -> Externref`.
1401
+ const ret = v0;
1402
+ return ret;
1403
+ };
752
1404
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
753
1405
  // Cast intrinsic for `I64 -> Externref`.
754
1406
  const ret = arg0;
755
1407
  return ret;
756
1408
  };
1409
+ imports.wbg.__wbindgen_cast_9f0223d8557fdf20 = function(arg0, arg1) {
1410
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 100, function: Function { arguments: [Externref], shim_idx: 101, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1411
+ const ret = makeMutClosure(arg0, arg1, 100, __wbg_adapter_12);
1412
+ return ret;
1413
+ };
757
1414
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
758
1415
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
759
1416
  const ret = getArrayU8FromWasm0(arg0, arg1);