lucivy-wasm 3.0.7 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -4
- package/js/lucivy-worker.js +71 -0
- package/js/lucivy.d.ts +62 -0
- package/js/lucivy.js +58 -1
- package/package.json +1 -1
- package/pkg/lucivy.js +1 -1
- package/pkg/lucivy.wasm +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
# lucivy-wasm
|
|
1
|
+
# lucivy-wasm 4.0.0
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Full-text search for code and technical text, in the browser. Substrings, fuzzy and regex **across token boundaries**, BM25, exact byte spans, every answer checked against the files — the same engine as the native bindings, built with emscripten: **threads** (pthreads over SharedArrayBuffer), OPFS persistence, snapshot import. Runs in a Web Worker. MIT.
|
|
4
4
|
|
|
5
5
|
[**Try the live playground**](https://l-defraiteur.github.io/lucivy/) — it clones lucivy's own source from GitHub and indexes it in your browser.
|
|
6
6
|
|
|
7
|
-
### What's new in
|
|
7
|
+
### What's new in 4.0.0
|
|
8
|
+
|
|
9
|
+
- **The index is 3.7× smaller**, and a tab holds a whole repository: the playground's prompt indexes MDN Web Docs (14 611 pages, 14 s), the **entire Linux 2.6.0 kernel** (14 032 files, 28 s, 1.1 GB held in memory), Go, Godot, **TypeScript (39 044 files, 33 s)**, PostgreSQL, CPython, Redis, Git, curl, SQLite, nginx — `index <name>`, kept in OPFS, reopened in seconds. The ceiling of a tab is about 200 MB of text. Browser against native on the 2.6.0 kernel: same counts and spans, 41 s to index against 23, substrings 10-18 ms against 2 ([README](../../README.md#browser-against-native)).
|
|
10
|
+
- **`shared_dictionary` and `derived_in_ram` in `IndexConfig`** (typed in `lucivy.d.ts`): the shard dictionary is the playground's default for big corpora (23-25 % smaller); `derived_in_ram` stays an option here — it saves a quarter of OPFS but raises the tab's memory peak.
|
|
11
|
+
- **`dictionary_wait` in `IndexConfig`** (typed): shared dictionary only — natively a commit returns before the shard's new texts are merged and a search waits for that merge by default; in the browser the merge stays inside the commit (few threads, and building the segments' dictionary pieces in parallel raised the memory high-water mark for no time gained), so the option changes nothing there yet
|
|
12
|
+
- **`Lucivy.dropIndex(path)`** — delete an index directory through the worker: WASMFS caches what it mounted, so a directory removed from the main thread still exists for it and the next `create` at that path fails.
|
|
13
|
+
- **A commit every 8 MB of text** in the playground's indexing loop (`?commitmb=M`), not only every 2 000 files: a segment's size, not its document count, sets the memory peak (Godot: 3.3 GB → 1.8 GB).
|
|
14
|
+
- **Compatibility contract** — 4.0 opens a 3.0.x index and returns what 3.0.x returned; 3.0.x does not open a 4.0 index; the first commit converts for good.
|
|
15
|
+
|
|
16
|
+
### What 3.0.0 brought
|
|
8
17
|
|
|
9
18
|
Measured on 10 000 Linux kernel files, in the browser, 8 threads:
|
|
10
19
|
|
|
@@ -24,7 +33,7 @@ Measured on 10 000 Linux kernel files, in the browser, 8 threads:
|
|
|
24
33
|
merges capped at 800 documents (48 small segments fill eight threads where
|
|
25
34
|
19 large ones fed one), at most 512 documents queued.
|
|
26
35
|
|
|
27
|
-
###
|
|
36
|
+
### From 2.x
|
|
28
37
|
|
|
29
38
|
- **SFX-only engine** — all queries route through the Suffix FST, no legacy code paths
|
|
30
39
|
- **Distributed search** — `merge_stats` for multi-node BM25
|
|
@@ -92,6 +101,14 @@ const index = await lucivy.create('/my-index', {
|
|
|
92
101
|
{ name: 'body', type: 'text' },
|
|
93
102
|
],
|
|
94
103
|
shards: 4,
|
|
104
|
+
// shared_dictionary: true — one dictionary per shard instead of one per
|
|
105
|
+
// segment: about 20 % less OPFS and memory, queries slightly slower at
|
|
106
|
+
// cold cache (roughly x1.2 to x1.6 on exact queries, fuzzy ones faster),
|
|
107
|
+
// same answers. Fixed at creation. The default since 4.0.0 (false keeps
|
|
108
|
+
// a suffix FST per segment).
|
|
109
|
+
// derived_in_ram: true — the three derived sidecars of each segment
|
|
110
|
+
// (about a third of the index) are rebuilt in memory when the index
|
|
111
|
+
// opens instead of written to OPFS. Same answers. Off by default.
|
|
95
112
|
});
|
|
96
113
|
|
|
97
114
|
// Open an existing index from OPFS
|
package/js/lucivy-worker.js
CHANGED
|
@@ -275,6 +275,7 @@ self.onmessage = async (e) => {
|
|
|
275
275
|
...(args.writerThreads ? [`--writer-threads=${args.writerThreads}`] : []),
|
|
276
276
|
...(args.maxMergedDocs ? [`--max-merged-docs=${args.maxMergedDocs}`] : []),
|
|
277
277
|
...(args.maxBuilds ? [`--max-builds=${args.maxBuilds}`] : []),
|
|
278
|
+
...(args.mergeConcurrency ? [`--merge-concurrency=${args.mergeConcurrency}`] : []),
|
|
278
279
|
...(args.maxMatches !== undefined && args.maxMatches !== null ? [`--max-matches-per-segment=${args.maxMatches}`] : []),
|
|
279
280
|
],
|
|
280
281
|
});
|
|
@@ -508,6 +509,10 @@ self.onmessage = async (e) => {
|
|
|
508
509
|
const ctx = getCtx(args.path);
|
|
509
510
|
result = JSON.parse(await callStr('lucivy_memory_status', ctx));
|
|
510
511
|
if (result.error) throw new Error(result.error);
|
|
512
|
+
// The wasm linear memory only grows: its size is the high-water
|
|
513
|
+
// mark of everything the engine ever held at once — the number
|
|
514
|
+
// that says how close a build or a merge came to the 4 GB.
|
|
515
|
+
result.heap_bytes = Module.HEAPU8.buffer.byteLength;
|
|
511
516
|
break;
|
|
512
517
|
}
|
|
513
518
|
|
|
@@ -550,6 +555,16 @@ self.onmessage = async (e) => {
|
|
|
550
555
|
break;
|
|
551
556
|
}
|
|
552
557
|
|
|
558
|
+
case 'dropIndex': {
|
|
559
|
+
// Delete an index directory from OPFS through WASMFS, the view
|
|
560
|
+
// this worker has: removing it from the main thread leaves a
|
|
561
|
+
// stale directory here and the next create at that path fails.
|
|
562
|
+
indexes.delete(args.path);
|
|
563
|
+
checkResult(await callStr('lucivy_drop_index', args.path));
|
|
564
|
+
result = true;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
|
|
553
568
|
case 'destroy': {
|
|
554
569
|
indexes.delete(args.path);
|
|
555
570
|
removeAllFiles(args.path).catch(() => {});
|
|
@@ -586,6 +601,62 @@ self.onmessage = async (e) => {
|
|
|
586
601
|
break;
|
|
587
602
|
}
|
|
588
603
|
|
|
604
|
+
// ── Incremental sync (LUCIDS) ───────────────────────────────
|
|
605
|
+
// The three entry points below were compiled into the wasm and
|
|
606
|
+
// listed in EXPORTED_FUNCTIONS from the start, but nothing above
|
|
607
|
+
// them called into them, so a browser client could only ever take
|
|
608
|
+
// a whole snapshot. Syncing a growing server index to a browser is
|
|
609
|
+
// the case this exists for, and a full snapshot each time is what
|
|
610
|
+
// makes it impractical.
|
|
611
|
+
|
|
612
|
+
case 'shardVersions': {
|
|
613
|
+
// What this client already holds, per shard — hand it to the
|
|
614
|
+
// server so it can send back only what moved.
|
|
615
|
+
const ctx = getCtx(args.path);
|
|
616
|
+
const json = await callStr('lucivy_shard_versions', ctx);
|
|
617
|
+
const parsed = json ? JSON.parse(json) : [];
|
|
618
|
+
// The C side reports failure as {"error": "..."}, which is a
|
|
619
|
+
// perfectly valid parse — returning it as data would hand the
|
|
620
|
+
// caller an object where it expects a list.
|
|
621
|
+
if (!Array.isArray(parsed)) throw new Error(parsed.error || 'shard_versions failed');
|
|
622
|
+
result = parsed;
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
case 'exportShardedDelta': {
|
|
627
|
+
const ctx = getCtx(args.path);
|
|
628
|
+
const versions = JSON.stringify(args.clientVersions || []);
|
|
629
|
+
const lenPtr = Module._malloc(4);
|
|
630
|
+
const dataPtr = await Module.ccall('lucivy_export_sharded_delta', 'number',
|
|
631
|
+
['number', 'string', 'number'], [ctx, versions, lenPtr], { async: true });
|
|
632
|
+
if (!dataPtr) {
|
|
633
|
+
Module._free(lenPtr);
|
|
634
|
+
throw new Error('export_sharded_delta failed — check the client versions shape');
|
|
635
|
+
}
|
|
636
|
+
const len = Module.getValue(lenPtr, 'i32');
|
|
637
|
+
Module._free(lenPtr);
|
|
638
|
+
// slice(), not subarray(): the wasm heap moves when it grows,
|
|
639
|
+
// and a view into it would silently point elsewhere afterwards.
|
|
640
|
+
result = Module.HEAPU8.slice(dataPtr, dataPtr + len);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
case 'applyShardedDelta': {
|
|
645
|
+
const ctx = getCtx(args.path);
|
|
646
|
+
const data = args.data instanceof Uint8Array ? args.data : new Uint8Array(args.data);
|
|
647
|
+
const ptr = Module._malloc(data.length);
|
|
648
|
+
Module.HEAPU8.set(data, ptr);
|
|
649
|
+
let res;
|
|
650
|
+
try {
|
|
651
|
+
res = await callStr('lucivy_apply_sharded_delta', ctx, ptr, data.length);
|
|
652
|
+
} finally {
|
|
653
|
+
Module._free(ptr);
|
|
654
|
+
}
|
|
655
|
+
checkResult(res);
|
|
656
|
+
result = true;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
|
|
589
660
|
case 'numDocs': {
|
|
590
661
|
const ctx = getCtx(args.path);
|
|
591
662
|
result = await Module.ccall('lucivy_num_docs', 'number', ['number'], [ctx], { async: true });
|
package/js/lucivy.d.ts
CHANGED
|
@@ -291,6 +291,12 @@ export interface LucivyOptions {
|
|
|
291
291
|
maxMergedDocs?: number;
|
|
292
292
|
/** Segment builds allowed at once (default 2). */
|
|
293
293
|
maxBuilds?: number;
|
|
294
|
+
/**
|
|
295
|
+
* Background merges allowed at once (`--merge-concurrency=N`; 1 in the
|
|
296
|
+
* browser by default, where a v3 merge rebuilding a segment's FST is a
|
|
297
|
+
* few hundred MB — a dictionary-mode merge rebuilds none).
|
|
298
|
+
*/
|
|
299
|
+
mergeConcurrency?: number;
|
|
294
300
|
}
|
|
295
301
|
|
|
296
302
|
export interface FieldDef {
|
|
@@ -303,7 +309,33 @@ export interface FieldDef {
|
|
|
303
309
|
|
|
304
310
|
export interface IndexConfig {
|
|
305
311
|
fields: FieldDef[];
|
|
312
|
+
/** Number of shards (default 1). */
|
|
306
313
|
shards?: number;
|
|
314
|
+
/**
|
|
315
|
+
* Store each distinct token text once per shard instead of once per
|
|
316
|
+
* segment: about 20 % smaller on disk and in memory, queries slightly
|
|
317
|
+
* slower at cold cache (roughly x1.2 to x1.6 on exact queries, fuzzy ones
|
|
318
|
+
* faster), a commit also writes the shard's new texts. Same answers.
|
|
319
|
+
* On by default since 4.0.0; `false` keeps a suffix FST per segment
|
|
320
|
+
* (indexing ×1.5 faster, an index 23 % bigger). Fixed at creation.
|
|
321
|
+
*/
|
|
322
|
+
shared_dictionary?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Do not write the three derived sidecars of each segment (about a third
|
|
325
|
+
* of the index in OPFS); they are rebuilt in memory, byte for byte, when
|
|
326
|
+
* the index opens. Same answers; opening pays the rebuild, never a query.
|
|
327
|
+
* Off by default; fixed at creation.
|
|
328
|
+
*/
|
|
329
|
+
derived_in_ram?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Shared dictionary only. A commit returns before the shard's new texts
|
|
332
|
+
* are merged into the dictionary (a background task does it); a search
|
|
333
|
+
* waits for that merge by default, so that its cost never depends on when
|
|
334
|
+
* it runs. `false` searches at once over the not-yet-merged parts.
|
|
335
|
+
* On by default; fixed at creation.
|
|
336
|
+
*/
|
|
337
|
+
dictionary_wait?: boolean;
|
|
338
|
+
/** Engine version: 4 (default, = `shared_dictionary: true`), 3 (a suffix FST per segment), 2 (pre-3.0). */
|
|
307
339
|
sfx_version?: number;
|
|
308
340
|
[key: string]: unknown;
|
|
309
341
|
}
|
|
@@ -330,6 +362,11 @@ export interface MemoryStatus {
|
|
|
330
362
|
/** Empty when the index is held in memory; a sentence for the user otherwise. */
|
|
331
363
|
warnings: string[];
|
|
332
364
|
shards: { shard: number; bytes: number; opened: number; listed: number }[];
|
|
365
|
+
/**
|
|
366
|
+
* Size of the wasm linear memory, which only grows: the high-water mark of
|
|
367
|
+
* everything the engine held at once since the worker started.
|
|
368
|
+
*/
|
|
369
|
+
heap_bytes: number;
|
|
333
370
|
}
|
|
334
371
|
|
|
335
372
|
export interface PreloadResult {
|
|
@@ -338,6 +375,11 @@ export interface PreloadResult {
|
|
|
338
375
|
ms: number;
|
|
339
376
|
/** True when the index is streamed and nothing was loaded. */
|
|
340
377
|
skipped: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Milliseconds spent waiting for the background merges before reading:
|
|
380
|
+
* after many small commits this is the long part, not the reads.
|
|
381
|
+
*/
|
|
382
|
+
merge_wait_ms: number;
|
|
341
383
|
}
|
|
342
384
|
|
|
343
385
|
export class Lucivy {
|
|
@@ -348,6 +390,12 @@ export class Lucivy {
|
|
|
348
390
|
open(path: string): Promise<LucivyIndex>;
|
|
349
391
|
/** Open an index persisted in OPFS in place (no copy). */
|
|
350
392
|
openDirect(path: string): Promise<LucivyIndex>;
|
|
393
|
+
/**
|
|
394
|
+
* Delete an index directory from OPFS, through the worker (removing it
|
|
395
|
+
* from the main thread leaves the worker's filesystem view stale and the
|
|
396
|
+
* next `create` at that path fails). Close the index first if it is open.
|
|
397
|
+
*/
|
|
398
|
+
dropIndex(path: string): Promise<void>;
|
|
351
399
|
importSnapshot(data: Uint8Array, path: string): Promise<LucivyIndex>;
|
|
352
400
|
/** Terminate the worker and free every byte of WASM memory. */
|
|
353
401
|
terminate(): void;
|
|
@@ -374,6 +422,20 @@ export class LucivyIndex {
|
|
|
374
422
|
numDocs(): Promise<number>;
|
|
375
423
|
schema(): Promise<IndexConfig>;
|
|
376
424
|
exportSnapshot(): Promise<Uint8Array>;
|
|
425
|
+
/** What this index holds per shard — hand it to whoever exports the delta. */
|
|
426
|
+
shardVersions(): Promise<ShardVersion[]>;
|
|
427
|
+
/** A LUCIDS delta holding only the shards that moved since `clientVersions`. */
|
|
428
|
+
exportShardedDelta(clientVersions?: ShardVersion[]): Promise<Uint8Array>;
|
|
429
|
+
/** Apply a LUCIDS delta onto this index, in place. */
|
|
430
|
+
applyShardedDelta(data: Uint8Array | ArrayBuffer): Promise<boolean>;
|
|
377
431
|
close(): Promise<void>;
|
|
378
432
|
destroy(): Promise<void>;
|
|
379
433
|
}
|
|
434
|
+
|
|
435
|
+
/** One shard's identity and the version of it a client holds. */
|
|
436
|
+
export interface ShardVersion {
|
|
437
|
+
shard_id: number;
|
|
438
|
+
version: string;
|
|
439
|
+
/** The segments that version is made of — what the exporter diffs against. */
|
|
440
|
+
segment_ids: string[];
|
|
441
|
+
}
|
package/js/lucivy.js
CHANGED
|
@@ -52,6 +52,7 @@ export class Lucivy {
|
|
|
52
52
|
writerThreads: options.writerThreads || 0,
|
|
53
53
|
maxMergedDocs: options.maxMergedDocs || 0,
|
|
54
54
|
maxBuilds: options.maxBuilds || 0,
|
|
55
|
+
mergeConcurrency: options.mergeConcurrency || 0,
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -100,7 +101,15 @@ export class Lucivy {
|
|
|
100
101
|
* Create a new index.
|
|
101
102
|
* @param {string} path
|
|
102
103
|
* @param {Array|Object} fieldsOrConfig — either a fields array or a full SchemaConfig
|
|
103
|
-
* Full config: { fields: [...],
|
|
104
|
+
* Full config: { fields: [...], shards: 4, shared_dictionary: false, tokenizer: "english", ... }
|
|
105
|
+
* shared_dictionary: store each distinct token text once per shard instead of
|
|
106
|
+
* once per segment — about 20 % smaller on disk and in memory, queries
|
|
107
|
+
* slightly slower at cold cache (roughly x1.2 to x1.6 on exact queries,
|
|
108
|
+
* fuzzy ones faster), a commit also writes the shard's new texts; same
|
|
109
|
+
* answers. Off by default, fixed at creation.
|
|
110
|
+
* derived_in_ram: the three derived sidecars of each segment (about a
|
|
111
|
+
* third of the index in OPFS) rebuilt in memory when the index opens
|
|
112
|
+
* instead of written; same answers. Off by default, fixed at creation.
|
|
104
113
|
* Legacy: [{ name: "body", type: "text" }]
|
|
105
114
|
*/
|
|
106
115
|
async create(path, fieldsOrConfig) {
|
|
@@ -125,6 +134,16 @@ export class Lucivy {
|
|
|
125
134
|
return new LucivyIndex(this, path);
|
|
126
135
|
}
|
|
127
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Delete an index directory from OPFS (`drop <name>` in the playground).
|
|
139
|
+
* Goes through the worker: WASMFS caches what it mounted, so a directory
|
|
140
|
+
* removed from the main thread would still exist for it and the next
|
|
141
|
+
* `create` at that path would fail. Close the index first if it is open.
|
|
142
|
+
*/
|
|
143
|
+
async dropIndex(path) {
|
|
144
|
+
await this._call('dropIndex', { path });
|
|
145
|
+
}
|
|
146
|
+
|
|
128
147
|
async importSnapshot(data, path) {
|
|
129
148
|
const res = await this._call('importSnapshot', { data, path });
|
|
130
149
|
return new LucivyIndex(this, path);
|
|
@@ -229,6 +248,44 @@ export class LucivyIndex {
|
|
|
229
248
|
return this._lucivy._call('exportSnapshot', { path: this.path });
|
|
230
249
|
}
|
|
231
250
|
|
|
251
|
+
/**
|
|
252
|
+
* What this index already holds, one entry per shard.
|
|
253
|
+
*
|
|
254
|
+
* Send it to whoever exports the delta: it is what lets them return only
|
|
255
|
+
* the shards that moved instead of the whole index.
|
|
256
|
+
*
|
|
257
|
+
* @returns {Promise<Array<{shard: number, version: string}>>}
|
|
258
|
+
*/
|
|
259
|
+
shardVersions() {
|
|
260
|
+
return this._lucivy._call('shardVersions', { path: this.path });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* A LUCIDS delta holding only what changed since `clientVersions`.
|
|
265
|
+
*
|
|
266
|
+
* @param {Array} clientVersions what the other side holds, from its own
|
|
267
|
+
* `shardVersions()`. An empty array asks for everything.
|
|
268
|
+
* @returns {Promise<Uint8Array>}
|
|
269
|
+
*/
|
|
270
|
+
exportShardedDelta(clientVersions = []) {
|
|
271
|
+
return this._lucivy._call('exportShardedDelta', { path: this.path, clientVersions });
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Apply a LUCIDS delta onto this index, in place.
|
|
276
|
+
*
|
|
277
|
+
* The counterpart of `exportShardedDelta`: after it resolves, this index
|
|
278
|
+
* holds what the exporting side held when it produced the delta. Applying
|
|
279
|
+
* a delta built against different versions than this index actually has is
|
|
280
|
+
* rejected rather than half-applied.
|
|
281
|
+
*
|
|
282
|
+
* @param {Uint8Array|ArrayBuffer} data the delta blob
|
|
283
|
+
* @returns {Promise<boolean>}
|
|
284
|
+
*/
|
|
285
|
+
applyShardedDelta(data) {
|
|
286
|
+
return this._lucivy._call('applyShardedDelta', { path: this.path, data });
|
|
287
|
+
}
|
|
288
|
+
|
|
232
289
|
close() {
|
|
233
290
|
return this._lucivy._call('close', { path: this.path });
|
|
234
291
|
}
|
package/package.json
CHANGED
package/pkg/lucivy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
async function createLucivy(moduleArg={}){var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";var ENVIRONMENT_IS_PTHREAD=ENVIRONMENT_IS_WORKER&&globalThis.name=="em-pthread";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url);var worker_threads=require("node:worker_threads");globalThis.Worker=worker_threads.Worker;ENVIRONMENT_IS_WORKER=!worker_threads.isMainThread;ENVIRONMENT_IS_PTHREAD=ENVIRONMENT_IS_WORKER&&worker_threads.workerData=="em-pthread"}var programArgs=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}programArgs=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}if(!ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var defaultPrint=console.log.bind(console);var defaultPrintErr=console.error.bind(console);if(ENVIRONMENT_IS_NODE){var utils=require("node:util");var stringify=a=>typeof a=="object"?utils.inspect(a):a;defaultPrint=(...args)=>fs.writeSync(1,args.map(stringify).join(" ")+"\n");defaultPrintErr=(...args)=>fs.writeSync(2,args.map(stringify).join(" ")+"\n")}var out=defaultPrint;var err=defaultPrintErr;var wasmBinary;var wasmModule;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");class EmscriptenEH{}class EmscriptenSjLj extends EmscriptenEH{}class CppException extends EmscriptenEH{constructor(excPtr){super();this.excPtr=excPtr}}function growMemViews(){if(wasmMemory.buffer!=HEAP8.buffer){updateMemoryViews()}}if(ENVIRONMENT_IS_NODE&&ENVIRONMENT_IS_PTHREAD){globalThis.self=globalThis;var parentPort=worker_threads.parentPort;if(!globalThis.postMessage){parentPort.on("message",msg=>globalThis.onmessage?.({data:msg}));globalThis.postMessage=msg=>parentPort.postMessage(msg)}process.on("uncaughtException",err=>{postMessage({cmd:8,error:err});process.exit(1)})}var startWorker;if(ENVIRONMENT_IS_PTHREAD){var initializedJS=false;self.onunhandledrejection=e=>{throw e.reason||e};function handleMessage(e){try{var msgData=e.data;var cmd=msgData.cmd;if(cmd==1){let messageQueue=[];self.onmessage=e=>messageQueue.push(e);startWorker=()=>{postMessage({cmd:3});for(let msg of messageQueue){handleMessage(msg)}self.onmessage=handleMessage};for(const handler of msgData.handlers){if(!Module[handler]||Module[handler].proxy){Module[handler]=(...args)=>{postMessage({cmd:9,handler,args})};if(handler=="print")out=Module[handler];if(handler=="printErr")err=Module[handler]}}wasmMemory=msgData.wasmMemory;updateMemoryViews();wasmModule=msgData.wasmModule;createWasm();run();startWorker()}else if(cmd==2){establishStackSpace(msgData.pthread_ptr);__emscripten_thread_init(msgData.pthread_ptr,0,0,1,0,0);PThread.threadInitTLS();__emscripten_thread_mailbox_await(msgData.pthread_ptr);if(!initializedJS){initializedJS=true}try{invokeEntryPoint(msgData.start_routine,msgData.arg)}catch(ex){if(ex!="unwind"){throw ex}}}else if(cmd==4){if(initializedJS){checkMailbox()}}else if(cmd){err(`worker: received unknown command ${cmd}`);err(msgData)}}catch(ex){if(runtimeInitialized)__emscripten_thread_crashed();throw ex}}self.onmessage=handleMessage}var runtimeInitialized=false;function getMemoryBuffer(){return wasmMemory.buffer}function updateMemoryViews(){if(HEAP8?.buffer?.growable)return;var b=getMemoryBuffer();HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b)}function initMemory(){if(ENVIRONMENT_IS_PTHREAD){return}{var INITIAL_MEMORY=16777216;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:65536,shared:true})}updateMemoryViews()}function preRun(){var preRun=Module["preRun"];if(preRun){if(typeof preRun=="function")preRun=[preRun];onPreRuns.push(...preRun)}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_PTHREAD)return;wasmExports["__wasm_call_ctors"]()}function postRun(){var postRun=Module["postRun"];if(postRun){if(typeof postRun=="function")postRun=[postRun];onPostRuns.push(...postRun)}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("lucivy.wasm")}return new URL("lucivy.wasm",import.meta.url).href}function getBinarySync(file){if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){assignWasmImports();var imports={env:wasmImports,wasi_snapshot_preview1:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=applySignatureConversions(wasmExports);registerTLSInit(wasmExports["_emscripten_tls_init"]);assignWasmExports(wasmExports);wasmModule=module;return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"],result["module"])}var info=getWasmImports();var instantiateWasm=Module["instantiateWasm"];if(instantiateWasm){return new Promise(resolve=>{instantiateWasm(info,(inst,mod)=>resolve(receiveInstance(inst,mod)))})}if(ENVIRONMENT_IS_PTHREAD){var instance=new WebAssembly.Instance(wasmModule,getWasmImports());return receiveInstance(instance,wasmModule)}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP8;var terminateWorker=worker=>{worker.terminate();worker.onmessage=e=>{}};var cleanupThread=pthread_ptr=>{var worker=PThread.pthreads[pthread_ptr];PThread.returnWorkerToPool(worker)};var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var dependenciesPromise=null;var resolveRunDependencies=async()=>dependenciesPromise;var runDependencies=0;var dependenciesPromiseResolve=null;var removeRunDependency=id=>{runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(!runDependencies){dependenciesPromiseResolve()}};var addRunDependency=id=>{if(!runDependencies){dependenciesPromise=new Promise(resolve=>dependenciesPromiseResolve=resolve)}runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)};var spawnThread=threadParams=>{var worker=PThread.getNewWorker();if(!worker){return 6}PThread.pthreads[threadParams.pthread_ptr]=worker;worker.pthread_ptr=threadParams.pthread_ptr;var msg={cmd:2,start_routine:threadParams.startRoutine,arg:threadParams.arg,pthread_ptr:threadParams.pthread_ptr};worker.postMessage(msg,threadParams.transferList);return 0};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var stackSave=()=>_emscripten_stack_get_current();var stackRestore=val=>__emscripten_stack_restore(val);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var HEAPF64;var HEAP64;var proxyToMainThread=(funcIndex,emAsmAddr,proxyMode,...callArgs)=>{var bufSize=8*callArgs.length*2;var sp=stackSave();var args=stackAlloc(bufSize);var b=args>>>3;for(var arg of callArgs){if(typeof arg=="bigint"){(growMemViews(),HEAP64)[b++>>>0]=1n;(growMemViews(),HEAP64)[b++>>>0]=arg}else{(growMemViews(),HEAP64)[b++>>>0]=0n;(growMemViews(),HEAPF64)[b++>>>0]=arg}}var rtn=__emscripten_run_js_on_main_thread(funcIndex,emAsmAddr,bufSize,args,proxyMode);stackRestore(sp);return rtn};function _proc_exit(code){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(0,0,1,code);EXITSTATUS=code;if(!keepRuntimeAlive()){PThread.terminateAllThreads();Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))}var runtimeKeepalivePop=()=>{runtimeKeepaliveCounter-=1};function exitOnMainThread(returnCode){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(1,0,0,returnCode);runtimeKeepalivePop();_exit(returnCode)}var exitJS=(status,implicit)=>{EXITSTATUS=status;if(ENVIRONMENT_IS_PTHREAD){exitOnMainThread(status);throw"unwind"}_proc_exit(status)};var _exit=exitJS;var waitAsyncPolyfilled=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2])<91;var HEAP32;var PThread={unusedWorkers:[],tlsInitFunctions:[],pthreads:{},init(){if(!ENVIRONMENT_IS_PTHREAD){PThread.initMainThread()}},initMainThread(){var pthreadPoolSize=Math.min(navigator.hardwareConcurrency||4,16);while(pthreadPoolSize--){PThread.allocateUnusedWorker()}addOnPreRun(async()=>{var pthreadPoolReady=PThread.loadWasmModuleToAllWorkers();addRunDependency("loading-workers");await pthreadPoolReady;removeRunDependency("loading-workers")})},terminateAllThreads:()=>{for(var worker of Object.values(PThread.pthreads)){terminateWorker(worker)}for(var worker of PThread.unusedWorkers){terminateWorker(worker)}PThread.unusedWorkers=[];PThread.pthreads={}},clearMailboxAwait:pthread_ptr=>{if(!waitAsyncPolyfilled){Atomics.notify((growMemViews(),HEAP32),pthread_ptr>>>2)}},terminateRuntime:()=>{PThread.terminateAllThreads();var pthread_ptr=_pthread_self();___set_thread_state(0,0,0,1);PThread.clearMailboxAwait(pthread_ptr)},returnWorkerToPool:worker=>{var pthread_ptr=worker.pthread_ptr;delete PThread.pthreads[pthread_ptr];PThread.unusedWorkers.push(worker);worker.pthread_ptr=0;if(ENVIRONMENT_IS_NODE){worker.unref()}PThread.clearMailboxAwait(pthread_ptr);__emscripten_thread_free_data(pthread_ptr)},threadInitTLS(){PThread.tlsInitFunctions.forEach(f=>f())},loadWasmModuleToWorker:worker=>new Promise(onFinishedLoading=>{worker.onmessage=e=>{var d=e.data;var cmd=d.cmd;if(d.targetThread&&d.targetThread!=_pthread_self()){var targetWorker=PThread.pthreads[d.targetThread];targetWorker?.postMessage(d);return}if(d==="setimmediate"||d==="_si"){worker.postMessage(d);return}switch(cmd){case 4:checkMailbox();break;case 5:spawnThread(d);break;case 6:callUserCallback(()=>cleanupThread(d.thread));break;case 3:if(ENVIRONMENT_IS_NODE&&!worker.strongref){worker.unref()}onFinishedLoading(worker);break;case 8:worker.onerror(d.error);break;case 9:Module[d.handler](...d.args);break;default:if(cmd)err(`worker sent an unknown command ${cmd}`)}};worker.onerror=e=>{var message="worker sent an error!";err(`${message} ${e.filename}:${e.lineno}: ${e.message}`);throw e};if(ENVIRONMENT_IS_NODE){worker.on("message",data=>worker.onmessage({data}));worker.on("error",e=>worker.onerror(e))}var handlers=[];var knownHandlers=["onExit","onAbort","print","printErr"];for(var handler of knownHandlers){if(Module.propertyIsEnumerable(handler)){handlers.push(handler)}}worker.postMessage({cmd:1,handlers,wasmMemory,wasmModule})}),async loadWasmModuleToAllWorkers(){if(ENVIRONMENT_IS_PTHREAD){return}let pthreadPoolReady=Promise.all(PThread.unusedWorkers.map(PThread.loadWasmModuleToWorker));return pthreadPoolReady},allocateUnusedWorker(){var worker;worker=new Worker(new URL("lucivy.js",import.meta.url),{type:"module",workerData:"em-pthread",trackUnmanagedFds:false,name:"em-pthread"});PThread.unusedWorkers.push(worker);return worker},getNewWorker(){if(PThread.unusedWorkers.length==0){var newWorker=PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(newWorker)}return PThread.unusedWorkers.pop()}};var onPostRuns=[];var HEAPU32;function establishStackSpace(pthread_ptr){var stackHigh=(growMemViews(),HEAPU32)[pthread_ptr+48>>>2>>>0];var stackSize=(growMemViews(),HEAPU32)[pthread_ptr+52>>>2>>>0];var stackLow=stackHigh-stackSize;_emscripten_stack_set_limits(stackHigh,stackLow);stackRestore(stackHigh)}var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var invokeEntryPoint=(ptr,arg)=>{runtimeKeepaliveCounter=0;noExitRuntime=0;var result=getWasmTableEntry(ptr)(arg);function finish(result){if(keepRuntimeAlive()){EXITSTATUS=result;return}__emscripten_thread_exit(result)}finish(result)};var noExitRuntime=true;var registerTLSInit=tlsInitFunc=>PThread.tlsInitFunctions.push(tlsInitFunc);var runtimeKeepalivePush=()=>{runtimeKeepaliveCounter+=1};var wasmMemory;var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function ___call_sighandler(fp,sig){fp>>>=0;return getWasmTableEntry(fp)(sig)}var exceptionCaught=[];var uncaughtExceptionCount=0;function ___cxa_begin_catch(ptr){ptr>>>=0;var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);return ___cxa_get_exception_ptr(ptr)}var exceptionLast=null;class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){(growMemViews(),HEAPU32)[this.ptr+4>>>2>>>0]=type}get_type(){return(growMemViews(),HEAPU32)[this.ptr+4>>>2>>>0]}set_destructor(destructor){(growMemViews(),HEAPU32)[this.ptr+8>>>2>>>0]=destructor}get_destructor(){return(growMemViews(),HEAPU32)[this.ptr+8>>>2>>>0]}set_caught(caught){caught=caught?1:0;(growMemViews(),HEAP8)[this.ptr+12>>>0]=caught}get_caught(){return(growMemViews(),HEAP8)[this.ptr+12>>>0]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;(growMemViews(),HEAP8)[this.ptr+13>>>0]=rethrown}get_rethrown(){return(growMemViews(),HEAP8)[this.ptr+13>>>0]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){(growMemViews(),HEAPU32)[this.ptr+16>>>2>>>0]=adjustedPtr}get_adjusted_ptr(){return(growMemViews(),HEAPU32)[this.ptr+16>>>2>>>0]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast?.excPtr;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(!caughtType||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};function ___cxa_find_matching_catch_2(){return findMatchingCatch([])}function ___cxa_find_matching_catch_3(arg0){arg0>>>=0;return findMatchingCatch([arg0])}var __Unwind_RaiseException=ex=>{throw ex};function ___cxa_throw(ptr,type,destructor){ptr>>>=0;type>>>=0;destructor>>>=0;var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);ptr=exceptionLast=new CppException(ptr);uncaughtExceptionCount++;__Unwind_RaiseException(ptr)}function pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(2,0,1,pthread_ptr,attr,startRoutine,arg);return ___pthread_create_js(pthread_ptr,attr,startRoutine,arg)}var _emscripten_has_threading_support=()=>!!globalThis.SharedArrayBuffer;function ___pthread_create_js(pthread_ptr,attr,startRoutine,arg){pthread_ptr>>>=0;attr>>>=0;startRoutine>>>=0;arg>>>=0;if(!_emscripten_has_threading_support()){return 6}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(!transferList.length||error)){return pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg)}if(error)return error;var threadParams={startRoutine,pthread_ptr,arg,transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd=5;postMessage(threadParams,transferList);return 0}return spawnThread(threadParams)}var __Unwind_Resume=ex=>{throw ex};function ___resumeException(ptr){ptr>>>=0;ptr=exceptionLast??=new CppException(ptr);__Unwind_Resume(ptr)}var __abort_js=()=>abort("");function __emscripten_init_main_thread_js(tb){tb>>>=0;var can_block=!ENVIRONMENT_IS_WEB;try{Atomics.wait((growMemViews(),HEAP32),0,0,0);can_block=true}catch(e){}__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1,can_block,2097152,false);PThread.threadInitTLS()}var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var maybeExit=()=>{if(!keepRuntimeAlive()){try{if(ENVIRONMENT_IS_PTHREAD){if(_pthread_self())__emscripten_thread_exit(EXITSTATUS);return}_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};function __emscripten_thread_mailbox_await(pthread_ptr){pthread_ptr>>>=0;if(!waitAsyncPolyfilled){var wait=Atomics.waitAsync((growMemViews(),HEAP32),pthread_ptr>>>2,pthread_ptr);wait.value.then(checkMailbox);var waitingAsync=pthread_ptr+112;Atomics.store((growMemViews(),HEAP32),waitingAsync>>>2,1)}}var checkMailbox=()=>{var pthread_ptr=_pthread_self();if(!pthread_ptr)return;callUserCallback(()=>{__emscripten_thread_mailbox_await(pthread_ptr);__emscripten_check_mailbox()})};function __emscripten_notify_mailbox_postmessage(targetThread,currThreadId){targetThread>>>=0;currThreadId>>>=0;if(targetThread==currThreadId){setTimeout(checkMailbox)}else if(ENVIRONMENT_IS_PTHREAD){postMessage({targetThread,cmd:4})}else{var worker=PThread.pthreads[targetThread];if(!worker){return}worker.postMessage({cmd:4})}}var proxiedJSCallArgs=[];function __emscripten_receive_on_main_thread_js(funcIndex,emAsmAddr,callingThread,bufSize,args,ctx,ctxArgs){emAsmAddr>>>=0;callingThread>>>=0;args>>>=0;ctx>>>=0;ctxArgs>>>=0;proxiedJSCallArgs.length=0;var b=args>>>3;var end=args+bufSize>>>3;while(b<end){var arg;if((growMemViews(),HEAP64)[b++>>>0]){arg=(growMemViews(),HEAP64)[b++>>>0]}else{arg=(growMemViews(),HEAPF64)[b++>>>0]}proxiedJSCallArgs.push(arg)}var func=proxiedFunctionTable[funcIndex];PThread.currentProxiedOperationCallerThread=callingThread;var rtn=func(...proxiedJSCallArgs);PThread.currentProxiedOperationCallerThread=0;if(ctx){rtn.then(rtn=>__emscripten_run_js_on_main_thread_done(ctx,ctxArgs,rtn));return}return rtn}var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};function __emscripten_thread_cleanup(thread){thread>>>=0;if(!ENVIRONMENT_IS_PTHREAD)cleanupThread(thread);else postMessage({cmd:6,thread})}function __emscripten_thread_set_strongref(thread){thread>>>=0;if(ENVIRONMENT_IS_NODE){var worker=PThread.pthreads[thread];worker.ref();worker.strongref=1}}var HEAPU8;function __wasmfs_copy_preloaded_file_data(index,buffer){buffer>>>=0;return(growMemViews(),HEAPU8).set(wasmFSPreloadedFiles[index].fileData,buffer>>>0)}var wasmFSPreloadedDirs=[];var __wasmfs_get_num_preloaded_dirs=()=>wasmFSPreloadedDirs.length;var wasmFSPreloadedFiles=[];var wasmFSPreloadingFlushed=false;var __wasmfs_get_num_preloaded_files=()=>{wasmFSPreloadingFlushed=true;return wasmFSPreloadedFiles.length};function __wasmfs_get_preloaded_child_path(index,childNameBuffer){childNameBuffer>>>=0;var s=wasmFSPreloadedDirs[index].childName;var len=lengthBytesUTF8(s)+1;stringToUTF8(s,childNameBuffer,len)}var __wasmfs_get_preloaded_file_mode=index=>wasmFSPreloadedFiles[index].mode;function __wasmfs_get_preloaded_file_size(index){return wasmFSPreloadedFiles[index].fileData.length}function __wasmfs_get_preloaded_parent_path(index,parentPathBuffer){parentPathBuffer>>>=0;var s=wasmFSPreloadedDirs[index].parentPath;var len=lengthBytesUTF8(s)+1;stringToUTF8(s,parentPathBuffer,len)}var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{outIdx>>>=0;if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++>>>0]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++>>>0]=192|u>>6;heap[outIdx++>>>0]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++>>>0]=224|u>>12;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++>>>0]=240|u>>18;heap[outIdx++>>>0]=128|u>>12&63;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63;i++}}heap[outIdx>>>0]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,(growMemViews(),HEAPU8),outPtr,maxBytesToWrite);function __wasmfs_get_preloaded_path_name(index,fileNameBuffer){fileNameBuffer>>>=0;var s=wasmFSPreloadedFiles[index].pathName;var len=lengthBytesUTF8(s)+1;stringToUTF8(s,fileNameBuffer,len)}class HandleAllocator{allocated=[undefined];freelist=[];get(id){return this.allocated[id]}has(id){return this.allocated[id]!==undefined}allocate(handle){var id=this.freelist.pop()??this.allocated.length;this.allocated[id]=handle;return id}free(id){this.allocated[id]=undefined;this.freelist.push(id)}}var wasmfsOPFSAccessHandles=new HandleAllocator;var wasmfsOPFSProxyFinish=ctx=>{_emscripten_proxy_finish(ctx)};async function __wasmfs_opfs_close_access(ctx,accessID,errPtr){ctx>>>=0;errPtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);try{await accessHandle.close()}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSAccessHandles.free(accessID);wasmfsOPFSProxyFinish(ctx)}var wasmfsOPFSBlobs=new HandleAllocator;var __wasmfs_opfs_close_blob=blobID=>{wasmfsOPFSBlobs.free(blobID)};async function __wasmfs_opfs_flush_access(ctx,accessID,errPtr){ctx>>>=0;errPtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);try{await accessHandle.flush()}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}var wasmfsOPFSDirectoryHandles=new HandleAllocator;var __wasmfs_opfs_free_directory=dirID=>{wasmfsOPFSDirectoryHandles.free(dirID)};var wasmfsOPFSFileHandles=new HandleAllocator;var __wasmfs_opfs_free_file=fileID=>{wasmfsOPFSFileHandles.free(fileID)};var wasmfsOPFSGetOrCreateFile=async(parent,name,create)=>{let parentHandle=wasmfsOPFSDirectoryHandles.get(parent);let fileHandle;try{fileHandle=await parentHandle.getFileHandle(name,{create})}catch(e){if(e.name==="NotFoundError"){return-20}if(e.name==="TypeMismatchError"){return-31}return-29}return wasmfsOPFSFileHandles.allocate(fileHandle)};var wasmfsOPFSGetOrCreateDir=async(parent,name,create)=>{let parentHandle=wasmfsOPFSDirectoryHandles.get(parent);let childHandle;try{childHandle=await parentHandle.getDirectoryHandle(name,{create})}catch(e){if(e.name==="NotFoundError"){return-20}if(e.name==="TypeMismatchError"){return-54}return-29}return wasmfsOPFSDirectoryHandles.allocate(childHandle)};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{idx>>>=0;var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.buffer instanceof ArrayBuffer?heapOrArray.subarray(idx,endPtr):heapOrArray.slice(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>{ptr>>>=0;return ptr?UTF8ArrayToString((growMemViews(),HEAPU8),ptr,maxBytesToRead,ignoreNul):""};async function __wasmfs_opfs_get_child(ctx,parent,namePtr,childTypePtr,childIDPtr){ctx>>>=0;namePtr>>>=0;childTypePtr>>>=0;childIDPtr>>>=0;let name=UTF8ToString(namePtr);let childType=1;let childID=await wasmfsOPFSGetOrCreateFile(parent,name,false);if(childID==-31){childType=2;childID=await wasmfsOPFSGetOrCreateDir(parent,name,false)}(growMemViews(),HEAP32)[childTypePtr>>>2>>>0]=childType;(growMemViews(),HEAP32)[childIDPtr>>>2>>>0]=childID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_get_entries(ctx,dirID,entriesPtr,errPtr){ctx>>>=0;entriesPtr>>>=0;errPtr>>>=0;let dirHandle=wasmfsOPFSDirectoryHandles.get(dirID);try{let iter=dirHandle.entries();for(let entry;entry=await iter.next(),!entry.done;){let[name,child]=entry.value;let sp=stackSave();let namePtr=stringToUTF8OnStack(name);let type=child.kind=="file"?1:2;__wasmfs_opfs_record_entry(entriesPtr,namePtr,type);stackRestore(sp)}}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_get_size_access(ctx,accessID,sizePtr){ctx>>>=0;sizePtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);let size;try{size=await accessHandle.getSize()}catch{size=-29}(growMemViews(),HEAP64)[sizePtr>>>3>>>0]=BigInt(size);wasmfsOPFSProxyFinish(ctx)}var __wasmfs_opfs_get_size_blob=function(blobID){var ret=(()=>wasmfsOPFSBlobs.get(blobID).size)();return BigInt(ret)};async function __wasmfs_opfs_get_size_file(ctx,fileID,sizePtr){ctx>>>=0;sizePtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);let size;try{size=(await fileHandle.getFile()).size}catch{size=-29}(growMemViews(),HEAP64)[sizePtr>>>3>>>0]=BigInt(size);wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_init_root_directory(ctx){ctx>>>=0;if(wasmfsOPFSDirectoryHandles.allocated.length==1){let root=await navigator.storage.getDirectory();wasmfsOPFSDirectoryHandles.allocated.push(root)}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_insert_directory(ctx,parent,namePtr,childIDPtr){ctx>>>=0;namePtr>>>=0;childIDPtr>>>=0;let name=UTF8ToString(namePtr);let childID=await wasmfsOPFSGetOrCreateDir(parent,name,true);(growMemViews(),HEAP32)[childIDPtr>>>2>>>0]=childID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_insert_file(ctx,parent,namePtr,childIDPtr){ctx>>>=0;namePtr>>>=0;childIDPtr>>>=0;let name=UTF8ToString(namePtr);let childID=await wasmfsOPFSGetOrCreateFile(parent,name,true);(growMemViews(),HEAP32)[childIDPtr>>>2>>>0]=childID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_move_file(ctx,fileID,newParentID,namePtr,errPtr){ctx>>>=0;namePtr>>>=0;errPtr>>>=0;let name=UTF8ToString(namePtr);let fileHandle=wasmfsOPFSFileHandles.get(fileID);let newDirHandle=wasmfsOPFSDirectoryHandles.get(newParentID);try{await fileHandle.move(newDirHandle,name)}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_open_access(ctx,fileID,accessIDPtr){ctx>>>=0;accessIDPtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);let accessID;try{let accessHandle;var len=FileSystemFileHandle.prototype.createSyncAccessHandle.length;if(len==0){accessHandle=await fileHandle.createSyncAccessHandle()}else{accessHandle=await fileHandle.createSyncAccessHandle({mode:"in-place"})}accessID=wasmfsOPFSAccessHandles.allocate(accessHandle)}catch(e){if(e.name==="InvalidStateError"||e.name==="NoModificationAllowedError"){accessID=-2}else{accessID=-29}}(growMemViews(),HEAP32)[accessIDPtr>>>2>>>0]=accessID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_open_blob(ctx,fileID,blobIDPtr){ctx>>>=0;blobIDPtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);let blobID;try{let blob=await fileHandle.getFile();blobID=wasmfsOPFSBlobs.allocate(blob)}catch(e){if(e.name==="NotAllowedError"){blobID=-2}else{blobID=-29}}(growMemViews(),HEAP32)[blobIDPtr>>>2>>>0]=blobID;wasmfsOPFSProxyFinish(ctx)}function __wasmfs_opfs_read_access(accessID,bufPtr,len,pos){bufPtr>>>=0;pos=bigintToI53Checked(pos);let accessHandle=wasmfsOPFSAccessHandles.get(accessID);let data=(growMemViews(),HEAPU8).subarray(bufPtr>>>0,bufPtr+len>>>0);try{return accessHandle.read(data,{at:pos})}catch(e){if(e.name=="TypeError"){return-28}return-29}}async function __wasmfs_opfs_read_blob(ctx,blobID,bufPtr,len,pos,nreadPtr){ctx>>>=0;bufPtr>>>=0;pos=bigintToI53Checked(pos);nreadPtr>>>=0;let blob=wasmfsOPFSBlobs.get(blobID);let slice=blob.slice(pos,pos+len);let nread=0;try{let buf=await slice.arrayBuffer();let data=new Uint8Array(buf);(growMemViews(),HEAPU8).set(data,bufPtr>>>0);nread+=data.length}catch(e){if(e instanceof RangeError){nread=-21}else{nread=-29}}(growMemViews(),HEAP32)[nreadPtr>>>2>>>0]=nread;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_remove_child(ctx,dirID,namePtr,errPtr){ctx>>>=0;namePtr>>>=0;errPtr>>>=0;let name=UTF8ToString(namePtr);let dirHandle=wasmfsOPFSDirectoryHandles.get(dirID);try{await dirHandle.removeEntry(name)}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_set_size_access(ctx,accessID,size,errPtr){ctx>>>=0;size=bigintToI53Checked(size);errPtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);try{await accessHandle.truncate(size)}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_set_size_file(ctx,fileID,size,errPtr){ctx>>>=0;size=bigintToI53Checked(size);errPtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);try{let writable=await fileHandle.createWritable({keepExistingData:true});await writable.truncate(size);await writable.close()}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}function __wasmfs_opfs_write_access(accessID,bufPtr,len,pos){bufPtr>>>=0;pos=bigintToI53Checked(pos);let accessHandle=wasmfsOPFSAccessHandles.get(accessID);let data=(growMemViews(),HEAPU8).subarray(bufPtr>>>0,bufPtr+len>>>0);try{return accessHandle.write(data,{at:pos})}catch(e){if(e.name=="TypeError"){return-28}return-29}}var FS_stdin_getChar_buffer=[];var intArrayFromString=(stringy,dontAddNull,length)=>{var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array};var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(globalThis.window?.prompt){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var __wasmfs_stdin_get_char=()=>{var c=FS_stdin_getChar();if(typeof c==="number"){return c}return-1};var __wasmfs_thread_utils_heartbeat=function(queue){queue>>>=0;var intervalID=setInterval(()=>{if(ABORT){clearInterval(intervalID)}else{_emscripten_proxy_execute_queue(queue)}},50)};var _emscripten_get_now=()=>performance.timeOrigin+performance.now();var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);ptime>>>=0;if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);(growMemViews(),HEAP64)[ptime>>>3>>>0]=BigInt(nsec);return 0}var _emscripten_check_blocking_allowed=()=>{};function _emscripten_err(str){str>>>=0;return err(UTF8ToString(str))}var _emscripten_exit_with_live_runtime=()=>{runtimeKeepalivePush();throw"unwind"};var jsStackTrace=()=>(new Error).stack.toString();var getCallstack=flags=>{var callstack=jsStackTrace();var lines=callstack.split("\n");callstack="";var firefoxRe=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)");var chromeRe=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var line of lines){var symbolName="";var file="";var lineno=0;var column=0;var parts=chromeRe.exec(line);if(parts?.length==5){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]}else{parts=firefoxRe.exec(line);if(parts?.length>=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+"\n";continue}}if(symbolName=="_emscripten_log"||symbolName=="_emscripten_get_callstack"){callstack="";continue}if(flags&24){if(flags&64){file=file.substring(file.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=` at ${symbolName} (${file}:${lineno}:${column})\n`}}callstack=callstack.replace(/\s+$/,"");return callstack};function _emscripten_get_callstack(flags,str,maxbytes){str>>>=0;var callstack=getCallstack(flags);if(!str||maxbytes<=0){return lengthBytesUTF8(callstack)+1}var bytesWrittenExcludingNull=stringToUTF8(callstack,str,maxbytes);return bytesWrittenExcludingNull+1}var getHeapMax=()=>4294901760;function _emscripten_get_heap_max(){return getHeapMax()}var _emscripten_num_logical_cores=()=>ENVIRONMENT_IS_NODE?require("node:os").cpus().length:navigator["hardwareConcurrency"];function _emscripten_out(str){str>>>=0;return out(UTF8ToString(str))}var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};function _emscripten_resize_heap(requestedSize){requestedSize>>>=0;var oldSize=(growMemViews(),HEAPU8).length;if(requestedSize<=oldSize){return false}var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false}var _emscripten_runtime_keepalive_check=keepRuntimeAlive;var _emscripten_unwind_to_js_event_loop=()=>{throw"unwind"};var ENV={};var getExecutableName=()=>thisProgram;var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};function _environ_get(__environ,environ_buf){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(3,0,1,__environ,environ_buf);__environ>>>=0;environ_buf>>>=0;var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;(growMemViews(),HEAPU32)[__environ+envp>>>2>>>0]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4}return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(4,0,1,penviron_count,penviron_buf_size);penviron_count>>>=0;penviron_buf_size>>>=0;var strings=getEnvStrings();(growMemViews(),HEAPU32)[penviron_count>>>2>>>0]=strings.length;var bufSize=0;for(var string of strings){bufSize+=lengthBytesUTF8(string)+1}(growMemViews(),HEAPU32)[penviron_buf_size>>>2>>>0]=bufSize;return 0}var initRandomFill=()=>{if(ENVIRONMENT_IS_NODE){var nodeCrypto=require("node:crypto");return view=>(nodeCrypto.randomFillSync(view),0)}return view=>(view.set(crypto.getRandomValues(new Uint8Array(view.byteLength))),0)};var randomFill=view=>(randomFill=initRandomFill())(view);function _random_get(buffer,size){buffer>>>=0;size>>>=0;return randomFill((growMemViews(),HEAPU8).subarray(buffer>>>0,buffer+size>>>0))}var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{(growMemViews(),HEAP8).set(array,buffer>>>0)};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="pointer")return ret>>>0;if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(!stack)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};var HEAP16;var HEAPF32;function getValue(ptr,type="i8"){if(type.endsWith("*"))type="*";switch(type){case"i1":return(growMemViews(),HEAP8)[ptr>>>0];case"i8":return(growMemViews(),HEAP8)[ptr>>>0];case"i16":return(growMemViews(),HEAP16)[ptr>>>1>>>0];case"i32":return(growMemViews(),HEAP32)[ptr>>>2>>>0];case"i64":return(growMemViews(),HEAP64)[ptr>>>3>>>0];case"float":return(growMemViews(),HEAPF32)[ptr>>>2>>>0];case"double":return(growMemViews(),HEAPF64)[ptr>>>3>>>0];case"*":return(growMemViews(),HEAPU32)[ptr>>>2>>>0];default:abort(`invalid type for getValue: ${type}`)}}PThread.init();{initMemory();if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["arguments"])programArgs=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var preInit=Module["preInit"];if(preInit){if(typeof preInit=="function")Module["preInit"]=preInit=[preInit];while(preInit.length>0){preInit.shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["getValue"]=getValue;Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["lengthBytesUTF8"]=lengthBytesUTF8;var proxiedFunctionTable=[_proc_exit,exitOnMainThread,pthreadCreateProxied,_environ_get,_environ_sizes_get];var _main,_lucivy_add,_lucivy_add_many,_lucivy_apply_sharded_delta,_lucivy_close,_lucivy_commit,_lucivy_commit_async,_lucivy_commit_finish,_lucivy_commit_status_ptr,_lucivy_compact_async,_lucivy_configure,_lucivy_create,_lucivy_destroy,_lucivy_drain_merges,_lucivy_dump_mermaid,_lucivy_dump_state,_lucivy_dump_wait_graph,_lucivy_dump_wait_graph_text,_lucivy_export_sharded_delta,_lucivy_export_snapshot,_lucivy_export_stats,_lucivy_import_file,_lucivy_import_snapshot,_lucivy_log_ring_ptr,_lucivy_log_ring_size,_lucivy_memory_status,_lucivy_merge_stats,_lucivy_num_docs,_lucivy_open,_lucivy_open_begin,_lucivy_open_finish,_lucivy_preload,_lucivy_query_warnings,_lucivy_read_logs,_lucivy_remove,_lucivy_schema_json,_lucivy_search,_lucivy_search_filtered,_lucivy_search_with_global_stats,_lucivy_shard_versions,_lucivy_test_condvar,_lucivy_test_coop,_lucivy_test_fs_task,_lucivy_update,_emscripten_builtin_free,__emscripten_tls_init,_pthread_self,_free,_malloc,_realloc,_calloc,__emscripten_proxy_main,_emscripten_builtin_malloc,___libc_free,___libc_malloc,__emscripten_thread_init,___set_thread_state,__emscripten_thread_crashed,_htonl,_htons,_emscripten_proxy_execute_queue,_ntohs,_emscripten_proxy_finish,__emscripten_run_js_on_main_thread_done,__emscripten_run_js_on_main_thread,__emscripten_thread_free_data,__emscripten_thread_exit,_strndup,__emscripten_check_mailbox,__ZdaPv,__ZdaPvm,__ZdlPv,__ZdlPvm,__Znam,__ZnamSt11align_val_t,__Znwm,__ZnwmSt11align_val_t,___libc_calloc,___libc_realloc,_emscripten_builtin_calloc,_emscripten_builtin_realloc,_malloc_size,_malloc_usable_size,_reallocf,_setThrew,__emscripten_tempret_set,_emscripten_stack_set_limits,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,__wasmfs_opfs_record_entry,__indirect_function_table,wasmTable;function assignWasmExports(wasmExports){_main=Module["_main"]=wasmExports["__main_argc_argv"];_lucivy_add=Module["_lucivy_add"]=wasmExports["lucivy_add"];_lucivy_add_many=Module["_lucivy_add_many"]=wasmExports["lucivy_add_many"];_lucivy_apply_sharded_delta=Module["_lucivy_apply_sharded_delta"]=wasmExports["lucivy_apply_sharded_delta"];_lucivy_close=Module["_lucivy_close"]=wasmExports["lucivy_close"];_lucivy_commit=Module["_lucivy_commit"]=wasmExports["lucivy_commit"];_lucivy_commit_async=Module["_lucivy_commit_async"]=wasmExports["lucivy_commit_async"];_lucivy_commit_finish=Module["_lucivy_commit_finish"]=wasmExports["lucivy_commit_finish"];_lucivy_commit_status_ptr=Module["_lucivy_commit_status_ptr"]=wasmExports["lucivy_commit_status_ptr"];_lucivy_compact_async=Module["_lucivy_compact_async"]=wasmExports["lucivy_compact_async"];_lucivy_configure=Module["_lucivy_configure"]=wasmExports["lucivy_configure"];_lucivy_create=Module["_lucivy_create"]=wasmExports["lucivy_create"];_lucivy_destroy=Module["_lucivy_destroy"]=wasmExports["lucivy_destroy"];_lucivy_drain_merges=Module["_lucivy_drain_merges"]=wasmExports["lucivy_drain_merges"];_lucivy_dump_mermaid=Module["_lucivy_dump_mermaid"]=wasmExports["lucivy_dump_mermaid"];_lucivy_dump_state=Module["_lucivy_dump_state"]=wasmExports["lucivy_dump_state"];_lucivy_dump_wait_graph=Module["_lucivy_dump_wait_graph"]=wasmExports["lucivy_dump_wait_graph"];_lucivy_dump_wait_graph_text=Module["_lucivy_dump_wait_graph_text"]=wasmExports["lucivy_dump_wait_graph_text"];_lucivy_export_sharded_delta=Module["_lucivy_export_sharded_delta"]=wasmExports["lucivy_export_sharded_delta"];_lucivy_export_snapshot=Module["_lucivy_export_snapshot"]=wasmExports["lucivy_export_snapshot"];_lucivy_export_stats=Module["_lucivy_export_stats"]=wasmExports["lucivy_export_stats"];_lucivy_import_file=Module["_lucivy_import_file"]=wasmExports["lucivy_import_file"];_lucivy_import_snapshot=Module["_lucivy_import_snapshot"]=wasmExports["lucivy_import_snapshot"];_lucivy_log_ring_ptr=Module["_lucivy_log_ring_ptr"]=wasmExports["lucivy_log_ring_ptr"];_lucivy_log_ring_size=Module["_lucivy_log_ring_size"]=wasmExports["lucivy_log_ring_size"];_lucivy_memory_status=Module["_lucivy_memory_status"]=wasmExports["lucivy_memory_status"];_lucivy_merge_stats=Module["_lucivy_merge_stats"]=wasmExports["lucivy_merge_stats"];_lucivy_num_docs=Module["_lucivy_num_docs"]=wasmExports["lucivy_num_docs"];_lucivy_open=Module["_lucivy_open"]=wasmExports["lucivy_open"];_lucivy_open_begin=Module["_lucivy_open_begin"]=wasmExports["lucivy_open_begin"];_lucivy_open_finish=Module["_lucivy_open_finish"]=wasmExports["lucivy_open_finish"];_lucivy_preload=Module["_lucivy_preload"]=wasmExports["lucivy_preload"];_lucivy_query_warnings=Module["_lucivy_query_warnings"]=wasmExports["lucivy_query_warnings"];_lucivy_read_logs=Module["_lucivy_read_logs"]=wasmExports["lucivy_read_logs"];_lucivy_remove=Module["_lucivy_remove"]=wasmExports["lucivy_remove"];_lucivy_schema_json=Module["_lucivy_schema_json"]=wasmExports["lucivy_schema_json"];_lucivy_search=Module["_lucivy_search"]=wasmExports["lucivy_search"];_lucivy_search_filtered=Module["_lucivy_search_filtered"]=wasmExports["lucivy_search_filtered"];_lucivy_search_with_global_stats=Module["_lucivy_search_with_global_stats"]=wasmExports["lucivy_search_with_global_stats"];_lucivy_shard_versions=Module["_lucivy_shard_versions"]=wasmExports["lucivy_shard_versions"];_lucivy_test_condvar=Module["_lucivy_test_condvar"]=wasmExports["lucivy_test_condvar"];_lucivy_test_coop=Module["_lucivy_test_coop"]=wasmExports["lucivy_test_coop"];_lucivy_test_fs_task=Module["_lucivy_test_fs_task"]=wasmExports["lucivy_test_fs_task"];_lucivy_update=Module["_lucivy_update"]=wasmExports["lucivy_update"];_emscripten_builtin_free=Module["_emscripten_builtin_free"]=wasmExports["emscripten_builtin_free"];__emscripten_tls_init=wasmExports["_emscripten_tls_init"];_pthread_self=wasmExports["pthread_self"];_free=Module["_free"]=wasmExports["free"];_malloc=Module["_malloc"]=wasmExports["malloc"];_realloc=wasmExports["realloc"];_calloc=wasmExports["calloc"];__emscripten_proxy_main=Module["__emscripten_proxy_main"]=wasmExports["_emscripten_proxy_main"];_emscripten_builtin_malloc=Module["_emscripten_builtin_malloc"]=wasmExports["emscripten_builtin_malloc"];___libc_free=Module["___libc_free"]=wasmExports["__libc_free"];___libc_malloc=Module["___libc_malloc"]=wasmExports["__libc_malloc"];__emscripten_thread_init=wasmExports["_emscripten_thread_init"];___set_thread_state=wasmExports["__set_thread_state"];__emscripten_thread_crashed=wasmExports["_emscripten_thread_crashed"];_htonl=wasmExports["htonl"];_htons=wasmExports["htons"];_emscripten_proxy_execute_queue=wasmExports["emscripten_proxy_execute_queue"];_ntohs=wasmExports["ntohs"];_emscripten_proxy_finish=wasmExports["emscripten_proxy_finish"];__emscripten_run_js_on_main_thread_done=wasmExports["_emscripten_run_js_on_main_thread_done"];__emscripten_run_js_on_main_thread=wasmExports["_emscripten_run_js_on_main_thread"];__emscripten_thread_free_data=wasmExports["_emscripten_thread_free_data"];__emscripten_thread_exit=wasmExports["_emscripten_thread_exit"];_strndup=Module["_strndup"]=wasmExports["strndup"];__emscripten_check_mailbox=wasmExports["_emscripten_check_mailbox"];__ZdaPv=Module["__ZdaPv"]=wasmExports["_ZdaPv"];__ZdaPvm=Module["__ZdaPvm"]=wasmExports["_ZdaPvm"];__ZdlPv=Module["__ZdlPv"]=wasmExports["_ZdlPv"];__ZdlPvm=Module["__ZdlPvm"]=wasmExports["_ZdlPvm"];__Znam=Module["__Znam"]=wasmExports["_Znam"];__ZnamSt11align_val_t=Module["__ZnamSt11align_val_t"]=wasmExports["_ZnamSt11align_val_t"];__Znwm=Module["__Znwm"]=wasmExports["_Znwm"];__ZnwmSt11align_val_t=Module["__ZnwmSt11align_val_t"]=wasmExports["_ZnwmSt11align_val_t"];___libc_calloc=Module["___libc_calloc"]=wasmExports["__libc_calloc"];___libc_realloc=Module["___libc_realloc"]=wasmExports["__libc_realloc"];_emscripten_builtin_calloc=Module["_emscripten_builtin_calloc"]=wasmExports["emscripten_builtin_calloc"];_emscripten_builtin_realloc=Module["_emscripten_builtin_realloc"]=wasmExports["emscripten_builtin_realloc"];_malloc_size=Module["_malloc_size"]=wasmExports["malloc_size"];_malloc_usable_size=Module["_malloc_usable_size"]=wasmExports["malloc_usable_size"];_reallocf=Module["_reallocf"]=wasmExports["reallocf"];_setThrew=wasmExports["setThrew"];__emscripten_tempret_set=wasmExports["_emscripten_tempret_set"];_emscripten_stack_set_limits=wasmExports["emscripten_stack_set_limits"];__emscripten_stack_restore=wasmExports["_emscripten_stack_restore"];__emscripten_stack_alloc=wasmExports["_emscripten_stack_alloc"];_emscripten_stack_get_current=wasmExports["emscripten_stack_get_current"];___cxa_increment_exception_refcount=wasmExports["__cxa_increment_exception_refcount"];___cxa_can_catch=wasmExports["__cxa_can_catch"];___cxa_get_exception_ptr=wasmExports["__cxa_get_exception_ptr"];__wasmfs_opfs_record_entry=wasmExports["_wasmfs_opfs_record_entry"];__indirect_function_table=wasmTable=wasmExports["__indirect_function_table"]}var wasmImports;function assignWasmImports(){wasmImports={__call_sighandler:___call_sighandler,__cxa_begin_catch:___cxa_begin_catch,__cxa_find_matching_catch_2:___cxa_find_matching_catch_2,__cxa_find_matching_catch_3:___cxa_find_matching_catch_3,__cxa_throw:___cxa_throw,__pthread_create_js:___pthread_create_js,__resumeException:___resumeException,_abort_js:__abort_js,_emscripten_init_main_thread_js:__emscripten_init_main_thread_js,_emscripten_notify_mailbox_postmessage:__emscripten_notify_mailbox_postmessage,_emscripten_receive_on_main_thread_js:__emscripten_receive_on_main_thread_js,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_emscripten_thread_cleanup:__emscripten_thread_cleanup,_emscripten_thread_mailbox_await:__emscripten_thread_mailbox_await,_emscripten_thread_set_strongref:__emscripten_thread_set_strongref,_wasmfs_copy_preloaded_file_data:__wasmfs_copy_preloaded_file_data,_wasmfs_get_num_preloaded_dirs:__wasmfs_get_num_preloaded_dirs,_wasmfs_get_num_preloaded_files:__wasmfs_get_num_preloaded_files,_wasmfs_get_preloaded_child_path:__wasmfs_get_preloaded_child_path,_wasmfs_get_preloaded_file_mode:__wasmfs_get_preloaded_file_mode,_wasmfs_get_preloaded_file_size:__wasmfs_get_preloaded_file_size,_wasmfs_get_preloaded_parent_path:__wasmfs_get_preloaded_parent_path,_wasmfs_get_preloaded_path_name:__wasmfs_get_preloaded_path_name,_wasmfs_opfs_close_access:__wasmfs_opfs_close_access,_wasmfs_opfs_close_blob:__wasmfs_opfs_close_blob,_wasmfs_opfs_flush_access:__wasmfs_opfs_flush_access,_wasmfs_opfs_free_directory:__wasmfs_opfs_free_directory,_wasmfs_opfs_free_file:__wasmfs_opfs_free_file,_wasmfs_opfs_get_child:__wasmfs_opfs_get_child,_wasmfs_opfs_get_entries:__wasmfs_opfs_get_entries,_wasmfs_opfs_get_size_access:__wasmfs_opfs_get_size_access,_wasmfs_opfs_get_size_blob:__wasmfs_opfs_get_size_blob,_wasmfs_opfs_get_size_file:__wasmfs_opfs_get_size_file,_wasmfs_opfs_init_root_directory:__wasmfs_opfs_init_root_directory,_wasmfs_opfs_insert_directory:__wasmfs_opfs_insert_directory,_wasmfs_opfs_insert_file:__wasmfs_opfs_insert_file,_wasmfs_opfs_move_file:__wasmfs_opfs_move_file,_wasmfs_opfs_open_access:__wasmfs_opfs_open_access,_wasmfs_opfs_open_blob:__wasmfs_opfs_open_blob,_wasmfs_opfs_read_access:__wasmfs_opfs_read_access,_wasmfs_opfs_read_blob:__wasmfs_opfs_read_blob,_wasmfs_opfs_remove_child:__wasmfs_opfs_remove_child,_wasmfs_opfs_set_size_access:__wasmfs_opfs_set_size_access,_wasmfs_opfs_set_size_file:__wasmfs_opfs_set_size_file,_wasmfs_opfs_write_access:__wasmfs_opfs_write_access,_wasmfs_stdin_get_char:__wasmfs_stdin_get_char,_wasmfs_thread_utils_heartbeat:__wasmfs_thread_utils_heartbeat,clock_time_get:_clock_time_get,emscripten_check_blocking_allowed:_emscripten_check_blocking_allowed,emscripten_date_now:_emscripten_date_now,emscripten_err:_emscripten_err,emscripten_exit_with_live_runtime:_emscripten_exit_with_live_runtime,emscripten_get_callstack:_emscripten_get_callstack,emscripten_get_heap_max:_emscripten_get_heap_max,emscripten_get_now:_emscripten_get_now,emscripten_num_logical_cores:_emscripten_num_logical_cores,emscripten_out:_emscripten_out,emscripten_resize_heap:_emscripten_resize_heap,emscripten_runtime_keepalive_check:_emscripten_runtime_keepalive_check,emscripten_unwind_to_js_event_loop:_emscripten_unwind_to_js_event_loop,environ_get:_environ_get,environ_sizes_get:_environ_sizes_get,exit:_exit,invoke_ii,invoke_iii,invoke_iiii,invoke_v,invoke_vi,invoke_vii,invoke_viii,memory:wasmMemory,proc_exit:_proc_exit,random_get:_random_get}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function applySignatureConversions(wasmExports){wasmExports=Object.assign({},wasmExports);var makeWrapper_p=f=>()=>f()>>>0;var makeWrapper_pp=f=>a0=>f(a0)>>>0;var makeWrapper_ppp=f=>(a0,a1)=>f(a0,a1)>>>0;wasmExports["_emscripten_tls_init"]=makeWrapper_p(wasmExports["_emscripten_tls_init"]);wasmExports["pthread_self"]=makeWrapper_p(wasmExports["pthread_self"]);wasmExports["malloc"]=makeWrapper_pp(wasmExports["malloc"]);wasmExports["realloc"]=makeWrapper_ppp(wasmExports["realloc"]);wasmExports["calloc"]=makeWrapper_ppp(wasmExports["calloc"]);wasmExports["emscripten_builtin_malloc"]=makeWrapper_pp(wasmExports["emscripten_builtin_malloc"]);wasmExports["__libc_malloc"]=makeWrapper_pp(wasmExports["__libc_malloc"]);wasmExports["strndup"]=makeWrapper_ppp(wasmExports["strndup"]);wasmExports["__libc_calloc"]=makeWrapper_ppp(wasmExports["__libc_calloc"]);wasmExports["__libc_realloc"]=makeWrapper_ppp(wasmExports["__libc_realloc"]);wasmExports["emscripten_builtin_calloc"]=makeWrapper_ppp(wasmExports["emscripten_builtin_calloc"]);wasmExports["emscripten_builtin_realloc"]=makeWrapper_ppp(wasmExports["emscripten_builtin_realloc"]);wasmExports["malloc_usable_size"]=makeWrapper_pp(wasmExports["malloc_usable_size"]);wasmExports["_emscripten_stack_alloc"]=makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]);wasmExports["emscripten_stack_get_current"]=makeWrapper_p(wasmExports["emscripten_stack_get_current"]);wasmExports["__cxa_get_exception_ptr"]=makeWrapper_pp(wasmExports["__cxa_get_exception_ptr"]);return wasmExports}function callMain(args=[]){var entryFunction=__emscripten_proxy_main;runtimeKeepalivePush();args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;for(var arg of args){(growMemViews(),HEAPU32)[argv_ptr>>>2>>>0]=stringToUTF8OnStack(arg);argv_ptr+=4}(growMemViews(),HEAPU32)[argv_ptr>>>2>>>0]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}async function run(args=programArgs){if(ENVIRONMENT_IS_PTHREAD){initRuntime();return}preRun();if(runDependencies){await resolveRunDependencies()}var setStatus=Module["setStatus"];if(setStatus){setStatus("Running...");await new Promise(resolve=>setTimeout(resolve,1));setTimeout(setStatus,1,"")}if(ABORT)return;initRuntime();Module["onRuntimeInitialized"]?.();var noInitialRun=Module["noInitialRun"]||false;if(!noInitialRun)callMain(args);postRun()}var wasmExports;if(!ENVIRONMENT_IS_PTHREAD){wasmExports=await createWasm();await run()}
|
|
1
|
+
async function createLucivy(moduleArg={}){var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";var ENVIRONMENT_IS_PTHREAD=ENVIRONMENT_IS_WORKER&&globalThis.name=="em-pthread";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url);var worker_threads=require("node:worker_threads");globalThis.Worker=worker_threads.Worker;ENVIRONMENT_IS_WORKER=!worker_threads.isMainThread;ENVIRONMENT_IS_PTHREAD=ENVIRONMENT_IS_WORKER&&worker_threads.workerData=="em-pthread"}var programArgs=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}programArgs=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}if(!ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var defaultPrint=console.log.bind(console);var defaultPrintErr=console.error.bind(console);if(ENVIRONMENT_IS_NODE){var utils=require("node:util");var stringify=a=>typeof a=="object"?utils.inspect(a):a;defaultPrint=(...args)=>fs.writeSync(1,args.map(stringify).join(" ")+"\n");defaultPrintErr=(...args)=>fs.writeSync(2,args.map(stringify).join(" ")+"\n")}var out=defaultPrint;var err=defaultPrintErr;var wasmBinary;var wasmModule;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");class EmscriptenEH{}class EmscriptenSjLj extends EmscriptenEH{}class CppException extends EmscriptenEH{constructor(excPtr){super();this.excPtr=excPtr}}function growMemViews(){if(wasmMemory.buffer!=HEAP8.buffer){updateMemoryViews()}}if(ENVIRONMENT_IS_NODE&&ENVIRONMENT_IS_PTHREAD){globalThis.self=globalThis;var parentPort=worker_threads.parentPort;if(!globalThis.postMessage){parentPort.on("message",msg=>globalThis.onmessage?.({data:msg}));globalThis.postMessage=msg=>parentPort.postMessage(msg)}process.on("uncaughtException",err=>{postMessage({cmd:8,error:err});process.exit(1)})}var startWorker;if(ENVIRONMENT_IS_PTHREAD){var initializedJS=false;self.onunhandledrejection=e=>{throw e.reason||e};function handleMessage(e){try{var msgData=e.data;var cmd=msgData.cmd;if(cmd==1){let messageQueue=[];self.onmessage=e=>messageQueue.push(e);startWorker=()=>{postMessage({cmd:3});for(let msg of messageQueue){handleMessage(msg)}self.onmessage=handleMessage};for(const handler of msgData.handlers){if(!Module[handler]||Module[handler].proxy){Module[handler]=(...args)=>{postMessage({cmd:9,handler,args})};if(handler=="print")out=Module[handler];if(handler=="printErr")err=Module[handler]}}wasmMemory=msgData.wasmMemory;updateMemoryViews();wasmModule=msgData.wasmModule;createWasm();run();startWorker()}else if(cmd==2){establishStackSpace(msgData.pthread_ptr);__emscripten_thread_init(msgData.pthread_ptr,0,0,1,0,0);PThread.threadInitTLS();__emscripten_thread_mailbox_await(msgData.pthread_ptr);if(!initializedJS){initializedJS=true}try{invokeEntryPoint(msgData.start_routine,msgData.arg)}catch(ex){if(ex!="unwind"){throw ex}}}else if(cmd==4){if(initializedJS){checkMailbox()}}else if(cmd){err(`worker: received unknown command ${cmd}`);err(msgData)}}catch(ex){if(runtimeInitialized)__emscripten_thread_crashed();throw ex}}self.onmessage=handleMessage}var runtimeInitialized=false;function getMemoryBuffer(){return wasmMemory.buffer}function updateMemoryViews(){if(HEAP8?.buffer?.growable)return;var b=getMemoryBuffer();HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b)}function initMemory(){if(ENVIRONMENT_IS_PTHREAD){return}{var INITIAL_MEMORY=16777216;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:65536,shared:true})}updateMemoryViews()}function preRun(){var preRun=Module["preRun"];if(preRun){if(typeof preRun=="function")preRun=[preRun];onPreRuns.push(...preRun)}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_PTHREAD)return;wasmExports["__wasm_call_ctors"]()}function postRun(){var postRun=Module["postRun"];if(postRun){if(typeof postRun=="function")postRun=[postRun];onPostRuns.push(...postRun)}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("lucivy.wasm")}return new URL("lucivy.wasm",import.meta.url).href}function getBinarySync(file){if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){assignWasmImports();var imports={env:wasmImports,wasi_snapshot_preview1:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=applySignatureConversions(wasmExports);registerTLSInit(wasmExports["_emscripten_tls_init"]);assignWasmExports(wasmExports);wasmModule=module;return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"],result["module"])}var info=getWasmImports();var instantiateWasm=Module["instantiateWasm"];if(instantiateWasm){return new Promise(resolve=>{instantiateWasm(info,(inst,mod)=>resolve(receiveInstance(inst,mod)))})}if(ENVIRONMENT_IS_PTHREAD){var instance=new WebAssembly.Instance(wasmModule,getWasmImports());return receiveInstance(instance,wasmModule)}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP8;var terminateWorker=worker=>{worker.terminate();worker.onmessage=e=>{}};var cleanupThread=pthread_ptr=>{var worker=PThread.pthreads[pthread_ptr];PThread.returnWorkerToPool(worker)};var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var dependenciesPromise=null;var resolveRunDependencies=async()=>dependenciesPromise;var runDependencies=0;var dependenciesPromiseResolve=null;var removeRunDependency=id=>{runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(!runDependencies){dependenciesPromiseResolve()}};var addRunDependency=id=>{if(!runDependencies){dependenciesPromise=new Promise(resolve=>dependenciesPromiseResolve=resolve)}runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)};var spawnThread=threadParams=>{var worker=PThread.getNewWorker();if(!worker){return 6}PThread.pthreads[threadParams.pthread_ptr]=worker;worker.pthread_ptr=threadParams.pthread_ptr;var msg={cmd:2,start_routine:threadParams.startRoutine,arg:threadParams.arg,pthread_ptr:threadParams.pthread_ptr};worker.postMessage(msg,threadParams.transferList);return 0};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var stackSave=()=>_emscripten_stack_get_current();var stackRestore=val=>__emscripten_stack_restore(val);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var HEAPF64;var HEAP64;var proxyToMainThread=(funcIndex,emAsmAddr,proxyMode,...callArgs)=>{var bufSize=8*callArgs.length*2;var sp=stackSave();var args=stackAlloc(bufSize);var b=args>>>3;for(var arg of callArgs){if(typeof arg=="bigint"){(growMemViews(),HEAP64)[b++>>>0]=1n;(growMemViews(),HEAP64)[b++>>>0]=arg}else{(growMemViews(),HEAP64)[b++>>>0]=0n;(growMemViews(),HEAPF64)[b++>>>0]=arg}}var rtn=__emscripten_run_js_on_main_thread(funcIndex,emAsmAddr,bufSize,args,proxyMode);stackRestore(sp);return rtn};function _proc_exit(code){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(0,0,1,code);EXITSTATUS=code;if(!keepRuntimeAlive()){PThread.terminateAllThreads();Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))}var runtimeKeepalivePop=()=>{runtimeKeepaliveCounter-=1};function exitOnMainThread(returnCode){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(1,0,0,returnCode);runtimeKeepalivePop();_exit(returnCode)}var exitJS=(status,implicit)=>{EXITSTATUS=status;if(ENVIRONMENT_IS_PTHREAD){exitOnMainThread(status);throw"unwind"}_proc_exit(status)};var _exit=exitJS;var waitAsyncPolyfilled=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2])<91;var HEAP32;var PThread={unusedWorkers:[],tlsInitFunctions:[],pthreads:{},init(){if(!ENVIRONMENT_IS_PTHREAD){PThread.initMainThread()}},initMainThread(){var pthreadPoolSize=Math.min(navigator.hardwareConcurrency||4,16);while(pthreadPoolSize--){PThread.allocateUnusedWorker()}addOnPreRun(async()=>{var pthreadPoolReady=PThread.loadWasmModuleToAllWorkers();addRunDependency("loading-workers");await pthreadPoolReady;removeRunDependency("loading-workers")})},terminateAllThreads:()=>{for(var worker of Object.values(PThread.pthreads)){terminateWorker(worker)}for(var worker of PThread.unusedWorkers){terminateWorker(worker)}PThread.unusedWorkers=[];PThread.pthreads={}},clearMailboxAwait:pthread_ptr=>{if(!waitAsyncPolyfilled){Atomics.notify((growMemViews(),HEAP32),pthread_ptr>>>2)}},terminateRuntime:()=>{PThread.terminateAllThreads();var pthread_ptr=_pthread_self();___set_thread_state(0,0,0,1);PThread.clearMailboxAwait(pthread_ptr)},returnWorkerToPool:worker=>{var pthread_ptr=worker.pthread_ptr;delete PThread.pthreads[pthread_ptr];PThread.unusedWorkers.push(worker);worker.pthread_ptr=0;if(ENVIRONMENT_IS_NODE){worker.unref()}PThread.clearMailboxAwait(pthread_ptr);__emscripten_thread_free_data(pthread_ptr)},threadInitTLS(){PThread.tlsInitFunctions.forEach(f=>f())},loadWasmModuleToWorker:worker=>new Promise(onFinishedLoading=>{worker.onmessage=e=>{var d=e.data;var cmd=d.cmd;if(d.targetThread&&d.targetThread!=_pthread_self()){var targetWorker=PThread.pthreads[d.targetThread];targetWorker?.postMessage(d);return}if(d==="setimmediate"||d==="_si"){worker.postMessage(d);return}switch(cmd){case 4:checkMailbox();break;case 5:spawnThread(d);break;case 6:callUserCallback(()=>cleanupThread(d.thread));break;case 3:if(ENVIRONMENT_IS_NODE&&!worker.strongref){worker.unref()}onFinishedLoading(worker);break;case 8:worker.onerror(d.error);break;case 9:Module[d.handler](...d.args);break;default:if(cmd)err(`worker sent an unknown command ${cmd}`)}};worker.onerror=e=>{var message="worker sent an error!";err(`${message} ${e.filename}:${e.lineno}: ${e.message}`);throw e};if(ENVIRONMENT_IS_NODE){worker.on("message",data=>worker.onmessage({data}));worker.on("error",e=>worker.onerror(e))}var handlers=[];var knownHandlers=["onExit","onAbort","print","printErr"];for(var handler of knownHandlers){if(Module.propertyIsEnumerable(handler)){handlers.push(handler)}}worker.postMessage({cmd:1,handlers,wasmMemory,wasmModule})}),async loadWasmModuleToAllWorkers(){if(ENVIRONMENT_IS_PTHREAD){return}let pthreadPoolReady=Promise.all(PThread.unusedWorkers.map(PThread.loadWasmModuleToWorker));return pthreadPoolReady},allocateUnusedWorker(){var worker;worker=new Worker(new URL("lucivy.js",import.meta.url),{type:"module",workerData:"em-pthread",trackUnmanagedFds:false,name:"em-pthread"});PThread.unusedWorkers.push(worker);return worker},getNewWorker(){if(PThread.unusedWorkers.length==0){var newWorker=PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(newWorker)}return PThread.unusedWorkers.pop()}};var onPostRuns=[];var HEAPU32;function establishStackSpace(pthread_ptr){var stackHigh=(growMemViews(),HEAPU32)[pthread_ptr+48>>>2>>>0];var stackSize=(growMemViews(),HEAPU32)[pthread_ptr+52>>>2>>>0];var stackLow=stackHigh-stackSize;_emscripten_stack_set_limits(stackHigh,stackLow);stackRestore(stackHigh)}var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var invokeEntryPoint=(ptr,arg)=>{runtimeKeepaliveCounter=0;noExitRuntime=0;var result=getWasmTableEntry(ptr)(arg);function finish(result){if(keepRuntimeAlive()){EXITSTATUS=result;return}__emscripten_thread_exit(result)}finish(result)};var noExitRuntime=true;var registerTLSInit=tlsInitFunc=>PThread.tlsInitFunctions.push(tlsInitFunc);var runtimeKeepalivePush=()=>{runtimeKeepaliveCounter+=1};var wasmMemory;var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function ___call_sighandler(fp,sig){fp>>>=0;return getWasmTableEntry(fp)(sig)}var exceptionCaught=[];var uncaughtExceptionCount=0;function ___cxa_begin_catch(ptr){ptr>>>=0;var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);return ___cxa_get_exception_ptr(ptr)}var exceptionLast=null;class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){(growMemViews(),HEAPU32)[this.ptr+4>>>2>>>0]=type}get_type(){return(growMemViews(),HEAPU32)[this.ptr+4>>>2>>>0]}set_destructor(destructor){(growMemViews(),HEAPU32)[this.ptr+8>>>2>>>0]=destructor}get_destructor(){return(growMemViews(),HEAPU32)[this.ptr+8>>>2>>>0]}set_caught(caught){caught=caught?1:0;(growMemViews(),HEAP8)[this.ptr+12>>>0]=caught}get_caught(){return(growMemViews(),HEAP8)[this.ptr+12>>>0]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;(growMemViews(),HEAP8)[this.ptr+13>>>0]=rethrown}get_rethrown(){return(growMemViews(),HEAP8)[this.ptr+13>>>0]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){(growMemViews(),HEAPU32)[this.ptr+16>>>2>>>0]=adjustedPtr}get_adjusted_ptr(){return(growMemViews(),HEAPU32)[this.ptr+16>>>2>>>0]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast?.excPtr;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(!caughtType||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};function ___cxa_find_matching_catch_2(){return findMatchingCatch([])}function ___cxa_find_matching_catch_3(arg0){arg0>>>=0;return findMatchingCatch([arg0])}var __Unwind_RaiseException=ex=>{throw ex};function ___cxa_throw(ptr,type,destructor){ptr>>>=0;type>>>=0;destructor>>>=0;var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);ptr=exceptionLast=new CppException(ptr);uncaughtExceptionCount++;__Unwind_RaiseException(ptr)}function pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(2,0,1,pthread_ptr,attr,startRoutine,arg);return ___pthread_create_js(pthread_ptr,attr,startRoutine,arg)}var _emscripten_has_threading_support=()=>!!globalThis.SharedArrayBuffer;function ___pthread_create_js(pthread_ptr,attr,startRoutine,arg){pthread_ptr>>>=0;attr>>>=0;startRoutine>>>=0;arg>>>=0;if(!_emscripten_has_threading_support()){return 6}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(!transferList.length||error)){return pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg)}if(error)return error;var threadParams={startRoutine,pthread_ptr,arg,transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd=5;postMessage(threadParams,transferList);return 0}return spawnThread(threadParams)}var __Unwind_Resume=ex=>{throw ex};function ___resumeException(ptr){ptr>>>=0;ptr=exceptionLast??=new CppException(ptr);__Unwind_Resume(ptr)}var __abort_js=()=>abort("");function __emscripten_init_main_thread_js(tb){tb>>>=0;var can_block=!ENVIRONMENT_IS_WEB;try{Atomics.wait((growMemViews(),HEAP32),0,0,0);can_block=true}catch(e){}__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1,can_block,2097152,false);PThread.threadInitTLS()}var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var maybeExit=()=>{if(!keepRuntimeAlive()){try{if(ENVIRONMENT_IS_PTHREAD){if(_pthread_self())__emscripten_thread_exit(EXITSTATUS);return}_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};function __emscripten_thread_mailbox_await(pthread_ptr){pthread_ptr>>>=0;if(!waitAsyncPolyfilled){var wait=Atomics.waitAsync((growMemViews(),HEAP32),pthread_ptr>>>2,pthread_ptr);wait.value.then(checkMailbox);var waitingAsync=pthread_ptr+112;Atomics.store((growMemViews(),HEAP32),waitingAsync>>>2,1)}}var checkMailbox=()=>{var pthread_ptr=_pthread_self();if(!pthread_ptr)return;callUserCallback(()=>{__emscripten_thread_mailbox_await(pthread_ptr);__emscripten_check_mailbox()})};function __emscripten_notify_mailbox_postmessage(targetThread,currThreadId){targetThread>>>=0;currThreadId>>>=0;if(targetThread==currThreadId){setTimeout(checkMailbox)}else if(ENVIRONMENT_IS_PTHREAD){postMessage({targetThread,cmd:4})}else{var worker=PThread.pthreads[targetThread];if(!worker){return}worker.postMessage({cmd:4})}}var proxiedJSCallArgs=[];function __emscripten_receive_on_main_thread_js(funcIndex,emAsmAddr,callingThread,bufSize,args,ctx,ctxArgs){emAsmAddr>>>=0;callingThread>>>=0;args>>>=0;ctx>>>=0;ctxArgs>>>=0;proxiedJSCallArgs.length=0;var b=args>>>3;var end=args+bufSize>>>3;while(b<end){var arg;if((growMemViews(),HEAP64)[b++>>>0]){arg=(growMemViews(),HEAP64)[b++>>>0]}else{arg=(growMemViews(),HEAPF64)[b++>>>0]}proxiedJSCallArgs.push(arg)}var func=proxiedFunctionTable[funcIndex];PThread.currentProxiedOperationCallerThread=callingThread;var rtn=func(...proxiedJSCallArgs);PThread.currentProxiedOperationCallerThread=0;if(ctx){rtn.then(rtn=>__emscripten_run_js_on_main_thread_done(ctx,ctxArgs,rtn));return}return rtn}var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};function __emscripten_thread_cleanup(thread){thread>>>=0;if(!ENVIRONMENT_IS_PTHREAD)cleanupThread(thread);else postMessage({cmd:6,thread})}function __emscripten_thread_set_strongref(thread){thread>>>=0;if(ENVIRONMENT_IS_NODE){var worker=PThread.pthreads[thread];worker.ref();worker.strongref=1}}var HEAPU8;function __wasmfs_copy_preloaded_file_data(index,buffer){buffer>>>=0;return(growMemViews(),HEAPU8).set(wasmFSPreloadedFiles[index].fileData,buffer>>>0)}var wasmFSPreloadedDirs=[];var __wasmfs_get_num_preloaded_dirs=()=>wasmFSPreloadedDirs.length;var wasmFSPreloadedFiles=[];var wasmFSPreloadingFlushed=false;var __wasmfs_get_num_preloaded_files=()=>{wasmFSPreloadingFlushed=true;return wasmFSPreloadedFiles.length};function __wasmfs_get_preloaded_child_path(index,childNameBuffer){childNameBuffer>>>=0;var s=wasmFSPreloadedDirs[index].childName;var len=lengthBytesUTF8(s)+1;stringToUTF8(s,childNameBuffer,len)}var __wasmfs_get_preloaded_file_mode=index=>wasmFSPreloadedFiles[index].mode;function __wasmfs_get_preloaded_file_size(index){return wasmFSPreloadedFiles[index].fileData.length}function __wasmfs_get_preloaded_parent_path(index,parentPathBuffer){parentPathBuffer>>>=0;var s=wasmFSPreloadedDirs[index].parentPath;var len=lengthBytesUTF8(s)+1;stringToUTF8(s,parentPathBuffer,len)}var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{outIdx>>>=0;if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++>>>0]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++>>>0]=192|u>>6;heap[outIdx++>>>0]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++>>>0]=224|u>>12;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++>>>0]=240|u>>18;heap[outIdx++>>>0]=128|u>>12&63;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63;i++}}heap[outIdx>>>0]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,(growMemViews(),HEAPU8),outPtr,maxBytesToWrite);function __wasmfs_get_preloaded_path_name(index,fileNameBuffer){fileNameBuffer>>>=0;var s=wasmFSPreloadedFiles[index].pathName;var len=lengthBytesUTF8(s)+1;stringToUTF8(s,fileNameBuffer,len)}class HandleAllocator{allocated=[undefined];freelist=[];get(id){return this.allocated[id]}has(id){return this.allocated[id]!==undefined}allocate(handle){var id=this.freelist.pop()??this.allocated.length;this.allocated[id]=handle;return id}free(id){this.allocated[id]=undefined;this.freelist.push(id)}}var wasmfsOPFSAccessHandles=new HandleAllocator;var wasmfsOPFSProxyFinish=ctx=>{_emscripten_proxy_finish(ctx)};async function __wasmfs_opfs_close_access(ctx,accessID,errPtr){ctx>>>=0;errPtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);try{await accessHandle.close()}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSAccessHandles.free(accessID);wasmfsOPFSProxyFinish(ctx)}var wasmfsOPFSBlobs=new HandleAllocator;var __wasmfs_opfs_close_blob=blobID=>{wasmfsOPFSBlobs.free(blobID)};async function __wasmfs_opfs_flush_access(ctx,accessID,errPtr){ctx>>>=0;errPtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);try{await accessHandle.flush()}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}var wasmfsOPFSDirectoryHandles=new HandleAllocator;var __wasmfs_opfs_free_directory=dirID=>{wasmfsOPFSDirectoryHandles.free(dirID)};var wasmfsOPFSFileHandles=new HandleAllocator;var __wasmfs_opfs_free_file=fileID=>{wasmfsOPFSFileHandles.free(fileID)};var wasmfsOPFSGetOrCreateFile=async(parent,name,create)=>{let parentHandle=wasmfsOPFSDirectoryHandles.get(parent);let fileHandle;try{fileHandle=await parentHandle.getFileHandle(name,{create})}catch(e){if(e.name==="NotFoundError"){return-20}if(e.name==="TypeMismatchError"){return-31}return-29}return wasmfsOPFSFileHandles.allocate(fileHandle)};var wasmfsOPFSGetOrCreateDir=async(parent,name,create)=>{let parentHandle=wasmfsOPFSDirectoryHandles.get(parent);let childHandle;try{childHandle=await parentHandle.getDirectoryHandle(name,{create})}catch(e){if(e.name==="NotFoundError"){return-20}if(e.name==="TypeMismatchError"){return-54}return-29}return wasmfsOPFSDirectoryHandles.allocate(childHandle)};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{idx>>>=0;var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.buffer instanceof ArrayBuffer?heapOrArray.subarray(idx,endPtr):heapOrArray.slice(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>{ptr>>>=0;return ptr?UTF8ArrayToString((growMemViews(),HEAPU8),ptr,maxBytesToRead,ignoreNul):""};async function __wasmfs_opfs_get_child(ctx,parent,namePtr,childTypePtr,childIDPtr){ctx>>>=0;namePtr>>>=0;childTypePtr>>>=0;childIDPtr>>>=0;let name=UTF8ToString(namePtr);let childType=1;let childID=await wasmfsOPFSGetOrCreateFile(parent,name,false);if(childID==-31){childType=2;childID=await wasmfsOPFSGetOrCreateDir(parent,name,false)}(growMemViews(),HEAP32)[childTypePtr>>>2>>>0]=childType;(growMemViews(),HEAP32)[childIDPtr>>>2>>>0]=childID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_get_entries(ctx,dirID,entriesPtr,errPtr){ctx>>>=0;entriesPtr>>>=0;errPtr>>>=0;let dirHandle=wasmfsOPFSDirectoryHandles.get(dirID);try{let iter=dirHandle.entries();for(let entry;entry=await iter.next(),!entry.done;){let[name,child]=entry.value;let sp=stackSave();let namePtr=stringToUTF8OnStack(name);let type=child.kind=="file"?1:2;__wasmfs_opfs_record_entry(entriesPtr,namePtr,type);stackRestore(sp)}}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_get_size_access(ctx,accessID,sizePtr){ctx>>>=0;sizePtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);let size;try{size=await accessHandle.getSize()}catch{size=-29}(growMemViews(),HEAP64)[sizePtr>>>3>>>0]=BigInt(size);wasmfsOPFSProxyFinish(ctx)}var __wasmfs_opfs_get_size_blob=function(blobID){var ret=(()=>wasmfsOPFSBlobs.get(blobID).size)();return BigInt(ret)};async function __wasmfs_opfs_get_size_file(ctx,fileID,sizePtr){ctx>>>=0;sizePtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);let size;try{size=(await fileHandle.getFile()).size}catch{size=-29}(growMemViews(),HEAP64)[sizePtr>>>3>>>0]=BigInt(size);wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_init_root_directory(ctx){ctx>>>=0;if(wasmfsOPFSDirectoryHandles.allocated.length==1){let root=await navigator.storage.getDirectory();wasmfsOPFSDirectoryHandles.allocated.push(root)}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_insert_directory(ctx,parent,namePtr,childIDPtr){ctx>>>=0;namePtr>>>=0;childIDPtr>>>=0;let name=UTF8ToString(namePtr);let childID=await wasmfsOPFSGetOrCreateDir(parent,name,true);(growMemViews(),HEAP32)[childIDPtr>>>2>>>0]=childID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_insert_file(ctx,parent,namePtr,childIDPtr){ctx>>>=0;namePtr>>>=0;childIDPtr>>>=0;let name=UTF8ToString(namePtr);let childID=await wasmfsOPFSGetOrCreateFile(parent,name,true);(growMemViews(),HEAP32)[childIDPtr>>>2>>>0]=childID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_move_file(ctx,fileID,newParentID,namePtr,errPtr){ctx>>>=0;namePtr>>>=0;errPtr>>>=0;let name=UTF8ToString(namePtr);let fileHandle=wasmfsOPFSFileHandles.get(fileID);let newDirHandle=wasmfsOPFSDirectoryHandles.get(newParentID);try{await fileHandle.move(newDirHandle,name)}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_open_access(ctx,fileID,accessIDPtr){ctx>>>=0;accessIDPtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);let accessID;try{let accessHandle;var len=FileSystemFileHandle.prototype.createSyncAccessHandle.length;if(len==0){accessHandle=await fileHandle.createSyncAccessHandle()}else{accessHandle=await fileHandle.createSyncAccessHandle({mode:"in-place"})}accessID=wasmfsOPFSAccessHandles.allocate(accessHandle)}catch(e){if(e.name==="InvalidStateError"||e.name==="NoModificationAllowedError"){accessID=-2}else{accessID=-29}}(growMemViews(),HEAP32)[accessIDPtr>>>2>>>0]=accessID;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_open_blob(ctx,fileID,blobIDPtr){ctx>>>=0;blobIDPtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);let blobID;try{let blob=await fileHandle.getFile();blobID=wasmfsOPFSBlobs.allocate(blob)}catch(e){if(e.name==="NotAllowedError"){blobID=-2}else{blobID=-29}}(growMemViews(),HEAP32)[blobIDPtr>>>2>>>0]=blobID;wasmfsOPFSProxyFinish(ctx)}function __wasmfs_opfs_read_access(accessID,bufPtr,len,pos){bufPtr>>>=0;pos=bigintToI53Checked(pos);let accessHandle=wasmfsOPFSAccessHandles.get(accessID);let data=(growMemViews(),HEAPU8).subarray(bufPtr>>>0,bufPtr+len>>>0);try{return accessHandle.read(data,{at:pos})}catch(e){if(e.name=="TypeError"){return-28}return-29}}async function __wasmfs_opfs_read_blob(ctx,blobID,bufPtr,len,pos,nreadPtr){ctx>>>=0;bufPtr>>>=0;pos=bigintToI53Checked(pos);nreadPtr>>>=0;let blob=wasmfsOPFSBlobs.get(blobID);let slice=blob.slice(pos,pos+len);let nread=0;try{let buf=await slice.arrayBuffer();let data=new Uint8Array(buf);(growMemViews(),HEAPU8).set(data,bufPtr>>>0);nread+=data.length}catch(e){if(e instanceof RangeError){nread=-21}else{nread=-29}}(growMemViews(),HEAP32)[nreadPtr>>>2>>>0]=nread;wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_remove_child(ctx,dirID,namePtr,errPtr){ctx>>>=0;namePtr>>>=0;errPtr>>>=0;let name=UTF8ToString(namePtr);let dirHandle=wasmfsOPFSDirectoryHandles.get(dirID);try{await dirHandle.removeEntry(name)}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_set_size_access(ctx,accessID,size,errPtr){ctx>>>=0;size=bigintToI53Checked(size);errPtr>>>=0;let accessHandle=wasmfsOPFSAccessHandles.get(accessID);try{await accessHandle.truncate(size)}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}async function __wasmfs_opfs_set_size_file(ctx,fileID,size,errPtr){ctx>>>=0;size=bigintToI53Checked(size);errPtr>>>=0;let fileHandle=wasmfsOPFSFileHandles.get(fileID);try{let writable=await fileHandle.createWritable({keepExistingData:true});await writable.truncate(size);await writable.close()}catch{let err=-29;(growMemViews(),HEAP32)[errPtr>>>2>>>0]=err}wasmfsOPFSProxyFinish(ctx)}function __wasmfs_opfs_write_access(accessID,bufPtr,len,pos){bufPtr>>>=0;pos=bigintToI53Checked(pos);let accessHandle=wasmfsOPFSAccessHandles.get(accessID);let data=(growMemViews(),HEAPU8).subarray(bufPtr>>>0,bufPtr+len>>>0);try{return accessHandle.write(data,{at:pos})}catch(e){if(e.name=="TypeError"){return-28}return-29}}var FS_stdin_getChar_buffer=[];var intArrayFromString=(stringy,dontAddNull,length)=>{var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array};var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(globalThis.window?.prompt){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var __wasmfs_stdin_get_char=()=>{var c=FS_stdin_getChar();if(typeof c==="number"){return c}return-1};var __wasmfs_thread_utils_heartbeat=function(queue){queue>>>=0;var intervalID=setInterval(()=>{if(ABORT){clearInterval(intervalID)}else{_emscripten_proxy_execute_queue(queue)}},50)};var _emscripten_get_now=()=>performance.timeOrigin+performance.now();var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);ptime>>>=0;if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);(growMemViews(),HEAP64)[ptime>>>3>>>0]=BigInt(nsec);return 0}var _emscripten_check_blocking_allowed=()=>{};function _emscripten_err(str){str>>>=0;return err(UTF8ToString(str))}var _emscripten_exit_with_live_runtime=()=>{runtimeKeepalivePush();throw"unwind"};var jsStackTrace=()=>(new Error).stack.toString();var getCallstack=flags=>{var callstack=jsStackTrace();var lines=callstack.split("\n");callstack="";var firefoxRe=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)");var chromeRe=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var line of lines){var symbolName="";var file="";var lineno=0;var column=0;var parts=chromeRe.exec(line);if(parts?.length==5){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]}else{parts=firefoxRe.exec(line);if(parts?.length>=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+"\n";continue}}if(symbolName=="_emscripten_log"||symbolName=="_emscripten_get_callstack"){callstack="";continue}if(flags&24){if(flags&64){file=file.substring(file.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=` at ${symbolName} (${file}:${lineno}:${column})\n`}}callstack=callstack.replace(/\s+$/,"");return callstack};function _emscripten_get_callstack(flags,str,maxbytes){str>>>=0;var callstack=getCallstack(flags);if(!str||maxbytes<=0){return lengthBytesUTF8(callstack)+1}var bytesWrittenExcludingNull=stringToUTF8(callstack,str,maxbytes);return bytesWrittenExcludingNull+1}var getHeapMax=()=>4294901760;function _emscripten_get_heap_max(){return getHeapMax()}var _emscripten_num_logical_cores=()=>ENVIRONMENT_IS_NODE?require("node:os").cpus().length:navigator["hardwareConcurrency"];function _emscripten_out(str){str>>>=0;return out(UTF8ToString(str))}var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};function _emscripten_resize_heap(requestedSize){requestedSize>>>=0;var oldSize=(growMemViews(),HEAPU8).length;if(requestedSize<=oldSize){return false}var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false}var _emscripten_runtime_keepalive_check=keepRuntimeAlive;var _emscripten_unwind_to_js_event_loop=()=>{throw"unwind"};var ENV={};var getExecutableName=()=>thisProgram;var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};function _environ_get(__environ,environ_buf){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(3,0,1,__environ,environ_buf);__environ>>>=0;environ_buf>>>=0;var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;(growMemViews(),HEAPU32)[__environ+envp>>>2>>>0]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4}return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){if(ENVIRONMENT_IS_PTHREAD)return proxyToMainThread(4,0,1,penviron_count,penviron_buf_size);penviron_count>>>=0;penviron_buf_size>>>=0;var strings=getEnvStrings();(growMemViews(),HEAPU32)[penviron_count>>>2>>>0]=strings.length;var bufSize=0;for(var string of strings){bufSize+=lengthBytesUTF8(string)+1}(growMemViews(),HEAPU32)[penviron_buf_size>>>2>>>0]=bufSize;return 0}var initRandomFill=()=>{if(ENVIRONMENT_IS_NODE){var nodeCrypto=require("node:crypto");return view=>(nodeCrypto.randomFillSync(view),0)}return view=>(view.set(crypto.getRandomValues(new Uint8Array(view.byteLength))),0)};var randomFill=view=>(randomFill=initRandomFill())(view);function _random_get(buffer,size){buffer>>>=0;size>>>=0;return randomFill((growMemViews(),HEAPU8).subarray(buffer>>>0,buffer+size>>>0))}var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{(growMemViews(),HEAP8).set(array,buffer>>>0)};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="pointer")return ret>>>0;if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(!stack)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};var HEAP16;var HEAPF32;function getValue(ptr,type="i8"){if(type.endsWith("*"))type="*";switch(type){case"i1":return(growMemViews(),HEAP8)[ptr>>>0];case"i8":return(growMemViews(),HEAP8)[ptr>>>0];case"i16":return(growMemViews(),HEAP16)[ptr>>>1>>>0];case"i32":return(growMemViews(),HEAP32)[ptr>>>2>>>0];case"i64":return(growMemViews(),HEAP64)[ptr>>>3>>>0];case"float":return(growMemViews(),HEAPF32)[ptr>>>2>>>0];case"double":return(growMemViews(),HEAPF64)[ptr>>>3>>>0];case"*":return(growMemViews(),HEAPU32)[ptr>>>2>>>0];default:abort(`invalid type for getValue: ${type}`)}}PThread.init();{initMemory();if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["arguments"])programArgs=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var preInit=Module["preInit"];if(preInit){if(typeof preInit=="function")Module["preInit"]=preInit=[preInit];while(preInit.length>0){preInit.shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["getValue"]=getValue;Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["lengthBytesUTF8"]=lengthBytesUTF8;var proxiedFunctionTable=[_proc_exit,exitOnMainThread,pthreadCreateProxied,_environ_get,_environ_sizes_get];var _main,_lucivy_add,_lucivy_add_many,_lucivy_apply_sharded_delta,_lucivy_close,_lucivy_commit,_lucivy_commit_async,_lucivy_commit_finish,_lucivy_commit_status_ptr,_lucivy_compact_async,_lucivy_configure,_lucivy_create,_lucivy_destroy,_lucivy_drain_merges,_lucivy_drop_index,_lucivy_dump_mermaid,_lucivy_dump_state,_lucivy_dump_wait_graph,_lucivy_dump_wait_graph_text,_lucivy_export_sharded_delta,_lucivy_export_snapshot,_lucivy_export_stats,_lucivy_import_file,_lucivy_import_snapshot,_lucivy_log_ring_ptr,_lucivy_log_ring_size,_lucivy_memory_status,_lucivy_merge_stats,_lucivy_num_docs,_lucivy_open,_lucivy_open_begin,_lucivy_open_finish,_lucivy_preload,_lucivy_query_warnings,_lucivy_read_logs,_lucivy_remove,_lucivy_schema_json,_lucivy_search,_lucivy_search_filtered,_lucivy_search_with_global_stats,_lucivy_shard_versions,_lucivy_test_condvar,_lucivy_test_coop,_lucivy_test_fs_task,_lucivy_update,_emscripten_builtin_free,__emscripten_tls_init,_pthread_self,_free,_malloc,_realloc,_calloc,__emscripten_proxy_main,_emscripten_builtin_malloc,___libc_free,___libc_malloc,__emscripten_thread_init,___set_thread_state,__emscripten_thread_crashed,_htonl,_htons,_emscripten_proxy_execute_queue,_ntohs,_emscripten_proxy_finish,__emscripten_run_js_on_main_thread_done,__emscripten_run_js_on_main_thread,__emscripten_thread_free_data,__emscripten_thread_exit,_strndup,__emscripten_check_mailbox,__ZdaPv,__ZdaPvm,__ZdlPv,__ZdlPvm,__Znam,__ZnamSt11align_val_t,__Znwm,__ZnwmSt11align_val_t,___libc_calloc,___libc_realloc,_emscripten_builtin_calloc,_emscripten_builtin_realloc,_malloc_size,_malloc_usable_size,_reallocf,_setThrew,__emscripten_tempret_set,_emscripten_stack_set_limits,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,__wasmfs_opfs_record_entry,__indirect_function_table,wasmTable;function assignWasmExports(wasmExports){_main=Module["_main"]=wasmExports["__main_argc_argv"];_lucivy_add=Module["_lucivy_add"]=wasmExports["lucivy_add"];_lucivy_add_many=Module["_lucivy_add_many"]=wasmExports["lucivy_add_many"];_lucivy_apply_sharded_delta=Module["_lucivy_apply_sharded_delta"]=wasmExports["lucivy_apply_sharded_delta"];_lucivy_close=Module["_lucivy_close"]=wasmExports["lucivy_close"];_lucivy_commit=Module["_lucivy_commit"]=wasmExports["lucivy_commit"];_lucivy_commit_async=Module["_lucivy_commit_async"]=wasmExports["lucivy_commit_async"];_lucivy_commit_finish=Module["_lucivy_commit_finish"]=wasmExports["lucivy_commit_finish"];_lucivy_commit_status_ptr=Module["_lucivy_commit_status_ptr"]=wasmExports["lucivy_commit_status_ptr"];_lucivy_compact_async=Module["_lucivy_compact_async"]=wasmExports["lucivy_compact_async"];_lucivy_configure=Module["_lucivy_configure"]=wasmExports["lucivy_configure"];_lucivy_create=Module["_lucivy_create"]=wasmExports["lucivy_create"];_lucivy_destroy=Module["_lucivy_destroy"]=wasmExports["lucivy_destroy"];_lucivy_drain_merges=Module["_lucivy_drain_merges"]=wasmExports["lucivy_drain_merges"];_lucivy_drop_index=Module["_lucivy_drop_index"]=wasmExports["lucivy_drop_index"];_lucivy_dump_mermaid=Module["_lucivy_dump_mermaid"]=wasmExports["lucivy_dump_mermaid"];_lucivy_dump_state=Module["_lucivy_dump_state"]=wasmExports["lucivy_dump_state"];_lucivy_dump_wait_graph=Module["_lucivy_dump_wait_graph"]=wasmExports["lucivy_dump_wait_graph"];_lucivy_dump_wait_graph_text=Module["_lucivy_dump_wait_graph_text"]=wasmExports["lucivy_dump_wait_graph_text"];_lucivy_export_sharded_delta=Module["_lucivy_export_sharded_delta"]=wasmExports["lucivy_export_sharded_delta"];_lucivy_export_snapshot=Module["_lucivy_export_snapshot"]=wasmExports["lucivy_export_snapshot"];_lucivy_export_stats=Module["_lucivy_export_stats"]=wasmExports["lucivy_export_stats"];_lucivy_import_file=Module["_lucivy_import_file"]=wasmExports["lucivy_import_file"];_lucivy_import_snapshot=Module["_lucivy_import_snapshot"]=wasmExports["lucivy_import_snapshot"];_lucivy_log_ring_ptr=Module["_lucivy_log_ring_ptr"]=wasmExports["lucivy_log_ring_ptr"];_lucivy_log_ring_size=Module["_lucivy_log_ring_size"]=wasmExports["lucivy_log_ring_size"];_lucivy_memory_status=Module["_lucivy_memory_status"]=wasmExports["lucivy_memory_status"];_lucivy_merge_stats=Module["_lucivy_merge_stats"]=wasmExports["lucivy_merge_stats"];_lucivy_num_docs=Module["_lucivy_num_docs"]=wasmExports["lucivy_num_docs"];_lucivy_open=Module["_lucivy_open"]=wasmExports["lucivy_open"];_lucivy_open_begin=Module["_lucivy_open_begin"]=wasmExports["lucivy_open_begin"];_lucivy_open_finish=Module["_lucivy_open_finish"]=wasmExports["lucivy_open_finish"];_lucivy_preload=Module["_lucivy_preload"]=wasmExports["lucivy_preload"];_lucivy_query_warnings=Module["_lucivy_query_warnings"]=wasmExports["lucivy_query_warnings"];_lucivy_read_logs=Module["_lucivy_read_logs"]=wasmExports["lucivy_read_logs"];_lucivy_remove=Module["_lucivy_remove"]=wasmExports["lucivy_remove"];_lucivy_schema_json=Module["_lucivy_schema_json"]=wasmExports["lucivy_schema_json"];_lucivy_search=Module["_lucivy_search"]=wasmExports["lucivy_search"];_lucivy_search_filtered=Module["_lucivy_search_filtered"]=wasmExports["lucivy_search_filtered"];_lucivy_search_with_global_stats=Module["_lucivy_search_with_global_stats"]=wasmExports["lucivy_search_with_global_stats"];_lucivy_shard_versions=Module["_lucivy_shard_versions"]=wasmExports["lucivy_shard_versions"];_lucivy_test_condvar=Module["_lucivy_test_condvar"]=wasmExports["lucivy_test_condvar"];_lucivy_test_coop=Module["_lucivy_test_coop"]=wasmExports["lucivy_test_coop"];_lucivy_test_fs_task=Module["_lucivy_test_fs_task"]=wasmExports["lucivy_test_fs_task"];_lucivy_update=Module["_lucivy_update"]=wasmExports["lucivy_update"];_emscripten_builtin_free=Module["_emscripten_builtin_free"]=wasmExports["emscripten_builtin_free"];__emscripten_tls_init=wasmExports["_emscripten_tls_init"];_pthread_self=wasmExports["pthread_self"];_free=Module["_free"]=wasmExports["free"];_malloc=Module["_malloc"]=wasmExports["malloc"];_realloc=wasmExports["realloc"];_calloc=wasmExports["calloc"];__emscripten_proxy_main=Module["__emscripten_proxy_main"]=wasmExports["_emscripten_proxy_main"];_emscripten_builtin_malloc=Module["_emscripten_builtin_malloc"]=wasmExports["emscripten_builtin_malloc"];___libc_free=Module["___libc_free"]=wasmExports["__libc_free"];___libc_malloc=Module["___libc_malloc"]=wasmExports["__libc_malloc"];__emscripten_thread_init=wasmExports["_emscripten_thread_init"];___set_thread_state=wasmExports["__set_thread_state"];__emscripten_thread_crashed=wasmExports["_emscripten_thread_crashed"];_htonl=wasmExports["htonl"];_htons=wasmExports["htons"];_emscripten_proxy_execute_queue=wasmExports["emscripten_proxy_execute_queue"];_ntohs=wasmExports["ntohs"];_emscripten_proxy_finish=wasmExports["emscripten_proxy_finish"];__emscripten_run_js_on_main_thread_done=wasmExports["_emscripten_run_js_on_main_thread_done"];__emscripten_run_js_on_main_thread=wasmExports["_emscripten_run_js_on_main_thread"];__emscripten_thread_free_data=wasmExports["_emscripten_thread_free_data"];__emscripten_thread_exit=wasmExports["_emscripten_thread_exit"];_strndup=Module["_strndup"]=wasmExports["strndup"];__emscripten_check_mailbox=wasmExports["_emscripten_check_mailbox"];__ZdaPv=Module["__ZdaPv"]=wasmExports["_ZdaPv"];__ZdaPvm=Module["__ZdaPvm"]=wasmExports["_ZdaPvm"];__ZdlPv=Module["__ZdlPv"]=wasmExports["_ZdlPv"];__ZdlPvm=Module["__ZdlPvm"]=wasmExports["_ZdlPvm"];__Znam=Module["__Znam"]=wasmExports["_Znam"];__ZnamSt11align_val_t=Module["__ZnamSt11align_val_t"]=wasmExports["_ZnamSt11align_val_t"];__Znwm=Module["__Znwm"]=wasmExports["_Znwm"];__ZnwmSt11align_val_t=Module["__ZnwmSt11align_val_t"]=wasmExports["_ZnwmSt11align_val_t"];___libc_calloc=Module["___libc_calloc"]=wasmExports["__libc_calloc"];___libc_realloc=Module["___libc_realloc"]=wasmExports["__libc_realloc"];_emscripten_builtin_calloc=Module["_emscripten_builtin_calloc"]=wasmExports["emscripten_builtin_calloc"];_emscripten_builtin_realloc=Module["_emscripten_builtin_realloc"]=wasmExports["emscripten_builtin_realloc"];_malloc_size=Module["_malloc_size"]=wasmExports["malloc_size"];_malloc_usable_size=Module["_malloc_usable_size"]=wasmExports["malloc_usable_size"];_reallocf=Module["_reallocf"]=wasmExports["reallocf"];_setThrew=wasmExports["setThrew"];__emscripten_tempret_set=wasmExports["_emscripten_tempret_set"];_emscripten_stack_set_limits=wasmExports["emscripten_stack_set_limits"];__emscripten_stack_restore=wasmExports["_emscripten_stack_restore"];__emscripten_stack_alloc=wasmExports["_emscripten_stack_alloc"];_emscripten_stack_get_current=wasmExports["emscripten_stack_get_current"];___cxa_increment_exception_refcount=wasmExports["__cxa_increment_exception_refcount"];___cxa_can_catch=wasmExports["__cxa_can_catch"];___cxa_get_exception_ptr=wasmExports["__cxa_get_exception_ptr"];__wasmfs_opfs_record_entry=wasmExports["_wasmfs_opfs_record_entry"];__indirect_function_table=wasmTable=wasmExports["__indirect_function_table"]}var wasmImports;function assignWasmImports(){wasmImports={__call_sighandler:___call_sighandler,__cxa_begin_catch:___cxa_begin_catch,__cxa_find_matching_catch_2:___cxa_find_matching_catch_2,__cxa_find_matching_catch_3:___cxa_find_matching_catch_3,__cxa_throw:___cxa_throw,__pthread_create_js:___pthread_create_js,__resumeException:___resumeException,_abort_js:__abort_js,_emscripten_init_main_thread_js:__emscripten_init_main_thread_js,_emscripten_notify_mailbox_postmessage:__emscripten_notify_mailbox_postmessage,_emscripten_receive_on_main_thread_js:__emscripten_receive_on_main_thread_js,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_emscripten_thread_cleanup:__emscripten_thread_cleanup,_emscripten_thread_mailbox_await:__emscripten_thread_mailbox_await,_emscripten_thread_set_strongref:__emscripten_thread_set_strongref,_wasmfs_copy_preloaded_file_data:__wasmfs_copy_preloaded_file_data,_wasmfs_get_num_preloaded_dirs:__wasmfs_get_num_preloaded_dirs,_wasmfs_get_num_preloaded_files:__wasmfs_get_num_preloaded_files,_wasmfs_get_preloaded_child_path:__wasmfs_get_preloaded_child_path,_wasmfs_get_preloaded_file_mode:__wasmfs_get_preloaded_file_mode,_wasmfs_get_preloaded_file_size:__wasmfs_get_preloaded_file_size,_wasmfs_get_preloaded_parent_path:__wasmfs_get_preloaded_parent_path,_wasmfs_get_preloaded_path_name:__wasmfs_get_preloaded_path_name,_wasmfs_opfs_close_access:__wasmfs_opfs_close_access,_wasmfs_opfs_close_blob:__wasmfs_opfs_close_blob,_wasmfs_opfs_flush_access:__wasmfs_opfs_flush_access,_wasmfs_opfs_free_directory:__wasmfs_opfs_free_directory,_wasmfs_opfs_free_file:__wasmfs_opfs_free_file,_wasmfs_opfs_get_child:__wasmfs_opfs_get_child,_wasmfs_opfs_get_entries:__wasmfs_opfs_get_entries,_wasmfs_opfs_get_size_access:__wasmfs_opfs_get_size_access,_wasmfs_opfs_get_size_blob:__wasmfs_opfs_get_size_blob,_wasmfs_opfs_get_size_file:__wasmfs_opfs_get_size_file,_wasmfs_opfs_init_root_directory:__wasmfs_opfs_init_root_directory,_wasmfs_opfs_insert_directory:__wasmfs_opfs_insert_directory,_wasmfs_opfs_insert_file:__wasmfs_opfs_insert_file,_wasmfs_opfs_move_file:__wasmfs_opfs_move_file,_wasmfs_opfs_open_access:__wasmfs_opfs_open_access,_wasmfs_opfs_open_blob:__wasmfs_opfs_open_blob,_wasmfs_opfs_read_access:__wasmfs_opfs_read_access,_wasmfs_opfs_read_blob:__wasmfs_opfs_read_blob,_wasmfs_opfs_remove_child:__wasmfs_opfs_remove_child,_wasmfs_opfs_set_size_access:__wasmfs_opfs_set_size_access,_wasmfs_opfs_set_size_file:__wasmfs_opfs_set_size_file,_wasmfs_opfs_write_access:__wasmfs_opfs_write_access,_wasmfs_stdin_get_char:__wasmfs_stdin_get_char,_wasmfs_thread_utils_heartbeat:__wasmfs_thread_utils_heartbeat,clock_time_get:_clock_time_get,emscripten_check_blocking_allowed:_emscripten_check_blocking_allowed,emscripten_date_now:_emscripten_date_now,emscripten_err:_emscripten_err,emscripten_exit_with_live_runtime:_emscripten_exit_with_live_runtime,emscripten_get_callstack:_emscripten_get_callstack,emscripten_get_heap_max:_emscripten_get_heap_max,emscripten_get_now:_emscripten_get_now,emscripten_num_logical_cores:_emscripten_num_logical_cores,emscripten_out:_emscripten_out,emscripten_resize_heap:_emscripten_resize_heap,emscripten_runtime_keepalive_check:_emscripten_runtime_keepalive_check,emscripten_unwind_to_js_event_loop:_emscripten_unwind_to_js_event_loop,environ_get:_environ_get,environ_sizes_get:_environ_sizes_get,exit:_exit,invoke_ii,invoke_iii,invoke_iiii,invoke_v,invoke_vi,invoke_vii,invoke_viii,memory:wasmMemory,proc_exit:_proc_exit,random_get:_random_get}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function applySignatureConversions(wasmExports){wasmExports=Object.assign({},wasmExports);var makeWrapper_p=f=>()=>f()>>>0;var makeWrapper_pp=f=>a0=>f(a0)>>>0;var makeWrapper_ppp=f=>(a0,a1)=>f(a0,a1)>>>0;wasmExports["_emscripten_tls_init"]=makeWrapper_p(wasmExports["_emscripten_tls_init"]);wasmExports["pthread_self"]=makeWrapper_p(wasmExports["pthread_self"]);wasmExports["malloc"]=makeWrapper_pp(wasmExports["malloc"]);wasmExports["realloc"]=makeWrapper_ppp(wasmExports["realloc"]);wasmExports["calloc"]=makeWrapper_ppp(wasmExports["calloc"]);wasmExports["emscripten_builtin_malloc"]=makeWrapper_pp(wasmExports["emscripten_builtin_malloc"]);wasmExports["__libc_malloc"]=makeWrapper_pp(wasmExports["__libc_malloc"]);wasmExports["strndup"]=makeWrapper_ppp(wasmExports["strndup"]);wasmExports["__libc_calloc"]=makeWrapper_ppp(wasmExports["__libc_calloc"]);wasmExports["__libc_realloc"]=makeWrapper_ppp(wasmExports["__libc_realloc"]);wasmExports["emscripten_builtin_calloc"]=makeWrapper_ppp(wasmExports["emscripten_builtin_calloc"]);wasmExports["emscripten_builtin_realloc"]=makeWrapper_ppp(wasmExports["emscripten_builtin_realloc"]);wasmExports["malloc_usable_size"]=makeWrapper_pp(wasmExports["malloc_usable_size"]);wasmExports["_emscripten_stack_alloc"]=makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]);wasmExports["emscripten_stack_get_current"]=makeWrapper_p(wasmExports["emscripten_stack_get_current"]);wasmExports["__cxa_get_exception_ptr"]=makeWrapper_pp(wasmExports["__cxa_get_exception_ptr"]);return wasmExports}function callMain(args=[]){var entryFunction=__emscripten_proxy_main;runtimeKeepalivePush();args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;for(var arg of args){(growMemViews(),HEAPU32)[argv_ptr>>>2>>>0]=stringToUTF8OnStack(arg);argv_ptr+=4}(growMemViews(),HEAPU32)[argv_ptr>>>2>>>0]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}async function run(args=programArgs){if(ENVIRONMENT_IS_PTHREAD){initRuntime();return}preRun();if(runDependencies){await resolveRunDependencies()}var setStatus=Module["setStatus"];if(setStatus){setStatus("Running...");await new Promise(resolve=>setTimeout(resolve,1));setTimeout(setStatus,1,"")}if(ABORT)return;initRuntime();Module["onRuntimeInitialized"]?.();var noInitialRun=Module["noInitialRun"]||false;if(!noInitialRun)callMain(args);postRun()}var wasmExports;if(!ENVIRONMENT_IS_PTHREAD){wasmExports=await createWasm();await run()}
|
|
2
2
|
;return Module}export default createLucivy;var isPthread=globalThis.name=="em-pthread";var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isPthread=(await import("node:worker_threads")).workerData==="em-pthread";isPthread&&createLucivy();
|
package/pkg/lucivy.wasm
CHANGED
|
Binary file
|