@kedem/okdb 2.6.3 → 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 +57 -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,63 @@ 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
|
+
|
|
51
|
+
## [2.6.4] - 2026-10-08
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- **Closed instances are no longer kept alive (~1.3 MB leaked per open/close cycle).** `close()` left the
|
|
56
|
+
env's auto-compact interval running; its closure pinned the `OKDBEnv`, the `OKDB` and the lmdb handles
|
|
57
|
+
for the life of the process (only `removeEnvironment` stopped it). Harmless for a process that opens one
|
|
58
|
+
store, but suites that open hundreds of stores per process exhausted the V8 heap. Heap now plateaus
|
|
59
|
+
across open/close cycles.
|
|
60
|
+
- The embeddings indexer and pipeline materializer handlers are registered at module scope, so the
|
|
61
|
+
process-global handler registry no longer pins the most recent driver (and its OKDB instance) after
|
|
62
|
+
close; each driver also drops its runtime table once its last engine stops.
|
|
63
|
+
|
|
7
64
|
## [2.6.3] - 2026-10-05
|
|
8
65
|
|
|
9
66
|
### Fixed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x18db61=_0x1e38;(function(_0x1a8057,_0x308a39){const _0xea8d94=_0x1e38,_0x371aa3=_0x1a8057();while(!![]){try{const _0x37f2ff=-parseInt(_0xea8d94(0x12b))/0x1+-parseInt(_0xea8d94(0xe2))/0x2*(-parseInt(_0xea8d94(0x14a))/0x3)+parseInt(_0xea8d94(0xf1))/0x4*(parseInt(_0xea8d94(0x13c))/0x5)+parseInt(_0xea8d94(0x10f))/0x6*(-parseInt(_0xea8d94(0x158))/0x7)+-parseInt(_0xea8d94(0xe4))/0x8*(parseInt(_0xea8d94(0xd2))/0x9)+-parseInt(_0xea8d94(0xb2))/0xa*(-parseInt(_0xea8d94(0xb9))/0xb)+parseInt(_0xea8d94(0x159))/0xc*(parseInt(_0xea8d94(0x139))/0xd);if(_0x37f2ff===_0x308a39)break;else _0x371aa3['push'](_0x371aa3['shift']());}catch(_0xada633){_0x371aa3['push'](_0x371aa3['shift']());}}}(_0x4daa,0xa4470));var require$$0$1=require(_0x18db61(0x143)),require$$0=require('fs'),require$$1=require(_0x18db61(0xd4)),require$$2=require('os'),require$$3=require(_0x18db61(0x15e));function getDefaultExportFromCjs(_0x4d5bb7){const _0x452c28=_0x18db61;return _0x4d5bb7&&_0x4d5bb7[_0x452c28(0xf3)]&&Object[_0x452c28(0x123)][_0x452c28(0xe3)][_0x452c28(0xcc)](_0x4d5bb7,_0x452c28(0xa5))?_0x4d5bb7[_0x452c28(0xa5)]:_0x4d5bb7;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x192b3d=_0x18db61;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x514a34=require$$0,_0x36e0f4=require$$1,_0x446247=require$$2,_0x1601d2=require$$3;function _0x25c05c(){const _0x4a277b=_0x1e38;return Date[_0x4a277b(0x10b)]();}function _0x279250(_0xf757bf){try{return _0x514a34['existsSync'](_0xf757bf);}catch{return![];}}function _0x27e296(_0xb81a36){const _0x14b34e=_0x1e38;try{return _0x514a34['readFileSync'](_0xb81a36,_0x14b34e(0x13a));}catch{return null;}}function _0x3ce218(_0x136680,_0x321574){const _0x28b0aa=_0x1e38,_0x2e77db=_0x136680+_0x28b0aa(0xa9)+_0x1601d2[_0x28b0aa(0x162)](0x6)[_0x28b0aa(0x117)](_0x28b0aa(0x145));_0x514a34[_0x28b0aa(0x11d)](_0x2e77db,_0x321574),_0x514a34[_0x28b0aa(0xed)](_0x2e77db,_0x136680);}function _0x5a94d2(_0x4c019d,_0x13c5e2=0x10){const _0x144e40=_0x1e38,_0x4dd092=String(Math[_0x144e40(0xc7)](0x0,Math[_0x144e40(0x10e)](_0x4c019d||0x0)));return _0x4dd092[_0x144e40(0x121)]>=_0x13c5e2?_0x4dd092:'0'[_0x144e40(0xd9)](_0x13c5e2-_0x4dd092[_0x144e40(0x121)])+_0x4dd092;}return snapshotStore=class _0x3c0891{constructor({dir:_0x29fa3d,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x10cdf9=_0x1e38;if(!_0x29fa3d)throw new Error(_0x10cdf9(0x127));this[_0x10cdf9(0x13d)]=_0x29fa3d,this[_0x10cdf9(0x155)]=_0x36e0f4[_0x10cdf9(0x172)](_0x29fa3d,_0x10cdf9(0xcf)),this[_0x10cdf9(0xe1)]=_0x36e0f4[_0x10cdf9(0x172)](_0x29fa3d,_0x10cdf9(0xe5)),this['lockPath']=_0x36e0f4['join'](_0x29fa3d,_0x10cdf9(0x9f)),this['keepSnapshots']=keepSnapshots,this['log']=log,_0x514a34[_0x10cdf9(0xb6)](this['dir'],{'recursive':!![]}),_0x514a34[_0x10cdf9(0xb6)](this['snapshotsDir'],{'recursive':!![]});}[_0x192b3d(0xa4)](_0x25528e){const _0x3aa4af=_0x192b3d;return _0x36e0f4[_0x3aa4af(0x172)](this['snapshotsDir'],_0x25528e);}[_0x192b3d(0xd5)](_0x1bb7cb){const _0x5a9e40=_0x192b3d,_0x47ffd8=this['_snapshotDir'](_0x1bb7cb);return{'dir':_0x47ffd8,'index':_0x36e0f4[_0x5a9e40(0x172)](_0x47ffd8,_0x5a9e40(0x114)),'labels':_0x36e0f4[_0x5a9e40(0x172)](_0x47ffd8,_0x5a9e40(0x132)),'state':_0x36e0f4[_0x5a9e40(0x172)](_0x47ffd8,'state.json')};}[_0x192b3d(0x9d)](){const _0x2b6e26=_0x192b3d;if(!_0x279250(this[_0x2b6e26(0xe1)]))return null;const _0x14277c=_0x27e296(this[_0x2b6e26(0xe1)]);if(!_0x14277c)return null;const _0x77c017=String(_0x14277c)[_0x2b6e26(0x149)]();return _0x77c017||null;}['readCurrentClock'](){const _0x38b620=_0x192b3d,_0xdc9bd5=this[_0x38b620(0x9d)]();if(!_0xdc9bd5)return 0x0;const _0x3db22a=Number(_0xdc9bd5);return Number[_0x38b620(0x14b)](_0x3db22a)?_0x3db22a:0x0;}[_0x192b3d(0x11a)](){const _0x5bd942=_0x192b3d;try{return _0x514a34[_0x5bd942(0xe0)](this[_0x5bd942(0x155)],{'withFileTypes':!![]})['filter'](_0x2f6a5d=>_0x2f6a5d[_0x5bd942(0xc5)]())['map'](_0x7de54=>_0x7de54[_0x5bd942(0x9a)])[_0x5bd942(0x174)](_0x5d89ba=>!_0x5d89ba[_0x5bd942(0x141)](_0x5bd942(0xa9)))['filter'](_0x5e5b73=>!_0x5e5b73[_0x5bd942(0x141)]('_tmp-'))[_0x5bd942(0x133)]();}catch{return[];}}[_0x192b3d(0x160)](){const _0x26e94e=_0x192b3d,_0xab98a6=this[_0x26e94e(0x9d)]();if(_0xab98a6)return _0xab98a6;const _0x150488=this[_0x26e94e(0x11a)]();if(!_0x150488[_0x26e94e(0x121)])return null;return _0x150488[_0x150488['length']-0x1];}[_0x192b3d(0xca)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x4e0eea=_0x192b3d;let _0x18380e;try{_0x18380e=_0x514a34[_0x4e0eea(0xe0)](this[_0x4e0eea(0x155)],{'withFileTypes':!![]});}catch{return;}const _0x40d9c1=_0x25c05c()-maxAgeMs;for(const _0xa0787c of _0x18380e){if(!_0xa0787c['isDirectory']())continue;const _0x48161d=_0xa0787c[_0x4e0eea(0x9a)];if(!_0x48161d[_0x4e0eea(0x141)](_0x4e0eea(0xa9))&&!_0x48161d[_0x4e0eea(0x141)](_0x4e0eea(0x154)))continue;const _0x2310df=_0x36e0f4[_0x4e0eea(0x172)](this[_0x4e0eea(0x155)],_0x48161d);try{const _0x167df4=_0x514a34['statSync'](_0x2310df);if(_0x167df4['mtimeMs']>_0x40d9c1)continue;}catch{}try{_0x514a34[_0x4e0eea(0x102)](_0x2310df,{'recursive':!![],'force':!![]});}catch{}}}[_0x192b3d(0xea)]({keep:keep=null}={}){const _0x5558d7=_0x192b3d,_0x4ca821=Math[_0x5558d7(0xc7)](0x1,Math[_0x5558d7(0x10e)](keep??this[_0x5558d7(0xa0)]??0x3)),_0x3fa659=this[_0x5558d7(0x11a)]();if(_0x3fa659[_0x5558d7(0x121)]<=_0x4ca821)return;const _0x274452=this[_0x5558d7(0x9d)](),_0x2725be=_0x3fa659[_0x5558d7(0xb3)](0x0,Math[_0x5558d7(0xc7)](0x0,_0x3fa659[_0x5558d7(0x121)]-_0x4ca821));for(const _0x5ed8bc of _0x2725be){if(_0x274452&&_0x5ed8bc===_0x274452)continue;const _0x562946=this[_0x5558d7(0xa4)](_0x5ed8bc);try{_0x514a34[_0x5558d7(0x102)](_0x562946,{'recursive':!![],'force':!![]});}catch{}}}async['loadSnapshot'](_0x31de52,_0x133b14){const _0x5436d9=_0x192b3d;if(!_0x31de52)throw new Error(_0x5436d9(0x105));const _0x233949=this[_0x5436d9(0xd5)](_0x31de52);if(!_0x279250(_0x233949[_0x5436d9(0xde)])||!_0x279250(_0x233949[_0x5436d9(0x113)])||!_0x279250(_0x233949[_0x5436d9(0x134)]))throw new Error(_0x5436d9(0x165)+_0x31de52);const _0x1e2b0b=await _0x133b14(_0x233949);return _0x1e2b0b||{};}async['publishSnapshot'](_0x5d6ff9,_0x29a2af,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x351e43=_0x192b3d,_0x1ee913=Number(_0x5d6ff9);if(!Number[_0x351e43(0x14b)](_0x1ee913)||_0x1ee913<0x0)throw new Error('candidateClock\x20must\x20be\x20finite\x20>=\x200');const _0x406610=_0x5a94d2(_0x1ee913),_0x3174ca=this['_snapshotDir'](_0x406610),_0x325ef7=_0x36e0f4[_0x351e43(0x172)](this[_0x351e43(0x155)],_0x351e43(0xa9)+_0x406610+'-'+_0x1601d2['randomBytes'](0x6)[_0x351e43(0x117)](_0x351e43(0x145)));_0x514a34[_0x351e43(0xb6)](_0x325ef7,{'recursive':!![]});const _0x4625e4={'dir':_0x325ef7,'index':_0x36e0f4[_0x351e43(0x172)](_0x325ef7,_0x351e43(0x114)),'labels':_0x36e0f4[_0x351e43(0x172)](_0x325ef7,'labels.json'),'state':_0x36e0f4[_0x351e43(0x172)](_0x325ef7,'state.json')};await _0x29a2af(_0x4625e4,{'id':_0x406610,'clock':_0x1ee913});const _0x2e5d1f=JSON[_0x351e43(0x130)]({'pid':process['pid'],'host':_0x446247[_0x351e43(0x131)](),'at':_0x25c05c()}),_0x1e1caa=_0x25c05c();let _0x57455e=null;const _0x191627=()=>{const _0x57ae69=_0x351e43;try{const _0x31d436=JSON[_0x57ae69(0xa1)](_0x514a34['readFileSync'](this[_0x57ae69(0xb5)],_0x57ae69(0x13a)));if(_0x31d436['at']&&_0x25c05c()-_0x31d436['at']>staleLockMaxAgeMs){const _0x106a2b=_0x25c05c()-_0x31d436['at'],_0x18e24f='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x57ae69(0x156)](_0x106a2b/0x3e8)+'s,\x20pid:\x20'+_0x31d436[_0x57ae69(0xcd)]+_0x57ae69(0x170)+_0x31d436['host']+_0x57ae69(0x112)+_0x57ae69(0xec);this[_0x57ae69(0x118)]?.['warn']?this[_0x57ae69(0x118)][_0x57ae69(0x13e)](_0x18e24f):console[_0x57ae69(0x13e)](_0x57ae69(0x11f),_0x18e24f);try{_0x514a34[_0x57ae69(0xf0)](this[_0x57ae69(0xb5)]);}catch{}return!![];}}catch{try{_0x514a34['unlinkSync'](this['lockPath']);}catch{}}return![];},_0x138556=()=>{const _0x56d9b=_0x351e43;try{return _0x57455e=_0x514a34[_0x56d9b(0x15b)](this[_0x56d9b(0xb5)],'wx'),_0x514a34[_0x56d9b(0x11d)](_0x57455e,_0x2e5d1f),!![];}catch(_0x3a5017){if(_0x3a5017&&_0x3a5017[_0x56d9b(0xef)]===_0x56d9b(0x169))return![];throw _0x3a5017;}};if(!_0x138556()){_0x191627(),_0x138556();if(_0x57455e==null&&lockTimeoutMs>0x0)while(_0x25c05c()-_0x1e1caa<lockTimeoutMs){await new Promise(_0x3d0b1e=>setTimeout(_0x3d0b1e,0x19));if(_0x138556())break;_0x191627();}}if(_0x57455e==null){try{_0x514a34[_0x351e43(0x102)](_0x325ef7,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0xe23f15=this[_0x351e43(0x99)]();if(_0x1ee913<=_0xe23f15){try{_0x514a34[_0x351e43(0x102)](_0x325ef7,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x351e43(0xc6),'currentClock':_0xe23f15};}if(!_0x279250(_0x3174ca))_0x514a34[_0x351e43(0xed)](_0x325ef7,_0x3174ca);else try{_0x514a34[_0x351e43(0x102)](_0x325ef7,{'recursive':!![],'force':!![]});}catch{}return _0x3ce218(this[_0x351e43(0xe1)],_0x406610+'\x0a'),this[_0x351e43(0xea)]({'keep':keep}),{'published':!![],'currentClock':_0x1ee913};}finally{try{_0x514a34[_0x351e43(0x166)](_0x57455e);}catch{}try{_0x514a34[_0x351e43(0xf0)](this[_0x351e43(0xb5)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x5ee822=_0x18db61;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x2c1707=require$$0;class _0x592cde{constructor(){const _0x2d54ba=_0x1e38;this[_0x2d54ba(0x10a)]=new Map(),this[_0x2d54ba(0xaa)]=new Map(),this['nextLabel']=0x0,this[_0x2d54ba(0x13b)]=0x0,this['keyToFp']=new Map(),this[_0x2d54ba(0xe7)]=!![];}async[_0x5ee822(0x171)](){const _0x58b081=_0x5ee822;this['keyToLabel']=new Map(),this['labelToKey']=new Map(),this[_0x58b081(0xe6)]=new Map(),this['hasFingerprints']=!![],this['nextLabel']=0x0,this[_0x58b081(0x13b)]=0x0;}async[_0x5ee822(0x11b)](_0x241e21){const _0x5e1b67=_0x5ee822;if(!_0x241e21||!_0x2c1707[_0x5e1b67(0xc2)](_0x241e21))return await this[_0x5e1b67(0x171)](),!![];let _0x51adb5;try{_0x51adb5=_0x2c1707['readFileSync'](_0x241e21,'utf8');}catch{return await this[_0x5e1b67(0x171)](),!![];}let _0x23bfca;try{_0x23bfca=JSON[_0x5e1b67(0xa1)](_0x51adb5);}catch{return await this[_0x5e1b67(0x171)](),!![];}const _0x5f2663=Array['isArray'](_0x23bfca?.[_0x5e1b67(0x116)])?_0x23bfca[_0x5e1b67(0x116)]:[],_0x3a086f=Number['isInteger'](_0x23bfca?.['nextLabel'])?_0x23bfca[_0x5e1b67(0x157)]:0x0,_0x2153ae=new Map(),_0x4d48e9=new Map(),_0x533fcf=new Map(),_0x164382=_0x23bfca?.[_0x5e1b67(0x11e)]>=0x2;let _0x42cd6a=-0x1;for(const _0x4aaa8f of _0x5f2663){if(!Array[_0x5e1b67(0x126)](_0x4aaa8f)||_0x4aaa8f['length']<0x2)continue;const _0x1bf828=Number(_0x4aaa8f[0x0]),_0x1c4905=String(_0x4aaa8f[0x1]??'');if(!Number[_0x5e1b67(0x173)](_0x1bf828)||_0x1bf828<0x0)continue;if(!_0x1c4905)continue;_0x2153ae[_0x5e1b67(0x9c)](_0x1c4905,_0x1bf828),_0x4d48e9[_0x5e1b67(0x9c)](_0x1bf828,_0x1c4905);if(_0x164382&&typeof _0x4aaa8f[0x2]===_0x5e1b67(0x110))_0x533fcf['set'](_0x1c4905,_0x4aaa8f[0x2]);if(_0x1bf828>_0x42cd6a)_0x42cd6a=_0x1bf828;}return this[_0x5e1b67(0x10a)]=_0x2153ae,this[_0x5e1b67(0xaa)]=_0x4d48e9,this[_0x5e1b67(0xe6)]=_0x533fcf,this[_0x5e1b67(0xe7)]=_0x164382,this['nextLabel']=Math[_0x5e1b67(0xc7)](_0x3a086f,_0x42cd6a+0x1,0x0),this[_0x5e1b67(0x13b)]=0x0,!![];}[_0x5ee822(0xc1)](_0x2d4028){const _0x3253bd=_0x5ee822;return this[_0x3253bd(0x10a)][_0x3253bd(0xb4)](_0x2d4028);}['labelForEphemeral'](_0x56af0a){const _0x1df393=_0x5ee822;let _0x1d7090=this[_0x1df393(0x10a)][_0x1df393(0xb4)](_0x56af0a);if(_0x1d7090!==undefined)return _0x1d7090;return _0x1d7090=this[_0x1df393(0x157)]++,this[_0x1df393(0x10a)][_0x1df393(0x9c)](_0x56af0a,_0x1d7090),this[_0x1df393(0xaa)][_0x1df393(0x9c)](_0x1d7090,_0x56af0a),_0x1d7090;}[_0x5ee822(0xdd)](_0x5a2698,_0x3d802b){const _0x5b268f=_0x5ee822;if(_0x3d802b==null)this[_0x5b268f(0xe6)][_0x5b268f(0x16f)](_0x5a2698);else this[_0x5b268f(0xe6)]['set'](_0x5a2698,_0x3d802b);}[_0x5ee822(0xae)](_0x2195d2){const _0x1d8741=_0x5ee822;return this['keyToFp'][_0x1d8741(0xb4)](_0x2195d2);}['keys'](){const _0x58ac55=_0x5ee822;return this['keyToLabel'][_0x58ac55(0x175)]();}[_0x5ee822(0xd1)](_0x448abc){const _0x2a5914=_0x5ee822,_0x3167f9=this[_0x2a5914(0x10a)][_0x2a5914(0xb4)](_0x448abc);if(_0x3167f9===undefined)return;this[_0x2a5914(0xe6)][_0x2a5914(0x16f)](_0x448abc),this[_0x2a5914(0x10a)]['delete'](_0x448abc),this[_0x2a5914(0xaa)][_0x2a5914(0x16f)](_0x3167f9),this[_0x2a5914(0x13b)]++;}[_0x5ee822(0xc4)](_0x39399a){const _0x27a861=_0x5ee822;return this[_0x27a861(0xaa)][_0x27a861(0xb4)](_0x39399a)??null;}[_0x5ee822(0x137)](){const _0x5b2bd9=_0x5ee822;return this[_0x5b2bd9(0x10a)][_0x5b2bd9(0x137)];}[_0x5ee822(0xab)](){const _0xd988b9=_0x5ee822;return this[_0xd988b9(0x13b)];}async[_0x5ee822(0x140)](_0x3e3882){const _0x49db39=_0x5ee822,_0xa192af=_0x3e3882+_0x49db39(0x153),_0xfd3348=[];for(const [_0x4cae70,_0x50b28]of this['labelToKey'][_0x49db39(0x116)]()){const _0x19f6a7=this[_0x49db39(0xe6)]['get'](_0x50b28);_0xfd3348[_0x49db39(0x11c)](_0x19f6a7==null?[_0x4cae70,_0x50b28]:[_0x4cae70,_0x50b28,_0x19f6a7]);}_0xfd3348[_0x49db39(0x133)]((_0x2ef849,_0x357715)=>_0x2ef849[0x0]-_0x357715[0x0]);const _0x1cbe31={'version':0x2,'nextLabel':this[_0x49db39(0x157)],'entries':_0xfd3348};_0x2c1707['writeFileSync'](_0xa192af,JSON[_0x49db39(0x130)](_0x1cbe31)),_0x2c1707[_0x49db39(0xed)](_0xa192af,_0x3e3882);}}return labelMap=_0x592cde,labelMap;}var indexConvergence,hasRequiredIndexConvergence;function requireIndexConvergence(){if(hasRequiredIndexConvergence)return indexConvergence;hasRequiredIndexConvergence=0x1;function _0xb27dea(_0x16afd3){const _0x9bde6c=_0x1e38,_0x2440d9=new Uint32Array(_0x16afd3[_0x9bde6c(0xd6)],_0x16afd3['byteOffset'],_0x16afd3[_0x9bde6c(0x121)]);let _0x438500=0x811c9dc5,_0x309ca9=0x9747b28c;for(let _0x21f670=0x0;_0x21f670<_0x2440d9[_0x9bde6c(0x121)];_0x21f670++){const _0x3abc00=_0x2440d9[_0x21f670];_0x438500=Math[_0x9bde6c(0xa6)](_0x438500^_0x3abc00,0x1000193)>>>0x0;let _0x4d0efa=Math[_0x9bde6c(0xa6)](_0x3abc00,0xcc9e2d51);_0x4d0efa=_0x4d0efa<<0xf|_0x4d0efa>>>0x11,_0x309ca9=Math['imul'](_0x309ca9^Math[_0x9bde6c(0xa6)](_0x4d0efa,0x1b873593),0x5)+0xe6546b64,_0x309ca9>>>=0x0;}return _0x309ca9=Math[_0x9bde6c(0xa6)](_0x309ca9^_0x309ca9>>>0x10,0x85ebca6b)>>>0x0,(_0x438500>>>0x0)*0x100000+(_0x309ca9&0xfffff);}function _0x3b9d04(_0x59eccc,_0x126ddc,_0x5986ef,{upsert:_0x37bba4,remove:_0x1ef4a6}){const _0xe01557=_0x1e38,_0x47d774=new Set();let _0x1b8d68=0x0,_0x2388df=0x0,_0x381a72=0x0;for(const {key:_0x35e042,vector:_0x27e1fc}of _0x126ddc){if(!(_0x27e1fc instanceof Float32Array)||_0x27e1fc['length']!==_0x5986ef)continue;_0x47d774[_0xe01557(0xff)](_0x35e042);const _0x3ee2a0=_0xb27dea(_0x27e1fc),_0x1d25b3=_0x59eccc[_0xe01557(0xc1)](_0x35e042)!==undefined;if(_0x1d25b3&&_0x59eccc[_0xe01557(0xae)](_0x35e042)===_0x3ee2a0)continue;_0x37bba4(_0x35e042,_0x27e1fc,_0x3ee2a0);if(_0x1d25b3)_0x2388df++;else _0x1b8d68++;}for(const _0x463f78 of[..._0x59eccc['keys']()]){if(_0x47d774[_0xe01557(0xf4)](_0x463f78))continue;_0x1ef4a6(_0x463f78),_0x381a72++;}return{'added':_0x1b8d68,'changed':_0x2388df,'removed':_0x381a72};}return indexConvergence={'fingerprint':_0xb27dea,'reconcileIndex':_0x3b9d04},indexConvergence;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x24a674=requireSnapshotStore(),_0xabc913=requireLabelMap(),{fingerprint:_0x137a6b,reconcileIndex:_0xa9e126}=requireIndexConvergence(),_0x355181=0x1;let _0x29084b=null;function _0x35d719(){const _0x3cdb04=_0x1e38;if(_0x29084b)return _0x29084b;try{return _0x29084b=require(_0x3cdb04(0x14c)),_0x29084b;}catch(_0xd9898e){const _0x2fb91b=new Error(_0x3cdb04(0xfa)+(_0x3cdb04(0xb8)+process[_0x3cdb04(0x147)][_0x3cdb04(0x150)]+_0x3cdb04(0xb0)+process[_0x3cdb04(0xf6)]+'/'+process[_0x3cdb04(0x12c)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20'+('Original\x20error:\x20'+(_0xd9898e?.[_0x3cdb04(0x129)]||String(_0xd9898e))));_0x2fb91b[_0x3cdb04(0xef)]=_0x3cdb04(0xe9),_0x2fb91b[_0x3cdb04(0xc3)]=_0xd9898e;throw _0x2fb91b;}}return hnsw=function _0x4dbd9e(_0x28d1ff={},{dims:_0x28cfba,dir:_0x2d1ba6}){const _0x4c545f=_0x1e38,_0x1c8fba=_0x35d719();if(!_0x28cfba||_0x28cfba<=0x0)throw new Error(_0x4c545f(0x12f));if(!_0x2d1ba6)throw new Error(_0x4c545f(0x125));const _0xcf12c0={'metric':_0x28d1ff[_0x4c545f(0x16a)]??_0x4c545f(0x104),'M':_0x28d1ff['M']??0x10,'efConstruction':_0x28d1ff[_0x4c545f(0x10d)]??0xc8,'efSearch':_0x28d1ff['efSearch']??0x40,'maxElements':_0x28d1ff[_0x4c545f(0xbf)]??0x400,'growFactor':_0x28d1ff['growFactor']??0x2,'snapshotEveryChanges':_0x28d1ff[_0x4c545f(0x12e)]??0xc350,'keepSnapshots':_0x28d1ff[_0x4c545f(0xa0)]??0x2,'tmpMaxAgeMs':_0x28d1ff[_0x4c545f(0x120)]??0x6*0x36ee80},_0x495cf3=new _0x24a674({'dir':_0x2d1ba6,'keepSnapshots':_0xcf12c0['keepSnapshots']}),_0xc0fdad=new _0xabc913();let _0x30543e=null,_0x5557c2=0x0,_0x3c1874=null,_0x481a30=Promise[_0x4c545f(0xfb)]();const _0x16df8a=_0x33ed50=>{const _0x2ca4a3=_0x4c545f,_0x599241=_0x481a30[_0x2ca4a3(0xd8)](_0x33ed50);return _0x481a30=_0x599241[_0x2ca4a3(0xf5)](()=>{}),_0x599241;};async function _0x4d8089(_0x323cfe){const _0x1d9570=_0x4c545f;await _0xc0fdad[_0x1d9570(0x171)](),_0x323cfe=_0x323cfe??[];const _0x14662d=Math[_0x1d9570(0xc7)](_0xcf12c0[_0x1d9570(0xbf)],Math[_0x1d9570(0x14f)](_0x323cfe[_0x1d9570(0x121)]*(_0xcf12c0[_0x1d9570(0xbd)]||1.2)),0x1);_0x30543e=new _0x1c8fba['HierarchicalNSW'](_0xcf12c0['metric'],_0x28cfba),_0x30543e[_0x1d9570(0x122)]({'maxElements':_0x14662d,'efConstruction':_0xcf12c0[_0x1d9570(0x10d)],'M':_0xcf12c0['M']});for(const {key:_0x43a585,vector:_0xd0433e}of _0x323cfe){if(!(_0xd0433e instanceof Float32Array)||_0xd0433e[_0x1d9570(0x121)]!==_0x28cfba)continue;_0x34c86c(_0x43a585,_0xd0433e);}_0x30543e['setEf'](_0xcf12c0[_0x1d9570(0x12d)]),_0x5557c2=0x0;}async function _0x10e221(_0x5764d7){return _0x4d8089(_0x5764d7?await _0x5764d7():[]);}function _0x1da5fa(){const _0x2cf5e5=_0x4c545f;if(_0x30543e[_0x2cf5e5(0xa2)]()<_0x30543e[_0x2cf5e5(0xb1)]())return;const _0x47dd25=Math[_0x2cf5e5(0x14f)](_0x30543e[_0x2cf5e5(0xb1)]()*(_0xcf12c0[_0x2cf5e5(0xbd)]||0x2));_0x30543e[_0x2cf5e5(0x16d)](_0x47dd25),_0xcf12c0[_0x2cf5e5(0xbf)]=_0x47dd25;}function _0x34c86c(_0x3fc2e7,_0x51c47e,_0x49ba6e){const _0x21e318=_0x4c545f,_0x325c7d=_0xc0fdad[_0x21e318(0xad)](_0x3fc2e7);try{_0x30543e[_0x21e318(0x124)](_0x325c7d);}catch{}_0x1da5fa(),_0x30543e[_0x21e318(0x176)](Array[_0x21e318(0xee)](_0x51c47e),_0x325c7d),_0xc0fdad['setFingerprint'](_0x3fc2e7,_0x49ba6e??_0x137a6b(_0x51c47e));}function _0x137ac1(_0x1d5674){const _0x2c8361=_0x4c545f,_0x1a6070=_0xc0fdad[_0x2c8361(0xc1)](_0x1d5674);if(_0x1a6070===undefined)return![];try{_0x30543e[_0x2c8361(0x124)](_0x1a6070);}catch{}return _0xc0fdad[_0x2c8361(0xd1)](_0x1d5674),!![];}function _0x9add03(){const _0x19b7f6=_0x4c545f;return Math['max'](Date['now'](),_0x495cf3[_0x19b7f6(0x99)]()+0x1);}async function _0x10641b(_0x4b2621){const _0x572fcf=_0x4c545f;if(!_0x30543e||!_0x4b2621)return![];const _0x36443c=await _0x495cf3[_0x572fcf(0xbc)](_0x4b2621,async _0x3cb805=>{const _0x4a5dff=_0x572fcf;_0x30543e[_0x4a5dff(0x148)](_0x3cb805['index']),await _0xc0fdad[_0x4a5dff(0x140)](_0x3cb805[_0x4a5dff(0x113)]);const _0x421d6e=require$$0;_0x421d6e['writeFileSync'](_0x3cb805[_0x4a5dff(0x134)],JSON[_0x4a5dff(0x130)]({'manifestVersion':_0x355181,'dims':_0x28cfba,'metric':_0xcf12c0['metric'],'clock':_0x4b2621,'snapshotAt':Date[_0x4a5dff(0x10b)]()},null,0x2));},{'keep':_0xcf12c0[_0x572fcf(0xa0)]});if(_0x36443c?.[_0x572fcf(0x16e)])_0x5557c2=0x0;return _0x36443c?.[_0x572fcf(0x16e)]??![];}async function _0x1c9e67(){const _0x259efa=_0x4c545f,_0x4439b8=_0x495cf3[_0x259efa(0x9d)]()||_0x495cf3[_0x259efa(0x160)]();if(!_0x4439b8)return null;let _0x1d862b,_0x748e7d=![];return await _0x495cf3['loadSnapshot'](_0x4439b8,async _0x49371a=>{const _0x9f87a4=_0x259efa,_0x3ad731=require$$0;_0x1d862b=JSON[_0x9f87a4(0xa1)](_0x3ad731[_0x9f87a4(0x163)](_0x49371a[_0x9f87a4(0x134)],'utf8'));if(_0x1d862b['manifestVersion']!==_0x355181||_0x1d862b[_0x9f87a4(0x136)]!==_0x28cfba||_0x1d862b[_0x9f87a4(0x16a)]!==_0xcf12c0['metric']){_0x1d862b=null;return;}await _0xc0fdad[_0x9f87a4(0x11b)](_0x49371a[_0x9f87a4(0x113)]),_0x30543e=new _0x1c8fba[(_0x9f87a4(0x12a))](_0xcf12c0[_0x9f87a4(0x16a)],_0x28cfba),_0x30543e[_0x9f87a4(0xfe)](_0x49371a[_0x9f87a4(0xde)]),_0x30543e['setEf'](_0xcf12c0[_0x9f87a4(0x12d)]),_0x748e7d=!![];}),_0x748e7d?_0x1d862b?.[_0x259efa(0x144)]??0x0:null;}return{async 'load'(_0x57f3b7){return _0x16df8a(async()=>{const _0x1c98ff=_0x1e38;_0x495cf3[_0x1c98ff(0xca)]({'maxAgeMs':_0xcf12c0[_0x1c98ff(0x120)]}),_0x3c1874=_0x57f3b7??null;const _0x7541c7=await _0x1c9e67(),_0x5bd9fb=_0x57f3b7?await _0x57f3b7():null;if(_0x7541c7!=null){if(_0x5bd9fb){if(!_0xc0fdad['hasFingerprints'])return await _0x4d8089(_0x5bd9fb),null;const _0x303ef7=_0xa9e126(_0xc0fdad,_0x5bd9fb,_0x28cfba,{'upsert':_0x34c86c,'remove':_0x137ac1});_0x5557c2+=_0x303ef7[_0x1c98ff(0xa3)]+_0x303ef7[_0x1c98ff(0x16c)]+_0x303ef7['removed'];}return _0x7541c7;}return await _0x4d8089(_0x5bd9fb),null;});},async 'add'(_0x155b81,_0x4d7a12,_0x39c7c8){return _0x16df8a(async()=>{const _0x345799=_0x1e38;if(!_0x30543e)return;const _0x2dd74a=_0x4d7a12 instanceof Float32Array?_0x4d7a12:new Float32Array(_0x4d7a12),_0x487795=_0x137a6b(_0x2dd74a);if(_0xc0fdad[_0x345799(0xae)](_0x155b81)===_0x487795)return;_0x34c86c(_0x155b81,_0x2dd74a,_0x487795),_0x5557c2++,_0x5557c2>=_0xcf12c0[_0x345799(0x12e)]&&await _0x10641b(_0x9add03());});},async 'remove'(_0xfb0248){return _0x16df8a(async()=>{if(!_0x30543e)return;if(_0x137ac1(_0xfb0248))_0x5557c2++;});},'search'(_0x464fdb,{limit:limit=0xa,efSearch:_0x4766b5}={}){const _0x4fd7cf=_0x4c545f;if(!_0x30543e)return[];if(Number[_0x4fd7cf(0x173)](_0x4766b5))_0x30543e[_0x4fd7cf(0xa8)](_0x4766b5);const _0x41ddfa=Math[_0x4fd7cf(0xcb)](limit,_0x30543e[_0x4fd7cf(0xa2)]()||0x1),{neighbors:_0x5841cd,distances:_0x3824b9}=_0x30543e[_0x4fd7cf(0x9e)](Array[_0x4fd7cf(0xee)](_0x464fdb),_0x41ddfa),_0x1da4f1=[];for(let _0x31176f=0x0;_0x31176f<_0x5841cd['length'];_0x31176f++){const _0x894e41=_0xc0fdad['keyForLabel'](_0x5841cd[_0x31176f]);if(!_0x894e41)continue;const _0x18712b=_0xcf12c0[_0x4fd7cf(0x16a)]==='cosine'?Math['max'](0x0,0x1-_0x3824b9[_0x31176f]):0x1/(0x1+_0x3824b9[_0x31176f]);_0x1da4f1['push']({'key':_0x894e41,'score':_0x18712b});}return _0x1da4f1;},async 'snapshot'(_0x210028){return _0x16df8a(()=>_0x10641b(_0x210028??_0x9add03()));},async 'rebuild'(_0x5e229a){return _0x16df8a(()=>{if(_0x5e229a!=null)_0x3c1874=_0x5e229a;return _0x10e221(_0x5e229a??_0x3c1874);});},async 'stop'(){const _0x599f26=_0x4c545f;return _0x16df8a(()=>_0x5557c2>0x0||!_0x495cf3[_0x599f26(0x9d)]()?_0x10641b(_0x9add03()):![]);},'count'(){const _0x30fd38=_0x4c545f;return _0xc0fdad[_0x30fd38(0x137)]();},'info'(){const _0x9c299e=_0x4c545f;return{'algorithm':_0x9c299e(0xdb),'metric':_0xcf12c0[_0x9c299e(0x16a)],'M':_0xcf12c0['M'],'efConstruction':_0xcf12c0[_0x9c299e(0x10d)],'efSearch':_0xcf12c0[_0x9c299e(0x12d)],'maxElements':_0x30543e?.[_0x9c299e(0xb1)]()??_0xcf12c0[_0x9c299e(0xbf)],'count':_0xc0fdad[_0x9c299e(0x137)](),'changesSince':_0x5557c2,'snapshotDir':_0x2d1ba6,'latestSnapshot':_0x495cf3[_0x9c299e(0x9d)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x56a51a(_0x2eec9c={}){const _0x54560a=new Map();return{async 'load'(_0x35d89c){const _0x50422d=_0x1e38;_0x54560a[_0x50422d(0x111)]();if(_0x35d89c)for(const {key:_0x4d6e43,vector:_0x2cc25f}of await _0x35d89c()){_0x54560a[_0x50422d(0x9c)](_0x4d6e43,_0x2cc25f);}},async 'add'(_0x4d8a07,_0x390e7a,_0x15d7c2){_0x54560a['set'](_0x4d8a07,_0x390e7a);},async 'remove'(_0x566193){const _0x5905d2=_0x1e38;_0x54560a[_0x5905d2(0x16f)](_0x566193);},'search'(_0x9fea1d,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x2b48b8=_0x1e38,_0x3e4081=[];for(const [_0x5e703d,_0x285c4f]of _0x54560a){const _0x4a6e9c=_0x3b1d32(_0x9fea1d,_0x285c4f);if(_0x4a6e9c>=threshold)_0x3e4081[_0x2b48b8(0x11c)]({'key':_0x5e703d,'score':_0x4a6e9c});}return _0x3e4081[_0x2b48b8(0x133)]((_0x4bc353,_0x2a7adb)=>_0x2a7adb[_0x2b48b8(0x151)]-_0x4bc353[_0x2b48b8(0x151)]),_0x3e4081[_0x2b48b8(0xb3)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x2aac43){const _0x59ac26=_0x1e38;await this[_0x59ac26(0x108)](_0x2aac43);},async 'stop'(){},'count'(){const _0x568dfe=_0x1e38;return _0x54560a[_0x568dfe(0x137)];},'info'(){const _0x259e8c=_0x1e38;return{'algorithm':'flat','count':_0x54560a[_0x259e8c(0x137)]};}};};function _0x3b1d32(_0x3b517f,_0x1ff2af){const _0x42782c=_0x1e38;let _0x3d948f=0x0,_0x5e86b3=0x0,_0x33cdbe=0x0;for(let _0x52bb22=0x0;_0x52bb22<_0x3b517f[_0x42782c(0x121)];_0x52bb22++){_0x3d948f+=_0x3b517f[_0x52bb22]*_0x1ff2af[_0x52bb22],_0x5e86b3+=_0x3b517f[_0x52bb22]*_0x3b517f[_0x52bb22],_0x33cdbe+=_0x1ff2af[_0x52bb22]*_0x1ff2af[_0x52bb22];}const _0x52d4b8=Math[_0x42782c(0xbe)](_0x5e86b3)*Math['sqrt'](_0x33cdbe);return _0x52d4b8===0x0?0x0:_0x3d948f/_0x52d4b8;}return flat;}var okdbTimers,hasRequiredOkdbTimers;function requireOkdbTimers(){if(hasRequiredOkdbTimers)return okdbTimers;hasRequiredOkdbTimers=0x1;const _0x19f103=0x2**0x1f-0x1;function _0x42a704(_0x524036){if(!(_0x524036>0x0))return 0x0;return _0x524036>_0x19f103?_0x19f103:_0x524036;}function _0x43aeed(_0x3079aa){return _0x3079aa===Infinity;}return okdbTimers={'MAX_TIMER_DELAY':_0x19f103,'clampTimerDelay':_0x42a704,'isNeverDelay':_0x43aeed},okdbTimers;}var writerLock,hasRequiredWriterLock;function requireWriterLock(){if(hasRequiredWriterLock)return writerLock;hasRequiredWriterLock=0x1;const _0x591aa0=require$$0,{clampTimerDelay:_0x3e8571}=requireOkdbTimers(),_0x2bf96e=require$$1,_0x10de31=require$$3;return writerLock=function _0x345a9a(_0x1f849f,{maxAgeMs:maxAgeMs=0x3a98,heartbeatMs:heartbeatMs=0x1388,onLost:onLost=null}={}){const _0x27698f=_0x1e38,_0x1ff64e=_0x2bf96e['join'](_0x1f849f,_0x27698f(0x15c)),_0x5ca9e8=_0x10de31['randomBytes'](0x8)['toString'](_0x27698f(0x145));let _0x45f56e=![],_0x594e4e=null;const _0x539edd=()=>JSON[_0x27698f(0x130)]({'pid':process[_0x27698f(0xcd)],'token':_0x5ca9e8,'at':Date[_0x27698f(0x10b)]()});function _0x404a08(){const _0x3a1f1e=_0x27698f;try{return JSON[_0x3a1f1e(0xa1)](_0x591aa0[_0x3a1f1e(0x163)](_0x1ff64e,_0x3a1f1e(0x13a)));}catch(_0x292cb0){return _0x292cb0?.['code']===_0x3a1f1e(0x14e)?null:{'unreadable':!![]};}}function _0x421e1e(){const _0x289fe9=_0x27698f;try{const _0x2b721e=_0x591aa0[_0x289fe9(0x15b)](_0x1ff64e,'wx');try{_0x591aa0['writeFileSync'](_0x2b721e,_0x539edd());}finally{_0x591aa0[_0x289fe9(0x166)](_0x2b721e);}return!![];}catch(_0x53c398){if(_0x53c398?.[_0x289fe9(0xef)]===_0x289fe9(0x169))return![];throw _0x53c398;}}function _0x127cb9(_0x509d0d){const _0x2ad95e=_0x27698f;if(!_0x509d0d)return!![];if(_0x509d0d[_0x2ad95e(0xf2)])return!![];return Date[_0x2ad95e(0x10b)]()-(_0x509d0d['at']??0x0)>=maxAgeMs;}function _0x4ee362(){if(_0x594e4e)clearInterval(_0x594e4e);_0x594e4e=null;}function _0xfdc046(){const _0x39f300=_0x27698f;_0x4ee362(),_0x594e4e=setInterval(()=>{const _0x7eaa97=_0x1e38,_0x20ef93=_0x404a08();if(_0x20ef93&&!_0x20ef93['unreadable']&&_0x20ef93[_0x7eaa97(0xf8)]!==_0x5ca9e8){_0x45f56e=![],_0x4ee362();try{onLost?.();}catch{}return;}try{_0x591aa0[_0x7eaa97(0x11d)](_0x1ff64e,_0x539edd());}catch{}},_0x3e8571(heartbeatMs)),_0x594e4e[_0x39f300(0x109)]?.();}function _0x5048b(){const _0x457066=_0x27698f,_0x409860=_0x404a08();return!!_0x409860&&_0x409860[_0x457066(0xf8)]===_0x5ca9e8;}return{'path':_0x1ff64e,'token':_0x5ca9e8,'acquire'(){const _0x112b68=_0x27698f,_0x46c962=_0x404a08();if(_0x46c962&&_0x46c962[_0x112b68(0xf8)]===_0x5ca9e8){_0x45f56e=!![];if(!_0x594e4e)_0xfdc046();return!![];}let _0x55facb=_0x421e1e();if(!_0x55facb&&_0x127cb9(_0x404a08())){try{_0x591aa0[_0x112b68(0xf0)](_0x1ff64e);}catch{}_0x55facb=_0x421e1e();}if(_0x55facb&&!_0x5048b())_0x55facb=![];_0x45f56e=_0x55facb;if(_0x55facb)_0xfdc046();return _0x55facb;},'held'(){return _0x45f56e;},'isFree'(){const _0x52ee00=_0x27698f,_0x1295e1=_0x404a08();if(_0x1295e1&&_0x1295e1[_0x52ee00(0xf8)]===_0x5ca9e8)return![];return _0x127cb9(_0x1295e1);},'release'(){const _0xd497a7=_0x27698f;_0x4ee362();if(!_0x45f56e)return;_0x45f56e=![];if(_0x5048b())try{_0x591aa0[_0xd497a7(0xf0)](_0x1ff64e);}catch{}}};},writerLock;}function _0x1e38(_0x42a571,_0x44425c){_0x42a571=_0x42a571-0x99;const _0x4daa31=_0x4daa();let _0x1e3820=_0x4daa31[_0x42a571];return _0x1e3820;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x217ae6=require$$0,{clampTimerDelay:_0x1e2bc9,isNeverDelay:_0x45fe0a}=requireOkdbTimers(),_0x5e842a=requireSnapshotStore(),_0x49fb05=requireLabelMap(),_0x2df6b0=requireWriterLock(),{fingerprint:_0x45d94b,reconcileIndex:_0x3ce3bd}=requireIndexConvergence(),_0x42f4ac=0x1;let _0xdf996c=null;function _0x44249e(){const _0x372225=_0x1e38;if(_0xdf996c)return _0xdf996c;try{return _0xdf996c=require(_0x372225(0xdc)),_0xdf996c;}catch(_0x4534b7){const _0x215392=new Error('usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20'+(_0x372225(0xb8)+process[_0x372225(0x147)][_0x372225(0x150)]+_0x372225(0xb0)+process[_0x372225(0xf6)]+'/'+process[_0x372225(0x12c)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20'+('Original\x20error:\x20'+(_0x4534b7?.[_0x372225(0x129)]||String(_0x4534b7))));_0x215392[_0x372225(0xef)]='USEARCH_BINDINGS_UNAVAILABLE',_0x215392[_0x372225(0xc3)]=_0x4534b7;throw _0x215392;}}function _0x167220(_0x3d4cf3,_0x44ed48){const _0x17a9a8=_0x1e38;switch(_0x3d4cf3){case _0x17a9a8(0x104):return _0x44ed48[_0x17a9a8(0x103)]['Cos'];case'l2':return _0x44ed48[_0x17a9a8(0x103)][_0x17a9a8(0xd3)];case'ip':return _0x44ed48[_0x17a9a8(0x103)]['IP'];default:return _0x44ed48[_0x17a9a8(0x103)][_0x17a9a8(0xce)];}}return usearch=function _0x519a5d(_0x8af0eb={},{dims:_0x2d0833,dir:_0xc3ca4d,fetchAll:fetchAll=null,onChange:onChange=null}={}){const _0x4edda9=_0x1e38,_0x27b49a=_0x44249e();if(!_0x2d0833||_0x2d0833<=0x0)throw new Error('usearch\x20algorithm\x20requires\x20dims\x20>\x200');if(!_0xc3ca4d)throw new Error(_0x4edda9(0x15a));const _0x436e81={'metric':_0x8af0eb[_0x4edda9(0x16a)]??'cosine','connectivity':_0x8af0eb[_0x4edda9(0x164)]??0x10,'expansionAdd':_0x8af0eb['expansionAdd']??0x80,'expansionSearch':_0x8af0eb[_0x4edda9(0xdf)]??0x40,'snapshotEveryChanges':_0x8af0eb[_0x4edda9(0x12e)]??0xc350,'snapshotMaxLagMs':_0x8af0eb['snapshotMaxLagMs']??0x2710,'keepSnapshots':_0x8af0eb['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x8af0eb[_0x4edda9(0x120)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x8af0eb['heartbeatIntervalMs']??0x1388,'writerLockMaxAgeMs':_0x8af0eb[_0x4edda9(0x128)]??0x3a98,'viewRefreshMs':_0x8af0eb[_0x4edda9(0xac)]??0x3e8},_0x1b49f8=new _0x5e842a({'dir':_0xc3ca4d,'keepSnapshots':_0x436e81[_0x4edda9(0xa0)]}),_0xa908fe=_0x2df6b0(_0xc3ca4d,{'maxAgeMs':_0x436e81[_0x4edda9(0x128)],'heartbeatMs':_0x436e81[_0x4edda9(0x107)],'onLost':()=>{_0x73ce08(_0x5f8907)['catch'](()=>{});}});let _0x35635a=new _0x49fb05(),_0x4a61b3=null,_0x48fee5=0x0,_0x56ac12=null,_0x4faed5=![],_0x4fd519=![],_0x56c632=null,_0x556999=0x0,_0x1f606=null,_0x2daa1d=0x0,_0x5560d2=![],_0x127fde=Promise['resolve']();const _0x73ce08=_0x5c4052=>{const _0x157bd7=_0x4edda9,_0x18903c=_0x127fde['then'](_0x5c4052);return _0x127fde=_0x18903c[_0x157bd7(0xf5)](()=>{}),_0x18903c;},_0x5978b1=()=>{try{onChange?.();}catch{}};function _0x3cd64a(){const _0x2853d3=_0x4edda9;return new _0x27b49a[(_0x2853d3(0xe8))]({'dimensions':_0x2d0833,'metric':_0x167220(_0x436e81[_0x2853d3(0x16a)],_0x27b49a),'quantization':_0x27b49a['ScalarKind'][_0x2853d3(0xaf)],'connectivity':_0x436e81[_0x2853d3(0x164)],'expansion_add':_0x436e81[_0x2853d3(0xc8)],'expansion_search':_0x436e81[_0x2853d3(0xdf)],'multi':![]});}function _0x10cae9(_0x16297b){return _0x16297b instanceof Float32Array?_0x16297b:new Float32Array(_0x16297b);}function _0x3e6b46(){const _0x3af020=_0x4edda9;if(fetchAll)return fetchAll();if(_0x56ac12)return _0x56ac12();return Promise[_0x3af020(0xfb)](null);}function _0x553b46(_0x25d977,_0x300d5c,_0x29e144){const _0x7b4eef=_0x4edda9,_0x4ca831=_0x35635a['labelForExisting'](_0x25d977);if(_0x4ca831!==undefined)try{_0x4a61b3[_0x7b4eef(0xda)](BigInt(_0x4ca831));}catch{}const _0x18363d=_0x35635a[_0x7b4eef(0xad)](_0x25d977);_0x4a61b3['add'](BigInt(_0x18363d),_0x300d5c),_0x35635a[_0x7b4eef(0xdd)](_0x25d977,_0x29e144??_0x45d94b(_0x300d5c));}function _0x5e43c0(_0x5c64af){const _0x3c223b=_0x4edda9,_0x2d8b7a=_0x35635a[_0x3c223b(0xc1)](_0x5c64af);if(_0x2d8b7a===undefined)return![];try{_0x4a61b3['remove'](BigInt(_0x2d8b7a));}catch{}return _0x35635a['tombstone'](_0x5c64af),!![];}function _0x130b07(_0x3c2fe7){const _0x45a6e0=_0x4edda9;_0x35635a=new _0x49fb05(),_0x4a61b3=_0x3cd64a();for(const {key:_0x50ec18,vector:_0x110bc2}of _0x3c2fe7??[]){if(!(_0x110bc2 instanceof Float32Array)||_0x110bc2[_0x45a6e0(0x121)]!==_0x2d0833)continue;_0x553b46(_0x50ec18,_0x110bc2);}_0x48fee5=0x0;}function _0x2a1c38(){const _0x22744c=_0x4edda9;return Math[_0x22744c(0xc7)](Date[_0x22744c(0x10b)](),_0x1b49f8[_0x22744c(0x99)]()+0x1);}function _0x4811d8(){if(_0x56c632)clearTimeout(_0x56c632);_0x56c632=null;}function _0x287086(){const _0x59708e=_0x4edda9;if(!_0x436e81[_0x59708e(0x10c)]||_0x45fe0a(_0x436e81['snapshotMaxLagMs'])||_0x56c632||!_0x4fd519||_0x48fee5<=0x0)return;const _0x3b682d=_0x1e2bc9(Math[_0x59708e(0xc7)](_0x436e81[_0x59708e(0x10c)],0xa*_0x556999));_0x56c632=setTimeout(()=>{const _0x28d1e3=_0x59708e;_0x56c632=null,_0x73ce08(async()=>{if(_0x4fd519&&_0x48fee5>0x0)await _0x3bfc37();_0x287086(),_0x5978b1();})[_0x28d1e3(0xf5)](()=>{});},_0x3b682d),_0x56c632[_0x59708e(0x109)]?.();}async function _0x3bfc37(_0x4f820e){const _0x5c2ea3=_0x4edda9;if(!_0x4a61b3)return![];const _0x3b7c4b=_0x4f820e??_0x2a1c38(),_0x2ae992=Date['now'](),_0x5c8fa3=await _0x1b49f8[_0x5c2ea3(0xbc)](_0x3b7c4b,async _0x4922b3=>{const _0x4e196e=_0x5c2ea3;_0x4a61b3[_0x4e196e(0x168)](_0x4922b3[_0x4e196e(0xde)]),await _0x35635a['snapshotTo'](_0x4922b3[_0x4e196e(0x113)]),_0x217ae6['writeFileSync'](_0x4922b3[_0x4e196e(0x134)],JSON[_0x4e196e(0x130)]({'manifestVersion':_0x42f4ac,'algorithm':_0x4e196e(0xdc),'dims':_0x2d0833,'metric':_0x436e81[_0x4e196e(0x16a)],'clock':_0x3b7c4b,'snapshotAt':Date[_0x4e196e(0x10b)]()},null,0x2));},{'keep':_0x436e81[_0x5c2ea3(0xa0)]});return _0x556999=Date['now']()-_0x2ae992,_0x5c8fa3?.[_0x5c2ea3(0x16e)]&&(_0x48fee5=0x0,_0x4811d8()),_0x5c8fa3?.[_0x5c2ea3(0x16e)]??![];}function _0x16feb5(){_0x48fee5++;if(_0x48fee5>=_0x436e81['snapshotEveryChanges'])return _0x3bfc37();return _0x287086(),null;}async function _0x3f135b(){const _0x12d7c8=_0x4edda9,_0xe6a033=_0x1b49f8[_0x12d7c8(0x9d)]()||_0x1b49f8[_0x12d7c8(0x160)]();if(!_0xe6a033)return null;let _0x39f98e,_0x1eca2c=![];try{await _0x1b49f8[_0x12d7c8(0xf9)](_0xe6a033,async _0x2453f5=>{const _0x4b0112=_0x12d7c8;_0x39f98e=JSON[_0x4b0112(0xa1)](_0x217ae6[_0x4b0112(0x163)](_0x2453f5['state'],_0x4b0112(0x13a)));if(_0x39f98e[_0x4b0112(0xa7)]!==_0x42f4ac||_0x39f98e[_0x4b0112(0x167)]!==_0x4b0112(0xdc)||_0x39f98e['dims']!==_0x2d0833||_0x39f98e['metric']!==_0x436e81['metric']){_0x39f98e=null;return;}const _0x5703f1=new _0x49fb05();await _0x5703f1[_0x4b0112(0x11b)](_0x2453f5[_0x4b0112(0x113)]);const _0x5f2774=_0x3cd64a();_0x5f2774[_0x4b0112(0x108)](_0x2453f5[_0x4b0112(0xde)]),_0x35635a=_0x5703f1,_0x4a61b3=_0x5f2774,_0x1eca2c=!![];});}catch{return null;}return _0x1eca2c?_0x39f98e?.[_0x12d7c8(0x144)]??0x0:null;}async function _0x1e88a0(_0x295035){const _0x240ffe=_0x4edda9;_0x1f606=null;const _0x2fe7f4=await _0x3f135b();if(_0x2fe7f4!=null){_0x48fee5=0x0;if(_0x295035){if(!_0x35635a[_0x240ffe(0xe7)])return _0x130b07(_0x295035),await _0x3bfc37(),null;const _0x272c56=_0x3ce3bd(_0x35635a,_0x295035,_0x2d0833,{'upsert':_0x553b46,'remove':_0x5e43c0}),_0x42f499=_0x272c56[_0x240ffe(0xa3)]+_0x272c56[_0x240ffe(0x16c)]+_0x272c56[_0x240ffe(0x101)];_0x42f499>0x0&&(_0x48fee5+=_0x42f499,await _0x3bfc37());}return _0x2fe7f4;}_0x130b07(_0x295035??[]);if(_0x4a61b3[_0x240ffe(0x137)]()>0x0)await _0x3bfc37();return null;}async function _0x46444f(){_0x4fd519=!![],await _0x1e88a0(await _0x3e6b46());}async function _0x5f8907(){const _0xae7b9a=_0x4edda9;if(!_0x4fd519)return;_0x4fd519=![],_0x4811d8(),_0x48fee5=0x0;const _0x30ce3e=_0x1b49f8[_0xae7b9a(0x9d)]()||_0x1b49f8['latestSnapshotId']();await _0xf9a9f5(_0x30ce3e),_0x5978b1();}async function _0xf9a9f5(_0x481106){if(!_0x481106)return![];let _0x9bf36c=![];try{await _0x1b49f8['loadSnapshot'](_0x481106,async _0x56f5be=>{const _0x40b5c3=_0x1e38,_0x333a44=JSON[_0x40b5c3(0xa1)](_0x217ae6['readFileSync'](_0x56f5be[_0x40b5c3(0x134)],'utf8'));if(_0x333a44[_0x40b5c3(0xa7)]!==_0x42f4ac||_0x333a44['algorithm']!==_0x40b5c3(0xdc)||_0x333a44['dims']!==_0x2d0833||_0x333a44[_0x40b5c3(0x16a)]!==_0x436e81[_0x40b5c3(0x16a)])return;const _0x46b1b1=new _0x49fb05();await _0x46b1b1[_0x40b5c3(0x11b)](_0x56f5be['labels']);const _0x2abfff=_0x3cd64a();_0x2abfff[_0x40b5c3(0x115)](_0x56f5be[_0x40b5c3(0xde)]),_0x4a61b3=_0x2abfff,_0x35635a=_0x46b1b1,_0x1f606=_0x481106,_0x9bf36c=!![];});}catch{}return _0x9bf36c;}function _0x3565bd(){const _0x4f2a49=_0x4edda9,_0x52e563=Date[_0x4f2a49(0x10b)]();if(_0x52e563-_0x2daa1d<_0x436e81[_0x4f2a49(0xac)])return;_0x2daa1d=_0x52e563;if(_0x5560d2)return;if(_0xa908fe[_0x4f2a49(0x135)]()){_0x5560d2=!![],_0x73ce08(async()=>{const _0x2543fe=_0x4f2a49;!_0x4fd519&&_0x4faed5&&_0xa908fe[_0x2543fe(0x13f)]()&&(await _0x46444f(),_0x5978b1());})[_0x4f2a49(0xf5)](()=>{})['finally'](()=>{_0x5560d2=![];});return;}const _0x23b3ec=_0x1b49f8[_0x4f2a49(0x9d)]()||_0x1b49f8[_0x4f2a49(0x160)]();if(!_0x23b3ec||_0x23b3ec===_0x1f606)return;_0x5560d2=!![],_0x73ce08(async()=>{if(!_0x4fd519&&await _0xf9a9f5(_0x23b3ec))_0x5978b1();})['catch'](()=>{})['finally'](()=>{_0x5560d2=![];});}return{async 'load'(_0x5c97ef){return _0x73ce08(async()=>{const _0xc3991=_0x1e38;_0x1b49f8[_0xc3991(0xca)]({'maxAgeMs':_0x436e81['tmpMaxAgeMs']}),_0x56ac12=_0x5c97ef??null,_0x4fd519=_0xa908fe[_0xc3991(0x13f)]();let _0x43c3b9=null;if(_0x4fd519)_0x43c3b9=await _0x1e88a0(_0x5c97ef?await _0x5c97ef():null);else{const _0x465a35=_0x1b49f8[_0xc3991(0x9d)]()||_0x1b49f8[_0xc3991(0x160)]();await _0xf9a9f5(_0x465a35);}return _0x4faed5=!![],_0x43c3b9;});},async 'add'(_0x20dedd,_0x4e8d54,_0x266cba){return _0x73ce08(async()=>{const _0x308dff=_0x1e38;if(!_0x4faed5)return;const _0x2de38c=_0x10cae9(_0x4e8d54);if(!_0x4fd519){if(!_0xa908fe[_0x308dff(0x13f)]())return;await _0x46444f();}if(!_0x4a61b3)return;const _0xa485cd=_0x45d94b(_0x2de38c);if(_0x35635a[_0x308dff(0xae)](_0x20dedd)===_0xa485cd)return;_0x553b46(_0x20dedd,_0x2de38c,_0xa485cd),await _0x16feb5();});},async 'remove'(_0x234a09){return _0x73ce08(async()=>{const _0x425dd7=_0x1e38;if(!_0x4faed5)return;if(!_0x4fd519){if(!_0xa908fe[_0x425dd7(0x13f)]())return;await _0x46444f();}if(!_0x4a61b3)return;if(_0x5e43c0(_0x234a09))await _0x16feb5();});},'search'(_0x45ad90,{limit:limit=0xa}={}){const _0x5be64e=_0x4edda9;if(!_0x4fd519&&_0x4faed5)_0x3565bd();if(!_0x4a61b3)return[];const _0x3526c7=_0x4a61b3['size']();if(_0x3526c7===0x0)return[];const _0x6b397b=Math[_0x5be64e(0xcb)](limit,_0x3526c7),_0xd556dd=_0x4a61b3[_0x5be64e(0x15f)](_0x10cae9(_0x45ad90),_0x6b397b,0x0),_0x572b49=[],_0x1fdb7d=_0xd556dd[_0x5be64e(0x175)],_0x10b2b3=_0xd556dd[_0x5be64e(0x146)];for(let _0x43b866=0x0;_0x43b866<_0x1fdb7d[_0x5be64e(0x121)];_0x43b866++){const _0x2e6894=_0x1fdb7d[_0x43b866];if(_0x2e6894===0xffffffffffffffffn)continue;const _0x17aa75=Number(_0x2e6894),_0x5ba4c5=_0x35635a['keyForLabel'](_0x17aa75);if(!_0x5ba4c5)continue;const _0x3ac6c2=_0x10b2b3[_0x43b866];let _0x1c4514;if(_0x436e81[_0x5be64e(0x16a)]===_0x5be64e(0x104))_0x1c4514=Math[_0x5be64e(0xc7)](0x0,0x1-_0x3ac6c2);else{if(_0x436e81[_0x5be64e(0x16a)]==='ip')_0x1c4514=-_0x3ac6c2;else _0x1c4514=0x1/(0x1+_0x3ac6c2);}_0x572b49[_0x5be64e(0x11c)]({'key':_0x5ba4c5,'score':_0x1c4514});}return _0x572b49;},async 'snapshot'(_0x177d0b){return _0x73ce08(()=>_0x4fd519?_0x3bfc37(_0x177d0b??undefined):![]);},async 'rebuild'(_0x45d2e5){return _0x73ce08(async()=>{if(_0x45d2e5!=null)_0x56ac12=_0x45d2e5;if(!_0x4fd519){if(!_0xa908fe['acquire']())return;_0x4fd519=!![];}const _0x293337=_0x45d2e5?await _0x45d2e5():await _0x3e6b46();_0x130b07(_0x293337??[]),_0x4faed5=!![],await _0x3bfc37();});},async 'stop'(){return _0x73ce08(async()=>{const _0x1fa45a=_0x1e38;_0x4811d8();if(_0x4fd519){if(_0x48fee5>0x0||!_0x1b49f8[_0x1fa45a(0x9d)]())await _0x3bfc37();_0xa908fe[_0x1fa45a(0x16b)]();}_0x4fd519=![],_0x4faed5=![];});},'count'(){const _0x16a716=_0x4edda9;return _0x35635a[_0x16a716(0x137)]();},'info'(){const _0x34d847=_0x4edda9;return{'algorithm':'usearch','role':_0x4fd519?_0x34d847(0xf7):_0x34d847(0xba),'metric':_0x436e81['metric'],'connectivity':_0x436e81['connectivity'],'expansionAdd':_0x436e81[_0x34d847(0xc8)],'expansionSearch':_0x436e81[_0x34d847(0xdf)],'snapshotEveryChanges':_0x436e81[_0x34d847(0x12e)],'snapshotMaxLagMs':_0x436e81[_0x34d847(0x10c)],'count':_0x35635a[_0x34d847(0x137)](),'size':_0x4a61b3?.[_0x34d847(0x137)]?.()??0x0,'capacity':_0x4a61b3?.['capacity']?.()??0x0,'changesSince':_0x4fd519?_0x48fee5:null,'viewedSnapshot':_0x1f606??null,'snapshotDir':_0xc3ca4d,'latestSnapshot':_0x1b49f8[_0x34d847(0x9d)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function _0x4daa(){const _0x5a021d=['labels.json','sort','state','isFree','dims','size','queryVec','5260164UIFIsE','utf8','_tombstoneCount','3515mzDAhA','dir','warn','acquire','snapshotTo','startsWith','ready','worker_threads','clock','hex','distances','versions','writeIndexSync','trim','663AAqoeK','isFinite','hnswlib-node','vectors','ENOENT','ceil','node','score','flat','.tmp','_tmp-','snapshotsDir','round','nextLabel','560RdbVxv','12aocebb','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','openSync','WRITER.LOCK','postMessage','crypto','search','latestSnapshotId','snapshot','randomBytes','readFileSync','connectivity','snapshot\x20incomplete:\x20','closeSync','algorithm','save','EEXIST','metric','release','changed','resizeIndex','published','delete',',\x20host:\x20','reset','join','isInteger','filter','keys','addPoint','readCurrentClock','name','reject','set','readCurrentId','searchKnn','SNAPSHOT.LOCK','keepSnapshots','parse','getCurrentCount','added','_snapshotDir','default','imul','manifestVersion','setEf','.tmp-','labelToKey','tombstoneCount','viewRefreshMs','labelForEphemeral','fingerprintOf','F32','\x20on\x20','getMaxElements','10TaNkJI','slice','get','lockPath','mkdirSync','rebuild','for\x20Node\x20','7393034IBUSJR','reader','error','publishSnapshot','growFactor','sqrt','maxElements','vector','labelForExisting','existsSync','cause','keyForLabel','isDirectory','stale','max','expansionAdd','key','cleanupTmpDirs','min','call','pid','Cos','snapshots','fid','tombstone','1233xOYKUk','L2sq','path','_snapshotPaths','buffer','exports','then','repeat','remove','hnsw','usearch','setFingerprint','index','expansionSearch','readdirSync','currentPath','4946ksxlvT','hasOwnProperty','44456pjbRGG','CURRENT','keyToFp','hasFingerprints','Index','HNSW_BINDINGS_UNAVAILABLE','prune','map','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','renameSync','from','code','unlinkSync','7004zCKtFz','unreadable','__esModule','has','catch','platform','writer','token','loadSnapshot','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','resolve','sync','fetchAll','readIndexSync','add','info','removed','rmSync','MetricKind','cosine','snapshot\x20id\x20required','stop','heartbeatIntervalMs','load','unref','keyToLabel','now','snapshotMaxLagMs','efConstruction','trunc','90264GBCtrY','number','clear',').\x20','labels','index.hnsw','view','entries','toString','log','count','listSnapshotIds','loadFrom','push','writeFileSync','version','[SnapshotStore]','tmpMaxAgeMs','length','initIndex','prototype','markDelete','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','isArray','SnapshotStore\x20requires\x20dir','writerLockMaxAgeMs','message','HierarchicalNSW','216499kxGezh','arch','efSearch','snapshotEveryChanges','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','stringify','hostname'];_0x4daa=function(){return _0x5a021d;};return _0x4daa();}function requireAlgorithmWorkerThread(){const _0x1b54e5=_0x18db61;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x2a3b97,workerData:_0x556021}=require$$0$1,{algorithmName:_0x2bb2da,algorithmConfig:_0x1db2fb,dims:_0x4f2321,dir:_0x2c1b1d}=_0x556021;let _0x22ff0d=0x1;const _0x118c34=new Map();function _0x1ea603(){const _0xe2203f=_0x22ff0d++;return new Promise((_0x53ec39,_0x3dcdff)=>{const _0x4481d7=_0x1e38;_0x118c34[_0x4481d7(0x9c)](_0xe2203f,{'resolve':_0x53ec39,'reject':_0x3dcdff}),_0x2a3b97[_0x4481d7(0x15d)]({'op':_0x4481d7(0xfd),'fid':_0xe2203f});});}const _0x5237da={'dims':_0x4f2321,'dir':_0x2c1b1d,'fetchAll':_0x1ea603,'onChange':()=>_0x53d63c()};let _0xbdf6ba;if(_0x2bb2da==='hnsw')_0xbdf6ba=requireHnsw()(_0x1db2fb,_0x5237da);else{if(_0x2bb2da===_0x1b54e5(0x152))_0xbdf6ba=requireFlat()(_0x1db2fb,_0x5237da);else{if(_0x2bb2da===_0x1b54e5(0xdc))_0xbdf6ba=requireUsearch()(_0x1db2fb,_0x5237da);else throw new Error('Unknown\x20algorithm:\x20\x22'+_0x2bb2da+'\x22');}}function _0x53d63c(){const _0x4331a1=_0x1b54e5;try{_0x2a3b97['postMessage']({'op':_0x4331a1(0xfc),'count':_0xbdf6ba[_0x4331a1(0x119)](),'info':_0xbdf6ba[_0x4331a1(0x100)](),'memory':process['memoryUsage']()});}catch{}}function _0x1ab97c(_0x427d81){const _0x5a93e6=_0x1b54e5;return(_0x427d81||[])[_0x5a93e6(0xeb)](_0x5eaab0=>({'key':_0x5eaab0['key'],'vector':_0x5eaab0['vector']instanceof Float32Array?_0x5eaab0[_0x5a93e6(0xc0)]:new Float32Array(_0x5eaab0[_0x5a93e6(0xc0)])}));}return _0x2a3b97['on'](_0x1b54e5(0x129),async _0x88e094=>{const _0x5e44c6=_0x1b54e5;if(_0x88e094['op']==='fetchAllResult'){const _0x140370=_0x118c34['get'](_0x88e094['fid']);if(!_0x140370)return;_0x118c34[_0x5e44c6(0x16f)](_0x88e094[_0x5e44c6(0xd0)]);if(_0x88e094[_0x5e44c6(0xbb)])_0x140370[_0x5e44c6(0x9b)](new Error(_0x88e094[_0x5e44c6(0xbb)]));else _0x140370[_0x5e44c6(0xfb)](_0x1ab97c(_0x88e094[_0x5e44c6(0x14d)]));return;}const {id:_0x37ed43,op:_0x46ee36,args:_0x17734e}=_0x88e094;try{let _0x4b3db4;switch(_0x46ee36){case'load':{_0x4b3db4=await _0xbdf6ba['load'](_0x17734e['hasRows']?_0x1ea603:null),_0x53d63c();break;}case _0x5e44c6(0xff):{const _0x5e04f2=_0x17734e[_0x5e44c6(0xc0)]instanceof Float32Array?_0x17734e[_0x5e44c6(0xc0)]:new Float32Array(_0x17734e['vector']);await _0xbdf6ba[_0x5e44c6(0xff)](_0x17734e[_0x5e44c6(0xc9)],_0x5e04f2,_0x17734e[_0x5e44c6(0x144)]??undefined),_0x53d63c(),_0x4b3db4=null;break;}case _0x5e44c6(0xda):{await _0xbdf6ba[_0x5e44c6(0xda)](_0x17734e[_0x5e44c6(0xc9)]),_0x53d63c(),_0x4b3db4=null;break;}case'search':{const _0x1a45f3=_0x17734e[_0x5e44c6(0x138)]instanceof Float32Array?_0x17734e[_0x5e44c6(0x138)]:new Float32Array(_0x17734e[_0x5e44c6(0x138)]);_0x4b3db4=_0xbdf6ba['search'](_0x1a45f3,_0x17734e['opts']||{});break;}case _0x5e44c6(0x161):{_0x4b3db4=await _0xbdf6ba['snapshot'](_0x17734e[_0x5e44c6(0x144)]),_0x53d63c();break;}case _0x5e44c6(0xb7):{const _0xf55c95=_0x1ab97c(_0x17734e[_0x5e44c6(0x14d)]);await _0xbdf6ba[_0x5e44c6(0xb7)](async()=>_0xf55c95),_0x53d63c(),_0x4b3db4=null;break;}case'stop':{await _0xbdf6ba[_0x5e44c6(0x106)](),_0x53d63c(),_0x4b3db4=null;break;}case _0x5e44c6(0x119):{_0x4b3db4=_0xbdf6ba[_0x5e44c6(0x119)]();break;}case _0x5e44c6(0x100):{_0x4b3db4=_0xbdf6ba['info']();break;}default:throw new Error('Unknown\x20op:\x20\x22'+_0x46ee36+'\x22');}_0x2a3b97[_0x5e44c6(0x15d)]({'id':_0x37ed43,'result':_0x4b3db4});}catch(_0x2a5a59){_0x2a3b97[_0x5e44c6(0x15d)]({'id':_0x37ed43,'error':{'message':_0x2a5a59?.[_0x5e44c6(0x129)]||String(_0x2a5a59),'code':_0x2a5a59?.[_0x5e44c6(0xef)]}});}}),_0x2a3b97[_0x1b54e5(0x15d)]({'op':_0x1b54e5(0x142)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x18db61(0xd7)]=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;
|