@moss-js/moss 1.15.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 CHANGED
@@ -1 +1 @@
1
- function _0x5865(){const _0xd31e47=['moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','embedding','HTTP\x20error!\x20status:\x20','manifestSha256','listWebSources','json','configuredIdentity','Unsupported\x20job\x20status\x20\x27','path','cachePath','5889oECLKR','applySessionIdentity','toByteArray','authUrl','56MlwvPJ','delete','maxPages','respectRobots','moss-minilm','queryText','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','test','resolveAuthRequest','normalizeJobStatus','PendingUpload','createIndexFromFiles','withAuthenticator','\x20could\x20not\x20be\x20settled:\x20','fetchAndCache','refreshCadence','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','createIndex','excludePaths','applyIdentity','body','alpha','all','projectKey','deviceIdentity','call','currentPhase','MOSS_CLOUD_API_BASE_URL','_fromInner','getAuthHeader','expiresAt','no\x20exact\x20artifact\x20identity','pendingupload','https://service.usemoss.dev','addDocs\x20requires\x20at\x20least\x20one\x20document','application/json','then','modelId','byteLength','unloadIndex','authNotifyFn','authenticator','status','MossClient\x20is\x20closed','env','Unsupported\x20data\x20type\x20for\x20file\x20upload','progress','asyncDispose','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','sources','unloadIndexes','error','\x20UTF-8\x20bytes','requireMultiIndexCore','inflight','default','MOSS_AUTH_URL','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','queryMultiIndexText','utf8','data','function','length','deleteDocs','resync','Failed','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','timeout','stringify','map','parse','minScore','mossDeviceId','getWebSource','\x20must\x20be\x20at\x20most\x20','bind','IndexManager','inner','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','ManageApiError','getDocs','Uploading','startsWith','deviceId','86PZaosg','now','arrayBuffer','cache','expiresIn','text','pending_upload','indexManager','393750gHCouw','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','addDocs','1577240cghewG','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','from','loadModel','identity','token','MossClient\x20options.identity.','pushIndex','replace','updateWebSource','query','ManageClient','maxDocuments','Authentication\x20failed\x20(HTTP\x20401):\x20','queryMultiIndex','SessionIndex','Bearer\x20','createIndex\x20requires\x20at\x20least\x20one\x20document','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','HTTP\x20','maxDepth','isArray','manageClient','POST','received\x20','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','createAuthenticatedSessionInner','loadIndex','_warmModel','loadFromDisk','loadIndexes','CLOUD_API_INDEX_URL','SDK_VERSION_NUMBER','contentType','hasCustomAuthenticator','modelArtifactContractVersion','Index\x20\x22','failed','MossClient\x20options.identity\x20must\x20be\x20an\x20object','toLowerCase','projectId','object','_create','trim','version','deleteDocuments','parseOptions','SessionIndex\x20\x27','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','indexName','added','includePaths','1684746QCAjQK','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','message','topK','building','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','getAuthToken','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','[moss]\x20Auth\x20request\x20','name','custom','listIndexes','warn','addDocumentsText','jobId','includes','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','requires\x20explicit\x20query\x20embeddings','inspectSnapshot','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','updated','ensureCachePathDeviceId','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','wrapProgress','Building','join','setIdentity','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','uploading','2395638GCaZNE','onProgress','candidateDepth','deref','cachePathDeviceId','close','getIndex','fromEntries','One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','deleteIndex','getJobStatus','string','slice','number','docCount','filter','998187zeMKQN','completed','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','1615108mirvvS','Completed','isSafeInteger','createWebSource','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','isFinite','\x27\x20returned\x20by\x20moss-core','\x20must\x20be\x20a\x20non-empty\x20string','saveToDisk','/v1/manage','addDocuments','rejectAuthRequest'];_0x5865=function(){return _0xd31e47;};return _0x5865();}const _0x46a83d=_0xddff;(function(_0x5860ff,_0x3cceb5){const _0x3ef3b4=_0xddff,_0x51f83d=_0x5860ff();while(!![]){try{const _0x22f410=-parseInt(_0x3ef3b4(0x16f))/0x1+-parseInt(_0x3ef3b4(0x1e0))/0x2*(-parseInt(_0x3ef3b4(0x188))/0x3)+-parseInt(_0x3ef3b4(0x172))/0x4+-parseInt(_0x3ef3b4(0x1eb))/0x5+parseInt(_0x3ef3b4(0x1e8))/0x6+parseInt(_0x3ef3b4(0x142))/0x7+parseInt(_0x3ef3b4(0x18c))/0x8*(parseInt(_0x3ef3b4(0x15f))/0x9);if(_0x22f410===_0x3cceb5)break;else _0x51f83d['push'](_0x51f83d['shift']());}catch(_0x2c4ccb){_0x51f83d['push'](_0x51f83d['shift']());}}}(_0x5865,0x82ffe));import{JobStatus as _0x5a2181}from'@moss-js/moss-core';import*as _0x1f1a6f from'@moss-js/moss-core';import*as _0x171d58 from'@moss-js/moss-core';var g=_0x171d58,ae=g['MODEL_DOWNLOAD_URL'],ue=g[_0x46a83d(0x20b)],de=g['CLOUD_API_IDENTITY_URL'],T=g['CLOUD_API_AUTH_URL'],ce=typeof process<'u'&&process[_0x46a83d(0x1b8)]['MOSS_INDEX_URL']||g[_0x46a83d(0x20a)],E=typeof process<'u'?process['env']:{},f=class{constructor(_0x3efcc4,_0x3f0494){const _0x1434a1=_0x46a83d;this['projectId']=_0x3efcc4,this[_0x1434a1(0x1a3)]=_0x3f0494,this[_0x1434a1(0x18b)]=E[_0x1434a1(0x1c4)]??T;}[_0x46a83d(0x213)];[_0x46a83d(0x1a3)];['authUrl'];async[_0x46a83d(0x148)](){const _0x44b57b=_0x46a83d;let _0x18e3e7=await fetch(this[_0x44b57b(0x18b)],{'method':_0x44b57b(0x202),'headers':{'Content-Type':_0x44b57b(0x1af)},'body':JSON[_0x44b57b(0x1d0)]({'projectId':this[_0x44b57b(0x213)],'projectKey':this[_0x44b57b(0x1a3)]}),'signal':AbortSignal['timeout'](0x7530)});if(_0x18e3e7[_0x44b57b(0x1b6)]===0x191){let _0x3a8a36=await _0x18e3e7[_0x44b57b(0x1e5)]();throw new Error(_0x44b57b(0x1f8)+_0x3a8a36);}if(!_0x18e3e7['ok']){let _0x39097c=await _0x18e3e7[_0x44b57b(0x1e5)]();throw new Error(_0x44b57b(0x1fe)+_0x18e3e7[_0x44b57b(0x1b6)]+':\x20'+_0x39097c);}let _0x50dbc1=await _0x18e3e7[_0x44b57b(0x183)]();return{'token':_0x50dbc1[_0x44b57b(0x1f0)],'expiresIn':_0x50dbc1[_0x44b57b(0x1e4)]};}async[_0x46a83d(0x1a9)](){const _0x576801=_0x46a83d;let {token:_0x1b3176}=await this[_0x576801(0x148)]();return'Bearer\x20'+_0x1b3176;}},I=class{constructor(_0x5b376f){const _0x140337=_0x46a83d;this[_0x140337(0x1d9)]=_0x5b376f;}[_0x46a83d(0x1d9)];[_0x46a83d(0x1e3)]=null;[_0x46a83d(0x1c2)]=null;async[_0x46a83d(0x148)](){const _0x36ba65=_0x46a83d;if(this[_0x36ba65(0x1e3)]&&this[_0x36ba65(0x1e3)][_0x36ba65(0x1aa)]>Date[_0x36ba65(0x1e1)]())return{'token':this[_0x36ba65(0x1e3)][_0x36ba65(0x1f0)],'expiresIn':this[_0x36ba65(0x1e3)][_0x36ba65(0x1e4)]};if(this[_0x36ba65(0x1c2)])return this[_0x36ba65(0x1c2)];this['inflight']=this[_0x36ba65(0x19a)]();try{return await this[_0x36ba65(0x1c2)];}finally{this['inflight']=null;}}async[_0x46a83d(0x1a9)](){let {token:_0x388eb3}=await this['getAuthToken']();return'Bearer\x20'+_0x388eb3;}async[_0x46a83d(0x19a)](){const _0x21fc57=_0x46a83d;let {token:_0x3d4fbf,expiresIn:_0x3e2379}=await this['inner']['getAuthToken'](),_0xb882e1=Date[_0x21fc57(0x1e1)]()+(_0x3e2379-0x3c)*0x3e8;return this[_0x21fc57(0x1e3)]={'token':_0x3d4fbf,'expiresIn':_0x3e2379,'expiresAt':_0xb882e1},{'token':_0x3d4fbf,'expiresIn':_0x3e2379};}};import{randomUUID as _0x3b74d0}from'node:crypto';import{existsSync as _0x4d2da1,mkdirSync as _0x466ae4,readFileSync as _0x431bad,writeFileSync as _0x21360b}from'node:fs';import{join as _0x13aeed}from'node:path';var z='.moss-device-id',S=0x100,k=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function Y(_0x23d30a){const _0x121e7f=_0x46a83d;return _0x23d30a['length']>0x0&&_0x23d30a[_0x121e7f(0x216)]()===_0x23d30a&&!k[_0x121e7f(0x193)](_0x23d30a)&&new TextEncoder()['encode'](_0x23d30a)[_0x121e7f(0x1b2)]<=S;}function _(_0x30ba72,_0x2e8f88){const _0x43a7e8=_0x46a83d;if(_0x30ba72!==void 0x0){if(typeof _0x30ba72!=_0x43a7e8(0x16a)||_0x30ba72['length']===0x0)throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+_0x43a7e8(0x179));if(_0x30ba72['trim']()!==_0x30ba72)throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+_0x43a7e8(0x19c));if(k[_0x43a7e8(0x193)](_0x30ba72))throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+'\x20contains\x20an\x20unsupported\x20character');if(new TextEncoder()['encode'](_0x30ba72)[_0x43a7e8(0x1b2)]>S)throw new TypeError(_0x43a7e8(0x1f1)+_0x2e8f88+_0x43a7e8(0x1d6)+S+_0x43a7e8(0x1c0));return _0x30ba72;}}function U(_0x41a35f){const _0x79ef9b=_0x46a83d;if(_0x41a35f!==void 0x0){if(_0x41a35f===null||typeof _0x41a35f!=_0x79ef9b(0x214)||Array[_0x79ef9b(0x200)](_0x41a35f))throw new TypeError(_0x79ef9b(0x211));return Object['freeze']({'deviceId':_(_0x41a35f['deviceId'],_0x79ef9b(0x1df)),'userId':_(_0x41a35f['userId'],'userId')});}}function q(_0x16b90e){const _0x45f15b=_0x46a83d;return _0x16b90e?.[_0x45f15b(0x1df)]!==void 0x0||_0x16b90e?.['userId']!==void 0x0;}function M(_0x158771){const _0x4a81d7=_0x46a83d;if(!_0x158771?.['trim']())return;let _0xd037a6=_0x13aeed(_0x158771,z);try{if(_0x4d2da1(_0xd037a6)){let _0x58fe3b=_0x431bad(_0xd037a6,_0x4a81d7(0x1c7))[_0x4a81d7(0x216)]();return Y(_0x58fe3b)?_0x58fe3b:void 0x0;}_0x466ae4(_0x158771,{'recursive':!0x0});let _0x11b932=_0x3b74d0();return _0x21360b(_0xd037a6,_0x11b932,_0x4a81d7(0x1c7)),_0x11b932;}catch{return;}}var Z=0x1;function y(_0x2572bd){const _0x4762fb=_0x46a83d;let _0x41402d=_0x2572bd[_0x4762fb(0x20e)];if(typeof _0x41402d!=_0x4762fb(0x1c9))throw L();let _0x2aa4a9=_0x41402d[_0x4762fb(0x1a5)](_0x2572bd);if(!Number[_0x4762fb(0x174)](_0x2aa4a9)||_0x2aa4a9<Z)throw L();}function L(){const _0xa2981=_0x46a83d;return new Error(_0xa2981(0x1ce));}var xe=0x708*0x3e8;function x(_0x38b551){const _0x34afb3=_0x46a83d;if(!(_0x38b551?.['minScore']===void 0x0&&_0x38b551?.[_0x34afb3(0x161)]===void 0x0))return{'minScore':_0x38b551[_0x34afb3(0x1d3)],'candidateDepth':_0x38b551[_0x34afb3(0x161)]};}function A(_0x28596b){const _0x2e69b7=_0x46a83d;return _0x28596b instanceof Error?_0x28596b[_0x2e69b7(0x144)]:String(_0x28596b);}function _0xddff(_0x3b6774,_0x309031){_0x3b6774=_0x3b6774-0x141;const _0x586501=_0x5865();let _0xddff50=_0x586501[_0x3b6774];return _0xddff50;}function ee(_0x1f0cfd){const _0x2b2511=_0x46a83d;if(_0x1f0cfd===null||typeof _0x1f0cfd!=_0x2b2511(0x214))return _0x2b2511(0x203)+String(_0x1f0cfd);if(Array[_0x2b2511(0x200)](_0x1f0cfd))return'received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected';let _0x11ff41=_0x1f0cfd;return typeof _0x11ff41['jobId']!=_0x2b2511(0x16a)||_0x11ff41['jobId'][_0x2b2511(0x1ca)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20('+String(_0x11ff41[_0x2b2511(0x150)])+')':typeof _0x11ff41[_0x2b2511(0x1b6)]!=_0x2b2511(0x16a)||_0x11ff41['status'][_0x2b2511(0x1ca)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20('+String(_0x11ff41[_0x2b2511(0x1b6)])+')':typeof _0x11ff41[_0x2b2511(0x1ba)]!=_0x2b2511(0x16c)||!Number[_0x2b2511(0x177)](_0x11ff41['progress'])?'received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20('+String(_0x11ff41[_0x2b2511(0x1ba)])+')':_0x11ff41['currentPhase']!==void 0x0&&_0x11ff41[_0x2b2511(0x1a6)]!==null&&typeof _0x11ff41[_0x2b2511(0x1a6)]!='string'?'received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20('+String(_0x11ff41[_0x2b2511(0x1a6)])+')':null;}var b=class{['authenticator'];[_0x46a83d(0x201)];[_0x46a83d(0x1e7)];[_0x46a83d(0x163)];[_0x46a83d(0x184)];['projectId'];[_0x46a83d(0x1b4)];constructor(_0xc4f53d,_0x146818,_0x7c846f){const _0x2ded6e=_0x46a83d;this['configuredIdentity']=U(_0x7c846f?.[_0x2ded6e(0x1ef)]),this[_0x2ded6e(0x163)]=M(_0x7c846f?.[_0x2ded6e(0x187)]),this[_0x2ded6e(0x213)]=_0xc4f53d;let _0x4b6942=typeof _0x146818==_0x2ded6e(0x16a)?new f(_0xc4f53d,_0x146818):_0x146818;this['authenticator']=new I(_0x4b6942);let _0x211416=_0x1f1a6f,_0x4900e3=_0x211416[_0x2ded6e(0x1f6)]??_0x211416['default']?.[_0x2ded6e(0x1f6)],_0x3946dd=_0x211416[_0x2ded6e(0x1d8)]??_0x211416[_0x2ded6e(0x1c3)]?.[_0x2ded6e(0x1d8)];if(!_0x4900e3||!_0x3946dd)throw new Error(_0x2ded6e(0x21b));if(typeof _0x146818=='string')this[_0x2ded6e(0x201)]=new _0x4900e3(_0xc4f53d,_0x146818),this[_0x2ded6e(0x1e7)]=new _0x3946dd(_0xc4f53d,_0x146818);else{let _0x3105de=_0x211416[_0x2ded6e(0x194)]??_0x211416[_0x2ded6e(0x1c3)]?.['resolveAuthRequest'],_0x5c8737=_0x211416[_0x2ded6e(0x17d)]??_0x211416['default']?.[_0x2ded6e(0x17d)];if(!_0x3105de||!_0x5c8737)throw new Error(_0x2ded6e(0x155));let _0x1e7dcc=this[_0x2ded6e(0x1b5)],_0x513eba=(_0x15652b,_0x245096)=>{const _0x40e859=_0x2ded6e;try{_0x5c8737(_0x15652b,_0x245096);}catch(_0x2661a0){console[_0x40e859(0x14e)](_0x40e859(0x14a)+_0x15652b+_0x40e859(0x199)+A(_0x2661a0));}},_0x59c2e3=(_0x324b04,_0x383566)=>{try{_0x3105de(_0x324b04,_0x383566);}catch(_0x4e1680){_0x513eba(_0x324b04,'moss-core\x20rejected\x20the\x20auth\x20token:\x20'+A(_0x4e1680));}},_0x157fc4=!0x1,_0x4f0511=(_0x4e79b1,_0x209bca)=>{const _0x4c4e05=_0x2ded6e;if(_0x4e79b1||!Number[_0x4c4e05(0x174)](_0x209bca)||_0x209bca<0x0){_0x157fc4||(_0x157fc4=!0x0,console[_0x4c4e05(0x14e)](_0x4c4e05(0x1fd)+(_0x4e79b1?_0x4e79b1[_0x4c4e05(0x144)]:_0x4c4e05(0x203)+String(_0x209bca))));return;}_0x1e7dcc[_0x4c4e05(0x1a9)]()[_0x4c4e05(0x1b0)](_0x4144fc=>{const _0x48e550=_0x4c4e05;let _0x5b4233=_0x4144fc[_0x48e550(0x1de)](_0x48e550(0x1fb))?_0x4144fc[_0x48e550(0x16b)](0x7):_0x4144fc;_0x59c2e3(_0x209bca,_0x5b4233);},_0x59f7b7=>_0x513eba(_0x209bca,A(_0x59f7b7)));};this[_0x2ded6e(0x1b4)]=_0x4f0511;let _0xa8ceab=_0x4900e3,_0x284f4f=_0x3946dd;if(!_0xa8ceab['withAuthenticator']||!_0x284f4f[_0x2ded6e(0x198)])throw new Error(_0x2ded6e(0x1e9));this[_0x2ded6e(0x201)]=_0xa8ceab[_0x2ded6e(0x198)](_0xc4f53d,_0x4f0511),this['indexManager']=_0x284f4f[_0x2ded6e(0x198)](_0xc4f53d,_0x4f0511);}this[_0x2ded6e(0x19f)](this[_0x2ded6e(0x1e7)]);}async[_0x46a83d(0x164)](){const _0x26a3d4=_0x46a83d;let _0x4a3bca=this[_0x26a3d4(0x1e7)]['close'];if(typeof _0x4a3bca!=_0x26a3d4(0x1c9))throw new Error(_0x26a3d4(0x1c5));await _0x4a3bca[_0x26a3d4(0x1a5)](this['indexManager']);}async[_0x46a83d(0x148)](){const _0x666c9a=_0x46a83d;return this[_0x666c9a(0x1b5)][_0x666c9a(0x148)]();}[_0x46a83d(0x159)](_0x4c6cdc){if(!_0x4c6cdc)return;let _0x1c2c34=!0x1;return(_0x5ea448,_0x403fc7)=>{const _0x33cf13=_0xddff;let _0x54841d=_0x5ea448?_0x5ea448[_0x33cf13(0x144)]:ee(_0x403fc7);if(_0x54841d!==null){_0x1c2c34||(_0x1c2c34=!0x0,console[_0x33cf13(0x14e)](_0x33cf13(0x1da)+_0x54841d));return;}_0x4c6cdc(_0x403fc7);};}[_0x46a83d(0x195)](_0x334470){const _0x155355=_0x46a83d;let _0x250f41=_0x334470[_0x155355(0x216)]()[_0x155355(0x212)]()['replace'](/\s+/g,'_'),_0x1a4222=_0x250f41[_0x155355(0x1f3)](/_/g,'');if(_0x250f41===_0x155355(0x1e6)||_0x1a4222===_0x155355(0x1ac))return _0x5a2181[_0x155355(0x196)];if(_0x250f41===_0x155355(0x15e))return _0x5a2181[_0x155355(0x1dd)];if(_0x250f41===_0x155355(0x146))return _0x5a2181[_0x155355(0x15a)];if(_0x250f41===_0x155355(0x170))return _0x5a2181[_0x155355(0x173)];if(_0x250f41===_0x155355(0x210))return _0x5a2181[_0x155355(0x1cd)];throw new Error(_0x155355(0x185)+_0x334470+_0x155355(0x178));}async['createIndex'](_0x5525a4,_0x2d4e21,_0x2c8344,_0x2aa729){const _0x312735=_0x46a83d;if(!_0x2d4e21[_0x312735(0x1ca)])throw new Error(_0x312735(0x1fc));return await this[_0x312735(0x201)][_0x312735(0x19d)](_0x5525a4,_0x2d4e21,_0x2c8344,this[_0x312735(0x159)](_0x2aa729?.[_0x312735(0x160)]));}async[_0x46a83d(0x18a)](_0x809009){const _0x20ede=_0x46a83d;if(_0x809009 instanceof Uint8Array)return Array['from'](_0x809009);if(_0x809009 instanceof ArrayBuffer)return Array[_0x20ede(0x1ed)](new Uint8Array(_0x809009));if(typeof _0x809009['arrayBuffer']==_0x20ede(0x1c9)){let _0x2f8424=await _0x809009[_0x20ede(0x1e2)]();return Array[_0x20ede(0x1ed)](new Uint8Array(_0x2f8424));}throw new Error(_0x20ede(0x1b9));}async[_0x46a83d(0x197)](_0x28bf73,_0x39acca,_0x429092){const _0x150454=_0x46a83d;if(_0x39acca[_0x150454(0x1ca)]===0x0)throw new Error(_0x150454(0x192));let _0x21e199=_0x429092?.[_0x150454(0x1b1)]??_0x150454(0x190),_0xd9adbe=await Promise[_0x150454(0x1a2)](_0x39acca[_0x150454(0x1d1)](async _0x50a7ec=>({'name':_0x50a7ec[_0x150454(0x14b)],'contentType':_0x50a7ec[_0x150454(0x20c)],'path':_0x50a7ec[_0x150454(0x186)]??void 0x0,'data':_0x50a7ec[_0x150454(0x1c8)]!=null?await this[_0x150454(0x18a)](_0x50a7ec[_0x150454(0x1c8)]):void 0x0})));return await this[_0x150454(0x201)][_0x150454(0x197)](_0x28bf73,_0xd9adbe,_0x21e199,this[_0x150454(0x159)](_0x429092?.[_0x150454(0x160)]),_0x429092?.[_0x150454(0x219)]??null);}async[_0x46a83d(0x1ea)](_0x447b2b,_0x362285,_0x4c3681){const _0xd8bc4f=_0x46a83d;if(Array[_0xd8bc4f(0x200)](_0x362285)&&_0x362285['length']===0x0)throw new Error(_0xd8bc4f(0x1ae));return await this['manageClient'][_0xd8bc4f(0x1ea)](_0x447b2b,_0x362285,_0x4c3681??null,this['wrapProgress'](_0x4c3681?.[_0xd8bc4f(0x160)]));}async[_0x46a83d(0x1cb)](_0x2c4133,_0x24cddb,_0x52bf73){const _0x4c8223=_0x46a83d;if(Array['isArray'](_0x24cddb)&&_0x24cddb[_0x4c8223(0x1ca)]===0x0)throw new Error(_0x4c8223(0x158));return await this[_0x4c8223(0x201)][_0x4c8223(0x1cb)](_0x2c4133,_0x24cddb,this[_0x4c8223(0x159)](_0x52bf73?.[_0x4c8223(0x160)]));}async[_0x46a83d(0x169)](_0x54147f){const _0x1bed93=_0x46a83d;let _0xe6b5fa=await this[_0x1bed93(0x201)][_0x1bed93(0x169)](_0x54147f);return{..._0xe6b5fa,'status':this['normalizeJobStatus'](_0xe6b5fa[_0x1bed93(0x1b6)]),'currentPhase':_0xe6b5fa[_0x1bed93(0x1a6)]??null,'error':_0xe6b5fa[_0x1bed93(0x1bf)]??null};}async['getIndex'](_0x23ba4c){const _0x3bf8fe=_0x46a83d;return this[_0x3bf8fe(0x201)][_0x3bf8fe(0x165)](_0x23ba4c);}async['listIndexes'](){const _0x1fbd1e=_0x46a83d;return this[_0x1fbd1e(0x201)][_0x1fbd1e(0x14d)]();}async[_0x46a83d(0x168)](_0x45f973){const _0x235f98=_0x46a83d;return this[_0x235f98(0x201)][_0x235f98(0x168)](_0x45f973);}async[_0x46a83d(0x1dc)](_0x30c64a,_0x200233){const _0x1ef1a4=_0x46a83d;return this[_0x1ef1a4(0x201)]['getDocs'](_0x30c64a,_0x200233??null);}async['loadIndex'](_0x2904f3,_0x1c232a){const _0x30642f=_0x46a83d;return this[_0x30642f(0x157)](_0x1c232a?.[_0x30642f(0x187)]),(await this[_0x30642f(0x1e7)][_0x30642f(0x206)](_0x2904f3,_0x1c232a??null))[_0x30642f(0x14b)];}async['loadIndexes'](_0x5862b1,_0x363f59){const _0x4fc802=_0x46a83d;let _0xc88f04=this[_0x4fc802(0x1c1)]();return this[_0x4fc802(0x157)](_0x363f59?.[_0x4fc802(0x187)]),_0xc88f04[_0x4fc802(0x209)](_0x5862b1,_0x363f59??null);}async[_0x46a83d(0x1b3)](_0x2bd1e6){const _0x50af75=_0x46a83d;return this['indexManager'][_0x50af75(0x1b3)](_0x2bd1e6);}async['unloadIndexes'](_0x9f1cfe){const _0xd6c23=_0x46a83d;return this[_0xd6c23(0x1c1)]()[_0xd6c23(0x1be)](_0x9f1cfe);}[_0x46a83d(0x1c1)](){const _0x48e9fe=_0x46a83d;let _0x2d3692=this['indexManager'];if(typeof _0x2d3692['queryMultiIndex']!='function'||typeof _0x2d3692['queryMultiIndexText']!=_0x48e9fe(0x1c9)||typeof _0x2d3692[_0x48e9fe(0x209)]!=_0x48e9fe(0x1c9)||typeof _0x2d3692['unloadIndexes']!=_0x48e9fe(0x1c9))throw new Error(_0x48e9fe(0x152));return{'queryMultiIndex':_0x2d3692[_0x48e9fe(0x1f9)][_0x48e9fe(0x1d7)](_0x2d3692),'queryMultiIndexText':_0x2d3692['queryMultiIndexText'][_0x48e9fe(0x1d7)](_0x2d3692),'loadIndexes':_0x2d3692['loadIndexes'][_0x48e9fe(0x1d7)](_0x2d3692),'unloadIndexes':_0x2d3692['unloadIndexes']['bind'](_0x2d3692)};}['ensureCachePathDeviceId'](_0x27ac17){const _0x5e1bb0=_0x46a83d;_0x27ac17&&this[_0x5e1bb0(0x163)]===void 0x0&&M(_0x27ac17);}[_0x46a83d(0x19f)]=_0x565d4f=>{const _0x2ba277=_0x46a83d;!q(this['configuredIdentity'])&&this[_0x2ba277(0x163)]===void 0x0||_0x565d4f[_0x2ba277(0x15c)](this[_0x2ba277(0x184)]?.[_0x2ba277(0x1df)]??null,this['configuredIdentity']?.['userId']??null,this[_0x2ba277(0x163)]??null);};[_0x46a83d(0x189)]=_0x31bbba=>{const _0x74fa4a=_0x46a83d;let _0x264ac3=this['indexManager'][_0x74fa4a(0x1a4)]?.();if(!_0x264ac3){this['applyIdentity'](_0x31bbba);return;}_0x31bbba[_0x74fa4a(0x15c)](_0x264ac3[_0x74fa4a(0x1df)]??null,this[_0x74fa4a(0x184)]?.['userId']??null,_0x264ac3[_0x74fa4a(0x1d4)]??null);};[_0x46a83d(0x20d)](){return this['authNotifyFn']!==void 0x0;}async[_0x46a83d(0x205)](_0x57e657,_0x2ca807,_0xe56b50){const _0xa432b4=_0x46a83d;if(!this[_0xa432b4(0x1b4)])throw new Error(_0xa432b4(0x147));let _0x5dc09b=_0x1f1a6f,_0x15a459=_0x5dc09b[_0xa432b4(0x1fa)]??_0x5dc09b[_0xa432b4(0x1c3)]?.[_0xa432b4(0x1fa)];if(!_0x15a459||typeof _0x15a459[_0xa432b4(0x198)]!=_0xa432b4(0x1c9))throw new Error(_0xa432b4(0x17e));return _0xe56b50&&y(_0x15a459),_0x15a459[_0xa432b4(0x198)](_0x57e657,_0x2ca807,this[_0xa432b4(0x213)],this['authNotifyFn'],null,null,_0xe56b50?.[_0xa432b4(0x217)]??null,_0xe56b50?.[_0xa432b4(0x181)]??null);}async[_0x46a83d(0x1f5)](_0x34c29e,_0x30e043,_0x11b5a8){const _0x599233=_0x46a83d;if(!await this[_0x599233(0x1e7)]['hasIndex'](_0x34c29e))throw new Error(_0x599233(0x20f)+_0x34c29e+_0x599233(0x171)+_0x34c29e+_0x599233(0x1ec));let _0x12406f=_0x11b5a8?.[_0x599233(0x145)]??0x5,_0x3d6ca7=_0x11b5a8?.[_0x599233(0x1a1)]??0.8;return _0x11b5a8?.[_0x599233(0x17f)]?this[_0x599233(0x1e7)][_0x599233(0x1f5)](_0x34c29e,_0x30e043,_0x11b5a8['embedding'],_0x12406f,_0x3d6ca7,_0x11b5a8?.[_0x599233(0x16e)],x(_0x11b5a8)):this['indexManager']['queryText'](_0x34c29e,_0x30e043,_0x12406f,_0x3d6ca7,_0x11b5a8?.[_0x599233(0x16e)],x(_0x11b5a8));}async[_0x46a83d(0x1f9)](_0x59e202,_0x356645,_0x5cd60b){const _0xf5a7be=_0x46a83d;if(_0x59e202[_0xf5a7be(0x1ca)]===0x0)throw new Error(_0xf5a7be(0x149));let _0x3f1e23=this[_0xf5a7be(0x1c1)](),_0x56a85d=_0x5cd60b?.['topK']??0xa,_0x2c17ec=_0x5cd60b?.[_0xf5a7be(0x1a1)]??0.8;if(_0x5cd60b?.['embedding'])return _0x3f1e23[_0xf5a7be(0x1f9)](_0x59e202,_0x356645,_0x5cd60b[_0xf5a7be(0x17f)],_0x56a85d,_0x2c17ec,_0x5cd60b?.[_0xf5a7be(0x16e)],x(_0x5cd60b));try{return await _0x3f1e23[_0xf5a7be(0x1c6)](_0x59e202,_0x356645,_0x56a85d,_0x2c17ec,_0x5cd60b?.['filter'],x(_0x5cd60b));}catch(_0x314c60){throw _0x314c60 instanceof Error&&_0x314c60['message'][_0xf5a7be(0x151)](_0xf5a7be(0x1ab))?new Error(_0x314c60[_0xf5a7be(0x144)]+_0xf5a7be(0x204),{'cause':_0x314c60}):_0x314c60 instanceof Error&&_0x314c60[_0xf5a7be(0x144)][_0xf5a7be(0x151)](_0xf5a7be(0x153))?new Error(_0xf5a7be(0x167),{'cause':_0x314c60}):_0x314c60;}}};import{SessionIndex as _0x299e9a}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0xfd2256,_0x2af824,_0x27bbc3){this.#s=_0xfd2256,this.#r=_0x2af824,this.#e=_0x27bbc3;}static async['_create'](_0x2139f2,_0x4aaf78,_0x15ccd3,_0x4150bf,_0x235906,_0x8e8fc,_0x22af73){const _0x254cc8=_0x46a83d;let _0x313c28=_0x299e9a;_0x22af73&&y(_0x313c28);let _0x10a7bb=await _0x313c28['create'](_0x2139f2,_0x4aaf78,_0x15ccd3,_0x4150bf,_0x235906??null,_0x22af73?.[_0x254cc8(0x217)]??null,_0x22af73?.[_0x254cc8(0x181)]??null);return r[_0x254cc8(0x1a8)](_0x2139f2,_0x4aaf78,_0x10a7bb,_0x8e8fc);}static[_0x46a83d(0x1a8)](_0x3be776,_0x44a783,_0x291790,_0x148c3e){return _0x148c3e?.(_0x291790),new r(_0x3be776,_0x44a783,_0x291790);}get['name'](){return this.#s;}get[_0x46a83d(0x16d)](){const _0x1c39b0=_0x46a83d;return this.#n(),this.#e[_0x1c39b0(0x16d)];}get[_0x46a83d(0x1b1)](){return this.#r;}async['addDocs'](_0x326fe4,_0x3c15c9){const _0x21cb4a=_0x46a83d;this.#n();let _0x1fb7e5=_0x3c15c9?{'upsert':_0x3c15c9['upsert']??!0x0}:void 0x0;if(this.#r==='custom'){let _0x13c36e=r.#t(_0x326fe4),_0x573f91=_0x326fe4['map'](_0x10c08f=>{const _0x2776fd=_0xddff;let _0x25ae62={..._0x10c08f};return delete _0x25ae62[_0x2776fd(0x17f)],_0x25ae62;}),_0x5462bf=await this.#e[_0x21cb4a(0x17c)](_0x573f91,_0x13c36e,_0x1fb7e5);return{'added':_0x5462bf[_0x21cb4a(0x21d)],'updated':_0x5462bf[_0x21cb4a(0x156)]};}let _0x36a41d=await this.#e[_0x21cb4a(0x14f)](_0x326fe4,_0x1fb7e5);return{'added':_0x36a41d[_0x21cb4a(0x21d)],'updated':_0x36a41d['updated']};}async['deleteDocs'](_0x5d72a6){const _0x2d5539=_0x46a83d;return this.#n(),await this.#e[_0x2d5539(0x218)](_0x5d72a6);}async[_0x46a83d(0x1dc)](_0x7a303c){return this.#n(),await this.#e['getDocuments'](_0x7a303c??null);}async['query'](_0x45989c,_0x420ea1){const _0x5f2fc9=_0x46a83d;this.#n();let _0x34ed1f=_0x420ea1?.[_0x5f2fc9(0x145)]??0x5,_0x55f937=_0x420ea1?.[_0x5f2fc9(0x1a1)]??0.8,_0x67bbb7=_0x420ea1?.[_0x5f2fc9(0x16e)]??null,_0x4a3e3a=_0x420ea1?.[_0x5f2fc9(0x17f)];if(_0x4a3e3a==null){if(this.#r===_0x5f2fc9(0x14c))throw new Error(_0x5f2fc9(0x143));return await this.#e[_0x5f2fc9(0x191)](_0x45989c,_0x34ed1f,_0x55f937,_0x67bbb7);}return await this.#e[_0x5f2fc9(0x1f5)](_0x45989c,_0x34ed1f,Array[_0x5f2fc9(0x1ed)](_0x4a3e3a),_0x55f937,_0x67bbb7);}async[_0x46a83d(0x206)](_0x41b2c2,_0x3258a7){const _0x4d16a9=_0x46a83d;return this.#n(),this.#e[_0x4d16a9(0x206)](_0x41b2c2,_0x3258a7??null);}async[_0x46a83d(0x1f2)](){const _0x745f16=_0x46a83d;return this.#n(),this.#e[_0x745f16(0x1f2)]();}async[_0x46a83d(0x17a)](_0x2c5ddf){const _0x2666a9=_0x46a83d;this.#n(),await this.#e[_0x2666a9(0x17a)](_0x2c5ddf);}async[_0x46a83d(0x208)](_0x3e2c76,_0x2fbbcf){const _0xa54195=_0x46a83d;this.#n();let _0x2ad015=_0x2fbbcf?.['rebuildLegacy']??!0x0;return await this.#e[_0xa54195(0x208)](_0x3e2c76,{'rebuildLegacy':_0x2ad015});}async[_0x46a83d(0x154)](_0x424a8f){const _0x255492=_0x46a83d;return this.#n(),await this.#e[_0x255492(0x154)](_0x424a8f);}#n(){const _0x39f651=_0x46a83d;if(this.#i)throw new Error(_0x39f651(0x21a)+this.#s+'\x27\x20is\x20closed');}[_0x46a83d(0x164)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0x4822ad=_0x46a83d;this.#i=!0x0;let _0x3f1d05=this.#e[_0x4822ad(0x164)];if(typeof _0x3f1d05!=_0x4822ad(0x1c9))throw new Error('@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()');await _0x3f1d05['call'](this.#e);}async[Symbol[_0x46a83d(0x1bb)]](){const _0x34f63d=_0x46a83d;return this[_0x34f63d(0x164)]();}async[_0x46a83d(0x207)](){const _0x40364e=_0x46a83d;this.#n(),this.#r!==_0x40364e(0x14c)&&await this.#e[_0x40364e(0x1ee)]();}static#t(_0x562664){const _0x4dc0c2=_0x46a83d;let _0x55c213=_0x562664[_0x4dc0c2(0x16e)](_0xc35080=>!_0xc35080['embedding']||_0xc35080[_0x4dc0c2(0x17f)][_0x4dc0c2(0x1ca)]===0x0)[_0x4dc0c2(0x1d1)](_0x582d4b=>_0x582d4b['id']);if(_0x55c213[_0x4dc0c2(0x1ca)]>0x0)throw new Error(_0x4dc0c2(0x15d)+_0x55c213[_0x4dc0c2(0x15b)](',\x20')+_0x4dc0c2(0x176));return _0x562664[_0x4dc0c2(0x1d1)](_0x587fee=>Array['from'](_0x587fee[_0x4dc0c2(0x17f)]??[]));}};import{validateIndexName as _0x13890c}from'@moss-js/moss-core';var ne=_0x46a83d(0x1ad),re=_0x46a83d(0x17b),w=class extends Error{[_0x46a83d(0x1b6)];[_0x46a83d(0x1a0)];constructor(_0x324ea7,_0x502cba){const _0x516f7f=_0x46a83d;let _0x260b5=_0x502cba?':\x20'+_0x502cba:'';super(_0x516f7f(0x180)+_0x324ea7+_0x260b5),this['name']=_0x516f7f(0x1db),this[_0x516f7f(0x1b6)]=_0x324ea7,this[_0x516f7f(0x1a0)]=_0x502cba;}};function se(){const _0x19e1a2=_0x46a83d;return''+(typeof process<'u'&&process['env'][_0x19e1a2(0x1a7)]||ne)[_0x19e1a2(0x1f3)](/\/+$/,'')+re;}function oe(_0x3617a1){const _0x4115c2=_0x46a83d;return _0x3617a1?Object[_0x4115c2(0x166)](Object['entries'](_0x3617a1)[_0x4115c2(0x16e)](([,_0x5baf99])=>_0x5baf99!==void 0x0)):{};}async function F(_0x2a06cd,_0x344c19,_0x282889,_0x56e674){const _0x2eb82c=_0x46a83d;let _0x3a0c4a={...oe(_0x56e674),'action':_0x282889,'projectId':_0x2a06cd},_0x519d2f=await fetch(se(),{'method':_0x2eb82c(0x202),'headers':{'Content-Type':'application/json','X-Project-Key':_0x344c19},'body':JSON[_0x2eb82c(0x1d0)](_0x3a0c4a),'signal':AbortSignal[_0x2eb82c(0x1cf)](0x927c0)}),_0x4b4cf5=await _0x519d2f[_0x2eb82c(0x1e5)]();if(!_0x519d2f['ok'])throw new w(_0x519d2f[_0x2eb82c(0x1b6)],_0x4b4cf5);return _0x4b4cf5?JSON[_0x2eb82c(0x1d2)](_0x4b4cf5):{};}var W=_0x46a83d(0x190),D=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x2a3c28,_0xd00f39,_0x3a710){const _0x4fd41d=_0x46a83d;this.#e=new b(_0x2a3c28,_0xd00f39,_0x3a710),this.#r=_0x2a3c28,this.#s=typeof _0xd00f39==_0x4fd41d(0x16a)?_0xd00f39:null;}async['getAuthToken'](){const _0x18d89a=_0x46a83d;return this.#t(),this.#e[_0x18d89a(0x148)]();}async[_0x46a83d(0x19d)](_0x19aae9,_0x5bd27f,_0x350e87){const _0x42f074=_0x46a83d;this.#t();let _0x587134;return _0x350e87?.[_0x42f074(0x1b1)]!==void 0x0?_0x587134=_0x350e87[_0x42f074(0x1b1)]:_0x587134=_0x5bd27f['some'](_0x3f8aa7=>Array['isArray'](_0x3f8aa7[_0x42f074(0x17f)])&&_0x3f8aa7[_0x42f074(0x17f)][_0x42f074(0x1ca)]>0x0)?_0x42f074(0x14c):W,this.#e['createIndex'](_0x19aae9,_0x5bd27f,_0x587134,_0x350e87);}async[_0x46a83d(0x197)](_0x4079d9,_0x1f689c,_0x4bd39f){const _0x4ea5f4=_0x46a83d;return this.#t(),this.#e[_0x4ea5f4(0x197)](_0x4079d9,_0x1f689c,_0x4bd39f);}async[_0x46a83d(0x165)](_0x1d4f18){const _0x132bed=_0x46a83d;return this.#t(),this.#e[_0x132bed(0x165)](_0x1d4f18);}async['listIndexes'](){const _0x221b9d=_0x46a83d;return this.#t(),this.#e[_0x221b9d(0x14d)]();}async['deleteIndex'](_0x275d56){const _0x4c121e=_0x46a83d;return this.#t(),this.#e[_0x4c121e(0x168)](_0x275d56);}async[_0x46a83d(0x1ea)](_0x1e06b9,_0x1d0ef7,_0x1c2ac4){const _0x16ac2d=_0x46a83d;return this.#t(),this.#e[_0x16ac2d(0x1ea)](_0x1e06b9,_0x1d0ef7,_0x1c2ac4);}async[_0x46a83d(0x1cb)](_0xa24c13,_0x40bf7b,_0x4bdc26){return this.#t(),this.#e['deleteDocs'](_0xa24c13,_0x40bf7b,_0x4bdc26);}async['getJobStatus'](_0x4074bb){const _0x175c02=_0x46a83d;return this.#t(),this.#e[_0x175c02(0x169)](_0x4074bb);}async['createWebSource'](_0x5bddc9,_0x1af71f,_0x18a2db){const _0x3b32d1=_0x46a83d;return this.#t(),_0x13890c(_0x1af71f),this.#o(_0x3b32d1(0x175),{'rootUrl':_0x5bddc9,'indexName':_0x1af71f,'maxPages':_0x18a2db?.[_0x3b32d1(0x18e)],'maxDocuments':_0x18a2db?.[_0x3b32d1(0x1f7)],'maxDepth':_0x18a2db?.[_0x3b32d1(0x1ff)],'includePaths':_0x18a2db?.[_0x3b32d1(0x141)],'excludePaths':_0x18a2db?.[_0x3b32d1(0x19e)],'respectRobots':_0x18a2db?.[_0x3b32d1(0x18f)],'parseDocuments':_0x18a2db?.['parseDocuments'],'refreshCadence':_0x18a2db?.[_0x3b32d1(0x19b)],'modelId':_0x18a2db?.[_0x3b32d1(0x1b1)]});}async['listWebSources'](_0x3d12a8){const _0xd5d590=_0x46a83d;this.#t();let _0x24e645=(await this.#o(_0xd5d590(0x182),_0x3d12a8!==void 0x0?{'indexName':_0x3d12a8}:void 0x0))[_0xd5d590(0x1bd)]??[];return _0x3d12a8===void 0x0?_0x24e645:_0x24e645[_0xd5d590(0x16e)](_0x231aa5=>_0x231aa5[_0xd5d590(0x21c)]===_0x3d12a8);}async[_0x46a83d(0x1d5)](_0x8f33ef){const _0x3bd6b3=_0x46a83d;return this.#t(),this.#o(_0x3bd6b3(0x1d5),{'sourceId':_0x8f33ef});}async[_0x46a83d(0x1f4)](_0x224463,_0x56d1b3){const _0x527b47=_0x46a83d;return this.#t(),this.#o(_0x527b47(0x1f4),{'sourceId':_0x224463,'refreshCadence':_0x56d1b3[_0x527b47(0x19b)],'rootUrl':_0x56d1b3['rootUrl'],'includePaths':_0x56d1b3['includePaths'],'excludePaths':_0x56d1b3[_0x527b47(0x19e)],'maxDepth':_0x56d1b3['maxDepth'],'maxPages':_0x56d1b3[_0x527b47(0x18e)],'resync':_0x56d1b3[_0x527b47(0x1cc)]});}async['resyncWebSource'](_0x55704){return this.#t(),this.#o('resyncWebSource',{'sourceId':_0x55704});}async['deleteWebSource'](_0x5d0322){return this.#t(),this.#o('deleteWebSource',{'sourceId':_0x5d0322});}async #o(_0x726aa7,_0x470e77){const _0x5dfa0c=_0x46a83d;if(this.#s===null)throw new Error(_0x5dfa0c(0x1bc));return F(this.#r,this.#s,_0x726aa7,_0x470e77);}async[_0x46a83d(0x1dc)](_0x1b80a2,_0x463868){const _0x7f31f7=_0x46a83d;return this.#t(),this.#e[_0x7f31f7(0x1dc)](_0x1b80a2,_0x463868);}async['loadIndex'](_0x31ca1c,_0x2b0d87){const _0x37298d=_0x46a83d;return this.#t(),this.#e[_0x37298d(0x206)](_0x31ca1c,_0x2b0d87);}async[_0x46a83d(0x209)](_0x3c174e,_0x1d7fbb){return this.#t(),this.#e['loadIndexes'](_0x3c174e,_0x1d7fbb);}async[_0x46a83d(0x1b3)](_0x3d6a17){const _0xcfd40=_0x46a83d;return this.#t(),this.#e[_0xcfd40(0x1b3)](_0x3d6a17);}async[_0x46a83d(0x1be)](_0x5d7b0d){return this.#t(),this.#e['unloadIndexes'](_0x5d7b0d);}async[_0x46a83d(0x1f5)](_0x496673,_0x33787a,_0x75a08f){return this.#t(),this.#e['query'](_0x496673,_0x33787a,_0x75a08f);}async[_0x46a83d(0x1f9)](_0x2d9d88,_0x29be49,_0x150e42){const _0x4cc838=_0x46a83d;return this.#t(),this.#e[_0x4cc838(0x1f9)](_0x2d9d88,_0x29be49,_0x150e42);}async['session'](_0x39dff9,_0x64c489=W,_0x8f92c7){const _0x21828c=_0x46a83d;this.#t();let _0x37c616=this.#e[_0x21828c(0x189)],_0xe6f658;if(this.#s!==null)_0xe6f658=await h[_0x21828c(0x215)](_0x39dff9,_0x64c489,this.#r,this.#s,void 0x0,_0x37c616,_0x8f92c7);else{let _0x5180c2=await this.#e[_0x21828c(0x205)](_0x39dff9,_0x64c489,_0x8f92c7);_0xe6f658=h[_0x21828c(0x1a8)](_0x39dff9,_0x64c489,_0x5180c2,_0x37c616);}await _0xe6f658['_warmModel']();for(let _0x467fe5 of this.#n)_0x467fe5['deref']()||this.#n[_0x21828c(0x18d)](_0x467fe5);return this.#n['add'](new WeakRef(_0xe6f658)),_0xe6f658;}#t(){const _0x57f93b=_0x46a83d;if(this.#i)throw new Error(_0x57f93b(0x1b7));}[_0x46a83d(0x164)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x348359=_0x46a83d;this.#i=!0x0;let _0x5f3da7=[...this.#n][_0x348359(0x1d1)](_0x51bad0=>_0x51bad0[_0x348359(0x162)]())['filter'](_0x44f62a=>_0x44f62a!==void 0x0);this.#n['clear'](),await Promise['all'](_0x5f3da7['map'](_0x57272b=>_0x57272b['close']())),await this.#e[_0x348359(0x164)]();}async[Symbol[_0x46a83d(0x1bb)]](){const _0x30010d=_0x46a83d;return this[_0x30010d(0x164)]();}};export{w as ManageApiError,D as MossClient,h as SessionIndex};
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
@@ -95,6 +95,9 @@ declare interface IdentityTarget {
95
95
  setIdentity(deviceId?: string | null, userId?: string | null, mossDeviceId?: string | null): void;
96
96
  }
97
97
 
98
+ /** True when `error` carries a stable Moss `code`, set by the native core or the SDK. */
99
+ export declare function isMossError(error: unknown): error is MossError;
100
+
98
101
  /**
99
102
  * ISO 8601 date string format.
100
103
  * @example "2025-09-26T15:04:05Z"
@@ -128,9 +131,14 @@ export declare interface LoadIndexesResult {
128
131
  */
129
132
  loaded: string[];
130
133
  /**
131
- * Names that failed to load, mapping name to error message.
134
+ * Names that failed to load, mapping name to a fixed public message.
132
135
  */
133
136
  failed: Record<string, string>;
137
+ /**
138
+ * Names that failed to load, mapping name to the error code. Set by the
139
+ * matching `@moss-js/moss-core`.
140
+ */
141
+ failedCodes?: Record<string, MossErrorCode>;
134
142
  }
135
143
 
136
144
  /**
@@ -519,7 +527,7 @@ export declare class MossClient {
519
527
  *
520
528
  * The index must have been loaded via `loadIndex()` or `loadIndexes()`;
521
529
  * queries run entirely in-memory with no network round-trip. Querying an
522
- * index that is not loaded rejects with an error naming the load call.
530
+ * index that is not loaded rejects with a `NOT_FOUND` error naming the load call.
523
531
  *
524
532
  * Loaded foundation indexes require an exact model artifact identity before
525
533
  * Moss can generate query embeddings locally. For an older identity-less
@@ -633,6 +641,21 @@ export declare interface MossClientOptions {
633
641
  identity?: MossIdentity;
634
642
  }
635
643
 
644
+ /**
645
+ * An `Error` with a stable `code`, from the native core or the SDK.
646
+ * A core failure carries fixed text for each kind of failure, and `detail`
647
+ * holds the core error text. An SDK error describes its cause and has no `detail`.
648
+ */
649
+ export declare interface MossError extends Error {
650
+ /** The kind of failure, stable across releases. */
651
+ code: MossErrorCode;
652
+ /** The core error text, for logs and support. Diagnostic text, not a stable contract. */
653
+ detail?: string;
654
+ }
655
+
656
+ /** Stable code on every error the native core or the SDK reports. */
657
+ export declare type MossErrorCode = "INVALID_ARGUMENT" | "NOT_FOUND" | "UNAUTHORIZED" | "NETWORK" | "DESERIALIZATION" | "MODEL_UNAVAILABLE" | "INTERNAL";
658
+
636
659
  /**
637
660
  * Caller-managed stable identity for a MossClient lifetime. Supplied values
638
661
  * must be 1-256 UTF-8 bytes with no leading or trailing whitespace, Unicode
@@ -848,8 +871,10 @@ export declare class SessionIndex {
848
871
  loadIndex(indexName: string, options?: LoadSessionOptions): Promise<number>;
849
872
  /**
850
873
  * Upload the session to the cloud, creating or replacing the index
851
- * with the same name. Documents are pushed with their locally-computed
852
- * embeddings — no server-side re-embedding.
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`.
853
878
  */
854
879
  pushIndex(): Promise<PushIndexResult>;
855
880
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moss-js/moss",
3
- "version": "1.15.0",
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.30.0"
48
+ "@moss-js/moss-core": "0.31.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^9.39.4",