@moss-js/moss 1.16.0 → 1.16.1
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/dist/index.esm.js +1 -1
- package/dist/moss.d.ts +4 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0xb7ded2=_0xf7dd;(function(_0x346014,_0x35f986){const _0x4faaaf=_0xf7dd,_0x151dd3=_0x346014();while(!![]){try{const _0x2627a1=-parseInt(_0x4faaaf(0x16f))/0x1+-parseInt(_0x4faaaf(0x1d8))/0x2*(-parseInt(_0x4faaaf(0x17b))/0x3)+-parseInt(_0x4faaaf(0x18b))/0x4+parseInt(_0x4faaaf(0x1ae))/0x5+-parseInt(_0x4faaaf(0x18c))/0x6+parseInt(_0x4faaaf(0x196))/0x7+parseInt(_0x4faaaf(0x214))/0x8*(parseInt(_0x4faaaf(0x1f4))/0x9);if(_0x2627a1===_0x35f986)break;else _0x151dd3['push'](_0x151dd3['shift']());}catch(_0x2e7c15){_0x151dd3['push'](_0x151dd3['shift']());}}}(_0x4484,0x51fc6));import{JobStatus as _0x5f4ea8}from'@moss-js/moss-core';import*as _0x5e12ee from'@moss-js/moss-core';import*as _0x36bb09 from'@moss-js/moss-core';var g=_0x36bb09,le=g[_0xb7ded2(0x1f1)],me=g[_0xb7ded2(0x1ee)],he=g[_0xb7ded2(0x1af)],T=g[_0xb7ded2(0x205)],ge=typeof process<'u'&&process[_0xb7ded2(0x22c)][_0xb7ded2(0x193)]||g[_0xb7ded2(0x195)],_=typeof process<'u'?process['env']:{},I=class{constructor(_0x27b9ea,_0x375c47){const _0x4b7f61=_0xb7ded2;this[_0x4b7f61(0x217)]=_0x27b9ea,this[_0x4b7f61(0x23d)]=_0x375c47,this[_0x4b7f61(0x1d7)]=_['MOSS_AUTH_URL']??T;}[_0xb7ded2(0x217)];[_0xb7ded2(0x23d)];[_0xb7ded2(0x1d7)];async['getAuthToken'](){const _0x479cd1=_0xb7ded2;let _0x412600=await fetch(this[_0x479cd1(0x1d7)],{'method':_0x479cd1(0x1d0),'headers':{'Content-Type':_0x479cd1(0x17c)},'body':JSON[_0x479cd1(0x1cc)]({'projectId':this[_0x479cd1(0x217)],'projectKey':this['projectKey']}),'signal':AbortSignal[_0x479cd1(0x1e7)](0x7530)});if(_0x412600[_0x479cd1(0x17e)]===0x191){let _0x5a4d53=await _0x412600[_0x479cd1(0x22a)]();throw new Error(_0x479cd1(0x16e)+_0x5a4d53);}if(!_0x412600['ok']){let _0x2818ba=await _0x412600[_0x479cd1(0x22a)]();throw new Error(_0x479cd1(0x1f9)+_0x412600['status']+':\x20'+_0x2818ba);}let _0x3bfd17=await _0x412600[_0x479cd1(0x206)]();return{'token':_0x3bfd17[_0x479cd1(0x1fa)],'expiresIn':_0x3bfd17[_0x479cd1(0x21e)]};}async['getAuthHeader'](){const _0x3adba4=_0xb7ded2;let {token:_0x577aff}=await this[_0x3adba4(0x185)]();return _0x3adba4(0x1cd)+_0x577aff;}},y=class{constructor(_0x44a248){const _0x393ecf=_0xb7ded2;this[_0x393ecf(0x1a7)]=_0x44a248;}[_0xb7ded2(0x1a7)];['cache']=null;[_0xb7ded2(0x203)]=null;async[_0xb7ded2(0x185)](){const _0xb880ea=_0xb7ded2;if(this[_0xb880ea(0x23c)]&&this[_0xb880ea(0x23c)]['expiresAt']>Date['now']())return{'token':this[_0xb880ea(0x23c)][_0xb880ea(0x1fa)],'expiresIn':this[_0xb880ea(0x23c)]['expiresIn']};if(this[_0xb880ea(0x203)])return this['inflight'];this[_0xb880ea(0x203)]=this['fetchAndCache']();try{return await this[_0xb880ea(0x203)];}finally{this['inflight']=null;}}async['getAuthHeader'](){const _0x3bca43=_0xb7ded2;let {token:_0x11e978}=await this[_0x3bca43(0x185)]();return'Bearer\x20'+_0x11e978;}async[_0xb7ded2(0x23b)](){const _0x367346=_0xb7ded2;let {token:_0x49746e,expiresIn:_0x17c8b6}=await this[_0x367346(0x1a7)][_0x367346(0x185)](),_0x569c2f=Date['now']()+(_0x17c8b6-0x3c)*0x3e8;return this[_0x367346(0x23c)]={'token':_0x49746e,'expiresIn':_0x17c8b6,'expiresAt':_0x569c2f},{'token':_0x49746e,'expiresIn':_0x17c8b6};}};import{randomUUID as _0x48aa9b}from'node:crypto';import{existsSync as _0x315ff5,mkdirSync as _0x767e04,readFileSync as _0x165c89,writeFileSync as _0x20d990}from'node:fs';import{join as _0xa59d9a}from'node:path';function _0x4484(){const _0x595f31=['getDocs','projectId','getAuthHeader','deleteIndex','deviceIdentity','bind','failed','manageClient','expiresIn','queryMultiIndexText','delete','_create','sources','encode','PendingUpload','isSafeInteger','listWebSources','rejectAuthRequest','data','query','text','all','env','received\x20','indexName','includePaths','cachePath','Unsupported\x20data\x20type\x20for\x20file\x20upload','resync','rootUrl','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','call','parseDocuments','hasIndex','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','unloadIndexes','updated','fetchAndCache','cache','projectKey','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','custom','warn','join','getJobStatus','test','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','SessionIndex','alpha','identity','applySessionIdentity','string','loadModel','message','byteLength','Authentication\x20failed\x20(HTTP\x20401):\x20','497266ZTVQED','jobId','NOT_FOUND','close','keys','default','applyIdentity','startsWith','deleteDocs','requireMultiIndexCore','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','/v1/manage','261juHXPo','application/json','create','status','function','INVALID_ARGUMENT','modelArtifactContractVersion','userId','deleteWebSource','SessionIndex\x20\x27','getAuthToken','body','path','object','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','createIndex','2162012uNVucH','1720308VcVIoI','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','loadIndex','mossDeviceId','_fromInner','MOSS_CLOUD_API_BASE_URL','trim','MOSS_INDEX_URL','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','CLOUD_API_INDEX_URL','2434901acjFFO','code','queryMultiIndex','MossClient\x20is\x20closed','pushIndex','onProgress','session','slice','Unsupported\x20job\x20status\x20\x27','addDocumentsText','ManageClient','saveToDisk','completed','parse','createIndex\x20requires\x20at\x20least\x20one\x20document','loadIndexes','Building','inner','createIndexFromFiles','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','resolveAuthRequest','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','hasCustomAuthenticator','loadFromDisk','155705KvPUiE','CLOUD_API_IDENTITY_URL','authNotifyFn','minScore','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','withAuthenticator','Failed','entries','arrayBuffer','createAuthenticatedSessionInner','modelId','rebuildLegacy','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','refreshCadence','queryText','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','setIdentity','asyncDispose','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','added','https://service.usemoss.dev','Uploading','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','map','indexManager','manifestSha256','toByteArray','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','inspectSnapshot','stringify','Bearer\x20','embedding','fromEntries','POST','\x20contains\x20an\x20unsupported\x20character','isFinite','pendingupload','upsert','MossClient\x20options.identity\x20must\x20be\x20an\x20object','configuredIdentity','authUrl','1006wtrjDo','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','topK','IndexManager','MossClient\x20options.identity.','deviceId','wrapProgress','deleteDocuments','getIndex','moss-minilm','utf8','resyncWebSource','updateWebSource','isArray','currentPhase','timeout','cachePathDeviceId','_warmModel','docCount','getWebSource','\x27\x20is\x20closed','name','SDK_VERSION_NUMBER','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','createWebSource','MODEL_DOWNLOAD_URL','unloadIndex','parseOptions','11138004pfnJCR','deref','moss-core\x20rejected\x20the\x20auth\x20token:\x20','.moss-device-id','normalizeJobStatus','HTTP\x20','token','length','maxDocuments','replace','ensureCachePathDeviceId','Completed','listIndexes','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','\x27\x20returned\x20by\x20moss-core','inflight','number','CLOUD_API_AUTH_URL','json','authenticator','\x20must\x20be\x20at\x20most\x20','progress','filter','Index\x20\x22','version','maxPages','addDocs','error','from','building','add','\x20must\x20be\x20a\x20non-empty\x20string','8mUzxVC','pending_upload'];_0x4484=function(){return _0x595f31;};return _0x4484();}var Y=_0xb7ded2(0x1f7),S=0x100,k=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function Z(_0x14b5e1){const _0x23a8ba=_0xb7ded2;return _0x14b5e1['length']>0x0&&_0x14b5e1['trim']()===_0x14b5e1&&!k[_0x23a8ba(0x243)](_0x14b5e1)&&new TextEncoder()[_0x23a8ba(0x223)](_0x14b5e1)[_0x23a8ba(0x16d)]<=S;}function U(_0x5d4881,_0x1425e9){const _0x14c66a=_0xb7ded2;if(_0x5d4881!==void 0x0){if(typeof _0x5d4881!=_0x14c66a(0x16a)||_0x5d4881['length']===0x0)throw new TypeError('MossClient\x20options.identity.'+_0x1425e9+_0x14c66a(0x213));if(_0x5d4881[_0x14c66a(0x192)]()!==_0x5d4881)throw new TypeError('MossClient\x20options.identity.'+_0x1425e9+'\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace');if(k[_0x14c66a(0x243)](_0x5d4881))throw new TypeError(_0x14c66a(0x1dc)+_0x1425e9+_0x14c66a(0x1d1));if(new TextEncoder()[_0x14c66a(0x223)](_0x5d4881)['byteLength']>S)throw new TypeError(_0x14c66a(0x1dc)+_0x1425e9+_0x14c66a(0x208)+S+'\x20UTF-8\x20bytes');return _0x5d4881;}}function _0xf7dd(_0x12546a,_0x14d2e6){_0x12546a=_0x12546a-0x169;const _0x448496=_0x4484();let _0xf7dd7a=_0x448496[_0x12546a];return _0xf7dd7a;}function L(_0x57af50){const _0xbafc50=_0xb7ded2;if(_0x57af50!==void 0x0){if(_0x57af50===null||typeof _0x57af50!=_0xbafc50(0x188)||Array[_0xbafc50(0x1e5)](_0x57af50))throw new TypeError(_0xbafc50(0x1d5));return Object['freeze']({'deviceId':U(_0x57af50[_0xbafc50(0x1dd)],'deviceId'),'userId':U(_0x57af50[_0xbafc50(0x182)],_0xbafc50(0x182))});}}function N(_0x4c9bbf){const _0x49f1f9=_0xb7ded2;return _0x4c9bbf?.[_0x49f1f9(0x1dd)]!==void 0x0||_0x4c9bbf?.[_0x49f1f9(0x182)]!==void 0x0;}function A(_0x95a4f1){const _0x3ac3d6=_0xb7ded2;if(!_0x95a4f1?.[_0x3ac3d6(0x192)]())return;let _0x3bc32b=_0xa59d9a(_0x95a4f1,Y);try{if(_0x315ff5(_0x3bc32b)){let _0x59138a=_0x165c89(_0x3bc32b,'utf8')[_0x3ac3d6(0x192)]();return Z(_0x59138a)?_0x59138a:void 0x0;}_0x767e04(_0x95a4f1,{'recursive':!0x0});let _0x5090cf=_0x48aa9b();return _0x20d990(_0x3bc32b,_0x5090cf,_0x3ac3d6(0x1e2)),_0x5090cf;}catch{return;}}var ee=0x1;function x(_0x1ef910){const _0x3dad15=_0xb7ded2;let _0x4c5fa3=_0x1ef910[_0x3dad15(0x181)];if(typeof _0x4c5fa3!='function')throw q();let _0x18a771=_0x4c5fa3[_0x3dad15(0x235)](_0x1ef910);if(!Number['isSafeInteger'](_0x18a771)||_0x18a771<ee)throw q();}function q(){const _0x2c0621=_0xb7ded2;return new Error(_0x2c0621(0x1d9));}var Pe=0x708*0x3e8,te={'INVALID_ARGUMENT':!0x0,'NOT_FOUND':!0x0,'UNAUTHORIZED':!0x0,'NETWORK':!0x0,'DESERIALIZATION':!0x0,'MODEL_UNAVAILABLE':!0x0,'INTERNAL':!0x0},ne=new Set(Object[_0xb7ded2(0x173)](te));function re(_0x2fd24e){const _0x7eb29f=_0xb7ded2;if(!(_0x2fd24e instanceof Error))return!0x1;let _0x4b4c19=_0x2fd24e[_0x7eb29f(0x197)];return typeof _0x4b4c19==_0x7eb29f(0x16a)&&ne['has'](_0x4b4c19);}function p(_0x509e4a,_0x8090e4){return Object['assign'](new Error(_0x8090e4),{'code':_0x509e4a});}function b(_0x4cf6ea){const _0x513e0a=_0xb7ded2;if(!(_0x4cf6ea?.[_0x513e0a(0x1b1)]===void 0x0&&_0x4cf6ea?.['candidateDepth']===void 0x0))return{'minScore':_0x4cf6ea['minScore'],'candidateDepth':_0x4cf6ea['candidateDepth']};}function D(_0x5b7cee){const _0x2f7207=_0xb7ded2;return _0x5b7cee instanceof Error?_0x5b7cee[_0x2f7207(0x16c)]:String(_0x5b7cee);}function se(_0x3b76e3){const _0x39d232=_0xb7ded2;if(_0x3b76e3===null||typeof _0x3b76e3!='object')return _0x39d232(0x22d)+String(_0x3b76e3);if(Array[_0x39d232(0x1e5)](_0x3b76e3))return _0x39d232(0x179);let _0x201909=_0x3b76e3;return typeof _0x201909[_0x39d232(0x170)]!=_0x39d232(0x16a)||_0x201909['jobId'][_0x39d232(0x1fb)]===0x0?_0x39d232(0x1ba)+String(_0x201909['jobId'])+')':typeof _0x201909[_0x39d232(0x17e)]!=_0x39d232(0x16a)||_0x201909[_0x39d232(0x17e)][_0x39d232(0x1fb)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20('+String(_0x201909['status'])+')':typeof _0x201909[_0x39d232(0x209)]!=_0x39d232(0x204)||!Number[_0x39d232(0x1d2)](_0x201909[_0x39d232(0x209)])?_0x39d232(0x244)+String(_0x201909[_0x39d232(0x209)])+')':_0x201909['currentPhase']!==void 0x0&&_0x201909['currentPhase']!==null&&typeof _0x201909[_0x39d232(0x1e6)]!=_0x39d232(0x16a)?_0x39d232(0x238)+String(_0x201909[_0x39d232(0x1e6)])+')':null;}var w=class{[_0xb7ded2(0x207)];[_0xb7ded2(0x21d)];['indexManager'];[_0xb7ded2(0x1e8)];[_0xb7ded2(0x1d6)];['projectId'];['authNotifyFn'];constructor(_0x478761,_0x47ea50,_0xdfae84){const _0xad4402=_0xb7ded2;this[_0xad4402(0x1d6)]=L(_0xdfae84?.[_0xad4402(0x248)]),this[_0xad4402(0x1e8)]=A(_0xdfae84?.[_0xad4402(0x230)]),this[_0xad4402(0x217)]=_0x478761;let _0x1a89df=typeof _0x47ea50==_0xad4402(0x16a)?new I(_0x478761,_0x47ea50):_0x47ea50;this[_0xad4402(0x207)]=new y(_0x1a89df);let _0x1bb598=_0x5e12ee,_0x1e0230=_0x1bb598[_0xad4402(0x1a0)]??_0x1bb598[_0xad4402(0x174)]?.['ManageClient'],_0xe3591=_0x1bb598[_0xad4402(0x1db)]??_0x1bb598[_0xad4402(0x174)]?.[_0xad4402(0x1db)];if(!_0x1e0230||!_0xe3591)throw new Error('moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports');if(typeof _0x47ea50==_0xad4402(0x16a))this[_0xad4402(0x21d)]=new _0x1e0230(_0x478761,_0x47ea50),this[_0xad4402(0x1c7)]=new _0xe3591(_0x478761,_0x47ea50);else{let _0x122945=_0x1bb598[_0xad4402(0x1aa)]??_0x1bb598[_0xad4402(0x174)]?.[_0xad4402(0x1aa)],_0xe8ea7c=_0x1bb598[_0xad4402(0x227)]??_0x1bb598[_0xad4402(0x174)]?.['rejectAuthRequest'];if(!_0x122945||!_0xe8ea7c)throw new Error(_0xad4402(0x1c4));let _0x1ba626=this[_0xad4402(0x207)],_0x3ac26a=(_0x5e50d9,_0x3f0271)=>{const _0x24071a=_0xad4402;try{_0xe8ea7c(_0x5e50d9,_0x3f0271);}catch(_0x460c6a){console[_0x24071a(0x240)]('[moss]\x20Auth\x20request\x20'+_0x5e50d9+'\x20could\x20not\x20be\x20settled:\x20'+D(_0x460c6a));}},_0x2240e9=(_0x520f73,_0x513db5)=>{const _0x4c68d8=_0xad4402;try{_0x122945(_0x520f73,_0x513db5);}catch(_0x149373){_0x3ac26a(_0x520f73,_0x4c68d8(0x1f6)+D(_0x149373));}},_0x551385=!0x1,_0x16cb97=(_0x15a07c,_0x384c5e)=>{const _0x4ce78a=_0xad4402;if(_0x15a07c||!Number[_0x4ce78a(0x225)](_0x384c5e)||_0x384c5e<0x0){_0x551385||(_0x551385=!0x0,console[_0x4ce78a(0x240)]('[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20'+(_0x15a07c?_0x15a07c[_0x4ce78a(0x16c)]:_0x4ce78a(0x22d)+String(_0x384c5e))));return;}_0x1ba626[_0x4ce78a(0x218)]()['then'](_0x2ab775=>{const _0x366ba9=_0x4ce78a;let _0x18915e=_0x2ab775[_0x366ba9(0x176)](_0x366ba9(0x1cd))?_0x2ab775[_0x366ba9(0x19d)](0x7):_0x2ab775;_0x2240e9(_0x384c5e,_0x18915e);},_0x215739=>_0x3ac26a(_0x384c5e,D(_0x215739)));};this[_0xad4402(0x1b0)]=_0x16cb97;let _0x560194=_0x1e0230,_0x5f1eaf=_0xe3591;if(!_0x560194[_0xad4402(0x1b3)]||!_0x5f1eaf[_0xad4402(0x1b3)])throw new Error(_0xad4402(0x201));this['manageClient']=_0x560194['withAuthenticator'](_0x478761,_0x16cb97),this['indexManager']=_0x5f1eaf['withAuthenticator'](_0x478761,_0x16cb97);}this[_0xad4402(0x175)](this[_0xad4402(0x1c7)]);}async[_0xb7ded2(0x172)](){const _0x84b445=_0xb7ded2;let _0x2784b7=this[_0x84b445(0x1c7)][_0x84b445(0x172)];if(typeof _0x2784b7!=_0x84b445(0x17f))throw new Error(_0x84b445(0x245));await _0x2784b7[_0x84b445(0x235)](this[_0x84b445(0x1c7)]);}async['getAuthToken'](){const _0xa5ce15=_0xb7ded2;return this[_0xa5ce15(0x207)][_0xa5ce15(0x185)]();}[_0xb7ded2(0x1de)](_0x241389){if(!_0x241389)return;let _0x290b22=!0x1;return(_0x4234f8,_0x586727)=>{const _0x42e3f2=_0xf7dd;let _0x137c84=_0x4234f8?_0x4234f8['message']:se(_0x586727);if(_0x137c84!==null){_0x290b22||(_0x290b22=!0x0,console['warn'](_0x42e3f2(0x1bd)+_0x137c84));return;}_0x241389(_0x586727);};}[_0xb7ded2(0x1f8)](_0x3fa72e){const _0x578fac=_0xb7ded2;let _0x577c17=_0x3fa72e['trim']()['toLowerCase']()[_0x578fac(0x1fd)](/\s+/g,'_'),_0xe62ac=_0x577c17[_0x578fac(0x1fd)](/_/g,'');if(_0x577c17===_0x578fac(0x215)||_0xe62ac===_0x578fac(0x1d3))return _0x5f4ea8[_0x578fac(0x224)];if(_0x577c17==='uploading')return _0x5f4ea8[_0x578fac(0x1c3)];if(_0x577c17===_0x578fac(0x211))return _0x5f4ea8[_0x578fac(0x1a6)];if(_0x577c17===_0x578fac(0x1a2))return _0x5f4ea8[_0x578fac(0x1ff)];if(_0x577c17===_0x578fac(0x21c))return _0x5f4ea8[_0x578fac(0x1b4)];throw new Error(_0x578fac(0x19e)+_0x3fa72e+_0x578fac(0x202));}async[_0xb7ded2(0x18a)](_0x182604,_0x54548d,_0x39a569,_0x521013){const _0x4b11e1=_0xb7ded2;if(!_0x54548d[_0x4b11e1(0x1fb)])throw new Error(_0x4b11e1(0x1a4));return await this[_0x4b11e1(0x21d)][_0x4b11e1(0x18a)](_0x182604,_0x54548d,_0x39a569,this[_0x4b11e1(0x1de)](_0x521013?.[_0x4b11e1(0x19b)]));}async[_0xb7ded2(0x1c9)](_0x5ed9fe){const _0x43b10d=_0xb7ded2;if(_0x5ed9fe instanceof Uint8Array)return Array[_0x43b10d(0x210)](_0x5ed9fe);if(_0x5ed9fe instanceof ArrayBuffer)return Array['from'](new Uint8Array(_0x5ed9fe));if(typeof _0x5ed9fe[_0x43b10d(0x1b6)]==_0x43b10d(0x17f)){let _0x249063=await _0x5ed9fe['arrayBuffer']();return Array[_0x43b10d(0x210)](new Uint8Array(_0x249063));}throw new Error(_0x43b10d(0x231));}async[_0xb7ded2(0x1a8)](_0x467af6,_0x8711df,_0x1eefa4){const _0x3f33c8=_0xb7ded2;if(_0x8711df['length']===0x0)throw new Error(_0x3f33c8(0x194));let _0x53f0b9=_0x1eefa4?.['modelId']??'moss-minilm',_0x8772ba=await Promise[_0x3f33c8(0x22b)](_0x8711df[_0x3f33c8(0x1c6)](async _0x1a1a04=>({'name':_0x1a1a04[_0x3f33c8(0x1ed)],'contentType':_0x1a1a04['contentType'],'path':_0x1a1a04[_0x3f33c8(0x187)]??void 0x0,'data':_0x1a1a04[_0x3f33c8(0x228)]!=null?await this['toByteArray'](_0x1a1a04[_0x3f33c8(0x228)]):void 0x0})));return await this['manageClient'][_0x3f33c8(0x1a8)](_0x467af6,_0x8772ba,_0x53f0b9,this['wrapProgress'](_0x1eefa4?.[_0x3f33c8(0x19b)]),_0x1eefa4?.[_0x3f33c8(0x1f3)]??null);}async[_0xb7ded2(0x20e)](_0x249710,_0x10afe7,_0x2501ab){const _0x385774=_0xb7ded2;if(Array[_0x385774(0x1e5)](_0x10afe7)&&_0x10afe7[_0x385774(0x1fb)]===0x0)throw new Error('addDocs\x20requires\x20at\x20least\x20one\x20document');return await this[_0x385774(0x21d)]['addDocs'](_0x249710,_0x10afe7,_0x2501ab??null,this[_0x385774(0x1de)](_0x2501ab?.['onProgress']));}async[_0xb7ded2(0x177)](_0x39a44d,_0x2de74a,_0x11a855){const _0x146a78=_0xb7ded2;if(Array[_0x146a78(0x1e5)](_0x2de74a)&&_0x2de74a[_0x146a78(0x1fb)]===0x0)throw new Error(_0x146a78(0x234));return await this['manageClient'][_0x146a78(0x177)](_0x39a44d,_0x2de74a,this['wrapProgress'](_0x11a855?.['onProgress']));}async[_0xb7ded2(0x242)](_0x11fa02){const _0x52198d=_0xb7ded2;let _0x43c57c=await this['manageClient'][_0x52198d(0x242)](_0x11fa02);return{..._0x43c57c,'status':this['normalizeJobStatus'](_0x43c57c[_0x52198d(0x17e)]),'currentPhase':_0x43c57c['currentPhase']??null,'error':_0x43c57c[_0x52198d(0x20f)]??null};}async[_0xb7ded2(0x1e0)](_0x4fa82a){const _0x3a7711=_0xb7ded2;return this[_0x3a7711(0x21d)][_0x3a7711(0x1e0)](_0x4fa82a);}async[_0xb7ded2(0x200)](){const _0x279af8=_0xb7ded2;return this[_0x279af8(0x21d)]['listIndexes']();}async[_0xb7ded2(0x219)](_0x5b1e4a){const _0x1f969e=_0xb7ded2;return this[_0x1f969e(0x21d)][_0x1f969e(0x219)](_0x5b1e4a);}async[_0xb7ded2(0x216)](_0x4f3386,_0x516c46){const _0x10bb7a=_0xb7ded2;return this[_0x10bb7a(0x21d)]['getDocs'](_0x4f3386,_0x516c46??null);}async[_0xb7ded2(0x18e)](_0x366420,_0x3d885a){const _0x24f2d7=_0xb7ded2;return this['ensureCachePathDeviceId'](_0x3d885a?.[_0x24f2d7(0x230)]),(await this[_0x24f2d7(0x1c7)][_0x24f2d7(0x18e)](_0x366420,_0x3d885a??null))['name'];}async[_0xb7ded2(0x1a5)](_0x402de0,_0x241abc){const _0x2310be=_0xb7ded2;let _0x43b2ad=this[_0x2310be(0x178)]();return this['ensureCachePathDeviceId'](_0x241abc?.['cachePath']),_0x43b2ad[_0x2310be(0x1a5)](_0x402de0,_0x241abc??null);}async[_0xb7ded2(0x1f2)](_0x144493){const _0x76beb0=_0xb7ded2;return this[_0x76beb0(0x1c7)][_0x76beb0(0x1f2)](_0x144493);}async[_0xb7ded2(0x239)](_0x26483c){return this['requireMultiIndexCore']()['unloadIndexes'](_0x26483c);}[_0xb7ded2(0x178)](){const _0x69cd8c=_0xb7ded2;let _0x54219d=this[_0x69cd8c(0x1c7)];if(typeof _0x54219d[_0x69cd8c(0x198)]!=_0x69cd8c(0x17f)||typeof _0x54219d[_0x69cd8c(0x21f)]!='function'||typeof _0x54219d[_0x69cd8c(0x1a5)]!=_0x69cd8c(0x17f)||typeof _0x54219d['unloadIndexes']!='function')throw new Error(_0x69cd8c(0x1c5));return{'queryMultiIndex':_0x54219d[_0x69cd8c(0x198)][_0x69cd8c(0x21b)](_0x54219d),'queryMultiIndexText':_0x54219d[_0x69cd8c(0x21f)]['bind'](_0x54219d),'loadIndexes':_0x54219d[_0x69cd8c(0x1a5)][_0x69cd8c(0x21b)](_0x54219d),'unloadIndexes':_0x54219d['unloadIndexes'][_0x69cd8c(0x21b)](_0x54219d)};}[_0xb7ded2(0x1fe)](_0x2299dc){_0x2299dc&&this['cachePathDeviceId']===void 0x0&&A(_0x2299dc);}[_0xb7ded2(0x175)]=_0x3abb0d=>{const _0x193778=_0xb7ded2;!N(this['configuredIdentity'])&&this[_0x193778(0x1e8)]===void 0x0||_0x3abb0d['setIdentity'](this[_0x193778(0x1d6)]?.[_0x193778(0x1dd)]??null,this[_0x193778(0x1d6)]?.['userId']??null,this[_0x193778(0x1e8)]??null);};[_0xb7ded2(0x169)]=_0x5ae14e=>{const _0x779b33=_0xb7ded2;let _0x54b315=this['indexManager'][_0x779b33(0x21a)]?.();if(!_0x54b315){this[_0x779b33(0x175)](_0x5ae14e);return;}_0x5ae14e[_0x779b33(0x1be)](_0x54b315[_0x779b33(0x1dd)]??null,this[_0x779b33(0x1d6)]?.[_0x779b33(0x182)]??null,_0x54b315[_0x779b33(0x18f)]??null);};[_0xb7ded2(0x1ac)](){const _0x58f231=_0xb7ded2;return this[_0x58f231(0x1b0)]!==void 0x0;}async[_0xb7ded2(0x1b7)](_0x3136ef,_0x42f9a8,_0x1f7f49){const _0x4131e5=_0xb7ded2;if(!this[_0x4131e5(0x1b0)])throw new Error('createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client');let _0x19cad1=_0x5e12ee,_0x50976e=_0x19cad1[_0x4131e5(0x246)]??_0x19cad1['default']?.[_0x4131e5(0x246)];if(!_0x50976e||typeof _0x50976e['withAuthenticator']!='function')throw new Error(_0x4131e5(0x1ab));return _0x1f7f49&&x(_0x50976e),_0x50976e[_0x4131e5(0x1b3)](_0x3136ef,_0x42f9a8,this[_0x4131e5(0x217)],this[_0x4131e5(0x1b0)],null,null,_0x1f7f49?.[_0x4131e5(0x20c)]??null,_0x1f7f49?.[_0x4131e5(0x1c8)]??null);}async[_0xb7ded2(0x229)](_0x359782,_0x61530c,_0x250c07){const _0x32c90f=_0xb7ded2;if(!await this[_0x32c90f(0x1c7)][_0x32c90f(0x237)](_0x359782))throw p(_0x32c90f(0x171),_0x32c90f(0x20b)+_0x359782+_0x32c90f(0x1c0)+_0x359782+_0x32c90f(0x23e));let _0x1fa202=_0x250c07?.[_0x32c90f(0x1da)]??0x5,_0x2d77f5=_0x250c07?.['alpha']??0.8;return _0x250c07?.['embedding']?this['indexManager'][_0x32c90f(0x229)](_0x359782,_0x61530c,_0x250c07[_0x32c90f(0x1ce)],_0x1fa202,_0x2d77f5,_0x250c07?.[_0x32c90f(0x20a)],b(_0x250c07)):this[_0x32c90f(0x1c7)]['queryText'](_0x359782,_0x61530c,_0x1fa202,_0x2d77f5,_0x250c07?.[_0x32c90f(0x20a)],b(_0x250c07));}async[_0xb7ded2(0x198)](_0x584fda,_0x2364a2,_0x5ba4c0){const _0x34e1a3=_0xb7ded2;if(_0x584fda[_0x34e1a3(0x1fb)]===0x0)throw p(_0x34e1a3(0x180),_0x34e1a3(0x1ef));let _0x273f00=this[_0x34e1a3(0x178)](),_0x2d11cb=_0x5ba4c0?.[_0x34e1a3(0x1da)]??0xa,_0x2cbc9d=_0x5ba4c0?.[_0x34e1a3(0x247)]??0.8;return _0x5ba4c0?.['embedding']?_0x273f00[_0x34e1a3(0x198)](_0x584fda,_0x2364a2,_0x5ba4c0[_0x34e1a3(0x1ce)],_0x2d11cb,_0x2cbc9d,_0x5ba4c0?.[_0x34e1a3(0x20a)],b(_0x5ba4c0)):_0x273f00['queryMultiIndexText'](_0x584fda,_0x2364a2,_0x2d11cb,_0x2cbc9d,_0x5ba4c0?.['filter'],b(_0x5ba4c0));}};import{SessionIndex as _0x259da3}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x4cfb78,_0x306448,_0x4e6938){this.#s=_0x4cfb78,this.#r=_0x306448,this.#e=_0x4e6938;}static async['_create'](_0x35a2fe,_0xf47c35,_0x484e3e,_0x98cfd5,_0x105ac5,_0x3d2dbb,_0x535006){const _0x322464=_0xb7ded2;let _0x284916=_0x259da3;_0x535006&&x(_0x284916);let _0x54ba6c=await _0x284916[_0x322464(0x17d)](_0x35a2fe,_0xf47c35,_0x484e3e,_0x98cfd5,_0x105ac5??null,_0x535006?.[_0x322464(0x20c)]??null,_0x535006?.[_0x322464(0x1c8)]??null);return r['_fromInner'](_0x35a2fe,_0xf47c35,_0x54ba6c,_0x3d2dbb);}static[_0xb7ded2(0x190)](_0x25cc42,_0x26f2cf,_0x505650,_0x36237d){return _0x36237d?.(_0x505650),new r(_0x25cc42,_0x26f2cf,_0x505650);}get[_0xb7ded2(0x1ed)](){return this.#s;}get[_0xb7ded2(0x1ea)](){const _0x31c758=_0xb7ded2;return this.#n(),this.#e[_0x31c758(0x1ea)];}get['modelId'](){return this.#r;}async[_0xb7ded2(0x20e)](_0x5a3872,_0x3b8636){const _0x3d668a=_0xb7ded2;this.#n();let _0x4f659a=_0x3b8636?{'upsert':_0x3b8636[_0x3d668a(0x1d4)]??!0x0}:void 0x0;if(this.#r===_0x3d668a(0x23f)){let _0x3d3b94=r.#t(_0x5a3872),_0x2a123f=_0x5a3872['map'](_0x1b5b53=>{const _0x1bd0c8=_0x3d668a;let _0x1a6048={..._0x1b5b53};return delete _0x1a6048[_0x1bd0c8(0x1ce)],_0x1a6048;}),_0x232644=await this.#e['addDocuments'](_0x2a123f,_0x3d3b94,_0x4f659a);return{'added':_0x232644[_0x3d668a(0x1c1)],'updated':_0x232644[_0x3d668a(0x23a)]};}let _0x2b3cbf=await this.#e[_0x3d668a(0x19f)](_0x5a3872,_0x4f659a);return{'added':_0x2b3cbf[_0x3d668a(0x1c1)],'updated':_0x2b3cbf[_0x3d668a(0x23a)]};}async[_0xb7ded2(0x177)](_0x3eae8a){const _0x30dfeb=_0xb7ded2;return this.#n(),await this.#e[_0x30dfeb(0x1df)](_0x3eae8a);}async['getDocs'](_0x1bb624){return this.#n(),await this.#e['getDocuments'](_0x1bb624??null);}async[_0xb7ded2(0x229)](_0xf8d8bc,_0x2fe9ad){const _0x458038=_0xb7ded2;this.#n();let _0x3e61ab=_0x2fe9ad?.['topK']??0x5,_0x12565d=_0x2fe9ad?.[_0x458038(0x247)]??0.8,_0x351d86=_0x2fe9ad?.['filter']??null,_0x20d28c=_0x2fe9ad?.[_0x458038(0x1ce)];if(_0x20d28c==null){if(this.#r==='custom')throw p('INVALID_ARGUMENT',_0x458038(0x189));return await this.#e[_0x458038(0x1bc)](_0xf8d8bc,_0x3e61ab,_0x12565d,_0x351d86);}return await this.#e[_0x458038(0x229)](_0xf8d8bc,_0x3e61ab,Array['from'](_0x20d28c),_0x12565d,_0x351d86);}async['loadIndex'](_0x37f50e,_0x4278f5){return this.#n(),this.#e['loadIndex'](_0x37f50e,_0x4278f5??null);}async['pushIndex'](){const _0x3f93f0=_0xb7ded2;return this.#n(),this.#e[_0x3f93f0(0x19a)]();}async['saveToDisk'](_0x60abcc){const _0x5761dc=_0xb7ded2;this.#n(),await this.#e[_0x5761dc(0x1a1)](_0x60abcc);}async['loadFromDisk'](_0x3e7105,_0x51121c){const _0xdf5bf7=_0xb7ded2;this.#n();let _0x1f7428=_0x51121c?.[_0xdf5bf7(0x1b9)]??!0x0;return await this.#e[_0xdf5bf7(0x1ad)](_0x3e7105,{'rebuildLegacy':_0x1f7428});}async[_0xb7ded2(0x1cb)](_0x27cea1){const _0x32b0e5=_0xb7ded2;return this.#n(),await this.#e[_0x32b0e5(0x1cb)](_0x27cea1);}#n(){const _0x15e3f7=_0xb7ded2;if(this.#i)throw new Error(_0x15e3f7(0x184)+this.#s+_0x15e3f7(0x1ec));}[_0xb7ded2(0x172)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0xf22ed4=_0xb7ded2;this.#i=!0x0;let _0x2a56b3=this.#e[_0xf22ed4(0x172)];if(typeof _0x2a56b3!=_0xf22ed4(0x17f))throw new Error(_0xf22ed4(0x1ca));await _0x2a56b3[_0xf22ed4(0x235)](this.#e);}async[Symbol[_0xb7ded2(0x1bf)]](){const _0x56d7e1=_0xb7ded2;return this[_0x56d7e1(0x172)]();}async[_0xb7ded2(0x1e9)](){const _0x181b86=_0xb7ded2;this.#n(),this.#r!==_0x181b86(0x23f)&&await this.#e[_0x181b86(0x16b)]();}static#t(_0x5d5d99){const _0x40ca0b=_0xb7ded2;let _0x199a9c=_0x5d5d99[_0x40ca0b(0x20a)](_0x2b6dcc=>!_0x2b6dcc[_0x40ca0b(0x1ce)]||_0x2b6dcc[_0x40ca0b(0x1ce)][_0x40ca0b(0x1fb)]===0x0)[_0x40ca0b(0x1c6)](_0x480020=>_0x480020['id']);if(_0x199a9c[_0x40ca0b(0x1fb)]>0x0)throw new Error(_0x40ca0b(0x1a9)+_0x199a9c[_0x40ca0b(0x241)](',\x20')+_0x40ca0b(0x1b2));return _0x5d5d99['map'](_0x18b116=>Array['from'](_0x18b116[_0x40ca0b(0x1ce)]??[]));}};import{validateIndexName as _0x3067b3}from'@moss-js/moss-core';var ie=_0xb7ded2(0x1c2),ae=_0xb7ded2(0x17a),M=class extends Error{[_0xb7ded2(0x17e)];[_0xb7ded2(0x186)];constructor(_0x1fe103,_0x491f84){const _0x56fb81=_0xb7ded2;let _0x3db726=_0x491f84?':\x20'+_0x491f84:'';super('HTTP\x20error!\x20status:\x20'+_0x1fe103+_0x3db726),this[_0x56fb81(0x1ed)]='ManageApiError',this[_0x56fb81(0x17e)]=_0x1fe103,this[_0x56fb81(0x186)]=_0x491f84;}};function ue(){const _0x46de45=_0xb7ded2;return''+(typeof process<'u'&&process[_0x46de45(0x22c)][_0x46de45(0x191)]||ie)[_0x46de45(0x1fd)](/\/+$/,'')+ae;}function de(_0x31fc57){const _0x2e06a6=_0xb7ded2;return _0x31fc57?Object[_0x2e06a6(0x1cf)](Object[_0x2e06a6(0x1b5)](_0x31fc57)[_0x2e06a6(0x20a)](([,_0x537b8a])=>_0x537b8a!==void 0x0)):{};}async function j(_0x1aba3b,_0x216394,_0x33ea0f,_0x3d6566){const _0x360d69=_0xb7ded2;let _0x3cff5f={...de(_0x3d6566),'action':_0x33ea0f,'projectId':_0x1aba3b},_0x3ef2e6=await fetch(ue(),{'method':'POST','headers':{'Content-Type':_0x360d69(0x17c),'X-Project-Key':_0x216394},'body':JSON[_0x360d69(0x1cc)](_0x3cff5f),'signal':AbortSignal['timeout'](0x927c0)}),_0x3b7fb1=await _0x3ef2e6[_0x360d69(0x22a)]();if(!_0x3ef2e6['ok'])throw new M(_0x3ef2e6[_0x360d69(0x17e)],_0x3b7fb1);return _0x3b7fb1?JSON[_0x360d69(0x1a3)](_0x3b7fb1):{};}var W=_0xb7ded2(0x1e1),R=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x2d2285,_0x4aa5d8,_0x441ce8){this.#e=new w(_0x2d2285,_0x4aa5d8,_0x441ce8),this.#r=_0x2d2285,this.#s=typeof _0x4aa5d8=='string'?_0x4aa5d8:null;}async[_0xb7ded2(0x185)](){const _0x28cb25=_0xb7ded2;return this.#t(),this.#e[_0x28cb25(0x185)]();}async[_0xb7ded2(0x18a)](_0xb159dd,_0xda3c4c,_0x37398f){const _0x27a719=_0xb7ded2;this.#t();let _0x450307;return _0x37398f?.['modelId']!==void 0x0?_0x450307=_0x37398f['modelId']:_0x450307=_0xda3c4c['some'](_0x413302=>Array['isArray'](_0x413302['embedding'])&&_0x413302[_0x27a719(0x1ce)][_0x27a719(0x1fb)]>0x0)?'custom':W,this.#e[_0x27a719(0x18a)](_0xb159dd,_0xda3c4c,_0x450307,_0x37398f);}async[_0xb7ded2(0x1a8)](_0x2d891e,_0x176bea,_0x2e19ad){const _0x4cd157=_0xb7ded2;return this.#t(),this.#e[_0x4cd157(0x1a8)](_0x2d891e,_0x176bea,_0x2e19ad);}async[_0xb7ded2(0x1e0)](_0x57f57e){const _0x489db1=_0xb7ded2;return this.#t(),this.#e[_0x489db1(0x1e0)](_0x57f57e);}async['listIndexes'](){const _0x5be572=_0xb7ded2;return this.#t(),this.#e[_0x5be572(0x200)]();}async[_0xb7ded2(0x219)](_0x596e86){const _0x271122=_0xb7ded2;return this.#t(),this.#e[_0x271122(0x219)](_0x596e86);}async[_0xb7ded2(0x20e)](_0x56998f,_0x21680a,_0x57bcb3){const _0x1a7a7a=_0xb7ded2;return this.#t(),this.#e[_0x1a7a7a(0x20e)](_0x56998f,_0x21680a,_0x57bcb3);}async[_0xb7ded2(0x177)](_0x48ed57,_0x1fc2e3,_0x55e776){const _0x4901d8=_0xb7ded2;return this.#t(),this.#e[_0x4901d8(0x177)](_0x48ed57,_0x1fc2e3,_0x55e776);}async[_0xb7ded2(0x242)](_0x37ae5f){const _0xf1ed33=_0xb7ded2;return this.#t(),this.#e[_0xf1ed33(0x242)](_0x37ae5f);}async[_0xb7ded2(0x1f0)](_0x3323a2,_0x19d5fa,_0x3b3ba1){const _0x601b7d=_0xb7ded2;return this.#t(),_0x3067b3(_0x19d5fa),this.#o(_0x601b7d(0x1f0),{'rootUrl':_0x3323a2,'indexName':_0x19d5fa,'maxPages':_0x3b3ba1?.[_0x601b7d(0x20d)],'maxDocuments':_0x3b3ba1?.[_0x601b7d(0x1fc)],'maxDepth':_0x3b3ba1?.['maxDepth'],'includePaths':_0x3b3ba1?.[_0x601b7d(0x22f)],'excludePaths':_0x3b3ba1?.['excludePaths'],'respectRobots':_0x3b3ba1?.['respectRobots'],'parseDocuments':_0x3b3ba1?.[_0x601b7d(0x236)],'refreshCadence':_0x3b3ba1?.[_0x601b7d(0x1bb)],'modelId':_0x3b3ba1?.[_0x601b7d(0x1b8)]});}async[_0xb7ded2(0x226)](_0x5e58f6){const _0x2e3cff=_0xb7ded2;this.#t();let _0x3a9fc7=(await this.#o(_0x2e3cff(0x226),_0x5e58f6!==void 0x0?{'indexName':_0x5e58f6}:void 0x0))[_0x2e3cff(0x222)]??[];return _0x5e58f6===void 0x0?_0x3a9fc7:_0x3a9fc7[_0x2e3cff(0x20a)](_0x4e49d9=>_0x4e49d9[_0x2e3cff(0x22e)]===_0x5e58f6);}async[_0xb7ded2(0x1eb)](_0x316fb0){const _0x78e178=_0xb7ded2;return this.#t(),this.#o(_0x78e178(0x1eb),{'sourceId':_0x316fb0});}async['updateWebSource'](_0x132e37,_0x5a1838){const _0x38c56b=_0xb7ded2;return this.#t(),this.#o(_0x38c56b(0x1e4),{'sourceId':_0x132e37,'refreshCadence':_0x5a1838[_0x38c56b(0x1bb)],'rootUrl':_0x5a1838[_0x38c56b(0x233)],'includePaths':_0x5a1838[_0x38c56b(0x22f)],'excludePaths':_0x5a1838['excludePaths'],'maxDepth':_0x5a1838['maxDepth'],'maxPages':_0x5a1838[_0x38c56b(0x20d)],'resync':_0x5a1838[_0x38c56b(0x232)]});}async[_0xb7ded2(0x1e3)](_0x2bafba){const _0x5516fd=_0xb7ded2;return this.#t(),this.#o(_0x5516fd(0x1e3),{'sourceId':_0x2bafba});}async[_0xb7ded2(0x183)](_0x4b2c99){return this.#t(),this.#o('deleteWebSource',{'sourceId':_0x4b2c99});}async #o(_0x4187e1,_0x5b3ae7){const _0x409ef0=_0xb7ded2;if(this.#s===null)throw new Error(_0x409ef0(0x18d));return j(this.#r,this.#s,_0x4187e1,_0x5b3ae7);}async[_0xb7ded2(0x216)](_0x4a5a9e,_0x2d123c){return this.#t(),this.#e['getDocs'](_0x4a5a9e,_0x2d123c);}async[_0xb7ded2(0x18e)](_0x1e7cbd,_0x39c933){return this.#t(),this.#e['loadIndex'](_0x1e7cbd,_0x39c933);}async[_0xb7ded2(0x1a5)](_0x5b75f7,_0x547190){const _0x8ecec7=_0xb7ded2;return this.#t(),this.#e[_0x8ecec7(0x1a5)](_0x5b75f7,_0x547190);}async[_0xb7ded2(0x1f2)](_0x5aaab6){const _0x10f955=_0xb7ded2;return this.#t(),this.#e[_0x10f955(0x1f2)](_0x5aaab6);}async['unloadIndexes'](_0x5d0fff){return this.#t(),this.#e['unloadIndexes'](_0x5d0fff);}async[_0xb7ded2(0x229)](_0x7438c8,_0x4002c0,_0x36dd6e){return this.#t(),this.#e['query'](_0x7438c8,_0x4002c0,_0x36dd6e);}async['queryMultiIndex'](_0x4fef6d,_0x244526,_0x56cb8d){return this.#t(),this.#e['queryMultiIndex'](_0x4fef6d,_0x244526,_0x56cb8d);}async[_0xb7ded2(0x19c)](_0x505baf,_0x42774f=W,_0x521f5d){const _0x3f4673=_0xb7ded2;this.#t();let _0x218297=this.#e[_0x3f4673(0x169)],_0x12e6cb;if(this.#s!==null)_0x12e6cb=await h[_0x3f4673(0x221)](_0x505baf,_0x42774f,this.#r,this.#s,void 0x0,_0x218297,_0x521f5d);else{let _0x3cc55c=await this.#e[_0x3f4673(0x1b7)](_0x505baf,_0x42774f,_0x521f5d);_0x12e6cb=h[_0x3f4673(0x190)](_0x505baf,_0x42774f,_0x3cc55c,_0x218297);}await _0x12e6cb[_0x3f4673(0x1e9)]();for(let _0x1567b4 of this.#n)_0x1567b4[_0x3f4673(0x1f5)]()||this.#n[_0x3f4673(0x220)](_0x1567b4);return this.#n[_0x3f4673(0x212)](new WeakRef(_0x12e6cb)),_0x12e6cb;}#t(){const _0x1b95e8=_0xb7ded2;if(this.#i)throw new Error(_0x1b95e8(0x199));}[_0xb7ded2(0x172)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x1ff043=_0xb7ded2;this.#i=!0x0;let _0x404b33=[...this.#n][_0x1ff043(0x1c6)](_0x10731e=>_0x10731e['deref']())[_0x1ff043(0x20a)](_0x14efc9=>_0x14efc9!==void 0x0);this.#n['clear'](),await Promise[_0x1ff043(0x22b)](_0x404b33[_0x1ff043(0x1c6)](_0x5ad13f=>_0x5ad13f[_0x1ff043(0x172)]())),await this.#e['close']();}async[Symbol['asyncDispose']](){const _0x5aa60e=_0xb7ded2;return this[_0x5aa60e(0x172)]();}};export{M as ManageApiError,R as MossClient,h as SessionIndex,re as isMossError};
|
|
1
|
+
const _0x5d9690=_0x1238;(function(_0x585173,_0x3ee1e0){const _0x153c3c=_0x1238,_0x468ea7=_0x585173();while(!![]){try{const _0x52eb24=-parseInt(_0x153c3c(0x16d))/0x1+parseInt(_0x153c3c(0x15a))/0x2+parseInt(_0x153c3c(0x14e))/0x3+-parseInt(_0x153c3c(0xbe))/0x4*(parseInt(_0x153c3c(0x13d))/0x5)+-parseInt(_0x153c3c(0xd8))/0x6*(-parseInt(_0x153c3c(0xec))/0x7)+-parseInt(_0x153c3c(0xbc))/0x8*(-parseInt(_0x153c3c(0xfd))/0x9)+-parseInt(_0x153c3c(0x15b))/0xa;if(_0x52eb24===_0x3ee1e0)break;else _0x468ea7['push'](_0x468ea7['shift']());}catch(_0x556d60){_0x468ea7['push'](_0x468ea7['shift']());}}}(_0x259c,0x25bbc));import{JobStatus as _0x600eb6}from'@moss-js/moss-core';import*as _0x1f7311 from'@moss-js/moss-core';import*as _0x2e5014 from'@moss-js/moss-core';var g=_0x2e5014,le=g['MODEL_DOWNLOAD_URL'],me=g[_0x5d9690(0x112)],he=g['CLOUD_API_IDENTITY_URL'],T=g[_0x5d9690(0x105)],ge=typeof process<'u'&&process[_0x5d9690(0x109)]['MOSS_INDEX_URL']||g[_0x5d9690(0xa7)],_=typeof process<'u'?process[_0x5d9690(0x109)]:{},I=class{constructor(_0x1bd776,_0x505f62){const _0x27ff82=_0x5d9690;this[_0x27ff82(0x108)]=_0x1bd776,this[_0x27ff82(0x9f)]=_0x505f62,this[_0x27ff82(0x16a)]=_[_0x27ff82(0xcc)]??T;}['projectId'];[_0x5d9690(0x9f)];[_0x5d9690(0x16a)];async[_0x5d9690(0x104)](){const _0x3b7566=_0x5d9690;let _0x5a0b8f=await fetch(this[_0x3b7566(0x16a)],{'method':_0x3b7566(0x158),'headers':{'Content-Type':_0x3b7566(0xa3)},'body':JSON[_0x3b7566(0x164)]({'projectId':this[_0x3b7566(0x108)],'projectKey':this[_0x3b7566(0x9f)]}),'signal':AbortSignal[_0x3b7566(0x128)](0x7530)});if(_0x5a0b8f['status']===0x191){let _0x50da1f=await _0x5a0b8f[_0x3b7566(0xcb)]();throw new Error(_0x3b7566(0x170)+_0x50da1f);}if(!_0x5a0b8f['ok']){let _0x4a0455=await _0x5a0b8f['text']();throw new Error(_0x3b7566(0xd1)+_0x5a0b8f[_0x3b7566(0xd4)]+':\x20'+_0x4a0455);}let _0x21db49=await _0x5a0b8f[_0x3b7566(0xd9)]();return{'token':_0x21db49['token'],'expiresIn':_0x21db49[_0x3b7566(0x131)]};}async[_0x5d9690(0x168)](){const _0x3764aa=_0x5d9690;let {token:_0x302343}=await this[_0x3764aa(0x104)]();return _0x3764aa(0xdb)+_0x302343;}},y=class{constructor(_0x23ef13){const _0x270965=_0x5d9690;this[_0x270965(0x15c)]=_0x23ef13;}[_0x5d9690(0x15c)];[_0x5d9690(0xc3)]=null;[_0x5d9690(0x103)]=null;async[_0x5d9690(0x104)](){const _0x4ab77e=_0x5d9690;if(this[_0x4ab77e(0xc3)]&&this[_0x4ab77e(0xc3)][_0x4ab77e(0xda)]>Date[_0x4ab77e(0x15d)]())return{'token':this[_0x4ab77e(0xc3)][_0x4ab77e(0x102)],'expiresIn':this[_0x4ab77e(0xc3)]['expiresIn']};if(this[_0x4ab77e(0x103)])return this[_0x4ab77e(0x103)];this[_0x4ab77e(0x103)]=this[_0x4ab77e(0x16b)]();try{return await this['inflight'];}finally{this[_0x4ab77e(0x103)]=null;}}async[_0x5d9690(0x168)](){const _0x21d9c5=_0x5d9690;let {token:_0x1a3b76}=await this[_0x21d9c5(0x104)]();return _0x21d9c5(0xdb)+_0x1a3b76;}async[_0x5d9690(0x16b)](){const _0x43fc62=_0x5d9690;let {token:_0x46ef0f,expiresIn:_0x3abd27}=await this['inner'][_0x43fc62(0x104)](),_0x38cbce=Date[_0x43fc62(0x15d)]()+(_0x3abd27-0x3c)*0x3e8;return this[_0x43fc62(0xc3)]={'token':_0x46ef0f,'expiresIn':_0x3abd27,'expiresAt':_0x38cbce},{'token':_0x46ef0f,'expiresIn':_0x3abd27};}};import{randomUUID as _0x38c13f}from'node:crypto';import{existsSync as _0x240a9d,mkdirSync as _0x48c409,readFileSync as _0x5ec0bd,writeFileSync as _0x13bee7}from'node:fs';import{join as _0x6fc023}from'node:path';var Y=_0x5d9690(0x132),S=0x100,k=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function Z(_0x42f45b){const _0x7fd596=_0x5d9690;return _0x42f45b[_0x7fd596(0x143)]>0x0&&_0x42f45b[_0x7fd596(0x10b)]()===_0x42f45b&&!k[_0x7fd596(0x166)](_0x42f45b)&&new TextEncoder()['encode'](_0x42f45b)[_0x7fd596(0xd3)]<=S;}function U(_0x29b246,_0x5757c4){const _0xa40f10=_0x5d9690;if(_0x29b246!==void 0x0){if(typeof _0x29b246!=_0xa40f10(0xe8)||_0x29b246['length']===0x0)throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+'\x20must\x20be\x20a\x20non-empty\x20string');if(_0x29b246['trim']()!==_0x29b246)throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+_0xa40f10(0x12f));if(k[_0xa40f10(0x166)](_0x29b246))throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+_0xa40f10(0xab));if(new TextEncoder()['encode'](_0x29b246)['byteLength']>S)throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+_0xa40f10(0xad)+S+_0xa40f10(0x134));return _0x29b246;}}function L(_0x2ae1fe){const _0x277dbd=_0x5d9690;if(_0x2ae1fe!==void 0x0){if(_0x2ae1fe===null||typeof _0x2ae1fe!='object'||Array[_0x277dbd(0x113)](_0x2ae1fe))throw new TypeError(_0x277dbd(0x11f));return Object['freeze']({'deviceId':U(_0x2ae1fe[_0x277dbd(0xe6)],_0x277dbd(0xe6)),'userId':U(_0x2ae1fe[_0x277dbd(0x161)],_0x277dbd(0x161))});}}function N(_0x4072a5){const _0x55d126=_0x5d9690;return _0x4072a5?.[_0x55d126(0xe6)]!==void 0x0||_0x4072a5?.[_0x55d126(0x161)]!==void 0x0;}function A(_0x7c9ef0){const _0x18b1f6=_0x5d9690;if(!_0x7c9ef0?.['trim']())return;let _0x68fff4=_0x6fc023(_0x7c9ef0,Y);try{if(_0x240a9d(_0x68fff4)){let _0x513247=_0x5ec0bd(_0x68fff4,_0x18b1f6(0x121))[_0x18b1f6(0x10b)]();return Z(_0x513247)?_0x513247:void 0x0;}_0x48c409(_0x7c9ef0,{'recursive':!0x0});let _0x7d679e=_0x38c13f();return _0x13bee7(_0x68fff4,_0x7d679e,_0x18b1f6(0x121)),_0x7d679e;}catch{return;}}var ee=0x1;function x(_0x28add3){const _0x3a9c73=_0x5d9690;let _0x334374=_0x28add3['modelArtifactContractVersion'];if(typeof _0x334374!=_0x3a9c73(0x154))throw q();let _0x3b22d8=_0x334374[_0x3a9c73(0xbd)](_0x28add3);if(!Number[_0x3a9c73(0xce)](_0x3b22d8)||_0x3b22d8<ee)throw q();}function q(){const _0x4d0bf1=_0x5d9690;return new Error(_0x4d0bf1(0xe3));}var Pe=0x708*0x3e8,te={'INVALID_ARGUMENT':!0x0,'NOT_FOUND':!0x0,'UNAUTHORIZED':!0x0,'NETWORK':!0x0,'DESERIALIZATION':!0x0,'MODEL_UNAVAILABLE':!0x0,'INTERNAL':!0x0},ne=new Set(Object['keys'](te));function re(_0x124d4b){const _0x434afa=_0x5d9690;if(!(_0x124d4b instanceof Error))return!0x1;let _0x25b3fd=_0x124d4b[_0x434afa(0xed)];return typeof _0x25b3fd==_0x434afa(0xe8)&&ne['has'](_0x25b3fd);}function p(_0x29aa5e,_0x529a61){return Object['assign'](new Error(_0x529a61),{'code':_0x29aa5e});}function b(_0x51d7a4){const _0x1e1c75=_0x5d9690;if(!(_0x51d7a4?.[_0x1e1c75(0xdc)]===void 0x0&&_0x51d7a4?.['candidateDepth']===void 0x0))return{'minScore':_0x51d7a4[_0x1e1c75(0xdc)],'candidateDepth':_0x51d7a4['candidateDepth']};}function _0x259c(){const _0x36513f=['warn','loadIndexes','data','609006HyBbtI','contentType','PendingUpload','loadModel','IndexManager','\x27\x20is\x20closed','function','received\x20','authenticator','then','POST','createIndex','412348fpUHsh','4689620KpJqog','inner','now','error','wrapProgress','replace','userId','number','INVALID_ARGUMENT','stringify','addDocs','test','toLowerCase','getAuthHeader','ensureCachePathDeviceId','authUrl','fetchAndCache','cachePathDeviceId','80595hlWlaO','query','queryText','Authentication\x20failed\x20(HTTP\x20401):\x20','asyncDispose','parseDocuments','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','embedding','refreshCadence','HTTP\x20error!\x20status:\x20','projectKey','includePaths','added','sources','application/json','requireMultiIndexCore','pushIndex','resync','CLOUD_API_INDEX_URL','getJobStatus','respectRobots','pending_upload','\x20contains\x20an\x20unsupported\x20character','listWebSources','\x20must\x20be\x20at\x20most\x20','maxDepth','inspectSnapshot','createIndexFromFiles','from','ManageClient','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','Index\x20\x22','getDocs','entries','addDocs\x20requires\x20at\x20least\x20one\x20document','updateWebSource','currentPhase','addDocuments','updated','166888MMbpgW','call','678412jEhNcq','deviceIdentity','docCount','\x27\x20returned\x20by\x20moss-core','createAuthenticatedSessionInner','cache','_warmModel','moss-core\x20rejected\x20the\x20auth\x20token:\x20','createWebSource','path','manageClient','default','map','text','MOSS_AUTH_URL','building','isSafeInteger','deleteWebSource','progress','HTTP\x20','createIndex\x20requires\x20at\x20least\x20one\x20document','byteLength','status','completed','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','topK','1660746lIynub','json','expiresAt','Bearer\x20','minScore','startsWith','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','[moss]\x20Auth\x20request\x20','MossClient\x20options.identity.','loadIndex','hasCustomAuthenticator','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','queryMultiIndex','message','deviceId','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','string','applySessionIdentity','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','7XrwjPx','code','getWebSource','mossDeviceId','rebuildLegacy','modelId','some','unloadIndex','rootUrl','deleteDocuments','normalizeJobStatus','setIdentity','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','fromEntries','name','upsert','withAuthenticator','81ubvxEA','loadFromDisk','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','close','token','inflight','getAuthToken','CLOUD_API_AUTH_URL','onProgress','version','projectId','env','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','trim','saveToDisk','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','indexName','maxPages','indexManager','ManageApiError','SDK_VERSION_NUMBER','isArray','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','_fromInner','_create','deleteIndex','getDocuments','resyncWebSource','maxDocuments','queryMultiIndexText','authNotifyFn','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','alpha','MossClient\x20options.identity\x20must\x20be\x20an\x20object','rejectAuthRequest','utf8','custom','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','pendingupload','addDocumentsText','excludePaths','timeout','jobId','getIndex','applyIdentity','Uploading','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','SessionIndex','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','expiresIn','.moss-device-id','identity','\x20UTF-8\x20bytes','bind','toByteArray','NOT_FOUND','unloadIndexes','hasIndex','slice','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','resolveAuthRequest','5QrMneE','manifestSha256','filter','body','configuredIdentity','listIndexes','length','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','deleteDocs','uploading','cachePath','all','arrayBuffer','MossClient\x20is\x20closed'];_0x259c=function(){return _0x36513f;};return _0x259c();}function D(_0x3eefdb){const _0x2a3eed=_0x5d9690;return _0x3eefdb instanceof Error?_0x3eefdb[_0x2a3eed(0xe5)]:String(_0x3eefdb);}function se(_0xfc92cc){const _0x2e8f83=_0x5d9690;if(_0xfc92cc===null||typeof _0xfc92cc!='object')return _0x2e8f83(0x155)+String(_0xfc92cc);if(Array['isArray'](_0xfc92cc))return'received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected';let _0x34c687=_0xfc92cc;return typeof _0x34c687[_0x2e8f83(0x129)]!=_0x2e8f83(0xe8)||_0x34c687[_0x2e8f83(0x129)]['length']===0x0?_0x2e8f83(0xff)+String(_0x34c687[_0x2e8f83(0x129)])+')':typeof _0x34c687[_0x2e8f83(0xd4)]!=_0x2e8f83(0xe8)||_0x34c687[_0x2e8f83(0xd4)][_0x2e8f83(0x143)]===0x0?_0x2e8f83(0xb3)+String(_0x34c687[_0x2e8f83(0xd4)])+')':typeof _0x34c687[_0x2e8f83(0xd0)]!=_0x2e8f83(0x162)||!Number['isFinite'](_0x34c687[_0x2e8f83(0xd0)])?_0x2e8f83(0x130)+String(_0x34c687[_0x2e8f83(0xd0)])+')':_0x34c687[_0x2e8f83(0xb9)]!==void 0x0&&_0x34c687[_0x2e8f83(0xb9)]!==null&&typeof _0x34c687[_0x2e8f83(0xb9)]!=_0x2e8f83(0xe8)?_0x2e8f83(0x12d)+String(_0x34c687['currentPhase'])+')':null;}var w=class{[_0x5d9690(0x156)];['manageClient'];[_0x5d9690(0x110)];[_0x5d9690(0x16c)];['configuredIdentity'];[_0x5d9690(0x108)];[_0x5d9690(0x11c)];constructor(_0x567e65,_0x395bb7,_0xcd974){const _0x51a82f=_0x5d9690;this[_0x51a82f(0x141)]=L(_0xcd974?.[_0x51a82f(0x133)]),this['cachePathDeviceId']=A(_0xcd974?.['cachePath']),this[_0x51a82f(0x108)]=_0x567e65;let _0x342df6=typeof _0x395bb7=='string'?new I(_0x567e65,_0x395bb7):_0x395bb7;this['authenticator']=new y(_0x342df6);let _0x295990=_0x1f7311,_0x3fe737=_0x295990['ManageClient']??_0x295990[_0x51a82f(0xc9)]?.[_0x51a82f(0xb2)],_0x3bdeb6=_0x295990[_0x51a82f(0x152)]??_0x295990['default']?.[_0x51a82f(0x152)];if(!_0x3fe737||!_0x3bdeb6)throw new Error(_0x51a82f(0x173));if(typeof _0x395bb7==_0x51a82f(0xe8))this[_0x51a82f(0xc8)]=new _0x3fe737(_0x567e65,_0x395bb7),this['indexManager']=new _0x3bdeb6(_0x567e65,_0x395bb7);else{let _0x2c7eac=_0x295990['resolveAuthRequest']??_0x295990['default']?.[_0x51a82f(0x13c)],_0x395ec4=_0x295990[_0x51a82f(0x120)]??_0x295990[_0x51a82f(0xc9)]?.[_0x51a82f(0x120)];if(!_0x2c7eac||!_0x395ec4)throw new Error(_0x51a82f(0xf8));let _0xbf8a68=this['authenticator'],_0x55f45a=(_0x353b2b,_0x5ef217)=>{const _0x586717=_0x51a82f;try{_0x395ec4(_0x353b2b,_0x5ef217);}catch(_0x51b4d0){console['warn'](_0x586717(0xdf)+_0x353b2b+'\x20could\x20not\x20be\x20settled:\x20'+D(_0x51b4d0));}},_0x1814ee=(_0x2d65ee,_0x2d98b4)=>{const _0x14fb01=_0x51a82f;try{_0x2c7eac(_0x2d65ee,_0x2d98b4);}catch(_0x369d46){_0x55f45a(_0x2d65ee,_0x14fb01(0xc5)+D(_0x369d46));}},_0x12f16d=!0x1,_0x105f62=(_0x6f1beb,_0x1b2339)=>{const _0x4f35fa=_0x51a82f;if(_0x6f1beb||!Number[_0x4f35fa(0xce)](_0x1b2339)||_0x1b2339<0x0){_0x12f16d||(_0x12f16d=!0x0,console[_0x4f35fa(0x14b)](_0x4f35fa(0x10d)+(_0x6f1beb?_0x6f1beb[_0x4f35fa(0xe5)]:_0x4f35fa(0x155)+String(_0x1b2339))));return;}_0xbf8a68['getAuthHeader']()[_0x4f35fa(0x157)](_0x2f20be=>{const _0x44b38a=_0x4f35fa;let _0x523d9f=_0x2f20be[_0x44b38a(0xdd)](_0x44b38a(0xdb))?_0x2f20be[_0x44b38a(0x13a)](0x7):_0x2f20be;_0x1814ee(_0x1b2339,_0x523d9f);},_0x445a0f=>_0x55f45a(_0x1b2339,D(_0x445a0f)));};this[_0x51a82f(0x11c)]=_0x105f62;let _0x51d358=_0x3fe737,_0x37c960=_0x3bdeb6;if(!_0x51d358[_0x51a82f(0xfc)]||!_0x37c960[_0x51a82f(0xfc)])throw new Error(_0x51a82f(0x124));this[_0x51a82f(0xc8)]=_0x51d358[_0x51a82f(0xfc)](_0x567e65,_0x105f62),this[_0x51a82f(0x110)]=_0x37c960[_0x51a82f(0xfc)](_0x567e65,_0x105f62);}this[_0x51a82f(0x12b)](this[_0x51a82f(0x110)]);}async[_0x5d9690(0x101)](){const _0x10aafb=_0x5d9690;let _0xdc4708=this[_0x10aafb(0x110)][_0x10aafb(0x101)];if(typeof _0xdc4708!=_0x10aafb(0x154))throw new Error(_0x10aafb(0x114));await _0xdc4708[_0x10aafb(0xbd)](this['indexManager']);}async[_0x5d9690(0x104)](){const _0x3bc3f5=_0x5d9690;return this['authenticator'][_0x3bc3f5(0x104)]();}[_0x5d9690(0x15f)](_0xc1f191){if(!_0xc1f191)return;let _0x58434b=!0x1;return(_0x29cb86,_0x1261af)=>{const _0xc90f7f=_0x1238;let _0x2d69dd=_0x29cb86?_0x29cb86[_0xc90f7f(0xe5)]:se(_0x1261af);if(_0x2d69dd!==null){_0x58434b||(_0x58434b=!0x0,console[_0xc90f7f(0x14b)](_0xc90f7f(0xeb)+_0x2d69dd));return;}_0xc1f191(_0x1261af);};}[_0x5d9690(0xf6)](_0x1d5698){const _0x388600=_0x5d9690;let _0x3987af=_0x1d5698[_0x388600(0x10b)]()[_0x388600(0x167)]()['replace'](/\s+/g,'_'),_0x1b0f79=_0x3987af[_0x388600(0x160)](/_/g,'');if(_0x3987af===_0x388600(0xaa)||_0x1b0f79===_0x388600(0x125))return _0x600eb6[_0x388600(0x150)];if(_0x3987af===_0x388600(0x146))return _0x600eb6[_0x388600(0x12c)];if(_0x3987af===_0x388600(0xcd))return _0x600eb6['Building'];if(_0x3987af===_0x388600(0xd5))return _0x600eb6['Completed'];if(_0x3987af==='failed')return _0x600eb6['Failed'];throw new Error('Unsupported\x20job\x20status\x20\x27'+_0x1d5698+_0x388600(0xc1));}async[_0x5d9690(0x159)](_0xdd023c,_0x3820f7,_0x2496d2,_0x2c121a){const _0x29c84b=_0x5d9690;if(!_0x3820f7[_0x29c84b(0x143)])throw new Error(_0x29c84b(0xd2));return await this['manageClient'][_0x29c84b(0x159)](_0xdd023c,_0x3820f7,_0x2496d2,this['wrapProgress'](_0x2c121a?.[_0x29c84b(0x106)]));}async[_0x5d9690(0x136)](_0x2b2e3d){const _0x26b7a9=_0x5d9690;if(_0x2b2e3d instanceof Uint8Array)return Array['from'](_0x2b2e3d);if(_0x2b2e3d instanceof ArrayBuffer)return Array[_0x26b7a9(0xb1)](new Uint8Array(_0x2b2e3d));if(typeof _0x2b2e3d[_0x26b7a9(0x149)]==_0x26b7a9(0x154)){let _0x134cdb=await _0x2b2e3d['arrayBuffer']();return Array[_0x26b7a9(0xb1)](new Uint8Array(_0x134cdb));}throw new Error('Unsupported\x20data\x20type\x20for\x20file\x20upload');}async[_0x5d9690(0xb0)](_0x9671cc,_0xec2d91,_0x384153){const _0x45c5cf=_0x5d9690;if(_0xec2d91['length']===0x0)throw new Error(_0x45c5cf(0x13b));let _0x5e9280=_0x384153?.[_0x45c5cf(0xf1)]??'moss-minilm',_0x509c5b=await Promise[_0x45c5cf(0x148)](_0xec2d91['map'](async _0x5f1c3f=>({'name':_0x5f1c3f[_0x45c5cf(0xfa)],'contentType':_0x5f1c3f[_0x45c5cf(0x14f)],'path':_0x5f1c3f[_0x45c5cf(0xc7)]??void 0x0,'data':_0x5f1c3f[_0x45c5cf(0x14d)]!=null?await this[_0x45c5cf(0x136)](_0x5f1c3f['data']):void 0x0})));return await this[_0x45c5cf(0xc8)][_0x45c5cf(0xb0)](_0x9671cc,_0x509c5b,_0x5e9280,this[_0x45c5cf(0x15f)](_0x384153?.[_0x45c5cf(0x106)]),_0x384153?.['parseOptions']??null);}async[_0x5d9690(0x165)](_0x4396e4,_0x224f74,_0x2145f6){const _0x459559=_0x5d9690;if(Array[_0x459559(0x113)](_0x224f74)&&_0x224f74[_0x459559(0x143)]===0x0)throw new Error(_0x459559(0xb7));return await this['manageClient'][_0x459559(0x165)](_0x4396e4,_0x224f74,_0x2145f6??null,this['wrapProgress'](_0x2145f6?.[_0x459559(0x106)]));}async[_0x5d9690(0x145)](_0x2b1a36,_0x13cfde,_0x56815d){const _0x692cca=_0x5d9690;if(Array[_0x692cca(0x113)](_0x13cfde)&&_0x13cfde[_0x692cca(0x143)]===0x0)throw new Error(_0x692cca(0x123));return await this[_0x692cca(0xc8)]['deleteDocs'](_0x2b1a36,_0x13cfde,this['wrapProgress'](_0x56815d?.[_0x692cca(0x106)]));}async[_0x5d9690(0xa8)](_0x5624eb){const _0x45579a=_0x5d9690;let _0x400b87=await this[_0x45579a(0xc8)][_0x45579a(0xa8)](_0x5624eb);return{..._0x400b87,'status':this[_0x45579a(0xf6)](_0x400b87[_0x45579a(0xd4)]),'currentPhase':_0x400b87[_0x45579a(0xb9)]??null,'error':_0x400b87[_0x45579a(0x15e)]??null};}async['getIndex'](_0x260f74){const _0x5180ad=_0x5d9690;return this[_0x5180ad(0xc8)]['getIndex'](_0x260f74);}async['listIndexes'](){const _0x49a987=_0x5d9690;return this['manageClient'][_0x49a987(0x142)]();}async[_0x5d9690(0x117)](_0x20e69e){const _0x23e6f9=_0x5d9690;return this['manageClient'][_0x23e6f9(0x117)](_0x20e69e);}async[_0x5d9690(0xb5)](_0x4a3a55,_0x23a6ec){const _0x50c356=_0x5d9690;return this[_0x50c356(0xc8)][_0x50c356(0xb5)](_0x4a3a55,_0x23a6ec??null);}async['loadIndex'](_0x8e2571,_0xaa4ed5){const _0x23f563=_0x5d9690;return this[_0x23f563(0x169)](_0xaa4ed5?.[_0x23f563(0x147)]),(await this[_0x23f563(0x110)][_0x23f563(0xe1)](_0x8e2571,_0xaa4ed5??null))[_0x23f563(0xfa)];}async[_0x5d9690(0x14c)](_0x4f9377,_0x4ba712){const _0x55a06e=_0x5d9690;let _0x32fc82=this['requireMultiIndexCore']();return this[_0x55a06e(0x169)](_0x4ba712?.['cachePath']),_0x32fc82[_0x55a06e(0x14c)](_0x4f9377,_0x4ba712??null);}async[_0x5d9690(0xf3)](_0xdaa616){const _0x4d2998=_0x5d9690;return this[_0x4d2998(0x110)][_0x4d2998(0xf3)](_0xdaa616);}async['unloadIndexes'](_0x587c01){const _0x30511f=_0x5d9690;return this[_0x30511f(0xa4)]()[_0x30511f(0x138)](_0x587c01);}[_0x5d9690(0xa4)](){const _0x18ed68=_0x5d9690;let _0x2c7244=this[_0x18ed68(0x110)];if(typeof _0x2c7244['queryMultiIndex']!='function'||typeof _0x2c7244[_0x18ed68(0x11b)]!=_0x18ed68(0x154)||typeof _0x2c7244[_0x18ed68(0x14c)]!=_0x18ed68(0x154)||typeof _0x2c7244[_0x18ed68(0x138)]!=_0x18ed68(0x154))throw new Error(_0x18ed68(0x10a));return{'queryMultiIndex':_0x2c7244['queryMultiIndex'][_0x18ed68(0x135)](_0x2c7244),'queryMultiIndexText':_0x2c7244[_0x18ed68(0x11b)][_0x18ed68(0x135)](_0x2c7244),'loadIndexes':_0x2c7244[_0x18ed68(0x14c)][_0x18ed68(0x135)](_0x2c7244),'unloadIndexes':_0x2c7244[_0x18ed68(0x138)][_0x18ed68(0x135)](_0x2c7244)};}[_0x5d9690(0x169)](_0x2cf27a){const _0x10da82=_0x5d9690;_0x2cf27a&&this[_0x10da82(0x16c)]===void 0x0&&A(_0x2cf27a);}[_0x5d9690(0x12b)]=_0x2ae6f0=>{const _0x1ecbe4=_0x5d9690;!N(this[_0x1ecbe4(0x141)])&&this['cachePathDeviceId']===void 0x0||_0x2ae6f0['setIdentity'](this[_0x1ecbe4(0x141)]?.[_0x1ecbe4(0xe6)]??null,this['configuredIdentity']?.['userId']??null,this[_0x1ecbe4(0x16c)]??null);};['applySessionIdentity']=_0x562794=>{const _0x1feb0c=_0x5d9690;let _0x434daf=this['indexManager'][_0x1feb0c(0xbf)]?.();if(!_0x434daf){this[_0x1feb0c(0x12b)](_0x562794);return;}_0x562794[_0x1feb0c(0xf7)](_0x434daf[_0x1feb0c(0xe6)]??null,this[_0x1feb0c(0x141)]?.[_0x1feb0c(0x161)]??null,_0x434daf[_0x1feb0c(0xef)]??null);};[_0x5d9690(0xe2)](){return this['authNotifyFn']!==void 0x0;}async[_0x5d9690(0xc2)](_0x2e44de,_0x58bfbb,_0x490628){const _0x1b3978=_0x5d9690;if(!this[_0x1b3978(0x11c)])throw new Error('createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client');let _0xfaf577=_0x1f7311,_0x44f556=_0xfaf577[_0x1b3978(0x12e)]??_0xfaf577[_0x1b3978(0xc9)]?.['SessionIndex'];if(!_0x44f556||typeof _0x44f556[_0x1b3978(0xfc)]!='function')throw new Error(_0x1b3978(0x100));return _0x490628&&x(_0x44f556),_0x44f556[_0x1b3978(0xfc)](_0x2e44de,_0x58bfbb,this[_0x1b3978(0x108)],this[_0x1b3978(0x11c)],null,null,_0x490628?.[_0x1b3978(0x107)]??null,_0x490628?.[_0x1b3978(0x13e)]??null);}async[_0x5d9690(0x16e)](_0x3f09c4,_0x3c3430,_0x328f65){const _0x55a838=_0x5d9690;if(!await this['indexManager'][_0x55a838(0x139)](_0x3f09c4))throw p(_0x55a838(0x137),_0x55a838(0xb4)+_0x3f09c4+_0x55a838(0xd6)+_0x3f09c4+_0x55a838(0xde));let _0x58d23b=_0x328f65?.[_0x55a838(0xd7)]??0x5,_0x110f4c=_0x328f65?.[_0x55a838(0x11e)]??0.8;return _0x328f65?.[_0x55a838(0x174)]?this[_0x55a838(0x110)][_0x55a838(0x16e)](_0x3f09c4,_0x3c3430,_0x328f65[_0x55a838(0x174)],_0x58d23b,_0x110f4c,_0x328f65?.['filter'],b(_0x328f65)):this['indexManager'][_0x55a838(0x16f)](_0x3f09c4,_0x3c3430,_0x58d23b,_0x110f4c,_0x328f65?.[_0x55a838(0x13f)],b(_0x328f65));}async[_0x5d9690(0xe4)](_0x283b1d,_0x231230,_0x46aac3){const _0x42a94f=_0x5d9690;if(_0x283b1d['length']===0x0)throw p(_0x42a94f(0x163),_0x42a94f(0x11d));let _0x183f64=this[_0x42a94f(0xa4)](),_0x1657e9=_0x46aac3?.[_0x42a94f(0xd7)]??0xa,_0x4ab51c=_0x46aac3?.[_0x42a94f(0x11e)]??0.8;return _0x46aac3?.[_0x42a94f(0x174)]?_0x183f64[_0x42a94f(0xe4)](_0x283b1d,_0x231230,_0x46aac3[_0x42a94f(0x174)],_0x1657e9,_0x4ab51c,_0x46aac3?.['filter'],b(_0x46aac3)):_0x183f64[_0x42a94f(0x11b)](_0x283b1d,_0x231230,_0x1657e9,_0x4ab51c,_0x46aac3?.[_0x42a94f(0x13f)],b(_0x46aac3));}};import{SessionIndex as _0x4f3d4d}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x49bd6c,_0x382a9f,_0x4fb340){this.#s=_0x49bd6c,this.#r=_0x382a9f,this.#e=_0x4fb340;}static async['_create'](_0x2866cd,_0x588ec3,_0x2a3f4f,_0x4c78e2,_0xf42072,_0x3ce766,_0x8136c1){const _0x4680da=_0x5d9690;let _0x45f3d4=_0x4f3d4d;_0x8136c1&&x(_0x45f3d4);let _0x5a3407=await _0x45f3d4['create'](_0x2866cd,_0x588ec3,_0x2a3f4f,_0x4c78e2,_0xf42072??null,_0x8136c1?.[_0x4680da(0x107)]??null,_0x8136c1?.[_0x4680da(0x13e)]??null);return r[_0x4680da(0x115)](_0x2866cd,_0x588ec3,_0x5a3407,_0x3ce766);}static[_0x5d9690(0x115)](_0x52d8a9,_0x4471cf,_0x54a2c9,_0x599e2e){return _0x599e2e?.(_0x54a2c9),new r(_0x52d8a9,_0x4471cf,_0x54a2c9);}get[_0x5d9690(0xfa)](){return this.#s;}get['docCount'](){const _0xbe9ea4=_0x5d9690;return this.#n(),this.#e[_0xbe9ea4(0xc0)];}get[_0x5d9690(0xf1)](){return this.#r;}async[_0x5d9690(0x165)](_0x33863c,_0xf6fe90){const _0x2a7334=_0x5d9690;this.#n();let _0x4748f3=_0xf6fe90?{'upsert':_0xf6fe90[_0x2a7334(0xfb)]??!0x0}:void 0x0;if(this.#r===_0x2a7334(0x122)){let _0x804a6d=r.#t(_0x33863c),_0x456116=_0x33863c['map'](_0x86aacd=>{const _0x1e5860=_0x2a7334;let _0x2de553={..._0x86aacd};return delete _0x2de553[_0x1e5860(0x174)],_0x2de553;}),_0xe7e9ed=await this.#e[_0x2a7334(0xba)](_0x456116,_0x804a6d,_0x4748f3);return{'added':_0xe7e9ed[_0x2a7334(0xa1)],'updated':_0xe7e9ed['updated']};}let _0x348aa6=await this.#e[_0x2a7334(0x126)](_0x33863c,_0x4748f3);return{'added':_0x348aa6[_0x2a7334(0xa1)],'updated':_0x348aa6[_0x2a7334(0xbb)]};}async['deleteDocs'](_0x15250b){const _0x4f1113=_0x5d9690;return this.#n(),await this.#e[_0x4f1113(0xf5)](_0x15250b);}async[_0x5d9690(0xb5)](_0x2d2826){const _0x53a5fe=_0x5d9690;return this.#n(),await this.#e[_0x53a5fe(0x118)](_0x2d2826??null);}async[_0x5d9690(0x16e)](_0x3a99b2,_0x3e917a){const _0x4827e0=_0x5d9690;this.#n();let _0x1fae6d=_0x3e917a?.[_0x4827e0(0xd7)]??0x5,_0x167e3d=_0x3e917a?.[_0x4827e0(0x11e)]??0.8,_0x15de2e=_0x3e917a?.[_0x4827e0(0x13f)]??null,_0x11bd33=_0x3e917a?.[_0x4827e0(0x174)];if(_0x11bd33==null){if(this.#r===_0x4827e0(0x122))throw p('INVALID_ARGUMENT',_0x4827e0(0x144));return await this.#e['queryText'](_0x3a99b2,_0x1fae6d,_0x167e3d,_0x15de2e);}return await this.#e['query'](_0x3a99b2,_0x1fae6d,Array['from'](_0x11bd33),_0x167e3d,_0x15de2e);}async['loadIndex'](_0x150248,_0x1c9db9){const _0x56cba4=_0x5d9690;return this.#n(),this.#e[_0x56cba4(0xe1)](_0x150248,_0x1c9db9??null);}async[_0x5d9690(0xa5)](){const _0x1186d5=_0x5d9690;return this.#n(),this.#e[_0x1186d5(0xa5)]();}async['saveToDisk'](_0x24cc0){const _0x2dee17=_0x5d9690;this.#n(),await this.#e[_0x2dee17(0x10c)](_0x24cc0);}async[_0x5d9690(0xfe)](_0x42e202,_0x1e361b){const _0x3d49e2=_0x5d9690;this.#n();let _0x1e5189=_0x1e361b?.[_0x3d49e2(0xf0)]??!0x0;return await this.#e['loadFromDisk'](_0x42e202,{'rebuildLegacy':_0x1e5189});}async[_0x5d9690(0xaf)](_0x2e876f){const _0x398f69=_0x5d9690;return this.#n(),await this.#e[_0x398f69(0xaf)](_0x2e876f);}#n(){const _0x84e74c=_0x5d9690;if(this.#i)throw new Error('SessionIndex\x20\x27'+this.#s+_0x84e74c(0x153));}['close'](){return this.#a??=this.#o(),this.#a;}async #o(){this.#i=!0x0;let _0x24900b=this.#e['close'];if(typeof _0x24900b!='function')throw new Error('@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()');await _0x24900b['call'](this.#e);}async[Symbol[_0x5d9690(0x171)]](){const _0x5aa711=_0x5d9690;return this[_0x5aa711(0x101)]();}async[_0x5d9690(0xc4)](){const _0x238ab1=_0x5d9690;this.#n(),this.#r!==_0x238ab1(0x122)&&await this.#e[_0x238ab1(0x151)]();}static#t(_0x5739be){const _0x5b80e0=_0x5d9690;let _0x162635=_0x5739be['filter'](_0x229e10=>!_0x229e10[_0x5b80e0(0x174)]||_0x229e10[_0x5b80e0(0x174)][_0x5b80e0(0x143)]===0x0)[_0x5b80e0(0xca)](_0x46d796=>_0x46d796['id']);if(_0x162635[_0x5b80e0(0x143)]>0x0)throw new Error(_0x5b80e0(0xe7)+_0x162635['join'](',\x20')+'.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.');return _0x5739be[_0x5b80e0(0xca)](_0x3210be=>Array[_0x5b80e0(0xb1)](_0x3210be['embedding']??[]));}};import{validateIndexName as _0x447e7a}from'@moss-js/moss-core';function _0x1238(_0x577bc1,_0xc6836c){_0x577bc1=_0x577bc1-0x9d;const _0x259c5b=_0x259c();let _0x123859=_0x259c5b[_0x577bc1];return _0x123859;}var ie='https://service.usemoss.dev',ae='/v1/manage',M=class extends Error{[_0x5d9690(0xd4)];[_0x5d9690(0x140)];constructor(_0x297e78,_0x5731d3){const _0x3fc807=_0x5d9690;let _0x12f2b5=_0x5731d3?':\x20'+_0x5731d3:'';super(_0x3fc807(0x9e)+_0x297e78+_0x12f2b5),this['name']=_0x3fc807(0x111),this[_0x3fc807(0xd4)]=_0x297e78,this[_0x3fc807(0x140)]=_0x5731d3;}};function ue(){const _0xb25592=_0x5d9690;return''+(typeof process<'u'&&process[_0xb25592(0x109)]['MOSS_CLOUD_API_BASE_URL']||ie)[_0xb25592(0x160)](/\/+$/,'')+ae;}function de(_0x466472){const _0x536af=_0x5d9690;return _0x466472?Object[_0x536af(0xf9)](Object[_0x536af(0xb6)](_0x466472)[_0x536af(0x13f)](([,_0x263c17])=>_0x263c17!==void 0x0)):{};}async function j(_0x2d5201,_0x192a50,_0x7f11d3,_0x10e7c5){const _0x22e80f=_0x5d9690;let _0x174eac={...de(_0x10e7c5),'action':_0x7f11d3,'projectId':_0x2d5201},_0x1023f1=await fetch(ue(),{'method':_0x22e80f(0x158),'headers':{'Content-Type':'application/json','X-Project-Key':_0x192a50},'body':JSON[_0x22e80f(0x164)](_0x174eac),'signal':AbortSignal[_0x22e80f(0x128)](0x927c0)}),_0x32a7e3=await _0x1023f1['text']();if(!_0x1023f1['ok'])throw new M(_0x1023f1[_0x22e80f(0xd4)],_0x32a7e3);return _0x32a7e3?JSON['parse'](_0x32a7e3):{};}var W='moss-minilm',R=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0xbe5b67,_0x5e5b4f,_0xedc69c){this.#e=new w(_0xbe5b67,_0x5e5b4f,_0xedc69c),this.#r=_0xbe5b67,this.#s=typeof _0x5e5b4f=='string'?_0x5e5b4f:null;}async[_0x5d9690(0x104)](){const _0x136c71=_0x5d9690;return this.#t(),this.#e[_0x136c71(0x104)]();}async['createIndex'](_0x2f0b12,_0x43b745,_0x2c0f34){const _0x5380f9=_0x5d9690;this.#t();let _0x5d8a99;return _0x2c0f34?.[_0x5380f9(0xf1)]!==void 0x0?_0x5d8a99=_0x2c0f34['modelId']:_0x5d8a99=_0x43b745[_0x5380f9(0xf2)](_0x31bb5a=>Array[_0x5380f9(0x113)](_0x31bb5a[_0x5380f9(0x174)])&&_0x31bb5a['embedding']['length']>0x0)?'custom':W,this.#e[_0x5380f9(0x159)](_0x2f0b12,_0x43b745,_0x5d8a99,_0x2c0f34);}async[_0x5d9690(0xb0)](_0x592740,_0x18579d,_0x31e388){const _0x35e7de=_0x5d9690;return this.#t(),this.#e[_0x35e7de(0xb0)](_0x592740,_0x18579d,_0x31e388);}async[_0x5d9690(0x12a)](_0xd0c1eb){return this.#t(),this.#e['getIndex'](_0xd0c1eb);}async[_0x5d9690(0x142)](){const _0x4a3cb5=_0x5d9690;return this.#t(),this.#e[_0x4a3cb5(0x142)]();}async['deleteIndex'](_0x493bfc){return this.#t(),this.#e['deleteIndex'](_0x493bfc);}async['addDocs'](_0xd40183,_0x91c7ae,_0x372572){const _0x337e5e=_0x5d9690;return this.#t(),this.#e[_0x337e5e(0x165)](_0xd40183,_0x91c7ae,_0x372572);}async[_0x5d9690(0x145)](_0x121706,_0x1ba4a0,_0x2dec65){const _0x6625c1=_0x5d9690;return this.#t(),this.#e[_0x6625c1(0x145)](_0x121706,_0x1ba4a0,_0x2dec65);}async[_0x5d9690(0xa8)](_0x46e591){return this.#t(),this.#e['getJobStatus'](_0x46e591);}async[_0x5d9690(0xc6)](_0x1a069e,_0x45475f,_0x2eec03){const _0xb34632=_0x5d9690;return this.#t(),_0x447e7a(_0x45475f),this.#o(_0xb34632(0xc6),{'rootUrl':_0x1a069e,'indexName':_0x45475f,'maxPages':_0x2eec03?.['maxPages'],'maxDocuments':_0x2eec03?.[_0xb34632(0x11a)],'maxDepth':_0x2eec03?.['maxDepth'],'includePaths':_0x2eec03?.[_0xb34632(0xa0)],'excludePaths':_0x2eec03?.[_0xb34632(0x127)],'respectRobots':_0x2eec03?.[_0xb34632(0xa9)],'parseDocuments':_0x2eec03?.[_0xb34632(0x172)],'refreshCadence':_0x2eec03?.[_0xb34632(0x9d)],'modelId':_0x2eec03?.[_0xb34632(0xf1)]});}async[_0x5d9690(0xac)](_0x48e465){const _0x4f2130=_0x5d9690;this.#t();let _0x444f29=(await this.#o(_0x4f2130(0xac),_0x48e465!==void 0x0?{'indexName':_0x48e465}:void 0x0))[_0x4f2130(0xa2)]??[];return _0x48e465===void 0x0?_0x444f29:_0x444f29[_0x4f2130(0x13f)](_0x1eae0a=>_0x1eae0a[_0x4f2130(0x10e)]===_0x48e465);}async[_0x5d9690(0xee)](_0x314c35){return this.#t(),this.#o('getWebSource',{'sourceId':_0x314c35});}async[_0x5d9690(0xb8)](_0x48dcba,_0x519cd5){const _0x13271c=_0x5d9690;return this.#t(),this.#o('updateWebSource',{'sourceId':_0x48dcba,'refreshCadence':_0x519cd5[_0x13271c(0x9d)],'rootUrl':_0x519cd5[_0x13271c(0xf4)],'includePaths':_0x519cd5[_0x13271c(0xa0)],'excludePaths':_0x519cd5['excludePaths'],'maxDepth':_0x519cd5[_0x13271c(0xae)],'maxPages':_0x519cd5[_0x13271c(0x10f)],'resync':_0x519cd5[_0x13271c(0xa6)]});}async[_0x5d9690(0x119)](_0x294fa4){const _0x479b4d=_0x5d9690;return this.#t(),this.#o(_0x479b4d(0x119),{'sourceId':_0x294fa4});}async[_0x5d9690(0xcf)](_0x58a244){const _0x44f262=_0x5d9690;return this.#t(),this.#o(_0x44f262(0xcf),{'sourceId':_0x58a244});}async #o(_0x2ab9f4,_0x1f73e2){const _0x5c2a52=_0x5d9690;if(this.#s===null)throw new Error(_0x5c2a52(0xea));return j(this.#r,this.#s,_0x2ab9f4,_0x1f73e2);}async[_0x5d9690(0xb5)](_0x11329f,_0x20861a){const _0x3ca098=_0x5d9690;return this.#t(),this.#e[_0x3ca098(0xb5)](_0x11329f,_0x20861a);}async[_0x5d9690(0xe1)](_0x392395,_0x5e436f){const _0x2a78e6=_0x5d9690;return this.#t(),this.#e[_0x2a78e6(0xe1)](_0x392395,_0x5e436f);}async[_0x5d9690(0x14c)](_0x13288a,_0x1563dc){const _0x435823=_0x5d9690;return this.#t(),this.#e[_0x435823(0x14c)](_0x13288a,_0x1563dc);}async[_0x5d9690(0xf3)](_0x2aa1fa){const _0x29c64a=_0x5d9690;return this.#t(),this.#e[_0x29c64a(0xf3)](_0x2aa1fa);}async[_0x5d9690(0x138)](_0x302477){return this.#t(),this.#e['unloadIndexes'](_0x302477);}async[_0x5d9690(0x16e)](_0x5f2fb9,_0x593e81,_0x62f742){return this.#t(),this.#e['query'](_0x5f2fb9,_0x593e81,_0x62f742);}async['queryMultiIndex'](_0x5ce96f,_0x5b280f,_0x4e37e8){const _0x546ca1=_0x5d9690;return this.#t(),this.#e[_0x546ca1(0xe4)](_0x5ce96f,_0x5b280f,_0x4e37e8);}async['session'](_0x141be1,_0x2fb7e7=W,_0x5909c2){const _0x5a7d80=_0x5d9690;this.#t();let _0x429429=this.#e[_0x5a7d80(0xe9)],_0x447608;if(this.#s!==null)_0x447608=await h[_0x5a7d80(0x116)](_0x141be1,_0x2fb7e7,this.#r,this.#s,void 0x0,_0x429429,_0x5909c2);else{let _0x3c9916=await this.#e[_0x5a7d80(0xc2)](_0x141be1,_0x2fb7e7,_0x5909c2);_0x447608=h[_0x5a7d80(0x115)](_0x141be1,_0x2fb7e7,_0x3c9916,_0x429429);}await _0x447608[_0x5a7d80(0xc4)]();for(let _0x293b84 of this.#n)_0x293b84['deref']()||this.#n['delete'](_0x293b84);return this.#n['add'](new WeakRef(_0x447608)),_0x447608;}#t(){const _0x7f332e=_0x5d9690;if(this.#i)throw new Error(_0x7f332e(0x14a));}[_0x5d9690(0x101)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x2f4ea5=_0x5d9690;this.#i=!0x0;let _0x1c6197=[...this.#n]['map'](_0x1308c7=>_0x1308c7['deref']())[_0x2f4ea5(0x13f)](_0x50063d=>_0x50063d!==void 0x0);this.#n['clear'](),await Promise[_0x2f4ea5(0x148)](_0x1c6197[_0x2f4ea5(0xca)](_0x23dfc9=>_0x23dfc9[_0x2f4ea5(0x101)]())),await this.#e['close']();}async[Symbol[_0x5d9690(0x171)]](){return this['close']();}};export{M as ManageApiError,R as MossClient,h as SessionIndex,re as isMossError};
|
package/dist/moss.d.ts
CHANGED
|
@@ -871,8 +871,10 @@ export declare class SessionIndex {
|
|
|
871
871
|
loadIndex(indexName: string, options?: LoadSessionOptions): Promise<number>;
|
|
872
872
|
/**
|
|
873
873
|
* Upload the session to the cloud, creating or replacing the index
|
|
874
|
-
* with the same name.
|
|
875
|
-
* embeddings
|
|
874
|
+
* with the same name. A custom-model session keeps its locally-computed
|
|
875
|
+
* embeddings; for a built-in model the server re-embeds the text with
|
|
876
|
+
* that model, so the index loads and answers text queries like one
|
|
877
|
+
* built with `createIndex`.
|
|
876
878
|
*/
|
|
877
879
|
pushIndex(): Promise<PushIndexResult>;
|
|
878
880
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moss-js/moss",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/moss.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "InferEdge Inc.",
|
|
46
46
|
"license": "SEE LICENSE IN LICENSE",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@moss-js/moss-core": "0.31.
|
|
48
|
+
"@moss-js/moss-core": "0.31.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^9.39.4",
|