@automerge/subduction 0.10.0 → 0.10.2

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 (43) hide show
  1. package/dist/cjs/node.cjs +5 -0
  2. package/dist/cjs/slim.cjs +1 -0
  3. package/dist/cjs/wasm-base64.cjs +1 -0
  4. package/dist/cjs/web-bindings.cjs +4800 -0
  5. package/dist/cjs/web.cjs +4751 -0
  6. package/dist/esm/bundler.js +7 -0
  7. package/dist/esm/node.js +7 -0
  8. package/dist/esm/slim.js +2 -0
  9. package/dist/esm/wasm-base64.js +1 -0
  10. package/dist/esm/web.js +5 -0
  11. package/dist/esm/workerd.js +5 -0
  12. package/dist/iife/index.js +4709 -0
  13. package/dist/index.d.ts +1710 -0
  14. package/dist/subduction.wasm +0 -0
  15. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-c507f5285f2927a0/inline0.js +2 -0
  16. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-c507f5285f2927a0/inline1.js +2 -0
  17. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-c507f5285f2927a0/inline2.js +2 -0
  18. package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
  19. package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-ec51bcf335db35bd/inline1.js +9 -0
  20. package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +1710 -0
  21. package/dist/wasm_bindgen/bundler/subduction_wasm.js +9 -0
  22. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +4806 -0
  23. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
  24. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +247 -0
  25. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-c507f5285f2927a0/inline0.js +2 -0
  26. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-c507f5285f2927a0/inline1.js +2 -0
  27. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-c507f5285f2927a0/inline2.js +2 -0
  28. package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
  29. package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-ec51bcf335db35bd/inline1.js +9 -0
  30. package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +4853 -0
  31. package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +1710 -0
  32. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
  33. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +247 -0
  34. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-c507f5285f2927a0/inline0.js +2 -0
  35. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-c507f5285f2927a0/inline1.js +2 -0
  36. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-c507f5285f2927a0/inline2.js +2 -0
  37. package/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
  38. package/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline1.js +9 -0
  39. package/dist/wasm_bindgen/web/subduction_wasm.d.ts +1982 -0
  40. package/dist/wasm_bindgen/web/subduction_wasm.js +4911 -0
  41. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
  42. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +247 -0
  43. package/package.json +1 -1
@@ -0,0 +1,4800 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // subduction_wasm/dist/wasm_bindgen/web/subduction_wasm.js
20
+ var subduction_wasm_exports = {};
21
+ __export(subduction_wasm_exports, {
22
+ AuthenticatedLongPoll: () => AuthenticatedLongPoll,
23
+ AuthenticatedTransport: () => AuthenticatedTransport,
24
+ AuthenticatedWebSocket: () => AuthenticatedWebSocket,
25
+ BatchSyncRequest: () => BatchSyncRequest,
26
+ BatchSyncResponse: () => BatchSyncResponse,
27
+ BlobMeta: () => BlobMeta,
28
+ CallError: () => CallError,
29
+ CommitWithBlob: () => CommitWithBlob,
30
+ Depth: () => Depth,
31
+ Digest: () => Digest,
32
+ Fragment: () => Fragment,
33
+ FragmentRequested: () => FragmentRequested,
34
+ FragmentWithBlob: () => FragmentWithBlob,
35
+ FragmentsArray: () => FragmentsArray,
36
+ HashMetric: () => HashMetric,
37
+ LooseCommit: () => LooseCommit,
38
+ MemorySigner: () => MemorySigner,
39
+ MemoryStorage: () => MemoryStorage,
40
+ MessagePortTransport: () => MessagePortTransport,
41
+ Nonce: () => Nonce,
42
+ PeerBatchSyncResult: () => PeerBatchSyncResult,
43
+ PeerId: () => PeerId,
44
+ PeerResultMap: () => PeerResultMap,
45
+ RequestId: () => RequestId,
46
+ Sedimentree: () => Sedimentree,
47
+ SedimentreeId: () => SedimentreeId,
48
+ SedimentreeIdsArray: () => SedimentreeIdsArray,
49
+ SignedFragment: () => SignedFragment,
50
+ SignedLooseCommit: () => SignedLooseCommit,
51
+ Subduction: () => Subduction,
52
+ SubductionHttpLongPoll: () => SubductionHttpLongPoll,
53
+ SubductionLongPoll: () => SubductionLongPoll,
54
+ SubductionWebSocket: () => SubductionWebSocket,
55
+ SyncMessage: () => SyncMessage,
56
+ SyncStats: () => SyncStats,
57
+ Topic: () => Topic,
58
+ WebCryptoSigner: () => WebCryptoSigner,
59
+ __wbg_set_wasm: () => __wbg_set_wasm,
60
+ default: () => __wbg_init,
61
+ initSync: () => initSync,
62
+ makeMessagePortTransport: () => makeMessagePortTransport,
63
+ start: () => start
64
+ });
65
+ module.exports = __toCommonJS(subduction_wasm_exports);
66
+
67
+ // subduction_wasm/dist/wasm_bindgen/web/snippets/sedimentree_wasm-c507f5285f2927a0/inline2.js
68
+ function tryIntoJsSedimentreeIdsArray(xs) {
69
+ return xs;
70
+ }
71
+
72
+ // subduction_wasm/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js
73
+ var inline0_exports = {};
74
+ __export(inline0_exports, {
75
+ makeOpenEphemeralPolicy: () => makeOpenEphemeralPolicy
76
+ });
77
+ function makeOpenEphemeralPolicy() {
78
+ return {
79
+ authorizeSubscribe() {
80
+ return Promise.resolve();
81
+ },
82
+ authorizePublish() {
83
+ return Promise.resolve();
84
+ },
85
+ filterAuthorizedSubscribers(_topic, peers) {
86
+ return Promise.resolve(peers);
87
+ }
88
+ };
89
+ }
90
+
91
+ // subduction_wasm/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline1.js
92
+ var inline1_exports = {};
93
+ __export(inline1_exports, {
94
+ makeOpenPolicy: () => makeOpenPolicy
95
+ });
96
+ function makeOpenPolicy() {
97
+ return {
98
+ authorizeConnect() {
99
+ return Promise.resolve();
100
+ },
101
+ authorizeFetch() {
102
+ return Promise.resolve();
103
+ },
104
+ authorizePut() {
105
+ return Promise.resolve();
106
+ },
107
+ filterAuthorizedFetch(_peer, ids) {
108
+ return Promise.resolve(ids);
109
+ }
110
+ };
111
+ }
112
+
113
+ // subduction_wasm/dist/wasm_bindgen/web/subduction_wasm.js
114
+ var import_meta = {};
115
+ var AuthenticatedLongPoll = class _AuthenticatedLongPoll {
116
+ static __wrap(ptr) {
117
+ ptr = ptr >>> 0;
118
+ const obj = Object.create(_AuthenticatedLongPoll.prototype);
119
+ obj.__wbg_ptr = ptr;
120
+ AuthenticatedLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
121
+ return obj;
122
+ }
123
+ __destroy_into_raw() {
124
+ const ptr = this.__wbg_ptr;
125
+ this.__wbg_ptr = 0;
126
+ AuthenticatedLongPollFinalization.unregister(this);
127
+ return ptr;
128
+ }
129
+ free() {
130
+ const ptr = this.__destroy_into_raw();
131
+ wasm.__wbg_authenticatedlongpoll_free(ptr, 0);
132
+ }
133
+ /**
134
+ * The verified peer identity.
135
+ * @returns {PeerId}
136
+ */
137
+ get peerId() {
138
+ const ret = wasm.authenticatedlongpoll_peerId(this.__wbg_ptr);
139
+ return PeerId.__wrap(ret);
140
+ }
141
+ /**
142
+ * The session ID assigned by the server.
143
+ * @returns {string}
144
+ */
145
+ get sessionId() {
146
+ let deferred1_0;
147
+ let deferred1_1;
148
+ try {
149
+ const ret = wasm.authenticatedlongpoll_sessionId(this.__wbg_ptr);
150
+ deferred1_0 = ret[0];
151
+ deferred1_1 = ret[1];
152
+ return getStringFromWasm0(ret[0], ret[1]);
153
+ } finally {
154
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
155
+ }
156
+ }
157
+ /**
158
+ * Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
159
+ * @returns {AuthenticatedTransport}
160
+ */
161
+ toTransport() {
162
+ const ptr = this.__destroy_into_raw();
163
+ const ret = wasm.authenticatedlongpoll_toTransport(ptr);
164
+ return AuthenticatedTransport.__wrap(ret);
165
+ }
166
+ };
167
+ if (Symbol.dispose) AuthenticatedLongPoll.prototype[Symbol.dispose] = AuthenticatedLongPoll.prototype.free;
168
+ var AuthenticatedTransport = class _AuthenticatedTransport {
169
+ static __wrap(ptr) {
170
+ ptr = ptr >>> 0;
171
+ const obj = Object.create(_AuthenticatedTransport.prototype);
172
+ obj.__wbg_ptr = ptr;
173
+ AuthenticatedTransportFinalization.register(obj, obj.__wbg_ptr, obj);
174
+ return obj;
175
+ }
176
+ __destroy_into_raw() {
177
+ const ptr = this.__wbg_ptr;
178
+ this.__wbg_ptr = 0;
179
+ AuthenticatedTransportFinalization.unregister(this);
180
+ return ptr;
181
+ }
182
+ free() {
183
+ const ptr = this.__destroy_into_raw();
184
+ wasm.__wbg_authenticatedtransport_free(ptr, 0);
185
+ }
186
+ /**
187
+ * Accept an incoming handshake over a custom transport (responder side).
188
+ *
189
+ * This is the counterpart to [`setup`](Self::setup). The initiator calls
190
+ * `setup`, and the responder calls `accept` over the same underlying channel.
191
+ *
192
+ * # Arguments
193
+ *
194
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
195
+ * * `signer` - The responder's signer for authentication
196
+ * * `max_drift_seconds` - Maximum acceptable clock drift in seconds (default: 600)
197
+ *
198
+ * # Errors
199
+ *
200
+ * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
201
+ * @param {Transport} transport
202
+ * @param {any} signer
203
+ * @param {number | null} [max_drift_seconds]
204
+ * @param {Function | null} [on_disconnect]
205
+ * @returns {Promise<AuthenticatedTransport>}
206
+ */
207
+ static accept(transport, signer, max_drift_seconds, on_disconnect) {
208
+ const ret = wasm.authenticatedtransport_accept(transport, signer, isLikeNone(max_drift_seconds) ? 4294967297 : max_drift_seconds >>> 0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
209
+ return ret;
210
+ }
211
+ /**
212
+ * The verified peer identity.
213
+ * @returns {PeerId}
214
+ */
215
+ get peerId() {
216
+ const ret = wasm.authenticatedtransport_peerId(this.__wbg_ptr);
217
+ return PeerId.__wrap(ret);
218
+ }
219
+ /**
220
+ * Run the Subduction handshake over a custom transport, producing an
221
+ * authenticated transport.
222
+ *
223
+ * The `transport` object must implement the `Transport` interface
224
+ * (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`).
225
+ * The same object is used for both the handshake phase and post-handshake
226
+ * communication.
227
+ *
228
+ * # Arguments
229
+ *
230
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
231
+ * * `signer` - The client's signer for authentication
232
+ * * `expected_peer_id` - The expected server peer ID (verified during handshake)
233
+ *
234
+ * # Errors
235
+ *
236
+ * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
237
+ * @param {Transport} transport
238
+ * @param {any} signer
239
+ * @param {PeerId} expected_peer_id
240
+ * @param {Function | null} [on_disconnect]
241
+ * @returns {Promise<AuthenticatedTransport>}
242
+ */
243
+ static setup(transport, signer, expected_peer_id, on_disconnect) {
244
+ _assertClass(expected_peer_id, PeerId);
245
+ const ret = wasm.authenticatedtransport_setup(transport, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
246
+ return ret;
247
+ }
248
+ /**
249
+ * Run the Subduction handshake over a custom transport using discovery
250
+ * mode, producing an authenticated transport.
251
+ *
252
+ * Unlike [`setup`](Self::setup) which requires a known peer ID,
253
+ * this method discovers the peer's identity during the handshake
254
+ * using a shared service name.
255
+ *
256
+ * # Arguments
257
+ *
258
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
259
+ * * `signer` - The client's signer for authentication
260
+ * * `service_name` - Shared service name for discovery.
261
+ * Defaults to [`DEFAULT_LOCAL_SERVICE_NAME`] (`"subduction:local"`) if omitted.
262
+ *
263
+ * # Errors
264
+ *
265
+ * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
266
+ * @param {Transport} transport
267
+ * @param {any} signer
268
+ * @param {string | null} [service_name]
269
+ * @param {Function | null} [on_disconnect]
270
+ * @returns {Promise<AuthenticatedTransport>}
271
+ */
272
+ static setupDiscover(transport, signer, service_name, on_disconnect) {
273
+ var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
274
+ var len0 = WASM_VECTOR_LEN;
275
+ const ret = wasm.authenticatedtransport_setupDiscover(transport, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
276
+ return ret;
277
+ }
278
+ };
279
+ if (Symbol.dispose) AuthenticatedTransport.prototype[Symbol.dispose] = AuthenticatedTransport.prototype.free;
280
+ var AuthenticatedWebSocket = class _AuthenticatedWebSocket {
281
+ static __wrap(ptr) {
282
+ ptr = ptr >>> 0;
283
+ const obj = Object.create(_AuthenticatedWebSocket.prototype);
284
+ obj.__wbg_ptr = ptr;
285
+ AuthenticatedWebSocketFinalization.register(obj, obj.__wbg_ptr, obj);
286
+ return obj;
287
+ }
288
+ __destroy_into_raw() {
289
+ const ptr = this.__wbg_ptr;
290
+ this.__wbg_ptr = 0;
291
+ AuthenticatedWebSocketFinalization.unregister(this);
292
+ return ptr;
293
+ }
294
+ free() {
295
+ const ptr = this.__destroy_into_raw();
296
+ wasm.__wbg_authenticatedwebsocket_free(ptr, 0);
297
+ }
298
+ /**
299
+ * The verified peer identity.
300
+ * @returns {PeerId}
301
+ */
302
+ get peerId() {
303
+ const ret = wasm.authenticatedwebsocket_peerId(this.__wbg_ptr);
304
+ return PeerId.__wrap(ret);
305
+ }
306
+ /**
307
+ * Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
308
+ * @returns {AuthenticatedTransport}
309
+ */
310
+ toTransport() {
311
+ const ptr = this.__destroy_into_raw();
312
+ const ret = wasm.authenticatedwebsocket_toTransport(ptr);
313
+ return AuthenticatedTransport.__wrap(ret);
314
+ }
315
+ };
316
+ if (Symbol.dispose) AuthenticatedWebSocket.prototype[Symbol.dispose] = AuthenticatedWebSocket.prototype.free;
317
+ var BatchSyncRequest = class _BatchSyncRequest {
318
+ static __wrap(ptr) {
319
+ ptr = ptr >>> 0;
320
+ const obj = Object.create(_BatchSyncRequest.prototype);
321
+ obj.__wbg_ptr = ptr;
322
+ BatchSyncRequestFinalization.register(obj, obj.__wbg_ptr, obj);
323
+ return obj;
324
+ }
325
+ __destroy_into_raw() {
326
+ const ptr = this.__wbg_ptr;
327
+ this.__wbg_ptr = 0;
328
+ BatchSyncRequestFinalization.unregister(this);
329
+ return ptr;
330
+ }
331
+ free() {
332
+ const ptr = this.__destroy_into_raw();
333
+ wasm.__wbg_batchsyncrequest_free(ptr, 0);
334
+ }
335
+ /**
336
+ * The sedimentree ID this request corresponds to.
337
+ * @returns {SedimentreeId}
338
+ */
339
+ id() {
340
+ const ret = wasm.batchsyncrequest_id(this.__wbg_ptr);
341
+ return SedimentreeId.__wrap(ret);
342
+ }
343
+ /**
344
+ * The request ID for this request.
345
+ * @returns {RequestId}
346
+ */
347
+ request_id() {
348
+ const ret = wasm.batchsyncrequest_request_id(this.__wbg_ptr);
349
+ return RequestId.__wrap(ret);
350
+ }
351
+ /**
352
+ * Whether this request subscribes to future updates.
353
+ * @returns {boolean}
354
+ */
355
+ subscribe() {
356
+ const ret = wasm.batchsyncrequest_subscribe(this.__wbg_ptr);
357
+ return ret !== 0;
358
+ }
359
+ };
360
+ if (Symbol.dispose) BatchSyncRequest.prototype[Symbol.dispose] = BatchSyncRequest.prototype.free;
361
+ var BatchSyncResponse = class _BatchSyncResponse {
362
+ static __wrap(ptr) {
363
+ ptr = ptr >>> 0;
364
+ const obj = Object.create(_BatchSyncResponse.prototype);
365
+ obj.__wbg_ptr = ptr;
366
+ BatchSyncResponseFinalization.register(obj, obj.__wbg_ptr, obj);
367
+ return obj;
368
+ }
369
+ __destroy_into_raw() {
370
+ const ptr = this.__wbg_ptr;
371
+ this.__wbg_ptr = 0;
372
+ BatchSyncResponseFinalization.unregister(this);
373
+ return ptr;
374
+ }
375
+ free() {
376
+ const ptr = this.__destroy_into_raw();
377
+ wasm.__wbg_batchsyncresponse_free(ptr, 0);
378
+ }
379
+ /**
380
+ * Upcasts; to the JS-import type for [`WasmBatchSyncResponse`].
381
+ * @returns {BatchSyncResponse}
382
+ */
383
+ __wasm_refgen_toWasmBatchSyncResponse() {
384
+ const ret = wasm.batchsyncresponse___wasm_refgen_toWasmBatchSyncResponse(this.__wbg_ptr);
385
+ return _BatchSyncResponse.__wrap(ret);
386
+ }
387
+ /**
388
+ * The sedimentree ID this response corresponds to.
389
+ * @returns {SedimentreeId}
390
+ */
391
+ id() {
392
+ const ret = wasm.batchsyncresponse_id(this.__wbg_ptr);
393
+ return SedimentreeId.__wrap(ret);
394
+ }
395
+ /**
396
+ * The request ID this response corresponds to.
397
+ * @returns {RequestId}
398
+ */
399
+ request_id() {
400
+ const ret = wasm.batchsyncresponse_request_id(this.__wbg_ptr);
401
+ return RequestId.__wrap(ret);
402
+ }
403
+ };
404
+ if (Symbol.dispose) BatchSyncResponse.prototype[Symbol.dispose] = BatchSyncResponse.prototype.free;
405
+ var BlobMeta = class _BlobMeta {
406
+ static __wrap(ptr) {
407
+ ptr = ptr >>> 0;
408
+ const obj = Object.create(_BlobMeta.prototype);
409
+ obj.__wbg_ptr = ptr;
410
+ BlobMetaFinalization.register(obj, obj.__wbg_ptr, obj);
411
+ return obj;
412
+ }
413
+ __destroy_into_raw() {
414
+ const ptr = this.__wbg_ptr;
415
+ this.__wbg_ptr = 0;
416
+ BlobMetaFinalization.unregister(this);
417
+ return ptr;
418
+ }
419
+ free() {
420
+ const ptr = this.__destroy_into_raw();
421
+ wasm.__wbg_blobmeta_free(ptr, 0);
422
+ }
423
+ /**
424
+ * Get the digest of the blob.
425
+ * @returns {Digest}
426
+ */
427
+ digest() {
428
+ const ret = wasm.blobmeta_digest(this.__wbg_ptr);
429
+ return Digest.__wrap(ret);
430
+ }
431
+ /**
432
+ * Create a `BlobMeta` from a digest and size.
433
+ *
434
+ * This is useful for deserialization when the original blob is not available.
435
+ * Since this is manual, the caller must ensure the digest and size are correct.
436
+ * @param {Digest} digest
437
+ * @param {bigint} size_bytes
438
+ * @returns {BlobMeta}
439
+ */
440
+ static fromDigestSize(digest, size_bytes) {
441
+ _assertClass(digest, Digest);
442
+ const ret = wasm.blobmeta_fromDigestSize(digest.__wbg_ptr, size_bytes);
443
+ return _BlobMeta.__wrap(ret);
444
+ }
445
+ /**
446
+ * Create a new `BlobMeta` from the given blob contents.
447
+ * @param {Uint8Array} blob
448
+ */
449
+ constructor(blob) {
450
+ const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
451
+ const len0 = WASM_VECTOR_LEN;
452
+ const ret = wasm.blobmeta_new(ptr0, len0);
453
+ this.__wbg_ptr = ret >>> 0;
454
+ BlobMetaFinalization.register(this, this.__wbg_ptr, this);
455
+ return this;
456
+ }
457
+ /**
458
+ * Get the size of the blob in bytes.
459
+ * @returns {bigint}
460
+ */
461
+ get sizeBytes() {
462
+ const ret = wasm.blobmeta_sizeBytes(this.__wbg_ptr);
463
+ return BigInt.asUintN(64, ret);
464
+ }
465
+ };
466
+ if (Symbol.dispose) BlobMeta.prototype[Symbol.dispose] = BlobMeta.prototype.free;
467
+ var CallError = class {
468
+ __destroy_into_raw() {
469
+ const ptr = this.__wbg_ptr;
470
+ this.__wbg_ptr = 0;
471
+ CallErrorFinalization.unregister(this);
472
+ return ptr;
473
+ }
474
+ free() {
475
+ const ptr = this.__destroy_into_raw();
476
+ wasm.__wbg_callerror_free(ptr, 0);
477
+ }
478
+ };
479
+ if (Symbol.dispose) CallError.prototype[Symbol.dispose] = CallError.prototype.free;
480
+ var CommitWithBlob = class _CommitWithBlob {
481
+ static __wrap(ptr) {
482
+ ptr = ptr >>> 0;
483
+ const obj = Object.create(_CommitWithBlob.prototype);
484
+ obj.__wbg_ptr = ptr;
485
+ CommitWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
486
+ return obj;
487
+ }
488
+ __destroy_into_raw() {
489
+ const ptr = this.__wbg_ptr;
490
+ this.__wbg_ptr = 0;
491
+ CommitWithBlobFinalization.unregister(this);
492
+ return ptr;
493
+ }
494
+ free() {
495
+ const ptr = this.__destroy_into_raw();
496
+ wasm.__wbg_commitwithblob_free(ptr, 0);
497
+ }
498
+ /**
499
+ * Upcasts; to the JS-import type for [`WasmCommitWithBlob`].
500
+ * @returns {CommitWithBlob}
501
+ */
502
+ __wasm_refgen_toWasmCommitWithBlob() {
503
+ const ret = wasm.commitwithblob___wasm_refgen_toWasmCommitWithBlob(this.__wbg_ptr);
504
+ return _CommitWithBlob.__wrap(ret);
505
+ }
506
+ /**
507
+ * Get the blob.
508
+ * @returns {Uint8Array}
509
+ */
510
+ get blob() {
511
+ const ret = wasm.commitwithblob_blob(this.__wbg_ptr);
512
+ return ret;
513
+ }
514
+ /**
515
+ * Create a new commit with blob.
516
+ * @param {SignedLooseCommit} signed
517
+ * @param {Uint8Array} blob
518
+ */
519
+ constructor(signed, blob) {
520
+ _assertClass(signed, SignedLooseCommit);
521
+ var ptr0 = signed.__destroy_into_raw();
522
+ const ret = wasm.commitwithblob_new(ptr0, blob);
523
+ this.__wbg_ptr = ret >>> 0;
524
+ CommitWithBlobFinalization.register(this, this.__wbg_ptr, this);
525
+ return this;
526
+ }
527
+ /**
528
+ * Get the signed commit.
529
+ * @returns {SignedLooseCommit}
530
+ */
531
+ get signed() {
532
+ const ret = wasm.commitwithblob_signed(this.__wbg_ptr);
533
+ return SignedLooseCommit.__wrap(ret);
534
+ }
535
+ };
536
+ if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
537
+ var Depth = class _Depth {
538
+ static __wrap(ptr) {
539
+ ptr = ptr >>> 0;
540
+ const obj = Object.create(_Depth.prototype);
541
+ obj.__wbg_ptr = ptr;
542
+ DepthFinalization.register(obj, obj.__wbg_ptr, obj);
543
+ return obj;
544
+ }
545
+ __destroy_into_raw() {
546
+ const ptr = this.__wbg_ptr;
547
+ this.__wbg_ptr = 0;
548
+ DepthFinalization.unregister(this);
549
+ return ptr;
550
+ }
551
+ free() {
552
+ const ptr = this.__destroy_into_raw();
553
+ wasm.__wbg_depth_free(ptr, 0);
554
+ }
555
+ /**
556
+ * Internal method for a hack crossing the JS boundary.
557
+ * @returns {Depth}
558
+ */
559
+ __subduction_castToDepth() {
560
+ const ret = wasm.depth___subduction_castToDepth(this.__wbg_ptr);
561
+ return _Depth.__wrap(ret);
562
+ }
563
+ /**
564
+ * Upcasts; to the JS-import type for [`WasmDepth`].
565
+ * @returns {Depth}
566
+ */
567
+ __wasm_refgen_toWasmDepth() {
568
+ const ret = wasm.depth___wasm_refgen_toWasmDepth(this.__wbg_ptr);
569
+ return _Depth.__wrap(ret);
570
+ }
571
+ /**
572
+ * Creates a new `WasmDepth` from a JavaScript value.
573
+ *
574
+ * # Errors
575
+ *
576
+ * Returns a `NotU32Error` if the JS value is not safely coercible to `u32`.
577
+ * @param {any} js_value
578
+ */
579
+ constructor(js_value) {
580
+ const ret = wasm.depth_new(js_value);
581
+ if (ret[2]) {
582
+ throw takeFromExternrefTable0(ret[1]);
583
+ }
584
+ this.__wbg_ptr = ret[0] >>> 0;
585
+ DepthFinalization.register(this, this.__wbg_ptr, this);
586
+ return this;
587
+ }
588
+ /**
589
+ * The depth value as an integer.
590
+ * @returns {number}
591
+ */
592
+ get value() {
593
+ const ret = wasm.depth_value(this.__wbg_ptr);
594
+ return ret >>> 0;
595
+ }
596
+ };
597
+ if (Symbol.dispose) Depth.prototype[Symbol.dispose] = Depth.prototype.free;
598
+ var Digest = class _Digest {
599
+ static __wrap(ptr) {
600
+ ptr = ptr >>> 0;
601
+ const obj = Object.create(_Digest.prototype);
602
+ obj.__wbg_ptr = ptr;
603
+ DigestFinalization.register(obj, obj.__wbg_ptr, obj);
604
+ return obj;
605
+ }
606
+ static __unwrap(jsValue) {
607
+ if (!(jsValue instanceof _Digest)) {
608
+ return 0;
609
+ }
610
+ return jsValue.__destroy_into_raw();
611
+ }
612
+ __destroy_into_raw() {
613
+ const ptr = this.__wbg_ptr;
614
+ this.__wbg_ptr = 0;
615
+ DigestFinalization.unregister(this);
616
+ return ptr;
617
+ }
618
+ free() {
619
+ const ptr = this.__destroy_into_raw();
620
+ wasm.__wbg_digest_free(ptr, 0);
621
+ }
622
+ /**
623
+ * Upcasts; to the JS-import type for [`WasmDigest`].
624
+ * @returns {Digest}
625
+ */
626
+ __wasm_refgen_toWasmDigest() {
627
+ const ret = wasm.digest___wasm_refgen_toWasmDigest(this.__wbg_ptr);
628
+ return _Digest.__wrap(ret);
629
+ }
630
+ /**
631
+ * Creates a new digest from its Base58 string representation.
632
+ *
633
+ * # Errors
634
+ *
635
+ * Returns a `WasmInvalidDigest` error if the string cannot be decoded or is not a valid digest.
636
+ * @param {string} s
637
+ * @returns {Digest}
638
+ */
639
+ static fromBase58(s) {
640
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
641
+ const len0 = WASM_VECTOR_LEN;
642
+ const ret = wasm.digest_fromBase58(ptr0, len0);
643
+ if (ret[2]) {
644
+ throw takeFromExternrefTable0(ret[1]);
645
+ }
646
+ return _Digest.__wrap(ret[0]);
647
+ }
648
+ /**
649
+ * Creates a new digest from its byte representation.
650
+ *
651
+ * # Errors
652
+ *
653
+ * Returns a `WasmValue` error if the byte slice is not a valid digest.
654
+ * @param {Uint8Array} bytes
655
+ * @returns {Digest}
656
+ */
657
+ static fromBytes(bytes) {
658
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
659
+ const len0 = WASM_VECTOR_LEN;
660
+ const ret = wasm.digest_fromBytes(ptr0, len0);
661
+ if (ret[2]) {
662
+ throw takeFromExternrefTable0(ret[1]);
663
+ }
664
+ return _Digest.__wrap(ret[0]);
665
+ }
666
+ /**
667
+ * Creates a new digest from its hexadecimal string representation.
668
+ *
669
+ * # Errors
670
+ *
671
+ * Returns a [`WasmInvalidDigest`] if the string is not a valid digest.
672
+ * @param {string} s
673
+ * @returns {Digest}
674
+ */
675
+ static fromHexString(s) {
676
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
677
+ const len0 = WASM_VECTOR_LEN;
678
+ const ret = wasm.digest_fromHexString(ptr0, len0);
679
+ if (ret[2]) {
680
+ throw takeFromExternrefTable0(ret[1]);
681
+ }
682
+ return _Digest.__wrap(ret[0]);
683
+ }
684
+ /**
685
+ * Creates a new digest from its byte representation.
686
+ *
687
+ * # Errors
688
+ *
689
+ * Returns a `WasmValue` error if the byte slice is not a valid digest.
690
+ * @param {Uint8Array} bytes
691
+ */
692
+ constructor(bytes) {
693
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
694
+ const len0 = WASM_VECTOR_LEN;
695
+ const ret = wasm.digest_new(ptr0, len0);
696
+ if (ret[2]) {
697
+ throw takeFromExternrefTable0(ret[1]);
698
+ }
699
+ this.__wbg_ptr = ret[0] >>> 0;
700
+ DigestFinalization.register(this, this.__wbg_ptr, this);
701
+ return this;
702
+ }
703
+ /**
704
+ * Returns the byte representation of the digest.
705
+ * @returns {Uint8Array}
706
+ */
707
+ toBytes() {
708
+ const ret = wasm.digest_toBytes(this.__wbg_ptr);
709
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
710
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
711
+ return v1;
712
+ }
713
+ /**
714
+ * Returns the hexadecimal string representation of the digest.
715
+ * @returns {string}
716
+ */
717
+ toHexString() {
718
+ let deferred1_0;
719
+ let deferred1_1;
720
+ try {
721
+ const ret = wasm.digest_toHexString(this.__wbg_ptr);
722
+ deferred1_0 = ret[0];
723
+ deferred1_1 = ret[1];
724
+ return getStringFromWasm0(ret[0], ret[1]);
725
+ } finally {
726
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
727
+ }
728
+ }
729
+ };
730
+ if (Symbol.dispose) Digest.prototype[Symbol.dispose] = Digest.prototype.free;
731
+ var Fragment = class _Fragment {
732
+ static __wrap(ptr) {
733
+ ptr = ptr >>> 0;
734
+ const obj = Object.create(_Fragment.prototype);
735
+ obj.__wbg_ptr = ptr;
736
+ FragmentFinalization.register(obj, obj.__wbg_ptr, obj);
737
+ return obj;
738
+ }
739
+ __destroy_into_raw() {
740
+ const ptr = this.__wbg_ptr;
741
+ this.__wbg_ptr = 0;
742
+ FragmentFinalization.unregister(this);
743
+ return ptr;
744
+ }
745
+ free() {
746
+ const ptr = this.__destroy_into_raw();
747
+ wasm.__wbg_fragment_free(ptr, 0);
748
+ }
749
+ /**
750
+ * Upcasts; to the JS-import type for [`WasmFragment`].
751
+ * @returns {Fragment}
752
+ */
753
+ __wasm_refgen_toWasmFragment() {
754
+ const ret = wasm.fragment___wasm_refgen_toWasmFragment(this.__wbg_ptr);
755
+ return _Fragment.__wrap(ret);
756
+ }
757
+ /**
758
+ * Get the blob metadata of the fragment.
759
+ * @returns {BlobMeta}
760
+ */
761
+ get blobMeta() {
762
+ const ret = wasm.fragment_blobMeta(this.__wbg_ptr);
763
+ return BlobMeta.__wrap(ret);
764
+ }
765
+ /**
766
+ * Get the boundary digests of the fragment.
767
+ * @returns {Digest[]}
768
+ */
769
+ get boundary() {
770
+ const ret = wasm.fragment_boundary(this.__wbg_ptr);
771
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
772
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
773
+ return v1;
774
+ }
775
+ /**
776
+ * Get the head digest of the fragment.
777
+ * @returns {Digest}
778
+ */
779
+ get head() {
780
+ const ret = wasm.fragment_head(this.__wbg_ptr);
781
+ return Digest.__wrap(ret);
782
+ }
783
+ /**
784
+ * Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
785
+ * @param {SedimentreeId} sedimentree_id
786
+ * @param {Digest} head
787
+ * @param {Digest[]} boundary
788
+ * @param {Digest[]} checkpoints
789
+ * @param {BlobMeta} blob_meta
790
+ */
791
+ constructor(sedimentree_id, head, boundary, checkpoints, blob_meta) {
792
+ _assertClass(sedimentree_id, SedimentreeId);
793
+ var ptr0 = sedimentree_id.__destroy_into_raw();
794
+ _assertClass(head, Digest);
795
+ var ptr1 = head.__destroy_into_raw();
796
+ const ptr2 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
797
+ const len2 = WASM_VECTOR_LEN;
798
+ const ptr3 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
799
+ const len3 = WASM_VECTOR_LEN;
800
+ _assertClass(blob_meta, BlobMeta);
801
+ var ptr4 = blob_meta.__destroy_into_raw();
802
+ const ret = wasm.fragment_new(ptr0, ptr1, ptr2, len2, ptr3, len3, ptr4);
803
+ this.__wbg_ptr = ret >>> 0;
804
+ FragmentFinalization.register(this, this.__wbg_ptr, this);
805
+ return this;
806
+ }
807
+ };
808
+ if (Symbol.dispose) Fragment.prototype[Symbol.dispose] = Fragment.prototype.free;
809
+ var FragmentRequested = class _FragmentRequested {
810
+ static __wrap(ptr) {
811
+ ptr = ptr >>> 0;
812
+ const obj = Object.create(_FragmentRequested.prototype);
813
+ obj.__wbg_ptr = ptr;
814
+ FragmentRequestedFinalization.register(obj, obj.__wbg_ptr, obj);
815
+ return obj;
816
+ }
817
+ __destroy_into_raw() {
818
+ const ptr = this.__wbg_ptr;
819
+ this.__wbg_ptr = 0;
820
+ FragmentRequestedFinalization.unregister(this);
821
+ return ptr;
822
+ }
823
+ free() {
824
+ const ptr = this.__destroy_into_raw();
825
+ wasm.__wbg_fragmentrequested_free(ptr, 0);
826
+ }
827
+ /**
828
+ * Get the depth of the requested fragment.
829
+ * @returns {Depth}
830
+ */
831
+ get depth() {
832
+ const ret = wasm.fragmentrequested_depth(this.__wbg_ptr);
833
+ return Depth.__wrap(ret);
834
+ }
835
+ /**
836
+ * Get the digest of the requested fragment.
837
+ * @returns {Digest}
838
+ */
839
+ get head() {
840
+ const ret = wasm.fragmentrequested_head(this.__wbg_ptr);
841
+ return Digest.__wrap(ret);
842
+ }
843
+ /**
844
+ * Create a new fragment request from the given digest.
845
+ * @param {Digest} digest
846
+ * @param {Depth} depth
847
+ */
848
+ constructor(digest, depth) {
849
+ _assertClass(digest, Digest);
850
+ _assertClass(depth, Depth);
851
+ const ret = wasm.fragmentrequested_new(digest.__wbg_ptr, depth.__wbg_ptr);
852
+ this.__wbg_ptr = ret >>> 0;
853
+ FragmentRequestedFinalization.register(this, this.__wbg_ptr, this);
854
+ return this;
855
+ }
856
+ };
857
+ if (Symbol.dispose) FragmentRequested.prototype[Symbol.dispose] = FragmentRequested.prototype.free;
858
+ var FragmentWithBlob = class _FragmentWithBlob {
859
+ static __wrap(ptr) {
860
+ ptr = ptr >>> 0;
861
+ const obj = Object.create(_FragmentWithBlob.prototype);
862
+ obj.__wbg_ptr = ptr;
863
+ FragmentWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
864
+ return obj;
865
+ }
866
+ __destroy_into_raw() {
867
+ const ptr = this.__wbg_ptr;
868
+ this.__wbg_ptr = 0;
869
+ FragmentWithBlobFinalization.unregister(this);
870
+ return ptr;
871
+ }
872
+ free() {
873
+ const ptr = this.__destroy_into_raw();
874
+ wasm.__wbg_fragmentwithblob_free(ptr, 0);
875
+ }
876
+ /**
877
+ * Upcasts; to the JS-import type for [`WasmFragmentWithBlob`].
878
+ * @returns {FragmentWithBlob}
879
+ */
880
+ __wasm_refgen_toWasmFragmentWithBlob() {
881
+ const ret = wasm.fragmentwithblob___wasm_refgen_toWasmFragmentWithBlob(this.__wbg_ptr);
882
+ return _FragmentWithBlob.__wrap(ret);
883
+ }
884
+ /**
885
+ * Get the blob.
886
+ * @returns {Uint8Array}
887
+ */
888
+ get blob() {
889
+ const ret = wasm.fragmentwithblob_blob(this.__wbg_ptr);
890
+ return ret;
891
+ }
892
+ /**
893
+ * Create a new fragment with blob.
894
+ * @param {SignedFragment} signed
895
+ * @param {Uint8Array} blob
896
+ */
897
+ constructor(signed, blob) {
898
+ _assertClass(signed, SignedFragment);
899
+ var ptr0 = signed.__destroy_into_raw();
900
+ const ret = wasm.fragmentwithblob_new(ptr0, blob);
901
+ this.__wbg_ptr = ret >>> 0;
902
+ FragmentWithBlobFinalization.register(this, this.__wbg_ptr, this);
903
+ return this;
904
+ }
905
+ /**
906
+ * Get the signed fragment.
907
+ * @returns {SignedFragment}
908
+ */
909
+ get signed() {
910
+ const ret = wasm.fragmentwithblob_signed(this.__wbg_ptr);
911
+ return SignedFragment.__wrap(ret);
912
+ }
913
+ };
914
+ if (Symbol.dispose) FragmentWithBlob.prototype[Symbol.dispose] = FragmentWithBlob.prototype.free;
915
+ var FragmentsArray = class _FragmentsArray {
916
+ static __wrap(ptr) {
917
+ ptr = ptr >>> 0;
918
+ const obj = Object.create(_FragmentsArray.prototype);
919
+ obj.__wbg_ptr = ptr;
920
+ FragmentsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
921
+ return obj;
922
+ }
923
+ __destroy_into_raw() {
924
+ const ptr = this.__wbg_ptr;
925
+ this.__wbg_ptr = 0;
926
+ FragmentsArrayFinalization.unregister(this);
927
+ return ptr;
928
+ }
929
+ free() {
930
+ const ptr = this.__destroy_into_raw();
931
+ wasm.__wbg_fragmentsarray_free(ptr, 0);
932
+ }
933
+ /**
934
+ * Upcasts; to the JS-import type for [`WasmFragmentsArray`].
935
+ * @returns {FragmentsArray}
936
+ */
937
+ __wasm_refgen_toWasmFragmentsArray() {
938
+ const ret = wasm.fragmentsarray___wasm_refgen_toWasmFragmentsArray(this.__wbg_ptr);
939
+ return _FragmentsArray.__wrap(ret);
940
+ }
941
+ };
942
+ if (Symbol.dispose) FragmentsArray.prototype[Symbol.dispose] = FragmentsArray.prototype.free;
943
+ var HashMetric = class {
944
+ __destroy_into_raw() {
945
+ const ptr = this.__wbg_ptr;
946
+ this.__wbg_ptr = 0;
947
+ HashMetricFinalization.unregister(this);
948
+ return ptr;
949
+ }
950
+ free() {
951
+ const ptr = this.__destroy_into_raw();
952
+ wasm.__wbg_hashmetric_free(ptr, 0);
953
+ }
954
+ /**
955
+ * Create a new `WasmHashMetric` with an optional JavaScript function.
956
+ *
957
+ * Defaults to counting leading zero bytes if no function is provided.
958
+ * @param {Function | null} [func]
959
+ */
960
+ constructor(func) {
961
+ const ret = wasm.hashmetric_new(isLikeNone(func) ? 0 : addToExternrefTable0(func));
962
+ this.__wbg_ptr = ret >>> 0;
963
+ HashMetricFinalization.register(this, this.__wbg_ptr, this);
964
+ return this;
965
+ }
966
+ };
967
+ if (Symbol.dispose) HashMetric.prototype[Symbol.dispose] = HashMetric.prototype.free;
968
+ var LooseCommit = class _LooseCommit {
969
+ static __wrap(ptr) {
970
+ ptr = ptr >>> 0;
971
+ const obj = Object.create(_LooseCommit.prototype);
972
+ obj.__wbg_ptr = ptr;
973
+ LooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
974
+ return obj;
975
+ }
976
+ __destroy_into_raw() {
977
+ const ptr = this.__wbg_ptr;
978
+ this.__wbg_ptr = 0;
979
+ LooseCommitFinalization.unregister(this);
980
+ return ptr;
981
+ }
982
+ free() {
983
+ const ptr = this.__destroy_into_raw();
984
+ wasm.__wbg_loosecommit_free(ptr, 0);
985
+ }
986
+ /**
987
+ * Upcasts; to the JS-import type for [`WasmLooseCommit`].
988
+ * @returns {LooseCommit}
989
+ */
990
+ __wasm_refgen_toWasmLooseCommit() {
991
+ const ret = wasm.loosecommit___wasm_refgen_toWasmLooseCommit(this.__wbg_ptr);
992
+ return _LooseCommit.__wrap(ret);
993
+ }
994
+ /**
995
+ * Get the blob metadata of the commit.
996
+ * @returns {BlobMeta}
997
+ */
998
+ get blobMeta() {
999
+ const ret = wasm.loosecommit_blobMeta(this.__wbg_ptr);
1000
+ return BlobMeta.__wrap(ret);
1001
+ }
1002
+ /**
1003
+ * Get the digest of the commit.
1004
+ * @returns {Digest}
1005
+ */
1006
+ get digest() {
1007
+ const ret = wasm.loosecommit_digest(this.__wbg_ptr);
1008
+ return Digest.__wrap(ret);
1009
+ }
1010
+ /**
1011
+ * Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
1012
+ * @param {SedimentreeId} sedimentree_id
1013
+ * @param {Digest[]} parents
1014
+ * @param {BlobMeta} blob_meta
1015
+ */
1016
+ constructor(sedimentree_id, parents, blob_meta) {
1017
+ _assertClass(sedimentree_id, SedimentreeId);
1018
+ var ptr0 = sedimentree_id.__destroy_into_raw();
1019
+ const ptr1 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
1020
+ const len1 = WASM_VECTOR_LEN;
1021
+ _assertClass(blob_meta, BlobMeta);
1022
+ const ret = wasm.loosecommit_new(ptr0, ptr1, len1, blob_meta.__wbg_ptr);
1023
+ this.__wbg_ptr = ret >>> 0;
1024
+ LooseCommitFinalization.register(this, this.__wbg_ptr, this);
1025
+ return this;
1026
+ }
1027
+ /**
1028
+ * Get the parent digests of the commit.
1029
+ * @returns {Digest[]}
1030
+ */
1031
+ get parents() {
1032
+ const ret = wasm.loosecommit_parents(this.__wbg_ptr);
1033
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1034
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1035
+ return v1;
1036
+ }
1037
+ };
1038
+ if (Symbol.dispose) LooseCommit.prototype[Symbol.dispose] = LooseCommit.prototype.free;
1039
+ var MemorySigner = class _MemorySigner {
1040
+ static __wrap(ptr) {
1041
+ ptr = ptr >>> 0;
1042
+ const obj = Object.create(_MemorySigner.prototype);
1043
+ obj.__wbg_ptr = ptr;
1044
+ MemorySignerFinalization.register(obj, obj.__wbg_ptr, obj);
1045
+ return obj;
1046
+ }
1047
+ __destroy_into_raw() {
1048
+ const ptr = this.__wbg_ptr;
1049
+ this.__wbg_ptr = 0;
1050
+ MemorySignerFinalization.unregister(this);
1051
+ return ptr;
1052
+ }
1053
+ free() {
1054
+ const ptr = this.__destroy_into_raw();
1055
+ wasm.__wbg_memorysigner_free(ptr, 0);
1056
+ }
1057
+ /**
1058
+ * Create a signer from raw 32-byte Ed25519 secret key bytes.
1059
+ *
1060
+ * # Errors
1061
+ *
1062
+ * Returns an error if `bytes` is not exactly 32 bytes.
1063
+ * @param {Uint8Array} bytes
1064
+ * @returns {MemorySigner}
1065
+ */
1066
+ static fromBytes(bytes) {
1067
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1068
+ const len0 = WASM_VECTOR_LEN;
1069
+ const ret = wasm.memorysigner_fromBytes(ptr0, len0);
1070
+ if (ret[2]) {
1071
+ throw takeFromExternrefTable0(ret[1]);
1072
+ }
1073
+ return _MemorySigner.__wrap(ret[0]);
1074
+ }
1075
+ /**
1076
+ * Create a new signer with a randomly generated Ed25519 key.
1077
+ *
1078
+ * # Panics
1079
+ *
1080
+ * Panics if the system random number generator fails.
1081
+ * @returns {MemorySigner}
1082
+ */
1083
+ static generate() {
1084
+ const ret = wasm.memorysigner_generate();
1085
+ return _MemorySigner.__wrap(ret);
1086
+ }
1087
+ /**
1088
+ * Create a new signer with a randomly generated Ed25519 key.
1089
+ *
1090
+ * This is the JS constructor (`new MemorySigner()`), equivalent to
1091
+ * [`generate`](Self::generate).
1092
+ *
1093
+ * # Panics
1094
+ *
1095
+ * Panics if the system random number generator fails.
1096
+ */
1097
+ constructor() {
1098
+ const ret = wasm.memorysigner_new();
1099
+ this.__wbg_ptr = ret >>> 0;
1100
+ MemorySignerFinalization.register(this, this.__wbg_ptr, this);
1101
+ return this;
1102
+ }
1103
+ /**
1104
+ * Get the peer ID derived from this signer's verifying key.
1105
+ * @returns {PeerId}
1106
+ */
1107
+ peerId() {
1108
+ const ret = wasm.memorysigner_peerId(this.__wbg_ptr);
1109
+ return PeerId.__wrap(ret);
1110
+ }
1111
+ /**
1112
+ * Sign a message and return the 64-byte Ed25519 signature as a `Uint8Array`.
1113
+ *
1114
+ * This fulfils the `Signer.sign(message)` interface contract.
1115
+ * Returns a `Promise<Uint8Array>` for consistency with the async signer interface.
1116
+ * @param {Uint8Array} message
1117
+ * @returns {Promise<Uint8Array>}
1118
+ */
1119
+ sign(message) {
1120
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export);
1121
+ const len0 = WASM_VECTOR_LEN;
1122
+ const ret = wasm.memorysigner_sign(this.__wbg_ptr, ptr0, len0);
1123
+ return ret;
1124
+ }
1125
+ /**
1126
+ * Get the 32-byte Ed25519 verifying (public) key as a `Uint8Array`.
1127
+ *
1128
+ * This fulfils the `Signer.verifyingKey()` interface contract.
1129
+ * @returns {Uint8Array}
1130
+ */
1131
+ verifyingKey() {
1132
+ const ret = wasm.memorysigner_verifyingKey(this.__wbg_ptr);
1133
+ return ret;
1134
+ }
1135
+ };
1136
+ if (Symbol.dispose) MemorySigner.prototype[Symbol.dispose] = MemorySigner.prototype.free;
1137
+ var MemoryStorage = class {
1138
+ __destroy_into_raw() {
1139
+ const ptr = this.__wbg_ptr;
1140
+ this.__wbg_ptr = 0;
1141
+ MemoryStorageFinalization.unregister(this);
1142
+ return ptr;
1143
+ }
1144
+ free() {
1145
+ const ptr = this.__destroy_into_raw();
1146
+ wasm.__wbg_memorystorage_free(ptr, 0);
1147
+ }
1148
+ /**
1149
+ * Delete all commits for a sedimentree.
1150
+ * @param {SedimentreeId} sedimentree_id
1151
+ * @returns {Promise<any>}
1152
+ */
1153
+ deleteAllCommits(sedimentree_id) {
1154
+ _assertClass(sedimentree_id, SedimentreeId);
1155
+ const ret = wasm.memorystorage_deleteAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1156
+ return ret;
1157
+ }
1158
+ /**
1159
+ * Delete all fragments for a sedimentree.
1160
+ * @param {SedimentreeId} sedimentree_id
1161
+ * @returns {Promise<any>}
1162
+ */
1163
+ deleteAllFragments(sedimentree_id) {
1164
+ _assertClass(sedimentree_id, SedimentreeId);
1165
+ const ret = wasm.memorystorage_deleteAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1166
+ return ret;
1167
+ }
1168
+ /**
1169
+ * Delete a commit by digest.
1170
+ * @param {SedimentreeId} sedimentree_id
1171
+ * @param {Digest} digest
1172
+ * @returns {Promise<any>}
1173
+ */
1174
+ deleteCommit(sedimentree_id, digest) {
1175
+ _assertClass(sedimentree_id, SedimentreeId);
1176
+ _assertClass(digest, Digest);
1177
+ const ret = wasm.memorystorage_deleteCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1178
+ return ret;
1179
+ }
1180
+ /**
1181
+ * Delete a fragment by digest.
1182
+ * @param {SedimentreeId} sedimentree_id
1183
+ * @param {Digest} digest
1184
+ * @returns {Promise<any>}
1185
+ */
1186
+ deleteFragment(sedimentree_id, digest) {
1187
+ _assertClass(sedimentree_id, SedimentreeId);
1188
+ _assertClass(digest, Digest);
1189
+ const ret = wasm.memorystorage_deleteFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1190
+ return ret;
1191
+ }
1192
+ /**
1193
+ * Delete a sedimentree ID.
1194
+ * @param {SedimentreeId} sedimentree_id
1195
+ * @returns {Promise<any>}
1196
+ */
1197
+ deleteSedimentreeId(sedimentree_id) {
1198
+ _assertClass(sedimentree_id, SedimentreeId);
1199
+ const ret = wasm.memorystorage_deleteSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1200
+ return ret;
1201
+ }
1202
+ /**
1203
+ * List all commit digests for a sedimentree.
1204
+ * @param {SedimentreeId} sedimentree_id
1205
+ * @returns {Promise<any>}
1206
+ */
1207
+ listCommitDigests(sedimentree_id) {
1208
+ _assertClass(sedimentree_id, SedimentreeId);
1209
+ const ret = wasm.memorystorage_listCommitDigests(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1210
+ return ret;
1211
+ }
1212
+ /**
1213
+ * List all fragment digests for a sedimentree.
1214
+ * @param {SedimentreeId} sedimentree_id
1215
+ * @returns {Promise<any>}
1216
+ */
1217
+ listFragmentDigests(sedimentree_id) {
1218
+ _assertClass(sedimentree_id, SedimentreeId);
1219
+ const ret = wasm.memorystorage_listFragmentDigests(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1220
+ return ret;
1221
+ }
1222
+ /**
1223
+ * Load all commits for a sedimentree, returning `CommitWithBlob[]`.
1224
+ * @param {SedimentreeId} sedimentree_id
1225
+ * @returns {Promise<any>}
1226
+ */
1227
+ loadAllCommits(sedimentree_id) {
1228
+ _assertClass(sedimentree_id, SedimentreeId);
1229
+ const ret = wasm.memorystorage_loadAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1230
+ return ret;
1231
+ }
1232
+ /**
1233
+ * Load all fragments for a sedimentree, returning `FragmentWithBlob[]`.
1234
+ * @param {SedimentreeId} sedimentree_id
1235
+ * @returns {Promise<any>}
1236
+ */
1237
+ loadAllFragments(sedimentree_id) {
1238
+ _assertClass(sedimentree_id, SedimentreeId);
1239
+ const ret = wasm.memorystorage_loadAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1240
+ return ret;
1241
+ }
1242
+ /**
1243
+ * Load all sedimentree IDs.
1244
+ * @returns {Promise<any>}
1245
+ */
1246
+ loadAllSedimentreeIds() {
1247
+ const ret = wasm.memorystorage_loadAllSedimentreeIds(this.__wbg_ptr);
1248
+ return ret;
1249
+ }
1250
+ /**
1251
+ * Load a commit by digest, returning `CommitWithBlob` or null.
1252
+ * @param {SedimentreeId} sedimentree_id
1253
+ * @param {Digest} digest
1254
+ * @returns {Promise<any>}
1255
+ */
1256
+ loadCommit(sedimentree_id, digest) {
1257
+ _assertClass(sedimentree_id, SedimentreeId);
1258
+ _assertClass(digest, Digest);
1259
+ const ret = wasm.memorystorage_loadCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1260
+ return ret;
1261
+ }
1262
+ /**
1263
+ * Load a fragment by digest, returning `FragmentWithBlob` or null.
1264
+ * @param {SedimentreeId} sedimentree_id
1265
+ * @param {Digest} digest
1266
+ * @returns {Promise<any>}
1267
+ */
1268
+ loadFragment(sedimentree_id, digest) {
1269
+ _assertClass(sedimentree_id, SedimentreeId);
1270
+ _assertClass(digest, Digest);
1271
+ const ret = wasm.memorystorage_loadFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1272
+ return ret;
1273
+ }
1274
+ /**
1275
+ * Create a new in-memory storage instance.
1276
+ */
1277
+ constructor() {
1278
+ const ret = wasm.memorystorage_new();
1279
+ this.__wbg_ptr = ret >>> 0;
1280
+ MemoryStorageFinalization.register(this, this.__wbg_ptr, this);
1281
+ return this;
1282
+ }
1283
+ /**
1284
+ * Save commits and fragments in a single batch.
1285
+ * @param {SedimentreeId} sedimentree_id
1286
+ * @param {Array<any>} commits
1287
+ * @param {Array<any>} fragments
1288
+ * @returns {Promise<any>}
1289
+ */
1290
+ saveBatchAll(sedimentree_id, commits, fragments) {
1291
+ _assertClass(sedimentree_id, SedimentreeId);
1292
+ const ret = wasm.memorystorage_saveBatchAll(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commits, fragments);
1293
+ return ret;
1294
+ }
1295
+ /**
1296
+ * Save a commit with its blob.
1297
+ * @param {SedimentreeId} sedimentree_id
1298
+ * @param {Digest} _digest
1299
+ * @param {SignedLooseCommit} signed_commit
1300
+ * @param {Uint8Array} blob
1301
+ * @returns {Promise<any>}
1302
+ */
1303
+ saveCommit(sedimentree_id, _digest, signed_commit, blob) {
1304
+ _assertClass(sedimentree_id, SedimentreeId);
1305
+ _assertClass(_digest, Digest);
1306
+ _assertClass(signed_commit, SignedLooseCommit);
1307
+ const ret = wasm.memorystorage_saveCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _digest.__wbg_ptr, signed_commit.__wbg_ptr, blob);
1308
+ return ret;
1309
+ }
1310
+ /**
1311
+ * Save a fragment with its blob.
1312
+ * @param {SedimentreeId} sedimentree_id
1313
+ * @param {Digest} _digest
1314
+ * @param {SignedFragment} signed_fragment
1315
+ * @param {Uint8Array} blob
1316
+ * @returns {Promise<any>}
1317
+ */
1318
+ saveFragment(sedimentree_id, _digest, signed_fragment, blob) {
1319
+ _assertClass(sedimentree_id, SedimentreeId);
1320
+ _assertClass(_digest, Digest);
1321
+ _assertClass(signed_fragment, SignedFragment);
1322
+ const ret = wasm.memorystorage_saveFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _digest.__wbg_ptr, signed_fragment.__wbg_ptr, blob);
1323
+ return ret;
1324
+ }
1325
+ /**
1326
+ * Save a sedimentree ID.
1327
+ * @param {SedimentreeId} sedimentree_id
1328
+ * @returns {Promise<any>}
1329
+ */
1330
+ saveSedimentreeId(sedimentree_id) {
1331
+ _assertClass(sedimentree_id, SedimentreeId);
1332
+ const ret = wasm.memorystorage_saveSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1333
+ return ret;
1334
+ }
1335
+ };
1336
+ if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prototype.free;
1337
+ var MessagePortTransport = class _MessagePortTransport {
1338
+ static __wrap(ptr) {
1339
+ ptr = ptr >>> 0;
1340
+ const obj = Object.create(_MessagePortTransport.prototype);
1341
+ obj.__wbg_ptr = ptr;
1342
+ MessagePortTransportFinalization.register(obj, obj.__wbg_ptr, obj);
1343
+ return obj;
1344
+ }
1345
+ __destroy_into_raw() {
1346
+ const ptr = this.__wbg_ptr;
1347
+ this.__wbg_ptr = 0;
1348
+ MessagePortTransportFinalization.unregister(this);
1349
+ return ptr;
1350
+ }
1351
+ free() {
1352
+ const ptr = this.__destroy_into_raw();
1353
+ wasm.__wbg_messageporttransport_free(ptr, 0);
1354
+ }
1355
+ /**
1356
+ * Disconnect (close the port) and fire the `onDisconnect` callback if registered.
1357
+ * @returns {Promise<any>}
1358
+ */
1359
+ disconnect() {
1360
+ const ret = wasm.messageporttransport_disconnect(this.__wbg_ptr);
1361
+ return ret;
1362
+ }
1363
+ /**
1364
+ * Create a new connection wrapping the given `MessagePort`.
1365
+ * @param {any} port
1366
+ */
1367
+ constructor(port) {
1368
+ const ret = wasm.messageporttransport_new(port);
1369
+ this.__wbg_ptr = ret >>> 0;
1370
+ MessagePortTransportFinalization.register(this, this.__wbg_ptr, this);
1371
+ return this;
1372
+ }
1373
+ /**
1374
+ * Register a callback to be invoked when the transport disconnects.
1375
+ *
1376
+ * Part of the [`Transport`](super::JsTransport) interface contract.
1377
+ * Typically called by internal wiring rather than directly by user code.
1378
+ * @param {Function} callback
1379
+ */
1380
+ onDisconnect(callback) {
1381
+ wasm.messageporttransport_onDisconnect(this.__wbg_ptr, callback);
1382
+ }
1383
+ /**
1384
+ * Receive raw bytes (for the handshake phase).
1385
+ * @returns {Promise<any>}
1386
+ */
1387
+ recvBytes() {
1388
+ const ret = wasm.messageporttransport_recvBytes(this.__wbg_ptr);
1389
+ return ret;
1390
+ }
1391
+ /**
1392
+ * Send raw bytes (for the handshake phase).
1393
+ * @param {Uint8Array} bytes
1394
+ * @returns {Promise<any>}
1395
+ */
1396
+ sendBytes(bytes) {
1397
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1398
+ const len0 = WASM_VECTOR_LEN;
1399
+ const ret = wasm.messageporttransport_sendBytes(this.__wbg_ptr, ptr0, len0);
1400
+ return ret;
1401
+ }
1402
+ };
1403
+ if (Symbol.dispose) MessagePortTransport.prototype[Symbol.dispose] = MessagePortTransport.prototype.free;
1404
+ var Nonce = class _Nonce {
1405
+ static __wrap(ptr) {
1406
+ ptr = ptr >>> 0;
1407
+ const obj = Object.create(_Nonce.prototype);
1408
+ obj.__wbg_ptr = ptr;
1409
+ NonceFinalization.register(obj, obj.__wbg_ptr, obj);
1410
+ return obj;
1411
+ }
1412
+ __destroy_into_raw() {
1413
+ const ptr = this.__wbg_ptr;
1414
+ this.__wbg_ptr = 0;
1415
+ NonceFinalization.unregister(this);
1416
+ return ptr;
1417
+ }
1418
+ free() {
1419
+ const ptr = this.__destroy_into_raw();
1420
+ wasm.__wbg_nonce_free(ptr, 0);
1421
+ }
1422
+ /**
1423
+ * Get the nonce as big-endian bytes.
1424
+ * @returns {Uint8Array}
1425
+ */
1426
+ get bytes() {
1427
+ const ret = wasm.nonce_bytes(this.__wbg_ptr);
1428
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1429
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1430
+ return v1;
1431
+ }
1432
+ /**
1433
+ * Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
1434
+ *
1435
+ * # Errors
1436
+ *
1437
+ * Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
1438
+ * @param {Uint8Array} bytes
1439
+ */
1440
+ constructor(bytes) {
1441
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1442
+ const len0 = WASM_VECTOR_LEN;
1443
+ const ret = wasm.nonce_new(ptr0, len0);
1444
+ if (ret[2]) {
1445
+ throw takeFromExternrefTable0(ret[1]);
1446
+ }
1447
+ this.__wbg_ptr = ret[0] >>> 0;
1448
+ NonceFinalization.register(this, this.__wbg_ptr, this);
1449
+ return this;
1450
+ }
1451
+ /**
1452
+ * Generate a random nonce.
1453
+ *
1454
+ * # Panics
1455
+ *
1456
+ * Panics if the system random number generator fails.
1457
+ * @returns {Nonce}
1458
+ */
1459
+ static random() {
1460
+ const ret = wasm.nonce_random();
1461
+ return _Nonce.__wrap(ret);
1462
+ }
1463
+ };
1464
+ if (Symbol.dispose) Nonce.prototype[Symbol.dispose] = Nonce.prototype.free;
1465
+ var PeerBatchSyncResult = class _PeerBatchSyncResult {
1466
+ static __wrap(ptr) {
1467
+ ptr = ptr >>> 0;
1468
+ const obj = Object.create(_PeerBatchSyncResult.prototype);
1469
+ obj.__wbg_ptr = ptr;
1470
+ PeerBatchSyncResultFinalization.register(obj, obj.__wbg_ptr, obj);
1471
+ return obj;
1472
+ }
1473
+ __destroy_into_raw() {
1474
+ const ptr = this.__wbg_ptr;
1475
+ this.__wbg_ptr = 0;
1476
+ PeerBatchSyncResultFinalization.unregister(this);
1477
+ return ptr;
1478
+ }
1479
+ free() {
1480
+ const ptr = this.__destroy_into_raw();
1481
+ wasm.__wbg_peerbatchsyncresult_free(ptr, 0);
1482
+ }
1483
+ /**
1484
+ * Statistics about the sync operation.
1485
+ * @returns {SyncStats}
1486
+ */
1487
+ get stats() {
1488
+ const ret = wasm.peerbatchsyncresult_stats(this.__wbg_ptr);
1489
+ return SyncStats.__wrap(ret);
1490
+ }
1491
+ /**
1492
+ * Whether the batch sync was successful with at least one connection.
1493
+ * @returns {boolean}
1494
+ */
1495
+ get success() {
1496
+ const ret = wasm.peerbatchsyncresult_success(this.__wbg_ptr);
1497
+ return ret !== 0;
1498
+ }
1499
+ /**
1500
+ * Errors that occurred during the batch sync.
1501
+ * @returns {Error[]}
1502
+ */
1503
+ get transportErrors() {
1504
+ const ret = wasm.peerbatchsyncresult_transportErrors(this.__wbg_ptr);
1505
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1506
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1507
+ return v1;
1508
+ }
1509
+ };
1510
+ if (Symbol.dispose) PeerBatchSyncResult.prototype[Symbol.dispose] = PeerBatchSyncResult.prototype.free;
1511
+ var PeerId = class _PeerId {
1512
+ static __wrap(ptr) {
1513
+ ptr = ptr >>> 0;
1514
+ const obj = Object.create(_PeerId.prototype);
1515
+ obj.__wbg_ptr = ptr;
1516
+ PeerIdFinalization.register(obj, obj.__wbg_ptr, obj);
1517
+ return obj;
1518
+ }
1519
+ __destroy_into_raw() {
1520
+ const ptr = this.__wbg_ptr;
1521
+ this.__wbg_ptr = 0;
1522
+ PeerIdFinalization.unregister(this);
1523
+ return ptr;
1524
+ }
1525
+ free() {
1526
+ const ptr = this.__destroy_into_raw();
1527
+ wasm.__wbg_peerid_free(ptr, 0);
1528
+ }
1529
+ /**
1530
+ * Creates a new `WasmPeerId` from a `PeerId`.
1531
+ *
1532
+ * # Errors
1533
+ *
1534
+ * Returns a `WasmInvalidPeerId` if the provided byte slice is not exactly 32 bytes long.
1535
+ * @param {Uint8Array} bytes
1536
+ */
1537
+ constructor(bytes) {
1538
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1539
+ const len0 = WASM_VECTOR_LEN;
1540
+ const ret = wasm.peerid_new(ptr0, len0);
1541
+ if (ret[2]) {
1542
+ throw takeFromExternrefTable0(ret[1]);
1543
+ }
1544
+ this.__wbg_ptr = ret[0] >>> 0;
1545
+ PeerIdFinalization.register(this, this.__wbg_ptr, this);
1546
+ return this;
1547
+ }
1548
+ /**
1549
+ * Returns the byte representation of the `PeerId`.
1550
+ * @returns {Uint8Array}
1551
+ */
1552
+ toBytes() {
1553
+ const ret = wasm.peerid_toBytes(this.__wbg_ptr);
1554
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1555
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1556
+ return v1;
1557
+ }
1558
+ /**
1559
+ * Returns the string representation of the `PeerId`.
1560
+ * @returns {string}
1561
+ */
1562
+ toString() {
1563
+ let deferred1_0;
1564
+ let deferred1_1;
1565
+ try {
1566
+ const ret = wasm.peerid_toString(this.__wbg_ptr);
1567
+ deferred1_0 = ret[0];
1568
+ deferred1_1 = ret[1];
1569
+ return getStringFromWasm0(ret[0], ret[1]);
1570
+ } finally {
1571
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1572
+ }
1573
+ }
1574
+ };
1575
+ if (Symbol.dispose) PeerId.prototype[Symbol.dispose] = PeerId.prototype.free;
1576
+ var PeerResultMap = class _PeerResultMap {
1577
+ static __wrap(ptr) {
1578
+ ptr = ptr >>> 0;
1579
+ const obj = Object.create(_PeerResultMap.prototype);
1580
+ obj.__wbg_ptr = ptr;
1581
+ PeerResultMapFinalization.register(obj, obj.__wbg_ptr, obj);
1582
+ return obj;
1583
+ }
1584
+ __destroy_into_raw() {
1585
+ const ptr = this.__wbg_ptr;
1586
+ this.__wbg_ptr = 0;
1587
+ PeerResultMapFinalization.unregister(this);
1588
+ return ptr;
1589
+ }
1590
+ free() {
1591
+ const ptr = this.__destroy_into_raw();
1592
+ wasm.__wbg_peerresultmap_free(ptr, 0);
1593
+ }
1594
+ /**
1595
+ * Get all entries in the peer result map.
1596
+ * @returns {PeerBatchSyncResult[]}
1597
+ */
1598
+ entries() {
1599
+ const ret = wasm.peerresultmap_entries(this.__wbg_ptr);
1600
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1601
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1602
+ return v1;
1603
+ }
1604
+ /**
1605
+ * Get the result for a specific peer ID.
1606
+ * @param {PeerId} peer_id
1607
+ * @returns {PeerBatchSyncResult | undefined}
1608
+ */
1609
+ getResult(peer_id) {
1610
+ _assertClass(peer_id, PeerId);
1611
+ const ret = wasm.peerresultmap_getResult(this.__wbg_ptr, peer_id.__wbg_ptr);
1612
+ return ret === 0 ? void 0 : PeerBatchSyncResult.__wrap(ret);
1613
+ }
1614
+ };
1615
+ if (Symbol.dispose) PeerResultMap.prototype[Symbol.dispose] = PeerResultMap.prototype.free;
1616
+ var RequestId = class _RequestId {
1617
+ static __wrap(ptr) {
1618
+ ptr = ptr >>> 0;
1619
+ const obj = Object.create(_RequestId.prototype);
1620
+ obj.__wbg_ptr = ptr;
1621
+ RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
1622
+ return obj;
1623
+ }
1624
+ __destroy_into_raw() {
1625
+ const ptr = this.__wbg_ptr;
1626
+ this.__wbg_ptr = 0;
1627
+ RequestIdFinalization.unregister(this);
1628
+ return ptr;
1629
+ }
1630
+ free() {
1631
+ const ptr = this.__destroy_into_raw();
1632
+ wasm.__wbg_requestid_free(ptr, 0);
1633
+ }
1634
+ /**
1635
+ * Upcasts; to the JS-import type for [`WasmRequestId`].
1636
+ * @returns {RequestId}
1637
+ */
1638
+ __wasm_refgen_toWasmRequestId() {
1639
+ const ret = wasm.requestid___wasm_refgen_toWasmRequestId(this.__wbg_ptr);
1640
+ return _RequestId.__wrap(ret);
1641
+ }
1642
+ /**
1643
+ * Create a new [`RequestId`] from a requestor peer ID and nonce.
1644
+ * @param {PeerId} requestor
1645
+ * @param {Nonce} nonce
1646
+ */
1647
+ constructor(requestor, nonce) {
1648
+ _assertClass(requestor, PeerId);
1649
+ _assertClass(nonce, Nonce);
1650
+ const ret = wasm.requestid_new(requestor.__wbg_ptr, nonce.__wbg_ptr);
1651
+ this.__wbg_ptr = ret >>> 0;
1652
+ RequestIdFinalization.register(this, this.__wbg_ptr, this);
1653
+ return this;
1654
+ }
1655
+ /**
1656
+ * The request nonce.
1657
+ * @returns {Nonce}
1658
+ */
1659
+ get nonce() {
1660
+ const ret = wasm.requestid_nonce(this.__wbg_ptr);
1661
+ return Nonce.__wrap(ret);
1662
+ }
1663
+ /**
1664
+ * The peer ID of the requestor.
1665
+ * @returns {PeerId}
1666
+ */
1667
+ get requestor() {
1668
+ const ret = wasm.requestid_requestor(this.__wbg_ptr);
1669
+ return PeerId.__wrap(ret);
1670
+ }
1671
+ };
1672
+ if (Symbol.dispose) RequestId.prototype[Symbol.dispose] = RequestId.prototype.free;
1673
+ var Sedimentree = class _Sedimentree {
1674
+ static __wrap(ptr) {
1675
+ ptr = ptr >>> 0;
1676
+ const obj = Object.create(_Sedimentree.prototype);
1677
+ obj.__wbg_ptr = ptr;
1678
+ SedimentreeFinalization.register(obj, obj.__wbg_ptr, obj);
1679
+ return obj;
1680
+ }
1681
+ __destroy_into_raw() {
1682
+ const ptr = this.__wbg_ptr;
1683
+ this.__wbg_ptr = 0;
1684
+ SedimentreeFinalization.unregister(this);
1685
+ return ptr;
1686
+ }
1687
+ free() {
1688
+ const ptr = this.__destroy_into_raw();
1689
+ wasm.__wbg_sedimentree_free(ptr, 0);
1690
+ }
1691
+ /**
1692
+ * Create an empty Sedimentree.
1693
+ * @returns {Sedimentree}
1694
+ */
1695
+ static empty() {
1696
+ const ret = wasm.sedimentree_empty();
1697
+ return _Sedimentree.__wrap(ret);
1698
+ }
1699
+ /**
1700
+ * Create a new Sedimentree from fragments and loose commits.
1701
+ * @param {Fragment[]} fragments
1702
+ * @param {LooseCommit[]} commits
1703
+ */
1704
+ constructor(fragments, commits) {
1705
+ const ptr0 = passArrayJsValueToWasm0(fragments, wasm.__wbindgen_export);
1706
+ const len0 = WASM_VECTOR_LEN;
1707
+ const ptr1 = passArrayJsValueToWasm0(commits, wasm.__wbindgen_export);
1708
+ const len1 = WASM_VECTOR_LEN;
1709
+ const ret = wasm.sedimentree_new(ptr0, len0, ptr1, len1);
1710
+ this.__wbg_ptr = ret >>> 0;
1711
+ SedimentreeFinalization.register(this, this.__wbg_ptr, this);
1712
+ return this;
1713
+ }
1714
+ };
1715
+ if (Symbol.dispose) Sedimentree.prototype[Symbol.dispose] = Sedimentree.prototype.free;
1716
+ var SedimentreeId = class _SedimentreeId {
1717
+ static __wrap(ptr) {
1718
+ ptr = ptr >>> 0;
1719
+ const obj = Object.create(_SedimentreeId.prototype);
1720
+ obj.__wbg_ptr = ptr;
1721
+ SedimentreeIdFinalization.register(obj, obj.__wbg_ptr, obj);
1722
+ return obj;
1723
+ }
1724
+ static __unwrap(jsValue) {
1725
+ if (!(jsValue instanceof _SedimentreeId)) {
1726
+ return 0;
1727
+ }
1728
+ return jsValue.__destroy_into_raw();
1729
+ }
1730
+ __destroy_into_raw() {
1731
+ const ptr = this.__wbg_ptr;
1732
+ this.__wbg_ptr = 0;
1733
+ SedimentreeIdFinalization.unregister(this);
1734
+ return ptr;
1735
+ }
1736
+ free() {
1737
+ const ptr = this.__destroy_into_raw();
1738
+ wasm.__wbg_sedimentreeid_free(ptr, 0);
1739
+ }
1740
+ /**
1741
+ * Upcasts; to the JS-import type for [`WasmSedimentreeId`].
1742
+ * @returns {SedimentreeId}
1743
+ */
1744
+ __wasm_refgen_toWasmSedimentreeId() {
1745
+ const ret = wasm.sedimentreeid___wasm_refgen_toWasmSedimentreeId(this.__wbg_ptr);
1746
+ return _SedimentreeId.__wrap(ret);
1747
+ }
1748
+ /**
1749
+ * Create an ID from a byte array.
1750
+ *
1751
+ * # Errors
1752
+ *
1753
+ * Returns `Not32Bytes` if the provided byte array is not exactly 32 bytes long.
1754
+ * @param {Uint8Array} bytes
1755
+ * @returns {SedimentreeId}
1756
+ */
1757
+ static fromBytes(bytes) {
1758
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1759
+ const len0 = WASM_VECTOR_LEN;
1760
+ const ret = wasm.sedimentreeid_fromBytes(ptr0, len0);
1761
+ if (ret[2]) {
1762
+ throw takeFromExternrefTable0(ret[1]);
1763
+ }
1764
+ return _SedimentreeId.__wrap(ret[0]);
1765
+ }
1766
+ /**
1767
+ * Returns the raw bytes of this ID.
1768
+ * @returns {Uint8Array}
1769
+ */
1770
+ toBytes() {
1771
+ const ret = wasm.sedimentreeid_toBytes(this.__wbg_ptr);
1772
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1773
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1774
+ return v1;
1775
+ }
1776
+ /**
1777
+ * Returns the string representation of the ID.
1778
+ * @returns {string}
1779
+ */
1780
+ toString() {
1781
+ let deferred1_0;
1782
+ let deferred1_1;
1783
+ try {
1784
+ const ret = wasm.sedimentreeid_toString(this.__wbg_ptr);
1785
+ deferred1_0 = ret[0];
1786
+ deferred1_1 = ret[1];
1787
+ return getStringFromWasm0(ret[0], ret[1]);
1788
+ } finally {
1789
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1790
+ }
1791
+ }
1792
+ };
1793
+ if (Symbol.dispose) SedimentreeId.prototype[Symbol.dispose] = SedimentreeId.prototype.free;
1794
+ var SedimentreeIdsArray = class _SedimentreeIdsArray {
1795
+ static __wrap(ptr) {
1796
+ ptr = ptr >>> 0;
1797
+ const obj = Object.create(_SedimentreeIdsArray.prototype);
1798
+ obj.__wbg_ptr = ptr;
1799
+ SedimentreeIdsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
1800
+ return obj;
1801
+ }
1802
+ __destroy_into_raw() {
1803
+ const ptr = this.__wbg_ptr;
1804
+ this.__wbg_ptr = 0;
1805
+ SedimentreeIdsArrayFinalization.unregister(this);
1806
+ return ptr;
1807
+ }
1808
+ free() {
1809
+ const ptr = this.__destroy_into_raw();
1810
+ wasm.__wbg_sedimentreeidsarray_free(ptr, 0);
1811
+ }
1812
+ /**
1813
+ * Upcasts; to the JS-import type for [`WasmSedimentreeIdsArray`].
1814
+ * @returns {SedimentreeIdsArray}
1815
+ */
1816
+ __wasm_refgen_toWasmSedimentreeIdsArray() {
1817
+ const ret = wasm.sedimentreeidsarray___wasm_refgen_toWasmSedimentreeIdsArray(this.__wbg_ptr);
1818
+ return _SedimentreeIdsArray.__wrap(ret);
1819
+ }
1820
+ };
1821
+ if (Symbol.dispose) SedimentreeIdsArray.prototype[Symbol.dispose] = SedimentreeIdsArray.prototype.free;
1822
+ var SignedFragment = class _SignedFragment {
1823
+ static __wrap(ptr) {
1824
+ ptr = ptr >>> 0;
1825
+ const obj = Object.create(_SignedFragment.prototype);
1826
+ obj.__wbg_ptr = ptr;
1827
+ SignedFragmentFinalization.register(obj, obj.__wbg_ptr, obj);
1828
+ return obj;
1829
+ }
1830
+ static __unwrap(jsValue) {
1831
+ if (!(jsValue instanceof _SignedFragment)) {
1832
+ return 0;
1833
+ }
1834
+ return jsValue.__destroy_into_raw();
1835
+ }
1836
+ __destroy_into_raw() {
1837
+ const ptr = this.__wbg_ptr;
1838
+ this.__wbg_ptr = 0;
1839
+ SignedFragmentFinalization.unregister(this);
1840
+ return ptr;
1841
+ }
1842
+ free() {
1843
+ const ptr = this.__destroy_into_raw();
1844
+ wasm.__wbg_signedfragment_free(ptr, 0);
1845
+ }
1846
+ /**
1847
+ * Upcasts; to the JS-import type for [`WasmSignedFragment`].
1848
+ * @returns {SignedFragment}
1849
+ */
1850
+ __wasm_refgen_toWasmSignedFragment() {
1851
+ const ret = wasm.signedfragment___wasm_refgen_toWasmSignedFragment(this.__wbg_ptr);
1852
+ return _SignedFragment.__wrap(ret);
1853
+ }
1854
+ /**
1855
+ * Encode this signed fragment to raw bytes.
1856
+ * @returns {Uint8Array}
1857
+ */
1858
+ encode() {
1859
+ const ret = wasm.signedfragment_encode(this.__wbg_ptr);
1860
+ return ret;
1861
+ }
1862
+ /**
1863
+ * Get the unsigned payload without re-verifying the signature.
1864
+ *
1865
+ * # Errors
1866
+ *
1867
+ * Returns an error if the payload cannot be decoded.
1868
+ * @returns {Fragment}
1869
+ */
1870
+ get payload() {
1871
+ const ret = wasm.signedfragment_payload(this.__wbg_ptr);
1872
+ if (ret[2]) {
1873
+ throw takeFromExternrefTable0(ret[1]);
1874
+ }
1875
+ return Fragment.__wrap(ret[0]);
1876
+ }
1877
+ /**
1878
+ * Decode a `SignedFragment` from raw bytes.
1879
+ *
1880
+ * # Errors
1881
+ *
1882
+ * Returns an error if the bytes are not a valid signed fragment.
1883
+ * @param {Uint8Array} bytes
1884
+ * @returns {SignedFragment}
1885
+ */
1886
+ static tryDecode(bytes) {
1887
+ const ret = wasm.signedfragment_tryDecode(bytes);
1888
+ if (ret[2]) {
1889
+ throw takeFromExternrefTable0(ret[1]);
1890
+ }
1891
+ return _SignedFragment.__wrap(ret[0]);
1892
+ }
1893
+ };
1894
+ if (Symbol.dispose) SignedFragment.prototype[Symbol.dispose] = SignedFragment.prototype.free;
1895
+ var SignedLooseCommit = class _SignedLooseCommit {
1896
+ static __wrap(ptr) {
1897
+ ptr = ptr >>> 0;
1898
+ const obj = Object.create(_SignedLooseCommit.prototype);
1899
+ obj.__wbg_ptr = ptr;
1900
+ SignedLooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
1901
+ return obj;
1902
+ }
1903
+ static __unwrap(jsValue) {
1904
+ if (!(jsValue instanceof _SignedLooseCommit)) {
1905
+ return 0;
1906
+ }
1907
+ return jsValue.__destroy_into_raw();
1908
+ }
1909
+ __destroy_into_raw() {
1910
+ const ptr = this.__wbg_ptr;
1911
+ this.__wbg_ptr = 0;
1912
+ SignedLooseCommitFinalization.unregister(this);
1913
+ return ptr;
1914
+ }
1915
+ free() {
1916
+ const ptr = this.__destroy_into_raw();
1917
+ wasm.__wbg_signedloosecommit_free(ptr, 0);
1918
+ }
1919
+ /**
1920
+ * Upcasts; to the JS-import type for [`WasmSignedLooseCommit`].
1921
+ * @returns {SignedLooseCommit}
1922
+ */
1923
+ __wasm_refgen_toWasmSignedLooseCommit() {
1924
+ const ret = wasm.signedloosecommit___wasm_refgen_toWasmSignedLooseCommit(this.__wbg_ptr);
1925
+ return _SignedLooseCommit.__wrap(ret);
1926
+ }
1927
+ /**
1928
+ * Encode this signed loose commit to raw bytes.
1929
+ * @returns {Uint8Array}
1930
+ */
1931
+ encode() {
1932
+ const ret = wasm.signedloosecommit_encode(this.__wbg_ptr);
1933
+ return ret;
1934
+ }
1935
+ /**
1936
+ * Get the unsigned payload without re-verifying the signature.
1937
+ *
1938
+ * # Errors
1939
+ *
1940
+ * Returns an error if the payload cannot be decoded.
1941
+ * @returns {LooseCommit}
1942
+ */
1943
+ get payload() {
1944
+ const ret = wasm.signedloosecommit_payload(this.__wbg_ptr);
1945
+ if (ret[2]) {
1946
+ throw takeFromExternrefTable0(ret[1]);
1947
+ }
1948
+ return LooseCommit.__wrap(ret[0]);
1949
+ }
1950
+ /**
1951
+ * Decode a `SignedLooseCommit` from raw bytes.
1952
+ *
1953
+ * # Errors
1954
+ *
1955
+ * Returns an error if the bytes are not a valid signed loose commit.
1956
+ * @param {Uint8Array} bytes
1957
+ * @returns {SignedLooseCommit}
1958
+ */
1959
+ static tryDecode(bytes) {
1960
+ const ret = wasm.signedloosecommit_tryDecode(bytes);
1961
+ if (ret[2]) {
1962
+ throw takeFromExternrefTable0(ret[1]);
1963
+ }
1964
+ return _SignedLooseCommit.__wrap(ret[0]);
1965
+ }
1966
+ };
1967
+ if (Symbol.dispose) SignedLooseCommit.prototype[Symbol.dispose] = SignedLooseCommit.prototype.free;
1968
+ var Subduction = class _Subduction {
1969
+ static __wrap(ptr) {
1970
+ ptr = ptr >>> 0;
1971
+ const obj = Object.create(_Subduction.prototype);
1972
+ obj.__wbg_ptr = ptr;
1973
+ SubductionFinalization.register(obj, obj.__wbg_ptr, obj);
1974
+ return obj;
1975
+ }
1976
+ __destroy_into_raw() {
1977
+ const ptr = this.__wbg_ptr;
1978
+ this.__wbg_ptr = 0;
1979
+ SubductionFinalization.unregister(this);
1980
+ return ptr;
1981
+ }
1982
+ free() {
1983
+ const ptr = this.__destroy_into_raw();
1984
+ wasm.__wbg_subduction_free(ptr, 0);
1985
+ }
1986
+ /**
1987
+ * Accept a connection from a peer over any [`Transport`](JsTransport).
1988
+ *
1989
+ * Performs the responder side of the handshake, then adds the authenticated
1990
+ * connection. This is the counterpart to [`connectTransport`](Self::connect_transport).
1991
+ *
1992
+ * # Arguments
1993
+ *
1994
+ * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
1995
+ * * `service_name` - Shared service name for discovery
1996
+ *
1997
+ * # Errors
1998
+ *
1999
+ * Returns an error if the handshake or connection fails.
2000
+ * @param {Transport} transport
2001
+ * @param {string} service_name
2002
+ * @returns {Promise<PeerId>}
2003
+ */
2004
+ acceptTransport(transport, service_name) {
2005
+ const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2006
+ const len0 = WASM_VECTOR_LEN;
2007
+ const ret = wasm.subduction_acceptTransport(this.__wbg_ptr, transport, ptr0, len0);
2008
+ return ret;
2009
+ }
2010
+ /**
2011
+ * Add a commit with its associated blob to the storage.
2012
+ *
2013
+ * The commit metadata (including `BlobMeta`) is computed internally from
2014
+ * the provided blob, ensuring consistency by construction.
2015
+ *
2016
+ * # Errors
2017
+ *
2018
+ * Returns a [`WasmWriteError`] if storage, networking, or policy fail.
2019
+ * @param {SedimentreeId} id
2020
+ * @param {Digest[]} parents
2021
+ * @param {Uint8Array} blob
2022
+ * @returns {Promise<FragmentRequested | undefined>}
2023
+ */
2024
+ addCommit(id, parents, blob) {
2025
+ _assertClass(id, SedimentreeId);
2026
+ const ptr0 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
2027
+ const len0 = WASM_VECTOR_LEN;
2028
+ const ret = wasm.subduction_addCommit(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0, blob);
2029
+ return ret;
2030
+ }
2031
+ /**
2032
+ * Onboard an authenticated transport: add it and sync all sedimentrees.
2033
+ *
2034
+ * Accepts an [`AuthenticatedTransport`](WasmAuthenticatedTransport),
2035
+ * obtained via [`AuthenticatedTransport.setup`](WasmAuthenticatedTransport::setup),
2036
+ * [`AuthenticatedWebSocket.toTransport`], or [`AuthenticatedLongPoll.toTransport`].
2037
+ *
2038
+ * Returns `true` if this is a new peer, `false` if already connected.
2039
+ *
2040
+ * Add an authenticated transport to tracking.
2041
+ *
2042
+ * This does not perform any synchronization. To sync after adding,
2043
+ * call [`fullSyncWithPeer`](Self::full_sync_with_peer).
2044
+ *
2045
+ * Returns `true` if this is a new peer, `false` if already connected.
2046
+ *
2047
+ * # Errors
2048
+ *
2049
+ * Returns an error if the connection is rejected by the policy.
2050
+ * @param {AuthenticatedTransport} transport
2051
+ * @returns {Promise<boolean>}
2052
+ */
2053
+ addConnection(transport) {
2054
+ _assertClass(transport, AuthenticatedTransport);
2055
+ const ret = wasm.subduction_addConnection(this.__wbg_ptr, transport.__wbg_ptr);
2056
+ return ret;
2057
+ }
2058
+ /**
2059
+ * Add a fragment with its associated blob to the storage.
2060
+ *
2061
+ * The fragment metadata (including `BlobMeta`) is computed internally from
2062
+ * the provided blob, ensuring consistency by construction.
2063
+ *
2064
+ * # Errors
2065
+ *
2066
+ * Returns a [`WasmWriteError`] if storage, networking, or policy fail.
2067
+ * @param {SedimentreeId} id
2068
+ * @param {Digest} head
2069
+ * @param {Digest[]} boundary
2070
+ * @param {Digest[]} checkpoints
2071
+ * @param {Uint8Array} blob
2072
+ * @returns {Promise<void>}
2073
+ */
2074
+ addFragment(id, head, boundary, checkpoints, blob) {
2075
+ _assertClass(id, SedimentreeId);
2076
+ _assertClass(head, Digest);
2077
+ const ptr0 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
2078
+ const len0 = WASM_VECTOR_LEN;
2079
+ const ptr1 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
2080
+ const len1 = WASM_VECTOR_LEN;
2081
+ const ret = wasm.subduction_addFragment(this.__wbg_ptr, id.__wbg_ptr, head.__wbg_ptr, ptr0, len0, ptr1, len1, blob);
2082
+ return ret;
2083
+ }
2084
+ /**
2085
+ * Add a Sedimentree.
2086
+ *
2087
+ * # Errors
2088
+ *
2089
+ * Returns [`WasmWriteError`] if there is a problem with storage, networking, or policy.
2090
+ * @param {SedimentreeId} id
2091
+ * @param {Sedimentree} sedimentree
2092
+ * @param {Uint8Array[]} blobs
2093
+ * @returns {Promise<void>}
2094
+ */
2095
+ addSedimentree(id, sedimentree, blobs) {
2096
+ _assertClass(id, SedimentreeId);
2097
+ _assertClass(sedimentree, Sedimentree);
2098
+ const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
2099
+ const len0 = WASM_VECTOR_LEN;
2100
+ const ret = wasm.subduction_addSedimentree(this.__wbg_ptr, id.__wbg_ptr, sedimentree.__wbg_ptr, ptr0, len0);
2101
+ return ret;
2102
+ }
2103
+ /**
2104
+ * Connect to a peer via WebSocket and add the connection.
2105
+ *
2106
+ * This performs the cryptographic handshake, verifies the server's identity,
2107
+ * and adds the authenticated connection for syncing.
2108
+ *
2109
+ * Returns the verified peer ID on success.
2110
+ *
2111
+ * # Arguments
2112
+ *
2113
+ * * `address` - The WebSocket URL to connect to
2114
+ * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2115
+ *
2116
+ * # Errors
2117
+ *
2118
+ * Returns an error if connection, handshake, or adding the connection fails.
2119
+ * @param {URL} address
2120
+ * @param {PeerId} expected_peer_id
2121
+ * @returns {Promise<PeerId>}
2122
+ */
2123
+ connect(address, expected_peer_id) {
2124
+ _assertClass(expected_peer_id, PeerId);
2125
+ const ret = wasm.subduction_connect(this.__wbg_ptr, address, expected_peer_id.__wbg_ptr);
2126
+ return ret;
2127
+ }
2128
+ /**
2129
+ * Connect to a peer via WebSocket using discovery mode and add the connection.
2130
+ *
2131
+ * Returns the discovered and verified peer ID on success.
2132
+ *
2133
+ * # Arguments
2134
+ *
2135
+ * * `address` - The WebSocket URL to connect to
2136
+ * * `timeout_milliseconds` - Request timeout in milliseconds (defaults to 30000)
2137
+ * * `service_name` - The service name for discovery (defaults to URL host)
2138
+ *
2139
+ * # Errors
2140
+ *
2141
+ * Returns an error if connection, handshake, or adding the connection fails.
2142
+ * @param {URL} address
2143
+ * @param {string | null} [service_name]
2144
+ * @returns {Promise<PeerId>}
2145
+ */
2146
+ connectDiscover(address, service_name) {
2147
+ var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2148
+ var len0 = WASM_VECTOR_LEN;
2149
+ const ret = wasm.subduction_connectDiscover(this.__wbg_ptr, address, ptr0, len0);
2150
+ return ret;
2151
+ }
2152
+ /**
2153
+ * Connect to a peer via HTTP long-poll using discovery mode.
2154
+ *
2155
+ * Returns the discovered and verified peer ID on success.
2156
+ *
2157
+ * # Arguments
2158
+ *
2159
+ * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2160
+ * * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
2161
+ * * `service_name` - The service name for discovery (defaults to `base_url`)
2162
+ *
2163
+ * # Errors
2164
+ *
2165
+ * Returns an error if connection, handshake, or adding the connection fails.
2166
+ * @param {string} base_url
2167
+ * @param {string | null} [service_name]
2168
+ * @returns {Promise<PeerId>}
2169
+ */
2170
+ connectDiscoverLongPoll(base_url, service_name) {
2171
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2172
+ const len0 = WASM_VECTOR_LEN;
2173
+ var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2174
+ var len1 = WASM_VECTOR_LEN;
2175
+ const ret = wasm.subduction_connectDiscoverLongPoll(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2176
+ return ret;
2177
+ }
2178
+ /**
2179
+ * Connect to a peer via HTTP long-poll and add the connection.
2180
+ *
2181
+ * Returns the verified peer ID on success.
2182
+ *
2183
+ * # Arguments
2184
+ *
2185
+ * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2186
+ * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2187
+ * * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
2188
+ *
2189
+ * # Errors
2190
+ *
2191
+ * Returns an error if connection, handshake, or adding the connection fails.
2192
+ * @param {string} base_url
2193
+ * @param {PeerId} expected_peer_id
2194
+ * @returns {Promise<PeerId>}
2195
+ */
2196
+ connectLongPoll(base_url, expected_peer_id) {
2197
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2198
+ const len0 = WASM_VECTOR_LEN;
2199
+ _assertClass(expected_peer_id, PeerId);
2200
+ const ret = wasm.subduction_connectLongPoll(this.__wbg_ptr, ptr0, len0, expected_peer_id.__wbg_ptr);
2201
+ return ret;
2202
+ }
2203
+ /**
2204
+ * Connect to a peer over any [`Transport`](JsTransport) using discovery mode.
2205
+ *
2206
+ * Performs a discovery handshake, then adds the authenticated connection.
2207
+ * The peer's identity is discovered during the handshake.
2208
+ *
2209
+ * # Arguments
2210
+ *
2211
+ * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
2212
+ * * `service_name` - Shared service name for discovery
2213
+ *
2214
+ * # Errors
2215
+ *
2216
+ * Returns an error if the handshake or connection fails.
2217
+ * @param {Transport} transport
2218
+ * @param {string} service_name
2219
+ * @returns {Promise<PeerId>}
2220
+ */
2221
+ connectTransport(transport, service_name) {
2222
+ const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2223
+ const len0 = WASM_VECTOR_LEN;
2224
+ const ret = wasm.subduction_connectTransport(this.__wbg_ptr, transport, ptr0, len0);
2225
+ return ret;
2226
+ }
2227
+ /**
2228
+ * Disconnect from all peers.
2229
+ *
2230
+ * # Errors
2231
+ *
2232
+ * Returns a [`WasmDisconnectionError`] if disconnection was not graceful.
2233
+ * @returns {Promise<void>}
2234
+ */
2235
+ disconnectAll() {
2236
+ const ret = wasm.subduction_disconnectAll(this.__wbg_ptr);
2237
+ return ret;
2238
+ }
2239
+ /**
2240
+ * Disconnect from a peer by its ID.
2241
+ *
2242
+ * # Errors
2243
+ *
2244
+ * Returns a `WasmDisconnectionError` if disconnection fails.
2245
+ * @param {PeerId} peer_id
2246
+ * @returns {Promise<boolean>}
2247
+ */
2248
+ disconnectFromPeer(peer_id) {
2249
+ _assertClass(peer_id, PeerId);
2250
+ const ret = wasm.subduction_disconnectFromPeer(this.__wbg_ptr, peer_id.__wbg_ptr);
2251
+ return ret;
2252
+ }
2253
+ /**
2254
+ * Fetch blobs by their digests, with an optional timeout in milliseconds.
2255
+ *
2256
+ * # Errors
2257
+ *
2258
+ * Returns a [`WasmIoError`] if storage or networking fail.
2259
+ * @param {SedimentreeId} id
2260
+ * @param {bigint | null} [timeout_milliseconds]
2261
+ * @returns {Promise<Uint8Array[] | undefined>}
2262
+ */
2263
+ fetchBlobs(id, timeout_milliseconds) {
2264
+ _assertClass(id, SedimentreeId);
2265
+ const ret = wasm.subduction_fetchBlobs(this.__wbg_ptr, id.__wbg_ptr, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2266
+ return ret;
2267
+ }
2268
+ /**
2269
+ * Sync all known Sedimentree IDs with all connected peers.
2270
+ * @param {bigint | null} [timeout_milliseconds]
2271
+ * @returns {Promise<PeerBatchSyncResult>}
2272
+ */
2273
+ fullSyncWithAllPeers(timeout_milliseconds) {
2274
+ const ret = wasm.subduction_fullSyncWithAllPeers(this.__wbg_ptr, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2275
+ return ret;
2276
+ }
2277
+ /**
2278
+ * Sync all known Sedimentree IDs with a single peer.
2279
+ *
2280
+ * # Arguments
2281
+ *
2282
+ * * `peer_id` - The peer to sync with
2283
+ * * `subscribe` - Whether to subscribe to future updates (default: `true`)
2284
+ * * `timeout_milliseconds` - Per-call timeout in milliseconds
2285
+ * @param {PeerId} peer_id
2286
+ * @param {boolean | null} [subscribe]
2287
+ * @param {bigint | null} [timeout_milliseconds]
2288
+ * @returns {Promise<PeerBatchSyncResult>}
2289
+ */
2290
+ fullSyncWithPeer(peer_id, subscribe, timeout_milliseconds) {
2291
+ _assertClass(peer_id, PeerId);
2292
+ const ret = wasm.subduction_fullSyncWithPeer(this.__wbg_ptr, peer_id.__wbg_ptr, isLikeNone(subscribe) ? 16777215 : subscribe ? 1 : 0, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2293
+ return ret;
2294
+ }
2295
+ /**
2296
+ * Get a local blob by its digest.
2297
+ *
2298
+ * # Errors
2299
+ *
2300
+ * Returns a [`JsStorageError`] if JS storage fails.
2301
+ * @param {SedimentreeId} id
2302
+ * @param {Digest} digest
2303
+ * @returns {Promise<Uint8Array | undefined>}
2304
+ */
2305
+ getBlob(id, digest) {
2306
+ _assertClass(id, SedimentreeId);
2307
+ _assertClass(digest, Digest);
2308
+ const ret = wasm.subduction_getBlob(this.__wbg_ptr, id.__wbg_ptr, digest.__wbg_ptr);
2309
+ return ret;
2310
+ }
2311
+ /**
2312
+ * Get all local blobs for a given Sedimentree ID.
2313
+ *
2314
+ * # Errors
2315
+ *
2316
+ * Returns a [`JsStorageError`] if JS storage fails.
2317
+ * @param {SedimentreeId} id
2318
+ * @returns {Promise<Uint8Array[]>}
2319
+ */
2320
+ getBlobs(id) {
2321
+ _assertClass(id, SedimentreeId);
2322
+ const ret = wasm.subduction_getBlobs(this.__wbg_ptr, id.__wbg_ptr);
2323
+ return ret;
2324
+ }
2325
+ /**
2326
+ * Get all commits for a given Sedimentree ID
2327
+ * @param {SedimentreeId} id
2328
+ * @returns {Promise<LooseCommit[] | undefined>}
2329
+ */
2330
+ getCommits(id) {
2331
+ _assertClass(id, SedimentreeId);
2332
+ const ret = wasm.subduction_getCommits(this.__wbg_ptr, id.__wbg_ptr);
2333
+ return ret;
2334
+ }
2335
+ /**
2336
+ * Get the peer IDs of all connected peers.
2337
+ * @returns {Promise<PeerId[]>}
2338
+ */
2339
+ getConnectedPeerIds() {
2340
+ const ret = wasm.subduction_getConnectedPeerIds(this.__wbg_ptr);
2341
+ return ret;
2342
+ }
2343
+ /**
2344
+ * Get all fragments for a given Sedimentree ID
2345
+ * @param {SedimentreeId} id
2346
+ * @returns {Promise<Fragment[] | undefined>}
2347
+ */
2348
+ getFragments(id) {
2349
+ _assertClass(id, SedimentreeId);
2350
+ const ret = wasm.subduction_getFragments(this.__wbg_ptr, id.__wbg_ptr);
2351
+ return ret;
2352
+ }
2353
+ /**
2354
+ * Hydrate a [`Subduction`] instance from external storage.
2355
+ *
2356
+ * Loads all sedimentree data from storage and reconstructs the in-memory
2357
+ * state before initializing the sync engine.
2358
+ *
2359
+ * # Arguments
2360
+ *
2361
+ * * `signer` - The cryptographic signer for this node's identity
2362
+ * * `storage` - Storage backend for persisting data
2363
+ * * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
2364
+ * When set, clients can connect without knowing the server's peer ID.
2365
+ * * `hash_metric_override` - Optional custom depth metric function
2366
+ * * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
2367
+ * * `policy` - Optional connection/storage authorization policy.
2368
+ * Defaults to allow-all.
2369
+ * * `ephemeral_policy` - Optional ephemeral message authorization policy.
2370
+ * Defaults to allow-all.
2371
+ *
2372
+ * # Panics
2373
+ *
2374
+ * Panics if `hash_metric_override` is `Some` but the underlying JS value
2375
+ * cannot be cast to a `Function`.
2376
+ *
2377
+ * # Errors
2378
+ *
2379
+ * Returns [`WasmHydrationError`] if hydration fails.
2380
+ * @param {any} signer
2381
+ * @param {SedimentreeStorage} storage
2382
+ * @param {string | null} [service_name]
2383
+ * @param {(digest: Digest) => Depth | null} [hash_metric_override]
2384
+ * @param {number | null} [max_pending_blob_requests]
2385
+ * @param {Policy | null} [policy]
2386
+ * @param {EphemeralPolicy | null} [ephemeral_policy]
2387
+ * @param {Function | null} [on_remote_heads]
2388
+ * @param {Function | null} [on_ephemeral]
2389
+ * @returns {Promise<Subduction>}
2390
+ */
2391
+ static hydrate(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, ephemeral_policy, on_remote_heads, on_ephemeral) {
2392
+ var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2393
+ var len0 = WASM_VECTOR_LEN;
2394
+ const ret = wasm.subduction_hydrate(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(ephemeral_policy) ? 0 : addToExternrefTable0(ephemeral_policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2395
+ return ret;
2396
+ }
2397
+ /**
2398
+ * Link two local [`Subduction`](WasmSubduction) instances over a
2399
+ * [`MessageChannel`](web_sys::MessageChannel).
2400
+ *
2401
+ * Creates a `MessageChannel`, performs a discovery handshake between
2402
+ * the two instances, and adds the connections to both. This is the
2403
+ * simplest way to sync two local instances.
2404
+ *
2405
+ * # Errors
2406
+ *
2407
+ * Returns an error if the handshake or connection fails.
2408
+ * @param {Subduction} a
2409
+ * @param {Subduction} b
2410
+ * @returns {Promise<void>}
2411
+ */
2412
+ static link(a, b) {
2413
+ _assertClass(a, _Subduction);
2414
+ _assertClass(b, _Subduction);
2415
+ const ret = wasm.subduction_link(a.__wbg_ptr, b.__wbg_ptr);
2416
+ return ret;
2417
+ }
2418
+ /**
2419
+ * Create a new [`Subduction`] instance.
2420
+ *
2421
+ * # Arguments
2422
+ *
2423
+ * * `signer` - The cryptographic signer for this node's identity
2424
+ * * `storage` - Storage backend for persisting data
2425
+ * * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
2426
+ * When set, clients can connect without knowing the server's peer ID.
2427
+ * * `hash_metric_override` - Optional custom depth metric function
2428
+ * * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
2429
+ * * `policy` - Optional connection/storage authorization policy.
2430
+ * Defaults to allow-all.
2431
+ * * `ephemeral_policy` - Optional ephemeral message authorization policy.
2432
+ * Defaults to allow-all.
2433
+ *
2434
+ * # Panics
2435
+ *
2436
+ * Panics if `hash_metric_override` is `Some` but the underlying JS value
2437
+ * cannot be cast to a `Function`.
2438
+ * @param {any} signer
2439
+ * @param {SedimentreeStorage} storage
2440
+ * @param {string | null} [service_name]
2441
+ * @param {(digest: Digest) => Depth | null} [hash_metric_override]
2442
+ * @param {number | null} [max_pending_blob_requests]
2443
+ * @param {Policy | null} [policy]
2444
+ * @param {EphemeralPolicy | null} [ephemeral_policy]
2445
+ * @param {Function | null} [on_remote_heads]
2446
+ * @param {Function | null} [on_ephemeral]
2447
+ */
2448
+ constructor(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, ephemeral_policy, on_remote_heads, on_ephemeral) {
2449
+ var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2450
+ var len0 = WASM_VECTOR_LEN;
2451
+ const ret = wasm.subduction_new(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(ephemeral_policy) ? 0 : addToExternrefTable0(ephemeral_policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2452
+ this.__wbg_ptr = ret >>> 0;
2453
+ SubductionFinalization.register(this, this.__wbg_ptr, this);
2454
+ return this;
2455
+ }
2456
+ /**
2457
+ * Publish an ephemeral message to all subscribers of a topic.
2458
+ *
2459
+ * The payload is opaque bytes — encoding is the caller's responsibility.
2460
+ * Messages are fire-and-forget; delivery is best-effort.
2461
+ *
2462
+ * # Panics
2463
+ *
2464
+ * Panics if the platform's random number generator fails.
2465
+ * @param {Topic} topic
2466
+ * @param {Uint8Array} payload
2467
+ * @returns {Promise<void>}
2468
+ */
2469
+ publishEphemeral(topic, payload) {
2470
+ _assertClass(topic, Topic);
2471
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
2472
+ const len0 = WASM_VECTOR_LEN;
2473
+ const ret = wasm.subduction_publishEphemeral(this.__wbg_ptr, topic.__wbg_ptr, ptr0, len0);
2474
+ return ret;
2475
+ }
2476
+ /**
2477
+ * Remove a Sedimentree and all associated data.
2478
+ *
2479
+ * # Errors
2480
+ *
2481
+ * Returns a [`WasmIoError`] if storage or networking fail.
2482
+ * @param {SedimentreeId} id
2483
+ * @returns {Promise<void>}
2484
+ */
2485
+ removeSedimentree(id) {
2486
+ _assertClass(id, SedimentreeId);
2487
+ const ret = wasm.subduction_removeSedimentree(this.__wbg_ptr, id.__wbg_ptr);
2488
+ return ret;
2489
+ }
2490
+ /**
2491
+ * Request blobs by their digests from connected peers for a specific sedimentree.
2492
+ * @param {SedimentreeId} id
2493
+ * @param {Digest[]} digests
2494
+ * @returns {Promise<void>}
2495
+ */
2496
+ requestBlobs(id, digests) {
2497
+ _assertClass(id, SedimentreeId);
2498
+ const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
2499
+ const len0 = WASM_VECTOR_LEN;
2500
+ const ret = wasm.subduction_requestBlobs(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
2501
+ return ret;
2502
+ }
2503
+ /**
2504
+ * Get all known Sedimentree IDs
2505
+ * @returns {Promise<SedimentreeId[]>}
2506
+ */
2507
+ sedimentreeIds() {
2508
+ const ret = wasm.subduction_sedimentreeIds(this.__wbg_ptr);
2509
+ return ret;
2510
+ }
2511
+ /**
2512
+ * Get the backing storage.
2513
+ * @returns {any}
2514
+ */
2515
+ get storage() {
2516
+ const ret = wasm.subduction_storage(this.__wbg_ptr);
2517
+ return ret;
2518
+ }
2519
+ /**
2520
+ * Subscribe to ephemeral messages for the given topics
2521
+ * from all connected peers.
2522
+ * @param {Topic[]} topics
2523
+ * @returns {Promise<void>}
2524
+ */
2525
+ subscribeEphemeral(topics) {
2526
+ const ptr0 = passArrayJsValueToWasm0(topics, wasm.__wbindgen_export);
2527
+ const len0 = WASM_VECTOR_LEN;
2528
+ const ret = wasm.subduction_subscribeEphemeral(this.__wbg_ptr, ptr0, len0);
2529
+ return ret;
2530
+ }
2531
+ /**
2532
+ * Request batch sync for a given Sedimentree ID from all connected peers.
2533
+ *
2534
+ * # Arguments
2535
+ *
2536
+ * * `id` - The sedimentree ID to sync
2537
+ * * `subscribe` - Whether to subscribe for incremental updates
2538
+ * * `timeout_milliseconds` - Optional timeout in milliseconds
2539
+ *
2540
+ * # Errors
2541
+ *
2542
+ * Returns a [`WasmIoError`] if storage or networking fail.
2543
+ * @param {SedimentreeId} id
2544
+ * @param {boolean} subscribe
2545
+ * @param {bigint | null} [timeout_milliseconds]
2546
+ * @returns {Promise<PeerResultMap>}
2547
+ */
2548
+ syncWithAllPeers(id, subscribe, timeout_milliseconds) {
2549
+ _assertClass(id, SedimentreeId);
2550
+ const ret = wasm.subduction_syncWithAllPeers(this.__wbg_ptr, id.__wbg_ptr, subscribe, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2551
+ return ret;
2552
+ }
2553
+ /**
2554
+ * Request batch sync for a given Sedimentree ID from a specific peer.
2555
+ *
2556
+ * # Arguments
2557
+ *
2558
+ * * `to_ask` - The peer ID to sync with
2559
+ * * `id` - The sedimentree ID to sync
2560
+ * * `subscribe` - Whether to subscribe for incremental updates
2561
+ * * `timeout_milliseconds` - Optional timeout in milliseconds
2562
+ *
2563
+ * # Errors
2564
+ *
2565
+ * Returns a [`WasmIoError`] if storage or networking fail.
2566
+ * @param {PeerId} to_ask
2567
+ * @param {SedimentreeId} id
2568
+ * @param {boolean} subscribe
2569
+ * @param {bigint | null} [timeout_milliseconds]
2570
+ * @returns {Promise<PeerBatchSyncResult>}
2571
+ */
2572
+ syncWithPeer(to_ask, id, subscribe, timeout_milliseconds) {
2573
+ _assertClass(to_ask, PeerId);
2574
+ _assertClass(id, SedimentreeId);
2575
+ const ret = wasm.subduction_syncWithPeer(this.__wbg_ptr, to_ask.__wbg_ptr, id.__wbg_ptr, subscribe, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2576
+ return ret;
2577
+ }
2578
+ /**
2579
+ * Unsubscribe from ephemeral messages for the given topics
2580
+ * from all connected peers.
2581
+ * @param {Topic[]} topics
2582
+ * @returns {Promise<void>}
2583
+ */
2584
+ unsubscribeEphemeral(topics) {
2585
+ const ptr0 = passArrayJsValueToWasm0(topics, wasm.__wbindgen_export);
2586
+ const len0 = WASM_VECTOR_LEN;
2587
+ const ret = wasm.subduction_unsubscribeEphemeral(this.__wbg_ptr, ptr0, len0);
2588
+ return ret;
2589
+ }
2590
+ };
2591
+ if (Symbol.dispose) Subduction.prototype[Symbol.dispose] = Subduction.prototype.free;
2592
+ var SubductionHttpLongPoll = class _SubductionHttpLongPoll {
2593
+ static __wrap(ptr) {
2594
+ ptr = ptr >>> 0;
2595
+ const obj = Object.create(_SubductionHttpLongPoll.prototype);
2596
+ obj.__wbg_ptr = ptr;
2597
+ SubductionHttpLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
2598
+ return obj;
2599
+ }
2600
+ __destroy_into_raw() {
2601
+ const ptr = this.__wbg_ptr;
2602
+ this.__wbg_ptr = 0;
2603
+ SubductionHttpLongPollFinalization.unregister(this);
2604
+ return ptr;
2605
+ }
2606
+ free() {
2607
+ const ptr = this.__destroy_into_raw();
2608
+ wasm.__wbg_subductionhttplongpoll_free(ptr, 0);
2609
+ }
2610
+ /**
2611
+ * Disconnect from the peer gracefully.
2612
+ *
2613
+ * Fires the `onDisconnect` callback if one is registered.
2614
+ *
2615
+ * # Errors
2616
+ *
2617
+ * Returns an error if the disconnect fails.
2618
+ * @returns {Promise<void>}
2619
+ */
2620
+ disconnect() {
2621
+ const ret = wasm.subductionhttplongpoll_disconnect(this.__wbg_ptr);
2622
+ return ret;
2623
+ }
2624
+ /**
2625
+ * Register a callback to be invoked when the transport disconnects.
2626
+ *
2627
+ * Part of the [`Transport`](super::JsTransport) interface contract.
2628
+ * Typically called by internal wiring rather than directly by user code.
2629
+ * @param {Function} callback
2630
+ */
2631
+ onDisconnect(callback) {
2632
+ wasm.subductionhttplongpoll_onDisconnect(this.__wbg_ptr, callback);
2633
+ }
2634
+ /**
2635
+ * Receive the next message frame as raw bytes.
2636
+ *
2637
+ * # Errors
2638
+ *
2639
+ * Returns an error if the inbound channel is closed.
2640
+ * @returns {Promise<Uint8Array>}
2641
+ */
2642
+ recvBytes() {
2643
+ const ret = wasm.subductionhttplongpoll_recvBytes(this.__wbg_ptr);
2644
+ return ret;
2645
+ }
2646
+ /**
2647
+ * Send raw bytes over the transport.
2648
+ *
2649
+ * # Errors
2650
+ *
2651
+ * Returns an error if the outbound channel is closed.
2652
+ * @param {Uint8Array} bytes
2653
+ * @returns {Promise<void>}
2654
+ */
2655
+ sendBytes(bytes) {
2656
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2657
+ const len0 = WASM_VECTOR_LEN;
2658
+ const ret = wasm.subductionhttplongpoll_sendBytes(this.__wbg_ptr, ptr0, len0);
2659
+ return ret;
2660
+ }
2661
+ };
2662
+ if (Symbol.dispose) SubductionHttpLongPoll.prototype[Symbol.dispose] = SubductionHttpLongPoll.prototype.free;
2663
+ var SubductionLongPoll = class {
2664
+ __destroy_into_raw() {
2665
+ const ptr = this.__wbg_ptr;
2666
+ this.__wbg_ptr = 0;
2667
+ SubductionLongPollFinalization.unregister(this);
2668
+ return ptr;
2669
+ }
2670
+ free() {
2671
+ const ptr = this.__destroy_into_raw();
2672
+ wasm.__wbg_subductionlongpoll_free(ptr, 0);
2673
+ }
2674
+ /**
2675
+ * Connect to a server with a known peer ID.
2676
+ *
2677
+ * # Arguments
2678
+ *
2679
+ * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2680
+ * * `signer` - The client's signer for authentication
2681
+ * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2682
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2683
+ *
2684
+ * # Errors
2685
+ *
2686
+ * Returns [`LongPollTransportError`] if connection or handshake fails.
2687
+ * @param {string} base_url
2688
+ * @param {any} signer
2689
+ * @param {PeerId} expected_peer_id
2690
+ * @param {Function | null} [on_disconnect]
2691
+ * @returns {Promise<AuthenticatedLongPoll>}
2692
+ */
2693
+ static tryConnect(base_url, signer, expected_peer_id, on_disconnect) {
2694
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2695
+ const len0 = WASM_VECTOR_LEN;
2696
+ _assertClass(expected_peer_id, PeerId);
2697
+ const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2698
+ return ret;
2699
+ }
2700
+ /**
2701
+ * Connect to a server using discovery mode.
2702
+ *
2703
+ * # Arguments
2704
+ *
2705
+ * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2706
+ * * `signer` - The client's signer for authentication
2707
+ * * `service_name` - The service name for discovery. If omitted, the base URL is used.
2708
+ *
2709
+ * # Errors
2710
+ *
2711
+ * Returns [`LongPollTransportError`] if connection or handshake fails.
2712
+ * @param {string} base_url
2713
+ * @param {any} signer
2714
+ * @param {string | null} [service_name]
2715
+ * @param {Function | null} [on_disconnect]
2716
+ * @returns {Promise<AuthenticatedLongPoll>}
2717
+ */
2718
+ static tryDiscover(base_url, signer, service_name, on_disconnect) {
2719
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2720
+ const len0 = WASM_VECTOR_LEN;
2721
+ var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2722
+ var len1 = WASM_VECTOR_LEN;
2723
+ const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, ptr1, len1, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2724
+ return ret;
2725
+ }
2726
+ };
2727
+ if (Symbol.dispose) SubductionLongPoll.prototype[Symbol.dispose] = SubductionLongPoll.prototype.free;
2728
+ var SubductionWebSocket = class _SubductionWebSocket {
2729
+ static __wrap(ptr) {
2730
+ ptr = ptr >>> 0;
2731
+ const obj = Object.create(_SubductionWebSocket.prototype);
2732
+ obj.__wbg_ptr = ptr;
2733
+ SubductionWebSocketFinalization.register(obj, obj.__wbg_ptr, obj);
2734
+ return obj;
2735
+ }
2736
+ __destroy_into_raw() {
2737
+ const ptr = this.__wbg_ptr;
2738
+ this.__wbg_ptr = 0;
2739
+ SubductionWebSocketFinalization.unregister(this);
2740
+ return ptr;
2741
+ }
2742
+ free() {
2743
+ const ptr = this.__destroy_into_raw();
2744
+ wasm.__wbg_subductionwebsocket_free(ptr, 0);
2745
+ }
2746
+ /**
2747
+ * Disconnect from the peer gracefully.
2748
+ * @returns {Promise<void>}
2749
+ */
2750
+ disconnect() {
2751
+ const ret = wasm.subductionwebsocket_disconnect(this.__wbg_ptr);
2752
+ return ret;
2753
+ }
2754
+ /**
2755
+ * Register a callback to be invoked when the WebSocket closes.
2756
+ *
2757
+ * Part of the [`Transport`](super::JsTransport) interface contract.
2758
+ * Typically called by internal wiring (factory methods like `tryConnect`
2759
+ * and `tryDiscover`) rather than directly by user code.
2760
+ *
2761
+ * The callback is fired from the browser WebSocket's `onclose` handler.
2762
+ * @param {Function} callback
2763
+ */
2764
+ onDisconnect(callback) {
2765
+ wasm.subductionwebsocket_onDisconnect(this.__wbg_ptr, callback);
2766
+ }
2767
+ /**
2768
+ * Receive the next message frame as raw bytes.
2769
+ *
2770
+ * # Errors
2771
+ *
2772
+ * Returns [`ReadFromClosedChannel`] if the channel has been closed.
2773
+ * @returns {Promise<Uint8Array>}
2774
+ */
2775
+ recvBytes() {
2776
+ const ret = wasm.subductionwebsocket_recvBytes(this.__wbg_ptr);
2777
+ return ret;
2778
+ }
2779
+ /**
2780
+ * Send raw bytes over the WebSocket.
2781
+ *
2782
+ * # Errors
2783
+ *
2784
+ * Returns [`WasmSendError`] if the bytes could not be sent.
2785
+ * @param {Uint8Array} bytes
2786
+ * @returns {Promise<void>}
2787
+ */
2788
+ sendBytes(bytes) {
2789
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2790
+ const len0 = WASM_VECTOR_LEN;
2791
+ const ret = wasm.subductionwebsocket_sendBytes(this.__wbg_ptr, ptr0, len0);
2792
+ return ret;
2793
+ }
2794
+ /**
2795
+ * Authenticate an existing WebSocket via handshake.
2796
+ *
2797
+ * This performs the Subduction handshake protocol over the provided WebSocket
2798
+ * to establish mutual identity. The WebSocket can be in CONNECTING or OPEN state.
2799
+ *
2800
+ * # Arguments
2801
+ *
2802
+ * * `ws` - An existing WebSocket (CONNECTING or OPEN)
2803
+ * * `signer` - The client's signer for authentication
2804
+ * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2805
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2806
+ *
2807
+ * # Errors
2808
+ *
2809
+ * Returns an error if the handshake fails (signature invalid, wrong peer, etc.)
2810
+ * @param {WebSocket} ws
2811
+ * @param {any} signer
2812
+ * @param {PeerId} expected_peer_id
2813
+ * @param {Function | null} [on_disconnect]
2814
+ * @returns {Promise<AuthenticatedWebSocket>}
2815
+ */
2816
+ static setup(ws, signer, expected_peer_id, on_disconnect) {
2817
+ _assertClass(expected_peer_id, PeerId);
2818
+ const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2819
+ return ret;
2820
+ }
2821
+ /**
2822
+ * Connect to a WebSocket server with mutual authentication via handshake.
2823
+ *
2824
+ * # Arguments
2825
+ *
2826
+ * * `address` - The WebSocket URL to connect to
2827
+ * * `signer` - The client's signer for authentication
2828
+ * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2829
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2830
+ *
2831
+ * # Errors
2832
+ *
2833
+ * Returns an error if:
2834
+ * - The WebSocket connection could not be established
2835
+ * - The handshake fails (signature invalid, wrong server, clock drift, etc.)
2836
+ * @param {URL} address
2837
+ * @param {any} signer
2838
+ * @param {PeerId} expected_peer_id
2839
+ * @param {Function | null} [on_disconnect]
2840
+ * @returns {Promise<AuthenticatedWebSocket>}
2841
+ */
2842
+ static tryConnect(address, signer, expected_peer_id, on_disconnect) {
2843
+ _assertClass(expected_peer_id, PeerId);
2844
+ const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2845
+ return ret;
2846
+ }
2847
+ /**
2848
+ * Connect to a WebSocket server using discovery mode.
2849
+ *
2850
+ * This method performs a cryptographic handshake using a service name
2851
+ * instead of a known peer ID. The server's peer ID is discovered during
2852
+ * the handshake and returned.
2853
+ *
2854
+ * # Arguments
2855
+ *
2856
+ * * `address` - The WebSocket URL to connect to
2857
+ * * `signer` - The client's signer for authentication
2858
+ * * `service_name` - The service name for discovery (e.g., `localhost:8080`).
2859
+ * If omitted, the host is extracted from the URL.
2860
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2861
+ *
2862
+ * # Errors
2863
+ *
2864
+ * Returns an error if:
2865
+ * - The WebSocket connection could not be established
2866
+ * - The handshake fails (signature invalid, clock drift, etc.)
2867
+ * @param {URL} address
2868
+ * @param {any} signer
2869
+ * @param {string | null} [service_name]
2870
+ * @param {Function | null} [on_disconnect]
2871
+ * @returns {Promise<AuthenticatedWebSocket>}
2872
+ */
2873
+ static tryDiscover(address, signer, service_name, on_disconnect) {
2874
+ var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2875
+ var len0 = WASM_VECTOR_LEN;
2876
+ const ret = wasm.subductionwebsocket_tryDiscover(address, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2877
+ return ret;
2878
+ }
2879
+ };
2880
+ if (Symbol.dispose) SubductionWebSocket.prototype[Symbol.dispose] = SubductionWebSocket.prototype.free;
2881
+ var SyncMessage = class _SyncMessage {
2882
+ static __wrap(ptr) {
2883
+ ptr = ptr >>> 0;
2884
+ const obj = Object.create(_SyncMessage.prototype);
2885
+ obj.__wbg_ptr = ptr;
2886
+ SyncMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2887
+ return obj;
2888
+ }
2889
+ __destroy_into_raw() {
2890
+ const ptr = this.__wbg_ptr;
2891
+ this.__wbg_ptr = 0;
2892
+ SyncMessageFinalization.unregister(this);
2893
+ return ptr;
2894
+ }
2895
+ free() {
2896
+ const ptr = this.__destroy_into_raw();
2897
+ wasm.__wbg_syncmessage_free(ptr, 0);
2898
+ }
2899
+ /**
2900
+ * Upcasts; to the JS-import type for [`WasmMessage`].
2901
+ * @returns {SyncMessage}
2902
+ */
2903
+ __wasm_refgen_toWasmMessage() {
2904
+ const ret = wasm.syncmessage___wasm_refgen_toWasmMessage(this.__wbg_ptr);
2905
+ return _SyncMessage.__wrap(ret);
2906
+ }
2907
+ /**
2908
+ * Create a [`SyncMessage::BatchSyncRequest`] message.
2909
+ * @param {BatchSyncRequest} request
2910
+ * @returns {SyncMessage}
2911
+ */
2912
+ static batchSyncRequest(request) {
2913
+ _assertClass(request, BatchSyncRequest);
2914
+ const ret = wasm.syncmessage_batchSyncRequest(request.__wbg_ptr);
2915
+ return _SyncMessage.__wrap(ret);
2916
+ }
2917
+ /**
2918
+ * Create a [`SyncMessage::BatchSyncResponse`] message.
2919
+ * @param {BatchSyncResponse} response
2920
+ * @returns {SyncMessage}
2921
+ */
2922
+ static batchSyncResponse(response) {
2923
+ _assertClass(response, BatchSyncResponse);
2924
+ const ret = wasm.syncmessage_batchSyncResponse(response.__wbg_ptr);
2925
+ return _SyncMessage.__wrap(ret);
2926
+ }
2927
+ /**
2928
+ * The [`Blob`] for commit or fragment messages, if applicable.
2929
+ * @returns {Uint8Array | undefined}
2930
+ */
2931
+ get blob() {
2932
+ const ret = wasm.syncmessage_blob(this.__wbg_ptr);
2933
+ return ret;
2934
+ }
2935
+ /**
2936
+ * The [`Blob`]s for a [`SyncMessage::BlobsResponse`], if applicable.
2937
+ * @returns {Uint8Array[] | undefined}
2938
+ */
2939
+ get blobs() {
2940
+ const ret = wasm.syncmessage_blobs(this.__wbg_ptr);
2941
+ let v1;
2942
+ if (ret[0] !== 0) {
2943
+ v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2944
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2945
+ }
2946
+ return v1;
2947
+ }
2948
+ /**
2949
+ * Create a [`SyncMessage::BlobsRequest`] message.
2950
+ * @param {SedimentreeId} id
2951
+ * @param {Digest[]} digests
2952
+ * @returns {SyncMessage}
2953
+ */
2954
+ static blobsRequest(id, digests) {
2955
+ _assertClass(id, SedimentreeId);
2956
+ const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
2957
+ const len0 = WASM_VECTOR_LEN;
2958
+ const ret = wasm.syncmessage_blobsRequest(id.__wbg_ptr, ptr0, len0);
2959
+ return _SyncMessage.__wrap(ret);
2960
+ }
2961
+ /**
2962
+ * Create a [`SyncMessage::BlobsResponse`] message.
2963
+ * @param {SedimentreeId} id
2964
+ * @param {Uint8Array[]} blobs
2965
+ * @returns {SyncMessage}
2966
+ */
2967
+ static blobsResponse(id, blobs) {
2968
+ _assertClass(id, SedimentreeId);
2969
+ const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
2970
+ const len0 = WASM_VECTOR_LEN;
2971
+ const ret = wasm.syncmessage_blobsResponse(id.__wbg_ptr, ptr0, len0);
2972
+ return _SyncMessage.__wrap(ret);
2973
+ }
2974
+ /**
2975
+ * The [`LooseCommit`] for a [`SyncMessage::LooseCommit`], if applicable.
2976
+ *
2977
+ * Decodes the signed payload to extract the underlying commit.
2978
+ * @returns {LooseCommit | undefined}
2979
+ */
2980
+ get commit() {
2981
+ const ret = wasm.syncmessage_commit(this.__wbg_ptr);
2982
+ return ret === 0 ? void 0 : LooseCommit.__wrap(ret);
2983
+ }
2984
+ /**
2985
+ * The requested [`Digest`]s for a [`SyncMessage::BlobsRequest`], if applicable.
2986
+ * @returns {Digest[] | undefined}
2987
+ */
2988
+ get digests() {
2989
+ const ret = wasm.syncmessage_digests(this.__wbg_ptr);
2990
+ let v1;
2991
+ if (ret[0] !== 0) {
2992
+ v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2993
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2994
+ }
2995
+ return v1;
2996
+ }
2997
+ /**
2998
+ * The [`Fragment`] for a [`SyncMessage::Fragment`], if applicable.
2999
+ *
3000
+ * Decodes the signed payload to extract the underlying fragment.
3001
+ * @returns {Fragment | undefined}
3002
+ */
3003
+ get fragment() {
3004
+ const ret = wasm.syncmessage_fragment(this.__wbg_ptr);
3005
+ return ret === 0 ? void 0 : Fragment.__wrap(ret);
3006
+ }
3007
+ /**
3008
+ * Deserialize a message from bytes.
3009
+ *
3010
+ * # Errors
3011
+ *
3012
+ * Returns a [`JsMessageDeserializationError`] if deserialization fails.
3013
+ * @param {Uint8Array} bytes
3014
+ * @returns {SyncMessage}
3015
+ */
3016
+ static fromBytes(bytes) {
3017
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
3018
+ const len0 = WASM_VECTOR_LEN;
3019
+ const ret = wasm.syncmessage_fromBytes(ptr0, len0);
3020
+ if (ret[2]) {
3021
+ throw takeFromExternrefTable0(ret[1]);
3022
+ }
3023
+ return _SyncMessage.__wrap(ret[0]);
3024
+ }
3025
+ /**
3026
+ * The [`BatchSyncRequest`] for a [`SyncMessage::BatchSyncRequest`], if applicable.
3027
+ * @returns {BatchSyncRequest | undefined}
3028
+ */
3029
+ get request() {
3030
+ const ret = wasm.syncmessage_request(this.__wbg_ptr);
3031
+ return ret === 0 ? void 0 : BatchSyncRequest.__wrap(ret);
3032
+ }
3033
+ /**
3034
+ * The [`BatchSyncResponse`] for a [`SyncMessage::BatchSyncResponse`], if applicable.
3035
+ * @returns {BatchSyncResponse | undefined}
3036
+ */
3037
+ get response() {
3038
+ const ret = wasm.syncmessage_response(this.__wbg_ptr);
3039
+ return ret === 0 ? void 0 : BatchSyncResponse.__wrap(ret);
3040
+ }
3041
+ /**
3042
+ * The [`SedimentreeId`] associated with this message, if any.
3043
+ * @returns {SedimentreeId | undefined}
3044
+ */
3045
+ get sedimentreeId() {
3046
+ const ret = wasm.syncmessage_sedimentreeId(this.__wbg_ptr);
3047
+ return ret === 0 ? void 0 : SedimentreeId.__wrap(ret);
3048
+ }
3049
+ /**
3050
+ * Serialize the message to bytes.
3051
+ * @returns {Uint8Array}
3052
+ */
3053
+ toBytes() {
3054
+ const ret = wasm.syncmessage_toBytes(this.__wbg_ptr);
3055
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3056
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
3057
+ return v1;
3058
+ }
3059
+ /**
3060
+ * The message variant name.
3061
+ * @returns {string}
3062
+ */
3063
+ get type() {
3064
+ let deferred1_0;
3065
+ let deferred1_1;
3066
+ try {
3067
+ const ret = wasm.syncmessage_type(this.__wbg_ptr);
3068
+ deferred1_0 = ret[0];
3069
+ deferred1_1 = ret[1];
3070
+ return getStringFromWasm0(ret[0], ret[1]);
3071
+ } finally {
3072
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
3073
+ }
3074
+ }
3075
+ };
3076
+ if (Symbol.dispose) SyncMessage.prototype[Symbol.dispose] = SyncMessage.prototype.free;
3077
+ var SyncStats = class _SyncStats {
3078
+ static __wrap(ptr) {
3079
+ ptr = ptr >>> 0;
3080
+ const obj = Object.create(_SyncStats.prototype);
3081
+ obj.__wbg_ptr = ptr;
3082
+ SyncStatsFinalization.register(obj, obj.__wbg_ptr, obj);
3083
+ return obj;
3084
+ }
3085
+ __destroy_into_raw() {
3086
+ const ptr = this.__wbg_ptr;
3087
+ this.__wbg_ptr = 0;
3088
+ SyncStatsFinalization.unregister(this);
3089
+ return ptr;
3090
+ }
3091
+ free() {
3092
+ const ptr = this.__destroy_into_raw();
3093
+ wasm.__wbg_syncstats_free(ptr, 0);
3094
+ }
3095
+ /**
3096
+ * Number of commits received from the peer.
3097
+ * @returns {number}
3098
+ */
3099
+ get commitsReceived() {
3100
+ const ret = wasm.syncstats_commitsReceived(this.__wbg_ptr);
3101
+ return ret >>> 0;
3102
+ }
3103
+ /**
3104
+ * Number of commits successfully sent to the peer.
3105
+ * @returns {number}
3106
+ */
3107
+ get commitsSent() {
3108
+ const ret = wasm.syncstats_commitsSent(this.__wbg_ptr);
3109
+ return ret >>> 0;
3110
+ }
3111
+ /**
3112
+ * Number of fragments received from the peer.
3113
+ * @returns {number}
3114
+ */
3115
+ get fragmentsReceived() {
3116
+ const ret = wasm.syncstats_fragmentsReceived(this.__wbg_ptr);
3117
+ return ret >>> 0;
3118
+ }
3119
+ /**
3120
+ * Number of fragments successfully sent to the peer.
3121
+ * @returns {number}
3122
+ */
3123
+ get fragmentsSent() {
3124
+ const ret = wasm.syncstats_fragmentsSent(this.__wbg_ptr);
3125
+ return ret >>> 0;
3126
+ }
3127
+ /**
3128
+ * Returns true if no commits or fragments were transferred.
3129
+ *
3130
+ * Note: `remoteHeads` may still be non-empty (heads metadata is not
3131
+ * considered "data" for this check).
3132
+ * @returns {boolean}
3133
+ */
3134
+ get isEmpty() {
3135
+ const ret = wasm.syncstats_isEmpty(this.__wbg_ptr);
3136
+ return ret !== 0;
3137
+ }
3138
+ /**
3139
+ * The remote peer's heads for this sedimentree.
3140
+ * @returns {Digest[]}
3141
+ */
3142
+ get remoteHeads() {
3143
+ const ret = wasm.syncstats_remoteHeads(this.__wbg_ptr);
3144
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
3145
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
3146
+ return v1;
3147
+ }
3148
+ /**
3149
+ * Total items received (commits + fragments).
3150
+ * @returns {number}
3151
+ */
3152
+ get totalReceived() {
3153
+ const ret = wasm.syncstats_totalReceived(this.__wbg_ptr);
3154
+ return ret >>> 0;
3155
+ }
3156
+ /**
3157
+ * Total items sent (commits + fragments).
3158
+ * @returns {number}
3159
+ */
3160
+ get totalSent() {
3161
+ const ret = wasm.syncstats_totalSent(this.__wbg_ptr);
3162
+ return ret >>> 0;
3163
+ }
3164
+ };
3165
+ if (Symbol.dispose) SyncStats.prototype[Symbol.dispose] = SyncStats.prototype.free;
3166
+ var Topic = class _Topic {
3167
+ static __wrap(ptr) {
3168
+ ptr = ptr >>> 0;
3169
+ const obj = Object.create(_Topic.prototype);
3170
+ obj.__wbg_ptr = ptr;
3171
+ TopicFinalization.register(obj, obj.__wbg_ptr, obj);
3172
+ return obj;
3173
+ }
3174
+ static __unwrap(jsValue) {
3175
+ if (!(jsValue instanceof _Topic)) {
3176
+ return 0;
3177
+ }
3178
+ return jsValue.__destroy_into_raw();
3179
+ }
3180
+ __destroy_into_raw() {
3181
+ const ptr = this.__wbg_ptr;
3182
+ this.__wbg_ptr = 0;
3183
+ TopicFinalization.unregister(this);
3184
+ return ptr;
3185
+ }
3186
+ free() {
3187
+ const ptr = this.__destroy_into_raw();
3188
+ wasm.__wbg_topic_free(ptr, 0);
3189
+ }
3190
+ /**
3191
+ * Create a topic from a 32-byte array.
3192
+ *
3193
+ * # Errors
3194
+ *
3195
+ * Returns an error if the provided byte array is not exactly 32 bytes.
3196
+ * @param {Uint8Array} bytes
3197
+ * @returns {Topic}
3198
+ */
3199
+ static fromBytes(bytes) {
3200
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
3201
+ const len0 = WASM_VECTOR_LEN;
3202
+ const ret = wasm.topic_fromBytes(ptr0, len0);
3203
+ if (ret[2]) {
3204
+ throw takeFromExternrefTable0(ret[1]);
3205
+ }
3206
+ return _Topic.__wrap(ret[0]);
3207
+ }
3208
+ /**
3209
+ * Returns the raw 32 bytes of this topic.
3210
+ * @returns {Uint8Array}
3211
+ */
3212
+ toBytes() {
3213
+ const ret = wasm.topic_toBytes(this.__wbg_ptr);
3214
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3215
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
3216
+ return v1;
3217
+ }
3218
+ /**
3219
+ * Returns a shortened hex prefix representation (first 4 bytes + `…`).
3220
+ * @returns {string}
3221
+ */
3222
+ toString() {
3223
+ let deferred1_0;
3224
+ let deferred1_1;
3225
+ try {
3226
+ const ret = wasm.topic_toString(this.__wbg_ptr);
3227
+ deferred1_0 = ret[0];
3228
+ deferred1_1 = ret[1];
3229
+ return getStringFromWasm0(ret[0], ret[1]);
3230
+ } finally {
3231
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
3232
+ }
3233
+ }
3234
+ };
3235
+ if (Symbol.dispose) Topic.prototype[Symbol.dispose] = Topic.prototype.free;
3236
+ var WebCryptoSigner = class _WebCryptoSigner {
3237
+ static __wrap(ptr) {
3238
+ ptr = ptr >>> 0;
3239
+ const obj = Object.create(_WebCryptoSigner.prototype);
3240
+ obj.__wbg_ptr = ptr;
3241
+ WebCryptoSignerFinalization.register(obj, obj.__wbg_ptr, obj);
3242
+ return obj;
3243
+ }
3244
+ __destroy_into_raw() {
3245
+ const ptr = this.__wbg_ptr;
3246
+ this.__wbg_ptr = 0;
3247
+ WebCryptoSignerFinalization.unregister(this);
3248
+ return ptr;
3249
+ }
3250
+ free() {
3251
+ const ptr = this.__destroy_into_raw();
3252
+ wasm.__wbg_webcryptosigner_free(ptr, 0);
3253
+ }
3254
+ /**
3255
+ * Get the peer ID derived from this signer's verifying key.
3256
+ *
3257
+ * # Panics
3258
+ *
3259
+ * Panics if the stored public key bytes are invalid (should never happen).
3260
+ * @returns {PeerId}
3261
+ */
3262
+ peerId() {
3263
+ const ret = wasm.webcryptosigner_peerId(this.__wbg_ptr);
3264
+ return PeerId.__wrap(ret);
3265
+ }
3266
+ /**
3267
+ * Set up the signer, loading an existing key from `IndexedDB` or generating a new one.
3268
+ *
3269
+ * # Errors
3270
+ *
3271
+ * Returns an error if `WebCrypto` or `IndexedDB` operations fail.
3272
+ * @returns {Promise<WebCryptoSigner>}
3273
+ */
3274
+ static setup() {
3275
+ const ret = wasm.webcryptosigner_setup();
3276
+ return ret;
3277
+ }
3278
+ /**
3279
+ * Sign a message and return the 64-byte Ed25519 signature.
3280
+ *
3281
+ * # Errors
3282
+ *
3283
+ * Returns an error if `WebCrypto` signing fails.
3284
+ * @param {Uint8Array} message
3285
+ * @returns {Promise<Uint8Array>}
3286
+ */
3287
+ sign(message) {
3288
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export);
3289
+ const len0 = WASM_VECTOR_LEN;
3290
+ const ret = wasm.webcryptosigner_sign(this.__wbg_ptr, ptr0, len0);
3291
+ return ret;
3292
+ }
3293
+ /**
3294
+ * Get the 32-byte Ed25519 verifying (public) key.
3295
+ * @returns {Uint8Array}
3296
+ */
3297
+ verifyingKey() {
3298
+ const ret = wasm.webcryptosigner_verifyingKey(this.__wbg_ptr);
3299
+ return ret;
3300
+ }
3301
+ };
3302
+ if (Symbol.dispose) WebCryptoSigner.prototype[Symbol.dispose] = WebCryptoSigner.prototype.free;
3303
+ function makeMessagePortTransport(port) {
3304
+ const ret = wasm.makeMessagePortTransport(port);
3305
+ return MessagePortTransport.__wrap(ret);
3306
+ }
3307
+ function start() {
3308
+ wasm.start();
3309
+ }
3310
+ function __wbg_get_imports() {
3311
+ const import0 = {
3312
+ __proto__: null,
3313
+ __wbg___wasm_refgen_toWasmCommitWithBlob_bcab5aaed3558280: function(arg0) {
3314
+ const ret = arg0.__wasm_refgen_toWasmCommitWithBlob();
3315
+ _assertClass(ret, CommitWithBlob);
3316
+ var ptr1 = ret.__destroy_into_raw();
3317
+ return ptr1;
3318
+ },
3319
+ __wbg___wasm_refgen_toWasmDepth_5124f666e343ff0c: function(arg0) {
3320
+ const ret = arg0.__wasm_refgen_toWasmDepth();
3321
+ _assertClass(ret, Depth);
3322
+ var ptr1 = ret.__destroy_into_raw();
3323
+ return ptr1;
3324
+ },
3325
+ __wbg___wasm_refgen_toWasmDigest_476b24805f220005: function(arg0) {
3326
+ const ret = arg0.__wasm_refgen_toWasmDigest();
3327
+ _assertClass(ret, Digest);
3328
+ var ptr1 = ret.__destroy_into_raw();
3329
+ return ptr1;
3330
+ },
3331
+ __wbg___wasm_refgen_toWasmFragmentWithBlob_ed713e5c5f4cc52e: function(arg0) {
3332
+ const ret = arg0.__wasm_refgen_toWasmFragmentWithBlob();
3333
+ _assertClass(ret, FragmentWithBlob);
3334
+ var ptr1 = ret.__destroy_into_raw();
3335
+ return ptr1;
3336
+ },
3337
+ __wbg___wasm_refgen_toWasmFragment_10dd1ff9b3934840: function(arg0) {
3338
+ const ret = arg0.__wasm_refgen_toWasmFragment();
3339
+ _assertClass(ret, Fragment);
3340
+ var ptr1 = ret.__destroy_into_raw();
3341
+ return ptr1;
3342
+ },
3343
+ __wbg___wasm_refgen_toWasmLooseCommit_f36ad6a9389cee03: function(arg0) {
3344
+ const ret = arg0.__wasm_refgen_toWasmLooseCommit();
3345
+ _assertClass(ret, LooseCommit);
3346
+ var ptr1 = ret.__destroy_into_raw();
3347
+ return ptr1;
3348
+ },
3349
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
3350
+ const ret = debugString(arg1);
3351
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3352
+ const len1 = WASM_VECTOR_LEN;
3353
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3354
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3355
+ },
3356
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
3357
+ const ret = typeof arg0 === "function";
3358
+ return ret;
3359
+ },
3360
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
3361
+ const ret = arg0 === null;
3362
+ return ret;
3363
+ },
3364
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
3365
+ const val = arg0;
3366
+ const ret = typeof val === "object" && val !== null;
3367
+ return ret;
3368
+ },
3369
+ __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
3370
+ const ret = typeof arg0 === "string";
3371
+ return ret;
3372
+ },
3373
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
3374
+ const ret = arg0 === void 0;
3375
+ return ret;
3376
+ },
3377
+ __wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
3378
+ const ret = arg0 === arg1;
3379
+ return ret;
3380
+ },
3381
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
3382
+ const obj = arg1;
3383
+ const ret = typeof obj === "number" ? obj : void 0;
3384
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
3385
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
3386
+ },
3387
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
3388
+ const obj = arg1;
3389
+ const ret = typeof obj === "string" ? obj : void 0;
3390
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3391
+ var len1 = WASM_VECTOR_LEN;
3392
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3393
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3394
+ },
3395
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
3396
+ throw new Error(getStringFromWasm0(arg0, arg1));
3397
+ },
3398
+ __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
3399
+ arg0._wbg_cb_unref();
3400
+ },
3401
+ __wbg_arrayBuffer_eb8e9ca620af2a19: function() {
3402
+ return handleError(function(arg0) {
3403
+ const ret = arg0.arrayBuffer();
3404
+ return ret;
3405
+ }, arguments);
3406
+ },
3407
+ __wbg_authenticatedlongpoll_new: function(arg0) {
3408
+ const ret = AuthenticatedLongPoll.__wrap(arg0);
3409
+ return ret;
3410
+ },
3411
+ __wbg_authenticatedtransport_new: function(arg0) {
3412
+ const ret = AuthenticatedTransport.__wrap(arg0);
3413
+ return ret;
3414
+ },
3415
+ __wbg_authenticatedwebsocket_new: function(arg0) {
3416
+ const ret = AuthenticatedWebSocket.__wrap(arg0);
3417
+ return ret;
3418
+ },
3419
+ __wbg_authorizeConnect_8e2609308bbbbcfd: function() {
3420
+ return handleError(function(arg0, arg1) {
3421
+ const ret = arg0.authorizeConnect(PeerId.__wrap(arg1));
3422
+ return ret;
3423
+ }, arguments);
3424
+ },
3425
+ __wbg_authorizeFetch_b7bcc4e437112c73: function() {
3426
+ return handleError(function(arg0, arg1, arg2) {
3427
+ const ret = arg0.authorizeFetch(PeerId.__wrap(arg1), SedimentreeId.__wrap(arg2));
3428
+ return ret;
3429
+ }, arguments);
3430
+ },
3431
+ __wbg_authorizePublish_7e546fc3d8103532: function() {
3432
+ return handleError(function(arg0, arg1, arg2) {
3433
+ const ret = arg0.authorizePublish(PeerId.__wrap(arg1), Topic.__wrap(arg2));
3434
+ return ret;
3435
+ }, arguments);
3436
+ },
3437
+ __wbg_authorizePut_ba5a5e36c9e9bbfa: function() {
3438
+ return handleError(function(arg0, arg1, arg2, arg3) {
3439
+ const ret = arg0.authorizePut(PeerId.__wrap(arg1), PeerId.__wrap(arg2), SedimentreeId.__wrap(arg3));
3440
+ return ret;
3441
+ }, arguments);
3442
+ },
3443
+ __wbg_authorizeSubscribe_34f5ba6f23bab853: function() {
3444
+ return handleError(function(arg0, arg1, arg2) {
3445
+ const ret = arg0.authorizeSubscribe(PeerId.__wrap(arg1), Topic.__wrap(arg2));
3446
+ return ret;
3447
+ }, arguments);
3448
+ },
3449
+ __wbg_buffer_60b8043cd926067d: function(arg0) {
3450
+ const ret = arg0.buffer;
3451
+ return ret;
3452
+ },
3453
+ __wbg_call_2d781c1f4d5c0ef8: function() {
3454
+ return handleError(function(arg0, arg1, arg2) {
3455
+ const ret = arg0.call(arg1, arg2);
3456
+ return ret;
3457
+ }, arguments);
3458
+ },
3459
+ __wbg_call_e133b57c9155d22c: function() {
3460
+ return handleError(function(arg0, arg1) {
3461
+ const ret = arg0.call(arg1);
3462
+ return ret;
3463
+ }, arguments);
3464
+ },
3465
+ __wbg_call_f858478a02f9600f: function() {
3466
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
3467
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
3468
+ return ret;
3469
+ }, arguments);
3470
+ },
3471
+ __wbg_close_af26905c832a88cb: function() {
3472
+ return handleError(function(arg0) {
3473
+ arg0.close();
3474
+ }, arguments);
3475
+ },
3476
+ __wbg_close_cbf870bdad0aad99: function(arg0) {
3477
+ arg0.close();
3478
+ },
3479
+ __wbg_close_f85b3643ad9ed8d4: function(arg0) {
3480
+ arg0.close();
3481
+ },
3482
+ __wbg_commitwithblob_new: function(arg0) {
3483
+ const ret = CommitWithBlob.__wrap(arg0);
3484
+ return ret;
3485
+ },
3486
+ __wbg_contains_ef4bfb7fa5a241b7: function(arg0, arg1, arg2) {
3487
+ const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
3488
+ return ret;
3489
+ },
3490
+ __wbg_createObjectStore_92a8aebcc6f9d7e3: function() {
3491
+ return handleError(function(arg0, arg1, arg2) {
3492
+ const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));
3493
+ return ret;
3494
+ }, arguments);
3495
+ },
3496
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
3497
+ const ret = arg0.crypto;
3498
+ return ret;
3499
+ },
3500
+ __wbg_data_a3d9ff9cdd801002: function(arg0) {
3501
+ const ret = arg0.data;
3502
+ return ret;
3503
+ },
3504
+ __wbg_deleteAllCommits_026a63e00bba2a2c: function(arg0, arg1) {
3505
+ const ret = arg0.deleteAllCommits(arg1);
3506
+ return ret;
3507
+ },
3508
+ __wbg_deleteAllFragments_857ddb74b3342f83: function(arg0, arg1) {
3509
+ const ret = arg0.deleteAllFragments(arg1);
3510
+ return ret;
3511
+ },
3512
+ __wbg_digest_new: function(arg0) {
3513
+ const ret = Digest.__wrap(arg0);
3514
+ return ret;
3515
+ },
3516
+ __wbg_digest_unwrap: function(arg0) {
3517
+ const ret = Digest.__unwrap(arg0);
3518
+ return ret;
3519
+ },
3520
+ __wbg_disconnect_91312bb506e834b1: function(arg0) {
3521
+ const ret = arg0.disconnect();
3522
+ return ret;
3523
+ },
3524
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
3525
+ let deferred0_0;
3526
+ let deferred0_1;
3527
+ try {
3528
+ deferred0_0 = arg0;
3529
+ deferred0_1 = arg1;
3530
+ console.error(getStringFromWasm0(arg0, arg1));
3531
+ } finally {
3532
+ wasm.__wbindgen_export5(deferred0_0, deferred0_1, 1);
3533
+ }
3534
+ },
3535
+ __wbg_exportKey_c43b919dba5a1db2: function() {
3536
+ return handleError(function(arg0, arg1, arg2, arg3) {
3537
+ const ret = arg0.exportKey(getStringFromWasm0(arg1, arg2), arg3);
3538
+ return ret;
3539
+ }, arguments);
3540
+ },
3541
+ __wbg_fetch_5550a88cf343aaa9: function(arg0, arg1) {
3542
+ const ret = arg0.fetch(arg1);
3543
+ return ret;
3544
+ },
3545
+ __wbg_fetch_f8a611684c3b5fe5: function(arg0, arg1) {
3546
+ const ret = arg0.fetch(arg1);
3547
+ return ret;
3548
+ },
3549
+ __wbg_filterAuthorizedFetch_a647f13dc33948f1: function() {
3550
+ return handleError(function(arg0, arg1, arg2, arg3) {
3551
+ var v0 = getArrayJsValueFromWasm0(arg2, arg3).slice();
3552
+ wasm.__wbindgen_export5(arg2, arg3 * 4, 4);
3553
+ const ret = arg0.filterAuthorizedFetch(PeerId.__wrap(arg1), v0);
3554
+ return ret;
3555
+ }, arguments);
3556
+ },
3557
+ __wbg_filterAuthorizedSubscribers_34bdeaaac0eb31a5: function() {
3558
+ return handleError(function(arg0, arg1, arg2, arg3) {
3559
+ var v0 = getArrayJsValueFromWasm0(arg2, arg3).slice();
3560
+ wasm.__wbindgen_export5(arg2, arg3 * 4, 4);
3561
+ const ret = arg0.filterAuthorizedSubscribers(Topic.__wrap(arg1), v0);
3562
+ return ret;
3563
+ }, arguments);
3564
+ },
3565
+ __wbg_fragment_new: function(arg0) {
3566
+ const ret = Fragment.__wrap(arg0);
3567
+ return ret;
3568
+ },
3569
+ __wbg_fragmentrequested_new: function(arg0) {
3570
+ const ret = FragmentRequested.__wrap(arg0);
3571
+ return ret;
3572
+ },
3573
+ __wbg_fragmentwithblob_new: function(arg0) {
3574
+ const ret = FragmentWithBlob.__wrap(arg0);
3575
+ return ret;
3576
+ },
3577
+ __wbg_from_4bdf88943703fd48: function(arg0) {
3578
+ const ret = Array.from(arg0);
3579
+ return ret;
3580
+ },
3581
+ __wbg_generateKey_2b6cf71e7c9ad526: function() {
3582
+ return handleError(function(arg0, arg1, arg2, arg3) {
3583
+ const ret = arg0.generateKey(arg1, arg2 !== 0, arg3);
3584
+ return ret;
3585
+ }, arguments);
3586
+ },
3587
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() {
3588
+ return handleError(function(arg0, arg1) {
3589
+ arg0.getRandomValues(arg1);
3590
+ }, arguments);
3591
+ },
3592
+ __wbg_get_3ef1eba1850ade27: function() {
3593
+ return handleError(function(arg0, arg1) {
3594
+ const ret = Reflect.get(arg0, arg1);
3595
+ return ret;
3596
+ }, arguments);
3597
+ },
3598
+ __wbg_get_6ac8c8119f577720: function() {
3599
+ return handleError(function(arg0, arg1) {
3600
+ const ret = arg0.get(arg1);
3601
+ return ret;
3602
+ }, arguments);
3603
+ },
3604
+ __wbg_get_a867a94064ecd263: function() {
3605
+ return handleError(function(arg0, arg1, arg2, arg3) {
3606
+ const ret = arg1.get(getStringFromWasm0(arg2, arg3));
3607
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3608
+ var len1 = WASM_VECTOR_LEN;
3609
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3610
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3611
+ }, arguments);
3612
+ },
3613
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
3614
+ const ret = arg0[arg1 >>> 0];
3615
+ return ret;
3616
+ },
3617
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
3618
+ const ret = arg0[arg1 >>> 0];
3619
+ return ret;
3620
+ },
3621
+ __wbg_has_926ef2ff40b308cf: function() {
3622
+ return handleError(function(arg0, arg1) {
3623
+ const ret = Reflect.has(arg0, arg1);
3624
+ return ret;
3625
+ }, arguments);
3626
+ },
3627
+ __wbg_headers_eb2234545f9ff993: function(arg0) {
3628
+ const ret = arg0.headers;
3629
+ return ret;
3630
+ },
3631
+ __wbg_host_5b3ec3e9d4d1fc78: function(arg0, arg1) {
3632
+ const ret = arg1.host;
3633
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3634
+ const len1 = WASM_VECTOR_LEN;
3635
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3636
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3637
+ },
3638
+ __wbg_href_da367531ce807a58: function(arg0, arg1) {
3639
+ const ret = arg1.href;
3640
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3641
+ const len1 = WASM_VECTOR_LEN;
3642
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3643
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3644
+ },
3645
+ __wbg_importKey_397406e38b080c57: function() {
3646
+ return handleError(function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3647
+ const ret = arg0.importKey(getStringFromWasm0(arg1, arg2), arg3, arg4, arg5 !== 0, arg6);
3648
+ return ret;
3649
+ }, arguments);
3650
+ },
3651
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
3652
+ let result;
3653
+ try {
3654
+ result = arg0 instanceof ArrayBuffer;
3655
+ } catch (_) {
3656
+ result = false;
3657
+ }
3658
+ const ret = result;
3659
+ return ret;
3660
+ },
3661
+ __wbg_instanceof_Crypto_5c2a4c15287b0332: function(arg0) {
3662
+ let result;
3663
+ try {
3664
+ result = arg0 instanceof Crypto;
3665
+ } catch (_) {
3666
+ result = false;
3667
+ }
3668
+ const ret = result;
3669
+ return ret;
3670
+ },
3671
+ __wbg_instanceof_IdbDatabase_5f436cc89cc07f14: function(arg0) {
3672
+ let result;
3673
+ try {
3674
+ result = arg0 instanceof IDBDatabase;
3675
+ } catch (_) {
3676
+ result = false;
3677
+ }
3678
+ const ret = result;
3679
+ return ret;
3680
+ },
3681
+ __wbg_instanceof_IdbFactory_efcffbfd9020e4ac: function(arg0) {
3682
+ let result;
3683
+ try {
3684
+ result = arg0 instanceof IDBFactory;
3685
+ } catch (_) {
3686
+ result = false;
3687
+ }
3688
+ const ret = result;
3689
+ return ret;
3690
+ },
3691
+ __wbg_instanceof_IdbOpenDbRequest_10c2576001eb6613: function(arg0) {
3692
+ let result;
3693
+ try {
3694
+ result = arg0 instanceof IDBOpenDBRequest;
3695
+ } catch (_) {
3696
+ result = false;
3697
+ }
3698
+ const ret = result;
3699
+ return ret;
3700
+ },
3701
+ __wbg_instanceof_Promise_7c3bdd7805c2c6e6: function(arg0) {
3702
+ let result;
3703
+ try {
3704
+ result = arg0 instanceof Promise;
3705
+ } catch (_) {
3706
+ result = false;
3707
+ }
3708
+ const ret = result;
3709
+ return ret;
3710
+ },
3711
+ __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
3712
+ let result;
3713
+ try {
3714
+ result = arg0 instanceof Response;
3715
+ } catch (_) {
3716
+ result = false;
3717
+ }
3718
+ const ret = result;
3719
+ return ret;
3720
+ },
3721
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
3722
+ let result;
3723
+ try {
3724
+ result = arg0 instanceof Uint8Array;
3725
+ } catch (_) {
3726
+ result = false;
3727
+ }
3728
+ const ret = result;
3729
+ return ret;
3730
+ },
3731
+ __wbg_instanceof_Window_23e677d2c6843922: function(arg0) {
3732
+ let result;
3733
+ try {
3734
+ result = arg0 instanceof Window;
3735
+ } catch (_) {
3736
+ result = false;
3737
+ }
3738
+ const ret = result;
3739
+ return ret;
3740
+ },
3741
+ __wbg_instanceof_WorkerGlobalScope_de6976d00cb213c6: function(arg0) {
3742
+ let result;
3743
+ try {
3744
+ result = arg0 instanceof WorkerGlobalScope;
3745
+ } catch (_) {
3746
+ result = false;
3747
+ }
3748
+ const ret = result;
3749
+ return ret;
3750
+ },
3751
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
3752
+ const ret = Array.isArray(arg0);
3753
+ return ret;
3754
+ },
3755
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
3756
+ const ret = Number.isSafeInteger(arg0);
3757
+ return ret;
3758
+ },
3759
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
3760
+ const ret = arg0.length;
3761
+ return ret;
3762
+ },
3763
+ __wbg_length_ea16607d7b61445b: function(arg0) {
3764
+ const ret = arg0.length;
3765
+ return ret;
3766
+ },
3767
+ __wbg_loadAllCommits_c18e977eb552890c: function(arg0, arg1) {
3768
+ const ret = arg0.loadAllCommits(arg1);
3769
+ return ret;
3770
+ },
3771
+ __wbg_loadAllFragments_499f304a483c7f7f: function(arg0, arg1) {
3772
+ const ret = arg0.loadAllFragments(arg1);
3773
+ return ret;
3774
+ },
3775
+ __wbg_loadAllSedimentreeIds_da48711155f73930: function(arg0) {
3776
+ const ret = arg0.loadAllSedimentreeIds();
3777
+ return ret;
3778
+ },
3779
+ __wbg_loosecommit_new: function(arg0) {
3780
+ const ret = LooseCommit.__wrap(arg0);
3781
+ return ret;
3782
+ },
3783
+ __wbg_messageporttransport_new: function(arg0) {
3784
+ const ret = MessagePortTransport.__wrap(arg0);
3785
+ return ret;
3786
+ },
3787
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
3788
+ const ret = arg0.msCrypto;
3789
+ return ret;
3790
+ },
3791
+ __wbg_new_0837727332ac86ba: function() {
3792
+ return handleError(function() {
3793
+ const ret = new Headers();
3794
+ return ret;
3795
+ }, arguments);
3796
+ },
3797
+ __wbg_new_227d7c05414eb861: function() {
3798
+ const ret = new Error();
3799
+ return ret;
3800
+ },
3801
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
3802
+ const ret = new Uint8Array(arg0);
3803
+ return ret;
3804
+ },
3805
+ __wbg_new_a70fbab9066b301f: function() {
3806
+ const ret = new Array();
3807
+ return ret;
3808
+ },
3809
+ __wbg_new_ab79df5bd7c26067: function() {
3810
+ const ret = new Object();
3811
+ return ret;
3812
+ },
3813
+ __wbg_new_d098e265629cd10f: function(arg0, arg1) {
3814
+ try {
3815
+ var state0 = { a: arg0, b: arg1 };
3816
+ var cb0 = (arg02, arg12) => {
3817
+ const a = state0.a;
3818
+ state0.a = 0;
3819
+ try {
3820
+ return __wasm_bindgen_func_elem_1652_195(a, state0.b, arg02, arg12);
3821
+ } finally {
3822
+ state0.a = a;
3823
+ }
3824
+ };
3825
+ const ret = new Promise(cb0);
3826
+ return ret;
3827
+ } finally {
3828
+ state0.a = state0.b = 0;
3829
+ }
3830
+ },
3831
+ __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
3832
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
3833
+ return ret;
3834
+ },
3835
+ __wbg_new_dd50bcc3f60ba434: function() {
3836
+ return handleError(function(arg0, arg1) {
3837
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
3838
+ return ret;
3839
+ }, arguments);
3840
+ },
3841
+ __wbg_new_f7708ba82c4c12f6: function() {
3842
+ return handleError(function() {
3843
+ const ret = new MessageChannel();
3844
+ return ret;
3845
+ }, arguments);
3846
+ },
3847
+ __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
3848
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
3849
+ return ret;
3850
+ },
3851
+ __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
3852
+ try {
3853
+ var state0 = { a: arg0, b: arg1 };
3854
+ var cb0 = (arg02, arg12) => {
3855
+ const a = state0.a;
3856
+ state0.a = 0;
3857
+ try {
3858
+ return __wasm_bindgen_func_elem_1652_196(a, state0.b, arg02, arg12);
3859
+ } finally {
3860
+ state0.a = a;
3861
+ }
3862
+ };
3863
+ const ret = new Promise(cb0);
3864
+ return ret;
3865
+ } finally {
3866
+ state0.a = state0.b = 0;
3867
+ }
3868
+ },
3869
+ __wbg_new_typed_bccac67128ed885a: function() {
3870
+ const ret = new Array();
3871
+ return ret;
3872
+ },
3873
+ __wbg_new_with_length_3259a525196bd8cc: function(arg0) {
3874
+ const ret = new Array(arg0 >>> 0);
3875
+ return ret;
3876
+ },
3877
+ __wbg_new_with_length_825018a1616e9e55: function(arg0) {
3878
+ const ret = new Uint8Array(arg0 >>> 0);
3879
+ return ret;
3880
+ },
3881
+ __wbg_new_with_str_and_init_b4b54d1a819bc724: function() {
3882
+ return handleError(function(arg0, arg1, arg2) {
3883
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
3884
+ return ret;
3885
+ }, arguments);
3886
+ },
3887
+ __wbg_node_84ea875411254db1: function(arg0) {
3888
+ const ret = arg0.node;
3889
+ return ret;
3890
+ },
3891
+ __wbg_now_16f0c993d5dd6c27: function() {
3892
+ const ret = Date.now();
3893
+ return ret;
3894
+ },
3895
+ __wbg_objectStoreNames_564985d2e9ae7523: function(arg0) {
3896
+ const ret = arg0.objectStoreNames;
3897
+ return ret;
3898
+ },
3899
+ __wbg_objectStore_f314ab152a5c7bd0: function() {
3900
+ return handleError(function(arg0, arg1, arg2) {
3901
+ const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));
3902
+ return ret;
3903
+ }, arguments);
3904
+ },
3905
+ __wbg_of_8bf7ed3eca00ea43: function(arg0) {
3906
+ const ret = Array.of(arg0);
3907
+ return ret;
3908
+ },
3909
+ __wbg_of_d6376e3774c51f89: function(arg0, arg1) {
3910
+ const ret = Array.of(arg0, arg1);
3911
+ return ret;
3912
+ },
3913
+ __wbg_onDisconnect_a24437def131c941: function(arg0, arg1) {
3914
+ arg0.onDisconnect(arg1);
3915
+ },
3916
+ __wbg_open_e7a9d3d6344572f6: function() {
3917
+ return handleError(function(arg0, arg1, arg2, arg3) {
3918
+ const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
3919
+ return ret;
3920
+ }, arguments);
3921
+ },
3922
+ __wbg_peerbatchsyncresult_new: function(arg0) {
3923
+ const ret = PeerBatchSyncResult.__wrap(arg0);
3924
+ return ret;
3925
+ },
3926
+ __wbg_peerid_new: function(arg0) {
3927
+ const ret = PeerId.__wrap(arg0);
3928
+ return ret;
3929
+ },
3930
+ __wbg_peerresultmap_new: function(arg0) {
3931
+ const ret = PeerResultMap.__wrap(arg0);
3932
+ return ret;
3933
+ },
3934
+ __wbg_port1_869a7ef90538dbdf: function(arg0) {
3935
+ const ret = arg0.port1;
3936
+ return ret;
3937
+ },
3938
+ __wbg_port2_947a51b8ba00adc9: function(arg0) {
3939
+ const ret = arg0.port2;
3940
+ return ret;
3941
+ },
3942
+ __wbg_postMessage_fb1c205fdbbf796d: function(arg0, arg1) {
3943
+ arg0.postMessage(arg1);
3944
+ },
3945
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
3946
+ const ret = arg0.process;
3947
+ return ret;
3948
+ },
3949
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
3950
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
3951
+ },
3952
+ __wbg_push_e87b0e732085a946: function(arg0, arg1) {
3953
+ const ret = arg0.push(arg1);
3954
+ return ret;
3955
+ },
3956
+ __wbg_put_f1673d719f93ce22: function() {
3957
+ return handleError(function(arg0, arg1, arg2) {
3958
+ const ret = arg0.put(arg1, arg2);
3959
+ return ret;
3960
+ }, arguments);
3961
+ },
3962
+ __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
3963
+ const ret = arg0.queueMicrotask;
3964
+ return ret;
3965
+ },
3966
+ __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
3967
+ queueMicrotask(arg0);
3968
+ },
3969
+ __wbg_randomFillSync_6c25eac9869eb53c: function() {
3970
+ return handleError(function(arg0, arg1) {
3971
+ arg0.randomFillSync(arg1);
3972
+ }, arguments);
3973
+ },
3974
+ __wbg_readyState_1f1e7f1bdf9f4d42: function(arg0) {
3975
+ const ret = arg0.readyState;
3976
+ return ret;
3977
+ },
3978
+ __wbg_recvBytes_e13f381294da16db: function(arg0) {
3979
+ const ret = arg0.recvBytes();
3980
+ return ret;
3981
+ },
3982
+ __wbg_require_b4edbdcf3e2a1ef0: function() {
3983
+ return handleError(function() {
3984
+ const ret = module.require;
3985
+ return ret;
3986
+ }, arguments);
3987
+ },
3988
+ __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
3989
+ const ret = Promise.resolve(arg0);
3990
+ return ret;
3991
+ },
3992
+ __wbg_result_c5baa2d3d690a01a: function() {
3993
+ return handleError(function(arg0) {
3994
+ const ret = arg0.result;
3995
+ return ret;
3996
+ }, arguments);
3997
+ },
3998
+ __wbg_saveBatchAll_7c5c5f486aefa571: function(arg0, arg1, arg2, arg3) {
3999
+ const ret = arg0.saveBatchAll(arg1, arg2, arg3);
4000
+ return ret;
4001
+ },
4002
+ __wbg_saveCommit_fb38edd913837eb2: function(arg0, arg1, arg2, arg3, arg4) {
4003
+ const ret = arg0.saveCommit(arg1, arg2, arg3, arg4);
4004
+ return ret;
4005
+ },
4006
+ __wbg_saveFragment_8682cc697a38dbad: function(arg0, arg1, arg2, arg3, arg4) {
4007
+ const ret = arg0.saveFragment(arg1, arg2, arg3, arg4);
4008
+ return ret;
4009
+ },
4010
+ __wbg_saveSedimentreeId_ec8145842e87e53b: function(arg0, arg1) {
4011
+ const ret = arg0.saveSedimentreeId(arg1);
4012
+ return ret;
4013
+ },
4014
+ __wbg_sedimentreeid_new: function(arg0) {
4015
+ const ret = SedimentreeId.__wrap(arg0);
4016
+ return ret;
4017
+ },
4018
+ __wbg_sedimentreeid_unwrap: function(arg0) {
4019
+ const ret = SedimentreeId.__unwrap(arg0);
4020
+ return ret;
4021
+ },
4022
+ __wbg_sendBytes_9a00cdaf7c891eff: function(arg0, arg1) {
4023
+ const ret = arg0.sendBytes(arg1);
4024
+ return ret;
4025
+ },
4026
+ __wbg_send_d31a693c975dea74: function() {
4027
+ return handleError(function(arg0, arg1, arg2) {
4028
+ arg0.send(getArrayU8FromWasm0(arg1, arg2));
4029
+ }, arguments);
4030
+ },
4031
+ __wbg_setTimeout_43db2c2050a4d3d2: function(arg0, arg1) {
4032
+ const ret = setTimeout(arg0, arg1);
4033
+ return ret;
4034
+ },
4035
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
4036
+ arg0[arg1 >>> 0] = arg2;
4037
+ },
4038
+ __wbg_set_7eaa4f96924fd6b3: function() {
4039
+ return handleError(function(arg0, arg1, arg2) {
4040
+ const ret = Reflect.set(arg0, arg1, arg2);
4041
+ return ret;
4042
+ }, arguments);
4043
+ },
4044
+ __wbg_set_binaryType_3dcf8281ec100a8f: function(arg0, arg1) {
4045
+ arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
4046
+ },
4047
+ __wbg_set_body_a3d856b097dfda04: function(arg0, arg1) {
4048
+ arg0.body = arg1;
4049
+ },
4050
+ __wbg_set_e09648bea3f1af1e: function() {
4051
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
4052
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
4053
+ }, arguments);
4054
+ },
4055
+ __wbg_set_headers_3c8fecc693b75327: function(arg0, arg1) {
4056
+ arg0.headers = arg1;
4057
+ },
4058
+ __wbg_set_method_8c015e8bcafd7be1: function(arg0, arg1, arg2) {
4059
+ arg0.method = getStringFromWasm0(arg1, arg2);
4060
+ },
4061
+ __wbg_set_mode_5a87f2c809cf37c2: function(arg0, arg1) {
4062
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
4063
+ },
4064
+ __wbg_set_name_7ef37fe858379aaf: function(arg0, arg1, arg2) {
4065
+ arg0.name = getStringFromWasm0(arg1, arg2);
4066
+ },
4067
+ __wbg_set_onclose_8da801226bdd7a7b: function(arg0, arg1) {
4068
+ arg0.onclose = arg1;
4069
+ },
4070
+ __wbg_set_onerror_8a268cb237177bba: function(arg0, arg1) {
4071
+ arg0.onerror = arg1;
4072
+ },
4073
+ __wbg_set_onerror_901ca711f94a5bbb: function(arg0, arg1) {
4074
+ arg0.onerror = arg1;
4075
+ },
4076
+ __wbg_set_onmessage_284248c97c42cb93: function(arg0, arg1) {
4077
+ arg0.onmessage = arg1;
4078
+ },
4079
+ __wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
4080
+ arg0.onmessage = arg1;
4081
+ },
4082
+ __wbg_set_onopen_34e3e24cf9337ddd: function(arg0, arg1) {
4083
+ arg0.onopen = arg1;
4084
+ },
4085
+ __wbg_set_onsuccess_fca94ded107b64af: function(arg0, arg1) {
4086
+ arg0.onsuccess = arg1;
4087
+ },
4088
+ __wbg_set_onupgradeneeded_860ce42184f987e7: function(arg0, arg1) {
4089
+ arg0.onupgradeneeded = arg1;
4090
+ },
4091
+ __wbg_sign_a34d057afd14c54d: function() {
4092
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
4093
+ const ret = arg0.sign(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
4094
+ return ret;
4095
+ }, arguments);
4096
+ },
4097
+ __wbg_sign_e6fa76bd4ef9c75a: function(arg0, arg1) {
4098
+ const ret = arg0.sign(arg1);
4099
+ return ret;
4100
+ },
4101
+ __wbg_signedfragment_new: function(arg0) {
4102
+ const ret = SignedFragment.__wrap(arg0);
4103
+ return ret;
4104
+ },
4105
+ __wbg_signedfragment_unwrap: function(arg0) {
4106
+ const ret = SignedFragment.__unwrap(arg0);
4107
+ return ret;
4108
+ },
4109
+ __wbg_signedloosecommit_new: function(arg0) {
4110
+ const ret = SignedLooseCommit.__wrap(arg0);
4111
+ return ret;
4112
+ },
4113
+ __wbg_signedloosecommit_unwrap: function(arg0) {
4114
+ const ret = SignedLooseCommit.__unwrap(arg0);
4115
+ return ret;
4116
+ },
4117
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
4118
+ const ret = arg1.stack;
4119
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4120
+ const len1 = WASM_VECTOR_LEN;
4121
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4122
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4123
+ },
4124
+ __wbg_start_f837ba2bac4733b5: function(arg0) {
4125
+ arg0.start();
4126
+ },
4127
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
4128
+ const ret = typeof global === "undefined" ? null : global;
4129
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4130
+ },
4131
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
4132
+ const ret = typeof globalThis === "undefined" ? null : globalThis;
4133
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4134
+ },
4135
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
4136
+ const ret = typeof self === "undefined" ? null : self;
4137
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4138
+ },
4139
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
4140
+ const ret = typeof window === "undefined" ? null : window;
4141
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4142
+ },
4143
+ __wbg_status_318629ab93a22955: function(arg0) {
4144
+ const ret = arg0.status;
4145
+ return ret;
4146
+ },
4147
+ __wbg_subarray_a068d24e39478a8a: function(arg0, arg1, arg2) {
4148
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
4149
+ return ret;
4150
+ },
4151
+ __wbg_subduction_new: function(arg0) {
4152
+ const ret = Subduction.__wrap(arg0);
4153
+ return ret;
4154
+ },
4155
+ __wbg_subductionhttplongpoll_new: function(arg0) {
4156
+ const ret = SubductionHttpLongPoll.__wrap(arg0);
4157
+ return ret;
4158
+ },
4159
+ __wbg_subductionwebsocket_new: function(arg0) {
4160
+ const ret = SubductionWebSocket.__wrap(arg0);
4161
+ return ret;
4162
+ },
4163
+ __wbg_subtle_c060fa3eb5c6248d: function(arg0) {
4164
+ const ret = arg0.subtle;
4165
+ return ret;
4166
+ },
4167
+ __wbg_target_7bc90f314634b37b: function(arg0) {
4168
+ const ret = arg0.target;
4169
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4170
+ },
4171
+ __wbg_then_098abe61755d12f6: function(arg0, arg1) {
4172
+ const ret = arg0.then(arg1);
4173
+ return ret;
4174
+ },
4175
+ __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
4176
+ const ret = arg0.then(arg1, arg2);
4177
+ return ret;
4178
+ },
4179
+ __wbg_topic_new: function(arg0) {
4180
+ const ret = Topic.__wrap(arg0);
4181
+ return ret;
4182
+ },
4183
+ __wbg_topic_unwrap: function(arg0) {
4184
+ const ret = Topic.__unwrap(arg0);
4185
+ return ret;
4186
+ },
4187
+ __wbg_transaction_1309b463c399d2b3: function() {
4188
+ return handleError(function(arg0, arg1, arg2, arg3) {
4189
+ const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
4190
+ return ret;
4191
+ }, arguments);
4192
+ },
4193
+ __wbg_transaction_2237af0233efbdf3: function() {
4194
+ return handleError(function(arg0, arg1, arg2) {
4195
+ const ret = arg0.transaction(getStringFromWasm0(arg1, arg2));
4196
+ return ret;
4197
+ }, arguments);
4198
+ },
4199
+ __wbg_tryIntoJsSedimentreeIdsArray_b07d2438a6f2a3b9: function() {
4200
+ return handleError(function(arg0, arg1) {
4201
+ const ret = tryIntoJsSedimentreeIdsArray(arg1);
4202
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
4203
+ const len1 = WASM_VECTOR_LEN;
4204
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4205
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4206
+ }, arguments);
4207
+ },
4208
+ __wbg_verifyingKey_28c38fc6525caed5: function(arg0) {
4209
+ const ret = arg0.verifyingKey();
4210
+ return ret;
4211
+ },
4212
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
4213
+ const ret = arg0.versions;
4214
+ return ret;
4215
+ },
4216
+ __wbg_webcryptosigner_new: function(arg0) {
4217
+ const ret = WebCryptoSigner.__wrap(arg0);
4218
+ return ret;
4219
+ },
4220
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
4221
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_287, __wasm_bindgen_func_elem_639);
4222
+ return ret;
4223
+ },
4224
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
4225
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_287, __wasm_bindgen_func_elem_639_1);
4226
+ return ret;
4227
+ },
4228
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
4229
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_287, __wasm_bindgen_func_elem_639_2);
4230
+ return ret;
4231
+ },
4232
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
4233
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_287, __wasm_bindgen_func_elem_639_3);
4234
+ return ret;
4235
+ },
4236
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
4237
+ const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_287, __wasm_bindgen_func_elem_638);
4238
+ return ret;
4239
+ },
4240
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
4241
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_287, __wasm_bindgen_func_elem_1652);
4242
+ return ret;
4243
+ },
4244
+ __wbindgen_cast_0000000000000007: function(arg0) {
4245
+ const ret = arg0;
4246
+ return ret;
4247
+ },
4248
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
4249
+ const ret = getArrayU8FromWasm0(arg0, arg1);
4250
+ return ret;
4251
+ },
4252
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
4253
+ const ret = getStringFromWasm0(arg0, arg1);
4254
+ return ret;
4255
+ },
4256
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
4257
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4258
+ wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4259
+ const ret = v0;
4260
+ return ret;
4261
+ },
4262
+ __wbindgen_cast_000000000000000b: function(arg0, arg1) {
4263
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4264
+ wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4265
+ const ret = v0;
4266
+ return ret;
4267
+ },
4268
+ __wbindgen_cast_000000000000000c: function(arg0, arg1) {
4269
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4270
+ wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4271
+ const ret = v0;
4272
+ return ret;
4273
+ },
4274
+ __wbindgen_cast_000000000000000d: function(arg0, arg1) {
4275
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4276
+ wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4277
+ const ret = v0;
4278
+ return ret;
4279
+ },
4280
+ __wbindgen_cast_000000000000000e: function(arg0, arg1) {
4281
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4282
+ wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4283
+ const ret = v0;
4284
+ return ret;
4285
+ },
4286
+ __wbindgen_init_externref_table: function() {
4287
+ const table = wasm.__wbindgen_externrefs;
4288
+ const offset = table.grow(4);
4289
+ table.set(0, void 0);
4290
+ table.set(offset + 0, void 0);
4291
+ table.set(offset + 1, null);
4292
+ table.set(offset + 2, true);
4293
+ table.set(offset + 3, false);
4294
+ }
4295
+ };
4296
+ return {
4297
+ __proto__: null,
4298
+ "./subduction_wasm_bg.js": import0,
4299
+ "./snippets/subduction_wasm-ec51bcf335db35bd/inline0.js": inline0_exports,
4300
+ "./snippets/subduction_wasm-ec51bcf335db35bd/inline1.js": inline1_exports
4301
+ };
4302
+ }
4303
+ function __wasm_bindgen_func_elem_638(arg0, arg1) {
4304
+ wasm.__wasm_bindgen_func_elem_638(arg0, arg1);
4305
+ }
4306
+ function __wasm_bindgen_func_elem_639(arg0, arg1, arg2) {
4307
+ wasm.__wasm_bindgen_func_elem_639(arg0, arg1, arg2);
4308
+ }
4309
+ function __wasm_bindgen_func_elem_639_1(arg0, arg1, arg2) {
4310
+ wasm.__wasm_bindgen_func_elem_639_1(arg0, arg1, arg2);
4311
+ }
4312
+ function __wasm_bindgen_func_elem_639_2(arg0, arg1, arg2) {
4313
+ wasm.__wasm_bindgen_func_elem_639_2(arg0, arg1, arg2);
4314
+ }
4315
+ function __wasm_bindgen_func_elem_639_3(arg0, arg1, arg2) {
4316
+ wasm.__wasm_bindgen_func_elem_639_3(arg0, arg1, arg2);
4317
+ }
4318
+ function __wasm_bindgen_func_elem_1652(arg0, arg1, arg2) {
4319
+ const ret = wasm.__wasm_bindgen_func_elem_1652(arg0, arg1, arg2);
4320
+ if (ret[1]) {
4321
+ throw takeFromExternrefTable0(ret[0]);
4322
+ }
4323
+ }
4324
+ function __wasm_bindgen_func_elem_1652_195(arg0, arg1, arg2, arg3) {
4325
+ wasm.__wasm_bindgen_func_elem_1652_195(arg0, arg1, arg2, arg3);
4326
+ }
4327
+ function __wasm_bindgen_func_elem_1652_196(arg0, arg1, arg2, arg3) {
4328
+ wasm.__wasm_bindgen_func_elem_1652_196(arg0, arg1, arg2, arg3);
4329
+ }
4330
+ var __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
4331
+ var __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
4332
+ var __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
4333
+ var MemorySignerFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4334
+ }, unregister: () => {
4335
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_memorysigner_free(ptr >>> 0, 1));
4336
+ var MemoryStorageFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4337
+ }, unregister: () => {
4338
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_memorystorage_free(ptr >>> 0, 1));
4339
+ var PeerBatchSyncResultFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4340
+ }, unregister: () => {
4341
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_peerbatchsyncresult_free(ptr >>> 0, 1));
4342
+ var AuthenticatedLongPollFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4343
+ }, unregister: () => {
4344
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_authenticatedlongpoll_free(ptr >>> 0, 1));
4345
+ var AuthenticatedTransportFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4346
+ }, unregister: () => {
4347
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_authenticatedtransport_free(ptr >>> 0, 1));
4348
+ var AuthenticatedWebSocketFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4349
+ }, unregister: () => {
4350
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_authenticatedwebsocket_free(ptr >>> 0, 1));
4351
+ var BatchSyncRequestFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4352
+ }, unregister: () => {
4353
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_batchsyncrequest_free(ptr >>> 0, 1));
4354
+ var BatchSyncResponseFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4355
+ }, unregister: () => {
4356
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_batchsyncresponse_free(ptr >>> 0, 1));
4357
+ var BlobMetaFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4358
+ }, unregister: () => {
4359
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_blobmeta_free(ptr >>> 0, 1));
4360
+ var CallErrorFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4361
+ }, unregister: () => {
4362
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_callerror_free(ptr >>> 0, 1));
4363
+ var CommitWithBlobFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4364
+ }, unregister: () => {
4365
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
4366
+ var DepthFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4367
+ }, unregister: () => {
4368
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_depth_free(ptr >>> 0, 1));
4369
+ var DigestFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4370
+ }, unregister: () => {
4371
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_digest_free(ptr >>> 0, 1));
4372
+ var FragmentFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4373
+ }, unregister: () => {
4374
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragment_free(ptr >>> 0, 1));
4375
+ var FragmentRequestedFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4376
+ }, unregister: () => {
4377
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragmentrequested_free(ptr >>> 0, 1));
4378
+ var FragmentWithBlobFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4379
+ }, unregister: () => {
4380
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragmentwithblob_free(ptr >>> 0, 1));
4381
+ var FragmentsArrayFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4382
+ }, unregister: () => {
4383
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragmentsarray_free(ptr >>> 0, 1));
4384
+ var HashMetricFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4385
+ }, unregister: () => {
4386
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_hashmetric_free(ptr >>> 0, 1));
4387
+ var SubductionHttpLongPollFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4388
+ }, unregister: () => {
4389
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_subductionhttplongpoll_free(ptr >>> 0, 1));
4390
+ var SubductionLongPollFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4391
+ }, unregister: () => {
4392
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_subductionlongpoll_free(ptr >>> 0, 1));
4393
+ var LooseCommitFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4394
+ }, unregister: () => {
4395
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
4396
+ var SyncMessageFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4397
+ }, unregister: () => {
4398
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_syncmessage_free(ptr >>> 0, 1));
4399
+ var MessagePortTransportFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4400
+ }, unregister: () => {
4401
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_messageporttransport_free(ptr >>> 0, 1));
4402
+ var NonceFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4403
+ }, unregister: () => {
4404
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_nonce_free(ptr >>> 0, 1));
4405
+ var PeerIdFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4406
+ }, unregister: () => {
4407
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_peerid_free(ptr >>> 0, 1));
4408
+ var PeerResultMapFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4409
+ }, unregister: () => {
4410
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_peerresultmap_free(ptr >>> 0, 1));
4411
+ var RequestIdFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4412
+ }, unregister: () => {
4413
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_requestid_free(ptr >>> 0, 1));
4414
+ var SedimentreeFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4415
+ }, unregister: () => {
4416
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_sedimentree_free(ptr >>> 0, 1));
4417
+ var SedimentreeIdFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4418
+ }, unregister: () => {
4419
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_sedimentreeid_free(ptr >>> 0, 1));
4420
+ var SedimentreeIdsArrayFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4421
+ }, unregister: () => {
4422
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_sedimentreeidsarray_free(ptr >>> 0, 1));
4423
+ var SignedFragmentFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4424
+ }, unregister: () => {
4425
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_signedfragment_free(ptr >>> 0, 1));
4426
+ var SignedLooseCommitFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4427
+ }, unregister: () => {
4428
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_signedloosecommit_free(ptr >>> 0, 1));
4429
+ var SubductionFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4430
+ }, unregister: () => {
4431
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_subduction_free(ptr >>> 0, 1));
4432
+ var SyncStatsFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4433
+ }, unregister: () => {
4434
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_syncstats_free(ptr >>> 0, 1));
4435
+ var TopicFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4436
+ }, unregister: () => {
4437
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_topic_free(ptr >>> 0, 1));
4438
+ var SubductionWebSocketFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4439
+ }, unregister: () => {
4440
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_subductionwebsocket_free(ptr >>> 0, 1));
4441
+ var WebCryptoSignerFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4442
+ }, unregister: () => {
4443
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_webcryptosigner_free(ptr >>> 0, 1));
4444
+ function addToExternrefTable0(obj) {
4445
+ const idx = wasm.__wbindgen_export4();
4446
+ wasm.__wbindgen_externrefs.set(idx, obj);
4447
+ return idx;
4448
+ }
4449
+ function _assertClass(instance, klass) {
4450
+ if (!(instance instanceof klass)) {
4451
+ throw new Error(`expected instance of ${klass.name}`);
4452
+ }
4453
+ }
4454
+ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
4455
+ }, unregister: () => {
4456
+ } } : new FinalizationRegistry((state) => state.dtor(state.a, state.b));
4457
+ function debugString(val) {
4458
+ const type = typeof val;
4459
+ if (type == "number" || type == "boolean" || val == null) {
4460
+ return `${val}`;
4461
+ }
4462
+ if (type == "string") {
4463
+ return `"${val}"`;
4464
+ }
4465
+ if (type == "symbol") {
4466
+ const description = val.description;
4467
+ if (description == null) {
4468
+ return "Symbol";
4469
+ } else {
4470
+ return `Symbol(${description})`;
4471
+ }
4472
+ }
4473
+ if (type == "function") {
4474
+ const name = val.name;
4475
+ if (typeof name == "string" && name.length > 0) {
4476
+ return `Function(${name})`;
4477
+ } else {
4478
+ return "Function";
4479
+ }
4480
+ }
4481
+ if (Array.isArray(val)) {
4482
+ const length = val.length;
4483
+ let debug = "[";
4484
+ if (length > 0) {
4485
+ debug += debugString(val[0]);
4486
+ }
4487
+ for (let i = 1; i < length; i++) {
4488
+ debug += ", " + debugString(val[i]);
4489
+ }
4490
+ debug += "]";
4491
+ return debug;
4492
+ }
4493
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
4494
+ let className;
4495
+ if (builtInMatches && builtInMatches.length > 1) {
4496
+ className = builtInMatches[1];
4497
+ } else {
4498
+ return toString.call(val);
4499
+ }
4500
+ if (className == "Object") {
4501
+ try {
4502
+ return "Object(" + JSON.stringify(val) + ")";
4503
+ } catch (_) {
4504
+ return "Object";
4505
+ }
4506
+ }
4507
+ if (val instanceof Error) {
4508
+ return `${val.name}: ${val.message}
4509
+ ${val.stack}`;
4510
+ }
4511
+ return className;
4512
+ }
4513
+ function getArrayJsValueFromWasm0(ptr, len) {
4514
+ ptr = ptr >>> 0;
4515
+ const mem = getDataViewMemory0();
4516
+ const result = [];
4517
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
4518
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
4519
+ }
4520
+ wasm.__wbindgen_export6(ptr, len);
4521
+ return result;
4522
+ }
4523
+ function getArrayU8FromWasm0(ptr, len) {
4524
+ ptr = ptr >>> 0;
4525
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
4526
+ }
4527
+ var cachedDataViewMemory0 = null;
4528
+ function getDataViewMemory0() {
4529
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
4530
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
4531
+ }
4532
+ return cachedDataViewMemory0;
4533
+ }
4534
+ function getStringFromWasm0(ptr, len) {
4535
+ ptr = ptr >>> 0;
4536
+ return decodeText(ptr, len);
4537
+ }
4538
+ var cachedUint8ArrayMemory0 = null;
4539
+ function getUint8ArrayMemory0() {
4540
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
4541
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
4542
+ }
4543
+ return cachedUint8ArrayMemory0;
4544
+ }
4545
+ function handleError(f, args) {
4546
+ try {
4547
+ return f.apply(this, args);
4548
+ } catch (e) {
4549
+ const idx = addToExternrefTable0(e);
4550
+ wasm.__wbindgen_export3(idx);
4551
+ }
4552
+ }
4553
+ function isLikeNone(x) {
4554
+ return x === void 0 || x === null;
4555
+ }
4556
+ function makeClosure(arg0, arg1, dtor, f) {
4557
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
4558
+ const real = (...args) => {
4559
+ state.cnt++;
4560
+ try {
4561
+ return f(state.a, state.b, ...args);
4562
+ } finally {
4563
+ real._wbg_cb_unref();
4564
+ }
4565
+ };
4566
+ real._wbg_cb_unref = () => {
4567
+ if (--state.cnt === 0) {
4568
+ state.dtor(state.a, state.b);
4569
+ state.a = 0;
4570
+ CLOSURE_DTORS.unregister(state);
4571
+ }
4572
+ };
4573
+ CLOSURE_DTORS.register(real, state, state);
4574
+ return real;
4575
+ }
4576
+ function makeMutClosure(arg0, arg1, dtor, f) {
4577
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
4578
+ const real = (...args) => {
4579
+ state.cnt++;
4580
+ const a = state.a;
4581
+ state.a = 0;
4582
+ try {
4583
+ return f(a, state.b, ...args);
4584
+ } finally {
4585
+ state.a = a;
4586
+ real._wbg_cb_unref();
4587
+ }
4588
+ };
4589
+ real._wbg_cb_unref = () => {
4590
+ if (--state.cnt === 0) {
4591
+ state.dtor(state.a, state.b);
4592
+ state.a = 0;
4593
+ CLOSURE_DTORS.unregister(state);
4594
+ }
4595
+ };
4596
+ CLOSURE_DTORS.register(real, state, state);
4597
+ return real;
4598
+ }
4599
+ function passArray8ToWasm0(arg, malloc) {
4600
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
4601
+ getUint8ArrayMemory0().set(arg, ptr / 1);
4602
+ WASM_VECTOR_LEN = arg.length;
4603
+ return ptr;
4604
+ }
4605
+ function passArrayJsValueToWasm0(array, malloc) {
4606
+ const ptr = malloc(array.length * 4, 4) >>> 0;
4607
+ for (let i = 0; i < array.length; i++) {
4608
+ const add = addToExternrefTable0(array[i]);
4609
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
4610
+ }
4611
+ WASM_VECTOR_LEN = array.length;
4612
+ return ptr;
4613
+ }
4614
+ function passStringToWasm0(arg, malloc, realloc) {
4615
+ if (realloc === void 0) {
4616
+ const buf = cachedTextEncoder.encode(arg);
4617
+ const ptr2 = malloc(buf.length, 1) >>> 0;
4618
+ getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
4619
+ WASM_VECTOR_LEN = buf.length;
4620
+ return ptr2;
4621
+ }
4622
+ let len = arg.length;
4623
+ let ptr = malloc(len, 1) >>> 0;
4624
+ const mem = getUint8ArrayMemory0();
4625
+ let offset = 0;
4626
+ for (; offset < len; offset++) {
4627
+ const code = arg.charCodeAt(offset);
4628
+ if (code > 127) break;
4629
+ mem[ptr + offset] = code;
4630
+ }
4631
+ if (offset !== len) {
4632
+ if (offset !== 0) {
4633
+ arg = arg.slice(offset);
4634
+ }
4635
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
4636
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
4637
+ const ret = cachedTextEncoder.encodeInto(arg, view);
4638
+ offset += ret.written;
4639
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
4640
+ }
4641
+ WASM_VECTOR_LEN = offset;
4642
+ return ptr;
4643
+ }
4644
+ function takeFromExternrefTable0(idx) {
4645
+ const value = wasm.__wbindgen_externrefs.get(idx);
4646
+ wasm.__wbindgen_export7(idx);
4647
+ return value;
4648
+ }
4649
+ var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
4650
+ cachedTextDecoder.decode();
4651
+ var MAX_SAFARI_DECODE_BYTES = 2146435072;
4652
+ var numBytesDecoded = 0;
4653
+ function decodeText(ptr, len) {
4654
+ numBytesDecoded += len;
4655
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
4656
+ cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
4657
+ cachedTextDecoder.decode();
4658
+ numBytesDecoded = len;
4659
+ }
4660
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
4661
+ }
4662
+ var cachedTextEncoder = new TextEncoder();
4663
+ if (!("encodeInto" in cachedTextEncoder)) {
4664
+ cachedTextEncoder.encodeInto = function(arg, view) {
4665
+ const buf = cachedTextEncoder.encode(arg);
4666
+ view.set(buf);
4667
+ return {
4668
+ read: arg.length,
4669
+ written: buf.length
4670
+ };
4671
+ };
4672
+ }
4673
+ var WASM_VECTOR_LEN = 0;
4674
+ var wasmModule;
4675
+ var wasm;
4676
+ function __wbg_finalize_init(instance, module2) {
4677
+ wasm = instance.exports;
4678
+ wasmModule = module2;
4679
+ cachedDataViewMemory0 = null;
4680
+ cachedUint8ArrayMemory0 = null;
4681
+ wasm.__wbindgen_start();
4682
+ return wasm;
4683
+ }
4684
+ async function __wbg_load(module2, imports) {
4685
+ if (typeof Response === "function" && module2 instanceof Response) {
4686
+ if (typeof WebAssembly.instantiateStreaming === "function") {
4687
+ try {
4688
+ return await WebAssembly.instantiateStreaming(module2, imports);
4689
+ } catch (e) {
4690
+ const validResponse = module2.ok && expectedResponseType(module2.type);
4691
+ if (validResponse && module2.headers.get("Content-Type") !== "application/wasm") {
4692
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
4693
+ } else {
4694
+ throw e;
4695
+ }
4696
+ }
4697
+ }
4698
+ const bytes = await module2.arrayBuffer();
4699
+ return await WebAssembly.instantiate(bytes, imports);
4700
+ } else {
4701
+ const instance = await WebAssembly.instantiate(module2, imports);
4702
+ if (instance instanceof WebAssembly.Instance) {
4703
+ return { instance, module: module2 };
4704
+ } else {
4705
+ return instance;
4706
+ }
4707
+ }
4708
+ function expectedResponseType(type) {
4709
+ switch (type) {
4710
+ case "basic":
4711
+ case "cors":
4712
+ case "default":
4713
+ return true;
4714
+ }
4715
+ return false;
4716
+ }
4717
+ }
4718
+ function initSync(module2) {
4719
+ if (wasm !== void 0) return wasm;
4720
+ if (module2 !== void 0) {
4721
+ if (Object.getPrototypeOf(module2) === Object.prototype) {
4722
+ ({ module: module2 } = module2);
4723
+ } else {
4724
+ console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
4725
+ }
4726
+ }
4727
+ const imports = __wbg_get_imports();
4728
+ if (!(module2 instanceof WebAssembly.Module)) {
4729
+ module2 = new WebAssembly.Module(module2);
4730
+ }
4731
+ const instance = new WebAssembly.Instance(module2, imports);
4732
+ return __wbg_finalize_init(instance, module2);
4733
+ }
4734
+ async function __wbg_init(module_or_path) {
4735
+ if (wasm !== void 0) return wasm;
4736
+ if (module_or_path !== void 0) {
4737
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
4738
+ ({ module_or_path } = module_or_path);
4739
+ } else {
4740
+ console.warn("using deprecated parameters for the initialization function; pass a single object instead");
4741
+ }
4742
+ }
4743
+ if (module_or_path === void 0) {
4744
+ module_or_path = new /* @vite-ignore */
4745
+ URL("subduction_wasm_bg.wasm", import_meta.url);
4746
+ }
4747
+ const imports = __wbg_get_imports();
4748
+ if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
4749
+ module_or_path = fetch(module_or_path);
4750
+ }
4751
+ const { instance, module: module2 } = await __wbg_load(await module_or_path, imports);
4752
+ return __wbg_finalize_init(instance, module2);
4753
+ }
4754
+ function __wbg_set_wasm(val) {
4755
+ wasm = val;
4756
+ }
4757
+ // Annotate the CommonJS export names for ESM import in node:
4758
+ 0 && (module.exports = {
4759
+ AuthenticatedLongPoll,
4760
+ AuthenticatedTransport,
4761
+ AuthenticatedWebSocket,
4762
+ BatchSyncRequest,
4763
+ BatchSyncResponse,
4764
+ BlobMeta,
4765
+ CallError,
4766
+ CommitWithBlob,
4767
+ Depth,
4768
+ Digest,
4769
+ Fragment,
4770
+ FragmentRequested,
4771
+ FragmentWithBlob,
4772
+ FragmentsArray,
4773
+ HashMetric,
4774
+ LooseCommit,
4775
+ MemorySigner,
4776
+ MemoryStorage,
4777
+ MessagePortTransport,
4778
+ Nonce,
4779
+ PeerBatchSyncResult,
4780
+ PeerId,
4781
+ PeerResultMap,
4782
+ RequestId,
4783
+ Sedimentree,
4784
+ SedimentreeId,
4785
+ SedimentreeIdsArray,
4786
+ SignedFragment,
4787
+ SignedLooseCommit,
4788
+ Subduction,
4789
+ SubductionHttpLongPoll,
4790
+ SubductionLongPoll,
4791
+ SubductionWebSocket,
4792
+ SyncMessage,
4793
+ SyncStats,
4794
+ Topic,
4795
+ WebCryptoSigner,
4796
+ __wbg_set_wasm,
4797
+ initSync,
4798
+ makeMessagePortTransport,
4799
+ start
4800
+ });