webslm 0.0.0-stage → 0.2.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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +373 -2
  3. package/dist/ai-sdk/index.d.ts +81 -0
  4. package/dist/ai-sdk/index.js +90 -0
  5. package/dist/ai-sdk/language-model.d.ts +77 -0
  6. package/dist/ai-sdk/language-model.js +422 -0
  7. package/dist/ai-sdk/loader.d.ts +54 -0
  8. package/dist/ai-sdk/loader.js +170 -0
  9. package/dist/ai-sdk/output.d.ts +43 -0
  10. package/dist/ai-sdk/output.js +152 -0
  11. package/dist/ai-sdk/prompt.d.ts +21 -0
  12. package/dist/ai-sdk/prompt.js +111 -0
  13. package/dist/async-queue.d.ts +22 -0
  14. package/dist/async-queue.js +70 -0
  15. package/dist/cache/cache-api.d.ts +29 -0
  16. package/dist/cache/cache-api.js +115 -0
  17. package/dist/cache/index.d.ts +21 -0
  18. package/dist/cache/index.js +42 -0
  19. package/dist/cache/memory.d.ts +12 -0
  20. package/dist/cache/memory.js +61 -0
  21. package/dist/cache/models.d.ts +67 -0
  22. package/dist/cache/models.js +107 -0
  23. package/dist/cache/node-fs.d.ts +21 -0
  24. package/dist/cache/node-fs.js +147 -0
  25. package/dist/cache/opfs.d.ts +69 -0
  26. package/dist/cache/opfs.js +181 -0
  27. package/dist/cache/store.d.ts +53 -0
  28. package/dist/cache/store.js +64 -0
  29. package/dist/cache-management.d.ts +23 -0
  30. package/dist/cache-management.js +58 -0
  31. package/dist/capabilities.d.ts +67 -0
  32. package/dist/capabilities.js +55 -0
  33. package/dist/client.d.ts +61 -0
  34. package/dist/client.js +256 -0
  35. package/dist/curated.d.ts +22 -0
  36. package/dist/curated.js +53 -0
  37. package/dist/download.d.ts +51 -0
  38. package/dist/download.js +289 -0
  39. package/dist/engine.d.ts +54 -0
  40. package/dist/engine.js +510 -0
  41. package/dist/errors.d.ts +81 -0
  42. package/dist/errors.js +89 -0
  43. package/dist/hub.d.ts +185 -0
  44. package/dist/hub.js +409 -0
  45. package/dist/index.d.ts +37 -0
  46. package/dist/index.js +41 -0
  47. package/dist/models.d.ts +225 -0
  48. package/dist/models.js +730 -0
  49. package/dist/node-pool-worker.d.ts +6 -0
  50. package/dist/node-pool-worker.js +32 -0
  51. package/dist/node-web-worker.d.ts +23 -0
  52. package/dist/node-web-worker.js +84 -0
  53. package/dist/node-worker.d.ts +2 -0
  54. package/dist/node-worker.js +9 -0
  55. package/dist/pool-worker.d.ts +36 -0
  56. package/dist/pool-worker.js +30 -0
  57. package/dist/pool.d.ts +17 -0
  58. package/dist/pool.js +41 -0
  59. package/dist/protocol.d.ts +246 -0
  60. package/dist/protocol.js +19 -0
  61. package/dist/runtime.d.ts +21 -0
  62. package/dist/runtime.js +53 -0
  63. package/dist/safetensors.d.ts +20 -0
  64. package/dist/safetensors.js +2 -0
  65. package/dist/simple.d.ts +310 -0
  66. package/dist/simple.js +553 -0
  67. package/dist/types.d.ts +412 -0
  68. package/dist/types.js +2 -0
  69. package/dist/wasm-flavour.d.ts +85 -0
  70. package/dist/wasm-flavour.js +169 -0
  71. package/dist/wasm.d.ts +34 -0
  72. package/dist/wasm.js +38 -0
  73. package/dist/worker.d.ts +6 -0
  74. package/dist/worker.js +11 -0
  75. package/package.json +92 -3
  76. package/wasm/relaxed/webslm_wasm.d.ts +325 -0
  77. package/wasm/relaxed/webslm_wasm.js +1899 -0
  78. package/wasm/relaxed/webslm_wasm_bg.wasm +0 -0
  79. package/wasm/relaxed/webslm_wasm_bg.wasm.d.ts +56 -0
  80. package/wasm/simd/webslm_wasm.d.ts +325 -0
  81. package/wasm/simd/webslm_wasm.js +1899 -0
  82. package/wasm/simd/webslm_wasm_bg.wasm +0 -0
  83. package/wasm/simd/webslm_wasm_bg.wasm.d.ts +56 -0
  84. package/wasm/threads/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +108 -0
  85. package/wasm/threads/webslm_wasm.d.ts +357 -0
  86. package/wasm/threads/webslm_wasm.js +2100 -0
  87. package/wasm/threads/webslm_wasm_bg.wasm +0 -0
  88. package/wasm/threads/webslm_wasm_bg.wasm.d.ts +66 -0
@@ -0,0 +1,2100 @@
1
+ /* @ts-self-types="./webslm_wasm.d.ts" */
2
+ import { startWorkers } from './snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js';
3
+
4
+
5
+ /**
6
+ * Checkpoint files served by JavaScript.
7
+ *
8
+ * `read(path, start?, end?)` returns (a promise of) a `Uint8Array` or an
9
+ * `ArrayBuffer` holding the whole file, or bytes `start..end` (end
10
+ * exclusive) when a range is given. A missing file is reported by
11
+ * resolving to `null`/`undefined` or by rejecting with an error whose
12
+ * `code` is `"NOT_FOUND"` (or whose `name` is `"NotFoundError"`, as OPFS
13
+ * throws). The optional `list()` returns the file names of the checkpoint.
14
+ */
15
+ export class JsSource {
16
+ __destroy_into_raw() {
17
+ const ptr = this.__wbg_ptr;
18
+ this.__wbg_ptr = 0;
19
+ JsSourceFinalization.unregister(this);
20
+ return ptr;
21
+ }
22
+ free() {
23
+ const ptr = this.__destroy_into_raw();
24
+ wasm.__wbg_jssource_free(ptr, 0);
25
+ }
26
+ /**
27
+ * @param {Function} read
28
+ * @param {Function | null} [list]
29
+ */
30
+ constructor(read, list) {
31
+ const ret = wasm.jssource_new(read, isLikeNone(list) ? 0 : addToExternrefTable0(list));
32
+ this.__wbg_ptr = ret;
33
+ JsSourceFinalization.register(this, this.__wbg_ptr, this);
34
+ return this;
35
+ }
36
+ }
37
+ if (Symbol.dispose) JsSource.prototype[Symbol.dispose] = JsSource.prototype.free;
38
+
39
+ /**
40
+ * Incremental SHA-256.
41
+ */
42
+ export class Sha256Hasher {
43
+ __destroy_into_raw() {
44
+ const ptr = this.__wbg_ptr;
45
+ this.__wbg_ptr = 0;
46
+ Sha256HasherFinalization.unregister(this);
47
+ return ptr;
48
+ }
49
+ free() {
50
+ const ptr = this.__destroy_into_raw();
51
+ wasm.__wbg_sha256hasher_free(ptr, 0);
52
+ }
53
+ /**
54
+ * Lowercase hex digest of everything fed so far; resets the hasher.
55
+ * @returns {string}
56
+ */
57
+ finish() {
58
+ let deferred1_0;
59
+ let deferred1_1;
60
+ try {
61
+ const ret = wasm.sha256hasher_finish(this.__wbg_ptr);
62
+ deferred1_0 = ret[0];
63
+ deferred1_1 = ret[1];
64
+ return getStringFromWasm0(ret[0], ret[1]);
65
+ } finally {
66
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
67
+ }
68
+ }
69
+ constructor() {
70
+ const ret = wasm.sha256hasher_new();
71
+ this.__wbg_ptr = ret;
72
+ Sha256HasherFinalization.register(this, this.__wbg_ptr, this);
73
+ return this;
74
+ }
75
+ /**
76
+ * Feeds bytes.
77
+ * @param {Uint8Array} bytes
78
+ */
79
+ update(bytes) {
80
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
81
+ const len0 = WASM_VECTOR_LEN;
82
+ wasm.sha256hasher_update(this.__wbg_ptr, ptr0, len0);
83
+ }
84
+ }
85
+ if (Symbol.dispose) Sha256Hasher.prototype[Symbol.dispose] = Sha256Hasher.prototype.free;
86
+
87
+ /**
88
+ * A loaded checkpoint, with a default session used by `chat` and
89
+ * `generate`.
90
+ */
91
+ export class WasmModel {
92
+ static __wrap(ptr) {
93
+ const obj = Object.create(WasmModel.prototype);
94
+ obj.__wbg_ptr = ptr;
95
+ WasmModelFinalization.register(obj, obj.__wbg_ptr, obj);
96
+ return obj;
97
+ }
98
+ __destroy_into_raw() {
99
+ const ptr = this.__wbg_ptr;
100
+ this.__wbg_ptr = 0;
101
+ WasmModelFinalization.unregister(this);
102
+ return ptr;
103
+ }
104
+ free() {
105
+ const ptr = this.__destroy_into_raw();
106
+ wasm.__wbg_wasmmodel_free(ptr, 0);
107
+ }
108
+ /**
109
+ * Merges a PEFT LoRA adapter served by `lora` into the weights,
110
+ * replacing the adapter applied before (if any). `options_json`:
111
+ * `{ scale?: number }` (default 1). Resolves to the adapter's
112
+ * description (see [`LoraInfo`]); rejects with `INVALID_ADAPTER`,
113
+ * leaving the model unchanged, when the adapter does not fit the
114
+ * model. Sessions start over at their next call.
115
+ * @param {JsSource} lora
116
+ * @param {string} options_json
117
+ * @returns {Promise<any>}
118
+ */
119
+ applyAdapter(lora, options_json) {
120
+ _assertClass(lora, JsSource);
121
+ var ptr0 = lora.__destroy_into_raw();
122
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
123
+ const len1 = WASM_VECTOR_LEN;
124
+ const ret = wasm.wasmmodel_applyAdapter(this.__wbg_ptr, ptr0, ptr1, len1);
125
+ return ret;
126
+ }
127
+ /**
128
+ * Answers a conversation in the default session; see
129
+ * [`WasmSession::chat`].
130
+ * @param {string} messages_json
131
+ * @param {string} options_json
132
+ * @param {Function} on_delta
133
+ * @param {Function | null} [on_prefill]
134
+ * @returns {Promise<any>}
135
+ */
136
+ chat(messages_json, options_json, on_delta, on_prefill) {
137
+ const ptr0 = passStringToWasm0(messages_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
+ const len0 = WASM_VECTOR_LEN;
139
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
140
+ const len1 = WASM_VECTOR_LEN;
141
+ const ret = wasm.wasmmodel_chat(this.__wbg_ptr, ptr0, len0, ptr1, len1, on_delta, isLikeNone(on_prefill) ? 0 : addToExternrefTable0(on_prefill));
142
+ return ret;
143
+ }
144
+ /**
145
+ * Starts a new, empty session over the same weights.
146
+ * @returns {WasmSession}
147
+ */
148
+ createSession() {
149
+ const ret = wasm.wasmmodel_createSession(this.__wbg_ptr);
150
+ if (ret[2]) {
151
+ throw takeFromExternrefTable0(ret[1]);
152
+ }
153
+ return WasmSession.__wrap(ret[0]);
154
+ }
155
+ /**
156
+ * Decodes token ids into text.
157
+ * @param {Uint32Array} ids
158
+ * @param {boolean} skip_special_tokens
159
+ * @returns {string}
160
+ */
161
+ detokenize(ids, skip_special_tokens) {
162
+ let deferred3_0;
163
+ let deferred3_1;
164
+ try {
165
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
166
+ const len0 = WASM_VECTOR_LEN;
167
+ const ret = wasm.wasmmodel_detokenize(this.__wbg_ptr, ptr0, len0, skip_special_tokens);
168
+ var ptr2 = ret[0];
169
+ var len2 = ret[1];
170
+ if (ret[3]) {
171
+ ptr2 = 0; len2 = 0;
172
+ throw takeFromExternrefTable0(ret[2]);
173
+ }
174
+ deferred3_0 = ptr2;
175
+ deferred3_1 = len2;
176
+ return getStringFromWasm0(ptr2, len2);
177
+ } finally {
178
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
179
+ }
180
+ }
181
+ /**
182
+ * Completes raw text in the default session; see
183
+ * [`WasmSession::generate`].
184
+ * @param {string} prompt
185
+ * @param {string} options_json
186
+ * @param {Function} on_delta
187
+ * @param {Function | null} [on_prefill]
188
+ * @returns {Promise<any>}
189
+ */
190
+ generate(prompt, options_json, on_delta, on_prefill) {
191
+ const ptr0 = passStringToWasm0(prompt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
192
+ const len0 = WASM_VECTOR_LEN;
193
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
194
+ const len1 = WASM_VECTOR_LEN;
195
+ const ret = wasm.wasmmodel_generate(this.__wbg_ptr, ptr0, len0, ptr1, len1, on_delta, isLikeNone(on_prefill) ? 0 : addToExternrefTable0(on_prefill));
196
+ return ret;
197
+ }
198
+ /**
199
+ * Describes the model; see [`ModelInfo`].
200
+ * @returns {any}
201
+ */
202
+ info() {
203
+ const ret = wasm.wasmmodel_info(this.__wbg_ptr);
204
+ if (ret[2]) {
205
+ throw takeFromExternrefTable0(ret[1]);
206
+ }
207
+ return takeFromExternrefTable0(ret[0]);
208
+ }
209
+ /**
210
+ * Loads a checkpoint from `source`. `options_json` is a JSON object:
211
+ * `{ format?: "q8" | "q4" | "q4_0" | "f32" | "f16" | "bf16",
212
+ * contextLength?: number, deterministic?: boolean,
213
+ * activations?: "quantized" | "f32", device?: "cpu" | "webgpu" | "auto" }`.
214
+ *
215
+ * `device` defaults to `"cpu"`. `"auto"` picks WebGPU when an adapter
216
+ * is available and the model has more than
217
+ * [`AUTO_GPU_MIN_PARAMETERS`] parameters. When WebGPU is wanted but
218
+ * the device cannot be created, the model loads on the CPU and
219
+ * `info().deviceNote` says why. `deterministic` runs on the CPU: GPU
220
+ * results depend on the adapter.
221
+ *
222
+ * `lora`, when given, serves a PEFT LoRA adapter (`adapter_config.json`
223
+ * and `adapter_model.safetensors`) merged into the weights as they
224
+ * load, at `adapterScale` (default 1).
225
+ * @param {JsSource} source
226
+ * @param {string} options_json
227
+ * @param {JsSource | null} [lora]
228
+ * @returns {Promise<WasmModel>}
229
+ */
230
+ static load(source, options_json, lora) {
231
+ _assertClass(source, JsSource);
232
+ var ptr0 = source.__destroy_into_raw();
233
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
234
+ const len1 = WASM_VECTOR_LEN;
235
+ let ptr2 = 0;
236
+ if (!isLikeNone(lora)) {
237
+ _assertClass(lora, JsSource);
238
+ ptr2 = lora.__destroy_into_raw();
239
+ }
240
+ const ret = wasm.wasmmodel_load(ptr0, ptr1, len1, ptr2);
241
+ return ret;
242
+ }
243
+ /**
244
+ * Removes the adapter, restoring the base weights exactly. Resolves to
245
+ * the description of the adapter removed, or `null` when there was
246
+ * none.
247
+ * @returns {Promise<any>}
248
+ */
249
+ removeAdapter() {
250
+ const ret = wasm.wasmmodel_removeAdapter(this.__wbg_ptr);
251
+ return ret;
252
+ }
253
+ /**
254
+ * Renders a conversation (JSON array of `{ role, content }`) with the
255
+ * chat template, ending with the header of a new assistant turn.
256
+ * `kwargs_json` holds extra template variables, e.g.
257
+ * `{"enable_thinking": false}`.
258
+ * @param {string} messages_json
259
+ * @param {string} kwargs_json
260
+ * @returns {string}
261
+ */
262
+ renderChat(messages_json, kwargs_json) {
263
+ let deferred4_0;
264
+ let deferred4_1;
265
+ try {
266
+ const ptr0 = passStringToWasm0(messages_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ const ptr1 = passStringToWasm0(kwargs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
269
+ const len1 = WASM_VECTOR_LEN;
270
+ const ret = wasm.wasmmodel_renderChat(this.__wbg_ptr, ptr0, len0, ptr1, len1);
271
+ var ptr3 = ret[0];
272
+ var len3 = ret[1];
273
+ if (ret[3]) {
274
+ ptr3 = 0; len3 = 0;
275
+ throw takeFromExternrefTable0(ret[2]);
276
+ }
277
+ deferred4_0 = ptr3;
278
+ deferred4_1 = len3;
279
+ return getStringFromWasm0(ptr3, len3);
280
+ } finally {
281
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
282
+ }
283
+ }
284
+ /**
285
+ * Clears the default session.
286
+ */
287
+ reset() {
288
+ const ret = wasm.wasmmodel_reset(this.__wbg_ptr);
289
+ if (ret[1]) {
290
+ throw takeFromExternrefTable0(ret[0]);
291
+ }
292
+ }
293
+ /**
294
+ * Encodes text into token ids.
295
+ * @param {string} text
296
+ * @param {boolean} add_special_tokens
297
+ * @returns {Uint32Array}
298
+ */
299
+ tokenize(text, add_special_tokens) {
300
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
301
+ const len0 = WASM_VECTOR_LEN;
302
+ const ret = wasm.wasmmodel_tokenize(this.__wbg_ptr, ptr0, len0, add_special_tokens);
303
+ if (ret[3]) {
304
+ throw takeFromExternrefTable0(ret[2]);
305
+ }
306
+ var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
307
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
308
+ return v2;
309
+ }
310
+ }
311
+ if (Symbol.dispose) WasmModel.prototype[Symbol.dispose] = WasmModel.prototype.free;
312
+
313
+ /**
314
+ * An independent conversation (KV cache) over a model.
315
+ */
316
+ export class WasmSession {
317
+ static __wrap(ptr) {
318
+ const obj = Object.create(WasmSession.prototype);
319
+ obj.__wbg_ptr = ptr;
320
+ WasmSessionFinalization.register(obj, obj.__wbg_ptr, obj);
321
+ return obj;
322
+ }
323
+ __destroy_into_raw() {
324
+ const ptr = this.__wbg_ptr;
325
+ this.__wbg_ptr = 0;
326
+ WasmSessionFinalization.unregister(this);
327
+ return ptr;
328
+ }
329
+ free() {
330
+ const ptr = this.__destroy_into_raw();
331
+ wasm.__wbg_wasmsession_free(ptr, 0);
332
+ }
333
+ /**
334
+ * Largest number of positions the cache holds.
335
+ * @returns {number}
336
+ */
337
+ get capacity() {
338
+ const ret = wasm.wasmsession_capacity(this.__wbg_ptr);
339
+ if (ret[2]) {
340
+ throw takeFromExternrefTable0(ret[1]);
341
+ }
342
+ return ret[0] >>> 0;
343
+ }
344
+ /**
345
+ * Answers a conversation: `messages_json` is a JSON array of
346
+ * `{ role, content }`, `options_json` a JSON object of generation
347
+ * options (`maxTokens`, `temperature`, `topK`, `topP`, `minP`,
348
+ * `repetitionPenalty`, `seed`, `stop`, `templateKwargs`,
349
+ * `ignoreStopTokens`). Turns already in the cache are not recomputed.
350
+ *
351
+ * Generation controls: `presencePenalty`, `frequencyPenalty`,
352
+ * `stopTokenIds`, `logprobs` (number of alternatives), `json`, `schema`,
353
+ * `thinkingBudget`, `loopDetection`, `contextShift`.
354
+ *
355
+ * `on_delta(text, tokenId, info)` runs after every token; `info` is
356
+ * `undefined` or `{ logprob, topLogprobs: [id, logprob][], forced }`.
357
+ * Returning `false` (or a promise resolving to `false`) stops the
358
+ * generation before the next token. `on_prefill(done, total)`, when
359
+ * given, runs after every piece of the prompt (128 tokens) and may stop
360
+ * it the same way. Resolves to `{ text, tokens, finishReason,
361
+ * promptTokens, reusedTokens, generatedTokens, droppedTokens, length }`;
362
+ * `finishReason` is `"stop"`, `"stop_string"`, `"length"`,
363
+ * `"context_full"`, `"loop"` or `"aborted"`.
364
+ * @param {string} messages_json
365
+ * @param {string} options_json
366
+ * @param {Function} on_delta
367
+ * @param {Function | null} [on_prefill]
368
+ * @returns {Promise<any>}
369
+ */
370
+ chat(messages_json, options_json, on_delta, on_prefill) {
371
+ const ptr0 = passStringToWasm0(messages_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
372
+ const len0 = WASM_VECTOR_LEN;
373
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
374
+ const len1 = WASM_VECTOR_LEN;
375
+ const ret = wasm.wasmsession_chat(this.__wbg_ptr, ptr0, len0, ptr1, len1, on_delta, isLikeNone(on_prefill) ? 0 : addToExternrefTable0(on_prefill));
376
+ return ret;
377
+ }
378
+ /**
379
+ * Positions run through the network since the session was created
380
+ * (what prefix reuse and forking save).
381
+ * @returns {number}
382
+ */
383
+ get computed() {
384
+ const ret = wasm.wasmsession_computed(this.__wbg_ptr);
385
+ if (ret[2]) {
386
+ throw takeFromExternrefTable0(ret[1]);
387
+ }
388
+ return ret[0] >>> 0;
389
+ }
390
+ /**
391
+ * A new session holding a copy of this one's cache, to continue it in
392
+ * several directions without recomputing it. Fails on backends that
393
+ * cannot copy caches.
394
+ * @returns {WasmSession}
395
+ */
396
+ fork() {
397
+ const ret = wasm.wasmsession_fork(this.__wbg_ptr);
398
+ if (ret[2]) {
399
+ throw takeFromExternrefTable0(ret[1]);
400
+ }
401
+ return WasmSession.__wrap(ret[0]);
402
+ }
403
+ /**
404
+ * Completes raw text, without the chat template (`addSpecialTokens`
405
+ * in the options, default `true`, adds the tokenizer's BOS). Same
406
+ * callback and result as [`WasmSession::chat`].
407
+ * @param {string} prompt
408
+ * @param {string} options_json
409
+ * @param {Function} on_delta
410
+ * @param {Function | null} [on_prefill]
411
+ * @returns {Promise<any>}
412
+ */
413
+ generate(prompt, options_json, on_delta, on_prefill) {
414
+ const ptr0 = passStringToWasm0(prompt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
415
+ const len0 = WASM_VECTOR_LEN;
416
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
417
+ const len1 = WASM_VECTOR_LEN;
418
+ const ret = wasm.wasmsession_generate(this.__wbg_ptr, ptr0, len0, ptr1, len1, on_delta, isLikeNone(on_prefill) ? 0 : addToExternrefTable0(on_prefill));
419
+ return ret;
420
+ }
421
+ /**
422
+ * Number of positions in the cache.
423
+ * @returns {number}
424
+ */
425
+ get length() {
426
+ const ret = wasm.wasmsession_length(this.__wbg_ptr);
427
+ return ret >>> 0;
428
+ }
429
+ /**
430
+ * Empties the cache.
431
+ */
432
+ reset() {
433
+ const ret = wasm.wasmsession_reset(this.__wbg_ptr);
434
+ if (ret[1]) {
435
+ throw takeFromExternrefTable0(ret[0]);
436
+ }
437
+ }
438
+ /**
439
+ * Log-probabilities of several continuations of one prefix, the prefix
440
+ * computed once. `continuations_json` is a JSON array of token-id
441
+ * arrays. Resolves to an array of `Float32Array`, one log-probability
442
+ * per continuation token; the session then holds the prefix.
443
+ * @param {Uint32Array} prefix
444
+ * @param {string} continuations_json
445
+ * @returns {Promise<any>}
446
+ */
447
+ scoreContinuations(prefix, continuations_json) {
448
+ const ptr0 = passArray32ToWasm0(prefix, wasm.__wbindgen_malloc);
449
+ const len0 = WASM_VECTOR_LEN;
450
+ const ptr1 = passStringToWasm0(continuations_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
451
+ const len1 = WASM_VECTOR_LEN;
452
+ const ret = wasm.wasmsession_scoreContinuations(this.__wbg_ptr, ptr0, len0, ptr1, len1);
453
+ return ret;
454
+ }
455
+ /**
456
+ * Teacher-forced pass: appends `ids` to the cache. `options_json`:
457
+ * `{ logits?: "all" | "last" | "none", hiddenStates?: number[] }`
458
+ * (default `"last"`). Hidden state `i` is the residual stream after
459
+ * layer `i` counted from 1, `0` the embedding output, all before the
460
+ * final norm (the `output_hidden_states` indexing of `transformers`).
461
+ *
462
+ * Resolves to `{ logits?: Float32Array, hidden: { [i]: Float32Array },
463
+ * positions, vocabSize, hiddenSize, length }`; arrays are row-major,
464
+ * one row per position.
465
+ * @param {Uint32Array} ids
466
+ * @param {string} options_json
467
+ * @returns {Promise<any>}
468
+ */
469
+ score(ids, options_json) {
470
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
471
+ const len0 = WASM_VECTOR_LEN;
472
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
473
+ const len1 = WASM_VECTOR_LEN;
474
+ const ret = wasm.wasmsession_score(this.__wbg_ptr, ptr0, len0, ptr1, len1);
475
+ return ret;
476
+ }
477
+ /**
478
+ * Context shift: drops `drop` cached positions after the first `keep`
479
+ * and recomputes the rest. Resolves to the new length.
480
+ * @param {number} keep
481
+ * @param {number} drop
482
+ * @returns {Promise<any>}
483
+ */
484
+ shiftContext(keep, drop) {
485
+ const ret = wasm.wasmsession_shiftContext(this.__wbg_ptr, keep, drop);
486
+ return ret;
487
+ }
488
+ /**
489
+ * One decode step with a token chosen by the caller. `options_json`:
490
+ * `{ logits?: boolean, hiddenStates?: number[] }` (logits by default).
491
+ * @param {number} id
492
+ * @param {string} options_json
493
+ * @returns {Promise<any>}
494
+ */
495
+ step(id, options_json) {
496
+ const ptr0 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
497
+ const len0 = WASM_VECTOR_LEN;
498
+ const ret = wasm.wasmsession_step(this.__wbg_ptr, id, ptr0, len0);
499
+ return ret;
500
+ }
501
+ /**
502
+ * The token ids in the cache.
503
+ * @returns {Uint32Array}
504
+ */
505
+ tokens() {
506
+ const ret = wasm.wasmsession_tokens(this.__wbg_ptr);
507
+ if (ret[3]) {
508
+ throw takeFromExternrefTable0(ret[2]);
509
+ }
510
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
511
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
512
+ return v1;
513
+ }
514
+ /**
515
+ * Keeps the first `len` positions. Models with recurrent layers (LFM2
516
+ * and LFM3 convolutions, Qwen3.5 Gated DeltaNet, sliding-window ring
517
+ * buffers) recompute their state for those positions (a prefill of
518
+ * `len` tokens).
519
+ * @param {number} len
520
+ */
521
+ truncate(len) {
522
+ const ret = wasm.wasmsession_truncate(this.__wbg_ptr, len);
523
+ if (ret[1]) {
524
+ throw takeFromExternrefTable0(ret[0]);
525
+ }
526
+ }
527
+ }
528
+ if (Symbol.dispose) WasmSession.prototype[Symbol.dispose] = WasmSession.prototype.free;
529
+
530
+ /**
531
+ * How this module was built: `{ flavour, kernels, threads }`. `flavour`
532
+ * is `"simd"`, `"relaxed"` (SIMD128 and relaxed SIMD) or `"threads"`
533
+ * (relaxed SIMD with atomics and a Web Worker pool); `kernels` the CPU
534
+ * kernel set; `threads` the size of the pool (1 until `startThreadPool`).
535
+ * @returns {any}
536
+ */
537
+ export function buildInfo() {
538
+ const ret = wasm.buildInfo();
539
+ if (ret[2]) {
540
+ throw takeFromExternrefTable0(ret[1]);
541
+ }
542
+ return takeFromExternrefTable0(ret[0]);
543
+ }
544
+
545
+ /**
546
+ * @param {number} num_threads
547
+ * @returns {Promise<any>}
548
+ */
549
+ export function initThreadPool(num_threads) {
550
+ const ret = wasm.initThreadPool(num_threads);
551
+ return ret;
552
+ }
553
+
554
+ /**
555
+ * Parses the header of a safetensors file.
556
+ *
557
+ * `bytes` must hold at least the 8-byte length prefix and the whole JSON
558
+ * header. Returns a plain object
559
+ * `{ headerLen, dataStart, tensors: { [name]: { name, dtype, shape, dataOffsets } } }`
560
+ * and throws an `Error` if the header is malformed.
561
+ * @param {Uint8Array} bytes
562
+ * @returns {any}
563
+ */
564
+ export function parseSafetensorsHeader(bytes) {
565
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
566
+ const len0 = WASM_VECTOR_LEN;
567
+ const ret = wasm.parseSafetensorsHeader(ptr0, len0);
568
+ if (ret[2]) {
569
+ throw takeFromExternrefTable0(ret[1]);
570
+ }
571
+ return takeFromExternrefTable0(ret[0]);
572
+ }
573
+
574
+ /**
575
+ * Starts a pool of `threads` Web Workers sharing this module's memory and
576
+ * makes the CPU kernels split their work across it (the `threads` build
577
+ * only). Must run in a worker (or Node), before any model runs.
578
+ * @param {number} threads
579
+ * @returns {Promise<void>}
580
+ */
581
+ export function startThreadPool(threads) {
582
+ const ret = wasm.startThreadPool(threads);
583
+ return ret;
584
+ }
585
+
586
+ /**
587
+ * `model_type` values (from `config.json`) of the architectures this build
588
+ * can run.
589
+ * @returns {string[]}
590
+ */
591
+ export function supportedModelTypes() {
592
+ const ret = wasm.supportedModelTypes();
593
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
594
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
595
+ return v1;
596
+ }
597
+
598
+ /**
599
+ * Version of the Rust engine, as declared in `Cargo.toml`.
600
+ * @returns {string}
601
+ */
602
+ export function version() {
603
+ let deferred1_0;
604
+ let deferred1_1;
605
+ try {
606
+ const ret = wasm.version();
607
+ deferred1_0 = ret[0];
608
+ deferred1_1 = ret[1];
609
+ return getStringFromWasm0(ret[0], ret[1]);
610
+ } finally {
611
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
612
+ }
613
+ }
614
+
615
+ export class wbg_rayon_PoolBuilder {
616
+ static __wrap(ptr) {
617
+ const obj = Object.create(wbg_rayon_PoolBuilder.prototype);
618
+ obj.__wbg_ptr = ptr;
619
+ wbg_rayon_PoolBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
620
+ return obj;
621
+ }
622
+ __destroy_into_raw() {
623
+ const ptr = this.__wbg_ptr;
624
+ this.__wbg_ptr = 0;
625
+ wbg_rayon_PoolBuilderFinalization.unregister(this);
626
+ return ptr;
627
+ }
628
+ free() {
629
+ const ptr = this.__destroy_into_raw();
630
+ wasm.__wbg_wbg_rayon_poolbuilder_free(ptr, 0);
631
+ }
632
+ build() {
633
+ wasm.wbg_rayon_poolbuilder_build(this.__wbg_ptr);
634
+ }
635
+ /**
636
+ * @returns {number}
637
+ */
638
+ numThreads() {
639
+ const ret = wasm.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr);
640
+ return ret >>> 0;
641
+ }
642
+ /**
643
+ * @returns {number}
644
+ */
645
+ receiver() {
646
+ const ret = wasm.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr);
647
+ return ret >>> 0;
648
+ }
649
+ }
650
+ if (Symbol.dispose) wbg_rayon_PoolBuilder.prototype[Symbol.dispose] = wbg_rayon_PoolBuilder.prototype.free;
651
+
652
+ /**
653
+ * @param {number} receiver
654
+ */
655
+ export function wbg_rayon_start_worker(receiver) {
656
+ wasm.wbg_rayon_start_worker(receiver);
657
+ }
658
+ function __wbg_get_imports(memory) {
659
+ const import0 = {
660
+ __proto__: null,
661
+ __wbg_Error_67e7344beaa85059: function(arg0, arg1) {
662
+ const ret = Error(getStringFromWasm0(arg0, arg1));
663
+ return ret;
664
+ },
665
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
666
+ const ret = String(arg1);
667
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
668
+ const len1 = WASM_VECTOR_LEN;
669
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
670
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
671
+ },
672
+ __wbg_Window_e6de206fcec1f90b: function(arg0) {
673
+ const ret = arg0.Window;
674
+ return ret;
675
+ },
676
+ __wbg_WorkerGlobalScope_5b1c3fa5eed8a42d: function(arg0) {
677
+ const ret = arg0.WorkerGlobalScope;
678
+ return ret;
679
+ },
680
+ __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
681
+ const ret = debugString(arg1);
682
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
683
+ const len1 = WASM_VECTOR_LEN;
684
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
685
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
686
+ },
687
+ __wbg___wbindgen_is_function_fcda5e3902d732fe: function(arg0) {
688
+ const ret = typeof(arg0) === 'function';
689
+ return ret;
690
+ },
691
+ __wbg___wbindgen_is_null_5160b3e381865372: function(arg0) {
692
+ const ret = arg0 === null;
693
+ return ret;
694
+ },
695
+ __wbg___wbindgen_is_object_edb6b15aa3afe12e: function(arg0) {
696
+ const val = arg0;
697
+ const ret = typeof(val) === 'object' && val !== null;
698
+ return ret;
699
+ },
700
+ __wbg___wbindgen_is_string_c4f7cb494a2a21f1: function(arg0) {
701
+ const ret = typeof(arg0) === 'string';
702
+ return ret;
703
+ },
704
+ __wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
705
+ const ret = arg0 === undefined;
706
+ return ret;
707
+ },
708
+ __wbg___wbindgen_jsval_eq_9fdcd3c0a860dd3b: function(arg0, arg1) {
709
+ const ret = arg0 === arg1;
710
+ return ret;
711
+ },
712
+ __wbg___wbindgen_memory_3f8442e22540244f: function() {
713
+ const ret = wasm.memory;
714
+ return ret;
715
+ },
716
+ __wbg___wbindgen_module_c2aeeb3b14bad631: function() {
717
+ const ret = wasmModule;
718
+ return ret;
719
+ },
720
+ __wbg___wbindgen_rethrow_dba7bb2caa14ba21: function(arg0) {
721
+ throw arg0;
722
+ },
723
+ __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
724
+ const obj = arg1;
725
+ const ret = typeof(obj) === 'string' ? obj : undefined;
726
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
727
+ var len1 = WASM_VECTOR_LEN;
728
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
729
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
730
+ },
731
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
732
+ throw new Error(getStringFromWasm0(arg0, arg1));
733
+ },
734
+ __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
735
+ arg0._wbg_cb_unref();
736
+ },
737
+ __wbg_async_50fcc3f740d37ed6: function(arg0) {
738
+ const ret = arg0.async;
739
+ return ret;
740
+ },
741
+ __wbg_beginComputePass_b3bb1a69e6a70bde: function(arg0, arg1) {
742
+ const ret = arg0.beginComputePass(arg1);
743
+ return ret;
744
+ },
745
+ __wbg_buffer_60eec204070b2802: function(arg0) {
746
+ const ret = arg0.buffer;
747
+ return ret;
748
+ },
749
+ __wbg_call_269c5566fbede3eb: function() { return handleError(function (arg0, arg1) {
750
+ const ret = arg0.call(arg1);
751
+ return ret;
752
+ }, arguments); },
753
+ __wbg_call_6bcf8d3e20937e46: function() { return handleError(function (arg0, arg1, arg2) {
754
+ const ret = arg0.call(arg1, arg2);
755
+ return ret;
756
+ }, arguments); },
757
+ __wbg_call_7bbd9cceba9949ad: function() { return handleError(function (arg0, arg1, arg2, arg3) {
758
+ const ret = arg0.call(arg1, arg2, arg3);
759
+ return ret;
760
+ }, arguments); },
761
+ __wbg_call_c1ad1cb1b78e8130: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
762
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
763
+ return ret;
764
+ }, arguments); },
765
+ __wbg_configure_f99faab92b5e744d: function() { return handleError(function (arg0, arg1) {
766
+ arg0.configure(arg1);
767
+ }, arguments); },
768
+ __wbg_copyBufferToBuffer_7b074d535b0f5d07: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
769
+ arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4, arg5);
770
+ }, arguments); },
771
+ __wbg_copyBufferToBuffer_e590dbbb1f6af2a1: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
772
+ arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4);
773
+ }, arguments); },
774
+ __wbg_createBindGroupLayout_45e16e6a488ebf6b: function() { return handleError(function (arg0, arg1) {
775
+ const ret = arg0.createBindGroupLayout(arg1);
776
+ return ret;
777
+ }, arguments); },
778
+ __wbg_createBindGroup_ec4dc4d9e46e1104: function(arg0, arg1) {
779
+ const ret = arg0.createBindGroup(arg1);
780
+ return ret;
781
+ },
782
+ __wbg_createBuffer_9f4e696755111e6a: function() { return handleError(function (arg0, arg1) {
783
+ const ret = arg0.createBuffer(arg1);
784
+ return ret;
785
+ }, arguments); },
786
+ __wbg_createCommandEncoder_a5136f45baaba888: function(arg0, arg1) {
787
+ const ret = arg0.createCommandEncoder(arg1);
788
+ return ret;
789
+ },
790
+ __wbg_createComputePipeline_6a05383609fddac6: function(arg0, arg1) {
791
+ const ret = arg0.createComputePipeline(arg1);
792
+ return ret;
793
+ },
794
+ __wbg_createPipelineLayout_a955ff1e35a63634: function(arg0, arg1) {
795
+ const ret = arg0.createPipelineLayout(arg1);
796
+ return ret;
797
+ },
798
+ __wbg_createShaderModule_f540847678b68e08: function(arg0, arg1) {
799
+ const ret = arg0.createShaderModule(arg1);
800
+ return ret;
801
+ },
802
+ __wbg_data_d607e3ca86acb68c: function(arg0) {
803
+ const ret = arg0.data;
804
+ return ret;
805
+ },
806
+ __wbg_description_a6d69e2e949ce306: function(arg0, arg1) {
807
+ const ret = arg1.description;
808
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
809
+ const len1 = WASM_VECTOR_LEN;
810
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
811
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
812
+ },
813
+ __wbg_dispatchWorkgroups_74a6ec8812ef9f3b: function(arg0, arg1, arg2, arg3) {
814
+ arg0.dispatchWorkgroups(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
815
+ },
816
+ __wbg_end_23ba48463344fbc0: function(arg0) {
817
+ arg0.end();
818
+ },
819
+ __wbg_error_200f31277a98b99f: function(arg0) {
820
+ const ret = arg0.error;
821
+ return ret;
822
+ },
823
+ __wbg_features_05f2c29f778eefeb: function(arg0) {
824
+ const ret = arg0.features;
825
+ return ret;
826
+ },
827
+ __wbg_finish_49529a046631ad9a: function(arg0) {
828
+ const ret = arg0.finish();
829
+ return ret;
830
+ },
831
+ __wbg_finish_678df663961386ff: function(arg0, arg1) {
832
+ const ret = arg0.finish(arg1);
833
+ return ret;
834
+ },
835
+ __wbg_getContext_5ff6bd600503b094: function() { return handleError(function (arg0, arg1, arg2) {
836
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2));
837
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
838
+ }, arguments); },
839
+ __wbg_getMappedRange_cd3dc2fcd533d3b9: function() { return handleError(function (arg0, arg1, arg2) {
840
+ const ret = arg0.getMappedRange(arg1, arg2);
841
+ return ret;
842
+ }, arguments); },
843
+ __wbg_getRandomValues_104f2a2a337e0ecc: function() { return handleError(function (arg0) {
844
+ globalThis.crypto.getRandomValues(arg0);
845
+ }, arguments); },
846
+ __wbg_getRandomValues_fceb21099645a50d: function() { return handleError(function (arg0) {
847
+ globalThis.crypto.getRandomValues(arg0);
848
+ }, arguments); },
849
+ __wbg_get_989d0a1309644f2b: function() { return handleError(function (arg0, arg1) {
850
+ const ret = Reflect.get(arg0, arg1);
851
+ return ret;
852
+ }, arguments); },
853
+ __wbg_get_unchecked_363572bdd397d473: function(arg0, arg1) {
854
+ const ret = arg0[arg1 >>> 0];
855
+ return ret;
856
+ },
857
+ __wbg_gpu_c7d57fb68edbac19: function(arg0) {
858
+ const ret = arg0.gpu;
859
+ return ret;
860
+ },
861
+ __wbg_has_47b8eb16db92789a: function(arg0, arg1, arg2) {
862
+ const ret = arg0.has(getStringFromWasm0(arg1, arg2));
863
+ return ret;
864
+ },
865
+ __wbg_info_3c45b8cfbbacab3b: function(arg0) {
866
+ const ret = arg0.info;
867
+ return ret;
868
+ },
869
+ __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae: function(arg0) {
870
+ let result;
871
+ try {
872
+ result = arg0 instanceof ArrayBuffer;
873
+ } catch (_) {
874
+ result = false;
875
+ }
876
+ const ret = result;
877
+ return ret;
878
+ },
879
+ __wbg_instanceof_GpuOutOfMemoryError_829d8185d83170f0: function(arg0) {
880
+ let result;
881
+ try {
882
+ result = arg0 instanceof GPUOutOfMemoryError;
883
+ } catch (_) {
884
+ result = false;
885
+ }
886
+ const ret = result;
887
+ return ret;
888
+ },
889
+ __wbg_instanceof_GpuValidationError_83f906582a640f23: function(arg0) {
890
+ let result;
891
+ try {
892
+ result = arg0 instanceof GPUValidationError;
893
+ } catch (_) {
894
+ result = false;
895
+ }
896
+ const ret = result;
897
+ return ret;
898
+ },
899
+ __wbg_instanceof_Promise_f6320f682f582ddf: function(arg0) {
900
+ let result;
901
+ try {
902
+ result = arg0 instanceof Promise;
903
+ } catch (_) {
904
+ result = false;
905
+ }
906
+ const ret = result;
907
+ return ret;
908
+ },
909
+ __wbg_instanceof_Uint8Array_598adc0fef426aa8: function(arg0) {
910
+ let result;
911
+ try {
912
+ result = arg0 instanceof Uint8Array;
913
+ } catch (_) {
914
+ result = false;
915
+ }
916
+ const ret = result;
917
+ return ret;
918
+ },
919
+ __wbg_instanceof_Window_a3b8566f0a9c5d1a: function(arg0) {
920
+ let result;
921
+ try {
922
+ result = arg0 instanceof Window;
923
+ } catch (_) {
924
+ result = false;
925
+ }
926
+ const ret = result;
927
+ return ret;
928
+ },
929
+ __wbg_isArray_5674713bb7b79043: function(arg0) {
930
+ const ret = Array.isArray(arg0);
931
+ return ret;
932
+ },
933
+ __wbg_isFallbackAdapter_3acf34ef5402fce5: function(arg0) {
934
+ const ret = arg0.isFallbackAdapter;
935
+ return ret;
936
+ },
937
+ __wbg_label_0752a49b0bb6f2c4: function(arg0, arg1) {
938
+ const ret = arg1.label;
939
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
940
+ const len1 = WASM_VECTOR_LEN;
941
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
942
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
943
+ },
944
+ __wbg_length_31bdaf014f5fbde2: function(arg0) {
945
+ const ret = arg0.length;
946
+ return ret;
947
+ },
948
+ __wbg_length_4e1adc0d42e23620: function(arg0) {
949
+ const ret = arg0.length;
950
+ return ret;
951
+ },
952
+ __wbg_limits_f4203404018656d1: function(arg0) {
953
+ const ret = arg0.limits;
954
+ return ret;
955
+ },
956
+ __wbg_lost_fa085c0cf1bffae4: function(arg0) {
957
+ const ret = arg0.lost;
958
+ return ret;
959
+ },
960
+ __wbg_mapAsync_84aeaa5780c9b8c7: function(arg0, arg1, arg2, arg3) {
961
+ const ret = arg0.mapAsync(arg1 >>> 0, arg2, arg3);
962
+ return ret;
963
+ },
964
+ __wbg_maxBindGroupsPlusVertexBuffers_d6dffc4ad89f024c: function(arg0) {
965
+ const ret = arg0.maxBindGroupsPlusVertexBuffers;
966
+ return ret;
967
+ },
968
+ __wbg_maxBindGroups_e8bcce17037d7413: function(arg0) {
969
+ const ret = arg0.maxBindGroups;
970
+ return ret;
971
+ },
972
+ __wbg_maxBindingsPerBindGroup_ef08905e194a1e54: function(arg0) {
973
+ const ret = arg0.maxBindingsPerBindGroup;
974
+ return ret;
975
+ },
976
+ __wbg_maxBufferSize_b1db4c8964be17cf: function(arg0) {
977
+ const ret = arg0.maxBufferSize;
978
+ return ret;
979
+ },
980
+ __wbg_maxColorAttachmentBytesPerSample_ac08ed619898c87e: function(arg0) {
981
+ const ret = arg0.maxColorAttachmentBytesPerSample;
982
+ return ret;
983
+ },
984
+ __wbg_maxColorAttachments_d1f42a41baed04ad: function(arg0) {
985
+ const ret = arg0.maxColorAttachments;
986
+ return ret;
987
+ },
988
+ __wbg_maxComputeInvocationsPerWorkgroup_2fee70c64ef20a73: function(arg0) {
989
+ const ret = arg0.maxComputeInvocationsPerWorkgroup;
990
+ return ret;
991
+ },
992
+ __wbg_maxComputeWorkgroupSizeX_2c2884390e0f2002: function(arg0) {
993
+ const ret = arg0.maxComputeWorkgroupSizeX;
994
+ return ret;
995
+ },
996
+ __wbg_maxComputeWorkgroupSizeY_a6dbdf413372949b: function(arg0) {
997
+ const ret = arg0.maxComputeWorkgroupSizeY;
998
+ return ret;
999
+ },
1000
+ __wbg_maxComputeWorkgroupSizeZ_40ec8315d6a923ec: function(arg0) {
1001
+ const ret = arg0.maxComputeWorkgroupSizeZ;
1002
+ return ret;
1003
+ },
1004
+ __wbg_maxComputeWorkgroupStorageSize_d0d1d2e746e81bcf: function(arg0) {
1005
+ const ret = arg0.maxComputeWorkgroupStorageSize;
1006
+ return ret;
1007
+ },
1008
+ __wbg_maxComputeWorkgroupsPerDimension_61b16abcf0d80b79: function(arg0) {
1009
+ const ret = arg0.maxComputeWorkgroupsPerDimension;
1010
+ return ret;
1011
+ },
1012
+ __wbg_maxDynamicStorageBuffersPerPipelineLayout_797d17e6e6944fdb: function(arg0) {
1013
+ const ret = arg0.maxDynamicStorageBuffersPerPipelineLayout;
1014
+ return ret;
1015
+ },
1016
+ __wbg_maxDynamicUniformBuffersPerPipelineLayout_edb82f86942b7949: function(arg0) {
1017
+ const ret = arg0.maxDynamicUniformBuffersPerPipelineLayout;
1018
+ return ret;
1019
+ },
1020
+ __wbg_maxInterStageShaderVariables_908ab3a923f07870: function(arg0) {
1021
+ const ret = arg0.maxInterStageShaderVariables;
1022
+ return ret;
1023
+ },
1024
+ __wbg_maxSampledTexturesPerShaderStage_191dbad7e2506090: function(arg0) {
1025
+ const ret = arg0.maxSampledTexturesPerShaderStage;
1026
+ return ret;
1027
+ },
1028
+ __wbg_maxSamplersPerShaderStage_cf1a5d29de6387c1: function(arg0) {
1029
+ const ret = arg0.maxSamplersPerShaderStage;
1030
+ return ret;
1031
+ },
1032
+ __wbg_maxStorageBufferBindingSize_6c66dbb2e10b3ebf: function(arg0) {
1033
+ const ret = arg0.maxStorageBufferBindingSize;
1034
+ return ret;
1035
+ },
1036
+ __wbg_maxStorageBuffersPerShaderStage_e9cde31564b6860e: function(arg0) {
1037
+ const ret = arg0.maxStorageBuffersPerShaderStage;
1038
+ return ret;
1039
+ },
1040
+ __wbg_maxStorageTexturesPerShaderStage_80c81f127106f576: function(arg0) {
1041
+ const ret = arg0.maxStorageTexturesPerShaderStage;
1042
+ return ret;
1043
+ },
1044
+ __wbg_maxTextureArrayLayers_2315e52a2a6ad4f6: function(arg0) {
1045
+ const ret = arg0.maxTextureArrayLayers;
1046
+ return ret;
1047
+ },
1048
+ __wbg_maxTextureDimension1D_8adabbb69e668b5d: function(arg0) {
1049
+ const ret = arg0.maxTextureDimension1D;
1050
+ return ret;
1051
+ },
1052
+ __wbg_maxTextureDimension2D_9023132dcda08d76: function(arg0) {
1053
+ const ret = arg0.maxTextureDimension2D;
1054
+ return ret;
1055
+ },
1056
+ __wbg_maxTextureDimension3D_bb2e13eec8c6a78b: function(arg0) {
1057
+ const ret = arg0.maxTextureDimension3D;
1058
+ return ret;
1059
+ },
1060
+ __wbg_maxUniformBufferBindingSize_825882c54699eb99: function(arg0) {
1061
+ const ret = arg0.maxUniformBufferBindingSize;
1062
+ return ret;
1063
+ },
1064
+ __wbg_maxUniformBuffersPerShaderStage_5b1f83edc54e5013: function(arg0) {
1065
+ const ret = arg0.maxUniformBuffersPerShaderStage;
1066
+ return ret;
1067
+ },
1068
+ __wbg_maxVertexAttributes_a026b2a337f0bdd5: function(arg0) {
1069
+ const ret = arg0.maxVertexAttributes;
1070
+ return ret;
1071
+ },
1072
+ __wbg_maxVertexBufferArrayStride_ba288c75efda40ac: function(arg0) {
1073
+ const ret = arg0.maxVertexBufferArrayStride;
1074
+ return ret;
1075
+ },
1076
+ __wbg_maxVertexBuffers_b40d07717d2856fd: function(arg0) {
1077
+ const ret = arg0.maxVertexBuffers;
1078
+ return ret;
1079
+ },
1080
+ __wbg_message_31dd74b6690b5316: function(arg0, arg1) {
1081
+ const ret = arg1.message;
1082
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1083
+ const len1 = WASM_VECTOR_LEN;
1084
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1085
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1086
+ },
1087
+ __wbg_message_6f556f23bc8a4aff: function(arg0, arg1) {
1088
+ const ret = arg1.message;
1089
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1090
+ const len1 = WASM_VECTOR_LEN;
1091
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1092
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1093
+ },
1094
+ __wbg_minStorageBufferOffsetAlignment_2c84ffed8659a936: function(arg0) {
1095
+ const ret = arg0.minStorageBufferOffsetAlignment;
1096
+ return ret;
1097
+ },
1098
+ __wbg_minUniformBufferOffsetAlignment_35a3aa8f239bba4a: function(arg0) {
1099
+ const ret = arg0.minUniformBufferOffsetAlignment;
1100
+ return ret;
1101
+ },
1102
+ __wbg_navigator_d217ca64c4bbff48: function(arg0) {
1103
+ const ret = arg0.navigator;
1104
+ return ret;
1105
+ },
1106
+ __wbg_navigator_d25c0f071226f233: function(arg0) {
1107
+ const ret = arg0.navigator;
1108
+ return ret;
1109
+ },
1110
+ __wbg_new_0700aaf827082758: function(arg0) {
1111
+ const ret = new Int32Array(arg0);
1112
+ return ret;
1113
+ },
1114
+ __wbg_new_12e5d807044fbfe3: function() { return handleError(function (arg0, arg1) {
1115
+ const ret = new OffscreenCanvas(arg0 >>> 0, arg1 >>> 0);
1116
+ return ret;
1117
+ }, arguments); },
1118
+ __wbg_new_1da3429bc3c4541c: function(arg0) {
1119
+ const ret = new Uint8Array(arg0);
1120
+ return ret;
1121
+ },
1122
+ __wbg_new_8d36e20aa758e411: function() {
1123
+ const ret = new Map();
1124
+ return ret;
1125
+ },
1126
+ __wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
1127
+ try {
1128
+ var state0 = {a: arg0, b: arg1};
1129
+ var cb0 = (arg0, arg1) => {
1130
+ const a = state0.a;
1131
+ state0.a = 0;
1132
+ try {
1133
+ return wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined_______true_(a, state0.b, arg0, arg1);
1134
+ } finally {
1135
+ state0.a = a;
1136
+ }
1137
+ };
1138
+ const ret = new Promise(cb0);
1139
+ return ret;
1140
+ } finally {
1141
+ state0.a = 0;
1142
+ }
1143
+ },
1144
+ __wbg_new_a32a1ab6c6655abe: function(arg0, arg1) {
1145
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1146
+ return ret;
1147
+ },
1148
+ __wbg_new_bebc3f4757acf305: function() {
1149
+ const ret = new Object();
1150
+ return ret;
1151
+ },
1152
+ __wbg_new_ffa92086ea89f79c: function() {
1153
+ const ret = new Array();
1154
+ return ret;
1155
+ },
1156
+ __wbg_new_from_slice_2221cabb71753908: function(arg0, arg1) {
1157
+ const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
1158
+ return ret;
1159
+ },
1160
+ __wbg_new_typed_6f8b0d724fe26c07: function(arg0, arg1) {
1161
+ try {
1162
+ var state0 = {a: arg0, b: arg1};
1163
+ var cb0 = (arg0, arg1) => {
1164
+ const a = state0.a;
1165
+ state0.a = 0;
1166
+ try {
1167
+ return wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined_______true_(a, state0.b, arg0, arg1);
1168
+ } finally {
1169
+ state0.a = a;
1170
+ }
1171
+ };
1172
+ const ret = new Promise(cb0);
1173
+ return ret;
1174
+ } finally {
1175
+ state0.a = 0;
1176
+ }
1177
+ },
1178
+ __wbg_new_typed_7d4574ab4b8446c8: function() {
1179
+ const ret = new Object();
1180
+ return ret;
1181
+ },
1182
+ __wbg_new_with_byte_offset_and_length_492c969e8b5da8a4: function(arg0, arg1, arg2) {
1183
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1184
+ return ret;
1185
+ },
1186
+ __wbg_new_with_length_5ffeddb9d9fbb96f: function(arg0) {
1187
+ const ret = new Uint8Array(arg0 >>> 0);
1188
+ return ret;
1189
+ },
1190
+ __wbg_new_worker_81c08e70aadb3771: function(arg0, arg1) {
1191
+ const ret = new Worker(getStringFromWasm0(arg0, arg1));
1192
+ return ret;
1193
+ },
1194
+ __wbg_of_d9a05aa72bb023a2: function(arg0, arg1, arg2) {
1195
+ const ret = Array.of(arg0, arg1, arg2);
1196
+ return ret;
1197
+ },
1198
+ __wbg_onSubmittedWorkDone_f62945abb48d8a84: function(arg0) {
1199
+ const ret = arg0.onSubmittedWorkDone();
1200
+ return ret;
1201
+ },
1202
+ __wbg_popErrorScope_cc6d6ccf22baf4b0: function(arg0) {
1203
+ const ret = arg0.popErrorScope();
1204
+ return ret;
1205
+ },
1206
+ __wbg_postMessage_8105a302ed002474: function() { return handleError(function (arg0, arg1) {
1207
+ arg0.postMessage(arg1);
1208
+ }, arguments); },
1209
+ __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
1210
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1211
+ },
1212
+ __wbg_pushErrorScope_efdacf97dcba3b94: function(arg0, arg1) {
1213
+ arg0.pushErrorScope(__wbindgen_enum_GpuErrorFilter[arg1]);
1214
+ },
1215
+ __wbg_push_bfdf956ba476f65b: function(arg0, arg1) {
1216
+ const ret = arg0.push(arg1);
1217
+ return ret;
1218
+ },
1219
+ __wbg_queueMicrotask_85c90f6987555d65: function(arg0) {
1220
+ const ret = arg0.queueMicrotask;
1221
+ return ret;
1222
+ },
1223
+ __wbg_queueMicrotask_f6a1fa10b81d1fc0: function(arg0) {
1224
+ queueMicrotask(arg0);
1225
+ },
1226
+ __wbg_queue_6e272de986f8f6fc: function(arg0) {
1227
+ const ret = arg0.queue;
1228
+ return ret;
1229
+ },
1230
+ __wbg_random_7bce4e9e78e2e0d0: function() {
1231
+ const ret = Math.random();
1232
+ return ret;
1233
+ },
1234
+ __wbg_reason_33b7423157d5e170: function(arg0) {
1235
+ const ret = arg0.reason;
1236
+ return (__wbindgen_enum_GpuDeviceLostReason.indexOf(ret) + 1 || 3) - 1;
1237
+ },
1238
+ __wbg_requestAdapter_2cb1006baf7abd60: function(arg0) {
1239
+ const ret = arg0.requestAdapter();
1240
+ return ret;
1241
+ },
1242
+ __wbg_requestAdapter_b725cba92e32c4ce: function(arg0, arg1) {
1243
+ const ret = arg0.requestAdapter(arg1);
1244
+ return ret;
1245
+ },
1246
+ __wbg_requestDevice_45bc1149c3b98eaf: function(arg0, arg1) {
1247
+ const ret = arg0.requestDevice(arg1);
1248
+ return ret;
1249
+ },
1250
+ __wbg_resolve_35ec7e0c6af4c82c: function(arg0) {
1251
+ const ret = Promise.resolve(arg0);
1252
+ return ret;
1253
+ },
1254
+ __wbg_setBindGroup_09aa10258bd4dc11: function(arg0, arg1, arg2) {
1255
+ arg0.setBindGroup(arg1 >>> 0, arg2);
1256
+ },
1257
+ __wbg_setBindGroup_91e8d4a44688d339: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
1258
+ arg0.setBindGroup(arg1 >>> 0, arg2, getArrayU32FromWasm0(arg3, arg4), arg5, arg6 >>> 0);
1259
+ }, arguments); },
1260
+ __wbg_setPipeline_1368374122476dc8: function(arg0, arg1) {
1261
+ arg0.setPipeline(arg1);
1262
+ },
1263
+ __wbg_set_13d25b81ab403f5e: function(arg0, arg1, arg2) {
1264
+ arg0[arg1 >>> 0] = arg2;
1265
+ },
1266
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1267
+ arg0[arg1] = arg2;
1268
+ },
1269
+ __wbg_set_9cfc0f17d60ff0af: function(arg0, arg1, arg2) {
1270
+ arg0.set(arg1, arg2 >>> 0);
1271
+ },
1272
+ __wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
1273
+ const ret = Reflect.set(arg0, arg1, arg2);
1274
+ return ret;
1275
+ }, arguments); },
1276
+ __wbg_set_access_d85c61c63a8f0054: function(arg0, arg1) {
1277
+ arg0.access = __wbindgen_enum_GpuStorageTextureAccess[arg1];
1278
+ },
1279
+ __wbg_set_beginning_of_pass_write_index_8038443ce9e1d332: function(arg0, arg1) {
1280
+ arg0.beginningOfPassWriteIndex = arg1 >>> 0;
1281
+ },
1282
+ __wbg_set_bf6dde4923b9b059: function(arg0, arg1, arg2) {
1283
+ const ret = arg0.set(arg1, arg2);
1284
+ return ret;
1285
+ },
1286
+ __wbg_set_bind_group_layouts_3586ff59b180c6f6: function(arg0, arg1, arg2) {
1287
+ arg0.bindGroupLayouts = getArrayJsValueViewFromWasm0(arg1, arg2);
1288
+ },
1289
+ __wbg_set_binding_5c2fb74e9df71acc: function(arg0, arg1) {
1290
+ arg0.binding = arg1 >>> 0;
1291
+ },
1292
+ __wbg_set_binding_dd48e769b9abd49c: function(arg0, arg1) {
1293
+ arg0.binding = arg1 >>> 0;
1294
+ },
1295
+ __wbg_set_buffer_3446218584f17583: function(arg0, arg1) {
1296
+ arg0.buffer = arg1;
1297
+ },
1298
+ __wbg_set_buffer_9924a87f5165fce6: function(arg0, arg1) {
1299
+ arg0.buffer = arg1;
1300
+ },
1301
+ __wbg_set_code_e21341a422769059: function(arg0, arg1, arg2) {
1302
+ arg0.code = getStringFromWasm0(arg1, arg2);
1303
+ },
1304
+ __wbg_set_compute_22ea0424f53da942: function(arg0, arg1) {
1305
+ arg0.compute = arg1;
1306
+ },
1307
+ __wbg_set_device_603f685db59c1649: function(arg0, arg1) {
1308
+ arg0.device = arg1;
1309
+ },
1310
+ __wbg_set_end_of_pass_write_index_88a6e72ec61673dd: function(arg0, arg1) {
1311
+ arg0.endOfPassWriteIndex = arg1 >>> 0;
1312
+ },
1313
+ __wbg_set_entries_7dfa89a00bdff489: function(arg0, arg1, arg2) {
1314
+ arg0.entries = getArrayJsValueViewFromWasm0(arg1, arg2);
1315
+ },
1316
+ __wbg_set_entries_f60b26345b2c7977: function(arg0, arg1, arg2) {
1317
+ arg0.entries = getArrayJsValueViewFromWasm0(arg1, arg2);
1318
+ },
1319
+ __wbg_set_entry_point_f385a5280d07a91f: function(arg0, arg1, arg2) {
1320
+ arg0.entryPoint = getStringFromWasm0(arg1, arg2);
1321
+ },
1322
+ __wbg_set_external_texture_bdd5ebdc331c0d06: function(arg0, arg1) {
1323
+ arg0.externalTexture = arg1;
1324
+ },
1325
+ __wbg_set_format_5444425dee1be1ea: function(arg0, arg1) {
1326
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
1327
+ },
1328
+ __wbg_set_format_617abf73e2d5bc21: function(arg0, arg1) {
1329
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
1330
+ },
1331
+ __wbg_set_has_dynamic_offset_ccafd64f17d0552b: function(arg0, arg1) {
1332
+ arg0.hasDynamicOffset = arg1 !== 0;
1333
+ },
1334
+ __wbg_set_label_1804369b72a4e735: function(arg0, arg1, arg2) {
1335
+ arg0.label = getStringFromWasm0(arg1, arg2);
1336
+ },
1337
+ __wbg_set_label_346bf11b8ec29fea: function(arg0, arg1, arg2) {
1338
+ arg0.label = getStringFromWasm0(arg1, arg2);
1339
+ },
1340
+ __wbg_set_label_3ac34d6a447c14b6: function(arg0, arg1, arg2) {
1341
+ arg0.label = getStringFromWasm0(arg1, arg2);
1342
+ },
1343
+ __wbg_set_label_48cf960febfa9f8b: function(arg0, arg1, arg2) {
1344
+ arg0.label = getStringFromWasm0(arg1, arg2);
1345
+ },
1346
+ __wbg_set_label_4ff277997e6b21ec: function(arg0, arg1, arg2) {
1347
+ arg0.label = getStringFromWasm0(arg1, arg2);
1348
+ },
1349
+ __wbg_set_label_6e7bc8922dca66f7: function(arg0, arg1, arg2) {
1350
+ arg0.label = getStringFromWasm0(arg1, arg2);
1351
+ },
1352
+ __wbg_set_label_79a74f675ac8c6f6: function(arg0, arg1, arg2) {
1353
+ arg0.label = getStringFromWasm0(arg1, arg2);
1354
+ },
1355
+ __wbg_set_label_83d1c79a73f44a36: function(arg0, arg1, arg2) {
1356
+ arg0.label = getStringFromWasm0(arg1, arg2);
1357
+ },
1358
+ __wbg_set_label_8bef035fed27f91a: function(arg0, arg1, arg2) {
1359
+ arg0.label = getStringFromWasm0(arg1, arg2);
1360
+ },
1361
+ __wbg_set_label_951186a6d8fcd032: function(arg0, arg1, arg2) {
1362
+ arg0.label = getStringFromWasm0(arg1, arg2);
1363
+ },
1364
+ __wbg_set_layout_7d84fb1f1fb10257: function(arg0, arg1) {
1365
+ arg0.layout = arg1;
1366
+ },
1367
+ __wbg_set_layout_94658faf9a0be06d: function(arg0, arg1) {
1368
+ arg0.layout = arg1;
1369
+ },
1370
+ __wbg_set_layout_gpu_auto_layout_mode_dd4e8e7a665074fb: function(arg0, arg1) {
1371
+ arg0.layout = __wbindgen_enum_GpuAutoLayoutMode[arg1];
1372
+ },
1373
+ __wbg_set_mapped_at_creation_f771fc107b1310a5: function(arg0, arg1) {
1374
+ arg0.mappedAtCreation = arg1 !== 0;
1375
+ },
1376
+ __wbg_set_min_binding_size_f64_74baaf5086ba50e2: function(arg0, arg1) {
1377
+ arg0.minBindingSize = arg1;
1378
+ },
1379
+ __wbg_set_module_b30bf16f8c1fab4a: function(arg0, arg1) {
1380
+ arg0.module = arg1;
1381
+ },
1382
+ __wbg_set_multisampled_82f133b97717fed0: function(arg0, arg1) {
1383
+ arg0.multisampled = arg1 !== 0;
1384
+ },
1385
+ __wbg_set_name_6e2a5da46a9ae1e7: function(arg0, arg1, arg2) {
1386
+ arg0.name = getStringFromWasm0(arg1, arg2);
1387
+ },
1388
+ __wbg_set_offset_f64_f6c19c7eab3139c3: function(arg0, arg1) {
1389
+ arg0.offset = arg1;
1390
+ },
1391
+ __wbg_set_onmessage_2244c2525c4e0c38: function(arg0, arg1) {
1392
+ arg0.onmessage = arg1;
1393
+ },
1394
+ __wbg_set_onuncapturederror_47c12cc2f5c09a08: function(arg0, arg1) {
1395
+ arg0.onuncapturederror = arg1;
1396
+ },
1397
+ __wbg_set_power_preference_08fe83a5eadb70d0: function(arg0, arg1) {
1398
+ arg0.powerPreference = __wbindgen_enum_GpuPowerPreference[arg1];
1399
+ },
1400
+ __wbg_set_query_set_dd5312ccb0fc400d: function(arg0, arg1) {
1401
+ arg0.querySet = arg1;
1402
+ },
1403
+ __wbg_set_required_features_a03feb65576a939d: function(arg0, arg1, arg2) {
1404
+ arg0.requiredFeatures = getArrayJsValueViewFromWasm0(arg1, arg2);
1405
+ },
1406
+ __wbg_set_required_limits_715c4f61cab45cbd: function(arg0, arg1) {
1407
+ arg0.requiredLimits = arg1;
1408
+ },
1409
+ __wbg_set_resource_8535e18d45831050: function(arg0, arg1) {
1410
+ arg0.resource = arg1;
1411
+ },
1412
+ __wbg_set_resource_gpu_buffer_binding_5450144e7744c01d: function(arg0, arg1) {
1413
+ arg0.resource = arg1;
1414
+ },
1415
+ __wbg_set_resource_gpu_texture_view_18f08044da0f00bb: function(arg0, arg1) {
1416
+ arg0.resource = arg1;
1417
+ },
1418
+ __wbg_set_sample_type_18ebe049de8b818f: function(arg0, arg1) {
1419
+ arg0.sampleType = __wbindgen_enum_GpuTextureSampleType[arg1];
1420
+ },
1421
+ __wbg_set_sampler_5d6e781457aaf9ac: function(arg0, arg1) {
1422
+ arg0.sampler = arg1;
1423
+ },
1424
+ __wbg_set_size_f64_1de16d25a7c2d7db: function(arg0, arg1) {
1425
+ arg0.size = arg1;
1426
+ },
1427
+ __wbg_set_size_f64_6db4344b19dff88b: function(arg0, arg1) {
1428
+ arg0.size = arg1;
1429
+ },
1430
+ __wbg_set_storage_texture_dccfcb6d8685a28b: function(arg0, arg1) {
1431
+ arg0.storageTexture = arg1;
1432
+ },
1433
+ __wbg_set_texture_60283d5a3509281c: function(arg0, arg1) {
1434
+ arg0.texture = arg1;
1435
+ },
1436
+ __wbg_set_timestamp_writes_e7961e2d69722523: function(arg0, arg1) {
1437
+ arg0.timestampWrites = arg1;
1438
+ },
1439
+ __wbg_set_type_87c1847bf338c3cf: function(arg0, arg1) {
1440
+ arg0.type = __wbindgen_enum_GpuBufferBindingType[arg1];
1441
+ },
1442
+ __wbg_set_type_e3051f91e1914ac5: function(arg0, arg1) {
1443
+ arg0.type = __wbindgen_enum_GpuSamplerBindingType[arg1];
1444
+ },
1445
+ __wbg_set_usage_29b8c421aa91de96: function(arg0, arg1) {
1446
+ arg0.usage = arg1 >>> 0;
1447
+ },
1448
+ __wbg_set_view_dimension_79c4ba7d05ee0f18: function(arg0, arg1) {
1449
+ arg0.viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
1450
+ },
1451
+ __wbg_set_view_dimension_c8a3183d873d8457: function(arg0, arg1) {
1452
+ arg0.viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
1453
+ },
1454
+ __wbg_set_visibility_13119ae63ddb4d54: function(arg0, arg1) {
1455
+ arg0.visibility = arg1 >>> 0;
1456
+ },
1457
+ __wbg_startWorkers_8b582d57e92bd2d4: function(arg0, arg1, arg2) {
1458
+ const ret = startWorkers(arg0, arg1, wbg_rayon_PoolBuilder.__wrap(arg2));
1459
+ return ret;
1460
+ },
1461
+ __wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
1462
+ const ret = typeof global === 'undefined' ? null : global;
1463
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1464
+ },
1465
+ __wbg_static_accessor_GLOBAL_THIS_1e7044f654e934db: function() {
1466
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1467
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1468
+ },
1469
+ __wbg_static_accessor_SELF_d8b50611246a6d92: function() {
1470
+ const ret = typeof self === 'undefined' ? null : self;
1471
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1472
+ },
1473
+ __wbg_static_accessor_WINDOW_fd0bc376bf0f8b42: function() {
1474
+ const ret = typeof window === 'undefined' ? null : window;
1475
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1476
+ },
1477
+ __wbg_subarray_1daff70dde20c145: function(arg0, arg1, arg2) {
1478
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1479
+ return ret;
1480
+ },
1481
+ __wbg_subgroupMaxSize_1317a597b4caba08: function(arg0) {
1482
+ const ret = arg0.subgroupMaxSize;
1483
+ return ret;
1484
+ },
1485
+ __wbg_subgroupMinSize_ba60776f25dadbfa: function(arg0) {
1486
+ const ret = arg0.subgroupMinSize;
1487
+ return ret;
1488
+ },
1489
+ __wbg_submit_c4379e221512d3fa: function(arg0, arg1, arg2) {
1490
+ arg0.submit(getArrayJsValueViewFromWasm0(arg1, arg2));
1491
+ },
1492
+ __wbg_then_7a850dae4493f353: function(arg0, arg1, arg2) {
1493
+ const ret = arg0.then(arg1, arg2);
1494
+ return ret;
1495
+ },
1496
+ __wbg_then_8ebf7f4d2b402f98: function(arg0, arg1) {
1497
+ const ret = arg0.then(arg1);
1498
+ return ret;
1499
+ },
1500
+ __wbg_then_b830475380919203: function(arg0, arg1) {
1501
+ const ret = arg0.then(arg1);
1502
+ return ret;
1503
+ },
1504
+ __wbg_unconfigure_7ca436ff70c0bcc3: function(arg0) {
1505
+ arg0.unconfigure();
1506
+ },
1507
+ __wbg_unmap_073211b910c6a369: function(arg0) {
1508
+ arg0.unmap();
1509
+ },
1510
+ __wbg_valueOf_24fc886d85bf55b5: function(arg0) {
1511
+ const ret = arg0.valueOf();
1512
+ return ret;
1513
+ },
1514
+ __wbg_value_a06131499b246ab0: function(arg0) {
1515
+ const ret = arg0.value;
1516
+ return ret;
1517
+ },
1518
+ __wbg_waitAsync_80b2e954334c3fdf: function(arg0, arg1, arg2) {
1519
+ const ret = Atomics.waitAsync(arg0, arg1 >>> 0, arg2);
1520
+ return ret;
1521
+ },
1522
+ __wbg_waitAsync_ac27a6bec1171c41: function() {
1523
+ const ret = Atomics.waitAsync;
1524
+ return ret;
1525
+ },
1526
+ __wbg_wasmmodel_new: function(arg0) {
1527
+ const ret = WasmModel.__wrap(arg0);
1528
+ return ret;
1529
+ },
1530
+ __wbg_writeBuffer_badef58fae6c9543: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
1531
+ arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
1532
+ }, arguments); },
1533
+ __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1534
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 270, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1535
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_);
1536
+ return ret;
1537
+ },
1538
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1539
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 789, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1540
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
1541
+ return ret;
1542
+ },
1543
+ __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1544
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 791, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1545
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_);
1546
+ return ret;
1547
+ },
1548
+ __wbindgen_generic_0000000000000004: function(arg0, arg1) {
1549
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 268, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1550
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
1551
+ return ret;
1552
+ },
1553
+ __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1554
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 270, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1555
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__43);
1556
+ return ret;
1557
+ },
1558
+ __wbindgen_generic_0000000000000006: function(arg0, arg1) {
1559
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 270, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1560
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__44);
1561
+ return ret;
1562
+ },
1563
+ __wbindgen_generic_0000000000000007: function(arg0, arg1) {
1564
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 268, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1565
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__45);
1566
+ return ret;
1567
+ },
1568
+ __wbindgen_generic_0000000000000008: function(arg0, arg1) {
1569
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 268, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1570
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__46);
1571
+ return ret;
1572
+ },
1573
+ __wbindgen_generic_0000000000000009: function(arg0) {
1574
+ // Cast intrinsic for `F64 -> Externref`.
1575
+ const ret = arg0;
1576
+ return ret;
1577
+ },
1578
+ __wbindgen_generic_000000000000000a: function(arg0, arg1) {
1579
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1580
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1581
+ return ret;
1582
+ },
1583
+ __wbindgen_generic_000000000000000b: function(arg0, arg1) {
1584
+ // Cast intrinsic for `Ref(String) -> Externref`.
1585
+ const ret = getStringFromWasm0(arg0, arg1);
1586
+ return ret;
1587
+ },
1588
+ __wbindgen_generic_000000000000000c: function(arg0) {
1589
+ // Cast intrinsic for `U64 -> Externref`.
1590
+ const ret = BigInt.asUintN(64, arg0);
1591
+ return ret;
1592
+ },
1593
+ __wbindgen_init_externref_table: function() {
1594
+ const table = wasm.__wbindgen_externrefs;
1595
+ const offset = table.grow(4);
1596
+ table.set(0, undefined);
1597
+ table.set(offset + 0, undefined);
1598
+ table.set(offset + 1, null);
1599
+ table.set(offset + 2, true);
1600
+ table.set(offset + 3, false);
1601
+ },
1602
+ __wbindgen_link_e7dbf70342428633: function(arg0) {
1603
+ const val = `onmessage = function (ev) {
1604
+ let [ia, index, value] = ev.data;
1605
+ ia = new Int32Array(ia.buffer);
1606
+ let result = Atomics.wait(ia, index, value);
1607
+ postMessage(result);
1608
+ };
1609
+ `;
1610
+ const ret = typeof URL.createObjectURL === 'undefined' ? "data:application/javascript," + encodeURIComponent(val) : URL.createObjectURL(new Blob([val], { type: "text/javascript" }));
1611
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1612
+ const len1 = WASM_VECTOR_LEN;
1613
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1614
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1615
+ },
1616
+ memory: memory || new WebAssembly.Memory({initial:29,maximum:65536,shared:true}),
1617
+ };
1618
+ return {
1619
+ __proto__: null,
1620
+ "./webslm_wasm_bg.js": import0,
1621
+ };
1622
+ }
1623
+
1624
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_(arg0, arg1, arg2) {
1625
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_(arg0, arg1, arg2);
1626
+ }
1627
+
1628
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_(arg0, arg1, arg2) {
1629
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_(arg0, arg1, arg2);
1630
+ }
1631
+
1632
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__43(arg0, arg1, arg2) {
1633
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__43(arg0, arg1, arg2);
1634
+ }
1635
+
1636
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__44(arg0, arg1, arg2) {
1637
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__44(arg0, arg1, arg2);
1638
+ }
1639
+
1640
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_(arg0, arg1, arg2) {
1641
+ const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_(arg0, arg1, arg2);
1642
+ if (ret[1]) {
1643
+ throw takeFromExternrefTable0(ret[0]);
1644
+ }
1645
+ }
1646
+
1647
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_(arg0, arg1, arg2) {
1648
+ const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_(arg0, arg1, arg2);
1649
+ if (ret[1]) {
1650
+ throw takeFromExternrefTable0(ret[0]);
1651
+ }
1652
+ }
1653
+
1654
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__45(arg0, arg1, arg2) {
1655
+ const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__45(arg0, arg1, arg2);
1656
+ if (ret[1]) {
1657
+ throw takeFromExternrefTable0(ret[0]);
1658
+ }
1659
+ }
1660
+
1661
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__46(arg0, arg1, arg2) {
1662
+ const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__46(arg0, arg1, arg2);
1663
+ if (ret[1]) {
1664
+ throw takeFromExternrefTable0(ret[0]);
1665
+ }
1666
+ }
1667
+
1668
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
1669
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
1670
+ }
1671
+
1672
+
1673
+ const __wbindgen_enum_GpuAutoLayoutMode = ["auto"];
1674
+
1675
+
1676
+ const __wbindgen_enum_GpuBufferBindingType = ["uniform", "storage", "read-only-storage"];
1677
+
1678
+
1679
+ const __wbindgen_enum_GpuDeviceLostReason = ["unknown", "destroyed"];
1680
+
1681
+
1682
+ const __wbindgen_enum_GpuErrorFilter = ["validation", "out-of-memory", "internal"];
1683
+
1684
+
1685
+ const __wbindgen_enum_GpuPowerPreference = ["low-power", "high-performance"];
1686
+
1687
+
1688
+ const __wbindgen_enum_GpuSamplerBindingType = ["filtering", "non-filtering", "comparison"];
1689
+
1690
+
1691
+ const __wbindgen_enum_GpuStorageTextureAccess = ["write-only", "read-only", "read-write"];
1692
+
1693
+
1694
+ const __wbindgen_enum_GpuTextureFormat = ["r8unorm", "r8snorm", "r8uint", "r8sint", "r16unorm", "r16snorm", "r16uint", "r16sint", "r16float", "rg8unorm", "rg8snorm", "rg8uint", "rg8sint", "r32uint", "r32sint", "r32float", "rg16unorm", "rg16snorm", "rg16uint", "rg16sint", "rg16float", "rgba8unorm", "rgba8unorm-srgb", "rgba8snorm", "rgba8uint", "rgba8sint", "bgra8unorm", "bgra8unorm-srgb", "rgb9e5ufloat", "rgb10a2uint", "rgb10a2unorm", "rg11b10ufloat", "rg32uint", "rg32sint", "rg32float", "rgba16unorm", "rgba16snorm", "rgba16uint", "rgba16sint", "rgba16float", "rgba32uint", "rgba32sint", "rgba32float", "stencil8", "depth16unorm", "depth24plus", "depth24plus-stencil8", "depth32float", "depth32float-stencil8", "bc1-rgba-unorm", "bc1-rgba-unorm-srgb", "bc2-rgba-unorm", "bc2-rgba-unorm-srgb", "bc3-rgba-unorm", "bc3-rgba-unorm-srgb", "bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm", "bc6h-rgb-ufloat", "bc6h-rgb-float", "bc7-rgba-unorm", "bc7-rgba-unorm-srgb", "etc2-rgb8unorm", "etc2-rgb8unorm-srgb", "etc2-rgb8a1unorm", "etc2-rgb8a1unorm-srgb", "etc2-rgba8unorm", "etc2-rgba8unorm-srgb", "eac-r11unorm", "eac-r11snorm", "eac-rg11unorm", "eac-rg11snorm", "astc-4x4-unorm", "astc-4x4-unorm-srgb", "astc-5x4-unorm", "astc-5x4-unorm-srgb", "astc-5x5-unorm", "astc-5x5-unorm-srgb", "astc-6x5-unorm", "astc-6x5-unorm-srgb", "astc-6x6-unorm", "astc-6x6-unorm-srgb", "astc-8x5-unorm", "astc-8x5-unorm-srgb", "astc-8x6-unorm", "astc-8x6-unorm-srgb", "astc-8x8-unorm", "astc-8x8-unorm-srgb", "astc-10x5-unorm", "astc-10x5-unorm-srgb", "astc-10x6-unorm", "astc-10x6-unorm-srgb", "astc-10x8-unorm", "astc-10x8-unorm-srgb", "astc-10x10-unorm", "astc-10x10-unorm-srgb", "astc-12x10-unorm", "astc-12x10-unorm-srgb", "astc-12x12-unorm", "astc-12x12-unorm-srgb"];
1695
+
1696
+
1697
+ const __wbindgen_enum_GpuTextureSampleType = ["float", "unfilterable-float", "depth", "sint", "uint"];
1698
+
1699
+
1700
+ const __wbindgen_enum_GpuTextureViewDimension = ["1d", "2d", "2d-array", "cube", "cube-array", "3d"];
1701
+ const JsSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1702
+ ? { register: () => {}, unregister: () => {} }
1703
+ : new FinalizationRegistry(ptr => wasm.__wbg_jssource_free(ptr, 1));
1704
+ const Sha256HasherFinalization = (typeof FinalizationRegistry === 'undefined')
1705
+ ? { register: () => {}, unregister: () => {} }
1706
+ : new FinalizationRegistry(ptr => wasm.__wbg_sha256hasher_free(ptr, 1));
1707
+ const WasmModelFinalization = (typeof FinalizationRegistry === 'undefined')
1708
+ ? { register: () => {}, unregister: () => {} }
1709
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmodel_free(ptr, 1));
1710
+ const WasmSessionFinalization = (typeof FinalizationRegistry === 'undefined')
1711
+ ? { register: () => {}, unregister: () => {} }
1712
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsession_free(ptr, 1));
1713
+ const wbg_rayon_PoolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
1714
+ ? { register: () => {}, unregister: () => {} }
1715
+ : new FinalizationRegistry(ptr => wasm.__wbg_wbg_rayon_poolbuilder_free(ptr, 1));
1716
+
1717
+ function addToExternrefTable0(obj) {
1718
+ const idx = wasm.__externref_table_alloc();
1719
+ wasm.__wbindgen_externrefs.set(idx, obj);
1720
+ return idx;
1721
+ }
1722
+
1723
+ function _assertClass(instance, klass) {
1724
+ if (!(instance instanceof klass)) {
1725
+ throw new Error(`expected instance of ${klass.name}`);
1726
+ }
1727
+ }
1728
+
1729
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1730
+ ? { register: () => {}, unregister: () => {} }
1731
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
1732
+
1733
+ function debugString(val) {
1734
+ // primitive types
1735
+ const type = typeof val;
1736
+ if (type == 'number' || type == 'boolean' || val == null) {
1737
+ return `${val}`;
1738
+ }
1739
+ if (type == 'string') {
1740
+ return `"${val}"`;
1741
+ }
1742
+ if (type == 'symbol') {
1743
+ const description = val.description;
1744
+ if (description == null) {
1745
+ return 'Symbol';
1746
+ } else {
1747
+ return `Symbol(${description})`;
1748
+ }
1749
+ }
1750
+ if (type == 'function') {
1751
+ const name = val.name;
1752
+ if (typeof name == 'string' && name.length > 0) {
1753
+ return `Function(${name})`;
1754
+ } else {
1755
+ return 'Function';
1756
+ }
1757
+ }
1758
+ // objects
1759
+ if (Array.isArray(val)) {
1760
+ const length = val.length;
1761
+ let debug = '[';
1762
+ if (length > 0) {
1763
+ debug += debugString(val[0]);
1764
+ }
1765
+ for(let i = 1; i < length; i++) {
1766
+ debug += ', ' + debugString(val[i]);
1767
+ }
1768
+ debug += ']';
1769
+ return debug;
1770
+ }
1771
+ // Test for built-in
1772
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1773
+ let className;
1774
+ if (builtInMatches && builtInMatches.length > 1) {
1775
+ className = builtInMatches[1];
1776
+ } else {
1777
+ // Failed to match the standard '[object ClassName]'
1778
+ return toString.call(val);
1779
+ }
1780
+ if (className == 'Object') {
1781
+ // we're a user defined class or Object
1782
+ // JSON.stringify avoids problems with cycles, and is generally much
1783
+ // easier than looping through ownProperties of `val`.
1784
+ try {
1785
+ return 'Object(' + JSON.stringify(val) + ')';
1786
+ } catch (_) {
1787
+ return 'Object';
1788
+ }
1789
+ }
1790
+ // errors
1791
+ if (val instanceof Error) {
1792
+ return `${val.name}: ${val.message}\n${val.stack}`;
1793
+ }
1794
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1795
+ return className;
1796
+ }
1797
+
1798
+ function getArrayF32FromWasm0(ptr, len) {
1799
+ ptr = ptr >>> 0;
1800
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1801
+ }
1802
+
1803
+ function getArrayJsValueFromWasm0(ptr, len) {
1804
+ ptr = ptr >>> 0;
1805
+ const mem = getDataViewMemory0();
1806
+ const result = [];
1807
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1808
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1809
+ }
1810
+ wasm.__externref_drop_slice(ptr, len);
1811
+ return result;
1812
+ }
1813
+
1814
+ function getArrayJsValueViewFromWasm0(ptr, len) {
1815
+ ptr = ptr >>> 0;
1816
+ const mem = getDataViewMemory0();
1817
+ const result = [];
1818
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1819
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1820
+ }
1821
+ return result;
1822
+ }
1823
+
1824
+ function getArrayU32FromWasm0(ptr, len) {
1825
+ ptr = ptr >>> 0;
1826
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1827
+ }
1828
+
1829
+ function getArrayU8FromWasm0(ptr, len) {
1830
+ ptr = ptr >>> 0;
1831
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1832
+ }
1833
+
1834
+ let cachedDataViewMemory0 = null;
1835
+ function getDataViewMemory0() {
1836
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
1837
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1838
+ }
1839
+ return cachedDataViewMemory0;
1840
+ }
1841
+
1842
+ let cachedFloat32ArrayMemory0 = null;
1843
+ function getFloat32ArrayMemory0() {
1844
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.buffer !== wasm.memory.buffer) {
1845
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
1846
+ }
1847
+ return cachedFloat32ArrayMemory0;
1848
+ }
1849
+
1850
+ function getStringFromWasm0(ptr, len) {
1851
+ return decodeText(ptr >>> 0, len);
1852
+ }
1853
+
1854
+ let cachedUint32ArrayMemory0 = null;
1855
+ function getUint32ArrayMemory0() {
1856
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.buffer !== wasm.memory.buffer) {
1857
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1858
+ }
1859
+ return cachedUint32ArrayMemory0;
1860
+ }
1861
+
1862
+ let cachedUint8ArrayMemory0 = null;
1863
+ function getUint8ArrayMemory0() {
1864
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.buffer !== wasm.memory.buffer) {
1865
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1866
+ }
1867
+ return cachedUint8ArrayMemory0;
1868
+ }
1869
+
1870
+ function handleError(f, args) {
1871
+ try {
1872
+ return f.apply(this, args);
1873
+ } catch (e) {
1874
+ const idx = addToExternrefTable0(e);
1875
+ wasm.__wbindgen_exn_store(idx);
1876
+ }
1877
+ }
1878
+
1879
+ function isLikeNone(x) {
1880
+ return x === undefined || x === null;
1881
+ }
1882
+
1883
+ function makeMutClosure(arg0, arg1, f) {
1884
+ const state = { a: arg0, b: arg1, cnt: 1 };
1885
+ const real = (...args) => {
1886
+
1887
+ // First up with a closure we increment the internal reference
1888
+ // count. This ensures that the Rust closure environment won't
1889
+ // be deallocated while we're invoking it.
1890
+ state.cnt++;
1891
+ const a = state.a;
1892
+ state.a = 0;
1893
+ try {
1894
+ return f(a, state.b, ...args);
1895
+ } finally {
1896
+ state.a = a;
1897
+ real._wbg_cb_unref();
1898
+ }
1899
+ };
1900
+ real._wbg_cb_unref = () => {
1901
+ if (--state.cnt === 0) {
1902
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
1903
+ state.a = 0;
1904
+ CLOSURE_DTORS.unregister(state);
1905
+ }
1906
+ };
1907
+ CLOSURE_DTORS.register(real, state, state);
1908
+ return real;
1909
+ }
1910
+
1911
+ function passArray32ToWasm0(arg, malloc) {
1912
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1913
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1914
+ WASM_VECTOR_LEN = arg.length;
1915
+ return ptr;
1916
+ }
1917
+
1918
+ function passArray8ToWasm0(arg, malloc) {
1919
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1920
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1921
+ WASM_VECTOR_LEN = arg.length;
1922
+ return ptr;
1923
+ }
1924
+
1925
+ function passStringToWasm0(arg, malloc, realloc) {
1926
+ if (realloc === undefined) {
1927
+ const buf = cachedTextEncoder.encode(arg);
1928
+ const ptr = malloc(buf.length, 1) >>> 0;
1929
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1930
+ WASM_VECTOR_LEN = buf.length;
1931
+ return ptr;
1932
+ }
1933
+
1934
+ let len = arg.length;
1935
+ let ptr = malloc(len, 1) >>> 0;
1936
+
1937
+ const mem = getUint8ArrayMemory0();
1938
+
1939
+ let offset = 0;
1940
+
1941
+ for (; offset < len; offset++) {
1942
+ const code = arg.charCodeAt(offset);
1943
+ if (code > 0x7F) break;
1944
+ mem[ptr + offset] = code;
1945
+ }
1946
+ if (offset !== len) {
1947
+ if (offset !== 0) {
1948
+ arg = arg.slice(offset);
1949
+ }
1950
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1951
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1952
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1953
+
1954
+ offset += ret.written;
1955
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1956
+ }
1957
+
1958
+ WASM_VECTOR_LEN = offset;
1959
+ return ptr;
1960
+ }
1961
+
1962
+ function takeFromExternrefTable0(idx) {
1963
+ const value = wasm.__wbindgen_externrefs.get(idx);
1964
+ wasm.__externref_table_dealloc(idx);
1965
+ return value;
1966
+ }
1967
+
1968
+ let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : undefined);
1969
+ if (cachedTextDecoder) cachedTextDecoder.decode();
1970
+
1971
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1972
+ let numBytesDecoded = 0;
1973
+ function decodeText(ptr, len) {
1974
+ numBytesDecoded += len;
1975
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1976
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1977
+ cachedTextDecoder.decode();
1978
+ numBytesDecoded = len;
1979
+ }
1980
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().slice(ptr, ptr + len));
1981
+ }
1982
+
1983
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined);
1984
+
1985
+ if (cachedTextEncoder) {
1986
+ cachedTextEncoder.encodeInto = function (arg, view) {
1987
+ const buf = cachedTextEncoder.encode(arg);
1988
+ view.set(buf);
1989
+ return {
1990
+ read: arg.length,
1991
+ written: buf.length
1992
+ };
1993
+ };
1994
+ }
1995
+
1996
+ let WASM_VECTOR_LEN = 0;
1997
+
1998
+ let wasmModule, wasmInstance, wasm;
1999
+ function __wbg_finalize_init(instance, module, thread_stack_size) {
2000
+ wasmInstance = instance;
2001
+ wasm = instance.exports;
2002
+ wasmModule = module;
2003
+ cachedDataViewMemory0 = null;
2004
+ cachedFloat32ArrayMemory0 = null;
2005
+ cachedUint32ArrayMemory0 = null;
2006
+ cachedUint8ArrayMemory0 = null;
2007
+ if (typeof thread_stack_size !== 'undefined' && (typeof thread_stack_size !== 'number' || thread_stack_size === 0 || thread_stack_size % 65536 !== 0)) {
2008
+ throw new Error('invalid stack size');
2009
+ }
2010
+
2011
+ wasm.__wbindgen_start(thread_stack_size);
2012
+ return wasm;
2013
+ }
2014
+
2015
+ async function __wbg_load(module, imports) {
2016
+ if (typeof Response === 'function' && module instanceof Response) {
2017
+ if (!module.ok) {
2018
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
2019
+ }
2020
+
2021
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2022
+ try {
2023
+ return await WebAssembly.instantiateStreaming(module, imports);
2024
+ } catch (e) {
2025
+ const validResponse = expectedResponseType(module.type);
2026
+
2027
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2028
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
2029
+
2030
+ } else { throw e; }
2031
+ }
2032
+ }
2033
+
2034
+ const bytes = await module.arrayBuffer();
2035
+ return await WebAssembly.instantiate(bytes, imports);
2036
+ } else {
2037
+ const instance = await WebAssembly.instantiate(module, imports);
2038
+
2039
+ if (instance instanceof WebAssembly.Instance) {
2040
+ return { instance, module };
2041
+ } else {
2042
+ return instance;
2043
+ }
2044
+ }
2045
+
2046
+ function expectedResponseType(type) {
2047
+ switch (type) {
2048
+ case 'basic': case 'cors': case 'default': return true;
2049
+ }
2050
+ return false;
2051
+ }
2052
+ }
2053
+
2054
+ function initSync(module, memory) {
2055
+ if (wasm !== undefined) return wasm;
2056
+
2057
+ let thread_stack_size
2058
+ if (module !== undefined) {
2059
+ if (Object.getPrototypeOf(module) === Object.prototype) {
2060
+ ({module, memory, thread_stack_size} = module)
2061
+ } else {
2062
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2063
+ }
2064
+ }
2065
+
2066
+ const imports = __wbg_get_imports(memory);
2067
+ if (!(module instanceof WebAssembly.Module)) {
2068
+ module = new WebAssembly.Module(module);
2069
+ }
2070
+ const instance = new WebAssembly.Instance(module, imports);
2071
+ return __wbg_finalize_init(instance, module, thread_stack_size);
2072
+ }
2073
+
2074
+ async function __wbg_init(module_or_path, memory) {
2075
+ if (wasm !== undefined) return wasm;
2076
+
2077
+ let thread_stack_size
2078
+ if (module_or_path !== undefined) {
2079
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2080
+ ({module_or_path, memory, thread_stack_size} = module_or_path)
2081
+ } else {
2082
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2083
+ }
2084
+ }
2085
+
2086
+ if (module_or_path === undefined) {
2087
+ module_or_path = new URL('webslm_wasm_bg.wasm', import.meta.url);
2088
+ }
2089
+ const imports = __wbg_get_imports(memory);
2090
+
2091
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2092
+ module_or_path = fetch(module_or_path);
2093
+ }
2094
+
2095
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2096
+
2097
+ return __wbg_finalize_init(instance, module, thread_stack_size);
2098
+ }
2099
+
2100
+ export { initSync, __wbg_init as default };