@kedem/okdb 2.2.0 → 2.3.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 +317 -0
- package/algorithm-worker-thread.js +1 -1
- package/bin/okdb.js +1 -1
- package/docs/embeddings.md +83 -5
- package/docs/fts.md +1 -1
- package/docs/licensing.md +75 -14
- package/docs/manifest.json +1 -0
- package/docs/resolved-fields.md +79 -0
- package/okdb-functions-sandbox-worker.js +1 -1
- package/okdb-http-worker-child.js +1 -1
- package/okdb-views-bootstrap-worker.js +1 -1
- package/okdb.js +1 -1
- package/package.json +1 -1
- package/public/modules/ok.js +1 -1
- package/public/sections/db/modals/create-env-modal.ok.js +1 -1
- package/public/sections/db/modals/remove-env-modal.ok.js +1 -1
- package/public/sections/db/modals/schema-edit-modal.ok.js +1 -1
- package/public/sections/embeddings/parts/embed-create-panel.ok.js +1 -1
- package/public/sections/embeddings/parts/embed-search-panel.ok.js +1 -1
- package/public/sections/embeddings/parts/pipeline-try-search.ok.js +1 -1
- package/public/sections/license/parts/license-panel.ok.js +1 -1
- package/public/sections/queue/modals/create-bucket-modal.ok.js +1 -1
- package/public/sections/queue/modals/edit-bucket-modal.ok.js +1 -1
- package/public/sections/sync/index.ok.html +2 -2
- package/public/sections/sync/modals/connect-peer-modal.ok.js +1 -1
- package/public/sections/system/parts/system-sync-panel.ok.js +1 -1
- package/public/vendor/okjs/ok.esm.min.js +1 -1
- package/public/vendor/okjs/toolkit/devtools/devtools-window.js +1 -0
- package/public/vendor/okjs/toolkit/devtools/ok-console.ok.js +1 -1
- package/public/vendor/okjs/toolkit/devtools/ok-crash-explorer-service.ok.js +1 -0
- package/public/vendor/okjs/toolkit/devtools/ok-crash-explorer.ok.js +1 -0
- package/public/vendor/okjs/toolkit/elements/ok-icon.ok.js +1 -1
- package/public/vendor/okjs/toolkit/errors/crash-minimal.ok.js +1 -0
- package/public/vendor/okjs/toolkit/errors/ok-crash-boundary.ok.js +1 -1
- package/public/vendor/okjs/toolkit/errors/ok-crash-info.ok.js +1 -1
- package/public/vendor/okjs/toolkit/manifest.js +1 -1
- package/types/environment.d.ts +26 -0
- package/types/features/licenses.d.ts +86 -0
- package/types/index.d.ts +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@kedem/okdb` are documented here. Format loosely follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
|
|
5
|
+
Dates are release dates.
|
|
6
|
+
|
|
7
|
+
## [2.3.0] - 2026-09-24
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Resolved fields** (`env.resolveField(type, field, fn)`): index content okdb never stores.
|
|
12
|
+
FTS (live drain and builds), the embeddings indexer and search-result chunk text read the field
|
|
13
|
+
through an app-registered resolver when a row has no stored value — e.g. rows of `{ rel, hash }`
|
|
14
|
+
with file text served from disk. The declaration is durable; a process that runs those indexes
|
|
15
|
+
without the resolver holds them with `FIELD_RESOLVER_MISSING` (the drain waits for the resolver;
|
|
16
|
+
no doc is marked failed) instead of indexing empty text. A resolver error fails that item only. Also `unresolveField`, `resolvedFields`, `readField`.
|
|
17
|
+
**Batch resolvers** (`resolveField(type, field, fn, { batch, batchSize })`) resolve many rows per
|
|
18
|
+
call — FTS drains/builds and the embeddings indexer prefetch a whole batch in one call (for a
|
|
19
|
+
remote source: one round trip per batch instead of per row).
|
|
20
|
+
Measured on okdb's own `src/` (265 files, 5.2 MB): identical FTS and vector results, source
|
|
21
|
+
env 2.6 MB → 0.27 MB. See `docs/resolved-fields.md`.
|
|
22
|
+
- Vector search views: `algorithm_config.idleEvictMs` (or `OKDB_VECTOR_VIEW_IDLE_EVICT_MS`) sets
|
|
23
|
+
a view's idle-eviction delay (default 5 min; `0` keeps it resident; `stats()` reports it), and
|
|
24
|
+
usearch `algorithm_config.snapshotMaxLagMs` bounds reader lag (see Fixed).
|
|
25
|
+
- `okdb.embeddings.getEmbedderFactory(type)` / `getEmbedderSchema(type)`: the factory (built-in or
|
|
26
|
+
registered) and field schema of an embedder type, e.g. to wrap a built-in provider and supply its
|
|
27
|
+
API key at runtime instead of storing it in the pipeline's durable config.
|
|
28
|
+
- **`db.licenses`** — install and inspect licenses from code (after `open()`): `add(input)` takes
|
|
29
|
+
a license blob, an activation token (auto-detected) or `{ blob, activation }`, takes effect
|
|
30
|
+
immediately, and is idempotent (re-adding a stored license returns it with `changed:false`);
|
|
31
|
+
`activate(token)`, `remove(id)`, `list()`, `get(id)`, and `effective()` (the active license or
|
|
32
|
+
the free tier, with `enforced`). Results are summaries (`id`, `type`, `status`,
|
|
33
|
+
`needsActivation`, `pin`, `expiresAt`, `features`, `limits`) — never the blob or token. The
|
|
34
|
+
admin license routes and `okdb license` now go through it. See `docs/licensing.md`.
|
|
35
|
+
- **`OKDB_LICENSE_FILE`**: `open()` installs the license in that file (blob, token, or both)
|
|
36
|
+
through the same idempotent path, before license-gated features and engines start. A missing or
|
|
37
|
+
invalid file is a warning (error code only, never the content); `open()` continues.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- **Free tier covers embeddings pipelines and 5 environments** (unlicensed prod builds), so an
|
|
42
|
+
embedded code index — a management env plus one env per workspace, each with an embeddings
|
|
43
|
+
pipeline — works out of the box for up to three workspaces. `embeddings` is on: the members of
|
|
44
|
+
an embeddings pipeline (embedder, indexer, vector-search, embed-worker engines) are licensed by
|
|
45
|
+
`embeddings` as well as `engines`, and load at open when either is enabled (previously an
|
|
46
|
+
unlicensed boot skipped every engine). A new free-tier-only limit, `pipelinesPerEnv` (2), bounds
|
|
47
|
+
them — counted as the env's indexer engines, refused before any member is created. `envs`
|
|
48
|
+
(which counts `default`) is 5, was 2. The generic `engines` platform (custom drivers,
|
|
49
|
+
standalone engines of other types) stays licensed. Paid licenses are unaffected: the license
|
|
50
|
+
format has no `pipelinesPerEnv` field, so a license is never bounded by it; a license with
|
|
51
|
+
`embeddings` but not `engines` can now actually run pipelines. Internal (`~`) envs, which the
|
|
52
|
+
`envs` limit never counted, are no longer refused by it either (a pipeline's
|
|
53
|
+
`~<env>:emb:<type>` env failed once the user envs were at the limit). See `docs/licensing.md`.
|
|
54
|
+
- Admin license routes (`POST /admin/license`, `POST /admin/license/:id/activate`) return the
|
|
55
|
+
license summary (no raw blob/token), and re-adding a stored license is an idempotent success
|
|
56
|
+
(was a 400 "License already stored"). `okdb license <blob>` likewise reports "already stored"
|
|
57
|
+
instead of failing. Internally a duplicate add is `LICENSE_ALREADY_STORED` (was
|
|
58
|
+
`LICENSE_INVALID`, the same code as a bad signature).
|
|
59
|
+
- **Embeddings indexing rebuilt around one idempotent `reconcile`.** For each document the
|
|
60
|
+
indexer compares the chunk content hashes the source doc calls for with the vectors actually
|
|
61
|
+
stored, embeds only the missing ones, deletes the stale ones, and records the outcome. Inline
|
|
62
|
+
drains and queue workers share it. Measured on 100 docs × 768 dims, half of them edited once:
|
|
63
|
+
the embeddings env per doc went from 100 → 34 KB (queue, chunked), 61 → 30 KB (inline,
|
|
64
|
+
chunked), 13 → 9 KB (queue, unchunked).
|
|
65
|
+
- Queue jobs are references: payload `{ key }` only (was the full job context plus a copy of
|
|
66
|
+
the chunk text), one job per doc (was one per chunk), write bursts folded into the pending
|
|
67
|
+
job (`idempotency_scope: 'pending'`, see below). New `debounce` option (ms) holds jobs back so
|
|
68
|
+
an edit burst embeds only the final text.
|
|
69
|
+
- Embed requests are batched (`batch`, default 32), across documents in inline mode.
|
|
70
|
+
`embedBatch(texts)` is a new optional embedder hook; the built-in `openai` and `ollama`
|
|
71
|
+
embedders implement it natively (one HTTP request per batch).
|
|
72
|
+
- Editing a field the pipeline doesn't embed costs no embed call and no write (was a full
|
|
73
|
+
re-embed). Non-chunked docs record a content `hash` for this.
|
|
74
|
+
- The hash→vector cache is a bounded LRU (`cache`, default 1024) instead of every stored vector
|
|
75
|
+
loaded into memory at startup.
|
|
76
|
+
- **Vectors are stored as raw float32 bytes** (3 KB per 768-dim vector, was ~6.9 KB as a msgpack
|
|
77
|
+
float64 array). A raw `vec:` row read through the generic data API is now a byte buffer, not a
|
|
78
|
+
number array — use `okdb.embeddings.getVector()`. Pre-2.3 rows still decode (the migration
|
|
79
|
+
keeps them); they convert as they're rewritten.
|
|
80
|
+
- **`doc_status` rows are trimmed** to `source_key`, `status`, `version`, `clock`, `updated`,
|
|
81
|
+
`error`, `empty`, and `hash` (unchunked) or `chunks[{hash,start,end}]`. Gone: `engine_key`, `mode`, `created`,
|
|
82
|
+
`chunk_strategy`, `total_chunks`, chunk text. `error`/`empty` are present only when set.
|
|
83
|
+
Rows are ordered by the source doc `version` and never regress.
|
|
84
|
+
- **Deleting a source doc deletes its `doc_status` row** (no `deleted` tombstones kept forever).
|
|
85
|
+
- **`chunk_status:<storage_key>` is gone** (a second copy of every chunk manifest, rewritten per
|
|
86
|
+
chunk). `listDocStatus` still reports `chunk_done` for chunked docs.
|
|
87
|
+
- **`chunk.storeText` is ignored**: chunk text is no longer copied into `doc_status`; search
|
|
88
|
+
results derive it from the current source doc (`okdb.embeddings.describeChunk()`). The admin
|
|
89
|
+
UI's "Store chunk text" checkbox (on by default) is removed.
|
|
90
|
+
- **Storage migration `2.3.0` / `embeddings-lean-layout`** (runs once on first open, before
|
|
91
|
+
engines boot, recorded in `~migrations`): drops each pipeline's pre-2.3 `doc_status`,
|
|
92
|
+
`chunk_status` and queued embedding jobs, removes vectors whose source doc no longer exists,
|
|
93
|
+
and resets the indexer to replay from clock 0.
|
|
94
|
+
Vectors are kept — chunked docs rebuild their status from the stored chunk hashes with **no
|
|
95
|
+
embed calls** and search keeps serving throughout; unchunked docs re-embed once (pre-2.3 rows
|
|
96
|
+
carry no content hash). `OKDB_EMBEDDINGS_REEMBED=1` also drops the vectors for a full
|
|
97
|
+
re-embed. The store is stamped `2.3.0`, so okdb 2.2.x refuses to open it (it cannot read
|
|
98
|
+
the new vector encoding).
|
|
99
|
+
- `okdb.embeddings.describeChunk()` is now async (it may read a resolved field).
|
|
100
|
+
- Indexer API: `reconcile(key, { heartbeat })` added (the embed-worker's entry point);
|
|
101
|
+
`markDone` no longer takes a `chunks` manifest; `markDelete` removes the row.
|
|
102
|
+
- Queue: `enqueue(..., { idempotency_scope: 'pending' })` — the idempotency key dedups against
|
|
103
|
+
pending jobs only and is released at claim, so a change arriving while a job runs enqueues a
|
|
104
|
+
follow-up instead of folding into the running job.
|
|
105
|
+
|
|
106
|
+
### Fixed
|
|
107
|
+
|
|
108
|
+
- **Queue calls wait out a peer's compaction instead of failing.** When another process
|
|
109
|
+
compacted the env, this process closed its handle for the ~seconds-long swap, and any queue call
|
|
110
|
+
in that window (`enqueue`, `markJobComplete`/`Fail`, `releaseClaim`, `getJob`, …) threw
|
|
111
|
+
`INVALID_STATE` "OKDB not opened" from its first read before reaching the write path's drain
|
|
112
|
+
park. Enqueues were lost, and finished jobs stayed `running` until their claim expired. Queue
|
|
113
|
+
entrypoints now wait for the reopen, as `env.put`/`txn` already did; a genuinely closed env still
|
|
114
|
+
fails immediately.
|
|
115
|
+
|
|
116
|
+
- **Vector search views now always converge to the stored vectors** (usearch and hnsw; flat
|
|
117
|
+
already did). A view that idle-evicted (5 min without a search) skipped live updates while
|
|
118
|
+
unloaded, and its next load served its own stale snapshot without replaying the stored
|
|
119
|
+
vectors — anything embedded while it was unloaded was missing from the graph for good (load 5,
|
|
120
|
+
evict, add 10, reload → 5 of 15). Every load (and every reader→writer promotion) now diffs the
|
|
121
|
+
snapshot against the `vec:` rows via per-key vector fingerprints stored with the snapshot
|
|
122
|
+
(labels v2) and applies the missing adds, replaced vectors and removes. A pre-2.3 snapshot
|
|
123
|
+
(no fingerprints) is rebuilt from the rows once.
|
|
124
|
+
- **usearch: a process holding `WRITER.LOCK` could be a reader, leaving nobody to write the
|
|
125
|
+
graph** (~2 in 10 evictions landing near a change-count publish). Ownership was by pid, so an
|
|
126
|
+
evicted view's replacement worker in the same process didn't recognise — or could release —
|
|
127
|
+
its sibling's lock; and a live update delivered to the not-yet-loaded replacement promoted it
|
|
128
|
+
to writer, after which its own load saw its fresh lock and turned reader while its heartbeat
|
|
129
|
+
kept the lock alive. The lock is now owned by a per-instance token (a writer whose lock was
|
|
130
|
+
taken over demotes itself), writes to an unloaded instance are dropped (the load reconciles
|
|
131
|
+
them), the fanout tail pins the instance for a batch, and a reload waits for the evicted
|
|
132
|
+
instance to publish and release first. A reader whose writer is gone takes over on its next
|
|
133
|
+
search instead of serving the last snapshot forever.
|
|
134
|
+
- **usearch/hnsw: change-count snapshot publishes stopped after the first eviction.** Snapshot
|
|
135
|
+
ids mixed two clocks — the changelog counter (change-count publishes) and `Date.now()`
|
|
136
|
+
(stop/eviction/explicit publishes) — so after one wall-clock publish every change-count publish
|
|
137
|
+
was rejected as stale, readers froze at that snapshot, and every later add re-saved the whole
|
|
138
|
+
index into a tmp dir that was then discarded. Internal publishes now use one monotonic id.
|
|
139
|
+
- **usearch readers are fresh within `snapshotMaxLagMs` (new, default 10 s)**: the writer
|
|
140
|
+
publishes once the oldest unpublished change is that old, stretched to 10× the last publish's
|
|
141
|
+
duration so a large index spends at most ~10% of its time saving. `snapshotEveryChanges`
|
|
142
|
+
(still 50 000) is now only a burst cap; as the only trigger it meant a reader of a typical
|
|
143
|
+
(< 50k) index never saw a publish until the writer's view was evicted.
|
|
144
|
+
- hnsw: growing past capacity rebuilt the graph from the rows captured at load, dropping every
|
|
145
|
+
vector added since; it now resizes in place.
|
|
146
|
+
- A usearch reader's cold load no longer reads and ships every stored vector to its worker
|
|
147
|
+
thread (the algorithm pulls rows only when it needs them); vectors cross to the worker as
|
|
148
|
+
Float32Arrays instead of boxed arrays.
|
|
149
|
+
- Search view `rebuild()` on an unloaded view marked it loaded without loading it.
|
|
150
|
+
- `removeEnvironment` deleted sub-environment directories (e.g. the embeddings env
|
|
151
|
+
`~<env>:emb:<type>`) using their RELATIVE registry path, i.e. relative to `process.cwd()`:
|
|
152
|
+
the real directory was left behind, and a same-named directory in the current working
|
|
153
|
+
directory would have been deleted instead. Paths now resolve under the store root, and a
|
|
154
|
+
non-absolute path is refused.
|
|
155
|
+
- Chunked queue-mode pipelines left the previous version's chunk vectors in place on every update
|
|
156
|
+
(a doc edited once held twice its vectors; search could match text the doc no longer has),
|
|
157
|
+
embedded superseded versions from queued jobs, and could report a doc DONE for an older
|
|
158
|
+
version while its current chunks were still pending.
|
|
159
|
+
- Deleting a source doc from a chunked queue-mode pipeline never removed its vectors (the delete
|
|
160
|
+
path called a storage `scan()` that the vector store doesn't have), so deleted docs stayed
|
|
161
|
+
searchable. The 2.3.0 migration removes the leftovers.
|
|
162
|
+
- `durableRetryDoc`/`durableRetryFailed`/`durableRebuild` now work for chunked queue-mode
|
|
163
|
+
pipelines too.
|
|
164
|
+
- Queue-mode embedding pipelines kept every completed job and its payload forever
|
|
165
|
+
(`~queue_jobs` / `~queue_payloads` in `~<env>:emb:<type>`) — one row pair per document, or
|
|
166
|
+
per chunk for chunked pipelines (whose payloads carry a copy of `chunk_text`), re-added on
|
|
167
|
+
every source update and "Re-embed all". Embedding jobs are now enqueued with `done_ttl: 0`
|
|
168
|
+
(deleted on completion; `doc_status` remains the durable record); jobs left by older builds
|
|
169
|
+
are dropped by the 2.3.0 migration. Failed jobs are still kept for inspection/retry. Side effect: the worker's "Queue" metric
|
|
170
|
+
now shows the real backlog instead of every job ever enqueued.
|
|
171
|
+
- **Writer: a transaction issued while another was held open ran nested inside it.** lmdb-js keeps
|
|
172
|
+
an async write txn open while its callback's promise is pending (FTS holds its post txn across
|
|
173
|
+
the docs commit); a `childTransaction` issued in that window ran synchronously inside the
|
|
174
|
+
holder's txn — the write silently joined it (lost if the holder aborted) and the writer crashed
|
|
175
|
+
on the non-promise result. New transactions on that writer now wait for the hold to settle; a
|
|
176
|
+
nested result from a caller outside the writer is accounted for and warned instead of crashing.
|
|
177
|
+
- **A failed FTS build left the index stuck in `RESETTING`** and `fts.ready()` waiting forever. The
|
|
178
|
+
index now goes to the `error` state (message in `fts.list(type)[i].error`) and `ready()` rejects
|
|
179
|
+
with `FTS_BUILD_FAILED`; `fts.reset()` or the next `open()` retries the build.
|
|
180
|
+
- A pending FTS reset racing a type drop crashed on its own "dropped before the reset completed"
|
|
181
|
+
guard.
|
|
182
|
+
- `removeEnvironment` (and env close) now deregisters the env's engines in-process — re-creating
|
|
183
|
+
the env and its pipeline in the same process failed with "Engine already exists".
|
|
184
|
+
- `pipelines.remove` now drops the pipeline's vectors and resets its indexer cursor (vectors were
|
|
185
|
+
kept forever, and a re-created pipeline skipped docs it had indexed before); `indexer.rebuild()`
|
|
186
|
+
on the lazy vector adapter really drops the vectors now.
|
|
187
|
+
- `embeddings.durableRebuild()` from a passive (`processors:false`/`engines:false`) process now
|
|
188
|
+
reaches the live indexer in the owning process (durable command epoch + a processor hint)
|
|
189
|
+
and makes it re-embed (the live indexer never noticed); a restart does not replay the reset.
|
|
190
|
+
Processors no longer re-run their last command at every registration, and a registration
|
|
191
|
+
stopped while acquiring its lease no longer leaks a heartbeating lease.
|
|
192
|
+
- `bus.stop()` flushes pending sends — hints sent right before close/exit were lost.
|
|
193
|
+
- Admin UI: works with `@kedem/okjs` 1.3 (its import of the removed `ok-crash-info` component
|
|
194
|
+
failed the whole module graph; the crash screen's details now come from
|
|
195
|
+
`ok-crash-explorer-service`), and Enter-to-submit works again in 10 dialogs
|
|
196
|
+
(`@keydown:enter` — `@keydown.enter` never bound a key filter).
|
|
197
|
+
|
|
198
|
+
## [2.2.1] - 2026-08-25
|
|
199
|
+
|
|
200
|
+
### Fixed
|
|
201
|
+
|
|
202
|
+
- **Regression in 2.2.0**: `query()` with an `index` + `reverse: true` + any bound (`prefix`,
|
|
203
|
+
flat `startIndex`/`endIndex`, or the nested `index: {fields, start, end}` form) silently
|
|
204
|
+
returned zero rows instead of the correct descending range. Caused by 2.2.0's own
|
|
205
|
+
`byIndex`/`getIndex`/`countByIndex` reverse-swap fix stacking on top of `query()`'s
|
|
206
|
+
pre-existing internal swap — the two canceled out. Fixed by splitting `byIndex()` into a
|
|
207
|
+
public normalizing wrapper and a private `_byIndexCore` that `query()` calls directly,
|
|
208
|
+
bypassing the double normalization. Direct `byIndex()`/`getIndex()`/`countByIndex()` callers
|
|
209
|
+
are unaffected.
|
|
210
|
+
|
|
211
|
+
## [2.2.0] - 2026-08-25
|
|
212
|
+
|
|
213
|
+
### Fixed
|
|
214
|
+
|
|
215
|
+
- `byIndex`/`getIndex`/`countByIndex({prefix})` silently ignored `prefix` and returned the
|
|
216
|
+
whole unfiltered index instead of a prefix match.
|
|
217
|
+
- `byIndex`/`getIndex`/`countByIndex` combined with `reverse: true` and natural-order
|
|
218
|
+
`start`/`end` silently returned zero rows (lmdb's own reverse convention wants `start` as
|
|
219
|
+
the higher bound; these now swap automatically, matching the documented direction-independent
|
|
220
|
+
contract).
|
|
221
|
+
- `query()` silently ignored a flat `start`/`end` option (only `startIndex`/`endIndex`, or the
|
|
222
|
+
nested `index: {start, end}` form, were ever wired up) and ran an unfiltered scan instead.
|
|
223
|
+
Passing `start`/`end` now throws immediately, pointing at the correct option names.
|
|
224
|
+
- `OKDBTransaction.query()` was not honoring `useReadTransaction` — a `txn.query()` call inside
|
|
225
|
+
a `useReadTransaction: true` transaction silently read live data instead of the transaction's
|
|
226
|
+
pinned consistent snapshot, unlike its `getRange`/`byIndex`/`get` siblings on the same
|
|
227
|
+
transaction. `query()` now threads the transaction through correctly.
|
|
228
|
+
- `$countBy` view results: `docs/views.md` and `types/features/views.d.ts` documented/typed a
|
|
229
|
+
plain `{ [groupKey]: { value } }` shape; the actual (correct, unchanged) runtime shape is the
|
|
230
|
+
paginated `{ totalGroups, preview: [...], hasMore, cursor }`. Docs and types corrected to
|
|
231
|
+
match reality — this also affects `$group` and `$ref`-nested grouped reducers, and the
|
|
232
|
+
`range()`/bucketed-view output shape.
|
|
233
|
+
- `docs/embeddings.md`: indexer `stats()` documented as `{ total, pending, embedded, failed }`;
|
|
234
|
+
actual shape is `{ doc_counts: { pending, done, failed, deleted, total }, ... }`.
|
|
235
|
+
|
|
236
|
+
### Changed
|
|
237
|
+
|
|
238
|
+
- **New strict option validation**: `getRange`, `getKeys`, `getCount`, `getIndex`, `byIndex`,
|
|
239
|
+
`countByIndex`, and `query()` now throw on any option key outside that method's real
|
|
240
|
+
vocabulary, instead of silently ignoring it. This is the root-cause fix behind several of the
|
|
241
|
+
bugs above — an unrecognized option previously produced a plausible wrong answer instead of an
|
|
242
|
+
error. **This can be a breaking change** for callers passing a typo'd, extra, or
|
|
243
|
+
wrong-surface option key that was previously tolerated silently (see `types/options.d.ts`:
|
|
244
|
+
`OKDBQueryOptions` for `query()`'s real vocabulary, `OKDBIndexRangeOptions` for
|
|
245
|
+
`byIndex`/`getIndex`/`countByIndex`'s).
|
|
246
|
+
- `types/options.d.ts`: split `OKDBQueryOptions` (query()'s vocabulary — `start`/`end` removed,
|
|
247
|
+
`endIndex`/`startKey`/`endKey` added) from a new `OKDBIndexRangeOptions`
|
|
248
|
+
(`byIndex`/`getIndex`/`countByIndex`'s lmdb-native vocabulary). They previously shared one
|
|
249
|
+
type, which is how `start`/`end` leaked into `query()`'s type despite never being implemented
|
|
250
|
+
there.
|
|
251
|
+
|
|
252
|
+
### Docs
|
|
253
|
+
|
|
254
|
+
- `docs/querying.md`: added the previously-undocumented `startIndex`/`endIndex` example for
|
|
255
|
+
non-prefix index ranges in `query()`, and notes on the new throw-on-unknown-key behavior and
|
|
256
|
+
the direction-independent `start`/`end` guarantee.
|
|
257
|
+
|
|
258
|
+
## [2.1.2] - 2026-08-21
|
|
259
|
+
|
|
260
|
+
### Fixed
|
|
261
|
+
|
|
262
|
+
- Admin engines page: `ACTIVATION_FAILED` on load — an inline `.ok.html` `<script type="module">`
|
|
263
|
+
is loaded via a blob URL with no hierarchical base, so a relative import to a plain
|
|
264
|
+
(non-`.ok.js`) file failed. Inlined the helper instead of importing it.
|
|
265
|
+
- `release-check.js`'s tag-vs-HEAD comparison broke on annotated tags (`npm version`'s default):
|
|
266
|
+
`refs/tags/<tag>` resolves to the tag _object's_ own SHA for an annotated tag, not the commit
|
|
267
|
+
it points at, so the comparison never matched even when the tag was correctly placed. Now peels
|
|
268
|
+
annotated tags to their target commit before comparing.
|
|
269
|
+
|
|
270
|
+
## [2.1.1] - 2026-08-21
|
|
271
|
+
|
|
272
|
+
### Fixed
|
|
273
|
+
|
|
274
|
+
- Passive-node (`engines: false`) embedding pipeline visibility: a node not running its own
|
|
275
|
+
engines showed members as "missing" with zero progress, and every action
|
|
276
|
+
(retry/rebuild/view vector) either threw `ENGINE_NOT_RUNNING_HERE` or silently no-opped — even
|
|
277
|
+
when the pipeline was running fine on a separate `engines: true` process against the same
|
|
278
|
+
path. Status/progress/actions now distinguish "running elsewhere" (remote) from genuinely
|
|
279
|
+
missing/broken, and read real progress, doc status, vectors, and processor cursors directly
|
|
280
|
+
from durable LMDB state instead of requiring a live in-process engine.
|
|
281
|
+
- `doc_counts.total` was undercounting mid-bootstrap/rebuild (only counted rows touched so far).
|
|
282
|
+
- Doc listing, mark done/failed/deleted, and single/bulk retry now work durably on a passive
|
|
283
|
+
node; empty content is correctly `DONE`, not `FAILED` (was polluting the failed count and
|
|
284
|
+
looping forever on retry).
|
|
285
|
+
- "Re-embed all" actually wipes+resets+re-enqueues now, instead of a silent no-op 200.
|
|
286
|
+
- "View vector" reads vectors directly from LMDB (including chunked pipelines) instead of
|
|
287
|
+
requiring a live engine's in-memory cache.
|
|
288
|
+
- Fixed a vector-write bug where `markDone`/`markDelete` silently skipped the actual vector
|
|
289
|
+
write in the default (no custom resolver) setup.
|
|
290
|
+
- Admin UI: pipeline-list members read the correct response field; progress bar live-updates
|
|
291
|
+
and stays visible at 100% on completion.
|
|
292
|
+
|
|
293
|
+
## [2.1.0] - 2026-08-08
|
|
294
|
+
|
|
295
|
+
### Changed — the safe-range contract (env-balloon fix)
|
|
296
|
+
|
|
297
|
+
LMDB range readers can no longer pin the freelist past a synchronous block: default
|
|
298
|
+
`getRange`/`getKeys`/`getValues` are renewable (an iterator held across an `await` neither
|
|
299
|
+
balloons the file nor breaks); pinned surfaces (`snapshot: true`, `byIndex`/`getIndex`,
|
|
300
|
+
`getChanges`, `useReadTransaction`) throw `READER_HELD_ACROSS_AWAIT` deterministically on
|
|
301
|
+
suspension, with an opt-in `'tolerant'` park-and-resume mode for callers who want it. See
|
|
302
|
+
`docs/upgrade-2.1.md` for the full contract and migration notes.
|
|
303
|
+
|
|
304
|
+
### Added
|
|
305
|
+
|
|
306
|
+
- Storage observability: per-env reclaimable %, reader pins, and compaction outcome surface in
|
|
307
|
+
the admin Environments table and env overview.
|
|
308
|
+
- Compaction temp-dir orphans are reaped on `open()`.
|
|
309
|
+
|
|
310
|
+
## [2.0.x] - 2026-07-07 – 2026-08-08
|
|
311
|
+
|
|
312
|
+
**okdb 2.0: the operator-managed rewrite.** Envs open lazily; async `OKDBWriter` funnels every
|
|
313
|
+
write through one choke point per env; `OKDBProcessor` unifies change-subscription across
|
|
314
|
+
views/indexes/FTS/materializer/embeddings/time-machine with a cooperative hold-window lease as
|
|
315
|
+
the load balancer; HTTP clustering, the function sandbox, and subscriptions v2 landed. See
|
|
316
|
+
`docs/upgrade-2.0.md` and the Architecture section of `CLAUDE.md` for the full model — this file
|
|
317
|
+
starts tracking change-by-change detail from 2.1.0 onward.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x67fb04=_0x43a8;(function(_0x5d1045,_0x1944e8){const _0x476e47=_0x43a8,_0x2a10c1=_0x5d1045();while(!![]){try{const _0x4f834f=parseInt(_0x476e47(0x124))/0x1+parseInt(_0x476e47(0x181))/0x2+parseInt(_0x476e47(0xd7))/0x3*(parseInt(_0x476e47(0x144))/0x4)+parseInt(_0x476e47(0xc3))/0x5*(-parseInt(_0x476e47(0x16a))/0x6)+parseInt(_0x476e47(0x10b))/0x7*(-parseInt(_0x476e47(0x183))/0x8)+-parseInt(_0x476e47(0x120))/0x9+-parseInt(_0x476e47(0x145))/0xa;if(_0x4f834f===_0x1944e8)break;else _0x2a10c1['push'](_0x2a10c1['shift']());}catch(_0x9f50a5){_0x2a10c1['push'](_0x2a10c1['shift']());}}}(_0x5bc2,0xf1ced));var require$$0$1=require(_0x67fb04(0xdf)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x67fb04(0x180));function getDefaultExportFromCjs(_0x46e66f){const _0x4cad82=_0x67fb04;return _0x46e66f&&_0x46e66f[_0x4cad82(0x12f)]&&Object[_0x4cad82(0x16d)]['hasOwnProperty'][_0x4cad82(0xed)](_0x46e66f,_0x4cad82(0xc2))?_0x46e66f[_0x4cad82(0xc2)]:_0x46e66f;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x22df5b=_0x67fb04;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x36a16c=require$$0,_0x1e8021=require$$1,_0x54b1d4=require$$2,_0x1d06f1=require$$3;function _0x4d6b2e(){const _0x4fd817=_0x43a8;return Date[_0x4fd817(0xcd)]();}function _0x420189(_0x19e7a5){const _0x11a1eb=_0x43a8;try{return _0x36a16c[_0x11a1eb(0xd4)](_0x19e7a5);}catch{return![];}}function _0x4f2378(_0x540d8c){const _0x44268d=_0x43a8;try{return _0x36a16c[_0x44268d(0x123)](_0x540d8c,_0x44268d(0xe6));}catch{return null;}}function _0x4e1dbd(_0x3b92f8,_0x1a5381){const _0x116b16=_0x43a8,_0x3e44fc=_0x3b92f8+_0x116b16(0x10e)+_0x1d06f1[_0x116b16(0x15b)](0x6)[_0x116b16(0xd8)](_0x116b16(0x14b));_0x36a16c[_0x116b16(0x179)](_0x3e44fc,_0x1a5381),_0x36a16c[_0x116b16(0x136)](_0x3e44fc,_0x3b92f8);}function _0x37381b(_0x58bcaa,_0x5d788b=0x10){const _0x3d1100=_0x43a8,_0x46c577=String(Math[_0x3d1100(0x11c)](0x0,Math[_0x3d1100(0x173)](_0x58bcaa||0x0)));return _0x46c577[_0x3d1100(0x13c)]>=_0x5d788b?_0x46c577:'0'['repeat'](_0x5d788b-_0x46c577[_0x3d1100(0x13c)])+_0x46c577;}return snapshotStore=class _0x4c5d79{constructor({dir:_0x38c571,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x232269=_0x43a8;if(!_0x38c571)throw new Error(_0x232269(0x119));this['dir']=_0x38c571,this[_0x232269(0xde)]=_0x1e8021[_0x232269(0xfb)](_0x38c571,_0x232269(0x104)),this[_0x232269(0x176)]=_0x1e8021[_0x232269(0xfb)](_0x38c571,'CURRENT'),this[_0x232269(0xeb)]=_0x1e8021['join'](_0x38c571,_0x232269(0xdb)),this[_0x232269(0x152)]=keepSnapshots,this[_0x232269(0x113)]=log,_0x36a16c[_0x232269(0x13d)](this[_0x232269(0x12d)],{'recursive':!![]}),_0x36a16c[_0x232269(0x13d)](this[_0x232269(0xde)],{'recursive':!![]});}['_snapshotDir'](_0x492011){const _0x263157=_0x43a8;return _0x1e8021[_0x263157(0xfb)](this['snapshotsDir'],_0x492011);}[_0x22df5b(0xee)](_0x52ed32){const _0xa6f367=_0x22df5b,_0x894038=this[_0xa6f367(0xca)](_0x52ed32);return{'dir':_0x894038,'index':_0x1e8021[_0xa6f367(0xfb)](_0x894038,_0xa6f367(0x14c)),'labels':_0x1e8021['join'](_0x894038,_0xa6f367(0x127)),'state':_0x1e8021[_0xa6f367(0xfb)](_0x894038,_0xa6f367(0x13f))};}[_0x22df5b(0x126)](){const _0x22e278=_0x22df5b;if(!_0x420189(this['currentPath']))return null;const _0x412333=_0x4f2378(this['currentPath']);if(!_0x412333)return null;const _0x338e34=String(_0x412333)[_0x22e278(0x12e)]();return _0x338e34||null;}['readCurrentClock'](){const _0x53360f=_0x22df5b,_0x1f8222=this[_0x53360f(0x126)]();if(!_0x1f8222)return 0x0;const _0x4c3588=Number(_0x1f8222);return Number[_0x53360f(0x132)](_0x4c3588)?_0x4c3588:0x0;}['listSnapshotIds'](){const _0x556f4a=_0x22df5b;try{return _0x36a16c[_0x556f4a(0xc8)](this[_0x556f4a(0xde)],{'withFileTypes':!![]})[_0x556f4a(0xda)](_0x31ab71=>_0x31ab71['isDirectory']())['map'](_0xa3a48e=>_0xa3a48e['name'])['filter'](_0x2d17ca=>!_0x2d17ca[_0x556f4a(0xd3)](_0x556f4a(0x10e)))[_0x556f4a(0xda)](_0x420233=>!_0x420233[_0x556f4a(0xd3)](_0x556f4a(0x150)))[_0x556f4a(0x103)]();}catch{return[];}}[_0x22df5b(0xf9)](){const _0x14cee1=_0x22df5b,_0x238680=this[_0x14cee1(0x126)]();if(_0x238680)return _0x238680;const _0x18ad0a=this[_0x14cee1(0x17a)]();if(!_0x18ad0a[_0x14cee1(0x13c)])return null;return _0x18ad0a[_0x18ad0a['length']-0x1];}[_0x22df5b(0xf7)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x46a488=_0x22df5b;let _0x103f8d;try{_0x103f8d=_0x36a16c[_0x46a488(0xc8)](this[_0x46a488(0xde)],{'withFileTypes':!![]});}catch{return;}const _0x52ccd0=_0x4d6b2e()-maxAgeMs;for(const _0x140197 of _0x103f8d){if(!_0x140197[_0x46a488(0xf3)]())continue;const _0x464027=_0x140197[_0x46a488(0x122)];if(!_0x464027['startsWith'](_0x46a488(0x10e))&&!_0x464027[_0x46a488(0xd3)]('_tmp-'))continue;const _0x18378d=_0x1e8021['join'](this[_0x46a488(0xde)],_0x464027);try{const _0x18c7b5=_0x36a16c[_0x46a488(0xe3)](_0x18378d);if(_0x18c7b5[_0x46a488(0xe4)]>_0x52ccd0)continue;}catch{}try{_0x36a16c[_0x46a488(0x10a)](_0x18378d,{'recursive':!![],'force':!![]});}catch{}}}[_0x22df5b(0xfc)]({keep:keep=null}={}){const _0x119956=_0x22df5b,_0x14931d=Math['max'](0x1,Math[_0x119956(0x173)](keep??this['keepSnapshots']??0x3)),_0x21c985=this[_0x119956(0x17a)]();if(_0x21c985[_0x119956(0x13c)]<=_0x14931d)return;const _0xaef5db=this[_0x119956(0x126)](),_0x3afb7c=_0x21c985[_0x119956(0x11e)](0x0,Math['max'](0x0,_0x21c985[_0x119956(0x13c)]-_0x14931d));for(const _0x3805d2 of _0x3afb7c){if(_0xaef5db&&_0x3805d2===_0xaef5db)continue;const _0x2efd1c=this[_0x119956(0xca)](_0x3805d2);try{_0x36a16c['rmSync'](_0x2efd1c,{'recursive':!![],'force':!![]});}catch{}}}async[_0x22df5b(0xd2)](_0x3fd4d4,_0x1aa942){const _0x3ac28c=_0x22df5b;if(!_0x3fd4d4)throw new Error('snapshot\x20id\x20required');const _0x45ab77=this[_0x3ac28c(0xee)](_0x3fd4d4);if(!_0x420189(_0x45ab77['index'])||!_0x420189(_0x45ab77[_0x3ac28c(0x153)])||!_0x420189(_0x45ab77['state']))throw new Error(_0x3ac28c(0xf0)+_0x3fd4d4);const _0x1ae891=await _0x1aa942(_0x45ab77);return _0x1ae891||{};}async[_0x22df5b(0x134)](_0x2080f0,_0x30817f,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0xa04c8f=_0x22df5b,_0x352771=Number(_0x2080f0);if(!Number[_0xa04c8f(0x132)](_0x352771)||_0x352771<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x1a285f=_0x37381b(_0x352771),_0x51bf9d=this[_0xa04c8f(0xca)](_0x1a285f),_0x568e63=_0x1e8021[_0xa04c8f(0xfb)](this['snapshotsDir'],_0xa04c8f(0x10e)+_0x1a285f+'-'+_0x1d06f1[_0xa04c8f(0x15b)](0x6)[_0xa04c8f(0xd8)]('hex'));_0x36a16c[_0xa04c8f(0x13d)](_0x568e63,{'recursive':!![]});const _0x4075b3={'dir':_0x568e63,'index':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,'index.hnsw'),'labels':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,_0xa04c8f(0x127)),'state':_0x1e8021[_0xa04c8f(0xfb)](_0x568e63,_0xa04c8f(0x13f))};await _0x30817f(_0x4075b3,{'id':_0x1a285f,'clock':_0x352771});const _0x15e96a=JSON[_0xa04c8f(0x117)]({'pid':process[_0xa04c8f(0x17d)],'host':_0x54b1d4['hostname'](),'at':_0x4d6b2e()}),_0x2248b5=_0x4d6b2e();let _0x2a35d0=null;const _0x3763c3=()=>{const _0x4336e0=_0xa04c8f;try{const _0x47ad1b=JSON['parse'](_0x36a16c[_0x4336e0(0x123)](this['lockPath'],_0x4336e0(0xe6)));if(_0x47ad1b['at']&&_0x4d6b2e()-_0x47ad1b['at']>staleLockMaxAgeMs){const _0x1a9f37=_0x4d6b2e()-_0x47ad1b['at'],_0x6b5e35=_0x4336e0(0x139)+Math[_0x4336e0(0xfd)](_0x1a9f37/0x3e8)+'s,\x20pid:\x20'+_0x47ad1b[_0x4336e0(0x17d)]+_0x4336e0(0x15a)+_0x47ad1b[_0x4336e0(0xd9)]+_0x4336e0(0xf4)+_0x4336e0(0xe8);this[_0x4336e0(0x113)]?.[_0x4336e0(0x11b)]?this[_0x4336e0(0x113)][_0x4336e0(0x11b)](_0x6b5e35):console[_0x4336e0(0x11b)](_0x4336e0(0xe2),_0x6b5e35);try{_0x36a16c[_0x4336e0(0x174)](this[_0x4336e0(0xeb)]);}catch{}return!![];}}catch{try{_0x36a16c['unlinkSync'](this[_0x4336e0(0xeb)]);}catch{}}return![];},_0x4363a5=()=>{const _0x106e59=_0xa04c8f;try{return _0x2a35d0=_0x36a16c[_0x106e59(0xc7)](this['lockPath'],'wx'),_0x36a16c[_0x106e59(0x179)](_0x2a35d0,_0x15e96a),!![];}catch(_0x79708c){if(_0x79708c&&_0x79708c['code']===_0x106e59(0x165))return![];throw _0x79708c;}};if(!_0x4363a5()){_0x3763c3(),_0x4363a5();if(_0x2a35d0==null&&lockTimeoutMs>0x0)while(_0x4d6b2e()-_0x2248b5<lockTimeoutMs){await new Promise(_0x708fbc=>setTimeout(_0x708fbc,0x19));if(_0x4363a5())break;_0x3763c3();}}if(_0x2a35d0==null){try{_0x36a16c['rmSync'](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xa04c8f(0x161)};}try{const _0x5bf8c9=this['readCurrentClock']();if(_0x352771<=_0x5bf8c9){try{_0x36a16c['rmSync'](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0xa04c8f(0xc4),'currentClock':_0x5bf8c9};}if(!_0x420189(_0x51bf9d))_0x36a16c[_0xa04c8f(0x136)](_0x568e63,_0x51bf9d);else try{_0x36a16c[_0xa04c8f(0x10a)](_0x568e63,{'recursive':!![],'force':!![]});}catch{}return _0x4e1dbd(this[_0xa04c8f(0x176)],_0x1a285f+'\x0a'),this[_0xa04c8f(0xfc)]({'keep':keep}),{'published':!![],'currentClock':_0x352771};}finally{try{_0x36a16c[_0xa04c8f(0x157)](_0x2a35d0);}catch{}try{_0x36a16c[_0xa04c8f(0x174)](this[_0xa04c8f(0xeb)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x597690=_0x67fb04;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0xaeeebb=require$$0;class _0x33d561{constructor(){this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this['nextLabel']=0x0,this['_tombstoneCount']=0x0;}async[_0x597690(0x12a)](){const _0x5bc972=_0x597690;this[_0x5bc972(0x167)]=new Map(),this[_0x5bc972(0xcb)]=new Map(),this[_0x5bc972(0x166)]=0x0,this['_tombstoneCount']=0x0;}async['loadFrom'](_0x5df3a0){const _0x24f6b0=_0x597690;if(!_0x5df3a0||!_0xaeeebb['existsSync'](_0x5df3a0))return await this[_0x24f6b0(0x12a)](),!![];let _0x54dbe0;try{_0x54dbe0=_0xaeeebb[_0x24f6b0(0x123)](_0x5df3a0,_0x24f6b0(0xe6));}catch{return await this['reset'](),!![];}let _0x268ae4;try{_0x268ae4=JSON[_0x24f6b0(0x12b)](_0x54dbe0);}catch{return await this[_0x24f6b0(0x12a)](),!![];}const _0x51b7ba=Array['isArray'](_0x268ae4?.['entries'])?_0x268ae4[_0x24f6b0(0x168)]:[],_0x2d0968=Number[_0x24f6b0(0x148)](_0x268ae4?.[_0x24f6b0(0x166)])?_0x268ae4[_0x24f6b0(0x166)]:0x0,_0x23fb10=new Map(),_0x2118fe=new Map();let _0x3ab383=-0x1;for(const _0x10d225 of _0x51b7ba){if(!Array['isArray'](_0x10d225)||_0x10d225[_0x24f6b0(0x13c)]!==0x2)continue;const _0x27d303=Number(_0x10d225[0x0]),_0x189306=String(_0x10d225[0x1]??'');if(!Number['isInteger'](_0x27d303)||_0x27d303<0x0)continue;if(!_0x189306)continue;_0x23fb10['set'](_0x189306,_0x27d303),_0x2118fe[_0x24f6b0(0x118)](_0x27d303,_0x189306);if(_0x27d303>_0x3ab383)_0x3ab383=_0x27d303;}return this[_0x24f6b0(0x167)]=_0x23fb10,this[_0x24f6b0(0xcb)]=_0x2118fe,this['nextLabel']=Math[_0x24f6b0(0x11c)](_0x2d0968,_0x3ab383+0x1,0x0),this['_tombstoneCount']=0x0,!![];}['labelForExisting'](_0x33b754){const _0xf15c82=_0x597690;return this[_0xf15c82(0x167)]['get'](_0x33b754);}[_0x597690(0x116)](_0x1cc731){const _0x3aa3bd=_0x597690;let _0x46c644=this[_0x3aa3bd(0x167)][_0x3aa3bd(0x129)](_0x1cc731);if(_0x46c644!==undefined)return _0x46c644;return _0x46c644=this['nextLabel']++,this[_0x3aa3bd(0x167)][_0x3aa3bd(0x118)](_0x1cc731,_0x46c644),this['labelToKey'][_0x3aa3bd(0x118)](_0x46c644,_0x1cc731),_0x46c644;}[_0x597690(0x110)](_0x72127b){const _0x7adbc7=_0x597690,_0x282371=this['keyToLabel']['get'](_0x72127b);if(_0x282371===undefined)return;this[_0x7adbc7(0x167)][_0x7adbc7(0x135)](_0x72127b),this[_0x7adbc7(0xcb)][_0x7adbc7(0x135)](_0x282371),this['_tombstoneCount']++;}['keyForLabel'](_0x22f7db){const _0x3ea83a=_0x597690;return this['labelToKey'][_0x3ea83a(0x129)](_0x22f7db)??null;}['size'](){const _0x39612e=_0x597690;return this['keyToLabel'][_0x39612e(0xcf)];}[_0x597690(0x11f)](){const _0x47790a=_0x597690;return this[_0x47790a(0x172)];}async['snapshotTo'](_0x1ed37a){const _0x2dc5d5=_0x597690,_0x4fe584=_0x1ed37a+_0x2dc5d5(0x170),_0x5a9146=[];for(const [_0x370c84,_0x2d00e8]of this['labelToKey']['entries']()){_0x5a9146[_0x2dc5d5(0xc9)]([_0x370c84,_0x2d00e8]);}_0x5a9146[_0x2dc5d5(0x103)]((_0x5e5b83,_0x50ee96)=>_0x5e5b83[0x0]-_0x50ee96[0x0]);const _0x8cf0b={'version':0x1,'nextLabel':this[_0x2dc5d5(0x166)],'entries':_0x5a9146};_0xaeeebb[_0x2dc5d5(0x179)](_0x4fe584,JSON[_0x2dc5d5(0x117)](_0x8cf0b)),_0xaeeebb[_0x2dc5d5(0x136)](_0x4fe584,_0x1ed37a);}}return labelMap=_0x33d561,labelMap;}function _0x43a8(_0x4e277e,_0x3c9193){_0x4e277e=_0x4e277e-0xc2;const _0x5bc290=_0x5bc2();let _0x43a8ba=_0x5bc290[_0x4e277e];return _0x43a8ba;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3f8c0a=requireSnapshotStore(),_0x318344=requireLabelMap(),_0x4a5250=0x1;let _0x598e37=null;function _0x2cbf09(){const _0x54fd7c=_0x43a8;if(_0x598e37)return _0x598e37;try{return _0x598e37=require(_0x54fd7c(0x149)),_0x598e37;}catch(_0x202e96){const _0x31cb28=new Error(_0x54fd7c(0xd5)+('for\x20Node\x20'+process['versions'][_0x54fd7c(0x105)]+_0x54fd7c(0x177)+process[_0x54fd7c(0xf2)]+'/'+process[_0x54fd7c(0x178)]+'.\x20')+_0x54fd7c(0x101)+(_0x54fd7c(0x114)+(_0x202e96?.[_0x54fd7c(0x112)]||String(_0x202e96))));_0x31cb28[_0x54fd7c(0x158)]=_0x54fd7c(0x16f),_0x31cb28[_0x54fd7c(0xfa)]=_0x202e96;throw _0x31cb28;}}return hnsw=function _0xa3db3(_0x3d6e37={},{dims:_0x4d296a,dir:_0x5c3e75}){const _0x29db6e=_0x43a8,_0x45a79b=_0x2cbf09();if(!_0x4d296a||_0x4d296a<=0x0)throw new Error('hnsw\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x5c3e75)throw new Error('hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x856a0c={'metric':_0x3d6e37[_0x29db6e(0x16c)]??_0x29db6e(0x10f),'M':_0x3d6e37['M']??0x10,'efConstruction':_0x3d6e37[_0x29db6e(0x111)]??0xc8,'efSearch':_0x3d6e37[_0x29db6e(0x141)]??0x40,'maxElements':_0x3d6e37['maxElements']??0x400,'growFactor':_0x3d6e37[_0x29db6e(0x160)]??0x2,'snapshotEveryChanges':_0x3d6e37['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x3d6e37[_0x29db6e(0x152)]??0x2,'tmpMaxAgeMs':_0x3d6e37[_0x29db6e(0x175)]??0x6*0x36ee80},_0x475d63=new _0x3f8c0a({'dir':_0x5c3e75,'keepSnapshots':_0x856a0c['keepSnapshots']}),_0x45a68f=new _0x318344();let _0x372034=null,_0x5290f6=0x0,_0x497b84=null,_0x57992f=Promise[_0x29db6e(0x128)]();const _0xe07a1f=_0x204f75=>{return _0x57992f=_0x57992f['then'](_0x204f75),_0x57992f;};async function _0x5ad60c(_0x2d1ae9){const _0xe39e57=_0x29db6e;await _0x45a68f['reset']();const _0x581620=_0x2d1ae9?await _0x2d1ae9():[],_0x2cc96=Math['max'](_0x856a0c[_0xe39e57(0x10c)],Math[_0xe39e57(0x159)](_0x581620[_0xe39e57(0x13c)]*(_0x856a0c['growFactor']||1.2)),0x1);_0x372034=new _0x45a79b[(_0xe39e57(0x14d))](_0x856a0c[_0xe39e57(0x16c)],_0x4d296a),_0x372034[_0xe39e57(0x151)]({'maxElements':_0x2cc96,'efConstruction':_0x856a0c[_0xe39e57(0x111)],'M':_0x856a0c['M']});for(const {key:_0x577704,vector:_0x1ed7b1}of _0x581620){if(!(_0x1ed7b1 instanceof Float32Array)||_0x1ed7b1[_0xe39e57(0x13c)]!==_0x4d296a)continue;const _0x43da76=_0x45a68f[_0xe39e57(0x116)](_0x577704);_0x372034['addPoint'](Array[_0xe39e57(0x106)](_0x1ed7b1),_0x43da76);}_0x372034[_0xe39e57(0x182)](_0x856a0c[_0xe39e57(0x141)]),_0x5290f6=0x0;}async function _0x2b7199(_0x1238d6){const _0x5a78b9=_0x29db6e;if(!_0x372034||!_0x1238d6)return![];const _0x275743=await _0x475d63[_0x5a78b9(0x134)](_0x1238d6,async _0x25327b=>{const _0x447160=_0x5a78b9;_0x372034[_0x447160(0xdd)](_0x25327b['index']),await _0x45a68f[_0x447160(0xfe)](_0x25327b[_0x447160(0x153)]);const _0x4b066a=require$$0;_0x4b066a['writeFileSync'](_0x25327b[_0x447160(0x17b)],JSON[_0x447160(0x117)]({'manifestVersion':_0x4a5250,'dims':_0x4d296a,'metric':_0x856a0c['metric'],'clock':_0x1238d6,'snapshotAt':Date[_0x447160(0xcd)]()},null,0x2));},{'keep':_0x856a0c['keepSnapshots']});if(_0x275743?.['published'])_0x5290f6=0x0;return _0x275743?.[_0x5a78b9(0xe0)]??![];}async function _0x5b4edc(){const _0x1e1012=_0x29db6e,_0x29eb91=_0x475d63['readCurrentId']()||_0x475d63['latestSnapshotId']();if(!_0x29eb91)return null;let _0x45250f,_0x6fafad=![];return await _0x475d63[_0x1e1012(0xd2)](_0x29eb91,async _0x24f435=>{const _0x42d082=_0x1e1012,_0x179879=require$$0;_0x45250f=JSON[_0x42d082(0x12b)](_0x179879[_0x42d082(0x123)](_0x24f435[_0x42d082(0x17b)],_0x42d082(0xe6)));if(_0x45250f[_0x42d082(0xea)]!==_0x4a5250||_0x45250f['dims']!==_0x4d296a||_0x45250f[_0x42d082(0x16c)]!==_0x856a0c[_0x42d082(0x16c)]){_0x45250f=null;return;}await _0x45a68f[_0x42d082(0x171)](_0x24f435['labels']),_0x372034=new _0x45a79b[(_0x42d082(0x14d))](_0x856a0c[_0x42d082(0x16c)],_0x4d296a),_0x372034[_0x42d082(0x155)](_0x24f435[_0x42d082(0xe7)]),_0x372034[_0x42d082(0x182)](_0x856a0c[_0x42d082(0x141)]),_0x6fafad=!![];}),_0x6fafad?_0x45250f?.[_0x1e1012(0x13b)]??0x0:null;}return{async 'load'(_0x5bd628){return _0xe07a1f(async()=>{const _0x35dfd0=_0x43a8;_0x475d63['cleanupTmpDirs']({'maxAgeMs':_0x856a0c[_0x35dfd0(0x175)]}),_0x497b84=_0x5bd628??null;const _0x267add=await _0x5b4edc();if(_0x267add!=null)return _0x267add;return await _0x5ad60c(_0x5bd628),null;});},async 'add'(_0x3abde2,_0x4cd019,_0x273944){return _0xe07a1f(async()=>{const _0x55714a=_0x43a8;if(!_0x372034)return;const _0x5d05e5=_0x45a68f[_0x55714a(0x116)](_0x3abde2);try{_0x372034[_0x55714a(0xd6)](_0x5d05e5);}catch{}_0x372034[_0x55714a(0xd0)]()>=_0x372034[_0x55714a(0x17f)]()&&(_0x856a0c[_0x55714a(0x10c)]=Math[_0x55714a(0x159)](_0x372034['getMaxElements']()*(_0x856a0c[_0x55714a(0x160)]||0x2)),await _0x5ad60c(_0x497b84)),_0x372034[_0x55714a(0x146)](Array[_0x55714a(0x106)](_0x4cd019),_0x5d05e5),_0x5290f6++,_0x5290f6>=_0x856a0c[_0x55714a(0x115)]&&await _0x2b7199(_0x273944??Date[_0x55714a(0xcd)]());});},async 'remove'(_0x2310e6){return _0xe07a1f(async()=>{const _0xe067ac=_0x43a8;if(!_0x372034)return;const _0x38a027=_0x45a68f['labelForExisting'](_0x2310e6);if(_0x38a027===undefined)return;try{_0x372034['markDelete'](_0x38a027);}catch{}_0x45a68f[_0xe067ac(0x110)](_0x2310e6),_0x5290f6++;});},'search'(_0x8fd898,{limit:limit=0xa,efSearch:_0x1311e8}={}){const _0x5ee767=_0x29db6e;if(!_0x372034)return[];if(Number['isInteger'](_0x1311e8))_0x372034['setEf'](_0x1311e8);const _0x177bbd=Math[_0x5ee767(0xf6)](limit,_0x372034['getCurrentCount']()||0x1),{neighbors:_0xa56f87,distances:_0x43a2ec}=_0x372034[_0x5ee767(0x137)](Array[_0x5ee767(0x106)](_0x8fd898),_0x177bbd),_0x4fa1aa=[];for(let _0x78f429=0x0;_0x78f429<_0xa56f87[_0x5ee767(0x13c)];_0x78f429++){const _0x2aec13=_0x45a68f[_0x5ee767(0x15f)](_0xa56f87[_0x78f429]);if(!_0x2aec13)continue;const _0x1748c4=_0x856a0c[_0x5ee767(0x16c)]===_0x5ee767(0x10f)?Math[_0x5ee767(0x11c)](0x0,0x1-_0x43a2ec[_0x78f429]):0x1/(0x1+_0x43a2ec[_0x78f429]);_0x4fa1aa[_0x5ee767(0xc9)]({'key':_0x2aec13,'score':_0x1748c4});}return _0x4fa1aa;},async 'snapshot'(_0x36b0b5=Date['now']()){return _0xe07a1f(()=>_0x2b7199(_0x36b0b5));},async 'rebuild'(_0x1c07c9){return _0xe07a1f(()=>{if(_0x1c07c9!=null)_0x497b84=_0x1c07c9;return _0x5ad60c(_0x1c07c9??_0x497b84);});},async 'stop'(){const _0x12b137=_0x29db6e;return _0xe07a1f(()=>_0x2b7199(Date[_0x12b137(0xcd)]()));},'count'(){return _0x45a68f['size']();},'info'(){const _0x28f4ad=_0x29db6e;return{'algorithm':'hnsw','metric':_0x856a0c[_0x28f4ad(0x16c)],'M':_0x856a0c['M'],'efConstruction':_0x856a0c[_0x28f4ad(0x111)],'efSearch':_0x856a0c[_0x28f4ad(0x141)],'maxElements':_0x372034?.[_0x28f4ad(0x17f)]()??_0x856a0c[_0x28f4ad(0x10c)],'count':_0x45a68f[_0x28f4ad(0xcf)](),'changesSince':_0x5290f6,'snapshotDir':_0x5c3e75,'latestSnapshot':_0x475d63[_0x28f4ad(0x126)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x11934e(_0x339672={}){const _0x3e1ee4=new Map();return{async 'load'(_0x1d6625){const _0x4349af=_0x43a8;_0x3e1ee4[_0x4349af(0x14e)]();if(_0x1d6625)for(const {key:_0x366aca,vector:_0x557d88}of await _0x1d6625()){_0x3e1ee4[_0x4349af(0x118)](_0x366aca,_0x557d88);}},async 'add'(_0x10b18b,_0x280d1d,_0x216330){const _0x1c58e3=_0x43a8;_0x3e1ee4[_0x1c58e3(0x118)](_0x10b18b,_0x280d1d);},async 'remove'(_0x33a311){const _0x180029=_0x43a8;_0x3e1ee4[_0x180029(0x135)](_0x33a311);},'search'(_0x355c42,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x436552=_0x43a8,_0x220857=[];for(const [_0x3a0b9c,_0x9069ec]of _0x3e1ee4){const _0x224942=_0x3f068a(_0x355c42,_0x9069ec);if(_0x224942>=threshold)_0x220857[_0x436552(0xc9)]({'key':_0x3a0b9c,'score':_0x224942});}return _0x220857[_0x436552(0x103)]((_0x406e2d,_0x186766)=>_0x186766[_0x436552(0xf1)]-_0x406e2d['score']),_0x220857['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x532c32){const _0xfdffd=_0x43a8;await this[_0xfdffd(0x156)](_0x532c32);},async 'stop'(){},'count'(){const _0x1f8f95=_0x43a8;return _0x3e1ee4[_0x1f8f95(0xcf)];},'info'(){const _0x210a29=_0x43a8;return{'algorithm':'flat','count':_0x3e1ee4[_0x210a29(0xcf)]};}};};function _0x3f068a(_0x32bfef,_0x171d64){const _0x5ed927=_0x43a8;let _0x112139=0x0,_0x4927e7=0x0,_0x24fc87=0x0;for(let _0x4bb3d1=0x0;_0x4bb3d1<_0x32bfef[_0x5ed927(0x13c)];_0x4bb3d1++){_0x112139+=_0x32bfef[_0x4bb3d1]*_0x171d64[_0x4bb3d1],_0x4927e7+=_0x32bfef[_0x4bb3d1]*_0x32bfef[_0x4bb3d1],_0x24fc87+=_0x171d64[_0x4bb3d1]*_0x171d64[_0x4bb3d1];}const _0x9b455a=Math[_0x5ed927(0x125)](_0x4927e7)*Math[_0x5ed927(0x125)](_0x24fc87);return _0x9b455a===0x0?0x0:_0x112139/_0x9b455a;}return flat;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0xe11bd3=require$$0,_0x975b8d=require$$1,_0xdb8de8=requireSnapshotStore(),_0xd34066=requireLabelMap(),_0x357957=0x1;let _0x53b115=null;function _0x54b789(){const _0x13e444=_0x43a8;if(_0x53b115)return _0x53b115;try{return _0x53b115=require(_0x13e444(0x12c)),_0x53b115;}catch(_0x4f5463){const _0x1b574a=new Error('usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+('for\x20Node\x20'+process[_0x13e444(0xf8)][_0x13e444(0x105)]+_0x13e444(0x177)+process[_0x13e444(0xf2)]+'/'+process[_0x13e444(0x178)]+'.\x20')+_0x13e444(0x14a)+(_0x13e444(0x114)+(_0x4f5463?.[_0x13e444(0x112)]||String(_0x4f5463))));_0x1b574a[_0x13e444(0x158)]=_0x13e444(0x17e),_0x1b574a[_0x13e444(0xfa)]=_0x4f5463;throw _0x1b574a;}}function _0x287ea8(_0x57633b,_0x41627c){const _0x33c0e3=_0x43a8;switch(_0x57633b){case _0x33c0e3(0x10f):return _0x41627c[_0x33c0e3(0x142)][_0x33c0e3(0xc6)];case'l2':return _0x41627c['MetricKind'][_0x33c0e3(0xdc)];case'ip':return _0x41627c[_0x33c0e3(0x142)]['IP'];default:return _0x41627c['MetricKind'][_0x33c0e3(0xc6)];}}return usearch=function _0x21aa2c(_0x3421ad={},{dims:_0x50c959,dir:_0x146dea}){const _0x69d16f=_0x43a8,_0x3224a2=_0x54b789();if(!_0x50c959||_0x50c959<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x146dea)throw new Error(_0x69d16f(0x10d));const _0x12e8b1={'metric':_0x3421ad['metric']??_0x69d16f(0x10f),'connectivity':_0x3421ad[_0x69d16f(0x15d)]??0x10,'expansionAdd':_0x3421ad[_0x69d16f(0xe1)]??0x80,'expansionSearch':_0x3421ad[_0x69d16f(0x140)]??0x40,'snapshotEveryChanges':_0x3421ad[_0x69d16f(0x115)]??0xc350,'keepSnapshots':_0x3421ad[_0x69d16f(0x152)]??0x2,'tmpMaxAgeMs':_0x3421ad[_0x69d16f(0x175)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x3421ad[_0x69d16f(0x147)]??0x1388,'writerLockMaxAgeMs':_0x3421ad[_0x69d16f(0x169)]??0x3a98,'viewRefreshMs':_0x3421ad[_0x69d16f(0xc5)]??0x3e8},_0x5e8350=new _0xdb8de8({'dir':_0x146dea,'keepSnapshots':_0x12e8b1[_0x69d16f(0x152)]}),_0x29233a=_0x975b8d[_0x69d16f(0xfb)](_0x146dea,_0x69d16f(0x11a));let _0x27f84b=new _0xd34066(),_0x86bebc=null,_0x157a43=0x0,_0x32a2e9=null,_0x2a8aba=![],_0x5a179c=null,_0x33bc09=null,_0x1b9887=0x0,_0x447cc0=![],_0x32a15=Promise['resolve']();const _0xf1ae84=_0x351835=>{const _0x3f1529=_0x69d16f;return _0x32a15=_0x32a15[_0x3f1529(0x107)](_0x351835),_0x32a15;};function _0x408551(){const _0xe1b9a0=_0x69d16f;return new _0x3224a2[(_0xe1b9a0(0x102))]({'dimensions':_0x50c959,'metric':_0x287ea8(_0x12e8b1[_0xe1b9a0(0x16c)],_0x3224a2),'quantization':_0x3224a2[_0xe1b9a0(0xec)][_0xe1b9a0(0x164)],'connectivity':_0x12e8b1[_0xe1b9a0(0x15d)],'expansion_add':_0x12e8b1['expansionAdd'],'expansion_search':_0x12e8b1[_0xe1b9a0(0x140)],'multi':![]});}function _0x551e8d(_0x3029dc){return _0x3029dc instanceof Float32Array?_0x3029dc:new Float32Array(_0x3029dc);}function _0x5611fd(){const _0x5b82e2=_0x69d16f,_0x4713dc=JSON['stringify']({'pid':process[_0x5b82e2(0x17d)],'at':Date['now']()}),_0x20b57d=()=>{const _0x18f94d=_0x5b82e2;try{const _0x54b3d6=_0xe11bd3[_0x18f94d(0xc7)](_0x29233a,'wx');return _0xe11bd3[_0x18f94d(0x179)](_0x54b3d6,_0x4713dc),_0xe11bd3[_0x18f94d(0x157)](_0x54b3d6),!![];}catch(_0x366fd3){if(_0x366fd3?.[_0x18f94d(0x158)]===_0x18f94d(0x165))return![];throw _0x366fd3;}};if(_0x20b57d())return!![];try{const _0x27b852=JSON['parse'](_0xe11bd3[_0x5b82e2(0x123)](_0x29233a,'utf8')),_0x38be25=Date['now']()-(_0x27b852['at']??0x0);if(_0x38be25<_0x12e8b1[_0x5b82e2(0x169)])return![];}catch{}try{_0xe11bd3[_0x5b82e2(0x174)](_0x29233a);}catch{}return _0x20b57d();}function _0x49e6eb(){const _0x51d3ea=_0x69d16f;if(_0x5a179c)clearInterval(_0x5a179c);_0x5a179c=setInterval(()=>{const _0x48adae=_0x43a8;try{_0xe11bd3['writeFileSync'](_0x29233a,JSON[_0x48adae(0x117)]({'pid':process[_0x48adae(0x17d)],'at':Date[_0x48adae(0xcd)]()}));}catch{}},_0x12e8b1[_0x51d3ea(0x147)]),_0x5a179c[_0x51d3ea(0x130)]();}function _0x49a610(){const _0xedecd=_0x69d16f;_0x5a179c&&(clearInterval(_0x5a179c),_0x5a179c=null);try{const _0x4f58cb=JSON[_0xedecd(0x12b)](_0xe11bd3['readFileSync'](_0x29233a,_0xedecd(0xe6)));if(_0x4f58cb[_0xedecd(0x17d)]===process[_0xedecd(0x17d)])_0xe11bd3[_0xedecd(0x174)](_0x29233a);}catch{}}async function _0x31863e(_0x1cbe29){const _0x1d568f=_0x69d16f;_0x27f84b=new _0xd34066(),await _0x27f84b[_0x1d568f(0x12a)](),_0x86bebc=_0x408551();const _0x4db1d4=_0x1cbe29?await _0x1cbe29():[];for(const {key:_0x42322c,vector:_0x2d82e}of _0x4db1d4){if(!(_0x2d82e instanceof Float32Array)||_0x2d82e[_0x1d568f(0x13c)]!==_0x50c959)continue;const _0x5ea525=_0x27f84b[_0x1d568f(0x116)](_0x42322c);_0x86bebc[_0x1d568f(0x16b)](BigInt(_0x5ea525),_0x2d82e);}_0x157a43=0x0;}async function _0x270923(_0x1c954b){const _0xfd9d89=_0x69d16f;if(!_0x86bebc||!_0x1c954b)return![];const _0x20092b=await _0x5e8350['publishSnapshot'](_0x1c954b,async _0x113f97=>{const _0x420c4e=_0x43a8;_0x86bebc[_0x420c4e(0x163)](_0x113f97['index']),await _0x27f84b[_0x420c4e(0xfe)](_0x113f97[_0x420c4e(0x153)]),_0xe11bd3[_0x420c4e(0x179)](_0x113f97[_0x420c4e(0x17b)],JSON[_0x420c4e(0x117)]({'manifestVersion':_0x357957,'algorithm':'usearch','dims':_0x50c959,'metric':_0x12e8b1[_0x420c4e(0x16c)],'clock':_0x1c954b,'snapshotAt':Date[_0x420c4e(0xcd)]()},null,0x2));},{'keep':_0x12e8b1[_0xfd9d89(0x152)]});if(_0x20092b?.[_0xfd9d89(0xe0)])_0x157a43=0x0;return _0x20092b?.[_0xfd9d89(0xe0)]??![];}async function _0x3d74a2(){const _0x24fe27=_0x69d16f,_0x3e4f32=_0x5e8350[_0x24fe27(0x126)]()||_0x5e8350[_0x24fe27(0xf9)]();if(!_0x3e4f32)return null;let _0x496a24,_0x37124d=![];return await _0x5e8350['loadSnapshot'](_0x3e4f32,async _0x1f76dd=>{const _0x3f9b88=_0x24fe27;_0x496a24=JSON[_0x3f9b88(0x12b)](_0xe11bd3[_0x3f9b88(0x123)](_0x1f76dd[_0x3f9b88(0x17b)],_0x3f9b88(0xe6)));if(_0x496a24[_0x3f9b88(0xea)]!==_0x357957||_0x496a24['algorithm']!=='usearch'||_0x496a24[_0x3f9b88(0x138)]!==_0x50c959||_0x496a24[_0x3f9b88(0x16c)]!==_0x12e8b1[_0x3f9b88(0x16c)]){_0x496a24=null;return;}_0x27f84b=new _0xd34066(),await _0x27f84b[_0x3f9b88(0x171)](_0x1f76dd[_0x3f9b88(0x153)]),_0x86bebc=_0x408551(),_0x86bebc[_0x3f9b88(0x156)](_0x1f76dd[_0x3f9b88(0xe7)]),_0x37124d=!![];}),_0x37124d?_0x496a24?.[_0x24fe27(0x13b)]??0x0:null;}async function _0x1f310d(_0x2696a8){const _0x12c824=_0x69d16f;if(!_0x2696a8)return![];let _0x5bba42=![];try{await _0x5e8350[_0x12c824(0xd2)](_0x2696a8,async _0x238f52=>{const _0x12544c=_0x12c824,_0x2ce2b0=JSON[_0x12544c(0x12b)](_0xe11bd3[_0x12544c(0x123)](_0x238f52['state'],_0x12544c(0xe6)));if(_0x2ce2b0[_0x12544c(0xea)]!==_0x357957||_0x2ce2b0[_0x12544c(0x154)]!==_0x12544c(0x12c)||_0x2ce2b0[_0x12544c(0x138)]!==_0x50c959||_0x2ce2b0[_0x12544c(0x16c)]!==_0x12e8b1[_0x12544c(0x16c)])return;const _0x5dbbfe=new _0xd34066();await _0x5dbbfe[_0x12544c(0x171)](_0x238f52[_0x12544c(0x153)]);const _0x4c9feb=_0x408551();_0x4c9feb['view'](_0x238f52[_0x12544c(0xe7)]),_0x86bebc=_0x4c9feb,_0x27f84b=_0x5dbbfe,_0x33bc09=_0x2696a8,_0x5bba42=!![];});}catch{}return _0x5bba42;}async function _0x38ae0d(_0x25d59a){try{await _0x1f310d(_0x25d59a);}finally{_0x447cc0=![];}}function _0x52d528(){const _0x5c10fd=_0x69d16f,_0x4f1c56=Date['now']();if(_0x4f1c56-_0x1b9887<_0x12e8b1[_0x5c10fd(0xc5)])return;_0x1b9887=_0x4f1c56;if(_0x447cc0)return;const _0x566116=_0x5e8350[_0x5c10fd(0x126)]()||_0x5e8350['latestSnapshotId']();if(!_0x566116||_0x566116===_0x33bc09)return;_0x447cc0=!![],_0x38ae0d(_0x566116);}async function _0x5d10f0(){const _0x459d43=_0x69d16f;_0x2a8aba=!![],_0x49e6eb();if(_0x33bc09)try{const _0x312c11=new _0xd34066();let _0x58622d=![];await _0x5e8350[_0x459d43(0xd2)](_0x33bc09,async _0x533b83=>{const _0xe2c5b5=_0x459d43;await _0x312c11[_0xe2c5b5(0x171)](_0x533b83[_0xe2c5b5(0x153)]);const _0x4d0bfa=_0x408551();_0x4d0bfa[_0xe2c5b5(0x156)](_0x533b83[_0xe2c5b5(0xe7)]),_0x86bebc=_0x4d0bfa,_0x27f84b=_0x312c11,_0x58622d=!![];});if(_0x58622d)return;}catch{}await _0x31863e(_0x32a2e9);}return{async 'load'(_0x31bf97){return _0xf1ae84(async()=>{const _0x52aea3=_0x43a8;_0x5e8350[_0x52aea3(0xf7)]({'maxAgeMs':_0x12e8b1[_0x52aea3(0x175)]}),_0x32a2e9=_0x31bf97??null,_0x2a8aba=_0x5611fd();if(_0x2a8aba){_0x49e6eb();const _0x41f092=await _0x3d74a2();if(_0x41f092!=null)return _0x41f092;return await _0x31863e(_0x31bf97),null;}const _0x12a147=_0x5e8350[_0x52aea3(0x126)]()||_0x5e8350['latestSnapshotId']();return await _0x1f310d(_0x12a147),null;});},async 'add'(_0x5eba55,_0x1b7cb6,_0x3b1c3d){return _0xf1ae84(async()=>{const _0x173654=_0x43a8;if(!_0x2a8aba){if(!_0x5611fd())return;await _0x5d10f0();}if(!_0x86bebc)return;const _0x79413c=_0x27f84b[_0x173654(0xd1)](_0x5eba55);if(_0x79413c!==undefined)try{_0x86bebc[_0x173654(0x121)](BigInt(_0x79413c));}catch{}const _0x5df022=_0x27f84b[_0x173654(0x116)](_0x5eba55);_0x86bebc['add'](BigInt(_0x5df022),_0x551e8d(_0x1b7cb6)),_0x157a43++,_0x157a43>=_0x12e8b1[_0x173654(0x115)]&&await _0x270923(_0x3b1c3d??Date[_0x173654(0xcd)]());});},async 'remove'(_0x996c74){return _0xf1ae84(async()=>{const _0x39163f=_0x43a8;if(!_0x2a8aba){if(!_0x5611fd())return;await _0x5d10f0();}if(!_0x86bebc)return;const _0xeeed9b=_0x27f84b['labelForExisting'](_0x996c74);if(_0xeeed9b===undefined)return;try{_0x86bebc[_0x39163f(0x121)](BigInt(_0xeeed9b));}catch{}_0x27f84b[_0x39163f(0x110)](_0x996c74),_0x157a43++;});},'search'(_0x3487ff,{limit:limit=0xa}={}){const _0x43f8d8=_0x69d16f;if(!_0x2a8aba)_0x52d528();if(!_0x86bebc)return[];const _0x2ea4d8=_0x86bebc[_0x43f8d8(0xcf)]();if(_0x2ea4d8===0x0)return[];const _0x4d0104=Math['min'](limit,_0x2ea4d8),_0x1add19=_0x86bebc[_0x43f8d8(0x13a)](_0x551e8d(_0x3487ff),_0x4d0104,0x0),_0x4571ab=[],_0x54c015=_0x1add19[_0x43f8d8(0xe5)],_0x5160b6=_0x1add19[_0x43f8d8(0x17c)];for(let _0x30aa86=0x0;_0x30aa86<_0x54c015[_0x43f8d8(0x13c)];_0x30aa86++){const _0x4ca0ef=_0x54c015[_0x30aa86];if(_0x4ca0ef===0xffffffffffffffffn)continue;const _0x427d2=Number(_0x4ca0ef),_0x337641=_0x27f84b[_0x43f8d8(0x15f)](_0x427d2);if(!_0x337641)continue;const _0x3b4f92=_0x5160b6[_0x30aa86];let _0xc4624d;if(_0x12e8b1[_0x43f8d8(0x16c)]===_0x43f8d8(0x10f))_0xc4624d=Math['max'](0x0,0x1-_0x3b4f92);else{if(_0x12e8b1['metric']==='ip')_0xc4624d=-_0x3b4f92;else _0xc4624d=0x1/(0x1+_0x3b4f92);}_0x4571ab[_0x43f8d8(0xc9)]({'key':_0x337641,'score':_0xc4624d});}return _0x4571ab;},async 'snapshot'(_0x546fbd=Date[_0x69d16f(0xcd)]()){if(!_0x2a8aba)return![];return _0xf1ae84(()=>_0x270923(_0x546fbd));},async 'rebuild'(_0x14337a){if(!_0x2a8aba)return;return _0xf1ae84(()=>{if(_0x14337a!=null)_0x32a2e9=_0x14337a;return _0x31863e(_0x14337a??_0x32a2e9);});},async 'stop'(){return _0xf1ae84(async()=>{const _0x59f414=_0x43a8;_0x2a8aba&&(await _0x270923(Date[_0x59f414(0xcd)]()),_0x49a610());});},'count'(){return _0x27f84b['size']();},'info'(){const _0x1e95b1=_0x69d16f;return{'algorithm':_0x1e95b1(0x12c),'role':_0x2a8aba?_0x1e95b1(0x100):_0x1e95b1(0x15c),'metric':_0x12e8b1[_0x1e95b1(0x16c)],'connectivity':_0x12e8b1[_0x1e95b1(0x15d)],'expansionAdd':_0x12e8b1['expansionAdd'],'expansionSearch':_0x12e8b1[_0x1e95b1(0x140)],'count':_0x27f84b['size'](),'size':_0x86bebc?.[_0x1e95b1(0xcf)]?.()??0x0,'capacity':_0x86bebc?.[_0x1e95b1(0xce)]?.()??0x0,'changesSince':_0x2a8aba?_0x157a43:null,'viewedSnapshot':_0x33bc09??null,'snapshotDir':_0x146dea,'latestSnapshot':_0x5e8350['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x2fbd0d=_0x67fb04;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0xbbf7bd,workerData:_0xc1f151}=require$$0$1,{algorithmName:_0x3b8ad9,algorithmConfig:_0x278670,dims:_0x4a2d69,dir:_0x2ee404}=_0xc1f151;let _0x312b03;if(_0x3b8ad9==='hnsw')_0x312b03=requireHnsw()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else{if(_0x3b8ad9===_0x2fbd0d(0x11d))_0x312b03=requireFlat()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else{if(_0x3b8ad9===_0x2fbd0d(0x12c))_0x312b03=requireUsearch()(_0x278670,{'dims':_0x4a2d69,'dir':_0x2ee404});else throw new Error(_0x2fbd0d(0xff)+_0x3b8ad9+'\x22');}}function _0x289b52(){const _0x19877a=_0x2fbd0d;try{_0xbbf7bd['postMessage']({'op':_0x19877a(0x108),'count':_0x312b03[_0x19877a(0x13e)](),'info':_0x312b03[_0x19877a(0x14f)](),'memory':process[_0x19877a(0xf5)]()});}catch{}}return _0xbbf7bd['on']('message',async _0x40f1aa=>{const _0x57654e=_0x2fbd0d,{id:_0x4385cc,op:_0x453618,args:_0x580016}=_0x40f1aa;try{let _0x2745d8;switch(_0x453618){case'load':{const _0x23a692=(_0x580016[_0x57654e(0xe9)]||[])[_0x57654e(0x109)](_0xaa6d65=>({'key':_0xaa6d65[_0x57654e(0x162)],'vector':_0xaa6d65[_0x57654e(0x143)]instanceof Float32Array?_0xaa6d65[_0x57654e(0x143)]:new Float32Array(_0xaa6d65[_0x57654e(0x143)])}));_0x2745d8=await _0x312b03[_0x57654e(0x156)](async()=>_0x23a692),_0x289b52();break;}case _0x57654e(0x16b):{const _0x4648a0=_0x580016[_0x57654e(0x143)]instanceof Float32Array?_0x580016[_0x57654e(0x143)]:new Float32Array(_0x580016[_0x57654e(0x143)]);await _0x312b03[_0x57654e(0x16b)](_0x580016[_0x57654e(0x162)],_0x4648a0,_0x580016[_0x57654e(0x13b)]??undefined),_0x289b52(),_0x2745d8=null;break;}case'remove':{await _0x312b03['remove'](_0x580016[_0x57654e(0x162)]),_0x289b52(),_0x2745d8=null;break;}case _0x57654e(0x13a):{const _0x301c5=_0x580016[_0x57654e(0xcc)]instanceof Float32Array?_0x580016[_0x57654e(0xcc)]:new Float32Array(_0x580016[_0x57654e(0xcc)]);_0x2745d8=_0x312b03['search'](_0x301c5,_0x580016['opts']||{});break;}case'snapshot':{_0x2745d8=await _0x312b03[_0x57654e(0x131)](_0x580016[_0x57654e(0x13b)]),_0x289b52();break;}case _0x57654e(0x16e):{const _0xe3aa33=(_0x580016[_0x57654e(0xe9)]||[])[_0x57654e(0x109)](_0x49f8d1=>({'key':_0x49f8d1[_0x57654e(0x162)],'vector':_0x49f8d1[_0x57654e(0x143)]instanceof Float32Array?_0x49f8d1[_0x57654e(0x143)]:new Float32Array(_0x49f8d1[_0x57654e(0x143)])}));await _0x312b03[_0x57654e(0x16e)](async()=>_0xe3aa33),_0x289b52(),_0x2745d8=null;break;}case'stop':{await _0x312b03['stop'](),_0x289b52(),_0x2745d8=null;break;}case _0x57654e(0x13e):{_0x2745d8=_0x312b03[_0x57654e(0x13e)]();break;}case'info':{_0x2745d8=_0x312b03[_0x57654e(0x14f)]();break;}default:throw new Error(_0x57654e(0x15e)+_0x453618+'\x22');}_0xbbf7bd['postMessage']({'id':_0x4385cc,'result':_0x2745d8});}catch(_0x5df0a4){_0xbbf7bd[_0x57654e(0x133)]({'id':_0x4385cc,'error':{'message':_0x5df0a4?.[_0x57654e(0x112)]||String(_0x5df0a4),'code':_0x5df0a4?.['code']}});}}),_0xbbf7bd[_0x2fbd0d(0x133)]({'op':'ready'}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);function _0x5bc2(){const _0x366627=['count','state.json','expansionSearch','efSearch','MetricKind','vector','4KpslQX','6397580jVBEPK','addPoint','heartbeatIntervalMs','isInteger','hnswlib-node','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','hex','index.hnsw','HierarchicalNSW','clear','info','_tmp-','initIndex','keepSnapshots','labels','algorithm','readIndexSync','load','closeSync','code','ceil',',\x20host:\x20','randomBytes','reader','connectivity','Unknown\x20op:\x20\x22','keyForLabel','growFactor','lock_busy','key','save','F32','EEXIST','nextLabel','keyToLabel','entries','writerLockMaxAgeMs','42gFtsjj','add','metric','prototype','rebuild','HNSW_BINDINGS_UNAVAILABLE','.tmp','loadFrom','_tombstoneCount','trunc','unlinkSync','tmpMaxAgeMs','currentPath','\x20on\x20','arch','writeFileSync','listSnapshotIds','state','distances','pid','USEARCH_BINDINGS_UNAVAILABLE','getMaxElements','crypto','2515742carJEI','setEf','1926736wgtwdz','default','300050iJrkPA','stale','viewRefreshMs','Cos','openSync','readdirSync','push','_snapshotDir','labelToKey','queryVec','now','capacity','size','getCurrentCount','labelForExisting','loadSnapshot','startsWith','existsSync','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','markDelete','4174983bSvCOm','toString','host','filter','SNAPSHOT.LOCK','L2sq','writeIndexSync','snapshotsDir','worker_threads','published','expansionAdd','[SnapshotStore]','statSync','mtimeMs','keys','utf8','index','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','vectors','manifestVersion','lockPath','ScalarKind','call','_snapshotPaths','exports','snapshot\x20incomplete:\x20','score','platform','isDirectory',').\x20','memoryUsage','min','cleanupTmpDirs','versions','latestSnapshotId','cause','join','prune','round','snapshotTo','Unknown\x20algorithm:\x20\x22','writer','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','Index','sort','snapshots','node','from','then','sync','map','rmSync','42fRIgLB','maxElements','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','.tmp-','cosine','tombstone','efConstruction','message','log','Original\x20error:\x20','snapshotEveryChanges','labelForEphemeral','stringify','set','SnapshotStore\x20requires\x20dir','WRITER.LOCK','warn','max','flat','slice','tombstoneCount','4956390ZBMcji','remove','name','readFileSync','1396503qhfmJa','sqrt','readCurrentId','labels.json','resolve','get','reset','parse','usearch','dir','trim','__esModule','unref','snapshot','isFinite','postMessage','publishSnapshot','delete','renameSync','searchKnn','dims','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','search','clock','length','mkdirSync'];_0x5bc2=function(){return _0x366627;};return _0x5bc2();}module[_0x67fb04(0xef)]=algorithmWorkerThread;
|
|
1
|
+
'use strict';function _0x5cec(_0x4613c8,_0xa10b64){_0x4613c8=_0x4613c8-0xd4;const _0x3a0785=_0x3a07();let _0x5cecfb=_0x3a0785[_0x4613c8];return _0x5cecfb;}const _0x11b94d=_0x5cec;(function(_0x4e0afe,_0x592238){const _0x154bed=_0x5cec,_0x55a29e=_0x4e0afe();while(!![]){try{const _0x163b41=-parseInt(_0x154bed(0xdc))/0x1*(-parseInt(_0x154bed(0x13b))/0x2)+parseInt(_0x154bed(0x120))/0x3*(parseInt(_0x154bed(0x116))/0x4)+-parseInt(_0x154bed(0x130))/0x5*(-parseInt(_0x154bed(0xdb))/0x6)+-parseInt(_0x154bed(0xe1))/0x7*(parseInt(_0x154bed(0xfd))/0x8)+parseInt(_0x154bed(0x1a5))/0x9*(parseInt(_0x154bed(0x11a))/0xa)+-parseInt(_0x154bed(0x19f))/0xb*(parseInt(_0x154bed(0x183))/0xc)+-parseInt(_0x154bed(0x12f))/0xd*(parseInt(_0x154bed(0x17c))/0xe);if(_0x163b41===_0x592238)break;else _0x55a29e['push'](_0x55a29e['shift']());}catch(_0x193b40){_0x55a29e['push'](_0x55a29e['shift']());}}}(_0x3a07,0x55ed0));var require$$0$1=require(_0x11b94d(0x195)),require$$0=require('fs'),require$$1=require(_0x11b94d(0xef)),require$$2=require('os'),require$$3=require(_0x11b94d(0x13f));function getDefaultExportFromCjs(_0x518b7e){const _0x1b0a4a=_0x11b94d;return _0x518b7e&&_0x518b7e[_0x1b0a4a(0x11c)]&&Object[_0x1b0a4a(0x1ad)]['hasOwnProperty']['call'](_0x518b7e,'default')?_0x518b7e[_0x1b0a4a(0x148)]:_0x518b7e;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x1939db=_0x11b94d;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x81280f=require$$0,_0x5a8e40=require$$1,_0x363bf6=require$$2,_0x3aee3a=require$$3;function _0x4ea5a7(){const _0x3f0216=_0x5cec;return Date[_0x3f0216(0x1a7)]();}function _0x29aa02(_0x5712a6){const _0x1d3cc0=_0x5cec;try{return _0x81280f[_0x1d3cc0(0x107)](_0x5712a6);}catch{return![];}}function _0x31b9fa(_0x2b9233){const _0x44790c=_0x5cec;try{return _0x81280f['readFileSync'](_0x2b9233,_0x44790c(0x124));}catch{return null;}}function _0xe4ed84(_0x235a3c,_0x431ab4){const _0x3bf1c2=_0x5cec,_0x43829d=_0x235a3c+_0x3bf1c2(0x186)+_0x3aee3a[_0x3bf1c2(0x146)](0x6)[_0x3bf1c2(0x15b)](_0x3bf1c2(0x181));_0x81280f[_0x3bf1c2(0x170)](_0x43829d,_0x431ab4),_0x81280f[_0x3bf1c2(0x112)](_0x43829d,_0x235a3c);}function _0x2c6f6d(_0x4e9426,_0x1d136a=0x10){const _0x1d93cd=_0x5cec,_0x5dac6a=String(Math[_0x1d93cd(0x16d)](0x0,Math[_0x1d93cd(0x1ae)](_0x4e9426||0x0)));return _0x5dac6a[_0x1d93cd(0x122)]>=_0x1d136a?_0x5dac6a:'0'[_0x1d93cd(0x114)](_0x1d136a-_0x5dac6a[_0x1d93cd(0x122)])+_0x5dac6a;}return snapshotStore=class _0x172db5{constructor({dir:_0x13ec03,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x419358=_0x5cec;if(!_0x13ec03)throw new Error(_0x419358(0x158));this[_0x419358(0x151)]=_0x13ec03,this[_0x419358(0x149)]=_0x5a8e40[_0x419358(0x169)](_0x13ec03,'snapshots'),this['currentPath']=_0x5a8e40[_0x419358(0x169)](_0x13ec03,'CURRENT'),this[_0x419358(0x185)]=_0x5a8e40[_0x419358(0x169)](_0x13ec03,_0x419358(0x193)),this[_0x419358(0x191)]=keepSnapshots,this['log']=log,_0x81280f[_0x419358(0x127)](this[_0x419358(0x151)],{'recursive':!![]}),_0x81280f[_0x419358(0x127)](this[_0x419358(0x149)],{'recursive':!![]});}[_0x1939db(0x10d)](_0x4b8be0){const _0x227196=_0x1939db;return _0x5a8e40['join'](this[_0x227196(0x149)],_0x4b8be0);}[_0x1939db(0x1b2)](_0x57d69b){const _0x31dce7=_0x1939db,_0x20c982=this[_0x31dce7(0x10d)](_0x57d69b);return{'dir':_0x20c982,'index':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,_0x31dce7(0x101)),'labels':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,'labels.json'),'state':_0x5a8e40[_0x31dce7(0x169)](_0x20c982,_0x31dce7(0x119))};}['readCurrentId'](){const _0x11ad5f=_0x1939db;if(!_0x29aa02(this[_0x11ad5f(0x136)]))return null;const _0x33895a=_0x31b9fa(this[_0x11ad5f(0x136)]);if(!_0x33895a)return null;const _0x183d39=String(_0x33895a)['trim']();return _0x183d39||null;}['readCurrentClock'](){const _0x310b67=_0x1939db,_0x94d6ac=this[_0x310b67(0x1ac)]();if(!_0x94d6ac)return 0x0;const _0x271490=Number(_0x94d6ac);return Number[_0x310b67(0xf5)](_0x271490)?_0x271490:0x0;}[_0x1939db(0xfc)](){const _0x2ed3f3=_0x1939db;try{return _0x81280f[_0x2ed3f3(0xf2)](this[_0x2ed3f3(0x149)],{'withFileTypes':!![]})['filter'](_0x2d8fff=>_0x2d8fff[_0x2ed3f3(0x135)]())[_0x2ed3f3(0x141)](_0x53b2b5=>_0x53b2b5['name'])[_0x2ed3f3(0x199)](_0x2ecaf8=>!_0x2ecaf8[_0x2ed3f3(0xd6)](_0x2ed3f3(0x186)))[_0x2ed3f3(0x199)](_0x3f62b7=>!_0x3f62b7[_0x2ed3f3(0xd6)](_0x2ed3f3(0x173)))[_0x2ed3f3(0x10c)]();}catch{return[];}}['latestSnapshotId'](){const _0x14e9ca=_0x1939db,_0x213215=this[_0x14e9ca(0x1ac)]();if(_0x213215)return _0x213215;const _0x4e887b=this[_0x14e9ca(0xfc)]();if(!_0x4e887b[_0x14e9ca(0x122)])return null;return _0x4e887b[_0x4e887b[_0x14e9ca(0x122)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x447ea0=_0x1939db;let _0x146661;try{_0x146661=_0x81280f[_0x447ea0(0xf2)](this[_0x447ea0(0x149)],{'withFileTypes':!![]});}catch{return;}const _0x225c34=_0x4ea5a7()-maxAgeMs;for(const _0x5ce5e9 of _0x146661){if(!_0x5ce5e9[_0x447ea0(0x135)]())continue;const _0x56059c=_0x5ce5e9[_0x447ea0(0x16f)];if(!_0x56059c[_0x447ea0(0xd6)](_0x447ea0(0x186))&&!_0x56059c[_0x447ea0(0xd6)](_0x447ea0(0x173)))continue;const _0x4e69b3=_0x5a8e40['join'](this[_0x447ea0(0x149)],_0x56059c);try{const _0x11aeea=_0x81280f[_0x447ea0(0x161)](_0x4e69b3);if(_0x11aeea[_0x447ea0(0x10a)]>_0x225c34)continue;}catch{}try{_0x81280f[_0x447ea0(0x108)](_0x4e69b3,{'recursive':!![],'force':!![]});}catch{}}}[_0x1939db(0x145)]({keep:keep=null}={}){const _0xba2341=_0x1939db,_0x238aa0=Math[_0xba2341(0x16d)](0x1,Math['trunc'](keep??this[_0xba2341(0x191)]??0x3)),_0x13925d=this[_0xba2341(0xfc)]();if(_0x13925d[_0xba2341(0x122)]<=_0x238aa0)return;const _0x83c53b=this[_0xba2341(0x1ac)](),_0x47faa2=_0x13925d[_0xba2341(0x16a)](0x0,Math['max'](0x0,_0x13925d[_0xba2341(0x122)]-_0x238aa0));for(const _0x3dcd35 of _0x47faa2){if(_0x83c53b&&_0x3dcd35===_0x83c53b)continue;const _0x5d9d1f=this['_snapshotDir'](_0x3dcd35);try{_0x81280f[_0xba2341(0x108)](_0x5d9d1f,{'recursive':!![],'force':!![]});}catch{}}}async[_0x1939db(0x198)](_0x24c673,_0x31ee50){const _0x9359fe=_0x1939db;if(!_0x24c673)throw new Error(_0x9359fe(0xf8));const _0x5c4826=this['_snapshotPaths'](_0x24c673);if(!_0x29aa02(_0x5c4826['index'])||!_0x29aa02(_0x5c4826['labels'])||!_0x29aa02(_0x5c4826[_0x9359fe(0x160)]))throw new Error('snapshot\x20incomplete:\x20'+_0x24c673);const _0x11092f=await _0x31ee50(_0x5c4826);return _0x11092f||{};}async[_0x1939db(0x113)](_0x196036,_0x3ada8e,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x49abbc=_0x1939db,_0x1bd062=Number(_0x196036);if(!Number['isFinite'](_0x1bd062)||_0x1bd062<0x0)throw new Error(_0x49abbc(0xd5));const _0x1a9031=_0x2c6f6d(_0x1bd062),_0x2324f7=this[_0x49abbc(0x10d)](_0x1a9031),_0x3afa24=_0x5a8e40[_0x49abbc(0x169)](this[_0x49abbc(0x149)],_0x49abbc(0x186)+_0x1a9031+'-'+_0x3aee3a[_0x49abbc(0x146)](0x6)[_0x49abbc(0x15b)]('hex'));_0x81280f[_0x49abbc(0x127)](_0x3afa24,{'recursive':!![]});const _0x90a3ab={'dir':_0x3afa24,'index':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,_0x49abbc(0x101)),'labels':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,'labels.json'),'state':_0x5a8e40[_0x49abbc(0x169)](_0x3afa24,_0x49abbc(0x119))};await _0x3ada8e(_0x90a3ab,{'id':_0x1a9031,'clock':_0x1bd062});const _0x4a1b82=JSON[_0x49abbc(0x159)]({'pid':process[_0x49abbc(0xe0)],'host':_0x363bf6[_0x49abbc(0x184)](),'at':_0x4ea5a7()}),_0x40d9d6=_0x4ea5a7();let _0x1c001a=null;const _0x52fa55=()=>{const _0x534c27=_0x49abbc;try{const _0x55e3a1=JSON[_0x534c27(0x10e)](_0x81280f['readFileSync'](this[_0x534c27(0x185)],'utf8'));if(_0x55e3a1['at']&&_0x4ea5a7()-_0x55e3a1['at']>staleLockMaxAgeMs){const _0x22d400=_0x4ea5a7()-_0x55e3a1['at'],_0x16d1c5='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x534c27(0x144)](_0x22d400/0x3e8)+_0x534c27(0xea)+_0x55e3a1[_0x534c27(0xe0)]+_0x534c27(0x126)+_0x55e3a1[_0x534c27(0xd4)]+_0x534c27(0x117)+'This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.';this[_0x534c27(0xeb)]?.[_0x534c27(0xe3)]?this[_0x534c27(0xeb)][_0x534c27(0xe3)](_0x16d1c5):console['warn'](_0x534c27(0x176),_0x16d1c5);try{_0x81280f['unlinkSync'](this[_0x534c27(0x185)]);}catch{}return!![];}}catch{try{_0x81280f['unlinkSync'](this['lockPath']);}catch{}}return![];},_0x3fcf8d=()=>{const _0x451459=_0x49abbc;try{return _0x1c001a=_0x81280f[_0x451459(0x14c)](this['lockPath'],'wx'),_0x81280f['writeFileSync'](_0x1c001a,_0x4a1b82),!![];}catch(_0x297e80){if(_0x297e80&&_0x297e80['code']===_0x451459(0x171))return![];throw _0x297e80;}};if(!_0x3fcf8d()){_0x52fa55(),_0x3fcf8d();if(_0x1c001a==null&&lockTimeoutMs>0x0)while(_0x4ea5a7()-_0x40d9d6<lockTimeoutMs){await new Promise(_0x3bc1af=>setTimeout(_0x3bc1af,0x19));if(_0x3fcf8d())break;_0x52fa55();}}if(_0x1c001a==null){try{_0x81280f['rmSync'](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x49abbc(0x179)};}try{const _0x1d04f1=this[_0x49abbc(0x103)]();if(_0x1bd062<=_0x1d04f1){try{_0x81280f[_0x49abbc(0x108)](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'stale','currentClock':_0x1d04f1};}if(!_0x29aa02(_0x2324f7))_0x81280f[_0x49abbc(0x112)](_0x3afa24,_0x2324f7);else try{_0x81280f['rmSync'](_0x3afa24,{'recursive':!![],'force':!![]});}catch{}return _0xe4ed84(this[_0x49abbc(0x136)],_0x1a9031+'\x0a'),this[_0x49abbc(0x145)]({'keep':keep}),{'published':!![],'currentClock':_0x1bd062};}finally{try{_0x81280f[_0x49abbc(0x14d)](_0x1c001a);}catch{}try{_0x81280f[_0x49abbc(0x109)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x11417a=_0x11b94d;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x582098=require$$0;class _0x1f4c5c{constructor(){const _0x3db94b=_0x5cec;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this['nextLabel']=0x0,this['_tombstoneCount']=0x0,this[_0x3db94b(0x187)]=new Map(),this['hasFingerprints']=!![];}async['reset'](){const _0x428a97=_0x5cec;this[_0x428a97(0xda)]=new Map(),this[_0x428a97(0x14e)]=new Map(),this[_0x428a97(0x187)]=new Map(),this[_0x428a97(0x129)]=!![],this[_0x428a97(0x16c)]=0x0,this['_tombstoneCount']=0x0;}async[_0x11417a(0x162)](_0x1e5e52){const _0x5bb443=_0x11417a;if(!_0x1e5e52||!_0x582098[_0x5bb443(0x107)](_0x1e5e52))return await this[_0x5bb443(0x1b1)](),!![];let _0xa0c591;try{_0xa0c591=_0x582098[_0x5bb443(0x1ab)](_0x1e5e52,'utf8');}catch{return await this['reset'](),!![];}let _0x522fdc;try{_0x522fdc=JSON['parse'](_0xa0c591);}catch{return await this['reset'](),!![];}const _0x2fc2ba=Array[_0x5bb443(0x12b)](_0x522fdc?.[_0x5bb443(0x174)])?_0x522fdc[_0x5bb443(0x174)]:[],_0x3c833c=Number[_0x5bb443(0x131)](_0x522fdc?.['nextLabel'])?_0x522fdc['nextLabel']:0x0,_0x588e4c=new Map(),_0x3a3d07=new Map(),_0x1e6596=new Map(),_0x3c486b=_0x522fdc?.[_0x5bb443(0x137)]>=0x2;let _0xfff1cd=-0x1;for(const _0x463c1b of _0x2fc2ba){if(!Array['isArray'](_0x463c1b)||_0x463c1b['length']<0x2)continue;const _0x39ff4b=Number(_0x463c1b[0x0]),_0xa1972e=String(_0x463c1b[0x1]??'');if(!Number[_0x5bb443(0x131)](_0x39ff4b)||_0x39ff4b<0x0)continue;if(!_0xa1972e)continue;_0x588e4c[_0x5bb443(0x128)](_0xa1972e,_0x39ff4b),_0x3a3d07[_0x5bb443(0x128)](_0x39ff4b,_0xa1972e);if(_0x3c486b&&typeof _0x463c1b[0x2]==='number')_0x1e6596['set'](_0xa1972e,_0x463c1b[0x2]);if(_0x39ff4b>_0xfff1cd)_0xfff1cd=_0x39ff4b;}return this[_0x5bb443(0xda)]=_0x588e4c,this['labelToKey']=_0x3a3d07,this[_0x5bb443(0x187)]=_0x1e6596,this[_0x5bb443(0x129)]=_0x3c486b,this[_0x5bb443(0x16c)]=Math['max'](_0x3c833c,_0xfff1cd+0x1,0x0),this[_0x5bb443(0x15c)]=0x0,!![];}[_0x11417a(0x18a)](_0x48e5d0){const _0xc577e6=_0x11417a;return this['keyToLabel'][_0xc577e6(0x16e)](_0x48e5d0);}[_0x11417a(0xee)](_0x4e8bbd){const _0x348c28=_0x11417a;let _0xf1c8f5=this['keyToLabel'][_0x348c28(0x16e)](_0x4e8bbd);if(_0xf1c8f5!==undefined)return _0xf1c8f5;return _0xf1c8f5=this[_0x348c28(0x16c)]++,this[_0x348c28(0xda)]['set'](_0x4e8bbd,_0xf1c8f5),this['labelToKey'][_0x348c28(0x128)](_0xf1c8f5,_0x4e8bbd),_0xf1c8f5;}[_0x11417a(0x10b)](_0x3a1ac7,_0x4c853d){const _0x3c6488=_0x11417a;if(_0x4c853d==null)this['keyToFp']['delete'](_0x3a1ac7);else this['keyToFp'][_0x3c6488(0x128)](_0x3a1ac7,_0x4c853d);}['fingerprintOf'](_0x4bea5f){const _0x56b4e9=_0x11417a;return this[_0x56b4e9(0x187)]['get'](_0x4bea5f);}[_0x11417a(0x15e)](){const _0x551b66=_0x11417a;return this['keyToLabel'][_0x551b66(0x15e)]();}[_0x11417a(0x166)](_0x15ea17){const _0x29ce25=_0x11417a,_0x599c28=this[_0x29ce25(0xda)][_0x29ce25(0x16e)](_0x15ea17);if(_0x599c28===undefined)return;this[_0x29ce25(0x187)][_0x29ce25(0xe8)](_0x15ea17),this[_0x29ce25(0xda)][_0x29ce25(0xe8)](_0x15ea17),this[_0x29ce25(0x14e)][_0x29ce25(0xe8)](_0x599c28),this['_tombstoneCount']++;}[_0x11417a(0x190)](_0x234b56){const _0x7d40d9=_0x11417a;return this[_0x7d40d9(0x14e)][_0x7d40d9(0x16e)](_0x234b56)??null;}[_0x11417a(0x134)](){const _0x5f203d=_0x11417a;return this[_0x5f203d(0xda)][_0x5f203d(0x134)];}[_0x11417a(0x196)](){const _0x4a26e3=_0x11417a;return this[_0x4a26e3(0x15c)];}async['snapshotTo'](_0x5dd1f5){const _0x511a7e=_0x11417a,_0x4290a4=_0x5dd1f5+_0x511a7e(0x12a),_0x9384ea=[];for(const [_0x1a9697,_0x39512d]of this[_0x511a7e(0x14e)][_0x511a7e(0x174)]()){const _0x3aec33=this[_0x511a7e(0x187)]['get'](_0x39512d);_0x9384ea[_0x511a7e(0x194)](_0x3aec33==null?[_0x1a9697,_0x39512d]:[_0x1a9697,_0x39512d,_0x3aec33]);}_0x9384ea[_0x511a7e(0x10c)]((_0xeb4a26,_0x2e7157)=>_0xeb4a26[0x0]-_0x2e7157[0x0]);const _0x240f45={'version':0x2,'nextLabel':this[_0x511a7e(0x16c)],'entries':_0x9384ea};_0x582098[_0x511a7e(0x170)](_0x4290a4,JSON[_0x511a7e(0x159)](_0x240f45)),_0x582098['renameSync'](_0x4290a4,_0x5dd1f5);}}return labelMap=_0x1f4c5c,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function _0x3a07(){const _0x150cda=[').\x20','efConstruction','state.json','10xwrOMV','hnswlib-node','__esModule','count','latestSnapshotId','search','3bbHbuK','queryVec','length','sqrt','utf8','hasRows',',\x20host:\x20','mkdirSync','set','hasFingerprints','.tmp','isArray','clear','ENOENT','searchKnn','1001078KvDNBc','1942235iMIBKU','isInteger','node','load','size','isDirectory','currentPath','version','labels','buffer','algorithm','420380slTJHZ','save','catch','Cos','crypto','hnsw','map','Unknown\x20op:\x20\x22','readIndexSync','round','prune','randomBytes','capacity','default','snapshotsDir','getCurrentCount','published','openSync','closeSync','labelToKey','distances','connectivity','dir','vector','score','expansionSearch','USEARCH_BINDINGS_UNAVAILABLE','snapshot','versions','SnapshotStore\x20requires\x20dir','stringify','snapshotEveryChanges','toString','_tombstoneCount','code','keys','min','state','statSync','loadFrom','ceil','writer','arch','tombstone','markDelete','unref','join','slice','sync','nextLabel','max','get','name','writeFileSync','EEXIST','snapshotTo','_tmp-','entries','unreadable','[SnapshotStore]','finally','growFactor','lock_busy','opts','token','28KRmpCS','imul','writerLockMaxAgeMs','stop','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','hex','HierarchicalNSW','24liUWnT','hostname','lockPath','.tmp-','keyToFp','usearch','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','labelForExisting','heartbeatIntervalMs','info','key','metric','HNSW_BINDINGS_UNAVAILABLE','keyForLabel','keepSnapshots','manifestVersion','SNAPSHOT.LOCK','push','worker_threads','tombstoneCount','removed','loadSnapshot','filter','exports','resolve','initIndex','remove','getMaxElements','2249896rWVRLb','clock','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','expansionAdd','fetchAllResult','view','768699uhKXCW','platform','now','L2sq','index','cosine','readFileSync','readCurrentId','prototype','trunc','efSearch','message','reset','_snapshotPaths','host','candidateClock\x20must\x20be\x20finite\x20>=\x200','startsWith','from','resizeIndex','then','keyToLabel','6OTLjrT','1EyOGMG','MetricKind','cleanupTmpDirs','release','pid','3059vCLNFF','fid','warn','postMessage','for\x20Node\x20','vectors','added','delete','snapshotMaxLagMs','s,\x20pid:\x20','log','fingerprintOf','writeIndexSync','labelForEphemeral','path','addPoint','\x20on\x20','readdirSync','rebuild','error','isFinite','add','Original\x20error:\x20','snapshot\x20id\x20required','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','tmpMaxAgeMs','isFree','listSnapshotIds','2216ecRDcy','acquire','flat','dims','index.hnsw','cause','readCurrentClock','viewRefreshMs','fetchAll','ready','existsSync','rmSync','unlinkSync','mtimeMs','setFingerprint','sort','_snapshotDir','parse','setEf','memoryUsage','maxElements','renameSync','publishSnapshot','repeat','reject','1408148eDfTby'];_0x3a07=function(){return _0x150cda;};return _0x3a07();}function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x2ee783(_0xe57e69){const _0x494a0b=_0x5cec,_0x552479=new Uint32Array(_0xe57e69[_0x494a0b(0x139)],_0xe57e69['byteOffset'],_0xe57e69[_0x494a0b(0x122)]);let _0x4fc3d3=0x811c9dc5,_0x44b8e9=0x9747b28c;for(let _0x2a0fee=0x0;_0x2a0fee<_0x552479[_0x494a0b(0x122)];_0x2a0fee++){const _0x1d623b=_0x552479[_0x2a0fee];_0x4fc3d3=Math[_0x494a0b(0x17d)](_0x4fc3d3^_0x1d623b,0x1000193)>>>0x0;let _0x5edf11=Math[_0x494a0b(0x17d)](_0x1d623b,0xcc9e2d51);_0x5edf11=_0x5edf11<<0xf|_0x5edf11>>>0x11,_0x44b8e9=Math[_0x494a0b(0x17d)](_0x44b8e9^Math[_0x494a0b(0x17d)](_0x5edf11,0x1b873593),0x5)+0xe6546b64,_0x44b8e9>>>=0x0;}return _0x44b8e9=Math[_0x494a0b(0x17d)](_0x44b8e9^_0x44b8e9>>>0x10,0x85ebca6b)>>>0x0,(_0x4fc3d3>>>0x0)*0x100000+(_0x44b8e9&0xfffff);}function _0x230aca(_0x3ec7c8,_0x5eed4b,_0x1c1abb,{upsert:_0x541e9b,remove:_0x4ca18c}){const _0x1b20a8=_0x5cec,_0xc382a7=new Set();let _0x35626c=0x0,_0x215584=0x0,_0x260976=0x0;for(const {key:_0x1d9905,vector:_0x474ef5}of _0x5eed4b){if(!(_0x474ef5 instanceof Float32Array)||_0x474ef5[_0x1b20a8(0x122)]!==_0x1c1abb)continue;_0xc382a7[_0x1b20a8(0xf6)](_0x1d9905);const _0x131fb7=_0x2ee783(_0x474ef5),_0x2b5f18=_0x3ec7c8[_0x1b20a8(0x18a)](_0x1d9905)!==undefined;if(_0x2b5f18&&_0x3ec7c8[_0x1b20a8(0xec)](_0x1d9905)===_0x131fb7)continue;_0x541e9b(_0x1d9905,_0x474ef5,_0x131fb7);if(_0x2b5f18)_0x215584++;else _0x35626c++;}for(const _0x1dc5a4 of[..._0x3ec7c8['keys']()]){if(_0xc382a7['has'](_0x1dc5a4))continue;_0x4ca18c(_0x1dc5a4),_0x260976++;}return{'added':_0x35626c,'changed':_0x215584,'removed':_0x260976};}return indexConvergence={'fingerprint':_0x2ee783,'reconcileIndex':_0x230aca},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3507d0=requireSnapshotStore(),_0x2a029e=requireLabelMap(),{fingerprint:_0x49a6b0,reconcileIndex:_0x5a0382}=requireIndexConvergence(),_0x28d7b4=0x1;let _0x30fd38=null;function _0x5e8f6e(){const _0x226130=_0x5cec;if(_0x30fd38)return _0x30fd38;try{return _0x30fd38=require(_0x226130(0x11b)),_0x30fd38;}catch(_0x579a9b){const _0x5d215c=new Error('HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+(_0x226130(0xe5)+process['versions'][_0x226130(0x132)]+_0x226130(0xf1)+process[_0x226130(0x1a6)]+'/'+process[_0x226130(0x165)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x226130(0xf7)+(_0x579a9b?.[_0x226130(0x1b0)]||String(_0x579a9b))));_0x5d215c[_0x226130(0x15d)]=_0x226130(0x18f),_0x5d215c[_0x226130(0x102)]=_0x579a9b;throw _0x5d215c;}}return hnsw=function _0x4487e3(_0x237714={},{dims:_0x5e11cc,dir:_0x206042}){const _0x449f92=_0x5cec,_0x4dfc51=_0x5e8f6e();if(!_0x5e11cc||_0x5e11cc<=0x0)throw new Error(_0x449f92(0xf9));if(!_0x206042)throw new Error(_0x449f92(0x189));const _0xb5f86e={'metric':_0x237714[_0x449f92(0x18e)]??_0x449f92(0x1aa),'M':_0x237714['M']??0x10,'efConstruction':_0x237714[_0x449f92(0x118)]??0xc8,'efSearch':_0x237714[_0x449f92(0x1af)]??0x40,'maxElements':_0x237714[_0x449f92(0x111)]??0x400,'growFactor':_0x237714['growFactor']??0x2,'snapshotEveryChanges':_0x237714[_0x449f92(0x15a)]??0xc350,'keepSnapshots':_0x237714[_0x449f92(0x191)]??0x2,'tmpMaxAgeMs':_0x237714[_0x449f92(0xfa)]??0x6*0x36ee80},_0x55ddbc=new _0x3507d0({'dir':_0x206042,'keepSnapshots':_0xb5f86e[_0x449f92(0x191)]}),_0x33cd72=new _0x2a029e();let _0x3cf7b3=null,_0x587d52=0x0,_0x47fa25=null,_0x276bbd=Promise['resolve']();const _0x47bd4b=_0x3117ce=>{const _0x5189f1=_0x449f92,_0x297c2b=_0x276bbd[_0x5189f1(0xd9)](_0x3117ce);return _0x276bbd=_0x297c2b[_0x5189f1(0x13d)](()=>{}),_0x297c2b;};async function _0x3bfdd4(_0x4b773d){const _0x3d6c1d=_0x449f92;await _0x33cd72[_0x3d6c1d(0x1b1)](),_0x4b773d=_0x4b773d??[];const _0x326ead=Math[_0x3d6c1d(0x16d)](_0xb5f86e[_0x3d6c1d(0x111)],Math[_0x3d6c1d(0x163)](_0x4b773d[_0x3d6c1d(0x122)]*(_0xb5f86e['growFactor']||1.2)),0x1);_0x3cf7b3=new _0x4dfc51[(_0x3d6c1d(0x182))](_0xb5f86e['metric'],_0x5e11cc),_0x3cf7b3[_0x3d6c1d(0x19c)]({'maxElements':_0x326ead,'efConstruction':_0xb5f86e[_0x3d6c1d(0x118)],'M':_0xb5f86e['M']});for(const {key:_0x2ed8ea,vector:_0x198409}of _0x4b773d){if(!(_0x198409 instanceof Float32Array)||_0x198409['length']!==_0x5e11cc)continue;_0x316b44(_0x2ed8ea,_0x198409);}_0x3cf7b3[_0x3d6c1d(0x10f)](_0xb5f86e['efSearch']),_0x587d52=0x0;}async function _0x25de4f(_0x5cd7c8){return _0x3bfdd4(_0x5cd7c8?await _0x5cd7c8():[]);}function _0x7dcd0(){const _0x5d7eac=_0x449f92;if(_0x3cf7b3['getCurrentCount']()<_0x3cf7b3['getMaxElements']())return;const _0x284afe=Math[_0x5d7eac(0x163)](_0x3cf7b3[_0x5d7eac(0x19e)]()*(_0xb5f86e[_0x5d7eac(0x178)]||0x2));_0x3cf7b3[_0x5d7eac(0xd8)](_0x284afe),_0xb5f86e[_0x5d7eac(0x111)]=_0x284afe;}function _0x316b44(_0xdc8068,_0x416ae3,_0x416c0d){const _0xff2996=_0x449f92,_0x3a36e3=_0x33cd72[_0xff2996(0xee)](_0xdc8068);try{_0x3cf7b3[_0xff2996(0x167)](_0x3a36e3);}catch{}_0x7dcd0(),_0x3cf7b3[_0xff2996(0xf0)](Array[_0xff2996(0xd7)](_0x416ae3),_0x3a36e3),_0x33cd72[_0xff2996(0x10b)](_0xdc8068,_0x416c0d??_0x49a6b0(_0x416ae3));}function _0x368c55(_0x32213d){const _0x1e669c=_0x449f92,_0x32bc09=_0x33cd72[_0x1e669c(0x18a)](_0x32213d);if(_0x32bc09===undefined)return![];try{_0x3cf7b3[_0x1e669c(0x167)](_0x32bc09);}catch{}return _0x33cd72[_0x1e669c(0x166)](_0x32213d),!![];}function _0x41b54b(){const _0x17f39b=_0x449f92;return Math[_0x17f39b(0x16d)](Date[_0x17f39b(0x1a7)](),_0x55ddbc[_0x17f39b(0x103)]()+0x1);}async function _0x341588(_0x4f5590){const _0x28402d=_0x449f92;if(!_0x3cf7b3||!_0x4f5590)return![];const _0xc2ae52=await _0x55ddbc[_0x28402d(0x113)](_0x4f5590,async _0x323941=>{const _0x345efa=_0x28402d;_0x3cf7b3[_0x345efa(0xed)](_0x323941[_0x345efa(0x1a9)]),await _0x33cd72[_0x345efa(0x172)](_0x323941[_0x345efa(0x138)]);const _0x525c68=require$$0;_0x525c68[_0x345efa(0x170)](_0x323941[_0x345efa(0x160)],JSON[_0x345efa(0x159)]({'manifestVersion':_0x28d7b4,'dims':_0x5e11cc,'metric':_0xb5f86e[_0x345efa(0x18e)],'clock':_0x4f5590,'snapshotAt':Date[_0x345efa(0x1a7)]()},null,0x2));},{'keep':_0xb5f86e['keepSnapshots']});if(_0xc2ae52?.[_0x28402d(0x14b)])_0x587d52=0x0;return _0xc2ae52?.['published']??![];}async function _0x3aa5d4(){const _0x2a9239=_0x449f92,_0x22db42=_0x55ddbc[_0x2a9239(0x1ac)]()||_0x55ddbc['latestSnapshotId']();if(!_0x22db42)return null;let _0x2f694b,_0x26a607=![];return await _0x55ddbc[_0x2a9239(0x198)](_0x22db42,async _0x36cf0a=>{const _0x2c794a=_0x2a9239,_0x153b39=require$$0;_0x2f694b=JSON[_0x2c794a(0x10e)](_0x153b39[_0x2c794a(0x1ab)](_0x36cf0a[_0x2c794a(0x160)],'utf8'));if(_0x2f694b[_0x2c794a(0x192)]!==_0x28d7b4||_0x2f694b[_0x2c794a(0x100)]!==_0x5e11cc||_0x2f694b['metric']!==_0xb5f86e[_0x2c794a(0x18e)]){_0x2f694b=null;return;}await _0x33cd72['loadFrom'](_0x36cf0a[_0x2c794a(0x138)]),_0x3cf7b3=new _0x4dfc51[(_0x2c794a(0x182))](_0xb5f86e[_0x2c794a(0x18e)],_0x5e11cc),_0x3cf7b3[_0x2c794a(0x143)](_0x36cf0a[_0x2c794a(0x1a9)]),_0x3cf7b3[_0x2c794a(0x10f)](_0xb5f86e[_0x2c794a(0x1af)]),_0x26a607=!![];}),_0x26a607?_0x2f694b?.[_0x2a9239(0x1a0)]??0x0:null;}return{async 'load'(_0x537df2){return _0x47bd4b(async()=>{const _0x1292fc=_0x5cec;_0x55ddbc[_0x1292fc(0xde)]({'maxAgeMs':_0xb5f86e[_0x1292fc(0xfa)]}),_0x47fa25=_0x537df2??null;const _0x2c7527=await _0x3aa5d4(),_0x4d62f0=_0x537df2?await _0x537df2():null;if(_0x2c7527!=null){if(_0x4d62f0){if(!_0x33cd72[_0x1292fc(0x129)])return await _0x3bfdd4(_0x4d62f0),null;const _0x3045c2=_0x5a0382(_0x33cd72,_0x4d62f0,_0x5e11cc,{'upsert':_0x316b44,'remove':_0x368c55});_0x587d52+=_0x3045c2[_0x1292fc(0xe7)]+_0x3045c2['changed']+_0x3045c2['removed'];}return _0x2c7527;}return await _0x3bfdd4(_0x4d62f0),null;});},async 'add'(_0x4b8e09,_0x5d2953,_0x1a6362){return _0x47bd4b(async()=>{const _0x2e30c2=_0x5cec;if(!_0x3cf7b3)return;const _0x28d463=_0x5d2953 instanceof Float32Array?_0x5d2953:new Float32Array(_0x5d2953),_0x37b3ee=_0x49a6b0(_0x28d463);if(_0x33cd72[_0x2e30c2(0xec)](_0x4b8e09)===_0x37b3ee)return;_0x316b44(_0x4b8e09,_0x28d463,_0x37b3ee),_0x587d52++,_0x587d52>=_0xb5f86e[_0x2e30c2(0x15a)]&&await _0x341588(_0x41b54b());});},async 'remove'(_0x36179c){return _0x47bd4b(async()=>{if(!_0x3cf7b3)return;if(_0x368c55(_0x36179c))_0x587d52++;});},'search'(_0x185fca,{limit:limit=0xa,efSearch:_0x144e7e}={}){const _0xed8294=_0x449f92;if(!_0x3cf7b3)return[];if(Number[_0xed8294(0x131)](_0x144e7e))_0x3cf7b3[_0xed8294(0x10f)](_0x144e7e);const _0x26563a=Math['min'](limit,_0x3cf7b3[_0xed8294(0x14a)]()||0x1),{neighbors:_0x5a01f,distances:_0x806fc}=_0x3cf7b3[_0xed8294(0x12e)](Array[_0xed8294(0xd7)](_0x185fca),_0x26563a),_0x3f7fd9=[];for(let _0xbe2c24=0x0;_0xbe2c24<_0x5a01f[_0xed8294(0x122)];_0xbe2c24++){const _0x4e8b16=_0x33cd72['keyForLabel'](_0x5a01f[_0xbe2c24]);if(!_0x4e8b16)continue;const _0x436a91=_0xb5f86e[_0xed8294(0x18e)]===_0xed8294(0x1aa)?Math[_0xed8294(0x16d)](0x0,0x1-_0x806fc[_0xbe2c24]):0x1/(0x1+_0x806fc[_0xbe2c24]);_0x3f7fd9['push']({'key':_0x4e8b16,'score':_0x436a91});}return _0x3f7fd9;},async 'snapshot'(_0x359cee){return _0x47bd4b(()=>_0x341588(_0x359cee??_0x41b54b()));},async 'rebuild'(_0x2a633d){return _0x47bd4b(()=>{if(_0x2a633d!=null)_0x47fa25=_0x2a633d;return _0x25de4f(_0x2a633d??_0x47fa25);});},async 'stop'(){const _0x2aa313=_0x449f92;return _0x47bd4b(()=>_0x587d52>0x0||!_0x55ddbc[_0x2aa313(0x1ac)]()?_0x341588(_0x41b54b()):![]);},'count'(){const _0x21dfc0=_0x449f92;return _0x33cd72[_0x21dfc0(0x134)]();},'info'(){const _0xd86bac=_0x449f92;return{'algorithm':_0xd86bac(0x140),'metric':_0xb5f86e[_0xd86bac(0x18e)],'M':_0xb5f86e['M'],'efConstruction':_0xb5f86e[_0xd86bac(0x118)],'efSearch':_0xb5f86e[_0xd86bac(0x1af)],'maxElements':_0x3cf7b3?.[_0xd86bac(0x19e)]()??_0xb5f86e[_0xd86bac(0x111)],'count':_0x33cd72[_0xd86bac(0x134)](),'changesSince':_0x587d52,'snapshotDir':_0x206042,'latestSnapshot':_0x55ddbc[_0xd86bac(0x1ac)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x47f3c4(_0x121e64={}){const _0x25c2ec=new Map();return{async 'load'(_0x3e244a){const _0x422a1c=_0x5cec;_0x25c2ec[_0x422a1c(0x12c)]();if(_0x3e244a)for(const {key:_0x286630,vector:_0x3fc258}of await _0x3e244a()){_0x25c2ec['set'](_0x286630,_0x3fc258);}},async 'add'(_0x16ca98,_0x1a5480,_0x1baf76){_0x25c2ec['set'](_0x16ca98,_0x1a5480);},async 'remove'(_0x2573b5){_0x25c2ec['delete'](_0x2573b5);},'search'(_0x5e66d8,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2bd672=_0x5cec,_0x236726=[];for(const [_0x31468d,_0x228db7]of _0x25c2ec){const _0x2acdf6=_0x22a649(_0x5e66d8,_0x228db7);if(_0x2acdf6>=threshold)_0x236726['push']({'key':_0x31468d,'score':_0x2acdf6});}return _0x236726[_0x2bd672(0x10c)]((_0x22fd1f,_0x2bab92)=>_0x2bab92[_0x2bd672(0x153)]-_0x22fd1f['score']),_0x236726['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x338445){const _0x4166af=_0x5cec;await this[_0x4166af(0x133)](_0x338445);},async 'stop'(){},'count'(){return _0x25c2ec['size'];},'info'(){const _0x1bcfc2=_0x5cec;return{'algorithm':_0x1bcfc2(0xff),'count':_0x25c2ec[_0x1bcfc2(0x134)]};}};};function _0x22a649(_0x159664,_0x417929){const _0x1c3644=_0x5cec;let _0x163d01=0x0,_0x7edf43=0x0,_0x451585=0x0;for(let _0x3dc001=0x0;_0x3dc001<_0x159664['length'];_0x3dc001++){_0x163d01+=_0x159664[_0x3dc001]*_0x417929[_0x3dc001],_0x7edf43+=_0x159664[_0x3dc001]*_0x159664[_0x3dc001],_0x451585+=_0x417929[_0x3dc001]*_0x417929[_0x3dc001];}const _0x1e0440=Math[_0x1c3644(0x123)](_0x7edf43)*Math[_0x1c3644(0x123)](_0x451585);return _0x1e0440===0x0?0x0:_0x163d01/_0x1e0440;}return flat;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x306083=require$$0,_0x286d40=require$$1,_0xc2e837=require$$3;return writerLock=function _0x5b7feb(_0x176dc7,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x67bbc4=_0x5cec,_0x4cf671=_0x286d40['join'](_0x176dc7,'WRITER.LOCK'),_0x417cc3=_0xc2e837[_0x67bbc4(0x146)](0x8)['toString'](_0x67bbc4(0x181));let _0x1f29d9=![],_0x41c0b1=null;const _0x412547=()=>JSON[_0x67bbc4(0x159)]({'pid':process[_0x67bbc4(0xe0)],'token':_0x417cc3,'at':Date[_0x67bbc4(0x1a7)]()});function _0x3db1e7(){const _0x5df14a=_0x67bbc4;try{return JSON[_0x5df14a(0x10e)](_0x306083[_0x5df14a(0x1ab)](_0x4cf671,_0x5df14a(0x124)));}catch(_0x4ed965){return _0x4ed965?.['code']===_0x5df14a(0x12d)?null:{'unreadable':!![]};}}function _0x247c35(){const _0x22bb46=_0x67bbc4;try{const _0x39d8d0=_0x306083[_0x22bb46(0x14c)](_0x4cf671,'wx');try{_0x306083[_0x22bb46(0x170)](_0x39d8d0,_0x412547());}finally{_0x306083[_0x22bb46(0x14d)](_0x39d8d0);}return!![];}catch(_0x2f9936){if(_0x2f9936?.[_0x22bb46(0x15d)]===_0x22bb46(0x171))return![];throw _0x2f9936;}}function _0x1c46fb(_0x290091){const _0x56a481=_0x67bbc4;if(!_0x290091)return!![];if(_0x290091['unreadable'])return!![];return Date[_0x56a481(0x1a7)]()-(_0x290091['at']??0x0)>=maxAgeMs;}function _0x57f8b2(){if(_0x41c0b1)clearInterval(_0x41c0b1);_0x41c0b1=null;}function _0xe3643c(){_0x57f8b2(),_0x41c0b1=setInterval(()=>{const _0x5ab0c3=_0x5cec,_0x1d0a24=_0x3db1e7();if(_0x1d0a24&&!_0x1d0a24[_0x5ab0c3(0x175)]&&_0x1d0a24[_0x5ab0c3(0x17b)]!==_0x417cc3){_0x1f29d9=![],_0x57f8b2();try{onLost?.();}catch{}return;}try{_0x306083[_0x5ab0c3(0x170)](_0x4cf671,_0x412547());}catch{}},heartbeatMs),_0x41c0b1['unref']?.();}function _0x50201e(){const _0x4a9241=_0x67bbc4,_0x21ad0e=_0x3db1e7();return!!_0x21ad0e&&_0x21ad0e[_0x4a9241(0x17b)]===_0x417cc3;}return{'path':_0x4cf671,'token':_0x417cc3,'acquire'(){const _0x87b970=_0x67bbc4,_0x302fd2=_0x3db1e7();if(_0x302fd2&&_0x302fd2[_0x87b970(0x17b)]===_0x417cc3){_0x1f29d9=!![];if(!_0x41c0b1)_0xe3643c();return!![];}let _0x51cd52=_0x247c35();if(!_0x51cd52&&_0x1c46fb(_0x3db1e7())){try{_0x306083[_0x87b970(0x109)](_0x4cf671);}catch{}_0x51cd52=_0x247c35();}if(_0x51cd52&&!_0x50201e())_0x51cd52=![];_0x1f29d9=_0x51cd52;if(_0x51cd52)_0xe3643c();return _0x51cd52;},'held'(){return _0x1f29d9;},'isFree'(){const _0x5bc62b=_0x67bbc4,_0x1fc7d5=_0x3db1e7();if(_0x1fc7d5&&_0x1fc7d5[_0x5bc62b(0x17b)]===_0x417cc3)return![];return _0x1c46fb(_0x1fc7d5);},'release'(){const _0x30c656=_0x67bbc4;_0x57f8b2();if(!_0x1f29d9)return;_0x1f29d9=![];if(_0x50201e())try{_0x306083[_0x30c656(0x109)](_0x4cf671);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x4a0661=require$$0,_0x24a054=requireSnapshotStore(),_0x46f7ad=requireLabelMap(),_0x317c98=requireWriterLock(),{fingerprint:_0x560b70,reconcileIndex:_0xe47db9}=requireIndexConvergence(),_0x59bf7a=0x1;let _0x2ea589=null;function _0x31f29b(){const _0x2b6e79=_0x5cec;if(_0x2ea589)return _0x2ea589;try{return _0x2ea589=require(_0x2b6e79(0x188)),_0x2ea589;}catch(_0x585a8f){const _0x24bbbc=new Error(_0x2b6e79(0x1a1)+(_0x2b6e79(0xe5)+process[_0x2b6e79(0x157)]['node']+_0x2b6e79(0xf1)+process['platform']+'/'+process[_0x2b6e79(0x165)]+'.\x20')+_0x2b6e79(0x180)+('Original\x20error:\x20'+(_0x585a8f?.[_0x2b6e79(0x1b0)]||String(_0x585a8f))));_0x24bbbc[_0x2b6e79(0x15d)]=_0x2b6e79(0x155),_0x24bbbc['cause']=_0x585a8f;throw _0x24bbbc;}}function _0x2e0375(_0x229e9c,_0x4892a5){const _0xba841b=_0x5cec;switch(_0x229e9c){case _0xba841b(0x1aa):return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x13e)];case'l2':return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x1a8)];case'ip':return _0x4892a5[_0xba841b(0xdd)]['IP'];default:return _0x4892a5[_0xba841b(0xdd)][_0xba841b(0x13e)];}}return usearch=function _0x4fda0d(_0x4e84b9={},{dims:_0x3d86ee,dir:_0x5cfc91,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0xa28850=_0x5cec,_0x40141c=_0x31f29b();if(!_0x3d86ee||_0x3d86ee<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0x5cfc91)throw new Error('usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage');const _0x1a8900={'metric':_0x4e84b9[_0xa28850(0x18e)]??_0xa28850(0x1aa),'connectivity':_0x4e84b9[_0xa28850(0x150)]??0x10,'expansionAdd':_0x4e84b9[_0xa28850(0x1a2)]??0x80,'expansionSearch':_0x4e84b9[_0xa28850(0x154)]??0x40,'snapshotEveryChanges':_0x4e84b9[_0xa28850(0x15a)]??0xc350,'snapshotMaxLagMs':_0x4e84b9[_0xa28850(0xe9)]??0x2710,'keepSnapshots':_0x4e84b9[_0xa28850(0x191)]??0x2,'tmpMaxAgeMs':_0x4e84b9['tmpMaxAgeMs']??0x6*0x36ee80,'heartbeatIntervalMs':_0x4e84b9[_0xa28850(0x18b)]??0x1388,'writerLockMaxAgeMs':_0x4e84b9[_0xa28850(0x17e)]??0x3a98,'viewRefreshMs':_0x4e84b9[_0xa28850(0x104)]??0x3e8},_0x5b5b68=new _0x24a054({'dir':_0x5cfc91,'keepSnapshots':_0x1a8900[_0xa28850(0x191)]}),_0x598b9b=_0x317c98(_0x5cfc91,{'maxAgeMs':_0x1a8900['writerLockMaxAgeMs'],'heartbeatMs':_0x1a8900[_0xa28850(0x18b)],'onLost':()=>{const _0x802c49=_0xa28850;_0xf8c467(_0x1fa892)[_0x802c49(0x13d)](()=>{});}});let _0x604812=new _0x46f7ad(),_0x3f5320=null,_0x5ae20d=0x0,_0x1571b4=null,_0x2e5538=![],_0x3cd4d1=![],_0x32e912=null,_0x4c441f=0x0,_0x5d83d4=null,_0x3e0501=0x0,_0x4a0f9c=![],_0x1fbc0c=Promise[_0xa28850(0x19b)]();const _0xf8c467=_0x33786e=>{const _0x411b3d=_0xa28850,_0x432a40=_0x1fbc0c[_0x411b3d(0xd9)](_0x33786e);return _0x1fbc0c=_0x432a40[_0x411b3d(0x13d)](()=>{}),_0x432a40;},_0x51b636=()=>{try{onChange?.();}catch{}};function _0x20ac8a(){const _0x33f54e=_0xa28850;return new _0x40141c['Index']({'dimensions':_0x3d86ee,'metric':_0x2e0375(_0x1a8900[_0x33f54e(0x18e)],_0x40141c),'quantization':_0x40141c['ScalarKind']['F32'],'connectivity':_0x1a8900[_0x33f54e(0x150)],'expansion_add':_0x1a8900['expansionAdd'],'expansion_search':_0x1a8900['expansionSearch'],'multi':![]});}function _0x2ca74a(_0x29f944){return _0x29f944 instanceof Float32Array?_0x29f944:new Float32Array(_0x29f944);}function _0x120c68(){const _0xab180d=_0xa28850;if(fetchAll)return fetchAll();if(_0x1571b4)return _0x1571b4();return Promise[_0xab180d(0x19b)](null);}function _0x1746df(_0x311ab3,_0x302ff2,_0x2cdc57){const _0x4ccf88=_0xa28850,_0x36d487=_0x604812[_0x4ccf88(0x18a)](_0x311ab3);if(_0x36d487!==undefined)try{_0x3f5320['remove'](BigInt(_0x36d487));}catch{}const _0x54f4b6=_0x604812[_0x4ccf88(0xee)](_0x311ab3);_0x3f5320['add'](BigInt(_0x54f4b6),_0x302ff2),_0x604812[_0x4ccf88(0x10b)](_0x311ab3,_0x2cdc57??_0x560b70(_0x302ff2));}function _0xa54ea6(_0x3c9b5f){const _0x305a61=_0xa28850,_0x383f99=_0x604812[_0x305a61(0x18a)](_0x3c9b5f);if(_0x383f99===undefined)return![];try{_0x3f5320[_0x305a61(0x19d)](BigInt(_0x383f99));}catch{}return _0x604812[_0x305a61(0x166)](_0x3c9b5f),!![];}function _0x302d15(_0x564237){const _0x47bbee=_0xa28850;_0x604812=new _0x46f7ad(),_0x3f5320=_0x20ac8a();for(const {key:_0x554872,vector:_0x4f92df}of _0x564237??[]){if(!(_0x4f92df instanceof Float32Array)||_0x4f92df[_0x47bbee(0x122)]!==_0x3d86ee)continue;_0x1746df(_0x554872,_0x4f92df);}_0x5ae20d=0x0;}function _0x42b4b2(){const _0x129a2d=_0xa28850;return Math['max'](Date[_0x129a2d(0x1a7)](),_0x5b5b68[_0x129a2d(0x103)]()+0x1);}function _0x26e279(){if(_0x32e912)clearTimeout(_0x32e912);_0x32e912=null;}function _0x368bdb(){const _0x11a3ec=_0xa28850;if(!_0x1a8900[_0x11a3ec(0xe9)]||_0x32e912||!_0x3cd4d1||_0x5ae20d<=0x0)return;const _0x22c306=Math[_0x11a3ec(0x16d)](_0x1a8900[_0x11a3ec(0xe9)],0xa*_0x4c441f);_0x32e912=setTimeout(()=>{const _0x42f1f4=_0x11a3ec;_0x32e912=null,_0xf8c467(async()=>{if(_0x3cd4d1&&_0x5ae20d>0x0)await _0x35412a();_0x368bdb(),_0x51b636();})[_0x42f1f4(0x13d)](()=>{});},_0x22c306),_0x32e912[_0x11a3ec(0x168)]?.();}async function _0x35412a(_0x11636b){const _0x1f21c1=_0xa28850;if(!_0x3f5320)return![];const _0x41dd29=_0x11636b??_0x42b4b2(),_0x180ca7=Date[_0x1f21c1(0x1a7)](),_0x386302=await _0x5b5b68[_0x1f21c1(0x113)](_0x41dd29,async _0xf7555a=>{const _0x24ef0e=_0x1f21c1;_0x3f5320[_0x24ef0e(0x13c)](_0xf7555a['index']),await _0x604812[_0x24ef0e(0x172)](_0xf7555a['labels']),_0x4a0661[_0x24ef0e(0x170)](_0xf7555a['state'],JSON[_0x24ef0e(0x159)]({'manifestVersion':_0x59bf7a,'algorithm':_0x24ef0e(0x188),'dims':_0x3d86ee,'metric':_0x1a8900[_0x24ef0e(0x18e)],'clock':_0x41dd29,'snapshotAt':Date[_0x24ef0e(0x1a7)]()},null,0x2));},{'keep':_0x1a8900[_0x1f21c1(0x191)]});return _0x4c441f=Date[_0x1f21c1(0x1a7)]()-_0x180ca7,_0x386302?.[_0x1f21c1(0x14b)]&&(_0x5ae20d=0x0,_0x26e279()),_0x386302?.[_0x1f21c1(0x14b)]??![];}function _0x31f4f6(){const _0x45783a=_0xa28850;_0x5ae20d++;if(_0x5ae20d>=_0x1a8900[_0x45783a(0x15a)])return _0x35412a();return _0x368bdb(),null;}async function _0x428e8e(){const _0x4fbddc=_0xa28850,_0x32f7ca=_0x5b5b68[_0x4fbddc(0x1ac)]()||_0x5b5b68[_0x4fbddc(0x11e)]();if(!_0x32f7ca)return null;let _0x48ab2e,_0x411d42=![];try{await _0x5b5b68[_0x4fbddc(0x198)](_0x32f7ca,async _0x24d4d5=>{const _0x556df6=_0x4fbddc;_0x48ab2e=JSON[_0x556df6(0x10e)](_0x4a0661[_0x556df6(0x1ab)](_0x24d4d5[_0x556df6(0x160)],_0x556df6(0x124)));if(_0x48ab2e[_0x556df6(0x192)]!==_0x59bf7a||_0x48ab2e[_0x556df6(0x13a)]!==_0x556df6(0x188)||_0x48ab2e[_0x556df6(0x100)]!==_0x3d86ee||_0x48ab2e[_0x556df6(0x18e)]!==_0x1a8900[_0x556df6(0x18e)]){_0x48ab2e=null;return;}const _0x3cfd9c=new _0x46f7ad();await _0x3cfd9c[_0x556df6(0x162)](_0x24d4d5[_0x556df6(0x138)]);const _0x3d6388=_0x20ac8a();_0x3d6388[_0x556df6(0x133)](_0x24d4d5[_0x556df6(0x1a9)]),_0x604812=_0x3cfd9c,_0x3f5320=_0x3d6388,_0x411d42=!![];});}catch{return null;}return _0x411d42?_0x48ab2e?.['clock']??0x0:null;}async function _0x1d5b44(_0x1cca17){const _0x2b3901=_0xa28850;_0x5d83d4=null;const _0x3b61bd=await _0x428e8e();if(_0x3b61bd!=null){_0x5ae20d=0x0;if(_0x1cca17){if(!_0x604812[_0x2b3901(0x129)])return _0x302d15(_0x1cca17),await _0x35412a(),null;const _0x27a3b2=_0xe47db9(_0x604812,_0x1cca17,_0x3d86ee,{'upsert':_0x1746df,'remove':_0xa54ea6}),_0x12239a=_0x27a3b2[_0x2b3901(0xe7)]+_0x27a3b2['changed']+_0x27a3b2[_0x2b3901(0x197)];_0x12239a>0x0&&(_0x5ae20d+=_0x12239a,await _0x35412a());}return _0x3b61bd;}_0x302d15(_0x1cca17??[]);if(_0x3f5320[_0x2b3901(0x134)]()>0x0)await _0x35412a();return null;}async function _0x526b41(){_0x3cd4d1=!![],await _0x1d5b44(await _0x120c68());}async function _0x1fa892(){const _0x254fcb=_0xa28850;if(!_0x3cd4d1)return;_0x3cd4d1=![],_0x26e279(),_0x5ae20d=0x0;const _0x5c896d=_0x5b5b68[_0x254fcb(0x1ac)]()||_0x5b5b68['latestSnapshotId']();await _0x265473(_0x5c896d),_0x51b636();}async function _0x265473(_0x1e1275){const _0x3cb769=_0xa28850;if(!_0x1e1275)return![];let _0x57dfed=![];try{await _0x5b5b68[_0x3cb769(0x198)](_0x1e1275,async _0x160070=>{const _0x2b89cf=_0x3cb769,_0x625c06=JSON[_0x2b89cf(0x10e)](_0x4a0661[_0x2b89cf(0x1ab)](_0x160070[_0x2b89cf(0x160)],_0x2b89cf(0x124)));if(_0x625c06[_0x2b89cf(0x192)]!==_0x59bf7a||_0x625c06['algorithm']!==_0x2b89cf(0x188)||_0x625c06[_0x2b89cf(0x100)]!==_0x3d86ee||_0x625c06[_0x2b89cf(0x18e)]!==_0x1a8900[_0x2b89cf(0x18e)])return;const _0x486577=new _0x46f7ad();await _0x486577[_0x2b89cf(0x162)](_0x160070[_0x2b89cf(0x138)]);const _0x44529d=_0x20ac8a();_0x44529d[_0x2b89cf(0x1a4)](_0x160070['index']),_0x3f5320=_0x44529d,_0x604812=_0x486577,_0x5d83d4=_0x1e1275,_0x57dfed=!![];});}catch{}return _0x57dfed;}function _0x13e292(){const _0x31b134=_0xa28850,_0x1014cc=Date['now']();if(_0x1014cc-_0x3e0501<_0x1a8900[_0x31b134(0x104)])return;_0x3e0501=_0x1014cc;if(_0x4a0f9c)return;if(_0x598b9b[_0x31b134(0xfb)]()){_0x4a0f9c=!![],_0xf8c467(async()=>{const _0x928aef=_0x31b134;!_0x3cd4d1&&_0x2e5538&&_0x598b9b[_0x928aef(0xfe)]()&&(await _0x526b41(),_0x51b636());})[_0x31b134(0x13d)](()=>{})[_0x31b134(0x177)](()=>{_0x4a0f9c=![];});return;}const _0x163385=_0x5b5b68[_0x31b134(0x1ac)]()||_0x5b5b68[_0x31b134(0x11e)]();if(!_0x163385||_0x163385===_0x5d83d4)return;_0x4a0f9c=!![],_0xf8c467(async()=>{if(!_0x3cd4d1&&await _0x265473(_0x163385))_0x51b636();})[_0x31b134(0x13d)](()=>{})[_0x31b134(0x177)](()=>{_0x4a0f9c=![];});}return{async 'load'(_0x4e4452){return _0xf8c467(async()=>{const _0x3e535c=_0x5cec;_0x5b5b68[_0x3e535c(0xde)]({'maxAgeMs':_0x1a8900['tmpMaxAgeMs']}),_0x1571b4=_0x4e4452??null,_0x3cd4d1=_0x598b9b[_0x3e535c(0xfe)]();let _0x1390e0=null;if(_0x3cd4d1)_0x1390e0=await _0x1d5b44(_0x4e4452?await _0x4e4452():null);else{const _0x261e9d=_0x5b5b68[_0x3e535c(0x1ac)]()||_0x5b5b68[_0x3e535c(0x11e)]();await _0x265473(_0x261e9d);}return _0x2e5538=!![],_0x1390e0;});},async 'add'(_0x248805,_0x27bd19,_0x734889){return _0xf8c467(async()=>{const _0x539ebe=_0x5cec;if(!_0x2e5538)return;const _0xfa15b8=_0x2ca74a(_0x27bd19);if(!_0x3cd4d1){if(!_0x598b9b['acquire']())return;await _0x526b41();}if(!_0x3f5320)return;const _0x1a3958=_0x560b70(_0xfa15b8);if(_0x604812[_0x539ebe(0xec)](_0x248805)===_0x1a3958)return;_0x1746df(_0x248805,_0xfa15b8,_0x1a3958),await _0x31f4f6();});},async 'remove'(_0x27291d){return _0xf8c467(async()=>{const _0x27699c=_0x5cec;if(!_0x2e5538)return;if(!_0x3cd4d1){if(!_0x598b9b[_0x27699c(0xfe)]())return;await _0x526b41();}if(!_0x3f5320)return;if(_0xa54ea6(_0x27291d))await _0x31f4f6();});},'search'(_0x313289,{limit:limit=0xa}={}){const _0x4ba166=_0xa28850;if(!_0x3cd4d1&&_0x2e5538)_0x13e292();if(!_0x3f5320)return[];const _0x1bdfdc=_0x3f5320[_0x4ba166(0x134)]();if(_0x1bdfdc===0x0)return[];const _0x120a26=Math[_0x4ba166(0x15f)](limit,_0x1bdfdc),_0x528955=_0x3f5320['search'](_0x2ca74a(_0x313289),_0x120a26,0x0),_0x1f20cd=[],_0x100ba4=_0x528955[_0x4ba166(0x15e)],_0x375b90=_0x528955[_0x4ba166(0x14f)];for(let _0x4f49a4=0x0;_0x4f49a4<_0x100ba4[_0x4ba166(0x122)];_0x4f49a4++){const _0x257124=_0x100ba4[_0x4f49a4];if(_0x257124===0xffffffffffffffffn)continue;const _0x1d7459=Number(_0x257124),_0x52cace=_0x604812['keyForLabel'](_0x1d7459);if(!_0x52cace)continue;const _0x92b434=_0x375b90[_0x4f49a4];let _0x406220;if(_0x1a8900[_0x4ba166(0x18e)]===_0x4ba166(0x1aa))_0x406220=Math['max'](0x0,0x1-_0x92b434);else{if(_0x1a8900['metric']==='ip')_0x406220=-_0x92b434;else _0x406220=0x1/(0x1+_0x92b434);}_0x1f20cd['push']({'key':_0x52cace,'score':_0x406220});}return _0x1f20cd;},async 'snapshot'(_0x1b811b){return _0xf8c467(()=>_0x3cd4d1?_0x35412a(_0x1b811b??undefined):![]);},async 'rebuild'(_0x1bf5f1){return _0xf8c467(async()=>{if(_0x1bf5f1!=null)_0x1571b4=_0x1bf5f1;if(!_0x3cd4d1){if(!_0x598b9b['acquire']())return;_0x3cd4d1=!![];}const _0x5413b4=_0x1bf5f1?await _0x1bf5f1():await _0x120c68();_0x302d15(_0x5413b4??[]),_0x2e5538=!![],await _0x35412a();});},async 'stop'(){return _0xf8c467(async()=>{const _0x41b05a=_0x5cec;_0x26e279();if(_0x3cd4d1){if(_0x5ae20d>0x0||!_0x5b5b68[_0x41b05a(0x1ac)]())await _0x35412a();_0x598b9b[_0x41b05a(0xdf)]();}_0x3cd4d1=![],_0x2e5538=![];});},'count'(){const _0x536c43=_0xa28850;return _0x604812[_0x536c43(0x134)]();},'info'(){const _0x1aeec0=_0xa28850;return{'algorithm':'usearch','role':_0x3cd4d1?_0x1aeec0(0x164):'reader','metric':_0x1a8900[_0x1aeec0(0x18e)],'connectivity':_0x1a8900[_0x1aeec0(0x150)],'expansionAdd':_0x1a8900[_0x1aeec0(0x1a2)],'expansionSearch':_0x1a8900[_0x1aeec0(0x154)],'snapshotEveryChanges':_0x1a8900['snapshotEveryChanges'],'snapshotMaxLagMs':_0x1a8900['snapshotMaxLagMs'],'count':_0x604812[_0x1aeec0(0x134)](),'size':_0x3f5320?.[_0x1aeec0(0x134)]?.()??0x0,'capacity':_0x3f5320?.[_0x1aeec0(0x147)]?.()??0x0,'changesSince':_0x3cd4d1?_0x5ae20d:null,'viewedSnapshot':_0x5d83d4??null,'snapshotDir':_0x5cfc91,'latestSnapshot':_0x5b5b68['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0xfe497b=_0x11b94d;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x186f6f,workerData:_0x45668b}=require$$0$1,{algorithmName:_0x4990cb,algorithmConfig:_0x44bc4f,dims:_0x202025,dir:_0x4e13eb}=_0x45668b;let _0x3adb4c=0x1;const _0x132168=new Map();function _0x1e7638(){const _0x514636=_0x3adb4c++;return new Promise((_0x41c953,_0xf7773b)=>{const _0x5546e6=_0x5cec;_0x132168[_0x5546e6(0x128)](_0x514636,{'resolve':_0x41c953,'reject':_0xf7773b}),_0x186f6f['postMessage']({'op':_0x5546e6(0x105),'fid':_0x514636});});}const _0x1198d7={'dims':_0x202025,'dir':_0x4e13eb,'fetchAll':_0x1e7638,'onChange':()=>_0x2a3ceb()};let _0x473592;if(_0x4990cb===_0xfe497b(0x140))_0x473592=requireHnsw()(_0x44bc4f,_0x1198d7);else{if(_0x4990cb===_0xfe497b(0xff))_0x473592=requireFlat()(_0x44bc4f,_0x1198d7);else{if(_0x4990cb===_0xfe497b(0x188))_0x473592=requireUsearch()(_0x44bc4f,_0x1198d7);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x4990cb+'\x22');}}function _0x2a3ceb(){const _0x401a33=_0xfe497b;try{_0x186f6f[_0x401a33(0xe4)]({'op':_0x401a33(0x16b),'count':_0x473592[_0x401a33(0x11d)](),'info':_0x473592[_0x401a33(0x18c)](),'memory':process[_0x401a33(0x110)]()});}catch{}}function _0x5f4cc8(_0x463d8c){const _0x38355b=_0xfe497b;return(_0x463d8c||[])['map'](_0x512e96=>({'key':_0x512e96['key'],'vector':_0x512e96['vector']instanceof Float32Array?_0x512e96[_0x38355b(0x152)]:new Float32Array(_0x512e96['vector'])}));}return _0x186f6f['on'](_0xfe497b(0x1b0),async _0x148785=>{const _0x332585=_0xfe497b;if(_0x148785['op']===_0x332585(0x1a3)){const _0x240b4f=_0x132168[_0x332585(0x16e)](_0x148785['fid']);if(!_0x240b4f)return;_0x132168['delete'](_0x148785[_0x332585(0xe2)]);if(_0x148785['error'])_0x240b4f[_0x332585(0x115)](new Error(_0x148785[_0x332585(0xf4)]));else _0x240b4f[_0x332585(0x19b)](_0x5f4cc8(_0x148785[_0x332585(0xe6)]));return;}const {id:_0x327322,op:_0x2a7d43,args:_0x2580dd}=_0x148785;try{let _0x107d8e;switch(_0x2a7d43){case _0x332585(0x133):{_0x107d8e=await _0x473592[_0x332585(0x133)](_0x2580dd[_0x332585(0x125)]?_0x1e7638:null),_0x2a3ceb();break;}case _0x332585(0xf6):{const _0x2f75df=_0x2580dd['vector']instanceof Float32Array?_0x2580dd[_0x332585(0x152)]:new Float32Array(_0x2580dd[_0x332585(0x152)]);await _0x473592[_0x332585(0xf6)](_0x2580dd[_0x332585(0x18d)],_0x2f75df,_0x2580dd['clock']??undefined),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x19d):{await _0x473592[_0x332585(0x19d)](_0x2580dd[_0x332585(0x18d)]),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x11f):{const _0x47884d=_0x2580dd[_0x332585(0x121)]instanceof Float32Array?_0x2580dd[_0x332585(0x121)]:new Float32Array(_0x2580dd[_0x332585(0x121)]);_0x107d8e=_0x473592[_0x332585(0x11f)](_0x47884d,_0x2580dd[_0x332585(0x17a)]||{});break;}case _0x332585(0x156):{_0x107d8e=await _0x473592[_0x332585(0x156)](_0x2580dd[_0x332585(0x1a0)]),_0x2a3ceb();break;}case _0x332585(0xf3):{const _0x1d8a57=_0x5f4cc8(_0x2580dd[_0x332585(0xe6)]);await _0x473592[_0x332585(0xf3)](async()=>_0x1d8a57),_0x2a3ceb(),_0x107d8e=null;break;}case'stop':{await _0x473592[_0x332585(0x17f)](),_0x2a3ceb(),_0x107d8e=null;break;}case _0x332585(0x11d):{_0x107d8e=_0x473592[_0x332585(0x11d)]();break;}case _0x332585(0x18c):{_0x107d8e=_0x473592[_0x332585(0x18c)]();break;}default:throw new Error(_0x332585(0x142)+_0x2a7d43+'\x22');}_0x186f6f[_0x332585(0xe4)]({'id':_0x327322,'result':_0x107d8e});}catch(_0x29b60d){_0x186f6f['postMessage']({'id':_0x327322,'error':{'message':_0x29b60d?.[_0x332585(0x1b0)]||String(_0x29b60d),'code':_0x29b60d?.[_0x332585(0x15d)]}});}}),_0x186f6f['postMessage']({'op':_0xfe497b(0x106)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x11b94d(0x19a)]=algorithmWorkerThread;
|