@kedem/okdb 2.6.4 → 2.7.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 +44 -0
- package/algorithm-worker-thread.js +1 -1
- package/bin/okdb.js +1 -1
- package/docs/functions.md +27 -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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,50 @@ All notable changes to `@kedem/okdb` are documented here. Format loosely follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
|
|
5
5
|
Dates are release dates.
|
|
6
6
|
|
|
7
|
+
## [2.7.0] - unreleased
|
|
8
|
+
|
|
9
|
+
The last Node.js release line: okdb 3 is a Rust core that forks from this version. 2.7.0 fixes every bug
|
|
10
|
+
found while porting, so a 2.7 process and an okdb 3 process can share a store and behave the same. The
|
|
11
|
+
storage format is unchanged: no migrations, stores open as-is.
|
|
12
|
+
|
|
13
|
+
### Changed (read before upgrading)
|
|
14
|
+
|
|
15
|
+
- **Sandboxed `fetch` refuses private addresses, and checks every redirect.** Before, only the first URL
|
|
16
|
+
was checked: an allowed host could redirect a function anywhere, and `allowedFetchDomains: '*'` reached
|
|
17
|
+
localhost and the LAN. Now every hop must be http(s), on the allow-list, and (unless its hostname is
|
|
18
|
+
listed explicitly) not resolve to loopback, RFC 1918, link-local (including the cloud metadata service),
|
|
19
|
+
CGNAT, ULA, multicast or reserved space (`FETCH_PRIVATE_ADDRESS`). Credentials are dropped when a
|
|
20
|
+
redirect leaves the origin. **A function that called a local service through `'*'` must list that host**,
|
|
21
|
+
or set `OKDB_FN_FETCH_ALLOW_PRIVATE=1`. Stored functions also keep `allowedFetchDomains` (it was dropped
|
|
22
|
+
when a function was saved). See [Functions → Network access](docs/functions.md#network-access-fetch).
|
|
23
|
+
- **Compaction can now be refused with `COMPACT_PEER_HOLDS_ENV`.** The `data.mdb` swap no longer runs
|
|
24
|
+
while another process still holds the env's `lock.mdb`; it re-signals the drain, then gives up with the
|
|
25
|
+
store untouched (auto-compaction retries later). Before, a peer that had not released could read the
|
|
26
|
+
compacted file through stale lock-file state and see the env **empty** (all types gone) or fail writes
|
|
27
|
+
with `MDB_PROBLEM`. Both meta pages of the compacted file are now sealed as a second safeguard.
|
|
28
|
+
- **A process that missed a compaction refuses writes with `ENV_SWAPPED_UNDER`** instead of writing into
|
|
29
|
+
the swapped-out file, where acknowledged writes were lost. Every env now also polls the shared drain
|
|
30
|
+
stamp (200 ms), so a process that opened while a peer was compacting is no longer deaf to the swap.
|
|
31
|
+
Restart a process that reports `ENV_SWAPPED_UNDER`.
|
|
32
|
+
- **Exports carry document versions** (`ver` on data lines). The importer already reads it.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- **Full-text search lost postings** when a document lost a term and regained it before the next
|
|
37
|
+
compaction of the index (the term sat in both live tiers and searched as removed). Postings are now
|
|
38
|
+
committed before the document row, so a failed commit is redone by the retry, and an index build replays
|
|
39
|
+
writes that a peer process skipped while the build ran.
|
|
40
|
+
- **Sync:** a replica that was sent a remove for a key it never had wedged for good (`… does not exist`);
|
|
41
|
+
it is now recorded as a no-op. A control pull no longer rewinds a newer data cursor, and an
|
|
42
|
+
acknowledgement that lands during a GC sweep queues another sweep instead of being dropped.
|
|
43
|
+
- **Queue `max_concurrency` never limited anything** (the running-job count scanned an empty range).
|
|
44
|
+
- **An index registered by one process was not maintained by processes already running** on the same
|
|
45
|
+
store; writes now pick up the new index (they retry with `INDEX_SET_CHANGED` internally), and the build
|
|
46
|
+
no longer overwrites a document written during its scan.
|
|
47
|
+
- **Time machine:** the first enable's seed no longer misses writes that land while it runs.
|
|
48
|
+
- **Logical rebuild (compaction fallback)** silently dropped index rows whose key starts with a null part
|
|
49
|
+
(both the raw and the typed copy), and its verification count could not notice.
|
|
50
|
+
|
|
7
51
|
## [2.6.4] - 2026-10-08
|
|
8
52
|
|
|
9
53
|
### Fixed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x35715f=_0x9448;(function(_0x30a51b,_0x1385f4){const _0x3567d6=_0x9448,_0x2c632d=_0x30a51b();while(!![]){try{const _0x224325=parseInt(_0x3567d6(0xd9))/0x1*(-parseInt(_0x3567d6(0x11d))/0x2)+-parseInt(_0x3567d6(0xea))/0x3+-parseInt(_0x3567d6(0x167))/0x4+-parseInt(_0x3567d6(0x13c))/0x5*(-parseInt(_0x3567d6(0xe6))/0x6)+-parseInt(_0x3567d6(0x176))/0x7*(-parseInt(_0x3567d6(0x179))/0x8)+-parseInt(_0x3567d6(0x10f))/0x9*(parseInt(_0x3567d6(0x14d))/0xa)+parseInt(_0x3567d6(0x196))/0xb;if(_0x224325===_0x1385f4)break;else _0x2c632d['push'](_0x2c632d['shift']());}catch(_0x48d856){_0x2c632d['push'](_0x2c632d['shift']());}}}(_0x33c4,0x8b23a));var require$$0$1=require(_0x35715f(0x155)),require$$0=require('fs'),require$$1=require(_0x35715f(0x125)),require$$2=require('os'),require$$3=require(_0x35715f(0x118));function getDefaultExportFromCjs(_0x5e4c5a){const _0x57489b=_0x35715f;return _0x5e4c5a&&_0x5e4c5a[_0x57489b(0x150)]&&Object['prototype'][_0x57489b(0x11a)][_0x57489b(0x161)](_0x5e4c5a,_0x57489b(0x17f))?_0x5e4c5a[_0x57489b(0x17f)]:_0x5e4c5a;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x53ccdd=_0x35715f;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x18168c=require$$0,_0x724a6a=require$$1,_0x242203=require$$2,_0x417b52=require$$3;function _0x791e5b(){const _0x355c56=_0x9448;return Date[_0x355c56(0x16e)]();}function _0x4f7781(_0x1bc8a6){try{return _0x18168c['existsSync'](_0x1bc8a6);}catch{return![];}}function _0x40caeb(_0x4261f1){const _0x43eabd=_0x9448;try{return _0x18168c[_0x43eabd(0x152)](_0x4261f1,_0x43eabd(0x15d));}catch{return null;}}function _0x191186(_0x30286d,_0x3041b9){const _0x3ae26e=_0x9448,_0x586feb=_0x30286d+_0x3ae26e(0x19f)+_0x417b52[_0x3ae26e(0x134)](0x6)[_0x3ae26e(0x186)](_0x3ae26e(0x18b));_0x18168c[_0x3ae26e(0xf0)](_0x586feb,_0x3041b9),_0x18168c[_0x3ae26e(0xd5)](_0x586feb,_0x30286d);}function _0x2507e4(_0x4c3788,_0x3f37ea=0x10){const _0xcd1b4a=_0x9448,_0x296f1e=String(Math[_0xcd1b4a(0x126)](0x0,Math[_0xcd1b4a(0x18a)](_0x4c3788||0x0)));return _0x296f1e[_0xcd1b4a(0x18c)]>=_0x3f37ea?_0x296f1e:'0'['repeat'](_0x3f37ea-_0x296f1e['length'])+_0x296f1e;}return snapshotStore=class _0x17c722{constructor({dir:_0x3b1201,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0xe11dac=_0x9448;if(!_0x3b1201)throw new Error(_0xe11dac(0x19c));this[_0xe11dac(0x13a)]=_0x3b1201,this[_0xe11dac(0xfe)]=_0x724a6a[_0xe11dac(0x195)](_0x3b1201,_0xe11dac(0x197)),this[_0xe11dac(0x148)]=_0x724a6a[_0xe11dac(0x195)](_0x3b1201,_0xe11dac(0x1a4)),this[_0xe11dac(0x108)]=_0x724a6a[_0xe11dac(0x195)](_0x3b1201,_0xe11dac(0x1aa)),this[_0xe11dac(0x12d)]=keepSnapshots,this[_0xe11dac(0x1a7)]=log,_0x18168c[_0xe11dac(0x190)](this[_0xe11dac(0x13a)],{'recursive':!![]}),_0x18168c[_0xe11dac(0x190)](this[_0xe11dac(0xfe)],{'recursive':!![]});}['_snapshotDir'](_0x47245c){const _0x4dcd9d=_0x9448;return _0x724a6a[_0x4dcd9d(0x195)](this[_0x4dcd9d(0xfe)],_0x47245c);}['_snapshotPaths'](_0x58181d){const _0x4a5874=_0x9448,_0x3b07f6=this['_snapshotDir'](_0x58181d);return{'dir':_0x3b07f6,'index':_0x724a6a['join'](_0x3b07f6,'index.hnsw'),'labels':_0x724a6a['join'](_0x3b07f6,'labels.json'),'state':_0x724a6a['join'](_0x3b07f6,_0x4a5874(0x15f))};}[_0x53ccdd(0x119)](){const _0x60b7a8=_0x53ccdd;if(!_0x4f7781(this['currentPath']))return null;const _0xb25555=_0x40caeb(this['currentPath']);if(!_0xb25555)return null;const _0x37f116=String(_0xb25555)[_0x60b7a8(0x18e)]();return _0x37f116||null;}[_0x53ccdd(0xe3)](){const _0x5b31b1=_0x53ccdd,_0x4004f1=this[_0x5b31b1(0x119)]();if(!_0x4004f1)return 0x0;const _0x5573c4=Number(_0x4004f1);return Number[_0x5b31b1(0x194)](_0x5573c4)?_0x5573c4:0x0;}[_0x53ccdd(0x145)](){const _0x4501c9=_0x53ccdd;try{return _0x18168c[_0x4501c9(0x12f)](this[_0x4501c9(0xfe)],{'withFileTypes':!![]})['filter'](_0x13fcb4=>_0x13fcb4['isDirectory']())[_0x4501c9(0x170)](_0x33cd4d=>_0x33cd4d[_0x4501c9(0x163)])[_0x4501c9(0x102)](_0x11f3eb=>!_0x11f3eb[_0x4501c9(0x144)](_0x4501c9(0x19f)))[_0x4501c9(0x102)](_0x5179bc=>!_0x5179bc[_0x4501c9(0x144)](_0x4501c9(0x174)))['sort']();}catch{return[];}}['latestSnapshotId'](){const _0x400a80=_0x53ccdd,_0x2ed280=this[_0x400a80(0x119)]();if(_0x2ed280)return _0x2ed280;const _0x55e246=this[_0x400a80(0x145)]();if(!_0x55e246[_0x400a80(0x18c)])return null;return _0x55e246[_0x55e246[_0x400a80(0x18c)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x133414=_0x53ccdd;let _0x488034;try{_0x488034=_0x18168c[_0x133414(0x12f)](this['snapshotsDir'],{'withFileTypes':!![]});}catch{return;}const _0x4a094b=_0x791e5b()-maxAgeMs;for(const _0x8b1076 of _0x488034){if(!_0x8b1076[_0x133414(0x1a5)]())continue;const _0x132f86=_0x8b1076[_0x133414(0x163)];if(!_0x132f86['startsWith'](_0x133414(0x19f))&&!_0x132f86['startsWith'](_0x133414(0x174)))continue;const _0x14ff99=_0x724a6a[_0x133414(0x195)](this[_0x133414(0xfe)],_0x132f86);try{const _0x519138=_0x18168c[_0x133414(0xf5)](_0x14ff99);if(_0x519138['mtimeMs']>_0x4a094b)continue;}catch{}try{_0x18168c[_0x133414(0x11e)](_0x14ff99,{'recursive':!![],'force':!![]});}catch{}}}[_0x53ccdd(0x149)]({keep:keep=null}={}){const _0x2e7fef=_0x53ccdd,_0xfb8821=Math[_0x2e7fef(0x126)](0x1,Math[_0x2e7fef(0x18a)](keep??this[_0x2e7fef(0x12d)]??0x3)),_0x425552=this[_0x2e7fef(0x145)]();if(_0x425552[_0x2e7fef(0x18c)]<=_0xfb8821)return;const _0x1aaa62=this[_0x2e7fef(0x119)](),_0x5c25db=_0x425552[_0x2e7fef(0x164)](0x0,Math[_0x2e7fef(0x126)](0x0,_0x425552[_0x2e7fef(0x18c)]-_0xfb8821));for(const _0x4a7e95 of _0x5c25db){if(_0x1aaa62&&_0x4a7e95===_0x1aaa62)continue;const _0x3cc5bb=this['_snapshotDir'](_0x4a7e95);try{_0x18168c[_0x2e7fef(0x11e)](_0x3cc5bb,{'recursive':!![],'force':!![]});}catch{}}}async[_0x53ccdd(0x14b)](_0x241b86,_0x15c44b){const _0x3f7491=_0x53ccdd;if(!_0x241b86)throw new Error('snapshot\x20id\x20required');const _0x56d8f3=this[_0x3f7491(0x17e)](_0x241b86);if(!_0x4f7781(_0x56d8f3[_0x3f7491(0xf8)])||!_0x4f7781(_0x56d8f3[_0x3f7491(0xf4)])||!_0x4f7781(_0x56d8f3[_0x3f7491(0x17b)]))throw new Error(_0x3f7491(0x137)+_0x241b86);const _0x147a67=await _0x15c44b(_0x56d8f3);return _0x147a67||{};}async[_0x53ccdd(0xe9)](_0x20c3fa,_0x4a3d30,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x1344ce=_0x53ccdd,_0x9ee543=Number(_0x20c3fa);if(!Number['isFinite'](_0x9ee543)||_0x9ee543<0x0)throw new Error(_0x1344ce(0x158));const _0x2cc3ad=_0x2507e4(_0x9ee543),_0x2493e2=this[_0x1344ce(0x17d)](_0x2cc3ad),_0x95005f=_0x724a6a[_0x1344ce(0x195)](this[_0x1344ce(0xfe)],_0x1344ce(0x19f)+_0x2cc3ad+'-'+_0x417b52[_0x1344ce(0x134)](0x6)[_0x1344ce(0x186)](_0x1344ce(0x18b)));_0x18168c[_0x1344ce(0x190)](_0x95005f,{'recursive':!![]});const _0x4243ed={'dir':_0x95005f,'index':_0x724a6a[_0x1344ce(0x195)](_0x95005f,_0x1344ce(0x113)),'labels':_0x724a6a[_0x1344ce(0x195)](_0x95005f,_0x1344ce(0x11f)),'state':_0x724a6a[_0x1344ce(0x195)](_0x95005f,'state.json')};await _0x4a3d30(_0x4243ed,{'id':_0x2cc3ad,'clock':_0x9ee543});const _0x457d3f=JSON[_0x1344ce(0x112)]({'pid':process[_0x1344ce(0x19a)],'host':_0x242203['hostname'](),'at':_0x791e5b()}),_0x5bbbb0=_0x791e5b();let _0x89423c=null;const _0x581e54=()=>{const _0x38723c=_0x1344ce;try{const _0x21bb70=JSON[_0x38723c(0xfa)](_0x18168c['readFileSync'](this[_0x38723c(0x108)],'utf8'));if(_0x21bb70['at']&&_0x791e5b()-_0x21bb70['at']>staleLockMaxAgeMs){const _0x143be1=_0x791e5b()-_0x21bb70['at'],_0x3abd5f=_0x38723c(0x101)+Math['round'](_0x143be1/0x3e8)+_0x38723c(0x1a8)+_0x21bb70[_0x38723c(0x19a)]+_0x38723c(0x123)+_0x21bb70[_0x38723c(0x1a3)]+').\x20'+_0x38723c(0xf2);this['log']?.[_0x38723c(0x105)]?this['log'][_0x38723c(0x105)](_0x3abd5f):console['warn'](_0x38723c(0x142),_0x3abd5f);try{_0x18168c['unlinkSync'](this['lockPath']);}catch{}return!![];}}catch{try{_0x18168c['unlinkSync'](this[_0x38723c(0x108)]);}catch{}}return![];},_0x16064c=()=>{const _0x33112b=_0x1344ce;try{return _0x89423c=_0x18168c[_0x33112b(0x1a6)](this[_0x33112b(0x108)],'wx'),_0x18168c[_0x33112b(0xf0)](_0x89423c,_0x457d3f),!![];}catch(_0x4050bb){if(_0x4050bb&&_0x4050bb[_0x33112b(0x193)]==='EEXIST')return![];throw _0x4050bb;}};if(!_0x16064c()){_0x581e54(),_0x16064c();if(_0x89423c==null&&lockTimeoutMs>0x0)while(_0x791e5b()-_0x5bbbb0<lockTimeoutMs){await new Promise(_0x25ab85=>setTimeout(_0x25ab85,0x19));if(_0x16064c())break;_0x581e54();}}if(_0x89423c==null){try{_0x18168c['rmSync'](_0x95005f,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x24e777=this[_0x1344ce(0xe3)]();if(_0x9ee543<=_0x24e777){try{_0x18168c[_0x1344ce(0x11e)](_0x95005f,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x1344ce(0x132),'currentClock':_0x24e777};}if(!_0x4f7781(_0x2493e2))_0x18168c[_0x1344ce(0xd5)](_0x95005f,_0x2493e2);else try{_0x18168c[_0x1344ce(0x11e)](_0x95005f,{'recursive':!![],'force':!![]});}catch{}return _0x191186(this[_0x1344ce(0x148)],_0x2cc3ad+'\x0a'),this['prune']({'keep':keep}),{'published':!![],'currentClock':_0x9ee543};}finally{try{_0x18168c[_0x1344ce(0x14c)](_0x89423c);}catch{}try{_0x18168c[_0x1344ce(0x14f)](this[_0x1344ce(0x108)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x3cad26=_0x35715f;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x162834=require$$0;class _0x57c2e9{constructor(){const _0x27fccd=_0x9448;this[_0x27fccd(0x128)]=new Map(),this[_0x27fccd(0xd4)]=new Map(),this[_0x27fccd(0x10e)]=0x0,this[_0x27fccd(0x191)]=0x0,this['keyToFp']=new Map(),this[_0x27fccd(0x139)]=!![];}async[_0x3cad26(0x133)](){const _0x25aec9=_0x3cad26;this[_0x25aec9(0x128)]=new Map(),this[_0x25aec9(0xd4)]=new Map(),this[_0x25aec9(0x184)]=new Map(),this[_0x25aec9(0x139)]=!![],this[_0x25aec9(0x10e)]=0x0,this[_0x25aec9(0x191)]=0x0;}async[_0x3cad26(0x15c)](_0x512e71){const _0x43a5bd=_0x3cad26;if(!_0x512e71||!_0x162834[_0x43a5bd(0xed)](_0x512e71))return await this['reset'](),!![];let _0x26e2ed;try{_0x26e2ed=_0x162834['readFileSync'](_0x512e71,_0x43a5bd(0x15d));}catch{return await this['reset'](),!![];}let _0x5c9bba;try{_0x5c9bba=JSON[_0x43a5bd(0xfa)](_0x26e2ed);}catch{return await this['reset'](),!![];}const _0x4747df=Array[_0x43a5bd(0xe4)](_0x5c9bba?.[_0x43a5bd(0x180)])?_0x5c9bba[_0x43a5bd(0x180)]:[],_0x3b68b9=Number['isInteger'](_0x5c9bba?.[_0x43a5bd(0x10e)])?_0x5c9bba['nextLabel']:0x0,_0x435930=new Map(),_0x5037a5=new Map(),_0x3899d9=new Map(),_0x1856e6=_0x5c9bba?.['version']>=0x2;let _0x77da7f=-0x1;for(const _0x505882 of _0x4747df){if(!Array['isArray'](_0x505882)||_0x505882[_0x43a5bd(0x18c)]<0x2)continue;const _0x22520a=Number(_0x505882[0x0]),_0x349255=String(_0x505882[0x1]??'');if(!Number[_0x43a5bd(0x188)](_0x22520a)||_0x22520a<0x0)continue;if(!_0x349255)continue;_0x435930[_0x43a5bd(0xd8)](_0x349255,_0x22520a),_0x5037a5['set'](_0x22520a,_0x349255);if(_0x1856e6&&typeof _0x505882[0x2]==='number')_0x3899d9[_0x43a5bd(0xd8)](_0x349255,_0x505882[0x2]);if(_0x22520a>_0x77da7f)_0x77da7f=_0x22520a;}return this[_0x43a5bd(0x128)]=_0x435930,this['labelToKey']=_0x5037a5,this[_0x43a5bd(0x184)]=_0x3899d9,this['hasFingerprints']=_0x1856e6,this[_0x43a5bd(0x10e)]=Math[_0x43a5bd(0x126)](_0x3b68b9,_0x77da7f+0x1,0x0),this['_tombstoneCount']=0x0,!![];}[_0x3cad26(0x183)](_0x29dea2){const _0x3e60f4=_0x3cad26;return this[_0x3e60f4(0x128)][_0x3e60f4(0x172)](_0x29dea2);}['labelForEphemeral'](_0x3a71e8){const _0x356e13=_0x3cad26;let _0x22ba6d=this[_0x356e13(0x128)][_0x356e13(0x172)](_0x3a71e8);if(_0x22ba6d!==undefined)return _0x22ba6d;return _0x22ba6d=this[_0x356e13(0x10e)]++,this[_0x356e13(0x128)][_0x356e13(0xd8)](_0x3a71e8,_0x22ba6d),this[_0x356e13(0xd4)]['set'](_0x22ba6d,_0x3a71e8),_0x22ba6d;}[_0x3cad26(0x114)](_0x33c717,_0x165c65){const _0x45e77d=_0x3cad26;if(_0x165c65==null)this[_0x45e77d(0x184)][_0x45e77d(0xeb)](_0x33c717);else this['keyToFp']['set'](_0x33c717,_0x165c65);}[_0x3cad26(0x12c)](_0x505989){const _0x2646c0=_0x3cad26;return this[_0x2646c0(0x184)][_0x2646c0(0x172)](_0x505989);}[_0x3cad26(0xd3)](){const _0x3cdb07=_0x3cad26;return this[_0x3cdb07(0x128)]['keys']();}[_0x3cad26(0x19d)](_0x2d4c4b){const _0x14c5fc=_0x3cad26,_0x3dcf34=this['keyToLabel'][_0x14c5fc(0x172)](_0x2d4c4b);if(_0x3dcf34===undefined)return;this['keyToFp'][_0x14c5fc(0xeb)](_0x2d4c4b),this['keyToLabel'][_0x14c5fc(0xeb)](_0x2d4c4b),this[_0x14c5fc(0xd4)][_0x14c5fc(0xeb)](_0x3dcf34),this[_0x14c5fc(0x191)]++;}[_0x3cad26(0x147)](_0x1e8157){const _0x56c293=_0x3cad26;return this[_0x56c293(0xd4)][_0x56c293(0x172)](_0x1e8157)??null;}[_0x3cad26(0x16d)](){const _0x51f6b8=_0x3cad26;return this[_0x51f6b8(0x128)][_0x51f6b8(0x16d)];}[_0x3cad26(0x19b)](){const _0x4c513d=_0x3cad26;return this[_0x4c513d(0x191)];}async[_0x3cad26(0x189)](_0x5a3e4f){const _0x3d5ded=_0x3cad26,_0x5c513f=_0x5a3e4f+_0x3d5ded(0x162),_0xd5c182=[];for(const [_0x4dd53b,_0x38f8a8]of this[_0x3d5ded(0xd4)][_0x3d5ded(0x180)]()){const _0x15db2e=this[_0x3d5ded(0x184)][_0x3d5ded(0x172)](_0x38f8a8);_0xd5c182['push'](_0x15db2e==null?[_0x4dd53b,_0x38f8a8]:[_0x4dd53b,_0x38f8a8,_0x15db2e]);}_0xd5c182[_0x3d5ded(0x17a)]((_0x560c78,_0x497afb)=>_0x560c78[0x0]-_0x497afb[0x0]);const _0xe16fc0={'version':0x2,'nextLabel':this[_0x3d5ded(0x10e)],'entries':_0xd5c182};_0x162834[_0x3d5ded(0xf0)](_0x5c513f,JSON[_0x3d5ded(0x112)](_0xe16fc0)),_0x162834[_0x3d5ded(0xd5)](_0x5c513f,_0x5a3e4f);}}return labelMap=_0x57c2e9,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x44778b(_0x38c079){const _0x11b2c8=_0x9448,_0x52cb2e=new Uint32Array(_0x38c079['buffer'],_0x38c079[_0x11b2c8(0xda)],_0x38c079[_0x11b2c8(0x18c)]);let _0x9341d9=0x811c9dc5,_0x1594e9=0x9747b28c;for(let _0x42f001=0x0;_0x42f001<_0x52cb2e[_0x11b2c8(0x18c)];_0x42f001++){const _0x35a975=_0x52cb2e[_0x42f001];_0x9341d9=Math['imul'](_0x9341d9^_0x35a975,0x1000193)>>>0x0;let _0x4e9c64=Math[_0x11b2c8(0x135)](_0x35a975,0xcc9e2d51);_0x4e9c64=_0x4e9c64<<0xf|_0x4e9c64>>>0x11,_0x1594e9=Math[_0x11b2c8(0x135)](_0x1594e9^Math[_0x11b2c8(0x135)](_0x4e9c64,0x1b873593),0x5)+0xe6546b64,_0x1594e9>>>=0x0;}return _0x1594e9=Math['imul'](_0x1594e9^_0x1594e9>>>0x10,0x85ebca6b)>>>0x0,(_0x9341d9>>>0x0)*0x100000+(_0x1594e9&0xfffff);}function _0x254643(_0x2e2e9b,_0x39350a,_0x3800ae,{upsert:_0x5e7fa0,remove:_0x5ecdd2}){const _0x3d6567=_0x9448,_0x236fa9=new Set();let _0x2f264e=0x0,_0x1e3a52=0x0,_0x2dc9e1=0x0;for(const {key:_0x11ff53,vector:_0x12eaf5}of _0x39350a){if(!(_0x12eaf5 instanceof Float32Array)||_0x12eaf5[_0x3d6567(0x18c)]!==_0x3800ae)continue;_0x236fa9[_0x3d6567(0x153)](_0x11ff53);const _0xfed7a3=_0x44778b(_0x12eaf5),_0x4d15ed=_0x2e2e9b[_0x3d6567(0x183)](_0x11ff53)!==undefined;if(_0x4d15ed&&_0x2e2e9b[_0x3d6567(0x12c)](_0x11ff53)===_0xfed7a3)continue;_0x5e7fa0(_0x11ff53,_0x12eaf5,_0xfed7a3);if(_0x4d15ed)_0x1e3a52++;else _0x2f264e++;}for(const _0x1e1a35 of[..._0x2e2e9b[_0x3d6567(0xd3)]()]){if(_0x236fa9[_0x3d6567(0x115)](_0x1e1a35))continue;_0x5ecdd2(_0x1e1a35),_0x2dc9e1++;}return{'added':_0x2f264e,'changed':_0x1e3a52,'removed':_0x2dc9e1};}return indexConvergence={'fingerprint':_0x44778b,'reconcileIndex':_0x254643},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x270421=requireSnapshotStore(),_0x4eb93b=requireLabelMap(),{fingerprint:_0x3c8db5,reconcileIndex:_0x105354}=requireIndexConvergence(),_0xcdb1a5=0x1;let _0x302834=null;function _0x3d2274(){const _0x538ae1=_0x9448;if(_0x302834)return _0x302834;try{return _0x302834=require('hnswlib-node'),_0x302834;}catch(_0x9e6b0c){const _0x290548=new Error('HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+(_0x538ae1(0x106)+process[_0x538ae1(0x129)][_0x538ae1(0xfd)]+'\x20on\x20'+process[_0x538ae1(0x157)]+'/'+process['arch']+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+(_0x538ae1(0x111)+(_0x9e6b0c?.[_0x538ae1(0x13b)]||String(_0x9e6b0c))));_0x290548[_0x538ae1(0x193)]=_0x538ae1(0x168),_0x290548[_0x538ae1(0x1a9)]=_0x9e6b0c;throw _0x290548;}}return hnsw=function _0x12715f(_0x59d025={},{dims:_0x56572c,dir:_0x5acb51}){const _0x483b93=_0x9448,_0x243f8d=_0x3d2274();if(!_0x56572c||_0x56572c<=0x0)throw new Error(_0x483b93(0x120));if(!_0x5acb51)throw new Error(_0x483b93(0xe2));const _0xf4d730={'metric':_0x59d025[_0x483b93(0x10d)]??_0x483b93(0x1ab),'M':_0x59d025['M']??0x10,'efConstruction':_0x59d025[_0x483b93(0x192)]??0xc8,'efSearch':_0x59d025[_0x483b93(0x130)]??0x40,'maxElements':_0x59d025['maxElements']??0x400,'growFactor':_0x59d025[_0x483b93(0x187)]??0x2,'snapshotEveryChanges':_0x59d025['snapshotEveryChanges']??0xc350,'keepSnapshots':_0x59d025[_0x483b93(0x12d)]??0x2,'tmpMaxAgeMs':_0x59d025[_0x483b93(0x175)]??0x6*0x36ee80},_0x18a6df=new _0x270421({'dir':_0x5acb51,'keepSnapshots':_0xf4d730['keepSnapshots']}),_0xebc386=new _0x4eb93b();let _0x87bb07=null,_0x54fb9f=0x0,_0x5a5f54=null,_0x51564e=Promise[_0x483b93(0x10b)]();const _0x36b9ce=_0x2b23f8=>{const _0x4febea=_0x483b93,_0x827879=_0x51564e[_0x4febea(0x146)](_0x2b23f8);return _0x51564e=_0x827879['catch'](()=>{}),_0x827879;};async function _0xcbb698(_0x166423){const _0x511048=_0x483b93;await _0xebc386['reset'](),_0x166423=_0x166423??[];const _0x595ca8=Math[_0x511048(0x126)](_0xf4d730[_0x511048(0x154)],Math['ceil'](_0x166423[_0x511048(0x18c)]*(_0xf4d730['growFactor']||1.2)),0x1);_0x87bb07=new _0x243f8d['HierarchicalNSW'](_0xf4d730[_0x511048(0x10d)],_0x56572c),_0x87bb07[_0x511048(0xdb)]({'maxElements':_0x595ca8,'efConstruction':_0xf4d730[_0x511048(0x192)],'M':_0xf4d730['M']});for(const {key:_0x497901,vector:_0x40ff2e}of _0x166423){if(!(_0x40ff2e instanceof Float32Array)||_0x40ff2e[_0x511048(0x18c)]!==_0x56572c)continue;_0x5d1445(_0x497901,_0x40ff2e);}_0x87bb07[_0x511048(0x10a)](_0xf4d730[_0x511048(0x130)]),_0x54fb9f=0x0;}async function _0x1bdc5a(_0x9050c8){return _0xcbb698(_0x9050c8?await _0x9050c8():[]);}function _0x18f687(){const _0x306359=_0x483b93;if(_0x87bb07[_0x306359(0x143)]()<_0x87bb07[_0x306359(0x16c)]())return;const _0x38aa2d=Math[_0x306359(0x100)](_0x87bb07[_0x306359(0x16c)]()*(_0xf4d730[_0x306359(0x187)]||0x2));_0x87bb07['resizeIndex'](_0x38aa2d),_0xf4d730[_0x306359(0x154)]=_0x38aa2d;}function _0x5d1445(_0xfcb78b,_0x249b63,_0x4594b0){const _0x302646=_0x483b93,_0x403fea=_0xebc386[_0x302646(0xdc)](_0xfcb78b);try{_0x87bb07[_0x302646(0x11c)](_0x403fea);}catch{}_0x18f687(),_0x87bb07[_0x302646(0x166)](Array[_0x302646(0x165)](_0x249b63),_0x403fea),_0xebc386[_0x302646(0x114)](_0xfcb78b,_0x4594b0??_0x3c8db5(_0x249b63));}function _0x46f1ab(_0x21ffab){const _0x52847a=_0x483b93,_0x16ea73=_0xebc386[_0x52847a(0x183)](_0x21ffab);if(_0x16ea73===undefined)return![];try{_0x87bb07[_0x52847a(0x11c)](_0x16ea73);}catch{}return _0xebc386[_0x52847a(0x19d)](_0x21ffab),!![];}function _0x1227e7(){const _0x45f557=_0x483b93;return Math['max'](Date[_0x45f557(0x16e)](),_0x18a6df[_0x45f557(0xe3)]()+0x1);}async function _0x58d189(_0x17e84c){const _0x539085=_0x483b93;if(!_0x87bb07||!_0x17e84c)return![];const _0x40fcc9=await _0x18a6df['publishSnapshot'](_0x17e84c,async _0x4993c6=>{const _0x4a686b=_0x9448;_0x87bb07[_0x4a686b(0x13f)](_0x4993c6[_0x4a686b(0xf8)]),await _0xebc386[_0x4a686b(0x189)](_0x4993c6[_0x4a686b(0xf4)]);const _0x4ba250=require$$0;_0x4ba250[_0x4a686b(0xf0)](_0x4993c6[_0x4a686b(0x17b)],JSON[_0x4a686b(0x112)]({'manifestVersion':_0xcdb1a5,'dims':_0x56572c,'metric':_0xf4d730[_0x4a686b(0x10d)],'clock':_0x17e84c,'snapshotAt':Date[_0x4a686b(0x16e)]()},null,0x2));},{'keep':_0xf4d730[_0x539085(0x12d)]});if(_0x40fcc9?.[_0x539085(0xfc)])_0x54fb9f=0x0;return _0x40fcc9?.[_0x539085(0xfc)]??![];}async function _0x53b48b(){const _0x267a61=_0x483b93,_0x3a8eef=_0x18a6df[_0x267a61(0x119)]()||_0x18a6df[_0x267a61(0x138)]();if(!_0x3a8eef)return null;let _0x25f5ba,_0xb365f9=![];return await _0x18a6df[_0x267a61(0x14b)](_0x3a8eef,async _0x257c5f=>{const _0x55d83f=_0x267a61,_0x2d02f7=require$$0;_0x25f5ba=JSON[_0x55d83f(0xfa)](_0x2d02f7[_0x55d83f(0x152)](_0x257c5f[_0x55d83f(0x17b)],_0x55d83f(0x15d)));if(_0x25f5ba[_0x55d83f(0x171)]!==_0xcdb1a5||_0x25f5ba[_0x55d83f(0x1ac)]!==_0x56572c||_0x25f5ba[_0x55d83f(0x10d)]!==_0xf4d730['metric']){_0x25f5ba=null;return;}await _0xebc386[_0x55d83f(0x15c)](_0x257c5f[_0x55d83f(0xf4)]),_0x87bb07=new _0x243f8d[(_0x55d83f(0x17c))](_0xf4d730['metric'],_0x56572c),_0x87bb07[_0x55d83f(0x117)](_0x257c5f['index']),_0x87bb07[_0x55d83f(0x10a)](_0xf4d730[_0x55d83f(0x130)]),_0xb365f9=!![];}),_0xb365f9?_0x25f5ba?.['clock']??0x0:null;}return{async 'load'(_0x355fb5){return _0x36b9ce(async()=>{const _0x3033b7=_0x9448;_0x18a6df[_0x3033b7(0x127)]({'maxAgeMs':_0xf4d730['tmpMaxAgeMs']}),_0x5a5f54=_0x355fb5??null;const _0x452956=await _0x53b48b(),_0x3dc55b=_0x355fb5?await _0x355fb5():null;if(_0x452956!=null){if(_0x3dc55b){if(!_0xebc386[_0x3033b7(0x139)])return await _0xcbb698(_0x3dc55b),null;const _0x3cc524=_0x105354(_0xebc386,_0x3dc55b,_0x56572c,{'upsert':_0x5d1445,'remove':_0x46f1ab});_0x54fb9f+=_0x3cc524[_0x3033b7(0xf7)]+_0x3cc524[_0x3033b7(0x15b)]+_0x3cc524[_0x3033b7(0x116)];}return _0x452956;}return await _0xcbb698(_0x3dc55b),null;});},async 'add'(_0x4b98d8,_0x430e93,_0x48df98){return _0x36b9ce(async()=>{const _0x28c470=_0x9448;if(!_0x87bb07)return;const _0x1a483b=_0x430e93 instanceof Float32Array?_0x430e93:new Float32Array(_0x430e93),_0x535b40=_0x3c8db5(_0x1a483b);if(_0xebc386[_0x28c470(0x12c)](_0x4b98d8)===_0x535b40)return;_0x5d1445(_0x4b98d8,_0x1a483b,_0x535b40),_0x54fb9f++,_0x54fb9f>=_0xf4d730[_0x28c470(0x199)]&&await _0x58d189(_0x1227e7());});},async 'remove'(_0x27350a){return _0x36b9ce(async()=>{if(!_0x87bb07)return;if(_0x46f1ab(_0x27350a))_0x54fb9f++;});},'search'(_0x365d81,{limit:limit=0xa,efSearch:_0x5e3697}={}){const _0x2abcec=_0x483b93;if(!_0x87bb07)return[];if(Number[_0x2abcec(0x188)](_0x5e3697))_0x87bb07[_0x2abcec(0x10a)](_0x5e3697);const _0x331bec=Math['min'](limit,_0x87bb07[_0x2abcec(0x143)]()||0x1),{neighbors:_0x5b6b48,distances:_0xcf00da}=_0x87bb07[_0x2abcec(0x156)](Array[_0x2abcec(0x165)](_0x365d81),_0x331bec),_0x199ee2=[];for(let _0x191aae=0x0;_0x191aae<_0x5b6b48[_0x2abcec(0x18c)];_0x191aae++){const _0x48ad02=_0xebc386[_0x2abcec(0x147)](_0x5b6b48[_0x191aae]);if(!_0x48ad02)continue;const _0x12e501=_0xf4d730['metric']===_0x2abcec(0x1ab)?Math[_0x2abcec(0x126)](0x0,0x1-_0xcf00da[_0x191aae]):0x1/(0x1+_0xcf00da[_0x191aae]);_0x199ee2['push']({'key':_0x48ad02,'score':_0x12e501});}return _0x199ee2;},async 'snapshot'(_0x5afd61){return _0x36b9ce(()=>_0x58d189(_0x5afd61??_0x1227e7()));},async 'rebuild'(_0x34a171){return _0x36b9ce(()=>{if(_0x34a171!=null)_0x5a5f54=_0x34a171;return _0x1bdc5a(_0x34a171??_0x5a5f54);});},async 'stop'(){const _0x1ea4a0=_0x483b93;return _0x36b9ce(()=>_0x54fb9f>0x0||!_0x18a6df[_0x1ea4a0(0x119)]()?_0x58d189(_0x1227e7()):![]);},'count'(){return _0xebc386['size']();},'info'(){const _0x303e54=_0x483b93;return{'algorithm':_0x303e54(0x16a),'metric':_0xf4d730[_0x303e54(0x10d)],'M':_0xf4d730['M'],'efConstruction':_0xf4d730[_0x303e54(0x192)],'efSearch':_0xf4d730['efSearch'],'maxElements':_0x87bb07?.[_0x303e54(0x16c)]()??_0xf4d730[_0x303e54(0x154)],'count':_0xebc386[_0x303e54(0x16d)](),'changesSince':_0x54fb9f,'snapshotDir':_0x5acb51,'latestSnapshot':_0x18a6df[_0x303e54(0x119)]()??null};}};},hnsw;}function _0x33c4(){const _0x24837f=['writer','getMaxElements','size','now','Index','map','manifestVersion','get','rebuild','_tmp-','tmpMaxAgeMs','7IiFCNx','expansionSearch','ENOENT','7365496ZYZyeE','sort','state','HierarchicalNSW','_snapshotDir','_snapshotPaths','default','entries','key','hasRows','labelForExisting','keyToFp','finally','toString','growFactor','isInteger','snapshotTo','trunc','hex','length','view','trim','release','mkdirSync','_tombstoneCount','efConstruction','code','isFinite','join','6489571Zwvjep','snapshots','arch','snapshotEveryChanges','pid','tombstoneCount','SnapshotStore\x20requires\x20dir','tombstone','algorithm','.tmp-','queryVec','usearch','expansionAdd','host','CURRENT','isDirectory','openSync','log','s,\x20pid:\x20','cause','SNAPSHOT.LOCK','cosine','dims','L2sq','snapshotMaxLagMs','keys','labelToKey','renameSync','MetricKind','vectors','set','3004CubWnT','byteOffset','initIndex','labelForEphemeral','unref','viewRefreshMs','sqrt','vector','min','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','readCurrentClock','isArray','token','6NXsqfk','postMessage','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','publishSnapshot','217416LtGTSf','delete','load','existsSync','F32','remove','writeFileSync','Cos','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','fetchAll','labels','statSync','acquire','added','index','Unknown\x20op:\x20\x22','parse','search','published','node','snapshotsDir','push','ceil','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','filter','connectivity','ScalarKind','warn','for\x20Node\x20','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','lockPath','snapshot','setEf','resolve','catch','metric','nextLabel','18igSdAH','clear','Original\x20error:\x20','stringify','index.hnsw','setFingerprint','has','removed','readIndexSync','crypto','readCurrentId','hasOwnProperty','reject','markDelete','128qJAlzq','rmSync','labels.json','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','usearch\x20algorithm\x20requires\x20dims\x20>\x200','sync',',\x20host:\x20','USEARCH_BINDINGS_UNAVAILABLE','path','max','cleanupTmpDirs','keyToLabel','versions','fetchAllResult','count','fingerprintOf','keepSnapshots','ready','readdirSync','efSearch','fid','stale','reset','randomBytes','imul','info','snapshot\x20incomplete:\x20','latestSnapshotId','hasFingerprints','dir','message','4683545SeGYDJ','unreadable','stop','writeIndexSync','\x20on\x20','reader','[SnapshotStore]','getCurrentCount','startsWith','listSnapshotIds','then','keyForLabel','currentPath','prune','memoryUsage','loadSnapshot','closeSync','3817190rkIRNo','EEXIST','unlinkSync','__esModule','flat','readFileSync','add','maxElements','worker_threads','searchKnn','platform','candidateClock\x20must\x20be\x20finite\x20>=\x200','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','heartbeatIntervalMs','changed','loadFrom','utf8','writerLockMaxAgeMs','state.json','clock','call','.tmp','name','slice','from','addPoint','3397108wZUlwN','HNSW_BINDINGS_UNAVAILABLE','error','hnsw'];_0x33c4=function(){return _0x24837f;};return _0x33c4();}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0xb4be5d(_0x5e6ba9={}){const _0x3a4a96=new Map();return{async 'load'(_0x3abfb9){const _0x4db906=_0x9448;_0x3a4a96[_0x4db906(0x110)]();if(_0x3abfb9)for(const {key:_0x51e4be,vector:_0x9f2a34}of await _0x3abfb9()){_0x3a4a96[_0x4db906(0xd8)](_0x51e4be,_0x9f2a34);}},async 'add'(_0x506e9f,_0x555e42,_0x29f5b9){_0x3a4a96['set'](_0x506e9f,_0x555e42);},async 'remove'(_0x3c1dd2){const _0x314307=_0x9448;_0x3a4a96[_0x314307(0xeb)](_0x3c1dd2);},'search'(_0x4194be,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2e3cd5=_0x9448,_0x13f675=[];for(const [_0x11a6de,_0x574a5b]of _0x3a4a96){const _0x2600aa=_0x51ee30(_0x4194be,_0x574a5b);if(_0x2600aa>=threshold)_0x13f675['push']({'key':_0x11a6de,'score':_0x2600aa});}return _0x13f675[_0x2e3cd5(0x17a)]((_0x5165c5,_0x534f92)=>_0x534f92['score']-_0x5165c5['score']),_0x13f675['slice'](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x1fc7c2){const _0xb3d676=_0x9448;await this[_0xb3d676(0xec)](_0x1fc7c2);},async 'stop'(){},'count'(){const _0x3cd8ad=_0x9448;return _0x3a4a96[_0x3cd8ad(0x16d)];},'info'(){const _0x306e23=_0x9448;return{'algorithm':'flat','count':_0x3a4a96[_0x306e23(0x16d)]};}};};function _0x51ee30(_0x32479d,_0x4bd10a){const _0x53ca1f=_0x9448;let _0x119330=0x0,_0x1270f4=0x0,_0xdff689=0x0;for(let _0x2da40b=0x0;_0x2da40b<_0x32479d['length'];_0x2da40b++){_0x119330+=_0x32479d[_0x2da40b]*_0x4bd10a[_0x2da40b],_0x1270f4+=_0x32479d[_0x2da40b]*_0x32479d[_0x2da40b],_0xdff689+=_0x4bd10a[_0x2da40b]*_0x4bd10a[_0x2da40b];}const _0x3ae158=Math[_0x53ca1f(0xdf)](_0x1270f4)*Math['sqrt'](_0xdff689);return _0x3ae158===0x0?0x0:_0x119330/_0x3ae158;}return flat;}function _0x9448(_0x123bf4,_0x1d00dd){_0x123bf4=_0x123bf4-0xd3;const _0x33c4e3=_0x33c4();let _0x94481f=_0x33c4e3[_0x123bf4];return _0x94481f;}var okdbTimers,hasRequiredOkdbTimers;function requireOkdbTimers(){if(hasRequiredOkdbTimers)return okdbTimers;hasRequiredOkdbTimers=0x1;const _0x266062=0x2**0x1f-0x1;function _0x5b560b(_0x66e64b){if(!(_0x66e64b>0x0))return 0x0;return _0x66e64b>_0x266062?_0x266062:_0x66e64b;}function _0x1c00fc(_0x40a6c0){return _0x40a6c0===Infinity;}return okdbTimers={'MAX_TIMER_DELAY':_0x266062,'clampTimerDelay':_0x5b560b,'isNeverDelay':_0x1c00fc},okdbTimers;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x39d160=require$$0,{clampTimerDelay:_0x4a91c3}=requireOkdbTimers(),_0x1478d9=require$$1,_0x162d54=require$$3;return writerLock=function _0x178a97(_0x621634,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x51c268=_0x9448,_0xe8025c=_0x1478d9[_0x51c268(0x195)](_0x621634,'WRITER.LOCK'),_0x142ae7=_0x162d54['randomBytes'](0x8)[_0x51c268(0x186)](_0x51c268(0x18b));let _0x407f2c=![],_0x315f94=null;const _0x1ff929=()=>JSON[_0x51c268(0x112)]({'pid':process[_0x51c268(0x19a)],'token':_0x142ae7,'at':Date[_0x51c268(0x16e)]()});function _0xea15e8(){const _0x121da9=_0x51c268;try{return JSON['parse'](_0x39d160[_0x121da9(0x152)](_0xe8025c,'utf8'));}catch(_0x4caeaa){return _0x4caeaa?.[_0x121da9(0x193)]===_0x121da9(0x178)?null:{'unreadable':!![]};}}function _0x54eba4(){const _0x4ebdba=_0x51c268;try{const _0x463302=_0x39d160[_0x4ebdba(0x1a6)](_0xe8025c,'wx');try{_0x39d160[_0x4ebdba(0xf0)](_0x463302,_0x1ff929());}finally{_0x39d160['closeSync'](_0x463302);}return!![];}catch(_0x28f435){if(_0x28f435?.[_0x4ebdba(0x193)]===_0x4ebdba(0x14e))return![];throw _0x28f435;}}function _0x548928(_0x1d5516){const _0x4be334=_0x51c268;if(!_0x1d5516)return!![];if(_0x1d5516[_0x4be334(0x13d)])return!![];return Date[_0x4be334(0x16e)]()-(_0x1d5516['at']??0x0)>=maxAgeMs;}function _0x2468f3(){if(_0x315f94)clearInterval(_0x315f94);_0x315f94=null;}function _0x74a183(){const _0x57a0c4=_0x51c268;_0x2468f3(),_0x315f94=setInterval(()=>{const _0x32efbb=_0x9448,_0xc3110c=_0xea15e8();if(_0xc3110c&&!_0xc3110c[_0x32efbb(0x13d)]&&_0xc3110c[_0x32efbb(0xe5)]!==_0x142ae7){_0x407f2c=![],_0x2468f3();try{onLost?.();}catch{}return;}try{_0x39d160[_0x32efbb(0xf0)](_0xe8025c,_0x1ff929());}catch{}},_0x4a91c3(heartbeatMs)),_0x315f94[_0x57a0c4(0xdd)]?.();}function _0x39f0c5(){const _0x1f396b=_0x51c268,_0x1ee35a=_0xea15e8();return!!_0x1ee35a&&_0x1ee35a[_0x1f396b(0xe5)]===_0x142ae7;}return{'path':_0xe8025c,'token':_0x142ae7,'acquire'(){const _0x1b1f2d=_0x51c268,_0x367513=_0xea15e8();if(_0x367513&&_0x367513[_0x1b1f2d(0xe5)]===_0x142ae7){_0x407f2c=!![];if(!_0x315f94)_0x74a183();return!![];}let _0x3ec020=_0x54eba4();if(!_0x3ec020&&_0x548928(_0xea15e8())){try{_0x39d160[_0x1b1f2d(0x14f)](_0xe8025c);}catch{}_0x3ec020=_0x54eba4();}if(_0x3ec020&&!_0x39f0c5())_0x3ec020=![];_0x407f2c=_0x3ec020;if(_0x3ec020)_0x74a183();return _0x3ec020;},'held'(){return _0x407f2c;},'isFree'(){const _0x3acb6b=_0x51c268,_0x122408=_0xea15e8();if(_0x122408&&_0x122408[_0x3acb6b(0xe5)]===_0x142ae7)return![];return _0x548928(_0x122408);},'release'(){const _0x5b8f46=_0x51c268;_0x2468f3();if(!_0x407f2c)return;_0x407f2c=![];if(_0x39f0c5())try{_0x39d160[_0x5b8f46(0x14f)](_0xe8025c);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x383dff=require$$0,{clampTimerDelay:_0x11e23d,isNeverDelay:_0x305b33}=requireOkdbTimers(),_0x42d966=requireSnapshotStore(),_0x521e11=requireLabelMap(),_0x453485=requireWriterLock(),{fingerprint:_0x11b0fe,reconcileIndex:_0x5d7efc}=requireIndexConvergence(),_0x477e7a=0x1;let _0x349fad=null;function _0x13502e(){const _0x3be0d4=_0x9448;if(_0x349fad)return _0x349fad;try{return _0x349fad=require('usearch'),_0x349fad;}catch(_0x1b0db8){const _0x3e34a1=new Error(_0x3be0d4(0x159)+(_0x3be0d4(0x106)+process[_0x3be0d4(0x129)][_0x3be0d4(0xfd)]+_0x3be0d4(0x140)+process[_0x3be0d4(0x157)]+'/'+process[_0x3be0d4(0x198)]+'.\x20')+_0x3be0d4(0x107)+(_0x3be0d4(0x111)+(_0x1b0db8?.[_0x3be0d4(0x13b)]||String(_0x1b0db8))));_0x3e34a1[_0x3be0d4(0x193)]=_0x3be0d4(0x124),_0x3e34a1[_0x3be0d4(0x1a9)]=_0x1b0db8;throw _0x3e34a1;}}function _0x19d7a4(_0x260a10,_0x18a54f){const _0x2a10d7=_0x9448;switch(_0x260a10){case'cosine':return _0x18a54f[_0x2a10d7(0xd6)][_0x2a10d7(0xf1)];case'l2':return _0x18a54f[_0x2a10d7(0xd6)][_0x2a10d7(0x1ad)];case'ip':return _0x18a54f[_0x2a10d7(0xd6)]['IP'];default:return _0x18a54f['MetricKind'][_0x2a10d7(0xf1)];}}return usearch=function _0x422c70(_0x457b1f={},{dims:_0x3026de,dir:_0x1aaea1,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x53a664=_0x9448,_0x3a1a05=_0x13502e();if(!_0x3026de||_0x3026de<=0x0)throw new Error(_0x53a664(0x121));if(!_0x1aaea1)throw new Error(_0x53a664(0xe8));const _0x4ea967={'metric':_0x457b1f[_0x53a664(0x10d)]??_0x53a664(0x1ab),'connectivity':_0x457b1f['connectivity']??0x10,'expansionAdd':_0x457b1f[_0x53a664(0x1a2)]??0x80,'expansionSearch':_0x457b1f['expansionSearch']??0x40,'snapshotEveryChanges':_0x457b1f[_0x53a664(0x199)]??0xc350,'snapshotMaxLagMs':_0x457b1f[_0x53a664(0x1ae)]??0x2710,'keepSnapshots':_0x457b1f[_0x53a664(0x12d)]??0x2,'tmpMaxAgeMs':_0x457b1f[_0x53a664(0x175)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x457b1f['heartbeatIntervalMs']??0x1388,'writerLockMaxAgeMs':_0x457b1f[_0x53a664(0x15e)]??0x3a98,'viewRefreshMs':_0x457b1f[_0x53a664(0xde)]??0x3e8},_0x1e7eaf=new _0x42d966({'dir':_0x1aaea1,'keepSnapshots':_0x4ea967[_0x53a664(0x12d)]}),_0x5dc882=_0x453485(_0x1aaea1,{'maxAgeMs':_0x4ea967['writerLockMaxAgeMs'],'heartbeatMs':_0x4ea967[_0x53a664(0x15a)],'onLost':()=>{const _0x3b9dd5=_0x53a664;_0x490487(_0x2cf3e8)[_0x3b9dd5(0x10c)](()=>{});}});let _0xf90cbc=new _0x521e11(),_0x2af47b=null,_0x38a95c=0x0,_0x3ab34a=null,_0x4ca126=![],_0x84eab=![],_0x115467=null,_0x4318e6=0x0,_0x3d6b46=null,_0x265c0e=0x0,_0xf6f36a=![],_0x110871=Promise['resolve']();const _0x490487=_0x1dd674=>{const _0x417a31=_0x53a664,_0x10792f=_0x110871[_0x417a31(0x146)](_0x1dd674);return _0x110871=_0x10792f[_0x417a31(0x10c)](()=>{}),_0x10792f;},_0x1b54cc=()=>{try{onChange?.();}catch{}};function _0x5be32e(){const _0x4cf50e=_0x53a664;return new _0x3a1a05[(_0x4cf50e(0x16f))]({'dimensions':_0x3026de,'metric':_0x19d7a4(_0x4ea967[_0x4cf50e(0x10d)],_0x3a1a05),'quantization':_0x3a1a05[_0x4cf50e(0x104)][_0x4cf50e(0xee)],'connectivity':_0x4ea967[_0x4cf50e(0x103)],'expansion_add':_0x4ea967[_0x4cf50e(0x1a2)],'expansion_search':_0x4ea967[_0x4cf50e(0x177)],'multi':![]});}function _0x2138e7(_0x5a25f2){return _0x5a25f2 instanceof Float32Array?_0x5a25f2:new Float32Array(_0x5a25f2);}function _0x317a47(){const _0x36e5aa=_0x53a664;if(fetchAll)return fetchAll();if(_0x3ab34a)return _0x3ab34a();return Promise[_0x36e5aa(0x10b)](null);}function _0x34e2ae(_0x310b77,_0x2e9bc7,_0x479c16){const _0x2c4254=_0x53a664,_0x24b7a0=_0xf90cbc['labelForExisting'](_0x310b77);if(_0x24b7a0!==undefined)try{_0x2af47b[_0x2c4254(0xef)](BigInt(_0x24b7a0));}catch{}const _0x5bea34=_0xf90cbc['labelForEphemeral'](_0x310b77);_0x2af47b[_0x2c4254(0x153)](BigInt(_0x5bea34),_0x2e9bc7),_0xf90cbc[_0x2c4254(0x114)](_0x310b77,_0x479c16??_0x11b0fe(_0x2e9bc7));}function _0x275585(_0x127ddc){const _0x4d7209=_0x53a664,_0x5cebd9=_0xf90cbc[_0x4d7209(0x183)](_0x127ddc);if(_0x5cebd9===undefined)return![];try{_0x2af47b['remove'](BigInt(_0x5cebd9));}catch{}return _0xf90cbc[_0x4d7209(0x19d)](_0x127ddc),!![];}function _0x2986de(_0x2d54c1){const _0x42064e=_0x53a664;_0xf90cbc=new _0x521e11(),_0x2af47b=_0x5be32e();for(const {key:_0x378d1a,vector:_0x467a2b}of _0x2d54c1??[]){if(!(_0x467a2b instanceof Float32Array)||_0x467a2b[_0x42064e(0x18c)]!==_0x3026de)continue;_0x34e2ae(_0x378d1a,_0x467a2b);}_0x38a95c=0x0;}function _0x41ca82(){const _0x3667b0=_0x53a664;return Math['max'](Date[_0x3667b0(0x16e)](),_0x1e7eaf[_0x3667b0(0xe3)]()+0x1);}function _0x3110ed(){if(_0x115467)clearTimeout(_0x115467);_0x115467=null;}function _0xbbe943(){const _0x447767=_0x53a664;if(!_0x4ea967[_0x447767(0x1ae)]||_0x305b33(_0x4ea967[_0x447767(0x1ae)])||_0x115467||!_0x84eab||_0x38a95c<=0x0)return;const _0x31a143=_0x11e23d(Math[_0x447767(0x126)](_0x4ea967[_0x447767(0x1ae)],0xa*_0x4318e6));_0x115467=setTimeout(()=>{const _0x200984=_0x447767;_0x115467=null,_0x490487(async()=>{if(_0x84eab&&_0x38a95c>0x0)await _0x342543();_0xbbe943(),_0x1b54cc();})[_0x200984(0x10c)](()=>{});},_0x31a143),_0x115467[_0x447767(0xdd)]?.();}async function _0x342543(_0x53b029){const _0x632000=_0x53a664;if(!_0x2af47b)return![];const _0x1e7f4b=_0x53b029??_0x41ca82(),_0x2d94c6=Date['now'](),_0x1f5643=await _0x1e7eaf[_0x632000(0xe9)](_0x1e7f4b,async _0xcceace=>{const _0x1b69c9=_0x632000;_0x2af47b['save'](_0xcceace[_0x1b69c9(0xf8)]),await _0xf90cbc[_0x1b69c9(0x189)](_0xcceace['labels']),_0x383dff[_0x1b69c9(0xf0)](_0xcceace['state'],JSON[_0x1b69c9(0x112)]({'manifestVersion':_0x477e7a,'algorithm':_0x1b69c9(0x1a1),'dims':_0x3026de,'metric':_0x4ea967[_0x1b69c9(0x10d)],'clock':_0x1e7f4b,'snapshotAt':Date[_0x1b69c9(0x16e)]()},null,0x2));},{'keep':_0x4ea967[_0x632000(0x12d)]});return _0x4318e6=Date[_0x632000(0x16e)]()-_0x2d94c6,_0x1f5643?.[_0x632000(0xfc)]&&(_0x38a95c=0x0,_0x3110ed()),_0x1f5643?.[_0x632000(0xfc)]??![];}function _0x25af3a(){const _0x23b1bb=_0x53a664;_0x38a95c++;if(_0x38a95c>=_0x4ea967[_0x23b1bb(0x199)])return _0x342543();return _0xbbe943(),null;}async function _0x496298(){const _0x4aa99b=_0x53a664,_0xd6c3ec=_0x1e7eaf['readCurrentId']()||_0x1e7eaf[_0x4aa99b(0x138)]();if(!_0xd6c3ec)return null;let _0x3ee983,_0x5c995a=![];try{await _0x1e7eaf[_0x4aa99b(0x14b)](_0xd6c3ec,async _0x1d900b=>{const _0x2382ff=_0x4aa99b;_0x3ee983=JSON[_0x2382ff(0xfa)](_0x383dff['readFileSync'](_0x1d900b['state'],'utf8'));if(_0x3ee983[_0x2382ff(0x171)]!==_0x477e7a||_0x3ee983['algorithm']!==_0x2382ff(0x1a1)||_0x3ee983[_0x2382ff(0x1ac)]!==_0x3026de||_0x3ee983['metric']!==_0x4ea967['metric']){_0x3ee983=null;return;}const _0x2acaf2=new _0x521e11();await _0x2acaf2[_0x2382ff(0x15c)](_0x1d900b[_0x2382ff(0xf4)]);const _0x22751d=_0x5be32e();_0x22751d['load'](_0x1d900b[_0x2382ff(0xf8)]),_0xf90cbc=_0x2acaf2,_0x2af47b=_0x22751d,_0x5c995a=!![];});}catch{return null;}return _0x5c995a?_0x3ee983?.[_0x4aa99b(0x160)]??0x0:null;}async function _0x3f7753(_0x54ef92){const _0x5885f3=_0x53a664;_0x3d6b46=null;const _0x147441=await _0x496298();if(_0x147441!=null){_0x38a95c=0x0;if(_0x54ef92){if(!_0xf90cbc['hasFingerprints'])return _0x2986de(_0x54ef92),await _0x342543(),null;const _0x120555=_0x5d7efc(_0xf90cbc,_0x54ef92,_0x3026de,{'upsert':_0x34e2ae,'remove':_0x275585}),_0x334a65=_0x120555[_0x5885f3(0xf7)]+_0x120555[_0x5885f3(0x15b)]+_0x120555['removed'];_0x334a65>0x0&&(_0x38a95c+=_0x334a65,await _0x342543());}return _0x147441;}_0x2986de(_0x54ef92??[]);if(_0x2af47b[_0x5885f3(0x16d)]()>0x0)await _0x342543();return null;}async function _0x4b8058(){_0x84eab=!![],await _0x3f7753(await _0x317a47());}async function _0x2cf3e8(){const _0x1050c5=_0x53a664;if(!_0x84eab)return;_0x84eab=![],_0x3110ed(),_0x38a95c=0x0;const _0x13481f=_0x1e7eaf[_0x1050c5(0x119)]()||_0x1e7eaf['latestSnapshotId']();await _0x57f51c(_0x13481f),_0x1b54cc();}async function _0x57f51c(_0x2ecda0){const _0x53bd9a=_0x53a664;if(!_0x2ecda0)return![];let _0x1d1066=![];try{await _0x1e7eaf[_0x53bd9a(0x14b)](_0x2ecda0,async _0x30b08a=>{const _0x243bc2=_0x53bd9a,_0x4c96d5=JSON['parse'](_0x383dff['readFileSync'](_0x30b08a['state'],_0x243bc2(0x15d)));if(_0x4c96d5['manifestVersion']!==_0x477e7a||_0x4c96d5[_0x243bc2(0x19e)]!==_0x243bc2(0x1a1)||_0x4c96d5[_0x243bc2(0x1ac)]!==_0x3026de||_0x4c96d5[_0x243bc2(0x10d)]!==_0x4ea967[_0x243bc2(0x10d)])return;const _0x30f211=new _0x521e11();await _0x30f211[_0x243bc2(0x15c)](_0x30b08a[_0x243bc2(0xf4)]);const _0x5374b0=_0x5be32e();_0x5374b0[_0x243bc2(0x18d)](_0x30b08a[_0x243bc2(0xf8)]),_0x2af47b=_0x5374b0,_0xf90cbc=_0x30f211,_0x3d6b46=_0x2ecda0,_0x1d1066=!![];});}catch{}return _0x1d1066;}function _0x72e50c(){const _0x3c0094=_0x53a664,_0x2cb7cc=Date[_0x3c0094(0x16e)]();if(_0x2cb7cc-_0x265c0e<_0x4ea967[_0x3c0094(0xde)])return;_0x265c0e=_0x2cb7cc;if(_0xf6f36a)return;if(_0x5dc882['isFree']()){_0xf6f36a=!![],_0x490487(async()=>{!_0x84eab&&_0x4ca126&&_0x5dc882['acquire']()&&(await _0x4b8058(),_0x1b54cc());})[_0x3c0094(0x10c)](()=>{})['finally'](()=>{_0xf6f36a=![];});return;}const _0x2a9b0f=_0x1e7eaf[_0x3c0094(0x119)]()||_0x1e7eaf[_0x3c0094(0x138)]();if(!_0x2a9b0f||_0x2a9b0f===_0x3d6b46)return;_0xf6f36a=!![],_0x490487(async()=>{if(!_0x84eab&&await _0x57f51c(_0x2a9b0f))_0x1b54cc();})[_0x3c0094(0x10c)](()=>{})[_0x3c0094(0x185)](()=>{_0xf6f36a=![];});}return{async 'load'(_0x547fa7){return _0x490487(async()=>{const _0x2187c9=_0x9448;_0x1e7eaf[_0x2187c9(0x127)]({'maxAgeMs':_0x4ea967[_0x2187c9(0x175)]}),_0x3ab34a=_0x547fa7??null,_0x84eab=_0x5dc882[_0x2187c9(0xf6)]();let _0x321f4a=null;if(_0x84eab)_0x321f4a=await _0x3f7753(_0x547fa7?await _0x547fa7():null);else{const _0xcdadb6=_0x1e7eaf[_0x2187c9(0x119)]()||_0x1e7eaf['latestSnapshotId']();await _0x57f51c(_0xcdadb6);}return _0x4ca126=!![],_0x321f4a;});},async 'add'(_0x1549d8,_0x4280d9,_0x1fd22c){return _0x490487(async()=>{const _0x2478e4=_0x9448;if(!_0x4ca126)return;const _0x5be524=_0x2138e7(_0x4280d9);if(!_0x84eab){if(!_0x5dc882['acquire']())return;await _0x4b8058();}if(!_0x2af47b)return;const _0x39d527=_0x11b0fe(_0x5be524);if(_0xf90cbc[_0x2478e4(0x12c)](_0x1549d8)===_0x39d527)return;_0x34e2ae(_0x1549d8,_0x5be524,_0x39d527),await _0x25af3a();});},async 'remove'(_0x1fb228){return _0x490487(async()=>{const _0x344f41=_0x9448;if(!_0x4ca126)return;if(!_0x84eab){if(!_0x5dc882[_0x344f41(0xf6)]())return;await _0x4b8058();}if(!_0x2af47b)return;if(_0x275585(_0x1fb228))await _0x25af3a();});},'search'(_0xd9662c,{limit:limit=0xa}={}){const _0x422dbe=_0x53a664;if(!_0x84eab&&_0x4ca126)_0x72e50c();if(!_0x2af47b)return[];const _0x340266=_0x2af47b[_0x422dbe(0x16d)]();if(_0x340266===0x0)return[];const _0x1425b8=Math[_0x422dbe(0xe1)](limit,_0x340266),_0x50cb48=_0x2af47b[_0x422dbe(0xfb)](_0x2138e7(_0xd9662c),_0x1425b8,0x0),_0x44fea5=[],_0x351015=_0x50cb48[_0x422dbe(0xd3)],_0x2f357f=_0x50cb48['distances'];for(let _0x3a283b=0x0;_0x3a283b<_0x351015['length'];_0x3a283b++){const _0x725379=_0x351015[_0x3a283b];if(_0x725379===0xffffffffffffffffn)continue;const _0x1f061b=Number(_0x725379),_0x17cfb3=_0xf90cbc[_0x422dbe(0x147)](_0x1f061b);if(!_0x17cfb3)continue;const _0x169bc5=_0x2f357f[_0x3a283b];let _0x4cbc78;if(_0x4ea967['metric']==='cosine')_0x4cbc78=Math[_0x422dbe(0x126)](0x0,0x1-_0x169bc5);else{if(_0x4ea967[_0x422dbe(0x10d)]==='ip')_0x4cbc78=-_0x169bc5;else _0x4cbc78=0x1/(0x1+_0x169bc5);}_0x44fea5[_0x422dbe(0xff)]({'key':_0x17cfb3,'score':_0x4cbc78});}return _0x44fea5;},async 'snapshot'(_0x16fa19){return _0x490487(()=>_0x84eab?_0x342543(_0x16fa19??undefined):![]);},async 'rebuild'(_0x9a36b6){return _0x490487(async()=>{const _0x2e8eb2=_0x9448;if(_0x9a36b6!=null)_0x3ab34a=_0x9a36b6;if(!_0x84eab){if(!_0x5dc882[_0x2e8eb2(0xf6)]())return;_0x84eab=!![];}const _0x2a7755=_0x9a36b6?await _0x9a36b6():await _0x317a47();_0x2986de(_0x2a7755??[]),_0x4ca126=!![],await _0x342543();});},async 'stop'(){return _0x490487(async()=>{const _0x1e3df4=_0x9448;_0x3110ed();if(_0x84eab){if(_0x38a95c>0x0||!_0x1e7eaf[_0x1e3df4(0x119)]())await _0x342543();_0x5dc882[_0x1e3df4(0x18f)]();}_0x84eab=![],_0x4ca126=![];});},'count'(){const _0x21d083=_0x53a664;return _0xf90cbc[_0x21d083(0x16d)]();},'info'(){const _0x27096b=_0x53a664;return{'algorithm':'usearch','role':_0x84eab?_0x27096b(0x16b):_0x27096b(0x141),'metric':_0x4ea967[_0x27096b(0x10d)],'connectivity':_0x4ea967[_0x27096b(0x103)],'expansionAdd':_0x4ea967['expansionAdd'],'expansionSearch':_0x4ea967['expansionSearch'],'snapshotEveryChanges':_0x4ea967[_0x27096b(0x199)],'snapshotMaxLagMs':_0x4ea967['snapshotMaxLagMs'],'count':_0xf90cbc[_0x27096b(0x16d)](),'size':_0x2af47b?.[_0x27096b(0x16d)]?.()??0x0,'capacity':_0x2af47b?.['capacity']?.()??0x0,'changesSince':_0x84eab?_0x38a95c:null,'viewedSnapshot':_0x3d6b46??null,'snapshotDir':_0x1aaea1,'latestSnapshot':_0x1e7eaf[_0x27096b(0x119)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x560435=_0x35715f;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x4026e9,workerData:_0x38129a}=require$$0$1,{algorithmName:_0x3e7b10,algorithmConfig:_0x5939b6,dims:_0xf61d78,dir:_0x16dcfd}=_0x38129a;let _0x45ec65=0x1;const _0x1915f0=new Map();function _0x5d2946(){const _0x278054=_0x45ec65++;return new Promise((_0x39e81b,_0xc8501)=>{const _0x5617aa=_0x9448;_0x1915f0['set'](_0x278054,{'resolve':_0x39e81b,'reject':_0xc8501}),_0x4026e9[_0x5617aa(0xe7)]({'op':_0x5617aa(0xf3),'fid':_0x278054});});}const _0x422e01={'dims':_0xf61d78,'dir':_0x16dcfd,'fetchAll':_0x5d2946,'onChange':()=>_0x884f35()};let _0x291134;if(_0x3e7b10===_0x560435(0x16a))_0x291134=requireHnsw()(_0x5939b6,_0x422e01);else{if(_0x3e7b10===_0x560435(0x151))_0x291134=requireFlat()(_0x5939b6,_0x422e01);else{if(_0x3e7b10==='usearch')_0x291134=requireUsearch()(_0x5939b6,_0x422e01);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x3e7b10+'\x22');}}function _0x884f35(){const _0x44bf20=_0x560435;try{_0x4026e9[_0x44bf20(0xe7)]({'op':_0x44bf20(0x122),'count':_0x291134['count'](),'info':_0x291134[_0x44bf20(0x136)](),'memory':process[_0x44bf20(0x14a)]()});}catch{}}function _0x4130e9(_0x4e70c4){const _0x98f65e=_0x560435;return(_0x4e70c4||[])[_0x98f65e(0x170)](_0x48d679=>({'key':_0x48d679[_0x98f65e(0x181)],'vector':_0x48d679[_0x98f65e(0xe0)]instanceof Float32Array?_0x48d679['vector']:new Float32Array(_0x48d679[_0x98f65e(0xe0)])}));}return _0x4026e9['on'](_0x560435(0x13b),async _0x486cc8=>{const _0x4c6007=_0x560435;if(_0x486cc8['op']===_0x4c6007(0x12a)){const _0x56db6c=_0x1915f0[_0x4c6007(0x172)](_0x486cc8[_0x4c6007(0x131)]);if(!_0x56db6c)return;_0x1915f0['delete'](_0x486cc8[_0x4c6007(0x131)]);if(_0x486cc8[_0x4c6007(0x169)])_0x56db6c[_0x4c6007(0x11b)](new Error(_0x486cc8['error']));else _0x56db6c[_0x4c6007(0x10b)](_0x4130e9(_0x486cc8[_0x4c6007(0xd7)]));return;}const {id:_0x209ebd,op:_0x450239,args:_0xd7a514}=_0x486cc8;try{let _0x6ef2fc;switch(_0x450239){case'load':{_0x6ef2fc=await _0x291134[_0x4c6007(0xec)](_0xd7a514[_0x4c6007(0x182)]?_0x5d2946:null),_0x884f35();break;}case'add':{const _0x1b1ed4=_0xd7a514['vector']instanceof Float32Array?_0xd7a514[_0x4c6007(0xe0)]:new Float32Array(_0xd7a514[_0x4c6007(0xe0)]);await _0x291134[_0x4c6007(0x153)](_0xd7a514[_0x4c6007(0x181)],_0x1b1ed4,_0xd7a514[_0x4c6007(0x160)]??undefined),_0x884f35(),_0x6ef2fc=null;break;}case'remove':{await _0x291134[_0x4c6007(0xef)](_0xd7a514['key']),_0x884f35(),_0x6ef2fc=null;break;}case'search':{const _0x55c475=_0xd7a514['queryVec']instanceof Float32Array?_0xd7a514[_0x4c6007(0x1a0)]:new Float32Array(_0xd7a514['queryVec']);_0x6ef2fc=_0x291134[_0x4c6007(0xfb)](_0x55c475,_0xd7a514['opts']||{});break;}case _0x4c6007(0x109):{_0x6ef2fc=await _0x291134['snapshot'](_0xd7a514[_0x4c6007(0x160)]),_0x884f35();break;}case _0x4c6007(0x173):{const _0x54999c=_0x4130e9(_0xd7a514[_0x4c6007(0xd7)]);await _0x291134[_0x4c6007(0x173)](async()=>_0x54999c),_0x884f35(),_0x6ef2fc=null;break;}case _0x4c6007(0x13e):{await _0x291134[_0x4c6007(0x13e)](),_0x884f35(),_0x6ef2fc=null;break;}case _0x4c6007(0x12b):{_0x6ef2fc=_0x291134['count']();break;}case _0x4c6007(0x136):{_0x6ef2fc=_0x291134['info']();break;}default:throw new Error(_0x4c6007(0xf9)+_0x450239+'\x22');}_0x4026e9[_0x4c6007(0xe7)]({'id':_0x209ebd,'result':_0x6ef2fc});}catch(_0x6c7a7f){_0x4026e9[_0x4c6007(0xe7)]({'id':_0x209ebd,'error':{'message':_0x6c7a7f?.[_0x4c6007(0x13b)]||String(_0x6c7a7f),'code':_0x6c7a7f?.['code']}});}}),_0x4026e9[_0x560435(0xe7)]({'op':_0x560435(0x12e)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module['exports']=algorithmWorkerThread;
|
|
1
|
+
'use strict';const _0x5daec5=_0x2974;(function(_0x1f53be,_0x310354){const _0x235ece=_0x2974,_0x231ebd=_0x1f53be();while(!![]){try{const _0x4394d4=-parseInt(_0x235ece(0x152))/0x1*(parseInt(_0x235ece(0x138))/0x2)+parseInt(_0x235ece(0x149))/0x3+-parseInt(_0x235ece(0x16d))/0x4*(parseInt(_0x235ece(0x148))/0x5)+-parseInt(_0x235ece(0x188))/0x6*(-parseInt(_0x235ece(0x108))/0x7)+-parseInt(_0x235ece(0x147))/0x8+parseInt(_0x235ece(0x183))/0x9+-parseInt(_0x235ece(0xef))/0xa*(-parseInt(_0x235ece(0x192))/0xb);if(_0x4394d4===_0x310354)break;else _0x231ebd['push'](_0x231ebd['shift']());}catch(_0x36c11e){_0x231ebd['push'](_0x231ebd['shift']());}}}(_0x33aa,0xb0d9c));function _0x33aa(){const _0x2f8306=['reader','snapshotEveryChanges','delete','hex','stale','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','lock_busy','resizeIndex','openSync','snapshotMaxLagMs','number','acquire','score','efSearch','readIndexSync','buffer',').\x20','prototype','path','ceil','1586165klgsyi','.tmp-','L2sq','count','now','candidateClock\x20must\x20be\x20finite\x20>=\x200','_snapshotDir','fid','exports','message','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','tombstone','info','readCurrentClock','ready','max','parse','snapshot','prune','dir','cleanupTmpDirs','fingerprintOf','isArray','nextLabel','connectivity','snapshotsDir','memoryUsage','queryVec','imul','getCurrentCount','writerLockMaxAgeMs','expansionAdd','WRITER.LOCK','tmpMaxAgeMs','keyForLabel','from','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','changed','distances','join','labels','add','byteOffset','trim','rmSync','hnsw','snapshots','markDelete','1435160vJFYUT','mtimeMs','snapshotTo','keyToLabel','lockPath','sort','removed','loadSnapshot','filter','platform','min','fetchAll','finally','Unknown\x20op:\x20\x22','setFingerprint','6542448rObuwR','41155uYNIqz','131166LdxYZB','.tmp','growFactor','EEXIST','search','capacity','readFileSync','set','loadFrom','2BAFEFX','Original\x20error:\x20','readdirSync','isDirectory','latestSnapshotId','cause','opts','labelToKey','log','publishSnapshot','clock','default','dims','map','slice','warn','published','mkdirSync','fetchAllResult','keys','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','keyToFp','getMaxElements','vectors','cosine','length','renameSync','556dOduEe','state','index','for\x20Node\x20','vector','has','hasFingerprints','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','ENOENT','code',',\x20host:\x20','repeat','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','node','usearch','keepSnapshots','versions','resolve','key','setEf','get','labelForEphemeral','2450970VLoLRY','error','pid','catch','HierarchicalNSW','6qKeRvz','s,\x20pid:\x20','utf8','isInteger','worker_threads','arch','push','token','crypto','save','9841722bngsCs','listSnapshotIds','Cos','name','postMessage','CURRENT','clear','startsWith','maxElements','_tombstoneCount','then','remove','stop','stringify','_snapshotPaths','[SnapshotStore]','Unknown\x20algorithm:\x20\x22','writeFileSync','unlinkSync','labels.json','sqrt','flat','writer','addPoint','ScalarKind','USEARCH_BINDINGS_UNAVAILABLE','readCurrentId','heartbeatIntervalMs','state.json','closeSync','\x20on\x20','isFinite','usearch\x20algorithm\x20requires\x20dims\x20>\x200','round','added','randomBytes','reset','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','algorithm','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','initIndex','MetricKind','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','unref','expansionSearch','unreadable','manifestVersion','size','toString','Index','version','view','currentPath','entries','viewRefreshMs','labelForExisting','efConstruction','trunc','sync','load','metric','40hClCSd','rebuild','SNAPSHOT.LOCK','call','_tmp-'];_0x33aa=function(){return _0x2f8306;};return _0x33aa();}var require$$0$1=require(_0x5daec5(0x18c)),require$$0=require('fs'),require$$1=require(_0x5daec5(0x106)),require$$2=require('os'),require$$3=require(_0x5daec5(0x190));function getDefaultExportFromCjs(_0x4e7727){const _0x84723c=_0x5daec5;return _0x4e7727&&_0x4e7727['__esModule']&&Object[_0x84723c(0x105)]['hasOwnProperty'][_0x84723c(0xf2)](_0x4e7727,_0x84723c(0x15d))?_0x4e7727[_0x84723c(0x15d)]:_0x4e7727;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x550890=_0x5daec5;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x3e1b45=require$$0,_0x1fba66=require$$1,_0x271cd1=require$$2,_0x21cf16=require$$3;function _0x3a3eb0(){return Date['now']();}function _0x5f1e2a(_0x539a4a){try{return _0x3e1b45['existsSync'](_0x539a4a);}catch{return![];}}function _0x502d77(_0x513d95){const _0x375c11=_0x2974;try{return _0x3e1b45[_0x375c11(0x14f)](_0x513d95,'utf8');}catch{return null;}}function _0x3fc1bd(_0x5e4487,_0x15eae5){const _0x20ec40=_0x2974,_0x4229e6=_0x5e4487+'.tmp-'+_0x21cf16[_0x20ec40(0x1b5)](0x6)[_0x20ec40(0xe2)](_0x20ec40(0xf7));_0x3e1b45[_0x20ec40(0x1a3)](_0x4229e6,_0x15eae5),_0x3e1b45[_0x20ec40(0x16c)](_0x4229e6,_0x5e4487);}function _0x37dd65(_0x53255b,_0x2d68a8=0x10){const _0x20fb68=_0x2974,_0x4548f9=String(Math[_0x20fb68(0x117)](0x0,Math['trunc'](_0x53255b||0x0)));return _0x4548f9['length']>=_0x2d68a8?_0x4548f9:'0'[_0x20fb68(0x178)](_0x2d68a8-_0x4548f9[_0x20fb68(0x16b)])+_0x4548f9;}return snapshotStore=class _0x17cf59{constructor({dir:_0x4d79b5,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x2024a1=_0x2974;if(!_0x4d79b5)throw new Error('SnapshotStore\x20requires\x20dir');this[_0x2024a1(0x11b)]=_0x4d79b5,this['snapshotsDir']=_0x1fba66[_0x2024a1(0x12f)](_0x4d79b5,_0x2024a1(0x136)),this[_0x2024a1(0xe6)]=_0x1fba66[_0x2024a1(0x12f)](_0x4d79b5,_0x2024a1(0x197)),this[_0x2024a1(0x13c)]=_0x1fba66[_0x2024a1(0x12f)](_0x4d79b5,_0x2024a1(0xf1)),this[_0x2024a1(0x17c)]=keepSnapshots,this['log']=log,_0x3e1b45[_0x2024a1(0x163)](this['dir'],{'recursive':!![]}),_0x3e1b45['mkdirSync'](this[_0x2024a1(0x121)],{'recursive':!![]});}[_0x550890(0x10e)](_0x5d8778){const _0x15ec89=_0x550890;return _0x1fba66[_0x15ec89(0x12f)](this[_0x15ec89(0x121)],_0x5d8778);}[_0x550890(0x1a0)](_0x496b90){const _0xe43bdb=_0x550890,_0x5696bc=this[_0xe43bdb(0x10e)](_0x496b90);return{'dir':_0x5696bc,'index':_0x1fba66['join'](_0x5696bc,'index.hnsw'),'labels':_0x1fba66[_0xe43bdb(0x12f)](_0x5696bc,_0xe43bdb(0x1a5)),'state':_0x1fba66[_0xe43bdb(0x12f)](_0x5696bc,'state.json')};}[_0x550890(0x1ac)](){const _0x5445af=_0x550890;if(!_0x5f1e2a(this['currentPath']))return null;const _0x226442=_0x502d77(this[_0x5445af(0xe6)]);if(!_0x226442)return null;const _0x489bac=String(_0x226442)[_0x5445af(0x133)]();return _0x489bac||null;}[_0x550890(0x115)](){const _0xfdc53c=_0x550890,_0xe7e42f=this['readCurrentId']();if(!_0xe7e42f)return 0x0;const _0x53f244=Number(_0xe7e42f);return Number[_0xfdc53c(0x1b1)](_0x53f244)?_0x53f244:0x0;}[_0x550890(0x193)](){const _0x4c541c=_0x550890;try{return _0x3e1b45[_0x4c541c(0x154)](this[_0x4c541c(0x121)],{'withFileTypes':!![]})[_0x4c541c(0x140)](_0x27e6d7=>_0x27e6d7[_0x4c541c(0x155)]())[_0x4c541c(0x15f)](_0x48adc5=>_0x48adc5[_0x4c541c(0x195)])[_0x4c541c(0x140)](_0x31f62b=>!_0x31f62b[_0x4c541c(0x199)](_0x4c541c(0x109)))[_0x4c541c(0x140)](_0x4554ff=>!_0x4554ff[_0x4c541c(0x199)](_0x4c541c(0xf3)))[_0x4c541c(0x13d)]();}catch{return[];}}[_0x550890(0x156)](){const _0x515968=_0x550890,_0x27716d=this[_0x515968(0x1ac)]();if(_0x27716d)return _0x27716d;const _0x4af4d1=this[_0x515968(0x193)]();if(!_0x4af4d1[_0x515968(0x16b)])return null;return _0x4af4d1[_0x4af4d1[_0x515968(0x16b)]-0x1];}['cleanupTmpDirs']({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x4a16cd=_0x550890;let _0x12a4a0;try{_0x12a4a0=_0x3e1b45[_0x4a16cd(0x154)](this[_0x4a16cd(0x121)],{'withFileTypes':!![]});}catch{return;}const _0x104bfc=_0x3a3eb0()-maxAgeMs;for(const _0x26d3c9 of _0x12a4a0){if(!_0x26d3c9[_0x4a16cd(0x155)]())continue;const _0x36e548=_0x26d3c9[_0x4a16cd(0x195)];if(!_0x36e548[_0x4a16cd(0x199)](_0x4a16cd(0x109))&&!_0x36e548[_0x4a16cd(0x199)]('_tmp-'))continue;const _0xe588a=_0x1fba66[_0x4a16cd(0x12f)](this['snapshotsDir'],_0x36e548);try{const _0x56df35=_0x3e1b45['statSync'](_0xe588a);if(_0x56df35[_0x4a16cd(0x139)]>_0x104bfc)continue;}catch{}try{_0x3e1b45[_0x4a16cd(0x134)](_0xe588a,{'recursive':!![],'force':!![]});}catch{}}}[_0x550890(0x11a)]({keep:keep=null}={}){const _0x1a4b0a=_0x550890,_0x32b6b1=Math[_0x1a4b0a(0x117)](0x1,Math[_0x1a4b0a(0xeb)](keep??this[_0x1a4b0a(0x17c)]??0x3)),_0x543a0f=this[_0x1a4b0a(0x193)]();if(_0x543a0f['length']<=_0x32b6b1)return;const _0x335698=this[_0x1a4b0a(0x1ac)](),_0x17b4c6=_0x543a0f[_0x1a4b0a(0x160)](0x0,Math['max'](0x0,_0x543a0f[_0x1a4b0a(0x16b)]-_0x32b6b1));for(const _0x5af7ef of _0x17b4c6){if(_0x335698&&_0x5af7ef===_0x335698)continue;const _0x3b00cb=this[_0x1a4b0a(0x10e)](_0x5af7ef);try{_0x3e1b45[_0x1a4b0a(0x134)](_0x3b00cb,{'recursive':!![],'force':!![]});}catch{}}}async[_0x550890(0x13f)](_0x1fd355,_0x39b4a6){const _0xe26c33=_0x550890;if(!_0x1fd355)throw new Error('snapshot\x20id\x20required');const _0x2d2f50=this[_0xe26c33(0x1a0)](_0x1fd355);if(!_0x5f1e2a(_0x2d2f50[_0xe26c33(0x16f)])||!_0x5f1e2a(_0x2d2f50[_0xe26c33(0x130)])||!_0x5f1e2a(_0x2d2f50['state']))throw new Error('snapshot\x20incomplete:\x20'+_0x1fd355);const _0x410cbc=await _0x39b4a6(_0x2d2f50);return _0x410cbc||{};}async[_0x550890(0x15b)](_0x10d9dd,_0x1d9074,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x2505fd=_0x550890,_0x3487e9=Number(_0x10d9dd);if(!Number[_0x2505fd(0x1b1)](_0x3487e9)||_0x3487e9<0x0)throw new Error(_0x2505fd(0x10d));const _0x2b07b0=_0x37dd65(_0x3487e9),_0x2d501e=this['_snapshotDir'](_0x2b07b0),_0x253c56=_0x1fba66[_0x2505fd(0x12f)](this[_0x2505fd(0x121)],_0x2505fd(0x109)+_0x2b07b0+'-'+_0x21cf16[_0x2505fd(0x1b5)](0x6)[_0x2505fd(0xe2)](_0x2505fd(0xf7)));_0x3e1b45[_0x2505fd(0x163)](_0x253c56,{'recursive':!![]});const _0x25d10b={'dir':_0x253c56,'index':_0x1fba66[_0x2505fd(0x12f)](_0x253c56,'index.hnsw'),'labels':_0x1fba66['join'](_0x253c56,_0x2505fd(0x1a5)),'state':_0x1fba66[_0x2505fd(0x12f)](_0x253c56,_0x2505fd(0x1ae))};await _0x1d9074(_0x25d10b,{'id':_0x2b07b0,'clock':_0x3487e9});const _0x3a7897=JSON[_0x2505fd(0x19f)]({'pid':process[_0x2505fd(0x185)],'host':_0x271cd1['hostname'](),'at':_0x3a3eb0()}),_0x266c93=_0x3a3eb0();let _0x438938=null;const _0x2f970e=()=>{const _0x1a18d2=_0x2505fd;try{const _0x101a7a=JSON[_0x1a18d2(0x118)](_0x3e1b45[_0x1a18d2(0x14f)](this[_0x1a18d2(0x13c)],_0x1a18d2(0x18a)));if(_0x101a7a['at']&&_0x3a3eb0()-_0x101a7a['at']>staleLockMaxAgeMs){const _0x54ec98=_0x3a3eb0()-_0x101a7a['at'],_0x28b599=_0x1a18d2(0xf9)+Math[_0x1a18d2(0x1b3)](_0x54ec98/0x3e8)+_0x1a18d2(0x189)+_0x101a7a[_0x1a18d2(0x185)]+_0x1a18d2(0x177)+_0x101a7a['host']+_0x1a18d2(0x104)+_0x1a18d2(0xd9);this[_0x1a18d2(0x15a)]?.[_0x1a18d2(0x161)]?this[_0x1a18d2(0x15a)]['warn'](_0x28b599):console[_0x1a18d2(0x161)](_0x1a18d2(0x1a1),_0x28b599);try{_0x3e1b45[_0x1a18d2(0x1a4)](this['lockPath']);}catch{}return!![];}}catch{try{_0x3e1b45[_0x1a18d2(0x1a4)](this['lockPath']);}catch{}}return![];},_0x5232ad=()=>{const _0x1dc581=_0x2505fd;try{return _0x438938=_0x3e1b45[_0x1dc581(0xfc)](this[_0x1dc581(0x13c)],'wx'),_0x3e1b45['writeFileSync'](_0x438938,_0x3a7897),!![];}catch(_0xe34107){if(_0xe34107&&_0xe34107[_0x1dc581(0x176)]===_0x1dc581(0x14c))return![];throw _0xe34107;}};if(!_0x5232ad()){_0x2f970e(),_0x5232ad();if(_0x438938==null&&lockTimeoutMs>0x0)while(_0x3a3eb0()-_0x266c93<lockTimeoutMs){await new Promise(_0x5c7740=>setTimeout(_0x5c7740,0x19));if(_0x5232ad())break;_0x2f970e();}}if(_0x438938==null){try{_0x3e1b45[_0x2505fd(0x134)](_0x253c56,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x2505fd(0xfa)};}try{const _0x34ad91=this['readCurrentClock']();if(_0x3487e9<=_0x34ad91){try{_0x3e1b45[_0x2505fd(0x134)](_0x253c56,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x2505fd(0xf8),'currentClock':_0x34ad91};}if(!_0x5f1e2a(_0x2d501e))_0x3e1b45[_0x2505fd(0x16c)](_0x253c56,_0x2d501e);else try{_0x3e1b45[_0x2505fd(0x134)](_0x253c56,{'recursive':!![],'force':!![]});}catch{}return _0x3fc1bd(this['currentPath'],_0x2b07b0+'\x0a'),this[_0x2505fd(0x11a)]({'keep':keep}),{'published':!![],'currentClock':_0x3487e9};}finally{try{_0x3e1b45['closeSync'](_0x438938);}catch{}try{_0x3e1b45['unlinkSync'](this[_0x2505fd(0x13c)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x870146=_0x5daec5;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x5b8a37=require$$0;class _0x17198b{constructor(){const _0x58ef67=_0x2974;this[_0x58ef67(0x13b)]=new Map(),this[_0x58ef67(0x159)]=new Map(),this['nextLabel']=0x0,this[_0x58ef67(0x19b)]=0x0,this['keyToFp']=new Map(),this['hasFingerprints']=!![];}async[_0x870146(0x1b6)](){const _0x34f3bb=_0x870146;this['keyToLabel']=new Map(),this[_0x34f3bb(0x159)]=new Map(),this['keyToFp']=new Map(),this[_0x34f3bb(0x173)]=!![],this['nextLabel']=0x0,this[_0x34f3bb(0x19b)]=0x0;}async[_0x870146(0x151)](_0x2eab52){const _0x274122=_0x870146;if(!_0x2eab52||!_0x5b8a37['existsSync'](_0x2eab52))return await this[_0x274122(0x1b6)](),!![];let _0x45f013;try{_0x45f013=_0x5b8a37[_0x274122(0x14f)](_0x2eab52,_0x274122(0x18a));}catch{return await this[_0x274122(0x1b6)](),!![];}let _0x5c9986;try{_0x5c9986=JSON[_0x274122(0x118)](_0x45f013);}catch{return await this[_0x274122(0x1b6)](),!![];}const _0x38cde7=Array[_0x274122(0x11e)](_0x5c9986?.[_0x274122(0xe7)])?_0x5c9986[_0x274122(0xe7)]:[],_0x35835a=Number[_0x274122(0x18b)](_0x5c9986?.['nextLabel'])?_0x5c9986[_0x274122(0x11f)]:0x0,_0x1b6162=new Map(),_0x341dbc=new Map(),_0x27dbe1=new Map(),_0x5b1f92=_0x5c9986?.[_0x274122(0xe4)]>=0x2;let _0x410bbd=-0x1;for(const _0x2c778c of _0x38cde7){if(!Array[_0x274122(0x11e)](_0x2c778c)||_0x2c778c[_0x274122(0x16b)]<0x2)continue;const _0x29e679=Number(_0x2c778c[0x0]),_0x201d79=String(_0x2c778c[0x1]??'');if(!Number[_0x274122(0x18b)](_0x29e679)||_0x29e679<0x0)continue;if(!_0x201d79)continue;_0x1b6162[_0x274122(0x150)](_0x201d79,_0x29e679),_0x341dbc[_0x274122(0x150)](_0x29e679,_0x201d79);if(_0x5b1f92&&typeof _0x2c778c[0x2]===_0x274122(0xfe))_0x27dbe1[_0x274122(0x150)](_0x201d79,_0x2c778c[0x2]);if(_0x29e679>_0x410bbd)_0x410bbd=_0x29e679;}return this[_0x274122(0x13b)]=_0x1b6162,this['labelToKey']=_0x341dbc,this['keyToFp']=_0x27dbe1,this[_0x274122(0x173)]=_0x5b1f92,this['nextLabel']=Math['max'](_0x35835a,_0x410bbd+0x1,0x0),this[_0x274122(0x19b)]=0x0,!![];}[_0x870146(0xe9)](_0x506461){return this['keyToLabel']['get'](_0x506461);}[_0x870146(0x182)](_0x94a4f9){const _0x2101a=_0x870146;let _0xe0e778=this[_0x2101a(0x13b)]['get'](_0x94a4f9);if(_0xe0e778!==undefined)return _0xe0e778;return _0xe0e778=this[_0x2101a(0x11f)]++,this[_0x2101a(0x13b)][_0x2101a(0x150)](_0x94a4f9,_0xe0e778),this[_0x2101a(0x159)]['set'](_0xe0e778,_0x94a4f9),_0xe0e778;}[_0x870146(0x146)](_0x11d1b0,_0x89324){const _0x376391=_0x870146;if(_0x89324==null)this[_0x376391(0x167)][_0x376391(0xf6)](_0x11d1b0);else this[_0x376391(0x167)][_0x376391(0x150)](_0x11d1b0,_0x89324);}[_0x870146(0x11d)](_0x34b277){const _0x116076=_0x870146;return this[_0x116076(0x167)][_0x116076(0x181)](_0x34b277);}['keys'](){const _0x1c02e1=_0x870146;return this[_0x1c02e1(0x13b)][_0x1c02e1(0x165)]();}[_0x870146(0x113)](_0x47a565){const _0x24b942=_0x870146,_0xb9d924=this['keyToLabel']['get'](_0x47a565);if(_0xb9d924===undefined)return;this[_0x24b942(0x167)][_0x24b942(0xf6)](_0x47a565),this[_0x24b942(0x13b)][_0x24b942(0xf6)](_0x47a565),this['labelToKey'][_0x24b942(0xf6)](_0xb9d924),this['_tombstoneCount']++;}[_0x870146(0x12a)](_0x22973e){const _0x4d6c2f=_0x870146;return this[_0x4d6c2f(0x159)][_0x4d6c2f(0x181)](_0x22973e)??null;}[_0x870146(0xe1)](){const _0x3f8e69=_0x870146;return this['keyToLabel'][_0x3f8e69(0xe1)];}['tombstoneCount'](){const _0x39105d=_0x870146;return this[_0x39105d(0x19b)];}async[_0x870146(0x13a)](_0x1c6774){const _0x43baed=_0x870146,_0x5c15ee=_0x1c6774+_0x43baed(0x14a),_0x195402=[];for(const [_0x39ee40,_0x23f945]of this[_0x43baed(0x159)]['entries']()){const _0x52f191=this[_0x43baed(0x167)][_0x43baed(0x181)](_0x23f945);_0x195402[_0x43baed(0x18e)](_0x52f191==null?[_0x39ee40,_0x23f945]:[_0x39ee40,_0x23f945,_0x52f191]);}_0x195402[_0x43baed(0x13d)]((_0x48f449,_0x532ff4)=>_0x48f449[0x0]-_0x532ff4[0x0]);const _0x50e63c={'version':0x2,'nextLabel':this['nextLabel'],'entries':_0x195402};_0x5b8a37['writeFileSync'](_0x5c15ee,JSON[_0x43baed(0x19f)](_0x50e63c)),_0x5b8a37[_0x43baed(0x16c)](_0x5c15ee,_0x1c6774);}}return labelMap=_0x17198b,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function _0x2974(_0x46cd69,_0x5e75f2){_0x46cd69=_0x46cd69-0xd7;const _0x33aaf8=_0x33aa();let _0x2974fa=_0x33aaf8[_0x46cd69];return _0x2974fa;}function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0x57342e(_0x2caaaf){const _0x4b7ffd=_0x2974,_0xdabd99=new Uint32Array(_0x2caaaf[_0x4b7ffd(0x103)],_0x2caaaf[_0x4b7ffd(0x132)],_0x2caaaf[_0x4b7ffd(0x16b)]);let _0x1b6edb=0x811c9dc5,_0x568fe8=0x9747b28c;for(let _0x5d1d58=0x0;_0x5d1d58<_0xdabd99[_0x4b7ffd(0x16b)];_0x5d1d58++){const _0x50324f=_0xdabd99[_0x5d1d58];_0x1b6edb=Math[_0x4b7ffd(0x124)](_0x1b6edb^_0x50324f,0x1000193)>>>0x0;let _0x21f3a0=Math[_0x4b7ffd(0x124)](_0x50324f,0xcc9e2d51);_0x21f3a0=_0x21f3a0<<0xf|_0x21f3a0>>>0x11,_0x568fe8=Math['imul'](_0x568fe8^Math[_0x4b7ffd(0x124)](_0x21f3a0,0x1b873593),0x5)+0xe6546b64,_0x568fe8>>>=0x0;}return _0x568fe8=Math[_0x4b7ffd(0x124)](_0x568fe8^_0x568fe8>>>0x10,0x85ebca6b)>>>0x0,(_0x1b6edb>>>0x0)*0x100000+(_0x568fe8&0xfffff);}function _0x2d1b11(_0x1ba946,_0x39d02e,_0x2d7877,{upsert:_0x2a2cc9,remove:_0x58b15b}){const _0x2cec0d=_0x2974,_0xadbfc5=new Set();let _0x2c7b7b=0x0,_0x4c8340=0x0,_0x5278f2=0x0;for(const {key:_0x5e94c3,vector:_0x2f8b0a}of _0x39d02e){if(!(_0x2f8b0a instanceof Float32Array)||_0x2f8b0a['length']!==_0x2d7877)continue;_0xadbfc5[_0x2cec0d(0x131)](_0x5e94c3);const _0x53eb38=_0x57342e(_0x2f8b0a),_0x1f6f2b=_0x1ba946[_0x2cec0d(0xe9)](_0x5e94c3)!==undefined;if(_0x1f6f2b&&_0x1ba946[_0x2cec0d(0x11d)](_0x5e94c3)===_0x53eb38)continue;_0x2a2cc9(_0x5e94c3,_0x2f8b0a,_0x53eb38);if(_0x1f6f2b)_0x4c8340++;else _0x2c7b7b++;}for(const _0x9a73dd of[..._0x1ba946[_0x2cec0d(0x165)]()]){if(_0xadbfc5[_0x2cec0d(0x172)](_0x9a73dd))continue;_0x58b15b(_0x9a73dd),_0x5278f2++;}return{'added':_0x2c7b7b,'changed':_0x4c8340,'removed':_0x5278f2};}return indexConvergence={'fingerprint':_0x57342e,'reconcileIndex':_0x2d1b11},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x3baeeb=requireSnapshotStore(),_0x64cb63=requireLabelMap(),{fingerprint:_0xeafc1b,reconcileIndex:_0x13d4fb}=requireIndexConvergence(),_0x283e66=0x1;let _0x389be1=null;function _0x25100a(){const _0x3b283a=_0x2974;if(_0x389be1)return _0x389be1;try{return _0x389be1=require('hnswlib-node'),_0x389be1;}catch(_0x324560){const _0x9a19af=new Error(_0x3b283a(0x12c)+(_0x3b283a(0x170)+process[_0x3b283a(0x17d)][_0x3b283a(0x17a)]+_0x3b283a(0x1b0)+process[_0x3b283a(0x141)]+'/'+process[_0x3b283a(0x18d)]+'.\x20')+_0x3b283a(0x166)+(_0x3b283a(0x153)+(_0x324560?.[_0x3b283a(0x111)]||String(_0x324560))));_0x9a19af['code']='HNSW_BINDINGS_UNAVAILABLE',_0x9a19af[_0x3b283a(0x157)]=_0x324560;throw _0x9a19af;}}return hnsw=function _0x568bb8(_0xea29ff={},{dims:_0x1a01be,dir:_0x2767a0}){const _0x4ef598=_0x2974,_0x16974e=_0x25100a();if(!_0x1a01be||_0x1a01be<=0x0)throw new Error(_0x4ef598(0xdc));if(!_0x2767a0)throw new Error(_0x4ef598(0x174));const _0xbfaf8e={'metric':_0xea29ff[_0x4ef598(0xee)]??'cosine','M':_0xea29ff['M']??0x10,'efConstruction':_0xea29ff[_0x4ef598(0xea)]??0xc8,'efSearch':_0xea29ff[_0x4ef598(0x101)]??0x40,'maxElements':_0xea29ff[_0x4ef598(0x19a)]??0x400,'growFactor':_0xea29ff[_0x4ef598(0x14b)]??0x2,'snapshotEveryChanges':_0xea29ff[_0x4ef598(0xf5)]??0xc350,'keepSnapshots':_0xea29ff[_0x4ef598(0x17c)]??0x2,'tmpMaxAgeMs':_0xea29ff[_0x4ef598(0x129)]??0x6*0x36ee80},_0x3c8c13=new _0x3baeeb({'dir':_0x2767a0,'keepSnapshots':_0xbfaf8e[_0x4ef598(0x17c)]}),_0x49d806=new _0x64cb63();let _0x4c3368=null,_0x8d3554=0x0,_0xc6741d=null,_0x5f5af5=Promise['resolve']();const _0x2a9478=_0x33b643=>{const _0x421960=_0x4ef598,_0x2052a6=_0x5f5af5['then'](_0x33b643);return _0x5f5af5=_0x2052a6[_0x421960(0x186)](()=>{}),_0x2052a6;};async function _0x44c261(_0xfdc232){const _0x341200=_0x4ef598;await _0x49d806[_0x341200(0x1b6)](),_0xfdc232=_0xfdc232??[];const _0x14abd2=Math['max'](_0xbfaf8e[_0x341200(0x19a)],Math['ceil'](_0xfdc232['length']*(_0xbfaf8e[_0x341200(0x14b)]||1.2)),0x1);_0x4c3368=new _0x16974e[(_0x341200(0x187))](_0xbfaf8e[_0x341200(0xee)],_0x1a01be),_0x4c3368[_0x341200(0xda)]({'maxElements':_0x14abd2,'efConstruction':_0xbfaf8e['efConstruction'],'M':_0xbfaf8e['M']});for(const {key:_0x38228c,vector:_0x2b742c}of _0xfdc232){if(!(_0x2b742c instanceof Float32Array)||_0x2b742c['length']!==_0x1a01be)continue;_0x4c6eaa(_0x38228c,_0x2b742c);}_0x4c3368[_0x341200(0x180)](_0xbfaf8e[_0x341200(0x101)]),_0x8d3554=0x0;}async function _0xb120bb(_0x259055){return _0x44c261(_0x259055?await _0x259055():[]);}function _0x4c2435(){const _0x2d2092=_0x4ef598;if(_0x4c3368[_0x2d2092(0x125)]()<_0x4c3368[_0x2d2092(0x168)]())return;const _0x5bd8de=Math[_0x2d2092(0x107)](_0x4c3368[_0x2d2092(0x168)]()*(_0xbfaf8e['growFactor']||0x2));_0x4c3368[_0x2d2092(0xfb)](_0x5bd8de),_0xbfaf8e['maxElements']=_0x5bd8de;}function _0x4c6eaa(_0xba48e0,_0x463eb5,_0x2eedad){const _0x5de62d=_0x4ef598,_0x37ad07=_0x49d806['labelForEphemeral'](_0xba48e0);try{_0x4c3368[_0x5de62d(0x137)](_0x37ad07);}catch{}_0x4c2435(),_0x4c3368[_0x5de62d(0x1a9)](Array[_0x5de62d(0x12b)](_0x463eb5),_0x37ad07),_0x49d806[_0x5de62d(0x146)](_0xba48e0,_0x2eedad??_0xeafc1b(_0x463eb5));}function _0x52816a(_0xcc2671){const _0x5742e6=_0x4ef598,_0xdabe95=_0x49d806[_0x5742e6(0xe9)](_0xcc2671);if(_0xdabe95===undefined)return![];try{_0x4c3368[_0x5742e6(0x137)](_0xdabe95);}catch{}return _0x49d806[_0x5742e6(0x113)](_0xcc2671),!![];}function _0x4a26dd(){const _0x477bd2=_0x4ef598;return Math[_0x477bd2(0x117)](Date[_0x477bd2(0x10c)](),_0x3c8c13[_0x477bd2(0x115)]()+0x1);}async function _0x57fd3f(_0x222af5){const _0xbe2e4d=_0x4ef598;if(!_0x4c3368||!_0x222af5)return![];const _0x5e08ef=await _0x3c8c13[_0xbe2e4d(0x15b)](_0x222af5,async _0x4ea3f2=>{const _0x41ae1d=_0xbe2e4d;_0x4c3368['writeIndexSync'](_0x4ea3f2[_0x41ae1d(0x16f)]),await _0x49d806['snapshotTo'](_0x4ea3f2[_0x41ae1d(0x130)]);const _0x34cb58=require$$0;_0x34cb58[_0x41ae1d(0x1a3)](_0x4ea3f2[_0x41ae1d(0x16e)],JSON['stringify']({'manifestVersion':_0x283e66,'dims':_0x1a01be,'metric':_0xbfaf8e[_0x41ae1d(0xee)],'clock':_0x222af5,'snapshotAt':Date[_0x41ae1d(0x10c)]()},null,0x2));},{'keep':_0xbfaf8e[_0xbe2e4d(0x17c)]});if(_0x5e08ef?.[_0xbe2e4d(0x162)])_0x8d3554=0x0;return _0x5e08ef?.['published']??![];}async function _0x2204ce(){const _0x1875bc=_0x4ef598,_0x52e45c=_0x3c8c13['readCurrentId']()||_0x3c8c13[_0x1875bc(0x156)]();if(!_0x52e45c)return null;let _0x15b925,_0x2fe5=![];return await _0x3c8c13[_0x1875bc(0x13f)](_0x52e45c,async _0x5d9123=>{const _0x17ee7e=_0x1875bc,_0x5ca186=require$$0;_0x15b925=JSON[_0x17ee7e(0x118)](_0x5ca186[_0x17ee7e(0x14f)](_0x5d9123['state'],'utf8'));if(_0x15b925[_0x17ee7e(0xe0)]!==_0x283e66||_0x15b925[_0x17ee7e(0x15e)]!==_0x1a01be||_0x15b925[_0x17ee7e(0xee)]!==_0xbfaf8e['metric']){_0x15b925=null;return;}await _0x49d806[_0x17ee7e(0x151)](_0x5d9123['labels']),_0x4c3368=new _0x16974e[(_0x17ee7e(0x187))](_0xbfaf8e[_0x17ee7e(0xee)],_0x1a01be),_0x4c3368[_0x17ee7e(0x102)](_0x5d9123['index']),_0x4c3368[_0x17ee7e(0x180)](_0xbfaf8e[_0x17ee7e(0x101)]),_0x2fe5=!![];}),_0x2fe5?_0x15b925?.['clock']??0x0:null;}return{async 'load'(_0x33c9c0){return _0x2a9478(async()=>{const _0x4161ad=_0x2974;_0x3c8c13[_0x4161ad(0x11c)]({'maxAgeMs':_0xbfaf8e['tmpMaxAgeMs']}),_0xc6741d=_0x33c9c0??null;const _0x196592=await _0x2204ce(),_0x182872=_0x33c9c0?await _0x33c9c0():null;if(_0x196592!=null){if(_0x182872){if(!_0x49d806[_0x4161ad(0x173)])return await _0x44c261(_0x182872),null;const _0x35c9ad=_0x13d4fb(_0x49d806,_0x182872,_0x1a01be,{'upsert':_0x4c6eaa,'remove':_0x52816a});_0x8d3554+=_0x35c9ad[_0x4161ad(0x1b4)]+_0x35c9ad[_0x4161ad(0x12d)]+_0x35c9ad[_0x4161ad(0x13e)];}return _0x196592;}return await _0x44c261(_0x182872),null;});},async 'add'(_0x922a7e,_0x5bb971,_0x8215ca){return _0x2a9478(async()=>{const _0x23b9b2=_0x2974;if(!_0x4c3368)return;const _0x53031b=_0x5bb971 instanceof Float32Array?_0x5bb971:new Float32Array(_0x5bb971),_0x1734f2=_0xeafc1b(_0x53031b);if(_0x49d806['fingerprintOf'](_0x922a7e)===_0x1734f2)return;_0x4c6eaa(_0x922a7e,_0x53031b,_0x1734f2),_0x8d3554++,_0x8d3554>=_0xbfaf8e[_0x23b9b2(0xf5)]&&await _0x57fd3f(_0x4a26dd());});},async 'remove'(_0x34db06){return _0x2a9478(async()=>{if(!_0x4c3368)return;if(_0x52816a(_0x34db06))_0x8d3554++;});},'search'(_0x48ca68,{limit:limit=0xa,efSearch:_0x33c4cc}={}){const _0x5c0e0f=_0x4ef598;if(!_0x4c3368)return[];if(Number[_0x5c0e0f(0x18b)](_0x33c4cc))_0x4c3368['setEf'](_0x33c4cc);const _0x41c4d7=Math['min'](limit,_0x4c3368[_0x5c0e0f(0x125)]()||0x1),{neighbors:_0xfd7ff0,distances:_0x14f9ae}=_0x4c3368['searchKnn'](Array['from'](_0x48ca68),_0x41c4d7),_0x4f1dcb=[];for(let _0x2bf9b3=0x0;_0x2bf9b3<_0xfd7ff0[_0x5c0e0f(0x16b)];_0x2bf9b3++){const _0xfd8389=_0x49d806[_0x5c0e0f(0x12a)](_0xfd7ff0[_0x2bf9b3]);if(!_0xfd8389)continue;const _0x12e931=_0xbfaf8e['metric']===_0x5c0e0f(0x16a)?Math['max'](0x0,0x1-_0x14f9ae[_0x2bf9b3]):0x1/(0x1+_0x14f9ae[_0x2bf9b3]);_0x4f1dcb['push']({'key':_0xfd8389,'score':_0x12e931});}return _0x4f1dcb;},async 'snapshot'(_0x4d7ef1){return _0x2a9478(()=>_0x57fd3f(_0x4d7ef1??_0x4a26dd()));},async 'rebuild'(_0x530fc8){return _0x2a9478(()=>{if(_0x530fc8!=null)_0xc6741d=_0x530fc8;return _0xb120bb(_0x530fc8??_0xc6741d);});},async 'stop'(){const _0x42cae4=_0x4ef598;return _0x2a9478(()=>_0x8d3554>0x0||!_0x3c8c13[_0x42cae4(0x1ac)]()?_0x57fd3f(_0x4a26dd()):![]);},'count'(){const _0x416471=_0x4ef598;return _0x49d806[_0x416471(0xe1)]();},'info'(){const _0x56f030=_0x4ef598;return{'algorithm':_0x56f030(0x135),'metric':_0xbfaf8e[_0x56f030(0xee)],'M':_0xbfaf8e['M'],'efConstruction':_0xbfaf8e[_0x56f030(0xea)],'efSearch':_0xbfaf8e[_0x56f030(0x101)],'maxElements':_0x4c3368?.[_0x56f030(0x168)]()??_0xbfaf8e[_0x56f030(0x19a)],'count':_0x49d806[_0x56f030(0xe1)](),'changesSince':_0x8d3554,'snapshotDir':_0x2767a0,'latestSnapshot':_0x3c8c13['readCurrentId']()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x2b1f48(_0xb73a0a={}){const _0x39a050=new Map();return{async 'load'(_0x22f62c){const _0x2637c4=_0x2974;_0x39a050[_0x2637c4(0x198)]();if(_0x22f62c)for(const {key:_0x4d48e6,vector:_0x58d532}of await _0x22f62c()){_0x39a050['set'](_0x4d48e6,_0x58d532);}},async 'add'(_0x5c39d3,_0x4847d7,_0x3dfc92){_0x39a050['set'](_0x5c39d3,_0x4847d7);},async 'remove'(_0x4080f5){const _0x5b5542=_0x2974;_0x39a050[_0x5b5542(0xf6)](_0x4080f5);},'search'(_0x48b546,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x55eb9e=_0x2974,_0x2450ab=[];for(const [_0x53517c,_0xdec5d7]of _0x39a050){const _0x19c562=_0x35201a(_0x48b546,_0xdec5d7);if(_0x19c562>=threshold)_0x2450ab['push']({'key':_0x53517c,'score':_0x19c562});}return _0x2450ab[_0x55eb9e(0x13d)]((_0x8874ac,_0x374f25)=>_0x374f25['score']-_0x8874ac[_0x55eb9e(0x100)]),_0x2450ab[_0x55eb9e(0x160)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x2790be){const _0x323eb4=_0x2974;await this[_0x323eb4(0xed)](_0x2790be);},async 'stop'(){},'count'(){return _0x39a050['size'];},'info'(){const _0x4c7a7c=_0x2974;return{'algorithm':_0x4c7a7c(0x1a7),'count':_0x39a050['size']};}};};function _0x35201a(_0x3a6542,_0x3202f1){const _0x21e59d=_0x2974;let _0x29a01f=0x0,_0x4995e0=0x0,_0x5b3d23=0x0;for(let _0x4cd2bd=0x0;_0x4cd2bd<_0x3a6542[_0x21e59d(0x16b)];_0x4cd2bd++){_0x29a01f+=_0x3a6542[_0x4cd2bd]*_0x3202f1[_0x4cd2bd],_0x4995e0+=_0x3a6542[_0x4cd2bd]*_0x3a6542[_0x4cd2bd],_0x5b3d23+=_0x3202f1[_0x4cd2bd]*_0x3202f1[_0x4cd2bd];}const _0x5a854a=Math[_0x21e59d(0x1a6)](_0x4995e0)*Math[_0x21e59d(0x1a6)](_0x5b3d23);return _0x5a854a===0x0?0x0:_0x29a01f/_0x5a854a;}return flat;}var okdbTimers,hasRequiredOkdbTimers;function requireOkdbTimers(){if(hasRequiredOkdbTimers)return okdbTimers;hasRequiredOkdbTimers=0x1;const _0x5bba48=0x2**0x1f-0x1;function _0x163ce2(_0x28bbca){if(!(_0x28bbca>0x0))return 0x0;return _0x28bbca>_0x5bba48?_0x5bba48:_0x28bbca;}function _0x33d3d6(_0x3ca00d){return _0x3ca00d===Infinity;}return okdbTimers={'MAX_TIMER_DELAY':_0x5bba48,'clampTimerDelay':_0x163ce2,'isNeverDelay':_0x33d3d6},okdbTimers;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x26cf4a=require$$0,{clampTimerDelay:_0x51cac1}=requireOkdbTimers(),_0x48c3e7=require$$1,_0x1dcb64=require$$3;return writerLock=function _0x5830c1(_0x485dbf,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x135c9b=_0x2974,_0x3c06c9=_0x48c3e7['join'](_0x485dbf,_0x135c9b(0x128)),_0x5d8e7d=_0x1dcb64[_0x135c9b(0x1b5)](0x8)['toString']('hex');let _0x59d76b=![],_0x19ed1f=null;const _0x13db9e=()=>JSON['stringify']({'pid':process[_0x135c9b(0x185)],'token':_0x5d8e7d,'at':Date[_0x135c9b(0x10c)]()});function _0x328231(){const _0x34143d=_0x135c9b;try{return JSON[_0x34143d(0x118)](_0x26cf4a['readFileSync'](_0x3c06c9,'utf8'));}catch(_0x5011fa){return _0x5011fa?.[_0x34143d(0x176)]===_0x34143d(0x175)?null:{'unreadable':!![]};}}function _0x470119(){const _0x3741e6=_0x135c9b;try{const _0x12bedd=_0x26cf4a['openSync'](_0x3c06c9,'wx');try{_0x26cf4a['writeFileSync'](_0x12bedd,_0x13db9e());}finally{_0x26cf4a[_0x3741e6(0x1af)](_0x12bedd);}return!![];}catch(_0x319e6e){if(_0x319e6e?.['code']===_0x3741e6(0x14c))return![];throw _0x319e6e;}}function _0x5d2cf1(_0x3c2bf8){const _0x4a179b=_0x135c9b;if(!_0x3c2bf8)return!![];if(_0x3c2bf8[_0x4a179b(0xdf)])return!![];return Date[_0x4a179b(0x10c)]()-(_0x3c2bf8['at']??0x0)>=maxAgeMs;}function _0x323664(){if(_0x19ed1f)clearInterval(_0x19ed1f);_0x19ed1f=null;}function _0x296b05(){const _0x4b330d=_0x135c9b;_0x323664(),_0x19ed1f=setInterval(()=>{const _0x560967=_0x2974,_0x5ec179=_0x328231();if(_0x5ec179&&!_0x5ec179[_0x560967(0xdf)]&&_0x5ec179[_0x560967(0x18f)]!==_0x5d8e7d){_0x59d76b=![],_0x323664();try{onLost?.();}catch{}return;}try{_0x26cf4a[_0x560967(0x1a3)](_0x3c06c9,_0x13db9e());}catch{}},_0x51cac1(heartbeatMs)),_0x19ed1f[_0x4b330d(0xdd)]?.();}function _0x340102(){const _0x3bd305=_0x135c9b,_0x5b81ce=_0x328231();return!!_0x5b81ce&&_0x5b81ce[_0x3bd305(0x18f)]===_0x5d8e7d;}return{'path':_0x3c06c9,'token':_0x5d8e7d,'acquire'(){const _0xcedabf=_0x135c9b,_0x14fa82=_0x328231();if(_0x14fa82&&_0x14fa82[_0xcedabf(0x18f)]===_0x5d8e7d){_0x59d76b=!![];if(!_0x19ed1f)_0x296b05();return!![];}let _0x1ddc85=_0x470119();if(!_0x1ddc85&&_0x5d2cf1(_0x328231())){try{_0x26cf4a['unlinkSync'](_0x3c06c9);}catch{}_0x1ddc85=_0x470119();}if(_0x1ddc85&&!_0x340102())_0x1ddc85=![];_0x59d76b=_0x1ddc85;if(_0x1ddc85)_0x296b05();return _0x1ddc85;},'held'(){return _0x59d76b;},'isFree'(){const _0x5ad660=_0x135c9b,_0x449fcf=_0x328231();if(_0x449fcf&&_0x449fcf[_0x5ad660(0x18f)]===_0x5d8e7d)return![];return _0x5d2cf1(_0x449fcf);},'release'(){const _0x46a18a=_0x135c9b;_0x323664();if(!_0x59d76b)return;_0x59d76b=![];if(_0x340102())try{_0x26cf4a[_0x46a18a(0x1a4)](_0x3c06c9);}catch{}}};},writerLock;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x2307a7=require$$0,{clampTimerDelay:_0x20c5ce,isNeverDelay:_0x307751}=requireOkdbTimers(),_0x6baf45=requireSnapshotStore(),_0x3b4c4c=requireLabelMap(),_0x489107=requireWriterLock(),{fingerprint:_0x5ae507,reconcileIndex:_0xe0f2af}=requireIndexConvergence(),_0x44da32=0x1;let _0x38ef80=null;function _0x5f429c(){const _0x3580b1=_0x2974;if(_0x38ef80)return _0x38ef80;try{return _0x38ef80=require(_0x3580b1(0x17b)),_0x38ef80;}catch(_0x5c60c9){const _0x1dbd0c=new Error(_0x3580b1(0x179)+(_0x3580b1(0x170)+process[_0x3580b1(0x17d)][_0x3580b1(0x17a)]+_0x3580b1(0x1b0)+process[_0x3580b1(0x141)]+'/'+process[_0x3580b1(0x18d)]+'.\x20')+_0x3580b1(0x112)+(_0x3580b1(0x153)+(_0x5c60c9?.[_0x3580b1(0x111)]||String(_0x5c60c9))));_0x1dbd0c[_0x3580b1(0x176)]=_0x3580b1(0x1ab),_0x1dbd0c[_0x3580b1(0x157)]=_0x5c60c9;throw _0x1dbd0c;}}function _0x36a102(_0x3a210d,_0x4655c8){const _0x80d02=_0x2974;switch(_0x3a210d){case _0x80d02(0x16a):return _0x4655c8[_0x80d02(0xdb)]['Cos'];case'l2':return _0x4655c8[_0x80d02(0xdb)][_0x80d02(0x10a)];case'ip':return _0x4655c8['MetricKind']['IP'];default:return _0x4655c8[_0x80d02(0xdb)][_0x80d02(0x194)];}}return usearch=function _0x4cfa17(_0x2648bf={},{dims:_0xf45727,dir:_0x37f291,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x11bdc9=_0x2974,_0x13f47e=_0x5f429c();if(!_0xf45727||_0xf45727<=0x0)throw new Error(_0x11bdc9(0x1b2));if(!_0x37f291)throw new Error(_0x11bdc9(0xd7));const _0xbe52d2={'metric':_0x2648bf['metric']??_0x11bdc9(0x16a),'connectivity':_0x2648bf[_0x11bdc9(0x120)]??0x10,'expansionAdd':_0x2648bf[_0x11bdc9(0x127)]??0x80,'expansionSearch':_0x2648bf[_0x11bdc9(0xde)]??0x40,'snapshotEveryChanges':_0x2648bf['snapshotEveryChanges']??0xc350,'snapshotMaxLagMs':_0x2648bf['snapshotMaxLagMs']??0x2710,'keepSnapshots':_0x2648bf[_0x11bdc9(0x17c)]??0x2,'tmpMaxAgeMs':_0x2648bf[_0x11bdc9(0x129)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x2648bf[_0x11bdc9(0x1ad)]??0x1388,'writerLockMaxAgeMs':_0x2648bf[_0x11bdc9(0x126)]??0x3a98,'viewRefreshMs':_0x2648bf[_0x11bdc9(0xe8)]??0x3e8},_0x3db754=new _0x6baf45({'dir':_0x37f291,'keepSnapshots':_0xbe52d2[_0x11bdc9(0x17c)]}),_0x176b82=_0x489107(_0x37f291,{'maxAgeMs':_0xbe52d2['writerLockMaxAgeMs'],'heartbeatMs':_0xbe52d2[_0x11bdc9(0x1ad)],'onLost':()=>{_0x35c03f(_0x15fddf)['catch'](()=>{});}});let _0x4948fc=new _0x3b4c4c(),_0x4236a9=null,_0x4d2619=0x0,_0x104908=null,_0x204056=![],_0x5b6348=![],_0x187935=null,_0x2aac2b=0x0,_0x1cbde3=null,_0x50bf7d=0x0,_0x1e7206=![],_0x346b1a=Promise[_0x11bdc9(0x17e)]();const _0x35c03f=_0x315045=>{const _0x402695=_0x11bdc9,_0x8b8595=_0x346b1a[_0x402695(0x19c)](_0x315045);return _0x346b1a=_0x8b8595[_0x402695(0x186)](()=>{}),_0x8b8595;},_0x27ecef=()=>{try{onChange?.();}catch{}};function _0x201576(){const _0x771b49=_0x11bdc9;return new _0x13f47e[(_0x771b49(0xe3))]({'dimensions':_0xf45727,'metric':_0x36a102(_0xbe52d2['metric'],_0x13f47e),'quantization':_0x13f47e[_0x771b49(0x1aa)]['F32'],'connectivity':_0xbe52d2[_0x771b49(0x120)],'expansion_add':_0xbe52d2[_0x771b49(0x127)],'expansion_search':_0xbe52d2[_0x771b49(0xde)],'multi':![]});}function _0x184e62(_0x576d1c){return _0x576d1c instanceof Float32Array?_0x576d1c:new Float32Array(_0x576d1c);}function _0x441dc2(){const _0x531c31=_0x11bdc9;if(fetchAll)return fetchAll();if(_0x104908)return _0x104908();return Promise[_0x531c31(0x17e)](null);}function _0x23d919(_0x377426,_0x364c8d,_0x46c1b9){const _0x1c7d00=_0x11bdc9,_0x21e1a9=_0x4948fc['labelForExisting'](_0x377426);if(_0x21e1a9!==undefined)try{_0x4236a9[_0x1c7d00(0x19d)](BigInt(_0x21e1a9));}catch{}const _0x56b3f9=_0x4948fc[_0x1c7d00(0x182)](_0x377426);_0x4236a9['add'](BigInt(_0x56b3f9),_0x364c8d),_0x4948fc[_0x1c7d00(0x146)](_0x377426,_0x46c1b9??_0x5ae507(_0x364c8d));}function _0x30ec60(_0x311362){const _0xb37a28=_0x11bdc9,_0x3a654c=_0x4948fc[_0xb37a28(0xe9)](_0x311362);if(_0x3a654c===undefined)return![];try{_0x4236a9[_0xb37a28(0x19d)](BigInt(_0x3a654c));}catch{}return _0x4948fc[_0xb37a28(0x113)](_0x311362),!![];}function _0x34f650(_0x144abd){_0x4948fc=new _0x3b4c4c(),_0x4236a9=_0x201576();for(const {key:_0x2fc7a7,vector:_0x246131}of _0x144abd??[]){if(!(_0x246131 instanceof Float32Array)||_0x246131['length']!==_0xf45727)continue;_0x23d919(_0x2fc7a7,_0x246131);}_0x4d2619=0x0;}function _0x2e3bc6(){const _0x4e863b=_0x11bdc9;return Math[_0x4e863b(0x117)](Date[_0x4e863b(0x10c)](),_0x3db754[_0x4e863b(0x115)]()+0x1);}function _0x37a678(){if(_0x187935)clearTimeout(_0x187935);_0x187935=null;}function _0x33d352(){const _0x6fbdd4=_0x11bdc9;if(!_0xbe52d2['snapshotMaxLagMs']||_0x307751(_0xbe52d2[_0x6fbdd4(0xfd)])||_0x187935||!_0x5b6348||_0x4d2619<=0x0)return;const _0x1004ae=_0x20c5ce(Math[_0x6fbdd4(0x117)](_0xbe52d2[_0x6fbdd4(0xfd)],0xa*_0x2aac2b));_0x187935=setTimeout(()=>{const _0x581b63=_0x6fbdd4;_0x187935=null,_0x35c03f(async()=>{if(_0x5b6348&&_0x4d2619>0x0)await _0x369797();_0x33d352(),_0x27ecef();})[_0x581b63(0x186)](()=>{});},_0x1004ae),_0x187935['unref']?.();}async function _0x369797(_0x53804c){const _0x58cec9=_0x11bdc9;if(!_0x4236a9)return![];const _0x3eb051=_0x53804c??_0x2e3bc6(),_0x807603=Date[_0x58cec9(0x10c)](),_0x2839df=await _0x3db754[_0x58cec9(0x15b)](_0x3eb051,async _0x4acf0d=>{const _0x50eb1e=_0x58cec9;_0x4236a9[_0x50eb1e(0x191)](_0x4acf0d[_0x50eb1e(0x16f)]),await _0x4948fc[_0x50eb1e(0x13a)](_0x4acf0d[_0x50eb1e(0x130)]),_0x2307a7[_0x50eb1e(0x1a3)](_0x4acf0d[_0x50eb1e(0x16e)],JSON[_0x50eb1e(0x19f)]({'manifestVersion':_0x44da32,'algorithm':_0x50eb1e(0x17b),'dims':_0xf45727,'metric':_0xbe52d2['metric'],'clock':_0x3eb051,'snapshotAt':Date[_0x50eb1e(0x10c)]()},null,0x2));},{'keep':_0xbe52d2[_0x58cec9(0x17c)]});return _0x2aac2b=Date['now']()-_0x807603,_0x2839df?.[_0x58cec9(0x162)]&&(_0x4d2619=0x0,_0x37a678()),_0x2839df?.['published']??![];}function _0x5420f7(){const _0x5db545=_0x11bdc9;_0x4d2619++;if(_0x4d2619>=_0xbe52d2[_0x5db545(0xf5)])return _0x369797();return _0x33d352(),null;}async function _0x10552d(){const _0x34ef47=_0x11bdc9,_0x4994b0=_0x3db754[_0x34ef47(0x1ac)]()||_0x3db754['latestSnapshotId']();if(!_0x4994b0)return null;let _0x2869b7,_0x250ffe=![];try{await _0x3db754[_0x34ef47(0x13f)](_0x4994b0,async _0x48d657=>{const _0x316886=_0x34ef47;_0x2869b7=JSON[_0x316886(0x118)](_0x2307a7['readFileSync'](_0x48d657[_0x316886(0x16e)],'utf8'));if(_0x2869b7[_0x316886(0xe0)]!==_0x44da32||_0x2869b7['algorithm']!==_0x316886(0x17b)||_0x2869b7[_0x316886(0x15e)]!==_0xf45727||_0x2869b7['metric']!==_0xbe52d2['metric']){_0x2869b7=null;return;}const _0x3eb038=new _0x3b4c4c();await _0x3eb038[_0x316886(0x151)](_0x48d657[_0x316886(0x130)]);const _0x13e048=_0x201576();_0x13e048[_0x316886(0xed)](_0x48d657[_0x316886(0x16f)]),_0x4948fc=_0x3eb038,_0x4236a9=_0x13e048,_0x250ffe=!![];});}catch{return null;}return _0x250ffe?_0x2869b7?.[_0x34ef47(0x15c)]??0x0:null;}async function _0x152dcb(_0x27d8b6){const _0x5d6bd3=_0x11bdc9;_0x1cbde3=null;const _0x44a540=await _0x10552d();if(_0x44a540!=null){_0x4d2619=0x0;if(_0x27d8b6){if(!_0x4948fc[_0x5d6bd3(0x173)])return _0x34f650(_0x27d8b6),await _0x369797(),null;const _0x18be35=_0xe0f2af(_0x4948fc,_0x27d8b6,_0xf45727,{'upsert':_0x23d919,'remove':_0x30ec60}),_0x3d932d=_0x18be35[_0x5d6bd3(0x1b4)]+_0x18be35[_0x5d6bd3(0x12d)]+_0x18be35[_0x5d6bd3(0x13e)];_0x3d932d>0x0&&(_0x4d2619+=_0x3d932d,await _0x369797());}return _0x44a540;}_0x34f650(_0x27d8b6??[]);if(_0x4236a9[_0x5d6bd3(0xe1)]()>0x0)await _0x369797();return null;}async function _0x12c70d(){_0x5b6348=!![],await _0x152dcb(await _0x441dc2());}async function _0x15fddf(){const _0x1e977d=_0x11bdc9;if(!_0x5b6348)return;_0x5b6348=![],_0x37a678(),_0x4d2619=0x0;const _0xa866dc=_0x3db754[_0x1e977d(0x1ac)]()||_0x3db754[_0x1e977d(0x156)]();await _0x46df83(_0xa866dc),_0x27ecef();}async function _0x46df83(_0x32c393){if(!_0x32c393)return![];let _0x1892f9=![];try{await _0x3db754['loadSnapshot'](_0x32c393,async _0x4afa31=>{const _0x544034=_0x2974,_0x23f9af=JSON[_0x544034(0x118)](_0x2307a7['readFileSync'](_0x4afa31[_0x544034(0x16e)],'utf8'));if(_0x23f9af[_0x544034(0xe0)]!==_0x44da32||_0x23f9af[_0x544034(0xd8)]!==_0x544034(0x17b)||_0x23f9af[_0x544034(0x15e)]!==_0xf45727||_0x23f9af[_0x544034(0xee)]!==_0xbe52d2[_0x544034(0xee)])return;const _0x16d38b=new _0x3b4c4c();await _0x16d38b[_0x544034(0x151)](_0x4afa31[_0x544034(0x130)]);const _0x1b837f=_0x201576();_0x1b837f[_0x544034(0xe5)](_0x4afa31[_0x544034(0x16f)]),_0x4236a9=_0x1b837f,_0x4948fc=_0x16d38b,_0x1cbde3=_0x32c393,_0x1892f9=!![];});}catch{}return _0x1892f9;}function _0x50e3db(){const _0x2e694d=_0x11bdc9,_0x513d37=Date['now']();if(_0x513d37-_0x50bf7d<_0xbe52d2[_0x2e694d(0xe8)])return;_0x50bf7d=_0x513d37;if(_0x1e7206)return;if(_0x176b82['isFree']()){_0x1e7206=!![],_0x35c03f(async()=>{const _0x425333=_0x2e694d;!_0x5b6348&&_0x204056&&_0x176b82[_0x425333(0xff)]()&&(await _0x12c70d(),_0x27ecef());})[_0x2e694d(0x186)](()=>{})[_0x2e694d(0x144)](()=>{_0x1e7206=![];});return;}const _0x298efa=_0x3db754[_0x2e694d(0x1ac)]()||_0x3db754[_0x2e694d(0x156)]();if(!_0x298efa||_0x298efa===_0x1cbde3)return;_0x1e7206=!![],_0x35c03f(async()=>{if(!_0x5b6348&&await _0x46df83(_0x298efa))_0x27ecef();})[_0x2e694d(0x186)](()=>{})['finally'](()=>{_0x1e7206=![];});}return{async 'load'(_0x387c4a){return _0x35c03f(async()=>{const _0x44ec72=_0x2974;_0x3db754[_0x44ec72(0x11c)]({'maxAgeMs':_0xbe52d2['tmpMaxAgeMs']}),_0x104908=_0x387c4a??null,_0x5b6348=_0x176b82[_0x44ec72(0xff)]();let _0x209217=null;if(_0x5b6348)_0x209217=await _0x152dcb(_0x387c4a?await _0x387c4a():null);else{const _0x5683fd=_0x3db754[_0x44ec72(0x1ac)]()||_0x3db754[_0x44ec72(0x156)]();await _0x46df83(_0x5683fd);}return _0x204056=!![],_0x209217;});},async 'add'(_0x4b7f24,_0x3ce23a,_0x44e04a){return _0x35c03f(async()=>{const _0x269f72=_0x2974;if(!_0x204056)return;const _0x2ef6a6=_0x184e62(_0x3ce23a);if(!_0x5b6348){if(!_0x176b82[_0x269f72(0xff)]())return;await _0x12c70d();}if(!_0x4236a9)return;const _0x3b80ab=_0x5ae507(_0x2ef6a6);if(_0x4948fc[_0x269f72(0x11d)](_0x4b7f24)===_0x3b80ab)return;_0x23d919(_0x4b7f24,_0x2ef6a6,_0x3b80ab),await _0x5420f7();});},async 'remove'(_0x3af847){return _0x35c03f(async()=>{const _0x1f87ab=_0x2974;if(!_0x204056)return;if(!_0x5b6348){if(!_0x176b82[_0x1f87ab(0xff)]())return;await _0x12c70d();}if(!_0x4236a9)return;if(_0x30ec60(_0x3af847))await _0x5420f7();});},'search'(_0x37d94a,{limit:limit=0xa}={}){const _0xce69e5=_0x11bdc9;if(!_0x5b6348&&_0x204056)_0x50e3db();if(!_0x4236a9)return[];const _0x2c0ba9=_0x4236a9[_0xce69e5(0xe1)]();if(_0x2c0ba9===0x0)return[];const _0x4fa9ce=Math[_0xce69e5(0x142)](limit,_0x2c0ba9),_0x410935=_0x4236a9[_0xce69e5(0x14d)](_0x184e62(_0x37d94a),_0x4fa9ce,0x0),_0x4199f9=[],_0x1a5c15=_0x410935['keys'],_0x5c44ae=_0x410935[_0xce69e5(0x12e)];for(let _0x257804=0x0;_0x257804<_0x1a5c15[_0xce69e5(0x16b)];_0x257804++){const _0x34b1e0=_0x1a5c15[_0x257804];if(_0x34b1e0===0xffffffffffffffffn)continue;const _0x31e7ee=Number(_0x34b1e0),_0x312ca2=_0x4948fc[_0xce69e5(0x12a)](_0x31e7ee);if(!_0x312ca2)continue;const _0x23088=_0x5c44ae[_0x257804];let _0x542150;if(_0xbe52d2[_0xce69e5(0xee)]===_0xce69e5(0x16a))_0x542150=Math[_0xce69e5(0x117)](0x0,0x1-_0x23088);else{if(_0xbe52d2[_0xce69e5(0xee)]==='ip')_0x542150=-_0x23088;else _0x542150=0x1/(0x1+_0x23088);}_0x4199f9[_0xce69e5(0x18e)]({'key':_0x312ca2,'score':_0x542150});}return _0x4199f9;},async 'snapshot'(_0x4a4073){return _0x35c03f(()=>_0x5b6348?_0x369797(_0x4a4073??undefined):![]);},async 'rebuild'(_0x5a0fc6){return _0x35c03f(async()=>{const _0x3d0f65=_0x2974;if(_0x5a0fc6!=null)_0x104908=_0x5a0fc6;if(!_0x5b6348){if(!_0x176b82[_0x3d0f65(0xff)]())return;_0x5b6348=!![];}const _0x470570=_0x5a0fc6?await _0x5a0fc6():await _0x441dc2();_0x34f650(_0x470570??[]),_0x204056=!![],await _0x369797();});},async 'stop'(){return _0x35c03f(async()=>{const _0x2e448b=_0x2974;_0x37a678();if(_0x5b6348){if(_0x4d2619>0x0||!_0x3db754[_0x2e448b(0x1ac)]())await _0x369797();_0x176b82['release']();}_0x5b6348=![],_0x204056=![];});},'count'(){return _0x4948fc['size']();},'info'(){const _0x488c87=_0x11bdc9;return{'algorithm':_0x488c87(0x17b),'role':_0x5b6348?_0x488c87(0x1a8):_0x488c87(0xf4),'metric':_0xbe52d2[_0x488c87(0xee)],'connectivity':_0xbe52d2[_0x488c87(0x120)],'expansionAdd':_0xbe52d2[_0x488c87(0x127)],'expansionSearch':_0xbe52d2['expansionSearch'],'snapshotEveryChanges':_0xbe52d2[_0x488c87(0xf5)],'snapshotMaxLagMs':_0xbe52d2[_0x488c87(0xfd)],'count':_0x4948fc[_0x488c87(0xe1)](),'size':_0x4236a9?.[_0x488c87(0xe1)]?.()??0x0,'capacity':_0x4236a9?.[_0x488c87(0x14e)]?.()??0x0,'changesSince':_0x5b6348?_0x4d2619:null,'viewedSnapshot':_0x1cbde3??null,'snapshotDir':_0x37f291,'latestSnapshot':_0x3db754[_0x488c87(0x1ac)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x3a3454=_0x5daec5;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x246e07,workerData:_0x5d1bad}=require$$0$1,{algorithmName:_0x326060,algorithmConfig:_0x2999df,dims:_0x22f5c3,dir:_0x119514}=_0x5d1bad;let _0x4864f8=0x1;const _0x430432=new Map();function _0x5e630b(){const _0x13626e=_0x4864f8++;return new Promise((_0x4c452f,_0x47231a)=>{const _0x35dc78=_0x2974;_0x430432[_0x35dc78(0x150)](_0x13626e,{'resolve':_0x4c452f,'reject':_0x47231a}),_0x246e07[_0x35dc78(0x196)]({'op':_0x35dc78(0x143),'fid':_0x13626e});});}const _0x50ded3={'dims':_0x22f5c3,'dir':_0x119514,'fetchAll':_0x5e630b,'onChange':()=>_0xeaa247()};let _0x28ab8c;if(_0x326060===_0x3a3454(0x135))_0x28ab8c=requireHnsw()(_0x2999df,_0x50ded3);else{if(_0x326060==='flat')_0x28ab8c=requireFlat()(_0x2999df,_0x50ded3);else{if(_0x326060==='usearch')_0x28ab8c=requireUsearch()(_0x2999df,_0x50ded3);else throw new Error(_0x3a3454(0x1a2)+_0x326060+'\x22');}}function _0xeaa247(){const _0xab292a=_0x3a3454;try{_0x246e07['postMessage']({'op':_0xab292a(0xec),'count':_0x28ab8c[_0xab292a(0x10b)](),'info':_0x28ab8c[_0xab292a(0x114)](),'memory':process[_0xab292a(0x122)]()});}catch{}}function _0x4776f3(_0x51ab9c){const _0x397261=_0x3a3454;return(_0x51ab9c||[])['map'](_0x3f67c9=>({'key':_0x3f67c9[_0x397261(0x17f)],'vector':_0x3f67c9['vector']instanceof Float32Array?_0x3f67c9[_0x397261(0x171)]:new Float32Array(_0x3f67c9['vector'])}));}return _0x246e07['on']('message',async _0x281007=>{const _0x4d697d=_0x3a3454;if(_0x281007['op']===_0x4d697d(0x164)){const _0x217bba=_0x430432[_0x4d697d(0x181)](_0x281007['fid']);if(!_0x217bba)return;_0x430432[_0x4d697d(0xf6)](_0x281007[_0x4d697d(0x10f)]);if(_0x281007['error'])_0x217bba['reject'](new Error(_0x281007[_0x4d697d(0x184)]));else _0x217bba[_0x4d697d(0x17e)](_0x4776f3(_0x281007[_0x4d697d(0x169)]));return;}const {id:_0x799321,op:_0x8e5f1e,args:_0x2c65b9}=_0x281007;try{let _0x42aabd;switch(_0x8e5f1e){case _0x4d697d(0xed):{_0x42aabd=await _0x28ab8c[_0x4d697d(0xed)](_0x2c65b9['hasRows']?_0x5e630b:null),_0xeaa247();break;}case _0x4d697d(0x131):{const _0x191032=_0x2c65b9[_0x4d697d(0x171)]instanceof Float32Array?_0x2c65b9[_0x4d697d(0x171)]:new Float32Array(_0x2c65b9[_0x4d697d(0x171)]);await _0x28ab8c[_0x4d697d(0x131)](_0x2c65b9[_0x4d697d(0x17f)],_0x191032,_0x2c65b9[_0x4d697d(0x15c)]??undefined),_0xeaa247(),_0x42aabd=null;break;}case'remove':{await _0x28ab8c[_0x4d697d(0x19d)](_0x2c65b9[_0x4d697d(0x17f)]),_0xeaa247(),_0x42aabd=null;break;}case _0x4d697d(0x14d):{const _0x4ee84a=_0x2c65b9[_0x4d697d(0x123)]instanceof Float32Array?_0x2c65b9[_0x4d697d(0x123)]:new Float32Array(_0x2c65b9['queryVec']);_0x42aabd=_0x28ab8c[_0x4d697d(0x14d)](_0x4ee84a,_0x2c65b9[_0x4d697d(0x158)]||{});break;}case _0x4d697d(0x119):{_0x42aabd=await _0x28ab8c[_0x4d697d(0x119)](_0x2c65b9[_0x4d697d(0x15c)]),_0xeaa247();break;}case _0x4d697d(0xf0):{const _0x2983f0=_0x4776f3(_0x2c65b9[_0x4d697d(0x169)]);await _0x28ab8c[_0x4d697d(0xf0)](async()=>_0x2983f0),_0xeaa247(),_0x42aabd=null;break;}case _0x4d697d(0x19e):{await _0x28ab8c['stop'](),_0xeaa247(),_0x42aabd=null;break;}case _0x4d697d(0x10b):{_0x42aabd=_0x28ab8c[_0x4d697d(0x10b)]();break;}case _0x4d697d(0x114):{_0x42aabd=_0x28ab8c[_0x4d697d(0x114)]();break;}default:throw new Error(_0x4d697d(0x145)+_0x8e5f1e+'\x22');}_0x246e07[_0x4d697d(0x196)]({'id':_0x799321,'result':_0x42aabd});}catch(_0x19ddc6){_0x246e07['postMessage']({'id':_0x799321,'error':{'message':_0x19ddc6?.[_0x4d697d(0x111)]||String(_0x19ddc6),'code':_0x19ddc6?.['code']}});}}),_0x246e07[_0x3a3454(0x196)]({'op':_0x3a3454(0x116)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x5daec5(0x110)]=algorithmWorkerThread;
|