timed-automata-analyzer 1.0.10 → 1.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 - 2025 Luthium
3
+ Copyright (c) 2024 - 2026 Luthium
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -27,6 +27,10 @@ In case you want to contribute to the tool or fork the repository, only few step
27
27
  To run the linters, execute `cargo check` and `cargo clippy`, respectively.
28
28
  - For further information on compiling Rust to WebAssembly, see the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_Wasm).
29
29
 
30
+ In addition to the Rust code for creating the Wasm binary, this project also contains a tiny TypeScript project in the folder `wasm_test`.
31
+ The purpose of this Node project is to check whether the generated Wasm binary and the generate glue code work as intended (i.e., the Wasm binary can in principal be accessed).
32
+ To execute these tests, just install Node and npm on your machine, open the `wasm_test` folder, and run `npm install` and `npm test`.
33
+
30
34
  ## 💡 Additional Information
31
35
 
32
36
  - Most of the algorithms for checking reachability are based on the paper [Timed Automata: Semantics, Algorithms and Tools](https://doi.org/10.1007/978-3-540-27755-2_3).
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "luth1um"
6
6
  ],
7
7
  "description": "An analyzer for Timed Automata written in Rust",
8
- "version": "1.0.10",
8
+ "version": "1.1.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -1,5 +1,49 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+
4
+ export class Clause {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ constructor(lhs: Clock, op: ClockComparator, rhs: number);
8
+ }
9
+
10
+ export class Clock {
11
+ free(): void;
12
+ [Symbol.dispose](): void;
13
+ constructor(name: string);
14
+ }
15
+
16
+ export enum ClockComparator {
17
+ LESSER = 0,
18
+ LEQ = 1,
19
+ GEQ = 2,
20
+ GREATER = 3,
21
+ }
22
+
23
+ export class ClockConstraint {
24
+ free(): void;
25
+ [Symbol.dispose](): void;
26
+ constructor(clauses: Clause[]);
27
+ }
28
+
29
+ export class Location {
30
+ free(): void;
31
+ [Symbol.dispose](): void;
32
+ constructor(name: string, is_initial: boolean, invariant?: ClockConstraint | null);
33
+ }
34
+
35
+ export class Switch {
36
+ free(): void;
37
+ [Symbol.dispose](): void;
38
+ constructor(source: Location, guard: ClockConstraint | null | undefined, action: string, reset: Clock[], target: Location);
39
+ }
40
+
41
+ export class TimedAutomaton {
42
+ free(): void;
43
+ [Symbol.dispose](): void;
44
+ constructor(locations: Location[], clocks: Clock[], switches: Switch[]);
45
+ }
46
+
3
47
  /**
4
48
  * Checks all locations of the input TA for reachability and returns all unreachable locations. The
5
49
  * result will be empty if all locations are reachable.
@@ -20,39 +64,3 @@
20
64
  * </ul>
21
65
  */
22
66
  export function findUnreachableLocations(ta: TimedAutomaton): string[];
23
- export enum ClockComparator {
24
- LESSER = 0,
25
- LEQ = 1,
26
- GEQ = 2,
27
- GREATER = 3,
28
- }
29
- export class Clause {
30
- free(): void;
31
- [Symbol.dispose](): void;
32
- constructor(lhs: Clock, op: ClockComparator, rhs: number);
33
- }
34
- export class Clock {
35
- free(): void;
36
- [Symbol.dispose](): void;
37
- constructor(name: string);
38
- }
39
- export class ClockConstraint {
40
- free(): void;
41
- [Symbol.dispose](): void;
42
- constructor(clauses: Clause[]);
43
- }
44
- export class Location {
45
- free(): void;
46
- [Symbol.dispose](): void;
47
- constructor(name: string, is_initial: boolean, invariant?: ClockConstraint | null);
48
- }
49
- export class Switch {
50
- free(): void;
51
- [Symbol.dispose](): void;
52
- constructor(source: Location, guard: ClockConstraint | null | undefined, action: string, reset: Clock[], target: Location);
53
- }
54
- export class TimedAutomaton {
55
- free(): void;
56
- [Symbol.dispose](): void;
57
- constructor(locations: Location[], clocks: Clock[], switches: Switch[]);
58
- }
@@ -1,5 +1,9 @@
1
+ /* @ts-self-types="./timed_automata_analyzer.d.ts" */
2
+
1
3
  import * as wasm from "./timed_automata_analyzer_bg.wasm";
2
- export * from "./timed_automata_analyzer_bg.js";
3
4
  import { __wbg_set_wasm } from "./timed_automata_analyzer_bg.js";
4
5
  __wbg_set_wasm(wasm);
5
6
  wasm.__wbindgen_start();
7
+ export {
8
+ Clause, Clock, ClockComparator, ClockConstraint, Location, Switch, TimedAutomaton, findUnreachableLocations
9
+ } from "./timed_automata_analyzer_bg.js";
@@ -1,197 +1,16 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
4
- }
5
-
6
-
7
- let cachedUint8ArrayMemory0 = null;
8
-
9
- function getUint8ArrayMemory0() {
10
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
- }
13
- return cachedUint8ArrayMemory0;
14
- }
15
-
16
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
-
18
- cachedTextDecoder.decode();
19
-
20
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
- let numBytesDecoded = 0;
22
- function decodeText(ptr, len) {
23
- numBytesDecoded += len;
24
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
- cachedTextDecoder.decode();
27
- numBytesDecoded = len;
28
- }
29
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
- }
31
-
32
- function getStringFromWasm0(ptr, len) {
33
- ptr = ptr >>> 0;
34
- return decodeText(ptr, len);
35
- }
36
-
37
- function _assertClass(instance, klass) {
38
- if (!(instance instanceof klass)) {
39
- throw new Error(`expected instance of ${klass.name}`);
40
- }
41
- }
42
-
43
- let cachedDataViewMemory0 = null;
44
-
45
- function getDataViewMemory0() {
46
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
47
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
48
- }
49
- return cachedDataViewMemory0;
50
- }
51
-
52
- function getArrayJsValueFromWasm0(ptr, len) {
53
- ptr = ptr >>> 0;
54
- const mem = getDataViewMemory0();
55
- const result = [];
56
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
57
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
58
- }
59
- wasm.__externref_drop_slice(ptr, len);
60
- return result;
61
- }
62
- /**
63
- * Checks all locations of the input TA for reachability and returns all unreachable locations. The
64
- * result will be empty if all locations are reachable.
65
- *
66
- * This function will throw an error if one or more validation checks fail. The following
67
- * properties will be validated:
68
- * <ul>
69
- * <li>There exists exactly one initial location.</li>
70
- * <li>The set of locations is non-empty.</li>
71
- * <li>All invariants are downward-closed.</li>
72
- * <li>The highest constant used in any clock constraint is not greater than the highest allowed
73
- * value (536870909).</li>
74
- * <li>All locations names are unique.</li>
75
- * <li>All clock names are unique.</li>
76
- * <li>All clocks used in clock constraints are also contained in the set of clocks.</li>
77
- * <li>All location names used as source and target of switches are also contained in the set of
78
- * locations.</li>
79
- * </ul>
80
- * @param {TimedAutomaton} ta
81
- * @returns {string[]}
82
- */
83
- export function findUnreachableLocations(ta) {
84
- _assertClass(ta, TimedAutomaton);
85
- var ptr0 = ta.__destroy_into_raw();
86
- const ret = wasm.findUnreachableLocations(ptr0);
87
- var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
88
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
89
- return v2;
90
- }
91
-
92
- let WASM_VECTOR_LEN = 0;
93
-
94
- function addToExternrefTable0(obj) {
95
- const idx = wasm.__externref_table_alloc();
96
- wasm.__wbindgen_externrefs.set(idx, obj);
97
- return idx;
98
- }
99
-
100
- function passArrayJsValueToWasm0(array, malloc) {
101
- const ptr = malloc(array.length * 4, 4) >>> 0;
102
- for (let i = 0; i < array.length; i++) {
103
- const add = addToExternrefTable0(array[i]);
104
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
105
- }
106
- WASM_VECTOR_LEN = array.length;
107
- return ptr;
108
- }
109
-
110
- const cachedTextEncoder = new TextEncoder();
111
-
112
- if (!('encodeInto' in cachedTextEncoder)) {
113
- cachedTextEncoder.encodeInto = function (arg, view) {
114
- const buf = cachedTextEncoder.encode(arg);
115
- view.set(buf);
116
- return {
117
- read: arg.length,
118
- written: buf.length
119
- };
120
- }
121
- }
122
-
123
- function passStringToWasm0(arg, malloc, realloc) {
124
-
125
- if (realloc === undefined) {
126
- const buf = cachedTextEncoder.encode(arg);
127
- const ptr = malloc(buf.length, 1) >>> 0;
128
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
129
- WASM_VECTOR_LEN = buf.length;
130
- return ptr;
131
- }
132
-
133
- let len = arg.length;
134
- let ptr = malloc(len, 1) >>> 0;
135
-
136
- const mem = getUint8ArrayMemory0();
137
-
138
- let offset = 0;
139
-
140
- for (; offset < len; offset++) {
141
- const code = arg.charCodeAt(offset);
142
- if (code > 0x7F) break;
143
- mem[ptr + offset] = code;
144
- }
145
-
146
- if (offset !== len) {
147
- if (offset !== 0) {
148
- arg = arg.slice(offset);
149
- }
150
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
151
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
152
- const ret = cachedTextEncoder.encodeInto(arg, view);
153
-
154
- offset += ret.written;
155
- ptr = realloc(ptr, len, offset, 1) >>> 0;
156
- }
157
-
158
- WASM_VECTOR_LEN = offset;
159
- return ptr;
160
- }
161
-
162
- function isLikeNone(x) {
163
- return x === undefined || x === null;
164
- }
165
- /**
166
- * @enum {0 | 1 | 2 | 3}
167
- */
168
- export const ClockComparator = Object.freeze({
169
- LESSER: 0, "0": "LESSER",
170
- LEQ: 1, "1": "LEQ",
171
- GEQ: 2, "2": "GEQ",
172
- GREATER: 3, "3": "GREATER",
173
- });
174
-
175
- const ClauseFinalization = (typeof FinalizationRegistry === 'undefined')
176
- ? { register: () => {}, unregister: () => {} }
177
- : new FinalizationRegistry(ptr => wasm.__wbg_clause_free(ptr >>> 0, 1));
178
-
179
1
  export class Clause {
180
-
181
2
  static __unwrap(jsValue) {
182
3
  if (!(jsValue instanceof Clause)) {
183
4
  return 0;
184
5
  }
185
6
  return jsValue.__destroy_into_raw();
186
7
  }
187
-
188
8
  __destroy_into_raw() {
189
9
  const ptr = this.__wbg_ptr;
190
10
  this.__wbg_ptr = 0;
191
11
  ClauseFinalization.unregister(this);
192
12
  return ptr;
193
13
  }
194
-
195
14
  free() {
196
15
  const ptr = this.__destroy_into_raw();
197
16
  wasm.__wbg_clause_free(ptr, 0);
@@ -211,26 +30,19 @@ export class Clause {
211
30
  }
212
31
  if (Symbol.dispose) Clause.prototype[Symbol.dispose] = Clause.prototype.free;
213
32
 
214
- const ClockFinalization = (typeof FinalizationRegistry === 'undefined')
215
- ? { register: () => {}, unregister: () => {} }
216
- : new FinalizationRegistry(ptr => wasm.__wbg_clock_free(ptr >>> 0, 1));
217
-
218
33
  export class Clock {
219
-
220
34
  static __unwrap(jsValue) {
221
35
  if (!(jsValue instanceof Clock)) {
222
36
  return 0;
223
37
  }
224
38
  return jsValue.__destroy_into_raw();
225
39
  }
226
-
227
40
  __destroy_into_raw() {
228
41
  const ptr = this.__wbg_ptr;
229
42
  this.__wbg_ptr = 0;
230
43
  ClockFinalization.unregister(this);
231
44
  return ptr;
232
45
  }
233
-
234
46
  free() {
235
47
  const ptr = this.__destroy_into_raw();
236
48
  wasm.__wbg_clock_free(ptr, 0);
@@ -249,19 +61,23 @@ export class Clock {
249
61
  }
250
62
  if (Symbol.dispose) Clock.prototype[Symbol.dispose] = Clock.prototype.free;
251
63
 
252
- const ClockConstraintFinalization = (typeof FinalizationRegistry === 'undefined')
253
- ? { register: () => {}, unregister: () => {} }
254
- : new FinalizationRegistry(ptr => wasm.__wbg_clockconstraint_free(ptr >>> 0, 1));
64
+ /**
65
+ * @enum {0 | 1 | 2 | 3}
66
+ */
67
+ export const ClockComparator = Object.freeze({
68
+ LESSER: 0, "0": "LESSER",
69
+ LEQ: 1, "1": "LEQ",
70
+ GEQ: 2, "2": "GEQ",
71
+ GREATER: 3, "3": "GREATER",
72
+ });
255
73
 
256
74
  export class ClockConstraint {
257
-
258
75
  __destroy_into_raw() {
259
76
  const ptr = this.__wbg_ptr;
260
77
  this.__wbg_ptr = 0;
261
78
  ClockConstraintFinalization.unregister(this);
262
79
  return ptr;
263
80
  }
264
-
265
81
  free() {
266
82
  const ptr = this.__destroy_into_raw();
267
83
  wasm.__wbg_clockconstraint_free(ptr, 0);
@@ -280,26 +96,19 @@ export class ClockConstraint {
280
96
  }
281
97
  if (Symbol.dispose) ClockConstraint.prototype[Symbol.dispose] = ClockConstraint.prototype.free;
282
98
 
283
- const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
284
- ? { register: () => {}, unregister: () => {} }
285
- : new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0, 1));
286
-
287
99
  export class Location {
288
-
289
100
  static __unwrap(jsValue) {
290
101
  if (!(jsValue instanceof Location)) {
291
102
  return 0;
292
103
  }
293
104
  return jsValue.__destroy_into_raw();
294
105
  }
295
-
296
106
  __destroy_into_raw() {
297
107
  const ptr = this.__wbg_ptr;
298
108
  this.__wbg_ptr = 0;
299
109
  LocationFinalization.unregister(this);
300
110
  return ptr;
301
111
  }
302
-
303
112
  free() {
304
113
  const ptr = this.__destroy_into_raw();
305
114
  wasm.__wbg_location_free(ptr, 0);
@@ -325,26 +134,19 @@ export class Location {
325
134
  }
326
135
  if (Symbol.dispose) Location.prototype[Symbol.dispose] = Location.prototype.free;
327
136
 
328
- const SwitchFinalization = (typeof FinalizationRegistry === 'undefined')
329
- ? { register: () => {}, unregister: () => {} }
330
- : new FinalizationRegistry(ptr => wasm.__wbg_switch_free(ptr >>> 0, 1));
331
-
332
137
  export class Switch {
333
-
334
138
  static __unwrap(jsValue) {
335
139
  if (!(jsValue instanceof Switch)) {
336
140
  return 0;
337
141
  }
338
142
  return jsValue.__destroy_into_raw();
339
143
  }
340
-
341
144
  __destroy_into_raw() {
342
145
  const ptr = this.__wbg_ptr;
343
146
  this.__wbg_ptr = 0;
344
147
  SwitchFinalization.unregister(this);
345
148
  return ptr;
346
149
  }
347
-
348
150
  free() {
349
151
  const ptr = this.__destroy_into_raw();
350
152
  wasm.__wbg_switch_free(ptr, 0);
@@ -376,19 +178,13 @@ export class Switch {
376
178
  }
377
179
  if (Symbol.dispose) Switch.prototype[Symbol.dispose] = Switch.prototype.free;
378
180
 
379
- const TimedAutomatonFinalization = (typeof FinalizationRegistry === 'undefined')
380
- ? { register: () => {}, unregister: () => {} }
381
- : new FinalizationRegistry(ptr => wasm.__wbg_timedautomaton_free(ptr >>> 0, 1));
382
-
383
181
  export class TimedAutomaton {
384
-
385
182
  __destroy_into_raw() {
386
183
  const ptr = this.__wbg_ptr;
387
184
  this.__wbg_ptr = 0;
388
185
  TimedAutomatonFinalization.unregister(this);
389
186
  return ptr;
390
187
  }
391
-
392
188
  free() {
393
189
  const ptr = this.__destroy_into_raw();
394
190
  wasm.__wbg_timedautomaton_free(ptr, 0);
@@ -413,36 +209,59 @@ export class TimedAutomaton {
413
209
  }
414
210
  if (Symbol.dispose) TimedAutomaton.prototype[Symbol.dispose] = TimedAutomaton.prototype.free;
415
211
 
416
- export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
212
+ /**
213
+ * Checks all locations of the input TA for reachability and returns all unreachable locations. The
214
+ * result will be empty if all locations are reachable.
215
+ *
216
+ * This function will throw an error if one or more validation checks fail. The following
217
+ * properties will be validated:
218
+ * <ul>
219
+ * <li>There exists exactly one initial location.</li>
220
+ * <li>The set of locations is non-empty.</li>
221
+ * <li>All invariants are downward-closed.</li>
222
+ * <li>The highest constant used in any clock constraint is not greater than the highest allowed
223
+ * value (536870909).</li>
224
+ * <li>All locations names are unique.</li>
225
+ * <li>All clock names are unique.</li>
226
+ * <li>All clocks used in clock constraints are also contained in the set of clocks.</li>
227
+ * <li>All location names used as source and target of switches are also contained in the set of
228
+ * locations.</li>
229
+ * </ul>
230
+ * @param {TimedAutomaton} ta
231
+ * @returns {string[]}
232
+ */
233
+ export function findUnreachableLocations(ta) {
234
+ _assertClass(ta, TimedAutomaton);
235
+ var ptr0 = ta.__destroy_into_raw();
236
+ const ret = wasm.findUnreachableLocations(ptr0);
237
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
238
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
239
+ return v2;
240
+ }
241
+ export function __wbg___wbindgen_throw_df03e93053e0f4bc(arg0, arg1) {
417
242
  throw new Error(getStringFromWasm0(arg0, arg1));
418
- };
419
-
243
+ }
420
244
  export function __wbg_clause_unwrap(arg0) {
421
245
  const ret = Clause.__unwrap(arg0);
422
246
  return ret;
423
- };
424
-
247
+ }
425
248
  export function __wbg_clock_unwrap(arg0) {
426
249
  const ret = Clock.__unwrap(arg0);
427
250
  return ret;
428
- };
429
-
251
+ }
430
252
  export function __wbg_location_unwrap(arg0) {
431
253
  const ret = Location.__unwrap(arg0);
432
254
  return ret;
433
- };
434
-
255
+ }
435
256
  export function __wbg_switch_unwrap(arg0) {
436
257
  const ret = Switch.__unwrap(arg0);
437
258
  return ret;
438
- };
439
-
440
- export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
259
+ }
260
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
441
261
  // Cast intrinsic for `Ref(String) -> Externref`.
442
262
  const ret = getStringFromWasm0(arg0, arg1);
443
263
  return ret;
444
- };
445
-
264
+ }
446
265
  export function __wbindgen_init_externref_table() {
447
266
  const table = wasm.__wbindgen_externrefs;
448
267
  const offset = table.grow(4);
@@ -451,6 +270,152 @@ export function __wbindgen_init_externref_table() {
451
270
  table.set(offset + 1, null);
452
271
  table.set(offset + 2, true);
453
272
  table.set(offset + 3, false);
454
- ;
455
- };
273
+ }
274
+ const ClauseFinalization = (typeof FinalizationRegistry === 'undefined')
275
+ ? { register: () => {}, unregister: () => {} }
276
+ : new FinalizationRegistry(ptr => wasm.__wbg_clause_free(ptr >>> 0, 1));
277
+ const ClockFinalization = (typeof FinalizationRegistry === 'undefined')
278
+ ? { register: () => {}, unregister: () => {} }
279
+ : new FinalizationRegistry(ptr => wasm.__wbg_clock_free(ptr >>> 0, 1));
280
+ const ClockConstraintFinalization = (typeof FinalizationRegistry === 'undefined')
281
+ ? { register: () => {}, unregister: () => {} }
282
+ : new FinalizationRegistry(ptr => wasm.__wbg_clockconstraint_free(ptr >>> 0, 1));
283
+ const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
284
+ ? { register: () => {}, unregister: () => {} }
285
+ : new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0, 1));
286
+ const SwitchFinalization = (typeof FinalizationRegistry === 'undefined')
287
+ ? { register: () => {}, unregister: () => {} }
288
+ : new FinalizationRegistry(ptr => wasm.__wbg_switch_free(ptr >>> 0, 1));
289
+ const TimedAutomatonFinalization = (typeof FinalizationRegistry === 'undefined')
290
+ ? { register: () => {}, unregister: () => {} }
291
+ : new FinalizationRegistry(ptr => wasm.__wbg_timedautomaton_free(ptr >>> 0, 1));
456
292
 
293
+ function addToExternrefTable0(obj) {
294
+ const idx = wasm.__externref_table_alloc();
295
+ wasm.__wbindgen_externrefs.set(idx, obj);
296
+ return idx;
297
+ }
298
+
299
+ function _assertClass(instance, klass) {
300
+ if (!(instance instanceof klass)) {
301
+ throw new Error(`expected instance of ${klass.name}`);
302
+ }
303
+ }
304
+
305
+ function getArrayJsValueFromWasm0(ptr, len) {
306
+ ptr = ptr >>> 0;
307
+ const mem = getDataViewMemory0();
308
+ const result = [];
309
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
310
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
311
+ }
312
+ wasm.__externref_drop_slice(ptr, len);
313
+ return result;
314
+ }
315
+
316
+ let cachedDataViewMemory0 = null;
317
+ function getDataViewMemory0() {
318
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
319
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
320
+ }
321
+ return cachedDataViewMemory0;
322
+ }
323
+
324
+ function getStringFromWasm0(ptr, len) {
325
+ ptr = ptr >>> 0;
326
+ return decodeText(ptr, len);
327
+ }
328
+
329
+ let cachedUint8ArrayMemory0 = null;
330
+ function getUint8ArrayMemory0() {
331
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
332
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
333
+ }
334
+ return cachedUint8ArrayMemory0;
335
+ }
336
+
337
+ function isLikeNone(x) {
338
+ return x === undefined || x === null;
339
+ }
340
+
341
+ function passArrayJsValueToWasm0(array, malloc) {
342
+ const ptr = malloc(array.length * 4, 4) >>> 0;
343
+ for (let i = 0; i < array.length; i++) {
344
+ const add = addToExternrefTable0(array[i]);
345
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
346
+ }
347
+ WASM_VECTOR_LEN = array.length;
348
+ return ptr;
349
+ }
350
+
351
+ function passStringToWasm0(arg, malloc, realloc) {
352
+ if (realloc === undefined) {
353
+ const buf = cachedTextEncoder.encode(arg);
354
+ const ptr = malloc(buf.length, 1) >>> 0;
355
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
356
+ WASM_VECTOR_LEN = buf.length;
357
+ return ptr;
358
+ }
359
+
360
+ let len = arg.length;
361
+ let ptr = malloc(len, 1) >>> 0;
362
+
363
+ const mem = getUint8ArrayMemory0();
364
+
365
+ let offset = 0;
366
+
367
+ for (; offset < len; offset++) {
368
+ const code = arg.charCodeAt(offset);
369
+ if (code > 0x7F) break;
370
+ mem[ptr + offset] = code;
371
+ }
372
+ if (offset !== len) {
373
+ if (offset !== 0) {
374
+ arg = arg.slice(offset);
375
+ }
376
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
377
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
378
+ const ret = cachedTextEncoder.encodeInto(arg, view);
379
+
380
+ offset += ret.written;
381
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
382
+ }
383
+
384
+ WASM_VECTOR_LEN = offset;
385
+ return ptr;
386
+ }
387
+
388
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
389
+ cachedTextDecoder.decode();
390
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
391
+ let numBytesDecoded = 0;
392
+ function decodeText(ptr, len) {
393
+ numBytesDecoded += len;
394
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
395
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
396
+ cachedTextDecoder.decode();
397
+ numBytesDecoded = len;
398
+ }
399
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
400
+ }
401
+
402
+ const cachedTextEncoder = new TextEncoder();
403
+
404
+ if (!('encodeInto' in cachedTextEncoder)) {
405
+ cachedTextEncoder.encodeInto = function (arg, view) {
406
+ const buf = cachedTextEncoder.encode(arg);
407
+ view.set(buf);
408
+ return {
409
+ read: arg.length,
410
+ written: buf.length
411
+ };
412
+ };
413
+ }
414
+
415
+ let WASM_VECTOR_LEN = 0;
416
+
417
+
418
+ let wasm;
419
+ export function __wbg_set_wasm(val) {
420
+ wasm = val;
421
+ }
Binary file