@jetpack-desktop/client 0.0.0-stage → 0.1.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1387 @@
1
+ /* @ts-self-types="./jetpack_wasm.d.ts" */
2
+
3
+ /**
4
+ * High-level WebAssembly client for interacting with the JetPack daemon.
5
+ */
6
+ export class JetPackWasmClient {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(JetPackWasmClient.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ JetPackWasmClientFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ JetPackWasmClientFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_jetpackwasmclient_free(ptr, 0);
22
+ }
23
+ /**
24
+ * Triggers a daemon self-update from the embedded Control Center, streaming
25
+ * `UpdateProgressFrame` events into `on_progress_callback` and resolving on
26
+ * `UpdateRestartingResponse` right before the daemon swaps binaries and restarts.
27
+ * @param {Function | null} [on_progress_callback]
28
+ * @param {string | null} [expected_version]
29
+ * @returns {Promise<any>}
30
+ */
31
+ apply_update(on_progress_callback, expected_version) {
32
+ var ptr0 = isLikeNone(expected_version) ? 0 : passStringToWasm0(expected_version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
33
+ var len0 = WASM_VECTOR_LEN;
34
+ const ret = wasm.jetpackwasmclient_apply_update(this.__wbg_ptr, isLikeNone(on_progress_callback) ? 0 : addToExternrefTable0(on_progress_callback), ptr0, len0);
35
+ return ret;
36
+ }
37
+ /**
38
+ * Queries the daemon for the latest available release (`UpdateStatusResponse`).
39
+ * @returns {Promise<any>}
40
+ */
41
+ check_for_updates() {
42
+ const ret = wasm.jetpackwasmclient_check_for_updates(this.__wbg_ptr);
43
+ return ret;
44
+ }
45
+ /**
46
+ * Clears application-private cache/settings and resets saved folder bindings without
47
+ * deleting user files inside mounted host directories (`"app.cache.clear"`).
48
+ * @param {string} app_id
49
+ * @returns {Promise<any>}
50
+ */
51
+ clear_app_cache(app_id) {
52
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
53
+ const len0 = WASM_VECTOR_LEN;
54
+ const ret = wasm.jetpackwasmclient_clear_app_cache(this.__wbg_ptr, ptr0, len0);
55
+ return ret;
56
+ }
57
+ /**
58
+ * Closes the client WebSocket connection and cleans up session state.
59
+ */
60
+ close() {
61
+ wasm.jetpackwasmclient_close(this.__wbg_ptr);
62
+ }
63
+ /**
64
+ * Connects to `ws://127.0.0.1:<port>` and automatically executes the cryptographic handshake.
65
+ *
66
+ * Resolves when the session is established and authenticated.
67
+ * @param {string} ws_url
68
+ * @param {WasmClientIdentity} identity
69
+ * @param {string | null} [origin]
70
+ * @returns {Promise<any>}
71
+ */
72
+ static connect(ws_url, identity, origin) {
73
+ _assertClass(identity, WasmClientIdentity);
74
+ let ptr0, len0, ptr1, len1;
75
+ try {
76
+ ptr0 = passStringToWasm0(ws_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
77
+ len0 = WASM_VECTOR_LEN;
78
+ ptr1 = isLikeNone(origin) ? 0 : passStringToWasm0(origin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
79
+ len1 = WASM_VECTOR_LEN;
80
+ } catch (e) {
81
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
82
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
83
+ throw e;
84
+ }
85
+ const ret = wasm.jetpackwasmclient_connect(ptr0, len0, identity.__wbg_ptr, ptr1, len1);
86
+ return ret;
87
+ }
88
+ /**
89
+ * Exports a privacy-sanitized `.zip` diagnostic bundle from the daemon
90
+ * (`{ filename, generated_at_unix, log_tail_bytes, log_truncated, redactions_applied, zip_bytes }`).
91
+ * @returns {Promise<any>}
92
+ */
93
+ export_diagnostics() {
94
+ const ret = wasm.jetpackwasmclient_export_diagnostics(this.__wbg_ptr);
95
+ return ret;
96
+ }
97
+ /**
98
+ * Retrieves verified App Store catalog entries (`CatalogAppEntry[]`).
99
+ * @returns {Promise<any>}
100
+ */
101
+ get_catalog() {
102
+ const ret = wasm.jetpackwasmclient_get_catalog(this.__wbg_ptr);
103
+ return ret;
104
+ }
105
+ /**
106
+ * Retrieves the host hardware and accelerator topology (`HardwareProfile`).
107
+ * @returns {Promise<any>}
108
+ */
109
+ get_hardware_profile() {
110
+ const ret = wasm.jetpackwasmclient_get_hardware_profile(this.__wbg_ptr);
111
+ return ret;
112
+ }
113
+ /**
114
+ * Fetches persisted daemon security settings (`DaemonSettings`).
115
+ * @returns {Promise<any>}
116
+ */
117
+ get_settings() {
118
+ const ret = wasm.jetpackwasmclient_get_settings(this.__wbg_ptr);
119
+ return ret;
120
+ }
121
+ /**
122
+ * Indicates whether the client is in the established authenticated state.
123
+ * @returns {boolean}
124
+ */
125
+ is_connected() {
126
+ const ret = wasm.jetpackwasmclient_is_connected(this.__wbg_ptr);
127
+ return ret !== 0;
128
+ }
129
+ /**
130
+ * Boots an installed application inside an OS kernel sandbox, streaming optional
131
+ * `app.launch.progress` provisioning/startup events to `on_progress_callback`.
132
+ * @param {string} app_id
133
+ * @param {boolean | null} [reset_volumes]
134
+ * @param {Function | null} [on_progress_callback]
135
+ * @returns {Promise<any>}
136
+ */
137
+ launch_app(app_id, reset_volumes, on_progress_callback) {
138
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
139
+ const len0 = WASM_VECTOR_LEN;
140
+ const ret = wasm.jetpackwasmclient_launch_app(this.__wbg_ptr, ptr0, len0, isLikeNone(reset_volumes) ? 0xFFFFFF : reset_volumes ? 1 : 0, isLikeNone(on_progress_callback) ? 0 : addToExternrefTable0(on_progress_callback));
141
+ return ret;
142
+ }
143
+ /**
144
+ * Lists installed applications and their runtime statuses (`AppInfo[]`).
145
+ * @returns {Promise<any>}
146
+ */
147
+ list_apps() {
148
+ const ret = wasm.jetpackwasmclient_list_apps(this.__wbg_ptr);
149
+ return ret;
150
+ }
151
+ /**
152
+ * Lists paired browser/origin clients stored in the daemon (`PairedClientSummary[]`).
153
+ * @returns {Promise<any>}
154
+ */
155
+ list_paired_clients() {
156
+ const ret = wasm.jetpackwasmclient_list_paired_clients(this.__wbg_ptr);
157
+ return ret;
158
+ }
159
+ /**
160
+ * Registers a callback for incoming worker or unsolicited streaming events.
161
+ *
162
+ * Invokes `callback(opcode, payload, correlationId)`. Existing 2-argument
163
+ * callbacks `(opcode, payload)` remain fully backwards compatible.
164
+ * @param {Function} callback
165
+ */
166
+ on_worker_frame(callback) {
167
+ wasm.jetpackwasmclient_on_worker_frame(this.__wbg_ptr, callback);
168
+ }
169
+ /**
170
+ * Registers a callback invoked when the daemon emits `"app.worker.stopped"`
171
+ * (`{ app_id, job_id, reason }`), e.g. on idle timeout, manual Stop, or worker crash.
172
+ * @param {Function} callback
173
+ */
174
+ on_worker_stopped(callback) {
175
+ wasm.jetpackwasmclient_on_worker_stopped(this.__wbg_ptr, callback);
176
+ }
177
+ /**
178
+ * Requests `jetpack-daemon` to open an authorized loopback URL honoring `open_in_app_window`.
179
+ * @param {string} url
180
+ * @returns {Promise<any>}
181
+ */
182
+ open_url(url) {
183
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
184
+ const len0 = WASM_VECTOR_LEN;
185
+ const ret = wasm.jetpackwasmclient_open_url(this.__wbg_ptr, ptr0, len0);
186
+ return ret;
187
+ }
188
+ /**
189
+ * Opens the daemon's native OS folder picker on the main thread and persists `appdata_dir`.
190
+ * @returns {Promise<any>}
191
+ */
192
+ pick_appdata_dir() {
193
+ const ret = wasm.jetpackwasmclient_pick_appdata_dir(this.__wbg_ptr);
194
+ return ret;
195
+ }
196
+ /**
197
+ * Downloads and provisions a verified OCI application artifact, streaming progress notifications.
198
+ * @param {string} image_ref
199
+ * @param {Function | null} [on_progress_callback]
200
+ * @param {string | null} [app_id]
201
+ * @returns {Promise<any>}
202
+ */
203
+ pull_app(image_ref, on_progress_callback, app_id) {
204
+ let ptr0, len0, ptr1, len1;
205
+ try {
206
+ ptr0 = passStringToWasm0(image_ref, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
207
+ len0 = WASM_VECTOR_LEN;
208
+ ptr1 = isLikeNone(app_id) ? 0 : passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ len1 = WASM_VECTOR_LEN;
210
+ } catch (e) {
211
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
212
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
213
+ throw e;
214
+ }
215
+ const ret = wasm.jetpackwasmclient_pull_app(this.__wbg_ptr, ptr0, len0, isLikeNone(on_progress_callback) ? 0 : addToExternrefTable0(on_progress_callback), ptr1, len1);
216
+ return ret;
217
+ }
218
+ /**
219
+ * Sends a correlated zero-copy binary hybrid frame to `target_worker` and awaits
220
+ * the matching response frame (`{ opcode, payload, correlationId }`).
221
+ *
222
+ * Rejects if the daemon/worker responds with `app.error` or `system.error`,
223
+ * or if the WebSocket closes before a response arrives.
224
+ * @param {string} target_worker
225
+ * @param {string} opcode
226
+ * @param {any} meta_js
227
+ * @param {Uint8Array} raw_payload
228
+ * @returns {Promise<any>}
229
+ */
230
+ request_worker_frame(target_worker, opcode, meta_js, raw_payload) {
231
+ let ptr0, len0, ptr1, len1;
232
+ try {
233
+ ptr0 = passStringToWasm0(target_worker, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
234
+ len0 = WASM_VECTOR_LEN;
235
+ ptr1 = passStringToWasm0(opcode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ len1 = WASM_VECTOR_LEN;
237
+ } catch (e) {
238
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
239
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
240
+ throw e;
241
+ }
242
+ const ret = wasm.jetpackwasmclient_request_worker_frame(this.__wbg_ptr, ptr0, len0, ptr1, len1, meta_js, raw_payload);
243
+ return ret;
244
+ }
245
+ /**
246
+ * Resets persisted authorized host volumes for an application via `"app.volumes.reset"`.
247
+ * @param {string} app_id
248
+ * @param {string | null} [volume_name]
249
+ * @returns {Promise<any>}
250
+ */
251
+ reset_app_volumes(app_id, volume_name) {
252
+ let ptr0, len0, ptr1, len1;
253
+ try {
254
+ ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
255
+ len0 = WASM_VECTOR_LEN;
256
+ ptr1 = isLikeNone(volume_name) ? 0 : passStringToWasm0(volume_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
+ len1 = WASM_VECTOR_LEN;
258
+ } catch (e) {
259
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
260
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
261
+ throw e;
262
+ }
263
+ const ret = wasm.jetpackwasmclient_reset_app_volumes(this.__wbg_ptr, ptr0, len0, ptr1, len1);
264
+ return ret;
265
+ }
266
+ /**
267
+ * Resets the persisted `appdata_dir` setting back to the default `<root>/appdata` folder.
268
+ * @returns {Promise<any>}
269
+ */
270
+ reset_appdata_dir() {
271
+ const ret = wasm.jetpackwasmclient_reset_appdata_dir(this.__wbg_ptr);
272
+ return ret;
273
+ }
274
+ /**
275
+ * Revokes access for a paired client UUID and/or origin and severs active sessions.
276
+ * @param {string | null} [client_id]
277
+ * @param {string | null} [origin]
278
+ * @returns {Promise<any>}
279
+ */
280
+ revoke_client(client_id, origin) {
281
+ let ptr0, len0, ptr1, len1;
282
+ try {
283
+ ptr0 = isLikeNone(client_id) ? 0 : passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
+ len0 = WASM_VECTOR_LEN;
285
+ ptr1 = isLikeNone(origin) ? 0 : passStringToWasm0(origin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
286
+ len1 = WASM_VECTOR_LEN;
287
+ } catch (e) {
288
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
289
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
290
+ throw e;
291
+ }
292
+ const ret = wasm.jetpackwasmclient_revoke_client(this.__wbg_ptr, ptr0, len0, ptr1, len1);
293
+ return ret;
294
+ }
295
+ /**
296
+ * Requests the daemon to transmit a sanitized diagnostic report JSON to its configured
297
+ * `[diagnostics] report_url` HTTP endpoint (`DiagnosticsSendOkResponse`).
298
+ * @returns {Promise<any>}
299
+ */
300
+ send_diagnostics() {
301
+ const ret = wasm.jetpackwasmclient_send_diagnostics(this.__wbg_ptr);
302
+ return ret;
303
+ }
304
+ /**
305
+ * Dispatches a zero-copy binary hybrid frame directly to a target worker service.
306
+ * @param {string} target_worker
307
+ * @param {string} opcode
308
+ * @param {any} meta_js
309
+ * @param {Uint8Array} raw_payload
310
+ * @returns {Promise<any>}
311
+ */
312
+ send_worker_frame(target_worker, opcode, meta_js, raw_payload) {
313
+ let ptr0, len0, ptr1, len1;
314
+ try {
315
+ ptr0 = passStringToWasm0(target_worker, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
316
+ len0 = WASM_VECTOR_LEN;
317
+ ptr1 = passStringToWasm0(opcode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
318
+ len1 = WASM_VECTOR_LEN;
319
+ } catch (e) {
320
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
321
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
322
+ throw e;
323
+ }
324
+ const ret = wasm.jetpackwasmclient_send_worker_frame(this.__wbg_ptr, ptr0, len0, ptr1, len1, meta_js, raw_payload);
325
+ return ret;
326
+ }
327
+ /**
328
+ * Updates and persists the daemon's Developer Mode (`Allow Unverified Apps`) setting.
329
+ * @param {boolean} enabled
330
+ * @returns {Promise<any>}
331
+ */
332
+ set_developer_mode(enabled) {
333
+ const ret = wasm.jetpackwasmclient_set_developer_mode(this.__wbg_ptr, enabled);
334
+ return ret;
335
+ }
336
+ /**
337
+ * Updates and persists whether interactive `jetpack-daemon` launches automatically open Control Center.
338
+ * @param {boolean} enabled
339
+ * @returns {Promise<any>}
340
+ */
341
+ set_open_dashboard_on_startup(enabled) {
342
+ const ret = wasm.jetpackwasmclient_set_open_dashboard_on_startup(this.__wbg_ptr, enabled);
343
+ return ret;
344
+ }
345
+ /**
346
+ * Updates and persists whether Control Center and standalone apps open in standalone Chromium `--app=` windows.
347
+ * @param {boolean} enabled
348
+ * @returns {Promise<any>}
349
+ */
350
+ set_open_in_app_window(enabled) {
351
+ const ret = wasm.jetpackwasmclient_set_open_in_app_window(this.__wbg_ptr, enabled);
352
+ return ret;
353
+ }
354
+ /**
355
+ * Subscribes to live sanitized daemon and worker log entries (`logs.entry`) when Developer Mode is active.
356
+ *
357
+ * Resolves with `{ buffered_count }` on success and clears the listener automatically if
358
+ * the daemon rejects the subscription (for example with `[DEV_MODE_REQUIRED]`).
359
+ * @param {Function} on_entry_callback
360
+ * @returns {Promise<any>}
361
+ */
362
+ subscribe_logs(on_entry_callback) {
363
+ const ret = wasm.jetpackwasmclient_subscribe_logs(this.__wbg_ptr, on_entry_callback);
364
+ return ret;
365
+ }
366
+ /**
367
+ * Terminates an active worker job by application ID or job UUID.
368
+ * @param {string} app_id_or_job_id
369
+ * @returns {Promise<any>}
370
+ */
371
+ terminate_app(app_id_or_job_id) {
372
+ const ptr0 = passStringToWasm0(app_id_or_job_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
373
+ const len0 = WASM_VECTOR_LEN;
374
+ const ret = wasm.jetpackwasmclient_terminate_app(this.__wbg_ptr, ptr0, len0);
375
+ return ret;
376
+ }
377
+ /**
378
+ * Uninstalls an application bundle (and optionally clears its app-private cache) without
379
+ * deleting user files inside mounted host directories (`"app.uninstall"`).
380
+ * @param {string} app_id
381
+ * @param {boolean} remove_cache
382
+ * @returns {Promise<any>}
383
+ */
384
+ uninstall_app(app_id, remove_cache) {
385
+ const val2 = +remove_cache;
386
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
387
+ const len0 = WASM_VECTOR_LEN;
388
+ const ret = wasm.jetpackwasmclient_uninstall_app(this.__wbg_ptr, ptr0, len0, val2);
389
+ return ret;
390
+ }
391
+ /**
392
+ * Unsubscribes from live log streaming (`logs.unsubscribe`) and clears the active log listener.
393
+ * @returns {Promise<any>}
394
+ */
395
+ unsubscribe_logs() {
396
+ const ret = wasm.jetpackwasmclient_unsubscribe_logs(this.__wbg_ptr);
397
+ return ret;
398
+ }
399
+ }
400
+ if (Symbol.dispose) JetPackWasmClient.prototype[Symbol.dispose] = JetPackWasmClient.prototype.free;
401
+
402
+ /**
403
+ * Client cryptographic identity managing asymmetric keys and browser persistence.
404
+ */
405
+ export class WasmClientIdentity {
406
+ static __wrap(ptr) {
407
+ const obj = Object.create(WasmClientIdentity.prototype);
408
+ obj.__wbg_ptr = ptr;
409
+ WasmClientIdentityFinalization.register(obj, obj.__wbg_ptr, obj);
410
+ return obj;
411
+ }
412
+ __destroy_into_raw() {
413
+ const ptr = this.__wbg_ptr;
414
+ this.__wbg_ptr = 0;
415
+ WasmClientIdentityFinalization.unregister(this);
416
+ return ptr;
417
+ }
418
+ free() {
419
+ const ptr = this.__destroy_into_raw();
420
+ wasm.__wbg_wasmclientidentity_free(ptr, 0);
421
+ }
422
+ /**
423
+ * Clears any persisted identity from browser `localStorage`.
424
+ * @returns {boolean}
425
+ */
426
+ static clear_storage() {
427
+ const ret = wasm.wasmclientidentity_clear_storage();
428
+ if (ret[2]) {
429
+ throw takeFromExternrefTable0(ret[1]);
430
+ }
431
+ return ret[0] !== 0;
432
+ }
433
+ /**
434
+ * Returns the client UUID as a string.
435
+ * @returns {string}
436
+ */
437
+ get client_id() {
438
+ let deferred1_0;
439
+ let deferred1_1;
440
+ try {
441
+ const ret = wasm.wasmclientidentity_client_id(this.__wbg_ptr);
442
+ deferred1_0 = ret[0];
443
+ deferred1_1 = ret[1];
444
+ return getStringFromWasm0(ret[0], ret[1]);
445
+ } finally {
446
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
447
+ }
448
+ }
449
+ /**
450
+ * Returns the 32-byte `Ed25519` public key as a hex string.
451
+ * @returns {string}
452
+ */
453
+ ed25519_pubkey_hex() {
454
+ let deferred1_0;
455
+ let deferred1_1;
456
+ try {
457
+ const ret = wasm.wasmclientidentity_ed25519_pubkey_hex(this.__wbg_ptr);
458
+ deferred1_0 = ret[0];
459
+ deferred1_1 = ret[1];
460
+ return getStringFromWasm0(ret[0], ret[1]);
461
+ } finally {
462
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
463
+ }
464
+ }
465
+ /**
466
+ * Generates an ephemeral in-memory client identity without reading/writing storage.
467
+ * @returns {WasmClientIdentity}
468
+ */
469
+ static generate_new_ephemeral() {
470
+ const ret = wasm.wasmclientidentity_generate_new_ephemeral();
471
+ if (ret[2]) {
472
+ throw takeFromExternrefTable0(ret[1]);
473
+ }
474
+ return WasmClientIdentity.__wrap(ret[0]);
475
+ }
476
+ /**
477
+ * Formats an Out-of-Band pairing deep link: `jetpack://pair?client_id=<uuid>&pubkey=<b64>&origin=<origin>`.
478
+ *
479
+ * Validates and normalizes the web origin parameter.
480
+ * @param {string} origin
481
+ * @returns {string}
482
+ */
483
+ generate_pairing_uri(origin) {
484
+ let deferred3_0;
485
+ let deferred3_1;
486
+ try {
487
+ const ptr0 = passStringToWasm0(origin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
488
+ const len0 = WASM_VECTOR_LEN;
489
+ const ret = wasm.wasmclientidentity_generate_pairing_uri(this.__wbg_ptr, ptr0, len0);
490
+ var ptr2 = ret[0];
491
+ var len2 = ret[1];
492
+ if (ret[3]) {
493
+ ptr2 = 0; len2 = 0;
494
+ throw takeFromExternrefTable0(ret[2]);
495
+ }
496
+ deferred3_0 = ptr2;
497
+ deferred3_1 = len2;
498
+ return getStringFromWasm0(ptr2, len2);
499
+ } finally {
500
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
501
+ }
502
+ }
503
+ /**
504
+ * Indicates whether this identity is persisted in browser `localStorage`.
505
+ * @returns {boolean}
506
+ */
507
+ get is_stored_in_local_storage() {
508
+ const ret = wasm.wasmclientidentity_is_stored_in_local_storage(this.__wbg_ptr);
509
+ return ret !== 0;
510
+ }
511
+ /**
512
+ * Loads client identity from browser `localStorage` or generates a new one.
513
+ *
514
+ * If `localStorage` is accessible and contains valid keys, the stored identity
515
+ * is restored. Otherwise, a new cryptographic keypair and UUID are created and
516
+ * persisted. If storage is unavailable, an ephemeral in-memory identity is used.
517
+ */
518
+ constructor() {
519
+ const ret = wasm.wasmclientidentity_load_or_generate();
520
+ if (ret[2]) {
521
+ throw takeFromExternrefTable0(ret[1]);
522
+ }
523
+ this.__wbg_ptr = ret[0];
524
+ WasmClientIdentityFinalization.register(this, this.__wbg_ptr, this);
525
+ return this;
526
+ }
527
+ /**
528
+ * Returns the URL-safe base64 encoded 64-byte public key bundle (`Ed25519` + `X25519`).
529
+ * @returns {string}
530
+ */
531
+ public_key_bundle_base64() {
532
+ let deferred1_0;
533
+ let deferred1_1;
534
+ try {
535
+ const ret = wasm.wasmclientidentity_public_key_bundle_base64(this.__wbg_ptr);
536
+ deferred1_0 = ret[0];
537
+ deferred1_1 = ret[1];
538
+ return getStringFromWasm0(ret[0], ret[1]);
539
+ } finally {
540
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
541
+ }
542
+ }
543
+ /**
544
+ * Returns the 32-byte `X25519` public key as a hex string.
545
+ * @returns {string}
546
+ */
547
+ x25519_pubkey_hex() {
548
+ let deferred1_0;
549
+ let deferred1_1;
550
+ try {
551
+ const ret = wasm.wasmclientidentity_x25519_pubkey_hex(this.__wbg_ptr);
552
+ deferred1_0 = ret[0];
553
+ deferred1_1 = ret[1];
554
+ return getStringFromWasm0(ret[0], ret[1]);
555
+ } finally {
556
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
557
+ }
558
+ }
559
+ }
560
+ if (Symbol.dispose) WasmClientIdentity.prototype[Symbol.dispose] = WasmClientIdentity.prototype.free;
561
+
562
+ /**
563
+ * @returns {string}
564
+ */
565
+ export function jetpack_version() {
566
+ let deferred1_0;
567
+ let deferred1_1;
568
+ try {
569
+ const ret = wasm.jetpack_version();
570
+ deferred1_0 = ret[0];
571
+ deferred1_1 = ret[1];
572
+ return getStringFromWasm0(ret[0], ret[1]);
573
+ } finally {
574
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
575
+ }
576
+ }
577
+ function __wbg_get_imports() {
578
+ const import0 = {
579
+ __proto__: null,
580
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
581
+ const ret = Error(getStringFromWasm0(arg0, arg1));
582
+ return ret;
583
+ },
584
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
585
+ const ret = String(arg1);
586
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
587
+ const len1 = WASM_VECTOR_LEN;
588
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
589
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
590
+ },
591
+ __wbg___wbindgen_bigint_get_as_i64_11da4b52cd0aedef: function(arg0, arg1) {
592
+ const v = arg1;
593
+ const ret = typeof(v) === 'bigint' ? v : undefined;
594
+ getDataViewMemory0().setBigInt64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
595
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
596
+ },
597
+ __wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(arg0) {
598
+ const v = arg0;
599
+ const ret = typeof(v) === 'boolean' ? v : undefined;
600
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
601
+ },
602
+ __wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
603
+ const ret = debugString(arg1);
604
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
605
+ const len1 = WASM_VECTOR_LEN;
606
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
607
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
608
+ },
609
+ __wbg___wbindgen_in_3f58a9d3b3a7eed2: function(arg0, arg1) {
610
+ const ret = arg0 in arg1;
611
+ return ret;
612
+ },
613
+ __wbg___wbindgen_is_bigint_5fa10641e039d3ef: function(arg0) {
614
+ const ret = typeof(arg0) === 'bigint';
615
+ return ret;
616
+ },
617
+ __wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
618
+ const ret = typeof(arg0) === 'function';
619
+ return ret;
620
+ },
621
+ __wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
622
+ const ret = arg0 === null;
623
+ return ret;
624
+ },
625
+ __wbg___wbindgen_is_object_8b968c3ab8e96595: function(arg0) {
626
+ const val = arg0;
627
+ const ret = typeof(val) === 'object' && val !== null;
628
+ return ret;
629
+ },
630
+ __wbg___wbindgen_is_string_fc456fee5d3317de: function(arg0) {
631
+ const ret = typeof(arg0) === 'string';
632
+ return ret;
633
+ },
634
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
635
+ const ret = arg0 === undefined;
636
+ return ret;
637
+ },
638
+ __wbg___wbindgen_jsval_eq_38d7bfbe4cc84039: function(arg0, arg1) {
639
+ const ret = arg0 === arg1;
640
+ return ret;
641
+ },
642
+ __wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36: function(arg0, arg1) {
643
+ const ret = arg0 == arg1;
644
+ return ret;
645
+ },
646
+ __wbg___wbindgen_number_get_934b640d0889af78: function(arg0, arg1) {
647
+ const obj = arg1;
648
+ const ret = typeof(obj) === 'number' ? obj : undefined;
649
+ getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
650
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
651
+ },
652
+ __wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
653
+ const obj = arg1;
654
+ const ret = typeof(obj) === 'string' ? obj : undefined;
655
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
656
+ var len1 = WASM_VECTOR_LEN;
657
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
658
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
659
+ },
660
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
661
+ throw new Error(getStringFromWasm0(arg0, arg1));
662
+ },
663
+ __wbg__wbg_cb_unref_09736879a3f67559: function(arg0) {
664
+ arg0._wbg_cb_unref();
665
+ },
666
+ __wbg_call_275b78b3b6520b92: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
667
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
668
+ return ret;
669
+ }, arguments); },
670
+ __wbg_call_40b008ba32f73991: function() { return handleError(function (arg0, arg1) {
671
+ const ret = arg0.call(arg1);
672
+ return ret;
673
+ }, arguments); },
674
+ __wbg_call_a410eb4b59ed5965: function() { return handleError(function (arg0, arg1, arg2) {
675
+ const ret = arg0.call(arg1, arg2);
676
+ return ret;
677
+ }, arguments); },
678
+ __wbg_close_5ee9c5fe4e8754a4: function() { return handleError(function (arg0) {
679
+ arg0.close();
680
+ }, arguments); },
681
+ __wbg_code_3e6881d821eab2c4: function(arg0) {
682
+ const ret = arg0.code;
683
+ return ret;
684
+ },
685
+ __wbg_crypto_23f565a907d30078: function(arg0) {
686
+ const ret = arg0.crypto;
687
+ return ret;
688
+ },
689
+ __wbg_data_c7e5e8500f1bca2f: function(arg0) {
690
+ const ret = arg0.data;
691
+ return ret;
692
+ },
693
+ __wbg_done_57e08d0be6e30c02: function(arg0) {
694
+ const ret = arg0.done;
695
+ return ret;
696
+ },
697
+ __wbg_entries_7bb1459bd9b5c2b9: function(arg0) {
698
+ const ret = Object.entries(arg0);
699
+ return ret;
700
+ },
701
+ __wbg_getItem_49556a3e59cfb688: function() { return handleError(function (arg0, arg1, arg2, arg3) {
702
+ const ret = arg1.getItem(getStringFromWasm0(arg2, arg3));
703
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
704
+ var len1 = WASM_VECTOR_LEN;
705
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
706
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
707
+ }, arguments); },
708
+ __wbg_getRandomValues_26d69b34970fd16e: function() { return handleError(function (arg0, arg1) {
709
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
710
+ }, arguments); },
711
+ __wbg_getRandomValues_d2908e0b99612b91: function() { return handleError(function (arg0, arg1) {
712
+ arg0.getRandomValues(arg1);
713
+ }, arguments); },
714
+ __wbg_get_635eea311fa1a291: function() { return handleError(function (arg0, arg1) {
715
+ const ret = Reflect.get(arg0, arg1);
716
+ return ret;
717
+ }, arguments); },
718
+ __wbg_get_d7176cfb76d71114: function(arg0, arg1) {
719
+ const ret = arg0[arg1 >>> 0];
720
+ return ret;
721
+ },
722
+ __wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
723
+ const ret = arg0[arg1 >>> 0];
724
+ return ret;
725
+ },
726
+ __wbg_instanceof_ArrayBuffer_12cdaa4161423e6b: function(arg0) {
727
+ let result;
728
+ try {
729
+ result = arg0 instanceof ArrayBuffer;
730
+ } catch (_) {
731
+ result = false;
732
+ }
733
+ const ret = result;
734
+ return ret;
735
+ },
736
+ __wbg_instanceof_Map_0b4fc8b62e73f163: function(arg0) {
737
+ let result;
738
+ try {
739
+ result = arg0 instanceof Map;
740
+ } catch (_) {
741
+ result = false;
742
+ }
743
+ const ret = result;
744
+ return ret;
745
+ },
746
+ __wbg_instanceof_Uint8Array_d7aeb0dcb3108fea: function(arg0) {
747
+ let result;
748
+ try {
749
+ result = arg0 instanceof Uint8Array;
750
+ } catch (_) {
751
+ result = false;
752
+ }
753
+ const ret = result;
754
+ return ret;
755
+ },
756
+ __wbg_instanceof_Window_5cf453f5639aa1a2: function(arg0) {
757
+ let result;
758
+ try {
759
+ result = arg0 instanceof Window;
760
+ } catch (_) {
761
+ result = false;
762
+ }
763
+ const ret = result;
764
+ return ret;
765
+ },
766
+ __wbg_isArray_bcf1376d0d732d08: function(arg0) {
767
+ const ret = Array.isArray(arg0);
768
+ return ret;
769
+ },
770
+ __wbg_isSafeInteger_1a35ba4d31e71d38: function(arg0) {
771
+ const ret = Number.isSafeInteger(arg0);
772
+ return ret;
773
+ },
774
+ __wbg_iterator_e4c5e8f68ada7b58: function() {
775
+ const ret = Symbol.iterator;
776
+ return ret;
777
+ },
778
+ __wbg_jetpackwasmclient_new: function(arg0) {
779
+ const ret = JetPackWasmClient.__wrap(arg0);
780
+ return ret;
781
+ },
782
+ __wbg_length_186163212ffe79c3: function(arg0) {
783
+ const ret = arg0.length;
784
+ return ret;
785
+ },
786
+ __wbg_length_b03a0fabb109b1e9: function(arg0) {
787
+ const ret = arg0.length;
788
+ return ret;
789
+ },
790
+ __wbg_localStorage_6827cfe6db14a9f6: function() { return handleError(function (arg0) {
791
+ const ret = arg0.localStorage;
792
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
793
+ }, arguments); },
794
+ __wbg_location_7320782274fc691b: function(arg0) {
795
+ const ret = arg0.location;
796
+ return ret;
797
+ },
798
+ __wbg_msCrypto_d5f06fad6bf1409b: function(arg0) {
799
+ const ret = arg0.msCrypto;
800
+ return ret;
801
+ },
802
+ __wbg_new_13de428334042d26: function(arg0) {
803
+ const ret = new Uint8Array(arg0);
804
+ return ret;
805
+ },
806
+ __wbg_new_37eb45aaf5eeb820: function() {
807
+ const ret = new Array();
808
+ return ret;
809
+ },
810
+ __wbg_new_7075786089b89c5e: function() {
811
+ const ret = new Map();
812
+ return ret;
813
+ },
814
+ __wbg_new_cd4348290afae586: function() {
815
+ const ret = new Object();
816
+ return ret;
817
+ },
818
+ __wbg_new_d72daa1c90ded389: function() { return handleError(function (arg0, arg1) {
819
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
820
+ return ret;
821
+ }, arguments); },
822
+ __wbg_new_from_slice_b8daf545a41c6aa0: function(arg0, arg1) {
823
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
824
+ return ret;
825
+ },
826
+ __wbg_new_typed_e09da9dae6ee5935: function(arg0, arg1) {
827
+ try {
828
+ var state0 = {a: arg0, b: arg1};
829
+ var cb0 = (arg0, arg1) => {
830
+ const a = state0.a;
831
+ state0.a = 0;
832
+ try {
833
+ return wasm_bindgen_72b45424988d9356___convert__closures_____invoke___js_sys_655e32931afb3f20___Function_fn_wasm_bindgen_72b45424988d9356___JsValue_____wasm_bindgen_72b45424988d9356___sys__Undefined___js_sys_655e32931afb3f20___Function_fn_wasm_bindgen_72b45424988d9356___JsValue_____wasm_bindgen_72b45424988d9356___sys__Undefined_______true_(a, state0.b, arg0, arg1);
834
+ } finally {
835
+ state0.a = a;
836
+ }
837
+ };
838
+ const ret = new Promise(cb0);
839
+ return ret;
840
+ } finally {
841
+ state0.a = 0;
842
+ }
843
+ },
844
+ __wbg_new_with_length_01b143a7e5dd5a3e: function(arg0) {
845
+ const ret = new Uint8Array(arg0 >>> 0);
846
+ return ret;
847
+ },
848
+ __wbg_next_178c1651c11432b3: function(arg0) {
849
+ const ret = arg0.next;
850
+ return ret;
851
+ },
852
+ __wbg_next_af5ac6a08bb0a717: function() { return handleError(function (arg0) {
853
+ const ret = arg0.next();
854
+ return ret;
855
+ }, arguments); },
856
+ __wbg_node_86166ff8ce1f2002: function(arg0) {
857
+ const ret = arg0.node;
858
+ return ret;
859
+ },
860
+ __wbg_origin_dafa41a3ee9236b1: function() { return handleError(function (arg0, arg1) {
861
+ const ret = arg1.origin;
862
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
863
+ const len1 = WASM_VECTOR_LEN;
864
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
865
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
866
+ }, arguments); },
867
+ __wbg_process_91f425a63f58e399: function(arg0) {
868
+ const ret = arg0.process;
869
+ return ret;
870
+ },
871
+ __wbg_prototypesetcall_13162965d1fe7aa3: function(arg0, arg1, arg2) {
872
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
873
+ },
874
+ __wbg_queueMicrotask_1e8503a8a690f0a3: function(arg0) {
875
+ const ret = arg0.queueMicrotask;
876
+ return ret;
877
+ },
878
+ __wbg_queueMicrotask_4a1a4d8dd332373b: function(arg0) {
879
+ queueMicrotask(arg0);
880
+ },
881
+ __wbg_randomFillSync_34b023059e3363de: function() { return handleError(function (arg0, arg1) {
882
+ arg0.randomFillSync(arg1);
883
+ }, arguments); },
884
+ __wbg_reason_34b16516ab3f72d4: function(arg0, arg1) {
885
+ const ret = arg1.reason;
886
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
887
+ const len1 = WASM_VECTOR_LEN;
888
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
889
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
890
+ },
891
+ __wbg_removeItem_6db621e167d16a1c: function() { return handleError(function (arg0, arg1, arg2) {
892
+ arg0.removeItem(getStringFromWasm0(arg1, arg2));
893
+ }, arguments); },
894
+ __wbg_require_9a7d8cc2e1d275c0: function() { return handleError(function () {
895
+ const ret = module.require;
896
+ return ret;
897
+ }, arguments); },
898
+ __wbg_resolve_dbf78ab4942478b0: function(arg0) {
899
+ const ret = Promise.resolve(arg0);
900
+ return ret;
901
+ },
902
+ __wbg_send_6ac1527dbb5bd98e: function() { return handleError(function (arg0, arg1) {
903
+ arg0.send(arg1);
904
+ }, arguments); },
905
+ __wbg_setItem_cfa3cb31f271776a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
906
+ arg0.setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
907
+ }, arguments); },
908
+ __wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
909
+ const ret = Reflect.set(arg0, arg1, arg2);
910
+ return ret;
911
+ }, arguments); },
912
+ __wbg_set_8282f7e0d2d01336: function(arg0, arg1, arg2) {
913
+ const ret = arg0.set(arg1, arg2);
914
+ return ret;
915
+ },
916
+ __wbg_set_binaryType_d5b4dafd0f127fb2: function(arg0, arg1) {
917
+ arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
918
+ },
919
+ __wbg_set_d2d33b52458e984a: function(arg0, arg1, arg2) {
920
+ arg0[arg1 >>> 0] = arg2;
921
+ },
922
+ __wbg_set_e4b9a833d288759a: function(arg0, arg1, arg2) {
923
+ arg0[arg1] = arg2;
924
+ },
925
+ __wbg_set_onclose_078935cf8d0fb024: function(arg0, arg1) {
926
+ arg0.onclose = arg1;
927
+ },
928
+ __wbg_set_onerror_f7f089f7f059501c: function(arg0, arg1) {
929
+ arg0.onerror = arg1;
930
+ },
931
+ __wbg_set_onmessage_26abc49cfa5f9ffc: function(arg0, arg1) {
932
+ arg0.onmessage = arg1;
933
+ },
934
+ __wbg_set_onopen_757be120cc7b1ea6: function(arg0, arg1) {
935
+ arg0.onopen = arg1;
936
+ },
937
+ __wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc: function() {
938
+ const ret = typeof globalThis === 'undefined' ? undefined : globalThis;
939
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
940
+ },
941
+ __wbg_static_accessor_GLOBAL_e4293fb22cbe77da: function() {
942
+ const ret = typeof global === 'undefined' ? undefined : global;
943
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
944
+ },
945
+ __wbg_static_accessor_SELF_53bb20457401453d: function() {
946
+ const ret = typeof self === 'undefined' ? undefined : self;
947
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
948
+ },
949
+ __wbg_static_accessor_WINDOW_b5e0810bfecb7feb: function() {
950
+ const ret = typeof window === 'undefined' ? undefined : window;
951
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
952
+ },
953
+ __wbg_subarray_58f388a9247ac0bb: function(arg0, arg1, arg2) {
954
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
955
+ return ret;
956
+ },
957
+ __wbg_then_e3f7f2d365708be8: function(arg0, arg1) {
958
+ const ret = arg0.then(arg1);
959
+ return ret;
960
+ },
961
+ __wbg_value_e0f328965e184931: function(arg0) {
962
+ const ret = arg0.value;
963
+ return ret;
964
+ },
965
+ __wbg_versions_6e128a981b0df859: function(arg0) {
966
+ const ret = arg0.versions;
967
+ return ret;
968
+ },
969
+ __wbindgen_generic_0000000000000001: function(arg0, arg1) {
970
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 414, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
971
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_72b45424988d9356___convert__closures_____invoke___wasm_bindgen_72b45424988d9356___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_72b45424988d9356___JsError___true_);
972
+ return ret;
973
+ },
974
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
975
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 211, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
976
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true_);
977
+ return ret;
978
+ },
979
+ __wbindgen_generic_0000000000000003: function(arg0, arg1) {
980
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 211, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
981
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true__44);
982
+ return ret;
983
+ },
984
+ __wbindgen_generic_0000000000000004: function(arg0, arg1) {
985
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 211, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
986
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true__45);
987
+ return ret;
988
+ },
989
+ __wbindgen_generic_0000000000000005: function(arg0, arg1) {
990
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 215, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
991
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_72b45424988d9356___convert__closures_____invoke_______true_);
992
+ return ret;
993
+ },
994
+ __wbindgen_generic_0000000000000006: function(arg0) {
995
+ // Cast intrinsic for `F64 -> Externref`.
996
+ const ret = arg0;
997
+ return ret;
998
+ },
999
+ __wbindgen_generic_0000000000000007: function(arg0) {
1000
+ // Cast intrinsic for `I64 -> Externref`.
1001
+ const ret = arg0;
1002
+ return ret;
1003
+ },
1004
+ __wbindgen_generic_0000000000000008: function(arg0, arg1) {
1005
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1006
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1007
+ return ret;
1008
+ },
1009
+ __wbindgen_generic_0000000000000009: function(arg0, arg1) {
1010
+ // Cast intrinsic for `Ref(String) -> Externref`.
1011
+ const ret = getStringFromWasm0(arg0, arg1);
1012
+ return ret;
1013
+ },
1014
+ __wbindgen_generic_000000000000000a: function(arg0) {
1015
+ // Cast intrinsic for `U64 -> Externref`.
1016
+ const ret = BigInt.asUintN(64, arg0);
1017
+ return ret;
1018
+ },
1019
+ __wbindgen_init_externref_table: function() {
1020
+ const table = wasm.__wbindgen_externrefs;
1021
+ table.set(0, undefined);
1022
+ table.set(1024, undefined);
1023
+ table.set(1025, null);
1024
+ table.set(1026, true);
1025
+ table.set(1027, false);
1026
+ },
1027
+ };
1028
+ return {
1029
+ __proto__: null,
1030
+ "./jetpack_wasm_bg.js": import0,
1031
+ };
1032
+ }
1033
+
1034
+ function wasm_bindgen_72b45424988d9356___convert__closures_____invoke_______true_(arg0, arg1) {
1035
+ wasm.wasm_bindgen_72b45424988d9356___convert__closures_____invoke_______true_(arg0, arg1);
1036
+ }
1037
+
1038
+ function wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2) {
1039
+ wasm.wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2);
1040
+ }
1041
+
1042
+ function wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true__44(arg0, arg1, arg2) {
1043
+ wasm.wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true__44(arg0, arg1, arg2);
1044
+ }
1045
+
1046
+ function wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true__45(arg0, arg1, arg2) {
1047
+ wasm.wasm_bindgen_72b45424988d9356___convert__closures_____invoke___web_sys_56acb6796a272af6___features__gen_CloseEvent__CloseEvent______true__45(arg0, arg1, arg2);
1048
+ }
1049
+
1050
+ function wasm_bindgen_72b45424988d9356___convert__closures_____invoke___wasm_bindgen_72b45424988d9356___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_72b45424988d9356___JsError___true_(arg0, arg1, arg2) {
1051
+ const ret = wasm.wasm_bindgen_72b45424988d9356___convert__closures_____invoke___wasm_bindgen_72b45424988d9356___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_72b45424988d9356___JsError___true_(arg0, arg1, arg2);
1052
+ if (ret[1]) {
1053
+ throw takeFromExternrefTable0(ret[0]);
1054
+ }
1055
+ }
1056
+
1057
+ function wasm_bindgen_72b45424988d9356___convert__closures_____invoke___js_sys_655e32931afb3f20___Function_fn_wasm_bindgen_72b45424988d9356___JsValue_____wasm_bindgen_72b45424988d9356___sys__Undefined___js_sys_655e32931afb3f20___Function_fn_wasm_bindgen_72b45424988d9356___JsValue_____wasm_bindgen_72b45424988d9356___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
1058
+ wasm.wasm_bindgen_72b45424988d9356___convert__closures_____invoke___js_sys_655e32931afb3f20___Function_fn_wasm_bindgen_72b45424988d9356___JsValue_____wasm_bindgen_72b45424988d9356___sys__Undefined___js_sys_655e32931afb3f20___Function_fn_wasm_bindgen_72b45424988d9356___JsValue_____wasm_bindgen_72b45424988d9356___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
1059
+ }
1060
+
1061
+
1062
+ const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
1063
+ const JetPackWasmClientFinalization = (typeof FinalizationRegistry === 'undefined')
1064
+ ? { register: () => {}, unregister: () => {} }
1065
+ : new FinalizationRegistry(ptr => wasm.__wbg_jetpackwasmclient_free(ptr, 1));
1066
+ const WasmClientIdentityFinalization = (typeof FinalizationRegistry === 'undefined')
1067
+ ? { register: () => {}, unregister: () => {} }
1068
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmclientidentity_free(ptr, 1));
1069
+
1070
+ function addToExternrefTable0(obj) {
1071
+ const idx = wasm.__externref_table_alloc();
1072
+ wasm.__wbindgen_externrefs.set(idx, obj);
1073
+ return idx;
1074
+ }
1075
+
1076
+ function _assertClass(instance, klass) {
1077
+ if (!(instance instanceof klass)) {
1078
+ throw new Error(`expected instance of ${klass.name}`);
1079
+ }
1080
+ }
1081
+
1082
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1083
+ ? { register: () => {}, unregister: () => {} }
1084
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
1085
+
1086
+ function debugString(val) {
1087
+ switch (typeof val) {
1088
+ // primitive types
1089
+ case 'number':
1090
+ case 'boolean':
1091
+ case 'undefined':
1092
+ return `${val}`;
1093
+ case 'string':
1094
+ return JSON.stringify(val);
1095
+ case 'bigint':
1096
+ return `${val}n`;
1097
+ case 'symbol':
1098
+ return val.description !== undefined
1099
+ ? `Symbol(${val.description})`
1100
+ : 'Symbol';
1101
+ case 'function':
1102
+ return typeof val.name === 'string' && val.name !== ''
1103
+ ? `Function(${val.name})`
1104
+ : 'Function';
1105
+ case 'object': {
1106
+ if (val === null) {
1107
+ return 'null';
1108
+ }
1109
+ // objects
1110
+ if (Array.isArray(val)) {
1111
+ return '[' + Array.from(val, debugString).join(', ') + ']';
1112
+ }
1113
+ // errors
1114
+ if (val instanceof Error) {
1115
+ return `${val.name}: ${val.message}\n${val.stack}`;
1116
+ }
1117
+
1118
+ const toStringOutput = toString.call(val);
1119
+ // Test for built-in
1120
+ const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
1121
+
1122
+ // Failed to match the standard '[object ClassName]'
1123
+ if (className === undefined) {
1124
+ return toStringOutput;
1125
+ }
1126
+ if (className === 'Object') {
1127
+ // we're a user defined class or Object
1128
+ // JSON.stringify avoids problems with cycles, and is generally much
1129
+ // easier than looping through ownProperties of `val`.
1130
+ try {
1131
+ return 'Object(' + JSON.stringify(val) + ')';
1132
+ } catch (_) {
1133
+ return 'Object';
1134
+ }
1135
+ }
1136
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1137
+ return className;
1138
+ }
1139
+ // Per MDN: 'This list of values is exhaustive.'
1140
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
1141
+ }
1142
+ }
1143
+
1144
+ function getArrayU8FromWasm0(ptr, len) {
1145
+ ptr = ptr >>> 0;
1146
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1147
+ }
1148
+
1149
+ let cachedDataViewMemory0 = null;
1150
+ function getDataViewMemory0() {
1151
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1152
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1153
+ }
1154
+ return cachedDataViewMemory0;
1155
+ }
1156
+
1157
+ function getStringFromWasm0(ptr, len) {
1158
+ ptr = ptr >>> 0;
1159
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1160
+ }
1161
+
1162
+ let cachedUint8ArrayMemory0 = null;
1163
+ function getUint8ArrayMemory0() {
1164
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1165
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1166
+ }
1167
+ return cachedUint8ArrayMemory0;
1168
+ }
1169
+
1170
+ function handleError(f, args) {
1171
+ try {
1172
+ return f.apply(this, args);
1173
+ } catch (e) {
1174
+ const idx = addToExternrefTable0(e);
1175
+ wasm.__wbindgen_exn_store(idx);
1176
+ }
1177
+ }
1178
+
1179
+ function isLikeNone(x) {
1180
+ return x === undefined || x === null;
1181
+ }
1182
+
1183
+ function makeMutClosure(arg0, arg1, f) {
1184
+ const state = { a: arg0, b: arg1, cnt: 1 };
1185
+ const real = (...args) => {
1186
+
1187
+ // First up with a closure we increment the internal reference
1188
+ // count. This ensures that the Rust closure environment won't
1189
+ // be deallocated while we're invoking it.
1190
+ state.cnt++;
1191
+ const a = state.a;
1192
+ state.a = 0;
1193
+ try {
1194
+ return f(a, state.b, ...args);
1195
+ } finally {
1196
+ state.a = a;
1197
+ real._wbg_cb_unref();
1198
+ }
1199
+ };
1200
+ real._wbg_cb_unref = () => {
1201
+ if (--state.cnt === 0) {
1202
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
1203
+ state.a = 0;
1204
+ CLOSURE_DTORS.unregister(state);
1205
+ }
1206
+ };
1207
+ CLOSURE_DTORS.register(real, state, state);
1208
+ return real;
1209
+ }
1210
+
1211
+ function passStringToWasm0(arg, malloc, realloc) {
1212
+ if (realloc === undefined) {
1213
+ const buf = cachedTextEncoder.encode(arg);
1214
+ const ptr = malloc(buf.length, 1) >>> 0;
1215
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1216
+ WASM_VECTOR_LEN = buf.length;
1217
+ return ptr;
1218
+ }
1219
+
1220
+ let len = arg.length;
1221
+ let ptr = malloc(len, 1) >>> 0;
1222
+
1223
+ const mem = getUint8ArrayMemory0();
1224
+
1225
+ let offset = 0;
1226
+
1227
+ for (; offset < len; offset++) {
1228
+ const code = arg.charCodeAt(offset);
1229
+ if (code > 0x7F) break;
1230
+ mem[ptr + offset] = code;
1231
+ }
1232
+ if (offset !== len) {
1233
+ if (offset !== 0) {
1234
+ arg = arg.slice(offset);
1235
+ }
1236
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1237
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1238
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1239
+
1240
+ offset += ret.written;
1241
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1242
+ }
1243
+
1244
+ WASM_VECTOR_LEN = offset;
1245
+ return ptr;
1246
+ }
1247
+
1248
+ function takeFromExternrefTable0(idx) {
1249
+ const value = wasm.__wbindgen_externrefs.get(idx);
1250
+ wasm.__externref_table_dealloc(idx);
1251
+ return value;
1252
+ }
1253
+
1254
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
1255
+ cachedTextDecoder.decode();
1256
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1257
+ let numBytesDecoded = 0;
1258
+ function decodeText(bytes) {
1259
+ numBytesDecoded += bytes.length;
1260
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1261
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
1262
+ cachedTextDecoder.decode();
1263
+ numBytesDecoded = bytes.length;
1264
+ }
1265
+ return cachedTextDecoder.decode(bytes);
1266
+ }
1267
+
1268
+ const cachedTextEncoder = new TextEncoder();
1269
+
1270
+ if (!('encodeInto' in cachedTextEncoder)) {
1271
+ cachedTextEncoder.encodeInto = function (arg, view) {
1272
+ const buf = cachedTextEncoder.encode(arg);
1273
+ view.set(buf);
1274
+ return {
1275
+ read: arg.length,
1276
+ written: buf.length
1277
+ };
1278
+ };
1279
+ }
1280
+
1281
+ let WASM_VECTOR_LEN = 0;
1282
+
1283
+ let wasmModule, wasmInstance, wasm;
1284
+ function __wbg_finalize_init(instance, module) {
1285
+ wasmInstance = instance;
1286
+ wasm = instance.exports;
1287
+ wasmModule = module;
1288
+ cachedDataViewMemory0 = null;
1289
+ cachedUint8ArrayMemory0 = null;
1290
+ wasm.__wbindgen_start();
1291
+ return wasm;
1292
+ }
1293
+
1294
+ async function __wbg_load(module, imports) {
1295
+ if (typeof Response === 'function' && module instanceof Response) {
1296
+ if (!module.ok) {
1297
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
1298
+ }
1299
+
1300
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1301
+ try {
1302
+ return await WebAssembly.instantiateStreaming(module, imports);
1303
+ } catch (e) {
1304
+ const validResponse = expectedResponseType(module.type);
1305
+
1306
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1307
+ 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);
1308
+
1309
+ } else { throw e; }
1310
+ }
1311
+ }
1312
+
1313
+ const bytes = await module.arrayBuffer();
1314
+ return await WebAssembly.instantiate(bytes, imports);
1315
+ } else {
1316
+ const instance = await WebAssembly.instantiate(module, imports);
1317
+
1318
+ if (instance instanceof WebAssembly.Instance) {
1319
+ return { instance, module };
1320
+ } else {
1321
+ return instance;
1322
+ }
1323
+ }
1324
+
1325
+ function expectedResponseType(type) {
1326
+ switch (type) {
1327
+ case 'basic': case 'cors': case 'default': return true;
1328
+ }
1329
+ return false;
1330
+ }
1331
+ }
1332
+
1333
+ function initSync(module) {
1334
+ if (wasm !== undefined) return wasm;
1335
+
1336
+
1337
+ if (module !== undefined) {
1338
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1339
+ ({module} = module)
1340
+ } else {
1341
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1342
+ }
1343
+ }
1344
+
1345
+ const imports = __wbg_get_imports();
1346
+ if (!(module instanceof WebAssembly.Module)) {
1347
+ module = new WebAssembly.Module(module);
1348
+ }
1349
+ const instance = new WebAssembly.Instance(module, imports);
1350
+ return __wbg_finalize_init(instance, module);
1351
+ }
1352
+
1353
+ let __wbg_init_promise;
1354
+ async function __wbg_init(module_or_path) {
1355
+ if (wasm !== undefined) return wasm;
1356
+ if (__wbg_init_promise === undefined) {
1357
+ __wbg_init_promise = __wbg_init_once(module_or_path);
1358
+ __wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
1359
+ }
1360
+ return __wbg_init_promise;
1361
+ }
1362
+
1363
+ async function __wbg_init_once(module_or_path) {
1364
+
1365
+ if (module_or_path !== undefined) {
1366
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1367
+ ({module_or_path} = module_or_path)
1368
+ } else {
1369
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1370
+ }
1371
+ }
1372
+
1373
+ if (module_or_path === undefined) {
1374
+ module_or_path = new URL('jetpack_wasm_bg.wasm', import.meta.url);
1375
+ }
1376
+ const imports = __wbg_get_imports();
1377
+
1378
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1379
+ module_or_path = fetch(module_or_path);
1380
+ }
1381
+
1382
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1383
+
1384
+ return __wbg_finalize_init(instance, module);
1385
+ }
1386
+
1387
+ export { initSync, __wbg_init as default };