@scalable-vector-audio/sva-wasm 0.5.1 → 0.7.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@scalable-vector-audio/sva-wasm",
3
3
  "type": "module",
4
4
  "description": "JS bindings: a composition a page fills node by node, rendered in the browser",
5
- "version": "0.5.1",
5
+ "version": "0.7.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/sva_wasm.d.ts CHANGED
@@ -1,55 +1,46 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
- export class Checkpoint {
5
- private constructor();
6
- free(): void;
7
- [Symbol.dispose](): void;
8
- readonly position: number;
9
- }
10
-
11
4
  export class Composition {
12
5
  free(): void;
13
6
  [Symbol.dispose](): void;
14
- bound_cache(max_bytes: number): void;
15
- /**
16
- * Empties the memory tier only: a persistent pack outlives it by design.
17
- */
18
7
  clear_cache(): void;
19
- clear_volatile(): void;
20
8
  insert(path: string, text: string): void;
21
9
  constructor(name?: string | null);
22
10
  /**
23
- * `name` labels the composition as `new` does; renders persist under `cache` in a dedicated
24
- * worker's private file system, and anywhere none opens, or `cache` is held, memory-only.
11
+ * Over the store in `dir`, an origin-private file system directory, or memory alone
12
+ * where there is none.
25
13
  */
26
- static persistent(name: string | null | undefined, cache: string, max_bytes?: number | null): Promise<Composition>;
14
+ static open(name?: string | null, dir?: FileSystemDirectoryHandle | null): Promise<Composition>;
27
15
  /**
28
- * Unset, `target` is `master`; `until` is the horizon in seconds, or `"silent"` to end
29
- * where every later sample is provably under `2^-bits` (default the profile's own), by
30
- * `max_secs` at the latest. `rate` is the observation rate. What reads a `volatile`
31
- * parameter is kept in a slot, never in either store.
16
+ * The only write to the directory `open` was handed: every value computed since the last.
32
17
  */
33
- render(target: string | null | undefined, rate: number | null | undefined, until: any, volatile?: string[] | null, bits?: number | null, max_secs?: number | null): Rendering;
18
+ persist(): Promise<number>;
34
19
  /**
35
- * A stream of `target` (`master` unset) at `rate`, `block` samples a block, each key of
36
- * `bindings` a named argument on the target. `until: "silent"` ends it at the first block
37
- * whose end proves every later sample under `2^-bits`, throwing past `max_secs`.
20
+ * `"oldest"` evicts what the latest render neither stored nor read, `"forks"` every value
21
+ * fewer than two nodes read.
38
22
  */
39
- stream(target: string | null | undefined, rate: number | null | undefined, block: number, bindings: any, until: any, bits?: number | null, max_secs?: number | null): Stream;
23
+ prune(policy: string): void;
40
24
  /**
41
- * The memory tier's, as `cache_max_bytes` is; `persistent_bytes` is the pack's.
25
+ * `target` as `sva-cli render` takes it, `@piano([0, 2b], f0=C4)`; `representations`
26
+ * what `representations()` answers, `samples` where unset, each a call as
27
+ * `--representation` writes it. `options` sets `rate`, `bits`, `flop_budget`, `until`,
28
+ * `volatile` and `cache`.
42
29
  */
43
- readonly cache_bytes: number;
44
- readonly cache_max_bytes: number;
45
- readonly persistent: boolean;
30
+ render(target: string, representations: string[] | null | undefined, options: any): Promise<Rendering>;
31
+ set_cache_policy(policy: string): void;
32
+ set_prune_policy(policy: string): void;
46
33
  /**
47
- * Zero on a memory-only composition, as `persistent_max_bytes` is.
34
+ * `target` block by block, through this store. `options`: `rate`, `bits`, `until`, `cache`,
35
+ * `live`.
48
36
  */
49
- readonly persistent_bytes: number;
50
- readonly persistent_max_bytes: number;
51
- volatile_max_bytes: number;
52
- readonly volatile_bytes: number;
37
+ stream(target: string, block: number, options: any): Stream;
38
+ readonly cache_bytes: number;
39
+ readonly cache_entries: number;
40
+ readonly cache_evictions: number;
41
+ cache_max_bytes: number;
42
+ readonly cache_policy: string;
43
+ readonly prune_policy: string;
53
44
  }
54
45
 
55
46
  export class Rendering {
@@ -57,45 +48,59 @@ export class Rendering {
57
48
  free(): void;
58
49
  [Symbol.dispose](): void;
59
50
  /**
60
- * The object `sva-cli render --as <name>` puts under `data`, arrays capped as it caps.
51
+ * The object `sva-cli render` puts under `data`, one reading per representation asked,
52
+ * arrays capped as it caps.
61
53
  */
62
- query(representation: string, from_secs?: number | null, to_secs?: number | null): any;
63
- samples(channel: number, from_secs?: number | null, to_secs?: number | null): Float32Array;
54
+ representations(): any;
55
+ samples(channel: number): Float32Array;
64
56
  /**
65
- * The object `sva-cli render` puts under `data.cache.stats`.
57
+ * Every lookup this render made of the composition's store, and what each came to.
66
58
  */
67
59
  stats(): any;
68
60
  work(): any;
69
61
  readonly channels: number;
70
62
  readonly duration_secs: number;
71
63
  readonly sample_rate: number;
64
+ readonly start_secs: number;
72
65
  readonly target: string;
73
66
  }
74
67
 
75
68
  /**
76
- * A target block by block, for a player that cannot know how long a note is held.
69
+ * A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
70
+ * A key-up replaces a term with one whose release is a number. A term leaves with its handle
71
+ * once its node ends, bar the last.
77
72
  */
78
73
  export class Stream {
79
74
  private constructor();
80
75
  free(): void;
81
76
  [Symbol.dispose](): void;
82
- checkpoint(): Checkpoint;
77
+ /**
78
+ * `term` summed into `@notes`.
79
+ */
80
+ add(term: string): number;
81
+ /**
82
+ * `expr` in place of the target.
83
+ */
84
+ edit(expr: string): void;
83
85
  /**
84
86
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
85
87
  * samples each component took: `block`, fewer where silence ends inside it, `0` after.
86
88
  */
87
89
  next(out: Float32Array): number;
90
+ remove(handle: number): boolean;
88
91
  /**
89
- * `until` as `stream` takes it, `max_secs` counted from the checkpoint.
92
+ * False where the stream no longer holds `handle`.
90
93
  */
91
- resume(checkpoint: Checkpoint, bindings: any, until: any, bits?: number | null, max_secs?: number | null): Stream;
94
+ replace(handle: number, term: string): boolean;
95
+ stats(): any;
92
96
  /**
93
- * `{ samples, proofs, priced_flops, waves }` since it opened or resumed.
97
+ * `{ samples, priced_flops, waves }` since it opened.
94
98
  */
95
99
  work(): any;
96
100
  readonly block: number;
97
101
  readonly channels: number;
98
102
  readonly end: number | undefined;
103
+ readonly held_bytes: number;
99
104
  readonly position: number;
100
105
  readonly sample_rate: number;
101
106
  }
@@ -111,48 +116,53 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
111
116
 
112
117
  export interface InitOutput {
113
118
  readonly memory: WebAssembly.Memory;
114
- readonly __wbg_checkpoint_free: (a: number, b: number) => void;
115
119
  readonly __wbg_composition_free: (a: number, b: number) => void;
116
120
  readonly __wbg_rendering_free: (a: number, b: number) => void;
117
121
  readonly __wbg_stream_free: (a: number, b: number) => void;
118
122
  readonly builtins: () => [number, number, number];
119
- readonly checkpoint_position: (a: number) => number;
120
- readonly composition_bound_cache: (a: number, b: number) => void;
121
123
  readonly composition_cache_bytes: (a: number) => number;
124
+ readonly composition_cache_entries: (a: number) => number;
125
+ readonly composition_cache_evictions: (a: number) => number;
122
126
  readonly composition_cache_max_bytes: (a: number) => number;
127
+ readonly composition_cache_policy: (a: number) => [number, number];
123
128
  readonly composition_clear_cache: (a: number) => void;
124
- readonly composition_clear_volatile: (a: number) => void;
125
129
  readonly composition_insert: (a: number, b: number, c: number, d: number, e: number) => void;
126
- readonly composition_is_persistent: (a: number) => number;
127
130
  readonly composition_new: (a: number, b: number) => number;
128
- readonly composition_persistent: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
129
- readonly composition_persistent_bytes: (a: number) => number;
130
- readonly composition_persistent_max_bytes: (a: number) => number;
131
- readonly composition_render: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
132
- readonly composition_set_volatile_max_bytes: (a: number, b: number) => void;
133
- readonly composition_stream: (a: number, b: number, c: number, d: number, e: number, f: any, g: any, h: number, i: number, j: number) => [number, number, number];
134
- readonly composition_volatile_bytes: (a: number) => number;
135
- readonly composition_volatile_max_bytes: (a: number) => number;
131
+ readonly composition_open: (a: number, b: number, c: number) => any;
132
+ readonly composition_persist: (a: number) => any;
133
+ readonly composition_prune: (a: number, b: number, c: number) => [number, number];
134
+ readonly composition_prune_policy: (a: number) => [number, number];
135
+ readonly composition_render: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
136
+ readonly composition_set_cache_max_bytes: (a: number, b: number) => void;
137
+ readonly composition_set_cache_policy: (a: number, b: number, c: number) => [number, number];
138
+ readonly composition_set_prune_policy: (a: number, b: number, c: number) => [number, number];
139
+ readonly composition_stream: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
136
140
  readonly outline: (a: number, b: number) => [number, number, number];
137
141
  readonly rendering_channels: (a: number) => number;
138
142
  readonly rendering_duration_secs: (a: number) => number;
139
- readonly rendering_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
143
+ readonly rendering_representations: (a: number) => [number, number, number];
140
144
  readonly rendering_sample_rate: (a: number) => number;
141
- readonly rendering_samples: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
145
+ readonly rendering_samples: (a: number, b: number) => [number, number, number, number];
146
+ readonly rendering_start_secs: (a: number) => number;
142
147
  readonly rendering_stats: (a: number) => [number, number, number];
143
148
  readonly rendering_target: (a: number) => [number, number];
144
149
  readonly rendering_work: (a: number) => [number, number, number];
150
+ readonly stream_add: (a: number, b: number, c: number) => [number, number, number];
145
151
  readonly stream_block: (a: number) => number;
146
152
  readonly stream_channels: (a: number) => number;
147
- readonly stream_checkpoint: (a: number) => number;
153
+ readonly stream_edit: (a: number, b: number, c: number) => [number, number];
148
154
  readonly stream_end: (a: number) => [number, number];
155
+ readonly stream_held_bytes: (a: number) => number;
149
156
  readonly stream_next: (a: number, b: number, c: number, d: any) => [number, number, number];
150
157
  readonly stream_position: (a: number) => number;
151
- readonly stream_resume: (a: number, b: number, c: any, d: any, e: number, f: number, g: number) => [number, number, number];
158
+ readonly stream_remove: (a: number, b: number) => [number, number, number];
159
+ readonly stream_replace: (a: number, b: number, c: number, d: number) => [number, number, number];
152
160
  readonly stream_sample_rate: (a: number) => number;
161
+ readonly stream_stats: (a: number) => [number, number, number];
153
162
  readonly stream_work: (a: number) => [number, number, number];
154
163
  readonly wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95: (a: number, b: number, c: any, d: any) => void;
155
164
  readonly wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150: (a: number, b: number, c: any) => [number, number];
165
+ readonly wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385: (a: number, b: number) => any;
156
166
  readonly __wbindgen_malloc: (a: number, b: number) => number;
157
167
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
158
168
  readonly __wbindgen_exn_store: (a: number) => void;
package/sva_wasm.js CHANGED
@@ -1,32 +1,5 @@
1
1
  /* @ts-self-types="./sva_wasm.d.ts" */
2
2
 
3
- export class Checkpoint {
4
- static __wrap(ptr) {
5
- const obj = Object.create(Checkpoint.prototype);
6
- obj.__wbg_ptr = ptr;
7
- CheckpointFinalization.register(obj, obj.__wbg_ptr, obj);
8
- return obj;
9
- }
10
- __destroy_into_raw() {
11
- const ptr = this.__wbg_ptr;
12
- this.__wbg_ptr = 0;
13
- CheckpointFinalization.unregister(this);
14
- return ptr;
15
- }
16
- free() {
17
- const ptr = this.__destroy_into_raw();
18
- wasm.__wbg_checkpoint_free(ptr, 0);
19
- }
20
- /**
21
- * @returns {number}
22
- */
23
- get position() {
24
- const ret = wasm.checkpoint_position(this.__wbg_ptr);
25
- return ret;
26
- }
27
- }
28
- if (Symbol.dispose) Checkpoint.prototype[Symbol.dispose] = Checkpoint.prototype.free;
29
-
30
3
  export class Composition {
31
4
  static __wrap(ptr) {
32
5
  const obj = Object.create(Composition.prototype);
@@ -45,17 +18,24 @@ export class Composition {
45
18
  wasm.__wbg_composition_free(ptr, 0);
46
19
  }
47
20
  /**
48
- * @param {number} max_bytes
21
+ * @returns {number}
49
22
  */
50
- bound_cache(max_bytes) {
51
- wasm.composition_bound_cache(this.__wbg_ptr, max_bytes);
23
+ get cache_bytes() {
24
+ const ret = wasm.composition_cache_bytes(this.__wbg_ptr);
25
+ return ret;
52
26
  }
53
27
  /**
54
- * The memory tier's, as `cache_max_bytes` is; `persistent_bytes` is the pack's.
55
28
  * @returns {number}
56
29
  */
57
- get cache_bytes() {
58
- const ret = wasm.composition_cache_bytes(this.__wbg_ptr);
30
+ get cache_entries() {
31
+ const ret = wasm.composition_cache_entries(this.__wbg_ptr);
32
+ return ret >>> 0;
33
+ }
34
+ /**
35
+ * @returns {number}
36
+ */
37
+ get cache_evictions() {
38
+ const ret = wasm.composition_cache_evictions(this.__wbg_ptr);
59
39
  return ret;
60
40
  }
61
41
  /**
@@ -66,14 +46,23 @@ export class Composition {
66
46
  return ret;
67
47
  }
68
48
  /**
69
- * Empties the memory tier only: a persistent pack outlives it by design.
49
+ * @returns {string}
70
50
  */
51
+ get cache_policy() {
52
+ let deferred1_0;
53
+ let deferred1_1;
54
+ try {
55
+ const ret = wasm.composition_cache_policy(this.__wbg_ptr);
56
+ deferred1_0 = ret[0];
57
+ deferred1_1 = ret[1];
58
+ return getStringFromWasm0(ret[0], ret[1]);
59
+ } finally {
60
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
61
+ }
62
+ }
71
63
  clear_cache() {
72
64
  wasm.composition_clear_cache(this.__wbg_ptr);
73
65
  }
74
- clear_volatile() {
75
- wasm.composition_clear_volatile(this.__wbg_ptr);
76
- }
77
66
  /**
78
67
  * @param {string} path
79
68
  * @param {string} text
@@ -85,13 +74,6 @@ export class Composition {
85
74
  const len1 = WASM_VECTOR_LEN;
86
75
  wasm.composition_insert(this.__wbg_ptr, ptr0, len0, ptr1, len1);
87
76
  }
88
- /**
89
- * @returns {boolean}
90
- */
91
- get persistent() {
92
- const ret = wasm.composition_is_persistent(this.__wbg_ptr);
93
- return ret !== 0;
94
- }
95
77
  /**
96
78
  * @param {string | null} [name]
97
79
  */
@@ -104,101 +86,116 @@ export class Composition {
104
86
  return this;
105
87
  }
106
88
  /**
107
- * `name` labels the composition as `new` does; renders persist under `cache` in a dedicated
108
- * worker's private file system, and anywhere none opens, or `cache` is held, memory-only.
109
- * @param {string | null | undefined} name
110
- * @param {string} cache
111
- * @param {number | null} [max_bytes]
89
+ * Over the store in `dir`, an origin-private file system directory, or memory alone
90
+ * where there is none.
91
+ * @param {string | null} [name]
92
+ * @param {FileSystemDirectoryHandle | null} [dir]
112
93
  * @returns {Promise<Composition>}
113
94
  */
114
- static persistent(name, cache, max_bytes) {
95
+ static open(name, dir) {
115
96
  var ptr0 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
116
97
  var len0 = WASM_VECTOR_LEN;
117
- const ptr1 = passStringToWasm0(cache, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
118
- const len1 = WASM_VECTOR_LEN;
119
- const ret = wasm.composition_persistent(ptr0, len0, ptr1, len1, !isLikeNone(max_bytes), isLikeNone(max_bytes) ? 0 : max_bytes);
98
+ const ret = wasm.composition_open(ptr0, len0, isLikeNone(dir) ? 0 : addToExternrefTable0(dir));
120
99
  return ret;
121
100
  }
122
101
  /**
123
- * Zero on a memory-only composition, as `persistent_max_bytes` is.
124
- * @returns {number}
102
+ * The only write to the directory `open` was handed: every value computed since the last.
103
+ * @returns {Promise<number>}
125
104
  */
126
- get persistent_bytes() {
127
- const ret = wasm.composition_persistent_bytes(this.__wbg_ptr);
105
+ persist() {
106
+ const ret = wasm.composition_persist(this.__wbg_ptr);
128
107
  return ret;
129
108
  }
130
109
  /**
131
- * @returns {number}
110
+ * `"oldest"` evicts what the latest render neither stored nor read, `"forks"` every value
111
+ * fewer than two nodes read.
112
+ * @param {string} policy
132
113
  */
133
- get persistent_max_bytes() {
134
- const ret = wasm.composition_persistent_max_bytes(this.__wbg_ptr);
135
- return ret;
114
+ prune(policy) {
115
+ const ptr0 = passStringToWasm0(policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
116
+ const len0 = WASM_VECTOR_LEN;
117
+ const ret = wasm.composition_prune(this.__wbg_ptr, ptr0, len0);
118
+ if (ret[1]) {
119
+ throw takeFromExternrefTable0(ret[0]);
120
+ }
136
121
  }
137
122
  /**
138
- * Unset, `target` is `master`; `until` is the horizon in seconds, or `"silent"` to end
139
- * where every later sample is provably under `2^-bits` (default the profile's own), by
140
- * `max_secs` at the latest. `rate` is the observation rate. What reads a `volatile`
141
- * parameter is kept in a slot, never in either store.
142
- * @param {string | null | undefined} target
143
- * @param {number | null | undefined} rate
144
- * @param {any} until
145
- * @param {string[] | null} [volatile]
146
- * @param {number | null} [bits]
147
- * @param {number | null} [max_secs]
148
- * @returns {Rendering}
123
+ * @returns {string}
149
124
  */
150
- render(target, rate, until, volatile, bits, max_secs) {
151
- var ptr0 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
152
- var len0 = WASM_VECTOR_LEN;
153
- var ptr1 = isLikeNone(volatile) ? 0 : passArrayJsValueToWasm0(volatile, wasm.__wbindgen_malloc);
154
- var len1 = WASM_VECTOR_LEN;
155
- const ret = wasm.composition_render(this.__wbg_ptr, ptr0, len0, isLikeNone(rate) ? Number.MAX_SAFE_INTEGER : (rate) >>> 0, until, ptr1, len1, isLikeNone(bits) ? Number.MAX_SAFE_INTEGER : (bits) >>> 0, !isLikeNone(max_secs), isLikeNone(max_secs) ? 0 : max_secs);
156
- if (ret[2]) {
157
- throw takeFromExternrefTable0(ret[1]);
125
+ get prune_policy() {
126
+ let deferred1_0;
127
+ let deferred1_1;
128
+ try {
129
+ const ret = wasm.composition_prune_policy(this.__wbg_ptr);
130
+ deferred1_0 = ret[0];
131
+ deferred1_1 = ret[1];
132
+ return getStringFromWasm0(ret[0], ret[1]);
133
+ } finally {
134
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
158
135
  }
159
- return Rendering.__wrap(ret[0]);
136
+ }
137
+ /**
138
+ * `target` as `sva-cli render` takes it, `@piano([0, 2b], f0=C4)`; `representations`
139
+ * what `representations()` answers, `samples` where unset, each a call as
140
+ * `--representation` writes it. `options` sets `rate`, `bits`, `flop_budget`, `until`,
141
+ * `volatile` and `cache`.
142
+ * @param {string} target
143
+ * @param {string[] | null | undefined} representations
144
+ * @param {any} options
145
+ * @returns {Promise<Rendering>}
146
+ */
147
+ render(target, representations, options) {
148
+ const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
149
+ const len0 = WASM_VECTOR_LEN;
150
+ var ptr1 = isLikeNone(representations) ? 0 : passArrayJsValueToWasm0(representations, wasm.__wbindgen_malloc);
151
+ var len1 = WASM_VECTOR_LEN;
152
+ const ret = wasm.composition_render(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);
153
+ return ret;
160
154
  }
161
155
  /**
162
156
  * @param {number} max_bytes
163
157
  */
164
- set volatile_max_bytes(max_bytes) {
165
- wasm.composition_set_volatile_max_bytes(this.__wbg_ptr, max_bytes);
158
+ set cache_max_bytes(max_bytes) {
159
+ wasm.composition_set_cache_max_bytes(this.__wbg_ptr, max_bytes);
166
160
  }
167
161
  /**
168
- * A stream of `target` (`master` unset) at `rate`, `block` samples a block, each key of
169
- * `bindings` a named argument on the target. `until: "silent"` ends it at the first block
170
- * whose end proves every later sample under `2^-bits`, throwing past `max_secs`.
171
- * @param {string | null | undefined} target
172
- * @param {number | null | undefined} rate
173
- * @param {number} block
174
- * @param {any} bindings
175
- * @param {any} until
176
- * @param {number | null} [bits]
177
- * @param {number | null} [max_secs]
178
- * @returns {Stream}
162
+ * @param {string} policy
179
163
  */
180
- stream(target, rate, block, bindings, until, bits, max_secs) {
181
- var ptr0 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
182
- var len0 = WASM_VECTOR_LEN;
183
- const ret = wasm.composition_stream(this.__wbg_ptr, ptr0, len0, isLikeNone(rate) ? Number.MAX_SAFE_INTEGER : (rate) >>> 0, block, bindings, until, isLikeNone(bits) ? Number.MAX_SAFE_INTEGER : (bits) >>> 0, !isLikeNone(max_secs), isLikeNone(max_secs) ? 0 : max_secs);
184
- if (ret[2]) {
185
- throw takeFromExternrefTable0(ret[1]);
164
+ set_cache_policy(policy) {
165
+ const ptr0 = passStringToWasm0(policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
166
+ const len0 = WASM_VECTOR_LEN;
167
+ const ret = wasm.composition_set_cache_policy(this.__wbg_ptr, ptr0, len0);
168
+ if (ret[1]) {
169
+ throw takeFromExternrefTable0(ret[0]);
186
170
  }
187
- return Stream.__wrap(ret[0]);
188
171
  }
189
172
  /**
190
- * @returns {number}
173
+ * @param {string} policy
191
174
  */
192
- get volatile_bytes() {
193
- const ret = wasm.composition_volatile_bytes(this.__wbg_ptr);
194
- return ret;
175
+ set_prune_policy(policy) {
176
+ const ptr0 = passStringToWasm0(policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
177
+ const len0 = WASM_VECTOR_LEN;
178
+ const ret = wasm.composition_set_prune_policy(this.__wbg_ptr, ptr0, len0);
179
+ if (ret[1]) {
180
+ throw takeFromExternrefTable0(ret[0]);
181
+ }
195
182
  }
196
183
  /**
197
- * @returns {number}
184
+ * `target` block by block, through this store. `options`: `rate`, `bits`, `until`, `cache`,
185
+ * `live`.
186
+ * @param {string} target
187
+ * @param {number} block
188
+ * @param {any} options
189
+ * @returns {Stream}
198
190
  */
199
- get volatile_max_bytes() {
200
- const ret = wasm.composition_volatile_max_bytes(this.__wbg_ptr);
201
- return ret;
191
+ stream(target, block, options) {
192
+ const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
193
+ const len0 = WASM_VECTOR_LEN;
194
+ const ret = wasm.composition_stream(this.__wbg_ptr, ptr0, len0, block, options);
195
+ if (ret[2]) {
196
+ throw takeFromExternrefTable0(ret[1]);
197
+ }
198
+ return Stream.__wrap(ret[0]);
202
199
  }
203
200
  }
204
201
  if (Symbol.dispose) Composition.prototype[Symbol.dispose] = Composition.prototype.free;
@@ -235,16 +232,12 @@ export class Rendering {
235
232
  return ret;
236
233
  }
237
234
  /**
238
- * The object `sva-cli render --as <name>` puts under `data`, arrays capped as it caps.
239
- * @param {string} representation
240
- * @param {number | null} [from_secs]
241
- * @param {number | null} [to_secs]
235
+ * The object `sva-cli render` puts under `data`, one reading per representation asked,
236
+ * arrays capped as it caps.
242
237
  * @returns {any}
243
238
  */
244
- query(representation, from_secs, to_secs) {
245
- const ptr0 = passStringToWasm0(representation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
- const len0 = WASM_VECTOR_LEN;
247
- const ret = wasm.rendering_query(this.__wbg_ptr, ptr0, len0, !isLikeNone(from_secs), isLikeNone(from_secs) ? 0 : from_secs, !isLikeNone(to_secs), isLikeNone(to_secs) ? 0 : to_secs);
239
+ representations() {
240
+ const ret = wasm.rendering_representations(this.__wbg_ptr);
248
241
  if (ret[2]) {
249
242
  throw takeFromExternrefTable0(ret[1]);
250
243
  }
@@ -259,12 +252,10 @@ export class Rendering {
259
252
  }
260
253
  /**
261
254
  * @param {number} channel
262
- * @param {number | null} [from_secs]
263
- * @param {number | null} [to_secs]
264
255
  * @returns {Float32Array}
265
256
  */
266
- samples(channel, from_secs, to_secs) {
267
- const ret = wasm.rendering_samples(this.__wbg_ptr, channel, !isLikeNone(from_secs), isLikeNone(from_secs) ? 0 : from_secs, !isLikeNone(to_secs), isLikeNone(to_secs) ? 0 : to_secs);
257
+ samples(channel) {
258
+ const ret = wasm.rendering_samples(this.__wbg_ptr, channel);
268
259
  if (ret[3]) {
269
260
  throw takeFromExternrefTable0(ret[2]);
270
261
  }
@@ -273,7 +264,14 @@ export class Rendering {
273
264
  return v1;
274
265
  }
275
266
  /**
276
- * The object `sva-cli render` puts under `data.cache.stats`.
267
+ * @returns {number}
268
+ */
269
+ get start_secs() {
270
+ const ret = wasm.rendering_start_secs(this.__wbg_ptr);
271
+ return ret;
272
+ }
273
+ /**
274
+ * Every lookup this render made of the composition's store, and what each came to.
277
275
  * @returns {any}
278
276
  */
279
277
  stats() {
@@ -312,7 +310,9 @@ export class Rendering {
312
310
  if (Symbol.dispose) Rendering.prototype[Symbol.dispose] = Rendering.prototype.free;
313
311
 
314
312
  /**
315
- * A target block by block, for a player that cannot know how long a note is held.
313
+ * A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
314
+ * A key-up replaces a term with one whose release is a number. A term leaves with its handle
315
+ * once its node ends, bar the last.
316
316
  */
317
317
  export class Stream {
318
318
  static __wrap(ptr) {
@@ -331,6 +331,20 @@ export class Stream {
331
331
  const ptr = this.__destroy_into_raw();
332
332
  wasm.__wbg_stream_free(ptr, 0);
333
333
  }
334
+ /**
335
+ * `term` summed into `@notes`.
336
+ * @param {string} term
337
+ * @returns {number}
338
+ */
339
+ add(term) {
340
+ const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
341
+ const len0 = WASM_VECTOR_LEN;
342
+ const ret = wasm.stream_add(this.__wbg_ptr, ptr0, len0);
343
+ if (ret[2]) {
344
+ throw takeFromExternrefTable0(ret[1]);
345
+ }
346
+ return ret[0] >>> 0;
347
+ }
334
348
  /**
335
349
  * @returns {number}
336
350
  */
@@ -346,11 +360,16 @@ export class Stream {
346
360
  return ret >>> 0;
347
361
  }
348
362
  /**
349
- * @returns {Checkpoint}
363
+ * `expr` in place of the target.
364
+ * @param {string} expr
350
365
  */
351
- checkpoint() {
352
- const ret = wasm.stream_checkpoint(this.__wbg_ptr);
353
- return Checkpoint.__wrap(ret);
366
+ edit(expr) {
367
+ const ptr0 = passStringToWasm0(expr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
+ const len0 = WASM_VECTOR_LEN;
369
+ const ret = wasm.stream_edit(this.__wbg_ptr, ptr0, len0);
370
+ if (ret[1]) {
371
+ throw takeFromExternrefTable0(ret[0]);
372
+ }
354
373
  }
355
374
  /**
356
375
  * @returns {number | undefined}
@@ -359,6 +378,13 @@ export class Stream {
359
378
  const ret = wasm.stream_end(this.__wbg_ptr);
360
379
  return ret[0] === 0 ? undefined : ret[1];
361
380
  }
381
+ /**
382
+ * @returns {number}
383
+ */
384
+ get held_bytes() {
385
+ const ret = wasm.stream_held_bytes(this.__wbg_ptr);
386
+ return ret;
387
+ }
362
388
  /**
363
389
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
364
390
  * samples each component took: `block`, fewer where silence ends inside it, `0` after.
@@ -382,21 +408,30 @@ export class Stream {
382
408
  return ret;
383
409
  }
384
410
  /**
385
- * `until` as `stream` takes it, `max_secs` counted from the checkpoint.
386
- * @param {Checkpoint} checkpoint
387
- * @param {any} bindings
388
- * @param {any} until
389
- * @param {number | null} [bits]
390
- * @param {number | null} [max_secs]
391
- * @returns {Stream}
411
+ * @param {number} handle
412
+ * @returns {boolean}
392
413
  */
393
- resume(checkpoint, bindings, until, bits, max_secs) {
394
- _assertClass(checkpoint, Checkpoint);
395
- const ret = wasm.stream_resume(this.__wbg_ptr, checkpoint.__wbg_ptr, bindings, until, isLikeNone(bits) ? Number.MAX_SAFE_INTEGER : (bits) >>> 0, !isLikeNone(max_secs), isLikeNone(max_secs) ? 0 : max_secs);
414
+ remove(handle) {
415
+ const ret = wasm.stream_remove(this.__wbg_ptr, handle);
396
416
  if (ret[2]) {
397
417
  throw takeFromExternrefTable0(ret[1]);
398
418
  }
399
- return Stream.__wrap(ret[0]);
419
+ return ret[0] !== 0;
420
+ }
421
+ /**
422
+ * False where the stream no longer holds `handle`.
423
+ * @param {number} handle
424
+ * @param {string} term
425
+ * @returns {boolean}
426
+ */
427
+ replace(handle, term) {
428
+ const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
+ const len0 = WASM_VECTOR_LEN;
430
+ const ret = wasm.stream_replace(this.__wbg_ptr, handle, ptr0, len0);
431
+ if (ret[2]) {
432
+ throw takeFromExternrefTable0(ret[1]);
433
+ }
434
+ return ret[0] !== 0;
400
435
  }
401
436
  /**
402
437
  * @returns {number}
@@ -406,7 +441,17 @@ export class Stream {
406
441
  return ret >>> 0;
407
442
  }
408
443
  /**
409
- * `{ samples, proofs, priced_flops, waves }` since it opened or resumed.
444
+ * @returns {any}
445
+ */
446
+ stats() {
447
+ const ret = wasm.stream_stats(this.__wbg_ptr);
448
+ if (ret[2]) {
449
+ throw takeFromExternrefTable0(ret[1]);
450
+ }
451
+ return takeFromExternrefTable0(ret[0]);
452
+ }
453
+ /**
454
+ * `{ samples, priced_flops, waves }` since it opened.
410
455
  * @returns {any}
411
456
  */
412
457
  work() {
@@ -447,9 +492,21 @@ export function outline(text) {
447
492
  function __wbg_get_imports() {
448
493
  const import0 = {
449
494
  __proto__: null,
495
+ __wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function(arg0) {
496
+ const v = arg0;
497
+ const ret = typeof(v) === 'boolean' ? v : undefined;
498
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
499
+ },
450
500
  __wbg___wbindgen_copy_to_typed_array_cccd104be8cf0b8d: function(arg0, arg1, arg2) {
451
501
  new Uint8Array(arg2.buffer, arg2.byteOffset, arg2.byteLength).set(getArrayU8FromWasm0(arg0, arg1));
452
502
  },
503
+ __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
504
+ const ret = debugString(arg1);
505
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
506
+ const len1 = WASM_VECTOR_LEN;
507
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
508
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
509
+ },
453
510
  __wbg___wbindgen_is_falsy_4502df4d571fca70: function(arg0) {
454
511
  const ret = !arg0;
455
512
  return ret;
@@ -486,48 +543,50 @@ function __wbg_get_imports() {
486
543
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
487
544
  arg0._wbg_cb_unref();
488
545
  },
546
+ __wbg_arrayBuffer_303605bfdb02dbaa: function(arg0) {
547
+ const ret = arg0.arrayBuffer();
548
+ return ret;
549
+ },
550
+ __wbg_call_269c5566fbede3eb: function() { return handleError(function (arg0, arg1) {
551
+ const ret = arg0.call(arg1);
552
+ return ret;
553
+ }, arguments); },
489
554
  __wbg_call_6bcf8d3e20937e46: function() { return handleError(function (arg0, arg1, arg2) {
490
555
  const ret = arg0.call(arg1, arg2);
491
556
  return ret;
492
557
  }, arguments); },
493
- __wbg_close_1d55410e47fc11c8: function(arg0) {
494
- arg0.close();
558
+ __wbg_close_c91cbb2cddb6f7aa: function(arg0) {
559
+ const ret = arg0.close();
560
+ return ret;
495
561
  },
496
562
  __wbg_composition_new: function(arg0) {
497
563
  const ret = Composition.__wrap(arg0);
498
564
  return ret;
499
565
  },
500
- __wbg_createSyncAccessHandle_f2f0452f71047cd7: function(arg0) {
501
- const ret = arg0.createSyncAccessHandle();
566
+ __wbg_createWritable_dcac2d262cf50ae7: function(arg0) {
567
+ const ret = arg0.createWritable();
502
568
  return ret;
503
569
  },
504
570
  __wbg_entries_972a87586902cf87: function(arg0) {
505
571
  const ret = Object.entries(arg0);
506
572
  return ret;
507
573
  },
508
- __wbg_flush_91458c8278aae724: function() { return handleError(function (arg0) {
509
- arg0.flush();
510
- }, arguments); },
511
574
  __wbg_from_a39669ce566077da: function(arg0) {
512
575
  const ret = Array.from(arg0);
513
576
  return ret;
514
577
  },
515
- __wbg_getDirectoryHandle_df6fb6f1fc6240ed: function(arg0, arg1, arg2, arg3) {
578
+ __wbg_getDirectoryHandle_6ba4491be2862323: function(arg0, arg1, arg2, arg3) {
516
579
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
517
580
  return ret;
518
581
  },
519
- __wbg_getDirectory_31689baa30c0e94c: function(arg0) {
520
- const ret = arg0.getDirectory();
521
- return ret;
522
- },
523
- __wbg_getFileHandle_fbeae17e3423535f: function(arg0, arg1, arg2, arg3) {
582
+ __wbg_getFileHandle_9709cc764716faf0: function(arg0, arg1, arg2, arg3) {
524
583
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
525
584
  return ret;
526
585
  },
527
- __wbg_getSize_479486b8ac438f8e: function() { return handleError(function (arg0) {
528
- const ret = arg0.getSize();
586
+ __wbg_getFile_514e6ad2d0b16f74: function(arg0) {
587
+ const ret = arg0.getFile();
529
588
  return ret;
530
- }, arguments); },
589
+ },
531
590
  __wbg_get_989d0a1309644f2b: function() { return handleError(function (arg0, arg1) {
532
591
  const ret = Reflect.get(arg0, arg1);
533
592
  return ret;
@@ -540,26 +599,6 @@ function __wbg_get_imports() {
540
599
  const ret = arg0[arg1 >>> 0];
541
600
  return ret;
542
601
  },
543
- __wbg_instanceof_FileSystemDirectoryHandle_a5c1bdaafba684ca: function(arg0) {
544
- let result;
545
- try {
546
- result = arg0 instanceof FileSystemDirectoryHandle;
547
- } catch (_) {
548
- result = false;
549
- }
550
- const ret = result;
551
- return ret;
552
- },
553
- __wbg_instanceof_FileSystemFileHandle_aba527fd4c84a882: function(arg0) {
554
- let result;
555
- try {
556
- result = arg0 instanceof FileSystemFileHandle;
557
- } catch (_) {
558
- result = false;
559
- }
560
- const ret = result;
561
- return ret;
562
- },
563
602
  __wbg_instanceof_Object_87732cb922ac2e2c: function(arg0) {
564
603
  let result;
565
604
  try {
@@ -570,29 +609,31 @@ function __wbg_get_imports() {
570
609
  const ret = result;
571
610
  return ret;
572
611
  },
573
- __wbg_instanceof_WorkerGlobalScope_0c1a6411473b843f: function(arg0) {
574
- let result;
575
- try {
576
- result = arg0 instanceof WorkerGlobalScope;
577
- } catch (_) {
578
- result = false;
579
- }
580
- const ret = result;
612
+ __wbg_isArray_5674713bb7b79043: function(arg0) {
613
+ const ret = Array.isArray(arg0);
581
614
  return ret;
582
615
  },
583
- __wbg_keys_4d3b6ee519555a72: function(arg0) {
616
+ __wbg_keys_23712aa1a6f4aa5d: function(arg0) {
584
617
  const ret = arg0.keys();
585
618
  return ret;
586
619
  },
620
+ __wbg_length_31bdaf014f5fbde2: function(arg0) {
621
+ const ret = arg0.length;
622
+ return ret;
623
+ },
587
624
  __wbg_length_4e1adc0d42e23620: function(arg0) {
588
625
  const ret = arg0.length;
589
626
  return ret;
590
627
  },
591
- __wbg_navigator_d25c0f071226f233: function(arg0) {
592
- const ret = arg0.navigator;
628
+ __wbg_move_2019b378ef90cf6c: function(arg0, arg1, arg2, arg3) {
629
+ const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
630
+ return ret;
631
+ },
632
+ __wbg_new_1da3429bc3c4541c: function(arg0) {
633
+ const ret = new Uint8Array(arg0);
593
634
  return ret;
594
635
  },
595
- __wbg_new_27e74e58f1461a9c: function(arg0, arg1) {
636
+ __wbg_new_30145d082ba9492c: function(arg0, arg1) {
596
637
  const ret = new Error(getStringFromWasm0(arg0, arg1));
597
638
  return ret;
598
639
  },
@@ -618,6 +659,10 @@ function __wbg_get_imports() {
618
659
  const ret = new Object();
619
660
  return ret;
620
661
  },
662
+ __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
663
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
664
+ return ret;
665
+ },
621
666
  __wbg_new_typed_6f8b0d724fe26c07: function(arg0, arg1) {
622
667
  try {
623
668
  var state0 = {a: arg0, b: arg1};
@@ -636,14 +681,21 @@ function __wbg_get_imports() {
636
681
  state0.a = 0;
637
682
  }
638
683
  },
639
- __wbg_next_a128c458fd40a0a5: function() { return handleError(function (arg0) {
684
+ __wbg_next_30e6632b4218cb09: function(arg0) {
640
685
  const ret = arg0.next();
641
686
  return ret;
642
- }, arguments); },
643
- __wbg_parse_74b31fef7234e333: function() { return handleError(function (arg0, arg1) {
687
+ },
688
+ __wbg_parse_a1c86daae8e336bd: function() { return handleError(function (arg0, arg1) {
644
689
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
645
690
  return ret;
646
691
  }, arguments); },
692
+ __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
693
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
694
+ },
695
+ __wbg_query_259d928d723fff72: function(arg0) {
696
+ const ret = arg0.query();
697
+ return ret;
698
+ },
647
699
  __wbg_queueMicrotask_85c90f6987555d65: function(arg0) {
648
700
  const ret = arg0.queueMicrotask;
649
701
  return ret;
@@ -651,37 +703,44 @@ function __wbg_get_imports() {
651
703
  __wbg_queueMicrotask_f6a1fa10b81d1fc0: function(arg0) {
652
704
  queueMicrotask(arg0);
653
705
  },
654
- __wbg_read_259baab664b5f318: function() { return handleError(function (arg0, arg1, arg2, arg3) {
655
- const ret = arg0.read(getArrayU8FromWasm0(arg1, arg2), arg3);
706
+ __wbg_random_7bce4e9e78e2e0d0: function() {
707
+ const ret = Math.random();
656
708
  return ret;
657
- }, arguments); },
658
- __wbg_removeEntry_c72a6de718a4679d: function(arg0, arg1, arg2) {
709
+ },
710
+ __wbg_removeEntry_526b61f67204248f: function(arg0, arg1, arg2) {
659
711
  const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
660
712
  return ret;
661
713
  },
662
- __wbg_resolve_35ec7e0c6af4c82c: function(arg0) {
663
- const ret = Promise.resolve(arg0);
714
+ __wbg_removeEntry_73524952fdb64743: function(arg0, arg1, arg2, arg3) {
715
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
664
716
  return ret;
665
717
  },
666
- __wbg_setTimeout_68c2cba08a966520: function() { return handleError(function (arg0, arg1, arg2) {
667
- const ret = arg0.setTimeout(arg1, arg2);
718
+ __wbg_rendering_new: function(arg0) {
719
+ const ret = Rendering.__wrap(arg0);
668
720
  return ret;
669
- }, arguments); },
670
- __wbg_set_at_40af7269bbcce291: function(arg0, arg1) {
671
- arg0.at = arg1;
672
721
  },
673
- __wbg_set_create_389985224a53c83d: function(arg0, arg1) {
674
- arg0.create = arg1 !== 0;
722
+ __wbg_request_eda21e880c785d71: function(arg0, arg1, arg2, arg3) {
723
+ const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
724
+ return ret;
675
725
  },
676
- __wbg_set_create_8c556c6febf6436c: function(arg0, arg1) {
677
- arg0.create = arg1 !== 0;
726
+ __wbg_resolve_35ec7e0c6af4c82c: function(arg0) {
727
+ const ret = Promise.resolve(arg0);
728
+ return ret;
678
729
  },
679
- __wbg_set_name_fb6171210e935eeb: function(arg0, arg1, arg2) {
730
+ __wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
731
+ const ret = Reflect.set(arg0, arg1, arg2);
732
+ return ret;
733
+ }, arguments); },
734
+ __wbg_set_name_67f69e636c52b8b8: function(arg0, arg1, arg2) {
680
735
  arg0.name = getStringFromWasm0(arg1, arg2);
681
736
  },
682
- __wbg_set_refusal_a80f0d1c079e712a: function(arg0, arg1) {
737
+ __wbg_set_refusal_67dcb641bf92d6bd: function(arg0, arg1) {
683
738
  arg0.refusal = arg1;
684
739
  },
740
+ __wbg_size_a827722774ab6a64: function(arg0) {
741
+ const ret = arg0.size;
742
+ return ret;
743
+ },
685
744
  __wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
686
745
  const ret = typeof global === 'undefined' ? null : global;
687
746
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -706,19 +765,26 @@ function __wbg_get_imports() {
706
765
  const ret = arg0.then(arg1);
707
766
  return ret;
708
767
  },
709
- __wbg_truncate_2ed7d68b99bcc8f6: function() { return handleError(function (arg0, arg1) {
710
- arg0.truncate(arg1);
711
- }, arguments); },
712
- __wbg_write_3e78f5b3224d701e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
713
- const ret = arg0.write(getArrayU8FromWasm0(arg1, arg2), arg3);
768
+ __wbg_write_b2d191debe961263: function(arg0, arg1) {
769
+ const ret = arg0.write(arg1);
714
770
  return ret;
715
- }, arguments); },
771
+ },
716
772
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
717
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 98, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
773
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 491, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
718
774
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150);
719
775
  return ret;
720
776
  },
721
777
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
778
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 38, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
779
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385);
780
+ return ret;
781
+ },
782
+ __wbindgen_generic_0000000000000003: function(arg0) {
783
+ // Cast intrinsic for `F64 -> Externref`.
784
+ const ret = arg0;
785
+ return ret;
786
+ },
787
+ __wbindgen_generic_0000000000000004: function(arg0, arg1) {
722
788
  // Cast intrinsic for `Ref(String) -> Externref`.
723
789
  const ret = getStringFromWasm0(arg0, arg1);
724
790
  return ret;
@@ -739,6 +805,11 @@ function __wbg_get_imports() {
739
805
  };
740
806
  }
741
807
 
808
+ function wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385(arg0, arg1) {
809
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385(arg0, arg1);
810
+ return ret;
811
+ }
812
+
742
813
  function wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150(arg0, arg1, arg2) {
743
814
  const ret = wasm.wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150(arg0, arg1, arg2);
744
815
  if (ret[1]) {
@@ -750,9 +821,6 @@ function wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95(arg0, arg
750
821
  wasm.wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95(arg0, arg1, arg2, arg3);
751
822
  }
752
823
 
753
- const CheckpointFinalization = (typeof FinalizationRegistry === 'undefined')
754
- ? { register: () => {}, unregister: () => {} }
755
- : new FinalizationRegistry(ptr => wasm.__wbg_checkpoint_free(ptr, 1));
756
824
  const CompositionFinalization = (typeof FinalizationRegistry === 'undefined')
757
825
  ? { register: () => {}, unregister: () => {} }
758
826
  : new FinalizationRegistry(ptr => wasm.__wbg_composition_free(ptr, 1));
@@ -769,16 +837,75 @@ function addToExternrefTable0(obj) {
769
837
  return idx;
770
838
  }
771
839
 
772
- function _assertClass(instance, klass) {
773
- if (!(instance instanceof klass)) {
774
- throw new Error(`expected instance of ${klass.name}`);
775
- }
776
- }
777
-
778
840
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
779
841
  ? { register: () => {}, unregister: () => {} }
780
842
  : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
781
843
 
844
+ function debugString(val) {
845
+ // primitive types
846
+ const type = typeof val;
847
+ if (type == 'number' || type == 'boolean' || val == null) {
848
+ return `${val}`;
849
+ }
850
+ if (type == 'string') {
851
+ return `"${val}"`;
852
+ }
853
+ if (type == 'symbol') {
854
+ const description = val.description;
855
+ if (description == null) {
856
+ return 'Symbol';
857
+ } else {
858
+ return `Symbol(${description})`;
859
+ }
860
+ }
861
+ if (type == 'function') {
862
+ const name = val.name;
863
+ if (typeof name == 'string' && name.length > 0) {
864
+ return `Function(${name})`;
865
+ } else {
866
+ return 'Function';
867
+ }
868
+ }
869
+ // objects
870
+ if (Array.isArray(val)) {
871
+ const length = val.length;
872
+ let debug = '[';
873
+ if (length > 0) {
874
+ debug += debugString(val[0]);
875
+ }
876
+ for(let i = 1; i < length; i++) {
877
+ debug += ', ' + debugString(val[i]);
878
+ }
879
+ debug += ']';
880
+ return debug;
881
+ }
882
+ // Test for built-in
883
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
884
+ let className;
885
+ if (builtInMatches && builtInMatches.length > 1) {
886
+ className = builtInMatches[1];
887
+ } else {
888
+ // Failed to match the standard '[object ClassName]'
889
+ return toString.call(val);
890
+ }
891
+ if (className == 'Object') {
892
+ // we're a user defined class or Object
893
+ // JSON.stringify avoids problems with cycles, and is generally much
894
+ // easier than looping through ownProperties of `val`.
895
+ try {
896
+ return 'Object(' + JSON.stringify(val) + ')';
897
+ } catch (_) {
898
+ return 'Object';
899
+ }
900
+ }
901
+ // errors
902
+ if (val instanceof Error) {
903
+ return `${val.name}: ${val.message}\n${val.stack}`;
904
+ }
905
+ // TODO we could test for more things here, like `Set`s and `Map`s.
906
+ return className;
907
+ }
908
+
782
909
  function getArrayF32FromWasm0(ptr, len) {
783
910
  ptr = ptr >>> 0;
784
911
  return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
package/sva_wasm_bg.wasm CHANGED
Binary file