@kedem/okdb 2.1.0 → 2.1.2

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.
@@ -1 +1 @@
1
- 'use strict';const _0x1b10ba=_0x485b;(function(_0x680271,_0x3ac39a){const _0x5da203=_0x485b,_0x247aff=_0x680271();while(!![]){try{const _0x49b64c=parseInt(_0x5da203(0x16d))/0x1*(-parseInt(_0x5da203(0x183))/0x2)+-parseInt(_0x5da203(0x1e0))/0x3*(parseInt(_0x5da203(0x1b3))/0x4)+-parseInt(_0x5da203(0x19d))/0x5*(parseInt(_0x5da203(0x1c6))/0x6)+-parseInt(_0x5da203(0x17d))/0x7+parseInt(_0x5da203(0x1c5))/0x8*(-parseInt(_0x5da203(0x1c0))/0x9)+-parseInt(_0x5da203(0x205))/0xa+parseInt(_0x5da203(0x18e))/0xb*(parseInt(_0x5da203(0x1df))/0xc);if(_0x49b64c===_0x3ac39a)break;else _0x247aff['push'](_0x247aff['shift']());}catch(_0x2b8741){_0x247aff['push'](_0x247aff['shift']());}}}(_0x41a1,0x278e7));var require$$0$1=require(_0x1b10ba(0x1fd)),require$$0=require('fs'),require$$1=require('path'),require$$2=require('os'),require$$3=require(_0x1b10ba(0x20e));function getDefaultExportFromCjs(_0x20b033){const _0x3cfe7a=_0x1b10ba;return _0x20b033&&_0x20b033[_0x3cfe7a(0x202)]&&Object[_0x3cfe7a(0x1af)][_0x3cfe7a(0x20f)][_0x3cfe7a(0x174)](_0x20b033,'default')?_0x20b033[_0x3cfe7a(0x227)]:_0x20b033;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x58e9b8=_0x1b10ba;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x1472d4=require$$0,_0x3078bf=require$$1,_0x50f398=require$$2,_0x554c4b=require$$3;function _0x3738ae(){const _0x2acc7b=_0x485b;return Date[_0x2acc7b(0x1b4)]();}function _0x3b13ea(_0x458a2a){const _0xd5cd77=_0x485b;try{return _0x1472d4[_0xd5cd77(0x215)](_0x458a2a);}catch{return![];}}function _0xfa414d(_0x2ddd0c){const _0x4d5312=_0x485b;try{return _0x1472d4[_0x4d5312(0x1f9)](_0x2ddd0c,_0x4d5312(0x221));}catch{return null;}}function _0x400b73(_0x19735d,_0x2657dd){const _0x28d884=_0x485b,_0x537c8b=_0x19735d+_0x28d884(0x1a9)+_0x554c4b['randomBytes'](0x6)[_0x28d884(0x20b)](_0x28d884(0x1bc));_0x1472d4[_0x28d884(0x166)](_0x537c8b,_0x2657dd),_0x1472d4[_0x28d884(0x201)](_0x537c8b,_0x19735d);}function _0x112517(_0x2a7a31,_0x2752e9=0x10){const _0x2398c5=_0x485b,_0x48c20a=String(Math[_0x2398c5(0x224)](0x0,Math['trunc'](_0x2a7a31||0x0)));return _0x48c20a[_0x2398c5(0x20d)]>=_0x2752e9?_0x48c20a:'0'[_0x2398c5(0x178)](_0x2752e9-_0x48c20a[_0x2398c5(0x20d)])+_0x48c20a;}return snapshotStore=class _0x389560{constructor({dir:_0x1ca969,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x1af362=_0x485b;if(!_0x1ca969)throw new Error(_0x1af362(0x214));this['dir']=_0x1ca969,this[_0x1af362(0x17a)]=_0x3078bf['join'](_0x1ca969,'snapshots'),this[_0x1af362(0x1c9)]=_0x3078bf['join'](_0x1ca969,_0x1af362(0x1e5)),this['lockPath']=_0x3078bf[_0x1af362(0x170)](_0x1ca969,_0x1af362(0x1dc)),this[_0x1af362(0x1a0)]=keepSnapshots,this[_0x1af362(0x179)]=log,_0x1472d4[_0x1af362(0x216)](this[_0x1af362(0x1a3)],{'recursive':!![]}),_0x1472d4[_0x1af362(0x216)](this[_0x1af362(0x17a)],{'recursive':!![]});}['_snapshotDir'](_0x532b2d){const _0x453176=_0x485b;return _0x3078bf['join'](this[_0x453176(0x17a)],_0x532b2d);}[_0x58e9b8(0x169)](_0x286ef7){const _0x38b432=_0x58e9b8,_0x3d3888=this['_snapshotDir'](_0x286ef7);return{'dir':_0x3d3888,'index':_0x3078bf[_0x38b432(0x170)](_0x3d3888,_0x38b432(0x167)),'labels':_0x3078bf[_0x38b432(0x170)](_0x3d3888,_0x38b432(0x1d3)),'state':_0x3078bf[_0x38b432(0x170)](_0x3d3888,_0x38b432(0x193))};}['readCurrentId'](){const _0x27c5dd=_0x58e9b8;if(!_0x3b13ea(this['currentPath']))return null;const _0x4125ab=_0xfa414d(this[_0x27c5dd(0x1c9)]);if(!_0x4125ab)return null;const _0x21adc2=String(_0x4125ab)[_0x27c5dd(0x18b)]();return _0x21adc2||null;}[_0x58e9b8(0x188)](){const _0x5e7b9b=_0x58e9b8,_0x500e85=this[_0x5e7b9b(0x1f4)]();if(!_0x500e85)return 0x0;const _0x455806=Number(_0x500e85);return Number[_0x5e7b9b(0x1b9)](_0x455806)?_0x455806:0x0;}[_0x58e9b8(0x192)](){const _0x1cb197=_0x58e9b8;try{return _0x1472d4[_0x1cb197(0x1be)](this[_0x1cb197(0x17a)],{'withFileTypes':!![]})['filter'](_0x36c0ec=>_0x36c0ec['isDirectory']())[_0x1cb197(0x220)](_0x28f271=>_0x28f271[_0x1cb197(0x225)])['filter'](_0x5a8a04=>!_0x5a8a04['startsWith']('.tmp-'))['filter'](_0x52962a=>!_0x52962a[_0x1cb197(0x21a)](_0x1cb197(0x1b1)))['sort']();}catch{return[];}}[_0x58e9b8(0x1bd)](){const _0x19b8a2=_0x58e9b8,_0x12d58e=this[_0x19b8a2(0x1f4)]();if(_0x12d58e)return _0x12d58e;const _0x1f4cfb=this[_0x19b8a2(0x192)]();if(!_0x1f4cfb[_0x19b8a2(0x20d)])return null;return _0x1f4cfb[_0x1f4cfb['length']-0x1];}[_0x58e9b8(0x172)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x2d6fb8=_0x58e9b8;let _0x29bf17;try{_0x29bf17=_0x1472d4[_0x2d6fb8(0x1be)](this[_0x2d6fb8(0x17a)],{'withFileTypes':!![]});}catch{return;}const _0x4d5bd9=_0x3738ae()-maxAgeMs;for(const _0x406578 of _0x29bf17){if(!_0x406578[_0x2d6fb8(0x1c7)]())continue;const _0x36537d=_0x406578[_0x2d6fb8(0x225)];if(!_0x36537d[_0x2d6fb8(0x21a)](_0x2d6fb8(0x1a9))&&!_0x36537d['startsWith']('_tmp-'))continue;const _0xb4a43c=_0x3078bf[_0x2d6fb8(0x170)](this[_0x2d6fb8(0x17a)],_0x36537d);try{const _0xad9fb7=_0x1472d4[_0x2d6fb8(0x21f)](_0xb4a43c);if(_0xad9fb7[_0x2d6fb8(0x1cc)]>_0x4d5bd9)continue;}catch{}try{_0x1472d4['rmSync'](_0xb4a43c,{'recursive':!![],'force':!![]});}catch{}}}[_0x58e9b8(0x1ff)]({keep:keep=null}={}){const _0x48d0d7=_0x58e9b8,_0x1bc9ee=Math[_0x48d0d7(0x224)](0x1,Math[_0x48d0d7(0x194)](keep??this[_0x48d0d7(0x1a0)]??0x3)),_0x50b159=this[_0x48d0d7(0x192)]();if(_0x50b159['length']<=_0x1bc9ee)return;const _0x5759d4=this[_0x48d0d7(0x1f4)](),_0x4702c2=_0x50b159[_0x48d0d7(0x204)](0x0,Math[_0x48d0d7(0x224)](0x0,_0x50b159[_0x48d0d7(0x20d)]-_0x1bc9ee));for(const _0xa26f54 of _0x4702c2){if(_0x5759d4&&_0xa26f54===_0x5759d4)continue;const _0x1f1a33=this[_0x48d0d7(0x15f)](_0xa26f54);try{_0x1472d4[_0x48d0d7(0x1ee)](_0x1f1a33,{'recursive':!![],'force':!![]});}catch{}}}async[_0x58e9b8(0x1e4)](_0x1aa5b4,_0x502954){const _0x217950=_0x58e9b8;if(!_0x1aa5b4)throw new Error(_0x217950(0x1d5));const _0x5f160b=this[_0x217950(0x169)](_0x1aa5b4);if(!_0x3b13ea(_0x5f160b['index'])||!_0x3b13ea(_0x5f160b[_0x217950(0x1e3)])||!_0x3b13ea(_0x5f160b['state']))throw new Error(_0x217950(0x211)+_0x1aa5b4);const _0x407ee2=await _0x502954(_0x5f160b);return _0x407ee2||{};}async['publishSnapshot'](_0x44dff8,_0x5374ef,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x171923=_0x58e9b8,_0x5ba1a2=Number(_0x44dff8);if(!Number[_0x171923(0x1b9)](_0x5ba1a2)||_0x5ba1a2<0x0)throw new Error(_0x171923(0x176));const _0xb65884=_0x112517(_0x5ba1a2),_0x1199ce=this[_0x171923(0x15f)](_0xb65884),_0x14ee58=_0x3078bf[_0x171923(0x170)](this[_0x171923(0x17a)],_0x171923(0x1a9)+_0xb65884+'-'+_0x554c4b[_0x171923(0x1ac)](0x6)[_0x171923(0x20b)]('hex'));_0x1472d4[_0x171923(0x216)](_0x14ee58,{'recursive':!![]});const _0x52d544={'dir':_0x14ee58,'index':_0x3078bf[_0x171923(0x170)](_0x14ee58,_0x171923(0x167)),'labels':_0x3078bf['join'](_0x14ee58,_0x171923(0x1d3)),'state':_0x3078bf[_0x171923(0x170)](_0x14ee58,'state.json')};await _0x5374ef(_0x52d544,{'id':_0xb65884,'clock':_0x5ba1a2});const _0x518857=JSON[_0x171923(0x195)]({'pid':process[_0x171923(0x1c4)],'host':_0x50f398[_0x171923(0x1bb)](),'at':_0x3738ae()}),_0x5effdb=_0x3738ae();let _0x17f3d6=null;const _0xae8f7f=()=>{const _0x2a17f0=_0x171923;try{const _0x653fce=JSON[_0x2a17f0(0x217)](_0x1472d4[_0x2a17f0(0x1f9)](this[_0x2a17f0(0x1a1)],'utf8'));if(_0x653fce['at']&&_0x3738ae()-_0x653fce['at']>staleLockMaxAgeMs){const _0x647413=_0x3738ae()-_0x653fce['at'],_0x1d9efd='Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20'+Math[_0x2a17f0(0x213)](_0x647413/0x3e8)+_0x2a17f0(0x1f3)+_0x653fce['pid']+_0x2a17f0(0x1fe)+_0x653fce[_0x2a17f0(0x1eb)]+_0x2a17f0(0x19b)+_0x2a17f0(0x1da);this['log']?.[_0x2a17f0(0x223)]?this['log'][_0x2a17f0(0x223)](_0x1d9efd):console[_0x2a17f0(0x223)](_0x2a17f0(0x21b),_0x1d9efd);try{_0x1472d4[_0x2a17f0(0x187)](this[_0x2a17f0(0x1a1)]);}catch{}return!![];}}catch{try{_0x1472d4[_0x2a17f0(0x187)](this['lockPath']);}catch{}}return![];},_0xe39c00=()=>{const _0x92fd4a=_0x171923;try{return _0x17f3d6=_0x1472d4[_0x92fd4a(0x1dd)](this[_0x92fd4a(0x1a1)],'wx'),_0x1472d4[_0x92fd4a(0x166)](_0x17f3d6,_0x518857),!![];}catch(_0x190153){if(_0x190153&&_0x190153[_0x92fd4a(0x1b6)]===_0x92fd4a(0x1cf))return![];throw _0x190153;}};if(!_0xe39c00()){_0xae8f7f(),_0xe39c00();if(_0x17f3d6==null&&lockTimeoutMs>0x0)while(_0x3738ae()-_0x5effdb<lockTimeoutMs){await new Promise(_0x1c1851=>setTimeout(_0x1c1851,0x19));if(_0xe39c00())break;_0xae8f7f();}}if(_0x17f3d6==null){try{_0x1472d4[_0x171923(0x1ee)](_0x14ee58,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'lock_busy'};}try{const _0x27dd62=this[_0x171923(0x188)]();if(_0x5ba1a2<=_0x27dd62){try{_0x1472d4[_0x171923(0x1ee)](_0x14ee58,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':'stale','currentClock':_0x27dd62};}if(!_0x3b13ea(_0x1199ce))_0x1472d4[_0x171923(0x201)](_0x14ee58,_0x1199ce);else try{_0x1472d4['rmSync'](_0x14ee58,{'recursive':!![],'force':!![]});}catch{}return _0x400b73(this['currentPath'],_0xb65884+'\x0a'),this['prune']({'keep':keep}),{'published':!![],'currentClock':_0x5ba1a2};}finally{try{_0x1472d4['closeSync'](_0x17f3d6);}catch{}try{_0x1472d4[_0x171923(0x187)](this[_0x171923(0x1a1)]);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function _0x485b(_0x258096,_0x24a72a){_0x258096=_0x258096-0x15e;const _0x41a1be=_0x41a1();let _0x485bdc=_0x41a1be[_0x258096];return _0x485bdc;}function requireLabelMap(){const _0x2741a2=_0x1b10ba;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x1cf61e=require$$0;class _0x37db40{constructor(){const _0x58bf83=_0x485b;this[_0x58bf83(0x1ba)]=new Map(),this[_0x58bf83(0x180)]=new Map(),this[_0x58bf83(0x212)]=0x0,this[_0x58bf83(0x191)]=0x0;}async[_0x2741a2(0x21c)](){const _0x49cfea=_0x2741a2;this[_0x49cfea(0x1ba)]=new Map(),this[_0x49cfea(0x180)]=new Map(),this[_0x49cfea(0x212)]=0x0,this[_0x49cfea(0x191)]=0x0;}async[_0x2741a2(0x209)](_0x4ffad4){const _0x2da248=_0x2741a2;if(!_0x4ffad4||!_0x1cf61e[_0x2da248(0x215)](_0x4ffad4))return await this[_0x2da248(0x21c)](),!![];let _0x3eff7c;try{_0x3eff7c=_0x1cf61e[_0x2da248(0x1f9)](_0x4ffad4,_0x2da248(0x221));}catch{return await this[_0x2da248(0x21c)](),!![];}let _0x2440ef;try{_0x2440ef=JSON[_0x2da248(0x217)](_0x3eff7c);}catch{return await this[_0x2da248(0x21c)](),!![];}const _0xaa376d=Array[_0x2da248(0x17e)](_0x2440ef?.[_0x2da248(0x171)])?_0x2440ef[_0x2da248(0x171)]:[],_0x54a180=Number['isInteger'](_0x2440ef?.['nextLabel'])?_0x2440ef[_0x2da248(0x212)]:0x0,_0x1a795c=new Map(),_0x3d9416=new Map();let _0x341d14=-0x1;for(const _0x4771dd of _0xaa376d){if(!Array[_0x2da248(0x17e)](_0x4771dd)||_0x4771dd[_0x2da248(0x20d)]!==0x2)continue;const _0x124030=Number(_0x4771dd[0x0]),_0x14586e=String(_0x4771dd[0x1]??'');if(!Number[_0x2da248(0x1db)](_0x124030)||_0x124030<0x0)continue;if(!_0x14586e)continue;_0x1a795c[_0x2da248(0x1a5)](_0x14586e,_0x124030),_0x3d9416[_0x2da248(0x1a5)](_0x124030,_0x14586e);if(_0x124030>_0x341d14)_0x341d14=_0x124030;}return this['keyToLabel']=_0x1a795c,this[_0x2da248(0x180)]=_0x3d9416,this[_0x2da248(0x212)]=Math[_0x2da248(0x224)](_0x54a180,_0x341d14+0x1,0x0),this[_0x2da248(0x191)]=0x0,!![];}[_0x2741a2(0x1ce)](_0x71a814){const _0x44b18e=_0x2741a2;return this[_0x44b18e(0x1ba)][_0x44b18e(0x1d1)](_0x71a814);}[_0x2741a2(0x184)](_0x3c7893){const _0x207f90=_0x2741a2;let _0x404686=this[_0x207f90(0x1ba)]['get'](_0x3c7893);if(_0x404686!==undefined)return _0x404686;return _0x404686=this[_0x207f90(0x212)]++,this[_0x207f90(0x1ba)][_0x207f90(0x1a5)](_0x3c7893,_0x404686),this['labelToKey'][_0x207f90(0x1a5)](_0x404686,_0x3c7893),_0x404686;}[_0x2741a2(0x181)](_0x4faad4){const _0x557dc0=_0x2741a2,_0x288f27=this[_0x557dc0(0x1ba)][_0x557dc0(0x1d1)](_0x4faad4);if(_0x288f27===undefined)return;this[_0x557dc0(0x1ba)][_0x557dc0(0x1b7)](_0x4faad4),this[_0x557dc0(0x180)][_0x557dc0(0x1b7)](_0x288f27),this[_0x557dc0(0x191)]++;}[_0x2741a2(0x168)](_0x2573c6){const _0x1ade5b=_0x2741a2;return this[_0x1ade5b(0x180)][_0x1ade5b(0x1d1)](_0x2573c6)??null;}['size'](){const _0x340fda=_0x2741a2;return this[_0x340fda(0x1ba)][_0x340fda(0x1ef)];}[_0x2741a2(0x19e)](){return this['_tombstoneCount'];}async[_0x2741a2(0x21e)](_0x157b09){const _0x5642d0=_0x2741a2,_0x12283b=_0x157b09+'.tmp',_0x442b38=[];for(const [_0x508241,_0x3ed7d3]of this[_0x5642d0(0x180)]['entries']()){_0x442b38['push']([_0x508241,_0x3ed7d3]);}_0x442b38[_0x5642d0(0x1fa)]((_0x569218,_0x47fd5)=>_0x569218[0x0]-_0x47fd5[0x0]);const _0x1c12db={'version':0x1,'nextLabel':this['nextLabel'],'entries':_0x442b38};_0x1cf61e[_0x5642d0(0x166)](_0x12283b,JSON[_0x5642d0(0x195)](_0x1c12db)),_0x1cf61e[_0x5642d0(0x201)](_0x12283b,_0x157b09);}}return labelMap=_0x37db40,labelMap;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x2c5d1c=requireSnapshotStore(),_0xdd4673=requireLabelMap(),_0x37343f=0x1;let _0x1f7562=null;function _0x1cc983(){const _0x4ed2e8=_0x485b;if(_0x1f7562)return _0x1f7562;try{return _0x1f7562=require(_0x4ed2e8(0x1f6)),_0x1f7562;}catch(_0x521301){const _0x3dce0e=new Error(_0x4ed2e8(0x177)+(_0x4ed2e8(0x1d2)+process['versions'][_0x4ed2e8(0x203)]+_0x4ed2e8(0x1a2)+process[_0x4ed2e8(0x1c2)]+'/'+process[_0x4ed2e8(0x1d7)]+'.\x20')+_0x4ed2e8(0x16f)+('Original\x20error:\x20'+(_0x521301?.['message']||String(_0x521301))));_0x3dce0e[_0x4ed2e8(0x1b6)]=_0x4ed2e8(0x173),_0x3dce0e[_0x4ed2e8(0x162)]=_0x521301;throw _0x3dce0e;}}return hnsw=function _0x31a5e9(_0x14797a={},{dims:_0x54e9f3,dir:_0x59ba2f}){const _0x5538d1=_0x485b,_0x40adff=_0x1cc983();if(!_0x54e9f3||_0x54e9f3<=0x0)throw new Error(_0x5538d1(0x1a7));if(!_0x59ba2f)throw new Error(_0x5538d1(0x16e));const _0x13ca49={'metric':_0x14797a[_0x5538d1(0x20a)]??_0x5538d1(0x1a6),'M':_0x14797a['M']??0x10,'efConstruction':_0x14797a[_0x5538d1(0x161)]??0xc8,'efSearch':_0x14797a[_0x5538d1(0x175)]??0x40,'maxElements':_0x14797a[_0x5538d1(0x1fc)]??0x400,'growFactor':_0x14797a['growFactor']??0x2,'snapshotEveryChanges':_0x14797a[_0x5538d1(0x18f)]??0xc350,'keepSnapshots':_0x14797a[_0x5538d1(0x1a0)]??0x2,'tmpMaxAgeMs':_0x14797a[_0x5538d1(0x199)]??0x6*0x36ee80},_0x163c05=new _0x2c5d1c({'dir':_0x59ba2f,'keepSnapshots':_0x13ca49['keepSnapshots']}),_0x396d34=new _0xdd4673();let _0xada06e=null,_0xbe9a57=0x0,_0x493c97=null,_0x22fe0d=Promise[_0x5538d1(0x1f8)]();const _0x12eef2=_0x17bd31=>{const _0x56cdb9=_0x5538d1;return _0x22fe0d=_0x22fe0d[_0x56cdb9(0x190)](_0x17bd31),_0x22fe0d;};async function _0x305c07(_0xb6524a){const _0x37f760=_0x5538d1;await _0x396d34[_0x37f760(0x21c)]();const _0x5a3e55=_0xb6524a?await _0xb6524a():[],_0x547d65=Math[_0x37f760(0x224)](_0x13ca49[_0x37f760(0x1fc)],Math[_0x37f760(0x206)](_0x5a3e55[_0x37f760(0x20d)]*(_0x13ca49[_0x37f760(0x16c)]||1.2)),0x1);_0xada06e=new _0x40adff[(_0x37f760(0x20c))](_0x13ca49[_0x37f760(0x20a)],_0x54e9f3),_0xada06e[_0x37f760(0x164)]({'maxElements':_0x547d65,'efConstruction':_0x13ca49[_0x37f760(0x161)],'M':_0x13ca49['M']});for(const {key:_0x393f79,vector:_0x3aa381}of _0x5a3e55){if(!(_0x3aa381 instanceof Float32Array)||_0x3aa381[_0x37f760(0x20d)]!==_0x54e9f3)continue;const _0x572567=_0x396d34['labelForEphemeral'](_0x393f79);_0xada06e[_0x37f760(0x1e7)](Array[_0x37f760(0x186)](_0x3aa381),_0x572567);}_0xada06e['setEf'](_0x13ca49[_0x37f760(0x175)]),_0xbe9a57=0x0;}async function _0x1a13ea(_0x52b0d7){const _0x37d4c0=_0x5538d1;if(!_0xada06e||!_0x52b0d7)return![];const _0x16e585=await _0x163c05[_0x37d4c0(0x1ab)](_0x52b0d7,async _0x430c2c=>{const _0x30c975=_0x37d4c0;_0xada06e[_0x30c975(0x226)](_0x430c2c[_0x30c975(0x18a)]),await _0x396d34[_0x30c975(0x21e)](_0x430c2c[_0x30c975(0x1e3)]);const _0x15c7cc=require$$0;_0x15c7cc[_0x30c975(0x166)](_0x430c2c[_0x30c975(0x18d)],JSON[_0x30c975(0x195)]({'manifestVersion':_0x37343f,'dims':_0x54e9f3,'metric':_0x13ca49['metric'],'clock':_0x52b0d7,'snapshotAt':Date[_0x30c975(0x1b4)]()},null,0x2));},{'keep':_0x13ca49[_0x37d4c0(0x1a0)]});if(_0x16e585?.[_0x37d4c0(0x1de)])_0xbe9a57=0x0;return _0x16e585?.[_0x37d4c0(0x1de)]??![];}async function _0xf4574f(){const _0x532304=_0x5538d1,_0x4c8bb6=_0x163c05[_0x532304(0x1f4)]()||_0x163c05[_0x532304(0x1bd)]();if(!_0x4c8bb6)return null;let _0x4ce172,_0x1a6dbc=![];return await _0x163c05['loadSnapshot'](_0x4c8bb6,async _0x457dd8=>{const _0x5b7413=_0x532304,_0x2495a5=require$$0;_0x4ce172=JSON['parse'](_0x2495a5['readFileSync'](_0x457dd8[_0x5b7413(0x18d)],'utf8'));if(_0x4ce172['manifestVersion']!==_0x37343f||_0x4ce172[_0x5b7413(0x208)]!==_0x54e9f3||_0x4ce172[_0x5b7413(0x20a)]!==_0x13ca49[_0x5b7413(0x20a)]){_0x4ce172=null;return;}await _0x396d34['loadFrom'](_0x457dd8['labels']),_0xada06e=new _0x40adff[(_0x5b7413(0x20c))](_0x13ca49['metric'],_0x54e9f3),_0xada06e[_0x5b7413(0x19a)](_0x457dd8[_0x5b7413(0x18a)]),_0xada06e['setEf'](_0x13ca49[_0x5b7413(0x175)]),_0x1a6dbc=!![];}),_0x1a6dbc?_0x4ce172?.['clock']??0x0:null;}return{async 'load'(_0x40a666){return _0x12eef2(async()=>{_0x163c05['cleanupTmpDirs']({'maxAgeMs':_0x13ca49['tmpMaxAgeMs']}),_0x493c97=_0x40a666??null;const _0x45c020=await _0xf4574f();if(_0x45c020!=null)return _0x45c020;return await _0x305c07(_0x40a666),null;});},async 'add'(_0x1394de,_0x19c93e,_0x56b2e8){return _0x12eef2(async()=>{const _0x78a5c=_0x485b;if(!_0xada06e)return;const _0x29f037=_0x396d34[_0x78a5c(0x184)](_0x1394de);try{_0xada06e[_0x78a5c(0x1d9)](_0x29f037);}catch{}_0xada06e[_0x78a5c(0x16b)]()>=_0xada06e[_0x78a5c(0x1ca)]()&&(_0x13ca49[_0x78a5c(0x1fc)]=Math[_0x78a5c(0x206)](_0xada06e[_0x78a5c(0x1ca)]()*(_0x13ca49[_0x78a5c(0x16c)]||0x2)),await _0x305c07(_0x493c97)),_0xada06e['addPoint'](Array[_0x78a5c(0x186)](_0x19c93e),_0x29f037),_0xbe9a57++,_0xbe9a57>=_0x13ca49['snapshotEveryChanges']&&await _0x1a13ea(_0x56b2e8??Date[_0x78a5c(0x1b4)]());});},async 'remove'(_0x53f114){return _0x12eef2(async()=>{const _0x20d86f=_0x485b;if(!_0xada06e)return;const _0x4043b0=_0x396d34[_0x20d86f(0x1ce)](_0x53f114);if(_0x4043b0===undefined)return;try{_0xada06e[_0x20d86f(0x1d9)](_0x4043b0);}catch{}_0x396d34[_0x20d86f(0x181)](_0x53f114),_0xbe9a57++;});},'search'(_0x2ab151,{limit:limit=0xa,efSearch:_0x626d67}={}){const _0x55d12b=_0x5538d1;if(!_0xada06e)return[];if(Number[_0x55d12b(0x1db)](_0x626d67))_0xada06e[_0x55d12b(0x185)](_0x626d67);const _0x951041=Math[_0x55d12b(0x1f1)](limit,_0xada06e[_0x55d12b(0x16b)]()||0x1),{neighbors:_0x4f4e45,distances:_0x1ef042}=_0xada06e[_0x55d12b(0x1ea)](Array[_0x55d12b(0x186)](_0x2ab151),_0x951041),_0x1525a4=[];for(let _0x420272=0x0;_0x420272<_0x4f4e45[_0x55d12b(0x20d)];_0x420272++){const _0x352d38=_0x396d34['keyForLabel'](_0x4f4e45[_0x420272]);if(!_0x352d38)continue;const _0x480d4d=_0x13ca49[_0x55d12b(0x20a)]==='cosine'?Math[_0x55d12b(0x224)](0x0,0x1-_0x1ef042[_0x420272]):0x1/(0x1+_0x1ef042[_0x420272]);_0x1525a4[_0x55d12b(0x1b0)]({'key':_0x352d38,'score':_0x480d4d});}return _0x1525a4;},async 'snapshot'(_0xf68ebf=Date[_0x5538d1(0x1b4)]()){return _0x12eef2(()=>_0x1a13ea(_0xf68ebf));},async 'rebuild'(_0x3d64a4){return _0x12eef2(()=>{if(_0x3d64a4!=null)_0x493c97=_0x3d64a4;return _0x305c07(_0x3d64a4??_0x493c97);});},async 'stop'(){const _0x46eada=_0x5538d1;return _0x12eef2(()=>_0x1a13ea(Date[_0x46eada(0x1b4)]()));},'count'(){return _0x396d34['size']();},'info'(){const _0x2af573=_0x5538d1;return{'algorithm':_0x2af573(0x207),'metric':_0x13ca49[_0x2af573(0x20a)],'M':_0x13ca49['M'],'efConstruction':_0x13ca49[_0x2af573(0x161)],'efSearch':_0x13ca49[_0x2af573(0x175)],'maxElements':_0xada06e?.[_0x2af573(0x1ca)]()??_0x13ca49[_0x2af573(0x1fc)],'count':_0x396d34[_0x2af573(0x1ef)](),'changesSince':_0xbe9a57,'snapshotDir':_0x59ba2f,'latestSnapshot':_0x163c05[_0x2af573(0x1f4)]()??null};}};},hnsw;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x5f3ab5(_0x106468={}){const _0x483b75=new Map();return{async 'load'(_0x2ec746){const _0x5788b7=_0x485b;_0x483b75[_0x5788b7(0x218)]();if(_0x2ec746)for(const {key:_0x3684f2,vector:_0x4c17e1}of await _0x2ec746()){_0x483b75[_0x5788b7(0x1a5)](_0x3684f2,_0x4c17e1);}},async 'add'(_0x2f3d87,_0x24682d,_0x427369){const _0x221c69=_0x485b;_0x483b75[_0x221c69(0x1a5)](_0x2f3d87,_0x24682d);},async 'remove'(_0x3eb8a3){_0x483b75['delete'](_0x3eb8a3);},'search'(_0x24aac7,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x29ad72=_0x485b,_0x51272c=[];for(const [_0x569db4,_0x608fab]of _0x483b75){const _0x2068ea=_0x8bf7ac(_0x24aac7,_0x608fab);if(_0x2068ea>=threshold)_0x51272c[_0x29ad72(0x1b0)]({'key':_0x569db4,'score':_0x2068ea});}return _0x51272c['sort']((_0x4550f1,_0x51fd2c)=>_0x51fd2c['score']-_0x4550f1['score']),_0x51272c[_0x29ad72(0x204)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x4aa3c8){const _0x863251=_0x485b;await this[_0x863251(0x1e9)](_0x4aa3c8);},async 'stop'(){},'count'(){const _0x3de000=_0x485b;return _0x483b75[_0x3de000(0x1ef)];},'info'(){const _0x5e7017=_0x485b;return{'algorithm':_0x5e7017(0x160),'count':_0x483b75[_0x5e7017(0x1ef)]};}};};function _0x8bf7ac(_0x592ee7,_0x29e130){const _0x34c7a3=_0x485b;let _0x24f948=0x0,_0x58aa1f=0x0,_0x3a9c84=0x0;for(let _0x1f452e=0x0;_0x1f452e<_0x592ee7[_0x34c7a3(0x20d)];_0x1f452e++){_0x24f948+=_0x592ee7[_0x1f452e]*_0x29e130[_0x1f452e],_0x58aa1f+=_0x592ee7[_0x1f452e]*_0x592ee7[_0x1f452e],_0x3a9c84+=_0x29e130[_0x1f452e]*_0x29e130[_0x1f452e];}const _0x16fa07=Math['sqrt'](_0x58aa1f)*Math[_0x34c7a3(0x198)](_0x3a9c84);return _0x16fa07===0x0?0x0:_0x24f948/_0x16fa07;}return flat;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x37c317=require$$0,_0x30cc9f=require$$1,_0x10e3d5=requireSnapshotStore(),_0x551db4=requireLabelMap(),_0x4a88e8=0x1;let _0x4f626d=null;function _0x4aba8d(){const _0x39b5d9=_0x485b;if(_0x4f626d)return _0x4f626d;try{return _0x4f626d=require(_0x39b5d9(0x1c8)),_0x4f626d;}catch(_0x148b4c){const _0x281b25=new Error(_0x39b5d9(0x1ad)+(_0x39b5d9(0x1d2)+process['versions'][_0x39b5d9(0x203)]+_0x39b5d9(0x1a2)+process[_0x39b5d9(0x1c2)]+'/'+process[_0x39b5d9(0x1d7)]+'.\x20')+_0x39b5d9(0x210)+(_0x39b5d9(0x1aa)+(_0x148b4c?.[_0x39b5d9(0x1e2)]||String(_0x148b4c))));_0x281b25[_0x39b5d9(0x1b6)]=_0x39b5d9(0x1a4),_0x281b25['cause']=_0x148b4c;throw _0x281b25;}}function _0x5eb77c(_0x4c4812,_0x3307b0){const _0x261524=_0x485b;switch(_0x4c4812){case _0x261524(0x1a6):return _0x3307b0[_0x261524(0x1f7)][_0x261524(0x1ed)];case'l2':return _0x3307b0[_0x261524(0x1f7)]['L2sq'];case'ip':return _0x3307b0[_0x261524(0x1f7)]['IP'];default:return _0x3307b0[_0x261524(0x1f7)][_0x261524(0x1ed)];}}return usearch=function _0x209994(_0xce4ca4={},{dims:_0xd96649,dir:_0x3ab4ab}){const _0x166a56=_0x485b,_0x5e48cc=_0x4aba8d();if(!_0xd96649||_0xd96649<=0x0)throw new Error(_0x166a56(0x163));if(!_0x3ab4ab)throw new Error(_0x166a56(0x196));const _0x50bc6b={'metric':_0xce4ca4[_0x166a56(0x20a)]??_0x166a56(0x1a6),'connectivity':_0xce4ca4[_0x166a56(0x1a8)]??0x10,'expansionAdd':_0xce4ca4[_0x166a56(0x197)]??0x80,'expansionSearch':_0xce4ca4['expansionSearch']??0x40,'snapshotEveryChanges':_0xce4ca4['snapshotEveryChanges']??0xc350,'keepSnapshots':_0xce4ca4['keepSnapshots']??0x2,'tmpMaxAgeMs':_0xce4ca4[_0x166a56(0x199)]??0x6*0x36ee80,'heartbeatIntervalMs':_0xce4ca4[_0x166a56(0x1f2)]??0x1388,'writerLockMaxAgeMs':_0xce4ca4[_0x166a56(0x16a)]??0x3a98,'viewRefreshMs':_0xce4ca4['viewRefreshMs']??0x3e8},_0x7fd6df=new _0x10e3d5({'dir':_0x3ab4ab,'keepSnapshots':_0x50bc6b['keepSnapshots']}),_0x1bec97=_0x30cc9f['join'](_0x3ab4ab,'WRITER.LOCK');let _0x5475e3=new _0x551db4(),_0x2c85bb=null,_0x4a238d=0x0,_0x26d870=null,_0x1f2138=![],_0x1e2937=null,_0x47d0f2=null,_0x169acd=0x0,_0x1e5275=![],_0x50815a=Promise['resolve']();const _0x4ebfb5=_0x518838=>{const _0x52023f=_0x166a56;return _0x50815a=_0x50815a[_0x52023f(0x190)](_0x518838),_0x50815a;};function _0x4e969c(){const _0x2779d3=_0x166a56;return new _0x5e48cc[(_0x2779d3(0x18c))]({'dimensions':_0xd96649,'metric':_0x5eb77c(_0x50bc6b['metric'],_0x5e48cc),'quantization':_0x5e48cc['ScalarKind'][_0x2779d3(0x1cb)],'connectivity':_0x50bc6b[_0x2779d3(0x1a8)],'expansion_add':_0x50bc6b[_0x2779d3(0x197)],'expansion_search':_0x50bc6b[_0x2779d3(0x1e6)],'multi':![]});}function _0x3da839(_0x2f9eaa){return _0x2f9eaa instanceof Float32Array?_0x2f9eaa:new Float32Array(_0x2f9eaa);}function _0x256d60(){const _0x13f0d2=_0x166a56,_0x2f1345=JSON[_0x13f0d2(0x195)]({'pid':process[_0x13f0d2(0x1c4)],'at':Date[_0x13f0d2(0x1b4)]()}),_0x80bd17=()=>{const _0x2d24e2=_0x13f0d2;try{const _0x2b8986=_0x37c317[_0x2d24e2(0x1dd)](_0x1bec97,'wx');return _0x37c317[_0x2d24e2(0x166)](_0x2b8986,_0x2f1345),_0x37c317[_0x2d24e2(0x1fb)](_0x2b8986),!![];}catch(_0x5f3c4c){if(_0x5f3c4c?.[_0x2d24e2(0x1b6)]==='EEXIST')return![];throw _0x5f3c4c;}};if(_0x80bd17())return!![];try{const _0x3cfeda=JSON[_0x13f0d2(0x217)](_0x37c317[_0x13f0d2(0x1f9)](_0x1bec97,'utf8')),_0x4d35b7=Date[_0x13f0d2(0x1b4)]()-(_0x3cfeda['at']??0x0);if(_0x4d35b7<_0x50bc6b[_0x13f0d2(0x16a)])return![];}catch{}try{_0x37c317['unlinkSync'](_0x1bec97);}catch{}return _0x80bd17();}function _0x4c1a53(){const _0x52ce1a=_0x166a56;if(_0x1e2937)clearInterval(_0x1e2937);_0x1e2937=setInterval(()=>{const _0x365ef3=_0x485b;try{_0x37c317['writeFileSync'](_0x1bec97,JSON[_0x365ef3(0x195)]({'pid':process['pid'],'at':Date[_0x365ef3(0x1b4)]()}));}catch{}},_0x50bc6b[_0x52ce1a(0x1f2)]),_0x1e2937['unref']();}function _0x5f247d(){const _0x487845=_0x166a56;_0x1e2937&&(clearInterval(_0x1e2937),_0x1e2937=null);try{const _0x3644e6=JSON[_0x487845(0x217)](_0x37c317[_0x487845(0x1f9)](_0x1bec97,_0x487845(0x221)));if(_0x3644e6[_0x487845(0x1c4)]===process[_0x487845(0x1c4)])_0x37c317[_0x487845(0x187)](_0x1bec97);}catch{}}async function _0x207dec(_0x525685){const _0x572aeb=_0x166a56;_0x5475e3=new _0x551db4(),await _0x5475e3[_0x572aeb(0x21c)](),_0x2c85bb=_0x4e969c();const _0xf01351=_0x525685?await _0x525685():[];for(const {key:_0x6a6282,vector:_0x26f710}of _0xf01351){if(!(_0x26f710 instanceof Float32Array)||_0x26f710['length']!==_0xd96649)continue;const _0x347c29=_0x5475e3[_0x572aeb(0x184)](_0x6a6282);_0x2c85bb[_0x572aeb(0x1c1)](BigInt(_0x347c29),_0x26f710);}_0x4a238d=0x0;}async function _0x89c8fa(_0xc71a9c){const _0x532f39=_0x166a56;if(!_0x2c85bb||!_0xc71a9c)return![];const _0x585da9=await _0x7fd6df['publishSnapshot'](_0xc71a9c,async _0x53e1ea=>{const _0x42faaf=_0x485b;_0x2c85bb[_0x42faaf(0x1d0)](_0x53e1ea['index']),await _0x5475e3[_0x42faaf(0x21e)](_0x53e1ea[_0x42faaf(0x1e3)]),_0x37c317['writeFileSync'](_0x53e1ea['state'],JSON[_0x42faaf(0x195)]({'manifestVersion':_0x4a88e8,'algorithm':_0x42faaf(0x1c8),'dims':_0xd96649,'metric':_0x50bc6b[_0x42faaf(0x20a)],'clock':_0xc71a9c,'snapshotAt':Date[_0x42faaf(0x1b4)]()},null,0x2));},{'keep':_0x50bc6b['keepSnapshots']});if(_0x585da9?.[_0x532f39(0x1de)])_0x4a238d=0x0;return _0x585da9?.[_0x532f39(0x1de)]??![];}async function _0x3d8604(){const _0x2c71e8=_0x166a56,_0x72a218=_0x7fd6df[_0x2c71e8(0x1f4)]()||_0x7fd6df[_0x2c71e8(0x1bd)]();if(!_0x72a218)return null;let _0x58f0ad,_0x37e2a8=![];return await _0x7fd6df[_0x2c71e8(0x1e4)](_0x72a218,async _0x51b1d3=>{const _0x51e8ea=_0x2c71e8;_0x58f0ad=JSON[_0x51e8ea(0x217)](_0x37c317['readFileSync'](_0x51b1d3[_0x51e8ea(0x18d)],_0x51e8ea(0x221)));if(_0x58f0ad[_0x51e8ea(0x182)]!==_0x4a88e8||_0x58f0ad['algorithm']!==_0x51e8ea(0x1c8)||_0x58f0ad[_0x51e8ea(0x208)]!==_0xd96649||_0x58f0ad['metric']!==_0x50bc6b['metric']){_0x58f0ad=null;return;}_0x5475e3=new _0x551db4(),await _0x5475e3[_0x51e8ea(0x209)](_0x51b1d3[_0x51e8ea(0x1e3)]),_0x2c85bb=_0x4e969c(),_0x2c85bb[_0x51e8ea(0x1e9)](_0x51b1d3[_0x51e8ea(0x18a)]),_0x37e2a8=!![];}),_0x37e2a8?_0x58f0ad?.[_0x2c71e8(0x19c)]??0x0:null;}async function _0x137d12(_0x7540cb){const _0x444025=_0x166a56;if(!_0x7540cb)return![];let _0x4f042d=![];try{await _0x7fd6df[_0x444025(0x1e4)](_0x7540cb,async _0x596a6e=>{const _0x4e3545=_0x444025,_0x3ed8f0=JSON[_0x4e3545(0x217)](_0x37c317[_0x4e3545(0x1f9)](_0x596a6e[_0x4e3545(0x18d)],_0x4e3545(0x221)));if(_0x3ed8f0[_0x4e3545(0x182)]!==_0x4a88e8||_0x3ed8f0[_0x4e3545(0x17b)]!==_0x4e3545(0x1c8)||_0x3ed8f0[_0x4e3545(0x208)]!==_0xd96649||_0x3ed8f0['metric']!==_0x50bc6b[_0x4e3545(0x20a)])return;const _0x20e94d=new _0x551db4();await _0x20e94d[_0x4e3545(0x209)](_0x596a6e['labels']);const _0x3c7e0d=_0x4e969c();_0x3c7e0d[_0x4e3545(0x222)](_0x596a6e['index']),_0x2c85bb=_0x3c7e0d,_0x5475e3=_0x20e94d,_0x47d0f2=_0x7540cb,_0x4f042d=!![];});}catch{}return _0x4f042d;}async function _0x453592(_0x4f4430){try{await _0x137d12(_0x4f4430);}finally{_0x1e5275=![];}}function _0xb8d4d2(){const _0x18aabd=_0x166a56,_0x28f847=Date['now']();if(_0x28f847-_0x169acd<_0x50bc6b[_0x18aabd(0x21d)])return;_0x169acd=_0x28f847;if(_0x1e5275)return;const _0x47b20b=_0x7fd6df[_0x18aabd(0x1f4)]()||_0x7fd6df[_0x18aabd(0x1bd)]();if(!_0x47b20b||_0x47b20b===_0x47d0f2)return;_0x1e5275=!![],_0x453592(_0x47b20b);}async function _0x311cfe(){_0x1f2138=!![],_0x4c1a53();if(_0x47d0f2)try{const _0x61072f=new _0x551db4();let _0x2ce5e9=![];await _0x7fd6df['loadSnapshot'](_0x47d0f2,async _0x72f679=>{const _0x2212e9=_0x485b;await _0x61072f[_0x2212e9(0x209)](_0x72f679[_0x2212e9(0x1e3)]);const _0x36251b=_0x4e969c();_0x36251b[_0x2212e9(0x1e9)](_0x72f679['index']),_0x2c85bb=_0x36251b,_0x5475e3=_0x61072f,_0x2ce5e9=!![];});if(_0x2ce5e9)return;}catch{}await _0x207dec(_0x26d870);}return{async 'load'(_0x32cf3c){return _0x4ebfb5(async()=>{const _0x2788c0=_0x485b;_0x7fd6df[_0x2788c0(0x172)]({'maxAgeMs':_0x50bc6b[_0x2788c0(0x199)]}),_0x26d870=_0x32cf3c??null,_0x1f2138=_0x256d60();if(_0x1f2138){_0x4c1a53();const _0x158769=await _0x3d8604();if(_0x158769!=null)return _0x158769;return await _0x207dec(_0x32cf3c),null;}const _0x335e81=_0x7fd6df[_0x2788c0(0x1f4)]()||_0x7fd6df[_0x2788c0(0x1bd)]();return await _0x137d12(_0x335e81),null;});},async 'add'(_0xb5b201,_0x13756a,_0x508f9b){return _0x4ebfb5(async()=>{const _0x246295=_0x485b;if(!_0x1f2138){if(!_0x256d60())return;await _0x311cfe();}if(!_0x2c85bb)return;const _0x271227=_0x5475e3[_0x246295(0x1ce)](_0xb5b201);if(_0x271227!==undefined)try{_0x2c85bb[_0x246295(0x19f)](BigInt(_0x271227));}catch{}const _0x4c9944=_0x5475e3[_0x246295(0x184)](_0xb5b201);_0x2c85bb['add'](BigInt(_0x4c9944),_0x3da839(_0x13756a)),_0x4a238d++,_0x4a238d>=_0x50bc6b[_0x246295(0x18f)]&&await _0x89c8fa(_0x508f9b??Date['now']());});},async 'remove'(_0x3462c8){return _0x4ebfb5(async()=>{const _0x56de7c=_0x485b;if(!_0x1f2138){if(!_0x256d60())return;await _0x311cfe();}if(!_0x2c85bb)return;const _0x869006=_0x5475e3[_0x56de7c(0x1ce)](_0x3462c8);if(_0x869006===undefined)return;try{_0x2c85bb[_0x56de7c(0x19f)](BigInt(_0x869006));}catch{}_0x5475e3['tombstone'](_0x3462c8),_0x4a238d++;});},'search'(_0xd86672,{limit:limit=0xa}={}){const _0x6ca62a=_0x166a56;if(!_0x1f2138)_0xb8d4d2();if(!_0x2c85bb)return[];const _0x3d9b07=_0x2c85bb[_0x6ca62a(0x1ef)]();if(_0x3d9b07===0x0)return[];const _0x5e355a=Math[_0x6ca62a(0x1f1)](limit,_0x3d9b07),_0x39df1d=_0x2c85bb[_0x6ca62a(0x17f)](_0x3da839(_0xd86672),_0x5e355a,0x0),_0x404fbe=[],_0x326135=_0x39df1d[_0x6ca62a(0x1bf)],_0x32e301=_0x39df1d[_0x6ca62a(0x1d4)];for(let _0x3feeaa=0x0;_0x3feeaa<_0x326135['length'];_0x3feeaa++){const _0x13a5b8=_0x326135[_0x3feeaa];if(_0x13a5b8===0xffffffffffffffffn)continue;const _0xb3ecd5=Number(_0x13a5b8),_0x543fbe=_0x5475e3[_0x6ca62a(0x168)](_0xb3ecd5);if(!_0x543fbe)continue;const _0x7f065b=_0x32e301[_0x3feeaa];let _0x5176ea;if(_0x50bc6b['metric']==='cosine')_0x5176ea=Math['max'](0x0,0x1-_0x7f065b);else{if(_0x50bc6b[_0x6ca62a(0x20a)]==='ip')_0x5176ea=-_0x7f065b;else _0x5176ea=0x1/(0x1+_0x7f065b);}_0x404fbe['push']({'key':_0x543fbe,'score':_0x5176ea});}return _0x404fbe;},async 'snapshot'(_0x59c506=Date[_0x166a56(0x1b4)]()){if(!_0x1f2138)return![];return _0x4ebfb5(()=>_0x89c8fa(_0x59c506));},async 'rebuild'(_0x1c2ed4){if(!_0x1f2138)return;return _0x4ebfb5(()=>{if(_0x1c2ed4!=null)_0x26d870=_0x1c2ed4;return _0x207dec(_0x1c2ed4??_0x26d870);});},async 'stop'(){return _0x4ebfb5(async()=>{const _0x24b73e=_0x485b;_0x1f2138&&(await _0x89c8fa(Date[_0x24b73e(0x1b4)]()),_0x5f247d());});},'count'(){const _0x3a4e91=_0x166a56;return _0x5475e3[_0x3a4e91(0x1ef)]();},'info'(){const _0x3977c4=_0x166a56;return{'algorithm':'usearch','role':_0x1f2138?_0x3977c4(0x1b2):_0x3977c4(0x1b8),'metric':_0x50bc6b['metric'],'connectivity':_0x50bc6b[_0x3977c4(0x1a8)],'expansionAdd':_0x50bc6b['expansionAdd'],'expansionSearch':_0x50bc6b['expansionSearch'],'count':_0x5475e3[_0x3977c4(0x1ef)](),'size':_0x2c85bb?.[_0x3977c4(0x1ef)]?.()??0x0,'capacity':_0x2c85bb?.['capacity']?.()??0x0,'changesSince':_0x1f2138?_0x4a238d:null,'viewedSnapshot':_0x47d0f2??null,'snapshotDir':_0x3ab4ab,'latestSnapshot':_0x7fd6df[_0x3977c4(0x1f4)]()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function _0x41a1(){const _0x5c22b2=['usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','expansionAdd','sqrt','tmpMaxAgeMs','readIndexSync',').\x20','clock','1302985rOBRIM','tombstoneCount','remove','keepSnapshots','lockPath','\x20on\x20','dir','USEARCH_BINDINGS_UNAVAILABLE','set','cosine','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','connectivity','.tmp-','Original\x20error:\x20','publishSnapshot','randomBytes','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','snapshot','prototype','push','_tmp-','writer','5068OJzagk','now','info','code','delete','reader','isFinite','keyToLabel','hostname','hex','latestSnapshotId','readdirSync','keys','333gYEREO','add','platform','vector','pid','69752sAntmh','6gvMDWt','isDirectory','usearch','currentPath','getMaxElements','F32','mtimeMs','Unknown\x20algorithm:\x20\x22','labelForExisting','EEXIST','save','get','for\x20Node\x20','labels.json','distances','snapshot\x20id\x20required','vectors','arch','key','markDelete','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','isInteger','SNAPSHOT.LOCK','openSync','published','84ZVsyfo','177eZLHCX','opts','message','labels','loadSnapshot','CURRENT','expansionSearch','addPoint','Unknown\x20op:\x20\x22','load','searchKnn','host','ready','Cos','rmSync','size','postMessage','min','heartbeatIntervalMs','s,\x20pid:\x20','readCurrentId','queryVec','hnswlib-node','MetricKind','resolve','readFileSync','sort','closeSync','maxElements','worker_threads',',\x20host:\x20','prune','stop','renameSync','__esModule','node','slice','542010yvWpgQ','ceil','hnsw','dims','loadFrom','metric','toString','HierarchicalNSW','length','crypto','hasOwnProperty','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20','snapshot\x20incomplete:\x20','nextLabel','round','SnapshotStore\x20requires\x20dir','existsSync','mkdirSync','parse','clear','exports','startsWith','[SnapshotStore]','reset','viewRefreshMs','snapshotTo','statSync','map','utf8','view','warn','max','name','writeIndexSync','default','memoryUsage','_snapshotDir','flat','efConstruction','cause','usearch\x20algorithm\x20requires\x20dims\x20>\x200','initIndex','rebuild','writeFileSync','index.hnsw','keyForLabel','_snapshotPaths','writerLockMaxAgeMs','getCurrentCount','growFactor','831EIkMYf','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','join','entries','cleanupTmpDirs','HNSW_BINDINGS_UNAVAILABLE','call','efSearch','candidateClock\x20must\x20be\x20finite\x20>=\x200','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','repeat','log','snapshotsDir','algorithm','sync','77511QVDvNf','isArray','search','labelToKey','tombstone','manifestVersion','198ASAggc','labelForEphemeral','setEf','from','unlinkSync','readCurrentClock','count','index','trim','Index','state','1520387IZDcRZ','snapshotEveryChanges','then','_tombstoneCount','listSnapshotIds','state.json','trunc','stringify'];_0x41a1=function(){return _0x5c22b2;};return _0x41a1();}function requireAlgorithmWorkerThread(){const _0xf90c02=_0x1b10ba;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x253785,workerData:_0x2773bc}=require$$0$1,{algorithmName:_0x53350f,algorithmConfig:_0x1c8f79,dims:_0x1925c5,dir:_0x52f0b8}=_0x2773bc;let _0x3ac3d3;if(_0x53350f===_0xf90c02(0x207))_0x3ac3d3=requireHnsw()(_0x1c8f79,{'dims':_0x1925c5,'dir':_0x52f0b8});else{if(_0x53350f===_0xf90c02(0x160))_0x3ac3d3=requireFlat()(_0x1c8f79,{'dims':_0x1925c5,'dir':_0x52f0b8});else{if(_0x53350f===_0xf90c02(0x1c8))_0x3ac3d3=requireUsearch()(_0x1c8f79,{'dims':_0x1925c5,'dir':_0x52f0b8});else throw new Error(_0xf90c02(0x1cd)+_0x53350f+'\x22');}}function _0xd5fde1(){const _0x4d89ef=_0xf90c02;try{_0x253785[_0x4d89ef(0x1f0)]({'op':_0x4d89ef(0x17c),'count':_0x3ac3d3[_0x4d89ef(0x189)](),'info':_0x3ac3d3[_0x4d89ef(0x1b5)](),'memory':process[_0x4d89ef(0x15e)]()});}catch{}}return _0x253785['on'](_0xf90c02(0x1e2),async _0x432dac=>{const _0x40441c=_0xf90c02,{id:_0x52f05a,op:_0x397c9e,args:_0x2c7706}=_0x432dac;try{let _0x3762ca;switch(_0x397c9e){case'load':{const _0x20096f=(_0x2c7706[_0x40441c(0x1d6)]||[])[_0x40441c(0x220)](_0x346be5=>({'key':_0x346be5[_0x40441c(0x1d8)],'vector':_0x346be5['vector']instanceof Float32Array?_0x346be5[_0x40441c(0x1c3)]:new Float32Array(_0x346be5['vector'])}));_0x3762ca=await _0x3ac3d3[_0x40441c(0x1e9)](async()=>_0x20096f),_0xd5fde1();break;}case'add':{const _0x3e47ad=_0x2c7706[_0x40441c(0x1c3)]instanceof Float32Array?_0x2c7706['vector']:new Float32Array(_0x2c7706[_0x40441c(0x1c3)]);await _0x3ac3d3[_0x40441c(0x1c1)](_0x2c7706[_0x40441c(0x1d8)],_0x3e47ad,_0x2c7706[_0x40441c(0x19c)]??undefined),_0xd5fde1(),_0x3762ca=null;break;}case _0x40441c(0x19f):{await _0x3ac3d3[_0x40441c(0x19f)](_0x2c7706[_0x40441c(0x1d8)]),_0xd5fde1(),_0x3762ca=null;break;}case _0x40441c(0x17f):{const _0x3b9824=_0x2c7706['queryVec']instanceof Float32Array?_0x2c7706[_0x40441c(0x1f5)]:new Float32Array(_0x2c7706[_0x40441c(0x1f5)]);_0x3762ca=_0x3ac3d3[_0x40441c(0x17f)](_0x3b9824,_0x2c7706[_0x40441c(0x1e1)]||{});break;}case _0x40441c(0x1ae):{_0x3762ca=await _0x3ac3d3['snapshot'](_0x2c7706[_0x40441c(0x19c)]),_0xd5fde1();break;}case _0x40441c(0x165):{const _0x439210=(_0x2c7706[_0x40441c(0x1d6)]||[])[_0x40441c(0x220)](_0x358605=>({'key':_0x358605[_0x40441c(0x1d8)],'vector':_0x358605['vector']instanceof Float32Array?_0x358605[_0x40441c(0x1c3)]:new Float32Array(_0x358605[_0x40441c(0x1c3)])}));await _0x3ac3d3[_0x40441c(0x165)](async()=>_0x439210),_0xd5fde1(),_0x3762ca=null;break;}case _0x40441c(0x200):{await _0x3ac3d3[_0x40441c(0x200)](),_0xd5fde1(),_0x3762ca=null;break;}case _0x40441c(0x189):{_0x3762ca=_0x3ac3d3[_0x40441c(0x189)]();break;}case _0x40441c(0x1b5):{_0x3762ca=_0x3ac3d3[_0x40441c(0x1b5)]();break;}default:throw new Error(_0x40441c(0x1e8)+_0x397c9e+'\x22');}_0x253785[_0x40441c(0x1f0)]({'id':_0x52f05a,'result':_0x3762ca});}catch(_0x558a14){_0x253785[_0x40441c(0x1f0)]({'id':_0x52f05a,'error':{'message':_0x558a14?.[_0x40441c(0x1e2)]||String(_0x558a14),'code':_0x558a14?.[_0x40441c(0x1b6)]}});}}),_0x253785[_0xf90c02(0x1f0)]({'op':_0xf90c02(0x1ec)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module[_0x1b10ba(0x219)]=algorithmWorkerThread;
1
+ 'use strict';const _0x4ea323=_0x1eb2;(function(_0x5c9582,_0x3acca7){const _0x47e396=_0x1eb2,_0x31e27c=_0x5c9582();while(!![]){try{const _0x4c0aa8=parseInt(_0x47e396(0x137))/0x1*(parseInt(_0x47e396(0x19a))/0x2)+-parseInt(_0x47e396(0x17d))/0x3+-parseInt(_0x47e396(0x15b))/0x4+-parseInt(_0x47e396(0x145))/0x5*(parseInt(_0x47e396(0x159))/0x6)+-parseInt(_0x47e396(0x1ce))/0x7+-parseInt(_0x47e396(0x154))/0x8+-parseInt(_0x47e396(0x18a))/0x9*(-parseInt(_0x47e396(0x17f))/0xa);if(_0x4c0aa8===_0x3acca7)break;else _0x31e27c['push'](_0x31e27c['shift']());}catch(_0x5ebd08){_0x31e27c['push'](_0x31e27c['shift']());}}}(_0x372b,0x84538));function _0x372b(){const _0x4344eb=['min','index','isDirectory','rebuild','memoryUsage','ready','keepSnapshots','viewRefreshMs','mkdirSync','writerLockMaxAgeMs','lock_busy','usearch','_tombstoneCount','Breaking\x20stale\x20snapshot\x20lock\x20(age:\x20','initIndex','utf8','cleanupTmpDirs',',\x20host:\x20','remove','loadSnapshot','F32','call','HNSW\x20algorithm\x20unavailable:\x20the\x20native\x20\x22hnswlib-node\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','_snapshotDir','randomBytes','trunc','WRITER.LOCK','tombstone','latestSnapshotId','sort','flat','452522RgziRl','sqrt','labels','labels.json','efConstruction','set','node','sync','writeFileSync','from','lockPath','loadFrom','currentPath','keys','closeSync','prune','index.hnsw','startsWith','for\x20Node\x20','CURRENT','snapshotsDir','capacity','nextLabel','readFileSync','efSearch','expansionSearch','Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22\x20instead.\x20','hex','stop','isArray','isFinite','hnsw\x20algorithm\x20requires\x20dims\x20>\x200','hnswlib-node','search','warn','join','Cos','map','path','max','1nfEvzy','delete','vectors','USEARCH_BINDINGS_UNAVAILABLE','cosine','labelToKey','candidateClock\x20must\x20be\x20finite\x20>=\x200','SnapshotStore\x20requires\x20dir','snapshot\x20id\x20required','arch','growFactor','Unknown\x20algorithm:\x20\x22','Index','readdirSync','5XircYL','connectivity','HierarchicalNSW','ceil','length','Original\x20error:\x20','resolve','algorithm','tombstoneCount','metric','info','push','then','reset','stale','2360032UydIVb','heartbeatIntervalMs','writer','queryVec','load','5719578CFBRps','view','3448444MAqVkj','distances','dir','name','code','dims','pid','rmSync','_snapshotPaths','key','getCurrentCount','labelForExisting','labelForEphemeral','get','postMessage','existsSync','publishSnapshot','clear','entries','.tmp','.tmp-','HNSW_BINDINGS_UNAVAILABLE','parse','setEf','ScalarKind','usearch\x20algorithm\x20requires\x20dims\x20>\x200','repeat','state.json','usearch\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','toString','openSync','snapshotTo','\x20on\x20','now','1493604QKrAzl','mtimeMs','511930aljwWR','searchKnn','expansionAdd','MetricKind','Unknown\x20op:\x20\x22','unref','add','state','versions','trim','readCurrentId','387jTKayF','slice','getMaxElements','isInteger','count','readCurrentClock','markDelete','This\x20is\x20risky\x20on\x20slow\x20disks\x20or\x20overloaded\x20machines.\x20Consider\x20increasing\x20staleLockMaxAgeMs\x20if\x20this\x20happens\x20frequently.','size','snapshot\x20incomplete:\x20','statSync','listSnapshotIds','_tmp-','stringify','platform','keyForLabel','2027202zLKOKm','clock','unlinkSync','snapshots','hnsw','message','snapshotEveryChanges','default','vector','filter','crypto','keyToLabel','published','usearch\x20algorithm\x20unavailable:\x20the\x20native\x20\x22usearch\x22\x20bindings\x20could\x20not\x20be\x20loaded\x20','tmpMaxAgeMs','cause','snapshot','log','maxElements','hnsw\x20algorithm\x20requires\x20dir\x20for\x20snapshot\x20storage','score'];_0x372b=function(){return _0x4344eb;};return _0x372b();}var require$$0$1=require('worker_threads'),require$$0=require('fs'),require$$1=require(_0x4ea323(0x135)),require$$2=require('os'),require$$3=require(_0x4ea323(0x1a4));function getDefaultExportFromCjs(_0x3da8d6){const _0x3efcd0=_0x4ea323;return _0x3da8d6&&_0x3da8d6['__esModule']&&Object['prototype']['hasOwnProperty'][_0x3efcd0(0x1c4)](_0x3da8d6,'default')?_0x3da8d6[_0x3efcd0(0x1a1)]:_0x3da8d6;}var algorithmWorkerThread$1={},snapshotStore,hasRequiredSnapshotStore;function requireSnapshotStore(){const _0x538d47=_0x4ea323;if(hasRequiredSnapshotStore)return snapshotStore;hasRequiredSnapshotStore=0x1;const _0x3ee969=require$$0,_0x2130bc=require$$1,_0x41cf97=require$$2,_0x3272d8=require$$3;function _0x5de148(){const _0x44e2f0=_0x1eb2;return Date[_0x44e2f0(0x17c)]();}function _0x2b9f2f(_0x4951ae){const _0x4bc90a=_0x1eb2;try{return _0x3ee969[_0x4bc90a(0x16a)](_0x4951ae);}catch{return![];}}function _0x30f043(_0xf0a77b){const _0x43204=_0x1eb2;try{return _0x3ee969[_0x43204(0x1e5)](_0xf0a77b,_0x43204(0x1be));}catch{return null;}}function _0x2238c6(_0x1b927a,_0xc90e7a){const _0xd399ec=_0x1eb2,_0x35d0a2=_0x1b927a+'.tmp-'+_0x3272d8['randomBytes'](0x6)['toString'](_0xd399ec(0x1e9));_0x3ee969['writeFileSync'](_0x35d0a2,_0xc90e7a),_0x3ee969['renameSync'](_0x35d0a2,_0x1b927a);}function _0x3a164d(_0x5580fb,_0x25149f=0x10){const _0x53c907=_0x1eb2,_0xe0ab4b=String(Math[_0x53c907(0x136)](0x0,Math['trunc'](_0x5580fb||0x0)));return _0xe0ab4b[_0x53c907(0x149)]>=_0x25149f?_0xe0ab4b:'0'[_0x53c907(0x175)](_0x25149f-_0xe0ab4b[_0x53c907(0x149)])+_0xe0ab4b;}return snapshotStore=class _0x6cdb84{constructor({dir:_0x2a5e30,keepSnapshots:keepSnapshots=0x3,log:log=null}={}){const _0x2f2421=_0x1eb2;if(!_0x2a5e30)throw new Error(_0x2f2421(0x13e));this[_0x2f2421(0x15d)]=_0x2a5e30,this[_0x2f2421(0x1e2)]=_0x2130bc[_0x2f2421(0x1f1)](_0x2a5e30,_0x2f2421(0x19d)),this[_0x2f2421(0x1da)]=_0x2130bc[_0x2f2421(0x1f1)](_0x2a5e30,_0x2f2421(0x1e1)),this[_0x2f2421(0x1d8)]=_0x2130bc['join'](_0x2a5e30,'SNAPSHOT.LOCK'),this['keepSnapshots']=keepSnapshots,this['log']=log,_0x3ee969[_0x2f2421(0x1b7)](this[_0x2f2421(0x15d)],{'recursive':!![]}),_0x3ee969[_0x2f2421(0x1b7)](this['snapshotsDir'],{'recursive':!![]});}[_0x538d47(0x1c6)](_0xbb1bcc){const _0x245590=_0x538d47;return _0x2130bc[_0x245590(0x1f1)](this['snapshotsDir'],_0xbb1bcc);}[_0x538d47(0x163)](_0x32a987){const _0xd2bbdc=_0x538d47,_0x3980d9=this[_0xd2bbdc(0x1c6)](_0x32a987);return{'dir':_0x3980d9,'index':_0x2130bc['join'](_0x3980d9,_0xd2bbdc(0x1de)),'labels':_0x2130bc[_0xd2bbdc(0x1f1)](_0x3980d9,_0xd2bbdc(0x1d1)),'state':_0x2130bc[_0xd2bbdc(0x1f1)](_0x3980d9,'state.json')};}[_0x538d47(0x189)](){const _0x4172a4=_0x538d47;if(!_0x2b9f2f(this[_0x4172a4(0x1da)]))return null;const _0x4b70f3=_0x30f043(this[_0x4172a4(0x1da)]);if(!_0x4b70f3)return null;const _0x438879=String(_0x4b70f3)[_0x4172a4(0x188)]();return _0x438879||null;}[_0x538d47(0x18f)](){const _0x476226=_0x538d47,_0x4d75cf=this[_0x476226(0x189)]();if(!_0x4d75cf)return 0x0;const _0x40598d=Number(_0x4d75cf);return Number['isFinite'](_0x40598d)?_0x40598d:0x0;}[_0x538d47(0x195)](){const _0x9a8300=_0x538d47;try{return _0x3ee969[_0x9a8300(0x144)](this[_0x9a8300(0x1e2)],{'withFileTypes':!![]})[_0x9a8300(0x1a3)](_0x22e8a0=>_0x22e8a0[_0x9a8300(0x1b1)]())[_0x9a8300(0x134)](_0x4059a7=>_0x4059a7[_0x9a8300(0x15e)])['filter'](_0x2a54bd=>!_0x2a54bd['startsWith'](_0x9a8300(0x16f)))[_0x9a8300(0x1a3)](_0x8cb1e5=>!_0x8cb1e5[_0x9a8300(0x1df)]('_tmp-'))[_0x9a8300(0x1cc)]();}catch{return[];}}[_0x538d47(0x1cb)](){const _0x5424f3=_0x538d47,_0x2fd4a9=this[_0x5424f3(0x189)]();if(_0x2fd4a9)return _0x2fd4a9;const _0x5ae22e=this[_0x5424f3(0x195)]();if(!_0x5ae22e['length'])return null;return _0x5ae22e[_0x5ae22e[_0x5424f3(0x149)]-0x1];}[_0x538d47(0x1bf)]({maxAgeMs:maxAgeMs=0x6*0x36ee80}={}){const _0x1249ff=_0x538d47;let _0xddb498;try{_0xddb498=_0x3ee969[_0x1249ff(0x144)](this[_0x1249ff(0x1e2)],{'withFileTypes':!![]});}catch{return;}const _0x81bdaf=_0x5de148()-maxAgeMs;for(const _0x41476c of _0xddb498){if(!_0x41476c['isDirectory']())continue;const _0x3b8cfb=_0x41476c[_0x1249ff(0x15e)];if(!_0x3b8cfb[_0x1249ff(0x1df)](_0x1249ff(0x16f))&&!_0x3b8cfb[_0x1249ff(0x1df)](_0x1249ff(0x196)))continue;const _0x106e45=_0x2130bc[_0x1249ff(0x1f1)](this[_0x1249ff(0x1e2)],_0x3b8cfb);try{const _0x35182c=_0x3ee969[_0x1249ff(0x194)](_0x106e45);if(_0x35182c[_0x1249ff(0x17e)]>_0x81bdaf)continue;}catch{}try{_0x3ee969[_0x1249ff(0x162)](_0x106e45,{'recursive':!![],'force':!![]});}catch{}}}['prune']({keep:keep=null}={}){const _0x1df731=_0x538d47,_0x2b54b4=Math[_0x1df731(0x136)](0x1,Math[_0x1df731(0x1c8)](keep??this[_0x1df731(0x1b5)]??0x3)),_0xb44e89=this[_0x1df731(0x195)]();if(_0xb44e89[_0x1df731(0x149)]<=_0x2b54b4)return;const _0x81e2e6=this[_0x1df731(0x189)](),_0x1f152d=_0xb44e89[_0x1df731(0x18b)](0x0,Math[_0x1df731(0x136)](0x0,_0xb44e89['length']-_0x2b54b4));for(const _0x17876d of _0x1f152d){if(_0x81e2e6&&_0x17876d===_0x81e2e6)continue;const _0x48b13e=this[_0x1df731(0x1c6)](_0x17876d);try{_0x3ee969[_0x1df731(0x162)](_0x48b13e,{'recursive':!![],'force':!![]});}catch{}}}async[_0x538d47(0x1c2)](_0x1824a4,_0x22e76d){const _0x2eaf81=_0x538d47;if(!_0x1824a4)throw new Error(_0x2eaf81(0x13f));const _0x394930=this[_0x2eaf81(0x163)](_0x1824a4);if(!_0x2b9f2f(_0x394930[_0x2eaf81(0x1b0)])||!_0x2b9f2f(_0x394930[_0x2eaf81(0x1d0)])||!_0x2b9f2f(_0x394930[_0x2eaf81(0x186)]))throw new Error(_0x2eaf81(0x193)+_0x1824a4);const _0x1dd040=await _0x22e76d(_0x394930);return _0x1dd040||{};}async['publishSnapshot'](_0x475622,_0x55f893,{keep:keep=null,lockTimeoutMs:lockTimeoutMs=0x0,staleLockMaxAgeMs:staleLockMaxAgeMs=0xea60}={}){const _0x38e9a4=_0x538d47,_0x2ef018=Number(_0x475622);if(!Number[_0x38e9a4(0x1ec)](_0x2ef018)||_0x2ef018<0x0)throw new Error(_0x38e9a4(0x13d));const _0x497dbf=_0x3a164d(_0x2ef018),_0xcda8d6=this['_snapshotDir'](_0x497dbf),_0x172dca=_0x2130bc[_0x38e9a4(0x1f1)](this[_0x38e9a4(0x1e2)],_0x38e9a4(0x16f)+_0x497dbf+'-'+_0x3272d8[_0x38e9a4(0x1c7)](0x6)[_0x38e9a4(0x178)](_0x38e9a4(0x1e9)));_0x3ee969[_0x38e9a4(0x1b7)](_0x172dca,{'recursive':!![]});const _0x4a90db={'dir':_0x172dca,'index':_0x2130bc[_0x38e9a4(0x1f1)](_0x172dca,_0x38e9a4(0x1de)),'labels':_0x2130bc[_0x38e9a4(0x1f1)](_0x172dca,_0x38e9a4(0x1d1)),'state':_0x2130bc['join'](_0x172dca,_0x38e9a4(0x176))};await _0x55f893(_0x4a90db,{'id':_0x497dbf,'clock':_0x2ef018});const _0x837b74=JSON[_0x38e9a4(0x197)]({'pid':process[_0x38e9a4(0x161)],'host':_0x41cf97['hostname'](),'at':_0x5de148()}),_0x4af2fc=_0x5de148();let _0x2e5191=null;const _0x931019=()=>{const _0x4b4594=_0x38e9a4;try{const _0x2926db=JSON[_0x4b4594(0x171)](_0x3ee969['readFileSync'](this[_0x4b4594(0x1d8)],_0x4b4594(0x1be)));if(_0x2926db['at']&&_0x5de148()-_0x2926db['at']>staleLockMaxAgeMs){const _0x5f3b00=_0x5de148()-_0x2926db['at'],_0x42557b=_0x4b4594(0x1bc)+Math['round'](_0x5f3b00/0x3e8)+'s,\x20pid:\x20'+_0x2926db[_0x4b4594(0x161)]+_0x4b4594(0x1c0)+_0x2926db['host']+').\x20'+_0x4b4594(0x191);this[_0x4b4594(0x1ab)]?.[_0x4b4594(0x1f0)]?this[_0x4b4594(0x1ab)][_0x4b4594(0x1f0)](_0x42557b):console[_0x4b4594(0x1f0)]('[SnapshotStore]',_0x42557b);try{_0x3ee969['unlinkSync'](this['lockPath']);}catch{}return!![];}}catch{try{_0x3ee969['unlinkSync'](this[_0x4b4594(0x1d8)]);}catch{}}return![];},_0x5c6d3a=()=>{const _0x47c7bc=_0x38e9a4;try{return _0x2e5191=_0x3ee969['openSync'](this[_0x47c7bc(0x1d8)],'wx'),_0x3ee969[_0x47c7bc(0x1d6)](_0x2e5191,_0x837b74),!![];}catch(_0x3e19a4){if(_0x3e19a4&&_0x3e19a4[_0x47c7bc(0x15f)]==='EEXIST')return![];throw _0x3e19a4;}};if(!_0x5c6d3a()){_0x931019(),_0x5c6d3a();if(_0x2e5191==null&&lockTimeoutMs>0x0)while(_0x5de148()-_0x4af2fc<lockTimeoutMs){await new Promise(_0x1a9d8e=>setTimeout(_0x1a9d8e,0x19));if(_0x5c6d3a())break;_0x931019();}}if(_0x2e5191==null){try{_0x3ee969[_0x38e9a4(0x162)](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x38e9a4(0x1b9)};}try{const _0x5d1017=this[_0x38e9a4(0x18f)]();if(_0x2ef018<=_0x5d1017){try{_0x3ee969[_0x38e9a4(0x162)](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return{'published':![],'reason':_0x38e9a4(0x153),'currentClock':_0x5d1017};}if(!_0x2b9f2f(_0xcda8d6))_0x3ee969['renameSync'](_0x172dca,_0xcda8d6);else try{_0x3ee969['rmSync'](_0x172dca,{'recursive':!![],'force':!![]});}catch{}return _0x2238c6(this['currentPath'],_0x497dbf+'\x0a'),this[_0x38e9a4(0x1dd)]({'keep':keep}),{'published':!![],'currentClock':_0x2ef018};}finally{try{_0x3ee969[_0x38e9a4(0x1dc)](_0x2e5191);}catch{}try{_0x3ee969[_0x38e9a4(0x19c)](this['lockPath']);}catch{}}}},snapshotStore;}var labelMap,hasRequiredLabelMap;function requireLabelMap(){const _0x12626a=_0x4ea323;if(hasRequiredLabelMap)return labelMap;hasRequiredLabelMap=0x1;const _0x490b9c=require$$0;class _0x25342a{constructor(){const _0x226539=_0x1eb2;this[_0x226539(0x1a5)]=new Map(),this[_0x226539(0x13c)]=new Map(),this[_0x226539(0x1e4)]=0x0,this[_0x226539(0x1bb)]=0x0;}async[_0x12626a(0x152)](){const _0x56fafe=_0x12626a;this['keyToLabel']=new Map(),this[_0x56fafe(0x13c)]=new Map(),this[_0x56fafe(0x1e4)]=0x0,this[_0x56fafe(0x1bb)]=0x0;}async['loadFrom'](_0x21fc47){const _0x43836b=_0x12626a;if(!_0x21fc47||!_0x490b9c[_0x43836b(0x16a)](_0x21fc47))return await this['reset'](),!![];let _0x4726da;try{_0x4726da=_0x490b9c['readFileSync'](_0x21fc47,_0x43836b(0x1be));}catch{return await this['reset'](),!![];}let _0x3bb6c7;try{_0x3bb6c7=JSON[_0x43836b(0x171)](_0x4726da);}catch{return await this[_0x43836b(0x152)](),!![];}const _0x84cd95=Array[_0x43836b(0x1eb)](_0x3bb6c7?.['entries'])?_0x3bb6c7[_0x43836b(0x16d)]:[],_0x2709c1=Number[_0x43836b(0x18d)](_0x3bb6c7?.[_0x43836b(0x1e4)])?_0x3bb6c7['nextLabel']:0x0,_0x1d85ba=new Map(),_0x31d5a1=new Map();let _0x46dac4=-0x1;for(const _0x2c51f3 of _0x84cd95){if(!Array[_0x43836b(0x1eb)](_0x2c51f3)||_0x2c51f3[_0x43836b(0x149)]!==0x2)continue;const _0x59898b=Number(_0x2c51f3[0x0]),_0x757519=String(_0x2c51f3[0x1]??'');if(!Number[_0x43836b(0x18d)](_0x59898b)||_0x59898b<0x0)continue;if(!_0x757519)continue;_0x1d85ba['set'](_0x757519,_0x59898b),_0x31d5a1[_0x43836b(0x1d3)](_0x59898b,_0x757519);if(_0x59898b>_0x46dac4)_0x46dac4=_0x59898b;}return this[_0x43836b(0x1a5)]=_0x1d85ba,this[_0x43836b(0x13c)]=_0x31d5a1,this[_0x43836b(0x1e4)]=Math['max'](_0x2709c1,_0x46dac4+0x1,0x0),this['_tombstoneCount']=0x0,!![];}[_0x12626a(0x166)](_0x228ba2){const _0x506a3f=_0x12626a;return this[_0x506a3f(0x1a5)][_0x506a3f(0x168)](_0x228ba2);}[_0x12626a(0x167)](_0x444c24){const _0x447f63=_0x12626a;let _0x17510e=this[_0x447f63(0x1a5)][_0x447f63(0x168)](_0x444c24);if(_0x17510e!==undefined)return _0x17510e;return _0x17510e=this[_0x447f63(0x1e4)]++,this['keyToLabel']['set'](_0x444c24,_0x17510e),this[_0x447f63(0x13c)][_0x447f63(0x1d3)](_0x17510e,_0x444c24),_0x17510e;}[_0x12626a(0x1ca)](_0x21fa5f){const _0x134314=_0x12626a,_0x45bb07=this[_0x134314(0x1a5)][_0x134314(0x168)](_0x21fa5f);if(_0x45bb07===undefined)return;this[_0x134314(0x1a5)][_0x134314(0x138)](_0x21fa5f),this['labelToKey']['delete'](_0x45bb07),this[_0x134314(0x1bb)]++;}[_0x12626a(0x199)](_0x5f0544){const _0x422631=_0x12626a;return this[_0x422631(0x13c)]['get'](_0x5f0544)??null;}[_0x12626a(0x192)](){const _0x4ba32d=_0x12626a;return this[_0x4ba32d(0x1a5)][_0x4ba32d(0x192)];}[_0x12626a(0x14d)](){return this['_tombstoneCount'];}async[_0x12626a(0x17a)](_0x1ff704){const _0x54dc9a=_0x12626a,_0x13fbe1=_0x1ff704+_0x54dc9a(0x16e),_0x49c69e=[];for(const [_0xb6a581,_0x433436]of this[_0x54dc9a(0x13c)][_0x54dc9a(0x16d)]()){_0x49c69e[_0x54dc9a(0x150)]([_0xb6a581,_0x433436]);}_0x49c69e[_0x54dc9a(0x1cc)]((_0x106296,_0x24befd)=>_0x106296[0x0]-_0x24befd[0x0]);const _0x3ef6c9={'version':0x1,'nextLabel':this['nextLabel'],'entries':_0x49c69e};_0x490b9c[_0x54dc9a(0x1d6)](_0x13fbe1,JSON[_0x54dc9a(0x197)](_0x3ef6c9)),_0x490b9c['renameSync'](_0x13fbe1,_0x1ff704);}}return labelMap=_0x25342a,labelMap;}var hnsw,hasRequiredHnsw;function requireHnsw(){if(hasRequiredHnsw)return hnsw;hasRequiredHnsw=0x1;const _0x25af06=requireSnapshotStore(),_0x2d933e=requireLabelMap(),_0x5a3e30=0x1;let _0x3a6af7=null;function _0x2dd5c8(){const _0xd3a3ac=_0x1eb2;if(_0x3a6af7)return _0x3a6af7;try{return _0x3a6af7=require(_0xd3a3ac(0x1ee)),_0x3a6af7;}catch(_0x57a455){const _0x373fdf=new Error(_0xd3a3ac(0x1c5)+(_0xd3a3ac(0x1e0)+process[_0xd3a3ac(0x187)][_0xd3a3ac(0x1d4)]+_0xd3a3ac(0x17b)+process[_0xd3a3ac(0x198)]+'/'+process['arch']+'.\x20')+_0xd3a3ac(0x1e8)+('Original\x20error:\x20'+(_0x57a455?.['message']||String(_0x57a455))));_0x373fdf['code']=_0xd3a3ac(0x170),_0x373fdf[_0xd3a3ac(0x1a9)]=_0x57a455;throw _0x373fdf;}}return hnsw=function _0x26ba16(_0x4bf6e4={},{dims:_0x287c47,dir:_0x300dd3}){const _0x5cfeec=_0x1eb2,_0x3cd347=_0x2dd5c8();if(!_0x287c47||_0x287c47<=0x0)throw new Error(_0x5cfeec(0x1ed));if(!_0x300dd3)throw new Error(_0x5cfeec(0x1ad));const _0x10266f={'metric':_0x4bf6e4[_0x5cfeec(0x14e)]??_0x5cfeec(0x13b),'M':_0x4bf6e4['M']??0x10,'efConstruction':_0x4bf6e4[_0x5cfeec(0x1d2)]??0xc8,'efSearch':_0x4bf6e4['efSearch']??0x40,'maxElements':_0x4bf6e4[_0x5cfeec(0x1ac)]??0x400,'growFactor':_0x4bf6e4[_0x5cfeec(0x141)]??0x2,'snapshotEveryChanges':_0x4bf6e4[_0x5cfeec(0x1a0)]??0xc350,'keepSnapshots':_0x4bf6e4['keepSnapshots']??0x2,'tmpMaxAgeMs':_0x4bf6e4[_0x5cfeec(0x1a8)]??0x6*0x36ee80},_0x1fb9e0=new _0x25af06({'dir':_0x300dd3,'keepSnapshots':_0x10266f[_0x5cfeec(0x1b5)]}),_0x4185a9=new _0x2d933e();let _0x25dad9=null,_0x2e4f0c=0x0,_0xbb1945=null,_0x31bab1=Promise[_0x5cfeec(0x14b)]();const _0x459065=_0xaa9a37=>{const _0x2709ea=_0x5cfeec;return _0x31bab1=_0x31bab1[_0x2709ea(0x151)](_0xaa9a37),_0x31bab1;};async function _0x58a19d(_0x4db443){const _0x3d0a3d=_0x5cfeec;await _0x4185a9['reset']();const _0x4af788=_0x4db443?await _0x4db443():[],_0x2ed9a3=Math[_0x3d0a3d(0x136)](_0x10266f[_0x3d0a3d(0x1ac)],Math['ceil'](_0x4af788['length']*(_0x10266f[_0x3d0a3d(0x141)]||1.2)),0x1);_0x25dad9=new _0x3cd347[(_0x3d0a3d(0x147))](_0x10266f['metric'],_0x287c47),_0x25dad9[_0x3d0a3d(0x1bd)]({'maxElements':_0x2ed9a3,'efConstruction':_0x10266f['efConstruction'],'M':_0x10266f['M']});for(const {key:_0x33f418,vector:_0x57abdb}of _0x4af788){if(!(_0x57abdb instanceof Float32Array)||_0x57abdb[_0x3d0a3d(0x149)]!==_0x287c47)continue;const _0xc93291=_0x4185a9[_0x3d0a3d(0x167)](_0x33f418);_0x25dad9['addPoint'](Array[_0x3d0a3d(0x1d7)](_0x57abdb),_0xc93291);}_0x25dad9[_0x3d0a3d(0x172)](_0x10266f[_0x3d0a3d(0x1e6)]),_0x2e4f0c=0x0;}async function _0x259199(_0x44349c){const _0x374416=_0x5cfeec;if(!_0x25dad9||!_0x44349c)return![];const _0x20a981=await _0x1fb9e0[_0x374416(0x16b)](_0x44349c,async _0x4dbce5=>{const _0x47508d=_0x374416;_0x25dad9['writeIndexSync'](_0x4dbce5[_0x47508d(0x1b0)]),await _0x4185a9[_0x47508d(0x17a)](_0x4dbce5['labels']);const _0x245a13=require$$0;_0x245a13[_0x47508d(0x1d6)](_0x4dbce5['state'],JSON[_0x47508d(0x197)]({'manifestVersion':_0x5a3e30,'dims':_0x287c47,'metric':_0x10266f[_0x47508d(0x14e)],'clock':_0x44349c,'snapshotAt':Date['now']()},null,0x2));},{'keep':_0x10266f[_0x374416(0x1b5)]});if(_0x20a981?.['published'])_0x2e4f0c=0x0;return _0x20a981?.[_0x374416(0x1a6)]??![];}async function _0x2dd110(){const _0x16f0eb=_0x5cfeec,_0x4e8f39=_0x1fb9e0['readCurrentId']()||_0x1fb9e0[_0x16f0eb(0x1cb)]();if(!_0x4e8f39)return null;let _0x17da4a,_0x3a459c=![];return await _0x1fb9e0[_0x16f0eb(0x1c2)](_0x4e8f39,async _0x2878d6=>{const _0x5b90be=_0x16f0eb,_0x1103d1=require$$0;_0x17da4a=JSON['parse'](_0x1103d1[_0x5b90be(0x1e5)](_0x2878d6[_0x5b90be(0x186)],'utf8'));if(_0x17da4a['manifestVersion']!==_0x5a3e30||_0x17da4a[_0x5b90be(0x160)]!==_0x287c47||_0x17da4a[_0x5b90be(0x14e)]!==_0x10266f[_0x5b90be(0x14e)]){_0x17da4a=null;return;}await _0x4185a9['loadFrom'](_0x2878d6[_0x5b90be(0x1d0)]),_0x25dad9=new _0x3cd347[(_0x5b90be(0x147))](_0x10266f[_0x5b90be(0x14e)],_0x287c47),_0x25dad9['readIndexSync'](_0x2878d6[_0x5b90be(0x1b0)]),_0x25dad9[_0x5b90be(0x172)](_0x10266f[_0x5b90be(0x1e6)]),_0x3a459c=!![];}),_0x3a459c?_0x17da4a?.[_0x16f0eb(0x19b)]??0x0:null;}return{async 'load'(_0x349aeb){return _0x459065(async()=>{const _0x56c441=_0x1eb2;_0x1fb9e0[_0x56c441(0x1bf)]({'maxAgeMs':_0x10266f[_0x56c441(0x1a8)]}),_0xbb1945=_0x349aeb??null;const _0x52adb8=await _0x2dd110();if(_0x52adb8!=null)return _0x52adb8;return await _0x58a19d(_0x349aeb),null;});},async 'add'(_0x198f63,_0xdf241d,_0x23db45){return _0x459065(async()=>{const _0x3f7fee=_0x1eb2;if(!_0x25dad9)return;const _0x204b0a=_0x4185a9[_0x3f7fee(0x167)](_0x198f63);try{_0x25dad9[_0x3f7fee(0x190)](_0x204b0a);}catch{}_0x25dad9['getCurrentCount']()>=_0x25dad9['getMaxElements']()&&(_0x10266f['maxElements']=Math[_0x3f7fee(0x148)](_0x25dad9[_0x3f7fee(0x18c)]()*(_0x10266f[_0x3f7fee(0x141)]||0x2)),await _0x58a19d(_0xbb1945)),_0x25dad9['addPoint'](Array['from'](_0xdf241d),_0x204b0a),_0x2e4f0c++,_0x2e4f0c>=_0x10266f[_0x3f7fee(0x1a0)]&&await _0x259199(_0x23db45??Date[_0x3f7fee(0x17c)]());});},async 'remove'(_0x1859a7){return _0x459065(async()=>{const _0x40f199=_0x1eb2;if(!_0x25dad9)return;const _0x335acd=_0x4185a9[_0x40f199(0x166)](_0x1859a7);if(_0x335acd===undefined)return;try{_0x25dad9[_0x40f199(0x190)](_0x335acd);}catch{}_0x4185a9[_0x40f199(0x1ca)](_0x1859a7),_0x2e4f0c++;});},'search'(_0x40eb60,{limit:limit=0xa,efSearch:_0x12b6b6}={}){const _0x3653f9=_0x5cfeec;if(!_0x25dad9)return[];if(Number[_0x3653f9(0x18d)](_0x12b6b6))_0x25dad9[_0x3653f9(0x172)](_0x12b6b6);const _0x269e36=Math[_0x3653f9(0x1af)](limit,_0x25dad9[_0x3653f9(0x165)]()||0x1),{neighbors:_0x1735b5,distances:_0x33ef1a}=_0x25dad9[_0x3653f9(0x180)](Array['from'](_0x40eb60),_0x269e36),_0x9d88b9=[];for(let _0x4ef37f=0x0;_0x4ef37f<_0x1735b5[_0x3653f9(0x149)];_0x4ef37f++){const _0x5f0d45=_0x4185a9[_0x3653f9(0x199)](_0x1735b5[_0x4ef37f]);if(!_0x5f0d45)continue;const _0x217fe5=_0x10266f[_0x3653f9(0x14e)]==='cosine'?Math[_0x3653f9(0x136)](0x0,0x1-_0x33ef1a[_0x4ef37f]):0x1/(0x1+_0x33ef1a[_0x4ef37f]);_0x9d88b9[_0x3653f9(0x150)]({'key':_0x5f0d45,'score':_0x217fe5});}return _0x9d88b9;},async 'snapshot'(_0x2a29bd=Date[_0x5cfeec(0x17c)]()){return _0x459065(()=>_0x259199(_0x2a29bd));},async 'rebuild'(_0x3bd0f4){return _0x459065(()=>{if(_0x3bd0f4!=null)_0xbb1945=_0x3bd0f4;return _0x58a19d(_0x3bd0f4??_0xbb1945);});},async 'stop'(){const _0x51737e=_0x5cfeec;return _0x459065(()=>_0x259199(Date[_0x51737e(0x17c)]()));},'count'(){const _0x423eb2=_0x5cfeec;return _0x4185a9[_0x423eb2(0x192)]();},'info'(){const _0x326c97=_0x5cfeec;return{'algorithm':_0x326c97(0x19e),'metric':_0x10266f[_0x326c97(0x14e)],'M':_0x10266f['M'],'efConstruction':_0x10266f[_0x326c97(0x1d2)],'efSearch':_0x10266f[_0x326c97(0x1e6)],'maxElements':_0x25dad9?.['getMaxElements']()??_0x10266f[_0x326c97(0x1ac)],'count':_0x4185a9[_0x326c97(0x192)](),'changesSince':_0x2e4f0c,'snapshotDir':_0x300dd3,'latestSnapshot':_0x1fb9e0[_0x326c97(0x189)]()??null};}};},hnsw;}function _0x1eb2(_0x3727a6,_0x27f81d){_0x3727a6=_0x3727a6-0x134;const _0x372b61=_0x372b();let _0x1eb2c7=_0x372b61[_0x3727a6];return _0x1eb2c7;}var flat,hasRequiredFlat;function requireFlat(){if(hasRequiredFlat)return flat;hasRequiredFlat=0x1,flat=function _0x2c7fe5(_0x121e57={}){const _0x929b39=new Map();return{async 'load'(_0xe7864b){const _0x934888=_0x1eb2;_0x929b39[_0x934888(0x16c)]();if(_0xe7864b)for(const {key:_0x1fa720,vector:_0x540f89}of await _0xe7864b()){_0x929b39[_0x934888(0x1d3)](_0x1fa720,_0x540f89);}},async 'add'(_0x57cc58,_0x1d1011,_0x5a6407){const _0x341b45=_0x1eb2;_0x929b39[_0x341b45(0x1d3)](_0x57cc58,_0x1d1011);},async 'remove'(_0x18c893){const _0x597c59=_0x1eb2;_0x929b39[_0x597c59(0x138)](_0x18c893);},'search'(_0x4efed1,{limit:limit=0xa,threshold:threshold=0x0}={}){const _0x19ec01=_0x1eb2,_0xedfbd1=[];for(const [_0x31b033,_0x3bf2e]of _0x929b39){const _0x43002f=_0x25710d(_0x4efed1,_0x3bf2e);if(_0x43002f>=threshold)_0xedfbd1[_0x19ec01(0x150)]({'key':_0x31b033,'score':_0x43002f});}return _0xedfbd1['sort']((_0x5a0014,_0x43e846)=>_0x43e846[_0x19ec01(0x1ae)]-_0x5a0014[_0x19ec01(0x1ae)]),_0xedfbd1[_0x19ec01(0x18b)](0x0,limit);},async 'snapshot'(){return![];},async 'rebuild'(_0x105f0e){await this['load'](_0x105f0e);},async 'stop'(){},'count'(){const _0x2dad9b=_0x1eb2;return _0x929b39[_0x2dad9b(0x192)];},'info'(){const _0x48c867=_0x1eb2;return{'algorithm':_0x48c867(0x1cd),'count':_0x929b39[_0x48c867(0x192)]};}};};function _0x25710d(_0x3159f5,_0x5589af){const _0x2b9d5e=_0x1eb2;let _0x35a137=0x0,_0x4c911f=0x0,_0x16546f=0x0;for(let _0x4f3936=0x0;_0x4f3936<_0x3159f5[_0x2b9d5e(0x149)];_0x4f3936++){_0x35a137+=_0x3159f5[_0x4f3936]*_0x5589af[_0x4f3936],_0x4c911f+=_0x3159f5[_0x4f3936]*_0x3159f5[_0x4f3936],_0x16546f+=_0x5589af[_0x4f3936]*_0x5589af[_0x4f3936];}const _0x57b7ab=Math[_0x2b9d5e(0x1cf)](_0x4c911f)*Math['sqrt'](_0x16546f);return _0x57b7ab===0x0?0x0:_0x35a137/_0x57b7ab;}return flat;}var usearch,hasRequiredUsearch;function requireUsearch(){if(hasRequiredUsearch)return usearch;hasRequiredUsearch=0x1;const _0x25345d=require$$0,_0x3f4e78=require$$1,_0x3d4d6f=requireSnapshotStore(),_0x519845=requireLabelMap(),_0x2ed3c7=0x1;let _0x460068=null;function _0x35d644(){const _0x2b879c=_0x1eb2;if(_0x460068)return _0x460068;try{return _0x460068=require(_0x2b879c(0x1ba)),_0x460068;}catch(_0x1c11cc){const _0x385249=new Error(_0x2b879c(0x1a7)+('for\x20Node\x20'+process['versions'][_0x2b879c(0x1d4)]+_0x2b879c(0x17b)+process[_0x2b879c(0x198)]+'/'+process[_0x2b879c(0x140)]+'.\x20')+'Install\x20compatible\x20bindings\x20or\x20use\x20algorithm\x20\x22flat\x22/\x22hnsw\x22\x20instead.\x20'+(_0x2b879c(0x14a)+(_0x1c11cc?.['message']||String(_0x1c11cc))));_0x385249[_0x2b879c(0x15f)]=_0x2b879c(0x13a),_0x385249['cause']=_0x1c11cc;throw _0x385249;}}function _0xc1fbaa(_0x2f339a,_0x59c97e){const _0x5008f9=_0x1eb2;switch(_0x2f339a){case _0x5008f9(0x13b):return _0x59c97e[_0x5008f9(0x182)][_0x5008f9(0x1f2)];case'l2':return _0x59c97e[_0x5008f9(0x182)]['L2sq'];case'ip':return _0x59c97e[_0x5008f9(0x182)]['IP'];default:return _0x59c97e['MetricKind'][_0x5008f9(0x1f2)];}}return usearch=function _0x5da9e5(_0x53c512={},{dims:_0x41be7d,dir:_0x43b6a5}){const _0x5e39ab=_0x1eb2,_0x2eb8cf=_0x35d644();if(!_0x41be7d||_0x41be7d<=0x0)throw new Error(_0x5e39ab(0x174));if(!_0x43b6a5)throw new Error(_0x5e39ab(0x177));const _0x535bc6={'metric':_0x53c512[_0x5e39ab(0x14e)]??'cosine','connectivity':_0x53c512['connectivity']??0x10,'expansionAdd':_0x53c512[_0x5e39ab(0x181)]??0x80,'expansionSearch':_0x53c512[_0x5e39ab(0x1e7)]??0x40,'snapshotEveryChanges':_0x53c512[_0x5e39ab(0x1a0)]??0xc350,'keepSnapshots':_0x53c512[_0x5e39ab(0x1b5)]??0x2,'tmpMaxAgeMs':_0x53c512[_0x5e39ab(0x1a8)]??0x6*0x36ee80,'heartbeatIntervalMs':_0x53c512[_0x5e39ab(0x155)]??0x1388,'writerLockMaxAgeMs':_0x53c512[_0x5e39ab(0x1b8)]??0x3a98,'viewRefreshMs':_0x53c512[_0x5e39ab(0x1b6)]??0x3e8},_0x4dea6e=new _0x3d4d6f({'dir':_0x43b6a5,'keepSnapshots':_0x535bc6[_0x5e39ab(0x1b5)]}),_0x1a30bc=_0x3f4e78[_0x5e39ab(0x1f1)](_0x43b6a5,_0x5e39ab(0x1c9));let _0x17c596=new _0x519845(),_0x2b914f=null,_0x500d9a=0x0,_0x107086=null,_0x367a06=![],_0xd113a5=null,_0x27c135=null,_0x2aff3d=0x0,_0x4d2c1e=![],_0x3e90ab=Promise[_0x5e39ab(0x14b)]();const _0x1401be=_0x578963=>{const _0x41840b=_0x5e39ab;return _0x3e90ab=_0x3e90ab[_0x41840b(0x151)](_0x578963),_0x3e90ab;};function _0x53473f(){const _0x4fadb2=_0x5e39ab;return new _0x2eb8cf[(_0x4fadb2(0x143))]({'dimensions':_0x41be7d,'metric':_0xc1fbaa(_0x535bc6[_0x4fadb2(0x14e)],_0x2eb8cf),'quantization':_0x2eb8cf[_0x4fadb2(0x173)][_0x4fadb2(0x1c3)],'connectivity':_0x535bc6[_0x4fadb2(0x146)],'expansion_add':_0x535bc6['expansionAdd'],'expansion_search':_0x535bc6[_0x4fadb2(0x1e7)],'multi':![]});}function _0x2dc5fe(_0x34f141){return _0x34f141 instanceof Float32Array?_0x34f141:new Float32Array(_0x34f141);}function _0x5ec6b7(){const _0x1a4b4b=_0x5e39ab,_0x2bebd5=JSON['stringify']({'pid':process[_0x1a4b4b(0x161)],'at':Date[_0x1a4b4b(0x17c)]()}),_0x590ffb=()=>{const _0x57446b=_0x1a4b4b;try{const _0x4803c2=_0x25345d[_0x57446b(0x179)](_0x1a30bc,'wx');return _0x25345d['writeFileSync'](_0x4803c2,_0x2bebd5),_0x25345d['closeSync'](_0x4803c2),!![];}catch(_0x148568){if(_0x148568?.[_0x57446b(0x15f)]==='EEXIST')return![];throw _0x148568;}};if(_0x590ffb())return!![];try{const _0x185fb9=JSON[_0x1a4b4b(0x171)](_0x25345d[_0x1a4b4b(0x1e5)](_0x1a30bc,_0x1a4b4b(0x1be))),_0x121b8e=Date['now']()-(_0x185fb9['at']??0x0);if(_0x121b8e<_0x535bc6[_0x1a4b4b(0x1b8)])return![];}catch{}try{_0x25345d[_0x1a4b4b(0x19c)](_0x1a30bc);}catch{}return _0x590ffb();}function _0x31db7a(){const _0x86f41a=_0x5e39ab;if(_0xd113a5)clearInterval(_0xd113a5);_0xd113a5=setInterval(()=>{const _0x362dd5=_0x1eb2;try{_0x25345d[_0x362dd5(0x1d6)](_0x1a30bc,JSON['stringify']({'pid':process[_0x362dd5(0x161)],'at':Date['now']()}));}catch{}},_0x535bc6['heartbeatIntervalMs']),_0xd113a5[_0x86f41a(0x184)]();}function _0x583338(){const _0x3380fd=_0x5e39ab;_0xd113a5&&(clearInterval(_0xd113a5),_0xd113a5=null);try{const _0x1f7fe7=JSON[_0x3380fd(0x171)](_0x25345d[_0x3380fd(0x1e5)](_0x1a30bc,_0x3380fd(0x1be)));if(_0x1f7fe7['pid']===process['pid'])_0x25345d['unlinkSync'](_0x1a30bc);}catch{}}async function _0x13b4b5(_0x41fac5){const _0x598a70=_0x5e39ab;_0x17c596=new _0x519845(),await _0x17c596[_0x598a70(0x152)](),_0x2b914f=_0x53473f();const _0xef83a7=_0x41fac5?await _0x41fac5():[];for(const {key:_0x51875d,vector:_0x598ab8}of _0xef83a7){if(!(_0x598ab8 instanceof Float32Array)||_0x598ab8[_0x598a70(0x149)]!==_0x41be7d)continue;const _0x4eddbc=_0x17c596[_0x598a70(0x167)](_0x51875d);_0x2b914f['add'](BigInt(_0x4eddbc),_0x598ab8);}_0x500d9a=0x0;}async function _0x7802c0(_0x2d3ebc){const _0x40e944=_0x5e39ab;if(!_0x2b914f||!_0x2d3ebc)return![];const _0x2b3365=await _0x4dea6e[_0x40e944(0x16b)](_0x2d3ebc,async _0x122453=>{const _0xb3b98e=_0x40e944;_0x2b914f['save'](_0x122453[_0xb3b98e(0x1b0)]),await _0x17c596[_0xb3b98e(0x17a)](_0x122453['labels']),_0x25345d[_0xb3b98e(0x1d6)](_0x122453[_0xb3b98e(0x186)],JSON['stringify']({'manifestVersion':_0x2ed3c7,'algorithm':'usearch','dims':_0x41be7d,'metric':_0x535bc6['metric'],'clock':_0x2d3ebc,'snapshotAt':Date[_0xb3b98e(0x17c)]()},null,0x2));},{'keep':_0x535bc6['keepSnapshots']});if(_0x2b3365?.[_0x40e944(0x1a6)])_0x500d9a=0x0;return _0x2b3365?.[_0x40e944(0x1a6)]??![];}async function _0x4cceb2(){const _0x48c6f6=_0x5e39ab,_0x6103eb=_0x4dea6e['readCurrentId']()||_0x4dea6e[_0x48c6f6(0x1cb)]();if(!_0x6103eb)return null;let _0x3b875c,_0x5fd6a0=![];return await _0x4dea6e['loadSnapshot'](_0x6103eb,async _0x26ce10=>{const _0x152da2=_0x48c6f6;_0x3b875c=JSON['parse'](_0x25345d[_0x152da2(0x1e5)](_0x26ce10[_0x152da2(0x186)],_0x152da2(0x1be)));if(_0x3b875c['manifestVersion']!==_0x2ed3c7||_0x3b875c[_0x152da2(0x14c)]!==_0x152da2(0x1ba)||_0x3b875c[_0x152da2(0x160)]!==_0x41be7d||_0x3b875c[_0x152da2(0x14e)]!==_0x535bc6[_0x152da2(0x14e)]){_0x3b875c=null;return;}_0x17c596=new _0x519845(),await _0x17c596[_0x152da2(0x1d9)](_0x26ce10[_0x152da2(0x1d0)]),_0x2b914f=_0x53473f(),_0x2b914f[_0x152da2(0x158)](_0x26ce10[_0x152da2(0x1b0)]),_0x5fd6a0=!![];}),_0x5fd6a0?_0x3b875c?.[_0x48c6f6(0x19b)]??0x0:null;}async function _0x16fb90(_0x32f430){const _0x5386a8=_0x5e39ab;if(!_0x32f430)return![];let _0x184308=![];try{await _0x4dea6e[_0x5386a8(0x1c2)](_0x32f430,async _0x59697a=>{const _0x37a9f8=_0x5386a8,_0xc5db1c=JSON[_0x37a9f8(0x171)](_0x25345d['readFileSync'](_0x59697a[_0x37a9f8(0x186)],'utf8'));if(_0xc5db1c['manifestVersion']!==_0x2ed3c7||_0xc5db1c['algorithm']!==_0x37a9f8(0x1ba)||_0xc5db1c[_0x37a9f8(0x160)]!==_0x41be7d||_0xc5db1c['metric']!==_0x535bc6[_0x37a9f8(0x14e)])return;const _0x286954=new _0x519845();await _0x286954[_0x37a9f8(0x1d9)](_0x59697a[_0x37a9f8(0x1d0)]);const _0x3a97a6=_0x53473f();_0x3a97a6[_0x37a9f8(0x15a)](_0x59697a[_0x37a9f8(0x1b0)]),_0x2b914f=_0x3a97a6,_0x17c596=_0x286954,_0x27c135=_0x32f430,_0x184308=!![];});}catch{}return _0x184308;}async function _0x1cc2dd(_0x40c7b3){try{await _0x16fb90(_0x40c7b3);}finally{_0x4d2c1e=![];}}function _0x497e81(){const _0xe620e=_0x5e39ab,_0x1e703d=Date[_0xe620e(0x17c)]();if(_0x1e703d-_0x2aff3d<_0x535bc6[_0xe620e(0x1b6)])return;_0x2aff3d=_0x1e703d;if(_0x4d2c1e)return;const _0xc86013=_0x4dea6e['readCurrentId']()||_0x4dea6e[_0xe620e(0x1cb)]();if(!_0xc86013||_0xc86013===_0x27c135)return;_0x4d2c1e=!![],_0x1cc2dd(_0xc86013);}async function _0x4f7e1a(){const _0x56a2e9=_0x5e39ab;_0x367a06=!![],_0x31db7a();if(_0x27c135)try{const _0x331234=new _0x519845();let _0xbf608=![];await _0x4dea6e[_0x56a2e9(0x1c2)](_0x27c135,async _0x19363b=>{const _0xd48002=_0x56a2e9;await _0x331234[_0xd48002(0x1d9)](_0x19363b[_0xd48002(0x1d0)]);const _0x37dca6=_0x53473f();_0x37dca6[_0xd48002(0x158)](_0x19363b[_0xd48002(0x1b0)]),_0x2b914f=_0x37dca6,_0x17c596=_0x331234,_0xbf608=!![];});if(_0xbf608)return;}catch{}await _0x13b4b5(_0x107086);}return{async 'load'(_0xf2a397){return _0x1401be(async()=>{const _0x357583=_0x1eb2;_0x4dea6e[_0x357583(0x1bf)]({'maxAgeMs':_0x535bc6[_0x357583(0x1a8)]}),_0x107086=_0xf2a397??null,_0x367a06=_0x5ec6b7();if(_0x367a06){_0x31db7a();const _0x47b930=await _0x4cceb2();if(_0x47b930!=null)return _0x47b930;return await _0x13b4b5(_0xf2a397),null;}const _0x58f407=_0x4dea6e[_0x357583(0x189)]()||_0x4dea6e[_0x357583(0x1cb)]();return await _0x16fb90(_0x58f407),null;});},async 'add'(_0x2411ae,_0x461f0,_0x517e99){return _0x1401be(async()=>{const _0xf9efcb=_0x1eb2;if(!_0x367a06){if(!_0x5ec6b7())return;await _0x4f7e1a();}if(!_0x2b914f)return;const _0xd0538b=_0x17c596[_0xf9efcb(0x166)](_0x2411ae);if(_0xd0538b!==undefined)try{_0x2b914f[_0xf9efcb(0x1c1)](BigInt(_0xd0538b));}catch{}const _0x572ca4=_0x17c596[_0xf9efcb(0x167)](_0x2411ae);_0x2b914f[_0xf9efcb(0x185)](BigInt(_0x572ca4),_0x2dc5fe(_0x461f0)),_0x500d9a++,_0x500d9a>=_0x535bc6[_0xf9efcb(0x1a0)]&&await _0x7802c0(_0x517e99??Date[_0xf9efcb(0x17c)]());});},async 'remove'(_0x14fd96){return _0x1401be(async()=>{const _0xcec98a=_0x1eb2;if(!_0x367a06){if(!_0x5ec6b7())return;await _0x4f7e1a();}if(!_0x2b914f)return;const _0x763dcb=_0x17c596[_0xcec98a(0x166)](_0x14fd96);if(_0x763dcb===undefined)return;try{_0x2b914f['remove'](BigInt(_0x763dcb));}catch{}_0x17c596[_0xcec98a(0x1ca)](_0x14fd96),_0x500d9a++;});},'search'(_0x5f1d7a,{limit:limit=0xa}={}){const _0x496a06=_0x5e39ab;if(!_0x367a06)_0x497e81();if(!_0x2b914f)return[];const _0x4c19b1=_0x2b914f['size']();if(_0x4c19b1===0x0)return[];const _0x718828=Math['min'](limit,_0x4c19b1),_0x3589c4=_0x2b914f[_0x496a06(0x1ef)](_0x2dc5fe(_0x5f1d7a),_0x718828,0x0),_0x9b0f26=[],_0x1eb6da=_0x3589c4[_0x496a06(0x1db)],_0x49eae3=_0x3589c4[_0x496a06(0x15c)];for(let _0x2e560c=0x0;_0x2e560c<_0x1eb6da['length'];_0x2e560c++){const _0x29474a=_0x1eb6da[_0x2e560c];if(_0x29474a===0xffffffffffffffffn)continue;const _0x312c5e=Number(_0x29474a),_0x43e15d=_0x17c596[_0x496a06(0x199)](_0x312c5e);if(!_0x43e15d)continue;const _0x547a42=_0x49eae3[_0x2e560c];let _0x3da592;if(_0x535bc6['metric']===_0x496a06(0x13b))_0x3da592=Math['max'](0x0,0x1-_0x547a42);else{if(_0x535bc6[_0x496a06(0x14e)]==='ip')_0x3da592=-_0x547a42;else _0x3da592=0x1/(0x1+_0x547a42);}_0x9b0f26['push']({'key':_0x43e15d,'score':_0x3da592});}return _0x9b0f26;},async 'snapshot'(_0x410890=Date['now']()){if(!_0x367a06)return![];return _0x1401be(()=>_0x7802c0(_0x410890));},async 'rebuild'(_0x80f957){if(!_0x367a06)return;return _0x1401be(()=>{if(_0x80f957!=null)_0x107086=_0x80f957;return _0x13b4b5(_0x80f957??_0x107086);});},async 'stop'(){return _0x1401be(async()=>{const _0x484b80=_0x1eb2;_0x367a06&&(await _0x7802c0(Date[_0x484b80(0x17c)]()),_0x583338());});},'count'(){return _0x17c596['size']();},'info'(){const _0x250f6c=_0x5e39ab;return{'algorithm':'usearch','role':_0x367a06?_0x250f6c(0x156):'reader','metric':_0x535bc6[_0x250f6c(0x14e)],'connectivity':_0x535bc6['connectivity'],'expansionAdd':_0x535bc6['expansionAdd'],'expansionSearch':_0x535bc6[_0x250f6c(0x1e7)],'count':_0x17c596['size'](),'size':_0x2b914f?.[_0x250f6c(0x192)]?.()??0x0,'capacity':_0x2b914f?.[_0x250f6c(0x1e3)]?.()??0x0,'changesSince':_0x367a06?_0x500d9a:null,'viewedSnapshot':_0x27c135??null,'snapshotDir':_0x43b6a5,'latestSnapshot':_0x4dea6e['readCurrentId']()??null};}};},usearch;}var hasRequiredAlgorithmWorkerThread;function requireAlgorithmWorkerThread(){const _0x12cded=_0x4ea323;if(hasRequiredAlgorithmWorkerThread)return algorithmWorkerThread$1;hasRequiredAlgorithmWorkerThread=0x1;const {parentPort:_0x51119e,workerData:_0x11124b}=require$$0$1,{algorithmName:_0x27c341,algorithmConfig:_0x2c13c2,dims:_0x22cabf,dir:_0x4b6ecb}=_0x11124b;let _0x4d1228;if(_0x27c341===_0x12cded(0x19e))_0x4d1228=requireHnsw()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else{if(_0x27c341===_0x12cded(0x1cd))_0x4d1228=requireFlat()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else{if(_0x27c341===_0x12cded(0x1ba))_0x4d1228=requireUsearch()(_0x2c13c2,{'dims':_0x22cabf,'dir':_0x4b6ecb});else throw new Error(_0x12cded(0x142)+_0x27c341+'\x22');}}function _0x2a659c(){const _0x400286=_0x12cded;try{_0x51119e['postMessage']({'op':_0x400286(0x1d5),'count':_0x4d1228[_0x400286(0x18e)](),'info':_0x4d1228['info'](),'memory':process[_0x400286(0x1b3)]()});}catch{}}return _0x51119e['on'](_0x12cded(0x19f),async _0x10aac7=>{const _0x30f58f=_0x12cded,{id:_0x2ca237,op:_0x5c9e5f,args:_0x531655}=_0x10aac7;try{let _0xb0759f;switch(_0x5c9e5f){case _0x30f58f(0x158):{const _0x310604=(_0x531655[_0x30f58f(0x139)]||[])['map'](_0x4fae10=>({'key':_0x4fae10[_0x30f58f(0x164)],'vector':_0x4fae10['vector']instanceof Float32Array?_0x4fae10[_0x30f58f(0x1a2)]:new Float32Array(_0x4fae10[_0x30f58f(0x1a2)])}));_0xb0759f=await _0x4d1228[_0x30f58f(0x158)](async()=>_0x310604),_0x2a659c();break;}case _0x30f58f(0x185):{const _0x3f63b7=_0x531655[_0x30f58f(0x1a2)]instanceof Float32Array?_0x531655[_0x30f58f(0x1a2)]:new Float32Array(_0x531655[_0x30f58f(0x1a2)]);await _0x4d1228['add'](_0x531655[_0x30f58f(0x164)],_0x3f63b7,_0x531655['clock']??undefined),_0x2a659c(),_0xb0759f=null;break;}case _0x30f58f(0x1c1):{await _0x4d1228[_0x30f58f(0x1c1)](_0x531655[_0x30f58f(0x164)]),_0x2a659c(),_0xb0759f=null;break;}case'search':{const _0x2c4812=_0x531655['queryVec']instanceof Float32Array?_0x531655[_0x30f58f(0x157)]:new Float32Array(_0x531655[_0x30f58f(0x157)]);_0xb0759f=_0x4d1228['search'](_0x2c4812,_0x531655['opts']||{});break;}case _0x30f58f(0x1aa):{_0xb0759f=await _0x4d1228[_0x30f58f(0x1aa)](_0x531655[_0x30f58f(0x19b)]),_0x2a659c();break;}case _0x30f58f(0x1b2):{const _0x3316b5=(_0x531655[_0x30f58f(0x139)]||[])[_0x30f58f(0x134)](_0x3ca4a5=>({'key':_0x3ca4a5[_0x30f58f(0x164)],'vector':_0x3ca4a5[_0x30f58f(0x1a2)]instanceof Float32Array?_0x3ca4a5[_0x30f58f(0x1a2)]:new Float32Array(_0x3ca4a5[_0x30f58f(0x1a2)])}));await _0x4d1228[_0x30f58f(0x1b2)](async()=>_0x3316b5),_0x2a659c(),_0xb0759f=null;break;}case _0x30f58f(0x1ea):{await _0x4d1228[_0x30f58f(0x1ea)](),_0x2a659c(),_0xb0759f=null;break;}case'count':{_0xb0759f=_0x4d1228[_0x30f58f(0x18e)]();break;}case _0x30f58f(0x14f):{_0xb0759f=_0x4d1228[_0x30f58f(0x14f)]();break;}default:throw new Error(_0x30f58f(0x183)+_0x5c9e5f+'\x22');}_0x51119e['postMessage']({'id':_0x2ca237,'result':_0xb0759f});}catch(_0x9e5349){_0x51119e['postMessage']({'id':_0x2ca237,'error':{'message':_0x9e5349?.[_0x30f58f(0x19f)]||String(_0x9e5349),'code':_0x9e5349?.[_0x30f58f(0x15f)]}});}}),_0x51119e[_0x12cded(0x169)]({'op':_0x12cded(0x1b4)}),algorithmWorkerThread$1;}var algorithmWorkerThreadExports=requireAlgorithmWorkerThread(),algorithmWorkerThread=getDefaultExportFromCjs(algorithmWorkerThreadExports);module['exports']=algorithmWorkerThread;