pikelet-wasm 0.16.0 → 0.17.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/CHANGELOG.md +130 -0
- package/FORMAT.md +52 -59
- package/README.md +2 -2
- package/complete/builder.d.ts +8 -7
- package/complete/builder.mjs +18 -36
- package/complete/fusion.mjs +3 -4
- package/complete/grounding.mjs +5 -9
- package/complete/index.d.ts +14 -32
- package/complete/index.mjs +94 -288
- package/complete/inline-transformer.mjs +0 -64
- package/complete/layer-append.mjs +5 -31
- package/complete/layer-chain.mjs +7 -53
- package/complete/layer-compact.mjs +3 -4
- package/complete/layer-encoder.mjs +17 -123
- package/complete/layer-reader.mjs +20 -147
- package/complete/layer-rebase.mjs +1 -1
- package/complete/wordpiece.mjs +0 -22
- package/dist/engine.js +1 -1
- package/dist/engine.scalar.js +1 -1
- package/dist/engine.scalar.wasm +0 -0
- package/dist/engine.wasm +0 -0
- package/package.json +1 -1
- package/src/artifact/pikelet-artifact-sketch.js +48 -124
- package/src/core/pikelet-core.js +6 -3
- package/complete/retrieval-abstention.mjs +0 -232
- package/complete/student-abstention.mjs +0 -102
- package/complete/student-embedder.mjs +0 -231
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
// one wave; the locator walk is sequential, because each hop's location is
|
|
22
22
|
// only known once its child's manifest has been read.
|
|
23
23
|
|
|
24
|
-
import { openPikeletFile, readChainMemberShell, readMemberManifest,
|
|
24
|
+
import { openPikeletFile, readChainMemberShell, readMemberManifest, LEXICAL_CANDIDATES, LEXICAL_CUTOFF } from './index.mjs';
|
|
25
25
|
import { resolveParentLocation, assertConfined } from './layer-locator.mjs';
|
|
26
26
|
import { httpRangeSource } from './sources.mjs';
|
|
27
27
|
import { fuseCandidates, FUSION_DEFAULTS, fusionDefaultsFor } from './fusion.mjs';
|
|
28
28
|
import { parseTombstoneSegment, firstSupersetViolation } from './tombstones.mjs';
|
|
29
29
|
import { groundQuery, GROUNDING_PASSAGES } from './grounding.mjs';
|
|
30
30
|
import { validateAgainstParent, chainIngestDeclaration, validateIngestAgainstChain, LAYER_PROFILE, MAX_DEPTH } from './layer-manifest.mjs';
|
|
31
|
-
import { parseInheritedQuerySegment
|
|
31
|
+
import { parseInheritedQuerySegment } from './layer-encoder.mjs';
|
|
32
32
|
import {
|
|
33
33
|
buildIntervalTable, ownerOf, projectMasks, liveCount, buildSupersessionMap,
|
|
34
|
-
resolveSupersession,
|
|
34
|
+
resolveSupersession, globalLexicalStats,
|
|
35
35
|
buildAncestry, resolveCitation,
|
|
36
36
|
} from './layer-chain.mjs';
|
|
37
37
|
|
|
@@ -40,10 +40,6 @@ import {
|
|
|
40
40
|
// can name the budget it hit.
|
|
41
41
|
export const CHAIN_DEFAULTS = Object.freeze({
|
|
42
42
|
maxDepth: MAX_DEPTH,
|
|
43
|
-
// 5.5: the reader's limit MUST be finite and declared. 0.20 is
|
|
44
|
-
// conservative (13.1 measured no degradation out to 40% drift), and it is
|
|
45
|
-
// a reader policy, not a format constant.
|
|
46
|
-
readerDriftLimit: 0.20,
|
|
47
43
|
});
|
|
48
44
|
|
|
49
45
|
/**
|
|
@@ -52,7 +48,7 @@ export const CHAIN_DEFAULTS = Object.freeze({
|
|
|
52
48
|
* [base, layer1, layer2, ...]. Every member is opened through
|
|
53
49
|
* openPikeletFile(), so a string is a path and an object is a range source.
|
|
54
50
|
* @param {object} [options] forwarded to each member's open, plus:
|
|
55
|
-
*
|
|
51
|
+
* maxDepth, and fetch (the transport for any parent the
|
|
56
52
|
* walk reaches over HTTP; default: the child source's own, else
|
|
57
53
|
* globalThis.fetch).
|
|
58
54
|
*/
|
|
@@ -180,7 +176,6 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
180
176
|
if (members.length - 1 > maxDepth) {
|
|
181
177
|
throw new Error(`chain depth ${members.length - 1} exceeds the limit ${maxDepth} (2.7)`);
|
|
182
178
|
}
|
|
183
|
-
const readerDriftLimit = options.readerDriftLimit ?? CHAIN_DEFAULTS.readerDriftLimit;
|
|
184
179
|
|
|
185
180
|
const opened = [];
|
|
186
181
|
const closeAll = async () => {
|
|
@@ -236,17 +231,10 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
236
231
|
|
|
237
232
|
const perLayerTombstones = [];
|
|
238
233
|
let headBitset = new Uint8Array(0);
|
|
239
|
-
const layerBlooms = [];
|
|
240
|
-
let everyLayerShipsBloom = true;
|
|
241
|
-
// 4.5: every layer's bloom MUST use the base asset's geometry, so the
|
|
242
|
-
// union is an exact OR. The geometry comes from the base's fit.
|
|
243
|
-
const baseVocabBloom = base.calibrationJson?.asset?.vocabBloom;
|
|
244
|
-
const baseBloomGeometry = options.baseBloom
|
|
245
|
-
|| (baseVocabBloom ? { bits: baseVocabBloom.bits, hashes: baseVocabBloom.hashes } : null);
|
|
246
234
|
// 4.3: lexical is REQUIRED on a layer with records if the base carries
|
|
247
235
|
// one, else MUST be absent. A layer that drops it leaves its records
|
|
248
236
|
// invisible to BM25 and skews the global statistics; one that adds it
|
|
249
|
-
// introduces lexical retrieval the base
|
|
237
|
+
// introduces lexical retrieval the base was never built with.
|
|
250
238
|
const baseHasLexical = base.segments.has('lexical');
|
|
251
239
|
|
|
252
240
|
for (let i = 1; i < tiersRaw.length; i++) {
|
|
@@ -264,24 +252,13 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
264
252
|
if (!baseQiSha) throw new Error('the base carries no query-interp segment digest to inherit');
|
|
265
253
|
const qiSeg = tier.segments.get('query-interp');
|
|
266
254
|
if (!qiSeg) throw new Error(`layer at depth ${rel.depth} carries no query-interp segment`);
|
|
267
|
-
|
|
255
|
+
parseInheritedQuerySegment(
|
|
268
256
|
await readSegment(opened[i], qiSeg),
|
|
269
257
|
{
|
|
270
258
|
layerBaseIdentity: rel.identityFields.baseIdentity,
|
|
271
259
|
baseQueryInterpSha256: baseQiSha,
|
|
272
|
-
baseBloom: baseBloomGeometry,
|
|
273
260
|
},
|
|
274
261
|
);
|
|
275
|
-
if (inherited.bloomBytes && !baseBloomGeometry) {
|
|
276
|
-
throw new Error(`layer at depth ${rel.depth} ships a vocabulary bloom but the base carries none whose geometry it could match (4.5)`);
|
|
277
|
-
}
|
|
278
|
-
// A missing bloom degrades the chain because it hides a layer's
|
|
279
|
-
// vocabulary from known_frac (4.5). A tombstone-only layer has no
|
|
280
|
-
// records and so no vocabulary to hide: its `none` region is the
|
|
281
|
-
// empty bloom, not a gap.
|
|
282
|
-
if (inherited.bloomBytes) layerBlooms.push(inherited.bloomBytes);
|
|
283
|
-
else if (!rel.tombstoneOnly) everyLayerShipsBloom = false;
|
|
284
|
-
|
|
285
262
|
if (!rel.tombstoneOnly && tier.segments.has('lexical') !== baseHasLexical) {
|
|
286
263
|
throw new Error(baseHasLexical
|
|
287
264
|
? `layer at depth ${rel.depth} carries no lexical segment, but the base does: a layer must not drop lexical retrieval (4.3)`
|
|
@@ -337,35 +314,10 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
337
314
|
const supersessions = buildSupersessionMap(perLayerTombstones);
|
|
338
315
|
const ancestry = buildAncestry(chainMembers);
|
|
339
316
|
const headTombstoneCount = countBits(headBitset);
|
|
340
|
-
const drift = chainMembers.length > 1
|
|
341
|
-
? calibrationDrift(chainMembers, headTombstoneCount) : 0;
|
|
342
|
-
// 5.5: "the base carries no fit" is status `none`. The fit lives in the
|
|
343
|
-
// base's query-interp calibration region (`asset`), never in the
|
|
344
|
-
// manifest.
|
|
345
|
-
const baseCal = base.calibrationJson || null;
|
|
346
|
-
const baseHasFit = !!(baseCal && baseCal.asset);
|
|
347
|
-
const calibration = calibrationStatus({
|
|
348
|
-
drift,
|
|
349
|
-
// producerEnvelope is the base producer's declared validity
|
|
350
|
-
// envelope. No claim is no constraint (+Infinity), which
|
|
351
|
-
// calibrationStatus() handles; the reader's finite limit still
|
|
352
|
-
// gates it.
|
|
353
|
-
producerEnvelope: baseCal?.asset?.driftLimit,
|
|
354
|
-
readerLimit: readerDriftLimit,
|
|
355
|
-
baseHasFit,
|
|
356
|
-
everyLayerShipsBloom: chainMembers.length === 1 ? true : everyLayerShipsBloom,
|
|
357
|
-
});
|
|
358
317
|
const lexStats = globalLexicalStats(searchTiers.map((t) => ({
|
|
359
318
|
docCount: t.reader.lexicalIndex ? t.reader.lexicalIndex.docCount : 0,
|
|
360
319
|
totalTokens: t.reader.lexicalIndex ? t.reader.lexicalIndex.totalTokens : 0,
|
|
361
320
|
})));
|
|
362
|
-
// The union bloom (4.5) starts from the base's own vocabulary bloom,
|
|
363
|
-
// which ships in its calibration region beside the fit.
|
|
364
|
-
const baseBloomBytes = baseCal?.vocabBloomBase64
|
|
365
|
-
? base64Bytes(baseCal.vocabBloomBase64)
|
|
366
|
-
: null;
|
|
367
|
-
const chainBloom = unionBloom([baseBloomBytes, ...layerBlooms]);
|
|
368
|
-
|
|
369
321
|
let closed = false;
|
|
370
322
|
const assertOpen = () => { if (closed) throw new Error('chain is closed'); };
|
|
371
323
|
|
|
@@ -392,15 +344,9 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
392
344
|
encoder: base.encoderInfo ?? null,
|
|
393
345
|
// The fusion defaults query() applies (the base encoder's).
|
|
394
346
|
fusion: { ...chainFusion },
|
|
395
|
-
calibrationDrift: calibration.drift,
|
|
396
|
-
calibrationStatus: calibration.status,
|
|
397
|
-
driftLimit: calibration.effectiveLimit,
|
|
398
|
-
producerEnvelope: calibration.producerEnvelope,
|
|
399
|
-
readerLimit: calibration.readerLimit,
|
|
400
347
|
lexical: { ...lexStats },
|
|
401
348
|
// 4.1: sampleQueries may appear on any member and applies
|
|
402
|
-
// to that member. A chain surfaces the base's
|
|
403
|
-
// the ones fit against the corpus the encoder saw.
|
|
349
|
+
// to that member. A chain surfaces the base's.
|
|
404
350
|
sampleQueries: Array.isArray(base.manifest.sampleQueries) ? base.manifest.sampleQueries : [],
|
|
405
351
|
// Each member's own integrity, from its reader. A
|
|
406
352
|
// tombstone-only layer is a verified shell (manifest plus
|
|
@@ -435,10 +381,6 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
435
381
|
if (!['hybrid', 'vector', 'lexical', 'augmented'].includes(retrieval)) {
|
|
436
382
|
throw new Error(`query() retrieval must be hybrid, vector, lexical, or augmented, got ${retrieval}`);
|
|
437
383
|
}
|
|
438
|
-
// The base's calibration (scorer, union bloom, drift envelope)
|
|
439
|
-
// was read unverified at open when its encoder is deferred.
|
|
440
|
-
if (base.calibrationVerified) await base.calibrationVerified();
|
|
441
|
-
|
|
442
384
|
// --- 2. Lexical candidates (5.3 step 2, 5.4) -------------------
|
|
443
385
|
// df is summed across tiers per query term, so a term scores
|
|
444
386
|
// with one idf everywhere (per-tier df would let layer records
|
|
@@ -517,9 +459,9 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
517
459
|
.sort((a, b) => (a.distance - b.distance) || (a.id - b.id));
|
|
518
460
|
|
|
519
461
|
// --- 4. Fuse (5.3 step 4) --------------------------------------
|
|
520
|
-
// fusedFull is the full-window order (not k-truncated):
|
|
521
|
-
//
|
|
522
|
-
//
|
|
462
|
+
// fusedFull is the full-window order (not k-truncated):
|
|
463
|
+
// grounding grades what fusion ranks first. Null where the
|
|
464
|
+
// mode keeps distance order.
|
|
523
465
|
let fusedFull = null;
|
|
524
466
|
if (retrieval === 'lexical') {
|
|
525
467
|
const byId = new Map(searched.map((hit) => [hit.id, hit]));
|
|
@@ -549,72 +491,19 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
549
491
|
...(hit.fusedRank ? { fusedRank: hit.fusedRank, lexicalRank: hit.lexicalRank, vectorRank: hit.vectorRank } : {}),
|
|
550
492
|
};
|
|
551
493
|
}));
|
|
552
|
-
//
|
|
553
|
-
//
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
if (calibration.status === 'inherited' && base.scoreQuality) {
|
|
562
|
-
// Coverage reads the fit's passagesNeeded from the FULL
|
|
563
|
-
// fused window, not the k-truncated results.
|
|
564
|
-
const passagesNeeded = baseCal?.asset?.coverage?.topK || 5;
|
|
565
|
-
const passageOrder = fusedFull?.length ? fusedFull : searched;
|
|
566
|
-
const passages = await Promise.all(passageOrder.slice(0, passagesNeeded).map(async (hit) => {
|
|
567
|
-
const owner = ownerOf(table, hit.id);
|
|
568
|
-
const rec = await searchTiers[owner.tier.tier].reader.hydrate(owner.localId);
|
|
569
|
-
return rec?.text ?? '';
|
|
570
|
-
}));
|
|
571
|
-
// 4.5: "A reader MUST compute the union before
|
|
572
|
-
// scoring", so known_frac counts every layer's
|
|
573
|
-
// vocabulary, not only the base's.
|
|
574
|
-
const scored = await base.scoreQuality(
|
|
575
|
-
searched,
|
|
576
|
-
{ text: queryOptions.text ?? '', vector, passages },
|
|
577
|
-
fusedFull,
|
|
578
|
-
{ vocabBloom: chainBloom },
|
|
579
|
-
);
|
|
580
|
-
if (scored && scored.match_quality) {
|
|
581
|
-
matchQuality = scored.match_quality;
|
|
582
|
-
if (Number.isFinite(scored.confidence)) confidence = scored.confidence;
|
|
583
|
-
}
|
|
584
|
-
} else if (calibration.status === 'none') {
|
|
585
|
-
matchQuality = 'unscored';
|
|
586
|
-
}
|
|
587
|
-
// Grounding for every chain, calibrated or not (grounding.mjs),
|
|
588
|
-
// from the passages fusion ranks first; recordId is the
|
|
589
|
-
// chain-global id of the graded passage.
|
|
590
|
-
{
|
|
591
|
-
const passageOrder = (fusedFull?.length ? fusedFull : searched).slice(0, GROUNDING_PASSAGES);
|
|
592
|
-
const passageTexts = await Promise.all(passageOrder.map(async (hit) => {
|
|
593
|
-
const owner = ownerOf(table, hit.id);
|
|
594
|
-
return (await searchTiers[owner.tier.tier].reader.hydrate(owner.localId))?.text ?? '';
|
|
595
|
-
}));
|
|
596
|
-
const graded = groundQuery(queryOptions.text ?? '', passageTexts);
|
|
597
|
-
if (graded) grounding = { ...graded, recordId: passageOrder[graded.passageIndex]?.id ?? null };
|
|
598
|
-
}
|
|
599
|
-
// A 'none' verdict withholds results, exactly as the
|
|
600
|
-
// single-file reader does: the calibrated abstention signal is
|
|
601
|
-
// doing its job, and a chain must not be a way to get results
|
|
602
|
-
// the base would have refused. showAbstained is the same
|
|
603
|
-
// explicit opt-out, and never changes matchQuality.
|
|
604
|
-
const withheld = matchQuality === 'none' && !queryOptions.showAbstained;
|
|
494
|
+
// Grounding (grounding.mjs), from the passages fusion ranks
|
|
495
|
+
// first; recordId is the chain-global id of the graded passage.
|
|
496
|
+
const passageOrder = (fusedFull?.length ? fusedFull : searched).slice(0, GROUNDING_PASSAGES);
|
|
497
|
+
const passageTexts = await Promise.all(passageOrder.map(async (hit) => {
|
|
498
|
+
const owner = ownerOf(table, hit.id);
|
|
499
|
+
return (await searchTiers[owner.tier.tier].reader.hydrate(owner.localId))?.text ?? '';
|
|
500
|
+
}));
|
|
501
|
+
const graded = groundQuery(queryOptions.text ?? '', passageTexts);
|
|
502
|
+
const grounding = graded ? { ...graded, recordId: passageOrder[graded.passageIndex]?.id ?? null } : null;
|
|
605
503
|
return {
|
|
606
|
-
|
|
607
|
-
...(confidence === undefined ? {} : { confidence }),
|
|
608
|
-
results: withheld ? [] : results,
|
|
504
|
+
results,
|
|
609
505
|
...(grounding ? { grounding } : {}),
|
|
610
506
|
identity: chainMembers[chainMembers.length - 1].identity,
|
|
611
|
-
calibration: {
|
|
612
|
-
status: calibration.status,
|
|
613
|
-
drift: calibration.drift,
|
|
614
|
-
effectiveLimit: calibration.effectiveLimit,
|
|
615
|
-
producerEnvelope: calibration.producerEnvelope,
|
|
616
|
-
readerLimit: calibration.readerLimit,
|
|
617
|
-
},
|
|
618
507
|
};
|
|
619
508
|
},
|
|
620
509
|
|
|
@@ -674,8 +563,6 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
674
563
|
return { ...ev, evaluationScope: 'base', evaluationIdentity: base.identity };
|
|
675
564
|
},
|
|
676
565
|
|
|
677
|
-
chainBloom() { assertOpen(); return chainBloom; },
|
|
678
|
-
|
|
679
566
|
/**
|
|
680
567
|
* The stored bytes of each id's record, from its owning tier's
|
|
681
568
|
* corpus segment and verified per record, in the order ids were
|
|
@@ -756,7 +643,6 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
756
643
|
get __head() {
|
|
757
644
|
assertOpen();
|
|
758
645
|
const last = chainMembers[chainMembers.length - 1];
|
|
759
|
-
const baseMember = chainMembers[0];
|
|
760
646
|
return {
|
|
761
647
|
identity: last.identity,
|
|
762
648
|
depth: last.depth,
|
|
@@ -766,13 +652,10 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
766
652
|
records: last.records,
|
|
767
653
|
bitset: headBitset,
|
|
768
654
|
baseIdentity: base.identity,
|
|
769
|
-
baseRecords: baseMember.records,
|
|
770
655
|
// The base sketch's numeric metric code, which
|
|
771
656
|
// exportSketchArtifact writes verbatim. manifest.metric is
|
|
772
657
|
// the string form and is not interchangeable with it.
|
|
773
658
|
metricCode: base.sketch.metric,
|
|
774
|
-
// Sum of every layer's records, for the drift numerator.
|
|
775
|
-
appendedBefore: chainMembers.slice(1).reduce((n, m) => n + m.records, 0),
|
|
776
659
|
// 6.1 needs the base's kind to decide appendability, its
|
|
777
660
|
// ingestion declaration to enforce granularity, and its
|
|
778
661
|
// chunking so new records are cut the same way. The kind
|
|
@@ -786,16 +669,6 @@ export async function openPikeletChain(members, options = {}) {
|
|
|
786
669
|
// them verbatim: compaction MUST NOT change the encoder,
|
|
787
670
|
// dim, metric, ingestion or tokenization (6.3), and the
|
|
788
671
|
// surest way not to is to carry the same bytes.
|
|
789
|
-
// The base's bloom geometry, which every layer's bloom
|
|
790
|
-
// MUST match so the chain's union is an exact bitwise OR
|
|
791
|
-
// (4.5). Null when the base carries no fit.
|
|
792
|
-
baseBloomGeometry: baseCal?.asset?.vocabBloom
|
|
793
|
-
? {
|
|
794
|
-
bits: baseCal.asset.vocabBloom.bits,
|
|
795
|
-
hashes: baseCal.asset.vocabBloom.hashes,
|
|
796
|
-
minCount: baseCal.asset.vocabBloom.minCount ?? null,
|
|
797
|
-
}
|
|
798
|
-
: null,
|
|
799
672
|
readBaseQueryInterp: () => {
|
|
800
673
|
const seg = base.segments.get('query-interp');
|
|
801
674
|
if (!seg) return null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Two producers appending to the same parent create a fork. Both chains are
|
|
4
4
|
// valid; the ref names one head. The other layer is re-based onto it: its rows,
|
|
5
|
-
// sketches, records
|
|
5
|
+
// sketches, records and postings are copied verbatim (nothing is
|
|
6
6
|
// re-embedded, local ids do not change), and its rowBase, bitset, supersessions
|
|
7
7
|
// and evaluation material are recomputed.
|
|
8
8
|
//
|
package/complete/wordpiece.mjs
CHANGED
|
@@ -64,27 +64,5 @@ export function createWordPiece(vocabText) {
|
|
|
64
64
|
ids.push(SEP);
|
|
65
65
|
return ids;
|
|
66
66
|
},
|
|
67
|
-
// Same as encode(), but also reports which basic (whitespace/punct-
|
|
68
|
-
// split) word each output token belongs to, as a same-length array of
|
|
69
|
-
// word indices (CLS and SEP get -1 — they belong to no word). A word
|
|
70
|
-
// that WordPiece splits into several sub-tokens (e.g. "quantization"
|
|
71
|
-
// -> "quant" + "##ization") reports the same word index for all of
|
|
72
|
-
// them, so a caller building one vector per word can average or
|
|
73
|
-
// otherwise pool the sub-token hidden states back into a single
|
|
74
|
-
// word-level vector — needed for MaxSim-style token-level grounding,
|
|
75
|
-
// where coverage must be measured in words, not WordPiece pieces.
|
|
76
|
-
encodeWithWordMap(text) {
|
|
77
|
-
const ids = [CLS];
|
|
78
|
-
const wordOf = [-1];
|
|
79
|
-
const words = basicTokenize(text);
|
|
80
|
-
words.forEach((word, wi) => {
|
|
81
|
-
const pieces = wordpiece(word);
|
|
82
|
-
ids.push(...pieces);
|
|
83
|
-
for (let i = 0; i < pieces.length; i++) wordOf.push(wi);
|
|
84
|
-
});
|
|
85
|
-
ids.push(SEP);
|
|
86
|
-
wordOf.push(-1);
|
|
87
|
-
return { ids, wordOf, words };
|
|
88
|
-
},
|
|
89
67
|
};
|
|
90
68
|
}
|
package/dist/engine.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=false;var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}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");scriptDirectory=__dirname+"/";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,"/")}arguments_=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{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}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);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}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&&!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(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}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 callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{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=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;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===0||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};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;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){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;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 wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};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)=>{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++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};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)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(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?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";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==="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===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)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)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={n:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,j:___cxa_find_matching_catch_3,l:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,i:invoke_iii,m:invoke_iiii,f:invoke_iiiiii,b:invoke_v,g:invoke_vii,e:invoke_viii,h:invoke_viiii,k:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
1
|
+
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=false;var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}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");scriptDirectory=__dirname+"/";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,"/")}arguments_=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{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}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);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}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&&!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(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}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 callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{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=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;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===0||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};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;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){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;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 wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};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)=>{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++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};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)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(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?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";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==="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===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)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)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={n:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,j:___cxa_find_matching_catch_3,l:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,i:invoke_iii,m:invoke_iiii,g:invoke_iiiiii,b:invoke_v,f:invoke_vii,e:invoke_viii,h:invoke_viiii,k:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
2
2
|
;return moduleRtn}})();if(typeof exports==="object"&&typeof module==="object"){module.exports=P;module.exports.default=P}else if(typeof define==="function"&&define["amd"])define([],()=>P);
|
package/dist/engine.scalar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;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 arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}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");scriptDirectory=__dirname+"/";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,"/")}arguments_=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{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}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);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.scalar.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}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&&!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(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}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 callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{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=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;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===0||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};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;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){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;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 wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};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)=>{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++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};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)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(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?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";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==="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===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)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)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={n:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,j:___cxa_find_matching_catch_3,l:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,i:invoke_iii,m:invoke_iiii,e:invoke_iiiiii,b:invoke_v,f:invoke_vii,g:invoke_viii,h:invoke_viiii,k:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
1
|
+
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;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 arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}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");scriptDirectory=__dirname+"/";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,"/")}arguments_=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{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}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);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.scalar.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}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&&!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(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}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 callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{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=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;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===0||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};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;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){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;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 wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};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)=>{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++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};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)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(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?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";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==="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===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)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)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={n:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,j:___cxa_find_matching_catch_3,l:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,i:invoke_iii,m:invoke_iiii,g:invoke_iiiiii,b:invoke_v,f:invoke_vii,e:invoke_viii,h:invoke_viiii,k:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)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!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
2
2
|
;return moduleRtn}})();if(typeof exports==="object"&&typeof module==="object"){module.exports=P;module.exports.default=P}else if(typeof define==="function"&&define["amd"])define([],()=>P);
|
package/dist/engine.scalar.wasm
CHANGED
|
Binary file
|
package/dist/engine.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pikelet-wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Vector search engine and .pikelet artifact readers/builders, in WebAssembly. Compile a corpus into one self-contained, hash-verified search file, or use the underlying HNSW engine directly. Runs in Node.js, browsers, and Cloudflare Workers with no native dependencies.",
|
|
5
5
|
"main": "src/pikelet.js",
|
|
6
6
|
"types": "src/pikelet.d.ts",
|