logic-mesh 1.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Controls the execution or the blocks.
2
+ * Controls the execution of blocks.
3
+ *
3
4
  * Loads programs and enables inspection and debugging
4
- * of the blocks and their inputs and outputs.
5
+ * of blocks and their inputs and outputs.
5
6
  */
6
7
  export class BlocksEngine {
7
8
  static __wrap(ptr) {
@@ -21,6 +22,7 @@ export class BlocksEngine {
21
22
  wasm.__wbg_blocksengine_free(ptr, 0);
22
23
  }
23
24
  /**
25
+ * Returns a new `EngineCommand` handle for sending commands.
24
26
  * @returns {EngineCommand}
25
27
  */
26
28
  engineCommand() {
@@ -28,44 +30,66 @@ export class BlocksEngine {
28
30
  return EngineCommand.__wrap(ret);
29
31
  }
30
32
  /**
31
- * Lists all available blocks
32
- * @returns {Array<any>}
33
+ * Lists the descriptions of all registered blocks.
34
+ * @returns {BlockDesc[]}
33
35
  */
34
36
  listBlocks() {
35
37
  const ret = wasm.blocksengine_listBlocks(this.__wbg_ptr);
36
- return takeObject(ret);
38
+ return ret;
37
39
  }
38
40
  /**
39
- * Create a new instance of an engine
40
- * @param {bigint | null} [sleep_duration]
41
+ * Creates a new engine instance.
42
+ *
43
+ * `scan_interval` is the engine's scan interval in milliseconds:
44
+ * how long a block that runs on every cycle waits between runs.
45
+ * Left out, the engine's default applies. A fraction of a
46
+ * millisecond is dropped.
47
+ *
48
+ * Throws a `LogicMeshError` with the `InvalidArgument` code if
49
+ * `scan_interval` is negative, not finite, or above
50
+ * `Number.MAX_SAFE_INTEGER`.
51
+ * @param {number | null} [scan_interval]
41
52
  */
42
- constructor(sleep_duration) {
43
- const ret = wasm.blocksengine_new(!isLikeNone(sleep_duration), isLikeNone(sleep_duration) ? BigInt(0) : sleep_duration);
44
- this.__wbg_ptr = ret;
45
- BlocksEngineFinalization.register(this, this.__wbg_ptr, this);
46
- return this;
53
+ constructor(scan_interval) {
54
+ try {
55
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
56
+ wasm.blocksengine_new(retptr, !isLikeNone(scan_interval), isLikeNone(scan_interval) ? 0 : scan_interval);
57
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
58
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
59
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
60
+ if (r2) {
61
+ throw takeFromExternrefTable0(r1);
62
+ }
63
+ this.__wbg_ptr = r0;
64
+ BlocksEngineFinalization.register(this, this.__wbg_ptr, this);
65
+ return this;
66
+ } finally {
67
+ wasm.__wbindgen_add_to_stack_pointer(16);
68
+ }
47
69
  }
48
70
  /**
49
- * Register a new JS block in the registry
50
- * The block is described by a JsBlockDesc object
71
+ * Registers a new JS block in the registry and returns its name.
51
72
  *
52
- * # Arguments
53
- * * `desc` - The description of the block
54
- * * `func` - Optional function that implements the block
55
- * logic. If not provided, the block would do nothing.
73
+ * `func`, if provided, is a factory that returns the function
74
+ * executing the block — without it (`null` or `undefined`) the
75
+ * block is a no-op. Pin kinds must be the lowercase Haystack names
76
+ * (`"number"`, `"str"`, …).
56
77
  *
57
- * # Returns
58
- * The name of the block
59
- * @param {any} desc
60
- * @param {Function | null} [func]
78
+ * Throws a `LogicMeshError`: `InvalidArgument` if `desc` is not a
79
+ * block description or `func` is neither a function nor left out,
80
+ * `UnknownPinKind`, `UnknownRunCondition` or `BlockNotExternal` for
81
+ * a bad field, and `BlockAlreadyRegistered` if the library already
82
+ * has a block of that name. Nothing is registered then.
83
+ * @param {BlockDesc} desc
84
+ * @param {JsBlockFactory | null | void} func
61
85
  * @returns {string}
62
86
  */
63
87
  registerBlock(desc, func) {
64
88
  let deferred2_0;
65
89
  let deferred2_1;
66
90
  try {
67
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
68
- wasm.blocksengine_registerBlock(retptr, this.__wbg_ptr, addHeapObject(desc), isLikeNone(func) ? 0 : addHeapObject(func));
91
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
92
+ wasm.blocksengine_registerBlock(retptr, this.__wbg_ptr, desc, func);
69
93
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
70
94
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
71
95
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -74,31 +98,92 @@ export class BlocksEngine {
74
98
  var len1 = r1;
75
99
  if (r3) {
76
100
  ptr1 = 0; len1 = 0;
77
- throw takeObject(r2);
101
+ throw takeFromExternrefTable0(r2);
78
102
  }
79
103
  deferred2_0 = ptr1;
80
104
  deferred2_1 = len1;
81
105
  return getStringFromWasm0(ptr1, len1);
82
106
  } finally {
83
107
  wasm.__wbindgen_add_to_stack_pointer(16);
84
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
108
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
109
+ }
110
+ }
111
+ /**
112
+ * Registers a JavaScript-implemented connector under `name` in
113
+ * the process-wide connector registry, as the module-level
114
+ * `registerConnector` function does, and throws as it does.
115
+ *
116
+ * Attach the registered connector to the running engine with the
117
+ * `addConnector` engine command.
118
+ * @param {string} name
119
+ * @param {JsConnector} connector
120
+ */
121
+ registerConnector(name, connector) {
122
+ try {
123
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
124
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
125
+ const len0 = WASM_VECTOR_LEN;
126
+ wasm.blocksengine_registerConnector(retptr, this.__wbg_ptr, ptr0, len0, connector);
127
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
128
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
129
+ if (r1) {
130
+ throw takeFromExternrefTable0(r0);
131
+ }
132
+ } finally {
133
+ wasm.__wbindgen_add_to_stack_pointer(16);
85
134
  }
86
135
  }
87
136
  /**
88
- * Runs the engine asynchronously
89
- * After this is called, the engine instance can't be used directly
90
- * Instead use the command object to communicate with the engine.
137
+ * Runs the engine asynchronously.
138
+ *
139
+ * After this is called, the engine instance can't be used directly —
140
+ * use the command object to communicate with the engine instead.
91
141
  * @returns {Promise<void>}
92
142
  */
93
143
  run() {
94
144
  const ret = wasm.blocksengine_run(this.__wbg_ptr);
95
- return takeObject(ret);
145
+ return ret;
146
+ }
147
+ /**
148
+ * Removes the connector registered under `name` from the
149
+ * process-wide connector registry, returning whether a connector
150
+ * was removed, as the module-level `unregisterConnector` function
151
+ * does.
152
+ *
153
+ * Meant for a connector that was registered but never attached. A
154
+ * connector attached to the running engine should instead be
155
+ * removed with the `removeConnector` engine command, which
156
+ * detaches and stops it before unregistering.
157
+ * @param {string} name
158
+ * @returns {boolean}
159
+ */
160
+ unregisterConnector(name) {
161
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
162
+ const len0 = WASM_VECTOR_LEN;
163
+ const ret = wasm.blocksengine_unregisterConnector(this.__wbg_ptr, ptr0, len0);
164
+ return ret !== 0;
96
165
  }
97
166
  }
98
167
  if (Symbol.dispose) BlocksEngine.prototype[Symbol.dispose] = BlocksEngine.prototype.free;
99
168
 
100
169
  /**
101
170
  * Commands a running instance of a Block Engine.
171
+ *
172
+ * Every method sends one request and resolves with the engine's
173
+ * response to it. Calls on one handle may overlap freely, and every
174
+ * handle feeds the same engine, which handles requests in the order
175
+ * they arrive.
176
+ *
177
+ * A failed request rejects its promise with a `LogicMeshError`: an
178
+ * `Error` whose `code` property is the stable name of the failure —
179
+ * `BlockInstanceNotFound`, `UnsupportedProgramVersion`, … — and whose
180
+ * `message` describes it.
181
+ *
182
+ * Haystack values reach JavaScript in one encoding, from every method
183
+ * and in every watch notification, JS block call and connector call
184
+ * alike: the Haystack JSON encoding as JSON-compatible values. A Dict
185
+ * is a plain object, never a `Map`, and `Null`, or a missing value, is
186
+ * `null`, never `undefined`.
102
187
  */
103
188
  export class EngineCommand {
104
189
  static __wrap(ptr) {
@@ -118,151 +203,193 @@ export class EngineCommand {
118
203
  wasm.__wbg_enginecommand_free(ptr, 0);
119
204
  }
120
205
  /**
121
- * Adds a block instance to the engine
122
- * to be immediately scheduled for execution
206
+ * Adds a block instance to the engine, immediately scheduling it
207
+ * for execution, and resolves with its id. Without `lib`, the block
208
+ * is looked up in every library, and a name more than one library
209
+ * holds is rejected.
123
210
  * @param {string} block_name
124
211
  * @param {string | null} [block_uuid]
125
212
  * @param {string | null} [lib]
126
213
  * @returns {Promise<string>}
127
214
  */
128
215
  addBlock(block_name, block_uuid, lib) {
129
- const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
130
- const len0 = WASM_VECTOR_LEN;
131
- var ptr1 = isLikeNone(block_uuid) ? 0 : passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
132
- var len1 = WASM_VECTOR_LEN;
133
- var ptr2 = isLikeNone(lib) ? 0 : passStringToWasm0(lib, wasm.__wbindgen_export, wasm.__wbindgen_export2);
134
- var len2 = WASM_VECTOR_LEN;
216
+ let ptr0, len0, ptr1, len1, ptr2, len2;
217
+ try {
218
+ ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
219
+ len0 = WASM_VECTOR_LEN;
220
+ ptr1 = isLikeNone(block_uuid) ? 0 : passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
221
+ len1 = WASM_VECTOR_LEN;
222
+ ptr2 = isLikeNone(lib) ? 0 : passStringToWasm0(lib, wasm.__wbindgen_export, wasm.__wbindgen_export2);
223
+ len2 = WASM_VECTOR_LEN;
224
+ } catch (e) {
225
+ if (ptr2) { wasm.__wbindgen_export3(ptr2, len2 * 1, 1); }
226
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 1, 1); }
227
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
228
+ throw e;
229
+ }
135
230
  const ret = wasm.enginecommand_addBlock(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
136
- return takeObject(ret);
231
+ return ret;
137
232
  }
138
233
  /**
139
- * Creates a link between two blocks
234
+ * Attaches an already-registered connector, by name, to the
235
+ * running engine: the engine resolves the name in the process-wide
236
+ * connector registry, starts the connector, and manages its
237
+ * lifecycle from then on. Register the connector first, with
238
+ * `registerConnector`.
140
239
  *
141
- * # Arguments
142
- * * `source_block_uuid` - The UUID of the source block
143
- * * `target_block_uuid` - The UUID of the target block
144
- * * `source_block_pin_name` - The name of the output pin of the source block
145
- * * `target_block_input_name` - The name of the input pin of the target block
146
- *
147
- * # Returns
148
- * A `LinkData` object with the following properties:
149
- * * `source_block_uuid` - The UUID of the source block
150
- * * `target_block_uuid` - The UUID of the target block
151
- * * `source_block_pin_name` - The name of the output pin of the source block
152
- * * `target_block_input_name` - The name of the input pin of the target block
240
+ * A paused engine still answers this request, like every other.
241
+ * @param {string} name
242
+ * @returns {Promise<string>}
243
+ */
244
+ addConnector(name) {
245
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ const ret = wasm.enginecommand_addConnector(this.__wbg_ptr, ptr0, len0);
248
+ return ret;
249
+ }
250
+ /**
251
+ * Links an output (or input) of one block to an input of another,
252
+ * and resolves with the link, its id assigned.
153
253
  * @param {string} source_block_uuid
154
254
  * @param {string} target_block_uuid
155
255
  * @param {string} source_block_pin_name
156
256
  * @param {string} target_block_pin_name
157
- * @returns {Promise<any>}
257
+ * @returns {LinkData}
158
258
  */
159
259
  createLink(source_block_uuid, target_block_uuid, source_block_pin_name, target_block_pin_name) {
160
- const ptr0 = passStringToWasm0(source_block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
161
- const len0 = WASM_VECTOR_LEN;
162
- const ptr1 = passStringToWasm0(target_block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
163
- const len1 = WASM_VECTOR_LEN;
164
- const ptr2 = passStringToWasm0(source_block_pin_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
165
- const len2 = WASM_VECTOR_LEN;
166
- const ptr3 = passStringToWasm0(target_block_pin_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
167
- const len3 = WASM_VECTOR_LEN;
260
+ let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
261
+ try {
262
+ ptr0 = passStringToWasm0(source_block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
263
+ len0 = WASM_VECTOR_LEN;
264
+ ptr1 = passStringToWasm0(target_block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
265
+ len1 = WASM_VECTOR_LEN;
266
+ ptr2 = passStringToWasm0(source_block_pin_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
267
+ len2 = WASM_VECTOR_LEN;
268
+ ptr3 = passStringToWasm0(target_block_pin_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
269
+ len3 = WASM_VECTOR_LEN;
270
+ } catch (e) {
271
+ if (ptr3) { wasm.__wbindgen_export3(ptr3, len3 * 1, 1); }
272
+ if (ptr2) { wasm.__wbindgen_export3(ptr2, len2 * 1, 1); }
273
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 1, 1); }
274
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
275
+ throw e;
276
+ }
168
277
  const ret = wasm.enginecommand_createLink(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
169
- return takeObject(ret);
278
+ return ret;
170
279
  }
171
280
  /**
172
- * Creates a watch on block changes.
281
+ * Opens a watch on block changes: from now on `callback` is called
282
+ * with a notification for every block change, until `removeWatch`
283
+ * closes the watch. Resolves with the watch's id once the engine
284
+ * opened it.
173
285
  *
174
- * The engine→UI watch channel is **unbounded**. The producer rate is
175
- * capped by per-block execution cadence and the payload is tiny
176
- * (one `WatchMessage` per changed block per cycle); a bounded channel
177
- * (we had 32) was undersized for bursty loads — e.g., dozens of
178
- * blocks faulting simultaneously during program load — and silently
179
- * dropped fault notifications, which the UI is now load-bearing on
180
- * (red ring/edge rendering).
181
- * @param {Function} callback
182
- * @returns {Promise<void>}
286
+ * Notifications are queued without bound between the engine and
287
+ * the callback, so a burst — such as many blocks faulting while a
288
+ * program loads — is never dropped.
289
+ * @param {(notification: BlockNotification) => void} callback
290
+ * @returns {Promise<number>}
183
291
  */
184
292
  createWatch(callback) {
185
- const ret = wasm.enginecommand_createWatch(this.__wbg_ptr, addHeapObject(callback));
186
- return takeObject(ret);
293
+ const ret = wasm.enginecommand_createWatch(this.__wbg_ptr, callback);
294
+ return ret;
187
295
  }
188
296
  /**
189
- * Evaluates a block by name
190
- * This will create a block instance and execute it.
297
+ * Evaluates a block by name, returning its output values.
191
298
  *
192
- * # Arguments
193
- * * `block_name` - The name of the block to evaluate
194
- * * `inputs` - The input values to the block
195
- * * `lib` - Optional, the library to load the block from, defaults to "core"
196
- *
197
- * # Returns
198
- * A list of values representing the outputs of the block
299
+ * Creates a temporary block instance, feeds it the given `inputs`,
300
+ * executes it, and returns the outputs. Without `lib`, the block is
301
+ * looked up in every library, as for `addBlock`. Each input is read
302
+ * as `writeBlockInput` reads its value. An evaluation still running
303
+ * after 5 s — a block waiting for an input `inputs` does not supply,
304
+ * say — rejects with `EvalTimeout`, and the engine goes on answering
305
+ * commands.
199
306
  * @param {string} block_name
200
- * @param {any[]} inputs
307
+ * @param {unknown[]} inputs
201
308
  * @param {string | null} [lib]
202
- * @returns {Promise<any>}
309
+ * @returns {unknown[]}
203
310
  */
204
311
  evalBlock(block_name, inputs, lib) {
205
- const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
206
- const len0 = WASM_VECTOR_LEN;
207
- const ptr1 = passArrayJsValueToWasm0(inputs, wasm.__wbindgen_export);
208
- const len1 = WASM_VECTOR_LEN;
209
- var ptr2 = isLikeNone(lib) ? 0 : passStringToWasm0(lib, wasm.__wbindgen_export, wasm.__wbindgen_export2);
210
- var len2 = WASM_VECTOR_LEN;
312
+ let ptr0, len0, ptr1, len1, ptr2, len2;
313
+ try {
314
+ ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
315
+ len0 = WASM_VECTOR_LEN;
316
+ ptr1 = passArrayJsValueToWasm0(inputs, wasm.__wbindgen_export);
317
+ len1 = WASM_VECTOR_LEN;
318
+ ptr2 = isLikeNone(lib) ? 0 : passStringToWasm0(lib, wasm.__wbindgen_export, wasm.__wbindgen_export2);
319
+ len2 = WASM_VECTOR_LEN;
320
+ } catch (e) {
321
+ if (ptr2) { wasm.__wbindgen_export3(ptr2, len2 * 1, 1); }
322
+ if (ptr1) { wasm.__wbindgen_export7(ptr1, len1); wasm.__wbindgen_export3(ptr1, len1 * 4, 4); }
323
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
324
+ throw e;
325
+ }
211
326
  const ret = wasm.enginecommand_evalBlock(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
212
- return takeObject(ret);
327
+ return ret;
213
328
  }
214
329
  /**
215
- * Get the current running engine program in the canonical save
216
- * format (Program struct serialized as JSON). Round-trips through
217
- * `loadProgram` without re-assembly.
218
- * @returns {Promise<any>}
330
+ * Returns the engine's current program in the save format, as
331
+ * plain JSON-compatible objects: maps are objects, not `Map`s, and
332
+ * a missing value is `null`. Round-trips through `loadProgram`,
333
+ * editor metadata included.
334
+ * @returns {Program}
219
335
  */
220
336
  getProgram() {
221
337
  const ret = wasm.enginecommand_getProgram(this.__wbg_ptr);
222
- return takeObject(ret);
338
+ return ret;
223
339
  }
224
340
  /**
225
- * Inspects the current state of a block
341
+ * Resolves with a block's state and pin values, as plain
342
+ * JSON-compatible objects.
226
343
  * @param {string} block_uuid
227
- * @returns {Promise<any>}
344
+ * @returns {BlockInspection}
228
345
  */
229
346
  inspectBlock(block_uuid) {
230
347
  const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
231
348
  const len0 = WASM_VECTOR_LEN;
232
349
  const ret = wasm.enginecommand_inspectBlock(this.__wbg_ptr, ptr0, len0);
233
- return takeObject(ret);
350
+ return ret;
351
+ }
352
+ /**
353
+ * Lists the names of the engine-managed connectors.
354
+ *
355
+ * A paused engine still answers this request, like every other.
356
+ * @returns {Promise<string[]>}
357
+ */
358
+ listConnectors() {
359
+ const ret = wasm.enginecommand_listConnectors(this.__wbg_ptr);
360
+ return ret;
234
361
  }
235
362
  /**
236
- * Atomically load a full program (blocks + links + pin values +
237
- * UI metadata) into the engine. Replaces the previous JS-side
238
- * `addBlock` + `createLink` + `writeBlockInput` chain. The engine
239
- * is expected to be empty (call `resetEngine` first if reloading).
240
- * @param {any} program
363
+ * Loads a full program (blocks, links, pin values, UI and editor
364
+ * metadata) into the engine, all or nothing. The engine is
365
+ * expected to be empty: call `resetEngine` first if reloading.
366
+ *
367
+ * A program with no `version` is a save from before format
368
+ * versions, and loads as one. A program from a newer format is
369
+ * rejected with the `UnsupportedProgramVersion` code before its
370
+ * shape is read; one that is not a program at all with
371
+ * `InvalidProgram`.
372
+ * @param {Program} program
241
373
  * @returns {Promise<void>}
242
374
  */
243
375
  loadProgram(program) {
244
- const ret = wasm.enginecommand_loadProgram(this.__wbg_ptr, addHeapObject(program));
245
- return takeObject(ret);
376
+ const ret = wasm.enginecommand_loadProgram(this.__wbg_ptr, program);
377
+ return ret;
246
378
  }
247
379
  /**
248
- * Pauses the execution of the engine
249
- * If the engine is already paused, this does nothing
380
+ * Pauses block execution: no block executes until
381
+ * `resumeExecution`, while every other request is still answered.
382
+ * Connector IO tasks keep running. Does nothing if already paused.
383
+ * Resolves once the engine paused.
250
384
  * @returns {Promise<void>}
251
385
  */
252
386
  pauseExecution() {
253
387
  const ret = wasm.enginecommand_pauseExecution(this.__wbg_ptr);
254
- return takeObject(ret);
388
+ return ret;
255
389
  }
256
390
  /**
257
- * Removes a block instance from the engine
258
- * to be immediately unscheduled for execution
259
- * and removed from the engine together with all its links.
260
- *
261
- * # Arguments
262
- * * `block_uuid` - The UUID of the block to be removed
263
- *
264
- * # Returns
265
- * The UUID of the removed block
391
+ * Removes a block instance and all its links from the engine,
392
+ * returning the UUID of the removed block.
266
393
  * @param {string} block_uuid
267
394
  * @returns {Promise<string>}
268
395
  */
@@ -270,16 +397,25 @@ export class EngineCommand {
270
397
  const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
271
398
  const len0 = WASM_VECTOR_LEN;
272
399
  const ret = wasm.enginecommand_removeBlock(this.__wbg_ptr, ptr0, len0);
273
- return takeObject(ret);
400
+ return ret;
274
401
  }
275
402
  /**
276
- * Removes a link between two blocks
277
- *
278
- * # Arguments
279
- * * `link_uuid` - The UUID of the link to be removed
403
+ * Detaches an engine-managed connector by name: the engine stops
404
+ * tracking it, unregisters it from the process-wide registry, and
405
+ * stops it. Returns the removed connector's name.
280
406
  *
281
- * # Returns
282
- * True if the link was removed, false otherwise
407
+ * A paused engine still answers this request, like every other.
408
+ * @param {string} name
409
+ * @returns {Promise<string>}
410
+ */
411
+ removeConnector(name) {
412
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
413
+ const len0 = WASM_VECTOR_LEN;
414
+ const ret = wasm.enginecommand_removeConnector(this.__wbg_ptr, ptr0, len0);
415
+ return ret;
416
+ }
417
+ /**
418
+ * Removes a link by UUID, returning `true` if it was found and removed.
283
419
  * @param {string} link_uuid
284
420
  * @returns {Promise<boolean>}
285
421
  */
@@ -287,197 +423,435 @@ export class EngineCommand {
287
423
  const ptr0 = passStringToWasm0(link_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
288
424
  const len0 = WASM_VECTOR_LEN;
289
425
  const ret = wasm.enginecommand_removeLink(this.__wbg_ptr, ptr0, len0);
290
- return takeObject(ret);
426
+ return ret;
291
427
  }
292
428
  /**
293
- * Resets the engine state, clears all blocks and links
429
+ * Closes the watch `createWatch` resolved with `watch_id`, resolving
430
+ * with whether the engine had it open. Once this resolves, its
431
+ * callback is not called again.
432
+ *
433
+ * Rejects with the `InvalidArgument` code if `watch_id` cannot be
434
+ * a watch id.
435
+ * @param {number} watch_id
436
+ * @returns {Promise<boolean>}
437
+ */
438
+ removeWatch(watch_id) {
439
+ const ret = wasm.enginecommand_removeWatch(this.__wbg_ptr, watch_id);
440
+ return ret;
441
+ }
442
+ /**
443
+ * Resets the engine state, clearing all blocks and links, and
444
+ * unregistering and stopping the engine-managed connectors — also
445
+ * while paused, and the engine stays paused. Resolves once the
446
+ * reset is done.
294
447
  * @returns {Promise<void>}
295
448
  */
296
449
  resetEngine() {
297
450
  const ret = wasm.enginecommand_resetEngine(this.__wbg_ptr);
298
- return takeObject(ret);
451
+ return ret;
299
452
  }
300
453
  /**
301
- * Resumes the execution of the engine
302
- * If the engine is not paused, this does nothing
454
+ * Resumes block execution. Does nothing if not paused. Resolves
455
+ * once the engine resumed.
303
456
  * @returns {Promise<void>}
304
457
  */
305
458
  resumeExecution() {
306
459
  const ret = wasm.enginecommand_resumeExecution(this.__wbg_ptr);
307
- return takeObject(ret);
460
+ return ret;
461
+ }
462
+ /**
463
+ * Replaces the editor metadata a block is saved with — any JSON
464
+ * object — or removes it if `editor` is `null` or `undefined`.
465
+ * @param {string} block_uuid
466
+ * @param {EditorMetadata | null | undefined} editor
467
+ * @returns {Promise<void>}
468
+ */
469
+ setBlockEditor(block_uuid, editor) {
470
+ const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
471
+ const len0 = WASM_VECTOR_LEN;
472
+ const ret = wasm.enginecommand_setBlockEditor(this.__wbg_ptr, ptr0, len0, editor);
473
+ return ret;
474
+ }
475
+ /**
476
+ * Updates the label and position a block is saved with: each of
477
+ * `label` and `position` that is given replaces the stored one.
478
+ * @param {string} block_uuid
479
+ * @param {string | null | undefined} label
480
+ * @param {Position | null | undefined} position
481
+ * @returns {Promise<void>}
482
+ */
483
+ setBlockMetadata(block_uuid, label, position) {
484
+ let ptr0, len0, ptr1, len1;
485
+ try {
486
+ ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
487
+ len0 = WASM_VECTOR_LEN;
488
+ ptr1 = isLikeNone(label) ? 0 : passStringToWasm0(label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
489
+ len1 = WASM_VECTOR_LEN;
490
+ } catch (e) {
491
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 1, 1); }
492
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
493
+ throw e;
494
+ }
495
+ const ret = wasm.enginecommand_setBlockMetadata(this.__wbg_ptr, ptr0, len0, ptr1, len1, position);
496
+ return ret;
308
497
  }
309
498
  /**
310
- * Stop the engine's execution
499
+ * Stops the engine: `run` resolves, keeping the blocks so a later
500
+ * `run` resumes them. Resolves once block execution and the
501
+ * managed connectors stopped.
311
502
  * @returns {Promise<void>}
312
503
  */
313
504
  stopEngine() {
314
505
  const ret = wasm.enginecommand_stopEngine(this.__wbg_ptr);
315
- return takeObject(ret);
506
+ return ret;
316
507
  }
317
508
  /**
318
- * Writes the given block input with a value
319
- *
320
- * # Arguments
321
- * * `block_uuid` - The UUID of the block to write to
322
- * * `input_name` - The name of the input to write to
323
- * * `value` - The value to write
509
+ * Writes a value to a block's input pin, resolving with the input's
510
+ * previous value, or `null` if it had none.
324
511
  *
325
- * # Returns
326
- * The previous value of the input
512
+ * `value` is a Haystack value in its JSON encoding, made of plain
513
+ * objects and arrays — `Map`s are read as Dicts too; `null` and
514
+ * `undefined` write `Null`.
515
+ * Anything else, such as a `Date` or a function, rejects with the
516
+ * `InvalidValue` code.
327
517
  * @param {string} block_uuid
328
518
  * @param {string} input_name
329
- * @param {any} value
330
- * @returns {Promise<any>}
519
+ * @param {unknown} value
520
+ * @returns {unknown}
331
521
  */
332
522
  writeBlockInput(block_uuid, input_name, value) {
333
- const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
334
- const len0 = WASM_VECTOR_LEN;
335
- const ptr1 = passStringToWasm0(input_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
336
- const len1 = WASM_VECTOR_LEN;
337
- const ret = wasm.enginecommand_writeBlockInput(this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(value));
338
- return takeObject(ret);
523
+ let ptr0, len0, ptr1, len1;
524
+ try {
525
+ ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
526
+ len0 = WASM_VECTOR_LEN;
527
+ ptr1 = passStringToWasm0(input_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
528
+ len1 = WASM_VECTOR_LEN;
529
+ } catch (e) {
530
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 1, 1); }
531
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
532
+ throw e;
533
+ }
534
+ const ret = wasm.enginecommand_writeBlockInput(this.__wbg_ptr, ptr0, len0, ptr1, len1, value);
535
+ return ret;
339
536
  }
340
537
  /**
341
- * Writes the given block out with a value
538
+ * Writes a value to a block's output pin, resolving with the output's
539
+ * previous value.
342
540
  *
343
- * # Arguments
344
- * * `block_uuid` - The UUID of the block to write to
345
- * * `output_name` - The name of the output to write to
346
- * * `value` - The value to write
347
- *
348
- * # Returns
349
- * The block data
541
+ * `value` is a Haystack value in its JSON encoding, made of plain
542
+ * objects and arrays — `Map`s are read as Dicts too; `null` and
543
+ * `undefined` write `Null`.
544
+ * Anything else, such as a `Date` or a function, rejects with the
545
+ * `InvalidValue` code.
350
546
  * @param {string} block_uuid
351
547
  * @param {string} output_name
352
- * @param {any} value
353
- * @returns {Promise<any>}
548
+ * @param {unknown} value
549
+ * @returns {unknown}
354
550
  */
355
551
  writeBlockOutput(block_uuid, output_name, value) {
356
- const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
357
- const len0 = WASM_VECTOR_LEN;
358
- const ptr1 = passStringToWasm0(output_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
- const len1 = WASM_VECTOR_LEN;
360
- const ret = wasm.enginecommand_writeBlockOutput(this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(value));
361
- return takeObject(ret);
552
+ let ptr0, len0, ptr1, len1;
553
+ try {
554
+ ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
555
+ len0 = WASM_VECTOR_LEN;
556
+ ptr1 = passStringToWasm0(output_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
557
+ len1 = WASM_VECTOR_LEN;
558
+ } catch (e) {
559
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 1, 1); }
560
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
561
+ throw e;
562
+ }
563
+ const ret = wasm.enginecommand_writeBlockOutput(this.__wbg_ptr, ptr0, len0, ptr1, len1, value);
564
+ return ret;
362
565
  }
363
566
  }
364
567
  if (Symbol.dispose) EngineCommand.prototype[Symbol.dispose] = EngineCommand.prototype.free;
365
568
 
366
569
  /**
367
- * @param {number | null} [sleep_duration]
570
+ * Reports whether the connector currently registered under `name` is
571
+ * a JavaScript connector wrapping exactly `connector` — compared by
572
+ * JS object identity (`===`), the way JS itself distinguishes two
573
+ * same-shaped objects.
574
+ *
575
+ * This is what lets a JS façade decide *ownership* against the live
576
+ * registry rather than its own bookkeeping: a boolean "I registered
577
+ * this" flag goes stale the moment an engine reset unregisters the
578
+ * connector behind the façade's back, after which the same name may
579
+ * be re-registered by someone else. `false` therefore means either
580
+ * "nothing is registered under `name`" or "something else is".
581
+ * @param {string} name
582
+ * @param {JsConnector} connector
583
+ * @returns {boolean}
584
+ */
585
+ export function connectorIs(name, connector) {
586
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
587
+ const len0 = WASM_VECTOR_LEN;
588
+ const ret = wasm.connectorIs(ptr0, len0, connector);
589
+ return ret !== 0;
590
+ }
591
+
592
+ /**
593
+ * Reports whether a connector is registered under `name` in the
594
+ * process-wide connector registry.
595
+ *
596
+ * Lets JS distinguish "not yet registered" from "registered but
597
+ * stale" (e.g. a registry entry that outlived a module re-init)
598
+ * without attempting a registration just to catch the
599
+ * already-registered error — `registerConnector` rejects duplicates,
600
+ * and the registry lives for the process, not the module.
601
+ * @param {string} name
602
+ * @returns {boolean}
603
+ */
604
+ export function connectorRegistered(name) {
605
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
606
+ const len0 = WASM_VECTOR_LEN;
607
+ const ret = wasm.connectorRegistered(ptr0, len0);
608
+ return ret !== 0;
609
+ }
610
+
611
+ /**
612
+ * Creates a new `BlocksEngine`, as its constructor does.
613
+ *
614
+ * `scan_interval` is the engine's scan interval in milliseconds: how
615
+ * long a block that runs on every cycle waits between runs. Left out,
616
+ * the engine's default applies. A fraction of a millisecond is
617
+ * dropped.
618
+ *
619
+ * Throws a `LogicMeshError` with the `InvalidArgument` code if
620
+ * `scan_interval` is negative, not finite, or above
621
+ * `Number.MAX_SAFE_INTEGER`.
622
+ * @param {number | null} [scan_interval]
368
623
  * @returns {BlocksEngine}
369
624
  */
370
- export function initEngine(sleep_duration) {
371
- const ret = wasm.initEngine(isLikeNone(sleep_duration) ? Number.MAX_SAFE_INTEGER : (sleep_duration) >>> 0);
372
- return BlocksEngine.__wrap(ret);
625
+ export function initEngine(scan_interval) {
626
+ try {
627
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
628
+ wasm.initEngine(retptr, !isLikeNone(scan_interval), isLikeNone(scan_interval) ? 0 : scan_interval);
629
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
630
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
631
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
632
+ if (r2) {
633
+ throw takeFromExternrefTable0(r1);
634
+ }
635
+ return BlocksEngine.__wrap(r0);
636
+ } finally {
637
+ wasm.__wbindgen_add_to_stack_pointer(16);
638
+ }
373
639
  }
374
640
 
375
641
  export function init_panic_hook() {
376
642
  wasm.init_panic_hook();
377
643
  }
378
644
 
645
+ /**
646
+ * Registers a JavaScript-implemented connector under `name` in the
647
+ * process-wide connector registry.
648
+ *
649
+ * `connector` is an object carrying `subscribe`, `publish` and
650
+ * `request` functions plus optional `start` and `stop` (see
651
+ * `JsConnector`). Callable at any time, including while an engine
652
+ * runs; attach the registered connector to a running engine with the
653
+ * `addConnector` engine command.
654
+ *
655
+ * Throws a `LogicMeshError`: `ConnectorMethodMissing`,
656
+ * `ConnectorMethodNotFunction` or `ConnectorPropertyUnreadable` if
657
+ * `connector` does not have the required shape, and
658
+ * `ConnectorAlreadyRegistered` if a connector named `name` is already
659
+ * registered.
660
+ * @param {string} name
661
+ * @param {JsConnector} connector
662
+ */
663
+ export function registerConnector(name, connector) {
664
+ try {
665
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
666
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
667
+ const len0 = WASM_VECTOR_LEN;
668
+ wasm.registerConnector(retptr, ptr0, len0, connector);
669
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
670
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
671
+ if (r1) {
672
+ throw takeFromExternrefTable0(r0);
673
+ }
674
+ } finally {
675
+ wasm.__wbindgen_add_to_stack_pointer(16);
676
+ }
677
+ }
678
+
679
+ /**
680
+ * Sets the most verbose level the module logs to the console at:
681
+ * `'off'`, `'error'`, `'warn'` (the default), `'info'`, `'debug'` or
682
+ * `'trace'`.
683
+ *
684
+ * The level is process-wide, as the `log` crate's is: it also limits
685
+ * a logger a Rust application installed instead of the module's own.
686
+ *
687
+ * Throws a `LogicMeshError` with the `InvalidArgument` code for any
688
+ * other level.
689
+ * @param {LogLevel} level
690
+ */
691
+ export function setLogLevel(level) {
692
+ try {
693
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
694
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export, wasm.__wbindgen_export2);
695
+ const len0 = WASM_VECTOR_LEN;
696
+ wasm.setLogLevel(retptr, ptr0, len0);
697
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
698
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
699
+ if (r1) {
700
+ throw takeFromExternrefTable0(r0);
701
+ }
702
+ } finally {
703
+ wasm.__wbindgen_add_to_stack_pointer(16);
704
+ }
705
+ }
706
+
707
+ /**
708
+ * The module's start hook, which runs when the module loads: routes
709
+ * panics to `console.error` and installs a console logger at the
710
+ * `'warn'` level.
711
+ *
712
+ * Safe to call again, which does nothing. If a logger is already
713
+ * installed, it is kept, and so is its level.
714
+ */
379
715
  export function start() {
380
716
  wasm.start();
381
717
  }
382
- export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
718
+
719
+ /**
720
+ * Removes the connector registered under `name` from the
721
+ * process-wide connector registry, returning whether a connector was
722
+ * removed.
723
+ *
724
+ * Symmetric with `registerConnector` and meant for a connector that
725
+ * was registered but never attached to an engine. A connector
726
+ * attached to a running engine should instead be removed with the
727
+ * `removeConnector` engine command, which detaches and stops it before
728
+ * unregistering — raw unregistration leaves the engine tracking a
729
+ * stale name (the engine copes: detaching it later warns that the
730
+ * connector was already unregistered externally).
731
+ * @param {string} name
732
+ * @returns {boolean}
733
+ */
734
+ export function unregisterConnector(name) {
735
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
736
+ const len0 = WASM_VECTOR_LEN;
737
+ const ret = wasm.unregisterConnector(ptr0, len0);
738
+ return ret !== 0;
739
+ }
740
+ export function __wbg_Error_208446807d0d1e30(arg0, arg1) {
383
741
  const ret = Error(getStringFromWasm0(arg0, arg1));
384
- return addHeapObject(ret);
742
+ return ret;
743
+ }
744
+ export function __wbg_Number_ff192a72a0dcdf6d(arg0) {
745
+ const ret = Number(arg0);
746
+ return ret;
385
747
  }
386
748
  export function __wbg_String_8564e559799eccda(arg0, arg1) {
387
- const ret = String(getObject(arg1));
749
+ const ret = String(arg1);
388
750
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
389
751
  const len1 = WASM_VECTOR_LEN;
390
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
391
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
752
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
753
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
392
754
  }
393
- export function __wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83(arg0, arg1) {
394
- const v = getObject(arg1);
755
+ export function __wbg___wbindgen_bigint_get_as_i64_11da4b52cd0aedef(arg0, arg1) {
756
+ const v = arg1;
395
757
  const ret = typeof(v) === 'bigint' ? v : undefined;
396
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
397
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
758
+ getDataViewMemory0().setBigInt64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
759
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
398
760
  }
399
- export function __wbg___wbindgen_boolean_get_2304fb8c853028c8(arg0) {
400
- const v = getObject(arg0);
761
+ export function __wbg___wbindgen_boolean_get_4f1baf9a00be3c74(arg0) {
762
+ const v = arg0;
401
763
  const ret = typeof(v) === 'boolean' ? v : undefined;
402
764
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
403
765
  }
404
- export function __wbg___wbindgen_debug_string_edece8177ad01481(arg0, arg1) {
405
- const ret = debugString(getObject(arg1));
766
+ export function __wbg___wbindgen_debug_string_f249a2a76caa9a55(arg0, arg1) {
767
+ const ret = debugString(arg1);
406
768
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
407
769
  const len1 = WASM_VECTOR_LEN;
408
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
409
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
770
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
771
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
772
+ }
773
+ export function __wbg___wbindgen_in_3f58a9d3b3a7eed2(arg0, arg1) {
774
+ const ret = arg0 in arg1;
775
+ return ret;
410
776
  }
411
- export function __wbg___wbindgen_in_07056af4f902c445(arg0, arg1) {
412
- const ret = getObject(arg0) in getObject(arg1);
777
+ export function __wbg___wbindgen_is_bigint_5fa10641e039d3ef(arg0) {
778
+ const ret = typeof(arg0) === 'bigint';
413
779
  return ret;
414
780
  }
415
- export function __wbg___wbindgen_is_bigint_aeae3893f30ed54e(arg0) {
416
- const ret = typeof(getObject(arg0)) === 'bigint';
781
+ export function __wbg___wbindgen_is_function_741ff2bb612836f5(arg0) {
782
+ const ret = typeof(arg0) === 'function';
417
783
  return ret;
418
784
  }
419
- export function __wbg___wbindgen_is_function_5cd60d5cf78b4eef(arg0) {
420
- const ret = typeof(getObject(arg0)) === 'function';
785
+ export function __wbg___wbindgen_is_null_c22311b1cc228e3a(arg0) {
786
+ const ret = arg0 === null;
421
787
  return ret;
422
788
  }
423
- export function __wbg___wbindgen_is_object_b4593df85baada48(arg0) {
424
- const val = getObject(arg0);
789
+ export function __wbg___wbindgen_is_object_8b968c3ab8e96595(arg0) {
790
+ const val = arg0;
425
791
  const ret = typeof(val) === 'object' && val !== null;
426
792
  return ret;
427
793
  }
428
- export function __wbg___wbindgen_is_string_dde0fd9020db4434(arg0) {
429
- const ret = typeof(getObject(arg0)) === 'string';
794
+ export function __wbg___wbindgen_is_string_fc456fee5d3317de(arg0) {
795
+ const ret = typeof(arg0) === 'string';
430
796
  return ret;
431
797
  }
432
- export function __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5(arg0) {
433
- const ret = getObject(arg0) === undefined;
798
+ export function __wbg___wbindgen_is_undefined_be5b34249ff1fc15(arg0) {
799
+ const ret = arg0 === undefined;
434
800
  return ret;
435
801
  }
436
- export function __wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9(arg0, arg1) {
437
- const ret = getObject(arg0) === getObject(arg1);
802
+ export function __wbg___wbindgen_jsval_eq_38d7bfbe4cc84039(arg0, arg1) {
803
+ const ret = arg0 === arg1;
438
804
  return ret;
439
805
  }
440
- export function __wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c(arg0, arg1) {
441
- const ret = getObject(arg0) == getObject(arg1);
806
+ export function __wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36(arg0, arg1) {
807
+ const ret = arg0 == arg1;
442
808
  return ret;
443
809
  }
444
- export function __wbg___wbindgen_number_get_f73a1244370fcc2c(arg0, arg1) {
445
- const obj = getObject(arg1);
810
+ export function __wbg___wbindgen_number_get_934b640d0889af78(arg0, arg1) {
811
+ const obj = arg1;
446
812
  const ret = typeof(obj) === 'number' ? obj : undefined;
447
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
448
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
813
+ getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
814
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
449
815
  }
450
- export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
451
- const obj = getObject(arg1);
816
+ export function __wbg___wbindgen_string_get_7ce8eee7fd327545(arg0, arg1) {
817
+ const obj = arg1;
452
818
  const ret = typeof(obj) === 'string' ? obj : undefined;
453
819
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
454
820
  var len1 = WASM_VECTOR_LEN;
455
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
456
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
821
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
822
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
457
823
  }
458
- export function __wbg___wbindgen_throw_9c31b086c2b26051(arg0, arg1) {
824
+ export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
459
825
  throw new Error(getStringFromWasm0(arg0, arg1));
460
826
  }
461
- export function __wbg__wbg_cb_unref_3fa391f3fcdb55f8(arg0) {
462
- getObject(arg0)._wbg_cb_unref();
827
+ export function __wbg___wbindgen_typeof_ee4990276e02f607(arg0) {
828
+ const ret = typeof arg0;
829
+ return ret;
830
+ }
831
+ export function __wbg__wbg_cb_unref_09736879a3f67559(arg0) {
832
+ arg0._wbg_cb_unref();
463
833
  }
464
- export function __wbg_call_13665d9f14390edc() { return handleError(function (arg0, arg1) {
465
- const ret = getObject(arg0).call(getObject(arg1));
466
- return addHeapObject(ret);
834
+ export function __wbg_call_40b008ba32f73991() { return handleError(function (arg0, arg1) {
835
+ const ret = arg0.call(arg1);
836
+ return ret;
837
+ }, arguments); }
838
+ export function __wbg_call_a410eb4b59ed5965() { return handleError(function (arg0, arg1, arg2) {
839
+ const ret = arg0.call(arg1, arg2);
840
+ return ret;
467
841
  }, arguments); }
468
- export function __wbg_call_dfde26266607c996() { return handleError(function (arg0, arg1, arg2) {
469
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
470
- return addHeapObject(ret);
842
+ export function __wbg_call_fc92fee6137d452d() { return handleError(function (arg0, arg1, arg2, arg3) {
843
+ const ret = arg0.call(arg1, arg2, arg3);
844
+ return ret;
471
845
  }, arguments); }
472
- export function __wbg_done_54b8da57023b7ed2(arg0) {
473
- const ret = getObject(arg0).done;
846
+ export function __wbg_done_57e08d0be6e30c02(arg0) {
847
+ const ret = arg0.done;
474
848
  return ret;
475
849
  }
476
- export function __wbg_entries_564a7e8b1e54ede5(arg0) {
477
- const ret = Object.entries(getObject(arg0));
478
- return addHeapObject(ret);
850
+ export function __wbg_entries_7bb1459bd9b5c2b9(arg0) {
851
+ const ret = Object.entries(arg0);
852
+ return ret;
479
853
  }
480
- export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
854
+ export function __wbg_error_757e9472f8410341(arg0, arg1) {
481
855
  let deferred0_0;
482
856
  let deferred0_1;
483
857
  try {
@@ -485,278 +859,366 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
485
859
  deferred0_1 = arg1;
486
860
  console.error(getStringFromWasm0(arg0, arg1));
487
861
  } finally {
488
- wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
862
+ wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
489
863
  }
490
864
  }
491
- export function __wbg_error_c2462bf0786c2044(arg0, arg1) {
865
+ export function __wbg_error_d0b35507fd5ba906(arg0, arg1) {
492
866
  console.error(getStringFromWasm0(arg0, arg1));
493
867
  }
494
- export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
868
+ export function __wbg_forEach_d33df67d27c9bd85(arg0, arg1, arg2) {
869
+ try {
870
+ var state0 = {a: arg1, b: arg2};
871
+ var cb0 = (arg0, arg1) => {
872
+ const a = state0.a;
873
+ state0.a = 0;
874
+ try {
875
+ return __wasm_bindgen_func_elem_12717(a, state0.b, arg0, arg1);
876
+ } finally {
877
+ state0.a = a;
878
+ }
879
+ };
880
+ arg0.forEach(cb0);
881
+ } finally {
882
+ state0.a = 0;
883
+ }
884
+ }
885
+ export function __wbg_getPrototypeOf_8fbf04523e13de29() { return handleError(function (arg0) {
886
+ const ret = Reflect.getPrototypeOf(arg0);
887
+ return ret;
888
+ }, arguments); }
889
+ export function __wbg_getRandomValues_8b6f1f663e6f188d() { return handleError(function (arg0, arg1) {
495
890
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
496
891
  }, arguments); }
497
- export function __wbg_getRandomValues_ef12552bf5acd2fe() { return handleError(function (arg0, arg1) {
892
+ export function __wbg_getRandomValues_abdecda20e6541f1() { return handleError(function (arg0, arg1) {
498
893
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
499
894
  }, arguments); }
500
- export function __wbg_get_3e9a707ab7d352eb() { return handleError(function (arg0, arg1) {
501
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
502
- return addHeapObject(ret);
895
+ export function __wbg_get_2080c49015e35254() { return handleError(function (arg0, arg1) {
896
+ const ret = Reflect.get(arg0, arg1);
897
+ return ret;
898
+ }, arguments); }
899
+ export function __wbg_get_635eea311fa1a291() { return handleError(function (arg0, arg1) {
900
+ const ret = Reflect.get(arg0, arg1);
901
+ return ret;
503
902
  }, arguments); }
504
- export function __wbg_get_98fdf51d029a75eb(arg0, arg1) {
505
- const ret = getObject(arg0)[arg1 >>> 0];
506
- return addHeapObject(ret);
903
+ export function __wbg_get_d7176cfb76d71114(arg0, arg1) {
904
+ const ret = arg0[arg1 >>> 0];
905
+ return ret;
906
+ }
907
+ export function __wbg_get_unchecked_e6325ad374eff861(arg0, arg1) {
908
+ const ret = arg0[arg1 >>> 0];
909
+ return ret;
507
910
  }
508
- export function __wbg_get_unchecked_1dfe6d05ad91d9b7(arg0, arg1) {
509
- const ret = getObject(arg0)[arg1 >>> 0];
510
- return addHeapObject(ret);
911
+ export function __wbg_get_with_ref_key_fc601247060b7204(arg0, arg1) {
912
+ const ret = arg0[arg1];
913
+ return ret;
511
914
  }
512
- export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
513
- const ret = getObject(arg0)[getObject(arg1)];
514
- return addHeapObject(ret);
915
+ export function __wbg_instanceof_ArrayBuffer_12cdaa4161423e6b(arg0) {
916
+ let result;
917
+ try {
918
+ result = arg0 instanceof ArrayBuffer;
919
+ } catch (_) {
920
+ result = false;
921
+ }
922
+ const ret = result;
923
+ return ret;
515
924
  }
516
- export function __wbg_instanceof_ArrayBuffer_53db37b06f6b9afe(arg0) {
925
+ export function __wbg_instanceof_Error_74e3cca0c4a69161(arg0) {
517
926
  let result;
518
927
  try {
519
- result = getObject(arg0) instanceof ArrayBuffer;
928
+ result = arg0 instanceof Error;
520
929
  } catch (_) {
521
930
  result = false;
522
931
  }
523
932
  const ret = result;
524
933
  return ret;
525
934
  }
526
- export function __wbg_instanceof_Map_16f217b9a2a08d8c(arg0) {
935
+ export function __wbg_instanceof_Map_0b4fc8b62e73f163(arg0) {
527
936
  let result;
528
937
  try {
529
- result = getObject(arg0) instanceof Map;
938
+ result = arg0 instanceof Map;
530
939
  } catch (_) {
531
940
  result = false;
532
941
  }
533
942
  const ret = result;
534
943
  return ret;
535
944
  }
536
- export function __wbg_instanceof_Uint8Array_abd07d4bd221d50b(arg0) {
945
+ export function __wbg_instanceof_Uint8Array_d7aeb0dcb3108fea(arg0) {
537
946
  let result;
538
947
  try {
539
- result = getObject(arg0) instanceof Uint8Array;
948
+ result = arg0 instanceof Uint8Array;
540
949
  } catch (_) {
541
950
  result = false;
542
951
  }
543
952
  const ret = result;
544
953
  return ret;
545
954
  }
546
- export function __wbg_isArray_74b636a53056fecb(arg0) {
547
- const ret = Array.isArray(getObject(arg0));
955
+ export function __wbg_isArray_181eee9e42397260(arg0) {
956
+ const ret = Array.isArray(arg0);
548
957
  return ret;
549
958
  }
550
- export function __wbg_isArray_94898ed3aad6947b(arg0) {
551
- const ret = Array.isArray(getObject(arg0));
959
+ export function __wbg_isArray_bcf1376d0d732d08(arg0) {
960
+ const ret = Array.isArray(arg0);
552
961
  return ret;
553
962
  }
554
- export function __wbg_isSafeInteger_01e964d144ad3a55(arg0) {
555
- const ret = Number.isSafeInteger(getObject(arg0));
963
+ export function __wbg_isSafeInteger_1a35ba4d31e71d38(arg0) {
964
+ const ret = Number.isSafeInteger(arg0);
556
965
  return ret;
557
966
  }
558
- export function __wbg_iterator_1441b47f341dc34f() {
967
+ export function __wbg_iterator_e4c5e8f68ada7b58() {
559
968
  const ret = Symbol.iterator;
560
- return addHeapObject(ret);
969
+ return ret;
561
970
  }
562
- export function __wbg_length_2591a0f4f659a55c(arg0) {
563
- const ret = getObject(arg0).length;
971
+ export function __wbg_length_186163212ffe79c3(arg0) {
972
+ const ret = arg0.length;
564
973
  return ret;
565
974
  }
566
- export function __wbg_length_56fcd3e2b7e0299d(arg0) {
567
- const ret = getObject(arg0).length;
975
+ export function __wbg_length_b03a0fabb109b1e9(arg0) {
976
+ const ret = arg0.length;
568
977
  return ret;
569
978
  }
570
- export function __wbg_log_0d9f05d35f8cac21(arg0, arg1) {
979
+ export function __wbg_log_59c27e5e5e0bbe78(arg0, arg1) {
571
980
  console.log(getStringFromWasm0(arg0, arg1));
572
981
  }
573
- export function __wbg_new_02d162bc6cf02f60() {
574
- const ret = new Object();
575
- return addHeapObject(ret);
576
- }
577
- export function __wbg_new_070df68d66325372() {
578
- const ret = new Map();
579
- return addHeapObject(ret);
982
+ export function __wbg_name_fd11f69c917c5670(arg0) {
983
+ const ret = arg0.name;
984
+ return ret;
580
985
  }
581
- export function __wbg_new_227d7c05414eb861() {
582
- const ret = new Error();
583
- return addHeapObject(ret);
986
+ export function __wbg_new_13de428334042d26(arg0) {
987
+ const ret = new Uint8Array(arg0);
988
+ return ret;
584
989
  }
585
- export function __wbg_new_310879b66b6e95e1() {
990
+ export function __wbg_new_37eb45aaf5eeb820() {
586
991
  const ret = new Array();
587
- return addHeapObject(ret);
992
+ return ret;
588
993
  }
589
- export function __wbg_new_7ddec6de44ff8f5d(arg0) {
590
- const ret = new Uint8Array(getObject(arg0));
591
- return addHeapObject(ret);
994
+ export function __wbg_new_7075786089b89c5e() {
995
+ const ret = new Map();
996
+ return ret;
997
+ }
998
+ export function __wbg_new_787b9fb330d55d78(arg0, arg1) {
999
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1000
+ return ret;
592
1001
  }
593
- export function __wbg_new_d8dfd33fa007511d(arg0, arg1) {
1002
+ export function __wbg_new_ba40181b3f24ac80(arg0, arg1) {
594
1003
  try {
595
1004
  var state0 = {a: arg0, b: arg1};
596
1005
  var cb0 = (arg0, arg1) => {
597
1006
  const a = state0.a;
598
1007
  state0.a = 0;
599
1008
  try {
600
- return __wasm_bindgen_func_elem_10966(a, state0.b, arg0, arg1);
1009
+ return __wasm_bindgen_func_elem_12712(a, state0.b, arg0, arg1);
601
1010
  } finally {
602
1011
  state0.a = a;
603
1012
  }
604
1013
  };
605
1014
  const ret = new Promise(cb0);
606
- return addHeapObject(ret);
1015
+ return ret;
607
1016
  } finally {
608
1017
  state0.a = 0;
609
1018
  }
610
1019
  }
611
- export function __wbg_new_typed_c072c4ce9a2a0cdf(arg0, arg1) {
1020
+ export function __wbg_new_bb74001155cb8ca8() {
1021
+ const ret = new Error();
1022
+ return ret;
1023
+ }
1024
+ export function __wbg_new_cd4348290afae586() {
1025
+ const ret = new Object();
1026
+ return ret;
1027
+ }
1028
+ export function __wbg_new_typed_e09da9dae6ee5935(arg0, arg1) {
612
1029
  try {
613
1030
  var state0 = {a: arg0, b: arg1};
614
1031
  var cb0 = (arg0, arg1) => {
615
1032
  const a = state0.a;
616
1033
  state0.a = 0;
617
1034
  try {
618
- return __wasm_bindgen_func_elem_10966(a, state0.b, arg0, arg1);
1035
+ return __wasm_bindgen_func_elem_12712(a, state0.b, arg0, arg1);
619
1036
  } finally {
620
1037
  state0.a = a;
621
1038
  }
622
1039
  };
623
1040
  const ret = new Promise(cb0);
624
- return addHeapObject(ret);
1041
+ return ret;
625
1042
  } finally {
626
1043
  state0.a = 0;
627
1044
  }
628
1045
  }
629
- export function __wbg_next_2a4e19f4f5083b0f(arg0) {
630
- const ret = getObject(arg0).next;
631
- return addHeapObject(ret);
1046
+ export function __wbg_next_178c1651c11432b3(arg0) {
1047
+ const ret = arg0.next;
1048
+ return ret;
632
1049
  }
633
- export function __wbg_next_6429a146bf756f93() { return handleError(function (arg0) {
634
- const ret = getObject(arg0).next();
635
- return addHeapObject(ret);
1050
+ export function __wbg_next_af5ac6a08bb0a717() { return handleError(function (arg0) {
1051
+ const ret = arg0.next();
1052
+ return ret;
636
1053
  }, arguments); }
637
- export function __wbg_now_81363d44c96dd239() {
1054
+ export function __wbg_now_463ac581d2fc7ea3() {
638
1055
  const ret = Date.now();
639
1056
  return ret;
640
1057
  }
641
- export function __wbg_prototypesetcall_5f9bdc8d75e07276(arg0, arg1, arg2) {
642
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1058
+ export function __wbg_now_e7a92b33874fa64b() {
1059
+ const ret = performance.now();
1060
+ return ret;
1061
+ }
1062
+ export function __wbg_prototypesetcall_13162965d1fe7aa3(arg0, arg1, arg2) {
1063
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1064
+ }
1065
+ export function __wbg_push_c9f4893fc209f768(arg0, arg1) {
1066
+ const ret = arg0.push(arg1);
1067
+ return ret;
643
1068
  }
644
- export function __wbg_push_b77c476b01548d0a(arg0, arg1) {
645
- const ret = getObject(arg0).push(getObject(arg1));
1069
+ export function __wbg_queueMicrotask_1e8503a8a690f0a3(arg0) {
1070
+ const ret = arg0.queueMicrotask;
646
1071
  return ret;
647
1072
  }
648
- export function __wbg_queueMicrotask_78d584b53af520f5(arg0) {
649
- const ret = getObject(arg0).queueMicrotask;
650
- return addHeapObject(ret);
1073
+ export function __wbg_queueMicrotask_4a1a4d8dd332373b(arg0) {
1074
+ queueMicrotask(arg0);
651
1075
  }
652
- export function __wbg_queueMicrotask_b39ea83c7f01971a(arg0) {
653
- queueMicrotask(getObject(arg0));
1076
+ export function __wbg_resolve_dbf78ab4942478b0(arg0) {
1077
+ const ret = Promise.resolve(arg0);
1078
+ return ret;
654
1079
  }
655
- export function __wbg_resolve_d17db9352f5a220e(arg0) {
656
- const ret = Promise.resolve(getObject(arg0));
657
- return addHeapObject(ret);
1080
+ export function __wbg_setTimeout_14c0b2625acb1d6e(arg0, arg1) {
1081
+ setTimeout(arg0, arg1);
658
1082
  }
659
- export function __wbg_setTimeout_8c38500cf1446a8c(arg0, arg1) {
660
- setTimeout(getObject(arg0), arg1);
1083
+ export function __wbg_set_2793479888329cb6() { return handleError(function (arg0, arg1, arg2) {
1084
+ const ret = Reflect.set(arg0, arg1, arg2);
1085
+ return ret;
1086
+ }, arguments); }
1087
+ export function __wbg_set_8282f7e0d2d01336(arg0, arg1, arg2) {
1088
+ const ret = arg0.set(arg1, arg2);
1089
+ return ret;
661
1090
  }
662
- export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
663
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1091
+ export function __wbg_set_d2d33b52458e984a(arg0, arg1, arg2) {
1092
+ arg0[arg1 >>> 0] = arg2;
664
1093
  }
665
- export function __wbg_set_78ea6a19f4818587(arg0, arg1, arg2) {
666
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1094
+ export function __wbg_set_e4b9a833d288759a(arg0, arg1, arg2) {
1095
+ arg0[arg1] = arg2;
667
1096
  }
668
- export function __wbg_set_facb7a5914e0fa39(arg0, arg1, arg2) {
669
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
670
- return addHeapObject(ret);
1097
+ export function __wbg_set_name_822e3903f3184979(arg0, arg1, arg2) {
1098
+ arg0.name = getStringFromWasm0(arg1, arg2);
671
1099
  }
672
- export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
673
- const ret = getObject(arg1).stack;
1100
+ export function __wbg_stack_575c4e0918581b9c(arg0, arg1) {
1101
+ const ret = arg1.stack;
674
1102
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
675
1103
  const len1 = WASM_VECTOR_LEN;
676
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
677
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1104
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
1105
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
1106
+ }
1107
+ export function __wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc() {
1108
+ const ret = typeof globalThis === 'undefined' ? undefined : globalThis;
1109
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
678
1110
  }
679
- export function __wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9() {
680
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
681
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1111
+ export function __wbg_static_accessor_GLOBAL_e4293fb22cbe77da() {
1112
+ const ret = typeof global === 'undefined' ? undefined : global;
1113
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
682
1114
  }
683
- export function __wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54() {
684
- const ret = typeof global === 'undefined' ? null : global;
685
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1115
+ export function __wbg_static_accessor_SELF_53bb20457401453d() {
1116
+ const ret = typeof self === 'undefined' ? undefined : self;
1117
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
686
1118
  }
687
- export function __wbg_static_accessor_SELF_9b2406c23aeb2023() {
688
- const ret = typeof self === 'undefined' ? null : self;
689
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1119
+ export function __wbg_static_accessor_WINDOW_b5e0810bfecb7feb() {
1120
+ const ret = typeof window === 'undefined' ? undefined : window;
1121
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1122
+ }
1123
+ export function __wbg_then_656f253a5dd7d8ea(arg0, arg1, arg2) {
1124
+ const ret = arg0.then(arg1, arg2);
1125
+ return ret;
690
1126
  }
691
- export function __wbg_static_accessor_WINDOW_b34d2126934e16ba() {
692
- const ret = typeof window === 'undefined' ? null : window;
693
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1127
+ export function __wbg_then_e3f7f2d365708be8(arg0, arg1) {
1128
+ const ret = arg0.then(arg1);
1129
+ return ret;
694
1130
  }
695
- export function __wbg_then_837494e384b37459(arg0, arg1) {
696
- const ret = getObject(arg0).then(getObject(arg1));
697
- return addHeapObject(ret);
1131
+ export function __wbg_toString_4d043badaf1f4f69(arg0) {
1132
+ const ret = arg0.toString();
1133
+ return ret;
698
1134
  }
699
- export function __wbg_then_bd927500e8905df2(arg0, arg1, arg2) {
700
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
701
- return addHeapObject(ret);
1135
+ export function __wbg_value_e0f328965e184931(arg0) {
1136
+ const ret = arg0.value;
1137
+ return ret;
702
1138
  }
703
- export function __wbg_value_9cc0518af87a489c(arg0) {
704
- const ret = getObject(arg0).value;
705
- return addHeapObject(ret);
1139
+ export function __wbg_values_01b79ec198898dfb(arg0) {
1140
+ const ret = Object.values(arg0);
1141
+ return ret;
706
1142
  }
707
- export function __wbg_warn_0a0181da0201bf15(arg0, arg1) {
1143
+ export function __wbg_warn_a9670c930d875050(arg0, arg1) {
708
1144
  console.warn(getStringFromWasm0(arg0, arg1));
709
1145
  }
710
- export function __wbindgen_cast_0000000000000001(arg0, arg1) {
711
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2025, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
712
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_10972);
713
- return addHeapObject(ret);
1146
+ export function __wbindgen_generic_0000000000000001(arg0, arg1) {
1147
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref, Externref], shim_idx: 2456, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1148
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12717);
1149
+ return ret;
1150
+ }
1151
+ export function __wbindgen_generic_0000000000000002(arg0, arg1) {
1152
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2450, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1153
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12710);
1154
+ return ret;
1155
+ }
1156
+ export function __wbindgen_generic_0000000000000003(arg0, arg1) {
1157
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 87, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1158
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8384);
1159
+ return ret;
714
1160
  }
715
- export function __wbindgen_cast_0000000000000002(arg0) {
1161
+ export function __wbindgen_generic_0000000000000004(arg0) {
716
1162
  // Cast intrinsic for `F64 -> Externref`.
717
1163
  const ret = arg0;
718
- return addHeapObject(ret);
1164
+ return ret;
719
1165
  }
720
- export function __wbindgen_cast_0000000000000003(arg0) {
1166
+ export function __wbindgen_generic_0000000000000005(arg0) {
721
1167
  // Cast intrinsic for `I64 -> Externref`.
722
1168
  const ret = arg0;
723
- return addHeapObject(ret);
1169
+ return ret;
724
1170
  }
725
- export function __wbindgen_cast_0000000000000004(arg0, arg1) {
1171
+ export function __wbindgen_generic_0000000000000006(arg0, arg1) {
726
1172
  // Cast intrinsic for `Ref(String) -> Externref`.
727
1173
  const ret = getStringFromWasm0(arg0, arg1);
728
- return addHeapObject(ret);
1174
+ return ret;
729
1175
  }
730
- export function __wbindgen_cast_0000000000000005(arg0) {
1176
+ export function __wbindgen_generic_0000000000000007(arg0) {
731
1177
  // Cast intrinsic for `U64 -> Externref`.
732
1178
  const ret = BigInt.asUintN(64, arg0);
733
- return addHeapObject(ret);
1179
+ return ret;
1180
+ }
1181
+ export function __wbindgen_generic_0000000000000008(arg0, arg1) {
1182
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1);
1183
+ wasm.__wbindgen_export3(arg0, arg1 * 4, 4);
1184
+ // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
1185
+ const ret = v0;
1186
+ return ret;
734
1187
  }
735
- export function __wbindgen_object_clone_ref(arg0) {
736
- const ret = getObject(arg0);
737
- return addHeapObject(ret);
1188
+ export function __wbindgen_init_externref_table() {
1189
+ const table = wasm.__wbindgen_externrefs;
1190
+ table.set(0, undefined);
1191
+ table.set(1024, undefined);
1192
+ table.set(1025, null);
1193
+ table.set(1026, true);
1194
+ table.set(1027, false);
738
1195
  }
739
- export function __wbindgen_object_drop_ref(arg0) {
740
- takeObject(arg0);
1196
+ function __wasm_bindgen_func_elem_8384(arg0, arg1, arg2) {
1197
+ wasm.__wasm_bindgen_func_elem_8384(arg0, arg1, arg2);
741
1198
  }
742
- function __wasm_bindgen_func_elem_10972(arg0, arg1, arg2) {
1199
+
1200
+ function __wasm_bindgen_func_elem_12717(arg0, arg1, arg2, arg3) {
1201
+ wasm.__wasm_bindgen_func_elem_12717(arg0, arg1, arg2, arg3);
1202
+ }
1203
+
1204
+ function __wasm_bindgen_func_elem_12712(arg0, arg1, arg2, arg3) {
1205
+ wasm.__wasm_bindgen_func_elem_12712(arg0, arg1, arg2, arg3);
1206
+ }
1207
+
1208
+ function __wasm_bindgen_func_elem_12710(arg0, arg1, arg2) {
743
1209
  try {
744
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
745
- wasm.__wasm_bindgen_func_elem_10972(retptr, arg0, arg1, addHeapObject(arg2));
1210
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
1211
+ wasm.__wasm_bindgen_func_elem_12710(retptr, arg0, arg1, arg2);
746
1212
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
747
1213
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
748
1214
  if (r1) {
749
- throw takeObject(r0);
1215
+ throw takeFromExternrefTable0(r0);
750
1216
  }
751
1217
  } finally {
752
1218
  wasm.__wbindgen_add_to_stack_pointer(16);
753
1219
  }
754
1220
  }
755
1221
 
756
- function __wasm_bindgen_func_elem_10966(arg0, arg1, arg2, arg3) {
757
- wasm.__wasm_bindgen_func_elem_10966(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
758
- }
759
-
760
1222
  const BlocksEngineFinalization = (typeof FinalizationRegistry === 'undefined')
761
1223
  ? { register: () => {}, unregister: () => {} }
762
1224
  : new FinalizationRegistry(ptr => wasm.__wbg_blocksengine_free(ptr, 1));
@@ -764,88 +1226,83 @@ const EngineCommandFinalization = (typeof FinalizationRegistry === 'undefined')
764
1226
  ? { register: () => {}, unregister: () => {} }
765
1227
  : new FinalizationRegistry(ptr => wasm.__wbg_enginecommand_free(ptr, 1));
766
1228
 
767
- function addHeapObject(obj) {
768
- if (heap_next === heap.length) heap.push(heap.length + 1);
769
- const idx = heap_next;
770
- heap_next = heap[idx];
771
-
772
- heap[idx] = obj;
1229
+ function addToExternrefTable0(obj) {
1230
+ const idx = wasm.__wbindgen_export5();
1231
+ wasm.__wbindgen_externrefs.set(idx, obj);
773
1232
  return idx;
774
1233
  }
775
1234
 
776
1235
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
777
1236
  ? { register: () => {}, unregister: () => {} }
778
- : new FinalizationRegistry(state => wasm.__wbindgen_export5(state.a, state.b));
1237
+ : new FinalizationRegistry(state => wasm.__wbindgen_export6(state.a, state.b));
779
1238
 
780
1239
  function debugString(val) {
781
- // primitive types
782
- const type = typeof val;
783
- if (type == 'number' || type == 'boolean' || val == null) {
784
- return `${val}`;
785
- }
786
- if (type == 'string') {
787
- return `"${val}"`;
788
- }
789
- if (type == 'symbol') {
790
- const description = val.description;
791
- if (description == null) {
792
- return 'Symbol';
793
- } else {
794
- return `Symbol(${description})`;
795
- }
796
- }
797
- if (type == 'function') {
798
- const name = val.name;
799
- if (typeof name == 'string' && name.length > 0) {
800
- return `Function(${name})`;
801
- } else {
802
- return 'Function';
803
- }
804
- }
805
- // objects
806
- if (Array.isArray(val)) {
807
- const length = val.length;
808
- let debug = '[';
809
- if (length > 0) {
810
- debug += debugString(val[0]);
811
- }
812
- for(let i = 1; i < length; i++) {
813
- debug += ', ' + debugString(val[i]);
814
- }
815
- debug += ']';
816
- return debug;
817
- }
818
- // Test for built-in
819
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
820
- let className;
821
- if (builtInMatches && builtInMatches.length > 1) {
822
- className = builtInMatches[1];
823
- } else {
824
- // Failed to match the standard '[object ClassName]'
825
- return toString.call(val);
826
- }
827
- if (className == 'Object') {
828
- // we're a user defined class or Object
829
- // JSON.stringify avoids problems with cycles, and is generally much
830
- // easier than looping through ownProperties of `val`.
831
- try {
832
- return 'Object(' + JSON.stringify(val) + ')';
833
- } catch (_) {
834
- return 'Object';
1240
+ switch (typeof val) {
1241
+ // primitive types
1242
+ case 'number':
1243
+ case 'boolean':
1244
+ case 'undefined':
1245
+ return `${val}`;
1246
+ case 'string':
1247
+ return JSON.stringify(val);
1248
+ case 'bigint':
1249
+ return `${val}n`;
1250
+ case 'symbol':
1251
+ return val.description !== undefined
1252
+ ? `Symbol(${val.description})`
1253
+ : 'Symbol';
1254
+ case 'function':
1255
+ return typeof val.name === 'string' && val.name !== ''
1256
+ ? `Function(${val.name})`
1257
+ : 'Function';
1258
+ case 'object': {
1259
+ if (val === null) {
1260
+ return 'null';
1261
+ }
1262
+ // objects
1263
+ if (Array.isArray(val)) {
1264
+ return '[' + Array.from(val, debugString).join(', ') + ']';
1265
+ }
1266
+ // errors
1267
+ if (val instanceof Error) {
1268
+ return `${val.name}: ${val.message}\n${val.stack}`;
1269
+ }
1270
+
1271
+ const toStringOutput = toString.call(val);
1272
+ // Test for built-in
1273
+ const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
1274
+
1275
+ // Failed to match the standard '[object ClassName]'
1276
+ if (className === undefined) {
1277
+ return toStringOutput;
1278
+ }
1279
+ if (className === 'Object') {
1280
+ // we're a user defined class or Object
1281
+ // JSON.stringify avoids problems with cycles, and is generally much
1282
+ // easier than looping through ownProperties of `val`.
1283
+ try {
1284
+ return 'Object(' + JSON.stringify(val) + ')';
1285
+ } catch (_) {
1286
+ return 'Object';
1287
+ }
1288
+ }
1289
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1290
+ return className;
835
1291
  }
1292
+ // Per MDN: 'This list of values is exhaustive.'
1293
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
836
1294
  }
837
- // errors
838
- if (val instanceof Error) {
839
- return `${val.name}: ${val.message}\n${val.stack}`;
840
- }
841
- // TODO we could test for more things here, like `Set`s and `Map`s.
842
- return className;
843
1295
  }
844
1296
 
845
- function dropObject(idx) {
846
- if (idx < 1028) return;
847
- heap[idx] = heap_next;
848
- heap_next = idx;
1297
+ function getArrayJsValueFromWasm0(ptr, len) {
1298
+ ptr = ptr >>> 0;
1299
+ const mem = getDataViewMemory0();
1300
+ const result = [];
1301
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1302
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1303
+ }
1304
+ wasm.__wbindgen_export7(ptr, len);
1305
+ return result;
849
1306
  }
850
1307
 
851
1308
  function getArrayU8FromWasm0(ptr, len) {
@@ -862,7 +1319,8 @@ function getDataViewMemory0() {
862
1319
  }
863
1320
 
864
1321
  function getStringFromWasm0(ptr, len) {
865
- return decodeText(ptr >>> 0, len);
1322
+ ptr = ptr >>> 0;
1323
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
866
1324
  }
867
1325
 
868
1326
  let cachedUint8ArrayMemory0 = null;
@@ -873,21 +1331,15 @@ function getUint8ArrayMemory0() {
873
1331
  return cachedUint8ArrayMemory0;
874
1332
  }
875
1333
 
876
- function getObject(idx) { return heap[idx]; }
877
-
878
1334
  function handleError(f, args) {
879
1335
  try {
880
1336
  return f.apply(this, args);
881
1337
  } catch (e) {
882
- wasm.__wbindgen_export3(addHeapObject(e));
1338
+ const idx = addToExternrefTable0(e);
1339
+ wasm.__wbindgen_export4(idx);
883
1340
  }
884
1341
  }
885
1342
 
886
- let heap = new Array(1024).fill(undefined);
887
- heap.push(undefined, null, true, false);
888
-
889
- let heap_next = heap.length;
890
-
891
1343
  function isLikeNone(x) {
892
1344
  return x === undefined || x === null;
893
1345
  }
@@ -911,7 +1363,7 @@ function makeMutClosure(arg0, arg1, f) {
911
1363
  };
912
1364
  real._wbg_cb_unref = () => {
913
1365
  if (--state.cnt === 0) {
914
- wasm.__wbindgen_export5(state.a, state.b);
1366
+ wasm.__wbindgen_export6(state.a, state.b);
915
1367
  state.a = 0;
916
1368
  CLOSURE_DTORS.unregister(state);
917
1369
  }
@@ -922,9 +1374,9 @@ function makeMutClosure(arg0, arg1, f) {
922
1374
 
923
1375
  function passArrayJsValueToWasm0(array, malloc) {
924
1376
  const ptr = malloc(array.length * 4, 4) >>> 0;
925
- const mem = getDataViewMemory0();
926
1377
  for (let i = 0; i < array.length; i++) {
927
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
1378
+ const add = addToExternrefTable0(array[i]);
1379
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
928
1380
  }
929
1381
  WASM_VECTOR_LEN = array.length;
930
1382
  return ptr;
@@ -967,24 +1419,24 @@ function passStringToWasm0(arg, malloc, realloc) {
967
1419
  return ptr;
968
1420
  }
969
1421
 
970
- function takeObject(idx) {
971
- const ret = getObject(idx);
972
- dropObject(idx);
973
- return ret;
1422
+ function takeFromExternrefTable0(idx) {
1423
+ const value = wasm.__wbindgen_externrefs.get(idx);
1424
+ wasm.__wbindgen_export8(idx);
1425
+ return value;
974
1426
  }
975
1427
 
976
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1428
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
977
1429
  cachedTextDecoder.decode();
978
1430
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
979
1431
  let numBytesDecoded = 0;
980
- function decodeText(ptr, len) {
981
- numBytesDecoded += len;
1432
+ function decodeText(bytes) {
1433
+ numBytesDecoded += bytes.length;
982
1434
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
983
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1435
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
984
1436
  cachedTextDecoder.decode();
985
- numBytesDecoded = len;
1437
+ numBytesDecoded = bytes.length;
986
1438
  }
987
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1439
+ return cachedTextDecoder.decode(bytes);
988
1440
  }
989
1441
 
990
1442
  const cachedTextEncoder = new TextEncoder();