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