@automerge/sedimentree 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/package.json +30 -3
  2. package/dist/cjs/node.cjs +0 -5
  3. package/dist/cjs/slim.cjs +0 -1
  4. package/dist/cjs/wasm-base64.cjs +0 -1
  5. package/dist/cjs/web-bindings.cjs +0 -1788
  6. package/dist/cjs/web.cjs +0 -1741
  7. package/dist/esm/bundler.js +0 -7
  8. package/dist/esm/node.js +0 -7
  9. package/dist/esm/slim.js +0 -2
  10. package/dist/esm/wasm-base64.js +0 -1
  11. package/dist/esm/web.js +0 -5
  12. package/dist/esm/workerd.js +0 -5
  13. package/dist/iife/index.js +0 -1723
  14. package/dist/index.d.ts +0 -522
  15. package/dist/sedimentree.wasm +0 -0
  16. package/dist/wasm_bindgen/bundler/sedimentree_wasm.d.ts +0 -522
  17. package/dist/wasm_bindgen/bundler/sedimentree_wasm.js +0 -9
  18. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.js +0 -1742
  19. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm +0 -0
  20. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm.d.ts +0 -104
  21. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  22. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  23. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
  24. package/dist/wasm_bindgen/nodejs/sedimentree_wasm.cjs +0 -1762
  25. package/dist/wasm_bindgen/nodejs/sedimentree_wasm.d.ts +0 -522
  26. package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm +0 -0
  27. package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm.d.ts +0 -104
  28. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  29. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  30. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
  31. package/dist/wasm_bindgen/web/sedimentree_wasm.d.ts +0 -651
  32. package/dist/wasm_bindgen/web/sedimentree_wasm.js +0 -1844
  33. package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm +0 -0
  34. package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm.d.ts +0 -104
  35. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  36. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  37. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
@@ -1,1742 +0,0 @@
1
- /**
2
- * A Wasm wrapper around the [`BlobMeta`] type.
3
- */
4
- export class BlobMeta {
5
- static __wrap(ptr) {
6
- ptr = ptr >>> 0;
7
- const obj = Object.create(BlobMeta.prototype);
8
- obj.__wbg_ptr = ptr;
9
- BlobMetaFinalization.register(obj, obj.__wbg_ptr, obj);
10
- return obj;
11
- }
12
- __destroy_into_raw() {
13
- const ptr = this.__wbg_ptr;
14
- this.__wbg_ptr = 0;
15
- BlobMetaFinalization.unregister(this);
16
- return ptr;
17
- }
18
- free() {
19
- const ptr = this.__destroy_into_raw();
20
- wasm.__wbg_blobmeta_free(ptr, 0);
21
- }
22
- /**
23
- * Get the digest of the blob.
24
- * @returns {Digest}
25
- */
26
- digest() {
27
- const ret = wasm.blobmeta_digest(this.__wbg_ptr);
28
- return Digest.__wrap(ret);
29
- }
30
- /**
31
- * Create a `BlobMeta` from a digest and size.
32
- *
33
- * This is useful for deserialization when the original blob is not available.
34
- * Since this is manual, the caller must ensure the digest and size are correct.
35
- * @param {Digest} digest
36
- * @param {bigint} size_bytes
37
- * @returns {BlobMeta}
38
- */
39
- static fromDigestSize(digest, size_bytes) {
40
- _assertClass(digest, Digest);
41
- const ret = wasm.blobmeta_fromDigestSize(digest.__wbg_ptr, size_bytes);
42
- return BlobMeta.__wrap(ret);
43
- }
44
- /**
45
- * Create a new `BlobMeta` from the given blob contents.
46
- * @param {Uint8Array} blob
47
- */
48
- constructor(blob) {
49
- const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
50
- const len0 = WASM_VECTOR_LEN;
51
- const ret = wasm.blobmeta_new(ptr0, len0);
52
- this.__wbg_ptr = ret >>> 0;
53
- BlobMetaFinalization.register(this, this.__wbg_ptr, this);
54
- return this;
55
- }
56
- /**
57
- * Get the size of the blob in bytes.
58
- * @returns {bigint}
59
- */
60
- get sizeBytes() {
61
- const ret = wasm.blobmeta_sizeBytes(this.__wbg_ptr);
62
- return BigInt.asUintN(64, ret);
63
- }
64
- }
65
- if (Symbol.dispose) BlobMeta.prototype[Symbol.dispose] = BlobMeta.prototype.free;
66
-
67
- /**
68
- * A user-supplied opaque identifier for a loose commit.
69
- *
70
- * Unlike [`Digest`](crate::digest::WasmDigest), which is a content hash
71
- * computed by the system, `CommitId` is provided by the caller at construction
72
- * time. This is the identity used for DAG traversal, fragment boundaries,
73
- * and sync.
74
- */
75
- export class CommitId {
76
- static __wrap(ptr) {
77
- ptr = ptr >>> 0;
78
- const obj = Object.create(CommitId.prototype);
79
- obj.__wbg_ptr = ptr;
80
- CommitIdFinalization.register(obj, obj.__wbg_ptr, obj);
81
- return obj;
82
- }
83
- __destroy_into_raw() {
84
- const ptr = this.__wbg_ptr;
85
- this.__wbg_ptr = 0;
86
- CommitIdFinalization.unregister(this);
87
- return ptr;
88
- }
89
- free() {
90
- const ptr = this.__destroy_into_raw();
91
- wasm.__wbg_commitid_free(ptr, 0);
92
- }
93
- /**
94
- * Upcasts; to the JS-import type for [`WasmCommitId`].
95
- * @returns {CommitId}
96
- */
97
- __wasm_refgen_toWasmCommitId() {
98
- const ret = wasm.commitid___wasm_refgen_toWasmCommitId(this.__wbg_ptr);
99
- return CommitId.__wrap(ret);
100
- }
101
- /**
102
- * Creates a new commit identifier from its Base58 string representation.
103
- *
104
- * # Errors
105
- *
106
- * Returns an error if the string cannot be decoded or is not 32 bytes.
107
- * @param {string} s
108
- * @returns {CommitId}
109
- */
110
- static fromBase58(s) {
111
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
112
- const len0 = WASM_VECTOR_LEN;
113
- const ret = wasm.commitid_fromBase58(ptr0, len0);
114
- if (ret[2]) {
115
- throw takeFromExternrefTable0(ret[1]);
116
- }
117
- return CommitId.__wrap(ret[0]);
118
- }
119
- /**
120
- * Creates a new commit identifier from its byte representation.
121
- *
122
- * # Errors
123
- *
124
- * Returns an error if the byte slice is not exactly 32 bytes.
125
- * @param {Uint8Array} bytes
126
- * @returns {CommitId}
127
- */
128
- static fromBytes(bytes) {
129
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
130
- const len0 = WASM_VECTOR_LEN;
131
- const ret = wasm.commitid_fromBytes(ptr0, len0);
132
- if (ret[2]) {
133
- throw takeFromExternrefTable0(ret[1]);
134
- }
135
- return CommitId.__wrap(ret[0]);
136
- }
137
- /**
138
- * Creates a new commit identifier from its hexadecimal string representation.
139
- *
140
- * # Errors
141
- *
142
- * Returns an error if the string is not valid hex or not 32 bytes.
143
- * @param {string} s
144
- * @returns {CommitId}
145
- */
146
- static fromHexString(s) {
147
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
148
- const len0 = WASM_VECTOR_LEN;
149
- const ret = wasm.commitid_fromHexString(ptr0, len0);
150
- if (ret[2]) {
151
- throw takeFromExternrefTable0(ret[1]);
152
- }
153
- return CommitId.__wrap(ret[0]);
154
- }
155
- /**
156
- * Creates a new commit identifier from its byte representation.
157
- *
158
- * # Errors
159
- *
160
- * Returns an error if the byte slice is not exactly 32 bytes.
161
- * @param {Uint8Array} bytes
162
- */
163
- constructor(bytes) {
164
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
165
- const len0 = WASM_VECTOR_LEN;
166
- const ret = wasm.commitid_new(ptr0, len0);
167
- if (ret[2]) {
168
- throw takeFromExternrefTable0(ret[1]);
169
- }
170
- this.__wbg_ptr = ret[0] >>> 0;
171
- CommitIdFinalization.register(this, this.__wbg_ptr, this);
172
- return this;
173
- }
174
- /**
175
- * Returns the byte representation of the commit identifier.
176
- * @returns {Uint8Array}
177
- */
178
- toBytes() {
179
- const ret = wasm.commitid_toBytes(this.__wbg_ptr);
180
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
181
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
182
- return v1;
183
- }
184
- /**
185
- * Returns the hexadecimal string representation.
186
- * @returns {string}
187
- */
188
- toHexString() {
189
- let deferred1_0;
190
- let deferred1_1;
191
- try {
192
- const ret = wasm.commitid_toHexString(this.__wbg_ptr);
193
- deferred1_0 = ret[0];
194
- deferred1_1 = ret[1];
195
- return getStringFromWasm0(ret[0], ret[1]);
196
- } finally {
197
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
198
- }
199
- }
200
- }
201
- if (Symbol.dispose) CommitId.prototype[Symbol.dispose] = CommitId.prototype.free;
202
-
203
- /**
204
- * A commit stored with its associated blob.
205
- */
206
- export class CommitWithBlob {
207
- static __wrap(ptr) {
208
- ptr = ptr >>> 0;
209
- const obj = Object.create(CommitWithBlob.prototype);
210
- obj.__wbg_ptr = ptr;
211
- CommitWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
212
- return obj;
213
- }
214
- __destroy_into_raw() {
215
- const ptr = this.__wbg_ptr;
216
- this.__wbg_ptr = 0;
217
- CommitWithBlobFinalization.unregister(this);
218
- return ptr;
219
- }
220
- free() {
221
- const ptr = this.__destroy_into_raw();
222
- wasm.__wbg_commitwithblob_free(ptr, 0);
223
- }
224
- /**
225
- * Upcasts; to the JS-import type for [`WasmCommitWithBlob`].
226
- * @returns {CommitWithBlob}
227
- */
228
- __wasm_refgen_toWasmCommitWithBlob() {
229
- const ret = wasm.commitwithblob___wasm_refgen_toWasmCommitWithBlob(this.__wbg_ptr);
230
- return CommitWithBlob.__wrap(ret);
231
- }
232
- /**
233
- * Get the blob.
234
- * @returns {Uint8Array}
235
- */
236
- get blob() {
237
- const ret = wasm.commitwithblob_blob(this.__wbg_ptr);
238
- return ret;
239
- }
240
- /**
241
- * Create a new commit with blob.
242
- * @param {SignedLooseCommit} signed
243
- * @param {Uint8Array} blob
244
- */
245
- constructor(signed, blob) {
246
- _assertClass(signed, SignedLooseCommit);
247
- var ptr0 = signed.__destroy_into_raw();
248
- const ret = wasm.commitwithblob_new(ptr0, blob);
249
- this.__wbg_ptr = ret >>> 0;
250
- CommitWithBlobFinalization.register(this, this.__wbg_ptr, this);
251
- return this;
252
- }
253
- /**
254
- * Get the signed commit.
255
- * @returns {SignedLooseCommit}
256
- */
257
- get signed() {
258
- const ret = wasm.commitwithblob_signed(this.__wbg_ptr);
259
- return SignedLooseCommit.__wrap(ret);
260
- }
261
- }
262
- if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
263
-
264
- /**
265
- * A JavaScript wrapper around `Depth`.
266
- */
267
- export class Depth {
268
- static __wrap(ptr) {
269
- ptr = ptr >>> 0;
270
- const obj = Object.create(Depth.prototype);
271
- obj.__wbg_ptr = ptr;
272
- DepthFinalization.register(obj, obj.__wbg_ptr, obj);
273
- return obj;
274
- }
275
- __destroy_into_raw() {
276
- const ptr = this.__wbg_ptr;
277
- this.__wbg_ptr = 0;
278
- DepthFinalization.unregister(this);
279
- return ptr;
280
- }
281
- free() {
282
- const ptr = this.__destroy_into_raw();
283
- wasm.__wbg_depth_free(ptr, 0);
284
- }
285
- /**
286
- * Internal method for a hack crossing the JS boundary.
287
- * @returns {Depth}
288
- */
289
- __subduction_castToDepth() {
290
- const ret = wasm.depth___subduction_castToDepth(this.__wbg_ptr);
291
- return Depth.__wrap(ret);
292
- }
293
- /**
294
- * Upcasts; to the JS-import type for [`WasmDepth`].
295
- * @returns {Depth}
296
- */
297
- __wasm_refgen_toWasmDepth() {
298
- const ret = wasm.depth___wasm_refgen_toWasmDepth(this.__wbg_ptr);
299
- return Depth.__wrap(ret);
300
- }
301
- /**
302
- * Creates a new `WasmDepth` from a JavaScript value.
303
- *
304
- * # Errors
305
- *
306
- * Returns a `NotU32Error` if the JS value is not safely coercible to `u32`.
307
- * @param {any} js_value
308
- */
309
- constructor(js_value) {
310
- const ret = wasm.depth_new(js_value);
311
- if (ret[2]) {
312
- throw takeFromExternrefTable0(ret[1]);
313
- }
314
- this.__wbg_ptr = ret[0] >>> 0;
315
- DepthFinalization.register(this, this.__wbg_ptr, this);
316
- return this;
317
- }
318
- /**
319
- * The depth value as an integer.
320
- * @returns {number}
321
- */
322
- get value() {
323
- const ret = wasm.depth_value(this.__wbg_ptr);
324
- return ret >>> 0;
325
- }
326
- }
327
- if (Symbol.dispose) Depth.prototype[Symbol.dispose] = Depth.prototype.free;
328
-
329
- /**
330
- * A wrapper around digest bytes for use in JavaScript via wasm-bindgen.
331
- *
332
- * Since JavaScript doesn't have Rust's type system, this stores raw bytes
333
- * and converts to/from typed `Digest<T>` at the Rust boundary.
334
- */
335
- export class Digest {
336
- static __wrap(ptr) {
337
- ptr = ptr >>> 0;
338
- const obj = Object.create(Digest.prototype);
339
- obj.__wbg_ptr = ptr;
340
- DigestFinalization.register(obj, obj.__wbg_ptr, obj);
341
- return obj;
342
- }
343
- __destroy_into_raw() {
344
- const ptr = this.__wbg_ptr;
345
- this.__wbg_ptr = 0;
346
- DigestFinalization.unregister(this);
347
- return ptr;
348
- }
349
- free() {
350
- const ptr = this.__destroy_into_raw();
351
- wasm.__wbg_digest_free(ptr, 0);
352
- }
353
- /**
354
- * Upcasts; to the JS-import type for [`WasmDigest`].
355
- * @returns {Digest}
356
- */
357
- __wasm_refgen_toWasmDigest() {
358
- const ret = wasm.digest___wasm_refgen_toWasmDigest(this.__wbg_ptr);
359
- return Digest.__wrap(ret);
360
- }
361
- /**
362
- * Creates a new digest from its Base58 string representation.
363
- *
364
- * # Errors
365
- *
366
- * Returns a `WasmInvalidDigest` error if the string cannot be decoded or is not a valid digest.
367
- * @param {string} s
368
- * @returns {Digest}
369
- */
370
- static fromBase58(s) {
371
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
372
- const len0 = WASM_VECTOR_LEN;
373
- const ret = wasm.digest_fromBase58(ptr0, len0);
374
- if (ret[2]) {
375
- throw takeFromExternrefTable0(ret[1]);
376
- }
377
- return Digest.__wrap(ret[0]);
378
- }
379
- /**
380
- * Creates a new digest from its byte representation.
381
- *
382
- * # Errors
383
- *
384
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
385
- * @param {Uint8Array} bytes
386
- * @returns {Digest}
387
- */
388
- static fromBytes(bytes) {
389
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
390
- const len0 = WASM_VECTOR_LEN;
391
- const ret = wasm.digest_fromBytes(ptr0, len0);
392
- if (ret[2]) {
393
- throw takeFromExternrefTable0(ret[1]);
394
- }
395
- return Digest.__wrap(ret[0]);
396
- }
397
- /**
398
- * Creates a new digest from its hexadecimal string representation.
399
- *
400
- * # Errors
401
- *
402
- * Returns a [`WasmInvalidDigest`] if the string is not a valid digest.
403
- * @param {string} s
404
- * @returns {Digest}
405
- */
406
- static fromHexString(s) {
407
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
408
- const len0 = WASM_VECTOR_LEN;
409
- const ret = wasm.digest_fromHexString(ptr0, len0);
410
- if (ret[2]) {
411
- throw takeFromExternrefTable0(ret[1]);
412
- }
413
- return Digest.__wrap(ret[0]);
414
- }
415
- /**
416
- * Creates a new digest from its byte representation.
417
- *
418
- * # Errors
419
- *
420
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
421
- * @param {Uint8Array} bytes
422
- */
423
- constructor(bytes) {
424
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
425
- const len0 = WASM_VECTOR_LEN;
426
- const ret = wasm.digest_new(ptr0, len0);
427
- if (ret[2]) {
428
- throw takeFromExternrefTable0(ret[1]);
429
- }
430
- this.__wbg_ptr = ret[0] >>> 0;
431
- DigestFinalization.register(this, this.__wbg_ptr, this);
432
- return this;
433
- }
434
- /**
435
- * Returns the byte representation of the digest.
436
- * @returns {Uint8Array}
437
- */
438
- toBytes() {
439
- const ret = wasm.digest_toBytes(this.__wbg_ptr);
440
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
441
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
442
- return v1;
443
- }
444
- /**
445
- * Returns the hexadecimal string representation of the digest.
446
- * @returns {string}
447
- */
448
- toHexString() {
449
- let deferred1_0;
450
- let deferred1_1;
451
- try {
452
- const ret = wasm.digest_toHexString(this.__wbg_ptr);
453
- deferred1_0 = ret[0];
454
- deferred1_1 = ret[1];
455
- return getStringFromWasm0(ret[0], ret[1]);
456
- } finally {
457
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
458
- }
459
- }
460
- }
461
- if (Symbol.dispose) Digest.prototype[Symbol.dispose] = Digest.prototype.free;
462
-
463
- /**
464
- * A data fragment used in the Sedimentree system.
465
- */
466
- export class Fragment {
467
- static __wrap(ptr) {
468
- ptr = ptr >>> 0;
469
- const obj = Object.create(Fragment.prototype);
470
- obj.__wbg_ptr = ptr;
471
- FragmentFinalization.register(obj, obj.__wbg_ptr, obj);
472
- return obj;
473
- }
474
- __destroy_into_raw() {
475
- const ptr = this.__wbg_ptr;
476
- this.__wbg_ptr = 0;
477
- FragmentFinalization.unregister(this);
478
- return ptr;
479
- }
480
- free() {
481
- const ptr = this.__destroy_into_raw();
482
- wasm.__wbg_fragment_free(ptr, 0);
483
- }
484
- /**
485
- * Upcasts; to the JS-import type for [`WasmFragment`].
486
- * @returns {Fragment}
487
- */
488
- __wasm_refgen_toWasmFragment() {
489
- const ret = wasm.fragment___wasm_refgen_toWasmFragment(this.__wbg_ptr);
490
- return Fragment.__wrap(ret);
491
- }
492
- /**
493
- * Get the blob metadata of the fragment.
494
- * @returns {BlobMeta}
495
- */
496
- get blobMeta() {
497
- const ret = wasm.fragment_blobMeta(this.__wbg_ptr);
498
- return BlobMeta.__wrap(ret);
499
- }
500
- /**
501
- * Get the boundary commit identifiers of the fragment.
502
- * @returns {CommitId[]}
503
- */
504
- get boundary() {
505
- const ret = wasm.fragment_boundary(this.__wbg_ptr);
506
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
507
- wasm.__wbindgen_export6(ret[0], ret[1] * 4, 4);
508
- return v1;
509
- }
510
- /**
511
- * Get the head commit identifier of the fragment.
512
- * @returns {CommitId}
513
- */
514
- get head() {
515
- const ret = wasm.fragment_head(this.__wbg_ptr);
516
- return CommitId.__wrap(ret);
517
- }
518
- /**
519
- * Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
520
- * @param {SedimentreeId} sedimentree_id
521
- * @param {CommitId} head
522
- * @param {CommitId[]} boundary
523
- * @param {CommitId[]} checkpoints
524
- * @param {BlobMeta} blob_meta
525
- */
526
- constructor(sedimentree_id, head, boundary, checkpoints, blob_meta) {
527
- _assertClass(sedimentree_id, SedimentreeId);
528
- var ptr0 = sedimentree_id.__destroy_into_raw();
529
- _assertClass(head, CommitId);
530
- var ptr1 = head.__destroy_into_raw();
531
- const ptr2 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
532
- const len2 = WASM_VECTOR_LEN;
533
- const ptr3 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
534
- const len3 = WASM_VECTOR_LEN;
535
- _assertClass(blob_meta, BlobMeta);
536
- var ptr4 = blob_meta.__destroy_into_raw();
537
- const ret = wasm.fragment_new(ptr0, ptr1, ptr2, len2, ptr3, len3, ptr4);
538
- this.__wbg_ptr = ret >>> 0;
539
- FragmentFinalization.register(this, this.__wbg_ptr, this);
540
- return this;
541
- }
542
- }
543
- if (Symbol.dispose) Fragment.prototype[Symbol.dispose] = Fragment.prototype.free;
544
-
545
- /**
546
- * A fragment stored with its associated blob.
547
- */
548
- export class FragmentWithBlob {
549
- static __wrap(ptr) {
550
- ptr = ptr >>> 0;
551
- const obj = Object.create(FragmentWithBlob.prototype);
552
- obj.__wbg_ptr = ptr;
553
- FragmentWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
554
- return obj;
555
- }
556
- __destroy_into_raw() {
557
- const ptr = this.__wbg_ptr;
558
- this.__wbg_ptr = 0;
559
- FragmentWithBlobFinalization.unregister(this);
560
- return ptr;
561
- }
562
- free() {
563
- const ptr = this.__destroy_into_raw();
564
- wasm.__wbg_fragmentwithblob_free(ptr, 0);
565
- }
566
- /**
567
- * Upcasts; to the JS-import type for [`WasmFragmentWithBlob`].
568
- * @returns {FragmentWithBlob}
569
- */
570
- __wasm_refgen_toWasmFragmentWithBlob() {
571
- const ret = wasm.fragmentwithblob___wasm_refgen_toWasmFragmentWithBlob(this.__wbg_ptr);
572
- return FragmentWithBlob.__wrap(ret);
573
- }
574
- /**
575
- * Get the blob.
576
- * @returns {Uint8Array}
577
- */
578
- get blob() {
579
- const ret = wasm.fragmentwithblob_blob(this.__wbg_ptr);
580
- return ret;
581
- }
582
- /**
583
- * Create a new fragment with blob.
584
- * @param {SignedFragment} signed
585
- * @param {Uint8Array} blob
586
- */
587
- constructor(signed, blob) {
588
- _assertClass(signed, SignedFragment);
589
- var ptr0 = signed.__destroy_into_raw();
590
- const ret = wasm.fragmentwithblob_new(ptr0, blob);
591
- this.__wbg_ptr = ret >>> 0;
592
- FragmentWithBlobFinalization.register(this, this.__wbg_ptr, this);
593
- return this;
594
- }
595
- /**
596
- * Get the signed fragment.
597
- * @returns {SignedFragment}
598
- */
599
- get signed() {
600
- const ret = wasm.fragmentwithblob_signed(this.__wbg_ptr);
601
- return SignedFragment.__wrap(ret);
602
- }
603
- }
604
- if (Symbol.dispose) FragmentWithBlob.prototype[Symbol.dispose] = FragmentWithBlob.prototype.free;
605
-
606
- export class FragmentsArray {
607
- static __wrap(ptr) {
608
- ptr = ptr >>> 0;
609
- const obj = Object.create(FragmentsArray.prototype);
610
- obj.__wbg_ptr = ptr;
611
- FragmentsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
612
- return obj;
613
- }
614
- __destroy_into_raw() {
615
- const ptr = this.__wbg_ptr;
616
- this.__wbg_ptr = 0;
617
- FragmentsArrayFinalization.unregister(this);
618
- return ptr;
619
- }
620
- free() {
621
- const ptr = this.__destroy_into_raw();
622
- wasm.__wbg_fragmentsarray_free(ptr, 0);
623
- }
624
- /**
625
- * Upcasts; to the JS-import type for [`WasmFragmentsArray`].
626
- * @returns {FragmentsArray}
627
- */
628
- __wasm_refgen_toWasmFragmentsArray() {
629
- const ret = wasm.fragmentsarray___wasm_refgen_toWasmFragmentsArray(this.__wbg_ptr);
630
- return FragmentsArray.__wrap(ret);
631
- }
632
- }
633
- if (Symbol.dispose) FragmentsArray.prototype[Symbol.dispose] = FragmentsArray.prototype.free;
634
-
635
- /**
636
- * A Wasm wrapper around the [`LooseCommit`] type.
637
- */
638
- export class LooseCommit {
639
- static __wrap(ptr) {
640
- ptr = ptr >>> 0;
641
- const obj = Object.create(LooseCommit.prototype);
642
- obj.__wbg_ptr = ptr;
643
- LooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
644
- return obj;
645
- }
646
- __destroy_into_raw() {
647
- const ptr = this.__wbg_ptr;
648
- this.__wbg_ptr = 0;
649
- LooseCommitFinalization.unregister(this);
650
- return ptr;
651
- }
652
- free() {
653
- const ptr = this.__destroy_into_raw();
654
- wasm.__wbg_loosecommit_free(ptr, 0);
655
- }
656
- /**
657
- * Upcasts; to the JS-import type for [`WasmLooseCommit`].
658
- * @returns {LooseCommit}
659
- */
660
- __wasm_refgen_toWasmLooseCommit() {
661
- const ret = wasm.loosecommit___wasm_refgen_toWasmLooseCommit(this.__wbg_ptr);
662
- return LooseCommit.__wrap(ret);
663
- }
664
- /**
665
- * Get the blob metadata of the commit.
666
- * @returns {BlobMeta}
667
- */
668
- get blobMeta() {
669
- const ret = wasm.loosecommit_blobMeta(this.__wbg_ptr);
670
- return BlobMeta.__wrap(ret);
671
- }
672
- /**
673
- * Get the commit's head identifier.
674
- * @returns {CommitId}
675
- */
676
- get commitId() {
677
- const ret = wasm.loosecommit_commitId(this.__wbg_ptr);
678
- return CommitId.__wrap(ret);
679
- }
680
- /**
681
- * Get the digest of the commit (content hash).
682
- * @returns {Digest}
683
- */
684
- get digest() {
685
- const ret = wasm.loosecommit_digest(this.__wbg_ptr);
686
- return Digest.__wrap(ret);
687
- }
688
- /**
689
- * Create a new `LooseCommit` from the given sedimentree ID, head, parents, and blob metadata.
690
- * @param {SedimentreeId} sedimentree_id
691
- * @param {CommitId} head
692
- * @param {CommitId[]} parents
693
- * @param {BlobMeta} blob_meta
694
- */
695
- constructor(sedimentree_id, head, parents, blob_meta) {
696
- _assertClass(sedimentree_id, SedimentreeId);
697
- var ptr0 = sedimentree_id.__destroy_into_raw();
698
- _assertClass(head, CommitId);
699
- var ptr1 = head.__destroy_into_raw();
700
- const ptr2 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
701
- const len2 = WASM_VECTOR_LEN;
702
- _assertClass(blob_meta, BlobMeta);
703
- const ret = wasm.loosecommit_new(ptr0, ptr1, ptr2, len2, blob_meta.__wbg_ptr);
704
- this.__wbg_ptr = ret >>> 0;
705
- LooseCommitFinalization.register(this, this.__wbg_ptr, this);
706
- return this;
707
- }
708
- /**
709
- * Get the parent commit identifiers.
710
- * @returns {CommitId[]}
711
- */
712
- get parents() {
713
- const ret = wasm.loosecommit_parents(this.__wbg_ptr);
714
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
715
- wasm.__wbindgen_export6(ret[0], ret[1] * 4, 4);
716
- return v1;
717
- }
718
- }
719
- if (Symbol.dispose) LooseCommit.prototype[Symbol.dispose] = LooseCommit.prototype.free;
720
-
721
- /**
722
- * An in-memory storage implementation for use in tests and development.
723
- *
724
- * This wraps the core `MemoryStorage` and exposes it via the `SedimentreeStorage` interface.
725
- */
726
- export class MemoryStorage {
727
- __destroy_into_raw() {
728
- const ptr = this.__wbg_ptr;
729
- this.__wbg_ptr = 0;
730
- MemoryStorageFinalization.unregister(this);
731
- return ptr;
732
- }
733
- free() {
734
- const ptr = this.__destroy_into_raw();
735
- wasm.__wbg_memorystorage_free(ptr, 0);
736
- }
737
- /**
738
- * Delete all commits for a sedimentree.
739
- * @param {SedimentreeId} sedimentree_id
740
- * @returns {Promise<any>}
741
- */
742
- deleteAllCommits(sedimentree_id) {
743
- _assertClass(sedimentree_id, SedimentreeId);
744
- const ret = wasm.memorystorage_deleteAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
745
- return ret;
746
- }
747
- /**
748
- * Delete all fragments for a sedimentree.
749
- * @param {SedimentreeId} sedimentree_id
750
- * @returns {Promise<any>}
751
- */
752
- deleteAllFragments(sedimentree_id) {
753
- _assertClass(sedimentree_id, SedimentreeId);
754
- const ret = wasm.memorystorage_deleteAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
755
- return ret;
756
- }
757
- /**
758
- * Delete a single commit by its ID.
759
- * @param {SedimentreeId} sedimentree_id
760
- * @param {CommitId} commit_id
761
- * @returns {Promise<any>}
762
- */
763
- deleteCommit(sedimentree_id, commit_id) {
764
- _assertClass(sedimentree_id, SedimentreeId);
765
- _assertClass(commit_id, CommitId);
766
- const ret = wasm.memorystorage_deleteCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr);
767
- return ret;
768
- }
769
- /**
770
- * Delete a fragment by its identifier.
771
- * @param {SedimentreeId} sedimentree_id
772
- * @param {CommitId} fragment_head
773
- * @returns {Promise<any>}
774
- */
775
- deleteFragment(sedimentree_id, fragment_head) {
776
- _assertClass(sedimentree_id, SedimentreeId);
777
- _assertClass(fragment_head, CommitId);
778
- const ret = wasm.memorystorage_deleteFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, fragment_head.__wbg_ptr);
779
- return ret;
780
- }
781
- /**
782
- * Delete a sedimentree ID.
783
- * @param {SedimentreeId} sedimentree_id
784
- * @returns {Promise<any>}
785
- */
786
- deleteSedimentreeId(sedimentree_id) {
787
- _assertClass(sedimentree_id, SedimentreeId);
788
- const ret = wasm.memorystorage_deleteSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
789
- return ret;
790
- }
791
- /**
792
- * List all commit IDs for a sedimentree.
793
- * @param {SedimentreeId} sedimentree_id
794
- * @returns {Promise<any>}
795
- */
796
- listCommitIds(sedimentree_id) {
797
- _assertClass(sedimentree_id, SedimentreeId);
798
- const ret = wasm.memorystorage_listCommitIds(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
799
- return ret;
800
- }
801
- /**
802
- * List all fragment IDs for a sedimentree.
803
- * @param {SedimentreeId} sedimentree_id
804
- * @returns {Promise<any>}
805
- */
806
- listFragmentIds(sedimentree_id) {
807
- _assertClass(sedimentree_id, SedimentreeId);
808
- const ret = wasm.memorystorage_listFragmentIds(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
809
- return ret;
810
- }
811
- /**
812
- * Load all commits for a sedimentree, returning `CommitWithBlob[]`.
813
- * @param {SedimentreeId} sedimentree_id
814
- * @returns {Promise<any>}
815
- */
816
- loadAllCommits(sedimentree_id) {
817
- _assertClass(sedimentree_id, SedimentreeId);
818
- const ret = wasm.memorystorage_loadAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
819
- return ret;
820
- }
821
- /**
822
- * Load all fragments for a sedimentree, returning `FragmentWithBlob[]`.
823
- * @param {SedimentreeId} sedimentree_id
824
- * @returns {Promise<any>}
825
- */
826
- loadAllFragments(sedimentree_id) {
827
- _assertClass(sedimentree_id, SedimentreeId);
828
- const ret = wasm.memorystorage_loadAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
829
- return ret;
830
- }
831
- /**
832
- * Load all sedimentree IDs.
833
- * @returns {Promise<any>}
834
- */
835
- loadAllSedimentreeIds() {
836
- const ret = wasm.memorystorage_loadAllSedimentreeIds(this.__wbg_ptr);
837
- return ret;
838
- }
839
- /**
840
- * Load a single commit by its ID, returning `CommitWithBlob` or null.
841
- * @param {SedimentreeId} sedimentree_id
842
- * @param {CommitId} commit_id
843
- * @returns {Promise<any>}
844
- */
845
- loadCommit(sedimentree_id, commit_id) {
846
- _assertClass(sedimentree_id, SedimentreeId);
847
- _assertClass(commit_id, CommitId);
848
- const ret = wasm.memorystorage_loadCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr);
849
- return ret;
850
- }
851
- /**
852
- * Load a fragment by its identifier, returning `FragmentWithBlob` or null.
853
- * @param {SedimentreeId} sedimentree_id
854
- * @param {CommitId} fragment_head
855
- * @returns {Promise<any>}
856
- */
857
- loadFragment(sedimentree_id, fragment_head) {
858
- _assertClass(sedimentree_id, SedimentreeId);
859
- _assertClass(fragment_head, CommitId);
860
- const ret = wasm.memorystorage_loadFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, fragment_head.__wbg_ptr);
861
- return ret;
862
- }
863
- /**
864
- * Create a new in-memory storage instance.
865
- */
866
- constructor() {
867
- const ret = wasm.memorystorage_new();
868
- this.__wbg_ptr = ret >>> 0;
869
- MemoryStorageFinalization.register(this, this.__wbg_ptr, this);
870
- return this;
871
- }
872
- /**
873
- * Save commits and fragments in a single batch.
874
- * @param {SedimentreeId} sedimentree_id
875
- * @param {Array<any>} commits
876
- * @param {Array<any>} fragments
877
- * @returns {Promise<any>}
878
- */
879
- saveBatchAll(sedimentree_id, commits, fragments) {
880
- _assertClass(sedimentree_id, SedimentreeId);
881
- const ret = wasm.memorystorage_saveBatchAll(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commits, fragments);
882
- return ret;
883
- }
884
- /**
885
- * Save a commit with its blob.
886
- *
887
- * The `commit_id` parameter must match the `head()` embedded in
888
- * the signed commit payload. Returns an error if they differ.
889
- *
890
- * # Errors
891
- *
892
- * Returns a JS error if:
893
- * - The signed payload cannot be decoded
894
- * - The `commit_id` does not match the embedded `head()`
895
- * @param {SedimentreeId} sedimentree_id
896
- * @param {CommitId} commit_id
897
- * @param {SignedLooseCommit} signed_commit
898
- * @param {Uint8Array} blob
899
- * @returns {Promise<any>}
900
- */
901
- saveCommit(sedimentree_id, commit_id, signed_commit, blob) {
902
- _assertClass(sedimentree_id, SedimentreeId);
903
- _assertClass(commit_id, CommitId);
904
- _assertClass(signed_commit, SignedLooseCommit);
905
- const ret = wasm.memorystorage_saveCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr, signed_commit.__wbg_ptr, blob);
906
- return ret;
907
- }
908
- /**
909
- * Save a fragment with its blob.
910
- * @param {SedimentreeId} sedimentree_id
911
- * @param {CommitId} _fragment_head
912
- * @param {SignedFragment} signed_fragment
913
- * @param {Uint8Array} blob
914
- * @returns {Promise<any>}
915
- */
916
- saveFragment(sedimentree_id, _fragment_head, signed_fragment, blob) {
917
- _assertClass(sedimentree_id, SedimentreeId);
918
- _assertClass(_fragment_head, CommitId);
919
- _assertClass(signed_fragment, SignedFragment);
920
- const ret = wasm.memorystorage_saveFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _fragment_head.__wbg_ptr, signed_fragment.__wbg_ptr, blob);
921
- return ret;
922
- }
923
- /**
924
- * Save a sedimentree ID.
925
- * @param {SedimentreeId} sedimentree_id
926
- * @returns {Promise<any>}
927
- */
928
- saveSedimentreeId(sedimentree_id) {
929
- _assertClass(sedimentree_id, SedimentreeId);
930
- const ret = wasm.memorystorage_saveSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
931
- return ret;
932
- }
933
- }
934
- if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prototype.free;
935
-
936
- /**
937
- * The main Sedimentree data structure.
938
- */
939
- export class Sedimentree {
940
- static __wrap(ptr) {
941
- ptr = ptr >>> 0;
942
- const obj = Object.create(Sedimentree.prototype);
943
- obj.__wbg_ptr = ptr;
944
- SedimentreeFinalization.register(obj, obj.__wbg_ptr, obj);
945
- return obj;
946
- }
947
- __destroy_into_raw() {
948
- const ptr = this.__wbg_ptr;
949
- this.__wbg_ptr = 0;
950
- SedimentreeFinalization.unregister(this);
951
- return ptr;
952
- }
953
- free() {
954
- const ptr = this.__destroy_into_raw();
955
- wasm.__wbg_sedimentree_free(ptr, 0);
956
- }
957
- /**
958
- * Create an empty Sedimentree.
959
- * @returns {Sedimentree}
960
- */
961
- static empty() {
962
- const ret = wasm.sedimentree_empty();
963
- return Sedimentree.__wrap(ret);
964
- }
965
- /**
966
- * Create a new Sedimentree from fragments and loose commits.
967
- * @param {Fragment[]} fragments
968
- * @param {LooseCommit[]} commits
969
- */
970
- constructor(fragments, commits) {
971
- const ptr0 = passArrayJsValueToWasm0(fragments, wasm.__wbindgen_export);
972
- const len0 = WASM_VECTOR_LEN;
973
- const ptr1 = passArrayJsValueToWasm0(commits, wasm.__wbindgen_export);
974
- const len1 = WASM_VECTOR_LEN;
975
- const ret = wasm.sedimentree_new(ptr0, len0, ptr1, len1);
976
- this.__wbg_ptr = ret >>> 0;
977
- SedimentreeFinalization.register(this, this.__wbg_ptr, this);
978
- return this;
979
- }
980
- }
981
- if (Symbol.dispose) Sedimentree.prototype[Symbol.dispose] = Sedimentree.prototype.free;
982
-
983
- /**
984
- * A Wasm wrapper around the [`SedimentreeId`] type.
985
- */
986
- export class SedimentreeId {
987
- static __wrap(ptr) {
988
- ptr = ptr >>> 0;
989
- const obj = Object.create(SedimentreeId.prototype);
990
- obj.__wbg_ptr = ptr;
991
- SedimentreeIdFinalization.register(obj, obj.__wbg_ptr, obj);
992
- return obj;
993
- }
994
- __destroy_into_raw() {
995
- const ptr = this.__wbg_ptr;
996
- this.__wbg_ptr = 0;
997
- SedimentreeIdFinalization.unregister(this);
998
- return ptr;
999
- }
1000
- free() {
1001
- const ptr = this.__destroy_into_raw();
1002
- wasm.__wbg_sedimentreeid_free(ptr, 0);
1003
- }
1004
- /**
1005
- * Upcasts; to the JS-import type for [`WasmSedimentreeId`].
1006
- * @returns {SedimentreeId}
1007
- */
1008
- __wasm_refgen_toWasmSedimentreeId() {
1009
- const ret = wasm.sedimentreeid___wasm_refgen_toWasmSedimentreeId(this.__wbg_ptr);
1010
- return SedimentreeId.__wrap(ret);
1011
- }
1012
- /**
1013
- * Create an ID from a byte array.
1014
- *
1015
- * # Errors
1016
- *
1017
- * Returns `Not32Bytes` if the provided byte array is not exactly 32 bytes long.
1018
- * @param {Uint8Array} bytes
1019
- * @returns {SedimentreeId}
1020
- */
1021
- static fromBytes(bytes) {
1022
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1023
- const len0 = WASM_VECTOR_LEN;
1024
- const ret = wasm.sedimentreeid_fromBytes(ptr0, len0);
1025
- if (ret[2]) {
1026
- throw takeFromExternrefTable0(ret[1]);
1027
- }
1028
- return SedimentreeId.__wrap(ret[0]);
1029
- }
1030
- /**
1031
- * Returns the raw bytes of this ID.
1032
- * @returns {Uint8Array}
1033
- */
1034
- toBytes() {
1035
- const ret = wasm.sedimentreeid_toBytes(this.__wbg_ptr);
1036
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1037
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
1038
- return v1;
1039
- }
1040
- /**
1041
- * Returns the string representation of the ID.
1042
- * @returns {string}
1043
- */
1044
- toString() {
1045
- let deferred1_0;
1046
- let deferred1_1;
1047
- try {
1048
- const ret = wasm.sedimentreeid_toString(this.__wbg_ptr);
1049
- deferred1_0 = ret[0];
1050
- deferred1_1 = ret[1];
1051
- return getStringFromWasm0(ret[0], ret[1]);
1052
- } finally {
1053
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
1054
- }
1055
- }
1056
- }
1057
- if (Symbol.dispose) SedimentreeId.prototype[Symbol.dispose] = SedimentreeId.prototype.free;
1058
-
1059
- export class SedimentreeIdsArray {
1060
- static __wrap(ptr) {
1061
- ptr = ptr >>> 0;
1062
- const obj = Object.create(SedimentreeIdsArray.prototype);
1063
- obj.__wbg_ptr = ptr;
1064
- SedimentreeIdsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
1065
- return obj;
1066
- }
1067
- __destroy_into_raw() {
1068
- const ptr = this.__wbg_ptr;
1069
- this.__wbg_ptr = 0;
1070
- SedimentreeIdsArrayFinalization.unregister(this);
1071
- return ptr;
1072
- }
1073
- free() {
1074
- const ptr = this.__destroy_into_raw();
1075
- wasm.__wbg_sedimentreeidsarray_free(ptr, 0);
1076
- }
1077
- /**
1078
- * Upcasts; to the JS-import type for [`WasmSedimentreeIdsArray`].
1079
- * @returns {SedimentreeIdsArray}
1080
- */
1081
- __wasm_refgen_toWasmSedimentreeIdsArray() {
1082
- const ret = wasm.sedimentreeidsarray___wasm_refgen_toWasmSedimentreeIdsArray(this.__wbg_ptr);
1083
- return SedimentreeIdsArray.__wrap(ret);
1084
- }
1085
- }
1086
- if (Symbol.dispose) SedimentreeIdsArray.prototype[Symbol.dispose] = SedimentreeIdsArray.prototype.free;
1087
-
1088
- /**
1089
- * A Wasm wrapper around `Signed<Fragment>`.
1090
- */
1091
- export class SignedFragment {
1092
- static __wrap(ptr) {
1093
- ptr = ptr >>> 0;
1094
- const obj = Object.create(SignedFragment.prototype);
1095
- obj.__wbg_ptr = ptr;
1096
- SignedFragmentFinalization.register(obj, obj.__wbg_ptr, obj);
1097
- return obj;
1098
- }
1099
- static __unwrap(jsValue) {
1100
- if (!(jsValue instanceof SignedFragment)) {
1101
- return 0;
1102
- }
1103
- return jsValue.__destroy_into_raw();
1104
- }
1105
- __destroy_into_raw() {
1106
- const ptr = this.__wbg_ptr;
1107
- this.__wbg_ptr = 0;
1108
- SignedFragmentFinalization.unregister(this);
1109
- return ptr;
1110
- }
1111
- free() {
1112
- const ptr = this.__destroy_into_raw();
1113
- wasm.__wbg_signedfragment_free(ptr, 0);
1114
- }
1115
- /**
1116
- * Upcasts; to the JS-import type for [`WasmSignedFragment`].
1117
- * @returns {SignedFragment}
1118
- */
1119
- __wasm_refgen_toWasmSignedFragment() {
1120
- const ret = wasm.signedfragment___wasm_refgen_toWasmSignedFragment(this.__wbg_ptr);
1121
- return SignedFragment.__wrap(ret);
1122
- }
1123
- /**
1124
- * Encode this signed fragment to raw bytes.
1125
- * @returns {Uint8Array}
1126
- */
1127
- encode() {
1128
- const ret = wasm.signedfragment_encode(this.__wbg_ptr);
1129
- return ret;
1130
- }
1131
- /**
1132
- * Get the unsigned payload without re-verifying the signature.
1133
- *
1134
- * # Errors
1135
- *
1136
- * Returns an error if the payload cannot be decoded.
1137
- * @returns {Fragment}
1138
- */
1139
- get payload() {
1140
- const ret = wasm.signedfragment_payload(this.__wbg_ptr);
1141
- if (ret[2]) {
1142
- throw takeFromExternrefTable0(ret[1]);
1143
- }
1144
- return Fragment.__wrap(ret[0]);
1145
- }
1146
- /**
1147
- * Decode a `SignedFragment` from raw bytes.
1148
- *
1149
- * # Errors
1150
- *
1151
- * Returns an error if the bytes are not a valid signed fragment.
1152
- * @param {Uint8Array} bytes
1153
- * @returns {SignedFragment}
1154
- */
1155
- static tryDecode(bytes) {
1156
- const ret = wasm.signedfragment_tryDecode(bytes);
1157
- if (ret[2]) {
1158
- throw takeFromExternrefTable0(ret[1]);
1159
- }
1160
- return SignedFragment.__wrap(ret[0]);
1161
- }
1162
- }
1163
- if (Symbol.dispose) SignedFragment.prototype[Symbol.dispose] = SignedFragment.prototype.free;
1164
-
1165
- /**
1166
- * A Wasm wrapper around `Signed<LooseCommit>`.
1167
- */
1168
- export class SignedLooseCommit {
1169
- static __wrap(ptr) {
1170
- ptr = ptr >>> 0;
1171
- const obj = Object.create(SignedLooseCommit.prototype);
1172
- obj.__wbg_ptr = ptr;
1173
- SignedLooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
1174
- return obj;
1175
- }
1176
- static __unwrap(jsValue) {
1177
- if (!(jsValue instanceof SignedLooseCommit)) {
1178
- return 0;
1179
- }
1180
- return jsValue.__destroy_into_raw();
1181
- }
1182
- __destroy_into_raw() {
1183
- const ptr = this.__wbg_ptr;
1184
- this.__wbg_ptr = 0;
1185
- SignedLooseCommitFinalization.unregister(this);
1186
- return ptr;
1187
- }
1188
- free() {
1189
- const ptr = this.__destroy_into_raw();
1190
- wasm.__wbg_signedloosecommit_free(ptr, 0);
1191
- }
1192
- /**
1193
- * Upcasts; to the JS-import type for [`WasmSignedLooseCommit`].
1194
- * @returns {SignedLooseCommit}
1195
- */
1196
- __wasm_refgen_toWasmSignedLooseCommit() {
1197
- const ret = wasm.signedloosecommit___wasm_refgen_toWasmSignedLooseCommit(this.__wbg_ptr);
1198
- return SignedLooseCommit.__wrap(ret);
1199
- }
1200
- /**
1201
- * Encode this signed loose commit to raw bytes.
1202
- * @returns {Uint8Array}
1203
- */
1204
- encode() {
1205
- const ret = wasm.signedloosecommit_encode(this.__wbg_ptr);
1206
- return ret;
1207
- }
1208
- /**
1209
- * Get the unsigned payload without re-verifying the signature.
1210
- *
1211
- * # Errors
1212
- *
1213
- * Returns an error if the payload cannot be decoded.
1214
- * @returns {LooseCommit}
1215
- */
1216
- get payload() {
1217
- const ret = wasm.signedloosecommit_payload(this.__wbg_ptr);
1218
- if (ret[2]) {
1219
- throw takeFromExternrefTable0(ret[1]);
1220
- }
1221
- return LooseCommit.__wrap(ret[0]);
1222
- }
1223
- /**
1224
- * Decode a `SignedLooseCommit` from raw bytes.
1225
- *
1226
- * # Errors
1227
- *
1228
- * Returns an error if the bytes are not a valid signed loose commit.
1229
- * @param {Uint8Array} bytes
1230
- * @returns {SignedLooseCommit}
1231
- */
1232
- static tryDecode(bytes) {
1233
- const ret = wasm.signedloosecommit_tryDecode(bytes);
1234
- if (ret[2]) {
1235
- throw takeFromExternrefTable0(ret[1]);
1236
- }
1237
- return SignedLooseCommit.__wrap(ret[0]);
1238
- }
1239
- }
1240
- if (Symbol.dispose) SignedLooseCommit.prototype[Symbol.dispose] = SignedLooseCommit.prototype.free;
1241
- export function __wbg___wasm_refgen_toWasmCommitId_65b818e358f27de6(arg0) {
1242
- const ret = arg0.__wasm_refgen_toWasmCommitId();
1243
- _assertClass(ret, CommitId);
1244
- var ptr1 = ret.__destroy_into_raw();
1245
- return ptr1;
1246
- }
1247
- export function __wbg___wasm_refgen_toWasmFragment_38ddb9958dbdc455(arg0) {
1248
- const ret = arg0.__wasm_refgen_toWasmFragment();
1249
- _assertClass(ret, Fragment);
1250
- var ptr1 = ret.__destroy_into_raw();
1251
- return ptr1;
1252
- }
1253
- export function __wbg___wasm_refgen_toWasmLooseCommit_876edb05490f6350(arg0) {
1254
- const ret = arg0.__wasm_refgen_toWasmLooseCommit();
1255
- _assertClass(ret, LooseCommit);
1256
- var ptr1 = ret.__destroy_into_raw();
1257
- return ptr1;
1258
- }
1259
- export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
1260
- const ret = debugString(arg1);
1261
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1262
- const len1 = WASM_VECTOR_LEN;
1263
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1264
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1265
- }
1266
- export function __wbg___wbindgen_is_function_3c846841762788c1(arg0) {
1267
- const ret = typeof(arg0) === 'function';
1268
- return ret;
1269
- }
1270
- export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
1271
- const ret = arg0 === undefined;
1272
- return ret;
1273
- }
1274
- export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
1275
- const obj = arg1;
1276
- const ret = typeof(obj) === 'number' ? obj : undefined;
1277
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1278
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1279
- }
1280
- export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
1281
- throw new Error(getStringFromWasm0(arg0, arg1));
1282
- }
1283
- export function __wbg__wbg_cb_unref_6b5b6b8576d35cb1(arg0) {
1284
- arg0._wbg_cb_unref();
1285
- }
1286
- export function __wbg_call_2d781c1f4d5c0ef8() { return handleError(function (arg0, arg1, arg2) {
1287
- const ret = arg0.call(arg1, arg2);
1288
- return ret;
1289
- }, arguments); }
1290
- export function __wbg_commitid_new(arg0) {
1291
- const ret = CommitId.__wrap(arg0);
1292
- return ret;
1293
- }
1294
- export function __wbg_commitwithblob_new(arg0) {
1295
- const ret = CommitWithBlob.__wrap(arg0);
1296
- return ret;
1297
- }
1298
- export function __wbg_fragmentwithblob_new(arg0) {
1299
- const ret = FragmentWithBlob.__wrap(arg0);
1300
- return ret;
1301
- }
1302
- export function __wbg_get_3ef1eba1850ade27() { return handleError(function (arg0, arg1) {
1303
- const ret = Reflect.get(arg0, arg1);
1304
- return ret;
1305
- }, arguments); }
1306
- export function __wbg_get_unchecked_329cfe50afab7352(arg0, arg1) {
1307
- const ret = arg0[arg1 >>> 0];
1308
- return ret;
1309
- }
1310
- export function __wbg_isSafeInteger_ecd6a7f9c3e053cd(arg0) {
1311
- const ret = Number.isSafeInteger(arg0);
1312
- return ret;
1313
- }
1314
- export function __wbg_length_b3416cf66a5452c8(arg0) {
1315
- const ret = arg0.length;
1316
- return ret;
1317
- }
1318
- export function __wbg_length_ea16607d7b61445b(arg0) {
1319
- const ret = arg0.length;
1320
- return ret;
1321
- }
1322
- export function __wbg_new_5f486cdf45a04d78(arg0) {
1323
- const ret = new Uint8Array(arg0);
1324
- return ret;
1325
- }
1326
- export function __wbg_new_a70fbab9066b301f() {
1327
- const ret = new Array();
1328
- return ret;
1329
- }
1330
- export function __wbg_new_d15cb560a6a0e5f0(arg0, arg1) {
1331
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1332
- return ret;
1333
- }
1334
- export function __wbg_new_from_slice_22da9388ac046e50(arg0, arg1) {
1335
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1336
- return ret;
1337
- }
1338
- export function __wbg_new_typed_aaaeaf29cf802876(arg0, arg1) {
1339
- try {
1340
- var state0 = {a: arg0, b: arg1};
1341
- var cb0 = (arg0, arg1) => {
1342
- const a = state0.a;
1343
- state0.a = 0;
1344
- try {
1345
- return __wasm_bindgen_func_elem_563_75(a, state0.b, arg0, arg1);
1346
- } finally {
1347
- state0.a = a;
1348
- }
1349
- };
1350
- const ret = new Promise(cb0);
1351
- return ret;
1352
- } finally {
1353
- state0.a = state0.b = 0;
1354
- }
1355
- }
1356
- export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
1357
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1358
- }
1359
- export function __wbg_push_e87b0e732085a946(arg0, arg1) {
1360
- const ret = arg0.push(arg1);
1361
- return ret;
1362
- }
1363
- export function __wbg_queueMicrotask_0c399741342fb10f(arg0) {
1364
- const ret = arg0.queueMicrotask;
1365
- return ret;
1366
- }
1367
- export function __wbg_queueMicrotask_a082d78ce798393e(arg0) {
1368
- queueMicrotask(arg0);
1369
- }
1370
- export function __wbg_resolve_ae8d83246e5bcc12(arg0) {
1371
- const ret = Promise.resolve(arg0);
1372
- return ret;
1373
- }
1374
- export function __wbg_sedimentreeid_new(arg0) {
1375
- const ret = SedimentreeId.__wrap(arg0);
1376
- return ret;
1377
- }
1378
- export function __wbg_set_name_7ef37fe858379aaf(arg0, arg1, arg2) {
1379
- arg0.name = getStringFromWasm0(arg1, arg2);
1380
- }
1381
- export function __wbg_signedfragment_unwrap(arg0) {
1382
- const ret = SignedFragment.__unwrap(arg0);
1383
- return ret;
1384
- }
1385
- export function __wbg_signedloosecommit_unwrap(arg0) {
1386
- const ret = SignedLooseCommit.__unwrap(arg0);
1387
- return ret;
1388
- }
1389
- export function __wbg_static_accessor_GLOBAL_8adb955bd33fac2f() {
1390
- const ret = typeof global === 'undefined' ? null : global;
1391
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1392
- }
1393
- export function __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913() {
1394
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1395
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1396
- }
1397
- export function __wbg_static_accessor_SELF_f207c857566db248() {
1398
- const ret = typeof self === 'undefined' ? null : self;
1399
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1400
- }
1401
- export function __wbg_static_accessor_WINDOW_bb9f1ba69d61b386() {
1402
- const ret = typeof window === 'undefined' ? null : window;
1403
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1404
- }
1405
- export function __wbg_then_098abe61755d12f6(arg0, arg1) {
1406
- const ret = arg0.then(arg1);
1407
- return ret;
1408
- }
1409
- export function __wbindgen_cast_0000000000000001(arg0, arg1) {
1410
- // Cast intrinsic for `Closure(Closure { dtor_idx: 73, function: Function { arguments: [Externref], shim_idx: 136, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1411
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_400, __wasm_bindgen_func_elem_563);
1412
- return ret;
1413
- }
1414
- export function __wbindgen_cast_0000000000000002(arg0) {
1415
- // Cast intrinsic for `F64 -> Externref`.
1416
- const ret = arg0;
1417
- return ret;
1418
- }
1419
- export function __wbindgen_cast_0000000000000003(arg0, arg1) {
1420
- // Cast intrinsic for `Ref(String) -> Externref`.
1421
- const ret = getStringFromWasm0(arg0, arg1);
1422
- return ret;
1423
- }
1424
- export function __wbindgen_init_externref_table() {
1425
- const table = wasm.__wbindgen_externrefs;
1426
- const offset = table.grow(4);
1427
- table.set(0, undefined);
1428
- table.set(offset + 0, undefined);
1429
- table.set(offset + 1, null);
1430
- table.set(offset + 2, true);
1431
- table.set(offset + 3, false);
1432
- }
1433
- function __wasm_bindgen_func_elem_563(arg0, arg1, arg2) {
1434
- const ret = wasm.__wasm_bindgen_func_elem_563(arg0, arg1, arg2);
1435
- if (ret[1]) {
1436
- throw takeFromExternrefTable0(ret[0]);
1437
- }
1438
- }
1439
-
1440
- function __wasm_bindgen_func_elem_563_75(arg0, arg1, arg2, arg3) {
1441
- wasm.__wasm_bindgen_func_elem_563_75(arg0, arg1, arg2, arg3);
1442
- }
1443
-
1444
- const MemoryStorageFinalization = (typeof FinalizationRegistry === 'undefined')
1445
- ? { register: () => {}, unregister: () => {} }
1446
- : new FinalizationRegistry(ptr => wasm.__wbg_memorystorage_free(ptr >>> 0, 1));
1447
- const BlobMetaFinalization = (typeof FinalizationRegistry === 'undefined')
1448
- ? { register: () => {}, unregister: () => {} }
1449
- : new FinalizationRegistry(ptr => wasm.__wbg_blobmeta_free(ptr >>> 0, 1));
1450
- const CommitIdFinalization = (typeof FinalizationRegistry === 'undefined')
1451
- ? { register: () => {}, unregister: () => {} }
1452
- : new FinalizationRegistry(ptr => wasm.__wbg_commitid_free(ptr >>> 0, 1));
1453
- const CommitWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
1454
- ? { register: () => {}, unregister: () => {} }
1455
- : new FinalizationRegistry(ptr => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
1456
- const DepthFinalization = (typeof FinalizationRegistry === 'undefined')
1457
- ? { register: () => {}, unregister: () => {} }
1458
- : new FinalizationRegistry(ptr => wasm.__wbg_depth_free(ptr >>> 0, 1));
1459
- const DigestFinalization = (typeof FinalizationRegistry === 'undefined')
1460
- ? { register: () => {}, unregister: () => {} }
1461
- : new FinalizationRegistry(ptr => wasm.__wbg_digest_free(ptr >>> 0, 1));
1462
- const FragmentFinalization = (typeof FinalizationRegistry === 'undefined')
1463
- ? { register: () => {}, unregister: () => {} }
1464
- : new FinalizationRegistry(ptr => wasm.__wbg_fragment_free(ptr >>> 0, 1));
1465
- const FragmentWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
1466
- ? { register: () => {}, unregister: () => {} }
1467
- : new FinalizationRegistry(ptr => wasm.__wbg_fragmentwithblob_free(ptr >>> 0, 1));
1468
- const FragmentsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
1469
- ? { register: () => {}, unregister: () => {} }
1470
- : new FinalizationRegistry(ptr => wasm.__wbg_fragmentsarray_free(ptr >>> 0, 1));
1471
- const LooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
1472
- ? { register: () => {}, unregister: () => {} }
1473
- : new FinalizationRegistry(ptr => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
1474
- const SedimentreeFinalization = (typeof FinalizationRegistry === 'undefined')
1475
- ? { register: () => {}, unregister: () => {} }
1476
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentree_free(ptr >>> 0, 1));
1477
- const SedimentreeIdFinalization = (typeof FinalizationRegistry === 'undefined')
1478
- ? { register: () => {}, unregister: () => {} }
1479
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeid_free(ptr >>> 0, 1));
1480
- const SedimentreeIdsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
1481
- ? { register: () => {}, unregister: () => {} }
1482
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeidsarray_free(ptr >>> 0, 1));
1483
- const SignedFragmentFinalization = (typeof FinalizationRegistry === 'undefined')
1484
- ? { register: () => {}, unregister: () => {} }
1485
- : new FinalizationRegistry(ptr => wasm.__wbg_signedfragment_free(ptr >>> 0, 1));
1486
- const SignedLooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
1487
- ? { register: () => {}, unregister: () => {} }
1488
- : new FinalizationRegistry(ptr => wasm.__wbg_signedloosecommit_free(ptr >>> 0, 1));
1489
-
1490
- function addToExternrefTable0(obj) {
1491
- const idx = wasm.__wbindgen_export4();
1492
- wasm.__wbindgen_externrefs.set(idx, obj);
1493
- return idx;
1494
- }
1495
-
1496
- function _assertClass(instance, klass) {
1497
- if (!(instance instanceof klass)) {
1498
- throw new Error(`expected instance of ${klass.name}`);
1499
- }
1500
- }
1501
-
1502
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1503
- ? { register: () => {}, unregister: () => {} }
1504
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1505
-
1506
- function debugString(val) {
1507
- // primitive types
1508
- const type = typeof val;
1509
- if (type == 'number' || type == 'boolean' || val == null) {
1510
- return `${val}`;
1511
- }
1512
- if (type == 'string') {
1513
- return `"${val}"`;
1514
- }
1515
- if (type == 'symbol') {
1516
- const description = val.description;
1517
- if (description == null) {
1518
- return 'Symbol';
1519
- } else {
1520
- return `Symbol(${description})`;
1521
- }
1522
- }
1523
- if (type == 'function') {
1524
- const name = val.name;
1525
- if (typeof name == 'string' && name.length > 0) {
1526
- return `Function(${name})`;
1527
- } else {
1528
- return 'Function';
1529
- }
1530
- }
1531
- // objects
1532
- if (Array.isArray(val)) {
1533
- const length = val.length;
1534
- let debug = '[';
1535
- if (length > 0) {
1536
- debug += debugString(val[0]);
1537
- }
1538
- for(let i = 1; i < length; i++) {
1539
- debug += ', ' + debugString(val[i]);
1540
- }
1541
- debug += ']';
1542
- return debug;
1543
- }
1544
- // Test for built-in
1545
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1546
- let className;
1547
- if (builtInMatches && builtInMatches.length > 1) {
1548
- className = builtInMatches[1];
1549
- } else {
1550
- // Failed to match the standard '[object ClassName]'
1551
- return toString.call(val);
1552
- }
1553
- if (className == 'Object') {
1554
- // we're a user defined class or Object
1555
- // JSON.stringify avoids problems with cycles, and is generally much
1556
- // easier than looping through ownProperties of `val`.
1557
- try {
1558
- return 'Object(' + JSON.stringify(val) + ')';
1559
- } catch (_) {
1560
- return 'Object';
1561
- }
1562
- }
1563
- // errors
1564
- if (val instanceof Error) {
1565
- return `${val.name}: ${val.message}\n${val.stack}`;
1566
- }
1567
- // TODO we could test for more things here, like `Set`s and `Map`s.
1568
- return className;
1569
- }
1570
-
1571
- function getArrayJsValueFromWasm0(ptr, len) {
1572
- ptr = ptr >>> 0;
1573
- const mem = getDataViewMemory0();
1574
- const result = [];
1575
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
1576
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1577
- }
1578
- wasm.__wbindgen_export7(ptr, len);
1579
- return result;
1580
- }
1581
-
1582
- function getArrayU8FromWasm0(ptr, len) {
1583
- ptr = ptr >>> 0;
1584
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1585
- }
1586
-
1587
- let cachedDataViewMemory0 = null;
1588
- function getDataViewMemory0() {
1589
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1590
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1591
- }
1592
- return cachedDataViewMemory0;
1593
- }
1594
-
1595
- function getStringFromWasm0(ptr, len) {
1596
- ptr = ptr >>> 0;
1597
- return decodeText(ptr, len);
1598
- }
1599
-
1600
- let cachedUint8ArrayMemory0 = null;
1601
- function getUint8ArrayMemory0() {
1602
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1603
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1604
- }
1605
- return cachedUint8ArrayMemory0;
1606
- }
1607
-
1608
- function handleError(f, args) {
1609
- try {
1610
- return f.apply(this, args);
1611
- } catch (e) {
1612
- const idx = addToExternrefTable0(e);
1613
- wasm.__wbindgen_export3(idx);
1614
- }
1615
- }
1616
-
1617
- function isLikeNone(x) {
1618
- return x === undefined || x === null;
1619
- }
1620
-
1621
- function makeMutClosure(arg0, arg1, dtor, f) {
1622
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
1623
- const real = (...args) => {
1624
-
1625
- // First up with a closure we increment the internal reference
1626
- // count. This ensures that the Rust closure environment won't
1627
- // be deallocated while we're invoking it.
1628
- state.cnt++;
1629
- const a = state.a;
1630
- state.a = 0;
1631
- try {
1632
- return f(a, state.b, ...args);
1633
- } finally {
1634
- state.a = a;
1635
- real._wbg_cb_unref();
1636
- }
1637
- };
1638
- real._wbg_cb_unref = () => {
1639
- if (--state.cnt === 0) {
1640
- state.dtor(state.a, state.b);
1641
- state.a = 0;
1642
- CLOSURE_DTORS.unregister(state);
1643
- }
1644
- };
1645
- CLOSURE_DTORS.register(real, state, state);
1646
- return real;
1647
- }
1648
-
1649
- function passArray8ToWasm0(arg, malloc) {
1650
- const ptr = malloc(arg.length * 1, 1) >>> 0;
1651
- getUint8ArrayMemory0().set(arg, ptr / 1);
1652
- WASM_VECTOR_LEN = arg.length;
1653
- return ptr;
1654
- }
1655
-
1656
- function passArrayJsValueToWasm0(array, malloc) {
1657
- const ptr = malloc(array.length * 4, 4) >>> 0;
1658
- for (let i = 0; i < array.length; i++) {
1659
- const add = addToExternrefTable0(array[i]);
1660
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
1661
- }
1662
- WASM_VECTOR_LEN = array.length;
1663
- return ptr;
1664
- }
1665
-
1666
- function passStringToWasm0(arg, malloc, realloc) {
1667
- if (realloc === undefined) {
1668
- const buf = cachedTextEncoder.encode(arg);
1669
- const ptr = malloc(buf.length, 1) >>> 0;
1670
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1671
- WASM_VECTOR_LEN = buf.length;
1672
- return ptr;
1673
- }
1674
-
1675
- let len = arg.length;
1676
- let ptr = malloc(len, 1) >>> 0;
1677
-
1678
- const mem = getUint8ArrayMemory0();
1679
-
1680
- let offset = 0;
1681
-
1682
- for (; offset < len; offset++) {
1683
- const code = arg.charCodeAt(offset);
1684
- if (code > 0x7F) break;
1685
- mem[ptr + offset] = code;
1686
- }
1687
- if (offset !== len) {
1688
- if (offset !== 0) {
1689
- arg = arg.slice(offset);
1690
- }
1691
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1692
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1693
- const ret = cachedTextEncoder.encodeInto(arg, view);
1694
-
1695
- offset += ret.written;
1696
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1697
- }
1698
-
1699
- WASM_VECTOR_LEN = offset;
1700
- return ptr;
1701
- }
1702
-
1703
- function takeFromExternrefTable0(idx) {
1704
- const value = wasm.__wbindgen_externrefs.get(idx);
1705
- wasm.__wbindgen_export5(idx);
1706
- return value;
1707
- }
1708
-
1709
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1710
- cachedTextDecoder.decode();
1711
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
1712
- let numBytesDecoded = 0;
1713
- function decodeText(ptr, len) {
1714
- numBytesDecoded += len;
1715
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1716
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1717
- cachedTextDecoder.decode();
1718
- numBytesDecoded = len;
1719
- }
1720
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1721
- }
1722
-
1723
- const cachedTextEncoder = new TextEncoder();
1724
-
1725
- if (!('encodeInto' in cachedTextEncoder)) {
1726
- cachedTextEncoder.encodeInto = function (arg, view) {
1727
- const buf = cachedTextEncoder.encode(arg);
1728
- view.set(buf);
1729
- return {
1730
- read: arg.length,
1731
- written: buf.length
1732
- };
1733
- };
1734
- }
1735
-
1736
- let WASM_VECTOR_LEN = 0;
1737
-
1738
-
1739
- let wasm;
1740
- export function __wbg_set_wasm(val) {
1741
- wasm = val;
1742
- }