timed-automata-analyzer 1.0.9 → 1.0.11

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.9",
8
+ "version": "1.0.11",
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,198 +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
- let WASM_VECTOR_LEN = 0;
38
-
39
- const cachedTextEncoder = new TextEncoder();
40
-
41
- if (!('encodeInto' in cachedTextEncoder)) {
42
- cachedTextEncoder.encodeInto = function (arg, view) {
43
- const buf = cachedTextEncoder.encode(arg);
44
- view.set(buf);
45
- return {
46
- read: arg.length,
47
- written: buf.length
48
- };
49
- }
50
- }
51
-
52
- function passStringToWasm0(arg, malloc, realloc) {
53
-
54
- if (realloc === undefined) {
55
- const buf = cachedTextEncoder.encode(arg);
56
- const ptr = malloc(buf.length, 1) >>> 0;
57
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
58
- WASM_VECTOR_LEN = buf.length;
59
- return ptr;
60
- }
61
-
62
- let len = arg.length;
63
- let ptr = malloc(len, 1) >>> 0;
64
-
65
- const mem = getUint8ArrayMemory0();
66
-
67
- let offset = 0;
68
-
69
- for (; offset < len; offset++) {
70
- const code = arg.charCodeAt(offset);
71
- if (code > 0x7F) break;
72
- mem[ptr + offset] = code;
73
- }
74
-
75
- if (offset !== len) {
76
- if (offset !== 0) {
77
- arg = arg.slice(offset);
78
- }
79
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
80
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
81
- const ret = cachedTextEncoder.encodeInto(arg, view);
82
-
83
- offset += ret.written;
84
- ptr = realloc(ptr, len, offset, 1) >>> 0;
85
- }
86
-
87
- WASM_VECTOR_LEN = offset;
88
- return ptr;
89
- }
90
-
91
- function _assertClass(instance, klass) {
92
- if (!(instance instanceof klass)) {
93
- throw new Error(`expected instance of ${klass.name}`);
94
- }
95
- }
96
-
97
- let cachedDataViewMemory0 = null;
98
-
99
- function getDataViewMemory0() {
100
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
101
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
102
- }
103
- return cachedDataViewMemory0;
104
- }
105
-
106
- function addToExternrefTable0(obj) {
107
- const idx = wasm.__externref_table_alloc();
108
- wasm.__wbindgen_export_0.set(idx, obj);
109
- return idx;
110
- }
111
-
112
- function passArrayJsValueToWasm0(array, malloc) {
113
- const ptr = malloc(array.length * 4, 4) >>> 0;
114
- for (let i = 0; i < array.length; i++) {
115
- const add = addToExternrefTable0(array[i]);
116
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
117
- }
118
- WASM_VECTOR_LEN = array.length;
119
- return ptr;
120
- }
121
-
122
- function isLikeNone(x) {
123
- return x === undefined || x === null;
124
- }
125
-
126
- function getArrayJsValueFromWasm0(ptr, len) {
127
- ptr = ptr >>> 0;
128
- const mem = getDataViewMemory0();
129
- const result = [];
130
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
131
- result.push(wasm.__wbindgen_export_0.get(mem.getUint32(i, true)));
132
- }
133
- wasm.__externref_drop_slice(ptr, len);
134
- return result;
135
- }
136
- /**
137
- * Checks all locations of the input TA for reachability and returns all unreachable locations. The
138
- * result will be empty if all locations are reachable.
139
- *
140
- * This function will throw an error if one or more validation checks fail. The following
141
- * properties will be validated:
142
- * <ul>
143
- * <li>There exists exactly one initial location.</li>
144
- * <li>The set of locations is non-empty.</li>
145
- * <li>All invariants are downward-closed.</li>
146
- * <li>The highest constant used in any clock constraint is not greater than the highest allowed
147
- * value (536870909).</li>
148
- * <li>All locations names are unique.</li>
149
- * <li>All clock names are unique.</li>
150
- * <li>All clocks used in clock constraints are also contained in the set of clocks.</li>
151
- * <li>All location names used as source and target of switches are also contained in the set of
152
- * locations.</li>
153
- * </ul>
154
- * @param {TimedAutomaton} ta
155
- * @returns {string[]}
156
- */
157
- export function findUnreachableLocations(ta) {
158
- _assertClass(ta, TimedAutomaton);
159
- var ptr0 = ta.__destroy_into_raw();
160
- const ret = wasm.findUnreachableLocations(ptr0);
161
- var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
162
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
163
- return v2;
164
- }
165
-
166
- /**
167
- * @enum {0 | 1 | 2 | 3}
168
- */
169
- export const ClockComparator = Object.freeze({
170
- LESSER: 0, "0": "LESSER",
171
- LEQ: 1, "1": "LEQ",
172
- GEQ: 2, "2": "GEQ",
173
- GREATER: 3, "3": "GREATER",
174
- });
175
-
176
- const ClauseFinalization = (typeof FinalizationRegistry === 'undefined')
177
- ? { register: () => {}, unregister: () => {} }
178
- : new FinalizationRegistry(ptr => wasm.__wbg_clause_free(ptr >>> 0, 1));
179
-
180
1
  export class Clause {
181
-
182
2
  static __unwrap(jsValue) {
183
3
  if (!(jsValue instanceof Clause)) {
184
4
  return 0;
185
5
  }
186
6
  return jsValue.__destroy_into_raw();
187
7
  }
188
-
189
8
  __destroy_into_raw() {
190
9
  const ptr = this.__wbg_ptr;
191
10
  this.__wbg_ptr = 0;
192
11
  ClauseFinalization.unregister(this);
193
12
  return ptr;
194
13
  }
195
-
196
14
  free() {
197
15
  const ptr = this.__destroy_into_raw();
198
16
  wasm.__wbg_clause_free(ptr, 0);
@@ -212,26 +30,19 @@ export class Clause {
212
30
  }
213
31
  if (Symbol.dispose) Clause.prototype[Symbol.dispose] = Clause.prototype.free;
214
32
 
215
- const ClockFinalization = (typeof FinalizationRegistry === 'undefined')
216
- ? { register: () => {}, unregister: () => {} }
217
- : new FinalizationRegistry(ptr => wasm.__wbg_clock_free(ptr >>> 0, 1));
218
-
219
33
  export class Clock {
220
-
221
34
  static __unwrap(jsValue) {
222
35
  if (!(jsValue instanceof Clock)) {
223
36
  return 0;
224
37
  }
225
38
  return jsValue.__destroy_into_raw();
226
39
  }
227
-
228
40
  __destroy_into_raw() {
229
41
  const ptr = this.__wbg_ptr;
230
42
  this.__wbg_ptr = 0;
231
43
  ClockFinalization.unregister(this);
232
44
  return ptr;
233
45
  }
234
-
235
46
  free() {
236
47
  const ptr = this.__destroy_into_raw();
237
48
  wasm.__wbg_clock_free(ptr, 0);
@@ -250,19 +61,23 @@ export class Clock {
250
61
  }
251
62
  if (Symbol.dispose) Clock.prototype[Symbol.dispose] = Clock.prototype.free;
252
63
 
253
- const ClockConstraintFinalization = (typeof FinalizationRegistry === 'undefined')
254
- ? { register: () => {}, unregister: () => {} }
255
- : 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
+ });
256
73
 
257
74
  export class ClockConstraint {
258
-
259
75
  __destroy_into_raw() {
260
76
  const ptr = this.__wbg_ptr;
261
77
  this.__wbg_ptr = 0;
262
78
  ClockConstraintFinalization.unregister(this);
263
79
  return ptr;
264
80
  }
265
-
266
81
  free() {
267
82
  const ptr = this.__destroy_into_raw();
268
83
  wasm.__wbg_clockconstraint_free(ptr, 0);
@@ -281,26 +96,19 @@ export class ClockConstraint {
281
96
  }
282
97
  if (Symbol.dispose) ClockConstraint.prototype[Symbol.dispose] = ClockConstraint.prototype.free;
283
98
 
284
- const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
285
- ? { register: () => {}, unregister: () => {} }
286
- : new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0, 1));
287
-
288
99
  export class Location {
289
-
290
100
  static __unwrap(jsValue) {
291
101
  if (!(jsValue instanceof Location)) {
292
102
  return 0;
293
103
  }
294
104
  return jsValue.__destroy_into_raw();
295
105
  }
296
-
297
106
  __destroy_into_raw() {
298
107
  const ptr = this.__wbg_ptr;
299
108
  this.__wbg_ptr = 0;
300
109
  LocationFinalization.unregister(this);
301
110
  return ptr;
302
111
  }
303
-
304
112
  free() {
305
113
  const ptr = this.__destroy_into_raw();
306
114
  wasm.__wbg_location_free(ptr, 0);
@@ -326,26 +134,19 @@ export class Location {
326
134
  }
327
135
  if (Symbol.dispose) Location.prototype[Symbol.dispose] = Location.prototype.free;
328
136
 
329
- const SwitchFinalization = (typeof FinalizationRegistry === 'undefined')
330
- ? { register: () => {}, unregister: () => {} }
331
- : new FinalizationRegistry(ptr => wasm.__wbg_switch_free(ptr >>> 0, 1));
332
-
333
137
  export class Switch {
334
-
335
138
  static __unwrap(jsValue) {
336
139
  if (!(jsValue instanceof Switch)) {
337
140
  return 0;
338
141
  }
339
142
  return jsValue.__destroy_into_raw();
340
143
  }
341
-
342
144
  __destroy_into_raw() {
343
145
  const ptr = this.__wbg_ptr;
344
146
  this.__wbg_ptr = 0;
345
147
  SwitchFinalization.unregister(this);
346
148
  return ptr;
347
149
  }
348
-
349
150
  free() {
350
151
  const ptr = this.__destroy_into_raw();
351
152
  wasm.__wbg_switch_free(ptr, 0);
@@ -377,19 +178,13 @@ export class Switch {
377
178
  }
378
179
  if (Symbol.dispose) Switch.prototype[Symbol.dispose] = Switch.prototype.free;
379
180
 
380
- const TimedAutomatonFinalization = (typeof FinalizationRegistry === 'undefined')
381
- ? { register: () => {}, unregister: () => {} }
382
- : new FinalizationRegistry(ptr => wasm.__wbg_timedautomaton_free(ptr >>> 0, 1));
383
-
384
181
  export class TimedAutomaton {
385
-
386
182
  __destroy_into_raw() {
387
183
  const ptr = this.__wbg_ptr;
388
184
  this.__wbg_ptr = 0;
389
185
  TimedAutomatonFinalization.unregister(this);
390
186
  return ptr;
391
187
  }
392
-
393
188
  free() {
394
189
  const ptr = this.__destroy_into_raw();
395
190
  wasm.__wbg_timedautomaton_free(ptr, 0);
@@ -414,44 +209,213 @@ export class TimedAutomaton {
414
209
  }
415
210
  if (Symbol.dispose) TimedAutomaton.prototype[Symbol.dispose] = TimedAutomaton.prototype.free;
416
211
 
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_be289d5034ed271b(arg0, arg1) {
242
+ throw new Error(getStringFromWasm0(arg0, arg1));
243
+ }
417
244
  export function __wbg_clause_unwrap(arg0) {
418
245
  const ret = Clause.__unwrap(arg0);
419
246
  return ret;
420
- };
421
-
247
+ }
422
248
  export function __wbg_clock_unwrap(arg0) {
423
249
  const ret = Clock.__unwrap(arg0);
424
250
  return ret;
425
- };
426
-
251
+ }
427
252
  export function __wbg_location_unwrap(arg0) {
428
253
  const ret = Location.__unwrap(arg0);
429
254
  return ret;
430
- };
431
-
255
+ }
432
256
  export function __wbg_switch_unwrap(arg0) {
433
257
  const ret = Switch.__unwrap(arg0);
434
258
  return ret;
435
- };
436
-
437
- export function __wbg_wbindgenthrow_451ec1a8469d7eb6(arg0, arg1) {
438
- throw new Error(getStringFromWasm0(arg0, arg1));
439
- };
440
-
441
- export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
259
+ }
260
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
442
261
  // Cast intrinsic for `Ref(String) -> Externref`.
443
262
  const ret = getStringFromWasm0(arg0, arg1);
444
263
  return ret;
445
- };
446
-
264
+ }
447
265
  export function __wbindgen_init_externref_table() {
448
- const table = wasm.__wbindgen_export_0;
266
+ const table = wasm.__wbindgen_externrefs;
449
267
  const offset = table.grow(4);
450
268
  table.set(0, undefined);
451
269
  table.set(offset + 0, undefined);
452
270
  table.set(offset + 1, null);
453
271
  table.set(offset + 2, true);
454
272
  table.set(offset + 3, false);
455
- ;
456
- };
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));
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
+ }
457
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