@rkat/web 0.4.1 → 0.4.3

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,1625 @@
1
+ /* @ts-self-types="./meerkat_web_runtime.d.ts" */
2
+
3
+ export class IntoUnderlyingByteSource {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ IntoUnderlyingByteSourceFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
13
+ }
14
+ /**
15
+ * @returns {number}
16
+ */
17
+ get autoAllocateChunkSize() {
18
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
19
+ return ret >>> 0;
20
+ }
21
+ cancel() {
22
+ const ptr = this.__destroy_into_raw();
23
+ wasm.intounderlyingbytesource_cancel(ptr);
24
+ }
25
+ /**
26
+ * @param {ReadableByteStreamController} controller
27
+ * @returns {Promise<any>}
28
+ */
29
+ pull(controller) {
30
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
31
+ return ret;
32
+ }
33
+ /**
34
+ * @param {ReadableByteStreamController} controller
35
+ */
36
+ start(controller) {
37
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
38
+ }
39
+ /**
40
+ * @returns {ReadableStreamType}
41
+ */
42
+ get type() {
43
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
44
+ return __wbindgen_enum_ReadableStreamType[ret];
45
+ }
46
+ }
47
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
48
+
49
+ export class IntoUnderlyingSink {
50
+ __destroy_into_raw() {
51
+ const ptr = this.__wbg_ptr;
52
+ this.__wbg_ptr = 0;
53
+ IntoUnderlyingSinkFinalization.unregister(this);
54
+ return ptr;
55
+ }
56
+ free() {
57
+ const ptr = this.__destroy_into_raw();
58
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
59
+ }
60
+ /**
61
+ * @param {any} reason
62
+ * @returns {Promise<any>}
63
+ */
64
+ abort(reason) {
65
+ const ptr = this.__destroy_into_raw();
66
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
67
+ return ret;
68
+ }
69
+ /**
70
+ * @returns {Promise<any>}
71
+ */
72
+ close() {
73
+ const ptr = this.__destroy_into_raw();
74
+ const ret = wasm.intounderlyingsink_close(ptr);
75
+ return ret;
76
+ }
77
+ /**
78
+ * @param {any} chunk
79
+ * @returns {Promise<any>}
80
+ */
81
+ write(chunk) {
82
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
83
+ return ret;
84
+ }
85
+ }
86
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
87
+
88
+ export class IntoUnderlyingSource {
89
+ __destroy_into_raw() {
90
+ const ptr = this.__wbg_ptr;
91
+ this.__wbg_ptr = 0;
92
+ IntoUnderlyingSourceFinalization.unregister(this);
93
+ return ptr;
94
+ }
95
+ free() {
96
+ const ptr = this.__destroy_into_raw();
97
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
98
+ }
99
+ cancel() {
100
+ const ptr = this.__destroy_into_raw();
101
+ wasm.intounderlyingsource_cancel(ptr);
102
+ }
103
+ /**
104
+ * @param {ReadableStreamDefaultController} controller
105
+ * @returns {Promise<any>}
106
+ */
107
+ pull(controller) {
108
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
109
+ return ret;
110
+ }
111
+ }
112
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
113
+
114
+ /**
115
+ * Clear all registered tool callbacks.
116
+ */
117
+ export function clear_tool_callbacks() {
118
+ wasm.clear_tool_callbacks();
119
+ }
120
+
121
+ /**
122
+ * Close a subscription and free resources.
123
+ * @param {number} handle
124
+ */
125
+ export function close_subscription(handle) {
126
+ const ret = wasm.close_subscription(handle);
127
+ if (ret[1]) {
128
+ throw takeFromExternrefTable0(ret[0]);
129
+ }
130
+ }
131
+
132
+ /**
133
+ * Create a session from a mobpack + config.
134
+ *
135
+ * Routes through `AgentFactory::build_agent()` with override-first
136
+ * resource injection — same pipeline as all other meerkat surfaces.
137
+ *
138
+ * `config_json`: `{ "model": "...", "api_key": "sk-...", "max_tokens"?: N,
139
+ * "comms_name"?: "...", "host_mode"?: true }`
140
+ * @param {Uint8Array} mobpack_bytes
141
+ * @param {string} config_json
142
+ * @returns {number}
143
+ */
144
+ export function create_session(mobpack_bytes, config_json) {
145
+ const ptr0 = passArray8ToWasm0(mobpack_bytes, wasm.__wbindgen_malloc_command_export);
146
+ const len0 = WASM_VECTOR_LEN;
147
+ const ptr1 = passStringToWasm0(config_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
148
+ const len1 = WASM_VECTOR_LEN;
149
+ const ret = wasm.create_session(ptr0, len0, ptr1, len1);
150
+ if (ret[2]) {
151
+ throw takeFromExternrefTable0(ret[1]);
152
+ }
153
+ return ret[0] >>> 0;
154
+ }
155
+
156
+ /**
157
+ * Create a session without a mobpack — for standalone agent use.
158
+ *
159
+ * `config_json`: `{ "model": "...", "api_key": "sk-...", "system_prompt"?: "...",
160
+ * "max_tokens"?: N, "additional_instructions"?: ["..."] }`
161
+ *
162
+ * Uses `register_tool_callback` tools if any were registered before this call.
163
+ * @param {string} config_json
164
+ * @returns {number}
165
+ */
166
+ export function create_session_simple(config_json) {
167
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
168
+ const len0 = WASM_VECTOR_LEN;
169
+ const ret = wasm.create_session_simple(ptr0, len0);
170
+ if (ret[2]) {
171
+ throw takeFromExternrefTable0(ret[1]);
172
+ }
173
+ return ret[0] >>> 0;
174
+ }
175
+
176
+ /**
177
+ * Remove a session.
178
+ * @param {number} handle
179
+ */
180
+ export function destroy_session(handle) {
181
+ const ret = wasm.destroy_session(handle);
182
+ if (ret[1]) {
183
+ throw takeFromExternrefTable0(ret[0]);
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Get current session state.
189
+ * @param {number} handle
190
+ * @returns {string}
191
+ */
192
+ export function get_session_state(handle) {
193
+ let deferred2_0;
194
+ let deferred2_1;
195
+ try {
196
+ const ret = wasm.get_session_state(handle);
197
+ var ptr1 = ret[0];
198
+ var len1 = ret[1];
199
+ if (ret[3]) {
200
+ ptr1 = 0; len1 = 0;
201
+ throw takeFromExternrefTable0(ret[2]);
202
+ }
203
+ deferred2_0 = ptr1;
204
+ deferred2_1 = len1;
205
+ return getStringFromWasm0(ptr1, len1);
206
+ } finally {
207
+ wasm.__wbindgen_free_command_export(deferred2_0, deferred2_1, 1);
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Primary bootstrap: parse a mobpack and create service infrastructure.
213
+ *
214
+ * `mobpack_bytes`: tar.gz mobpack archive.
215
+ * `credentials_json`: `{ "api_key": "sk-...", "anthropic_api_key"?: "...", "openai_api_key"?: "...", "gemini_api_key"?: "...", "model"?: "claude-sonnet-4-5" }`
216
+ *
217
+ * Stores an `EphemeralSessionService<FactoryAgentBuilder>` and a `MobMcpState`
218
+ * in a `thread_local! RuntimeState` for subsequent mob/comms calls.
219
+ * @param {Uint8Array} mobpack_bytes
220
+ * @param {string} credentials_json
221
+ * @returns {any}
222
+ */
223
+ export function init_runtime(mobpack_bytes, credentials_json) {
224
+ const ptr0 = passArray8ToWasm0(mobpack_bytes, wasm.__wbindgen_malloc_command_export);
225
+ const len0 = WASM_VECTOR_LEN;
226
+ const ptr1 = passStringToWasm0(credentials_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
227
+ const len1 = WASM_VECTOR_LEN;
228
+ const ret = wasm.init_runtime(ptr0, len0, ptr1, len1);
229
+ if (ret[2]) {
230
+ throw takeFromExternrefTable0(ret[1]);
231
+ }
232
+ return takeFromExternrefTable0(ret[0]);
233
+ }
234
+
235
+ /**
236
+ * Advanced bare-bones bootstrap without a mobpack.
237
+ *
238
+ * `config_json`: `{ "api_key"?: "sk-...", "anthropic_api_key"?: "...", "openai_api_key"?: "...", "gemini_api_key"?: "...", "model"?: "claude-sonnet-4-5", "max_sessions"?: 64 }`
239
+ * @param {string} config_json
240
+ * @returns {any}
241
+ */
242
+ export function init_runtime_from_config(config_json) {
243
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
244
+ const len0 = WASM_VECTOR_LEN;
245
+ const ret = wasm.init_runtime_from_config(ptr0, len0);
246
+ if (ret[2]) {
247
+ throw takeFromExternrefTable0(ret[1]);
248
+ }
249
+ return takeFromExternrefTable0(ret[0]);
250
+ }
251
+
252
+ /**
253
+ * Inspect a mobpack without creating a session.
254
+ * @param {Uint8Array} mobpack_bytes
255
+ * @returns {string}
256
+ */
257
+ export function inspect_mobpack(mobpack_bytes) {
258
+ let deferred3_0;
259
+ let deferred3_1;
260
+ try {
261
+ const ptr0 = passArray8ToWasm0(mobpack_bytes, wasm.__wbindgen_malloc_command_export);
262
+ const len0 = WASM_VECTOR_LEN;
263
+ const ret = wasm.inspect_mobpack(ptr0, len0);
264
+ var ptr2 = ret[0];
265
+ var len2 = ret[1];
266
+ if (ret[3]) {
267
+ ptr2 = 0; len2 = 0;
268
+ throw takeFromExternrefTable0(ret[2]);
269
+ }
270
+ deferred3_0 = ptr2;
271
+ deferred3_1 = len2;
272
+ return getStringFromWasm0(ptr2, len2);
273
+ } finally {
274
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Cancel an in-flight flow run.
280
+ * @param {string} mob_id
281
+ * @param {string} run_id
282
+ * @returns {Promise<void>}
283
+ */
284
+ export function mob_cancel_flow(mob_id, run_id) {
285
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
286
+ const len0 = WASM_VECTOR_LEN;
287
+ const ptr1 = passStringToWasm0(run_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
288
+ const len1 = WASM_VECTOR_LEN;
289
+ const ret = wasm.mob_cancel_flow(ptr0, len0, ptr1, len1);
290
+ return ret;
291
+ }
292
+
293
+ /**
294
+ * Create a new mob from a definition JSON.
295
+ *
296
+ * Returns the mob_id as a string.
297
+ * @param {string} definition_json
298
+ * @returns {Promise<any>}
299
+ */
300
+ export function mob_create(definition_json) {
301
+ const ptr0 = passStringToWasm0(definition_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
302
+ const len0 = WASM_VECTOR_LEN;
303
+ const ret = wasm.mob_create(ptr0, len0);
304
+ return ret;
305
+ }
306
+
307
+ /**
308
+ * Fetch mob events.
309
+ *
310
+ * Returns JSON array of mob events.
311
+ *
312
+ * Note: `after_cursor` is u32 at the JS boundary (wasm_bindgen limitation),
313
+ * internally widened to u64. Cursors beyond 4B are not supported via this export.
314
+ * @param {string} mob_id
315
+ * @param {number} after_cursor
316
+ * @param {number} limit
317
+ * @returns {Promise<any>}
318
+ */
319
+ export function mob_events(mob_id, after_cursor, limit) {
320
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
321
+ const len0 = WASM_VECTOR_LEN;
322
+ const ret = wasm.mob_events(ptr0, len0, after_cursor, limit);
323
+ return ret;
324
+ }
325
+
326
+ /**
327
+ * Read flow run status.
328
+ *
329
+ * Returns JSON with run state and ledgers, or null if not found.
330
+ * @param {string} mob_id
331
+ * @param {string} run_id
332
+ * @returns {Promise<any>}
333
+ */
334
+ export function mob_flow_status(mob_id, run_id) {
335
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
336
+ const len0 = WASM_VECTOR_LEN;
337
+ const ptr1 = passStringToWasm0(run_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
338
+ const len1 = WASM_VECTOR_LEN;
339
+ const ret = wasm.mob_flow_status(ptr0, len0, ptr1, len1);
340
+ return ret;
341
+ }
342
+
343
+ /**
344
+ * Inject a message and subscribe for interaction-scoped events.
345
+ *
346
+ * Returns JSON: `{ "interaction_id": "..." }`
347
+ * @param {string} mob_id
348
+ * @param {string} meerkat_id
349
+ * @param {string} message
350
+ * @returns {Promise<any>}
351
+ */
352
+ export function mob_inject_and_subscribe(mob_id, meerkat_id, message) {
353
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
354
+ const len0 = WASM_VECTOR_LEN;
355
+ const ptr1 = passStringToWasm0(meerkat_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
356
+ const len1 = WASM_VECTOR_LEN;
357
+ const ptr2 = passStringToWasm0(message, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
358
+ const len2 = WASM_VECTOR_LEN;
359
+ const ret = wasm.mob_inject_and_subscribe(ptr0, len0, ptr1, len1, ptr2, len2);
360
+ return ret;
361
+ }
362
+
363
+ /**
364
+ * Perform a lifecycle action on a mob.
365
+ *
366
+ * `action`: one of "stop", "resume", "complete", "destroy".
367
+ * @param {string} mob_id
368
+ * @param {string} action
369
+ * @returns {Promise<void>}
370
+ */
371
+ export function mob_lifecycle(mob_id, action) {
372
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
373
+ const len0 = WASM_VECTOR_LEN;
374
+ const ptr1 = passStringToWasm0(action, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
375
+ const len1 = WASM_VECTOR_LEN;
376
+ const ret = wasm.mob_lifecycle(ptr0, len0, ptr1, len1);
377
+ return ret;
378
+ }
379
+
380
+ /**
381
+ * List all mobs.
382
+ *
383
+ * Returns JSON array of `{ mob_id, state }`.
384
+ * @returns {Promise<any>}
385
+ */
386
+ export function mob_list() {
387
+ const ret = wasm.mob_list();
388
+ return ret;
389
+ }
390
+
391
+ /**
392
+ * List all members in a mob.
393
+ *
394
+ * Returns JSON array of roster entries.
395
+ * @param {string} mob_id
396
+ * @returns {Promise<any>}
397
+ */
398
+ export function mob_list_members(mob_id) {
399
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
400
+ const len0 = WASM_VECTOR_LEN;
401
+ const ret = wasm.mob_list_members(ptr0, len0);
402
+ return ret;
403
+ }
404
+
405
+ /**
406
+ * Subscribe to a mob member's session event stream.
407
+ *
408
+ * Returns a subscription handle. Use `poll_subscription(handle)` to drain
409
+ * buffered events. Each call returns all events since the last poll.
410
+ *
411
+ * The subscription captures ALL agent activity: text deltas, tool calls
412
+ * (including comms send_message/peers), turn completions, etc.
413
+ * @param {string} mob_id
414
+ * @param {string} meerkat_id
415
+ * @returns {Promise<number>}
416
+ */
417
+ export function mob_member_subscribe(mob_id, meerkat_id) {
418
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
419
+ const len0 = WASM_VECTOR_LEN;
420
+ const ptr1 = passStringToWasm0(meerkat_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
421
+ const len1 = WASM_VECTOR_LEN;
422
+ const ret = wasm.mob_member_subscribe(ptr0, len0, ptr1, len1);
423
+ return ret;
424
+ }
425
+
426
+ /**
427
+ * Retire and re-spawn a meerkat with the same profile.
428
+ *
429
+ * Returns JSON: `{ "meerkat_id", "status": "respawn_enqueued" }`
430
+ * @param {string} mob_id
431
+ * @param {string} meerkat_id
432
+ * @param {string | null} [initial_message]
433
+ * @returns {Promise<any>}
434
+ */
435
+ export function mob_respawn(mob_id, meerkat_id, initial_message) {
436
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ const ptr1 = passStringToWasm0(meerkat_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
439
+ const len1 = WASM_VECTOR_LEN;
440
+ var ptr2 = isLikeNone(initial_message) ? 0 : passStringToWasm0(initial_message, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
441
+ var len2 = WASM_VECTOR_LEN;
442
+ const ret = wasm.mob_respawn(ptr0, len0, ptr1, len1, ptr2, len2);
443
+ return ret;
444
+ }
445
+
446
+ /**
447
+ * Retire a meerkat from a mob.
448
+ * @param {string} mob_id
449
+ * @param {string} meerkat_id
450
+ * @returns {Promise<void>}
451
+ */
452
+ export function mob_retire(mob_id, meerkat_id) {
453
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
454
+ const len0 = WASM_VECTOR_LEN;
455
+ const ptr1 = passStringToWasm0(meerkat_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
456
+ const len1 = WASM_VECTOR_LEN;
457
+ const ret = wasm.mob_retire(ptr0, len0, ptr1, len1);
458
+ return ret;
459
+ }
460
+
461
+ /**
462
+ * Start a configured flow run.
463
+ *
464
+ * Returns the run_id as a string.
465
+ * @param {string} mob_id
466
+ * @param {string} flow_id
467
+ * @param {string} params_json
468
+ * @returns {Promise<any>}
469
+ */
470
+ export function mob_run_flow(mob_id, flow_id, params_json) {
471
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ptr1 = passStringToWasm0(flow_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
474
+ const len1 = WASM_VECTOR_LEN;
475
+ const ptr2 = passStringToWasm0(params_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
476
+ const len2 = WASM_VECTOR_LEN;
477
+ const ret = wasm.mob_run_flow(ptr0, len0, ptr1, len1, ptr2, len2);
478
+ return ret;
479
+ }
480
+
481
+ /**
482
+ * Send an external message to a spawned meerkat.
483
+ * @param {string} mob_id
484
+ * @param {string} meerkat_id
485
+ * @param {string} message
486
+ * @returns {Promise<void>}
487
+ */
488
+ export function mob_send_message(mob_id, meerkat_id, message) {
489
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
490
+ const len0 = WASM_VECTOR_LEN;
491
+ const ptr1 = passStringToWasm0(meerkat_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
492
+ const len1 = WASM_VECTOR_LEN;
493
+ const ptr2 = passStringToWasm0(message, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
494
+ const len2 = WASM_VECTOR_LEN;
495
+ const ret = wasm.mob_send_message(ptr0, len0, ptr1, len1, ptr2, len2);
496
+ return ret;
497
+ }
498
+
499
+ /**
500
+ * Spawn one or more meerkats in a mob.
501
+ *
502
+ * `specs_json`: JSON array of `{ "profile": "...", "meerkat_id": "...", "initial_message"?: "...",
503
+ * "runtime_mode"?: "autonomous_host"|"turn_driven", "backend"?: "subagent"|"external" }`
504
+ *
505
+ * Returns JSON array of results per spec.
506
+ * @param {string} mob_id
507
+ * @param {string} specs_json
508
+ * @returns {Promise<any>}
509
+ */
510
+ export function mob_spawn(mob_id, specs_json) {
511
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
512
+ const len0 = WASM_VECTOR_LEN;
513
+ const ptr1 = passStringToWasm0(specs_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
514
+ const len1 = WASM_VECTOR_LEN;
515
+ const ret = wasm.mob_spawn(ptr0, len0, ptr1, len1);
516
+ return ret;
517
+ }
518
+
519
+ /**
520
+ * Get the status of a mob.
521
+ *
522
+ * Returns JSON with the mob state.
523
+ * @param {string} mob_id
524
+ * @returns {Promise<any>}
525
+ */
526
+ export function mob_status(mob_id) {
527
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
528
+ const len0 = WASM_VECTOR_LEN;
529
+ const ret = wasm.mob_status(ptr0, len0);
530
+ return ret;
531
+ }
532
+
533
+ /**
534
+ * Subscribe to mob-wide events (all members, continuously updated).
535
+ *
536
+ * Returns a subscription handle. Use `poll_subscription(handle)` to drain
537
+ * buffered events. Each call returns all events since the last poll.
538
+ *
539
+ * Unlike `mob_member_subscribe` which streams a single member's agent events,
540
+ * this streams [`AttributedEvent`]s tagged with source meerkat_id and profile
541
+ * for every member in the mob, automatically tracking roster changes.
542
+ * @param {string} mob_id
543
+ * @returns {Promise<number>}
544
+ */
545
+ export function mob_subscribe_events(mob_id) {
546
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
547
+ const len0 = WASM_VECTOR_LEN;
548
+ const ret = wasm.mob_subscribe_events(ptr0, len0);
549
+ return ret;
550
+ }
551
+
552
+ /**
553
+ * Unwire bidirectional trust between two meerkats.
554
+ * @param {string} mob_id
555
+ * @param {string} a
556
+ * @param {string} b
557
+ * @returns {Promise<void>}
558
+ */
559
+ export function mob_unwire(mob_id, a, b) {
560
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
561
+ const len0 = WASM_VECTOR_LEN;
562
+ const ptr1 = passStringToWasm0(a, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
563
+ const len1 = WASM_VECTOR_LEN;
564
+ const ptr2 = passStringToWasm0(b, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
565
+ const len2 = WASM_VECTOR_LEN;
566
+ const ret = wasm.mob_unwire(ptr0, len0, ptr1, len1, ptr2, len2);
567
+ return ret;
568
+ }
569
+
570
+ /**
571
+ * Wire bidirectional trust between two meerkats.
572
+ * @param {string} mob_id
573
+ * @param {string} a
574
+ * @param {string} b
575
+ * @returns {Promise<void>}
576
+ */
577
+ export function mob_wire(mob_id, a, b) {
578
+ const ptr0 = passStringToWasm0(mob_id, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
579
+ const len0 = WASM_VECTOR_LEN;
580
+ const ptr1 = passStringToWasm0(a, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
581
+ const len1 = WASM_VECTOR_LEN;
582
+ const ptr2 = passStringToWasm0(b, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
583
+ const len2 = WASM_VECTOR_LEN;
584
+ const ret = wasm.mob_wire(ptr0, len0, ptr1, len1, ptr2, len2);
585
+ return ret;
586
+ }
587
+
588
+ /**
589
+ * Drain and return all pending agent events from the last turn(s).
590
+ *
591
+ * Returns a JSON array of `AgentEvent` objects. Each call drains the buffer;
592
+ * subsequent calls return `[]` until the next `start_turn` produces more events.
593
+ * @param {number} handle
594
+ * @returns {string}
595
+ */
596
+ export function poll_events(handle) {
597
+ let deferred2_0;
598
+ let deferred2_1;
599
+ try {
600
+ const ret = wasm.poll_events(handle);
601
+ var ptr1 = ret[0];
602
+ var len1 = ret[1];
603
+ if (ret[3]) {
604
+ ptr1 = 0; len1 = 0;
605
+ throw takeFromExternrefTable0(ret[2]);
606
+ }
607
+ deferred2_0 = ptr1;
608
+ deferred2_1 = len1;
609
+ return getStringFromWasm0(ptr1, len1);
610
+ } finally {
611
+ wasm.__wbindgen_free_command_export(deferred2_0, deferred2_1, 1);
612
+ }
613
+ }
614
+
615
+ /**
616
+ * Poll a subscription for new events.
617
+ *
618
+ * Returns a JSON array of event objects. Drains all buffered events
619
+ * since the last poll. Non-blocking: returns `[]` if no new events.
620
+ *
621
+ * For per-member subscriptions (`mob_member_subscribe`), returns
622
+ * `EventEnvelope<AgentEvent>` objects. For mob-wide subscriptions
623
+ * (`mob_subscribe_events`), returns `AttributedEvent` objects with
624
+ * `source`, `profile`, and `envelope` fields.
625
+ * @param {number} handle
626
+ * @returns {string}
627
+ */
628
+ export function poll_subscription(handle) {
629
+ let deferred2_0;
630
+ let deferred2_1;
631
+ try {
632
+ const ret = wasm.poll_subscription(handle);
633
+ var ptr1 = ret[0];
634
+ var len1 = ret[1];
635
+ if (ret[3]) {
636
+ ptr1 = 0; len1 = 0;
637
+ throw takeFromExternrefTable0(ret[2]);
638
+ }
639
+ deferred2_0 = ptr1;
640
+ deferred2_1 = len1;
641
+ return getStringFromWasm0(ptr1, len1);
642
+ } finally {
643
+ wasm.__wbindgen_free_command_export(deferred2_0, deferred2_1, 1);
644
+ }
645
+ }
646
+
647
+ /**
648
+ * Register a tool implementation from JavaScript.
649
+ *
650
+ * Call this BEFORE `init_runtime` or `init_runtime_from_config`.
651
+ * The `callback` receives a JSON string of tool arguments and must return
652
+ * a `Promise<string>` resolving to JSON `{"content": "...", "is_error": false}`.
653
+ *
654
+ * Example (JS):
655
+ * ```js
656
+ * register_tool_callback("shell", '{"type":"object","properties":{"command":{"type":"string"}},"required":["command"]}', shellFn);
657
+ * ```
658
+ * @param {string} name
659
+ * @param {string} description
660
+ * @param {string} schema_json
661
+ * @param {any} callback
662
+ */
663
+ export function register_tool_callback(name, description, schema_json, callback) {
664
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
665
+ const len0 = WASM_VECTOR_LEN;
666
+ const ptr1 = passStringToWasm0(description, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
667
+ const len1 = WASM_VECTOR_LEN;
668
+ const ptr2 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
669
+ const len2 = WASM_VECTOR_LEN;
670
+ const ret = wasm.register_tool_callback(ptr0, len0, ptr1, len1, ptr2, len2, callback);
671
+ if (ret[1]) {
672
+ throw takeFromExternrefTable0(ret[0]);
673
+ }
674
+ }
675
+
676
+ /**
677
+ * Return the crate version embedded at compile time.
678
+ *
679
+ * Used by the `@rkat/web` TypeScript wrapper to validate that the JS glue
680
+ * and the WASM binary were built from the same version.
681
+ * @returns {string}
682
+ */
683
+ export function runtime_version() {
684
+ let deferred1_0;
685
+ let deferred1_1;
686
+ try {
687
+ const ret = wasm.runtime_version();
688
+ deferred1_0 = ret[0];
689
+ deferred1_1 = ret[1];
690
+ return getStringFromWasm0(ret[0], ret[1]);
691
+ } finally {
692
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
693
+ }
694
+ }
695
+
696
+ /**
697
+ * Run a turn through the real meerkat agent loop via AgentFactory::build_agent().
698
+ *
699
+ * Returns JSON: `{ "text", "usage", "status", "session_id", "turns", "tool_calls" }`
700
+ *
701
+ * Convention: always resolves (Ok). Check `status` field for "completed" vs "failed".
702
+ * Only rejects (Err) for infrastructure errors (session not found, build failure).
703
+ * Agent-level errors (LLM failure, timeout) resolve with `status: "failed"` + `error` field.
704
+ * @param {number} handle
705
+ * @param {string} prompt
706
+ * @param {string} options_json
707
+ * @returns {Promise<any>}
708
+ */
709
+ export function start_turn(handle, prompt, options_json) {
710
+ const ptr0 = passStringToWasm0(prompt, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
711
+ const len0 = WASM_VECTOR_LEN;
712
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
713
+ const len1 = WASM_VECTOR_LEN;
714
+ const ret = wasm.start_turn(handle, ptr0, len0, ptr1, len1);
715
+ return ret;
716
+ }
717
+
718
+ /**
719
+ * Entry point invoked by JavaScript in a worker.
720
+ * @param {number} ptr
721
+ */
722
+ export function task_worker_entry_point(ptr) {
723
+ const ret = wasm.task_worker_entry_point(ptr);
724
+ if (ret[1]) {
725
+ throw takeFromExternrefTable0(ret[0]);
726
+ }
727
+ }
728
+
729
+ /**
730
+ * Wire bidirectional comms trust between meerkats in DIFFERENT mobs.
731
+ *
732
+ * Unlike `mob_wire` (which is intra-mob), this establishes peer trust across
733
+ * mob boundaries by accessing each member's comms runtime through the shared
734
+ * session service. Both members must have comms enabled.
735
+ * @param {string} mob_a
736
+ * @param {string} meerkat_a
737
+ * @param {string} mob_b
738
+ * @param {string} meerkat_b
739
+ * @returns {Promise<void>}
740
+ */
741
+ export function wire_cross_mob(mob_a, meerkat_a, mob_b, meerkat_b) {
742
+ const ptr0 = passStringToWasm0(mob_a, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
743
+ const len0 = WASM_VECTOR_LEN;
744
+ const ptr1 = passStringToWasm0(meerkat_a, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
745
+ const len1 = WASM_VECTOR_LEN;
746
+ const ptr2 = passStringToWasm0(mob_b, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
747
+ const len2 = WASM_VECTOR_LEN;
748
+ const ptr3 = passStringToWasm0(meerkat_b, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
749
+ const len3 = WASM_VECTOR_LEN;
750
+ const ret = wasm.wire_cross_mob(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
751
+ return ret;
752
+ }
753
+
754
+ function __wbg_get_imports() {
755
+ const import0 = {
756
+ __proto__: null,
757
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
758
+ const ret = debugString(arg1);
759
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
760
+ const len1 = WASM_VECTOR_LEN;
761
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
762
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
763
+ },
764
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
765
+ const ret = typeof(arg0) === 'function';
766
+ return ret;
767
+ },
768
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
769
+ const val = arg0;
770
+ const ret = typeof(val) === 'object' && val !== null;
771
+ return ret;
772
+ },
773
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
774
+ const ret = typeof(arg0) === 'string';
775
+ return ret;
776
+ },
777
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
778
+ const ret = arg0 === undefined;
779
+ return ret;
780
+ },
781
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
782
+ const obj = arg1;
783
+ const ret = typeof(obj) === 'string' ? obj : undefined;
784
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
785
+ var len1 = WASM_VECTOR_LEN;
786
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
787
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
788
+ },
789
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
790
+ throw new Error(getStringFromWasm0(arg0, arg1));
791
+ },
792
+ __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
793
+ arg0._wbg_cb_unref();
794
+ },
795
+ __wbg_abort_2f0584e03e8e3950: function(arg0) {
796
+ arg0.abort();
797
+ },
798
+ __wbg_abort_d549b92d3c665de1: function(arg0, arg1) {
799
+ arg0.abort(arg1);
800
+ },
801
+ __wbg_append_a992ccc37aa62dc4: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
802
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
803
+ }, arguments); },
804
+ __wbg_body_3a0b4437dadea6bf: function(arg0) {
805
+ const ret = arg0.body;
806
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
807
+ },
808
+ __wbg_buffer_26d0910f3a5bc899: function(arg0) {
809
+ const ret = arg0.buffer;
810
+ return ret;
811
+ },
812
+ __wbg_byobRequest_80e594e6da4e1af7: function(arg0) {
813
+ const ret = arg0.byobRequest;
814
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
815
+ },
816
+ __wbg_byteLength_3417f266f4bf562a: function(arg0) {
817
+ const ret = arg0.byteLength;
818
+ return ret;
819
+ },
820
+ __wbg_byteOffset_f88547ca47c86358: function(arg0) {
821
+ const ret = arg0.byteOffset;
822
+ return ret;
823
+ },
824
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
825
+ const ret = arg0.call(arg1);
826
+ return ret;
827
+ }, arguments); },
828
+ __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
829
+ const ret = arg0.call(arg1, arg2);
830
+ return ret;
831
+ }, arguments); },
832
+ __wbg_cancel_2c0a0a251ff6b2b7: function(arg0) {
833
+ const ret = arg0.cancel();
834
+ return ret;
835
+ },
836
+ __wbg_catch_c1f8c7623b458214: function(arg0, arg1) {
837
+ const ret = arg0.catch(arg1);
838
+ return ret;
839
+ },
840
+ __wbg_clearInterval_f58e642200529dfb: function(arg0) {
841
+ globalThis.clearInterval(arg0);
842
+ },
843
+ __wbg_clearTimeout_42d9ccd50822fd3a: function(arg0) {
844
+ const ret = clearTimeout(arg0);
845
+ return ret;
846
+ },
847
+ __wbg_close_06dfa0a815b9d71f: function() { return handleError(function (arg0) {
848
+ arg0.close();
849
+ }, arguments); },
850
+ __wbg_close_a79afee31de55b36: function() { return handleError(function (arg0) {
851
+ arg0.close();
852
+ }, arguments); },
853
+ __wbg_crypto_86f2631e91b51511: function(arg0) {
854
+ const ret = arg0.crypto;
855
+ return ret;
856
+ },
857
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
858
+ const ret = arg0.done;
859
+ return ret;
860
+ },
861
+ __wbg_enqueue_2c63f2044f257c3e: function() { return handleError(function (arg0, arg1) {
862
+ arg0.enqueue(arg1);
863
+ }, arguments); },
864
+ __wbg_error_c8eaf2faafef0bdd: function(arg0, arg1) {
865
+ console.error(getStringFromWasm0(arg0, arg1));
866
+ },
867
+ __wbg_eval_3f0b9f0cbaf45a34: function() { return handleError(function (arg0, arg1) {
868
+ const ret = eval(getStringFromWasm0(arg0, arg1));
869
+ return ret;
870
+ }, arguments); },
871
+ __wbg_fetch_6bbc32f991730587: function(arg0) {
872
+ const ret = fetch(arg0);
873
+ return ret;
874
+ },
875
+ __wbg_fetch_afb6a4b6cacf876d: function(arg0, arg1) {
876
+ const ret = arg0.fetch(arg1);
877
+ return ret;
878
+ },
879
+ __wbg_getRandomValues_1c61fac11405ffdc: function() { return handleError(function (arg0, arg1) {
880
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
881
+ }, arguments); },
882
+ __wbg_getRandomValues_9b655bdd369112f2: function() { return handleError(function (arg0, arg1) {
883
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
884
+ }, arguments); },
885
+ __wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
886
+ arg0.getRandomValues(arg1);
887
+ }, arguments); },
888
+ __wbg_getReader_48e00749fe3f6089: function() { return handleError(function (arg0) {
889
+ const ret = arg0.getReader();
890
+ return ret;
891
+ }, arguments); },
892
+ __wbg_getTime_1e3cd1391c5c3995: function(arg0) {
893
+ const ret = arg0.getTime();
894
+ return ret;
895
+ },
896
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
897
+ const ret = Reflect.get(arg0, arg1);
898
+ return ret;
899
+ }, arguments); },
900
+ __wbg_get_done_1ad1c16537f444c6: function(arg0) {
901
+ const ret = arg0.done;
902
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
903
+ },
904
+ __wbg_get_value_6b77a1b7b90c9200: function(arg0) {
905
+ const ret = arg0.value;
906
+ return ret;
907
+ },
908
+ __wbg_has_d4e53238966c12b6: function() { return handleError(function (arg0, arg1) {
909
+ const ret = Reflect.has(arg0, arg1);
910
+ return ret;
911
+ }, arguments); },
912
+ __wbg_headers_59a2938db9f80985: function(arg0) {
913
+ const ret = arg0.headers;
914
+ return ret;
915
+ },
916
+ __wbg_instanceof_Response_ee1d54d79ae41977: function(arg0) {
917
+ let result;
918
+ try {
919
+ result = arg0 instanceof Response;
920
+ } catch (_) {
921
+ result = false;
922
+ }
923
+ const ret = result;
924
+ return ret;
925
+ },
926
+ __wbg_iterator_6ff6560ca1568e55: function() {
927
+ const ret = Symbol.iterator;
928
+ return ret;
929
+ },
930
+ __wbg_length_32ed9a279acd054c: function(arg0) {
931
+ const ret = arg0.length;
932
+ return ret;
933
+ },
934
+ __wbg_log_0cc1b7768397bcfe: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
935
+ let deferred0_0;
936
+ let deferred0_1;
937
+ try {
938
+ deferred0_0 = arg0;
939
+ deferred0_1 = arg1;
940
+ console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
941
+ } finally {
942
+ wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
943
+ }
944
+ },
945
+ __wbg_log_cb9e190acc5753fb: function(arg0, arg1) {
946
+ let deferred0_0;
947
+ let deferred0_1;
948
+ try {
949
+ deferred0_0 = arg0;
950
+ deferred0_1 = arg1;
951
+ console.log(getStringFromWasm0(arg0, arg1));
952
+ } finally {
953
+ wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
954
+ }
955
+ },
956
+ __wbg_mark_7438147ce31e9d4b: function(arg0, arg1) {
957
+ performance.mark(getStringFromWasm0(arg0, arg1));
958
+ },
959
+ __wbg_measure_fb7825c11612c823: function() { return handleError(function (arg0, arg1, arg2, arg3) {
960
+ let deferred0_0;
961
+ let deferred0_1;
962
+ let deferred1_0;
963
+ let deferred1_1;
964
+ try {
965
+ deferred0_0 = arg0;
966
+ deferred0_1 = arg1;
967
+ deferred1_0 = arg2;
968
+ deferred1_1 = arg3;
969
+ performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
970
+ } finally {
971
+ wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
972
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
973
+ }
974
+ }, arguments); },
975
+ __wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
976
+ const ret = arg0.msCrypto;
977
+ return ret;
978
+ },
979
+ __wbg_new_0_73afc35eb544e539: function() {
980
+ const ret = new Date();
981
+ return ret;
982
+ },
983
+ __wbg_new_361308b2356cecd0: function() {
984
+ const ret = new Object();
985
+ return ret;
986
+ },
987
+ __wbg_new_64284bd487f9d239: function() { return handleError(function () {
988
+ const ret = new Headers();
989
+ return ret;
990
+ }, arguments); },
991
+ __wbg_new_72b49615380db768: function(arg0, arg1) {
992
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
993
+ return ret;
994
+ },
995
+ __wbg_new_b5d9e2fb389fef91: function(arg0, arg1) {
996
+ try {
997
+ var state0 = {a: arg0, b: arg1};
998
+ var cb0 = (arg0, arg1) => {
999
+ const a = state0.a;
1000
+ state0.a = 0;
1001
+ try {
1002
+ return wasm_bindgen__convert__closures_____invoke__h4c4b72406261edf7(a, state0.b, arg0, arg1);
1003
+ } finally {
1004
+ state0.a = a;
1005
+ }
1006
+ };
1007
+ const ret = new Promise(cb0);
1008
+ return ret;
1009
+ } finally {
1010
+ state0.a = state0.b = 0;
1011
+ }
1012
+ },
1013
+ __wbg_new_b949e7f56150a5d1: function() { return handleError(function () {
1014
+ const ret = new AbortController();
1015
+ return ret;
1016
+ }, arguments); },
1017
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
1018
+ const ret = new Uint8Array(arg0);
1019
+ return ret;
1020
+ },
1021
+ __wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
1022
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1023
+ return ret;
1024
+ },
1025
+ __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
1026
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1027
+ return ret;
1028
+ },
1029
+ __wbg_new_with_byte_offset_and_length_aa261d9c9da49eb1: function(arg0, arg1, arg2) {
1030
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1031
+ return ret;
1032
+ },
1033
+ __wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
1034
+ const ret = new Uint8Array(arg0 >>> 0);
1035
+ return ret;
1036
+ },
1037
+ __wbg_new_with_str_and_init_a61cbc6bdef21614: function() { return handleError(function (arg0, arg1, arg2) {
1038
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
1039
+ return ret;
1040
+ }, arguments); },
1041
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
1042
+ const ret = arg0.next();
1043
+ return ret;
1044
+ }, arguments); },
1045
+ __wbg_next_418f80d8f5303233: function(arg0) {
1046
+ const ret = arg0.next;
1047
+ return ret;
1048
+ },
1049
+ __wbg_node_e1f24f89a7336c2e: function(arg0) {
1050
+ const ret = arg0.node;
1051
+ return ret;
1052
+ },
1053
+ __wbg_now_2c95c9de01293173: function(arg0) {
1054
+ const ret = arg0.now();
1055
+ return ret;
1056
+ },
1057
+ __wbg_now_37839916ec63896b: function() { return handleError(function () {
1058
+ const ret = Date.now();
1059
+ return ret;
1060
+ }, arguments); },
1061
+ __wbg_now_a3af9a2f4bbaa4d1: function() {
1062
+ const ret = Date.now();
1063
+ return ret;
1064
+ },
1065
+ __wbg_performance_7a3ffd0b17f663ad: function(arg0) {
1066
+ const ret = arg0.performance;
1067
+ return ret;
1068
+ },
1069
+ __wbg_postMessage_2041f4e90af61318: function() { return handleError(function (arg0, arg1) {
1070
+ arg0.postMessage(arg1);
1071
+ }, arguments); },
1072
+ __wbg_process_3975fd6c72f520aa: function(arg0) {
1073
+ const ret = arg0.process;
1074
+ return ret;
1075
+ },
1076
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
1077
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1078
+ },
1079
+ __wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
1080
+ const ret = arg0.queueMicrotask;
1081
+ return ret;
1082
+ },
1083
+ __wbg_queueMicrotask_5bb536982f78a56f: function(arg0) {
1084
+ queueMicrotask(arg0);
1085
+ },
1086
+ __wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
1087
+ arg0.randomFillSync(arg1);
1088
+ }, arguments); },
1089
+ __wbg_read_68fd377df67e19b0: function(arg0) {
1090
+ const ret = arg0.read();
1091
+ return ret;
1092
+ },
1093
+ __wbg_releaseLock_aa5846c2494b3032: function(arg0) {
1094
+ arg0.releaseLock();
1095
+ },
1096
+ __wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
1097
+ const ret = module.require;
1098
+ return ret;
1099
+ }, arguments); },
1100
+ __wbg_resolve_002c4b7d9d8f6b64: function(arg0) {
1101
+ const ret = Promise.resolve(arg0);
1102
+ return ret;
1103
+ },
1104
+ __wbg_respond_bf6ab10399ca8722: function() { return handleError(function (arg0, arg1) {
1105
+ arg0.respond(arg1 >>> 0);
1106
+ }, arguments); },
1107
+ __wbg_setInterval_def8cfc26a20eec7: function(arg0, arg1) {
1108
+ const ret = globalThis.setInterval(arg0, arg1);
1109
+ return ret;
1110
+ },
1111
+ __wbg_setTimeout_4ec014681668a581: function(arg0, arg1) {
1112
+ const ret = setTimeout(arg0, arg1);
1113
+ return ret;
1114
+ },
1115
+ __wbg_setTimeout_c3c682fa1d6caf77: function(arg0, arg1) {
1116
+ globalThis.setTimeout(arg0, arg1);
1117
+ },
1118
+ __wbg_set_body_9a7e00afe3cfe244: function(arg0, arg1) {
1119
+ arg0.body = arg1;
1120
+ },
1121
+ __wbg_set_cache_315a3ed773a41543: function(arg0, arg1) {
1122
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
1123
+ },
1124
+ __wbg_set_cc56eefd2dd91957: function(arg0, arg1, arg2) {
1125
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
1126
+ },
1127
+ __wbg_set_credentials_c4a58d2e05ef24fb: function(arg0, arg1) {
1128
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1129
+ },
1130
+ __wbg_set_headers_cfc5f4b2c1f20549: function(arg0, arg1) {
1131
+ arg0.headers = arg1;
1132
+ },
1133
+ __wbg_set_method_c3e20375f5ae7fac: function(arg0, arg1, arg2) {
1134
+ arg0.method = getStringFromWasm0(arg1, arg2);
1135
+ },
1136
+ __wbg_set_mode_b13642c312648202: function(arg0, arg1) {
1137
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
1138
+ },
1139
+ __wbg_set_signal_f2d3f8599248896d: function(arg0, arg1) {
1140
+ arg0.signal = arg1;
1141
+ },
1142
+ __wbg_signal_d1285ecab4ebc5ad: function(arg0) {
1143
+ const ret = arg0.signal;
1144
+ return ret;
1145
+ },
1146
+ __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
1147
+ const ret = typeof global === 'undefined' ? null : global;
1148
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1149
+ },
1150
+ __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
1151
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1152
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1153
+ },
1154
+ __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
1155
+ const ret = typeof self === 'undefined' ? null : self;
1156
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1157
+ },
1158
+ __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
1159
+ const ret = typeof window === 'undefined' ? null : window;
1160
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1161
+ },
1162
+ __wbg_status_89d7e803db911ee7: function(arg0) {
1163
+ const ret = arg0.status;
1164
+ return ret;
1165
+ },
1166
+ __wbg_stringify_8d1cc6ff383e8bae: function() { return handleError(function (arg0) {
1167
+ const ret = JSON.stringify(arg0);
1168
+ return ret;
1169
+ }, arguments); },
1170
+ __wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
1171
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1172
+ return ret;
1173
+ },
1174
+ __wbg_text_083b8727c990c8c0: function() { return handleError(function (arg0) {
1175
+ const ret = arg0.text();
1176
+ return ret;
1177
+ }, arguments); },
1178
+ __wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
1179
+ const ret = arg0.then(arg1, arg2);
1180
+ return ret;
1181
+ },
1182
+ __wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
1183
+ const ret = arg0.then(arg1);
1184
+ return ret;
1185
+ },
1186
+ __wbg_url_c484c26b1fbf5126: function(arg0, arg1) {
1187
+ const ret = arg1.url;
1188
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1189
+ const len1 = WASM_VECTOR_LEN;
1190
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1191
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1192
+ },
1193
+ __wbg_value_0546255b415e96c1: function(arg0) {
1194
+ const ret = arg0.value;
1195
+ return ret;
1196
+ },
1197
+ __wbg_versions_4e31226f5e8dc909: function(arg0) {
1198
+ const ret = arg0.versions;
1199
+ return ret;
1200
+ },
1201
+ __wbg_view_6c32e7184b8606ad: function(arg0) {
1202
+ const ret = arg0.view;
1203
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1204
+ },
1205
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1206
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1481, function: Function { arguments: [], shim_idx: 1482, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1207
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hb87c6a2b7693073e, wasm_bindgen__convert__closures_____invoke__hc484b96269102350);
1208
+ return ret;
1209
+ },
1210
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1211
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3799, function: Function { arguments: [], shim_idx: 3800, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1212
+ const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17256c949385a6eb, wasm_bindgen__convert__closures_____invoke__h308d3c0b30a9202d);
1213
+ return ret;
1214
+ },
1215
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1216
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3817, function: Function { arguments: [Externref], shim_idx: 3818, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1217
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h824973ba58a55617, wasm_bindgen__convert__closures_____invoke__hf6fd50a67b85890f);
1218
+ return ret;
1219
+ },
1220
+ __wbindgen_cast_0000000000000004: function(arg0) {
1221
+ // Cast intrinsic for `F64 -> Externref`.
1222
+ const ret = arg0;
1223
+ return ret;
1224
+ },
1225
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1226
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1227
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1228
+ return ret;
1229
+ },
1230
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
1231
+ // Cast intrinsic for `Ref(String) -> Externref`.
1232
+ const ret = getStringFromWasm0(arg0, arg1);
1233
+ return ret;
1234
+ },
1235
+ __wbindgen_init_externref_table: function() {
1236
+ const table = wasm.__wbindgen_externrefs;
1237
+ const offset = table.grow(4);
1238
+ table.set(0, undefined);
1239
+ table.set(offset + 0, undefined);
1240
+ table.set(offset + 1, null);
1241
+ table.set(offset + 2, true);
1242
+ table.set(offset + 3, false);
1243
+ },
1244
+ };
1245
+ return {
1246
+ __proto__: null,
1247
+ "./meerkat_web_runtime_bg.js": import0,
1248
+ };
1249
+ }
1250
+
1251
+ function wasm_bindgen__convert__closures_____invoke__hc484b96269102350(arg0, arg1) {
1252
+ wasm.wasm_bindgen__convert__closures_____invoke__hc484b96269102350(arg0, arg1);
1253
+ }
1254
+
1255
+ function wasm_bindgen__convert__closures_____invoke__h308d3c0b30a9202d(arg0, arg1) {
1256
+ wasm.wasm_bindgen__convert__closures_____invoke__h308d3c0b30a9202d(arg0, arg1);
1257
+ }
1258
+
1259
+ function wasm_bindgen__convert__closures_____invoke__hf6fd50a67b85890f(arg0, arg1, arg2) {
1260
+ wasm.wasm_bindgen__convert__closures_____invoke__hf6fd50a67b85890f(arg0, arg1, arg2);
1261
+ }
1262
+
1263
+ function wasm_bindgen__convert__closures_____invoke__h4c4b72406261edf7(arg0, arg1, arg2, arg3) {
1264
+ wasm.wasm_bindgen__convert__closures_____invoke__h4c4b72406261edf7(arg0, arg1, arg2, arg3);
1265
+ }
1266
+
1267
+
1268
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
1269
+
1270
+
1271
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
1272
+
1273
+
1274
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
1275
+
1276
+
1277
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
1278
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1279
+ ? { register: () => {}, unregister: () => {} }
1280
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
1281
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
1282
+ ? { register: () => {}, unregister: () => {} }
1283
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
1284
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1285
+ ? { register: () => {}, unregister: () => {} }
1286
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
1287
+
1288
+ function addToExternrefTable0(obj) {
1289
+ const idx = wasm.__externref_table_alloc_command_export();
1290
+ wasm.__wbindgen_externrefs.set(idx, obj);
1291
+ return idx;
1292
+ }
1293
+
1294
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1295
+ ? { register: () => {}, unregister: () => {} }
1296
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1297
+
1298
+ function debugString(val) {
1299
+ // primitive types
1300
+ const type = typeof val;
1301
+ if (type == 'number' || type == 'boolean' || val == null) {
1302
+ return `${val}`;
1303
+ }
1304
+ if (type == 'string') {
1305
+ return `"${val}"`;
1306
+ }
1307
+ if (type == 'symbol') {
1308
+ const description = val.description;
1309
+ if (description == null) {
1310
+ return 'Symbol';
1311
+ } else {
1312
+ return `Symbol(${description})`;
1313
+ }
1314
+ }
1315
+ if (type == 'function') {
1316
+ const name = val.name;
1317
+ if (typeof name == 'string' && name.length > 0) {
1318
+ return `Function(${name})`;
1319
+ } else {
1320
+ return 'Function';
1321
+ }
1322
+ }
1323
+ // objects
1324
+ if (Array.isArray(val)) {
1325
+ const length = val.length;
1326
+ let debug = '[';
1327
+ if (length > 0) {
1328
+ debug += debugString(val[0]);
1329
+ }
1330
+ for(let i = 1; i < length; i++) {
1331
+ debug += ', ' + debugString(val[i]);
1332
+ }
1333
+ debug += ']';
1334
+ return debug;
1335
+ }
1336
+ // Test for built-in
1337
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1338
+ let className;
1339
+ if (builtInMatches && builtInMatches.length > 1) {
1340
+ className = builtInMatches[1];
1341
+ } else {
1342
+ // Failed to match the standard '[object ClassName]'
1343
+ return toString.call(val);
1344
+ }
1345
+ if (className == 'Object') {
1346
+ // we're a user defined class or Object
1347
+ // JSON.stringify avoids problems with cycles, and is generally much
1348
+ // easier than looping through ownProperties of `val`.
1349
+ try {
1350
+ return 'Object(' + JSON.stringify(val) + ')';
1351
+ } catch (_) {
1352
+ return 'Object';
1353
+ }
1354
+ }
1355
+ // errors
1356
+ if (val instanceof Error) {
1357
+ return `${val.name}: ${val.message}\n${val.stack}`;
1358
+ }
1359
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1360
+ return className;
1361
+ }
1362
+
1363
+ function getArrayU8FromWasm0(ptr, len) {
1364
+ ptr = ptr >>> 0;
1365
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1366
+ }
1367
+
1368
+ let cachedDataViewMemory0 = null;
1369
+ function getDataViewMemory0() {
1370
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1371
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1372
+ }
1373
+ return cachedDataViewMemory0;
1374
+ }
1375
+
1376
+ function getStringFromWasm0(ptr, len) {
1377
+ ptr = ptr >>> 0;
1378
+ return decodeText(ptr, len);
1379
+ }
1380
+
1381
+ let cachedUint8ArrayMemory0 = null;
1382
+ function getUint8ArrayMemory0() {
1383
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1384
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1385
+ }
1386
+ return cachedUint8ArrayMemory0;
1387
+ }
1388
+
1389
+ function handleError(f, args) {
1390
+ try {
1391
+ return f.apply(this, args);
1392
+ } catch (e) {
1393
+ const idx = addToExternrefTable0(e);
1394
+ wasm.__wbindgen_exn_store_command_export(idx);
1395
+ }
1396
+ }
1397
+
1398
+ function isLikeNone(x) {
1399
+ return x === undefined || x === null;
1400
+ }
1401
+
1402
+ function makeClosure(arg0, arg1, dtor, f) {
1403
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1404
+ const real = (...args) => {
1405
+
1406
+ // First up with a closure we increment the internal reference
1407
+ // count. This ensures that the Rust closure environment won't
1408
+ // be deallocated while we're invoking it.
1409
+ state.cnt++;
1410
+ try {
1411
+ return f(state.a, state.b, ...args);
1412
+ } finally {
1413
+ real._wbg_cb_unref();
1414
+ }
1415
+ };
1416
+ real._wbg_cb_unref = () => {
1417
+ if (--state.cnt === 0) {
1418
+ state.dtor(state.a, state.b);
1419
+ state.a = 0;
1420
+ CLOSURE_DTORS.unregister(state);
1421
+ }
1422
+ };
1423
+ CLOSURE_DTORS.register(real, state, state);
1424
+ return real;
1425
+ }
1426
+
1427
+ function makeMutClosure(arg0, arg1, dtor, f) {
1428
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1429
+ const real = (...args) => {
1430
+
1431
+ // First up with a closure we increment the internal reference
1432
+ // count. This ensures that the Rust closure environment won't
1433
+ // be deallocated while we're invoking it.
1434
+ state.cnt++;
1435
+ const a = state.a;
1436
+ state.a = 0;
1437
+ try {
1438
+ return f(a, state.b, ...args);
1439
+ } finally {
1440
+ state.a = a;
1441
+ real._wbg_cb_unref();
1442
+ }
1443
+ };
1444
+ real._wbg_cb_unref = () => {
1445
+ if (--state.cnt === 0) {
1446
+ state.dtor(state.a, state.b);
1447
+ state.a = 0;
1448
+ CLOSURE_DTORS.unregister(state);
1449
+ }
1450
+ };
1451
+ CLOSURE_DTORS.register(real, state, state);
1452
+ return real;
1453
+ }
1454
+
1455
+ function passArray8ToWasm0(arg, malloc) {
1456
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1457
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1458
+ WASM_VECTOR_LEN = arg.length;
1459
+ return ptr;
1460
+ }
1461
+
1462
+ function passStringToWasm0(arg, malloc, realloc) {
1463
+ if (realloc === undefined) {
1464
+ const buf = cachedTextEncoder.encode(arg);
1465
+ const ptr = malloc(buf.length, 1) >>> 0;
1466
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1467
+ WASM_VECTOR_LEN = buf.length;
1468
+ return ptr;
1469
+ }
1470
+
1471
+ let len = arg.length;
1472
+ let ptr = malloc(len, 1) >>> 0;
1473
+
1474
+ const mem = getUint8ArrayMemory0();
1475
+
1476
+ let offset = 0;
1477
+
1478
+ for (; offset < len; offset++) {
1479
+ const code = arg.charCodeAt(offset);
1480
+ if (code > 0x7F) break;
1481
+ mem[ptr + offset] = code;
1482
+ }
1483
+ if (offset !== len) {
1484
+ if (offset !== 0) {
1485
+ arg = arg.slice(offset);
1486
+ }
1487
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1488
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1489
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1490
+
1491
+ offset += ret.written;
1492
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1493
+ }
1494
+
1495
+ WASM_VECTOR_LEN = offset;
1496
+ return ptr;
1497
+ }
1498
+
1499
+ function takeFromExternrefTable0(idx) {
1500
+ const value = wasm.__wbindgen_externrefs.get(idx);
1501
+ wasm.__externref_table_dealloc_command_export(idx);
1502
+ return value;
1503
+ }
1504
+
1505
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1506
+ cachedTextDecoder.decode();
1507
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1508
+ let numBytesDecoded = 0;
1509
+ function decodeText(ptr, len) {
1510
+ numBytesDecoded += len;
1511
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1512
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1513
+ cachedTextDecoder.decode();
1514
+ numBytesDecoded = len;
1515
+ }
1516
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1517
+ }
1518
+
1519
+ const cachedTextEncoder = new TextEncoder();
1520
+
1521
+ if (!('encodeInto' in cachedTextEncoder)) {
1522
+ cachedTextEncoder.encodeInto = function (arg, view) {
1523
+ const buf = cachedTextEncoder.encode(arg);
1524
+ view.set(buf);
1525
+ return {
1526
+ read: arg.length,
1527
+ written: buf.length
1528
+ };
1529
+ };
1530
+ }
1531
+
1532
+ let WASM_VECTOR_LEN = 0;
1533
+
1534
+ let wasmModule, wasm;
1535
+ function __wbg_finalize_init(instance, module) {
1536
+ wasm = instance.exports;
1537
+ wasmModule = module;
1538
+ cachedDataViewMemory0 = null;
1539
+ cachedUint8ArrayMemory0 = null;
1540
+ wasm.__wbindgen_start();
1541
+ return wasm;
1542
+ }
1543
+
1544
+ async function __wbg_load(module, imports) {
1545
+ if (typeof Response === 'function' && module instanceof Response) {
1546
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1547
+ try {
1548
+ return await WebAssembly.instantiateStreaming(module, imports);
1549
+ } catch (e) {
1550
+ const validResponse = module.ok && expectedResponseType(module.type);
1551
+
1552
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1553
+ 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);
1554
+
1555
+ } else { throw e; }
1556
+ }
1557
+ }
1558
+
1559
+ const bytes = await module.arrayBuffer();
1560
+ return await WebAssembly.instantiate(bytes, imports);
1561
+ } else {
1562
+ const instance = await WebAssembly.instantiate(module, imports);
1563
+
1564
+ if (instance instanceof WebAssembly.Instance) {
1565
+ return { instance, module };
1566
+ } else {
1567
+ return instance;
1568
+ }
1569
+ }
1570
+
1571
+ function expectedResponseType(type) {
1572
+ switch (type) {
1573
+ case 'basic': case 'cors': case 'default': return true;
1574
+ }
1575
+ return false;
1576
+ }
1577
+ }
1578
+
1579
+ function initSync(module) {
1580
+ if (wasm !== undefined) return wasm;
1581
+
1582
+
1583
+ if (module !== undefined) {
1584
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1585
+ ({module} = module)
1586
+ } else {
1587
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1588
+ }
1589
+ }
1590
+
1591
+ const imports = __wbg_get_imports();
1592
+ if (!(module instanceof WebAssembly.Module)) {
1593
+ module = new WebAssembly.Module(module);
1594
+ }
1595
+ const instance = new WebAssembly.Instance(module, imports);
1596
+ return __wbg_finalize_init(instance, module);
1597
+ }
1598
+
1599
+ async function __wbg_init(module_or_path) {
1600
+ if (wasm !== undefined) return wasm;
1601
+
1602
+
1603
+ if (module_or_path !== undefined) {
1604
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1605
+ ({module_or_path} = module_or_path)
1606
+ } else {
1607
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1608
+ }
1609
+ }
1610
+
1611
+ if (module_or_path === undefined) {
1612
+ module_or_path = new URL('meerkat_web_runtime_bg.wasm', import.meta.url);
1613
+ }
1614
+ const imports = __wbg_get_imports();
1615
+
1616
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1617
+ module_or_path = fetch(module_or_path);
1618
+ }
1619
+
1620
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1621
+
1622
+ return __wbg_finalize_init(instance, module);
1623
+ }
1624
+
1625
+ export { initSync, __wbg_init as default };