ping-openmls-sdk 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1558 @@
1
+ /* @ts-self-types="./ping_wasm.d.ts" */
2
+
3
+ export class PingClient {
4
+ static __wrap(ptr) {
5
+ const obj = Object.create(PingClient.prototype);
6
+ obj.__wbg_ptr = ptr;
7
+ PingClientFinalization.register(obj, obj.__wbg_ptr, obj);
8
+ return obj;
9
+ }
10
+ __destroy_into_raw() {
11
+ const ptr = this.__wbg_ptr;
12
+ this.__wbg_ptr = 0;
13
+ PingClientFinalization.unregister(this);
14
+ return ptr;
15
+ }
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_pingclient_free(ptr, 0);
19
+ }
20
+ /**
21
+ * Add members ([CR-2]). `entries` is an array of `{ deviceId: Uint8Array,
22
+ * keyPackage: Uint8Array }`. Bundling the device_id with the KeyPackage lets us
23
+ * persist a per-conversation device→leaf map for [`revokeDevice`].
24
+ * @param {Uint8Array} conv_id
25
+ * @param {any} entries
26
+ * @param {number} now_ms
27
+ * @returns {Promise<void>}
28
+ */
29
+ addMembers(conv_id, entries, now_ms) {
30
+ const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
31
+ const len0 = WASM_VECTOR_LEN;
32
+ const ret = wasm.pingclient_addMembers(this.__wbg_ptr, ptr0, len0, addHeapObject(entries), now_ms);
33
+ return takeObject(ret);
34
+ }
35
+ /**
36
+ * Build a `LinkingTicket` ([CR-13] populates `catchup_snapshot` from `last_app_events`).
37
+ *
38
+ * `last_app_events` is an array of `{ conversationId: Uint8Array, appEventBytes:
39
+ * Uint8Array }`. Pass `[]` to suppress catchup data.
40
+ * @param {Uint8Array} new_device_id
41
+ * @param {Uint8Array} new_device_kp
42
+ * @param {any} last_app_events
43
+ * @param {number} now_ms
44
+ * @returns {Promise<any>}
45
+ */
46
+ buildLinkingTicket(new_device_id, new_device_kp, last_app_events, now_ms) {
47
+ const ptr0 = passArray8ToWasm0(new_device_id, wasm.__wbindgen_export);
48
+ const len0 = WASM_VECTOR_LEN;
49
+ const ptr1 = passArray8ToWasm0(new_device_kp, wasm.__wbindgen_export);
50
+ const len1 = WASM_VECTOR_LEN;
51
+ const ret = wasm.pingclient_buildLinkingTicket(this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(last_app_events), now_ms);
52
+ return takeObject(ret);
53
+ }
54
+ /**
55
+ * @param {any} ticket
56
+ * @param {number} now_ms
57
+ * @returns {Promise<void>}
58
+ */
59
+ consumeLinkingTicket(ticket, now_ms) {
60
+ const ret = wasm.pingclient_consumeLinkingTicket(this.__wbg_ptr, addHeapObject(ticket), now_ms);
61
+ return takeObject(ret);
62
+ }
63
+ /**
64
+ * @param {string | null | undefined} name
65
+ * @param {number} now_ms
66
+ * @returns {Promise<Uint8Array>}
67
+ */
68
+ createConversation(name, now_ms) {
69
+ var ptr0 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
70
+ var len0 = WASM_VECTOR_LEN;
71
+ const ret = wasm.pingclient_createConversation(this.__wbg_ptr, ptr0, len0, now_ms);
72
+ return takeObject(ret);
73
+ }
74
+ /**
75
+ * @returns {Uint8Array}
76
+ */
77
+ deviceId() {
78
+ try {
79
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
80
+ wasm.pingclient_deviceId(retptr, this.__wbg_ptr);
81
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
82
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
83
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
84
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
85
+ return v1;
86
+ } finally {
87
+ wasm.__wbindgen_add_to_stack_pointer(16);
88
+ }
89
+ }
90
+ /**
91
+ * Export a derived secret from a conversation's MLS exporter ([CR-8]).
92
+ *
93
+ * The core wraps the bytes in `Zeroizing<Vec<u8>>`; once they cross the WASM/JS
94
+ * boundary they live in a regular JS `Uint8Array` and JS GC controls the lifetime.
95
+ * Callers in JS MUST treat the buffer as a secret — never log, persist only
96
+ * encrypted, and clear the typed array when done (`u8.fill(0)`).
97
+ * @param {Uint8Array} conv_id
98
+ * @param {string} label
99
+ * @param {Uint8Array} context
100
+ * @param {number} length
101
+ * @returns {Uint8Array}
102
+ */
103
+ exportConversationSecret(conv_id, label, context, length) {
104
+ try {
105
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
106
+ const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
107
+ const len0 = WASM_VECTOR_LEN;
108
+ const ptr1 = passStringToWasm0(label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
109
+ const len1 = WASM_VECTOR_LEN;
110
+ const ptr2 = passArray8ToWasm0(context, wasm.__wbindgen_export);
111
+ const len2 = WASM_VECTOR_LEN;
112
+ wasm.pingclient_exportConversationSecret(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, length);
113
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
114
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
115
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
116
+ if (r2) {
117
+ throw takeObject(r1);
118
+ }
119
+ return takeObject(r0);
120
+ } finally {
121
+ wasm.__wbindgen_add_to_stack_pointer(16);
122
+ }
123
+ }
124
+ /**
125
+ * [CR-7] Export the MLS state snapshot for one conversation.
126
+ * @param {Uint8Array} conv_id
127
+ * @param {number} now_ms
128
+ * @returns {Uint8Array}
129
+ */
130
+ exportConversationStateSnapshot(conv_id, now_ms) {
131
+ try {
132
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
133
+ const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
134
+ const len0 = WASM_VECTOR_LEN;
135
+ wasm.pingclient_exportConversationStateSnapshot(retptr, this.__wbg_ptr, ptr0, len0, now_ms);
136
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
137
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
138
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
139
+ if (r2) {
140
+ throw takeObject(r1);
141
+ }
142
+ return takeObject(r0);
143
+ } finally {
144
+ wasm.__wbindgen_add_to_stack_pointer(16);
145
+ }
146
+ }
147
+ /**
148
+ * @returns {Uint8Array}
149
+ */
150
+ freshKeyPackage() {
151
+ try {
152
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
153
+ wasm.pingclient_freshKeyPackage(retptr, this.__wbg_ptr);
154
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
155
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
156
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
157
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
158
+ if (r3) {
159
+ throw takeObject(r2);
160
+ }
161
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
162
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
163
+ return v1;
164
+ } finally {
165
+ wasm.__wbindgen_add_to_stack_pointer(16);
166
+ }
167
+ }
168
+ /**
169
+ * Generate a fresh identity. Returns the export bytes — store them under the user's account.
170
+ * @returns {Uint8Array}
171
+ */
172
+ static generateIdentity() {
173
+ try {
174
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
175
+ wasm.pingclient_generateIdentity(retptr);
176
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
177
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
178
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
179
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
180
+ return v1;
181
+ } finally {
182
+ wasm.__wbindgen_add_to_stack_pointer(16);
183
+ }
184
+ }
185
+ /**
186
+ * [CR-7] Import an MLS state snapshot produced by another device of the same
187
+ * user identity. Returns the conversation id the snapshot describes.
188
+ * @param {Uint8Array} snapshot_bytes
189
+ * @param {number} now_ms
190
+ * @returns {Promise<Uint8Array>}
191
+ */
192
+ importStateSnapshot(snapshot_bytes, now_ms) {
193
+ const ptr0 = passArray8ToWasm0(snapshot_bytes, wasm.__wbindgen_export);
194
+ const len0 = WASM_VECTOR_LEN;
195
+ const ret = wasm.pingclient_importStateSnapshot(this.__wbg_ptr, ptr0, len0, now_ms);
196
+ return takeObject(ret);
197
+ }
198
+ /**
199
+ * Initialise the client. Pass an exported identity (use `generateIdentity()` for a fresh one).
200
+ * @param {Uint8Array} identity_export
201
+ * @param {string} device_label
202
+ * @param {JsStorage} storage
203
+ * @param {JsTransport} transport
204
+ * @param {number} now_ms
205
+ * @returns {Promise<PingClient>}
206
+ */
207
+ static init(identity_export, device_label, storage, transport, now_ms) {
208
+ const ptr0 = passArray8ToWasm0(identity_export, wasm.__wbindgen_export);
209
+ const len0 = WASM_VECTOR_LEN;
210
+ const ptr1 = passStringToWasm0(device_label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
211
+ const len1 = WASM_VECTOR_LEN;
212
+ const ret = wasm.pingclient_init(ptr0, len0, ptr1, len1, addHeapObject(storage), addHeapObject(transport), now_ms);
213
+ return takeObject(ret);
214
+ }
215
+ /**
216
+ * @param {any} welcome
217
+ * @param {number} now_ms
218
+ * @returns {Promise<Uint8Array>}
219
+ */
220
+ joinConversation(welcome, now_ms) {
221
+ const ret = wasm.pingclient_joinConversation(this.__wbg_ptr, addHeapObject(welcome), now_ms);
222
+ return takeObject(ret);
223
+ }
224
+ /**
225
+ * @returns {any}
226
+ */
227
+ listConversations() {
228
+ try {
229
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
230
+ wasm.pingclient_listConversations(retptr, this.__wbg_ptr);
231
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
232
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
233
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
234
+ if (r2) {
235
+ throw takeObject(r1);
236
+ }
237
+ return takeObject(r0);
238
+ } finally {
239
+ wasm.__wbindgen_add_to_stack_pointer(16);
240
+ }
241
+ }
242
+ /**
243
+ * @param {Function} cb
244
+ */
245
+ onMessage(cb) {
246
+ wasm.pingclient_onMessage(this.__wbg_ptr, addHeapObject(cb));
247
+ }
248
+ /**
249
+ * @param {any} env
250
+ * @param {number} now_ms
251
+ * @returns {Promise<any>}
252
+ */
253
+ processEnvelope(env, now_ms) {
254
+ const ret = wasm.pingclient_processEnvelope(this.__wbg_ptr, addHeapObject(env), now_ms);
255
+ return takeObject(ret);
256
+ }
257
+ /**
258
+ * @param {Uint8Array} conv_id
259
+ * @param {Uint32Array} leaves
260
+ * @param {number} now_ms
261
+ * @returns {Promise<void>}
262
+ */
263
+ removeMembers(conv_id, leaves, now_ms) {
264
+ const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ptr1 = passArray32ToWasm0(leaves, wasm.__wbindgen_export);
267
+ const len1 = WASM_VECTOR_LEN;
268
+ const ret = wasm.pingclient_removeMembers(this.__wbg_ptr, ptr0, len0, ptr1, len1, now_ms);
269
+ return takeObject(ret);
270
+ }
271
+ /**
272
+ * Revoke a device ([CR-2]). Returns an array of Commit envelopes — one per
273
+ * conversation the device was a locally-known leaf in. Each envelope has already
274
+ * been handed to the transport; the host's hand-back is for any additional
275
+ * receipt-of-revocation handling.
276
+ * @param {Uint8Array} device_id
277
+ * @param {number} now_ms
278
+ * @returns {Promise<any>}
279
+ */
280
+ revokeDevice(device_id, now_ms) {
281
+ const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_export);
282
+ const len0 = WASM_VECTOR_LEN;
283
+ const ret = wasm.pingclient_revokeDevice(this.__wbg_ptr, ptr0, len0, now_ms);
284
+ return takeObject(ret);
285
+ }
286
+ /**
287
+ * @param {Uint8Array} conv_id
288
+ * @param {Uint8Array} plaintext
289
+ * @param {number} now_ms
290
+ * @returns {Promise<any>}
291
+ */
292
+ send(conv_id, plaintext, now_ms) {
293
+ const ptr0 = passArray8ToWasm0(conv_id, wasm.__wbindgen_export);
294
+ const len0 = WASM_VECTOR_LEN;
295
+ const ptr1 = passArray8ToWasm0(plaintext, wasm.__wbindgen_export);
296
+ const len1 = WASM_VECTOR_LEN;
297
+ const ret = wasm.pingclient_send(this.__wbg_ptr, ptr0, len0, ptr1, len1, now_ms);
298
+ return takeObject(ret);
299
+ }
300
+ /**
301
+ * @param {number} now_ms
302
+ * @returns {Promise<any>}
303
+ */
304
+ syncConversations(now_ms) {
305
+ const ret = wasm.pingclient_syncConversations(this.__wbg_ptr, now_ms);
306
+ return takeObject(ret);
307
+ }
308
+ /**
309
+ * @returns {Uint8Array}
310
+ */
311
+ userId() {
312
+ try {
313
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
314
+ wasm.pingclient_userId(retptr, this.__wbg_ptr);
315
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
316
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
317
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
318
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
319
+ return v1;
320
+ } finally {
321
+ wasm.__wbindgen_add_to_stack_pointer(16);
322
+ }
323
+ }
324
+ }
325
+ if (Symbol.dispose) PingClient.prototype[Symbol.dispose] = PingClient.prototype.free;
326
+
327
+ /**
328
+ * Runtime test harness support instantiated in JS.
329
+ *
330
+ * The node.js entry script instantiates a `Context` here which is used to
331
+ * drive test execution.
332
+ */
333
+ export class WasmBindgenTestContext {
334
+ __destroy_into_raw() {
335
+ const ptr = this.__wbg_ptr;
336
+ this.__wbg_ptr = 0;
337
+ WasmBindgenTestContextFinalization.unregister(this);
338
+ return ptr;
339
+ }
340
+ free() {
341
+ const ptr = this.__destroy_into_raw();
342
+ wasm.__wbg_wasmbindgentestcontext_free(ptr, 0);
343
+ }
344
+ /**
345
+ * Handle filter argument.
346
+ * @param {number} filtered
347
+ */
348
+ filtered_count(filtered) {
349
+ wasm.wasmbindgentestcontext_filtered_count(this.__wbg_ptr, filtered);
350
+ }
351
+ /**
352
+ * Handle `--include-ignored` flag.
353
+ * @param {boolean} include_ignored
354
+ */
355
+ include_ignored(include_ignored) {
356
+ wasm.wasmbindgentestcontext_include_ignored(this.__wbg_ptr, include_ignored);
357
+ }
358
+ /**
359
+ * Creates a new context ready to run tests.
360
+ *
361
+ * A `Context` is the main structure through which test execution is
362
+ * coordinated, and this will collect output and results for all executed
363
+ * tests.
364
+ * @param {boolean} is_bench
365
+ */
366
+ constructor(is_bench) {
367
+ const ret = wasm.wasmbindgentestcontext_new(is_bench);
368
+ this.__wbg_ptr = ret;
369
+ WasmBindgenTestContextFinalization.register(this, this.__wbg_ptr, this);
370
+ return this;
371
+ }
372
+ /**
373
+ * Executes a list of tests, returning a promise representing their
374
+ * eventual completion.
375
+ *
376
+ * This is the main entry point for executing tests. All the tests passed
377
+ * in are the JS `Function` object that was plucked off the
378
+ * `WebAssembly.Instance` exports list.
379
+ *
380
+ * The promise returned resolves to either `true` if all tests passed or
381
+ * `false` if at least one test failed.
382
+ * @param {any[]} tests
383
+ * @returns {Promise<any>}
384
+ */
385
+ run(tests) {
386
+ const ptr0 = passArrayJsValueToWasm0(tests, wasm.__wbindgen_export);
387
+ const len0 = WASM_VECTOR_LEN;
388
+ const ret = wasm.wasmbindgentestcontext_run(this.__wbg_ptr, ptr0, len0);
389
+ return takeObject(ret);
390
+ }
391
+ }
392
+ if (Symbol.dispose) WasmBindgenTestContext.prototype[Symbol.dispose] = WasmBindgenTestContext.prototype.free;
393
+
394
+ /**
395
+ * Used to read benchmark data, and then the runner stores it on the local disk.
396
+ * @returns {Uint8Array | undefined}
397
+ */
398
+ export function __wbgbench_dump() {
399
+ try {
400
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
401
+ wasm.__wbgbench_dump(retptr);
402
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
403
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
404
+ let v1;
405
+ if (r0 !== 0) {
406
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
407
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
408
+ }
409
+ return v1;
410
+ } finally {
411
+ wasm.__wbindgen_add_to_stack_pointer(16);
412
+ }
413
+ }
414
+
415
+ /**
416
+ * Used to write previous benchmark data before the benchmark, for later comparison.
417
+ * @param {Uint8Array} baseline
418
+ */
419
+ export function __wbgbench_import(baseline) {
420
+ const ptr0 = passArray8ToWasm0(baseline, wasm.__wbindgen_export);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ wasm.__wbgbench_import(ptr0, len0);
423
+ }
424
+
425
+ /**
426
+ * Handler for `console.debug` invocations. See above.
427
+ * @param {Array<any>} args
428
+ */
429
+ export function __wbgtest_console_debug(args) {
430
+ try {
431
+ wasm.__wbgtest_console_debug(addBorrowedObject(args));
432
+ } finally {
433
+ heap[stack_pointer++] = undefined;
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Handler for `console.error` invocations. See above.
439
+ * @param {Array<any>} args
440
+ */
441
+ export function __wbgtest_console_error(args) {
442
+ try {
443
+ wasm.__wbgtest_console_error(addBorrowedObject(args));
444
+ } finally {
445
+ heap[stack_pointer++] = undefined;
446
+ }
447
+ }
448
+
449
+ /**
450
+ * Handler for `console.info` invocations. See above.
451
+ * @param {Array<any>} args
452
+ */
453
+ export function __wbgtest_console_info(args) {
454
+ try {
455
+ wasm.__wbgtest_console_info(addBorrowedObject(args));
456
+ } finally {
457
+ heap[stack_pointer++] = undefined;
458
+ }
459
+ }
460
+
461
+ /**
462
+ * Handler for `console.log` invocations.
463
+ *
464
+ * If a test is currently running it takes the `args` array and stringifies
465
+ * it and appends it to the current output of the test. Otherwise it passes
466
+ * the arguments to the original `console.log` function, psased as
467
+ * `original`.
468
+ * @param {Array<any>} args
469
+ */
470
+ export function __wbgtest_console_log(args) {
471
+ try {
472
+ wasm.__wbgtest_console_log(addBorrowedObject(args));
473
+ } finally {
474
+ heap[stack_pointer++] = undefined;
475
+ }
476
+ }
477
+
478
+ /**
479
+ * Handler for `console.warn` invocations. See above.
480
+ * @param {Array<any>} args
481
+ */
482
+ export function __wbgtest_console_warn(args) {
483
+ try {
484
+ wasm.__wbgtest_console_warn(addBorrowedObject(args));
485
+ } finally {
486
+ heap[stack_pointer++] = undefined;
487
+ }
488
+ }
489
+
490
+ /**
491
+ * @returns {Uint8Array | undefined}
492
+ */
493
+ export function __wbgtest_cov_dump() {
494
+ try {
495
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
496
+ wasm.__wbgtest_cov_dump(retptr);
497
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
498
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
499
+ let v1;
500
+ if (r0 !== 0) {
501
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
502
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
503
+ }
504
+ return v1;
505
+ } finally {
506
+ wasm.__wbindgen_add_to_stack_pointer(16);
507
+ }
508
+ }
509
+
510
+ /**
511
+ * Path to use for coverage data.
512
+ * @param {string | null | undefined} env
513
+ * @param {number} pid
514
+ * @param {string} temp_dir
515
+ * @param {bigint} module_signature
516
+ * @returns {string}
517
+ */
518
+ export function __wbgtest_coverage_path(env, pid, temp_dir, module_signature) {
519
+ let deferred3_0;
520
+ let deferred3_1;
521
+ try {
522
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
523
+ var ptr0 = isLikeNone(env) ? 0 : passStringToWasm0(env, wasm.__wbindgen_export, wasm.__wbindgen_export2);
524
+ var len0 = WASM_VECTOR_LEN;
525
+ const ptr1 = passStringToWasm0(temp_dir, wasm.__wbindgen_export, wasm.__wbindgen_export2);
526
+ const len1 = WASM_VECTOR_LEN;
527
+ wasm.__wbgtest_coverage_path(retptr, ptr0, len0, pid, ptr1, len1, module_signature);
528
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
529
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
530
+ deferred3_0 = r0;
531
+ deferred3_1 = r1;
532
+ return getStringFromWasm0(r0, r1);
533
+ } finally {
534
+ wasm.__wbindgen_add_to_stack_pointer(16);
535
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
536
+ }
537
+ }
538
+
539
+ /**
540
+ * @returns {bigint | undefined}
541
+ */
542
+ export function __wbgtest_module_signature() {
543
+ try {
544
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
545
+ wasm.__wbgtest_module_signature(retptr);
546
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
547
+ var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
548
+ return r0 === 0 ? undefined : BigInt.asUintN(64, r2);
549
+ } finally {
550
+ wasm.__wbindgen_add_to_stack_pointer(16);
551
+ }
552
+ }
553
+
554
+ export function _start() {
555
+ wasm._start();
556
+ }
557
+
558
+ /**
559
+ * HPKE-open a sealed `LinkingTicket` ([CR-3]). Pure function — usable without an
560
+ * initialized `PingClient`, which is exactly the situation the receiving device is in
561
+ * (pre-bootstrap; no identity yet).
562
+ *
563
+ * `new_device_priv` must be 32 bytes (X25519 private key). Errors are returned with a
564
+ * generic message — the new device shouldn't get to discriminate "wrong key" from
565
+ * "tampered ciphertext".
566
+ * [CR-13] Decode a `LinkingTicket.catchup_snapshot` blob. Pure function; no client
567
+ * required. The new device calls this after `consumeLinkingTicket` to populate its
568
+ * initial UI.
569
+ * @param {Uint8Array} snapshot_bytes
570
+ * @returns {any}
571
+ */
572
+ export function decodeCatchupSnapshot(snapshot_bytes) {
573
+ try {
574
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
575
+ const ptr0 = passArray8ToWasm0(snapshot_bytes, wasm.__wbindgen_export);
576
+ const len0 = WASM_VECTOR_LEN;
577
+ wasm.decodeCatchupSnapshot(retptr, ptr0, len0);
578
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
579
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
580
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
581
+ if (r2) {
582
+ throw takeObject(r1);
583
+ }
584
+ return takeObject(r0);
585
+ } finally {
586
+ wasm.__wbindgen_add_to_stack_pointer(16);
587
+ }
588
+ }
589
+
590
+ /**
591
+ * @param {Uint8Array} sealed
592
+ * @param {Uint8Array} new_device_priv
593
+ * @returns {any}
594
+ */
595
+ export function openLinkingTicket(sealed, new_device_priv) {
596
+ try {
597
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
598
+ const ptr0 = passArray8ToWasm0(sealed, wasm.__wbindgen_export);
599
+ const len0 = WASM_VECTOR_LEN;
600
+ const ptr1 = passArray8ToWasm0(new_device_priv, wasm.__wbindgen_export);
601
+ const len1 = WASM_VECTOR_LEN;
602
+ wasm.openLinkingTicket(retptr, ptr0, len0, ptr1, len1);
603
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
604
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
605
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
606
+ if (r2) {
607
+ throw takeObject(r1);
608
+ }
609
+ return takeObject(r0);
610
+ } finally {
611
+ wasm.__wbindgen_add_to_stack_pointer(16);
612
+ }
613
+ }
614
+
615
+ /**
616
+ * HPKE-seal a `LinkingTicket` ([CR-3]). Pure function — does not need an initialized
617
+ * `PingClient`, so it's exported at module scope and the JS facade can call it from an
618
+ * ephemeral worker (no full client init needed on the sender side).
619
+ *
620
+ * `new_device_pub` must be 32 bytes. Returns CBOR-encoded sealed bytes.
621
+ * @param {any} ticket
622
+ * @param {Uint8Array} new_device_pub
623
+ * @returns {Uint8Array}
624
+ */
625
+ export function sealLinkingTicket(ticket, new_device_pub) {
626
+ try {
627
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
628
+ const ptr0 = passArray8ToWasm0(new_device_pub, wasm.__wbindgen_export);
629
+ const len0 = WASM_VECTOR_LEN;
630
+ wasm.sealLinkingTicket(retptr, addHeapObject(ticket), ptr0, len0);
631
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
632
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
633
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
634
+ if (r2) {
635
+ throw takeObject(r1);
636
+ }
637
+ return takeObject(r0);
638
+ } finally {
639
+ wasm.__wbindgen_add_to_stack_pointer(16);
640
+ }
641
+ }
642
+ function __wbg_get_imports() {
643
+ const import0 = {
644
+ __proto__: null,
645
+ __wbg_Deno_5568da40b5320910: function(arg0) {
646
+ const ret = getObject(arg0).Deno;
647
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
648
+ },
649
+ __wbg_Error_3639a60ed15f87e7: function(arg0, arg1) {
650
+ const ret = Error(getStringFromWasm0(arg0, arg1));
651
+ return addHeapObject(ret);
652
+ },
653
+ __wbg_Number_a3d737fd183f7dca: function(arg0) {
654
+ const ret = Number(getObject(arg0));
655
+ return ret;
656
+ },
657
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
658
+ const ret = String(getObject(arg1));
659
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
660
+ const len1 = WASM_VECTOR_LEN;
661
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
662
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
663
+ },
664
+ __wbg_String_9f1bc0c1cfdb8d71: function(arg0, arg1) {
665
+ const ret = String(getObject(arg1));
666
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
667
+ const len1 = WASM_VECTOR_LEN;
668
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
669
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
670
+ },
671
+ __wbg___wbg_test_output_writeln_ce1c14f3235de893: function(arg0) {
672
+ __wbg_test_output_writeln(takeObject(arg0));
673
+ },
674
+ __wbg___wbgtest_og_console_log_b41ebf420153741b: function(arg0, arg1) {
675
+ __wbgtest_og_console_log(getStringFromWasm0(arg0, arg1));
676
+ },
677
+ __wbg___wbindgen_bigint_get_as_i64_3af6d4ca77193a4b: function(arg0, arg1) {
678
+ const v = getObject(arg1);
679
+ const ret = typeof(v) === 'bigint' ? v : undefined;
680
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
681
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
682
+ },
683
+ __wbg___wbindgen_boolean_get_c3dd5c39f1b5a12b: function(arg0) {
684
+ const v = getObject(arg0);
685
+ const ret = typeof(v) === 'boolean' ? v : undefined;
686
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
687
+ },
688
+ __wbg___wbindgen_debug_string_07cb72cfcc952e2b: function(arg0, arg1) {
689
+ const ret = debugString(getObject(arg1));
690
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
691
+ const len1 = WASM_VECTOR_LEN;
692
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
693
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
694
+ },
695
+ __wbg___wbindgen_in_2617fa76397620d3: function(arg0, arg1) {
696
+ const ret = getObject(arg0) in getObject(arg1);
697
+ return ret;
698
+ },
699
+ __wbg___wbindgen_is_bigint_d6a8167cac401b95: function(arg0) {
700
+ const ret = typeof(getObject(arg0)) === 'bigint';
701
+ return ret;
702
+ },
703
+ __wbg___wbindgen_is_function_2f0fd7ceb86e64c5: function(arg0) {
704
+ const ret = typeof(getObject(arg0)) === 'function';
705
+ return ret;
706
+ },
707
+ __wbg___wbindgen_is_null_066086be3abe9bb3: function(arg0) {
708
+ const ret = getObject(arg0) === null;
709
+ return ret;
710
+ },
711
+ __wbg___wbindgen_is_object_5b22ff2418063a9c: function(arg0) {
712
+ const val = getObject(arg0);
713
+ const ret = typeof(val) === 'object' && val !== null;
714
+ return ret;
715
+ },
716
+ __wbg___wbindgen_is_string_eddc07a3efad52e6: function(arg0) {
717
+ const ret = typeof(getObject(arg0)) === 'string';
718
+ return ret;
719
+ },
720
+ __wbg___wbindgen_is_undefined_244a92c34d3b6ec0: function(arg0) {
721
+ const ret = getObject(arg0) === undefined;
722
+ return ret;
723
+ },
724
+ __wbg___wbindgen_jsval_eq_403eaa3610500a25: function(arg0, arg1) {
725
+ const ret = getObject(arg0) === getObject(arg1);
726
+ return ret;
727
+ },
728
+ __wbg___wbindgen_jsval_loose_eq_1978f1e77b4bce62: function(arg0, arg1) {
729
+ const ret = getObject(arg0) == getObject(arg1);
730
+ return ret;
731
+ },
732
+ __wbg___wbindgen_number_get_dd6d69a6079f26f1: function(arg0, arg1) {
733
+ const obj = getObject(arg1);
734
+ const ret = typeof(obj) === 'number' ? obj : undefined;
735
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
736
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
737
+ },
738
+ __wbg___wbindgen_string_get_965592073e5d848c: function(arg0, arg1) {
739
+ const obj = getObject(arg1);
740
+ const ret = typeof(obj) === 'string' ? obj : undefined;
741
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
742
+ var len1 = WASM_VECTOR_LEN;
743
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
744
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
745
+ },
746
+ __wbg___wbindgen_throw_9c75d47bf9e7731e: function(arg0, arg1) {
747
+ throw new Error(getStringFromWasm0(arg0, arg1));
748
+ },
749
+ __wbg__wbg_cb_unref_158e43e869788cdc: function(arg0) {
750
+ getObject(arg0)._wbg_cb_unref();
751
+ },
752
+ __wbg_call_a41d6421b30a32c5: function() { return handleError(function (arg0, arg1, arg2) {
753
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
754
+ return addHeapObject(ret);
755
+ }, arguments); },
756
+ __wbg_call_add9e5a76382e668: function() { return handleError(function (arg0, arg1) {
757
+ const ret = getObject(arg0).call(getObject(arg1));
758
+ return addHeapObject(ret);
759
+ }, arguments); },
760
+ __wbg_constructor_d15f058d68158e7a: function(arg0) {
761
+ const ret = getObject(arg0).constructor;
762
+ return addHeapObject(ret);
763
+ },
764
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
765
+ const ret = getObject(arg0).crypto;
766
+ return addHeapObject(ret);
767
+ },
768
+ __wbg_del_99e00f07d941c410: function(arg0, arg1, arg2, arg3, arg4) {
769
+ const ret = getObject(arg0).del(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
770
+ return addHeapObject(ret);
771
+ },
772
+ __wbg_discoverDevices_0a164c7016ed3ae1: function(arg0, arg1) {
773
+ const ret = getObject(arg0).discoverDevices(takeObject(arg1));
774
+ return addHeapObject(ret);
775
+ },
776
+ __wbg_done_b1afd6201ac045e0: function(arg0) {
777
+ const ret = getObject(arg0).done;
778
+ return ret;
779
+ },
780
+ __wbg_entries_bb9843ba73dc70d6: function(arg0) {
781
+ const ret = Object.entries(getObject(arg0));
782
+ return addHeapObject(ret);
783
+ },
784
+ __wbg_error_537f92d5f29e50f7: function(arg0, arg1) {
785
+ console.error(getStringFromWasm0(arg0, arg1));
786
+ },
787
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
788
+ let deferred0_0;
789
+ let deferred0_1;
790
+ try {
791
+ deferred0_0 = arg0;
792
+ deferred0_1 = arg1;
793
+ console.error(getStringFromWasm0(arg0, arg1));
794
+ } finally {
795
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
796
+ }
797
+ },
798
+ __wbg_fetchSince_918cc0023bdd145c: function(arg0, arg1, arg2, arg3) {
799
+ const ret = getObject(arg0).fetchSince(takeObject(arg1), takeObject(arg2), arg3 >>> 0);
800
+ return addHeapObject(ret);
801
+ },
802
+ __wbg_forEach_544291b320823e55: function(arg0, arg1, arg2) {
803
+ try {
804
+ var state0 = {a: arg1, b: arg2};
805
+ var cb0 = (arg0, arg1, arg2) => {
806
+ const a = state0.a;
807
+ state0.a = 0;
808
+ try {
809
+ return __wasm_bindgen_func_elem_2609(a, state0.b, arg0, arg1, arg2);
810
+ } finally {
811
+ state0.a = a;
812
+ }
813
+ };
814
+ getObject(arg0).forEach(cb0);
815
+ } finally {
816
+ state0.a = 0;
817
+ }
818
+ },
819
+ __wbg_from_ff141b1e4c69b979: function(arg0) {
820
+ const ret = Array.from(getObject(arg0));
821
+ return addHeapObject(ret);
822
+ },
823
+ __wbg_getElementById_ef2cf6fa058f410a: function(arg0, arg1, arg2) {
824
+ const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));
825
+ return addHeapObject(ret);
826
+ },
827
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
828
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
829
+ }, arguments); },
830
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
831
+ getObject(arg0).getRandomValues(getObject(arg1));
832
+ }, arguments); },
833
+ __wbg_get_652f640b3b0b6e3e: function(arg0, arg1) {
834
+ const ret = getObject(arg0)[arg1 >>> 0];
835
+ return addHeapObject(ret);
836
+ },
837
+ __wbg_get_9cfea9b7bbf12a15: function() { return handleError(function (arg0, arg1) {
838
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
839
+ return addHeapObject(ret);
840
+ }, arguments); },
841
+ __wbg_get_ef4ff25a244ef485: function(arg0, arg1, arg2, arg3, arg4) {
842
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
843
+ return addHeapObject(ret);
844
+ },
845
+ __wbg_get_unchecked_be562b1421656321: function(arg0, arg1) {
846
+ const ret = getObject(arg0)[arg1 >>> 0];
847
+ return addHeapObject(ret);
848
+ },
849
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
850
+ const ret = getObject(arg0)[getObject(arg1)];
851
+ return addHeapObject(ret);
852
+ },
853
+ __wbg_instanceof_ArrayBuffer_eab9f28fbec23477: function(arg0) {
854
+ let result;
855
+ try {
856
+ result = getObject(arg0) instanceof ArrayBuffer;
857
+ } catch (_) {
858
+ result = false;
859
+ }
860
+ const ret = result;
861
+ return ret;
862
+ },
863
+ __wbg_instanceof_Uint8Array_57d77acd50e4c44d: function(arg0) {
864
+ let result;
865
+ try {
866
+ result = getObject(arg0) instanceof Uint8Array;
867
+ } catch (_) {
868
+ result = false;
869
+ }
870
+ const ret = result;
871
+ return ret;
872
+ },
873
+ __wbg_isArray_c6c6ef8308995bcf: function(arg0) {
874
+ const ret = Array.isArray(getObject(arg0));
875
+ return ret;
876
+ },
877
+ __wbg_isSafeInteger_3c56c421a5b4cce4: function(arg0) {
878
+ const ret = Number.isSafeInteger(getObject(arg0));
879
+ return ret;
880
+ },
881
+ __wbg_iterator_9d68985a1d096fc2: function() {
882
+ const ret = Symbol.iterator;
883
+ return addHeapObject(ret);
884
+ },
885
+ __wbg_length_0a6ce016dc1460b0: function(arg0) {
886
+ const ret = getObject(arg0).length;
887
+ return ret;
888
+ },
889
+ __wbg_length_ba3c032602efe310: function(arg0) {
890
+ const ret = getObject(arg0).length;
891
+ return ret;
892
+ },
893
+ __wbg_listKeys_ce1ed9d08f2cd2a9: function(arg0, arg1, arg2, arg3, arg4) {
894
+ const ret = getObject(arg0).listKeys(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
895
+ return addHeapObject(ret);
896
+ },
897
+ __wbg_log_8d00d059d90f8f62: function(arg0, arg1) {
898
+ console.log(getStringFromWasm0(arg0, arg1));
899
+ },
900
+ __wbg_message_d5628ca19de920d3: function(arg0) {
901
+ const ret = getObject(arg0).message;
902
+ return addHeapObject(ret);
903
+ },
904
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
905
+ const ret = getObject(arg0).msCrypto;
906
+ return addHeapObject(ret);
907
+ },
908
+ __wbg_name_bf92195f4668ab6e: function(arg0) {
909
+ const ret = getObject(arg0).name;
910
+ return addHeapObject(ret);
911
+ },
912
+ __wbg_name_e75d30c26e8dc6aa: function(arg0, arg1) {
913
+ const ret = getObject(arg1).name;
914
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
915
+ const len1 = WASM_VECTOR_LEN;
916
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
917
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
918
+ },
919
+ __wbg_new_227d7c05414eb861: function() {
920
+ const ret = new Error();
921
+ return addHeapObject(ret);
922
+ },
923
+ __wbg_new_2fad8ca02fd00684: function() {
924
+ const ret = new Object();
925
+ return addHeapObject(ret);
926
+ },
927
+ __wbg_new_3baa8d9866155c79: function() {
928
+ const ret = new Array();
929
+ return addHeapObject(ret);
930
+ },
931
+ __wbg_new_5aafc1bf3ffe858c: function() {
932
+ const ret = new Error();
933
+ return addHeapObject(ret);
934
+ },
935
+ __wbg_new_8454eee672b2ba6e: function(arg0) {
936
+ const ret = new Uint8Array(getObject(arg0));
937
+ return addHeapObject(ret);
938
+ },
939
+ __wbg_new_from_slice_5a173c243af2e823: function(arg0, arg1) {
940
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
941
+ return addHeapObject(ret);
942
+ },
943
+ __wbg_new_typed_1137602701dc87d4: function(arg0, arg1) {
944
+ try {
945
+ var state0 = {a: arg0, b: arg1};
946
+ var cb0 = (arg0, arg1) => {
947
+ const a = state0.a;
948
+ state0.a = 0;
949
+ try {
950
+ return __wasm_bindgen_func_elem_2608(a, state0.b, arg0, arg1);
951
+ } finally {
952
+ state0.a = a;
953
+ }
954
+ };
955
+ const ret = new Promise(cb0);
956
+ return addHeapObject(ret);
957
+ } finally {
958
+ state0.a = 0;
959
+ }
960
+ },
961
+ __wbg_new_with_length_9011f5da794bf5d9: function(arg0) {
962
+ const ret = new Uint8Array(arg0 >>> 0);
963
+ return addHeapObject(ret);
964
+ },
965
+ __wbg_next_261c3c48c6e309a5: function(arg0) {
966
+ const ret = getObject(arg0).next;
967
+ return addHeapObject(ret);
968
+ },
969
+ __wbg_next_aacee310bcfe6461: function() { return handleError(function (arg0) {
970
+ const ret = getObject(arg0).next();
971
+ return addHeapObject(ret);
972
+ }, arguments); },
973
+ __wbg_node_84ea875411254db1: function(arg0) {
974
+ const ret = getObject(arg0).node;
975
+ return addHeapObject(ret);
976
+ },
977
+ __wbg_now_4f457f10f864aec5: function() {
978
+ const ret = Date.now();
979
+ return ret;
980
+ },
981
+ __wbg_now_e627993f858511c9: function(arg0) {
982
+ const ret = getObject(arg0).now();
983
+ return ret;
984
+ },
985
+ __wbg_performance_3550bf29533f0eae: function(arg0) {
986
+ const ret = getObject(arg0).performance;
987
+ return addHeapObject(ret);
988
+ },
989
+ __wbg_pingclient_new: function(arg0) {
990
+ const ret = PingClient.__wrap(arg0);
991
+ return addHeapObject(ret);
992
+ },
993
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
994
+ const ret = getObject(arg0).process;
995
+ return addHeapObject(ret);
996
+ },
997
+ __wbg_prototypesetcall_fd4050e806e1d519: function(arg0, arg1, arg2) {
998
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
999
+ },
1000
+ __wbg_put_b8e780bed1594753: function(arg0, arg1, arg2, arg3, arg4, arg5) {
1001
+ const ret = getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), takeObject(arg5));
1002
+ return addHeapObject(ret);
1003
+ },
1004
+ __wbg_queueMicrotask_40ac6ffc2848ba77: function(arg0) {
1005
+ queueMicrotask(getObject(arg0));
1006
+ },
1007
+ __wbg_queueMicrotask_74d092439f6494c1: function(arg0) {
1008
+ const ret = getObject(arg0).queueMicrotask;
1009
+ return addHeapObject(ret);
1010
+ },
1011
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
1012
+ getObject(arg0).randomFillSync(takeObject(arg1));
1013
+ }, arguments); },
1014
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
1015
+ const ret = module.require;
1016
+ return addHeapObject(ret);
1017
+ }, arguments); },
1018
+ __wbg_resolve_9feb5d906ca62419: function(arg0) {
1019
+ const ret = Promise.resolve(getObject(arg0));
1020
+ return addHeapObject(ret);
1021
+ },
1022
+ __wbg_self_fbd35b4e1b417b7c: function(arg0) {
1023
+ const ret = getObject(arg0).self;
1024
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1025
+ },
1026
+ __wbg_send_7bdc7805d6aca500: function(arg0, arg1) {
1027
+ const ret = getObject(arg0).send(takeObject(arg1));
1028
+ return addHeapObject(ret);
1029
+ },
1030
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1031
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1032
+ },
1033
+ __wbg_set_f614f6a0608d1d1d: function(arg0, arg1, arg2) {
1034
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1035
+ },
1036
+ __wbg_set_text_content_63c250954481807a: function(arg0, arg1, arg2) {
1037
+ getObject(arg0).textContent = getStringFromWasm0(arg1, arg2);
1038
+ },
1039
+ __wbg_stack_18dcc55b1429bfed: function(arg0, arg1) {
1040
+ const ret = getObject(arg1).stack;
1041
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1042
+ var len1 = WASM_VECTOR_LEN;
1043
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1044
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1045
+ },
1046
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1047
+ const ret = getObject(arg1).stack;
1048
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1049
+ const len1 = WASM_VECTOR_LEN;
1050
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1051
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1052
+ },
1053
+ __wbg_stack_5b90bbbb003d7e5c: function(arg0, arg1) {
1054
+ const ret = getObject(arg1).stack;
1055
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1056
+ const len1 = WASM_VECTOR_LEN;
1057
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1058
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1059
+ },
1060
+ __wbg_stack_5f3026c9cb27e9a3: function(arg0) {
1061
+ const ret = getObject(arg0).stack;
1062
+ return addHeapObject(ret);
1063
+ },
1064
+ __wbg_stack_e914725ec1a4a021: function(arg0) {
1065
+ const ret = getObject(arg0).stack;
1066
+ return addHeapObject(ret);
1067
+ },
1068
+ __wbg_static_accessor_DOCUMENT_fa300f5b84193774: function() {
1069
+ const ret = document;
1070
+ return addHeapObject(ret);
1071
+ },
1072
+ __wbg_static_accessor_GLOBAL_THIS_1c7f1bd6c6941fdb: function() {
1073
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1074
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1075
+ },
1076
+ __wbg_static_accessor_GLOBAL_e039bc914f83e74e: function() {
1077
+ const ret = typeof global === 'undefined' ? null : global;
1078
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1079
+ },
1080
+ __wbg_static_accessor_SELF_8bf8c48c28420ad5: function() {
1081
+ const ret = typeof self === 'undefined' ? null : self;
1082
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1083
+ },
1084
+ __wbg_static_accessor_WINDOW_6aeee9b51652ee0f: function() {
1085
+ const ret = typeof window === 'undefined' ? null : window;
1086
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1087
+ },
1088
+ __wbg_subarray_fbe3cef290e1fa43: function(arg0, arg1, arg2) {
1089
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1090
+ return addHeapObject(ret);
1091
+ },
1092
+ __wbg_text_content_39133fe2ceeea2bf: function(arg0, arg1) {
1093
+ const ret = getObject(arg1).textContent;
1094
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1095
+ const len1 = WASM_VECTOR_LEN;
1096
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1097
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1098
+ },
1099
+ __wbg_then_20a157d939b514f5: function(arg0, arg1) {
1100
+ const ret = getObject(arg0).then(getObject(arg1));
1101
+ return addHeapObject(ret);
1102
+ },
1103
+ __wbg_then_5ef9b762bc91555c: function(arg0, arg1, arg2) {
1104
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1105
+ return addHeapObject(ret);
1106
+ },
1107
+ __wbg_toString_90f2e8a87f5b736e: function() { return handleError(function (arg0, arg1) {
1108
+ const ret = getObject(arg1).toString();
1109
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1110
+ const len1 = WASM_VECTOR_LEN;
1111
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1112
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1113
+ }, arguments); },
1114
+ __wbg_value_f852716acdeb3e82: function(arg0) {
1115
+ const ret = getObject(arg0).value;
1116
+ return addHeapObject(ret);
1117
+ },
1118
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
1119
+ const ret = getObject(arg0).versions;
1120
+ return addHeapObject(ret);
1121
+ },
1122
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1123
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 722, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1124
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2599);
1125
+ return addHeapObject(ret);
1126
+ },
1127
+ __wbindgen_cast_0000000000000002: function(arg0) {
1128
+ // Cast intrinsic for `F64 -> Externref`.
1129
+ const ret = arg0;
1130
+ return addHeapObject(ret);
1131
+ },
1132
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1133
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1134
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1135
+ return addHeapObject(ret);
1136
+ },
1137
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1138
+ // Cast intrinsic for `Ref(String) -> Externref`.
1139
+ const ret = getStringFromWasm0(arg0, arg1);
1140
+ return addHeapObject(ret);
1141
+ },
1142
+ __wbindgen_cast_0000000000000005: function(arg0) {
1143
+ // Cast intrinsic for `U64 -> Externref`.
1144
+ const ret = BigInt.asUintN(64, arg0);
1145
+ return addHeapObject(ret);
1146
+ },
1147
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
1148
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1149
+ wasm.__wbindgen_export4(arg0, arg1 * 1, 1);
1150
+ // Cast intrinsic for `Vector(U8) -> Externref`.
1151
+ const ret = v0;
1152
+ return addHeapObject(ret);
1153
+ },
1154
+ __wbindgen_object_clone_ref: function(arg0) {
1155
+ const ret = getObject(arg0);
1156
+ return addHeapObject(ret);
1157
+ },
1158
+ __wbindgen_object_drop_ref: function(arg0) {
1159
+ takeObject(arg0);
1160
+ },
1161
+ };
1162
+ return {
1163
+ __proto__: null,
1164
+ "./ping_wasm_bg.js": import0,
1165
+ };
1166
+ }
1167
+
1168
+ function __wasm_bindgen_func_elem_2599(arg0, arg1, arg2) {
1169
+ try {
1170
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1171
+ wasm.__wasm_bindgen_func_elem_2599(retptr, arg0, arg1, addHeapObject(arg2));
1172
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1173
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1174
+ if (r1) {
1175
+ throw takeObject(r0);
1176
+ }
1177
+ } finally {
1178
+ wasm.__wbindgen_add_to_stack_pointer(16);
1179
+ }
1180
+ }
1181
+
1182
+ function __wasm_bindgen_func_elem_2608(arg0, arg1, arg2, arg3) {
1183
+ wasm.__wasm_bindgen_func_elem_2608(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1184
+ }
1185
+
1186
+ function __wasm_bindgen_func_elem_2609(arg0, arg1, arg2, arg3, arg4) {
1187
+ wasm.__wasm_bindgen_func_elem_2609(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
1188
+ }
1189
+
1190
+ const WasmBindgenTestContextFinalization = (typeof FinalizationRegistry === 'undefined')
1191
+ ? { register: () => {}, unregister: () => {} }
1192
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbindgentestcontext_free(ptr, 1));
1193
+ const PingClientFinalization = (typeof FinalizationRegistry === 'undefined')
1194
+ ? { register: () => {}, unregister: () => {} }
1195
+ : new FinalizationRegistry(ptr => wasm.__wbg_pingclient_free(ptr, 1));
1196
+
1197
+ function addHeapObject(obj) {
1198
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1199
+ const idx = heap_next;
1200
+ heap_next = heap[idx];
1201
+
1202
+ heap[idx] = obj;
1203
+ return idx;
1204
+ }
1205
+
1206
+ function addBorrowedObject(obj) {
1207
+ if (stack_pointer == 1) throw new Error('out of js stack');
1208
+ heap[--stack_pointer] = obj;
1209
+ return stack_pointer;
1210
+ }
1211
+
1212
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1213
+ ? { register: () => {}, unregister: () => {} }
1214
+ : new FinalizationRegistry(state => wasm.__wbindgen_export5(state.a, state.b));
1215
+
1216
+ function debugString(val) {
1217
+ // primitive types
1218
+ const type = typeof val;
1219
+ if (type == 'number' || type == 'boolean' || val == null) {
1220
+ return `${val}`;
1221
+ }
1222
+ if (type == 'string') {
1223
+ return `"${val}"`;
1224
+ }
1225
+ if (type == 'symbol') {
1226
+ const description = val.description;
1227
+ if (description == null) {
1228
+ return 'Symbol';
1229
+ } else {
1230
+ return `Symbol(${description})`;
1231
+ }
1232
+ }
1233
+ if (type == 'function') {
1234
+ const name = val.name;
1235
+ if (typeof name == 'string' && name.length > 0) {
1236
+ return `Function(${name})`;
1237
+ } else {
1238
+ return 'Function';
1239
+ }
1240
+ }
1241
+ // objects
1242
+ if (Array.isArray(val)) {
1243
+ const length = val.length;
1244
+ let debug = '[';
1245
+ if (length > 0) {
1246
+ debug += debugString(val[0]);
1247
+ }
1248
+ for(let i = 1; i < length; i++) {
1249
+ debug += ', ' + debugString(val[i]);
1250
+ }
1251
+ debug += ']';
1252
+ return debug;
1253
+ }
1254
+ // Test for built-in
1255
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1256
+ let className;
1257
+ if (builtInMatches && builtInMatches.length > 1) {
1258
+ className = builtInMatches[1];
1259
+ } else {
1260
+ // Failed to match the standard '[object ClassName]'
1261
+ return toString.call(val);
1262
+ }
1263
+ if (className == 'Object') {
1264
+ // we're a user defined class or Object
1265
+ // JSON.stringify avoids problems with cycles, and is generally much
1266
+ // easier than looping through ownProperties of `val`.
1267
+ try {
1268
+ return 'Object(' + JSON.stringify(val) + ')';
1269
+ } catch (_) {
1270
+ return 'Object';
1271
+ }
1272
+ }
1273
+ // errors
1274
+ if (val instanceof Error) {
1275
+ return `${val.name}: ${val.message}\n${val.stack}`;
1276
+ }
1277
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1278
+ return className;
1279
+ }
1280
+
1281
+ function dropObject(idx) {
1282
+ if (idx < 1028) return;
1283
+ heap[idx] = heap_next;
1284
+ heap_next = idx;
1285
+ }
1286
+
1287
+ function getArrayU8FromWasm0(ptr, len) {
1288
+ ptr = ptr >>> 0;
1289
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1290
+ }
1291
+
1292
+ let cachedDataViewMemory0 = null;
1293
+ function getDataViewMemory0() {
1294
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1295
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1296
+ }
1297
+ return cachedDataViewMemory0;
1298
+ }
1299
+
1300
+ function getStringFromWasm0(ptr, len) {
1301
+ return decodeText(ptr >>> 0, len);
1302
+ }
1303
+
1304
+ let cachedUint32ArrayMemory0 = null;
1305
+ function getUint32ArrayMemory0() {
1306
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1307
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1308
+ }
1309
+ return cachedUint32ArrayMemory0;
1310
+ }
1311
+
1312
+ let cachedUint8ArrayMemory0 = null;
1313
+ function getUint8ArrayMemory0() {
1314
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1315
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1316
+ }
1317
+ return cachedUint8ArrayMemory0;
1318
+ }
1319
+
1320
+ function getObject(idx) { return heap[idx]; }
1321
+
1322
+ function handleError(f, args) {
1323
+ try {
1324
+ return f.apply(this, args);
1325
+ } catch (e) {
1326
+ wasm.__wbindgen_export3(addHeapObject(e));
1327
+ }
1328
+ }
1329
+
1330
+ let heap = new Array(1024).fill(undefined);
1331
+ heap.push(undefined, null, true, false);
1332
+
1333
+ let heap_next = heap.length;
1334
+
1335
+ function isLikeNone(x) {
1336
+ return x === undefined || x === null;
1337
+ }
1338
+
1339
+ function makeMutClosure(arg0, arg1, f) {
1340
+ const state = { a: arg0, b: arg1, cnt: 1 };
1341
+ const real = (...args) => {
1342
+
1343
+ // First up with a closure we increment the internal reference
1344
+ // count. This ensures that the Rust closure environment won't
1345
+ // be deallocated while we're invoking it.
1346
+ state.cnt++;
1347
+ const a = state.a;
1348
+ state.a = 0;
1349
+ try {
1350
+ return f(a, state.b, ...args);
1351
+ } finally {
1352
+ state.a = a;
1353
+ real._wbg_cb_unref();
1354
+ }
1355
+ };
1356
+ real._wbg_cb_unref = () => {
1357
+ if (--state.cnt === 0) {
1358
+ wasm.__wbindgen_export5(state.a, state.b);
1359
+ state.a = 0;
1360
+ CLOSURE_DTORS.unregister(state);
1361
+ }
1362
+ };
1363
+ CLOSURE_DTORS.register(real, state, state);
1364
+ return real;
1365
+ }
1366
+
1367
+ function passArray32ToWasm0(arg, malloc) {
1368
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1369
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1370
+ WASM_VECTOR_LEN = arg.length;
1371
+ return ptr;
1372
+ }
1373
+
1374
+ function passArray8ToWasm0(arg, malloc) {
1375
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1376
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1377
+ WASM_VECTOR_LEN = arg.length;
1378
+ return ptr;
1379
+ }
1380
+
1381
+ function passArrayJsValueToWasm0(array, malloc) {
1382
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1383
+ const mem = getDataViewMemory0();
1384
+ for (let i = 0; i < array.length; i++) {
1385
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
1386
+ }
1387
+ WASM_VECTOR_LEN = array.length;
1388
+ return ptr;
1389
+ }
1390
+
1391
+ function passStringToWasm0(arg, malloc, realloc) {
1392
+ if (realloc === undefined) {
1393
+ const buf = cachedTextEncoder.encode(arg);
1394
+ const ptr = malloc(buf.length, 1) >>> 0;
1395
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1396
+ WASM_VECTOR_LEN = buf.length;
1397
+ return ptr;
1398
+ }
1399
+
1400
+ let len = arg.length;
1401
+ let ptr = malloc(len, 1) >>> 0;
1402
+
1403
+ const mem = getUint8ArrayMemory0();
1404
+
1405
+ let offset = 0;
1406
+
1407
+ for (; offset < len; offset++) {
1408
+ const code = arg.charCodeAt(offset);
1409
+ if (code > 0x7F) break;
1410
+ mem[ptr + offset] = code;
1411
+ }
1412
+ if (offset !== len) {
1413
+ if (offset !== 0) {
1414
+ arg = arg.slice(offset);
1415
+ }
1416
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1417
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1418
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1419
+
1420
+ offset += ret.written;
1421
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1422
+ }
1423
+
1424
+ WASM_VECTOR_LEN = offset;
1425
+ return ptr;
1426
+ }
1427
+
1428
+ let stack_pointer = 1024;
1429
+
1430
+ function takeObject(idx) {
1431
+ const ret = getObject(idx);
1432
+ dropObject(idx);
1433
+ return ret;
1434
+ }
1435
+
1436
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1437
+ cachedTextDecoder.decode();
1438
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1439
+ let numBytesDecoded = 0;
1440
+ function decodeText(ptr, len) {
1441
+ numBytesDecoded += len;
1442
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1443
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1444
+ cachedTextDecoder.decode();
1445
+ numBytesDecoded = len;
1446
+ }
1447
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1448
+ }
1449
+
1450
+ const cachedTextEncoder = new TextEncoder();
1451
+
1452
+ if (!('encodeInto' in cachedTextEncoder)) {
1453
+ cachedTextEncoder.encodeInto = function (arg, view) {
1454
+ const buf = cachedTextEncoder.encode(arg);
1455
+ view.set(buf);
1456
+ return {
1457
+ read: arg.length,
1458
+ written: buf.length
1459
+ };
1460
+ };
1461
+ }
1462
+
1463
+ let WASM_VECTOR_LEN = 0;
1464
+
1465
+ let wasmModule, wasmInstance, wasm;
1466
+ function __wbg_finalize_init(instance, module) {
1467
+ wasmInstance = instance;
1468
+ wasm = instance.exports;
1469
+ wasmModule = module;
1470
+ cachedDataViewMemory0 = null;
1471
+ cachedUint32ArrayMemory0 = null;
1472
+ cachedUint8ArrayMemory0 = null;
1473
+ wasm.__wbindgen_start();
1474
+ return wasm;
1475
+ }
1476
+
1477
+ async function __wbg_load(module, imports) {
1478
+ if (typeof Response === 'function' && module instanceof Response) {
1479
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1480
+ try {
1481
+ return await WebAssembly.instantiateStreaming(module, imports);
1482
+ } catch (e) {
1483
+ const validResponse = module.ok && expectedResponseType(module.type);
1484
+
1485
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1486
+ 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);
1487
+
1488
+ } else { throw e; }
1489
+ }
1490
+ }
1491
+
1492
+ const bytes = await module.arrayBuffer();
1493
+ return await WebAssembly.instantiate(bytes, imports);
1494
+ } else {
1495
+ const instance = await WebAssembly.instantiate(module, imports);
1496
+
1497
+ if (instance instanceof WebAssembly.Instance) {
1498
+ return { instance, module };
1499
+ } else {
1500
+ return instance;
1501
+ }
1502
+ }
1503
+
1504
+ function expectedResponseType(type) {
1505
+ switch (type) {
1506
+ case 'basic': case 'cors': case 'default': return true;
1507
+ }
1508
+ return false;
1509
+ }
1510
+ }
1511
+
1512
+ function initSync(module) {
1513
+ if (wasm !== undefined) return wasm;
1514
+
1515
+
1516
+ if (module !== undefined) {
1517
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1518
+ ({module} = module)
1519
+ } else {
1520
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1521
+ }
1522
+ }
1523
+
1524
+ const imports = __wbg_get_imports();
1525
+ if (!(module instanceof WebAssembly.Module)) {
1526
+ module = new WebAssembly.Module(module);
1527
+ }
1528
+ const instance = new WebAssembly.Instance(module, imports);
1529
+ return __wbg_finalize_init(instance, module);
1530
+ }
1531
+
1532
+ async function __wbg_init(module_or_path) {
1533
+ if (wasm !== undefined) return wasm;
1534
+
1535
+
1536
+ if (module_or_path !== undefined) {
1537
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1538
+ ({module_or_path} = module_or_path)
1539
+ } else {
1540
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1541
+ }
1542
+ }
1543
+
1544
+ if (module_or_path === undefined) {
1545
+ module_or_path = new URL('ping_wasm_bg.wasm', import.meta.url);
1546
+ }
1547
+ const imports = __wbg_get_imports();
1548
+
1549
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1550
+ module_or_path = fetch(module_or_path);
1551
+ }
1552
+
1553
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1554
+
1555
+ return __wbg_finalize_init(instance, module);
1556
+ }
1557
+
1558
+ export { initSync, __wbg_init as default };